KiCad PCB EDA Suite
BOARD Class Reference

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

#include <class_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 ()
 Get what the board use is. More...
 
bool IsFootprintHolder ()
 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
 
MODULES & Modules ()
 
const MODULES & Modules () const
 
DRAWINGS & Drawings ()
 
const DRAWINGS & Drawings () const
 
ZONE_CONTAINERS & Zones ()
 
const ZONE_CONTAINERS & Zones () const
 
MARKERS & Markers ()
 
GROUPS & Groups ()
 The groups must maintain the following invariants. More...
 
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
 Function GetFocusPosition 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
 Function Move 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) override
 Removes an item from the container. More...
 
MODULEGetFirstModule () const
 Gets the first module in the list (used in footprint viewer/editor) or NULL if none. More...
 
void DeleteAllModules ()
 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< MARKER_PCB * > 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 IsModuleLayerVisible (PCB_LAYER_ID aLayer)
 Expect either of the two layers on which a module 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 ()
 
void SetTitleBlock (const TITLE_BLOCK &aTitleBlock)
 
wxString GetSelectMenuText (EDA_UNITS aUnits) const override
 Function GetSelectMenuText returns 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, wxString *aErrorText=nullptr, std::vector< wxPoint > *aDiscontinuities=nullptr, std::vector< wxPoint > *aIntersections=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< D_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
 Function GetBoundingBox returns 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
 Function GetMsgPanelInfo populates 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...
 
MODULEFindModuleByReference (const wxString &aReference) const
 Search for a MODULE within this board with the given reference designator. More...
 
MODULEFindModuleByPath (const KIID_PATH &aPath) const
 Search for a MODULE 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
 Function GetClass returns 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...
 
ZONE_CONTAINERGetArea (int index) const
 Return the Area (Zone Container) at a given index. More...
 
std::list< ZONE_CONTAINER * > GetZoneList (bool aIncludeZonesInFootprints=false)
 
int GetAreaCount () const
 
ZONE_CONTAINERAddArea (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_CONTAINER *aCurrArea)
 Process an area that has been modified, by normalizing its polygon against itself. More...
 
bool OnAreaPolygonModified (PICKED_ITEMS_LIST *aModifiedZonesList, ZONE_CONTAINER *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 CombineAllAreasInNet (PICKED_ITEMS_LIST *aDeletedList, int aNetCode, bool aUseLocalFlags)
 Check all copper areas in net for intersections, combining them if found. More...
 
void RemoveArea (PICKED_ITEMS_LIST *aDeletedList, ZONE_CONTAINER *area_to_remove)
 Remove copper area from net, and put it in a deleted list (if exists). More...
 
bool TestAreaIntersections (ZONE_CONTAINER *area_to_test)
 Check for intersection of a given copper area with other areas in same net. More...
 
bool TestAreaIntersection (ZONE_CONTAINER *area_ref, ZONE_CONTAINER *area_to_test)
 Test for intersection of 2 copper areas. More...
 
bool CombineAreas (PICKED_ITEMS_LIST *aDeletedList, ZONE_CONTAINER *area_ref, ZONE_CONTAINER *area_to_combine)
 If possible, combine 2 copper areas. More...
 
D_PADGetPad (const wxPoint &aPosition, LSET aLayerMask)
 Find a pad aPosition on aLayer. More...
 
D_PADGetPad (const wxPoint &aPosition)
 
D_PADGetPad (TRACK *aTrace, ENDPOINT_T aEndPoint)
 Find a pad connected to aEndPoint of aTrace. More...
 
D_PADGetPadFast (const wxPoint &aPosition, LSET aLayerMask)
 Return pad found at aPosition on aLayerMask using the fast search method. More...
 
D_PADGetPad (std::vector< D_PAD * > &aPadList, const wxPoint &aPosition, LSET aLayerMask)
 Locate the pad connected at aPosition on aLayer starting at list position aPad. More...
 
void PadDelete (D_PAD *aPad)
 Delete a given pad from the BOARD by removing it from its module and from the m_NetInfo. More...
 
void GetSortedPadListByXthenYCoord (std::vector< D_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...
 
MODULEGetFootprint (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...
 
wxString GroupsSanityCheck (bool repair=false)
 
wxString GroupsSanityCheckInternal (bool repair)
 
GroupLegalOpsField GroupLegalOps (const PCBNEW_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
 Function GetCenter() More...
 
void SetX (int aX)
 
void SetY (int aY)
 
virtual bool IsConnected () const
 Function IsConnected() 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
 Function GetEffectiveShape 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
 Function GetLayer returns the primary layer this item is on. More...
 
virtual LSET GetLayerSet () const
 Function GetLayerSet returns 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)
 Function SetLayer sets the layer this item is on. More...
 
virtual BOARD_ITEMDuplicate () const
 Function Duplicate creates a copy of a BOARD_ITEM. More...
 
virtual void SwapData (BOARD_ITEM *aImage)
 Swap data between aItem and aImage. More...
 
virtual bool IsOnLayer (PCB_LAYER_ID aLayer) const
 Function IsOnLayer tests to see if this object is on the given layer. More...
 
bool IsTrack () const
 Function IsTrack tests to see if this object is a track or via (or microvia). More...
 
virtual bool IsLocked () const
 Function IsLocked. More...
 
virtual void SetLocked (bool aLocked)
 Function SetLocked modifies 'lock' status for of the item. More...
 
void DeleteStructure ()
 Function DeleteStructure deletes 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)
 Function Rotate Rotate this object. More...
 
void Rotate (const VECTOR2I &aRotCentre, double aAngle)
 
virtual void Flip (const wxPoint &aCentre, bool aFlipLeftRight)
 Function Flip Flip this object, i.e. More...
 
void Flip (const VECTOR2I &aCentre, bool aFlipLeftRight)
 
virtual BOARDGetBoard () const
 Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none. More...
 
wxString GetLayerName () const
 Function GetLayerName returns the name of the PCB layer on which the item resides. More...
 
virtual void ViewGetLayers (int aLayers[], int &aCount) const override
 Function ViewGetLayers() Returns 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
 Function TransformShapeWithClearanceToPolygon Convert the item shape to a closed polygon Used in filling zones calculations Circles and arcs are approximated by segments. More...
 
KICAD_T Type () const
 Function Type() 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 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)
 
STATUS_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
virtual bool IsType (const KICAD_T aScanTypes[]) const
 Function IsType Checks whether the item is one of the listed types. More...
 
void SetForceVisible (bool aEnable)
 Function SetForceVisible is used to set and cleag 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
 Function HitTest tests 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
 Function HitTest tests if aRect intersects or is contained within the bounding box of an item. More...
 
virtual EDA_ITEMClone () const
 Function Clone creates a duplicate of this item with linked list members set to NULL. More...
 
virtual BITMAP_DEF GetMenuImage () const
 Function GetMenuImage returns a pointer to an image to be used in menus. More...
 
virtual bool Matches (wxFindReplaceData &aSearchData, void *aAuxData)
 Function Matches compares the item against the search criteria in aSearchData. More...
 
virtual bool Replace (wxFindReplaceData &aSearchData, void *aAuxData=NULL)
 Function Replace performs a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Function IsReplaceable. More...
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
virtual const BOX2I ViewBBox () const override
 Function ViewBBox() returns the bounding box of the item covering all its layers. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Function ViewDraw() Draws the parts of the object belonging to layer aLayer. More...
 
virtual double ViewGetLOD (int aLayer, VIEW *aView) const
 Function ViewGetLOD() Returns 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)
 Function ShowShape converts 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[])
 IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T ) More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::vector< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T ) More...
 
static bool Replace (wxFindReplaceData &aSearchData, wxString &aText)
 Helper function used in search and replace dialog Function Replace performs 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)
 Function Sort is a 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_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
 Helper function Return a string (to be shown to the user) describing a layer mask. More...
 
bool Matches (const wxString &aText, wxFindReplaceData &aSearchData)
 Function Matches compares aText against search criteria in aSearchData. More...
 

Protected Attributes

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
 
MODULES m_modules
 
TRACKS m_tracks
 
GROUPS m_groups
 
ZONE_CONTAINERS m_zones
 
