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

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 ()
 
const 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)
 
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 DeleteZONEOutlines ()
 Function DeleteZONEOutlines deletes ALL zone outlines from the board. More...
 
void SetAuxOrigin (const wxPoint &aPoint)
 Function SetAuxOrigin sets the origin point used for plotting. More...
 
const wxPointGetAuxOrigin () const
 
void SetGridOrigin (const wxPoint &aPoint)
 Function SetGridOrigin sets the origin point of the grid. More...
 
const wxPointGetGridOrigin () const
 
void ResetNetHighLight ()
 Function ResetNetHighLight Reset all high light data to the init state. More...
 
int GetHighLightNetCode () const
 Function GetHighLightNetCode. More...
 
void SetHighLightNet (int aNetCode)
 Function SetHighLightNet. More...
 
bool IsHighLightNetON () const
 Function IsHighLightNetON. More...
 
void HighLightOFF ()
 Function HighLightOFF Disable highlight. More...
 
void HighLightON ()
 Function HighLightON Enable 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...
 
int GetVisibleElements () const
 Function GetVisibleElements is a proxy function that calls the correspondent function in m_BoardSettings returns a bit-mask of all the element categories that are visible. More...
 
void SetVisibleElements (int 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...
 
void SetDesignSettings (const BOARD_DESIGN_SETTINGS &aDesignSettings)
 Function SetDesignSettings. 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...
 
const PCBNEW_SETTINGSGeneralSettings () const
 
void SetGeneralSettings (PCBNEW_SETTINGS *aSettings)
 
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 given by aLayerName. More...
 
const wxString GetLayerName (PCB_LAYER_ID aLayer) const
 Function GetLayerName returns the name of a layer given by aLayer. 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...
 
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_UNITS aUnits, 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...
 
void Print (PCB_BASE_FRAME *aFrame, wxDC *aDC, const wxPoint &aOffset=ZeroOffset) override
 Function Print. 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...
 
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...
 
ZONE_CONTAINERHitTestForAnyFilledArea (const wxPoint &aRefPos, PCB_LAYER_ID aStartLayer, PCB_LAYER_ID aEndLayer, int aNetCode)
 Function HitTestForAnyFilledArea tests if the given wxPoint is within the bounds of a filled area of this zone. 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_HATCH_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_HATCH_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 ()
 
virtual void Delete (BOARD_ITEM *aItem)
 Removes an item from the container and deletes it. More...
 
const ZONE_SETTINGSGetZoneSettings () const
 Fetch the zone settings for this container. More...
 
void SetZoneSettings (const ZONE_SETTINGS &aSettings)
 Set the zone settings for this container. More...
 
virtual const wxPoint GetCenter () const
 Function GetCenter() More...
 
virtual bool IsConnected () const
 Function IsConnected() Returns information if the object is derived from BOARD_CONNECTED_ITEM. More...
 
virtual bool IsOnCopperLayer () const
 
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...
 
void SetParent (EDA_ITEM *aParent)
 
bool IsNew () const
 
bool IsModified () const
 
bool IsMoving () const
 
bool IsDragging () const
 
bool IsWireImage () const
 
bool IsSelected () const
 
bool IsResized () const
 
bool IsHighlighted () const
 
bool IsBrightened () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetHighlighted ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearHighlighted ()
 
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...
 
virtual bool HitTest (const wxPoint &aPosition, int aAccuracy=0) const
 Function HitTest tests if aPosition is contained within or on the bounding box of an item. More...
 
virtual bool HitTest (const EDA_RECT &aRect, bool aContained, int aAccuracy=0) const
 Function HitTest tests if aRect intersects or is contained within the bounding box of an item. More...
 
virtual EDA_ITEMClone () const
 Function Clone creates a duplicate of this item with linked list members set to NULL. More...
 
virtual BITMAP_DEF GetMenuImage () const
 Function GetMenuImage returns a pointer to an image to be used in menus. More...
 
virtual bool Matches (wxFindReplaceData &aSearchData, void *aAuxData)
 Function Matches compares the item against the search criteria in aSearchData. More...
 
virtual bool Replace (wxFindReplaceData &aSearchData, void *aAuxData=NULL)
 Function Replace performs a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Function IsReplaceable. More...
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
virtual const BOX2I ViewBBox () const override
 Function ViewBBox() returns the bounding box of the item covering all its layers. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Function ViewDraw() Draws the parts of the object belonging to layer aLayer. More...
 
virtual 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 ()
 

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...
 
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 int getNextNumberInSequence (const std::set< int > &aSeq, bool aFillSequenceGaps)
 

Protected Attributes

EDA_ITEMm_Parent
 Linked list: Link (parent struct) More...
 
bool m_forceVisible
 Set to true to override the visibility setting of the item. More...
 
STATUS_FLAGS m_Flags
 Flag bits for editing and other uses. More...
 

Private Member Functions

 BOARD (const BOARD &aOther)=delete
 
BOARDoperator= (const BOARD &aOther)=delete
 

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
 the version loaded from the file More...
 
std::shared_ptr< CONNECTIVITY_DATAm_connectivity
 
BOARD_DESIGN_SETTINGS m_designSettings
 
PCBNEW_SETTINGSm_generalSettings
 reference only; I have no ownership More...
 
PAGE_INFO m_paper
 
TITLE_BLOCK m_titles
 text in lower right of screen and plots More...
 
PCB_PLOT_PARAMS m_plotOptions
 
NETINFO_LIST m_NetInfo
 net info list (name, design constraints .. More...
 

Friends

class PCB_EDIT_FRAME
 

Detailed Description

BOARD holds information pertinent to a Pcbnew printed circuit board.

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

102  :
104  m_paper( PAGE_INFO::A4 ), m_NetInfo( this )
105 {
106  // we have not loaded a board yet, assume latest until then.
107  m_fileFormatVersionAtLoad = LEGACY_BOARD_FILE_VERSION;
108 
110 
111  m_CurrentZoneContour = NULL; // This ZONE_CONTAINER handle the
112  // zone contour currently in progress
113 
114  BuildListOfNets(); // prepare pad and netlist containers.
115 
116  for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
117  {
118  m_Layer[layer].m_name = GetStandardLayerName( ToLAYER_ID( layer ) );
119 
120  if( IsCopperLayer( layer ) )
121  m_Layer[layer].m_type = LT_SIGNAL;
122  else
123  m_Layer[layer].m_type = LT_UNDEFINED;
124  }
125 
126  // Initialize default netclass.
127  NETCLASSPTR defaultClass = m_designSettings.GetDefault();
128  defaultClass->SetDescription( _( "This is the default net class." ) );
129  m_designSettings.SetCurrentNetClass( defaultClass->GetName() );
130 
131  // Set sensible initial values for custom track width & via size
136 
137  // Initialize ratsnest
138  m_connectivity.reset( new CONNECTIVITY_DATA() );
139 }
void BuildListOfNets()
Definition: class_board.h:692
Definition: typeinfo.h:85
static PCBNEW_SETTINGS dummyGeneralSettings
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:108
int GetCurrentTrackWidth() const
Function GetCurrentTrackWidth.
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
PAGE_INFO m_paper
Definition: class_board.h:198
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:109
ZONE_CONTAINER * m_CurrentZoneContour
zone contour currently in progress
Definition: class_board.h:256
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:201
void SetCustomViaSize(int aSize)
Function SetCustomViaSize Sets custom size for via diameter (i.e.
#define NULL
static const wxChar A4[]
Definition: page_info.h:64
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 ...
NETCLASSPTR GetDefault() const
Function GetDefault.
int m_fileFormatVersionAtLoad
the version loaded from the file
Definition: class_board.h:192
#define _(s)
Definition: 3d_actions.cpp:33
LAYER m_Layer[PCB_LAYER_ID_COUNT]
Definition: class_board.h:186
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: class_board.h:194
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
BOARD_DESIGN_SETTINGS m_designSettings
Definition: class_board.h:196
BOARD_ITEM_CONTAINER(BOARD_ITEM *aParent, KICAD_T aType)
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:823
PCBNEW_SETTINGS * m_generalSettings
reference only; I have no ownership
Definition: class_board.h:197
void UseCustomTrackViaSize(bool aEnabled)
Function UseCustomTrackViaSize Enables/disables custom track/via size settings.
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:622

References _, BuildListOfNets(), dummyGeneralSettings, BOARD_DESIGN_SETTINGS::GetCurrentTrackWidth(), BOARD_DESIGN_SETTINGS::GetCurrentViaDrill(), BOARD_DESIGN_SETTINGS::GetCurrentViaSize(), BOARD_DESIGN_SETTINGS::GetDefault(), GetStandardLayerName(), IsCopperLayer(), LT_SIGNAL, LT_UNDEFINED, m_connectivity, m_CurrentZoneContour, m_designSettings, m_fileFormatVersionAtLoad, m_generalSettings, m_Layer, LAYER::m_name, LAYER::m_type, NULL, PCB_LAYER_ID_COUNT, BOARD_DESIGN_SETTINGS::SetCurrentNetClass(), BOARD_DESIGN_SETTINGS::SetCustomTrackWidth(), BOARD_DESIGN_SETTINGS::SetCustomViaDrill(), BOARD_DESIGN_SETTINGS::SetCustomViaSize(), ToLAYER_ID(), and BOARD_DESIGN_SETTINGS::UseCustomTrackViaSize().

◆ ~BOARD()

BOARD::~BOARD ( )

Definition at line 142 of file class_board.cpp.

143 {
144  while( m_ZoneDescriptorList.size() )
145  {
146  ZONE_CONTAINER* area_to_remove = m_ZoneDescriptorList[0];
147  Delete( area_to_remove );
148  }
149 
150  // Clean up the owned elements
151  DeleteMARKERs();
153 
154  // Delete the modules
155  for( auto m : m_modules )
156  delete m;
157 
158  m_modules.clear();
159 
160  // Delete the tracks
161  for( auto t : m_tracks )
162  delete t;
163 
164  m_tracks.clear();
165 
166  // Delete the drawings
167  for (auto d : m_drawings )
168  delete d;
169 
170  m_drawings.clear();
171 
172  delete m_CurrentZoneContour;
174 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:178
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
void DeleteZONEOutlines()
Function DeleteZONEOutlines deletes ALL zone outlines from the board.
ZONE_CONTAINER * m_CurrentZoneContour
zone contour currently in progress
Definition: class_board.h:256
TRACKS m_tracks
TRACKS for traces on the board, owned by pointer.
Definition: class_board.h:181
#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:175
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:184
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 527 of file class_board.cpp.

528 {
529  if( aBoardItem == NULL )
530  {
531  wxFAIL_MSG( wxT( "BOARD::Add() param error: aBoardItem NULL" ) );
532  return;
533  }
534 
535  switch( aBoardItem->Type() )
536  {
537  case PCB_NETINFO_T:
538  m_NetInfo.AppendNet( (NETINFO_ITEM*) aBoardItem );
539  break;
540 
541  // this one uses a vector
542  case PCB_MARKER_T:
543  m_markers.push_back( (MARKER_PCB*) aBoardItem );
544  break;
545 
546  // this one uses a vector
547  case PCB_ZONE_AREA_T:
548  m_ZoneDescriptorList.push_back( (ZONE_CONTAINER*) aBoardItem );
549  break;
550 
551  case PCB_TRACE_T:
552  case PCB_VIA_T:
553  case PCB_ARC_T:
554 
555  // N.B. This inserts a small memory leak as we lose the
556  if( !IsCopperLayer( aBoardItem->GetLayer() ) )
557  {
558  wxFAIL_MSG( wxT( "BOARD::Add() Cannot place Track on non-copper layer" ) );
559  return;
560  }
561 
562  if( aMode == ADD_MODE::APPEND )
563  m_tracks.push_back( static_cast<TRACK*>( aBoardItem ) );
564  else
565  m_tracks.push_front( static_cast<TRACK*>( aBoardItem ) );
566 
567  break;
568 
569  case PCB_MODULE_T:
570  if( aMode == ADD_MODE::APPEND )
571  m_modules.push_back( (MODULE*) aBoardItem );
572  else
573  m_modules.push_front( (MODULE*) aBoardItem );
574 
575  break;
576 
577  case PCB_DIMENSION_T:
578  case PCB_LINE_T:
579  case PCB_TEXT_T:
580  case PCB_TARGET_T:
581  if( aMode == ADD_MODE::APPEND )
582  m_drawings.push_back( aBoardItem );
583  else
584  m_drawings.push_front( aBoardItem );
585 
586  break;
587 
588  // other types may use linked list
589  default:
590  {
591  wxString msg;
592  msg.Printf( wxT( "BOARD::Add() needs work: BOARD_ITEM type (%d) not handled" ),
593  aBoardItem->Type() );
594  wxFAIL_MSG( msg );
595  return;
596  }
597  break;
598  }
599 
600  aBoardItem->SetParent( this );
601  aBoardItem->ClearEditFlags();
602  m_connectivity->Add( aBoardItem );
603 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:178
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
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:213
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
net info list (name, design constraints ..
Definition: class_board.h:201
TRACKS m_tracks
TRACKS for traces on the board, owned by pointer.
Definition: class_board.h:181
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
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:218
MARKERS m_markers
MARKER_PCBs for clearance problems, owned by pointer.
Definition: class_board.h:172
DRAWINGS m_drawings
BOARD_ITEMs for drawings on the board, owned by pointer.
Definition: class_board.h:175
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:184
class NETINFO_ITEM, a description of a net
Definition: typeinfo.h:104
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: class_board.h:194
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:275
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212

References APPEND, NETINFO_LIST::AppendNet(), EDA_ITEM::ClearEditFlags(), ZONE_CONTAINER::GetLayer(), IsCopperLayer(), m_connectivity, m_drawings, m_markers, m_modules, m_NetInfo, m_tracks, m_ZoneDescriptorList, NULL, 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 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(), 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(), PANEL_PREV_3D::PANEL_PREV_3D(), 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_HATCH_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 1567 of file class_board.cpp.

1569 {
1570  ZONE_CONTAINER* new_area = InsertArea( aNetcode,
1571  m_ZoneDescriptorList.size( ) - 1,
1572  aLayer, aStartPointPosition.x,
1573  aStartPointPosition.y, aHatch );
1574 
1575  if( aNewZonesList )
1576  {
1577  ITEM_PICKER picker( new_area, UR_NEW );
1578  aNewZonesList->PushItem( picker );
1579  }
1580 
1581  return new_area;
1582 }
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
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_HATCH_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:184

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

Referenced by NormalizeAreaPolygon().

◆ AllConnectedItems()

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

Definition at line 1745 of file class_board.cpp.

1746 {
1747  std::vector<BOARD_CONNECTED_ITEM*> items;
1748 
1749  for( auto track : Tracks() )
1750  {
1751  items.push_back( track );
1752  }
1753 
1754  for( auto mod : Modules() )
1755  {
1756  for( auto pad : mod->Pads() )
1757  {
1758  items.push_back( pad );
1759  }
1760  }
1761 
1762  for( int i = 0; i<GetAreaCount(); i++ )
1763  {
1764  auto zone = GetArea( i );
1765  items.push_back( zone );
1766  }
1767 
1768  return items;
1769 }
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:919
MODULES & Modules()
Definition: class_board.h:229
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:884
TRACKS & Tracks()
Definition: class_board.h:220

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

724  {
725  return m_NetInfo.begin();
726  }
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:201
iterator begin() const
Definition: netinfo.h:533

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

178 {
179  GetConnectivity()->Build( this );
180 }
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:306

References GetConnectivity().

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

693  {
695  }
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:201
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(), BOARD_NETLIST_UPDATER::deleteSinglePadNets(), FOOTPRINT_EDIT_FRAME::Import_Module(), LoadBoard(), PCB_EDIT_FRAME::OpenProjectFiles(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), and PANEL_SETUP_NETCLASSES::TransferDataToWindow().

◆ ClassOf()

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

Definition at line 211 of file class_board.h.

212  {
213  return aItem && PCB_T == aItem->Type();
214  }
Definition: typeinfo.h:85
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212

References PCB_T, and EDA_ITEM::Type().

◆ ClearAllNetCodes()

void BOARD::ClearAllNetCodes ( )

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

Definition at line 1772 of file class_board.cpp.

1773 {
1774  for( BOARD_CONNECTED_ITEM* item : AllConnectedItems() )
1775  item->SetNetCode( 0 );
1776 }
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

Definition at line 237 of file base_struct.h.

237 { ClearFlags( BRIGHTENED ); }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:143
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:258

References BRIGHTENED, and EDA_ITEM::ClearFlags().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PCB_BASE_FRAME::FocusOnItem(), SCH_BASE_FRAME::FocusOnItem(), EE_SELECTION_TOOL::unhighlight(), SELECTION_TOOL::unhighlight(), and SCH_EDITOR_CONTROL::UpdateNetHighlighting().

◆ ClearEditFlags()

void EDA_ITEM::ClearEditFlags ( )
inlineinherited

◆ ClearFlags()

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

Definition at line 258 of file base_struct.h.

258 { m_Flags &= ~aMask; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189

References EDA_ITEM::m_Flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_COMPONENT::ClearAllHighlightFlags(), SCH_SCREEN::ClearAnnotation(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), EDA_ITEM::ClearHighlighted(), clearModuleItemFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), SCH_EDIT_FRAME::ConvertPart(), LIB_EDIT_TOOL::Copy(), MWAVE::CreateMicrowaveInductor(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), 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(), KIGFX::SCH_VIEW::HighlightItem(), MODULE_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().

◆ ClearHighlighted()

void EDA_ITEM::ClearHighlighted ( )
inlineinherited

Definition at line 236 of file base_struct.h.

236 { ClearFlags( HIGHLIGHTED ); }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:142
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:258

References EDA_ITEM::ClearFlags(), and HIGHLIGHTED.

◆ ClearSelected()

void EDA_ITEM::ClearSelected ( )
inlineinherited

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 270 of file base_struct.h.

271  {
273  }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:117
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: base_struct.h:131
#define CANDIDATE
flag indicating that the structure is connected
Definition: base_struct.h:130
#define ENDPOINT
ends. (Used to support dragging.)
Definition: base_struct.h:126
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:258
#define DO_NOT_DRAW
Used to disable draw function.
Definition: base_struct.h:132
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: base_struct.h:125

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

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 153 of file view_item.h.

154  {
156  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:161
#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, D_PAD, ZONE_CONTAINER, SCH_COMPONENT, MODULE, SCH_SHEET, SCH_HIERLABEL, LIB_PIN, SCH_GLOBALLABEL, VIA, SCH_LABEL, ARC, SCH_TEXT, DRAWSEGMENT, DIMENSION, SCH_LINE, TEXTE_MODULE, TRACK, SCH_SHEET_PIN, SCH_BUS_BUS_ENTRY, SCH_FIELD, LIB_FIELD, SCH_BUS_WIRE_ENTRY, SCH_BITMAP, LIB_ARC, EDGE_MODULE, TEXTE_PCB, SCH_NO_CONNECT, LIB_POLYLINE, SCH_JUNCTION, SCH_MARKER, LIB_TEXT, PCB_TARGET, LIB_BEZIER, LIB_CIRCLE, LIB_RECTANGLE, and KIGFX::ORIGIN_VIEWITEM.

Definition at line 117 of file base_struct.cpp.

118 {
119  wxCHECK_MSG( false, NULL, wxT( "Clone not implemented in derived class " ) + GetClass() +
120  wxT( ". Bad programmer!" ) );
121 }
#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(), 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->GetLayer() != area2->GetLayer() )
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:60
int GetNetCode() const
Function GetNetCode.
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:213
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:265
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...
bool Intersects(const BOX2< Vec > &aRect) const
Function Intersects.
Definition: box2.h:235
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:649
unsigned GetPriority() const
Function GetPriority.
Definition: class_zone.h:100
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:184
const BOX2I BBox(int aClearance=0) const override
Function BBox()
int GetLocalFlags() const
Definition: class_zone.h:259

References SHAPE_POLY_SET::BBox(), CombineAreas(), ZONE_CONTAINER::GetIsKeepout(), ZONE_CONTAINER::GetLayer(), 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 286 of file zones_test_and_combine_areas.cpp.

288 {
289  if( area_ref == area_to_combine )
290  {
291  wxASSERT( 0 );
292  return false;
293  }
294 
295  SHAPE_POLY_SET mergedOutlines = *area_ref->Outline();
296  SHAPE_POLY_SET areaToMergePoly = *area_to_combine->Outline();
297 
298  mergedOutlines.BooleanAdd( areaToMergePoly, SHAPE_POLY_SET::PM_FAST );
299  mergedOutlines.Simplify( SHAPE_POLY_SET::PM_FAST );
300 
301  // We should have one polygon with hole
302  // We can have 2 polygons with hole, if the 2 initial polygons have only one common corner
303  // and therefore cannot be merged (they are dectected as intersecting)
304  // but we should never have more than 2 polys
305  if( mergedOutlines.OutlineCount() > 2 )
306  {
307  wxLogMessage(wxT("BOARD::CombineAreas error: more than 2 polys after merging") );
308  return false;
309  }
310 
311  if( mergedOutlines.OutlineCount() > 1 )
312  return false;
313 
314  // Update the area with the new merged outline
315  delete area_ref->Outline();
316  area_ref->SetOutline( new SHAPE_POLY_SET( mergedOutlines ) );
317 
318  RemoveArea( aDeletedList, area_to_combine );
319 
320  area_ref->SetLocalFlags( 1 );
321  area_ref->Hatch();
322 
323  return true;
324 }
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:265
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:268
SHAPE_POLY_SET.
void Simplify(POLYGON_MODE aFastMode)
Simplifies the polyset (merges overlapping polys, eliminates degeneracy/self-intersections) For aFast...
void Hatch()
Function Hatch computes the hatch lines depending on the hatch parameters and stores it in the zone's...
void SetLocalFlags(int aFlags)
Definition: class_zone.h:260

References SHAPE_POLY_SET::BooleanAdd(), ZONE_CONTAINER::Hatch(), 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 781 of file class_board.cpp.

782 {
783  EDA_RECT area;
784  LSET visible = GetVisibleLayers();
785  bool showInvisibleText = IsElementVisible( LAYER_MOD_TEXT_INVISIBLE )
786  && PgmOrNull() && !PgmOrNull()->m_Printing;
787 
788  // Check segments, dimensions, texts, and fiducials
789  for( auto item : m_drawings )
790  {
791  if( aBoardEdgesOnly && ( item->GetLayer() != Edge_Cuts ) )
792  continue;
793 
794  if( ( item->GetLayerSet() & visible ).any() )
795  area.Merge( item->GetBoundingBox() );
796  }
797 
798  // Check modules
799  for( auto module : m_modules )
800  {
801  if( !( module->GetLayerSet() & visible ).any() )
802  continue;
803 
804  if( aBoardEdgesOnly )
805  {
806  for( const auto edge : module->GraphicalItems() )
807  {
808  if( edge->GetLayer() == Edge_Cuts )
809  area.Merge( edge->GetBoundingBox() );
810  }
811  }
812  else
813  {
814  area.Merge( module->GetBoundingBox( showInvisibleText ) );
815  }
816  }
817 
818  if( !aBoardEdgesOnly )
819  {
820  // Check tracks
821  for( auto track : m_tracks )
822  {
823  if( ( track->GetLayerSet() & visible ).any() )
824  area.Merge( track->GetBoundingBox() );
825  }
826 
827  // Check zones
828  for( auto aZone : m_ZoneDescriptorList )
829  {
830  if( ( aZone->GetLayerSet() & visible ).any() )
831  area.Merge( aZone->GetBoundingBox() );
832  }
833  }
834 
835  return area;
836 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:178
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:181
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:175
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:184
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(), CINFO3D_VISU::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 66 of file board_items_to_polygon_shape_transform.cpp.

67 {
68  // convert tracks and vias:
69  for( auto track : m_tracks )
70  {
71  if( !track->IsOnLayer( aLayer ) )
72  continue;
73 
74  track->TransformShapeWithClearanceToPolygon( aOutlines, 0 );
75  }
76 
77  // convert pads
78  for( auto module : m_modules )
79  {
80  module->TransformPadsShapesWithClearanceToPolygon( aLayer, aOutlines, 0 );
81 
82  // Micro-wave modules may have items on copper layers
83  module->TransformGraphicShapesWithClearanceToPolygonSet( aLayer, aOutlines, 0 );
84  }
85 
86  // convert copper zones
87  for( int ii = 0; ii < GetAreaCount(); ii++ )
88  {
89  ZONE_CONTAINER* zone = GetArea( ii );
90  PCB_LAYER_ID zonelayer = zone->GetLayer();
91 
92  if( zonelayer == aLayer )
93  zone->TransformSolidAreasShapesToPolygonSet( aOutlines );
94  }
95 
96  // convert graphic items on copper layers (texts)
97  for( auto item : m_drawings )
98  {
99  if( !item->IsOnLayer( aLayer ) )
100  continue;
101 
102  switch( item->Type() )
103  {
104  case PCB_LINE_T:
105  ( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon( aOutlines, 0 );
106  break;
107 
108  case PCB_TEXT_T:
109  ( (TEXTE_PCB*) item )->TransformShapeWithClearanceToPolygonSet( aOutlines, 0 );
110  break;
111 
112  default:
113  break;
114  }
115  }
116 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:178
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:213
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:181
PCB_LAYER_ID
A quick note on layer IDs:
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:919
void TransformSolidAreasShapesToPolygonSet(SHAPE_POLY_SET &aCornerBuffer, int aError=ARC_HIGH_DEF) const
Function TransformSolidAreasShapesToPolygonSet Convert solid areas full shapes to polygon set (the fu...
DRAWINGS m_drawings
BOARD_ITEMs for drawings on the board, owned by pointer.
Definition: class_board.h:175
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:884
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:91

References GetArea(), GetAreaCount(), ZONE_CONTAINER::GetLayer(), 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(), DIALOG_DRC::OnDRCItemRClick(), 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 291 of file class_board.h.

292  {
293  for( MODULE* mod : m_modules )
294  delete mod;
295 
296  m_modules.clear();
297  }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:178

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

void BOARD::DeleteMARKERs ( )

Function DeleteMARKERs deletes ALL MARKERS from the board.

Definition at line 690 of file class_board.cpp.

691 {
692  // the vector does not know how to delete the MARKER_PCB, it holds pointers
693  for( MARKER_PCB* marker : m_markers )
694  delete marker;
695 
696  m_markers.clear();
697 }
MARKERS m_markers
MARKER_PCBs for clearance problems, owned by pointer.
Definition: class_board.h:172

References m_markers.

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

◆ DeleteStructure()

void BOARD_ITEM::DeleteStructure ( )
inherited

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

Definition at line 117 of file class_board_item.cpp.

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

References BOARD_ITEM::GetParent().

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

◆ DeleteZONEOutlines()

void BOARD::DeleteZONEOutlines ( )

Function DeleteZONEOutlines deletes ALL zone outlines from the board.

Definition at line 700 of file class_board.cpp.

701 {
702  // the vector does not know how to delete the ZONE Outlines, it holds pointers
703  for( ZONE_CONTAINER* zone : m_ZoneDescriptorList )
704  delete zone;
705 
706  m_ZoneDescriptorList.clear();
707 }
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:184

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

166  {
167  EDA_ITEM* dupe = Clone();
168  const_cast<KIID&>( dupe->m_Uuid ) = KIID();
169 
170  return static_cast<BOARD_ITEM*>( dupe );
171  }
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: common.h:65
const KIID m_Uuid
Definition: base_struct.h:169
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:166

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(), InsertArea(), 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 732 of file class_board.h.

733  {
734  return m_NetInfo.end();
735  }
iterator end() const
Definition: netinfo.h:538
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:201

References NETINFO_LIST::end().

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

1103 {
1104  for( MODULE* module : m_modules )
1105  {
1106  if( module->GetPath() == aPath )
1107  return module;
1108  }
1109 
1110  return nullptr;
1111 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:178

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

1075 {
1076  MODULE* found = nullptr;
1077 
1078  // search only for MODULES
1079  static const KICAD_T scanTypes[] = { PCB_MODULE_T, EOT };
1080 
1081  INSPECTOR_FUNC inspector = [&] ( EDA_ITEM* item, void* testData )
1082  {
1083  MODULE* module = (MODULE*) item;
1084 
1085  if( aReference == module->GetReference() )
1086  {
1087  found = module;
1088  return SEARCH_RESULT::QUIT;
1089  }
1090 
1091  return SEARCH_RESULT::CONTINUE;
1092  };
1093 
1094  // visit this BOARD with the above inspector
1095  BOARD* nonconstMe = (BOARD*) this;
1096  nonconstMe->Visit( inspector, NULL, scanTypes );
1097 
1098  return found;
1099 }
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:83
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:436
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:163
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:166

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 DRC::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 1053 of file class_board.cpp.

1054 {
1055  // the first valid netcode is 1 and the last is m_NetInfo.GetCount()-1.
1056  // zero is reserved for "no connection" and is not actually a net.
1057  // NULL is returned for non valid netcodes
1058 
1059  wxASSERT( m_NetInfo.GetNetCount() > 0 );
1060 
1061  if( aNetcode == NETINFO_LIST::UNCONNECTED && m_NetInfo.GetNetCount() == 0 )
1062  return NETINFO_LIST::OrphanedItem();
1063  else
1064  return m_NetInfo.GetNetItem( aNetcode );
1065 }
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:470
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:201
unsigned GetNetCount() const
Function GetNetCount.
Definition: netinfo.h:435
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:462

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(), PCB_EDIT_FRAME::fixEagleNets(), DSN::SPECCTRA_DB::FromBOARD(), DSN::SPECCTRA_DB::FromSESSION(), DIALOG_SELECT_NET_FROM_LIST::HighlightNet(), PCB_INSPECTION_TOOL::highlightNet(), PNS::SIZES_SETTINGS::Init(), LEGACY_PLUGIN::loadNETINFO_ITEM(), LEGACY_PLUGIN::loadPAD(), MapNets(), PNS_PCBNEW_RULE_RESOLVER::NetName(), NETINFO_MAPPING::iterator::operator *(), PNS_PCBNEW_RULE_RESOLVER::PNS_PCBNEW_RULE_RESOLVER(), SanitizeNetcodes(), BOARD_CONNECTED_ITEM::SetNetCode(), PNS::DIFF_PAIR_PLACER::Start(), SynchronizeNetsAndNetClasses(), 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 1068 of file class_board.cpp.

1069 {
1070  return m_NetInfo.GetNetItem( aNetname );
1071 }
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:201
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, D_PAD, ARC, MODULE, DRAWSEGMENT, DIMENSION, TEXTE_MODULE, MARKER_PCB, TRACK, EDGE_MODULE, PCB_TARGET, and TEXTE_PCB.

Definition at line 276 of file class_board_item.h.

277  {
278  wxMessageBox( wxT( "virtual BOARD_ITEM::Flip used, should not occur" ), GetClass() );
279  }
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 281 of file class_board_item.h.

282  {
283  Flip( wxPoint( aCentre.x, aCentre.y ), aFlipLeftRight );
284  }
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.

◆ GeneralSettings()

const PCBNEW_SETTINGS& BOARD::GeneralSettings ( ) const
inline

Definition at line 538 of file class_board.h.

538 { return *m_generalSettings; }
PCBNEW_SETTINGS * m_generalSettings
reference only; I have no ownership
Definition: class_board.h:197

Referenced by DSN::SPECCTRA_DB::FlipMODULEs(), DSN::SPECCTRA_DB::FromSESSION(), and DSN::SPECCTRA_DB::RevertMODULEs().

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

885  {
886  if( (unsigned) index < m_ZoneDescriptorList.size() )
887  return m_ZoneDescriptorList[index];
888 
889  return NULL;
890  }
#define NULL
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:184

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(), CINFO3D_VISU::createLayers(), PCB_EDIT_FRAME::Edit_Zone_Params(), export_vrml_zones(), DIALOG_COPPER_ZONE::ExportSetupToOtherCopperZones(), PCB_IO::format(), GetZoneList(), SaveCopyOfZones(), SetAreasNetCodesFromNetNames(), SetElementVisibility(), DRC::testZones(), DRC::TestZoneToZoneOutlines(), 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 898 of file class_board.h.

899  {
900  for( int ii = 0; ii < GetAreaCount(); ii++ ) // Search for aArea in list
901  {
902  if( aArea == GetArea( ii ) ) // Found !
903  return ii;
904  }
905 
906  return -1;
907  }
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:919
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:884

◆ GetAuxOrigin()

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

55 {
56  if( Type() == PCB_T )
57  return (BOARD*) this;
58 
59  BOARD_ITEM* parent = GetParent();
60 
61  if( parent )
62  return parent->GetBoard();
63 
64  return NULL;
65 }
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:163
BOARD_ITEM_CONTAINER * GetParent() const
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212

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

Referenced by ZONE_CONTAINER::BuildSmoothedPoly(), DRC::checkClearancePadToPad(), DRC::checkClearanceSegmToPad(), TEXTE_PCB::Flip(), TRACK::Flip(), ARC::Flip(), VIA::Flip(), ZONE_CONTAINER::Flip(), BOARD_ITEM::GetBoard(), MODULE::GetBoundingPoly(), BOARD_CONNECTED_ITEM::GetClearance(), BOARD_ITEM::GetLayerName(), PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), TRACK::GetMsgPanelInfo(), NETINFO_ITEM::GetMsgPanelInfo(), D_PAD::GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase(), VIA::GetMsgPanelInfoBase(), TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), VIA::GetSelectMenuText(), D_PAD::GetSelectMenuText(), D_PAD::GetSolderMaskMargin(), D_PAD::GetSolderPasteMargin(), GetTrackLength(), D_PAD::HitTest(), D_PAD::MergePrimitivesAsPolygon(), EAGLE_PLUGIN::packageWire(), TEXTE_PCB::Print(), PCB_TARGET::Print(), ZONE_CONTAINER::Print(), EDGE_MODULE::Print(), TRACK::Print(), TEXTE_MODULE::Print(), DIMENSION::Print(), DRAWSEGMENT::Print(), VIA::Print(), MODULE::Print(), D_PAD::Print(), ZONE_CONTAINER::PrintFilledArea(), BOARD_CONNECTED_ITEM::SetNet(), BOARD_CONNECTED_ITEM::SetNetCode(), ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon(), ZONE_CONTAINER::TransformSolidAreasShapesToPolygonSet(), MODULE::ViewBBox(), VIA::ViewGetLOD(), 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 767 of file class_board.h.

768  {
769  return ComputeBoundingBox( true );
770  }
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 1684 of file class_board.cpp.

1685 {
1686 
1687  bool success = BuildBoardPolygonOutlines( this, aOutlines, aErrorText,
1688  GetDesignSettings().m_MaxError, aErrorLocation );
1689 
1690  // Make polygon strictly simple to avoid issues (especially in 3D viewer)
1692 
1693  return success;
1694 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:512
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 CINFO3D_VISU::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 755 of file class_board.h.

756  {
757  return ComputeBoundingBox( false );
758  }
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(), and PCB_EDIT_FRAME::OnNetlistChanged().

◆ GetCenter()

virtual const 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 98 of file class_board_item.h.

98 { return GetPosition(); }
virtual const wxPoint GetPosition() const =0

References BOARD_ITEM::GetPosition().

Referenced by ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), KIGFX::PCB_PAINTER::draw(), and PNS_KICAD_IFACE_BASE::syncArc().

◆ GetClass()

wxString BOARD::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Implements EDA_ITEM.

Definition at line 836 of file class_board.h.

837  {
838  return wxT( "BOARD" );
839  }

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

307  {
308  return m_connectivity;
309  }
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: class_board.h:194

Referenced by BuildConnectivity(), DIALOG_SELECT_NET_FROM_LIST::buildNetsList(), BOARD_NETLIST_UPDATER::cacheCopperZoneConnections(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), TRACKS_CLEANER::cleanupSegments(), TRACKS_CLEANER::cleanupVias(), PCB_BASE_FRAME::Compile_Ratsnest(), 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(), TRACKS_CLEANER::removeBadTrackSegments(), BOARD_COMMIT::Revert(), AR_AUTOPLACER::rotateModule(), SELECTION_TOOL::selectAllItemsOnNet(), SELECTION_TOOL::selectConnectedTracks(), PCB_EDIT_FRAME::SetBoard(), TRACKS_CLEANER::testTrackEndpointDangling(), TRACKS_CLEANER::testTrackEndpointIsNode(), 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 403 of file class_board.cpp.

404 {
406 }
BOARD_DESIGN_SETTINGS m_designSettings
Definition: class_board.h:196
int GetCopperLayerCount() const
Function GetCopperLayerCount.

References BOARD_DESIGN_SETTINGS::GetCopperLayerCount(), and m_designSettings.

Referenced by GERBER_JOBFILE_WRITER::addJSONDesignRules(), GERBER_JOBFILE_WRITER::addJSONFilesAttributes(), GERBER_JOBFILE_WRITER::addJSONGeneralSpecs(), GERBER_JOBFILE_WRITER::addJSONMaterialStackup(), PCBNEW_CONTROL::AppendBoard(), GENDRILL_WRITER_BASE::BuildFileFunctionAttributeString(), DSN::SPECCTRA_DB::buildLayerMaps(), compute_layer_Zs(), compute_pad_access_code(), CreateComponentsSection(), CreatePadsShapesSection(), PLACEFILE_GERBER_WRITER::CreatePlaceFile(), CreateRoutesSection(), DIALOG_SWAP_LAYERS::DIALOG_SWAP_LAYERS(), DRAWING_TOOL::DrawVia(), TEXTE_PCB::Flip(), TRACK::Flip(), ARC::Flip(), VIA::Flip(), ZONE_CONTAINER::Flip(), DSN::SPECCTRA_DB::FromBOARD(), GetGerberFileFunctionAttribute(), CINFO3D_VISU::InitSettings(), EAGLE_PLUGIN::Load(), DSN::SPECCTRA_DB::makeIMAGE(), DSN::SPECCTRA_DB::makePADSTACK(), DSN::SPECCTRA_DB::makeVIA(), VIA::Print(), PARAM_CFG_LAYERS::SaveParam(), 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 512 of file class_board.h.

513  {
514  // remove const-ness with cast. TODO(snh): Make GetDesignSettings const
515  return const_cast<BOARD_DESIGN_SETTINGS&>( m_designSettings );
516  }
BOARD_DESIGN_SETTINGS m_designSettings
Definition: class_board.h:196

Referenced by GERBER_JOBFILE_WRITER::addJSONDesignRules(), GERBER_JOBFILE_WRITER::addJSONGeneralSpecs(), GERBER_JOBFILE_WRITER::addJSONMaterialStackup(), ZONE_FILLER::buildCopperItemClearances(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildFilterLists(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildNetclassesGrid(), ZONE_FILLER::buildThermalSpokes(), EDIT_TOOL::ChangeTrackWidth(), DRC::checkClearancePadToPad(), DRC::checkClearanceSegmToPad(), PNS_PCBNEW_RULE_RESOLVER::CollideHoles(), compute_layer_Zs(), ZONE_FILLER::computeRawFilledArea(), DRAWING_TOOL::constrainDimension(), MICROWAVE_TOOL::createInductorBetween(), CreatePadsShapesSection(), CreateRoutesSection(), ROUTER_TOOL::CustomTrackWidthDialog(), DIALOG_DRC::DIALOG_DRC(), DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME(), DRC::doNetClass(), DRC::doTrackDrc(), ROUTER_TOOL::DpDimensionsDialog(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawVia(), TRACK_WIDTH_MENU::eventHandler(), DIFF_PAIR_MENU::eventHandler(), EVT_GRID_CMD_CELL_CHANGED(), PCB_EDIT_FRAME::Export_IDF3(), ZONE_FILLER::Fill(), FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), PCB_IO::formatGeneral(), PCB_IO::formatNetInformation(), PCB_IO::formatSetup(), DSN::SPECCTRA_DB::FromBOARD(), DSN::SPECCTRA_DB::FromSESSION(), GetBoardPolygonOutlines(), MODULE::GetBoundingPoly(), BOARD_CONNECTED_ITEM::GetClearance(), MARKER_PCB::GetColorLayer(), BOARD_DRC_ITEMS_PROVIDER::GetCount(), VECTOR_DRC_ITEMS_PROVIDER::GetCount(), FOOTPRINT_EDIT_FRAME::GetDesignSettings(), PCB_BASE_FRAME::GetDesignSettings(), BOARD_CONNECTED_ITEM::GetNetClass(), PCB_EDIT_FRAME::GetProjectFileParameters(), DRAWING_TOOL::getSegmentWidth(), PCB_EDIT_FRAME::GetSeverity(), D_PAD::GetSolderMaskMargin(), 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(), PANEL_SETUP_NETCLASSES::ImportSettingsFrom(), PNS::SIZES_SETTINGS::Init(), DIALOG_PLOT::init_Dialog(), CINFO3D_VISU::InitSettings(), CINFO3D_VISU::Is3DLayerEnabled(), EAGLE_PLUGIN::Load(), LEGACY_PLUGIN::loadGENERAL(), LEGACY_PLUGIN::loadNETCLASS(), EAGLE_PLUGIN::loadPlain(), LEGACY_PLUGIN::loadSETUP(), DSN::SPECCTRA_DB::makePADSTACK(), NETINFO_ITEM::NETINFO_ITEM(), DIALOG_DRC::OnActivateDlg(), DIALOG_PAD_PROPERTIES::onAddPrimitive(), DIALOG_BOARD_SETUP::OnAuxiliaryAction(), ROUTER_TOOL::onViaCommand(), PCB_EDIT_FRAME::OpenProjectFiles(), 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_NETCLASSES::PANEL_SETUP_NETCLASSES(), PANEL_SETUP_TEXT_AND_GRAPHICS::PANEL_SETUP_TEXT_AND_GRAPHICS(), PANEL_SETUP_TRACKS_AND_VIAS::PANEL_SETUP_TRACKS_AND_VIAS(), PCB_EDITOR_CONTROL::PlaceTarget(), PlotOneBoardLayer(), BRDITEMS_PLOTTER::PlotPad(), PlotSolderMaskLayer(), PlotStandardLayer(), PNS_PCBNEW_RULE_RESOLVER::PNS_PCBNEW_RULE_RESOLVER(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), PARAM_CFG_SEVERITIES::ReadParam(), PARAM_CFG_LAYERS::ReadParam(), PCB_LAYER_WIDGET::ReFillRender(), DRC_COURTYARD_OVERLAP::RunDRC(), DRC::RunTests(), SaveBoard(), PARAM_CFG_SEVERITIES::SaveParam(), PARAM_CFG_LAYERS::SaveParam(), NETINFO_ITEM::SetClass(), BOARD_DRC_ITEMS_PROVIDER::SetSeverities(), VECTOR_DRC_ITEMS_PROVIDER::SetSeverities(), PNS::DIFF_PAIR_PLACER::Start(), EDA_3D_VIEWER::SynchroniseColoursWithBoard(), PNS_KICAD_IFACE_BASE::SyncWorld(), DRC::testDrilledHoles(), DRC::testNetClasses(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon(), TRACK_WIDTH_MENU::update(), DIFF_PAIR_MENU::update(), POINT_EDITOR::updateItem(), MODULE::ViewBBox(), MARKER_PCB::ViewGetLayers(), and HYPERLYNX_EXPORTER::writeStackupInfo().

◆ GetEditFlags()

STATUS_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 262 of file base_struct.h.

263  {
267  return m_Flags & mask;
268  }
#define TEMP_SELECTED
flag indicating that the structure has already selected
Definition: base_struct.h:128
#define END_ONPAD
Pcbnew: flag set for track segment ending on a pad.
Definition: base_struct.h:139
#define BEGIN_ONPAD
Pcbnew: flag set for track segment starting on a pad.
Definition: base_struct.h:138
#define EDA_ITEM_ALL_FLAGS
Definition: base_struct.h:157
#define SELECTED
Definition: base_struct.h:127
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:143
#define DP_COUPLED
item is coupled with another item making a differential pair
Definition: base_struct.h:145
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:142
#define IS_DANGLING
indicates a pin is dangling
Definition: base_struct.h:149
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
#define ENDPOINT
ends. (Used to support dragging.)
Definition: base_struct.h:126
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: base_struct.h:125

References BEGIN_ONPAD, BRIGHTENED, DP_COUPLED, EDA_ITEM_ALL_FLAGS, END_ONPAD, ENDPOINT, HIGHLIGHTED, IS_DANGLING, EDA_ITEM::m_Flags, SELECTED, STARTPOINT, and TEMP_SELECTED.

Referenced by SCH_EDIT_TOOL::ChangeShape(), EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::ConvertTextType(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_TOOL::editFieldText(), SCH_EDITOR_CONTROL::EditWithLibEdit(), LIB_MOVE_TOOL::Main(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_EDIT_PIN::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().

◆ GetEnabledLayers()

LSET BOARD::GetEnabledLayers ( ) const

◆ GetFileFormatVersionAtLoad()

int BOARD::GetFileFormatVersionAtLoad ( ) const
inline

Definition at line 273 of file class_board.h.

273 { return m_fileFormatVersionAtLoad; }
int m_fileFormatVersionAtLoad
the version loaded from the file
Definition: class_board.h:192

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ GetFileName()

const wxString& BOARD::GetFileName ( ) const
inline

Definition at line 218 of file class_board.h.

218 { return m_fileName; }
wxString m_fileName
the board filename
Definition: class_board.h:169

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(), GENDRILL_WRITER_BASE::getDrillFileName(), PCB_EDIT_FRAME::GetLastPath(), PCB_EDITOR_CONTROL::ImportSpecctraSession(), 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(), 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 283 of file class_board.h.

284  {
285  return m_modules.empty() ? nullptr : m_modules.front();
286  }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:178

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), MODULE_EDITOR_TOOLS::CutCopyFootprint(), PCBNEW_CONTROL::DeleteItemCursor(), DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX(), EDIT_TOOL::Duplicate(), MODULE_EDITOR_TOOLS::ExportFootprint(), FOOTPRINT_EDIT_FRAME::GetDocumentExtents(), FOOTPRINT_EDIT_FRAME::GetLoadedFPID(), FOOTPRINT_EDIT_FRAME::GetModel(), FP_TREE_SYNCHRONIZING_ADAPTER::GetValue(), MODULE_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_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(), MODULE_EDITOR_TOOLS::PlacePad(), Print(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), MODULE_EDITOR_TOOLS::Properties(), FOOTPRINT_EDIT_FRAME::ReCreateMenuBar(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), DISPLAY_FOOTPRINTS_FRAME::UpdateMsgPanel(), and FOOTPRINT_WIZARD_FRAME::UpdateMsgPanel().

◆ GetFlags()

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

1478 {
1479  MODULE* module = NULL;
1480  MODULE* alt_module = NULL;
1481  int min_dim = 0x7FFFFFFF;
1482  int alt_min_dim = 0x7FFFFFFF;
1483  bool current_layer_back = IsBackLayer( aActiveLayer );
1484 
1485  for( auto pt_module : m_modules )
1486  {
1487  // is the ref point within the module's bounds?
1488  if( !pt_module->HitTest( aPosition ) )
1489  continue;
1490 
1491  // if caller wants to ignore locked modules, and this one is locked, skip it.
1492  if( aIgnoreLocked && pt_module->IsLocked() )
1493  continue;
1494 
1495  PCB_LAYER_ID layer = pt_module->GetLayer();
1496 
1497  // Filter non visible modules if requested
1498  if( !aVisibleOnly || IsModuleLayerVisible( layer ) )
1499  {
1500  EDA_RECT bb = pt_module->GetFootprintRect();
1501 
1502  int offx = bb.GetX() + bb.GetWidth() / 2;
1503  int offy = bb.GetY() + bb.GetHeight() / 2;
1504 
1505  // off x & offy point to the middle of the box.
1506  int dist = ( aPosition.x - offx ) * ( aPosition.x - offx ) +
1507  ( aPosition.y - offy ) * ( aPosition.y - offy );
1508 
1509  if( current_layer_back == IsBackLayer( layer ) )
1510  {
1511  if( dist <= min_dim )
1512  {
1513  // better footprint shown on the active side
1514  module = pt_module;
1515  min_dim = dist;
1516  }
1517  }
1518  else if( aVisibleOnly && IsModuleLayerVisible( layer ) )
1519  {
1520  if( dist <= alt_min_dim )
1521  {
1522  // better footprint shown on the other side
1523  alt_module = pt_module;
1524  alt_min_dim = dist;
1525  }
1526  }
1527  }
1528  }
1529 
1530  if( module )
1531  {
1532  return module;
1533  }
1534 
1535  if( alt_module)
1536  {
1537  return alt_module;
1538  }
1539 
1540  return NULL;
1541 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:178
static const int dist[10][10]
Definition: ar_matrix.cpp:326
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 dist, EDA_RECT::GetHeight(), EDA_RECT::GetWidth(), EDA_RECT::GetX(), EDA_RECT::GetY(), IsBackLayer(), IsModuleLayerVisible(), m_modules, NULL, wxPoint::x, and wxPoint::y.

◆ GetGridOrigin()

const wxPoint& BOARD::GetGridOrigin ( ) const
inline

◆ GetHighLightNetCode()

int BOARD::GetHighLightNetCode ( ) const
inline

Function GetHighLightNetCode.

Returns
netcode of net to highlight (-1 when no net selected)

Definition at line 358 of file class_board.h.

358 { return m_highLight.m_netCode; }
HIGH_LIGHT_INFO m_highLight
Definition: class_board.h:189

References HIGH_LIGHT_INFO::m_netCode.

Referenced by DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildFilterLists().

◆ GetItem()

BOARD_ITEM * BOARD::GetItem ( const KIID aID)

Definition at line 710 of file class_board.cpp.

711 {
712  if( aID == niluuid )
713  return nullptr;
714 
715  for( TRACK* track : Tracks() )
716  if( track->m_Uuid == aID )
717  return track;
718 
719  for( MODULE* module : Modules() )
720  {
721  if( module->m_Uuid == aID )
722  return module;
723 
724  for( D_PAD* pad : module->Pads() )
725  if( pad->m_Uuid == aID )
726  return pad;
727 
728  if( module->Reference().m_Uuid == aID )
729  return &module->Reference();
730 
731  if( module->Value().m_Uuid == aID )
732  return &module->Value();
733 
734  for( BOARD_ITEM* drawing : module->GraphicalItems() )
735  if( drawing->m_Uuid == aID )
736  return drawing;
737  }
738 
739  for( ZONE_CONTAINER* zone : Zones() )
740  if( zone->m_Uuid == aID )
741  return zone;
742 
743  for( BOARD_ITEM* drawing : Drawings() )
744  if( drawing->m_Uuid == aID )
745  return drawing;
746 
747  for( MARKER_PCB* marker : m_markers )
748  if( marker->m_Uuid == aID )
749  return marker;
750 
751  // Not found; weak reference has been deleted.
752  if( !g_DeletedItem )
754 
755  return g_DeletedItem;
756 }
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
A singleton item of this class is returned for a weak reference that no longer exists.
Definition: class_board.cpp:61
MODULES & Modules()
Definition: class_board.h:229
KIID niluuid(0)
MARKERS m_markers
MARKER_PCBs for clearance problems, owned by pointer.
Definition: class_board.h:172
ZONE_CONTAINERS & Zones()
Definition: class_board.h:243
DELETED_BOARD_ITEM * g_DeletedItem
Definition: class_board.cpp:88
DRAWINGS & Drawings()
Definition: class_board.h:238
TRACKS & Tracks()
Definition: class_board.h:220

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

Referenced by CollisionMatchesExpected(), PCB_BASE_FRAME::FocusOnItem(), InvalidMatchesExpected(), DIALOG_DRC::OnDRCItemSelected(), and DIALOG_CLEANUP_TRACKS_AND_VIAS::OnSelectItem().

◆ GetLayer()

virtual PCB_LAYER_ID BOARD_ITEM::GetLayer ( ) const
inlinevirtualinherited

Function GetLayer returns the primary layer this item is on.

Reimplemented in ZONE_CONTAINER.

Definition at line 131 of file class_board_item.h.

131 { return m_Layer; }
PCB_LAYER_ID m_Layer

References BOARD_ITEM::m_Layer.

Referenced by CN_LIST::Add(), CINFO3D_VISU::AddGraphicsShapesWithClearanceToContainer(), DIMENSION::AdjustDimensionDetails(), AR_AUTOPLACER::buildFpAreas(), CreateBoardSection(), MWAVE::CreateMicrowaveInductor(), CreateRoutesSection(), DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), 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(), TEXTE_PCB::Flip(), PCB_TARGET::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(), ZONE_CONTAINER::GetLayer(), 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(), DIALOG_FOOTPRINT_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAddField(), EAGLE_PLUGIN::packagePad(), BRDITEMS_PLOTTER::Plot_1_EdgeModule(), BRDITEMS_PLOTTER::Plot_Edges_Modules(), BRDITEMS_PLOTTER::PlotAllTextsModule(), BRDITEMS_PLOTTER::PlotDimension(), BRDITEMS_PLOTTER::PlotDrawSegment(), BRDITEMS_PLOTTER::PlotPcbTarget(), BRDITEMS_PLOTTER::PlotTextePcb(), TEXTE_MODULE::Print(), DRAWSEGMENT::Print(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), processTextItem(), SELECTION_TOOL::Selectable(), TEXT_MOD_GRID_TABLE::SetValueAsLong(), ShowClearance(), GLOBAL_EDIT_TOOL::swapBoardItem(), PNS_KICAD_IFACE_BASE::syncArc(), PNS_KICAD_IFACE_BASE::syncGraphicalItem(), PNS_KICAD_IFACE_BASE::syncTrack(), DRC::testCopperDrawItem(), DRC::testCopperTextAndGraphics(), DRC::testCopperTextItem(), DRC::testDisabledLayers(), AR_AUTOPLACER::testModuleOnBoard(), TEXTE_MODULE::TEXTE_MODULE(), AR_MATRIX::TraceSegmentPcb(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), CINFO3D_VISU::transformGraphicModuleEdgeToPolygonSet(), MODULE::TransformGraphicShapesWithClearanceToPolygonSet(), MODULE::TransformGraphicTextWithClearanceToPolygonSet(), 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 given by aLayerName.

Copper layers may have custom names.

Parameters
aLayerName= A layer name, like wxT("B.Cu"), etc.
Returns
PCB_LAYER_ID - the layer id, which for copper layers may be custom, else standard.

Definition at line 262 of file class_board.cpp.

263 {
264 
265  // Look for the BOARD specific copper layer names
266  for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
267  {
268  if ( IsCopperLayer( layer ) && ( m_Layer[ layer ].m_name == aLayerName ) )
269  {
270  return ToLAYER_ID( layer );
271  }
272  }
273 
274  // Otherwise fall back to the system standard layer names
275  for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
276  {
277  if( GetStandardLayerName( ToLAYER_ID( layer ) ) == aLayerName )
278  {
279  return ToLAYER_ID( layer );
280  }
281  }
282 
283  return UNDEFINED_LAYER;
284 }
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
LAYER m_Layer[PCB_LAYER_ID_COUNT]
Definition: class_board.h:186
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:823
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:622

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

69 {
70  BOARD* board = GetBoard();
71 
72  if( board )
73  return board->GetLayerName( m_Layer );
74 
75  // If no parent, return standard name
77 }
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer given by aLayer.
PCB_LAYER_ID m_Layer
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:163
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:622

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

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

◆ GetLayerName() [2/2]

wxString BOARD::GetLayerName ( PCB_LAYER_ID  aLayer) const

Function GetLayerName returns the name of a layer given by aLayer.

Copper layers may have custom names.

Parameters
aLayer= A layer, like B_Cu, etc.
Returns
wxString - the layer name, which for copper layers may be custom, else standard.

Definition at line 286 of file class_board.cpp.

287 {
288  // All layer names are stored in the BOARD.
289  if( IsLayerEnabled( aLayer ) )
290  {
291  // Standard names were set in BOARD::BOARD() but they may be
292  // over-ridden by BOARD::SetLayerName().
293  // For copper layers, return the actual copper layer name,
294  // otherwise return the Standard English layer name.
295  if( IsCopperLayer( aLayer ) )
296  return m_Layer[aLayer].m_name;
297  }
298 
299  return GetStandardLayerName( aLayer );
300 }
wxString m_name
The name of the layer, there should be no spaces in this name.
Definition: class_board.h:108
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:419
LAYER m_Layer[PCB_LAYER_ID_COUNT]
Definition: class_board.h:186
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:622

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(), 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(), TRACK::GetMsgPanelInfoBase(), VIA::GetMsgPanelInfoBase(), VIA::GetSelectMenuText(), GRID_CELL_LAYER_SELECTOR::GetValue(), DIALOG_PLOT::init_Dialog(), DIALOG_EXPORT_SVG::initDialog(), DIALOG_PAD_PROPERTIES::initValues(), LayerMaskDescribe(), DIALOG_PLOT::Plot(), PCB_LAYER_WIDGET::ReFill(), PARAM_CFG_LAYERS::SaveParam(), 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 D_PAD, VIA, and ZONE_CONTAINER.

Definition at line 139 of file class_board_item.h.

139 { 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(), DRC::doTrackDrc(), DRAWING_TOOL::DrawVia(), hash_board_item(), and POINT_EDITOR::OnSelectionChange().

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

330 {
331  if( !IsCopperLayer( aLayer ) )
332  return LT_SIGNAL;
333 
334  //@@IMB: The original test was broken due to the discontinuity
335  // in the layer sequence.
336  if( IsLayerEnabled( aLayer ) )
337  return m_Layer[aLayer].m_type;
338 
339  return LT_SIGNAL;
340 }
LAYER_T m_type
The type of the layer.
Definition: class_board.h:109
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:419
LAYER m_Layer[PCB_LAYER_ID_COUNT]
Definition: class_board.h:186
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(), PARAM_CFG_LAYERS::SaveParam(), 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 D_PAD, ZONE_CONTAINER, SCH_COMPONENT, MODULE, SCH_SHEET, SCH_HIERLABEL, LIB_PIN, SCH_GLOBALLABEL, VIA, SCH_LABEL, SCH_TEXT, GERBER_DRAW_ITEM, DRAWSEGMENT, DIMENSION, TEXTE_MODULE, TRACK, SCH_BUS_BUS_ENTRY, SCH_LINE, SCH_SHEET_PIN, LIB_FIELD, SCH_FIELD, SCH_BUS_WIRE_ENTRY, MARKER_PCB, LIB_ARC, SCH_BITMAP, EDGE_MODULE, TEXTE_PCB, LIB_POLYLINE, SCH_NO_CONNECT, LIB_TEXT, PCB_TARGET, SCH_MARKER, LIB_CIRCLE, SCH_JUNCTION, and LIB_RECTANGLE.

Definition at line 242 of file base_struct.cpp.

243 {
244  return dummy_xpm;
245 }
static const BITMAP_OPAQUE dummy_xpm[1]
Definition: base_struct.cpp:54

References dummy_xpm.

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

◆ GetMsgPanelInfo()

void BOARD::GetMsgPanelInfo ( EDA_UNITS  aUnits,
std::vector< MSG_PANEL_ITEM > &  aList 
)
overridevirtual

Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.

Note
This method replaces DisplayInfo() so that KiCad objects no longer have any knowledge of wxWidgets UI objects.
Parameters
aListis the list to populate.

Reimplemented from EDA_ITEM.

Definition at line 839 of file class_board.cpp.

840 {
841  wxString txt;
842  int viasCount = 0;
843  int trackSegmentsCount = 0;
844 
845  for( auto item : m_tracks )
846  {
847  if( item->Type() == PCB_VIA_T )
848  viasCount++;
849  else
850  trackSegmentsCount++;
851  }
852 
853  txt.Printf( wxT( "%d" ), GetPadCount() );
854  aList.emplace_back( _( "Pads" ), txt, DARKGREEN );
855 
856  txt.Printf( wxT( "%d" ), viasCount );
857  aList.emplace_back( _( "Vias" ), txt, DARKGREEN );
858 
859  txt.Printf( wxT( "%d" ), trackSegmentsCount );
860  aList.emplace_back( _( "Track Segments" ), txt, DARKGREEN );
861 
862  txt.Printf( wxT( "%d" ), GetNodesCount() );
863  aList.emplace_back( _( "Nodes" ), txt, DARKCYAN );
864 
865  txt.Printf( wxT( "%d" ), m_NetInfo.GetNetCount() - 1 /* Don't include "No Net" in count */ );
866  aList.emplace_back( _( "Nets" ), txt, RED );
867 
868  txt.Printf( wxT( "%d" ), GetConnectivity()->GetUnconnectedCount() );
869  aList.emplace_back( _( "Unrouted" ), txt, BLUE );
870 }
Definition: colors.h:57
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:201
TRACKS m_tracks
TRACKS for traces on the board, owned by pointer.
Definition: class_board.h:181
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:306
Definition: colors.h:60
unsigned GetPadCount()
Function GetPadCount.
#define _(s)
Definition: 3d_actions.cpp:33
unsigned GetNetCount() const
Function GetNetCount.
Definition: netinfo.h:435
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.

◆ GetNetCount()

unsigned BOARD::GetNetCount ( ) const
inline

Function GetNetCount.

Returns
the number of nets (NETINFO_ITEM)

Definition at line 742 of file class_board.h.

743  {
744  return m_NetInfo.GetNetCount();
745  }
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:201
unsigned GetNetCount() const
Function GetNetCount.
Definition: netinfo.h:435

References NETINFO_LIST::GetNetCount().

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

◆ GetNetInfo()

◆ getNextNumberInSequence()

int BOARD_ITEM::getNextNumberInSequence ( const std::set< int > &  aSeq,
bool  aFillSequenceGaps 
)
staticprotectedinherited

Definition at line 88 of file class_board_item.cpp.

89 {
90  if( aSeq.empty() )
91  return 1;
92 
93  // By default go to the end of the sequence
94  int candidate = *aSeq.rbegin();
95 
96  // Filling in gaps in pad numbering
97  if( aFillSequenceGaps )
98  {
99  // start at the beginning
100  candidate = *aSeq.begin();
101 
102  for( auto it : aSeq )
103  {
104  if( it - candidate > 1 )
105  break;
106 
107  candidate = it;
108  }
109  }
110 
111  ++candidate;
112 
113  return candidate;
114 }

Referenced by MODULE::GetNextPadName().

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

760 {
761  unsigned retval = 0;
762  for( auto mod : Modules() )
763  {
764  for( auto pad : mod->Pads() )
765  {
766  if( ( aNet == -1 && pad->GetNetCode() > 0 ) || aNet == pad->GetNetCode() )
767  retval++;
768  }
769  }
770 
771  return retval;
772 }
MODULES & Modules()
Definition: class_board.h:229

References Modules().

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

◆ GetPad() [1/5]

D_PAD * BOARD::GetPad ( unsigned  aIndex) const

Function GetPad.

Returns
D_PAD* - at the aIndex

Definition at line 1726 of file class_board.cpp.

1727 {
1728  unsigned count = 0;
1729 
1730  for( auto mod : m_modules )
1731  {
1732  for( auto pad : mod->Pads() )
1733  {
1734  if( count == aIndex )
1735  return pad;
1736 
1737  count++;
1738  }
1739  }
1740 
1741  return nullptr;
1742 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:178

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

1256 {
1257  if( !aLayerSet.any() )
1258  aLayerSet = LSET::AllCuMask();
1259 
1260  for( auto module : m_modules )
1261  {
1262  D_PAD* pad = NULL;
1263 
1264  if( module->HitTest( aPosition ) )
1265  pad = module->GetPad( aPosition, aLayerSet );
1266 
1267  if( pad )
1268  return pad;
1269  }
1270 
1271  return NULL;
1272 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:178
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:686
#define NULL

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

◆ GetPad() [3/5]

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

Definition at line 1041 of file class_board.h.

1042  {
1043  return GetPad( aPosition, LSET().set() );
1044  }
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 1275 of file class_board.cpp.

1276 {
1277  const wxPoint& aPosition = aTrace->GetEndPoint( aEndPoint );
1278 
1279  LSET lset( aTrace->GetLayer() );
1280 
1281  return GetPad( aPosition, lset );
1282 }
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:115
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 1304 of file class_board.cpp.

1305 {
1306  // Search aPadList for aPosition
1307  // aPadList is sorted by X then Y values, and a fast binary search is used
1308  int idxmax = aPadList.size()-1;
1309 
1310  int delta = aPadList.size();
1311 
1312  int idx = 0; // Starting index is the beginning of list
1313 
1314  while( delta )
1315  {
1316  // Calculate half size of remaining interval to test.
1317  // Ensure the computed value is not truncated (too small)
1318  if( (delta & 1) && ( delta > 1 ) )
1319  delta++;
1320 
1321  delta /= 2;
1322 
1323  D_PAD* pad = aPadList[idx];
1324 
1325  if( pad->GetPosition() == aPosition ) // candidate found
1326  {
1327  // The pad must match the layer mask:
1328  if( ( aLayerSet & pad->GetLayerSet() ).any() )
1329  return pad;
1330 
1331  // More than one pad can be at aPosition
1332  // search for a pad at aPosition that matched this mask
1333 
1334  // search next
1335  for( int ii = idx+1; ii <= idxmax; ii++ )
1336  {
1337  pad = aPadList[ii];
1338 
1339  if( pad->GetPosition() != aPosition )
1340  break;
1341 
1342  if( ( aLayerSet & pad->GetLayerSet() ).any() )
1343  return pad;
1344  }
1345  // search previous
1346  for( int ii = idx-1 ;ii >=0; ii-- )
1347  {
1348  pad = aPadList[ii];
1349 
1350  if( pad->GetPosition() != aPosition )
1351  break;
1352 
1353  if( ( aLayerSet & pad->GetLayerSet() ).any() )
1354  return pad;
1355  }
1356 
1357  // Not found:
1358  return 0;
1359  }
1360 
1361  if( pad->GetPosition().x == aPosition.x ) // Must search considering Y coordinate
1362  {
1363  if( pad->GetPosition().y < aPosition.y ) // Must search after this item
1364  {
1365  idx += delta;
1366 
1367  if( idx > idxmax )
1368  idx = idxmax;
1369  }
1370  else // Must search before this item
1371  {
1372  idx -= delta;
1373 
1374  if( idx < 0 )
1375  idx = 0;
1376  }
1377  }
1378  else if( pad->GetPosition().x < aPosition.x ) // Must search after this item
1379  {
1380  idx += delta;
1381 
1382  if( idx > idxmax )
1383  idx = idxmax;
1384  }
1385  else // Must search before this item
1386  {
1387  idx -= delta;
1388 
1389  if( idx < 0 )
1390  idx = 0;
1391  }
1392  }
1393 
1394  return NULL;
1395 }
#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:446
const wxPoint GetPosition() const override
Definition: class_pad.h:241

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

1712 {
1713  unsigned retval = 0;
1714 
1715  for( auto mod : Modules() )
1716  retval += mod->Pads().size();
1717 
1718  return retval;
1719 }
MODULES & Modules()
Definition: class_board.h:229

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

1286 {
1287  for( auto mod : Modules() )
1288  {
1289  for ( auto pad : mod->Pads() )
1290  {
1291  if( pad->GetPosition() != aPosition )
1292  continue;
1293 
1294  // Pad found, it must be on the correct layer
1295  if( ( pad->GetLayerSet() & aLayerSet ).any() )
1296  return pad;
1297  }
1298  }
1299 
1300  return nullptr;
1301 }
MODULES & Modules()
Definition: class_board.h:229

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

1698 {
1699  std::vector<D_PAD*> allPads;
1700 
1701  for( MODULE* mod : Modules() )
1702  {
1703  for( D_PAD* pad : mod->Pads() )
1704  allPads.push_back( pad );
1705  }
1706 
1707  return allPads;
1708 }
MODULES & Modules()
Definition: class_board.h:229

References Modules().

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

◆ GetPageSettings()

◆ GetParent()

BOARD_ITEM_CONTAINER* BOARD_ITEM::GetParent ( void  ) const
inlineinherited

Definition at line 125 of file class_board_item.h.

125 { return (BOARD_ITEM_CONTAINER*) m_Parent; }
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:183
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_MODULE::GetShownText(), SELECTION_TOOL::GuessSelectionCandidates(), GENERAL_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), EDGE_MODULE::IsParentFlipped(), TEXTE_MODULE::IsParentFlipped(), LEGACY_PLUGIN::loadMODULE_TEXT(), BRDITEMS_PLOTTER::Plot_1_EdgeModule(), BRDITEMS_PLOTTER::PlotTextModule(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), SELECTION_TOOL::select(), SELECTION_TOOL::Selectable(), SwapItemData(), 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()

const wxPoint BOARD::GetPosition ( ) const
overridevirtual

Implements BOARD_ITEM.

Definition at line 183 of file class_board.cpp.

184 {
185  return ZeroOffset;
186 }
static wxPoint ZeroOffset
A value of wxPoint(0,0) which can be passed to the Draw() functions.

References BOARD_ITEM::ZeroOffset.

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

685 {
686  return wxString::Format( _( "PCB" ) );
687 }
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 1411 of file class_board.cpp.

1412 {
1413  for ( auto mod : Modules() )
1414  {
1415  for ( auto pad : mod->Pads( ) )
1416  {
1417  if( aNetCode < 0 || pad->GetNetCode() == aNetCode )
1418  {
1419  aVector.push_back( pad );
1420  }
1421  }
1422  }
1423 
1424  std::sort( aVector.begin(), aVector.end(), sortPadsByXthenYCoord );
1425 }
MODULES & Modules()
Definition: class_board.h:229
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::testPad2Pad().

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

623  {
624  // a BOARD's standard layer name is the PCB_LAYER_ID fixed name
625  return LSET::Name( aLayerId );
626  }
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::formatLayer(), PCB_IO::formatLayers(), GetLayerID(), BOARD_ITEM::GetLayerName(), GetLayerName(), PARAM_CFG_LAYERS::ReadParam(), and PARAM_CFG_LAYERS::SaveParam().

◆ GetState()

int EDA_ITEM::GetState ( int  type) const
inlineinherited

Definition at line 241 of file base_struct.h.

242  {
243  return m_Status & type;
244  }
STATUS_FLAGS m_Status
Definition: base_struct.h:179

References EDA_ITEM::m_Status.

Referenced by SELECTION_TOOL::expandConnection(), TRACK::GetMsgPanelInfoBase_Common(), TRACK::IsLocked(), TRACK::Print(), and ZONE_CONTAINER::PrintFilledArea().

◆ GetStatus()

STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 254 of file base_struct.h.

254 { return m_Status; }
STATUS_FLAGS m_Status
Definition: base_struct.h:179

References EDA_ITEM::m_Status.

Referenced by PCB_IO::format().

◆ GetTitleBlock()

TITLE_BLOCK& BOARD::GetTitleBlock ( )
inline

Definition at line 533 of file class_board.h.

533 { return m_titles; }
TITLE_BLOCK m_titles
text in lower right of screen and plots
Definition: class_board.h:199

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

◆ GetTrackLength()

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

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

This uses the connectivity data for the board to calculate connections

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

Definition at line 1435 of file class_board.cpp.

1436 {
1437  int count = 0;
1438  double length = 0.0;
1439  double package_length = 0.0;
1440 
1441  constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T, PCB_PAD_T, EOT };
1442  auto connectivity = GetBoard()->GetConnectivity();
1443 
1444  for( auto item : connectivity->GetConnectedItems(
1445  static_cast<const BOARD_CONNECTED_ITEM*>( &aTrack ), types ) )
1446  {
1447  count++;
1448 
1449  if( auto track = dyn_cast<TRACK*>( item ) )
1450  {
1451  bool inPad = false;
1452 
1453  for( auto pad_it : connectivity->GetConnectedPads( item ) )
1454  {
1455  auto pad = static_cast<D_PAD*>( pad_it );
1456 
1457  if( pad->HitTest( track->GetStart(), track->GetWidth() / 2 )
1458  && pad->HitTest( track->GetEnd(), track->GetWidth() / 2 ) )
1459  {
1460  inPad = true;
1461  break;
1462  }
1463  }
1464 
1465  if( !inPad )
1466  length += track->GetLength();
1467  }
1468  else if( auto pad = dyn_cast<D_PAD*>( item ) )
1469  package_length += pad->GetPadToDieLength();
1470  }
1471 
1472  return std::make_tuple( count, length, package_length );
1473 }
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:306
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 775 of file class_board.cpp.

776 {
777  return m_connectivity->GetUnconnectedCount();
778 }
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: class_board.h:194

References m_connectivity.

◆ GetVisibleElements()

int BOARD::GetVisibleElements ( ) const

Function GetVisibleElements is a proxy function that calls the correspondent function in m_BoardSettings returns a bit-mask of all the element categories that are visible.

Returns
int - the visible element bitmap or-ed from enum GAL_LAYER_ID
See also
enum GAL_LAYER_ID

Definition at line 463 of file class_board.cpp.

464 {
466 }
int GetVisibleElements() const
Function GetVisibleElements returns a bit-mask of all the element categories that are visible.
BOARD_DESIGN_SETTINGS m_designSettings
Definition: class_board.h:196

References BOARD_DESIGN_SETTINGS::GetVisibleElements(), and m_designSettings.

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

422 {
424 }
LSET GetVisibleLayers() const
Function GetVisibleLayers returns a bit-mask of all the layers that are visible.
BOARD_DESIGN_SETTINGS m_designSettings
Definition: class_board.h:196

References BOARD_DESIGN_SETTINGS::GetVisibleLayers(), and m_designSettings.

Referenced by ComputeBoundingBox(), PCB_IO::formatBoardLayers(), PCB_BASE_FRAME::GetCollectorsGuide(), PCB_LAYER_WIDGET::OnLayerVisible(), ZONE_CONTAINER::Print(), VIA::Print(), SELECTION_TOOL::Selectable(), VIA::ViewGetLOD(), and D_PAD::ViewGetLOD().

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

1544 {
1545  std::list<ZONE_CONTAINER*> zones;
1546 
1547  for( int ii = 0; ii < GetAreaCount(); ii++ )
1548  {
1549  zones.push_back( GetArea( ii ) );
1550  }
1551 
1552  if( aIncludeZonesInFootprints )
1553  {
1554  for( MODULE* mod : m_modules )
1555  {
1556  for( MODULE_ZONE_CONTAINER* zone : mod->Zones() )
1557  {
1558  zones.push_back( zone );
1559  }
1560  }
1561  }
1562 
1563  return zones;
1564 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:178
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:919
MODULE_ZONE_CONTAINER is the same item as ZONE_CONTAINER, but with a specific type id ZONE_CONTAINER ...
Definition: class_zone.h:848
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:884

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

Referenced by ZONE_FILLER::buildCopperItemClearances(), and DRC::testKeepoutAreas().

◆ GetZoneSettings()

const ZONE_SETTINGS& BOARD_ITEM_CONTAINER::GetZoneSettings ( ) const
inlineinherited

Fetch the zone settings for this container.

Definition at line 75 of file board_item_container.h.

76  {
77  return m_zoneSettings;
78  }

References BOARD_ITEM_CONTAINER::m_zoneSettings.

Referenced by PCB_IO::formatSetup(), PCB_BASE_FRAME::GetZoneSettings(), LEGACY_PLUGIN::loadSETUP(), and ZONE_CONTAINER::ZONE_CONTAINER().

◆ HasFlag()

◆ HighLightOFF()

void BOARD::HighLightOFF ( )
inline

Function HighLightOFF Disable highlight.

Definition at line 379 of file class_board.h.

379 { m_highLight.m_highLightOn = false; }
HIGH_LIGHT_INFO m_highLight
Definition: class_board.h:189

References HIGH_LIGHT_INFO::m_highLightOn.

◆ HighLightON()

void BOARD::HighLightON ( )
inline

Function HighLightON Enable highlight.

if m_highLight_NetCode >= 0, this net will be highlighted

Definition at line 386 of file class_board.h.

386 { m_highLight.m_highLightOn = true; }
HIGH_LIGHT_INFO m_highLight
Definition: class_board.h:189

References HIGH_LIGHT_INFO::m_highLightOn.

◆ HitTest() [1/2]

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

Function HitTest tests if aPosition is contained within or on the bounding box of an item.

Parameters
aPositionA reference to a wxPoint object containing the coordinates to test.
aAccuracyIncrease the item bounding box by this amount.
Returns
True if aPosition is within the item bounding box.

Reimplemented in D_PAD, SCH_COMPONENT, SCH_SHEET, MODULE, VIA, WS_DRAW_ITEM_BITMAP, SCH_TEXT, ARC, WS_DRAW_ITEM_TEXT, ZONE_CONTAINER, GERBER_DRAW_ITEM, WS_DRAW_ITEM_PAGE, DIMENSION, DRAWSEGMENT, WS_DRAW_ITEM_RECT, SCH_LINE, SCH_SHEET_PIN, TEXTE_MODULE, SCH_FIELD, LIB_ITEM, TRACK, WS_DRAW_ITEM_POLYPOLYGONS, LIB_FIELD, SCH_BITMAP, WS_DRAW_ITEM_LINE, MARKER_PCB, LIB_PIN, SCH_NO_CONNECT, SCH_BUS_ENTRY_BASE, SCH_MARKER, SCH_JUNCTION, PCB_TARGET, WS_DRAW_ITEM_BASE, SCH_PIN, TEXTE_PCB, LIB_POLYLINE, LIB_ARC, LIB_BEZIER, LIB_TEXT, LIB_RECTANGLE, LIB_CIRCLE, and KIGFX::RATSNEST_VIEWITEM.

Definition at line 332 of file base_struct.h.

333  {
334  return false; // derived classes should override this function
335  }

Referenced by SCH_MOVE_TOOL::getConnectedDragItems(), EE_SELECTION_TOOL::GuessSelectionCandidates(), WS_DRAW_ITEM_BASE::HitTest(), LIB_ITEM::HitTest(), EE_COLLECTOR::Inspect(), GERBER_COLLECTOR::Inspect(), GENERAL_COLLECTOR::Inspect(), EE_SELECTION_TOOL::selectMultiple(), and SELECTION_TOOL::selectMultiple().

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

Definition at line 346 of file base_struct.h.

347  {
348  return false; // derived classes should override this function
349  }

◆ HitTestForAnyFilledArea()

ZONE_CONTAINER * BOARD::HitTestForAnyFilledArea ( const wxPoint aRefPos,
PCB_LAYER_ID  aStartLayer,
PCB_LAYER_ID  aEndLayer,
int  aNetCode 
)

Function HitTestForAnyFilledArea tests if the given wxPoint is within the bounds of a filled area of this zone.

the test is made on zones on layer from aStartLayer to aEndLayer Note: if a zone has its flag BUSY (in .m_State) is set, it is ignored.

Parameters
aRefPosA wxPoint to test
aStartLayerthe first layer to test
aEndLayerthe last layer to test
aNetCode= the netcode used to filter zones (-1 to to test all zones)
Returns
ZONE_CONTAINER* return a pointer to the ZONE_CONTAINER found, else NULL

Definition at line 1190 of file class_board.cpp.

1192 {
1193  if( aEndLayer < 0 )
1194  aEndLayer = aStartLayer;
1195 
1196  if( aEndLayer < aStartLayer )
1197  std::swap( aEndLayer, aStartLayer );
1198 
1199  for( ZONE_CONTAINER* area : m_ZoneDescriptorList )
1200  {
1201  if( area->GetLayer() < aStartLayer || area->GetLayer() > aEndLayer )
1202  continue;
1203 
1204  // In locate functions we must skip tagged items with BUSY flag set.
1205  if( area->GetState( BUSY ) )
1206  continue;
1207 
1208  if( aNetCode >= 0 && area->GetNetCode() != aNetCode )
1209  continue;
1210 
1211  if( area->HitTestFilledArea( aRefPos ) )
1212  return area;
1213  }
1214 
1215  return NULL;
1216 }
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
#define BUSY
Pcbnew: flag indicating that the structure has.
Definition: base_struct.h:140
#define NULL
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:184

References BUSY, m_ZoneDescriptorList, and NULL.

◆ InsertArea()

ZONE_CONTAINER * BOARD::InsertArea ( int  aNetcode,
int  aAreaIdx,
PCB_LAYER_ID  aLayer,
int  aCornerX,
int  aCornerY,
ZONE_HATCH_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 1603 of file class_board.cpp.

1605 {
1606  ZONE_CONTAINER* new_area = (ZONE_CONTAINER*) this->Duplicate();
1607 
1608  new_area->SetNetCode( aNetcode );
1609  new_area->SetLayer( aLayer );
1610 
1611  if( aAreaIdx < (int) ( m_ZoneDescriptorList.size() - 1 ) )
1612  m_ZoneDescriptorList.insert( m_ZoneDescriptorList.begin() + aAreaIdx + 1, new_area );
1613  else
1614  m_ZoneDescriptorList.push_back( new_area );
1615 
1616  new_area->SetHatchStyle( (ZONE_HATCH_STYLE) aHatch );
1617 
1618  // Add the first corner to the new zone
1619  new_area->AppendCorner( wxPoint( aCornerX, aCornerY ), -1 );
1620 
1621  return new_area;
1622 }
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
void SetHatchStyle(ZONE_HATCH_STYLE aStyle)
Definition: class_zone.h:543
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Function SetLayer sets the layer this item is on.
Definition: class_zone.cpp:240
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Sets net using a net code.
ZONE_HATCH_STYLE
Zone hatch styles.
Definition: zone_settings.h:45
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:184
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:927
BOARD_ITEM * Duplicate() const
Function Duplicate creates a copy of a BOARD_ITEM.

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

Referenced by AddArea().

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

108  {
109  return false;
110  }

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

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 223 of file base_struct.h.

223 { return m_Flags & IS_DRAGGED; }
#define IS_DRAGGED
Item being dragged.
Definition: base_struct.h:122
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189

References IS_DRAGGED, and EDA_ITEM::m_Flags.

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

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

470 {
471  return m_designSettings.IsElementVisible( aLayer );
472 }
bool IsElementVisible(GAL_LAYER_ID aElementCategory) const
Function IsElementVisible tests whether a given element category is visible.
BOARD_DESIGN_SETTINGS m_designSettings
Definition: class_board.h:196

References BOARD_DESIGN_SETTINGS::IsElementVisible(), and m_designSettings.

Referenced by ComputeBoundingBox(), PCB_BASE_FRAME::GetCollectorsGuide(), FOOTPRINT_EDIT_FRAME::IsElementVisible(), PCB_EDIT_FRAME::IsElementVisible(), IsModuleLayerVisible(), PCB_LAYER_WIDGET::OnRenderEnable(), TRACK::Print(), TEXTE_MODULE::Print(), VIA::Print(), MODULE::Print(), D_PAD::Print(), PCB_LAYER_WIDGET::ReFillRender(), SELECTION_TOOL::Selectable(), and PCB_DRAW_PANEL_GAL::SyncLayersVisibility().

◆ IsEmpty()

bool BOARD::IsEmpty ( ) const
inline

Definition at line 264 of file class_board.h.

265  {
266  return m_drawings.empty() && m_modules.empty() && m_tracks.empty() &&
267  m_ZoneDescriptorList.empty();
268  }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:178
TRACKS m_tracks
TRACKS for traces on the board, owned by pointer.
Definition: class_board.h:181
DRAWINGS m_drawings
BOARD_ITEMs for drawings on the board, owned by pointer.
Definition: class_board.h:175
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:184

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

◆ IsHighlighted()

bool EDA_ITEM::IsHighlighted ( ) const
inlineinherited

Definition at line 227 of file base_struct.h.

227 { return m_Flags & HIGHLIGHTED; }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:142
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189

References HIGHLIGHTED, and EDA_ITEM::m_Flags.

Referenced by SCH_COMPONENT::ClearAllHighlightFlags(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), and KIGFX::SCH_VIEW::HighlightItem().

◆ IsHighLightNetON()

bool BOARD::IsHighLightNetON ( ) const
inline

Function IsHighLightNetON.

Returns
true if a net is currently highlighted

Definition at line 373 of file class_board.h.

373 { return m_highLight.m_highLightOn; }
HIGH_LIGHT_INFO m_highLight
Definition: class_board.h:189

References HIGH_LIGHT_INFO::m_highLightOn.

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

420  {
421  return m_designSettings.IsLayerEnabled( aLayer );
422  }
bool IsLayerEnabled(PCB_LAYER_ID aLayerId) const
Function IsLayerEnabled tests whether a given layer is enabled.
BOARD_DESIGN_SETTINGS m_designSettings
Definition: class_board.h:196

References 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(), PARAM_CFG_LAYERS::SaveParam(), SetLayerName(), and SetLayerType().

◆ IsLayerVisible()

bool BOARD::IsLayerVisible ( PCB_LAYER_ID  aLayer) const
inline

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

432  {
433  return m_designSettings.IsLayerVisible( aLayer );
434  }
bool IsLayerVisible(PCB_LAYER_ID aLayerId) const
Function IsLayerVisible tests whether a given layer is visible.
BOARD_DESIGN_SETTINGS m_designSettings
Definition: class_board.h:196

References BOARD_DESIGN_SETTINGS::IsLayerVisible().

Referenced by DRAWING_TOOL::DrawVia(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), PCBNEW_CONTROL::LayerNext(), PCBNEW_CONTROL::LayerPrev(), TEXTE_PCB::Print(), PCB_TARGET::Print(), ZONE_CONTAINER::Print(), EDGE_MODULE::Print(), TRACK::Print(), TEXTE_MODULE::Print(), DIMENSION::Print(), DRAWSEGMENT::Print(), D_PAD::Print(), ZONE_CONTAINER::PrintFilledArea(), 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 210 of file class_board_item.h.

211  {
212  // only MODULEs & TRACKs can be locked at this time.
213  return false;
214  }

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

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 221 of file base_struct.h.

221 { return m_Flags & IS_CHANGED; }
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:116
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189

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

511 {
512  switch( aLayer )
513  {
514  case F_Cu:
515  return IsElementVisible( LAYER_MOD_FR );
516 
517  case B_Cu:
518  return IsElementVisible( LAYER_MOD_BK );
519 
520  default:
521  wxFAIL_MSG( wxT( "BOARD::IsModuleLayerVisible() param error: bad layer" ) );
522  return true;
523  }
524 }
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 D_PAD, TRACK, and ZONE_CONTAINER.

Definition at line 115 of file class_board_item.h.

116  {
117  return IsCopperLayer( GetLayer() );
118  }
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, and MARKER_PCB.

Definition at line 190 of file class_board_item.h.

191  {
192  return m_Layer == aLayer;
193  }
PCB_LAYER_ID m_Layer

References BOARD_ITEM::m_Layer.

Referenced by CINFO3D_VISU::createLayers(), GENERAL_COLLECTOR::Inspect(), ZONE_CONTAINER::IsOnLayer(), and AR_MATRIX::TraceSegmentPcb().

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

517 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 226 of file base_struct.h.

226 { return m_Flags & IS_RESIZED; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:121

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

202  {
203  return ( Type() == PCB_TRACE_T ) || ( Type() == PCB_VIA_T );
204  }
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:212

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 SCH_LABEL, SCH_FIELD, and SCH_LINE.

Definition at line 286 of file base_struct.h.

287  {
288  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
289  return true;
290 
291  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
292  {
293  if( m_StructType == *p )
294  return true;
295  }
296 
297  return false;
298  }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it.
Definition: base_struct.h:178
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(), SCH_LINE::IsType(), SCH_FIELD::IsType(), SCH_LABEL::IsType(), EE_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 224 of file base_struct.h.

224 { return m_Flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:124
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189

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

403  {
404  for( auto it : aList )
405  {
406  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
408  return SEARCH_RESULT::QUIT;
409  }
410 
412  }
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 420 of file base_struct.h.

422  {
423  for( auto it : aList )
424  {
425  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
427  return SEARCH_RESULT::QUIT;
428  }
429 
431  }
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().

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

1780 {
1781  for( BOARD_CONNECTED_ITEM* item : AllConnectedItems() )
1782  {
1783  NETINFO_ITEM* netInfo = aDestBoard->FindNet( item->GetNetname() );
1784 
1785  if( netInfo )
1786  item->SetNetCode( netInfo->GetNet() );
1787  else
1788  item->SetNetCode( 0 );
1789  }
1790 }
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:226
NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
int GetNet() const
Function GetNet.
Definition: netinfo.h:224

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

◆ Markers()

MARKERS& BOARD::Markers ( )
inline

Definition at line 248 of file class_board.h.

249  {
250  return m_markers;
251  }
MARKERS m_markers
MARKER_PCBs for clearance problems, owned by pointer.
Definition: class_board.h:172

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

Definition at line 473 of file base_struct.h.

474  {
475  return false;
476  }

Referenced by SCH_EDITOR_CONTROL::HasMatch(), TEXTE_PCB::Matches(), TEXTE_MODULE::Matches(), SCH_MARKER::Matches(), LIB_PIN::Matches(), MARKER_PCB::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 152 of file base_struct.cpp.

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

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

◆ Modules() [1/2]

MODULES& BOARD::Modules ( )
inline

Definition at line 229 of file class_board.h.

230  {
231  return m_modules;
232  }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:178

Referenced by DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), C3D_RENDER_RAYTRACING::add_3D_vias_and_pads_to_container(), 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(), ZONE_FILLER::buildThermalSpokes(), HYPERLYNX_EXPORTER::collectNetObjects(), CreateComponentsSection(), CINFO3D_VISU::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(), 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(), 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(), PCB_BASE_FRAME::OnTogglePadDrawMode(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), PCBNEW_CONTROL::Paste(), AR_AUTOPLACER::pickModule(), PCBNEW_CONTROL::placeBoardItems(), BRDITEMS_PLOTTER::Plot_Edges_Modules(), BRDITEMS_PLOTTER::PlotDrillMarks(), PlotLayerOutlines(), PlotSilkScreen(), 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(), DRC_COURTYARD_OVERLAP::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(), DRC::testDrilledHoles(), DRC::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 233 of file class_board.h.

234  {
235  return m_modules;
236  }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:178

◆ Move() [1/2]

void BOARD_ITEM::Move ( const VECTOR2I aMoveVector)
inlineinherited

Definition at line 249 of file class_board_item.h.

250  {
251  Move( wxPoint( aMoveVector.x, aMoveVector.y ) );
252  }
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 195 of file class_board.cpp.

196 {
197  // @todo : anything like this elsewhere? maybe put into GENERAL_COLLECTOR class.
198  static const KICAD_T top_level_board_stuff[] = {
199  PCB_MARKER_T,
200  PCB_TEXT_T,
201  PCB_LINE_T,
203  PCB_TARGET_T,
204  PCB_VIA_T,
205  PCB_TRACE_T,
206  PCB_ARC_T,
207  // PCB_PAD_T, Can't be at board level
208  // PCB_MODULE_TEXT_T, Can't be at board level
209  PCB_MODULE_T,
211  EOT
212  };
213 
214  INSPECTOR_FUNC inspector = [&] ( EDA_ITEM* item, void* testData )
215  {
216  BOARD_ITEM* brd_item = (BOARD_ITEM*) item;
217 
218  // aMoveVector was snapshotted, don't need "data".
219  brd_item->Move( aMoveVector );
220 
222  };
223 
224  Visit( inspector, NULL, top_level_board_stuff );
225 }
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:83
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:166
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 1625 of file class_board.cpp.

1626 {
1627  // mark all areas as unmodified except this one, if modified
1628  for( ZONE_CONTAINER* zone : m_ZoneDescriptorList )
1629  zone->SetLocalFlags( 0 );
1630 
1631  aCurrArea->SetLocalFlags( 1 );
1632 
1633  if( aCurrArea->Outline()->IsSelfIntersecting() )
1634  {
1635  aCurrArea->UnHatch();
1636 
1637  // Normalize copied area and store resulting number of polygons
1638  int n_poly = aCurrArea->Outline()->NormalizeAreaOutlines();
1639 
1640  // If clipping has created some polygons, we must add these new copper areas.
1641  if( n_poly > 1 )
1642  {
1643  ZONE_CONTAINER* NewArea;
1644 
1645  // Move the newly created polygons to new areas, removing them from the current area
1646  for( int ip = 1; ip < n_poly; ip++ )
1647  {
1648  // Create new copper area and copy poly into it
1649  SHAPE_POLY_SET* new_p = new SHAPE_POLY_SET( aCurrArea->Outline()->UnitSet( ip ) );
1650  NewArea = AddArea( aNewZonesList, aCurrArea->GetNetCode(), aCurrArea->GetLayer(),
1651  wxPoint(0, 0), aCurrArea->GetHatchStyle() );
1652 
1653  // remove the poly that was automatically created for the new area
1654  // and replace it with a poly from NormalizeAreaOutlines
1655  delete NewArea->Outline();
1656  NewArea->SetOutline( new_p );
1657  NewArea->Hatch();
1658  NewArea->SetLocalFlags( 1 );
1659  }
1660 
1661  SHAPE_POLY_SET* new_p = new SHAPE_POLY_SET( aCurrArea->Outline()->UnitSet( 0 ) );
1662  delete aCurrArea->Outline();
1663  aCurrArea->SetOutline( new_p );
1664  }
1665  }
1666 
1667  aCurrArea->Hatch();
1668 
1669  return true;
1670 }
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
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:213
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:265
void SetOutline(SHAPE_POLY_SET *aOutline)
Definition: class_zone.h:268
SHAPE_POLY_SET.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Returns the reference to aIndex-th outline in the set
ZONE_HATCH_STYLE GetHatchStyle() const
Definition: class_zone.h:538
void UnHatch()
Function UnHatch clears the zone's hatch.
Definition: class_zone.cpp:986
SHAPE_POLY_SET UnitSet(int aPolygonIndex)
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:184
void Hatch()
Function Hatch computes the hatch lines depending on the hatch parameters and stores it in the zone's...
void SetLocalFlags(int aFlags)
Definition: class_zone.h:260
ZONE_CONTAINER * AddArea(PICKED_ITEMS_LIST *aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer, wxPoint aStartPointPosition, ZONE_HATCH_STYLE aHatch)
Function AddArea Add an empty copper area to board areas list.
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::Hatch(), 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::UnHatch(), 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:60
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:450
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:184
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().

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

207 {
208  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
209  GetChars( GetClass() ) ) );
210 
211  return false;
212 }
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:101
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
aPadis the pad to delete.

Definition at line 1428 of file class_board.cpp.

1429 {
1430  GetConnectivity()->Remove( aPad );
1431  aPad->DeleteStructure();
1432 }
void DeleteStructure()
Function DeleteStructure deletes this object after removing from its parent if it has one.
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:306

References BOARD_ITEM::DeleteStructure(), and GetConnectivity().

◆ Print()

void BOARD::Print ( PCB_BASE_FRAME aFrame,
wxDC *  aDC,
const wxPoint aOffset = ZeroOffset 
)
overridevirtual

Function Print.

Print the BOARD items.

Parameters
aFrame= the current Frame
aDC= the current device context
aDrawMode= GR_COPY, GR_OR ... (not always used)
aOffset= an draw offset value (default = 0,0)

Implements BOARD_ITEM.

Definition at line 461 of file display_footprints_frame.cpp.

462 {
463  if( !m_modules.empty() )
464  GetFirstModule()->Print( aFrame, aDC );
465 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:178
MODULE * GetFirstModule() const
Gets the first module in the list (used in footprint viewer/editor) or NULL if none.
Definition: class_board.h:283
void Print(PCB_BASE_FRAME *aFrame, wxDC *aDC, const wxPoint &aOffset=ZeroOffset) override
Function Print Prints the footprint to the aDC.

References GetFirstModule(), m_modules, and MODULE::Print().

◆ Remove()

void BOARD::Remove ( BOARD_ITEM aItem)
overridevirtual

Removes an item from the container.

Implements BOARD_ITEM_CONTAINER.

Definition at line 606 of file class_board.cpp.

607 {
608  // find these calls and fix them! Don't send me no stinking' NULL.
609  wxASSERT( aBoardItem );
610 
611  switch( aBoardItem->Type() )
612  {
613  case PCB_NETINFO_T:
614  {
615  NETINFO_ITEM* item = (NETINFO_ITEM*) aBoardItem;
616  m_NetInfo.RemoveNet( item );
617  break;
618  }
619 
620  case PCB_MARKER_T:
621 
622  // find the item in the vector, then remove it
623  for( unsigned i = 0; i<m_markers.size(); ++i )
624  {
625  if( m_markers[i] == (MARKER_PCB*) aBoardItem )
626  {
627  m_markers.erase( m_markers.begin() + i );
628  break;
629  }
630  }
631 
632  break;
633 
634  case PCB_ZONE_AREA_T: // this one uses a vector
635  // find the item in the vector, then delete then erase it.
636  for( unsigned i = 0; i<m_ZoneDescriptorList.size(); ++i )
637  {
638  if( m_ZoneDescriptorList[i] == (ZONE_CONTAINER*) aBoardItem )
639  {
640  m_ZoneDescriptorList.erase( m_ZoneDescriptorList.begin() + i );
641  break;
642  }
643  }
644  break;
645 
646  case PCB_MODULE_T:
647  m_modules.erase( std::remove_if( m_modules.begin(), m_modules.end(),
648  [aBoardItem]( BOARD_ITEM* aItem )
649  {
650  return aItem == aBoardItem;
651  } ) );
652  break;
653 
654  case PCB_TRACE_T:
655  case PCB_ARC_T:
656  case PCB_VIA_T:
657  m_tracks.erase( std::remove_if( m_tracks.begin(), m_tracks.end(),
658  [aBoardItem]( BOARD_ITEM* aItem )
659  {
660  return aItem == aBoardItem;
661  } ) );
662  break;
663 
664  case PCB_DIMENSION_T:
665  case PCB_LINE_T:
666  case PCB_TEXT_T:
667  case PCB_TARGET_T:
668  m_drawings.erase( std::remove_if( m_drawings.begin(), m_drawings.end(),
669  [aBoardItem](BOARD_ITEM* aItem)
670  {
671  return aItem == aBoardItem;
672  } ) );
673  break;
674 
675  // other types may use linked list
676  default:
677  wxFAIL_MSG( wxT( "BOARD::Remove() needs more ::Type() support" ) );
678  }
679 
680  m_connectivity->Remove( aBoardItem );
681 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:178
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
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
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:201
TRACKS m_tracks
TRACKS for traces on the board, owned by pointer.
Definition: class_board.h:181
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
class MODULE, a footprint
Definition: typeinfo.h:89
void RemoveNet(NETINFO_ITEM *aNet)
Function RemoveNet Removes a new from the net list.
MARKERS m_markers
MARKER_PCBs for clearance problems, owned by pointer.
Definition: class_board.h:172
DRAWINGS m_drawings
BOARD_ITEMs for drawings on the board, owned by pointer.
Definition: class_board.h:175
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:184
class NETINFO_ITEM, a description of a net
Definition: typeinfo.h:104
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: class_board.h:194
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 m_connectivity, m_drawings, m_markers, m_modules, m_NetInfo, m_tracks, m_ZoneDescriptorList, 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, NETINFO_LIST::RemoveNet(), and EDA_ITEM::Type().

Referenced by TRACKS_CLEANER::deleteDanglingTracks(), TRACKS_CLEANER::mergeCollinearSegments(), BOARD_COMMIT::Push(), RemoveArea(), TRACKS_CLEANER::removeItems(), BOARD_COMMIT::Revert(), and PANEL_SETUP_LAYERS::TransferDataFromWindow().

◆ RemoveArea()

void BOARD::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)

Parameters
aDeletedList= a PICKED_ITEMS_LIST * where to store deleted areas (useful in undo commands can be NULL
area_to_remove= area to delete or put in deleted list

Definition at line 1585 of file class_board.cpp.

1586 {
1587  if( area_to_remove == NULL )
1588  return;
1589 
1590  if( aDeletedList )
1591  {
1592  ITEM_PICKER picker( area_to_remove, UR_DELETED );
1593  aDeletedList->PushItem( picker );
1594  Remove( area_to_remove ); // remove from zone list, but does not delete it
1595  }
1596  else
1597  {
1598  Delete( area_to_remove );
1599  }
1600 }
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
#define NULL
virtual void Delete(BOARD_ITEM *aItem)
Removes an item from the container and deletes it.
void Remove(BOARD_ITEM *aBoardItem) override
Removes an item from the container.

References BOARD_ITEM_CONTAINER::Delete(), NULL, PICKED_ITEMS_LIST::PushItem(), Remove(), and UR_DELETED.

Referenced by CombineAreas(), and OnAreaPolygonModified().

◆ Replace() [1/2]

bool EDA_ITEM::Replace ( wxFindReplaceData &  aSearchData,
wxString &  aText 
)
staticinherited

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.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search and replace criteria.
aTextA reference to a wxString object containing the text to be replaced.
Returns
True if aText was modified, otherwise false.

Definition at line 179 of file base_struct.cpp.

180 {
181  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
182 
183  int result = searchString.Find( (aSearchData.GetFlags() & wxFR_MATCHCASE) ?
184  aSearchData.GetFindString() :
185  aSearchData.GetFindString().Upper() );
186 
187  if( result == wxNOT_FOUND )
188  return false;
189 
190  wxString prefix = aText.Left( result );
191  wxString suffix;
192 
193  if( aSearchData.GetFindString().length() + result < aText.length() )
194  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
195 
196  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
197  GetChars( aText ), GetChars( prefix ), GetChars( aSearchData.GetReplaceString() ),
198  GetChars( suffix ) );
199 
200  aText = prefix + aSearchData.GetReplaceString() + suffix;
201 
202  return true;
203 }
const wxChar *const traceFindReplace
Flag to enable find and replace debug tracing.
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:101

References GetChars(), and traceFindReplace.

Referenced by SCH_FIELD::Replace(), EDA_TEXT::Replace(), and SCH_EDITOR_CONTROL::ReplaceAndFindNext().

◆ Replace() [2/2]

virtual bool EDA_ITEM::Replace ( wxFindReplaceData &  aSearchData,
void *  aAuxData = NULL 
)
inlinevirtualinherited

Function Replace performs a text replace using the find and replace criteria in aSearchData on items that support text find and replace.

This function must be overridden for items that support text replace.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search and replace criteria.
aAuxDataA pointer to optional data required for the search or NULL if not used.
Returns
True if the item text was modified, otherwise false.

Reimplemented in SCH_TEXT, SCH_SHEET_PIN, and SCH_FIELD.

Definition at line 505 of file base_struct.h.

505 { return false; }

◆ ResetNetHighLight()

void BOARD::ResetNetHighLight ( )
inline

Function ResetNetHighLight Reset all high light data to the init state.

Definition at line 348 of file class_board.h.

349  {
350  m_highLight.Clear();
352  }
HIGH_LIGHT_INFO m_highLight
Definition: class_board.h:189
HIGH_LIGHT_INFO m_highLightPrevious
Definition: class_board.h:190

References HIGH_LIGHT_INFO::Clear().

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

◆ Rotate() [1/2]

virtual void BOARD_ITEM::Rotate ( const wxPoint aRotCentre,
double  aAngle 
)
inlinevirtualinherited

Function Rotate Rotate this object.

Parameters
aRotCentre- the rotation point.
aAngle- the rotation angle in 0.1 degree.

Reimplemented in D_PAD, ZONE_CONTAINER, ARC, MODULE, DRAWSEGMENT, DIMENSION, TEXTE_MODULE, MARKER_PCB, TRACK, PCB_TARGET, EDGE_MODULE, and TEXTE_PCB.

Definition at line 260 of file class_board_item.h.

261  {
262  wxMessageBox( wxT( "virtual BOARD_ITEM::Rotate used, should not occur" ), GetClass() );
263  }
virtual wxString GetClass() const =0
Function GetClass returns the class name.

References EDA_ITEM::GetClass().

Referenced by EDIT_TOOL::MoveExact(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), BOARD_ITEM::Rotate(), and TransformItem().

◆ Rotate() [2/2]

void BOARD_ITEM::Rotate ( const VECTOR2I aRotCentre,
double  aAngle 
)
inlineinherited

Definition at line 265 of file class_board_item.h.

266  {
267  Rotate( wxPoint( aRotCentre.x, aRotCentre.y ), aAngle );
268  }
virtual void Rotate(const wxPoint &aRotCentre, double aAngle)
Function Rotate Rotate this object.

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

◆ SanitizeNetcodes()

void BOARD::SanitizeNetcodes ( )

Definition at line 1793 of file class_board.cpp.

1794 {
1795  for ( BOARD_CONNECTED_ITEM* item : AllConnectedItems() )
1796  {
1797  if( FindNet( item->GetNetCode() ) == nullptr )
1798  item->SetNetCode( NETINFO_LIST::ORPHANED );
1799  }
1800 }
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()
static const int ORPHANED
Constant that forces initialization of a netinfo item to the NETINFO_ITEM ORPHANED (typically -1) whe...
Definition: netinfo.h:466

References AllConnectedItems(), FindNet(), and NETINFO_LIST::ORPHANED.

Referenced by PCB_BASE_EDIT_FRAME::PutDataInPreviousState().

◆ SetAreasNetCodesFromNetNames()

int BOARD::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.

However the Netcode is an arbitrary equivalence, it must be set after each netlist read or net change Must be called after pad netcodes are calculated

Returns
: error count For non copper areas, netcode is set to 0

Definition at line 1219 of file class_board.cpp.

1220 {
1221  int error_count = 0;
1222 
1223  for( int ii = 0; ii < GetAreaCount(); ii++ )
1224  {
1225  ZONE_CONTAINER* it = GetArea( ii );
1226 
1227  if( !it->IsOnCopperLayer() )
1228  {
1230  continue;
1231  }
1232 
1233  if( it->GetNetCode() != 0 ) // i.e. if this zone is connected to a net
1234  {
1235  const NETINFO_ITEM* net = it->GetNet();
1236 
1237  if( net )
1238  {
1239  it->SetNetCode( net->GetNet() );
1240  }
1241  else
1242  {
1243  error_count++;
1244 
1245  // keep Net Name and set m_NetCode to -1 : error flag.
1246  it->SetNetCode( -1 );
1247  }
1248  }
1249  }
1250 
1251  return error_count;
1252 }
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
int GetNetCode() const
Function GetNetCode.
NETINFO_ITEM * GetNet() const
Function GetNet Returns NET_INFO object for a given item.
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:919
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Sets net using a net code.
NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
int GetNet() const
Function GetNet.
Definition: netinfo.h:224
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:884
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
Definition: netinfo.h:462
bool IsOnCopperLayer() const override
Function IsOnCopperLayer.
Definition: class_zone.cpp:219

References GetArea(), GetAreaCount(), BOARD_CONNECTED_ITEM::GetNet(), NETINFO_ITEM::GetNet(), BOARD_CONNECTED_ITEM::GetNetCode(), ZONE_CONTAINER::IsOnCopperLayer(), BOARD_CONNECTED_ITEM::SetNetCode(), and NETINFO_LIST::UNCONNECTED.

Referenced by NETINFO_LIST::buildListOfNets().

◆ SetAuxOrigin()

void BOARD::SetAuxOrigin ( const wxPoint aPoint)
inline

Function SetAuxOrigin sets the origin point used for plotting.

Definition at line 334 of file class_board.h.

334 { m_designSettings.m_AuxOrigin = aPoint; }
BOARD_DESIGN_SETTINGS m_designSettings
Definition: class_board.h:196
wxPoint m_AuxOrigin
origin for plot exports

References BOARD_DESIGN_SETTINGS::m_AuxOrigin.

Referenced by DIALOG_EXPORT_SVG::CreateSVGFile(), and PCB_BASE_FRAME::SetAuxOrigin().

◆ SetBrightened()

void EDA_ITEM::SetBrightened ( )
inlineinherited

◆ SetCopperLayerCount()

void BOARD::SetCopperLayerCount ( int  aCount)

Definition at line 409 of file class_board.cpp.

410 {
412 }
void SetCopperLayerCount(int aNewLayerCount)
Function SetCopperLayerCount do what its name says...
BOARD_DESIGN_SETTINGS m_designSettings
Definition: class_board.h:196

References m_designSettings, and BOARD_DESIGN_SETTINGS::SetCopperLayerCount().

Referenced by PCAD2KICAD::PCB::AddToBoard(), PCBNEW_CONTROL::AppendBoard(), PCB_EDIT_FRAME::Clear_Pcb(), EAGLE_PLUGIN::Load(), LEGACY_PLUGIN::loadGENERAL(), and EAGLE_PLUGIN::loadLayerDefs().

◆ SetDesignSettings()

void BOARD::SetDesignSettings ( const BOARD_DESIGN_SETTINGS aDesignSettings)
inline

Function SetDesignSettings.

Parameters
aDesignSettingsthe new BOARD_DESIGN_SETTINGS to use

Definition at line 522 of file class_board.h.

523  {
524  m_designSettings = aDesignSettings;
525  }
BOARD_DESIGN_SETTINGS m_designSettings
Definition: class_board.h:196

Referenced by FOOTPRINT_EDIT_FRAME::Clear_Pcb(), DRC_RUNNER::Execute(), LEGACY_PLUGIN::loadSETUP(), DIALOG_DRC::OnDRCItemRClick(), FOOTPRINT_EDIT_FRAME::SetDesignSettings(), PCB_BASE_FRAME::SetDesignSettings(), and DIALOG_DRC::setDRCParameters().

◆ SetElementVisibility()

void BOARD::SetElementVisibility ( GAL_LAYER_ID  aLayer,
bool  aNewState 
)

Function SetElementVisibility changes the visibility of an element category.

Parameters
aLayeris from the enum by the same name
aNewState= The new visibility state of the element category
See also
enum GAL_LAYER_ID

Definition at line 475 of file class_board.cpp.

476 {
477  m_designSettings.SetElementVisibility( aLayer, isEnabled );
478 
479  switch( aLayer )
480  {
481  case LAYER_RATSNEST:
482  {
483  // because we have a tool to show/hide ratsnest relative to a pad or a module
484  // so the hide/show option is a per item selection
485 
486  for( auto track : Tracks() )
487  track->SetLocalRatsnestVisible( isEnabled );
488 
489  for( auto mod : Modules() )
490  {
491  for( auto pad : mod->Pads() )
492  pad->SetLocalRatsnestVisible( isEnabled );
493  }
494 
495  for(