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 ()
 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 NormalizeAreaPolygon (PICKED_ITEMS_LIST *aNewZonesList, ZONE *aCurrArea)
 Process an area that has been modified, by normalizing its polygon against itself. More...
 
bool OnAreaPolygonModified (PICKED_ITEMS_LIST *aModifiedZonesList, ZONE *modified_area)
 Process an area that has been modified, by normalizing its polygon and merging the intersecting polygons for any other areas on the same net. More...
 
bool TestZoneIntersection (ZONE *aZone1, ZONE *aZone2)
 Test for intersection of 2 copper areas. More...
 
PADGetPad (const wxPoint &aPosition, LSET aLayerMask) const
 Find a pad aPosition on aLayer. More...
 
PADGetPad (const wxPoint &aPosition) const
 
PADGetPad (const PCB_TRACK *aTrace, ENDPOINT_T aEndPoint) const
 Find a pad connected to aEndPoint of aTrace. More...
 
PADGetPadFast (const wxPoint &aPosition, LSET aLayerMask) const
 Return pad found at aPosition on aLayerMask using the fast search method. More...
 
PADGetPad (std::vector< PAD * > &aPadList, const wxPoint &aPosition, LSET aLayerMask) const
 Locate the pad connected at aPosition on aLayer starting at list position aPad. More...
 
void PadDelete (PAD *aPad)
 Delete a given pad from the BOARD by removing it from its footprint and from the m_NetInfo. More...
 
void GetSortedPadListByXthenYCoord (std::vector< PAD * > &aVector, int aNetCode=-1) const
 First empties then fills the vector with all pads and sorts them by increasing x coordinate, and for increasing y coordinate for same values of x coordinates. More...
 
std::tuple< int, double, double > GetTrackLength (const PCB_TRACK &aTrack) const
 Return data on the length and number of track segments connected to a given track. More...
 
TRACKS TracksInNet (int aNetCode)
 Collect all the TRACKs and VIAs that are members of a net given by aNetCode. More...
 
FOOTPRINTGetFootprint (const wxPoint &aPosition, PCB_LAYER_ID aActiveLayer, bool aVisibleOnly, bool aIgnoreLocked=false) const
 Get a footprint by its bounding rectangle at aPosition on aLayer. More...
 
void ClearAllNetCodes ()
 Reset all items' netcodes to 0 (no net). More...
 
void MapNets (const BOARD *aDestBoard)
 Map all nets in the given board to nets with the same name (if any) in the destination board. More...
 
void SanitizeNetcodes ()
 
void AddListener (BOARD_LISTENER *aListener)
 Add a listener to the board to receive calls whenever something on the board has been modified. More...
 
void RemoveListener (BOARD_LISTENER *aListener)
 Remove the specified listener. More...
 
void OnItemChanged (BOARD_ITEM *aItem)
 Notify the board and its listeners that an item on the board has been modified in some way. More...
 
void OnItemsChanged (std::vector< BOARD_ITEM * > &aItems)
 Notify the board and its listeners that an item on the board has been modified in some way. More...
 
wxString GroupsSanityCheck (bool repair=false)
 Consistency check of internal m_groups structure. More...
 
wxString GroupsSanityCheckInternal (bool repair)
 
GroupLegalOpsField GroupLegalOps (const PCB_SELECTION &selection) const
 Check which selection tool group operations are legal given the selection. More...
 
virtual void Delete (BOARD_ITEM *aItem)
 Removes an item from the container and deletes it. More...
 
void SetParentGroup (PCB_GROUP *aGroup)
 
PCB_GROUPGetParentGroup () const
 
int GetX () const
 
int GetY () const
 
virtual wxPoint GetCenter () const
 This defaults to the center of the bounding box if not overridden. More...
 
void SetX (int aX)
 
void SetY (int aY)
 
virtual bool IsConnected () const
 Returns information if the object is derived from BOARD_CONNECTED_ITEM. More...
 
virtual bool IsOnCopperLayer () const
 
virtual std::shared_ptr< SHAPEGetEffectiveShape (PCB_LAYER_ID aLayer=UNDEFINED_LAYER) const
 Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes. More...
 
BOARD_ITEM_CONTAINERGetParent () const
 
virtual PCB_LAYER_ID GetLayer () const
 Return the primary layer this item is on. More...
 
virtual LSET GetLayerSet () const
 Return a std::bitset of all layers on which the item physically resides. More...
 
virtual void SetLayerSet (LSET aLayers)
 
virtual void SetLayer (PCB_LAYER_ID aLayer)
 Set the layer this item is on. More...
 
virtual BOARD_ITEMDuplicate () const
 Create a copy of this BOARD_ITEM. More...
 
virtual void SwapData (BOARD_ITEM *aImage)
 Swap data between aItem and aImage. More...
 
virtual bool IsOnLayer (PCB_LAYER_ID aLayer) const
 Test to see if this object is on the given layer. More...
 
bool IsTrack () const
 Test to see if this object is a track or via (or microvia). More...
 
virtual bool IsLocked () const
 
virtual void SetLocked (bool aLocked)
 Modify the 'lock' status for of the item. More...
 
void DeleteStructure ()
 Delete this object after removing from its parent if it has one. More...
 
void Move (const VECTOR2I &aMoveVector)
 
virtual void Rotate (const wxPoint &aRotCentre, double aAngle)
 Rotate this object. More...
 
void Rotate (const VECTOR2I &aRotCentre, double aAngle)
 
virtual void Flip (const wxPoint &aCentre, bool aFlipLeftRight)
 Flip this object, i.e. More...
 
void Flip (const VECTOR2I &aCentre, bool aFlipLeftRight)
 
virtual 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 contained within or on the bounding box of an item. More...
 
virtual bool HitTest (const EDA_RECT &aRect, bool aContained, int aAccuracy=0) const
 Test if aRect intersects or is contained within the bounding box of an item. More...
 
virtual EDA_ITEMClone () const
 Create a duplicate of this item with linked list members set to NULL. More...
 
virtual BITMAPS GetMenuImage () const
 Return a pointer to an image to be used in menus. More...
 
virtual bool Matches (const wxFindReplaceData &aSearchData, void *aAuxData) const
 Compare the item against the search criteria in aSearchData. More...
 
virtual bool Replace (const wxFindReplaceData &aSearchData, void *aAuxData=nullptr)
 Perform a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Override this method in any derived object that supports test find and replace. More...
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
virtual const BOX2I ViewBBox () const override
 Return the bounding box of the item covering all its layers. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Draw the parts of the object belonging to layer aLayer. More...
 
virtual double ViewGetLOD (int aLayer, VIEW *aView) const
 Return the level of detail (LOD) of the item. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 
void ClearViewPrivData ()
 
bool Set (PROPERTY_BASE *aProperty, wxAny &aValue)
 
template<typename T >
bool Set (PROPERTY_BASE *aProperty, T aValue)
 
template<typename T >
bool Set (const wxString &aProperty, T aValue)
 
wxAny Get (PROPERTY_BASE *aProperty)
 
template<typename T >
Get (PROPERTY_BASE *aProperty)
 
template<typename T >
boost::optional< T > Get (const wxString &aProperty)
 

Static Public Member Functions

static bool ClassOf (const EDA_ITEM *aItem)
 
static wxString GetStandardLayerName (PCB_LAYER_ID aLayerId)
 Return an "English Standard" name of a PCB layer when given aLayerNumber. More...
 
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 190 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:268
wxString m_name
The canonical name of the layer.
Definition: board.h:108
bool m_LegacyNetclassesLoaded
True if netclasses were loaded from the file.
Definition: board.h:272
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:49
PAGE_INFO m_paper
Definition: board.h:1137
LAYER_T m_type
The type of the layer.
Definition: board.h:110
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:1126
NETINFO_LIST m_NetInfo
Definition: board.h:1154
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:222
bool m_LegacyCopperEdgeClearanceLoaded
Definition: board.h:269
BOARD_USE m_boardUse
What is this board being used for.
Definition: board.h:1115
#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:249
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:1152
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:796
int m_fileFormatVersionAtLoad
Definition: board.h:1131
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: board.h:1135
NETCLASS * GetDefault() const
GAL_SET & set()
Definition: layer_ids.h:295
BOARD_ITEM_CONTAINER(BOARD_ITEM *aParent, KICAD_T aType)
LSET m_LegacyVisibleLayers
Visibility settings stored in board prior to 6.0, only used for loading legacy files.
Definition: board.h:264
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:905
void UseCustomTrackViaSize(bool aEnabled)
Enables/disables custom track/via size settings.
PROJECT * m_project
Definition: board.h:1140
int m_timeStamp
Definition: board.h:1116
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition: board.h:605
Container for design settings for a BOARD object.
GAL_SET m_LegacyVisibleItems
Definition: board.h:265

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

