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 SetGenerator (const wxString &aGenerator)
 
const wxString & GetGenerator () 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
 Get the first footprint on the board or nullptr. More...
 
void DeleteAllFootprints ()
 Remove all footprints from the deque and free 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 ()
 Build or rebuild 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)
 Link 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. More...
 
void SetEnabledLayers (LSET aLayerMask)
 A proxy function that calls the correspondent function in m_BoardSettings. 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. 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
 Return 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. 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. 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
 Return 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...
 
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 PCB_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 PCB_TRACK &aTrack) const
 Return 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)
 Consistency check of internal m_groups structure. More...
 
wxString GroupsSanityCheckInternal (bool repair)
 
GroupLegalOpsField GroupLegalOps (const PCB_SELECTION &selection) const
 Check which selection tool group operations are legal given the selection. More...
 
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 (EDA_ITEM_FLAGS type) const
 
void SetState (EDA_ITEM_FLAGS type, bool state)
 
EDA_ITEM_FLAGS GetStatus () const
 
void SetStatus (EDA_ITEM_FLAGS aStatus)
 
void SetFlags (EDA_ITEM_FLAGS aMask)
 
void ClearFlags (EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
EDA_ITEM_FLAGS GetFlags () const
 
bool HasFlag (EDA_ITEM_FLAGS aFlag) const
 
EDA_ITEM_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 (SHAPE_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
 
EDA_ITEM_FLAGS m_status
 
EDA_ITEMm_parent
 Linked list: Link (parent struct) More...
 
bool m_forceVisible
 
EDA_ITEM_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
 
wxString m_generator
 
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 ( )

Definition at line 62 of file board.cpp.

62  :
63  BOARD_ITEM_CONTAINER( (BOARD_ITEM*) nullptr, PCB_T ),
66  m_LegacyNetclassesLoaded( false ),
68  m_timeStamp( 1 ),
70  m_project( nullptr ),
71  m_designSettings( new BOARD_DESIGN_SETTINGS( nullptr, "board.design_settings" ) ),
72  m_NetInfo( this )
73 {
74  // we have not loaded a board yet, assume latest until then.
75  m_fileFormatVersionAtLoad = LEGACY_BOARD_FILE_VERSION;
76 
77  for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
78  {
79  m_layers[layer].m_name = GetStandardLayerName( ToLAYER_ID( layer ) );
80 
81  if( IsCopperLayer( layer ) )
82  m_layers[layer].m_type = LT_SIGNAL;
83  else
84  m_layers[layer].m_type = LT_UNDEFINED;
85  }
86 
88 
89  // Initialize default netclass.
90  NETCLASS* defaultClass = bds.GetDefault();
91  defaultClass->SetDescription( _( "This is the default net class." ) );
92 
93  bds.UseCustomTrackViaSize( false );
94 
95  // Initialize ratsnest
96  m_connectivity.reset( new CONNECTIVITY_DATA() );
97 
98  // Set flag bits on these that will only be cleared if these are loaded from a legacy file
99  m_LegacyVisibleLayers.reset().set( Rescue );
101 }
Definition: typeinfo.h:84
bool m_LegacyDesignSettingsLoaded
True if the legacy board design settings were loaded from a file.
Definition: board.h:268
wxString m_name
The canonical name of the layer.
Definition: board.h:108
bool m_LegacyNetclassesLoaded
True if netclasses were loaded from the file.
Definition: board.h:272
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:80
PAGE_INFO m_paper
Definition: board.h:1129
LAYER_T m_type
The type of the layer.
Definition: board.h:110
void SetDescription(const wxString &aDesc)
Definition: netclass.h:121
LAYER m_layers[PCB_LAYER_ID_COUNT]
Definition: board.h:1118
This is the end of the layers used for visibility bit masks in Pcbnew.
NETINFO_LIST m_NetInfo
Definition: board.h:1146
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:588
bool m_LegacyCopperEdgeClearanceLoaded
Definition: board.h:269
BOARD_USE m_boardUse
What is this board being used for.
Definition: board.h:1107
#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
#define _(s)
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:1144
int LAYER_NUM
This can be replaced with int and removed.
int m_fileFormatVersionAtLoad
Definition: board.h:1123
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: board.h:1127
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:264
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:1132
int m_timeStamp
Definition: board.h:1108
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition: board.h:605
Container for design settings for a BOARD object.
GAL_SET m_LegacyVisibleItems
Definition: board.h:265

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 104 of file board.cpp.

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

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

◆ BOARD() [2/2]

BOARD::BOARD ( const BOARD aOther)
privatedelete

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 606 of file board.cpp.

607 {
608  if( aBoardItem == nullptr )
609  {
610  wxFAIL_MSG( wxT( "BOARD::Add() param error: aBoardItem nullptr" ) );
611  return;
612  }
613 
614  switch( aBoardItem->Type() )
615  {
616  case PCB_NETINFO_T:
617  m_NetInfo.AppendNet( (NETINFO_ITEM*) aBoardItem );
618  break;
619 
620  // this one uses a vector
621  case PCB_MARKER_T:
622  m_markers.push_back( (PCB_MARKER*) aBoardItem );
623  break;
624 
625  // this one uses a vector
626  case PCB_GROUP_T:
627  m_groups.push_back( (PCB_GROUP*) aBoardItem );
628  break;
629 
630  // this one uses a vector
631  case PCB_ZONE_T:
632  m_zones.push_back( (ZONE*) aBoardItem );
633  break;
634 
635  case PCB_TRACE_T:
636  case PCB_VIA_T:
637  case PCB_ARC_T:
638 
639  // N.B. This inserts a small memory leak as we lose the
640  if( !IsCopperLayer( aBoardItem->GetLayer() ) )
641  {
642  wxFAIL_MSG( wxT( "BOARD::Add() Cannot place Track on non-copper layer" ) );
643  return;
644  }
645 
646  if( aMode == ADD_MODE::APPEND || aMode == ADD_MODE::BULK_APPEND )
647  m_tracks.push_back( static_cast<PCB_TRACK*>( aBoardItem ) );
648  else
649  m_tracks.push_front( static_cast<PCB_TRACK*>( aBoardItem ) );
650 
651  break;
652 
653  case PCB_FOOTPRINT_T:
654  if( aMode == ADD_MODE::APPEND || aMode == ADD_MODE::BULK_APPEND )
655  m_footprints.push_back( static_cast<FOOTPRINT*>( aBoardItem ) );
656  else
657  m_footprints.push_front( static_cast<FOOTPRINT*>( aBoardItem ) );
658 
659  break;
660 
661  case PCB_DIM_ALIGNED_T:
662  case PCB_DIM_CENTER_T:
664  case PCB_DIM_LEADER_T:
665  case PCB_SHAPE_T:
666  case PCB_TEXT_T:
667  case PCB_TARGET_T:
668  if( aMode == ADD_MODE::APPEND || aMode == ADD_MODE::BULK_APPEND )
669  m_drawings.push_back( aBoardItem );
670  else
671  m_drawings.push_front( aBoardItem );
672 
673  break;
674 
675  // other types may use linked list
676  default:
677  {
678  wxString msg;
679  msg.Printf( wxT( "BOARD::Add() needs work: BOARD_ITEM type (%d) not handled" ),
680  aBoardItem->Type() );
681  wxFAIL_MSG( msg );
682  return;
683  }
684  break;
685  }
686 
687  aBoardItem->SetParent( this );
688  aBoardItem->ClearEditFlags();
689  m_connectivity->Add( aBoardItem );
690 
691  if( aMode != ADD_MODE::BULK_INSERT && aMode != ADD_MODE::BULK_APPEND )
692  InvokeListeners( &BOARD_LISTENER::OnBoardItemAdded, *this, aBoardItem );
693 }
void InvokeListeners(Func &&aFunc, Args &&... args)
Definition: board.h:1098
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
Definition: typeinfo.h:100
class PCB_DIM_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:1115
class PCB_DIM_CENTER, a center point marking (graphic item)
Definition: typeinfo.h:102
class PCB_TEXT, text on a layer
Definition: typeinfo.h:91
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:97
NETINFO_LIST m_NetInfo
Definition: board.h:1146
TRACKS m_tracks
Definition: board.h:1114
virtual void OnBoardItemAdded(BOARD &aBoard, BOARD_ITEM *aBoardItem)
Definition: board.h:166
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:116
class PCB_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.
ZONES m_zones
Definition: board.h:1116
virtual PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: zone.cpp:218
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
class ZONE, a copper pour area
Definition: typeinfo.h:105
MARKERS m_markers
Definition: board.h:1111
DRAWINGS m_drawings
Definition: board.h:1112
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 PCB_MARKER, 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:1127
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
FOOTPRINTS m_footprints
Definition: board.h:1113
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
Definition: typeinfo.h:103
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
void ClearEditFlags()
Definition: eda_item.h:172
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:113

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, 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_ARC::AddToBoard(), PCAD2KICAD::PCB_LINE::AddToBoard(), PCAD2KICAD::PCB_POLYGON::AddToBoard(), PCAD2KICAD::PCB_PAD::AddToBoard(), PCAD2KICAD::PCB::AddToBoard(), PCAD2KICAD::PCB_FOOTPRINT::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(), ALTIUM_PCB::HelperParseDimensions6Radial(), 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_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL(), 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
aNewZonesListis a PICKED_ITEMS_LIST * where to store new areas pickers (useful in undo commands) can be NULL.
aNetcodeis the netcode of the copper area (0 = no net).
aLayeris the layer of area.
aStartPointPositionis position of the first point of the polygon outline of this area.
aHatchis the hatch option.
Returns
a reference to the new area.

Definition at line 1825 of file board.cpp.

1827 {
1828  ZONE* new_area = new ZONE( this );
1829 
1830  new_area->SetNetCode( aNetcode );
1831  new_area->SetLayer( aLayer );
1832 
1833  m_zones.push_back( new_area );
1834 
1835  new_area->SetHatchStyle( (ZONE_BORDER_DISPLAY_STYLE) aHatch );
1836 
1837  // Add the first corner to the new zone
1838  new_area->AppendCorner( aStartPointPosition, -1 );
1839 
1840  if( aNewZonesList )
1841  {
1842  ITEM_PICKER picker( nullptr, new_area, UNDO_REDO::NEWITEM );
1843  aNewZonesList->PushItem( picker );
1844  }
1845 
1846  return new_area;
1847 }
void SetHatchStyle(ZONE_BORDER_DISPLAY_STYLE aStyle)
Definition: zone.h:614
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:1116
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
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:836
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:238

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 1989 of file board.cpp.

1990 {
1991  if( !alg::contains( m_listeners, aListener ) )
1992  m_listeners.push_back( aListener );
1993 }
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition: kicad_algo.h:98
std::vector< BOARD_LISTENER * > m_listeners
Definition: board.h:1148

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 1938 of file board.cpp.

1939 {
1940  std::vector<BOARD_CONNECTED_ITEM*> items;
1941 
1942  for( PCB_TRACK* track : Tracks() )
1943  items.push_back( track );
1944 
1945  for( FOOTPRINT* footprint : Footprints() )
1946  {
1947  for( PAD* pad : footprint->Pads() )
1948  items.push_back( pad );
1949  }
1950 
1951  for( ZONE* zone : Zones() )
1952  items.push_back( zone );
1953 
1954  return items;
1955 }
ZONES & Zones()
Definition: board.h:239
FOOTPRINTS & Footprints()
Definition: board.h:233
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
Definition: pad.h:57
TRACKS & Tracks()
Definition: board.h:230

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 698 of file board.h.

699  {
700  return m_NetInfo.begin();
701  }
NETINFO_LIST m_NetInfo
Definition: board.h:1146
iterator begin() const
Definition: netinfo.h:436

References NETINFO_LIST::begin(), and m_NetInfo.

◆ BuildConnectivity()

void BOARD::BuildConnectivity ( )

Build or rebuild 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 136 of file board.cpp.

137 {
138  GetConnectivity()->Build( this );
139 }
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:344

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 193 of file board.h.

194  {
195  return aItem && PCB_T == aItem->Type();
196  }
Definition: typeinfo.h:84
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

References PCB_T, and EDA_ITEM::Type().

◆ ClearAllNetCodes()

void BOARD::ClearAllNetCodes ( )

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

Definition at line 1958 of file board.cpp.

1959 {
1960  for( BOARD_CONNECTED_ITEM* item : AllConnectedItems() )
1961  item->SetNetCode( 0 );
1962 }
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:1938

References AllConnectedItems().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

◆ ClearEditFlags()

◆ ClearFlags()

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

Definition at line 154 of file eda_item.h.

154 { m_flags &= ~aMask; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481

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 172 of file board.cpp.

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

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 166 of file eda_item.h.

167  {
169  DO_NOT_DRAW );
170  }
#define DO_NOT_DRAW
Used to disable draw function.
#define STARTPOINT
When a line is selected, these flags indicate which.
#define ENDPOINT
ends. (Used to support dragging.)
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
#define CANDIDATE
flag indicating that the structure is connected
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:154
#define SKIP_STRUCT
flag indicating that the structure should be ignored
#define TEMP_SELECTED
flag indicating that the structure has already selected

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_SYMBOL, PAD, FOOTPRINT, PCB_DIM_CENTER, PCB_DIM_LEADER, SCH_HIERLABEL, PCB_DIM_ORTHOGONAL, PCB_VIA, SCH_SHEET, PCB_DIM_ALIGNED, SCH_GLOBALLABEL, PCB_SHAPE, SCH_LABEL, PCB_ARC, SCH_TEXT, SCH_LINE, LIB_PIN, FP_TEXT, SCH_BUS_BUS_ENTRY, PCB_TRACK, SCH_FIELD, SCH_SHEET_PIN, LIB_FIELD, SCH_BUS_WIRE_ENTRY, FP_SHAPE, PCB_TEXT, SCH_BITMAP, PCB_GROUP, LIB_ARC, LIB_TEXT, SCH_JUNCTION, SCH_NO_CONNECT, SCH_MARKER, LIB_POLYLINE, PCB_TARGET, LIB_BEZIER, LIB_CIRCLE, LIB_RECTANGLE, and KIGFX::ORIGIN_VIEWITEM.

Definition at line 83 of file eda_item.cpp.

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

References EDA_ITEM::GetClass().

Referenced by DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), BOARD_ITEM::Duplicate(), SCH_ITEM::Duplicate(), PCB_DIMENSION_BASE::GetEffectiveShape(), LIB_SYMBOL::LIB_SYMBOL(), new_clone(), LIB_SYMBOL::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_SYMBOL::SetConversion(), LIB_SYMBOL::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
the board's bounding box.

Definition at line 1104 of file board.cpp.

1105 {
1106  EDA_RECT area;
1107  LSET visible = GetVisibleLayers();
1108  bool showInvisibleText = IsElementVisible( LAYER_MOD_TEXT_INVISIBLE )
1109  && PgmOrNull() && !PgmOrNull()->m_Printing;
1110 
1111  if( aBoardEdgesOnly )
1112  visible.set( Edge_Cuts );
1113 
1114  // Check shapes, dimensions, texts, and fiducials
1115  for( BOARD_ITEM* item : m_drawings )
1116  {
1117  if( aBoardEdgesOnly && ( item->GetLayer() != Edge_Cuts || item->Type() != PCB_SHAPE_T ) )
1118  continue;
1119 
1120  if( ( item->GetLayerSet() & visible ).any() )
1121  area.Merge( item->GetBoundingBox() );
1122  }
1123 
1124  // Check footprints
1125  for( FOOTPRINT* footprint : m_footprints )
1126  {
1127  if( !( footprint->GetLayerSet() & visible ).any() )
1128  continue;
1129 
1130  if( aBoardEdgesOnly )
1131  {
1132  for( const BOARD_ITEM* edge : footprint->GraphicalItems() )
1133  {
1134  if( edge->GetLayer() == Edge_Cuts && edge->Type() == PCB_FP_SHAPE_T )
1135  area.Merge( edge->GetBoundingBox() );
1136  }
1137  }
1138  else
1139  {
1140  area.Merge( footprint->GetBoundingBox( true, showInvisibleText ) );
1141  }
1142  }
1143 
1144  if( !aBoardEdgesOnly )
1145  {
1146  // Check tracks
1147  for( PCB_TRACK* track : m_tracks )
1148  {
1149  if( ( track->GetLayerSet() & visible ).any() )
1150  area.Merge( track->GetBoundingBox() );
1151  }
1152 
1153  // Check zones
1154  for( ZONE* aZone : m_zones )
1155  {
1156  if( ( aZone->GetLayerSet() & visible ).any() )
1157  area.Merge( aZone->GetBoundingBox() );
1158  }
1159  }
1160 
1161  return area;
1162 }
void Merge(const EDA_RECT &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: eda_rect.cpp:432
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:80
LSET GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:479
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
TRACKS m_tracks
Definition: board.h:1114
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:125
ZONES m_zones
Definition: board.h:1116
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
DRAWINGS m_drawings
Definition: board.h:1112
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
Definition: board.cpp:531
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:289
Handle the component boundary box.
Definition: eda_rect.h:42
FOOTPRINTS m_footprints
Definition: board.h:1113
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90

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. This is useful to export the shape of copper layers to dxf polygons or 3D viewer/

Parameters
aLayeris a copper layer, like B_Cu, etc.
aOutlinesis the SHAPE_POLY_SET to fill in with items outline.

Definition at line 71 of file board_items_to_polygon_shape_transform.cpp.

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

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 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 
1010  for( const FOOTPRINT* footprint : Footprints() )
1011  {
1012  if( footprint->GetReference().CmpNoCase( ref ) == 0 )
1013  {
1014  wxString test( remainder );
1015 
1016  if( footprint->ResolveTextVar( &test ) )
1017  token = footprint->m_Uuid.AsString() + ":" + remainder;
1018 
1019  break;
1020  }
1021  }
1022  }
1023 
1024  newbuf.append( "${" + token + "}" );
1025  }
1026  else
1027  {
1028  newbuf.append( aSource[i] );
1029  }
1030  }
1031 
1032  return newbuf;
1033 }
FOOTPRINTS & Footprints()
Definition: board.h:233

