34#include <wx/tokenzr.h>
45 wxString ret( aNetName );
47 ret.Replace(
"!",
"~" );
55 wxString token = aText;
61 bool sectionOpen =
false;
63 for( wxString::size_type i = 0; i < aText.size(); i++ )
66 if( aText[i] ==
'\\' )
68 if( i+1 < aText.size() )
69 text.Append( aText[i+1] );
78 if( ( i+1 < aText.size() && aText[i+1] ==
'{' )
96 static wxString escapeChars( wxT(
" )]}'\"" ) );
98 if( i+1 < aText.size() && escapeChars.Find( aText[i+1] ) == wxNOT_FOUND )
105 text.Append( aText[i] );
111 if( aText[i] ==
',' && sectionOpen )
117 text.Append( aText[i] );
126 if( aText->StartsWith(
'>' ) && aText->AfterFirst(
' ' ).IsEmpty() )
128 wxString token = aText->Upper();
130 if ( token == wxT(
">NAME" ) ) *aText = wxT(
"${REFERENCE}" );
131 else if( token == wxT(
">VALUE" ) ) *aText = wxT(
"${VALUE}" );
132 else if( token == wxT(
">PART" ) ) *aText = wxT(
"${REFERENCE}" );
133 else if( token == wxT(
">GATE" ) ) *aText = wxT(
"${UNIT}" );
134 else if( token == wxT(
">MODULE" ) ) *aText = wxT(
"${FOOTPRINT_NAME}" );
135 else if( token == wxT(
">SHEETNR" ) ) *aText = wxT(
"${#}" );
136 else if( token == wxT(
">SHEETS" ) ) *aText = wxT(
"${##}" );
137 else if( token == wxT(
">SHEET" ) ) *aText = wxT(
"${#}/${##}" );
138 else if( token == wxT(
">SHEETNR_TOTAL" ) ) *aText = wxT(
"${#}" );
139 else if( token == wxT(
">SHEETS_TOTAL" ) ) *aText = wxT(
"${##}" );
140 else if( token == wxT(
">SHEET_TOTAL" ) ) *aText = wxT(
"${#}/${##}" );
141 else if( token == wxT(
">SHEET_HEADLINE" ) ) *aText = wxT(
"${SHEETNAME}" );
142 else if( token == wxT(
">ASSEMBLY_VARIANT" ) ) *aText = wxT(
"${ASSEMBLY_VARIANT}" );
143 else if( token == wxT(
">DRAWING_NAME" ) ) *aText = wxT(
"${PROJECTNAME}" );
144 else if( token == wxT(
">LAST_DATE_TIME" ) ) *aText = wxT(
"${CURRENT_DATE}" );
145 else if( token == wxT(
">PLOT_DATE_TIME" ) ) *aText = wxT(
"${CURRENT_DATE}" );
146 else if( token == wxT(
">DATE" ) ) *aText = wxT(
"${ISSUE_DATE}" );
147 else *aText = wxString::Format( wxS(
"${%s}" ), aText->Mid( 1 ).Trim() );
158 aDescr.Replace( wxS(
"\n" ), wxS(
" " ) );
159 aDescr.Replace( wxS(
"\r" ), wxEmptyString );
161 wxRegEx( wxS(
"<a\\s+(?:[^>]*?\\s+)?href=\"([^\"]*)\"[^>]*>" ) ).ReplaceAll( &aDescr, wxS(
"\\1 " ) );
163 aDescr.Replace( wxS(
"<p>" ), wxS(
"\n\n" ) );
164 aDescr.Replace( wxS(
"</p>" ), wxS(
"\n\n" ) );
166 aDescr.Replace( wxS(
"<br>" ), wxS(
"\n" ) );
167 aDescr.Replace( wxS(
"<ul>" ), wxS(
"\n" ) );
168 aDescr.Replace( wxS(
"</ul>" ), wxS(
"\n\n" ) );
169 aDescr.Replace( wxS(
"<li></li>" ), wxS(
"\n" ) );
170 aDescr.Replace( wxS(
"<li>" ), wxS(
"\n \u2022 " ) );
174 wxRegEx( wxS(
"\n +" ) ).ReplaceAll( &aDescr, wxS(
"\n" ) );
175 wxRegEx( wxS(
" +\n" ) ).ReplaceAll( &aDescr, wxS(
"\n" ) );
177 wxRegEx( wxS(
"\n{3,}" ) ).ReplaceAll( &aDescr, wxS(
"\n\n" ) );
178 wxRegEx( wxS(
"^\n+" ) ).ReplaceAll( &aDescr, wxEmptyString );
179 wxRegEx( wxS(
"\n+$" ) ).ReplaceAll( &aDescr, wxEmptyString );
191 std::function<size_t(
const wxXmlNode* )> countNodes =
192 [&](
const wxXmlNode* node )
198 if(
const wxXmlNode* child = node->GetChildren() )
199 count += countNodes( child );
203 node = node->GetNext();
209 cnt = countNodes( aNode );
213 wxLogTrace(
traceEagleIo, wxS(
"XML node '%s' count = %zu took %0.4f ms." ), aNode->GetName(), cnt, timer.
msecs() );
223 static std::array<int, 9> DIVIDERS = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000 };
225 int integer, pre_fraction, post_fraction;
226 long long unsigned fraction;
230 bool negative = ( aValue[0] ==
'-' );
234 int ret = sscanf( aValue.c_str(),
"%d.%n%llu%n", &integer, &pre_fraction, &fraction, &post_fraction );
245 int digits = post_fraction - pre_fraction;
249 if( digits >=
static_cast<int>( DIVIDERS.size() ) )
251 long long unsigned denom = pow( 10, digits - DIVIDERS.size() + 1 );
252 digits = DIVIDERS.size() - 1;
256 int frac_value =
ConvertToNm( fraction, aUnit ) / DIVIDERS[digits];
271 case EU_NM: ret = aValue;
break;
272 case EU_MM: ret = (
long long) aValue * 1000000;
break;
273 case EU_INCH: ret = (
long long) aValue * 25400000;
break;
274 case EU_MIL: ret = (
long long) aValue * 25400;
break;
277 if( ( ret > 0 ) != ( aValue > 0 ) )
278 wxLogTrace(
traceEagleIo, wxT(
"Invalid size %d: too large" ), aValue );
292 wxStringTokenizer tokens( aUrn,
":" );
294 host = tokens.GetNextToken();
295 path = tokens.GetNextToken();
299 wxString tmp = tokens.GetNextToken();
301 assetId = tmp.BeforeFirst(
'/' );
314 static std::set<wxString> validAssetTypes =
324 if( validAssetTypes.count(
assetType ) == 0 )
353 return std::string( aValue.ToUTF8() );
362 if( aValue.ToCDouble( &value ) )
365 throw XML_PARSER_ERROR(
"Conversion to double failed. Original value: '" + aValue.ToStdString() +
"'." );
372 if( aValue.IsEmpty() )
373 throw XML_PARSER_ERROR(
"Conversion to int failed. Original value is empty." );
375 return wxAtoi( aValue );
382 if( aValue !=
"yes" && aValue !=
"no" )
384 throw XML_PARSER_ERROR(
"Conversion to bool failed. Original value, '" + aValue.ToStdString() +
385 "', is neither 'yes' nor 'no'." );
388 return aValue ==
"yes";
399 value.
spin = aRot.find(
'S' ) != aRot.npos;
400 value.
mirror = aRot.find(
'M' ) != aRot.npos;
402 size_t rPos = aRot.find(
'R' );
404 if( rPos == wxString::npos )
413 for( offset = 0; offset < aRot.size(); offset++ )
415 if( wxIsdigit( aRot[offset] ) )
419 wxString degreesStr = aRot.Mid( offset );
422 if( !degreesStr.ToCDouble( &value.
degrees ) )
457 if( aNode->GetAttribute( aAttribute, &value ) )
463 throw XML_PARSER_ERROR(
"The required attribute " + aAttribute +
" is missing at "
464 "line " + wxString::Format(
"%d", aNode->GetLineNumber() ) +
"." );
479 wxString value = aNode->GetAttribute( aAttribute );
481 if( value.IsEmpty() )
482 return std::optional<T>();
495 aCurrentNode = aCurrentNode->GetChildren();
497 while( aCurrentNode )
502 nodesMap[aCurrentNode->GetName()] = aCurrentNode;
505 aCurrentNode = aCurrentNode->GetNext();
516 double dx = aEnd.
x - aStart.
x, dy = aEnd.
y - aStart.
y;
517 VECTOR2I mid = ( aStart + aEnd ) / 2;
519 double dlen = sqrt( dx*dx + dy*dy );
521 if( !std::isnormal( dlen ) || !std::isnormal( aAngle ) )
529 double dist = dlen / ( 2 * tan(
DEG2RAD( aAngle ) / 2 ) );
532 mid.
x + dist * ( dy / dlen ),
533 mid.
y - dist * ( dx / dlen )
544 if( aAlignment ==
"center" )
546 else if( aAlignment ==
"center-right" )
548 else if( aAlignment ==
"top-left" )
550 else if( aAlignment ==
"top-center" )
552 else if( aAlignment ==
"top-right" )
554 else if( aAlignment ==
"bottom-left" )
556 else if( aAlignment ==
"bottom-center" )
558 else if( aAlignment ==
"bottom-right" )
560 else if( aAlignment ==
"center-left" )
572 io->Report( aMsg, aSeverity );
581 io->AdvanceProgressPhase();
616 if( s.value() ==
"continuous" )
618 else if( s.value() ==
"longdash" )
620 else if( s.value() ==
"shortdash" )
622 else if( s.value() ==
"dashdot" )
630 if( s.value() ==
"round" )
632 else if( s.value() ==
"flat" )
647 for( wxXmlNode* child = aSegment->GetChildren(); child; child = child->GetNext() )
649 if( child->GetName() ==
"pinref" )
650 pinRefs.emplace_back( std::make_unique<EPINREF>( child, aIo ) );
651 else if( child->GetName() ==
"portref" )
652 portRefs.emplace_back( std::make_unique<EPORTREF>( child, aIo ) );
653 else if( child->GetName() ==
"wire" )
654 wires.emplace_back( std::make_unique<EWIRE>( child, aIo ) );
655 else if( child->GetName() ==
"junction" )
656 junctions.emplace_back( std::make_unique<EJUNCTION>( child, aIo ) );
657 else if( child->GetName() ==
"label" )
658 labels.emplace_back( std::make_unique<ELABEL>( child, aIo ) );
659 else if( child->GetName() ==
"probe" )
660 probes.emplace_back( std::make_unique<EPROBE>( child, aIo ) );
678 for( wxXmlNode* child = aBus->GetChildren(); child; child = child->GetNext() )
680 if( child->GetName() ==
"segment" )
681 segments.emplace_back( std::make_unique<ESEGMENT>( child, aIo ) );
753 for( wxXmlNode* segment = aNet->GetChildren(); segment; segment = segment->GetNext() )
754 segments.emplace_back( std::make_unique<ESEGMENT>( segment ) );
850 text = aDescription->GetNodeContent();
892 if( stemp.has_value() )
895 if( stemp.value_or( wxEmptyString ) ==
"off" )
897 else if( stemp.value_or( wxEmptyString ) ==
"name" )
899 else if( stemp.value_or( wxEmptyString ) ==
"both" )
907 if( stemp.has_value() )
1031 text = aText->GetNodeContent();
1045 if( stemp.has_value() )
1056 if( font.has_value() )
1058 const wxString& fontName = font.value();
1060 if( fontName ==
"vector" )
1064 else if( fontName ==
"fixed" )
1175 else if( s ==
"round" )
1177 else if( s ==
"octagon" )
1179 else if( s ==
"long" )
1181 else if( s ==
"offset" )
1313 if( s.value() ==
"hatch" )
1315 else if( s.value() ==
"cutout" )
1323 for( wxXmlNode* child = aPolygon->GetChildren(); child; child = child->GetNext() )
1325 if( child->GetName() ==
"vertex" )
1326 vertices.emplace_back( std::make_unique<EVERTEX>( child, aIo ) );
1346 for( wxXmlNode* child = aSpline->GetChildren(); child; child = child->GetNext() )
1348 if( child->GetName() ==
"vertex" )
1349 vertices.emplace_back( std::make_unique<EVERTEX>( child, aIo ) );
1388 model = aModel->GetNodeContent();
1428 for( wxXmlNode* child = aPinMapping->GetChildren(); child; child = child->GetNext() )
1430 if( child->GetName() ==
"pinmap" )
1431 pinmaps.emplace_back( std::make_unique<EPINMAP>( child, aIo ) );
1444 pinmapping = std::make_unique<EPINMAPPING>( aSpice );
1446 if( aSpice->GetName() ==
"model" )
1447 model = std::make_unique<EMODEL>( aSpice );
1505 package = wxString::FromUTF8( p.c_str() );
1516 for( wxXmlNode* child = aElement->GetChildren(); child; child = child->GetNext() )
1518 if( child->GetName() ==
"attribute" )
1520 std::unique_ptr<EATTR> attr = std::make_unique<EATTR>( child, aIo );
1521 attributes[ attr->name ] = std::move( attr );
1523 else if( child->GetName() ==
"variant" )
1525 std::unique_ptr<EVARIANT> variant = std::make_unique<EVARIANT>( child, aIo );
1526 variants[ variant->name ] = std::move( variant );
1586 for( wxXmlNode* child = aPart->GetChildren(); child; child = child->GetNext() )
1588 if( child->GetName() ==
"attribute" )
1590 std::unique_ptr<EATTR> attr = std::make_unique<EATTR>( child, aIo );
1591 attributes[ attr->name ] = std::move( attr );
1593 else if( child->GetName() ==
"variant" )
1595 std::unique_ptr<EVARIANT> variant = std::make_unique<EVARIANT>( child, aIo );
1596 variants[ variant->name ] = std::move( variant );
1598 else if( child->GetName() ==
"spice" )
1600 spice = std::make_unique<ESPICE>( child, aIo );
1632 for( wxXmlNode* child = aInstance->GetChildren(); child; child = child->GetNext() )
1634 if( child->GetName() ==
"attribute" )
1636 std::unique_ptr<EATTR> attr = std::make_unique<EATTR>( child, aIo );
1637 attributes[ attr->name ] = std::move( attr );
1670 if( stemp.has_value() )
1673 if( stemp.value_or( wxEmptyString ) ==
"must" )
1675 else if( stemp.value_or( wxEmptyString ) ==
"can" )
1677 else if( stemp.value_or( wxEmptyString ) ==
"next" )
1679 else if( stemp.value_or( wxEmptyString ) ==
"request" )
1681 else if( stemp.value_or( wxEmptyString ) ==
"always" )
1723 for( wxXmlNode* child = aTechnology->GetChildren(); child; child = child->GetNext() )
1725 if( child->GetName() ==
"attribute" )
1726 attributes.emplace_back( std::make_unique<EATTR>( child, aIo ) );
1760 if( pack.has_value() )
1762 std::string p( pack.value().c_str() );
1764 package = wxString::FromUTF8( p.c_str() );
1767 for( wxXmlNode* child = aDevice->GetChildren(); child; child = child->GetNext() )
1769 if( child->GetName() ==
"connects" )
1771 for( wxXmlNode* connect = child->GetChildren(); connect; connect = connect->GetNext() )
1773 if( connect->GetName() ==
"connect" )
1774 connects.emplace_back( std::make_unique<ECONNECT>( connect, aIo ) );
1779 else if( child->GetName() ==
"packages3dinstances" )
1781 for( wxXmlNode* package3dinst = child->GetChildren(); package3dinst;
1782 package3dinst = package3dinst->GetNext() )
1784 if( package3dinst->GetName() ==
"package3dinstance" )
1785 package3dinstances.emplace_back( std::make_unique<EPACKAGE3DINST>( package3dinst, aIo ) );
1790 else if( child->GetName() ==
"technologies" )
1792 for( wxXmlNode* technology = child->GetChildren(); technology; technology = technology->GetNext() )
1794 if( technology->GetName() ==
"technology" )
1796 std::unique_ptr<ETECHNOLOGY> tmp = std::make_unique<ETECHNOLOGY>( technology, aIo );
1834 for( wxXmlNode* child = aDeviceSet->GetChildren(); child; child = child->GetNext() )
1836 if( child->GetName() ==
"description" )
1838 description = std::make_optional<EDESCRIPTION>( child, aIo );
1840 else if( child->GetName() ==
"gates" )
1842 for( wxXmlNode* gate = child->GetChildren(); gate; gate = gate->GetNext() )
1844 std::unique_ptr<EGATE> tmp = std::make_unique<EGATE>( gate, aIo );
1845 gates[tmp->name] = std::move( tmp );
1850 else if( child->GetName() ==
"devices" )
1852 for( wxXmlNode* device = child->GetChildren(); device; device = device->GetNext() )
1854 std::unique_ptr<EDEVICE> tmp = std::make_unique<EDEVICE>( device, aIo );
1855 devices[tmp->name] = std::move( tmp );
1860 else if( child->GetName() ==
"spice" )
1862 spice = std::make_optional<ESPICE>( child, aIo );
1887 for( wxXmlNode* child = aClass->GetChildren(); child; child = child->GetNext() )
1889 if( child->GetName() ==
"clearance" )
1911 for( wxXmlNode* child = aPlain->GetChildren(); child; child = child->GetNext() )
1913 if( child->GetName() ==
"polygon" )
1914 polygons.emplace_back( std::make_unique<EPOLYGON>( child, aIo ) );
1915 else if( child->GetName() ==
"wire" )
1916 wires.emplace_back( std::make_unique<EWIRE>( child, aIo ) );
1917 else if( child->GetName() ==
"text" )
1918 texts.emplace_back( std::make_unique<ETEXT>( child, aIo ) );
1919 else if( child->GetName() ==
"dimension" )
1920 dimensions.emplace_back( std::make_unique<EDIMENSION>( child, aIo ) );
1921 else if( child->GetName() ==
"circle" )
1922 circles.emplace_back( std::make_unique<ECIRCLE>( child, aIo ) );
1923 else if( child->GetName() ==
"spline" )
1924 splines.emplace_back( std::make_unique<ESPLINE>( child, aIo ) );
1925 else if( child->GetName() ==
"rectangle" )
1926 rectangles.emplace_back( std::make_unique<ERECT>( child, aIo ) );
1927 else if( child->GetName() ==
"frame" )
1928 frames.emplace_back( std::make_unique<EFRAME>( child, aIo ) );
1929 else if( child->GetName() ==
"hole" )
1930 holes.emplace_back( std::make_unique<EHOLE>( child, aIo ) );
1973 for( wxXmlNode* child = aSheet->GetChildren(); child; child = child->GetNext() )
1975 if( child->GetName() ==
"description" )
1977 description = std::make_optional<EDESCRIPTION>( child, aIo );
1979 else if( child->GetName() ==
"plain" )
1981 plain = std::make_unique<EPLAIN>( child, aIo );
1983 else if( child->GetName() ==
"moduleinsts" )
1985 for( wxXmlNode* moduleinst = child->GetChildren(); moduleinst;
1986 moduleinst = moduleinst->GetNext() )
1988 if( moduleinst->GetName() ==
"moduleinst" )
1990 std::unique_ptr<EMODULEINST> inst = std::make_unique<EMODULEINST>( moduleinst, aIo );
1991 moduleinsts[ inst->name ] = std::move( inst );
1997 else if( child->GetName() ==
"instances" )
1999 for( wxXmlNode* instance = child->GetChildren(); instance; instance = instance->GetNext() )
2001 if( instance->GetName() ==
"instance" )
2002 instances.emplace_back( std::make_unique<EINSTANCE>( instance, aIo ) );
2005 AdvanceProgressPhase();
2007 else if( child->GetName() ==
"busses" )
2009 for( wxXmlNode* bus = child->GetChildren(); bus; bus = bus->GetNext() )
2011 if( bus->GetName() ==
"bus" )
2012 busses.emplace_back( std::make_unique<EBUS>( bus, aIo ) );
2015 AdvanceProgressPhase();
2017 else if( child->GetName() ==
"nets" )
2019 for( wxXmlNode* net = child->GetChildren(); net; net = net->GetNext() )
2021 if( net->GetName() ==
"net" )
2022 nets.emplace_back( std::make_unique<ENET>( net, aIo ) );
2025 AdvanceProgressPhase();
2029 AdvanceProgressPhase();
2060 for( wxXmlNode* child = aSchematicGroup->GetChildren(); child; child = child->GetNext() )
2062 if( child->GetName() ==
"description" )
2064 description = std::make_optional<EDESCRIPTION>( child, aIo );
2066 else if( child->GetName() ==
"attribute" )
2068 attributes.emplace_back( std::make_unique<EATTR>( child, aIo ) );
2093 for( wxXmlNode* child = aModule->GetChildren(); child; child = child->GetNext() )
2095 if( child->GetName() ==
"description" )
2097 description = std::make_optional<EDESCRIPTION>( child, aIo );
2099 else if( child->GetName() ==
"ports" )
2101 for( wxXmlNode* port = child->GetChildren(); port; port = port->GetNext() )
2103 if( port->GetName() ==
"port" )
2105 std::unique_ptr<EPORT> tmp = std::make_unique<EPORT>( port, aIo );
2106 ports[ tmp->name ] = std::move( tmp );
2112 else if( child->GetName() ==
"variantdefs" )
2114 for( wxXmlNode* variantdef = child->GetChildren(); variantdef;
2115 variantdef = variantdef->GetNext() )
2117 if( variantdef->GetName() ==
"variantdef" )
2119 std::unique_ptr<EVARIANTDEF> tmp = std::make_unique<EVARIANTDEF>( variantdef,
2127 else if( child->GetName() ==
"groups" )
2131 if(
group->GetName() ==
"schematic_group" )
2133 std::unique_ptr<ESCHEMATIC_GROUP> tmp =
2134 std::make_unique<ESCHEMATIC_GROUP>(
group, aIo );
2135 groups[ tmp->name ] = std::move( tmp );
2141 else if( child->GetName() ==
"parts" )
2143 for( wxXmlNode* part = child->GetChildren(); part; part = part->GetNext() )
2145 if( part->GetName() ==
"part" )
2147 std::unique_ptr<EPART> tmp = std::make_unique<EPART>( part, aIo );
2148 parts[ tmp->name ] = std::move( tmp );
2154 else if( child->GetName() ==
"sheets" )
2156 for( wxXmlNode* sheet = child->GetChildren(); sheet; sheet = sheet->GetNext() )
2158 if( sheet->GetName() ==
"sheet" )
2159 sheets.emplace_back( std::make_unique<ESHEET>( sheet, aIo ) );
2222 note = aNote->GetNodeContent();
2234 for( wxXmlNode* child = aCompatibility->GetNext(); child; child = child->GetNext() )
2236 if( child->GetName() ==
"note" )
2237 notes.emplace_back( std::make_unique<ENOTE>( child ) );
2333 for( wxXmlNode* child = aPackage->GetChildren(); child; child = child->GetNext() )
2335 if( child->GetName() ==
"description" )
2337 description = std::make_optional<EDESCRIPTION>( child, aIo );
2339 else if( child->GetName() ==
"polygon" )
2341 polygons.emplace_back( std::make_unique<EPOLYGON>( child, aIo ) );
2343 else if( child->GetName() ==
"wire" )
2345 wires.emplace_back( std::make_unique<EWIRE>( child, aIo ) );
2347 else if( child->GetName() ==
"text" )
2349 texts.emplace_back( std::make_unique<ETEXT>( child, aIo ) );
2351 else if( child->GetName() ==
"dimension" )
2353 dimensions.emplace_back( std::make_unique<EDIMENSION>( child, aIo ) );
2355 else if( child->GetName() ==
"circle" )
2357 circles.emplace_back( std::make_unique<ECIRCLE>( child, aIo ) );
2359 else if( child->GetName() ==
"rectangle" )
2361 rectangles.emplace_back( std::make_unique<ERECT>( child, aIo ) );
2363 else if( child->GetName() ==
"frame" )
2365 frames.emplace_back( std::make_unique<EFRAME>( child, aIo ) );
2367 else if( child->GetName() ==
"hole" )
2369 holes.emplace_back( std::make_unique<EHOLE>( child, aIo ) );
2371 else if( child->GetName() ==
"pad" )
2373 thtpads.emplace_back( std::make_unique<EPAD>( child, aIo ) );
2375 else if( child->GetName() ==
"smd" )
2377 smdpads.emplace_back( std::make_unique<ESMD>( child, aIo ) );
2421 for( wxXmlNode* child = aPackage3d->GetChildren(); child; child = child->GetNext() )
2423 if( child->GetName() ==
"description" )
2425 description = std::make_optional<EDESCRIPTION>( child, aIo );
2427 else if( child->GetName() ==
"packageinstances" )
2429 for( wxXmlNode* instance = child->GetChildren(); instance;
2430 instance = instance->GetNext() )
2431 packageinstances.emplace_back( std::make_unique<EPACKAGEINSTANCE>( instance, aIo ) );
2464 for( wxXmlNode* child = aSymbol->GetChildren(); child; child = child->GetNext() )
2466 if( child->GetName() ==
"description" )
2468 description = std::make_optional<EDESCRIPTION>( child, aIo );
2470 else if( child->GetName() ==
"polygon" )
2472 polygons.emplace_back( std::make_unique<EPOLYGON>( child, aIo ) );
2474 else if( child->GetName() ==
"wire" )
2476 wires.emplace_back( std::make_unique<EWIRE>( child, aIo ) );
2478 else if( child->GetName() ==
"text" )
2480 texts.emplace_back( std::make_unique<ETEXT>( child, aIo ) );
2482 else if( child->GetName() ==
"dimension" )
2484 dimensions.emplace_back( std::make_unique<EDIMENSION>( child, aIo ) );
2486 else if( child->GetName() ==
"pin" )
2488 pins.emplace_back( std::make_unique<EPIN>( child, aIo ) );
2490 else if( child->GetName() ==
"circle" )
2492 circles.emplace_back( std::make_unique<ECIRCLE>( child, aIo ) );
2494 else if( child->GetName() ==
"rectangle" )
2496 rectangles.emplace_back( std::make_unique<ERECT>( child, aIo ) );
2498 else if( child->GetName() ==
"frame" )
2500 frames.emplace_back( std::make_unique<EFRAME>( child, aIo ) );
2522 wxString parentNodeName;
2524 if( aLibrary->GetParent() )
2525 parentNodeName = aLibrary->GetParent()->GetName();
2527 if( parentNodeName ==
"libraries" )
2529 name = parseRequiredAttribute<wxString>( aLibrary,
"name" );
2530 urn = parseOptionalAttribute<EURN>( aLibrary,
"urn" );
2533 for( wxXmlNode* child = aLibrary->GetChildren(); child; child = child->GetNext() )
2535 if( child->GetName() ==
"description" )
2537 description = std::make_optional<EDESCRIPTION>( child, aIo );
2539 else if( child->GetName() ==
"packages" )
2541 for( wxXmlNode* package = child->GetChildren(); package; package = package->GetNext() )
2543 if( package->GetName() ==
"package" )
2545 std::unique_ptr<EPACKAGE> tmp = std::make_unique<EPACKAGE>( package, aIo );
2546 packages[ tmp->name ] = std::move( tmp );
2552 else if( child->GetName() ==
"packages3d" )
2554 for( wxXmlNode* package3d = child->GetChildren(); package3d;
2555 package3d = package3d->GetNext() )
2557 if( package3d->GetName() ==
"package3d" )
2559 std::unique_ptr<EPACKAGE3D> tmp = std::make_unique<EPACKAGE3D>( package3d,
2561 packages3d[ tmp->name ] = std::move( tmp );
2565 AdvanceProgressPhase();
2567 else if( child->GetName() ==
"symbols" )
2569 for( wxXmlNode* symbol = child->GetChildren(); symbol; symbol = symbol->GetNext() )
2571 if( symbol->GetName() ==
"symbol" )
2573 std::unique_ptr<ESYMBOL> tmp = std::make_unique<ESYMBOL>( symbol, aIo );
2574 symbols[ tmp->name ] = std::move( tmp );
2578 AdvanceProgressPhase();
2580 else if( child->GetName() ==
"devicesets" )
2582 for( wxXmlNode* deviceset = child->GetChildren(); deviceset;
2583 deviceset = deviceset->GetNext() )
2585 if( deviceset->GetName() ==
"deviceset" )
2587 std::unique_ptr<EDEVICE_SET> tmp = std::make_unique<EDEVICE_SET>( deviceset,
2589 devicesets[ tmp->name ] = std::move( tmp );
2593 AdvanceProgressPhase();
2597 AdvanceProgressPhase();
2603 wxString libName =
name;
2606 if( !
urn.has_value() )
2612 if(
urn.value().IsValid() )
2613 libName += wxS(
"_" ) +
urn.value().assetId;
2648 for( wxXmlNode* child = aSchematic->GetChildren(); child; child = child->GetNext() )
2650 if( child->GetName() ==
"description" )
2652 description = std::make_optional<EDESCRIPTION>( child, aIo );
2654 else if( child->GetName() ==
"libraries" )
2658 if(
library->GetName() ==
"library" )
2660 std::unique_ptr<ELIBRARY> tmp = std::make_unique<ELIBRARY>(
library, aIo );
2662 wxString libName = tmp->GetName();
2668 wxString uniqueName;
2669 std::set<wxString> usedNames;
2671 for(
const auto& [setName, setLibrary] :
libraries )
2672 usedNames.emplace( setName );
2677 for(
int i = 1; i <= (int) usedNames.size() + 1; i++ )
2679 uniqueName.Format( wxS(
"%s_%d" ), libName, i );
2681 if( usedNames.find( uniqueName ) == usedNames.end() )
2685 libName = uniqueName;
2688 libraries[ libName ] = std::move( tmp );
2694 else if( child->GetName() ==
"attributes" )
2696 for( wxXmlNode* attribute = child->GetChildren(); attribute;
2697 attribute = attribute->GetNext() )
2699 if( attribute->GetName() ==
"attribute" )
2701 std::unique_ptr<EATTR> tmp = std::make_unique<EATTR>( attribute, aIo );
2708 else if( child->GetName() ==
"variantdefs" )
2710 for( wxXmlNode* variantdef = child->GetChildren(); variantdef;
2711 variantdef = variantdef->GetNext() )
2713 if( variantdef->GetName() ==
"variantdef" )
2715 std::unique_ptr<EVARIANTDEF> tmp = std::make_unique<EVARIANTDEF>( variantdef,
2723 else if( child->GetName() ==
"classes" )
2725 for( wxXmlNode* eclass = child->GetChildren(); eclass; eclass = eclass->GetNext() )
2727 if( eclass->GetName() ==
"class" )
2729 std::unique_ptr<ECLASS> tmp = std::make_unique<ECLASS>( eclass, aIo );
2730 classes[ tmp->number ] = std::move( tmp );
2736 else if( child->GetName() ==
"modules" )
2738 for( wxXmlNode* mod = child->GetChildren(); mod; mod = mod->GetNext() )
2740 if( mod->GetName() ==
"module" )
2742 std::unique_ptr<EMODULE> tmp = std::make_unique<EMODULE>( mod, aIo );
2743 modules[ tmp->name ] = std::move( tmp );
2749 else if( child->GetName() ==
"groups" )
2753 if(
group->GetName() ==
"schematic_group" )
2755 std::unique_ptr<ESCHEMATIC_GROUP> tmp =
2756 std::make_unique<ESCHEMATIC_GROUP>(
group, aIo );
2757 groups[ tmp->name ] = std::move( tmp );
2763 else if( child->GetName() ==
"parts" )
2765 for( wxXmlNode* part = child->GetChildren(); part; part = part->GetNext() )
2767 if( part->GetName() ==
"part" )
2769 std::unique_ptr<EPART> tmp = std::make_unique<EPART>( part, aIo );
2770 parts[ tmp->name ] = std::move( tmp );
2776 else if( child->GetName() ==
"sheets" )
2778 for( wxXmlNode* sheet = child->GetChildren(); sheet; sheet = sheet->GetNext() )
2780 if( sheet->GetName() ==
"sheet" )
2781 sheets.emplace_back( std::make_unique<ESHEET>( sheet, aIo ) );
2786 else if( child->GetName() ==
"errors" )
2788 for( wxXmlNode* error = child->GetChildren(); error; error = error->GetNext() )
2790 if( error->GetName() ==
"approved" )
2791 errors.emplace_back( std::make_unique<EAPPROVED>( error, aIo ) );
2808 for( wxXmlNode* child = aDrawing->GetChildren(); child; child = child->GetNext() )
2810 if( child->GetName() ==
"settings" )
2812 for( wxXmlNode* setting = child->GetChildren(); setting; setting = setting->GetNext() )
2813 settings.emplace_back( std::make_unique<ESETTING>( setting, aIo ) );
2815 AdvanceProgressPhase();
2817 else if( child->GetName() ==
"grid" )
2819 grid = std::make_optional<EGRID>( child, aIo );
2821 else if( child->GetName() ==
"filters" )
2823 for( wxXmlNode* filter = child->GetChildren(); filter; filter = filter->GetNext() )
2825 if( filter->GetName() ==
"filter" )
2826 filters.emplace_back( std::make_unique<EFILTER>( filter, aIo ) );
2831 else if( child->GetName() ==
"layers" )
2833 for( wxXmlNode* layer = child->GetChildren(); layer; layer = layer->GetNext() )
2835 if( layer->GetName() ==
"layer" )
2836 layers.emplace_back( std::make_unique<ELAYER>( layer, aIo ) );
2839 AdvanceProgressPhase();
2841 else if( child->GetName() ==
"schematic" )
2843 schematic = std::make_optional<ESCHEMATIC>( child, aIo );
2845 else if( child->GetName() ==
"library" )
2847 library = std::make_optional<ELIBRARY>( child, aIo );
2853 AdvanceProgressPhase();
2871 for( wxXmlNode* child = aEagleDoc->GetChildren(); child; child = child->GetNext() )
2873 if( child->GetName() ==
"compitibility" )
2874 compatibility = std::make_optional<ECOMPATIBILITY>( child, aIo );
2875 else if( child->GetName() ==
"drawing" )
2876 drawing = std::make_unique<EDRAWING>( child, aIo );
A small class to help profiling.
void Stop()
Save the time when this function was called, and set the counter stane to stop.
double msecs(bool aSinceLast=false)
EURN Convert< EURN >(const wxString &aUrn)
std::string Convert< std::string >(const wxString &aValue)
static int parseAlignment(const wxString &aAlignment)
NODE_MAP MapChildren(wxXmlNode *aCurrentNode)
Provide an easy access to the children of an XML node via their names.
double Convert< double >(const wxString &aValue)
wxString escapeName(const wxString &aNetName)
Translates Eagle special characters to their counterparts in KiCad.
wxString interpretText(const wxString &aText)
Interprets special characters in Eagle text and converts them to KiCAD notation.
bool substituteVariable(wxString *aText)
Translates Eagle special text reference to a KiCad variable reference.
constexpr auto DEFAULT_ALIGNMENT
int Convert< int >(const wxString &aValue)
wxString Convert< wxString >(const wxString &aValue)
size_t GetNodeCount(const wxXmlNode *aNode)
Fetch the number of XML nodes within aNode.
std::optional< T > parseOptionalAttribute(wxXmlNode *aNode, const wxString &aAttribute)
Parse option aAttribute of the XML node aNode.
EROT Convert< EROT >(const wxString &aRot)
parse an Eagle XML "rot" field.
T parseRequiredAttribute(wxXmlNode *aNode, const wxString &aAttribute)
Parse aAttribute of the XML node aNode.
bool Convert< bool >(const wxString &aValue)
ECOORD Convert< ECOORD >(const wxString &aCoord)
VECTOR2I ConvertEagleTextSize(const std::optional< wxString > &font, const ECOORD &size)
Converts Eagle's text size to KiCad text size depending on the font used.
VECTOR2I ConvertArcCenter(const VECTOR2I &aStart, const VECTOR2I &aEnd, double aAngle)
Convert an Eagle curve end to a KiCad center for S_ARC.
wxString convertDescription(wxString aDescr)
Converts Eagle's HTML description into KiCad description format.
T Convert(const wxString &aValue)
Convert a wxString to a generic type T.
std::unordered_map< wxString, wxXmlNode * > NODE_MAP
VECTOR2I ConvertEagleTextSize(const std::optional< wxString > &font, const ECOORD &size)
Converts Eagle's text size to KiCad text size depending on the font used.
const wxChar *const traceEagleIo
#define THROW_IO_ERRORF(msg,...)
wxString RemoveHTMLTags(const wxString &aInput)
Removes HTML tags from a string.
wxString ConvertToNewOverbarNotation(const wxString &aOldStr)
Convert the old ~...~ overbar notation to the new ~{...} one.
bool ReplaceIllegalFileNameChars(std::string &aName, int aReplaceChar)
Checks aName for illegal file name characters.
EAGLE_BASE(IO_BASE *aIo=nullptr)
void AdvanceProgressPhase()
void Report(const wxString &aMsg, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Send a message to the IO_BASE REPORTER object if one exists.
EAGLE_DOC(wxXmlNode *aEagleDoc, IO_BASE *aIo=nullptr)
std::optional< ECOMPATIBILITY > compatibility
wxString version
The Eagle XML file version.
std::unique_ptr< EDRAWING > drawing
EAPPROVED(wxXmlNode *aApproved, IO_BASE *aIo=nullptr)
std::optional< int > layer
std::optional< ECOORD > y
std::optional< wxString > value
std::optional< ECOORD > size
std::optional< int > align
std::optional< EROT > rot
std::optional< double > ratio
std::optional< int > display
std::optional< ECOORD > x
EBUS(wxXmlNode *aBus, IO_BASE *aIo=nullptr)
std::vector< std::unique_ptr< ESEGMENT > > segments
ECIRCLE(wxXmlNode *aCircle, IO_BASE *aIo=nullptr)
std::optional< ECOORD > width
std::map< wxString, ECOORD > clearanceMap
std::optional< ECOORD > drill
ECLASS(wxXmlNode *aClass, IO_BASE *aIo=nullptr)
ECOMPATIBILITY(wxXmlNode *aCompatibility, IO_BASE *aIo=nullptr)
std::optional< wxString > contactroute
ECONNECT(wxXmlNode *aConnect, IO_BASE *aIo=nullptr)
long long int value
Value expressed in nanometers.
static long long int ConvertToNm(int aValue, enum EAGLE_UNIT aUnit)
Converts a size expressed in a certain unit to nanometers.
std::optional< wxString > language
EDESCRIPTION(wxXmlNode *aDescription, IO_BASE *aIo=nullptr)
std::map< wxString, std::unique_ptr< EDEVICE > > devices
std::optional< wxString > prefix
std::optional< EURN > urn
std::optional< EDESCRIPTION > description
EDEVICE_SET(wxXmlNode *aDeviceSet, IO_BASE *aIo=nullptr)
std::optional< bool > locally_modified
std::map< wxString, std::unique_ptr< EGATE > > gates
std::optional< int > library_version
std::optional< ESPICE > spice
std::optional< bool > uservalue
std::optional< bool > library_locally_modified
std::vector< std::unique_ptr< EPACKAGE3DINST > > package3dinstances
std::vector< std::unique_ptr< ECONNECT > > connects
EDEVICE(wxXmlNode *aDevice, IO_BASE *aIo=nullptr)
std::map< wxString, std::unique_ptr< ETECHNOLOGY > > technologies
std::optional< wxString > dimensionType
std::optional< ECOORD > textsize
EDIMENSION(wxXmlNode *aDimension, IO_BASE *aIo=nullptr)
EDRAWING(wxXmlNode *aDrawing, IO_BASE *aIo=nullptr)
EELEMENT(wxXmlNode *aElement, IO_BASE *aIo=nullptr)
std::optional< bool > locked
std::optional< bool > smashed
std::optional< EROT > rot
std::optional< EURN > library_urn
std::map< wxString, std::unique_ptr< EATTR > > attributes
std::map< wxString, std::unique_ptr< EVARIANT > > variants
EFILTER(wxXmlNode *aGrid, IO_BASE *aIo=nullptr)
std::optional< bool > border_bottom
std::optional< bool > border_top
EFRAME(wxXmlNode *aFrameNode, IO_BASE *aIo=nullptr)
std::optional< bool > border_left
std::optional< bool > border_right
std::optional< int > addlevel
std::optional< int > swaplevel
EGATE(wxXmlNode *aGate, IO_BASE *aIo=nullptr)
std::optional< double > distance
std::optional< int > multiple
std::optional< bool > display
std::optional< wxString > altunitdist
EGRID(wxXmlNode *aGrid, IO_BASE *aIo=nullptr)
std::optional< wxString > unit
std::optional< wxString > altunit
std::optional< double > altdistance
std::optional< wxString > unitdist
std::optional< wxString > style
EHOLE(wxXmlNode *aHole, IO_BASE *aIo=nullptr)
std::optional< EROT > rot
std::map< wxString, std::unique_ptr< EATTR > > attributes
std::optional< bool > smashed
EINSTANCE(wxXmlNode *aInstance, IO_BASE *aIo=nullptr)
EJUNCTION(wxXmlNode *aJunction, IO_BASE *aIo=nullptr)
std::optional< EROT > rot
std::optional< int > ratio
std::optional< bool > xref
ELABEL(wxXmlNode *aLabel, IO_BASE *aIo=nullptr)
std::optional< wxString > font
std::optional< wxString > align
std::optional< bool > active
std::optional< bool > visible
ELAYER(wxXmlNode *aLayer, IO_BASE *aIo=nullptr)
wxString GetName() const
Fetch the fully unique library name.
std::optional< EURN > urn
ELIBRARY(wxXmlNode *aLibrary, IO_BASE *aIo=nullptr)
EMODEL(wxXmlNode *aModel, IO_BASE *aIo=nullptr)
EMODULEINST(wxXmlNode *aModuleInst, IO_BASE *aIo=nullptr)
std::optional< wxString > moduleVariant
std::optional< int > offset
std::optional< EROT > rotation
std::optional< bool > smashed
std::map< wxString, std::unique_ptr< EPART > > parts
std::optional< wxString > prefix
std::map< wxString, std::unique_ptr< ESCHEMATIC_GROUP > > groups
std::vector< std::unique_ptr< ESHEET > > sheets
std::optional< EDESCRIPTION > description
EMODULE(wxXmlNode *aModule, IO_BASE *aIo=nullptr)
std::map< wxString, std::unique_ptr< EVARIANTDEF > > variantdefs
std::map< wxString, std::unique_ptr< EPORT > > ports
std::vector< std::unique_ptr< ESEGMENT > > segments
ENOTE(wxXmlNode *aNote, IO_BASE *aIo=nullptr)
EPACKAGE3DINST(wxXmlNode *aPackage3dInst, IO_BASE *aIo=nullptr)
std::optional< bool > library_locally_modified
std::optional< EDESCRIPTION > description
std::vector< std::unique_ptr< EPACKAGEINSTANCE > > packageinstances
std::optional< int > library_version
EPACKAGE3D(wxXmlNode *aPackage3d, IO_BASE *aIo=nullptr)
EPACKAGEINSTANCE(wxXmlNode *aPackageInstance, IO_BASE *aIo=nullptr)
std::vector< std::unique_ptr< EPOLYGON > > polygons
std::optional< int > library_version
std::vector< std::unique_ptr< EPAD > > thtpads
std::vector< std::unique_ptr< ECIRCLE > > circles
std::vector< std::unique_ptr< ESMD > > smdpads
std::optional< bool > library_locally_modified
std::vector< std::unique_ptr< EDIMENSION > > dimensions
std::optional< EURN > urn
std::vector< std::unique_ptr< EHOLE > > holes
std::vector< std::unique_ptr< EFRAME > > frames
std::vector< std::unique_ptr< ERECT > > rectangles
std::vector< std::unique_ptr< ETEXT > > texts
std::vector< std::unique_ptr< EWIRE > > wires
std::optional< EDESCRIPTION > description
EPACKAGE(wxXmlNode *aPackage, IO_BASE *aIo=nullptr)
std::optional< bool > locally_modified
EPAD_COMMON(wxXmlNode *aPad, IO_BASE *aIo=nullptr)
std::optional< bool > thermals
std::optional< EROT > rot
std::optional< bool > stop
std::optional< bool > first
std::optional< ECOORD > diameter
std::optional< int > shape
EPAD(wxXmlNode *aPad, IO_BASE *aIo=nullptr)
std::optional< ECOORD > drill
std::optional< wxString > technology
std::optional< wxString > value
std::unique_ptr< ESPICE > spice
std::optional< bool > override_locally_modified
std::map< wxString, std::unique_ptr< EATTR > > attributes
std::optional< EURN > libraryUrn
EPART(wxXmlNode *aPart, IO_BASE *aIo=nullptr)
std::optional< wxString > override_package_urn
std::optional< wxString > override_package3d_urn
std::optional< wxString > package3d_urn
std::map< wxString, std::unique_ptr< EVARIANT > > variants
EPINMAPPING(wxXmlNode *aPinMap, IO_BASE *aIo=nullptr)
std::optional< bool > iddevicewide
std::optional< wxString > spiceprefix
std::vector< std::unique_ptr< EPINMAP > > pinmaps
std::optional< bool > isusermap
EPINMAP(wxXmlNode *aPinMap, IO_BASE *aIo=nullptr)
EPINREF(wxXmlNode *aPinRef, IO_BASE *aIo=nullptr)
std::optional< wxString > length
std::optional< wxString > function
std::optional< wxString > visible
EPIN(wxXmlNode *aPin, IO_BASE *aIo=nullptr)
std::optional< int > swaplevel
std::optional< EROT > rot
std::optional< wxString > direction
EPLAIN(wxXmlNode *aPlain, IO_BASE *aIo=nullptr)
std::optional< ECOORD > isolate
std::vector< std::unique_ptr< EVERTEX > > vertices
EPOLYGON(wxXmlNode *aPolygon, IO_BASE *aIo=nullptr)
std::optional< int > rank
std::optional< ECOORD > spacing
std::optional< bool > thermals
std::optional< bool > orphans
EPORTREF(wxXmlNode *aPortRef, IO_BASE *aIo=nullptr)
std::optional< wxString > direction
EPORT(wxXmlNode *aPort, IO_BASE *aIo=nullptr)
std::optional< int > ratio
std::optional< EROT > rot
std::optional< bool > xref
std::optional< wxString > font
EPROBE(wxXmlNode *aProbe, IO_BASE *aIo=nullptr)
std::optional< EROT > rot
ERECT(wxXmlNode *aRect, IO_BASE *aIo=nullptr)
std::optional< ECOORD > width
std::vector< std::unique_ptr< EATTR > > attributes
ESCHEMATIC_GROUP(wxXmlNode *aSchematicGroup, IO_BASE *aIo=nullptr)
std::optional< ECOORD > titleSize
std::optional< bool > selectable
std::optional< EDESCRIPTION > description
std::optional< wxString > wireStyle
std::optional< int > layer
std::optional< bool > showAnnotations
std::optional< wxString > grouprefs
std::optional< wxString > titleFont
std::optional< wxString > xreflabel
std::map< wxString, std::unique_ptr< EMODULE > > modules
std::map< wxString, std::unique_ptr< EATTR > > attributes
std::vector< std::unique_ptr< EAPPROVED > > errors
std::optional< EDESCRIPTION > description
std::map< wxString, std::unique_ptr< ECLASS > > classes
std::vector< std::unique_ptr< ESHEET > > sheets
std::map< wxString, std::unique_ptr< EPART > > parts
ESCHEMATIC(wxXmlNode *aSchematic, IO_BASE *aIo=nullptr)
std::map< wxString, std::unique_ptr< ELIBRARY > > libraries
std::map< wxString, std::unique_ptr< EVARIANTDEF > > variantdefs
std::optional< wxString > xrefpart
std::map< wxString, std::unique_ptr< ESCHEMATIC_GROUP > > groups
ESEGMENT(wxXmlNode *aSegment, IO_BASE *aIo=nullptr)
std::optional< bool > alwaysvectorfont
std::optional< bool > keepoldvectorfont
std::optional< wxString > verticaltext
ESETTING(wxXmlNode *aSetting, IO_BASE *aIo=nullptr)
ESHEET(wxXmlNode *aSheet, IO_BASE *aIo=nullptr)
std::optional< bool > cream
ESMD(wxXmlNode *aSMD, IO_BASE *aIo=nullptr)
std::optional< int > roundness
ESPICE(wxXmlNode *aSpice, IO_BASE *aIo=nullptr)
std::unique_ptr< EMODEL > model
std::unique_ptr< EPINMAPPING > pinmapping
std::vector< std::unique_ptr< EVERTEX > > vertices
ESPLINE(wxXmlNode *aSpline, IO_BASE *aIo=nullptr)
std::vector< std::unique_ptr< EFRAME > > frames
std::optional< EDESCRIPTION > description
std::optional< bool > locally_modified
std::optional< bool > library_locally_modified
std::optional< int > library_version
std::vector< std::unique_ptr< EPIN > > pins
std::vector< std::unique_ptr< ECIRCLE > > circles
std::vector< std::unique_ptr< ETEXT > > texts
std::vector< std::unique_ptr< EPOLYGON > > polygons
std::vector< std::unique_ptr< ERECT > > rectangles
std::vector< std::unique_ptr< EWIRE > > wires
ESYMBOL(wxXmlNode *aSymbol, IO_BASE *aIo=nullptr)
std::optional< EURN > urn
std::vector< std::unique_ptr< EDIMENSION > > dimensions
std::vector< std::unique_ptr< EATTR > > attributes
ETECHNOLOGY(wxXmlNode *aTechnology, IO_BASE *aIo=nullptr)
std::optional< wxString > font
ETEXT(wxXmlNode *aText, IO_BASE *aIo=nullptr)
std::optional< EROT > rot
std::optional< int > align
VECTOR2I ConvertSize() const
Calculate text size based on font type and size.
std::optional< double > ratio
Container that parses Eagle library file "urn" definitions.
bool IsValid() const
Check if the string passed to the ctor was a valid Eagle urn.
wxString host
Should always be "urn".
void Parse(const wxString &aUrn)
wxString assetVersion
May be empty depending on the asset type.
wxString assetId
The unique asset identifier for the asset type.
wxString assetType
Must be "symbol", "footprint", "package", "component", or "library".
wxString path
Path to the asset type below.
EVARIANTDEF(wxXmlNode *aVariantDef, IO_BASE *aIo=nullptr)
std::optional< bool > current
EVARIANT(wxXmlNode *aVariant, IO_BASE *aIo=nullptr)
std::optional< bool > populate
std::optional< wxString > technology
std::optional< wxString > value
EVERTEX(wxXmlNode *aVertex, IO_BASE *aIo=nullptr)
std::optional< double > curve
range is -359.9..359.9
std::optional< wxString > shape
EVIA(wxXmlNode *aVia, IO_BASE *aIo=nullptr)
std::optional< ECOORD > diam
int layer_back_most
< extent
EWIRE(wxXmlNode *aWire, IO_BASE *aIo=nullptr)
std::optional< int > style
std::optional< double > curve
range is -359.9..359.9
Implement a simple wrapper around runtime_error to isolate the errors thrown by the Eagle XML parser.
wxLogTrace helper definitions.
double DEG2RAD(double deg)
VECTOR2< int32_t > VECTOR2I