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  cmp_drawings
 
struct  cmp_items
 
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 () const
 
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 (PROGRESS_REPORTER *aReporter=nullptr)
 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
 
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 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, FLASHING aFlash=FLASHING::DEFAULT) const
 Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes. More...
 
BOARD_ITEM_CONTAINERGetParent () const
 
BOARD_ITEM_CONTAINERGetParentFootprint () 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 const BOARDGetBoard () const
 Return the BOARD in which this BOARD_ITEM resides, or NULL if none. More...
 
virtual BOARDGetBoard ()
 
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 inside or on the boundary of this item. More...
 
virtual bool HitTest (const EDA_RECT &aRect, bool aContained, int aAccuracy=0) const
 Test if aRect intersects this 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...
 
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< wxString, LSETm_LayerExpressionCache
 
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 191 of file board.h.

Constructor & Destructor Documentation

◆ BOARD() [1/2]

BOARD::BOARD ( )

Definition at line 63 of file board.cpp.

63  :
64  BOARD_ITEM_CONTAINER( (BOARD_ITEM*) nullptr, PCB_T ),
67  m_LegacyNetclassesLoaded( false ),
69  m_timeStamp( 1 ),
71  m_project( nullptr ),
72  m_designSettings( new BOARD_DESIGN_SETTINGS( nullptr, "board.design_settings" ) ),
73  m_NetInfo( this )
74 {
75  // we have not loaded a board yet, assume latest until then.
76  m_fileFormatVersionAtLoad = LEGACY_BOARD_FILE_VERSION;
77 
78  for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
79  {
80  m_layers[layer].m_name = GetStandardLayerName( ToLAYER_ID( layer ) );
81 
82  if( IsCopperLayer( layer ) )
83  m_layers[layer].m_type = LT_SIGNAL;
84  else
85  m_layers[layer].m_type = LT_UNDEFINED;
86  }
87 
89 
90  // Initialize default netclass.
91  NETCLASS* defaultClass = bds.GetDefault();
92  defaultClass->SetDescription( _( "This is the default net class." ) );
93 
94  bds.UseCustomTrackViaSize( false );
95 
96  // Initialize ratsnest
97  m_connectivity.reset( new CONNECTIVITY_DATA() );
98 
99  // Set flag bits on these that will only be cleared if these are loaded from a legacy file
100  m_LegacyVisibleLayers.reset().set( Rescue );
102 }
Definition: typeinfo.h:84
bool m_LegacyDesignSettingsLoaded
True if the legacy board design settings were loaded from a file.
Definition: board.h:269
wxString m_name
The canonical name of the layer.
Definition: board.h:109
bool m_LegacyNetclassesLoaded
True if netclasses were loaded from the file.
Definition: board.h:273
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:49
PAGE_INFO m_paper
Definition: board.h:1113
LAYER_T m_type
The type of the layer.
Definition: board.h:111
void SetDescription(const wxString &aDesc)
Definition: netclass.h:121
int LAYER_NUM
This can be replaced with int and removed.
Definition: layer_ids.h:41
LAYER m_layers[PCB_LAYER_ID_COUNT]
Definition: board.h:1102
NETINFO_LIST m_NetInfo
Definition: board.h:1130
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:590
This is the end of the layers used for visibility bit masks in Pcbnew.
Definition: layer_ids.h:233
bool m_LegacyCopperEdgeClearanceLoaded
Definition: board.h:270
BOARD_USE m_boardUse
What is this board being used for.
Definition: board.h:1091
#define GAL_LAYER_INDEX(x)
Use this macro to convert a GAL layer to a 0-indexed offset from LAYER_VIAS.
Definition: layer_ids.h:260
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:1128
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:808
int m_fileFormatVersionAtLoad
Definition: board.h:1107
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: board.h:1111
NETCLASS * GetDefault() const
GAL_SET & set()
Definition: layer_ids.h:306
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:265
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:914
void UseCustomTrackViaSize(bool aEnabled)
Enables/disables custom track/via size settings.
PROJECT * m_project
Definition: board.h:1116
int m_timeStamp
Definition: board.h:1092
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition: board.h:606
Container for design settings for a BOARD object.
GAL_SET m_LegacyVisibleItems
Definition: board.h:266

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

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

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

609 {
610  if( aBoardItem == nullptr )
611  {
612  wxFAIL_MSG( wxT( "BOARD::Add() param error: aBoardItem nullptr" ) );
613  return;
614  }
615 
616  switch( aBoardItem->Type() )
617  {
618  case PCB_NETINFO_T:
619  m_NetInfo.AppendNet( (NETINFO_ITEM*) aBoardItem );
620  break;
621 
622  // this one uses a vector
623  case PCB_MARKER_T:
624  m_markers.push_back( (PCB_MARKER*) aBoardItem );
625  break;
626 
627  // this one uses a vector
628  case PCB_GROUP_T:
629  m_groups.push_back( (PCB_GROUP*) aBoardItem );
630  break;
631 
632  // this one uses a vector
633  case PCB_ZONE_T:
634  m_zones.push_back( (ZONE*) aBoardItem );
635  break;
636 
637  case PCB_TRACE_T:
638  case PCB_VIA_T:
639  case PCB_ARC_T:
640 
641  // N.B. This inserts a small memory leak as we lose the
642  if( !IsCopperLayer( aBoardItem->GetLayer() ) )
643  {
644  wxFAIL_MSG( wxT( "BOARD::Add() Cannot place Track on non-copper layer" ) );
645  return;
646  }
647 
648  if( aMode == ADD_MODE::APPEND || aMode == ADD_MODE::BULK_APPEND )
649  m_tracks.push_back( static_cast<PCB_TRACK*>( aBoardItem ) );
650  else
651  m_tracks.push_front( static_cast<PCB_TRACK*>( aBoardItem ) );
652 
653  break;
654 
655  case PCB_FOOTPRINT_T:
656  if( aMode == ADD_MODE::APPEND || aMode == ADD_MODE::BULK_APPEND )
657  m_footprints.push_back( static_cast<FOOTPRINT*>( aBoardItem ) );
658  else
659  m_footprints.push_front( static_cast<FOOTPRINT*>( aBoardItem ) );
660 
661  break;
662 
663  case PCB_DIM_ALIGNED_T:
664  case PCB_DIM_CENTER_T:
666  case PCB_DIM_LEADER_T:
667  case PCB_SHAPE_T:
668  case PCB_TEXT_T:
669  case PCB_TARGET_T:
670  if( aMode == ADD_MODE::APPEND || aMode == ADD_MODE::BULK_APPEND )
671  m_drawings.push_back( aBoardItem );
672  else
673  m_drawings.push_front( aBoardItem );
674 
675  break;
676 
677  // other types may use linked list
678  default:
679  {
680  wxString msg;
681  msg.Printf( wxT( "BOARD::Add() needs work: BOARD_ITEM type (%d) not handled" ),
682  aBoardItem->Type() );
683  wxFAIL_MSG( msg );
684  return;
685  }
686  break;
687  }
688 
689  aBoardItem->SetParent( this );
690  aBoardItem->ClearEditFlags();
691  m_connectivity->Add( aBoardItem );
692 
693  if( aMode != ADD_MODE::BULK_INSERT && aMode != ADD_MODE::BULK_APPEND )
694  InvokeListeners( &BOARD_LISTENER::OnBoardItemAdded, *this, aBoardItem );
695 }
void InvokeListeners(Func &&aFunc, Args &&... args)
Definition: board.h:1082
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:1099
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:1130
TRACKS m_tracks
Definition: board.h:1098
virtual void OnBoardItemAdded(BOARD &aBoard, BOARD_ITEM *aBoardItem)
Definition: board.h:167
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:115
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:1100
virtual PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: zone.cpp:222
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:1095
DRAWINGS m_drawings
Definition: board.h:1096
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:808
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:66
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:1111
FOOTPRINTS m_footprints
Definition: board.h:1097
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:171
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:112

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::HelperCreateAndAddShape(), 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 1810 of file board.cpp.

1812 {
1813  ZONE* new_area = new ZONE( this );
1814 
1815  new_area->SetNetCode( aNetcode );
1816  new_area->SetLayer( aLayer );
1817 
1818  m_zones.push_back( new_area );
1819 
1820  new_area->SetHatchStyle( (ZONE_BORDER_DISPLAY_STYLE) aHatch );
1821 
1822  // Add the first corner to the new zone
1823  new_area->AppendCorner( aStartPointPosition, -1 );
1824 
1825  if( aNewZonesList )
1826  {
1827  ITEM_PICKER picker( nullptr, new_area, UNDO_REDO::NEWITEM );
1828  aNewZonesList->PushItem( picker );
1829  }
1830 
1831  return new_area;
1832 }
void SetHatchStyle(ZONE_BORDER_DISPLAY_STYLE aStyle)
Definition: zone.h:616
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:1100
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:815
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:242

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

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

1916 {
1917  if( !alg::contains( m_listeners, aListener ) )
1918  m_listeners.push_back( aListener );
1919 }
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition: kicad_algo.h:99
std::vector< BOARD_LISTENER * > m_listeners
Definition: board.h:1132

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

1865 {
1866  std::vector<BOARD_CONNECTED_ITEM*> items;
1867 
1868  for( PCB_TRACK* track : Tracks() )
1869  items.push_back( track );
1870 
1871  for( FOOTPRINT* footprint : Footprints() )
1872  {
1873  for( PAD* pad : footprint->Pads() )
1874  items.push_back( pad );
1875  }
1876 
1877  for( ZONE* zone : Zones() )
1878  items.push_back( zone );
1879 
1880  return items;
1881 }
ZONES & Zones()
Definition: board.h:240
FOOTPRINTS & Footprints()
Definition: board.h:234
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
Definition: pad.h:57
TRACKS & Tracks()
Definition: board.h:231

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

695  {
696  return m_NetInfo.begin();
697  }
NETINFO_LIST m_NetInfo
Definition: board.h:1130
iterator begin() const
Definition: netinfo.h:443

References NETINFO_LIST::begin(), and m_NetInfo.

◆ BuildConnectivity()

void BOARD::BuildConnectivity ( PROGRESS_REPORTER aReporter = nullptr)

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

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

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

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

References PCB_T, and EDA_ITEM::Type().

◆ ClearAllNetCodes()

void BOARD::ClearAllNetCodes ( )

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

Definition at line 1884 of file board.cpp.

1885 {
1886  for( BOARD_CONNECTED_ITEM* item : AllConnectedItems() )
1887  item->SetNetCode( 0 );
1888 }
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:1864

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

