25 #include <wx/filename.h> 27 #include <wx/xml/xml.h> 42 const std::map<CADSTAR_ARCHIVE_PARSER::TEXT_FIELD_NAME, wxString>
44 { { TEXT_FIELD_NAME::DESIGN_TITLE, wxT(
"DESIGN_TITLE" ) },
45 { TEXT_FIELD_NAME::SHORT_JOBNAME, wxT(
"SHORT_JOBNAME" ) },
46 { TEXT_FIELD_NAME::LONG_JOBNAME, wxT(
"LONG_JOBNAME" ) },
47 { TEXT_FIELD_NAME::NUM_OF_SHEETS, wxT(
"##" ) },
48 { TEXT_FIELD_NAME::SHEET_NUMBER, wxT(
"#" ) },
49 { TEXT_FIELD_NAME::SHEET_NAME, wxT(
"SHEETNAME" ) },
50 { TEXT_FIELD_NAME::VARIANT_NAME, wxT(
"VARIANT_NAME" ) },
51 { TEXT_FIELD_NAME::VARIANT_DESCRIPTION, wxT(
"VARIANT_DESCRIPTION" ) },
52 { TEXT_FIELD_NAME::REG_USER, wxT(
"REG_USER" ) },
53 { TEXT_FIELD_NAME::COMPANY_NAME, wxT(
"COMPANY_NAME" ) },
54 { TEXT_FIELD_NAME::CURRENT_USER, wxT(
"CURRENT_USER" ) },
55 { TEXT_FIELD_NAME::DATE, wxT(
"DATE" ) },
56 { TEXT_FIELD_NAME::TIME, wxT(
"TIME" ) },
57 { TEXT_FIELD_NAME::MACHINE_NAME, wxT(
"MACHINE_NAME" ) } };
62 wxASSERT( aNode->GetName() == wxT(
"FORMAT" ) );
72 wxASSERT( aNode->GetName() == wxT(
"TIMESTAMP" ) );
86 wxASSERT( aNode->GetName() == wxT(
"HEADER" ) );
90 for( ; cNode; cNode = cNode->GetNext() )
92 wxString nodeName = cNode->GetName();
94 if( nodeName == wxT(
"FORMAT" ) )
96 Format.Parse( cNode, aContext );
98 else if( nodeName == wxT(
"JOBFILE" ) )
102 else if( nodeName == wxT(
"JOBTITLE" ) )
106 else if( nodeName == wxT(
"GENERATOR" ) )
110 else if( nodeName == wxT(
"RESOLUTION" ) )
114 if( ( subNode->GetName() == wxT(
"METRIC" ) )
129 else if( nodeName == wxT(
"TIMESTAMP" ) )
131 Timestamp.Parse( cNode, aContext );
143 wxASSERT( aNode->GetName() == wxT(
"VMASTER" ) || aNode->GetName() == wxT(
"VARIANT" ) );
147 if( aNode->GetName() == wxT(
"VMASTER" ) )
163 wxASSERT( aNode->GetName() == wxT(
"VHIERARCHY" ) );
167 for( ; cNode; cNode = cNode->GetNext() )
169 if( cNode->GetName() == wxT(
"VMASTER" ) || cNode->GetName() == wxT(
"VARIANT" ) )
172 variant.
Parse( cNode, aContext );
173 Variants.insert( std::make_pair( variant.
ID, variant ) );
185 wxASSERT( aNode->GetName() == wxT(
"LINECODE" ) );
195 if( cNode->GetName() != wxT(
"STYLE" ) )
200 if( styleStr == wxT(
"SOLID" ) )
204 else if( styleStr == wxT(
"DASH" ) )
208 else if( styleStr == wxT(
"DASHDOT" ) )
212 else if( styleStr == wxT(
"DASHDOTDOT" ) )
216 else if( styleStr == wxT(
"DOT" ) )
230 wxASSERT( aNode->GetName() == wxT(
"HATCH" ) );
237 if( !cNode || cNode->GetName() != wxT(
"ORIENT" ) )
246 wxASSERT( aNode->GetName() == wxT(
"HATCHCODE" ) );
254 for( ; cNode; cNode = cNode->
GetNext() )
256 if( cNode->GetName() != wxT(
"HATCH" ) )
260 hatch.
Parse( cNode, aContext );
261 Hatches.push_back( hatch );
268 wxASSERT( aNode->GetName() == wxT(
"FONT" ) );
276 for( ; cNode; cNode = cNode->
GetNext() )
278 wxString cNodeName = cNode->GetName();
280 if( cNodeName == wxT(
"ITALIC" ) )
282 else if( cNodeName == wxT(
"KERNING" ) )
292 wxASSERT( aNode->GetName() == wxT(
"TEXTCODE" ) );
305 if( cNode->GetName() == wxT(
"FONT" ) )
306 Font.Parse( cNode, aContext );
315 wxASSERT( aNode->GetName() == wxT(
"ROUTEREASSIGN" ) );
322 for( ; cNode; cNode = cNode->
GetNext() )
324 wxString cNodeName = cNode->GetName();
326 if( cNodeName == wxT(
"NECKWIDTH" ) )
328 else if( cNodeName == wxT(
"SROUTEWIDTH" ) )
330 else if( cNodeName == wxT(
"MINWIDTH" ) )
332 else if( cNodeName == wxT(
"MAXWIDTH" ) )
342 wxASSERT( aNode->GetName() == wxT(
"ROUTECODE" ) );
350 for( ; cNode; cNode = cNode->
GetNext() )
352 wxString cNodeName = cNode->GetName();
354 if( cNodeName == wxT(
"NECKWIDTH" ) )
358 else if( cNodeName == wxT(
"SROUTEWIDTH" ) )
362 else if( cNodeName == wxT(
"MINWIDTH" ) )
366 else if( cNodeName == wxT(
"MAXWIDTH" ) )
370 else if( cNodeName == wxT(
"ROUTEREASSIGN" ) )
373 routereassign.
Parse( cNode, aContext );
374 RouteReassigns.push_back( routereassign );
386 return Base * std::pow( 10.0, Exponent );
392 wxASSERT( aNode->GetName() == wxT(
"E" ) );
406 wxASSERT( aNode->GetName() == wxT(
"PT" ) );
415 wxASSERT( aNode->GetName() == wxT(
"PT" ) );
424 wxString aNodeName = aNode->GetName();
426 if( aNodeName == wxT(
"PT" ) || aNodeName == wxT(
"ACWARC" ) || aNodeName == wxT(
"CWARC" )
427 || aNodeName == wxT(
"CWSEMI" ) || aNodeName == wxT(
"ACWSEMI" ) )
440 wxASSERT( IsVertex( aNode ) );
442 wxString aNodeName = aNode->GetName();
444 if( aNodeName == wxT(
"PT" ) )
449 End.Parse( aNode, aContext );
451 else if( aNodeName == wxT(
"ACWARC" ) || aNodeName == wxT(
"CWARC" ) )
453 if( aNodeName == wxT(
"ACWARC" ) )
463 else if( aNodeName == wxT(
"ACWSEMI" ) || aNodeName == wxT(
"CWSEMI" ) )
465 if( aNodeName == wxT(
"ACWSEMI" ) )
479 wxASSERT_MSG(
true, wxT(
"Unknown VERTEX type" ) );
486 wxASSERT( aNode->GetName() == wxT(
"CUTOUT" ) );
494 wxString aNodeName = aNode->GetName();
496 if( aNodeName == wxT(
"OPENSHAPE" ) || aNodeName == wxT(
"OUTLINE" )
497 || aNodeName == wxT(
"SOLID" ) || aNodeName == wxT(
"HATCHED" ) )
510 wxASSERT( IsShape( aNode ) );
512 wxString aNodeName = aNode->GetName();
514 if( aNodeName == wxT(
"OPENSHAPE" ) )
519 HatchCodeID = wxEmptyString;
521 else if( aNodeName == wxT(
"OUTLINE" ) )
526 HatchCodeID = wxEmptyString;
528 else if( aNodeName == wxT(
"SOLID" ) )
533 HatchCodeID = wxEmptyString;
535 else if( aNodeName == wxT(
"HATCHED" ) )
544 wxASSERT_MSG(
true, wxT(
"Unknown SHAPE type" ) );
551 wxASSERT( aNode->GetName() == wxT(
"UNITS" ) );
555 if( unit == wxT(
"CENTIMETER" ) )
557 else if( unit == wxT(
"INCH" ) )
559 else if( unit == wxT(
"METER" ) )
561 else if( unit == wxT(
"MICROMETRE" ) )
563 else if( unit == wxT(
"MM" ) )
565 else if( unit == wxT(
"THOU" ) )
567 else if( unit == wxT(
"DESIGN" ) )
578 wxASSERT( aNode->GetName() == wxT(
"ANGUNITS" ) );
582 if( angUnitStr == wxT(
"DEGREES" ) )
584 else if( angUnitStr == wxT(
"RADIANS" ) )
595 wxString aNodeName = aNode->GetName();
597 if( aNodeName == wxT(
"FRACTIONALGRID" ) || aNodeName == wxT(
"STEPGRID" ) )
606 wxASSERT( IsGrid( aNode ) );
608 wxString aNodeName = aNode->GetName();
610 if( aNodeName == wxT(
"FRACTIONALGRID" ) )
612 else if( aNodeName == wxT(
"STEPGRID" ) )
615 wxASSERT_MSG(
true, wxT(
"Unknown Grid Type" ) );
625 wxASSERT( aNode->GetName() == wxT(
"GRIDS" ) );
629 for( ; cNode; cNode = cNode->GetNext() )
631 wxString cNodeName = cNode->GetName();
633 if( cNodeName == wxT(
"WORKINGGRID" ) )
640 workingGridNode->GetName(), wxT(
"GRIDS -> WORKINGGRID" ) );
644 WorkingGrid.Parse( workingGridNode, aContext );
647 else if( cNodeName == wxT(
"SCREENGRID" ) )
654 screenGridNode->GetName(), wxT(
"GRIDS -> SCREENGRID" ) );
658 ScreenGrid.Parse( screenGridNode, aContext );
664 userGrid.
Parse( cNode, aContext );
665 UserGrids.push_back( userGrid );
673 wxString cNodeName = aChildNode->GetName();
675 if( cNodeName == wxT(
"UNITS" ) )
679 else if( cNodeName == wxT(
"UNITSPRECISION" ) )
683 else if( cNodeName == wxT(
"INTERLINEGAP" ) )
687 else if( cNodeName == wxT(
"BARLINEGAP" ) )
691 else if( cNodeName == wxT(
"ALLOWBARTEXT" ) )
693 AllowBarredText =
true;
695 else if( cNodeName == wxT(
"ANGULARPRECISION" ) )
699 else if( cNodeName == wxT(
"DESIGNORIGIN" ) )
701 DesignOrigin.Parse( aChildNode->
GetChildren(), aContext );
703 else if( cNodeName == wxT(
"DESIGNAREA" ) )
706 DesignArea = std::make_pair( pts[0], pts[1] );
708 else if( cNodeName == wxT(
"DESIGNREF" ) )
710 DesignOrigin.Parse( aChildNode->
GetChildren(), aContext );
712 else if( cNodeName == wxT(
"DESIGNLIMIT" ) )
714 DesignLimit.Parse( aChildNode->
GetChildren(), aContext );
727 wxASSERT( aNode->GetName() == wxT(
"SETTINGS" ) );
731 for( ; cNode; cNode = cNode->GetNext() )
733 wxString cNodeName = cNode->GetName();
735 if( ParseSubNode( cNode, aContext ) )
746 static const std::map<TEXT_FIELD_NAME, wxString> txtTokens =
770 wxString remainingStr = aTextString;
773 while( remainingStr.size() > 0 )
776 size_t startpos = remainingStr.Find( wxT(
"<@" ) );
778 if( static_cast<int>( startpos ) == wxNOT_FOUND )
781 returnStr += remainingStr;
786 returnStr += remainingStr.SubString( 0, startpos - 1 );
788 if( ( startpos + 2 ) >= remainingStr.size() )
791 remainingStr = remainingStr.Mid( startpos + 2 );
796 for( std::pair<TEXT_FIELD_NAME, wxString> txtF : txtTokens )
798 if( remainingStr.StartsWith( txtF.second ) )
800 foundField = txtF.first;
808 returnStr += wxT(
"<@" );
813 size_t endpos = remainingStr.Find( wxT(
"@>" ) );
815 if( static_cast<int>( endpos ) == wxNOT_FOUND )
819 returnStr += wxT(
"<@" ) + remainingStr;
823 size_t valueStart = txtTokens.at( foundField ).size();
824 wxString fieldValue = remainingStr.SubString( valueStart, endpos - 1 );
830 wxASSERT_MSG( fieldValue.at( 0 ) ==
'"',
"Expected '\"' as the first character" );
832 size_t splitPos = fieldValue.find_first_of(
'"', 1 );
833 address = fieldValue.SubString( 1, splitPos - 1 );
838 wxASSERT_MSG( remainingStr.EndsWith( wxT(
"@>" ) ),
839 wxT(
"Expected '@>' at the end of a hyperlink" ) );
841 fieldValue = remainingStr.SubString( valueStart + splitPos + 1,
842 remainingStr.Length() - 3 );
844 remainingStr = wxEmptyString;
848 fieldValue = fieldValue.Mid( splitPos + 1 );
889 returnStr += fieldValue;
894 wxFileName fn( address );
895 wxString fieldFmt = wxT(
"FROM_FILE_%s_%s" );
896 wxString fieldName =
wxString::Format( fieldFmt, fn.GetName(), fn.GetExt() );
910 returnStr += wxT(
"${" ) + fieldName + wxT(
"}" );
922 wxFAIL_MSG(
"We should have already covered this scenario above" );
927 if( ( endpos + 2 ) >= remainingStr.size() )
930 remainingStr = remainingStr.Mid( endpos + 2 );
939 wxASSERT( aNode->GetName() == wxT(
"ALIGN" ) );
943 if( alignmentStr == wxT(
"BOTTOMCENTER" ) )
945 else if( alignmentStr == wxT(
"BOTTOMLEFT" ) )
947 else if( alignmentStr == wxT(
"BOTTOMRIGHT" ) )
949 else if( alignmentStr == wxT(
"CENTERCENTER" ) )
951 else if( alignmentStr == wxT(
"CENTERLEFT" ) )
953 else if( alignmentStr == wxT(
"CENTERRIGHT" ) )
955 else if( alignmentStr == wxT(
"TOPCENTER" ) )
957 else if( alignmentStr == wxT(
"TOPLEFT" ) )
959 else if( alignmentStr == wxT(
"TOPRIGHT" ) )
971 wxASSERT( aNode->GetName() == wxT(
"JUSTIFICATION" ) );
975 if( justificationStr == wxT(
"LEFT" ) )
977 else if( justificationStr == wxT(
"RIGHT" ) )
979 else if( justificationStr == wxT(
"CENTER" ) )
990 wxASSERT( aNode->GetName() == wxT(
"READABILITY" ) );
994 if( readabilityStr == wxT(
"BOTTOM_TO_TOP" ) )
996 else if( readabilityStr == wxT(
"TOP_TO_BOTTOM" ) )
1016 wxString cNodeName = aChildNode->GetName();
1018 if( cNodeName == wxT(
"PT" ) )
1019 Position.Parse( aChildNode, aContext );
1020 else if( cNodeName == wxT(
"ORIENT" ) )
1022 else if( cNodeName == wxT(
"MIRROR" ) )
1024 else if( cNodeName == wxT(
"FIX" ) )
1026 else if( cNodeName == wxT(
"ALIGN" ) )
1028 else if( cNodeName == wxT(
"JUSTIFICATION" ) )
1039 wxASSERT( aNode->GetName() == wxT(
"ATTRLOC" ) );
1041 ParseIdentifiers( aNode, aContext );
1046 for( ; cNode; cNode = cNode->
GetNext() )
1048 if( ParseSubNode( cNode, aContext ) )
1054 if( !Position.IsFullySpecified() )
1061 wxASSERT( aNode->GetName() == wxT(
"COLUMNORDER" ) );
1072 wxASSERT( aNode->GetName() == wxT(
"COLUMNWIDTH" ) );
1083 wxASSERT( aNode->GetName() == wxT(
"ATTRNAME" ) );
1091 for( ; cNode; cNode = cNode->
GetNext() )
1093 wxString cNodeName = cNode->GetName();
1095 if( cNodeName == wxT(
"ATTROWNER" ) )
1099 if( attOwnerVal == wxT(
"ALL_ITEMS" ) )
1101 else if( attOwnerVal == wxT(
"AREA" ) )
1103 else if( attOwnerVal == wxT(
"BOARD" ) )
1105 else if( attOwnerVal == wxT(
"COMPONENT" ) )
1107 else if( attOwnerVal == wxT(
"CONNECTION" ) )
1109 else if( attOwnerVal == wxT(
"COPPER" ) )
1111 else if( attOwnerVal == wxT(
"DOCSYMBOL" ) )
1113 else if( attOwnerVal == wxT(
"FIGURE" ) )
1115 else if( attOwnerVal == wxT(
"NET" ) )
1117 else if( attOwnerVal == wxT(
"NETCLASS" ) )
1119 else if( attOwnerVal == wxT(
"PART" ) )
1121 else if( attOwnerVal == wxT(
"PART_DEFINITION" ) )
1123 else if( attOwnerVal == wxT(
"PIN" ) )
1125 else if( attOwnerVal == wxT(
"SIGNALREF" ) )
1127 else if( attOwnerVal == wxT(
"SYMBOL" ) )
1129 else if( attOwnerVal == wxT(
"SYMDEF" ) )
1131 else if( attOwnerVal == wxT(
"TEMPLATE" ) )
1133 else if( attOwnerVal == wxT(
"TESTPOINT" ) )
1138 else if( cNodeName == wxT(
"ATTRUSAGE" ) )
1142 if( attUsageVal == wxT(
"BOTH" ) )
1144 else if( attUsageVal == wxT(
"COMPONENT" ) )
1146 else if( attUsageVal == wxT(
"PART_DEFINITION" ) )
1148 else if( attUsageVal == wxT(
"PART_LIBRARY" ) )
1150 else if( attUsageVal == wxT(
"SYMBOL" ) )
1155 else if( cNodeName == wxT(
"NOTRANSFER" ) )
1159 else if( cNodeName == wxT(
"COLUMNORDER" ) )
1162 cOrder.
Parse( cNode, aContext );
1163 ColumnOrders.push_back( cOrder );
1165 else if( cNodeName == wxT(
"COLUMNWIDTH" ) )
1168 cWidth.
Parse( cNode, aContext );
1169 ColumnWidths.push_back( cWidth );
1171 else if( cNodeName == wxT(
"COLUMNINVISIBLE" ) )
1173 ColumnInvisible =
true;
1185 wxASSERT( aNode->GetName() == wxT(
"ATTR" ) );
1192 for( ; cNode; cNode = cNode->
GetNext() )
1194 if( cNode->GetName() == wxT(
"READONLY" ) )
1198 else if( cNode->GetName() == wxT(
"ATTRLOC" ) )
1200 AttributeLocation.Parse( cNode, aContext );
1213 wxASSERT( aNode->GetName() == wxT(
"TEXTLOC" ) );
1216 bool attributeIDisSet =
false;
1218 if( attributeStr == wxT(
"PART_NAME" ) )
1221 attributeIDisSet =
true;
1223 else if( attributeStr == wxT(
"COMP_NAME" ) )
1226 attributeIDisSet =
true;
1228 else if( attributeStr == wxT(
"COMP_NAME2" ) )
1231 attributeIDisSet =
true;
1233 else if( attributeStr == wxT(
"SYMBOL_NAME" ) )
1236 attributeIDisSet =
true;
1238 else if( attributeStr == wxT(
"LINK_ORIGIN" ) )
1241 attributeIDisSet =
true;
1243 else if( attributeStr == wxT(
"SIGNALNAME_ORIGIN" ) )
1246 attributeIDisSet =
true;
1248 else if( attributeStr == wxT(
"ATTRREF" ) )
1251 attributeIDisSet =
false;
1264 for( ; cNode; cNode = cNode->
GetNext() )
1266 wxString cNodeName = cNode->GetName();
1268 if( ParseSubNode( cNode, aContext ) )
1272 else if( !attributeIDisSet && cNodeName == wxT(
"ATTRREF" ) )
1275 attributeIDisSet =
true;
1277 else if( cNodeName == wxT(
"ORIENT" ) )
1281 else if( cNodeName == wxT(
"MIRROR" ) )
1285 else if( cNodeName == wxT(
"FIX" ) )
1289 else if( cNodeName == wxT(
"ALIGN" ) )
1293 else if( cNodeName == wxT(
"JUSTIFICATION" ) )
1303 if( !Position.IsFullySpecified() )
1310 wxASSERT( aNode->GetName() == wxT(
"NETCLASS" ) );
1318 for( ; cNode; cNode = cNode->
GetNext() )
1320 wxString cNodeName = cNode->GetName();
1322 if( cNodeName == wxT(
"ATTR" ) )
1325 attribute_val.
Parse( cNode, aContext );
1326 Attributes.push_back( attribute_val );
1338 wxASSERT( aNode->GetName() == wxT(
"SPCCLASSNAME" ) );
1347 wxString nodeName = aChildNode->GetName();
1349 if( nodeName == wxT(
"LINECODE" ) )
1352 linecode.
Parse( aChildNode, aContext );
1353 LineCodes.insert( std::make_pair( linecode.
ID, linecode ) );
1355 else if( nodeName == wxT(
"HATCHCODE" ) )
1358 hatchcode.
Parse( aChildNode, aContext );
1359 HatchCodes.insert( std::make_pair( hatchcode.
ID, hatchcode ) );
1361 else if( nodeName == wxT(
"TEXTCODE" ) )
1364 textcode.
Parse( aChildNode, aContext );
1365 TextCodes.insert( std::make_pair( textcode.
ID, textcode ) );
1367 else if( nodeName == wxT(
"ROUTECODE" ) )
1370 routecode.
Parse( aChildNode, aContext );
1371 RouteCodes.insert( std::make_pair( routecode.
ID, routecode ) );
1373 else if( nodeName == wxT(
"ATTRNAME" ) )
1376 attrname.
Parse( aChildNode, aContext );
1377 AttributeNames.insert( std::make_pair( attrname.
ID, attrname ) );
1379 else if( nodeName == wxT(
"NETCLASS" ) )
1382 netclass.
Parse( aChildNode, aContext );
1383 NetClasses.insert( std::make_pair( netclass.
ID, netclass ) );
1385 else if( nodeName == wxT(
"SPCCLASSNAME" ) )
1388 spcclassname.
Parse( aChildNode, aContext );
1389 SpacingClassNames.insert( std::make_pair( spcclassname.
ID, spcclassname ) );
1402 wxASSERT( aNode->GetName() == wxT(
"SWAPRULE" ) );
1407 if( swapRuleStr == wxT(
"NO_SWAP" ) )
1409 else if( swapRuleStr == wxT(
"USE_SWAP_LAYER" ) )
1420 wxASSERT( aNode->GetName() == wxT(
"REUSEBLOCK" ) );
1428 for( ; cNode; cNode = cNode->
GetNext() )
1430 wxString cNodeName = cNode->GetName();
1432 if( cNodeName == wxT(
"MIRROR" ) )
1434 else if( cNodeName == wxT(
"ORIENT" ) )
1444 return ReuseBlockID == wxEmptyString && ItemReference == wxEmptyString;
1450 wxASSERT( aNode->GetName() == wxT(
"REUSEBLOCKREF" ) );
1461 wxASSERT( aNode->GetName() == wxT(
"GROUP" ) );
1468 for( ; cNode; cNode = cNode->
GetNext() )
1470 wxString cNodeName = cNode->GetName();
1472 if( cNodeName == wxT(
"FIX" ) )
1474 else if( cNodeName == wxT(
"TRANSFER" ) )
1476 else if( cNodeName == wxT(
"GROUPREF" ) )
1478 else if( cNodeName == wxT(
"REUSEBLOCKREF" ) )
1479 ReuseBlockRef.Parse( cNode, aContext );
1488 wxASSERT( aNode->GetName() == wxT(
"FIGURE" ) );
1495 bool shapeIsInitialised =
false;
1501 for( ; cNode; cNode = cNode->
GetNext() )
1503 wxString cNodeName = cNode->GetName();
1505 if( !shapeIsInitialised && Shape.IsShape( cNode ) )
1507 Shape.Parse( cNode, aContext );
1508 shapeIsInitialised =
true;
1510 else if( cNodeName == wxT(
"SWAPRULE" ) )
1514 else if( cNodeName == wxT(
"FIX" ) )
1518 else if( cNodeName == wxT(
"GROUPREF" ) )
1523 else if( cNodeName == wxT(
"REUSEBLOCKREF" ) )
1525 ReuseBlockRef.Parse( cNode, aContext );
1527 else if( cNodeName == wxT(
"ATTR" ) )
1530 attr.
Parse( cNode, aContext );
1531 AttributeValues.insert( std::make_pair( attr.
AttributeID, attr ) );
1543 Parse( aNode, aContext,
true );
1550 wxASSERT( aNode->GetName() == wxT(
"TEXT" ) );
1566 for( ; cNode; cNode = cNode->
GetNext() )
1568 wxString cNodeName = cNode->GetName();
1570 if( cNodeName == wxT(
"PT" ) )
1571 Position.Parse( cNode, aContext );
1572 else if( cNodeName == wxT(
"ORIENT" ) )
1574 else if( cNodeName == wxT(
"MIRROR" ) )
1576 else if( cNodeName == wxT(
"FIX" ) )
1578 else if( cNodeName == wxT(
"SWAPRULE" ) )
1580 else if( cNodeName == wxT(
"ALIGN" ) )
1582 else if( cNodeName == wxT(
"JUSTIFICATION" ) )
1584 else if( cNodeName == wxT(
"GROUPREF" ) )
1586 else if( cNodeName == wxT(
"REUSEBLOCKREF" ) )
1587 ReuseBlockRef.Parse( cNode, aContext );
1596 wxASSERT( aNode->GetName() == wxT(
"SYMDEF" ) );
1606 wxString cNodeName = aChildNode->GetName();
1608 if( cNodeName == wxT(
"PT" ) )
1610 Origin.Parse( aChildNode, aContext );
1612 else if( cNodeName == wxT(
"STUB" ) )
1616 else if( cNodeName == wxT(
"VERSION" ) )
1620 else if( cNodeName == wxT(
"FIGURE" ) )
1623 figure.
Parse( aChildNode, aContext );
1624 Figures.insert( std::make_pair( figure.
ID, figure ) );
1626 else if( cNodeName == wxT(
"TEXT" ) )
1629 txt.
Parse( aChildNode, aContext );
1630 Texts.insert( std::make_pair( txt.
ID, txt ) );
1632 else if( cNodeName == wxT(
"TEXTLOC" ) )
1635 textloc.
Parse( aChildNode, aContext );
1636 TextLocations.insert( std::make_pair( textloc.
AttributeID, textloc ) );
1638 else if( cNodeName == wxT(
"ATTR" ) )
1641 attrVal.
Parse( aChildNode, aContext );
1642 AttributeValues.insert( std::make_pair( attrVal.
AttributeID, attrVal ) );
1655 wxASSERT( aNode->GetName() == wxT(
"GATEDEFINITION" ) );
1668 wxASSERT( aNode->GetName() == wxT(
"PINTYPE" ) );
1672 std::map<wxString, PIN_TYPE> pinTypeMap = { { wxT(
"INPUT" ), PIN_TYPE::INPUT },
1673 { wxT(
"OUTPUT_OR" ), PIN_TYPE::OUTPUT_OR },
1674 { wxT(
"OUTPUT_NOT_OR" ), PIN_TYPE::OUTPUT_NOT_OR },
1675 { wxT(
"OUTPUT_NOT_NORM_OR" ), PIN_TYPE::OUTPUT_NOT_NORM_OR },
1676 { wxT(
"POWER" ), PIN_TYPE::POWER }, { wxT(
"GROUND" ), PIN_TYPE::GROUND },
1677 { wxT(
"TRISTATE_BIDIR" ), PIN_TYPE::TRISTATE_BIDIR },
1678 { wxT(
"TRISTATE_INPUT" ), PIN_TYPE::TRISTATE_INPUT },
1679 { wxT(
"TRISTATE_DRIVER" ), PIN_TYPE::TRISTATE_DRIVER } };
1681 if( pinTypeMap.find( pinTypeStr ) == pinTypeMap.end() )
1684 return pinTypeMap[pinTypeStr];
1690 wxASSERT( aNode->GetName() == wxT(
"PARTDEFINITIONPIN" ) );
1696 for( ; cNode; cNode = cNode->
GetNext() )
1698 wxString cNodeName = cNode->GetName();
1700 if( cNodeName == wxT(
"PINNAME" ) )
1704 else if( cNodeName == wxT(
"PINLABEL" ) )
1708 else if( cNodeName == wxT(
"PINSIGNAL" ) )
1712 else if( cNodeName == wxT(
"PINTERM" ) )
1717 else if( cNodeName == wxT(
"PINTYPE" ) )
1719 Type = GetPinType( cNode );
1721 else if( cNodeName == wxT(
"PINLOAD" ) )
1725 else if( cNodeName == wxT(
"PINPOSITION" ) )
1729 else if( cNodeName == wxT(
"PINIDENTIFIER" ) )
1743 wxASSERT( aNode->GetName() == wxT(
"PARTPIN" ) );
1749 for( ; cNode; cNode = cNode->
GetNext() )
1751 wxString cNodeName = cNode->GetName();
1753 if( cNodeName == wxT(
"PINNAME" ) )
1755 else if( cNodeName == wxT(
"PINTYPE" ) )
1756 Type = GetPinType( cNode );
1757 else if( cNodeName == wxT(
"PINIDENTIFIER" ) )
1768 wxASSERT( aNode->GetName() == wxT(
"PINEQUIVALENCE" ) );
1770 wxXmlAttribute* xmlAttribute = aNode->GetAttributes();
1772 for( ; xmlAttribute; xmlAttribute = xmlAttribute->GetNext() )
1779 if( !xmlAttribute->GetValue().ToLong( &pinId ) )
1792 wxASSERT( aNode->GetName() == wxT(
"SWAPGATE" ) );
1794 wxXmlAttribute* xmlAttribute = aNode->GetAttributes();
1796 for( ; xmlAttribute; xmlAttribute = xmlAttribute->GetNext() )
1803 if( !xmlAttribute->GetValue().ToLong( &pinId ) )
1816 wxASSERT( aNode->GetName() == wxT(
"SWAPGROUP" ) );
1822 for( ; cNode; cNode = cNode->
GetNext() )
1824 wxString cNodeName = cNode->GetName();
1826 if( cNodeName == wxT(
"EXTERNAL" ) )
1830 else if( cNodeName == wxT(
"SWAPGATE" ) )
1833 swapGate.
Parse( cNode, aContext );
1834 SwapGates.push_back( swapGate );
1846 wxASSERT( aNode->GetName() == wxT(
"PARTDEFINITION" ) );
1852 for( ; cNode; cNode = cNode->
GetNext() )
1854 wxString cNodeName = cNode->GetName();
1856 if( cNodeName == wxT(
"HIDEPINNAMES" ) )
1858 HidePinNames =
true;
1860 else if( cNodeName == wxT(
"MAXPIN" ) )
1864 else if( cNodeName == wxT(
"GATEDEFINITION" ) )
1867 gate.
Parse( cNode, aContext );
1868 GateSymbols.insert( std::make_pair( gate.
ID, gate ) );
1870 else if( cNodeName == wxT(
"PARTDEFINITIONPIN" ) )
1873 pin.Parse( cNode, aContext );
1874 Pins.insert( std::make_pair(
pin.ID,
pin ) );
1876 else if( cNodeName == wxT(
"ATTR" ) )
1879 attr.
Parse( cNode, aContext );
1880 AttributeValues.insert( std::make_pair( attr.
AttributeID, attr ) );
1882 else if( cNodeName == wxT(
"PINEQUIVALENCE" ) )
1885 pinEq.
Parse( cNode, aContext );
1886 PinEquivalences.push_back( pinEq );
1888 else if( cNodeName == wxT(
"SWAPGROUP" ) )
1891 swapGroup.
Parse( cNode, aContext );
1892 SwapGroups.push_back( swapGroup );
1904 wxASSERT( aNode->GetName() == wxT(
"PART" ) );
1911 for( ; cNode; cNode = cNode->
GetNext() )
1913 wxString cNodeName = cNode->GetName();
1915 if( cNodeName == wxT(
"VERSION" ) )
1919 else if( cNodeName == wxT(
"HIDEPINNAMES" ) )
1921 HidePinNames =
true;
1923 else if( cNodeName == wxT(
"PARTDEFINITION" ) )
1925 Definition.Parse( cNode, aContext );
1927 else if( cNodeName == wxT(
"PARTPIN" ) )
1930 pin.Parse( cNode, aContext );
1931 PartPins.insert( std::make_pair(
pin.ID,
pin ) );
1933 else if( cNodeName == wxT(
"ATTR" ) )
1936 attr.
Parse( cNode, aContext );
1937 AttributeValues.insert( std::make_pair( attr.
AttributeID, attr ) );
1949 wxASSERT( aNode->GetName() == wxT(
"PARTS" ) );
1953 for( ; cNode; cNode = cNode->GetNext() )
1955 wxString cNodeName = cNode->GetName();
1957 if( cNodeName == wxT(
"PART" ) )
1960 part.
Parse( cNode, aContext );
1961 PartDefinitions.insert( std::make_pair( part.
ID, part ) );
1976 wxASSERT( aNode->GetName() == wxT(
"JPT" ) );
1986 wxString cNodeName = aChildNode->GetName();
1988 if( cNodeName == wxT(
"PT" ) )
1989 Location.Parse( aChildNode, aContext );
1990 else if( cNodeName == wxT(
"FIX" ) )
1992 else if( cNodeName == wxT(
"GROUPREF" ) )
1994 else if( cNodeName == wxT(
"REUSEBLOCKREF" ) )
1995 ReuseBlockRef.Parse( aChildNode, aContext );
2005 ParseIdentifiers( aNode, aContext );
2008 for( ; cNode; cNode = cNode->
GetNext() )
2010 if( ParseSubNode( cNode, aContext ) )
2021 wxASSERT( aNode->GetName() == wxT(
"CONN" ) );
2032 wxString cNodeName = aChildNode->GetName();
2034 if( cNodeName == wxT(
"FIX" ) )
2038 else if( cNodeName == wxT(
"HIDDEN" ) )
2042 else if( cNodeName == wxT(
"GROUPREF" ) )
2046 else if( cNodeName == wxT(
"REUSEBLOCKREF" ) )
2048 ReuseBlockRef.Parse( aChildNode, aContext );
2050 else if( cNodeName == wxT(
"ATTR" ) )
2053 attrVal.
Parse( aChildNode, aContext );
2054 AttributeValues.insert( std::make_pair( attrVal.
AttributeID, attrVal ) );
2067 wxASSERT( aNode->GetName() == wxT(
"NET" ) );
2075 wxString cNodeName = aChildNode->GetName();
2077 if( cNodeName == wxT(
"NETCODE" ) )
2081 else if( cNodeName == wxT(
"SIGNAME" ) )
2085 else if( cNodeName == wxT(
"SIGNUM" ) )
2089 else if( cNodeName == wxT(
"HIGHLIT" ) )
2093 else if( cNodeName == wxT(
"JPT" ) )
2096 jpt.
Parse( aChildNode, aContext );
2097 Junctions.insert( std::make_pair( jpt.
ID, jpt ) );
2099 else if( cNodeName == wxT(
"NETCLASSREF" ) )
2103 else if( cNodeName == wxT(
"SPACINGCLASS" ) )
2107 else if( cNodeName == wxT(
"ATTR" ) )
2110 attrVal.
Parse( aChildNode, aContext );
2111 AttributeValues.insert( std::make_pair( attrVal.
AttributeID, attrVal ) );
2124 wxASSERT( aNode->GetName() == wxT(
"DOCSYMBOL" ) );
2131 bool originParsed =
false;
2133 for( ; cNode; cNode = cNode->
GetNext() )
2135 wxString cNodeName = cNode->GetName();
2137 if( !originParsed && cNodeName == wxT(
"PT" ) )
2139 Origin.Parse( cNode, aContext );
2140 originParsed =
true;
2142 else if( cNodeName == wxT(
"GROUPREF" ) )
2146 else if( cNodeName == wxT(
"REUSEBLOCKREF" ) )
2148 ReuseBlockRef.Parse( cNode, aContext );
2150 else if( cNodeName == wxT(
"FIX" ) )
2154 else if( cNodeName == wxT(
"MIRROR" ) )
2158 else if( cNodeName == wxT(
"READABILITY" ) )
2162 else if( cNodeName == wxT(
"ORIENT" ) )
2166 else if( cNodeName == wxT(
"ATTR" ) )
2169 attr.
Parse( cNode, aContext );
2170 AttributeValues.insert( std::make_pair( attr.
AttributeID, attr ) );
2172 else if( cNodeName == wxT(
"SCALE" ) )
2190 wxASSERT( aNode->GetName() == wxT(
"DFLTSETTINGS" ) );
2196 for( ; cNode; cNode = cNode->
GetNext() )
2198 wxString cNodeName = cNode->GetName();
2200 if( cNodeName == wxT(
"INVISIBLE" ) )
2214 wxASSERT( aNode->GetName() == wxT(
"ATTRCOL" ) );
2221 for( ; cNode; cNode = cNode->
GetNext() )
2223 wxString cNodeName = cNode->GetName();
2225 if( cNodeName == wxT(
"INVISIBLE" ) )
2229 else if( cNodeName == wxT(
"NOTPICKABLE" ) )
2243 wxASSERT( aNode->GetName() == wxT(
"ATTRCOLORS" ) );
2247 for( ; cNode; cNode = cNode->GetNext() )
2249 wxString cNodeName = cNode->GetName();
2251 if( cNodeName == wxT(
"DFLTSETTINGS" ) )
2253 DefaultSettings.Parse( cNode, aContext );
2255 else if( cNodeName == wxT(
"ATTRCOL" ) )
2258 attrcol.
Parse( cNode, aContext );
2259 AttributeColors.insert( { attrcol.
AttributeID, attrcol } );
2271 wxASSERT( aNode->GetName() == wxT(
"PARTNAMECOL" ) );
2277 for( ; cNode; cNode = cNode->
GetNext() )
2279 wxString cNodeName = cNode->GetName();
2281 if( cNodeName == wxT(
"INVISIBLE" ) )
2285 else if( cNodeName == wxT(
"NOTPICKABLE" ) )
2300 int numAttributes = 0;
2302 if( aNode->GetAttribute( wxT(
"numAttributes" ), &result ) )
2304 numAttributes = wxAtoi( result );
2305 aNode->DeleteAttribute( wxT(
"numAttributes" ) );
2309 aNode->AddAttribute( wxT(
"numAttributes" ),
wxString::Format( wxT(
"%i" ), numAttributes ) );
2311 wxString paramName = wxT(
"attr" );
2312 paramName << numAttributes;
2314 aNode->AddAttribute( paramName, aValue );
2321 KEYWORD emptyKeywords[1] = {};
2322 XNODE * iNode =
nullptr, *cNode =
nullptr;
2324 bool cadstarFileCheckDone =
false;
2326 wxCSConv win1252( wxT(
"windows-1252" ) );
2327 wxMBConv* conv = &win1252;
2331 FILE* fp = wxFopen( aFileName, wxT(
"rt" ) );
2336 fseek( fp, 0L, SEEK_END );
2337 long fileSize = ftell( fp );
2340 DSNLEXER lexer( emptyKeywords, 0, fp, aFileName );
2342 auto currentProgress = [&]() ->
double 2344 return static_cast<double>( ftell( fp ) ) / fileSize;
2347 double previousReportedProgress = -1.0;
2351 if( aProgressReporter && ( currentProgress() - previousReportedProgress ) > 0.01 )
2357 previousReportedProgress = currentProgress();
2370 THROW_IO_ERROR(
_(
"The selected file is not valid or might be corrupt!" ) );
2376 str = wxString( lexer.
CurText(), *conv );
2377 cNode =
new XNODE( wxXML_ELEMENT_NODE, str );
2383 iNode->AddChild( cNode );
2385 else if( !cadstarFileCheckDone )
2387 if( cNode->GetName() != aFileTypeIdentifier )
2388 THROW_IO_ERROR(
_(
"The selected file is not valid or might be corrupt!" ) );
2390 cadstarFileCheckDone =
true;
2397 str = wxString( lexer.
CurText(), *conv );
2404 THROW_IO_ERROR(
_(
"The selected file is not valid or might be corrupt!" ) );
2409 if( iNode !=
nullptr )
2410 THROW_IO_ERROR(
_(
"The selected file is not valid or might be corrupt!" ) );
2416 THROW_IO_ERROR(
_(
"The selected file is not valid or might be corrupt!" ) );
2424 return aAttribute->GetName() != wxT(
"numAttributes" );
2431 wxString attrName, retVal;
2432 attrName = wxT(
"attr" );
2435 if( !aNode->GetAttribute( attrName, &retVal ) )
2440 return wxEmptyString;
2474 if( aNode && aNode->
GetNext() )
2482 if( aNode->
GetChildren()->GetName() == wxT(
"E" ) )
2492 std::vector<POINT> retVal;
2496 for( ; cNode; cNode = cNode->
GetNext() )
2498 if( cNode->GetName() == wxT(
"PT" ) )
2502 pt.
Parse( cNode, aContext );
2503 retVal.push_back( pt );
2505 else if( aTestAllChildNodes )
2512 && retVal.size() != static_cast<size_t>( aExpectedNumPoints ) )
2515 _(
"Unexpected number of points in '%s'. Found %d but expected %d." ),
2516 aNode->GetName(), retVal.size(), aExpectedNumPoints ) );
2526 std::vector<VERTEX> retVal;
2530 for( ; cNode; cNode = cNode->
GetNext() )
2536 vertex.
Parse( cNode, aContext );
2537 retVal.push_back( vertex );
2539 else if( aTestAllChildNodes )
2552 std::vector<CUTOUT> retVal;
2556 for( ; cNode; cNode = cNode->
GetNext() )
2558 if( cNode->GetName() == wxT(
"CUTOUT" ) )
2562 cutout.
Parse( cNode, aContext );
2563 retVal.push_back( cutout );
2565 else if( aTestAllChildNodes )
2580 for( ; childNodes; childNodes = childNodes->
GetNext() )
2592 for( ; level1Node; level1Node = level1Node->
GetNext() )
2594 for( wxString childNodeName : aSubNodeChildrenToCount )
2596 if( level1Node->GetName() == childNodeName )
2609 wxString escapedText = aCadstarString;
2611 escapedText.Replace( wxT(
"'" ), wxT(
"~" ) );
2619 if( !aKiCadTextItem->
GetText().IsEmpty() )
2622 wxPoint positionOffset( 0, aKiCadTextItem->
GetInterline() );
2625 EDA_ITEM* textEdaItem = dynamic_cast<EDA_ITEM*>( aKiCadTextItem );
2631 positionOffset.y = -positionOffset.y;
2636 int numExtraLines =
text.Replace( wxT(
"\n" ), wxT(
"\n" ) );
2637 numExtraLines -=
text.at(
text.size() - 1 ) ==
'\n';
2638 positionOffset.x *= numExtraLines;
2639 positionOffset.y *= numExtraLines;
2641 aKiCadTextItem->
Offset( positionOffset );
long PART_DEFINITION_PIN_ID
Pin identifier in the part definition.
wxString ConvertToNewOverbarNotation(const wxString &aOldStr)
Convert the old ~...~ overbar notation to the new ~{...} one.
READABILITY
Sets the readability direction of text.
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
void Offset(const wxPoint &aOffset)
From CADSTAR Help: Assigned to Parts library Definitions and displayed by the Library searcher.
int GetInterline() const
Return the distance between two lines of text.
static long GetNumberOfChildNodes(XNODE *aNode)
bool ParseSubNode(XNODE *aChildNode, PARSER_CONTEXT *aContext)
static const double TXT_HEIGHT_RATIO
CADSTAR fonts are drawn on a 24x24 integer matrix, where the each axis goes from 0 to 24.
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
virtual void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
static XNODE * LoadArchiveFile(const wxString &aFileName, const wxString &aFileTypeIdentifier, PROGRESS_REPORTER *aProgressReporter=nullptr)
Reads a CADSTAR Archive file (S-parameter format)
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
static ANGUNITS ParseAngunits(XNODE *aNode)
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
#define SIGNALNAME_ORIGIN_ATTRID
static JUSTIFICATION ParseJustification(XNODE *aNode)
TEXT_FIELD_NAME
These are special fields in text objects enclosed between the tokens '<@' and '>' such as <@[FIELD_NA...
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
static PIN_TYPE GetPinType(XNODE *aNode)
A progress reporter interface for use in multi-threaded environments.
#define COMPONENT_NAME_2_ATTRID
Component Name 2 Attribute ID - typically used for indicating the placement of designators in placeme...
void ParseIdentifiers(XNODE *aNode, PARSER_CONTEXT *aContext)
Filled closed shape (hatch fill).
< "GATEDEFINITION" node name
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
static bool IsValidAttribute(wxXmlAttribute *aAttribute)
From CADSTAR Help: Assigned to Schematic Symbols and displayed on Schematic Designs.
Param1 = X Step, Param2 = Y Step. A standard x,y grid.
#define SYMBOL_NAME_ATTRID
Symbol Name attribute ID - used for placement of designators on the schematic.
#define COMPONENT_NAME_ATTRID
Component Name Attribute ID - typically used for placement of designators on silk screen.
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
From CADSTAR Help: Only used by non-Cadstar applications.
static SWAP_RULE ParseSwapRule(XNODE *aNode)
#define THROW_MISSING_PARAMETER_IO_ERROR(param, location)
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
POSITION
Positioning of pin names can be in one of four quadrants.
void RotatePoint(int *pX, int *pY, double angle)
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
const char * CurText() const
Return a pointer to the current token's text.
std::map< wxString, wxString > FilenamesToTextMap
CADSTAR doesn't have user defined text fields but does allow loading text from a file.
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
static void CheckNoChildNodes(XNODE *aNode)
void ParseIdentifiers(XNODE *aNode, PARSER_CONTEXT *aContext)
virtual void AdvanceProgress()=0
Increment the progress bar length (inside the current virtual zone).
virtual void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
Helper functions and common defines between schematic and PCB Archive files.
< "PARTDEFINITIONPIN" node name
This file contains miscellaneous commonly used macros and functions.
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
static bool IsGrid(XNODE *aNode)
std::set< TEXT_FIELD_NAME > InconsistentTextFields
Text fields need to be updated in CADSTAR and it is possible that they are not consistent across text...
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
std::map< wxString, wxString > TextToHyperlinksMap
KiCad doesn't support hyperlinks but we use this map to display warning messages after import.
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
std::function< void()> CheckPointCallback
Callback function to report progress.
bool ParseSubNode(XNODE *aChildNode, PARSER_CONTEXT *aContext)
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
Inherits from design units (assumed Assignments->Technology->Units)
Represents a point in x,y coordinates.
XNODE * GetChildren() const
ALIGNMENT
From CADSTAR Help: "Text Alignment enables you to define the position of an alignment origin for all ...
Represents a floating value in E notation.
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
bool ParseSubNode(XNODE *aChildNode, PARSER_CONTEXT *aContext)
XNODE * GetParent() const
bool IsEmpty()
Determines if this is empty (i.e. no design reuse associated)
bool ParseSubNode(XNODE *aChildNode, PARSER_CONTEXT *aContext)
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
static std::vector< VERTEX > ParseAllChildVertices(XNODE *aNode, PARSER_CONTEXT *aContext, bool aTestAllChildNodes=false)
if no children are present, it just returns an empty vector (without throwing an exception)
void ParseIdentifiers(XNODE *aNode, PARSER_CONTEXT *aContext)
When text is vertical, show it rotated 90 degrees clockwise.
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
static bool IsShape(XNODE *aNode)
static std::vector< CUTOUT > ParseAllChildCutouts(XNODE *aNode, PARSER_CONTEXT *aContext, bool aTestAllChildNodes=false)
if no children are present, it just returns an empty vector (without throwing an exception)
SWAP_RULE
Corresponds to "Display when" Item property.
#define THROW_PARSING_IO_ERROR(param, location)
#define THROW_MISSING_NODE_IO_ERROR(nodename, location)
virtual void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
< "PINEQUIVALENCE" Node name
static void FixTextPositionNoAlignment(EDA_TEXT *aKiCadTextItem)
Corrects the position of a text element that had NO_ALIGNMENT in CADSTAR.
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
static bool IsVertex(XNODE *aNode)
bool ParseSubNode(XNODE *aChildNode, PARSER_CONTEXT *aContext)
static wxString ParseTextFields(const wxString &aTextString, PARSER_CONTEXT *aParserContext)
Replaces CADSTAR fields for the equivalent in KiCad and stores the field values in aParserContext.
static const long UNDEFINED_VALUE
Corresponds to CADSTAR "origin".
< Nodename = "VARIANT" or "VMASTER" (master variant
static long GetXmlAttributeIDLong(XNODE *aNode, unsigned int aID, bool aIsRequired=true)
NOTE from CADSTAR help: To convert a Part Definition Attribute into a hyperlink, prefix the attribute...
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
void checkPoint()
Updates m_progressReporter or throws if user cancelled.
Hold an XML or S-expression element.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
JUSTIFICATION
From CADSTAR Help: "Multi Line Text can also be justified as Left, Centre or Right.
double GetTextAngleDegrees() const
static READABILITY ParseReadability(XNODE *aNode)
Param1 = Units, Param2 = Divisor.
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
static void CheckNoNextNodes(XNODE *aNode)
< "SWAPGATE" Node name (represents an "Element")
#define LINK_ORIGIN_ATTRID
static void ParseChildEValue(XNODE *aNode, PARSER_CONTEXT *aContext, EVALUE &aValueToParse)
bool ParseSubNode(XNODE *aChildNode, PARSER_CONTEXT *aContext)
void ParseIdentifiers(XNODE *aNode, PARSER_CONTEXT *aContext)
PROGRESS_REPORTER * m_progressReporter
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
static void InsertAttributeAtEnd(XNODE *aNode, wxString aValue)
int NextTok()
Return the next token found in the input file or DSN_EOF when reaching the end of file.
Unfilled open shape. Cannot have cutouts.
static UNITS ParseUnits(XNODE *aNode)
A base class for most all the KiCad significant classes used in schematics and boards.
void ParseIdentifiers(XNODE *aNode, PARSER_CONTEXT *aContext)
From CADSTAR Help: Assigned to PCB components and displayed on PCB designs.
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
NETELEMENT_ID ID
First character is "J".
KICAD_PLUGIN_EXPORT SCENEGRAPH * Load(char const *aFileName)
reads a model file and creates a generic display structure
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
virtual bool KeepRefreshing(bool aWait=false)=0
Update the UI (if any).
#define THROW_UNKNOWN_NODE_IO_ERROR(nodename, location)
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
static wxString HandleTextOverbar(wxString aCadstarString)
Convert a string with CADSTAR overbar characters to equivalent in KiCad.
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
Hold a keyword string and its unique integer token.
static wxString GetXmlAttributeIDString(XNODE *aNode, unsigned int aID, bool aIsRequired=true)
static ALIGNMENT ParseAlignment(XNODE *aNode)
NO_ALIGNMENT has different meaning depending on the object type.
#define THROW_IO_ERROR(msg)
Implement a lexical analyzer for the SPECCTRA DSN file format.
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
Filled closed shape (solid fill).
virtual const wxString & GetText() const
Return the string associated with the text object.
std::map< TEXT_FIELD_NAME, wxString > TextFieldToValuesMap
Values for the text field elements used in the CADSTAR design extracted from the text element instanc...
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
GATE_ID ID
Usually "A", "B", "C", etc.
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
static long GetNumberOfStepsForReporting(XNODE *aRootNode, std::vector< wxString > aSubNodeChildrenToCount)
#define THROW_UNKNOWN_PARAMETER_IO_ERROR(param, location)
static std::vector< POINT > ParseAllChildPoints(XNODE *aNode, PARSER_CONTEXT *aContext, bool aTestAllChildNodes=false, int aExpectedNumPoints=UNDEFINED_VALUE)
if no children are present, it just returns an empty vector (without throwing an exception)
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
bool ParseSubNode(XNODE *aChildNode, PARSER_CONTEXT *aContext)
static const std::map< TEXT_FIELD_NAME, wxString > CADSTAR_TO_KICAD_FIELDS
Map between CADSTAR fields and KiCad text variables.
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
Represents a cutout in a closed shape (e.g.
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
KICAD_T Type() const
Returns the type of object.
From CADSTAR Help: Assigned to both Schematic symbols and PCB components, and displayed on Schematic ...
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
Represents a vertex in a shape.
virtual void SetCurrentProgress(double aProgress)=0
Set the progress value to aProgress (0..1).
When text is vertical, show it rotated 90 degrees anticlockwise.