◆ ~BOARD()

BOARD::~BOARD ( )

Definition at line 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:1123
TRACKS m_tracks
Definition: board.h:1122
void DeleteMARKERs()
Delete all MARKERS from the board.
Definition: board.cpp:804
ZONES m_zones
Definition: board.h:1124
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
DRAWINGS m_drawings
Definition: board.h:1120
FOOTPRINTS m_footprints
Definition: board.h:1121

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:1106
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:1123
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:1154
TRACKS m_tracks
Definition: board.h:1122
virtual void OnBoardItemAdded(BOARD &aBoard, BOARD_ITEM *aBoardItem)
Definition: board.h:166
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:116
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
void AppendNet(NETINFO_ITEM *aNewElement)
Add aNewElement to the end of the net list.
ZONES m_zones
Definition: board.h:1124
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:1119
DRAWINGS m_drawings
Definition: board.h:1120
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:796
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:104
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
Handle the data for a net.
Definition: netinfo.h:64
class PCB_MARKER, a marker used to show something
Definition: typeinfo.h:98
class NETINFO_ITEM, a description of a net
Definition: typeinfo.h:107
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: board.h:1135
FOOTPRINTS m_footprints
Definition: board.h:1121
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
Definition: typeinfo.h:103
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
void ClearEditFlags()
Definition: eda_item.h:172
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

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

Referenced by NET_SELECTOR_COMBOPOPUP::Accept(), PCB_BASE_FRAME::AddFootprintToBoard(), PCAD2KICAD::PCB_TEXT::AddToBoard(), PCAD2KICAD::PCB_ARC::AddToBoard(), PCAD2KICAD::PCB_LINE::AddToBoard(), PCAD2KICAD::PCB_POLYGON::AddToBoard(), PCAD2KICAD::PCB_PAD::AddToBoard(), PCAD2KICAD::PCB::AddToBoard(), PCAD2KICAD::PCB_FOOTPRINT::AddToBoard(), PCAD2KICAD::PCB_PAD::AddToFootprint(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), CADSTAR_PCB_ARCHIVE_LOADER::createUniqueGroupID(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), DSN::SPECCTRA_DB::FromSESSION(), CADSTAR_PCB_ARCHIVE_LOADER::getKiCadNet(), GROUP_TOOL::Group(), ALTIUM_PCB::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 1807 of file board.cpp.

1809 {
1810  ZONE* new_area = new ZONE( this );
1811 
1812  new_area->SetNetCode( aNetcode );
1813  new_area->SetLayer( aLayer );
1814 
1815  m_zones.push_back( new_area );
1816 
1817  new_area->SetHatchStyle( (ZONE_BORDER_DISPLAY_STYLE) aHatch );
1818 
1819  // Add the first corner to the new zone
1820  new_area->AppendCorner( aStartPointPosition, -1 );
1821 
1822  if( aNewZonesList )
1823  {
1824  ITEM_PICKER picker( nullptr, new_area, UNDO_REDO::NEWITEM );
1825  aNewZonesList->PushItem( picker );
1826  }
1827 
1828  return new_area;
1829 }
void SetHatchStyle(ZONE_BORDER_DISPLAY_STYLE aStyle)
Definition: zone.h:614
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
void PushItem(const ITEM_PICKER &aItem)
Push aItem to the top of the list.
ZONES m_zones
Definition: board.h:1124
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:840
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().

Referenced by NormalizeAreaPolygon().

◆ AddListener()

void BOARD::AddListener ( BOARD_LISTENER aListener)

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

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

Definition at line 1960 of file board.cpp.

1961 {
1962  if( !alg::contains( m_listeners, aListener ) )
1963  m_listeners.push_back( aListener );
1964 }
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:1156

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

1910 {
1911  std::vector<BOARD_CONNECTED_ITEM*> items;
1912 
1913  for( PCB_TRACK* track : Tracks() )
1914  items.push_back( track );
1915 
1916  for( FOOTPRINT* footprint : Footprints() )
1917  {
1918  for( PAD* pad : footprint->Pads() )
1919  items.push_back( pad );
1920  }
1921 
1922  for( ZONE* zone : Zones() )
1923  items.push_back( zone );
1924 
1925  return items;
1926 }
ZONES & Zones()
Definition: board.h:239
FOOTPRINTS & Footprints()
Definition: board.h:233
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
Definition: pad.h:57
TRACKS & Tracks()
Definition: board.h:230

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

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

◆ BeginNets()

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

Definition at line 693 of file board.h.

694  {
695  return m_NetInfo.begin();
696  }
NETINFO_LIST m_NetInfo
Definition: board.h:1154
iterator begin() const
Definition: netinfo.h:436

References NETINFO_LIST::begin(), and m_NetInfo.

◆ BuildConnectivity()

void BOARD::BuildConnectivity ( )

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

Definition at line 137 of file board.cpp.

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

References GetConnectivity().

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

◆ BuildListOfNets()

◆ ClassOf()

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

Definition at line 193 of file board.h.

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

References PCB_T, and EDA_ITEM::Type().

◆ ClearAllNetCodes()

void BOARD::ClearAllNetCodes ( )

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

Definition at line 1929 of file board.cpp.

1930 {
1931  for( BOARD_CONNECTED_ITEM* item : AllConnectedItems() )
1932  item->SetNetCode( 0 );
1933 }
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:1909

References AllConnectedItems().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

◆ ClearEditFlags()

◆ ClearFlags()

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

Definition at line 154 of file eda_item.h.

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

References EDA_ITEM::m_flags.

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

◆ ClearProject()

void BOARD::ClearProject ( )

Definition at line 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:1140

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

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

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 166 of file eda_item.h.

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

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

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 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, FP_TEXT, SCH_BUS_BUS_ENTRY, PCB_TRACK, SCH_FIELD, SCH_SHEET_PIN, LIB_FIELD, SCH_BUS_WIRE_ENTRY, FP_SHAPE, PCB_TEXT, SCH_BITMAP, PCB_SHAPE, PCB_GROUP, SCH_JUNCTION, SCH_NO_CONNECT, LIB_TEXT, SCH_MARKER, LIB_SHAPE, PCB_TARGET, and KIGFX::ORIGIN_VIEWITEM.

Definition at line 83 of file eda_item.cpp.

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

References EDA_ITEM::GetClass().

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

◆ ComputeBoundingBox()

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

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

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

Definition at line 1082 of file board.cpp.

1083 {
1084  EDA_RECT area;
1085  LSET visible = GetVisibleLayers();
1086  bool showInvisibleText = IsElementVisible( LAYER_MOD_TEXT_INVISIBLE )
1087  && PgmOrNull() && !PgmOrNull()->m_Printing;
1088 
1089  if( aBoardEdgesOnly )
1090  visible.set( Edge_Cuts );
1091 
1092  // Check shapes, dimensions, texts, and fiducials
1093  for( BOARD_ITEM* item : m_drawings )
1094  {
1095  if( aBoardEdgesOnly && ( item->GetLayer() != Edge_Cuts || item->Type() != PCB_SHAPE_T ) )
1096  continue;
1097 
1098  if( ( item->GetLayerSet() & visible ).any() )
1099  area.Merge( item->GetBoundingBox() );
1100  }
1101 
1102  // Check footprints
1103  for( FOOTPRINT* footprint : m_footprints )
1104  {
1105  if( !( footprint->GetLayerSet() & visible ).any() )
1106  continue;
1107 
1108  if( aBoardEdgesOnly )
1109  {
1110  for( const BOARD_ITEM* edge : footprint->GraphicalItems() )
1111  {
1112  if( edge->GetLayer() == Edge_Cuts && edge->Type() == PCB_FP_SHAPE_T )
1113  area.Merge( edge->GetBoundingBox() );
1114  }
1115  }
1116  else
1117  {
1118  area.Merge( footprint->GetBoundingBox( true, showInvisibleText ) );
1119  }
1120  }
1121 
1122  if( !aBoardEdgesOnly )
1123  {
1124  // Check tracks
1125  for( PCB_TRACK* track : m_tracks )
1126  {
1127  if( ( track->GetLayerSet() & visible ).any() )
1128  area.Merge( track->GetBoundingBox() );
1129  }
1130 
1131  // Check zones
1132  for( ZONE* aZone : m_zones )
1133  {
1134  if( ( aZone->GetLayerSet() & visible ).any() )
1135  area.Merge( aZone->GetBoundingBox() );
1136  }
1137  }
1138 
1139  return area;
1140 }
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:1122
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:504
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:1124
text marked as invisible
Definition: layer_ids.h:196
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
DRAWINGS m_drawings
Definition: board.h:1120
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:1121
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90

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

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