References Footprints().

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

◆ ConvertKIIDsToCrossReferences()

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

Definition at line 1036 of file board.cpp.

1037 {
1038  wxString newbuf;
1039  size_t sourceLen = aSource.length();
1040 
1041  for( size_t i = 0; i < sourceLen; ++i )
1042  {
1043  if( aSource[i] == '$' && i + 1 < sourceLen && aSource[i+1] == '{' )
1044  {
1045  wxString token;
1046  bool isCrossRef = false;
1047 
1048  for( i = i + 2; i < sourceLen; ++i )
1049  {
1050  if( aSource[i] == '}' )
1051  break;
1052 
1053  if( aSource[i] == ':' )
1054  isCrossRef = true;
1055 
1056  token.append( aSource[i] );
1057  }
1058 
1059  if( isCrossRef )
1060  {
1061  wxString remainder;
1062  wxString ref = token.BeforeFirst( ':', &remainder );
1063  BOARD_ITEM* refItem = GetItem( KIID( ref ) );
1064 
1065  if( refItem && refItem->Type() == PCB_FOOTPRINT_T )
1066  token = static_cast<FOOTPRINT*>( refItem )->GetReference() + ":" + remainder;
1067  }
1068 
1069  newbuf.append( "${" + token + "}" );
1070  }
1071  else
1072  {
1073  newbuf.append( aSource[i] );
1074  }
1075  }
1076 
1077  return newbuf;
1078 }
BOARD_ITEM * GetItem(const KIID &aID) const
Definition: board.cpp:867
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:80
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:113

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 ( )

Remove all footprints from the deque and free the memory associated with them.

Definition at line 858 of file board.cpp.

859 {
860  for( FOOTPRINT* footprint : m_footprints )
861  delete footprint;
862 
863  m_footprints.clear();
864 }
FOOTPRINTS m_footprints
Definition: board.h:1113

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 826 of file board.cpp.

827 {
828  // the vector does not know how to delete the PCB_MARKER, it holds pointers
829  for( PCB_MARKER* marker : m_markers )
830  delete marker;
831 
832  m_markers.clear();
833 }
MARKERS m_markers
Definition: board.h:1111

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 836 of file board.cpp.

837 {
838  // Deleting lots of items from a vector can be very slow. Copy remaining items instead.
839  MARKERS remaining;
840 
841  for( PCB_MARKER* marker : m_markers )
842  {
843  if( ( marker->IsExcluded() && aExclusions )
844  || ( !marker->IsExcluded() && aWarningsAndErrors ) )
845  {
846  delete marker;
847  }
848  else
849  {
850  remaining.push_back( marker );
851  }
852  }
853 
854  m_markers = remaining;
855 }
MARKERS m_markers
Definition: board.h:1111

References m_markers.

◆ DeleteStructure()

void BOARD_ITEM::DeleteStructure ( )
inherited

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

