65 m_LegacyDesignSettingsLoaded( false ),
66 m_LegacyCopperEdgeClearanceLoaded( false ),
67 m_LegacyNetclassesLoaded( false ),
184 project.m_BoardSettings =
nullptr;
216 marker->SetExcluded(
true );
221 std::vector<PCB_MARKER*> newMarkers;
230 newMarkers.push_back( marker );
264 wxLogWarning( wxT(
"This should not be called on the BOARD object") );
271 static const KICAD_T top_level_board_stuff[] = {
297 brd_item->
Move( aMoveVector );
302 Visit( inspector,
nullptr, top_level_board_stuff );
312 PCB_TRACK* t = static_cast<PCB_TRACK*>( item );
346 if ( (
m_layers[ layer ].m_name == aLayerName )
347 || (
m_layers[ layer ].m_userName == aLayerName ) )
370 if( !
m_layers[aLayer].m_userName.IsEmpty() )
380 wxCHECK( !aLayerName.IsEmpty(), false );
383 if( aLayerName.Find( wxChar(
'"' ) ) != wxNOT_FOUND )
442 if( strcmp( aType,
"signal" ) == 0 )
444 else if( strcmp( aType,
"power" ) == 0 )
446 else if( strcmp( aType,
"mixed" ) == 0 )
448 else if( strcmp( aType,
"jumper" ) == 0 )
511 for(
size_t i = 0; i < aSet.size(); i++ )
552 track->SetLocalRatsnestVisible( isEnabled );
556 for(
PAD*
pad : footprint->Pads() )
557 pad->SetLocalRatsnestVisible( isEnabled );
561 zone->SetLocalRatsnestVisible( isEnabled );
583 wxFAIL_MSG( wxT(
"BOARD::IsModuleLayerVisible() param error: bad layer" ) );
610 if( aBoardItem ==
nullptr )
612 wxFAIL_MSG( wxT(
"BOARD::Add() param error: aBoardItem nullptr" ) );
616 switch( aBoardItem->
Type() )
644 wxFAIL_MSG( wxT(
"BOARD::Add() Cannot place Track on non-copper layer" ) );
649 m_tracks.push_back( static_cast<PCB_TRACK*>( aBoardItem ) );
651 m_tracks.push_front( static_cast<PCB_TRACK*>( aBoardItem ) );
657 m_footprints.push_back( static_cast<FOOTPRINT*>( aBoardItem ) );
659 m_footprints.push_front( static_cast<FOOTPRINT*>( aBoardItem ) );
681 msg.Printf( wxT(
"BOARD::Add() needs work: BOARD_ITEM type (%d) not handled" ),
682 aBoardItem->
Type() );
713 wxASSERT( aBoardItem );
715 switch( aBoardItem->
Type() )
719 NETINFO_ITEM* item = static_cast<NETINFO_ITEM*>( aBoardItem );
724 for(
PAD*
pad : fp->Pads() )
726 if(
pad->GetNet() == item )
727 pad->SetNet( unconnected );
733 if( zone->GetNet() == item )
734 zone->SetNet( unconnected );
739 if( track->GetNet() == item )
740 track->SetNet( unconnected );
781 wxFAIL_MSG( wxT(
"BOARD::Remove() needs more ::Type() support" ) );
821 if( ( marker->IsExcluded() && aExclusions )
822 || ( !marker->IsExcluded() && aWarningsAndErrors ) )
828 remaining.push_back( marker );
852 if( track->m_Uuid == aID )
858 if( footprint->m_Uuid == aID )
861 for(
PAD*
pad : footprint->Pads() )
863 if(
pad->m_Uuid == aID )
867 if( footprint->Reference().m_Uuid == aID )
868 return &footprint->Reference();
870 if( footprint->Value().m_Uuid == aID )
871 return &footprint->Value();
873 for(
BOARD_ITEM* drawing : footprint->GraphicalItems() )
875 if( drawing->m_Uuid == aID )
881 if( zone->m_Uuid == aID )
887 if(
group->m_Uuid == aID )
894 if( zone->m_Uuid == aID )
900 if( drawing->m_Uuid == aID )
906 if( marker->m_Uuid == aID )
912 if(
group->m_Uuid == aID )
917 return const_cast<BOARD*>(
this );
930 aMap[ track->m_Uuid ] = track;
934 aMap[ footprint->m_Uuid ] = footprint;
936 for(
PAD*
pad : footprint->Pads() )
937 aMap[
pad->m_Uuid ] =
pad;
939 aMap[ footprint->Reference().m_Uuid ] = &footprint->Reference();
940 aMap[ footprint->Value().m_Uuid ] = &footprint->Value();
942 for(
BOARD_ITEM* drawing : footprint->GraphicalItems() )
943 aMap[ drawing->m_Uuid ] = drawing;
947 aMap[ zone->m_Uuid ] = zone;
950 aMap[ drawing->m_Uuid ] = drawing;
953 aMap[ marker->m_Uuid ] = marker;
963 size_t sourceLen = aSource.length();
965 for(
size_t i = 0; i < sourceLen; ++i )
967 if( aSource[i] ==
'$' && i + 1 < sourceLen && aSource[i+1] ==
'{' )
970 bool isCrossRef =
false;
972 for( i = i + 2; i < sourceLen; ++i )
974 if( aSource[i] ==
'}' )
977 if( aSource[i] ==
':' )
980 token.append( aSource[i] );
986 wxString ref = token.BeforeFirst(
':', &remainder );
990 if( footprint->GetReference().CmpNoCase( ref ) == 0 )
992 wxString
test( remainder );
994 if( footprint->ResolveTextVar( &
test ) )
995 token = footprint->m_Uuid.AsString() + wxT(
":" ) + remainder;
1002 newbuf.append( wxT(
"${" ) + token + wxT(
"}" ) );
1006 newbuf.append( aSource[i] );
1017 size_t sourceLen = aSource.length();
1019 for(
size_t i = 0; i < sourceLen; ++i )
1021 if( aSource[i] ==
'$' && i + 1 < sourceLen && aSource[i+1] ==
'{' )
1024 bool isCrossRef =
false;
1026 for( i = i + 2; i < sourceLen; ++i )
1028 if( aSource[i] ==
'}' )
1031 if( aSource[i] ==
':' )
1034 token.append( aSource[i] );
1040 wxString ref = token.BeforeFirst(
':', &remainder );
1045 token = static_cast<FOOTPRINT*>( refItem )->GetReference() + wxT(
":" )
1050 newbuf.append( wxT(
"${" ) + token + wxT(
"}" ) );
1054 newbuf.append( aSource[i] );
1064 unsigned retval = 0;
1068 for(
PAD*
pad : footprint->Pads() )
1070 if( ( aNet == -1 &&
pad->GetNetCode() > 0 ) || aNet ==
pad->GetNetCode() )
1092 if( aBoardEdgesOnly )
1101 if( ( item->GetLayerSet() & visible ).any() )
1102 area.
Merge( item->GetBoundingBox() );
1108 if( !( footprint->GetLayerSet() & visible ).any() )
1111 if( aBoardEdgesOnly )
1113 for(
const BOARD_ITEM* edge : footprint->GraphicalItems() )
1116 area.
Merge( edge->GetBoundingBox() );
1121 area.
Merge( footprint->GetBoundingBox(
true, showInvisibleText ) );
1125 if( !aBoardEdgesOnly )
1130 if( ( track->GetLayerSet() & visible ).any() )
1131 area.
Merge( track->GetBoundingBox() );
1137 if( ( aZone->GetLayerSet() & visible ).any() )
1138 area.
Merge( aZone->GetBoundingBox() );
1150 int trackSegmentCount = 0;
1151 std::set<int> netCodes;
1159 trackSegmentCount++;
1161 if( item->GetNetCode() > 0 )
1162 netCodes.insert( item->GetNetCode() );
1167 for(
PAD*
pad : footprint->Pads() )
1171 if(
pad->GetNetCode() > 0 )
1172 netCodes.insert(
pad->GetNetCode() );
1178 aList.emplace_back(
_(
"Track Segments" ),
wxString::Format( wxT(
"%d" ), trackSegmentCount ) );
1179 aList.emplace_back(
_(
"Nets" ),
wxString::Format( wxT(
"%d" ), (
int) netCodes.size() ) );
1180 aList.emplace_back(
_(
"Unrouted" ),
wxString::Format( wxT(
"%d" ), unconnected ) );
1191 #if 0 && defined(DEBUG) 1192 std::cout <<
GetClass().mb_str() <<
' ';
1202 result = inspector(
this, testData );
1220 result = IterateForward<FOOTPRINT*>(
m_footprints, inspector, testData, p );
1225 switch( stype = *++p )
1250 result = IterateForward<BOARD_ITEM*>(
m_drawings, inspector, testData, p );
1255 switch( stype = *++p )
1276 result = IterateForward<PCB_TRACK*>(
m_tracks, inspector, testData, p );
1282 result = IterateForward<PCB_TRACK*>(
m_tracks, inspector, testData, p );
1289 result = marker->Visit( inspector, testData, p );
1301 result = zone->Visit( inspector, testData, p );
1311 result = IterateForward<PCB_GROUP*>(
m_groups, inspector, testData, p );
1353 if( aReference == footprint->GetReference() )
1365 if( footprint->GetPath() == aPath )
1375 std::vector<wxString> names;
1379 if( !net->GetNetname().IsEmpty() )
1380 names.emplace_back( net->GetNetname() );
1401 NETCLASSPTR defaultNetClass = netClasses.
GetDefault();
1405 const wxString& netname = net->GetNetname();
1406 const wxString& netclassName = netSettings->
GetNetclassName( netname );
1408 net->SetNetClass( netClasses.
Find( netclassName ) );
1429 int error_count = 0;
1433 if( !zone->IsOnCopperLayer() )
1439 if( zone->GetNetCode() != 0 )
1452 zone->SetNetCode( -1 );
1463 if( !aLayerSet.any() )
1470 if( footprint->HitTest( aPosition ) )
1471 pad = footprint->GetPad( aPosition, aLayerSet );
1483 const wxPoint& aPosition = aTrace->
GetEndPoint( aEndPoint );
1487 return GetPad( aPosition, lset );
1495 for(
PAD*
pad : footprint->Pads() )
1497 if(
pad->GetPosition() != aPosition )
1501 if( (
pad->GetLayerSet() & aLayerSet ).any() )
1514 int idxmax = aPadList.size() - 1;
1516 int delta = aPadList.size();
1529 PAD*
pad = aPadList[idx];
1531 if(
pad->GetPosition() == aPosition )
1534 if( ( aLayerSet &
pad->GetLayerSet() ).any() )
1541 for(
int ii = idx+1; ii <= idxmax; ii++ )
1545 if(
pad->GetPosition() != aPosition )
1548 if( ( aLayerSet &
pad->GetLayerSet() ).any() )
1552 for(
int ii = idx - 1 ;ii >=0; ii-- )
1556 if(
pad->GetPosition() != aPosition )
1559 if( ( aLayerSet &
pad->GetLayerSet() ).any() )
1567 if(
pad->GetPosition().x == aPosition.x )
1569 if(
pad->GetPosition().y < aPosition.y )
1584 else if(
pad->GetPosition().x < aPosition.x )
1622 for(
PAD*
pad : footprint->Pads( ) )
1624 if( aNetCode < 0 || pad->GetNetCode() == aNetCode )
1625 aVector.push_back(
pad );
1646 double length = 0.0;
1647 double package_length = 0.0;
1655 static_cast<const BOARD_CONNECTED_ITEM*>( &aTrack ), types ) )
1659 if(
PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( item ) )
1661 if( track->Type() ==
PCB_VIA_T && useHeight )
1663 PCB_VIA*
via = static_cast<PCB_VIA*>( track );
1671 length += track->GetLength();
1676 SEG trackSeg( track->GetStart(), track->GetEnd() );
1677 double segLen = trackSeg.
Length();
1678 double segInPadLen = 0;
1680 for(
auto pad_it : connectivity->GetConnectedPads( item ) )
1682 PAD*
pad = static_cast<PAD*>( pad_it );
1684 bool hitStart =
pad->HitTest( track->GetStart(), track->GetWidth() / 2 );
1685 bool hitEnd =
pad->HitTest( track->GetEnd(), track->GetWidth() / 2 );
1687 if( hitStart && hitEnd )
1692 else if( hitStart || hitEnd )
1697 if(
pad->GetEffectivePolygon()->Collide( trackSeg, 0,
nullptr, &loc ) )
1705 segLen = trackSeg.Length();
1714 length += segLen + segInPadLen;
1716 else if(
PAD*
pad = dyn_cast<PAD*>( item ) )
1718 package_length +=
pad->GetPadToDieLength();
1722 return std::make_tuple( count, length, package_length );
1727 bool aVisibleOnly,
bool aIgnoreLocked )
const 1731 int min_dim = 0x7FFFFFFF;
1732 int alt_min_dim = 0x7FFFFFFF;
1733 bool current_layer_back =
IsBackLayer( aActiveLayer );
1738 if( !candidate->HitTest( aPosition ) )
1742 if( aIgnoreLocked && candidate->IsLocked() )
1750 EDA_RECT bb = candidate->GetBoundingBox(
false,
false );
1756 int dist = ( aPosition.x - offx ) * ( aPosition.x - offx ) +
1757 ( aPosition.y - offy ) * ( aPosition.y - offy );
1761 if( dist <= min_dim )
1764 footprint = candidate;
1770 if( dist <= alt_min_dim )
1773 alt_footprint = candidate;
1784 return alt_footprint;
1792 std::list<ZONE*> zones;
1795 zones.push_back( zone );
1797 if( aIncludeZonesInFootprints )
1801 for(
FP_ZONE* zone : footprint->Zones() )
1802 zones.push_back( zone );
1818 m_zones.push_back( new_area );
1841 chainingEpsilon, aErrorHandler );
1852 std::vector<PAD*> allPads;
1856 for(
PAD*
pad : footprint->Pads() )
1857 allPads.push_back(
pad );
1866 std::vector<BOARD_CONNECTED_ITEM*> items;
1869 items.push_back( track );
1873 for(
PAD*
pad : footprint->Pads() )
1874 items.push_back(
pad );
1878 items.push_back( zone );
1887 item->SetNetCode( 0 );
1898 item->SetNet( netInfo );
1909 if(
FindNet( item->GetNetCode() ) ==
nullptr )
1985 return wxEmptyString;
2004 std::unordered_set<PCB_GROUP*> knownCycleFreeGroups;
2006 std::unordered_set<PCB_GROUP*> currentChainGroups;
2008 std::unordered_set<PCB_GROUP*> toCheckGroups;
2012 toCheckGroups.insert(
group);
2014 while( !toCheckGroups.empty() )
2016 currentChainGroups.clear();
2021 if( currentChainGroups.find(
group ) != currentChainGroups.end() )
2026 return "Cycle detected in group membership";
2028 else if( knownCycleFreeGroups.find(
group ) != knownCycleFreeGroups.end() )
2034 currentChainGroups.insert(
group );
2036 toCheckGroups.erase(
group );
2049 knownCycleFreeGroups.insert( currentChainGroups.begin(), currentChainGroups.end() );
2059 bool hasGroup =
false;
2060 bool hasMember =
false;
2067 if( static_cast<BOARD_ITEM*>( item )->GetParentGroup() )
2076 legalOps.
enter = hasGroup && selection.Size() == 1;
2106 if( aFirst->
Type() != aSecond->
Type() )
2107 return aFirst->
Type() < aSecond->
Type();
2114 const PCB_SHAPE* shape = static_cast<const PCB_SHAPE*>( aFirst );
2115 const PCB_SHAPE* other = static_cast<const PCB_SHAPE*>( aSecond );
2116 return shape->
Compare( other );
2120 const PCB_TEXT*
text = static_cast<const PCB_TEXT*>( aFirst );
2121 const PCB_TEXT* other = static_cast<const PCB_TEXT*>( aSecond );
2122 return text->Compare( other );
2137 if( !track->IsOnLayer( aLayer ) )
2140 track->TransformShapeWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
2147 footprint->TransformPadsWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
2151 footprint->TransformFPShapesWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
2156 for(
const ZONE* zone : footprint->Zones() )
2158 if( zone->GetLayerSet().test( aLayer ) )
2159 zone->TransformSolidAreasShapesToPolygon( aLayer, aOutlines );
2166 if( zone->GetLayerSet().test( aLayer ) )
2167 zone->TransformSolidAreasShapesToPolygon( aLayer, aOutlines );
2173 if( !item->IsOnLayer( aLayer ) )
2176 switch( item->Type() )
2180 const PCB_SHAPE* shape = static_cast<const PCB_SHAPE*>( item );
2188 const PCB_TEXT*
text = static_cast<const PCB_TEXT*>( item );
2189 text->TransformTextShapeWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
int Length() const
Return the length (this).
void SetParent(JSON_SETTINGS *aParent, bool aLoadFromFile=true)
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
BOARD_ITEM * GetItem(const KIID &aID) const
PCB_GROUP * GetParentGroup() const
LSET m_VisibleLayers
Board settings.
void InvokeListeners(Func &&aFunc, Args &&... args)
void AddListener(BOARD_LISTENER *aListener)
Add a listener to the board to receive calls whenever something on the board has been modified.
virtual void OnBoardItemRemoved(BOARD &aBoard, BOARD_ITEM *aBoardItem)
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
void SetNetClasses(NETCLASSES *aNetClasses)
void SetCopperLayerCount(int aNewLayerCount)
Set the copper layer count to aNewLayerCount.
void SetEnabledLayers(LSET aMask)
Change the bit-mask of enabled layers to aMask.
virtual std::map< wxString, wxString > & GetTextVars() const
const PCB_LAYER_ID GetLayerID(const wxString &aLayerName) const
Return the ID of a layer.
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
class PCB_DIM_LEADER, a leader dimension (graphic item)
GroupLegalOpsField GroupLegalOps(const PCB_SELECTION &selection) const
Check which selection tool group operations are legal given the selection.
std::map< std::pair< BOARD_ITEM *, BOARD_ITEM * >, bool > m_InsideCourtyardCache
class FP_TEXT, text in a footprint
void Merge(const EDA_RECT &aRect)
Modify the position and size of the rectangle in order to contain aRect.
void SetElementVisibility(GAL_LAYER_ID aLayer, bool aNewState)
Change the visibility of an element category.
Container for project specific data.
NETCLASSPTR Find(const wxString &aName) const
Search this container for a NETCLASS given by aName.
bool m_LegacyDesignSettingsLoaded
True if the legacy board design settings were loaded from a file.
bool GetBoardPolygonOutlines(SHAPE_POLY_SET &aOutlines, OUTLINE_ERROR_HANDLER *aErrorHandler=nullptr)
Extract the board outlines and build a closed polygon from lines, arcs and circle items on edge cut l...
static const KICAD_T Tracks[]
A scan list for only TRACKs.
bool operator()(const BOARD_ITEM *aFirst, const BOARD_ITEM *aSecond) const
static NETINFO_ITEM * OrphanedItem()
Wrapper class, so you can iterate through NETINFO_ITEM*s, not std::pair<int/wxString,...
const ZONE_SETTINGS & GetZoneSettings() const override
Fetch the zone settings for this container.
wxString m_name
The canonical name of the layer.
bool m_LegacyNetclassesLoaded
True if netclasses were loaded from the file.
ZONE * AddArea(PICKED_ITEMS_LIST *aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer, wxPoint aStartPointPosition, ZONE_BORDER_DISPLAY_STYLE aHatch)
Add an empty copper area to board areas list.
Manage layers needed to make a physical board.
const wxString & GetNetclassName(const wxString &aNetName) const
bool sortPadsByXthenYCoord(PAD *const &aLH, PAD *const &aRH)
Used by #GetSortedPadListByXCoord to sort a pad list by X coordinate value.
void SetCustomDiffPairViaGap(int aGap)
Sets custom via gap for differential pairs (i.e.
void ConvertBrdLayerToPolygonalContours(PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aOutlines) const
Build a set of polygons which are the outlines of copper items (pads, tracks, vias,...
void HighLightON(bool aValue=true)
Enable or disable net highlighting.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
void SetHatchStyle(ZONE_BORDER_DISPLAY_STYLE aStyle)
class PCB_GROUP, a set of BOARD_ITEMs
void SetDefaultZoneSettings(const ZONE_SETTINGS &aSettings)
void SetProperties(const std::map< wxString, wxString > &aProps)
bool operator()(const BOARD_ITEM *aFirst, const BOARD_ITEM *aSecond) const
bool IsLayerEnabled(PCB_LAYER_ID aLayerId) const
Test whether a given layer aLayerId is enabled.
GROUPS & Groups()
The groups must maintain the following invariants.
A set of BOARD_ITEMs (i.e., without duplicates).
A progress reporter interface for use in multi-threaded environments.
std::map< wxString, wxString > m_properties
void SetCustomViaDrill(int aDrill)
Sets custom size for via drill (i.e.
class PCB_DIM_CENTER, a center point marking (graphic item)
virtual PROJECT_FILE & GetProjectFile() const
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
Class that computes missing connections on a PCB.
LAYER_T m_type
The type of the layer.
int GetLayerDistance(PCB_LAYER_ID aFirstLayer, PCB_LAYER_ID aSecondLayer) const
Calculate the distance (height) between the two given copper layers.
void SetFlags(EDA_ITEM_FLAGS aMask)
void DeleteStructure()
Delete this object after removing from its parent if it has one.
void SetCopperLayerCount(int aCount)
class PCB_TEXT, text on a layer
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
LSET GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
class PCB_ARC, an arc track segment on a copper layer
void SetVisibleElements(const GAL_SET &aMask)
A proxy function that calls the correspondent function in m_BoardSettings.
void SetDescription(const wxString &aDesc)
int LAYER_NUM
This can be replaced with int and removed.
virtual void OnBoardItemsAdded(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItem)
void SetVisibleAlls()
Change the bit-mask of visible element categories and layers.
void PushItem(const ITEM_PICKER &aItem)
Push aItem to the top of the list.
PAD * GetPad(const wxPoint &aPosition, LSET aLayerMask) const
Find a pad aPosition on aLayer.
class FP_SHAPE, a footprint edge
class PAD, a pad in a footprint
void SetPosition(const wxPoint &aPos) override
FOOTPRINT * FindFootprintByPath(const KIID_PATH &aPath) const
Search for a FOOTPRINT within this board with the given path.
virtual void OnBoardItemChanged(BOARD &aBoard, BOARD_ITEM *aBoardItem)
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
LAYER m_layers[PCB_LAYER_ID_COUNT]
bool SetLayerType(PCB_LAYER_ID aLayer, LAYER_T aLayerType)
Change the type of the layer given by aLayer.
HIGH_LIGHT_INFO m_highLight
virtual wxPoint GetPosition() const
HIGH_LIGHT_INFO m_highLightPrevious
The base class for create windows for drawing purpose.
bool IsLayerEnabled(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
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...
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.
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
virtual void OnBoardItemAdded(BOARD &aBoard, BOARD_ITEM *aBoardItem)
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
FOOTPRINT * GetFootprint(const wxPoint &aPosition, PCB_LAYER_ID aActiveLayer, bool aVisibleOnly, bool aIgnoreLocked=false) const
Get a footprint by its bounding rectangle at aPosition on aLayer.
The backing store for a PROJECT, in JSON format.
void SetCustomViaSize(int aSize)
Set custom size for via diameter (i.e.
const INSPECTOR_FUNC & INSPECTOR
search types array terminator (End Of Types)
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
static wxPoint ZeroOffset
A value of wxPoint(0,0) which can be passed to the Draw() functions.
virtual void SetParent(EDA_ITEM *aParent)
class PCB_TRACK, a track segment (segment on a copper layer)
PAD * GetPadFast(const wxPoint &aPosition, LSET aLayerMask) const
Return pad found at aPosition on aLayerMask using the fast search method.
virtual void OnBoardItemsChanged(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItem)
virtual PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
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.
static const char * ShowType(LAYER_T aType)
Convert a LAYER_T enum to a string representation of the layer type.
Classes used in Pcbnew, CvPcb and GerbView.
This is the end of the layers used for visibility bit masks in Pcbnew.
void AppendNet(NETINFO_ITEM *aNewElement)
Add aNewElement to the end of the net list.
SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[]) override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
std::list< ZONE * > GetZoneList(bool aIncludeZonesInFootprints=false) const
void SynchronizeNetsAndNetClasses()
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
unsigned GetNodesCount(int aNet=-1) const
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Adds an item to the container.
std::vector< PCB_MARKER * > ResolveDRCExclusions()
Rebuild DRC markers from the serialized data in BOARD_DESIGN_SETTINGS.
std::shared_ptr< NET_SETTINGS > m_NetSettings
Net settings for this project (owned here)
BOARD_STACKUP & GetStackupDescriptor()
bool BuildBoardPolygonOutlines(BOARD *aBoard, SHAPE_POLY_SET &aOutlines, int aErrorMax, int aChainingEpsilon, OUTLINE_ERROR_HANDLER *aErrorHandler)
Extracts the board outlines and build a closed polygon from lines, arcs and circle items on edge cut ...
const std::vector< BOARD_CONNECTED_ITEM * > AllConnectedItems()
void RemoveNet(NETINFO_ITEM *aNet)
Remove a net from the net list.
LSET is a set of PCB_LAYER_IDs.
void ResetNetHighLight()
Reset all high light data to the init state.
A container for NETCLASS instances.
void SetExcluded(bool aExcluded)
GAL_SET m_VisibleItems
The GAL layers (aka items) that are turned on for viewing (.
#define GAL_LAYER_INDEX(x)
Use this macro to convert a GAL layer to a 0-indexed offset from LAYER_VIAS.
wxString GroupsSanityCheckInternal(bool repair)
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
std::function< SEARCH_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...
void RemoveListener(BOARD_LISTENER *aListener)
Remove the specified listener.
void DeleteMARKERs()
Delete all MARKERS from the board.
PGM_BASE * PgmOrNull()
similar to PGM_BASE& Pgm(), but return a reference that can be nullptr when running a shared lib from...
virtual void Move(const wxPoint &aMoveVector)
Move this object.
Represent a set of closed polygons.
void SetVisibleLayers(LSET aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings changes the bit-mask of vis...
static DELETED_BOARD_ITEM * GetInstance()
GAL_SET GetVisibleElements() const
Return a set of all the element categories that are visible.
virtual PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Use all material properties from model file.
Describe the page size and margins of a paper page on which to eventually print or plot.
const std::vector< PAD * > GetPads() const
Return a reference to a list of all the pads.
void SetCustomDiffPairWidth(int aWidth)
Sets custom track width for differential pairs (i.e.
FOOTPRINTS & Footprints()
virtual void OnBoardNetSettingsChanged(BOARD &aBoard)
A collection of nets and the parameters used to route or test these nets.
void SetNetCode(int aNetCode)
unsigned GetUnconnectedNetCount() const
bool SetLayerName(PCB_LAYER_ID aLayer, const wxString &aLayerName)
Changes the name of the layer given by aLayer.
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
bool SetLayerDescr(PCB_LAYER_ID aIndex, const LAYER &aLayer)
Return the type of the copper layer given by aLayer.
BOARD_USE
Flags to specify how the board is being used.
void SynchronizeProperties()
Copy the current project's text variables into the boards property cache.
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.
Helper for storing and iterating over GAL_LAYER_IDs.
static PCB_MARKER * Deserialize(const wxString &data)
std::vector< wxString > GetNetClassAssignmentCandidates() const
Return a list of name candidates for netclass assignment.
#define STRUCT_DELETED
flag indication structures to be erased
NET_SETTINGS stores various net-related settings in a project context.
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
NETCLASSES & GetNetClasses() const
bool RemoveItem(BOARD_ITEM *aItem)
Remove item from group.
static LSET AllLayersMask()
void Simplify(POLYGON_MODE aFastMode)
Handle a list of polygons defining a copper zone.
wxString m_userName
The user defined name of the layer.
class ZONE, a copper pour area
void SetHighLightNet(int aNetCode, bool aMulti=false)
Select the netcode to be highlighted.
void SetCustomDiffPairGap(int aGap)
Sets custom gap for differential pairs (i.e.
A holder to handle information on schematic or board items.
std::unique_ptr< BOARD_DESIGN_SETTINGS > m_designSettings
All of the board design settings are stored as a JSON object inside the project file.
static LAYER_T ParseType(const char *aType)
Convert a string to a LAYER_T.
void IncrementTimeStamp()
int SetAreasNetCodesFromNetNames()
Set the .m_NetCode member of all copper areas, according to the area Net Name The SetNetCodesFromNetN...
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
void SetCustomTrackWidth(int aWidth)
Sets custom width for track (i.e.
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
int Compare(const EDA_SHAPE *aOther) const
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
class PCB_TARGET, a target (graphic item)
static const int ORPHANED
NETINFO_ITEM meaning that there was no net assigned for an item, as there was no board storing net li...
EDA_ITEM_FLAGS GetFlags() const
class FOOTPRINT, a footprint
ZONE_SETTINGS handles zones parameters.
TRACKS TracksInNet(int aNetCode)
Collect all the TRACKs and VIAs that are members of a net given by aNetCode.
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
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.
void BuildConnectivity(PROGRESS_REPORTER *aReporter=nullptr)
Build or rebuild the board connectivity database for the board, especially the list of connected item...
void SetProject(PROJECT *aProject)
Link a board to a given project.
std::map< wxString, LSET > m_LayerExpressionCache
LAYER_T GetLayerType(PCB_LAYER_ID aLayer) const
Return the type of the copper layer given by aLayer.
void Move(const wxPoint &aMoveVector) override
Move this object.
std::set< int > m_netCodes
Handle the data for a net.
void MapNets(const BOARD *aDestBoard)
Map all nets in the given board to nets with the same name (if any) in the destination board.
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
bool m_UseHeightForLengthCalcs
Enable inclusion of stackup height in track length measurements and length tuning.
bool AppendCorner(wxPoint aPosition, int aHoleIdx, bool aAllowDuplication=false)
Add a new corner to the zone outline (to the main outline or a hole)
class PCB_MARKER, a marker used to show something
bool m_Printing
wxWidgets on MSW tends to crash if you spool up more than one print job at a time.
virtual void OnBoardHighlightNetChanged(BOARD &aBoard)
TITLE_BLOCK & GetTitleBlock()
void PadDelete(PAD *aPad)
Delete a given pad from the BOARD by removing it from its footprint and from the m_NetInfo.
int m_fileFormatVersionAtLoad
wxPoint GetPosition() const override
Container to hold information pertinent to a layer of a BOARD.
Information pertinent to a Pcbnew printed circuit board.
LSET GetEnabledLayers() const
Return a bit-mask of all the layers that are enabled.
wxPoint GetPosition() const override
PCB_LAYER_ID
A quick note on layer IDs:
virtual void OnBoardItemsRemoved(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItem)
wxString ConvertCrossReferencesToKIIDs(const wxString &aSource) const
Convert cross-references back and forth between ${refDes:field} and ${kiid:field}.
class NETINFO_ITEM, a description of a net
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,...
int GetCopperLayerCount() const
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
class ZONE, managed by a footprint
Handle the component boundary box.
NETCLASS * GetDefault() const
void SetZoneSettings(const ZONE_SETTINGS &aSettings) override
Set the zone settings for this container.
const wxPoint & GetEndPoint(ENDPOINT_T aEndPoint) const
Return the selected endpoint (start or end)
void OnItemChanged(BOARD_ITEM *aItem)
Notify the board and its listeners that an item on the board has been modified in some way.
A base class for most all the KiCad significant classes used in schematics and boards.
void Remove(BOARD_ITEM *aBoardItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
Removes an item from the container.
wxString GetClass() const override
Return the class name.
EDA_RECT ComputeBoundingBox(bool aBoardEdgesOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
std::map< ZONE *, std::unique_ptr< DRC_RTREE > > m_CopperZoneRTrees
unsigned GetNetCount() const
wxString ConvertKIIDsToCrossReferences(const wxString &aSource) const
NETCLASSPTR GetDefault() const
wxString GroupsSanityCheck(bool repair=false)
Consistency check of internal m_groups structure.
ZONE_BORDER_DISPLAY_STYLE
Zone border styles.
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
const std::function< void(const wxString &msg, BOARD_ITEM *itemA, BOARD_ITEM *itemB, const wxPoint &pt)> OUTLINE_ERROR_HANDLER
void DeleteAllFootprints()
Remove all footprints from the deque and free the memory associated with them.
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
class PCB_VIA, a via (like a track segment on a copper layer)
ZONE_SETTINGS & GetDefaultZoneSettings()
Abstract interface for BOARD_ITEMs capable of storing other items inside.
std::map< std::pair< BOARD_ITEM *, BOARD_ITEM * >, bool > m_InsideBCourtyardCache
void delete_matching(_Container &__c, _Value __value)
Covers for the horrifically named std::remove and std::remove_if (neither of which remove anything).
NETINFO_ITEM * GetNetItem(int aNetCode) const
void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearanceValue, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
Convert the shape to a closed polygon.
bool ResolveTextVar(wxString *token, int aDepth) const
LAYER_T
The allowed types of layers, same as Specctra DSN spec.
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
class PCB_SHAPE, a segment not on copper layers
static constexpr int Millimeter2iu(double mm)
std::map< std::pair< BOARD_ITEM *, BOARD_ITEM * >, bool > m_InsideAreaCache
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
static const int UNCONNECTED
Constant that forces initialization of a netinfo item to the NETINFO_ITEM ORPHANED (typically -1) whe...
int GetCopperLayerCount() const
void FillItemMap(std::map< KIID, EDA_ITEM * > &aMap)
LSET m_LegacyVisibleLayers
Visibility settings stored in board prior to 6.0, only used for loading legacy files.
void ClearAllNetCodes()
Reset all items' netcodes to 0 (no net).
PCB_LAYER_ID ToLAYER_ID(int aLayer)
void SetEnabledLayers(LSET aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings.
std::vector< BOARD_LISTENER * > m_listeners
A specialization of ZONE for use in footprints.
void UseCustomTrackViaSize(bool aEnabled)
Enables/disables custom track/via size settings.
std::tuple< int, double, double > GetTrackLength(const PCB_TRACK &aTrack) const
Return data on the length and number of track segments connected to a given track.
FOOTPRINT * FindFootprintByReference(const wxString &aReference) const
Search for a FOOTPRINT within this board with the given reference designator.
KICAD_T Type() const
Returns the type of object.
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Container for design settings for a BOARD object.
std::map< std::pair< BOARD_ITEM *, BOARD_ITEM * >, bool > m_InsideFCourtyardCache
GAL_SET m_LegacyVisibleItems