KiCad PCB EDA Suite
BOARD Class Reference

Class 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 ()
 
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_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 (void *aWeakReference)
 
BOARD_ITEMDuplicate (const BOARD_ITEM *aItem, bool aAddToBoard=false)
 
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...
 
MARKER_PCBGetMARKER (int index) const
 Function GetMARKER returns the MARKER at a given index. More...
 
int GetMARKERCount () const
 Function GetMARKERCount. More...
 
void SetAuxOrigin (const wxPoint &aPoint)
 Function SetAuxOrigin sets the origin point used for plotting. More...
 
const wxPoint & GetAuxOrigin () const
 
void SetGridOrigin (const wxPoint &aPoint)
 Function SetGridOrigin sets the origin point of the grid. More...
 
const wxPoint & GetGridOrigin () 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_T 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 COLORS_DESIGN_SETTINGSColors () const
 Function GetColorSettings. More...
 
const PCB_GENERAL_SETTINGSGeneralSettings () const
 
void SetGeneralSettings (PCB_GENERAL_SETTINGS *aGeneralSettings)
 
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_T 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...
 
MODULEFindModule (const wxString &aRefOrTimeStamp, bool aSearchByTimeStamp=false) const
 Function FindModule searches for a module matching aRefOrTimeStamp depending on the state of aSearchByTimeStamp. 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, int 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, int 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...
 
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 SetTimeStamp (timestamp_t aNewTimeStamp)
 
timestamp_t GetTimeStamp () const
 
EDA_ITEMNext () const
 
EDA_ITEMBack () const
 
DHEADGetList () const
 
void SetNext (EDA_ITEM *aNext)
 
void SetBack (EDA_ITEM *aBack)
 
void SetParent (EDA_ITEM *aParent)
 
void SetList (DHEAD *aList)
 
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[])
 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...
 