◆ ConvertBrdLayerToPolygonalContours()

void BOARD::ConvertBrdLayerToPolygonalContours ( PCB_LAYER_ID  aLayer,
SHAPE_POLY_SET aOutlines 
) const

Build a set of polygons which are the outlines of copper items (pads, tracks, vias, texts, zones).

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

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

Definition at line 72 of file board_items_to_polygon_shape_transform.cpp.

74 {
75  int maxError = GetDesignSettings().m_MaxError;
76 
77  // convert tracks and vias:
78  for( const PCB_TRACK* track : m_tracks )
79  {
80  if( !track->IsOnLayer( aLayer ) )
81  continue;
82 
83  track->TransformShapeWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
84  ERROR_INSIDE );
85  }
86 
87  // convert pads and other copper items in footprints
88  for( const FOOTPRINT* footprint : m_footprints )
89  {
90  footprint->TransformPadsWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
91  ERROR_INSIDE );
92 
93  // Micro-wave footprints may have items on copper layers
94  footprint->TransformFPShapesWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
96  true, /* include text */
97  true /* include shapes */ );
98 
99  for( const ZONE* zone : footprint->Zones() )
100  {
101  if( zone->GetLayerSet().test( aLayer ) )
102  zone->TransformSolidAreasShapesToPolygon( aLayer, aOutlines );
103  }
104  }
105 
106  // convert copper zones
107  for( const ZONE* zone : Zones() )
108  {
109  if( zone->GetLayerSet().test( aLayer ) )
110  zone->TransformSolidAreasShapesToPolygon( aLayer, aOutlines );
111  }
112 
113  // convert graphic items on copper layers (texts)
114  for( const BOARD_ITEM* item : m_drawings )
115  {
116  if( !item->IsOnLayer( aLayer ) )
117  continue;
118 
119  switch( item->Type() )
120  {
121  case PCB_SHAPE_T:
122  {
123  const PCB_SHAPE* shape = static_cast<const PCB_SHAPE*>( item );
124  shape->TransformShapeWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
125  ERROR_INSIDE );
126  break;
127  }
128 
129  case PCB_TEXT_T:
130  {
131  const PCB_TEXT* text = static_cast<const PCB_TEXT*>( item );
132  text->TransformTextShapeWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
133  ERROR_INSIDE );
134  break;
135  }
136 
137  default:
138  break;
139  }
140  }
141 }
ZONES & Zones()
Definition: board.h:239
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:49
class PCB_TEXT, text on a layer
Definition: typeinfo.h:91
TRACKS m_tracks
Definition: board.h:1122
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:1120
FOOTPRINTS m_footprints
Definition: board.h:1121
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.
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() + ":" + remainder;
996 
997  break;
998  }
999  }
1000  }
1001 
1002  newbuf.append( "${" + token + "}" );
1003  }
1004  else
1005  {
1006  newbuf.append( aSource[i] );
1007  }
1008  }
1009 
1010  return newbuf;
1011 }
FOOTPRINTS & Footprints()
Definition: board.h:233

References Footprints().

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

◆ ConvertKIIDsToCrossReferences()

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

Definition at line 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  token = static_cast<FOOTPRINT*>( refItem )->GetReference() + ":" + remainder;
1045  }
1046 
1047  newbuf.append( "${" + token + "}" );
1048  }
1049  else
1050  {
1051  newbuf.append( aSource[i] );
1052  }
1053  }
1054 
1055  return newbuf;
1056 }
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:113

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

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

◆ Delete()

virtual void BOARD_ITEM_CONTAINER::Delete ( BOARD_ITEM aItem)
inlinevirtualinherited

Removes an item from the container and deletes it.

Definition at line 74 of file board_item_container.h.

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

References BOARD_ITEM_CONTAINER::Remove().

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

◆ DeleteAllFootprints()

void BOARD::DeleteAllFootprints ( )

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

Definition at line 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:1121

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:1119

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:1119

References m_markers.

◆ DeleteStructure()

void BOARD_ITEM::DeleteStructure ( )
inherited

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

Definition at line 126 of file board_item.cpp.

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

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

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

◆ Drawings() [1/2]

◆ Drawings() [2/2]

const DRAWINGS& BOARD::Drawings ( ) const
inline

Definition at line 237 of file board.h.

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

References m_drawings.

◆ Duplicate()

virtual BOARD_ITEM* BOARD_ITEM::Duplicate ( ) const
inlinevirtualinherited

Create a copy of this BOARD_ITEM.

Reimplemented in FOOTPRINT.

Definition at line 169 of file board_item.h.

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

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

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

◆ EndNets()

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

Definition at line 701 of file board.h.

702  {
703  return m_NetInfo.end();
704  }
iterator end() const
Definition: netinfo.h:441
NETINFO_LIST m_NetInfo
Definition: board.h:1154

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:239
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:1123
FOOTPRINTS & Footprints()
Definition: board.h:233
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
MARKERS m_markers
Definition: board.h:1119
const KIID m_Uuid
Definition: eda_item.h:475
Definition: pad.h:57
DRAWINGS & Drawings()
Definition: board.h:236
TRACKS & Tracks()
Definition: board.h:230

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

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

◆ FinalizeBulkAdd()

void BOARD::FinalizeBulkAdd ( std::vector< BOARD_ITEM * > &  aNewItems)

Must be used if Add() is used using a BULK_x ADD_MODE to generate a change event for listeners.

Definition at line 698 of file board.cpp.

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

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

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

◆ FinalizeBulkRemove()

void BOARD::FinalizeBulkRemove ( std::vector< BOARD_ITEM * > &  aRemovedItems)

Must be used if Remove() is used using a BULK_x REMOVE_MODE to generate a change event for listeners.

Definition at line 704 of file board.cpp.

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

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

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

◆ FindFootprintByPath()

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

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

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

Definition at line 1358 of file board.cpp.

1359 {
1360  for( FOOTPRINT* footprint : m_footprints )
1361  {
1362  if( footprint->GetPath() == aPath )
1363  return footprint;
1364  }
1365 
1366  return nullptr;
1367 }
FOOTPRINTS m_footprints
Definition: board.h:1121

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

1347 {
1348  for( FOOTPRINT* footprint : m_footprints )
1349  {
1350  if( aReference == footprint->GetReference() )
1351  return footprint;
1352  }
1353 
1354  return nullptr;
1355 }
FOOTPRINTS m_footprints
Definition: board.h:1121

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

1326 {
1327  // the first valid netcode is 1 and the last is m_NetInfo.GetCount()-1.
1328  // zero is reserved for "no connection" and is not actually a net.
1329  // nullptr is returned for non valid netcodes
1330 
1331  wxASSERT( m_NetInfo.GetNetCount() > 0 );
1332 
1333  if( aNetcode == NETINFO_LIST::UNCONNECTED && m_NetInfo.GetNetCount() == 0 )
1334  return NETINFO_LIST::OrphanedItem();
1335  else
1336  return m_NetInfo.GetNetItem( aNetcode );
1337 }
static NETINFO_ITEM * OrphanedItem()
Wrapper class, so you can iterate through NETINFO_ITEM*s, not std::pair<int/wxString,...
Definition: netinfo.h:373
NETINFO_LIST m_NetInfo
Definition: board.h:1154
unsigned GetNetCount() const
Definition: netinfo.h:339
NETINFO_ITEM * GetNetItem(int aNetCode) const
static const int UNCONNECTED
Constant that forces initialization of a netinfo item to the NETINFO_ITEM ORPHANED (typically -1) whe...
Definition: netinfo.h:365

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

Referenced by PCAD2KICAD::PCB_PAD::AddToFootprint(), CreateSignalsSection(), PNS_PCBNEW_RULE_RESOLVER::DpCoupledNet(), PNS_PCBNEW_RULE_RESOLVER::DpNetPair(), PNS_PCBNEW_RULE_RESOLVER::DpNetPolarity(), PCB_EDIT_FRAME::Edit_Zone_Params(), DIALOG_COPPER_ZONE::ensureSelectedNetIsVisible(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), DSN::SPECCTRA_DB::FromBOARD(), DSN::SPECCTRA_DB::FromSESSION(), BOARD_INSPECTION_TOOL::highlightNet(), 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 1340 of file board.cpp.