153 { m_flags &= ~aMask; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480

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(), EE_SELECTION_TOOL::selectMultiple(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ ClearProject()

void BOARD::ClearProject ( )

Definition at line 173 of file board.cpp.

174 {
175  if( !m_project )
176  return;
177 
179 
180  // Owned by the BOARD
181  if( project.m_BoardSettings )
182  {
183  project.ReleaseNestedSettings( project.m_BoardSettings );
184  project.m_BoardSettings = nullptr;
185  }
186 
187  GetDesignSettings().SetParent( nullptr );
188  m_project = nullptr;
189 }
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:590
The backing store for a PROJECT, in JSON format.
Definition: project_file.h:64
PROJECT * m_project
Definition: board.h:1116

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

166  {
168  DO_NOT_DRAW );
169  }
#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:153
#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 143 of file view_item.h.

144  {
145  m_viewPrivData = nullptr;
146  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:151

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, SCH_LABEL, PCB_ARC, SCH_TEXT, SCH_LINE, LIB_PIN, SCH_BUS_BUS_ENTRY, FP_TEXT, SCH_FIELD, PCB_TRACK, SCH_SHEET_PIN, SCH_BUS_WIRE_ENTRY, LIB_FIELD, FP_SHAPE, PCB_TEXT, SCH_BITMAP, PCB_SHAPE, PCB_GROUP, SCH_JUNCTION, SCH_NO_CONNECT, LIB_TEXT, SCH_MARKER, LIB_SHAPE, NETINFO_ITEM, PCB_TARGET, SCH_PIN, PCB_MARKER, 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 BOOST_AUTO_TEST_CASE(), 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 1085 of file board.cpp.

1086 {
1087  EDA_RECT area;
1088  LSET visible = GetVisibleLayers();
1089  bool showInvisibleText = IsElementVisible( LAYER_MOD_TEXT_INVISIBLE )
1090  && PgmOrNull() && !PgmOrNull()->m_Printing;
1091 
1092  if( aBoardEdgesOnly )
1093  visible.set( Edge_Cuts );
1094 
1095  // Check shapes, dimensions, texts, and fiducials
1096  for( BOARD_ITEM* item : m_drawings )
1097  {
1098  if( aBoardEdgesOnly && ( item->GetLayer() != Edge_Cuts || item->Type() != PCB_SHAPE_T ) )
1099  continue;
1100 
1101  if( ( item->GetLayerSet() & visible ).any() )
1102  area.Merge( item->GetBoundingBox() );
1103  }
1104 
1105  // Check footprints
1106  for( FOOTPRINT* footprint : m_footprints )
1107  {
1108  if( !( footprint->GetLayerSet() & visible ).any() )
1109  continue;
1110 
1111  if( aBoardEdgesOnly )
1112  {
1113  for( const BOARD_ITEM* edge : footprint->GraphicalItems() )
1114  {
1115  if( edge->GetLayer() == Edge_Cuts && edge->Type() == PCB_FP_SHAPE_T )
1116  area.Merge( edge->GetBoundingBox() );
1117  }
1118  }
1119  else
1120  {
1121  area.Merge( footprint->GetBoundingBox( true, showInvisibleText ) );
1122  }
1123  }
1124 
1125  if( !aBoardEdgesOnly )
1126  {
1127  // Check tracks
1128  for( PCB_TRACK* track : m_tracks )
1129  {
1130  if( ( track->GetLayerSet() & visible ).any() )
1131  area.Merge( track->GetBoundingBox() );
1132  }
1133 
1134  // Check zones
1135  for( ZONE* aZone : m_zones )
1136  {
1137  if( ( aZone->GetLayerSet() & visible ).any() )
1138  area.Merge( aZone->GetBoundingBox() );
1139  }
1140  }
1141 
1142  return area;
1143 }
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:49
LSET GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:481
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
TRACKS m_tracks
Definition: board.h:1098
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516
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:1100
text marked as invisible
Definition: layer_ids.h:207
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
DRAWINGS m_drawings
Definition: board.h:1096
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
Definition: board.cpp:533
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:291
Handle the component boundary box.
Definition: eda_rect.h:42
FOOTPRINTS m_footprints
Definition: board.h:1097
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(), 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 2129 of file board.cpp.

2131 {
2132  int maxError = GetDesignSettings().m_MaxError;
2133 
2134  // convert tracks and vias:
2135  for( const PCB_TRACK* track : m_tracks )
2136  {
2137  if( !track->IsOnLayer( aLayer ) )
2138  continue;
2139 
2140  track->TransformShapeWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
2141  ERROR_INSIDE );
2142  }
2143 
2144  // convert pads and other copper items in footprints
2145  for( const FOOTPRINT* footprint : m_footprints )
2146  {
2147  footprint->TransformPadsWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
2148  ERROR_INSIDE );
2149 
2150  // Micro-wave footprints may have items on copper layers
2151  footprint->TransformFPShapesWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
2152  ERROR_INSIDE,
2153  true, /* include text */
2154  true /* include shapes */ );
2155 
2156  for( const ZONE* zone : footprint->Zones() )
2157  {
2158  if( zone->GetLayerSet().test( aLayer ) )
2159  zone->TransformSolidAreasShapesToPolygon( aLayer, aOutlines );
2160  }
2161  }
2162 
2163  // convert copper zones
2164  for( const ZONE* zone : Zones() )
2165  {
2166  if( zone->GetLayerSet().test( aLayer ) )
2167  zone->TransformSolidAreasShapesToPolygon( aLayer, aOutlines );
2168  }
2169 
2170  // convert graphic items on copper layers (texts)
2171  for( const BOARD_ITEM* item : m_drawings )
2172  {
2173  if( !item->IsOnLayer( aLayer ) )
2174  continue;
2175 
2176  switch( item->Type() )
2177  {
2178  case PCB_SHAPE_T:
2179  {
2180  const PCB_SHAPE* shape = static_cast<const PCB_SHAPE*>( item );
2181  shape->TransformShapeWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
2182  ERROR_INSIDE );
2183  break;
2184  }
2185 
2186  case PCB_TEXT_T:
2187  {
2188  const PCB_TEXT* text = static_cast<const PCB_TEXT*>( item );
2189  text->TransformTextShapeWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
2190  ERROR_INSIDE );
2191  break;
2192  }
2193 
2194  default:
2195  break;
2196  }
2197  }
2198 }
ZONES & Zones()
Definition: board.h:240
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:49
class PCB_TEXT, text on a layer
Definition: typeinfo.h:91
TRACKS m_tracks
Definition: board.h:1098
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:590
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
DRAWINGS m_drawings
Definition: board.h:1096
FOOTPRINTS m_footprints
Definition: board.h:1097
void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearanceValue, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
Convert the shape to a closed polygon.
Definition: pcb_shape.cpp:236
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 960 of file board.cpp.

961 {
962  wxString newbuf;
963  size_t sourceLen = aSource.length();
964 
965  for( size_t i = 0; i < sourceLen; ++i )
966  {
967  if( aSource[i] == '$' && i + 1 < sourceLen && aSource[i+1] == '{' )
968  {
969  wxString token;
970  bool isCrossRef = false;
971 
972  for( i = i + 2; i < sourceLen; ++i )
973  {
974  if( aSource[i] == '}' )
975  break;
976 
977  if( aSource[i] == ':' )
978  isCrossRef = true;
979 
980  token.append( aSource[i] );
981  }
982 
983  if( isCrossRef )
984  {
985  wxString remainder;
986  wxString ref = token.BeforeFirst( ':', &remainder );
987 
988  for( const FOOTPRINT* footprint : Footprints() )
989  {
990  if( footprint->GetReference().CmpNoCase( ref ) == 0 )
991  {
992  wxString test( remainder );
993 
994  if( footprint->ResolveTextVar( &test ) )
995  token = footprint->m_Uuid.AsString() + wxT( ":" ) + remainder;
996 
997  break;
998  }
999  }
1000  }
1001 
1002  newbuf.append( wxT( "${" ) + token + wxT( "}" ) );
1003  }
1004  else
1005  {
1006  newbuf.append( aSource[i] );
1007  }
1008  }
1009 
1010  return newbuf;
1011 }
FOOTPRINTS & Footprints()
Definition: board.h:234

References Footprints().

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

◆ ConvertKIIDsToCrossReferences()

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

Definition at line 1014 of file board.cpp.

1015 {
1016  wxString newbuf;
1017  size_t sourceLen = aSource.length();
1018 
1019  for( size_t i = 0; i < sourceLen; ++i )
1020  {
1021  if( aSource[i] == '$' && i + 1 < sourceLen && aSource[i+1] == '{' )
1022  {
1023  wxString token;
1024  bool isCrossRef = false;
1025 
1026  for( i = i + 2; i < sourceLen; ++i )
1027  {
1028  if( aSource[i] == '}' )
1029  break;
1030 
1031  if( aSource[i] == ':' )
1032  isCrossRef = true;
1033 
1034  token.append( aSource[i] );
1035  }
1036 
1037  if( isCrossRef )
1038  {
1039  wxString remainder;
1040  wxString ref = token.BeforeFirst( ':', &remainder );
1041  BOARD_ITEM* refItem = GetItem( KIID( ref ) );
1042 
1043  if( refItem && refItem->Type() == PCB_FOOTPRINT_T )
1044  {
1045  token = static_cast<FOOTPRINT*>( refItem )->GetReference() + wxT( ":" )
1046  + remainder;
1047  }
1048  }
1049 
1050  newbuf.append( wxT( "${" ) + token + wxT( "}" ) );
1051  }
1052  else
1053  {
1054  newbuf.append( aSource[i] );
1055  }
1056  }
1057 
1058  return newbuf;
1059 }
BOARD_ITEM * GetItem(const KIID &aID) const
Definition: board.cpp:845
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:49
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:112

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

837 {
838  for( FOOTPRINT* footprint : m_footprints )
839  delete footprint;
840 
841  m_footprints.clear();
842 }
FOOTPRINTS m_footprints
Definition: board.h:1097

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

805 {
806  // the vector does not know how to delete the PCB_MARKER, it holds pointers
807  for( PCB_MARKER* marker : m_markers )
808  delete marker;
809 
810  m_markers.clear();
811 }
MARKERS m_markers
Definition: board.h:1095

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