LAYER m_Layer [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 186 of file class_board.h.

Constructor & Destructor Documentation

◆ BOARD() [1/2]

BOARD::BOARD ( const BOARD aOther)
privatedelete

◆ BOARD() [2/2]

BOARD::BOARD ( )

Definition at line 60 of file class_board.cpp.

60  :
64  m_project( nullptr ),
65  m_designSettings( new BOARD_DESIGN_SETTINGS( nullptr, "board.design_settings" ) ),
66  m_NetInfo( this ),
69 {
70  // we have not loaded a board yet, assume latest until then.
71  m_fileFormatVersionAtLoad = LEGACY_BOARD_FILE_VERSION;
72 
73  for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
74  {
75  m_Layer[layer].m_name = GetStandardLayerName( ToLAYER_ID( layer ) );
76 
77  if( IsCopperLayer( layer ) )
78  m_Layer[layer].m_type = LT_SIGNAL;
79  else
80  m_Layer[layer].m_type = LT_UNDEFINED;
81  }
82 
84 
85  // Initialize default netclass.
86  NETCLASS* defaultClass = bds.GetDefault();
87  defaultClass->SetDescription( _( "This is the default net class." ) );
88 
89  bds.UseCustomTrackViaSize( false );
90 
91  // Initialize ratsnest
92  m_connectivity.reset( new CONNECTIVITY_DATA() );
93 
94  // Set flag bits on these that will only be cleared if these are loaded from a legacy file
95  m_LegacyVisibleLayers.reset().set( Rescue );
97 }
Definition: typeinfo.h:85
bool m_LegacyDesignSettingsLoaded
True if the legacy board design settings were loaded from a file.
Definition: class_board.h:317
wxString m_name
The canonical name of the layer.
Definition: class_board.h:102
bool m_LegacyNetclassesLoaded
True if netclasses were loaded from the file.
Definition: class_board.h:320
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
PAGE_INFO m_paper
Definition: class_board.h:213
LAYER_T m_type
The type of the layer.
Definition: class_board.h:104
void SetDescription(const wxString &aDesc)
Definition: netclass.h:156
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: class_board.h:558
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: class_board.h:230
BOARD_USE m_boardUse
What is this board being used for.
Definition: class_board.h:192
#define NULL
#define GAL_LAYER_INDEX(x)
Use this macro to convert a GAL layer to a 0-indexed offset from LAYER_VIAS.
NETCLASS handles a collection of nets and the parameters used to route or test these nets.
Definition: netclass.h:49
static const wxChar A4[]
Definition: page_info.h:65
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: class_board.h:228
int LAYER_NUM
This can be replaced with int and removed.
int m_fileFormatVersionAtLoad
Definition: class_board.h:208
#define _(s)
Definition: 3d_actions.cpp:33
LAYER m_Layer[PCB_LAYER_ID_COUNT]
Definition: class_board.h:202
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: class_board.h:211
NETCLASS * GetDefault() const
Function GetDefault.
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: class_board.h:313
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:897
void UseCustomTrackViaSize(bool aEnabled)
Function UseCustomTrackViaSize Enables/disables custom track/via size settings.
PROJECT * m_project
Definition: class_board.h:216
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition: class_board.h:646
BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.
GAL_SET m_LegacyVisibleItems
Definition: class_board.h:314

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

◆ ~BOARD()

BOARD::~BOARD ( )

Definition at line 100 of file class_board.cpp.

101 {
102  // Clean up the owned elements
103  DeleteMARKERs();
104 
105  for( ZONE_CONTAINER* zone : m_zones )
106  delete zone;
107 
108  m_zones.clear();
109 
110  for( MODULE* m : m_modules )
111  delete m;
112 
113  m_modules.clear();
114 
115  for( TRACK* t : m_tracks )
116  delete t;
117 
118  m_tracks.clear();
119 
120  for( BOARD_ITEM* d : m_drawings )
121  delete d;
122 
123  m_drawings.clear();
124 
125  for( PCB_GROUP* g : m_groups )
126  delete g;
127 
128  m_groups.clear();
129 }
MODULES m_modules
Definition: class_board.h:197
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
PCB_GROUP is a set of BOARD_ITEMs (i.e., without duplicates)
GROUPS m_groups
Definition: class_board.h:199
TRACKS m_tracks
Definition: class_board.h:198
void DeleteMARKERs()
Delete all MARKERS from the board.
DRAWINGS m_drawings
Definition: class_board.h:196
ZONE_CONTAINERS m_zones
Definition: class_board.h:200

References DeleteMARKERs(), m_drawings, m_groups, m_modules, 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 550 of file class_board.cpp.

551 {
552  if( aBoardItem == NULL )
553  {
554  wxFAIL_MSG( wxT( "BOARD::Add() param error: aBoardItem NULL" ) );
555  return;
556  }
557 
558  switch( aBoardItem->Type() )
559  {
560  case PCB_NETINFO_T:
561  m_NetInfo.AppendNet( (NETINFO_ITEM*) aBoardItem );
562  break;
563 
564  // this one uses a vector
565  case PCB_MARKER_T:
566  m_markers.push_back( (MARKER_PCB*) aBoardItem );
567  break;
568 
569  // this one uses a vector
570  case PCB_GROUP_T:
571  m_groups.push_back( (PCB_GROUP*) aBoardItem );
572  break;
573 
574  // this one uses a vector
575  case PCB_ZONE_AREA_T:
576  m_zones.push_back( (ZONE_CONTAINER*) aBoardItem );
577  break;
578 
579  case PCB_TRACE_T:
580  case PCB_VIA_T:
581  case PCB_ARC_T:
582 
583  // N.B. This inserts a small memory leak as we lose the
584  if( !IsCopperLayer( aBoardItem->GetLayer() ) )
585  {
586  wxFAIL_MSG( wxT( "BOARD::Add() Cannot place Track on non-copper layer" ) );
587  return;
588  }
589 
590  if( aMode == ADD_MODE::APPEND )
591  m_tracks.push_back( static_cast<TRACK*>( aBoardItem ) );
592  else
593  m_tracks.push_front( static_cast<TRACK*>( aBoardItem ) );
594 
595  break;
596 
597  case PCB_MODULE_T:
598  if( aMode == ADD_MODE::APPEND )
599  m_modules.push_back( (MODULE*) aBoardItem );
600  else
601  m_modules.push_front( (MODULE*) aBoardItem );
602 
603  break;
604 
605  case PCB_DIM_ALIGNED_T:
606  case PCB_DIM_CENTER_T:
608  case PCB_DIM_LEADER_T:
609  case PCB_SHAPE_T:
610  case PCB_TEXT_T:
611  case PCB_TARGET_T:
612  if( aMode == ADD_MODE::APPEND )
613  m_drawings.push_back( aBoardItem );
614  else
615  m_drawings.push_front( aBoardItem );
616 
617  break;
618 
619  // other types may use linked list
620  default:
621  {
622  wxString msg;
623  msg.Printf( wxT( "BOARD::Add() needs work: BOARD_ITEM type (%d) not handled" ),
624  aBoardItem->Type() );
625  wxFAIL_MSG( msg );
626  return;
627  }
628  break;
629  }
630 
631  aBoardItem->SetParent( this );
632  aBoardItem->ClearEditFlags();
633  m_connectivity->Add( aBoardItem );
634 
635  InvokeListeners( &BOARD_LISTENER::OnBoardItemAdded, *this, aBoardItem );
636 }
MODULES m_modules
Definition: class_board.h:197
void InvokeListeners(Func &&aFunc, Args &&... args)
Definition: class_board.h:241
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
class ALIGNED_DIMENSION, a linear dimension (graphic item)
Definition: typeinfo.h:101
class LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:102
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:109
PCB_GROUP is a set of BOARD_ITEMs (i.e., without duplicates)
GROUPS m_groups
Definition: class_board.h:199
class CENTER_DIMENSION, a center point marking (graphic item)
Definition: typeinfo.h:103
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:106
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:214
class PCB_TEXT, text on a layer
Definition: typeinfo.h:92
class ARC, an arc track segment on a copper layer
Definition: typeinfo.h:98
NETINFO_LIST m_NetInfo
Definition: class_board.h:230
TRACKS m_tracks
Definition: class_board.h:198
virtual void OnBoardItemAdded(BOARD &aBoard, BOARD_ITEM *aBoardItem)
Definition: class_board.h:159
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:185
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
void AppendNet(NETINFO_ITEM *aNewElement)
Function AppendNet adds aNewElement to the end of the net list.
class MODULE, a footprint
Definition: typeinfo.h:89
#define NULL
MARKERS m_markers
Definition: class_board.h:195
DRAWINGS m_drawings
Definition: class_board.h:196
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:105
ZONE_CONTAINERS m_zones
Definition: class_board.h:200
NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
class MARKER_PCB, a marker used to show something
Definition: typeinfo.h:99
class NETINFO_ITEM, a description of a net
Definition: typeinfo.h:108
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: class_board.h:211
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
class ORTHOGONAL_DIMENSION, a linear dimension constrained to x/y
Definition: typeinfo.h:104
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
void ClearEditFlags()
Definition: eda_item.h:240
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:91
KICAD_T Type() const
Function Type()
Definition: eda_item.h:182

References APPEND, NETINFO_LIST::AppendNet(), EDA_ITEM::ClearEditFlags(), ZONE_CONTAINER::GetLayer(), InvokeListeners(), IsCopperLayer(), m_connectivity, m_drawings, m_groups, m_markers, m_modules, 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_GROUP_T, PCB_MARKER_T, PCB_MODULE_T, PCB_NETINFO_T, PCB_SHAPE_T, PCB_TARGET_T, PCB_TEXT_T, PCB_TRACE_T, PCB_VIA_T, PCB_ZONE_AREA_T, EDA_ITEM::SetParent(), and EDA_ITEM::Type().

Referenced by NET_SELECTOR_COMBOPOPUP::Accept(), PCB_BASE_FRAME::AddModuleToBoard(), PCAD2KICAD::PCB_TEXT::AddToBoard(), PCAD2KICAD::PCB_LINE::AddToBoard(), PCAD2KICAD::PCB_ARC::AddToBoard(), PCAD2KICAD::PCB_PAD::AddToBoard(), PCAD2KICAD::PCB_POLYGON::AddToBoard(), PCAD2KICAD::PCB::AddToBoard(), PCAD2KICAD::PCB_MODULE::AddToBoard(), PCAD2KICAD::PCB_PAD::AddToModule(), 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(), LEGACY_PLUGIN::loadNETINFO_ITEM(), LEGACY_PLUGIN::loadPCB_LINE(), LEGACY_PLUGIN::loadPCB_TARGET(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), EAGLE_PLUGIN::loadPolygon(), EAGLE_PLUGIN::loadSignals(), LEGACY_PLUGIN::loadTrackList(), LEGACY_PLUGIN::loadZONE_CONTAINER(), DIALOG_SELECT_NET_FROM_LIST::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(), PCB_EDITOR_CONTROL::RepairBoard(), BOARD_COMMIT::Revert(), and FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint().

◆ AddArea()

ZONE_CONTAINER * 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 1752 of file class_board.cpp.

1754 {
1755  ZONE_CONTAINER* new_area = new ZONE_CONTAINER( this );
1756 
1757  new_area->SetNetCode( aNetcode );
1758  new_area->SetLayer( aLayer );
1759 
1760  m_zones.push_back( new_area );
1761 
1762  new_area->SetHatchStyle( (ZONE_BORDER_DISPLAY_STYLE) aHatch );
1763 
1764  // Add the first corner to the new zone
1765  new_area->AppendCorner( aStartPointPosition, -1 );
1766 
1767  if( aNewZonesList )
1768  {
1769  ITEM_PICKER picker( nullptr, new_area, UNDO_REDO::NEWITEM );
1770  aNewZonesList->PushItem( picker );
1771  }
1772 
1773  return new_area;
1774 }
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
bool SetNetCode(int aNetCode, bool aNoAssert)
Sets net using a net code.
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Function SetLayer sets the layer this item is on.
Definition: class_zone.cpp:234
ZONE_CONTAINERS m_zones
Definition: class_board.h:200
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: class_zone.cpp:831
ZONE_BORDER_DISPLAY_STYLE
Zone border styles.
Definition: zone_settings.h:46
void SetHatchStyle(ZONE_BORDER_DISPLAY_STYLE aStyle)
Definition: class_zone.h:595

References ZONE_CONTAINER::AppendCorner(), m_zones, NEWITEM, PICKED_ITEMS_LIST::PushItem(), ZONE_CONTAINER::SetHatchStyle(), ZONE_CONTAINER::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 1933 of file class_board.cpp.

1934 {
1935  if( !alg::contains( m_listeners, aListener ) )
1936  m_listeners.push_back( aListener );
1937 }
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: class_board.h:232

References alg::contains(), and m_listeners.

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

◆ AllConnectedItems()

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

Definition at line 1882 of file class_board.cpp.

1883 {
1884  std::vector<BOARD_CONNECTED_ITEM*> items;
1885 
1886  for( TRACK* track : Tracks() )
1887  items.push_back( track );
1888 
1889  for( MODULE* footprint : Modules() )
1890  {
1891  for( D_PAD* pad : footprint->Pads() )
1892  items.push_back( pad );
1893  }
1894 
1895  for( ZONE_CONTAINER* zone : Zones() )
1896  items.push_back( zone );
1897 
1898  return items;
1899 }
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
MODULES & Modules()
Definition: class_board.h:284
ZONE_CONTAINERS & Zones()
Definition: class_board.h:290
TRACKS & Tracks()
Definition: class_board.h:281

References Modules(), 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 738 of file class_board.h.

739  {
740  return m_NetInfo.begin();
741  }
NETINFO_LIST m_NetInfo
Definition: class_board.h:230
iterator begin() const
Definition: netinfo.h:549

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 132 of file class_board.cpp.

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

References GetConnectivity().

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

◆ BuildListOfNets()

void BOARD::BuildListOfNets ( )
inline

Definition at line 705 of file class_board.h.

706  {
708  }
NETINFO_LIST m_NetInfo
Definition: class_board.h:230
void buildListOfNets()
Function buildListOfNets builds or rebuilds the list of NETINFO_ITEMs The list is sorted by names.

References NETINFO_LIST::buildListOfNets(), and m_NetInfo.

Referenced by PCBNEW_CONTROL::AppendBoard(), BOARD_NETLIST_UPDATER::deleteSinglePadNets(), FOOTPRINT_EDIT_FRAME::Import_Module(), LoadBoard(), PCB_EDIT_FRAME::OpenProjectFiles(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), and PCB_EDIT_FRAME::ShowBoardSetupDialog().

◆ ClassOf()

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

Definition at line 248 of file class_board.h.

249  {
250  return aItem && PCB_T == aItem->Type();
251  }
Definition: typeinfo.h:85
KICAD_T Type() const
Function Type()
Definition: eda_item.h:182

References PCB_T, and EDA_ITEM::Type().

◆ ClearAllNetCodes()

void BOARD::ClearAllNetCodes ( )

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

Definition at line 1902 of file class_board.cpp.

1903 {
1904  for( BOARD_CONNECTED_ITEM* item : AllConnectedItems() )
1905  item->SetNetCode( 0 );
1906 }
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()

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

222 { m_Flags &= ~aMask; }
STATUS_FLAGS m_Flags
Definition: eda_item.h:165

References EDA_ITEM::m_Flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_MOVE_TOOL::AlignElements(), MODULE::BuildPolyCourtyards(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), clearModuleItemFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), ConvertOutlineToPolygon(), SCH_EDIT_FRAME::ConvertPart(), LIB_EDIT_TOOL::Copy(), LIB_PIN_TOOL::CreateImagePins(), MICROWAVE_TOOL::createMicrowaveInductor(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), KIGFX::SCH_PAINTER::draw(), LIB_EDIT_TOOL::Duplicate(), SCH_ITEM::Duplicate(), PCB_EDIT_FRAME::ExchangeFootprint(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), FOOTPRINT_EDIT_FRAME::LoadModuleFromLibrary(), EE_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::narrowSelection(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), PCB_BASE_FRAME::PlaceModule(), LIB_PIN_TOOL::PlacePin(), DRAWING_TOOL::PlaceText(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), SCH_EDIT_FRAME::RecomputeIntersheetsRefs(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_PIN_TOOL::RepeatPin(), LIB_EDIT_FRAME::RollbackPartFromUndo(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN_CACHE::savePin(), SCH_LEGACY_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 164 of file class_board.cpp.

165 {
166  if( !m_project )
167  return;
168 
169  PROJECT_FILE& project = m_project->GetProjectFile();
170 
171  // Owned by the BOARD
172  if( project.m_BoardSettings )
173  {
174  project.ReleaseNestedSettings( project.m_BoardSettings );
175  project.m_BoardSettings = nullptr;
176  }
177 
178  GetDesignSettings().SetParent( nullptr );
179  m_project = nullptr;
180 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: class_board.h:558
PROJECT_FILE is the backing store for a PROJECT, in JSON format.
Definition: project_file.h:62
VTBL_ENTRY PROJECT_FILE & GetProjectFile() const
Definition: project.h:143
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: class_board.h:216
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(), and PCB_EDIT_FRAME::SavePcbFile().

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 234 of file eda_item.h.

235  {
237  DO_NOT_DRAW );
238  }
#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:222
#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 154 of file view_item.h.

155  {
157  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:162
#define NULL

References KIGFX::VIEW_ITEM::m_viewPrivData, and NULL.

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

◆ Clone()

EDA_ITEM * EDA_ITEM::Clone ( ) const
virtualinherited

Function Clone creates 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 MODULE_ZONE_CONTAINER, ZONE_CONTAINER, SCH_COMPONENT, D_PAD, MODULE, SCH_SHEET, CENTER_DIMENSION, LEADER, SCH_HIERLABEL, ORTHOGONAL_DIMENSION, VIA, SCH_GLOBALLABEL, SCH_LABEL, ALIGNED_DIMENSION, ARC, PCB_SHAPE, SCH_TEXT, LIB_PIN, SCH_LINE, TRACK, FP_TEXT, SCH_SHEET_PIN, SCH_BUS_BUS_ENTRY, SCH_FIELD, LIB_FIELD, SCH_BUS_WIRE_ENTRY, SCH_BITMAP, FP_SHAPE, LIB_ARC, PCB_TEXT, PCB_GROUP, SCH_NO_CONNECT, SCH_JUNCTION, LIB_POLYLINE, SCH_MARKER, LIB_TEXT, PCB_TARGET, LIB_CIRCLE, LIB_BEZIER, LIB_RECTANGLE, KIGFX::ORIGIN_VIEWITEM, and SCH_IREF.

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
Function GetClass returns the class name.

References EDA_ITEM::GetClass(), and NULL.

Referenced by DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), LIB_DRAWING_TOOLS::DrawShape(), LIB_EDIT_TOOL::Duplicate(), BOARD_ITEM::Duplicate(), SCH_ITEM::Duplicate(), LIB_PART::LIB_PART(), LIB_EDIT_FRAME::LoadOneSymbol(), new_clone(), LIB_PART::operator=(), LIB_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(), LIB_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ CombineAllAreasInNet()

bool BOARD::CombineAllAreasInNet ( PICKED_ITEMS_LIST aDeletedList,
int  aNetCode,
bool  aUseLocalFlags 
)

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
aUseLocalFlags: if true, don't check areas if both local flags are 0 Sets local flag = 1 for any areas modified
Returns
true if some areas modified

Definition at line 62 of file zones_test_and_combine_areas.cpp.

64 {
65  if( m_zones.size() <= 1 )
66  return false;
67 
68  bool modified = false;
69 
70  // Loop through all combinations
71  for( unsigned ia1 = 0; ia1 < m_zones.size() - 1; ia1++ )
72  {
73  ZONE_CONTAINER* curr_area = m_zones[ia1];
74 
75  if( curr_area->GetNetCode() != aNetCode )
76  continue;
77 
78  // legal polygon
79  BOX2I b1 = curr_area->Outline()->BBox();
80  bool mod_ia1 = false;
81 
82  for( unsigned ia2 = m_zones.size() - 1; ia2 > ia1; ia2-- )
83  {
84  ZONE_CONTAINER* area2 = m_zones[ia2];
85 
86  if( area2->GetNetCode() != aNetCode )
87  continue;
88 
89  if( curr_area->GetPriority() != area2->GetPriority() )
90  continue;
91 
92  if( curr_area->GetIsRuleArea() != area2->GetIsRuleArea() )
93  continue;
94 
95  if( curr_area->GetLayerSet() != area2->GetLayerSet() )
96  continue;
97 
98  BOX2I b2 = area2->Outline()->BBox();
99 
100  if( b1.Intersects( b2 ) )
101  {
102  // check area2 against curr_area
103  if( curr_area->GetLocalFlags() || area2->GetLocalFlags()
104  || aUseLocalFlags == false )
105  {
106  bool ret = TestAreaIntersection( curr_area, area2 );
107 
108  if( ret )
109  ret = CombineAreas( aDeletedList, curr_area, area2 );
110 
111  if( ret )
112  {
113  mod_ia1 = true;
114  modified = true;
115  }
116  }
117  }
118  }
119 
120  if( mod_ia1 )
121  ia1--; // if modified, we need to check it again
122  }
123 
124  return modified;
125 }
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
int GetNetCode() const
Function GetNetCode.
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:300
bool CombineAreas(PICKED_ITEMS_LIST *aDeletedList, ZONE_CONTAINER *area_ref, ZONE_CONTAINER *area_to_combine)
If possible, combine 2 copper areas.
bool TestAreaIntersection(ZONE_CONTAINER *area_ref, ZONE_CONTAINER *area_to_test)
Test for intersection of 2 copper areas.
virtual LSET GetLayerSet() const override
Function GetLayerSet returns a std::bitset of all layers on which the item physically resides.
Definition: class_zone.cpp:287
bool Intersects(const BOX2< Vec > &aRect) const
Function Intersects.
Definition: box2.h:236
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: class_zone.h:729
ZONE_CONTAINERS m_zones
Definition: class_board.h:200
unsigned GetPriority() const
Function GetPriority.
Definition: class_zone.h:106
const BOX2I BBox(int aClearance=0) const override
Function BBox()
int GetLocalFlags() const
Definition: class_zone.h:285

References SHAPE_POLY_SET::BBox(), CombineAreas(), ZONE_CONTAINER::GetIsRuleArea(), ZONE_CONTAINER::GetLayerSet(), ZONE_CONTAINER::GetLocalFlags(), BOARD_CONNECTED_ITEM::GetNetCode(), ZONE_CONTAINER::GetPriority(), BOX2< Vec >::Intersects(), m_zones, ZONE_CONTAINER::Outline(), and TestAreaIntersection().

Referenced by OnAreaPolygonModified().

◆ CombineAreas()

bool BOARD::CombineAreas ( PICKED_ITEMS_LIST aDeletedList,
ZONE_CONTAINER area_ref,
ZONE_CONTAINER area_to_combine 
)

If possible, combine 2 copper areas.

Parameters
aDeletedList= a PICKED_ITEMS_LIST * where to store deleted areas (useful for undo).
area_ref= the main area (zone)
area_to_combine= the zone that can be merged with area_ref area_ref must be BEFORE area_to_combine area_to_combine will be deleted, if areas are combined
Returns
: true if area_to_combine is combined with area_ref (and therefore be deleted)

Definition at line 255 of file zones_test_and_combine_areas.cpp.

257 {
258  if( area_ref == area_to_combine )
259  {
260  wxASSERT( 0 );
261  return false;
262  }
263 
264  SHAPE_POLY_SET mergedOutlines = *area_ref->Outline();
265  SHAPE_POLY_SET areaToMergePoly = *area_to_combine->Outline();
266 
267  mergedOutlines.BooleanAdd( areaToMergePoly, SHAPE_POLY_SET::PM_FAST );
268  mergedOutlines.Simplify( SHAPE_POLY_SET::PM_FAST );
269 
270  // We should have one polygon with hole
271  // We can have 2 polygons with hole, if the 2 initial polygons have only one common corner
272  // and therefore cannot be merged (they are dectected as intersecting)
273  // but we should never have more than 2 polys
274  if( mergedOutlines.OutlineCount() > 2 )
275  {
276  wxLogMessage( "BOARD::CombineAreas error: more than 2 polys after merging" );
277  return false;
278  }
279 
280  if( mergedOutlines.OutlineCount() > 1 )
281  return false;
282 
283  // Update the area with the new merged outline
284  delete area_ref->Outline();
285  area_ref->SetOutline( new SHAPE_POLY_SET( mergedOutlines ) );
286 
287  RemoveArea( aDeletedList, area_to_combine );
288 
289  area_ref->SetLocalFlags( 1 );
290  area_ref->HatchBorder();
291 
292  return true;
293 }
void HatchBorder()
Function HatchBorder computes the hatch lines depending on the hatch parameters and stores it in the ...
Definition: class_zone.cpp:919
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: class_zone.h:300
void RemoveArea(PICKED_ITEMS_LIST *aDeletedList, ZONE_CONTAINER *area_to_remove)
Remove copper area from net, and put it in a deleted list (if exists).
void SetOutline(SHAPE_POLY_SET *aOutline)
Definition: class_zone.h:303
SHAPE_POLY_SET.
void Simplify(POLYGON_MODE aFastMode)
Simplifies the polyset (merges overlapping polys, eliminates degeneracy/self-intersections) For aFast...
void SetLocalFlags(int aFlags)
Definition: class_zone.h:286

References SHAPE_POLY_SET::BooleanAdd(), ZONE_CONTAINER::HatchBorder(), ZONE_CONTAINER::Outline(), SHAPE_POLY_SET::OutlineCount(), SHAPE_POLY_SET::PM_FAST, RemoveArea(), ZONE_CONTAINER::SetLocalFlags(), ZONE_CONTAINER::SetOutline(), and SHAPE_POLY_SET::Simplify().

Referenced by CombineAllAreasInNet().

◆ 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 995 of file class_board.cpp.

996 {
997  EDA_RECT area;
998  LSET visible = GetVisibleLayers();
999  bool showInvisibleText = IsElementVisible( LAYER_MOD_TEXT_INVISIBLE )
1000  && PgmOrNull() && !PgmOrNull()->m_Printing;
1001 
1002  // Check shapes, dimensions, texts, and fiducials
1003  for( BOARD_ITEM* item : m_drawings )
1004  {
1005  if( aBoardEdgesOnly && ( item->GetLayer() != Edge_Cuts || item->Type() != PCB_SHAPE_T ) )
1006  continue;
1007 
1008  if( ( item->GetLayerSet() & visible ).any() )
1009  area.Merge( item->GetBoundingBox() );
1010  }
1011 
1012  // Check footprints
1013  for( MODULE* footprint : m_modules )
1014  {
1015  if( !( footprint->GetLayerSet() & visible ).any() )
1016  continue;
1017 
1018  if( aBoardEdgesOnly )
1019  {
1020  for( const BOARD_ITEM* edge : footprint->GraphicalItems() )
1021  {
1022  if( edge->GetLayer() == Edge_Cuts && edge->Type() == PCB_FP_SHAPE_T )
1023  area.Merge( edge->GetBoundingBox() );
1024  }
1025  }
1026  else
1027  {
1028  area.Merge( footprint->GetBoundingBox( showInvisibleText ) );
1029  }
1030  }
1031 
1032  if( !aBoardEdgesOnly )
1033  {
1034  // Check tracks
1035  for( TRACK* track : m_tracks )
1036  {
1037  if( ( track->GetLayerSet() & visible ).any() )
1038  area.Merge( track->GetBoundingBox() );
1039  }
1040 
1041  // Check zones
1042  for( ZONE_CONTAINER* aZone : m_zones )
1043  {
1044  if( ( aZone->GetLayerSet() & visible ).any() )
1045  area.Merge( aZone->GetBoundingBox() );
1046  }
1047  }
1048 
1049  return area;
1050 }
MODULES m_modules
Definition: class_board.h:197
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
void Merge(const EDA_RECT &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect.
Definition: eda_rect.cpp:431
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
LSET GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings Returns a bit-mask of all t...
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:94
TRACKS m_tracks
Definition: class_board.h:198
LSET is a set of PCB_LAYER_IDs.
DRAWINGS m_drawings
Definition: class_board.h:196
ZONE_CONTAINERS m_zones
Definition: class_board.h:200
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
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:341
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
PGM_BASE * PgmOrNull()
similat to PGM_BASE& Pgm(), but return a reference that can be nullptr when running a shared lib from...
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:91

References Edge_Cuts, GetVisibleLayers(), IsElementVisible(), LAYER_MOD_TEXT_INVISIBLE, m_drawings, m_modules, 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( auto 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
80  for( MODULE* module : m_modules )
81  {
82  module->TransformPadsShapesWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
83  ERROR_INSIDE );
84 
85  // Micro-wave footprints may have items on copper layers
86  module->TransformGraphicShapesWithClearanceToPolygonSet( aOutlines, aLayer, 0, maxError,
87  ERROR_INSIDE );
88  }
89 
90  // convert copper zones
91  for( ZONE_CONTAINER* zone : Zones() )
92  {
93  if( zone->GetLayerSet().test( aLayer ) )
94  zone->TransformSolidAreasShapesToPolygon( aLayer, aOutlines );
95  }
96 
97  // convert graphic items on copper layers (texts)
98  for( BOARD_ITEM* item : m_drawings )
99  {
100  if( !item->IsOnLayer( aLayer ) )
101  continue;
102 
103  switch( item->Type() )
104  {
105  case PCB_SHAPE_T:
106  {
107  PCB_SHAPE* shape = static_cast<PCB_SHAPE*>( item );
108  shape->TransformShapeWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
109  ERROR_INSIDE );
110  }
111  break;
112 
113  case PCB_TEXT_T:
114  {
115  PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
116  text->TransformShapeWithClearanceToPolygonSet( aOutlines, 0, maxError, ERROR_INSIDE );
117  }
118  break;
119 
120  default:
121  break;
122  }
123  }
124 }
MODULES m_modules
Definition: class_board.h:197
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
class PCB_TEXT, text on a layer
Definition: typeinfo.h:92
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: class_board.h:558
TRACKS m_tracks
Definition: class_board.h:198
DRAWINGS m_drawings
Definition: class_board.h:196
void TransformShapeWithClearanceToPolygonSet(SHAPE_POLY_SET &aCornerBuffer, int aClearance, int aError, ERROR_LOC aErrorLoc) const
Function TransformShapeWithClearanceToPolygonSet Convert the text shape to a set of polygons (one by ...
ZONE_CONTAINERS & Zones()
Definition: class_board.h:290
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:91

References ERROR_INSIDE, GetDesignSettings(), m_drawings, BOARD_DESIGN_SETTINGS::m_MaxError, m_modules, m_tracks, PCB_SHAPE_T, PCB_TEXT_T, PCB_SHAPE::TransformShapeWithClearanceToPolygon(), PCB_TEXT::TransformShapeWithClearanceToPolygonSet(), 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 873 of file class_board.cpp.

874 {
875  wxString newbuf;
876  size_t sourceLen = aSource.length();
877 
878  for( size_t i = 0; i < sourceLen; ++i )
879  {
880  if( aSource[i] == '$' && i + 1 < sourceLen && aSource[i+1] == '{' )
881  {
882  wxString token;
883  bool isCrossRef = false;
884 
885  for( i = i + 2; i < sourceLen; ++i )
886  {
887  if( aSource[i] == '}' )
888  break;
889 
890  if( aSource[i] == ':' )
891  isCrossRef = true;
892 
893  token.append( aSource[i] );
894  }
895 
896  if( isCrossRef )
897  {
898  wxString remainder;
899  wxString ref = token.BeforeFirst( ':', &remainder );
900 
901  for( MODULE* footprint : Modules() )
902  {
903  if( footprint->GetReference().CmpNoCase( ref ) == 0 )
904  {
905  wxString test( remainder );
906 
907  if( footprint->ResolveTextVar( &test ) )
908  token = footprint->m_Uuid.AsString() + ":" + remainder;
909 
910  break;
911  }
912  }
913  }
914 
915  newbuf.append( "${" + token + "}" );
916  }
917  else
918  {
919  newbuf.append( aSource[i] );
920  }
921  }
922 
923  return newbuf;
924 }
MODULES & Modules()
Definition: class_board.h:284

References Modules().

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

◆ ConvertKIIDsToCrossReferences()

wxString BOARD::ConvertKIIDsToCrossReferences ( const wxString &  aSource)

Definition at line 927 of file class_board.cpp.

928 {
929  wxString newbuf;
930  size_t sourceLen = aSource.length();
931 
932  for( size_t i = 0; i < sourceLen; ++i )
933  {
934  if( aSource[i] == '$' && i + 1 < sourceLen && aSource[i+1] == '{' )
935  {
936  wxString token;
937  bool isCrossRef = false;
938 
939  for( i = i + 2; i < sourceLen; ++i )
940  {
941  if( aSource[i] == '}' )
942  break;
943 
944  if( aSource[i] == ':' )
945  isCrossRef = true;
946 
947  token.append( aSource[i] );
948  }
949 
950  if( isCrossRef )
951  {
952  wxString remainder;
953  wxString ref = token.BeforeFirst( ':', &remainder );
954  BOARD_ITEM* refItem = GetItem( KIID( ref ) );
955 
956  if( refItem && refItem->Type() == PCB_MODULE_T )
957  token = static_cast<MODULE*>( refItem )->GetReference() + ":" + remainder;
958  }
959 
960  newbuf.append( "${" + token + "}" );
961  }
962  else
963  {
964  newbuf.append( aSource[i] );
965  }
966  }
967 
968  return newbuf;
969 }
BOARD_ITEM * GetItem(const KIID &aID) const
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
Definition: kiid.h:44
class MODULE, a footprint
Definition: typeinfo.h:89
KICAD_T Type() const
Function Type()
Definition: eda_item.h:182

References GetItem(), PCB_MODULE_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 66 of file board_item_container.h.

67  {
68  Remove( aItem );
69  delete aItem;
70  }
virtual void Remove(BOARD_ITEM *aItem)=0
Removes an item from the container.

References BOARD_ITEM_CONTAINER::Remove().

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

◆ DeleteAllModules()

void BOARD::DeleteAllModules ( )
inline

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

Definition at line 355 of file class_board.h.

356  {
357  for( MODULE* mod : m_modules )
358  delete mod;
359 
360  m_modules.clear();
361  }
MODULES m_modules
Definition: class_board.h:197

References m_modules.

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 726 of file class_board.cpp.

727 {
728  // the vector does not know how to delete the MARKER_PCB, it holds pointers
729  for( MARKER_PCB* marker : m_markers )
730  delete marker;
731 
732  m_markers.clear();
733 }
MARKERS m_markers
Definition: class_board.h:195

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 736 of file class_board.cpp.

737 {
738  // Deleting lots of items from a vector can be very slow. Copy remaining items instead.
739  MARKERS remaining;
740 
741  for( MARKER_PCB* marker : m_markers )
742  {
743  if( ( marker->IsExcluded() && aExclusions )
744  || ( !marker->IsExcluded() && aWarningsAndErrors ) )
745  {
746  delete marker;
747  }
748  else
749  {
750  remaining.push_back( marker );
751  }
752  }
753 
754  m_markers = remaining;
755 }
MARKERS m_markers
Definition: class_board.h:195

References m_markers.

◆ DeleteStructure()

void BOARD_ITEM::DeleteStructure ( )
inherited

Function DeleteStructure deletes this object after removing from its parent if it has one.

Definition at line 113 of file class_board_item.cpp.

114 {
115  auto parent = GetParent();
116 
117  if( parent )
118  parent->Remove( this );
119 
120  delete this;
121 }
BOARD_ITEM_CONTAINER * GetParent() const

References BOARD_ITEM::GetParent().

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

◆ Drawings() [1/2]

◆ Drawings() [2/2]

const DRAWINGS& BOARD::Drawings ( ) const
inline

Definition at line 288 of file class_board.h.

288 { return m_drawings; }
DRAWINGS m_drawings
Definition: class_board.h:196

References m_drawings.

◆ Duplicate()

virtual BOARD_ITEM* BOARD_ITEM::Duplicate ( ) const
inlinevirtualinherited

Function Duplicate creates a copy of a BOARD_ITEM.

Reimplemented in MODULE.

Definition at line 220 of file class_board_item.h.

221  {
222  EDA_ITEM* dupe = Clone();
223  const_cast<KIID&>( dupe->m_Uuid ) = KIID();
224 
225  return static_cast<BOARD_ITEM*>( dupe );
226  }
virtual EDA_ITEM * Clone() const
Function Clone creates 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:151
EDA_ITEM is 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 PCB_GROUP::DeepDuplicate(), 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 746 of file class_board.h.

747  {
748  return m_NetInfo.end();
749  }
iterator end() const
Definition: netinfo.h:554
NETINFO_LIST m_NetInfo
Definition: class_board.h:230

References NETINFO_LIST::end(), and m_NetInfo.

◆ FillItemMap()

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

Definition at line 837 of file class_board.cpp.

838 {
839  // the board itself
840  aMap[ this->m_Uuid ] = this;
841 
842  for( TRACK* track : Tracks() )
843  aMap[ track->m_Uuid ] = track;
844 
845  for( MODULE* footprint : Modules() )
846  {
847  aMap[ footprint->m_Uuid ] = footprint;
848 
849  for( D_PAD* pad : footprint->Pads() )
850  aMap[ pad->m_Uuid ] = pad;
851 
852  aMap[ footprint->Reference().m_Uuid ] = &footprint->Reference();
853  aMap[ footprint->Value().m_Uuid ] = &footprint->Value();
854 
855  for( BOARD_ITEM* drawing : footprint->GraphicalItems() )
856  aMap[ drawing->m_Uuid ] = drawing;
857  }
858 
859  for( ZONE_CONTAINER* zone : Zones() )
860  aMap[ zone->m_Uuid ] = zone;
861 
862  for( BOARD_ITEM* drawing : Drawings() )
863  aMap[ drawing->m_Uuid ] = drawing;
864 
865  for( MARKER_PCB* marker : m_markers )
866  aMap[ marker->m_Uuid ] = marker;
867 
868  for( PCB_GROUP* group : m_groups )
869  aMap[ group->m_Uuid ] = group;
870 }
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
PCB_GROUP is a set of BOARD_ITEMs (i.e., without duplicates)
GROUPS m_groups
Definition: class_board.h:199
MODULES & Modules()
Definition: class_board.h:284
MARKERS m_markers
Definition: class_board.h:195
const KIID m_Uuid
Definition: eda_item.h:151
ZONE_CONTAINERS & Zones()
Definition: class_board.h:290
DRAWINGS & Drawings()
Definition: class_board.h:287
TRACKS & Tracks()
Definition: class_board.h:281

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

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

◆ FindModuleByPath()

MODULE * BOARD::FindModuleByPath ( const KIID_PATH aPath) const

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

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

Definition at line 1265 of file class_board.cpp.

1266 {
1267  for( MODULE* footprint : m_modules )
1268  {
1269  if( footprint->GetPath() == aPath )
1270  return footprint;
1271  }
1272 
1273  return nullptr;
1274 }
MODULES m_modules
Definition: class_board.h:197

References m_modules.

◆ FindModuleByReference()

MODULE * BOARD::FindModuleByReference ( const wxString &  aReference) const

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

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

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

Definition at line 1253 of file class_board.cpp.

1254 {
1255  for( MODULE* footprint : m_modules )
1256  {
1257  if( aReference == footprint->GetReference() )
1258  return footprint;
1259  }
1260 
1261  return nullptr;
1262 }
MODULES m_modules
Definition: class_board.h:197

References m_modules.

Referenced by PCB_EDIT_FRAME::ExecuteRemoteCommand(), DSN::SPECCTRA_DB::FromSESSION(), BOARD_NETLIST_UPDATER::testConnectivity(), 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 1232 of file class_board.cpp.

1233 {
1234  // the first valid netcode is 1 and the last is m_NetInfo.GetCount()-1.
1235  // zero is reserved for "no connection" and is not actually a net.
1236  // NULL is returned for non valid netcodes
1237 
1238  wxASSERT( m_NetInfo.GetNetCount() > 0 );
1239 
1240  if( aNetcode == NETINFO_LIST::UNCONNECTED && m_NetInfo.GetNetCount() == 0 )
1241  return NETINFO_LIST::OrphanedItem();
1242  else
1243  return m_NetInfo.GetNetItem( aNetcode );
1244 }
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:486
NETINFO_LIST m_NetInfo
Definition: class_board.h:230
unsigned GetNetCount() const
Function GetNetCount.
Definition: netinfo.h:449
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:478

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::AddToModule(), 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(), DIALOG_SELECT_NET_FROM_LIST::findRow(), PCB_EDIT_FRAME::fixEagleNets(), DSN::SPECCTRA_DB::FromBOARD(), DSN::SPECCTRA_DB::FromSESSION(), PCB_INSPECTION_TOOL::highlightNet(), DRC_ENGINE::IsNetADiffPair(), LEGACY_PLUGIN::loadNETINFO_ITEM(), LEGACY_PLUGIN::loadPAD(), MapNets(), PNS_PCBNEW_RULE_RESOLVER::NetName(), DIALOG_SELECT_NET_FROM_LIST::onAddNet(), DIALOG_SELECT_NET_FROM_LIST::OnBoardHighlightNetChanged(), DIALOG_SELECT_NET_FROM_LIST::onRenameNet(), NETINFO_MAPPING::iterator::operator *(), SanitizeNetcodes(), BOARD_CONNECTED_ITEM::SetNetCode(), PNS::DIFF_PAIR_PLACER::Start(), 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 1247 of file class_board.cpp.

1248 {
1249  return m_NetInfo.GetNetItem( aNetname );
1250 }
NETINFO_LIST m_NetInfo
Definition: class_board.h:230
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

Function Flip Flip this object, i.e.

change the board side for this object

Parameters
aCentre- the rotation point.
aFlipLeftRight- mirror across Y axis instead of X (the default)

Reimplemented in ZONE_CONTAINER, VIA, ARC, PCB_SHAPE, D_PAD, MODULE, DIMENSION, PCB_GROUP, FP_TEXT, TRACK, FP_SHAPE, PCB_TEXT, PCB_TARGET, and MARKER_PCB.

Definition at line 331 of file class_board_item.h.

332  {
333  wxMessageBox( wxT( "virtual BOARD_ITEM::Flip used, should not occur" ), GetClass() );
334  }
virtual wxString GetClass() const =0
Function GetClass returns 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 336 of file class_board_item.h.

337  {
338  Flip( wxPoint( aCentre.x, aCentre.y ), aFlipLeftRight );
339  }
virtual void Flip(const wxPoint &aCentre, bool aFlipLeftRight)
Function Flip Flip this object, i.e.

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

◆ 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:55
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:55
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:275
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:55
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:275
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_CONTAINER* BOARD::GetArea ( int  index) const
inline

Return the Area (Zone Container) at a given index.

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

Definition at line 882 of file class_board.h.

883  {
884  if( (unsigned) index < m_zones.size() )
885  return m_zones[index];
886 
887  return NULL;
888  }
#define NULL
ZONE_CONTAINERS m_zones
Definition: class_board.h:200

References m_zones, and NULL.

Referenced by DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), SaveCopyOfZones(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZones(), and UpdateCopyOfZonesList().

◆ GetAreaCount()

int BOARD::GetAreaCount ( ) const
inline
Returns
The number of Areas or ZONE_CONTAINER.

Definition at line 898 of file class_board.h.

899  {
900  return static_cast<int>( m_zones.size() );
901  }
ZONE_CONTAINERS m_zones
Definition: class_board.h:200

References m_zones.

Referenced by DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZones().

◆ GetBoard()

BOARD * BOARD_ITEM::GetBoard ( ) const
virtualinherited

Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.

Definition at line 46 of file class_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:85
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
#define NULL
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
Information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:186
BOARD_ITEM_CONTAINER * GetParent() const
KICAD_T Type() const
Function Type()
Definition: eda_item.h:182

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

Referenced by D_PAD::BuildEffectiveShapes(), ZONE_CONTAINER::BuildSmoothedPoly(), KIGFX::PCB_PAINTER::draw(), exprFromTo(), VIA::FlashLayer(), D_PAD::FlashLayer(), PCB_TEXT::Flip(), TRACK::Flip(), ARC::Flip(), VIA::Flip(), ZONE_CONTAINER::Flip(), BOARD_ITEM::GetBoard(), MODULE::GetBoundingBox(), MODULE::GetBoundingPoly(), BOARD_CONNECTED_ITEM::GetEffectiveNetclass(), ZONE_CONTAINER::GetInteractingZones(), BOARD_ITEM::GetLayerName(), VIA::GetMinAnnulus(), PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), ZONE_CONTAINER::GetMsgPanelInfo(), TRACK::GetMsgPanelInfo(), NETINFO_ITEM::GetMsgPanelInfo(), D_PAD::GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), BOARD_CONNECTED_ITEM::GetOwnClearance(), ZONE_CONTAINER::GetSelectMenuText(), FP_TEXT::GetShownText(), D_PAD::GetSolderMaskMargin(), D_PAD::GetSolderPasteMargin(), GetTrackLength(), TRACK::GetWidthConstraints(), insideArea(), insideCourtyard(), isDiffPair(), BOARD_ITEM::LayerMaskDescribe(), VIA::LayerMaskDescribe(), D_PAD::MergePrimitivesAsPolygon(), EAGLE_PLUGIN::packageWire(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), ResolveDRCExclusions(), BOARD_CONNECTED_ITEM::SetNetCode(), setupDummyPadForHole(), ZONE_CONTAINER::TransformSmoothedOutlineToPolygon(), ZONE_CONTAINER::TransformSolidAreasShapesToPolygon(), MODULE::ViewBBox(), and D_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 782 of file class_board.h.

