265 bool aClosed,
bool aInFill )
const
267 std::vector<std::unique_ptr<PCB_SHAPE>> results;
270 for(
int i = 0; i < polyData.size(); i++ )
272 nlohmann::json val = polyData.at( i );
274 if( val.is_string() )
277 if( str == wxS(
"CIRCLE" ) )
280 center.x = ( polyData.at( ++i ) );
281 center.y = ( polyData.at( ++i ) );
282 double r = ( polyData.at( ++i ) );
284 std::unique_ptr<PCB_SHAPE> shape =
289 shape->SetFilled( aClosed );
291 results.emplace_back( std::move( shape ) );
293 else if( str == wxS(
"R" ) )
296 start.
x = ( polyData.at( ++i ) );
297 start.
y = ( polyData.at( ++i ) );
298 size.
x = ( polyData.at( ++i ) );
299 size.
y = -( polyData.at( ++i ).get<double>() );
300 double angle = polyData.at( ++i );
301 double cr = ( i + 1 ) < polyData.size() ? polyData.at( ++i ).get<
double>() : 0;
305 std::unique_ptr<PCB_SHAPE> shape =
308 shape->SetStart(
ScalePos( start ) );
309 shape->SetEnd(
ScalePos( start + size ) );
310 shape->SetFilled( aClosed );
313 results.emplace_back( std::move( shape ) );
321 std::unique_ptr<PCB_SHAPE> shape =
324 shape->SetStart(
ScalePos( aStart ) );
326 shape->SetFilled( aClosed );
329 results.emplace_back( std::move( shape ) );
334 std::unique_ptr<PCB_SHAPE> shape =
335 std::make_unique<PCB_SHAPE>( aContainer,
SHAPE_T::ARC );
337 shape->SetStart(
ScalePos( aStart ) );
340 shape->SetFilled( aClosed );
343 results.emplace_back( std::move( shape ) );
351 addArc( {
end.x - cr, start.
y }, {
end.x, start.
y - cr },
352 {
end.x - cr, start.
y - cr } );
355 {
end.x - cr,
end.y + cr } );
357 addArc( { start.
x + cr,
end.y }, { start.
x,
end.y + cr },
358 { start.
x + cr,
end.y + cr } );
360 addArc( { start.
x, start.
y - cr }, { start.
x + cr, start.
y },
361 { start.
x + cr, start.
y - cr } );
364 else if( str == wxS(
"ARC" ) || str == wxS(
"CARC" ) )
367 double angle = polyData.at( ++i ).get<
double>() / ( aInFill ? 10 : 1 );
368 end.x = ( polyData.at( ++i ) );
369 end.y = ( polyData.at( ++i ) );
371 std::unique_ptr<PCB_SHAPE> shape =
372 std::make_unique<PCB_SHAPE>( aContainer,
SHAPE_T::ARC );
376 shape->SetStart(
ScalePos( prevPt ) );
382 shape->SetEnd(
ScalePos( prevPt ) );
388 double ha = angle / 2;
389 double hd =
delta.EuclideanNorm() / 2;
390 double cdist = hd / tan(
DEG2RAD( ha ) );
394 shape->SetFilled( aClosed );
396 results.emplace_back( std::move( shape ) );
400 else if( str == wxS(
"L" ) )
405 while( i < polyData.size() - 2 && polyData.at( i + 1 ).is_number() )
408 pt.
x = ( polyData.at( ++i ) );
409 pt.
y = ( polyData.at( ++i ) );
418 std::unique_ptr<PCB_SHAPE> shape =
421 wxASSERT(
chain.PointCount() > 2 );
423 if(
chain.PointCount() > 2 )
425 chain.SetClosed(
true );
426 shape->SetFilled(
true );
427 shape->SetPolyShape(
chain );
429 results.emplace_back( std::move( shape ) );
434 for(
int s = 0; s <
chain.SegmentCount(); s++ )
438 std::unique_ptr<PCB_SHAPE> shape =
441 shape->SetStart( seg.
A );
442 shape->SetEnd( seg.
B );
444 results.emplace_back( std::move( shape ) );
449 else if( val.is_number() )
451 prevPt.
x = ( polyData.at( i ) );
452 prevPt.
y = ( polyData.at( ++i ) );
743 const wxString& aFpUuid,
744 const std::vector<nlohmann::json>& aLines )
746 std::unique_ptr<FOOTPRINT> footprintPtr = std::make_unique<FOOTPRINT>(
m_board );
747 FOOTPRINT* footprint = footprintPtr.get();
750 const int defaultTextThickness(
pcbIUScale.mmToIU( 0.15 ) );
754 field->SetTextSize( defaultTextSize );
755 field->SetTextThickness( defaultTextThickness );
758 for(
const nlohmann::json& line : aLines )
760 if( line.size() == 0 )
763 wxString type = line.at( 0 );
765 if( type == wxS(
"POLY" ) || type == wxS(
"PAD" ) || type == wxS(
"FILL" )
766 || type == wxS(
"ATTR" ) )
768 wxString uuid = line.at( 1 );
775 wxString netname = line.at( 3 );
776 int layer = line.at( 4 ).get<
int>();
779 if( type == wxS(
"POLY" ) )
781 double thickness = ( line.at( 5 ) );
782 nlohmann::json polyData = line.at( 6 );
784 std::vector<std::unique_ptr<PCB_SHAPE>> results =
785 ParsePoly( footprint, polyData,
false,
false );
787 for(
auto& shape : results )
789 shape->SetLayer( klayer );
790 shape->SetWidth(
ScaleSize( thickness ) );
795 else if( type == wxS(
"PAD" ) )
797 std::unique_ptr<PAD>
pad =
createPAD( footprint, line );
801 else if( type == wxS(
"FILL" ) )
803 int layer = line.at( 4 ).get<
int>();
806 double width = line.at( 5 );
808 nlohmann::json polyDataList = line.at( 7 );
810 if( !polyDataList.is_null() && !polyDataList.empty() )
812 if( !polyDataList.at( 0 ).is_array() )
813 polyDataList = nlohmann::json::array( { polyDataList } );
815 std::vector<SHAPE_LINE_CHAIN> contours;
816 for( nlohmann::json& polyData : polyDataList )
821 contours.push_back( contour );
831 std::unique_ptr<PCB_GROUP>
group;
834 group = std::make_unique<PCB_GROUP>( footprint );
840 std::unique_ptr<PCB_SHAPE> shape =
843 shape->SetFilled(
true );
844 shape->SetPolyShape( poly );
845 shape->SetLayer( klayer );
846 shape->SetWidth( 0 );
849 group->AddItem( shape.get() );
858 else if( type == wxS(
"ATTR" ) )
862 if( attr.
key == wxS(
"Designator" ) )
866 else if( type == wxS(
"REGION" ) )
868 wxString uuid = line.at( 1 );
875 int layer = line.at( 3 ).get<
int>();
878 double width = line.at( 4 );
879 std::set<int> flags = line.at( 5 );
880 nlohmann::json polyDataList = line.at( 6 );
882 for( nlohmann::json& polyData : polyDataList )
886 std::vector<std::unique_ptr<PCB_SHAPE>> results =
887 ParsePoly(
nullptr, polyData,
true,
false );
889 for(
auto& shape : results )
891 shape->SetFilled(
true );
898 std::unique_ptr<ZONE> zone = std::make_unique<ZONE>( footprint );
900 zone->SetIsRuleArea(
true );
901 zone->SetDoNotAllowFootprints( !!flags.count( 2 ) );
902 zone->SetDoNotAllowZoneFills( !!flags.count( 7 ) || !!flags.count( 6 )
903 || !!flags.count( 8 ) );
904 zone->SetDoNotAllowPads( !!flags.count( 7 ) );
905 zone->SetDoNotAllowTracks( !!flags.count( 7 ) || !!flags.count( 5 ) );
906 zone->SetDoNotAllowVias( !!flags.count( 7 ) );
908 zone->SetLayer( klayer );
909 zone->Outline()->Append( polySet );
916 if( aProject.is_object() && aProject.contains(
"devices" ) )
918 std::map<wxString, EASYEDAPRO::PRJ_DEVICE> devicesMap = aProject.at(
"devices" );
919 std::map<wxString, wxString> compAttrs;
921 for(
auto& [devUuid, devData] : devicesMap )
923 if(
auto fp =
get_opt( devData.attributes,
"Footprint" ) )
927 compAttrs = devData.attributes;
933 wxString modelUuid, modelTitle, modelTransform;
935 modelUuid =
get_def( compAttrs,
"3D Model",
"" );
936 modelTitle =
get_def( compAttrs,
"3D Model Title", modelUuid );
937 modelTransform =
get_def( compAttrs,
"3D Model Transform",
"" );
943 std::vector<PCB_SHAPE*> edgeShapes;
948 edgeShapes.push_back(
static_cast<PCB_SHAPE*
>( item ) );
959 std::unique_ptr<PCB_SHAPE> shape =
965 shape->SetEnd( bbox.
GetEnd() );
970 bool hasFabRef =
false;
976 if(
static_cast<PCB_TEXT*
>( item )->GetText() == wxT(
"${REFERENCE}" ) )
988 int c_refTextThickness =
pcbIUScale.mmToIU( 0.1 );
989 std::unique_ptr<PCB_TEXT> refText = std::make_unique<PCB_TEXT>( footprint );
991 refText->SetLayer(
F_Fab );
992 refText->SetTextSize(
VECTOR2I( c_refTextSize, c_refTextSize ) );
993 refText->SetTextThickness( c_refTextThickness );
994 refText->SetText( wxT(
"${REFERENCE}" ) );
999 return footprintPtr.release();
1004 BOARD* aBoard,
const nlohmann::json& aProject,
1005 std::map<wxString, std::unique_ptr<FOOTPRINT>>& aFootprintMap,
1006 const std::map<wxString, EASYEDAPRO::BLOB>& aBlobMap,
1007 const std::multimap<wxString, EASYEDAPRO::POURED>& aPouredMap,
1008 const std::vector<nlohmann::json>& aLines,
const wxString& aFpLibName )
1010 std::map<wxString, std::vector<nlohmann::json>> componentLines;
1011 std::map<wxString, std::vector<nlohmann::json>> ruleLines;
1013 std::multimap<wxString, EASYEDAPRO::POURED> boardPouredMap = aPouredMap;
1014 std::map<wxString, ZONE*> poursToFill;
1018 for(
const nlohmann::json& line : aLines )
1020 if( line.size() == 0 )
1023 wxString type = line.at( 0 );
1025 if( type == wxS(
"LAYER" ) )
1027 int layer = line.at( 1 );
1030 wxString layerType = line.at( 2 );
1031 wxString layerName = line.at( 3 );
1032 int layerFlag = line.at( 4 );
1034 if( layerFlag != 0 )
1037 blayers.
set( klayer );
1042 else if( type == wxS(
"NET" ) )
1044 wxString netname = line.at( 1 );
1049 else if( type == wxS(
"RULE" ) )
1051 wxString ruleType = line.at( 1 );
1052 wxString ruleName = line.at( 2 );
1053 int isDefault = line.at( 3 );
1054 nlohmann::json ruleData = line.at( 4 );
1056 if( ruleType == wxS(
"3" ) && isDefault )
1058 wxString units = ruleData.at( 0 );
1059 double minVal = ruleData.at( 1 );
1060 double optVal = ruleData.at( 2 );
1061 double maxVal = ruleData.at( 3 );
1065 else if( ruleType == wxS(
"1" ) && isDefault )
1067 wxString units = ruleData.at( 0 );
1068 nlohmann::json
table = ruleData.at( 1 );
1070 int minVal = INT_MAX;
1071 for(
const std::vector<int>& arr :
table )
1073 for(
int val : arr )
1083 ruleLines[ruleType].push_back( line );
1085 else if( type == wxS(
"POURED" ) )
1087 if( !line.at( 2 ).is_string() )
1091 boardPouredMap.emplace( poured.
parentId, poured );
1093 else if( type == wxS(
"VIA" ) || type == wxS(
"LINE" ) || type == wxS(
"ARC" )
1094 || type == wxS(
"POLY" ) || type == wxS(
"FILL" ) || type == wxS(
"POUR" ) )
1096 wxString uuid = line.at( 1 );
1103 wxString netname = line.at( 3 );
1105 if( type == wxS(
"VIA" ) )
1111 double drill = line.at( 7 );
1112 double dia = line.at( 8 );
1114 std::unique_ptr<PCB_VIA>
via = std::make_unique<PCB_VIA>( aBoard );
1124 else if( type == wxS(
"LINE" ) )
1126 int layer = line.at( 4 ).get<
int>();
1130 start.
x = line.at( 5 );
1131 start.
y = line.at( 6 );
1134 end.x = line.at( 7 );
1135 end.y = line.at( 8 );
1137 double width = line.at( 9 );
1139 std::unique_ptr<PCB_TRACK> track = std::make_unique<PCB_TRACK>( aBoard );
1141 track->SetLayer( klayer );
1142 track->SetStart(
ScalePos( start ) );
1146 track->SetNet( aBoard->
FindNet( netname ) );
1150 else if( type == wxS(
"ARC" ) )
1152 int layer = line.at( 4 ).get<
int>();
1156 start.
x = line.at( 5 );
1157 start.
y = line.at( 6 );
1160 end.x = line.at( 7 );
1161 end.y = line.at( 8 );
1163 double angle = line.at( 9 );
1164 double width = line.at( 10 );
1169 double ha = angle / 2;
1170 double hd =
delta.EuclideanNorm() / 2;
1171 double cdist = hd / tan(
DEG2RAD( ha ) );
1178 std::unique_ptr<PCB_ARC> arc = std::make_unique<PCB_ARC>( aBoard, &sarc );
1181 arc->SetLayer( klayer );
1182 arc->SetNet( aBoard->
FindNet( netname ) );
1186 else if( type == wxS(
"FILL" ) )
1188 int layer = line.at( 4 ).get<
int>();
1191 double width = line.at( 5 );
1193 nlohmann::json polyDataList = line.at( 7 );
1195 if( !polyDataList.at( 0 ).is_array() )
1196 polyDataList = nlohmann::json::array( { polyDataList } );
1198 std::vector<SHAPE_LINE_CHAIN> contours;
1199 for( nlohmann::json& polyData : polyDataList )
1204 contours.push_back( contour );
1215 std::unique_ptr<ZONE> zone = std::make_unique<ZONE>( aBoard );
1217 zone->SetNet( aBoard->
FindNet( netname ) );
1218 zone->SetLayer( klayer );
1220 zone->SetFilledPolysList( klayer, zoneFillPoly );
1221 zone->SetAssignedPriority( 500 );
1222 zone->SetIsFilled(
true );
1223 zone->SetNeedRefill(
false );
1230 else if( type == wxS(
"POLY" ) )
1232 int layer = line.at( 4 );
1235 double thickness = line.at( 5 );
1236 nlohmann::json polyData = line.at( 6 );
1238 std::vector<std::unique_ptr<PCB_SHAPE>> results =
1239 ParsePoly( aBoard, polyData,
false,
false );
1241 for(
auto& shape : results )
1243 shape->SetLayer( klayer );
1244 shape->SetWidth(
ScaleSize( thickness ) );
1249 else if( type == wxS(
"POUR" ) )
1251 int layer = line.at( 4 ).get<
int>();
1254 double lineWidth = line.at( 5 );
1255 wxString pourname = line.at( 6 );
1256 int fillOrder = line.at( 7 ).get<
int>();
1257 nlohmann::json polyDataList = line.at( 8 );
1259 std::unique_ptr<ZONE> zone = std::make_unique<ZONE>( aBoard );
1261 zone->SetNet( aBoard->
FindNet( netname ) );
1262 zone->SetLayer( klayer );
1263 zone->SetAssignedPriority( 500 - fillOrder );
1267 for( nlohmann::json& polyData : polyDataList )
1272 zone->Outline()->Append( contour );
1275 wxASSERT( zone->Outline()->OutlineCount() == 1 );
1277 poursToFill.emplace( uuid, zone.get() );
1282 else if( type == wxS(
"TEARDROP" ) )
1284 wxString uuid = line.at( 1 );
1285 wxString netname = line.at( 2 );
1286 int layer = line.at( 3 ).get<
int>();
1289 nlohmann::json polyData = line.at( 4 );
1294 std::unique_ptr<ZONE> zone = std::make_unique<ZONE>( aBoard );
1296 zone->SetNet( aBoard->
FindNet( netname ) );
1297 zone->SetLayer( klayer );
1298 zone->Outline()->Append( contour );
1299 zone->SetFilledPolysList( klayer, contour );
1300 zone->SetNeedRefill(
false );
1301 zone->SetIsFilled(
true );
1303 zone->SetAssignedPriority( 600 );
1304 zone->SetLocalClearance( 0 );
1305 zone->SetMinThickness( 0 );
1310 else if( type == wxS(
"REGION" ) )
1312 wxString uuid = line.at( 1 );
1319 int layer = line.at( 3 ).get<
int>();
1322 double width = line.at( 4 );
1323 std::set<int> flags = line.at( 5 );
1324 nlohmann::json polyDataList = line.at( 6 );
1326 for( nlohmann::json& polyData : polyDataList )
1331 std::unique_ptr<ZONE> zone = std::make_unique<ZONE>( aBoard );
1333 zone->SetIsRuleArea(
true );
1334 zone->SetDoNotAllowFootprints( !!flags.count( 2 ) );
1335 zone->SetDoNotAllowZoneFills( !!flags.count( 7 ) || !!flags.count( 6 )
1336 || !!flags.count( 8 ) );
1337 zone->SetDoNotAllowPads( !!flags.count( 7 ) );
1338 zone->SetDoNotAllowTracks( !!flags.count( 7 ) || !!flags.count( 5 ) );
1339 zone->SetDoNotAllowVias( !!flags.count( 7 ) );
1341 zone->SetLayer( klayer );
1342 zone->Outline()->Append( contour );
1347 else if( type == wxS(
"PAD" ) )
1349 wxString netname = line.at( 3 );
1351 std::unique_ptr<FOOTPRINT> footprint = std::make_unique<FOOTPRINT>( aBoard );
1352 std::unique_ptr<PAD>
pad =
createPAD( footprint.get(), line );
1363 footprint->SetPosition( pos );
1364 footprint->SetOrientation( orient );
1366 wxString fpName = wxS(
"Pad_" ) + line.at( 1 ).get<wxString>();
1369 footprint->SetFPID( fpID );
1370 footprint->Reference().SetVisible(
true );
1371 footprint->Value().SetVisible(
true );
1372 footprint->AutoPositionFields();
1376 else if( type == wxS(
"IMAGE" ) )
1378 wxString uuid = line.at( 1 );
1385 int layer = line.at( 3 ).get<
int>();
1388 VECTOR2D start( line.at( 4 ), line.at( 5 ) );
1389 VECTOR2D size( line.at( 6 ), line.at( 7 ) );
1391 double angle = line.at( 8 );
1392 int mirror = line.at( 9 );
1393 nlohmann::json polyDataList = line.at( 10 );
1396 std::vector<SHAPE_LINE_CHAIN> contours;
1397 for( nlohmann::json& polyData : polyDataList )
1402 contours.push_back( contour );
1414 for(
int i = 0; i < contour.PointCount(); i++ )
1425 std::unique_ptr<PCB_GROUP>
group;
1428 group = std::make_unique<PCB_GROUP>( aBoard );
1434 std::unique_ptr<PCB_SHAPE> shape =
1437 shape->SetFilled(
true );
1438 shape->SetPolyShape( poly );
1439 shape->SetLayer( klayer );
1440 shape->SetWidth( 0 );
1450 shape->Mirror(
ScalePos( start ), flipDirection );
1454 group->AddItem( shape.get() );
1462 else if( type == wxS(
"OBJ" ) )
1465 wxString mimeType, base64Data;
1469 if( !line.at( 3 ).is_number() )
1472 int layer = line.at( 3 ).get<
int>();
1475 start =
VECTOR2D( line.at( 5 ), line.at( 6 ) );
1476 size =
VECTOR2D( line.at( 7 ), line.at( 8 ) );
1477 angle = line.at( 9 );
1478 flipped = line.at( 10 );
1480 wxString imageUrl = line.at( 11 );
1482 if( imageUrl.BeforeFirst(
':' ) == wxS(
"blob" ) )
1484 wxString objectId = imageUrl.AfterLast(
':' );
1486 if(
auto blob =
get_opt( aBlobMap, objectId ) )
1488 wxString blobUrl = blob->url;
1490 if( blobUrl.BeforeFirst(
':' ) == wxS(
"data" ) )
1492 wxArrayString paramsArr =
1493 wxSplit( blobUrl.AfterFirst(
':' ).BeforeFirst(
',' ),
';',
'\0' );
1495 base64Data = blobUrl.AfterFirst(
',' );
1497 if( paramsArr.size() > 0 )
1498 mimeType = paramsArr[0];
1506 if( mimeType.empty() || base64Data.empty() )
1509 wxMemoryBuffer buf = wxBase64Decode( base64Data );
1511 if( mimeType == wxS(
"image/svg+xml" ) )
1517 VECTOR2D kcenter = kstart + ksize / 2;
1519 std::unique_ptr<PCB_REFERENCE_IMAGE> bitmap =
1520 std::make_unique<PCB_REFERENCE_IMAGE>( aBoard, kcenter, klayer );
1523 wxImage::SetDefaultLoadFlags( wxImage::GetDefaultLoadFlags()
1524 & ~wxImage::Load_Verbose );
1536 int x = bitmap->GetPosition().x;
1547 else if( type == wxS(
"STRING" ) )
1549 wxString uuid = line.at( 1 );
1556 int layer = line.at( 3 ).get<
int>();
1560 wxString
string = line.at( 6 );
1561 wxString font = line.at( 7 );
1563 double height = line.at( 8 );
1564 double strokew = line.at( 9 );
1566 int align = line.at( 12 );
1567 double angle = line.at( 13 );
1568 int inverted = line.at( 14 );
1569 int mirror = line.at( 16 );
1573 text->SetText(
string );
1574 text->SetLayer( klayer );
1576 text->SetIsKnockout( inverted );
1580 if( font != wxS(
"default" ) )
1593 text->SetMirrored(
true );
1594 text->SetTextAngleDegrees( -angle );
1598 text->SetTextAngleDegrees( angle );
1603 else if( type == wxS(
"COMPONENT" ) )
1605 wxString compId = line.at( 1 );
1606 componentLines[compId].push_back( line );
1608 else if( type == wxS(
"ATTR" ) )
1610 wxString compId = line.at( 3 );
1611 componentLines[compId].push_back( line );
1613 else if( type == wxS(
"PAD_NET" ) )
1615 wxString compId = line.at( 1 );
1616 componentLines[compId].push_back( line );
1620 for(
auto const& [compId, lines] : componentLines )
1623 wxString fpIdOverride;
1624 wxString fpDesignator;
1625 std::map<wxString, wxString> localCompAttribs;
1627 for(
auto& line : lines )
1629 if( line.size() == 0 )
1632 wxString type = line.at( 0 );
1634 if( type == wxS(
"COMPONENT" ) )
1636 localCompAttribs = line.at( 7 );
1638 else if( type == wxS(
"ATTR" ) )
1642 if( attr.
key == wxS(
"Device" ) )
1643 deviceId = attr.
value;
1645 else if( attr.
key == wxS(
"Footprint" ) )
1646 fpIdOverride = attr.
value;
1648 else if( attr.
key == wxS(
"Designator" ) )
1649 fpDesignator = attr.
value;
1653 if( deviceId.empty() )
1656 nlohmann::json compAttrs = aProject.at(
"devices" ).at( deviceId ).at(
"attributes" );
1660 if( !fpIdOverride.IsEmpty() )
1661 fpId = fpIdOverride;
1663 fpId = compAttrs.at(
"Footprint" ).get<wxString>();
1665 auto it = aFootprintMap.find( fpId );
1666 if( it == aFootprintMap.end() )
1668 wxLogError(
"Footprint of '%s' with uuid '%s' not found.", fpDesignator, fpId );
1672 std::unique_ptr<FOOTPRINT>& footprintOrig = it->second;
1673 std::unique_ptr<FOOTPRINT> footprint(
static_cast<FOOTPRINT*
>( footprintOrig->Clone() ) );
1675 wxString modelUuid, modelTitle, modelTransform;
1677 if(
auto val =
get_opt( localCompAttribs,
"3D Model" ) )
1680 modelUuid = compAttrs.value<wxString>(
"3D Model",
"" );
1682 if(
auto val =
get_opt( localCompAttribs,
"3D Model Title" ) )
1683 modelTitle = val->Trim();
1685 modelTitle = compAttrs.value<wxString>(
"3D Model Title", modelUuid ).Trim();
1687 if(
auto val =
get_opt( localCompAttribs,
"3D Model Transform" ) )
1688 modelTransform = *val;
1690 modelTransform = compAttrs.value<wxString>(
"3D Model Transform",
"" );
1694 footprint->SetParent( aBoard );
1696 for(
auto& line : lines )
1698 if( line.size() == 0 )
1701 wxString type = line.at( 0 );
1703 if( type == wxS(
"COMPONENT" ) )
1705 int layer = line.at( 3 );
1710 double orient = line.at( 6 );
1713 if( klayer ==
B_Cu )
1716 footprint->SetOrientationDegrees( orient );
1719 else if( type == wxS(
"ATTR" ) )
1727 if( attr.
key == wxS(
"Designator" ) )
1729 if( attr.
key == wxS(
"Designator" ) )
1739 if( attr.
fontName != wxS(
"default" ) )
1768 else if( type == wxS(
"PAD_NET" ) )
1770 wxString padNumber = line.at( 2 );
1771 wxString padNet = line.at( 3 );
1773 PAD*
pad = footprint->FindPadByNumber( padNumber );
1791 for(
auto& [uuid, zone] : poursToFill )
1796 auto range = boardPouredMap.equal_range( uuid );
1797 for(
auto& it = range.first; it != range.second; ++it )
1800 int unki = poured.
unki;
1804 for(
int dataId = 0; dataId < poured.
polyData.size(); dataId++ )
1806 const nlohmann::json& fillData = poured.
polyData[dataId];
1807 const double ptScale = 10;
1812 for(
int i = 0; i < contour.
PointCount(); i++ )
1825 thisPoly.
Append( simple );
1834 const int thermalWidth =
pcbIUScale.mmToIU( 0.2 );
1836 for(
int segId = 0; segId < contour.
SegmentCount(); segId++ )
1846 fillPolySet.
Append( thisPoly );
1853 const int strokeWidth =
pcbIUScale.MilsToIU( 8 );
1862 zone->SetFilledPolysList( zone->GetFirstLayer(), fillPolySet );
1863 zone->SetNeedRefill(
false );
1864 zone->SetIsFilled(
true );
1870 std::vector<PCB_SHAPE*> shapes;
1878 shapes.push_back(
static_cast<PCB_SHAPE*
>( item ) );
1893 offset.
x =
KiROUND( offset.
x / alignGrid ) * alignGrid;
1894 offset.
y =
KiROUND( offset.
y / alignGrid ) * alignGrid;
1896 aBoard->
Move( offset );