47 wxString ret( aNetName );
49 ret.Replace(
"!",
"~" );
57 wxString token = aText;
63 bool sectionOpen =
false;
65 for( wxString::size_type i = 0; i < aText.size(); i++ )
68 if( aText[ i ] ==
'\\' )
70 if( i + 1 != aText.size() )
71 text.Append( aText[ i + 1 ] );
85 if( aText[ i ] ==
'!' )
94 static wxString escapeChars( wxT(
" )]}'\"" ) );
96 if( i + 1 != aText.size() && escapeChars.Find( aText[i + 1] ) == wxNOT_FOUND )
103 text.Append( aText[ i ] );
109 if( aText[i] ==
',' && sectionOpen )
115 text.Append( aText[ i ] );
124 if( aText->StartsWith(
'>' ) && aText->AfterFirst(
' ' ).IsEmpty() )
126 wxString token = aText->Upper();
128 if ( token == wxT(
">NAME" ) ) *aText = wxT(
"${REFERENCE}" );
129 else if( token == wxT(
">VALUE" ) ) *aText = wxT(
"${VALUE}" );
130 else if( token == wxT(
">PART" ) ) *aText = wxT(
"${REFERENCE}" );
131 else if( token == wxT(
">GATE" ) ) *aText = wxT(
"${UNIT}" );
132 else if( token == wxT(
">MODULE" ) ) *aText = wxT(
"${FOOTPRINT_NAME}" );
133 else if( token == wxT(
">SHEETNR" ) ) *aText = wxT(
"${#}" );
134 else if( token == wxT(
">SHEETS" ) ) *aText = wxT(
"${##}" );
135 else if( token == wxT(
">SHEET" ) ) *aText = wxT(
"${#}/${##}" );
136 else if( token == wxT(
">SHEETNR_TOTAL" ) ) *aText = wxT(
"${#}" );
137 else if( token == wxT(
">SHEETS_TOTAL" ) ) *aText = wxT(
"${##}" );
138 else if( token == wxT(
">SHEET_TOTAL" ) ) *aText = wxT(
"${#}/${##}" );
139 else if( token == wxT(
">SHEET_HEADLINE" ) ) *aText = wxT(
"${SHEETNAME}" );
140 else if( token == wxT(
">ASSEMBLY_VARIANT" ) ) *aText = wxT(
"${ASSEMBLY_VARIANT}" );
141 else if( token == wxT(
">DRAWING_NAME" ) ) *aText = wxT(
"${PROJECTNAME}" );
142 else if( token == wxT(
">LAST_DATE_TIME" ) ) *aText = wxT(
"${CURRENT_DATE}" );
143 else if( token == wxT(
">PLOT_DATE_TIME" ) ) *aText = wxT(
"${CURRENT_DATE}" );
144 else *aText = wxString::Format( wxS(
"${%s}" ), aText->Mid( 1 ).Trim() );
155 aDescr.Replace( wxS(
"\n" ), wxS(
" " ) );
156 aDescr.Replace( wxS(
"\r" ), wxEmptyString );
158 wxRegEx( wxS(
"<a\\s+(?:[^>]*?\\s+)?href=\"([^\"]*)\"[^>]*>" ) )
159 .ReplaceAll( &aDescr, wxS(
"\\1 " ) );
161 aDescr.Replace( wxS(
"<p>" ), wxS(
"\n\n" ) );
162 aDescr.Replace( wxS(
"</p>" ), wxS(
"\n\n" ) );
164 aDescr.Replace( wxS(
"<br>" ), wxS(
"\n" ) );
165 aDescr.Replace( wxS(
"<ul>" ), wxS(
"\n" ) );
166 aDescr.Replace( wxS(
"</ul>" ), wxS(
"\n\n" ) );
167 aDescr.Replace( wxS(
"<li></li>" ), wxS(
"\n" ) );
168 aDescr.Replace( wxS(
"<li>" ), wxS(
"\n \u2022 " ) );
172 wxRegEx( wxS(
"\n +" ) ).ReplaceAll( &aDescr, wxS(
"\n" ) );
173 wxRegEx( wxS(
" +\n" ) ).ReplaceAll( &aDescr, wxS(
"\n" ) );
175 wxRegEx( wxS(
"\n{3,}" ) ).ReplaceAll( &aDescr, wxS(
"\n\n" ) );
176 wxRegEx( wxS(
"^\n+" ) ).ReplaceAll( &aDescr, wxEmptyString );
177 wxRegEx( wxS(
"\n+$" ) ).ReplaceAll( &aDescr, wxEmptyString );
189 std::function<size_t(
const wxXmlNode* )> countNodes =
190 [&](
const wxXmlNode* node )
196 if(
const wxXmlNode* child = node->GetChildren() )
197 count += countNodes( child );
201 node = node->GetNext();
207 cnt = countNodes( aNode );
211 wxLogTrace(
traceEagleIo, wxS(
"XML node '%s' count = %zu took %0.4f ms." ),
212 aNode->GetName(), cnt, timer.
msecs() );
221 m_isAvailable = !aData.IsEmpty();
232 constexpr int DIVIDERS[] = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000 };
233 constexpr unsigned int DIVIDERS_MAX_IDX =
sizeof( DIVIDERS ) /
sizeof( DIVIDERS[0] ) - 1;
235 int integer, fraction, pre_fraction, post_fraction;
239 bool negative = ( aValue[0] ==
'-' );
243 int ret = sscanf( aValue.c_str(),
"%d.%n%d%n", &integer, &pre_fraction, &fraction,
255 int digits = post_fraction - pre_fraction;
259 if( (
unsigned) digits > DIVIDERS_MAX_IDX )
261 int diff = digits - DIVIDERS_MAX_IDX;
262 digits = DIVIDERS_MAX_IDX;
263 fraction /= DIVIDERS[diff];
266 int frac_value =
ConvertToNm( fraction, aUnit ) / DIVIDERS[digits];
281 case EU_NM: ret = aValue;
break;
282 case EU_MM: ret = (
long long) aValue * 1000000;
break;
283 case EU_INCH: ret = (
long long) aValue * 25400000;
break;
284 case EU_MIL: ret = (
long long) aValue * 25400;
break;
287 if( ( ret > 0 ) != ( aValue > 0 ) )
288 wxLogError(
_(
"Invalid size %lld: too large" ), aValue );
313 return std::string( aValue.ToUTF8() );
322 if( aValue.ToCDouble( &value ) )
326 aValue.ToStdString() +
"'." );
333 if( aValue.IsEmpty() )
334 throw XML_PARSER_ERROR(
"Conversion to int failed. Original value is empty." );
336 return wxAtoi( aValue );
343 if( aValue !=
"yes" && aValue !=
"no" )
345 aValue.ToStdString() +
346 "', is neither 'yes' nor 'no'." );
348 return aValue ==
"yes";
359 value.
spin = aRot.find(
'S' ) != aRot.npos;
360 value.
mirror = aRot.find(
'M' ) != aRot.npos;
361 value.
degrees = strtod( aRot.c_str()
392 if( aNode->GetAttribute( aAttribute, &value ) )
393 return Convert<T>( value );
395 throw XML_PARSER_ERROR(
"The required attribute " + aAttribute +
" is missing at "
396 "line " + wxString::Format(
"%d", aNode->GetLineNumber() ) +
423 aCurrentNode = aCurrentNode->GetChildren();
425 while( aCurrentNode )
430 nodesMap[aCurrentNode->GetName()] = aCurrentNode;
433 aCurrentNode = aCurrentNode->GetNext();
444 double dx = aEnd.
x - aStart.
x, dy = aEnd.
y - aStart.
y;
445 VECTOR2I mid = ( aStart + aEnd ) / 2;
447 double dlen = sqrt( dx*dx + dy*dy );
449 if( !std::isnormal( dlen ) || !std::isnormal( aAngle ) )
451 THROW_IO_ERROR( wxString::Format(
_(
"Invalid Arc with radius %f and angle %f" ),
456 double dist = dlen / ( 2 * tan(
DEG2RAD( aAngle ) / 2 ) );
459 mid.
x + dist * ( dy / dlen ),
460 mid.
y - dist * ( dx / dlen )
471 if( aAlignment ==
"center" )
473 else if( aAlignment ==
"center-right" )
475 else if( aAlignment ==
"top-left" )
477 else if( aAlignment ==
"top-center" )
479 else if( aAlignment ==
"top-right" )
481 else if( aAlignment ==
"bottom-left" )
483 else if( aAlignment ==
"bottom-center" )
485 else if( aAlignment ==
"bottom-right" )
487 else if( aAlignment ==
"center-left" )
531 x1 = parseRequiredAttribute<ECOORD>( aWire,
"x1" );
532 y1 = parseRequiredAttribute<ECOORD>( aWire,
"y1" );
533 x2 = parseRequiredAttribute<ECOORD>( aWire,
"x2" );
534 y2 = parseRequiredAttribute<ECOORD>( aWire,
"y2" );
535 width = parseRequiredAttribute<ECOORD>( aWire,
"width" );
536 layer = parseRequiredAttribute<int>( aWire,
"layer" );
537 curve = parseOptionalAttribute<double>( aWire,
"curve" );
539 opt_wxString s = parseOptionalAttribute<wxString>( aWire,
"style" );
541 if( s ==
"continuous" )
543 else if( s ==
"longdash" )
545 else if( s ==
"shortdash" )
547 else if( s ==
"dashdot" )
550 s = parseOptionalAttribute<wxString>( aWire,
"cap" );
554 else if( s ==
"flat" )
568 for( wxXmlNode* child = aSegment->GetChildren(); child; child = child->GetNext() )
570 if( child->GetName() ==
"pinref" )
571 pinRefs.emplace_back( std::make_unique<EPINREF>( child, aIo ) );
572 else if( child->GetName() ==
"portref" )
573 portRefs.emplace_back( std::make_unique<EPORTREF>( child, aIo ) );
574 else if( child->GetName() ==
"wire" )
575 wires.emplace_back( std::make_unique<EWIRE>( child, aIo ) );
576 else if( child->GetName() ==
"junction" )
577 junctions.emplace_back( std::make_unique<EJUNCTION>( child, aIo ) );
578 else if( child->GetName() ==
"label" )
579 labels.emplace_back( std::make_unique<ELABEL>( child, aIo ) );
580 else if( child->GetName() ==
"probe" )
581 probes.emplace_back( std::make_unique<EPROBE>( child, aIo ) );
597 name = parseRequiredAttribute<wxString>( aBus,
"name" );
599 for( wxXmlNode* child = aBus->GetChildren(); child; child = child->GetNext() )
601 if( child->GetName() ==
"segment" )
602 segments.emplace_back( std::make_unique<ESEGMENT>( child, aIo ) );
620 x = parseRequiredAttribute<ECOORD>( aJunction,
"x" );
621 y = parseRequiredAttribute<ECOORD>( aJunction,
"y" );
647 x = parseRequiredAttribute<ECOORD>( aLabel,
"x" );
648 y = parseRequiredAttribute<ECOORD>( aLabel,
"y" );
649 size = parseRequiredAttribute<ECOORD>( aLabel,
"size" );
650 layer = parseRequiredAttribute<int>( aLabel,
"layer" );
651 font = parseOptionalAttribute<wxString>( aLabel,
"font" );
652 ratio = parseOptionalAttribute<int>( aLabel,
"ratio" );
653 rot = parseOptionalAttribute<EROT>( aLabel,
"rot" );
654 xref = parseOptionalAttribute<wxString>( aLabel,
"xref" );
655 align = parseOptionalAttribute<wxString>( aLabel,
"align" );
671 netname = parseRequiredAttribute<wxString>( aNet,
"name" );
672 netcode = parseRequiredAttribute<int>( aNet,
"class" );
674 for( wxXmlNode* segment = aNet->GetChildren(); segment; segment = segment->GetNext() )
675 segments.emplace_back( std::make_unique<ESEGMENT>( segment ) );
697 x = parseRequiredAttribute<ECOORD>( aVia,
"x" );
698 y = parseRequiredAttribute<ECOORD>( aVia,
"y" );
700 wxString ext = parseRequiredAttribute<wxString>( aVia,
"extent" );
703 drill = parseRequiredAttribute<ECOORD>( aVia,
"drill" );
704 diam = parseOptionalAttribute<ECOORD>( aVia,
"diameter" );
705 shape = parseOptionalAttribute<wxString>( aVia,
"shape" );
725 x = parseRequiredAttribute<ECOORD>( aCircle,
"x" );
726 y = parseRequiredAttribute<ECOORD>( aCircle,
"y" );
727 radius = parseRequiredAttribute<ECOORD>( aCircle,
"radius" );
728 width = parseRequiredAttribute<ECOORD>( aCircle,
"width" );
729 layer = parseRequiredAttribute<int>( aCircle,
"layer" );
750 x1 = parseRequiredAttribute<ECOORD>( aRect,
"x1" );
751 y1 = parseRequiredAttribute<ECOORD>( aRect,
"y1" );
752 x2 = parseRequiredAttribute<ECOORD>( aRect,
"x2" );
753 y2 = parseRequiredAttribute<ECOORD>( aRect,
"y2" );
754 layer = parseRequiredAttribute<int>( aRect,
"layer" );
755 rot = parseOptionalAttribute<EROT>( aRect,
"rot" );
771 text = aDescription->GetNodeContent();
772 language = parseOptionalAttribute<wxString>( aDescription,
"language" );
798 name = parseRequiredAttribute<wxString>( aTree,
"name" );
799 value = parseOptionalAttribute<wxString>( aTree,
"value" );
801 x = parseOptionalAttribute<ECOORD>( aTree,
"x" );
802 y = parseOptionalAttribute<ECOORD>( aTree,
"y" );
803 size = parseOptionalAttribute<ECOORD>( aTree,
"size" );
805 layer = parseOptionalAttribute<int>( aTree,
"layer" );
806 ratio = parseOptionalAttribute<double>( aTree,
"ratio" );
807 rot = parseOptionalAttribute<EROT>( aTree,
"rot" );
809 opt_wxString stemp = parseOptionalAttribute<wxString>( aTree,
"display" );
814 else if( stemp ==
"name" )
816 else if( stemp ==
"both" )
821 stemp = parseOptionalAttribute<wxString>( aTree,
"align" );
840 part = parseRequiredAttribute<wxString>( aPinRef,
"part" );
841 gate = parseRequiredAttribute<wxString>( aPinRef,
"gate" );
842 pin = parseRequiredAttribute<wxString>( aPinRef,
"pin" );
858 moduleinst = parseRequiredAttribute<wxString>( aPortRef,
"moduleinst" );
859 port = parseRequiredAttribute<wxString>( aPortRef,
"port" );
884 x = parseRequiredAttribute<ECOORD>( aProbe,
"x" );
885 y = parseRequiredAttribute<ECOORD>( aProbe,
"y" );
886 size = parseRequiredAttribute<double>( aProbe,
"size" );
887 layer = parseRequiredAttribute<int>( aProbe,
"layer" );
888 font = parseOptionalAttribute<wxString>( aProbe,
"font" );
889 ratio = parseOptionalAttribute<int>( aProbe,
"ratio" );
890 rot = parseOptionalAttribute<EROT>( aProbe,
"rot" );
891 xref = parseOptionalAttribute<bool>( aProbe,
"xref" );
915 x1 = parseRequiredAttribute<ECOORD>( aDimension, wxT(
"x1" ) );
916 y1 = parseRequiredAttribute<ECOORD>( aDimension, wxT(
"y1" ) );
917 x2 = parseRequiredAttribute<ECOORD>( aDimension, wxT(
"x2" ) );
918 y2 = parseRequiredAttribute<ECOORD>( aDimension, wxT(
"y2" ) );
919 x3 = parseRequiredAttribute<ECOORD>( aDimension, wxT(
"x3" ) );
920 y3 = parseRequiredAttribute<ECOORD>( aDimension, wxT(
"y3" ) );
921 textsize = parseOptionalAttribute<ECOORD>( aDimension, wxT(
"textsize" ) );
922 layer = parseRequiredAttribute<int>( aDimension, wxT(
"layer" ) );
923 dimensionType = parseOptionalAttribute<wxString>( aDimension, wxT(
"dtype" ) );
946 text = aText->GetNodeContent();
947 x = parseRequiredAttribute<ECOORD>( aText,
"x" );
948 y = parseRequiredAttribute<ECOORD>( aText,
"y" );
949 size = parseRequiredAttribute<ECOORD>( aText,
"size" );
950 layer = parseRequiredAttribute<int>( aText,
"layer" );
952 font = parseOptionalAttribute<wxString>( aText,
"font" );
953 ratio = parseOptionalAttribute<double>( aText,
"ratio" );
954 rot = parseOptionalAttribute<EROT>( aText,
"rot" );
956 opt_wxString stemp = parseOptionalAttribute<wxString>( aText,
"align" );
970 const wxString& fontName =
font.
CGet();
972 if( fontName ==
"vector" )
976 else if( fontName ==
"fixed" )
1018 x1 = parseRequiredAttribute<ECOORD>( aFrameNode,
"x1" );
1019 y1 = parseRequiredAttribute<ECOORD>( aFrameNode,
"y1" );
1020 x2 = parseRequiredAttribute<ECOORD>( aFrameNode,
"x2" );
1021 y2 = parseRequiredAttribute<ECOORD>( aFrameNode,
"y2" );
1022 columns = parseRequiredAttribute<int>( aFrameNode,
"columns" );
1023 rows = parseRequiredAttribute<int>( aFrameNode,
"rows" );
1024 layer = parseRequiredAttribute<int>( aFrameNode,
"layer" );
1025 border_left = parseOptionalAttribute<bool>( aFrameNode,
"border-left" );
1026 border_top = parseOptionalAttribute<bool>( aFrameNode,
"border-top" );
1027 border_right = parseOptionalAttribute<bool>( aFrameNode,
"border-right" );
1028 border_bottom = parseOptionalAttribute<bool>( aFrameNode,
"border-bottom" );
1038 name = parseRequiredAttribute<wxString>( aPad,
"name" );
1039 x = parseRequiredAttribute<ECOORD>( aPad,
"x" );
1040 y = parseRequiredAttribute<ECOORD>( aPad,
"y" );
1041 rot = parseOptionalAttribute<EROT>( aPad,
"rot" );
1042 stop = parseOptionalAttribute<bool>( aPad,
"stop" );
1043 thermals = parseOptionalAttribute<bool>( aPad,
"thermals" );
1067 drill = parseRequiredAttribute<ECOORD>( aPad,
"drill" );
1070 diameter = parseOptionalAttribute<ECOORD>( aPad,
"diameter" );
1072 opt_wxString s = parseOptionalAttribute<wxString>( aPad,
"shape" );
1077 else if( s ==
"round" )
1079 else if( s ==
"octagon" )
1081 else if( s ==
"long" )
1083 else if( s ==
"offset" )
1086 first = parseOptionalAttribute<bool>( aPad,
"first" );
1112 dx = parseRequiredAttribute<ECOORD>( aSMD,
"dx" );
1113 dy = parseRequiredAttribute<ECOORD>( aSMD,
"dy" );
1114 layer = parseRequiredAttribute<int>( aSMD,
"layer" );
1116 roundness = parseOptionalAttribute<int>( aSMD,
"roundness" );
1117 cream = parseOptionalAttribute<bool>( aSMD,
"cream" );
1142 name = parseRequiredAttribute<wxString>( aPin,
"name" );
1143 x = parseRequiredAttribute<ECOORD>( aPin,
"x" );
1144 y = parseRequiredAttribute<ECOORD>( aPin,
"y" );
1146 visible = parseOptionalAttribute<wxString>( aPin,
"visible" );
1147 length = parseOptionalAttribute<wxString>( aPin,
"length" );
1148 direction = parseOptionalAttribute<wxString>( aPin,
"direction" );
1149 function = parseOptionalAttribute<wxString>( aPin,
"function" );
1150 swaplevel = parseOptionalAttribute<int>( aPin,
"swaplevel" );
1151 rot = parseOptionalAttribute<EROT>( aPin,
"rot" );
1169 x = parseRequiredAttribute<ECOORD>( aVertex,
"x" );
1170 y = parseRequiredAttribute<ECOORD>( aVertex,
"y" );
1171 curve = parseOptionalAttribute<double>( aVertex,
"curve" );
1201 width = parseRequiredAttribute<ECOORD>( aPolygon,
"width" );
1202 layer = parseRequiredAttribute<int>( aPolygon,
"layer" );
1204 spacing = parseOptionalAttribute<ECOORD>( aPolygon,
"spacing" );
1205 isolate = parseOptionalAttribute<ECOORD>( aPolygon,
"isolate" );
1206 opt_wxString s = parseOptionalAttribute<wxString>( aPolygon,
"pour" );
1214 else if( s ==
"cutout" )
1217 orphans = parseOptionalAttribute<bool>( aPolygon,
"orphans" );
1218 thermals = parseOptionalAttribute<bool>( aPolygon,
"thermals" );
1219 rank = parseOptionalAttribute<int>( aPolygon,
"rank" );
1221 for( wxXmlNode* child = aPolygon->GetChildren(); child; child = child->GetNext() )
1223 if( child->GetName() ==
"vertex" )
1224 vertices.emplace_back( std::make_unique<EVERTEX>( child, aIo ) );
1242 width = parseRequiredAttribute<double>( aSpline,
"width" );
1244 for( wxXmlNode* child = aSpline->GetChildren(); child; child = child->GetNext() )
1246 if( child->GetName() ==
"vertex" )
1247 vertices.emplace_back( std::make_unique<EVERTEX>( child, aIo ) );
1267 name = parseRequiredAttribute<wxString>( aVariant,
"name" );
1268 populate = parseOptionalAttribute<bool>( aVariant,
"populate" );
1269 value = parseOptionalAttribute<wxString>( aVariant,
"value" );
1270 technology = parseOptionalAttribute<wxString>( aVariant,
"technology" );
1285 name = parseRequiredAttribute<wxString>( aModel,
"name" );
1286 model = aModel->GetNodeContent();
1303 gate = parseRequiredAttribute<wxString>( aPinMap,
"gate" );
1304 pin = parseRequiredAttribute<wxString>( aPinMap,
"pin" );
1305 pinorder = parseRequiredAttribute<wxString>( aPinMap,
"pinorder" );
1322 isusermap = parseOptionalAttribute<bool>( aPinMapping,
"isusermap" );
1323 iddevicewide = parseOptionalAttribute<bool>( aPinMapping,
"iddevicewide" );
1324 spiceprefix = parseOptionalAttribute<wxString>( aPinMapping,
"spiceprefix" );
1326 for( wxXmlNode* child = aPinMapping->GetChildren(); child; child = child->GetNext() )
1328 if( child->GetName() ==
"pinmap" )
1329 pinmaps.emplace_back( std::make_unique<EPINMAP>( child, aIo ) );
1342 pinmapping = std::make_unique<EPINMAPPING>( aSpice );
1344 if( aSpice->GetName() ==
"model" )
1345 model = std::make_unique<EMODEL>( aSpice );
1364 x = parseRequiredAttribute<ECOORD>( aHole,
"x" );
1365 y = parseRequiredAttribute<ECOORD>( aHole,
"y" );
1366 drill = parseRequiredAttribute<ECOORD>( aHole,
"drill" );
1398 name = parseRequiredAttribute<wxString>( aElement,
"name" );
1399 library = parseRequiredAttribute<wxString>( aElement,
"library" );
1400 value = parseRequiredAttribute<wxString>( aElement,
"value" );
1401 std::string p = parseRequiredAttribute<std::string>( aElement,
"package" );
1403 package = wxString::FromUTF8( p.c_str() );
1405 x = parseRequiredAttribute<ECOORD>( aElement,
"x" );
1406 y = parseRequiredAttribute<ECOORD>( aElement,
"y" );
1409 library_urn = parseOptionalAttribute<wxString>( aElement,
"library_urn" );
1410 locked = parseOptionalAttribute<bool>( aElement,
"locked" );
1411 smashed = parseOptionalAttribute<bool>( aElement,
"smashed" );
1412 rot = parseOptionalAttribute<EROT>( aElement,
"rot" );
1414 for( wxXmlNode* child = aElement->GetChildren(); child; child = child->GetNext() )
1416 if( child->GetName() ==
"attribute" )
1418 std::unique_ptr<EATTR> attr = std::make_unique<EATTR>( child, aIo );
1419 attributes[ attr->name ] = std::move( attr );
1421 else if( child->GetName() ==
"variant" )
1423 std::unique_ptr<EVARIANT> variant = std::make_unique<EVARIANT>( child, aIo );
1424 variants[ variant->name ] = std::move( variant );
1428 AdvanceProgressPhase();
1447 number = parseRequiredAttribute<int>( aLayer,
"number" );
1448 name = parseRequiredAttribute<wxString>( aLayer,
"name" );
1449 color = parseRequiredAttribute<int>( aLayer,
"color" );
1450 fill = parseRequiredAttribute<int>( aLayer,
"fill" );
1451 visible = parseOptionalAttribute<bool>( aLayer,
"visible" );
1452 active = parseOptionalAttribute<bool>( aLayer,
"active" );
1472 name = parseRequiredAttribute<wxString>( aPart,
"name" );
1473 library = parseRequiredAttribute<wxString>( aPart,
"library" );
1474 libraryUrn = parseOptionalAttribute<wxString>( aPart,
"library_urn" );
1475 deviceset = parseRequiredAttribute<wxString>( aPart,
"deviceset" );
1476 device = parseRequiredAttribute<wxString>( aPart,
"device" );
1477 package3d_urn = parseOptionalAttribute<wxString>( aPart,
"package3d_urn" );
1481 technology = parseOptionalAttribute<wxString>( aPart,
"technology" );
1482 value = parseOptionalAttribute<wxString>( aPart,
"value" );
1484 for( wxXmlNode* child = aPart->GetChildren(); child; child = child->GetNext() )
1486 if( child->GetName() ==
"attribute" )
1488 std::unique_ptr<EATTR> attr = std::make_unique<EATTR>( child, aIo );
1489 attributes[ attr->name ] = std::move( attr );
1491 else if( child->GetName() ==
"variant" )
1493 std::unique_ptr<EVARIANT> variant = std::make_unique<EVARIANT>( child, aIo );
1494 variants[ variant->name ] = std::move( variant );
1496 else if( child->GetName() ==
"spice" )
1498 spice = std::make_unique<ESPICE>( child, aIo );
1520 part = parseRequiredAttribute<wxString>( aInstance,
"part" );
1521 gate = parseRequiredAttribute<wxString>( aInstance,
"gate" );
1523 x = parseRequiredAttribute<ECOORD>( aInstance,
"x" );
1524 y = parseRequiredAttribute<ECOORD>( aInstance,
"y" );
1527 smashed = parseOptionalAttribute<bool>( aInstance,
"smashed" );
1528 rot = parseOptionalAttribute<EROT>( aInstance,
"rot" );
1530 for( wxXmlNode* child = aInstance->GetChildren(); child; child = child->GetNext() )
1532 if( child->GetName() ==
"attribute" )
1534 std::unique_ptr<EATTR> attr = std::make_unique<EATTR>( child, aIo );
1535 attributes[ attr->name ] = std::move( attr );
1558 name = parseRequiredAttribute<wxString>( aGate,
"name" );
1559 symbol = parseRequiredAttribute<wxString>( aGate,
"symbol" );
1561 x = parseRequiredAttribute<ECOORD>( aGate,
"x" );
1562 y = parseRequiredAttribute<ECOORD>( aGate,
"y" );
1564 opt_wxString stemp = parseOptionalAttribute<wxString>( aGate,
"addlevel" );
1567 if( stemp ==
"must" )
1569 else if( stemp ==
"can" )
1571 else if( stemp ==
"next" )
1573 else if( stemp ==
"request" )
1575 else if( stemp ==
"always" )
1580 swaplevel = parseOptionalAttribute<int>( aGate,
"swaplevel" );
1598 gate = parseRequiredAttribute<wxString>( aConnect,
"gate" );
1599 pin = parseRequiredAttribute<wxString>( aConnect,
"pin" );
1600 pad = parseRequiredAttribute<wxString>( aConnect,
"pad" );
1601 contactroute = parseOptionalAttribute<wxString>( aConnect,
"contactroute" );
1616 name = parseRequiredAttribute<wxString>( aTechnology,
"name" );
1618 for( wxXmlNode* child = aTechnology->GetChildren(); child; child = child->GetNext() )
1620 if( child->GetName() ==
"attribute" )
1621 attributes.emplace_back( std::make_unique<EATTR>( child, aIo ) );
1637 package3d_urn = parseRequiredAttribute<wxString>( aPackage3dInst,
"package3d_urn" );
1652 name = parseRequiredAttribute<wxString>( aDevice,
"name" );
1653 opt_wxString pack = parseOptionalAttribute<wxString>( aDevice,
"package" );
1657 std::string p( pack->c_str() );
1659 package.
Set( wxString::FromUTF8( p.c_str() ) );
1662 for( wxXmlNode* child = aDevice->GetChildren(); child; child = child->GetNext() )
1664 if( child->GetName() ==
"connects" )
1666 for( wxXmlNode* connect = child->GetChildren(); connect; connect = connect->GetNext() )
1668 if( connect->GetName() ==
"connect" )
1669 connects.emplace_back( std::make_unique<ECONNECT>( connect, aIo ) );
1674 else if( child->GetName() ==
"packages3dinstances" )
1676 for( wxXmlNode* package3dinst = child->GetChildren(); package3dinst;
1677 package3dinst = package3dinst->GetNext() )
1679 if( package3dinst->GetName() ==
"package3dinstance" )
1680 package3dinstances.emplace_back( std::make_unique<EPACKAGE3DINST>( package3dinst, aIo ) );
1685 else if( child->GetName() ==
"technologies" )
1687 for( wxXmlNode* technology = child->GetChildren(); technology;
1688 technology = technology->GetNext() )
1690 if( technology->GetName() ==
"technology" )
1691 technologies.emplace_back( std::make_unique<ETECHNOLOGY>( technology, aIo ) );
1719 name = parseRequiredAttribute<wxString>( aDeviceSet,
"name" );
1720 urn = parseOptionalAttribute<wxString>( aDeviceSet,
"urn" );
1721 locally_modified = parseOptionalAttribute<bool>( aDeviceSet,
"locally_modified" );
1722 prefix = parseOptionalAttribute<wxString>( aDeviceSet,
"prefix" );
1723 uservalue = parseOptionalAttribute<bool>( aDeviceSet,
"uservalue" );
1724 library_version = parseOptionalAttribute<int>( aDeviceSet,
"library_version" );
1726 parseOptionalAttribute<bool>( aDeviceSet,
"library_locally_modified" );
1728 for( wxXmlNode* child = aDeviceSet->GetChildren(); child; child = child->GetNext() )
1730 if( child->GetName() ==
"description" )
1732 description = std::make_optional<EDESCRIPTION>( child, aIo );
1734 else if( child->GetName() ==
"gates" )
1736 for( wxXmlNode* gate = child->GetChildren(); gate; gate = gate->GetNext() )
1738 std::unique_ptr<EGATE> tmp = std::make_unique<EGATE>( gate, aIo );
1739 gates[tmp->name] = std::move( tmp );
1744 else if( child->GetName() ==
"devices" )
1746 for( wxXmlNode* device = child->GetChildren(); device; device = device->GetNext() )
1747 devices.emplace_back( std::make_unique<EDEVICE>( device, aIo ) );
1751 else if( child->GetName() ==
"spice" )
1753 spice = std::make_optional<ESPICE>( child, aIo );
1773 number = parseRequiredAttribute<wxString>( aClass,
"number" );
1774 name = parseRequiredAttribute<wxString>( aClass,
"name" );
1775 width = parseOptionalAttribute<ECOORD>( aClass,
"width" );
1776 drill = parseOptionalAttribute<ECOORD>( aClass,
"drill" );
1778 for( wxXmlNode* child = aClass->GetChildren(); child; child = child->GetNext() )
1780 if( child->GetName() ==
"clearance" )
1782 wxString to = parseRequiredAttribute<wxString>( child,
"class" );
1783 ECOORD value = parseRequiredAttribute<ECOORD>( child,
"value" );
1802 for( wxXmlNode* child = aPlain->GetChildren(); child; child = child->GetNext() )
1804 if( child->GetName() ==
"polygon" )
1805 polygons.emplace_back( std::make_unique<EPOLYGON>( child, aIo ) );
1806 else if( child->GetName() ==
"wire" )
1807 wires.emplace_back( std::make_unique<EWIRE>( child, aIo ) );
1808 else if( child->GetName() ==
"text" )
1809 texts.emplace_back( std::make_unique<ETEXT>( child, aIo ) );
1810 else if( child->GetName() ==
"dimension" )
1811 dimensions.emplace_back( std::make_unique<EDIMENSION>( child, aIo ) );
1812 else if( child->GetName() ==
"circle" )
1813 circles.emplace_back( std::make_unique<ECIRCLE>( child, aIo ) );
1814 else if( child->GetName() ==
"spline" )
1815 splines.emplace_back( std::make_unique<ESPLINE>( child, aIo ) );
1816 else if( child->GetName() ==
"rectangle" )
1817 rectangles.emplace_back( std::make_unique<ERECT>( child, aIo ) );
1818 else if( child->GetName() ==
"frame" )
1819 frames.emplace_back( std::make_unique<EFRAME>( child, aIo ) );
1820 else if( child->GetName() ==
"hole" )
1821 holes.emplace_back( std::make_unique<EHOLE>( child, aIo ) );
1845 name = parseRequiredAttribute<wxString>( aModuleInst,
"name" );
1846 moduleinst = parseRequiredAttribute<wxString>( aModuleInst,
"module" );
1847 moduleVariant = parseOptionalAttribute<wxString>( aModuleInst,
"modulevariant" );
1848 x = parseRequiredAttribute<ECOORD>( aModuleInst,
"x" );
1849 y = parseRequiredAttribute<ECOORD>( aModuleInst,
"y" );
1850 offset = parseOptionalAttribute<int>( aModuleInst,
"offset" );
1851 smashed = parseOptionalAttribute<bool>( aModuleInst,
"smashed" );
1852 rotation = parseOptionalAttribute<EROT>( aModuleInst,
"rot" );
1864 description = parseOptionalAttribute<wxString>( aSheet,
"description" );
1866 for( wxXmlNode* child = aSheet->GetChildren(); child; child = child->GetNext() )
1868 if( child->GetName() ==
"plain" )
1870 plain = std::make_unique<EPLAIN>( child, aIo );
1872 else if( child->GetName() ==
"moduleinsts" )
1874 for( wxXmlNode* moduleinst = child->GetChildren(); moduleinst;
1875 moduleinst = moduleinst->GetNext() )
1877 if( moduleinst->GetName() ==
"moduleinst" )
1879 std::unique_ptr<EMODULEINST> inst = std::make_unique<EMODULEINST>( moduleinst,
1887 else if( child->GetName() ==
"instances" )
1889 for( wxXmlNode* instance = child->GetChildren(); instance;
1890 instance = instance->GetNext() )
1892 if( instance->GetName() ==
"instance" )
1893 instances.emplace_back( std::make_unique<EINSTANCE>( instance, aIo ) );
1898 else if( child->GetName() ==
"busses" )
1900 for( wxXmlNode* bus = child->GetChildren(); bus; bus = bus->GetNext() )
1902 if( bus->GetName() ==
"bus" )
1903 busses.emplace_back( std::make_unique<EBUS>( bus, aIo ) );
1908 else if( child->GetName() ==
"nets" )
1910 for( wxXmlNode* net = child->GetChildren(); net; net = net->GetNext() )
1912 if( net->GetName() ==
"net" )
1913 nets.emplace_back( std::make_unique<ENET>( net, aIo ) );
1941 name = parseRequiredAttribute<wxString>( aSchematicGroup,
"name" );
1942 selectable = parseOptionalAttribute<bool>( aSchematicGroup,
"selectable" );
1943 width = parseOptionalAttribute<ECOORD>( aSchematicGroup,
"width" );
1944 titleSize = parseOptionalAttribute<ECOORD>( aSchematicGroup,
"titleSize" );
1945 titleFont = parseOptionalAttribute<wxString>( aSchematicGroup,
"font" );
1946 wireStyle = parseOptionalAttribute<wxString>( aSchematicGroup,
"style" );
1947 showAnnotations = parseOptionalAttribute<bool>( aSchematicGroup,
"showAnnotations" );
1948 layer = parseOptionalAttribute<int>( aSchematicGroup,
"layer" );
1949 grouprefs = parseOptionalAttribute<wxString>( aSchematicGroup,
"grouprefs" );
1951 for( wxXmlNode* child = aSchematicGroup->GetChildren(); child; child = child->GetNext() )
1953 if( child->GetName() ==
"description" )
1955 description = std::make_optional<EDESCRIPTION>( child, aIo );
1957 else if( child->GetName() ==
"attribute" )
1959 attributes.emplace_back( std::make_unique<EATTR>( child, aIo ) );
1979 name = parseRequiredAttribute<wxString>( aModule,
"name" );
1980 prefix = parseOptionalAttribute<wxString>( aModule,
"prefix" );
1981 dx = parseRequiredAttribute<ECOORD>( aModule,
"dx" );
1982 dy = parseRequiredAttribute<ECOORD>( aModule,
"dy" );
1984 for( wxXmlNode* child = aModule->GetChildren(); child; child = child->GetNext() )
1986 if( child->GetName() ==
"description" )
1988 description = std::make_optional<EDESCRIPTION>( child, aIo );
1990 else if( child->GetName() ==
"ports" )
1992 for( wxXmlNode* port = child->GetChildren(); port; port = port->GetNext() )
1994 if( port->GetName() ==
"port" )
1996 std::unique_ptr<EPORT> tmp = std::make_unique<EPORT>( port, aIo );
1997 ports[ tmp->name ] = std::move( tmp );
2003 else if( child->GetName() ==
"variantdefs" )
2005 for( wxXmlNode* variantdef = child->GetChildren(); variantdef;
2006 variantdef = variantdef->GetNext() )
2008 if( variantdef->GetName() ==
"variantdef" )
2010 std::unique_ptr<EVARIANTDEF> tmp = std::make_unique<EVARIANTDEF>( variantdef,
2018 else if( child->GetName() ==
"groups" )
2022 if(
group->GetName() ==
"schematic_group" )
2024 std::unique_ptr<ESCHEMATIC_GROUP> tmp =
2025 std::make_unique<ESCHEMATIC_GROUP>(
group, aIo );
2026 groups[ tmp->name ] = std::move( tmp );
2032 else if( child->GetName() ==
"parts" )
2034 for( wxXmlNode* part = child->GetChildren(); part; part = part->GetNext() )
2036 if( part->GetName() ==
"part" )
2038 std::unique_ptr<EPART> tmp = std::make_unique<EPART>( part, aIo );
2039 parts[ tmp->name ] = std::move( tmp );
2045 else if( child->GetName() ==
"sheets" )
2047 for( wxXmlNode* sheet = child->GetChildren(); sheet; sheet = sheet->GetNext() )
2049 if( sheet->GetName() ==
"sheet" )
2050 sheets.emplace_back( std::make_unique<ESHEET>( sheet, aIo ) );
2073 name = parseRequiredAttribute<wxString>( aPort,
"name" );
2074 side = parseRequiredAttribute<wxString>( aPort,
"side" );
2075 coord = parseRequiredAttribute<ECOORD>( aPort,
"coord" );
2076 direction = parseOptionalAttribute<wxString>( aPort,
"direction" );
2092 name = parseRequiredAttribute<wxString>( aVariantDef,
"name" );
2093 current = parseOptionalAttribute<bool>( aVariantDef,
"current" );
2110 version = parseRequiredAttribute<double>( aNote,
"version" );
2111 severity = parseRequiredAttribute<wxString>( aNote,
"severity" );
2113 note = aNote->GetNodeContent();
2125 for( wxXmlNode* child = aCompatibility->GetNext(); child; child = child->GetNext() )
2127 if( child->GetName() ==
"note" )
2128 notes.emplace_back( std::make_unique<ENOTE>( child ) );
2146 alwaysvectorfont = parseOptionalAttribute<bool>( aSetting,
"alwaysvectorfont" );
2147 verticaltext = parseOptionalAttribute<wxString>( aSetting,
"verticaltext" );
2148 keepoldvectorfont = parseOptionalAttribute<bool>( aSetting,
"keepoldvectorfont" );
2171 distance = parseOptionalAttribute<double>( aGrid,
"distance" );
2172 unitdist = parseOptionalAttribute<wxString>( aGrid,
"unitdist" );
2173 unit = parseOptionalAttribute<wxString>( aGrid,
"unit" );
2174 style = parseOptionalAttribute<wxString>( aGrid,
"style" );
2175 multiple = parseOptionalAttribute<int>( aGrid,
"multiple" );
2176 display = parseOptionalAttribute<bool>( aGrid,
"display" );
2177 altdistance = parseOptionalAttribute<double>( aGrid,
"altdistance" );
2178 altunitdist = parseOptionalAttribute<wxString>( aGrid,
"altunitdist" );
2179 altunit = parseOptionalAttribute<wxString>( aGrid,
"altunit" );
2195 name = parseRequiredAttribute<wxString>( aFilter,
"name" );
2196 expression = parseRequiredAttribute<wxString>( aFilter,
"expression" );
2218 name = parseRequiredAttribute<wxString>( aPackage,
"name" );
2219 urn = parseOptionalAttribute<wxString>( aPackage,
"urn" );
2220 locally_modified = parseOptionalAttribute<bool>( aPackage,
"locally_modified" );
2221 library_version = parseOptionalAttribute<int>( aPackage,
"library_version" );
2224 for( wxXmlNode* child = aPackage->GetChildren(); child; child = child->GetNext() )
2226 if( child->GetName() ==
"description" )
2228 description = std::make_optional<EDESCRIPTION>( child, aIo );
2230 else if( child->GetName() ==
"polygon" )
2232 polygons.emplace_back( std::make_unique<EPOLYGON>( child, aIo ) );
2234 else if( child->GetName() ==
"wire" )
2236 wires.emplace_back( std::make_unique<EWIRE>( child, aIo ) );
2238 else if( child->GetName() ==
"text" )
2240 texts.emplace_back( std::make_unique<ETEXT>( child, aIo ) );
2242 else if( child->GetName() ==
"dimension" )
2244 dimensions.emplace_back( std::make_unique<EDIMENSION>( child, aIo ) );
2246 else if( child->GetName() ==
"circle" )
2248 circles.emplace_back( std::make_unique<ECIRCLE>( child, aIo ) );
2250 else if( child->GetName() ==
"rectangle" )
2252 rectangles.emplace_back( std::make_unique<ERECT>( child, aIo ) );
2254 else if( child->GetName() ==
"frame" )
2256 frames.emplace_back( std::make_unique<EFRAME>( child, aIo ) );
2258 else if( child->GetName() ==
"hole" )
2260 holes.emplace_back( std::make_unique<EHOLE>( child, aIo ) );
2262 else if( child->GetName() ==
"pad" )
2264 thtpads.emplace_back( std::make_unique<EPAD>( child, aIo ) );
2266 else if( child->GetName() ==
"smd" )
2268 smdpads.emplace_back( std::make_unique<ESMD>( child, aIo ) );
2285 name = parseRequiredAttribute<wxString>( aPackageInstance,
"name" );
2306 name = parseRequiredAttribute<wxString>( aPackage3d,
"name" );
2307 urn = parseRequiredAttribute<wxString>( aPackage3d,
"urn" );
2308 type = parseRequiredAttribute<wxString>( aPackage3d,
"type" );
2309 library_version = parseOptionalAttribute<int>( aPackage3d,
"library_version" );
2311 "library_locally_modified" );
2313 for( wxXmlNode* child = aPackage3d->GetChildren(); child; child = child->GetNext() )
2315 if( child->GetName() ==
"description" )
2317 description = std::make_optional<EDESCRIPTION>( child, aIo );
2319 else if( child->GetName() ==
"packageinstances" )
2321 for( wxXmlNode* instance = child->GetChildren(); instance;
2322 instance = instance->GetNext() )
2323 packageinstances.emplace_back( std::make_unique<EPACKAGEINSTANCE>( instance,
2351 name = parseRequiredAttribute<wxString>( aSymbol,
"name" );
2352 urn = parseOptionalAttribute<wxString>( aSymbol,
"urn" );
2353 locally_modified = parseOptionalAttribute<bool>( aSymbol,
"locally_modified" );
2354 library_version = parseOptionalAttribute<int>( aSymbol,
"library_version" );
2357 for( wxXmlNode* child = aSymbol->GetChildren(); child; child = child->GetNext() )
2359 if( child->GetName() ==
"description" )
2361 description = std::make_optional<EDESCRIPTION>( child, aIo );
2363 else if( child->GetName() ==
"polygon" )
2365 polygons.emplace_back( std::make_unique<EPOLYGON>( child, aIo ) );
2367 else if( child->GetName() ==
"wire" )
2369 wires.emplace_back( std::make_unique<EWIRE>( child, aIo ) );
2371 else if( child->GetName() ==
"text" )
2373 texts.emplace_back( std::make_unique<ETEXT>( child, aIo ) );
2375 else if( child->GetName() ==
"dimension" )
2377 dimensions.emplace_back( std::make_unique<EDIMENSION>( child, aIo ) );
2379 else if( child->GetName() ==
"pin" )
2381 pins.emplace_back( std::make_unique<EPIN>( child, aIo ) );
2383 else if( child->GetName() ==
"circle" )
2385 circles.emplace_back( std::make_unique<ECIRCLE>( child, aIo ) );
2387 else if( child->GetName() ==
"rectangle" )
2389 rectangles.emplace_back( std::make_unique<ERECT>( child, aIo ) );
2391 else if( child->GetName() ==
"frame" )
2393 frames.emplace_back( std::make_unique<EFRAME>( child, aIo ) );
2415 wxString parentNodeName;
2417 if( aLibrary->GetParent() )
2418 parentNodeName = aLibrary->GetParent()->GetName();
2420 if( parentNodeName ==
"libraries" )
2422 name = parseRequiredAttribute<wxString>( aLibrary,
"name" );
2423 urn = parseOptionalAttribute<wxString>( aLibrary,
"urn" );
2426 for( wxXmlNode* child = aLibrary->GetChildren(); child; child = child->GetNext() )
2428 if( child->GetName() ==
"description" )
2430 description = std::make_optional<EDESCRIPTION>( child, aIo );
2432 else if( child->GetName() ==
"packages" )
2434 for( wxXmlNode* package = child->GetChildren(); package; package = package->GetNext() )
2436 if( package->GetName() ==
"package" )
2438 std::unique_ptr<EPACKAGE> tmp = std::make_unique<EPACKAGE>( package, aIo );
2439 packages[ tmp->name ] = std::move( tmp );
2445 else if( child->GetName() ==
"packages3d" )
2447 for( wxXmlNode* package3d = child->GetChildren(); package3d;
2448 package3d = package3d->GetNext() )
2450 if( package3d->GetName() ==
"package3d" )
2452 std::unique_ptr<EPACKAGE3D> tmp = std::make_unique<EPACKAGE3D>( package3d,
2460 else if( child->GetName() ==
"symbols" )
2462 for( wxXmlNode* symbol = child->GetChildren(); symbol; symbol = symbol->GetNext() )
2464 if( symbol->GetName() ==
"symbol" )
2466 std::unique_ptr<ESYMBOL> tmp = std::make_unique<ESYMBOL>( symbol, aIo );
2467 symbols[ tmp->name ] = std::move( tmp );
2473 else if( child->GetName() ==
"devicesets" )
2475 for( wxXmlNode* deviceset = child->GetChildren(); deviceset;
2476 deviceset = deviceset->GetNext() )
2478 if( deviceset->GetName() ==
"deviceset" )
2480 std::unique_ptr<EDEVICE_SET> tmp = std::make_unique<EDEVICE_SET>( deviceset,
2503 hash = parseRequiredAttribute<wxString>( aApproved,
"hash" );
2520 xreflabel = parseOptionalAttribute<wxString>( aSchematic,
"xreflabel" );
2521 xrefpart = parseOptionalAttribute<wxString>( aSchematic,
"xrefpart" );
2523 for( wxXmlNode* child = aSchematic->GetChildren(); child; child = child->GetNext() )
2525 if( child->GetName() ==
"description" )
2527 description = std::make_optional<EDESCRIPTION>( child, aIo );
2529 else if( child->GetName() ==
"libraries" )
2533 if(
library->GetName() ==
"library" )
2535 std::unique_ptr<ELIBRARY> tmp = std::make_unique<ELIBRARY>(
library, aIo );
2536 libraries[ tmp->name ] = std::move( tmp );
2542 else if( child->GetName() ==
"attributes" )
2544 for( wxXmlNode* attribute = child->GetChildren(); attribute;
2545 attribute = attribute->GetNext() )
2547 if( attribute->GetName() ==
"attribute" )
2549 std::unique_ptr<EATTR> tmp = std::make_unique<EATTR>( attribute, aIo );
2556 else if( child->GetName() ==
"variantdefs" )
2558 for( wxXmlNode* variantdef = child->GetChildren(); variantdef;
2559 variantdef = variantdef->GetNext() )
2561 if( variantdef->GetName() ==
"variantdef" )
2563 std::unique_ptr<EVARIANTDEF> tmp = std::make_unique<EVARIANTDEF>( variantdef,
2571 else if( child->GetName() ==
"classes" )
2573 for( wxXmlNode* eclass = child->GetChildren(); eclass; eclass = eclass->GetNext() )
2575 if( eclass->GetName() ==
"class" )
2577 std::unique_ptr<ECLASS> tmp = std::make_unique<ECLASS>( eclass, aIo );
2578 classes[ tmp->number ] = std::move( tmp );
2584 else if( child->GetName() ==
"modules" )
2586 for( wxXmlNode* mod = child->GetChildren(); mod; mod = mod->GetNext() )
2588 if( mod->GetName() ==
"module" )
2590 std::unique_ptr<EMODULE> tmp = std::make_unique<EMODULE>( mod, aIo );
2591 modules[ tmp->name ] = std::move( tmp );
2597 else if( child->GetName() ==
"groups" )
2601 if(
group->GetName() ==
"schematic_group" )
2603 std::unique_ptr<ESCHEMATIC_GROUP> tmp =
2604 std::make_unique<ESCHEMATIC_GROUP>(
group, aIo );
2605 groups[ tmp->name ] = std::move( tmp );
2611 else if( child->GetName() ==
"parts" )
2613 for( wxXmlNode* part = child->GetChildren(); part; part = part->GetNext() )
2615 if( part->GetName() ==
"part" )
2617 std::unique_ptr<EPART> tmp = std::make_unique<EPART>( part, aIo );
2618 parts[ tmp->name ] = std::move( tmp );
2624 else if( child->GetName() ==
"sheets" )
2626 for( wxXmlNode* sheet = child->GetChildren(); sheet; sheet = sheet->GetNext() )
2628 if( sheet->GetName() ==
"sheet" )
2629 sheets.emplace_back( std::make_unique<ESHEET>( sheet, aIo ) );
2634 else if( child->GetName() ==
"errors" )
2636 for( wxXmlNode* error = child->GetChildren(); error; error = error->GetNext() )
2638 if( error->GetName() ==
"approved" )
2639 errors.emplace_back( std::make_unique<EAPPROVED>( error, aIo ) );
2656 for( wxXmlNode* child = aDrawing->GetChildren(); child; child = child->GetNext() )
2658 if( child->GetName() ==
"settings" )
2660 for( wxXmlNode* setting = child->GetChildren(); setting; setting = setting->GetNext() )
2661 settings.emplace_back( std::make_unique<ESETTING>( setting, aIo ) );
2665 else if( child->GetName() ==
"grid" )
2667 grid = std::make_optional<EGRID>( child, aIo );
2669 else if( child->GetName() ==
"filters" )
2673 if(
filter->GetName() ==
"filter" )
2674 filters.emplace_back( std::make_unique<EFILTER>(
filter, aIo ) );
2679 else if( child->GetName() ==
"layers" )
2681 for( wxXmlNode* layer = child->GetChildren(); layer; layer = layer->GetNext() )
2683 if( layer->GetName() ==
"layer" )
2684 layers.emplace_back( std::make_unique<ELAYER>( layer, aIo ) );
2689 else if( child->GetName() ==
"schematic" )
2691 schematic = std::make_optional<ESCHEMATIC>( child, aIo );
2693 else if( child->GetName() ==
"library" )
2695 library = std::make_optional<ELIBRARY>( child, aIo );
2717 version = parseRequiredAttribute<wxString>( aEagleDoc,
"version" );
2719 for( wxXmlNode* child = aEagleDoc->GetChildren(); child; child = child->GetNext() )
2721 if( child->GetName() ==
"compitibility" )
2722 compatibility = std::make_optional<ECOMPATIBILITY>( child, aIo );
2723 else if( child->GetName() ==
"drawing" )
2724 drawing = std::make_unique<EDRAWING>( child, aIo );
virtual void AdvanceProgressPhase()
virtual void Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Model an optional XML attribute.
const T & CGet() const
Return a constant reference to the value of the attribute assuming it is available.
void Set(const wxString &aString)
Attempt to convert a string to the base type.
OPTIONAL_XML_ATTRIBUTE()
Construct a default OPTIONAL_XML_ATTRIBUTE, whose data is not available.
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)
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)
Interprets special characters in Eagle text and converts them to KiCAD notation.
wxString interpretText(const wxString &aText)
Translates Eagle special text reference to a KiCad variable reference.
bool substituteVariable(wxString *aText)
Converts Eagle's HTML description into KiCad description format.
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.
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)
OPTIONAL_XML_ATTRIBUTE< T > parseOptionalAttribute(wxXmlNode *aNode, const wxString &aAttribute)
Parse option aAttribute of the XML node aNode.
VECTOR2I ConvertArcCenter(const VECTOR2I &aStart, const VECTOR2I &aEnd, double aAngle)
wxString convertDescription(wxString aDescr)
std::unordered_map< wxString, wxXmlNode * > NODE_MAP
const wxChar *const traceEagleIo
#define THROW_IO_ERROR(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.
void AdvanceProgressPhase()
void Report(const wxString &aMsg, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
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)
EBUS(wxXmlNode *aBus, IO_BASE *aIo=nullptr)
std::vector< std::unique_ptr< ESEGMENT > > segments
ECIRCLE(wxXmlNode *aCircle, IO_BASE *aIo=nullptr)
std::map< wxString, ECOORD > clearanceMap
ECLASS(wxXmlNode *aClass, IO_BASE *aIo=nullptr)
std::vector< std::unique_ptr< ENOTE > > notes
ECOMPATIBILITY(wxXmlNode *aCompatibility, IO_BASE *aIo=nullptr)
opt_wxString contactroute
ECONNECT(wxXmlNode *aConnect, IO_BASE *aIo=nullptr)
long long int value
Unit used for the value field.
static long long int ConvertToNm(int aValue, enum EAGLE_UNIT aUnit)
EDESCRIPTION(wxXmlNode *aDescription, IO_BASE *aIo=nullptr)
opt_bool library_locally_modified
std::vector< std::unique_ptr< EDEVICE > > devices
opt_bool locally_modified
std::optional< EDESCRIPTION > description
EDEVICE_SET(wxXmlNode *aDeviceSet, IO_BASE *aIo=nullptr)
std::map< wxString, std::unique_ptr< EGATE > > gates
std::optional< ESPICE > spice
std::vector< std::unique_ptr< EPACKAGE3DINST > > package3dinstances
std::vector< std::unique_ptr< ECONNECT > > connects
EDEVICE(wxXmlNode *aDevice, IO_BASE *aIo=nullptr)
std::vector< std::unique_ptr< ETECHNOLOGY > > technologies
opt_wxString dimensionType
EDIMENSION(wxXmlNode *aDimension, IO_BASE *aIo=nullptr)
std::optional< ESCHEMATIC > schematic
std::optional< ELIBRARY > library
EDRAWING(wxXmlNode *aDrawing, IO_BASE *aIo=nullptr)
std::vector< std::unique_ptr< ESETTING > > settings
std::vector< std::unique_ptr< ELAYER > > layers
std::optional< EGRID > grid
std::vector< std::unique_ptr< EFILTER > > filters
EELEMENT(wxXmlNode *aElement, IO_BASE *aIo=nullptr)
EFILTER(wxXmlNode *aGrid, IO_BASE *aIo=nullptr)
EFRAME(wxXmlNode *aFrameNode, IO_BASE *aIo=nullptr)
EGATE(wxXmlNode *aGate, IO_BASE *aIo=nullptr)
EGRID(wxXmlNode *aGrid, IO_BASE *aIo=nullptr)
EHOLE(wxXmlNode *aHole, IO_BASE *aIo=nullptr)
std::map< wxString, std::unique_ptr< EATTR > > attributes
EINSTANCE(wxXmlNode *aInstance, IO_BASE *aIo=nullptr)
EJUNCTION(wxXmlNode *aJunction, IO_BASE *aIo=nullptr)
ELABEL(wxXmlNode *aLabel, IO_BASE *aIo=nullptr)
ELAYER(wxXmlNode *aLayer, IO_BASE *aIo=nullptr)
std::map< wxString, std::unique_ptr< EDEVICE_SET > > devicesets
std::map< wxString, std::unique_ptr< EPACKAGE3D > > packages3d
std::map< wxString, std::unique_ptr< EPACKAGE > > packages
std::optional< EDESCRIPTION > description
std::map< wxString, std::unique_ptr< ESYMBOL > > symbols
ELIBRARY(wxXmlNode *aLibrary, IO_BASE *aIo=nullptr)
EMODEL(wxXmlNode *aModel, IO_BASE *aIo=nullptr)
EMODULEINST(wxXmlNode *aModuleInst, IO_BASE *aIo=nullptr)
opt_wxString moduleVariant
std::map< wxString, std::unique_ptr< EPART > > parts
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)
opt_bool library_locally_modified
std::optional< EDESCRIPTION > description
std::vector< std::unique_ptr< EPACKAGEINSTANCE > > packageinstances
EPACKAGE3D(wxXmlNode *aPackage3d, IO_BASE *aIo=nullptr)
EPACKAGEINSTANCE(wxXmlNode *aPackageInstance, IO_BASE *aIo=nullptr)
std::vector< std::unique_ptr< EPOLYGON > > polygons
std::vector< std::unique_ptr< EPAD > > thtpads
std::vector< std::unique_ptr< ECIRCLE > > circles
std::vector< std::unique_ptr< ESMD > > smdpads
std::vector< std::unique_ptr< EDIMENSION > > dimensions
opt_bool library_locally_modified
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)
opt_bool locally_modified
Structure holding common properties for through-hole and SMD pads.
EPAD_COMMON(wxXmlNode *aPad, IO_BASE *aIo=nullptr)
EPAD(wxXmlNode *aPad, IO_BASE *aIo=nullptr)
std::unique_ptr< ESPICE > spice
opt_bool override_locally_modified
opt_wxString override_package_urn
std::map< wxString, std::unique_ptr< EATTR > > attributes
opt_wxString override_package3d_urn
EPART(wxXmlNode *aPart, IO_BASE *aIo=nullptr)
opt_wxString package3d_urn
std::map< wxString, std::unique_ptr< EVARIANT > > variants
EPINMAPPING(wxXmlNode *aPinMap, IO_BASE *aIo=nullptr)
std::vector< std::unique_ptr< EPINMAP > > pinmaps
EPINMAP(wxXmlNode *aPinMap, IO_BASE *aIo=nullptr)
EPINREF(wxXmlNode *aPinRef, IO_BASE *aIo=nullptr)
EPIN(wxXmlNode *aPin, IO_BASE *aIo=nullptr)
std::vector< std::unique_ptr< EWIRE > > wires
std::vector< std::unique_ptr< EPOLYGON > > polygons
std::vector< std::unique_ptr< ETEXT > > texts
std::vector< std::unique_ptr< ECIRCLE > > circles
EPLAIN(wxXmlNode *aPlain, IO_BASE *aIo=nullptr)
std::vector< std::unique_ptr< EFRAME > > frames
std::vector< std::unique_ptr< ESPLINE > > splines
std::vector< std::unique_ptr< ERECT > > rectangles
std::vector< std::unique_ptr< EDIMENSION > > dimensions
std::vector< std::unique_ptr< EHOLE > > holes
std::vector< std::unique_ptr< EVERTEX > > vertices
EPOLYGON(wxXmlNode *aPolygon, IO_BASE *aIo=nullptr)
EPORTREF(wxXmlNode *aPortRef, IO_BASE *aIo=nullptr)
EPORT(wxXmlNode *aPort, IO_BASE *aIo=nullptr)
EPROBE(wxXmlNode *aProbe, IO_BASE *aIo=nullptr)
ERECT(wxXmlNode *aRect, IO_BASE *aIo=nullptr)
std::vector< std::unique_ptr< EATTR > > attributes
ESCHEMATIC_GROUP(wxXmlNode *aSchematicGroup, IO_BASE *aIo=nullptr)
std::optional< EDESCRIPTION > description
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::map< wxString, std::unique_ptr< ESCHEMATIC_GROUP > > groups
std::vector< std::unique_ptr< EPORTREF > > portRefs
std::vector< std::unique_ptr< EPROBE > > probes
std::vector< std::unique_ptr< EPINREF > > pinRefs
ESEGMENT(wxXmlNode *aSegment, IO_BASE *aIo=nullptr)
std::vector< std::unique_ptr< EWIRE > > wires
std::vector< std::unique_ptr< EJUNCTION > > junctions
std::vector< std::unique_ptr< ELABEL > > labels
opt_bool alwaysvectorfont
opt_bool keepoldvectorfont
opt_wxString verticaltext
ESETTING(wxXmlNode *aSetting, IO_BASE *aIo=nullptr)
ESHEET(wxXmlNode *aSheet, IO_BASE *aIo=nullptr)
std::unique_ptr< EPLAIN > plain
std::vector< std::unique_ptr< ENET > > nets
std::vector< std::unique_ptr< EBUS > > busses
std::vector< std::unique_ptr< EINSTANCE > > instances
std::map< wxString, std::unique_ptr< EMODULEINST > > moduleinsts
ESMD(wxXmlNode *aSMD, IO_BASE *aIo=nullptr)
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::vector< std::unique_ptr< EPIN > > pins
std::vector< std::unique_ptr< ECIRCLE > > circles
opt_bool library_locally_modified
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)
opt_bool locally_modified
std::vector< std::unique_ptr< EDIMENSION > > dimensions
std::vector< std::unique_ptr< EATTR > > attributes
ETECHNOLOGY(wxXmlNode *aTechnology, IO_BASE *aIo=nullptr)
ETEXT(wxXmlNode *aText, IO_BASE *aIo=nullptr)
VECTOR2I ConvertSize() const
Calculate text size based on font type and size.
EVARIANTDEF(wxXmlNode *aVariantDef, IO_BASE *aIo=nullptr)
EVARIANT(wxXmlNode *aVariant, IO_BASE *aIo=nullptr)
EVERTEX(wxXmlNode *aVertex, IO_BASE *aIo=nullptr)
opt_double curve
range is -359.9..359.9
EVIA(wxXmlNode *aVia, IO_BASE *aIo=nullptr)
int layer_back_most
< extent
EWIRE(wxXmlNode *aWire, IO_BASE *aIo=nullptr)
opt_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