783  {
784  return ComputeBoundingBox( true );
785  }
EDA_RECT ComputeBoundingBox(bool aBoardEdgesOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).

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,
wxString *  aErrorText = nullptr,
std::vector< wxPoint > *  aDiscontinuities = nullptr,
std::vector< wxPoint > *  aIntersections = 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.
aErrorText= an optional wxString for an error message with the coordinate of the first discontinuity or self-intersection
aDiscontinuities= an optional array of wxPoint giving the locations of discontinuities in the outline
aIntersections= an optional array of wxPoint giving the locations of self- intersections in the outline
Returns
true if success, false if a contour is not valid

Definition at line 1843 of file class_board.cpp.

1846 {
1847  bool success = BuildBoardPolygonOutlines( this, aOutlines, GetDesignSettings().m_MaxError,
1848  aErrorText, aDiscontinuities, aIntersections );
1849 
1850  // Make polygon strictly simple to avoid issues (especially in 3D viewer)
1852 
1853  return success;
1854 }
bool BuildBoardPolygonOutlines(BOARD *aBoard, SHAPE_POLY_SET &aOutlines, unsigned int aTolerance, wxString *aErrorText, std::vector< wxPoint > *aDiscontinuities, std::vector< wxPoint > *aIntersections)
Extracts the board outlines and build a closed polygon from lines, arcs and circle items on edge cut ...
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: class_board.h:558
void Simplify(POLYGON_MODE aFastMode)
Simplifies the polyset (merges overlapping polys, eliminates degeneracy/self-intersections) For aFast...

