20#ifndef LIBREPCB_EAGLEIMPORT_EAGLETYPECONVERTER_H
21#define LIBREPCB_EAGLEIMPORT_EAGLETYPECONVERTER_H
44#include <optional/tl/optional.hpp>
45#include <parseagle/common/enums.h>
83namespace eagleimport {
108 tl::optional<std::pair<Point, PositiveLength>>
circle;
115 std::shared_ptr<SymbolPin>
pin;
173 const QString& deviceName);
328 template <
typename T>
392 const QList<parseagle::Wire>& wires,
bool isGrabAreaIfClosed,
433 static std::shared_ptr<Hole>
convertHole(
const parseagle::Hole& h);
470 const parseagle::Text& t);
480 const parseagle::Attribute& t);
512 const parseagle::Text& t);
522 const parseagle::Attribute& t);
543 static std::pair<std::shared_ptr<PackagePad>, std::shared_ptr<FootprintPad>>
554 static std::pair<std::shared_ptr<PackagePad>, std::shared_ptr<FootprintPad>>
630 const QString& fallback =
"unknown") noexcept;
The Alignment class.
Definition: alignment.h:115
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:78
The BoundedUnsignedRatio class represents a ratio limited to a range specified by min/max values.
Definition: boundedunsignedratio.h:46
The Layer class provides all supported geometry layers.
Definition: layer.h:42
The Length class is used to represent a length (for example 12.75 millimeters)
Definition: length.h:83
The LengthUnit class represents a length unit (millimeters, inches,...) and provides some useful meth...
Definition: lengthunit.h:60
Generic logger class to pass messages between objects.
Definition: messagelogger.h:43
The Path class represents a list of vertices connected by straight lines or circular arc segments.
Definition: path.h:58
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition: point.h:79
The Vertex class.
Definition: vertex.h:44
Helper class to convert EAGLE types to LibrePCB types.
Definition: eagletypeconverter.h:92
static std::shared_ptr< Circle > tryConvertToBoardCircle(const Geometry &g)
Try to convert an intermediate geometry to a board circle.
Definition: eagletypeconverter.cpp:988
static UnsignedLength convertLineWidth(double w, int layerId)
Convert a line width for a given layer.
Definition: eagletypeconverter.cpp:380
static void convertGrid(const parseagle::Grid &g, PositiveLength &interval, LengthUnit &unit)
Convert grid settings.
Definition: eagletypeconverter.cpp:449
EagleTypeConverter()=delete
static void tryConvertAttributes(const QList< parseagle::Attribute > &in, AttributeList &out, MessageLogger &log)
Try converting a list of attributes.
Definition: eagletypeconverter.cpp:155
EagleTypeConverter(const EagleTypeConverter &other)=delete
static Geometry convertPolygon(const parseagle::Polygon &p, bool isGrabArea)
Convert a polygon.
Definition: eagletypeconverter.cpp:553
static T convertParamTo(const parseagle::Param &p)
Convert a parameter value to a LibrePCB type.
static QString convertInversionSyntax(const QString &s) noexcept
Convert the inversion syntax of a text.
Definition: eagletypeconverter.cpp:122
static std::shared_ptr< Text > tryConvertSchematicAttribute(const parseagle::Attribute &t)
Try to convert a schematic/symbol attribute text.
Definition: eagletypeconverter.cpp:648
static ElementName convertDeviceName(const QString &deviceSetName, const QString &deviceName)
Convert a device name.
Definition: eagletypeconverter.cpp:86
static std::shared_ptr< Text > tryConvertSchematicText(const parseagle::Text &t)
Try to convert a schematic/symbol text.
Definition: eagletypeconverter.cpp:628
static std::pair< std::shared_ptr< PackagePad >, std::shared_ptr< FootprintPad > > convertThtPad(const parseagle::ThtPad &p, const BoundedUnsignedRatio &autoAnnularWidth)
Convert a THT pad.
Definition: eagletypeconverter.cpp:810
static ComponentSymbolVariantItemSuffix convertGateName(const QString &n)
Convert a component gate name.
Definition: eagletypeconverter.cpp:105
static const Layer * tryConvertBoardLayer(int id) noexcept
Try to convert a layer ID to a board layer.
Definition: eagletypeconverter.cpp:219
static Vertex convertVertex(const parseagle::Vertex &v)
Convert a vertex.
Definition: eagletypeconverter.cpp:469
~EagleTypeConverter()=delete
static Geometry convertFrame(const parseagle::Frame &f)
Convert a frame.
Definition: eagletypeconverter.cpp:591
static Geometry convertRectangle(const parseagle::Rectangle &r, bool isGrabArea)
Convert a rectangle.
Definition: eagletypeconverter.cpp:536
static Angle convertAngle(double a)
Convert an angle.
Definition: eagletypeconverter.cpp:445
static ComponentPrefix convertComponentPrefix(const QString &p)
Convert a component prefix.
Definition: eagletypeconverter.cpp:100
static QHash< const Layer *, const Layer * > convertLayerSetup(const QString &s)
Convert a layer setup string.
Definition: eagletypeconverter.cpp:321
static std::shared_ptr< StrokeText > tryConvertBoardText(const parseagle::Text &t)
Try to cnvert a board/footprint text.
Definition: eagletypeconverter.cpp:712
static Pin convertSymbolPin(const parseagle::Pin &p)
Convert a symbol pin.
Definition: eagletypeconverter.cpp:762
static Point convertPoint(const parseagle::Point &p)
Convert a point.
Definition: eagletypeconverter.cpp:441
static PositiveLength convertSchematicTextSize(double s)
Convert the size (height) of a schematic text.
Definition: eagletypeconverter.cpp:624
static CircuitIdentifier convertPinOrPadName(const QString &n)
Convert a pin or pad name.
Definition: eagletypeconverter.cpp:111
static std::shared_ptr< Attribute > tryConvertAttribute(const parseagle::Attribute &a, MessageLogger &log)
Try converting an attribute.
Definition: eagletypeconverter.cpp:143
static std::pair< std::shared_ptr< PackagePad >, std::shared_ptr< FootprintPad > > convertSmtPad(const parseagle::SmtPad &p)
Convert an SMT pad.
Definition: eagletypeconverter.cpp:881
static std::shared_ptr< Circle > tryConvertToSchematicCircle(const Geometry &g)
Try to convert an intermediate geometry to a schematic circle.
Definition: eagletypeconverter.cpp:918
static Path convertVertices(const QList< parseagle::Vertex > &v, bool close)
Convert vertices.
Definition: eagletypeconverter.cpp:473
static QList< Geometry > convertAndJoinWires(const QList< parseagle::Wire > &wires, bool isGrabAreaIfClosed, MessageLogger &log)
Try to join and convert multiple wires to polygons.
Definition: eagletypeconverter.cpp:485
static Length convertLength(double l)
Convert a length.
Definition: eagletypeconverter.cpp:376
static Alignment convertAlignment(parseagle::Alignment a)
Convert an alignment.
Definition: eagletypeconverter.cpp:351
static BoundedUnsignedRatio getDefaultAutoThtAnnularWidth() noexcept
Get the default annular width of THT pads with 'auto' size.
Definition: eagletypeconverter.cpp:1129
static QString getLayerName(int id, const QString &fallback="unknown") noexcept
Get the EAGLE layer name for a given layer ID.
Definition: eagletypeconverter.cpp:1009
static UnsignedLength convertBoardTextStrokeWidth(int layerId, double size, int ratio)
Convert the stroke width of a board text.
Definition: eagletypeconverter.cpp:688
static Geometry convertCircle(const parseagle::Circle &c, bool isGrabArea)
Convert a circle.
Definition: eagletypeconverter.cpp:565
static ElementName convertComponentName(QString n)
Convert a component name.
Definition: eagletypeconverter.cpp:79
static QString convertTextValue(const QString &v)
Convert a text value.
Definition: eagletypeconverter.cpp:610
static std::shared_ptr< Polygon > tryConvertToSchematicPolygon(const Geometry &g)
Try to convert an intermediate geometry to a schematic polygon.
Definition: eagletypeconverter.cpp:930
static std::shared_ptr< StrokeText > tryConvertBoardAttribute(const parseagle::Attribute &t)
Try to convert a board/footprint attribute text.
Definition: eagletypeconverter.cpp:737
static std::shared_ptr< Polygon > tryConvertToBoardPolygon(const Geometry &g)
Try to convert an intermediate geometry to a board polygon.
Definition: eagletypeconverter.cpp:1000
static QVector< std::shared_ptr< Zone > > tryConvertToBoardZones(const Geometry &g)
Try to convert an intermediate geometry to board keepout zones.
Definition: eagletypeconverter.cpp:952
static const Layer * tryConvertSchematicLayer(int id) noexcept
Try to convert a layer ID to a schematic layer.
Definition: eagletypeconverter.cpp:188
static std::shared_ptr< Hole > convertHole(const parseagle::Hole &h)
Convert a hole.
Definition: eagletypeconverter.cpp:581
static ElementName convertElementName(const QString &n)
Convert an element (e.g. symbol) name.
Definition: eagletypeconverter.cpp:62
static QString convertElementDescription(const QString &d)
Convert an element (e.g. symbol) description.
Definition: eagletypeconverter.cpp:70
static PositiveLength convertBoardTextSize(int layerId, double size)
Convert the size (height) of a board text.
Definition: eagletypeconverter.cpp:668
static QVector< Path > convertBoardZoneOutline(const Path &outline, const Length &lineWidth)
Convert the outline of a board zone.
Definition: eagletypeconverter.cpp:939
static void tryExtractMpnAndManufacturer(AttributeList &attributes, SimpleString &mpn, SimpleString &manufacturer) noexcept
Try extracting MPN and manufacturer from a list of attributes.
Definition: eagletypeconverter.cpp:167
Definition: occmodel.cpp:77
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:812
type_safe::constrained_type< QString, CircuitIdentifierConstraint, CircuitIdentifierVerifier > CircuitIdentifier
Definition: circuitidentifier.h:96
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition: length.h:696
type_safe::constrained_type< QString, ComponentPrefixConstraint, ComponentPrefixVerifier > ComponentPrefix
Definition: componentprefix.h:85
type_safe::constrained_type< QString, SimpleStringConstraint, SimpleStringVerifier > SimpleString
Definition: simplestring.h:80
type_safe::constrained_type< QString, ComponentSymbolVariantItemSuffixConstraint, ComponentSymbolVariantItemSuffixVerifier > ComponentSymbolVariantItemSuffix
Definition: componentsymbolvariantitemsuffix.h:89
type_safe::constrained_type< QString, ElementNameConstraint, ElementNameVerifier > ElementName
Definition: elementname.h:84
Definition: eaglelibraryconverter.h:38
Intermediate geometry type used for converting polygon-like EAGLE elements.
Definition: eagletypeconverter.h:102
UnsignedLength lineWidth
Definition: eagletypeconverter.h:104
bool grabArea
Definition: eagletypeconverter.h:106
int layerId
Definition: eagletypeconverter.h:103
bool filled
Definition: eagletypeconverter.h:105
tl::optional< std::pair< Point, PositiveLength > > circle
Definition: eagletypeconverter.h:108
Path path
Definition: eagletypeconverter.h:107
LibrePCB data structure to represent an EAGLE symbol pin.
Definition: eagletypeconverter.h:114
std::shared_ptr< Circle > circle
Definition: eagletypeconverter.h:116
std::shared_ptr< Polygon > polygon
Definition: eagletypeconverter.h:117
std::shared_ptr< SymbolPin > pin
Definition: eagletypeconverter.h:115