815 {
816  // Deleting lots of items from a vector can be very slow. Copy remaining items instead.
817  MARKERS remaining;
818 
819  for( PCB_MARKER* marker : m_markers )
820  {
821  if( ( marker->IsExcluded() && aExclusions )
822  || ( !marker->IsExcluded() && aWarningsAndErrors ) )
823  {
824  delete marker;
825  }
826  else
827  {
828  remaining.push_back( marker );
829  }
830  }
831 
832  m_markers = remaining;
833 }
MARKERS m_markers
Definition: board.h:1095

References m_markers.

◆ DeleteStructure()

void BOARD_ITEM::DeleteStructure ( )
inherited

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

Definition at line 128 of file board_item.cpp.

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

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

238 { return m_drawings; }
DRAWINGS m_drawings
Definition: board.h:1096

References m_drawings.

◆ Duplicate()

BOARD_ITEM * BOARD_ITEM::Duplicate ( ) const
virtualinherited

Create a copy of this BOARD_ITEM.

Reimplemented in FOOTPRINT.

Definition at line 144 of file board_item.cpp.

145 {
146  BOARD_ITEM* dupe = static_cast<BOARD_ITEM*>( Clone() );
147  const_cast<KIID&>( dupe->m_Uuid ) = KIID();
148 
149  if( dupe->GetParentGroup() )
150  dupe->GetParentGroup()->AddItem( dupe );
151 
152  return static_cast<BOARD_ITEM*>( dupe );
153 }
PCB_GROUP * GetParentGroup() const
Definition: board_item.h:60
bool AddItem(BOARD_ITEM *aItem)
Add item to group.
Definition: pcb_group.cpp:39
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:49
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:474

References PCB_GROUP::AddItem(), EDA_ITEM::Clone(), BOARD_ITEM::GetParentGroup(), and EDA_ITEM::m_Uuid.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), BOOST_AUTO_TEST_CASE(), PCB_GROUP::DeepDuplicate(), KIGFX::PCB_PAINTER::draw(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), EDIT_TOOL::Duplicate(), FOOTPRINT::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 702 of file board.h.

703  {
704  return m_NetInfo.end();
705  }
iterator end() const
Definition: netinfo.h:448
NETINFO_LIST m_NetInfo
Definition: board.h:1130

References NETINFO_LIST::end(), and m_NetInfo.

◆ FillItemMap()

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

Definition at line 924 of file board.cpp.

925 {
926  // the board itself
927  aMap[ m_Uuid ] = this;
928 
929  for( PCB_TRACK* track : Tracks() )
930  aMap[ track->m_Uuid ] = track;
931 
932  for( FOOTPRINT* footprint : Footprints() )
933  {
934  aMap[ footprint->m_Uuid ] = footprint;
935 
936  for( PAD* pad : footprint->Pads() )
937  aMap[ pad->m_Uuid ] = pad;
938 
939  aMap[ footprint->Reference().m_Uuid ] = &footprint->Reference();
940  aMap[ footprint->Value().m_Uuid ] = &footprint->Value();
941 
942  for( BOARD_ITEM* drawing : footprint->GraphicalItems() )
943  aMap[ drawing->m_Uuid ] = drawing;
944  }
945 
946  for( ZONE* zone : Zones() )
947  aMap[ zone->m_Uuid ] = zone;
948 
949  for( BOARD_ITEM* drawing : Drawings() )
950  aMap[ drawing->m_Uuid ] = drawing;
951 
952  for( PCB_MARKER* marker : m_markers )
953  aMap[ marker->m_Uuid ] = marker;
954 
955  for( PCB_GROUP* group : m_groups )
956  aMap[ group->m_Uuid ] = group;
957 }
ZONES & Zones()
Definition: board.h:240
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:49
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:50
GROUPS m_groups
Definition: board.h:1099
FOOTPRINTS & Footprints()
Definition: board.h:234
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
MARKERS m_markers
Definition: board.h:1095
const KIID m_Uuid
Definition: eda_item.h:474
Definition: pad.h:57
DRAWINGS & Drawings()
Definition: board.h:237
TRACKS & Tracks()
Definition: board.h:231

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

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

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

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

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

1362 {
1363  for( FOOTPRINT* footprint : m_footprints )
1364  {
1365  if( footprint->GetPath() == aPath )
1366  return footprint;
1367  }
1368 
1369  return nullptr;
1370 }
FOOTPRINTS m_footprints
Definition: board.h:1097

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

1350 {
1351  for( FOOTPRINT* footprint : m_footprints )
1352  {
1353  if( aReference == footprint->GetReference() )
1354  return footprint;
1355  }
1356 
1357  return nullptr;
1358 }
FOOTPRINTS m_footprints
Definition: board.h:1097

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

1329 {
1330  // the first valid netcode is 1 and the last is m_NetInfo.GetCount()-1.
1331  // zero is reserved for "no connection" and is not actually a net.
1332  // nullptr is returned for non valid netcodes
1333 
1334  wxASSERT( m_NetInfo.GetNetCount() > 0 );
1335 
1336  if( aNetcode == NETINFO_LIST::UNCONNECTED && m_NetInfo.GetNetCount() == 0 )
1337  return NETINFO_LIST::OrphanedItem();
1338  else
1339  return m_NetInfo.GetNetItem( aNetcode );
1340 }
static NETINFO_ITEM * OrphanedItem()
Wrapper class, so you can iterate through NETINFO_ITEM*s, not std::pair<int/wxString,...
Definition: netinfo.h:380
NETINFO_LIST m_NetInfo
Definition: board.h:1130
unsigned GetNetCount() const
Definition: netinfo.h:346
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:372

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

1344 {
1345  return m_NetInfo.GetNetItem( aNetname );
1346 }
NETINFO_LIST m_NetInfo
Definition: board.h:1130
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_ARC, FOOTPRINT, PCB_DIMENSION_BASE, PCB_GROUP, FP_TEXT, PCB_SHAPE, FP_SHAPE, PCB_TEXT, PCB_TRACK, PCB_TARGET, and PCB_MARKER.

Definition at line 208 of file board_item.cpp.

209 {
210  wxMessageBox( wxT( "virtual BOARD_ITEM::Flip used, should not occur" ), GetClass() );
211 }
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 264 of file board_item.h.

265  {
266  Flip( wxPoint( aCentre.x, aCentre.y ), aFlipLeftRight );
267  }
virtual void Flip(const wxPoint &aCentre, bool aFlipLeftRight)
Flip this object, i.e.
Definition: board_item.cpp:208

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

◆ Footprints() [1/2]

FOOTPRINTS& BOARD::Footprints ( )
inline

