KiCad PCB EDA Suite
BOARD Class Reference

Information pertinent to a Pcbnew printed circuit board. More...

#include <board.h>

Inheritance diagram for BOARD:
BOARD_ITEM_CONTAINER BOARD_ITEM EDA_ITEM KIGFX::VIEW_ITEM INSPECTABLE

Classes

struct  GroupLegalOpsField
 

Public Member Functions

void SetBoardUse (BOARD_USE aUse)
 Set what the board is going to be used for. More...
 
BOARD_USE GetBoardUse () const
 Get what the board use is. More...
 
void IncrementTimeStamp ()
 
int GetTimeStamp ()
 
bool IsFootprintHolder () const
 Find out if the board is being used to hold a single footprint for editing/viewing. More...
 
void SetFileName (const wxString &aFileName)
 
const wxString & GetFileName () const
 
TRACKS & Tracks ()
 
const TRACKS & Tracks () const
 
FOOTPRINTS & Footprints ()
 
const FOOTPRINTS & Footprints () const
 
DRAWINGS & Drawings ()
 
const DRAWINGS & Drawings () const
 
ZONESZones ()
 
const ZONESZones () const
 
MARKERS & Markers ()
 
const MARKERS & Markers () const
 
GROUPS & Groups ()
 The groups must maintain the following invariants. More...
 
const GROUPS & Groups () const
 
const std::vector< BOARD_CONNECTED_ITEM * > AllConnectedItems ()
 
const std::map< wxString, wxString > & GetProperties () const
 
void SetProperties (const std::map< wxString, wxString > &aProps)
 
bool ResolveTextVar (wxString *token, int aDepth) const
 
 BOARD ()
 
 ~BOARD ()
 
wxPoint GetPosition () const override
 
void SetPosition (const wxPoint &aPos) override
 
const wxPoint GetFocusPosition () const override
 Similar to GetPosition, but allows items to return their visual center rather than their anchor. More...
 
bool IsEmpty () const
 
void Move (const wxPoint &aMoveVector) override
 Move this object. More...
 
void SetFileFormatVersionAtLoad (int aVersion)
 
int GetFileFormatVersionAtLoad () const
 