Definition at line 127 of file board_item.cpp.

128 {
129  BOARD_ITEM_CONTAINER* parent = GetParent();
130 
131  if( parent )
132  parent->Remove( this );
133 
134  delete this;
135 }
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:166

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 237 of file board.h.

237 { return m_drawings; }
DRAWINGS m_drawings
Definition: board.h:1112

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 200 of file board_item.h.

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

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 706 of file board.h.

707  {
708  return m_NetInfo.end();
709  }
iterator end() const
Definition: netinfo.h:441
NETINFO_LIST m_NetInfo
Definition: board.h:1146

References NETINFO_LIST::end(), and m_NetInfo.

◆ FillItemMap()

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

Definition at line 946 of file board.cpp.

947 {
948  // the board itself
949  aMap[ m_Uuid ] = this;
950 
951  for( PCB_TRACK* track : Tracks() )
952  aMap[ track->m_Uuid ] = track;
953 
954  for( FOOTPRINT* footprint : Footprints() )
955  {
956  aMap[ footprint->m_Uuid ] = footprint;
957 
958  for( PAD* pad : footprint->Pads() )
959  aMap[ pad->m_Uuid ] = pad;
960 
961  aMap[ footprint->Reference().m_Uuid ] = &footprint->Reference();
962  aMap[ footprint->Value().m_Uuid ] = &footprint->Value();
963 
964  for( BOARD_ITEM* drawing : footprint->GraphicalItems() )
965  aMap[ drawing->m_Uuid ] = drawing;
966  }
967 
968  for( ZONE* zone : Zones() )
969  aMap[ zone->m_Uuid ] = zone;
970 
971  for( BOARD_ITEM* drawing : Drawings() )
972  aMap[ drawing->m_Uuid ] = drawing;
973 
974  for( PCB_MARKER* marker : m_markers )
975  aMap[ marker->m_Uuid ] = marker;
976 
977  for( PCB_GROUP* group : m_groups )
978  aMap[ group->m_Uuid ] = group;
979 }
ZONES & Zones()
Definition: board.h:239
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:80
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:50
GROUPS m_groups
Definition: board.h:1115
FOOTPRINTS & Footprints()
Definition: board.h:233
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
MARKERS m_markers
Definition: board.h:1111
const KIID m_Uuid
Definition: eda_item.h:475
Definition: pad.h:57
DRAWINGS & Drawings()
Definition: board.h:236
TRACKS & Tracks()
Definition: board.h:230

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 696 of file board.cpp.

697 {
699 }
void InvokeListeners(Func &&aFunc, Args &&... args)
Definition: board.h:1098
virtual void OnBoardItemsAdded(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItem)
Definition: board.h:167

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 702 of file board.cpp.

703 {
704  InvokeListeners( &BOARD_LISTENER::OnBoardItemsRemoved, *this, aRemovedItems );
705 }
void InvokeListeners(Func &&aFunc, Args &&... args)
Definition: board.h:1098
virtual void OnBoardItemsRemoved(BOARD &aBoard, std::vector< BOARD_ITEM * > &aBoardItem)
Definition: board.h:169

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
If found, the FOOTPRINT having the given uuid, else NULL.

Definition at line 1376 of file board.cpp.

1377 {
1378  for( FOOTPRINT* footprint : m_footprints )
1379  {
1380  if( footprint->GetPath() == aPath )
1381  return footprint;
1382  }
1383 
1384  return nullptr;
1385 }
FOOTPRINTS m_footprints
Definition: board.h:1113

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
If found the FOOTPRINT having the given reference designator, else nullptr.

Definition at line 1364 of file board.cpp.

1365 {
1366  for( FOOTPRINT* footprint : m_footprints )
1367  {
1368  if( aReference == footprint->GetReference() )
1369  return footprint;
1370  }
1371 
1372  return nullptr;
1373 }
FOOTPRINTS m_footprints
Definition: board.h:1113

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
the net if found or NULL if not found.

Definition at line 1343 of file board.cpp.

1344 {
1345  // the first valid netcode is 1 and the last is m_NetInfo.GetCount()-1.
1346  // zero is reserved for "no connection" and is not actually a net.
1347  // nullptr is returned for non valid netcodes
1348 
1349  wxASSERT( m_NetInfo.GetNetCount() > 0 );
1350 
1351  if( aNetcode == NETINFO_LIST::UNCONNECTED && m_NetInfo.GetNetCount() == 0 )
1352  return NETINFO_LIST::OrphanedItem();
1353  else
1354  return m_NetInfo.GetNetItem( aNetcode );
1355 }
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:1146
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 PCAD2KICAD::PCB_PAD::AddToFootprint(), CreateSignalsSection(), PNS_PCBNEW_RULE_RESOLVER::DpCoupledNet(), PNS_PCBNEW_RULE_RESOLVER::DpNetPair(), PNS_PCBNEW_RULE_RESOLVER::DpNetPolarity(), PCB_EDIT_FRAME::Edit_Zone_Params(), DIALOG_COPPER_ZONE::ensureSelectedNetIsVisible(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), 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(), BOARD_NETLIST_UPDATER::updateCopperZoneNets(), and ROUTER_TOOL::updateMessagePanel().

◆ 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
the net if found or NULL if not found.

Definition at line 1358 of file board.cpp.

1359 {
1360  return m_NetInfo.GetNetItem( aNetname );
1361 }
NETINFO_LIST m_NetInfo
Definition: board.h:1146
NETINFO_ITEM * GetNetItem(int aNetCode) const

References NETINFO_LIST::GetNetItem(), and m_NetInfo.

◆ Flip() [1/2]

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

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, PCB_VIA, PAD, PCB_SHAPE, PCB_ARC, FOOTPRINT, PCB_DIMENSION_BASE, PCB_GROUP, FP_TEXT, FP_SHAPE, PCB_TEXT, PCB_TRACK, PCB_TARGET, and PCB_MARKER.

Definition at line 184 of file board_item.cpp.

185 {
186  wxMessageBox( wxT( "virtual BOARD_ITEM::Flip used, should not occur" ), GetClass() );
187 }
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 304 of file board_item.h.

305  {
306  Flip( wxPoint( aCentre.x, aCentre.y ), aFlipLeftRight );
307  }
virtual void Flip(const wxPoint &aCentre, bool aFlipLeftRight)
Flip this object, i.e.
Definition: board_item.cpp:184

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

◆ Footprints() [1/2]

FOOTPRINTS& BOARD::Footprints ( )
inline

Definition at line 233 of file board.h.

233 { return m_footprints; }
FOOTPRINTS m_footprints
Definition: board.h:1113

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(), DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP(), 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_EDIT_FRAME::OpenProjectFiles(), PCB_CONTROL::Paste(), AR_AUTOPLACER::pickFootprint(), PCB_CONTROL::placeBoardItems(), BRDITEMS_PLOTTER::PlotDrillMarks(), PlotLayerOutlines(), PlotSolderMaskLayer(), PlotStandardLayer(), DIALOG_EXCHANGE_FOOTPRINTS::processMatchingFootprints(), BOARD_COMMIT::Push(), BOARD_REANNOTATE_TOOL::ReannotateDuplicatesInSelection(), RecreateCmpFile(), RENDER_3D_LEGACY::render3dModelsSelected(), BOARD_EDITOR_CONTROL::RepairBoard(), FOOTPRINT_EDITOR_CONTROL::RepairFootprint(), BOARD_INSPECTION_TOOL::reportClearance(), DSN::SPECCTRA_DB::RevertFOOTPRINTs(), DRC_TEST_PROVIDER_HOLE_SIZE::Run(), DRC_TEST_PROVIDER_HOLE_TO_HOLE::Run(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::Run(), PCB_EDIT_FRAME::RunActionPlugin(), 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 234 of file board.h.

234 { return m_footprints; }
FOOTPRINTS m_footprints
Definition: board.h:1113

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 BOOST_AUTO_TEST_CASE(), 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 = T();
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
a pointer to the Area or NULL if index out of range.

Definition at line 834 of file board.h.

835  {
836  if( (unsigned) index < m_zones.size() )
837  return m_zones[index];
838 
839  return nullptr;
840  }
ZONES m_zones
Definition: board.h:1116

References m_zones.

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 850 of file board.h.

851  {
852  return static_cast<int>( m_zones.size() );
853  }
ZONES m_zones
Definition: board.h:1116

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 51 of file board_item.cpp.

52 {
53  if( Type() == PCB_T )
54  return (BOARD*) this;
55 
56  BOARD_ITEM* parent = GetParent();
57 
58  if( parent )
59  return parent->GetBoard();
60 
61  return nullptr;
62 }
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:80
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:51
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:166
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

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

Referenced by PAD::BuildEffectivePolygon(), PAD::BuildEffectiveShapes(), ZONE::BuildSmoothedPoly(), KIGFX::PCB_PAINTER::draw(), exprFromTo(), PCB_VIA::FlashLayer(), PAD::FlashLayer(), PCB_TARGET::Flip(), PCB_TEXT::Flip(), PCB_TRACK::Flip(), FP_SHAPE::Flip(), FP_TEXT::Flip(), PCB_DIMENSION_BASE::Flip(), PCB_ARC::Flip(), PCB_SHAPE::Flip(), PCB_VIA::Flip(), ZONE::Flip(), BOARD_ITEM::GetBoard(), FOOTPRINT::GetBoundingBox(), FOOTPRINT::GetBoundingHull(), BOARD_CONNECTED_ITEM::GetEffectiveNetclass(), ZONE::GetInteractingZones(), BOARD_ITEM::GetLayerName(), PCB_VIA::GetMinAnnulus(), PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), ZONE::GetMsgPanelInfo(), NETINFO_ITEM::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfo(), PCB_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(), PCB_TRACK::GetWidthConstraints(), inDiffPair(), insideArea(), insideBackCourtyard(), insideCourtyard(), insideFrontCourtyard(), BOARD_ITEM::layerMaskDescribe(), PCB_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(), PCB_TRACK::ViewBBox(), FOOTPRINT::ViewBBox(), PCB_VIA::ViewGetLOD(), and PAD::ViewGetLOD().

◆ GetBoardEdgesBoundingBox()

const EDA_RECT BOARD::GetBoardEdgesBoundingBox ( ) const
inline

Return 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 742 of file board.h.