static SEARCH_RESULT IterateForward (EDA_ITEM *listStart, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 Function IterateForward walks through the object tree calling the inspector() on each object type requested in scanTypes. 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...
 

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_ITEMPnext
 next in linked list More...
 
EDA_ITEMPback
 previous in linked list More...
 
DHEADm_List
 which DLIST I am on. More...
 
EDA_ITEMm_Parent
 Linked list: Link (parent struct) More...
 
timestamp_t m_TimeStamp
 Time stamp used for logical links. 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
 
PCB_GENERAL_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

Class BOARD holds information pertinent to a Pcbnew printed circuit board.

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

101  :
103  m_paper( PAGE_INFO::A4 ), m_NetInfo( this )
104 {
105  // we have not loaded a board yet, assume latest until then.
106  m_fileFormatVersionAtLoad = LEGACY_BOARD_FILE_VERSION;
107 
109 
110  m_CurrentZoneContour = NULL; // This ZONE_CONTAINER handle the
111  // zone contour currently in progress
112 
113  BuildListOfNets(); // prepare pad and netlist containers.
114 
115  for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
116  {
117  m_Layer[layer].m_name = GetStandardLayerName( ToLAYER_ID( layer ) );
118 
119  if( IsCopperLayer( layer ) )
120  m_Layer[layer].m_type = LT_SIGNAL;
121  else
122  m_Layer[layer].m_type = LT_UNDEFINED;
123  }
124 
125  // Initialize default netclass.
126  NETCLASSPTR defaultClass = m_designSettings.GetDefault();
127  defaultClass->SetDescription( _( "This is the default net class." ) );
128  m_designSettings.SetCurrentNetClass( defaultClass->GetName() );
129 
130  // Set sensible initial values for custom track width & via size
135 
136  // Initialize ratsnest
137  m_connectivity.reset( new CONNECTIVITY_DATA() );
138 }
void BuildListOfNets()
Definition: class_board.h:717
Definition: typeinfo.h:85
int GetCurrentViaDrill() const
Function GetCurrentViaDrill.
wxString m_name
The name of the layer, there should be no spaces in this name.
Definition: class_board.h:106
int GetCurrentTrackWidth() const
Function GetCurrentTrackWidth.
Class 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:196
void SetCustomViaDrill(int aDrill)
Function SetCustomViaDrill Sets custom size for via drill (i.e.
LAYER_T m_type
The type of the layer.
Definition: class_board.h:107
ZONE_CONTAINER * m_CurrentZoneContour
zone contour currently in progress
Definition: class_board.h:249
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:199
void SetCustomViaSize(int aSize)
Function SetCustomViaSize Sets custom size for via diameter (i.e.
static const wxChar A4[]
Definition: page_info.h:64
#define _(s)
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 ...
static PCB_GENERAL_SETTINGS dummyGeneralSettings(FRAME_PCB_EDITOR)
NETCLASSPTR GetDefault() const
Function GetDefault.
int m_fileFormatVersionAtLoad
the version loaded from the file
Definition: class_board.h:190
PCB_GENERAL_SETTINGS * m_generalSettings
reference only; I have no ownership
Definition: class_board.h:195
LAYER m_Layer[PCB_LAYER_ID_COUNT]
Definition: class_board.h:184
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: class_board.h:192
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
BOARD_DESIGN_SETTINGS m_designSettings
Definition: class_board.h:194
BOARD_ITEM_CONTAINER(BOARD_ITEM *aParent, KICAD_T aType)
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:813
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:647

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

142 {
143  while( m_ZoneDescriptorList.size() )
144  {
145  ZONE_CONTAINER* area_to_remove = m_ZoneDescriptorList[0];
146  Delete( area_to_remove );
147  }
148 
149  // Clean up the owned elements
150  DeleteMARKERs();
152 
153  // Delete the modules
154  for( auto m : m_modules )
155  delete m;
156 
157  m_modules.clear();
158 
159  // Delete the tracks
160  for( auto t : m_tracks )
161  delete t;
162 
163  m_tracks.clear();
164 
165  // Delete the drawings
166  for (auto d : m_drawings )
167  delete d;
168 
169  m_drawings.clear();
170 
171  delete m_CurrentZoneContour;
172  m_CurrentZoneContour = NULL;
173 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:176
Class 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:249
TRACKS m_tracks
TRACKS for traces on the board, owned by pointer.
Definition: class_board.h:179
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:173
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:182
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, and m_ZoneDescriptorList.

Member Function Documentation

◆ Add()

void BOARD::Add ( BOARD_ITEM aItem,
ADD_MODE  aMode = ADD_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 525 of file class_board.cpp.

526 {
527  if( aBoardItem == NULL )
528  {
529  wxFAIL_MSG( wxT( "BOARD::Add() param error: aBoardItem NULL" ) );
530  return;
531  }
532 
533  switch( aBoardItem->Type() )
534  {
535  case PCB_NETINFO_T:
536  m_NetInfo.AppendNet( (NETINFO_ITEM*) aBoardItem );
537  break;
538 
539  // this one uses a vector
540  case PCB_MARKER_T:
541  m_markers.push_back( (MARKER_PCB*) aBoardItem );
542  break;
543 
544  // this one uses a vector
545  case PCB_ZONE_AREA_T:
546  m_ZoneDescriptorList.push_back( (ZONE_CONTAINER*) aBoardItem );
547  break;
548 
549  case PCB_TRACE_T:
550  case PCB_VIA_T:
551 
552  // N.B. This inserts a small memory leak as we lose the
553  if( !IsCopperLayer( aBoardItem->GetLayer() ) )
554  {
555  wxFAIL_MSG( wxT( "BOARD::Add() Cannot place Track on non-copper layer" ) );
556  return;
557  }
558 
559  if( aMode == ADD_APPEND )
560  m_tracks.push_back( static_cast<TRACK*>( aBoardItem ) );
561  else
562  m_tracks.push_front( static_cast<TRACK*>( aBoardItem ) );
563 
564  break;
565 
566  case PCB_MODULE_T:
567  if( aMode == ADD_APPEND )
568  m_modules.push_back( (MODULE*) aBoardItem );
569  else
570  m_modules.push_front( (MODULE*) aBoardItem );
571 
572  break;
573 
574  case PCB_DIMENSION_T:
575  case PCB_LINE_T:
576  case PCB_TEXT_T:
577  case PCB_TARGET_T:
578  if( aMode == ADD_APPEND )
579  m_drawings.push_back( aBoardItem );
580  else
581  m_drawings.push_front( aBoardItem );
582 
583  break;
584 
585  // other types may use linked list
586  default:
587  {
588  wxString msg;
589  msg.Printf( wxT( "BOARD::Add() needs work: BOARD_ITEM type (%d) not handled" ),
590  aBoardItem->Type() );
591  wxFAIL_MSG( msg );
592  return;
593  }
594  break;
595  }
596 
597  aBoardItem->SetParent( this );
598  aBoardItem->ClearEditFlags();
599  m_connectivity->Add( aBoardItem );
600 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:176
Class 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:101
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:203
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:92
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:199
TRACKS m_tracks
TRACKS for traces on the board, owned by pointer.
Definition: class_board.h:179
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
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:225
MARKERS m_markers
MARKER_PCBs for clearance problems, owned by pointer.
Definition: class_board.h:170
DRAWINGS m_drawings
BOARD_ITEMs for drawings on the board, owned by pointer.
Definition: class_board.h:173
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:99
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:100
Class NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
class MARKER_PCB, a marker used to show something
Definition: typeinfo.h:98
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:182
class NETINFO_ITEM, a description of a net
Definition: typeinfo.h:103
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: class_board.h:192
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:283
KICAD_T Type() const
Function Type()
Definition: base_struct.h:210

References ADD_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, 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(), Duplicate(), 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,
int  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 1546 of file class_board.cpp.

1548 {
1549  ZONE_CONTAINER* new_area = InsertArea( aNetcode,
1550  m_ZoneDescriptorList.size( ) - 1,
1551  aLayer, aStartPointPosition.x,
1552  aStartPointPosition.y, aHatch );
1553 
1554  if( aNewZonesList )
1555  {
1556  ITEM_PICKER picker( new_area, UR_NEW );
1557  aNewZonesList->PushItem( picker );
1558  }
1559 
1560  return new_area;
1561 }
Class 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, int 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:182

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

Referenced by NormalizeAreaPolygon().

◆ AllConnectedItems()

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

Definition at line 1756 of file class_board.cpp.

1757 {
1758  std::vector<BOARD_CONNECTED_ITEM*> items;
1759 
1760  for( auto track : Tracks() )
1761  {
1762  items.push_back( track );
1763  }
1764 
1765  for( auto mod : Modules() )
1766  {
1767  for( auto pad : mod->Pads() )
1768  {
1769  items.push_back( pad );
1770  }
1771  }
1772 
1773  for( int i = 0; i<GetAreaCount(); i++ )
1774  {
1775  auto zone = GetArea( i );
1776  items.push_back( zone );
1777  }
1778 
1779  return items;
1780 }
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:949
MODULES & Modules()
Definition: class_board.h:227
size_t i
Definition: json11.cpp:649
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:914
#define mod(a, n)
Definition: greymap.cpp:24
TRACKS & Tracks()
Definition: class_board.h:218

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

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

◆ Back()

EDA_ITEM* EDA_ITEM::Back ( ) const
inlineinherited

Definition at line 219 of file base_struct.h.

219 { return Pback; }
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:177

References EDA_ITEM::Pback.

Referenced by DHEAD::insert(), and DHEAD::remove().

◆ BeginNets()

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

Function BeginNets.

Returns
iterator to the first element of the NETINFO_ITEMs list

Definition at line 748 of file class_board.h.

749  {
750  return m_NetInfo.begin();
751  }
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:199
iterator begin() const
Definition: netinfo.h:526

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

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

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

718  {
720  }
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:199
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 209 of file class_board.h.

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

References PCB_T, and EDA_ITEM::Type().

◆ ClearAllNetCodes()

void BOARD::ClearAllNetCodes ( )

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

Definition at line 1783 of file class_board.cpp.

1784 {
1785  for ( BOARD_CONNECTED_ITEM* item : AllConnectedItems() )
1786  item->SetNetCode( 0 );
1787 }
Class BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected an...
const std::vector< BOARD_CONNECTED_ITEM * > AllConnectedItems()

References AllConnectedItems().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 245 of file base_struct.h.

245 { 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:266

References BRIGHTENED, and EDA_ITEM::ClearFlags().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_SELECTION_TOOL::unhighlight(), EE_SELECTION_TOOL::unhighlight(), SELECTION_TOOL::unhighlight(), and SCH_EDITOR_CONTROL::UpdateNetHighlighting().

◆ ClearEditFlags()

◆ ClearFlags()

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

Definition at line 266 of file base_struct.h.

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

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(), EDIT_POINTS_FACTORY::Make(), 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_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 244 of file base_struct.h.

244 { 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:266

References EDA_ITEM::ClearFlags(), and HIGHLIGHTED.

◆ ClearSelected()

void EDA_ITEM::ClearSelected ( )
inlineinherited

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 278 of file base_struct.h.

279  {
281  }
#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:266
#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  {
155  m_viewPrivData = NULL;
156  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:161

References KIGFX::VIEW_ITEM::m_viewPrivData.

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

Definition at line 121 of file base_struct.cpp.

122 {
123  wxCHECK_MSG( false, NULL, wxT( "Clone not implemented in derived class " ) + GetClass() +
124  wxT( ". Bad programmer!" ) );
125 }
virtual wxString GetClass() const =0
Function GetClass returns the class name.

References EDA_ITEM::GetClass().

Referenced by LIB_DRAWING_TOOLS::DrawShape(), LIB_EDIT_TOOL::Duplicate(), SCH_ITEM::Duplicate(), Duplicate(), LIB_PART::LIB_PART(), LIB_EDIT_FRAME::LoadOneSymbol(), new_clone(), LIB_EDIT_TOOL::Paste(), SCH_LEGACY_PLUGIN_CACHE::removeSymbol(), SCH_EDIT_TOOL::RepeatDrawItem(), 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().

◆ Colors()

const COLORS_DESIGN_SETTINGS& BOARD::Colors ( ) const
inline

Function GetColorSettings.

Returns
the current COLORS_DESIGN_SETTINGS in use

Definition at line 561 of file class_board.h.

561 { return m_generalSettings->Colors(); }
COLORS_DESIGN_SETTINGS & Colors()
PCB_GENERAL_SETTINGS * m_generalSettings
reference only; I have no ownership
Definition: class_board.h:195

References PCB_GENERAL_SETTINGS::Colors().

Referenced by BRDITEMS_PLOTTER::getColor(), CINFO3D_VISU::GetItemColor(), CINFO3D_VISU::GetLayerColor(), BRDITEMS_PLOTTER::PlotDimension(), PlotSilkScreen(), and PlotStandardLayer().

◆ 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 }
Class 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:203
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:246
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:234
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:630
unsigned GetPriority() const
Function GetPriority.
Definition: class_zone.h:103
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:182
const BOX2I BBox(int aClearance=0) const override
Function BBox()
int GetLocalFlags() const
Definition: class_zone.h:240

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:246
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:249
Class 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...
Definition: class_zone.cpp:987
void SetLocalFlags(int aFlags)
Definition: class_zone.h:241

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

761 {
762  EDA_RECT area;
763  LSET visible = GetVisibleLayers();
764  bool showInvisibleText = IsElementVisible( LAYER_MOD_TEXT_INVISIBLE )
765  && PgmOrNull() && !PgmOrNull()->m_Printing;
766 
767  // Check segments, dimensions, texts, and fiducials
768  for( auto item : m_drawings )
769  {
770  if( aBoardEdgesOnly && ( item->GetLayer() != Edge_Cuts ) )
771  continue;
772 
773  if( ( item->GetLayerSet() & visible ).any() )
774  area.Merge( item->GetBoundingBox() );
775  }
776 
777  // Check modules
778  for( auto module : m_modules )
779  {
780  if( !( module->GetLayerSet() & visible ).any() )
781  continue;
782 
783  if( aBoardEdgesOnly )
784  {
785  for( const auto edge : module->GraphicalItems() )
786  {
787  if( edge->GetLayer() == Edge_Cuts )
788  area.Merge( edge->GetBoundingBox() );
789  }
790  }
791  else
792  {
793  area.Merge( module->GetBoundingBox( showInvisibleText ) );
794  }
795  }
796 
797  if( !aBoardEdgesOnly )
798  {
799  // Check tracks
800  for( auto track : m_tracks )
801  {
802  if( ( track->GetLayerSet() & visible ).any() )
803  area.Merge( track->GetBoundingBox() );
804  }
805 
806  // Check zones
807  for( auto aZone : m_ZoneDescriptorList )
808  {
809  if( ( aZone->GetLayerSet() & visible ).any() )
810  area.Merge( aZone->GetBoundingBox() );
811  }
812  }
813 
814  return area;
815 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:176
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:179
Class LSET is a set of PCB_LAYER_IDs.
PGM_BASE * PgmOrNull()
similat to PGM_BASE& Pgm(), but return a reference that can be nullptr when running a shared lib from...
Definition: cvpcb.cpp:110
DRAWINGS m_drawings
BOARD_ITEMs for drawings on the board, owned by pointer.
Definition: class_board.h:173
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:358
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:182
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44

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 65 of file board_items_to_polygon_shape_transform.cpp.

66 {
67  // convert tracks and vias:
68  for( auto track : m_tracks )
69  {
70  if( !track->IsOnLayer( aLayer ) )
71  continue;
72 
73  track->TransformShapeWithClearanceToPolygon( aOutlines, 0 );
74  }
75 
76  // convert pads
77  for( auto module : m_modules )
78  {
79  module->TransformPadsShapesWithClearanceToPolygon( aLayer, aOutlines, 0 );
80 
81  // Micro-wave modules may have items on copper layers
82  module->TransformGraphicShapesWithClearanceToPolygonSet( aLayer, aOutlines, 0 );
83  }
84 
85  // convert copper zones
86  for( int ii = 0; ii < GetAreaCount(); ii++ )
87  {
88  ZONE_CONTAINER* zone = GetArea( ii );
89  PCB_LAYER_ID zonelayer = zone->GetLayer();
90 
91  if( zonelayer == aLayer )
92  zone->TransformSolidAreasShapesToPolygonSet( aOutlines );
93  }
94 
95  // convert graphic items on copper layers (texts)
96  for( auto item : m_drawings )
97  {
98  if( !item->IsOnLayer( aLayer ) )
99  continue;
100 
101  switch( item->Type() )
102  {
103  case PCB_LINE_T:
104  ( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon( aOutlines, 0 );
105  break;
106 
107  case PCB_TEXT_T:
108  ( (TEXTE_PCB*) item )->TransformShapeWithClearanceToPolygonSet( aOutlines, 0 );
109  break;
110 
111  default:
112  break;
113  }
114  }
115 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:176
Class 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:203
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:179
PCB_LAYER_ID
A quick note on layer IDs:
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:949
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:173
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:914
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 62 of file board_item_container.h.

63  {
64  Remove( aItem );
65  delete aItem;
66  }
virtual void Remove(BOARD_ITEM *aItem)=0
Removes an item from the container.

References BOARD_ITEM_CONTAINER::Remove().

Referenced by DRC_LIST_MARKERS::DeleteItem(), BOARD_COMMIT::Push(), RemoveArea(), and ~BOARD().

◆ DeleteAllModules()

void BOARD::DeleteAllModules ( )
inline

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

Definition at line 284 of file class_board.h.

285  {
286  for( MODULE* mod : m_modules )
287  delete mod;
288 
289  m_modules.clear();
290  }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:176
#define mod(a, n)
Definition: greymap.cpp:24

References mod.

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

680 {
681  // the vector does not know how to delete the MARKER_PCB, it holds pointers
682  for( MARKER_PCB* marker : m_markers )
683  delete marker;
684 
685  m_markers.clear();
686 }
MARKERS m_markers
MARKER_PCBs for clearance problems, owned by pointer.
Definition: class_board.h:170

References m_markers.

Referenced by DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), DRC_LIST_MARKERS::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 689 of file class_board.cpp.

690 {
691  // the vector does not know how to delete the ZONE Outlines, it holds pointers
692  for( ZONE_CONTAINER* zone : m_ZoneDescriptorList )
693  delete zone;
694 
695  m_ZoneDescriptorList.clear();
696 }
Class 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:182

References m_ZoneDescriptorList.

Referenced by ~BOARD().

◆ Drawings()

◆ Duplicate()

BOARD_ITEM * BOARD::Duplicate ( const BOARD_ITEM aItem,
bool  aAddToBoard = false 
)

Definition at line 1653 of file class_board.cpp.

1654 {
1655  BOARD_ITEM* new_item = NULL;
1656 
1657  switch( aItem->Type() )
1658  {
1659  case PCB_MODULE_T:
1660  case PCB_TEXT_T:
1661  case PCB_LINE_T:
1662  case PCB_TRACE_T:
1663  case PCB_VIA_T:
1664  case PCB_ZONE_AREA_T:
1665  case PCB_TARGET_T:
1666  case PCB_DIMENSION_T:
1667  new_item = static_cast<BOARD_ITEM*>( aItem->Clone() );
1668  break;
1669 
1670  default:
1671  // Un-handled item for duplication
1672  new_item = NULL;
1673  break;
1674  }
1675 
1676  if( new_item && aAddToBoard )
1677  Add( new_item );
1678 
1679  return new_item;
1680 }
Class 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:101
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:92
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
class MODULE, a footprint
Definition: typeinfo.h:89
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_INSERT) override
Adds an item to the container.
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:99
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:100
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
KICAD_T Type() const
Function Type()
Definition: base_struct.h:210

References Add(), EDA_ITEM::Clone(), PCB_DIMENSION_T, PCB_LINE_T, PCB_MODULE_T, PCB_TARGET_T, PCB_TEXT_T, PCB_TRACE_T, PCB_VIA_T, PCB_ZONE_AREA_T, and EDA_ITEM::Type().

Referenced by EDIT_TOOL::Duplicate(), and ARRAY_CREATOR::Invoke().

◆ EndNets()

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

Function EndNets.

Returns
iterator to the last element of the NETINFO_ITEMs list

Definition at line 757 of file class_board.h.

758  {
759  return m_NetInfo.end();
760  }
iterator end() const
Definition: netinfo.h:531
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:199

References NETINFO_LIST::end().

◆ FindModule()

MODULE * BOARD::FindModule ( const wxString &  aRefOrTimeStamp,
bool  aSearchByTimeStamp = false 
) const

Function FindModule searches for a module matching aRefOrTimeStamp depending on the state of aSearchByTimeStamp.

Parameters
aRefOrTimeStampis the search string.
aSearchByTimeStampsearches by the module time stamp value if true. Otherwise search by reference designator.
Returns
MODULE* - If found, the module meeting the search criteria, else NULL.

Definition at line 1078 of file class_board.cpp.

1079 {
1080  if( aSearchByTimeStamp )
1081  {
1082  for( auto module : m_modules )
1083  {
1084  if( aRefOrTimeStamp.CmpNoCase( module->GetPath() ) == 0 )
1085  return module;
1086  }
1087  }
1088  else
1089  {
1090  return FindModuleByReference( aRefOrTimeStamp );
1091  }
1092 
1093  return NULL;
1094 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:176
MODULE * FindModuleByReference(const wxString &aReference) const
Function FindModuleByReference searches for a MODULE within this board with the given reference desig...

References FindModuleByReference(), and 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 1050 of file class_board.cpp.

1051 {
1052  MODULE* found = nullptr;
1053 
1054  // search only for MODULES
1055  static const KICAD_T scanTypes[] = { PCB_MODULE_T, EOT };
1056 
1057  INSPECTOR_FUNC inspector = [&] ( EDA_ITEM* item, void* testData )
1058  {
1059  MODULE* module = (MODULE*) item;
1060 
1061  if( aReference == module->GetReference() )
1062  {
1063  found = module;
1064  return SEARCH_QUIT;
1065  }
1066 
1067  return SEARCH_CONTINUE;
1068  };
1069 
1070  // visit this BOARD with the above inspector
1071  BOARD* nonconstMe = (BOARD*) this;
1072  nonconstMe->Visit( inspector, NULL, scanTypes );
1073 
1074  return found;
1075 }
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:432
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
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:161
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163

References EOT, MODULE::GetReference(), PCB_MODULE_T, SEARCH_CONTINUE, SEARCH_QUIT, and Visit().

Referenced by PCB_EDIT_FRAME::ExecuteRemoteCommand(), FindModule(), 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 1029 of file class_board.cpp.

1030 {
1031  // the first valid netcode is 1 and the last is m_NetInfo.GetCount()-1.
1032  // zero is reserved for "no connection" and is not actually a net.
1033  // NULL is returned for non valid netcodes
1034 
1035  wxASSERT( m_NetInfo.GetNetCount() > 0 );
1036 
1037  if( aNetcode == NETINFO_LIST::UNCONNECTED && m_NetInfo.GetNetCount() == 0 )
1039  else
1040  return m_NetInfo.GetNetItem( aNetcode );
1041 }
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:199
static NETINFO_ITEM ORPHANED_ITEM
NETINFO_ITEM meaning that there was no net assigned for an item, as there was no board storing net li...
Definition: netinfo.h:471
unsigned GetNetCount() const
Function GetNetCount.
Definition: netinfo.h:436
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:463

References NETINFO_LIST::GetNetCount(), NETINFO_LIST::GetNetItem(), m_NetInfo, NETINFO_LIST::ORPHANED_ITEM, 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 1044 of file class_board.cpp.

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

Definition at line 266 of file class_board_item.h.

267  {
268  wxMessageBox( wxT( "virtual BOARD_ITEM::Flip used, should not occur" ), GetClass() );
269  }
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 271 of file class_board_item.h.

272  {
273  Flip( wxPoint( aCentre.x, aCentre.y ), aFlipLeftRight );
274  }
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 PCB_GENERAL_SETTINGS& BOARD::GeneralSettings ( ) const
inline

Definition at line 563 of file class_board.h.

563 { return *m_generalSettings; }
PCB_GENERAL_SETTINGS * m_generalSettings
reference only; I have no ownership
Definition: class_board.h:195

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

◆ GetArea()

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

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

929  {
930  for( int ii = 0; ii < GetAreaCount(); ii++ ) // Search for aArea in list
931  {
932  if( aArea == GetArea( ii ) ) // Found !
933  return ii;
934  }
935 
936  return -1;
937  }
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:949
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:914

◆ 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
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:161
BOARD_ITEM_CONTAINER * GetParent() const
KICAD_T Type() const
Function Type()
Definition: base_struct.h:210

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

Referenced by ZONE_CONTAINER::BuildSmoothedPoly(), DRC::checkClearancePadToPad(), DRC::checkClearanceSegmToPad(), TEXTE_PCB::Flip(), TRACK::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 792 of file class_board.h.

793  {
794  return ComputeBoundingBox( true );
795  }
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 1694 of file class_board.cpp.

1695 {
1696 
1697  bool success = BuildBoardPolygonOutlines( this, aOutlines, aErrorText,
1698  GetDesignSettings().m_MaxError, aErrorLocation );
1699 
1700  // Make polygon strictly simple to avoid issues (especially in 3D viewer)
1702 
1703  return success;
1704 
1705 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:531
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 780 of file class_board.h.

781  {
782  return ComputeBoundingBox( false );
783  }
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().

◆ GetClass()

wxString BOARD::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Implements EDA_ITEM.

Definition at line 866 of file class_board.h.

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

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

302  {
303  return m_connectivity;
304  }
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: class_board.h:192

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

402 {
404 }
BOARD_DESIGN_SETTINGS m_designSettings
Definition: class_board.h:194
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(), VIA::Flip(), ZONE_CONTAINER::Flip(), DSN::SPECCTRA_DB::FromBOARD(), GetGerberFileFunctionAttribute(), CINFO3D_VISU::InitSettings(), PCBNEW_CONTROL::LayerNext(), PCBNEW_CONTROL::LayerPrev(), 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 531 of file class_board.h.

532  {
533  // remove const-ness with cast. TODO(snh): Make GetDesignSettings const
534  return const_cast<BOARD_DESIGN_SETTINGS&>( m_designSettings );
535  }
BOARD_DESIGN_SETTINGS m_designSettings
Definition: class_board.h:194

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_CONTROL::DIALOG_DRC_CONTROL(), 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(), FOOTPRINT_EDIT_FRAME::GetDesignSettings(), PCB_BASE_FRAME::GetDesignSettings(), BOARD_CONNECTED_ITEM::GetNetClass(), PCB_EDIT_FRAME::GetProjectFileParameters(), DRAWING_TOOL::getSegmentWidth(), D_PAD::GetSolderMaskMargin(), PANEL_SETUP_MASK_AND_PASTE::ImportSettingsFrom(), PANEL_SETUP_FEATURE_CONSTRAINTS::ImportSettingsFrom(), PANEL_SETUP_TEXT_AND_GRAPHICS::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_CONTROL::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_LAYERS::ReadParam(), PCB_LAYER_WIDGET::ReFillRender(), DRC_COURTYARD_OVERLAP::RunDRC(), DRC::RunTests(), SaveBoard(), PARAM_CFG_LAYERS::SaveParam(), NETINFO_ITEM::SetClass(), PNS::DIFF_PAIR_PLACER::Start(), PNS_KICAD_IFACE::SyncWorld(), DRC::testDrilledHoles(), DRC::testNetClasses(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow(), ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon(), TRACK_WIDTH_MENU::update(), DIFF_PAIR_MENU::update(), POINT_EDITOR::updateItem(), MODULE::ViewBBox(), and HYPERLYNX_EXPORTER::writeStackupInfo().

◆ GetEditFlags()

STATUS_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 270 of file base_struct.h.

271  {
275  return m_Flags & mask;
276  }
#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:154
#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:187
#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::editComponentFieldText(), SCH_EDITOR_CONTROL::EditWithLibEdit(), LIB_MOVE_TOOL::Main(), POINT_EDITOR::OnSelectionChange(), Print(), 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_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), and DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow().

◆ GetEnabledLayers()

LSET BOARD::GetEnabledLayers ( ) const

◆ GetFileFormatVersionAtLoad()

int BOARD::GetFileFormatVersionAtLoad ( ) const
inline

Definition at line 266 of file class_board.h.

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

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ GetFileName()

const wxString& BOARD::GetFileName ( ) const
inline

Definition at line 216 of file class_board.h.

216 { return m_fileName; }
wxString m_fileName
the board filename
Definition: class_board.h:167

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(), DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick(), 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_CONTROL::writeReport().

◆ GetFirstModule()

MODULE* BOARD::GetFirstModule ( ) const
inline

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

1457 {
1458  MODULE* module = NULL;
1459  MODULE* alt_module = NULL;
1460  int min_dim = 0x7FFFFFFF;
1461  int alt_min_dim = 0x7FFFFFFF;
1462  bool current_layer_back = IsBackLayer( aActiveLayer );
1463 
1464  for( auto pt_module : m_modules )
1465  {
1466  // is the ref point within the module's bounds?
1467  if( !pt_module->HitTest( aPosition ) )
1468  continue;
1469 
1470  // if caller wants to ignore locked modules, and this one is locked, skip it.
1471  if( aIgnoreLocked && pt_module->IsLocked() )
1472  continue;
1473 
1474  PCB_LAYER_ID layer = pt_module->GetLayer();
1475 
1476  // Filter non visible modules if requested
1477  if( !aVisibleOnly || IsModuleLayerVisible( layer ) )
1478  {
1479  EDA_RECT bb = pt_module->GetFootprintRect();
1480 
1481  int offx = bb.GetX() + bb.GetWidth() / 2;
1482  int offy = bb.GetY() + bb.GetHeight() / 2;
1483 
1484  // off x & offy point to the middle of the box.
1485  int dist = ( aPosition.x - offx ) * ( aPosition.x - offx ) +
1486  ( aPosition.y - offy ) * ( aPosition.y - offy );
1487 
1488  if( current_layer_back == IsBackLayer( layer ) )
1489  {
1490  if( dist <= min_dim )
1491  {
1492  // better footprint shown on the active side
1493  module = pt_module;
1494  min_dim = dist;
1495  }
1496  }
1497  else if( aVisibleOnly && IsModuleLayerVisible( layer ) )
1498  {
1499  if( dist <= alt_min_dim )
1500  {
1501  // better footprint shown on the other side
1502  alt_module = pt_module;
1503  alt_min_dim = dist;
1504  }
1505  }
1506  }
1507  }
1508 
1509  if( module )
1510  {
1511  return module;
1512  }
1513 
1514  if( alt_module)
1515  {
1516  return alt_module;
1517  }
1518 
1519  return NULL;
1520 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:176
static const int dist[10][10]
Definition: ar_matrix.cpp:320
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:
int GetHeight() const
Definition: eda_rect.h:120
Class 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(), and m_modules.

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

377 { return m_highLight.m_netCode; }
HIGH_LIGHT_INFO m_highLight
Definition: class_board.h:187

References HIGH_LIGHT_INFO::m_netCode.

Referenced by DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildFilterLists().

◆ GetItem()

BOARD_ITEM * BOARD::GetItem ( void *  aWeakReference)

Definition at line 699 of file class_board.cpp.

700 {
701  for( TRACK* track : Tracks() )
702  if( track == aWeakReference )
703  return track;
704 
705  for( MODULE* module : Modules() )
706  {
707  if( module == aWeakReference )
708  return module;
709 
710  for( D_PAD* pad : module->Pads() )
711  if( pad == aWeakReference )
712  return pad;
713 
714  if( &module->Reference() == aWeakReference )
715  return &module->Reference();
716 
717  if( &module->Value() == aWeakReference )
718  return &module->Value();
719 
720  for( BOARD_ITEM* drawing : module->GraphicalItems() )
721  if( drawing == aWeakReference )
722  return drawing;
723  }
724 
725  for( ZONE_CONTAINER* zone : Zones() )
726  if( zone == aWeakReference )
727  return zone;
728 
729  for( BOARD_ITEM* drawing : Drawings() )
730  if( drawing == aWeakReference )
731  return drawing;
732 
733  // Not found; weak reference has been deleted.
734  return &g_DeletedItem;
735 }
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
DELETED_BOARD_ITEM g_DeletedItem
Definition: class_board.cpp:87
MODULES & Modules()
Definition: class_board.h:227
ZONE_CONTAINERS & Zones()
Definition: class_board.h:241
DRAWINGS & Drawings()
Definition: class_board.h:236
TRACKS & Tracks()
Definition: class_board.h:218

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

Referenced by DRC_ITEM::GetAuxiliaryItem(), and DRC_ITEM::GetMainItem().

◆ 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(), 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::syncGraphicalItem(), PNS_KICAD_IFACE::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(), TEXTE_MODULE::ViewGetLayers(), TRACK::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 260 of file class_board.cpp.

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

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.
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:161
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:647

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(), TEXTE_MODULE::GetSelectMenuText(), TRACK::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 284 of file class_board.cpp.

285 {
286  // All layer names are stored in the BOARD.
287  if( IsLayerEnabled( aLayer ) )
288  {
289  // Standard names were set in BOARD::BOARD() but they may be
290  // over-ridden by BOARD::SetLayerName().
291  // For copper layers, return the actual copper layer name,
292  // otherwise return the Standard English layer name.
293  if( IsCopperLayer( aLayer ) )
294  return m_Layer[aLayer].m_name;
295  }
296 
297  return GetStandardLayerName( aLayer );
298 }
wxString m_name
The name of the layer, there should be no spaces in this name.
Definition: class_board.h:106
bool IsLayerEnabled(PCB_LAYER_ID aLayer) const
Function IsLayerEnabled is a proxy function that calls the correspondent function in m_BoardSettings ...
Definition: class_board.h:438
LAYER m_Layer[PCB_LAYER_ID_COUNT]
Definition: class_board.h:184
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:647

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

328 {
329  if( !IsCopperLayer( aLayer ) )
330  return LT_SIGNAL;
331 
332  //@@IMB: The original test was broken due to the discontinuity
333  // in the layer sequence.
334  if( IsLayerEnabled( aLayer ) )
335  return m_Layer[aLayer].m_type;
336 
337  return LT_SIGNAL;
338 }
LAYER_T m_type
The type of the layer.
Definition: class_board.h:107
bool IsLayerEnabled(PCB_LAYER_ID aLayer) const
Function IsLayerEnabled is a proxy function that calls the correspondent function in m_BoardSettings ...
Definition: class_board.h:438
LAYER m_Layer[PCB_LAYER_ID_COUNT]
Definition: class_board.h:184
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().

◆ GetList()

DHEAD* EDA_ITEM::GetList ( ) const
inlineinherited

Definition at line 221 of file base_struct.h.

221 { return m_List; }
DHEAD * m_List
which DLIST I am on.
Definition: base_struct.h:178

References EDA_ITEM::m_List.

Referenced by DHEAD::insert(), DHEAD::remove(), and GERBER_DRAW_ITEM::UnLink().

◆ GetMARKER()

MARKER_PCB* BOARD::GetMARKER ( int  index) const
inline

Function GetMARKER returns the MARKER at a given index.

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

Definition at line 332 of file class_board.h.

333  {
334  if( (unsigned) index < m_markers.size() )
335  return m_markers[index];
336 
337  return NULL;
338  }
MARKERS m_markers
MARKER_PCBs for clearance problems, owned by pointer.
Definition: class_board.h:170

Referenced by DRC_LIST_MARKERS::DeleteItem(), PCB_DRAW_PANEL_GAL::DisplayBoard(), DRC_LIST_MARKERS::GetItem(), and DIALOG_FIND::search().

◆ GetMARKERCount()

int BOARD::GetMARKERCount ( ) const
inline

Function GetMARKERCount.

Returns
int - The number of MARKER_PCBS.

Definition at line 344 of file class_board.h.

345  {
346  return (int) m_markers.size();
347  }
MARKERS m_markers
MARKER_PCBs for clearance problems, owned by pointer.
Definition: class_board.h:170

Referenced by PCB_DRAW_PANEL_GAL::DisplayBoard(), DRC_LIST_MARKERS::GetCount(), and DIALOG_FIND::search().

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

Definition at line 251 of file base_struct.cpp.

252 {
253  return dummy_xpm;
254 }
static const BITMAP_OPAQUE dummy_xpm[1]
Definition: base_struct.cpp:54

References dummy_xpm.

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

◆ GetMsgPanelInfo()

void BOARD::GetMsgPanelInfo ( EDA_UNITS_T  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 818 of file class_board.cpp.

819 {
820  wxString txt;
821  int viasCount = 0;
822  int trackSegmentsCount = 0;
823 
824  for( auto item : m_tracks )
825  {
826  if( item->Type() == PCB_VIA_T )
827  viasCount++;
828  else
829  trackSegmentsCount++;
830  }
831 
832  txt.Printf( wxT( "%d" ), GetPadCount() );
833  aList.emplace_back( _( "Pads" ), txt, DARKGREEN );
834 
835  txt.Printf( wxT( "%d" ), viasCount );
836  aList.emplace_back( _( "Vias" ), txt, DARKGREEN );
837 
838  txt.Printf( wxT( "%d" ), trackSegmentsCount );
839  aList.emplace_back( _( "Track Segments" ), txt, DARKGREEN );
840 
841  txt.Printf( wxT( "%d" ), GetNodesCount() );
842  aList.emplace_back( _( "Nodes" ), txt, DARKCYAN );
843 
844  txt.Printf( wxT( "%d" ), m_NetInfo.GetNetCount() - 1 /* Don't include "No Net" in count */ );
845  aList.emplace_back( _( "Nets" ), txt, RED );
846 
847  txt.Printf( wxT( "%d" ), GetConnectivity()->GetUnconnectedCount() );
848  aList.emplace_back( _( "Unrouted" ), txt, BLUE );
849 }
Definition: colors.h:57
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:199
TRACKS m_tracks
TRACKS for traces on the board, owned by pointer.
Definition: class_board.h:179
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:301
Definition: colors.h:60
#define _(s)
unsigned GetPadCount()
Function GetPadCount.
unsigned GetNetCount() const
Function GetNetCount.
Definition: netinfo.h:436
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 767 of file class_board.h.

768  {
769  return m_NetInfo.GetNetCount();
770  }
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:199
unsigned GetNetCount() const
Function GetNetCount.
Definition: netinfo.h:436

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

739 {
740  unsigned retval = 0;
741  for( auto mod : Modules() )
742  {
743  for( auto pad : mod->Pads() )
744  {
745  if( ( aNet == -1 && pad->GetNetCode() > 0 ) || aNet == pad->GetNetCode() )
746  retval++;
747  }
748  }
749 
750  return retval;
751 }
MODULES & Modules()
Definition: class_board.h:227
#define mod(a, n)
Definition: greymap.cpp:24

References mod, and 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 1737 of file class_board.cpp.

1738 {
1739  unsigned count = 0;
1740 
1741  for( auto mod : m_modules )
1742  {
1743  for( auto pad : mod->Pads() )
1744  {
1745  if( count == aIndex )
1746  return pad;
1747 
1748  count++;
1749  }
1750  }
1751 
1752  return nullptr;
1753 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:176
#define mod(a, n)
Definition: greymap.cpp:24

References m_modules, and mod.

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

1235 {
1236  if( !aLayerSet.any() )
1237  aLayerSet = LSET::AllCuMask();
1238 
1239  for( auto module : m_modules )
1240  {
1241  D_PAD* pad = NULL;
1242 
1243  if( module->HitTest( aPosition ) )
1244  pad = module->GetPad( aPosition, aLayerSet );
1245 
1246  if( pad )
1247  return pad;
1248  }
1249 
1250  return NULL;
1251 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:176
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:676

References LSET::AllCuMask(), and m_modules.

◆ GetPad() [3/5]

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

Definition at line 1071 of file class_board.h.

1072  {
1073  return GetPad( aPosition, LSET().set() );
1074  }
D_PAD * GetPad(unsigned aIndex) const
Function GetPad.
Class 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 1254 of file class_board.cpp.

1255 {
1256  const wxPoint& aPosition = aTrace->GetEndPoint( aEndPoint );
1257 
1258  LSET lset( aTrace->GetLayer() );
1259 
1260  return GetPad( aPosition, lset );
1261 }
D_PAD * GetPad(unsigned aIndex) const
Function GetPad.
Class 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:113
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 1283 of file class_board.cpp.

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

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

◆ GetPadCount()

unsigned BOARD::GetPadCount ( )

Function GetPadCount.

Returns
the number of pads in board

Definition at line 1722 of file class_board.cpp.

1723 {
1724  unsigned retval = 0;
1725 
1726  for( auto mod : Modules() )
1727  retval += mod->Pads().size();
1728 
1729  return retval;
1730 }
MODULES & Modules()
Definition: class_board.h:227
#define mod(a, n)
Definition: greymap.cpp:24

References mod, and 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 1264 of file class_board.cpp.

1265 {
1266  for( auto mod : Modules() )
1267  {
1268  for ( auto pad : mod->Pads() )
1269  {
1270  if( pad->GetPosition() != aPosition )
1271  continue;
1272 
1273  // Pad found, it must be on the correct layer
1274  if( ( pad->GetLayerSet() & aLayerSet ).any() )
1275  return pad;
1276  }
1277  }
1278 
1279  return nullptr;
1280 }
MODULES & Modules()
Definition: class_board.h:227
#define mod(a, n)
Definition: greymap.cpp:24

References mod, and 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 1708 of file class_board.cpp.

1709 {
1710  std::vector<D_PAD*> allPads;
1711 
1712  for( MODULE* mod : Modules() )
1713  {
1714  for( D_PAD* pad : mod->Pads() )
1715  allPads.push_back( pad );
1716  }
1717 
1718  return allPads;
1719 }
MODULES & Modules()
Definition: class_board.h:227
#define mod(a, n)
Definition: greymap.cpp:24

References mod, and 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:180
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(), EditToolSelectionFilter(), PCB_IO::format(), FormatProbeItem(), BOARD_ITEM::GetBoard(), 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(), 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 182 of file class_board.cpp.

183 {
184  return ZeroOffset;
185 }
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_T  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 673 of file class_board.cpp.

674 {
675  return wxString::Format( _( "PCB" ) );
676 }
#define _(s)
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 _, 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 1390 of file class_board.cpp.

1391 {
1392  for ( auto mod : Modules() )
1393  {
1394  for ( auto pad : mod->Pads( ) )
1395  {
1396  if( aNetCode < 0 || pad->GetNetCode() == aNetCode )
1397  {
1398  aVector.push_back( pad );
1399  }
1400  }
1401  }
1402 
1403  std::sort( aVector.begin(), aVector.end(), sortPadsByXthenYCoord );
1404 }
MODULES & Modules()
Definition: class_board.h:227
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...
#define mod(a, n)
Definition: greymap.cpp:24

References mod, 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 647 of file class_board.h.

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

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

250  {
251  return m_Status & type;
252  }
STATUS_FLAGS m_Status
Definition: base_struct.h:173

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

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

References EDA_ITEM::m_Status.

Referenced by PCB_IO::format().

◆ GetTimeStamp()

◆ GetTitleBlock()

TITLE_BLOCK& BOARD::GetTitleBlock ( )
inline

Definition at line 552 of file class_board.h.

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

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

1415 {
1416  int count = 0;
1417  double length = 0.0;
1418  double package_length = 0.0;
1419 
1420  constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, PCB_PAD_T, EOT };
1421  auto connectivity = GetBoard()->GetConnectivity();
1422 
1423  for( auto item : connectivity->GetConnectedItems(
1424  static_cast<const BOARD_CONNECTED_ITEM*>( &aTrack ), types ) )
1425  {
1426  count++;
1427 
1428  if( auto track = dyn_cast<TRACK*>( item ) )
1429  {
1430  bool inPad = false;
1431 
1432  for( auto pad_it : connectivity->GetConnectedPads( item ) )
1433  {
1434  auto pad = static_cast<D_PAD*>( pad_it );
1435 
1436  if( pad->HitTest( track->GetStart(), track->GetWidth() / 2 )
1437  && pad->HitTest( track->GetEnd(), track->GetWidth() / 2 ) )
1438  {
1439  inPad = true;
1440  break;
1441  }
1442  }
1443 
1444  if( !inPad )
1445  length += track->GetLength();
1446  }
1447  else if( auto pad = dyn_cast<D_PAD*>( item ) )
1448  package_length += pad->GetPadToDieLength();
1449  }
1450 
1451  return std::make_tuple( count, length, package_length );
1452 }
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:301
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97

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

755 {
756  return m_connectivity->GetUnconnectedCount();
757 }
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: class_board.h:192

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

462 {
464 }
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:194

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

420 {
422 }
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:194

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

1523 {
1524  std::list<ZONE_CONTAINER*> zones;
1525 
1526  for( int ii = 0; ii < GetAreaCount(); ii++ )
1527  {
1528  zones.push_back( GetArea( ii ) );
1529  }
1530 
1531  if( aIncludeZonesInFootprints )
1532  {
1533  for( MODULE* mod : m_modules )
1534  {
1535  for( MODULE_ZONE_CONTAINER* zone : mod->Zones() )
1536  {
1537  zones.push_back( zone );
1538  }
1539  }
1540  }
1541 
1542  return zones;
1543 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:176
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:949
MODULE_ZONE_CONTAINER is the same item as ZONE_CONTAINER, but with a specific type id ZONE_CONTAINER ...
Definition: class_zone.h:827
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:914
#define mod(a, n)
Definition: greymap.cpp:24

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

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 71 of file board_item_container.h.

72  {
73  return m_zoneSettings;
74  }

References BOARD_ITEM_CONTAINER::m_zoneSettings.

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

◆ HasFlag()

bool EDA_ITEM::HasFlag ( STATUS_FLAGS  aFlag)
inlineinherited

◆ HighLightOFF()

void BOARD::HighLightOFF ( )
inline

Function HighLightOFF Disable highlight.

Definition at line 398 of file class_board.h.

398 { m_highLight.m_highLightOn = false; }
HIGH_LIGHT_INFO m_highLight
Definition: class_board.h:187

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

405 { m_highLight.m_highLightOn = true; }
HIGH_LIGHT_INFO m_highLight
Definition: class_board.h:187

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, WS_DRAW_ITEM_BITMAP, VIA, WS_DRAW_ITEM_TEXT, GERBER_DRAW_ITEM, WS_DRAW_ITEM_PAGE, ZONE_CONTAINER, DIMENSION, DRAWSEGMENT, WS_DRAW_ITEM_RECT, SCH_LINE, SCH_TEXT, TEXTE_MODULE, SCH_FIELD, SCH_SHEET_PIN, TRACK, LIB_ITEM, WS_DRAW_ITEM_POLYPOLYGONS, LIB_FIELD, SCH_BITMAP, WS_DRAW_ITEM_LINE, LIB_PIN, SCH_BUS_ENTRY_BASE, SCH_NO_CONNECT, SCH_JUNCTION, SCH_MARKER, MARKER_PCB, PCB_TARGET, WS_DRAW_ITEM_BASE, TEXTE_PCB, SCH_PIN, LIB_POLYLINE, LIB_BEZIER, LIB_ARC, LIB_TEXT, LIB_RECTANGLE, LIB_CIRCLE, and KIGFX::RATSNEST_VIEWITEM.

Definition at line 340 of file base_struct.h.

341  {
342  return false; // derived classes should override this function
343  }

Referenced by SCH_MOVE_TOOL::getConnectedDragItems(), PL_SELECTION_TOOL::guessSelectionCandidates(), 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, ZONE_CONTAINER, WS_DRAW_ITEM_BITMAP, VIA, WS_DRAW_ITEM_TEXT, GERBER_DRAW_ITEM, DIMENSION, DRAWSEGMENT, SCH_LINE, TEXTE_MODULE, SCH_TEXT, SCH_FIELD, TRACK, LIB_ITEM, WS_DRAW_ITEM_POLYPOLYGONS, SCH_BITMAP, SCH_BUS_ENTRY_BASE, SCH_NO_CONNECT, SCH_JUNCTION, WS_DRAW_ITEM_BASE, PCB_TARGET, TEXTE_PCB, LIB_POLYLINE, LIB_BEZIER, LIB_ARC, LIB_TEXT, and LIB_CIRCLE.

Definition at line 354 of file base_struct.h.

355  {
356  return false; // derived classes should override this function
357  }

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

1171 {
1172  if( aEndLayer < 0 )
1173  aEndLayer = aStartLayer;
1174 
1175  if( aEndLayer < aStartLayer )
1176  std::swap( aEndLayer, aStartLayer );
1177 
1178  for( ZONE_CONTAINER* area : m_ZoneDescriptorList )
1179  {
1180  if( area->GetLayer() < aStartLayer || area->GetLayer() > aEndLayer )
1181  continue;
1182 
1183  // In locate functions we must skip tagged items with BUSY flag set.
1184  if( area->GetState( BUSY ) )
1185  continue;
1186 
1187  if( aNetCode >= 0 && area->GetNetCode() != aNetCode )
1188  continue;
1189 
1190  if( area->HitTestFilledArea( aRefPos ) )
1191  return area;
1192  }
1193 
1194  return NULL;
1195 }
Class 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
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:182

References BUSY, and m_ZoneDescriptorList.

◆ InsertArea()

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

1584 {
1585  ZONE_CONTAINER* new_area = new ZONE_CONTAINER( this );
1586 
1587  new_area->SetNetCode( aNetcode );
1588  new_area->SetLayer( aLayer );
1589  new_area->SetTimeStamp( GetNewTimeStamp() );
1590 
1591  if( aAreaIdx < (int) ( m_ZoneDescriptorList.size() - 1 ) )
1592  m_ZoneDescriptorList.insert( m_ZoneDescriptorList.begin() + aAreaIdx + 1, new_area );
1593  else
1594  m_ZoneDescriptorList.push_back( new_area );
1595 
1596  new_area->SetHatchStyle( (ZONE_CONTAINER::HATCH_STYLE) aHatch );
1597 
1598  // Add the first corner to the new zone
1599  new_area->AppendCorner( wxPoint( aCornerX, aCornerY ), -1 );
1600 
1601  return new_area;
1602 }
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
timestamp_t GetNewTimeStamp()
Definition: common.cpp:217
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Function SetLayer sets the layer this item is on.
Definition: class_zone.cpp:230
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Sets net using a net code.
HATCH_STYLE
Zone hatch styles.
Definition: class_zone.h:65
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:182
void SetHatchStyle(HATCH_STYLE aStyle)
Definition: class_zone.h:524
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:914
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:215

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

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

231 { 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:187

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

468 {
469  return m_designSettings.IsElementVisible( aLayer );
470 }
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:194

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(), Print(), PCB_LAYER_WIDGET::ReFillRender(), SELECTION_TOOL::Selectable(), and PCB_DRAW_PANEL_GAL::SyncLayersVisibility().

◆ IsEmpty()

bool BOARD::IsEmpty ( ) const
inline

Definition at line 257 of file class_board.h.

258  {
259  return m_drawings.empty() && m_modules.empty() && m_tracks.empty() &&
260  m_ZoneDescriptorList.empty();
261  }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:176
TRACKS m_tracks
TRACKS for traces on the board, owned by pointer.
Definition: class_board.h:179
DRAWINGS m_drawings
BOARD_ITEMs for drawings on the board, owned by pointer.
Definition: class_board.h:173
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:182

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

◆ IsHighlighted()

bool EDA_ITEM::IsHighlighted ( ) const
inlineinherited

Definition at line 235 of file base_struct.h.

235 { 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:187

References HIGHLIGHTED, and EDA_ITEM::m_Flags.

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

◆ IsHighLightNetON()

bool BOARD::IsHighLightNetON ( ) const
inline

Function IsHighLightNetON.

Returns
true if a net is currently highlighted

Definition at line 392 of file class_board.h.

392 { return m_highLight.m_highLightOn; }
HIGH_LIGHT_INFO m_highLight
Definition: class_board.h:187

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

439  {
440  return m_designSettings.IsLayerEnabled( aLayer );
441  }
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:194

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

451  {
452  return m_designSettings.IsLayerVisible( aLayer );
453  }
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:194

References BOARD_DESIGN_SETTINGS::IsLayerVisible().

Referenced by DRAWING_TOOL::DrawVia(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), itemIsIncludedByFilter(), 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 200 of file class_board_item.h.

201  {
202  // only MODULEs & TRACKs can be locked at this time.
203  return false;
204  }

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

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 229 of file base_struct.h.

229 { 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:187

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

509 {
510  switch( aLayer )
511  {
512  case F_Cu:
513  return IsElementVisible( LAYER_MOD_FR );
514 
515  case B_Cu:
516  return IsElementVisible( LAYER_MOD_BK );
517 
518  default:
519  wxFAIL_MSG( wxT( "BOARD::IsModuleLayerVisible() param error: bad layer" ) );
520  return true;
521  }
522 }
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 180 of file class_board_item.h.

181  {
182  return m_Layer == aLayer;
183  }
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_FIELD, SCH_SHEET_PIN, and SCH_TEXT.

Definition at line 556 of file base_struct.h.

556 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 234 of file base_struct.h.

234 { return m_Flags & IS_RESIZED; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:187
#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 191 of file class_board_item.h.

192  {
193  return ( Type() == PCB_TRACE_T ) || ( Type() == PCB_VIA_T );
194  }
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:210

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

◆ IsType()

virtual bool EDA_ITEM::IsType ( const KICAD_T  aScanTypes[])
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 294 of file base_struct.h.

295  {
296  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
297  return true;
298 
299  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
300  {
301  if( m_StructType == *p )
302  return true;
303  }
304 
305  return false;
306  }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it.
Definition: base_struct.h:172
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_SCREEN::GetItem(), 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(), PL_POINT_EDITOR::Main(), EE_SELECTION_TOOL::RequestSelection(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), EDA_ITEM::Visit(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 232 of file base_struct.h.

232 { 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:187

References IS_WIRE_IMAGE, and EDA_ITEM::m_Flags.

◆ IterateForward() [1/3]

static SEARCH_RESULT EDA_ITEM::IterateForward ( EDA_ITEM listStart,
INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
inlinestaticinherited

Function IterateForward walks through the object tree calling the inspector() on each object type requested in scanTypes.

Parameters
listStartThe first in a list of EDA_ITEMs to iterate over.
inspectorIs an INSPECTOR to call on each object that is one of the requested scanTypes.
testDataIs an aid to testFunc, and should be sufficient to allow it to fully determine if an item meets the match criteria, but it may also be used to collect output.
scanTypesA KICAD_T array that is EOT terminated, and provides both the order and interest level of of the types of objects to be iterated over.
Returns
SEARCH_RESULT SEARCH_QUIT if the called INSPECTOR returned SEARCH_QUIT, else SCAN_CONTINUE;

Definition at line 418 of file base_struct.h.

423  {
424  for( EDA_ITEM* p = listStart; p; p = p->Pnext )
425  {
426  if( SEARCH_QUIT == p->Visit( inspector, testData, scanTypes ) )
427  return SEARCH_QUIT;
428  }
429 
430  return SEARCH_CONTINUE;
431  }
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:176

References EDA_ITEM::Pnext, SEARCH_CONTINUE, and SEARCH_QUIT.

Referenced by EE_COLLECTOR::Collect(), EE_TYPE_COLLECTOR::Collect(), nextMatch(), EE_SELECTION_TOOL::RebuildSelection(), SCH_EDITOR_CONTROL::UpdateFind(), GERBER_FILE_IMAGE::Visit(), and Visit().

◆ IterateForward() [2/3]

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

443  {
444  for( auto it : aList )
445  {
446  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes ) == SEARCH_QUIT )
447  return SEARCH_QUIT;
448  }
449 
450  return SEARCH_CONTINUE;
451  }
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 SEARCH_CONTINUE, SEARCH_QUIT, and EDA_ITEM::Visit().

◆ IterateForward() [3/3]

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

461  {
462  for( auto it : aList )
463  {
464  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
465  == SEARCH_QUIT )
466  return SEARCH_QUIT;
467  }
468 
469  return SEARCH_CONTINUE;
470  }
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 SEARCH_CONTINUE, SEARCH_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 1790 of file class_board.cpp.

1791 {
1792  for ( BOARD_CONNECTED_ITEM* item : AllConnectedItems() )
1793  {
1794  NETINFO_ITEM* netInfo = aDestBoard->FindNet( item->GetNetname() );
1795 
1796  if( netInfo )
1797  item->SetNetCode( netInfo->GetNet() );
1798  else
1799  item->SetNetCode( 0 );
1800  }
1801 }
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
Class BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected an...
const std::vector< BOARD_CONNECTED_ITEM * > AllConnectedItems()
void SetNetCode(int aNetCode)
Definition: netinfo.h:227
Class NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
int GetNet() const
Function GetNet.
Definition: netinfo.h:225

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

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

Definition at line 512 of file base_struct.h.

513  {
514  return false;
515  }

Referenced by SCH_EDITOR_CONTROL::HasMatch(), TEXTE_PCB::Matches(), TEXTE_MODULE::Matches(), SCH_MARKER::Matches(), MARKER_PCB::Matches(), LIB_PIN::Matches(), SCH_TEXT::Matches(), SCH_SHEET_PIN::Matches(), SCH_FIELD::Matches(), SCH_SHEET::Matches(), nextMatch(), SCH_EDITOR_CONTROL::ReplaceAndFindNext(), and SCH_EDITOR_CONTROL::UpdateFind().

◆ Matches() [2/2]

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

Function Matches compares aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

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

Definition at line 156 of file base_struct.cpp.

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

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

◆ Modules() [1/2]

MODULES& BOARD::Modules ( )
inline

Definition at line 227 of file class_board.h.

228  {
229  return m_modules;
230  }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:176

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(), 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(), FOOTPRINT_EDIT_FRAME::ReCreateMenuBar(), 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::SyncWorld(), DRC::testCopperTextAndGraphics(), DRC::testDisabledLayers(), DRC::testDrilledHoles(), DRC::TestFootprints(), TestForExistingItem(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow(), NETINFO_MAPPING::Update(), BOARD_NETLIST_UPDATER::UpdateNetlist(), HYPERLYNX_EXPORTER::writeDevices(), and HYPERLYNX_EXPORTER::writePadStacks().

◆ Modules() [2/2]

const MODULES& BOARD::Modules ( ) const
inline

Definition at line 231 of file class_board.h.

232  {
233  return m_modules;
234  }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:176

◆ Move() [1/2]

void BOARD_ITEM::Move ( const VECTOR2I aMoveVector)
inlineinherited

Definition at line 239 of file class_board_item.h.

240  {
241  Move( wxPoint( aMoveVector.x, aMoveVector.y ) );
242  }
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 194 of file class_board.cpp.

195 {
196  // @todo : anything like this elsewhere? maybe put into GENERAL_COLLECTOR class.
197  static const KICAD_T top_level_board_stuff[] = {
198  PCB_MARKER_T,
199  PCB_TEXT_T,
200  PCB_LINE_T,
202  PCB_TARGET_T,
203  PCB_VIA_T,
204  PCB_TRACE_T,
205  // PCB_PAD_T, Can't be at board level
206  // PCB_MODULE_TEXT_T, Can't be at board level
207  PCB_MODULE_T,
209  EOT
210  };
211 
212  INSPECTOR_FUNC inspector = [&] ( EDA_ITEM* item, void* testData )
213  {
214  BOARD_ITEM* brd_item = (BOARD_ITEM*) item;
215 
216  // aMoveVector was snapshotted, don't need "data".
217  brd_item->Move( aMoveVector );
218 
219  return SEARCH_CONTINUE;
220  };
221 
222  Visit( inspector, NULL, top_level_board_stuff );
223 }
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
Class 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:101
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:92
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
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:99
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:100
class MARKER_PCB, a marker used to show something
Definition: typeinfo.h:98
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
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 EOT, BOARD_ITEM::Move(), 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, SEARCH_CONTINUE, and Visit().

Referenced by EAGLE_PLUGIN::centerBoard().

◆ Next()

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

1606 {
1607  // mark all areas as unmodified except this one, if modified
1608  for( ZONE_CONTAINER* zone : m_ZoneDescriptorList )
1609  zone->SetLocalFlags( 0 );
1610 
1611  aCurrArea->SetLocalFlags( 1 );
1612 
1613  if( aCurrArea->Outline()->IsSelfIntersecting() )
1614  {
1615  aCurrArea->UnHatch();
1616 
1617  // Normalize copied area and store resulting number of polygons
1618  int n_poly = aCurrArea->Outline()->NormalizeAreaOutlines();
1619 
1620  // If clipping has created some polygons, we must add these new copper areas.
1621  if( n_poly > 1 )
1622  {
1623  ZONE_CONTAINER* NewArea;
1624 
1625  // Move the newly created polygons to new areas, removing them from the current area
1626  for( int ip = 1; ip < n_poly; ip++ )
1627  {
1628  // Create new copper area and copy poly into it
1629  SHAPE_POLY_SET* new_p = new SHAPE_POLY_SET( aCurrArea->Outline()->UnitSet( ip ) );
1630  NewArea = AddArea( aNewZonesList, aCurrArea->GetNetCode(), aCurrArea->GetLayer(),
1631  wxPoint(0, 0), aCurrArea->GetHatchStyle() );
1632 
1633  // remove the poly that was automatically created for the new area
1634  // and replace it with a poly from NormalizeAreaOutlines
1635  delete NewArea->Outline();
1636  NewArea->SetOutline( new_p );
1637  NewArea->Hatch();
1638  NewArea->SetLocalFlags( 1 );
1639  }
1640 
1641  SHAPE_POLY_SET* new_p = new SHAPE_POLY_SET( aCurrArea->Outline()->UnitSet( 0 ) );
1642  delete aCurrArea->Outline();
1643  aCurrArea->SetOutline( new_p );
1644  }
1645  }
1646 
1647  aCurrArea->Hatch();
1648 
1649  return true;
1650 }
Class 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:203
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:246
void SetOutline(SHAPE_POLY_SET *aOutline)
Definition: class_zone.h:249
HATCH_STYLE GetHatchStyle() const
Definition: class_zone.h:519
ZONE_CONTAINER * AddArea(PICKED_ITEMS_LIST *aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer, wxPoint aStartPointPosition, int aHatch)
Function AddArea Add an empty copper area to board areas list.
Class SHAPE_POLY_SET.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Returns the reference to aIndex-th outline in the set
void UnHatch()
Function UnHatch clears the zone's hatch.
Definition: class_zone.cpp:973
SHAPE_POLY_SET UnitSet(int aPolygonIndex)
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:182
void Hatch()
Function Hatch computes the hatch lines depending on the hatch parameters and stores it in the zone's...
Definition: class_zone.cpp:987
void SetLocalFlags(int aFlags)
Definition: class_zone.h:241
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 }
Class 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:431
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:182
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 210 of file base_struct.cpp.

211 {
212  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
213  GetChars( GetClass() ) ) );
214 
215  return false;
216 }
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 1407 of file class_board.cpp.

1408 {
1409  GetConnectivity()->Remove( aPad );
1410  aPad->DeleteStructure();
1411 }
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:301

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 52 of file pcb_legacy_draw_utils.cpp.

53 {
54  /* The order of drawing is flexible on some systems and not on others. For
55  * OSes which use OR to draw, the order is not important except for the
56  * effect of the highlight and its relationship to markers. See comment
57  * below.
58  * This order independence comes from the fact that a binary OR operation is
59  * commutative in nature.
60  * However on the OSX, the OR operation is not used, and so this sequence
61  * below is chosen to give MODULEs the highest visible priority.
62  */
63 
64  /* Draw all tracks and zones. As long as dark colors are used for the
65  * tracks, Then the OR draw mode should show tracks underneath other
66  * tracks. But a white track will cover any other color since it has
67  * more bits to OR in.
68  */
69  for( auto track : m_tracks )
70  {
71  if( track->IsMoving() )
72  continue;
73 
74  track->Print( aFrame, DC );
75  }
76 
77  // Draw areas (i.e. zones)
78  for( int ii = 0; ii < GetAreaCount(); ii++ )
79  {
80  ZONE_CONTAINER* zone = GetArea( ii );
81 
82  // Areas must be drawn here only if not moved or dragged,
83  // because these areas are drawn by ManageCursor() in a specific manner
84  if( ( zone->GetEditFlags() & (IN_EDIT | IS_DRAGGED | IS_MOVED) ) == 0 )
85  {
86  zone->Print( aFrame, DC );
87  zone->PrintFilledArea( aFrame, DC );
88  }
89  }
90 
91  // Draw the graphic items
92  for( auto item : m_drawings )
93  {
94  if( item->IsMoving() )
95  continue;
96 
97  switch( item->Type() )
98  {
99  case PCB_DIMENSION_T:
100  case PCB_TEXT_T:
101  case PCB_TARGET_T:
102  case PCB_LINE_T:
103  item->Print( aFrame, DC );
104  break;
105 
106  default:
107  break;
108  }
109  }
110 
111  LSET all_cu = LSET::AllCuMask();
112 
113  for( auto module : m_modules )
114  {
115  bool display = true;
116  LSET layerMask = all_cu;
117 
118  if( module->IsMoving() )
119  continue;
120 
122  {
123  if( module->GetLayer() == F_Cu )
124  display = false;
125 
126  layerMask.set( F_Cu, false );
127  }
128 
130  {
131  if( module->GetLayer() == B_Cu )
132  display = false;
133 
134  layerMask.set( B_Cu, false );
135  }
136 
137  if( display )
138  module->Print( aFrame, DC );
139  else
140  Trace_Pads_Only( aFrame, DC, module, 0, 0, layerMask );
141  }
142 
143  // draw the BOARD's markers last, otherwise the high light will erase any marker on a pad
144  for( unsigned i = 0; i < m_markers.size(); ++i )
145  {
146  m_markers[i]->Print( aFrame, DC );
147  }
148 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:176
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:676
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
#define IN_EDIT
Item currently edited.
Definition: base_struct.h:118
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:179
show modules on front
#define IS_DRAGGED
Item being dragged.
Definition: base_struct.h:122
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:949
Class LSET is a set of PCB_LAYER_IDs.
void Print(PCB_BASE_FRAME *aFrame, wxDC *DC, const wxPoint &offset=ZeroOffset) override
Function Print Prints the zone outline.
Definition: class_zone.cpp:309
STATUS_FLAGS GetEditFlags() const
Definition: base_struct.h:270
MARKERS m_markers
MARKER_PCBs for clearance problems, owned by pointer.
Definition: class_board.h:170
static void Trace_Pads_Only(PCB_BASE_FRAME *aFrame, wxDC *DC, MODULE *Module, int ox, int oy, LSET LayerMask)
DRAWINGS m_drawings
BOARD_ITEMs for drawings on the board, owned by pointer.
Definition: class_board.h:173
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:99
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:100
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Function IsElementVisible tests whether a given element category is visible.
void PrintFilledArea(PCB_BASE_FRAME *aFrame, wxDC *DC, const wxPoint &offset=ZeroOffset)
Function PrintFilledArea Draws the filled area for this zone (polygon list .m_FilledPolysList)
Definition: class_zone.cpp:421
size_t i
Definition: json11.cpp:649
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:914
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:91
#define IS_MOVED
Item being moved.
Definition: base_struct.h:119

References LSET::AllCuMask(), B_Cu, F_Cu, GetArea(), GetAreaCount(), EDA_ITEM::GetEditFlags(), i, IN_EDIT, IS_DRAGGED, IS_MOVED, IsElementVisible(), LAYER_MOD_BK, LAYER_MOD_FR, m_drawings, m_markers, m_modules, m_tracks, PCB_DIMENSION_T, PCB_LINE_T, PCB_TARGET_T, PCB_TEXT_T, ZONE_CONTAINER::Print(), ZONE_CONTAINER::PrintFilledArea(), and Trace_Pads_Only().

◆ Remove()

void BOARD::Remove ( BOARD_ITEM aItem)
overridevirtual

Removes an item from the container.

Implements BOARD_ITEM_CONTAINER.

Definition at line 603 of file class_board.cpp.

604 {
605  // find these calls and fix them! Don't send me no stinking' NULL.
606  wxASSERT( aBoardItem );
607 
608  switch( aBoardItem->Type() )
609  {
610  case PCB_NETINFO_T:
611  {
612  NETINFO_ITEM* item = (NETINFO_ITEM*) aBoardItem;
613  m_NetInfo.RemoveNet( item );
614  break;
615  }
616 
617  case PCB_MARKER_T:
618 
619  // find the item in the vector, then remove it
620  for( unsigned i = 0; i<m_markers.size(); ++i )
621  {
622  if( m_markers[i] == (MARKER_PCB*) aBoardItem )
623  {
624  m_markers.erase( m_markers.begin() + i );
625  break;
626  }
627  }
628 
629  break;
630 
631  case PCB_ZONE_AREA_T: // this one uses a vector
632  // find the item in the vector, then delete then erase it.
633  for( unsigned i = 0; i<m_ZoneDescriptorList.size(); ++i )
634  {
635  if( m_ZoneDescriptorList[i] == (ZONE_CONTAINER*) aBoardItem )
636  {
637  m_ZoneDescriptorList.erase( m_ZoneDescriptorList.begin() + i );
638  break;
639  }
640  }
641  break;
642 
643  case PCB_MODULE_T:
644  m_modules.erase( std::remove_if( m_modules.begin(), m_modules.end(),
645  [aBoardItem]( BOARD_ITEM* aItem ) { return aItem == aBoardItem; } ) );
646  break;
647 
648  case PCB_TRACE_T:
649  case PCB_VIA_T:
650  m_tracks.erase( std::remove_if( m_tracks.begin(), m_tracks.end(),
651  [aBoardItem]( BOARD_ITEM* aItem ) { return aItem == aBoardItem; } ) );
652  break;
653 
654  case PCB_DIMENSION_T:
655  case PCB_LINE_T:
656  case PCB_TEXT_T:
657  case PCB_TARGET_T:
658  m_drawings.erase(
659  std::remove_if( m_drawings.begin(), m_drawings.end(),
660  [aBoardItem](BOARD_ITEM* aItem)
661  { return aItem == aBoardItem;} ) );
662  break;
663 
664  // other types may use linked list
665  default:
666  wxFAIL_MSG( wxT( "BOARD::Remove() needs more ::Type() support" ) );
667  }
668 
669  m_connectivity->Remove( aBoardItem );
670 }
MODULES m_modules
MODULES for components on the board, owned by pointer.
Definition: class_board.h:176
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
Class 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:101
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:92
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:199
TRACKS m_tracks
TRACKS for traces on the board, owned by pointer.
Definition: class_board.h:179
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:170
DRAWINGS m_drawings
BOARD_ITEMs for drawings on the board, owned by pointer.
Definition: class_board.h:173
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:99
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:100
Class NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
class MARKER_PCB, a marker used to show something
Definition: typeinfo.h:98
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:182
class NETINFO_ITEM, a description of a net
Definition: typeinfo.h:103
size_t i
Definition: json11.cpp:649
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: class_board.h:192
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 i, m_connectivity, m_drawings, m_markers, m_modules, m_NetInfo, m_tracks, m_ZoneDescriptorList, 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 1564 of file class_board.cpp.

1565 {
1566  if( area_to_remove == NULL )
1567  return;
1568 
1569  if( aDeletedList )
1570  {
1571  ITEM_PICKER picker( area_to_remove, UR_DELETED );
1572  aDeletedList->PushItem( picker );
1573  Remove( area_to_remove ); // remove from zone list, but does not delete it
1574  }
1575  else
1576  {
1577  Delete( area_to_remove );
1578  }
1579 }
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
virtual void Delete(BOARD_ITEM *aItem)
Removes an item from the container and deletes it.