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
 
DLIST_ITERATOR_WRAPPER< TRACKTracks ()
 
DLIST_ITERATOR_WRAPPER< MODULEModules ()
 
DLIST_ITERATOR_WRAPPER< BOARD_ITEMDrawings ()
 
ZONE_CONTAINERS & Zones ()
 
const std::vector< BOARD_CONNECTED_ITEM * > AllConnectedItems ()
 
DLIST< BOARD_ITEM > & DrawingsList ()
 
 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...
 
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 ResetHighLight ()
 Function ResetHighLight 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...
 
void PushHighLight ()
 Function PushHighLight save current high light info for later use. More...
 
void PopHighLight ()
 Function PopHighLight retrieve a previously saved high light info. 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)
 
const ZONE_SETTINGSGetZoneSettings () const
 
void SetZoneSettings (const ZONE_SETTINGS &aSettings)
 
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...
 
void SetColorsSettings (COLORS_DESIGN_SETTINGS *aColorsSettings)
 Function SetColorsSettings. More...
 
bool GetBoardPolygonOutlines (SHAPE_POLY_SET &aOutlines, wxString *aErrorText=nullptr, wxPoint *aErrorLocation=nullptr)
 Function GetBoardPolygonOutlines Extracts the board outlines and build a closed polygon from lines, arcs and circle items on edge cut layer Any closed outline inside the main outline is a hole All contours should be closed, i.e. More...
 
void ConvertBrdLayerToPolygonalContours (PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aOutlines)
 Function ConvertBrdLayerToPolygonalContours Build a set of polygons which are the outlines of copper items (pads, tracks, vias, texts, zones) Holes in vias or pads are ignored Usefull to export the shape of copper layers to dxf polygons or 3D viewer the polygons are not merged. More...
 
const PCB_LAYER_ID GetLayerID (const wxString &aLayerName) const
 Function GetLayerID returns the ID of a layer 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...
 
int GetNumSegmTrack () const
 Functions to get some items count. 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 Draw (EDA_DRAW_PANEL *aPanel, wxDC *aDC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset=ZeroOffset) override
 Function Draw. More...
 
void DrawHighLight (EDA_DRAW_PANEL *aDrawPanel, wxDC *aDC, int aNetCode)
 Function DrawHighLight redraws the objects in the board that are associated with the given aNetCode and turns on or off the brilliance associated with that net according to the current value of global g_HighLight_Status. 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...
 
void RedrawAreasOutlines (EDA_DRAW_PANEL *aPanel, wxDC *aDC, GR_DRAWMODE aDrawMode, PCB_LAYER_ID aLayer)
 Function RedrawAreasOutlines Redraw all areas outlines on layer aLayer ( redraw all if aLayer < 0 ) More...
 
void RedrawFilledAreas (EDA_DRAW_PANEL *aPanel, wxDC *aDC, GR_DRAWMODE aDrawMode, PCB_LAYER_ID aLayer)
 Function RedrawFilledAreas Redraw all filled areas on layer aLayer ( redraw all if aLayer < 0 ) 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...
 
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...
 
VIAGetViaByPosition (const wxPoint &aPosition, PCB_LAYER_ID aLayer=PCB_LAYER_ID(-1)) const
 Function GetViaByPosition finds the first via at aPosition on aLayer. More...
 
std::list< TRACK * > GetTracksByPosition (const wxPoint &aPosition, PCB_LAYER_ID aLayer=PCB_LAYER_ID(-1)) const
 Function GetTracksByPosition finds the list of tracks that starts or ends at aPosition on aLayer. 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...
 
TRACKGetVisibleTrack (TRACK *aStartingTrace, const wxPoint &aPosition, LSET aLayerSet) const
 Function GetVisibleTrack finds the neighboring visible segment of aTrace at aPosition that is on a layer in aLayerSet. More...
 
TRACKMarkTrace (TRACK *aTrackList, TRACK *aTrace, int *aCount, double *aTraceLength, double *aInPackageLength, bool aReorder)
 Function MarkTrace marks a chain of trace segments, connected to aTrace. More...
 
TRACKS TracksInNet (int aNetCode)
 Function TrackInNet collects all the TRACKs and VIAs that are members of a net given by aNetCode. More...
 
TRACKS TracksInNetBetweenPoints (const wxPoint &aStartPos, const wxPoint &aGoalPos, int aNetCode)
 Function TrackInNetBetweenPoints collects all the TRACKs and VIAs that are members of a net given by aNetCode and that make up a path between two end points. 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...
 
BOARD_CONNECTED_ITEMGetLockPoint (const wxPoint &aPosition, LSET aLayerMask)
 Function GetLockPoint returns the item at the "attachment" point at the end of a trace at aPosition on aLayerMask. More...
 
TRACKCreateLockPoint (wxPoint &aPosition, TRACK *aSegment, PICKED_ITEMS_LIST *aList)
 Function CreateLockPoint creates an intermediate point on aSegment and break it into two segments at aPosition. More...
 
void ClearAllNetCodes ()
 Function ClearAllNetCodes() Resets all items' netcodes to 0 (no net). More...
 
void SanitizeNetcodes ()
 
virtual void Delete (BOARD_ITEM *aItem)
 Removes an item from the containter and deletes it. 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...
 
BOARD_ITEMNext () const
 
BOARD_ITEMBack () 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...
 
virtual void UnLink ()
 Function UnLink detaches this object from its owner. More...
 
void DeleteStructure ()
 Function DeleteStructure deletes this object after UnLink()ing it from its owner 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)
 Function Flip Flip this object, i.e. More...
 
void Flip (const VECTOR2I &aCentre)
 
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 aCircleToSegmentsCount, double aCorrectionFactor, 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
 
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
 
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, wxPoint *aFindLocation)
 Function Matches compares the item against the search criteria in aSearchData. More...
 
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...
 
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...
 
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

int m_Status_Pcb
 Flags used in ratsnest calculation and update. More...
 
DLIST< MODULEm_Modules
 
DLIST< TRACKm_Track
 
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

void chainMarkedSegments (TRACK *aTrackList, wxPoint aPosition, const LSET &aLayerSet, TRACKS *aList)
 Function chainMarkedSegments is used by MarkTrace() to set the BUSY flag of connected segments of the trace segment located at aPosition on aLayerMask. More...
 
 BOARD (const BOARD &aOther)
 
BOARDoperator= (const BOARD &aOther)
 

Private Attributes

wxString m_fileName
 the board filename More...
 
MARKERS m_markers
 MARKER_PCBs for clearance problems, 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
 
ZONE_SETTINGS m_zoneSettings
 
COLORS_DESIGN_SETTINGSm_colorsSettings
 
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...
 
DLIST< BOARD_ITEMm_Drawings
 

Friends

class PCB_EDIT_FRAME
 

Detailed Description

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

Definition at line 170 of file class_board.h.

Constructor & Destructor Documentation

◆ BOARD() [1/2]

BOARD::BOARD ( const BOARD aOther)
inlineprivate

Definition at line 217 of file class_board.h.

217  :
218  BOARD_ITEM_CONTAINER( aOther ), m_NetInfo( this )
219  {
220  assert( false );
221  }
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:200
BOARD_ITEM_CONTAINER(BOARD_ITEM *aParent, KICAD_T aType)

◆ BOARD() [2/2]

BOARD::BOARD ( )

Definition at line 110 of file class_board.cpp.