References BuildBoardPolygonOutlines(), GetDesignSettings(), 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_MISC::testOutline(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZones(), and HYPERLYNX_EXPORTER::writeBoardInfo().

◆ GetBoardUse()

BOARD_USE BOARD::GetBoardUse ( )
inline

Get what the board use is.

Returns
what the board is being used for

Definition at line 265 of file class_board.h.

265 { return m_boardUse; }
BOARD_USE m_boardUse
What is this board being used for.
Definition: class_board.h:192

References m_boardUse.

◆ GetBoundingBox()

const EDA_RECT BOARD::GetBoundingBox ( ) const
inlineoverridevirtual

Function GetBoundingBox returns 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 768 of file class_board.h.

769  {
770  return ComputeBoundingBox( false );
771  }
EDA_RECT ComputeBoundingBox(bool aBoardEdgesOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).

References ComputeBoundingBox().

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

◆ GetCenter()

virtual wxPoint BOARD_ITEM::GetCenter ( ) const
inlinevirtualinherited

Function GetCenter()

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

Returns
centre point of the item

Reimplemented in ARC, D_PAD, PCB_SHAPE, and MARKER_PCB.

Definition at line 129 of file class_board_item.h.

130  {
131  return GetBoundingBox().GetCenter();
132  }
virtual const EDA_RECT GetBoundingBox() const
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
Definition: eda_item.cpp:89
const wxPoint GetCenter() const
Definition: eda_rect.h:117

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

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

◆ GetClass()

wxString BOARD::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Implements EDA_ITEM.

Definition at line 851 of file class_board.h.

852  {
853  return wxT( "BOARD" );
854  }

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 381 of file class_board.h.

381 { return m_connectivity; }
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: class_board.h:211

References m_connectivity.

Referenced by BuildConnectivity(), BOARD_NETLIST_UPDATER::cacheCopperZoneConnections(), FROM_TO_CACHE::cacheFromToPaths(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), TRACKS_CLEANER::cleanup(), 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(), VIA::FlashLayer(), D_PAD::FlashLayer(), PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), GetMsgPanelInfo(), GetTrackLength(), PCB_EDIT_FRAME::ImportSpecctraSession(), TRACKS_CLEANER::mergeCollinearSegments(), DIALOG_NETLIST::OnCompileRatsnestClick(), PadDelete(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), DIALOG_SELECT_NET_FROM_LIST::relevantConnectivityItems(), TRACKS_CLEANER::removeShortingTrackSegments(), BOARD_COMMIT::Revert(), AR_AUTOPLACER::rotateModule(), DRC_TEST_PROVIDER_CONNECTIVITY::Run(), test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run(), SELECTION_TOOL::selectAllItemsOnNet(), 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 422 of file class_board.cpp.

