77 m_LegacyDesignSettingsLoaded( false ),
78 m_LegacyCopperEdgeClearanceLoaded( false ),
79 m_LegacyNetclassesLoaded( false ),
118 int infinity = ( std::numeric_limits<int>::max() / 2 ) -
pcbIUScale.
mmToIU( 1 );
131 _(
"This is the default net class." ) );
150 item->SetParentGroup(
nullptr );
155 for(
BOARD_ITEM* item : generator->GetItems() )
156 item->SetParentGroup(
nullptr );
176 ownedItems.insert( g );
204 if( aProject && !aReferenceOnly )
221 std::shared_ptr<NET_SETTINGS>& projectSettings =
project.NetSettings();
223 projectSettings->SetDefaultNetclass( legacySettings->GetDefaultNetclass() );
224 projectSettings->SetNetclasses( legacySettings->GetNetclasses() );
225 projectSettings->SetNetclassPatternAssignments(
226 std::move( legacySettings->GetNetclassPatternAssignments() ) );
246 project.m_BoardSettings =
nullptr;
269 std::unique_lock<std::shared_mutex> writeLock(
m_CachesMutex );
298 std::set<std::pair<KIID, KIID>> m_ratsnestExclusions;
304 const std::shared_ptr<RC_ITEM>& rcItem = marker->GetRCItem();
305 m_ratsnestExclusions.emplace( rcItem->GetMainItemID(), rcItem->GetAuxItemID() );
306 m_ratsnestExclusions.emplace( rcItem->GetAuxItemID(), rcItem->GetMainItemID() );
316 std::pair<KIID, KIID> ids = { aEdge.GetSourceNode()->Parent()->m_Uuid,
317 aEdge.GetTargetNode()->Parent()->m_Uuid };
319 aEdge.
SetVisible( m_ratsnestExclusions.count( ids ) == 0 );
334 if( marker->IsExcluded() )
336 wxString serialized = marker->SerializeToString();
338 m_designSettings->m_DrcExclusionComments[ serialized ] = marker->GetComment();
347 std::map<wxString, wxString> comments =
m_designSettings->m_DrcExclusionComments;
354 wxString serialized = marker->SerializeToString();
355 std::set<wxString>::iterator it = exclusions.find( serialized );
357 if( it != exclusions.end() )
359 marker->SetExcluded(
true, comments[ serialized ] );
363 m_designSettings->m_DrcExclusionComments[ serialized ] = comments[ serialized ];
365 exclusions.erase( it );
369 std::vector<PCB_MARKER*> newMarkers;
373 for(
const wxString& serialized : exclusions )
393 marker->
SetExcluded(
true, comments[ serialized ] );
394 newMarkers.push_back( marker );
398 m_designSettings->m_DrcExclusionComments[ serialized ] = comments[ serialized ];
410 [&](
const wxString& aVar )
413 aVars->push_back( aVar );
416 add( wxT(
"LAYER" ) );
417 add( wxT(
"FILENAME" ) );
418 add( wxT(
"FILEPATH" ) );
419 add( wxT(
"PROJECTNAME" ) );
420 add( wxT(
"DRC_ERROR <message_text>" ) );
421 add( wxT(
"DRC_WARNING <message_text>" ) );
435 if( token->Contains(
':' ) )
438 wxString ref = token->BeforeFirst(
':', &remainder );
453 if( token->IsSameAs( wxT(
"FILENAME" ) ) )
456 *token = fn.GetFullName();
459 else if( token->IsSameAs( wxT(
"FILEPATH" ) ) )
462 *token = fn.GetFullPath();
465 else if( token->IsSameAs( wxT(
"PROJECTNAME" ) ) &&
GetProject() )
471 wxString var = *token;
498 wxLogWarning( wxT(
"This should not be called on the BOARD object") );
505 [&] (
EDA_ITEM* item,
void* testData )
514 board_item->
Move( aMoveVector );
517 return INSPECT_RESULT::CONTINUE;
535 return INSPECT_RESULT::CONTINUE;
564 if (
m_layers[ layer ].m_name == aLayerName ||
m_layers[ layer ].m_userName == aLayerName )
587 if( !
m_layers[aLayer].m_userName.IsEmpty() )
597 if( !aLayerName.IsEmpty() )
600 if( aLayerName.Find( wxChar(
'"' ) ) != wxNOT_FOUND )
651 case LT_AUX:
return "auxiliary";
660 if( strcmp( aType,
"signal" ) == 0 )
return LT_SIGNAL;
661 else if( strcmp( aType,
"power" ) == 0 )
return LT_POWER;
662 else if( strcmp( aType,
"mixed" ) == 0 )
return LT_MIXED;
663 else if( strcmp( aType,
"jumper" ) == 0 )
return LT_JUMPER;
664 else if( strcmp( aType,
"auxiliary" ) == 0 )
return LT_AUX;
665 else if( strcmp( aType,
"front" ) == 0 )
return LT_FRONT;
666 else if( strcmp( aType,
"back" ) == 0 )
return LT_BACK;
673 for(
int layer =
F_Cu; layer <
User_9; ++layer )
679 if(
m_layers[layer].m_opposite != layer )
700 if( !candidate.IsEmpty() && candidate == principalName )
712 int next = layer + 1;
765 if( aStartLayer > aEndLayer )
766 std::swap( aStartLayer, aEndLayer );
768 if( aEndLayer ==
B_Cu )
771 return aEndLayer - aStartLayer;
819 for(
size_t i = 0; i < aSet.size(); i++ )
860 track->SetLocalRatsnestVisible( isEnabled );
864 for(
PAD*
pad : footprint->Pads() )
865 pad->SetLocalRatsnestVisible( isEnabled );
869 zone->SetLocalRatsnestVisible( isEnabled );
886 default: wxFAIL_MSG( wxT(
"BOARD::IsModuleLayerVisible(): bad layer" ) );
return true;
902 std::unique_lock<std::shared_mutex> writeLock(
m_CachesMutex );
907 worstClearance = std::max( worstClearance, zone->GetLocalClearance().value() );
911 for(
PAD*
pad : footprint->Pads() )
913 std::optional<int>
override =
pad->GetClearanceOverrides(
nullptr );
915 if(
override.has_value() )
916 worstClearance = std::max( worstClearance,
override.value() );
919 for(
ZONE* zone : footprint->Zones() )
920 worstClearance = std::max( worstClearance, zone->GetLocalClearance().value() );
932 std::vector<ZONE*> zones = aZones;
941 aReporter->
Report(
_(
"Tessellating copper zones..." ) );
944 std::vector<std::future<size_t>> returns;
946 returns.reserve( zones.size() );
948 auto cache_zones = [aReporter](
ZONE* aZone ) ->
size_t
953 aZone->CacheTriangulation();
961 for(
ZONE* zone : zones )
962 returns.emplace_back(
tp.submit( cache_zones, zone ) );
965 for(
const std::future<size_t>& ret : returns )
967 std::future_status status = ret.wait_for( std::chrono::milliseconds( 250 ) );
969 while( status != std::future_status::ready )
974 status = ret.wait_for( std::chrono::milliseconds( 250 ) );
984 for(
auto& [filename, embeddedFile] : footprint->EmbeddedFileMap() )
992 embeddedFile->data_hash = file->
data_hash;
993 embeddedFile->is_valid = file->
is_valid;
1002 if( aBoardItem ==
nullptr )
1004 wxFAIL_MSG( wxT(
"BOARD::Add() param error: aBoardItem nullptr" ) );
1010 switch( aBoardItem->
Type() )
1043 wxFAIL_MSG( wxT(
"BOARD::Add() Cannot place Track on non-copper layer" ) );
1047 if( aMode == ADD_MODE::APPEND || aMode == ADD_MODE::BULK_APPEND )
1058 if( aMode == ADD_MODE::APPEND || aMode == ADD_MODE::BULK_APPEND )
1083 if( aMode == ADD_MODE::APPEND || aMode == ADD_MODE::BULK_APPEND )
1105 msg.Printf( wxT(
"BOARD::Add() needs work: BOARD_ITEM type (%d) not handled" ),
1106 aBoardItem->
Type() );
1116 if( !aSkipConnectivity )
1119 if( aMode != ADD_MODE::BULK_INSERT && aMode != ADD_MODE::BULK_APPEND )
1141 wxASSERT( aBoardItem );
1145 switch( aBoardItem->
Type() )
1154 if( boardItem->GetNet() == netItem )
1155 boardItem->SetNet( unconnected );
1227 wxFAIL_MSG( wxT(
"BOARD::Remove() needs more ::Type() support" ) );
1239 if( aRemoveMode != REMOVE_MODE::BULK )
1246 std::vector<BOARD_ITEM*> removed;
1248 for(
const KICAD_T& type : aTypes )
1254 removed.emplace_back( item );
1265 std::copy(
m_groups.begin(),
m_groups.end(), std::back_inserter( removed ) );
1270 std::copy(
m_zones.begin(),
m_zones.end(), std::back_inserter( removed ) );
1285 std::copy(
m_tracks.begin(),
m_tracks.end(), std::back_inserter( removed ) );
1291 wxFAIL_MSG( wxT(
"Use PCB_TRACE_T to remove all tracks, arcs, and vias" ) );
1310 wxFAIL_MSG( wxT(
"Use PCB_SHAPE_T to remove all graphics and text" ) );
1314 wxFAIL_MSG( wxT(
"BOARD::RemoveAll() needs more ::Type() support" ) );
1327 return wxString::Format(
_(
"PCB" ) );
1334 [&](
EDA_ITEM* descendant,
void* aTestData )
1338 if( dimension->
GetUnitsMode() == DIM_UNITS_MODE::AUTOMATIC )
1343 aView->
Update( dimension );
1346 return INSPECT_RESULT::CONTINUE;
1387 remaining.push_back( marker );
1418 if( track->m_Uuid == aID )
1424 if( footprint->m_Uuid == aID )
1427 for(
PAD*
pad : footprint->Pads() )
1429 if(
pad->m_Uuid == aID )
1433 for(
PCB_FIELD* field : footprint->Fields() )
1435 if( field->m_Uuid == aID )
1439 for(
BOARD_ITEM* drawing : footprint->GraphicalItems() )
1441 if( drawing->m_Uuid == aID )
1447 if( zone->m_Uuid == aID )
1453 if(
group->m_Uuid == aID )
1460 if( zone->m_Uuid == aID )
1470 if( cell->m_Uuid == aID )
1475 if( drawing->m_Uuid == aID )
1481 if( marker->m_Uuid == aID )
1487 if(
group->m_Uuid == aID )
1493 if( generator->m_Uuid == aID )
1500 if( netInfo->m_Uuid == aID )
1505 return const_cast<BOARD*
>( this );
1518 aMap[ track->m_Uuid ] = track;
1522 aMap[ footprint->m_Uuid ] = footprint;
1524 for(
PAD*
pad : footprint->Pads() )
1525 aMap[
pad->m_Uuid ] =
pad;
1527 aMap[ footprint->Reference().m_Uuid ] = &footprint->Reference();
1528 aMap[ footprint->Value().m_Uuid ] = &footprint->Value();
1530 for(
BOARD_ITEM* drawing : footprint->GraphicalItems() )
1531 aMap[ drawing->m_Uuid ] = drawing;
1535 aMap[ zone->m_Uuid ] = zone;
1538 aMap[ drawing->m_Uuid ] = drawing;
1541 aMap[ marker->m_Uuid ] = marker;
1547 aMap[ generator->m_Uuid ] = generator;
1554 size_t sourceLen = aSource.length();
1556 for(
size_t i = 0; i < sourceLen; ++i )
1558 if( aSource[i] ==
'$' && i + 1 < sourceLen && aSource[i+1] ==
'{' )
1561 bool isCrossRef =
false;
1563 for( i = i + 2; i < sourceLen; ++i )
1565 if( aSource[i] ==
'}' )
1568 if( aSource[i] ==
':' )
1571 token.append( aSource[i] );
1577 wxString ref = token.BeforeFirst(
':', &remainder );
1581 if( footprint->GetReference().CmpNoCase( ref ) == 0 )
1583 wxString
test( remainder );
1585 if( footprint->ResolveTextVar( &
test ) )
1586 token = footprint->m_Uuid.AsString() + wxT(
":" ) + remainder;
1593 newbuf.append( wxT(
"${" ) + token + wxT(
"}" ) );
1597 newbuf.append( aSource[i] );
1608 size_t sourceLen = aSource.length();
1610 for(
size_t i = 0; i < sourceLen; ++i )
1612 if( aSource[i] ==
'$' && i + 1 < sourceLen && aSource[i+1] ==
'{' )
1615 bool isCrossRef =
false;
1617 for( i = i + 2; i < sourceLen; ++i )
1619 if( aSource[i] ==
'}' )
1622 if( aSource[i] ==
':' )
1625 token.append( aSource[i] );
1631 wxString ref = token.BeforeFirst(
':', &remainder );
1636 token =
static_cast<FOOTPRINT*
>( refItem )->GetReference() + wxT(
":" )
1641 newbuf.append( wxT(
"${" ) + token + wxT(
"}" ) );
1645 newbuf.append( aSource[i] );
1655 unsigned retval = 0;
1659 for(
PAD*
pad : footprint->Pads() )
1661 if( ( aNet == -1 &&
pad->GetNetCode() > 0 ) || aNet ==
pad->GetNetCode() )
1680 if( aBoardEdgesOnly )
1689 if( ( item->GetLayerSet() & visible ).any() )
1690 bbox.
Merge( item->GetBoundingBox() );
1696 if( aBoardEdgesOnly )
1698 for(
const BOARD_ITEM* edge : footprint->GraphicalItems() )
1701 bbox.
Merge( edge->GetBoundingBox() );
1704 else if( ( footprint->GetLayerSet() & visible ).any() )
1706 bbox.
Merge( footprint->GetBoundingBox(
true ) );
1710 if( !aBoardEdgesOnly )
1715 if( ( track->GetLayerSet() & visible ).any() )
1716 bbox.
Merge( track->GetBoundingBox() );
1722 if( ( aZone->GetLayerSet() & visible ).any() )
1723 bbox.
Merge( aZone->GetBoundingBox() );
1735 int trackSegmentCount = 0;
1736 std::set<int> netCodes;
1744 trackSegmentCount++;
1746 if( item->GetNetCode() > 0 )
1747 netCodes.insert( item->GetNetCode() );
1752 for(
PAD*
pad : footprint->Pads() )
1756 if(
pad->GetNetCode() > 0 )
1757 netCodes.insert(
pad->GetNetCode() );
1761 aList.emplace_back(
_(
"Pads" ), wxString::Format( wxT(
"%d" ), padCount ) );
1762 aList.emplace_back(
_(
"Vias" ), wxString::Format( wxT(
"%d" ), viaCount ) );
1763 aList.emplace_back(
_(
"Track Segments" ), wxString::Format( wxT(
"%d" ), trackSegmentCount ) );
1764 aList.emplace_back(
_(
"Nets" ), wxString::Format( wxT(
"%d" ), (
int) netCodes.size() ) );
1765 aList.emplace_back(
_(
"Unrouted" ), wxString::Format( wxT(
"%d" ), unconnected ) );
1770 const std::vector<KICAD_T>& scanTypes )
1772#if 0 && defined(DEBUG)
1773 std::cout <<
GetClass().mb_str() <<
' ';
1776 bool footprintsScanned =
false;
1777 bool drawingsScanned =
false;
1778 bool tracksScanned =
false;
1780 for(
KICAD_T scanType : scanTypes )
1785 if( inspector(
this, testData ) == INSPECT_RESULT::QUIT )
1786 return INSPECT_RESULT::QUIT;
1811 if( !footprintsScanned )
1813 if( IterateForward<FOOTPRINT*>(
m_footprints, inspector, testData, scanTypes )
1814 == INSPECT_RESULT::QUIT )
1816 return INSPECT_RESULT::QUIT;
1819 footprintsScanned =
true;
1822 if( !drawingsScanned )
1824 if( IterateForward<BOARD_ITEM*>(
m_drawings, inspector, testData, scanTypes )
1825 == INSPECT_RESULT::QUIT )
1827 return INSPECT_RESULT::QUIT;
1830 drawingsScanned =
true;
1838 if( !tracksScanned )
1840 if( IterateForward<PCB_TRACK*>(
m_tracks, inspector, testData, scanTypes )
1841 == INSPECT_RESULT::QUIT )
1843 return INSPECT_RESULT::QUIT;
1846 tracksScanned =
true;
1854 if( marker->Visit( inspector, testData, { scanType } ) == INSPECT_RESULT::QUIT )
1855 return INSPECT_RESULT::QUIT;
1861 if( !footprintsScanned )
1863 if( IterateForward<FOOTPRINT*>(
m_footprints, inspector, testData, scanTypes )
1864 == INSPECT_RESULT::QUIT )
1866 return INSPECT_RESULT::QUIT;
1869 footprintsScanned =
true;
1874 if( zone->Visit( inspector, testData, { scanType } ) == INSPECT_RESULT::QUIT )
1875 return INSPECT_RESULT::QUIT;
1881 if( !footprintsScanned )
1883 if( IterateForward<FOOTPRINT*>(
m_footprints, inspector, testData, scanTypes )
1884 == INSPECT_RESULT::QUIT )
1886 return INSPECT_RESULT::QUIT;
1889 footprintsScanned =
true;
1892 if( IterateForward<PCB_GENERATOR*>(
m_generators, inspector, testData, { scanType } )
1893 == INSPECT_RESULT::QUIT )
1895 return INSPECT_RESULT::QUIT;
1901 if( IterateForward<PCB_GROUP*>(
m_groups, inspector, testData, { scanType } )
1902 == INSPECT_RESULT::QUIT )
1904 return INSPECT_RESULT::QUIT;
1914 return INSPECT_RESULT::CONTINUE;
1944 for(
auto it = aNetName.rbegin(); it != aNetName.rend() && rv == 0; ++it, ++count )
1948 if( ( ch >=
'0' && ch <=
'9' ) || ch ==
'_' )
1952 else if( ch ==
'+' )
1954 aComplementNet = wxT(
"-" );
1957 else if( ch ==
'-' )
1959 aComplementNet = wxT(
"+" );
1962 else if( ch ==
'N' )
1964 aComplementNet = wxT(
"P" );
1967 else if ( ch ==
'P' )
1969 aComplementNet = wxT(
"N" );
1978 if( rv != 0 && count >= 1 )
1980 aComplementNet = aNetName.Left( aNetName.length() - count )
1982 + aNetName.Right( count - 1 );
1994 wxString coupledNetName;
1997 return FindNet( coupledNetName );
2008 if( aReference == footprint->GetReference() )
2020 if( footprint->GetPath() == aPath )
2030 std::set<wxString> names;
2034 if( !net->GetNetname().IsEmpty() )
2035 names.insert( net->GetNetname() );
2057 const std::shared_ptr<NETCLASS>& defaultNetClass = bds.
m_NetSettings->GetDefaultNetclass();
2062 net->SetNetClass( bds.
m_NetSettings->GetEffectiveNetClass( net->GetNetname() ) );
2064 if( aResetTrackAndViaSizes )
2083 int error_count = 0;
2087 if( !zone->IsOnCopperLayer() )
2093 if( zone->GetNetCode() != 0 )
2106 zone->SetNetCode( -1 );
2117 if( !aLayerSet.any() )
2124 if( footprint->HitTest( aPosition ) )
2125 pad = footprint->GetPad( aPosition, aLayerSet );
2141 return GetPad( aPosition, lset );
2149 for(
PAD*
pad : footprint->Pads() )
2151 if(
pad->GetPosition() != aPosition )
2155 if( (
pad->GetLayerSet() & aLayerSet ).any() )
2168 int idxmax = aPadList.size() - 1;
2170 int delta = aPadList.size();
2183 PAD*
pad = aPadList[idx];
2185 if(
pad->GetPosition() == aPosition )
2188 if( ( aLayerSet &
pad->GetLayerSet() ).any() )
2195 for(
int ii = idx+1; ii <= idxmax; ii++ )
2199 if(
pad->GetPosition() != aPosition )
2202 if( ( aLayerSet &
pad->GetLayerSet() ).any() )
2206 for(
int ii = idx - 1 ;ii >=0; ii-- )
2210 if(
pad->GetPosition() != aPosition )
2213 if( ( aLayerSet &
pad->GetLayerSet() ).any() )
2221 if(
pad->GetPosition().x == aPosition.
x )
2223 if(
pad->GetPosition().y < aPosition.
y )
2238 else if(
pad->GetPosition().x < aPosition.
x )
2276 for(
PAD*
pad : footprint->Pads( ) )
2278 if( aNetCode < 0 || pad->GetNetCode() == aNetCode )
2279 aVector.push_back(
pad );
2301 double length = 0.0;
2302 double package_length = 0.0;
2319 if( track->Type() ==
PCB_VIA_T && useHeight )
2329 length += track->GetLength();
2334 SEG trackSeg( track->GetStart(), track->GetEnd() );
2335 double segLen = trackSeg.
Length();
2336 double segInPadLen = 0;
2338 for(
auto pad_it : connectivity->GetConnectedPads( item ) )
2342 bool hitStart =
pad->HitTest( track->GetStart(), track->GetWidth() / 2 );
2343 bool hitEnd =
pad->HitTest( track->GetEnd(), track->GetWidth() / 2 );
2345 if( hitStart && hitEnd )
2350 else if( hitStart || hitEnd )
2355 if(
pad->GetEffectivePolygon( track->GetLayer(),
ERROR_INSIDE )->Collide( trackSeg, 0,
nullptr, &loc ) )
2363 segLen = trackSeg.
Length();
2366 segInPadLen += ( loc -
pad->GetPosition() ).EuclideanNorm();
2372 length += segLen + segInPadLen;
2374 else if(
PAD*
pad =
dynamic_cast<PAD*
>( item ) )
2376 package_length +=
pad->GetPadToDieLength();
2380 return std::make_tuple( count, length, package_length );
2385 bool aVisibleOnly,
bool aIgnoreLocked )
const
2389 int min_dim = 0x7FFFFFFF;
2390 int alt_min_dim = 0x7FFFFFFF;
2391 bool current_layer_back =
IsBackLayer( aActiveLayer );
2396 if( !candidate->HitTest( aPosition ) )
2400 if( aIgnoreLocked && candidate->IsLocked() )
2408 BOX2I bb = candidate->GetBoundingBox(
false );
2414 int dist = ( aPosition.
x - offx ) * ( aPosition.
x - offx ) +
2415 ( aPosition.
y - offy ) * ( aPosition.
y - offy );
2419 if( dist <= min_dim )
2422 footprint = candidate;
2428 if( dist <= alt_min_dim )
2431 alt_footprint = candidate;
2442 return alt_footprint;
2450 std::list<ZONE*> zones;
2453 zones.push_back( zone );
2455 if( aIncludeZonesInFootprints )
2459 for(
ZONE* zone : footprint->Zones() )
2460 zones.push_back( zone );
2476 m_zones.push_back( new_area );
2485 ITEM_PICKER picker(
nullptr, new_area, UNDO_REDO::NEWITEM );
2495 bool aAllowUseArcsInPolygons,
2496 bool aIncludeNPTHAsOutlines )
2502 chainingEpsilon, aErrorHandler,
2503 aAllowUseArcsInPolygons );
2506 if( aIncludeNPTHAsOutlines )
2510 for(
PAD*
pad : fp->Pads() )
2512 if(
pad->GetAttribute () != PAD_ATTRIB::NPTH )
2530 aOutlines.
AddHole( pad_hole, jj );
2566 std::set<KIFONT::OUTLINE_FONT*>
fonts;
2580 if( outline->GetEmbeddingPermission() == EMBEDDING_PERMISSION::EDITABLE
2581 || outline->GetEmbeddingPermission() == EMBEDDING_PERMISSION::INSTALLABLE )
2583 fonts.insert( outline );
2598 std::vector<PAD*> allPads;
2602 for(
PAD*
pad : footprint->Pads() )
2603 allPads.push_back(
pad );
2612 std::vector<BOARD_CONNECTED_ITEM*> items;
2615 items.push_back( track );
2619 for(
PAD*
pad : footprint->Pads() )
2620 items.push_back(
pad );
2624 items.push_back( zone );
2629 items.push_back( bci );
2643 item->SetNet( netInfo );
2647 aDestBoard->
Add( newNet );
2648 item->SetNet( newNet );
2659 if(
FindNet( item->GetNetCode() ) ==
nullptr )
2703 std::vector<BOARD_ITEM*>& aRemovedItems,
2704 std::vector<BOARD_ITEM*>& aChangedItems )
2756 return wxEmptyString;
2775 std::unordered_set<PCB_GROUP*> knownCycleFreeGroups;
2777 std::unordered_set<PCB_GROUP*> currentChainGroups;
2779 std::unordered_set<PCB_GROUP*> toCheckGroups;
2783 toCheckGroups.insert(
group );
2786 toCheckGroups.insert( gen );
2788 while( !toCheckGroups.empty() )
2790 currentChainGroups.clear();
2795 if( currentChainGroups.find(
group ) != currentChainGroups.end() )
2800 return "Cycle detected in group membership";
2802 else if( knownCycleFreeGroups.find(
group ) != knownCycleFreeGroups.end() )
2808 currentChainGroups.insert(
group );
2810 toCheckGroups.erase(
group );
2823 knownCycleFreeGroups.insert( currentChainGroups.begin(), currentChainGroups.end() );
2833 bool hasGroup =
false;
2834 bool hasMember =
false;
2838 if( item->IsBOARD_ITEM() )
2884 if( aFirst->
Type() != aSecond->
Type() )
2885 return aFirst->
Type() < aSecond->
Type();
2894 return shape->
Compare( other );
2900 return text->Compare( other );
2907 return textbox->PCB_SHAPE::Compare( other ) && textbox->EDA_TEXT::Compare( other );
2929 if( !track->IsOnLayer( aLayer ) )
2932 track->TransformShapeToPolygon( aOutlines, aLayer, 0, maxError,
ERROR_INSIDE );
2938 footprint->TransformPadsToPolySet( aOutlines, aLayer, 0, maxError,
ERROR_INSIDE );
2940 footprint->TransformFPShapesToPolySet( aOutlines, aLayer, 0, maxError,
ERROR_INSIDE,
2945 for(
const ZONE* zone : footprint->Zones() )
2947 if( zone->GetLayerSet().test( aLayer ) )
2948 zone->TransformSolidAreasShapesToPolygon( aLayer, aOutlines );
2955 if( zone->GetLayerSet().test( aLayer ) )
2956 zone->TransformSolidAreasShapesToPolygon( aLayer, aOutlines );
2962 if( !item->IsOnLayer( aLayer ) )
2965 switch( item->Type() )
2987 textbox->PCB_SHAPE::TransformShapeToPolygon( aOutlines, aLayer, 0, maxError,
3026 std::copy(
m_tracks.begin(),
m_tracks.end(), std::inserter( items, items.end() ) );
3027 std::copy(
m_zones.begin(),
m_zones.end(), std::inserter( items, items.end() ) );
3030 std::copy(
m_markers.begin(),
m_markers.end(), std::inserter( items, items.end() ) );
3031 std::copy(
m_groups.begin(),
m_groups.end(), std::inserter( items, items.end() ) );
3042 const BOARD& other =
static_cast<const BOARD&
>( aItem );
3053 for(
auto it1 = thisNetNames.begin(), it2 = otherNetNames.begin();
3054 it1 != thisNetNames.end() && it2 != otherNetNames.end(); ++it1, ++it2 )
3058 if( it1->first != it2->first )
3093 wxArrayString ourVars;
3096 wxArrayString otherVars;
3099 if( ourVars != otherVars )
@ NORMAL
Use all material properties from model file.
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
constexpr EDA_IU_SCALE pcbIUScale
bool sortPadsByXthenYCoord(PAD *const &aLH, PAD *const &aRH)
Used by #GetSortedPadListByXCoord to sort a pad list by X coordinate value.
#define DEFAULT_CHAINING_EPSILON_MM
BOARD_USE
Flags to specify how the board is being used.
LAYER_T
The allowed types of layers, same as Specctra DSN spec.
std::set< BOARD_ITEM *, CompareByUuid > BOARD_ITEM_SET
Set of BOARD_ITEMs ordered by UUID.
BASE_SET & reset(size_t pos)
BASE_SET & set(size_t pos)
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
Container for design settings for a BOARD object.
void UseCustomTrackViaSize(bool aEnabled)
Enables/disables custom track/via size settings.
void SetCustomDiffPairWidth(int aWidth)
Sets custom track width for differential pairs (i.e.
std::shared_ptr< NET_SETTINGS > m_NetSettings
void SetCustomTrackWidth(int aWidth)
Sets custom width for track (i.e.
void SetEnabledLayers(LSET aMask)
Change the bit-mask of enabled layers to aMask.
LSET GetEnabledLayers() const
Return a bit-mask of all the layers that are enabled.
void SetCustomViaSize(int aSize)
Set custom size for via diameter (i.e.
void SetCustomDiffPairGap(int aGap)
Sets custom gap for differential pairs (i.e.
bool IsLayerEnabled(PCB_LAYER_ID aLayerId) const
Test whether a given layer aLayerId is enabled.
BOARD_STACKUP & GetStackupDescriptor()
void SetCustomViaDrill(int aDrill)
Sets custom size for via drill (i.e.
int GetCopperLayerCount() const
bool m_UseHeightForLengthCalcs
Enable inclusion of stackup height in track length measurements and length tuning.
void SetCopperLayerCount(int aNewLayerCount)
Set the copper layer count to aNewLayerCount.
void SetCustomDiffPairViaGap(int aGap)
Sets custom via gap for differential pairs (i.e.
Abstract interface for BOARD_ITEMs capable of storing other items inside.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
PCB_GROUP * GetParentGroup() const
virtual void Move(const VECTOR2I &aMoveVector)
Move this object.
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
FOOTPRINT * GetParentFootprint() const
static VECTOR2I ZeroOffset
A value of wxPoint(0,0) which can be passed to the Draw() functions.
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
virtual void OnBoardNetSettingsChanged(BOARD &aBoard)
virtual void OnBoardItemsAdded(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItem)
virtual void OnBoardRatsnestChanged(BOARD &aBoard)
virtual void OnBoardCompositeUpdate(BOARD &aBoard, std::vector< BOARD_ITEM * > &aAddedItems, std::vector< BOARD_ITEM * > &aRemovedItems, std::vector< BOARD_ITEM * > &aDeletedItems)
virtual void OnBoardItemsChanged(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItem)
virtual void OnBoardItemChanged(BOARD &aBoard, BOARD_ITEM *aBoardItem)
virtual void OnBoardItemRemoved(BOARD &aBoard, BOARD_ITEM *aBoardItem)
virtual void OnBoardItemAdded(BOARD &aBoard, BOARD_ITEM *aBoardItem)
virtual void OnBoardHighlightNetChanged(BOARD &aBoard)
virtual void OnBoardItemsRemoved(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItem)
Manage layers needed to make a physical board.
void BuildDefaultStackupList(const BOARD_DESIGN_SETTINGS *aSettings, int aActiveCopperLayersCount=0)
Create a default stackup, according to the current BOARD_DESIGN_SETTINGS settings.
int GetLayerDistance(PCB_LAYER_ID aFirstLayer, PCB_LAYER_ID aSecondLayer) const
Calculate the distance (height) between the two given copper layers.
Information pertinent to a Pcbnew printed circuit board.
INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &scanTypes) override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
ZONE * m_SolderMaskBridges
void GetContextualTextVars(wxArrayString *aVars) const
bool IsFootprintLayerVisible(PCB_LAYER_ID aLayer) const
Expect either of the two layers on which a footprint can reside, and returns whether that layer is vi...
BOARD_STACKUP GetStackupOrDefault() const
std::unordered_map< PTR_PTR_LAYER_CACHE_KEY, bool > m_EnclosedByAreaCache
std::map< ZONE *, std::map< PCB_LAYER_ID, ISOLATED_ISLANDS > > m_ZoneIsolatedIslandsMap
PCB_LAYER_ID GetCopperLayerStackMaxId() const
bool GetBoardPolygonOutlines(SHAPE_POLY_SET &aOutlines, OUTLINE_ERROR_HANDLER *aErrorHandler=nullptr, bool aAllowUseArcsInPolygons=false, bool aIncludeNPTHAsOutlines=false)
Extract the board outlines and build a closed polygon from lines, arcs and circle items on edge cut l...
void OnItemChanged(BOARD_ITEM *aItem)
Notify the board and its listeners that an item on the board has been modified in some way.
bool m_LegacyDesignSettingsLoaded
True if the legacy board design settings were loaded from a file.
bool IsFootprintHolder() const
Find out if the board is being used to hold a single footprint for editing/viewing.
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
void SetPosition(const VECTOR2I &aPos) override
std::map< wxString, wxString > m_properties
EMBEDDED_FILES * GetEmbeddedFiles() override
int m_fileFormatVersionAtLoad
NETINFO_ITEM * DpCoupledNet(const NETINFO_ITEM *aNet)
LSET GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
std::vector< ZONE * > m_DRCCopperZones
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
void MapNets(BOARD *aDestBoard)
Map all nets in the given board to nets with the same name (if any) in the destination board.
GAL_SET m_LegacyVisibleItems
PAD * GetPadFast(const VECTOR2I &aPosition, LSET aLayerMask) const
Return pad found at aPosition on aLayerMask using the fast search method.
LAYER m_layers[PCB_LAYER_ID_COUNT]
const GENERATORS & Generators() const
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
const std::vector< BOARD_CONNECTED_ITEM * > AllConnectedItems()
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
int m_outlinesChainingEpsilon
the max distance between 2 end point to see them connected when building the board outlines
std::set< wxString > GetNetClassAssignmentCandidates() const
Return the set of netname candidates for netclass assignment.
void RemoveAllListeners()
Remove all listeners.
std::unique_ptr< BOARD_DESIGN_SETTINGS > m_designSettings
All of the board design settings are stored as a JSON object inside the project file.
void SetEnabledLayers(LSET aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings.
void AddListener(BOARD_LISTENER *aListener)
Add a listener to the board to receive calls whenever something on the board has been modified.
void UpdateUserUnits(BOARD_ITEM *aItem, KIGFX::VIEW *aView)
Update any references within aItem (or its descendants) to the user units.
void SetProperties(const std::map< wxString, wxString > &aProps)
GAL_SET GetVisibleElements() const
Return a set of all the element categories that are visible.
void SetHighLightNet(int aNetCode, bool aMulti=false)
Select the netcode to be highlighted.
HIGH_LIGHT_INFO m_highLight
bool SetLayerDescr(PCB_LAYER_ID aIndex, const LAYER &aLayer)
Return the type of the copper layer given by aLayer.
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
BOARD_ITEM * GetItem(const KIID &aID) const
const ZONES & Zones() const
void InvokeListeners(Func &&aFunc, Args &&... args)
ZONE * AddArea(PICKED_ITEMS_LIST *aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer, VECTOR2I aStartPointPosition, ZONE_BORDER_DISPLAY_STYLE aHatch)
Add an empty copper area to board areas list.
const GROUPS & Groups() const
The groups must maintain the following invariants.
bool BuildConnectivity(PROGRESS_REPORTER *aReporter=nullptr)
Build or rebuild the board connectivity database for the board, especially the list of connected item...
bool IsLayerEnabled(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
LAYER_T GetLayerType(PCB_LAYER_ID aLayer) const
Return the type of the copper layer given by aLayer.
void RecordDRCExclusions()
Scan existing markers and record data from any that are Excluded.
void OnItemsCompositeUpdate(std::vector< BOARD_ITEM * > &aAddedItems, std::vector< BOARD_ITEM * > &aRemovedItems, std::vector< BOARD_ITEM * > &aChangedItems)
Notify the board and its listeners that items on the board have been modified in a composite operatio...
int SetAreasNetCodesFromNetNames()
Set the .m_NetCode member of all copper areas, according to the area Net Name The SetNetCodesFromNetN...
void SynchronizeNetsAndNetClasses(bool aResetTrackAndViaSizes)
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
void ResetNetHighLight()
Reset all high light data to the init state.
bool SetLayerName(PCB_LAYER_ID aLayer, const wxString &aLayerName)
Changes the name of the layer given by aLayer.
std::list< ZONE * > GetZoneList(bool aIncludeZonesInFootprints=false) const
void ConvertBrdLayerToPolygonalContours(PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aOutlines) const
Build a set of polygons which are the outlines of copper items (pads, tracks, vias,...
bool ResolveTextVar(wxString *token, int aDepth) const
const MARKERS & Markers() const
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayer) const
const std::vector< PAD * > GetPads() const
Return a reference to a list of all the pads.
void Move(const VECTOR2I &aMoveVector) override
Move this object.
TITLE_BLOCK & GetTitleBlock()
BOX2I ComputeBoundingBox(bool aBoardEdgesOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
void FixupEmbeddedData()
After loading a file from disk, the footprints do not yet contain the full data for their embedded fi...
int GetMaxClearanceValue() const
Returns the maximum clearance value for any object on the board.
PCB_LAYER_ID GetLayerID(const wxString &aLayerName) const
Return the ID of a layer.
HIGH_LIGHT_INFO m_highLightPrevious
LSET m_LegacyVisibleLayers
Visibility settings stored in board prior to 6.0, only used for loading legacy files.
void SetVisibleAlls()
Change the bit-mask of visible element categories and layers.
GroupLegalOpsField GroupLegalOps(const PCB_SELECTION &selection) const
Check which selection tool group operations are legal given the selection.
int GetCopperLayerCount() const
std::vector< BOARD_LISTENER * > m_listeners
std::unordered_map< PTR_PTR_CACHE_KEY, bool > m_IntersectsCourtyardCache
void IncrementTimeStamp()
int MatchDpSuffix(const wxString &aNetName, wxString &aComplementNet)
Fetch the coupled netname for a given net.
std::unordered_map< PTR_PTR_CACHE_KEY, bool > m_IntersectsFCourtyardCache
const FOOTPRINTS & Footprints() const
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
void RemoveAll(std::initializer_list< KICAD_T > aTypes={ PCB_NETINFO_T, PCB_MARKER_T, PCB_GROUP_T, PCB_ZONE_T, PCB_GENERATOR_T, PCB_FOOTPRINT_T, PCB_TRACE_T, PCB_SHAPE_T })
An efficient way to remove all items of a certain type from the board.
const BOARD_ITEM_SET GetItemSet()
const TRACKS & Tracks() const
int m_DRCMaxPhysicalClearance
FOOTPRINT * FindFootprintByPath(const KIID_PATH &aPath) const
Search for a FOOTPRINT within this board with the given path.
void FinalizeBulkRemove(std::vector< BOARD_ITEM * > &aRemovedItems)
Must be used if Remove() is used using a BULK_x REMOVE_MODE to generate a change event for listeners.
std::unordered_map< wxString, LSET > m_LayerExpressionCache
wxString GroupsSanityCheckInternal(bool repair)
void OnRatsnestChanged()
Notify the board and its listeners that the ratsnest has been recomputed.
wxString ConvertCrossReferencesToKIIDs(const wxString &aSource) const
Convert cross-references back and forth between ${refDes:field} and ${kiid:field}.
wxString GetClass() const override
Return the class name.
void SetVisibleLayers(LSET aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings changes the bit-mask of vis...
bool m_LegacyNetclassesLoaded
True if netclasses were loaded from the file.
void SetCopperLayerCount(int aCount)
std::unordered_map< const ZONE *, BOX2I > m_ZoneBBoxCache
std::unordered_map< PTR_PTR_CACHE_KEY, bool > m_IntersectsBCourtyardCache
TRACKS TracksInNet(int aNetCode)
Collect all the TRACKs and VIAs that are members of a net given by aNetCode.
void SetProject(PROJECT *aProject, bool aReferenceOnly=false)
Link a board to a given project.
FOOTPRINT * GetFootprint(const VECTOR2I &aPosition, PCB_LAYER_ID aActiveLayer, bool aVisibleOnly, bool aIgnoreLocked=false) const
Get a footprint by its bounding rectangle at aPosition on aLayer.
const wxString & GetFileName() const
bool operator==(const BOARD_ITEM &aOther) const override
std::vector< PCB_MARKER * > ResolveDRCExclusions(bool aCreateMarkers)
Rebuild DRC markers from the serialized data in BOARD_DESIGN_SETTINGS.
FOOTPRINT * FindFootprintByReference(const wxString &aReference) const
Search for a FOOTPRINT within this board with the given reference designator.
unsigned GetNodesCount(int aNet=-1) const
void FillItemMap(std::map< KIID, EDA_ITEM * > &aMap)
void SetElementVisibility(GAL_LAYER_ID aLayer, bool aNewState)
Change the visibility of an element category.
std::shared_ptr< DRC_RTREE > m_CopperItemRTreeCache
bool SetLayerType(PCB_LAYER_ID aLayer, LAYER_T aLayerType)
Change the type of the layer given by aLayer.
int GetOutlinesChainingEpsilon()
void GetSortedPadListByXthenYCoord(std::vector< PAD * > &aVector, int aNetCode=-1) const
First empties then fills the vector with all pads and sorts them by increasing x coordinate,...
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
std::unordered_map< ZONE *, std::unique_ptr< DRC_RTREE > > m_CopperZoneRTreeCache
void FinalizeBulkAdd(std::vector< BOARD_ITEM * > &aNewItems)
Must be used if Add() is used using a BULK_x ADD_MODE to generate a change event for listeners.
int LayerDepth(PCB_LAYER_ID aStartLayer, PCB_LAYER_ID aEndLayer) const
void DeleteAllFootprints()
Remove all footprints from the deque and free the memory associated with them.
PROJECT * GetProject() const
std::tuple< int, double, double > GetTrackLength(const PCB_TRACK &aTrack) const
Return data on the length and number of track segments connected to a given track.
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
wxString GroupsSanityCheck(bool repair=false)
Consistency check of internal m_groups structure.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
std::vector< ZONE * > m_DRCZones
PAD * GetPad(const VECTOR2I &aPosition, LSET aLayerMask) const
Find a pad aPosition on aLayer.
void UpdateRatsnestExclusions()
Update the visibility flags on the current unconnected ratsnest lines.
wxString ConvertKIIDsToCrossReferences(const wxString &aSource) const
void SynchronizeProperties()
Copy the current project's text variables into the boards property cache.
std::unordered_map< KIID, BOARD_ITEM * > m_itemByIdCache
void RemoveListener(BOARD_LISTENER *aListener)
Remove the specified listener.
std::shared_mutex m_CachesMutex
void DeleteMARKERs()
Delete all MARKERS from the board.
void Remove(BOARD_ITEM *aBoardItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
Removes an item from the container.
std::unordered_map< PTR_PTR_LAYER_CACHE_KEY, bool > m_IntersectsAreaCache
std::optional< int > m_maxClearanceValue
void HighLightON(bool aValue=true)
Enable or disable net highlighting.
void OnItemsChanged(std::vector< BOARD_ITEM * > &aItems)
Notify the board and its listeners that an item on the board has been modified in some way.
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
VECTOR2I GetPosition() const override
void CacheTriangulation(PROGRESS_REPORTER *aReporter=nullptr, const std::vector< ZONE * > &aZones={})
void SetVisibleElements(const GAL_SET &aMask)
A proxy function that calls the correspondent function in m_BoardSettings.
void EmbedFonts() override
Finds all fonts used in the board and embeds them in the file if permissions allow.
const DRAWINGS & Drawings() const
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
constexpr coord_type GetY() const
constexpr size_type GetWidth() const
constexpr coord_type GetX() const
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
constexpr size_type GetHeight() const
CN_EDGE represents a point-to-point connection, whether realized or unrealized (ie: tracks etc.
std::shared_ptr< const CN_ANCHOR > GetSourceNode() const
void SetVisible(bool aVisible)
std::shared_ptr< const CN_ANCHOR > GetTargetNode() const
static DELETED_BOARD_ITEM * GetInstance()
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
virtual VECTOR2I GetPosition() const
virtual void ClearEditFlags()
void SetFlags(EDA_ITEM_FLAGS aMask)
KICAD_T Type() const
Returns the type of object.
virtual INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &aScanTypes)
May be re-implemented for each derived class in order to handle all the types given by its member dat...
virtual void SetParent(EDA_ITEM *aParent)
EDA_ITEM_FLAGS GetFlags() const
int Compare(const EDA_SHAPE *aOther) const
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
EMBEDDED_FILE * GetEmbeddedFile(const wxString &aName) const
Returns the embedded file with the given name or nullptr if it does not exist.
EMBEDDED_FILE * AddFile(const wxFileName &aName, bool aOverwrite)
Loads a file from disk and adds it to the collection.
Helper for storing and iterating over GAL_LAYER_IDs.
static const std::vector< KICAD_T > BoardLevelItems
A scan list for all primary board items, omitting items which are subordinate to a FOOTPRINT,...
static const std::vector< KICAD_T > Tracks
A scan list for only TRACKs and ARCs.
std::set< int > m_netCodes
FONT is an abstract base class for both outline and stroke fonts.
virtual bool IsStroke() const
Class OUTLINE_FONT implements outline font drawing.
bool IsBOARD_ITEM() const
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
LSET is a set of PCB_LAYER_IDs.
static LSET AllLayersMask()
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
std::shared_ptr< RC_ITEM > GetRCItem() const
void SetExcluded(bool aExcluded, const wxString &aComment=wxEmptyString)
void SetParent(JSON_SETTINGS *aParent, bool aLoadFromFile=true)
static const char Default[]
the name of the default NETCLASS
Handle the data for a net.
const wxString & GetNetname() const
void SetNetCode(int aNetCode)
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
static const int ORPHANED
Constant that forces initialization of a netinfo item to the NETINFO_ITEM ORPHANED (typically -1) whe...
static NETINFO_ITEM * OrphanedItem()
NETINFO_ITEM meaning that there was no net assigned for an item, as there was no board storing net li...
unsigned GetNetCount() const
void RemoveNet(NETINFO_ITEM *aNet)
Remove a net from the net list.
NETINFO_ITEM * GetNetItem(int aNetCode) const
void clear()
Delete the list of nets (and free memory).
void AppendNet(NETINFO_ITEM *aNewElement)
Add aNewElement to the end of the net list.
const NETNAMES_MAP & NetsByName() const
Return the name map, at least for python.
VECTOR2I GetPosition() const override
Describe the page size and margins of a paper page on which to eventually print or plot.
const VECTOR2D & GetSizeMils() const
wxPrintOrientation GetWxOrientation() const
static double GetCustomHeightMils()
wxPaperSize GetPaperId() const
static double GetCustomWidthMils()
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool aIgnoreLineWidth=false) const override
Convert the item shape to a closed polygon.
DIM_UNITS_MODE GetUnitsMode() const
A set of BOARD_ITEMs (i.e., without duplicates).
virtual bool RemoveItem(BOARD_ITEM *aItem)
Remove item from group.
static PCB_MARKER * DeserializeFromString(const wxString &data)
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
Convert the shape to a closed polygon.
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc, bool aIgnoreLineWidth=false) const override
Convert the item shape to a closed polygon.
static int Compare(const PCB_TABLE *aTable, const PCB_TABLE *aOther)
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction) const override
Invoke a function on all children.
void TransformTextToPolySet(SHAPE_POLY_SET &aBuffer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc) const
Function TransformTextToPolySet Convert the text to a polygonSet describing the actual character stro...
void TransformTextToPolySet(SHAPE_POLY_SET &aBuffer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc) const
Function TransformTextToPolySet Convert the text to a polygonSet describing the actual character stro...
const VECTOR2I & GetEndPoint(ENDPOINT_T aEndPoint) const
Return the selected endpoint (start or end)
A holder to handle information on schematic or board items.
void PushItem(const ITEM_PICKER &aItem)
Push aItem to the top of the list.
A progress reporter interface for use in multi-threaded environments.
virtual bool IsCancelled() const =0
virtual bool KeepRefreshing(bool aWait=false)=0
Update the UI (if any).
virtual void Report(const wxString &aMessage)=0
Display aMessage in the progress bar dialog.
virtual void AdvanceProgress()=0
Increment the progress bar length (inside the current virtual zone).
The backing store for a PROJECT, in JSON format.
LSET m_VisibleLayers
Board settings.
GAL_SET m_VisibleItems
The GAL layers (aka items) that are turned on for viewing (.
Container for project specific data.
virtual const wxString GetProjectName() const
Return the short name of the project.
virtual PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
virtual PROJECT_FILE & GetProjectFile() const
virtual std::map< wxString, wxString > & GetTextVars() const
virtual bool IsNullProject() const
Check if this project is a null project (i.e.
int Length() const
Return the length (this).
bool PointInside(const VECTOR2I &aPt, int aAccuracy=0, bool aUseBBoxCache=false) const override
Check if point aP lies inside a closed shape.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
Represent a set of closed polygons.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)
void Simplify(POLYGON_MODE aFastMode)
Simplify the polyset (merges overlapping polys, eliminates degeneracy/self-intersections) For aFastMo...
int AddHole(const SHAPE_LINE_CHAIN &aHole, int aOutline=-1)
Adds a new hole to the given outline (default: last) and returns its index.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
int NewOutline()
Creates a new empty polygon in the set and returns its index.
int OutlineCount() const
Return the number of outlines in the set.
const wxString & GetComment(int aIdx) const
static void GetContextualTextVars(wxArrayString *aVars)
Handle a list of polygons defining a copper zone.
void SetMinThickness(int aMinThickness)
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
SHAPE_POLY_SET * Outline()
void SetHatchStyle(ZONE_BORDER_DISPLAY_STYLE aStyle)
void SetLayerSet(const LSET &aLayerSet) override
bool AppendCorner(VECTOR2I aPosition, int aHoleIdx, bool aAllowDuplication=false)
Add a new corner to the zone outline (to the main outline or a hole)
wxString GetTextVars(const wxString &aSource)
Returns any variables unexpanded, e.g.
bool BuildBoardPolygonOutlines(BOARD *aBoard, SHAPE_POLY_SET &aOutlines, int aErrorMax, int aChainingEpsilon, OUTLINE_ERROR_HANDLER *aErrorHandler, bool aAllowUseArcsInPolygons)
Extract the board outlines and build a closed polygon from lines, arcs and circle items on edge cut l...
const std::function< void(const wxString &msg, BOARD_ITEM *itemA, BOARD_ITEM *itemB, const VECTOR2I &pt)> OUTLINE_ERROR_HANDLER
const INSPECTOR_FUNC & INSPECTOR
std::function< INSPECT_RESULT(EDA_ITEM *aItem, void *aTestData) > INSPECTOR_FUNC
Used to inspect and possibly collect the (search) results of iterating over a list or tree of KICAD_T...
#define STRUCT_DELETED
flag indication structures to be erased
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
bool IsCopperLayer(int aLayerId)
Tests whether a layer is a copper layer.
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
@ LAYER_FOOTPRINTS_FR
show footprints on front
@ GAL_LAYER_ID_BITMASK_END
This is the end of the layers used for visibility bit masks in legacy board files.
@ LAYER_FOOTPRINTS_BK
show footprints on back
PCB_LAYER_ID
A quick note on layer IDs:
#define GAL_LAYER_INDEX(x)
Use this macro to convert a GAL layer to a 0-indexed offset from LAYER_VIAS.
PCB_LAYER_ID ToLAYER_ID(int aLayer)
void delete_matching(_Container &__c, _Value __value)
Covers for the horrifically named std::remove and std::remove_if (neither of which remove anything).
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Class to handle a set of BOARD_ITEMs.
Class that computes missing connections on a PCB.
bool operator()(const BOARD_ITEM *aFirst, const BOARD_ITEM *aSecond) const
bool operator()(const BOARD_ITEM *aFirst, const BOARD_ITEM *aSecond) const
constexpr int mmToIU(double mm) const
std::vector< char > decompressedData
std::string compressedEncodedData
Container to hold information pertinent to a layer of a BOARD.
int m_opposite
Similar layer on opposite side of the board, if any.
static LAYER_T ParseType(const char *aType)
Convert a string to a LAYER_T.
LAYER_T m_type
The type of the layer.
static const char * ShowType(LAYER_T aType)
Convert a LAYER_T enum to a string representation of the layer type.
wxString m_name
The canonical name of the layer.
wxString m_userName
The user defined name of the layer.
BS::thread_pool thread_pool
thread_pool & GetKiCadThreadPool()
Get a reference to the current thread pool.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
@ PCB_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
@ PCB_ZONE_T
class ZONE, a copper pour area
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
@ PCB_REFERENCE_IMAGE_T
class PCB_REFERENCE_IMAGE, bitmap on a layer
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
@ PCB_MARKER_T
class PCB_MARKER, a marker used to show something
@ PCB_TARGET_T
class PCB_TARGET, a target (graphic item)
@ PCB_TABLECELL_T
class PCB_TABLECELL, PCB_TEXTBOX for use in tables
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
@ PCB_PAD_T
class PAD, a pad in a footprint
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
@ PCB_TABLE_T
class PCB_TABLE, table of PCB_TABLECELLs
@ PCB_NETINFO_T
class NETINFO_ITEM, a description of a net
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
VECTOR2< int32_t > VECTOR2I
ZONE_BORDER_DISPLAY_STYLE
Zone border styles.