LibrePCB Developers Documentation
|
Helper class to convert EAGLE types to LibrePCB types. More...
#include <eagletypeconverter.h>
Classes | |
struct | Geometry |
Intermediate geometry type used for converting polygon-like EAGLE elements. More... | |
struct | Pin |
LibrePCB data structure to represent an EAGLE symbol pin. More... | |
Public Member Functions | |
EagleTypeConverter ()=delete | |
EagleTypeConverter (const EagleTypeConverter &other)=delete | |
~EagleTypeConverter ()=delete | |
EagleTypeConverter & | operator= (const EagleTypeConverter &rhs)=delete |
template<> | |
Length | convertParamTo (const parseagle::Param &p) |
template<> | |
UnsignedLength | convertParamTo (const parseagle::Param &p) |
template<> | |
PositiveLength | convertParamTo (const parseagle::Param &p) |
template<> | |
Ratio | convertParamTo (const parseagle::Param &p) |
template<> | |
UnsignedRatio | convertParamTo (const parseagle::Param &p) |
Static Public Member Functions | |
static ElementName | convertElementName (const QString &n) |
Convert an element (e.g. symbol) name. More... | |
static QString | convertElementDescription (const QString &d) |
Convert an element (e.g. symbol) description. More... | |
static ElementName | convertComponentName (QString n) |
Convert a component name. More... | |
static ElementName | convertDeviceName (const QString &deviceSetName, const QString &deviceName) |
Convert a device name. More... | |
static ComponentPrefix | convertComponentPrefix (const QString &p) |
Convert a component prefix. More... | |
static ComponentSymbolVariantItemSuffix | convertGateName (const QString &n) |
Convert a component gate name. More... | |
static CircuitIdentifier | convertPinOrPadName (const QString &n) |
Convert a pin or pad name. More... | |
static QString | convertInversionSyntax (const QString &s) noexcept |
Convert the inversion syntax of a text. More... | |
static std::shared_ptr< Attribute > | tryConvertAttribute (const parseagle::Attribute &a, MessageLogger &log) |
Try converting an attribute. More... | |
static void | tryConvertAttributes (const QList< parseagle::Attribute > &in, AttributeList &out, MessageLogger &log) |
Try converting a list of attributes. More... | |
static void | tryExtractMpnAndManufacturer (AttributeList &attributes, SimpleString &mpn, SimpleString &manufacturer) noexcept |
Try extracting MPN and manufacturer from a list of attributes. More... | |
static const Layer * | tryConvertSchematicLayer (int id) noexcept |
Try to convert a layer ID to a schematic layer. More... | |
static const Layer * | tryConvertBoardLayer (int id) noexcept |
Try to convert a layer ID to a board layer. More... | |
static QHash< const Layer *, const Layer * > | convertLayerSetup (const QString &s) |
Convert a layer setup string. More... | |
static Alignment | convertAlignment (parseagle::Alignment a) |
Convert an alignment. More... | |
static Length | convertLength (double l) |
Convert a length. More... | |
static UnsignedLength | convertLineWidth (double w, int layerId) |
Convert a line width for a given layer. More... | |
template<typename T > | |
static T | convertParamTo (const parseagle::Param &p) |
Convert a parameter value to a LibrePCB type. More... | |
static Point | convertPoint (const parseagle::Point &p) |
Convert a point. More... | |
static Angle | convertAngle (double a) |
Convert an angle. More... | |
static void | convertGrid (const parseagle::Grid &g, PositiveLength &interval, LengthUnit &unit) |
Convert grid settings. More... | |
static Vertex | convertVertex (const parseagle::Vertex &v) |
Convert a vertex. More... | |
static Path | convertVertices (const QList< parseagle::Vertex > &v, bool close) |
Convert vertices. More... | |
static QList< Geometry > | convertAndJoinWires (const QList< parseagle::Wire > &wires, bool isGrabAreaIfClosed, MessageLogger &log) |
Try to join and convert multiple wires to polygons. More... | |
static Geometry | convertRectangle (const parseagle::Rectangle &r, bool isGrabArea) |
Convert a rectangle. More... | |
static Geometry | convertPolygon (const parseagle::Polygon &p, bool isGrabArea) |
Convert a polygon. More... | |
static Geometry | convertCircle (const parseagle::Circle &c, bool isGrabArea) |
Convert a circle. More... | |
static std::shared_ptr< Hole > | convertHole (const parseagle::Hole &h) |
Convert a hole. More... | |
static Geometry | convertFrame (const parseagle::Frame &f) |
Convert a frame. More... | |
static QString | convertTextValue (const QString &v) |
Convert a text value. More... | |
static PositiveLength | convertSchematicTextSize (double s) |
Convert the size (height) of a schematic text. More... | |
static std::shared_ptr< Text > | tryConvertSchematicText (const parseagle::Text &t) |
Try to convert a schematic/symbol text. More... | |
static std::shared_ptr< Text > | tryConvertSchematicAttribute (const parseagle::Attribute &t) |
Try to convert a schematic/symbol attribute text. More... | |
static PositiveLength | convertBoardTextSize (int layerId, double size) |
Convert the size (height) of a board text. More... | |
static UnsignedLength | convertBoardTextStrokeWidth (int layerId, double size, int ratio) |
Convert the stroke width of a board text. More... | |
static std::shared_ptr< StrokeText > | tryConvertBoardText (const parseagle::Text &t) |
Try to cnvert a board/footprint text. More... | |
static std::shared_ptr< StrokeText > | tryConvertBoardAttribute (const parseagle::Attribute &t) |
Try to convert a board/footprint attribute text. More... | |
static Pin | convertSymbolPin (const parseagle::Pin &p) |
Convert a symbol pin. More... | |
static std::pair< std::shared_ptr< PackagePad >, std::shared_ptr< FootprintPad > > | convertThtPad (const parseagle::ThtPad &p, const BoundedUnsignedRatio &autoAnnularWidth) |
Convert a THT pad. More... | |
static std::pair< std::shared_ptr< PackagePad >, std::shared_ptr< FootprintPad > > | convertSmtPad (const parseagle::SmtPad &p) |
Convert an SMT pad. More... | |
static std::shared_ptr< Circle > | tryConvertToSchematicCircle (const Geometry &g) |
Try to convert an intermediate geometry to a schematic circle. More... | |
static std::shared_ptr< Polygon > | tryConvertToSchematicPolygon (const Geometry &g) |
Try to convert an intermediate geometry to a schematic polygon. More... | |
static QVector< Path > | convertBoardZoneOutline (const Path &outline, const Length &lineWidth) |
Convert the outline of a board zone. More... | |
static QVector< std::shared_ptr< Zone > > | tryConvertToBoardZones (const Geometry &g) |
Try to convert an intermediate geometry to board keepout zones. More... | |
static std::shared_ptr< Circle > | tryConvertToBoardCircle (const Geometry &g) |
Try to convert an intermediate geometry to a board circle. More... | |
static std::shared_ptr< Polygon > | tryConvertToBoardPolygon (const Geometry &g) |
Try to convert an intermediate geometry to a board polygon. More... | |
static QString | getLayerName (int id, const QString &fallback="unknown") noexcept |
Get the EAGLE layer name for a given layer ID. More... | |
static BoundedUnsignedRatio | getDefaultAutoThtAnnularWidth () noexcept |
Get the default annular width of THT pads with 'auto' size. More... | |
Helper class to convert EAGLE types to LibrePCB types.
|
delete |
|
delete |
|
delete |
|
static |
Convert an element (e.g. symbol) name.
Removes all invalid characters from an EAGLE element name and convert it to the corresponding LibrePCB type. If completely invalid, "Unnamed" will be returned (no error).
n | EAGLE element name (e.g. "R-0805") |
|
static |
Convert an element (e.g. symbol) description.
Removes HTML tags and returns only the plain text.
d | EAGLE element description (might contain HTML) |
|
static |
Convert a component name.
Like convertElementName(), but also removes trailing separation characters.
n | EAGLE component name (e.g. "R-0805-") |
|
static |
Convert a device name.
Like convertElementName(), but concatenating the EAGLE device set name with the EAGLE device name.
deviceSetName | EAGLE device set name |
deviceName | EAGLE device name |
|
static |
Convert a component prefix.
Removes all invalid characters and returns the component prefix in the corresponding LibrePCB type.
p | EAGLE device set prefix |
|
static |
Convert a component gate name.
Removes all invalid characters and returns the gate name as component symbol variant item suffix.
n | EAGLE gate name |
|
static |
Convert a pin or pad name.
Removes all invalid characters and returns the name as a circuit identifier.
n | EAGLE pin or pad name |
|
staticnoexcept |
Convert the inversion syntax of a text.
s | EAGLE text possibly containing inversion signs (e.g. "!RST!/EN") |
|
static |
Try converting an attribute.
a | EAGLE attribute |
log | Message logger |
|
static |
Try converting a list of attributes.
in | EAGLE attribute list |
out | List where converted attributes are appended to |
log | Message logger |
|
staticnoexcept |
Try extracting MPN and manufacturer from a list of attributes.
attributes | Arbitrary attributes. Found MPN and manufacturer attributes will be removed from it. |
mpn | The found MPN (unmodified if not found) |
manufacturer | The found manufacturer name (unmodified if not found) |
|
staticnoexcept |
Try to convert a layer ID to a schematic layer.
id | EAGLE layer ID |
nullptr
to discard object)
|
staticnoexcept |
Try to convert a layer ID to a board layer.
id | EAGLE layer ID |
nullptr
to discard object) Convert a layer setup string.
s | EAGLE layer setup string (e.g. "[2:1+((2*3)+(14*15))+16:15]") |
|
static |
Convert an alignment.
a | EAGLE alignment |
|
static |
Convert a length.
l | EAGLE length [mm] |
|
static |
Convert a line width for a given layer.
Applies line width rules for some special purpose layers (like board outline).
w | EAGLE line width [mm] |
layerId | EAGLE layer ID |
|
static |
Convert a parameter value to a LibrePCB type.
Return | type, e.g. :librepcb::Length, librepcb::PositiveLength or librepcb::Ratio |
p | EAGLE parameter |
If | the value could not be converted |
|
static |
Convert a point.
p | EAGLE point [mm] |
|
static |
Convert an angle.
a | EAGLE angle [°] |
|
static |
Convert grid settings.
g | EAGLE grid settings |
interval | LibrePCB grid interval (output) |
unit | LibrePCB grid unit (output) |
|
static |
Convert a vertex.
v | EAGLE vertex |
|
static |
Convert vertices.
v | EAGLE vertices |
close | If true, the returned path will always be closed |
|
static |
Try to join and convert multiple wires to polygons.
wires | EAGLE wires |
isGrabAreaIfClosed | If true, grab area will be enabled on closed polygons |
log | Logging message handler |
|
static |
Convert a rectangle.
r | EAGLE rectangle |
isGrabArea | If the returned geometry should be a grab area |
|
static |
Convert a polygon.
p | EAGLE polygon |
isGrabArea | If the returned geometry should be a grab area |
|
static |
Convert a circle.
c | EAGLE circle |
isGrabArea | If the returned geometry should be a grab area |
|
static |
Convert a hole.
h | EAGLE hole |
|
static |
Convert a frame.
f | EAGLE frame |
|
static |
Convert a text value.
v | EAGLE text value (e.g. ">NAME") |
|
static |
Convert the size (height) of a schematic text.
s | EAGLE text size [mm] |
|
static |
Try to convert a schematic/symbol text.
t | EAGLE text |
nullptr
|
static |
Try to convert a schematic/symbol attribute text.
t | EAGLE attribute text |
nullptr
|
static |
Convert the size (height) of a board text.
layerId | EAGLE layer ID |
size | EAGLE text size [mm] |
|
static |
Convert the stroke width of a board text.
layerId | EAGLE layer ID |
size | EAGLE text size [mm] |
ratio | EAGLE text ratio [%] |
|
static |
Try to cnvert a board/footprint text.
t | EAGLE text |
nullptr
|
static |
Try to convert a board/footprint attribute text.
t | EAGLE attribute text |
nullptr
|
static |
Convert a symbol pin.
p | EAGLE pin |
|
static |
Convert a THT pad.
p | EAGLE pad |
autoAnnularWidth | How to calculate the annular width (and thus the outer pad size) if it is set to 'auto' in EAGLE. See getDefaultAutoThtAnnularWidth(). |
|
static |
Convert an SMT pad.
p | EAGLE pad |
Try to convert an intermediate geometry to a schematic circle.
g | intermediate geometry |
nullptr
Try to convert an intermediate geometry to a schematic polygon.
g | intermediate geometry |
nullptr
Convert the outline of a board zone.
Our zones do not support setting aline width, so we have to offet the outline to get the same keepout area.
outline | EAGLE keepout zone outline |
lineWidth | EAGLE keepout zone line width |
Try to convert an intermediate geometry to board keepout zones.
g | intermediate geometry |
Try to convert an intermediate geometry to a board circle.
g | intermediate geometry |
nullptr
Try to convert an intermediate geometry to a board polygon.
g | intermediate geometry |
nullptr
|
staticnoexcept |
Get the EAGLE layer name for a given layer ID.
id | EAGLE layer ID |
fallback | The string to return if the given layer is unknown |
|
staticnoexcept |
Get the default annular width of THT pads with 'auto' size.
This is the value used by the EAGLE footprint editor.
|
delete |
Length convertParamTo | ( | const parseagle::Param & | p | ) |
UnsignedLength convertParamTo | ( | const parseagle::Param & | p | ) |
PositiveLength convertParamTo | ( | const parseagle::Param & | p | ) |
Ratio convertParamTo | ( | const parseagle::Param & | p | ) |
UnsignedRatio convertParamTo | ( | const parseagle::Param & | p | ) |