110  :
112  m_paper( PAGE_INFO::A4 ), m_NetInfo( this )
113 {
114  // we have not loaded a board yet, assume latest until then.
115  m_fileFormatVersionAtLoad = LEGACY_BOARD_FILE_VERSION;
116 
118  m_Status_Pcb = 0; // Status word: bit 1 = calculate.
119  m_CurrentZoneContour = NULL; // This ZONE_CONTAINER handle the
120  // zone contour currently in progress
121 
122  BuildListOfNets(); // prepare pad and netlist containers.
123 
124  for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
125  {
126  m_Layer[layer].m_name = GetStandardLayerName( ToLAYER_ID( layer ) );
127 
128  if( IsCopperLayer( layer ) )
129  m_Layer[layer].m_type = LT_SIGNAL;
130  else
131  m_Layer[layer].m_type = LT_UNDEFINED;
132  }
133 
134  // Initialize default netclass.
135  NETCLASSPTR defaultClass = m_designSettings.GetDefault();
136  defaultClass->SetDescription( _( "This is the default net class." ) );
137  m_designSettings.SetCurrentNetClass( defaultClass->GetName() );
138 
139  // Set sensible initial values for custom track width & via size
144 
145  // Initialize ratsnest
146  m_connectivity.reset( new CONNECTIVITY_DATA() );
147 }
void BuildListOfNets()
Definition: class_board.h:727
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:112
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:197
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:114
COLORS_DESIGN_SETTINGS * m_colorsSettings
Definition: class_board.h:196
ZONE_CONTAINER * m_CurrentZoneContour
zone contour currently in progress
Definition: class_board.h:261
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:200
static COLORS_DESIGN_SETTINGS dummyColorsSettings(FRAME_PCB)
void SetCustomViaSize(int aSize)
Function SetCustomViaSize Sets custom size for via diameter (i.e.
static const wxChar A4[]
Definition: page_info.h:64
void SetCustomTrackWidth(int aWidth)
Function SetCustomTrackWidth Sets custom width for track (i.e.
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
int GetCurrentViaSize() const
Function GetCurrentViaSize.
bool SetCurrentNetClass(const wxString &aNetClassName)
Function SetCurrentNetClass Must be called after a netclass selection (or after a netclass parameter ...
NETCLASSPTR GetDefault() const
Function GetDefault.
int m_fileFormatVersionAtLoad
the version loaded from the file
Definition: class_board.h:190
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:654
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:240

References BuildListOfNets(), dummyColorsSettings, BOARD_DESIGN_SETTINGS::GetCurrentTrackWidth(), BOARD_DESIGN_SETTINGS::GetCurrentViaDrill(), BOARD_DESIGN_SETTINGS::GetCurrentViaSize(), BOARD_DESIGN_SETTINGS::GetDefault(), GetStandardLayerName(), IsCopperLayer(), LT_SIGNAL, LT_UNDEFINED, m_colorsSettings, m_connectivity, m_CurrentZoneContour, m_designSettings, m_fileFormatVersionAtLoad, m_Layer, LAYER::m_name, m_Status_Pcb, 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 150 of file class_board.cpp.

151 {
152  while( m_ZoneDescriptorList.size() )
153  {
154  ZONE_CONTAINER* area_to_remove = m_ZoneDescriptorList[0];
155  Delete( area_to_remove );
156  }
157 
158  DeleteMARKERs();
160 
161  delete m_CurrentZoneContour;
162  m_CurrentZoneContour = NULL;
163 }
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:59
void DeleteZONEOutlines()
Function DeleteZONEOutlines deletes ALL zone outlines from the board.
ZONE_CONTAINER * m_CurrentZoneContour
zone contour currently in progress
Definition: class_board.h:261
void DeleteMARKERs()
Function DeleteMARKERs deletes ALL MARKERS from the board.
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 containter and deletes it.

References BOARD_ITEM_CONTAINER::Delete(), DeleteMARKERs(), DeleteZONEOutlines(), m_CurrentZoneContour, 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
aItemis an item to be added.
aModedecides whether the item is added in the beginning or at the end of the list.

Implements BOARD_ITEM_CONTAINER.

Definition at line 867 of file class_board.cpp.

868 {
869  if( aBoardItem == NULL )
870  {
871  wxFAIL_MSG( wxT( "BOARD::Add() param error: aBoardItem NULL" ) );
872  return;
873  }
874 
875  switch( aBoardItem->Type() )
876  {
877  case PCB_NETINFO_T:
878  m_NetInfo.AppendNet( (NETINFO_ITEM*) aBoardItem );
879  break;
880 
881  // this one uses a vector
882  case PCB_MARKER_T:
883  m_markers.push_back( (MARKER_PCB*) aBoardItem );
884  break;
885 
886  // this one uses a vector
887  case PCB_ZONE_AREA_T:
888  m_ZoneDescriptorList.push_back( (ZONE_CONTAINER*) aBoardItem );
889  break;
890 
891  case PCB_TRACE_T:
892  case PCB_VIA_T:
893  if( aMode == ADD_APPEND )
894  {
895  m_Track.PushBack( (TRACK*) aBoardItem );
896  }
897  else
898  {
899  TRACK* insertAid;
900  insertAid = ( (TRACK*) aBoardItem )->GetBestInsertPoint( this );
901  m_Track.Insert( (TRACK*) aBoardItem, insertAid );
902  }
903 
904  break;
905 
906  case PCB_MODULE_T:
907  if( aMode == ADD_APPEND )
908  m_Modules.PushBack( (MODULE*) aBoardItem );
909  else
910  m_Modules.PushFront( (MODULE*) aBoardItem );
911 
912  // Because the list of pads has changed, reset the status
913  // This indicate the list of pad and nets must be recalculated before use
914  m_Status_Pcb = 0;
915  break;
916 
917  case PCB_DIMENSION_T:
918  case PCB_LINE_T:
919  case PCB_TEXT_T:
920  case PCB_TARGET_T:
921  if( aMode == ADD_APPEND )
922  m_Drawings.PushBack( aBoardItem );
923  else
924  m_Drawings.PushFront( aBoardItem );
925 
926  break;
927 
928  // other types may use linked list
929  default:
930  {
931  wxString msg;
932  msg.Printf( wxT( "BOARD::Add() needs work: BOARD_ITEM type (%d) not handled" ),
933  aBoardItem->Type() );
934  wxFAIL_MSG( msg );
935  return;
936  }
937  break;
938  }
939 
940  aBoardItem->SetParent( this );
941  m_connectivity->Add( aBoardItem );
942 }
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:59
void PushFront(T *aNewElement)
Function PushFront puts aNewElement at front of list sequence.
Definition: dlist.h:240
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:100
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:200
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
void PushBack(T *aNewElement)
Function PushBack puts aNewElement at the end of the list sequence.
Definition: dlist.h:250
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:219
DLIST< BOARD_ITEM > m_Drawings
Definition: class_board.h:244
MARKERS m_markers
MARKER_PCBs for clearance problems, owned by pointer.
Definition: class_board.h:179
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:98
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:99
Class NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
TRACK * GetBestInsertPoint(BOARD *aPcb)
Function GetBestInsertPoint searches the "best" insertion point within the track linked list.
class MARKER_PCB, a marker used to show something
Definition: typeinfo.h:97
DLIST< MODULE > m_Modules
Definition: class_board.h:248
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:102
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:96
DLIST< TRACK > m_Track
Definition: class_board.h:249
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:91
void Insert(T *aNewElement, T *aElementAfterMe)
Function Insert puts aNewElement just in front of aElementAfterMe in the list sequence.
Definition: dlist.h:200
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:240

References ADD_APPEND, NETINFO_LIST::AppendNet(), TRACK::GetBestInsertPoint(), DLIST< T >::Insert(), m_connectivity, m_Drawings, m_markers, m_Modules, m_NetInfo, m_Status_Pcb, m_Track, 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, DLIST< T >::PushBack(), DLIST< T >::PushFront(), 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(), PCB_EDIT_FRAME::Begin_DrawSegment(), PCB_EDIT_FRAME::Block_Duplicate(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), PCB_EDIT_FRAME::CreateTarget(), PCB_EDIT_FRAME::CreateTextePcb(), Duplicate(), PCB_EDIT_FRAME::duplicateZone(), PCB_EDIT_FRAME::EditDimension(), PCB_EDIT_FRAME::End_Edge(), PCB_EDIT_FRAME::End_Zone(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), DSN::SPECCTRA_DB::FromSESSION(), InvokeDialogImportGfxBoard(), 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 2324 of file class_board.cpp.

2326 {
2327  ZONE_CONTAINER* new_area = InsertArea( aNetcode,
2328  m_ZoneDescriptorList.size( ) - 1,
2329  aLayer, aStartPointPosition.x,
2330  aStartPointPosition.y, aHatch );
2331 
2332  if( aNewZonesList )
2333  {
2334  ITEM_PICKER picker( new_area, UR_NEW );
2335  aNewZonesList->PushItem( picker );
2336  }
2337 
2338  return new_area;
2339 }
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:59
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 2545 of file class_board.cpp.

2546 {
2547  std::vector<BOARD_CONNECTED_ITEM*> items;
2548 
2549  for( auto track : Tracks() )
2550  {
2551  items.push_back( track );
2552  }
2553 
2554  for( auto mod : Modules() )
2555  {
2556  for( auto pad : mod->Pads() )
2557  {
2558  items.push_back( pad );
2559  }
2560  }
2561 
2562  for( int i = 0; i<GetAreaCount(); i++ )
2563  {
2564  auto zone = GetArea( i );
2565  items.push_back( zone );
2566  }
2567 
2568  return items;
2569 }
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:981
DLIST_ITERATOR_WRAPPER< MODULE > Modules()
Definition: class_board.h:252
size_t i
Definition: json11.cpp:597
DLIST_ITERATOR_WRAPPER< TRACK > Tracks()
Definition: class_board.h:251
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:952
#define mod(a, n)
Definition: greymap.cpp:24

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

Referenced by SanitizeNetcodes().

◆ Back()

BOARD_ITEM* BOARD_ITEM::Back ( ) const
inlineinherited

Definition at line 116 of file class_board_item.h.

116 { return static_cast<BOARD_ITEM*>( Pback ); }
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:171

References EDA_ITEM::Pback.

Referenced by SwapItemData().

◆ BeginNets()

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

Function BeginNets.

Returns
iterator to the first element of the NETINFO_ITEMs list

Definition at line 758 of file class_board.h.

759  {
760  return m_NetInfo.begin();
761  }
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:200
iterator begin() const
Definition: netinfo.h:528

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

167 {
168  GetConnectivity()->Build( this );
169 }
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:292

References GetConnectivity().

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

◆ BuildListOfNets()

void BOARD::BuildListOfNets ( )
inline

Definition at line 727 of file class_board.h.

728  {
730  }
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:200
void buildListOfNets()
Function buildListOfNets builds or rebuilds the list of NETINFO_ITEMs The list is sorted by names.

References NETINFO_LIST::buildListOfNets().

Referenced by Abort_MoveOrCopyModule(), PCBNEW_CONTROL::AppendBoard(), PCB_EDIT_FRAME::AppendBoardFile(), 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().

◆ chainMarkedSegments()

void BOARD::chainMarkedSegments ( TRACK aTrackList,
wxPoint  aPosition,
const LSET aLayerSet,
TRACKS *  aList 
)
private

Function chainMarkedSegments is used by MarkTrace() to set the BUSY flag of connected segments of the trace segment located at aPosition on aLayerMask.

Vias are put in list but their flags BUSY is not set

Parameters
aTrackListis the beginning of the track list (usually the board track list).
aPositionA wxPoint object containing the position of the starting search.
aLayerSetThe allowed layers for segments to search.
aListThe track list to fill with points of flagged segments.

Definition at line 423 of file class_board.cpp.

425 {
426  LSET layer_set = aLayerSet;
427 
428  if( !aTrackList ) // no tracks at all in board
429  return;
430 
431  D_PAD* pad = NULL;
432  double distanceToPadCenter = std::numeric_limits<double>::max();
433 
434  /* Set the BUSY flag of all connected segments, first search starting at
435  * aPosition. The search ends when a pad is found (end of a track), a
436  * segment end has more than one other segment end connected, or when no
437  * connected item found.
438  *
439  * Vias are a special case because they can connect segments
440  * on other layers and they change the layer mask. They can be a track
441  * end or not. They will be analyzed later, and vias on terminal points
442  * of the track will be considered as part of this track if they do not
443  * connect segments on a other track together and will be considered as
444  * part of a other track when removing the via, the segments of that other
445  * track are disconnected.
446  */
447  for( ; ; )
448  {
449  if( !pad )
450  pad = GetPad( aPosition, layer_set );
451 
452  if( pad )
453  distanceToPadCenter = GetLineLength( aPosition, pad->GetCenter() );
454 
455  /* Test for a via: a via changes the layer mask and can connect a lot
456  * of segments at location aPosition. When found, the via is just
457  * pushed in list. Vias will be examined later, when all connected
458  * segment are found and push in list. This is because when a via
459  * is found we do not know at this time the number of connected items
460  * and we do not know if this via is on the track or finish the track
461  */
462  TRACK* via = aTrackList->GetVia( NULL, aPosition, layer_set );
463 
464  if( via )
465  {
466  layer_set = via->GetLayerSet();
467  aList->push_back( via );
468  }
469 
470  int seg_count = 0;
471  TRACK* candidate = NULL;
472 
473  /* Search all segments connected to point aPosition.
474  * if only 1 segment at aPosition: then this segment is "candidate"
475  * if > 1 segment:
476  * then end of "track" (because more than 2 segments are connected at aPosition)
477  */
478  TRACK* segment = aTrackList;
479 
480  while( ( segment = ::GetTrack( segment, NULL, aPosition, layer_set ) ) != NULL )
481  {
482  if( segment->GetState( BUSY ) ) // already found and selected: skip it
483  {
484  segment = segment->Next();
485  continue;
486  }
487 
488  if( segment == via ) // just previously found: skip it
489  {
490  segment = segment->Next();
491  continue;
492  }
493 
494  if( ++seg_count == 1 ) // if first connected item: then segment is candidate
495  {
496  candidate = segment;
497  segment = segment->Next();
498  }
499  else // More than 1 segment connected -> location is end of track
500  {
501  return;
502  }
503  }
504 
505  if( candidate ) // A candidate is found: flag it and push it in list
506  {
507  /* Initialize parameters to search items connected to this
508  * candidate:
509  * we must analyze connections to its other end
510  */
511  if( aPosition == candidate->GetStart() )
512  {
513  aPosition = candidate->GetEnd();
514  }
515  else
516  {
517  aPosition = candidate->GetStart();
518  }
519 
520  /* If we are in a pad, only candidates approaching the pad center
521  * are accepted.
522  */
523  if( pad )
524  {
525  if( GetPad( aPosition, layer_set ) != pad )
526  return;
527 
528  if( GetLineLength( aPosition, pad->GetCenter() ) > distanceToPadCenter )
529  return;
530  }
531 
532  layer_set = candidate->GetLayerSet();
533 
534  // flag this item and push it in list of selected items
535  aList->push_back( candidate );
536  candidate->SetState( BUSY, true );
537  }
538  else
539  {
540  return;
541  }
542  }
543 }
TRACK * GetTrack(TRACK *aStartTrace, const TRACK *aEndTrace, const wxPoint &aPosition, LSET aLayerMask)
Function GetTrack is a helper function to locate a trace segment having an end point at aPosition on ...
Definition: class_track.cpp:68
double GetLineLength(const wxPoint &aPointA, const wxPoint &aPointB)
Function GetLineLength returns the length of a line segment defined by aPointA and aPointB.
Definition: trigo.h:200
const wxPoint & GetStart() const
Definition: class_track.h:133
#define BUSY
Pcbnew: flag indicating that the structure has.
Definition: base_struct.h:134
D_PAD * GetPad(unsigned aIndex) const
Function GetPad.
VIA * GetVia(const wxPoint &aPosition, PCB_LAYER_ID aLayer=UNDEFINED_LAYER)
Function GetVia finds the first VIA object at aPosition on aLayer starting at the trace.
Class LSET is a set of PCB_LAYER_IDs.
void SetState(int type, int state)
Definition: base_struct.h:248
TRACK * Next() const
Definition: class_track.h:110
#define max(a, b)
Definition: auxiliary.h:86
const wxPoint & GetEnd() const
Definition: class_track.h:130
virtual const wxPoint GetCenter() const
Function GetCenter()
int GetState(int type) const
Definition: base_struct.h:243
virtual LSET GetLayerSet() const
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...

References BUSY, BOARD_ITEM::GetCenter(), TRACK::GetEnd(), BOARD_ITEM::GetLayerSet(), GetLineLength(), GetPad(), TRACK::GetStart(), EDA_ITEM::GetState(), GetTrack(), TRACK::GetVia(), max, TRACK::Next(), and EDA_ITEM::SetState().

Referenced by MarkTrace().

◆ ClassOf()

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

Definition at line 230 of file class_board.h.

231  {
232  return aItem && PCB_T == aItem->Type();
233  }
Definition: typeinfo.h:85
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204

References PCB_T, and EDA_ITEM::Type().

◆ ClearAllNetCodes()

void BOARD::ClearAllNetCodes ( )

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

Definition at line 2533 of file class_board.cpp.

2534 {
2535  for( auto zone : Zones() )
2536  zone->SetNetCode( 0 );
2537 
2538  for( auto pad : GetPads() )
2539  pad->SetNetCode( 0 );
2540 
2541  for( auto track : Tracks() )
2542  track->SetNetCode( 0 );
2543 }
const std::vector< D_PAD * > GetPads()
Function GetPads returns a reference to a list of all the pads.
ZONE_CONTAINERS & Zones()
Definition: class_board.h:254
DLIST_ITERATOR_WRAPPER< TRACK > Tracks()
Definition: class_board.h:251

References GetPads(), Tracks(), and Zones().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 239 of file base_struct.h.

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

References BRIGHTENED, and EDA_ITEM::ClearFlags().

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

◆ ClearEditFlags()

void EDA_ITEM::ClearEditFlags ( )
inlineinherited

◆ ClearFlags()

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

Definition at line 260 of file base_struct.h.

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

References EDA_ITEM::m_Flags.

Referenced by Abort_Edit_Pcb_Text(), Abort_EditEdge(), Abort_Move_ModuleOutline(), Abort_Move_Pad(), Abort_MoveOrCopyModule(), Abort_MoveTrack(), Abort_Zone_Create_Outline(), Abort_Zone_Move_Corner_Or_Outlines(), AbortMoveAndEditTarget(), AbortMoveDimensionText(), AbortMoveTextModule(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Zone(), PCB_EDIT_FRAME::Block_Delete(), PCB_EDIT_FRAME::Block_Flip(), PCB_EDIT_FRAME::Block_Move(), PCB_EDIT_FRAME::Change_Side_Module(), SCH_COMPONENT::ClearAllHighlightFlags(), SCH_SCREEN::ClearAnnotation(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), EDA_ITEM::ClearHighlighted(), ClearMarkItems(), clearModuleItemFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), SCH_EDIT_FRAME::ConvertPart(), LIB_EDIT_TOOL::Copy(), CopyMarkedItems(), MWAVE::CreateMicrowaveInductor(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), PCB_EDIT_FRAME::Delete_LastCreatedCorner(), PCB_EDIT_FRAME::Delete_Segment_Edge(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), KIGFX::SCH_PAINTER::draw(), SCH_ITEM::Duplicate(), PCB_EDIT_FRAME::EditDimension(), PCB_EDIT_FRAME::End_Edge(), FOOTPRINT_EDIT_FRAME::End_Edge_Module(), PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines(), PCB_EDIT_FRAME::End_Route(), PCB_EDIT_FRAME::End_Zone(), PCB_EDIT_FRAME::Exchange_Module(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), SCH_MOVE_TOOL::getConnectedDragItems(), PCB_BASE_FRAME::Import_Pad_Settings(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), EDIT_POINTS_FACTORY::Make(), MarkItemsInBloc(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::Place_DrawItem(), FOOTPRINT_EDIT_FRAME::Place_EdgeMod(), PCB_EDIT_FRAME::Place_Texte_Pcb(), PCB_EDIT_FRAME::PlaceDimensionText(), PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment(), PCB_BASE_FRAME::PlaceModule(), PCB_BASE_FRAME::PlacePad(), PCB_EDIT_FRAME::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCB_BASE_FRAME::PlaceTexteModule(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_PIN_TOOL::RepeatPin(), BOARD_COMMIT::Revert(), LIB_EDIT_FRAME::RollbackPartFromUndo(), PCB_BASE_FRAME::Rotate_Module(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_LEGACY_PLUGIN_CACHE::savePin(), SCH_EDIT_FRAME::SelectUnit(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::StartMoveModule(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), and DIALOG_PAD_PROPERTIES::TransferDataFromWindow().

◆ ClearHighlighted()

void EDA_ITEM::ClearHighlighted ( )
inlineinherited

Definition at line 238 of file base_struct.h.

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

References EDA_ITEM::ClearFlags(), and HIGHLIGHTED.

◆ ClearSelected()

void EDA_ITEM::ClearSelected ( )
inlineinherited

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 271 of file base_struct.h.

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

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

Definition at line 123 of file base_struct.cpp.

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

References EDA_ITEM::GetClass().

Referenced by PCB_EDIT_FRAME::Block_Duplicate(), CopyMarkedItems(), LIB_DRAWING_TOOLS::doTwoClickPlace(), SCH_DRAWING_TOOLS::doTwoClickPlace(), 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_EDIT_TOOL::RepeatDrawItem(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), LIB_PART::SetConversion(), LIB_PART::SetUnitCount(), and COMMIT::Stage().

◆ Colors()

const COLORS_DESIGN_SETTINGS& BOARD::Colors ( ) const
inline

Function GetColorSettings.

Returns
the current COLORS_DESIGN_SETTINGS in use

Definition at line 567 of file class_board.h.

567 { return *m_colorsSettings; }
COLORS_DESIGN_SETTINGS * m_colorsSettings
Definition: class_board.h:196

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:59
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:185
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:260
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:651
unsigned GetPriority() const
Function GetPriority.
Definition: class_zone.h:96
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:254

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 289 of file zones_test_and_combine_areas.cpp.

291 {
292  if( area_ref == area_to_combine )
293  {
294  wxASSERT( 0 );
295  return false;
296  }
297 
298  SHAPE_POLY_SET mergedOutlines = *area_ref->Outline();
299  SHAPE_POLY_SET areaToMergePoly = *area_to_combine->Outline();
300 
301  mergedOutlines.BooleanAdd( areaToMergePoly, SHAPE_POLY_SET::PM_FAST );
302  mergedOutlines.Simplify( SHAPE_POLY_SET::PM_FAST );
303 
304  // We should have one polygon with hole
305  // We can have 2 polygons with hole, if the 2 initial polygons have only one common corner
306  // and therefore cannot be merged (they are dectected as intersecting)
307  // but we should never have more than 2 polys
308  if( mergedOutlines.OutlineCount() > 2 )
309  {
310  wxLogMessage(wxT("BOARD::CombineAreas error: more than 2 polys after merging") );
311  return false;
312  }
313 
314  if( mergedOutlines.OutlineCount() > 1 )
315  return false;
316 
317  // Update the area with the new merged outline
318  delete area_ref->Outline();
319  area_ref->SetOutline( new SHAPE_POLY_SET( mergedOutlines ) );
320 
321  RemoveArea( aDeletedList, area_to_combine );
322 
323  area_ref->SetLocalFlags( 1 );
324  area_ref->Hatch();
325 
326  return true;
327 }
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:260
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:263
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...
void SetLocalFlags(int aFlags)
Definition: class_zone.h:255

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

1104 {
1105  bool hasItems = false;
1106  EDA_RECT area;
1107 
1108  // Check segments, dimensions, texts, and fiducials
1109  for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
1110  {
1111  if( aBoardEdgesOnly && (item->Type() != PCB_LINE_T || item->GetLayer() != Edge_Cuts ) )
1112  continue;
1113 
1114  if( !hasItems )
1115  area = item->GetBoundingBox();
1116  else
1117  area.Merge( item->GetBoundingBox() );
1118 
1119  hasItems = true;
1120  }
1121 
1122  if( !aBoardEdgesOnly )
1123  {
1124  // Check modules
1125  for( MODULE* module = m_Modules; module; module = module->Next() )
1126  {
1127  if( !hasItems )
1128  area = module->GetBoundingBox();
1129  else
1130  area.Merge( module->GetBoundingBox() );
1131 
1132  hasItems = true;
1133  }
1134 
1135  // Check tracks
1136  for( TRACK* track = m_Track; track; track = track->Next() )
1137  {
1138  if( !hasItems )
1139  area = track->GetBoundingBox();
1140  else
1141  area.Merge( track->GetBoundingBox() );
1142 
1143  hasItems = true;
1144  }
1145 
1146  // Check zones
1147  for( auto aZone : m_ZoneDescriptorList )
1148  {
1149  if( !hasItems )
1150  area = aZone->GetBoundingBox();
1151  else
1152  area.Merge( aZone->GetBoundingBox() );
1153 
1154  area.Merge( aZone->GetBoundingBox() );
1155  hasItems = true;
1156  }
1157  }
1158 
1159  return area;
1160 }
void Merge(const EDA_RECT &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect.
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
DLIST< BOARD_ITEM > m_Drawings
Definition: class_board.h:244
DLIST< MODULE > m_Modules
Definition: class_board.h:248
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
DLIST< TRACK > m_Track
Definition: class_board.h:249
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:91

References Edge_Cuts, m_Drawings, m_Modules, m_Track, m_ZoneDescriptorList, EDA_RECT::Merge(), and PCB_LINE_T.

Referenced by BuildBoardPolygonOutlines(), DIALOG_EXPORT_SVG::CreateSVGFile(), PCB_EDIT_FRAME::DoGenFootprintsReport(), PCB_EDIT_FRAME::ExportToGenCAD(), 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 80 of file board_items_to_polygon_shape_transform.cpp.

81 {
82  // Number of segments to convert a circle to a polygon
83  const int segcountforcircle = ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF;
84  double correctionFactor = GetCircletoPolyCorrectionFactor( segcountforcircle );
85 
86  // convert tracks and vias:
87  for( TRACK* track = m_Track; track != NULL; track = track->Next() )
88  {
89  if( !track->IsOnLayer( aLayer ) )
90  continue;
91 
92  track->TransformShapeWithClearanceToPolygon( aOutlines,
93  0, segcountforcircle, correctionFactor );
94  }
95 
96  // convert pads
97  for( MODULE* module = m_Modules; module != NULL; module = module->Next() )
98  {
99  module->TransformPadsShapesWithClearanceToPolygon( aLayer,
100  aOutlines, 0, segcountforcircle, correctionFactor );
101 
102  // Micro-wave modules may have items on copper layers
103  module->TransformGraphicShapesWithClearanceToPolygonSet( aLayer,
104  aOutlines, 0, segcountforcircle, correctionFactor );
105  }
106 
107  // convert copper zones
108  for( int ii = 0; ii < GetAreaCount(); ii++ )
109  {
110  ZONE_CONTAINER* zone = GetArea( ii );
111  PCB_LAYER_ID zonelayer = zone->GetLayer();
112 
113  if( zonelayer == aLayer )
115  aOutlines, segcountforcircle, correctionFactor );
116  }
117 
118  // convert graphic items on copper layers (texts)
119  for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
120  {
121  if( !item->IsOnLayer( aLayer ) )
122  continue;
123 
124  switch( item->Type() )
125  {
126  case PCB_LINE_T:
127  ( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon(
128  aOutlines, 0, segcountforcircle, correctionFactor );
129  break;
130 
131  case PCB_TEXT_T:
132  ( (TEXTE_PCB*) item )->TransformShapeWithClearanceToPolygonSet(
133  aOutlines, 0, segcountforcircle, correctionFactor );
134  break;
135 
136  default:
137  break;
138  }
139  }
140 }
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:59
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:185
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:92
PCB_LAYER_ID
A quick note on layer IDs:
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:981
void TransformSolidAreasShapesToPolygonSet(SHAPE_POLY_SET &aCornerBuffer, int aCircleToSegmentsCount, double aCorrectionFactor) const
Function TransformSolidAreasShapesToPolygonSet Convert solid areas full shapes to polygon set (the fu...
DLIST< BOARD_ITEM > m_Drawings
Definition: class_board.h:244
DLIST< MODULE > m_Modules
Definition: class_board.h:248
DLIST< TRACK > m_Track
Definition: class_board.h:249
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:952
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:91
#define ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF
Definition: pcbnew.h:42
double GetCircletoPolyCorrectionFactor(int aSegCountforCircle)

References ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF, GetArea(), GetAreaCount(), GetCircletoPolyCorrectionFactor(), ZONE_CONTAINER::GetLayer(), m_Drawings, m_Modules, m_Track, PCB_LINE_T, PCB_TEXT_T, and ZONE_CONTAINER::TransformSolidAreasShapesToPolygonSet().

Referenced by PlotLayerOutlines().

◆ CreateLockPoint()

TRACK * BOARD::CreateLockPoint ( wxPoint &  aPosition,
TRACK aSegment,
PICKED_ITEMS_LIST aList 
)

Function CreateLockPoint creates an intermediate point on aSegment and break it into two segments at aPosition.

The new segment starts from aPosition and ends at the end point of aSegment. The original segment now ends at aPosition.

Parameters
aPositionA wxPoint object containing the position to test and the new segment start position if the return value is not NULL.
aSegmentThe trace segment to create the lock point on.
aListThe pick list to add the created items to.
Returns
NULL if no new point was created or a pointer to a TRACK object of the created segment. If aSegment points to a via the exact value of aPosition and a pointer to the via are returned.

Definition at line 2246 of file class_board.cpp.

2247 {
2248  /* creates an intermediate point on aSegment and break it into two segments
2249  * at aPosition.
2250  * The new segment starts from aPosition and ends at the end point of
2251  * aSegment. The original segment now ends at aPosition.
2252  */
2253  if( aSegment->GetStart() == aPosition || aSegment->GetEnd() == aPosition )
2254  return NULL;
2255 
2256  // A via is a good lock point
2257  if( aSegment->Type() == PCB_VIA_T )
2258  {
2259  aPosition = aSegment->GetStart();
2260  return aSegment;
2261  }
2262 
2263  // Calculation coordinate of intermediate point relative to the start point of aSegment
2264  wxPoint delta = aSegment->GetEnd() - aSegment->GetStart();
2265 
2266  // calculate coordinates of aPosition relative to aSegment->GetStart()
2267  wxPoint lockPoint = aPosition - aSegment->GetStart();
2268 
2269  // lockPoint must be on aSegment:
2270  // Ensure lockPoint.y/lockPoint.y = delta.y/delta.x
2271  if( delta.x == 0 )
2272  lockPoint.x = 0; // horizontal segment
2273  else
2274  lockPoint.y = KiROUND( ( (double)lockPoint.x * delta.y ) / delta.x );
2275 
2276  /* Create the intermediate point (that is to say creation of a new
2277  * segment, beginning at the intermediate point.
2278  */
2279  lockPoint += aSegment->GetStart();
2280 
2281  TRACK* newTrack = (TRACK*)aSegment->Clone();
2282  // The new segment begins at the new point,
2283  newTrack->SetStart(lockPoint);
2284  newTrack->start = aSegment;
2285  newTrack->SetState( BEGIN_ONPAD, false );
2286 
2287  DLIST<TRACK>* list = (DLIST<TRACK>*)aSegment->GetList();
2288  wxASSERT( list );
2289  list->Insert( newTrack, aSegment->Next() );
2290 
2291  if( aList )
2292  {
2293  // Prepare the undo command for the now track segment
2294  ITEM_PICKER picker( newTrack, UR_NEW );
2295  aList->PushItem( picker );
2296  // Prepare the undo command for the old track segment
2297  // before modifications
2298  picker.SetItem( aSegment );
2299  picker.SetStatus( UR_CHANGED );
2300  picker.SetLink( aSegment->Clone() );
2301  aList->PushItem( picker );
2302  }
2303 
2304  // Old track segment now ends at new point.
2305  aSegment->SetEnd(lockPoint);
2306  aSegment->end = newTrack;
2307  aSegment->SetState( END_ONPAD, false );
2308 
2309  D_PAD * pad = GetPad( newTrack, ENDPOINT_START );
2310 
2311  if( pad )
2312  {
2313  newTrack->start = pad;
2314  newTrack->SetState( BEGIN_ONPAD, true );
2315  aSegment->end = pad;
2316  aSegment->SetState( END_ONPAD, true );
2317  }
2318 
2319  aPosition = lockPoint;
2320  return newTrack;
2321 }
DHEAD * GetList() const
Definition: base_struct.h:215
#define END_ONPAD
Pcbnew: flag set for track segment ending on a pad.
Definition: base_struct.h:133
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:118
void SetEnd(const wxPoint &aEnd)
Definition: class_track.h:129
const wxPoint & GetStart() const
Definition: class_track.h:133
virtual EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
D_PAD * GetPad(unsigned aIndex) const
Function GetPad.
#define BEGIN_ONPAD
Pcbnew: flag set for track segment starting on a pad.
Definition: base_struct.h:132
static const int delta[8][2]
Definition: solve.cpp:112
void SetState(int type, int state)
Definition: base_struct.h:248
TRACK * Next() const
Definition: class_track.h:110
const wxPoint & GetEnd() const
Definition: class_track.h:130
void SetStart(const wxPoint &aStart)
Definition: class_track.h:132
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
BOARD_CONNECTED_ITEM * end
Definition: class_track.h:102
BOARD_CONNECTED_ITEM * start
Definition: class_track.h:101
void Insert(T *aNewElement, T *aElementAfterMe)
Function Insert puts aNewElement just in front of aElementAfterMe in the list sequence.
Definition: dlist.h:200
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204

References BEGIN_ONPAD, TRACK::Clone(), delta, TRACK::end, END_ONPAD, ENDPOINT_START, TRACK::GetEnd(), EDA_ITEM::GetList(), GetPad(), TRACK::GetStart(), DLIST< T >::Insert(), KiROUND(), TRACK::Next(), PCB_VIA_T, PICKED_ITEMS_LIST::PushItem(), TRACK::SetEnd(), ITEM_PICKER::SetItem(), ITEM_PICKER::SetLink(), TRACK::SetStart(), EDA_ITEM::SetState(), ITEM_PICKER::SetStatus(), TRACK::start, EDA_ITEM::Type(), UR_CHANGED, and UR_NEW.

Referenced by PCB_EDIT_FRAME::Begin_Route(), PCB_EDIT_FRAME::End_Route(), and PCB_EDIT_FRAME::Process_Special_Functions().

◆ Delete()

virtual void BOARD_ITEM_CONTAINER::Delete ( BOARD_ITEM aItem)
inlinevirtualinherited

Removes an item from the containter and deletes it.

Parameters
aItemis an item to be deleted.

Definition at line 68 of file board_item_container.h.

69  {
70  Remove( aItem );
71  delete aItem;
72  }
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(), PCB_EDIT_FRAME::Remove_Zone_Corner(), RemoveArea(), PCB_EDIT_FRAME::RemoveStruct(), and ~BOARD().

◆ DeleteMARKERs()

void BOARD::DeleteMARKERs ( )

Function DeleteMARKERs deletes ALL MARKERS from the board.

Definition at line 1016 of file class_board.cpp.

1017 {
1018  // the vector does not know how to delete the MARKER_PCB, it holds pointers
1019  for( MARKER_PCB* marker : m_markers )
1020  delete marker;
1021 
1022  m_markers.clear();
1023 }
MARKERS m_markers
MARKER_PCBs for clearance problems, owned by pointer.
Definition: class_board.h:179

References m_markers.

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

◆ DeleteStructure()

◆ DeleteZONEOutlines()

void BOARD::DeleteZONEOutlines ( )

Function DeleteZONEOutlines deletes ALL zone outlines from the board.

Definition at line 1026 of file class_board.cpp.

1027 {
1028  // the vector does not know how to delete the ZONE Outlines, it holds pointers
1029  for( ZONE_CONTAINER* zone : m_ZoneDescriptorList )
1030  delete zone;
1031 
1032  m_ZoneDescriptorList.clear();
1033 }
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:59
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:182

References m_ZoneDescriptorList.

Referenced by ~BOARD().

◆ Draw()

void BOARD::Draw ( EDA_DRAW_PANEL aPanel,
wxDC *  aDC,
GR_DRAWMODE  aDrawMode,
const wxPoint &  aOffset = ZeroOffset 
)
overridevirtual

Function Draw.

Redraw the BOARD items but not cursors, axis or grid.

Parameters
aPanel= the panel relative to the board
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 135 of file pcb_legacy_draw_utils.cpp.

136 {
137  /* The order of drawing is flexible on some systems and not on others. For
138  * OSes which use OR to draw, the order is not important except for the
139  * effect of the highlight and its relationship to markers. See comment
140  * below.
141  * This order independence comes from the fact that a binary OR operation is
142  * commutative in nature.
143  * However on the OSX, the OR operation is not used, and so this sequence
144  * below is chosen to give MODULEs the highest visible priority.
145  */
146 
147  /* Draw all tracks and zones. As long as dark colors are used for the
148  * tracks, Then the OR draw mode should show tracks underneath other
149  * tracks. But a white track will cover any other color since it has
150  * more bits to OR in.
151  */
152  for( TRACK* track = m_Track; track; track = track->Next() )
153  {
154  if( track->IsMoving() )
155  continue;
156 
157  track->Draw( aPanel, DC, aDrawMode );
158  }
159 
160  // Draw areas (i.e. zones)
161  for( int ii = 0; ii < GetAreaCount(); ii++ )
162  {
163  ZONE_CONTAINER* zone = GetArea( ii );
164 
165  // Areas must be drawn here only if not moved or dragged,
166  // because these areas are drawn by ManageCursor() in a specific manner
167  if( ( zone->GetEditFlags() & (IN_EDIT | IS_DRAGGED | IS_MOVED) ) == 0 )
168  {
169  zone->Draw( aPanel, DC, aDrawMode );
170  zone->DrawFilledArea( aPanel, DC, aDrawMode );
171  }
172  }
173 
174  // Draw the graphic items
175  for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
176  {
177  if( item->IsMoving() )
178  continue;
179 
180  switch( item->Type() )
181  {
182  case PCB_DIMENSION_T:
183  case PCB_TEXT_T:
184  case PCB_TARGET_T:
185  case PCB_LINE_T:
186  item->Draw( aPanel, DC, aDrawMode );
187  break;
188 
189  default:
190  break;
191  }
192  }
193 
194  LSET all_cu = LSET::AllCuMask();
195 
196  for( MODULE* module = m_Modules; module; module = module->Next() )
197  {
198  bool display = true;
199  LSET layerMask = all_cu;
200 
201  if( module->IsMoving() )
202  continue;
203 
205  {
206  if( module->GetLayer() == F_Cu )
207  display = false;
208 
209  layerMask.set( F_Cu, false );
210  }
211 
213  {
214  if( module->GetLayer() == B_Cu )
215  display = false;
216 
217  layerMask.set( B_Cu, false );
218  }
219 
220  if( display )
221  module->Draw( aPanel, DC, aDrawMode );
222  else
223  Trace_Pads_Only( aPanel, DC, module, 0, 0, layerMask, aDrawMode );
224  }
225 
226  if( IsHighLightNetON() )
227  DrawHighLight( aPanel, DC, GetHighLightNetCode() );
228 
229  // draw the BOARD's markers last, otherwise the high light will erase any marker on a pad
230  for( unsigned i = 0; i < m_markers.size(); ++i )
231  {
232  m_markers[i]->Draw( aPanel, DC, aDrawMode );
233  }
234 }
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
void Draw(EDA_DRAW_PANEL *panel, wxDC *DC, GR_DRAWMODE aDrawMode, const wxPoint &offset=ZeroOffset) override
Function Draw Draws the zone outline.
Definition: class_zone.cpp:289
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:59
#define IN_EDIT
Item currently edited.
Definition: base_struct.h:112
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
void DrawFilledArea(EDA_DRAW_PANEL *panel, wxDC *DC, GR_DRAWMODE aDrawMode, const wxPoint &offset=ZeroOffset)
Function DrawDrawFilledArea Draws the filled area for this zone (polygon list .m_FilledPolysList)
Definition: class_zone.cpp:419
bool IsHighLightNetON() const
Function IsHighLightNetON.
Definition: class_board.h:383
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:92
show modules on front
#define IS_DRAGGED
Item being dragged.
Definition: base_struct.h:116
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:981
Class LSET is a set of PCB_LAYER_IDs.
STATUS_FLAGS GetEditFlags() const
Definition: base_struct.h:263
DLIST< BOARD_ITEM > m_Drawings
Definition: class_board.h:244
MARKERS m_markers
MARKER_PCBs for clearance problems, owned by pointer.
Definition: class_board.h:179
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:98
static void Trace_Pads_Only(EDA_DRAW_PANEL *panel, wxDC *DC, MODULE *Module, int ox, int oy, LSET LayerMask, GR_DRAWMODE draw_mode)
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:99
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Function IsElementVisible tests whether a given element category is visible.
int GetHighLightNetCode() const
Function GetHighLightNetCode.
Definition: class_board.h:368
DLIST< MODULE > m_Modules
Definition: class_board.h:248
size_t i
Definition: json11.cpp:597
DLIST< TRACK > m_Track
Definition: class_board.h:249
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:952
void DrawHighLight(EDA_DRAW_PANEL *aDrawPanel, wxDC *aDC, int aNetCode)
Function DrawHighLight redraws the objects in the board that are associated with the given aNetCode a...
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:91
#define IS_MOVED
Item being moved.
Definition: base_struct.h:113

References LSET::AllCuMask(), B_Cu, ZONE_CONTAINER::Draw(), ZONE_CONTAINER::DrawFilledArea(), DrawHighLight(), F_Cu, GetArea(), GetAreaCount(), EDA_ITEM::GetEditFlags(), GetHighLightNetCode(), i, IN_EDIT, IS_DRAGGED, IS_MOVED, IsElementVisible(), IsHighLightNetON(), LAYER_MOD_BK, LAYER_MOD_FR, m_Drawings, m_markers, m_Modules, m_Track, PCB_DIMENSION_T, PCB_LINE_T, PCB_TARGET_T, PCB_TEXT_T, and Trace_Pads_Only().

Referenced by FOOTPRINT_VIEWER_FRAME::RedrawActiveWindow(), FOOTPRINT_WIZARD_FRAME::RedrawActiveWindow(), and PCB_EDIT_FRAME::RedrawActiveWindow().

◆ DrawHighLight()

void BOARD::DrawHighLight ( EDA_DRAW_PANEL aDrawPanel,
wxDC *  aDC,
int  aNetCode 
)

Function DrawHighLight redraws the objects in the board that are associated with the given aNetCode and turns on or off the brilliance associated with that net according to the current value of global g_HighLight_Status.

Parameters
aDrawPanelis needed for the clipping support.
aDC= the current device context
aNetCodeis the net number to highlight or to dim.

Definition at line 237 of file pcb_legacy_draw_utils.cpp.

238 {
239  GR_DRAWMODE draw_mode;
240 
241  if( IsHighLightNetON() )
242  draw_mode = GR_HIGHLIGHT | GR_OR;
243  else
244  draw_mode = GR_AND | GR_HIGHLIGHT;
245 
246  // Redraw zones
247  for( int ii = 0; ii < GetAreaCount(); ii++ )
248  {
249  ZONE_CONTAINER* zone = GetArea( ii );
250 
251  if( zone->GetNetCode() == aNetCode )
252  {
253  zone->Draw( am_canvas, DC, draw_mode );
254  }
255  }
256 
257  // Redraw any pads that have aNetCode
258  for( MODULE* module = m_Modules; module; module = module->Next() )
259  {
260  for( D_PAD* pad = module->PadsList(); pad; pad = pad->Next() )
261  {
262  if( pad->GetNetCode() == aNetCode )
263  {
264  pad->Draw( am_canvas, DC, draw_mode );
265  }
266  }
267  }
268 
269  // Redraw track and vias that have aNetCode
270  for( TRACK* seg = m_Track; seg; seg = seg->Next() )
271  {
272  if( seg->GetNetCode() == aNetCode )
273  {
274  seg->Draw( am_canvas, DC, draw_mode );
275  }
276  }
277 }
D_PAD * Next() const
Definition: class_pad.h:162
void Draw(EDA_DRAW_PANEL *panel, wxDC *DC, GR_DRAWMODE aDrawMode, const wxPoint &offset=ZeroOffset) override
Function Draw Draws the zone outline.
Definition: class_zone.cpp:289
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:59
int GetNetCode() const
Function GetNetCode.
bool IsHighLightNetON() const
Function IsHighLightNetON.
Definition: class_board.h:383
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:981
GR_DRAWMODE
Drawmode. Compositing mode plus a flag or two.
Definition: gr_basic.h:37
Definition: gr_basic.h:38
DLIST< MODULE > m_Modules
Definition: class_board.h:248
DLIST< TRACK > m_Track
Definition: class_board.h:249
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:952

References ZONE_CONTAINER::Draw(), GetArea(), GetAreaCount(), BOARD_CONNECTED_ITEM::GetNetCode(), GR_AND, GR_HIGHLIGHT, GR_OR, IsHighLightNetON(), m_Modules, m_Track, and D_PAD::Next().

Referenced by Abort_Create_Track(), PCB_EDIT_FRAME::Begin_Route(), Draw(), PCB_EDIT_FRAME::End_Route(), PCB_EDIT_FRAME::HighLight(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), and PCB_EDIT_FRAME::StartMoveOneNodeOrSegment().

◆ Drawings()

◆ DrawingsList()

DLIST<BOARD_ITEM>& BOARD::DrawingsList ( )
inline

Definition at line 258 of file class_board.h.

258 { return m_Drawings; }
DLIST< BOARD_ITEM > m_Drawings
Definition: class_board.h:244

Referenced by PCB_EDIT_FRAME::AppendBoardFile(), and PCBNEW_CONTROL::placeBoardItems().

◆ Duplicate()

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

Definition at line 2431 of file class_board.cpp.

2433 {
2434  BOARD_ITEM* new_item = NULL;
2435 
2436  switch( aItem->Type() )
2437  {
2438  case PCB_MODULE_T:
2439  case PCB_TEXT_T:
2440  case PCB_LINE_T:
2441  case PCB_TRACE_T:
2442  case PCB_VIA_T:
2443  case PCB_ZONE_AREA_T:
2444  case PCB_TARGET_T:
2445  case PCB_DIMENSION_T:
2446  new_item = static_cast<BOARD_ITEM*>( aItem->Clone() );
2447  break;
2448 
2449  default:
2450  // Un-handled item for duplication
2451  new_item = NULL;
2452  break;
2453  }
2454 
2455  if( new_item && aAddToBoard )
2456  Add( new_item );
2457 
2458  return new_item;
2459 }
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:100
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:95
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:98
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:99
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:91
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204

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

◆ EndNets()

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

Function EndNets.

Returns
iterator to the last element of the NETINFO_ITEMs list

Definition at line 767 of file class_board.h.

768  {
769  return m_NetInfo.end();
770  }
iterator end() const
Definition: netinfo.h:533
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:200

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

1424 {
1425  if( aSearchByTimeStamp )
1426  {
1427  for( MODULE* module = m_Modules; module; module = module->Next() )
1428  {
1429  if( aRefOrTimeStamp.CmpNoCase( module->GetPath() ) == 0 )
1430  return module;
1431  }
1432  }
1433  else
1434  {
1435  return FindModuleByReference( aRefOrTimeStamp );
1436  }
1437 
1438  return NULL;
1439 }
DLIST< MODULE > m_Modules
Definition: class_board.h:248
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 1395 of file class_board.cpp.

1396 {
1397  MODULE* found = nullptr;
1398 
1399  // search only for MODULES
1400  static const KICAD_T scanTypes[] = { PCB_MODULE_T, EOT };
1401 
1402  INSPECTOR_FUNC inspector = [&] ( EDA_ITEM* item, void* testData )
1403  {
1404  MODULE* module = (MODULE*) item;
1405 
1406  if( aReference == module->GetReference() )
1407  {
1408  found = module;
1409  return SEARCH_QUIT;
1410  }
1411 
1412  return SEARCH_CONTINUE;
1413  };
1414 
1415  // visit this BOARD with the above inspector
1416  BOARD* nonconstMe = (BOARD*) this;
1417  nonconstMe->Visit( inspector, NULL, scanTypes );
1418 
1419  return found;
1420 }
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:77
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:462
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:170
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:157

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

1375 {
1376  // the first valid netcode is 1 and the last is m_NetInfo.GetCount()-1.
1377  // zero is reserved for "no connection" and is not actually a net.
1378  // NULL is returned for non valid netcodes
1379 
1380  wxASSERT( m_NetInfo.GetNetCount() > 0 );
1381 
1382  if( aNetcode == NETINFO_LIST::UNCONNECTED && m_NetInfo.GetNetCount() == 0 )
1384  else
1385  return m_NetInfo.GetNetItem( aNetcode );
1386 }
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:200
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:473
unsigned GetNetCount() const
Function GetNetCount.
Definition: netinfo.h:438
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:465

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(), BOARD_CONNECTED_ITEM::GetNetClass(), DIALOG_SELECT_NET_FROM_LIST::HighlightNet(), PNS::SIZES_SETTINGS::Init(), LEGACY_PLUGIN::loadNETINFO_ITEM(), LEGACY_PLUGIN::loadPAD(), PNS_PCBNEW_RULE_RESOLVER::NetName(), PCB_EDIT_FRAME::OnLeftClick(), 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 1389 of file class_board.cpp.

1390 {
1391  return m_NetInfo.GetNetItem( aNetname );
1392 }
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:200
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)
inlinevirtualinherited

Function Flip Flip this object, i.e.

change the board side for this object

Parameters
aCentre- the rotation point.

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

Definition at line 265 of file class_board_item.h.

266  {
267  wxMessageBox( wxT( "virtual BOARD_ITEM::Flip used, should not occur" ), GetClass() );
268  }
virtual wxString GetClass() const =0
Function GetClass returns the class name.

References EDA_ITEM::GetClass().

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

◆ Flip() [2/2]

void BOARD_ITEM::Flip ( const VECTOR2I aCentre)
inlineinherited

Definition at line 270 of file class_board_item.h.

271  {
272  Flip( wxPoint( aCentre.x, aCentre.y ) );
273  }
virtual void Flip(const wxPoint &aCentre)
Function Flip Flip this object, i.e.

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

◆ GetArea()

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

Function GetArea returns the Area (Zone Container) at a given index.

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

Definition at line 952 of file class_board.h.

953  {
954  if( (unsigned) index < m_ZoneDescriptorList.size() )
955  return m_ZoneDescriptorList[index];
956 
957  return NULL;
958  }
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:182

Referenced by DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), GERBER_JOBFILE_WRITER::addJSONDesignRules(), AllConnectedItems(), PCB_EDIT_FRAME::AppendBoardFile(), PCB_EDIT_FRAME::Begin_Zone(), PCB_EDIT_FRAME::Block_SelectItems(), CN_CONNECTIVITY_ALGO::Build(), ZONE_FILLER::buildZoneFeatureHoleList(), BOARD_NETLIST_UPDATER::cacheCopperZoneConnections(), HYPERLYNX_EXPORTER::collectNetObjects(), ConvertBrdLayerToPolygonalContours(), CINFO3D_VISU::createLayers(), DRC::doEdgeZoneDrc(), DRC::doTrackKeepoutDrc(), Draw(), DrawHighLight(), PCB_EDIT_FRAME::Edit_Zone_Params(), export_vrml_zones(), DIALOG_COPPER_ZONE::ExportSetupToOtherCopperZones(), PCB_IO::format(), PlotSilkScreen(), PlotSolderMaskLayer(), PlotStandardLayer(), PCB_EDIT_FRAME::Process_Special_Functions(), RedrawAreasOutlines(), RedrawFilledAreas(), SaveCopyOfZones(), SetAreasNetCodesFromNetNames(), SetElementVisibility(), TestForExistingItem(), DRC::testKeepoutAreas(), DRC::testZones(), DRC::TestZoneToZoneOutline(), NETINFO_MAPPING::Update(), BOARD_NETLIST_UPDATER::updateCopperZoneNets(), and UpdateCopyOfZonesList().

◆ GetAreaCount()

◆ GetAreaIndex()

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

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

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

Definition at line 966 of file class_board.h.

967  {
968  for( int ii = 0; ii < GetAreaCount(); ii++ ) // Search for aArea in list
969  {
970  if( aArea == GetArea( ii ) ) // Found !
971  return ii;
972  }
973 
974  return -1;
975  }
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:981
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:952

Referenced by PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines(), PCB_EDIT_FRAME::End_Zone(), and PCB_EDIT_FRAME::Remove_Zone_Corner().

◆ GetAuxOrigin()

const wxPoint& BOARD::GetAuxOrigin ( ) const
inline

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

65 {
66  if( Type() == PCB_T )
67  return (BOARD*) this;
68 
69  BOARD_ITEM* parent = GetParent();
70 
71  if( parent )
72  return parent->GetBoard();
73 
74  return NULL;
75 }
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:170
BOARD_ITEM_CONTAINER * GetParent() const
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204

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

Referenced by DeleteMarkedItems(), TEXTE_PCB::Draw(), PCB_TARGET::Draw(), ZONE_CONTAINER::Draw(), EDGE_MODULE::Draw(), TEXTE_MODULE::Draw(), TRACK::Draw(), DIMENSION::Draw(), DRAWSEGMENT::Draw(), MODULE::Draw(), VIA::Draw(), D_PAD::Draw(), MODULE::DrawAncre(), ZONE_CONTAINER::DrawFilledArea(), TEXTE_PCB::Flip(), TRACK::Flip(), VIA::Flip(), ZONE_CONTAINER::Flip(), BOARD_ITEM::GetBoard(), MODULE::GetBoundingPoly(), 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(), EAGLE_PLUGIN::packageWire(), PushTrack(), BOARD_CONNECTED_ITEM::SetNet(), BOARD_CONNECTED_ITEM::SetNetCode(), 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 802 of file class_board.h.

803  {
804  return ComputeBoundingBox( true );
805  }
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(), PCB_EDIT_FRAME::SpreadFootprints(), 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 2473 of file class_board.cpp.

2474 {
2475  bool success = BuildBoardPolygonOutlines( this, aOutlines, aErrorText,
2476  ARC_HIGH_DEF, aErrorLocation );
2477 
2478  // Make polygon strictly simple to avoid issues (especially in 3D viewer)
2480 
2481  return success;
2482 
2483 }
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(), 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 790 of file class_board.h.

791  {
792  return ComputeBoundingBox( false );
793  }
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 96 of file class_board_item.h.

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

References BOARD_ITEM::GetPosition().

Referenced by chainMarkedSegments(), and LEGACY_ARRAY_CREATOR::getRotationCentre().

◆ GetClass()

wxString BOARD::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Implements EDA_ITEM.

Definition at line 888 of file class_board.h.

889  {
890  return wxT( "BOARD" );
891  }

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

293  {
294  return m_connectivity;
295  }
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: class_board.h:192

Referenced by PCB_EDIT_FRAME::Block_Delete(), PCB_EDIT_FRAME::Block_Flip(), PCB_EDIT_FRAME::Block_Move(), PCB_EDIT_FRAME::Block_Rotate(), PCB_BASE_FRAME::build_ratsnest_module(), BuildConnectivity(), DIALOG_SELECT_NET_FROM_LIST::buildNetsList(), TRACKS_CLEANER::buildTrackConnectionInfo(), BOARD_NETLIST_UPDATER::cacheCopperZoneConnections(), PCB_EDITOR_CONTROL::calculateSelectionRatsnest(), PCB_EDIT_FRAME::Change_Side_Module(), TRACKS_CLEANER::cleanupVias(), PCB_BASE_FRAME::Compile_Ratsnest(), PCB_EDIT_FRAME::Delete_net(), PCB_EDIT_FRAME::Delete_Segment(), PCB_DRAW_PANEL_GAL::DisplayBoard(), PCB_BASE_FRAME::DrawGeneralRatsnest(), PCB_EDIT_FRAME::Edit_Zone_Params(), PCB_EDIT_FRAME::End_Route(), PCB_EDIT_FRAME::EraseRedundantTrack(), ZONE_FILLER::Fill(), DRAG_LIST::fillList(), filterNetClass(), PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), GetMsgPanelInfo(), PCB_EDIT_FRAME::ImportSpecctraSession(), TRACKS_CLEANER::mergeCollinearSegments(), DIALOG_NETLIST::OnCompileRatsnestClick(), PadDelete(), PCB_BASE_FRAME::PlaceModule(), PCB_EDIT_FRAME::Process_Special_Functions(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), PCB_EDIT_FRAME::Remove_One_Track(), TRACKS_CLEANER::removeBadTrackSegments(), BOARD_COMMIT::Revert(), PCB_BASE_FRAME::Rotate_Module(), AR_AUTOPLACER::rotateModule(), SELECTION_TOOL::selectAllItemsConnectedToItem(), SELECTION_TOOL::selectAllItemsOnNet(), PCB_EDIT_FRAME::SetBoard(), SetElementVisibility(), TRACKS_CLEANER::testTrackEndpointDangling(), DRC::testUnconnected(), DRC::testZones(), PCB_BASE_FRAME::TraceAirWiresToTargets(), 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 732 of file class_board.cpp.

733 {
735 }
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(), PCBNEW_CONTROL::AppendBoard(), PCB_EDIT_FRAME::AppendBoardFile(), Autoroute_One_Track(), GENDRILL_WRITER_BASE::BuildFileFunctionAttributeString(), DSN::SPECCTRA_DB::buildLayerMaps(), compute_layer_Zs(), compute_pad_access_code(), CreateComponentsSection(), CreatePadsShapesSection(), CreateRoutesSection(), DIALOG_SWAP_LAYERS::DIALOG_SWAP_LAYERS(), VIA::Draw(), DRAWING_TOOL::DrawVia(), TEXTE_PCB::Flip(), TRACK::Flip(), VIA::Flip(), ZONE_CONTAINER::Flip(), DSN::SPECCTRA_DB::FromBOARD(), GetGerberFileFunctionAttribute(), CINFO3D_VISU::InitSettings(), PCB_EDIT_FRAME::IsMicroViaAcceptable(), PCBNEW_CONTROL::LayerNext(), PCBNEW_CONTROL::LayerPrev(), EAGLE_PLUGIN::Load(), DSN::SPECCTRA_DB::makeIMAGE(), DSN::SPECCTRA_DB::makePADSTACK(), DSN::SPECCTRA_DB::makeVIA(), PARAM_CFG_LAYERS::SaveParam(), ZONE_SETTINGS::SetupLayersList(), PCB_BASE_FRAME::SwitchLayer(), PCB_EDIT_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 534 of file class_board.h.

535  {
536  // remove const-ness with cast.
538  }
BOARD_DESIGN_SETTINGS m_designSettings
Definition: class_board.h:194
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.

Referenced by GERBER_JOBFILE_WRITER::addJSONDesignRules(), GERBER_JOBFILE_WRITER::addJSONGeneralSpecs(), Append_Track_Width_List(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildFilterLists(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildNetclassesGrid(), ZONE_FILLER::buildUnconnectedThermalStubsPolygonList(), ZONE_FILLER::buildZoneFeatureHoleList(), EDIT_TOOL::changeTrackWidthOnClick(), compute_layer_Zs(), 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(), PCB_EDIT_FRAME::EditDimension(), TRACK_WIDTH_MENU::eventHandler(), DIFF_PAIR_MENU::eventHandler(), EVT_GRID_CMD_CELL_CHANGED(), PCB_EDIT_FRAME::Export_IDF3(), 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(), MODULE::GetBoundingPoly(), 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_TEXT_AND_GRAPHICS::ImportSettingsFrom(), PANEL_SETUP_FEATURE_CONSTRAINTS::ImportSettingsFrom(), PANEL_SETUP_TRACKS_AND_VIAS::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(), NETINFO_ITEM::NETINFO_ITEM(), DIALOG_DRC_CONTROL::OnActivateDlg(), DIALOG_PAD_PROPERTIES::onAddPrimitive(), DIALOG_BOARD_SETUP::OnAuxiliaryAction(), PCB_EDIT_FRAME::OnHotKey(), ROUTER_TOOL::onViaCommand(), PCB_EDIT_FRAME::OpenProjectFiles(), OrCell_Trace(), EAGLE_PLUGIN::packageWire(), 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(), 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(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), PANEL_SETUP_LAYERS::TransferDataFromWindow(), PANEL_SETUP_LAYERS::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow(), TRACK_WIDTH_MENU::update(), DIFF_PAIR_MENU::update(), PCB_EDITOR_CONTROL::ViaSizeDec(), PCB_EDITOR_CONTROL::ViaSizeInc(), MODULE::ViewBBox(), and HYPERLYNX_EXPORTER::writeStackupInfo().

◆ GetEditFlags()

STATUS_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 263 of file base_struct.h.

264  {
268  return m_Flags & mask;
269  }
#define END_ONPAD
Pcbnew: flag set for track segment ending on a pad.
Definition: base_struct.h:133
#define BEGIN_ONPAD
Pcbnew: flag set for track segment starting on a pad.
Definition: base_struct.h:132
#define EDA_ITEM_ALL_FLAGS
Definition: base_struct.h:148
#define SELECTED
Definition: base_struct.h:121
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:137
#define DP_COUPLED
item is coupled with another item making a differential pair
Definition: base_struct.h:139
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:136
#define IS_DANGLING
indicates a pin is dangling
Definition: base_struct.h:143
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:181
#define ENDPOINT
ends. (Used to support dragging.)
Definition: base_struct.h:120
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: base_struct.h:119

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

Referenced by AbortMoveAndEditTarget(), SCH_EDIT_TOOL::ChangeShape(), EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::ConvertTextType(), PCB_EDIT_FRAME::createPopUpMenuForFootprints(), PCB_EDIT_FRAME::createPopUpMenuForFpPads(), PCB_EDIT_FRAME::createPopUpMenuForFpTexts(), PCB_EDIT_FRAME::createPopUpMenuForTexts(), PCB_EDIT_FRAME::createPopupMenuForTracks(), PCB_EDIT_FRAME::createPopUpMenuForZones(), PCB_EDIT_FRAME::Delete_Segment_Edge(), SCH_EDIT_FRAME::DeleteJunction(), PCB_BASE_FRAME::DeleteTextModule(), Draw(), PCB_EDIT_FRAME::Edit_TrackSegm_Width(), SCH_EDIT_FRAME::EditComponentFieldText(), SCH_EDIT_FRAME::EditImage(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), PCB_EDIT_FRAME::FlipTextePcb(), LIB_VIEW_FRAME::GeneralControl(), FOOTPRINT_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotkeyBeginRoute(), PCB_EDIT_FRAME::OnHotkeyCopyItem(), PCB_EDIT_FRAME::OnHotkeyDeleteItem(), PCB_EDIT_FRAME::OnHotkeyDuplicateOrArrayItem(), PCB_EDIT_FRAME::OnHotkeyEditItem(), PCB_EDIT_FRAME::OnHotkeyFlipItem(), PCB_EDIT_FRAME::OnHotkeyMoveItem(), PCB_EDIT_FRAME::OnHotkeyPlaceItem(), PCB_EDIT_FRAME::OnHotkeyRotateItem(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), FOOTPRINT_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), EDA_DRAW_PANEL::OnMouseEvent(), FOOTPRINT_EDIT_FRAME::OnRightClick(), GERBVIEW_FRAME::OnRightClick(), PCB_EDIT_FRAME::OnRightClick(), PCB_EDIT_FRAME::PlaceTarget(), FOOTPRINT_EDIT_FRAME::PrepareItemForHotkey(), TRACKS_CLEANER::removeDuplicatesOfTrack(), PCB_BASE_FRAME::Rotate_Module(), PCB_EDIT_FRAME::Rotate_Texte_Pcb(), PCB_BASE_FRAME::RotateTextModule(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::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 277 of file class_board.h.

277 { 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 237 of file class_board.h.

237 { return m_fileName; }
wxString m_fileName
the board filename
Definition: class_board.h:176

Referenced by AddGerberX2Header(), GERBER_JOBFILE_WRITER::addJSONGeneralSpecs(), DIALOG_GEN_FOOTPRINT_POSITION::CreateFiles(), CreateHeaderInfoData(), DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP(), DIALOG_GENCAD_EXPORT_OPTIONS::DIALOG_GENCAD_EXPORT_OPTIONS(), PCB_DRAW_PANEL_GAL::DisplayBoard(), PCB_EDIT_FRAME::Export_IDF3(), DIALOG_EXPORT_SVG::ExportSVGFile(), PCB_EDIT_FRAME::GenD356File(), DIALOG_GENDRILL::GenDrillAndMapFiles(), GENDRILL_WRITER_BASE::GenDrillReportFile(), PCB_EDIT_FRAME::GenFootprintsReport(), GENDRILL_WRITER_BASE::getDrillFileName(), PCB_EDIT_FRAME::GetLastNetListRead(), PCB_EDIT_FRAME::ImportSpecctraSession(), PCB_EDIT_FRAME::InstallNetlistFrame(), 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_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_GEN_FOOTPRINT_POSITION::OnOutputDirectoryBrowseClicked(), PLOT_CONTROLLER::OpenPlotfile(), DIALOG_PLOT::Plot(), PCB_EDIT_FRAME::RecreateBOMFileFromBoard(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), PCB_EDIT_FRAME::SetLastNetListRead(), StartPlotBoard(), PCB_EDIT_FRAME::UpdateTitle(), HYPERLYNX_EXPORTER::writeBoardInfo(), and DIALOG_DRC_CONTROL::writeReport().

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

2159 {
2160  MODULE* pt_module;
2161  MODULE* module = NULL;
2162  MODULE* alt_module = NULL;
2163  int min_dim = 0x7FFFFFFF;
2164  int alt_min_dim = 0x7FFFFFFF;
2165  bool current_layer_back = IsBackLayer( aActiveLayer );
2166 
2167  for( pt_module = m_Modules; pt_module; pt_module = pt_module->Next() )
2168  {
2169  // is the ref point within the module's bounds?
2170  if( !pt_module->HitTest( aPosition ) )
2171  continue;
2172 
2173  // if caller wants to ignore locked modules, and this one is locked, skip it.
2174  if( aIgnoreLocked && pt_module->IsLocked() )
2175  continue;
2176 
2177  PCB_LAYER_ID layer = pt_module->GetLayer();
2178 
2179  // Filter non visible modules if requested
2180  if( !aVisibleOnly || IsModuleLayerVisible( layer ) )
2181  {
2182  EDA_RECT bb = pt_module->GetFootprintRect();
2183 
2184  int offx = bb.GetX() + bb.GetWidth() / 2;
2185  int offy = bb.GetY() + bb.GetHeight() / 2;
2186 
2187  // off x & offy point to the middle of the box.
2188  int dist = ( aPosition.x - offx ) * ( aPosition.x - offx ) +
2189  ( aPosition.y - offy ) * ( aPosition.y - offy );
2190 
2191  if( current_layer_back == IsBackLayer( layer ) )
2192  {
2193  if( dist <= min_dim )
2194  {
2195  // better footprint shown on the active side
2196  module = pt_module;
2197  min_dim = dist;
2198  }
2199  }
2200  else if( aVisibleOnly && IsModuleLayerVisible( layer ) )
2201  {
2202  if( dist <= alt_min_dim )
2203  {
2204  // better footprint shown on the other side
2205  alt_module = pt_module;
2206  alt_min_dim = dist;
2207  }
2208  }
2209  }
2210  }
2211 
2212  if( module )
2213  {
2214  return module;
2215  }
2216 
2217  if( alt_module)
2218  {
2219  return alt_module;
2220  }
2221 
2222  return NULL;
2223 }
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Function HitTest tests if aPosition is contained within or on the bounding box of an item.
static const int dist[10][10]
Definition: ar_matrix.cpp:320
int GetX() const
Definition: eda_rect.h:109
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
int GetWidth() const
Definition: eda_rect.h:117
EDA_RECT GetFootprintRect() const
Function GetFootprintRect() Returns the area of the module footprint excluding any text.
PCB_LAYER_ID
A quick note on layer IDs:
bool IsLocked() const override
Function IsLocked.
Definition: class_module.h:267
int GetHeight() const
Definition: eda_rect.h:118
DLIST< MODULE > m_Modules
Definition: class_board.h:248
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
int GetY() const
Definition: eda_rect.h:110
bool IsModuleLayerVisible(PCB_LAYER_ID aLayer)
Function IsModuleLayerVisible expects either of the two layers on which a module can reside,...
MODULE * Next() const
Definition: class_module.h:122
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.

References dist, MODULE::GetFootprintRect(), EDA_RECT::GetHeight(), BOARD_ITEM::GetLayer(), EDA_RECT::GetWidth(), EDA_RECT::GetX(), EDA_RECT::GetY(), MODULE::HitTest(), IsBackLayer(), MODULE::IsLocked(), IsModuleLayerVisible(), m_Modules, and MODULE::Next().

Referenced by PCB_EDIT_FRAME::OnHotKey(), and PCB_EDIT_FRAME::OnHotkeyDeleteItem().

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

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

References HIGH_LIGHT_INFO::m_netCode.

Referenced by Abort_Create_Track(), PCB_EDIT_FRAME::Begin_Zone(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildFilterLists(), and Draw().

◆ GetItem()

BOARD_ITEM * BOARD::GetItem ( void *  aWeakReference)

Definition at line 1036 of file class_board.cpp.

1037 {
1038  for( TRACK* track : Tracks() )
1039  if( track == aWeakReference )
1040  return track;
1041 
1042  for( MODULE* module : Modules() )
1043  {
1044  if( module == aWeakReference )
1045  return module;
1046 
1047  for( D_PAD* pad : module->Pads() )
1048  if( pad == aWeakReference )
1049  return pad;
1050 
1051  if( &module->Reference() == aWeakReference )
1052  return &module->Reference();
1053 
1054  if( &module->Value() == aWeakReference )
1055  return &module->Value();
1056 
1057  for( BOARD_ITEM* drawing : module->GraphicalItems() )
1058  if( drawing == aWeakReference )
1059  return drawing;
1060  }
1061 
1062  for( ZONE_CONTAINER* zone : Zones() )
1063  if( zone == aWeakReference )
1064  return zone;
1065 
1066  for( BOARD_ITEM* drawing : Drawings() )
1067  if( drawing == aWeakReference )
1068  return drawing;
1069 
1070  // Not found; weak reference has been deleted.
1071  return &g_DeletedItem;
1072 }
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:59
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:95
DLIST_ITERATOR_WRAPPER< MODULE > Modules()
Definition: class_board.h:252
ZONE_CONTAINERS & Zones()
Definition: class_board.h:254
DLIST_ITERATOR_WRAPPER< TRACK > Tracks()
Definition: class_board.h:251
DLIST_ITERATOR_WRAPPER< BOARD_ITEM > Drawings()
Definition: class_board.h:253

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

123 { return m_Layer; }
PCB_LAYER_ID m_Layer

References BOARD_ITEM::m_Layer.

Referenced by Abort_MoveOrCopyModule(), DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), CN_CONNECTIVITY_ALGO::Add(), CN_LIST::Add(), CINFO3D_VISU::AddGraphicsShapesWithClearanceToContainer(), DIMENSION::AdjustDimensionDetails(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), AR_AUTOPLACER::buildFpAreas(), PCB_EDIT_FRAME::Change_Side_Module(), checkConnectedTo(), MODULE::CopyNetlistSettings(), 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(), PCB_EDIT_FRAME::DoGenFootprintsPositionFile(), DRC::doTrackKeepoutDrc(), TEXTE_MODULE::Draw(), DRAWSEGMENT::Draw(), KIGFX::PCB_PAINTER::draw(), FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer(), FOOTPRINT_EDIT_FRAME::Edit_Edge_Width(), export_vrml_drawsegment(), export_vrml_edge_module(), export_vrml_module(), export_vrml_pcbtext(), export_vrml_text_module(), PCB_EDIT_FRAME::ExportToGenCAD(), TEXTE_PCB::Flip(), PCB_TARGET::Flip(), EDGE_MODULE::Flip(), TEXTE_MODULE::Flip(), TRACK::Flip(), DIMENSION::Flip(), MODULE::Flip(), DRAWSEGMENT::Flip(), PCB_IO::FootprintSave(), FootprintWriteShape(), PCB_IO::formatLayer(), DSN::SPECCTRA_DB::FromBOARD(), AR_AUTOPLACER::genModuleOnRoutingMatrix(), GetFootprint(), ZONE_CONTAINER::GetLayer(), AR_AUTOPLACER::getOptimalModulePlacement(), GetPad(), TEXT_MOD_GRID_TABLE::GetValueAsLong(), GetVisibleTrack(), SELECTION_TOOL::guessSelectionCandidates(), idf_export_module(), GENERAL_COLLECTOR::Inspect(), PCB_LAYER_COLLECTOR::Inspect(), D_PAD::IsFlipped(), MODULE::IsFlipped(), EDGE_MODULE::IsParentFlipped(), TEXTE_MODULE::IsParentFlipped(), itemIsIncludedByFilter(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), MarkTrace(), DIALOG_FOOTPRINT_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAddField(), PCB_EDIT_FRAME::OnRightClick(), EAGLE_PLUGIN::packagePad(), PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment(), 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(), processBoardItem(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), processTextItem(), TRACKS_CLEANER::removeDuplicatesOfTrack(), PCB_BASE_FRAME::ResetTextSize(), SELECTION_TOOL::selectable(), TEXT_MOD_GRID_TABLE::SetValueAsLong(), ShowClearance(), 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(), TraceSegmentPcb(), TrackListSortByNetcode(), 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(), 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 572 of file class_board.cpp.

573 {
574 
575  // Look for the BOARD specific copper layer names
576  for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
577  {
578  if ( IsCopperLayer( layer ) && ( m_Layer[ layer ].m_name == aLayerName ) )
579  {
580  return ToLAYER_ID( layer );
581  }
582  }
583 
584  // Otherwise fall back to the system standard layer names
585  for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
586  {
587  if( GetStandardLayerName( ToLAYER_ID( layer ) ) == aLayerName )
588  {
589  return ToLAYER_ID( layer );
590  }
591  }
592 
593  return UNDEFINED_LAYER;
594 }
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:654

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

79 {
80  BOARD* board = GetBoard();
81 
82  if( board )
83  return board->GetLayerName( m_Layer );
84 
85  // If no parent, return standard name
87 }
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:170
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:654

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(), DIMENSION::GetSelectMenuText(), DRAWSEGMENT::GetSelectMenuText(), TRACK::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 596 of file class_board.cpp.

597 {
598  // All layer names are stored in the BOARD.
599  if( IsLayerEnabled( aLayer ) )
600  {
601  // Standard names were set in BOARD::BOARD() but they may be
602  // over-ridden by BOARD::SetLayerName().
603  // For copper layers, return the actual copper layer name,
604  // otherwise return the Standard English layer name.
605  if( IsCopperLayer( aLayer ) )
606  return m_Layer[aLayer].m_name;
607  }
608 
609  return GetStandardLayerName( aLayer );
610 }
wxString m_name
The name of the layer, there should be no spaces in this name.
Definition: class_board.h:112
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:441
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:654

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

Referenced by GERBER_JOBFILE_WRITER::addJSONMaterialStackup(), DSN::SPECCTRA_DB::buildLayerMaps(), GRID_CELL_LAYER_RENDERER::Draw(), PCB_IO::format(), PCB_IO::formatBoardLayers(), 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(), 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 131 of file class_board_item.h.

131 { 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(), chainMarkedSegments(), Collect_TrackSegmentsToDrag(), DRC::doTrackDrc(), DRC::doTrackKeepoutDrc(), DRAWING_TOOL::DrawVia(), PCB_EDIT_FRAME::EraseRedundantTrack(), find_vias_and_tracks_at(), TRACK::GetEndSegments(), TRACK::GetTrack(), hash_board_item(), MarkTrace(), POINT_EDITOR::OnSelectionChange(), and PCB_EDIT_FRAME::StartMoveOneNodeOrSegment().

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

659 {
660  if( !IsCopperLayer( aLayer ) )
661  return LT_SIGNAL;
662 
663  //@@IMB: The original test was broken due to the discontinuity
664  // in the layer sequence.
665  if( IsLayerEnabled( aLayer ) )
666  return m_Layer[aLayer].m_type;
667 
668  return LT_SIGNAL;
669 }
LAYER_T m_type
The type of the layer.
Definition: class_board.h:114
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:441
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

◆ GetLockPoint()

BOARD_CONNECTED_ITEM * BOARD::GetLockPoint ( const wxPoint &  aPosition,
LSET  aLayerMask 
)

Function GetLockPoint returns the item at the "attachment" point at the end of a trace at aPosition on aLayerMask.

This may be a PAD or another trace segment.

Parameters
aPositionA wxPoint object containing the position to test.
aLayerMaskA layer or layers to mask the hit test. Use -1 to ignore layer mask.
Returns
A pointer to a BOARD_ITEM object if found otherwise NULL.

Definition at line 2226 of file class_board.cpp.

2227 {
2228  for( MODULE* module = m_Modules; module; module = module->Next() )
2229  {
2230  D_PAD* pad = module->GetPad( aPosition, aLayerSet );
2231 
2232  if( pad )
2233  return pad;
2234  }
2235 
2236  // No pad has been located so check for a segment of the trace.
2237  TRACK* segment = ::GetTrack( m_Track, NULL, aPosition, aLayerSet );
2238 
2239  if( !segment )
2240  segment = GetVisibleTrack( m_Track, aPosition, aLayerSet );
2241 
2242  return segment;
2243 }
TRACK * GetTrack(TRACK *aStartTrace, const TRACK *aEndTrace, const wxPoint &aPosition, LSET aLayerMask)
Function GetTrack is a helper function to locate a trace segment having an end point at aPosition on ...
Definition: class_track.cpp:68
TRACK * GetVisibleTrack(TRACK *aStartingTrace, const wxPoint &aPosition, LSET aLayerSet) const
Function GetVisibleTrack finds the neighboring visible segment of aTrace at aPosition that is on a la...
DLIST< MODULE > m_Modules
Definition: class_board.h:248
DLIST< TRACK > m_Track
Definition: class_board.h:249

References GetTrack(), GetVisibleTrack(), m_Modules, and m_Track.

Referenced by PCB_EDIT_FRAME::Begin_Route(), and PCB_EDIT_FRAME::End_Route().

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

324  {
325  if( (unsigned) index < m_markers.size() )
326  return m_markers[index];
327 
328  return NULL;
329  }
MARKERS m_markers
MARKER_PCBs for clearance problems, owned by pointer.
Definition: class_board.h:179

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

◆ GetMARKERCount()

int BOARD::GetMARKERCount ( ) const
inline

Function GetMARKERCount.

Returns
int - The number of MARKER_PCBS.

Definition at line 335 of file class_board.h.

336  {
337  return (int) m_markers.size();
338  }
MARKERS m_markers
MARKER_PCBs for clearance problems, owned by pointer.
Definition: class_board.h:179

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

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

Definition at line 272 of file base_struct.cpp.

273 {
274  return dummy_xpm;
275 }
static const BITMAP_OPAQUE dummy_xpm[1]
Definition: base_struct.cpp:56

References dummy_xpm.

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay(), and PCB_BASE_FRAME::PcbGeneralLocateAndDisplay().

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

1164 {
1165  wxString txt;
1166  int viasCount = 0;
1167  int trackSegmentsCount = 0;
1168 
1169  for( BOARD_ITEM* item = m_Track; item; item = item->Next() )
1170  {
1171  if( item->Type() == PCB_VIA_T )
1172  viasCount++;
1173  else
1174  trackSegmentsCount++;
1175  }
1176 
1177  txt.Printf( wxT( "%d" ), GetPadCount() );
1178  aList.push_back( MSG_PANEL_ITEM( _( "Pads" ), txt, DARKGREEN ) );
1179 
1180  txt.Printf( wxT( "%d" ), viasCount );
1181  aList.push_back( MSG_PANEL_ITEM( _( "Vias" ), txt, DARKGREEN ) );
1182 
1183  txt.Printf( wxT( "%d" ), trackSegmentsCount );
1184  aList.push_back( MSG_PANEL_ITEM( _( "Track Segments" ), txt, DARKGREEN ) );
1185 
1186  txt.Printf( wxT( "%d" ), GetNodesCount() );
1187  aList.push_back( MSG_PANEL_ITEM( _( "Nodes" ), txt, DARKCYAN ) );
1188 
1189  txt.Printf( wxT( "%d" ), m_NetInfo.GetNetCount() - 1 /* Don't include "No Net" in count */ );
1190  aList.push_back( MSG_PANEL_ITEM( _( "Nets" ), txt, RED ) );
1191 
1192  txt.Printf( wxT( "%d" ), GetConnectivity()->GetUnconnectedCount() );
1193  aList.push_back( MSG_PANEL_ITEM( _( "Unrouted" ), txt, BLUE ) );
1194 }
Definition: colors.h:57
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:200
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:292
Definition: colors.h:60
unsigned GetPadCount()
Function GetPadCount.
unsigned GetNetCount() const
Function GetNetCount.
Definition: netinfo.h:438
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
DLIST< TRACK > m_Track
Definition: class_board.h:249
Class EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53

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

Referenced by PCB_BASE_FRAME::UpdateMsgPanel().

◆ GetNetCount()

unsigned BOARD::GetNetCount ( ) const
inline

Function GetNetCount.

Returns
the number of nets (NETINFO_ITEM)

Definition at line 777 of file class_board.h.

778  {
779  return m_NetInfo.GetNetCount();
780  }
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:200
unsigned GetNetCount() const
Function GetNetCount.
Definition: netinfo.h:438

References NETINFO_LIST::GetNetCount().

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

◆ GetNetInfo()

◆ getNextNumberInSequence()

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

Definition at line 98 of file class_board_item.cpp.

99 {
100  if( aSeq.empty() )
101  return 1;
102 
103  // By default go to the end of the sequence
104  int candidate = *aSeq.rbegin();
105 
106  // Filling in gaps in pad numbering
107  if( aFillSequenceGaps )
108  {
109  // start at the beginning
110  candidate = *aSeq.begin();
111 
112  for( auto it : aSeq )
113  {
114  if( it - candidate > 1 )
115  break;
116 
117  candidate = it;
118  }
119  }
120 
121  ++candidate;
122 
123  return candidate;
124 }

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

1082 {
1083  unsigned retval = 0;
1084  for( auto mod : Modules() )
1085  {
1086  for( auto pad : mod->Pads() )
1087  {
1088  if( ( aNet == -1 && pad->GetNetCode() > 0 ) || aNet == pad->GetNetCode() )
1089  retval++;
1090  }
1091  }
1092 
1093  return retval;
1094 }
DLIST_ITERATOR_WRAPPER< MODULE > Modules()
Definition: class_board.h:252
#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().

◆ GetNumSegmTrack()

int BOARD::GetNumSegmTrack ( ) const

Functions to get some items count.

Definition at line 1075 of file class_board.cpp.

1076 {
1077  return m_Track.GetCount();
1078 }
unsigned GetCount() const
Function GetCount returns the number of elements in the list.
Definition: dlist.h:126
DLIST< TRACK > m_Track
Definition: class_board.h:249

References DHEAD::GetCount(), and m_Track.

Referenced by PCB_IO::formatGeneral().

◆ GetPad() [1/5]

D_PAD * BOARD::GetPad ( unsigned  aIndex) const

Function GetPad.

Returns
D_PAD* - at the aIndex

Definition at line 2515 of file class_board.cpp.

2516 {
2517  unsigned count = 0;
2518 
2519  for( MODULE* mod = m_Modules; mod ; mod = mod->Next() ) // FIXME: const DLIST_ITERATOR
2520  {
2521  for( D_PAD* pad = mod->PadsList(); pad; pad = pad->Next() )
2522  {
2523  if( count == aIndex )
2524  return pad;
2525 
2526  count++;
2527  }
2528  }
2529 
2530  return nullptr;
2531 }
DLIST< MODULE > m_Modules
Definition: class_board.h:248
#define mod(a, n)
Definition: greymap.cpp:24

References m_Modules, and mod.

Referenced by AddNewTrace(), Autoroute_One_Track(), chainMarkedSegments(), CreateLockPoint(), DeleteNullTrackSegments(), PCB_EDIT_FRAME::EraseRedundantTrack(), GetPad(), Magnetize(), and MarkTrace().

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

1624 {
1625  if( !aLayerSet.any() )
1626  aLayerSet = LSET::AllCuMask();
1627 
1628  for( MODULE* module = m_Modules; module; module = module->Next() )
1629  {
1630  D_PAD* pad = NULL;
1631 
1632  if( module->HitTest( aPosition ) )
1633  pad = module->GetPad( aPosition, aLayerSet );
1634 
1635  if( pad )
1636  return pad;
1637  }
1638 
1639  return NULL;
1640 }
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
DLIST< MODULE > m_Modules
Definition: class_board.h:248

References LSET::AllCuMask(), and m_Modules.

◆ GetPad() [3/5]

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

Definition at line 1128 of file class_board.h.

1129  {
1130  return GetPad( aPosition, LSET().set() );
1131  }
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 1643 of file class_board.cpp.

1644 {
1645  const wxPoint& aPosition = aTrace->GetEndPoint( aEndPoint );
1646 
1647  LSET lset( aTrace->GetLayer() );
1648 
1649  return GetPad( aPosition, lset );
1650 }
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:137
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 1689 of file class_board.cpp.

1690 {
1691  // Search aPadList for aPosition
1692  // aPadList is sorted by X then Y values, and a fast binary search is used
1693  int idxmax = aPadList.size()-1;
1694 
1695  int delta = aPadList.size();
1696 
1697  int idx = 0; // Starting index is the beginning of list
1698 
1699  while( delta )
1700  {
1701  // Calculate half size of remaining interval to test.
1702  // Ensure the computed value is not truncated (too small)
1703  if( (delta & 1) && ( delta > 1 ) )
1704  delta++;
1705 
1706  delta /= 2;
1707 
1708  D_PAD* pad = aPadList[idx];
1709 
1710  if( pad->GetPosition() == aPosition ) // candidate found
1711  {
1712  // The pad must match the layer mask:
1713  if( ( aLayerSet & pad->GetLayerSet() ).any() )
1714  return pad;
1715 
1716  // More than one pad can be at aPosition
1717  // search for a pad at aPosition that matched this mask
1718 
1719  // search next
1720  for( int ii = idx+1; ii <= idxmax; ii++ )
1721  {
1722  pad = aPadList[ii];
1723 
1724  if( pad->GetPosition() != aPosition )
1725  break;
1726 
1727  if( ( aLayerSet & pad->GetLayerSet() ).any() )
1728  return pad;
1729  }
1730  // search previous
1731  for( int ii = idx-1 ;ii >=0; ii-- )
1732  {
1733  pad = aPadList[ii];
1734 
1735  if( pad->GetPosition() != aPosition )
1736  break;
1737 
1738  if( ( aLayerSet & pad->GetLayerSet() ).any() )
1739  return pad;
1740  }
1741 
1742  // Not found:
1743  return 0;
1744  }
1745 
1746  if( pad->GetPosition().x == aPosition.x ) // Must search considering Y coordinate
1747  {
1748  if( pad->GetPosition().y < aPosition.y ) // Must search after this item
1749  {
1750  idx += delta;
1751 
1752  if( idx > idxmax )
1753  idx = idxmax;
1754  }
1755  else // Must search before this item
1756  {
1757  idx -= delta;
1758 
1759  if( idx < 0 )
1760  idx = 0;
1761  }
1762  }
1763  else if( pad->GetPosition().x < aPosition.x ) // Must search after this item
1764  {
1765  idx += delta;
1766 
1767  if( idx > idxmax )
1768  idx = idxmax;
1769  }
1770  else // Must search before this item
1771  {
1772  idx -= delta;
1773 
1774  if( idx < 0 )
1775  idx = 0;
1776  }
1777  }
1778 
1779  return NULL;
1780 }
static const int delta[8][2]
Definition: solve.cpp:112
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:414
const wxPoint GetPosition() const override
Definition: class_pad.h:222

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

◆ GetPadCount()

unsigned BOARD::GetPadCount ( )

Function GetPadCount.

Returns
the number of pads in board

Definition at line 2500 of file class_board.cpp.

2501 {
2502  unsigned retval = 0;
2503 
2504  for( auto mod : Modules() )
2505  retval += mod->Pads().Size();
2506 
2507  return retval;
2508 }
DLIST_ITERATOR_WRAPPER< MODULE > Modules()
Definition: class_board.h:252
#define mod(a, n)
Definition: greymap.cpp:24

References mod, and Modules().

Referenced by Autoroute_One_Track(), CreatePadsShapesSection(), DRC::doTrackDrc(), 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 1670 of file class_board.cpp.

1671 {
1672  for( auto mod : Modules() )
1673  {
1674  for ( auto pad : mod->Pads() )
1675  {
1676  if( pad->GetPosition() != aPosition )
1677  continue;
1678 
1679  // Pad found, it must be on the correct layer
1680  if( ( pad->GetLayerSet() & aLayerSet ).any() )
1681  return pad;
1682  }
1683  }
1684 
1685  return nullptr;
1686 }
DLIST_ITERATOR_WRAPPER< MODULE > Modules()
Definition: class_board.h:252
#define mod(a, n)
Definition: greymap.cpp:24

References mod, and Modules().

Referenced by checkConnectedTo(), and PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment().

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

2487 {
2488  std::vector<D_PAD*> allPads;
2489 
2490  for( MODULE* mod : Modules() )
2491  {
2492  for( D_PAD* pad : mod->Pads() )
2493  allPads.push_back( pad );
2494  }
2495 
2496  return allPads;
2497 }
DLIST_ITERATOR_WRAPPER< MODULE > Modules()
Definition: class_board.h:252
#define mod(a, n)
Definition: greymap.cpp:24

References mod, and Modules().

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

◆ GetPageSettings()

◆ GetParent()

BOARD_ITEM_CONTAINER* BOARD_ITEM::GetParent ( void  ) const
inlineinherited

Definition at line 117 of file class_board_item.h.

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

References EDA_ITEM::m_Parent.

Referenced by Abort_Move_ModuleOutline(), AbortMoveTextModule(), POINT_EDITOR::addCorner(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), PCB_EDIT_FRAME::createPopUpMenuForFpTexts(), FOOTPRINT_EDIT_FRAME::Delete_Edge_Module(), BOARD_ITEM::DeleteStructure(), PCB_BASE_FRAME::DeleteTextModule(), 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(), TEXTE_MODULE::DrawUmbilical(), PCB_EDIT_FRAME::duplicateItems(), EditToolSelectionFilter(), PCB_IO::format(), FormatProbeItem(), BOARD_ITEM::GetBoard(), LEGACY_ARRAY_CREATOR::getModule(), 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(), PCB_EDIT_FRAME::moveExact(), FOOTPRINT_EDIT_FRAME::OnRightClick(), FOOTPRINT_EDIT_FRAME::Place_EdgeMod(), PCB_BASE_FRAME::PlaceTexteModule(), BRDITEMS_PLOTTER::Plot_1_EdgeModule(), BRDITEMS_PLOTTER::PlotTextModule(), PCB_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), PCB_BASE_FRAME::ResetTextSize(), PCB_BASE_FRAME::RotateTextModule(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), SELECTION_TOOL::select(), ShowCurrentOutlineWhileMoving(), ShowNewEdgeModule(), PCB_BASE_FRAME::StartMoveTexteModule(), SwapItemData(), DRC::testCopperDrawItem(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ GetPlotOptions()

const PCB_PLOT_PARAMS& BOARD::GetPlotOptions ( ) const
inline

Definition at line 552 of file class_board.h.

552 { return m_plotOptions; }
PCB_PLOT_PARAMS m_plotOptions
Definition: class_board.h:199

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

◆ GetPosition()

const wxPoint BOARD::GetPosition ( ) const
overridevirtual

Implements BOARD_ITEM.

Definition at line 172 of file class_board.cpp.

173 {
174  return ZeroOffset;
175 }
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 1010 of file class_board.cpp.

1011 {
1012  return wxString::Format( _( "PCB" ) );
1013 }
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().

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

1797 {
1798  for ( auto mod : Modules() )
1799  {
1800  for ( auto pad : mod->Pads( ) )
1801  {
1802  if( aNetCode < 0 || pad->GetNetCode() == aNetCode )
1803  {
1804  aVector.push_back( pad );
1805  }
1806  }
1807  }
1808 
1809  std::sort( aVector.begin(), aVector.end(), sortPadsByXthenYCoord );
1810 }
DLIST_ITERATOR_WRAPPER< MODULE > Modules()
Definition: class_board.h:252
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 654 of file class_board.h.

655  {
656  // a BOARD's standard layer name is the PCB_LAYER_ID fixed name
657  return LSET::Name( aLayerId );
658  }
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()

◆ GetStatus()

STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 256 of file base_struct.h.

256 { return m_Status; }
STATUS_FLAGS m_Status
Definition: base_struct.h:167

References EDA_ITEM::m_Status.

Referenced by PCB_IO::format().

◆ GetTimeStamp()

◆ GetTitleBlock()

TITLE_BLOCK& BOARD::GetTitleBlock ( )
inline

Definition at line 555 of file class_board.h.

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

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

◆ GetTracksByPosition()

std::list< TRACK * > BOARD::GetTracksByPosition ( const wxPoint &  aPosition,
PCB_LAYER_ID  aLayer = PCB_LAYER_ID( -1 ) 
) const

Function GetTracksByPosition finds the list of tracks that starts or ends at aPosition on aLayer.

Parameters
aPositionThe wxPoint to check start agains against.
aLayerThe layer to search. Use -1 (<PCB_LAYER_ID>UNDEFINED_LAYER) for a don't care.
Returns
std::list<TRACK*> A list of TRACK* items that can be zero if no track is found.

Definition at line 1653 of file class_board.cpp.

1654 {
1655  std::list<TRACK*> tracks;
1656 
1657  for( TRACK* track = GetFirstTrack( m_Track ); track; track = GetFirstTrack( track->Next() ) )
1658  {
1659  if( ( ( track->GetStart() == aPosition ) || track->GetEnd() == aPosition ) &&
1660  ( track->GetState( BUSY | IS_DELETED ) == 0 ) &&
1661  ( ( aLayer == UNDEFINED_LAYER ) || ( track->IsOnLayer( aLayer ) ) ) )
1662 
1663  tracks.push_back( track );
1664  }
1665 
1666  return tracks;
1667 }
#define BUSY
Pcbnew: flag indicating that the structure has.
Definition: base_struct.h:134
#define IS_DELETED
Definition: base_struct.h:117
DLIST< TRACK > m_Track
Definition: class_board.h:249
TRACK * GetFirstTrack(TRACK *aTrk, const TRACK *aStopPoint=NULL)
Scan a track list for the first TRACK object. Returns NULL if not found (or NULL passed)
Definition: class_track.h:504

References BUSY, GetFirstTrack(), IS_DELETED, m_Track, and UNDEFINED_LAYER.

Referenced by SELECTION_TOOL::selectAllItemsOnSheet().

◆ GetUnconnectedNetCount()

unsigned BOARD::GetUnconnectedNetCount ( ) const

Function GetUnconnectedNetCount.

Returns
the number of unconnected nets in the current ratsnest.

Definition at line 1097 of file class_board.cpp.

1098 {
1099  return m_connectivity->GetUnconnectedCount();
1100 }
std::shared_ptr< CONNECTIVITY_DATA > m_connectivity
Definition: class_board.h:192

References m_connectivity.

◆ GetViaByPosition()

VIA * BOARD::GetViaByPosition ( const wxPoint &  aPosition,
PCB_LAYER_ID  aLayer = PCB_LAYER_ID( -1 ) 
) const

Function GetViaByPosition finds the first via at aPosition on aLayer.

This function does not use the normal hit test to locate a via which which tests if a position is within the via's bounding box. It tests for the actual locate of the via.

Parameters
aPositionThe wxPoint to HitTest() against.
aLayerThe layer to search. Use -1 (PCB_LAYER_ID::UNDEFINED_LAYER) for a don't care.
Returns
VIA* A point a to the VIA object if found, else NULL.

Definition at line 1609 of file class_board.cpp.

1610 {
1611  for( VIA *via = GetFirstVia( m_Track); via; via = GetFirstVia( via->Next() ) )
1612  {
1613  if( (via->GetStart() == aPosition) &&
1614  (via->GetState( BUSY | IS_DELETED ) == 0) &&
1615  ((aLayer == UNDEFINED_LAYER) || (via->IsOnLayer( aLayer ))) )
1616  return via;
1617  }
1618 
1619  return NULL;
1620 }
#define BUSY
Pcbnew: flag indicating that the structure has.
Definition: base_struct.h:134
#define IS_DELETED
Definition: base_struct.h:117
DLIST< TRACK > m_Track
Definition: class_board.h:249
VIA * GetFirstVia(TRACK *aTrk, const TRACK *aStopPoint=NULL)
Scan a track list for the first VIA o NULL if not found (or NULL passed)
Definition: class_track.h:490

References BUSY, GetFirstVia(), IS_DELETED, m_Track, and UNDEFINED_LAYER.

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

793 {
795 }
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 750 of file class_board.cpp.

751 {
753 }
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 ZONE_CONTAINER::Draw(), VIA::Draw(), D_PAD::Draw(), PCB_IO::formatBoardLayers(), PCB_BASE_FRAME::GetCollectorsGuide(), PCB_LAYER_WIDGET::OnLayerVisible(), SELECTION_TOOL::selectable(), VIA::ViewGetLOD(), and D_PAD::ViewGetLOD().

◆ GetVisibleTrack()

TRACK * BOARD::GetVisibleTrack ( TRACK aStartingTrace,
const wxPoint &  aPosition,
LSET  aLayerSet 
) const

Function GetVisibleTrack finds the neighboring visible segment of aTrace at aPosition that is on a layer in aLayerSet.

Traces that are flagged as deleted or busy are ignored.

Parameters
aStartingTraceis the first TRACK to test, testing continues to end of m_Track list from this starting point.
aPositionA wxPoint object containing the position to test.
aLayerSetA set of layers; returned TRACK must be on one of these. May pass a full set to request any layer.
Returns
A TRACK object pointer if found otherwise NULL.

Definition at line 1820 of file class_board.cpp.

1822 {
1823  for( TRACK* track = aStartingTrace; track; track = track->Next() )
1824  {
1825  PCB_LAYER_ID layer = track->GetLayer();
1826 
1827  if( track->GetState( BUSY | IS_DELETED ) )
1828  continue;
1829 
1830  // track's layer is not visible
1831  if( m_designSettings.IsLayerVisible( layer ) == false )
1832  continue;
1833 
1834  if( track->Type() == PCB_VIA_T ) // VIA encountered.
1835  {
1836  if( track->HitTest( aPosition ) )
1837  return track;
1838  }
1839  else
1840  {
1841  if( !aLayerSet[layer] )
1842  continue; // track's layer is not in aLayerSet
1843 
1844  if( track->HitTest( aPosition ) )
1845  return track;
1846  }
1847  }
1848 
1849  return NULL;
1850 }
bool IsLayerVisible(PCB_LAYER_ID aLayerId) const
Function IsLayerVisible tests whether a given layer is visible.
#define BUSY
Pcbnew: flag indicating that the structure has.
Definition: base_struct.h:134
PCB_LAYER_ID
A quick note on layer IDs:
#define IS_DELETED
Definition: base_struct.h:117
TRACK * Next() const
Definition: class_track.h:110
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
BOARD_DESIGN_SETTINGS m_designSettings
Definition: class_board.h:194

References BUSY, BOARD_ITEM::GetLayer(), IS_DELETED, BOARD_DESIGN_SETTINGS::IsLayerVisible(), m_designSettings, TRACK::Next(), and PCB_VIA_T.

Referenced by GetLockPoint(), and Magnetize().

◆ GetZoneSettings()

const ZONE_SETTINGS& BOARD::GetZoneSettings ( ) const
inline

◆ HighLightOFF()

void BOARD::HighLightOFF ( )
inline

Function HighLightOFF Disable highlight.

Definition at line 389 of file class_board.h.

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

References HIGH_LIGHT_INFO::m_highLightOn.

Referenced by Abort_MoveTrack(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), and PCB_EDIT_FRAME::HighLight().

◆ HighLightON()

void BOARD::HighLightON ( )
inline

Function HighLightON Enable highlight.

if m_highLight_NetCode >= 0, this net will be highlighted

Definition at line 396 of file class_board.h.

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

References HIGH_LIGHT_INFO::m_highLightOn.

Referenced by PCB_EDIT_FRAME::Begin_Route(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), PCB_EDIT_FRAME::HighLight(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), and PCB_EDIT_FRAME::StartMoveOneNodeOrSegment().

◆ HitTest() [1/2]

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

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

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

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

Definition at line 333 of file base_struct.h.

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

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

◆ HitTest() [2/2]

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

Function HitTest tests if aRect intersects or is contained within the bounding box of an item.

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

Reimplemented in D_PAD, SCH_COMPONENT, SCH_SHEET, MODULE, VIA, ZONE_CONTAINER, GERBER_DRAW_ITEM, TRACK, DIMENSION, LIB_ITEM, DRAWSEGMENT, TEXTE_MODULE, SCH_FIELD, SCH_LINE, SCH_TEXT, SCH_BITMAP, SCH_BUS_ENTRY_BASE, SCH_NO_CONNECT, SCH_JUNCTION, PCB_TARGET, TEXTE_PCB, LIB_TEXT, LIB_ARC, LIB_BEZIER, LIB_POLYLINE, and LIB_CIRCLE.

Definition at line 347 of file base_struct.h.

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

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

1546 {
1547  if( aEndLayer < 0 )
1548  aEndLayer = aStartLayer;
1549 
1550  if( aEndLayer < aStartLayer )
1551  std::swap( aEndLayer, aStartLayer );
1552 
1553  for( ZONE_CONTAINER* area : m_ZoneDescriptorList )
1554  {
1555  if( area->GetLayer() < aStartLayer || area->GetLayer() > aEndLayer )
1556  continue;
1557 
1558  // In locate functions we must skip tagged items with BUSY flag set.
1559  if( area->GetState( BUSY ) )
1560  continue;
1561 
1562  if( aNetCode >= 0 && area->GetNetCode() != aNetCode )
1563  continue;
1564 
1565  if( area->HitTestFilledArea( aRefPos ) )
1566  return area;
1567  }
1568 
1569  return NULL;
1570 }
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:59
#define BUSY
Pcbnew: flag indicating that the structure has.
Definition: base_struct.h:134
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:182

References BUSY, and m_ZoneDescriptorList.

Referenced by PCB_EDIT_FRAME::Begin_Route().

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

2362 {
2363  ZONE_CONTAINER* new_area = new ZONE_CONTAINER( this );
2364 
2365  new_area->SetNetCode( aNetcode );
2366  new_area->SetLayer( aLayer );
2367  new_area->SetTimeStamp( GetNewTimeStamp() );
2368 
2369  if( aAreaIdx < (int) ( m_ZoneDescriptorList.size() - 1 ) )
2370  m_ZoneDescriptorList.insert( m_ZoneDescriptorList.begin() + aAreaIdx + 1, new_area );
2371  else
2372  m_ZoneDescriptorList.push_back( new_area );
2373 
2374  new_area->SetHatchStyle( (ZONE_CONTAINER::HATCH_STYLE) aHatch );
2375 
2376  // Add the first corner to the new zone
2377  new_area->AppendCorner( wxPoint( aCornerX, aCornerY ), -1 );
2378 
2379  return new_area;
2380 }
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:59
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:212
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Function SetNetCode sets net using a net code.
HATCH_STYLE
Zone hatch styles.
Definition: class_zone.h:66
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:182
void SetHatchStyle(HATCH_STYLE aStyle)
Definition: class_zone.h:552
bool AppendCorner(wxPoint aPosition, int aHoleIdx, bool aAllowDuplication=false)
Add a new corner to the zone outline (to the main outline or a hole)
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:209

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

Definition at line 230 of file base_struct.h.

230 { return m_Flags & BRIGHTENED; }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:137
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:181

References BRIGHTENED, and EDA_ITEM::m_Flags.

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), KIGFX::GERBVIEW_PAINTER::draw(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), and KIGFX::SCH_PAINTER::getRenderColor().

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

106  {
107  return false;
108  }

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

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

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

799 {
800  return m_designSettings.IsElementVisible( aLayer );
801 }
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 Abort_MoveOrCopyModule(), TEXTE_PCB::Draw(), TEXTE_MODULE::Draw(), TRACK::Draw(), MODULE::Draw(), VIA::Draw(), D_PAD::Draw(), Draw(), PCB_BASE_FRAME::GetCollectorsGuide(), FOOTPRINT_EDIT_FRAME::IsElementVisible(), PCB_EDIT_FRAME::IsElementVisible(), IsModuleLayerVisible(), DIALOG_EXCHANGE_FOOTPRINTS::OnApplyClicked(), PCB_EDIT_FRAME::OnPlaceOrRouteFootprints(), PCB_LAYER_WIDGET::OnRenderEnable(), PCB_EDIT_FRAME::ReCreateMenuBar(), PCB_LAYER_WIDGET::ReFillRender(), SELECTION_TOOL::selectable(), SetElementVisibility(), PCB_EDITOR_CONTROL::ShowLocalRatsnest(), showLocalRatsnest(), and PCB_DRAW_PANEL_GAL::SyncLayersVisibility().

◆ IsEmpty()

bool BOARD::IsEmpty ( ) const
inline

Definition at line 269 of file class_board.h.

270  {
271  return m_Drawings.GetCount() == 0 && m_Modules.GetCount() == 0 && m_Track.GetCount() == 0;
272  }
unsigned GetCount() const
Function GetCount returns the number of elements in the list.
Definition: dlist.h:126
DLIST< BOARD_ITEM > m_Drawings
Definition: class_board.h:244
DLIST< MODULE > m_Modules
Definition: class_board.h:248
DLIST< TRACK > m_Track
Definition: class_board.h:249

References DHEAD::GetCount().

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

◆ IsHighlighted()

bool EDA_ITEM::IsHighlighted ( ) const
inlineinherited

Definition at line 229 of file base_struct.h.

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

References HIGHLIGHTED, and EDA_ITEM::m_Flags.

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

◆ IsHighLightNetON()

bool BOARD::IsHighLightNetON ( ) const
inline

Function IsHighLightNetON.

Returns
true if a net is currently highlighted

Definition at line 383 of file class_board.h.

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

References HIGH_LIGHT_INFO::m_highLightOn.

Referenced by Abort_Create_Track(), Draw(), DrawHighLight(), PCB_EDIT_FRAME::End_Route(), DIALOG_SELECT_NET_FROM_LIST::HighlightNet(), PCB_EDIT_FRAME::Start_Move_Zone_Corner(), and PCB_EDIT_FRAME::Start_Move_Zone_Outlines().

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

442  {
443  return m_designSettings.IsLayerEnabled( aLayer );
444  }
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 453 of file class_board.h.

454  {
455  return m_designSettings.IsLayerVisible( aLayer );
456  }
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 PCB_EDIT_FRAME::Block_SelectItems(), TEXTE_PCB::Draw(), PCB_TARGET::Draw(), ZONE_CONTAINER::Draw(), EDGE_MODULE::Draw(), TEXTE_MODULE::Draw(), TRACK::Draw(), DIMENSION::Draw(), DRAWSEGMENT::Draw(), D_PAD::Draw(), ZONE_CONTAINER::DrawFilledArea(), DRAWING_TOOL::DrawVia(), itemIsIncludedByFilter(), Magnetize(), 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 193 of file class_board_item.h.

194  {
195  // only MODULEs & TRACKs can be locked at this time.
196  return false;
197  }

Referenced by DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), EditToolSelectionFilter(), GENERAL_COLLECTOR::Inspect(), and PCB_EDIT_FRAME::OnHotkeyDeleteItem().

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 223 of file base_struct.h.

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

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

851 {
852  switch( aLayer )
853  {
854  case F_Cu:
855  return IsElementVisible( LAYER_MOD_FR );
856 
857  case B_Cu:
858  return IsElementVisible( LAYER_MOD_BK );
859 
860  default:
861  wxFAIL_MSG( wxT( "BOARD::IsModuleLayerVisible() param error: bad layer" ) );
862  return true;
863  }
864 }
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 PCB_EDIT_FRAME::Block_SelectItems(), and GetFootprint().

◆ IsMoving()

◆ IsNew()

bool EDA_ITEM::IsNew ( ) const
inlineinherited

Definition at line 222 of file base_struct.h.

222 { return m_Flags & IS_NEW; }
#define IS_NEW
New item, just created.
Definition: base_struct.h:114
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:181

References IS_NEW, and EDA_ITEM::m_Flags.

Referenced by Abort_Edit_Pcb_Text(), Abort_EditEdge(), Abort_Move_ModuleOutline(), Abort_MoveOrCopyModule(), Abort_Zone_Create_Outline(), AbortBuildDimension(), AbortMoveAndEditTarget(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_EDIT_TOOL::AutoplaceFields(), LIB_CIRCLE::CalcEdit(), LIB_RECTANGLE::CalcEdit(), LIB_FIELD::CalcEdit(), LIB_POLYLINE::CalcEdit(), LIB_ARC::CalcEdit(), LIB_TEXT::CalcEdit(), LIB_POLYLINE::ContinueEdit(), LIB_ARC::ContinueEdit(), SCH_EDIT_TOOL::ConvertDeMorgan(), SCH_EDIT_FRAME::ConvertTextType(), PCB_EDIT_FRAME::Delete_Segment(), PCB_EDIT_FRAME::Delete_Segment_Edge(), LIB_ARC::drawGraphic(), LIB_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::Duplicate(), LIB_PIN::EnableEditMode(), LIB_DRAWING_TOOLS::Init(), isNewSegment(), SCH_MOVE_TOOL::Main(), LIB_MOVE_TOOL::Main(), EDIT_TOOL::MoveExact(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), FOOTPRINT_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::Place_Texte_Pcb(), PCB_BASE_FRAME::PlaceModule(), LIB_PIN_TOOL::PlacePin(), PCB_EDIT_FRAME::PlaceTarget(), ShowClearance(), PCB_EDIT_FRAME::StartMoveTextePcb(), PCB_EDIT_FRAME::SwitchLayer(), DIALOG_SCH_EDIT_SHEET_PIN::TransferDataFromWindow(), and DIALOG_LABEL_EDITOR::TransferDataFromWindow().

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

174  {
175  return m_Layer == aLayer;
176  }
PCB_LAYER_ID m_Layer

References BOARD_ITEM::m_Layer.

Referenced by CINFO3D_VISU::createLayers(), TEXTE_PCB::Draw(), EDGE_MODULE::Draw(), TEXTE_MODULE::Draw(), TRACK::Draw(), DRAWSEGMENT::Draw(), TRACK::DrawShortNetname(), GENERAL_COLLECTOR::Inspect(), ZONE_CONTAINER::IsOnLayer(), AR_MATRIX::TraceSegmentPcb(), and 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 502 of file base_struct.h.

502 { return false; }

Referenced by EDA_ITEM::Matches(), and EDA_ITEM::Replace().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 228 of file base_struct.h.

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

References IS_RESIZED, and EDA_ITEM::m_Flags.

Referenced by LIB_POLYLINE::CalcEdit(), and KIGFX::SCH_PAINTER::setColors().

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

185  {
186  return ( Type() == PCB_TRACE_T ) || ( Type() == PCB_VIA_T );
187  }
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204

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

Referenced by PCB_EDIT_FRAME::OnHotKey(), and PCB_EDIT_FRAME::OnHotkeyDeleteItem().

◆ 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_FIELD, and SCH_LINE.

Definition at line 287 of file base_struct.h.

288  {
289  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
290  return true;
291 
292  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
293  {
294  if( m_StructType == *p )
295  return true;
296  }
297 
298  return false;
299  }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it.
Definition: base_struct.h:166
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_WIRE_BUS_TOOL::IsDrawingBus(), SCH_WIRE_BUS_TOOL::IsDrawingLine(), SCH_WIRE_BUS_TOOL::IsDrawingWire(), SCH_LINE::IsType(), SCH_FIELD::IsType(), EE_POINT_EDITOR::Main(), EE_SELECTION_TOOL::RequestSelection(), and EDA_ITEM::Visit().

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 226 of file base_struct.h.

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

References IS_WIRE_IMAGE, and EDA_ITEM::m_Flags.

◆ IterateForward()

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

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

134 {
135  EDA_ITEM* p = listStart;
136 
137  for( ; p; p = p->Pnext )
138  {
139  if( SEARCH_QUIT == p->Visit( inspector, testData, scanTypes ) )
140  return SEARCH_QUIT;
141  }
142 
143  return SEARCH_CONTINUE;
144 }
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...
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:157
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:170

References EDA_ITEM::Pnext, SEARCH_CONTINUE, SEARCH_QUIT, and EDA_ITEM::Visit().

Referenced by EE_COLLECTOR::Collect(), SCH_FIND_COLLECTOR::Collect(), EE_TYPE_COLLECTOR::Collect(), SCH_FIND_COLLECTOR::GetItem(), EE_SELECTION_TOOL::RebuildSelection(), GERBER_FILE_IMAGE::Visit(), MODULE::Visit(), and Visit().

◆ MarkTrace()

TRACK * BOARD::MarkTrace ( TRACK aTrackList,
TRACK aTrace,
int *  aCount,
double *  aTraceLength,
double *  aInPackageLength,
bool  aReorder 
)

Function MarkTrace marks a chain of trace segments, connected to aTrace.

Each segment is marked by setting the BUSY bit into m_Flags. Electrical continuity is detected by walking each segment, and finally the segments are rearranged into a contiguous chain within the given list.

Parameters
aTrackListThe list of available track segments. usually tracks on board, but can be a list of segments currently created.
aTraceThe segment within a list of trace segments to test.
aCountA pointer to an integer where to return the number of marked segments (can be NULL).
aTraceLengthA pointer to an double where to return the length of the trace (can be NULL).
aInPackageLengthA pointer to an double where to return the extra lengths inside integrated circuits from the pads connected to this track to the die (if any) (can be NULL).
aReordertrue for reorder the interesting segments (useful for track editing/deleting) in this case the flag BUSY is set (the user is responsible of flag clearing). False for no reorder : useful when we want just calculate the track length in this case, flags are reset
Returns
TRACK* - The first in the chain of interesting segments.

Definition at line 1853 of file class_board.cpp.

1856 {
1857  TRACKS trackList;
1858 
1859  if( aCount )
1860  *aCount = 0;
1861 
1862  if( aTraceLength )
1863  *aTraceLength = 0;
1864 
1865  if( aTrace == NULL )
1866  return NULL;
1867 
1868  // Ensure the flag BUSY of all tracks of the board is cleared
1869  // because we use it to mark segments of the track
1870  for( TRACK* track = aTrackList; track; track = track->Next() )
1871  track->SetState( BUSY, false );
1872 
1873  // Set flags of the initial track segment
1874  aTrace->SetState( BUSY, true );
1875  LSET layer_set = aTrace->GetLayerSet();
1876 
1877  trackList.push_back( aTrace );
1878 
1879  /* Examine the initial track segment : if it is really a segment, this is
1880  * easy.
1881  * If it is a via, one must search for connected segments.
1882  * If <=2, this via connect 2 segments (or is connected to only one
1883  * segment) and this via and these 2 segments are a part of a track.
1884  * If > 2 only this via is flagged (the track has only this via)
1885  */
1886  if( aTrace->Type() == PCB_VIA_T )
1887  {
1888  TRACK* segm1 = ::GetTrack( aTrackList, NULL, aTrace->GetStart(), layer_set );
1889  TRACK* segm2 = NULL;
1890  TRACK* segm3 = NULL;
1891 
1892  if( segm1 )
1893  {
1894  segm2 = ::GetTrack( segm1->Next(), NULL, aTrace->GetStart(), layer_set );
1895  }
1896 
1897  if( segm2 )
1898  {
1899  segm3 = ::GetTrack( segm2->Next(), NULL, aTrace->GetStart(), layer_set );
1900  }
1901 
1902  if( segm3 )
1903  {
1904  // More than 2 segments are connected to this via.
1905  // The "track" is only this via.
1906 
1907  if( aCount )
1908  *aCount = 1;
1909 
1910  return aTrace;
1911  }
1912 
1913  if( segm1 ) // search for other segments connected to the initial segment start point
1914  {
1915  layer_set = segm1->GetLayerSet();
1916  chainMarkedSegments( aTrackList, aTrace->GetStart(), layer_set, &trackList );
1917  }
1918 
1919  if( segm2 ) // search for other segments connected to the initial segment end point
1920  {
1921  layer_set = segm2->GetLayerSet();
1922  chainMarkedSegments( aTrackList, aTrace->GetStart(), layer_set, &trackList );
1923  }
1924  }
1925  else // mark the chain using both ends of the initial segment
1926  {
1927  TRACKS from_start;
1928  TRACKS from_end;
1929 
1930  chainMarkedSegments( aTrackList, aTrace->GetStart(), layer_set, &from_start );
1931  chainMarkedSegments( aTrackList, aTrace->GetEnd(), layer_set, &from_end );
1932 
1933  // combine into one trackList:
1934  trackList.insert( trackList.end(), from_start.begin(), from_start.end() );
1935  trackList.insert( trackList.end(), from_end.begin(), from_end.end() );
1936  }
1937 
1938  // Now examine selected vias and flag them if they are on the track
1939  // If a via is connected to only one or 2 segments, it is flagged (is on the track)
1940  // If a via is connected to more than 2 segments, it is a track end, and it
1941  // is removed from the list.
1942  // Go through the list backwards.
1943  for( int i = trackList.size() - 1; i>=0; --i )
1944  {
1945  ::VIA* via = dynamic_cast< ::VIA* >( trackList[i] );
1946 
1947  if( !via )
1948  continue;
1949 
1950  if( via == aTrace )
1951  continue;
1952 
1953  via->SetState( BUSY, true ); // Try to flag it. the flag will be cleared later if needed
1954 
1955  layer_set = via->GetLayerSet();
1956 
1957  TRACK* track = ::GetTrack( aTrackList, NULL, via->GetStart(), layer_set );
1958 
1959  // GetTrace does not consider tracks flagged BUSY.</