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
 
 BOARD ()
 
 ~BOARD ()
 
virtual const wxPointGetPosition () const override
 
virtual 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
 > More...
 
void Remove (BOARD_ITEM *aBoardItem) override
 > More...
 
BOARD_ITEMDuplicate (const BOARD_ITEM *aItem, bool aAddToBoard=false)
 
RN_DATAGetRatsnest () const
 Function GetRatsnest() returns list of missing connections between components/tracks. 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 wxPointGetAuxOrigin () const
 
void SetGridOrigin (const wxPoint &aPoint)
 Function SetGridOrigin sets the origin point of the grid. More...
 
const wxPointGetGridOrigin () 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 (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 (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 (int aPCB_VISIBLE) const
 Function IsElementVisible tests whether a given element category is visible. More...
 
void SetElementVisibility (int aPCB_VISIBLE, bool aNewState)
 Function SetElementVisibility changes the visibility of an element category. More...
 
bool IsModuleLayerVisible (LAYER_ID layer)
 Function IsModuleLayerVisible expects either of the two layers on which a module can reside, and returns whether that layer is visible. More...
 
COLOR4D GetVisibleElementColor (int aPCB_VISIBLE)
 Function GetVisibleElementColor returns the color of a pcb visible element. More...
 
void SetVisibleElementColor (int aPCB_VISIBLE, COLOR4D aColor)
 
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)
 
COLORS_DESIGN_SETTINGSGetColorsSettings () const
 Function GetColorSettings. More...
 
void SetColorsSettings (COLORS_DESIGN_SETTINGS *aColorsSettings)
 Function SetColorsSettings. More...
 
bool GetBoardPolygonOutlines (SHAPE_POLY_SET &aOutlines, wxString *aErrorText=NULL)
 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 (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 LAYER_ID GetLayerID (const wxString &aLayerName) const
 Function GetLayerID returns the ID of a layer given by aLayerName. More...
 
const wxString GetLayerName (LAYER_ID aLayer) const
 Function GetLayerName returns the name of a layer given by aLayer. More...
 
bool SetLayerName (LAYER_ID aLayer, const wxString &aLayerName)
 Function SetLayerName changes the name of the layer given by aLayer. More...
 
bool SetLayerDescr (LAYER_ID aIndex, const LAYER &aLayer)
 Function SetLayerDescr returns the type of the copper layer given by aLayer. More...
 
LAYER_T GetLayerType (LAYER_ID aLayer) const
 Function GetLayerType returns the type of the copper layer given by aLayer. More...
 
bool SetLayerType (LAYER_ID aLayer, LAYER_T aLayerType)
 Function SetLayerType changes the type of the layer given by aLayer. More...
 
void SetLayerColor (LAYER_ID aLayer, COLOR4D aColor)
 Function SetLayerColor changes a layer color for any valid layer, including non-copper ones. More...
 
COLOR4D GetLayerColor (LAYER_ID aLayer) const
 Function GetLayerColor gets a layer color for any valid layer, including non-copper ones. More...
 
int GetNumSegmTrack () const
 Functions to get some items count. More...
 
int GetNumSegmZone () const
 Calculate the zone segment count. More...
 
unsigned GetRatsnestsCount () const
 Function GetNumRatsnests. More...
 
unsigned GetNodesCount () const
 Function GetNodesCount. More...
 
void SetNodeCount (unsigned aCount)
 Function SetNodeCount set the number of nodes of the current net to aCount. More...
 
unsigned GetUnconnectedNetCount () const
 Function GetUnconnectedNetCount. More...
 
void SetUnconnectedNetCount (unsigned aCount)
 Function SetUnconnectedNetCount sets the number of unconnected nets in the current rats nest to aCount. More...
 
unsigned GetPadCount () const
 Function GetPadCount. More...
 
D_PADGetPad (unsigned aIndex) const
 Function GetPad. More...
 
const D_PADS & 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 (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...
 
void ReplaceNetlist (NETLIST &aNetlist, bool aDeleteSinglePadNets, std::vector< MODULE * > *aNewFootprints, REPORTER *aReporter=NULL)
 Function ReplaceNetlist updates the BOARD according to aNetlist. 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, LAYER_ID aStartLayer, 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, 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, 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, LAYER_ID aLayer, wxPoint aStartPointPosition, int aHatch)
 Function AddArea Add an empty copper area to board areas list. More...
 
ZONE_CONTAINERInsertArea (int netcode, int iarea, LAYER_ID layer, int x, int y, int hatch)
 Function InsertArea add empty copper area to net, inserting after m_ZoneDescriptorList[iarea]. 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...
 
int Test_Drc_Areas_Outlines_To_Areas_Outlines (ZONE_CONTAINER *aArea_To_Examine, bool aCreate_Markers)
 Function Test_Drc_Areas_Outlines_To_Areas_Outlines tests area outlines for DRC: Tests areas inside other areas. More...
 
void Test_Connections_To_Copper_Areas (int aNetcode=-1)
 Function Test_Connection_To_Copper_Areas init .m_ZoneSubnet parameter in tracks and pads according to the connections to areas found. More...
 
VIAGetViaByPosition (const wxPoint &aPosition, LAYER_ID aLayer=LAYER_ID(-1)) const
 Function GetViaByPosition finds the first via 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 *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, 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...
 
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
 
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 (LAYER_ID aLayer)
 Function SetLayer sets the layer this item is on. More...
 
void SwapData (BOARD_ITEM *aImage)
 Swap data between aItem and aImage. More...
 
virtual bool IsOnLayer (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...
 
virtual void Rotate (const wxPoint &aRotCentre, double aAngle)
 Function Rotate Rotate this object. More...
 
virtual void Flip (const wxPoint &aCentre)
 Function Flip Flip this object, i.e. More...
 
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 bool HitTest (const wxPoint &aPosition) const override
 Function HitTest tests if aPosition is contained within or on the bounding area of an item. More...
 
virtual bool HitTest (const EDA_RECT &aRect, bool aContained=true, int aAccuracy=0) const
 Function HitTest tests if the aRect intersects or contains this object (depending on aContained). More...
 
virtual void ViewGetLayers (int aLayers[], int &aCount) const override
 
KICAD_T Type () const
 Function Type() More...
 
void SetTimeStamp (time_t aNewTimeStamp)
 
time_t GetTimeStamp () const
 
DHEADGetList () const
 
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
 
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 EDA_ITEMClone () const
 Function Clone creates a duplicate of this item with linked list members set to NULL. More...
 
virtual wxString GetSelectMenuText () const
 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...
 
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
 
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 of the item. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 

Static Public Member Functions

static bool ClassOf (const EDA_ITEM *aItem)
 
static wxString GetStandardLayerName (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 std::string FormatInternalUnits (int aValue)
 Function FormatInternalUnits converts aValue from board internal units to a string appropriate for writing to file. More...
 
static std::string FormatInternalUnits (const wxPoint &aPoint)
 
static std::string FormatInternalUnits (const wxSize &aSize)
 
static std::string FormatAngle (double aAngle)
 Function FormatAngle converts aAngle from board units to a string appropriate for writing to file. 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< BOARD_ITEMm_Drawings
 
DLIST< MODULEm_Modules
 
DLIST< TRACKm_Track
 
DLIST< SEGZONEm_Zone
 
std::vector< RATSNEST_ITEMm_FullRatsnest
 Ratsnest list for the BOARD. More...
 
std::vector< RATSNEST_ITEMm_LocalRatsnest
 Ratsnest list relative to a given footprint (used while moving a footprint). More...
 
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 getTrailingInt (wxString aStr)
 
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...
 
time_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 (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 [LAYER_ID_COUNT]
 
HIGH_LIGHT_INFO m_highLight
 
HIGH_LIGHT_INFO m_highLightPrevious
 
int m_fileFormatVersionAtLoad
 the version loaded from the file More...
 
NETINFO_LIST m_NetInfo
 net info list (name, design constraints .. More...
 
RN_DATAm_ratsnest
 
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
 
int m_nodeCount
 Number of pads connected to the current net. More...
 
int m_unconnectedNetCount
 Number of unconnected nets in the current rats nest. More...
 

Friends

class PCB_EDIT_FRAME
 

Detailed Description

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

Definition at line 166 of file class_board.h.

Constructor & Destructor Documentation

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:188
BOARD_ITEM_CONTAINER(BOARD_ITEM *aParent, KICAD_T aType)
BOARD::BOARD ( )

Definition at line 69 of file class_board.cpp.

References BuildListOfNets(), g_ColorsSettings, BOARD_DESIGN_SETTINGS::GetCurrentTrackWidth(), BOARD_DESIGN_SETTINGS::GetCurrentViaDrill(), BOARD_DESIGN_SETTINGS::GetCurrentViaSize(), BOARD_DESIGN_SETTINGS::GetDefault(), GetStandardLayerName(), IsCopperLayer(), LAYER_ID_COUNT, LT_SIGNAL, LT_UNDEFINED, m_CurrentZoneContour, m_designSettings, m_fileFormatVersionAtLoad, m_Layer, LAYER::m_name, m_nodeCount, m_ratsnest, m_Status_Pcb, LAYER::m_type, m_unconnectedNetCount, SetColorsSettings(), BOARD_DESIGN_SETTINGS::SetCurrentNetClass(), BOARD_DESIGN_SETTINGS::SetCustomTrackWidth(), BOARD_DESIGN_SETTINGS::SetCustomViaDrill(), BOARD_DESIGN_SETTINGS::SetCustomViaSize(), ToLAYER_ID(), and BOARD_DESIGN_SETTINGS::UseCustomTrackViaSize().

69  :
71  m_NetInfo( this ),
73 {
74  // we have not loaded a board yet, assume latest until then.
75  m_fileFormatVersionAtLoad = LEGACY_BOARD_FILE_VERSION;
76 
77  m_Status_Pcb = 0; // Status word: bit 1 = calculate.
79  m_nodeCount = 0; // Number of connected pads.
80  m_unconnectedNetCount = 0; // Number of unconnected nets.
81 
82  m_CurrentZoneContour = NULL; // This ZONE_CONTAINER handle the
83  // zone contour currently in progress
84 
85  BuildListOfNets(); // prepare pad and netlist containers.
86 
87  for( LAYER_NUM layer = 0; layer < LAYER_ID_COUNT; ++layer )
88  {
89  m_Layer[layer].m_name = GetStandardLayerName( ToLAYER_ID( layer ) );
90 
91  if( IsCopperLayer( layer ) )
92  m_Layer[layer].m_type = LT_SIGNAL;
93  else
94  m_Layer[layer].m_type = LT_UNDEFINED;
95  }
96 
97  // Initialize default netclass.
98  NETCLASSPTR defaultClass = m_designSettings.GetDefault();
99  defaultClass->SetDescription( _( "This is the default net class." ) );
100  m_designSettings.SetCurrentNetClass( defaultClass->GetName() );
101 
102  // Set sensible initial values for custom track width & via size
107 
108  // Initialize ratsnest
109  m_ratsnest = new RN_DATA( this );
110 }
void SetColorsSettings(COLORS_DESIGN_SETTINGS *aColorsSettings)
Function SetColorsSettings.
Definition: class_board.h:567
void BuildListOfNets()
Definition: class_board.h:764
int GetCurrentViaDrill() const
Function GetCurrentViaDrill.
Definition: typeinfo.h:97
NETCLASSPTR GetDefault() const
Function GetDefault.
wxString m_name
The name of the layer, there should be no spaces in this name.
Definition: class_board.h:108
Class RN_DATA.
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:194
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:110
ZONE_CONTAINER * m_CurrentZoneContour
zone contour currently in progress
Definition: class_board.h:254
int m_unconnectedNetCount
Number of unconnected nets in the current rats nest.
Definition: class_board.h:202
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:188
int GetCurrentViaSize() const
Function GetCurrentViaSize.
void SetCustomViaSize(int aSize)
Function SetCustomViaSize Sets custom size for via diameter (i.e.
static const wxChar A4[]
COLORS_DESIGN_SETTINGS g_ColorsSettings
Definition: pcbnew.cpp:68
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.
bool SetCurrentNetClass(const wxString &aNetClassName)
Function SetCurrentNetClass Must be called after a netclass selection (or after a netclass parameter ...
LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:766
int m_fileFormatVersionAtLoad
the version loaded from the file
Definition: class_board.h:186
static wxString GetStandardLayerName(LAYER_ID aLayerId)
Function GetStandardLayerName returns an "English Standard" name of a PCB layer when given aLayerNumb...
Definition: class_board.h:646
LAYER m_Layer[LAYER_ID_COUNT]
Definition: class_board.h:180
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
RN_DATA * m_ratsnest
Definition: class_board.h:189
BOARD_DESIGN_SETTINGS m_designSettings
Definition: class_board.h:191
int GetCurrentTrackWidth() const
Function GetCurrentTrackWidth.
int m_nodeCount
Number of pads connected to the current net.
Definition: class_board.h:199
BOARD_ITEM_CONTAINER(BOARD_ITEM *aParent, KICAD_T aType)
void UseCustomTrackViaSize(bool aEnabled)
Function UseCustomTrackViaSize Enables/disables custom track/via size settings.
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:240
BOARD::~BOARD ( )

Definition at line 113 of file class_board.cpp.

References BOARD_ITEM_CONTAINER::Delete(), DeleteMARKERs(), DeleteZONEOutlines(), m_CurrentZoneContour, m_FullRatsnest, m_LocalRatsnest, m_ratsnest, and m_ZoneDescriptorList.

114 {
115  while( m_ZoneDescriptorList.size() )
116  {
117  ZONE_CONTAINER* area_to_remove = m_ZoneDescriptorList[0];
118  Delete( area_to_remove );
119  }
120 
121  delete m_ratsnest;
122 
123  m_FullRatsnest.clear();
124  m_LocalRatsnest.clear();
125 
126  DeleteMARKERs();
128 
129  delete m_CurrentZoneContour;
130  m_CurrentZoneContour = NULL;
131 }
std::vector< RATSNEST_ITEM > m_LocalRatsnest
Ratsnest list relative to a given footprint (used while moving a footprint).
Definition: class_board.h:251
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:78
void DeleteZONEOutlines()
Function DeleteZONEOutlines deletes ALL zone outlines from the board.
ZONE_CONTAINER * m_CurrentZoneContour
zone contour currently in progress
Definition: class_board.h:254
std::vector< RATSNEST_ITEM > m_FullRatsnest
Ratsnest list for the BOARD.
Definition: class_board.h:248
void DeleteMARKERs()
Function DeleteMARKERs deletes ALL MARKERS from the board.
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:178
virtual void Delete(BOARD_ITEM *aItem)
Removes an item from the containter and deletes it.
RN_DATA * m_ratsnest
Definition: class_board.h:189

Member Function Documentation

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

References RN_DATA::Add(), ADD_APPEND, NETINFO_LIST::AppendNet(), TRACK::GetBestInsertPoint(), DLIST< T >::Insert(), m_Drawings, m_markers, m_Modules, m_NetInfo, m_ratsnest, m_Status_Pcb, m_Track, m_Zone, 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, PCB_ZONE_T, DLIST< T >::PushBack(), DLIST< T >::PushFront(), EDA_ITEM::SetParent(), and EDA_ITEM::Type().

Referenced by PCAD2KICAD::PCB_TEXT::AddToBoard(), PCAD2KICAD::PCB_ARC::AddToBoard(), PCAD2KICAD::PCB_PAD::AddToBoard(), PCAD2KICAD::PCB_LINE::AddToBoard(), PCAD2KICAD::PCB_POLYGON::AddToBoard(), PCAD2KICAD::PCB_MODULE::AddToBoard(), PCAD2KICAD::PCB::AddToBoard(), PCAD2KICAD::PCB_PAD::AddToModule(), PCB_EDIT_FRAME::Begin_DrawSegment(), PCB_EDIT_FRAME::Block_Duplicate(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), PCB_BASE_FRAME::CreateNewModule(), 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(), EVT_TOOL(), FOOTPRINT_EDIT_FRAME::Import_Module(), InvokeDXFDialogBoardImport(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), LEGACY_PLUGIN::loadAllSections(), LEGACY_PLUGIN::loadDIMENSION(), EAGLE_PLUGIN::loadElements(), PCB_BASE_FRAME::LoadModuleFromLibrary(), LEGACY_PLUGIN::loadNETINFO_ITEM(), LEGACY_PLUGIN::loadPCB_LINE(), LEGACY_PLUGIN::loadPCB_TARGET(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), EAGLE_PLUGIN::loadSignals(), LEGACY_PLUGIN::loadTrackList(), LEGACY_PLUGIN::loadZONE_CONTAINER(), PANEL_PREV_3D::PANEL_PREV_3D(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), FOOTPRINT_WIZARD_FRAME::ReloadFootprint(), ReplaceNetlist(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), and Test_Drc_Areas_Outlines_To_Areas_Outlines().

864 {
865  if( aBoardItem == NULL )
866  {
867  wxFAIL_MSG( wxT( "BOARD::Add() param error: aBoardItem NULL" ) );
868  return;
869  }
870 
871  switch( aBoardItem->Type() )
872  {
873  case PCB_NETINFO_T:
874  m_NetInfo.AppendNet( (NETINFO_ITEM*) aBoardItem );
875  break;
876 
877  // this one uses a vector
878  case PCB_MARKER_T:
879  m_markers.push_back( (MARKER_PCB*) aBoardItem );
880  break;
881 
882  // this one uses a vector
883  case PCB_ZONE_AREA_T:
884  m_ZoneDescriptorList.push_back( (ZONE_CONTAINER*) aBoardItem );
885  break;
886 
887  case PCB_TRACE_T:
888  case PCB_VIA_T:
889  if( aMode == ADD_APPEND )
890  {
891  m_Track.PushBack( (TRACK*) aBoardItem );
892  }
893  else
894  {
895  TRACK* insertAid;
896  insertAid = ( (TRACK*) aBoardItem )->GetBestInsertPoint( this );
897  m_Track.Insert( (TRACK*) aBoardItem, insertAid );
898  }
899 
900  break;
901 
902  case PCB_ZONE_T:
903  if( aMode == ADD_APPEND )
904  m_Zone.PushBack( (SEGZONE*) aBoardItem );
905  else
906  m_Zone.PushFront( (SEGZONE*) aBoardItem );
907 
908  break;
909 
910  case PCB_MODULE_T:
911  if( aMode == ADD_APPEND )
912  m_Modules.PushBack( (MODULE*) aBoardItem );
913  else
914  m_Modules.PushFront( (MODULE*) aBoardItem );
915 
916  // Because the list of pads has changed, reset the status
917  // This indicate the list of pad and nets must be recalculated before use
918  m_Status_Pcb = 0;
919  break;
920 
921  case PCB_DIMENSION_T:
922  case PCB_LINE_T:
923  case PCB_TEXT_T:
924  case PCB_TARGET_T:
925  if( aMode == ADD_APPEND )
926  m_Drawings.PushBack( aBoardItem );
927  else
928  m_Drawings.PushFront( aBoardItem );
929 
930  break;
931 
932  // other types may use linked list
933  default:
934  {
935  wxString msg;
936  msg.Printf( wxT( "BOARD::Add() needs work: BOARD_ITEM type (%d) not handled" ),
937  aBoardItem->Type() );
938  wxFAIL_MSG( msg );
939  return;
940  }
941  break;
942  }
943 
944  aBoardItem->SetParent( this );
945  m_ratsnest->Add( aBoardItem );
946 }
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:78
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:114
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:104
DLIST< SEGZONE > m_Zone
Definition: class_board.h:245
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:188
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:107
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:101
DLIST< BOARD_ITEM > m_Drawings
Definition: class_board.h:242
class SEGZONE, a segment used to fill a zone area (segment on a copper layer)
Definition: typeinfo.h:109
MARKERS m_markers
MARKER_PCBs for clearance problems, owned by pointer.
Definition: class_board.h:175
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:112
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:113
Class NETINFO_ITEM handles the data for a net.
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:111
DLIST< MODULE > m_Modules
Definition: class_board.h:243
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:178
class NETINFO_ITEM, a description of a net
Definition: typeinfo.h:116
bool Add(const BOARD_ITEM *aItem)
Function Add() Adds an item to the ratsnest data.
RN_DATA * m_ratsnest
Definition: class_board.h:189
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:108
DLIST< TRACK > m_Track
Definition: class_board.h:244
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:103
void Insert(T *aNewElement, T *aElementAfterMe)
Function Insert puts aNewElement just in front of aElementAfterMe in the list sequence.
Definition: dlist.h:200
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:240
ZONE_CONTAINER * BOARD::AddArea ( PICKED_ITEMS_LIST aNewZonesList,
int  aNetcode,
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 2315 of file class_board.cpp.

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

Referenced by NormalizeAreaPolygon().

2317 {
2318  ZONE_CONTAINER* new_area = InsertArea( aNetcode,
2319  m_ZoneDescriptorList.size( ) - 1,
2320  aLayer, aStartPointPosition.x,
2321  aStartPointPosition.y, aHatch );
2322 
2323  if( aNewZonesList )
2324  {
2325  ITEM_PICKER picker( new_area, UR_NEW );
2326  aNewZonesList->PushItem( picker );
2327  }
2328 
2329  return new_area;
2330 }
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:78
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:178
ZONE_CONTAINER * InsertArea(int netcode, int iarea, LAYER_ID layer, int x, int y, int hatch)
Function InsertArea add empty copper area to net, inserting after m_ZoneDescriptorList[iarea].
BOARD_ITEM* BOARD_ITEM::Back ( ) const
inlineinherited

Definition at line 125 of file class_board_item.h.

References EDA_ITEM::Pback.

Referenced by PCB_EDIT_FRAME::Delete_Segment_Edge().

125 { return static_cast<BOARD_ITEM*>( Pback ); }
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:165
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
NETINFO_LIST::iterator BOARD::BeginNets ( ) const
inline

Function BeginNets.

Returns
iterator to the first element of the NETINFO_ITEMs list

Definition at line 795 of file class_board.h.

References NETINFO_LIST::begin().

796  {
797  return m_NetInfo.begin();
798  }
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:188
iterator begin() const
void BOARD::chainMarkedSegments ( 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
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 386 of file class_board.cpp.

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

Referenced by MarkTrace().

387 {
388  LSET layer_set = aLayerSet;
389 
390  if( !m_Track ) // no tracks at all in board
391  return;
392 
393  /* Set the BUSY flag of all connected segments, first search starting at
394  * aPosition. The search ends when a pad is found (end of a track), a
395  * segment end has more than one other segment end connected, or when no
396  * connected item found.
397  *
398  * Vias are a special case because they must look for segments connected
399  * on other layers and they change the layer mask. They can be a track
400  * end or not. They will be analyzer later and vias on terminal points
401  * of the track will be considered as part of this track if they do not
402  * connect segments of another track together and will be considered as
403  * part of an other track when removing the via, the segments of that other
404  * track are disconnected.
405  */
406  for( ; ; )
407  {
408 
409 
410  if( GetPad( aPosition, layer_set ) != NULL )
411  return;
412 
413  /* Test for a via: a via changes the layer mask and can connect a lot
414  * of segments at location aPosition. When found, the via is just
415  * pushed in list. Vias will be examined later, when all connected
416  * segment are found and push in list. This is because when a via
417  * is found we do not know at this time the number of connected items
418  * and we do not know if this via is on the track or finish the track
419  */
420  TRACK* via = m_Track->GetVia( NULL, aPosition, layer_set );
421 
422  if( via )
423  {
424  layer_set = via->GetLayerSet();
425 
426  aList->push_back( via );
427  }
428 
429  int seg_count = 0;
430  TRACK* candidate = NULL;
431 
432  /* Search all segments connected to point aPosition.
433  * if only 1 segment at aPosition: then this segment is "candidate"
434  * if > 1 segment:
435  * then end of "track" (because more than 2 segments are connected at aPosition)
436  */
437  TRACK* segment = m_Track;
438 
439  while( ( segment = ::GetTrack( segment, NULL, aPosition, layer_set ) ) != NULL )
440  {
441  if( segment->GetState( BUSY ) ) // already found and selected: skip it
442  {
443  segment = segment->Next();
444  continue;
445  }
446 
447  if( segment == via ) // just previously found: skip it
448  {
449  segment = segment->Next();
450  continue;
451  }
452 
453  if( ++seg_count == 1 ) // if first connected item: then segment is candidate
454  {
455  candidate = segment;
456  segment = segment->Next();
457  }
458  else // More than 1 segment connected -> location is end of track
459  {
460  return;
461  }
462  }
463 
464  if( candidate ) // A candidate is found: flag it and push it in list
465  {
466  /* Initialize parameters to search items connected to this
467  * candidate:
468  * we must analyze connections to its other end
469  */
470  if( aPosition == candidate->GetStart() )
471  {
472  aPosition = candidate->GetEnd();
473  }
474  else
475  {
476  aPosition = candidate->GetStart();
477  }
478 
479  layer_set = candidate->GetLayerSet();
480 
481  // flag this item and push it in list of selected items
482  aList->push_back( candidate );
483  candidate->SetState( BUSY, true );
484  }
485  else
486  {
487  return;
488  }
489  }
490 }
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
VIA * GetVia(const wxPoint &aPosition, LAYER_ID aLayer=UNDEFINED_LAYER)
Function GetVia finds the first VIA object at aPosition on aLayer starting at the trace...
#define BUSY
Pcbnew: flag indicating that the structure has.
Definition: base_struct.h:134
int GetState(int type) const
Definition: base_struct.h:237
const wxPoint & GetEnd() const
Definition: class_track.h:117
Class LSET is a set of LAYER_IDs.
const wxPoint & GetStart() const
Definition: class_track.h:120
virtual LSET GetLayerSet() const
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
D_PAD * GetPad(unsigned aIndex) const
Function GetPad.
Definition: class_board.h:750
TRACK * Next() const
Definition: class_track.h:97
void SetState(int type, int state)
Definition: base_struct.h:242
DLIST< TRACK > m_Track
Definition: class_board.h:244
static bool BOARD::ClassOf ( const EDA_ITEM aItem)
inlinestatic

Definition at line 230 of file class_board.h.

References PCB_T, and EDA_ITEM::Type().

231  {
232  return aItem && PCB_T == aItem->Type();
233  }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
Definition: typeinfo.h:97
void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 233 of file base_struct.h.

References BRIGHTENED, and EDA_ITEM::ClearFlags().

Referenced by SELECTION_TOOL::disambiguationMenu().

233 { 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:254
void EDA_ITEM::ClearFlags ( STATUS_FLAGS  aMask = EDA_ITEM_ALL_FLAGS)
inlineinherited

Definition at line 254 of file base_struct.h.

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(), abortMoveBitmap(), AbortMoveDimensionText(), abortMoveItem(), AbortMoveTextModule(), AbortPinMove(), SCH_SCREEN::addConnectedItemsToBlock(), SCH_EDIT_FRAME::addCurrentItemToList(), PNS_KICAD_IFACE::AddItem(), PCB_EDIT_FRAME::AppendBoardFile(), SCH_EDIT_FRAME::AppendOneEEProject(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Zone(), SCH_EDIT_FRAME::BeginSegment(), PCB_EDIT_FRAME::Block_Delete(), PCB_EDIT_FRAME::Block_Flip(), PCB_EDIT_FRAME::Block_Move(), PCB_EDIT_FRAME::Change_Side_Module(), SCH_SCREEN::ClearAnnotation(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearHighlighted(), ClearMarkItems(), clearModuleItemFlags(), EDA_ITEM::ClearSelected(), SCH_EDIT_FRAME::ConvertPart(), SCH_EDIT_FRAME::copyBlockItems(), CopyMarkedItems(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), LIB_PART::CopySelectedItems(), MWAVE::CreateMicrowaveInductor(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), PCB_EDIT_FRAME::Delete_LastCreatedCorner(), PCB_EDIT_FRAME::Delete_Segment_Edge(), LIB_PART::DeleteSelectedItems(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), 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_Zone(), SCH_EDIT_FRAME::EndSegment(), PCB_EDIT_FRAME::Exchange_Module(), ExitSheet(), SCH_SCREEN::GetConnection(), PCB_BASE_FRAME::GlobalChange_PadSettings(), PCB_BASE_FRAME::Import_Pad_Settings(), SCH_JUNCTION::IsSelectStateChanged(), SCH_NO_CONNECT::IsSelectStateChanged(), SCH_MARKER::IsSelectStateChanged(), SCH_BUS_ENTRY_BASE::IsSelectStateChanged(), SCH_LINE::IsSelectStateChanged(), SCH_BITMAP::IsSelectStateChanged(), SCH_TEXT::IsSelectStateChanged(), SCH_COMPONENT::IsSelectStateChanged(), SCH_SHEET::IsSelectStateChanged(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), MarkItemsInBloc(), MirrorX(), MirrorY(), moveBitmap(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), LIB_EDIT_FRAME::OnEditPin(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnRotateItem(), SCH_EDIT_FRAME::OnSelectUnit(), SCH_FIELD::Place(), 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(), LIB_EDIT_FRAME::Process_Special_Functions(), EDIT_TOOL::Properties(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), BOARD_COMMIT::Revert(), PCB_BASE_FRAME::Rotate_Module(), RotateListOfItems(), LIB_PIN::Save(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint(), SCH_EDIT_FRAME::SetRepeatItem(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::StartMoveModule(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), and DIALOG_PAD_PROPERTIES::TransferDataFromWindow().

254 { m_Flags &= ~aMask; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
void EDA_ITEM::ClearHighlighted ( )
inlineinherited

Definition at line 232 of file base_struct.h.

References EDA_ITEM::ClearFlags(), and HIGHLIGHTED.

232 { 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:254
void EDA_ITEM::ClearSelected ( )
inlineinherited

Definition at line 231 of file base_struct.h.

References EDA_ITEM::ClearFlags(), and SELECTED.

Referenced by POINT_EDITOR::addCorner(), SELECTION_TOOL::unselectVisually(), and PCB_EDITOR_CONTROL::ZoneDuplicate().

231 { ClearFlags( SELECTED ); }
#define SELECTED
Definition: base_struct.h:120
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:254
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 ZONE_CONTAINER, SCH_SHEET, SCH_COMPONENT, MODULE, D_PAD, LIB_PIN, VIA, SEGZONE, SCH_HIERLABEL, SCH_GLOBALLABEL, TRACK, SCH_LABEL, DRAWSEGMENT, LIB_FIELD, DIMENSION, SCH_TEXT, SCH_SHEET_PIN, SCH_FIELD, TEXTE_MODULE, SCH_BUS_BUS_ENTRY, LIB_ARC, SCH_BUS_WIRE_ENTRY, SCH_LINE, SCH_BITMAP, TEXTE_PCB, LIB_TEXT, EDGE_MODULE, LIB_POLYLINE, LIB_RECTANGLE, SCH_MARKER, LIB_CIRCLE, PCB_TARGET, LIB_BEZIER, SCH_NO_CONNECT, and SCH_JUNCTION.

Definition at line 125 of file base_struct.cpp.

References EDA_ITEM::GetClass().

Referenced by PCB_EDIT_FRAME::Block_Duplicate(), CopyMarkedItems(), LIB_PART::CopySelectedItems(), Duplicate(), DuplicateStruct(), SCH_SCREEN::ExtractWires(), LIB_PART::LIB_PART(), LIB_EDIT_FRAME::LoadOneSymbol(), new_clone(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), SCH_EDIT_FRAME::RepeatDrawItem(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), LIB_PART::SetConversion(), SCH_EDIT_FRAME::SetRepeatItem(), SCH_EDIT_FRAME::SetUndoItem(), LIB_PART::SetUnitCount(), and COMMIT::Stage().

126 {
127  wxCHECK_MSG( false, NULL, wxT( "Clone not implemented in derived class " ) + GetClass() +
128  wxT( ". Bad programmer!" ) );
129 }
virtual wxString GetClass() const =0
Function GetClass returns the class name.
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 88 of file zones_test_and_combine_areas.cpp.

References SHAPE_POLY_SET::BBox(), CombineAreas(), ZONE_CONTAINER::GetIsKeepout(), BOARD_ITEM::GetLayer(), ZONE_CONTAINER::GetLocalFlags(), BOARD_CONNECTED_ITEM::GetNetCode(), ZONE_CONTAINER::GetPriority(), BOX2< Vec >::Intersects(), m_ZoneDescriptorList, ZONE_CONTAINER::Outline(), and TestAreaIntersection().

Referenced by OnAreaPolygonModified().

90 {
91  if( m_ZoneDescriptorList.size() <= 1 )
92  return false;
93 
94  bool modified = false;
95 
96  // Loop through all combinations
97  for( unsigned ia1 = 0; ia1 < m_ZoneDescriptorList.size() - 1; ia1++ )
98  {
99  ZONE_CONTAINER* curr_area = m_ZoneDescriptorList[ia1];
100 
101  if( curr_area->GetNetCode() != aNetCode )
102  continue;
103 
104  // legal polygon
105  BOX2I b1 = curr_area->Outline()->BBox();
106  bool mod_ia1 = false;
107 
108  for( unsigned ia2 = m_ZoneDescriptorList.size() - 1; ia2 > ia1; ia2-- )
109  {
110  ZONE_CONTAINER* area2 = m_ZoneDescriptorList[ia2];
111 
112  if( area2->GetNetCode() != aNetCode )
113  continue;
114 
115  if( curr_area->GetPriority() != area2->GetPriority() )
116  continue;
117 
118  if( curr_area->GetIsKeepout() != area2->GetIsKeepout() )
119  continue;
120 
121  if( curr_area->GetLayer() != area2->GetLayer() )
122  continue;
123 
124  BOX2I b2 = area2->Outline()->BBox();
125 
126  if( b1.Intersects( b2 ) )
127  {
128  // check area2 against curr_area
129  if( curr_area->GetLocalFlags() || area2->GetLocalFlags()
130  || aUseLocalFlags == false )
131  {
132  bool ret = TestAreaIntersection( curr_area, area2 );
133 
134  if( ret )
135  ret = CombineAreas( aDeletedList, curr_area, area2 );
136 
137  if( ret )
138  {
139  mod_ia1 = true;
140  modified = true;
141  }
142  }
143  }
144  }
145 
146  if( mod_ia1 )
147  ia1--; // if modified, we need to check it again
148  }
149 
150  return modified;
151 }
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:78
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:247
bool CombineAreas(PICKED_ITEMS_LIST *aDeletedList, ZONE_CONTAINER *area_ref, ZONE_CONTAINER *area_to_combine)
Function CombineAreas If possible, combine 2 copper areas.
LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
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 GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:644
bool Intersects(const BOX2< Vec > &aRect) const
Function Intersects.
Definition: box2.h:224
int GetNetCode() const
Function GetNetCode.
int GetLocalFlags() const
Definition: class_zone.h:241
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:178
unsigned GetPriority() const
Function GetPriority.
Definition: class_zone.h:119
const BOX2I BBox(int aClearance=0) const override
Function BBox()
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 237 of file zones_test_and_combine_areas.cpp.

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

239 {
240  if( area_ref == area_to_combine )
241  {
242  wxASSERT( 0 );
243  return false;
244  }
245 
246  SHAPE_POLY_SET mergedOutlines = *area_ref->Outline();
247  SHAPE_POLY_SET areaToMergePoly = *area_to_combine->Outline();
248 
249  mergedOutlines.BooleanAdd( areaToMergePoly, SHAPE_POLY_SET::PM_FAST );
250  mergedOutlines.Simplify( SHAPE_POLY_SET::PM_FAST );
251 
252  // We should have one polygon with hole
253  // We can have 2 polygons with hole, if the 2 initial polygons have only one common corner
254  // and therefore cannot be merged (they are dectected as intersecting)
255  // but we should never have more than 2 polys
256  if( mergedOutlines.OutlineCount() > 2 )
257  {
258  wxLogMessage(wxT("BOARD::CombineAreas error: more than 2 polys after merging") );
259  return false;
260  }
261 
262  if( mergedOutlines.OutlineCount() > 1 )
263  return false;
264 
265  // Update the area with the new merged outline
266  delete area_ref->Outline();
267  area_ref->SetOutline( new SHAPE_POLY_SET( mergedOutlines ) );
268 
269  RemoveArea( aDeletedList, area_to_combine );
270 
271  area_ref->SetLocalFlags( 1 );
272  area_ref->Hatch();
273 
274  return true;
275 }
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:247
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) ...
int OutlineCount() const
Returns the number of outlines in the set
void SetOutline(SHAPE_POLY_SET *aOutline)
Definition: class_zone.h:250
Class SHAPE_POLY_SET.
void Simplify(POLYGON_MODE aFastMode)
Simplifies the polyset (merges overlapping polys, eliminates degeneracy/self-intersections) For aFast...
void Hatch()
Function Hatch computes the hatch lines depending on the hatch parameters and stores it in the zone's...
Definition: class_zone.cpp:911
void SetLocalFlags(int aFlags)
Definition: class_zone.h:242
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 1057 of file class_board.cpp.

References Edge_Cuts, ZONE_CONTAINER::GetBoundingBox(), m_Drawings, m_Modules, m_Track, m_Zone, m_ZoneDescriptorList, EDA_RECT::Merge(), TRACK::Next(), MODULE::Next(), BOARD_ITEM::Next(), SEGZONE::Next(), and PCB_LINE_T.

Referenced by BuildBoardPolygonOutlines(), DIALOG_SVG_PRINT::CreateSVGFile(), PCB_EDIT_FRAME::DoGenFootprintsReport(), BOARD_PRINTOUT_CONTROLLER::DrawPage(), PCB_EDIT_FRAME::ExportToGenCAD(), initializePlotter(), CINFO3D_VISU::InitSettings(), and StartPlotBoard().

1058 {
1059  bool hasItems = false;
1060  EDA_RECT area;
1061 
1062  // Check segments, dimensions, texts, and fiducials
1063  for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
1064  {
1065  if( aBoardEdgesOnly && (item->Type() != PCB_LINE_T || item->GetLayer() != Edge_Cuts ) )
1066  continue;
1067 
1068  if( !hasItems )
1069  area = item->GetBoundingBox();
1070  else
1071  area.Merge( item->GetBoundingBox() );
1072 
1073  hasItems = true;
1074  }
1075 
1076  if( !aBoardEdgesOnly )
1077  {
1078  // Check modules
1079  for( MODULE* module = m_Modules; module; module = module->Next() )
1080  {
1081  if( !hasItems )
1082  area = module->GetBoundingBox();
1083  else
1084  area.Merge( module->GetBoundingBox() );
1085 
1086  hasItems = true;
1087  }
1088 
1089  // Check tracks
1090  for( TRACK* track = m_Track; track; track = track->Next() )
1091  {
1092  if( !hasItems )
1093  area = track->GetBoundingBox();
1094  else
1095  area.Merge( track->GetBoundingBox() );
1096 
1097  hasItems = true;
1098  }
1099 
1100  // Check segment zones
1101  for( TRACK* track = m_Zone; track; track = track->Next() )
1102  {
1103  if( !hasItems )
1104  area = track->GetBoundingBox();
1105  else
1106  area.Merge( track->GetBoundingBox() );
1107 
1108  hasItems = true;
1109  }
1110 
1111  // Check polygonal zones
1112  for( unsigned int i = 0; i < m_ZoneDescriptorList.size(); i++ )
1113  {
1115 
1116  if( !hasItems )
1117  area = aZone->GetBoundingBox();
1118  else
1119  area.Merge( aZone->GetBoundingBox() );
1120 
1121  area.Merge( aZone->GetBoundingBox() );
1122  hasItems = true;
1123  }
1124  }
1125 
1126  return area;
1127 }
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:78
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...
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox (virtual)
Definition: class_zone.cpp:349
MODULE * Next() const
Definition: class_module.h:99
DLIST< SEGZONE > m_Zone
Definition: class_board.h:245
SEGZONE * Next() const
Definition: class_track.h:362
BOARD_ITEM * Next() const
DLIST< BOARD_ITEM > m_Drawings
Definition: class_board.h:242
TRACK * Next() const
Definition: class_track.h:97
DLIST< MODULE > m_Modules
Definition: class_board.h:243
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:178
Class EDA_RECT handles the component boundary box.
DLIST< TRACK > m_Track
Definition: class_board.h:244
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:103
void BOARD::ConvertBrdLayerToPolygonalContours ( LAYER_ID  aLayer,
SHAPE_POLY_SET aOutlines 
)

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

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

Definition at line 66 of file board_items_to_polygon_shape_transform.cpp.

References GetArea(), GetAreaCount(), BOARD_ITEM::GetLayer(), m_Drawings, m_Modules, m_Track, TRACK::Next(), MODULE::Next(), BOARD_ITEM::Next(), PCB_LINE_T, PCB_TEXT_T, and ZONE_CONTAINER::TransformSolidAreasShapesToPolygonSet().

Referenced by PlotLayerOutlines().

67 {
68  // Number of segments to convert a circle to a polygon
69  const int segcountforcircle = 18;
70  double correctionFactor = 1.0 / cos( M_PI / (segcountforcircle * 2) );
71 
72  // convert tracks and vias:
73  for( TRACK* track = m_Track; track != NULL; track = track->Next() )
74  {
75  if( !track->IsOnLayer( aLayer ) )
76  continue;
77 
78  track->TransformShapeWithClearanceToPolygon( aOutlines,
79  0, segcountforcircle, correctionFactor );
80  }
81 
82  // convert pads
83  for( MODULE* module = m_Modules; module != NULL; module = module->Next() )
84  {
85  module->TransformPadsShapesWithClearanceToPolygon( aLayer,
86  aOutlines, 0, segcountforcircle, correctionFactor );
87 
88  // Micro-wave modules may have items on copper layers
89  module->TransformGraphicShapesWithClearanceToPolygonSet( aLayer,
90  aOutlines, 0, segcountforcircle, correctionFactor );
91  }
92 
93  // convert copper zones
94  for( int ii = 0; ii < GetAreaCount(); ii++ )
95  {
96  ZONE_CONTAINER* zone = GetArea( ii );
97  LAYER_ID zonelayer = zone->GetLayer();
98 
99  if( zonelayer == aLayer )
101  aOutlines, segcountforcircle, correctionFactor );
102  }
103 
104  // convert graphic items on copper layers (texts)
105  for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
106  {
107  if( !item->IsOnLayer( aLayer ) )
108  continue;
109 
110  switch( item->Type() )
111  {
112  case PCB_LINE_T: // should not exist on copper layers
113  ( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon(
114  aOutlines, 0, segcountforcircle, correctionFactor );
115  break;
116 
117  case PCB_TEXT_T:
118  ( (TEXTE_PCB*) item )->TransformShapeWithClearanceToPolygonSet(
119  aOutlines, 0, segcountforcircle, correctionFactor );
120  break;
121 
122  default:
123  break;
124  }
125  }
126 }
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:78
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
MODULE * Next() const
Definition: class_module.h:99
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:104
LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
void TransformSolidAreasShapesToPolygonSet(SHAPE_POLY_SET &aCornerBuffer, int aCircleToSegmentsCount, double aCorrectionFactor) const
Function TransformSolidAreasShapesToPolygonSet Convert solid areas full shapes to polygon set (the fu...
BOARD_ITEM * Next() const
DLIST< BOARD_ITEM > m_Drawings
Definition: class_board.h:242
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:1051
TRACK * Next() const
Definition: class_track.h:97
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:1022
LAYER_ID
Enum LAYER_ID is the set of PCB layers.
DLIST< MODULE > m_Modules
Definition: class_board.h:243
DLIST< TRACK > m_Track
Definition: class_board.h:244
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:103
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 2237 of file class_board.cpp.

References BEGIN_ONPAD, TRACK::Clone(), delta, TRACK::end, END_ONPAD, ENDPOINT_START, TRACK::GetEnd(), EDA_ITEM::GetList(), GetPad(), TRACK::GetStart(), 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, UR_NEW, wxPoint::x, and wxPoint::y.

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

2238 {
2239  /* creates an intermediate point on aSegment and break it into two segments
2240  * at aPosition.
2241  * The new segment starts from aPosition and ends at the end point of
2242  * aSegment. The original segment now ends at aPosition.
2243  */
2244  if( aSegment->GetStart() == aPosition || aSegment->GetEnd() == aPosition )
2245  return NULL;
2246 
2247  // A via is a good lock point
2248  if( aSegment->Type() == PCB_VIA_T )
2249  {
2250  aPosition = aSegment->GetStart();
2251  return aSegment;
2252  }
2253 
2254  // Calculation coordinate of intermediate point relative to the start point of aSegment
2255  wxPoint delta = aSegment->GetEnd() - aSegment->GetStart();
2256 
2257  // calculate coordinates of aPosition relative to aSegment->GetStart()
2258  wxPoint lockPoint = aPosition - aSegment->GetStart();
2259 
2260  // lockPoint must be on aSegment:
2261  // Ensure lockPoint.y/lockPoint.y = delta.y/delta.x
2262  if( delta.x == 0 )
2263  lockPoint.x = 0; // horizontal segment
2264  else
2265  lockPoint.y = KiROUND( ( (double)lockPoint.x * delta.y ) / delta.x );
2266 
2267  /* Create the intermediate point (that is to say creation of a new
2268  * segment, beginning at the intermediate point.
2269  */
2270  lockPoint += aSegment->GetStart();
2271 
2272  TRACK* newTrack = (TRACK*)aSegment->Clone();
2273  // The new segment begins at the new point,
2274  newTrack->SetStart(lockPoint);
2275  newTrack->start = aSegment;
2276  newTrack->SetState( BEGIN_ONPAD, false );
2277 
2278  DLIST<TRACK>* list = (DLIST<TRACK>*)aSegment->GetList();
2279  wxASSERT( list );
2280  list->Insert( newTrack, aSegment->Next() );
2281 
2282  if( aList )
2283  {
2284  // Prepare the undo command for the now track segment
2285  ITEM_PICKER picker( newTrack, UR_NEW );
2286  aList->PushItem( picker );
2287  // Prepare the undo command for the old track segment
2288  // before modifications
2289  picker.SetItem( aSegment );
2290  picker.SetStatus( UR_CHANGED );
2291  picker.SetLink( aSegment->Clone() );
2292  aList->PushItem( picker );
2293  }
2294 
2295  // Old track segment now ends at new point.
2296  aSegment->SetEnd(lockPoint);
2297  aSegment->end = newTrack;
2298  aSegment->SetState( END_ONPAD, false );
2299 
2300  D_PAD * pad = GetPad( newTrack, ENDPOINT_START );
2301 
2302  if( pad )
2303  {
2304  newTrack->start = pad;
2305  newTrack->SetState( BEGIN_ONPAD, true );
2306  aSegment->end = pad;
2307  aSegment->SetState( END_ONPAD, true );
2308  }
2309 
2310  aPosition = lockPoint;
2311  return newTrack;
2312 }
DHEAD * GetList() const
Definition: base_struct.h:209
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
#define END_ONPAD
Pcbnew: flag set for track segment ending on a pad.
Definition: base_struct.h:133
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
void SetEnd(const wxPoint &aEnd)
Definition: class_track.h:116
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.
#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
const wxPoint & GetEnd() const
Definition: class_track.h:117
const wxPoint & GetStart() const
Definition: class_track.h:120
D_PAD * GetPad(unsigned aIndex) const
Function GetPad.
Definition: class_board.h:750
TRACK * Next() const
Definition: class_track.h:97
void SetState(int type, int state)
Definition: base_struct.h:242
void SetStart(const wxPoint &aStart)
Definition: class_track.h:119
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:108
BOARD_CONNECTED_ITEM * end
Definition: class_track.h:89
BOARD_CONNECTED_ITEM * start
Definition: class_track.h:88
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 66 of file board_item_container.h.

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

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

Function DeleteMARKERs deletes ALL MARKERS from the board.

Definition at line 1018 of file class_board.cpp.

References m_markers.

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

1019 {
1020  // the vector does not know how to delete the MARKER_PCB, it holds pointers
1021  for( unsigned i = 0; i<m_markers.size(); ++i )
1022  delete m_markers[i];
1023 
1024  m_markers.clear();
1025 }
MARKERS m_markers
MARKER_PCBs for clearance problems, owned by pointer.
Definition: class_board.h:175
void BOARD_ITEM::DeleteStructure ( )
inherited
void BOARD::DeleteZONEOutlines ( )

Function DeleteZONEOutlines deletes ALL zone outlines from the board.

Definition at line 1028 of file class_board.cpp.

References m_ZoneDescriptorList.

Referenced by ~BOARD().

1029 {
1030  // the vector does not know how to delete the ZONE Outlines, it holds
1031  // pointers
1032  for( unsigned i = 0; i<m_ZoneDescriptorList.size(); ++i )
1033  delete m_ZoneDescriptorList[i];
1034 
1035  m_ZoneDescriptorList.clear();
1036 }
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:178
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 tracepcb.cpp.

References LSET::AllCuMask(), B_Cu, ZONE_CONTAINER::Draw(), ZONE_CONTAINER::DrawFilledArea(), DrawHighLight(), F_Cu, GetArea(), GetAreaCount(), EDA_ITEM::GetFlags(), GetHighLightNetCode(), IN_EDIT, IS_DRAGGED, IS_MOVED, IsElementVisible(), IsHighLightNetON(), m_Drawings, m_markers, m_Modules, m_Track, m_Zone, MOD_BK_VISIBLE, MOD_FR_VISIBLE, TRACK::Next(), MODULE::Next(), BOARD_ITEM::Next(), SEGZONE::Next(), PCB_DIMENSION_T, PCB_LINE_T, PCB_TARGET_T, PCB_TEXT_T, and Trace_Pads_Only().

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

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  // SEGZONE is outdated, only her for compatibility with
161  // very old designs
162  for( SEGZONE* zone = m_Zone; zone; zone = zone->Next() )
163  {
164  if( zone->IsMoving() )
165  continue;
166 
167  zone->Draw( aPanel, DC, aDrawMode );
168  }
169 
170  // Draw the graphic items
171  for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
172  {
173  if( item->IsMoving() )
174  continue;
175 
176  switch( item->Type() )
177  {
178  case PCB_DIMENSION_T:
179  case PCB_TEXT_T:
180  case PCB_TARGET_T:
181  case PCB_LINE_T:
182  item->Draw( aPanel, DC, aDrawMode );
183  break;
184 
185  default:
186  break;
187  }
188  }
189 
190  // Draw areas (i.e. zones)
191  for( int ii = 0; ii < GetAreaCount(); ii++ )
192  {
193  ZONE_CONTAINER* zone = GetArea( ii );
194 
195  // Areas must be drawn here only if not moved or dragged,
196  // because these areas are drawn by ManageCursor() in a specific manner
197  if( ( zone->GetFlags() & (IN_EDIT | IS_DRAGGED | IS_MOVED) ) == 0 )
198  {
199  zone->Draw( aPanel, DC, aDrawMode );
200  zone->DrawFilledArea( aPanel, DC, aDrawMode );
201  }
202  }
203 
204  LSET all_cu = LSET::AllCuMask();
205 
206  for( MODULE* module = m_Modules; module; module = module->Next() )
207  {
208  bool display = true;
209  LSET layerMask = all_cu;
210 
211  if( module->IsMoving() )
212  continue;
213 
215  {
216  if( module->GetLayer() == F_Cu )
217  display = false;
218 
219  layerMask.set( F_Cu, false );
220  }
221 
223  {
224  if( module->GetLayer() == B_Cu )
225  display = false;
226 
227  layerMask.set( B_Cu, false );
228  }
229 
230  if( display )
231  module->Draw( aPanel, DC, aDrawMode );
232  else
233  Trace_Pads_Only( aPanel, DC, module, 0, 0, layerMask, aDrawMode );
234  }
235 
236  if( IsHighLightNetON() )
237  DrawHighLight( aPanel, DC, GetHighLightNetCode() );
238 
239  // draw the BOARD's markers last, otherwise the high light will erase any marker on a pad
240  for( unsigned i = 0; i < m_markers.size(); ++i )
241  {
242  m_markers[i]->Draw( aPanel, DC, aDrawMode );
243  }
244 }
show modules on front
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu LAYER_IDs.
Definition: lset.cpp:638
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:179
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:78
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:255
#define IN_EDIT
Item currently edited.
Definition: base_struct.h:111
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:240
MODULE * Next() const
Definition: class_module.h:99
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:104
DLIST< SEGZONE > m_Zone
Definition: class_board.h:245
SEGZONE * Next() const
Definition: class_track.h:362
BOARD_ITEM * Next() const
#define IS_DRAGGED
Item being dragged.
Definition: base_struct.h:115
Class LSET is a set of LAYER_IDs.
PCB_VISIBLE
Enum PCB_VISIBLE is a set of visible PCB elements.
DLIST< BOARD_ITEM > m_Drawings
Definition: class_board.h:242
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:1051
MARKERS m_markers
MARKER_PCBs for clearance problems, owned by pointer.
Definition: class_board.h:175
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:112
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:113
TRACK * Next() const
Definition: class_track.h:97
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:1022
static void Trace_Pads_Only(EDA_DRAW_PANEL *panel, wxDC *DC, MODULE *Module, int ox, int oy, LSET LayerMask, GR_DRAWMODE draw_mode)
Definition: tracepcb.cpp:295
DLIST< MODULE > m_Modules
Definition: class_board.h:243
bool IsElementVisible(int aPCB_VISIBLE) const
Function IsElementVisible tests whether a given element category is visible.
bool IsHighLightNetON() const
Function IsHighLightNetON.
Definition: class_board.h:370
int GetHighLightNetCode() const
Function GetHighLightNetCode.
Definition: class_board.h:355
DLIST< TRACK > m_Track
Definition: class_board.h:244
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...
Definition: tracepcb.cpp:247
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:103
#define IS_MOVED
Item being moved.
Definition: base_struct.h:112
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 247 of file tracepcb.cpp.

References ZONE_CONTAINER::Draw(), GetArea(), GetAreaCount(), BOARD_CONNECTED_ITEM::GetNetCode(), GR_AND, GR_HIGHLIGHT, GR_OR, IsHighLightNetON(), m_Modules, m_Track, TRACK::Next(), MODULE::Next(), 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().

248 {
249  GR_DRAWMODE draw_mode;
250 
251  if( IsHighLightNetON() )
252  draw_mode = GR_HIGHLIGHT | GR_OR;
253  else
254  draw_mode = GR_AND | GR_HIGHLIGHT;
255 
256  // Redraw zones
257  for( int ii = 0; ii < GetAreaCount(); ii++ )
258  {
259  ZONE_CONTAINER* zone = GetArea( ii );
260 
261  if( zone->GetNetCode() == aNetCode )
262  {
263  zone->Draw( am_canvas, DC, draw_mode );
264  }
265  }
266 
267  // Redraw any pads that have aNetCode
268  for( MODULE* module = m_Modules; module; module = module->Next() )
269  {
270  for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() )
271  {
272  if( pad->GetNetCode() == aNetCode )
273  {
274  pad->Draw( am_canvas, DC, draw_mode );
275  }
276  }
277  }
278 
279  // Redraw track and vias that have aNetCode
280  for( TRACK* seg = m_Track; seg; seg = seg->Next() )
281  {
282  if( seg->GetNetCode() == aNetCode )
283  {
284  seg->Draw( am_canvas, DC, draw_mode );
285  }
286  }
287 }
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:179
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:78
MODULE * Next() const
Definition: class_module.h:99
GR_DRAWMODE
Drawmode. Compositing mode plus a flag or two.
Definition: gr_basic.h:41
D_PAD * Next() const
Definition: class_pad.h:106
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:1051
Definition: gr_basic.h:42
int GetNetCode() const
Function GetNetCode.
TRACK * Next() const
Definition: class_track.h:97
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:1022
DLIST< MODULE > m_Modules
Definition: class_board.h:243
bool IsHighLightNetON() const
Function IsHighLightNetON.
Definition: class_board.h:370
DLIST< TRACK > m_Track
Definition: class_board.h:244
BOARD_ITEM * BOARD::Duplicate ( const BOARD_ITEM aItem,
bool  aAddToBoard = false 
)

Definition at line 2843 of file class_board.cpp.

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

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

2845 {
2846  BOARD_ITEM* new_item = NULL;
2847 
2848  switch( aItem->Type() )
2849  {
2850  case PCB_MODULE_T:
2851  case PCB_TEXT_T:
2852  case PCB_LINE_T:
2853  case PCB_TRACE_T:
2854  case PCB_VIA_T:
2855  case PCB_ZONE_AREA_T:
2856  case PCB_TARGET_T:
2857  case PCB_DIMENSION_T:
2858  new_item = static_cast<BOARD_ITEM*>( aItem->Clone() );
2859  break;
2860 
2861  default:
2862  // Un-handled item for duplication
2863  new_item = NULL;
2864  break;
2865  }
2866 
2867  if( new_item && aAddToBoard )
2868  Add( new_item );
2869 
2870  return new_item;
2871 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:114
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:104
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:107
class MODULE, a footprint
Definition: typeinfo.h:101
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_INSERT) override
>
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:112
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:113
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:108
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:103
NETINFO_LIST::iterator BOARD::EndNets ( ) const
inline

Function EndNets.

Returns
iterator to the last element of the NETINFO_ITEMs list

Definition at line 804 of file class_board.h.

References NETINFO_LIST::end().

805  {
806  return m_NetInfo.end();
807  }
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:188
iterator end() const
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 1409 of file class_board.cpp.

References FindModuleByReference(), m_Modules, and MODULE::Next().

Referenced by ReplaceNetlist(), and BOARD_NETLIST_UPDATER::UpdateNetlist().

1410 {
1411  if( aSearchByTimeStamp )
1412  {
1413  for( MODULE* module = m_Modules; module; module = module->Next() )
1414  {
1415  if( aRefOrTimeStamp.CmpNoCase( module->GetPath() ) == 0 )
1416  return module;
1417  }
1418  }
1419  else
1420  {
1421  return FindModuleByReference( aRefOrTimeStamp );
1422  }
1423 
1424  return NULL;
1425 }
MODULE * Next() const
Definition: class_module.h:99
MODULE * FindModuleByReference(const wxString &aReference) const
Function FindModuleByReference searches for a MODULE within this board with the given reference desig...
DLIST< MODULE > m_Modules
Definition: class_board.h:243
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 1381 of file class_board.cpp.

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

Referenced by PCB_EDIT_FRAME::ExecuteRemoteCommand(), FindModule(), ReplaceNetlist(), BOARD_NETLIST_UPDATER::testConnectivity(), and DIALOG_NETLIST::verifyFootprints().

1382 {
1383  MODULE* found = nullptr;
1384 
1385  // search only for MODULES
1386  static const KICAD_T scanTypes[] = { PCB_MODULE_T, EOT };
1387 
1388  INSPECTOR_FUNC inspector = [&] ( EDA_ITEM* item, void* testData )
1389  {
1390  MODULE* module = (MODULE*) item;
1391 
1392  if( aReference == module->GetReference() )
1393  {
1394  found = module;
1395  return SEARCH_QUIT;
1396  }
1397 
1398  return SEARCH_CONTINUE;
1399  };
1400 
1401  // visit this BOARD with the above inspector
1402  BOARD* nonconstMe = (BOARD*) this;
1403  nonconstMe->Visit( inspector, NULL, scanTypes );
1404 
1405  return found;
1406 }
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:79
search types array terminator (End Of Types)
Definition: typeinfo.h:94
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:90
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:101
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:166
const wxString & GetReference() const
Function GetReference.
Definition: class_module.h:411
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:151
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 1360 of file class_board.cpp.

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(), PCB_BASE_FRAME::Build_Board_Ratsnest(), PCB_BASE_FRAME::BuildAirWiresTargetsList(), 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(), filterNetClass(), BOARD_CONNECTED_ITEM::GetNetClass(), ROUTER_TOOL::getNetclassDimensions(), PNS::SIZES_SETTINGS::Init(), PCB_EDIT_FRAME::ListNetsAndSelect(), LEGACY_PLUGIN::loadNETINFO_ITEM(), LEGACY_PLUGIN::loadPAD(), Merge_SubNets_Connected_By_CopperAreas(), PCB_EDIT_FRAME::OnLeftClick(), NETINFO_MAPPING::iterator::operator*(), PNS_PCBNEW_RULE_RESOLVER::PNS_PCBNEW_RULE_RESOLVER(), ReplaceNetlist(), BOARD_CONNECTED_ITEM::SetNetCode(), PCB_EDIT_FRAME::Solve(), PNS::DIFF_PAIR_PLACER::Start(), SynchronizeNetsAndNetClasses(), Test_Connections_To_Copper_Areas(), PCB_BASE_FRAME::TestForActiveLinksInRatsnest(), PCB_BASE_FRAME::TestNetConnection(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::transferDataToPad(), BOARD_NETLIST_UPDATER::updateComponentPadConnections(), and DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::updateNetInfo().

1361 {
1362  // the first valid netcode is 1 and the last is m_NetInfo.GetCount()-1.
1363  // zero is reserved for "no connection" and is not actually a net.
1364  // NULL is returned for non valid netcodes
1365 
1366  wxASSERT( m_NetInfo.GetNetCount() > 0 ); // net zero should exist
1367 
1368  if( aNetcode == NETINFO_LIST::UNCONNECTED && m_NetInfo.GetNetCount() == 0 )
1370  else
1371  return m_NetInfo.GetNetItem( aNetcode );
1372 }
NETINFO_ITEM * GetNetItem(int aNetCode) const
Function GetItem.
unsigned GetNetCount() const
Function GetNetCount.
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:188
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...
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
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 1375 of file class_board.cpp.

References NETINFO_LIST::GetNetItem(), and m_NetInfo.

1376 {
1377  return m_NetInfo.GetNetItem( aNetname );
1378 }
NETINFO_ITEM * GetNetItem(int aNetCode) const
Function GetItem.
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:188
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, DRAWSEGMENT, DIMENSION, MODULE, D_PAD, TRACK, TEXTE_MODULE, EDGE_MODULE, PCB_TARGET, MARKER_PCB, and TEXTE_PCB.

Definition at line 263 of file class_board_item.h.

References EDA_ITEM::GetClass().

Referenced by PCB_EDIT_FRAME::Block_Flip(), DRAWING_TOOL::PlaceText(), and PCB_BASE_EDIT_FRAME::PutDataInPreviousState().

264  {
265  wxMessageBox( wxT( "virtual BOARD_ITEM::Flip used, should not occur" ), GetClass() );
266  }
virtual wxString GetClass() const =0
Function GetClass returns the class name.
std::string BOARD_ITEM::FormatAngle ( double  aAngle)
staticinherited

Function FormatAngle converts aAngle from board units to a string appropriate for writing to file.

Note
Internal angles for board items can be either degrees or tenths of degree on how KiCad is built.
Parameters
aAngleA angle value to convert.
Returns
A std::string object containing the converted angle.

Definition at line 170 of file class_board_item.cpp.

171 {
172  char temp[50];
173 
174  int len = snprintf( temp, sizeof(temp), "%.10g", aAngle / 10.0 );
175 
176  return std::string( temp, len );
177 }
std::string BOARD_ITEM::FormatInternalUnits ( int  aValue)
staticinherited

Function FormatInternalUnits converts aValue from board internal units to a string appropriate for writing to file.

Note
Internal units for board items can be either deci-mils or nanometers depending on how KiCad is build.
Parameters
aValueA coordinate value to convert.
Returns
A std::string object containing the converted value.

Definition at line 89 of file class_board_item.cpp.

Referenced by checkConnectedTo(), ConvertOutlineToPolygon(), BOARD_ITEM::FormatInternalUnits(), and TracksInNetBetweenPoints().

90 {
91 #if 1
92 
93  char buf[50];
94  int len;
95  double mm = aValue / IU_PER_MM;
96 
97  if( mm != 0.0 && fabs( mm ) <= 0.0001 )
98  {
99  len = sprintf( buf, "%.10f", mm );
100 
101  while( --len > 0 && buf[len] == '0' )
102  buf[len] = '\0';
103 
104  if( buf[len] == '.' )
105  buf[len] = '\0';
106  else
107  ++len;
108  }
109  else
110  {
111  len = sprintf( buf, "%.10g", mm );
112  }
113 
114  return std::string( buf, len );
115 
116 #else
117 
118  // Assume aValue is in nanometers, and that we want the result in millimeters,
119  // and that int is 32 bits wide. Then perform an alternative algorithm.
120  // Can be used to verify that the above algorithm is correctly generating text.
121  // Convert aValue into an integer string, then insert a decimal point manually.
122  // Results are the same as above general purpose algorithm.
123 
124  wxASSERT( sizeof(int) == 4 );
125 
126  if( aValue == 0 )
127  return std::string( 1, '0' );
128  else
129  {
130  char buf[50];
131  int len = sprintf( buf, aValue > 0 ? "%06d" : "%07d", aValue ); // optionally pad w/leading zeros
132 
133  std::string ret( buf, len );
134 
135  std::string::iterator it = ret.end() - 1; // last byte
136 
137  // insert '.' at 6 positions from end, dividing by 10e6 (a million), nm => mm
138  std::string::iterator decpoint = ret.end() - 6;
139 
140  // truncate trailing zeros, up to decimal point position
141  for( ; *it=='0' && it >= decpoint; --it )
142  ret.erase( it ); // does not invalidate iterators it or decpoint
143 
144  if( it >= decpoint )
145  {
146  ret.insert( decpoint, '.' );
147 
148  // decpoint is invalidated here, after insert()
149 
150 #if 1 // want a leading zero when decimal point is in first position?
151  if( ret[0] == '.' )
152  {
153  // insert leading zero ahead of decimal point.
154  ret.insert( ret.begin(), '0' );
155  }
156  else if( ret[0]=='-' && ret[1]=='.' )
157  {
158  ret.insert( ret.begin() + 1, '0' );
159  }
160 #endif
161  }
162 
163  return ret;
164  }
165 
166 #endif
167 }
std::string BOARD_ITEM::FormatInternalUnits ( const wxPoint aPoint)
staticinherited

Definition at line 180 of file class_board_item.cpp.

References BOARD_ITEM::FormatInternalUnits(), wxPoint::x, and wxPoint::y.

181 {
182  return FormatInternalUnits( aPoint.x ) + " " + FormatInternalUnits( aPoint.y );
183 }
static std::string FormatInternalUnits(int aValue)
Function FormatInternalUnits converts aValue from board internal units to a string appropriate for wr...
std::string BOARD_ITEM::FormatInternalUnits ( const wxSize &  aSize)
staticinherited

Definition at line 186 of file class_board_item.cpp.

References BOARD_ITEM::FormatInternalUnits().

187 {
188  return FormatInternalUnits( aSize.GetWidth() ) + " " + FormatInternalUnits( aSize.GetHeight() );
189 }
static std::string FormatInternalUnits(int aValue)
Function FormatInternalUnits converts aValue from board internal units to a string appropriate for wr...
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 1022 of file class_board.h.

Referenced by DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), PCBNEW_CONTROL::AppendBoard(), PCB_EDIT_FRAME::AppendBoardFile(), PCB_EDIT_FRAME::Begin_Zone(), PCB_EDIT_FRAME::Block_SelectItems(), ZONE_CONTAINER::buildFeatureHoleList(), ConvertBrdLayerToPolygonalContours(), CINFO3D_VISU::createLayers(), BOARD_NETLIST_UPDATER::deleteSinglePadNets(), PCB_DRAW_PANEL_GAL::DisplayBoard(), DRC::doEdgeZoneDrc(), DRC::doTrackKeepoutDrc(), Draw(), DrawHighLight(), PCB_EDIT_FRAME::Edit_Zone_Params(), export_vrml_zones(), DIALOG_COPPER_ZONE::ExportSetupToOtherCopperZones(), PCB_EDIT_FRAME::Fill_All_Zones(), Merge_SubNets_Connected_By_CopperAreas(), PlotSilkScreen(), PlotSolderMaskLayer(), PlotStandardLayer(), PCB_EDIT_FRAME::PrintPage(), PCB_EDIT_FRAME::Process_Special_Functions(), RN_DATA::ProcessBoard(), RedrawAreasOutlines(), RedrawFilledAreas(), ReplaceNetlist(), SaveCopyOfZones(), SetAreasNetCodesFromNetNames(), Test_Connections_To_Copper_Areas(), Test_Drc_Areas_Outlines_To_Areas_Outlines(), BOARD_NETLIST_UPDATER::testConnectivity(), TestForExistingItem(), DRC::testKeepoutAreas(), DRC::testZones(), NETINFO_MAPPING::Update(), UpdateCopyOfZonesList(), PCBNEW_CONTROL::ZoneDisplayMode(), PCB_EDITOR_CONTROL::ZoneFillAll(), and PCB_EDITOR_CONTROL::ZoneUnfillAll().

1023  {
1024  if( (unsigned) index < m_ZoneDescriptorList.size() )
1025  return m_ZoneDescriptorList[index];
1026 
1027  return NULL;
1028  }
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:178
int BOARD::GetAreaCount ( ) const
inline

Function GetAreaCount.

Returns
int - The number of Areas or ZONE_CONTAINER.

Definition at line 1051 of file class_board.h.

Referenced by PCBNEW_CONTROL::AppendBoard(), PCB_EDIT_FRAME::AppendBoardFile(), PCB_EDIT_FRAME::Begin_Zone(), PCB_EDIT_FRAME::Block_SelectItems(), ZONE_CONTAINER::buildFeatureHoleList(), ConvertBrdLayerToPolygonalContours(), CINFO3D_VISU::createLayers(), BOARD_NETLIST_UPDATER::deleteSinglePadNets(), PCB_DRAW_PANEL_GAL::DisplayBoard(), DRC::doEdgeZoneDrc(), DRC::doTrackKeepoutDrc(), Draw(), DrawHighLight(), PCB_EDIT_FRAME::Edit_Zone_Params(), export_vrml_zones(), DIALOG_COPPER_ZONE::ExportSetupToOtherCopperZones(), PCB_EDIT_FRAME::Fill_All_Zones(), Merge_SubNets_Connected_By_CopperAreas(), PlotSilkScreen(), PlotSolderMaskLayer(), PlotStandardLayer(), PCB_EDIT_FRAME::PrintPage(), PCB_EDIT_FRAME::Process_Special_Functions(), RN_DATA::ProcessBoard(), RedrawAreasOutlines(), RedrawFilledAreas(), ReplaceNetlist(), SetAreasNetCodesFromNetNames(), Test_Connections_To_Copper_Areas(), Test_Drc_Areas_Outlines_To_Areas_Outlines(), BOARD_NETLIST_UPDATER::testConnectivity(), TestForExistingItem(), DRC::testKeepoutAreas(), DRC::testZones(), NETINFO_MAPPING::Update(), PCBNEW_CONTROL::ZoneDisplayMode(), PCB_EDITOR_CONTROL::ZoneFillAll(), and PCB_EDITOR_CONTROL::ZoneUnfillAll().

1052  {
1053  return (int) m_ZoneDescriptorList.size();
1054  }
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:178
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 1036 of file class_board.h.

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

1037  {
1038  for( int ii = 0; ii < GetAreaCount(); ii++ ) // Search for aArea in list
1039  {
1040  if( aArea == GetArea( ii ) ) // Found !
1041  return ii;
1042  }
1043 
1044  return -1;
1045  }
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:1051
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:1022
const wxPoint& BOARD::GetAuxOrigin ( ) const
inline
BOARD * BOARD_ITEM::GetBoard ( ) const
virtualinherited

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

Definition at line 63 of file class_board_item.cpp.

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

Referenced by ZONE_CONTAINER::buildFeatureHoleList(), DeleteMarkedItems(), TEXTE_PCB::Draw(), PCB_TARGET::Draw(), EDGE_MODULE::Draw(), ZONE_CONTAINER::Draw(), TEXTE_MODULE::Draw(), TRACK::Draw(), DRAWSEGMENT::Draw(), DIMENSION::Draw(), KIGFX::PCB_PAINTER::draw(), MODULE::Draw(), D_PAD::Draw(), SEGZONE::Draw(), VIA::Draw(), MODULE::DrawAncre(), ZONE_CONTAINER::DrawFilledArea(), BOARD_PRINTOUT_CONTROLLER::DrawPage(), ZONE_CONTAINER::DrawWhileCreateOutline(), EVT_COMMAND_RANGE(), POINT_EDITOR::finishItem(), TEXTE_PCB::Flip(), TRACK::Flip(), VIA::Flip(), ZONE_CONTAINER::Flip(), BOARD_ITEM::GetBoard(), MODULE::GetBoundingBox(), BOARD_ITEM::GetLayerName(), TRACK::GetMsgPanelInfo(), NETINFO_ITEM::GetMsgPanelInfo(), D_PAD::GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase(), SEGZONE::GetMsgPanelInfoBase(), VIA::GetMsgPanelInfoBase(), TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetClass(), TRACK::GetSelectMenuText(), SEGZONE::GetSelectMenuText(), VIA::GetSelectMenuText(), D_PAD::GetSelectMenuText(), ZONE_CONTAINER::GetSelectMenuText(), D_PAD::GetSolderMaskMargin(), D_PAD::GetSolderPasteMargin(), BRDITEMS_PLOTTER::PlotDimension(), PushTrack(), BOARD_CONNECTED_ITEM::SetNet(), and BOARD_CONNECTED_ITEM::SetNetCode().

64 {
65  if( Type() == PCB_T )
66  return (BOARD*) this;
67 
68  BOARD_ITEM* parent = GetParent();
69 
70  if( parent )
71  return parent->GetBoard();
72 
73  return NULL;
74 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
BOARD_ITEM_CONTAINER * GetParent() const
Definition: typeinfo.h:97
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:166
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
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 839 of file class_board.h.

Referenced by BuildBoardPolygonOutlines(), EAGLE_PLUGIN::centerBoard(), MATRIX_ROUTING_HEAD::ComputeMatrixSize(), BOARD_NETLIST_UPDATER::estimateComponentInsertionPosition(), EXCELLON_WRITER::GenDrillMapFile(), genPlacementRoutingMatrix(), PCB_BASE_FRAME::GetBoardBoundingBox(), idf_export_outline(), PCB_EDIT_FRAME::OnExportIDF3(), ReplaceNetlist(), and PCB_EDIT_FRAME::SpreadFootprints().

840  {
841  return ComputeBoundingBox( true );
842  }
EDA_RECT ComputeBoundingBox(bool aBoardEdgesOnly=false) const
Function ComputeBoundingBox calculates the bounding box containing all board items (or board edge seg...
bool BOARD::GetBoardPolygonOutlines ( SHAPE_POLY_SET aOutlines,
wxString *  aErrorText = NULL 
)

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 = NULL , no message returned on error)
Returns
true if success, false if a contour is not valid

Definition at line 2884 of file class_board.cpp.

References BuildBoardPolygonOutlines(), SHAPE_POLY_SET::PM_STRICTLY_SIMPLE, and SHAPE_POLY_SET::Simplify().

Referenced by CINFO3D_VISU::createBoardPolygon(), and export_vrml_board().

2886 {
2887  bool success = BuildBoardPolygonOutlines( this, aOutlines, aErrorText );
2888 
2889  // Make polygon strictly simple to avoid issues (especially in 3D viewer)
2891 
2892  return success;
2893 
2894 }
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)
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 827 of file class_board.h.

Referenced by MATRIX_ROUTING_HEAD::ComputeMatrixSize(), PCB_BASE_FRAME::GetBoardBoundingBox(), DIALOG_UPDATE_PCB::PerformUpdate(), and PCB_EDIT_FRAME::ReadPcbNetlist().

828  {
829  return ComputeBoundingBox( false );
830  }
EDA_RECT ComputeBoundingBox(bool aBoardEdgesOnly=false) const
Function ComputeBoundingBox calculates the bounding box containing all board items (or board edge seg...
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 105 of file class_board_item.h.

References BOARD_ITEM::GetPosition().

Referenced by LEGACY_ARRAY_CREATOR::getRotationCentre(), and DIALOG_CREATE_ARRAY::ARRAY_CIRCULAR_OPTIONS::TransformItem().

105 { return GetPosition(); }
virtual const wxPoint & GetPosition() const =0
wxString BOARD::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Implements EDA_ITEM.

Definition at line 958 of file class_board.h.

Referenced by Visit().

959  {
960  return wxT( "BOARD" );
961  }
BOARD_DESIGN_SETTINGS& BOARD::GetDesignSettings ( ) const
inline

Function GetDesignSettings.

Returns
the BOARD_DESIGN_SETTINGS for this BOARD

Definition at line 530 of file class_board.h.

Referenced by Append_Track_Width_List(), TRACK_VIA_SIZE_MENU::AppendSizes(), ZONE_CONTAINER::buildFeatureHoleList(), BuildUnconnectedThermalStubsPolygonList(), compute_layer_Zs(), MICROWAVE_TOOL::createInductorBetween(), CreatePadsShapesSection(), CreateRoutesSection(), ROUTER_TOOL::CustomTrackWidthDialog(), DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL(), DIALOG_LAYERS_SETUP::DIALOG_LAYERS_SETUP(), DIALOG_PADS_MASK_CLEARANCE::DIALOG_PADS_MASK_CLEARANCE(), DRC::doNetClass(), DRC::doTrackDrc(), DRAWING_TOOL::DrawDimension(), PCB_EDIT_FRAME::EditDimension(), TRACK_WIDTH_MENU::eventHandler(), EVT_TOOL(), EVT_UPDATE_UI(), PCB_EDIT_FRAME::Export_IDF3(), MODULE::GetBoundingBox(), FOOTPRINT_EDIT_FRAME::GetDesignSettings(), PCB_BASE_FRAME::GetDesignSettings(), BOARD_CONNECTED_ITEM::GetNetClass(), ROUTER_TOOL::getNetclassDimensions(), PCB_EDIT_FRAME::GetProjectFileParameters(), DRAWING_TOOL::getSegmentWidth(), D_PAD::GetSolderMaskMargin(), D_PAD::GetSolderPasteMargin(), PNS::SIZES_SETTINGS::Init(), DIALOG_PLOT::Init_Dialog(), DIALOG_DESIGN_RULES::InitDialogRules(), CINFO3D_VISU::InitSettings(), CINFO3D_VISU::Is3DLayerEnabled(), LEGACY_PLUGIN::loadGENERAL(), LEGACY_PLUGIN::loadNETCLASS(), EAGLE_PLUGIN::loadPlain(), LEGACY_PLUGIN::loadSETUP(), DIALOG_DRC_CONTROL::OnActivateDlg(), PCB_EDIT_FRAME::OnHotKey(), DIALOG_LAYERS_SETUP::OnOkButtonClick(), ROUTER_TOOL::onTrackViaSizeChanged(), ROUTER_TOOL::onViaCommand(), OrCell_Trace(), PlaceCells(), PCB_EDITOR_CONTROL::PlaceTarget(), PlotOneBoardLayer(), PlotSolderMaskLayer(), PlotStandardLayer(), PNS_PCBNEW_RULE_RESOLVER::PNS_PCBNEW_RULE_RESOLVER(), SaveBoard(), PCB_EDIT_FRAME::Solve(), PNS::DIFF_PAIR_PLACER::Start(), PNS_KICAD_IFACE::SyncWorld(), DRC::testNetClasses(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::updateNetInfo(), PCB_EDITOR_CONTROL::ViaSizeDec(), and PCB_EDITOR_CONTROL::ViaSizeInc().

531  {
532  // remove const-ness with cast.
534  }
BOARD_DESIGN_SETTINGS m_designSettings
Definition: class_board.h:191
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.
LSET BOARD::GetEnabledLayers ( ) const

Function GetEnabledLayers is a proxy function that calls the corresponding function in m_BoardSettings Returns a bit-mask of all the layers that are enabled.

Returns
int - the enabled layers in bit-mapped form.

Definition at line 691 of file class_board.cpp.

References BOARD_DESIGN_SETTINGS::GetEnabledLayers(), and m_designSettings.

Referenced by PCBNEW_CONTROL::AppendBoard(), PCB_EDIT_FRAME::AppendBoardFile(), DIALOG_PLOT::applyPlotSettings(), PCB_ONE_LAYER_SELECTOR::buildList(), SELECT_COPPER_LAYERS_PAIR_DIALOG::buildList(), DIALOG_LAYERS_SETUP::DIALOG_LAYERS_SETUP(), EXCELLON_WRITER::GenDrillReportFile(), PCB_LAYER_BOX_SELECTOR::getEnabledLayers(), DIALOG_PLOT::Init_Dialog(), DIALOG_SVG_PRINT::initDialog(), DIALOG_PRINT_USING_PRINTER::initValues(), DIALOG_PLOT::Plot(), PCB_LAYER_WIDGET::ReFill(), and SetLayerName().

692 {
694 }
BOARD_DESIGN_SETTINGS m_designSettings
Definition: class_board.h:191
LSET GetEnabledLayers() const
Function GetEnabledLayers returns a bit-mask of all the layers that are enabled.
int BOARD::GetFileFormatVersionAtLoad ( ) const
inline

Definition at line 272 of file class_board.h.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

272 { return m_fileFormatVersionAtLoad; }
int m_fileFormatVersionAtLoad
the version loaded from the file
Definition: class_board.h:186
const wxString& BOARD::GetFileName ( ) const
inline

Definition at line 237 of file class_board.h.

Referenced by AddGerberX2Attribute(), DIALOG_FREEROUTE::createDSN_File(), DIALOG_GEN_MODULE_POSITION::CreateFiles(), CreateHeaderInfoData(), BOARD_PRINTOUT_CONTROLLER::DrawPage(), EXCELLON_WRITER::drillFileName(), PCB_EDIT_FRAME::Export_IDF3(), DIALOG_SVG_PRINT::ExportSVGFile(), PCB_EDIT_FRAME::ExportToGenCAD(), PCB_EDIT_FRAME::ExportToSpecctra(), PCB_EDIT_FRAME::GenD356File(), EXCELLON_WRITER::GenDrillReportFile(), PCB_EDIT_FRAME::GenFootprintsReport(), PCB_EDIT_FRAME::GetLastNetListRead(), PCB_EDIT_FRAME::ImportSpecctraSession(), PCB_EDIT_FRAME::InstallNetlistFrame(), DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick(), PCB_EDIT_FRAME::OnCloseWindow(), PCB_EDIT_FRAME::OnExportIDF3(), PCB_EDIT_FRAME::OnExportSTEP(), PCB_EDIT_FRAME::OnExportVRML(), DIALOG_GENDRILL::OnGenReportFile(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_SVG_PRINT::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_GEN_MODULE_POSITION::OnOutputDirectoryBrowseClicked(), PLOT_CONTROLLER::OpenPlotfile(), DIALOG_PLOT::Plot(), PCB_EDIT_FRAME::Process_Config(), DIALOG_EXCHANGE_MODULE::RebuildCmpList(), PCB_EDIT_FRAME::RecreateBOMFileFromBoard(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), PCB_EDIT_FRAME::SetLastNetListRead(), StartPlotBoard(), PCB_EDIT_FRAME::UpdateTitle(), and DIALOG_DRC_CONTROL::writeReport().

237 { return m_fileName; }
wxString m_fileName
the board filename
Definition: class_board.h:172
STATUS_FLAGS EDA_ITEM::GetFlags ( ) const
inlineinherited

Definition at line 255 of file base_struct.h.

References EDA_ITEM::m_Flags.

Referenced by AbortMoveAndEditTarget(), SCH_SCREEN::addConnectedItemsToBlock(), AddMenusForBitmap(), AddMenusForBusEntry(), AddMenusForComponent(), AddMenusForComponentField(), AddMenusForEditComponent(), AddMenusForGLabel(), AddMenusForHierchicalSheet(), AddMenusForHLabel(), AddMenusForLabel(), AddMenusForSheetPin(), AddMenusForText(), SCH_EDIT_FRAME::BeginSegment(), SCH_EDIT_FRAME::ChangeTextOrient(), Collect_TrackSegmentsToDrag(), SCH_EDIT_FRAME::ConvertPart(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), LIB_EDIT_FRAME::CreatePin(), 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(), Draw(), PCB_EDIT_FRAME::Edit_TrackSegm_Width(), SCH_EDIT_FRAME::EditComponentFieldText(), SCH_EDIT_FRAME::EditImage(), PCB_EDIT_FRAME::FlipTextePcb(), LIB_VIEW_FRAME::GeneralControl(), SCH_EDIT_FRAME::GeneralControl(), SCH_SCREEN::GetConnection(), InitialiseDragParameters(), LIB_EDIT_FRAME::LoadOneSymbol(), Magnetize(), SCH_EDIT_FRAME::MirrorImage(), SCH_EDIT_FRAME::MirrorSheet(), moveBitmap(), SCH_EDIT_FRAME::OnAutoplaceFields(), SCH_EDIT_FRAME::OnConvertTextType(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), SCH_EDIT_FRAME::OnDragItem(), SCH_EDIT_FRAME::OnEditItem(), LIB_EDIT_FRAME::OnEditPin(), FOOTPRINT_EDIT_FRAME::OnHotKey(), SCH_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(), SCH_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), FOOTPRINT_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnMoveItem(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick(), TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick(), SCH_EDIT_FRAME::OnOpenLibraryEditor(), SCH_EDIT_FRAME::OnOrient(), FOOTPRINT_EDIT_FRAME::OnRightClick(), GERBVIEW_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRightClick(), PCB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRotate(), SCH_EDIT_FRAME::OnSelectUnit(), PCB_EDIT_FRAME::PlaceTarget(), FOOTPRINT_EDIT_FRAME::PrepareItemForHotkey(), LIB_EDIT_FRAME::Process_Special_Functions(), EDIT_TOOL::Properties(), PCB_BASE_FRAME::Rotate_Module(), PCB_EDIT_FRAME::Rotate_Texte_Pcb(), SCH_EDIT_FRAME::RotateField(), SCH_EDIT_FRAME::RotateHierarchicalSheet(), SCH_EDIT_FRAME::RotateImage(), PCB_BASE_FRAME::RotateTextModule(), SCH_EDIT_FRAME::SaveCopyInUndoList(), SCH_SCREEN::SelectBlockItems(), SCH_EDIT_FRAME::SetBusEntryShape(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp(), Show_Drag_Track_Segment_With_Cte_Slope(), Show_MoveNode(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), DIALOG_LABEL_EDITOR::TextPropertiesAccept(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow(), and DIALOG_MODULE_BOARD_EDITOR::TransferDataFromWindow().

255 { return m_Flags; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
MODULE * BOARD::GetFootprint ( const wxPoint aPosition,
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 2148 of file class_board.cpp.

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, MODULE::Next(), wxPoint::x, and wxPoint::y.

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

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

Definition at line 339 of file class_board.h.

References BOARD_DESIGN_SETTINGS::m_GridOrigin.

Referenced by PCB_BASE_FRAME::GetGridOrigin(), and PCB_BASE_EDIT_FRAME::SetBoard().

339 { return m_designSettings.m_GridOrigin; }
wxPoint m_GridOrigin
origin for grid offsets
BOARD_DESIGN_SETTINGS m_designSettings
Definition: class_board.h:191
int BOARD::GetHighLightNetCode ( ) const
inline

Function GetHighLightNetCode.

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

Definition at line 355 of file class_board.h.

References HIGH_LIGHT_INFO::m_netCode.

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

355 { return m_highLight.m_netCode; }
HIGH_LIGHT_INFO m_highLight
Definition: class_board.h:183
LAYER_ID BOARD_ITEM::GetLayer ( ) const
inlineinherited

Function GetLayer returns the primary layer this item is on.

Definition at line 132 of file class_board_item.h.

References BOARD_ITEM::m_Layer.

Referenced by Abort_MoveOrCopyModule(), DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), CINFO3D_VISU::AddGraphicsShapesWithClearanceToContainer(), DIMENSION::AdjustDimensionDetails(), PCB_EDIT_FRAME::Begin_DrawSegment(), PCB_EDIT_FRAME::Begin_Zone(), GRID_HELPER::BestSnapAnchor(), PCB_EDIT_FRAME::Block_SelectItems(), ZONE_CONTAINER::buildFeatureHoleList(), BuildUnconnectedThermalStubsPolygonList(), PCB_EDIT_FRAME::Change_Side_Module(), checkConnectedTo(), CombineAllAreasInNet(), ConvertBrdLayerToPolygonalContours(), MODULE::CopyNetlistSettings(), CreateBoardSection(), CINFO3D_VISU::createLayers(), MWAVE::CreateMicrowaveInductor(), CreateRoutesSection(), DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DRC::doEdgeZoneDrc(), PCB_EDIT_FRAME::DoGenFootprintsPositionFile(), DRC::doTrackKeepoutDrc(), TEXTE_MODULE::Draw(), DRAWSEGMENT::Draw(), KIGFX::PCB_PAINTER::draw(), PCB_EDIT_FRAME::duplicateZone(), FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer(), PCB_EDIT_FRAME::Edit_Zone_Params(), PCB_EDIT_FRAME::End_Zone(), export_vrml_drawsegment(), export_vrml_edge_module(), export_vrml_module(), export_vrml_pcbtext(), export_vrml_text_module(), export_vrml_zones(), PCB_EDIT_FRAME::ExportToGenCAD(), TEXTE_PCB::Flip(), PCB_TARGET::Flip(), EDGE_MODULE::Flip(), TEXTE_MODULE::Flip(), TRACK::Flip(), MODULE::Flip(), DIMENSION::Flip(), DRAWSEGMENT::Flip(), ZONE_CONTAINER::Flip(), PCB_IO::FootprintSave(), FootprintWriteShape(), PCB_IO::formatLayer(), DSN::SPECCTRA_DB::FromBOARD(), genModuleOnRoutingMatrix(), genPlacementRoutingMatrix(), GetFootprint(), getOptimalModulePlacement(), GetPad(), GetVisibleTrack(), SELECTION_TOOL::guessSelectionCandidates(), ZONE_CONTAINER::Hatch(), HitTestForAnyFilledArea(), idf_export_module(), DIALOG_NON_COPPER_ZONES_EDITOR::Init(), DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties(), GENERAL_COLLECTOR::Inspect(), D_PAD::IsFlipped(), MODULE::IsFlipped(), ZONE_CONTAINER::IsOnCopperLayer(), ZONE_CONTAINER::IsSame(), itemIsIncludedByFilter(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), MarkTrace(), NormalizeAreaPolygon(), OnAreaPolygonModified(), PCB_EDIT_FRAME::OnRightClick(), ZONE_SETTINGS::operator<<(), PlaceCells(), 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::PlotFilledAreas(), BRDITEMS_PLOTTER::PlotPcbTarget(), PlotSilkScreen(), PlotSolderMaskLayer(), PlotStandardLayer(), BRDITEMS_PLOTTER::PlotTextePcb(), Print_Module(), PCB_EDIT_FRAME::PrintPage(), RedrawAreasOutlines(), RedrawFilledAreas(), TRACKS_CLEANER::remove_duplicates_of_track(), PCB_EDIT_FRAME::Remove_Zone_Corner(), SaveCopyOfZones(), SELECTION_TOOL::selectable(), ShowClearance(), PCB_EDIT_FRAME::Start_Move_Zone_Corner(), PCB_EDIT_FRAME::Start_Move_Zone_Drag_Outline_Edge(), PCB_EDIT_FRAME::Start_Move_Zone_Outlines(), PCB_EDIT_FRAME::Swap_Layers(), PNS_KICAD_IFACE::syncTrack(), Test_Connections_To_Copper_Areas(), Test_Drc_Areas_Outlines_To_Areas_Outlines(), TestAreaIntersection(), TestAreaIntersections(), ZONE_CONTAINER::TestForCopperIslandAndRemoveInsulatedIslands(), DRC::testKeepoutAreas(), TEXTE_MODULE::TEXTE_MODULE(), TraceSegmentPcb(), TrackListSortByNetcode(), DialogEditModuleText::TransferDataFromWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), DIALOG_MODULE_BOARD_EDITOR::TransferDataFromWindow(), DialogEditModuleText::TransferDataToWindow(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::TransferDataToWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow(), CINFO3D_VISU::transformGraphicModuleEdgeToPolygonSet(), MODULE::TransformGraphicShapesWithClearanceToPolygonSet(), MODULE::TransformGraphicTextWithClearanceToPolygonSet(), TstModuleOnBoard(), TEXTE_MODULE::ViewGetLayers(), TRACK::ViewGetLayers(), TRACKS_CLEANER::zoneForTrackEndpoint(), and PCB_EDITOR_CONTROL::ZoneMerge().

132 { return m_Layer; }
LAYER_ID m_Layer
const 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
LAYER_ID - the layer id, which for copper layers may be custom, else standard.

Definition at line 519 of file class_board.cpp.

References GetStandardLayerName(), IsCopperLayer(), LAYER_ID_COUNT, m_Layer, ToLAYER_ID(), and UNDEFINED_LAYER.

520 {
521 
522  // Look for the BOARD specific copper layer names
523  for( LAYER_NUM layer = 0; layer < LAYER_ID_COUNT; ++layer )
524  {
525  if ( IsCopperLayer( layer ) && ( m_Layer[ layer ].m_name == aLayerName ) )
526  {
527  return ToLAYER_ID( layer );
528  }
529  }
530 
531  // Otherwise fall back to the system standard layer names
532  for( LAYER_NUM layer = 0; layer < LAYER_ID_COUNT; ++layer )
533  {
534  if( GetStandardLayerName( ToLAYER_ID( layer ) ) == aLayerName )
535  {
536  return ToLAYER_ID( layer );
537  }
538  }
539 
540  return UNDEFINED_LAYER;
541 }
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:766
static wxString GetStandardLayerName(LAYER_ID aLayerId)
Function GetStandardLayerName returns an "English Standard" name of a PCB layer when given aLayerNumb...
Definition: class_board.h:646
LAYER m_Layer[LAYER_ID_COUNT]
Definition: class_board.h:180
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
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 77 of file class_board_item.cpp.

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

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

78 {
79  BOARD* board = GetBoard();
80 
81  if( board )
82  return board->GetLayerName( m_Layer );
83 
84  // If no parent, return standard name
86 }
const wxString GetLayerName(LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer given by aLayer.
LAYER_ID m_Layer
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:166
static wxString GetStandardLayerName(LAYER_ID aLayerId)
Function GetStandardLayerName returns an "English Standard" name of a PCB layer when given aLayerNumb...
Definition: class_board.h:646
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
wxString BOARD::GetLayerName ( 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 543 of file class_board.cpp.

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

Referenced by DSN::SPECCTRA_DB::buildLayerMaps(), EVT_COMMAND_RANGE(), EXCELLON_WRITER::GenDrillReportFile(), PCB_LAYER_SELECTOR::GetLayerName(), PCB_LAYER_BOX_SELECTOR::GetLayerName(), BOARD_ITEM::GetLayerName(), TRACK::GetMsgPanelInfoBase(), SEGZONE::GetMsgPanelInfoBase(), VIA::GetMsgPanelInfoBase(), VIA::GetSelectMenuText(), DIALOG_NON_COPPER_ZONES_EDITOR::Init(), DIALOG_PLOT::Init_Dialog(), DIALOG_SVG_PRINT::initDialog(), DIALOG_KEEPOUT_AREA_PROPERTIES::initDialog(), DIALOG_COPPER_ZONE::initDialog(), DIALOG_PAD_PROPERTIES::initValues(), DIALOG_PRINT_USING_PRINTER::initValues(), LayerMaskDescribe(), DIALOG_PLOT::Plot(), PCB_LAYER_WIDGET::ReFill(), SWAP_LAYERS_DIALOG::Sel_Layer(), DIALOG_GLOBAL_DELETION::SetCurrentLayer(), and DIALOG_LAYERS_SETUP::showBoardLayerNames().

544 {
545  // All layer names are stored in the BOARD.
546  if( IsLayerEnabled( aLayer ) )
547  {
548  // Standard names were set in BOARD::BOARD() but they may be
549  // over-ridden by BOARD::SetLayerName().
550  // For copper layers, return the actual copper layer name,
551  // otherwise return the Standard English layer name.
552  if( IsCopperLayer( aLayer ) )
553  return m_Layer[aLayer].m_name;
554  }
555 
556  return GetStandardLayerName( aLayer );
557 }
wxString m_name
The name of the layer, there should be no spaces in this name.
Definition: class_board.h:108
bool IsLayerEnabled(LAYER_ID aLayer) const
Function IsLayerEnabled is a proxy function that calls the correspondent function in m_BoardSettings ...
Definition: class_board.h:428
static wxString GetStandardLayerName(LAYER_ID aLayerId)
Function GetStandardLayerName returns an "English Standard" name of a PCB layer when given aLayerNumb...
Definition: class_board.h:646
LAYER m_Layer[LAYER_ID_COUNT]
Definition: class_board.h:180
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
virtual LSET BOARD_ITEM::GetLayerSet ( ) const
inlinevirtualinherited

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

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

Reimplemented in VIA, and D_PAD.

Definition at line 140 of file class_board_item.h.

Referenced by build_pad_testpoints(), chainMarkedSegments(), Collect_TrackSegmentsToDrag(), DRC::doTrackDrc(), PCB_EDIT_FRAME::EraseRedundantTrack(), find_vias_and_tracks_at(), TRACK::GetEndSegments(), TRACK::GetTrack(), MarkTrace(), PCB_EDIT_FRAME::PrintPage(), RN_NET::processZones(), CONNECTIONS::SearchConnectedTracks(), CONNECTIONS::SearchTracksConnectedToPads(), and PCB_EDIT_FRAME::StartMoveOneNodeOrSegment().

140 { return LSET( m_Layer ); }
LAYER_ID m_Layer
Class LSET is a set of LAYER_IDs.
LAYER_T BOARD::GetLayerType ( 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 605 of file class_board.cpp.

References IsCopperLayer(), IsLayerEnabled(), LT_SIGNAL, m_Layer, and LAYER::m_type.

Referenced by GetGerberFileFunctionAttribute(), and DIALOG_LAYERS_SETUP::showLayerTypes().

606 {
607  if( !IsCopperLayer( aLayer ) )
608  return LT_SIGNAL;
609 
610  //@@IMB: The original test was broken due to the discontinuity
611  // in the layer sequence.
612  if( IsLayerEnabled( aLayer ) )
613  return m_Layer[aLayer].m_type;
614 
615  return LT_SIGNAL;
616 }
LAYER_T m_type
The type of the layer.
Definition: class_board.h:110
bool IsLayerEnabled(LAYER_ID aLayer) const
Function IsLayerEnabled is a proxy function that calls the correspondent function in m_BoardSettings ...
Definition: class_board.h:428
LAYER m_Layer[LAYER_ID_COUNT]
Definition: class_board.h:180
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
DHEAD* EDA_ITEM::GetList ( ) const
inlineinherited

Definition at line 209 of file base_struct.h.

References EDA_ITEM::m_List.

Referenced by CreateLockPoint(), BOARD_ITEM::DeleteStructure(), DHEAD::insert(), MarkTrace(), DHEAD::remove(), BOARD_ITEM::UnLink(), and GERBER_DRAW_ITEM::UnLink().

209 { return m_List; }
DHEAD * m_List
which DLIST I am on.
Definition: base_struct.h:166
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 2217 of file class_board.cpp.

References GetTrack(), GetVisibleTrack(), m_Modules, m_Track, and MODULE::Next().

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

2218 {
2219  for( MODULE* module = m_Modules; module; module = module->Next() )
2220  {
2221  D_PAD* pad = module->GetPad( aPosition, aLayerSet );
2222 
2223  if( pad )
2224  return pad;
2225  }
2226 
2227  // No pad has been located so check for a segment of the trace.
2228  TRACK* segment = ::GetTrack( m_Track, NULL, aPosition, aLayerSet );
2229 
2230  if( !segment )
2231  segment = GetVisibleTrack( m_Track, aPosition, aLayerSet );
2232 
2233  return segment;
2234 }
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
MODULE * Next() const
Definition: class_module.h:99
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:243
DLIST< TRACK > m_Track
Definition: class_board.h:244
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 310 of file class_board.h.

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

311  {
312  if( (unsigned) index < m_markers.size() )
313  return m_markers[index];
314 
315  return NULL;
316  }
MARKERS m_markers
MARKER_PCBs for clearance problems, owned by pointer.
Definition: class_board.h:175
int BOARD::GetMARKERCount ( ) const
inline

Function GetMARKERCount.

Returns
int - The number of MARKER_PCBS.

Definition at line 322 of file class_board.h.

Referenced by DRC_LIST_MARKERS::GetCount().

323  {
324  return (int) m_markers.size();
325  }
MARKERS m_markers
MARKER_PCBs for clearance problems, owned by pointer.
Definition: class_board.h:175
BITMAP_DEF EDA_ITEM::GetMenuImage ( ) const
virtualinherited

Function GetMenuImage returns a pointer to an image to be used in menus.

The default version returns the right arrow image. Override this function to provide object specific menu images.

Returns
The menu image associated with the item.

Reimplemented in ZONE_CONTAINER, SCH_SHEET, MODULE, SCH_COMPONENT, D_PAD, LIB_PIN, VIA, SEGZONE, SCH_HIERLABEL, SCH_GLOBALLABEL, TRACK, SCH_LABEL, DRAWSEGMENT, LIB_FIELD, DIMENSION, SCH_SHEET_PIN, TEXTE_MODULE, SCH_TEXT, SCH_FIELD, LIB_ARC, TEXTE_PCB, SCH_BITMAP, LIB_TEXT, SCH_LINE, EDGE_MODULE, LIB_POLYLINE, SCH_BUS_ENTRY_BASE, MARKER_PCB, LIB_RECTANGLE, LIB_CIRCLE, PCB_TARGET, SCH_MARKER, SCH_NO_CONNECT, and SCH_JUNCTION.

Definition at line 282 of file base_struct.cpp.

References dummy_xpm.

Referenced by FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay(), and PCB_BASE_FRAME::PcbGeneralLocateAndDisplay().

283 {
284  return dummy_xpm;
285 }
static const BITMAP_OPAQUE dummy_xpm[1]
Definition: base_struct.cpp:56
void BOARD::GetMsgPanelInfo ( 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 1131 of file class_board.cpp.

References BLUE, DARKCYAN, DARKGREEN, NETINFO_LIST::GetNetCount(), GetNodesCount(), GetPadCount(), GetRatsnestsCount(), GetUnconnectedNetCount(), m_NetInfo, m_Status_Pcb, m_Track, NET_CODES_OK, TRACK::Next(), PCB_VIA_T, and RED.

Referenced by PCB_BASE_FRAME::UpdateMsgPanel().

1132 {
1133  wxString txt;
1134  int viasCount = 0;
1135  int trackSegmentsCount = 0;
1136 
1137  for( BOARD_ITEM* item = m_Track; item; item = item->Next() )
1138  {
1139  if( item->Type() == PCB_VIA_T )
1140  viasCount++;
1141  else
1142  trackSegmentsCount++;
1143  }
1144 
1145  txt.Printf( wxT( "%d" ), GetPadCount() );
1146  aList.push_back( MSG_PANEL_ITEM( _( "Pads" ), txt, DARKGREEN ) );
1147 
1148  txt.Printf( wxT( "%d" ), viasCount );
1149  aList.push_back( MSG_PANEL_ITEM( _( "Vias" ), txt, DARKGREEN ) );
1150 
1151  txt.Printf( wxT( "%d" ), trackSegmentsCount );
1152  aList.push_back( MSG_PANEL_ITEM( _( "Track Segments" ), txt, DARKGREEN ) );
1153 
1154  txt.Printf( wxT( "%d" ), GetNodesCount() );
1155  aList.push_back( MSG_PANEL_ITEM( _( "Nodes" ), txt, DARKCYAN ) );
1156 
1157  txt.Printf( wxT( "%d" ), m_NetInfo.GetNetCount() );
1158  aList.push_back( MSG_PANEL_ITEM( _( "Nets" ), txt, RED ) );
1159 
1160  /* These parameters are known only if the full ratsnest is available,
1161  * so, display them only if this is the case
1162  */
1163  if( (m_Status_Pcb & NET_CODES_OK) )
1164  {
1165  txt.Printf( wxT( "%d" ), GetRatsnestsCount() );
1166  aList.push_back( MSG_PANEL_ITEM( _( "Links" ), txt, DARKGREEN ) );
1167 
1168  txt.Printf( wxT( "%d" ), GetRatsnestsCount() - GetUnconnectedNetCount() );
1169  aList.push_back( MSG_PANEL_ITEM( _( "Connections" ), txt, DARKGREEN ) );
1170 
1171  txt.Printf( wxT( "%d" ), GetUnconnectedNetCount() );
1172  aList.push_back( MSG_PANEL_ITEM( _( "Unconnected" ), txt, BLUE ) );
1173  }
1174 }
Definition: colors.h:57
unsigned GetUnconnectedNetCount() const
Function GetUnconnectedNetCount.
Definition: class_board.h:727
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
unsigned GetNetCount() const
Function GetNetCount.
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:188
unsigned GetRatsnestsCount() const
Function GetNumRatsnests.
Definition: class_board.h:704
Definition: colors.h:60
unsigned GetPadCount() const
Function GetPadCount.
Definition: class_board.h:741
TRACK * Next() const
Definition: class_track.h:97
unsigned GetNodesCount() const
Function GetNodesCount.
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:108
DLIST< TRACK > m_Track
Definition: class_board.h:244
Class EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:240
NETINFO_LIST& BOARD::GetNetInfo ( )
inline

Definition at line 785 of file class_board.h.

Referenced by DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildNetsList(), DIALOG_SELECT_NET_FROM_LIST::buildNetsList(), and TestForExistingItem().

786  {
787  return m_NetInfo;
788  }
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:188
int BOARD_ITEM::getNextNumberInSequence ( const std::set< int > &  aSeq,
bool  aFillSequenceGaps 
)
staticprotectedinherited

Definition at line 223 of file class_board_item.cpp.

Referenced by MODULE::GetNextPadName().

224 {
225  if( aSeq.empty() )
226  return 1;
227 
228  // By default go to the end of the sequence
229  int candidate = *aSeq.rbegin();
230 
231  // Filling in gaps in pad numbering
232  if( aFillSequenceGaps )
233  {
234  // start at the beginning
235  candidate = *aSeq.begin();
236 
237  for( auto it : aSeq )
238  {
239  if( it - candidate > 1 )
240  break;
241 
242  candidate = it;
243  }
244  }
245 
246  ++candidate;
247 
248  return candidate;
249 }
unsigned BOARD::GetNodesCount ( ) const

Function GetNodesCount.

Returns
the number of pads members of nets (i.e. with netcode > 0)

Definition at line 1051 of file class_board.cpp.

References m_nodeCount.

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

1052 {
1053  return m_nodeCount;
1054 }
int m_nodeCount
Number of pads connected to the current net.
Definition: class_board.h:199
int BOARD::GetNumSegmTrack ( ) const

Functions to get some items count.

Definition at line 1039 of file class_board.cpp.

References DHEAD::GetCount(), and m_Track.

1040 {
1041  return m_Track.GetCount();
1042 }
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:244
int BOARD::GetNumSegmZone ( ) const

Calculate the zone segment count.

Definition at line 1045 of file class_board.cpp.

References DHEAD::GetCount(), and m_Zone.

1046 {
1047  return m_Zone.GetCount();
1048 }
DLIST< SEGZONE > m_Zone
Definition: class_board.h:245
unsigned GetCount() const
Function GetCount returns the number of elements in the list.
Definition: dlist.h:126
D_PAD* BOARD::GetPad ( unsigned  aIndex) const
inline

Function GetPad.

Returns
D_PAD* - at the aIndex from m_NetInfo

Definition at line 750 of file class_board.h.

References NETINFO_LIST::GetPad().

Referenced by AddNewTrace(), Autoroute_One_Track(), PCB_EDIT_FRAME::Begin_Route(), PCB_BASE_FRAME::Build_Board_Ratsnest(), chainMarkedSegments(), CreateLockPoint(), DeleteNullTrackSegments(), DRC::doTrackDrc(), Magnetize(), MarkTrace(), PlaceCells(), PCB_BASE_FRAME::TestConnections(), and PCB_BASE_FRAME::TestNetConnection().

751  {
752  return m_NetInfo.GetPad( aIndex );
753  }
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:188
D_PAD * GetPad(unsigned aIdx) const
Function GetPad.
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 1585 of file class_board.cpp.

References LSET::AllCuMask(), m_Modules, and MODULE::Next().

1586 {
1587  if( !aLayerSet.any() )
1588  aLayerSet = LSET::AllCuMask();
1589 
1590  for( MODULE* module = m_Modules; module; module = module->Next() )
1591  {
1592  D_PAD* pad = module->GetPad( aPosition, aLayerSet );
1593 
1594  if( pad )
1595  return pad;
1596  }
1597 
1598  return NULL;
1599 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu LAYER_IDs.
Definition: lset.cpp:638
MODULE * Next() const
Definition: class_module.h:99
DLIST< MODULE > m_Modules
Definition: class_board.h:243
D_PAD* BOARD::GetPad ( const wxPoint aPosition)
inline

Definition at line 1204 of file class_board.h.

1205  {
1206  return GetPad( aPosition, LSET().set() );
1207  }
Class LSET is a set of LAYER_IDs.
D_PAD * GetPad(unsigned aIndex) const
Function GetPad.
Definition: class_board.h:750
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 1602 of file class_board.cpp.

References TRACK::GetEndPoint(), BOARD_ITEM::GetLayer(), m_Modules, and MODULE::Next().

1603 {
1604  const wxPoint& aPosition = aTrace->GetEndPoint( aEndPoint );
1605 
1606  LSET lset( aTrace->GetLayer() );
1607 
1608  for( MODULE* module = m_Modules; module; module = module->Next() )
1609  {
1610  D_PAD* pad = module->GetPad( aPosition, lset );
1611 
1612  if( pad )
1613  return pad;
1614  }
1615 
1616  return NULL;
1617 }
MODULE * Next() const
Definition: class_module.h:99
LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
Class LSET is a set of LAYER_IDs.
const wxPoint & GetEndPoint(ENDPOINT_T aEndPoint) const
Return the selected endpoint (start or end)
Definition: class_track.h:124
DLIST< MODULE > m_Modules
Definition: class_board.h:243
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 1638 of file class_board.cpp.

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

1639 {
1640  // Search aPadList for aPosition
1641  // aPadList is sorted by X then Y values, and a fast binary search is used
1642  int idxmax = aPadList.size()-1;
1643 
1644  int delta = aPadList.size();
1645 
1646  int idx = 0; // Starting index is the beginning of list
1647 
1648  while( delta )
1649  {
1650  // Calculate half size of remaining interval to test.
1651  // Ensure the computed value is not truncated (too small)
1652  if( (delta & 1) && ( delta > 1 ) )
1653  delta++;
1654 
1655  delta /= 2;
1656 
1657  D_PAD* pad = aPadList[idx];
1658 
1659  if( pad->GetPosition() == aPosition ) // candidate found
1660  {
1661  // The pad must match the layer mask:
1662  if( ( aLayerSet & pad->GetLayerSet() ).any() )
1663  return pad;
1664 
1665  // More than one pad can be at aPosition
1666  // search for a pad at aPosition that matched this mask
1667 
1668  // search next
1669  for( int ii = idx+1; ii <= idxmax; ii++ )
1670  {
1671  pad = aPadList[ii];
1672 
1673  if( pad->GetPosition() != aPosition )
1674  break;
1675 
1676  if( ( aLayerSet & pad->GetLayerSet() ).any() )
1677  return pad;
1678  }
1679  // search previous
1680  for( int ii = idx-1 ;ii >=0; ii-- )
1681  {
1682  pad = aPadList[ii];
1683 
1684  if( pad->GetPosition() != aPosition )
1685  break;
1686 
1687  if( ( aLayerSet & pad->GetLayerSet() ).any() )
1688  return pad;
1689  }
1690 
1691  // Not found:
1692  return 0;
1693  }
1694 
1695  if( pad->GetPosition().x == aPosition.x ) // Must search considering Y coordinate
1696  {
1697  if( pad->GetPosition().y < aPosition.y ) // Must search after this item
1698  {
1699  idx += delta;
1700 
1701  if( idx > idxmax )
1702  idx = idxmax;
1703  }
1704  else // Must search before this item
1705  {
1706  idx -= delta;
1707 
1708  if( idx < 0 )
1709  idx = 0;
1710  }
1711  }
1712  else if( pad->GetPosition().x < aPosition.x ) // Must search after this item
1713  {
1714  idx += delta;
1715 
1716  if( idx > idxmax )
1717  idx = idxmax;
1718  }
1719  else // Must search before this item
1720  {
1721  idx -= delta;
1722 
1723  if( idx < 0 )
1724  idx = 0;
1725  }
1726  }
1727 
1728  return NULL;
1729 }
static const int delta[8][2]
Definition: solve.cpp:112
const wxPoint & GetPosition() const override
Definition: class_pad.h:170
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:235
unsigned BOARD::GetPadCount ( ) const
inline
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 1620 of file class_board.cpp.

References D_PAD::GetLayerSet(), NETINFO_LIST::GetPad(), GetPadCount(), D_PAD::GetPosition(), and m_NetInfo.

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

1621 {
1622  for( unsigned i=0; i<GetPadCount(); ++i )
1623  {
1624  D_PAD* pad = m_NetInfo.GetPad(i);
1625 
1626  if( pad->GetPosition() != aPosition )
1627  continue;
1628 
1629  // Pad found, it must be on the correct layer
1630  if( ( pad->GetLayerSet() & aLayerSet ).any() )
1631  return pad;
1632  }
1633 
1634  return NULL;
1635 }
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:188
const wxPoint & GetPosition() const override
Definition: class_pad.h:170
D_PAD * GetPad(unsigned aIdx) const
Function GetPad.
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:235
unsigned GetPadCount() const
Function GetPadCount.
Definition: class_board.h:741
const D_PADS& BOARD::GetPads ( )
inline

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

References NETINFO_LIST::m_PadsFullList.

Referenced by CreatePadsShapesSection(), BOARD_NETLIST_UPDATER::deleteSinglePadNets(), ReplaceNetlist(), and DRC::testTexts().

762 { return m_NetInfo.m_PadsFullList; }
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:188
D_PADS m_PadsFullList
contains all pads, sorted by pad's netname.
BOARD_ITEM_CONTAINER* BOARD_ITEM::GetParent ( void  ) const
inlineinherited

Definition at line 126 of file class_board_item.h.

References EDA_ITEM::m_Parent.

Referenced by Abort_Move_ModuleOutline(), AbortMoveTextModule(), POINT_EDITOR::addCorner(), PCB_EDIT_FRAME::createPopUpMenuForFpTexts(), FOOTPRINT_EDIT_FRAME::Delete_Edge_Module(), BOARD_ITEM::DeleteStructure(), PCB_BASE_FRAME::DeleteTextModule(), DialogEditModuleText::DialogEditModuleText(), KIGFX::PCB_PAINTER::draw(), TEXTE_MODULE::DrawUmbilical(), PCB_EDIT_FRAME::duplicateItems(), PCB_IO::format(), FormatProbeItem(), BOARD_ITEM::GetBoard(), LEGACY_ARRAY_CREATOR::getModule(), EDGE_MODULE::GetMsgPanelInfo(), EDGE_MODULE::GetSelectMenuText(), TEXTE_MODULE::GetSelectMenuText(), TEXTE_MODULE::GetShownText(), GENERAL_COLLECTOR::Inspect(), 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(), PAD_TOOL::pushPadSettings(), PCB_BASE_FRAME::ResetTextSize(), PCB_BASE_FRAME::RotateTextModule(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), SELECTION_TOOL::select(), ShowCurrentOutlineWhileMoving(), ShowNewEdgeModule(), and PCB_BASE_FRAME::StartMoveTexteModule().

126 { return (BOARD_ITEM_CONTAINER*) m_Parent; }
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:168
Abstract interface for BOARD_ITEMs capable of storing other items inside.
const PCB_PLOT_PARAMS& BOARD::GetPlotOptions ( ) const
inline

Definition at line 548 of file class_board.h.

Referenced by PCB_BASE_FRAME::GetPlotSettings().

548 { return m_plotOptions; }
PCB_PLOT_PARAMS m_plotOptions
Definition: class_board.h:196
const wxPoint & BOARD::GetPosition ( ) const
overridevirtual

Implements BOARD_ITEM.

Definition at line 134 of file class_board.cpp.

References BOARD_ITEM::ZeroOffset.

135 {
136  wxLogWarning( wxT( "This should not be called on the BOARD object") );
137 
138  return ZeroOffset;
139 }
static wxPoint ZeroOffset
A value of wxPoint(0,0) which can be passed to the Draw() functions.
unsigned BOARD::GetRatsnestsCount ( ) const
inline
wxString EDA_ITEM::GetSelectMenuText ( ) const
virtualinherited

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

Definition at line 175 of file base_struct.cpp.

References EDA_ITEM::GetClass().

Referenced by SELECTION_TOOL::disambiguationMenu(), DRC::fillMarker(), SCH_FIND_COLLECTOR::GetText(), FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay(), and PCB_BASE_FRAME::PcbGeneralLocateAndDisplay().

176 {
177  wxFAIL_MSG( wxT( "GetSelectMenuText() was not overridden for schematic item type " ) +
178  GetClass() );
179 
180  return wxString( wxT( "Undefined menu text for " ) + GetClass() );
181 }
virtual wxString GetClass() const =0
Function GetClass returns the class name.
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 1745 of file class_board.cpp.

References NETINFO_LIST::GetNetItem(), m_NetInfo, NETINFO_ITEM::m_PadInNetList, NETINFO_LIST::m_PadsFullList, and sortPadsByXthenYCoord().

Referenced by CONNECTIONS::BuildPadsList(), and DRC::testPad2Pad().

1746 {
1747  if( aNetCode < 0 )
1748  {
1749  aVector.insert( aVector.end(), m_NetInfo.m_PadsFullList.begin(),
1750  m_NetInfo.m_PadsFullList.end() );
1751  }
1752  else
1753  {
1754  const NETINFO_ITEM* net = m_NetInfo.GetNetItem( aNetCode );
1755  if( net )
1756  {
1757  aVector.insert( aVector.end(), net->m_PadInNetList.begin(),
1758  net->m_PadInNetList.end() );
1759  }
1760  }
1761 
1762  sort( aVector.begin(), aVector.end(), sortPadsByXthenYCoord );
1763 }
NETINFO_ITEM * GetNetItem(int aNetCode) const
Function GetItem.
NETINFO_LIST m_NetInfo
net info list (name, design constraints ..
Definition: class_board.h:188
D_PADS m_PadInNetList
List of pads connected to this net.
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...
Class NETINFO_ITEM handles the data for a net.
D_PADS m_PadsFullList
contains all pads, sorted by pad's netname.
static wxString BOARD::GetStandardLayerName ( 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 646 of file class_board.h.

References LSET::Name().

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

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

Definition at line 250 of file base_struct.h.

References EDA_ITEM::m_Status.

250 { return m_Status; }
STATUS_FLAGS m_Status
Definition: base_struct.h:161
TITLE_BLOCK& BOARD::GetTitleBlock ( )
inline

Definition at line 551 of file class_board.h.

Referenced by PCB_BASE_FRAME::GetTitleBlock(), and StartPlotBoard().

551 { return m_titles; }
TITLE_BLOCK m_titles
text in lower right of screen and plots
Definition: class_board.h:195
int BOARD_ITEM::getTrailingInt ( wxString  aStr)
staticprotectedinherited

Definition at line 200 of file class_board_item.cpp.

Referenced by MODULE::GetNextPadName().

201 {
202  int number = 0;
203  int base = 1;
204 
205  // Trim and extract the trailing numeric part
206  int index = aStr.Len() - 1;
207  while( index >= 0 )
208  {
209  const char chr = aStr.GetChar( index );
210 
211  if( chr < '0' || chr > '9' )
212  break;
213 
214  number += ( chr - '0' ) * base;
215  base *= 10;
216  index--;
217  }
218 
219  return number;
220 }
unsigned BOARD::GetUnconnectedNetCount ( ) const
inline

Function GetUnconnectedNetCount.

Returns
the number of unconnected nets in the current rats nest.

Definition at line 727 of file class_board.h.

Referenced by GetMsgPanelInfo(), PCB_EDIT_FRAME::Solve(), and PCB_BASE_FRAME::TestNetConnection().

727 { return m_unconnectedNetCount; }
int m_unconnectedNetCount
Number of unconnected nets in the current rats nest.
Definition: class_board.h:202
VIA * BOARD::GetViaByPosition ( const wxPoint aPosition,
LAYER_ID  aLayer = 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 (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 1571 of file class_board.cpp.

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

1572 {
1573  for( VIA *via = GetFirstVia( m_Track); via; via = GetFirstVia( via->Next() ) )
1574  {
1575  if( (via->GetStart() == aPosition) &&
1576  (via->GetState( BUSY | IS_DELETED ) == 0) &&
1577  ((aLayer == UNDEFINED_LAYER) || (via->IsOnLayer( aLayer ))) )
1578  return via;
1579  }
1580 
1581  return NULL;
1582 }
#define BUSY
Pcbnew: flag indicating that the structure has.
Definition: base_struct.h:134
#define IS_DELETED
Definition: base_struct.h:116
DLIST< TRACK > m_Track
Definition: class_board.h:244
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:493
COLOR4D BOARD::GetVisibleElementColor ( int  aPCB_VISIBLE)

Function GetVisibleElementColor returns the color of a pcb visible element.

See also
enum PCB_VISIBLE

Definition at line 780 of file class_board.cpp.

References ANCHOR_VISIBLE, GetColorsSettings(), COLORS_DESIGN_SETTINGS::GetItemColor(), GRID_VISIBLE, MOD_TEXT_BK_VISIBLE, MOD_TEXT_FR_VISIBLE, MOD_TEXT_INVISIBLE, NON_PLATED_VISIBLE, PAD_BK_VISIBLE, PAD_FR_VISIBLE, RATSNEST_VISIBLE, VIA_BBLIND_VISIBLE, VIA_MICROVIA_VISIBLE, and VIA_THROUGH_VISIBLE.

Referenced by TEXTE_PCB::Draw(), TEXTE_MODULE::Draw(), D_PAD::Draw(), VIA::Draw(), PCB_EDIT_FRAME::GetGridColor(), DIALOG_PAD_PROPERTIES::OnPaintShowPanel(), PlotStandardLayer(), PCB_EDIT_FRAME::PrepareLayerIndicator(), and PCB_LAYER_WIDGET::ReFillRender().

781 {
782  COLOR4D color = COLOR4D::UNSPECIFIED;
783 
784  switch( aPCB_VISIBLE )
785  {
786  case NON_PLATED_VISIBLE:
787  case VIA_THROUGH_VISIBLE:
789  case VIA_BBLIND_VISIBLE:
790  case MOD_TEXT_FR_VISIBLE:
791  case MOD_TEXT_BK_VISIBLE:
792  case MOD_TEXT_INVISIBLE:
793  case ANCHOR_VISIBLE:
794  case PAD_FR_VISIBLE:
795  case PAD_BK_VISIBLE:
796  case RATSNEST_VISIBLE:
797  case GRID_VISIBLE:
798  color = GetColorsSettings()->GetItemColor( aPCB_VISIBLE );
799  break;
800 
801  default:
802  wxLogDebug( wxT( "BOARD::GetVisibleElementColor(): bad arg %d" ), aPCB_VISIBLE );
803  }
804 
805  return color;
806 }
text marked as invisible
COLOR4D GetItemColor(int aItemIdx) const
Function GetItemColor.
COLORS_DESIGN_SETTINGS * GetColorsSettings() const
Function GetColorSettings.
Definition: class_board.h:561
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
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 PCB_VISIBLE
See also
enum PCB_VISIBLE

Definition at line 739 of file class_board.cpp.

References BOARD_DESIGN_SETTINGS::GetVisibleElements(), and m_designSettings.

740 {
742 }
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:191
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 697 of file class_board.cpp.

References BOARD_DESIGN_SETTINGS::GetVisibleLayers(), and m_designSettings.

Referenced by KIGFX::PCB_PAINTER::draw(), D_PAD::Draw(), VIA::Draw(), PCB_BASE_FRAME::GetCollectorsGuide(), PCB_LAYER_WIDGET::OnLayerVisible(), and PCB_LAYER_WIDGET::OnRenderEnable().

698 {
700 }
BOARD_DESIGN_SETTINGS m_designSettings
Definition: class_board.h:191
LSET GetVisibleLayers() const
Function GetVisibleLayers returns a bit-mask of all the layers that are visible.
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 1774 of file class_board.cpp.

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

Referenced by GetLockPoint(), and Magnetize().

1776 {
1777  for( TRACK* track = aStartingTrace; track; track = track->Next() )
1778  {
1779  LAYER_ID layer = track->GetLayer();
1780 
1781  if( track->GetState( BUSY | IS_DELETED ) )
1782  continue;
1783 
1784  // track's layer is not visible
1785  if( m_designSettings.IsLayerVisible( layer ) == false )
1786  continue;
1787 
1788  if( track->Type() == PCB_VIA_T ) // VIA encountered.
1789  {
1790  if( track->HitTest( aPosition ) )
1791  return track;
1792  }
1793  else
1794  {
1795  if( !aLayerSet[layer] )
1796  continue; // track's layer is not in aLayerSet
1797 
1798  if( track->HitTest( aPosition ) )
1799  return track;
1800  }
1801  }
1802 
1803  return NULL;
1804 }
#define BUSY
Pcbnew: flag indicating that the structure has.
Definition: base_struct.h:134
bool IsLayerVisible(LAYER_ID aLayerId) const
Function IsLayerVisible tests whether a given layer is visible.
#define IS_DELETED
Definition: base_struct.h:116
TRACK * Next() const
Definition: class_track.h:97
LAYER_ID
Enum LAYER_ID is the set of PCB layers.
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:108
BOARD_DESIGN_SETTINGS m_designSettings
Definition: class_board.h:191
const ZONE_SETTINGS& BOARD::GetZoneSettings ( ) const
inline

Definition at line 554 of file class_board.h.

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

554 { return m_zoneSettings; }
ZONE_SETTINGS m_zoneSettings
Definition: class_board.h:192
void BOARD::HighLightOFF ( )
inline

Function HighLightOFF Disable highlight.

Definition at line 376 of file class_board.h.

References HIGH_LIGHT_INFO::m_highLightOn.

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

376 { m_highLight.m_highLightOn = false; }
HIGH_LIGHT_INFO m_highLight
Definition: class_board.h:183
void BOARD::HighLightON ( )
inline

Function HighLightON Enable highlight.

if m_highLight_NetCode >= 0, this net will be highlighted

Definition at line 383 of file class_board.h.

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

383 { m_highLight.m_highLightOn = true; }
HIGH_LIGHT_INFO m_highLight
Definition: class_board.h:183
virtual bool BOARD_ITEM::HitTest ( const wxPoint aPosition) const
inlineoverridevirtualinherited

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

Parameters
aPositionA reference to a wxPoint object containing the coordinates to test.
Returns
True if aPosition is within or on the item bounding area.

Reimplemented from EDA_ITEM.

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

Definition at line 282 of file class_board_item.h.

References EDA_ITEM::HitTest().

Referenced by GENERAL_COLLECTOR::Inspect().

283  {
284  return EDA_ITEM::HitTest( aPosition );
285  }
virtual bool HitTest(const wxPoint &aPosition) const
Function HitTest tests if aPosition is contained within or on the bounding area of an item...
Definition: base_struct.h:288
virtual bool BOARD_ITEM::HitTest ( const EDA_RECT aRect,
bool  aContained = true,
int  aAccuracy = 0 
) const
inlinevirtualinherited

Function HitTest tests if the aRect intersects or contains this object (depending on aContained).

Parameters
aRectA reference to an EDA_RECT object containg the area to test.
aContainedTest if aRect contains this object completly.
aAccuracyIncrease the item bounding box by this amount.
Returns
bool - True if aRect contains this object completly or if aRect intersects the object and aContained is False, otherwise false.

Reimplemented in VIA, MODULE, ZONE_CONTAINER, TRACK, DIMENSION, DRAWSEGMENT, PCB_TARGET, and TEXTE_PCB.

Definition at line 297 of file class_board_item.h.

298  {
299  return false; // derived classes should override this function
300  }
ZONE_CONTAINER * BOARD::HitTestForAnyFilledArea ( const wxPoint aRefPos,
LAYER_ID  aStartLayer,
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 1503 of file class_board.cpp.

References BUSY, BOARD_ITEM::GetLayer(), BOARD_CONNECTED_ITEM::GetNetCode(), EDA_ITEM::GetState(), ZONE_CONTAINER::HitTestFilledArea(), and m_ZoneDescriptorList.

Referenced by PCB_EDIT_FRAME::Begin_Route(), and TRACKS_CLEANER::zoneForTrackEndpoint().

1505 {
1506  if( aEndLayer < 0 )
1507  aEndLayer = aStartLayer;
1508 
1509  if( aEndLayer < aStartLayer )
1510  std::swap( aEndLayer, aStartLayer );
1511 
1512  for( unsigned ia = 0; ia < m_ZoneDescriptorList.size(); ia++ )
1513  {
1515  LAYER_NUM layer = area->GetLayer();
1516 
1517  if( layer < aStartLayer || layer > aEndLayer )
1518  continue;
1519 
1520  // In locate functions we must skip tagged items with BUSY flag set.
1521  if( area->GetState( BUSY ) )
1522  continue;
1523 
1524  if( aNetCode >= 0 && area->GetNetCode() != aNetCode )
1525  continue;
1526 
1527  if( area->HitTestFilledArea( aRefPos ) )
1528  return area;
1529  }
1530 
1531  return NULL;
1532 }
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:78
#define BUSY
Pcbnew: flag indicating that the structure has.
Definition: base_struct.h:134
int GetState(int type) const
Definition: base_struct.h:237
LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
int GetNetCode() const
Function GetNetCode.
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:178
bool HitTestFilledArea(const wxPoint &aRefPos) const
Function HitTestFilledArea tests if the given wxPoint is within the bounds of a filled area of this z...
Definition: class_zone.cpp:623
ZONE_CONTAINER * BOARD::InsertArea ( int  netcode,
int  iarea,
LAYER_ID  layer,
int  x,
int  y,
int  hatch 
)

Function InsertArea add empty copper area to net, inserting after m_ZoneDescriptorList[iarea].

Returns
pointer to the new area

Definition at line 2351 of file class_board.cpp.

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

Referenced by AddArea().

2352 {
2353  ZONE_CONTAINER* new_area = new ZONE_CONTAINER( this );
2354 
2355  new_area->SetNetCode( netcode );
2356  new_area->SetLayer( layer );
2357  new_area->SetTimeStamp( GetNewTimeStamp() );
2358 
2359  if( iarea < (int) ( m_ZoneDescriptorList.size() - 1 ) )
2360  m_ZoneDescriptorList.insert( m_ZoneDescriptorList.begin() + iarea + 1, new_area );
2361  else
2362  m_ZoneDescriptorList.push_back( new_area );
2363 
2364  new_area->SetHatchStyle( (ZONE_CONTAINER::HATCH_STYLE) hatch );
2365  new_area->AppendCorner( wxPoint( x, y ) );
2366 
2367  return new_area;
2368 }
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:78
virtual void SetLayer(LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
time_t GetNewTimeStamp()
Definition: common.cpp:166
void SetTimeStamp(time_t aNewTimeStamp)
Definition: base_struct.h:203
void AppendCorner(wxPoint position, bool aAllowDuplication=false)
Function AppendCorner.
Definition: class_zone.h:546
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Function SetNetCode sets net using a net code.
HATCH_STYLE
Zone hatch styles.
Definition: class_zone.h:85
ZONE_CONTAINERS m_ZoneDescriptorList
edge zone descriptors, owned by pointer.
Definition: class_board.h:178
void SetHatchStyle(HATCH_STYLE aStyle)
Definition: class_zone.h:559
bool EDA_ITEM::IsBrightened ( ) const
inlineinherited

Definition at line 224 of file base_struct.h.

References BRIGHTENED.

Referenced by SELECTION_TOOL::disambiguationMenu().

224 { 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:175
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 114 of file class_board_item.h.

Referenced by RN_DATA::Add(), RN_DATA::AddBlocked(), RN_DATA::AddSimple(), and RN_DATA::Remove().

115  {
116  return false;
117  }
bool EDA_ITEM::IsDragging ( ) const
inlineinherited
bool BOARD::IsElementVisible ( int  aPCB_VISIBLE) const
bool BOARD::IsEmpty ( ) const
inline

Definition at line 263 of file class_board.h.

References DHEAD::GetCount().

Referenced by BOARD_NETLIST_UPDATER::estimateComponentInsertionPosition(), DIALOG_NETLIST::OnReadNetlistFileClick(), and ReplaceNetlist().

264  {
265  return m_Drawings.GetCount() == 0 && m_Modules.GetCount() == 0 &&
266  m_Track.GetCount() == 0 && m_Zone.GetCount() == 0;
267  }
DLIST< SEGZONE > m_Zone
Definition: class_board.h:245
DLIST< BOARD_ITEM > m_Drawings
Definition: class_board.h:242
DLIST< MODULE > m_Modules
Definition: class_board.h:243
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:244
bool EDA_ITEM::IsHighlighted ( ) const
inlineinherited

Definition at line 223 of file base_struct.h.

References HIGHLIGHTED.

223 { 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:175
bool BOARD::IsHighLightNetON ( ) const
inline

Function IsHighLightNetON.

Returns
true if a net is currently highlighted

Definition at line 370 of file class_board.h.

References HIGH_LIGHT_INFO::m_highLightOn.

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

370 { return m_highLight.m_highLightOn; }
HIGH_LIGHT_INFO m_highLight
Definition: class_board.h:183
bool BOARD::IsLayerEnabled ( 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 428 of file class_board.h.

References BOARD_DESIGN_SETTINGS::IsLayerEnabled().

Referenced by DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR(), GetLayerName(), GetLayerType(), PCB_LAYER_SELECTOR::IsLayerEnabled(), PCB_LAYER_BOX_SELECTOR::IsLayerEnabled(), DIALOG_DIMENSION_EDITOR::OnOKClick(), SetLayerName(), SetLayerType(), and DialogEditModuleText::TransferDataToWindow().

429  {
430  return m_designSettings.IsLayerEnabled( aLayer );
431  }
bool IsLayerEnabled(LAYER_ID aLayerId) const
Function IsLayerEnabled tests whether a given layer is enabled.
BOARD_DESIGN_SETTINGS m_designSettings
Definition: class_board.h:191
bool BOARD::IsLayerVisible ( 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 440 of file class_board.h.

References BOARD_DESIGN_SETTINGS::IsLayerVisible().

Referenced by PCB_EDIT_FRAME::Block_SelectItems(), TEXTE_PCB::Draw(), PCB_TARGET::Draw(), EDGE_MODULE::Draw(), ZONE_CONTAINER::Draw(), TEXTE_MODULE::Draw(), TRACK::Draw(), DRAWSEGMENT::Draw(), DIMENSION::Draw(), SEGZONE::Draw(), ZONE_CONTAINER::DrawFilledArea(), itemIsIncludedByFilter(), Magnetize(), SELECTION_TOOL::selectable(), PCB_DRAW_PANEL_GAL::SyncLayersVisibility(), and PCB_LAYER_WIDGET::SyncLayerVisibilities().

441  {
442  return m_designSettings.IsLayerVisible( aLayer );
443  }
bool IsLayerVisible(LAYER_ID aLayerId) const
Function IsLayerVisible tests whether a given layer is visible.
BOARD_DESIGN_SETTINGS m_designSettings
Definition: class_board.h:191
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 202 of file class_board_item.h.

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

203  {
204  // only MODULEs & TRACKs can be locked at this time.
205  return false;
206  }
bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 217 of file base_struct.h.

References IS_CHANGED.

Referenced by LIB_EDIT_FRAME::OnEditPin().

217 { return m_Flags & IS_CHANGED; }
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:109
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
bool BOARD::IsModuleLayerVisible ( LAYER_ID  layer)

Function IsModuleLayerVisible expects either of the two layers on which a module can reside, and returns whether that layer is visible.

Parameters
layerOne 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 846 of file class_board.cpp.

References B_Cu, F_Cu, IsElementVisible(), MOD_BK_VISIBLE, and MOD_FR_VISIBLE.

Referenced by PCB_EDIT_FRAME::Block_SelectItems(), and GetFootprint().

847 {
848  switch( layer )
849  {
850  case F_Cu:
852 
853  case B_Cu:
855 
856  default:
857  wxFAIL_MSG( wxT( "BOARD::IsModuleLayerVisible() param error: bad layer" ) );
858  return true;
859  }
860 }
show modules on front
PCB_VISIBLE
Enum PCB_VISIBLE is a set of visible PCB elements.
bool IsElementVisible(int aPCB_VISIBLE) const
Function IsElementVisible tests whether a given element category is visible.
bool EDA_ITEM::IsNew ( ) const
inlineinherited

Definition at line 216 of file base_struct.h.

References IS_NEW.

Referenced by Abort_Edit_Pcb_Text(), Abort_EditEdge(), Abort_Move_ModuleOutline(), Abort_MoveOrCopyModule(), Abort_Zone_Create_Outline(), AbortBuildDimension(), AbortMoveAndEditTarget(), abortMoveBitmap(), abortMoveItem(), AbortPinMove(), AbortSymbolTraceOn(), SCH_EDIT_FRAME::addCurrentItemToList(), SCH_EDIT_FRAME::addJunctionMenuEntries(), AddMenusForBus(), AddMenusForWire(), PCB_EDIT_FRAME::Delete_Segment(), PCB_EDIT_FRAME::Delete_Segment_Edge(), SCH_EDIT_FRAME::DeleteCurrentSegment(), LIB_ARC::drawEditGraphics(), LIB_ARC::drawGraphic(), DrawMovePin(), SCH_EDIT_FRAME::EditSheetPin(), LIB_PIN::EnableEditMode(), LIB_EDIT_FRAME::EndDrawGraphicItem(), SCH_EDIT_FRAME::EndSegment(), ExitSheet(), SCH_EDIT_FRAME::OnAutoplaceFields(), SCH_EDIT_FRAME::OnConvertTextType(), LIB_EDIT_FRAME::OnEditPin(), SCH_EDIT_FRAME::OnHotKey(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), FOOTPRINT_EDIT_FRAME::OnLeftDClick(), LIB_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), LIB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRotate(), PCB_EDIT_FRAME::Place_Texte_Pcb(), PCB_BASE_FRAME::PlaceModule(), LIB_EDIT_FRAME::PlacePin(), PCB_EDIT_FRAME::PlaceTarget(), SCH_EDIT_FRAME::PrepareMoveItem(), SCH_EDIT_FRAME::ReSizeSheet(), ShowClearance(), PCB_EDIT_FRAME::StartMoveTextePcb(), PCB_EDIT_FRAME::SwitchLayer(), and DIALOG_LABEL_EDITOR::TextPropertiesAccept().

216 { return m_Flags & IS_NEW; }
#define IS_NEW
New item, just created.
Definition: base_struct.h:113
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
virtual bool BOARD_ITEM::IsOnLayer ( 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, and MARKER_PCB.

Definition at line 182 of file class_board_item.h.

Referenced by CINFO3D_VISU::createLayers(), TEXTE_PCB::Draw(), EDGE_MODULE::Draw(), ZONE_CONTAINER::Draw(), TEXTE_MODULE::Draw(), TRACK::Draw(), DRAWSEGMENT::Draw(), SEGZONE::Draw(), ZONE_CONTAINER::DrawFilledArea(), TRACK::DrawShortNetname(), ZONE_CONTAINER::DrawWhileCreateOutline(), GENERAL_COLLECTOR::Inspect(), SELECTION_TOOL::selectable(), Test_Connections_To_Copper_Areas(), and TraceSegmentPcb().

183  {
184  return m_Layer == aLayer;
185  }
LAYER_ID m_Layer
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_SHEET_PIN, SCH_FIELD, and SCH_TEXT.

Definition at line 444 of file base_struct.h.

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

444 { return false; }
bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 222 of file base_struct.h.

References IS_RESIZED.

Referenced by ExitSheet().

222 { return m_Flags & IS_RESIZED; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:114
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 193 of file class_board_item.h.

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

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

194  {
195  return ( Type() == PCB_TRACE_T ) || ( Type() == PCB_VIA_T );
196  }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:107
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:108
bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 220 of file base_struct.h.

References IS_WIRE_IMAGE.

Referenced by abortMoveItem(), and SCH_FIELD::Draw().

220 { return m_Flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:117
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
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 132 of file base_struct.cpp.

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

Referenced by SCH_COLLECTOR::Collect(), SCH_FIND_COLLECTOR::Collect(), SCH_TYPE_COLLECTOR::Collect(), MODULE::Visit(), and Visit().

136 {
137  EDA_ITEM* p = listStart;
138 
139  for( ; p; p = p->Pnext )
140  {
141  if( SEARCH_QUIT == p->Visit( inspector, testData, scanTypes ) )
142  return SEARCH_QUIT;
143  }
144 
145  return SEARCH_CONTINUE;
146 }
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:151
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:164
TRACK * BOARD::MarkTrace ( 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
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 edition/deletion) 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 1830 of file class_board.cpp.

References BUSY, chainMarkedSegments(), DBG, dist, TRACK::GetEnd(), BOARD_ITEM::GetLayer(), BOARD_ITEM::GetLayerSet(), VIA::GetLayerSet(), EDA_ITEM::GetList(), GetPad(), D_PAD::GetPadToDieLength(), D_PAD::GetPosition(), TRACK::GetStart(), EDA_ITEM::GetState(), GetTrack(), m_Track, TRACK::Next(), next(), PCB_VIA_T, EDA_ITEM::SetState(), EDA_ITEM::Type(), BOARD_ITEM::UnLink(), wxPoint::x, and wxPoint::y.

Referenced by PCB_EDIT_FRAME::Attribut_Track(), PCB_EDIT_FRAME::Edit_Track_Width(), PCB_EDIT_FRAME::EraseRedundantTrack(), TRACK::GetMsgPanelInfo(), PCB_EDIT_FRAME::Remove_One_Track(), and SELECTION_TOOL::selectAllItemsConnectedToTrack().

1833 {
1834  TRACKS trackList;
1835 
1836  if( aCount )
1837  *aCount = 0;
1838 
1839  if( aTraceLength )
1840  *aTraceLength = 0;
1841 
1842  if( aTrace == NULL )
1843  return NULL;
1844 
1845  // Ensure the flag BUSY of all tracks of the board is cleared
1846  // because we use it to mark segments of the track
1847  for( TRACK* track = m_Track; track; track = track->Next() )
1848  track->SetState( BUSY, false );
1849 
1850  // Set flags of the initial track segment
1851  aTrace->SetState( BUSY, true );
1852  LSET layer_set = aTrace->GetLayerSet();
1853 
1854  trackList.push_back( aTrace );
1855 
1856  /* Examine the initial track segment : if it is really a segment, this is
1857  * easy.
1858  * If it is a via, one must search for connected segments.
1859  * If <=2, this via connect 2 segments (or is connected to only one
1860  * segment) and this via and these 2 segments are a part of a track.
1861  * If > 2 only this via is flagged (the track has only this via)
1862  */
1863  if( aTrace->Type() == PCB_VIA_T )
1864  {
1865  TRACK* segm1 = ::GetTrack( m_Track, NULL, aTrace->GetStart(), layer_set );
1866  TRACK* segm2 = NULL;
1867  TRACK* segm3 = NULL;
1868 
1869  if( segm1 )
1870  {
1871  segm2 = ::GetTrack( segm1->Next(), NULL, aTrace->GetStart(), layer_set );
1872  }
1873 
1874  if( segm2 )
1875  {
1876  segm3 = ::GetTrack( segm2->Next(), NULL, aTrace->GetStart(), layer_set );
1877  }
1878 
1879  if( segm3 )
1880  {
1881  // More than 2 segments are connected to this via.
1882  // The "track" is only this via.
1883 
1884  if( aCount )
1885  *aCount = 1;
1886 
1887  return aTrace;
1888  }
1889 
1890  if( segm1 ) // search for other segments connected to the initial segment start point
1891  {
1892  layer_set = segm1->GetLayerSet();
1893  chainMarkedSegments( aTrace->GetStart(), layer_set, &trackList );
1894  }
1895 
1896  if( segm2 ) // search for other segments connected to the initial segment end point
1897  {
1898  layer_set = segm2->GetLayerSet();
1899  chainMarkedSegments( aTrace->GetStart(), layer_set, &trackList );
1900  }
1901  }
1902  else // mark the chain using both ends of the initial segment
1903  {
1904  TRACKS from_start;
1905  TRACKS from_end;
1906 
1907  chainMarkedSegments( aTrace->GetStart(), layer_set, &from_start );
1908  chainMarkedSegments( aTrace->GetEnd(), layer_set, &from_end );
1909 
1910  // DBG( dump_tracks( "first_clicked", trackList ); )
1911  // DBG( dump_tracks( "from_start", from_start ); )
1912  // DBG( dump_tracks( "from_end", from_end ); )
1913 
1914  // combine into one trackList:
1915  trackList.insert( trackList.end(), from_start.begin(), from_start.end() );
1916  trackList.insert( trackList.end(), from_end.begin(), from_end.end() );
1917  }
1918 
1919  // Now examine selected vias and flag them if they are on the track
1920  // If a via is connected to only one or 2 segments, it is flagged (is on the track)
1921  // If a via is connected to more than 2 segments, it is a track end, and it
1922  // is removed from the list.
1923  // Go through the list backwards.
1924  for( int i = trackList.size() - 1; i>=0; --i )
1925  {
1926  ::VIA* via = dynamic_cast< ::VIA* >( trackList[i] );
1927 
1928  if( !via )
1929  continue;
1930 
1931  if( via == aTrace )
1932  continue;
1933 
1934  via->SetState( BUSY, true ); // Try to flag it. the flag will be cleared later if needed
1935 
1936  layer_set = via->GetLayerSet();
1937 
1938  TRACK* track = ::GetTrack( m_Track, NULL, via->GetStart(), layer_set );
1939 
1940  // GetTrace does not consider tracks flagged BUSY.
1941  // So if no connected track found, this via is on the current track
1942  // only: keep it
1943  if( track == NULL )
1944  continue;
1945 
1946  /* If a track is found, this via connects also other segments of
1947  * another track. This case happens when a via ends the selected
1948  * track but must we consider this via is on the selected track, or
1949  * on another track.
1950  * (this is important when selecting a track for deletion: must this
1951  * via be deleted or not?)
1952  * We consider this via to be on our track if other segments connected
1953  * to this via remain connected when removing this via.
1954  * We search for all other segments connected together:
1955  * if they are on the same layer, then the via is on the selected track;
1956  * if they are on different layers, the via is on another track.
1957  */
1958  LAYER_NUM layer = track->GetLayer();
1959 
1960  while( ( track = ::GetTrack( track->Next(), NULL, via->GetStart(), layer_set ) ) != NULL )
1961  {
1962  if( layer != track->GetLayer() )
1963  {
1964  // The via connects segments of another track: it is removed
1965  // from list because it is member of another track
1966