423 {
425 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: class_board.h:558
int GetCopperLayerCount() const
Function GetCopperLayerCount.

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(), PCBNEW_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_CONTAINER::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 558 of file class_board.h.

559  {
560  return *m_designSettings;
561  }
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: class_board.h:228

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(), D_PAD::BuildEffectiveShapes(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildFilterLists(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildNetclassesGrid(), ZONE_CONTAINER::BuildSmoothedPoly(), ZONE_FILLER::buildThermalSpokes(), EDIT_TOOL::ChangeTrackWidth(), FOOTPRINT_EDIT_FRAME::Clear_Pcb(), PNS_PCBNEW_RULE_RESOLVER::Clearance(), ClearProject(), PNS_PCBNEW_RULE_RESOLVER::CollideHoles(), 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(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::doPadToPadsDrc(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::doTrackDrc(), 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(), MODULE::GetBoundingPoly(), MARKER_PCB::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::GetHolePlatingThicknessBIU(), VIA::GetMinAnnulus(), ZONE_CONTAINER::GetMsgPanelInfo(), D_PAD::GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetOwnClearance(), DRAWING_TOOL::getSegmentWidth(), PCB_BASE_FRAME::GetSeverity(), D_PAD::GetSolderMaskMargin(), TRACK::GetWidthConstraints(), PCB_BASE_FRAME::GetZoneSettings(), GetZoneSettings(), 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(), PCB_INSPECTION_TOOL::InspectConstraints(), IsLayerEnabled(), IsLayerVisible(), EAGLE_PLUGIN::Load(), LoadBoard(), LEGACY_PLUGIN::loadGENERAL(), DRC_ENGINE::loadImplicitRules(), LEGACY_PLUGIN::loadNETCLASS(), EAGLE_PLUGIN::loadPlain(), LEGACY_PLUGIN::loadSETUP(), DSN::SPECCTRA_DB::makePADSTACK(), D_PAD::MergePrimitivesAsPolygon(), NETINFO_ITEM::NETINFO_ITEM(), DIALOG_PAD_PROPERTIES::onAddPrimitive(), DIALOG_BOARD_SETUP::OnAuxiliaryAction(), PANEL_SETUP_RULES::onScintillaCharAdded(), DIALOG_POSITION_RELATIVE::OnUseGridOriginClick(), ROUTER_TOOL::onViaCommand(), 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(), PCB_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(), PCB_INSPECTION_TOOL::reportClearance(), DRC_TOOL::Reset(), PCB_BASE_EDIT_FRAME::SetBoard(), NETINFO_ITEM::SetClass(), SetCopperLayerCount(), SetEnabledLayers(), PCB_BASE_FRAME::SetGridOrigin(), DIALOG_PLOT::SetPlotFormat(), SetProject(), BOARD_DRC_ITEMS_PROVIDER::SetSeverities(), VECTOR_DRC_ITEMS_PROVIDER::SetSeverities(), setupDummyPadForHole(), PCB_BASE_FRAME::SetZoneSettings(), SetZoneSettings(), APPEARANCE_CONTROLS::showNetclass(), PNS::DIFF_PAIR_PLACER::Start(), EDA_3D_VIEWER::SynchroniseColoursWithBoard(), SynchronizeNetsAndNetClasses(), PNS_KICAD_IFACE_BASE::syncPad(), PNS_KICAD_IFACE_BASE::SyncWorld(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testCopperDrawItem(), PANEL_SETUP_RULES::TransferDataFromWindow(), ZONE_CONTAINER::TransformSmoothedOutlineToPolygon(), VIA_SIZE_MENU::update(), TRACK_WIDTH_MENU::update(), DIFF_PAIR_MENU::update(), DIALOG_GENDRILL::UpdateDrillParams(), MODULE::ViewBBox(), MARKER_PCB::ViewGetLayers(), WriteDRCReport(), DIALOG_DRC::writeReport(), and HYPERLYNX_EXPORTER::writeStackupInfo().

◆ GetEditFlags()

STATUS_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 226 of file eda_item.h.

227  {
228  constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVED | IS_RESIZED | IS_DRAGGED |
230 
231  return m_Flags & mask;
232  }
#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:165
#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(), LIB_PIN_TOOL::EditPinProperties(), SCH_EDITOR_CONTROL::EditWithLibEdit(), SCH_COMPONENT::GetMsgPanelInfo(), SELECTION_CONDITIONS::Idle(), SELECTION_CONDITIONS::IdleSelection(), LIB_MOVE_TOOL::Main(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), PAD_TOOL::recombinePad(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_SYMBOL_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

Function GetEffectiveShape 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 fod use with routing, collision determiniation, etc).

Note that 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 MODULE, VIA, D_PAD, ARC, ZONE_CONTAINER, PCB_SHAPE, DIMENSION, FP_TEXT, TRACK, and PCB_TEXT.

Definition at line 153 of file class_board_item.cpp.

154 {
155  std::shared_ptr<SHAPE> shape;
156 
157  int unimplemented_get_effective_shape = 0;
158  assert( unimplemented_get_effective_shape );
159  (void) unimplemented_get_effective_shape;
160 
161  return shape;
162 }

Referenced by DRC_RTREE::insert(), insideArea(), DRC_RTREE::QueryColliding(), and DRC_TEST_PROVIDER_COPPER_CLEARANCE::testCopperDrawItem().

◆ 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 434 of file class_board.cpp.

435 {
437 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: class_board.h:558
LSET GetEnabledLayers() const
Function GetEnabledLayers returns a bit-mask of all the layers that are enabled.

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

Referenced by PCBNEW_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(), D_PAD::ViewGetLOD(), and HYPERLYNX_EXPORTER::writeSinglePadStack().

◆ GetFileFormatVersionAtLoad()

int BOARD::GetFileFormatVersionAtLoad ( ) const
inline

Definition at line 337 of file class_board.h.

337 { return m_fileFormatVersionAtLoad; }
int m_fileFormatVersionAtLoad
Definition: class_board.h:208

References m_fileFormatVersionAtLoad.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ GetFileName()

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

Definition at line 279 of file class_board.h.

279 { return m_fileName; }
wxString m_fileName
Definition: class_board.h:194

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(), PCB_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(), PCB_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().

◆ GetFirstModule()

MODULE* BOARD::GetFirstModule ( ) const
inline

Gets the first module in the list (used in footprint viewer/editor) or NULL if none.

Returns
first module or null pointer

Definition at line 347 of file class_board.h.

348  {
349  return m_modules.empty() ? nullptr : m_modules.front();
350  }
MODULES m_modules
Definition: class_board.h:197

References m_modules.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), BuildFootprintPolygonOutlines(), FOOTPRINT_EDIT_FRAME::canCloseWindow(), FOOTPRINT_EDITOR_TOOLS::CutCopyFootprint(), PCBNEW_CONTROL::DeleteItemCursor(), DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX(), DIALOG_CLEANUP_GRAPHICS::doCleanup(), EDIT_TOOL::Duplicate(), FOOTPRINT_EDITOR_TOOLS::ExportFootprint(), 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_TOOLS::ImportFootprint(), ARRAY_CREATOR::Invoke(), FOOTPRINT_EDIT_FRAME::IsContentModified(), FOOTPRINT_EDIT_FRAME::IsCurrentFPFromBoard(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), FOOTPRINT_EDIT_FRAME::LoadModuleFromLibrary(), PCB_VIEWER_TOOLS::module(), PCB_TOOL_BASE::module(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), PCBNEW_CONTROL::Paste(), pasteModuleItemsToModEdit(), DRAWING_TOOL::PlaceImportedGraphics(), CONVERT_TOOL::PolyToLines(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), FOOTPRINT_EDITOR_TOOLS::Properties(), BOARD_COMMIT::Push(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), FOOTPRINT_EDIT_FRAME::setupUIConditions(), GROUP_TOOL::Ungroup(), DISPLAY_FOOTPRINTS_FRAME::UpdateMsgPanel(), and FOOTPRINT_WIZARD_FRAME::UpdateMsgPanel().

◆ GetFlags()

◆ GetFocusPosition()

const wxPoint BOARD::GetFocusPosition ( ) const
inlineoverridevirtual

Function GetFocusPosition similar to GetPosition, but allows items to return their visual center rather than their anchor.

Reimplemented from EDA_ITEM.

Definition at line 327 of file class_board.h.

327 { return GetBoundingBox().GetCenter(); }
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
Definition: class_board.h:768
const wxPoint GetCenter() const
Definition: eda_rect.h:117

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

◆ GetFootprint()

MODULE * 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.
Returns
MODULE* The best module or NULL if none.

Definition at line 1668 of file class_board.cpp.

1670 {
1671  MODULE* footprint = NULL;
1672  MODULE* alt_footprint = NULL;
1673  int min_dim = 0x7FFFFFFF;
1674  int alt_min_dim = 0x7FFFFFFF;
1675  bool current_layer_back = IsBackLayer( aActiveLayer );
1676 
1677  for( MODULE* candidate : m_modules )
1678  {
1679  // is the ref point within the footprint's bounds?
1680  if( !candidate->HitTest( aPosition ) )
1681  continue;
1682 
1683  // if caller wants to ignore locked footprints, and this one is locked, skip it.
1684  if( aIgnoreLocked && candidate->IsLocked() )
1685  continue;
1686 
1687  PCB_LAYER_ID layer = candidate->GetLayer();
1688 
1689  // Filter non visible footprints if requested
1690  if( !aVisibleOnly || IsModuleLayerVisible( layer ) )
1691  {
1692  EDA_RECT bb = candidate->GetFootprintRect();
1693 
1694  int offx = bb.GetX() + bb.GetWidth() / 2;
1695  int offy = bb.GetY() + bb.GetHeight() / 2;
1696 
1697  // off x & offy point to the middle of the box.
1698  int dist = ( aPosition.x - offx ) * ( aPosition.x - offx ) +
1699  ( aPosition.y - offy ) * ( aPosition.y - offy );
1700 
1701  if( current_layer_back == IsBackLayer( layer ) )
1702  {
1703  if( dist <= min_dim )
1704  {
1705  // better footprint shown on the active side
1706  footprint = candidate;
1707  min_dim = dist;
1708  }
1709  }
1710  else if( aVisibleOnly && IsModuleLayerVisible( layer ) )
1711  {
1712  if( dist <= alt_min_dim )
1713  {
1714  // better footprint shown on the other side
1715  alt_footprint = candidate;
1716  alt_min_dim = dist;
1717  }
1718  }
1719  }
1720  }
1721 
1722  if( footprint )
1723  return footprint;
1724 
1725  if( alt_footprint)
1726  return alt_footprint;
1727 
1728  return NULL;
1729 }
MODULES m_modules
Definition: class_board.h:197
int GetX() const
Definition: eda_rect.h:111
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
int GetWidth() const
Definition: eda_rect.h:119
PCB_LAYER_ID
A quick note on layer IDs:
#define NULL
int GetHeight() const
Definition: eda_rect.h:120
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
int GetY() const
Definition: eda_rect.h:112
bool IsModuleLayerVisible(PCB_LAYER_ID aLayer)
Expect either of the two layers on which a module can reside, and returns whether that layer is visib...

References EDA_RECT::GetHeight(), EDA_RECT::GetWidth(), EDA_RECT::GetX(), EDA_RECT::GetY(), IsBackLayer(), IsModuleLayerVisible(), m_modules, and NULL.

◆ GetHighLightNetCodes()

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

Definition at line 421 of file class_board.h.

422  {
423  return m_highLight.m_netCodes;
424  }
HIGH_LIGHT_INFO m_highLight
Definition: class_board.h:205
std::set< int > m_netCodes
Definition: class_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_SELECT_NET_FROM_LIST::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 758 of file class_board.cpp.

759 {
760  if( aID == niluuid )
761  return nullptr;
762 
763  for( TRACK* track : Tracks() )
764  {
765  if( track->m_Uuid == aID )
766  return track;
767  }
768 
769  for( MODULE* footprint : Modules() )
770  {
771  if( footprint->m_Uuid == aID )
772  return footprint;
773 
774  for( D_PAD* pad : footprint->Pads() )
775  {
776  if( pad->m_Uuid == aID )
777  return pad;
778  }
779 
780  if( footprint->Reference().m_Uuid == aID )
781  return &footprint->Reference();
782 
783  if( footprint->Value().m_Uuid == aID )
784  return &footprint->Value();
785 
786  for( BOARD_ITEM* drawing : footprint->GraphicalItems() )
787  {
788  if( drawing->m_Uuid == aID )
789  return drawing;
790  }
791 
792  for( BOARD_ITEM* zone : footprint->Zones() )
793  {
794  if( zone->m_Uuid == aID )
795  return zone;
796  }
797 
798  for( PCB_GROUP* group : footprint->Groups() )
799  {
800  if( group->m_Uuid == aID )
801  return group;
802  }
803  }
804 
805  for( ZONE_CONTAINER* zone : Zones() )
806  {
807  if( zone->m_Uuid == aID )
808  return zone;
809  }
810 
811  for( BOARD_ITEM* drawing : Drawings() )
812  {
813  if( drawing->m_Uuid == aID )
814  return drawing;
815  }
816 
817  for( MARKER_PCB* marker : m_markers )
818  {
819  if( marker->m_Uuid == aID )
820  return marker;
821  }
822 
823  for( PCB_GROUP* group : m_groups )
824  {
825  if( group->m_Uuid == aID )
826  return group;
827  }
828 
829  if( m_Uuid == aID )
830  return const_cast<BOARD*>( this );
831 
832  // Not found; weak reference has been deleted.
834 }
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
KIID niluuid(0)
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
PCB_GROUP is a set of BOARD_ITEMs (i.e., without duplicates)
GROUPS m_groups
Definition: class_board.h:199
MODULES & Modules()
Definition: class_board.h:284
static DELETED_BOARD_ITEM * GetInstance()
MARKERS m_markers
Definition: class_board.h:195
const KIID m_Uuid
Definition: eda_item.h:151
ZONE_CONTAINERS & Zones()
Definition: class_board.h:290
DRAWINGS & Drawings()
Definition: class_board.h:287
TRACKS & Tracks()
Definition: class_board.h:281

References Drawings(), DELETED_BOARD_ITEM::GetInstance(), m_groups, m_markers, EDA_ITEM::m_Uuid, Modules(), 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(), and DIALOG_CLEANUP_TRACKS_AND_VIAS::OnSelectItem().

◆ GetLayer()

virtual PCB_LAYER_ID BOARD_ITEM::GetLayer ( ) const
inlinevirtualinherited

Function GetLayer returns the primary layer this item is on.

Reimplemented in ZONE_CONTAINER.

Definition at line 190 of file class_board_item.h.

190 { return m_Layer; }
PCB_LAYER_ID m_Layer

References BOARD_ITEM::m_Layer.

Referenced by CN_LIST::Add(), BOARD_ADAPTER::AddGraphicsShapesWithClearanceToContainer(), 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::CreateNewModule(), 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(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::doTrackDrc(), KIGFX::PCB_PAINTER::draw(), PCB_EDIT_FRAME::ExchangeFootprint(), export_vrml_drawsegment(), export_vrml_edge_module(), export_vrml_module(), export_vrml_pcbtext(), export_vrml_text_module(), export_vrml_tracks(), extractDiffPairCoupledItems(), EDIT_TOOL::FilletTracks(), PCB_TARGET::Flip(), PCB_TEXT::Flip(), FP_SHAPE::Flip(), TRACK::Flip(), FP_TEXT::Flip(), DIMENSION::Flip(), MODULE::Flip(), ARC::Flip(), PCB_SHAPE::Flip(), PCB_IO::FootprintSave(), FootprintWriteShape(), PCB_IO::format(), PCB_IO::formatLayer(), FP_TEXT::FP_TEXT(), DSN::SPECCTRA_DB::FromBOARD(), AR_AUTOPLACER::genModuleOnRoutingMatrix(), MODULE::GetBoundingBox(), ZONE_CONTAINER::GetLayer(), getMatchingTextItem(), TRACK::GetMsgPanelInfo(), VIA::GetMsgPanelInfo(), D_PAD::GetMsgPanelInfo(), AR_AUTOPLACER::getOptimalModulePlacement(), GetPad(), TEXT_MOD_GRID_TABLE::GetValueAsLong(), TRACK::GetWidthConstraints(), SELECTION_TOOL::GuessSelectionCandidates(), idf_export_module(), GENERAL_COLLECTOR::Inspect(), PCB_INSPECTION_TOOL::InspectClearance(), D_PAD::IsFlipped(), PNS_KICAD_IFACE::IsItemVisible(), BOARD_ITEM::IsOnCopperLayer(), FP_SHAPE::IsParentFlipped(), FP_TEXT::IsParentFlipped(), itemIsIncludedByFilter(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), MODULE_DESC::MODULE_DESC(), DIALOG_FOOTPRINT_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_PROPERTIES::OnAddField(), DIALOG_DRC::OnDRCItemSelected(), TRACK::cmp_tracks::operator()(), PCB_SHAPE::cmp_drawings::operator()(), BOARD_ITEM::ptr_cmp::operator()(), MODULE::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(), 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(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testCopperDrawItem(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testCopperTextAndGraphics(), AR_AUTOPLACER::testModuleOnBoard(), TRACK_VIA_DESC::TRACK_VIA_DESC(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow(), BOARD_ADAPTER::transformGraphicModuleEdgeToPolygonSet(), MODULE::TransformGraphicShapesWithClearanceToPolygonSet(), TRACK::ViewBBox(), FP_TEXT::ViewGetLayers(), TRACK::ViewGetLayers(), FP_TEXT::ViewGetLOD(), MODULE_ZONE_CONTAINER::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 307 of file class_board.cpp.

308 {
309 
310  // Check the BOARD physical layer names.
311  for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
312  {
313  if ( ( m_Layer[ layer ].m_name == aLayerName )
314  || ( m_Layer[ layer ].m_userName == aLayerName ) )
315  return ToLAYER_ID( layer );
316  }
317 
318  // Otherwise fall back to the system standard layer names for virtual layers.
319  for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
320  {
321  if( GetStandardLayerName( ToLAYER_ID( layer ) ) == aLayerName )
322  return ToLAYER_ID( layer );
323  }
324 
325  return UNDEFINED_LAYER;
326 }
int LAYER_NUM
This can be replaced with int and removed.
LAYER m_Layer[PCB_LAYER_ID_COUNT]
Definition: class_board.h:202
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:897
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition: class_board.h:646

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

◆ GetLayerName() [1/2]

wxString BOARD_ITEM::GetLayerName ( ) const
inherited

Function GetLayerName returns the name of the PCB layer on which the item resides.

Returns
wxString containing the layer name associated with this item.

Definition at line 60 of file class_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.
PCB_LAYER_ID m_Layer
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
Information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:186
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition: class_board.h:646

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

Referenced by PCB_TEXT::GetMsgPanelInfo(), FP_TEXT::GetMsgPanelInfo(), DIMENSION::GetMsgPanelInfo(), PCB_SHAPE::GetMsgPanelInfo(), LEADER::GetMsgPanelInfo(), PCB_TEXT::GetSelectMenuText(), FP_SHAPE::GetSelectMenuText(), TRACK::GetSelectMenuText(), DIMENSION::GetSelectMenuText(), PCB_SHAPE::GetSelectMenuText(), PCB_TEXT::GetShownText(), TEXT_MOD_GRID_TABLE::GetValue(), and MODULE::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 329 of file class_board.cpp.

330 {
331  // All layer names are stored in the BOARD.
332  if( IsLayerEnabled( aLayer ) )
333  {
334  // Standard names were set in BOARD::BOARD() but they may be over-ridden by
335  // BOARD::SetLayerName(). For copper layers, return the user defined layer name,
336  // if it was set. Otherwise return the Standard English layer name.
337  if( !m_Layer[aLayer].m_userName.IsEmpty() )
338  return m_Layer[aLayer].m_userName;
339  }
340 
341  return GetStandardLayerName( aLayer );
342 }
bool IsLayerEnabled(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
Definition: class_board.h:480
LAYER m_Layer[PCB_LAYER_ID_COUNT]
Definition: class_board.h:202
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition: class_board.h:646

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

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_CONTAINER::GetMsgPanelInfo(), ZONE_CONTAINER::GetSelectMenuText(), GRID_CELL_LAYER_SELECTOR::GetValue(), DIALOG_PLOT::init_Dialog(), DIALOG_EXPORT_SVG::initDialog(), DIALOG_PAD_PROPERTIES::initValues(), PCB_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()

◆ 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 363 of file class_board.cpp.

364 {
365  if( !IsCopperLayer( aLayer ) )
366  return LT_SIGNAL;
367 
368  //@@IMB: The original test was broken due to the discontinuity
369  // in the layer sequence.
370  if( IsLayerEnabled( aLayer ) )
371  return m_Layer[aLayer].m_type;
372 
373  return LT_SIGNAL;
374 }
LAYER_T m_type
The type of the layer.
Definition: class_board.h:104
bool IsLayerEnabled(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
Definition: class_board.h:480
LAYER m_Layer[PCB_LAYER_ID_COUNT]
Definition: class_board.h:202
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.

References IsCopperLayer(), IsLayerEnabled(), LT_SIGNAL, m_Layer, 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

Function GetMenuImage returns 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_CONTAINER, SCH_COMPONENT, D_PAD, MODULE, SCH_SHEET, CENTER_DIMENSION, LEADER, SCH_HIERLABEL, ORTHOGONAL_DIMENSION, VIA, SCH_GLOBALLABEL, ALIGNED_DIMENSION, SCH_LABEL, PCB_SHAPE, SCH_TEXT, GERBER_DRAW_ITEM, LIB_PIN, SCH_LINE, TRACK, FP_TEXT, 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, LIB_TEXT, SCH_MARKER, PCB_TARGET, MARKER_PCB, SCH_JUNCTION, LIB_CIRCLE, and LIB_RECTANGLE.

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

◆ GetMsgPanelInfo()

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

Function GetMsgPanelInfo populates 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 1053 of file class_board.cpp.

1054 {
1055  wxString txt;
1056  int viasCount = 0;
1057  int trackSegmentsCount = 0;
1058 
1059  for( TRACK* item : m_tracks )
1060  {
1061  if( item->Type() == PCB_VIA_T )
1062  viasCount++;
1063  else
1064  trackSegmentsCount++;
1065  }
1066 
1067  txt.Printf( wxT( "%d" ), GetPadCount() );
1068  aList.emplace_back( _( "Pads" ), txt, DARKGREEN );
1069 
1070  txt.Printf( wxT( "%d" ), viasCount );
1071  aList.emplace_back( _( "Vias" ), txt, DARKGREEN );
1072 
1073  txt.Printf( wxT( "%d" ), trackSegmentsCount );
1074  aList.emplace_back( _( "Track Segments" ), txt, DARKGREEN );
1075 
1076  txt.Printf( wxT( "%d" ), GetNodesCount() );
1077  aList.emplace_back( _( "Nodes" ), txt, DARKCYAN );
1078 
1079  txt.Printf( wxT( "%d" ), m_NetInfo.GetNetCount() - 1 /* Don't include "No Net" in count */ );
1080  aList.emplace_back( _( "Nets" ), txt, RED );
1081 
1082  txt.Printf( wxT( "%d" ), GetConnectivity()->GetUnconnectedCount() );
1083  aList.emplace_back( _( "Unrouted" ), txt, BLUE );
1084 }
NETINFO_LIST m_NetInfo
Definition: class_board.h:230
TRACKS m_tracks
Definition: class_board.h:198
unsigned GetNodesCount(int aNet=-1) const
unsigned GetPadCount() const
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: class_board.h:381
Definition: color4d.h:60
Definition: color4d.h:57
#define _(s)
Definition: 3d_actions.cpp:33
unsigned GetNetCount() const
Function GetNetCount.
Definition: netinfo.h:449
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97

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

◆ 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 1356 of file class_board.cpp.

1357 {
1358  std::vector<wxString> names;
1359 
1360  for( NETINFO_ITEM* net : m_NetInfo )
1361  {
1362  if( !net->GetNetname().IsEmpty() )
1363  names.emplace_back( net->GetNetname() );
1364  }
1365 
1366  return names;
1367 }
NETINFO_LIST m_NetInfo
Definition: class_board.h:230
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 755 of file class_board.h.

756  {
757  return m_NetInfo.GetNetCount();
758  }
NETINFO_LIST m_NetInfo
Definition: class_board.h:230
unsigned GetNetCount() const
Function GetNetCount.
Definition: netinfo.h:449

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 729 of file class_board.h.

730  {
731  return m_NetInfo;
732  }
NETINFO_LIST m_NetInfo
Definition: class_board.h:230

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 972 of file class_board.cpp.

973 {
974  unsigned retval = 0;
975 
976  for( MODULE* footprint : Modules() )
977  {
978  for( D_PAD* pad : footprint->Pads() )
979  {
980  if( ( aNet == -1 && pad->GetNetCode() > 0 ) || aNet == pad->GetNetCode() )
981  retval++;
982  }
983  }
984 
985  return retval;
986 }
MODULES & Modules()
Definition: class_board.h:284

References Modules().

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

◆ GetPad() [1/4]

D_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 D_PAD object if found or NULL if not found.

Definition at line 1444 of file class_board.cpp.

1445 {
1446  if( !aLayerSet.any() )
1447  aLayerSet = LSET::AllCuMask();
1448 
1449  for( MODULE* footprint : m_modules )
1450  {
1451  D_PAD* pad = NULL;
1452 
1453  if( footprint->HitTest( aPosition ) )
1454  pad = footprint->GetPad( aPosition, aLayerSet );
1455 
1456  if( pad )
1457  return pad;
1458  }
1459 
1460  return NULL;
1461 }
MODULES m_modules
Definition: class_board.h:197
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:749
#define NULL

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

Referenced by GetPad().

◆ GetPad() [2/4]

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

Definition at line 1000 of file class_board.h.

1001  {
1002  return GetPad( aPosition, LSET().set() );
1003  }
LSET is a set of PCB_LAYER_IDs.
D_PAD * GetPad(const wxPoint &aPosition, LSET aLayerMask)
Find a pad aPosition on aLayer.

References GetPad().

◆ GetPad() [3/4]

D_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 D_PAD object if found or NULL if not found.

Definition at line 1464 of file class_board.cpp.

1465 {
1466  const wxPoint& aPosition = aTrace->GetEndPoint( aEndPoint );
1467 
1468  LSET lset( aTrace->GetLayer() );
1469 
1470  return GetPad( aPosition, lset );
1471 }
LSET is a set of PCB_LAYER_IDs.
D_PAD * GetPad(const wxPoint &aPosition, LSET aLayerMask)
Find a pad aPosition on aLayer.
const wxPoint & GetEndPoint(ENDPOINT_T aEndPoint) const
Return the selected endpoint (start or end)
Definition: class_track.h:125
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.

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

◆ GetPad() [4/4]

D_PAD * BOARD::GetPad ( std::vector< D_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<D_PAD*>)
aPositionA wxPoint object containing the position to test.
aLayerMaskA layer or layers to mask the hit test.
Returns
a D_PAD object pointer to the connected pad.

Definition at line 1493 of file class_board.cpp.

1494 {
1495  // Search aPadList for aPosition
1496  // aPadList is sorted by X then Y values, and a fast binary search is used
1497  int idxmax = aPadList.size()-1;
1498 
1499  int delta = aPadList.size();
1500 
1501  int idx = 0; // Starting index is the beginning of list
1502 
1503  while( delta )
1504  {
1505  // Calculate half size of remaining interval to test.
1506  // Ensure the computed value is not truncated (too small)
1507  if( (delta & 1) && ( delta > 1 ) )
1508  delta++;
1509 
1510  delta /= 2;
1511 
1512  D_PAD* pad = aPadList[idx];
1513 
1514  if( pad->GetPosition() == aPosition ) // candidate found
1515  {
1516  // The pad must match the layer mask:
1517  if( ( aLayerSet & pad->GetLayerSet() ).any() )
1518  return pad;
1519 
1520  // More than one pad can be at aPosition
1521  // search for a pad at aPosition that matched this mask
1522 
1523  // search next
1524  for( int ii = idx+1; ii <= idxmax; ii++ )
1525  {
1526  pad = aPadList[ii];
1527 
1528  if( pad->GetPosition() != aPosition )
1529  break;
1530 
1531  if( ( aLayerSet & pad->GetLayerSet() ).any() )
1532  return pad;
1533  }
1534  // search previous
1535  for( int ii = idx-1 ;ii >=0; ii-- )
1536  {
1537  pad = aPadList[ii];
1538 
1539  if( pad->GetPosition() != aPosition )
1540  break;
1541 
1542  if( ( aLayerSet & pad->GetLayerSet() ).any() )
1543  return pad;
1544  }
1545 
1546  // Not found:
1547  return 0;
1548  }
1549 
1550  if( pad->GetPosition().x == aPosition.x ) // Must search considering Y coordinate
1551  {
1552  if( pad->GetPosition().y < aPosition.y ) // Must search after this item
1553  {
1554  idx += delta;
1555 
1556  if( idx > idxmax )
1557  idx = idxmax;
1558  }
1559  else // Must search before this item
1560  {
1561  idx -= delta;
1562 
1563  if( idx < 0 )
1564  idx = 0;
1565  }
1566  }
1567  else if( pad->GetPosition().x < aPosition.x ) // Must search after this item
1568  {
1569  idx += delta;
1570 
1571  if( idx > idxmax )
1572  idx = idxmax;
1573  }
1574  else // Must search before this item
1575  {
1576  idx -= delta;
1577 
1578  if( idx < 0 )
1579  idx = 0;
1580  }
1581  }
1582 
1583  return NULL;
1584 }
wxPoint GetPosition() const override
Definition: class_pad.h:172
#define NULL
LSET GetLayerSet() const override
Function GetLayerSet returns a std::bitset of all layers on which the item physically resides.
Definition: class_pad.h:349

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

◆ GetPadCount()

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

Definition at line 1871 of file class_board.cpp.

1872 {
1873  unsigned retval = 0;
1874 
1875  for( MODULE* footprint : Modules() )
1876  retval += footprint->Pads().size();
1877 
1878  return retval;
1879 }
MODULES & Modules()
Definition: class_board.h:284

References Modules().

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

◆ GetPadFast()

D_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 D_PAD object if found or NULL if not found.

Definition at line 1474 of file class_board.cpp.

1475 {
1476  for( MODULE* footprint : Modules() )
1477  {
1478  for( D_PAD* pad : footprint->Pads() )
1479  {
1480  if( pad->GetPosition() != aPosition )
1481  continue;
1482 
1483  // Pad found, it must be on the correct layer
1484  if( ( pad->GetLayerSet() & aLayerSet ).any() )
1485  return pad;
1486  }
1487  }
1488 
1489  return nullptr;
1490 }
MODULES & Modules()
Definition: class_board.h:284

References Modules().

◆ GetPads()

const std::vector< D_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 1857 of file class_board.cpp.

1858 {
1859  std::vector<D_PAD*> allPads;
1860 
1861  for( MODULE* footprint : Modules() )
1862  {
1863  for( D_PAD* pad : footprint->Pads() )
1864  allPads.push_back( pad );
1865  }
1866 
1867  return allPads;
1868 }
MODULES & Modules()
Definition: class_board.h:284

References Modules().

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

◆ GetPageSettings()

◆ GetParent()

BOARD_ITEM_CONTAINER* BOARD_ITEM::GetParent ( void  ) const
inlineinherited

Definition at line 184 of file class_board_item.h.

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

References EDA_ITEM::m_Parent.

Referenced by POINT_EDITOR::addCorner(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), 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(), KIGFX::PCB_PAINTER::draw(), EDIT_TOOL::Duplicate(), EditToolSelectionFilter(), PCB_IO::format(), FormatProbeItem(), BOARD_ITEM::GetBoard(), MARKER_PCB::GetColorLayer(), FP_SHAPE::GetMsgPanelInfo(), FP_TEXT::GetSelectMenuText(), PCB_TEXT::GetShownText(), FP_TEXT::GetShownText(), SELECTION_TOOL::GuessSelectionCandidates(), GENERAL_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), FP_SHAPE::IsParentFlipped(), FP_TEXT::IsParentFlipped(), LEGACY_PLUGIN::loadMODULE_TEXT(), memberOf(), ALTIUM_PCB::ParseTexts6Data(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BOARD_COMMIT::Push(), DRC_TEST_PROVIDER_SILK_CLEARANCE::Run(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), CLIPBOARD_IO::SaveSelection(), SELECTION_TOOL::select(), SELECTION_TOOL::Selectable(), SwapItemData(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testCopperDrawItem(), PCB_GROUP::TopLevelGroup(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), MARKER_PCB::ViewGetLayers(), MODULE_ZONE_CONTAINER::ViewGetLOD(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem(), and PCB_GROUP::WithinScope().

◆ GetParentGroup()

◆ GetPlotOptions()

const PCB_PLOT_PARAMS& BOARD::GetPlotOptions ( ) const
inline

◆ GetPosition()

wxPoint BOARD::GetPosition ( ) const
overridevirtual

Reimplemented from EDA_ITEM.

Definition at line 227 of file class_board.cpp.

228 {
229  return ZeroOffset;
230 }
static wxPoint ZeroOffset
A value of wxPoint(0,0) which can be passed to the Draw() functions.

References BOARD_ITEM::ZeroOffset.

◆ GetProject()

PROJECT* BOARD::GetProject ( ) const
inline

◆ GetProperties()

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

Definition at line 307 of file class_board.h.

307 { return m_properties; }
std::map< wxString, wxString > m_properties
Definition: class_board.h:210

References m_properties.

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

◆ GetSelectMenuText()

wxString BOARD::GetSelectMenuText ( EDA_UNITS  aUnits) const
overridevirtual

Function GetSelectMenuText returns 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 720 of file class_board.cpp.

721 {
722  return wxString::Format( _( "PCB" ) );
723 }
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:201
#define _(s)
Definition: 3d_actions.cpp:33

References _, and Format().

◆ GetSortedPadListByXthenYCoord()

void BOARD::GetSortedPadListByXthenYCoord ( std::vector< D_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 1600 of file class_board.cpp.

1601 {
1602  for( MODULE* footprint : Modules() )
1603  {
1604  for( D_PAD* pad : footprint->Pads( ) )
1605  {
1606  if( aNetCode < 0 || pad->GetNetCode() == aNetCode )
1607  aVector.push_back( pad );
1608  }
1609  }
1610 
1611  std::sort( aVector.begin(), aVector.end(), sortPadsByXthenYCoord );
1612 }
MODULES & Modules()
Definition: class_board.h:284
bool sortPadsByXthenYCoord(D_PAD *const &ref, D_PAD *const &comp)
Used by #GetSortedPadListByXCoord to sort a pad list by X coordinate value.

References Modules(), and sortPadsByXthenYCoord().

Referenced by DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadClearances(), and DRC_TEST_PROVIDER_HOLE_CLEARANCE::testPads2Holes().

◆ 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 646 of file class_board.h.

647  {
648  // a BOARD's standard layer name is the PCB_LAYER_ID fixed name
649  return LayerName( aLayerId );
650  }
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 205 of file eda_item.h.

206  {
207  return m_Status & type;
208  }
STATUS_FLAGS m_Status
Definition: eda_item.h:162

References EDA_ITEM::m_Status.

Referenced by TRACK::GetMsgPanelInfoBase_Common(), and TRACK::IsLocked().

◆ GetStatus()

STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 218 of file eda_item.h.

218 { return m_Status; }
STATUS_FLAGS m_Status
Definition: eda_item.h:162

References EDA_ITEM::m_Status.

◆ GetTitleBlock()

TITLE_BLOCK& BOARD::GetTitleBlock ( )
inline

Definition at line 579 of file class_board.h.

579 { return m_titles; }
TITLE_BLOCK m_titles
Definition: class_board.h:214

References m_titles.

Referenced by GERBER_JOBFILE_WRITER::addJSONGeneralSpecs(), PCB_IO::formatGeneral(), PCB_BASE_FRAME::GetTitleBlock(), and StartPlotBoard().

◆ 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 1625 of file class_board.cpp.

1626 {
1627  int count = 0;
1628  double length = 0.0;
1629  double package_length = 0.0;
1630 
1631  constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T, PCB_PAD_T, EOT };
1632  auto connectivity = GetBoard()->GetConnectivity();
1633 
1634  for( BOARD_CONNECTED_ITEM* item : connectivity->GetConnectedItems(
1635  static_cast<const BOARD_CONNECTED_ITEM*>( &aTrack ), types ) )
1636  {
1637  count++;
1638 
1639  if( TRACK* track = dyn_cast<TRACK*>( item ) )
1640  {
1641  bool inPad = false;
1642 
1643  for( auto pad_it : connectivity->GetConnectedPads( item ) )
1644  {
1645  D_PAD* pad = static_cast<D_PAD*>( pad_it );
1646 
1647  if( pad->HitTest( track->GetStart(), track->GetWidth() / 2 )
1648  && pad->HitTest( track->GetEnd(), track->GetWidth() / 2 ) )
1649  {
1650  inPad = true;
1651  break;
1652  }
1653  }
1654 
1655  if( !inPad )
1656  length += track->GetLength();
1657  }
1658  else if( D_PAD* pad = dyn_cast<D_PAD*>( item ) )
1659  {
1660  package_length += pad->GetPadToDieLength();
1661  }
1662  }
1663 
1664  return std::make_tuple( count, length, package_length );
1665 }
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Function HitTest tests if aPosition is contained within or on the bounding box of an item.
Definition: class_pad.cpp:908
int GetPadToDieLength() const
Definition: class_pad.h:362
class ARC, an arc track segment on a copper layer
Definition: typeinfo.h:98
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
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:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: class_board.h:381
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97

References EOT, BOARD_ITEM::GetBoard(), GetConnectivity(), D_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 989 of file class_board.cpp.

990 {
991  return m_connectivity->GetUnconnectedCount();
992 }
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: class_board.h:211

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 488 of file class_board.cpp.

489 {
491 }
VTBL_ENTRY PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
Definition: project.h:149
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: class_board.h:216

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

Referenced by APPEARANCE_CONTROLS::getVisibleObjects().

◆ 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 448 of file class_board.cpp.

449 {
451 }
LSET m_VisibleLayers
Board settings.
VTBL_ENTRY PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
Definition: project.h:149
static LSET AllLayersMask()
Definition: lset.cpp:786
PROJECT * m_project
Definition: class_board.h:216

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(), SELECTION_TOOL::Selectable(), PCB_EDIT_FRAME::UpdateUserInterface(), and D_PAD::ViewGetLOD().

◆ GetX()

int BOARD_ITEM::GetX ( ) const
inlineinherited

Definition at line 110 of file class_board_item.h.

111  {
112  wxPoint p = GetPosition();
113  return p.x;
114  }
virtual wxPoint GetPosition() const
Definition: eda_item.h:326

References EDA_ITEM::GetPosition().

Referenced by BOARD_ITEM_DESC::BOARD_ITEM_DESC(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), BOARD_ITEM::SetY(), and TRACK_VIA_DESC::TRACK_VIA_DESC().

◆ GetY()

int BOARD_ITEM::GetY ( ) const
inlineinherited

Definition at line 116 of file class_board_item.h.

117  {
118  wxPoint p = GetPosition();
119  return p.y;
120  }
virtual wxPoint GetPosition() const
Definition: eda_item.h:326

References EDA_ITEM::GetPosition().

Referenced by BOARD_ITEM_DESC::BOARD_ITEM_DESC(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), BOARD_ITEM::SetX(), and TRACK_VIA_DESC::TRACK_VIA_DESC().

◆ GetZoneList()

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

Definition at line 1732 of file class_board.cpp.

1733 {
1734  std::list<ZONE_CONTAINER*> zones;
1735 
1736  for( ZONE_CONTAINER* zone : Zones() )
1737  zones.push_back( zone );
1738 
1739  if( aIncludeZonesInFootprints )
1740  {
1741  for( MODULE* footprint : m_modules )
1742  {
1743  for( MODULE_ZONE_CONTAINER* zone : footprint->Zones() )
1744  zones.push_back( zone );
1745  }
1746  }
1747 
1748  return zones;
1749 }
MODULES m_modules
Definition: class_board.h:197
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
ZONE_CONTAINERS & Zones()
Definition: class_board.h:290
MODULE_ZONE_CONTAINER is the same item as ZONE_CONTAINER, but with a specific type id ZONE_CONTAINER ...
Definition: class_zone.h:958

References m_modules, 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 563 of file class_board.h.

564  {
566  }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: class_board.h:558
ZONE_SETTINGS & GetDefaultZoneSettings()

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

Referenced by LEGACY_PLUGIN::loadSETUP().

◆ GroupLegalOps()

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

Definition at line 2067 of file class_board.cpp.

2068 {
2069  GroupLegalOpsField legalOps = { false, false, false, false, false, false };
2070 
2071  std::unordered_set<const BOARD_ITEM*> allMembers;
2072 
2073  for( const PCB_GROUP* grp : m_groups )
2074  {
2075  for( const BOARD_ITEM* member : grp->GetItems() )
2076  allMembers.insert( member );
2077  }
2078 
2079  bool hasGroup = ( SELECTION_CONDITIONS::HasType( PCB_GROUP_T ) )( selection );
2080  // All elements of selection are groups, and no element is a descendant group of any other.
2081  bool onlyGroups = ( SELECTION_CONDITIONS::OnlyType( PCB_GROUP_T ) )( selection );
2082  // Any elements of the selections are already members of groups
2083  bool anyGrouped = false;
2084  // Any elements of the selections, except the first group, are already members of groups.
2085  bool anyGroupedExceptFirst = false;
2086  // All elements of the selections are already members of groups
2087  bool allGrouped = true;
2088  bool seenFirstGroup = false;
2089 
2090  if( onlyGroups )
2091  {
2092  // Check that no groups are descendant subgroups of another group in the selection
2093  for( EDA_ITEM* item : selection )
2094  {
2095  const PCB_GROUP* group = static_cast<const PCB_GROUP*>( item );
2096  std::unordered_set<const PCB_GROUP*> subgroupos;
2097  std::queue<const PCB_GROUP*> toCheck;
2098  toCheck.push( group );
2099 
2100  while( !toCheck.empty() )
2101  {
2102  const PCB_GROUP* candidate = toCheck.front();
2103  toCheck.pop();
2104 
2105  for( const BOARD_ITEM* aChild : candidate->GetItems() )
2106  {
2107  if( aChild->Type() == PCB_GROUP_T )
2108  {
2109  const PCB_GROUP* childGroup = static_cast<const PCB_GROUP*>( aChild );
2110  subgroupos.insert( childGroup );
2111  toCheck.push( childGroup );
2112  }
2113  }
2114  }
2115 
2116  for( EDA_ITEM* otherItem : selection )
2117  {
2118  if( otherItem != item
2119  && subgroupos.find( static_cast<PCB_GROUP*>( otherItem ) ) != subgroupos.end() )
2120  {
2121  // otherItem is a descendant subgroup of item
2122  onlyGroups = false;
2123  }
2124  }
2125  }
2126  }
2127 
2128  for( EDA_ITEM* item : selection )
2129  {
2130  BOARD_ITEM* board_item = static_cast<BOARD_ITEM*>( item );
2131  bool isFirstGroup = !seenFirstGroup && board_item->Type() == PCB_GROUP_T;
2132 
2133  if( isFirstGroup )
2134  {
2135  seenFirstGroup = true;
2136  }
2137 
2138  if( allMembers.find( board_item ) == allMembers.end() )
2139  {
2140  allGrouped = false;
2141  }
2142  else
2143  {
2144  anyGrouped = true;
2145 
2146  if( !isFirstGroup )
2147  anyGroupedExceptFirst = true;
2148  }
2149  }
2150 
2151  legalOps.create = !anyGrouped;
2152  legalOps.merge = hasGroup && !anyGroupedExceptFirst && ( selection.Size() > 1 );
2153  legalOps.ungroup = onlyGroups;
2154  legalOps.removeItems = allGrouped;
2155  legalOps.flatten = onlyGroups;
2156  legalOps.enter = onlyGroups && selection.Size() == 1;
2157  return legalOps;
2158 }
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:109
PCB_GROUP is a set of BOARD_ITEMs (i.e., without duplicates)
GROUPS m_groups
Definition: class_board.h:199
static SELECTION_CONDITION HasType(KICAD_T aType)
Creates a functor that tests if among the selected items there is at least one of a given type.
const std::unordered_set< BOARD_ITEM * > & GetItems() const
static SELECTION_CONDITION OnlyType(KICAD_T aType)
Creates a functor that tests if the selected items are only of given type.
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: eda_item.h:148
KICAD_T Type() const
Function Type()
Definition: eda_item.h:182

References BOARD::GroupLegalOpsField::create, BOARD::GroupLegalOpsField::enter, BOARD::GroupLegalOpsField::flatten, PCB_GROUP::GetItems(), SELECTION_CONDITIONS::HasType(), m_groups, BOARD::GroupLegalOpsField::merge, SELECTION_CONDITIONS::OnlyType(), PCB_GROUP_T, BOARD::GroupLegalOpsField::removeItems, EDA_ITEM::Type(), and BOARD::GroupLegalOpsField::ungroup.

◆ Groups()

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 303 of file class_board.h.

303 { return m_groups; }
GROUPS m_groups
Definition: class_board.h:199

References m_groups.

Referenced by PCBNEW_CONTROL::AppendBoard(), PCB_IO::format(), GroupsSanityCheckInternal(), PCBNEW_CONTROL::placeBoardItems(), PCB_EDITOR_CONTROL::RepairBoard(), and TestForExistingItem().

◆ GroupsSanityCheck()

wxString BOARD::GroupsSanityCheck ( bool  repair = false)

Definition at line 1990 of file class_board.cpp.

1991 {
1992  if( repair )
1993  {
1994  while( GroupsSanityCheckInternal( repair ) != wxEmptyString );
1995  return wxEmptyString;
1996  }
1997  return GroupsSanityCheckInternal( repair );
1998 }
wxString GroupsSanityCheckInternal(bool repair)

References GroupsSanityCheckInternal().

Referenced by PCB_IO::Save().

◆ GroupsSanityCheckInternal()

wxString BOARD::GroupsSanityCheckInternal ( bool  repair)

Definition at line 2001 of file class_board.cpp.

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

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

Referenced by GroupsSanityCheck().

◆ HasFlag()

◆ HighLightOFF()

void BOARD::HighLightOFF ( )
inline

Disable net highlight.

Definition at line 449 of file class_board.h.

450  {
451  HighLightON( false );
452  }
void HighLightON(bool aValue=true)
Enable or disable net highlighting.

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 1980 of file class_board.cpp.

1981 {
1982  if( m_highLight.m_highLightOn != aValue )
1983  {
1984  m_highLight.m_highLightOn = aValue;
1986  }
1987 }
void InvokeListeners(Func &&aFunc, Args &&... args)
Definition: class_board.h:241
HIGH_LIGHT_INFO m_highLight
Definition: class_board.h:205
virtual void OnBoardHighlightNetChanged(BOARD &aBoard)
Definition: class_board.h:163

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

Referenced by PCB_EDIT_FRAME::ExecuteRemoteCommand(), PCB_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

Function HitTest tests 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, SCH_SHEET, D_PAD, ZONE_CONTAINER, MODULE, VIA, WS_DRAW_ITEM_BITMAP, ARC, SCH_TEXT, WS_DRAW_ITEM_TEXT, PCB_SHAPE, GERBER_DRAW_ITEM, DIMENSION, SCH_LINE, LIB_PIN, FP_TEXT, TRACK, LIB_ITEM, SCH_FIELD, WS_DRAW_ITEM_POLYPOLYGONS, SCH_BITMAP, PCB_GROUP, SCH_BUS_ENTRY_BASE, SCH_NO_CONNECT, WS_DRAW_ITEM_BASE, SCH_JUNCTION, PCB_TEXT, PCB_TARGET, LIB_POLYLINE, LIB_ARC, LIB_BEZIER, LIB_TEXT, and LIB_CIRCLE.

Definition at line 310 of file eda_item.h.

311  {
312  return false; // derived classes should override this function
313  }

◆ InvokeListeners()

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

Definition at line 241 of file class_board.h.

242  {
243  for( auto&& l : m_listeners )
244  ( l->*aFunc )( std::forward<Args>( args )... );
245  }
std::vector< BOARD_LISTENER * > m_listeners
Definition: class_board.h:232

References m_listeners.

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

◆ IsBrightened()

◆ IsConnected()

virtual bool BOARD_ITEM::IsConnected ( ) const
inlinevirtualinherited

Function IsConnected() Returns information if the object is derived from BOARD_CONNECTED_ITEM.

Returns
True if the object is of BOARD_CONNECTED_ITEM type, false otherwise.

Reimplemented in BOARD_CONNECTED_ITEM.

Definition at line 151 of file class_board_item.h.

152  {
153  return false;
154  }

Referenced by PNS_PCBNEW_RULE_RESOLVER::DpNetPair(), PNS::NODE::FindItemByParent(), PCB_INSPECTION_TOOL::InspectClearance(), isDiffPair(), CN_CONNECTIVITY_ALGO::markItemNetAsDirty(), and CONNECTIVITY_DATA::MarkItemNetAsDirty().

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 190 of file eda_item.h.

190 { return m_Flags & IS_DRAGGED; }
#define IS_DRAGGED
Item being dragged.
Definition: eda_item.h:108
STATUS_FLAGS m_Flags
Definition: eda_item.h:165

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 494 of file class_board.cpp.

495 {
497 }
VTBL_ENTRY PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
Definition: project.h:149
GAL_SET m_VisibleItems
The GAL layers (aka items) that are turned on for viewing (.
PROJECT * m_project
Definition: class_board.h:216

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

Referenced by ComputeBoundingBox(), KIGFX::PCB_PAINTER::draw(), MODULE::GetBoundingBox(), PCB_BASE_FRAME::GetCollectorsGuide(), SELECTION_TOOL::getCollectorsGuide(), PCB_EDIT_FRAME::IsElementVisible(), IsModuleLayerVisible(), SELECTION_TOOL::Selectable(), PCBNEW_PRINTOUT::setupViewLayers(), and PCB_DRAW_PANEL_GAL::SyncLayersVisibility().

◆ IsEmpty()

bool BOARD::IsEmpty ( ) const
inline

◆ IsFootprintHolder()

bool BOARD::IsFootprintHolder ( )
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 272 of file class_board.h.

273  {
275  }
BOARD_USE m_boardUse
What is this board being used for.
Definition: class_board.h:192

References FPHOLDER, and m_boardUse.

Referenced by BOARD_ADAPTER::createBoardPolygon().

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 275 of file eda_item.h.

275 { return m_forceVisible; }
bool m_forceVisible
Definition: eda_item.h:164

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 436 of file class_board.h.

436 { return m_highLight.m_highLightOn; }
HIGH_LIGHT_INFO m_highLight
Definition: class_board.h:205

References m_highLight, and HIGH_LIGHT_INFO::m_highLightOn.

Referenced by PCB_EDIT_FRAME::ExecuteRemoteCommand(), and DIALOG_SELECT_NET_FROM_LIST::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 480 of file class_board.h.

481  {
482  return GetDesignSettings().IsLayerEnabled( aLayer );
483  }
bool IsLayerEnabled(PCB_LAYER_ID aLayerId) const
Function IsLayerEnabled tests whether a given layer is enabled.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: class_board.h:558

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 440 of file class_board.cpp.

441 {
442  // If there is no project, assume layer is visible always
443  return GetDesignSettings().IsLayerEnabled( aLayer )
444  && ( !m_project || m_project->GetLocalSettings().m_VisibleLayers[aLayer] );
445 }
LSET m_VisibleLayers
Board settings.
bool IsLayerEnabled(PCB_LAYER_ID aLayerId) const
Function IsLayerEnabled tests whether a given layer is enabled.
VTBL_ENTRY PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
Definition: project.h:149
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: class_board.h:558
PROJECT * m_project
Definition: class_board.h:216

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

Referenced by DRAWING_TOOL::DrawVia(), MODULE::GetBoundingBox(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), PCB_BASE_FRAME::GetDocumentExtents(), BOARD_ADAPTER::Is3DLayerEnabled(), PCBNEW_CONTROL::LayerNext(), PCBNEW_CONTROL::LayerPrev(), SELECTION_TOOL::Selectable(), and PCB_DRAW_PANEL_GAL::SyncLayersVisibility().

◆ IsLocked()

virtual bool BOARD_ITEM::IsLocked ( ) const
inlinevirtualinherited

Function IsLocked.

Returns
bool - true if the object is locked, else false

Reimplemented in MODULE, and TRACK.

Definition at line 265 of file class_board_item.h.

266  {
267  // only footprints & TRACKs can be locked at this time.
268  return false;
269  }

Referenced by BOARD_ITEM_DESC::BOARD_ITEM_DESC(), PCBNEW_CONTROL::DeleteItemCursor(), EditToolSelectionFilter(), GENERAL_COLLECTOR::Inspect(), SELECTION_TOOL::itemPassesFilter(), and PCB_EDITOR_CONTROL::modifyLockSelected().

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 187 of file eda_item.h.

187 { return m_Flags & IS_CHANGED; }
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: eda_item.h:102
STATUS_FLAGS m_Flags
Definition: eda_item.h:165

References IS_CHANGED, and EDA_ITEM::m_Flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsModuleLayerVisible()

bool BOARD::IsModuleLayerVisible ( PCB_LAYER_ID  aLayer)

Expect either of the two layers on which a module 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 533 of file class_board.cpp.

534 {
535  switch( aLayer )
536  {
537  case F_Cu:
538  return IsElementVisible( LAYER_MOD_FR );
539 
540  case B_Cu:
541  return IsElementVisible( LAYER_MOD_BK );
542 
543  default:
544  wxFAIL_MSG( wxT( "BOARD::IsModuleLayerVisible() param error: bad layer" ) );
545  return true;
546  }
547 }
show footprints on back
show footprints on front
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.

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

Referenced by GetFootprint().

◆ 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, D_PAD, and ZONE_CONTAINER.

Definition at line 159 of file class_board_item.h.

160  {
161  return IsCopperLayer( GetLayer() );
162  }
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.

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

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

◆ IsOnLayer()

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

Function IsOnLayer tests to see if this object is on the given layer.

Is virtual so objects like D_PAD, which reside on multiple layers can do their own form of testing.

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

Reimplemented in D_PAD, VIA, ZONE_CONTAINER, and PCB_GROUP.

Definition at line 245 of file class_board_item.h.

246  {
247  return m_Layer == aLayer;
248  }
PCB_LAYER_ID m_Layer

References BOARD_ITEM::m_Layer.

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

◆ IsReplaceable()

virtual bool EDA_ITEM::IsReplaceable ( ) const
inlinevirtualinherited

Function IsReplaceable.

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

491 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 193 of file eda_item.h.

193 { return m_Flags & IS_RESIZED; }
#define IS_RESIZED
Item being resized.
Definition: eda_item.h:107
STATUS_FLAGS m_Flags
Definition: eda_item.h:165

References IS_RESIZED, and EDA_ITEM::m_Flags.

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

◆ IsSelected()

◆ IsTrack()

bool BOARD_ITEM::IsTrack ( ) const
inlineinherited

Function IsTrack tests to see if this object is a track or via (or microvia).

form of testing.

Returns
bool - true if a track or via, else false.

Definition at line 256 of file class_board_item.h.

257  {
258  return ( Type() == PCB_TRACE_T ) || ( Type() == PCB_VIA_T );
259  }
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
KICAD_T Type() const
Function Type()
Definition: eda_item.h:182

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

◆ IsType()

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

Function IsType Checks 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, D_PAD, PCB_SHAPE, SCH_FIELD, FP_TEXT, SCH_LINE, FP_SHAPE, and PCB_TEXT.

Definition at line 251 of file eda_item.h.

252  {
253  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
254  return true;
255 
256  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
257  {
258  if( m_StructType == *p )
259  return true;
260  }
261 
262  return false;
263  }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it.
Definition: eda_item.h:159
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78

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(), SCH_LINE::IsType(), FP_TEXT::IsType(), SCH_FIELD::IsType(), PCB_SHAPE::IsType(), D_PAD::IsType(), DIMENSION::IsType(), SCH_LABEL::IsType(), VIA::IsType(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), EE_SELECTION_TOOL::RequestSelection(), EDA_ITEM::Visit(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 191 of file eda_item.h.

191 { 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:165

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

IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T )

IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T )

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

Definition at line 373 of file eda_item.h.

377  {
378  for( auto it : aList )
379  {
380  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
382  return SEARCH_RESULT::QUIT;
383  }
384 
386  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
Function Visit may be re-implemented for each derived class in order to handle all the types given by...
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

IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T )

IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T )

This changes first parameter to avoid the DList and use std::vector instead

Definition at line 394 of file eda_item.h.

396  {
397  for( auto it : aList )
398  {
399  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
401  return SEARCH_RESULT::QUIT;
402  }
403 
405  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
Function Visit may be re-implemented for each derived class in order to handle all the types given by...
Definition: eda_item.cpp:107

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

◆ LayerMaskDescribe()

wxString BOARD_ITEM::LayerMaskDescribe ( ) const
protectedvirtualinherited

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

The BOARD is needed because layer names are (somewhat) customizable

Reimplemented in VIA.

Definition at line 72 of file class_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:749
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings Returns a bit-mask of all t...
static LSET AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
Definition: lset.cpp:819
LSET is a set of PCB_LAYER_IDs.
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
Information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:186
#define _(s)
Definition: 3d_actions.cpp:33
virtual LSET GetLayerSet() const
Function GetLayerSet returns a std::bitset of all layers on which the item physically resides.

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(), D_PAD::GetMsgPanelInfo(), and D_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 1909 of file class_board.cpp.

1910 {
1911  for( BOARD_CONNECTED_ITEM* item : AllConnectedItems() )
1912  {
1913  NETINFO_ITEM* netInfo = aDestBoard->FindNet( item->GetNetname() );
1914 
1915  if( netInfo )
1916  item->SetNet( netInfo );
1917  else
1918  item->SetNetCode( 0 );
1919  }
1920 }
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
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()
void SetNetCode(int aNetCode)
Definition: netinfo.h:225
NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65

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

◆ Markers()

◆ Matches() [1/2]

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

Function Matches compares 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, SCH_PIN, SCH_MARKER, MARKER_PCB, FP_TEXT, and PCB_TEXT.

Definition at line 447 of file eda_item.h.

448  {
449  return false;
450  }

Referenced by SCH_EDITOR_CONTROL::HasMatch(), PCB_TEXT::Matches(), FP_TEXT::Matches(), MARKER_PCB::Matches(), SCH_MARKER::Matches(), SCH_PIN::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,
wxFindReplaceData &  aSearchData 
)
protectedinherited

Function Matches compares 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
Function IsReplaceable.
Definition: eda_item.h:491

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

◆ Modules() [1/2]

MODULES& BOARD::Modules ( )
inline

Definition at line 284 of file class_board.h.

284 { return m_modules; }
MODULES m_modules
Definition: class_board.h:197

References m_modules.

Referenced by DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), C3D_RENDER_RAYTRACING::add_3D_vias_and_pads_to_container(), ZONE_FILLER::addHatchFillTypeOnZone(), GERBER_JOBFILE_WRITER::addJSONDesignRules(), AllConnectedItems(), PCBNEW_CONTROL::AppendBoard(), AR_AUTOPLACER::AR_AUTOPLACER(), AR_AUTOPLACER::AutoplaceModules(), CN_CONNECTIVITY_ALGO::Build(), build_pad_testpoints(), ZONE_FILLER::buildCopperItemClearances(), DRC_TEST_PROVIDER_HOLE_CLEARANCE::buildDrilledHoleList(), FROM_TO_CACHE::buildEndpointList(), GENDRILL_WRITER_BASE::buildHolesList(), DIALOG_BOARD_REANNOTATE::BuildModuleList(), DIALOG_SELECT_NET_FROM_LIST::buildNetsList(), ZONE_FILLER::buildThermalSpokes(), HYPERLYNX_EXPORTER::collectNetObjects(), ConvertCrossReferencesToKIIDs(), CreateComponentsSection(), BOARD_ADAPTER::createLayers(), PLACEFILE_GERBER_WRITER::CreatePlaceFile(), CreateShapesSection(), CreateSignalsSection(), BOARD_NETLIST_UPDATER::deleteUnusedComponents(), PCB_DRAW_PANEL_GAL::DisplayBoard(), doPushPadProperties(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::doTrackDrc(), DRAWING_TOOL::DrawVia(), 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::FlipMODULEs(), DRC_TEST_PROVIDER::forEachGeometryItem(), PCB_IO::format(), C3D_RENDER_OGL_LEGACY::generate_3D_Vias_and_Pads(), 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(), PCB_INSPECTION_TOOL::InspectConstraints(), PCB_EDIT_FRAME::KiwayMailIn(), ZONE_FILLER::knockoutThermalReliefs(), C3D_RENDER_OGL_LEGACY::load_3D_models(), C3D_RENDER_RAYTRACING::load_3D_models(), DRC_ENGINE::loadImplicitRules(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), AR_AUTOPLACER::nearestPad(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), ALTIUM_PCB::Parse(), PCBNEW_CONTROL::Paste(), AR_AUTOPLACER::pickModule(), PCBNEW_CONTROL::placeBoardItems(), BRDITEMS_PLOTTER::PlotDrillMarks(), PlotLayerOutlines(), PlotSolderMaskLayer(), PlotStandardLayer(), DIALOG_EXCHANGE_FOOTPRINTS::processMatchingFootprints(), BOARD_COMMIT::Push(), RecreateCmpFile(), C3D_RENDER_OGL_LEGACY::render_3D_models_selected(), PCB_EDITOR_CONTROL::RepairBoard(), DSN::SPECCTRA_DB::RevertMODULEs(), DRC_TEST_PROVIDER_HOLE_SIZE::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_COPPER_CLEARANCE::testCopperTextAndGraphics(), DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testFootprintCourtyardDefinitions(), DRC_TEST_PROVIDER_LVS::testFootprints(), TestForExistingItem(), DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testOverlappingComponentCourtyards(), DIALOG_UNUSED_PAD_LAYERS::TransferDataFromWindow(), NETINFO_MAPPING::Update(), BOARD_NETLIST_UPDATER::UpdateNetlist(), HYPERLYNX_EXPORTER::writeDevices(), and HYPERLYNX_EXPORTER::writePadStacks().

◆ Modules() [2/2]

const MODULES& BOARD::Modules ( ) const
inline

Definition at line 285 of file class_board.h.

285 { return m_modules; }
MODULES m_modules
Definition: class_board.h:197

References m_modules.

◆ Move() [1/2]

void BOARD_ITEM::Move ( const VECTOR2I aMoveVector)
inlineinherited

Definition at line 304 of file class_board_item.h.

305  {
306  Move( wxPoint( aMoveVector.x, aMoveVector.y ) );
307  }
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.

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

◆ Move() [2/2]

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

Function Move move this object.

Parameters
aMoveVector- the move vector for this object.

Reimplemented from BOARD_ITEM.

Definition at line 239 of file class_board.cpp.

240 {
241  // @todo : anything like this elsewhere? maybe put into GENERAL_COLLECTOR class.
242  static const KICAD_T top_level_board_stuff[] = {
243  PCB_MARKER_T,
244  PCB_TEXT_T,
245  PCB_SHAPE_T,
248  PCB_TARGET_T,
249  PCB_VIA_T,
250  PCB_TRACE_T,
251  PCB_ARC_T,
252  // PCB_PAD_T, Can't be at board level
253  // PCB_FP_TEXT_T, Can't be at board level
254  PCB_MODULE_T,
256  EOT
257  };
258 
259  INSPECTOR_FUNC inspector = [&] ( EDA_ITEM* item, void* testData )
260  {
261  BOARD_ITEM* brd_item = (BOARD_ITEM*) item;
262 
263  // aMoveVector was snapshotted, don't need "data".
264  brd_item->Move( aMoveVector );
265 
267  };
268 
269