void Add (BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
 Adds an item to the container. More...
 
void Remove (BOARD_ITEM *aBoardItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
 Removes an item from the container. More...
 
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. More...
 
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. More...
 
FOOTPRINTGetFirstFootprint () const
 Gets the first footprint on the board or nullptr. More...
 
void DeleteAllFootprints ()
 Removes all footprints from the deque and frees the memory associated with them. More...
 
BOARD_ITEMGetItem (const KIID &aID) const
 
void FillItemMap (std::map< KIID, EDA_ITEM * > &aMap)
 
wxString ConvertCrossReferencesToKIIDs (const wxString &aSource) const
 Convert cross-references back and forth between ${refDes:field} and ${kiid:field}. More...
 
wxString ConvertKIIDsToCrossReferences (const wxString &aSource) const
 
std::shared_ptr< CONNECTIVITY_DATAGetConnectivity () const
 Return a list of missing connections between components/tracks. More...
 
void BuildConnectivity ()
 Builds or rebuilds the board connectivity database for the board, especially the list of connected items, list of nets and rastnest data Needed after loading a board to have the connectivity database updated. More...
 
void DeleteMARKERs ()
 Delete all MARKERS from the board. More...
 
void DeleteMARKERs (bool aWarningsAndErrors, bool aExclusions)
 
PROJECTGetProject () const
 
void SetProject (PROJECT *aProject)
 Links a board to a given project. More...
 
void ClearProject ()
 
std::vector< PCB_MARKER * > ResolveDRCExclusions ()
 Rebuild DRC markers from the serialized data in BOARD_DESIGN_SETTINGS. More...
 
void ResetNetHighLight ()
 Reset all high light data to the init state. More...
 
const std::set< int > & GetHighLightNetCodes () const
 
void SetHighLightNet (int aNetCode, bool aMulti=false)
 Select the netcode to be highlighted. More...
 
bool IsHighLightNetON () const
 
void HighLightON (bool aValue=true)
 Enable or disable net highlighting. More...
 
void HighLightOFF ()
 Disable net highlight. More...
 
int GetCopperLayerCount () const
 
void SetCopperLayerCount (int aCount)
 
LSET GetEnabledLayers () const
 A proxy function that calls the corresponding function in m_BoardSettings Returns a bit-mask of all the layers that are enabled. More...
 
void SetEnabledLayers (LSET aLayerMask)
 A proxy function that calls the correspondent function in m_BoardSettings Changes the bit-mask of enabled layers. More...
 
bool IsLayerEnabled (PCB_LAYER_ID aLayer) const
 A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer is enabled. More...
 
bool IsLayerVisible (PCB_LAYER_ID aLayer) const
 A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer is visible. More...
 
LSET GetVisibleLayers () const
 A proxy function that calls the correspondent function in m_BoardSettings Returns a bit-mask of all the layers that are visible. More...
 
void SetVisibleLayers (LSET aLayerMask)
 A proxy function that calls the correspondent function in m_BoardSettings changes the bit-mask of visible layers. More...
 
GAL_SET GetVisibleElements () const
 Returns a set of all the element categories that are visible. More...
 
void SetVisibleElements (const GAL_SET &aMask)
 A proxy function that calls the correspondent function in m_BoardSettings changes the bit-mask of visible element categories. More...
 
void SetVisibleAlls ()
 Change the bit-mask of visible element categories and layers. More...
 
bool IsElementVisible (GAL_LAYER_ID aLayer) const
 Test whether a given element category is visible. More...
 
void SetElementVisibility (GAL_LAYER_ID aLayer, bool aNewState)
 Change the visibility of an element category. More...
 
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 visible. More...
 
BOARD_DESIGN_SETTINGSGetDesignSettings () const
 
const ZONE_SETTINGSGetZoneSettings () const override
 Fetch the zone settings for this container. More...
 
void SetZoneSettings (const ZONE_SETTINGS &aSettings) override
 Set the zone settings for this container. More...
 
const PAGE_INFOGetPageSettings () const
 
void SetPageSettings (const PAGE_INFO &aPageSettings)
 
const PCB_PLOT_PARAMSGetPlotOptions () const
 
void SetPlotOptions (const PCB_PLOT_PARAMS &aOptions)
 
TITLE_BLOCKGetTitleBlock ()
 
const TITLE_BLOCKGetTitleBlock () const
 
void SetTitleBlock (const TITLE_BLOCK &aTitleBlock)
 
wxString GetSelectMenuText (EDA_UNITS aUnits) const override
 Return the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position. More...
 
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 layer Any closed outline inside the main outline is a hole All contours should be closed, i.e. More...
 
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, texts, zones). More...
 
const PCB_LAYER_ID GetLayerID (const wxString &aLayerName) const
 Return the ID of a layer. More...
 
const wxString GetLayerName (PCB_LAYER_ID aLayer) const
 Return the name of a aLayer. More...
 
bool SetLayerName (PCB_LAYER_ID aLayer, const wxString &aLayerName)
 Changes the name of the layer given by aLayer. More...
 
bool SetLayerDescr (PCB_LAYER_ID aIndex, const LAYER &aLayer)
 Return the type of the copper layer given by aLayer. More...
 
LAYER_T GetLayerType (PCB_LAYER_ID aLayer) const
 Return the type of the copper layer given by aLayer. More...
 
bool SetLayerType (PCB_LAYER_ID aLayer, LAYER_T aLayerType)
 Change the type of the layer given by aLayer. More...
 
unsigned GetNodesCount (int aNet=-1) const
 
unsigned GetUnconnectedNetCount () const
 
unsigned GetPadCount () const
 
const std::vector< PAD * > GetPads () const
 Return a reference to a list of all the pads. More...
 
void BuildListOfNets ()
 
NETINFO_ITEMFindNet (int aNetcode) const
 Search for a net with the given netcode. More...
 
NETINFO_ITEMFindNet (const wxString &aNetname) const
 Search for a net with the given name. More...
 
const NETINFO_LISTGetNetInfo () const
 
NETINFO_LISTGetNetInfo ()
 
NETINFO_LIST::iterator BeginNets () const
 
NETINFO_LIST::iterator EndNets () const
 
unsigned GetNetCount () const
 
EDA_RECT ComputeBoundingBox (bool aBoardEdgesOnly=false) const
 Calculate the bounding box containing all board items (or board edge segments). More...
 
const EDA_RECT GetBoundingBox () const override
 Return the orthogonal bounding box of this object for display purposes. More...
 
const EDA_RECT GetBoardEdgesBoundingBox () const
 Returns the board bounding box calculated using exclusively the board edges (graphics on Edge.Cuts layer). More...
 
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. More...
 
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 data. More...
 
FOOTPRINTFindFootprintByReference (const wxString &aReference) const
 Search for a FOOTPRINT within this board with the given reference designator. More...
 
FOOTPRINTFindFootprintByPath (const KIID_PATH &aPath) const
 Search for a FOOTPRINT within this board with the given path. More...
 
int SortedNetnamesList (wxArrayString &aNames, bool aSortbyPadsCount)
 
std::vector< wxString > GetNetClassAssignmentCandidates () const
 Return a list of name candidates for netclass assignment. More...
 
void SynchronizeNetsAndNetClasses ()
 Copy NETCLASS info to each NET, based on NET membership in a NETCLASS. More...
 
void SynchronizeProperties ()
 Copy the current project's text variables into the boards property cache. More...
 
wxString GetClass () const override
 Return the class name. More...
 
int SetAreasNetCodesFromNetNames ()
 Set the .m_NetCode member of all copper areas, according to the area Net Name The SetNetCodesFromNetNames is an equivalent to net name, for fast comparisons. More...
 
ZONEGetArea (int index) const
 Return the Zone at a given index. More...
 
std::list< ZONE * > GetZoneList (bool aIncludeZonesInFootprints=false) const
 
int GetAreaCount () const
 
ZONEAddArea (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. More...
 
bool NormalizeAreaPolygon (PICKED_ITEMS_LIST *aNewZonesList, ZONE *aCurrArea)
 Process an area that has been modified, by normalizing its polygon against itself. More...
 
bool OnAreaPolygonModified (PICKED_ITEMS_LIST *aModifiedZonesList, ZONE *modified_area)
 Process an area that has been modified, by normalizing its polygon and merging the intersecting polygons for any other areas on the same net. More...
 
bool TestZoneIntersection (ZONE *aZone1, ZONE *aZone2)
 Test for intersection of 2 copper areas. More...
 
PADGetPad (const wxPoint &aPosition, LSET aLayerMask) const
 Find a pad aPosition on aLayer. More...
 
PADGetPad (const wxPoint &aPosition) const
 
PADGetPad (const TRACK *aTrace, ENDPOINT_T aEndPoint) const
 Find a pad connected to aEndPoint of aTrace. More...
 
PADGetPadFast (const wxPoint &aPosition, LSET aLayerMask) const
 Return pad found at aPosition on aLayerMask using the fast search method. More...
 
PADGetPad (std::vector< PAD * > &aPadList, const wxPoint &aPosition, LSET aLayerMask) const
 Locate the pad connected at aPosition on aLayer starting at list position aPad. More...
 
void PadDelete (PAD *aPad)
 Delete a given pad from the BOARD by removing it from its footprint and from the m_NetInfo. More...
 
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, and for increasing y coordinate for same values of x coordinates. More...
 
std::tuple< int, double, double > GetTrackLength (const TRACK &aTrack) const
 Returns data on the length and number of track segments connected to a given track. More...
 
TRACKS TracksInNet (int aNetCode)
 Collect all the TRACKs and VIAs that are members of a net given by aNetCode. More...
 
FOOTPRINTGetFootprint (const wxPoint &aPosition, PCB_LAYER_ID aActiveLayer, bool aVisibleOnly, bool aIgnoreLocked=false) const
 Get a footprint by its bounding rectangle at aPosition on aLayer. More...
 
void ClearAllNetCodes ()
 Reset all items' netcodes to 0 (no net). More...
 
void MapNets (const BOARD *aDestBoard)
 Map all nets in the given board to nets with the same name (if any) in the destination board. More...
 
void SanitizeNetcodes ()
 
void AddListener (BOARD_LISTENER *aListener)
 Add a listener to the board to receive calls whenever something on the board has been modified. More...
 
void RemoveListener (BOARD_LISTENER *aListener)
 Remove the specified listener. More...
 
void OnItemChanged (BOARD_ITEM *aItem)
 Notify the board and its listeners that an item on the board has been modified in some way. More...
 
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. More...
 
wxString GroupsSanityCheck (bool repair=false)
 
wxString GroupsSanityCheckInternal (bool repair)
 
GroupLegalOpsField GroupLegalOps (const PCB_SELECTION &selection) const
 
virtual void Delete (BOARD_ITEM *aItem)
 Removes an item from the container and deletes it. More...
 
void SetParentGroup (PCB_GROUP *aGroup)
 
PCB_GROUPGetParentGroup () const
 
int GetX () const
 
int GetY () const
 
virtual wxPoint GetCenter () const
 This defaults to the center of the bounding box if not overridden. More...
 
void SetX (int aX)
 
void SetY (int aY)
 
virtual bool IsConnected () const
 Returns information if the object is derived from BOARD_CONNECTED_ITEM. More...
 
virtual bool IsOnCopperLayer () const
 
virtual std::shared_ptr< SHAPEGetEffectiveShape (PCB_LAYER_ID aLayer=UNDEFINED_LAYER) const
 Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes. More...
 
BOARD_ITEM_CONTAINERGetParent () const
 
virtual PCB_LAYER_ID GetLayer () const
 Return the primary layer this item is on. More...
 
virtual LSET GetLayerSet () const
 Return a std::bitset of all layers on which the item physically resides. More...
 
virtual void SetLayerSet (LSET aLayers)
 
virtual void SetLayer (PCB_LAYER_ID aLayer)
 Set the layer this item is on. More...
 
virtual BOARD_ITEMDuplicate () const
 Create a copy of this BOARD_ITEM. More...
 
virtual void SwapData (BOARD_ITEM *aImage)
 Swap data between aItem and aImage. More...
 
virtual bool IsOnLayer (PCB_LAYER_ID aLayer) const
 Test to see if this object is on the given layer. More...
 
bool IsTrack () const
 Test to see if this object is a track or via (or microvia). More...
 
virtual bool IsLocked () const
 
virtual void SetLocked (bool aLocked)
 Modify the 'lock' status for of the item. More...
 
void DeleteStructure ()
 Delete this object after removing from its parent if it has one. More...
 
void Move (const VECTOR2I &aMoveVector)
 
virtual void Rotate (const wxPoint &aRotCentre, double aAngle)
 Rotate this object. More...
 
void Rotate (const VECTOR2I &aRotCentre, double aAngle)
 
virtual void Flip (const wxPoint &aCentre, bool aFlipLeftRight)
 Flip this object, i.e. More...
 
void Flip (const VECTOR2I &aCentre, bool aFlipLeftRight)
 
virtual BOARDGetBoard () const
 Return the BOARD in which this BOARD_ITEM resides, or NULL if none. More...
 
wxString GetLayerName () const
 Return the name of the PCB layer on which the item resides. More...
 
virtual void ViewGetLayers (int aLayers[], int &aCount) const override
 Return the all the layers within the VIEW the object is painted on. More...
 
virtual void TransformShapeWithClearanceToPolygon (SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearanceValue, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const
 Convert the item shape to a closed polygon. More...
 
KICAD_T Type () const
 Returns the type of object. More...
 
virtual void SetParent (EDA_ITEM *aParent)
 
bool IsModified () const
 
bool IsNew () const
 
bool IsMoving () const
 
bool IsDragging () const
 
bool IsWireImage () const
 
bool IsSelected () const
 
bool IsEntered () const
 
bool IsResized () const
 
bool IsBrightened () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (int type) const
 
void SetState (int type, bool state)
 
STATUS_FLAGS GetStatus () const
 
void SetStatus (STATUS_FLAGS aStatus)
 
void SetFlags (STATUS_FLAGS aMask)
 
void ClearFlags (STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
STATUS_FLAGS GetFlags () const
 
bool HasFlag (STATUS_FLAGS aFlag) const
 
STATUS_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
virtual bool IsType (const KICAD_T aScanTypes[]) const
 Check whether the item is one of the listed types. More...
 
void SetForceVisible (bool aEnable)
 Set and clear force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible. More...
 
bool IsForceVisible () const
 
virtual bool HitTest (const wxPoint &aPosition, int aAccuracy=0) const
 Test if aPosition is contained within or on the bounding box of an item. More...
 
virtual bool HitTest (const EDA_RECT &aRect, bool aContained, int aAccuracy=0) const
 Test if aRect intersects or is contained within the bounding box of an item. More...
 
virtual EDA_ITEMClone () const
 Create a duplicate of this item with linked list members set to NULL. More...
 
virtual BITMAPS GetMenuImage () const
 Return a pointer to an image to be used in menus. More...
 
virtual bool Matches (const wxFindReplaceData &aSearchData, void *aAuxData) const
 Compare the item against the search criteria in aSearchData. More...
 
virtual bool Replace (const wxFindReplaceData &aSearchData, void *aAuxData=nullptr)
 Perform a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Override this method in any derived object that supports test find and replace. More...
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
virtual const BOX2I ViewBBox () const override
 Return the bounding box of the item covering all its layers. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Draw the parts of the object belonging to layer aLayer. More...
 
virtual double ViewGetLOD (int aLayer, VIEW *aView) const
 Return the level of detail (LOD) of the item. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 
void ClearViewPrivData ()
 
bool Set (PROPERTY_BASE *aProperty, wxAny &aValue)
 
template<typename T >
bool Set (PROPERTY_BASE *aProperty, T aValue)
 
template<typename T >
bool Set (const wxString &aProperty, T aValue)
 
wxAny Get (PROPERTY_BASE *aProperty)
 
template<typename T >
Get (PROPERTY_BASE *aProperty)
 
template<typename T >
boost::optional< T > Get (const wxString &aProperty)
 

Static Public Member Functions

static bool ClassOf (const EDA_ITEM *aItem)
 
static wxString GetStandardLayerName (PCB_LAYER_ID aLayerId)
 Return an "English Standard" name of a PCB layer when given aLayerNumber. More...
 
static wxString ShowShape (PCB_SHAPE_TYPE_T aShape)
 Convert the enum PCB_SHAPE_TYPE_T integer value to a wxString. More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::deque< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 This changes first parameter to avoid the DList and use the main queue instead. More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::vector< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 Change first parameter to avoid the DList and use std::vector instead. More...
 
static bool Replace (const wxFindReplaceData &aSearchData, wxString &aText)
 Perform a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
static bool Sort (const EDA_ITEM *aLeft, const EDA_ITEM *aRight)
 Helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers. More...
 

Public Attributes

LSET m_LegacyVisibleLayers
 Visibility settings stored in board prior to 6.0, only used for loading legacy files. More...
 
GAL_SET m_LegacyVisibleItems
 
bool m_LegacyDesignSettingsLoaded
 True if the legacy board design settings were loaded from a file. More...
 
bool m_LegacyCopperEdgeClearanceLoaded
 
bool m_LegacyNetclassesLoaded
 True if netclasses were loaded from the file. More...
 
std::mutex m_CachesMutex
 
std::map< std::pair< BOARD_ITEM *, BOARD_ITEM * >, bool > m_InsideCourtyardCache
 
std::map< std::pair< BOARD_ITEM *, BOARD_ITEM * >, bool > m_InsideFCourtyardCache
 
std::map< std::pair< BOARD_ITEM *, BOARD_ITEM * >, bool > m_InsideBCourtyardCache
 
std::map< std::pair< BOARD_ITEM *, BOARD_ITEM * >, bool > m_InsideAreaCache
 
std::map< ZONE *, std::unique_ptr< DRC_RTREE > > m_CopperZoneRTrees
 
const KIID m_Uuid
 

Static Public Attributes

static wxPoint ZeroOffset
 A value of wxPoint(0,0) which can be passed to the Draw() functions. More...
 

Protected Member Functions

virtual wxString layerMaskDescribe () const
 Return a string (to be shown to the user) describing a layer mask. More...
 
bool Matches (const wxString &aText, const wxFindReplaceData &aSearchData) const
 Compare aText against search criteria in aSearchData. More...
 

Protected Attributes

PCB_LAYER_ID m_layer
 
PCB_GROUPm_group
 
STATUS_FLAGS m_status
 
EDA_ITEMm_parent
 Linked list: Link (parent struct) More...
 
bool m_forceVisible
 
STATUS_FLAGS m_flags
 

Private Member Functions

 BOARD (const BOARD &aOther)=delete
 
BOARDoperator= (const BOARD &aOther)=delete
 
template<typename Func , typename... Args>
void InvokeListeners (Func &&aFunc, Args &&... args)
 

Private Attributes

BOARD_USE m_boardUse
 What is this board being used for. More...
 
int m_timeStamp
 
wxString m_fileName
 
MARKERS m_markers
 
DRAWINGS m_drawings
 
FOOTPRINTS m_footprints
 
TRACKS m_tracks
 
GROUPS m_groups
 
ZONES m_zones
 
LAYER m_layers [PCB_LAYER_ID_COUNT]
 
HIGH_LIGHT_INFO m_highLight
 
HIGH_LIGHT_INFO m_highLightPrevious
 
int m_fileFormatVersionAtLoad
 
std::map< wxString, wxString > m_properties
 
std::shared_ptr< CONNECTIVITY_DATAm_connectivity
 
PAGE_INFO m_paper
 
TITLE_BLOCK m_titles
 
PCB_PLOT_PARAMS m_plotOptions
 
PROJECTm_project
 
std::unique_ptr< BOARD_DESIGN_SETTINGSm_designSettings
 All of the board design settings are stored as a JSON object inside the project file. More...
 
NETINFO_LIST m_NetInfo
 
std::vector< BOARD_LISTENER * > m_listeners
 

Friends

class PCB_EDIT_FRAME
 

Detailed Description

Information pertinent to a Pcbnew printed circuit board.

Definition at line 190 of file board.h.

Constructor & Destructor Documentation

◆ BOARD() [1/2]

BOARD::BOARD ( const BOARD aOther)
privatedelete

◆ BOARD() [2/2]

BOARD::BOARD ( )

Definition at line 59 of file board.cpp.

59  :
62  m_timeStamp( 1 ),
64  m_project( nullptr ),
65  m_designSettings( new BOARD_DESIGN_SETTINGS( nullptr, "board.design_settings" ) ),
66  m_NetInfo( this ),
70 {
71  // we have not loaded a board yet, assume latest until then.
72  m_fileFormatVersionAtLoad = LEGACY_BOARD_FILE_VERSION;
73 
74  for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
75  {
76  m_layers[layer].m_name = GetStandardLayerName( ToLAYER_ID( layer ) );
77 
78  if( IsCopperLayer( layer ) )
79  m_layers[layer].m_type = LT_SIGNAL;
80  else
81  m_layers[layer].m_type = LT_UNDEFINED;
82  }
83 
85 
86  // Initialize default netclass.
87  NETCLASS* defaultClass = bds.GetDefault();
88  defaultClass->SetDescription( _( "This is the default net class." ) );
89 
90  bds.UseCustomTrackViaSize( false );
91 
92  // Initialize ratsnest
93  m_connectivity.reset( new CONNECTIVITY_DATA() );
94 
95  // Set flag bits on these that will only be cleared if these are loaded from a legacy file
96  m_LegacyVisibleLayers.reset().set( Rescue );
98 }
Definition: typeinfo.h:84
bool m_LegacyDesignSettingsLoaded
True if the legacy board design settings were loaded from a file.
Definition: board.h:340
wxString m_name
The canonical name of the layer.
Definition: board.h:103
bool m_LegacyNetclassesLoaded
True if netclasses were loaded from the file.
Definition: board.h:344
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
PAGE_INFO m_paper
Definition: board.h:217
LAYER_T m_type
The type of the layer.
Definition: board.h:105
void SetDescription(const wxString &aDesc)
Definition: netclass.h:121
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.h:593
LAYER m_layers[PCB_LAYER_ID_COUNT]
Definition: board.h:207
This is the end of the layers used for visibility bit masks in Pcbnew.
NETINFO_LIST m_NetInfo
Definition: board.h:234
bool m_LegacyCopperEdgeClearanceLoaded
Definition: board.h:341
BOARD_USE m_boardUse
What is this board being used for.
Definition: board.h:196
#define NULL
#define GAL_LAYER_INDEX(x)
Use this macro to convert a GAL layer to a 0-indexed offset from LAYER_VIAS.
A collection of nets and the parameters used to route or test these nets.
Definition: netclass.h:46
static const wxChar A4[]
Definition: page_info.h:63
std::unique_ptr< BOARD_DESIGN_SETTINGS > m_designSettings
All of the board design settings are stored as a JSON object inside the project file.
Definition: board.h:232
int LAYER_NUM
This can be replaced with int and removed.
int m_fileFormatVersionAtLoad
Definition: board.h:212
#define _(s)
Definition: 3d_actions.cpp:33
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: board.h:215
NETCLASS * GetDefault() const
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
BOARD_ITEM_CONTAINER(BOARD_ITEM *aParent, KICAD_T aType)
LSET m_LegacyVisibleLayers
Visibility settings stored in board prior to 6.0, only used for loading legacy files.
Definition: board.h:336
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:905
void UseCustomTrackViaSize(bool aEnabled)
Enables/disables custom track/via size settings.
PROJECT * m_project
Definition: board.h:220
int m_timeStamp
Definition: board.h:197
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition: board.h:676
Container for design settings for a BOARD object.
GAL_SET m_LegacyVisibleItems
Definition: board.h:337

References _, A4, GAL_LAYER_ID_BITMASK_END, GAL_LAYER_INDEX, BOARD_DESIGN_SETTINGS::GetDefault(), GetDesignSettings(), GetStandardLayerName(), IsCopperLayer(), LT_SIGNAL, LT_UNDEFINED, m_connectivity, m_fileFormatVersionAtLoad, m_layers, m_LegacyVisibleItems, m_LegacyVisibleLayers, LAYER::m_name, LAYER::m_type, NORMAL, PCB_LAYER_ID_COUNT, Rescue, GAL_SET::set(), NETCLASS::SetDescription(), ToLAYER_ID(), and BOARD_DESIGN_SETTINGS::UseCustomTrackViaSize().

◆ ~BOARD()

BOARD::~BOARD ( )

Definition at line 101 of file board.cpp.

102 {
103  // Clean up the owned elements
104  DeleteMARKERs();
105 
106  for( ZONE* zone : m_zones )
107  delete zone;
108 
109  m_zones.clear();
110 
111  for( FOOTPRINT* footprint : m_footprints )
112  delete footprint;
113 
114  m_footprints.clear();
115 
116  for( TRACK* t : m_tracks )
117  delete t;
118 
119  m_tracks.clear();
120 
121  for( BOARD_ITEM* d : m_drawings )
122  delete d;
123 
124  m_drawings.clear();
125 
126  for( PCB_GROUP* g : m_groups )
127  delete g;
128 
129  m_groups.clear();
130 }
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:50
GROUPS m_groups
Definition: board.h:204
TRACKS m_tracks
Definition: board.h:203
void DeleteMARKERs()
Delete all MARKERS from the board.
Definition: board.cpp:781
ZONES m_zones
Definition: board.h:205
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
DRAWINGS m_drawings
Definition: board.h:201
FOOTPRINTS m_footprints
Definition: board.h:202
Definition: track.h:83

References DeleteMARKERs(), m_drawings, m_footprints, m_groups, m_tracks, and m_zones.

Member Function Documentation

◆ Add()

void BOARD::Add ( BOARD_ITEM aItem,
ADD_MODE  aMode = ADD_MODE::INSERT 
)
overridevirtual

Adds an item to the container.

Parameters
aModedecides whether the item is added in the beginning or at the end of the list.

Implements BOARD_ITEM_CONTAINER.

Definition at line 563 of file board.cpp.

564 {
565  if( aBoardItem == NULL )
566  {
567  wxFAIL_MSG( wxT( "BOARD::Add() param error: aBoardItem NULL" ) );
568  return;
569  }
570 
571  switch( aBoardItem->Type() )
572  {
573  case PCB_NETINFO_T:
574  m_NetInfo.AppendNet( (NETINFO_ITEM*) aBoardItem );
575  break;
576 
577  // this one uses a vector
578  case PCB_MARKER_T:
579  m_markers.push_back( (PCB_MARKER*) aBoardItem );
580  break;
581 
582  // this one uses a vector
583  case PCB_GROUP_T:
584  m_groups.push_back( (PCB_GROUP*) aBoardItem );
585  break;
586 
587  // this one uses a vector
588  case PCB_ZONE_T:
589  m_zones.push_back( (ZONE*) aBoardItem );
590  break;
591 
592  case PCB_TRACE_T:
593  case PCB_VIA_T:
594  case PCB_ARC_T:
595 
596  // N.B. This inserts a small memory leak as we lose the
597  if( !IsCopperLayer( aBoardItem->GetLayer() ) )
598  {
599  wxFAIL_MSG( wxT( "BOARD::Add() Cannot place Track on non-copper layer" ) );
600  return;
601  }
602 
603  if( aMode == ADD_MODE::APPEND || aMode == ADD_MODE::BULK_APPEND )
604  m_tracks.push_back( static_cast<TRACK*>( aBoardItem ) );
605  else
606  m_tracks.push_front( static_cast<TRACK*>( aBoardItem ) );
607 
608  break;
609 
610  case PCB_FOOTPRINT_T:
611  if( aMode == ADD_MODE::APPEND || aMode == ADD_MODE::BULK_APPEND )
612  m_footprints.push_back( static_cast<FOOTPRINT*>( aBoardItem ) );
613  else
614  m_footprints.push_front( static_cast<FOOTPRINT*>( aBoardItem ) );
615 
616  break;
617 
618  case PCB_DIM_ALIGNED_T:
619  case PCB_DIM_CENTER_T:
621  case PCB_DIM_LEADER_T:
622  case PCB_SHAPE_T:
623  case PCB_TEXT_T:
624  case PCB_TARGET_T:
625  if( aMode == ADD_MODE::APPEND || aMode == ADD_MODE::BULK_APPEND )
626  m_drawings.push_back( aBoardItem );
627  else
628  m_drawings.push_front( aBoardItem );
629 
630  break;
631 
632  // other types may use linked list
633  default:
634  {
635  wxString msg;
636  msg.Printf( wxT( "BOARD::Add() needs work: BOARD_ITEM type (%d) not handled" ),
637  aBoardItem->Type() );
638  wxFAIL_MSG( msg );
639  return;
640  }
641  break;
642  }
643 
644  aBoardItem->SetParent( this );
645  aBoardItem->ClearEditFlags();
646  m_connectivity->Add( aBoardItem );
647 
648  if( aMode != ADD_MODE::BULK_INSERT && aMode != ADD_MODE::BULK_APPEND )
649  InvokeListeners( &BOARD_LISTENER::OnBoardItemAdded, *this, aBoardItem );
650 }
void InvokeListeners(Func &&aFunc, Args &&... args)
Definition: board.h:245
class ALIGNED_DIMENSION, a linear dimension (graphic item)
Definition: typeinfo.h:100
class LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:101
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:108
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:50
GROUPS m_groups
Definition: board.h:204
class CENTER_DIMENSION, a center point marking (graphic item)
Definition: typeinfo.h:102
class PCB_TEXT, text on a layer
Definition: typeinfo.h:91
class ARC, an arc track segment on a copper layer
Definition: typeinfo.h:97
NETINFO_LIST m_NetInfo
Definition: board.h:234
TRACKS m_tracks
Definition: board.h:203
virtual void OnBoardItemAdded(BOARD &aBoard, BOARD_ITEM *aBoardItem)
Definition: board.h:160
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:166
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
void AppendNet(NETINFO_ITEM *aNewElement)
Add aNewElement to the end of the net list.
#define NULL
ZONES m_zones
Definition: board.h:205
virtual PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: zone.cpp:216
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
class ZONE, a copper pour area
Definition: typeinfo.h:105
MARKERS m_markers
Definition: board.h:200
DRAWINGS m_drawings
Definition: board.h:201
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:104
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
Handle the data for a net.
Definition: netinfo.h:64
class MARKER_PCB, a marker used to show something
Definition: typeinfo.h:98
class NETINFO_ITEM, a description of a net
Definition: typeinfo.h:107
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: board.h:215
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
FOOTPRINTS m_footprints
Definition: board.h:202
class ORTHOGONAL_DIMENSION, a linear dimension constrained to x/y
Definition: typeinfo.h:103
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
void ClearEditFlags()
Definition: eda_item.h:222
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References APPEND, NETINFO_LIST::AppendNet(), BULK_APPEND, BULK_INSERT, EDA_ITEM::ClearEditFlags(), ZONE::GetLayer(), InvokeListeners(), IsCopperLayer(), m_connectivity, m_drawings, m_footprints, m_groups, m_markers, m_NetInfo, m_tracks, m_zones, NULL, BOARD_LISTENER::OnBoardItemAdded(), PCB_ARC_T, PCB_DIM_ALIGNED_T, PCB_DIM_CENTER_T, PCB_DIM_LEADER_T, PCB_DIM_ORTHOGONAL_T, PCB_FOOTPRINT_T, PCB_GROUP_T, PCB_MARKER_T, PCB_NETINFO_T, PCB_SHAPE_T, PCB_TARGET_T, PCB_TEXT_T, PCB_TRACE_T, PCB_VIA_T, PCB_ZONE_T, EDA_ITEM::SetParent(), and EDA_ITEM::Type().

Referenced by NET_SELECTOR_COMBOPOPUP::Accept(), PCB_BASE_FRAME::AddFootprintToBoard(), PCAD2KICAD::PCB_TEXT::AddToBoard(), PCAD2KICAD::PCB_LINE::AddToBoard(), PCAD2KICAD::PCB_ARC::AddToBoard(), PCAD2KICAD::PCB_PAD::AddToBoard(), PCAD2KICAD::PCB_FOOTPRINT::AddToBoard(), PCAD2KICAD::PCB_POLYGON::AddToBoard(), PCAD2KICAD::PCB::AddToBoard(), PCAD2KICAD::PCB_PAD::AddToFootprint(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), CADSTAR_PCB_ARCHIVE_LOADER::createUniqueGroupID(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), DSN::SPECCTRA_DB::FromSESSION(), CADSTAR_PCB_ARCHIVE_LOADER::getKiCadNet(), GROUP_TOOL::Group(), ALTIUM_PCB::HelperCreateAndAddDrawsegment(), ALTIUM_PCB::HelperCreateBoardOutline(), ALTIUM_PCB::HelperParseDimensions6Center(), ALTIUM_PCB::HelperParseDimensions6Datum(), ALTIUM_PCB::HelperParseDimensions6Leader(), ALTIUM_PCB::HelperParseDimensions6Linear(), DISPLAY_FOOTPRINTS_FRAME::InitDisplay(), LEGACY_PLUGIN::loadAllSections(), CADSTAR_PCB_ARCHIVE_LOADER::loadAreas(), LoadBoard(), CADSTAR_PCB_ARCHIVE_LOADER::loadComponents(), CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers(), LEGACY_PLUGIN::loadDIMENSION(), CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions(), EAGLE_PLUGIN::loadElements(), FABMASTER::loadEtch(), FABMASTER::loadFootprints(), FABMASTER::loadGraphics(), CADSTAR_PCB_ARCHIVE_LOADER::loadGroups(), LEGACY_PLUGIN::loadNETINFO_ITEM(), FABMASTER::loadNets(), CADSTAR_PCB_ARCHIVE_LOADER::loadNetVia(), FABMASTER::loadOutline(), LEGACY_PLUGIN::loadPCB_LINE(), LEGACY_PLUGIN::loadPCB_TARGET(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), EAGLE_PLUGIN::loadPolygon(), FABMASTER::loadPolygon(), EAGLE_PLUGIN::loadSignals(), CADSTAR_PCB_ARCHIVE_LOADER::loadTemplates(), LEGACY_PLUGIN::loadTrackList(), FABMASTER::loadVias(), FABMASTER::loadZone(), LEGACY_PLUGIN::loadZONE_CONTAINER(), DIALOG_NET_INSPECTOR::onAddNet(), PANEL_PREV_3D::PANEL_PREV_3D(), ALTIUM_PCB::ParseArcs6Data(), ALTIUM_PCB::ParseComponents6Data(), ALTIUM_PCB::ParseFills6Data(), ALTIUM_PCB::ParseNets6Data(), ALTIUM_PCB::ParsePads6Data(), ALTIUM_PCB::ParsePolygons6Data(), ALTIUM_PCB::ParseShapeBasedRegions6Data(), ALTIUM_PCB::ParseTexts6Data(), ALTIUM_PCB::ParseTracks6Data(), ALTIUM_PCB::ParseVias6Data(), BOARD_COMMIT::Push(), FOOTPRINT_WIZARD_FRAME::ReloadFootprint(), BOARD_EDITOR_CONTROL::RepairBoard(), BOARD_COMMIT::Revert(), DIALOG_FOOTPRINT_CHECKER::runChecks(), and FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint().

◆ AddArea()

ZONE * BOARD::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.

Parameters
aNewZonesList= a PICKED_ITEMS_LIST * where to store new areas pickers (useful in undo commands) can be NULL
aNetcode= the netcode of the copper area (0 = no net)
aLayer= the layer of area
aStartPointPosition= position of the first point of the polygon outline of this area
aHatch= hatch option
Returns
a reference to the new area

Definition at line 1849 of file board.cpp.

1851 {
1852  ZONE* new_area = new ZONE( this );
1853 
1854  new_area->SetNetCode( aNetcode );
1855  new_area->SetLayer( aLayer );
1856 
1857  m_zones.push_back( new_area );
1858 
1859  new_area->SetHatchStyle( (ZONE_BORDER_DISPLAY_STYLE) aHatch );
1860 
1861  // Add the first corner to the new zone
1862  new_area->AppendCorner( aStartPointPosition, -1 );
1863 
1864  if( aNewZonesList )
1865  {
1866  ITEM_PICKER picker( nullptr, new_area, UNDO_REDO::NEWITEM );
1867  aNewZonesList->PushItem( picker );
1868  }
1869 
1870  return new_area;
1871 }
void SetHatchStyle(ZONE_BORDER_DISPLAY_STYLE aStyle)
Definition: zone.h:611
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
void PushItem(const ITEM_PICKER &aItem)
Push aItem to the top of the list.
ZONES m_zones
Definition: board.h:205
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
bool AppendCorner(wxPoint aPosition, int aHoleIdx, bool aAllowDuplication=false)
Add a new corner to the zone outline (to the main outline or a hole)
Definition: zone.cpp:833
ZONE_BORDER_DISPLAY_STYLE
Zone border styles.
Definition: zone_settings.h:46
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
Definition: zone.cpp:236

References ZONE::AppendCorner(), m_zones, NEWITEM, PICKED_ITEMS_LIST::PushItem(), ZONE::SetHatchStyle(), ZONE::SetLayer(), and BOARD_CONNECTED_ITEM::SetNetCode().

Referenced by NormalizeAreaPolygon().

◆ AddListener()

void BOARD::AddListener ( BOARD_LISTENER aListener)

Add a listener to the board to receive calls whenever something on the board has been modified.

The board does not take ownership of the listener object. Make sure to call RemoveListener before deleting the listener object. The order of listener invocations is not guaranteed. If the specified listener object has been added before, it will not be added again.

Definition at line 2013 of file board.cpp.

2014 {
2015  if( !alg::contains( m_listeners, aListener ) )
2016  m_listeners.push_back( aListener );
2017 }
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition: kicad_algo.h:81
std::vector< BOARD_LISTENER * > m_listeners
Definition: board.h:236

References alg::contains(), and m_listeners.

Referenced by DIALOG_NET_INSPECTOR::DIALOG_NET_INSPECTOR(), DIALOG_NET_INSPECTOR::onBoardChanged(), and APPEARANCE_CONTROLS::OnBoardChanged().

◆ AllConnectedItems()

const std::vector< BOARD_CONNECTED_ITEM * > BOARD::AllConnectedItems ( )

Definition at line 1962 of file board.cpp.

1963 {
1964  std::vector<BOARD_CONNECTED_ITEM*> items;
1965 
1966  for( TRACK* track : Tracks() )
1967  items.push_back( track );
1968 
1969  for( FOOTPRINT* footprint : Footprints() )
1970  {
1971  for( PAD* pad : footprint->Pads() )
1972  items.push_back( pad );
1973  }
1974 
1975  for( ZONE* zone : Zones() )
1976  items.push_back( zone );
1977 
1978  return items;
1979 }
ZONES & Zones()
Definition: board.h:311
FOOTPRINTS & Footprints()
Definition: board.h:305
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
Definition: pad.h:60
TRACKS & Tracks()
Definition: board.h:302
Definition: track.h:83

References Footprints(), pad, Tracks(), and Zones().

Referenced by ClearAllNetCodes(), MapNets(), and SanitizeNetcodes().

◆ BeginNets()

NETINFO_LIST::iterator BOARD::BeginNets ( ) const
inline
Returns
iterator to the first element of the NETINFO_ITEMs list

Definition at line 768 of file board.h.

769  {
770  return m_NetInfo.begin();
771  }
NETINFO_LIST m_NetInfo
Definition: board.h:234
iterator begin() const
Definition: netinfo.h:436

References NETINFO_LIST::begin(), and m_NetInfo.

◆ BuildConnectivity()

void BOARD::BuildConnectivity ( )

Builds or rebuilds the board connectivity database for the board, especially the list of connected items, list of nets and rastnest data Needed after loading a board to have the connectivity database updated.

Definition at line 133 of file board.cpp.

134 {
135  GetConnectivity()->Build( this );
136 }
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:416

References GetConnectivity().

Referenced by PCB_CONTROL::AppendBoard(), TRACKS_CLEANER::cleanup(), TRACKS_CLEANER::deleteDanglingTracks(), LoadBoard(), PCB_EDIT_FRAME::OpenProjectFiles(), PCB_CONTROL::Paste(), Refresh(), SaveBoard(), PANEL_SETUP_LAYERS::TransferDataFromWindow(), and PCB_EDIT_FRAME::UpdateUserInterface().

◆ BuildListOfNets()

◆ ClassOf()

static bool BOARD::ClassOf ( const EDA_ITEM aItem)
inlinestatic

Definition at line 252 of file board.h.

253  {
254  return aItem && PCB_T == aItem->Type();
255  }
Definition: typeinfo.h:84
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References PCB_T, and EDA_ITEM::Type().

◆ ClearAllNetCodes()

void BOARD::ClearAllNetCodes ( )

Reset all items' netcodes to 0 (no net).

Definition at line 1982 of file board.cpp.

1983 {
1984  for( BOARD_CONNECTED_ITEM* item : AllConnectedItems() )
1985  item->SetNetCode( 0 );
1986 }
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
const std::vector< BOARD_CONNECTED_ITEM * > AllConnectedItems()
Definition: board.cpp:1962

References AllConnectedItems().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

◆ ClearEditFlags()

◆ ClearFlags()

void EDA_ITEM::ClearFlags ( STATUS_FLAGS  aMask = EDA_ITEM_ALL_FLAGS)
inlineinherited

Definition at line 204 of file eda_item.h.

204 { m_flags &= ~aMask; }
STATUS_FLAGS m_flags
Definition: eda_item.h:531

References EDA_ITEM::m_flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_MOVE_TOOL::AlignElements(), FOOTPRINT::BuildPolyCourtyards(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), ConvertOutlineToPolygon(), SCH_EDIT_FRAME::ConvertPart(), SYMBOL_EDITOR_EDIT_TOOL::Copy(), FOOTPRINT_EDITOR_CONTROL::CreateFootprint(), SYMBOL_EDITOR_PIN_TOOL::CreateImagePins(), MICROWAVE_TOOL::createMicrowaveInductor(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), KIGFX::SCH_PAINTER::draw(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), SCH_ITEM::Duplicate(), PCB_EDIT_FRAME::ExchangeFootprint(), PCB_SELECTION_TOOL::ExitGroup(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary(), EE_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::narrowSelection(), FOOTPRINT_EDITOR_CONTROL::NewFootprint(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), PCB_BASE_FRAME::PlaceFootprint(), SYMBOL_EDITOR_PIN_TOOL::PlacePin(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDIT_FRAME::RollbackSymbolFromUndo(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN_CACHE::savePin(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ ClearProject()

void BOARD::ClearProject ( )

Definition at line 169 of file board.cpp.

170 {
171  if( !m_project )
172  return;
173 
175 
176  // Owned by the BOARD
177  if( project.m_BoardSettings )
178  {
179  project.ReleaseNestedSettings( project.m_BoardSettings );
180  project.m_BoardSettings = nullptr;
181  }
182 
183  GetDesignSettings().SetParent( nullptr );
184  m_project = nullptr;
185 }
void SetParent(JSON_SETTINGS *aParent, bool aLoadFromFile=true)
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:145
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.h:593
The backing store for a PROJECT, in JSON format.
Definition: project_file.h:64
PROJECT * m_project
Definition: board.h:220

References GetDesignSettings(), PROJECT::GetProjectFile(), m_project, project, and NESTED_SETTINGS::SetParent().

Referenced by PCB_EDIT_FRAME::doCloseWindow(), PCB_EDIT_FRAME::Files_io_from_id(), DIALOG_BOARD_SETUP::OnAuxiliaryAction(), PCB_EDIT_FRAME::OpenProjectFiles(), and SetProject().

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 216 of file eda_item.h.

217  {
219  DO_NOT_DRAW );
220  }
#define TEMP_SELECTED
flag indicating that the structure has already selected
Definition: eda_item.h:115
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: eda_item.h:104
#define CANDIDATE
flag indicating that the structure is connected
Definition: eda_item.h:117
#define DO_NOT_DRAW
Used to disable draw function.
Definition: eda_item.h:119
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: eda_item.h:112
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:204
#define ENDPOINT
ends. (Used to support dragging.)
Definition: eda_item.h:113
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: eda_item.h:118

References CANDIDATE, EDA_ITEM::ClearFlags(), DO_NOT_DRAW, ENDPOINT, IS_LINKED, SKIP_STRUCT, STARTPOINT, and TEMP_SELECTED.

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 148 of file view_item.h.

149  {
150  m_viewPrivData = nullptr;
151  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:156

References KIGFX::VIEW_ITEM::m_viewPrivData.

Referenced by KIGFX::VIEW::OnDestroy().

◆ Clone()

EDA_ITEM * EDA_ITEM::Clone ( ) const
virtualinherited

Create a duplicate of this item with linked list members set to NULL.

The default version will return NULL in release builds and likely crash the program. In debug builds, a warning message indicating the derived class has not implemented cloning. This really should be a pure virtual function. Due to the fact that there are so many objects derived from EDA_ITEM, the decision was made to return NULL until all the objects derived from EDA_ITEM implement cloning. Once that happens, this function should be made pure.

Returns
A clone of the item.

Reimplemented in FP_ZONE, ZONE, SCH_COMPONENT, PAD, FOOTPRINT, SCH_HIERLABEL, CENTER_DIMENSION, LEADER, ORTHOGONAL_DIMENSION, VIA, SCH_GLOBALLABEL, SCH_SHEET, SCH_LABEL, ALIGNED_DIMENSION, PCB_SHAPE, ARC, SCH_TEXT, SCH_LINE, LIB_PIN, FP_TEXT, TRACK, SCH_BUS_BUS_ENTRY, SCH_FIELD, LIB_FIELD, SCH_SHEET_PIN, SCH_BUS_WIRE_ENTRY, FP_SHAPE, SCH_BITMAP, PCB_TEXT, PCB_GROUP, LIB_ARC, LIB_TEXT, SCH_NO_CONNECT, SCH_JUNCTION, SCH_MARKER, LIB_POLYLINE, PCB_TARGET, LIB_CIRCLE, LIB_BEZIER, LIB_RECTANGLE, and KIGFX::ORIGIN_VIEWITEM.

Definition at line 81 of file eda_item.cpp.

82 {
83  wxCHECK_MSG( false, NULL, wxT( "Clone not implemented in derived class " ) + GetClass() +
84  wxT( ". Bad programmer!" ) );
85 }
#define NULL
virtual wxString GetClass() const =0
Return the class name.

References EDA_ITEM::GetClass(), and NULL.

Referenced by DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), BOARD_ITEM::Duplicate(), SCH_ITEM::Duplicate(), DIMENSION_BASE::GetEffectiveShape(), LIB_PART::LIB_PART(), new_clone(), LIB_PART::operator=(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), SCH_SEXPR_PLUGIN_CACHE::removeSymbol(), SCH_LEGACY_PLUGIN_CACHE::removeSymbol(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), CLIPBOARD_IO::SaveSelection(), LIB_PART::SetConversion(), LIB_PART::SetUnitCount(), SCH_DRAWING_TOOLS::SingleClickPlace(), COMMIT::Stage(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ ComputeBoundingBox()

EDA_RECT BOARD::ComputeBoundingBox ( bool  aBoardEdgesOnly = false) const

Calculate the bounding box containing all board items (or board edge segments).

Parameters
aBoardEdgesOnlyis true if we are interested in board edge segments only.
Returns
EDA_RECT - the board's bounding box

Definition at line 1050 of file board.cpp.

1051 {
1052  EDA_RECT area;
1053  LSET visible = GetVisibleLayers();
1054  bool showInvisibleText = IsElementVisible( LAYER_MOD_TEXT_INVISIBLE )
1055  && PgmOrNull() && !PgmOrNull()->m_Printing;
1056 
1057  if( aBoardEdgesOnly )
1058  visible.set( Edge_Cuts );
1059 
1060  // Check shapes, dimensions, texts, and fiducials
1061  for( BOARD_ITEM* item : m_drawings )
1062  {
1063  if( aBoardEdgesOnly && ( item->GetLayer() != Edge_Cuts || item->Type() != PCB_SHAPE_T ) )
1064  continue;
1065 
1066  if( ( item->GetLayerSet() & visible ).any() )
1067  area.Merge( item->GetBoundingBox() );
1068  }
1069 
1070  // Check footprints
1071  for( FOOTPRINT* footprint : m_footprints )
1072  {
1073  if( !( footprint->GetLayerSet() & visible ).any() )
1074  continue;
1075 
1076  if( aBoardEdgesOnly )
1077  {
1078  for( const BOARD_ITEM* edge : footprint->GraphicalItems() )
1079  {
1080  if( edge->GetLayer() == Edge_Cuts && edge->Type() == PCB_FP_SHAPE_T )
1081  area.Merge( edge->GetBoundingBox() );
1082  }
1083  }
1084  else
1085  {
1086  area.Merge( footprint->GetBoundingBox( true, showInvisibleText ) );
1087  }
1088  }
1089 
1090  if( !aBoardEdgesOnly )
1091  {
1092  // Check tracks
1093  for( TRACK* track : m_tracks )
1094  {
1095  if( ( track->GetLayerSet() & visible ).any() )
1096  area.Merge( track->GetBoundingBox() );
1097  }
1098 
1099  // Check zones
1100  for( ZONE* aZone : m_zones )
1101  {
1102  if( ( aZone->GetLayerSet() & visible ).any() )
1103  area.Merge( aZone->GetBoundingBox() );
1104  }
1105  }
1106 
1107  return area;
1108 }
void Merge(const EDA_RECT &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: eda_rect.cpp:431
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
LSET GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings Returns a bit-mask of all t...
Definition: board.cpp:461
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
TRACKS m_tracks
Definition: board.h:203
LSET is a set of PCB_LAYER_IDs.
PGM_BASE * PgmOrNull()
similar to PGM_BASE& Pgm(), but return a reference that can be nullptr when running a shared lib from...
Definition: cvpcb.cpp:112
ZONES m_zones
Definition: board.h:205
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
DRAWINGS m_drawings
Definition: board.h:201
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
Definition: board.cpp:507
bool m_Printing
wxWidgets on MSW tends to crash if you spool up more than one print job at a time.
Definition: pgm_base.h:330
Handle the component boundary box.
Definition: eda_rect.h:42
FOOTPRINTS m_footprints
Definition: board.h:202
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90
Definition: track.h:83

References Edge_Cuts, GetVisibleLayers(), IsElementVisible(), LAYER_MOD_TEXT_INVISIBLE, m_drawings, m_footprints, PGM_BASE::m_Printing, m_tracks, m_zones, EDA_RECT::Merge(), PCB_FP_SHAPE_T, PCB_SHAPE_T, and PgmOrNull().

Referenced by buildBoardBoundingBoxPoly(), BuildBoardPolygonOutlines(), DIALOG_EXPORT_SVG::CreateSVGFile(), DRAWING_TOOL::DrawBoardCharacteristics(), PCB_EDIT_FRAME::ExportToGenCAD(), PLACE_FILE_EXPORTER::GenReportData(), GetBoardEdgesBoundingBox(), PCBNEW_PRINTOUT::getBoundingBox(), GetBoundingBox(), initializePlotter(), BOARD_ADAPTER::InitSettings(), DIALOG_EXPORT_STEP::onExportButton(), and StartPlotBoard().

◆ ConvertBrdLayerToPolygonalContours()

void BOARD::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, texts, zones).

Holes in vias or pads are ignored. The polygons are not merged. Useful to export the shape of copper layers to dxf polygons or 3D viewer

Parameters
aLayer= A copper layer, like B_Cu, etc.
aOutlinesThe SHAPE_POLY_SET to fill in with items outline.

Definition at line 69 of file board_items_to_polygon_shape_transform.cpp.

70 {
71  int maxError = GetDesignSettings().m_MaxError;
72 
73  // convert tracks and vias:
74  for( const TRACK* track : m_tracks )
75  {
76  if( !track->IsOnLayer( aLayer ) )
77  continue;
78 
79  track->TransformShapeWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
80  ERROR_INSIDE );
81  }
82 
83  // convert pads and other copper items in footprints
84  for( const FOOTPRINT* footprint : m_footprints )
85  {
86  footprint->TransformPadsWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
87  ERROR_INSIDE );
88 
89  // Micro-wave footprints may have items on copper layers
90  footprint->TransformFPShapesWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
92  true, /* include text */
93  true /* include shapes */ );
94 
95  for( const ZONE* zone : footprint->Zones() )
96  {
97  if( zone->GetLayerSet().test( aLayer ) )
98  zone->TransformSolidAreasShapesToPolygon( aLayer, aOutlines );
99  }
100  }
101 
102  // convert copper zones
103  for( const ZONE* zone : Zones() )
104  {
105  if( zone->GetLayerSet().test( aLayer ) )
106  zone->TransformSolidAreasShapesToPolygon( aLayer, aOutlines );
107  }
108 
109  // convert graphic items on copper layers (texts)
110  for( const BOARD_ITEM* item : m_drawings )
111  {
112  if( !item->IsOnLayer( aLayer ) )
113  continue;
114 
115  switch( item->Type() )
116  {
117  case PCB_SHAPE_T:
118  {
119  const PCB_SHAPE* shape = static_cast<const PCB_SHAPE*>( item );
120  shape->TransformShapeWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
121  ERROR_INSIDE );
122  }
123  break;
124 
125  case PCB_TEXT_T:
126  {
127  const PCB_TEXT* text = static_cast<const PCB_TEXT*>( item );
128  text->TransformTextShapeWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
129  ERROR_INSIDE );
130  }
131  break;
132 
133  default:
134  break;
135  }
136  }
137 }
ZONES & Zones()
Definition: board.h:311
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
class PCB_TEXT, text on a layer
Definition: typeinfo.h:91
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.h:593
TRACKS m_tracks
Definition: board.h:203
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
DRAWINGS m_drawings
Definition: board.h:201
FOOTPRINTS m_footprints
Definition: board.h:202
void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearanceValue, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
Function TransformShapeWithClearanceToPolygon Convert the draw segment to a closed polygon Used in fi...
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90
Definition: track.h:83

References ERROR_INSIDE, GetDesignSettings(), m_drawings, m_footprints, BOARD_DESIGN_SETTINGS::m_MaxError, m_tracks, PCB_SHAPE_T, PCB_TEXT_T, text, PCB_SHAPE::TransformShapeWithClearanceToPolygon(), and Zones().

Referenced by EXPORTER_PCB_VRML::ExportStandardLayers(), EXPORTER_PCB_VRML::ExportVrmlSolderMask(), and PlotLayerOutlines().

◆ ConvertCrossReferencesToKIIDs()

wxString BOARD::ConvertCrossReferencesToKIIDs ( const wxString &  aSource) const

Convert cross-references back and forth between ${refDes:field} and ${kiid:field}.

Definition at line 928 of file board.cpp.

929 {
930  wxString newbuf;
931  size_t sourceLen = aSource.length();
932 
933  for( size_t i = 0; i < sourceLen; ++i )
934  {
935  if( aSource[i] == '$' && i + 1 < sourceLen && aSource[i+1] == '{' )
936  {
937  wxString token;
938  bool isCrossRef = false;
939 
940  for( i = i + 2; i < sourceLen; ++i )
941  {
942  if( aSource[i] == '}' )
943  break;
944 
945  if( aSource[i] == ':' )
946  isCrossRef = true;
947 
948  token.append( aSource[i] );
949  }
950 
951  if( isCrossRef )
952  {
953  wxString remainder;
954  wxString ref = token.BeforeFirst( ':', &remainder );
955 
956  for( const FOOTPRINT* footprint : Footprints() )
957  {
958  if( footprint->GetReference().CmpNoCase( ref ) == 0 )
959  {
960  wxString test( remainder );
961 
962  if( footprint->ResolveTextVar( &test ) )
963  token = footprint->m_Uuid.AsString() + ":" + remainder;
964 
965  break;
966  }
967  }
968  }
969 
970  newbuf.append( "${" + token + "}" );
971  }
972  else
973  {
974  newbuf.append( aSource[i] );
975  }
976  }
977 
978  return newbuf;
979 }
FOOTPRINTS & Footprints()
Definition: board.h:305

References Footprints().

Referenced by DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), and DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog().

◆ ConvertKIIDsToCrossReferences()

wxString BOARD::ConvertKIIDsToCrossReferences ( const wxString &  aSource) const

Definition at line 982 of file board.cpp.

983 {
984  wxString newbuf;
985  size_t sourceLen = aSource.length();
986 
987  for( size_t i = 0; i < sourceLen; ++i )
988  {
989  if( aSource[i] == '$' && i + 1 < sourceLen && aSource[i+1] == '{' )
990  {
991  wxString token;
992  bool isCrossRef = false;
993 
994  for( i = i + 2; i < sourceLen; ++i )
995  {
996  if( aSource[i] == '}' )
997  break;
998 
999  if( aSource[i] == ':' )
1000  isCrossRef = true;
1001 
1002  token.append( aSource[i] );
1003  }
1004 
1005  if( isCrossRef )
1006  {
1007  wxString remainder;
1008  wxString ref = token.BeforeFirst( ':', &remainder );
1009  BOARD_ITEM* refItem = GetItem( KIID( ref ) );
1010 
1011  if( refItem && refItem->Type() == PCB_FOOTPRINT_T )
1012  token = static_cast<FOOTPRINT*>( refItem )->GetReference() + ":" + remainder;
1013  }
1014 
1015  newbuf.append( "${" + token + "}" );
1016  }
1017  else
1018  {
1019  newbuf.append( aSource[i] );
1020  }
1021  }
1022 
1023  return newbuf;
1024 }
BOARD_ITEM * GetItem(const KIID &aID) const
Definition: board.cpp:813
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
Definition: kiid.h:44
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References GetItem(), PCB_FOOTPRINT_T, and EDA_ITEM::Type().

Referenced by DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow(), and DIALOG_TEXT_PROPERTIES::TransferDataToWindow().

◆ Delete()

virtual void BOARD_ITEM_CONTAINER::Delete ( BOARD_ITEM aItem)
inlinevirtualinherited

Removes an item from the container and deletes it.

Definition at line 74 of file board_item_container.h.

75  {
76  Remove( aItem );
77  delete aItem;
78  }
virtual void Remove(BOARD_ITEM *aItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL)=0
Removes an item from the container.

References BOARD_ITEM_CONTAINER::Remove().

Referenced by BOARD_DRC_ITEMS_PROVIDER::DeleteItem(), and BOARD_COMMIT::Push().

◆ DeleteAllFootprints()

void BOARD::DeleteAllFootprints ( )
inline

Removes all footprints from the deque and frees the memory associated with them.

Definition at line 390 of file board.h.

391  {
392  for( FOOTPRINT* footprint : m_footprints )
393  delete footprint;
394 
395  m_footprints.clear();
396  }
FOOTPRINTS m_footprints
Definition: board.h:202

References m_footprints.

Referenced by FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), DISPLAY_FOOTPRINTS_FRAME::InitDisplay(), FOOTPRINT_WIZARD_FRAME::ReloadFootprint(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), and DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME().

◆ DeleteMARKERs() [1/2]

void BOARD::DeleteMARKERs ( )

Delete all MARKERS from the board.

Definition at line 781 of file board.cpp.

782 {
783  // the vector does not know how to delete the PCB_MARKER, it holds pointers
784  for( PCB_MARKER* marker : m_markers )
785  delete marker;
786 
787  m_markers.clear();
788 }
MARKERS m_markers
Definition: board.h:200

References m_markers.

Referenced by BOARD_DRC_ITEMS_PROVIDER::DeleteAllItems(), DIALOG_GLOBAL_DELETION::doGlobalDeletions(), DSN::SPECCTRA_DB::FromSESSION(), and ~BOARD().

◆ DeleteMARKERs() [2/2]

void BOARD::DeleteMARKERs ( bool  aWarningsAndErrors,
bool  aExclusions 
)

Definition at line 791 of file board.cpp.

792 {
793  // Deleting lots of items from a vector can be very slow. Copy remaining items instead.
794  MARKERS remaining;
795 
796  for( PCB_MARKER* marker : m_markers )
797  {
798  if( ( marker->IsExcluded() && aExclusions )
799  || ( !marker->IsExcluded() && aWarningsAndErrors ) )
800  {
801  delete marker;
802  }
803  else
804  {
805  remaining.push_back( marker );
806  }
807  }
808 
809  m_markers = remaining;
810 }
MARKERS m_markers
Definition: board.h:200

References m_markers.

◆ DeleteStructure()

void BOARD_ITEM::DeleteStructure ( )
inherited

Delete this object after removing from its parent if it has one.

Definition at line 113 of file board_item.cpp.

114 {
115  BOARD_ITEM_CONTAINER* parent = GetParent();
116 
117  if( parent )
118  parent->Remove( this );
119 
120  delete this;
121 }
virtual void Remove(BOARD_ITEM *aItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL)=0
Removes an item from the container.
Abstract interface for BOARD_ITEMs capable of storing other items inside.
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:168

References BOARD_ITEM::GetParent(), and BOARD_ITEM_CONTAINER::Remove().

Referenced by PadDelete(), and DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow().

◆ Drawings() [1/2]

◆ Drawings() [2/2]

const DRAWINGS& BOARD::Drawings ( ) const
inline

Definition at line 309 of file board.h.

309 { return m_drawings; }
DRAWINGS m_drawings
Definition: board.h:201

References m_drawings.

◆ Duplicate()

virtual BOARD_ITEM* BOARD_ITEM::Duplicate ( ) const
inlinevirtualinherited

Create a copy of this BOARD_ITEM.

Reimplemented in FOOTPRINT.

Definition at line 202 of file board_item.h.

203  {
204  EDA_ITEM* dupe = Clone();
205  const_cast<KIID&>( dupe->m_Uuid ) = KIID();
206 
207  return static_cast<BOARD_ITEM*>( dupe );
208  }
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition: eda_item.cpp:81
Definition: kiid.h:44
const KIID m_Uuid
Definition: eda_item.h:525
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150

References EDA_ITEM::Clone(), and EDA_ITEM::m_Uuid.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), PCB_GROUP::DeepDuplicate(), KIGFX::PCB_PAINTER::draw(), DRAWING_TOOL::DrawBoardCharacteristics(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), DRAWING_TOOL::DrawSpecificationStackup(), EDIT_TOOL::Duplicate(), and ARRAY_CREATOR::Invoke().