1341 {
1342  return m_NetInfo.GetNetItem( aNetname );
1343 }
NETINFO_LIST m_NetInfo
Definition: board.h:1154
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 183 of file board_item.cpp.

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

268  {
269  Flip( wxPoint( aCentre.x, aCentre.y ), aFlipLeftRight );
270  }
virtual void Flip(const wxPoint &aCentre, bool aFlipLeftRight)
Flip this object, i.e.
Definition: board_item.cpp:183

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

◆ Footprints() [1/2]

FOOTPRINTS& BOARD::Footprints ( )
inline

Definition at line 233 of file board.h.

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

References m_footprints.

Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), GERBER_JOBFILE_WRITER::addJSONDesignRules(), RENDER_3D_RAYTRACE::addPadsAndVias(), AllConnectedItems(), PCB_CONTROL::AppendBoard(), AR_AUTOPLACER::AR_AUTOPLACER(), AR_AUTOPLACER::AutoplaceFootprints(), CN_CONNECTIVITY_ALGO::Build(), build_pad_testpoints(), ZONE_FILLER::buildCopperItemClearances(), FROM_TO_CACHE::buildEndpointList(), DIALOG_BOARD_REANNOTATE::BuildFootprintList(), GENDRILL_WRITER_BASE::buildHolesList(), DIALOG_NET_INSPECTOR::buildNetsList(), ZONE_FILLER::buildThermalSpokes(), HYPERLYNX_EXPORTER::collectNetObjects(), ConvertCrossReferencesToKIIDs(), CreateComponentsSection(), BOARD_ADAPTER::createLayers(), PLACEFILE_GERBER_WRITER::CreatePlaceFile(), CreateShapesSection(), CreateSignalsSection(), DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP(), PCB_DRAW_PANEL_GAL::DisplayBoard(), DIALOG_GLOBAL_DELETION::DoGlobalDeletions(), doPushPadProperties(), DRAWING_TOOL::DrawVia(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), PCB_EDIT_FRAME::Export_IDF3(), EXPORTER_PCB_VRML::ExportFp3DModelsAsLinkedFile(), PCB_EDIT_FRAME::ExportToGenCAD(), PCB_EDIT_FRAME::ExportVRML_File(), ZONE_FILLER::Fill(), FillItemMap(), DSN::SPECCTRA_DB::FlipFOOTPRINTs(), DRC_TEST_PROVIDER::forEachGeometryItem(), PCB_IO::format(), RENDER_3D_LEGACY::generateViasAndPads(), PLACE_FILE_EXPORTER::GenPositionData(), PLACE_FILE_EXPORTER::GenReportData(), DIALOG_BOARD_STATISTICS::getDataFromPCB(), PCB_BASE_FRAME::GetFootprintFromBoardByReference(), GetItem(), 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_LEGACY::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::ReannotateDuplicatesInSelection(), RecreateCmpFile(), RENDER_3D_LEGACY::render3dModelsSelected(), BOARD_EDITOR_CONTROL::RepairBoard(), FOOTPRINT_EDITOR_CONTROL::RepairFootprint(), BOARD_INSPECTION_TOOL::reportClearance(), DSN::SPECCTRA_DB::RevertFOOTPRINTs(), DRC_TEST_PROVIDER_HOLE_SIZE::Run(), DRC_TEST_PROVIDER_HOLE_TO_HOLE::Run(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::Run(), PCB_EDIT_FRAME::RunActionPlugin(), DRC_ENGINE::RunTests(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), CLIPBOARD_IO::SaveSelection(), DIALOG_FIND::search(), FOOTPRINT_EDIT_FRAME::SelectFootprintFromBoard(), SetElementVisibility(), ZONE_FILLER::subtractHigherPriorityZones(), PNS_KICAD_IFACE_BASE::SyncWorld(), DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testCourtyardClearances(), DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testFootprintCourtyardDefinitions(), DRC_TEST_PROVIDER_LVS::testFootprints(), TestForExistingItem(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadClearances(), DIALOG_UNUSED_PAD_LAYERS::TransferDataFromWindow(), NETINFO_MAPPING::Update(), BOARD_NETLIST_UPDATER::UpdateNetlist(), HYPERLYNX_EXPORTER::writeDevices(), and HYPERLYNX_EXPORTER::writePadStacks().

◆ Footprints() [2/2]

const FOOTPRINTS& BOARD::Footprints ( ) const
inline

Definition at line 234 of file board.h.

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

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

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

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

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

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:135
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

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

Referenced by 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(), 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(), PCB_TRACK::GetWidthConstraints(), inDiffPair(), insideArea(), insideBackCourtyard(), insideCourtyard(), insideFrontCourtyard(), isInsideArea(), isInsideCourtyard(), 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:135
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

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

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

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

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

1882 {
1883  int chainingEpsilon = Millimeter2iu( 0.02 ); // max dist from one endPt to next startPt
1884 
1885  bool success = BuildBoardPolygonOutlines( this, aOutlines, GetDesignSettings().m_MaxError,
1886  chainingEpsilon, aErrorHandler );
1887 
1888  // Make polygon strictly simple to avoid issues (especially in 3D viewer)
1890 
1891  return success;
1892 }
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(), 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 210 of file board.h.

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

References m_boardUse.

◆ GetBoundingBox()

const EDA_RECT BOARD::GetBoundingBox ( ) const
inlineoverridevirtual

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

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

Reimplemented from EDA_ITEM.

Definition at line 723 of file board.h.

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

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:104

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

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

◆ GetClass()

wxString BOARD::GetClass ( ) const
inlineoverridevirtual

Return the class name.

Implements EDA_ITEM.

Definition at line 798 of file board.h.

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

Referenced by Visit().

◆ GetConnectivity()

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

Return a list of missing connections between components/tracks.

Returns
an object that contains information about missing connections.

Definition at line 344 of file board.h.

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

References m_connectivity.

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

◆ GetCopperLayerCount()

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

Definition at line 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_SWAP_LAYERS::DIALOG_SWAP_LAYERS(), DRAWING_TOOL::DrawVia(), PCB_TRACK::Flip(), PCB_ARC::Flip(), PCB_VIA::Flip(), ZONE::Flip(), DSN::SPECCTRA_DB::FromBOARD(), GetGerberFileFunctionAttribute(), BOARD_ADAPTER::InitSettings(), EAGLE_PLUGIN::Load(), DSN::SPECCTRA_DB::makeIMAGE(), DSN::SPECCTRA_DB::makePADSTACK(), DSN::SPECCTRA_DB::makeVIA(), APPEARANCE_CONTROLS::rebuildLayerContextMenu(), DRC_TEST_PROVIDER_DISALLOW::Run(), ZONE_SETTINGS::SetupLayersList(), PCB_BASE_FRAME::SwitchLayer(), PANEL_SETUP_BOARD_STACKUP::synchronizeWithBoard(), DIALOG_SWAP_LAYERS::TransferDataFromWindow(), DIALOG_SWAP_LAYERS::TransferDataToWindow(), PANEL_SETUP_LAYERS::TransferDataToWindow(), and via_access_code().

◆ GetDesignSettings()

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

Definition at line 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:1152

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(), 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(), PCB_EDIT_FRAME::ExportToGenCAD(), ZONE_FILLER::Fill(), KI_TEST::FillZones(), FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), PCB_IO::formatGeneral(), PCB_IO::formatSetup(), DSN::SPECCTRA_DB::FromBOARD(), DSN::SPECCTRA_DB::FromSESSION(), PCB_BASE_FRAME::GetAuxOrigin(), GetBoardPolygonOutlines(), PCB_MARKER::GetColorLayer(), GetCopperLayerCount(), BOARD_DRC_ITEMS_PROVIDER::GetCount(), VECTOR_DRC_ITEMS_PROVIDER::GetCount(), FOOTPRINT_EDIT_FRAME::GetDesignSettings(), PCB_BASE_FRAME::GetDesignSettings(), BOARD_CONNECTED_ITEM::GetEffectiveNetclass(), 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_TRACK::GetWidthConstraints(), PCB_BASE_FRAME::GetZoneSettings(), GetZoneSettings(), ROUTER_TOOL::handleLayerSwitch(), ALTIUM_PCB::HelperCreateBoardOutline(), PANEL_SETUP_BOARD_FINISH::ImportSettingsFrom(), PANEL_SETUP_CONSTRAINTS::ImportSettingsFrom(), PANEL_SETUP_TEXT_AND_GRAPHICS::ImportSettingsFrom(), PANEL_SETUP_TRACKS_AND_VIAS::ImportSettingsFrom(), PANEL_SETUP_MASK_AND_PASTE::ImportSettingsFrom(), PANEL_SETUP_BOARD_STACKUP::ImportSettingsFrom(), PNS_KICAD_IFACE_BASE::ImportSizes(), DIALOG_PLOT::init_Dialog(), initializePlotter(), BOARD_ADAPTER::InitSettings(), 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(), 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(), PLACE_FILE_EXPORTER::PLACE_FILE_EXPORTER(), BOARD_EDITOR_CONTROL::PlaceTarget(), DIALOG_PLOT::Plot(), PlotOneBoardLayer(), PlotSolderMaskLayer(), PlotStandardLayer(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), PNS_PCBNEW_RULE_RESOLVER::QueryConstraint(), APPEARANCE_CONTROLS::rebuildNets(), PAD_TOOL::recombinePad(), PCB_EDIT_FRAME::RecordDRCExclusions(), DIALOG_PLOT::reInitDialog(), BOARD_INSPECTION_TOOL::reportClearance(), DRC_TOOL::Reset(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::Run(), PCB_BASE_EDIT_FRAME::SetBoard(), SetCopperLayerCount(), SetEnabledLayers(), PCB_BASE_FRAME::SetGridOrigin(), NETINFO_ITEM::SetNetClass(), DIALOG_PLOT::SetPlotFormat(), SetProject(), BOARD_DRC_ITEMS_PROVIDER::SetSeverities(), VECTOR_DRC_ITEMS_PROVIDER::SetSeverities(), PCB_BASE_FRAME::SetZoneSettings(), SetZoneSettings(), APPEARANCE_CONTROLS::showNetclass(), PNS_KICAD_IFACE_BASE::StackupHeight(), SynchronizeNetsAndNetClasses(), PNS_KICAD_IFACE_BASE::syncPad(), PNS_KICAD_IFACE_BASE::syncVia(), PNS_KICAD_IFACE_BASE::SyncWorld(), DRC_TEST_PROVIDER_HOLE_TO_HOLE::testHoleAgainstHole(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZones(), DRC_TEST_PROVIDER_MISC::testOutline(), PANEL_SETUP_RULES::TransferDataFromWindow(), ZONE::TransformSmoothedOutlineToPolygon(), VIA_SIZE_MENU::update(), TRACK_WIDTH_MENU::update(), DIFF_PAIR_MENU::update(), DIALOG_GENDRILL::UpdateDrillParams(), PCB_TRACK::ViewBBox(), FOOTPRINT::ViewBBox(), PCB_MARKER::ViewGetLayers(), WriteDRCReport(), DIALOG_DRC::writeReport(), and HYPERLYNX_EXPORTER::writeStackupInfo().

◆ GetEditFlags()

EDA_ITEM_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 158 of file eda_item.h.

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

References IS_DRAGGING, IS_MOVING, IS_NEW, IS_PASTED, IS_RESIZING, IS_WIRE_IMAGE, EDA_ITEM::m_flags, and STRUCT_DELETED.

Referenced by EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_TOOL::editFieldText(), SYMBOL_EDITOR_PIN_TOOL::EditPinProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), SCH_SYMBOL::GetMsgPanelInfo(), SELECTION_CONDITIONS::Idle(), SELECTION_CONDITIONS::IdleSelection(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PCB_POINT_EDITOR::OnSelectionChange(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), PAD_TOOL::recombinePad(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_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) 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_TARGET, and PCB_MARKER.

Definition at line 167 of file board_item.cpp.

168 {
169  std::shared_ptr<SHAPE> shape;
170 
172 
173  return shape;
174 }
#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(), DRC_RTREE::QueryColliding(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::testAgainstEdge(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZones(), 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(), PCB_IO::formatBoardLayers(), GENDRILL_WRITER_BASE::GenDrillReportFile(), PCB_LAYER_BOX_SELECTOR::getEnabledLayers(), PANEL_SETUP_LAYERS::getNonRemovableLayers(), PANEL_SETUP_LAYERS::getRemovedLayersWithItems(), DIALOG_PLOT::init_Dialog(), DIALOG_EXPORT_SVG::initDialog(), HYPERLYNX_PAD_STACK::isEmpty(), BOARD_ITEM::layerMaskDescribe(), PANEL_SETUP_BOARD_STACKUP::PANEL_SETUP_BOARD_STACKUP(), DIALOG_PLOT::Plot(), APPEARANCE_CONTROLS::rebuildLayers(), CADSTAR_PCB_ARCHIVE_LOADER::remapUnsureLayers(), DRC_TEST_PROVIDER_MISC::testDisabledLayers(), PANEL_SETUP_LAYERS::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow(), DIALOG_PRINT_PCBNEW::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow(), PANEL_SETUP_LAYERS::TransferDataToWindow(), PCB_EDIT_FRAME::UpdateUserInterface(), PCB_VIA::ViewGetLOD(), PAD::ViewGetLOD(), and HYPERLYNX_EXPORTER::writeSinglePadStack().

◆ GetFileFormatVersionAtLoad()

int BOARD::GetFileFormatVersionAtLoad ( ) const
inline

Definition at line 289 of file board.h.

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

References m_fileFormatVersionAtLoad.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ GetFileName()

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

Definition at line 228 of file board.h.

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

References m_fileName.

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

◆ GetFirstFootprint()

FOOTPRINT* BOARD::GetFirstFootprint ( ) const
inline

Get the first footprint on the board or nullptr.

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

Returns
first footprint or null pointer

Definition at line 317 of file board.h.

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

References m_footprints.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), BuildFootprintPolygonOutlines(), 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(), 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 279 of file board.h.

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

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

◆ GetFootprint()

FOOTPRINT * BOARD::GetFootprint ( const wxPoint &  aPosition,
PCB_LAYER_ID  aActiveLayer,
bool  aVisibleOnly,
bool  aIgnoreLocked = false 
) const

Get a footprint by its bounding rectangle at aPosition on aLayer.

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

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

Definition at line 1723 of file board.cpp.

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

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

◆ GetGenerator()

const wxString& BOARD::GetGenerator ( ) const
inline

Definition at line 292 of file board.h.

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

References m_generator.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ GetHighLightNetCodes()

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

Definition at line 386 of file board.h.

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

References m_highLight, and HIGH_LIGHT_INFO::m_netCodes.

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

◆ GetItem()

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

Definition at line 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:239
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:1123
static DELETED_BOARD_ITEM * GetInstance()
Definition: board_item.h:351
FOOTPRINTS & Footprints()
Definition: board.h:233
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
MARKERS m_markers
Definition: board.h:1119
const KIID m_Uuid
Definition: eda_item.h:475
Definition: pad.h:57
DRAWINGS & Drawings()
Definition: board.h:236
TRACKS & Tracks()
Definition: board.h:230

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

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

◆ GetLayer()

virtual PCB_LAYER_ID BOARD_ITEM::GetLayer ( ) const
inlinevirtualinherited

Return the primary layer this item is on.

Reimplemented in ZONE.

Definition at line 140 of file board_item.h.

140 { return m_layer; }
PCB_LAYER_ID m_layer
Definition: board_item.h:316

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(), PCB_BASE_FRAME::FocusOnItem(), FOOTPRINT_DESC::FOOTPRINT_DESC(), PCB_IO::FootprintSave(), FootprintWriteShape(), PCB_IO::format(), PCB_IO::formatLayer(), FP_TEXT::FP_TEXT(), DSN::SPECCTRA_DB::FromBOARD(), AR_AUTOPLACER::genModuleOnRoutingMatrix(), FOOTPRINT::GetBoundingBox(), ZONE::GetLayer(), getMatchingTextItem(), PCB_TRACK::GetMsgPanelInfo(), PCB_VIA::GetMsgPanelInfo(), PAD::GetMsgPanelInfo(), AR_AUTOPLACER::getOptimalFPPlacement(), GetPad(), PCB_TRACK::GetWidthConstraints(), PCB_SELECTION_TOOL::GuessSelectionCandidates(), idf_export_footprint(), GENERAL_COLLECTOR::Inspect(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), BOARD_INSPECTION_TOOL::InspectDRCError(), isEdge(), PAD::IsFlipped(), FOOTPRINT::IsFlipped(), PNS_KICAD_IFACE::IsItemVisible(), BOARD_ITEM::IsOnCopperLayer(), FP_SHAPE::IsParentFlipped(), FP_TEXT::IsParentFlipped(), itemIsIncludedByFilter(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromShapes(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_PROPERTIES::OnAddField(), DIALOG_FOOTPRINT_CHECKER::OnSelectItem(), PCB_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(), CLIPBOARD_IO::SaveSelection(), CONVERT_TOOL::SegmentToArc(), PCB_SELECTION_TOOL::Selectable(), GLOBAL_EDIT_TOOL::swapBoardItem(), PNS_KICAD_IFACE_BASE::syncArc(), PNS_KICAD_IFACE_BASE::syncGraphicalItem(), PNS_KICAD_IFACE_BASE::syncTrack(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::testAgainstEdge(), AR_AUTOPLACER::testFootprintOnBoard(), 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:1126
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:905
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition: board.h:605

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

◆ GetLayerName() [1/2]

wxString BOARD_ITEM::GetLayerName ( ) const
inherited

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

Returns
the layer name associated with this item.

Definition at line 73 of file board_item.cpp.

74 {
75  const BOARD* board = GetBoard();
76 
77  if( board )
78  return board->GetLayerName( m_layer );
79 
80  // If no parent, return standard name
82 }
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:190
PCB_LAYER_ID m_layer
Definition: board_item.h:316
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:605

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

Referenced by PCB_TARGET::GetMsgPanelInfo(), PCB_TEXT::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:1126
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:605

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

Referenced by GERBER_JOBFILE_WRITER::addJSONMaterialStackup(), DSN::SPECCTRA_DB::buildLayerMaps(), PANEL_SETUP_BOARD_STACKUP::createRowData(), PANEL_PCBNEW_COLOR_SETTINGS::createSwatches(), GRID_CELL_LAYER_RENDERER::Draw(), DRAWING_TOOL::DrawSpecificationStackup(), PCB_IO::formatBoardLayers(), GENDRILL_WRITER_BASE::GenDrillReportFile(), PCB_LAYER_SELECTOR::getLayerName(), PCB_LAYER_BOX_SELECTOR::getLayerName(), BOARD_ITEM::GetLayerName(), ZONE::GetMsgPanelInfo(), ZONE::GetSelectMenuText(), GRID_CELL_LAYER_SELECTOR::GetValue(), DIALOG_PLOT::init_Dialog(), DIALOG_EXPORT_SVG::initDialog(), DIALOG_PAD_PROPERTIES::initValues(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectDRCError(), BOARD_ITEM::layerMaskDescribe(), PCB_VIA::layerMaskDescribe(), 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:110
LAYER m_layers[PCB_LAYER_ID_COUNT]
Definition: board.h:1126
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:796

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

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

◆ GetMenuImage()

BITMAPS EDA_ITEM::GetMenuImage ( ) const
virtualinherited

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, LIB_PIN, FP_TEXT, SCH_LINE, SCH_BUS_BUS_ENTRY, PCB_TRACK, PCB_GROUP, SCH_FIELD, SCH_SHEET_PIN, LIB_FIELD, SCH_BUS_WIRE_ENTRY, FP_SHAPE, PCB_TEXT, PCB_SHAPE, SCH_BITMAP, LIB_TEXT, LIB_SHAPE, SCH_NO_CONNECT, SCH_MARKER, PCB_MARKER, PCB_TARGET, and SCH_JUNCTION.

Definition at line 211 of file eda_item.cpp.

212 {
213  return BITMAPS::dummy_item;
214 }

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

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

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

References m_NetInfo.

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

◆ GetNetCount()

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

Definition at line 710 of file board.h.

711  {
712  return m_NetInfo.GetNetCount();
713  }
NETINFO_LIST m_NetInfo
Definition: board.h:1154
unsigned GetNetCount() const
Definition: netinfo.h:339

References NETINFO_LIST::GetNetCount(), and m_NetInfo.

Referenced by CreateSignalsSection().

◆ GetNetInfo() [1/2]

◆ GetNetInfo() [2/2]

NETINFO_LIST& BOARD::GetNetInfo ( )
inline

Definition at line 684 of file board.h.

685  {
686  return m_NetInfo;
687  }
NETINFO_LIST m_NetInfo
Definition: board.h:1154

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

1060 {
1061  unsigned retval = 0;
1062 
1063  for( FOOTPRINT* footprint : Footprints() )
1064  {
1065  for( PAD* pad : footprint->Pads() )
1066  {
1067  if( ( aNet == -1 && pad->GetNetCode() > 0 ) || aNet == pad->GetNetCode() )
1068  retval++;
1069  }
1070  }
1071 
1072  return retval;
1073 }
FOOTPRINTS & Footprints()
Definition: board.h:233
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 1458 of file board.cpp.

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

910  {
911  return GetPad( aPosition, LSET().set() );
912  }
PAD * GetPad(const wxPoint &aPosition, LSET aLayerMask) const
Find a pad aPosition on aLayer.
Definition: board.cpp:1458
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:504

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

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

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

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

1489 {
1490  for( FOOTPRINT* footprint : Footprints() )
1491  {
1492  for( PAD* pad : footprint->Pads() )
1493  {
1494  if( pad->GetPosition() != aPosition )
1495  continue;
1496 
1497  // Pad found, it must be on the correct layer
1498  if( ( pad->GetLayerSet() & aLayerSet ).any() )
1499  return pad;
1500  }
1501  }
1502 
1503  return nullptr;
1504 }
FOOTPRINTS & Footprints()
Definition: board.h:233
Definition: pad.h:57

References Footprints(), and pad.

◆ GetPads()

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

Return a reference to a list of all the pads.

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

Returns
a full list of pads.

Definition at line 1895 of file board.cpp.

1896 {
1897  std::vector<PAD*> allPads;
1898 
1899  for( FOOTPRINT* footprint : Footprints() )
1900  {
1901  for( PAD* pad : footprint->Pads() )
1902  allPads.push_back( pad );
1903  }
1904 
1905  return allPads;
1906 }
FOOTPRINTS & Footprints()
Definition: board.h:233
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 135 of file board_item.h.

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

References EDA_ITEM::m_parent.

Referenced by PCB_POINT_EDITOR::addCorner(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), PNS_KICAD_IFACE::Commit(), EDIT_TOOL::copyToClipboard(), FOOTPRINT::CoverageRatio(), BOARD_ITEM::DeleteStructure(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::Drag(), EDIT_TOOL::DragArcTrack(), KIGFX::PCB_PAINTER::draw(), EDIT_TOOL::Duplicate(), PCB_SELECTION_TOOL::FilterCollectorForHierarchy(), PCB_IO::format(), FormatProbeItem(), BOARD_ITEM::GetBoard(), PCB_MARKER::GetColorLayer(), ALIGN_DISTRIBUTE_TOOL::GetSelections(), FP_TEXT::GetSelectMenuText(), PCB_TEXT::GetShownText(), FP_TEXT::GetShownText(), getTopLevelGroup(), 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().

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

PROJECT* BOARD::GetProject ( ) const
inline

◆ GetProperties()

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

Definition at line 258 of file board.h.

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

References m_properties.

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

◆ GetSelectMenuText()

wxString BOARD::GetSelectMenuText ( EDA_UNITS  aUnits) const
overridevirtual

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

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

Returns
The menu text string.

Reimplemented from EDA_ITEM.

Definition at line 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 1615 of file board.cpp.

1616 {
1617  for( FOOTPRINT* footprint : Footprints() )
1618  {
1619  for( PAD* pad : footprint->Pads( ) )
1620  {
1621  if( aNetCode < 0 || pad->GetNetCode() == aNetCode )
1622  aVector.push_back( pad );
1623  }
1624  }
1625 
1626  std::sort( aVector.begin(), aVector.end(), sortPadsByXthenYCoord );
1627 }
bool sortPadsByXthenYCoord(PAD *const &aLH, PAD *const &aRH)
Used by #GetSortedPadListByXCoord to sort a pad list by X coordinate value.
Definition: board.cpp:1606
FOOTPRINTS & Footprints()
Definition: board.h:233
Definition: pad.h:57

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

◆ GetStandardLayerName()

static wxString BOARD::GetStandardLayerName ( PCB_LAYER_ID  aLayerId)
inlinestatic

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

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

Parameters
aLayerIdis the layer identifier (index) to fetch.
Returns
a string containing the layer name or "BAD INDEX" if aLayerId is not legal.

Definition at line 605 of file board.h.

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

References LayerName().

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

◆ GetState()

int EDA_ITEM::GetState ( EDA_ITEM_FLAGS  type) const
inlineinherited

Definition at line 137 of file eda_item.h.

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

References EDA_ITEM::m_status.

Referenced by BOARD_ITEM::IsLocked().

◆ GetStatus()

EDA_ITEM_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 150 of file eda_item.h.

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

References EDA_ITEM::m_status.

◆ GetTimeStamp()

int BOARD::GetTimeStamp ( ) const
inline

Definition at line 214 of file board.h.

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

References m_timeStamp.

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

◆ GetTitleBlock() [1/2]

TITLE_BLOCK& BOARD::GetTitleBlock ( )
inline

◆ GetTitleBlock() [2/2]

const TITLE_BLOCK& BOARD::GetTitleBlock ( ) const
inline

Definition at line 542 of file board.h.

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

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

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

1077 {
1078  return m_connectivity->GetUnconnectedCount();
1079 }
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: board.h:1135

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:279
GAL_SET & set()
Definition: layer_ids.h:295
PROJECT * m_project
Definition: board.h:1140

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

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

◆ GetVisibleLayers()

LSET BOARD::GetVisibleLayers ( ) const

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

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

References m_footprints, and Zones().

◆ GetZoneSettings()

const ZONE_SETTINGS & BOARD::GetZoneSettings ( ) const
overridevirtual

Fetch the zone settings for this container.

Reimplemented from BOARD_ITEM_CONTAINER.

Definition at line 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 2102 of file board.cpp.

2103 {
2104  bool hasGroup = false;
2105  bool hasMember = false;
2106 
2107  for( EDA_ITEM* item : selection )
2108  {
2109  if( item->Type() == PCB_GROUP_T )
2110  hasGroup = true;
2111 
2112  if( static_cast<BOARD_ITEM*>( item )->GetParentGroup() )
2113  hasMember = true;
2114  }
2115 
2116  GroupLegalOpsField legalOps;
2117 
2118  legalOps.create = true;
2119  legalOps.removeItems = hasMember;
2120  legalOps.ungroup = hasGroup;
2121  legalOps.enter = hasGroup && selection.Size() == 1;
2122 
2123  return legalOps;
2124 }
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:108
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100

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

◆ Groups() [1/2]

GROUPS& BOARD::Groups ( )
inline

The groups must maintain the following invariants.

These are checked by GroupsSanityCheck():

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

Definition at line 253 of file board.h.

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

References m_groups.

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

◆ Groups() [2/2]

const GROUPS& BOARD::Groups ( ) const
inline

Definition at line 254 of file board.h.

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

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

2024 {
2025  if( repair )
2026  {
2027  while( GroupsSanityCheckInternal( repair ) != wxEmptyString )
2028  {};
2029 
2030  return wxEmptyString;
2031  }
2032  return GroupsSanityCheckInternal( repair );
2033 }
wxString GroupsSanityCheckInternal(bool repair)
Definition: board.cpp:2036

References GroupsSanityCheckInternal().

Referenced by PCB_IO::Save().

◆ GroupsSanityCheckInternal()

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

Definition at line 2036 of file board.cpp.

2037 {
2038  // Cycle detection
2039  //
2040  // Each group has at most one parent group.
2041  // So we start at group 0 and traverse the parent chain, marking groups seen along the way.
2042  // If we ever see a group that we've already marked, that's a cycle.
2043  // If we reach the end of the chain, we know all groups in that chain are not part of any cycle.
2044  //
2045  // Algorithm below is linear in the # of groups because each group is visited only once.
2046  // There may be extra time taken due to the container access calls and iterators.
2047  //
2048  // Groups we know are cycle free
2049  std::unordered_set<PCB_GROUP*> knownCycleFreeGroups;
2050  // Groups in the current chain we're exploring.
2051  std::unordered_set<PCB_GROUP*> currentChainGroups;
2052  // Groups we haven't checked yet.
2053  std::unordered_set<PCB_GROUP*> toCheckGroups;
2054 
2055  // Initialize set of groups to check that could participate in a cycle.
2056  for( PCB_GROUP* group : Groups() )
2057  toCheckGroups.insert( group);
2058 
2059  while( !toCheckGroups.empty() )
2060  {
2061  currentChainGroups.clear();
2062  PCB_GROUP* group = *toCheckGroups.begin();
2063 
2064  while( true )
2065  {
2066  if( currentChainGroups.find( group ) != currentChainGroups.end() )
2067  {
2068  if( repair )
2069  Remove( group );
2070 
2071  return "Cycle detected in group membership";
2072  }
2073  else if( knownCycleFreeGroups.find( group ) != knownCycleFreeGroups.end() )
2074  {
2075  // Parent is a group we know does not lead to a cycle
2076  break;
2077  }
2078 
2079  currentChainGroups.insert( group );
2080  // We haven't visited currIdx yet, so it must be in toCheckGroups
2081  toCheckGroups.erase( group );
2082 
2083  group = group->GetParentGroup();
2084 
2085  if( !group )
2086  {
2087  // end of chain and no cycles found in this chain
2088  break;
2089  }
2090  }
2091 
2092  // No cycles found in chain, so add it to set of groups we know don't participate
2093  // in a cycle.
2094  knownCycleFreeGroups.insert( currentChainGroups.begin(), currentChainGroups.end() );
2095  }
2096 
2097  // Success
2098  return "";
2099 }
GROUPS & Groups()
The groups must maintain the following invariants.
Definition: board.h:253
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:50
void Remove(BOARD_ITEM *aBoardItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
Removes an item from the container.
Definition: board.cpp:710

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

Referenced by GroupsSanityCheck().

◆ HasFlag()

◆ HighLightOFF()

void BOARD::HighLightOFF ( )
inline

Disable net highlight.

Definition at line 416 of file board.h.

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

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

2014 {
2015  if( m_highLight.m_highLightOn != aValue )
2016  {
2017  m_highLight.m_highLightOn = aValue;
2019  }
2020 }
void InvokeListeners(Func &&aFunc, Args &&... args)
Definition: board.h:1106
HIGH_LIGHT_INFO m_highLight
Definition: board.h:1128
bool m_highLightOn
Definition: board.h:138
virtual void OnBoardHighlightNetChanged(BOARD &aBoard)
Definition: board.h:173

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

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

◆ HitTest() [1/2]

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

◆ HitTest() [2/2]

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

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

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

Reimplemented in SCH_SYMBOL, PAD, ZONE, FOOTPRINT, PCB_VIA, SCH_GLOBALLABEL, SCH_SHEET, DS_DRAW_ITEM_BITMAP, DS_DRAW_ITEM_TEXT, PCB_ARC, SCH_TEXT, PCB_DIMENSION_BASE, DS_DRAW_ITEM_RECT, SCH_LINE, GERBER_DRAW_ITEM, FP_TEXT, SCH_FIELD, PCB_TRACK, DS_DRAW_ITEM_POLYPOLYGONS, LIB_ITEM, LIB_PIN, PCB_GROUP, SCH_BITMAP, PCB_TEXT, SCH_JUNCTION, PCB_SHAPE, SCH_NO_CONNECT, SCH_BUS_ENTRY_BASE, DS_DRAW_ITEM_BASE, PCB_TARGET, LIB_TEXT, and LIB_SHAPE.

Definition at line 238 of file eda_item.h.

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

◆ IncrementTimeStamp()

void BOARD::IncrementTimeStamp ( )

Definition at line 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:1090
std::mutex m_CachesMutex
Definition: board.h:1089
std::map< wxString, LSET > m_LayerExpressionCache
Definition: board.h:1094
std::map< ZONE *, std::unique_ptr< DRC_RTREE > > m_CopperZoneRTrees
Definition: board.h:1096
std::map< std::pair< BOARD_ITEM *, BOARD_ITEM * >, bool > m_InsideBCourtyardCache
Definition: board.h:1092
std::map< std::pair< BOARD_ITEM *, BOARD_ITEM * >, bool > m_InsideAreaCache
Definition: board.h:1093
int m_timeStamp
Definition: board.h:1116
std::map< std::pair< BOARD_ITEM *, BOARD_ITEM * >, bool > m_InsideFCourtyardCache
Definition: board.h:1091

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

1107  {
1108  for( auto&& l : m_listeners )
1109  ( l->*aFunc )( std::forward<Args>( args )... );
1110  }
std::vector< BOARD_LISTENER * > m_listeners
Definition: board.h:1156

References m_listeners.

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

◆ IsBrightened()

◆ IsConnected()

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 121 of file eda_item.h.

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

References IS_DRAGGING, and EDA_ITEM::m_flags.

Referenced by DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES().

◆ IsElementVisible()

bool BOARD::IsElementVisible ( GAL_LAYER_ID  aLayer) const

Test whether a given element category is visible.

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

Definition at line 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:1140

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

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

◆ IsEmpty()

bool BOARD::IsEmpty ( ) const
inline

Definition at line 281 of file board.h.

282  {
283  return m_drawings.empty() && m_footprints.empty() && m_tracks.empty() && m_zones.empty();
284  }
TRACKS m_tracks
Definition: board.h:1122
ZONES m_zones
Definition: board.h:1124
DRAWINGS m_drawings
Definition: board.h:1120
FOOTPRINTS m_footprints
Definition: board.h:1121

References m_drawings, m_footprints, m_tracks, and m_zones.

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

◆ IsEntered()

bool EDA_ITEM::IsEntered ( ) const
inlineinherited

Definition at line 124 of file eda_item.h.

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

References ENTERED, and EDA_ITEM::m_flags.

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

◆ IsFootprintHolder()

bool BOARD::IsFootprintHolder ( ) const
inline

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

Returns
if the board is just holding a footprint

Definition at line 221 of file board.h.

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

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:205
show footprints on front
Definition: layer_ids.h:204
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 206 of file eda_item.h.

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

References EDA_ITEM::m_forceVisible.

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

◆ IsHighLightNetON()

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

Definition at line 402 of file board.h.

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

References m_highLight, and HIGH_LIGHT_INFO::m_highLightOn.

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

◆ IsLayerEnabled()

bool BOARD::IsLayerEnabled ( PCB_LAYER_ID  aLayer) const

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

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

Definition at line 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:1140

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

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

◆ IsLocked()

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

Reimplemented in FOOTPRINT, and PAD.

Definition at line 64 of file board_item.cpp.

65 {
66  if( GetParentGroup() )
67  return GetParentGroup()->IsLocked();
68 
69  return GetState( LOCKED );
70 }
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:137

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

Referenced by BOARD_ITEM_DESC::BOARD_ITEM_DESC(), PCB_CONTROL::DeleteItemCursor(), DIALOG_GROUP_PROPERTIES::DIALOG_GROUP_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), EDIT_TOOL::FilletTracks(), PCB_IO::format(), PCB_TEXT::GetMsgPanelInfo(), 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 118 of file eda_item.h.

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

References IS_CHANGED, and EDA_ITEM::m_flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsNew()

◆ IsOnCopperLayer()

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

Reimplemented in PAD, PCB_TRACK, and ZONE.

Definition at line 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:796
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:140

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

199  {
200  return m_layer == aLayer;
201  }
PCB_LAYER_ID m_layer
Definition: board_item.h:316

References BOARD_ITEM::m_layer.

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

◆ IsReplaceable()

virtual bool EDA_ITEM::IsReplaceable ( ) const
inlinevirtualinherited

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

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

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

Definition at line 403 of file eda_item.h.

403 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 125 of file eda_item.h.

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

References IS_RESIZING, and EDA_ITEM::m_flags.

◆ IsSelected()

bool EDA_ITEM::IsSelected ( ) const
inlineinherited

Definition at line 123 of file eda_item.h.

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

References EDA_ITEM::m_flags, and SELECTED.

Referenced by ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), SCH_EDIT_FRAME::ConvertPart(), DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), DS_PROXY_UNDO_ITEM::DS_PROXY_UNDO_ITEM(), KIGFX::DS_RENDER_SETTINGS::GetColor(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), SCH_MOVE_TOOL::getConnectedDragItems(), KIGFX::SCH_PAINTER::getLineWidth(), KIGFX::SCH_PAINTER::getRenderColor(), KIGFX::SCH_PAINTER::getTextThickness(), DIALOG_EXCHANGE_FOOTPRINTS::isMatch(), DIALOG_CHANGE_SYMBOLS::isMatch(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), EE_SELECTION_TOOL::RebuildSelection(), RENDER_3D_LEGACY::renderFootprint(), SCH_EDIT_TOOL::Rotate(), EE_TOOL_BASE< SCH_BASE_FRAME >::saveCopyInUndoList(), SCH_EDIT_FRAME::SchematicCleanUp(), GERBVIEW_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), KIGFX::SCH_PAINTER::setDeviceColors(), 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 208 of file board_item.h.

209  {
210  return ( Type() == PCB_TRACE_T ) || ( Type() == PCB_VIA_T );
211  }
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

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

◆ IsType()

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

Check whether the item is one of the listed types.

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

Reimplemented in PCB_VIA, SCH_LABEL, PCB_DIMENSION_BASE, PAD, SCH_FIELD, FP_TEXT, SCH_LINE, PCB_SHAPE, FP_SHAPE, and PCB_TEXT.

Definition at line 183 of file eda_item.h.

184  {
185  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
186  return true;
187 
188  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
189  {
190  if( m_structType == *p )
191  return true;
192  }
193 
194  return false;
195  }
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
KICAD_T m_structType
Run time identification, keep private so it can never be changed after a ctor sets it.
Definition: eda_item.h:488

References EOT, EDA_ITEM::m_structType, and SCH_LOCATE_ANY_T.

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

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 122 of file eda_item.h.

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

References IS_WIRE_IMAGE, and EDA_ITEM::m_flags.

◆ IterateForward() [1/2]

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

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

Definition at line 295 of file eda_item.h.

299  {
300  for( auto it : aList )
301  {
302  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
304  return SEARCH_RESULT::QUIT;
305  }
306 
308  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:93

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

Referenced by GERBER_FILE_IMAGE::Visit().

◆ IterateForward() [2/2]

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

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

Definition at line 314 of file eda_item.h.

316  {
317  for( auto it : aList )
318  {
319  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
321  return SEARCH_RESULT::QUIT;
322  }
323 
325  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:93

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

◆ layerMaskDescribe()

wxString BOARD_ITEM::layerMaskDescribe ( ) const
protectedvirtualinherited

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

The BOARD is needed because layer names are customizable.

Reimplemented in PCB_VIA.

Definition at line 85 of file board_item.cpp.

86 {
87  const BOARD* board = GetBoard();
88  LSET layers = GetLayerSet();
89 
90  // Try to be smart and useful. Check all copper first.
91  if( layers[F_Cu] && layers[B_Cu] )
92  return _( "all copper layers" );
93 
94  LSET copperLayers = layers & board->GetEnabledLayers().AllCuMask();
95  LSET techLayers = layers & board->GetEnabledLayers().AllTechMask();
96 
97  for( LSET testLayers : { copperLayers, techLayers, layers } )
98  {
99  for( int bit = PCBNEW_LAYER_ID_START; bit < PCB_LAYER_ID_COUNT; ++bit )
100  {
101  if( testLayers[ bit ] )
102  {
103  wxString layerInfo = board->GetLayerName( static_cast<PCB_LAYER_ID>( bit ) );
104 
105  if( testLayers.count() > 1 )
106  layerInfo << wxS( " " ) + _( "and others" );
107 
108  return layerInfo;
109  }
110  }
111  }
112 
113  // No copper, no technicals: no layer
114  return _( "no layers" );
115 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:750
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp: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:820
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:504
#define _(s)
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
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:145

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

1937 {
1938  for( BOARD_CONNECTED_ITEM* item : AllConnectedItems() )
1939  {
1940  NETINFO_ITEM* netInfo = aDestBoard->FindNet( item->GetNetname() );
1941 
1942  if( netInfo )
1943  item->SetNet( netInfo );
1944  else
1945  item->SetNetCode( 0 );
1946  }
1947 }
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition: board.cpp:1325
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:1909
void SetNetCode(int aNetCode)
Definition: netinfo.h:114
Handle the data for a net.
Definition: netinfo.h:64

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

◆ Markers() [1/2]

◆ Markers() [2/2]

const MARKERS& BOARD::Markers ( ) const
inline

Definition at line 243 of file board.h.

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

References m_markers.

◆ Matches() [1/2]

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

Compare the item against the search criteria in aSearchData.

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

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

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

Definition at line 365 of file eda_item.h.

366  {
367  return false;
368  }

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

◆ Matches() [2/2]

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

Compare aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

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

Definition at line 118 of file eda_it