743  {
744  return ComputeBoundingBox( true );
745  }
EDA_RECT ComputeBoundingBox(bool aBoardEdgesOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
Definition: board.cpp:1104

References ComputeBoundingBox().

Referenced by GERBER_JOBFILE_WRITER::addJSONGeneralSpecs(), AUTOPLACE_TOOL::autoplace(), BuildBoardPolygonOutlines(), EAGLE_PLUGIN::centerBoard(), BOARD_NETLIST_UPDATER::estimateFootprintInsertionPosition(), 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
aOutlinesis the SHAPE_POLY_SET to fill in with outlines/holes.
aErrorHandleris an optional DRC_ITEM error handler.
Returns
true if success, false if a contour is not valid

Definition at line 1898 of file board.cpp.

1900 {
1901  int chainingEpsilon = Millimeter2iu( 0.02 ); // max dist from one endPt to next startPt
1902 
1903  bool success = BuildBoardPolygonOutlines( this, aOutlines, GetDesignSettings().m_MaxError,
1904  chainingEpsilon, aErrorHandler );
1905 
1906  // Make polygon strictly simple to avoid issues (especially in 3D viewer)
1908 
1909  return success;
1910 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:588
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 DSN::SPECCTRA_DB::BuiltBoardOutlines(), BOARD_ADAPTER::createBoardPolygon(), EXPORTER_PCB_VRML::ExportVrmlBoard(), ZONE_FILLER::Fill(), 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 210 of file board.h.

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

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 728 of file board.h.

729  {
730  return ComputeBoundingBox( false );
731  }
EDA_RECT ComputeBoundingBox(bool aBoardEdgesOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
Definition: board.cpp:1104

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 PCB_ARC, PAD, PCB_SHAPE, and PCB_MARKER.

Definition at line 112 of file board_item.h.

113  {
114  return GetBoundingBox().GetCenter();
115  }
virtual const EDA_RECT GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
Definition: eda_item.cpp:75
const wxPoint GetCenter() const
Definition: eda_rect.h:104

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

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

◆ GetClass()

wxString BOARD::GetClass ( ) const
inlineoverridevirtual

Return the class name.

Implements EDA_ITEM.

Definition at line 803 of file board.h.

804  {
805  return wxT( "BOARD" );
806  }

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 344 of file board.h.

344 { return m_connectivity; }
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: board.h:1127

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(), PCB_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
The number of copper layers in the BOARD.

Definition at line 453 of file board.cpp.

454 {
456 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:588

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(), PCB_TRACK::Flip(), PCB_ARC::Flip(), PCB_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(), DRC_TEST_PROVIDER_DISALLOW::Run(), 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
Returns
the BOARD_DESIGN_SETTINGS for this BOARD

Definition at line 588 of file board.cpp.

589 {
590  return *m_designSettings;
591 }
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:1144

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(), 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(), PCB_VIA::GetMinAnnulus(), BOARD_CONNECTED_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetOwnClearance(), DRAWING_TOOL::getSegmentWidth(), PCB_BASE_FRAME::GetSeverity(), DRC_ENGINE::GetShape(), PAD::GetSolderMaskMargin(), GetTrackLength(), PCB_TRACK::GetWidthConstraints(), PCB_BASE_FRAME::GetZoneSettings(), GetZoneSettings(), ROUTER_TOOL::handleLayerSwitch(), ALTIUM_PCB::HelperCreateBoardOutline(), PANEL_SETUP_BOARD_FINISH::ImportSettingsFrom(), PANEL_SETUP_CONSTRAINTS::ImportSettingsFrom(), PANEL_SETUP_TEXT_AND_GRAPHICS::ImportSettingsFrom(), PANEL_SETUP_TRACKS_AND_VIAS::ImportSettingsFrom(), PANEL_SETUP_MASK_AND_PASTE::ImportSettingsFrom(), PANEL_SETUP_BOARD_STACKUP::ImportSettingsFrom(), PNS_KICAD_IFACE_BASE::ImportSizes(), DIALOG_PLOT::init_Dialog(), initializePlotter(), BOARD_ADAPTER::InitSettings(), insideArea(), 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_3D_COLORS::OnLoadColorsFromBoardStackup(), 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(), PLACE_FILE_EXPORTER::PLACE_FILE_EXPORTER(), 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(), SynchronizeNetsAndNetClasses(), PNS_KICAD_IFACE_BASE::syncPad(), PNS_KICAD_IFACE_BASE::syncVia(), PNS_KICAD_IFACE_BASE::SyncWorld(), DRC_TEST_PROVIDER_HOLE_TO_HOLE::testHoleAgainstHole(), 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(), PCB_TRACK::ViewBBox(), FOOTPRINT::ViewBBox(), PCB_MARKER::ViewGetLayers(), WriteDRCReport(), DIALOG_DRC::writeReport(), and HYPERLYNX_EXPORTER::writeStackupInfo().

◆ GetEditFlags()

EDA_ITEM_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 158 of file eda_item.h.

159  {
160  constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVING | IS_RESIZING | IS_DRAGGING
162 
163  return m_flags & mask;
164  }
#define IS_NEW
New item, just created.
#define IS_RESIZING
Item being resized.
#define IS_DRAGGING
Item being dragged.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
#define IS_MOVING
Item being moved.
#define STRUCT_DELETED
flag indication structures to be erased
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.

References IS_DRAGGING, IS_MOVING, IS_NEW, IS_PASTED, IS_RESIZING, 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_SYMBOL::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_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), and DIALOG_SYMBOL_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, PCB_VIA, PAD, ZONE, PCB_ARC, PCB_SHAPE, PCB_DIMENSION_BASE, FP_TEXT, PCB_TRACK, PCB_TEXT, PCB_TARGET, and PCB_MARKER.

Definition at line 168 of file board_item.cpp.

169 {
170  std::shared_ptr<SHAPE> shape;
171 
172  wxFAIL_MSG( "GetEffectiveShape() not implemented for " + GetClass() );
173 
174  return shape;
175 }
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
the enabled layers in bit-mapped form.

Definition at line 465 of file board.cpp.

466 {
468 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:588
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_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow(), DIALOG_PRINT_PCBNEW::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow(), PANEL_SETUP_LAYERS::TransferDataToWindow(), PCB_EDIT_FRAME::UpdateUserInterface(), PCB_VIA::ViewGetLOD(), PAD::ViewGetLOD(), and HYPERLYNX_EXPORTER::writeSinglePadStack().

◆ GetFileFormatVersionAtLoad()

int BOARD::GetFileFormatVersionAtLoad ( ) const
inline

Definition at line 289 of file board.h.

289 { return m_fileFormatVersionAtLoad; }
int m_fileFormatVersionAtLoad
Definition: board.h:1123

References m_fileFormatVersionAtLoad.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ GetFileName()

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

Definition at line 228 of file board.h.

228 { return m_fileName; }
wxString m_fileName
Definition: board.h:1110

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_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_EXPORT_SVG::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

Get 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 317 of file board.h.

318  {
319  return m_footprints.empty() ? nullptr : m_footprints.front();
320  }
FOOTPRINTS m_footprints
Definition: board.h:1113

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(), FOOTPRINT_WIZARD_FRAME::GetModel(), DISPLAY_FOOTPRINTS_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 279 of file board.h.

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

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 1741 of file board.cpp.

1743 {
1744  FOOTPRINT* footprint = nullptr;
1745  FOOTPRINT* alt_footprint = nullptr;
1746  int min_dim = 0x7FFFFFFF;
1747  int alt_min_dim = 0x7FFFFFFF;
1748  bool current_layer_back = IsBackLayer( aActiveLayer );
1749 
1750  for( FOOTPRINT* candidate : m_footprints )
1751  {
1752  // is the ref point within the footprint's bounds?
1753  if( !candidate->HitTest( aPosition ) )
1754  continue;
1755 
1756  // if caller wants to ignore locked footprints, and this one is locked, skip it.
1757  if( aIgnoreLocked && candidate->IsLocked() )
1758  continue;
1759 
1760  PCB_LAYER_ID layer = candidate->GetLayer();
1761 
1762  // Filter non visible footprints if requested
1763  if( !aVisibleOnly || IsFootprintLayerVisible( layer ) )
1764  {
1765  EDA_RECT bb = candidate->GetBoundingBox( false, false );
1766 
1767  int offx = bb.GetX() + bb.GetWidth() / 2;
1768  int offy = bb.GetY() + bb.GetHeight() / 2;
1769 
1770  // off x & offy point to the middle of the box.
1771  int dist = ( aPosition.x - offx ) * ( aPosition.x - offx ) +
1772  ( aPosition.y - offy ) * ( aPosition.y - offy );
1773 
1774  if( current_layer_back == IsBackLayer( layer ) )
1775  {
1776  if( dist <= min_dim )
1777  {
1778  // better footprint shown on the active side
1779  footprint = candidate;
1780  min_dim = dist;
1781  }
1782  }
1783  else if( aVisibleOnly && IsFootprintLayerVisible( layer ) )
1784  {
1785  if( dist <= alt_min_dim )
1786  {
1787  // better footprint shown on the other side
1788  alt_footprint = candidate;
1789  alt_min_dim = dist;
1790  }
1791  }
1792  }
1793  }
1794 
1795  if( footprint )
1796  return footprint;
1797 
1798  if( alt_footprint)
1799  return alt_footprint;
1800 
1801  return nullptr;
1802 }
int GetX() const
Definition: eda_rect.h:98
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
int GetWidth() const
Definition: eda_rect.h:109
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:570
PCB_LAYER_ID
A quick note on layer IDs:
int GetHeight() const
Definition: eda_rect.h:110
Handle the component boundary box.
Definition: eda_rect.h:42
int GetY() const
Definition: eda_rect.h:99
FOOTPRINTS m_footprints
Definition: board.h:1113

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

◆ GetGenerator()

const wxString& BOARD::GetGenerator ( ) const
inline

Definition at line 292 of file board.h.

292 { return m_generator; }
wxString m_generator
Definition: board.h:1124

References m_generator.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ GetHighLightNetCodes()

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

Definition at line 386 of file board.h.

387  {
388  return m_highLight.m_netCodes;
389  }
HIGH_LIGHT_INFO m_highLight
Definition: board.h:1120
std::set< int > m_netCodes
Definition: board.h:137

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 867 of file board.cpp.

868 {
869  if( aID == niluuid )
870  return nullptr;
871 
872  for( PCB_TRACK* track : Tracks() )
873  {
874  if( track->m_Uuid == aID )
875  return track;
876  }
877 
878  for( FOOTPRINT* footprint : Footprints() )
879  {
880  if( footprint->m_Uuid == aID )
881  return footprint;
882 
883  for( PAD* pad : footprint->Pads() )
884  {
885  if( pad->m_Uuid == aID )
886  return pad;
887  }
888 
889  if( footprint->Reference().m_Uuid == aID )
890  return &footprint->Reference();
891 
892  if( footprint->Value().m_Uuid == aID )
893  return &footprint->Value();
894 
895  for( BOARD_ITEM* drawing : footprint->GraphicalItems() )
896  {
897  if( drawing->m_Uuid == aID )
898  return drawing;
899  }
900 
901  for( BOARD_ITEM* zone : footprint->Zones() )
902  {
903  if( zone->m_Uuid == aID )
904  return zone;
905  }
906 
907  for( PCB_GROUP* group : footprint->Groups() )
908  {
909  if( group->m_Uuid == aID )
910  return group;
911  }
912  }
913 
914  for( ZONE* zone : Zones() )
915  {
916  if( zone->m_Uuid == aID )
917  return zone;
918  }
919 
920  for( BOARD_ITEM* drawing : Drawings() )
921  {
922  if( drawing->m_Uuid == aID )
923  return drawing;
924  }
925 
926  for( PCB_MARKER* marker : m_markers )
927  {
928  if( marker->m_Uuid == aID )
929  return marker;
930  }
931 
932  for( PCB_GROUP* group : m_groups )
933  {
934  if( group->m_Uuid == aID )
935  return group;
936  }
937 
938  if( m_Uuid == aID )
939  return const_cast<BOARD*>( this );
940 
941  // Not found; weak reference has been deleted.
943 }
KIID niluuid(0)
ZONES & Zones()
Definition: board.h:239
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:80
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:50
GROUPS m_groups
Definition: board.h:1115
static DELETED_BOARD_ITEM * GetInstance()
Definition: board_item.h:387
FOOTPRINTS & Footprints()
Definition: board.h:233
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
MARKERS m_markers
Definition: board.h:1111
const KIID m_Uuid
Definition: eda_item.h:475
Definition: pad.h:57
DRAWINGS & Drawings()
Definition: board.h:236
TRACKS & Tracks()
Definition: board.h:230

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(), BOARD_INSPECTION_TOOL::InspectDRCError(), InvalidMatchesExpected(), DIALOG_DRC::OnDRCItemSelected(), DIALOG_CLEANUP_TRACKS_AND_VIAS::OnSelectItem(), DIALOG_CLEANUP_GRAPHICS::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 171 of file board_item.h.

171 { return m_layer; }
PCB_LAYER_ID m_layer
Definition: board_item.h:352

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(), PCB_TRACK::Flip(), FP_SHAPE::Flip(), FP_TEXT::Flip(), PCB_DIMENSION_BASE::Flip(), FOOTPRINT::Flip(), PCB_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(), PCB_TRACK::GetMsgPanelInfo(), PCB_VIA::GetMsgPanelInfo(), PAD::GetMsgPanelInfo(), AR_AUTOPLACER::getOptimalFPPlacement(), GetPad(), PCB_TRACK::GetWidthConstraints(), PCB_SELECTION_TOOL::GuessSelectionCandidates(), idf_export_footprint(), GENERAL_COLLECTOR::Inspect(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), BOARD_INSPECTION_TOOL::InspectDRCError(), isEdge(), PAD::IsFlipped(), FOOTPRINT::IsFlipped(), PNS_KICAD_IFACE::IsItemVisible(), BOARD_ITEM::IsOnCopperLayer(), FP_SHAPE::IsParentFlipped(), FP_TEXT::IsParentFlipped(), itemIsIncludedByFilter(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromShapes(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_PROPERTIES::OnAddField(), DIALOG_FOOTPRINT_CHECKER::OnSelectItem(), PCB_TRACK::cmp_tracks::operator()(), PCB_SHAPE::cmp_drawings::operator()(), BOARD_ITEM::ptr_cmp::operator()(), FOOTPRINT::cmp_drawings::operator()(), EAGLE_PLUGIN::packagePad(), 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_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow(), BOARD_ADAPTER::transformFPShapesToPolygon(), FOOTPRINT::TransformFPShapesWithClearanceToPolygon(), PCB_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 338 of file board.cpp.

339 {
340 
341  // Check the BOARD physical layer names.
342  for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
343  {
344  if ( ( m_layers[ layer ].m_name == aLayerName )
345  || ( m_layers[ layer ].m_userName == aLayerName ) )
346  return ToLAYER_ID( layer );
347  }
348 
349  // Otherwise fall back to the system standard layer names for virtual layers.
350  for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
351  {
352  if( GetStandardLayerName( ToLAYER_ID( layer ) ) == aLayerName )
353  return ToLAYER_ID( layer );
354  }
355 
356  return UNDEFINED_LAYER;
357 }
LAYER m_layers[PCB_LAYER_ID_COUNT]
Definition: board.h:1118
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:605

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 74 of file board_item.cpp.

75 {
76  BOARD* board = GetBoard();
77 
78  if( board )
79  return board->GetLayerName( m_layer );
80 
81  // If no parent, return standard name
83 }
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:360
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:51
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
PCB_LAYER_ID m_layer
Definition: board_item.h:352
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition: board.h:605

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

Referenced by PCB_TARGET::GetMsgPanelInfo(), PCB_TEXT::GetMsgPanelInfo(), FP_TEXT::GetMsgPanelInfo(), PCB_DIMENSION_BASE::GetMsgPanelInfo(), PCB_SHAPE::GetMsgPanelInfo(), PCB_DIM_LEADER::GetMsgPanelInfo(), PCB_TEXT::GetSelectMenuText(), FP_SHAPE::GetSelectMenuText(), PCB_TRACK::GetSelectMenuText(), PCB_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 name of the layer.

Definition at line 360 of file board.cpp.

361 {
362  // All layer names are stored in the BOARD.
363  if( IsLayerEnabled( aLayer ) )
364  {
365  // Standard names were set in BOARD::BOARD() but they may be over-ridden by
366  // BOARD::SetLayerName(). For copper layers, return the user defined layer name,
367  // if it was set. Otherwise return the Standard English layer name.
368  if( !m_layers[aLayer].m_userName.IsEmpty() )
369  return m_layers[aLayer].m_userName;
370  }
371 
372  return GetStandardLayerName( aLayer );
373 }
LAYER m_layers[PCB_LAYER_ID_COUNT]
Definition: board.h:1118
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.cpp:491
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition: board.h:605

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(), DRAWING_TOOL::DrawSpecificationStackup(), 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_INSPECTION_TOOL::InspectDRCError(), BOARD_ITEM::layerMaskDescribe(), PCB_VIA::layerMaskDescribe(), DIALOG_PLOT::Plot(), APPEARANCE_CONTROLS::rebuildLayers(), DIALOG_GLOBAL_DELETION::SetCurrentLayer(), ZONE_SETTINGS::SetupLayersList(), PANEL_SETUP_LAYERS::showBoardLayerNames(), PANEL_SETUP_LAYERS::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow(), DIALOG_PRINT_PCBNEW::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
the layer type, or LAYER_T(-1) if the index was out of range.

Definition at line 394 of file board.cpp.

395 {
396  if( !IsCopperLayer( aLayer ) )
397  return LT_SIGNAL;
398 
399  //@@IMB: The original test was broken due to the discontinuity
400  // in the layer sequence.
401  if( IsLayerEnabled( aLayer ) )
402  return m_layers[aLayer].m_type;
403 
404  return LT_SIGNAL;
405 }
LAYER_T m_type
The type of the layer.
Definition: board.h:110
LAYER m_layers[PCB_LAYER_ID_COUNT]
Definition: board.h:1118
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.cpp:491
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 1165 of file board.cpp.

1166 {
1167  wxString txt;
1168  int viasCount = 0;
1169  int trackSegmentsCount = 0;
1170 
1171  for( PCB_TRACK* item : m_tracks )
1172  {
1173  if( item->Type() == PCB_VIA_T )
1174  viasCount++;
1175  else
1176  trackSegmentsCount++;
1177  }
1178 
1179  txt.Printf( wxT( "%d" ), GetPadCount() );
1180  aList.emplace_back( _( "Pads" ), txt );
1181 
1182  txt.Printf( wxT( "%d" ), viasCount );
1183  aList.emplace_back( _( "Vias" ), txt );
1184 
1185  txt.Printf( wxT( "%d" ), trackSegmentsCount );
1186  aList.emplace_back( _( "Track Segments" ), txt );
1187 
1188  txt.Printf( wxT( "%d" ), GetNodesCount() );
1189  aList.emplace_back( _( "Nodes" ), txt );
1190 
1191  txt.Printf( wxT( "%d" ), m_NetInfo.GetNetCount() - 1 /* Don't include "No Net" in count */ );
1192  aList.emplace_back( _( "Nets" ), txt );
1193 
1194  txt.Printf( wxT( "%d" ), GetConnectivity()->GetUnconnectedCount() );
1195  aList.emplace_back( _( "Unrouted" ), txt );
1196 }
NETINFO_LIST m_NetInfo
Definition: board.h:1146
TRACKS m_tracks
Definition: board.h:1114
unsigned GetNodesCount(int aNet=-1) const
Definition: board.cpp:1081
unsigned GetPadCount() const
Definition: board.cpp:1927
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:344
#define _(s)
unsigned GetNetCount() const
Definition: netinfo.h:339
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96

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 1388 of file board.cpp.

1389 {
1390  std::vector<wxString> names;
1391 
1392  for( const NETINFO_ITEM* net : m_NetInfo )
1393  {
1394  if( !net->GetNetname().IsEmpty() )
1395  names.emplace_back( net->GetNetname() );
1396  }
1397 
1398  return names;
1399 }
NETINFO_LIST m_NetInfo
Definition: board.h:1146
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 715 of file board.h.

716  {
717  return m_NetInfo.GetNetCount();
718  }
NETINFO_LIST m_NetInfo
Definition: board.h:1146
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 689 of file board.h.

690  {
691  return m_NetInfo;
692  }
NETINFO_LIST m_NetInfo
Definition: board.h:1146

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 1081 of file board.cpp.

1082 {
1083  unsigned retval = 0;
1084 
1085  for( FOOTPRINT* footprint : Footprints() )
1086  {
1087  for( PAD* pad : footprint->Pads() )
1088  {
1089  if( ( aNet == -1 && pad->GetNetCode() > 0 ) || aNet == pad->GetNetCode() )
1090  retval++;
1091  }
1092  }
1093 
1094  return retval;
1095 }
FOOTPRINTS & Footprints()
Definition: board.h:233
Definition: pad.h:57

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 1476 of file board.cpp.

1477 {
1478  if( !aLayerSet.any() )
1479  aLayerSet = LSET::AllCuMask();
1480 
1481  for( FOOTPRINT* footprint : m_footprints )
1482  {
1483  PAD* pad = nullptr;
1484 
1485  if( footprint->HitTest( aPosition ) )
1486  pad = footprint->GetPad( aPosition, aLayerSet );
1487 
1488  if( pad )
1489  return pad;
1490  }
1491 
1492  return nullptr;
1493 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:750
FOOTPRINTS m_footprints
Definition: board.h:1113
Definition: pad.h:57

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

Referenced by GetPad().

◆ GetPad() [2/4]

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

Definition at line 914 of file board.h.

915  {
916  return GetPad( aPosition, LSET().set() );
917  }
PAD * GetPad(const wxPoint &aPosition, LSET aLayerMask) const
Find a pad aPosition on aLayer.
Definition: board.cpp:1476
LSET is a set of PCB_LAYER_IDs.

References GetPad().

◆ GetPad() [3/4]

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

Find a pad connected to aEndPoint of aTrace.

Parameters
aTraceA pointer to a PCB_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 1496 of file board.cpp.

1497 {
1498  const wxPoint& aPosition = aTrace->GetEndPoint( aEndPoint );
1499 
1500  LSET lset( aTrace->GetLayer() );
1501 
1502  return GetPad( aPosition, lset );
1503 }
PAD * GetPad(const wxPoint &aPosition, LSET aLayerMask) const
Find a pad aPosition on aLayer.
Definition: board.cpp:1476
LSET is a set of PCB_LAYER_IDs.
const wxPoint & GetEndPoint(ENDPOINT_T aEndPoint) const
Return the selected endpoint (start or end)
Definition: pcb_track.h:117
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:171

References PCB_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
aPadListis 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 1525 of file board.cpp.

1526 {
1527  // Search aPadList for aPosition
1528  // aPadList is sorted by X then Y values, and a fast binary search is used
1529  int idxmax = aPadList.size() - 1;
1530 
1531  int delta = aPadList.size();
1532 
1533  int idx = 0; // Starting index is the beginning of list
1534 
1535  while( delta )
1536  {
1537  // Calculate half size of remaining interval to test.
1538  // Ensure the computed value is not truncated (too small)
1539  if( (delta & 1) && ( delta > 1 ) )
1540  delta++;
1541 
1542  delta /= 2;
1543 
1544  PAD* pad = aPadList[idx];
1545 
1546  if( pad->GetPosition() == aPosition ) // candidate found
1547  {
1548  // The pad must match the layer mask:
1549  if( ( aLayerSet & pad->GetLayerSet() ).any() )
1550  return pad;
1551 
1552  // More than one pad can be at aPosition
1553  // search for a pad at aPosition that matched this mask
1554 
1555  // search next
1556  for( int ii = idx+1; ii <= idxmax; ii++ )
1557  {
1558  pad = aPadList[ii];
1559 
1560  if( pad->GetPosition() != aPosition )
1561  break;
1562 
1563  if( ( aLayerSet & pad->GetLayerSet() ).any() )
1564  return pad;
1565  }
1566  // search previous
1567  for( int ii = idx - 1 ;ii >=0; ii-- )
1568  {
1569  pad = aPadList[ii];
1570 
1571  if( pad->GetPosition() != aPosition )
1572  break;
1573 
1574  if( ( aLayerSet & pad->GetLayerSet() ).any() )
1575  return pad;
1576  }
1577 
1578  // Not found:
1579  return nullptr;
1580  }
1581 
1582  if( pad->GetPosition().x == aPosition.x ) // Must search considering Y coordinate
1583  {
1584  if( pad->GetPosition().y < aPosition.y ) // Must search after this item
1585  {
1586  idx += delta;
1587 
1588  if( idx > idxmax )
1589  idx = idxmax;
1590  }
1591  else // Must search before this item
1592  {
1593  idx -= delta;
1594 
1595  if( idx < 0 )
1596  idx = 0;
1597  }
1598  }
1599  else if( pad->GetPosition().x < aPosition.x ) // Must search after this item
1600  {
1601  idx += delta;
1602 
1603  if( idx > idxmax )
1604  idx = idxmax;
1605  }
1606  else // Must search before this item
1607  {
1608  idx -= delta;
1609 
1610  if( idx < 0 )
1611  idx = 0;
1612  }
1613  }
1614 
1615  return nullptr;
1616 }
Definition: pad.h:57

References pad.

◆ GetPadCount()

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

Definition at line 1927 of file board.cpp.

1928 {
1929  unsigned retval = 0;
1930 
1931  for( FOOTPRINT* footprint : Footprints() )
1932  retval += footprint->Pads().size();
1933 
1934  return retval;
1935 }
FOOTPRINTS & Footprints()
Definition: board.h:233

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 1506 of file board.cpp.

1507 {
1508  for( FOOTPRINT* footprint : Footprints() )
1509  {
1510  for( PAD* pad : footprint->Pads() )
1511  {
1512  if( pad->GetPosition() != aPosition )
1513  continue;
1514 
1515  // Pad found, it must be on the correct layer
1516  if( ( pad->GetLayerSet() & aLayerSet ).any() )
1517  return pad;
1518  }
1519  }
1520 
1521  return nullptr;
1522 }
FOOTPRINTS & Footprints()
Definition: board.h:233
Definition: pad.h:57

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
a full list of pads.

Definition at line 1913 of file board.cpp.

1914 {
1915  std::vector<PAD*> allPads;
1916 
1917  for( FOOTPRINT* footprint : Footprints() )
1918  {
1919  for( PAD* pad : footprint->Pads() )
1920  allPads.push_back( pad );
1921  }
1922 
1923  return allPads;
1924 }
FOOTPRINTS & Footprints()
Definition: board.h:233
Definition: pad.h:57

References Footprints(), and pad.

Referenced by CreatePadsShapesSection(), BOARD_NETLIST_UPDATER::deleteSinglePadNets(), and DIALOG_COPPER_ZONE::sortNetsByPadCount().

◆ GetPageSettings()

◆ GetParent()

BOARD_ITEM_CONTAINER* BOARD_ITEM::GetParent ( void  ) const
inlineinherited

Definition at line 166 of file board_item.h.

166 { return (BOARD_ITEM_CONTAINER*) m_parent; }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:479
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(), 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::FilterCollectorForHierarchy(), 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::MoveExact(), ALTIUM_PCB::ParseTexts6Data(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), POSITION_RELATIVE_TOOL::PositionRelative(), BOARD_COMMIT::Push(), 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 254 of file board.cpp.

255 {
256  return ZeroOffset;
257 }
static wxPoint ZeroOffset
A value of wxPoint(0,0) which can be passed to the Draw() functions.
Definition: board_item.h:150

References BOARD_ITEM::ZeroOffset.

◆ GetProject()

PROJECT* BOARD::GetProject ( ) const
inline

◆ GetProperties()

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

Definition at line 258 of file board.h.

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

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 820 of file board.cpp.

821 {
822  return wxString::Format( _( "PCB" ) );
823 }
#define _(s)
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

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 1633 of file board.cpp.

1634 {
1635  for( FOOTPRINT* footprint : Footprints() )
1636  {
1637  for( PAD* pad : footprint->Pads( ) )
1638  {
1639  if( aNetCode < 0 || pad->GetNetCode() == aNetCode )
1640  aVector.push_back( pad );
1641  }
1642  }
1643 
1644  std::sort( aVector.begin(), aVector.end(), sortPadsByXthenYCoord );
1645 }
bool sortPadsByXthenYCoord(PAD *const &aLH, PAD *const &aRH)
Used by #GetSortedPadListByXCoord to sort a pad list by X coordinate value.
Definition: board.cpp:1624
FOOTPRINTS & Footprints()
Definition: board.h:233
Definition: pad.h:57

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
a string containing the layer name or "BAD INDEX" if aLayerId is not legal.

Definition at line 605 of file board.h.

606  {
607  // a BOARD's standard layer name is the PCB_LAYER_ID fixed name
608  return LayerName( aLayerId );
609  }
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 ( EDA_ITEM_FLAGS  type) const
inlineinherited

Definition at line 137 of file eda_item.h.

138  {
139  return m_status & type;
140  }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:478

References EDA_ITEM::m_status.

Referenced by BOARD_ITEM::IsLocked().

◆ GetStatus()

EDA_ITEM_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 150 of file eda_item.h.

150 { return m_status; }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:478

References EDA_ITEM::m_status.

◆ GetTimeStamp()

int BOARD::GetTimeStamp ( )
inline

Definition at line 214 of file board.h.

214 { return m_timeStamp; }
int m_timeStamp
Definition: board.h:1108

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 542 of file board.h.

542 { return m_titles; }
TITLE_BLOCK m_titles
Definition: board.h:1130

References m_titles.

◆ GetTrackLength()

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

Return 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 1658 of file board.cpp.

1659 {
1660  int count = 0;
1661  double length = 0.0;
1662  double package_length = 0.0;
1663 
1664  constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T, PCB_PAD_T, EOT };
1665  auto connectivity = GetBoard()->GetConnectivity();
1667  bool useHeight = GetDesignSettings().m_UseHeightForLengthCalcs;
1668 
1669  for( BOARD_CONNECTED_ITEM* item : connectivity->GetConnectedItems(
1670  static_cast<const BOARD_CONNECTED_ITEM*>( &aTrack ), types ) )
1671  {
1672  count++;
1673 
1674  if( PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( item ) )
1675  {
1676  if( track->Type() == PCB_VIA_T && useHeight )
1677  {
1678  PCB_VIA* via = static_cast<PCB_VIA*>( track );
1679  length += stackup.GetLayerDistance( via->TopLayer(), via->BottomLayer() );
1680  continue;
1681  }
1682  else if( track->Type() == PCB_ARC_T )
1683  {
1684  // Note: we don't apply the clip-to-pad optimization if an arc ends in a pad
1685  // Room for future improvement.
1686  length += track->GetLength();
1687  continue;
1688  }
1689 
1690  bool inPad = false;
1691  SEG trackSeg( track->GetStart(), track->GetEnd() );
1692  double segLen = trackSeg.Length();
1693  double segInPadLen = 0;
1694 
1695  for( auto pad_it : connectivity->GetConnectedPads( item ) )
1696  {
1697  PAD* pad = static_cast<PAD*>( pad_it );
1698 
1699  bool hitStart = pad->HitTest( track->GetStart(), track->GetWidth() / 2 );
1700  bool hitEnd = pad->HitTest( track->GetEnd(), track->GetWidth() / 2 );
1701 
1702  if( hitStart && hitEnd )
1703  {
1704  inPad = true;
1705  break;
1706  }
1707  else if( hitStart || hitEnd )
1708  {
1709  VECTOR2I loc;
1710 
1711  // We may not collide even if we passed the bounding-box hit test
1712  if( pad->GetEffectivePolygon()->Collide( trackSeg, 0, nullptr, &loc ) )
1713  {
1714  // Part 1: length of the seg to the intersection with the pad poly
1715  if( hitStart )
1716  trackSeg.A = loc;
1717  else
1718  trackSeg.B = loc;
1719 
1720  segLen = trackSeg.Length();
1721 
1722  // Part 2: length from the intersection to the pad anchor
1723  segInPadLen += ( loc - pad->GetPosition() ).EuclideanNorm();
1724  }
1725  }
1726  }
1727 
1728  if( !inPad )
1729  length += segLen + segInPadLen;
1730  }
1731  else if( PAD* pad = dyn_cast<PAD*>( item ) )
1732  {
1733  package_length += pad->GetPadToDieLength();
1734  }
1735  }
1736 
1737  return std::make_tuple( count, length, package_length );
1738 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:146
int Length() const
Return the length (this).
Definition: seg.h:350
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 PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:97
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,...
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:588
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 PCB_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:51
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:344
Definition: seg.h:40
bool m_UseHeightForLengthCalcs
Enable inclusion of stackup height in track length measurements and length tuning.
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
Definition: pad.h:57

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

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

◆ GetUnconnectedNetCount()

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

Definition at line 1098 of file board.cpp.

1099 {
1100  return m_connectivity->GetUnconnectedCount();
1101 }
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: board.h:1127

References m_connectivity.

◆ GetVisibleElements()

GAL_SET BOARD::GetVisibleElements ( ) const

Return 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 525 of file board.cpp.

526 {
528 }
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:1132

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
the visible layers in bit-mapped form.

Definition at line 479 of file board.cpp.

480 {
482 }
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:1132

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(), PCB_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 1805 of file board.cpp.

1806 {
1807  std::list<ZONE*> zones;
1808 
1809  for( ZONE* zone : Zones() )
1810  zones.push_back( zone );
1811 
1812  if( aIncludeZonesInFootprints )
1813  {
1814  for( FOOTPRINT* footprint : m_footprints )
1815  {
1816  for( FP_ZONE* zone : footprint->Zones() )
1817  zones.push_back( zone );
1818  }
1819  }
1820 
1821  return zones;
1822 }
ZONES & Zones()
Definition: board.h:239
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
FOOTPRINTS m_footprints
Definition: board.h:1113
A specialization of ZONE for use in footprints.
Definition: zone.h:946

References m_footprints, and Zones().

◆ GetZoneSettings()

const ZONE_SETTINGS & BOARD::GetZoneSettings ( ) const
overridevirtual

Fetch the zone settings for this container.

Reimplemented from BOARD_ITEM_CONTAINER.

Definition at line 594 of file board.cpp.

595 {
597 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:588
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

Check which selection tool group operations are legal given the selection.

Returns
bit field of legal ops.

Definition at line 2131 of file board.cpp.

2132 {
2133  bool hasGroup = false;
2134  bool hasMember = false;
2135 
2136  for( EDA_ITEM* item : selection )
2137  {
2138  if( item->Type() == PCB_GROUP_T )
2139  hasGroup = true;
2140 
2141  if( static_cast<BOARD_ITEM*>( item )->GetParentGroup() )
2142  hasMember = true;
2143  }
2144 
2145  GroupLegalOpsField legalOps;
2146 
2147  legalOps.create = true;
2148  legalOps.removeItems = hasMember;
2149  legalOps.ungroup = hasGroup;
2150  legalOps.enter = hasGroup && selection.Size() == 1;
2151 
2152  return legalOps;
2153 }
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:100

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 cyclic.

Definition at line 253 of file board.h.

253 { return m_groups; }
GROUPS m_groups
Definition: board.h:1115

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 254 of file board.h.

254 { return m_groups; }
GROUPS m_groups
Definition: board.h:1115

References m_groups.

◆ GroupsSanityCheck()

wxString BOARD::GroupsSanityCheck ( bool  repair = false)

Consistency check of internal m_groups structure.

Parameters
repairif true, modify groups structure until it passes the sanity check.
Returns
empty string on success. Or error description if there's a problem.

Definition at line 2052 of file board.cpp.

2053 {
2054  if( repair )
2055  {
2056  while( GroupsSanityCheckInternal( repair ) != wxEmptyString )
2057  {};
2058 
2059  return wxEmptyString;
2060  }
2061  return GroupsSanityCheckInternal( repair );
2062 }
wxString GroupsSanityCheckInternal(bool repair)
Definition: board.cpp:2065

References GroupsSanityCheckInternal().

Referenced by PCB_IO::Save().

◆ GroupsSanityCheckInternal()

wxString BOARD::GroupsSanityCheckInternal ( bool  repair)
Parameters
repairif true, make one modification to groups structure that brings it closer to passing the sanity check.
Returns
empty string on success. Or error description if there's a problem.

Definition at line 2065 of file board.cpp.

2066 {
2067  // Cycle detection
2068  //
2069  // Each group has at most one parent group.
2070  // So we start at group 0 and traverse the parent chain, marking groups seen along the way.
2071  // If we ever see a group that we've already marked, that's a cycle.
2072  // If we reach the end of the chain, we know all groups in that chain are not part of any cycle.
2073  //
2074  // Algorithm below is linear in the # of groups because each group is visited only once.
2075  // There may be extra time taken due to the container access calls and iterators.
2076  //
2077  // Groups we know are cycle free
2078  std::unordered_set<PCB_GROUP*> knownCycleFreeGroups;
2079  // Groups in the current chain we're exploring.
2080  std::unordered_set<PCB_GROUP*> currentChainGroups;
2081  // Groups we haven't checked yet.
2082  std::unordered_set<PCB_GROUP*> toCheckGroups;
2083 
2084  // Initialize set of groups to check that could participate in a cycle.
2085  for( PCB_GROUP* group : Groups() )
2086  toCheckGroups.insert( group);
2087 
2088  while( !toCheckGroups.empty() )
2089  {
2090  currentChainGroups.clear();
2091  PCB_GROUP* group = *toCheckGroups.begin();
2092 
2093  while( true )
2094  {
2095  if( currentChainGroups.find( group ) != currentChainGroups.end() )
2096  {
2097  if( repair )
2098  Remove( group );
2099 
2100  return "Cycle detected in group membership";
2101  }
2102  else if( knownCycleFreeGroups.find( group ) != knownCycleFreeGroups.end() )
2103  {
2104  // Parent is a group we know does not lead to a cycle
2105  break;
2106  }
2107 
2108  currentChainGroups.insert( group );
2109  // We haven't visited currIdx yet, so it must be in toCheckGroups
2110  toCheckGroups.erase( group );
2111 
2112  group = group->GetParentGroup();
2113 
2114  if( !group )
2115  {
2116  // end of chain and no cycles found in this chain
2117  break;
2118  }
2119  }
2120 
2121  // No cycles found in chain, so add it to set of groups we know don't participate
2122  // in a cycle.
2123  knownCycleFreeGroups.insert( currentChainGroups.begin(), currentChainGroups.end() );
2124  }
2125 
2126  // Success
2127  return "";
2128 }
GROUPS & Groups()
The groups must maintain the following invariants.
Definition: board.h:253
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:708

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

Referenced by GroupsSanityCheck().

◆ HasFlag()

◆ HighLightOFF()

void BOARD::HighLightOFF ( )
inline

Disable net highlight.

Definition at line 416 of file board.h.

417  {
418  HighLightON( false );
419  }
void HighLightON(bool aValue=true)
Enable or disable net highlighting.
Definition: board.cpp:2042

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 2042 of file board.cpp.

2043 {
2044  if( m_highLight.m_highLightOn != aValue )
2045  {
2046  m_highLight.m_highLightOn = aValue;
2048  }
2049 }
void InvokeListeners(Func &&aFunc, Args &&... args)
Definition: board.h:1098
HIGH_LIGHT_INFO m_highLight
Definition: board.h:1120
bool m_highLightOn
Definition: board.h:138
virtual void OnBoardHighlightNetChanged(BOARD &aBoard)
Definition: board.h:173

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_SYMBOL, PAD, ZONE, FOOTPRINT, PCB_VIA, SCH_SHEET, DS_DRAW_ITEM_BITMAP, DS_DRAW_ITEM_TEXT, PCB_ARC, PCB_SHAPE, SCH_TEXT, PCB_DIMENSION_BASE, DS_DRAW_ITEM_RECT, SCH_LINE, GERBER_DRAW_ITEM, FP_TEXT, SCH_FIELD, PCB_TRACK, DS_DRAW_ITEM_POLYPOLYGONS, LIB_PIN, LIB_ITEM, PCB_GROUP, SCH_BITMAP, PCB_TEXT, SCH_JUNCTION, SCH_NO_CONNECT, SCH_BUS_ENTRY_BASE, DS_DRAW_ITEM_BASE, PCB_TARGET, LIB_POLYLINE, LIB_BEZIER, LIB_TEXT, LIB_ARC, LIB_RECTANGLE, and LIB_CIRCLE.

Definition at line 238 of file eda_item.h.

239  {
240  return false; // derived classes should override this function
241  }

◆ IncrementTimeStamp()

void BOARD::IncrementTimeStamp ( )

Definition at line 191 of file board.cpp.

192 {
193  m_timeStamp++;
194 
195  {
196  std::unique_lock<std::mutex> cacheLock( m_CachesMutex );
197  m_InsideAreaCache.clear();
198  m_InsideCourtyardCache.clear();
199  m_InsideFCourtyardCache.clear();
200  m_InsideBCourtyardCache.clear();
201  }
202 
203  m_CopperZoneRTrees.clear();
204 }
std::map< std::pair< BOARD_ITEM *, BOARD_ITEM * >, bool > m_InsideCourtyardCache
Definition: board.h:1083
std::mutex m_CachesMutex
Definition: board.h:1082
std::map< ZONE *, std::unique_ptr< DRC_RTREE > > m_CopperZoneRTrees
Definition: board.h:1088
std::map< std::pair< BOARD_ITEM *, BOARD_ITEM * >, bool > m_InsideBCourtyardCache
Definition: board.h:1085
std::map< std::pair< BOARD_ITEM *, BOARD_ITEM * >, bool > m_InsideAreaCache
Definition: board.h:1086
int m_timeStamp
Definition: board.h:1108
std::map< std::pair< BOARD_ITEM *, BOARD_ITEM * >, bool > m_InsideFCourtyardCache
Definition: board.h:1084

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 1098 of file board.h.

1099  {
1100  for( auto&& l : m_listeners )
1101  ( l->*aFunc )( std::forward<Args>( args )... );
1102  }
std::vector< BOARD_LISTENER * > m_listeners
Definition: board.h:1148

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 121 of file eda_item.h.

121 { return m_flags & IS_DRAGGING; }
#define IS_DRAGGING
Item being dragged.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481

References IS_DRAGGING, 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.

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

Definition at line 531 of file board.cpp.

532 {
534 }
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:1132

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 281 of file board.h.

282  {
283  return m_drawings.empty() && m_footprints.empty() && m_tracks.empty() && m_zones.empty();
284  }
TRACKS m_tracks
Definition: board.h:1114
ZONES m_zones
Definition: board.h:1116
DRAWINGS m_drawings
Definition: board.h:1112
FOOTPRINTS m_footprints
Definition: board.h:1113

References m_drawings, m_footprints, m_tracks, and m_zones.

Referenced by BOARD_NETLIST_UPDATER::estimateFootprintInsertionPosition(), 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 124 of file eda_item.h.

124 { return m_flags & ENTERED; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481
#define ENTERED
indicates a group has been entered

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 221 of file board.h.

222  {
224  }
BOARD_USE m_boardUse
What is this board being used for.
Definition: board.h:1107

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
aLayeris one of the two allowed layers for footprints: F_Cu or B_Cu
Returns
true if the layer is visible, otherwise false.

Definition at line 570 of file board.cpp.

571 {
572  switch( aLayer )
573  {
574  case F_Cu:
575  return IsElementVisible( LAYER_MOD_FR );
576 
577  case B_Cu:
578  return IsElementVisible( LAYER_MOD_BK );
579 
580  default:
581  wxFAIL_MSG( wxT( "BOARD::IsModuleLayerVisible() param error: bad layer" ) );
582  return true;
583  }
584 }
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:531

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 206 of file eda_item.h.

206 { return m_forceVisible; }
bool m_forceVisible
Definition: eda_item.h:480

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 402 of file board.h.

402 { return m_highLight.m_highLightOn; }
HIGH_LIGHT_INFO m_highLight
Definition: board.h:1120
bool m_highLightOn
Definition: board.h:138

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

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
true if the layer is visible.

Definition at line 491 of file board.cpp.

492 {
493  return GetDesignSettings().IsLayerEnabled( aLayer );
494 }
bool IsLayerEnabled(PCB_LAYER_ID aLayerId) const
Test whether a given layer aLayerId is enabled.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:588

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
aLayeris the layer to be tested.
Returns
true if the layer is visible otherwise false.

Definition at line 471 of file board.cpp.

472 {
473  // If there is no project, assume layer is visible always
474  return GetDesignSettings().IsLayerEnabled( aLayer )
475  && ( !m_project || m_project->GetLocalSettings().m_VisibleLayers[aLayer] );
476 }
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.cpp:588
virtual PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
Definition: project.h:151
PROJECT * m_project
Definition: board.h:1132

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()

bool BOARD_ITEM::IsLocked ( ) const
virtualinherited
Returns
true if the object is locked, else false.

Reimplemented in FOOTPRINT, and PAD.

Definition at line 65 of file board_item.cpp.

66 {
67  if( GetParentGroup() )
68  return GetParentGroup()->IsLocked();
69 
70  return GetState( LOCKED );
71 }
PCB_GROUP * GetParentGroup() const
Definition: board_item.h:91
virtual bool IsLocked() const
Definition: board_item.cpp:65
#define LOCKED
Pcbnew: locked from movement and deletion.
int GetState(EDA_ITEM_FLAGS type) const
Definition: eda_item.h:137

References BOARD_ITEM::GetParentGroup(), EDA_ITEM::GetState(), BOARD_ITEM::IsLocked(), and LOCKED.

Referenced by BOARD_ITEM_DESC::BOARD_ITEM_DESC(), PCB_CONTROL::DeleteItemCursor(), DIALOG_GROUP_PROPERTIES::DIALOG_GROUP_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), EDIT_TOOL::FilletTracks(), PCB_IO::format(), PCB_TEXT::GetMsgPanelInfo(), ZONE::GetMsgPanelInfo(), FP_TEXT::GetMsgPanelInfo(), PCB_GROUP::GetMsgPanelInfo(), PCB_DIMENSION_BASE::GetMsgPanelInfo(), PCB_SHAPE::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfoBase_Common(), ALIGN_DISTRIBUTE_TOOL::GetSelections(), GENERAL_COLLECTOR::Inspect(), PAD::IsLocked(), BOARD_ITEM::IsLocked(), PCB_SELECTION_TOOL::itemPassesFilter(), CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromShapes(), TRACKS_CLEANER::mergeCollinearSegments(), BOARD_EDITOR_CONTROL::modifyLockSelected(), PCB_POINT_EDITOR::OnSelectionChange(), ZONE_SETTINGS::operator<<(), POSITION_RELATIVE_TOOL::PositionRelative(), processTextItem(), PCB_SELECTION_TOOL::RequestSelection(), PNS_KICAD_IFACE_BASE::syncArc(), PNS_KICAD_IFACE_BASE::syncTrack(), PNS_KICAD_IFACE_BASE::syncVia(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), and DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow().

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 118 of file eda_item.h.

118 { return m_flags & IS_CHANGED; }
#define IS_CHANGED
Item was edited, and modified.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481

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 PAD, PCB_TRACK, and ZONE.

Definition at line 142 of file board_item.h.

143  {
144  return IsCopperLayer( GetLayer() );
145  }
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:171

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, PCB_VIA, FOOTPRINT, ZONE, and PCB_GROUP.

Definition at line 229 of file board_item.h.

230  {
231  return m_layer == aLayer;
232  }
PCB_LAYER_ID m_layer
Definition: board_item.h:352

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_SYMBOL, SCH_SHEET, SCH_LABEL, SCH_TEXT, SCH_FIELD, and SCH_SHEET_PIN.

Definition at line 403 of file eda_item.h.

403 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 125 of file eda_item.h.

125 { return m_flags & IS_RESIZING; }
#define IS_RESIZING
Item being resized.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481

References IS_RESIZING, and EDA_ITEM::m_flags.

◆ IsSelected()

bool EDA_ITEM::IsSelected ( ) const
inlineinherited

Definition at line 123 of file eda_item.h.

123 { return m_flags & SELECTED; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481
#define SELECTED

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(), DIALOG_EXCHANGE_FOOTPRINTS::isMatch(), DIALOG_CHANGE_SYMBOLS::isMatch(), 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 239 of file board_item.h.

240  {
241  return ( Type() == PCB_TRACE_T ) || ( Type() == PCB_VIA_T );
242  }
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
class PCB_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:113

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 PCB_VIA, SCH_LABEL, PCB_DIMENSION_BASE, PAD, SCH_FIELD, FP_TEXT, SCH_LINE, PCB_SHAPE, FP_SHAPE, and PCB_TEXT.

Definition at line 183 of file eda_item.h.

184  {
185  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
186  return true;
187 
188  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
189  {
190  if( m_structType == *p )
191  return true;
192  }
193 
194  return false;
195  }
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:488

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(), PCB_SHAPE::IsType(), SCH_LINE::IsType(), FP_TEXT::IsType(), SCH_FIELD::IsType(), PAD::IsType(), PCB_DIMENSION_BASE::IsType(), SCH_LABEL::IsType(), PCB_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 122 of file eda_item.h.

122 { return m_flags & IS_WIRE_IMAGE; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.

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 295 of file eda_item.h.

299  {
300  for( auto it : aList )
301  {
302  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
304  return SEARCH_RESULT::QUIT;
305  }
306 
308  }
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:93

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 314 of file eda_item.h.

316  {
317  for( auto it : aList )
318  {
319  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
321  return SEARCH_RESULT::QUIT;
322  }
323 
325  }
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:93

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 PCB_VIA.

Definition at line 86 of file board_item.cpp.

87 {
88  BOARD* board = GetBoard();
89  LSET layers = GetLayerSet();
90 
91  // Try to be smart and useful. Check all copper first.
92  if( layers[F_Cu] && layers[B_Cu] )
93  return _( "all copper layers" );
94 
95  LSET copperLayers = layers & board->GetEnabledLayers().AllCuMask();
96  LSET techLayers = layers & board->GetEnabledLayers().AllTechMask();
97 
98  for( LSET testLayers : { copperLayers, techLayers, layers } )
99  {
100  for( int bit = PCBNEW_LAYER_ID_START; bit < PCB_LAYER_ID_COUNT; ++bit )
101  {
102  if( testLayers[ bit ] )
103  {
104  wxString layerInfo = board->GetLayerName( static_cast<PCB_LAYER_ID>( bit ) );
105 
106  if( testLayers.count() > 1 )
107  layerInfo << wxS( " " ) + _( "and others" );
108 
109  return layerInfo;
110  }
111  }
112  }
113 
114  // No copper, no technicals: no layer
115  return _( "no layers" );
116 }
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:360
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:465
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:51
#define _(s)
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
Definition: board_item.h:176

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 PCB_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 1965 of file board.cpp.

1966 {
1967  for( BOARD_CONNECTED_ITEM* item : AllConnectedItems() )
1968  {
1969  NETINFO_ITEM* netInfo = aDestBoard->FindNet( item->GetNetname() );
1970 
1971  if( netInfo )
1972  item->SetNet( netInfo );
1973  else
1974  item->SetNetCode( 0 );
1975  }
1976 }
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition: board.cpp:1343
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:1938
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 243 of file board.h.

243 { return m_markers; }
MARKERS m_markers
Definition: board.h:1111

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_SYMBOL, SCH_SHEET, SCH_TEXT, SCH_FIELD, SCH_SHEET_PIN, ZONE, SCH_PIN, SCH_MARKER, PCB_MARKER, FP_TEXT, and PCB_TEXT.

Definition at line 365 of file eda_item.h.

366  {
367  return false;
368  }

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 118 of file eda_item.cpp.

119 {
120  wxString text = aText;
121  wxString searchText = aSearchData.GetFindString();
122 
123  // Don't match if searching for replaceable item and the item doesn't support text replace.
124  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
125  return false;
126 
127  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
128  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
129 
130  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
131  {
132  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
133  return text.Matches( searchText );
134 
135  return