118 else if( layer >=
User_1 && layer & 1 )
131 int infinity = ( std::numeric_limits<int>::max() / 2 ) -
pcbIUScale.mmToIU( 1 );
144 _(
"This is the default net class." ) );
177 ownedItems.insert( g );
209 if( aProject && !aReferenceOnly )
226 std::shared_ptr<NET_SETTINGS>& projectSettings =
project.NetSettings();
228 projectSettings->SetDefaultNetclass( legacySettings->GetDefaultNetclass() );
229 projectSettings->SetNetclasses( legacySettings->GetNetclasses() );
230 projectSettings->SetNetclassPatternAssignments(
231 std::move( legacySettings->GetNetclassPatternAssignments() ) );
251 project.m_BoardSettings =
nullptr;
262 std::unique_lock<std::shared_mutex> writeLock(
m_CachesMutex );
306 std::set<std::pair<KIID, KIID>> m_ratsnestExclusions;
312 const std::shared_ptr<RC_ITEM>& rcItem = marker->GetRCItem();
313 m_ratsnestExclusions.emplace( rcItem->GetMainItemID(), rcItem->GetAuxItemID() );
314 m_ratsnestExclusions.emplace( rcItem->GetAuxItemID(), rcItem->GetMainItemID() );
327 aEdge.
SetVisible( m_ratsnestExclusions.count( ids ) == 0 );
342 if( marker->IsExcluded() )
344 wxString serialized = marker->SerializeToString();
346 m_designSettings->m_DrcExclusionComments[ serialized ] = marker->GetComment();
357 prjSettings->m_DrcExclusionComments =
m_designSettings->m_DrcExclusionComments;
363std::set<wxString>::iterator
FindByFirstNFields( std::set<wxString>& strSet,
const wxString& searchStr,
char delimiter,
366 wxString searchPrefix = searchStr;
369 int delimiterCount = 0;
372 while( pos < searchPrefix.length() && delimiterCount < n )
374 if( searchPrefix[pos] == delimiter )
380 if( delimiterCount == n )
381 searchPrefix = searchPrefix.Left( pos - 1 );
383 for(
auto it = strSet.begin(); it != strSet.end(); ++it )
385 if( it->StartsWith( searchPrefix + delimiter ) || *it == searchPrefix )
395 std::map<wxString, wxString> comments =
m_designSettings->m_DrcExclusionComments;
402 std::set<wxString>::iterator it;
403 wxString serialized = marker->SerializeToString();
404 wxString matchedExclusion;
406 if( !serialized.Contains(
"unconnected_items" ) )
408 it = exclusions.find( serialized );
410 if( it != exclusions.end() )
411 matchedExclusion = *it;
415 const int numberOfFieldsExcludingIds = 3;
416 const char delimiter =
'|';
417 it =
FindByFirstNFields( exclusions, serialized, delimiter, numberOfFieldsExcludingIds );
419 if( it != exclusions.end() )
420 matchedExclusion = *it;
423 if( it != exclusions.end() )
425 marker->SetExcluded(
true, comments[matchedExclusion] );
429 m_designSettings->m_DrcExclusionComments[matchedExclusion] = comments[matchedExclusion];
431 exclusions.erase( it );
435 std::vector<PCB_MARKER*> newMarkers;
439 for(
const wxString& serialized : exclusions )
450 for(
const KIID& uuid : ids )
452 if( uuidCount < 1 || uuid !=
niluuid )
466 marker->
SetExcluded(
true, comments[ serialized ] );
467 newMarkers.push_back( marker );
471 m_designSettings->m_DrcExclusionComments[ serialized ] = comments[ serialized ];
483 [&](
const wxString& aVar )
486 aVars->push_back( aVar );
489 add( wxT(
"LAYER" ) );
490 add( wxT(
"FILENAME" ) );
491 add( wxT(
"FILEPATH" ) );
492 add( wxT(
"PROJECTNAME" ) );
493 add( wxT(
"DRC_ERROR <message_text>" ) );
494 add( wxT(
"DRC_WARNING <message_text>" ) );
500 for( std::pair<wxString, wxString> entry :
GetProject()->GetTextVars() )
508 if( token->Contains(
':' ) )
511 wxString ref = token->BeforeFirst(
':', &remainder );
520 *token = std::move( remainder );
526 if( token->IsSameAs( wxT(
"FILENAME" ) ) )
529 *token = fn.GetFullName();
532 else if( token->IsSameAs( wxT(
"FILEPATH" ) ) )
535 *token = fn.GetFullPath();
538 else if( token->IsSameAs( wxT(
"PROJECTNAME" ) ) &&
GetProject() )
544 wxString var = *token;
577 wxLogWarning( wxT(
"This should not be called on the BOARD object") );
584 [&] (
EDA_ITEM* item,
void* testData )
593 board_item->
Move( aMoveVector );
624 aFunction( footprint );
632 aFunction( drawing );
638 catch( std::bad_function_call& )
640 wxFAIL_MSG( wxT(
"Error running BOARD::RunOnChildren" ) );
678 for(
auto& [ layer_id, layer ] :
m_layers )
680 if( layer.m_name == aLayerName || layer.m_userName == aLayerName )
705 if( it !=
m_layers.end() && !it->second.m_userName.IsEmpty() )
706 return it->second.m_userName;
715 if( aLayerName.IsEmpty() )
718 m_layers[aLayer].m_userName.clear();
723 if( aLayerName.Find( wxChar(
'"' ) ) != wxNOT_FOUND )
728 m_layers[aLayer].m_userName = aLayerName;
757 return it->second.m_type;
773 m_layers[aLayer].m_type = aLayerType;
791 case LT_AUX:
return "auxiliary";
800 if( strcmp( aType,
"signal" ) == 0 )
return LT_SIGNAL;
801 else if( strcmp( aType,
"power" ) == 0 )
return LT_POWER;
802 else if( strcmp( aType,
"mixed" ) == 0 )
return LT_MIXED;
803 else if( strcmp( aType,
"jumper" ) == 0 )
return LT_JUMPER;
804 else if( strcmp( aType,
"auxiliary" ) == 0 )
return LT_AUX;
805 else if( strcmp( aType,
"front" ) == 0 )
return LT_FRONT;
806 else if( strcmp( aType,
"back" ) == 0 )
return LT_BACK;
819 if(
m_layers[layer].m_opposite != layer )
825 wxString principalName =
m_layers[layer].m_userName.AfterFirst(
'.' );
838 wxString candidate =
m_layers[ii].m_userName.AfterFirst(
'.' );
840 if( !candidate.IsEmpty() && candidate == principalName )
852 int next = layer + 2;
917 if( aStartLayer > aEndLayer )
918 std::swap( aStartLayer, aEndLayer );
920 if( aEndLayer ==
B_Cu )
923 return aEndLayer - aStartLayer;
962 m_project->GetLocalSettings().m_VisibleLayers = aLayerSet;
971 for(
size_t i = 0; i < aSet.size(); i++ )
1012 track->SetLocalRatsnestVisible( isEnabled );
1016 for(
PAD*
pad : footprint->Pads() )
1017 pad->SetLocalRatsnestVisible( isEnabled );
1021 zone->SetLocalRatsnestVisible( isEnabled );
1038 default: wxFAIL_MSG( wxT(
"BOARD::IsModuleLayerVisible(): bad layer" ) );
return true;
1060 std::unique_lock<std::shared_mutex> writeLock(
m_CachesMutex );
1065 worstClearance = std::max( worstClearance, zone->GetLocalClearance().value() );
1069 for(
PAD*
pad : footprint->Pads() )
1071 std::optional<int>
override =
pad->GetClearanceOverrides(
nullptr );
1073 if(
override.has_value() )
1074 worstClearance = std::max( worstClearance,
override.value() );
1077 for(
ZONE* zone : footprint->Zones() )
1078 worstClearance = std::max( worstClearance, zone->GetLocalClearance().value() );
1090 std::vector<ZONE*> zones = aZones;
1099 aReporter->
Report(
_(
"Tessellating copper zones..." ) );
1102 std::vector<std::future<size_t>> returns;
1104 returns.reserve( zones.size() );
1107 [aReporter](
ZONE* aZone ) ->
size_t
1112 aZone->CacheTriangulation();
1120 for(
ZONE* zone : zones )
1121 returns.emplace_back(
tp.submit_task( [cache_zones, zone] { return cache_zones( zone ); } ) );
1124 for(
const std::future<size_t>& ret : returns )
1126 std::future_status status = ret.wait_for( std::chrono::milliseconds( 250 ) );
1128 while( status != std::future_status::ready )
1133 status = ret.wait_for( std::chrono::milliseconds( 250 ) );
1142 aFunction( footprint->GetEmbeddedFiles() );
1159 embeddedFile->data_hash = file->
data_hash;
1160 embeddedFile->is_valid = file->
is_valid;
1169 if( aBoardItem ==
nullptr )
1171 wxFAIL_MSG( wxT(
"BOARD::Add() param error: aBoardItem nullptr" ) );
1177 switch( aBoardItem->
Type() )
1217 wxFAIL_MSG( wxString::Format(
"BOARD::Add() Cannot place Track on non-copper layer: %d = %s",
1218 static_cast<int>( aBoardItem->
GetLayer() ),
1290 wxFAIL_MSG( wxString::Format( wxT(
"BOARD::Add() item type %s not handled" ),
1298 if( !aSkipConnectivity )
1320 for(
int ii = (
int)
m_zones.size() - 1; ii >= 0; --ii )
1338 wxASSERT( aBoardItem );
1342 switch( aBoardItem->
Type() )
1351 if( boardItem->GetNet() == netItem )
1352 boardItem->SetNet( unconnected );
1364 std::erase(
m_groups, aBoardItem );
1368 std::erase(
m_zones, aBoardItem );
1372 std::erase(
m_points, aBoardItem );
1396 std::erase(
m_tracks, aBoardItem );
1435 wxFAIL_MSG( wxString::Format( wxT(
"BOARD::Remove() item type %s not handled" ),
1450 std::vector<BOARD_ITEM*> removed;
1452 for(
const KICAD_T& type : aTypes )
1458 removed.emplace_back( item );
1469 std::copy(
m_groups.begin(),
m_groups.end(), std::back_inserter( removed ) );
1474 std::copy(
m_points.begin(),
m_points.end(), std::back_inserter( removed ) );
1479 std::copy(
m_zones.begin(),
m_zones.end(), std::back_inserter( removed ) );
1494 std::copy(
m_tracks.begin(),
m_tracks.end(), std::back_inserter( removed ) );
1500 wxFAIL_MSG( wxT(
"Use PCB_TRACE_T to remove all tracks, arcs, and vias" ) );
1520 wxFAIL_MSG( wxT(
"Use PCB_SHAPE_T to remove all graphics and text" ) );
1524 wxFAIL_MSG( wxT(
"BOARD::RemoveAll() needs more ::Type() support" ) );
1545 for(
int i = 0; i < collector.
GetCount(); i++ )
1565 via->LayerPair( &top_layer, &bottom_layer );
1567 if( top_layer != aLayer && bottom_layer != aLayer )
1582 bool modified =
false;
1583 bool removedItemLayers =
false;
1589 for(
int i = 0; i < collector.
GetCount(); i++ )
1610 removedItemLayers =
true;
1613 else if(
via->IsOnLayer( aLayer ) )
1617 via->LayerPair( &top_layer, &bottom_layer );
1619 if( top_layer == aLayer || bottom_layer == aLayer )
1629 removedItemLayers =
true;
1636 layers.
reset( aLayer );
1649 removedItemLayers =
true;
1653 if( removedItemLayers )
1662 return wxString::Format(
_(
"PCB" ) );
1669 [&](
EDA_ITEM* descendant,
void* aTestData )
1678 aView->
Update( dimension );
1705 std::vector<PCB_MARKER*> remaining;
1716 remaining.push_back( marker );
1738 footprint->SetParent(
nullptr );
1759 if(
group->m_Uuid == aID )
1765 if( generator->m_Uuid == aID )
1771 if( track->m_Uuid == aID )
1777 if( footprint->m_Uuid == aID )
1780 for(
PAD*
pad : footprint->Pads() )
1782 if(
pad->m_Uuid == aID )
1786 for(
PCB_FIELD* field : footprint->GetFields() )
1788 if( field && field->m_Uuid == aID )
1792 for(
BOARD_ITEM* drawing : footprint->GraphicalItems() )
1794 if( drawing->m_Uuid == aID )
1800 if( zone->m_Uuid == aID )
1806 if(
group->m_Uuid == aID )
1813 if( zone->m_Uuid == aID )
1823 if( cell->m_Uuid == aID )
1828 if( drawing->m_Uuid == aID )
1834 if( marker->m_Uuid == aID )
1840 if( point->m_Uuid == aID )
1846 if( netInfo->m_Uuid == aID )
1851 return const_cast<BOARD*
>( this );
1854 if( aAllowNullptrReturn )
1867 aMap[ track->m_Uuid ] = track;
1871 aMap[ footprint->m_Uuid ] = footprint;
1873 for(
PAD*
pad : footprint->Pads() )
1874 aMap[
pad->m_Uuid ] =
pad;
1876 aMap[ footprint->Reference().m_Uuid ] = &footprint->Reference();
1877 aMap[ footprint->Value().m_Uuid ] = &footprint->Value();
1879 for(
BOARD_ITEM* drawing : footprint->GraphicalItems() )
1880 aMap[ drawing->m_Uuid ] = drawing;
1884 aMap[ zone->m_Uuid ] = zone;
1887 aMap[ drawing->m_Uuid ] = drawing;
1890 aMap[ marker->m_Uuid ] = marker;
1896 aMap[ point->m_Uuid ] = point;
1899 aMap[ generator->m_Uuid ] = generator;
1906 size_t sourceLen = aSource.length();
1908 for(
size_t i = 0; i < sourceLen; ++i )
1910 if( aSource[i] ==
'$' && i + 1 < sourceLen && aSource[i+1] ==
'{' )
1913 bool isCrossRef =
false;
1915 for( i = i + 2; i < sourceLen; ++i )
1917 if( aSource[i] ==
'}' )
1920 if( aSource[i] ==
':' )
1923 token.append( aSource[i] );
1929 wxString ref = token.BeforeFirst(
':', &remainder );
1933 if( footprint->GetReference().CmpNoCase( ref ) == 0 )
1935 wxString
test( remainder );
1937 if( footprint->ResolveTextVar( &
test ) )
1938 token = footprint->m_Uuid.AsString() + wxT(
":" ) + remainder;
1945 newbuf.append( wxT(
"${" ) + token + wxT(
"}" ) );
1949 newbuf.append( aSource[i] );
1960 size_t sourceLen = aSource.length();
1962 for(
size_t i = 0; i < sourceLen; ++i )
1964 if( aSource[i] ==
'$' && i + 1 < sourceLen && aSource[i+1] ==
'{' )
1967 bool isCrossRef =
false;
1969 for( i = i + 2; i < sourceLen; ++i )
1971 if( aSource[i] ==
'}' )
1974 if( aSource[i] ==
':' )
1977 token.append( aSource[i] );
1983 wxString ref = token.BeforeFirst(
':', &remainder );
1988 token =
static_cast<FOOTPRINT*
>( refItem )->GetReference() + wxT(
":" )
1993 newbuf.append( wxT(
"${" ) + token + wxT(
"}" ) );
1997 newbuf.append( aSource[i] );
2007 unsigned retval = 0;
2011 for(
PAD*
pad : footprint->Pads() )
2013 if( ( aNet == -1 &&
pad->GetNetCode() > 0 ) || aNet ==
pad->GetNetCode() )
2032 if( aBoardEdgesOnly )
2041 if( ( item->GetLayerSet() & visible ).any() )
2042 bbox.
Merge( item->GetBoundingBox() );
2048 if( aBoardEdgesOnly )
2050 for(
const BOARD_ITEM* edge : footprint->GraphicalItems() )
2053 bbox.
Merge( edge->GetBoundingBox() );
2056 else if( ( footprint->GetLayerSet() & visible ).any() )
2058 bbox.
Merge( footprint->GetBoundingBox(
true ) );
2062 if( !aBoardEdgesOnly )
2067 if( ( track->GetLayerSet() & visible ).any() )
2068 bbox.
Merge( track->GetBoundingBox() );
2074 if( ( aZone->GetLayerSet() & visible ).any() )
2075 bbox.
Merge( aZone->GetBoundingBox() );
2080 bbox.
Merge( point->GetBoundingBox() );
2092 int trackSegmentCount = 0;
2093 std::set<int> netCodes;
2101 trackSegmentCount++;
2103 if( item->GetNetCode() > 0 )
2104 netCodes.insert( item->GetNetCode() );
2109 for(
PAD*
pad : footprint->Pads() )
2113 if(
pad->GetNetCode() > 0 )
2114 netCodes.insert(
pad->GetNetCode() );
2118 aList.emplace_back(
_(
"Pads" ), wxString::Format( wxT(
"%d" ), padCount ) );
2119 aList.emplace_back(
_(
"Vias" ), wxString::Format( wxT(
"%d" ), viaCount ) );
2120 aList.emplace_back(
_(
"Track Segments" ), wxString::Format( wxT(
"%d" ), trackSegmentCount ) );
2121 aList.emplace_back(
_(
"Nets" ), wxString::Format( wxT(
"%d" ), (
int) netCodes.size() ) );
2122 aList.emplace_back(
_(
"Unrouted" ), wxString::Format( wxT(
"%d" ), unconnected ) );
2127 const std::vector<KICAD_T>& scanTypes )
2129#if 0 && defined(DEBUG)
2130 std::cout <<
GetClass().mb_str() <<
' ';
2133 bool footprintsScanned =
false;
2134 bool drawingsScanned =
false;
2135 bool tracksScanned =
false;
2137 for(
KICAD_T scanType : scanTypes )
2169 if( !footprintsScanned )
2177 footprintsScanned =
true;
2180 if( !drawingsScanned )
2188 drawingsScanned =
true;
2196 if( !tracksScanned )
2204 tracksScanned =
true;
2228 if( !footprintsScanned )
2236 footprintsScanned =
true;
2248 if( !footprintsScanned )
2256 footprintsScanned =
true;
2294 return m_NetInfo.GetNetItem( aNetcode );
2300 return m_NetInfo.GetNetItem( aNetname );
2309 for(
auto it = aNetName.rbegin(); it != aNetName.rend() && rv == 0; ++it, ++count )
2313 if( ( ch >=
'0' && ch <=
'9' ) || ch ==
'_' )
2317 else if( ch ==
'+' )
2319 aComplementNet = wxT(
"-" );
2322 else if( ch ==
'-' )
2324 aComplementNet = wxT(
"+" );
2327 else if( ch ==
'N' )
2329 aComplementNet = wxT(
"P" );
2332 else if ( ch ==
'P' )
2334 aComplementNet = wxT(
"N" );
2343 if( rv != 0 && count >= 1 )
2345 aComplementNet = aNetName.Left( aNetName.length() - count )
2347 + aNetName.Right( count - 1 );
2359 wxString coupledNetName;
2362 return FindNet( coupledNetName );
2373 if( aReference == footprint->GetReference() )
2385 if( footprint->GetPath() == aPath )
2395 std::set<wxString> names;
2399 if( !net->GetNetname().IsEmpty() )
2400 names.insert( net->GetNetname() );
2433 if( aResetTrackAndViaSizes )
2452 std::shared_ptr<COMPONENT_CLASS_SETTINGS> settings =
2456 settings->GetComponentClassAssignments(), settings->GetEnableSheetComponentClasses(),
2463 int error_count = 0;
2467 if( !zone->IsOnCopperLayer() )
2473 if( zone->GetNetCode() != 0 )
2486 zone->SetNetCode( -1 );
2501 if( footprint->HitTest( aPosition ) )
2502 pad = footprint->GetPad( aPosition, aLayerSet.any() ? aLayerSet :
LSET::AllCuMask() );
2518 return GetPad( aPosition, lset );
2526 int idxmax = aPadList.size() - 1;
2528 int delta = aPadList.size();
2541 PAD*
pad = aPadList[idx];
2543 if(
pad->GetPosition() == aPosition )
2546 if( ( aLayerSet &
pad->GetLayerSet() ).any() )
2553 for(
int ii = idx+1; ii <= idxmax; ii++ )
2557 if(
pad->GetPosition() != aPosition )
2560 if( ( aLayerSet &
pad->GetLayerSet() ).any() )
2564 for(
int ii = idx - 1 ;ii >=0; ii-- )
2568 if(
pad->GetPosition() != aPosition )
2571 if( ( aLayerSet &
pad->GetLayerSet() ).any() )
2579 if(
pad->GetPosition().x == aPosition.
x )
2581 if(
pad->GetPosition().y < aPosition.
y )
2596 else if(
pad->GetPosition().x < aPosition.
x )
2634 for(
PAD*
pad : footprint->Pads( ) )
2636 if( aNetCode < 0 || pad->GetNetCode() == aNetCode )
2637 aVector.push_back(
pad );
2659 std::vector<LENGTH_DELAY_CALCULATION_ITEM> items;
2665 if( item.
Type() != LENGTH_DELAY_CALCULATION_ITEM::TYPE::UNKNOWN )
2666 items.push_back( std::move( item ) );
2670 .OptimiseViaLayers =
true, .MergeTracks =
true, .OptimiseTracesInPads =
true, .InferViaInPad =
false
2682 bool aVisibleOnly,
bool aIgnoreLocked )
const
2686 int min_dim = 0x7FFFFFFF;
2687 int alt_min_dim = 0x7FFFFFFF;
2688 bool current_layer_back =
IsBackLayer( aActiveLayer );
2693 if( !candidate->HitTest( aPosition ) )
2697 if( aIgnoreLocked && candidate->IsLocked() )
2705 BOX2I bb = candidate->GetBoundingBox(
false );
2711 int dist = ( aPosition.
x - offx ) * ( aPosition.
x - offx ) +
2712 ( aPosition.
y - offy ) * ( aPosition.
y - offy );
2716 if( dist <= min_dim )
2719 footprint = candidate;
2725 if( dist <= alt_min_dim )
2728 alt_footprint = candidate;
2739 return alt_footprint;
2747 std::list<ZONE*> zones;
2750 zones.push_back( zone );
2752 if( aIncludeZonesInFootprints )
2756 for(
ZONE* zone : footprint->Zones() )
2757 zones.push_back( zone );
2773 m_zones.push_back( new_area );
2791 bool aAllowUseArcsInPolygons,
bool aIncludeNPTHAsOutlines )
2797 chainingEpsilon, aErrorHandler, aAllowUseArcsInPolygons );
2800 if( aIncludeNPTHAsOutlines )
2804 for(
PAD*
pad : fp->Pads() )
2824 aOutlines.
AddHole( pad_hole, jj );
2862 std::set<KIFONT::OUTLINE_FONT*>
fonts;
2875 if( permission == PERMISSION::EDITABLE || permission == PERMISSION::INSTALLABLE )
2876 fonts.insert( outlineFont );
2897 std::vector<PAD*> allPads;
2901 for(
PAD*
pad : footprint->Pads() )
2902 allPads.push_back(
pad );
2911 std::vector<BOARD_CONNECTED_ITEM*> items;
2914 items.push_back( track );
2918 for(
PAD*
pad : footprint->Pads() )
2919 items.push_back(
pad );
2923 items.push_back( zone );
2928 items.push_back( bci );
2942 item->SetNet( netInfo );
2946 aDestBoard->
Add( newNet );
2947 item->SetNet( newNet );
2958 if(
FindNet( item->GetNetCode() ) ==
nullptr )
3002 std::vector<BOARD_ITEM*>& aRemovedItems,
3003 std::vector<BOARD_ITEM*>& aChangedItems )
3055 return wxEmptyString;
3074 std::unordered_set<EDA_GROUP*> knownCycleFreeGroups;
3076 std::unordered_set<EDA_GROUP*> currentChainGroups;
3078 std::unordered_set<EDA_GROUP*> toCheckGroups;
3082 toCheckGroups.insert(
group );
3085 toCheckGroups.insert( gen );
3087 while( !toCheckGroups.empty() )
3089 currentChainGroups.clear();
3094 if( currentChainGroups.find(
group ) != currentChainGroups.end() )
3099 return "Cycle detected in group membership";
3101 else if( knownCycleFreeGroups.find(
group ) != knownCycleFreeGroups.end() )
3107 currentChainGroups.insert(
group );
3109 toCheckGroups.erase(
group );
3111 group =
group->AsEdaItem()->GetParentGroup();
3122 knownCycleFreeGroups.insert( currentChainGroups.begin(), currentChainGroups.end() );
3154 if( aFirst->
Type() != aSecond->
Type() )
3155 return aFirst->
Type() < aSecond->
Type();
3164 return shape->
Compare( other );
3170 return text->Compare( other );
3177 return textbox->PCB_SHAPE::Compare( other ) && textbox->EDA_TEXT::Compare( other );
3207 if( !track->IsOnLayer( aLayer ) )
3210 track->TransformShapeToPolygon( aOutlines, aLayer, 0, maxError,
ERROR_INSIDE );
3216 footprint->TransformPadsToPolySet( aOutlines, aLayer, 0, maxError,
ERROR_INSIDE );
3218 footprint->TransformFPShapesToPolySet( aOutlines, aLayer, 0, maxError,
ERROR_INSIDE,
3223 for(
const ZONE* zone : footprint->Zones() )
3225 if( zone->GetLayerSet().test( aLayer ) )
3226 zone->TransformSolidAreasShapesToPolygon( aLayer, aOutlines );
3233 if( zone->GetLayerSet().test( aLayer ) )
3234 zone->TransformSolidAreasShapesToPolygon( aLayer, aOutlines );
3240 if( !item->IsOnLayer( aLayer ) )
3243 switch( item->Type() )
3271 textbox->PCB_SHAPE::TransformShapeToPolygon( aOutlines, aLayer, 0, maxError,
ERROR_INSIDE );
3280 table->TransformGraphicItemsToPolySet( aOutlines, maxError,
ERROR_INSIDE, aRenderSettings );
3307 std::copy(
m_tracks.begin(),
m_tracks.end(), std::inserter( items, items.end() ) );
3308 std::copy(
m_zones.begin(),
m_zones.end(), std::inserter( items, items.end() ) );
3311 std::copy(
m_markers.begin(),
m_markers.end(), std::inserter( items, items.end() ) );
3312 std::copy(
m_groups.begin(),
m_groups.end(), std::inserter( items, items.end() ) );
3313 std::copy(
m_points.begin(),
m_points.end(), std::inserter( items, items.end() ) );
3324 const BOARD& other =
static_cast<const BOARD&
>( aItem );
3332 const NETNAMES_MAP& thisNetNames =
m_NetInfo.NetsByName();
3335 for(
auto it1 = thisNetNames.begin(), it2 = otherNetNames.begin();
3336 it1 != thisNetNames.end() && it2 != otherNetNames.end(); ++it1, ++it2 )
3340 if( it1->first != it2->first )
3375 wxArrayString ourVars;
3376 m_titles.GetContextualTextVars( &ourVars );
3378 wxArrayString otherVars;
3381 if( ourVars != otherVars )
3405 for(
PAD*
pad : footprint->Pads() )
3423 for(
PAD*
pad : footprint->Pads() )
3438 if( projPath.IsEmpty() )
3442 if( !projPath.IsSameAs( aProjectPath ) )
3444 wxLogTrace(
traceAutoSave, wxS(
"[history] pcb saver skipping - project path mismatch: %s vs %s"),
3445 projPath, aProjectPath );
3451 if( boardPath.IsEmpty() )
3455 if( !boardPath.StartsWith( projPath ) )
3457 wxLogTrace(
traceAutoSave, wxS(
"[history] pcb saver skipping - board not under project: %s"),
3462 wxString rel = boardPath.Mid( projPath.length() );
3465 wxFileName historyRoot( projPath, wxEmptyString );
3466 historyRoot.AppendDir( wxS(
".history" ) );
3467 wxFileName dst( historyRoot.GetPath(), rel );
3470 wxFileName dstDir( dst );
3471 dstDir.SetFullName( wxEmptyString );
3473 if( !dstDir.DirExists() )
3474 wxFileName::Mkdir( dstDir.GetPath(), 0777, wxPATH_MKDIR_FULL );
3480 pi->SaveBoard( dst.GetFullPath(),
this,
nullptr );
3481 aFiles.push_back( dst.GetFullPath() );
3482 wxLogTrace(
traceAutoSave, wxS(
"[history] pcb saver exported '%s'"), dst.GetFullPath() );
3486 wxLogTrace(
traceAutoSave, wxS(
"[history] pcb saver export failed: %s"),
3487 wxString::FromUTF8( ioe.
What() ) );
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.
std::set< wxString >::iterator FindByFirstNFields(std::set< wxString > &strSet, const wxString &searchStr, char delimiter, int n)
#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.
void SetEnabledLayers(const LSET &aMask)
Change the bit-mask of enabled layers to aMask.
std::shared_ptr< NET_SETTINGS > m_NetSettings
void SetCustomTrackWidth(int aWidth)
Sets custom width for track (i.e.
void SetCustomViaSize(int aSize)
Set custom size for via diameter (i.e.
const LSET & GetEnabledLayers() const
Return a bit-mask of all the layers that are enabled.
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.
void SetUserDefinedLayerCount(int aNewLayerCount)
Set the number of user defined layers to aNewLayerCount.
BOARD_STACKUP & GetStackupDescriptor()
void SetCustomViaDrill(int aDrill)
Sets custom size for via drill (i.e.
int GetCopperLayerCount() const
int GetUserDefinedLayerCount() const
void SetCopperLayerCount(int aNewLayerCount)
Set the copper layer count to aNewLayerCount.
void SetCustomDiffPairViaGap(int aGap)
Sets custom via gap for differential pairs (i.e.
BOARD_ITEM_CONTAINER(BOARD_ITEM *aParent, KICAD_T aType)
BOARD_ITEM(BOARD_ITEM *aParent, KICAD_T idtype, PCB_LAYER_ID aLayer=F_Cu)
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual void SetLayerSet(const LSET &aLayers)
virtual void Move(const VECTOR2I &aMoveVector)
Move this object.
virtual bool IsOnLayer(PCB_LAYER_ID aLayer) const
Test to see if this object is on the given layer.
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
FOOTPRINT * GetParentFootprint() const
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
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 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 OnBoardCompositeUpdate(BOARD &aBoard, std::vector< BOARD_ITEM * > &aAddedItems, std::vector< BOARD_ITEM * > &aRemovedItems, std::vector< BOARD_ITEM * > &aChangedItems)
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.
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.
PAD * GetPad(const VECTOR2I &aPosition, const LSET &aLayerMask) const
Find a pad aPosition on aLayer.
int GetUserDefinedLayerCount() const
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)
std::vector< ZONE * > m_DRCCopperZones
void SetVisibleLayers(const LSET &aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings changes the bit-mask of vis...
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
LENGTH_DELAY_CALCULATION * GetLengthCalculation() const
Returns the track length calculator.
void RunOnNestedEmbeddedFiles(const std::function< void(EMBEDDED_FILES *)> &aFunction) override
Provide access to nested embedded files, such as symbols in schematics and footprints in boards.
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::tuple< int, double, double, double, double > GetTrackLength(const PCB_TRACK &aTrack) const
Return data on the length and number of track segments connected to a given track.
std::set< wxString > GetNetClassAssignmentCandidates() const
Return the set of netname candidates for netclass assignment.
BOARD_USE m_boardUse
What is this board being used for.
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 ConvertBrdLayerToPolygonalContours(PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aOutlines, KIGFX::RENDER_SETTINGS *aRenderSettings=nullptr) const
Build a set of polygons which are the outlines of copper items (pads, tracks, vias,...
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)
bool IsBackLayer(PCB_LAYER_ID aLayer) const
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.
void UpdateBoardOutline()
const ZONES & Zones() const
void BulkRemoveStaleTeardrops(BOARD_COMMIT &aCommit)
Remove all teardrop zones with the STRUCT_DELETED flag set.
void InvokeListeners(Func &&aFunc, Args &&... args)
void SetDesignSettings(const BOARD_DESIGN_SETTINGS &aSettings)
const LSET & GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
EMBEDDED_FILES * m_embeddedFilesDelegate
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.
bool IsFrontLayer(PCB_LAYER_ID aLayer) const
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
bool ResolveTextVar(wxString *token, int aDepth) const
const MARKERS & Markers() const
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.
int GetCopperLayerCount() const
std::vector< BOARD_LISTENER * > m_listeners
bool RemoveAllItemsOnLayer(PCB_LAYER_ID aLayer)
Removes all owned items other than footprints existing on the given board layer, and modifies the sta...
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
std::unique_ptr< LENGTH_DELAY_CALCULATION > m_lengthDelayCalc
const FOOTPRINTS & Footprints() const
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
std::set< KIFONT::OUTLINE_FONT * > GetFonts() const override
Get the list of all outline fonts used in the board.
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.
std::unique_ptr< COMPONENT_CLASS_MANAGER > m_componentClassManager
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.
bool HasItemsOnLayer(PCB_LAYER_ID 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.
int GetPadWithCastellatedAttrCount()
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.
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
void DetachAllFootprints()
Remove all footprints without deleting.
std::map< int, LAYER > m_layers
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction, RECURSE_MODE aMode) const override
Invoke a function on all children.
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
int GetPadWithPressFitAttrCount()
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
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
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
bool SynchronizeComponentClasses(const std::unordered_set< wxString > &aNewSheetPaths) const
Copy component class / component class generator information from the project settings.
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 SetEnabledLayers(const LSET &aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings.
void SynchronizeTuningProfileProperties()
Ensure that all time domain properties providers are in sync with current settings.
BOARD_ITEM * ResolveItem(const KIID &aID, bool aAllowNullptrReturn=false) const
bool m_LegacyCopperEdgeClearanceLoaded
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 SaveToHistory(const wxString &aProjectPath, std::vector< wxString > &aFiles)
Save board file to the .history directory.
void EmbedFonts() override
Finds all fonts used in the board and embeds them in the file if permissions allow.
PCB_BOARD_OUTLINE * m_boardOutline
void SetUserDefinedLayerCount(int aCount)
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
BOARD_CONNECTED_ITEM * Parent() 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
int GetCount() const
Return the number of objects in the list.
COMMIT & Removed(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
A class to manage Component Classes in a board context.
void RunOnUnconnectedEdges(std::function< bool(CN_EDGE &)> aFunc)
unsigned int GetUnconnectedCount(bool aVisibileOnly) const
static DELETED_BOARD_ITEM * GetInstance()
The base class for create windows for drawing purpose.
A set of EDA_ITEMs (i.e., without duplicates).
virtual VECTOR2I GetPosition() const
virtual void ClearEditFlags()
void SetFlags(EDA_ITEM_FLAGS aMask)
virtual EDA_GROUP * GetParentGroup() const
KICAD_T Type() const
Returns the type of object.
static INSPECT_RESULT IterateForward(std::deque< T > &aList, INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &scanTypes)
This changes first parameter to avoid the DList and use the main queue instead.
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)
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
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)
Load a file from disk and adds it to the collection.
const std::map< wxString, EMBEDDED_FILE * > & EmbeddedFileMap() const
Helper for storing and iterating over GAL_LAYER_IDs.
static GAL_SET DefaultVisible()
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.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
virtual const wxString What() const
A composite of Problem() and Where()
FONT is an abstract base class for both outline and stroke fonts.
virtual bool IsOutline() const
Class OUTLINE_FONT implements outline font drawing.
EMBEDDING_PERMISSION GetEmbeddingPermission() const
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
bool IsBOARD_ITEM() const
virtual wxString GetClass() const =0
Return the class name.
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...
Lightweight class which holds a pad, via, or a routed trace outline.
TYPE Type() const
Gets the routing item type.
Class which calculates lengths (and associated routing statistics) in a BOARD context.
LENGTH_DELAY_CALCULATION_ITEM GetLengthCalculationItem(const BOARD_CONNECTED_ITEM *aBoardItem) const
Return a LENGTH_CALCULATION_ITEM constructed from the given BOARD_CONNECTED_ITEM.
LENGTH_DELAY_STATS CalculateLengthDetails(std::vector< LENGTH_DELAY_CALCULATION_ITEM > &aItems, PATH_OPTIMISATIONS aOptimisations, const PAD *aStartPad=nullptr, const PAD *aEndPad=nullptr, LENGTH_DELAY_LAYER_OPT aLayerOpt=LENGTH_DELAY_LAYER_OPT::NO_LAYER_DETAIL, LENGTH_DELAY_DOMAIN_OPT aDomain=LENGTH_DELAY_DOMAIN_OPT::NO_DELAY_DETAIL) const
Calculates the electrical length of the given items.
LSET is a set of PCB_LAYER_IDs.
static LSET AllCuMask(int aCuLayerCount)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
static const LSET & AllLayersMask()
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
void SetDescription(const wxString &aDesc)
Handle the data for a net.
wxString GetClass() const override
Return the class name.
const wxString & GetNetname() const
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
const NETNAMES_MAP & NetsByName() const
Return the name map, at least for python.
void ClearAllCaches()
Clears the effective netclass cache for all nets.
std::shared_ptr< NETCLASS > GetEffectiveNetClass(const wxString &aNetName)
Fetches the effective (may be aggregate) netclass for the given net name.
std::shared_ptr< NETCLASS > GetDefaultNetclass()
Gets the default netclass for the project.
void SetDefaultNetclass(std::shared_ptr< NETCLASS > netclass)
Sets the default netclass for the project Calling user is responsible for resetting the effective net...
VECTOR2I GetPosition() const override
const VECTOR2D & GetSizeMils() const
wxPrintOrientation GetWxOrientation() const
static double GetCustomHeightMils()
wxPaperSize GetPaperId() const
static double GetCustomWidthMils()
static int Compare(const PCB_BARCODE *aBarcode, const PCB_BARCODE *aOther)
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc=ERROR_INSIDE, bool ignoreLineWidth=false) const override
Convert the barcode (text + symbol shapes) to polygonal geometry suitable for filling/collision tests...
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).
@ KICAD_SEXP
S-expression Pcbnew file format.
static PCB_IO * FindPlugin(PCB_FILE_T aFileType)
Return a #PLUGIN which the caller can use to import, export, save, or load design documents.
Collect all BOARD_ITEM objects on a given layer.
void Collect(BOARD_ITEM *aBoard, const std::vector< KICAD_T > &aTypes)
Test a BOARD_ITEM using this class's Inspector method, which does the collection.
void SetLayerId(PCB_LAYER_ID aLayerId)
static PCB_MARKER * DeserializeFromString(const wxString &data)
A PCB_POINT is a 0-dimensional point that is used to mark a position on a PCB, or more usually a foot...
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.
static int Compare(const PCB_TABLE *aTable, const PCB_TABLE *aOther)
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.
std::shared_ptr< COMPONENT_CLASS_SETTINGS > & ComponentClassSettings()
Container for project specific data.
virtual const wxString GetProjectPath() const
Return the full path of the project.
virtual const wxString GetProjectName() const
Return the short name of the project.
virtual PROJECT_FILE & GetProjectFile() const
std::vector< KIID > GetIDs() const
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.
void Simplify()
Simplify the polyset (merges overlapping polys, eliminates degeneracy/self-intersections)
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 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.
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
void SetHatchStyle(ZONE_BORDER_DISPLAY_STYLE aStyle)
bool IsTeardropArea() const
bool AppendCorner(VECTOR2I aPosition, int aHoleIdx, bool aAllowDuplication=false)
Add a new corner to the zone outline (to the main outline or a hole)
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
static bool empty(const wxTextEntryBase *aCtrl)
const INSPECTOR_FUNC & INSPECTOR
std::function passed to nested users by ref, avoids copying std::function.
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
const wxChar *const traceAutoSave
Flag to enable auto save feature debug tracing.
std::unique_ptr< T > IO_RELEASER
Helper to hold and release an IO_BASE object when exceptions are thrown.
bool IsCopperLayer(int aLayerId)
Test 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)
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
@ NPTH
like PAD_PTH, but not plated mechanical use only, no connection allowed
@ PRESSFIT
a PTH with a hole diameter with tight tolerances for press fit pin
@ CASTELLATED
a pad with a castellated through hole
BARCODE class definition.
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
std::vector< char > decompressedData
std::string compressedEncodedData
Container to hold information pertinent to a layer of a BOARD.
static LAYER_T ParseType(const char *aType)
Convert a string to a LAYER_T.
static const char * ShowType(LAYER_T aType)
Convert a LAYER_T enum to a string representation of the layer type.
Holds length measurement result details and statistics.
Struct to control which optimisations the length calculation code runs on the given path objects.
thread_pool & GetKiCadThreadPool()
Get a reference to the current thread pool.
BS::priority_thread_pool thread_pool
wxLogTrace helper definitions.
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_BARCODE_T
class PCB_BARCODE, a barcode (graphic item)
@ 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_POINT_T
class PCB_POINT, a 0-dimensional point
@ 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.