◆ EndNets()

NETINFO_LIST::iterator BOARD::EndNets ( ) const
inline
Returns
iterator to the last element of the NETINFO_ITEMs list

Definition at line 776 of file board.h.

777  {
778  return m_NetInfo.end();
779  }
iterator end() const
Definition: netinfo.h:441
NETINFO_LIST m_NetInfo
Definition: board.h:234

References NETINFO_LIST::end(), and m_NetInfo.

◆ FillItemMap()

void BOARD::FillItemMap ( std::map< KIID, EDA_ITEM * > &  aMap)

Definition at line 892 of file board.cpp.

893 {
894  // the board itself
895  aMap[ m_Uuid ] = this;
896 
897  for( TRACK* track : Tracks() )
898  aMap[ track->m_Uuid ] = track;
899 
900  for( FOOTPRINT* footprint : Footprints() )
901  {
902  aMap[ footprint->m_Uuid ] = footprint;
903 
904  for( PAD* pad : footprint->Pads() )
905  aMap[ pad->m_Uuid ] = pad;
906 
907  aMap[ footprint->Reference().m_Uuid ] = &footprint->Reference();
908  aMap[ footprint->Value().m_Uuid ] = &footprint->Value();
909 
910  for( BOARD_ITEM* drawing : footprint->GraphicalItems() )
911  aMap[ drawing->m_Uuid ] = drawing;
912  }
913 
914  for( ZONE* zone : Zones() )
915  aMap[ zone->m_Uuid ] = zone;
916 
917  for( BOARD_ITEM* drawing : Drawings() )
918  aMap[ drawing->m_Uuid ] = drawing;
919 
920  for( PCB_MARKER* marker : m_markers )
921  aMap[ marker->m_Uuid ] = marker;
922 
923  for( PCB_GROUP* group : m_groups )
924  aMap[ group->m_Uuid ] = group;
925 }
ZONES & Zones()
Definition: board.h:311
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:50
GROUPS m_groups
Definition: board.h:204
FOOTPRINTS & Footprints()
Definition: board.h:305
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
MARKERS m_markers
Definition: board.h:200
const KIID m_Uuid
Definition: eda_item.h:525
Definition: pad.h:60
DRAWINGS & Drawings()
Definition: board.h:308
TRACKS & Tracks()
Definition: board.h:302
Definition: track.h:83

References Drawings(), Footprints(), group, m_groups, m_markers, EDA_ITEM::m_Uuid, pad, Tracks(), and Zones().

Referenced by WriteDRCReport(), and DIALOG_DRC::writeReport().

◆ FinalizeBulkAdd()

void BOARD::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.

Definition at line 653 of file board.cpp.

654 {
656 }
void InvokeListeners(Func &&aFunc, Args &&... args)
Definition: board.h:245
virtual void OnBoardItemsAdded(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItem)
Definition: board.h:161

References InvokeListeners(), and BOARD_LISTENER::OnBoardItemsAdded().

Referenced by BOARD_COMMIT::Push(), and BOARD_COMMIT::Revert().

◆ FinalizeBulkRemove()

void BOARD::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.

Definition at line 659 of file board.cpp.

660 {
661  InvokeListeners( &BOARD_LISTENER::OnBoardItemsRemoved, *this, aRemovedItems );
662 }
void InvokeListeners(Func &&aFunc, Args &&... args)
Definition: board.h:245
virtual void OnBoardItemsRemoved(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItem)
Definition: board.h:163

References InvokeListeners(), and BOARD_LISTENER::OnBoardItemsRemoved().

Referenced by BOARD_COMMIT::Push(), and BOARD_COMMIT::Revert().

◆ FindFootprintByPath()

FOOTPRINT * BOARD::FindFootprintByPath ( const KIID_PATH aPath) const

Search for a FOOTPRINT within this board with the given path.

Parameters
aPathThe path ([sheetUUID, .., symbolUUID]) to search for.
Returns
FOOTPRINT* - If found, the FOOTPRINT having the given uuid, else NULL.

Definition at line 1322 of file board.cpp.

1323 {
1324  for( FOOTPRINT* footprint : m_footprints )
1325  {
1326  if( footprint->GetPath() == aPath )
1327  return footprint;
1328  }
1329 
1330  return nullptr;
1331 }
FOOTPRINTS m_footprints
Definition: board.h:202

References m_footprints.

◆ FindFootprintByReference()

FOOTPRINT * BOARD::FindFootprintByReference ( const wxString &  aReference) const

Search for a FOOTPRINT within this board with the given reference designator.

Finds only the first one, if there is more than one such FOOTPRINT.

Parameters
aReferenceThe reference designator of the FOOTPRINT to find.
Returns
FOOTPRINT* - If found, the FOOTPRINT having the given reference designator, else nullptr.

Definition at line 1310 of file board.cpp.

1311 {
1312  for( FOOTPRINT* footprint : m_footprints )
1313  {
1314  if( aReference == footprint->GetReference() )
1315  return footprint;
1316  }
1317 
1318  return nullptr;
1319 }
FOOTPRINTS m_footprints
Definition: board.h:202

References m_footprints.

Referenced by PCB_EDIT_FRAME::ExecuteRemoteCommand(), DSN::SPECCTRA_DB::FromSESSION(), and DRC_TEST_PROVIDER_LVS::testFootprints().

◆ FindNet() [1/2]

NETINFO_ITEM * BOARD::FindNet ( int  aNetcode) const

Search for a net with the given netcode.

Parameters
aNetcodeA netcode to search for.
Returns
NETINFO_ITEM_ITEM* - the net or NULL if not found.

Definition at line 1289 of file board.cpp.

1290 {
1291  // the first valid netcode is 1 and the last is m_NetInfo.GetCount()-1.
1292  // zero is reserved for "no connection" and is not actually a net.
1293  // NULL is returned for non valid netcodes
1294 
1295  wxASSERT( m_NetInfo.GetNetCount() > 0 );
1296 
1297  if( aNetcode == NETINFO_LIST::UNCONNECTED && m_NetInfo.GetNetCount() == 0 )
1298  return NETINFO_LIST::OrphanedItem();
1299  else
1300  return m_NetInfo.GetNetItem( aNetcode );
1301 }
static NETINFO_ITEM * OrphanedItem()
Wrapper class, so you can iterate through NETINFO_ITEM*s, not std::pair<int/wxString,...
Definition: netinfo.h:373
NETINFO_LIST m_NetInfo
Definition: board.h:234
unsigned GetNetCount() const
Definition: netinfo.h:339
NETINFO_ITEM * GetNetItem(int aNetCode) const
static const int UNCONNECTED
Constant that forces initialization of a netinfo item to the NETINFO_ITEM ORPHANED (typically -1) whe...
Definition: netinfo.h:365

References NETINFO_LIST::GetNetCount(), NETINFO_LIST::GetNetItem(), m_NetInfo, NETINFO_LIST::OrphanedItem(), and NETINFO_LIST::UNCONNECTED.

