KiCad PCB EDA Suite
BOARD Class Reference

BOARD holds 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

Public Member Functions

void SetFileName (const wxString &aFileName)
 
const wxString & GetFileName () const
 
TRACKS & Tracks ()
 
const TRACKS & Tracks () const
 
MODULES & Modules ()
 
const MODULES & Modules () const
 
DRAWINGS & Drawings ()
 
ZONE_CONTAINERS & Zones ()
 
MARKERS & Markers ()
 
const std::vector< BOARD_CONNECTED_ITEM * > AllConnectedItems ()
 
 BOARD ()
 
 ~BOARD ()
 
wxPoint GetPosition () const override
 
void SetPosition (const wxPoint &aPos) override
 
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 modules from the deque and frees the memory associated with them. More...
 
BOARD_ITEMGetItem (const KIID &aID)
 
void FillItemMap (std::map< KIID, EDA_ITEM * > &aMap)
 
std::shared_ptr< CONNECTIVITY_DATAGetConnectivity () const
 Function GetConnectivity() returns 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 ()
 Function DeleteMARKERs deletes ALL MARKERS from the board. More...
 
void DeleteMARKERs (bool aWarningsAndErrors, bool aExclusions)
 
void DeleteZONEOutlines ()
 Function DeleteZONEOutlines deletes ALL zone outlines from the board. More...
 
PROJECTGetProject () const
 
void SetProject (PROJECT *aProject)
 Links a board to a given project. More...
 
void ClearProject ()
 
void ResetNetHighLight ()
 Function ResetNetHighLight Reset all high light data to the init state. More...
 
const std::set< int > & GetHighLightNetCodes () const
 Function GetHighLightNetCode. More...
 
void SetHighLightNet (int aNetCode, bool aMulti=false)
 Function SetHighLightNet Select the netcode to be highlighted. More...
 
bool IsHighLightNetON () const
 Function IsHighLightNetON. More...
 
void HighLightON (bool aValue=true)
 Enable or disable net highlighting. More...
 
void HighLightOFF ()
 Function HighLightOFF Disable net highlight. More...
 
int GetCopperLayerCount () const
 Function GetCopperLayerCount. More...
 
void SetCopperLayerCount (int aCount)
 
LSET GetEnabledLayers () const
 Function GetEnabledLayers is 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)
 Function SetEnabledLayers is 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
 Function IsLayerEnabled is 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
 Function IsLayerVisible is a proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer is visible. More...
 
LSET GetVisibleLayers () const
 Function GetVisibleLayers is 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)
 Function SetVisibleLayers is 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)
 Function SetVisibleElements is a proxy function that calls the correspondent function in m_BoardSettings changes the bit-mask of visible element categories. More...
 
void SetVisibleAlls ()
 Function SetVisibleAlls changes the bit-mask of visible element categories and layers. More...
 
bool IsElementVisible (GAL_LAYER_ID aLayer) const
 Function IsElementVisible tests whether a given element category is visible. More...
 
void SetElementVisibility (GAL_LAYER_ID aLayer, bool aNewState)
 Function SetElementVisibility changes the visibility of an element category. More...
 
bool IsModuleLayerVisible (PCB_LAYER_ID aLayer)
 Function IsModuleLayerVisible expects either of the two layers on which a module can reside, and returns whether that layer is visible. More...
 
BOARD_DESIGN_SETTINGSGetDesignSettings () const
 Function GetDesignSettings. More...
 
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, wxPoint *aErrorLocation=nullptr)
 Function GetBoardPolygonOutlines Extracts 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)
 Function ConvertBrdLayerToPolygonalContours Build a set of polygons which are the outlines of copper items (pads, tracks, vias, texts, zones) Holes in vias or pads are ignored Usefull to export the shape of copper layers to dxf polygons or 3D viewer the polygons are not merged. More...
 
const PCB_LAYER_ID GetLayerID (const wxString &aLayerName) const
 Function GetLayerID returns the ID of a layer. More...
 
const wxString GetLayerName (PCB_LAYER_ID aLayer) const
 Function GetLayerName returns the name of a layer. More...
 
bool SetLayerName (PCB_LAYER_ID aLayer, const wxString &aLayerName)
 Function SetLayerName changes the name of the layer given by aLayer. More...
 
bool SetLayerDescr (PCB_LAYER_ID aIndex, const LAYER &aLayer)
 Function SetLayerDescr returns the type of the copper layer given by aLayer. More...
 
LAYER_T GetLayerType (PCB_LAYER_ID aLayer) const
 Function GetLayerType returns the type of the copper layer given by aLayer. More...
 
bool SetLayerType (PCB_LAYER_ID aLayer, LAYER_T aLayerType)
 Function SetLayerType changes the type of the layer given by aLayer. More...
 
unsigned GetNodesCount (int aNet=-1)
 Function GetNodesCount. More...
 
unsigned GetUnconnectedNetCount () const
 Function GetUnconnectedNetCount. More...
 
unsigned GetPadCount ()
 Function GetPadCount. More...
 
D_PADGetPad (unsigned aIndex) const
 Function GetPad. More...
 
const std::vector< D_PAD * > GetPads ()
 Function GetPads returns a reference to a list of all the pads. More...
 
void BuildListOfNets ()
 
NETINFO_ITEMFindNet (int aNetcode) const
 Function FindNet searches for a net with the given netcode. More...
 
NETINFO_ITEMFindNet (const wxString &aNetname) const
 Function FindNet overloaded searches for a net with the given name. More...
 
const NETINFO_LISTGetNetInfo () const
 
NETINFO_LISTGetNetInfo ()
 
NETINFO_LIST::iterator BeginNets () const
 Function BeginNets. More...
 
NETINFO_LIST::iterator EndNets () const
 Function EndNets. More...
 
unsigned GetNetCount () const
 Function GetNetCount. More...
 
EDA_RECT ComputeBoundingBox (bool aBoardEdgesOnly=false) const
 Function ComputeBoundingBox calculates 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
 Function GetBoardEdgesBoundingBox 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
 Function Visit 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
 Function FindModuleByReference searches for a MODULE within this board with the given reference designator. More...
 
MODULEFindModuleByPath (const KIID_PATH &aPath) const
 Function FindModuleByPath searches for a MODULE within this board with the given path. More...
 
int SortedNetnamesList (wxArrayString &aNames, bool aSortbyPadsCount)
 Function SortedNetnamesList. More...
 
std::vector< wxString > GetNetClassAssignmentCandidates ()
 Function GetNetClassAssignmentCandidates Returns a list of name candidates for netclass assignment. More...
 
void SynchronizeNetsAndNetClasses ()
 Function SynchronizeNetsAndNetClasses copies NETCLASS info to each NET, based on NET membership in a NETCLASS. More...
 
wxString GetClass () const override
 Function GetClass returns the class name. More...
 
int SetAreasNetCodesFromNetNames (void)
 Function 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
 Function GetArea returns the Area (Zone Container) at a given index. More...
 
int GetAreaIndex (const ZONE_CONTAINER *aArea) const
 Function GetAreaIndex returns the Area Index for the given Zone Container. More...
 
std::list< ZONE_CONTAINER * > GetZoneList (bool aIncludeZonesInFootprints=false)
 Function GetZoneList. More...
 
int GetAreaCount () const
 Function GetAreaCount. More...
 
ZONE_CONTAINERAddArea (PICKED_ITEMS_LIST *aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer, wxPoint aStartPointPosition, ZONE_BORDER_DISPLAY_STYLE aHatch)
 Function AddArea Add an empty copper area to board areas list. More...
 
ZONE_CONTAINERInsertArea (int aNetcode, int aAreaIdx, PCB_LAYER_ID aLayer, int aCornerX, int aCornerY, ZONE_BORDER_DISPLAY_STYLE aHatch)
 Add a copper area to net, inserting after m_ZoneDescriptorList[aAreaIdx]. More...
 
bool NormalizeAreaPolygon (PICKED_ITEMS_LIST *aNewZonesList, ZONE_CONTAINER *aCurrArea)
 Function NormalizeAreaPolygon Process an area that has been modified, by normalizing its polygon against itself. More...
 
bool OnAreaPolygonModified (PICKED_ITEMS_LIST *aModifiedZonesList, ZONE_CONTAINER *modified_area)
 Function OnAreaPolygonModified 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)
 Function CombineAllAreasInNet Checks all copper areas in net for intersections, combining them if found. More...
 
void RemoveArea (PICKED_ITEMS_LIST *aDeletedList, ZONE_CONTAINER *area_to_remove)
 Function RemoveArea remove copper area from net, and put it in a deleted list (if exists) More...
 
bool TestAreaIntersections (ZONE_CONTAINER *area_to_test)
 Function TestAreaIntersections 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)
 Function TestAreaIntersection Test for intersection of 2 copper areas area_to_test must be after area_ref in m_ZoneDescriptorList. More...
 
bool CombineAreas (PICKED_ITEMS_LIST *aDeletedList, ZONE_CONTAINER *area_ref, ZONE_CONTAINER *area_to_combine)
 Function CombineAreas If possible, combine 2 copper areas. More...
 
D_PADGetPad (const wxPoint &aPosition, LSET aLayerMask)
 Function GetPad finds a pad aPosition on aLayer. More...
 
D_PADGetPad (const wxPoint &aPosition)
 
D_PADGetPad (TRACK *aTrace, ENDPOINT_T aEndPoint)
 Function GetPad finds a pad connected to aEndPoint of aTrace. More...
 
D_PADGetPadFast (const wxPoint &aPosition, LSET aLayerMask)
 Function GetPadFast 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)
 Function GetPad locates the pad connected at aPosition on aLayer starting at list position aPad. More...
 
void PadDelete (D_PAD *aPad)
 Function PadDelete deletes a given bad 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)
 Function GetSortedPadListByXthenYCoord 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)
 Function TrackInNet collects 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)
 Function GetFootprint get a footprint by its bounding rectangle at aPosition on aLayer. More...
 
void ClearAllNetCodes ()
 Function ClearAllNetCodes() Resets 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...
 
virtual void Delete (BOARD_ITEM *aItem)
 Removes an item from the container and deletes it. More...
 
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 "layer mask", which is a bitmap of all layers on which the TRACK segment or VIA physically resides. More...
 
virtual void SetLayer (PCB_LAYER_ID aLayer)
 Function SetLayer sets the layer this item is on. More...
 
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, int aClearanceValue, int aError=ARC_LOW_DEF, 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 const wxPoint GetFocusPosition () const
 Function GetFocusPosition similar to GetPosition, but allows items to return their visual center rather than their anchor. 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 unsigned int 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)
 Function GetStandardLayerName returns an "English Standard" name of a PCB layer when given aLayerNumber. More...
 
static wxString ShowShape (STROKE_T aShape)
 Function ShowShape converts the enum STROKE_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

ZONE_CONTAINERm_CurrentZoneContour
 zone contour currently in progress More...
 
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

bool Matches (const wxString &aText, wxFindReplaceData &aSearchData)
 Function Matches compares aText against search criteria in aSearchData. More...
 

Static Protected Member Functions

static wxString LayerMaskDescribe (const BOARD *aBoard, LSET aMask)
 Helper function Return a string (to be shown to the user) describing a layer mask. More...
 

Protected Attributes

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

wxString m_fileName
 the board filename More...
 
MARKERS m_markers
 MARKER_PCBs for clearance problems, owned by pointer. More...
 
DRAWINGS m_drawings
 BOARD_ITEMs for drawings on the board, owned by pointer. More...
 
MODULES m_modules
 MODULES for components on the board, owned by pointer. More...
 
TRACKS m_tracks
 TRACKS for traces on the board, owned by pointer. More...
 
ZONE_CONTAINERS m_ZoneDescriptorList
 edge zone descriptors, owned by pointer. More...
 
LAYER m_Layer [PCB_LAYER_ID_COUNT]
 
HIGH_LIGHT_INFO m_highLight
 
HIGH_LIGHT_INFO m_highLightPrevious
 
int m_fileFormatVersionAtLoad
 
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

BOARD holds information pertinent to a Pcbnew printed circuit board.

Definition at line 180 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 57 of file class_board.cpp.

