KiCad PCB EDA Suite
BOARD Class Reference

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

#include <board.h>

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

Classes

struct  GroupLegalOpsField
 

Public Member Functions

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

Static Public Member Functions

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

Public Attributes

LSET m_LegacyVisibleLayers
 Visibility settings stored in board prior to 6.0, only used for loading legacy files. More...
 
GAL_SET m_LegacyVisibleItems
 
bool m_LegacyDesignSettingsLoaded
 True if the legacy board design settings were loaded from a file. More...
 
bool m_LegacyCopperEdgeClearanceLoaded
 
bool m_LegacyNetclassesLoaded
 True if netclasses were loaded from the file. More...
 
const KIID m_Uuid
 

Static Public Attributes

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

Protected Member Functions

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

Protected Attributes

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

Private Member Functions

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

Private Attributes

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

Friends

class PCB_EDIT_FRAME
 

Detailed Description

Information pertinent to a Pcbnew printed circuit board.

Definition at line 189 of file board.h.

Constructor & Destructor Documentation

◆ BOARD() [1/2]

BOARD::BOARD ( const BOARD aOther)
privatedelete

◆ BOARD() [2/2]

BOARD::BOARD ( )

Definition at line 61 of file board.cpp.

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

References _, 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, PCB_LAYER_ID_COUNT, Rescue, GAL_SET::set(), NETCLASS::SetDescription(), ToLAYER_ID(), and BOARD_DESIGN_SETTINGS::UseCustomTrackViaSize().

◆ ~BOARD()

BOARD::~BOARD ( )

Definition at line 102 of file board.cpp.

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

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

Member Function Documentation

◆ Add()

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

Adds an item to the container.

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

Implements BOARD_ITEM_CONTAINER.

Definition at line 563 of file board.cpp.

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

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

Referenced by NET_SELECTOR_COMBOPOPUP::Accept(), PCB_BASE_FRAME::AddFootprintToBoard(), PCAD2KICAD::PCB_TEXT::AddToBoard(), PCAD2KICAD::PCB_ARC::AddToBoard(), PCAD2KICAD::PCB_LINE::AddToBoard(), PCAD2KICAD::PCB_PAD::AddToBoard(), PCAD2KICAD::PCB_FOOTPRINT::AddToBoard(), PCAD2KICAD::PCB::AddToBoard(), PCAD2KICAD::PCB_POLYGON::AddToBoard(), PCAD2KICAD::PCB_PAD::AddToFootprint(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), DSN::SPECCTRA_DB::FromSESSION(), GROUP_TOOL::Group(), ALTIUM_PCB::HelperCreateAndAddDrawsegment(), ALTIUM_PCB::HelperCreateBoardOutline(), ALTIUM_PCB::HelperParseDimensions6Center(), ALTIUM_PCB::HelperParseDimensions6Datum(), ALTIUM_PCB::HelperParseDimensions6Leader(), ALTIUM_PCB::HelperParseDimensions6Linear(), DISPLAY_FOOTPRINTS_FRAME::InitDisplay(), LEGACY_PLUGIN::loadAllSections(), LoadBoard(), LEGACY_PLUGIN::loadDIMENSION(), EAGLE_PLUGIN::loadElements(), FABMASTER::loadEtch(), FABMASTER::loadFootprints(), FABMASTER::loadGraphics(), LEGACY_PLUGIN::loadNETINFO_ITEM(), FABMASTER::loadNets(), 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(), LEGACY_PLUGIN::loadTrackList(), FABMASTER::loadVias(), FABMASTER::loadZone(), LEGACY_PLUGIN::loadZONE_CONTAINER(), DIALOG_NET_INSPECTOR::onAddNet(), PANEL_PREV_3D::PANEL_PREV_3D(), ALTIUM_PCB::ParseArcs6Data(), ALTIUM_PCB::ParseComponents6Data(), ALTIUM_PCB::ParseFills6Data(), ALTIUM_PCB::ParseNets6Data(), ALTIUM_PCB::ParsePads6Data(), ALTIUM_PCB::ParsePolygons6Data(), ALTIUM_PCB::ParseShapeBasedRegions6Data(), ALTIUM_PCB::ParseTexts6Data(), ALTIUM_PCB::ParseTracks6Data(), ALTIUM_PCB::ParseVias6Data(), BOARD_COMMIT::Push(), FOOTPRINT_WIZARD_FRAME::ReloadFootprint(), BOARD_EDITOR_CONTROL::RepairBoard(), BOARD_COMMIT::Revert(), DIALOG_FOOTPRINT_CHECKER::runChecks(), and FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint().

◆ AddArea()

ZONE * BOARD::AddArea ( PICKED_ITEMS_LIST aNewZonesList,
int  aNetcode,
PCB_LAYER_ID  aLayer,
wxPoint  aStartPointPosition,
ZONE_BORDER_DISPLAY_STYLE  aHatch 
)

Add an empty copper area to board areas list.

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

Definition at line 1782 of file board.cpp.

1784 {
1785  ZONE* new_area = new ZONE( this );
1786 
1787  new_area->SetNetCode( aNetcode );
1788  new_area->SetLayer( aLayer );
1789 
1790  m_zones.push_back( new_area );
1791 
1792  new_area->SetHatchStyle( (ZONE_BORDER_DISPLAY_STYLE) aHatch );
1793 
1794  // Add the first corner to the new zone
1795  new_area->AppendCorner( aStartPointPosition, -1 );
1796 
1797  if( aNewZonesList )
1798  {
1799  ITEM_PICKER picker( nullptr, new_area, UNDO_REDO::NEWITEM );
1800  aNewZonesList->PushItem( picker );
1801  }
1802 
1803  return new_area;
1804 }
void SetHatchStyle(ZONE_BORDER_DISPLAY_STYLE aStyle)
Definition: zone.h:621
bool SetNetCode(int aNetCode, bool aNoAssert)
Sets 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:203
ZONE handles a list of polygons defining a copper zone.
Definition: zone.h:57
bool AppendCorner(wxPoint aPosition, int aHoleIdx, bool aAllowDuplication=false)
Add a new corner to the zone outline (to the main outline or a hole)
Definition: zone.cpp:832
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:235

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

1947 {
1948  if( !alg::contains( m_listeners, aListener ) )
1949  m_listeners.push_back( aListener );
1950 }
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition: kicad_algo.h:81
std::vector< BOARD_LISTENER * > m_listeners
Definition: board.h:234

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

1896 {
1897  std::vector<BOARD_CONNECTED_ITEM*> items;
1898 
1899  for( TRACK* track : Tracks() )
1900  items.push_back( track );
1901 
1902  for( FOOTPRINT* footprint : Footprints() )
1903  {
1904  for( PAD* pad : footprint->Pads() )
1905  items.push_back( pad );
1906  }
1907 
1908  for( ZONE* zone : Zones() )
1909  items.push_back( zone );
1910 
1911  return items;
1912 }
ZONES & Zones()
Definition: board.h:292
FOOTPRINTS & Footprints()
Definition: board.h:286
ZONE handles a list of polygons defining a copper zone.
Definition: zone.h:57
Definition: pad.h:60
TRACKS & Tracks()
Definition: board.h:283
Definition: track.h:83

References Footprints(), 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 749 of file board.h.

750  {
751  return m_NetInfo.begin();
752  }
NETINFO_LIST m_NetInfo
Definition: board.h:232
iterator begin() const
Definition: netinfo.h:453

References NETINFO_LIST::begin(), and m_NetInfo.

◆ BuildConnectivity()

void BOARD::BuildConnectivity ( )

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

Definition at line 134 of file board.cpp.

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

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

void BOARD::BuildListOfNets ( )
inline

◆ ClassOf()

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

Definition at line 250 of file board.h.

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

References PCB_T, and EDA_ITEM::Type().

◆ ClearAllNetCodes()

void BOARD::ClearAllNetCodes ( )

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

Definition at line 1915 of file board.cpp.

1916 {
1917  for( BOARD_CONNECTED_ITEM* item : AllConnectedItems() )
1918  item->SetNetCode( 0 );
1919 }
BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected and have...
const std::vector< BOARD_CONNECTED_ITEM * > AllConnectedItems()
Definition: board.cpp:1895

References AllConnectedItems().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

◆ ClearEditFlags()

◆ ClearFlags()

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

Definition at line 202 of file eda_item.h.