Referenced by DIALOG_COPPER_ZONE::AcceptOptions(), PCAD2KICAD::PCB_PAD::AddToFootprint(), DIALOG_COPPER_ZONE::buildAvailableListOfNets(), CreateSignalsSection(), PNS_PCBNEW_RULE_RESOLVER::DpCoupledNet(), dpCoupledNet(), PNS_PCBNEW_RULE_RESOLVER::DpNetPair(), PNS_PCBNEW_RULE_RESOLVER::DpNetPolarity(), PCB_EDIT_FRAME::Edit_Zone_Params(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), extractAllDiffPairs(), DSN::SPECCTRA_DB::FromBOARD(), DSN::SPECCTRA_DB::FromSESSION(), BOARD_INSPECTION_TOOL::highlightNet(), DRC_ENGINE::IsNetADiffPair(), LEGACY_PLUGIN::loadNETINFO_ITEM(), LEGACY_PLUGIN::loadPAD(), MapNets(), PNS_PCBNEW_RULE_RESOLVER::NetName(), DIALOG_NET_INSPECTOR::onAddNet(), DIALOG_NET_INSPECTOR::onRenameNet(), NETINFO_MAPPING::iterator::operator *(), SanitizeNetcodes(), BOARD_CONNECTED_ITEM::SetNetCode(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow(), BOARD_NETLIST_UPDATER::updateComponentPadConnections(), and BOARD_NETLIST_UPDATER::updateCopperZoneNets().

◆ FindNet() [2/2]

NETINFO_ITEM * BOARD::FindNet ( const wxString &  aNetname) const

Search for a net with the given name.

Parameters
aNetnameA Netname to search for.
Returns
NETINFO_ITEM* - the net or NULL if not found.

Definition at line 1304 of file board.cpp.

1305 {
1306  return m_NetInfo.GetNetItem( aNetname );
1307 }
NETINFO_LIST m_NetInfo
Definition: board.h:234
NETINFO_ITEM * GetNetItem(int aNetCode) const

References NETINFO_LIST::GetNetItem(), and m_NetInfo.

◆ Flip() [1/2]

virtual void BOARD_ITEM::Flip ( const wxPoint &  aCentre,
bool  aFlipLeftRight 
)
inlinevirtualinherited

Flip this object, i.e.

change the board side for this object.

Parameters
aCentrethe rotation point.
aFlipLeftRightmirror across Y axis instead of X (the default).

Reimplemented in ZONE, VIA, PCB_SHAPE, PAD, ARC, FOOTPRINT, DIMENSION_BASE, PCB_GROUP, FP_TEXT, FP_SHAPE, TRACK, PCB_TEXT, PCB_TARGET, and PCB_MARKER.

Definition at line 310 of file board_item.h.

311  {
312  wxMessageBox( wxT( "virtual BOARD_ITEM::Flip used, should not occur" ), GetClass() );
313  }
virtual wxString GetClass() const =0
Return the class name.

References EDA_ITEM::GetClass().

Referenced by BOARD_ITEM::Flip().

◆ Flip() [2/2]

void BOARD_ITEM::Flip ( const VECTOR2I aCentre,
bool  aFlipLeftRight 
)
inlineinherited

Definition at line 315 of file board_item.h.

316  {
317  Flip( wxPoint( aCentre.x, aCentre.y ), aFlipLeftRight );
318  }
virtual void Flip(const wxPoint &aCentre, bool aFlipLeftRight)
Flip this object, i.e.
Definition: board_item.h:310

References BOARD_ITEM::Flip(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ Footprints() [1/2]

FOOTPRINTS& BOARD::Footprints ( )
inline

Definition at line 305 of file board.h.

305 { return m_footprints; }
FOOTPRINTS m_footprints
Definition: board.h:202

References m_footprints.

Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), GERBER_JOBFILE_WRITER::addJSONDesignRules(), RENDER_3D_RAYTRACE::addPadsAndVias(), AllConnectedItems(), PCB_CONTROL::AppendBoard(), AR_AUTOPLACER::AR_AUTOPLACER(), AR_AUTOPLACER::AutoplaceFootprints(), CN_CONNECTIVITY_ALGO::Build(), build_pad_testpoints(), ZONE_FILLER::buildCopperItemClearances(), FROM_TO_CACHE::buildEndpointList(), DIALOG_BOARD_REANNOTATE::BuildFootprintList(), GENDRILL_WRITER_BASE::buildHolesList(), DIALOG_NET_INSPECTOR::buildNetsList(), ZONE_FILLER::buildThermalSpokes(), HYPERLYNX_EXPORTER::collectNetObjects(), ConvertCrossReferencesToKIIDs(), CreateComponentsSection(), BOARD_ADAPTER::createLayers(), PLACEFILE_GERBER_WRITER::CreatePlaceFile(), CreateShapesSection(), CreateSignalsSection(), PCB_DRAW_PANEL_GAL::DisplayBoard(), DIALOG_GLOBAL_DELETION::doGlobalDeletions(), doPushPadProperties(), DRAWING_TOOL::DrawVia(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), PCB_EDIT_FRAME::Export_IDF3(), EXPORTER_PCB_VRML::ExportFp3DModelsAsLinkedFile(), PCB_EDIT_FRAME::ExportToGenCAD(), PCB_EDIT_FRAME::ExportVRML_File(), ZONE_FILLER::Fill(), FillItemMap(), DSN::SPECCTRA_DB::FlipFOOTPRINTs(), DRC_TEST_PROVIDER::forEachGeometryItem(), PCB_IO::format(), RENDER_3D_LEGACY::generateViasAndPads(), PLACE_FILE_EXPORTER::GenPositionData(), PLACE_FILE_EXPORTER::GenReportData(), DIALOG_BOARD_STATISTICS::getDataFromPCB(), PCB_BASE_FRAME::GetFootprintFromBoardByReference(), GetItem(), NETINFO_ITEM::GetMsgPanelInfo(), GetNodesCount(), GetPadCount(), GetPadFast(), GetPads(), GetSortedPadListByXthenYCoord(), DIALOG_GENDRILL::InitDisplayParams(), insideArea(), insideBackCourtyard(), insideCourtyard(), insideFrontCourtyard(), BOARD_INSPECTION_TOOL::InspectConstraints(), PCB_EDIT_FRAME::KiwayMailIn(), ZONE_FILLER::knockoutThermalReliefs(), RENDER_3D_LEGACY::load3dModels(), DRC_ENGINE::loadImplicitRules(), RENDER_3D_RAYTRACE::loadModels(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), AR_AUTOPLACER::nearestPad(), FOOTPRINT_EDIT_FRAME::OnUpdateSaveFootprintToBoard(), PCB_CONTROL::Paste(), AR_AUTOPLACER::pickFootprint(), PCB_CONTROL::placeBoardItems(), BRDITEMS_PLOTTER::PlotDrillMarks(), PlotLayerOutlines(), PlotSolderMaskLayer(), PlotStandardLayer(), DIALOG_EXCHANGE_FOOTPRINTS::processMatchingFootprints(), BOARD_COMMIT::Push(), RecreateCmpFile(), RENDER_3D_LEGACY::render3dModelsSelected(), BOARD_EDITOR_CONTROL::RepairBoard(), BOARD_INSPECTION_TOOL::reportClearance(), DSN::SPECCTRA_DB::RevertFOOTPRINTs(), DRC_TEST_PROVIDER_HOLE_SIZE::Run(), DRC_TEST_PROVIDER_HOLE_CLEARANCE::Run(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::Run(), DRC_ENGINE::RunTests(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), CLIPBOARD_IO::SaveSelection(), DIALOG_FIND::search(), FOOTPRINT_EDIT_FRAME::SelectFootprintFromBoard(), SetElementVisibility(), ZONE_FILLER::subtractHigherPriorityZones(), PNS_KICAD_IFACE_BASE::SyncWorld(), DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testCourtyardClearances(), DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testFootprintCourtyardDefinitions(), DRC_TEST_PROVIDER_LVS::testFootprints(), TestForExistingItem(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadClearances(), DIALOG_UNUSED_PAD_LAYERS::TransferDataFromWindow(), NETINFO_MAPPING::Update(), BOARD_NETLIST_UPDATER::UpdateNetlist(), HYPERLYNX_EXPORTER::writeDevices(), and HYPERLYNX_EXPORTER::writePadStacks().

◆ Footprints() [2/2]

const FOOTPRINTS& BOARD::Footprints ( ) const
inline

Definition at line 306 of file board.h.

306 { return m_footprints; }
FOOTPRINTS m_footprints
Definition: board.h:202

References m_footprints.

◆ Get() [1/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty)
inlineinherited

Definition at line 86 of file inspectable.h.

87  {
89  TYPE_ID thisType = TYPE_HASH( *this );
90  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
91  return object ? aProperty->getter( object ) : wxAny();
92  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
virtual wxAny getter(void *aObject) const =0
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

References PROPERTY_BASE::getter(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

Referenced by CLASS_D_DESC::CLASS_D_DESC(), PCB_EXPR_VAR_REF::GetValue(), and PAD_DESC::PAD_DESC().

◆ Get() [2/3]

template<typename T >
T INSPECTABLE::Get ( PROPERTY_BASE aProperty)
inlineinherited

Definition at line 95 of file inspectable.h.

96  {
98  TYPE_ID thisType = TYPE_HASH( *this );
99  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
100  return object ? aProperty->get<T>( object ) : T();
101  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
T get(void *aObject)
Definition: property.h:268
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

References PROPERTY_BASE::get(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ Get() [3/3]

template<typename T >
boost::optional<T> INSPECTABLE::Get ( const wxString &  aProperty)
inlineinherited

Definition at line 104 of file inspectable.h.

105  {
107  TYPE_ID thisType = TYPE_HASH( *this );
108  PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
109  boost::optional<T> ret;
110 
111  if( prop )
112  {
113  void* object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
114 
115  if( object )
116  ret = prop->get<T>( object );
117  }
118 
119  return ret;
120  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
T get(void *aObject)
Definition: property.h:268
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

References PROPERTY_BASE::get(), PROPERTY_MANAGER::GetProperty(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ GetArea()

ZONE* BOARD::GetArea ( int  index) const
inline

Return the Zone at a given index.

Parameters
indexThe array type index into a collection of ZONE *.
Returns
ZONE* - a pointer to the Area or NULL if index out of range.

Definition at line 913 of file board.h.

914  {
915  if( (unsigned) index < m_zones.size() )
916  return m_zones[index];
917 
918  return NULL;
919  }
#define NULL
ZONES m_zones
Definition: board.h:205

References m_zones, and NULL.

Referenced by DIALOG_GLOBAL_DELETION::doGlobalDeletions(), SaveCopyOfZones(), and UpdateCopyOfZonesList().

◆ GetAreaCount()

int BOARD::GetAreaCount ( ) const
inline
Returns
The number of copper pour areas or ZONEs.

Definition at line 929 of file board.h.

930  {
931  return static_cast<int>( m_zones.size() );
932  }
ZONES m_zones
Definition: board.h:205

References m_zones.

◆ GetBoard()

BOARD * BOARD_ITEM::GetBoard ( ) const
virtualinherited

Return the BOARD in which this BOARD_ITEM resides, or NULL if none.

Definition at line 46 of file board_item.cpp.

47 {
48  if( Type() == PCB_T )
49  return (BOARD*) this;
50 
51  BOARD_ITEM* parent = GetParent();
52 
53  if( parent )
54  return parent->GetBoard();
55 
56  return NULL;
57 }
Definition: typeinfo.h:84
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
#define NULL
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:46
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:168
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References BOARD_ITEM::GetBoard(), BOARD_ITEM::GetParent(), NULL, PCB_T, and EDA_ITEM::Type().

Referenced by PAD::BuildEffectivePolygon(), PAD::BuildEffectiveShapes(), ZONE::BuildSmoothedPoly(), KIGFX::PCB_PAINTER::draw(), exprFromTo(), VIA::FlashLayer(), PAD::FlashLayer(), PCB_TARGET::Flip(), PCB_TEXT::Flip(), TRACK::Flip(), FP_SHAPE::Flip(), FP_TEXT::Flip(), DIMENSION_BASE::Flip(), ARC::Flip(), PCB_SHAPE::Flip(), VIA::Flip(), ZONE::Flip(), BOARD_ITEM::GetBoard(), FOOTPRINT::GetBoundingBox(), FOOTPRINT::GetBoundingHull(), BOARD_CONNECTED_ITEM::GetEffectiveNetclass(), ZONE::GetInteractingZones(), BOARD_ITEM::GetLayerName(), VIA::GetMinAnnulus(), PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), ZONE::GetMsgPanelInfo(), NETINFO_ITEM::GetMsgPanelInfo(), TRACK::GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), BOARD_CONNECTED_ITEM::GetOwnClearance(), ZONE::GetSelectMenuText(), DRC_ENGINE::GetShape(), FP_TEXT::GetShownText(), PAD::GetSolderMaskMargin(), PAD::GetSolderPasteMargin(), GetTrackLength(), TRACK::GetWidthConstraints(), insideArea(), insideBackCourtyard(), insideCourtyard(), insideFrontCourtyard(), BOARD_ITEM::layerMaskDescribe(), VIA::layerMaskDescribe(), CONVERT_TOOL::makePolysFromCircles(), PAD::MergePrimitivesAsPolygon(), EAGLE_PLUGIN::packageWire(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), ResolveDRCExclusions(), BOARD_CONNECTED_ITEM::SetNetCode(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow(), ZONE::TransformSmoothedOutlineToPolygon(), ZONE::TransformSolidAreasShapesToPolygon(), TRACK::ViewBBox(), FOOTPRINT::ViewBBox(), VIA::ViewGetLOD(), and PAD::ViewGetLOD().

◆ GetBoardEdgesBoundingBox()

const EDA_RECT BOARD::GetBoardEdgesBoundingBox ( ) const
inline

Returns the board bounding box calculated using exclusively the board edges (graphics on Edge.Cuts layer).

If there are items outside of the area limited by Edge.Cuts graphics, the items will not be taken into account.

Returns
bounding box calculated using exclusively the board edges.

Definition at line 812 of file board.h.

813  {
814  return ComputeBoundingBox( true );
815  }
EDA_RECT ComputeBoundingBox(bool aBoardEdgesOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
Definition: board.cpp:1050

References ComputeBoundingBox().

Referenced by GERBER_JOBFILE_WRITER::addJSONGeneralSpecs(), AUTOPLACE_TOOL::autoplace(), BuildBoardPolygonOutlines(), EAGLE_PLUGIN::centerBoard(), BOARD_NETLIST_UPDATER::estimateComponentInsertionPosition(), GENDRILL_WRITER_BASE::genDrillMapFile(), AR_AUTOPLACER::genPlacementRoutingMatrix(), PCB_BASE_FRAME::GetBoardBoundingBox(), idf_export_outline(), CADSTAR_PCB_ARCHIVE_PLUGIN::Load(), PCB_EDIT_FRAME::OnExportIDF3(), and ALTIUM_PCB::Parse().

◆ GetBoardPolygonOutlines()

bool BOARD::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 layer Any closed outline inside the main outline is a hole All contours should be closed, i.e.

have valid vertices to build a closed polygon

Parameters
aOutlinesThe SHAPE_POLY_SET to fill in with outlines/holes.
aErrorHandler= an optional DRC_ITEM error handler
Returns
true if success, false if a contour is not valid

Definition at line 1922 of file board.cpp.

1924 {
1925  int chainingEpsilon = Millimeter2iu( 0.02 ); // max dist from one endPt to next startPt
1926 
1927  bool success = BuildBoardPolygonOutlines( this, aOutlines, GetDesignSettings().m_MaxError,
1928  chainingEpsilon, aErrorHandler );
1929 
1930  // Make polygon strictly simple to avoid issues (especially in 3D viewer)
1932 
1933  return success;
1934 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.h:593
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 ...
void Simplify(POLYGON_MODE aFastMode)
static constexpr int Millimeter2iu(double mm)

References BuildBoardPolygonOutlines(), GetDesignSettings(), Millimeter2iu(), SHAPE_POLY_SET::PM_STRICTLY_SIMPLE, and SHAPE_POLY_SET::Simplify().

Referenced by BOARD_ADAPTER::createBoardPolygon(), EXPORTER_PCB_VRML::ExportVrmlBoard(), ZONE_FILLER::Fill(), DSN::SPECCTRA_DB::fillBOUNDARY(), AR_AUTOPLACER::genPlacementRoutingMatrix(), DIALOG_BOARD_STATISTICS::getDataFromPCB(), PlotSolderMaskLayer(), PNS_KICAD_IFACE_BASE::SyncWorld(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZones(), and HYPERLYNX_EXPORTER::writeBoardInfo().

◆ GetBoardUse()

BOARD_USE BOARD::GetBoardUse ( ) const
inline

Get what the board use is.

Returns
what the board is being used for

Definition at line 269 of file board.h.

269 { return m_boardUse; }
BOARD_USE m_boardUse
What is this board being used for.
Definition: board.h:196

References m_boardUse.

◆ GetBoundingBox()

const EDA_RECT BOARD::GetBoundingBox ( ) const
inlineoverridevirtual

Return the orthogonal bounding box of this object for display purposes.

This box should be an enclosing perimeter for visible components of this object, and the units should be in the pcb or schematic coordinate system. It is OK to overestimate the size by a few counts.

Reimplemented from EDA_ITEM.

Definition at line 798 of file board.h.

799  {
800  return ComputeBoundingBox( false );
801  }
EDA_RECT ComputeBoundingBox(bool aBoardEdgesOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
Definition: board.cpp:1050

References ComputeBoundingBox().

Referenced by buildBoardBoundingBoxPoly(), PCB_BASE_FRAME::GetBoardBoundingBox(), GetFocusPosition(), PCB_EDIT_FRAME::OnExportVRML(), PCB_EDIT_FRAME::OnNetlistChanged(), DRC_TEST_PROVIDER_MISC::testOutline(), and PANEL_PCBNEW_COLOR_SETTINGS::zoomFitPreview().

◆ GetCenter()

virtual wxPoint BOARD_ITEM::GetCenter ( ) const
inlinevirtualinherited

This defaults to the center of the bounding box if not overridden.

Returns
center point of the item

Reimplemented in ARC, PAD, PCB_SHAPE, and PCB_MARKER.

Definition at line 114 of file board_item.h.

115  {
116  return GetBoundingBox().GetCenter();
117  }
virtual const EDA_RECT GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
Definition: eda_item.cpp:73
const wxPoint GetCenter() const
Definition: eda_rect.h:109

References EDA_ITEM::GetBoundingBox(), and EDA_RECT::GetCenter().

Referenced by PCB_GRID_HELPER::computeAnchors(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), and ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically().

◆ GetClass()

wxString BOARD::GetClass ( ) const
inlineoverridevirtual

Return the class name.

Implements EDA_ITEM.

Definition at line 882 of file board.h.

883  {
884  return wxT( "BOARD" );
885  }

Referenced by Visit().

◆ GetConnectivity()

std::shared_ptr<CONNECTIVITY_DATA> BOARD::GetConnectivity ( ) const
inline

Return a list of missing connections between components/tracks.

Returns
an object that contains information about missing connections.

Definition at line 416 of file board.h.

416 { return m_connectivity; }
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: board.h:215

References m_connectivity.

Referenced by BuildConnectivity(), BOARD_NETLIST_UPDATER::cacheCopperZoneConnections(), FROM_TO_CACHE::cacheFromToPaths(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), TRACKS_CLEANER::cleanup(), ZONE_CREATE_HELPER::commitZone(), PCB_BASE_FRAME::Compile_Ratsnest(), TRACKS_CLEANER::deleteDanglingTracks(), TRACKS_CLEANER::deleteTracksInPads(), PCB_DRAW_PANEL_GAL::DisplayBoard(), EDIT_TOOL::DragArcTrack(), PCB_EDIT_FRAME::Edit_Zone_Params(), exprFromTo(), ZONE_FILLER::Fill(), EDIT_TOOL::FilletTracks(), VIA::FlashLayer(), PAD::FlashLayer(), PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), GetMsgPanelInfo(), GetTrackLength(), PCB_EDIT_FRAME::ImportSpecctraSession(), TRACKS_CLEANER::mergeCollinearSegments(), PadDelete(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), DIALOG_NET_INSPECTOR::relevantConnectivityItems(), TRACKS_CLEANER::removeShortingTrackSegments(), BOARD_COMMIT::Revert(), AR_AUTOPLACER::rotateFootprint(), DRC_TEST_PROVIDER_CONNECTIVITY::Run(), test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run(), DRC_TEST_PROVIDER_MATCHED_LENGTH::runInternal(), PCB_SELECTION_TOOL::selectAllItemsOnNet(), PCB_SELECTION_TOOL::selectConnectedTracks(), PCB_EDIT_FRAME::SetBoard(), TRACKS_CLEANER::testTrackEndpointIsNode(), DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow(), and BOARD_NETLIST_UPDATER::UpdateNetlist().

◆ GetCopperLayerCount()

int BOARD::GetCopperLayerCount ( ) const
Returns
int - The number of copper layers in the BOARD.

Definition at line 435 of file board.cpp.

436 {
438 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.h:593

References BOARD_DESIGN_SETTINGS::GetCopperLayerCount(), and GetDesignSettings().

Referenced by GERBER_JOBFILE_WRITER::addJSONDesignRules(), GERBER_JOBFILE_WRITER::addJSONFilesAttributes(), GERBER_JOBFILE_WRITER::addJSONGeneralSpecs(), GERBER_JOBFILE_WRITER::addJSONMaterialStackup(), PCB_CONTROL::AppendBoard(), GENDRILL_WRITER_BASE::BuildFileFunctionAttributeString(), DSN::SPECCTRA_DB::buildLayerMaps(), PANEL_SETUP_LAYERS::CheckCopperLayerCount(), compute_pad_access_code(), EXPORTER_PCB_VRML::ComputeLayer3D_Zpos(), CreateComponentsSection(), CreatePadsShapesSection(), PLACEFILE_GERBER_WRITER::CreatePlaceFile(), CreateRoutesSection(), DIALOG_SWAP_LAYERS::DIALOG_SWAP_LAYERS(), DRAWING_TOOL::DrawVia(), TRACK::Flip(), ARC::Flip(), VIA::Flip(), ZONE::Flip(), DSN::SPECCTRA_DB::FromBOARD(), GetGerberFileFunctionAttribute(), BOARD_ADAPTER::InitSettings(), EAGLE_PLUGIN::Load(), DSN::SPECCTRA_DB::makeIMAGE(), DSN::SPECCTRA_DB::makePADSTACK(), DSN::SPECCTRA_DB::makeVIA(), APPEARANCE_CONTROLS::rebuildLayerContextMenu(), ZONE_SETTINGS::SetupLayersList(), PCB_BASE_FRAME::SwitchLayer(), PANEL_SETUP_BOARD_STACKUP::synchronizeWithBoard(), DIALOG_SWAP_LAYERS::TransferDataFromWindow(), DIALOG_SWAP_LAYERS::TransferDataToWindow(), PANEL_SETUP_LAYERS::TransferDataToWindow(), and via_access_code().

◆ GetDesignSettings()

BOARD_DESIGN_SETTINGS& BOARD::GetDesignSettings ( ) const
inline
Returns
the BOARD_DESIGN_SETTINGS for this BOARD

Definition at line 593 of file board.h.

594  {
595  return *m_designSettings;
596  }
std::unique_ptr< BOARD_DESIGN_SETTINGS > m_designSettings
All of the board design settings are stored as a JSON object inside the project file.
Definition: board.h:232

References m_designSettings.

Referenced by AddGerberX2Header(), GERBER_JOBFILE_WRITER::addJSONDesignRules(), GERBER_JOBFILE_WRITER::addJSONGeneralSpecs(), GERBER_JOBFILE_WRITER::addJSONMaterialStackup(), BOARD(), build_pad_testpoints(), build_via_testpoints(), ZONE_FILLER::buildCopperItemClearances(), PAD::BuildEffectivePolygon(), PAD::BuildEffectiveShapes(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildFilterLists(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildNetclassesGrid(), ZONE::BuildSmoothedPoly(), ZONE_FILLER::buildThermalSpokes(), DIALOG_NET_INSPECTOR::calculateViaLength(), EDIT_TOOL::ChangeTrackWidth(), FOOTPRINT_EDIT_FRAME::Clear_Pcb(), ClearProject(), ZONE_CREATE_HELPER::commitZone(), EXPORTER_PCB_VRML::ComputeLayer3D_Zpos(), ZONE_FILLER::computeRawFilledArea(), ConvertBrdLayerToPolygonalContours(), BOARD_ADAPTER::createBoardPolygon(), MICROWAVE_TOOL::createInductorBetween(), BOARD_ADAPTER::createLayers(), CreatePadsShapesSection(), PLACEFILE_GERBER_WRITER::CreatePlaceFile(), CreateRoutesSection(), DIALOG_EXPORT_SVG::CreateSVGFile(), ROUTER_TOOL::CustomTrackWidthDialog(), DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP(), DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME(), ROUTER_TOOL::DpDimensionsDialog(), KIGFX::PCB_PAINTER::draw(), DRAWING_TOOL::DrawBoardCharacteristics(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawVia(), VIA_SIZE_MENU::eventHandler(), TRACK_WIDTH_MENU::eventHandler(), DIFF_PAIR_MENU::eventHandler(), EVT_GRID_CMD_CELL_CHANGED(), PCB_EDIT_FRAME::Export_IDF3(), PCB_EDIT_FRAME::ExportToGenCAD(), ZONE_FILLER::Fill(), FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), PCB_IO::formatGeneral(), PCB_IO::formatSetup(), DSN::SPECCTRA_DB::FromBOARD(), DSN::SPECCTRA_DB::FromSESSION(), PLACE_FILE_EXPORTER::GenPositionData(), PCB_BASE_FRAME::GetAuxOrigin(), GetBoardPolygonOutlines(), PCB_MARKER::GetColorLayer(), GetCopperLayerCount(), BOARD_DRC_ITEMS_PROVIDER::GetCount(), VECTOR_DRC_ITEMS_PROVIDER::GetCount(), FOOTPRINT_EDIT_FRAME::GetDesignSettings(), PCB_BASE_FRAME::GetDesignSettings(), BOARD_CONNECTED_ITEM::GetEffectiveNetclass(), GetEnabledLayers(), PCB_BASE_FRAME::GetGridOrigin(), CADSTAR_PCB_ARCHIVE_LOADER::getHatchCodeAngleDegrees(), BOARD_ADAPTER::GetHolePlatingThickness(), CADSTAR_PCB_ARCHIVE_LOADER::getKiCadHatchCodeGap(), CADSTAR_PCB_ARCHIVE_LOADER::getKiCadHatchCodeThickness(), CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad(), CADSTAR_PCB_ARCHIVE_LOADER::getLineThickness(), VIA::GetMinAnnulus(), BOARD_CONNECTED_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetOwnClearance(), DRAWING_TOOL::getSegmentWidth(), PCB_BASE_FRAME::GetSeverity(), DRC_ENGINE::GetShape(), PAD::GetSolderMaskMargin(), GetTrackLength(), TRACK::GetWidthConstraints(), PCB_BASE_FRAME::GetZoneSettings(), GetZoneSettings(), ROUTER_TOOL::handleLayerSwitch(), ALTIUM_PCB::HelperCreateBoardOutline(), PANEL_SETUP_BOARD_FINISH::ImportSettingsFrom(), PANEL_SETUP_MASK_AND_PASTE::ImportSettingsFrom(), PANEL_SETUP_TEXT_AND_GRAPHICS::ImportSettingsFrom(), PANEL_SETUP_CONSTRAINTS::ImportSettingsFrom(), PANEL_SETUP_TRACKS_AND_VIAS::ImportSettingsFrom(), PANEL_SETUP_BOARD_STACKUP::ImportSettingsFrom(), PNS_KICAD_IFACE_BASE::ImportSizes(), DIALOG_PLOT::init_Dialog(), initializePlotter(), BOARD_ADAPTER::InitSettings(), BOARD_INSPECTION_TOOL::InspectConstraints(), IsLayerEnabled(), IsLayerVisible(), EAGLE_PLUGIN::Load(), LoadBoard(), CADSTAR_PCB_ARCHIVE_LOADER::loadBoardStackup(), CADSTAR_PCB_ARCHIVE_LOADER::loadDesignRules(), FABMASTER::loadFootprints(), LEGACY_PLUGIN::loadGENERAL(), DRC_ENGINE::loadImplicitRules(), LEGACY_PLUGIN::loadNETCLASS(), FABMASTER::loadOutline(), EAGLE_PLUGIN::loadPlain(), FABMASTER::loadPolygon(), LEGACY_PLUGIN::loadSETUP(), CADSTAR_PCB_ARCHIVE_LOADER::loadTemplates(), FABMASTER::loadVias(), DSN::SPECCTRA_DB::makePADSTACK(), CONVERT_TOOL::makePolysFromCircles(), PAD::MergePrimitivesAsPolygon(), NETINFO_ITEM::NETINFO_ITEM(), DIALOG_PAD_PROPERTIES::onAddPrimitive(), DIALOG_BOARD_SETUP::OnAuxiliaryAction(), PANEL_SETUP_RULES::onScintillaCharAdded(), DIALOG_POSITION_RELATIVE::OnUseGridOriginClick(), PCB_EDIT_FRAME::OpenProjectFiles(), EAGLE_PLUGIN::packageWire(), DIALOG_PAD_PROPERTIES::padValuesOK(), PANEL_SETUP_BOARD_FINISH::PANEL_SETUP_BOARD_FINISH(), PANEL_SETUP_BOARD_STACKUP::PANEL_SETUP_BOARD_STACKUP(), PANEL_SETUP_CONSTRAINTS::PANEL_SETUP_CONSTRAINTS(), PANEL_SETUP_MASK_AND_PASTE::PANEL_SETUP_MASK_AND_PASTE(), PANEL_SETUP_TEXT_AND_GRAPHICS::PANEL_SETUP_TEXT_AND_GRAPHICS(), PANEL_SETUP_TRACKS_AND_VIAS::PANEL_SETUP_TRACKS_AND_VIAS(), ALTIUM_PCB::Parse(), ALTIUM_PCB::ParseBoard6Data(), ALTIUM_PCB::ParseClasses6Data(), BOARD_EDITOR_CONTROL::PlaceTarget(), DIALOG_PLOT::Plot(), PlotOneBoardLayer(), PlotSolderMaskLayer(), PlotStandardLayer(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), PNS_PCBNEW_RULE_RESOLVER::QueryConstraint(), APPEARANCE_CONTROLS::rebuildNets(), PAD_TOOL::recombinePad(), PCB_EDIT_FRAME::RecordDRCExclusions(), DIALOG_PLOT::reInitDialog(), BOARD_INSPECTION_TOOL::reportClearance(), DRC_TOOL::Reset(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::Run(), PCB_BASE_EDIT_FRAME::SetBoard(), SetCopperLayerCount(), SetEnabledLayers(), PCB_BASE_FRAME::SetGridOrigin(), NETINFO_ITEM::SetNetClass(), DIALOG_PLOT::SetPlotFormat(), SetProject(), BOARD_DRC_ITEMS_PROVIDER::SetSeverities(), VECTOR_DRC_ITEMS_PROVIDER::SetSeverities(), PCB_BASE_FRAME::SetZoneSettings(), SetZoneSettings(), APPEARANCE_CONTROLS::showNetclass(), PNS_KICAD_IFACE_BASE::StackupHeight(), EDA_3D_VIEWER::SynchroniseColoursWithBoard(), SynchronizeNetsAndNetClasses(), PNS_KICAD_IFACE_BASE::syncPad(), PNS_KICAD_IFACE_BASE::syncVia(), PNS_KICAD_IFACE_BASE::SyncWorld(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZones(), DRC_TEST_PROVIDER_MISC::testOutline(), PANEL_SETUP_RULES::TransferDataFromWindow(), ZONE::TransformSmoothedOutlineToPolygon(), VIA_SIZE_MENU::update(), TRACK_WIDTH_MENU::update(), DIFF_PAIR_MENU::update(), DIALOG_GENDRILL::UpdateDrillParams(), TRACK::ViewBBox(), FOOTPRINT::ViewBBox(), PCB_MARKER::ViewGetLayers(), WriteDRCReport(), DIALOG_DRC::writeReport(), and HYPERLYNX_EXPORTER::writeStackupInfo().

◆ GetEditFlags()

STATUS_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 208 of file eda_item.h.

209  {
210  constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVED | IS_RESIZED | IS_DRAGGED |
212 
213  return m_flags & mask;
214  }
#define IS_RESIZED
Item being resized.
Definition: eda_item.h:108
#define STRUCT_DELETED
flag indication structures to be erased
Definition: eda_item.h:116
#define IS_MOVED
Item being moved.
Definition: eda_item.h:106
#define IS_DRAGGED
Item being dragged.
Definition: eda_item.h:109
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
Definition: eda_item.h:120
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: eda_item.h:111
STATUS_FLAGS m_flags
Definition: eda_item.h:531
#define IS_NEW
New item, just created.
Definition: eda_item.h:107

References IS_DRAGGED, IS_MOVED, IS_NEW, IS_PASTED, IS_RESIZED, IS_WIRE_IMAGE, EDA_ITEM::m_flags, and STRUCT_DELETED.

Referenced by EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_TOOL::editFieldText(), SYMBOL_EDITOR_PIN_TOOL::EditPinProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), SCH_COMPONENT::GetMsgPanelInfo(), SELECTION_CONDITIONS::Idle(), SELECTION_CONDITIONS::IdleSelection(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PCB_POINT_EDITOR::OnSelectionChange(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), PAD_TOOL::recombinePad(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), and DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow().

◆ GetEffectiveShape()

std::shared_ptr< SHAPE > BOARD_ITEM::GetEffectiveShape ( PCB_LAYER_ID  aLayer = UNDEFINED_LAYER) const
virtualinherited

Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.

This routine returns a COMPOUND shape (set of simple shapes which make up the pad for use with routing, collision determination, etc).

Note
This list can contain a SHAPE_SIMPLE (a simple single-outline non-intersecting polygon), but should never contain a SHAPE_POLY_SET (a complex polygon consisting of multiple outlines and/or holes).
Parameters
aLayerin case of items spanning multiple layers, only the shapes belonging to aLayer will be returned. Pass UNDEFINED_LAYER to return shapes for all layers.

Reimplemented in FOOTPRINT, VIA, PAD, ZONE, ARC, PCB_SHAPE, DIMENSION_BASE, FP_TEXT, TRACK, PCB_TEXT, PCB_TARGET, and PCB_MARKER.

Definition at line 153 of file board_item.cpp.

154 {
155  std::shared_ptr<SHAPE> shape;
156 
157  wxFAIL_MSG( "GetEffectiveShape() not implemented for " + GetClass() );
158 
159  return shape;
160 }
virtual wxString GetClass() const =0
Return the class name.

References EDA_ITEM::GetClass().

Referenced by DRC_ENGINE::GetShape(), PCB_SELECTION_TOOL::hitTestDistance(), DRC_RTREE::Insert(), insideArea(), insideFootprintCourtyard(), DRC_RTREE::QueryColliding(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::testAgainstEdge(), and DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZones().

◆ GetEnabledLayers()

LSET BOARD::GetEnabledLayers ( ) const

A proxy function that calls the corresponding function in m_BoardSettings Returns a bit-mask of all the layers that are enabled.

Returns
int - the enabled layers in bit-mapped form.

Definition at line 447 of file board.cpp.

448 {
450 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.h:593
LSET GetEnabledLayers() const
Return a bit-mask of all the layers that are enabled.

References GetDesignSettings(), and BOARD_DESIGN_SETTINGS::GetEnabledLayers().

Referenced by PCB_CONTROL::AppendBoard(), DIALOG_PLOT::applyPlotSettings(), PCB_ONE_LAYER_SELECTOR::buildList(), SELECT_COPPER_LAYERS_PAIR_DIALOG::buildList(), PCB_IO::formatBoardLayers(), GENDRILL_WRITER_BASE::GenDrillReportFile(), PCB_LAYER_BOX_SELECTOR::getEnabledLayers(), PANEL_SETUP_LAYERS::getNonRemovableLayers(), PANEL_SETUP_LAYERS::getRemovedLayersWithItems(), DIALOG_PLOT::init_Dialog(), DIALOG_EXPORT_SVG::initDialog(), HYPERLYNX_PAD_STACK::isEmpty(), BOARD_ITEM::layerMaskDescribe(), PANEL_SETUP_BOARD_STACKUP::PANEL_SETUP_BOARD_STACKUP(), DIALOG_PLOT::Plot(), APPEARANCE_CONTROLS::rebuildLayers(), CADSTAR_PCB_ARCHIVE_LOADER::remapUnsureLayers(), DRC_TEST_PROVIDER_MISC::testDisabledLayers(), PANEL_SETUP_LAYERS::TransferDataFromWindow(), DIALOG_PRINT_PCBNEW::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow(), PANEL_SETUP_LAYERS::TransferDataToWindow(), PCB_EDIT_FRAME::UpdateUserInterface(), VIA::ViewGetLOD(), PAD::ViewGetLOD(), and HYPERLYNX_EXPORTER::writeSinglePadStack().

◆ GetFileFormatVersionAtLoad()

int BOARD::GetFileFormatVersionAtLoad ( ) const
inline

Definition at line 361 of file board.h.

361 { return m_fileFormatVersionAtLoad; }
int m_fileFormatVersionAtLoad
Definition: board.h:212

References m_fileFormatVersionAtLoad.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ GetFileName()

const wxString& BOARD::GetFileName ( void  ) const
inline

Definition at line 300 of file board.h.

300 { return m_fileName; }
wxString m_fileName
Definition: board.h:199

References m_fileName.

Referenced by AddGerberX2Header(), GERBER_JOBFILE_WRITER::addJSONGeneralSpecs(), PCB_EDIT_FRAME::canCloseWindow(), DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles(), DIALOG_GEN_FOOTPRINT_POSITION::CreateGerberFiles(), CreateHeaderInfoData(), DIALOG_BOARD_STATISTICS::DIALOG_BOARD_STATISTICS(), DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP(), PCB_DRAW_PANEL_GAL::DisplayBoard(), PCB_EDIT_FRAME::doCloseWindow(), PCB_EDIT_FRAME::Export_IDF3(), BOARD_EDITOR_CONTROL::ExportSpecctraDSN(), DIALOG_EXPORT_SVG::ExportSVGFile(), PCB_EDIT_FRAME::ExportToGenCAD(), PCB_EDIT_FRAME::Files_io_from_id(), PCB_EDIT_FRAME::GenD356File(), DIALOG_GENDRILL::GenDrillAndMapFiles(), GENDRILL_WRITER_BASE::GenDrillReportFile(), PCB_EDIT_FRAME::GenFootprintsReport(), PCB_EDIT_FRAME::GetCurrentFileName(), PCB_BASE_EDIT_FRAME::GetDesignRulesPath(), GENDRILL_WRITER_BASE::getDrillFileName(), PCB_EDIT_FRAME::GetLastPath(), BOARD_EDITOR_CONTROL::ImportSpecctraSession(), PCB_EDIT_FRAME::onBoardLoaded(), DIALOG_IMPORT_SETTINGS::OnBrowseClicked(), PCB_EDIT_FRAME::OnExportHyperlynx(), PCB_EDIT_FRAME::OnExportIDF3(), PCB_EDIT_FRAME::OnExportSTEP(), PCB_EDIT_FRAME::OnExportVRML(), DIALOG_GENDRILL::OnGenReportFile(), DIALOG_EXPORT_SVG::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_GEN_FOOTPRINT_POSITION::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), PLOT_CONTROLLER::OpenPlotfile(), ALTIUM_PCB::ParseModelsData(), DIALOG_PLOT::Plot(), PCB_EDIT_FRAME::RecreateBOMFileFromBoard(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), DIALOG_BOARD_STATISTICS::saveReportClicked(), PCB_EDIT_FRAME::SetLastPath(), StartPlotBoard(), PCB_EDIT_FRAME::UpdateTitle(), HYPERLYNX_EXPORTER::writeBoardInfo(), WriteDRCReport(), and DIALOG_DRC::writeReport().

◆ GetFirstFootprint()

FOOTPRINT* BOARD::GetFirstFootprint ( ) const
inline

Gets the first footprint on the board or nullptr.

This is used primarily by the footprint editor which knows there is only one.

Returns
first footprint or null pointer

Definition at line 382 of file board.h.

383  {
384  return m_footprints.empty() ? nullptr : m_footprints.front();
385  }
FOOTPRINTS m_footprints
Definition: board.h:202

References m_footprints.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), BuildFootprintPolygonOutlines(), FOOTPRINT_EDIT_FRAME::canCloseWindow(), FOOTPRINT_EDIT_FRAME::ClearModify(), BOARD_ADAPTER::createBoardPolygon(), FOOTPRINT_EDITOR_CONTROL::CutCopyFootprint(), PCB_CONTROL::DeleteItemCursor(), DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX(), DIALOG_CLEANUP_GRAPHICS::doCleanup(), EDIT_TOOL::Duplicate(), FOOTPRINT_EDITOR_CONTROL::ExportFootprint(), PCB_VIEWER_TOOLS::footprint(), PCB_TOOL_BASE::footprint(), FOOTPRINT_EDIT_FRAME::GetDocumentExtents(), FOOTPRINT_EDIT_FRAME::GetLoadedFPID(), FOOTPRINT_EDIT_FRAME::GetModel(), FOOTPRINT_VIEWER_FRAME::GetModel(), DISPLAY_FOOTPRINTS_FRAME::GetModel(), FOOTPRINT_WIZARD_FRAME::GetModel(), FP_TREE_SYNCHRONIZING_ADAPTER::GetValue(), GROUP_TOOL::Group(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), ARRAY_CREATOR::Invoke(), FOOTPRINT_EDIT_FRAME::IsContentModified(), FOOTPRINT_EDIT_FRAME::IsCurrentFPFromBoard(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadFootprintFromBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateSaveFootprintToBoard(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), PCB_CONTROL::Paste(), pasteFootprintItemsToFootprintEditor(), DRAWING_TOOL::PlaceImportedGraphics(), CONVERT_TOOL::PolyToLines(), FOOTPRINT_EDITOR_CONTROL::Properties(), BOARD_COMMIT::Push(), DIALOG_FOOTPRINT_CHECKER::runChecks(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), FOOTPRINT_EDIT_FRAME::setupUIConditions(), GROUP_TOOL::Ungroup(), DISPLAY_FOOTPRINTS_FRAME::UpdateMsgPanel(), FOOTPRINT_WIZARD_FRAME::UpdateMsgPanel(), and FOOTPRINT_EDIT_FRAME::UpdateTitle().

◆ GetFlags()

◆ GetFocusPosition()

const wxPoint BOARD::GetFocusPosition ( ) const
inlineoverridevirtual

Similar to GetPosition, but allows items to return their visual center rather than their anchor.

Reimplemented from EDA_ITEM.

Definition at line 351 of file board.h.

351 { return GetBoundingBox().GetCenter(); }
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: board.h:798
const wxPoint GetCenter() const
Definition: eda_rect.h:109

References GetBoundingBox(), and EDA_RECT::GetCenter().

◆ GetFootprint()

FOOTPRINT * BOARD::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.

If more than one footprint is at aPosition, then the closest footprint on the active layer is returned. The distance is calculated via manhattan distance from the center of the bounding rectangle to aPosition.

Parameters
aPositionA wxPoint object containing the position to test.
aActiveLayerLayer to test.
aVisibleOnlySearch only the visible layers if true.
aIgnoreLockedIgnore locked footprints when true.

Definition at line 1765 of file board.cpp.

1767 {
1768  FOOTPRINT* footprint = NULL;
1769  FOOTPRINT* alt_footprint = NULL;
1770  int min_dim = 0x7FFFFFFF;
1771  int alt_min_dim = 0x7FFFFFFF;
1772  bool current_layer_back = IsBackLayer( aActiveLayer );
1773 
1774  for( FOOTPRINT* candidate : m_footprints )
1775  {
1776  // is the ref point within the footprint's bounds?
1777  if( !candidate->HitTest( aPosition ) )
1778  continue;
1779 
1780  // if caller wants to ignore locked footprints, and this one is locked, skip it.
1781  if( aIgnoreLocked && candidate->IsLocked() )
1782  continue;
1783 
1784  PCB_LAYER_ID layer = candidate->GetLayer();
1785 
1786  // Filter non visible footprints if requested
1787  if( !aVisibleOnly || IsFootprintLayerVisible( layer ) )
1788  {
1789  EDA_RECT bb = candidate->GetBoundingBox( false, false );
1790 
1791  int offx = bb.GetX() + bb.GetWidth() / 2;
1792  int offy = bb.GetY() + bb.GetHeight() / 2;
1793 
1794  // off x & offy point to the middle of the box.
1795  int dist = ( aPosition.x - offx ) * ( aPosition.x - offx ) +
1796  ( aPosition.y - offy ) * ( aPosition.y - offy );
1797 
1798  if( current_layer_back == IsBackLayer( layer ) )
1799  {
1800  if( dist <= min_dim )
1801  {
1802  // better footprint shown on the active side
1803  footprint = candidate;
1804  min_dim = dist;
1805  }
1806  }
1807  else if( aVisibleOnly && IsFootprintLayerVisible( layer ) )
1808  {
1809  if( dist <= alt_min_dim )
1810  {
1811  // better footprint shown on the other side
1812  alt_footprint = candidate;
1813  alt_min_dim = dist;
1814  }
1815  }
1816  }
1817  }
1818 
1819  if( footprint )
1820  return footprint;
1821 
1822  if( alt_footprint)
1823  return alt_footprint;
1824 
1825  return NULL;
1826 }
int GetX() const
Definition: eda_rect.h:103
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
int GetWidth() const
Definition: eda_rect.h:114
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...
Definition: board.cpp:546
PCB_LAYER_ID
A quick note on layer IDs:
#define NULL
int GetHeight() const
Definition: eda_rect.h:115
Handle the component boundary box.
Definition: eda_rect.h:42
int GetY() const
Definition: eda_rect.h:104
FOOTPRINTS m_footprints
Definition: board.h:202

References EDA_RECT::GetHeight(), EDA_RECT::GetWidth(), EDA_RECT::GetX(), EDA_RECT::GetY(), IsBackLayer(), IsFootprintLayerVisible(), m_footprints, and NULL.

◆ GetHighLightNetCodes()

const std::set<int>& BOARD::GetHighLightNetCodes ( ) const
inline
Returns
the set of net codes that should be highlighted

Definition at line 456 of file board.h.

457  {
458  return m_highLight.m_netCodes;
459  }
HIGH_LIGHT_INFO m_highLight
Definition: board.h:209
std::set< int > m_netCodes
Definition: board.h:134

References m_highLight, and HIGH_LIGHT_INFO::m_netCodes.

Referenced by DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildFilterLists(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), and DIALOG_NET_INSPECTOR::OnBoardHighlightNetChanged().

◆ GetItem()

BOARD_ITEM * BOARD::GetItem ( const KIID aID) const
Returns
null if aID is null. Returns an object of Type() == NOT_USED if the aID is not found.

Definition at line 813 of file board.cpp.

814 {
815  if( aID == niluuid )
816  return nullptr;
817 
818  for( TRACK* track : Tracks() )
819  {
820  if( track->m_Uuid == aID )
821  return track;
822  }
823 
824  for( FOOTPRINT* footprint : Footprints() )
825  {
826  if( footprint->m_Uuid == aID )
827  return footprint;
828 
829  for( PAD* pad : footprint->Pads() )
830  {
831  if( pad->m_Uuid == aID )
832  return pad;
833  }
834 
835  if( footprint->Reference().m_Uuid == aID )
836  return &footprint->Reference();
837 
838  if( footprint->Value().m_Uuid == aID )
839  return &footprint->Value();
840 
841  for( BOARD_ITEM* drawing : footprint->GraphicalItems() )
842  {
843  if( drawing->m_Uuid == aID )
844  return drawing;
845  }
846 
847  for( BOARD_ITEM* zone : footprint->Zones() )
848  {
849  if( zone->m_Uuid == aID )
850  return zone;
851  }
852 
853  for( PCB_GROUP* group : footprint->Groups() )
854  {
855  if( group->m_Uuid == aID )
856  return group;
857  }
858  }
859 
860  for( ZONE* zone : Zones() )
861  {
862  if( zone->m_Uuid == aID )
863  return zone;
864  }
865 
866  for( BOARD_ITEM* drawing : Drawings() )
867  {
868  if( drawing->m_Uuid == aID )
869  return drawing;
870  }
871 
872  for( PCB_MARKER* marker : m_markers )
873  {
874  if( marker->m_Uuid == aID )
875  return marker;
876  }
877 
878  for( PCB_GROUP* group : m_groups )
879  {
880  if( group->m_Uuid == aID )
881  return group;
882  }
883 
884  if( m_Uuid == aID )
885  return const_cast<BOARD*>( this );
886 
887  // Not found; weak reference has been deleted.
889 }
KIID niluuid(0)
ZONES & Zones()
Definition: board.h:311
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:50
GROUPS m_groups
Definition: board.h:204
static DELETED_BOARD_ITEM * GetInstance()
Definition: board_item.h:398
FOOTPRINTS & Footprints()
Definition: board.h:305
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
MARKERS m_markers
Definition: board.h:200
const KIID m_Uuid
Definition: eda_item.h:525
Definition: pad.h:60
DRAWINGS & Drawings()
Definition: board.h:308
TRACKS & Tracks()
Definition: board.h:302
Definition: track.h:83

References Drawings(), Footprints(), DELETED_BOARD_ITEM::GetInstance(), group, m_groups, m_markers, EDA_ITEM::m_Uuid, niluuid, pad, Tracks(), and Zones().

Referenced by CollisionMatchesExpected(), ConvertKIIDsToCrossReferences(), PCB_BASE_FRAME::FocusOnItem(), PCB_BASE_FRAME::GetItem(), PCB_TEXT::GetShownText(), InvalidMatchesExpected(), DIALOG_DRC::OnDRCItemSelected(), DIALOG_CLEANUP_GRAPHICS::OnSelectItem(), DIALOG_CLEANUP_TRACKS_AND_VIAS::OnSelectItem(), and DIALOG_FOOTPRINT_CHECKER::OnSelectItem().

◆ GetLayer()

virtual PCB_LAYER_ID BOARD_ITEM::GetLayer ( ) const
inlinevirtualinherited

Return the primary layer this item is on.

Reimplemented in ZONE.

Definition at line 173 of file board_item.h.

173 { return m_layer; }
PCB_LAYER_ID m_layer
Definition: board_item.h:363

References BOARD_ITEM::m_layer.

Referenced by CN_LIST::Add(), BOARD_ADAPTER::addFootprintShapesWithClearance(), GRAPHICS_CLEANER::areEquivalent(), BOARD_CONNECTED_ITEM_DESC::BOARD_CONNECTED_ITEM_DESC(), BOARD_ITEM_DESC::BOARD_ITEM_DESC(), AR_AUTOPLACER::buildFpAreas(), TRACKS_CLEANER::cleanup(), CreateBoardSection(), MICROWAVE_TOOL::createMicrowaveInductor(), PCB_BASE_FRAME::CreateNewFootprint(), CreateRoutesSection(), DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), EDIT_TOOL::DragArcTrack(), KIGFX::PCB_PAINTER::draw(), PCB_EDIT_FRAME::ExchangeFootprint(), EXPORTER_PCB_VRML::ExportVrmlFootprint(), extractDiffPairCoupledItems(), EDIT_TOOL::FilletTracks(), PCB_TARGET::Flip(), PCB_TEXT::Flip(), TRACK::Flip(), FP_SHAPE::Flip(), FP_TEXT::Flip(), DIMENSION_BASE::Flip(), FOOTPRINT::Flip(), ARC::Flip(), PCB_SHAPE::Flip(), FOOTPRINT_DESC::FOOTPRINT_DESC(), PCB_IO::FootprintSave(), FootprintWriteShape(), PCB_IO::format(), PCB_IO::formatLayer(), FP_TEXT::FP_TEXT(), DSN::SPECCTRA_DB::FromBOARD(), AR_AUTOPLACER::genModuleOnRoutingMatrix(), FOOTPRINT::GetBoundingBox(), ZONE::GetLayer(), getMatchingTextItem(), TRACK::GetMsgPanelInfo(), VIA::GetMsgPanelInfo(), PAD::GetMsgPanelInfo(), AR_AUTOPLACER::getOptimalFPPlacement(), GetPad(), TRACK::GetWidthConstraints(), PCB_SELECTION_TOOL::GuessSelectionCandidates(), idf_export_footprint(), GENERAL_COLLECTOR::Inspect(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), isEdge(), PAD::IsFlipped(), PNS_KICAD_IFACE::IsItemVisible(), BOARD_ITEM::IsOnCopperLayer(), FP_SHAPE::IsParentFlipped(), FP_TEXT::IsParentFlipped(), itemIsIncludedByFilter(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromDrawsegments(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_PROPERTIES::OnAddField(), DIALOG_FOOTPRINT_CHECKER::OnSelectItem(), TRACK::cmp_tracks::operator()(), BOARD_ITEM::ptr_cmp::operator()(), PCB_SHAPE::cmp_drawings::operator()(), FOOTPRINT::cmp_drawings::operator()(), EAGLE_PLUGIN::packagePad(), BRDITEMS_PLOTTER::PlotBoardGraphicItems(), BRDITEMS_PLOTTER::PlotDimension(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotFootprintGraphicItems(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BRDITEMS_PLOTTER::PlotFootprintTextItems(), BRDITEMS_PLOTTER::PlotPcbShape(), BRDITEMS_PLOTTER::PlotPcbTarget(), BRDITEMS_PLOTTER::PlotPcbText(), CONVERT_TOOL::PolyToLines(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), processTextItem(), PAD_TOOL::recombinePad(), CLIPBOARD_IO::SaveSelection(), CONVERT_TOOL::SegmentToArc(), PCB_SELECTION_TOOL::Selectable(), GLOBAL_EDIT_TOOL::swapBoardItem(), PNS_KICAD_IFACE_BASE::syncArc(), PNS_KICAD_IFACE_BASE::syncGraphicalItem(), PNS_KICAD_IFACE_BASE::syncTrack(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::testAgainstEdge(), AR_AUTOPLACER::testFootprintOnBoard(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackAgainstItem(), TRACK_VIA_DESC::TRACK_VIA_DESC(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow(), BOARD_ADAPTER::transformFPShapesToPolygon(), FOOTPRINT::TransformFPShapesWithClearanceToPolygon(), TRACK::ViewGetLayers(), FP_TEXT::ViewGetLayers(), FP_TEXT::ViewGetLOD(), FP_ZONE::ViewGetLOD(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ GetLayerID()

const PCB_LAYER_ID BOARD::GetLayerID ( const wxString &  aLayerName) const

Return the ID of a layer.

Definition at line 320 of file board.cpp.

321 {
322 
323  // Check the BOARD physical layer names.
324  for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
325  {
326  if ( ( m_layers[ layer ].m_name == aLayerName )
327  || ( m_layers[ layer ].m_userName == aLayerName ) )
328  return ToLAYER_ID( layer );
329  }
330 
331  // Otherwise fall back to the system standard layer names for virtual layers.
332  for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
333  {
334  if( GetStandardLayerName( ToLAYER_ID( layer ) ) == aLayerName )
335  return ToLAYER_ID( layer );
336  }
337 
338  return UNDEFINED_LAYER;
339 }
LAYER m_layers[PCB_LAYER_ID_COUNT]
Definition: board.h:207
int LAYER_NUM
This can be replaced with int and removed.
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:905
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition: board.h:676

References GetStandardLayerName(), m_layers, PCB_LAYER_ID_COUNT, ToLAYER_ID(), and UNDEFINED_LAYER.

◆ GetLayerName() [1/2]

wxString BOARD_ITEM::GetLayerName ( ) const
inherited

Return the name of the PCB layer on which the item resides.

Returns
the layer name associated with this item.

Definition at line 60 of file board_item.cpp.

61 {
62  BOARD* board = GetBoard();
63 
64  if( board )
65  return board->GetLayerName( m_layer );
66 
67  // If no parent, return standard name
69 }
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:342
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:46
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
PCB_LAYER_ID m_layer
Definition: board_item.h:363
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition: board.h:676

References BOARD_ITEM::GetBoard(), GetLayerName(), GetStandardLayerName(), and BOARD_ITEM::m_layer.

Referenced by PCB_TEXT::GetMsgPanelInfo(), PCB_TARGET::GetMsgPanelInfo(), FP_TEXT::GetMsgPanelInfo(), DIMENSION_BASE::GetMsgPanelInfo(), PCB_SHAPE::GetMsgPanelInfo(), LEADER::GetMsgPanelInfo(), PCB_TEXT::GetSelectMenuText(), FP_SHAPE::GetSelectMenuText(), TRACK::GetSelectMenuText(), DIMENSION_BASE::GetSelectMenuText(), PCB_SHAPE::GetSelectMenuText(), PCB_TEXT::GetShownText(), and FOOTPRINT::ResolveTextVar().

◆ GetLayerName() [2/2]

wxString BOARD::GetLayerName ( PCB_LAYER_ID  aLayer) const

Return the name of a aLayer.

Parameters
aLayeris the PCB_LAYER_ID of the layer.
Returns
a string containing the appropriate layer type.

Definition at line 342 of file board.cpp.

343 {
344  // All layer names are stored in the BOARD.
345  if( IsLayerEnabled( aLayer ) )
346  {
347  // Standard names were set in BOARD::BOARD() but they may be over-ridden by
348  // BOARD::SetLayerName(). For copper layers, return the user defined layer name,
349  // if it was set. Otherwise return the Standard English layer name.
350  if( !m_layers[aLayer].m_userName.IsEmpty() )
351  return m_layers[aLayer].m_userName;
352  }
353 
354  return GetStandardLayerName( aLayer );
355 }
LAYER m_layers[PCB_LAYER_ID_COUNT]
Definition: board.h:207
bool IsLayerEnabled(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
Definition: board.h:515
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition: board.h:676

References GetStandardLayerName(), IsLayerEnabled(), and m_layers.

Referenced by GERBER_JOBFILE_WRITER::addJSONMaterialStackup(), DSN::SPECCTRA_DB::buildLayerMaps(), PANEL_SETUP_BOARD_STACKUP::createRowData(), PANEL_PCBNEW_COLOR_SETTINGS::createSwatches(), GRID_CELL_LAYER_RENDERER::Draw(), PCB_IO::formatBoardLayers(), GENDRILL_WRITER_BASE::GenDrillReportFile(), PCB_LAYER_SELECTOR::getLayerName(), PCB_LAYER_BOX_SELECTOR::getLayerName(), BOARD_ITEM::GetLayerName(), ZONE::GetMsgPanelInfo(), ZONE::GetSelectMenuText(), GRID_CELL_LAYER_SELECTOR::GetValue(), DIALOG_PLOT::init_Dialog(), DIALOG_EXPORT_SVG::initDialog(), DIALOG_PAD_PROPERTIES::initValues(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_ITEM::layerMaskDescribe(), VIA::layerMaskDescribe(), DIALOG_PLOT::Plot(), APPEARANCE_CONTROLS::rebuildLayers(), DIALOG_GLOBAL_DELETION::SetCurrentLayer(), ZONE_SETTINGS::SetupLayersList(), PANEL_SETUP_LAYERS::showBoardLayerNames(), PANEL_SETUP_LAYERS::TransferDataFromWindow(), DIALOG_PRINT_PCBNEW::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow(), BOARD_NETLIST_UPDATER::updateCopperZoneNets(), DIALOG_BOARD_STATISTICS::updateDrillGrid(), DIALOG_PAD_PROPERTIES::UpdateLayersDropdown(), HYPERLYNX_EXPORTER::writeDevices(), HYPERLYNX_EXPORTER::writeNetObjects(), HYPERLYNX_EXPORTER::writeSinglePadStack(), and HYPERLYNX_EXPORTER::writeStackupInfo().

◆ GetLayerSet()

◆ GetLayerType()

LAYER_T BOARD::GetLayerType ( PCB_LAYER_ID  aLayer) const

Return the type of the copper layer given by aLayer.

Parameters
aLayerA layer index, like B_Cu, etc.
Returns
LAYER_T - the layer type, or LAYER_T(-1) if the index was out of range.

Definition at line 376 of file board.cpp.

377 {
378  if( !IsCopperLayer( aLayer ) )
379  return LT_SIGNAL;
380 
381  //@@IMB: The original test was broken due to the discontinuity
382  // in the layer sequence.
383  if( IsLayerEnabled( aLayer ) )
384  return m_layers[aLayer].m_type;
385 
386  return LT_SIGNAL;
387 }
LAYER_T m_type
The type of the layer.
Definition: board.h:105
LAYER m_layers[PCB_LAYER_ID_COUNT]
Definition: board.h:207
bool IsLayerEnabled(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
Definition: board.h:515
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.

References IsCopperLayer(), IsLayerEnabled(), LT_SIGNAL, m_layers, and LAYER::m_type.

Referenced by PCB_IO::formatBoardLayers(), DSN::SPECCTRA_DB::FromBOARD(), GetGerberFileFunctionAttribute(), PANEL_SETUP_LAYERS::showLayerTypes(), and PANEL_SETUP_LAYERS::TransferDataFromWindow().

◆ GetMenuImage()

BITMAPS EDA_ITEM::GetMenuImage ( ) const
virtualinherited

◆ GetMsgPanelInfo()

void BOARD::GetMsgPanelInfo ( EDA_DRAW_FRAME aFrame,
std::vector< MSG_PANEL_ITEM > &  aList 
)
overridevirtual

Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.

Parameters
aListis the list to populate.

Reimplemented from EDA_ITEM.

Definition at line 1111 of file board.cpp.

1112 {
1113  wxString txt;
1114  int viasCount = 0;
1115  int trackSegmentsCount = 0;
1116 
1117  for( TRACK* item : m_tracks )
1118  {
1119  if( item->Type() == PCB_VIA_T )
1120  viasCount++;
1121  else
1122  trackSegmentsCount++;
1123  }
1124 
1125  txt.Printf( wxT( "%d" ), GetPadCount() );
1126  aList.emplace_back( _( "Pads" ), txt );
1127 
1128  txt.Printf( wxT( "%d" ), viasCount );
1129  aList.emplace_back( _( "Vias" ), txt );
1130 
1131  txt.Printf( wxT( "%d" ), trackSegmentsCount );
1132  aList.emplace_back( _( "Track Segments" ), txt );
1133 
1134  txt.Printf( wxT( "%d" ), GetNodesCount() );
1135  aList.emplace_back( _( "Nodes" ), txt );
1136 
1137  txt.Printf( wxT( "%d" ), m_NetInfo.GetNetCount() - 1 /* Don't include "No Net" in count */ );
1138  aList.emplace_back( _( "Nets" ), txt );
1139 
1140  txt.Printf( wxT( "%d" ), GetConnectivity()->GetUnconnectedCount() );
1141  aList.emplace_back( _( "Unrouted" ), txt );
1142 }
NETINFO_LIST m_NetInfo
Definition: board.h:234
TRACKS m_tracks
Definition: board.h:203
unsigned GetNodesCount(int aNet=-1) const
Definition: board.cpp:1027
unsigned GetPadCount() const
Definition: board.cpp:1951
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:416
#define _(s)
Definition: 3d_actions.cpp:33
unsigned GetNetCount() const
Definition: netinfo.h:339
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
Definition: track.h:83

References _, GetConnectivity(), NETINFO_LIST::GetNetCount(), GetNodesCount(), GetPadCount(), m_NetInfo, m_tracks, and PCB_VIA_T.

◆ GetNetClassAssignmentCandidates()

std::vector< wxString > BOARD::GetNetClassAssignmentCandidates ( ) const

Return a list of name candidates for netclass assignment.

Tokens may appear more than once if they were harvested from hierarchical nets (ie: /CLK, /sheet1/CLK).

Definition at line 1413 of file board.cpp.

1414 {
1415  std::vector<wxString> names;
1416 
1417  for( const NETINFO_ITEM* net : m_NetInfo )
1418  {
1419  if( !net->GetNetname().IsEmpty() )
1420  names.emplace_back( net->GetNetname() );
1421  }
1422 
1423  return names;
1424 }
NETINFO_LIST m_NetInfo
Definition: board.h:234
Handle the data for a net.
Definition: netinfo.h:64

References m_NetInfo.

Referenced by DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP(), and PANEL_SETUP_RULES::onScintillaCharAdded().

◆ GetNetCount()

unsigned BOARD::GetNetCount ( ) const
inline
Returns
the number of nets (NETINFO_ITEM)

Definition at line 785 of file board.h.

786  {
787  return m_NetInfo.GetNetCount();
788  }
NETINFO_LIST m_NetInfo
Definition: board.h:234
unsigned GetNetCount() const
Definition: netinfo.h:339

References NETINFO_LIST::GetNetCount(), and m_NetInfo.

Referenced by CreateSignalsSection(), and PCB_DRAW_PANEL_GAL::GetMsgPanelInfo().

◆ GetNetInfo() [1/2]

◆ GetNetInfo() [2/2]

NETINFO_LIST& BOARD::GetNetInfo ( )
inline

Definition at line 759 of file board.h.

760  {
761  return m_NetInfo;
762  }
NETINFO_LIST m_NetInfo
Definition: board.h:234

References m_NetInfo.

◆ GetNodesCount()

unsigned BOARD::GetNodesCount ( int  aNet = -1) const
Parameters
aNetOnly count nodes belonging to this net
Returns
the number of pads members of nets (i.e. with netcode > 0)

Definition at line 1027 of file board.cpp.

1028 {
1029  unsigned retval = 0;
1030 
1031  for( FOOTPRINT* footprint : Footprints() )
1032  {
1033  for( PAD* pad : footprint->Pads() )
1034  {
1035  if( ( aNet == -1 && pad->GetNetCode() > 0 ) || aNet == pad->GetNetCode() )
1036  retval++;
1037  }
1038  }
1039 
1040  return retval;
1041 }
FOOTPRINTS & Footprints()
Definition: board.h:305
Definition: pad.h:60

References Footprints(), and pad.

Referenced by PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), GetMsgPanelInfo(), DIALOG_NET_INSPECTOR::OnBoardItemAdded(), and DIALOG_NET_INSPECTOR::updateNet().

◆ GetPad() [1/4]

PAD * BOARD::GetPad ( const wxPoint &  aPosition,
LSET  aLayerMask 
) const

Find a pad aPosition on aLayer.

Parameters
aPositionA wxPoint object containing the position to hit test.
aLayerMaskA layer or layers to mask the hit test.
Returns
A pointer to a PAD object if found or NULL if not found.

Definition at line 1501 of file board.cpp.

1502 {
1503  if( !aLayerSet.any() )
1504  aLayerSet = LSET::AllCuMask();
1505 
1506  for( FOOTPRINT* footprint : m_footprints )
1507  {
1508  PAD* pad = NULL;
1509 
1510  if( footprint->HitTest( aPosition ) )
1511  pad = footprint->GetPad( aPosition, aLayerSet );
1512 
1513  if( pad )
1514  return pad;
1515  }
1516 
1517  return NULL;
1518 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:750
#define NULL
FOOTPRINTS m_footprints
Definition: board.h:202
Definition: pad.h:60

References LSET::AllCuMask(), m_footprints, NULL, and pad.

Referenced by GetPad().

◆ GetPad() [2/4]

PAD* BOARD::GetPad ( const wxPoint &  aPosition) const
inline

Definition at line 987 of file board.h.

988  {
989  return GetPad( aPosition, LSET().set() );
990  }
PAD * GetPad(const wxPoint &aPosition, LSET aLayerMask) const
Find a pad aPosition on aLayer.
Definition: board.cpp:1501
LSET is a set of PCB_LAYER_IDs.

References GetPad().

◆ GetPad() [3/4]

PAD * BOARD::GetPad ( const TRACK aTrace,
ENDPOINT_T  aEndPoint 
) const

Find a pad connected to aEndPoint of aTrace.

Parameters
aTraceA pointer to a TRACK object to hit test against.
aEndPointThe end point of aTrace the hit test against.
Returns
A pointer to a PAD object if found or NULL if not found.

Definition at line 1521 of file board.cpp.

1522 {
1523  const wxPoint& aPosition = aTrace->GetEndPoint( aEndPoint );
1524 
1525  LSET lset( aTrace->GetLayer() );
1526 
1527  return GetPad( aPosition, lset );
1528 }
PAD * GetPad(const wxPoint &aPosition, LSET aLayerMask) const
Find a pad aPosition on aLayer.
Definition: board.cpp:1501
LSET is a set of PCB_LAYER_IDs.
const wxPoint & GetEndPoint(ENDPOINT_T aEndPoint) const
Return the selected endpoint (start or end)
Definition: track.h:125
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:173

References TRACK::GetEndPoint(), BOARD_ITEM::GetLayer(), and GetPad().

◆ GetPad() [4/4]

PAD * BOARD::GetPad ( std::vector< PAD * > &  aPadList,
const wxPoint &  aPosition,
LSET  aLayerMask 
) const

Locate the pad connected at aPosition on aLayer starting at list position aPad.

This function uses a fast search in this sorted pad list and it is faster than GetPadFast(). This list is a sorted pad list must be built before calling this function.

Note
The normal pad list is sorted by increasing netcodes.
Parameters
aPadList= the list of pads candidates (a std::vector<PAD*>)
aPositionA wxPoint object containing the position to test.
aLayerMaskA layer or layers to mask the hit test.
Returns
a PAD object pointer to the connected pad.

Definition at line 1550 of file board.cpp.

1551 {
1552  // Search aPadList for aPosition
1553  // aPadList is sorted by X then Y values, and a fast binary search is used
1554  int idxmax = aPadList.size() - 1;
1555 
1556  int delta = aPadList.size();
1557 
1558  int idx = 0; // Starting index is the beginning of list
1559 
1560  while( delta )
1561  {
1562  // Calculate half size of remaining interval to test.
1563  // Ensure the computed value is not truncated (too small)
1564  if( (delta & 1) && ( delta > 1 ) )
1565  delta++;
1566 
1567  delta /= 2;
1568 
1569  PAD* pad = aPadList[idx];
1570 
1571  if( pad->GetPosition() == aPosition ) // candidate found
1572  {
1573  // The pad must match the layer mask:
1574  if( ( aLayerSet & pad->GetLayerSet() ).any() )
1575  return pad;
1576 
1577  // More than one pad can be at aPosition
1578  // search for a pad at aPosition that matched this mask
1579 
1580  // search next
1581  for( int ii = idx+1; ii <= idxmax; ii++ )
1582  {
1583  pad = aPadList[ii];
1584 
1585  if( pad->GetPosition() != aPosition )
1586  break;
1587 
1588  if( ( aLayerSet & pad->GetLayerSet() ).any() )
1589  return pad;
1590  }
1591  // search previous
1592  for( int ii = idx - 1 ;ii >=0; ii-- )
1593  {
1594  pad = aPadList[ii];
1595 
1596  if( pad->GetPosition() != aPosition )
1597  break;
1598 
1599  if( ( aLayerSet & pad->GetLayerSet() ).any() )
1600  return pad;
1601  }
1602 
1603  // Not found:
1604  return 0;
1605  }
1606 
1607  if( pad->GetPosition().x == aPosition.x ) // Must search considering Y coordinate
1608  {
1609  if( pad->GetPosition().y < aPosition.y ) // Must search after this item
1610  {
1611  idx += delta;
1612 
1613  if( idx > idxmax )
1614  idx = idxmax;
1615  }
1616  else // Must search before this item
1617  {
1618  idx -= delta;
1619 
1620  if( idx < 0 )
1621  idx = 0;
1622  }
1623  }
1624  else if( pad->GetPosition().x < aPosition.x ) // Must search after this item
1625  {
1626  idx += delta;
1627 
1628  if( idx > idxmax )
1629  idx = idxmax;
1630  }
1631  else // Must search before this item
1632  {
1633  idx -= delta;
1634 
1635  if( idx < 0 )
1636  idx = 0;
1637  }
1638  }
1639 
1640  return NULL;
1641 }
#define NULL
Definition: pad.h:60

References NULL, and pad.

◆ GetPadCount()

unsigned BOARD::GetPadCount ( ) const
Returns
the number of pads in board

Definition at line 1951 of file board.cpp.

1952 {
1953  unsigned retval = 0;
1954 
1955  for( FOOTPRINT* footprint : Footprints() )
1956  retval += footprint->Pads().size();
1957 
1958  return retval;
1959 }
FOOTPRINTS & Footprints()
Definition: board.h:305

References Footprints().

Referenced by PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), and GetMsgPanelInfo().

◆ GetPadFast()

PAD * BOARD::GetPadFast ( const wxPoint &  aPosition,
LSET  aLayerMask 
) const

Return pad found at aPosition on aLayerMask using the fast search method.

The fast search method only works if the pad list has already been built.

Parameters
aPositionA wxPoint object containing the position to hit test.
aLayerMaskA layer or layers to mask the hit test.
Returns
A pointer to a PAD object if found or NULL if not found.

Definition at line 1531 of file board.cpp.

1532 {
1533  for( FOOTPRINT* footprint : Footprints() )
1534  {
1535  for( PAD* pad : footprint->Pads() )
1536  {
1537  if( pad->GetPosition() != aPosition )
1538  continue;
1539 
1540  // Pad found, it must be on the correct layer
1541  if( ( pad->GetLayerSet() & aLayerSet ).any() )
1542  return pad;
1543  }
1544  }
1545 
1546  return nullptr;
1547 }
FOOTPRINTS & Footprints()
Definition: board.h:305
Definition: pad.h:60

References Footprints(), and pad.

◆ GetPads()

const std::vector< PAD * > BOARD::GetPads ( ) const

Return a reference to a list of all the pads.

The returned list is not sorted and contains pointers to PADS, but those pointers do not convey ownership of the respective PADs.

Returns
D_PADS - a full list of pads

Definition at line 1937 of file board.cpp.

1938 {
1939  std::vector<PAD*> allPads;
1940 
1941  for( FOOTPRINT* footprint : Footprints() )
1942  {
1943  for( PAD* pad : footprint->Pads() )
1944  allPads.push_back( pad );
1945  }
1946 
1947  return allPads;
1948 }
FOOTPRINTS & Footprints()
Definition: board.h:305
Definition: pad.h:60

References Footprints(), and pad.

Referenced by CreatePadsShapesSection(), BOARD_NETLIST_UPDATER::deleteSinglePadNets(), and SortedNetnamesList().

◆ GetPageSettings()

◆ GetParent()

BOARD_ITEM_CONTAINER* BOARD_ITEM::GetParent ( void  ) const
inlineinherited

Definition at line 168 of file board_item.h.

168 { return (BOARD_ITEM_CONTAINER*) m_parent; }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:529
Abstract interface for BOARD_ITEMs capable of storing other items inside.

References EDA_ITEM::m_parent.

Referenced by PCB_POINT_EDITOR::addCorner(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), PNS_KICAD_IFACE::Commit(), EDIT_TOOL::copyToClipboard(), FOOTPRINT::CoverageRatio(), EDIT_TOOL::CreateArray(), BOARD_ITEM::DeleteStructure(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::Drag(), EDIT_TOOL::DragArcTrack(), KIGFX::PCB_PAINTER::draw(), EDIT_TOOL::Duplicate(), PCB_SELECTION_TOOL::FilterCollectorForGroups(), EDIT_TOOL::Flip(), PCB_IO::format(), FormatProbeItem(), BOARD_ITEM::GetBoard(), PCB_MARKER::GetColorLayer(), ALIGN_DISTRIBUTE_TOOL::GetSelections(), FP_TEXT::GetSelectMenuText(), PCB_TEXT::GetShownText(), FP_TEXT::GetShownText(), getTopLevelGroup(), insideArea(), GENERAL_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), DRC_ENGINE::IsNetTie(), FP_SHAPE::IsParentFlipped(), FP_TEXT::IsParentFlipped(), LEGACY_PLUGIN::loadMODULE_TEXT(), memberOf(), EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), ALTIUM_PCB::ParseTexts6Data(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), POSITION_RELATIVE_TOOL::PositionRelative(), BOARD_COMMIT::Push(), EDIT_TOOL::Rotate(), DRC_TEST_PROVIDER_SILK_CLEARANCE::Run(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), CLIPBOARD_IO::SaveSelection(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::Selectable(), SwapItemData(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), PCB_MARKER::ViewGetLayers(), FP_ZONE::ViewGetLOD(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ GetParentGroup()

◆ GetPlotOptions()

const PCB_PLOT_PARAMS& BOARD::GetPlotOptions ( ) const
inline

◆ GetPosition()

wxPoint BOARD::GetPosition ( ) const
overridevirtual

Reimplemented from EDA_ITEM.

Definition at line 236 of file board.cpp.

237 {
238  return ZeroOffset;
239 }
static wxPoint ZeroOffset
A value of wxPoint(0,0) which can be passed to the Draw() functions.
Definition: board_item.h:152

References BOARD_ITEM::ZeroOffset.

◆ GetProject()

PROJECT* BOARD::GetProject ( ) const
inline

◆ GetProperties()

const std::map<wxString, wxString>& BOARD::GetProperties ( ) const
inline

Definition at line 330 of file board.h.

330 { return m_properties; }
std::map< wxString, wxString > m_properties
Definition: board.h:214

References m_properties.

Referenced by PCB_CONTROL::AppendBoard(), and PCB_IO::formatProperties().

◆ GetSelectMenuText()

wxString BOARD::GetSelectMenuText ( EDA_UNITS  aUnits) const
overridevirtual

Return the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position.

The default version of this function raises an assertion in the debug mode and returns a string to indicate that it was not overridden to provide the object specific text.

Returns
The menu text string.

Reimplemented from EDA_ITEM.

Definition at line 775 of file board.cpp.

776 {
777  return wxString::Format( _( "PCB" ) );
778 }
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
#define _(s)
Definition: 3d_actions.cpp:33

References _, and Format().

◆ GetSortedPadListByXthenYCoord()

void BOARD::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, and for increasing y coordinate for same values of x coordinates.

The vector only holds pointers to the pads and those pointers are only references to pads which are owned by the BOARD through other links.

Parameters
aVectorWhere to put the pad pointers.
aNetCode= the netcode filter: = -1 to build the full pad list. = a given netcode to build the pad list relative to the given net

Definition at line 1658 of file board.cpp.

1659 {
1660  for( FOOTPRINT* footprint : Footprints() )
1661  {
1662  for( PAD* pad : footprint->Pads( ) )
1663  {
1664  if( aNetCode < 0 || pad->GetNetCode() == aNetCode )
1665  aVector.push_back( pad );
1666  }
1667  }
1668 
1669  std::sort( aVector.begin(), aVector.end(), sortPadsByXthenYCoord );
1670 }
bool sortPadsByXthenYCoord(PAD *const &aLH, PAD *const &aRH)
Used by #GetSortedPadListByXCoord to sort a pad list by X coordinate value.
Definition: board.cpp:1649
FOOTPRINTS & Footprints()
Definition: board.h:305
Definition: pad.h:60

References Footprints(), pad, and sortPadsByXthenYCoord().

◆ GetStandardLayerName()

static wxString BOARD::GetStandardLayerName ( PCB_LAYER_ID  aLayerId)
inlinestatic

Return an "English Standard" name of a PCB layer when given aLayerNumber.

This function is static so it can be called without a BOARD instance. Use GetLayerName() if want the layer names of a specific BOARD, which could be different than the default if the user has renamed any copper layers.

Parameters
aLayerIdis the layer identifier (index) to fetch
Returns
const wxString - containing the layer name or "BAD INDEX" if aLayerId is not legal

Definition at line 676 of file board.h.

677  {
678  // a BOARD's standard layer name is the PCB_LAYER_ID fixed name
679  return LayerName( aLayerId );
680  }
wxString LayerName(int aLayer)
Returns the default display name for a given layer.
Definition: layer_id.cpp:27

References LayerName().

Referenced by BOARD(), DIALOG_EXPORT_SVG::ExportSVGFile(), PCB_IO::format(), GetLayerID(), BOARD_ITEM::GetLayerName(), and GetLayerName().

◆ GetState()

int EDA_ITEM::GetState ( int  type) const
inlineinherited

Definition at line 187 of file eda_item.h.

188  {
189  return m_status & type;
190  }
STATUS_FLAGS m_status
Definition: eda_item.h:528

References EDA_ITEM::m_status.

Referenced by BOARD_ITEM::IsLocked().

◆ GetStatus()

STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 200 of file eda_item.h.

200 { return m_status; }
STATUS_FLAGS m_status
Definition: eda_item.h:528

References EDA_ITEM::m_status.

◆ GetTimeStamp()

int BOARD::GetTimeStamp ( )
inline

Definition at line 286 of file board.h.

286 { return m_timeStamp; }
int m_timeStamp
Definition: board.h:197

References m_timeStamp.

Referenced by FOOTPRINT::GetBoundingBox(), and FOOTPRINT::GetBoundingHull().

◆ GetTitleBlock() [1/2]

TITLE_BLOCK& BOARD::GetTitleBlock ( )
inline

◆ GetTitleBlock() [2/2]

const TITLE_BLOCK& BOARD::GetTitleBlock ( ) const
inline

Definition at line 615 of file board.h.

615 { return m_titles; }
TITLE_BLOCK m_titles
Definition: board.h:218

References m_titles.

◆ GetTrackLength()

std::tuple< int, double, double > BOARD::GetTrackLength ( const TRACK aTrack) const

Returns data on the length and number of track segments connected to a given track.

This uses the connectivity data for the board to calculate connections

Parameters
aTrackStarting track (can also be a via) to check against for connection.
Returns
a tuple containing <number, length, package length>

Definition at line 1683 of file board.cpp.

1684 {
1685  int count = 0;
1686  double length = 0.0;
1687  double package_length = 0.0;
1688 
1689  constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T, PCB_PAD_T, EOT };
1690  auto connectivity = GetBoard()->GetConnectivity();
1692 
1693  for( BOARD_CONNECTED_ITEM* item : connectivity->GetConnectedItems(
1694  static_cast<const BOARD_CONNECTED_ITEM*>( &aTrack ), types ) )
1695  {
1696  count++;
1697 
1698  if( TRACK* track = dynamic_cast<TRACK*>( item ) )
1699  {
1700  if( track->Type() == PCB_VIA_T )
1701  {
1702  VIA* via = static_cast<VIA*>( track );
1703  length += stackup.GetLayerDistance( via->TopLayer(), via->BottomLayer() );
1704  continue;
1705  }
1706  else if( track->Type() == PCB_ARC_T )
1707  {
1708  // Note: we don't apply the clip-to-pad optimization if an arc ends in a pad
1709  // Room for future improvement.
1710  length += track->GetLength();
1711  continue;
1712  }
1713 
1714  bool inPad = false;
1715  SEG trackSeg( track->GetStart(), track->GetEnd() );
1716  double segLen = trackSeg.Length();
1717  double segInPadLen = 0;
1718 
1719  for( auto pad_it : connectivity->GetConnectedPads( item ) )
1720  {
1721  PAD* pad = static_cast<PAD*>( pad_it );
1722 
1723  bool hitStart = pad->HitTest( track->GetStart(), track->GetWidth() / 2 );
1724  bool hitEnd = pad->HitTest( track->GetEnd(), track->GetWidth() / 2 );
1725 
1726  if( hitStart && hitEnd )
1727  {
1728  inPad = true;
1729  break;
1730  }
1731  else if( hitStart || hitEnd )
1732  {
1733  VECTOR2I loc;
1734 
1735  // We may not collide even if we passed the bounding-box hit test
1736  if( pad->GetEffectivePolygon()->Collide( trackSeg, 0, nullptr, &loc ) )
1737  {
1738  // Part 1: length of the seg to the intersection with the pad poly
1739  if( hitStart )
1740  trackSeg.A = loc;
1741  else
1742  trackSeg.B = loc;
1743 
1744  segLen = trackSeg.Length();
1745 
1746  // Part 2: length from the interesection to the pad anchor
1747  segInPadLen += ( loc - pad->GetPosition() ).EuclideanNorm();
1748  }
1749  }
1750  }
1751 
1752  if( !inPad )
1753  length += segLen + segInPadLen;
1754  }
1755  else if( PAD* pad = dyn_cast<PAD*>( item ) )
1756  {
1757  package_length += pad->GetPadToDieLength();
1758  }
1759  }
1760 
1761  return std::make_tuple( count, length, package_length );
1762 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:148
int Length() const
Return the length (this).
Definition: seg.h:355
Definition: track.h:343
Manage layers needed to make a physical board.
int GetLayerDistance(PCB_LAYER_ID aFirstLayer, PCB_LAYER_ID aSecondLayer) const
Calculate the distance (height) between the two given copper layers.
class ARC, an arc track segment on a copper layer
Definition: typeinfo.h:97
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.h:593
class PAD, a pad in a footprint
Definition: typeinfo.h:89
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
BOARD_STACKUP & GetStackupDescriptor()
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:46
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:416
Definition: seg.h:41
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
Definition: pad.h:60
Definition: track.h:83

References EOT, EuclideanNorm(), BOARD_ITEM::GetBoard(), GetConnectivity(), GetDesignSettings(), BOARD_STACKUP::GetLayerDistance(), BOARD_DESIGN_SETTINGS::GetStackupDescriptor(), SEG::Length(), pad, PCB_ARC_T, PCB_PAD_T, PCB_TRACE_T, PCB_VIA_T, and via.

Referenced by NETINFO_ITEM::GetMsgPanelInfo(), and TRACK::GetMsgPanelInfo().

◆ GetUnconnectedNetCount()

unsigned BOARD::GetUnconnectedNetCount ( ) const
Returns
the number of unconnected nets in the current ratsnest.

Definition at line 1044 of file board.cpp.

1045 {
1046  return m_connectivity->GetUnconnectedCount();
1047 }
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: board.h:215

References m_connectivity.

◆ GetVisibleElements()

GAL_SET BOARD::GetVisibleElements ( ) const

Returns a set of all the element categories that are visible.

Returns
the set of visible GAL layers
See also
enum GAL_LAYER_ID

Definition at line 501 of file board.cpp.

502 {
504 }
virtual PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
Definition: project.h:151
GAL_SET m_VisibleItems
The GAL layers (aka items) that are turned on for viewing (.
Helper for storing and iterating over GAL_LAYER_IDs.
PROJECT * m_project
Definition: board.h:220

References PROJECT::GetLocalSettings(), m_project, PROJECT_LOCAL_SETTINGS::m_VisibleItems, and GAL_SET::set().

Referenced by APPEARANCE_CONTROLS::getVisibleObjects(), and PCB_EDIT_FRAME::setupUIConditions().

◆ GetVisibleLayers()

LSET BOARD::GetVisibleLayers ( ) const

A proxy function that calls the correspondent function in m_BoardSettings Returns a bit-mask of all the layers that are visible.

Returns
int - the visible layers in bit-mapped form.

Definition at line 461 of file board.cpp.

462 {
464 }
LSET m_VisibleLayers
Board settings.
virtual PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
Definition: project.h:151
static LSET AllLayersMask()
Definition: lset.cpp:787
PROJECT * m_project
Definition: board.h:220

References LSET::AllLayersMask(), PROJECT::GetLocalSettings(), m_project, and PROJECT_LOCAL_SETTINGS::m_VisibleLayers.

Referenced by ComputeBoundingBox(), GENDRILL_WRITER_BASE::genDrillMapFile(), PCB_BASE_FRAME::GetCollectorsGuide(), APPEARANCE_CONTROLS::getVisibleLayers(), DIALOG_DRC::OnDRCItemSelected(), DIALOG_FOOTPRINT_CHECKER::OnSelectItem(), PCB_SELECTION_TOOL::Selectable(), PCB_EDIT_FRAME::UpdateUserInterface(), VIA::ViewGetLOD(), and PAD::ViewGetLOD().

◆ GetX()

int BOARD_ITEM::GetX ( ) const
inlineinherited

◆ GetY()

int BOARD_ITEM::GetY ( ) const
inlineinherited

◆ GetZoneList()

std::list< ZONE * > BOARD::GetZoneList ( bool  aIncludeZonesInFootprints = false) const
Returns
a std::list of pointers to all board zones (possibly including zones in footprints)

Definition at line 1829 of file board.cpp.

1830 {
1831  std::list<ZONE*> zones;
1832 
1833  for( ZONE* zone : Zones() )
1834  zones.push_back( zone );
1835 
1836  if( aIncludeZonesInFootprints )
1837  {
1838  for( FOOTPRINT* footprint : m_footprints )
1839  {
1840  for( FP_ZONE* zone : footprint->Zones() )
1841  zones.push_back( zone );
1842  }
1843  }
1844 
1845  return zones;
1846 }
ZONES & Zones()
Definition: board.h:311
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
FOOTPRINTS m_footprints
Definition: board.h:202
A specialization of ZONE for use in footprints.
Definition: zone.h:943

References m_footprints, and Zones().

◆ GetZoneSettings()

const ZONE_SETTINGS& BOARD::GetZoneSettings ( ) const
inlineoverridevirtual

Fetch the zone settings for this container.

Reimplemented from BOARD_ITEM_CONTAINER.

Definition at line 598 of file board.h.

599  {
601  }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.h:593
ZONE_SETTINGS & GetDefaultZoneSettings()

References BOARD_DESIGN_SETTINGS::GetDefaultZoneSettings(), and GetDesignSettings().

Referenced by LEGACY_PLUGIN::loadSETUP().

◆ GroupLegalOps()

BOARD::GroupLegalOpsField BOARD::GroupLegalOps ( const PCB_SELECTION selection) const

Definition at line 2155 of file board.cpp.

2156 {
2157  bool hasGroup = false;
2158  bool hasMember = false;
2159 
2160  for( EDA_ITEM* item : selection )
2161  {
2162  if( item->Type() == PCB_GROUP_T )
2163  hasGroup = true;
2164 
2165  if( item->GetParent() && item->GetParent()->Type() == PCB_GROUP_T )
2166  hasMember = true;
2167  }
2168 
2169  GroupLegalOpsField legalOps;
2170 
2171  legalOps.create = true;
2172  legalOps.removeItems = hasMember;
2173  legalOps.ungroup = hasGroup;
2174  legalOps.enter = hasGroup && selection.Size() == 1;
2175 
2176  return legalOps;
2177 }
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:108
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150

References BOARD::GroupLegalOpsField::create, BOARD::GroupLegalOpsField::enter, PCB_GROUP_T, BOARD::GroupLegalOpsField::removeItems, and BOARD::GroupLegalOpsField::ungroup.

◆ Groups() [1/2]

GROUPS& BOARD::Groups ( )
inline

The groups must maintain the following invariants.

These are checked by GroupsSanityCheck():

  • An item may appear in at most one group
  • Each group must contain at least one item
  • If a group specifies a name, it must be unique
  • The graph of groups containing subgroups must be acyclic.

Definition at line 325 of file board.h.

325 { return m_groups; }
GROUPS m_groups
Definition: board.h:204

References m_groups.

Referenced by PCB_CONTROL::AppendBoard(), PCB_IO::format(), GroupsSanityCheckInternal(), PCB_CONTROL::placeBoardItems(), BOARD_EDITOR_CONTROL::RepairBoard(), and TestForExistingItem().

◆ Groups() [2/2]

const GROUPS& BOARD::Groups ( ) const
inline

Definition at line 326 of file board.h.

326 { return m_groups; }
GROUPS m_groups
Definition: board.h:204

References m_groups.

◆ GroupsSanityCheck()

wxString BOARD::GroupsSanityCheck ( bool  repair = false)

Definition at line 2076 of file board.cpp.

2077 {
2078  if( repair )
2079  {
2080  while( GroupsSanityCheckInternal( repair ) != wxEmptyString )
2081  {};
2082 
2083  return wxEmptyString;
2084  }
2085  return GroupsSanityCheckInternal( repair );
2086 }
wxString GroupsSanityCheckInternal(bool repair)
Definition: board.cpp:2089

References GroupsSanityCheckInternal().

Referenced by PCB_IO::Save().

◆ GroupsSanityCheckInternal()

wxString BOARD::GroupsSanityCheckInternal ( bool  repair)

Definition at line 2089 of file board.cpp.

2090 {
2091  // Cycle detection
2092  //
2093  // Each group has at most one parent group.
2094  // So we start at group 0 and traverse the parent chain, marking groups seen along the way.
2095  // If we ever see a group that we've already marked, that's a cycle.
2096  // If we reach the end of the chain, we know all groups in that chain are not part of any cycle.
2097  //
2098  // Algorithm below is linear in the # of groups because each group is visited only once.
2099  // There may be extra time taken due to the container access calls and iterators.
2100  //
2101  // Groups we know are cycle free
2102  std::unordered_set<PCB_GROUP*> knownCycleFreeGroups;
2103  // Groups in the current chain we're exploring.
2104  std::unordered_set<PCB_GROUP*> currentChainGroups;
2105  // Groups we haven't checked yet.
2106  std::unordered_set<PCB_GROUP*> toCheckGroups;
2107 
2108  // Initialize set of groups to check that could participate in a cycle.
2109  for( PCB_GROUP* group : Groups() )
2110  toCheckGroups.insert( group);
2111 
2112  while( !toCheckGroups.empty() )
2113  {
2114  currentChainGroups.clear();
2115  PCB_GROUP* group = *toCheckGroups.begin();
2116 
2117  while( true )
2118  {
2119  if( currentChainGroups.find( group ) != currentChainGroups.end() )
2120  {
2121  if( repair )
2122  Remove( group );
2123 
2124  return "Cycle detected in group membership";
2125  }
2126  else if( knownCycleFreeGroups.find( group ) != knownCycleFreeGroups.end() )
2127  {
2128  // Parent is a group we know does not lead to a cycle
2129  break;
2130  }
2131 
2132  currentChainGroups.insert( group );
2133  // We haven't visited currIdx yet, so it must be in toCheckGroups
2134  toCheckGroups.erase( group );
2135 
2136  group = group->GetParentGroup();
2137 
2138  if( !group )
2139  {
2140  // end of chain and no cycles found in this chain
2141  break;
2142  }
2143  }
2144 
2145  // No cycles found in chain, so add it to set of groups we know don't participate
2146  // in a cycle.
2147  knownCycleFreeGroups.insert( currentChainGroups.begin(), currentChainGroups.end() );
2148  }
2149 
2150  // Success
2151  return "";
2152 }
GROUPS & Groups()
The groups must maintain the following invariants.
Definition: board.h:325
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:50
void Remove(BOARD_ITEM *aBoardItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
Removes an item from the container.
Definition: board.cpp:665

References group, Groups(), and Remove().

Referenced by GroupsSanityCheck().

◆ HasFlag()

◆ HighLightOFF()

void BOARD::HighLightOFF ( )
inline

Disable net highlight.

Definition at line 484 of file board.h.

485  {
486  HighLightON( false );
487  }
void HighLightON(bool aValue=true)
Enable or disable net highlighting.
Definition: board.cpp:2066

References HighLightON().

◆ HighLightON()

void BOARD::HighLightON ( bool  aValue = true)

Enable or disable net highlighting.

If a netcode >= 0 has been set with SetHighLightNet and aValue is true, the net will be highlighted. If aValue is false, net highlighting will be disabled regardless of the highlight netcode being set.

Definition at line 2066 of file board.cpp.

2067 {
2068  if( m_highLight.m_highLightOn != aValue )
2069  {
2070  m_highLight.m_highLightOn = aValue;
2072  }
2073 }
void InvokeListeners(Func &&aFunc, Args &&... args)
Definition: board.h:245
HIGH_LIGHT_INFO m_highLight
Definition: board.h:209
bool m_highLightOn
Definition: board.h:135
virtual void OnBoardHighlightNetChanged(BOARD &aBoard)
Definition: board.h:167

References InvokeListeners(), m_highLight, HIGH_LIGHT_INFO::m_highLightOn, and BOARD_LISTENER::OnBoardHighlightNetChanged().

Referenced by PCB_EDIT_FRAME::ExecuteRemoteCommand(), BOARD_INSPECTION_TOOL::highlightNet(), and HighLightOFF().

◆ HitTest() [1/2]

virtual bool EDA_ITEM::HitTest ( const wxPoint &  aPosition,
int  aAccuracy = 0 
) const
inlinevirtualinherited

◆ HitTest() [2/2]

virtual bool EDA_ITEM::HitTest ( const EDA_RECT aRect,
bool  aContained,
int  aAccuracy = 0 
) const
inlinevirtualinherited

Test if aRect intersects or is contained within the bounding box of an item.

Parameters
aRectA reference to a EDA_RECT object containing the rectangle to test.
aContainedSet to true to test for containment instead of an intersection.
aAccuracyIncrease aRect by this amount.
Returns
True if aRect contains or intersects the item bounding box.

Reimplemented in SCH_COMPONENT, PAD, ZONE, FOOTPRINT, VIA, SCH_SHEET, DS_DRAW_ITEM_BITMAP, DS_DRAW_ITEM_TEXT, ARC, PCB_SHAPE, SCH_TEXT, DIMENSION_BASE, DS_DRAW_ITEM_RECT, SCH_LINE, GERBER_DRAW_ITEM, FP_TEXT, SCH_FIELD, TRACK, DS_DRAW_ITEM_POLYPOLYGONS, LIB_PIN, LIB_ITEM, PCB_GROUP, SCH_BITMAP, SCH_NO_CONNECT, SCH_JUNCTION, SCH_BUS_ENTRY_BASE, PCB_TEXT, DS_DRAW_ITEM_BASE, PCB_TARGET, LIB_POLYLINE, LIB_BEZIER, LIB_TEXT, LIB_ARC, LIB_RECTANGLE, and LIB_CIRCLE.

Definition at line 288 of file eda_item.h.

289  {
290  return false; // derived classes should override this function
291  }

◆ IncrementTimeStamp()

void BOARD::IncrementTimeStamp ( )
inline

Definition at line 271 of file board.h.

272  {
273  m_timeStamp++;
274 
275  {
276  std::unique_lock<std::mutex> cacheLock( m_CachesMutex );
277  m_InsideAreaCache.clear();
278  m_InsideCourtyardCache.clear();
279  m_InsideFCourtyardCache.clear();
280  m_InsideBCourtyardCache.clear();
281  }
282 
283  m_CopperZoneRTrees.clear();
284  }
std::map< std::pair< BOARD_ITEM *, BOARD_ITEM * >, bool > m_InsideCourtyardCache
Definition: board.h:1153
std::mutex m_CachesMutex
Definition: board.h:1152
std::map< ZONE *, std::unique_ptr< DRC_RTREE > > m_CopperZoneRTrees
Definition: board.h:1158
std::map< std::pair< BOARD_ITEM *, BOARD_ITEM * >, bool > m_InsideBCourtyardCache
Definition: board.h:1155
std::map< std::pair< BOARD_ITEM *, BOARD_ITEM * >, bool > m_InsideAreaCache
Definition: board.h:1156
int m_timeStamp
Definition: board.h:197
std::map< std::pair< BOARD_ITEM *, BOARD_ITEM * >, bool > m_InsideFCourtyardCache
Definition: board.h:1154

References m_CachesMutex, m_CopperZoneRTrees, m_InsideAreaCache, m_InsideBCourtyardCache, m_InsideCourtyardCache, m_InsideFCourtyardCache, and m_timeStamp.

Referenced by ZONE_FILLER_TOOL::FillAllZones(), DRC_ENGINE::InitEngine(), PCB_BASE_FRAME::OnModify(), and DRC_ENGINE::RunTests().

◆ InvokeListeners()

template<typename Func , typename... Args>
void BOARD::InvokeListeners ( Func &&  aFunc,
Args &&...  args 
)
inlineprivate

Definition at line 245 of file board.h.

246  {
247  for( auto&& l : m_listeners )
248  ( l->*aFunc )( std::forward<Args>( args )... );
249  }
std::vector< BOARD_LISTENER * > m_listeners
Definition: board.h:236

References m_listeners.

Referenced by Add(), FinalizeBulkAdd(), FinalizeBulkRemove(), HighLightON(), OnItemChanged(), OnItemsChanged(), PadDelete(), Remove(), ResetNetHighLight(), SetHighLightNet(), and SynchronizeNetsAndNetClasses().

◆ IsBrightened()

◆ IsConnected()

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 171 of file eda_item.h.

171 { return m_flags & IS_DRAGGED; }
#define IS_DRAGGED
Item being dragged.
Definition: eda_item.h:109
STATUS_FLAGS m_flags
Definition: eda_item.h:531

References IS_DRAGGED, and EDA_ITEM::m_flags.

Referenced by DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES().

◆ IsElementVisible()

bool BOARD::IsElementVisible ( GAL_LAYER_ID  aLayer) const

Test whether a given element category is visible.

Keep this as an inline function.

Parameters
aLayeris from the enum by the same name
Returns
bool - true if the element is visible.
See also
enum GAL_LAYER_ID

Definition at line 507 of file board.cpp.

508 {
510 }
virtual PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
Definition: project.h:151
GAL_SET m_VisibleItems
The GAL layers (aka items) that are turned on for viewing (.
PROJECT * m_project
Definition: board.h:220

References GAL_LAYER_ID_START, PROJECT::GetLocalSettings(), m_project, and PROJECT_LOCAL_SETTINGS::m_VisibleItems.

Referenced by ComputeBoundingBox(), KIGFX::PCB_PAINTER::draw(), FOOTPRINT::GetBoundingBox(), PCB_BASE_FRAME::GetCollectorsGuide(), PCB_SELECTION_TOOL::getCollectorsGuide(), PCB_EDIT_FRAME::IsElementVisible(), IsFootprintLayerVisible(), PCB_SELECTION_TOOL::Selectable(), PCBNEW_PRINTOUT::setupViewLayers(), and PCB_DRAW_PANEL_GAL::SyncLayersVisibility().

◆ IsEmpty()

bool BOARD::IsEmpty ( ) const
inline

Definition at line 353 of file board.h.

354  {
355  return m_drawings.empty() && m_footprints.empty() && m_tracks.empty() && m_zones.empty();
356  }
TRACKS m_tracks
Definition: board.h:203
ZONES m_zones
Definition: board.h:205
DRAWINGS m_drawings
Definition: board.h:201
FOOTPRINTS m_footprints
Definition: board.h:202

References m_drawings, m_footprints, m_tracks, and m_zones.

Referenced by BOARD_NETLIST_UPDATER::estimateComponentInsertionPosition(), PCB_EDIT_FRAME::Files_io_from_id(), PCB_EDITOR_CONDITIONS::hasItemsFunc(), EDIT_TOOL::Init(), and DIALOG_BOARD_REANNOTATE::OnApplyClick().

◆ IsEntered()

bool EDA_ITEM::IsEntered ( ) const
inlineinherited

Definition at line 174 of file eda_item.h.

174 { return m_flags & ENTERED; }
#define ENTERED
indicates a group has been entered
Definition: eda_item.h:138
STATUS_FLAGS m_flags
Definition: eda_item.h:531

References ENTERED, and EDA_ITEM::m_flags.

Referenced by KIGFX::PCB_PAINTER::draw().

◆ IsFootprintHolder()

bool BOARD::IsFootprintHolder ( ) const
inline

Find out if the board is being used to hold a single footprint for editing/viewing.

Returns
if the board is just holding a footprint

Definition at line 293 of file board.h.

294  {
296  }
BOARD_USE m_boardUse
What is this board being used for.
Definition: board.h:196

References FPHOLDER, and m_boardUse.

Referenced by BOARD_ADAPTER::createBoardPolygon(), and BOARD_ADAPTER::InitSettings().

◆ IsFootprintLayerVisible()

bool BOARD::IsFootprintLayerVisible ( PCB_LAYER_ID  aLayer) const

Expect either of the two layers on which a footprint can reside, and returns whether that layer is visible.

Parameters
aLayerOne of the two allowed layers for footprints: F_Cu or B_Cu
Returns
bool - true if the layer is visible, else false.

Definition at line 546 of file board.cpp.

547 {
548  switch( aLayer )
549  {
550  case F_Cu:
551  return IsElementVisible( LAYER_MOD_FR );
552 
553  case B_Cu:
554  return IsElementVisible( LAYER_MOD_BK );
555 
556  default:
557  wxFAIL_MSG( wxT( "BOARD::IsModuleLayerVisible() param error: bad layer" ) );
558  return true;
559  }
560 }
show footprints on back
show footprints on front
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
Definition: board.cpp:507

References B_Cu, F_Cu, IsElementVisible(), LAYER_MOD_BK, and LAYER_MOD_FR.

Referenced by GetFootprint().

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 256 of file eda_item.h.

256 { return m_forceVisible; }
bool m_forceVisible
Definition: eda_item.h:530

References EDA_ITEM::m_forceVisible.

Referenced by KIGFX::SCH_PAINTER::draw(), and SCH_FIELD::Print().

◆ IsHighLightNetON()

bool BOARD::IsHighLightNetON ( ) const
inline
Returns
true if a net is currently highlighted

Definition at line 471 of file board.h.

471 { return m_highLight.m_highLightOn; }
HIGH_LIGHT_INFO m_highLight
Definition: board.h:209
bool m_highLightOn
Definition: board.h:135

References m_highLight, and HIGH_LIGHT_INFO::m_highLightOn.

Referenced by PCB_EDIT_FRAME::ExecuteRemoteCommand(), and DIALOG_NET_INSPECTOR::OnBoardHighlightNetChanged().

◆ IsLayerEnabled()

bool BOARD::IsLayerEnabled ( PCB_LAYER_ID  aLayer) const
inline

A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer is enabled.

Parameters
aLayer= The layer to be tested
Returns
bool - true if the layer is visible.

Definition at line 515 of file board.h.

516  {
517  return GetDesignSettings().IsLayerEnabled( aLayer );
518  }
bool IsLayerEnabled(PCB_LAYER_ID aLayerId) const
Test whether a given layer aLayerId is enabled.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.h:593

References GetDesignSettings(), and BOARD_DESIGN_SETTINGS::IsLayerEnabled().

Referenced by GRID_CELL_LAYER_SELECTOR::BeginEdit(), DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), GetLayerName(), GetLayerType(), BOARD_ADAPTER::Is3dLayerEnabled(), PCB_LAYER_SELECTOR::isLayerEnabled(), PCB_LAYER_BOX_SELECTOR::isLayerEnabled(), SetLayerName(), SetLayerType(), PANEL_SETUP_LAYERS::setUserDefinedLayerCheckBoxes(), and DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZones().

◆ IsLayerVisible()

bool BOARD::IsLayerVisible ( PCB_LAYER_ID  aLayer) const

A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer is visible.

Parameters
aLayer= The layer to be tested
Returns
bool - true if the layer is visible.

Definition at line 453 of file board.cpp.

454 {
455  // If there is no project, assume layer is visible always
456  return GetDesignSettings().IsLayerEnabled( aLayer )
457  && ( !m_project || m_project->GetLocalSettings().m_VisibleLayers[aLayer] );
458 }
LSET m_VisibleLayers
Board settings.
bool IsLayerEnabled(PCB_LAYER_ID aLayerId) const
Test whether a given layer aLayerId is enabled.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.h:593
virtual PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
Definition: project.h:151
PROJECT * m_project
Definition: board.h:220

References GetDesignSettings(), PROJECT::GetLocalSettings(), BOARD_DESIGN_SETTINGS::IsLayerEnabled(), m_project, and PROJECT_LOCAL_SETTINGS::m_VisibleLayers.

Referenced by DRAWING_TOOL::DrawVia(), FOOTPRINT::GetBoundingBox(), PCB_BASE_FRAME::GetDocumentExtents(), BOARD_ADAPTER::Is3dLayerEnabled(), PCB_CONTROL::LayerNext(), PCB_CONTROL::LayerPrev(), PCB_SELECTION_TOOL::Selectable(), and PCB_DRAW_PANEL_GAL::SyncLayersVisibility().

◆ IsLocked()

virtual bool BOARD_ITEM::IsLocked ( ) const
inlinevirtualinherited

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 168 of file eda_item.h.

168 { return m_flags & IS_CHANGED; }
#define IS_CHANGED
Item was edited, and modified.
Definition: eda_item.h:103
STATUS_FLAGS m_flags
Definition: eda_item.h:531

References IS_CHANGED, and EDA_ITEM::m_flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsNew()

◆ IsOnCopperLayer()

virtual bool BOARD_ITEM::IsOnCopperLayer ( ) const
inlinevirtualinherited
Returns
true if the object is on any copper layer, false otherwise.

Reimplemented in TRACK, PAD, and ZONE.

Definition at line 144 of file board_item.h.

145  {
146  return IsCopperLayer( GetLayer() );
147  }
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:173

References BOARD_ITEM::GetLayer(), and IsCopperLayer().

Referenced by CN_CONNECTIVITY_ALGO::Add(), DRC_ENGINE::EvalRules(), and BOARD_CONNECTED_ITEM::SetNetCode().

◆ IsOnLayer()

virtual bool BOARD_ITEM::IsOnLayer ( PCB_LAYER_ID  aLayer) const
inlinevirtualinherited

Test to see if this object is on the given layer.

Virtual so objects like PAD, which reside on multiple layers can do their own form of testing.

Parameters
aLayerThe layer to test for.
Returns
true if on given layer, else false.

Reimplemented in PAD, VIA, FOOTPRINT, ZONE, and PCB_GROUP.

Definition at line 231 of file board_item.h.

232  {
233  return m_layer == aLayer;
234  }
PCB_LAYER_ID m_layer
Definition: board_item.h:363

References BOARD_ITEM::m_layer.

Referenced by BOARD_ADAPTER::createLayers(), existsOnLayer(), GENERAL_COLLECTOR::Inspect(), PCB_LAYER_COLLECTOR::Inspect(), and PNS_KICAD_IFACE::IsItemVisible().

◆ IsReplaceable()

virtual bool EDA_ITEM::IsReplaceable ( ) const
inlinevirtualinherited

Override this method in any derived object that supports test find and replace.

Returns
True if the item has replaceable text that can be modified using the find and replace dialog.

Reimplemented in SCH_COMPONENT, SCH_LABEL, SCH_SHEET, SCH_TEXT, SCH_FIELD, and SCH_SHEET_PIN.

Definition at line 453 of file eda_item.h.

453 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 175 of file eda_item.h.

175 { return m_flags & IS_RESIZED; }
#define IS_RESIZED
Item being resized.
Definition: eda_item.h:108
STATUS_FLAGS m_flags
Definition: eda_item.h:531

References IS_RESIZED, and EDA_ITEM::m_flags.

◆ IsSelected()

bool EDA_ITEM::IsSelected ( ) const
inlineinherited

Definition at line 173 of file eda_item.h.

173 { return m_flags & SELECTED; }
#define SELECTED
Definition: eda_item.h:114
STATUS_FLAGS m_flags
Definition: eda_item.h:531

References EDA_ITEM::m_flags, and SELECTED.

Referenced by ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), SCH_EDIT_FRAME::ConvertPart(), DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), DS_PROXY_UNDO_ITEM::DS_PROXY_UNDO_ITEM(), KIGFX::DS_RENDER_SETTINGS::GetColor(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), SCH_MOVE_TOOL::getConnectedDragItems(), KIGFX::SCH_PAINTER::getLineWidth(), KIGFX::SCH_PAINTER::getRenderColor(), KIGFX::SCH_PAINTER::getTextThickness(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), EE_SELECTION_TOOL::RebuildSelection(), RENDER_3D_LEGACY::renderFootprint(), SCH_EDIT_TOOL::Rotate(), EE_TOOL_BASE< SCH_BASE_FRAME >::saveCopyInUndoList(), SCH_EDIT_FRAME::SchematicCleanUp(), GERBVIEW_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), KIGFX::SCH_PAINTER::setDeviceColors(), and GERBVIEW_SELECTION_TOOL::unselect().

◆ IsTrack()

bool BOARD_ITEM::IsTrack ( ) const
inlineinherited

Test to see if this object is a track or via (or microvia).

Returns
true if a track or via, else false.

Definition at line 241 of file board_item.h.

242  {
243  return ( Type() == PCB_TRACE_T ) || ( Type() == PCB_VIA_T );
244  }
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References PCB_TRACE_T, PCB_VIA_T, and EDA_ITEM::Type().

◆ IsType()

virtual bool EDA_ITEM::IsType ( const KICAD_T  aScanTypes[]) const
inlinevirtualinherited

Check whether the item is one of the listed types.

Parameters
aScanTypesList of item types
Returns
true if the item type is contained in the list aScanTypes

Reimplemented in VIA, SCH_LABEL, DIMENSION_BASE, PAD, PCB_SHAPE, SCH_FIELD, FP_TEXT, SCH_LINE, FP_SHAPE, and PCB_TEXT.

Definition at line 233 of file eda_item.h.

234  {
235  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
236  return true;
237 
238  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
239  {
240  if( m_structType == *p )
241  return true;
242  }
243 
244  return false;
245  }
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
KICAD_T m_structType
Run time identification, keep private so it can never be changed after a ctor sets it.
Definition: eda_item.h:538

References EOT, EDA_ITEM::m_structType, and SCH_LOCATE_ANY_T.

Referenced by ROUTER_TOOL::CanInlineDrag(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingBus(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLine(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingWire(), PCB_TEXT::IsType(), FP_SHAPE::IsType(), SCH_LINE::IsType(), FP_TEXT::IsType(), SCH_FIELD::IsType(), PCB_SHAPE::IsType(), PAD::IsType(), DIMENSION_BASE::IsType(), SCH_LABEL::IsType(), VIA::IsType(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), EE_SELECTION_TOOL::RequestSelection(), SCH_BASE_FRAME::UpdateItem(), EDA_ITEM::Visit(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 172 of file eda_item.h.

172 { return m_flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: eda_item.h:111
STATUS_FLAGS m_flags
Definition: eda_item.h:531

References IS_WIRE_IMAGE, and EDA_ITEM::m_flags.

◆ IterateForward() [1/2]

template<class T >
static SEARCH_RESULT EDA_ITEM::IterateForward ( std::deque< T > &  aList,
INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
inlinestaticinherited

This changes first parameter to avoid the DList and use the main queue instead.

Definition at line 345 of file eda_item.h.

349  {
350  for( auto it : aList )
351  {
352  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
354  return SEARCH_RESULT::QUIT;
355  }
356 
358  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:91

References CONTINUE, QUIT, and EDA_ITEM::Visit().

Referenced by GERBER_FILE_IMAGE::Visit().

◆ IterateForward() [2/2]

template<class T >
static SEARCH_RESULT EDA_ITEM::IterateForward ( std::vector< T > &  aList,
INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
inlinestaticinherited

Change first parameter to avoid the DList and use std::vector instead.

Definition at line 364 of file eda_item.h.

366  {
367  for( auto it : aList )
368  {
369  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
371  return SEARCH_RESULT::QUIT;
372  }
373 
375  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:91

References CONTINUE, QUIT, and EDA_ITEM::Visit().

◆ layerMaskDescribe()

wxString BOARD_ITEM::layerMaskDescribe ( ) const
protectedvirtualinherited

Return a string (to be shown to the user) describing a layer mask.

The BOARD is needed because layer names are customizable.

Reimplemented in VIA.

Definition at line 72 of file board_item.cpp.

73 {
74  BOARD* board = GetBoard();
75  LSET layers = GetLayerSet();
76 
77  // Try to be smart and useful. Check all copper first.
78  if( layers[F_Cu] && layers[B_Cu] )
79  return _( "all copper layers" );
80 
81  LSET copperLayers = layers & board->GetEnabledLayers().AllCuMask();
82  LSET techLayers = layers & board->GetEnabledLayers().AllTechMask();
83 
84  for( LSET testLayers : { copperLayers, techLayers, layers } )
85  {
86  for( int bit = PCBNEW_LAYER_ID_START; bit < PCB_LAYER_ID_COUNT; ++bit )
87  {
88  if( testLayers[ bit ] )
89  {
90  wxString layerInfo = board->GetLayerName( static_cast<PCB_LAYER_ID>( bit ) );
91 
92  if( testLayers.count() > 1 )
93  layerInfo << wxS( " " ) + _( "and others" );
94 
95  return layerInfo;
96  }
97  }
98  }
99 
100  // No copper, no technicals: no layer
101  return _( "no layers" );
102 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:750
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:342
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings Returns a bit-mask of all t...
Definition: board.cpp:447
static LSET AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
Definition: lset.cpp:820
LSET is a set of PCB_LAYER_IDs.
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:46
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
#define _(s)
Definition: 3d_actions.cpp:33
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
Definition: board_item.h:178

References _, LSET::AllCuMask(), LSET::AllTechMask(), B_Cu, F_Cu, BOARD_ITEM::GetBoard(), GetEnabledLayers(), GetLayerName(), BOARD_ITEM::GetLayerSet(), PCB_LAYER_ID_COUNT, and PCBNEW_LAYER_ID_START.

Referenced by TRACK::GetMsgPanelInfo(), PAD::GetMsgPanelInfo(), and PAD::GetSelectMenuText().

◆ MapNets()

void BOARD::MapNets ( const BOARD aDestBoard)

Map all nets in the given board to nets with the same name (if any) in the destination board.

This allows us to share layouts which came from the same hierarchical sheet in the schematic.

Definition at line 1989 of file board.cpp.

1990 {
1991  for( BOARD_CONNECTED_ITEM* item : AllConnectedItems() )
1992  {
1993  NETINFO_ITEM* netInfo = aDestBoard->FindNet( item->GetNetname() );
1994 
1995  if( netInfo )
1996  item->SetNet( netInfo );
1997  else
1998  item->SetNetCode( 0 );
1999  }
2000 }
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition: board.cpp:1289
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
const std::vector< BOARD_CONNECTED_ITEM * > AllConnectedItems()
Definition: board.cpp:1962
void SetNetCode(int aNetCode)
Definition: netinfo.h:114
Handle the data for a net.
Definition: netinfo.h:64

References AllConnectedItems(), FindNet(), and NETINFO_ITEM::SetNetCode().

◆ Markers() [1/2]

◆ Markers() [2/2]

const MARKERS& BOARD::Markers ( ) const
inline

Definition at line 315 of file board.h.

315 { return m_markers; }
MARKERS m_markers
Definition: board.h:200

References m_markers.

◆ Matches() [1/2]

virtual bool EDA_ITEM::Matches ( const wxFindReplaceData &  aSearchData,
void *  aAuxData 
) const
inlinevirtualinherited

Compare the item against the search criteria in aSearchData.

The base class returns false since many of the objects derived from EDA_ITEM do not have any text to search.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search criteria.
aAuxDataA pointer to optional data required for the search or NULL if not used.
Returns
True if the item's text matches the search criteria in aSearchData.

Reimplemented in SCH_COMPONENT, SCH_SHEET, SCH_TEXT, SCH_FIELD, SCH_SHEET_PIN, ZONE, SCH_PIN, SCH_MARKER, PCB_MARKER, FP_TEXT, and PCB_TEXT.

Definition at line 415 of file eda_item.h.

416  {
417  return false;
418  }

Referenced by SCH_EDITOR_CONTROL::HasMatch(), PCB_TEXT::Matches(), FP_TEXT::Matches(), PCB_MARKER::Matches(), SCH_MARKER::Matches(), SCH_PIN::Matches(), ZONE::Matches(), SCH_SHEET_PIN::Matches(), SCH_FIELD::Matches(), SCH_TEXT::Matches(), SCH_EDITOR_CONTROL::ReplaceAndFindNext(), and SCH_EDITOR_CONTROL::UpdateFind().

◆ Matches() [2/2]

bool EDA_ITEM::Matches ( const wxString &  aText,
const wxFindReplaceData &  aSearchData 
) const
protectedinherited

Compare aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

Parameters
aTextA reference to a wxString object containing the string to test.
aSearchDataThe criteria to search against.
Returns
True if aText matches the search criteria in aSearchData.

Definition at line 116 of file eda_item.cpp.

117 {
118  wxString text = aText;
119  wxString searchText = aSearchData.GetFindString();
120 
121  // Don't match if searching for replaceable item and the item doesn't support text replace.
122  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
123  return false;
124 
125  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
126  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
127 
128  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
129  {
130  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
131  return text.Matches( searchText );
132 
133  return text.MakeUpper().Matches( searchText.MakeUpper() );
134  }
135 
136  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
137  return aText.Find( searchText ) != wxNOT_FOUND;
138 
139  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
140 }
virtual bool IsReplaceable() const
Override this method in any derived object that supports test find and replace.
Definition: eda_item.h:453

References FR_MATCH_WILDCARD, FR_SEARCH_REPLACE, EDA_ITEM::IsReplaceable(), and text.

◆ Move() [1/2]

void BOARD_ITEM::Move ( const VECTOR2I aMoveVector)
inlineinherited

Definition at line 283 of file board_item.h.

284  {
285  Move( wxPoint( aMoveVector.x, aMoveVector.y ) );
286  }
virtual void Move(const wxPoint &aMoveVector)
Move this object.
Definition: board_item.h:277

References BOARD_ITEM::Move(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ Move() [2/2]

void BOARD::Move ( const wxPoint &  aMoveVector)