57  :
60  m_project( nullptr ),
61  m_designSettings( new BOARD_DESIGN_SETTINGS( nullptr, "board.design_settings" ) ),
62  m_NetInfo( this ),
65 {
66  // we have not loaded a board yet, assume latest until then.
67  m_fileFormatVersionAtLoad = LEGACY_BOARD_FILE_VERSION;
68 
69  m_CurrentZoneContour = NULL; // This ZONE_CONTAINER handle the
70  // zone contour currently in progress
71 
72  for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
73  {
74  m_Layer[layer].m_name = GetStandardLayerName( ToLAYER_ID( layer ) );
75 
76  if( IsCopperLayer( layer ) )
77  m_Layer[layer].m_type = LT_SIGNAL;
78  else
79  m_Layer[layer].m_type = LT_UNDEFINED;
80  }
81 
83 
84  // Initialize default netclass.
85  NETCLASS* defaultClass = bds.GetDefault();
86  defaultClass->SetDescription( _( "This is the default net class." ) );
87  bds.SetCurrentNetClass( defaultClass->GetName() );
88 
89  // Set sensible initial values for custom track width & via size
90  bds.UseCustomTrackViaSize( false );
94 
95  // Initialize ratsnest
96  m_connectivity.reset( new CONNECTIVITY_DATA() );
97 
98  // Set flag bits on these that will only be cleared if these are loaded from a legacy file
99  m_LegacyVisibleLayers.reset().set( Rescue );
101 }
Definition: typeinfo.h:85
bool m_LegacyDesignSettingsLoaded
True if the legacy board design settings were loaded from a file.
Definition: class_board.h:300
int GetCurrentViaDrill() const
Function GetCurrentViaDrill.
wxString m_name
The name of the layer, there should be no spaces in this name.
Definition: class_board.h:106
bool m_LegacyNetclassesLoaded
True if netclasses were loaded from the file.
Definition: class_board.h:303
int GetCurrentTrackWidth() const
Function GetCurrentTrackWidth.
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
const wxString & GetName() const
Definition: netclass.h:96
PAGE_INFO m_paper
Definition: class_board.h:213
void SetCustomViaDrill(int aDrill)
Function SetCustomViaDrill Sets custom size for via drill (i.e.
LAYER_T m_type
The type of the layer.
Definition: class_board.h:107
ZONE_CONTAINER * m_CurrentZoneContour
zone contour currently in progress
Definition: class_board.h:293
void SetDescription(const wxString &aDesc)
Definition: netclass.h:156
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:553
This is the end of the layers used for visibility bitmasks in Pcbnew There can be at most 32 layers a...
NETINFO_LIST m_NetInfo
Definition: class_board.h:230
void SetCustomViaSize(int aSize)
Function SetCustomViaSize Sets custom size for via diameter (i.e.
#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
void SetCustomTrackWidth(int aWidth)
Function SetCustomTrackWidth Sets custom width for track (i.e.
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
int GetCurrentViaSize() const
Function GetCurrentViaSize.
bool SetCurrentNetClass(const wxString &aNetClassName)
Function SetCurrentNetClass Must be called after a netclass selection (or after a netclass parameter ...
int m_fileFormatVersionAtLoad
Definition: class_board.h:209
#define _(s)
Definition: 3d_actions.cpp:33
LAYER m_Layer[PCB_LAYER_ID_COUNT]
Definition: class_board.h:203
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: class_board.h:211
NETCLASS * GetDefault() const
Function GetDefault.
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer 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:296
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:849
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)
Function GetStandardLayerName returns an "English Standard" name of a PCB layer when given aLayerNumb...
Definition: class_board.h:650
BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.
GAL_SET m_LegacyVisibleItems
Definition: class_board.h:297

References _, GAL_LAYER_ID_BITMASK_END, GAL_LAYER_INDEX, BOARD_DESIGN_SETTINGS::GetCurrentTrackWidth(), BOARD_DESIGN_SETTINGS::GetCurrentViaDrill(), BOARD_DESIGN_SETTINGS::GetCurrentViaSize(), BOARD_DESIGN_SETTINGS::GetDefault(), GetDesignSettings(), NETCLASS::GetName(), GetStandardLayerName(), IsCopperLayer(), LT_SIGNAL, LT_UNDEFINED, m_connectivity, m_CurrentZoneContour, m_fileFormatVersionAtLoad, m_Layer, m_LegacyVisibleItems, m_LegacyVisibleLayers, LAYER::m_name, LAYER::m_type, NULL, PCB_LAYER_ID_COUNT, Rescue, GAL_SET::set(), BOARD_DESIGN_SETTINGS::SetCurrentNetClass(), BOARD_DESIGN_SETTINGS::SetCustomTrackWidth(), BOARD_DESIGN_SETTINGS::SetCustomViaDrill(), BOARD_DESIGN_SETTINGS::SetCustomViaSize(), NETCLASS::SetDescription(), ToLAYER_ID(), and BOARD_DESIGN_SETTINGS::UseCustomTrackViaSize().

◆ ~BOARD()

BOARD::~BOARD ( )

Definition at line 104 of file class_board.cpp.

105 {
106  while( m_ZoneDescriptorList.size() )
107  {
108  ZONE_CONTAINER* area_to_remove = m_ZoneDescriptorList[0];
109  Delete( area_to_remove );
110  }
111 
112  // Clean up the owned elements
113  DeleteMARKERs();
115 
116  // Delete the modules
117  for( auto m : m_modules )
118  delete m;
119 
120  m_modules.clear();
121 
122  // Delete the tracks
123  for( auto t : m_tracks )
124  delete t;
125 
126  m_tracks.clear();
127 
128  // Delete the drawings
129  for (auto d : m_drawings )
130  delete d;
131 
132  m_drawings.clear();
133 
134  delete m_CurrentZoneContour;
136 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:195
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
void DeleteZONEOutlines()
Function DeleteZONEOutlines deletes ALL zone outlines from the board.
ZONE_CONTAINER * m_CurrentZoneContour
zone contour currently in progress
Definition: class_board.h:293
TRACKS m_tracks
TRACKS for traces on the board, owned by pointer.
Definition: class_board.h:198
#define NULL
void DeleteMARKERs()
Function DeleteMARKERs deletes ALL MARKERS from the board.
DRAWINGS m_drawings
BOARD_ITEMs for drawings on the board, owned by pointer.
Definition: class_board.h:192
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:201
virtual void Delete(BOARD_ITEM *aItem)
Removes an item from the container and deletes it.

References BOARD_ITEM_CONTAINER::Delete(), DeleteMARKERs(), DeleteZONEOutlines(), m_CurrentZoneContour, m_drawings, m_modules, m_tracks, m_ZoneDescriptorList, and NULL.

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

542 {
543  if( aBoardItem == NULL )
544  {
545  wxFAIL_MSG( wxT( "BOARD::Add() param error: aBoardItem NULL" ) );
546  return;
547  }
548 
549  switch( aBoardItem->Type() )
550  {
551  case PCB_NETINFO_T:
552  m_NetInfo.AppendNet( (NETINFO_ITEM*) aBoardItem );
553  break;
554 
555  // this one uses a vector
556  case PCB_MARKER_T:
557  m_markers.push_back( (MARKER_PCB*) aBoardItem );
558  break;
559 
560  // this one uses a vector
561  case PCB_ZONE_AREA_T:
562  m_ZoneDescriptorList.push_back( (ZONE_CONTAINER*) aBoardItem );
563  break;
564 
565  case PCB_TRACE_T:
566  case PCB_VIA_T:
567  case PCB_ARC_T:
568 
569  // N.B. This inserts a small memory leak as we lose the
570  if( !IsCopperLayer( aBoardItem->GetLayer() ) )
571  {
572  wxFAIL_MSG( wxT( "BOARD::Add() Cannot place Track on non-copper layer" ) );
573  return;
574  }
575 
576  if( aMode == ADD_MODE::APPEND )
577  m_tracks.push_back( static_cast<TRACK*>( aBoardItem ) );
578  else
579  m_tracks.push_front( static_cast<TRACK*>( aBoardItem ) );
580 
581  break;
582 
583  case PCB_MODULE_T:
584  if( aMode == ADD_MODE::APPEND )
585  m_modules.push_back( (MODULE*) aBoardItem );
586  else
587  m_modules.push_front( (MODULE*) aBoardItem );
588 
589  break;
590 
591  case PCB_DIMENSION_T:
592  case PCB_LINE_T:
593  case PCB_TEXT_T:
594  case PCB_TARGET_T:
595  if( aMode == ADD_MODE::APPEND )
596  m_drawings.push_back( aBoardItem );
597  else
598  m_drawings.push_front( aBoardItem );
599 
600  break;
601 
602  // other types may use linked list
603  default:
604  {
605  wxString msg;
606  msg.Printf( wxT( "BOARD::Add() needs work: BOARD_ITEM type (%d) not handled" ),
607  aBoardItem->Type() );
608  wxFAIL_MSG( msg );
609  return;
610  }
611  break;
612  }
613 
614  aBoardItem->SetParent( this );
615  aBoardItem->ClearEditFlags();
616  m_connectivity->Add( aBoardItem );
617 
618  InvokeListeners( &BOARD_LISTENER::OnBoardItemAdded, *this, aBoardItem );
619 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:195
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 ZONE_CONTAINER, a zone area
Definition: typeinfo.h:102
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:212
class TEXTE_PCB, 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
TRACKS for traces on the board, owned by pointer.
Definition: class_board.h:198
virtual void OnBoardItemAdded(BOARD &aBoard, BOARD_ITEM *aBoardItem)
Definition: class_board.h:163
virtual void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:196
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
MARKER_PCBs for clearance problems, owned by pointer.
Definition: class_board.h:189
DRAWINGS m_drawings
BOARD_ITEMs for drawings on the board, owned by pointer.
Definition: class_board.h:192
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:100
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:101
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
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:201
class NETINFO_ITEM, a description of a net
Definition: typeinfo.h:104
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: class_board.h:211
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:91
void ClearEditFlags()
Definition: base_struct.h:251
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References APPEND, NETINFO_LIST::AppendNet(), EDA_ITEM::ClearEditFlags(), ZONE_CONTAINER::GetLayer(), InvokeListeners(), IsCopperLayer(), m_connectivity, m_drawings, m_markers, m_modules, m_NetInfo, m_tracks, m_ZoneDescriptorList, NULL, BOARD_LISTENER::OnBoardItemAdded(), PCB_ARC_T, PCB_DIMENSION_T, PCB_LINE_T, PCB_MARKER_T, PCB_MODULE_T, PCB_NETINFO_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(), 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(), 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(), 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 
)

Function AddArea 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 1672 of file class_board.cpp.

1674 {
1675  ZONE_CONTAINER* new_area = InsertArea( aNetcode,
1676  m_ZoneDescriptorList.size( ) - 1,
1677  aLayer, aStartPointPosition.x,
1678  aStartPointPosition.y, aHatch );
1679 
1680  if( aNewZonesList )
1681  {
1682  ITEM_PICKER picker( nullptr, new_area, UR_NEW );
1683  aNewZonesList->PushItem( picker );
1684  }
1685 
1686  return new_area;
1687 }
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
ZONE_CONTAINER * InsertArea(int aNetcode, int aAreaIdx, PCB_LAYER_ID aLayer, int aCornerX, int aCornerY, ZONE_BORDER_DISPLAY_STYLE aHatch)
Add a copper area to net, inserting after m_ZoneDescriptorList[aAreaIdx].
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:201

References InsertArea(), m_ZoneDescriptorList, PICKED_ITEMS_LIST::PushItem(), UR_NEW, wxPoint::x, and wxPoint::y.

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

1909 {
1910  if( std::find( m_listeners.begin(), m_listeners.end(), aListener ) == m_listeners.end() )
1911  m_listeners.push_back( aListener );
1912 }
std::vector< BOARD_LISTENER * > m_listeners
Definition: class_board.h:232

References m_listeners.

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

◆ AllConnectedItems()

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

Definition at line 1850 of file class_board.cpp.

1851 {
1852  std::vector<BOARD_CONNECTED_ITEM*> items;
1853 
1854  for( auto track : Tracks() )
1855  {
1856  items.push_back( track );
1857  }
1858 
1859  for( auto mod : Modules() )
1860  {
1861  for( auto pad : mod->Pads() )
1862  {
1863  items.push_back( pad );
1864  }
1865  }
1866 
1867  for( int i = 0; i<GetAreaCount(); i++ )
1868  {
1869  auto zone = GetArea( i );
1870  items.push_back( zone );
1871  }
1872 
1873  return items;
1874 }
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:934
MODULES & Modules()
Definition: class_board.h:266
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:899
TRACKS & Tracks()
Definition: class_board.h:257

References GetArea(), GetAreaCount(), Modules(), and Tracks().

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

◆ BeginNets()

NETINFO_LIST::iterator BOARD::BeginNets ( ) const
inline

Function BeginNets.

Returns
iterator to the first element of the NETINFO_ITEMs list

Definition at line 756 of file class_board.h.

757  {
758  return m_NetInfo.begin();
759  }
NETINFO_LIST m_NetInfo
Definition: class_board.h:230
iterator begin() const
Definition: netinfo.h:549

References NETINFO_LIST::begin().

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

140 {
141  GetConnectivity()->Build( this );
142 }
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:355

References GetConnectivity().

Referenced by PCBNEW_CONTROL::AppendBoard(), TRACKS_CLEANER::cleanupSegments(), 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 720 of file class_board.h.

721  {
723  }
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().

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: base_struct.h:193

References PCB_T, and EDA_ITEM::Type().

◆ ClearAllNetCodes()

void BOARD::ClearAllNetCodes ( )

Function ClearAllNetCodes() Resets all items' netcodes to 0 (no net).

Definition at line 1877 of file class_board.cpp.

1878 {
1879  for( BOARD_CONNECTED_ITEM* item : AllConnectedItems() )
1880  item->SetNetCode( 0 );
1881 }
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 233 of file base_struct.h.

233 { m_Flags &= ~aMask; }
STATUS_FLAGS m_Flags
Definition: base_struct.h:176

References EDA_ITEM::m_Flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_SCREEN::ClearAnnotation(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), clearModuleItemFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), SCH_EDIT_FRAME::ConvertPart(), LIB_EDIT_TOOL::Copy(), LIB_PIN_TOOL::CreateImagePins(), MICROWAVE_TOOL::createMicrowaveInductor(), SCH_EDIT_FRAME::DeleteAnnotation(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), KIGFX::SCH_PAINTER::draw(), LIB_EDIT_TOOL::Duplicate(), SCH_ITEM::Duplicate(), PCB_EDIT_FRAME::Exchange_Module(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), FOOTPRINT_EDIT_FRAME::LoadModuleFromLibrary(), 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_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(), EE_SELECTION_TOOL::SelectPoint(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ ClearProject()

void BOARD::ClearProject ( )

Definition at line 171 of file class_board.cpp.

172 {
173  if( !m_project )
174  return;
175 
176  PROJECT_FILE& project = m_project->GetProjectFile();
177 
178  // Owned by the BOARD
179  if( project.m_BoardSettings )
180  {
181  project.ReleaseNestedSettings( project.m_BoardSettings );
182  project.m_BoardSettings = nullptr;
183  }
184 
185  GetDesignSettings().SetParent( nullptr );
186  m_project = nullptr;
187 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:553
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:137
BOARD_DESIGN_SETTINGS * m_BoardSettings
Board design settings for this project's board.
Definition: project_file.h:178
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::Files_io_from_id(), DIALOG_BOARD_SETUP::OnAuxiliaryAction(), PCB_EDIT_FRAME::OnCloseWindow(), PCB_EDIT_FRAME::OpenProjectFiles(), and PCB_EDIT_FRAME::SavePcbFile().

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 245 of file base_struct.h.

246  {
248  DO_NOT_DRAW );
249  }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:114
#define TEMP_SELECTED
flag indicating that the structure has already selected
Definition: base_struct.h:125
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: base_struct.h:128
#define CANDIDATE
flag indicating that the structure is connected
Definition: base_struct.h:127
#define ENDPOINT
ends. (Used to support dragging.)
Definition: base_struct.h:123
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:233
#define DO_NOT_DRAW
Used to disable draw function.
Definition: base_struct.h:129
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: base_struct.h:122

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, MODULE, SCH_SHEET, D_PAD, SCH_HIERLABEL, VIA, SCH_GLOBALLABEL, SCH_LABEL, ARC, SCH_TEXT, LIB_PIN, DRAWSEGMENT, DIMENSION, SCH_LINE, TRACK, TEXTE_MODULE, SCH_BUS_BUS_ENTRY, SCH_SHEET_PIN, SCH_FIELD, LIB_FIELD, SCH_BUS_WIRE_ENTRY, SCH_BITMAP, EDGE_MODULE, LIB_ARC, TEXTE_PCB, SCH_NO_CONNECT, SCH_JUNCTION, LIB_POLYLINE, SCH_MARKER, LIB_TEXT, PCB_TARGET, LIB_BEZIER, LIB_CIRCLE, LIB_RECTANGLE, and KIGFX::ORIGIN_VIEWITEM.

Definition at line 110 of file base_struct.cpp.

111 {
112  wxCHECK_MSG( false, NULL, wxT( "Clone not implemented in derived class " ) + GetClass() +
113  wxT( ". Bad programmer!" ) );
114 }
#define NULL
virtual wxString GetClass() const =0
Function GetClass returns the class name.

References EDA_ITEM::GetClass(), and NULL.

Referenced by 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 
)

Function CombineAllAreasInNet Checks 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 97 of file zones_test_and_combine_areas.cpp.

99 {
100  if( m_ZoneDescriptorList.size() <= 1 )
101  return false;
102 
103  bool modified = false;
104 
105  // Loop through all combinations
106  for( unsigned ia1 = 0; ia1 < m_ZoneDescriptorList.size() - 1; ia1++ )
107  {
108  ZONE_CONTAINER* curr_area = m_ZoneDescriptorList[ia1];
109 
110  if( curr_area->GetNetCode() != aNetCode )
111  continue;
112 
113  // legal polygon
114  BOX2I b1 = curr_area->Outline()->BBox();
115  bool mod_ia1 = false;
116 
117  for( unsigned ia2 = m_ZoneDescriptorList.size() - 1; ia2 > ia1; ia2-- )
118  {
119  ZONE_CONTAINER* area2 = m_ZoneDescriptorList[ia2];
120 
121  if( area2->GetNetCode() != aNetCode )
122  continue;
123 
124  if( curr_area->GetPriority() != area2->GetPriority() )
125  continue;
126 
127  if( curr_area->GetIsKeepout() != area2->GetIsKeepout() )
128  continue;
129 
130  if( curr_area->GetLayerSet() != area2->GetLayerSet() )
131  continue;
132 
133  BOX2I b2 = area2->Outline()->BBox();
134 
135  if( b1.Intersects( b2 ) )
136  {
137  // check area2 against curr_area
138  if( curr_area->GetLocalFlags() || area2->GetLocalFlags()
139  || aUseLocalFlags == false )
140  {
141  bool ret = TestAreaIntersection( curr_area, area2 );
142 
143  if( ret )
144  ret = CombineAreas( aDeletedList, curr_area, area2 );
145 
146  if( ret )
147  {
148  mod_ia1 = true;
149  modified = true;
150  }
151  }
152  }
153  }
154 
155  if( mod_ia1 )
156  ia1--; // if modified, we need to check it again
157  }
158 
159  return modified;
160 }
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:282
bool CombineAreas(PICKED_ITEMS_LIST *aDeletedList, ZONE_CONTAINER *area_ref, ZONE_CONTAINER *area_to_combine)
Function CombineAreas If possible, combine 2 copper areas.
bool TestAreaIntersection(ZONE_CONTAINER *area_ref, ZONE_CONTAINER *area_to_test)
Function TestAreaIntersection Test for intersection of 2 copper areas area_to_test must be after area...
virtual LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_zone.cpp:288
bool Intersects(const BOX2< Vec > &aRect) const
Function Intersects.
Definition: box2.h:236
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:712
unsigned GetPriority() const
Function GetPriority.
Definition: class_zone.h:106
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:201
const BOX2I BBox(int aClearance=0) const override
Function BBox()
int GetLocalFlags() const
Definition: class_zone.h:267

References SHAPE_POLY_SET::BBox(), CombineAreas(), ZONE_CONTAINER::GetIsKeepout(), ZONE_CONTAINER::GetLayerSet(), ZONE_CONTAINER::GetLocalFlags(), BOARD_CONNECTED_ITEM::GetNetCode(), ZONE_CONTAINER::GetPriority(), BOX2< Vec >::Intersects(), m_ZoneDescriptorList, 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 
)

Function CombineAreas 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 292 of file zones_test_and_combine_areas.cpp.

294 {
295  if( area_ref == area_to_combine )
296  {
297  wxASSERT( 0 );
298  return false;
299  }
300 
301  SHAPE_POLY_SET mergedOutlines = *area_ref->Outline();
302  SHAPE_POLY_SET areaToMergePoly = *area_to_combine->Outline();
303 
304  mergedOutlines.BooleanAdd( areaToMergePoly, SHAPE_POLY_SET::PM_FAST );
305  mergedOutlines.Simplify( SHAPE_POLY_SET::PM_FAST );
306 
307  // We should have one polygon with hole
308  // We can have 2 polygons with hole, if the 2 initial polygons have only one common corner
309  // and therefore cannot be merged (they are dectected as intersecting)
310  // but we should never have more than 2 polys
311  if( mergedOutlines.OutlineCount() > 2 )
312  {
313  wxLogMessage(wxT("BOARD::CombineAreas error: more than 2 polys after merging") );
314  return false;
315  }
316 
317  if( mergedOutlines.OutlineCount() > 1 )
318  return false;
319 
320  // Update the area with the new merged outline
321  delete area_ref->Outline();
322  area_ref->SetOutline( new SHAPE_POLY_SET( mergedOutlines ) );
323 
324  RemoveArea( aDeletedList, area_to_combine );
325 
326  area_ref->SetLocalFlags( 1 );
327  area_ref->HatchBorder();
328 
329  return true;
330 }
void HatchBorder()
Function HatchBorder computes the hatch lines depending on the hatch parameters and stores it in the ...
Definition: class_zone.cpp:961
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:282
void RemoveArea(PICKED_ITEMS_LIST *aDeletedList, ZONE_CONTAINER *area_to_remove)
Function RemoveArea remove copper area from net, and put it in a deleted list (if exists)
void SetOutline(SHAPE_POLY_SET *aOutline)
Definition: class_zone.h:285
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:268

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

Function ComputeBoundingBox calculates 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 851 of file class_board.cpp.

852 {
853  EDA_RECT area;
854  LSET visible = GetVisibleLayers();
855  bool showInvisibleText = IsElementVisible( LAYER_MOD_TEXT_INVISIBLE )
856  && PgmOrNull() && !PgmOrNull()->m_Printing;
857 
858  // Check segments, dimensions, texts, and fiducials
859  for( auto item : m_drawings )
860  {
861  if( aBoardEdgesOnly && ( item->GetLayer() != Edge_Cuts ) )
862  continue;
863 
864  if( ( item->GetLayerSet() & visible ).any() )
865  area.Merge( item->GetBoundingBox() );
866  }
867 
868  // Check modules
869  for( auto module : m_modules )
870  {
871  if( !( module->GetLayerSet() & visible ).any() )
872  continue;
873 
874  if( aBoardEdgesOnly )
875  {
876  for( const auto edge : module->GraphicalItems() )
877  {
878  if( edge->GetLayer() == Edge_Cuts )
879  area.Merge( edge->GetBoundingBox() );
880  }
881  }
882  else
883  {
884  area.Merge( module->GetBoundingBox( showInvisibleText ) );
885  }
886  }
887 
888  if( !aBoardEdgesOnly )
889  {
890  // Check tracks
891  for( auto track : m_tracks )
892  {
893  if( ( track->GetLayerSet() & visible ).any() )
894  area.Merge( track->GetBoundingBox() );
895  }
896 
897  // Check zones
898  for( auto aZone : m_ZoneDescriptorList )
899  {
900  if( ( aZone->GetLayerSet() & visible ).any() )
901  area.Merge( aZone->GetBoundingBox() );
902  }
903  }
904 
905  return area;
906 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:195
void Merge(const EDA_RECT &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect.
LSET GetVisibleLayers() const
Function GetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
TRACKS m_tracks
TRACKS for traces on the board, owned by pointer.
Definition: class_board.h:198
LSET is a set of PCB_LAYER_IDs.
DRAWINGS m_drawings
BOARD_ITEMs for drawings on the board, owned by pointer.
Definition: class_board.h:192
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Function IsElementVisible tests 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
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:201
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...

References Edge_Cuts, GetVisibleLayers(), IsElementVisible(), LAYER_MOD_TEXT_INVISIBLE, m_drawings, m_modules, PGM_BASE::m_Printing, m_tracks, m_ZoneDescriptorList, EDA_RECT::Merge(), and PgmOrNull().

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

◆ ConvertBrdLayerToPolygonalContours()

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

Function ConvertBrdLayerToPolygonalContours Build a set of polygons which are the outlines of copper items (pads, tracks, vias, texts, zones) Holes in vias or pads are ignored Usefull to export the shape of copper layers to dxf polygons or 3D viewer the polygons are not merged.

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

Definition at line 68 of file board_items_to_polygon_shape_transform.cpp.

69 {
70  // convert tracks and vias:
71  for( auto track : m_tracks )
72  {
73  if( !track->IsOnLayer( aLayer ) )
74  continue;
75 
76  track->TransformShapeWithClearanceToPolygon( aOutlines, 0 );
77  }
78 
79  // convert pads
80  for( auto module : m_modules )
81  {
82  module->TransformPadsShapesWithClearanceToPolygon( aLayer, aOutlines, 0 );
83 
84  // Micro-wave modules may have items on copper layers
85  module->TransformGraphicShapesWithClearanceToPolygonSet( aLayer, aOutlines, 0 );
86  }
87 
88  // convert copper zones
89  for( int ii = 0; ii < GetAreaCount(); ii++ )
90  {
91  ZONE_CONTAINER* zone = GetArea( ii );
92 
93  if( zone->GetLayerSet().test( aLayer ) )
94  zone->TransformSolidAreasShapesToPolygonSet( aLayer, aOutlines );
95  }
96 
97  // convert graphic items on copper layers (texts)
98  for( auto item : m_drawings )
99  {
100  if( !item->IsOnLayer( aLayer ) )
101  continue;
102 
103  switch( item->Type() )
104  {
105  case PCB_LINE_T:
106  ( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon( aOutlines, 0 );
107  break;
108 
109  case PCB_TEXT_T:
110  ( (TEXTE_PCB*) item )->TransformShapeWithClearanceToPolygonSet( aOutlines, 0 );
111  break;
112 
113  default:
114  break;
115  }
116  }
117 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:195
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:92
TRACKS m_tracks
TRACKS for traces on the board, owned by pointer.
Definition: class_board.h:198
void TransformSolidAreasShapesToPolygonSet(PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aCornerBuffer, int aError=ARC_HIGH_DEF) const
Function TransformSolidAreasShapesToPolygonSet Convert solid areas full shapes to polygon set (the fu...
virtual LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_zone.cpp:288
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:934
DRAWINGS m_drawings
BOARD_ITEMs for drawings on the board, owned by pointer.
Definition: class_board.h:192
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:899
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:91

References GetArea(), GetAreaCount(), ZONE_CONTAINER::GetLayerSet(), m_drawings, m_modules, m_tracks, PCB_LINE_T, PCB_TEXT_T, and ZONE_CONTAINER::TransformSolidAreasShapesToPolygonSet().

Referenced by PlotLayerOutlines().

◆ 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(), RemoveArea(), and ~BOARD().

◆ DeleteAllModules()

void BOARD::DeleteAllModules ( )
inline

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

Definition at line 338 of file class_board.h.

339  {
340  for( MODULE* mod : m_modules )
341  delete mod;
342 
343  m_modules.clear();
344  }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:195

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

Function DeleteMARKERs deletes ALL MARKERS from the board.

Definition at line 708 of file class_board.cpp.

709 {
710  // the vector does not know how to delete the MARKER_PCB, it holds pointers
711  for( MARKER_PCB* marker : m_markers )
712  delete marker;
713 
714  m_markers.clear();
715 }
MARKERS m_markers
MARKER_PCBs for clearance problems, owned by pointer.
Definition: class_board.h:189

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

719 {
720  // Deleting lots of items from a vector can be very slow. Copy remaining items instead.
721  MARKERS remaining;
722 
723  for( MARKER_PCB* marker : m_markers )
724  {
725  if( ( marker->IsExcluded() && aExclusions )
726  || ( !marker->IsExcluded() && aWarningsAndErrors ) )
727  {
728  delete marker;
729  }
730  else
731  {
732  remaining.push_back( marker );
733  }
734  }
735 
736  m_markers = remaining;
737 }
MARKERS m_markers
MARKER_PCBs for clearance problems, owned by pointer.
Definition: class_board.h:189

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

119 {
120  auto parent = GetParent();
121 
122  if( parent )
123  parent->Remove( this );
124 
125  delete this;
126 }
BOARD_ITEM_CONTAINER * GetParent() const

References BOARD_ITEM::GetParent().

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

◆ DeleteZONEOutlines()

void BOARD::DeleteZONEOutlines ( )

Function DeleteZONEOutlines deletes ALL zone outlines from the board.

Definition at line 740 of file class_board.cpp.

741 {
742  // the vector does not know how to delete the ZONE Outlines, it holds pointers
743  for( ZONE_CONTAINER* zone : m_ZoneDescriptorList )
744  delete zone;
745 
746  m_ZoneDescriptorList.clear();
747 }
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:201

References m_ZoneDescriptorList.

Referenced by ~BOARD().

◆ Drawings()

◆ Duplicate()

BOARD_ITEM* BOARD_ITEM::Duplicate ( ) const
inlineinherited

Function Duplicate creates a copy of a BOARD_ITEM.

Definition at line 208 of file class_board_item.h.

209  {
210  EDA_ITEM* dupe = Clone();
211  const_cast<KIID&>( dupe->m_Uuid ) = KIID();
212 
213  return static_cast<BOARD_ITEM*>( dupe );
214  }
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: common.h:68
const KIID m_Uuid
Definition: base_struct.h:162
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159

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

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), EDIT_TOOL::Duplicate(), GPCB_PLUGIN::FootprintLoad(), PCB_IO::FootprintLoad(), PCB_IO::FootprintSave(), ARRAY_CREATOR::Invoke(), and FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD().

◆ EndNets()

NETINFO_LIST::iterator BOARD::EndNets ( ) const
inline

Function EndNets.

Returns
iterator to the last element of the NETINFO_ITEMs list

Definition at line 765 of file class_board.h.

766  {
767  return m_NetInfo.end();
768  }
iterator end() const
Definition: netinfo.h:554
NETINFO_LIST m_NetInfo
Definition: class_board.h:230

References NETINFO_LIST::end().

◆ FillItemMap()

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

Definition at line 799 of file class_board.cpp.

800 {
801  for( TRACK* track : Tracks() )
802  aMap[ track->m_Uuid ] = track;
803 
804  for( MODULE* module : Modules() )
805  {
806  aMap[ module->m_Uuid ] = module;
807 
808  for( D_PAD* pad : module->Pads() )
809  aMap[ pad->m_Uuid ] = pad;
810 
811  aMap[ module->Reference().m_Uuid ] = &module->Reference();
812  aMap[ module->Value().m_Uuid ] = &module->Value();
813 
814  for( BOARD_ITEM* drawing : module->GraphicalItems() )
815  aMap[ drawing->m_Uuid ] = drawing;
816  }
817 
818  for( ZONE_CONTAINER* zone : Zones() )
819  aMap[ zone->m_Uuid ] = zone;
820 
821  for( BOARD_ITEM* drawing : Drawings() )
822  aMap[ drawing->m_Uuid ] = drawing;
823 
824  for( MARKER_PCB* marker : m_markers )
825  aMap[ marker->m_Uuid ] = marker;
826 }
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,...
MODULES & Modules()
Definition: class_board.h:266
MARKERS m_markers
MARKER_PCBs for clearance problems, owned by pointer.
Definition: class_board.h:189
ZONE_CONTAINERS & Zones()
Definition: class_board.h:280
DRAWINGS & Drawings()
Definition: class_board.h:275
TRACKS & Tracks()
Definition: class_board.h:257

References Drawings(), m_markers, Modules(), Tracks(), and Zones().

Referenced by DRC_RUNNER::reportMarkers(), and DIALOG_DRC::writeReport().

◆ FindModuleByPath()

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

Function FindModuleByPath searches 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 1174 of file class_board.cpp.

1175 {
1176  for( MODULE* module : m_modules )
1177  {
1178  if( module->GetPath() == aPath )
1179  return module;
1180  }
1181 
1182  return nullptr;
1183 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:195

References m_modules.

◆ FindModuleByReference()

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

Function FindModuleByReference searches 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 1146 of file class_board.cpp.

1147 {
1148  MODULE* found = nullptr;
1149 
1150  // search only for MODULES
1151  static const KICAD_T scanTypes[] = { PCB_MODULE_T, EOT };
1152 
1153  INSPECTOR_FUNC inspector = [&] ( EDA_ITEM* item, void* testData )
1154  {
1155  MODULE* module = (MODULE*) item;
1156 
1157  if( aReference == module->GetReference() )
1158  {
1159  found = module;
1160  return SEARCH_RESULT::QUIT;
1161  }
1162 
1163  return SEARCH_RESULT::CONTINUE;
1164  };
1165 
1166  // visit this BOARD with the above inspector
1167  BOARD* nonconstMe = (BOARD*) this;
1168  nonconstMe->Visit( inspector, NULL, scanTypes );
1169 
1170  return found;
1171 }
std::function< SEARCH_RESULT(EDA_ITEM *aItem, void *aTestData) > INSPECTOR_FUNC
Typedef INSPECTOR is used to inspect and possibly collect the (search) results of iterating over a li...
Definition: base_struct.h:80
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
const wxString GetReference() const
Function GetReference.
Definition: class_module.h:444
SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[]) override
Function Visit may be re-implemented for each derived class in order to handle all the types given by...
class MODULE, a footprint
Definition: typeinfo.h:89
#define NULL
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:180
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159

References CONTINUE, EOT, MODULE::GetReference(), NULL, PCB_MODULE_T, QUIT, and Visit().

Referenced by PCB_EDIT_FRAME::ExecuteRemoteCommand(), DSN::SPECCTRA_DB::FromSESSION(), BOARD_NETLIST_UPDATER::testConnectivity(), and TestFootprints().

◆ FindNet() [1/2]

NETINFO_ITEM * BOARD::FindNet ( int  aNetcode) const

Function FindNet searches 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 1125 of file class_board.cpp.

1126 {
1127  // the first valid netcode is 1 and the last is m_NetInfo.GetCount()-1.
1128  // zero is reserved for "no connection" and is not actually a net.
1129  // NULL is returned for non valid netcodes
1130 
1131  wxASSERT( m_NetInfo.GetNetCount() > 0 );
1132 
1133  if( aNetcode == NETINFO_LIST::UNCONNECTED && m_NetInfo.GetNetCount() == 0 )
1134  return NETINFO_LIST::OrphanedItem();
1135  else
1136  return m_NetInfo.GetNetItem( aNetcode );
1137 }
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(), filterNetClass(), DIALOG_SELECT_NET_FROM_LIST::findRow(), PCB_EDIT_FRAME::fixEagleNets(), DSN::SPECCTRA_DB::FromBOARD(), DSN::SPECCTRA_DB::FromSESSION(), PCB_INSPECTION_TOOL::highlightNet(), PNS::SIZES_SETTINGS::Init(), 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 *(), PNS_PCBNEW_RULE_RESOLVER::PNS_PCBNEW_RULE_RESOLVER(), 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

Function FindNet overloaded searches 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 1140 of file class_board.cpp.

1141 {
1142  return m_NetInfo.GetNetItem( aNetname );
1143 }
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, MODULE, D_PAD, DRAWSEGMENT, DIMENSION, TEXTE_MODULE, TRACK, EDGE_MODULE, TEXTE_PCB, PCB_TARGET, MARKER_PCB, and MARKER_PCB.

Definition at line 319 of file class_board_item.h.

320  {
321  wxMessageBox( wxT( "virtual BOARD_ITEM::Flip used, should not occur" ), GetClass() );
322  }
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 324 of file class_board_item.h.

325  {
326  Flip( wxPoint( aCentre.x, aCentre.y ), aFlipLeftRight );
327  }
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:61
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:53
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:38
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:58
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:61
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:53
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:38
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Casts a type to another type.
T
enum T contains all this lexer's tokens.
Provides class metadata.
Definition: property_mgr.h:58
T get(void *aObject)
Definition: property.h:273
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:61
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:53
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:38
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Casts a type to another type.
T
enum T contains all this lexer's tokens.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Returns a property for a specific type.
Provides class metadata.
Definition: property_mgr.h:58
T get(void *aObject)
Definition: property.h:273
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

Function GetArea returns 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 899 of file class_board.h.

900  {
901  if( (unsigned) index < m_ZoneDescriptorList.size() )
902  return m_ZoneDescriptorList[index];
903 
904  return NULL;
905  }
#define NULL
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:201

References NULL.

Referenced by DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), GERBER_JOBFILE_WRITER::addJSONDesignRules(), AllConnectedItems(), CN_CONNECTIVITY_ALGO::Build(), BOARD_NETLIST_UPDATER::cacheCopperZoneConnections(), HYPERLYNX_EXPORTER::collectNetObjects(), ConvertBrdLayerToPolygonalContours(), BOARD_ADAPTER::createLayers(), PCB_EDIT_FRAME::Edit_Zone_Params(), export_vrml_zones(), DIALOG_COPPER_ZONE::ExportSetupToOtherCopperZones(), GetZoneList(), SaveCopyOfZones(), SetAreasNetCodesFromNetNames(), SetElementVisibility(), DRC::testZones(), NETINFO_MAPPING::Update(), BOARD_NETLIST_UPDATER::updateCopperZoneNets(), and UpdateCopyOfZonesList().

◆ GetAreaCount()

◆ GetAreaIndex()

int BOARD::GetAreaIndex ( const ZONE_CONTAINER aArea) const
inline

Function GetAreaIndex returns the Area Index for the given Zone Container.

Parameters
aArea:The ZONE_CONTAINER to find.
Returns
an Area Index in m_ZoneDescriptorList or -1 if non found.

Definition at line 913 of file class_board.h.

914  {
915  for( int ii = 0; ii < GetAreaCount(); ii++ ) // Search for aArea in list
916  {
917  if( aArea == GetArea( ii ) ) // Found !
918  return ii;
919  }
920 
921  return -1;
922  }
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:934
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:899

◆ 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 48 of file class_board_item.cpp.

49 {
50  if( Type() == PCB_T )
51  return (BOARD*) this;
52 
53  BOARD_ITEM* parent = GetParent();
54 
55  if( parent )
56  return parent->GetBoard();
57 
58  return NULL;
59 }
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.
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:180
BOARD_ITEM_CONTAINER * GetParent() const
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

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

Referenced by D_PAD::BuildEffectiveShapes(), ZONE_CONTAINER::BuildSmoothedPoly(), checkClearancePadToPad(), checkClearanceSegmToPad(), TEXTE_PCB::Flip(), TRACK::Flip(), ARC::Flip(), VIA::Flip(), ZONE_CONTAINER::Flip(), BOARD_ITEM::GetBoard(), MODULE::GetBoundingPoly(), BOARD_CONNECTED_ITEM::GetClearance(), GetConstraint(), BOARD_CONNECTED_ITEM::GetEffectiveNetclass(), BOARD_ITEM::GetLayerName(), VIA::GetMinAnnulus(), PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), ZONE_CONTAINER::GetMsgPanelInfo(), TRACK::GetMsgPanelInfo(), NETINFO_ITEM::GetMsgPanelInfo(), VIA::GetMsgPanelInfo(), D_PAD::GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), VIA::GetSelectMenuText(), D_PAD::GetSelectMenuText(), ZONE_CONTAINER::GetSelectMenuText(), D_PAD::GetSolderMaskMargin(), D_PAD::GetSolderPasteMargin(), GetTrackLength(), TRACK::GetWidthConstraints(), insideArea(), insideCourtyard(), D_PAD::MergePrimitivesAsPolygon(), EAGLE_PLUGIN::packageWire(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), BOARD_CONNECTED_ITEM::SetNetCode(), ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon(), ZONE_CONTAINER::TransformSolidAreasShapesToPolygonSet(), MODULE::ViewBBox(), and D_PAD::ViewGetLOD().

◆ GetBoardEdgesBoundingBox()

const EDA_RECT BOARD::GetBoardEdgesBoundingBox ( ) const
inline

Function GetBoardEdgesBoundingBox 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 800 of file class_board.h.

801  {
802  return ComputeBoundingBox( true );
803  }
EDA_RECT ComputeBoundingBox(bool aBoardEdgesOnly=false) const
Function ComputeBoundingBox calculates the bounding box containing all board items (or board edge seg...

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

◆ GetBoardPolygonOutlines()

bool BOARD::GetBoardPolygonOutlines ( SHAPE_POLY_SET aOutlines,
wxString *  aErrorText = nullptr,
wxPoint aErrorLocation = nullptr 
)

Function GetBoardPolygonOutlines Extracts 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= a wxString reference to display an error message with the coordinate of the point which creates the error (default = nullptr , no message returned on error)
aErrorLocation= a wxPoint giving the location of the Error message on the board if left null (default), no location is returned
Returns
true if success, false if a contour is not valid

Definition at line 1789 of file class_board.cpp.

1790 {
1791 
1792  bool success = BuildBoardPolygonOutlines( this, aOutlines, aErrorText,
1793  GetDesignSettings().m_MaxError, aErrorLocation );
1794 
1795  // Make polygon strictly simple to avoid issues (especially in 3D viewer)
1797 
1798  return success;
1799 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:553
void Simplify(POLYGON_MODE aFastMode)
Simplifies the polyset (merges overlapping polys, eliminates degeneracy/self-intersections) For aFast...
bool BuildBoardPolygonOutlines(BOARD *aBoard, SHAPE_POLY_SET &aOutlines, wxString *aErrorText, unsigned int aTolerance, wxPoint *aErrorLocation=nullptr)

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(), DRC::testOutline(), and HYPERLYNX_EXPORTER::writeBoardInfo().

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

789  {
790  return ComputeBoundingBox( false );
791  }
EDA_RECT ComputeBoundingBox(bool aBoardEdgesOnly=false) const
Function ComputeBoundingBox calculates the bounding box containing all board items (or board edge seg...

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

◆ GetCenter()

virtual wxPoint BOARD_ITEM::GetCenter ( ) const
inlinevirtualinherited

Function GetCenter()

This defaults to the same point as returned by GetPosition(), unless overridden

Returns
centre point of the item

Reimplemented in DRAWSEGMENT.

Definition at line 120 of file class_board_item.h.

120 { return GetPosition(); }
virtual wxPoint GetPosition() const
Definition: base_struct.h:337

References EDA_ITEM::GetPosition().

Referenced by BOARD_ADAPTER::createNewTrack(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), KIGFX::PCB_PAINTER::draw(), export_vrml_tracks(), PlotStandardLayer(), and TRACK::TransformShapeWithClearanceToPolygon().

◆ GetClass()

wxString BOARD::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Implements EDA_ITEM.

Definition at line 867 of file class_board.h.

868  {
869  return wxT( "BOARD" );
870  }

Referenced by Visit().

◆ GetConnectivity()

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

Function GetConnectivity() returns list of missing connections between components/tracks.

Returns
an object that contains informations about missing connections.

Definition at line 355 of file class_board.h.

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

Referenced by BuildConnectivity(), BOARD_NETLIST_UPDATER::cacheCopperZoneConnections(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), TRACKS_CLEANER::cleanupSegments(), TRACKS_CLEANER::cleanupVias(), PCB_BASE_FRAME::Compile_Ratsnest(), TRACKS_CLEANER::deleteDanglingTracks(), TRACKS_CLEANER::deleteTracksInPads(), PCB_DRAW_PANEL_GAL::DisplayBoard(), PCB_EDIT_FRAME::Edit_Zone_Params(), ZONE_FILLER::Fill(), filterNetClass(), 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::removeBadTrackSegments(), BOARD_COMMIT::Revert(), AR_AUTOPLACER::rotateModule(), SELECTION_TOOL::selectAllItemsOnNet(), SELECTION_TOOL::selectConnectedTracks(), PCB_EDIT_FRAME::SetBoard(), TRACKS_CLEANER::testTrackEndpointIsNode(), DRC::testTracks(), DRC::testUnconnected(), DRC::testZones(), DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow(), and BOARD_NETLIST_UPDATER::UpdateNetlist().

◆ GetCopperLayerCount()

int BOARD::GetCopperLayerCount ( ) const

Function GetCopperLayerCount.

Returns
int - The number of copper layers in the BOARD.

Definition at line 410 of file class_board.cpp.

411 {
413 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:553
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(), PCB_LAYER_WIDGET::AddRightClickMenuItems(), PCBNEW_CONTROL::AppendBoard(), GENDRILL_WRITER_BASE::BuildFileFunctionAttributeString(), DSN::SPECCTRA_DB::buildLayerMaps(), PANEL_SETUP_LAYERS::compareCopperLayerCount(), 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(), 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

Function GetDesignSettings.

Returns
the BOARD_DESIGN_SETTINGS for this BOARD

Definition at line 553 of file class_board.h.

554  {
555  // remove const-ness with cast. TODO(snh): Make GetDesignSettings const
556  // NOTE(JE) If we want this to be const, it's going to have to involve making BOARD and
557  // everything else that relies on BOARD_DESIGN_SETTINGS aware of the PROJECT so that it
558  // can be retrieved from there. This will also currently require constructing BOARD with
559  // a valid PROJECT passed in to the ctor.
560 
561  return const_cast<BOARD_DESIGN_SETTINGS&>( *m_designSettings.get() );
562  }
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

Referenced by AddGerberX2Header(), GERBER_JOBFILE_WRITER::addJSONDesignRules(), GERBER_JOBFILE_WRITER::addJSONGeneralSpecs(), GERBER_JOBFILE_WRITER::addJSONMaterialStackup(), DRC::addMarkerToPcb(), BOARD(), build_pad_testpoints(), build_via_testpoints(), ZONE_FILLER::buildCopperItemClearances(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildFilterLists(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildNetclassesGrid(), ZONE_FILLER::buildThermalSpokes(), EDIT_TOOL::ChangeTrackWidth(), checkClearancePadToPad(), checkClearanceSegmToPad(), DRC_DRILLED_HOLE_TESTER::checkHoles(), DRC_DRILLED_HOLE_TESTER::checkMicroVia(), DRC_NETCLASS_TESTER::checkNetClass(), DRC_DRILLED_HOLE_TESTER::checkPad(), DRC_DRILLED_HOLE_TESTER::checkVia(), ClearProject(), PNS_PCBNEW_RULE_RESOLVER::CollideHoles(), compute_layer_Zs(), ZONE_FILLER::computeRawFilledArea(), DRAWING_TOOL::constrainDimension(), 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::doPadToPadsDrc(), DRC::doTrackDrc(), ROUTER_TOOL::DpDimensionsDialog(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawVia(), TRACK_WIDTH_MENU::eventHandler(), DIFF_PAIR_MENU::eventHandler(), EVT_GRID_CMD_CELL_CHANGED(), DRC_RUNNER::Execute(), 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(), GetBoardPolygonOutlines(), MODULE::GetBoundingPoly(), BOARD_CONNECTED_ITEM::GetClearance(), MARKER_PCB::GetColorLayer(), GetConstraint(), 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(), VIA::GetMinAnnulus(), ZONE_CONTAINER::GetMsgPanelInfo(), D_PAD::GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetClass(), DRAWING_TOOL::getSegmentWidth(), PCB_BASE_FRAME::GetSeverity(), D_PAD::GetSolderMaskMargin(), TRACK::GetWidthConstraints(), PCB_BASE_FRAME::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::SIZES_SETTINGS::Init(), DIALOG_PLOT::init_Dialog(), initializePlotter(), BOARD_ADAPTER::InitSettings(), IsLayerVisible(), EAGLE_PLUGIN::Load(), LEGACY_PLUGIN::loadGENERAL(), LEGACY_PLUGIN::loadNETCLASS(), EAGLE_PLUGIN::loadPlain(), DRC::LoadRules(), LEGACY_PLUGIN::loadSETUP(), DSN::SPECCTRA_DB::makePADSTACK(), NETINFO_ITEM::NETINFO_ITEM(), DIALOG_PAD_PROPERTIES::onAddPrimitive(), DIALOG_BOARD_SETUP::OnAuxiliaryAction(), DIALOG_POSITION_RELATIVE::OnUseGridOriginClick(), ROUTER_TOOL::onViaCommand(), EAGLE_PLUGIN::packageWire(), 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(), PNS_PCBNEW_RULE_RESOLVER::PNS_PCBNEW_RULE_RESOLVER(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), PAD_TOOL::recombinePad(), PCB_EDIT_FRAME::RecordDRCExclusions(), PCB_EDIT_FRAME::ResolveDRCExclusions(), DRC_COURTYARD_TESTER::RunDRC(), DRC_NETCLASS_TESTER::RunDRC(), DRC::RunTests(), SaveBoard(), 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(), PCB_BASE_FRAME::SetZoneSettings(), PCB_EDIT_FRAME::ShowBoardSetupDialog(), PNS::DIFF_PAIR_PLACER::Start(), EDA_3D_VIEWER::SynchroniseColoursWithBoard(), SynchronizeNetsAndNetClasses(), PNS_KICAD_IFACE_BASE::SyncWorld(), TestFootprints(), DRC::testPadClearances(), DRC::testTracks(), DRC::testZones(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon(), TRACK_WIDTH_MENU::update(), DIFF_PAIR_MENU::update(), DIALOG_GENDRILL::UpdateDrillParams(), POINT_EDITOR::updateItem(), MODULE::ViewBBox(), MARKER_PCB::ViewGetLayers(), and HYPERLYNX_EXPORTER::writeStackupInfo().

◆ GetEditFlags()

STATUS_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 237 of file base_struct.h.

238  {
239  constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVED | IS_RESIZED | IS_DRAGGED |
241 
242  return m_Flags & mask;
243  }
#define IS_NEW
New item, just created.
Definition: base_struct.h:117
#define IS_DRAGGED
Item being dragged.
Definition: base_struct.h:119
#define STRUCT_DELETED
flag indication structures to be erased
Definition: base_struct.h:126
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:121
STATUS_FLAGS m_Flags
Definition: base_struct.h:176
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:118
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
Definition: base_struct.h:130
#define IS_MOVED
Item being moved.
Definition: base_struct.h:116

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(), 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_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::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 D_PAD, and DRAWSEGMENT.

Definition at line 154 of file class_board_item.cpp.

155 {
156  std::shared_ptr<SHAPE> shape;
157 
158  return shape;
159 }

◆ GetEnabledLayers()

LSET BOARD::GetEnabledLayers ( ) const

Function GetEnabledLayers is 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 422 of file class_board.cpp.

423 {
425 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:553
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(), PCB_LAYER_WIDGET::ReFill(), DRC::testDisabledLayers(), PANEL_SETUP_LAYERS::TransferDataFromWindow(), DIALOG_PRINT_PCBNEW::TransferDataToWindow(), PANEL_SETUP_LAYERS::TransferDataToWindow(), and HYPERLYNX_EXPORTER::writeSinglePadStack().

◆ GetFileFormatVersionAtLoad()

int BOARD::GetFileFormatVersionAtLoad ( ) const
inline

Definition at line 320 of file class_board.h.

320 { return m_fileFormatVersionAtLoad; }
int m_fileFormatVersionAtLoad
Definition: class_board.h:209

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ GetFileName()

const wxString& BOARD::GetFileName ( ) const
inline

Definition at line 255 of file class_board.h.

255 { return m_fileName; }
wxString m_fileName
the board filename
Definition: class_board.h:186

Referenced by AddGerberX2Header(), GERBER_JOBFILE_WRITER::addJSONGeneralSpecs(), DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles(), DIALOG_GEN_FOOTPRINT_POSITION::CreateGerberFiles(), CreateHeaderInfoData(), DIALOG_BOARD_STATISTICS::DIALOG_BOARD_STATISTICS(), DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP(), PCB_DRAW_PANEL_GAL::DisplayBoard(), PCB_EDIT_FRAME::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(), GENDRILL_WRITER_BASE::getDrillFileName(), PCB_EDIT_FRAME::GetLastPath(), PCB_EDITOR_CONTROL::ImportSpecctraSession(), PCB_EDIT_FRAME::onBoardLoaded(), DIALOG_IMPORT_SETTINGS::OnBrowseClicked(), PCB_EDIT_FRAME::OnCloseWindow(), 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(), 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 330 of file class_board.h.

331  {
332  return m_modules.empty() ? nullptr : m_modules.front();
333  }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:195

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), 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(), 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::OnCloseWindow(), DIALOG_NETLIST::OnTestFootprintsClick(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), PCBNEW_CONTROL::Paste(), pasteModuleItemsToModEdit(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), FOOTPRINT_EDITOR_TOOLS::Properties(), FOOTPRINT_EDIT_FRAME::ReCreateMenuBar(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), DISPLAY_FOOTPRINTS_FRAME::UpdateMsgPanel(), and FOOTPRINT_WIZARD_FRAME::UpdateMsgPanel().

◆ GetFlags()

◆ GetFocusPosition()

virtual const wxPoint EDA_ITEM::GetFocusPosition ( ) const
inlinevirtualinherited

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

Reimplemented in DRAWSEGMENT, and TRACK.

Definition at line 344 of file base_struct.h.

344 { return GetPosition(); }
virtual wxPoint GetPosition() const
Definition: base_struct.h:337

References EDA_ITEM::GetPosition().

Referenced by PCB_BASE_FRAME::FocusOnItem(), and SCH_EDIT_FRAME::FocusOnItem().

◆ GetFootprint()

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

Function GetFootprint 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 modules when true.
Returns
MODULE* The best module or NULL if none.

Definition at line 1581 of file class_board.cpp.

1583 {
1584  MODULE* module = NULL;
1585  MODULE* alt_module = NULL;
1586  int min_dim = 0x7FFFFFFF;
1587  int alt_min_dim = 0x7FFFFFFF;
1588  bool current_layer_back = IsBackLayer( aActiveLayer );
1589 
1590  for( auto pt_module : m_modules )
1591  {
1592  // is the ref point within the module's bounds?
1593  if( !pt_module->HitTest( aPosition ) )
1594  continue;
1595 
1596  // if caller wants to ignore locked modules, and this one is locked, skip it.
1597  if( aIgnoreLocked && pt_module->IsLocked() )
1598  continue;
1599 
1600  PCB_LAYER_ID layer = pt_module->GetLayer();
1601 
1602  // Filter non visible modules if requested
1603  if( !aVisibleOnly || IsModuleLayerVisible( layer ) )
1604  {
1605  EDA_RECT bb = pt_module->GetFootprintRect();
1606 
1607  int offx = bb.GetX() + bb.GetWidth() / 2;
1608  int offy = bb.GetY() + bb.GetHeight() / 2;
1609 
1610  // off x & offy point to the middle of the box.
1611  int dist = ( aPosition.x - offx ) * ( aPosition.x - offx ) +
1612  ( aPosition.y - offy ) * ( aPosition.y - offy );
1613 
1614  if( current_layer_back == IsBackLayer( layer ) )
1615  {
1616  if( dist <= min_dim )
1617  {
1618  // better footprint shown on the active side
1619  module = pt_module;
1620  min_dim = dist;
1621  }
1622  }
1623  else if( aVisibleOnly && IsModuleLayerVisible( layer ) )
1624  {
1625  if( dist <= alt_min_dim )
1626  {
1627  // better footprint shown on the other side
1628  alt_module = pt_module;
1629  alt_min_dim = dist;
1630  }
1631  }
1632  }
1633  }
1634 
1635  if( module )
1636  {
1637  return module;
1638  }
1639 
1640  if( alt_module)
1641  {
1642  return alt_module;
1643  }
1644 
1645  return NULL;
1646 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:195
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)
Function IsModuleLayerVisible expects either of the two layers on which a module can reside,...

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

◆ GetHighLightNetCodes()

const std::set<int>& BOARD::GetHighLightNetCodes ( ) const
inline

Function GetHighLightNetCode.

Returns
the set of net codes that should be highlighted

Definition at line 399 of file class_board.h.

400  {
401  return m_highLight.m_netCodes;
402  }
HIGH_LIGHT_INFO m_highLight
Definition: class_board.h:206
std::set< int > m_netCodes
Definition: class_board.h:136

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

Definition at line 750 of file class_board.cpp.

751 {
752  if( aID == niluuid )
753  return nullptr;
754 
755  for( TRACK* track : Tracks() )
756  if( track->m_Uuid == aID )
757  return track;
758 
759  for( MODULE* module : Modules() )
760  {
761  if( module->m_Uuid == aID )
762  return module;
763 
764  for( D_PAD* pad : module->Pads() )
765  if( pad->m_Uuid == aID )
766  return pad;
767 
768  if( module->Reference().m_Uuid == aID )
769  return &module->Reference();
770 
771  if( module->Value().m_Uuid == aID )
772  return &module->Value();
773 
774  for( BOARD_ITEM* drawing : module->GraphicalItems() )
775  if( drawing->m_Uuid == aID )
776  return drawing;
777  }
778 
779  for( ZONE_CONTAINER* zone : Zones() )
780  if( zone->m_Uuid == aID )
781  return zone;
782 
783  for( BOARD_ITEM* drawing : Drawings() )
784  if( drawing->m_Uuid == aID )
785  return drawing;
786 
787  for( MARKER_PCB* marker : m_markers )
788  if( marker->m_Uuid == aID )
789  return marker;
790 
791  if( m_Uuid == aID )
792  return this;
793 
794  // Not found; weak reference has been deleted.
796 }
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,...
MODULES & Modules()
Definition: class_board.h:266
static DELETED_BOARD_ITEM * GetInstance()
KIID niluuid(0)
MARKERS m_markers
MARKER_PCBs for clearance problems, owned by pointer.
Definition: class_board.h:189
const KIID m_Uuid
Definition: base_struct.h:162
ZONE_CONTAINERS & Zones()
Definition: class_board.h:280
DRAWINGS & Drawings()
Definition: class_board.h:275
TRACKS & Tracks()
Definition: class_board.h:257

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

Referenced by CollisionMatchesExpected(), DIALOG_TEXT_PROPERTIES::convertKIIDsToReferences(), PCB_BASE_FRAME::FocusOnItem(), PCB_BASE_FRAME::GetItem(), TEXTE_PCB::GetShownText(), InvalidMatchesExpected(), DIALOG_DRC::OnDRCItemSelected(), DIALOG_CLEANUP_TRACKS_AND_VIAS::OnSelectItem(), DIALOG_CLEANUP_GRAPHICS::OnSelectItem(), and DRC_ITEM::ShowHtml().

◆ 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 180 of file class_board_item.h.

180 { return m_Layer; }
PCB_LAYER_ID m_Layer

References BOARD_ITEM::m_Layer.

Referenced by CN_LIST::Add(), BOARD_ADAPTER::AddGraphicsShapesWithClearanceToContainer(), DIMENSION::AdjustDimensionDetails(), GRAPHICS_CLEANER::areEquivalent(), BOARD_CONNECTED_ITEM_DESC::BOARD_CONNECTED_ITEM_DESC(), BOARD_ITEM_DESC::BOARD_ITEM_DESC(), AR_AUTOPLACER::buildFpAreas(), TRACKS_CLEANER::cleanupSegments(), CreateBoardSection(), MICROWAVE_TOOL::createMicrowaveInductor(), PCB_BASE_FRAME::CreateNewModule(), CreateRoutesSection(), DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DRC::doPadToPadsDrc(), test::DRC_TEST_PROVIDER_COPPER_CLEARANCE::doTrackDrc(), DRC::doTrackDrc(), KIGFX::PCB_PAINTER::draw(), PCB_EDIT_FRAME::Exchange_Module(), export_vrml_drawsegment(), export_vrml_edge_module(), export_vrml_module(), export_vrml_pcbtext(), export_vrml_text_module(), export_vrml_tracks(), PCB_TARGET::Flip(), TEXTE_PCB::Flip(), EDGE_MODULE::Flip(), TRACK::Flip(), TEXTE_MODULE::Flip(), DIMENSION::Flip(), DRAWSEGMENT::Flip(), MODULE::Flip(), ARC::Flip(), PCB_IO::FootprintSave(), FootprintWriteShape(), PCB_IO::formatLayer(), DSN::SPECCTRA_DB::FromBOARD(), AR_AUTOPLACER::genModuleOnRoutingMatrix(), BOARD_CONNECTED_ITEM::GetClearance(), ZONE_CONTAINER::GetLayer(), test::DRC_TEST_PROVIDER_CLEARANCE_BASE::getLocation(), DRC::GetLocation(), getMatchingTextItem(), TRACK::GetMsgPanelInfo(), VIA::GetMsgPanelInfo(), D_PAD::GetMsgPanelInfo(), AR_AUTOPLACER::getOptimalModulePlacement(), GetPad(), TEXT_MOD_GRID_TABLE::GetValueAsLong(), SELECTION_TOOL::GuessSelectionCandidates(), idf_export_module(), GENERAL_COLLECTOR::Inspect(), PCB_LAYER_COLLECTOR::Inspect(), D_PAD::IsFlipped(), BOARD_ITEM::IsOnCopperLayer(), EDGE_MODULE::IsParentFlipped(), TEXTE_MODULE::IsParentFlipped(), itemIsIncludedByFilter(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), MODULE_DESC::MODULE_DESC(), DIALOG_FOOTPRINT_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAddField(), TRACK::cmp_tracks::operator()(), DRAWSEGMENT::cmp_drawings::operator()(), BOARD_ITEM::ptr_cmp::operator()(), MODULE::cmp_drawings::operator()(), EAGLE_PLUGIN::packagePad(), BRDITEMS_PLOTTER::PlotDimension(), BRDITEMS_PLOTTER::PlotDrawSegment(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotFootprintGraphicItems(), BRDITEMS_PLOTTER::PlotFootprintTextItems(), BRDITEMS_PLOTTER::PlotPcbTarget(), BRDITEMS_PLOTTER::PlotTextePcb(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), processTextItem(), PAD_TOOL::recombinePad(), CLIPBOARD_IO::SaveSelection(), 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(), test::DRC_TEST_PROVIDER_COPPER_CLEARANCE::testCopperDrawItem(), DRC::testCopperDrawItem(), test::DRC_TEST_PROVIDER_COPPER_CLEARANCE::testCopperTextAndGraphics(), DRC::testCopperTextAndGraphics(), DRC::testDisabledLayers(), AR_AUTOPLACER::testModuleOnBoard(), DRC::testPadClearances(), TEXTE_MODULE::TEXTE_MODULE(), TRACK_VIA_DESC::TRACK_VIA_DESC(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), BOARD_ADAPTER::transformGraphicModuleEdgeToPolygonSet(), MODULE::TransformGraphicShapesWithClearanceToPolygonSet(), TRACK::ViewBBox(), TRACK::ViewGetLayers(), TEXTE_MODULE::ViewGetLayers(), TEXTE_MODULE::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

Function GetLayerID returns the ID of a layer.

Copper layers may have custom names.

Definition at line 269 of file class_board.cpp.

270 {
271 
272  // Look for the BOARD specific copper layer names
273  for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
274  {
275  if ( IsCopperLayer( layer ) && ( m_Layer[ layer ].m_name == aLayerName ) )
276  {
277  return ToLAYER_ID( layer );
278  }
279  }
280 
281  // Otherwise fall back to the system standard layer names
282  for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
283  {
284  if( GetStandardLayerName( ToLAYER_ID( layer ) ) == aLayerName )
285  {
286  return ToLAYER_ID( layer );
287  }
288  }
289 
290  return UNDEFINED_LAYER;
291 }
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
LAYER m_Layer[PCB_LAYER_ID_COUNT]
Definition: class_board.h:203
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:849
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Function GetStandardLayerName returns an "English Standard" name of a PCB layer when given aLayerNumb...
Definition: class_board.h:650

References GetStandardLayerName(), IsCopperLayer(), 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 62 of file class_board_item.cpp.

63 {
64  BOARD* board = GetBoard();
65 
66  if( board )
67  return board->GetLayerName( m_Layer );
68 
69  // If no parent, return standard name
71 }
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer.
PCB_LAYER_ID m_Layer
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:180
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Function GetStandardLayerName returns an "English Standard" name of a PCB layer when given aLayerNumb...
Definition: class_board.h:650

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

Referenced by PCB_IO::format(), PCB_IO::formatLayer(), TEXTE_PCB::GetMsgPanelInfo(), TEXTE_MODULE::GetMsgPanelInfo(), DRAWSEGMENT::GetMsgPanelInfo(), TEXTE_PCB::GetSelectMenuText(), EDGE_MODULE::GetSelectMenuText(), TEXTE_MODULE::GetSelectMenuText(), TRACK::GetSelectMenuText(), DIMENSION::GetSelectMenuText(), DRAWSEGMENT::GetSelectMenuText(), MODULE::GetSelectMenuText(), TEXTE_PCB::GetShownText(), TEXT_MOD_GRID_TABLE::GetValue(), MODULE::ResolveTextVar(), and DRC::testDisabledLayers().

◆ GetLayerName() [2/2]

wxString BOARD::GetLayerName ( PCB_LAYER_ID  aLayer) const

Function GetLayerName returns the name of a layer.

Copper layers may have custom names.

Definition at line 293 of file class_board.cpp.

294 {
295  // All layer names are stored in the BOARD.
296  if( IsLayerEnabled( aLayer ) )
297  {
298  // Standard names were set in BOARD::BOARD() but they may be
299  // over-ridden by BOARD::SetLayerName().
300  // For copper layers, return the actual copper layer name,
301  // otherwise return the Standard English layer name.
302  if( IsCopperLayer( aLayer ) )
303  return m_Layer[aLayer].m_name;
304  }
305 
306  return GetStandardLayerName( aLayer );
307 }
wxString m_name
The name of the layer, there should be no spaces in this name.
Definition: class_board.h:106
bool IsLayerEnabled(PCB_LAYER_ID aLayer) const
Function IsLayerEnabled is a proxy function that calls the correspondent function in m_BoardSettings ...
Definition: class_board.h:465
LAYER m_Layer[PCB_LAYER_ID_COUNT]
Definition: class_board.h:203
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Function GetStandardLayerName returns an "English Standard" name of a PCB layer when given aLayerNumb...
Definition: class_board.h:650

References GetStandardLayerName(), IsCopperLayer(), IsLayerEnabled(), m_Layer, and LAYER::m_name.

Referenced by GERBER_JOBFILE_WRITER::addJSONMaterialStackup(), DSN::SPECCTRA_DB::buildLayerMaps(), PANEL_SETUP_BOARD_STACKUP::createRowData(), PANEL_MODEDIT_COLOR_SETTINGS::createSwatches(), PANEL_PCBNEW_COLOR_SETTINGS::createSwatches(), DRC::doTrackDrc(), GRID_CELL_LAYER_RENDERER::Draw(), PCB_IO::format(), PCB_IO::formatBoardLayers(), BOARD_STACKUP::FormatBoardStackup(), PCB_IO::formatLayers(), GENDRILL_WRITER_BASE::GenDrillReportFile(), PCB_LAYER_SELECTOR::getLayerName(), PCB_LAYER_BOX_SELECTOR::getLayerName(), BOARD_ITEM::GetLayerName(), ZONE_CONTAINER::GetMsgPanelInfo(), TRACK::GetMsgPanelInfo(), VIA::GetMsgPanelInfo(), VIA::GetSelectMenuText(), ZONE_CONTAINER::GetSelectMenuText(), GRID_CELL_LAYER_SELECTOR::GetValue(), DIALOG_PLOT::init_Dialog(), DIALOG_EXPORT_SVG::initDialog(), DIALOG_PAD_PROPERTIES::initValues(), BOARD_ITEM::LayerMaskDescribe(), DIALOG_PLOT::Plot(), PCB_LAYER_WIDGET::ReFill(), DIALOG_GLOBAL_DELETION::SetCurrentLayer(), ZONE_SETTINGS::SetupLayersList(), PANEL_SETUP_LAYERS::showBoardLayerNames(), PANEL_SETUP_LAYERS::TransferDataFromWindow(), DIALOG_PRINT_PCBNEW::TransferDataToWindow(), DIALOG_BOARD_STATISTICS::updateDrillGrid(), HYPERLYNX_EXPORTER::writeDevices(), HYPERLYNX_EXPORTER::writeNetObjects(), HYPERLYNX_EXPORTER::writeSinglePadStack(), and HYPERLYNX_EXPORTER::writeStackupInfo().

◆ GetLayerSet()

virtual LSET BOARD_ITEM::GetLayerSet ( ) const
inlinevirtualinherited

Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segment or VIA physically resides.

Returns
int - a layer mask, see layers_id_colors_visibility.h.

Reimplemented in VIA, D_PAD, and ZONE_CONTAINER.

Definition at line 188 of file class_board_item.h.

188 { return LSET( m_Layer ); }
PCB_LAYER_ID m_Layer
LSET is a set of PCB_LAYER_IDs.

References BOARD_ITEM::m_Layer.

Referenced by GRID_HELPER::BestSnapAnchor(), build_pad_testpoints(), test::DRC_TEST_PROVIDER_COPPER_CLEARANCE::doTrackDrc(), DRC::doTrackDrc(), DRAWING_TOOL::DrawVia(), hash_board_item(), and CN_VISITOR::operator()().

◆ GetLayerType()

LAYER_T BOARD::GetLayerType ( PCB_LAYER_ID  aLayer) const

Function GetLayerType returns 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 336 of file class_board.cpp.

337 {
338  if( !IsCopperLayer( aLayer ) )
339  return LT_SIGNAL;
340 
341  //@@IMB: The original test was broken due to the discontinuity
342  // in the layer sequence.
343  if( IsLayerEnabled( aLayer ) )
344  return m_Layer[aLayer].m_type;
345 
346  return LT_SIGNAL;
347 }
LAYER_T m_type
The type of the layer.
Definition: class_board.h:107
bool IsLayerEnabled(PCB_LAYER_ID aLayer) const
Function IsLayerEnabled is a proxy function that calls the correspondent function in m_BoardSettings ...
Definition: class_board.h:465
LAYER m_Layer[PCB_LAYER_ID_COUNT]
Definition: class_board.h:203
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer 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(), and PANEL_SETUP_LAYERS::showLayerTypes().

◆ 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, MODULE, SCH_SHEET, D_PAD, SCH_HIERLABEL, VIA, SCH_GLOBALLABEL, SCH_LABEL, SCH_TEXT, GERBER_DRAW_ITEM, LIB_PIN, DRAWSEGMENT, DIMENSION, TRACK, TEXTE_MODULE, SCH_BUS_BUS_ENTRY, SCH_LINE, SCH_SHEET_PIN, LIB_FIELD, SCH_FIELD, SCH_BUS_WIRE_ENTRY, EDGE_MODULE, SCH_BITMAP, LIB_ARC, TEXTE_PCB, LIB_POLYLINE, SCH_NO_CONNECT, LIB_TEXT, SCH_MARKER, PCB_TARGET, MARKER_PCB, SCH_JUNCTION, MARKER_PCB, LIB_CIRCLE, and LIB_RECTANGLE.

Definition at line 235 of file base_struct.cpp.

236 {
237  return dummy_xpm;
238 }
static const BITMAP_OPAQUE dummy_xpm[1]
Definition: base_struct.cpp:56

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

910 {
911  wxString txt;
912  int viasCount = 0;
913  int trackSegmentsCount = 0;
914 
915  for( auto item : m_tracks )
916  {
917  if( item->Type() == PCB_VIA_T )
918  viasCount++;
919  else
920  trackSegmentsCount++;
921  }
922 
923  txt.Printf( wxT( "%d" ), GetPadCount() );
924  aList.emplace_back( _( "Pads" ), txt, DARKGREEN );
925 
926  txt.Printf( wxT( "%d" ), viasCount );
927  aList.emplace_back( _( "Vias" ), txt, DARKGREEN );
928 
929  txt.Printf( wxT( "%d" ), trackSegmentsCount );
930  aList.emplace_back( _( "Track Segments" ), txt, DARKGREEN );
931 
932  txt.Printf( wxT( "%d" ), GetNodesCount() );
933  aList.emplace_back( _( "Nodes" ), txt, DARKCYAN );
934 
935  txt.Printf( wxT( "%d" ), m_NetInfo.GetNetCount() - 1 /* Don't include "No Net" in count */ );
936  aList.emplace_back( _( "Nets" ), txt, RED );
937 
938  txt.Printf( wxT( "%d" ), GetConnectivity()->GetUnconnectedCount() );
939  aList.emplace_back( _( "Unrouted" ), txt, BLUE );
940 }
NETINFO_LIST m_NetInfo
Definition: class_board.h:230
TRACKS m_tracks
TRACKS for traces on the board, owned by pointer.
Definition: class_board.h:198
unsigned GetNodesCount(int aNet=-1)
Function GetNodesCount.
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:355
Definition: color4d.h:59
unsigned GetPadCount()
Function GetPadCount.
Definition: color4d.h:56
#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 ( )

Function GetNetClassAssignmentCandidates Returns 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 1262 of file class_board.cpp.

1263 {
1264  std::vector<wxString> names;
1265 
1266  for( NETINFO_ITEM* net : m_NetInfo )
1267  {
1268  if( !net->GetShortNetname().IsEmpty() )
1269  names.emplace_back( net->GetShortNetname() );
1270  }
1271 
1272  return names;
1273 }
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().

◆ GetNetCount()

unsigned BOARD::GetNetCount ( ) const
inline

Function GetNetCount.

Returns
the number of nets (NETINFO_ITEM)

Definition at line 775 of file class_board.h.

776  {
777  return m_NetInfo.GetNetCount();
778  }
NETINFO_LIST m_NetInfo
Definition: class_board.h:230
unsigned GetNetCount() const
Function GetNetCount.
Definition: netinfo.h:449

References NETINFO_LIST::GetNetCount().

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

◆ GetNetInfo() [1/2]

◆ GetNetInfo() [2/2]

NETINFO_LIST& BOARD::GetNetInfo ( )
inline

Definition at line 746 of file class_board.h.

747  {
748  return m_NetInfo;
749  }
NETINFO_LIST m_NetInfo
Definition: class_board.h:230

◆ GetNodesCount()

unsigned BOARD::GetNodesCount ( int  aNet = -1)

Function GetNodesCount.

Parameters
aNetOnly count nodes belonging to this net
Returns
the number of pads members of nets (i.e. with netcode > 0)

Definition at line 829 of file class_board.cpp.

830 {
831  unsigned retval = 0;
832  for( auto mod : Modules() )
833  {
834  for( auto pad : mod->Pads() )
835  {
836  if( ( aNet == -1 && pad->GetNetCode() > 0 ) || aNet == pad->GetNetCode() )
837  retval++;
838  }
839  }
840 
841  return retval;
842 }
MODULES & Modules()
Definition: class_board.h:266

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/5]

D_PAD * BOARD::GetPad ( unsigned  aIndex) const

Function GetPad.

Returns
D_PAD* - at the aIndex

Definition at line 1831 of file class_board.cpp.

1832 {
1833  unsigned count = 0;
1834 
1835  for( auto mod : m_modules )
1836  {
1837  for( auto pad : mod->Pads() )
1838  {
1839  if( count == aIndex )
1840  return pad;
1841 
1842  count++;
1843  }
1844  }
1845 
1846  return nullptr;
1847 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:195

References m_modules.

Referenced by GetPad().

◆ GetPad() [2/5]

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

Function GetPad finds 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 1357 of file class_board.cpp.

1358 {
1359  if( !aLayerSet.any() )
1360  aLayerSet = LSET::AllCuMask();
1361 
1362  for( auto module : m_modules )
1363  {
1364  D_PAD* pad = NULL;
1365 
1366  if( module->HitTest( aPosition ) )
1367  pad = module->GetPad( aPosition, aLayerSet );
1368 
1369  if( pad )
1370  return pad;
1371  }
1372 
1373  return NULL;
1374 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:195
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:712
#define NULL

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

◆ GetPad() [3/5]

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

Definition at line 1056 of file class_board.h.

1057  {
1058  return GetPad( aPosition, LSET().set() );
1059  }
D_PAD * GetPad(unsigned aIndex) const
Function GetPad.
LSET is a set of PCB_LAYER_IDs.

◆ GetPad() [4/5]

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

Function GetPad finds 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 1377 of file class_board.cpp.

1378 {
1379  const wxPoint& aPosition = aTrace->GetEndPoint( aEndPoint );
1380 
1381  LSET lset( aTrace->GetLayer() );
1382 
1383  return GetPad( aPosition, lset );
1384 }
D_PAD * GetPad(unsigned aIndex) const
Function GetPad.
LSET is a set of PCB_LAYER_IDs.
const wxPoint & GetEndPoint(ENDPOINT_T aEndPoint) const
Return the selected endpoint (start or end)
Definition: class_track.h:127
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() [5/5]

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

Function GetPad locates 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 1406 of file class_board.cpp.

1407 {
1408  // Search aPadList for aPosition
1409  // aPadList is sorted by X then Y values, and a fast binary search is used
1410  int idxmax = aPadList.size()-1;
1411 
1412  int delta = aPadList.size();
1413 
1414  int idx = 0; // Starting index is the beginning of list
1415 
1416  while( delta )
1417  {
1418  // Calculate half size of remaining interval to test.
1419  // Ensure the computed value is not truncated (too small)
1420  if( (delta & 1) && ( delta > 1 ) )
1421  delta++;
1422 
1423  delta /= 2;
1424 
1425  D_PAD* pad = aPadList[idx];
1426 
1427  if( pad->GetPosition() == aPosition ) // candidate found
1428  {
1429  // The pad must match the layer mask:
1430  if( ( aLayerSet & pad->GetLayerSet() ).any() )
1431  return pad;
1432 
1433  // More than one pad can be at aPosition
1434  // search for a pad at aPosition that matched this mask
1435 
1436  // search next
1437  for( int ii = idx+1; ii <= idxmax; ii++ )
1438  {
1439  pad = aPadList[ii];
1440 
1441  if( pad->GetPosition() != aPosition )
1442  break;
1443 
1444  if( ( aLayerSet & pad->GetLayerSet() ).any() )
1445  return pad;
1446  }
1447  // search previous
1448  for( int ii = idx-1 ;ii >=0; ii-- )
1449  {
1450  pad = aPadList[ii];
1451 
1452  if( pad->GetPosition() != aPosition )
1453  break;
1454 
1455  if( ( aLayerSet & pad->GetLayerSet() ).any() )
1456  return pad;
1457  }
1458 
1459  // Not found:
1460  return 0;
1461  }
1462 
1463  if( pad->GetPosition().x == aPosition.x ) // Must search considering Y coordinate
1464  {
1465  if( pad->GetPosition().y < aPosition.y ) // Must search after this item
1466  {
1467  idx += delta;
1468 
1469  if( idx > idxmax )
1470  idx = idxmax;
1471  }
1472  else // Must search before this item
1473  {
1474  idx -= delta;
1475 
1476  if( idx < 0 )
1477  idx = 0;
1478  }
1479  }
1480  else if( pad->GetPosition().x < aPosition.x ) // Must search after this item
1481  {
1482  idx += delta;
1483 
1484  if( idx > idxmax )
1485  idx = idxmax;
1486  }
1487  else // Must search before this item
1488  {
1489  idx -= delta;
1490 
1491  if( idx < 0 )
1492  idx = 0;
1493  }
1494  }
1495 
1496  return NULL;
1497 }
wxPoint GetPosition() const override
Definition: class_pad.h:165
#define NULL
LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_pad.h:335

References D_PAD::GetLayerSet(), D_PAD::GetPosition(), NULL, wxPoint::x, and wxPoint::y.

◆ GetPadCount()

unsigned BOARD::GetPadCount ( )

Function GetPadCount.

Returns
the number of pads in board

Definition at line 1816 of file class_board.cpp.

1817 {
1818  unsigned retval = 0;
1819 
1820  for( auto mod : Modules() )
1821  retval += mod->Pads().size();
1822 
1823  return retval;
1824 }
MODULES & Modules()
Definition: class_board.h:266

References Modules().

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

◆ GetPadFast()

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

Function GetPadFast 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 1387 of file class_board.cpp.

1388 {
1389  for( auto mod : Modules() )
1390  {
1391  for ( auto pad : mod->Pads() )
1392  {
1393  if( pad->GetPosition() != aPosition )
1394  continue;
1395 
1396  // Pad found, it must be on the correct layer
1397  if( ( pad->GetLayerSet() & aLayerSet ).any() )
1398  return pad;
1399  }
1400  }
1401 
1402  return nullptr;
1403 }
MODULES & Modules()
Definition: class_board.h:266

References Modules().

◆ GetPads()

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

Function GetPads returns 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 1802 of file class_board.cpp.

1803 {
1804  std::vector<D_PAD*> allPads;
1805 
1806  for( MODULE* mod : Modules() )
1807  {
1808  for( D_PAD* pad : mod->Pads() )
1809  allPads.push_back( pad );
1810  }
1811 
1812  return allPads;
1813 }
MODULES & Modules()
Definition: class_board.h:266

References Modules().

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

◆ GetPageSettings()

◆ GetParent()

BOARD_ITEM_CONTAINER* BOARD_ITEM::GetParent ( void  ) const
inlineinherited

Definition at line 174 of file class_board_item.h.

174 { return (BOARD_ITEM_CONTAINER*) m_Parent; }
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:174
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(), EDGE_MODULE::GetMsgPanelInfo(), EDGE_MODULE::GetSelectMenuText(), TEXTE_MODULE::GetSelectMenuText(), TEXTE_PCB::GetShownText(), TEXTE_MODULE::GetShownText(), SELECTION_TOOL::GuessSelectionCandidates(), GENERAL_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), EDGE_MODULE::IsParentFlipped(), TEXTE_MODULE::IsParentFlipped(), LEGACY_PLUGIN::loadMODULE_TEXT(), ALTIUM_PCB::ParseTexts6Data(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), CLIPBOARD_IO::SaveSelection(), SELECTION_TOOL::select(), SELECTION_TOOL::Selectable(), SwapItemData(), test::DRC_TEST_PROVIDER_COPPER_CLEARANCE::testCopperDrawItem(), DRC::testCopperDrawItem(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), MARKER_PCB::ViewGetLayers(), MODULE_ZONE_CONTAINER::ViewGetLOD(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ GetPlotOptions()

const PCB_PLOT_PARAMS& BOARD::GetPlotOptions ( ) const
inline

◆ GetPosition()

wxPoint BOARD::GetPosition ( ) const
overridevirtual

Reimplemented from EDA_ITEM.

Definition at line 190 of file class_board.cpp.

191 {
192  return ZeroOffset;
193 }
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

Definition at line 378 of file class_board.h.

378 { return m_project; }
PROJECT * m_project
Definition: class_board.h:216

Referenced by GetFootprintLibraryTable(), TEXTE_PCB::GetShownText(), and StartPlotBoard().

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

703 {
704  return wxString::Format( _( "PCB" ) );
705 }
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:205
#define _(s)
Definition: 3d_actions.cpp:33

References _, and Format().

◆ GetSortedPadListByXthenYCoord()

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

Function GetSortedPadListByXthenYCoord 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 1513 of file class_board.cpp.

1514 {
1515  for ( auto mod : Modules() )
1516  {
1517  for ( auto pad : mod->Pads( ) )
1518  {
1519  if( aNetCode < 0 || pad->GetNetCode() == aNetCode )
1520  {
1521  aVector.push_back( pad );
1522  }
1523  }
1524  }
1525 
1526  std::sort( aVector.begin(), aVector.end(), sortPadsByXthenYCoord );
1527 }
MODULES & Modules()
Definition: class_board.h:266
bool sortPadsByXthenYCoord(D_PAD *const &ref, D_PAD *const &comp)
Function SortPadsByXCoord is used by GetSortedPadListByXCoord to Sort a pad list by x coordinate valu...

References Modules(), and sortPadsByXthenYCoord().

Referenced by DRC::testPadClearances().

◆ GetStandardLayerName()

static wxString BOARD::GetStandardLayerName ( PCB_LAYER_ID  aLayerId)
inlinestatic

Function GetStandardLayerName returns 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 650 of file class_board.h.

651  {
652  // a BOARD's standard layer name is the PCB_LAYER_ID fixed name
653  return LSET::Name( aLayerId );
654  }
static const wxChar * Name(PCB_LAYER_ID aLayerId)
Function Name returns the fixed name association with aLayerId.
Definition: lset.cpp:78

References LSET::Name().

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

◆ GetState()

int EDA_ITEM::GetState ( int  type) const
inlineinherited

Definition at line 216 of file base_struct.h.

217  {
218  return m_Status & type;
219  }
STATUS_FLAGS m_Status
Definition: base_struct.h:173

References EDA_ITEM::m_Status.

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

◆ GetStatus()

STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 229 of file base_struct.h.

229 { return m_Status; }
STATUS_FLAGS m_Status
Definition: base_struct.h:173

References EDA_ITEM::m_Status.

Referenced by PCB_IO::format().

◆ GetTitleBlock()

TITLE_BLOCK& BOARD::GetTitleBlock ( )
inline

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

1541 {
1542  int count = 0;
1543  double length = 0.0;
1544  double package_length = 0.0;
1545 
1546  constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T, PCB_PAD_T, EOT };
1547  auto connectivity = GetBoard()->GetConnectivity();
1548 
1549  for( auto item : connectivity->GetConnectedItems(
1550  static_cast<const BOARD_CONNECTED_ITEM*>( &aTrack ), types ) )
1551  {
1552  count++;
1553 
1554  if( auto track = dyn_cast<TRACK*>( item ) )
1555  {
1556  bool inPad = false;
1557 
1558  for( auto pad_it : connectivity->GetConnectedPads( item ) )
1559  {
1560  auto pad = static_cast<D_PAD*>( pad_it );
1561 
1562  if( pad->HitTest( track->GetStart(), track->GetWidth() / 2 )
1563  && pad->HitTest( track->GetEnd(), track->GetWidth() / 2 ) )
1564  {
1565  inPad = true;
1566  break;
1567  }
1568  }
1569 
1570  if( !inPad )
1571  length += track->GetLength();
1572  }
1573  else if( auto pad = dyn_cast<D_PAD*>( item ) )
1574  package_length += pad->GetPadToDieLength();
1575  }
1576 
1577  return std::make_tuple( count, length, package_length );
1578 }
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
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
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:355
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97

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

Referenced by TRACK::GetMsgPanelInfo().

◆ GetUnconnectedNetCount()

unsigned BOARD::GetUnconnectedNetCount ( ) const

Function GetUnconnectedNetCount.

Returns
the number of unconnected nets in the current ratsnest.

Definition at line 845 of file class_board.cpp.

846 {
847  return m_connectivity->GetUnconnectedCount();
848 }
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 476 of file class_board.cpp.

477 {
479 }
VTBL_ENTRY PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
Definition: project.h:143
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().

◆ GetVisibleLayers()

LSET BOARD::GetVisibleLayers ( ) const

Function GetVisibleLayers is 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 436 of file class_board.cpp.

437 {
439 }
LSET m_VisibleLayers
Board settings.
VTBL_ENTRY PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
Definition: project.h:143
static LSET AllLayersMask()
Definition: lset.cpp:749
PROJECT * m_project
Definition: class_board.h:216

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

Referenced by ComputeBoundingBox(), PCB_BASE_FRAME::GetCollectorsGuide(), DIALOG_DRC::OnDRCItemSelected(), PCB_LAYER_WIDGET::OnLayerVisible(), SELECTION_TOOL::Selectable(), and D_PAD::ViewGetLOD().

◆ GetX()

int BOARD_ITEM::GetX ( ) const
inlineinherited

◆ GetY()

int BOARD_ITEM::GetY ( ) const
inlineinherited

◆ GetZoneList()

std::list< ZONE_CONTAINER * > BOARD::GetZoneList ( bool  aIncludeZonesInFootprints = false)

Function GetZoneList.

Returns
a std::list of pointers to all board zones (possibly including zones in footprints)

Definition at line 1648 of file class_board.cpp.

1649 {
1650  std::list<ZONE_CONTAINER*> zones;
1651 
1652  for( int ii = 0; ii < GetAreaCount(); ii++ )
1653  {
1654  zones.push_back( GetArea( ii ) );
1655  }
1656 
1657  if( aIncludeZonesInFootprints )
1658  {
1659  for( MODULE* mod : m_modules )
1660  {
1661  for( MODULE_ZONE_CONTAINER* zone : mod->Zones() )
1662  {
1663  zones.push_back( zone );
1664  }
1665  }
1666  }
1667 
1668  return zones;
1669 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:195
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:934
MODULE_ZONE_CONTAINER is the same item as ZONE_CONTAINER, but with a specific type id ZONE_CONTAINER ...
Definition: class_zone.h:950
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:899

References GetArea(), GetAreaCount(), and m_modules.

Referenced by ZONE_FILLER::buildCopperItemClearances(), and DRC_KEEPOUT_TESTER::RunDRC().

◆ GetZoneSettings()

const ZONE_SETTINGS& BOARD::GetZoneSettings ( ) const
inlineoverridevirtual

Fetch the zone settings for this container.

Reimplemented from BOARD_ITEM_CONTAINER.

Definition at line 564 of file class_board.h.

565  {
567  }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:553
ZONE_SETTINGS & GetDefaultZoneSettings()

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

Referenced by LEGACY_PLUGIN::loadSETUP().

◆ HasFlag()

◆ HighLightOFF()

void BOARD::HighLightOFF ( )
inline

Function HighLightOFF Disable net highlight.

Definition at line 430 of file class_board.h.

431  {
432  HighLightON( false );
433  }
void HighLightON(bool aValue=true)
Enable or disable net highlighting.

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

1956 {
1957  if( m_highLight.m_highLightOn != aValue )
1958  {
1959  m_highLight.m_highLightOn = aValue;
1961  }
1962 }
void InvokeListeners(Func &&aFunc, Args &&... args)
Definition: class_board.h:241
HIGH_LIGHT_INFO m_highLight
Definition: class_board.h:206
virtual void OnBoardHighlightNetChanged(BOARD &aBoard)
Definition: class_board.h:167

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

Referenced by PCB_EDIT_FRAME::ExecuteRemoteCommand(), and PCB_INSPECTION_TOOL::highlightNet().

◆ 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, MODULE, ZONE_CONTAINER, VIA, WS_DRAW_ITEM_BITMAP, SCH_TEXT, ARC, WS_DRAW_ITEM_TEXT, GERBER_DRAW_ITEM, DRAWSEGMENT, DIMENSION, LIB_PIN, SCH_LINE, TEXTE_MODULE, LIB_ITEM, SCH_FIELD, TRACK, WS_DRAW_ITEM_POLYPOLYGONS, SCH_BITMAP, SCH_BUS_ENTRY_BASE, SCH_NO_CONNECT, TEXTE_PCB, SCH_JUNCTION, WS_DRAW_ITEM_BASE, PCB_TARGET, LIB_POLYLINE, LIB_ARC, LIB_BEZIER, LIB_TEXT, and LIB_CIRCLE.

Definition at line 321 of file base_struct.h.

322  {
323  return false; // derived classes should override this function
324  }

◆ InsertArea()

ZONE_CONTAINER * BOARD::InsertArea ( int  aNetcode,
int  aAreaIdx,
PCB_LAYER_ID  aLayer,
int  aCornerX,
int  aCornerY,
ZONE_BORDER_DISPLAY_STYLE  aHatch 
)

Add a copper area to net, inserting after m_ZoneDescriptorList[aAreaIdx].

Parameters
aNetcodeis the netcode of the new copper zone
aAreaIdxis the netcode of the new copper zone
aLayeris the copper layer id of the new copper zone
aCornerX,aCornerYis the coordinate of the first corner (a zone cannot have a empty outline)
aHatchis the hatch option
Returns
pointer to the new area

Definition at line 1708 of file class_board.cpp.

1710 {
1711  ZONE_CONTAINER* new_area = new ZONE_CONTAINER( this );
1712 
1713  new_area->SetNetCode( aNetcode );
1714  new_area->SetLayer( aLayer );
1715 
1716  if( aAreaIdx < (int) ( m_ZoneDescriptorList.size() - 1 ) )
1717  m_ZoneDescriptorList.insert( m_ZoneDescriptorList.begin() + aAreaIdx + 1, new_area );
1718  else
1719  m_ZoneDescriptorList.push_back( new_area );
1720 
1721  new_area->SetHatchStyle( (ZONE_BORDER_DISPLAY_STYLE) aHatch );
1722 
1723  // Add the first corner to the new zone
1724  new_area->AppendCorner( wxPoint( aCornerX, aCornerY ), -1 );
1725 
1726  return new_area;
1727 }
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.
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Function SetLayer sets the layer this item is on.
Definition: class_zone.cpp:232
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:201
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:873
ZONE_BORDER_DISPLAY_STYLE
Zone border styles.
Definition: zone_settings.h:46
void SetHatchStyle(ZONE_BORDER_DISPLAY_STYLE aStyle)
Definition: class_zone.h:578

References ZONE_CONTAINER::AppendCorner(), m_ZoneDescriptorList, ZONE_CONTAINER::SetHatchStyle(), ZONE_CONTAINER::SetLayer(), and BOARD_CONNECTED_ITEM::SetNetCode().

Referenced by AddArea().

◆ 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

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

◆ IsBrightened()

bool EDA_ITEM::IsBrightened ( ) const
inlineinherited

◆ 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 141 of file class_board_item.h.

142  {
143  return false;
144  }

Referenced by CN_CONNECTIVITY_ALGO::markItemNetAsDirty(), and CONNECTIVITY_DATA::MarkItemNetAsDirty().

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 201 of file base_struct.h.

201 { return m_Flags & IS_DRAGGED; }
#define IS_DRAGGED
Item being dragged.
Definition: base_struct.h:119
STATUS_FLAGS m_Flags
Definition: base_struct.h:176

References IS_DRAGGED, and EDA_ITEM::m_Flags.

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

◆ IsElementVisible()

bool BOARD::IsElementVisible ( GAL_LAYER_ID  aLayer) const

Function IsElementVisible tests 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 482 of file class_board.cpp.

483 {
485 }
VTBL_ENTRY PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
Definition: project.h:143
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(), PCB_BASE_FRAME::GetCollectorsGuide(), FOOTPRINT_EDIT_FRAME::IsElementVisible(), PCB_EDIT_FRAME::IsElementVisible(), IsModuleLayerVisible(), PCB_LAYER_WIDGET::ReFillRender(), SELECTION_TOOL::Selectable(), and PCB_DRAW_PANEL_GAL::SyncLayersVisibility().

◆ IsEmpty()

bool BOARD::IsEmpty ( ) const
inline

Definition at line 311 of file class_board.h.

312  {
313  return m_drawings.empty() && m_modules.empty() && m_tracks.empty() &&
314  m_ZoneDescriptorList.empty();
315  }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:195
TRACKS m_tracks
TRACKS for traces on the board, owned by pointer.
Definition: class_board.h:198
DRAWINGS m_drawings
BOARD_ITEMs for drawings on the board, owned by pointer.
Definition: class_board.h:192
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:201

Referenced by BOARD_NETLIST_UPDATER::estimateComponentInsertionPosition(), PCB_EDIT_FRAME::Files_io_from_id(), PCB_EDIT_FRAME::IsContentModified(), and DIALOG_NETLIST::OnUpdatePCB().

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 286 of file base_struct.h.

286 { return m_forceVisible; }
bool m_forceVisible
Definition: base_struct.h:175

References EDA_ITEM::m_forceVisible.

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

◆ IsHighLightNetON()

bool BOARD::IsHighLightNetON ( ) const
inline

Function IsHighLightNetON.

Returns
true if a net is currently highlighted

Definition at line 416 of file class_board.h.

416 { return m_highLight.m_highLightOn; }
HIGH_LIGHT_INFO m_highLight
Definition: class_board.h:206

References 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

Function IsLayerEnabled is 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 465 of file class_board.h.

466  {
467  return GetDesignSettings().IsLayerEnabled( aLayer );
468  }
bool IsLayerEnabled(PCB_LAYER_ID aLayerId) const
Function IsLayerEnabled tests whether a given layer is enabled.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:553

References PCB_BASE_FRAME::GetDesignSettings(), and BOARD_DESIGN_SETTINGS::IsLayerEnabled().

Referenced by GRID_CELL_LAYER_SELECTOR::BeginEdit(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), GetLayerName(), GetLayerType(), PCB_LAYER_SELECTOR::isLayerEnabled(), PCB_LAYER_BOX_SELECTOR::isLayerEnabled(), SetLayerName(), and SetLayerType().

◆ IsLayerVisible()

bool BOARD::IsLayerVisible ( PCB_LAYER_ID  aLayer) const

Function IsLayerVisible is 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 428 of file class_board.cpp.

429 {
430  // If there is no project, assume layer is visible always
431  return GetDesignSettings().IsLayerEnabled( aLayer )
432  && ( !m_project || m_project->GetLocalSettings().m_VisibleLayers[aLayer] );
433 }
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:143
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:553
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(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), BOARD_ADAPTER::Is3DLayerEnabled(), PCBNEW_CONTROL::LayerNext(), PCBNEW_CONTROL::LayerPrev(), SELECTION_TOOL::Selectable(), PCB_DRAW_PANEL_GAL::SyncLayersVisibility(), and PCB_LAYER_WIDGET::SyncLayerVisibilities().

◆ 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 253 of file class_board_item.h.

254  {
255  // only MODULEs & TRACKs can be locked at this time.
256  return false;
257  }

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

198 { return m_Flags & IS_CHANGED; }
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:113
STATUS_FLAGS m_Flags
Definition: base_struct.h:176

References IS_CHANGED, and EDA_ITEM::m_Flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsModuleLayerVisible()

bool BOARD::IsModuleLayerVisible ( PCB_LAYER_ID  aLayer)

Function IsModuleLayerVisible expects 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 modules: F_Cu or B_Cu
Returns
bool - true if the layer is visible, else false.

Definition at line 524 of file class_board.cpp.

525 {
526  switch( aLayer )
527  {
528  case F_Cu:
529  return IsElementVisible( LAYER_MOD_FR );
530 
531  case B_Cu:
532  return IsElementVisible( LAYER_MOD_BK );
533 
534  default:
535  wxFAIL_MSG( wxT( "BOARD::IsModuleLayerVisible() param error: bad layer" ) );
536  return true;
537  }
538 }
show modules on front
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Function IsElementVisible tests 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 149 of file class_board_item.h.

150  {
151  return IsCopperLayer( GetLayer() );
152  }
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer 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, MARKER_PCB, and MARKER_PCB.

Definition at line 233 of file class_board_item.h.

234  {
235  return m_Layer == aLayer;
236  }
PCB_LAYER_ID m_Layer

References BOARD_ITEM::m_Layer.

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

◆ 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 501 of file base_struct.h.

501 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 204 of file base_struct.h.

204 { return m_Flags & IS_RESIZED; }
STATUS_FLAGS m_Flags
Definition: base_struct.h:176
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:118

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 244 of file class_board_item.h.

245  {
246  return ( Type() == PCB_TRACE_T ) || ( Type() == PCB_VIA_T );
247  }
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: base_struct.h:193

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, DRAWSEGMENT, TEXTE_MODULE, SCH_FIELD, SCH_LINE, EDGE_MODULE, and TEXTE_PCB.

Definition at line 262 of file base_struct.h.

263  {
264  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
265  return true;
266 
267  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
268  {
269  if( m_StructType == *p )
270  return true;
271  }
272 
273  return false;
274  }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it.
Definition: base_struct.h:170
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(), TEXTE_PCB::IsType(), EDGE_MODULE::IsType(), SCH_LINE::IsType(), SCH_FIELD::IsType(), TEXTE_MODULE::IsType(), DRAWSEGMENT::IsType(), D_PAD::IsType(), DIMENSION::IsType(), SCH_LABEL::IsType(), VIA::IsType(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), EE_SELECTION_TOOL::RequestSelection(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), EDA_ITEM::Visit(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 202 of file base_struct.h.

202 { return m_Flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:121
STATUS_FLAGS m_Flags
Definition: base_struct.h:176

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 383 of file base_struct.h.

387  {
388  for( auto it : aList )
389  {
390  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
392  return SEARCH_RESULT::QUIT;
393  }
394 
396  }
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...

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

Referenced by GERBER_FILE_IMAGE::Visit(), and 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 404 of file base_struct.h.

406  {
407  for( auto it : aList )
408  {
409  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
411  return SEARCH_RESULT::QUIT;
412  }
413 
415  }
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...

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

◆ LayerMaskDescribe()

wxString BOARD_ITEM::LayerMaskDescribe ( const BOARD aBoard,
LSET  aMask 
)
staticprotectedinherited

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

Definition at line 74 of file class_board_item.cpp.

75 {
76  // Try to be smart and useful. Check all copper first.
77  if( aMask[F_Cu] && aMask[B_Cu] )
78  return _( "All copper layers" );
79 
80  // Check for copper.
81  auto layer = aBoard->GetEnabledLayers().AllCuMask() & aMask;
82 
83  for( int i = 0; i < 3; i++ )
84  {
85  for( int bit = PCBNEW_LAYER_ID_START; bit < PCB_LAYER_ID_COUNT; ++bit )
86  {
87  if( layer[ bit ] )
88  {
89  wxString layerInfo = aBoard->GetLayerName( static_cast<PCB_LAYER_ID>( bit ) );
90 
91  if( aMask.count() > 1 )
92  layerInfo << _( " and others" );
93 
94  return layerInfo;
95  }
96  }
97 
98  // No copper; first, check for technicals and then for all layers.
99  if( i < 1 ) // first, check for technicals
100  layer = aBoard->GetEnabledLayers().AllTechMask() & aMask;
101  else // then check for all other layers
102  layer = aMask;
103  }
104 
105  // No copper, no technicals: no layer
106  return _( "no layers" );
107 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:712
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer.
LSET GetEnabledLayers() const
Function GetEnabledLayers is a proxy function that calls the corresponding function in m_BoardSetting...
static LSET AllTechMask()
Function AllTechMask returns a mask holding all technical layers (no CU layer) on both side.
Definition: lset.cpp:782
#define _(s)
Definition: 3d_actions.cpp:33

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

Referenced by 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 1884 of file class_board.cpp.

1885 {
1886  for( BOARD_CONNECTED_ITEM* item : AllConnectedItems() )
1887  {
1888  NETINFO_ITEM* netInfo = aDestBoard->FindNet( item->GetNetname() );
1889 
1890  if( netInfo )
1891  item->SetNet( netInfo );
1892  else
1893  item->SetNetCode( 0 );
1894  }
1895 }
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches 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()

MARKERS& BOARD::Markers ( )
inline

Definition at line 285 of file class_board.h.

286  {
287  return m_markers;
288  }
MARKERS m_markers
MARKER_PCBs for clearance problems, owned by pointer.
Definition: class_board.h:189

Referenced by PCB_DRAW_PANEL_GAL::DisplayBoard(), BOARD_DRC_ITEMS_PROVIDER::GetCount(), DIALOG_DRC::OnDRCItemRClick(), DIALOG_PLOT::reInitDialog(), DIALOG_FIND::search(), and BOARD_DRC_ITEMS_PROVIDER::SetSeverities().

◆ 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, TEXTE_MODULE, SCH_MARKER, MARKER_PCB, MARKER_PCB, and TEXTE_PCB.

Definition at line 457 of file base_struct.h.

458  {
459  return false;
460  }

Referenced by SCH_EDITOR_CONTROL::HasMatch(), TEXTE_PCB::Matches(), MARKER_PCB::Matches(), SCH_MARKER::Matches(), TEXTE_MODULE::Matches(), SCH_PIN::Matches(), SCH_FIELD::Matches(), SCH_SHEET_PIN::Matches(), SCH_TEXT::Matches(), and SCH_EDITOR_CONTROL::ReplaceAndFindNext().

◆ 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 145 of file base_struct.cpp.

146 {
147  wxString text = aText;
148  wxString searchText = aSearchData.GetFindString();
149 
150  // Don't match if searching for replaceable item and the item doesn't support text replace.
151  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
152  return false;
153 
154  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
155  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
156 
157  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
158  {
159  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
160  return text.Matches( searchText );
161 
162  return text.MakeUpper().Matches( searchText.MakeUpper() );
163  }
164 
165  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
166  return aText.Find( searchText ) != wxNOT_FOUND;
167 
168  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
169 }
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:501

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

◆ Modules() [1/2]

MODULES& BOARD::Modules ( )
inline

Definition at line 266 of file class_board.h.

267  {
268  return m_modules;
269  }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:195

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(), GENDRILL_WRITER_BASE::buildHolesList(), DIALOG_SELECT_NET_FROM_LIST::buildNetsList(), ZONE_FILLER::buildThermalSpokes(), DRC_KEEPOUT_TESTER::checkFootprints(), HYPERLYNX_EXPORTER::collectNetObjects(), DIALOG_TEXT_PROPERTIES::convertReferencesToKIIDs(), CreateComponentsSection(), BOARD_ADAPTER::createLayers(), PLACEFILE_GERBER_WRITER::CreatePlaceFile(), CreateShapesSection(), CreateSignalsSection(), BOARD_NETLIST_UPDATER::deleteUnusedComponents(), PCB_DRAW_PANEL_GAL::DisplayBoard(), doPushPadProperties(), DRC::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(), PCB_IO::format(), PCB_IO::formatGeneral(), C3D_RENDER_OGL_LEGACY::generate_3D_Vias_and_Pads(), PLACE_FILE_EXPORTER::GenPositionData(), PLACE_FILE_EXPORTER::GenReportData(), PCB_BASE_FRAME::GetFootprintFromBoardByReference(), GetItem(), NETINFO_ITEM::GetMsgPanelInfo(), GetNodesCount(), GetPadCount(), GetPadFast(), GetPads(), GetSortedPadListByXthenYCoord(), DIALOG_GENDRILL::InitDisplayParams(), insideCourtyard(), PCB_EDIT_FRAME::KiwayMailIn(), ZONE_FILLER::knockoutThermalReliefs(), C3D_RENDER_OGL_LEGACY::load_3D_models(), C3D_RENDER_RAYTRACING::load_3D_models(), 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(), PNS_PCBNEW_RULE_RESOLVER::PNS_PCBNEW_RULE_RESOLVER(), DIALOG_EXCHANGE_FOOTPRINTS::processMatchingModules(), BOARD_COMMIT::Push(), RecreateCmpFile(), C3D_RENDER_OGL_LEGACY::render_3D_models(), DSN::SPECCTRA_DB::RevertMODULEs(), test::DRC_TEST_PROVIDER_HOLE_SIZE::Run(), DRC_COURTYARD_TESTER::RunDRC(), DRC_TEXTVAR_TESTER::RunDRC(), DRC_DRILLED_HOLE_TESTER::RunDRC(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), CLIPBOARD_IO::SaveSelection(), DIALOG_FIND::search(), FOOTPRINT_EDIT_FRAME::SelectFootprintFromBoard(), SetElementVisibility(), PNS_KICAD_IFACE_BASE::SyncWorld(), DRC::testCopperTextAndGraphics(), DRC::testDisabledLayers(), TestFootprints(), TestForExistingItem(), 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 270 of file class_board.h.

271  {
272  return m_modules;
273  }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:195

◆ Move() [1/2]

void BOARD_ITEM::Move ( const VECTOR2I aMoveVector)
inlineinherited

Definition at line 292 of file class_board_item.h.

293  {
294  Move( wxPoint( aMoveVector.x, aMoveVector.y ) );
295  }
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 202 of file class_board.cpp.

203 {
204  // @todo : anything like this elsewhere? maybe put into GENERAL_COLLECTOR class.
205  static const KICAD_T top_level_board_stuff[] = {
206  PCB_MARKER_T,
207  PCB_TEXT_T,
208  PCB_LINE_T,
210  PCB_TARGET_T,
211  PCB_VIA_T,
212  PCB_TRACE_T,
213  PCB_ARC_T,
214  // PCB_PAD_T, Can't be at board level
215  // PCB_MODULE_TEXT_T, Can't be at board level
216  PCB_MODULE_T,
218  EOT
219  };
220 
221  INSPECTOR_FUNC inspector = [&] ( EDA_ITEM* item, void* testData )
222  {
223  BOARD_ITEM* brd_item = (BOARD_ITEM*) item;
224 
225  // aMoveVector was snapshotted, don't need "data".
226  brd_item->Move( aMoveVector );
227 
229  };
230 
231  Visit( inspector, NULL, top_level_board_stuff );
232 }
std::function< SEARCH_RESULT(EDA_ITEM *aItem, void *aTestData) > INSPECTOR_FUNC
Typedef INSPECTOR is used to inspect and possibly collect the (search) results of iterating over a li...
Definition: base_struct.h:80
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:102
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:92
class ARC, an arc track segment on a copper layer
Definition: typeinfo.h:98
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
SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[]) override
Function Visit may be re-implemented for each derived class in order to handle all the types given by...
class MODULE, a footprint
Definition: typeinfo.h:89
#define NULL
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:100
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:101
class MARKER_PCB, a marker used to show something
Definition: typeinfo.h:99
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:91

References CONTINUE, EOT, BOARD_ITEM::Move(), NULL, PCB_ARC_T, PCB_DIMENSION_T, PCB_LINE_T, PCB_MARKER_T, PCB_MODULE_T, PCB_TARGET_T, PCB_TEXT_T, PCB_TRACE_T, PCB_VIA_T, PCB_ZONE_AREA_T, and Visit().

Referenced by EAGLE_PLUGIN::centerBoard().

◆ NormalizeAreaPolygon()

bool BOARD::NormalizeAreaPolygon ( PICKED_ITEMS_LIST aNewZonesList,
ZONE_CONTAINER aCurrArea 
)

Function NormalizeAreaPolygon Process an area that has been modified, by normalizing its polygon against itself.

i.e. convert a self-intersecting polygon to one (or more) non self-intersecting polygon(s) This may change the number and order of copper areas in the net.

Parameters
aNewZonesList= a PICKED_ITEMS_LIST * where to store new created areas pickers
aCurrArea= the zone to process
Returns
true if changes are made

Definition at line 1730 of file class_board.cpp.

1731 {
1732  // mark all areas as unmodified except this one, if modified
1733  for( ZONE_CONTAINER* zone : m_ZoneDescriptorList )
1734  zone->SetLocalFlags( 0 );
1735 
1736  aCurrArea->SetLocalFlags( 1 );
1737 
1738  if( aCurrArea->Outline()->IsSelfIntersecting() )
1739  {
1740  aCurrArea->UnHatchBorder();
1741 
1742  // Normalize copied area and store resulting number of polygons
1743  int n_poly = aCurrArea->Outline()->NormalizeAreaOutlines();
1744 
1745  // If clipping has created some polygons, we must add these new copper areas.
1746  if( n_poly > 1 )
1747  {
1748  ZONE_CONTAINER* NewArea;
1749 
1750  // Move the newly created polygons to new areas, removing them from the current area
1751  for( int ip = 1; ip < n_poly; ip++ )
1752  {
1753  // Create new copper area and copy poly into it
1754  SHAPE_POLY_SET* new_p = new SHAPE_POLY_SET( aCurrArea->Outline()->UnitSet( ip ) );
1755  NewArea = AddArea( aNewZonesList, aCurrArea->GetNetCode(), aCurrArea->GetLayer(),
1756  wxPoint(0, 0), aCurrArea->GetHatchStyle() );
1757 
1758  // remove the poly that was automatically created for the new area
1759  // and replace it with a poly from NormalizeAreaOutlines
1760  delete NewArea->Outline();
1761  NewArea->SetOutline( new_p );
1762  NewArea->HatchBorder();
1763  NewArea->SetLocalFlags( 1 );
1764  }
1765 
1766  SHAPE_POLY_SET* new_p = new SHAPE_POLY_SET( aCurrArea->Outline()->UnitSet( 0 ) );
1767  delete aCurrArea->Outline();
1768  aCurrArea->SetOutline( new_p );
1769  }
1770  }
1771 
1772  aCurrArea->HatchBorder();
1773 
1774  return true;
1775 }
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
void HatchBorder()
Function HatchBorder computes the hatch lines depending on the hatch parameters and stores it in the ...
Definition: class_zone.cpp:961
int GetNetCode() const
Function GetNetCode.
int NormalizeAreaOutlines()
Function NormalizeAreaOutlines Convert a self-intersecting polygon to one (or more) non self-intersec...
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:212
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:282
ZONE_BORDER_DISPLAY_STYLE GetHatchStyle() const
Definition: class_zone.h:577
void SetOutline(SHAPE_POLY_SET *aOutline)
Definition: class_zone.h:285
ZONE_CONTAINER * AddArea(PICKED_ITEMS_LIST *aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer, wxPoint aStartPointPosition, ZONE_BORDER_DISPLAY_STYLE aHatch)
Function AddArea Add an empty copper area to board areas list.
SHAPE_POLY_SET.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Returns the reference to aIndex-th outline in the set
void UnHatchBorder()
Function UnHatchBorder clears the zone's hatch.
Definition: class_zone.cpp:947
SHAPE_POLY_SET UnitSet(int aPolygonIndex)
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:201
void SetLocalFlags(int aFlags)
Definition: class_zone.h:268
bool IsSelfIntersecting() const
Function IsSelfIntersecting Checks whether any of the polygons in the set is self intersecting.

References AddArea(), ZONE_CONTAINER::GetHatchStyle(), ZONE_CONTAINER::GetLayer(), BOARD_CONNECTED_ITEM::GetNetCode(), ZONE_CONTAINER::HatchBorder(), SHAPE_POLY_SET::IsSelfIntersecting(), m_ZoneDescriptorList, SHAPE_POLY_SET::NormalizeAreaOutlines(), ZONE_CONTAINER::Outline(), SHAPE_POLY_SET::Outline(), ZONE_CONTAINER::SetLocalFlags(), ZONE_CONTAINER::SetOutline(), ZONE_CONTAINER::UnHatchBorder(), and SHAPE_POLY_SET::UnitSet().

Referenced by OnAreaPolygonModified().

◆ OnAreaPolygonModified()

bool BOARD::OnAreaPolygonModified ( PICKED_ITEMS_LIST aModifiedZonesList,
ZONE_CONTAINER modified_area 
)

Function OnAreaPolygonModified Process an area that has been modified, by normalizing its polygon and merging the intersecting polygons for any other areas on the same net.

This may change the number and order of copper areas in the net.

Parameters
aModifiedZonesList= a PICKED_ITEMS_LIST * where to store deleted or added areas (useful in undo commands can be NULL
modified_area= area to test
Returns
true if some areas modified

Definition at line 49 of file zones_test_and_combine_areas.cpp.

51 {
52  // clip polygon against itself
53  bool modified = NormalizeAreaPolygon( aModifiedZonesList, modified_area );
54 
55  // now see if we need to clip against other areas
56  /*
57  LAYER_NUM layer = modified_area->GetLayer();
58  */
59 
60  bool bCheckAllAreas = TestAreaIntersections( modified_area );
61 
62  if( bCheckAllAreas )
63  {
64  modified = true;
65  CombineAllAreasInNet( aModifiedZonesList, modified_area->GetNetCode(), true );
66  }
67 
68  /*
69 
70  FIXME : do we really need this?
71 
72  if( !IsCopperLayer( layer ) ) // Refill non copper zones on this layer
73  {
74  for( unsigned ia = 0; ia < m_ZoneDescriptorList.size(); ia++ )
75  if( m_ZoneDescriptorList[ia]->GetLayer() == layer )
76  m_ZoneDescriptorList[ia]->BuildFilledSolidAreasPolygons( this );
77  }
78 
79  */
80 
81  // Test for bad areas: all zones must have more than 2 corners:
82  // Note: should not happen, but just in case.
83  for( unsigned ii = 0; ii < m_ZoneDescriptorList.size(); )
84  {
86 
87  if( zone->GetNumCorners() >= 3 )
88  ii++;
89  else // Remove zone because it is incorrect:
90  RemoveArea( aModifiedZonesList, zone );
91  }
92 
93  return modified;
94 }
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
int GetNetCode() const
Function GetNetCode.
void RemoveArea(PICKED_ITEMS_LIST *aDeletedList, ZONE_CONTAINER *area_to_remove)
Function RemoveArea remove copper area from net, and put it in a deleted list (if exists)
bool NormalizeAreaPolygon(PICKED_ITEMS_LIST *aNewZonesList, ZONE_CONTAINER *aCurrArea)
Function NormalizeAreaPolygon Process an area that has been modified, by normalizing its polygon agai...
int GetNumCorners(void) const
Access to m_Poly parameters.
Definition: class_zone.h:489
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:201
bool CombineAllAreasInNet(PICKED_ITEMS_LIST *aDeletedList, int aNetCode, bool aUseLocalFlags)
Function CombineAllAreasInNet Checks all copper areas in net for intersections, combining them if fou...
bool TestAreaIntersections(ZONE_CONTAINER *area_to_test)
Function TestAreaIntersections Check for intersection of a given copper area with other areas in same...

References CombineAllAreasInNet(), BOARD_CONNECTED_ITEM::GetNetCode(), ZONE_CONTAINER::GetNumCorners(), m_ZoneDescriptorList, NormalizeAreaPolygon(), RemoveArea(), and TestAreaIntersections().

Referenced by PCB_EDIT_FRAME::Edit_Zone_Params().

◆ OnItemChanged()

void BOARD::OnItemChanged ( BOARD_ITEM aItem)

Notify the board and its listeners that an item on the board has been modified in some way.

Definition at line 1927 of file class_board.cpp.

1928 {
1930 }
void InvokeListeners(Func &&aFunc, Args &&... args)
Definition: class_board.h:241
virtual void OnBoardItemChanged(BOARD &aBoard, BOARD_ITEM *aBoardItem)
Definition: class_board.h:166

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

Referenced by DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), and BOARD_COMMIT::Revert().

◆ operator<()

bool EDA_ITEM::operator< ( const EDA_ITEM aItem) const
inherited

Test if another item is less than this object.

Parameters
aItem- Item to compare against.
Returns
- True if aItem is less than the item.

Definition at line 199 of file base_struct.cpp.

200 {
201  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
202  GetChars( GetClass() ) ) );
203 
204  return false;
205 }
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:153
virtual wxString GetClass() const =0
Function GetClass returns the class name.
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:205

References Format(), GetChars(), and EDA_ITEM::GetClass().

◆ operator=()

BOARD& BOARD::operator= ( const BOARD aOther)
privatedelete

◆ PadDelete()

void BOARD::PadDelete ( D_PAD aPad)

Function PadDelete deletes a given bad from the BOARD by removing it from its module and from the m_NetInfo.

Makes no UI calls.

Parameters