202 { m_flags &= ~aMask; }
STATUS_FLAGS m_flags
Definition: eda_item.h:529

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(), DRAWING_TOOL::PlaceText(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDITOR_PIN_TOOL::RepeatPin(), SYMBOL_EDIT_FRAME::RollbackSymbolFromUndo(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN_CACHE::savePin(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ ClearProject()

void BOARD::ClearProject ( )

Definition at line 169 of file board.cpp.

170 {
171  if( !m_project )
172  return;
173 
174  PROJECT_FILE& project = m_project->GetProjectFile();
175 
176  // Owned by the BOARD
177  if( project.m_BoardSettings )
178  {
179  project.ReleaseNestedSettings( project.m_BoardSettings );
180  project.m_BoardSettings = nullptr;
181  }
182 
183  GetDesignSettings().SetParent( nullptr );
184  m_project = nullptr;
185 }
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:145
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.h:574
PROJECT_FILE is the backing store for a PROJECT, in JSON format.
Definition: project_file.h:62
BOARD_DESIGN_SETTINGS * m_BoardSettings
Board design settings for this project's board.
Definition: project_file.h:167
void ReleaseNestedSettings(NESTED_SETTINGS *aSettings)
Saves and frees a nested settings object, if it exists within this one.
PROJECT * m_project
Definition: board.h:218
void SetParent(JSON_SETTINGS *aParent)

References GetDesignSettings(), PROJECT::GetProjectFile(), PROJECT_FILE::m_BoardSettings, m_project, JSON_SETTINGS::ReleaseNestedSettings(), 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(), PCB_EDIT_FRAME::SavePcbCopy(), PCB_EDIT_FRAME::SavePcbFile(), and SetProject().

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 214 of file eda_item.h.

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

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

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 148 of file view_item.h.

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

References KIGFX::VIEW_ITEM::m_viewPrivData.

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

◆ Clone()

EDA_ITEM * EDA_ITEM::Clone ( ) const
virtualinherited

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

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

Returns
A clone of the item.

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

Definition at line 97 of file eda_item.cpp.

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

References EDA_ITEM::GetClass(), and NULL.

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

◆ CombineAllZonesInNet()

bool BOARD::CombineAllZonesInNet ( PICKED_ITEMS_LIST aDeletedList,
int  aNetCode 
)

Check all copper areas in net for intersections, combining them if found.

Parameters
aDeletedList= a PICKED_ITEMS_LIST * where to store deleted areas (useful in undo commands can be NULL
aNetCode= net to consider
Returns
true if some areas modified

Definition at line 178 of file edit_zone_helpers.cpp.

179 {
180  if( m_zones.size() <= 1 )
181  return false;
182 
183  bool modified = false;
184 
185  for( ZONE* zone : m_zones )
186  zone->ClearFlags( STRUCT_DELETED );
187 
188  // Loop through all combinations
189  for( unsigned ia1 = 0; ia1 < m_zones.size() - 1; ia1++ )
190  {
191  ZONE* refZone = m_zones[ia1];
192 
193  if( refZone->GetNetCode() != aNetCode )
194  continue;
195 
196  // legal polygon
197  BOX2I b1 = refZone->Outline()->BBox();
198  bool mod_ia1 = false;
199 
200  for( unsigned ia2 = m_zones.size() - 1; ia2 > ia1; ia2-- )
201  {
202  ZONE* otherZone = m_zones[ia2];
203 
204  if( otherZone->HasFlag( STRUCT_DELETED ) )
205  continue;
206 
207  if( otherZone->GetNetCode() != aNetCode )
208  continue;
209 
210  if( refZone->GetPriority() != otherZone->GetPriority() )
211  continue;
212 
213  if( refZone->GetIsRuleArea() != otherZone->GetIsRuleArea() )
214  continue;
215 
216  if( refZone->GetLayerSet() != otherZone->GetLayerSet() )
217  continue;
218 
219  BOX2I b2 = otherZone->Outline()->BBox();
220 
221  if( b1.Intersects( b2 ) )
222  {
223  // check otherZone against refZone
224  if( refZone->GetLocalFlags() || otherZone->GetLocalFlags() )
225  {
226  bool ret = TestZoneIntersection( refZone, otherZone );
227 
228  if( ret )
229  ret = CombineZones( aDeletedList, refZone, otherZone );
230 
231  if( ret )
232  {
233  mod_ia1 = true;
234  modified = true;
235  }
236  }
237  }
238  }
239 
240  if( mod_ia1 )
241  ia1--; // if modified, we need to check it again
242  }
243 
244  return modified;
245 }
int GetNetCode() const
Function GetNetCode.
unsigned GetPriority() const
Function GetPriority.
Definition: zone.h:124
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:755
SHAPE_POLY_SET * Outline()
Definition: zone.h:323
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: zone.cpp:288
bool TestZoneIntersection(ZONE *aZone1, ZONE *aZone2)
Test for intersection of 2 copper areas.
bool Intersects(const BOX2< Vec > &aRect) const
Function Intersects.
Definition: box2.h:236
ZONES m_zones
Definition: board.h:203
int GetLocalFlags() const
Definition: zone.h:308
ZONE handles a list of polygons defining a copper zone.
Definition: zone.h:57
#define STRUCT_DELETED
flag indication structures to be erased
Definition: eda_item.h:115
bool CombineZones(PICKED_ITEMS_LIST *aDeletedList, ZONE *aRefZone, ZONE *aZoneToCombine)
If possible, combine 2 copper areas.
const BOX2I BBox(int aClearance=0) const override
Function BBox()
bool HasFlag(STATUS_FLAGS aFlag) const
Definition: eda_item.h:204

References SHAPE_POLY_SET::BBox(), CombineZones(), ZONE::GetIsRuleArea(), ZONE::GetLayerSet(), ZONE::GetLocalFlags(), BOARD_CONNECTED_ITEM::GetNetCode(), ZONE::GetPriority(), EDA_ITEM::HasFlag(), BOX2< Vec >::Intersects(), m_zones, ZONE::Outline(), STRUCT_DELETED, and TestZoneIntersection().

Referenced by OnAreaPolygonModified().

◆ CombineZones()

bool BOARD::CombineZones ( PICKED_ITEMS_LIST aDeletedList,
ZONE aRefZone,
ZONE aZoneToCombine 
)

If possible, combine 2 copper areas.

Parameters
aDeletedList= a PICKED_ITEMS_LIST * where to store deleted areas (for undo).
aRefZone= the main area (zone)
aZoneToCombine= the zone that can be merged with aRefZone; will be deleted if the combine is successful
Returns
: true if aZoneToCombine is combined with aRefZone (and therefore be deleted)

Definition at line 375 of file edit_zone_helpers.cpp.

376 {
377  if( aRefZone == aZoneToCombine )
378  {
379  wxASSERT( 0 );
380  return false;
381  }
382 
383  SHAPE_POLY_SET mergedOutlines = *aRefZone->Outline();
384  SHAPE_POLY_SET areaToMergePoly = *aZoneToCombine->Outline();
385 
386  mergedOutlines.BooleanAdd( areaToMergePoly, SHAPE_POLY_SET::PM_FAST );
387  mergedOutlines.Simplify( SHAPE_POLY_SET::PM_FAST );
388 
389  // We should have one polygon with hole
390  // We can have 2 polygons with hole, if the 2 initial polygons have only one common corner
391  // and therefore cannot be merged (they are dectected as intersecting)
392  // but we should never have more than 2 polys
393  if( mergedOutlines.OutlineCount() > 2 )
394  {
395  wxLogMessage( "BOARD::CombineZones error: more than 2 polys after merging" );
396  return false;
397  }
398 
399  if( mergedOutlines.OutlineCount() > 1 )
400  return false;
401 
402  // Update the area with the new merged outline
403  delete aRefZone->Outline();
404  aRefZone->SetOutline( new SHAPE_POLY_SET( mergedOutlines ) );
405 
406  ITEM_PICKER picker( nullptr, aZoneToCombine, UNDO_REDO::DELETED );
407  aDeletedList->PushItem( picker );
408  aZoneToCombine->SetFlags( STRUCT_DELETED );
409 
410  aRefZone->SetLocalFlags( 1 );
411  aRefZone->HatchBorder();
412 
413  return true;
414 }
int OutlineCount() const
Returns the number of outlines in the set
void BooleanAdd(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Performs boolean polyset union For aFastMode meaning, see function booleanOp
SHAPE_POLY_SET * Outline()
Definition: zone.h:323
void PushItem(const ITEM_PICKER &aItem)
Push aItem to the top of the list.
void SetFlags(STATUS_FLAGS aMask)
Definition: eda_item.h:201
void HatchBorder()
Function HatchBorder computes the hatch lines depending on the hatch parameters and stores it in the ...
Definition: zone.cpp:923
SHAPE_POLY_SET.
void SetOutline(SHAPE_POLY_SET *aOutline)
Definition: zone.h:326
void Simplify(POLYGON_MODE aFastMode)
Simplifies the polyset (merges overlapping polys, eliminates degeneracy/self-intersections) For aFast...
#define STRUCT_DELETED
flag indication structures to be erased
Definition: eda_item.h:115
void SetLocalFlags(int aFlags)
Definition: zone.h:309

References SHAPE_POLY_SET::BooleanAdd(), DELETED, ZONE::HatchBorder(), ZONE::Outline(), SHAPE_POLY_SET::OutlineCount(), SHAPE_POLY_SET::PM_FAST, PICKED_ITEMS_LIST::PushItem(), EDA_ITEM::SetFlags(), ZONE::SetLocalFlags(), ZONE::SetOutline(), SHAPE_POLY_SET::Simplify(), and STRUCT_DELETED.

Referenced by CombineAllZonesInNet().

◆ ComputeBoundingBox()

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

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

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

Definition at line 1022 of file board.cpp.

1023 {
1024  EDA_RECT area;
1025  LSET visible = GetVisibleLayers();
1026  bool showInvisibleText = IsElementVisible( LAYER_MOD_TEXT_INVISIBLE )
1027  && PgmOrNull() && !PgmOrNull()->m_Printing;
1028 
1029  if( aBoardEdgesOnly )
1030  visible.set( Edge_Cuts );
1031 
1032  // Check shapes, dimensions, texts, and fiducials
1033  for( BOARD_ITEM* item : m_drawings )
1034  {
1035  if( aBoardEdgesOnly && ( item->GetLayer() != Edge_Cuts || item->Type() != PCB_SHAPE_T ) )
1036  continue;
1037 
1038  if( ( item->GetLayerSet() & visible ).any() )
1039  area.Merge( item->GetBoundingBox() );
1040  }
1041 
1042  // Check footprints
1043  for( FOOTPRINT* footprint : m_footprints )
1044  {
1045  if( !( footprint->GetLayerSet() & visible ).any() )
1046  continue;
1047 
1048  if( aBoardEdgesOnly )
1049  {
1050  for( const BOARD_ITEM* edge : footprint->GraphicalItems() )
1051  {
1052  if( edge->GetLayer() == Edge_Cuts && edge->Type() == PCB_FP_SHAPE_T )
1053  area.Merge( edge->GetBoundingBox() );
1054  }
1055  }
1056  else
1057  {
1058  area.Merge( footprint->GetBoundingBox( showInvisibleText ) );
1059  }
1060  }
1061 
1062  if( !aBoardEdgesOnly )
1063  {
1064  // Check tracks
1065  for( TRACK* track : m_tracks )
1066  {
1067  if( ( track->GetLayerSet() & visible ).any() )
1068  area.Merge( track->GetBoundingBox() );
1069  }
1070 
1071  // Check zones
1072  for( ZONE* aZone : m_zones )
1073  {
1074  if( ( aZone->GetLayerSet() & visible ).any() )
1075  area.Merge( aZone->GetBoundingBox() );
1076  }
1077  }
1078 
1079  return area;
1080 }
void Merge(const EDA_RECT &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: eda_rect.cpp:431
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
LSET GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings Returns a bit-mask of all t...
Definition: board.cpp:461
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
TRACKS m_tracks
Definition: board.h:201
LSET is a set of PCB_LAYER_IDs.
PGM_BASE * PgmOrNull()
similar to PGM_BASE& Pgm(), but return a reference that can be nullptr when running a shared lib from...
Definition: cvpcb.cpp:112
ZONES m_zones
Definition: board.h:203
ZONE handles a list of polygons defining a copper zone.
Definition: zone.h:57
DRAWINGS m_drawings
Definition: board.h:199
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
Definition: board.cpp:507
bool m_Printing
wxWidgets on MSW tends to crash if you spool up more than one print job at a time.
Definition: pgm_base.h:331
Handle the component boundary box.
Definition: eda_rect.h:42
FOOTPRINTS m_footprints
Definition: board.h:200
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90
Definition: track.h:83

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

Referenced by buildBoardBoundingBoxPoly(), BuildBoardPolygonOutlines(), DIALOG_EXPORT_SVG::CreateSVGFile(), 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 
)

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

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

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

Definition at line 65 of file board_items_to_polygon_shape_transform.cpp.

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

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

Referenced by PlotLayerOutlines().

◆ ConvertCrossReferencesToKIIDs()

wxString BOARD::ConvertCrossReferencesToKIIDs ( const wxString &  aSource)

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

Definition at line 900 of file board.cpp.

901 {
902  wxString newbuf;
903  size_t sourceLen = aSource.length();
904 
905  for( size_t i = 0; i < sourceLen; ++i )
906  {
907  if( aSource[i] == '$' && i + 1 < sourceLen && aSource[i+1] == '{' )
908  {
909  wxString token;
910  bool isCrossRef = false;
911 
912  for( i = i + 2; i < sourceLen; ++i )
913  {
914  if( aSource[i] == '}' )
915  break;
916 
917  if( aSource[i] == ':' )
918  isCrossRef = true;
919 
920  token.append( aSource[i] );
921  }
922 
923  if( isCrossRef )
924  {
925  wxString remainder;
926  wxString ref = token.BeforeFirst( ':', &remainder );
927 
928  for( FOOTPRINT* footprint : Footprints() )
929  {
930  if( footprint->GetReference().CmpNoCase( ref ) == 0 )
931  {
932  wxString test( remainder );
933 
934  if( footprint->ResolveTextVar( &test ) )
935  token = footprint->m_Uuid.AsString() + ":" + remainder;
936 
937  break;
938  }
939  }
940  }
941 
942  newbuf.append( "${" + token + "}" );
943  }
944  else
945  {
946  newbuf.append( aSource[i] );
947  }
948  }
949 
950  return newbuf;
951 }
FOOTPRINTS & Footprints()
Definition: board.h:286

References Footprints().

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

◆ ConvertKIIDsToCrossReferences()

wxString BOARD::ConvertKIIDsToCrossReferences ( const wxString &  aSource)

Definition at line 954 of file board.cpp.

955 {
956  wxString newbuf;
957  size_t sourceLen = aSource.length();
958 
959  for( size_t i = 0; i < sourceLen; ++i )
960  {
961  if( aSource[i] == '$' && i + 1 < sourceLen && aSource[i+1] == '{' )
962  {
963  wxString token;
964  bool isCrossRef = false;
965 
966  for( i = i + 2; i < sourceLen; ++i )
967  {
968  if( aSource[i] == '}' )
969  break;
970 
971  if( aSource[i] == ':' )
972  isCrossRef = true;
973 
974  token.append( aSource[i] );
975  }
976 
977  if( isCrossRef )
978  {
979  wxString remainder;
980  wxString ref = token.BeforeFirst( ':', &remainder );
981  BOARD_ITEM* refItem = GetItem( KIID( ref ) );
982 
983  if( refItem && refItem->Type() == PCB_FOOTPRINT_T )
984  token = static_cast<FOOTPRINT*>( refItem )->GetReference() + ":" + remainder;
985  }
986 
987  newbuf.append( "${" + token + "}" );
988  }
989  else
990  {
991  newbuf.append( aSource[i] );
992  }
993  }
994 
995  return newbuf;
996 }
BOARD_ITEM * GetItem(const KIID &aID) const
Definition: board.cpp:785
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
Definition: kiid.h:44
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:161

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

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

◆ Delete()

virtual void BOARD_ITEM_CONTAINER::Delete ( BOARD_ITEM aItem)
inlinevirtualinherited

Removes an item from the container and deletes it.

Definition at line 74 of file board_item_container.h.

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

References BOARD_ITEM_CONTAINER::Remove().

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

◆ DeleteAllFootprints()

void BOARD::DeleteAllFootprints ( )
inline

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

Definition at line 371 of file board.h.

372  {
373  for( FOOTPRINT* footprint : m_footprints )
374  delete footprint;
375 
376  m_footprints.clear();
377  }
FOOTPRINTS m_footprints
Definition: board.h:200

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

754 {
755  // the vector does not know how to delete the PCB_MARKER, it holds pointers
756  for( PCB_MARKER* marker : m_markers )
757  delete marker;
758 
759  m_markers.clear();
760 }
MARKERS m_markers
Definition: board.h:198

References m_markers.

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

◆ DeleteMARKERs() [2/2]

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

Definition at line 763 of file board.cpp.

764 {
765  // Deleting lots of items from a vector can be very slow. Copy remaining items instead.
766  MARKERS remaining;
767 
768  for( PCB_MARKER* marker : m_markers )
769  {
770  if( ( marker->IsExcluded() && aExclusions )
771  || ( !marker->IsExcluded() && aWarningsAndErrors ) )
772  {
773  delete marker;
774  }
775  else
776  {
777  remaining.push_back( marker );
778  }
779  }
780 
781  m_markers = remaining;
782 }
MARKERS m_markers
Definition: board.h:198

References m_markers.

◆ DeleteStructure()

void BOARD_ITEM::DeleteStructure ( )
inherited

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

Definition at line 113 of file board_item.cpp.

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

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

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

◆ Drawings() [1/2]

◆ Drawings() [2/2]

const DRAWINGS& BOARD::Drawings ( ) const
inline

Definition at line 290 of file board.h.

290 { return m_drawings; }
DRAWINGS m_drawings
Definition: board.h:199

References m_drawings.

◆ Duplicate()

virtual BOARD_ITEM* BOARD_ITEM::Duplicate ( ) const
inlinevirtualinherited

Create a copy of a of this BOARD_ITEM.

Reimplemented in FOOTPRINT.

Definition at line 202 of file board_item.h.

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

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

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

758  {
759  return m_NetInfo.end();
760  }
iterator end() const
Definition: netinfo.h:458
NETINFO_LIST m_NetInfo
Definition: board.h:232

References NETINFO_LIST::end(), and m_NetInfo.

◆ FillItemMap()

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

Definition at line 864 of file board.cpp.

865 {
866  // the board itself
867  aMap[ this->m_Uuid ] = this;
868 
869  for( TRACK* track : Tracks() )
870  aMap[ track->m_Uuid ] = track;
871 
872  for( FOOTPRINT* footprint : Footprints() )
873  {
874  aMap[ footprint->m_Uuid ] = footprint;
875 
876  for( PAD* pad : footprint->Pads() )
877  aMap[ pad->m_Uuid ] = pad;
878 
879  aMap[ footprint->Reference().m_Uuid ] = &footprint->Reference();
880  aMap[ footprint->Value().m_Uuid ] = &footprint->Value();
881 
882  for( BOARD_ITEM* drawing : footprint->GraphicalItems() )
883  aMap[ drawing->m_Uuid ] = drawing;
884  }
885 
886  for( ZONE* zone : Zones() )
887  aMap[ zone->m_Uuid ] = zone;
888 
889  for( BOARD_ITEM* drawing : Drawings() )
890  aMap[ drawing->m_Uuid ] = drawing;
891 
892  for( PCB_MARKER* marker : m_markers )
893  aMap[ marker->m_Uuid ] = marker;
894 
895  for( PCB_GROUP* group : m_groups )
896  aMap[ group->m_Uuid ] = group;
897 }
ZONES & Zones()
Definition: board.h:292
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
PCB_GROUP is a set of BOARD_ITEMs (i.e., without duplicates)
Definition: pcb_group.h:50
GROUPS m_groups
Definition: board.h:202
FOOTPRINTS & Footprints()
Definition: board.h:286
ZONE handles a list of polygons defining a copper zone.
Definition: zone.h:57
MARKERS m_markers
Definition: board.h:198
const KIID m_Uuid
Definition: eda_item.h:523
Definition: pad.h:60
DRAWINGS & Drawings()
Definition: board.h:289
TRACKS & Tracks()
Definition: board.h:283
Definition: track.h:83

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

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

◆ FinalizeBulkAdd()

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

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

Definition at line 653 of file board.cpp.

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

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

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

◆ FinalizeBulkRemove()

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

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

Definition at line 659 of file board.cpp.

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

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

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

◆ FindFootprintByPath()

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

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

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

Definition at line 1294 of file board.cpp.

1295 {
1296  for( FOOTPRINT* footprint : m_footprints )
1297  {
1298  if( footprint->GetPath() == aPath )
1299  return footprint;
1300  }
1301 
1302  return nullptr;
1303 }
FOOTPRINTS m_footprints
Definition: board.h:200

References m_footprints.

◆ FindFootprintByReference()

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

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

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

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

Definition at line 1282 of file board.cpp.

1283 {
1284  for( FOOTPRINT* footprint : m_footprints )
1285  {
1286  if( aReference == footprint->GetReference() )
1287  return footprint;
1288  }
1289 
1290  return nullptr;
1291 }
FOOTPRINTS m_footprints
Definition: board.h:200

References m_footprints.

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

◆ FindNet() [1/2]

NETINFO_ITEM * BOARD::FindNet ( int  aNetcode) const

Search for a net with the given netcode.

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

Definition at line 1261 of file board.cpp.

1262 {
1263  // the first valid netcode is 1 and the last is m_NetInfo.GetCount()-1.
1264  // zero is reserved for "no connection" and is not actually a net.
1265  // NULL is returned for non valid netcodes
1266 
1267  wxASSERT( m_NetInfo.GetNetCount() > 0 );
1268 
1269  if( aNetcode == NETINFO_LIST::UNCONNECTED && m_NetInfo.GetNetCount() == 0 )
1270  return NETINFO_LIST::OrphanedItem();
1271  else
1272  return m_NetInfo.GetNetItem( aNetcode );
1273 }
static NETINFO_ITEM * OrphanedItem()
NETINFO_ITEM meaning that there was no net assigned for an item, as there was no board storing net li...
Definition: netinfo.h:390
NETINFO_LIST m_NetInfo
Definition: board.h:232
unsigned GetNetCount() const
Function GetNetCount.
Definition: netinfo.h:353
NETINFO_ITEM * GetNetItem(int aNetCode) const
Function GetItem.
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
Definition: netinfo.h:382

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

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

◆ FindNet() [2/2]

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

Search for a net with the given name.

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

Definition at line 1276 of file board.cpp.

1277 {
1278  return m_NetInfo.GetNetItem( aNetname );
1279 }
NETINFO_LIST m_NetInfo
Definition: board.h:232
NETINFO_ITEM * GetNetItem(int aNetCode) const
Function GetItem.

References NETINFO_LIST::GetNetItem(), and m_NetInfo.

◆ Flip() [1/2]

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

Flip this object, i.e.

change the board side for this object.

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

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

Definition at line 310 of file board_item.h.

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

References EDA_ITEM::GetClass().

Referenced by BOARD_ITEM::Flip(), and PCB_BASE_EDIT_FRAME::PutDataInPreviousState().

◆ Flip() [2/2]

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

Definition at line 315 of file board_item.h.

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

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

◆ Footprints() [1/2]

FOOTPRINTS& BOARD::Footprints ( )
inline

Definition at line 286 of file board.h.

286 { return m_footprints; }
FOOTPRINTS m_footprints
Definition: board.h:200

References m_footprints.

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

◆ Footprints() [2/2]

const FOOTPRINTS& BOARD::Footprints ( ) const
inline

Definition at line 287 of file board.h.

287 { return m_footprints; }
FOOTPRINTS m_footprints
Definition: board.h:200

References m_footprints.

◆ Get() [1/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty)
inlineinherited

Definition at line 84 of file inspectable.h.

85  {
87  TYPE_ID thisType = TYPE_HASH( *this );
88  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
89  return object ? aProperty->getter( object ) : wxAny();
90  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:64
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:56
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:41
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Casts a type to another type.
virtual wxAny getter(void *aObject) const =0
Provides class metadata.
Definition: property_mgr.h:61
virtual size_t OwnerHash() const =0
Returns type-id of the Owner class.

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

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

◆ Get() [2/3]

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

Definition at line 93 of file inspectable.h.

94  {
96  TYPE_ID thisType = TYPE_HASH( *this );
97  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
98  return object ? aProperty->get<T>( object ) : T();
99  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:64
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:56
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:41
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Casts a type to another type.
Provides class metadata.
Definition: property_mgr.h:61
T get(void *aObject)
Definition: property.h:265
virtual size_t OwnerHash() const =0
Returns 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 102 of file inspectable.h.

103  {
105  TYPE_ID thisType = TYPE_HASH( *this );
106  PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
107  boost::optional<T> ret;
108 
109  if( prop )
110  {
111  void* object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
112 
113  if( object )
114  ret = prop->get<T>( object );
115  }
116 
117  return ret;
118  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:64
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:56
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:41
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Casts a type to another type.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Returns a property for a specific type.
Provides class metadata.
Definition: property_mgr.h:61
T get(void *aObject)
Definition: property.h:265
virtual size_t OwnerHash() const =0
Returns type-id of the Owner class.

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

◆ GetArea()

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

Return the Zone at a given index.

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

Definition at line 894 of file board.h.

895  {
896  if( (unsigned) index < m_zones.size() )
897  return m_zones[index];
898 
899  return NULL;
900  }
#define NULL
ZONES m_zones
Definition: board.h:203

References m_zones, and NULL.

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

◆ GetAreaCount()

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

Definition at line 910 of file board.h.

911  {
912  return static_cast<int>( m_zones.size() );
913  }
ZONES m_zones
Definition: board.h:203

References m_zones.

◆ GetBoard()

BOARD * BOARD_ITEM::GetBoard ( ) const
virtualinherited

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

Definition at line 46 of file board_item.cpp.

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

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

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

◆ GetBoardEdgesBoundingBox()

const EDA_RECT BOARD::GetBoardEdgesBoundingBox ( ) const
inline

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

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

Returns
bounding box calculated using exclusively the board edges.

Definition at line 793 of file board.h.

794  {
795  return ComputeBoundingBox( true );
796  }
EDA_RECT ComputeBoundingBox(bool aBoardEdgesOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
Definition: board.cpp:1022

References ComputeBoundingBox().

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

◆ GetBoardPolygonOutlines()

bool BOARD::GetBoardPolygonOutlines ( SHAPE_POLY_SET aOutlines,
OUTLINE_ERROR_HANDLER aErrorHandler = nullptr 
)

Extract the board outlines and build a closed polygon from lines, arcs and circle items on edge cut layer Any closed outline inside the main outline is a hole All contours should be closed, i.e.

have valid vertices to build a closed polygon

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

Definition at line 1855 of file board.cpp.

1857 {
1858  int chainingEpsilon = Millimeter2iu( 0.02 ); // max dist from one endPt to next startPt
1859 
1860  bool success = BuildBoardPolygonOutlines( this, aOutlines, GetDesignSettings().m_MaxError,
1861  chainingEpsilon, aErrorHandler );
1862 
1863  // Make polygon strictly simple to avoid issues (especially in 3D viewer)
1865 
1866  return success;
1867 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.h:574
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)
Simplifies the polyset (merges overlapping polys, eliminates degeneracy/self-intersections) For aFast...
static constexpr int Millimeter2iu(double mm)

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

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

◆ GetBoardUse()

BOARD_USE BOARD::GetBoardUse ( ) const
inline

Get what the board use is.

Returns
what the board is being used for

Definition at line 267 of file board.h.

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

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

780  {
781  return ComputeBoundingBox( false );
782  }
EDA_RECT ComputeBoundingBox(bool aBoardEdgesOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
Definition: board.cpp:1022

References ComputeBoundingBox().

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

◆ GetCenter()

virtual wxPoint BOARD_ITEM::GetCenter ( ) const
inlinevirtualinherited

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

Returns
center point of the item

Reimplemented in ARC, PAD, PCB_SHAPE, and PCB_MARKER.

Definition at line 114 of file board_item.h.

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

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

Referenced by ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), and getDrilledHoleShape().

◆ GetClass()

wxString BOARD::GetClass ( ) const
inlineoverridevirtual

Return the class name.

Implements EDA_ITEM.

Definition at line 863 of file board.h.

864  {
865  return wxT( "BOARD" );
866  }

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

397 { return m_connectivity; }
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: board.h:213

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(), PCB_EDIT_FRAME::Edit_Zone_Params(), exprFromTo(), ZONE_FILLER::Fill(), EDIT_TOOL::FilletTracks(), VIA::FlashLayer(), PAD::FlashLayer(), PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), GetMsgPanelInfo(), GetTrackLength(), PCB_EDIT_FRAME::ImportSpecctraSession(), TRACKS_CLEANER::mergeCollinearSegments(), DIALOG_NETLIST::OnCompileRatsnestClick(), PadDelete(), ZONE_CREATE_HELPER::performZoneCutout(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), DIALOG_NET_INSPECTOR::relevantConnectivityItems(), TRACKS_CLEANER::removeShortingTrackSegments(), BOARD_COMMIT::Revert(), AR_AUTOPLACER::rotateFootprint(), DRC_TEST_PROVIDER_CONNECTIVITY::Run(), test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run(), DRC_TEST_PROVIDER_MATCHED_LENGTH::runInternal(), PCB_SELECTION_TOOL::selectAllItemsOnNet(), PCB_SELECTION_TOOL::selectConnectedTracks(), PCB_EDIT_FRAME::SetBoard(), TRACKS_CLEANER::testTrackEndpointIsNode(), DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow(), and BOARD_NETLIST_UPDATER::UpdateNetlist().

◆ GetCopperLayerCount()

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

Definition at line 435 of file board.cpp.

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

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_layer_Zs(), compute_pad_access_code(), CreateComponentsSection(), CreatePadsShapesSection(), PLACEFILE_GERBER_WRITER::CreatePlaceFile(), CreateRoutesSection(), DIALOG_SWAP_LAYERS::DIALOG_SWAP_LAYERS(), DRAWING_TOOL::DrawVia(), TRACK::Flip(), ARC::Flip(), VIA::Flip(), ZONE::Flip(), DSN::SPECCTRA_DB::FromBOARD(), GetGerberFileFunctionAttribute(), BOARD_ADAPTER::InitSettings(), EAGLE_PLUGIN::Load(), DSN::SPECCTRA_DB::makeIMAGE(), DSN::SPECCTRA_DB::makePADSTACK(), DSN::SPECCTRA_DB::makeVIA(), APPEARANCE_CONTROLS::rebuildLayerContextMenu(), ZONE_SETTINGS::SetupLayersList(), PCB_BASE_FRAME::SwitchLayer(), DIALOG_SWAP_LAYERS::TransferDataFromWindow(), DIALOG_SWAP_LAYERS::TransferDataToWindow(), PANEL_SETUP_LAYERS::TransferDataToWindow(), and via_access_code().

◆ GetDesignSettings()

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

Definition at line 574 of file board.h.

575  {
576  return *m_designSettings;
577  }
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:230

References m_designSettings.

Referenced by AddGerberX2Header(), GERBER_JOBFILE_WRITER::addJSONDesignRules(), GERBER_JOBFILE_WRITER::addJSONGeneralSpecs(), GERBER_JOBFILE_WRITER::addJSONMaterialStackup(), BOARD(), build_pad_testpoints(), build_via_testpoints(), ZONE_FILLER::buildCopperItemClearances(), PAD::BuildEffectivePolygon(), PAD::BuildEffectiveShapes(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildFilterLists(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildNetclassesGrid(), ZONE::BuildSmoothedPoly(), ZONE_FILLER::buildThermalSpokes(), DIALOG_NET_INSPECTOR::calculateViaLength(), EDIT_TOOL::ChangeTrackWidth(), FOOTPRINT_EDIT_FRAME::Clear_Pcb(), ClearProject(), compute_layer_Zs(), ZONE_FILLER::computeRawFilledArea(), ConvertBrdLayerToPolygonalContours(), BOARD_ADAPTER::createBoardPolygon(), MICROWAVE_TOOL::createInductorBetween(), CreatePadsShapesSection(), PLACEFILE_GERBER_WRITER::CreatePlaceFile(), CreateRoutesSection(), DIALOG_EXPORT_SVG::CreateSVGFile(), ROUTER_TOOL::CustomTrackWidthDialog(), DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP(), DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME(), ROUTER_TOOL::DpDimensionsDialog(), KIGFX::PCB_PAINTER::draw(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawVia(), VIA_SIZE_MENU::eventHandler(), TRACK_WIDTH_MENU::eventHandler(), DIFF_PAIR_MENU::eventHandler(), EVT_GRID_CMD_CELL_CHANGED(), PCB_EDIT_FRAME::Export_IDF3(), PCB_EDIT_FRAME::ExportToGenCAD(), ZONE_FILLER::Fill(), FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), PCB_IO::formatGeneral(), PCB_IO::formatSetup(), DSN::SPECCTRA_DB::FromBOARD(), DSN::SPECCTRA_DB::FromSESSION(), PLACE_FILE_EXPORTER::GenPositionData(), PCB_BASE_FRAME::GetAuxOrigin(), GetBoardPolygonOutlines(), PCB_MARKER::GetColorLayer(), GetCopperLayerCount(), BOARD_DRC_ITEMS_PROVIDER::GetCount(), VECTOR_DRC_ITEMS_PROVIDER::GetCount(), FOOTPRINT_EDIT_FRAME::GetDesignSettings(), PCB_BASE_FRAME::GetDesignSettings(), BOARD_CONNECTED_ITEM::GetEffectiveNetclass(), GetEnabledLayers(), PCB_BASE_FRAME::GetGridOrigin(), BOARD_ADAPTER::GetHolePlatingThickness(), VIA::GetMinAnnulus(), BOARD_CONNECTED_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetOwnClearance(), DRAWING_TOOL::getSegmentWidth(), PCB_BASE_FRAME::GetSeverity(), getShape(), PAD::GetSolderMaskMargin(), TRACK::GetWidthConstraints(), PCB_BASE_FRAME::GetZoneSettings(), GetZoneSettings(), ROUTER_TOOL::handleLayerSwitch(), ALTIUM_PCB::HelperCreateBoardOutline(), PANEL_SETUP_MASK_AND_PASTE::ImportSettingsFrom(), PANEL_SETUP_TEXT_AND_GRAPHICS::ImportSettingsFrom(), PANEL_SETUP_FEATURE_CONSTRAINTS::ImportSettingsFrom(), PANEL_SETUP_TRACKS_AND_VIAS::ImportSettingsFrom(), PANEL_SETUP_BOARD_STACKUP::ImportSettingsFrom(), PNS_KICAD_IFACE_BASE::ImportSizes(), DIALOG_PLOT::init_Dialog(), initializePlotter(), BOARD_ADAPTER::InitSettings(), BOARD_INSPECTION_TOOL::InspectConstraints(), IsLayerEnabled(), IsLayerVisible(), EAGLE_PLUGIN::Load(), LoadBoard(), FABMASTER::loadFootprints(), LEGACY_PLUGIN::loadGENERAL(), DRC_ENGINE::loadImplicitRules(), LEGACY_PLUGIN::loadNETCLASS(), EAGLE_PLUGIN::loadPlain(), LEGACY_PLUGIN::loadSETUP(), 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_STACKUP::PANEL_SETUP_BOARD_STACKUP(), PANEL_SETUP_FEATURE_CONSTRAINTS::PANEL_SETUP_FEATURE_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::ParseBoard6Data(), ALTIUM_PCB::ParseClasses6Data(), BOARD_EDITOR_CONTROL::PlaceTarget(), DIALOG_PLOT::Plot(), PlotOneBoardLayer(), PlotSolderMaskLayer(), PlotStandardLayer(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), PNS_PCBNEW_RULE_RESOLVER::QueryConstraint(), APPEARANCE_CONTROLS::rebuildNets(), PAD_TOOL::recombinePad(), PCB_EDIT_FRAME::RecordDRCExclusions(), DIALOG_PLOT::reInitDialog(), BOARD_INSPECTION_TOOL::reportClearance(), DRC_TOOL::Reset(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::Run(), PCB_BASE_EDIT_FRAME::SetBoard(), SetCopperLayerCount(), SetEnabledLayers(), PCB_BASE_FRAME::SetGridOrigin(), NETINFO_ITEM::SetNetClass(), DIALOG_PLOT::SetPlotFormat(), SetProject(), BOARD_DRC_ITEMS_PROVIDER::SetSeverities(), VECTOR_DRC_ITEMS_PROVIDER::SetSeverities(), PCB_BASE_FRAME::SetZoneSettings(), SetZoneSettings(), APPEARANCE_CONTROLS::showNetclass(), EDA_3D_VIEWER::SynchroniseColoursWithBoard(), SynchronizeNetsAndNetClasses(), PNS_KICAD_IFACE_BASE::syncPad(), PNS_KICAD_IFACE_BASE::syncVia(), PNS_KICAD_IFACE_BASE::SyncWorld(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZones(), DRC_TEST_PROVIDER_MISC::testOutline(), PANEL_SETUP_RULES::TransferDataFromWindow(), ZONE::TransformSmoothedOutlineToPolygon(), VIA_SIZE_MENU::update(), TRACK_WIDTH_MENU::update(), DIFF_PAIR_MENU::update(), DIALOG_GENDRILL::UpdateDrillParams(), TRACK::ViewBBox(), FOOTPRINT::ViewBBox(), PCB_MARKER::ViewGetLayers(), WriteDRCReport(), DIALOG_DRC::writeReport(), and HYPERLYNX_EXPORTER::writeStackupInfo().

◆ GetEditFlags()

STATUS_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 206 of file eda_item.h.

207  {
208  constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVED | IS_RESIZED | IS_DRAGGED |
210 
211  return m_flags & mask;
212  }
#define IS_RESIZED
Item being resized.
Definition: eda_item.h:107
#define STRUCT_DELETED
flag indication structures to be erased
Definition: eda_item.h:115
#define IS_MOVED
Item being moved.
Definition: eda_item.h:105
#define IS_DRAGGED
Item being dragged.
Definition: eda_item.h:108
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
Definition: eda_item.h:119
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: eda_item.h:110
STATUS_FLAGS m_flags
Definition: eda_item.h:529
#define IS_NEW
New item, just created.
Definition: eda_item.h:106

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

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

◆ GetEffectiveShape()

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

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

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

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

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

Definition at line 153 of file board_item.cpp.

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

References EDA_ITEM::GetClass().

Referenced by getShape(), PCB_SELECTION_TOOL::hitTestDistance(), DRC_RTREE::Insert(), insideArea(), insideCourtyard(), DRC_RTREE::QueryColliding(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::testAgainstEdge(), and DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZones().

◆ GetEnabledLayers()

LSET BOARD::GetEnabledLayers ( ) const

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

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

Definition at line 447 of file board.cpp.

448 {
450 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.h:574
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(), DRC_TEST_PROVIDER_MISC::testDisabledLayers(), PANEL_SETUP_LAYERS::TransferDataFromWindow(), DIALOG_PRINT_PCBNEW::TransferDataToWindow(), PANEL_SETUP_LAYERS::TransferDataToWindow(), PCB_EDIT_FRAME::UpdateUserInterface(), PAD::ViewGetLOD(), and HYPERLYNX_EXPORTER::writeSinglePadStack().

◆ GetFileFormatVersionAtLoad()

int BOARD::GetFileFormatVersionAtLoad ( ) const
inline

Definition at line 342 of file board.h.

342 { return m_fileFormatVersionAtLoad; }
int m_fileFormatVersionAtLoad
Definition: board.h:210

References m_fileFormatVersionAtLoad.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ GetFileName()

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

Definition at line 281 of file board.h.

281 { return m_fileName; }
wxString m_fileName
Definition: board.h:197

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_REANNOTATE::DIALOG_BOARD_REANNOTATE(), DIALOG_BOARD_STATISTICS::DIALOG_BOARD_STATISTICS(), DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP(), PCB_DRAW_PANEL_GAL::DisplayBoard(), PCB_EDIT_FRAME::doCloseWindow(), PCB_EDIT_FRAME::Export_IDF3(), BOARD_EDITOR_CONTROL::ExportSpecctraDSN(), DIALOG_EXPORT_SVG::ExportSVGFile(), PCB_EDIT_FRAME::ExportToGenCAD(), PCB_EDIT_FRAME::Files_io_from_id(), PCB_EDIT_FRAME::GenD356File(), DIALOG_GENDRILL::GenDrillAndMapFiles(), GENDRILL_WRITER_BASE::GenDrillReportFile(), PCB_EDIT_FRAME::GenFootprintsReport(), PCB_EDIT_FRAME::GetCurrentFileName(), PCB_BASE_EDIT_FRAME::GetDesignRulesPath(), GENDRILL_WRITER_BASE::getDrillFileName(), PCB_EDIT_FRAME::GetLastPath(), BOARD_EDITOR_CONTROL::ImportSpecctraSession(), PCB_EDIT_FRAME::onBoardLoaded(), DIALOG_IMPORT_SETTINGS::OnBrowseClicked(), PCB_EDIT_FRAME::OnExportHyperlynx(), PCB_EDIT_FRAME::OnExportIDF3(), PCB_EDIT_FRAME::OnExportSTEP(), PCB_EDIT_FRAME::OnExportVRML(), DIALOG_GENDRILL::OnGenReportFile(), DIALOG_EXPORT_SVG::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_GEN_FOOTPRINT_POSITION::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), PLOT_CONTROLLER::OpenPlotfile(), ALTIUM_PCB::ParseModelsData(), DIALOG_PLOT::Plot(), PCB_EDIT_FRAME::RecreateBOMFileFromBoard(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), DIALOG_BOARD_STATISTICS::saveReportClicked(), PCB_EDIT_FRAME::SetLastPath(), StartPlotBoard(), PCB_EDIT_FRAME::UpdateTitle(), HYPERLYNX_EXPORTER::writeBoardInfo(), WriteDRCReport(), and DIALOG_DRC::writeReport().

◆ GetFirstFootprint()

FOOTPRINT* BOARD::GetFirstFootprint ( ) const
inline

Gets the first footprint on the board or nullptr.

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

Returns
first footprint or null pointer

Definition at line 363 of file board.h.

364  {
365  return m_footprints.empty() ? nullptr : m_footprints.front();
366  }
FOOTPRINTS m_footprints
Definition: board.h:200

References m_footprints.

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

◆ GetFlags()

◆ GetFocusPosition()

const wxPoint BOARD::GetFocusPosition ( ) const
inlineoverridevirtual

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

Reimplemented from EDA_ITEM.

Definition at line 332 of file board.h.

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

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

◆ GetFootprint()

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

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

1700 {
1701  FOOTPRINT* footprint = NULL;
1702  FOOTPRINT* alt_footprint = NULL;
1703  int min_dim = 0x7FFFFFFF;
1704  int alt_min_dim = 0x7FFFFFFF;
1705  bool current_layer_back = IsBackLayer( aActiveLayer );
1706 
1707  for( FOOTPRINT* candidate : m_footprints )
1708  {
1709  // is the ref point within the footprint's bounds?
1710  if( !candidate->HitTest( aPosition ) )
1711  continue;
1712 
1713  // if caller wants to ignore locked footprints, and this one is locked, skip it.
1714  if( aIgnoreLocked && candidate->IsLocked() )
1715  continue;
1716 
1717  PCB_LAYER_ID layer = candidate->GetLayer();
1718 
1719  // Filter non visible footprints if requested
1720  if( !aVisibleOnly || IsFootprintLayerVisible( layer ) )
1721  {
1722  EDA_RECT bb = candidate->GetFootprintRect();
1723 
1724  int offx = bb.GetX() + bb.GetWidth() / 2;
1725  int offy = bb.GetY() + bb.GetHeight() / 2;
1726 
1727  // off x & offy point to the middle of the box.
1728  int dist = ( aPosition.x - offx ) * ( aPosition.x - offx ) +
1729  ( aPosition.y - offy ) * ( aPosition.y - offy );
1730 
1731  if( current_layer_back == IsBackLayer( layer ) )
1732  {
1733  if( dist <= min_dim )
1734  {
1735  // better footprint shown on the active side
1736  footprint = candidate;
1737  min_dim = dist;
1738  }
1739  }
1740  else if( aVisibleOnly && IsFootprintLayerVisible( layer ) )
1741  {
1742  if( dist <= alt_min_dim )
1743  {
1744  // better footprint shown on the other side
1745  alt_footprint = candidate;
1746  alt_min_dim = dist;
1747  }
1748  }
1749  }
1750  }
1751 
1752  if( footprint )
1753  return footprint;
1754 
1755  if( alt_footprint)
1756  return alt_footprint;
1757 
1758  return NULL;
1759 }
int GetX() const
Definition: eda_rect.h:103
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
int GetWidth() const
Definition: eda_rect.h:114
PCB_LAYER_ID
A quick note on layer IDs:
#define NULL
int GetHeight() const
Definition: eda_rect.h:115
Handle the component boundary box.
Definition: eda_rect.h:42
int GetY() const
Definition: eda_rect.h:104
FOOTPRINTS m_footprints
Definition: board.h:200
bool IsFootprintLayerVisible(PCB_LAYER_ID aLayer)
Expect either of the two layers on which a footprint can reside, and returns whether that layer is vi...
Definition: board.cpp:546

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

◆ GetHighLightNetCodes()

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

Definition at line 437 of file board.h.

438  {
439  return m_highLight.m_netCodes;
440  }
HIGH_LIGHT_INFO m_highLight
Definition: board.h:207
std::set< int > m_netCodes
Definition: board.h:133

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

786 {
787  if( aID == niluuid )
788  return nullptr;
789 
790  for( TRACK* track : Tracks() )
791  {
792  if( track->m_Uuid == aID )
793  return track;
794  }
795 
796  for( FOOTPRINT* footprint : Footprints() )
797  {
798  if( footprint->m_Uuid == aID )
799  return footprint;
800 
801  for( PAD* pad : footprint->Pads() )
802  {
803  if( pad->m_Uuid == aID )
804  return pad;
805  }
806 
807  if( footprint->Reference().m_Uuid == aID )
808  return &footprint->Reference();
809 
810  if( footprint->Value().m_Uuid == aID )
811  return &footprint->Value();
812 
813  for( BOARD_ITEM* drawing : footprint->GraphicalItems() )
814  {
815  if( drawing->m_Uuid == aID )
816  return drawing;
817  }
818 
819  for( BOARD_ITEM* zone : footprint->Zones() )
820  {
821  if( zone->m_Uuid == aID )
822  return zone;
823  }
824 
825  for( PCB_GROUP* group : footprint->Groups() )
826  {
827  if( group->m_Uuid == aID )
828  return group;
829  }
830  }
831 
832  for( ZONE* zone : Zones() )
833  {
834  if( zone->m_Uuid == aID )
835  return zone;
836  }
837 
838  for( BOARD_ITEM* drawing : Drawings() )
839  {
840  if( drawing->m_Uuid == aID )
841  return drawing;
842  }
843 
844  for( PCB_MARKER* marker : m_markers )
845  {
846  if( marker->m_Uuid == aID )
847  return marker;
848  }
849 
850  for( PCB_GROUP* group : m_groups )
851  {
852  if( group->m_Uuid == aID )
853  return group;
854  }
855 
856  if( m_Uuid == aID )
857  return const_cast<BOARD*>( this );
858 
859  // Not found; weak reference has been deleted.
861 }
KIID niluuid(0)
ZONES & Zones()
Definition: board.h:292
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
PCB_GROUP is a set of BOARD_ITEMs (i.e., without duplicates)
Definition: pcb_group.h:50
GROUPS m_groups
Definition: board.h:202
static DELETED_BOARD_ITEM * GetInstance()
Definition: board_item.h:398
FOOTPRINTS & Footprints()
Definition: board.h:286
ZONE handles a list of polygons defining a copper zone.
Definition: zone.h:57
MARKERS m_markers
Definition: board.h:198
const KIID m_Uuid
Definition: eda_item.h:523
Definition: pad.h:60
DRAWINGS & Drawings()
Definition: board.h:289
TRACKS & Tracks()
Definition: board.h:283
Definition: track.h:83

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

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

◆ GetLayer()

virtual PCB_LAYER_ID BOARD_ITEM::GetLayer ( ) const
inlinevirtualinherited

Return the primary layer this item is on.

Reimplemented in ZONE.

Definition at line 173 of file board_item.h.

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

References BOARD_ITEM::m_layer.

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

◆ GetLayerID()

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

Return the ID of a layer.

Definition at line 320 of file board.cpp.

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

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

◆ GetLayerName() [1/2]

wxString BOARD_ITEM::GetLayerName ( ) const
inherited

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

Returns
the layer name associated with this item.

Definition at line 60 of file board_item.cpp.

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

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

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

◆ GetLayerName() [2/2]

wxString BOARD::GetLayerName ( PCB_LAYER_ID  aLayer) const

Return the name of a aLayer.

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

Definition at line 342 of file board.cpp.

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

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

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

◆ GetLayerSet()

virtual LSET BOARD_ITEM::GetLayerSet ( ) const
inlinevirtualinherited

◆ GetLayerType()

LAYER_T BOARD::GetLayerType ( PCB_LAYER_ID  aLayer) const

Return the type of the copper layer given by aLayer.

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

Definition at line 376 of file board.cpp.

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

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

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

◆ GetMenuImage()

BITMAP_DEF 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_COMPONENT, PAD, FOOTPRINT, SCH_SHEET, CENTER_DIMENSION, SCH_HIERLABEL, LEADER, ORTHOGONAL_DIMENSION, SCH_GLOBALLABEL, VIA, SCH_LABEL, ALIGNED_DIMENSION, PCB_SHAPE, SCH_TEXT, GERBER_DRAW_ITEM, LIB_PIN, SCH_LINE, FP_TEXT, TRACK, SCH_BUS_BUS_ENTRY, SCH_SHEET_PIN, LIB_FIELD, SCH_FIELD, PCB_GROUP, SCH_BUS_WIRE_ENTRY, FP_SHAPE, SCH_BITMAP, LIB_ARC, PCB_TEXT, LIB_POLYLINE, SCH_NO_CONNECT, SCH_MARKER, LIB_TEXT, PCB_TARGET, SCH_JUNCTION, LIB_RECTANGLE, PCB_MARKER, and LIB_CIRCLE.

Definition at line 221 of file eda_item.cpp.

222 {
223  return dummy_xpm;
224 }
static const BITMAP_OPAQUE dummy_xpm[1]
Definition: eda_item.cpp:48

References dummy_xpm.

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

1084 {
1085  wxString txt;
1086  int viasCount = 0;
1087  int trackSegmentsCount = 0;
1088 
1089  for( TRACK* item : m_tracks )
1090  {
1091  if( item->Type() == PCB_VIA_T )
1092  viasCount++;
1093  else
1094  trackSegmentsCount++;
1095  }
1096 
1097  txt.Printf( wxT( "%d" ), GetPadCount() );
1098  aList.emplace_back( _( "Pads" ), txt );
1099 
1100  txt.Printf( wxT( "%d" ), viasCount );
1101  aList.emplace_back( _( "Vias" ), txt );
1102 
1103  txt.Printf( wxT( "%d" ), trackSegmentsCount );
1104  aList.emplace_back( _( "Track Segments" ), txt );
1105 
1106  txt.Printf( wxT( "%d" ), GetNodesCount() );
1107  aList.emplace_back( _( "Nodes" ), txt );
1108 
1109  txt.Printf( wxT( "%d" ), m_NetInfo.GetNetCount() - 1 /* Don't include "No Net" in count */ );
1110  aList.emplace_back( _( "Nets" ), txt );
1111 
1112  txt.Printf( wxT( "%d" ), GetConnectivity()->GetUnconnectedCount() );
1113  aList.emplace_back( _( "Unrouted" ), txt );
1114 }
NETINFO_LIST m_NetInfo
Definition: board.h:232
TRACKS m_tracks
Definition: board.h:201
unsigned GetNodesCount(int aNet=-1) const
Definition: board.cpp:999
unsigned GetPadCount() const
Definition: board.cpp:1884
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:397
#define _(s)
Definition: 3d_actions.cpp:33
unsigned GetNetCount() const
Function GetNetCount.
Definition: netinfo.h:353
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
Definition: track.h:83

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

◆ GetNetClassAssignmentCandidates()

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

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

1386 {
1387  std::vector<wxString> names;
1388 
1389  for( NETINFO_ITEM* net : m_NetInfo )
1390  {
1391  if( !net->GetNetname().IsEmpty() )
1392  names.emplace_back( net->GetNetname() );
1393  }
1394 
1395  return names;
1396 }
NETINFO_LIST m_NetInfo
Definition: board.h:232
NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65

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

767  {
768  return m_NetInfo.GetNetCount();
769  }
NETINFO_LIST m_NetInfo
Definition: board.h:232
unsigned GetNetCount() const
Function GetNetCount.
Definition: netinfo.h:353

References NETINFO_LIST::GetNetCount(), and m_NetInfo.

Referenced by CreateSignalsSection(), DSN::SPECCTRA_DB::FromBOARD(), and PCB_DRAW_PANEL_GAL::GetMsgPanelInfo().

◆ GetNetInfo() [1/2]

◆ GetNetInfo() [2/2]

NETINFO_LIST& BOARD::GetNetInfo ( )
inline

Definition at line 740 of file board.h.

741  {
742  return m_NetInfo;
743  }
NETINFO_LIST m_NetInfo
Definition: board.h:232

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

1000 {
1001  unsigned retval = 0;
1002 
1003  for( FOOTPRINT* footprint : Footprints() )
1004  {
1005  for( PAD* pad : footprint->Pads() )
1006  {
1007  if( ( aNet == -1 && pad->GetNetCode() > 0 ) || aNet == pad->GetNetCode() )
1008  retval++;
1009  }
1010  }
1011 
1012  return retval;
1013 }
FOOTPRINTS & Footprints()
Definition: board.h:286
Definition: pad.h:60

References Footprints().

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

◆ GetPad() [1/4]

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

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

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

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

Referenced by GetPad().

◆ GetPad() [2/4]

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

Definition at line 994 of file board.h.

995  {
996  return GetPad( aPosition, LSET().set() );
997  }
PAD * GetPad(const wxPoint &aPosition, LSET aLayerMask)
Find a pad aPosition on aLayer.
Definition: board.cpp:1473
LSET is a set of PCB_LAYER_IDs.

References GetPad().

◆ GetPad() [3/4]

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

Find a pad connected to aEndPoint of aTrace.

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

Definition at line 1493 of file board.cpp.

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

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

◆ GetPad() [4/4]

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

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

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

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

Definition at line 1522 of file board.cpp.

1523 {
1524  // Search aPadList for aPosition
1525  // aPadList is sorted by X then Y values, and a fast binary search is used
1526  int idxmax = aPadList.size()-1;
1527 
1528  int delta = aPadList.size();
1529 
1530  int idx = 0; // Starting index is the beginning of list
1531 
1532  while( delta )
1533  {
1534  // Calculate half size of remaining interval to test.
1535  // Ensure the computed value is not truncated (too small)
1536  if( (delta & 1) && ( delta > 1 ) )
1537  delta++;
1538 
1539  delta /= 2;
1540 
1541  PAD* pad = aPadList[idx];
1542 
1543  if( pad->GetPosition() == aPosition ) // candidate found
1544  {
1545  // The pad must match the layer mask:
1546  if( ( aLayerSet & pad->GetLayerSet() ).any() )
1547  return pad;
1548 
1549  // More than one pad can be at aPosition
1550  // search for a pad at aPosition that matched this mask
1551 
1552  // search next
1553  for( int ii = idx+1; ii <= idxmax; ii++ )
1554  {
1555  pad = aPadList[ii];
1556 
1557  if( pad->GetPosition() != aPosition )
1558  break;
1559 
1560  if( ( aLayerSet & pad->GetLayerSet() ).any() )
1561  return pad;
1562  }
1563  // search previous
1564  for( int ii = idx-1 ;ii >=0; ii-- )
1565  {
1566  pad = aPadList[ii];
1567 
1568  if( pad->GetPosition() != aPosition )
1569  break;
1570 
1571  if( ( aLayerSet & pad->GetLayerSet() ).any() )
1572  return pad;
1573  }
1574 
1575  // Not found:
1576  return 0;
1577  }
1578 
1579  if( pad->GetPosition().x == aPosition.x ) // Must search considering Y coordinate
1580  {
1581  if( pad->GetPosition().y < aPosition.y ) // 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  else if( pad->GetPosition().x < aPosition.x ) // Must search after this item
1597  {
1598  idx += delta;
1599 
1600  if( idx > idxmax )
1601  idx = idxmax;
1602  }
1603  else // Must search before this item
1604  {
1605  idx -= delta;
1606 
1607  if( idx < 0 )
1608  idx = 0;
1609  }
1610  }
1611 
1612  return NULL;
1613 }
#define NULL
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: pad.h:356
wxPoint GetPosition() const override
Definition: pad.h:170
Definition: pad.h:60

References PAD::GetLayerSet(), PAD::GetPosition(), and NULL.

◆ GetPadCount()

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

Definition at line 1884 of file board.cpp.

1885 {
1886  unsigned retval = 0;
1887 
1888  for( FOOTPRINT* footprint : Footprints() )
1889  retval += footprint->Pads().size();
1890 
1891  return retval;
1892 }
FOOTPRINTS & Footprints()
Definition: board.h:286

References Footprints().

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

◆ GetPadFast()

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

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

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

References Footprints().

◆ GetPads()

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

Return a reference to a list of all the pads.

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

Returns
D_PADS - a full list of pads

Definition at line 1870 of file board.cpp.

1871 {
1872  std::vector<PAD*> allPads;
1873 
1874  for( FOOTPRINT* footprint : Footprints() )
1875  {
1876  for( PAD* pad : footprint->Pads() )
1877  allPads.push_back( pad );
1878  }
1879 
1880  return allPads;
1881 }
FOOTPRINTS & Footprints()
Definition: board.h:286
Definition: pad.h:60

References Footprints().

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

◆ GetPageSettings()

◆ GetParent()

BOARD_ITEM_CONTAINER* BOARD_ITEM::GetParent ( void  ) const
inlineinherited

Definition at line 168 of file board_item.h.

168 { return (BOARD_ITEM_CONTAINER*) m_parent; }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:527
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(), FOOTPRINT::CoverageRatio(), EDIT_TOOL::CreateArray(), BOARD_ITEM::DeleteStructure(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::Drag(), KIGFX::PCB_PAINTER::draw(), EDIT_TOOL::Duplicate(), PCB_SELECTION_TOOL::FilterCollectorForGroups(), EDIT_TOOL::Flip(), PCB_IO::format(), FormatProbeItem(), BOARD_ITEM::GetBoard(), PCB_MARKER::GetColorLayer(), ALIGN_DISTRIBUTE_TOOL::GetSelections(), FP_TEXT::GetSelectMenuText(), PCB_TEXT::GetShownText(), FP_TEXT::GetShownText(), GENERAL_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), isNetTie(), FP_SHAPE::IsParentFlipped(), FP_TEXT::IsParentFlipped(), LEGACY_PLUGIN::loadMODULE_TEXT(), memberOf(), EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), ALTIUM_PCB::ParseTexts6Data(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), POSITION_RELATIVE_TOOL::PositionRelative(), BOARD_COMMIT::Push(), EDIT_TOOL::Rotate(), DRC_TEST_PROVIDER_SILK_CLEARANCE::Run(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), CLIPBOARD_IO::SaveSelection(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::Selectable(), SwapItemData(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem(), PCB_GROUP::TopLevelGroup(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), PCB_MARKER::ViewGetLayers(), FP_ZONE::ViewGetLOD(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem(), and PCB_GROUP::WithinScope().

◆ GetParentGroup()

◆ GetPlotOptions()

const PCB_PLOT_PARAMS& BOARD::GetPlotOptions ( ) const
inline

Definition at line 592 of file board.h.

592 { return m_plotOptions; }
PCB_PLOT_PARAMS m_plotOptions
Definition: board.h:217

References m_plotOptions.

Referenced by AddGerberX2Header(), PLACEFILE_GERBER_WRITER::CreatePlaceFile(), PCB_IO::formatSetup(), and PCB_BASE_FRAME::GetPlotSettings().

◆ GetPosition()

wxPoint BOARD::GetPosition ( ) const
overridevirtual

Reimplemented from EDA_ITEM.

Definition at line 236 of file board.cpp.

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

References BOARD_ITEM::ZeroOffset.

◆ GetProject()

PROJECT* BOARD::GetProject ( ) const
inline

◆ GetProperties()

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

Definition at line 311 of file board.h.

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

References m_properties.

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

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

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

References _, and Format().

◆ GetSortedPadListByXthenYCoord()

void BOARD::GetSortedPadListByXthenYCoord ( std::vector< PAD * > &  aVector,
int  aNetCode = -1 
)

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

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

References Footprints(), and sortPadsByXthenYCoord().

◆ GetStandardLayerName()

static wxString BOARD::GetStandardLayerName ( PCB_LAYER_ID  aLayerId)
inlinestatic

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

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

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

Definition at line 657 of file board.h.

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

References LayerName().

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

◆ GetState()

int EDA_ITEM::GetState ( int  type) const
inlineinherited

Definition at line 185 of file eda_item.h.

186  {
187  return m_status & type;
188  }
STATUS_FLAGS m_status
Definition: eda_item.h:526

References EDA_ITEM::m_status.

Referenced by BOARD_ITEM::IsLocked().

◆ GetStatus()

STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 198 of file eda_item.h.

198 { return m_status; }
STATUS_FLAGS m_status
Definition: eda_item.h:526

References EDA_ITEM::m_status.

◆ GetTitleBlock() [1/2]

TITLE_BLOCK& BOARD::GetTitleBlock ( )
inline

◆ GetTitleBlock() [2/2]

const TITLE_BLOCK& BOARD::GetTitleBlock ( ) const
inline

Definition at line 596 of file board.h.

596 { return m_titles; }
TITLE_BLOCK m_titles
Definition: board.h:216

References m_titles.

◆ GetTrackLength()

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

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

This uses the connectivity data for the board to calculate connections

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

Definition at line 1655 of file board.cpp.

1656 {
1657  int count = 0;
1658  double length = 0.0;
1659  double package_length = 0.0;
1660 
1661  constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T, PCB_PAD_T, EOT };
1662  auto connectivity = GetBoard()->GetConnectivity();
1663 
1664  for( BOARD_CONNECTED_ITEM* item : connectivity->GetConnectedItems(
1665  static_cast<const BOARD_CONNECTED_ITEM*>( &aTrack ), types ) )
1666  {
1667  count++;
1668 
1669  if( TRACK* track = dyn_cast<TRACK*>( item ) )
1670  {
1671  bool inPad = false;
1672 
1673  for( auto pad_it : connectivity->GetConnectedPads( item ) )
1674  {
1675  PAD* pad = static_cast<PAD*>( pad_it );
1676 
1677  if( pad->HitTest( track->GetStart(), track->GetWidth() / 2 )
1678  && pad->HitTest( track->GetEnd(), track->GetWidth() / 2 ) )
1679  {
1680  inPad = true;
1681  break;
1682  }
1683  }
1684 
1685  if( !inPad )
1686  length += track->GetLength();
1687  }
1688  else if( PAD* pad = dyn_cast<PAD*>( item ) )
1689  {
1690  package_length += pad->GetPadToDieLength();
1691  }
1692  }
1693 
1694  return std::make_tuple( count, length, package_length );
1695 }
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is contained within or on the bounding box of an item.
Definition: pcbnew/pad.cpp:950
class ARC, an arc track segment on a copper layer
Definition: typeinfo.h:97
class PAD, a pad in a footprint
Definition: typeinfo.h:89
BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected and have...
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:46
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:397
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
Definition: pad.h:60
int GetPadToDieLength() const
Definition: pad.h:369
Definition: track.h:83

References EOT, BOARD_ITEM::GetBoard(), GetConnectivity(), PAD::HitTest(), PCB_ARC_T, PCB_PAD_T, PCB_TRACE_T, and PCB_VIA_T.

Referenced by TRACK::GetMsgPanelInfo().

◆ GetUnconnectedNetCount()

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

Definition at line 1016 of file board.cpp.

1017 {
1018  return m_connectivity->GetUnconnectedCount();
1019 }
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: board.h:213

References m_connectivity.

◆ GetVisibleElements()

GAL_SET BOARD::GetVisibleElements ( ) const

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

Returns
the set of visible GAL layers
See also
enum GAL_LAYER_ID

Definition at line 501 of file board.cpp.

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

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

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

◆ GetVisibleLayers()

LSET BOARD::GetVisibleLayers ( ) const

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

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

Definition at line 461 of file board.cpp.

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

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

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

◆ GetX()

int BOARD_ITEM::GetX ( ) const
inlineinherited

◆ GetY()

int BOARD_ITEM::GetY ( ) const
inlineinherited

◆ GetZoneList()

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

Definition at line 1762 of file board.cpp.

1763 {
1764  std::list<ZONE*> zones;
1765 
1766  for( ZONE* zone : Zones() )
1767  zones.push_back( zone );
1768 
1769  if( aIncludeZonesInFootprints )
1770  {
1771  for( FOOTPRINT* footprint : m_footprints )
1772  {
1773  for( FP_ZONE* zone : footprint->Zones() )
1774  zones.push_back( zone );
1775  }
1776  }
1777 
1778  return zones;
1779 }
ZONES & Zones()
Definition: board.h:292
ZONE handles a list of polygons defining a copper zone.
Definition: zone.h:57
FOOTPRINTS m_footprints
Definition: board.h:200
FP_ZONE is a specialization of ZONE for use in footprints.
Definition: zone.h:965

References m_footprints, and Zones().

◆ GetZoneSettings()

const ZONE_SETTINGS& BOARD::GetZoneSettings ( ) const
inlineoverridevirtual

Fetch the zone settings for this container.

Reimplemented from BOARD_ITEM_CONTAINER.

Definition at line 579 of file board.h.

580  {
582  }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.h:574
ZONE_SETTINGS & GetDefaultZoneSettings()

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

Referenced by LEGACY_PLUGIN::loadSETUP().

◆ GroupLegalOps()

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

Definition at line 2086 of file board.cpp.

2087 {
2088  bool hasGroup = false;
2089  bool hasMember = false;
2090 
2091  for( EDA_ITEM* item : selection )
2092  {
2093  if( item->Type() == PCB_GROUP_T )
2094  hasGroup = true;
2095 
2096  if( item->GetParent() && item->GetParent()->Type() == PCB_GROUP_T )
2097  hasMember = true;
2098  }
2099 
2100  GroupLegalOpsField legalOps;
2101 
2102  legalOps.create = true;
2103  legalOps.removeItems = hasMember;
2104  legalOps.ungroup = hasGroup;
2105  legalOps.enter = hasGroup && selection.Size() == 1;
2106 
2107  return legalOps;
2108 }
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:148

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

◆ Groups() [1/2]

GROUPS& BOARD::Groups ( )
inline

The groups must maintain the following invariants.

These are checked by GroupsSanityCheck():

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

Definition at line 306 of file board.h.

306 { return m_groups; }
GROUPS m_groups
Definition: board.h:202

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

307 { return m_groups; }
GROUPS m_groups
Definition: board.h:202

References m_groups.

◆ GroupsSanityCheck()

wxString BOARD::GroupsSanityCheck ( bool  repair = false)

Definition at line 2009 of file board.cpp.

2010 {
2011  if( repair )
2012  {
2013  while( GroupsSanityCheckInternal( repair ) != wxEmptyString );
2014  return wxEmptyString;
2015  }
2016  return GroupsSanityCheckInternal( repair );
2017 }
wxString GroupsSanityCheckInternal(bool repair)
Definition: board.cpp:2020

References GroupsSanityCheckInternal().

Referenced by PCB_IO::Save().

◆ GroupsSanityCheckInternal()

wxString BOARD::GroupsSanityCheckInternal ( bool  repair)

Definition at line 2020 of file board.cpp.

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

References BOARD_ITEM::GetParentGroup(), Groups(), and Remove().

Referenced by GroupsSanityCheck().

◆ HasFlag()

◆ HighLightOFF()

void BOARD::HighLightOFF ( )
inline

Disable net highlight.

Definition at line 465 of file board.h.

466  {
467  HighLightON( false );
468  }
void HighLightON(bool aValue=true)
Enable or disable net highlighting.
Definition: board.cpp:1999

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

2000 {
2001  if( m_highLight.m_highLightOn != aValue )
2002  {
2003  m_highLight.m_highLightOn = aValue;
2005  }
2006 }
void InvokeListeners(Func &&aFunc, Args &&... args)
Definition: board.h:243
HIGH_LIGHT_INFO m_highLight
Definition: board.h:207
bool m_highLightOn
Definition: board.h:134
virtual void OnBoardHighlightNetChanged(BOARD &aBoard)
Definition: board.h:166

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

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

◆ HitTest() [1/2]

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

◆ HitTest() [2/2]

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

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

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

Reimplemented in SCH_COMPONENT, PAD, SCH_SHEET, ZONE, FOOTPRINT, VIA, WS_DRAW_ITEM_BITMAP, WS_DRAW_ITEM_TEXT, SCH_TEXT, ARC, PCB_SHAPE, GERBER_DRAW_ITEM, SCH_LINE, DIMENSION_BASE, WS_DRAW_ITEM_RECT, LIB_PIN, SCH_FIELD, LIB_ITEM, FP_TEXT, TRACK, WS_DRAW_ITEM_POLYPOLYGONS, PCB_GROUP, SCH_BITMAP, SCH_JUNCTION, SCH_NO_CONNECT, SCH_BUS_ENTRY_BASE, PCB_TEXT, WS_DRAW_ITEM_BASE, PCB_TARGET, LIB_POLYLINE, LIB_ARC, LIB_BEZIER, LIB_TEXT, LIB_RECTANGLE, and LIB_CIRCLE.

Definition at line 286 of file eda_item.h.

287  {
288  return false; // derived classes should override this function
289  }

◆ InvokeListeners()

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

Definition at line 243 of file board.h.

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

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

169 { return m_flags & IS_DRAGGED; }
#define IS_DRAGGED
Item being dragged.
Definition: eda_item.h:108
STATUS_FLAGS m_flags
Definition: eda_item.h:529

References IS_DRAGGED, and EDA_ITEM::m_flags.

Referenced by DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES(), and KIGFX::SCH_PAINTER::setDeviceColors().

◆ IsElementVisible()

bool BOARD::IsElementVisible ( GAL_LAYER_ID  aLayer) const

Test whether a given element category is visible.

Keep this as an inline function.

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

Definition at line 507 of file board.cpp.

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

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

335  {
336  return m_drawings.empty() && m_footprints.empty() && m_tracks.empty() && m_zones.empty();
337  }
TRACKS m_tracks
Definition: board.h:201
ZONES m_zones
Definition: board.h:203
DRAWINGS m_drawings
Definition: board.h:199
FOOTPRINTS m_footprints
Definition: board.h:200

References m_drawings, m_footprints, m_tracks, and m_zones.

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

◆ IsEntered()

bool EDA_ITEM::IsEntered ( ) const
inlineinherited

Definition at line 172 of file eda_item.h.

172 { return m_flags & ENTERED; }
#define ENTERED
indicates a group has been entered
Definition: eda_item.h:136
STATUS_FLAGS m_flags
Definition: eda_item.h:529

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

275  {
277  }
BOARD_USE m_boardUse
What is this board being used for.
Definition: board.h:195

References FPHOLDER, and m_boardUse.

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

◆ IsFootprintLayerVisible()

bool BOARD::IsFootprintLayerVisible ( PCB_LAYER_ID  aLayer)

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

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

Definition at line 546 of file board.cpp.

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

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

Referenced by GetFootprint().

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 254 of file eda_item.h.

254 { return m_forceVisible; }
bool m_forceVisible
Definition: eda_item.h:528

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

452 { return m_highLight.m_highLightOn; }
HIGH_LIGHT_INFO m_highLight
Definition: board.h:207
bool m_highLightOn
Definition: board.h:134

References m_highLight, and HIGH_LIGHT_INFO::m_highLightOn.

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

◆ IsLayerEnabled()

bool BOARD::IsLayerEnabled ( PCB_LAYER_ID  aLayer) const
inline

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

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

Definition at line 496 of file board.h.

497  {
498  return GetDesignSettings().IsLayerEnabled( aLayer );
499  }
bool IsLayerEnabled(PCB_LAYER_ID aLayerId) const
Test whether a given layer aLayerId is enabled.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.h:574

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(), PCB_LAYER_SELECTOR::isLayerEnabled(), PCB_LAYER_BOX_SELECTOR::isLayerEnabled(), SetLayerName(), SetLayerType(), PANEL_SETUP_LAYERS::setUserDefinedLayerCheckBoxes(), and DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZones().

◆ IsLayerVisible()

bool BOARD::IsLayerVisible ( PCB_LAYER_ID  aLayer) const

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

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

Definition at line 453 of file board.cpp.

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

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

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 166 of file eda_item.h.

166 { return m_flags & IS_CHANGED; }
#define IS_CHANGED
Item was edited, and modified.
Definition: eda_item.h:102
STATUS_FLAGS m_flags
Definition: eda_item.h:529

References IS_CHANGED, and EDA_ITEM::m_flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsNew()

◆ IsOnCopperLayer()

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

Reimplemented in TRACK, PAD, and ZONE.

Definition at line 144 of file board_item.h.

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

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

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

◆ IsOnLayer()

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

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

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

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

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

Definition at line 231 of file board_item.h.

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

References BOARD_ITEM::m_layer.

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

◆ IsReplaceable()

virtual bool EDA_ITEM::IsReplaceable ( ) const
inlinevirtualinherited

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

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

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

Definition at line 451 of file eda_item.h.

451 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 173 of file eda_item.h.

173 { return m_flags & IS_RESIZED; }
#define IS_RESIZED
Item being resized.
Definition: eda_item.h:107
STATUS_FLAGS m_flags
Definition: eda_item.h:529

References IS_RESIZED, and EDA_ITEM::m_flags.

Referenced by KIGFX::SCH_PAINTER::setDeviceColors().

◆ IsSelected()

◆ IsTrack()

bool BOARD_ITEM::IsTrack ( ) const
inlineinherited

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

Returns
true if a track or via, else false.

Definition at line 241 of file board_item.h.

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

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

◆ IsType()

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

Check whether the item is one of the listed types.

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

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

Definition at line 231 of file eda_item.h.

232  {
233  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
234  return true;
235 
236  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
237  {
238  if( m_structType == *p )
239  return true;
240  }
241 
242  return false;
243  }
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:536

References EOT, EDA_ITEM::m_structType, and SCH_LOCATE_ANY_T.

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

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 170 of file eda_item.h.

170 { return m_flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: eda_item.h:110
STATUS_FLAGS m_flags
Definition: eda_item.h:529

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

347  {
348  for( auto it : aList )
349  {
350  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
352  return SEARCH_RESULT::QUIT;
353  }
354 
356  }
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:107

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

364  {
365  for( auto it : aList )
366  {
367  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
369  return SEARCH_RESULT::QUIT;
370  }
371 
373  }
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:107

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

◆ layerMaskDescribe()

wxString BOARD_ITEM::layerMaskDescribe ( ) const
protectedvirtualinherited

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

The BOARD is needed because layer names are customizable.

Reimplemented in VIA.

Definition at line 72 of file board_item.cpp.

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

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

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

◆ MapNets()

void BOARD::MapNets ( const BOARD aDestBoard)

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

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

Definition at line 1922 of file board.cpp.

1923 {
1924  for( BOARD_CONNECTED_ITEM* item : AllConnectedItems() )
1925  {
1926  NETINFO_ITEM* netInfo = aDestBoard->FindNet( item->GetNetname() );
1927 
1928  if( netInfo )
1929  item->SetNet( netInfo );
1930  else
1931  item->SetNetCode( 0 );
1932  }
1933 }
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition: board.cpp:1261
BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected and have...
const std::vector< BOARD_CONNECTED_ITEM * > AllConnectedItems()
Definition: board.cpp:1895
void SetNetCode(int aNetCode)
Definition: netinfo.h:132
NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65

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

◆ Markers() [1/2]

◆ Markers() [2/2]

const MARKERS& BOARD::Markers ( ) const
inline

Definition at line 296 of file board.h.

296 { return m_markers; }
MARKERS m_markers
Definition: board.h:198

References m_markers.

◆ Matches() [1/2]

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

Compare the item against the search criteria in aSearchData.

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

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

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

Definition at line 413 of file eda_item.h.

414  {
415  return false;
416  }

Referenced by SCH_EDITOR_CONTROL::HasMatch(), PCB_TEXT::Matches(), FP_TEXT::Matches(), PCB_MARKER::Matches(), SCH_MARKER::Matches(), SCH_PIN::Matches(), ZONE::Matches(), SCH_FIELD::Matches(), SCH_SHEET_PIN::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 132 of file eda_item.cpp.

133 {
134  wxString text = aText;
135  wxString searchText = aSearchData.GetFindString();
136 
137  // Don't match if searching for replaceable item and the item doesn't support text replace.
138  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
139  return false;
140 
141  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
142  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
143 
144  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
145  {
146  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
147  return text.Matches( searchText );
148 
149  return text.MakeUpper().Matches( searchText.MakeUpper() );
150  }
151 
152  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
153  return aText.Find( searchText ) != wxNOT_FOUND;
154 
155  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
156 }
virtual bool IsReplaceable() const
Override this method in any derived object that supports test find and replace.
Definition: eda_item.h:451

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

◆ Move() [1/2]

void BOARD_ITEM::Move ( const VECTOR2I aMoveVector)
inlineinherited

Definition at line 283 of file board_item.h.

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

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

◆ Move() [2/2]

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

Move this object.

Parameters
aMoveVectorthe move vector for this object.

Reimplemented from BOARD_ITEM.

Definition at line 248 of file board.cpp.

249 {
250  // @todo : anything like this elsewhere? maybe put into GENERAL_COLLECTOR class.
251  static const KICAD_T top_level_board_stuff[] = {
252  PCB_MARKER_T,
253  PCB_TEXT_T,
254  PCB_SHAPE_T,
25