26#include <unordered_map>
29#include <wx/filename.h>
57#include <api/board/board_rules.pb.h>
136 else if( layer >=
User_1 && layer & 1 )
149 int infinity = ( std::numeric_limits<int>::max() / 2 ) -
pcbIUScale.mmToIU( 1 );
194 switch( aItem->
Type() )
209 std::vector<const PCB_DRILL_MAP*> maps;
242 std::vector<std::pair<VECTOR2I, int>> placements;
277 std::shared_ptr<DRILL_SYMBOL_CACHE> rebuilt = std::make_shared<DRILL_SYMBOL_CACHE>();
283 rebuilt->m_Totals = totalsModel.
Totals();
285 for(
const auto& [itemId, entries] : rebuilt->m_ByItem )
288 rebuilt->m_HoleExtent.Merge( entry.m_Position );
292 rebuilt->m_Profile = profileKey;
309 BOX2I symbolBox = aBoundingBox;
310 symbolBox.
Move( offset );
312 result.Merge( symbolBox );
345 std::sort( ownedItems.begin(), ownedItems.end() );
346 ownedItems.erase( std::unique( ownedItems.begin(), ownedItems.end() ), ownedItems.end() );
389 if( aProject && !aReferenceOnly )
406 std::shared_ptr<NET_SETTINGS>& projectSettings =
project.NetSettings();
408 projectSettings->SetDefaultNetclass( legacySettings->GetDefaultNetclass() );
409 projectSettings->SetNetclasses( legacySettings->GetNetclasses() );
410 projectSettings->SetNetclassPatternAssignments(
411 std::move( legacySettings->GetNetclassPatternAssignments() ) );
440 return wxEmptyString;
444 return m_project->AbsolutePath( fn.GetFullName() );
450 std::unique_lock<std::shared_mutex> writeLock(
m_CachesMutex );
517 std::shared_lock<std::shared_mutex> readLock(
m_CachesMutex );
527 auto index = std::make_shared<FOOTPRINT_COURTYARD_INDEX>(
this );
529 std::unique_lock<std::shared_mutex> writeLock(
m_CachesMutex );
540 std::set<std::pair<KIID, KIID>> m_ratsnestExclusions;
546 const std::shared_ptr<RC_ITEM>& rcItem = marker->GetRCItem();
547 m_ratsnestExclusions.emplace( rcItem->GetMainItemID(), rcItem->GetAuxItemID() );
548 m_ratsnestExclusions.emplace( rcItem->GetAuxItemID(), rcItem->GetMainItemID() );
561 aEdge.
SetVisible( m_ratsnestExclusions.count( ids ) == 0 );
577 if( !marker->GetRCItem() )
580 if( marker->IsExcluded() )
588 if( projectFile->m_BoardSettings )
589 projectFile->m_BoardSettings->m_DrcExclusions =
m_designSettings->m_DrcExclusions;
597 std::set<DRC_EXCLUSION, DRC_EXCLUSION_COMPARE> exclusions =
m_designSettings->m_DrcExclusions;
604 if(
auto it = exclusions.find( lookup ); it != exclusions.end() )
606 marker->SetExcluded(
true, it->GetComment() );
611 std::vector<PCB_MARKER*> newMarkers;
627 for(
const KIID& uuid : ids )
639 marker->
SetExcluded(
true, exclusion.GetComment() );
640 newMarkers.push_back( marker );
652 auto add = [&](
const wxString& aVar )
655 aVars->push_back( aVar );
658 add( wxT(
"LAYER" ) );
659 add( wxT(
"FILENAME" ) );
660 add( wxT(
"FILEPATH" ) );
661 add( wxT(
"PROJECTNAME" ) );
662 add( wxT(
"DRC_ERROR <message_text>" ) );
663 add( wxT(
"DRC_WARNING <message_text>" ) );
664 add( wxT(
"VARIANT" ) );
665 add( wxT(
"VARIANT_DESC" ) );
666 add( wxT(
"DRILL_OPERATIONS" ) );
667 add( wxT(
"DRILL_SITES" ) );
668 add( wxT(
"DRILL_GROUPS" ) );
674 for( std::pair<wxString, wxString> entry :
GetProject()->GetTextVars() )
688 if( token->Contains(
':' ) )
691 wxString ref = token->BeforeFirst(
':', &remainder );
698 if( refFP->
ResolveTextVar( &remainder, aVariantName, aDepth + 1 ) )
699 *token = std::move( remainder );
701 *token = wxString::Format( wxT(
"<Unresolved: %s:%s>" ), refFP->
GetReference(), remainder );
712 if( footprint->GetReference().CmpNoCase( ref ) == 0 )
714 if( footprint->ResolveTextVar( &remainder, aVariantName, aDepth + 1 ) )
715 *token = std::move( remainder );
717 *token = wxString::Format( wxT(
"<Unresolved: %s:%s>" ), ref, remainder );
726 *token = wxString::Format( wxT(
"<Unresolved: %s:%s>" ), ref, remainder );
731 if( token->IsSameAs( wxT(
"FILENAME" ) ) )
734 *token = fn.GetFullName();
737 else if( token->IsSameAs( wxT(
"FILEPATH" ) ) )
740 *token = fn.GetFullPath();
743 else if( token->IsSameAs( wxT(
"VARIANT" ) ) )
745 *token = aVariantName;
748 else if( token->IsSameAs( wxT(
"VARIANT_DESC" ) ) )
753 else if( token->IsSameAs( wxT(
"PROJECTNAME" ) ) &&
GetProject() )
758 else if( token->IsSameAs( wxT(
"DRILL_OPERATIONS" ) )
759 || token->IsSameAs( wxT(
"DRILL_SITES" ) )
760 || token->IsSameAs( wxT(
"DRILL_GROUPS" ) ) )
766 if( token->IsSameAs( wxT(
"DRILL_OPERATIONS" ) ) )
767 *token = wxString::Format( wxT(
"%d" ), totals.
m_Operations );
768 else if( token->IsSameAs( wxT(
"DRILL_SITES" ) ) )
769 *token = wxString::Format( wxT(
"%d" ), totals.
m_Sites );
771 *token = wxString::Format( wxT(
"%d" ), totals.
m_Groups );
776 wxString var = *token;
812 wxLogWarning( wxT(
"This should not be called on the BOARD object" ) );
827 board_item->
Move( aMoveVector );
854 aFunction( constraint );
861 aFunction( footprint );
869 aFunction( drawing );
875 catch( std::bad_function_call& )
877 wxFAIL_MSG( wxT(
"Error running BOARD::RunOnChildren" ) );
915 for(
auto& [layer_id, layer] :
m_layers )
917 if( layer.m_name == aLayerName || layer.m_userName == aLayerName )
942 if( it !=
m_layers.end() && !it->second.m_userName.IsEmpty() )
943 return it->second.m_userName;
952 if( aLayerName.IsEmpty() )
955 m_layers[aLayer].m_userName.clear();
961 if( aLayerName.Find( wxChar(
'"' ) ) != wxNOT_FOUND )
966 m_layers[aLayer].m_userName = aLayerName;
998 return it->second.m_type;
1014 m_layers[aLayer].m_type = aLayerType;
1032 case LT_AUX:
return "auxiliary";
1041 if( strcmp( aType,
"signal" ) == 0 )
1043 else if( strcmp( aType,
"power" ) == 0 )
1045 else if( strcmp( aType,
"mixed" ) == 0 )
1047 else if( strcmp( aType,
"jumper" ) == 0 )
1049 else if( strcmp( aType,
"auxiliary" ) == 0 )
1051 else if( strcmp( aType,
"front" ) == 0 )
1053 else if( strcmp( aType,
"back" ) == 0 )
1068 if(
m_layers[layer].m_opposite != layer )
1074 wxString principalName =
m_layers[layer].m_userName.AfterFirst(
'.' );
1078 if(
m_layers[ii].m_opposite != ii )
1087 wxString candidate =
m_layers[ii].m_userName.AfterFirst(
'.' );
1089 if( !candidate.IsEmpty() && candidate == principalName )
1101 int next = layer + 2;
1210 m_project->GetLocalSettings().m_VisibleLayers = aLayerSet;
1219 for(
size_t i = 0; i < aSet.size(); i++ )
1260 track->SetLocalRatsnestVisible( isEnabled );
1264 for(
PAD*
pad : footprint->Pads() )
1265 pad->SetLocalRatsnestVisible( isEnabled );
1269 zone->SetLocalRatsnestVisible( isEnabled );
1285 default: wxFAIL_MSG( wxT(
"BOARD::IsModuleLayerVisible(): bad layer" ) );
return true;
1304 std::unique_lock<std::shared_mutex> writeLock(
m_CachesMutex );
1329 std::unique_lock<std::shared_mutex> writeLock(
m_CachesMutex );
1334 worstClearance = std::max( worstClearance, zone->GetLocalClearance().value() );
1338 for(
PAD*
pad : footprint->Pads() )
1340 std::optional<int>
override =
pad->GetClearanceOverrides(
nullptr );
1342 if(
override.has_value() )
1343 worstClearance = std::max( worstClearance,
override.value() );
1346 for(
ZONE* zone : footprint->Zones() )
1347 worstClearance = std::max( worstClearance, zone->GetLocalClearance().value() );
1359 std::vector<ZONE*> zones = aZones;
1368 aReporter->
Report(
_(
"Tessellating copper zones..." ) );
1373 [&
tp]( std::function<void()> aTask )
1375 tp.detach_task( std::move( aTask ) );
1379 std::vector<std::pair<ZONE*, PCB_LAYER_ID>> work;
1381 for(
ZONE* zone : zones )
1385 work.emplace_back( zone, layer );
1388 std::vector<std::future<size_t>> returns;
1390 returns.reserve( work.size() );
1392 for(
const std::pair<ZONE*, PCB_LAYER_ID>& item : work )
1394 ZONE* zone = item.first;
1397 returns.emplace_back(
tp.submit_task(
1398 [aReporter, &submitter, zone, layer]() ->
size_t
1400 if( aReporter && aReporter->IsCancelled() )
1403 zone->CacheTriangulation( layer, submitter );
1410 for(
const std::future<size_t>& ret : returns )
1412 std::future_status status = ret.wait_for( std::chrono::milliseconds( 250 ) );
1414 while( status != std::future_status::ready )
1419 status = ret.wait_for( std::chrono::milliseconds( 250 ) );
1424 for(
ZONE* zone : zones )
1429 zone->CacheOutlineTriangulation();
1440 aFunction( footprint->GetEmbeddedFiles() );
1457 embeddedFile->data_hash = file->
data_hash;
1458 embeddedFile->is_valid = file->
is_valid;
1468 [&](
const wxString& aName )
1472 if( zone != aExclude && zone->
GetZoneName() == aName )
1485 if( aBaseName.IsEmpty() || !aInUse( aBaseName ) )
1490 wxString root = aBaseName;
1492 if( aBaseName.Find(
'_' ) != wxNOT_FOUND )
1494 wxString suffix = aBaseName.AfterLast(
'_' );
1495 bool allDigits = !suffix.IsEmpty();
1497 for( wxUniChar ch : suffix )
1499 if( !wxIsdigit( ch ) )
1507 root = aBaseName.BeforeLast(
'_' );
1510 for(
int i = 1;; ++i )
1512 wxString candidate = wxString::Format( wxT(
"%s_%d" ), root, i );
1514 if( !aInUse( candidate ) )
1522 if( aBoardItem ==
nullptr )
1524 wxFAIL_MSG( wxT(
"BOARD::Add() param error: aBoardItem nullptr" ) );
1528 switch( aBoardItem->
Type() )
1572 wxFAIL_MSG( wxString::Format(
"BOARD::Add() Cannot place Track on non-copper layer: %d = %s",
1573 static_cast<int>( aBoardItem->
GetLayer() ),
1630 wxFAIL_MSG( wxString::Format( wxT(
"BOARD::Add() item type %s not handled" ), aBoardItem->
GetClass() ) );
1644 if( !aSkipConnectivity )
1674 for(
int ii = (
int)
m_zones.size() - 1; ii >= 0; --ii )
1694 wxASSERT( aBoardItem );
1699 parentGroup && !( parentGroup->AsEdaItem()->GetFlags() &
STRUCT_DELETED ) )
1701 parentGroup->RemoveItem( aBoardItem );
1706 switch( aBoardItem->
Type() )
1715 if( boardItem->GetNet() == netItem )
1716 boardItem->SetNet( unconnected );
1728 std::erase(
m_groups, aBoardItem );
1736 std::erase(
m_zones, aBoardItem );
1740 std::erase(
m_points, aBoardItem );
1756 std::erase(
m_tracks, aBoardItem );
1788 wxFAIL_MSG( wxString::Format( wxT(
"BOARD::Remove() item type %s not handled" ), aBoardItem->
GetClass() ) );
1807 std::vector<BOARD_ITEM*> removed;
1808 std::vector<NETINFO_ITEM*> removedNets;
1810 for(
const KICAD_T& type : aTypes )
1817 removed.emplace_back( item );
1818 removedNets.emplace_back( item );
1832 std::copy(
m_groups.begin(),
m_groups.end(), std::back_inserter( removed ) );
1842 std::copy(
m_points.begin(),
m_points.end(), std::back_inserter( removed ) );
1847 std::copy(
m_zones.begin(),
m_zones.end(), std::back_inserter( removed ) );
1862 std::copy(
m_tracks.begin(),
m_tracks.end(), std::back_inserter( removed ) );
1868 wxFAIL_MSG( wxT(
"Use PCB_TRACE_T to remove all tracks, arcs, and vias" ) );
1890 wxFAIL_MSG( wxT(
"Use PCB_SHAPE_T to remove all graphics and text" ) );
1894 wxFAIL_MSG( wxT(
"BOARD::RemoveAll() needs more ::Type() support" ) );
1923 for(
int i = 0; i < collector.
GetCount(); i++ )
1943 via->LayerPair( &top_layer, &bottom_layer );
1945 if( top_layer != aLayer && bottom_layer != aLayer )
1960 bool modified =
false;
1961 bool removedItemLayers =
false;
1967 for(
int i = 0; i < collector.
GetCount(); i++ )
1988 removedItemLayers =
true;
1991 else if(
via->IsOnLayer( aLayer ) )
1995 via->LayerPair( &top_layer, &bottom_layer );
1997 if( top_layer == aLayer || bottom_layer == aLayer )
2007 removedItemLayers =
true;
2014 layers.
reset( aLayer );
2027 removedItemLayers =
true;
2031 if( removedItemLayers )
2040 return wxString::Format(
_(
"PCB" ) );
2055 aView->
Update( dimension );
2061 aItem->
Visit( inspector,
nullptr,
2082 std::vector<PCB_MARKER*> remaining;
2094 remaining.push_back( marker );
2105 std::vector<FOOTPRINT*> footprints;
2110 for(
FOOTPRINT* footprint : footprints )
2117 std::vector<FOOTPRINT*> footprints;
2122 for(
FOOTPRINT* footprint : footprints )
2123 footprint->SetParent(
nullptr );
2134 if( cell->m_Uuid == aID )
2152 const auto cacheAndReturn =
2155 wxASSERT_MSG( aItem.m_Uuid == aID,
2156 wxT(
"BOARD::ResolveItem() must only return an item that carries the requested UUID" ) );
2166 if(
group->m_Uuid == aID )
2167 return cacheAndReturn( *
group );
2172 if( constraint->m_Uuid == aID )
2173 return cacheAndReturn( *constraint );
2178 if( generator->m_Uuid == aID )
2179 return cacheAndReturn( *generator );
2184 if( track->m_Uuid == aID )
2185 return cacheAndReturn( *track );
2190 if( footprint->m_Uuid == aID )
2191 return cacheAndReturn( *footprint );
2193 for(
PAD*
pad : footprint->Pads() )
2195 if(
pad->m_Uuid == aID )
2196 return cacheAndReturn( *
pad );
2199 for(
PCB_FIELD* field : footprint->GetFields() )
2201 wxCHECK2( field,
continue );
2203 if( field && field->m_Uuid == aID )
2204 return cacheAndReturn( *field );
2207 for(
BOARD_ITEM* drawing : footprint->GraphicalItems() )
2210 return cacheAndReturn( *cell );
2212 if( drawing->m_Uuid == aID )
2213 return cacheAndReturn( *drawing );
2218 if( zone->m_Uuid == aID )
2219 return cacheAndReturn( *zone );
2224 if(
group->m_Uuid == aID )
2225 return cacheAndReturn( *
group );
2230 if( constraint->m_Uuid == aID )
2231 return cacheAndReturn( *constraint );
2234 for(
PCB_POINT* point : footprint->Points() )
2236 if( point->m_Uuid == aID )
2237 return cacheAndReturn( *point );
2242 if( body->m_Uuid == aID )
2243 return cacheAndReturn( *body );
2249 if( zone->m_Uuid == aID )
2250 return cacheAndReturn( *zone );
2256 return cacheAndReturn( *cell );
2258 if( drawing->m_Uuid == aID )
2259 return cacheAndReturn( *drawing );
2264 if( marker->m_Uuid == aID )
2265 return cacheAndReturn( *marker );
2270 if( point->m_Uuid == aID )
2271 return cacheAndReturn( *point );
2276 if( netInfo->m_Uuid == aID )
2277 return cacheAndReturn( *netInfo );
2281 return const_cast<BOARD*
>( this );
2284 if( aAllowNullptrReturn )
2300 wxCHECK2( aItem,
return );
2302 if( ids.count( aItem->m_Uuid ) )
2308 ids.insert( aItem->m_Uuid );
2314 processItem( footprint );
2320 for(
PAD*
pad : footprint->Pads() )
2325 processItem( track );
2330 processItem( &footprint->Reference() );
2331 processItem( &footprint->Value() );
2333 for(
BOARD_ITEM* item : footprint->GraphicalItems() )
2334 processItem( item );
2337 processItem( body );
2339 for(
ZONE* zone : footprint->Zones() )
2340 processItem( zone );
2343 processItem(
group );
2350 switch( item->Type() )
2359 processItem( item );
2371 size_t sourceLen = aSource.length();
2373 for(
size_t i = 0; i < sourceLen; ++i )
2377 if( aSource[i] ==
'\\' && i + 2 < sourceLen && aSource[i + 2] ==
'{' &&
2378 ( aSource[i + 1] ==
'$' || aSource[i + 1] ==
'@' ) )
2381 newbuf.append( aSource[i] );
2382 newbuf.append( aSource[i + 1] );
2383 newbuf.append( aSource[i + 2] );
2388 for( i = i + 1; i < sourceLen && braceDepth > 0; ++i )
2390 if( aSource[i] ==
'{' )
2392 else if( aSource[i] ==
'}' )
2395 newbuf.append( aSource[i] );
2401 if( aSource[i] ==
'$' && i + 1 < sourceLen && aSource[i + 1] ==
'{' )
2404 bool isCrossRef =
false;
2406 for( i = i + 2; i < sourceLen; ++i )
2408 if( aSource[i] ==
'}' )
2411 if( aSource[i] ==
':' )
2414 token.append( aSource[i] );
2420 wxString ref = token.BeforeFirst(
':', &remainder );
2424 if( footprint->GetReference().CmpNoCase( ref ) == 0 )
2426 wxString
test( remainder );
2428 if( footprint->ResolveTextVar( &
test ) )
2429 token = footprint->m_Uuid.AsString() + wxT(
":" ) + remainder;
2436 newbuf.append( wxT(
"${" ) + token + wxT(
"}" ) );
2440 newbuf.append( aSource[i] );
2451 size_t sourceLen = aSource.length();
2453 for(
size_t i = 0; i < sourceLen; ++i )
2457 if( aSource[i] ==
'\\' && i + 2 < sourceLen && aSource[i + 2] ==
'{' &&
2458 ( aSource[i + 1] ==
'$' || aSource[i + 1] ==
'@' ) )
2461 newbuf.append( aSource[i] );
2462 newbuf.append( aSource[i + 1] );
2463 newbuf.append( aSource[i + 2] );
2468 for( i = i + 1; i < sourceLen && braceDepth > 0; ++i )
2470 if( aSource[i] ==
'{' )
2472 else if( aSource[i] ==
'}' )
2475 newbuf.append( aSource[i] );
2481 if( aSource[i] ==
'$' && i + 1 < sourceLen && aSource[i + 1] ==
'{' )
2484 bool isCrossRef =
false;
2486 for( i = i + 2; i < sourceLen; ++i )
2488 if( aSource[i] ==
'}' )
2491 if( aSource[i] ==
':' )
2494 token.append( aSource[i] );
2500 wxString ref = token.BeforeFirst(
':', &remainder );
2505 token =
static_cast<FOOTPRINT*
>( refItem )->GetReference() + wxT(
":" ) + remainder;
2509 newbuf.append( wxT(
"${" ) + token + wxT(
"}" ) );
2513 newbuf.append( aSource[i] );
2523 unsigned retval = 0;
2527 for(
PAD*
pad : footprint->Pads() )
2529 if( ( aNet == -1 &&
pad->GetNetCode() > 0 ) || aNet ==
pad->GetNetCode() )
2543 if( aPhysicalLayersOnly )
2551 if( aBoardEdgesOnly )
2560 if( ( item->GetLayerSet() & visible ).any() )
2561 bbox.
Merge( item->GetBoundingBox() );
2567 if( aBoardEdgesOnly )
2569 for(
const BOARD_ITEM* edge : footprint->GraphicalItems() )
2572 bbox.
Merge( edge->GetBoundingBox() );
2575 else if( ( footprint->GetLayerSet() & visible ).any() )
2577 bbox.
Merge( footprint->GetBoundingBox(
true ) );
2581 if( !aBoardEdgesOnly )
2586 if( ( track->GetLayerSet() & visible ).any() )
2587 bbox.
Merge( track->GetBoundingBox() );
2593 if( ( aZone->GetLayerSet() & visible ).any() )
2594 bbox.
Merge( aZone->GetBoundingBox() );
2599 bbox.
Merge( point->GetBoundingBox() );
2611 int trackSegmentCount = 0;
2612 std::set<int> netCodes;
2620 trackSegmentCount++;
2622 if( item->GetNetCode() > 0 )
2623 netCodes.insert( item->GetNetCode() );
2628 for(
PAD*
pad : footprint->Pads() )
2632 if(
pad->GetNetCode() > 0 )
2633 netCodes.insert(
pad->GetNetCode() );
2637 aList.emplace_back(
_(
"Pads" ), wxString::Format( wxT(
"%d" ), padCount ) );
2638 aList.emplace_back(
_(
"Vias" ), wxString::Format( wxT(
"%d" ), viaCount ) );
2639 aList.emplace_back(
_(
"Track Segments" ), wxString::Format( wxT(
"%d" ), trackSegmentCount ) );
2640 aList.emplace_back(
_(
"Nets" ), wxString::Format( wxT(
"%d" ), (
int) netCodes.size() ) );
2641 aList.emplace_back(
_(
"Unrouted" ), wxString::Format( wxT(
"%d" ), unconnected ) );
2647#if 0 && defined( DEBUG )
2648 std::cout <<
GetClass().mb_str() <<
' ';
2651 bool footprintsScanned =
false;
2652 bool drawingsScanned =
false;
2653 bool tracksScanned =
false;
2655 for(
KICAD_T scanType : scanTypes )
2690 if( !footprintsScanned )
2695 footprintsScanned =
true;
2698 if( !drawingsScanned )
2703 drawingsScanned =
true;
2711 if( !tracksScanned )
2716 tracksScanned =
true;
2740 if( !footprintsScanned )
2745 footprintsScanned =
true;
2757 if( !footprintsScanned )
2762 footprintsScanned =
true;
2806 return m_NetInfo.GetNetItem( aNetcode );
2812 return m_NetInfo.GetNetItem( aNetname );
2821 for(
auto it = aNetName.rbegin(); it != aNetName.rend() && rv == 0; ++it, ++count )
2825 if( ( ch >=
'0' && ch <=
'9' ) || ch ==
'_' )
2829 else if( ch ==
'+' )
2831 aComplementNet = wxT(
"-" );
2834 else if( ch ==
'-' )
2836 aComplementNet = wxT(
"+" );
2839 else if( ch ==
'N' )
2841 aComplementNet = wxT(
"P" );
2844 else if( ch ==
'P' )
2846 aComplementNet = wxT(
"N" );
2855 if( rv != 0 && count >= 1 )
2857 aComplementNet = aNetName.Left( aNetName.length() - count ) + aComplementNet + aNetName.Right( count - 1 );
2869 wxString coupledNetName;
2872 return FindNet( coupledNetName );
2883 if( aReference == footprint->GetReference() )
2895 if( footprint->GetPath() == aPath )
2907 if(
PAD*
pad = footprint->FindPadByUuid( aUuid ) )
2921 if( net->GetNetChain() == aNetChain )
2923 for(
int i = 0; i < 2; ++i )
2925 PAD*
pad = net->GetTerminalPad( i );
2927 if(
pad &&
pad->m_Uuid == aPrev )
2928 net->SetTerminalPad( i, newPad );
2937 std::set<wxString> names;
2941 if( !net->GetNetname().IsEmpty() )
2942 names.insert( net->GetNetname() );
2957 const wxString& aVariantName )
2959 for(
const wxString&
name : aNames )
2961 if(
name.CmpNoCase( aVariantName ) == 0 )
2965 return wxEmptyString;
2981 if( actualName.IsEmpty() )
3003 if( aVariantName.IsEmpty()
3020 [&](
const wxString&
name )
3022 return name.CmpNoCase( aVariantName ) == 0;
3027 wxString actualName = *it;
3037 fp->DeleteVariant( actualName );
3048 [&](
const wxString&
name )
3050 return name.CmpNoCase( aOldName ) == 0;
3055 wxString actualOldName = *it;
3060 if( !existingName.IsEmpty() && existingName.CmpNoCase( actualOldName ) != 0 )
3063 if( actualOldName == aNewName )
3073 if( !descIt->second.IsEmpty() )
3085 fp->RenameVariant( actualOldName, aNewName );
3090void BOARD::CopyVariant(
const wxString& aOldName,
const wxString& aNewName,
const wxString& aNewDescription )
3092 if( aOldName.IsEmpty() || aNewName.IsEmpty()
3100 if( actualOldName.IsEmpty() )
3108 if( !aNewDescription.IsEmpty() )
3118 copied.SetName( aNewName );
3119 fp->SetVariant(
copied );
3128 return wxEmptyString;
3132 if( actualName.IsEmpty() )
3133 return wxEmptyString;
3140 return wxEmptyString;
3151 if( actualName.IsEmpty() )
3154 if( aDescription.IsEmpty() )
3163 wxArrayString names;
3191 const std::map<wxString, wxString>& chainNetclasses = netSettings->GetNetChainNetClasses();
3195 if( chainNetclasses.empty()
3205 const wxString& chainName = net->GetNetChain();
3207 if( chainName.IsEmpty() )
3210 auto it = chainNetclasses.find( chainName );
3212 if( it == chainNetclasses.end() || !netSettings->HasNetclass( it->second ) )
3236 if( aResetTrackAndViaSizes )
3245 if( defaultNetClass->HasDiffPairWidth() )
3250 if( defaultNetClass->HasDiffPairGap() )
3255 if( defaultNetClass->HasDiffPairViaGap() )
3277 int error_count = 0;
3281 if( !zone->IsOnCopperLayer() )
3287 if( zone->GetNetCode() != 0 )
3300 zone->SetNetCode( -1 );
3315 if( footprint->HitTest( aPosition ) )
3316 pad = footprint->GetPad( aPosition, aLayerSet.any() ? aLayerSet :
LSET::AllCuMask() );
3332 return GetPad( aPosition, lset );
3340 int idxmax = aPadList.size() - 1;
3342 int delta = aPadList.size();
3355 PAD*
pad = aPadList[idx];
3357 if(
pad->GetPosition() == aPosition )
3360 if( ( aLayerSet &
pad->GetLayerSet() ).any() )
3367 for(
int ii = idx + 1; ii <= idxmax; ii++ )
3371 if(
pad->GetPosition() != aPosition )
3374 if( ( aLayerSet &
pad->GetLayerSet() ).any() )
3378 for(
int ii = idx - 1; ii >= 0; ii-- )
3382 if(
pad->GetPosition() != aPosition )
3385 if( ( aLayerSet &
pad->GetLayerSet() ).any() )
3393 if(
pad->GetPosition().x == aPosition.
x )
3395 if(
pad->GetPosition().y < aPosition.
y )
3410 else if(
pad->GetPosition().x < aPosition.
x )
3448 for(
PAD*
pad : footprint->Pads() )
3450 if( aNetCode < 0 || pad->GetNetCode() == aNetCode )
3451 aVector.push_back(
pad );
3473 std::vector<LENGTH_DELAY_CALCULATION_ITEM> items;
3479 if( item.
Type() != LENGTH_DELAY_CALCULATION_ITEM::TYPE::UNKNOWN )
3480 items.push_back( std::move( item ) );
3484 .OptimiseVias =
true, .MergeTracks =
true, .OptimiseTracesInPads =
true, .InferViaInPad =
false
3496 bool aIgnoreLocked )
const
3500 int min_dim = 0x7FFFFFFF;
3501 int alt_min_dim = 0x7FFFFFFF;
3502 bool current_layer_back =
IsBackLayer( aActiveLayer );
3507 if( !candidate->HitTest( aPosition ) )
3511 if( aIgnoreLocked && candidate->IsLocked() )
3519 BOX2I bb = candidate->GetBoundingBox(
false );
3526 ( aPosition.
x - offx ) * ( aPosition.
x - offx ) + ( aPosition.
y - offy ) * ( aPosition.
y - offy );
3530 if( dist <= min_dim )
3533 footprint = candidate;
3539 if( dist <= alt_min_dim )
3542 alt_footprint = candidate;
3553 return alt_footprint;
3561 std::list<ZONE*> zones;
3564 zones.push_back( zone );
3566 if( aIncludeZonesInFootprints )
3570 for(
ZONE* zone : footprint->Zones() )
3571 zones.push_back( zone );
3587 m_zones.push_back( new_area );
3606 bool aIncludeNPTHAsOutlines )
3612 aInferOutlineIfNecessary, aErrorHandler, aAllowUseArcsInPolygons );
3615 if( aIncludeNPTHAsOutlines )
3619 for(
PAD*
pad : fp->Pads() )
3648 simplified.
Append( island );
3651 aOutlines = std::move( simplified );
3684 std::set<KIFONT::OUTLINE_FONT*>
fonts;
3697 if( permission == PERMISSION::EDITABLE || permission == PERMISSION::INSTALLABLE )
3698 fonts.insert( outlineFont );
3715 wxLogTrace(
"EMBED",
"Failed to add font file: %s", font->GetFileName() );
3726 std::vector<PAD*> allPads;
3730 for(
PAD*
pad : footprint->Pads() )
3731 allPads.push_back(
pad );
3740 std::vector<BOARD_CONNECTED_ITEM*> items;
3743 items.push_back( track );
3747 for(
PAD*
pad : footprint->Pads() )
3748 items.push_back(
pad );
3750 for(
ZONE* zone : footprint->Zones() )
3751 items.push_back( zone );
3753 for(
BOARD_ITEM* dwg : footprint->GraphicalItems() )
3756 items.push_back( bci );
3761 items.push_back( zone );
3766 items.push_back( bci );
3780 item->SetNet( netInfo );
3784 aDestBoard->
Add( newNet );
3785 item->SetNet( newNet );
3795 if(
FindNet( item->GetNetCode() ) ==
nullptr )
3803 if( aZones.empty() )
3807 generator->OnZoneFillChanged( aZones );
3860 std::vector<BOARD_ITEM*>& aChangedItems )
3895 bool already =
m_highLight.m_netCodes.count( aNetCode );
3926 return wxEmptyString;
3945 std::unordered_set<EDA_GROUP*> knownCycleFreeGroups;
3947 std::unordered_set<EDA_GROUP*> currentChainGroups;
3949 std::unordered_set<EDA_GROUP*> toCheckGroups;
3953 toCheckGroups.insert(
group );
3956 toCheckGroups.insert( gen );
3958 while( !toCheckGroups.empty() )
3960 currentChainGroups.clear();
3965 if( currentChainGroups.find(
group ) != currentChainGroups.end() )
3970 return "Cycle detected in group membership";
3972 else if( knownCycleFreeGroups.find(
group ) != knownCycleFreeGroups.end() )
3978 currentChainGroups.insert(
group );
3980 toCheckGroups.erase(
group );
3982 group =
group->AsEdaItem()->GetParentGroup();
3993 knownCycleFreeGroups.insert( currentChainGroups.begin(), currentChainGroups.end() );
4024 if( aFirst->
Type() != aSecond->
Type() )
4025 return aFirst->
Type() < aSecond->
Type();
4040 cmp = shape->
Compare( other );
4047 cmp =
text->Compare( other );
4054 cmp = textbox->PCB_SHAPE::Compare( other );
4057 cmp = textbox->EDA_TEXT::Compare( other );
4080 return aFirst < aSecond;
4092 if( !track->IsOnLayer( aLayer ) )
4095 track->TransformShapeToPolygon( aOutlines, aLayer, 0, maxError,
ERROR_INSIDE );
4101 footprint->TransformPadsToPolySet( aOutlines, aLayer, 0, maxError,
ERROR_INSIDE );
4103 footprint->TransformFPShapesToPolySet( aOutlines, aLayer, 0, maxError,
ERROR_INSIDE,
true,
4107 for(
const ZONE* zone : footprint->Zones() )
4109 if( zone->GetLayerSet().test( aLayer ) )
4110 zone->TransformSolidAreasShapesToPolygon( aLayer, aOutlines );
4117 if( zone->GetLayerSet().test( aLayer ) )
4118 zone->TransformSolidAreasShapesToPolygon( aLayer, aOutlines );
4124 if( !item->IsOnLayer( aLayer ) )
4127 switch( item->Type() )
4155 textbox->PCB_SHAPE::TransformShapeToPolygon( aOutlines, aLayer, 0, maxError,
ERROR_INSIDE );
4165 table->TransformGraphicItemsToPolySet( aOutlines, maxError,
ERROR_INSIDE, aRenderSettings );
4194 std::vector<BOARD_ITEM*> items;
4236 const BOARD& other =
static_cast<const BOARD&
>( aItem );
4247 for(
auto it1 = thisNetNames.begin(), it2 = otherNetNames.begin();
4248 it1 != thisNetNames.end() && it2 != otherNetNames.end(); ++it1, ++it2 )
4252 if( it1->first != it2->first )
4287 wxArrayString ourVars;
4288 m_titles.GetContextualTextVars( &ourVars );
4290 wxArrayString otherVars;
4293 if( ourVars != otherVars )
4318 for(
PAD*
pad : footprint->Pads() )
4336 for(
PAD*
pad : footprint->Pads() )
4357 wxString projPath =
project->GetProjectPath();
4359 if( projPath.IsEmpty() )
4363 if( !projPath.IsSameAs( aProjectPath ) )
4365 wxLogTrace(
traceAutoSave, wxS(
"[history] pcb saver skipping - project path mismatch: %s vs %s" ), projPath,
4372 if( boardPath.IsEmpty() )
4376 if( !boardPath.StartsWith( projPath ) )
4378 wxLogTrace(
traceAutoSave, wxS(
"[history] pcb saver skipping - board not under project: %s" ), boardPath );
4382 wxString rel = boardPath.Mid( projPath.length() );
4397 entry.
formatMode = KICAD_FORMAT::FORMAT_MODE::COMPACT_TEXT_PROPERTIES;
4399 aFileData.push_back( std::move( entry ) );
4401 wxLogTrace(
traceAutoSave, wxS(
"[history] pcb saver serialized %zu bytes for '%s'" ),
4402 aFileData.back().content.size(), rel );
4406 wxLogTrace(
traceAutoSave, wxS(
"[history] pcb saver serialize failed: %s" ), wxString::FromUTF8( ioe.
What() ) );
constexpr EDA_IU_SCALE pcbIUScale
static PCB_TABLECELL * findTableCell(const BOARD_ITEM *aDrawing, const KIID &aID)
static bool affectsDrillModel(const BOARD_ITEM *aItem)
bool sortPadsByXthenYCoord(PAD *const &aLH, PAD *const &aRH)
Used by BOARD::GetSortedPadListByXthenYCoord to sort a pad list by X coordinate value.
static wxString FindVariantNameCaseInsensitive(const std::vector< wxString > &aNames, const wxString &aVariantName)
#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.
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
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,...
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
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.
int GetCustomDiffPairGap()
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.
DRILL_SYMBOL_PROFILE & GetDrillSymbolProfile()
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)
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
BOARD_ITEM(BOARD_ITEM *aParent, KICAD_T idtype, PCB_LAYER_ID aLayer=F_Cu)
virtual void SetLayerSet(const LSET &aLayers)
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
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 OnBoardRatsnestChanged(BOARD &aBoard)
virtual void OnBoardItemsAdded(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItems)
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 * > &aBoardItems)
virtual void OnBoardCompositeUpdate(BOARD &aBoard, std::vector< BOARD_ITEM * > &aAddedItems, std::vector< BOARD_ITEM * > &aRemovedItems, std::vector< BOARD_ITEM * > &aChangedItems)
virtual void OnBoardItemsChanged(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItems)
virtual void OnBoardSelectionChanged(BOARD &aBoard)
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 ApplyNetChainNetclasses()
Expand the project's chain-to-netclass assignments into per-net pattern assignments,...
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::map< ZONE *, std::map< PCB_LAYER_ID, ISOLATED_ISLANDS > > m_ZoneIsolatedIslandsMap
PCB_LAYER_ID GetCopperLayerStackMaxId() const
std::vector< const PCB_DRILL_MAP * > DrillMapsOnLayer(PCB_LAYER_ID aLayer) const
Every map on this layer.
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.
SHARDED_CACHE< PTR_PTR_LAYER_CACHE_KEY, bool > m_IntersectsAreaCache
void CacheChildrenById(const BOARD_ITEM &aParent)
int GetUserDefinedLayerCount() const
void SetPosition(const VECTOR2I &aPos) override
std::map< wxString, wxString > m_properties
SHARDED_CACHE< ITEM_SELECTOR_LAYER_CACHE_KEY, bool > m_IntersectsCourtyardResultCache
EMBEDDED_FILES * GetEmbeddedFiles() override
SHARDED_CACHE< PTR_PTR_LAYER_CACHE_KEY, bool > m_EnclosedByAreaCache
int m_fileFormatVersionAtLoad
NETINFO_ITEM * DpCoupledNet(const NETINFO_ITEM *aNet)
void SetCurrentVariant(const wxString &aVariant)
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 CacheItemById(BOARD_ITEM &aItem) const
Add an item to the item-by-id cache.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
std::shared_ptr< const DRILL_SYMBOL_CACHE > m_drillSymbolCache
SHARDED_CACHE< ITEM_SELECTOR_LAYER_CACHE_KEY, bool > m_EnclosedByAreaResultCache
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
std::vector< wxString > m_variantNames
LENGTH_DELAY_CALCULATION * GetLengthCalculation() const
Returns the track length calculator.
wxArrayString GetVariantNamesForUI() const
Return the variant names for UI display.
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
uint64_t m_drillModelGeneration
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 RefreshDrillSymbolLayers()
void CopyVariant(const wxString &aOldName, const wxString &aNewName, const wxString &aNewDescription=wxEmptyString)
void RemoveAllListeners()
Remove all listeners.
SHARDED_CACHE< PTR_PTR_CACHE_KEY, bool > m_IntersectsBCourtyardCache
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
std::shared_ptr< BOARD_DESIGN_SETTINGS > m_designSettings
All of the board design settings are stored as a JSON object inside the project file.
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.
void CompileRatsnest()
Rebuild the entire board ratsnest.
HIGH_LIGHT_INFO m_highLight
std::map< wxString, wxString > m_variantDescriptions
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.
CONSTRAINTS m_constraints
void UpdateBoardOutline()
const ZONES & Zones() const
void BulkRemoveStaleTeardrops(BOARD_COMMIT &aCommit)
Remove all teardrop zones with the STRUCT_DELETED flag set.
void ClearItemByIdCache()
void DeleteVariant(const wxString &aVariantName)
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.
void InitializeClearanceCache()
Initialize the clearance cache for all board items.
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.
void SaveToHistory(const wxString &aProjectPath, std::vector< HISTORY_FILE_DATA > &aFileData)
Serialize board into HISTORY_FILE_DATA for non-blocking history commit.
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 RebindItemUuid(BOARD_ITEM &aItem, const KIID &aNewId)
Rebind the UUID of an attached item and keep the item-by-id cache coherent.
uint64_t m_boardOutlineGeneration
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.
SHARDED_CACHE< PTR_PTR_CACHE_KEY, bool > m_IntersectsCourtyardCache
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()
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.
void InvalidateClearanceCache(const KIID &aUuid)
Invalidate the clearance cache for a specific item.
PAD * FindPadByUuid(const KIID &aUuid) const
void OnBoardSelectionChanged()
Notify the board and its listeners that the editor selection has changed.
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.
std::shared_ptr< const DRILL_SYMBOL_CACHE > DrillSymbolCache() const
Resolved drill symbols, by group and by owning item.
bool HasVariant(const wxString &aVariantName) const
void AddVariant(const wxString &aVariantName)
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...
SHARDED_CACHE< PTR_PTR_LAYER_CACHE_KEY, bool > m_IntersectsKeepoutCache
void IncrementTimeStamp()
int MatchDpSuffix(const wxString &aNetName, wxString &aComplementNet)
Fetch the coupled netname for a given net.
wxString GetUniqueZoneName(const wxString &aBaseName, const ZONE *aExclude=nullptr) const
Return a name based on aBaseName that is not used by any other zone or rule area on the board.
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()
Collect every owned item (tracks, zones, generators, footprints, drawings, markers,...
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.
BOARD_ITEM_INDEX m_itemIndex
std::unordered_map< wxString, LSET > m_LayerExpressionCache
wxString GroupsSanityCheckInternal(bool repair)
std::shared_ptr< const FOOTPRINT_COURTYARD_INDEX > m_footprintCourtyardIndex
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
SHARDED_CACHE< PTR_PTR_CACHE_KEY, bool > m_IntersectsFCourtyardCache
bool GetBoardPolygonOutlines(SHAPE_POLY_SET &aOutlines, bool aInferOutlineIfNecessary, 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...
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< const ZONE *, SHAPE_POLY_SET > m_DeflatedZoneOutlineCache
std::vector< BOARD_ITEM * > collectOwnedItems() const
Get a simple vector of the board's pointers.
SHARDED_CACHE< ITEM_SELECTOR_LAYER_CACHE_KEY, bool > m_IntersectsFCourtyardResultCache
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()
SHARDED_CACHE< ITEM_SELECTOR_LAYER_CACHE_KEY, bool > m_IntersectsKeepoutResultCache
wxString GetVariantDescription(const wxString &aVariantName) const
FOOTPRINT * FindFootprintByReference(const wxString &aReference) const
Search for a FOOTPRINT within this board with the given reference designator.
unsigned GetNodesCount(int aNet=-1) const
SHARDED_CACHE< ITEM_FIELD_CACHE_KEY, wxString > m_ItemFieldCache
std::map< PCB_LAYER_ID, std::vector< ZONE * > > m_DRCCopperZonesByLayer
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.
std::optional< std::set< const PCB_VIA * > > m_StackedMicroviaCache
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
BOX2I ExpandBoundingBoxForDrillSymbols(const BOX2I &aBoundingBox) const
Include every displaced copy of a hole-owned drill symbol in its view bounds.
void DetachAllFootprints()
Remove all footprints without deleting.
std::map< int, LAYER > m_layers
void noteDrillModelChange(BOARD_ITEM *aItem)
Container-boundary notification, so an item that arrives or leaves without going through a commit sti...
wxString GetCurrentVariant() const
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction, RECURSE_MODE aMode) const override
Invoke a function on all children.
int GetOutlinesChainingEpsilon()
void BumpDrillModelGeneration()
Bumped whenever anything a drill chart or map reports on has moved.
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,...
void OnZonesFilled(const std::vector< ZONE * > &aZones)
Notify the board that the listed zones were just refilled.
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
SHARDED_CACHE< ITEM_SELECTOR_LAYER_CACHE_KEY, bool > m_IntersectsAreaResultCache
void ReplaceNetChainTerminalPad(const wxString &aNetChain, const KIID &aPrev, const KIID &aNew)
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.
wxString m_currentVariant
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 GetDesignRulesPath() const
Return the absolute path to the design rules file for this board.
wxString GroupsSanityCheck(bool repair=false)
Consistency check of internal m_groups structure.
void RenameVariant(const wxString &aOldName, const wxString &aNewName)
std::vector< ZONE * > m_DRCZones
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
void bumpDrillModelFor(const std::vector< BOARD_ITEM * > &aItems)
std::vector< std::pair< VECTOR2I, int > > m_drillSymbolPlacements
Offset and symbol reach of every drill map, so a pad or track ViewBBox() does not walk the drawings l...
void UpdateRatsnestExclusions()
Update the visibility flags on the current unconnected ratsnest lines.
wxString ConvertKIIDsToCrossReferences(const wxString &aSource) const
int RepairDuplicateItemUuids()
Rebind duplicate attached-item UUIDs so each live board item has a unique ID.
void SynchronizeProperties()
Copy the current project's text variables into the boards property cache.
void RemoveListener(BOARD_LISTENER *aListener)
Remove the specified listener.
std::unique_ptr< BOARD_TEXT_VAR_ADAPTER > m_textVarAdapter
std::shared_mutex m_CachesMutex
BOX2I ComputeBoundingBox(bool aBoardEdgesOnly=false, bool aPhysicalLayersOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
std::shared_ptr< const FOOTPRINT_COURTYARD_INDEX > GetFootprintCourtyardIndex()
Return a spatial index of footprint courtyards, building it on first use.
static wxString MakeUniqueZoneName(const wxString &aBaseName, const std::function< bool(const wxString &)> &aInUse)
Return a name based on aBaseName for which aInUse returns false, adding or incrementing a _<number> s...
std::atomic< int > m_timeStamp
std::mutex m_drillSymbolCacheMutex
bool SynchronizeComponentClasses(const std::unordered_set< wxString > &aNewSheetPaths) const
Copy component class / component class generator information from the project settings.
void UncacheChildrenById(const BOARD_ITEM &aParent)
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< wxString, std::vector< ZONE * > > m_ZonesByNameCache
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
BOARD_DESIGN_SETTINGS & GetDesignSettings()
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.
SHARDED_CACHE< ITEM_SELECTOR_LAYER_CACHE_KEY, bool > m_IntersectsBCourtyardResultCache
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
VECTOR2I GetPosition() const override
void SetVariantDescription(const wxString &aVariantName, const wxString &aDescription)
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.
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 BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
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
constexpr void Move(const Vec &aMoveVector)
Move the rectangle by the aMoveVector.
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)
Notify observers that aItem has been removed.
A class to manage Component Classes in a board context.
COMPONENT_CLASS_SETTINGS stores data for component classes, including rules for automatic generation ...
bool GetEnableSheetComponentClasses() const
Gets whether component classes should be generated for components in hierarchical sheets.
const std::vector< COMPONENT_CLASS_ASSIGNMENT_DATA > & GetComponentClassAssignments() const
Gets all dynamic component class assignments.
void RecalculateRatsnest(BOARD_COMMIT *aCommit=nullptr)
Update the ratsnest for the board.
void RunOnUnconnectedEdges(std::function< bool(CN_EDGE &)> aFunc)
unsigned int GetUnconnectedCount(bool aVisibleOnly) const
static DELETED_BOARD_ITEM * GetInstance()
Container for an DRC exclusion, which is a PCB_MARKER plus an optional comment.
static DRC_EXCLUSION FromMarker(const PCB_MARKER &aMarker)
void Build(const BOARD &aBoard, const std::vector< DRILL_SPAN > &aSpans)
const DRILL_CHART_TOTALS & Totals() const
uint64_t Fingerprint() const
Cheap value used to notice an edit.
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 aInspector, void *aTestData, 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...
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
virtual void SetParent(EDA_ITEM *aParent)
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, std::shared_ptr< EMBEDDED_FILE > > & EmbeddedFileMap() const
Provide an iterable view of the file collection.
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
Implement 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_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, LENGTH_DELAY_ITEM_DETAILS *aPerItemLengthDelays=nullptr) const
Calculates the electrical length of the given items.
LENGTH_DELAY_CALCULATION_ITEM GetLengthCalculationItem(const BOARD_CONNECTED_ITEM *aBoardItem) const
Return a LENGTH_CALCULATION_ITEM constructed from the given BOARD_CONNECTED_ITEM.
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()
static const LSET & PhysicalLayersMask()
Return a mask holding all layers which are physically realized.
std::shared_ptr< RC_ITEM > GetRCItem() const
void SetExcluded(bool aExcluded, const wxString &aComment=wxEmptyString)
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
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
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() const
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()
A 3D body attached to a footprint (or, later, placed on a board).
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...
A geometric constraint between board items (issue #2329).
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
Turns on drill symbols at the holes, for one layer.
int GetSymbolExtent() const
const VECTOR2I & GetOffset() const
A set of BOARD_ITEMs (i.e., without duplicates).
A PCB_IO derivation for saving and loading Pcbnew s-expression formatted files.
void FormatBoardToFormatter(OUTPUTFORMATTER *aOut, BOARD *aBoard, const std::map< std::string, UTF8 > *aProperties=nullptr)
Serialize a BOARD to an OUTPUTFORMATTER without file I/O or Prettify.
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 * FromProto(const kiapi::board::DrcMarker &aMsg)
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
Convert the text to a polygonSet describing the actual character strokes (one per segment).
void TransformTextToPolySet(SHAPE_POLY_SET &aBuffer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc) const
Convert the text to a polygonSet describing the actual character strokes (one per segment).
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 GetProjectName() const
Return the short name of the project.
virtual PROJECT_FILE & GetProjectFile() const
std::vector< KIID > GetIDs() const
Represent a set of closed polygons.
POLYGON & Polygon(int aIndex)
Return the aIndex-th subpolygon in the set.
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()
Simplify the polyset (merges overlapping polys, eliminates degeneracy/self-intersections)
int ArcCount() const
Count the number of arc shapes present.
int OutlineCount() const
Return the number of outlines in the set.
void BooleanSubtract(const SHAPE_POLY_SET &b)
Perform boolean polyset difference.
std::function< void(std::function< void()>)> TASK_SUBMITTER
Callback that submits a unit of work for asynchronous execution.
const wxString & GetComment(int aIdx) const
static void GetContextualTextVars(wxArrayString *aVars)
Handle a list of polygons defining a copper zone.
bool AppendCorner(const VECTOR2I &aPosition, int aHoleIdx, bool aAllowDuplication=false)
Add a new corner to the zone outline (to the main outline or a hole)
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
void SetHatchStyle(ZONE_BORDER_DISPLAY_STYLE aStyle)
bool SetNetCode(int aNetCode, bool aNoAssert) override
Override that clamps the netcode to 0 when this zone is in copper-thieving fill mode.
const wxString & GetZoneName() const
bool IsTeardropArea() const
bool BuildBoardPolygonOutlines(BOARD *aBoard, SHAPE_POLY_SET &aOutlines, int aErrorMax, int aChainingEpsilon, bool aInferOutlineIfNecessary, 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)
std::vector< DRILL_SPAN > EnumerateDrillSpans(const BOARD &aBoard, bool aPadBackdrills)
Every drill span present on the board, through-holes first.
std::map< KIID, std::vector< DRILL_SYMBOL_ENTRY > > ResolveDrillSymbolsByItem(const BOARD &aBoard, const std::map< std::string, DRILL_SYMBOL_ASSIGNMENT > &aResolved)
The same answer keyed by the item that owns the holes.
std::map< std::string, DRILL_SYMBOL_ASSIGNMENT > ResolveDrillSymbols(const BOARD &aBoard)
The symbol every hole should carry, without touching the board.
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
static const std::string DesignRulesFileExtension
const wxChar *const traceAutoSave
Flag to enable auto save feature debug tracing.
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.
std::map< wxString, NETINFO_ITEM * > NETNAMES_MAP
@ 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.
std::deque< PCB_TRACK * > TRACKS
Class that computes missing connections on a PCB.
wxString GetDefaultVariantName()
int SortVariantNames(const wxString &aLhs, const wxString &aRhs)
bool operator()(const BOARD_ITEM *aFirst, const BOARD_ITEM *aSecond) const
bool operator()(const BOARD_ITEM *aFirst, const BOARD_ITEM *aSecond) const
DRILL_CHART_TOTALS m_Totals
Counts for the ${DRILL_*} text variables.
One drawable mark, with the geometry the renderer needs to place it.
std::vector< char > decompressedData
std::string compressedEncodedData
Data produced by a registered saver on the UI thread, consumed by either the background local-history...
std::string content
Serialized content (mutually exclusive with sourcePath)
KICAD_FORMAT::FORMAT_MODE formatMode
wxString relativePath
Destination path relative to the project root.
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.
static const long long MM
wxString result
Test unit parsing edge cases and error handling.
thread_pool & GetKiCadThreadPool()
Get a reference to the current thread pool.
BS::priority_thread_pool thread_pool
wxLogTrace helper definitions.
constexpr KICAD_T BaseType(const KICAD_T aType)
Return the underlying type of the given type.
constexpr bool IsSingleLayerType(const KICAD_T aType)
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
@ PCB_CONSTRAINT_T
a geometric constraint between board items
@ 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_DRILL_MAP_T
class PCB_DRILL_MAP, drill symbols drawn at the holes
@ 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_GRID_ITEM_T
a subgrid placed on a board
@ 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
@ PCB_DRILL_CHART_T
class PCB_DRILL_CHART, a live drill chart derived from PCB_TABLE
VECTOR2< int32_t > VECTOR2I
ZONE_BORDER_DISPLAY_STYLE
Zone border styles.