Definition at line 234 of file board.h.

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

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(), ZONE_FILLER::Fill(), FillItemMap(), DSN::SPECCTRA_DB::FlipFOOTPRINTs(), DRC_TEST_PROVIDER::forEachGeometryItem(), PCB_PLUGIN::format(), RENDER_3D_OPENGL::generateViasAndPads(), PLACE_FILE_EXPORTER::GenPositionData(), PLACE_FILE_EXPORTER::GenReportData(), DIALOG_BOARD_STATISTICS::getDataFromPCB(), PCB_BASE_FRAME::GetFootprintFromBoardByReference(), GetItem(), PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), NETINFO_ITEM::GetMsgPanelInfo(), GetMsgPanelInfo(), GetNodesCount(), GetPadFast(), GetPads(), GetSortedPadListByXthenYCoord(), DIALOG_GENDRILL::InitDisplayParams(), insideArea(), insideBackCourtyard(), insideCourtyard(), insideFrontCourtyard(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), PCB_EDIT_FRAME::KiwayMailIn(), ZONE_FILLER::knockoutThermalReliefs(), RENDER_3D_RAYTRACE::load3DModels(), RENDER_3D_OPENGL::load3dModels(), DRC_ENGINE::loadImplicitRules(), 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::ReannotateDuplicates(), RecreateCmpFile(), RENDER_3D_OPENGL::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_ZONE_CONNECTIONS::Run(), DRC_TEST_PROVIDER_HOLE_TO_HOLE::Run(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::Run(), DRC_TEST_PROVIDER_SOLDER_MASK::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 235 of file board.h.

235 { return m_footprints; }
FOOTPRINTS m_footprints
Definition: board.h:1097

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

831  {
832  if( (unsigned) index < m_zones.size() )
833  return m_zones[index];
834 
835  return nullptr;
836  }
ZONES m_zones
Definition: board.h:1100

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

847  {
848  return static_cast<int>( m_zones.size() );
849  }
ZONES m_zones
Definition: board.h:1100

References m_zones.

◆ GetBoard() [1/2]

const BOARD * BOARD_ITEM::GetBoard ( ) const
virtualinherited

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

Definition at line 36 of file board_item.cpp.

37 {
38  if( Type() == PCB_T )
39  return static_cast<const BOARD*>( this );
40 
41  BOARD_ITEM* parent = GetParent();
42 
43  if( parent )
44  return parent->GetBoard();
45 
46  return nullptr;
47 }
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:49
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:136
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112

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

Referenced by ZONE_FILLER::addHoleKnockout(), PAD::BuildEffectivePolygon(), PAD::BuildEffectiveShapes(), ZONE::BuildSmoothedPoly(), calcIsInsideArea(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), PCB_LAYER_VALUE::EqualTo(), existsOnLayer(), exprFromTo(), PCB_VIA::FlashLayer(), PAD::FlashLayer(), PCB_TARGET::Flip(), PCB_TEXT::Flip(), PCB_TRACK::Flip(), FP_SHAPE::Flip(), PCB_SHAPE::Flip(), FP_TEXT::Flip(), PCB_DIMENSION_BASE::Flip(), PCB_ARC::Flip(), PCB_VIA::Flip(), ZONE::Flip(), PCB_EXPR_CONTEXT::GetBoard(), BOARD_ITEM::GetBoard(), FOOTPRINT::GetBoundingBox(), FOOTPRINT::GetBoundingHull(), BOARD_CONNECTED_ITEM::GetEffectiveNetclass(), PAD::GetEffectiveShape(), PCB_VIA::GetEffectiveShape(), 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(), inDiffPair(), insideArea(), insideBackCourtyard(), insideCourtyard(), insideFrontCourtyard(), isInsideArea(), isInsideCourtyard(), BOARD_ITEM::IsLocked(), 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().

◆ GetBoard() [2/2]

BOARD * BOARD_ITEM::GetBoard ( )
virtualinherited

Definition at line 50 of file board_item.cpp.

51 {
52  if( Type() == PCB_T )
53  return static_cast<BOARD*>( this );
54 
55  BOARD_ITEM* parent = GetParent();
56 
57  if( parent )
58  return parent->GetBoard();
59 
60  return nullptr;
61 }
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:49
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:136
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112

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

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

739  {
740  return ComputeBoundingBox( true );
741  }
EDA_RECT ComputeBoundingBox(bool aBoardEdgesOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
Definition: board.cpp:1085

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

1837 {
1838  int chainingEpsilon = Millimeter2iu( 0.02 ); // max dist from one endPt to next startPt
1839 
1840  bool success = BuildBoardPolygonOutlines( this, aOutlines, GetDesignSettings().m_MaxError,
1841  chainingEpsilon, aErrorHandler );
1842 
1843  // Make polygon strictly simple to avoid issues (especially in 3D viewer)
1845 
1846  return success;
1847 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:590
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(), DRAWING_TOOL::DrawBoardCharacteristics(), 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::testZonesToZones(), 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 211 of file board.h.

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

References m_boardUse.

Referenced by BOARD_ITEM::IsLocked().

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

725  {
726  return ComputeBoundingBox( false );
727  }
EDA_RECT ComputeBoundingBox(bool aBoardEdgesOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
Definition: board.cpp:1085

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

82  {
83  return GetBoundingBox().GetCenter();
84  }
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:113

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

800  {
801  return wxT( "BOARD" );
802  }

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

345 { return m_connectivity; }
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: board.h:1111

References m_connectivity.

Referenced by BuildConnectivity(), BOARD_NETLIST_UPDATER::cacheCopperZoneConnections(), FROM_TO_CACHE::cacheFromToPaths(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), ZONE_FILLER_TOOL::CheckAllZones(), 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(), ZONE_FILLER_TOOL::FillAllZones(), EDIT_TOOL::FilletTracks(), PCB_VIA::FlashLayer(), PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), GetMsgPanelInfo(), GetTrackLength(), PCB_EDIT_FRAME::ImportSpecctraSession(), ROUTER_TOOL::InlineDrag(), 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(), DRC_TEST_PROVIDER_ZONE_CONNECTIONS::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(), BOARD_NETLIST_UPDATER::UpdateNetlist(), and ZONE_FILLER_TOOL::ZoneFill().

◆ GetCopperLayerCount()

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

Definition at line 455 of file board.cpp.

456 {
458 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:590

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_RULE_AREA_PROPERTIES::DIALOG_RULE_AREA_PROPERTIES(), 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(), 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 590 of file board.cpp.

591 {
592  return *m_designSettings;
593 }
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:1128

References m_designSettings.

Referenced by AddGerberX2Header(), ZONE_FILLER::addHoleKnockout(), 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(), calcIsInsideArea(), DIALOG_NET_INSPECTOR::calculateViaLength(), CADSTAR_PCB_ARCHIVE_LOADER::calculateZonePriorities(), EDIT_TOOL::ChangeTrackWidth(), GRAPHICS_CLEANER::CleanupBoard(), 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(), 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(), EXPORTER_PCB_VRML::EXPORTER_PCB_VRML(), PCB_EDIT_FRAME::ExportToGenCAD(), ZONE_FILLER::Fill(), KI_TEST::FillZones(), FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), PCB_PLUGIN::formatGeneral(), PCB_PLUGIN::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(), PAD::GetEffectiveShape(), PCB_VIA::GetEffectiveShape(), 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::getKiCadNet(), 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_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(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), IsLayerEnabled(), IsLayerVisible(), EAGLE_PLUGIN::Load(), LoadBoard(), CADSTAR_PCB_ARCHIVE_LOADER::loadBoardStackup(), EAGLE_PLUGIN::loadClasses(), 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(), NewBoard(), DIALOG_PAD_PROPERTIES::onAddPrimitive(), DIALOG_BOARD_SETUP::OnAuxiliaryAction(), PANEL_SETUP_RULES::onScintillaCharAdded(), DIALOG_POSITION_RELATIVE::OnUseGridOriginClick(), PCB_EDIT_FRAME::OpenProjectFiles(), EAGLE_PLUGIN::packageWire(), DIALOG_PAD_PROPERTIES::padValuesOK(), PANEL_SETUP_BOARD_FINISH::PANEL_SETUP_BOARD_FINISH(), PANEL_SETUP_BOARD_STACKUP::PANEL_SETUP_BOARD_STACKUP(), PANEL_SETUP_CONSTRAINTS::PANEL_SETUP_CONSTRAINTS(), PANEL_SETUP_MASK_AND_PASTE::PANEL_SETUP_MASK_AND_PASTE(), PANEL_SETUP_TEXT_AND_GRAPHICS::PANEL_SETUP_TEXT_AND_GRAPHICS(), PANEL_SETUP_TRACKS_AND_VIAS::PANEL_SETUP_TRACKS_AND_VIAS(), ALTIUM_PCB::Parse(), ALTIUM_PCB::ParseBoard6Data(), ALTIUM_PCB::ParseClasses6Data(), ALTIUM_PCB::ParseVias6Data(), PLACE_FILE_EXPORTER::PLACE_FILE_EXPORTER(), BOARD_EDITOR_CONTROL::PlaceTarget(), DIALOG_PLOT::Plot(), PlotOneBoardLayer(), PlotSolderMaskLayer(), PlotStandardLayer(), ROUTER_TOOL::prepareInteractive(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), PNS_PCBNEW_RULE_RESOLVER::QueryConstraint(), APPEARANCE_CONTROLS::rebuildNets(), PAD_TOOL::recombinePad(), PCB_EDIT_FRAME::RecordDRCExclusions(), Refresh(), DIALOG_PLOT::reInitDialog(), BOARD_INSPECTION_TOOL::reportClearance(), DRC_TOOL::Reset(), DRC_TEST_PROVIDER_ZONE_CONNECTIONS::Run(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::Run(), DRC_TEST_PROVIDER_SOLDER_MASK::Run(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::Run(), DRC_TEST_PROVIDER_MATCHED_LENGTH::runInternal(), 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_SOLDER_MASK::testItemAgainstItems(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testItemAgainstZones(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZones(), DRC_TEST_PROVIDER_SOLDER_MASK::testMaskItemAgainstZones(), DRC_TEST_PROVIDER_MISC::testOutline(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testShapeLineChain(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testZoneLayer(), 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 157 of file eda_item.h.

158  {
159  constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVING | IS_RESIZING | IS_DRAGGING
161 
162  return m_flags & mask;
163  }
#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:480
#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_TEXT_AND_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), and DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow().

◆ GetEffectiveShape()

std::shared_ptr< SHAPE > BOARD_ITEM::GetEffectiveShape ( PCB_LAYER_ID  aLayer = UNDEFINED_LAYER,
FLASHING  aFlash = FLASHING::DEFAULT 
) 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_DIMENSION_BASE, FP_TEXT, PCB_TRACK, PCB_TEXT, PCB_SHAPE, PCB_MARKER, and PCB_TARGET.

Definition at line 181 of file board_item.cpp.

182 {
183  std::shared_ptr<SHAPE> shape;
184 
186 
187  return shape;
188 }
#define UNIMPLEMENTED_FOR(type)
Definition: macros.h:120
virtual wxString GetClass() const =0
Return the class name.

References EDA_ITEM::GetClass(), and UNIMPLEMENTED_FOR.

Referenced by calcIsInsideArea(), calcIsInsideCourtyard(), DRC_ENGINE::GetShape(), PCB_SELECTION_TOOL::hitTestDistance(), DRC_RTREE::Insert(), CN_VISITOR::operator()(), DRC_RTREE::QueryColliding(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::Run(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::testAgainstEdge(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testItemAgainstItem(), DRC_TEST_PROVIDER_SOLDER_MASK::testItemAgainstItems(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testItemAgainstZones(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZones(), DRC_TEST_PROVIDER_SOLDER_MASK::testMaskItemAgainstZones(), DRC_TEST_PROVIDER_SOLDER_MASK::testSilkToMaskClearance(), and CONNECTIVITY_DATA::TestTrackEndpointDangling().

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

468 {
470 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:590
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(), DRC_ENGINE::EvalRules(), PCB_PLUGIN::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 290 of file board.h.

290 { return m_fileFormatVersionAtLoad; }
int m_fileFormatVersionAtLoad
Definition: board.h:1107

References m_fileFormatVersionAtLoad.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ GetFileName()

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

Definition at line 229 of file board.h.

229 { return m_fileName; }
wxString m_fileName
Definition: board.h:1094

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

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

References m_footprints.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), BuildFootprintPolygonOutlines(), FOOTPRINT_EDIT_FRAME::CanCloseFPFromBoard(), FOOTPRINT_EDIT_FRAME::canCloseWindow(), FOOTPRINT_EDIT_FRAME::ClearModify(), BOARD_ADAPTER::createBoardPolygon(), CONVERT_TOOL::CreateLines(), FOOTPRINT_EDITOR_CONTROL::CutCopyFootprint(), PCB_CONTROL::DeleteItemCursor(), DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX(), DIALOG_CLEANUP_GRAPHICS::doCleanup(), EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), 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(), 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 280 of file board.h.

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

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

1728 {
1729  FOOTPRINT* footprint = nullptr;
1730  FOOTPRINT* alt_footprint = nullptr;
1731  int min_dim = 0x7FFFFFFF;
1732  int alt_min_dim = 0x7FFFFFFF;
1733  bool current_layer_back = IsBackLayer( aActiveLayer );
1734 
1735  for( FOOTPRINT* candidate : m_footprints )
1736  {
1737  // is the ref point within the footprint's bounds?
1738  if( !candidate->HitTest( aPosition ) )
1739  continue;
1740 
1741  // if caller wants to ignore locked footprints, and this one is locked, skip it.
1742  if( aIgnoreLocked && candidate->IsLocked() )
1743  continue;
1744 
1745  PCB_LAYER_ID layer = candidate->GetLayer();
1746 
1747  // Filter non visible footprints if requested
1748  if( !aVisibleOnly || IsFootprintLayerVisible( layer ) )
1749  {
1750  EDA_RECT bb = candidate->GetBoundingBox( false, false );
1751 
1752  int offx = bb.GetX() + bb.GetWidth() / 2;
1753  int offy = bb.GetY() + bb.GetHeight() / 2;
1754 
1755  // off x & offy point to the middle of the box.
1756  int dist = ( aPosition.x - offx ) * ( aPosition.x - offx ) +
1757  ( aPosition.y - offy ) * ( aPosition.y - offy );
1758 
1759  if( current_layer_back == IsBackLayer( layer ) )
1760  {
1761  if( dist <= min_dim )
1762  {
1763  // better footprint shown on the active side
1764  footprint = candidate;
1765  min_dim = dist;
1766  }
1767  }
1768  else if( aVisibleOnly && IsFootprintLayerVisible( layer ) )
1769  {
1770  if( dist <= alt_min_dim )
1771  {
1772  // better footprint shown on the other side
1773  alt_footprint = candidate;
1774  alt_min_dim = dist;
1775  }
1776  }
1777  }
1778  }
1779 
1780  if( footprint )
1781  return footprint;
1782 
1783  if( alt_footprint)
1784  return alt_footprint;
1785 
1786  return nullptr;
1787 }
int GetX() const
Definition: eda_rect.h:107
int GetWidth() const
Definition: eda_rect.h:118
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:572
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
Definition: layer_ids.h:907
int GetHeight() const
Definition: eda_rect.h:119
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
Handle the component boundary box.
Definition: eda_rect.h:42
int GetY() const
Definition: eda_rect.h:108
FOOTPRINTS m_footprints
Definition: board.h:1097

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

293 { return m_generator; }
wxString m_generator
Definition: board.h:1108

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

388  {
389  return m_highLight.m_netCodes;
390  }
HIGH_LIGHT_INFO m_highLight
Definition: board.h:1104
std::set< int > m_netCodes
Definition: board.h:138

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

846 {
847  if( aID == niluuid )
848  return nullptr;
849 
850  for( PCB_TRACK* track : Tracks() )
851  {
852  if( track->m_Uuid == aID )
853  return track;
854  }
855 
856  for( FOOTPRINT* footprint : Footprints() )
857  {
858  if( footprint->m_Uuid == aID )
859  return footprint;
860 
861  for( PAD* pad : footprint->Pads() )
862  {
863  if( pad->m_Uuid == aID )
864  return pad;
865  }
866 
867  if( footprint->Reference().m_Uuid == aID )
868  return &footprint->Reference();
869 
870  if( footprint->Value().m_Uuid == aID )
871  return &footprint->Value();
872 
873  for( BOARD_ITEM* drawing : footprint->GraphicalItems() )
874  {
875  if( drawing->m_Uuid == aID )
876  return drawing;
877  }
878 
879  for( BOARD_ITEM* zone : footprint->Zones() )
880  {
881  if( zone->m_Uuid == aID )
882  return zone;
883  }
884 
885  for( PCB_GROUP* group : footprint->Groups() )
886  {
887  if( group->m_Uuid == aID )
888  return group;
889  }
890  }
891 
892  for( ZONE* zone : Zones() )
893  {
894  if( zone->m_Uuid == aID )
895  return zone;
896  }
897 
898  for( BOARD_ITEM* drawing : Drawings() )
899  {
900  if( drawing->m_Uuid == aID )
901  return drawing;
902  }
903 
904  for( PCB_MARKER* marker : m_markers )
905  {
906  if( marker->m_Uuid == aID )
907  return marker;
908  }
909 
910  for( PCB_GROUP* group : m_groups )
911  {
912  if( group->m_Uuid == aID )
913  return group;
914  }
915 
916  if( m_Uuid == aID )
917  return const_cast<BOARD*>( this );
918 
919  // Not found; weak reference has been deleted.
921 }
KIID niluuid(0)
ZONES & Zones()
Definition: board.h:240
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:49
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:50
GROUPS m_groups
Definition: board.h:1099
static DELETED_BOARD_ITEM * GetInstance()
Definition: board_item.h:348
FOOTPRINTS & Footprints()
Definition: board.h:234
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
MARKERS m_markers
Definition: board.h:1095
const KIID m_Uuid
Definition: eda_item.h:474
Definition: pad.h:57
DRAWINGS & Drawings()
Definition: board.h:237
TRACKS & Tracks()
Definition: board.h:231

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::FocusOnItems(), 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 143 of file board_item.h.

143 { return m_layer; }
PCB_LAYER_ID m_layer
Definition: board_item.h:313

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(), PCB_SHAPE::Flip(), FP_TEXT::Flip(), PCB_DIMENSION_BASE::Flip(), FOOTPRINT::Flip(), PCB_ARC::Flip(), FOOTPRINT_DESC::FOOTPRINT_DESC(), PCB_PLUGIN::FootprintSave(), FootprintWriteShape(), PCB_PLUGIN::format(), PCB_PLUGIN::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_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_SHAPE::cmp_drawings::operator()(), PCB_TRACK::cmp_tracks::operator()(), BOARD_ITEM::ptr_cmp::operator()(), FOOTPRINT::cmp_drawings::operator()(), BOARD::cmp_items::operator()(), BOARD::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(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), processTextItem(), PAD_TOOL::recombinePad(), DRC_TEST_PROVIDER_TEXT_DIMS::Run(), CLIPBOARD_IO::SaveSelection(), CONVERT_TOOL::SegmentToArc(), PCB_SELECTION_TOOL::Selectable(), PCB_SELECTION_TOOL::selectConnectedTracks(), 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(), CONNECTIVITY_DATA::TestTrackEndpointDangling(), 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 340 of file board.cpp.

341 {
342 
343  // Check the BOARD physical layer names.
344  for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
345  {
346  if ( ( m_layers[ layer ].m_name == aLayerName )
347  || ( m_layers[ layer ].m_userName == aLayerName ) )
348  return ToLAYER_ID( layer );
349  }
350 
351  // Otherwise fall back to the system standard layer names for virtual layers.
352  for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
353  {
354  if( GetStandardLayerName( ToLAYER_ID( layer ) ) == aLayerName )
355  return ToLAYER_ID( layer );
356  }
357 
358  return UNDEFINED_LAYER;
359 }
int LAYER_NUM
This can be replaced with int and removed.
Definition: layer_ids.h:41
LAYER m_layers[PCB_LAYER_ID_COUNT]
Definition: board.h:1102
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:914
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition: board.h:606

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

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

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

Referenced by PCB_TEXT::GetMsgPanelInfo(), PCB_TARGET::GetMsgPanelInfo(), PCB_SHAPE::GetMsgPanelInfo(), FP_TEXT::GetMsgPanelInfo(), PCB_DIMENSION_BASE::GetMsgPanelInfo(), PCB_DIM_LEADER::GetMsgPanelInfo(), PCB_SHAPE::GetSelectMenuText(), PCB_TEXT::GetSelectMenuText(), FP_SHAPE::GetSelectMenuText(), PCB_TRACK::GetSelectMenuText(), PCB_DIMENSION_BASE::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 362 of file board.cpp.

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

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_PLUGIN::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(), CADSTAR_PCB_ARCHIVE_LOADER::Load(), 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 396 of file board.cpp.

397 {
398  if( !IsCopperLayer( aLayer ) )
399  return LT_SIGNAL;
400 
401  //@@IMB: The original test was broken due to the discontinuity
402  // in the layer sequence.
403  if( IsLayerEnabled( aLayer ) )
404  return m_layers[aLayer].m_type;
405 
406  return LT_SIGNAL;
407 }
LAYER_T m_type
The type of the layer.
Definition: board.h:111
LAYER m_layers[PCB_LAYER_ID_COUNT]
Definition: board.h:1102
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:493
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:808

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

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

◆ GetMenuImage()

BITMAPS EDA_ITEM::GetMenuImage ( ) const
virtualinherited

Return a pointer to an image to be used in menus.

The default version returns the right arrow image. Override this function to provide object specific menu images.

Returns
The menu image associated with the item.

Reimplemented in ZONE, SCH_SYMBOL, PAD, FOOTPRINT, PCB_DIM_CENTER, PCB_DIM_LEADER, SCH_HIERLABEL, PCB_DIM_ORTHOGONAL, SCH_GLOBALLABEL, PCB_VIA, SCH_SHEET, PCB_DIM_ALIGNED, SCH_LABEL, GERBER_DRAW_ITEM, SCH_TEXT, SCH_BUS_BUS_ENTRY, SCH_LINE, LIB_PIN, FP_TEXT, PCB_TRACK, SCH_FIELD, SCH_SHEET_PIN, PCB_GROUP, SCH_BUS_WIRE_ENTRY, LIB_FIELD, FP_SHAPE, PCB_TEXT, PCB_SHAPE, SCH_BITMAP, LIB_TEXT, LIB_SHAPE, SCH_JUNCTION, SCH_NO_CONNECT, SCH_MARKER, PCB_MARKER, and PCB_TARGET.

Definition at line 274 of file eda_item.cpp.

275 {
276  return BITMAPS::dummy_item;
277 }

References dummy_item.

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), and PCB_SELECTION_TOOL::doSelectionMenu().

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

1147 {
1148  int padCount = 0;
1149  int viaCount = 0;
1150  int trackSegmentCount = 0;
1151  std::set<int> netCodes;
1152  int unconnected = GetConnectivity()->GetUnconnectedCount();
1153 
1154  for( PCB_TRACK* item : m_tracks )
1155  {
1156  if( item->Type() == PCB_VIA_T )
1157  viaCount++;
1158  else
1159  trackSegmentCount++;
1160 
1161  if( item->GetNetCode() > 0 )
1162  netCodes.insert( item->GetNetCode() );
1163  }
1164 
1165  for( FOOTPRINT* footprint : Footprints() )
1166  {
1167  for( PAD* pad : footprint->Pads() )
1168  {
1169  padCount++;
1170 
1171  if( pad->GetNetCode() > 0 )
1172  netCodes.insert( pad->GetNetCode() );
1173  }
1174  }
1175 
1176  aList.emplace_back( _( "Pads" ), wxString::Format( wxT( "%d" ), padCount ) );
1177  aList.emplace_back( _( "Vias" ), wxString::Format( wxT( "%d" ), viaCount ) );
1178  aList.emplace_back( _( "Track Segments" ), wxString::Format( wxT( "%d" ), trackSegmentCount ) );
1179  aList.emplace_back( _( "Nets" ), wxString::Format( wxT( "%d" ), (int) netCodes.size() ) );
1180  aList.emplace_back( _( "Unrouted" ), wxString::Format( wxT( "%d" ), unconnected ) );
1181 }
TRACKS m_tracks
Definition: board.h:1098
FOOTPRINTS & Footprints()
Definition: board.h:234
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:345
#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
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
Definition: pad.h:57

References _, Footprints(), Format(), GetConnectivity(), m_tracks, pad, 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 1373 of file board.cpp.

1374 {
1375  std::vector<wxString> names;
1376 
1377  for( const NETINFO_ITEM* net : m_NetInfo )
1378  {
1379  if( !net->GetNetname().IsEmpty() )
1380  names.emplace_back( net->GetNetname() );
1381  }
1382 
1383  return names;
1384 }
NETINFO_LIST m_NetInfo
Definition: board.h:1130
Handle the data for a net.
Definition: netinfo.h:66

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

712  {
713  return m_NetInfo.GetNetCount();
714  }
NETINFO_LIST m_NetInfo
Definition: board.h:1130
unsigned GetNetCount() const
Definition: netinfo.h:346

References NETINFO_LIST::GetNetCount(), and m_NetInfo.

Referenced by CreateSignalsSection().

◆ GetNetInfo() [1/2]

◆ GetNetInfo() [2/2]

NETINFO_LIST& BOARD::GetNetInfo ( )
inline

Definition at line 685 of file board.h.

686  {
687  return m_NetInfo;
688  }
NETINFO_LIST m_NetInfo
Definition: board.h:1130

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

1063 {
1064  unsigned retval = 0;
1065 
1066  for( FOOTPRINT* footprint : Footprints() )
1067  {
1068  for( PAD* pad : footprint->Pads() )
1069  {
1070  if( ( aNet == -1 && pad->GetNetCode() > 0 ) || aNet == pad->GetNetCode() )
1071  retval++;
1072  }
1073  }
1074 
1075  return retval;
1076 }
FOOTPRINTS & Footprints()
Definition: board.h:234
Definition: pad.h:57

References Footprints(), and pad.

Referenced by 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 1461 of file board.cpp.

1462 {
1463  if( !aLayerSet.any() )
1464  aLayerSet = LSET::AllCuMask();
1465 
1466  for( FOOTPRINT* footprint : m_footprints )
1467  {
1468  PAD* pad = nullptr;
1469 
1470  if( footprint->HitTest( aPosition ) )
1471  pad = footprint->GetPad( aPosition, aLayerSet );
1472 
1473  if( pad )
1474  return pad;
1475  }
1476 
1477  return nullptr;
1478 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:759
FOOTPRINTS m_footprints
Definition: board.h:1097
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 885 of file board.h.

886  {
887  return GetPad( aPosition, LSET().set() );
888  }
PAD * GetPad(const wxPoint &aPosition, LSET aLayerMask) const
Find a pad aPosition on aLayer.
Definition: board.cpp:1461
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516

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

1482 {
1483  const wxPoint& aPosition = aTrace->GetEndPoint( aEndPoint );
1484 
1485  LSET lset( aTrace->GetLayer() );
1486 
1487  return GetPad( aPosition, lset );
1488 }
PAD * GetPad(const wxPoint &aPosition, LSET aLayerMask) const
Find a pad aPosition on aLayer.
Definition: board.cpp:1461
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516
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:143

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

1511 {
1512  // Search aPadList for aPosition
1513  // aPadList is sorted by X then Y values, and a fast binary search is used
1514  int idxmax = aPadList.size() - 1;
1515 
1516  int delta = aPadList.size();
1517 
1518  int idx = 0; // Starting index is the beginning of list
1519 
1520  while( delta )
1521  {
1522  // Calculate half size of remaining interval to test.
1523  // Ensure the computed value is not truncated (too small)
1524  if( (delta & 1) && ( delta > 1 ) )
1525  delta++;
1526 
1527  delta /= 2;
1528 
1529  PAD* pad = aPadList[idx];
1530 
1531  if( pad->GetPosition() == aPosition ) // candidate found
1532  {
1533  // The pad must match the layer mask:
1534  if( ( aLayerSet & pad->GetLayerSet() ).any() )
1535  return pad;
1536 
1537  // More than one pad can be at aPosition
1538  // search for a pad at aPosition that matched this mask
1539 
1540  // search next
1541  for( int ii = idx+1; ii <= idxmax; ii++ )
1542  {
1543  pad = aPadList[ii];
1544 
1545  if( pad->GetPosition() != aPosition )
1546  break;
1547 
1548  if( ( aLayerSet & pad->GetLayerSet() ).any() )
1549  return pad;
1550  }
1551  // search previous
1552  for( int ii = idx - 1 ;ii >=0; ii-- )
1553  {
1554  pad = aPadList[ii];
1555 
1556  if( pad->GetPosition() != aPosition )
1557  break;
1558 
1559  if( ( aLayerSet & pad->GetLayerSet() ).any() )
1560  return pad;
1561  }
1562 
1563  // Not found:
1564  return nullptr;
1565  }
1566 
1567  if( pad->GetPosition().x == aPosition.x ) // Must search considering Y coordinate
1568  {
1569  if( pad->GetPosition().y < aPosition.y ) // Must search after this item
1570  {
1571  idx += delta;
1572 
1573  if( idx > idxmax )
1574  idx = idxmax;
1575  }
1576  else // Must search before this item
1577  {
1578  idx -= delta;
1579 
1580  if( idx < 0 )
1581  idx = 0;
1582  }
1583  }
1584  else if( pad->GetPosition().x < aPosition.x ) // 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 
1600  return nullptr;
1601 }
constexpr int delta
Definition: pad.h:57

References delta, and pad.

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

1492 {
1493  for( FOOTPRINT* footprint : Footprints() )
1494  {
1495  for( PAD* pad : footprint->Pads() )
1496  {
1497  if( pad->GetPosition() != aPosition )
1498  continue;
1499 
1500  // Pad found, it must be on the correct layer
1501  if( ( pad->GetLayerSet() & aLayerSet ).any() )
1502  return pad;
1503  }
1504  }
1505 
1506  return nullptr;
1507 }
FOOTPRINTS & Footprints()
Definition: board.h:234
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 1850 of file board.cpp.

1851 {
1852  std::vector<PAD*> allPads;
1853 
1854  for( FOOTPRINT* footprint : Footprints() )
1855  {
1856  for( PAD* pad : footprint->Pads() )
1857  allPads.push_back( pad );
1858  }
1859 
1860  return allPads;
1861 }
FOOTPRINTS & Footprints()
Definition: board.h:234
Definition: pad.h:57

References Footprints(), and pad.

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

◆ GetPageSettings()

◆ GetParent()

BOARD_ITEM_CONTAINER* BOARD_ITEM::GetParent ( void  ) const
inlineinherited

Definition at line 136 of file board_item.h.

136 { return (BOARD_ITEM_CONTAINER*) m_parent; }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:478
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::DragArcTrack(), KIGFX::PCB_PAINTER::draw(), EDIT_TOOL::Duplicate(), PCB_SELECTION_TOOL::FilterCollectorForFreePads(), PCB_SELECTION_TOOL::FilterCollectorForHierarchy(), PCB_PLUGIN::format(), FormatProbeItem(), BOARD_ITEM::GetBoard(), PCB_MARKER::GetColorLayer(), BOARD_ITEM::GetParentFootprint(), ALIGN_DISTRIBUTE_TOOL::GetSelections(), FP_TEXT::GetSelectMenuText(), PCB_TEXT::GetShownText(), FP_TEXT::GetShownText(), getTopLevelGroup(), GENERAL_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), isInsideArea(), DRC_ENGINE::IsNetTie(), FP_SHAPE::IsParentFlipped(), FP_TEXT::IsParentFlipped(), PCB_SELECTION_TOOL::itemPassesFilter(), 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().

◆ GetParentFootprint()

BOARD_ITEM_CONTAINER * BOARD_ITEM::GetParentFootprint ( ) const
inherited

Definition at line 191 of file board_item.cpp.

192 {
193  BOARD_ITEM_CONTAINER* ancestor = GetParent();
194 
195  while( ancestor && ancestor->Type() == PCB_GROUP_T )
196  ancestor = ancestor->GetParent();
197 
198  return ( ancestor && ancestor->Type() == PCB_FOOTPRINT_T ) ? ancestor : nullptr;
199 }
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:108
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
Abstract interface for BOARD_ITEMs capable of storing other items inside.
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:136
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112

References BOARD_ITEM::GetParent(), PCB_FOOTPRINT_T, PCB_GROUP_T, and EDA_ITEM::Type().

Referenced by CN_CONNECTIVITY_ALGO::Add(), PNS::ITEM::collideSimple(), CONVERT_TOOL::CreatePolys(), and DRC_TEST_PROVIDER_SOLDER_MASK::testItemAgainstItems().

◆ GetParentGroup()

◆ GetPlotOptions()

const PCB_PLOT_PARAMS& BOARD::GetPlotOptions ( ) const
inline

◆ GetPosition()

wxPoint BOARD::GetPosition ( ) const
overridevirtual

Reimplemented from EDA_ITEM.

Definition at line 256 of file board.cpp.

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

References BOARD_ITEM::ZeroOffset.

◆ GetProject()

◆ GetProperties()

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

Definition at line 259 of file board.h.

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

References m_properties.

Referenced by PCB_CONTROL::AppendBoard(), and PCB_PLUGIN::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 798 of file board.cpp.

799 {
800  return wxString::Format( _( "PCB" ) );
801 }
#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 1618 of file board.cpp.

1619 {
1620  for( FOOTPRINT* footprint : Footprints() )
1621  {
1622  for( PAD* pad : footprint->Pads( ) )
1623  {
1624  if( aNetCode < 0 || pad->GetNetCode() == aNetCode )
1625  aVector.push_back( pad );
1626  }
1627  }
1628 
1629  std::sort( aVector.begin(), aVector.end(), sortPadsByXthenYCoord );
1630 }
bool sortPadsByXthenYCoord(PAD *const &aLH, PAD *const &aRH)
Used by #GetSortedPadListByXCoord to sort a pad list by X coordinate value.
Definition: board.cpp:1609
FOOTPRINTS & Footprints()
Definition: board.h:234
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 606 of file board.h.

607  {
608  // a BOARD's standard layer name is the PCB_LAYER_ID fixed name
609  return LayerName( aLayerId );
610  }
wxString LayerName(int aLayer)
Returns the default display name for a given layer.
Definition: layer_id.cpp:30

References LayerName().

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

◆ GetState()

int EDA_ITEM::GetState ( EDA_ITEM_FLAGS  type) const
inlineinherited

Definition at line 136 of file eda_item.h.

137  {
138  return m_status & type;
139  }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:477

References EDA_ITEM::m_status.

Referenced by BOARD_ITEM::IsLocked().

◆ GetStatus()

EDA_ITEM_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 149 of file eda_item.h.

149 { return m_status; }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:477

References EDA_ITEM::m_status.

◆ GetTimeStamp()

int BOARD::GetTimeStamp ( ) const
inline

Definition at line 215 of file board.h.

215 { return m_timeStamp; }
int m_timeStamp
Definition: board.h:1092

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

543 { return m_titles; }
TITLE_BLOCK m_titles
Definition: board.h:1114

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

1644 {
1645  int count = 0;
1646  double length = 0.0;
1647  double package_length = 0.0;
1648 
1649  constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T, PCB_PAD_T, EOT };
1650  auto connectivity = GetBoard()->GetConnectivity();
1652  bool useHeight = GetDesignSettings().m_UseHeightForLengthCalcs;
1653 
1654  for( BOARD_CONNECTED_ITEM* item : connectivity->GetConnectedItems(
1655  static_cast<const BOARD_CONNECTED_ITEM*>( &aTrack ), types ) )
1656  {
1657  count++;
1658 
1659  if( PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( item ) )
1660  {
1661  if( track->Type() == PCB_VIA_T && useHeight )
1662  {
1663  PCB_VIA* via = static_cast<PCB_VIA*>( track );
1664  length += stackup.GetLayerDistance( via->TopLayer(), via->BottomLayer() );
1665  continue;
1666  }
1667  else if( track->Type() == PCB_ARC_T )
1668  {
1669  // Note: we don't apply the clip-to-pad optimization if an arc ends in a pad
1670  // Room for future improvement.
1671  length += track->GetLength();
1672  continue;
1673  }
1674 
1675  bool inPad = false;
1676  SEG trackSeg( track->GetStart(), track->GetEnd() );
1677  double segLen = trackSeg.Length();
1678  double segInPadLen = 0;
1679 
1680  for( auto pad_it : connectivity->GetConnectedPads( item ) )
1681  {
1682  PAD* pad = static_cast<PAD*>( pad_it );
1683 
1684  bool hitStart = pad->HitTest( track->GetStart(), track->GetWidth() / 2 );
1685  bool hitEnd = pad->HitTest( track->GetEnd(), track->GetWidth() / 2 );
1686 
1687  if( hitStart && hitEnd )
1688  {
1689  inPad = true;
1690  break;
1691  }
1692  else if( hitStart || hitEnd )
1693  {
1694  VECTOR2I loc;
1695 
1696  // We may not collide even if we passed the bounding-box hit test
1697  if( pad->GetEffectivePolygon()->Collide( trackSeg, 0, nullptr, &loc ) )
1698  {
1699  // Part 1: length of the seg to the intersection with the pad poly
1700  if( hitStart )
1701  trackSeg.A = loc;
1702  else
1703  trackSeg.B = loc;
1704 
1705  segLen = trackSeg.Length();
1706 
1707  // Part 2: length from the intersection to the pad anchor
1708  segInPadLen += ( loc - pad->GetPosition() ).EuclideanNorm();
1709  }
1710  }
1711  }
1712 
1713  if( !inPad )
1714  length += segLen + segInPadLen;
1715  }
1716  else if( PAD* pad = dyn_cast<PAD*>( item ) )
1717  {
1718  package_length += pad->GetPadToDieLength();
1719  }
1720  }
1721 
1722  return std::make_tuple( count, length, package_length );
1723 }
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:590
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()
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:345
Definition: seg.h:40
bool m_UseHeightForLengthCalcs
Enable inclusion of stackup height in track length measurements and length tuning.
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
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 1079 of file board.cpp.

1080 {
1081  return m_connectivity->GetUnconnectedCount();
1082 }
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: board.h:1111

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

528 {
530 }
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.
Definition: layer_ids.h:290
GAL_SET & set()
Definition: layer_ids.h:306
PROJECT * m_project
Definition: board.h:1116

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

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

1791 {
1792  std::list<ZONE*> zones;
1793 
1794  for( ZONE* zone : Zones() )
1795  zones.push_back( zone );
1796 
1797  if( aIncludeZonesInFootprints )
1798  {
1799  for( FOOTPRINT* footprint : m_footprints )
1800  {
1801  for( FP_ZONE* zone : footprint->Zones() )
1802  zones.push_back( zone );
1803  }
1804  }
1805 
1806  return zones;
1807 }
ZONES & Zones()
Definition: board.h:240
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
FOOTPRINTS m_footprints
Definition: board.h:1097
A specialization of ZONE for use in footprints.
Definition: zone.h:947

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

597 {
599 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:590
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 2057 of file board.cpp.

2058 {
2059  bool hasGroup = false;
2060  bool hasMember = false;
2061 
2062  for( EDA_ITEM* item : selection )
2063  {
2064  if( item->Type() == PCB_GROUP_T )
2065  hasGroup = true;
2066 
2067  if( static_cast<BOARD_ITEM*>( item )->GetParentGroup() )
2068  hasMember = true;
2069  }
2070 
2071  GroupLegalOpsField legalOps;
2072 
2073  legalOps.create = true;
2074  legalOps.removeItems = hasMember;
2075  legalOps.ungroup = hasGroup;
2076  legalOps.enter = hasGroup && selection.Size() == 1;
2077 
2078  return legalOps;
2079 }
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:99

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

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

References m_groups.

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

◆ Groups() [2/2]

const GROUPS& BOARD::Groups ( ) const
inline

Definition at line 255 of file board.h.

255 { return m_groups; }
GROUPS m_groups
Definition: board.h:1099

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

1979 {
1980  if( repair )
1981  {
1982  while( GroupsSanityCheckInternal( repair ) != wxEmptyString )
1983  {};
1984 
1985  return wxEmptyString;
1986  }
1987  return GroupsSanityCheckInternal( repair );
1988 }
wxString GroupsSanityCheckInternal(bool repair)
Definition: board.cpp:1991

References GroupsSanityCheckInternal().

Referenced by PCB_PLUGIN::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 1991 of file board.cpp.

1992 {
1993  // Cycle detection
1994  //
1995  // Each group has at most one parent group.
1996  // So we start at group 0 and traverse the parent chain, marking groups seen along the way.
1997  // If we ever see a group that we've already marked, that's a cycle.
1998  // If we reach the end of the chain, we know all groups in that chain are not part of any cycle.
1999  //
2000  // Algorithm below is linear in the # of groups because each group is visited only once.
2001  // There may be extra time taken due to the container access calls and iterators.
2002  //
2003  // Groups we know are cycle free
2004  std::unordered_set<PCB_GROUP*> knownCycleFreeGroups;
2005  // Groups in the current chain we're exploring.
2006  std::unordered_set<PCB_GROUP*> currentChainGroups;
2007  // Groups we haven't checked yet.
2008  std::unordered_set<PCB_GROUP*> toCheckGroups;
2009 
2010  // Initialize set of groups to check that could participate in a cycle.
2011  for( PCB_GROUP* group : Groups() )
2012  toCheckGroups.insert( group);
2013 
2014  while( !toCheckGroups.empty() )
2015  {
2016  currentChainGroups.clear();
2017  PCB_GROUP* group = *toCheckGroups.begin();
2018 
2019  while( true )
2020  {
2021  if( currentChainGroups.find( group ) != currentChainGroups.end() )
2022  {
2023  if( repair )
2024  Remove( group );
2025 
2026  return "Cycle detected in group membership";
2027  }
2028  else if( knownCycleFreeGroups.find( group ) != knownCycleFreeGroups.end() )
2029  {
2030  // Parent is a group we know does not lead to a cycle
2031  break;
2032  }
2033 
2034  currentChainGroups.insert( group );
2035  // We haven't visited currIdx yet, so it must be in toCheckGroups
2036  toCheckGroups.erase( group );
2037 
2038  group = group->GetParentGroup();
2039 
2040  if( !group )
2041  {
2042  // end of chain and no cycles found in this chain
2043  break;
2044  }
2045  }
2046 
2047  // No cycles found in chain, so add it to set of groups we know don't participate
2048  // in a cycle.
2049  knownCycleFreeGroups.insert( currentChainGroups.begin(), currentChainGroups.end() );
2050  }
2051 
2052  // Success
2053  return "";
2054 }
GROUPS & Groups()
The groups must maintain the following invariants.
Definition: board.h:254
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:710

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

Referenced by GroupsSanityCheck().

◆ HasFlag()

◆ HighLightOFF()

void BOARD::HighLightOFF ( )
inline

Disable net highlight.

Definition at line 417 of file board.h.

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

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

1969 {
1970  if( m_highLight.m_highLightOn != aValue )
1971  {
1972  m_highLight.m_highLightOn = aValue;
1974  }
1975 }
void InvokeListeners(Func &&aFunc, Args &&... args)
Definition: board.h:1082
HIGH_LIGHT_INFO m_highLight
Definition: board.h:1104
bool m_highLightOn
Definition: board.h:139
virtual void OnBoardHighlightNetChanged(BOARD &aBoard)
Definition: board.h:174

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 this 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_GLOBALLABEL, SCH_SHEET, DS_DRAW_ITEM_BITMAP, DS_DRAW_ITEM_TEXT, PCB_ARC, SCH_TEXT, SCH_LINE, PCB_DIMENSION_BASE, DS_DRAW_ITEM_RECT, GERBER_DRAW_ITEM, SCH_FIELD, FP_TEXT, LIB_ITEM, PCB_TRACK, DS_DRAW_ITEM_POLYPOLYGONS, LIB_PIN, PCB_GROUP, SCH_BITMAP, SCH_JUNCTION, SCH_BUS_ENTRY_BASE, PCB_TEXT, PCB_SHAPE, SCH_NO_CONNECT, DS_DRAW_ITEM_BASE, PCB_TARGET, LIB_TEXT, and LIB_SHAPE.

Definition at line 237 of file eda_item.h.

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

◆ IncrementTimeStamp()

void BOARD::IncrementTimeStamp ( )

Definition at line 192 of file board.cpp.

193 {
194  m_timeStamp++;
195 
196  {
197  std::unique_lock<std::mutex> cacheLock( m_CachesMutex );
198  m_InsideAreaCache.clear();
199  m_InsideCourtyardCache.clear();
200  m_InsideFCourtyardCache.clear();
201  m_InsideBCourtyardCache.clear();
202  m_LayerExpressionCache.clear();
203  }
204 
205  m_CopperZoneRTrees.clear();
206 }
std::map< std::pair< BOARD_ITEM *, BOARD_ITEM * >, bool > m_InsideCourtyardCache
Definition: board.h:1066
std::mutex m_CachesMutex
Definition: board.h:1065
std::map< wxString, LSET > m_LayerExpressionCache
Definition: board.h:1070
std::map< ZONE *, std::unique_ptr< DRC_RTREE > > m_CopperZoneRTrees
Definition: board.h:1072
std::map< std::pair< BOARD_ITEM *, BOARD_ITEM * >, bool > m_InsideBCourtyardCache
Definition: board.h:1068
std::map< std::pair< BOARD_ITEM *, BOARD_ITEM * >, bool > m_InsideAreaCache
Definition: board.h:1069
int m_timeStamp
Definition: board.h:1092
std::map< std::pair< BOARD_ITEM *, BOARD_ITEM * >, bool > m_InsideFCourtyardCache
Definition: board.h:1067

References m_CachesMutex, m_CopperZoneRTrees, m_InsideAreaCache, m_InsideBCourtyardCache, m_InsideCourtyardCache, m_InsideFCourtyardCache, m_LayerExpressionCache, 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 1082 of file board.h.

1083  {
1084  for( auto&& l : m_listeners )
1085  ( l->*aFunc )( std::forward<Args>( args )... );
1086  }
std::vector< BOARD_LISTENER * > m_listeners
Definition: board.h:1132

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

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

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

534 {
536 }
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:1116

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

283  {
284  return m_drawings.empty() && m_footprints.empty() && m_tracks.empty() && m_zones.empty();
285  }
TRACKS m_tracks
Definition: board.h:1098
ZONES m_zones
Definition: board.h:1100
DRAWINGS m_drawings
Definition: board.h:1096
FOOTPRINTS m_footprints
Definition: board.h:1097

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

123 { return m_flags & ENTERED; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480
#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 222 of file board.h.

223  {
225  }
BOARD_USE m_boardUse
What is this board being used for.
Definition: board.h:1091

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

573 {
574  switch( aLayer )
575  {
576  case F_Cu:
577  return IsElementVisible( LAYER_MOD_FR );
578 
579  case B_Cu:
580  return IsElementVisible( LAYER_MOD_BK );
581 
582  default:
583  wxFAIL_MSG( wxT( "BOARD::IsModuleLayerVisible() param error: bad layer" ) );
584  return true;
585  }
586 }
show footprints on back
Definition: layer_ids.h:216
show footprints on front
Definition: layer_ids.h:215
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
Definition: board.cpp:533
Definition: layer_ids.h:71

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

205 { return m_forceVisible; }
bool m_forceVisible
Definition: eda_item.h:479

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

403 { return m_highLight.m_highLightOn; }
HIGH_LIGHT_INFO m_highLight
Definition: board.h:1104
bool m_highLightOn
Definition: board.h:139

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

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

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::testZonesToZones().

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

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

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

Referenced by 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 64 of file board_item.cpp.

65 {
66  if( GetParentGroup() )
67  return GetParentGroup()->IsLocked();
68 
69  const BOARD* board = GetBoard();
70 
71  return board && board->GetBoardUse() != BOARD_USE::FPHOLDER && GetState( LOCKED );
72 }
PCB_GROUP * GetParentGroup() const
Definition: board_item.h:60
virtual bool IsLocked() const
Definition: board_item.cpp:64
#define LOCKED
Pcbnew: locked from movement and deletion.
int GetState(EDA_ITEM_FLAGS type) const
Definition: eda_item.h:136
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:191
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
BOARD_USE GetBoardUse() const
Get what the board use is.
Definition: board.h:211

References FPHOLDER, BOARD_ITEM::GetBoard(), GetBoardUse(), 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::DragArcTrack(), EDIT_TOOL::FilletTracks(), PCB_PLUGIN::format(), DSN::SPECCTRA_DB::FromBOARD(), DSN::SPECCTRA_DB::FromSESSION(), PCB_TEXT::GetMsgPanelInfo(), PCB_SHAPE::GetMsgPanelInfo(), ZONE::GetMsgPanelInfo(), FP_TEXT::GetMsgPanelInfo(), PCB_GROUP::GetMsgPanelInfo(), PCB_DIMENSION_BASE::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfoBase_Common(), ALIGN_DISTRIBUTE_TOOL::GetSelections(), GROUP_TOOL::Group(), ROUTER_TOOL::InlineDrag(), 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 117 of file eda_item.h.

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

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

112  {
113  return IsCopperLayer( GetLayer() );
114  }
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:808
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:143

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

196  {
197  return m_layer == aLayer;
198  }
PCB_LAYER_ID m_layer
Definition: board_item.h:313

References BOARD_ITEM::m_layer.

Referenced by DRC_TEST_PROVIDER_SOLDER_MASK::addItemToRTrees(), BOARD_ADAPTER::createLayers(), existsOnLayer(), GENERAL_COLLECTOR::Inspect(), PCB_LAYER_COLLECTOR::Inspect(), BOARD_INSPECTION_TOOL::InspectClearance(), PNS_KICAD_IFACE::IsItemVisible(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::Run(), DRC_TEST_PROVIDER_SOLDER_MASK::testMaskBridges(), and DRC_TEST_PROVIDER_SOLDER_MASK::testSilkToMaskClearance().

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

402 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 124 of file eda_item.h.

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

References IS_RESIZING, and EDA_ITEM::m_flags.

◆ IsSelected()

bool EDA_ITEM::IsSelected ( ) const
inlineinherited

Definition at line 122 of file eda_item.h.

122 { return m_flags & SELECTED; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480
#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(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), EE_SELECTION_TOOL::RebuildSelection(), RENDER_3D_OPENGL::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(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), KIGFX::SCH_PAINTER::setDeviceColors(), GERBVIEW_SELECTION_TOOL::unselect(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

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

206  {
207  return ( Type() == PCB_TRACE_T ) || ( Type() == PCB_VIA_T );
208  }
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:112

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

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

References EOT, EDA_ITEM::m_structType, and SCH_LOCATE_ANY_T.

Referenced by SCH_EDIT_TOOL::AutoplaceFields(), 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 121 of file eda_item.h.

121 { return m_flags & IS_WIRE_IMAGE; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480
#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 294 of file eda_item.h.

298  {
299  for( auto it : aList )
300  {
301  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
303  return SEARCH_RESULT::QUIT;
304  }
305 
307  }
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 313 of file eda_item.h.

315  {
316  for( auto it : aList )
317  {
318  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
320  return SEARCH_RESULT::QUIT;
321  }
322 
324  }
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 87 of file board_item.cpp.

88 {
89  const BOARD* board = GetBoard();
90  LSET layers = GetLayerSet();
91 
92  // Try to be smart and useful. Check all copper first.
93  if( layers[F_Cu] && layers[B_Cu] )
94  return _( "all copper layers" );
95 
96  LSET copperLayers = layers & board->GetEnabledLayers().AllCuMask();
97  LSET techLayers = layers & board->GetEnabledLayers().AllTechMask();
98 
99  for( LSET testLayers : { copperLayers, techLayers, layers } )
100  {
101  for( int bit = PCBNEW_LAYER_ID_START; bit < PCB_LAYER_ID_COUNT; ++bit )
102  {
103  if( testLayers[ bit ] )
104  {
105  wxString layerInfo = board->GetLayerName( static_cast<PCB_LAYER_ID>( bit ) );
106 
107  if( testLayers.count() > 1 )
108  layerInfo << wxS( " " ) + _( "and others" );
109 
110  return layerInfo;
111  }
112  }
113  }
114 
115  // No copper, no technicals: no layer
116  return _( "no layers" );
117 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:759
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:362
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:467
static LSET AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
Definition: lset.cpp:829
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516
#define _(s)
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:191
Definition: layer_ids.h:71
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
Definition: board_item.h:148

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

1892 {
1893  for( BOARD_CONNECTED_ITEM* item : AllConnectedItems() )
1894  {
1895  NETINFO_ITEM* netInfo = aDestBoard->FindNet( item->GetNetname() );
1896 
1897  if( netInfo )
1898  item->SetNet( netInfo );
1899  else
1900  item->SetNetCode( 0 );
1901  }
1902 }
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition: board.cpp:1328
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:1864
void SetNetCode(int aNetCode)
Definition: netinfo.h:121
Handle the data for a net.
Definition: netinfo.h:66

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

◆ Markers() [1/2]

◆ Markers() [2/2]

const MARKERS& BOARD::Markers ( ) const
inline

Definition at line 244 of file board.h.

244 { return m_markers; }
MARKERS m_markers
Definition: board.h:1095

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, PCB_MARKER, SCH_MARKER, FP_TEXT, and PCB_TEXT.

Definition at line 364 of file eda_item.h.

365  {
366  return false;
367  }

Referenced by SCH_EDITOR_CONTROL::HasMatch(), PCB_TEXT::Matches(), FP_TEXT::Matches(), SCH_MARKER::Matches(), PCB_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  int flags = aSearchData.GetFlags();
122  wxString searchText = aSearchData.GetFindString();
123 
124  // Don't match if searching for replaceable item and the item doesn't support text replace.
125  if( ( flags & FR_SEARCH_REPLACE ) && !IsReplaceable() )
126  return false;
127 
128  if( !( flags & wxFR_MATCHCASE ) )
129  {
130  text.MakeUpper();
131  searchText.MakeUpper();
132  }
133 
134  if( flags & wxFR_WHOLEWORD )
135  {
136  int ii = 0;
137 
138  while( ii < (int) text.length() )
139  {
140  int next = text.find( searchText, ii );
141 
142  if( next == wxNOT_FOUND )
143  return false;
144 
145  ii = next;
146  next += searchText.length();
147 
148  bool startOK = ( ii == 0 || !wxIsalnum( text.GetChar( ii - 1 ) ) );
149  bool endOK = ( next == (int) text.length() || !wxIsalnum( text.GetChar( next ) ) );
150 
151  if( startOK && endOK )
152  return true;
153  else
154  ii++;
155  }
156 
157  return false;
158  }
159  else if( flags & FR_MATCH_WILDCARD )
160  {
161  return text.Matches( searchText );
162  }
163  else
164  {
165  return text.Find( searchText ) != wxNOT_FOUND;
166  }
167 }
CITER next(CITER it)
Definition: ptree.cpp:126
virtual bool IsReplaceable() const
Override this method in any derived object that supports test find and replace.
Definition: eda_item.h:402

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

◆ Move() [1/2]

void BOARD_ITEM::Move ( const VECTOR2I aMoveVector)
inlineinherited

Definition at line 238 of file board_item.h.

239  {
240  Move( wxPoint( aMoveVector.x, aMoveVector.y ) );
241  }
virtual void Move(const wxPoint &aMoveVector)
Move this object.
Definition: board_item.h:233

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

◆ Move() [2/2]

void BOARD::Move ( const wxPoint &  aMoveVector)
overridevirtual

Move this object.

Parameters
aMoveVectorthe move vector for this object.