KiCad PCB EDA Suite
MODULE_ZONE_CONTAINER Class Reference

MODULE_ZONE_CONTAINER is the same item as ZONE_CONTAINER, but with a specific type id ZONE_CONTAINER is living in a board MODULE_ZONE_CONTAINER is living in a footprint althougt the are similar, these items need a specific type to be easily managed in many functions using the type id in switches A few virtual methods are different. More...

#include <class_zone.h>

Inheritance diagram for MODULE_ZONE_CONTAINER:
ZONE_CONTAINER BOARD_CONNECTED_ITEM BOARD_ITEM EDA_ITEM KIGFX::VIEW_ITEM INSPECTABLE

Public Member Functions

 MODULE_ZONE_CONTAINER (BOARD_ITEM_CONTAINER *aParent)
 
 MODULE_ZONE_CONTAINER (const MODULE_ZONE_CONTAINER &aZone)
 
MODULE_ZONE_CONTAINERoperator= (const MODULE_ZONE_CONTAINER &aOther)
 
EDA_ITEMClone () const override
 Function Clone creates a duplicate of this item with linked list members set to NULL. More...
 
unsigned int ViewGetLOD (int aLayer, KIGFX::VIEW *aView) const override
 Function ViewGetLOD() Returns the level of detail (LOD) of the item. More...
 
void InitDataFromSrcInCopyCtor (const ZONE_CONTAINER &aZone)
 Copy aZone data to me. More...
 
wxPoint GetPosition () const override
 
void SetPosition (const wxPoint &aPos) override
 
void SetPriority (unsigned aPriority)
 Function SetPriority. More...
 
unsigned GetPriority () const
 Function GetPriority. More...
 
void GetMsgPanelInfo (EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
 Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for display purposes. More...
 
void SetLayerSet (LSET aLayerSet)
 
virtual LSET GetLayerSet () const override
 Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segment or VIA physically resides. More...
 
wxString GetZoneName () const
 
void SetZoneName (const wxString &aName)
 
const EDA_RECT GetBoundingBox () const override
 Function GetBoundingBox (virtual) More...
 
int GetLocalClearance (wxString *aSource=nullptr) const override
 Function GetLocalClearance returns any local clearances set in the "classic" (ie: pre-rule) system. More...
 
bool IsOnCopperLayer () const override
 Function IsOnCopperLayer. More...
 
bool CommonLayerExists (const LSET aLayerSet) const
 Function CommonLayerExist Test if this zone shares a common layer with the given layer set. More...
 
virtual void SetLayer (PCB_LAYER_ID aLayer) override
 Function SetLayer sets the layer this item is on. More...
 
virtual PCB_LAYER_ID GetLayer () const override
 Function GetLayer returns the primary layer this item is on. More...
 
virtual bool IsOnLayer (PCB_LAYER_ID) const override
 Function IsOnLayer tests to see if this object is on the given layer. More...
 
virtual void ViewGetLayers (int aLayers[], int &aCount) const override
 Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on. More...
 
void SetFillMode (ZONE_FILL_MODE aFillMode)
 
ZONE_FILL_MODE GetFillMode () const
 
void SetThermalReliefGap (int aThermalReliefGap)
 
int GetThermalReliefGap (D_PAD *aPad=NULL) const
 
void SetThermalReliefCopperBridge (int aThermalReliefCopperBridge)
 
int GetThermalReliefCopperBridge (D_PAD *aPad=NULL) const
 
double CalculateFilledArea ()
 Compute the area currently occupied by the zone fill. More...
 
double GetFilledArea ()
 Get the area currently occupied by the zone fill. More...
 
std::mutex & GetLock ()
 
bool IsFilled () const
 
void SetIsFilled (bool isFilled)
 
bool NeedRefill () const
 
void SetNeedRefill (bool aNeedRefill)
 
int GetZoneClearance () const
 
void SetZoneClearance (int aZoneClearance)
 
ZONE_CONNECTION GetPadConnection (D_PAD *aPad=NULL) const
 
void SetPadConnection (ZONE_CONNECTION aPadConnection)
 
int GetMinThickness () const
 
void SetMinThickness (int aMinThickness)
 
int GetHatchThickness () const
 
void SetHatchThickness (int aThickness)
 
int GetHatchGap () const
 
void SetHatchGap (int aStep)
 
double GetHatchOrientation () const
 
void SetHatchOrientation (double aStep)
 
int GetHatchSmoothingLevel () const
 
void SetHatchSmoothingLevel (int aLevel)
 
double GetHatchSmoothingValue () const
 
void SetHatchSmoothingValue (double aValue)
 
double GetHatchHoleMinArea () const
 
void SetHatchHoleMinArea (double aPct)
 
int GetHatchBorderAlgorithm () const
 
void SetHatchBorderAlgorithm (int aAlgo)
 
int GetSelectedCorner () const
 
void SetSelectedCorner (int aCorner)
 
void SetSelectedCorner (const wxPoint &aPosition, int aAccuracy)
 
int GetLocalFlags () const
 
void SetLocalFlags (int aFlags)
 
ZONE_SEGMENT_FILLFillSegments (PCB_LAYER_ID aLayer)
 
const ZONE_SEGMENT_FILLFillSegments (PCB_LAYER_ID aLayer) const
 
SHAPE_POLY_SETOutline ()
 
const SHAPE_POLY_SETOutline () const
 
void SetOutline (SHAPE_POLY_SET *aOutline)
 
bool HitTest (const wxPoint &aPosition, int aAccuracy=0) const override
 Function HitTest tests if a point is near an outline edge or a corner of this zone. More...
 
bool HitTest (const EDA_RECT &aRect, bool aContained=true, int aAccuracy=0) const override
 
bool HitTestFilledArea (PCB_LAYER_ID aLayer, const wxPoint &aRefPos, int aAccuracy=0) const
 Function HitTestFilledArea tests if the given wxPoint is within the bounds of a filled area of this zone. More...
 
bool HitTestCutout (const VECTOR2I &aRefPos, int *aOutlineIdx=nullptr, int *aHoleIdx=nullptr) const
 Tests if the given point is contained within a cutout of the zone. More...
 
bool HitTestCutout (const wxPoint &aRefPos, int *aOutlineIdx=nullptr, int *aHoleIdx=nullptr) const
 
void GetColinearCorners (BOARD *aBoard, std::set< VECTOR2I > &colinearCorners)
 Some intersecting zones, despite being on the same layer with the same net, cannot be merged due to other parameters such as fillet radius. More...
 
void TransformSolidAreasShapesToPolygonSet (PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aCornerBuffer, int aError=ARC_HIGH_DEF) const
 Function TransformSolidAreasShapesToPolygonSet Convert solid areas full shapes to polygon set (the full shape is the polygon area with a thick outline) Used in 3D view Arcs (ends of segments) are approximated by segments. More...
 
void TransformOutlinesShapeWithClearanceToPolygon (SHAPE_POLY_SET &aCornerBuffer, int aMinClearanceValue, std::set< VECTOR2I > *aPreserveCorners=nullptr) const
 Function TransformOutlinesShapeWithClearanceToPolygon Convert the outlines shape to a polygon with no holes inflated (optional) by max( aClearanceValue, the zone clearance) (holes are linked to external outline by overlapping segments) Used in filling zones calculations Circles (vias) and arcs (ends of tracks) are approximated by segments. More...
 
void TransformShapeWithClearanceToPolygon (SHAPE_POLY_SET &aCornerBuffer, int aClearanceValue, int aError=ARC_HIGH_DEF, bool ignoreLineWidth=false) const override
 Function TransformShapeWithClearanceToPolygon Convert the zone shape to a closed polygon Used in filling zones calculations Circles and arcs are approximated by segments. More...
 
bool HitTestForCorner (const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
 Function HitTestForCorner tests if the given wxPoint is near a corner. More...
 
bool HitTestForCorner (const wxPoint &refPos, int aAccuracy) const
 Function HitTestForCorner tests if the given wxPoint is near a corner. More...
 
bool HitTestForEdge (const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
 Function HitTestForEdge tests if the given wxPoint is near a segment defined by 2 corners. More...
 
bool HitTestForEdge (const wxPoint &refPos, int aAccuracy) const
 Function HitTestForEdge tests if the given wxPoint is near a segment defined by 2 corners. More...
 
bool UnFill ()
 Function UnFill Removes the zone filling. More...
 
void Move (const wxPoint &offset) override
 Function Move Move the outlines. More...
 
void Move (const VECTOR2I &aMoveVector)
 
void MoveEdge (const wxPoint &offset, int aEdge)
 Function MoveEdge Move the outline Edge. More...
 
void Rotate (const wxPoint &centre, double angle) override
 Function Rotate Move the outlines. More...
 
void Rotate (const VECTOR2I &aRotCentre, double aAngle)
 
virtual void Flip (const wxPoint &aCentre, bool aFlipLeftRight) override
 Function Flip Flip this object, i.e. More...
 
void Flip (const VECTOR2I &aCentre, bool aFlipLeftRight)
 
void Mirror (const wxPoint &aMirrorRef, bool aMirrorLeftRight)
 Function Mirror Mirror the outlines , relative to a given horizontal axis the layer is not changed. More...
 
wxString GetClass () const override
 Function GetClass returns the class name. More...
 
int GetNumCorners (void) const
 Access to m_Poly parameters. More...
 
SHAPE_POLY_SET::ITERATOR Iterate ()
 Function Iterate returns an iterator to visit all points of the zone's main outline without holes. More...
 
SHAPE_POLY_SET::ITERATOR IterateWithHoles ()
 Function IterateWithHoles returns an iterator to visit all points of the zone's main outline with holes. More...
 
SHAPE_POLY_SET::CONST_ITERATOR CIterateWithHoles () const
 Function CIterateWithHoles returns an iterator to visit all points of the zone's main outline with holes. More...
 
void RemoveAllContours (void)
 
const VECTOR2IGetCornerPosition (int aCornerIndex) const
 
void SetCornerPosition (int aCornerIndex, wxPoint new_pos)
 
void NewHole ()
 Function NewHole creates a new hole on the zone; i.e., a new contour on the zone's outline. More...
 
bool AppendCorner (wxPoint aPosition, int aHoleIdx, bool aAllowDuplication=false)
 Add a new corner to the zone outline (to the main outline or a hole) More...
 
ZONE_BORDER_DISPLAY_STYLE GetHatchStyle () const
 
void SetHatchStyle (ZONE_BORDER_DISPLAY_STYLE aStyle)
 
bool IsSame (const ZONE_CONTAINER &aZoneToCompare)
 Function IsSame tests if 2 zones are equivalent: 2 zones are equivalent if they have same parameters and same outlines info, filling is not taken into account. More...
 
void ClearFilledPolysList ()
 Function ClearFilledPolysList clears the list of filled polygons. More...
 
bool HasFilledPolysForLayer (PCB_LAYER_ID aLayer) const
 
const SHAPE_POLY_SETGetFilledPolysList (PCB_LAYER_ID aLayer) const
 Function GetFilledPolysList returns a reference to the list of filled polygons. More...
 
void CacheTriangulation ()
 (re)create a list of triangles that "fill" the solid areas. More...
 
void SetFilledPolysList (PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aPolysList)
 Function SetFilledPolysList sets the list of filled polygons. More...
 
void SetRawPolysList (PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aPolysList)
 Function SetFilledPolysList sets the list of filled polygons. More...
 
bool IsIsland (PCB_LAYER_ID aLayer, int aPolyIdx)
 Checks if a given filled polygon is an insulated island. More...
 
void SetIsIsland (PCB_LAYER_ID aLayer, int aPolyIdx)
 
bool BuildSmoothedPoly (SHAPE_POLY_SET &aSmoothedPoly, std::set< VECTOR2I > *aPreserveCorners) const
 Function GetSmoothedPoly returns a pointer to the corner-smoothed version of m_Poly. More...
 
void SetCornerSmoothingType (int aType)
 
int GetCornerSmoothingType () const
 
void SetCornerRadius (unsigned int aRadius)
 
unsigned int GetCornerRadius () const
 
bool GetFilledPolysUseThickness () const
 
void SetFilledPolysUseThickness (bool aOption)
 
void RemoveCutout (int aOutlineIdx, int aHoleIdx)
 Remove a cutout from the zone. More...
 
void AddPolygon (std::vector< wxPoint > &aPolygon)
 add a polygon to the zone outline if the zone outline is empty, this is the main outline else it is a hole inside the main outline More...
 
void AddPolygon (const SHAPE_LINE_CHAIN &aPolygon)
 
void SetFillSegments (PCB_LAYER_ID aLayer, const ZONE_SEGMENT_FILL &aSegments)
 
SHAPE_POLY_SETRawPolysList (PCB_LAYER_ID aLayer)
 
wxString GetSelectMenuText (EDA_UNITS aUnits) const override
 Function GetSelectMenuText returns the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position. More...
 
BITMAP_DEF GetMenuImage () const override
 Function GetMenuImage returns a pointer to an image to be used in menus. More...
 
bool GetIsKeepout () const
 Accessors to parameters used in Keepout zones: More...
 
bool GetDoNotAllowCopperPour () const
 
bool GetDoNotAllowVias () const
 
bool GetDoNotAllowTracks () const
 
bool GetDoNotAllowPads () const
 
bool GetDoNotAllowFootprints () const
 
int GetKeepouts (PCB_LAYER_ID aLayer, std::map< int, wxString > *aSources=nullptr) const
 Return a bitset of flags for keepouts. More...
 
void SetIsKeepout (bool aEnable)
 
void SetDoNotAllowCopperPour (bool aEnable)
 
void SetDoNotAllowVias (bool aEnable)
 
void SetDoNotAllowTracks (bool aEnable)
 
void SetDoNotAllowPads (bool aEnable)
 
void SetDoNotAllowFootprints (bool aEnable)
 
const ISLAND_REMOVAL_MODE GetIslandRemovalMode () const
 
void SetIslandRemovalMode (ISLAND_REMOVAL_MODE aRemove)
 
long long int GetMinIslandArea () const
 
void SetMinIslandArea (long long int aArea)
 
int GetBorderHatchPitch () const
 HatchBorder related methods. More...
 
void SetBorderDisplayStyle (ZONE_BORDER_DISPLAY_STYLE aHatchStyle, int aHatchPitch, bool aRebuildHatch)
 Function SetBorderDisplayStyle sets all hatch parameters for the zone. More...
 
void SetHatchPitch (int aPitch)
 Function SetHatchPitch sets the hatch pitch parameter for the zone. More...
 
void UnHatchBorder ()
 Function UnHatchBorder clears the zone's hatch. More...
 
void HatchBorder ()
 Function HatchBorder computes the hatch lines depending on the hatch parameters and stores it in the zone's attribute m_borderHatchLines. More...
 
const std::vector< SEG > & GetHatchLines () const
 
bool GetHV45 () const
 
void SetHV45 (bool aConstrain)
 
MD5_HASH GetHashValue (PCB_LAYER_ID aLayer)
 
void BuildHashValue (PCB_LAYER_ID aLayer)
 Build the hash value of m_FilledPolysList, and store it internally in m_filledPolysHash. More...
 
virtual void SwapData (BOARD_ITEM *aImage) override
 Swap data between aItem and aImage. More...
 
bool IsConnected () const override
 

More...
 
NETINFO_ITEMGetNet () const
 Function GetNet Returns NET_INFO object for a given item. More...
 
void SetNet (NETINFO_ITEM *aNetInfo)
 Function SetNet Sets a NET_INFO object for the item. More...
 
int GetNetCode () const
 Function GetNetCode. More...
 
bool SetNetCode (int aNetCode, bool aNoAssert)
 Sets net using a net code. More...
 
void SetNetCode (int aNetCode)
 
const wxString & GetNetname () const
 Function GetNetname. More...
 
wxString GetNetnameMsg () const
 Function GetNetnameMsg. More...
 
const wxString & GetShortNetname () const
 Function GetShortNetname. More...
 
virtual int GetClearance (PCB_LAYER_ID aLayer, BOARD_ITEM *aItem=nullptr, wxString *aSource=nullptr) const
 Function GetClearance returns the clearance in internal units. More...
 
virtual bool GetRuleClearance (BOARD_ITEM *aItem, PCB_LAYER_ID aLayer, int *aClearance, wxString *aSource) const
 Function GetRuleClearance returns any rule-based clearance. More...
 
virtual int GetLocalClearanceOverrides (wxString *aSource=nullptr) const
 Function GetLocalClearanceOverrides returns any local clearance overrides set in the "classic" (ie: pre-rule) system. More...
 
NETCLASSGetNetClass () const
 Function GetNetClassPtr returns the NETCLASS for this item. More...
 
NETCLASSGetEffectiveNetclass () const
 Function GetEffectiveNetclass returns the NETCLASS for this item, or the default netclass if none is defined. More...
 
wxString GetNetClassName () const
 Function GetNetClassName returns a pointer to the netclass of the zone. More...
 
void SetLocalRatsnestVisible (bool aVisible)
 
bool GetLocalRatsnestVisible () const
 
int GetX () const
 
int GetY () const
 
virtual wxPoint GetCenter () const
 Function GetCenter() More...
 
void SetX (int aX)
 
void SetY (int aY)
 
virtual std::shared_ptr< SHAPEGetEffectiveShape (PCB_LAYER_ID aLayer=UNDEFINED_LAYER) const
 Function GetEffectiveShape Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes. More...
 
BOARD_ITEM_CONTAINERGetParent () const
 
BOARD_ITEMDuplicate () const
 Function Duplicate creates a copy of a BOARD_ITEM. More...
 
bool IsTrack () const
 Function IsTrack tests to see if this object is a track or via (or microvia). More...
 
virtual bool IsLocked () const
 Function IsLocked. More...
 
virtual void SetLocked (bool aLocked)
 Function SetLocked modifies 'lock' status for of the item. More...
 
void DeleteStructure ()
 Function DeleteStructure deletes this object after removing from its parent if it has one. More...
 
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...
 
KICAD_T Type () const
 Function Type() More...
 
virtual void SetParent (EDA_ITEM *aParent)
 
bool IsModified () const
 
bool IsNew () const
 
bool IsMoving () const
 
bool IsDragging () const
 
bool IsWireImage () const
 
bool IsSelected () const
 
bool IsResized () const
 
bool IsBrightened () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (int type) const
 
void SetState (int type, int state)
 
STATUS_FLAGS GetStatus () const
 
void SetStatus (STATUS_FLAGS aStatus)
 
void SetFlags (STATUS_FLAGS aMask)
 
void ClearFlags (STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
STATUS_FLAGS GetFlags () const
 
bool HasFlag (STATUS_FLAGS aFlag)
 
STATUS_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
virtual bool IsType (const KICAD_T aScanTypes[]) const
 Function IsType Checks whether the item is one of the listed types. More...
 
void SetForceVisible (bool aEnable)
 Function SetForceVisible is used to set and cleag force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible. More...
 
bool IsForceVisible () const
 
virtual const wxPoint GetFocusPosition () const
 Function GetFocusPosition similar to GetPosition, but allows items to return their visual center rather than their anchor. More...
 
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 its member data. More...
 
virtual bool Matches (wxFindReplaceData &aSearchData, void *aAuxData)
 Function Matches compares the item against the search criteria in aSearchData. More...
 
virtual bool Replace (wxFindReplaceData &aSearchData, void *aAuxData=NULL)
 Function Replace performs a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Function IsReplaceable. More...
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
virtual const BOX2I ViewBBox () const override
 Function ViewBBox() returns the bounding box of the item covering all its layers. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Function ViewDraw() Draws the parts of the object belonging to layer aLayer. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 
void ClearViewPrivData ()
 
bool Set (PROPERTY_BASE *aProperty, wxAny &aValue)
 
template<typename T >
bool Set (PROPERTY_BASE *aProperty, T aValue)
 
template<typename T >
bool Set (const wxString &aProperty, T aValue)
 
wxAny Get (PROPERTY_BASE *aProperty)
 
template<typename T >
Get (PROPERTY_BASE *aProperty)
 
template<typename T >
boost::optional< T > Get (const wxString &aProperty)
 

Static Public Member Functions

static bool ClassOf (const EDA_ITEM *aItem)
 
static int GetDefaultHatchPitch ()
 Function GetDefaultHatchPitchMils. More...
 
static wxString ShowShape (STROKE_T aShape)
 Function ShowShape converts the enum STROKE_T integer value to a wxString. More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::deque< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T ) More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::vector< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T ) More...
 
static bool Replace (wxFindReplaceData &aSearchData, wxString &aText)
 Helper function used in search and replace dialog Function Replace performs a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
static bool Sort (const EDA_ITEM *aLeft, const EDA_ITEM *aRight)
 Function Sort is a helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers. More...
 

Public Attributes

const KIID m_Uuid
 

Static Public Attributes

static wxPoint ZeroOffset
 A value of wxPoint(0,0) which can be passed to the Draw() functions. More...
 

Protected Member Functions

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

Static Protected Member Functions

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

Protected Attributes

SHAPE_POLY_SETm_Poly
 Outline of the zone. More...
 
int m_cornerSmoothingType
 
unsigned int m_cornerRadius
 
wxString m_zoneName
 An optional unique name for this zone, used for identifying it in DRC checking. More...
 
LSET m_layerSet
 
unsigned m_priority
 
bool m_isKeepout
 
bool m_doNotAllowCopperPour
 
bool m_doNotAllowVias
 
bool m_doNotAllowTracks
 
bool m_doNotAllowPads
 
bool m_doNotAllowFootprints
 
ZONE_CONNECTION m_PadConnection
 
int m_ZoneClearance
 Clearance value in internal units. More...
 
int m_ZoneMinThickness
 Minimum thickness value in filled areas. More...
 
bool m_FilledPolysUseThickness
 outline of filled polygons have thickness. More...
 
ISLAND_REMOVAL_MODE m_islandRemovalMode
 
long long int m_minIslandArea
 When island removal mode is set to AREA, islands below this area will be removed. More...
 
bool m_IsFilled
 True when a zone was filled, false after deleting the filled areas. More...
 
bool m_needRefill
 False when a zone was refilled, true after changes in zone params. More...
 
int m_ThermalReliefGap
 Width of the copper bridge in thermal reliefs. More...
 
int m_ThermalReliefCopperBridge
 
ZONE_FILL_MODE m_FillMode
 How to fill areas: ZONE_FILL_MODE::POLYGONS => use solid polygons ZONE_FILL_MODE::HATCH_PATTERN => use a grid pattern as shape. More...
 
int m_hatchThickness
 
int m_hatchGap
 
double m_hatchOrientation
 
int m_hatchSmoothingLevel
 
double m_hatchSmoothingValue
 
double m_hatchHoleMinArea
 
int m_hatchBorderAlgorithm
 
SHAPE_POLY_SET::VERTEX_INDEXm_CornerSelection
 The index of the corner being moved or nullptr if no corner is selected. More...
 
int m_localFlgs
 Variable used in polygon calculations. More...
 
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILLm_FillSegmList
 Segments used to fill the zone (m_FillMode ==1 ), when fill zone by segment is used. More...
 
std::map< PCB_LAYER_ID, SHAPE_POLY_SETm_FilledPolysList
 
std::map< PCB_LAYER_ID, SHAPE_POLY_SETm_RawPolysList
 
std::map< PCB_LAYER_ID, MD5_HASHm_filledPolysHash
 A hash value used in zone filling calculations to see if the filled areas are up to date. More...
 
ZONE_BORDER_DISPLAY_STYLE m_borderStyle
 
int m_borderHatchPitch
 
std::vector< SEGm_borderHatchLines
 
std::map< PCB_LAYER_ID, std::set< int > > m_insulatedIslands
 For each layer, a set of insulated islands that were not removed. More...
 
bool m_hv45
 
double m_area
 
std::mutex m_lock
 Lock used for multi-threaded filling on multi-layer zones. More...
 
NETINFO_ITEMm_netinfo
 Stores all informations about the net that item belongs to. More...
 
PCB_LAYER_ID m_Layer
 
STATUS_FLAGS m_Status
 
EDA_ITEMm_Parent
 Linked list: Link (parent struct) More...
 
bool m_forceVisible
 
STATUS_FLAGS m_Flags
 

Detailed Description

MODULE_ZONE_CONTAINER is the same item as ZONE_CONTAINER, but with a specific type id ZONE_CONTAINER is living in a board MODULE_ZONE_CONTAINER is living in a footprint althougt the are similar, these items need a specific type to be easily managed in many functions using the type id in switches A few virtual methods are different.

Definition at line 950 of file class_zone.h.

Constructor & Destructor Documentation

◆ MODULE_ZONE_CONTAINER() [1/2]

MODULE_ZONE_CONTAINER::MODULE_ZONE_CONTAINER ( BOARD_ITEM_CONTAINER aParent)

Definition at line 1313 of file class_zone.cpp.

1313  :
1314  ZONE_CONTAINER( aParent, true )
1315 {
1316  // in a footprint, net classes are not managed.
1317  // so set the net to NETINFO_LIST::ORPHANED_ITEM
1318  SetNetCode( -1, true );
1319 }
ZONE_CONTAINER(BOARD_ITEM_CONTAINER *parent, bool aInModule=false)
The ctor to build ZONE_CONTAINER, but comaptible with MODULE_ZONE_CONTAINER requirement.
Definition: class_zone.cpp:39
bool SetNetCode(int aNetCode, bool aNoAssert)
Sets net using a net code.

References BOARD_CONNECTED_ITEM::SetNetCode().

Referenced by Clone().

◆ MODULE_ZONE_CONTAINER() [2/2]

MODULE_ZONE_CONTAINER::MODULE_ZONE_CONTAINER ( const MODULE_ZONE_CONTAINER aZone)

Definition at line 1322 of file class_zone.cpp.

1323  : ZONE_CONTAINER( aZone.GetParent(), true )
1324 {
1325  InitDataFromSrcInCopyCtor( aZone );
1326 }
void InitDataFromSrcInCopyCtor(const ZONE_CONTAINER &aZone)
Copy aZone data to me.
Definition: class_zone.cpp:102
ZONE_CONTAINER(BOARD_ITEM_CONTAINER *parent, bool aInModule=false)
The ctor to build ZONE_CONTAINER, but comaptible with MODULE_ZONE_CONTAINER requirement.
Definition: class_zone.cpp:39
BOARD_ITEM_CONTAINER * GetParent() const

References ZONE_CONTAINER::InitDataFromSrcInCopyCtor().

Member Function Documentation

◆ AddPolygon() [1/2]

void ZONE_CONTAINER::AddPolygon ( std::vector< wxPoint > &  aPolygon)
inherited

add a polygon to the zone outline if the zone outline is empty, this is the main outline else it is a hole inside the main outline

Definition at line 856 of file class_zone.cpp.

857 {
858  if( aPolygon.empty() )
859  return;
860 
861  SHAPE_LINE_CHAIN outline;
862 
863  // Create an outline and populate it with the points of aPolygon
864  for( const wxPoint& pt : aPolygon)
865  outline.Append( pt );
866 
867  outline.SetClosed( true );
868 
869  AddPolygon( outline );
870 }
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
void SetClosed(bool aClosed)
Function SetClosed()
void AddPolygon(std::vector< wxPoint > &aPolygon)
add a polygon to the zone outline if the zone outline is empty, this is the main outline else it is a...
Definition: class_zone.cpp:856
SHAPE_LINE_CHAIN.

References SHAPE_LINE_CHAIN::Append(), and SHAPE_LINE_CHAIN::SetClosed().

Referenced by EAGLE_PLUGIN::loadPolygon().

◆ AddPolygon() [2/2]

void ZONE_CONTAINER::AddPolygon ( const SHAPE_LINE_CHAIN aPolygon)
inherited

Definition at line 842 of file class_zone.cpp.

843 {
844  wxASSERT( aPolygon.IsClosed() );
845 
846  // Add the outline as a new polygon in the polygon set
847  if( m_Poly->OutlineCount() == 0 )
848  m_Poly->AddOutline( aPolygon );
849  else
850  m_Poly->AddHole( aPolygon );
851 
852  SetNeedRefill( true );
853 }
int OutlineCount() const
Returns the number of outlines in the set
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:826
int AddHole(const SHAPE_LINE_CHAIN &aHole, int aOutline=-1)
Adds a new hole to the given outline (default: last) and returns its index
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new outline to the set and returns its index
bool IsClosed() const
Function IsClosed()
void SetNeedRefill(bool aNeedRefill)
Definition: class_zone.h:194

References SHAPE_POLY_SET::AddHole(), SHAPE_POLY_SET::AddOutline(), SHAPE_LINE_CHAIN::IsClosed(), ZONE_CONTAINER::m_Poly, SHAPE_POLY_SET::OutlineCount(), and ZONE_CONTAINER::SetNeedRefill().

◆ AppendCorner()

bool ZONE_CONTAINER::AppendCorner ( wxPoint  aPosition,
int  aHoleIdx,
bool  aAllowDuplication = false 
)
inherited

Add a new corner to the zone outline (to the main outline or a hole)

Parameters
aPositionis the position of the new corner.
aHoleIdxis the index of the hole (-1 for the main outline, >= 0 for hole).
aAllowDuplicationis a flag to indicate whether it is allowed to add this corner even if it is duplicated.
Returns
true if the corner was added, false if error (aHoleIdx > hole count -1)

Definition at line 873 of file class_zone.cpp.

874 {
875  // Ensure the main outline exists:
876  if( m_Poly->OutlineCount() == 0 )
877  m_Poly->NewOutline();
878 
879  // If aHoleIdx >= 0, the corner musty be added to the hole, index aHoleIdx.
880  // (remember: the index of the first hole is 0)
881  // Return error if if does dot exist.
882  if( aHoleIdx >= m_Poly->HoleCount( 0 ) )
883  return false;
884 
885  m_Poly->Append( aPosition.x, aPosition.y, -1, aHoleIdx, aAllowDuplication );
886 
887  SetNeedRefill( true );
888 
889  return true;
890 }
int OutlineCount() const
Returns the number of outlines in the set
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:826
int NewOutline()
Creates a new empty polygon in the set and returns its index
int HoleCount(int aOutline) const
Returns the number of holes in a given outline
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)
void SetNeedRefill(bool aNeedRefill)
Definition: class_zone.h:194

References SHAPE_POLY_SET::Append(), SHAPE_POLY_SET::HoleCount(), ZONE_CONTAINER::m_Poly, SHAPE_POLY_SET::NewOutline(), SHAPE_POLY_SET::OutlineCount(), ZONE_CONTAINER::SetNeedRefill(), wxPoint::x, and wxPoint::y.

Referenced by PCAD2KICAD::PCB_POLYGON::AddToBoard(), BOARD::InsertArea(), EAGLE_PLUGIN::loadPlain(), EAGLE_PLUGIN::packageCircle(), EAGLE_PLUGIN::packageRectangle(), ALTIUM_PCB::ParseFills6Data(), ALTIUM_PCB::ParsePolygons6Data(), and ALTIUM_PCB::ParseShapeBasedRegions6Data().

◆ BuildHashValue()

void ZONE_CONTAINER::BuildHashValue ( PCB_LAYER_ID  aLayer)
inlineinherited

Build the hash value of m_FilledPolysList, and store it internally in m_filledPolysHash.

Used in zone filling calculations, to know if m_FilledPolysList is up to date.

Definition at line 809 of file class_zone.h.

810  {
811  if( !m_FilledPolysList.count( aLayer ) )
812  return;
813 
814  m_filledPolysHash[aLayer] = m_FilledPolysList.at( aLayer ).GetHash();
815  }
std::map< PCB_LAYER_ID, MD5_HASH > m_filledPolysHash
A hash value used in zone filling calculations to see if the filled areas are up to date.
Definition: class_zone.h:924
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:920

References ZONE_CONTAINER::m_filledPolysHash, and ZONE_CONTAINER::m_FilledPolysList.

◆ BuildSmoothedPoly()

bool ZONE_CONTAINER::BuildSmoothedPoly ( SHAPE_POLY_SET aSmoothedPoly,
std::set< VECTOR2I > *  aPreserveCorners 
) const
inherited

Function GetSmoothedPoly returns a pointer to the corner-smoothed version of m_Poly.

Parameters
aPreserveCorners- set of corners which should /not/ be smoothed
Returns
SHAPE_POLY_SET* - pointer to the polygon.

Definition at line 1215 of file class_zone.cpp.

1217 {
1218  if( GetNumCorners() <= 2 ) // malformed zone. polygon calculations do not like it ...
1219  return false;
1220 
1221  // Make a smoothed polygon out of the user-drawn polygon if required
1222  switch( m_cornerSmoothingType )
1223  {
1225  aSmoothedPoly = m_Poly->Chamfer( m_cornerRadius, aPreserveCorners );
1226  break;
1227 
1229  {
1230  auto board = GetBoard();
1231  int maxError = ARC_HIGH_DEF;
1232 
1233  if( board )
1234  maxError = board->GetDesignSettings().m_MaxError;
1235 
1236  aSmoothedPoly = m_Poly->Fillet( m_cornerRadius, maxError, aPreserveCorners );
1237  break;
1238  }
1239  default:
1240  // Acute angles between adjacent edges can create issues in calculations,
1241  // in inflate/deflate outlines transforms, especially when the angle is very small.
1242  // We can avoid issues by creating a very small chamfer which remove acute angles,
1243  // or left it without chamfer and use only CPOLYGONS_LIST::InflateOutline to create
1244  // clearance areas
1245  aSmoothedPoly = m_Poly->Chamfer( Millimeter2iu( 0.0 ), aPreserveCorners );
1246  break;
1247  }
1248 
1249  return true;
1250 };
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:826
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
int m_cornerSmoothingType
Definition: class_zone.h:827
int GetNumCorners(void) const
Access to m_Poly parameters.
Definition: class_zone.h:489
unsigned int m_cornerRadius
Definition: class_zone.h:828
SHAPE_POLY_SET Fillet(int aRadius, int aErrorMax, std::set< VECTOR2I > *aPreserveCorners=nullptr)
Function Fillet returns a filleted version of the polygon set.
SHAPE_POLY_SET Chamfer(int aDistance, std::set< VECTOR2I > *aPreserveCorners=nullptr)
Function Chamfer returns a chamfered version of the polygon set.
static constexpr int Millimeter2iu(double mm)

References SHAPE_POLY_SET::Chamfer(), SHAPE_POLY_SET::Fillet(), BOARD_ITEM::GetBoard(), ZONE_CONTAINER::GetNumCorners(), ZONE_CONTAINER::m_cornerRadius, ZONE_CONTAINER::m_cornerSmoothingType, ZONE_CONTAINER::m_Poly, Millimeter2iu(), ZONE_SETTINGS::SMOOTHING_CHAMFER, and ZONE_SETTINGS::SMOOTHING_FILLET.

Referenced by ZONE_FILLER::fillSingleZone(), PNS_KICAD_IFACE_BASE::syncZone(), test::DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZones(), DRC::testZones(), and ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon().

◆ CacheTriangulation()

void ZONE_CONTAINER::CacheTriangulation ( )
inherited

(re)create a list of triangles that "fill" the solid areas.

used for instance to draw these solid areas on opengl

Definition at line 1148 of file class_zone.cpp.

1149 {
1150  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
1151  pair.second.CacheTriangulation();
1152 }
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:920

References ZONE_CONTAINER::m_FilledPolysList.

◆ CalculateFilledArea()

double ZONE_CONTAINER::CalculateFilledArea ( )
inherited

Compute the area currently occupied by the zone fill.

Returns
the currently filled area

Definition at line 1253 of file class_zone.cpp.

1254 {
1255  m_area = 0.0;
1256 
1257  // Iterate over each outline polygon in the zone and then iterate over
1258  // each hole it has to compute the total area.
1259  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
1260  {
1261  SHAPE_POLY_SET& poly = pair.second;
1262 
1263  for( int i = 0; i < poly.OutlineCount(); i++ )
1264  {
1265  m_area += poly.Outline( i ).Area();
1266 
1267  for( int j = 0; j < poly.HoleCount( i ); j++ )
1268  {
1269  m_area -= poly.Hole( i, j ).Area();
1270  }
1271  }
1272  }
1273 
1274  return m_area;
1275 }
int OutlineCount() const
Returns the number of outlines in the set
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Returns the reference to aHole-th hole in the aIndex-th outline
SHAPE_POLY_SET.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Returns the reference to aIndex-th outline in the set
int HoleCount(int aOutline) const
Returns the number of holes in a given outline
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:920

References SHAPE_LINE_CHAIN::Area(), SHAPE_POLY_SET::Hole(), SHAPE_POLY_SET::HoleCount(), ZONE_CONTAINER::m_area, ZONE_CONTAINER::m_FilledPolysList, SHAPE_POLY_SET::Outline(), and SHAPE_POLY_SET::OutlineCount().

◆ CIterateWithHoles()

SHAPE_POLY_SET::CONST_ITERATOR ZONE_CONTAINER::CIterateWithHoles ( ) const
inlineinherited

Function CIterateWithHoles returns an iterator to visit all points of the zone's main outline with holes.

Returns
SHAPE_POLY_SET::ITERATOR - an iterator to visit the zone vertices with holes.

Definition at line 519 of file class_zone.h.

520  {
521  return m_Poly->CIterateWithHoles();
522  }
CONST_ITERATOR CIterateWithHoles(int aOutline) const
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:826

References SHAPE_POLY_SET::CIterateWithHoles(), and ZONE_CONTAINER::m_Poly.

◆ ClassOf()

static bool ZONE_CONTAINER::ClassOf ( const EDA_ITEM aItem)
inlinestaticinherited

Definition at line 80 of file class_zone.h.

81  {
82  return aItem && aItem->Type() == PCB_ZONE_AREA_T;
83  }
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:102
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References PCB_ZONE_AREA_T, and EDA_ITEM::Type().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

◆ ClearEditFlags()

◆ ClearFilledPolysList()

void ZONE_CONTAINER::ClearFilledPolysList ( )
inlineinherited

Function ClearFilledPolysList clears the list of filled polygons.

Definition at line 593 of file class_zone.h.

594  {
595  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
596  {
597  m_insulatedIslands[pair.first].clear();
598  pair.second.RemoveAllContours();
599  }
600  }
std::map< PCB_LAYER_ID, std::set< int > > m_insulatedIslands
For each layer, a set of insulated islands that were not removed.
Definition: class_zone.h:931
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:920

References ZONE_CONTAINER::m_FilledPolysList, and ZONE_CONTAINER::m_insulatedIslands.

Referenced by POINT_EDITOR::updateItem().

◆ ClearFlags()

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

Definition at line 233 of file base_struct.h.

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

References EDA_ITEM::m_Flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_SCREEN::ClearAnnotation(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), clearModuleItemFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), SCH_EDIT_FRAME::ConvertPart(), LIB_EDIT_TOOL::Copy(), LIB_PIN_TOOL::CreateImagePins(), MICROWAVE_TOOL::createMicrowaveInductor(), SCH_EDIT_FRAME::DeleteAnnotation(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), KIGFX::SCH_PAINTER::draw(), LIB_EDIT_TOOL::Duplicate(), SCH_ITEM::Duplicate(), PCB_EDIT_FRAME::Exchange_Module(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), FOOTPRINT_EDIT_FRAME::LoadModuleFromLibrary(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), PCB_BASE_FRAME::PlaceModule(), LIB_PIN_TOOL::PlacePin(), DRAWING_TOOL::PlaceText(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_PIN_TOOL::RepeatPin(), LIB_EDIT_FRAME::RollbackPartFromUndo(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN_CACHE::savePin(), SCH_LEGACY_PLUGIN_CACHE::savePin(), EE_SELECTION_TOOL::SelectPoint(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 245 of file base_struct.h.

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

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

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 154 of file view_item.h.

155  {
157  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:162
#define NULL

References KIGFX::VIEW_ITEM::m_viewPrivData, and NULL.

Referenced by KIGFX::VIEW::OnDestroy().

◆ Clone()

EDA_ITEM * MODULE_ZONE_CONTAINER::Clone ( ) const
overridevirtual

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 from ZONE_CONTAINER.

Definition at line 1336 of file class_zone.cpp.

1337 {
1338  return new MODULE_ZONE_CONTAINER( *this );
1339 }
MODULE_ZONE_CONTAINER(BOARD_ITEM_CONTAINER *aParent)

References MODULE_ZONE_CONTAINER().

◆ CommonLayerExists()

bool ZONE_CONTAINER::CommonLayerExists ( const LSET  aLayerSet) const
inherited

Function CommonLayerExist Test if this zone shares a common layer with the given layer set.

Definition at line 224 of file class_zone.cpp.

225 {
226  LSET common = GetLayerSet() & aLayerSet;
227 
228  return common.count() > 0;
229 }
virtual LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_zone.cpp:288
LSET is a set of PCB_LAYER_IDs.

References ZONE_CONTAINER::GetLayerSet().

Referenced by DRC_KEEPOUT_TESTER::checkFootprints(), and DRC_KEEPOUT_TESTER::checkPads().

◆ DeleteStructure()

void BOARD_ITEM::DeleteStructure ( )
inherited

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

Definition at line 118 of file class_board_item.cpp.

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

References BOARD_ITEM::GetParent().

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

◆ Duplicate()

BOARD_ITEM* BOARD_ITEM::Duplicate ( ) const
inlineinherited

Function Duplicate creates a copy of a BOARD_ITEM.

Definition at line 208 of file class_board_item.h.

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

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

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

◆ FillSegments() [1/2]

ZONE_SEGMENT_FILL& ZONE_CONTAINER::FillSegments ( PCB_LAYER_ID  aLayer)
inlineinherited

Definition at line 270 of file class_zone.h.

271  {
272  wxASSERT( m_FillSegmList.count( aLayer ) );
273  return m_FillSegmList.at( aLayer );
274  }
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:910

References ZONE_CONTAINER::m_FillSegmList.

Referenced by PCB_IO::format().

◆ FillSegments() [2/2]

const ZONE_SEGMENT_FILL& ZONE_CONTAINER::FillSegments ( PCB_LAYER_ID  aLayer) const
inlineinherited

Definition at line 276 of file class_zone.h.

277  {
278  wxASSERT( m_FillSegmList.count( aLayer ) );
279  return m_FillSegmList.at( aLayer );
280  }
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:910

References ZONE_CONTAINER::m_FillSegmList.

◆ Flip() [1/2]

void BOARD_ITEM::Flip ( const VECTOR2I aCentre,
bool  aFlipLeftRight 
)
inlineinherited

Definition at line 324 of file class_board_item.h.

325  {
326  Flip( wxPoint( aCentre.x, aCentre.y ), aFlipLeftRight );
327  }
virtual void Flip(const wxPoint &aCentre, bool aFlipLeftRight)
Function Flip Flip this object, i.e.

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

◆ Flip() [2/2]

void ZONE_CONTAINER::Flip ( const wxPoint aCentre,
bool  aFlipLeftRight 
)
overridevirtualinherited

Function Flip Flip this object, i.e.

change the board side for this object (like Mirror() but changes layer)

Parameters
aCentre- the rotation point.

Reimplemented from BOARD_ITEM.

Definition at line 777 of file class_zone.cpp.

778 {
779  Mirror( aCentre, aFlipLeftRight );
780  int copperLayerCount = GetBoard()->GetCopperLayerCount();
781 
782  if( GetIsKeepout() )
783  SetLayerSet( FlipLayerMask( GetLayerSet(), copperLayerCount ) );
784  else
785  SetLayer( FlipLayer( GetLayer(), copperLayerCount ) );
786 }
void Mirror(const wxPoint &aMirrorRef, bool aMirrorLeftRight)
Function Mirror Mirror the outlines , relative to a given horizontal axis the layer is not changed.
Definition: class_zone.cpp:789
LSET FlipLayerMask(LSET aMask, int aCopperLayersCount)
Calculate the mask layer when flipping a footprint BACK and FRONT copper layers, mask,...
Definition: lset.cpp:531
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Function FlippedLayerNumber.
Definition: lset.cpp:485
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:212
virtual LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_zone.cpp:288
void SetLayerSet(LSET aLayerSet)
Definition: class_zone.cpp:240
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Function SetLayer sets the layer this item is on.
Definition: class_zone.cpp:232
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:712
int GetCopperLayerCount() const
Function GetCopperLayerCount.

References FlipLayer(), FlipLayerMask(), BOARD_ITEM::GetBoard(), BOARD::GetCopperLayerCount(), ZONE_CONTAINER::GetIsKeepout(), ZONE_CONTAINER::GetLayer(), ZONE_CONTAINER::GetLayerSet(), ZONE_CONTAINER::Mirror(), ZONE_CONTAINER::SetLayer(), and ZONE_CONTAINER::SetLayerSet().

◆ Get() [1/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty)
inlineinherited

Definition at line 84 of file inspectable.h.

85  {
87  TYPE_ID thisType = TYPE_HASH( *this );
88  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
89  return object ? aProperty->getter( object ) : wxAny();
90  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:61
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:53
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:38
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Casts a type to another type.
virtual wxAny getter(void *aObject) const =0
Provides class metadata.
Definition: property_mgr.h:58
virtual size_t OwnerHash() const =0
Returns type-id of the Owner class.

References PROPERTY_BASE::getter(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

Referenced by CLASS_D_DESC::CLASS_D_DESC(), PCB_EXPR_VAR_REF::GetValue(), and PAD_DESC::PAD_DESC().

◆ Get() [2/3]

template<typename T >
T INSPECTABLE::Get ( PROPERTY_BASE aProperty)
inlineinherited

Definition at line 93 of file inspectable.h.

94  {
96  TYPE_ID thisType = TYPE_HASH( *this );
97  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
98  return object ? aProperty->get<T>( object ) : T();
99  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:61
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:53
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:38
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Casts a type to another type.
T
enum T contains all this lexer's tokens.
Provides class metadata.
Definition: property_mgr.h:58
T get(void *aObject)
Definition: property.h:273
virtual size_t OwnerHash() const =0
Returns type-id of the Owner class.

References PROPERTY_BASE::get(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ Get() [3/3]

template<typename T >
boost::optional<T> INSPECTABLE::Get ( const wxString &  aProperty)
inlineinherited

Definition at line 102 of file inspectable.h.

103  {
105  TYPE_ID thisType = TYPE_HASH( *this );
106  PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
107  boost::optional<T> ret;
108 
109  if( prop )
110  {
111  void* object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
112 
113  if( object )
114  ret = prop->get<T>( object );
115  }
116 
117  return ret;
118  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:61
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:53
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:38
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Casts a type to another type.
T
enum T contains all this lexer's tokens.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Returns a property for a specific type.
Provides class metadata.
Definition: property_mgr.h:58
T get(void *aObject)
Definition: property.h:273
virtual size_t OwnerHash() const =0
Returns type-id of the Owner class.

References PROPERTY_BASE::get(), PROPERTY_MANAGER::GetProperty(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ GetBoard()

BOARD * BOARD_ITEM::GetBoard ( ) const
virtualinherited

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

Definition at line 48 of file class_board_item.cpp.

49 {
50  if( Type() == PCB_T )
51  return (BOARD*) this;
52 
53  BOARD_ITEM* parent = GetParent();
54 
55  if( parent )
56  return parent->GetBoard();
57 
58  return NULL;
59 }
Definition: typeinfo.h:85
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
#define NULL
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:180
BOARD_ITEM_CONTAINER * GetParent() const
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

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

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

◆ GetBorderHatchPitch()

int ZONE_CONTAINER::GetBorderHatchPitch ( ) const
inherited

HatchBorder related methods.

Function GetBorderHatchPitch

Returns
int - the zone hatch pitch in iu.

Definition at line 924 of file class_zone.cpp.

925 {
926  return m_borderHatchPitch;
927 }
int m_borderHatchPitch
Definition: class_zone.h:927

References ZONE_CONTAINER::m_borderHatchPitch.

Referenced by PCB_IO::format().

◆ GetBoundingBox()

const EDA_RECT ZONE_CONTAINER::GetBoundingBox ( ) const
overridevirtualinherited

Function GetBoundingBox (virtual)

Returns
an EDA_RECT that is the bounding box of the zone outline

Reimplemented from EDA_ITEM.

Definition at line 311 of file class_zone.cpp.

312 {
313  auto bb = m_Poly->BBox();
314 
315  EDA_RECT ret( (wxPoint) bb.GetOrigin(), wxSize( bb.GetWidth(), bb.GetHeight() ) );
316 
317  return ret;
318 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:826
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
const BOX2I BBox(int aClearance=0) const override
Function BBox()

References SHAPE_POLY_SET::BBox(), and ZONE_CONTAINER::m_Poly.

Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), ZONE_FILLER::buildCopperItemClearances(), ZONE_FILLER::buildThermalSpokes(), hasThermalConnection(), ZONE_CONTAINER::HitTest(), and ALTIUM_PCB::ParsePolygons6Data().

◆ GetCenter()

virtual wxPoint BOARD_ITEM::GetCenter ( ) const
inlinevirtualinherited

Function GetCenter()

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

Returns
centre point of the item

Reimplemented in DRAWSEGMENT.

Definition at line 120 of file class_board_item.h.

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

References EDA_ITEM::GetPosition().

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

◆ GetClass()

wxString ZONE_CONTAINER::GetClass ( ) const
inlineoverridevirtualinherited

Function GetClass returns the class name.

Returns
wxString

Implements EDA_ITEM.

Definition at line 482 of file class_zone.h.

483  {
484  return wxT( "ZONE_CONTAINER" );
485  }

◆ GetClearance()

int BOARD_CONNECTED_ITEM::GetClearance ( PCB_LAYER_ID  aLayer,
BOARD_ITEM aItem = nullptr,
wxString *  aSource = nullptr 
) const
virtualinherited

Function GetClearance returns the clearance in internal units.

If aItem is not NULL then the returned clearance is the greater of this object's NETCLASS clearance and aItem's NETCLASS clearance. If aItem is NULL, then this objects clearance is returned.

Parameters
aLayerthe layer in question
aItemis an optional BOARD_ITEM
aSource[out] optionally reports the source as a user-readable string
Returns
int - the clearance in internal units.

Definition at line 95 of file board_connected_item.cpp.

97 {
98  BOARD* board = GetBoard();
99  int clearance = 0;
100  wxString source;
101  wxString* localSource = aSource ? &source : nullptr;
102  BOARD_CONNECTED_ITEM* second = dynamic_cast<BOARD_CONNECTED_ITEM*>( aItem );
103 
104  // No clearance if "this" is not (yet) linked to a board therefore no available netclass
105  if( !board )
106  return clearance;
107 
108  // LEVEL 1: local overrides (pad, footprint, etc.)
109  //
110  if( GetLocalClearanceOverrides() > clearance )
111  clearance = GetLocalClearanceOverrides( localSource );
112 
113  if( second && second->GetLocalClearanceOverrides() > clearance )
114  clearance = second->GetLocalClearanceOverrides( localSource );
115 
116  if( clearance )
117  {
118  if( aSource )
119  *aSource = *localSource;
120 
121  return clearance;
122  }
123 
124  // LEVEL 2: Rules
125  //
126  if( GetRuleClearance( aItem, aLayer, &clearance, aSource ) )
127  return clearance;
128 
129  // LEVEL 3: Accumulated local settings, netclass settings, & board design settings
130  //
132  NETCLASS* netclass = GetEffectiveNetclass();
133  NETCLASS* secondNetclass = second ? second->GetEffectiveNetclass() : nullptr;
134 
135  if( bds.m_MinClearance > clearance )
136  {
137  if( aSource )
138  *aSource = _( "board minimum" );
139 
140  clearance = bds.m_MinClearance;
141  }
142 
143  if( netclass && netclass->GetClearance() > clearance )
144  clearance = netclass->GetClearance( aSource );
145 
146  if( secondNetclass && secondNetclass->GetClearance() > clearance )
147  clearance = secondNetclass->GetClearance( aSource );
148 
149  if( aItem && aItem->GetLayer() == Edge_Cuts && bds.m_CopperEdgeClearance > clearance )
150  {
151  if( aSource )
152  *aSource = _( "board edge" );
153 
154  clearance = bds.m_CopperEdgeClearance;
155  }
156 
157  if( GetLocalClearance() > clearance )
158  clearance = GetLocalClearance( aSource );
159 
160  if( second && second->GetLocalClearance() > clearance )
161  clearance = second->GetLocalClearance( aSource );
162 
163  return clearance;
164 }
virtual int GetLocalClearance(wxString *aSource=nullptr) const
Function GetLocalClearance returns any local clearances set in the "classic" (ie: pre-rule) system.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:553
int GetClearance(wxString *aSource=nullptr) const
Definition: netclass.h:158
BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected and have...
NETCLASS handles a collection of nets and the parameters used to route or test these nets.
Definition: netclass.h:49
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
virtual int GetLocalClearanceOverrides(wxString *aSource=nullptr) const
Function GetLocalClearanceOverrides returns any local clearance overrides set in the "classic" (ie: p...
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:180
#define _(s)
Definition: 3d_actions.cpp:33
NETCLASS * GetEffectiveNetclass() const
Function GetEffectiveNetclass returns the NETCLASS for this item, or the default netclass if none is ...
virtual bool GetRuleClearance(BOARD_ITEM *aItem, PCB_LAYER_ID aLayer, int *aClearance, wxString *aSource) const
Function GetRuleClearance returns any rule-based clearance.
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.

References _, Edge_Cuts, BOARD_ITEM::GetBoard(), NETCLASS::GetClearance(), BOARD::GetDesignSettings(), BOARD_CONNECTED_ITEM::GetEffectiveNetclass(), BOARD_ITEM::GetLayer(), BOARD_CONNECTED_ITEM::GetLocalClearance(), BOARD_CONNECTED_ITEM::GetLocalClearanceOverrides(), BOARD_CONNECTED_ITEM::GetRuleClearance(), BOARD_DESIGN_SETTINGS::m_CopperEdgeClearance, and BOARD_DESIGN_SETTINGS::m_MinClearance.

Referenced by GERBER_JOBFILE_WRITER::addJSONDesignRules(), ZONE_FILLER::buildCopperItemClearances(), DRC::doPadToPadsDrc(), DRC::doTrackDrc(), KIGFX::PCB_PAINTER::draw(), ZONE_CONTAINER::GetMsgPanelInfo(), TRACK::GetMsgPanelInfo(), VIA::GetMsgPanelInfo(), D_PAD::GetMsgPanelInfo(), DRC::testZones(), and TRACK::ViewBBox().

◆ GetColinearCorners()

void ZONE_CONTAINER::GetColinearCorners ( BOARD aBoard,
std::set< VECTOR2I > &  colinearCorners 
)
inherited

Some intersecting zones, despite being on the same layer with the same net, cannot be merged due to other parameters such as fillet radius.

The copper pour will end up effectively merged though, so we want to keep the corners of such intersections sharp.

Definition at line 1172 of file class_zone.cpp.

1173 {
1174  int epsilon = Millimeter2iu( 0.001 );
1175 
1176  // Things get messy when zone of different nets intersect. To do it right we'd need to
1177  // run our colinear test with the final filled regions rather than the outline regions.
1178  // However, since there's no order dependance the only way to do that is to iterate
1179  // through successive zone fills until the results are no longer changing -- and that's
1180  // not going to happen. So we punt and ignore any "messy" corners.
1181  std::set<VECTOR2I> colinearCorners;
1182  std::set<VECTOR2I> messyCorners;
1183 
1184  for( ZONE_CONTAINER* candidate : aBoard->Zones() )
1185  {
1186  if( candidate == this )
1187  continue;
1188 
1189  if( candidate->GetLayerSet() != GetLayerSet() )
1190  continue;
1191 
1192  if( candidate->GetIsKeepout() != GetIsKeepout() )
1193  continue;
1194 
1195  for( auto iter = m_Poly->CIterate(); iter; iter++ )
1196  {
1197  if( candidate->m_Poly->Collide( iter.Get(), epsilon ) )
1198  {
1199  if( candidate->GetNetCode() == GetNetCode() )
1200  colinearCorners.insert( VECTOR2I( iter.Get() ) );
1201  else
1202  messyCorners.insert( VECTOR2I( iter.Get() ) );
1203  }
1204  }
1205  }
1206 
1207  for( VECTOR2I corner : colinearCorners )
1208  {
1209  if( messyCorners.count( corner ) == 0 )
1210  aCorners.insert( corner );
1211  }
1212 }
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
int GetNetCode() const
Function GetNetCode.
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
virtual LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_zone.cpp:288
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:826
CONST_ITERATOR CIterate(int aFirst, int aLast, bool aIterateHoles=false) const
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:712
ZONE_CONTAINERS & Zones()
Definition: class_board.h:280
static constexpr int Millimeter2iu(double mm)

References SHAPE_POLY_SET::CIterate(), ZONE_CONTAINER::GetIsKeepout(), ZONE_CONTAINER::GetLayerSet(), BOARD_CONNECTED_ITEM::GetNetCode(), ZONE_CONTAINER::m_Poly, Millimeter2iu(), and BOARD::Zones().

Referenced by ZONE_FILLER::fillSingleZone(), PNS_KICAD_IFACE_BASE::syncZone(), test::DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZones(), and DRC::testZones().

◆ GetCornerPosition()

const VECTOR2I& ZONE_CONTAINER::GetCornerPosition ( int  aCornerIndex) const
inlineinherited

Definition at line 529 of file class_zone.h.

530  {
532 
533  // Convert global to relative indices
534  if( !m_Poly->GetRelativeIndices( aCornerIndex, &index ) )
535  throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
536 
537  return m_Poly->CVertex( index );
538  }
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Returns the index-th vertex in a given hole outline within a given outline
Struct VERTEX_INDEX.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:826
bool GetRelativeIndices(int aGlobalIdx, VERTEX_INDEX *aRelativeIndices) const
Function GetRelativeIndices.

References SHAPE_POLY_SET::CVertex(), SHAPE_POLY_SET::GetRelativeIndices(), and ZONE_CONTAINER::m_Poly.

Referenced by ZONE_CONTAINER::GetPosition().

◆ GetCornerRadius()

unsigned int ZONE_CONTAINER::GetCornerRadius ( ) const
inlineinherited

◆ GetCornerSmoothingType()

int ZONE_CONTAINER::GetCornerSmoothingType ( ) const
inlineinherited

◆ GetDefaultHatchPitch()

◆ GetDoNotAllowCopperPour()

bool ZONE_CONTAINER::GetDoNotAllowCopperPour ( ) const
inlineinherited

◆ GetDoNotAllowFootprints()

bool ZONE_CONTAINER::GetDoNotAllowFootprints ( ) const
inlineinherited

◆ GetDoNotAllowPads()

bool ZONE_CONTAINER::GetDoNotAllowPads ( ) const
inlineinherited

◆ GetDoNotAllowTracks()

◆ GetDoNotAllowVias()

bool ZONE_CONTAINER::GetDoNotAllowVias ( ) const
inlineinherited

◆ GetEditFlags()

STATUS_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 237 of file base_struct.h.

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

References IS_DRAGGED, IS_MOVED, IS_NEW, IS_PASTED, IS_RESIZED, IS_WIRE_IMAGE, EDA_ITEM::m_Flags, and STRUCT_DELETED.

Referenced by SCH_EDIT_TOOL::ChangeTextType(), EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_TOOL::editFieldText(), LIB_PIN_TOOL::EditPinProperties(), SCH_EDITOR_CONTROL::EditWithLibEdit(), SCH_COMPONENT::GetMsgPanelInfo(), LIB_MOVE_TOOL::Main(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), PAD_TOOL::recombinePad(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), and SCH_EDIT_FRAME::TrimWire().

◆ GetEffectiveNetclass()

NETCLASS * BOARD_CONNECTED_ITEM::GetEffectiveNetclass ( ) const
inherited

Function GetEffectiveNetclass returns the NETCLASS for this item, or the default netclass if none is defined.

Note: do NOT return a std::shared_ptr from this. It is used heavily in DRC, and the std::shared_ptr stuff shows up large in performance profiling.

Definition at line 76 of file board_connected_item.cpp.

77 {
78  // NB: we must check the net first, as when it is 0 GetNetClass() will return the
79  // orphaned net netclass, not the default netclass.
80  if( m_netinfo->GetNet() == 0 )
82  else
83  return GetNetClass();
84 }
NETCLASS * GetNetClass() const
Function GetNetClassPtr returns the NETCLASS for this item.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:553
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
int GetNet() const
Function GetNet.
Definition: netinfo.h:223
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.
NETCLASS * GetDefault() const
Function GetDefault.

References BOARD_ITEM::GetBoard(), BOARD_DESIGN_SETTINGS::GetDefault(), BOARD::GetDesignSettings(), NETINFO_ITEM::GetNet(), BOARD_CONNECTED_ITEM::GetNetClass(), and BOARD_CONNECTED_ITEM::m_netinfo.

Referenced by BOARD_CONNECTED_ITEM::GetClearance().

◆ GetEffectiveShape()

std::shared_ptr< SHAPE > BOARD_ITEM::GetEffectiveShape ( PCB_LAYER_ID  aLayer = UNDEFINED_LAYER) const
virtualinherited

Function GetEffectiveShape Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.

This routine returns a COMPOUND shape (set of simple shapes which make up the pad fod use with routing, collision determiniation, etc).

Note that this list can contain a SHAPE_SIMPLE (a simple single-outline non-intersecting polygon), but should never contain a SHAPE_POLY_SET (a complex polygon consisting of multiple outlines and/or holes).

Parameters
aLayerin case of items spanning multiple layers, only the shapes belonging to aLayer will be returned. Pass UNDEFINED_LAYER to return shapes for all layers.

Reimplemented in D_PAD, and DRAWSEGMENT.

Definition at line 154 of file class_board_item.cpp.

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

◆ GetFilledArea()

double ZONE_CONTAINER::GetFilledArea ( )
inlineinherited

Get the area currently occupied by the zone fill.

This area is cached from the most recent call to CalculateFilledArea().

Returns
the filled area

Definition at line 180 of file class_zone.h.

181  {
182  return m_area;
183  }

References ZONE_CONTAINER::m_area.

◆ GetFilledPolysList()

const SHAPE_POLY_SET& ZONE_CONTAINER::GetFilledPolysList ( PCB_LAYER_ID  aLayer) const
inlineinherited

Function GetFilledPolysList returns a reference to the list of filled polygons.

Returns
Reference to the list of filled polygons.

Definition at line 612 of file class_zone.h.

613  {
614  wxASSERT( m_FilledPolysList.count( aLayer ) );
615  return m_FilledPolysList.at( aLayer );
616  }
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:920

References ZONE_CONTAINER::m_FilledPolysList.

Referenced by CN_LIST::Add(), BOARD_ADAPTER::AddSolidAreasShapesToContainer(), CN_ZONE::CN_ZONE(), KIGFX::PCB_PAINTER::draw(), export_vrml_zones(), CN_CONNECTIVITY_ALGO::FindIsolatedCopperIslands(), PCB_IO::format(), test::DRC_TEST_PROVIDER_CLEARANCE_BASE::getLocation(), DRC::GetLocation(), insideArea(), and ALTIUM_PCB::ParseRegions6Data().

◆ GetFilledPolysUseThickness()

bool ZONE_CONTAINER::GetFilledPolysUseThickness ( ) const
inlineinherited

◆ GetFillMode()

ZONE_FILL_MODE ZONE_CONTAINER::GetFillMode ( ) const
inlineinherited

Definition at line 153 of file class_zone.h.

153 { return m_FillMode; }
ZONE_FILL_MODE m_FillMode
How to fill areas: ZONE_FILL_MODE::POLYGONS => use solid polygons ZONE_FILL_MODE::HATCH_PATTERN => us...
Definition: class_zone.h:888

References ZONE_CONTAINER::m_FillMode.

Referenced by ZONE_FILLER::computeRawFilledArea(), ZONE_FILLER::fillSingleZone(), PCB_IO::format(), ZONE_CONTAINER::IsSame(), and ZONE_SETTINGS::operator<<().

◆ GetFlags()

◆ GetFocusPosition()

virtual const wxPoint EDA_ITEM::GetFocusPosition ( ) const
inlinevirtualinherited

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

Reimplemented in DRAWSEGMENT, and TRACK.

Definition at line 344 of file base_struct.h.

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

References EDA_ITEM::GetPosition().

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

◆ GetHashValue()

MD5_HASH ZONE_CONTAINER::GetHashValue ( PCB_LAYER_ID  aLayer)
inlineinherited
Returns
the hash value previously calculated by BuildHashValue(). used in zone filling calculations

Definition at line 797 of file class_zone.h.

798  {
799  if( !m_filledPolysHash.count( aLayer ) )
800  return MD5_HASH();
801 
802  return m_filledPolysHash.at( aLayer );
803  }
std::map< PCB_LAYER_ID, MD5_HASH > m_filledPolysHash
A hash value used in zone filling calculations to see if the filled areas are up to date.
Definition: class_zone.h:924

References ZONE_CONTAINER::m_filledPolysHash.

◆ GetHatchBorderAlgorithm()

int ZONE_CONTAINER::GetHatchBorderAlgorithm ( ) const
inlineinherited

◆ GetHatchGap()

int ZONE_CONTAINER::GetHatchGap ( ) const
inlineinherited

◆ GetHatchHoleMinArea()

double ZONE_CONTAINER::GetHatchHoleMinArea ( ) const
inlineinherited

◆ GetHatchLines()

const std::vector<SEG>& ZONE_CONTAINER::GetHatchLines ( ) const
inlineinherited

Definition at line 789 of file class_zone.h.

789 { return m_borderHatchLines; }
std::vector< SEG > m_borderHatchLines
Definition: class_zone.h:928

References ZONE_CONTAINER::m_borderHatchLines.

Referenced by KIGFX::PCB_PAINTER::draw().

◆ GetHatchOrientation()

double ZONE_CONTAINER::GetHatchOrientation ( ) const
inlineinherited

◆ GetHatchSmoothingLevel()

int ZONE_CONTAINER::GetHatchSmoothingLevel ( ) const
inlineinherited

◆ GetHatchSmoothingValue()

double ZONE_CONTAINER::GetHatchSmoothingValue ( ) const
inlineinherited

◆ GetHatchStyle()

ZONE_BORDER_DISPLAY_STYLE ZONE_CONTAINER::GetHatchStyle ( ) const
inlineinherited

Definition at line 577 of file class_zone.h.

577 { return m_borderStyle; }
ZONE_BORDER_DISPLAY_STYLE m_borderStyle
Definition: class_zone.h:926

References ZONE_CONTAINER::m_borderStyle.

Referenced by PCB_IO::format(), BOARD::NormalizeAreaPolygon(), and ZONE_SETTINGS::operator<<().

◆ GetHatchThickness()

int ZONE_CONTAINER::GetHatchThickness ( ) const
inlineinherited

◆ GetHV45()

bool ZONE_CONTAINER::GetHV45 ( ) const
inlineinherited

Definition at line 791 of file class_zone.h.

791 { return m_hv45; }

References ZONE_CONTAINER::m_hv45.

Referenced by DRAWING_TOOL::DrawZone(), and ZONE_SETTINGS::operator<<().

◆ GetIsKeepout()

◆ GetIslandRemovalMode()

const ISLAND_REMOVAL_MODE ZONE_CONTAINER::GetIslandRemovalMode ( ) const
inlineinherited

Definition at line 735 of file class_zone.h.

735 { return m_islandRemovalMode; }
ISLAND_REMOVAL_MODE m_islandRemovalMode
Definition: class_zone.h:860

References ZONE_CONTAINER::m_islandRemovalMode.

Referenced by PCB_IO::format(), and ZONE_SETTINGS::operator<<().

◆ GetKeepouts()

int ZONE_CONTAINER::GetKeepouts ( PCB_LAYER_ID  aLayer,
std::map< int, wxString > *  aSources = nullptr 
) const
inherited

Return a bitset of flags for keepouts.

Includes both those set via the GUI and those set via DRC rules. @aSources indicates the source ("zone properties" or rule name) of each flag.

Returns
a bitset of DISALLOW_* flags.

Definition at line 339 of file class_zone.cpp.

340 {
341  wxString source;
342  int keepouts = 0;
343 
344  auto setFlag = [&]( int aFlag )
345  {
346  keepouts |= aFlag;
347 
348  if( aSources )
349  (*aSources)[ aFlag ] = source;
350  };
351 
352  if( m_isKeepout )
353  {
354  if( aSources )
355  source = _( "zone properties" );
356 
357  if( m_doNotAllowTracks )
358  setFlag( DISALLOW_TRACKS );
359 
360  if( m_doNotAllowVias )
361  setFlag( DISALLOW_VIAS );
362 
363  if( m_doNotAllowPads )
364  setFlag( DISALLOW_PADS );
365 
367  setFlag( DISALLOW_FOOTPRINTS );
368 
370  setFlag( DISALLOW_ZONES );
371  }
372 
373  const DRC_CONSTRAINT* constraint = GetConstraint( this, nullptr, DRC_RULE_ID_DISALLOW, aLayer,
374  &source );
375 
376  if( constraint )
377  {
378  if( aSources )
379  source = wxString::Format( _( "'%s' rule" ), source );
380 
381  if( ( constraint->m_DisallowFlags & DISALLOW_VIAS ) > 0 )
382  setFlag( DISALLOW_VIAS );
383 
384  if( ( constraint->m_DisallowFlags & DISALLOW_MICRO_VIAS ) > 0 )
385  setFlag( DISALLOW_MICRO_VIAS );
386 
387  if( ( constraint->m_DisallowFlags & DISALLOW_BB_VIAS ) > 0 )
388  setFlag( DISALLOW_BB_VIAS );
389 
390  if( ( constraint->m_DisallowFlags & DISALLOW_TRACKS ) > 0 )
391  setFlag( DISALLOW_TRACKS );
392 
393  if( ( constraint->m_DisallowFlags & DISALLOW_PADS ) > 0 )
394  setFlag( DISALLOW_PADS );
395 
396  if( ( constraint->m_DisallowFlags & DISALLOW_ZONES ) > 0 )
397  setFlag( DISALLOW_ZONES );
398 
399  if( ( constraint->m_DisallowFlags & DISALLOW_TEXTS ) > 0 )
400  setFlag( DISALLOW_TEXTS );
401 
402  if( ( constraint->m_DisallowFlags & DISALLOW_GRAPHICS ) > 0 )
403  setFlag( DISALLOW_GRAPHICS );
404 
405  if( ( constraint->m_DisallowFlags & DISALLOW_HOLES ) > 0 )
406  setFlag( DISALLOW_HOLES );
407 
408  if( ( constraint->m_DisallowFlags & DISALLOW_FOOTPRINTS ) > 0 )
409  setFlag( DISALLOW_FOOTPRINTS );
410  }
411 
412  return keepouts;
413 }
bool m_doNotAllowPads
Definition: class_zone.h:852
bool m_doNotAllowTracks
Definition: class_zone.h:851
bool m_doNotAllowFootprints
Definition: class_zone.h:853
#define DISALLOW_MICRO_VIAS
#define DISALLOW_ZONES
bool m_doNotAllowVias
Definition: class_zone.h:850
#define DISALLOW_VIAS
bool m_doNotAllowCopperPour
Definition: class_zone.h:849
const DRC_CONSTRAINT * GetConstraint(const BOARD_ITEM *aItem, const BOARD_ITEM *bItem, int aConstraint, PCB_LAYER_ID aLayer, wxString *aRuleName)
#define DISALLOW_PADS
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:33
#define DISALLOW_FOOTPRINTS
#define DISALLOW_BB_VIAS
#define DISALLOW_HOLES
#define DISALLOW_GRAPHICS
#define DISALLOW_TRACKS
#define DISALLOW_TEXTS

References _, DISALLOW_BB_VIAS, DISALLOW_FOOTPRINTS, DISALLOW_GRAPHICS, DISALLOW_HOLES, DISALLOW_MICRO_VIAS, DISALLOW_PADS, DISALLOW_TEXTS, DISALLOW_TRACKS, DISALLOW_VIAS, DISALLOW_ZONES, DRC_RULE_ID_DISALLOW, Format(), GetConstraint(), DRC_CONSTRAINT::m_DisallowFlags, ZONE_CONTAINER::m_doNotAllowCopperPour, ZONE_CONTAINER::m_doNotAllowFootprints, ZONE_CONTAINER::m_doNotAllowPads, ZONE_CONTAINER::m_doNotAllowTracks, ZONE_CONTAINER::m_doNotAllowVias, and ZONE_CONTAINER::m_isKeepout.

◆ GetLayer()

PCB_LAYER_ID ZONE_CONTAINER::GetLayer ( ) const
overridevirtualinherited

◆ GetLayerName()

wxString BOARD_ITEM::GetLayerName ( ) const
inherited

Function GetLayerName returns the name of the PCB layer on which the item resides.

Returns
wxString containing the layer name associated with this item.

Definition at line 62 of file class_board_item.cpp.

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

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

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

◆ GetLayerSet()

LSET ZONE_CONTAINER::GetLayerSet ( ) const
overridevirtualinherited

◆ GetLocalClearance()

int ZONE_CONTAINER::GetLocalClearance ( wxString *  aSource = nullptr) const
overridevirtualinherited

Function GetLocalClearance returns any local clearances set in the "classic" (ie: pre-rule) system.

These are things like zone clearance which are NOT an override.

Parameters
aSource[out] optionally reports the source as a user-readable string
Returns
int - the clearance in internal units.

Reimplemented from BOARD_CONNECTED_ITEM.

Definition at line 524 of file class_zone.cpp.

525 {
526  if( m_isKeepout )
527  return 0;
528 
529  if( aSource )
530  *aSource = _( "zone" );
531 
532  return m_ZoneClearance;
533 }
int m_ZoneClearance
Clearance value in internal units.
Definition: class_zone.h:856
#define _(s)
Definition: 3d_actions.cpp:33

References _, ZONE_CONTAINER::m_isKeepout, and ZONE_CONTAINER::m_ZoneClearance.

Referenced by ZONE_FILLER::buildCopperItemClearances(), and BOARD::TestAreaIntersections().

◆ GetLocalClearanceOverrides()

virtual int BOARD_CONNECTED_ITEM::GetLocalClearanceOverrides ( wxString *  aSource = nullptr) const
inlinevirtualinherited

Function GetLocalClearanceOverrides returns any local clearance overrides set in the "classic" (ie: pre-rule) system.

Parameters
aSource[out] optionally reports the source as a user-readable string
Returns
int - the clearance in internal units.

Reimplemented in D_PAD.

Definition at line 189 of file board_connected_item.h.

189 { return 0; }

Referenced by BOARD_CONNECTED_ITEM::GetClearance().

◆ GetLocalFlags()

int ZONE_CONTAINER::GetLocalFlags ( ) const
inlineinherited

Definition at line 267 of file class_zone.h.

267 { return m_localFlgs; }
int m_localFlgs
Variable used in polygon calculations.
Definition: class_zone.h:905

References ZONE_CONTAINER::m_localFlgs.

Referenced by BOARD::CombineAllAreasInNet(), and ZONE_CONTAINER::InitDataFromSrcInCopyCtor().

◆ GetLocalRatsnestVisible()

bool BOARD_CONNECTED_ITEM::GetLocalRatsnestVisible ( ) const
inlineinherited

◆ GetLock()

std::mutex& ZONE_CONTAINER::GetLock ( )
inlineinherited

Definition at line 185 of file class_zone.h.

186  {
187  return m_lock;
188  }
std::mutex m_lock
Lock used for multi-threaded filling on multi-layer zones.
Definition: class_zone.h:938

References ZONE_CONTAINER::m_lock.

Referenced by ZONE_FILLER::Fill().

◆ GetMenuImage()

BITMAP_DEF ZONE_CONTAINER::GetMenuImage ( ) const
overridevirtualinherited

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 from EDA_ITEM.

Definition at line 1134 of file class_zone.cpp.

1135 {
1136  return add_zone_xpm;
1137 }
const BITMAP_OPAQUE add_zone_xpm[1]
Definition: add_zone.cpp:74

References add_zone_xpm.

◆ GetMinIslandArea()

long long int ZONE_CONTAINER::GetMinIslandArea ( ) const
inlineinherited

Definition at line 739 of file class_zone.h.

739 { return m_minIslandArea; }
long long int m_minIslandArea
When island removal mode is set to AREA, islands below this area will be removed.
Definition: class_zone.h:866

References ZONE_CONTAINER::m_minIslandArea.

Referenced by PCB_IO::format(), and ZONE_SETTINGS::operator<<().

◆ GetMinThickness()

◆ GetMsgPanelInfo()

void ZONE_CONTAINER::GetMsgPanelInfo ( EDA_DRAW_FRAME aFrame,
std::vector< MSG_PANEL_ITEM > &  aList 
)
overridevirtualinherited

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

Parameters
aListis the list to populate.

Reimplemented from EDA_ITEM.

Definition at line 577 of file class_zone.cpp.

578 {
579  EDA_UNITS units = aFrame->GetUserUnits();
580  wxString msg, msg2;
581 
582  if( GetIsKeepout() )
583  msg = _( "Keepout Area" );
584  else if( IsOnCopperLayer() )
585  msg = _( "Copper Zone" );
586  else
587  msg = _( "Non-copper Zone" );
588 
589  // Display Cutout instead of Outline for holes inside a zone
590  // i.e. when num contour !=0
591  // Check whether the selected corner is in a hole; i.e., in any contour but the first one.
592  if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
593  msg << wxT( " " ) << _( "Cutout" );
594 
595  aList.emplace_back( _( "Type" ), msg, DARKCYAN );
596 
597  if( GetIsKeepout() )
598  {
599  msg.Empty();
600 
601  if( GetDoNotAllowVias() )
602  AccumulateDescription( msg, _( "No vias" ) );
603 
604  if( GetDoNotAllowTracks() )
605  AccumulateDescription( msg, _( "No tracks" ) );
606 
607  if( GetDoNotAllowPads() )
608  AccumulateDescription( msg, _( "No pads" ) );
609 
611  AccumulateDescription( msg, _( "No copper zones" ) );
612 
614  AccumulateDescription( msg, _( "No footprints" ) );
615 
616  aList.emplace_back( MSG_PANEL_ITEM( _( "Keepout" ), msg, RED ) );
617  }
618  else if( IsOnCopperLayer() )
619  {
620  if( GetNetCode() >= 0 )
621  {
622  NETINFO_ITEM* net = GetNet();
623  NETCLASS* netclass = nullptr;
624 
625  if( net )
626  {
627  if( net->GetNet() )
628  netclass = GetNetClass();
629  else
630  netclass = GetBoard()->GetDesignSettings().GetDefault();
631 
632  msg = UnescapeString( net->GetNetname() );
633  }
634  else
635  {
636  msg = wxT( "<no name>" );
637  }
638 
639  aList.emplace_back( _( "Net" ), msg, RED );
640 
641  if( netclass )
642  aList.emplace_back( _( "NetClass" ), netclass->GetName(), DARKMAGENTA );
643  }
644 
645  // Display priority level
646  msg.Printf( wxT( "%d" ), GetPriority() );
647  aList.emplace_back( _( "Priority" ), msg, BLUE );
648  }
649 
650  wxString layerDesc;
651  int count = 0;
652 
653  for( PCB_LAYER_ID layer : m_layerSet.Seq() )
654  {
655  if( count == 0 )
656  layerDesc = GetBoard()->GetLayerName( layer );
657 
658  count++;
659  }
660 
661  if( count > 1 )
662  layerDesc.Printf( _( "%s and %d more" ), layerDesc, count - 1 );
663 
664  aList.emplace_back( _( "Layer" ), layerDesc, DARKGREEN );
665 
666  if( !m_zoneName.empty() )
667  aList.emplace_back( _( "Name" ), m_zoneName, DARKMAGENTA );
668 
669  switch( m_FillMode )
670  {
671  case ZONE_FILL_MODE::POLYGONS: msg = _( "Solid" ); break;
672  case ZONE_FILL_MODE::HATCH_PATTERN: msg = _( "Hatched" ); break;
673  default: msg = _( "Unknown" ); break;
674  }
675 
676  aList.emplace_back( _( "Fill Mode" ), msg, BROWN );
677 
678  msg = MessageTextFromValue( units, m_area, false, EDA_DATA_TYPE::AREA );
679  aList.emplace_back( _( "Filled Area" ), msg, BLUE );
680 
681  wxString source;
682  int clearance = GetClearance( GetLayer(), nullptr, &source );
683 
684  msg.Printf( _( "Min Clearance: %s" ), MessageTextFromValue( units, clearance, true ) );
685  msg2.Printf( _( "(from %s)" ), source );
686  aList.emplace_back( msg, msg2, BLACK );
687 
688  // Useful for statistics, especially when zones are complex the number of hatches
689  // and filled polygons can explain the display and DRC calculation time:
690  msg.Printf( wxT( "%d" ), (int) m_borderHatchLines.size() );
691  aList.emplace_back( MSG_PANEL_ITEM( _( "HatchBorder Lines" ), msg, BLUE ) );
692 
693  PCB_LAYER_ID layer = m_Layer;
694 
695  // NOTE: This brings in dependence on PCB_EDIT_FRAME to the qa tests, which isn't ideal.
696  // TODO: Figure out a way for items to know the active layer without the whole edit frame?
697 #if 0
698  if( PCB_EDIT_FRAME* pcbframe = dynamic_cast<PCB_EDIT_FRAME*>( aFrame ) )
699  if( m_FilledPolysList.count( pcbframe->GetActiveLayer() ) )
700  layer = pcbframe->GetActiveLayer();
701 #endif
702 
703  if( !m_FilledPolysList.at( layer ).IsEmpty() )
704  {
705  msg.Printf( wxT( "%d" ), m_FilledPolysList.at( layer ).TotalVertices() );
706  aList.emplace_back( MSG_PANEL_ITEM( _( "Corner Count" ), msg, BLUE ) );
707  }
708 }
EDA_UNITS
Definition: common.h:198
bool GetDoNotAllowPads() const
Definition: class_zone.h:716
std::vector< SEG > m_borderHatchLines
Definition: class_zone.h:928
int GetNetCode() const
Function GetNetCode.
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer.
NETINFO_ITEM * GetNet() const
Function GetNet Returns NET_INFO object for a given item.
const wxString & GetName() const
Definition: netclass.h:96
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: class_zone.h:902
NETCLASS * GetNetClass() const
Function GetNetClassPtr returns the NETCLASS for this item.
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:212
Definition: color4d.h:61
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:553
Definition: color4d.h:44
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Function Seq returns an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:377
bool GetDoNotAllowVias() const
Definition: class_zone.h:714
PCB_LAYER_ID m_Layer
virtual int GetClearance(PCB_LAYER_ID aLayer, BOARD_ITEM *aItem=nullptr, wxString *aSource=nullptr) const
Function GetClearance returns the clearance in internal units.
wxString m_zoneName
An optional unique name for this zone, used for identifying it in DRC checking.
Definition: class_zone.h:831
PCB_LAYER_ID
A quick note on layer IDs:
NETCLASS handles a collection of nets and the parameters used to route or test these nets.
Definition: netclass.h:49
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
bool GetDoNotAllowCopperPour() const
Definition: class_zone.h:713
const wxString & GetNetname() const
Function GetNetname.
Definition: netinfo.h:231
Definition: color4d.h:59
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:712
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aUseMils, EDA_DATA_TYPE aType)
Definition: base_units.cpp:124
void AccumulateDescription(wxString &aDesc, const wxString &aItem)
Utility to build comma separated lists in messages.
Definition: macros.h:126
NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
Definition: color4d.h:56
ZONE_FILL_MODE m_FillMode
How to fill areas: ZONE_FILL_MODE::POLYGONS => use solid polygons ZONE_FILL_MODE::HATCH_PATTERN => us...
Definition: class_zone.h:888
unsigned GetPriority() const
Function GetPriority.
Definition: class_zone.h:106
int GetNet() const
Function GetNet.
Definition: netinfo.h:223
#define _(s)
Definition: 3d_actions.cpp:33
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:125
NETCLASS * GetDefault() const
Function GetDefault.
PCB_EDIT_FRAME is the main frame for Pcbnew.
bool GetDoNotAllowTracks() const
Definition: class_zone.h:715
bool GetDoNotAllowFootprints() const
Definition: class_zone.h:717
EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
bool IsOnCopperLayer() const override
Function IsOnCopperLayer.
Definition: class_zone.cpp:218
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:920

References _, AccumulateDescription(), AREA, BLACK, BLUE, BROWN, DARKCYAN, DARKGREEN, DARKMAGENTA, BOARD_ITEM::GetBoard(), BOARD_CONNECTED_ITEM::GetClearance(), BOARD_DESIGN_SETTINGS::GetDefault(), BOARD::GetDesignSettings(), ZONE_CONTAINER::GetDoNotAllowCopperPour(), ZONE_CONTAINER::GetDoNotAllowFootprints(), ZONE_CONTAINER::GetDoNotAllowPads(), ZONE_CONTAINER::GetDoNotAllowTracks(), ZONE_CONTAINER::GetDoNotAllowVias(), ZONE_CONTAINER::GetIsKeepout(), ZONE_CONTAINER::GetLayer(), BOARD::GetLayerName(), NETCLASS::GetName(), BOARD_CONNECTED_ITEM::GetNet(), NETINFO_ITEM::GetNet(), BOARD_CONNECTED_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetNetCode(), NETINFO_ITEM::GetNetname(), ZONE_CONTAINER::GetPriority(), EDA_BASE_FRAME::GetUserUnits(), HATCH_PATTERN, ZONE_CONTAINER::IsOnCopperLayer(), ZONE_CONTAINER::m_area, ZONE_CONTAINER::m_borderHatchLines, SHAPE_POLY_SET::VERTEX_INDEX::m_contour, ZONE_CONTAINER::m_CornerSelection, ZONE_CONTAINER::m_FilledPolysList, ZONE_CONTAINER::m_FillMode, BOARD_ITEM::m_Layer, ZONE_CONTAINER::m_layerSet, ZONE_CONTAINER::m_zoneName, MessageTextFromValue(), POLYGONS, RED, LSET::Seq(), and UnescapeString().

◆ GetNet()

NETINFO_ITEM* BOARD_CONNECTED_ITEM::GetNet ( ) const
inlineinherited

Function GetNet Returns NET_INFO object for a given item.

Definition at line 81 of file board_connected_item.h.

82  {
83  return m_netinfo;
84  }
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.

References BOARD_CONNECTED_ITEM::m_netinfo.

Referenced by PNS_PCBNEW_RULE_RESOLVER::DpNetPair(), DRAWING_TOOL::DrawVia(), ZONE_CONTAINER::GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase_Common(), BOARD::SetAreasNetCodesFromNetNames(), and PCB_EDIT_FRAME::SetTrackSegmentWidth().

◆ GetNetClass()

NETCLASS * BOARD_CONNECTED_ITEM::GetNetClass ( ) const
inherited

Function GetNetClassPtr returns the NETCLASS for this item.

Note: do NOT return a std::shared_ptr from this. It is used heavily in DRC, and the std::shared_ptr stuff shows up large in performance profiling.

Definition at line 188 of file board_connected_item.cpp.

189 {
190  NETCLASS* netclass = m_netinfo->GetNetClass();
191 
192  if( netclass )
193  return netclass;
194  else
195  return GetBoard()->GetDesignSettings().GetDefault();
196 }
NETCLASS * GetNetClass()
Function GetNetClass.
Definition: netinfo.h:128
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:553
NETCLASS handles a collection of nets and the parameters used to route or test these nets.
Definition: netclass.h:49
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.
NETCLASS * GetDefault() const
Function GetDefault.

References BOARD_ITEM::GetBoard(), BOARD_DESIGN_SETTINGS::GetDefault(), BOARD::GetDesignSettings(), NETINFO_ITEM::GetNetClass(), and BOARD_CONNECTED_ITEM::m_netinfo.

Referenced by VIA::GetDrillValue(), BOARD_CONNECTED_ITEM::GetEffectiveNetclass(), ZONE_CONTAINER::GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase_Common(), ROUTER_TOOL::prepareInteractive(), and DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow().

◆ GetNetClassName()

wxString BOARD_CONNECTED_ITEM::GetNetClassName ( ) const
inherited

Function GetNetClassName returns a pointer to the netclass of the zone.

If the net is not found (can happen when a netlist is reread, and the net name does not exist, return the default net class (should not return a null pointer).

Returns
the Net Class name of this item

Definition at line 199 of file board_connected_item.cpp.

200 {
201  return m_netinfo->GetClassName();
202 }
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.
wxString GetClassName() const
Function GetClassName returns the class name.
Definition: netinfo.h:137

References NETINFO_ITEM::GetClassName(), and BOARD_CONNECTED_ITEM::m_netinfo.

Referenced by BOARD_CONNECTED_ITEM_DESC::BOARD_CONNECTED_ITEM_DESC(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), D_PAD::GetMsgPanelInfo(), main(), and DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem().

◆ GetNetCode()

int BOARD_CONNECTED_ITEM::GetNetCode ( ) const
inlineinherited

Function GetNetCode.

Returns
int - the net code.

Definition at line 99 of file board_connected_item.h.

100  {
101  return m_netinfo ? m_netinfo->GetNet() : -1;
102  }
int GetNet() const
Function GetNet.
Definition: netinfo.h:223
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.

References NETINFO_ITEM::GetNet(), and BOARD_CONNECTED_ITEM::m_netinfo.

Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), BOARD_CONNECTED_ITEM_DESC::BOARD_CONNECTED_ITEM_DESC(), ZONE_FILLER::buildCopperItemClearances(), BOARD::CombineAllAreasInNet(), connectedItemFilter(), CreateRoutesSection(), test::DRC_TEST_PROVIDER_COPPER_CLEARANCE::doPadToPadsDrc(), DRC::doPadToPadsDrc(), test::DRC_TEST_PROVIDER_COPPER_CLEARANCE::doTrackDrc(), DRC::doTrackDrc(), KIGFX::PCB_PAINTER::draw(), DRAWING_TOOL::DrawVia(), PCB_EDIT_FRAME::Exchange_Module(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), PNS::NODE::FindItemByParent(), PCB_IO::format(), DSN::SPECCTRA_DB::FromBOARD(), ZONE_CONTAINER::GetColinearCorners(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), CONNECTIVITY_DATA::GetConnectedItems(), ZONE_CONTAINER::GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), hash_eda(), hasThermalConnection(), DIALOG_PAD_PROPERTIES::initValues(), ZONE_CONTAINER::IsIsland(), ZONE_CONTAINER::IsSame(), DSN::SPECCTRA_DB::makeIMAGE(), AR_AUTOPLACER::nearestPad(), ROUTER_TOOL::NeighboringSegmentFilter(), CN_ITEM::Net(), BOARD::NormalizeAreaPolygon(), BOARD::OnAreaPolygonModified(), TRACK::cmp_tracks::operator()(), ZONE_SETTINGS::operator<<(), DIALOG_PAD_PROPERTIES::PadTypeSelected(), process(), PCB_SELECTION_CONDITIONS::sameNetFunc(), SaveCopyOfZones(), SELECTION_TOOL::selectNet(), BOARD::SetAreasNetCodesFromNetNames(), setupDummyPadForHole(), PNS_KICAD_IFACE_BASE::syncArc(), PNS_KICAD_IFACE_BASE::syncPad(), PNS_KICAD_IFACE_BASE::syncTrack(), PNS_KICAD_IFACE_BASE::syncVia(), BOARD::TestAreaIntersections(), test::DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZones(), DRC::testZones(), BOARD::TracksInNet(), NETINFO_MAPPING::Update(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), and PCB_EDITOR_CONTROL::ZoneMerge().

◆ GetNetname()

const wxString& BOARD_CONNECTED_ITEM::GetNetname ( ) const
inlineinherited

◆ GetNetnameMsg()

wxString BOARD_CONNECTED_ITEM::GetNetnameMsg ( ) const
inlineinherited

Function GetNetnameMsg.

Returns
wxString - the full netname or "<no net>" in square braces, followed by "(Not Found)" if the netcode is undefined.

Definition at line 134 of file board_connected_item.h.

135  {
136  if( !GetBoard() )
137  return wxT( "[** NO BOARD DEFINED **]" );
138 
139  wxString netname = GetNetname();
140 
141  if( !netname.length() )
142  return wxT( "[<no net>]" );
143  else if( GetNetCode() < 0 )
144  return wxT( "[" + UnescapeString( netname ) + "](" + _( "Not Found" ) + ")" );
145  else
146  return wxT( "[" + UnescapeString( netname ) + "]" );
147  }
int GetNetCode() const
Function GetNetCode.
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
const wxString & GetNetname() const
Function GetNetname.
#define _(s)
Definition: 3d_actions.cpp:33
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:125

References _, BOARD_ITEM::GetBoard(), BOARD_CONNECTED_ITEM::GetNetCode(), BOARD_CONNECTED_ITEM::GetNetname(), and UnescapeString().

Referenced by TRACK::GetSelectMenuText(), VIA::GetSelectMenuText(), and ZONE_CONTAINER::GetSelectMenuText().

◆ GetNumCorners()

int ZONE_CONTAINER::GetNumCorners ( void  ) const
inlineinherited

Access to m_Poly parameters.

Definition at line 489 of file class_zone.h.

490  {
491  return m_Poly->TotalVertices();
492  }
int TotalVertices() const
Returns total number of vertices stored in the set.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:826

References ZONE_CONTAINER::m_Poly, and SHAPE_POLY_SET::TotalVertices().

Referenced by ZONE_CONTAINER::BuildSmoothedPoly(), PCB_IO::format(), and BOARD::OnAreaPolygonModified().

◆ GetPadConnection()

ZONE_CONNECTION ZONE_CONTAINER::GetPadConnection ( D_PAD aPad = NULL) const
inherited

Definition at line 818 of file class_zone.cpp.

819 {
821  return m_PadConnection;
822  else
823  return aPad->GetEffectiveZoneConnection();
824 }
ZONE_CONNECTION m_PadConnection
Definition: class_zone.h:855
#define NULL
ZONE_CONNECTION GetEffectiveZoneConnection() const
Return the zone connection in effect (either locally overridden or overridden in the parent module).
Definition: class_pad.cpp:700

References D_PAD::GetEffectiveZoneConnection(), INHERITED, ZONE_CONTAINER::m_PadConnection, and NULL.

Referenced by ZONE_FILLER::buildCopperItemClearances(), PCB_IO::format(), hasThermalConnection(), ZONE_SETTINGS::operator<<(), and BOARD::TestAreaIntersections().

◆ GetParent()

BOARD_ITEM_CONTAINER* BOARD_ITEM::GetParent ( void  ) const
inlineinherited

Definition at line 174 of file class_board_item.h.

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

References EDA_ITEM::m_Parent.

Referenced by POINT_EDITOR::addCorner(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), BOARD_ITEM::DeleteStructure(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), KIGFX::PCB_PAINTER::draw(), EDIT_TOOL::Duplicate(), EditToolSelectionFilter(), PCB_IO::format(), FormatProbeItem(), BOARD_ITEM::GetBoard(), MARKER_PCB::GetColorLayer(), EDGE_MODULE::GetMsgPanelInfo(), EDGE_MODULE::GetSelectMenuText(), TEXTE_MODULE::GetSelectMenuText(), TEXTE_PCB::GetShownText(), TEXTE_MODULE::GetShownText(), SELECTION_TOOL::GuessSelectionCandidates(), GENERAL_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), EDGE_MODULE::IsParentFlipped(), TEXTE_MODULE::IsParentFlipped(), LEGACY_PLUGIN::loadMODULE_TEXT(), ALTIUM_PCB::ParseTexts6Data(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), CLIPBOARD_IO::SaveSelection(), SELECTION_TOOL::select(), SELECTION_TOOL::Selectable(), SwapItemData(), test::DRC_TEST_PROVIDER_COPPER_CLEARANCE::testCopperDrawItem(), DRC::testCopperDrawItem(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), MARKER_PCB::ViewGetLayers(), ViewGetLOD(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ GetPosition()

wxPoint ZONE_CONTAINER::GetPosition ( ) const
overridevirtualinherited
Returns
a wxPoint, position of the first point of the outline

Reimplemented from EDA_ITEM.

Definition at line 206 of file class_zone.cpp.

207 {
208  return (wxPoint) GetCornerPosition( 0 );
209 }
const VECTOR2I & GetCornerPosition(int aCornerIndex) const
Definition: class_zone.h:529

References ZONE_CONTAINER::GetCornerPosition().

Referenced by EAGLE_PLUGIN::loadPlain(), PNS_KICAD_IFACE_BASE::syncZone(), and DRC::testZones().

◆ GetPriority()

◆ GetRuleClearance()

bool BOARD_CONNECTED_ITEM::GetRuleClearance ( BOARD_ITEM aItem,
PCB_LAYER_ID  aLayer,
int *  aClearance,
wxString *  aSource 
) const
virtualinherited

Function GetRuleClearance returns any rule-based clearance.

Parameters
aLayerthe current layer under test
aClearance[out] the clearance value in internal units
aSource[out] reports the source as a user-readable string
Returns
true if a rule was fired

Definition at line 167 of file board_connected_item.cpp.

169 {
170  const DRC_CONSTRAINT* constraint = GetConstraint( this, aItem, DRC_RULE_ID_CLEARANCE, aLayer,
171  aSource );
172 
173  if( constraint )
174  {
175  if( aSource )
176  *aSource = wxString::Format( _( "'%s' rule" ), *aSource );
177 
178  *aClearance = constraint->m_Value.Min();
179  return true;
180  }
181 
182  return false;
183 }
MINOPTMAX< int > m_Value
const DRC_CONSTRAINT * GetConstraint(const BOARD_ITEM *aItem, const BOARD_ITEM *bItem, int aConstraint, PCB_LAYER_ID aLayer, wxString *aRuleName)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:33

References _, DRC_RULE_ID_CLEARANCE, Format(), GetConstraint(), DRC_CONSTRAINT::m_Value, and MINOPTMAX< T >::Min().

Referenced by DRC::doTrackDrc(), and BOARD_CONNECTED_ITEM::GetClearance().

◆ GetSelectedCorner()

int ZONE_CONTAINER::GetSelectedCorner ( ) const
inlineinherited

Definition at line 236 of file class_zone.h.

237  {
238  // Transform relative indices to global index
239  int globalIndex = -1;
240 
241  if( m_CornerSelection )
242  m_Poly->GetGlobalIndex( *m_CornerSelection, globalIndex );
243 
244  return globalIndex;
245  }
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: class_zone.h:902
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:826
bool GetGlobalIndex(VERTEX_INDEX aRelativeIndices, int &aGlobalIdx)
Function GetGlobalIndex computes the global index of a vertex from the relative indices of polygon,...

References SHAPE_POLY_SET::GetGlobalIndex(), ZONE_CONTAINER::m_CornerSelection, and ZONE_CONTAINER::m_Poly.

◆ GetSelectMenuText()

wxString ZONE_CONTAINER::GetSelectMenuText ( EDA_UNITS  aUnits) const
overridevirtualinherited

Function GetSelectMenuText returns the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position.

The default version of this function raises an assertion in the debug mode and returns a string to indicate that it was not overridden to provide the object specific text.

Returns
The menu text string.

Reimplemented from EDA_ITEM.

Definition at line 893 of file class_zone.cpp.

894 {
895  wxString text;
896 
897  // Check whether the selected contour is a hole (contour index > 0)
898  if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
899  text << wxT( " " ) << _( "(Cutout)" );
900 
901  if( GetIsKeepout() )
902  text << wxT( " " ) << _( "(Keepout)" );
903  else
904  text << GetNetnameMsg();
905 
906  wxString layerDesc;
907  int count = 0;
908 
909  for( PCB_LAYER_ID layer : m_layerSet.Seq() )
910  {
911  if( count == 0 )
912  layerDesc = GetBoard()->GetLayerName( layer );
913 
914  count++;
915  }
916 
917  if( count > 1 )
918  layerDesc.Printf( _( "%s and %d more" ), layerDesc, count - 1 );
919 
920  return wxString::Format( _( "Zone Outline %s on %s" ), text, layerDesc );
921 }
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer.
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: class_zone.h:902
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Function Seq returns an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:377
PCB_LAYER_ID
A quick note on layer IDs:
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:712
wxString GetNetnameMsg() const
Function GetNetnameMsg.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:33

References _, Format(), BOARD_ITEM::GetBoard(), ZONE_CONTAINER::GetIsKeepout(), BOARD::GetLayerName(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), SHAPE_POLY_SET::VERTEX_INDEX::m_contour, ZONE_CONTAINER::m_CornerSelection, ZONE_CONTAINER::m_layerSet, and LSET::Seq().

Referenced by PNS_KICAD_IFACE_BASE::syncZone().

◆ GetShortNetname()

const wxString& BOARD_CONNECTED_ITEM::GetShortNetname ( ) const
inlineinherited

Function GetShortNetname.

Returns
wxString - the short netname

Definition at line 153 of file board_connected_item.h.

154  {
155  return m_netinfo->GetShortNetname();
156  }
const wxString & GetShortNetname() const
Function GetShortNetname.
Definition: netinfo.h:237
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.

References NETINFO_ITEM::GetShortNetname(), and BOARD_CONNECTED_ITEM::m_netinfo.

Referenced by KIGFX::PCB_PAINTER::draw().

◆ GetState()

int EDA_ITEM::GetState ( int  type) const
inlineinherited

Definition at line 216 of file base_struct.h.

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

References EDA_ITEM::m_Status.

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

◆ GetStatus()

STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 229 of file base_struct.h.

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

References EDA_ITEM::m_Status.

Referenced by PCB_IO::format().

◆ GetThermalReliefCopperBridge()

int ZONE_CONTAINER::GetThermalReliefCopperBridge ( D_PAD aPad = NULL) const
inherited

Definition at line 330 of file class_zone.cpp.

331 {
332  if( aPad == NULL || aPad->GetThermalWidth() == 0 )
334  else
335  return aPad->GetThermalWidth();
336 }
int m_ThermalReliefCopperBridge
Definition: class_zone.h:881
#define NULL
int GetThermalWidth() const
Definition: class_pad.cpp:711

References D_PAD::GetThermalWidth(), ZONE_CONTAINER::m_ThermalReliefCopperBridge, and NULL.

Referenced by ZONE_FILLER::buildThermalSpokes(), PCB_IO::format(), ZONE_SETTINGS::operator<<(), and BOARD::TestAreaIntersections().

◆ GetThermalReliefGap()

int ZONE_CONTAINER::GetThermalReliefGap ( D_PAD aPad = NULL) const
inherited

Definition at line 321 of file class_zone.cpp.

322 {
323  if( aPad == NULL || aPad->GetThermalGap() == 0 )
324  return m_ThermalReliefGap;
325  else
326  return aPad->GetThermalGap();
327 }
int GetThermalGap() const
Definition: class_pad.cpp:722
#define NULL
int m_ThermalReliefGap
Width of the copper bridge in thermal reliefs.
Definition: class_zone.h:878

References D_PAD::GetThermalGap(), ZONE_CONTAINER::m_ThermalReliefGap, and NULL.

Referenced by ZONE_FILLER::buildCopperItemClearances(), ZONE_FILLER::buildThermalSpokes(), PCB_IO::format(), hasThermalConnection(), ZONE_FILLER::knockoutThermalReliefs(), ZONE_SETTINGS::operator<<(), and BOARD::TestAreaIntersections().

◆ GetX()

int BOARD_ITEM::GetX ( ) const
inlineinherited

◆ GetY()

int BOARD_ITEM::GetY ( ) const
inlineinherited

◆ GetZoneClearance()

int ZONE_CONTAINER::GetZoneClearance ( ) const
inlineinherited

◆ GetZoneName()

wxString ZONE_CONTAINER::GetZoneName ( ) const
inlineinherited

Definition at line 114 of file class_zone.h.

114 { return m_zoneName; }
wxString m_zoneName
An optional unique name for this zone, used for identifying it in DRC checking.
Definition: class_zone.h:831

References ZONE_CONTAINER::m_zoneName.

Referenced by PCB_IO::format(), ZONE_SETTINGS::operator<<(), and ZONE_CONTAINER_DESC::ZONE_CONTAINER_DESC().

◆ HasFilledPolysForLayer()

bool ZONE_CONTAINER::HasFilledPolysForLayer ( PCB_LAYER_ID  aLayer) const
inlineinherited

Definition at line 602 of file class_zone.h.

603  {
604  return m_FilledPolysList.count( aLayer ) > 0;
605  }
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:920

References ZONE_CONTAINER::m_FilledPolysList.

Referenced by DRC::GetLocation().

◆ HasFlag()

◆ HatchBorder()

void ZONE_CONTAINER::HatchBorder ( )
inherited

Function HatchBorder computes the hatch lines depending on the hatch parameters and stores it in the zone's attribute m_borderHatchLines.

Definition at line 961 of file class_zone.cpp.

962 {
963  UnHatchBorder();
964 
966  || m_borderHatchPitch == 0
967  || m_Poly->IsEmpty() )
968  {
969  return;
970  }
971 
972  // define range for hatch lines
973  int min_x = m_Poly->CVertex( 0 ).x;
974  int max_x = m_Poly->CVertex( 0 ).x;
975  int min_y = m_Poly->CVertex( 0 ).y;
976  int max_y = m_Poly->CVertex( 0 ).y;
977 
978  for( auto iterator = m_Poly->IterateWithHoles(); iterator; iterator++ )
979  {
980  if( iterator->x < min_x )
981  min_x = iterator->x;
982 
983  if( iterator->x > max_x )
984  max_x = iterator->x;
985 
986  if( iterator->y < min_y )
987  min_y = iterator->y;
988 
989  if( iterator->y > max_y )
990  max_y = iterator->y;
991  }
992 
993  // Calculate spacing between 2 hatch lines
994  int spacing;
995 
997  spacing = m_borderHatchPitch;
998  else
999  spacing = m_borderHatchPitch * 2;
1000 
1001  // set the "length" of hatch lines (the length on horizontal axis)
1002  int hatch_line_len = m_borderHatchPitch;
1003 
1004  // To have a better look, give a slope depending on the layer
1005  LAYER_NUM layer = GetLayer();
1006  int slope_flag = (layer & 1) ? 1 : -1; // 1 or -1
1007  double slope = 0.707106 * slope_flag; // 45 degrees slope
1008  int max_a, min_a;
1009 
1010  if( slope_flag == 1 )
1011  {
1012  max_a = KiROUND( max_y - slope * min_x );
1013  min_a = KiROUND( min_y - slope * max_x );
1014  }
1015  else
1016  {
1017  max_a = KiROUND( max_y - slope * max_x );
1018  min_a = KiROUND( min_y - slope * min_x );
1019  }
1020 
1021  min_a = (min_a / spacing) * spacing;
1022 
1023  // calculate an offset depending on layer number,
1024  // for a better look of hatches on a multilayer board
1025  int offset = (layer * 7) / 8;
1026  min_a += offset;
1027 
1028  // loop through hatch lines
1029  #define MAXPTS 200 // Usually we store only few values per one hatch line
1030  // depending on the complexity of the zone outline
1031 
1032  static std::vector<VECTOR2I> pointbuffer;
1033  pointbuffer.clear();
1034  pointbuffer.reserve( MAXPTS + 2 );
1035 
1036  for( int a = min_a; a < max_a; a += spacing )
1037  {
1038  // get intersection points for this hatch line
1039 
1040  // Note: because we should have an even number of intersections with the
1041  // current hatch line and the zone outline (a closed polygon,
1042  // or a set of closed polygons), if an odd count is found
1043  // we skip this line (should not occur)
1044  pointbuffer.clear();
1045 
1046  // Iterate through all vertices
1047  for( auto iterator = m_Poly->IterateSegmentsWithHoles(); iterator; iterator++ )
1048  {
1049  double x, y, x2, y2;
1050  int ok;
1051 
1052  SEG segment = *iterator;
1053 
1054  ok = FindLineSegmentIntersection( a, slope,
1055  segment.A.x, segment.A.y,
1056  segment.B.x, segment.B.y,
1057  &x, &y, &x2, &y2 );
1058 
1059  if( ok )
1060  {
1061  VECTOR2I point( KiROUND( x ), KiROUND( y ) );
1062  pointbuffer.push_back( point );
1063  }
1064 
1065  if( ok == 2 )
1066  {
1067  VECTOR2I point( KiROUND( x2 ), KiROUND( y2 ) );
1068  pointbuffer.push_back( point );
1069  }
1070 
1071  if( pointbuffer.size() >= MAXPTS ) // overflow
1072  {
1073  wxASSERT( 0 );
1074  break;
1075  }
1076  }
1077 
1078  // ensure we have found an even intersection points count
1079  // because intersections are the ends of segments
1080  // inside the polygon(s) and a segment has 2 ends.
1081  // if not, this is a strange case (a bug ?) so skip this hatch
1082  if( pointbuffer.size() % 2 != 0 )
1083  continue;
1084 
1085  // sort points in order of descending x (if more than 2) to
1086  // ensure the starting point and the ending point of the same segment
1087  // are stored one just after the other.
1088  if( pointbuffer.size() > 2 )
1089  sort( pointbuffer.begin(), pointbuffer.end(), sortEndsByDescendingX );
1090 
1091  // creates lines or short segments inside the complex polygon
1092  for( unsigned ip = 0; ip < pointbuffer.size(); ip += 2 )
1093  {
1094  int dx = pointbuffer[ip + 1].x - pointbuffer[ip].x;
1095 
1096  // Push only one line for diagonal hatch,
1097  // or for small lines < twice the line length
1098  // else push 2 small lines
1100  || std::abs( dx ) < 2 * hatch_line_len )
1101  {
1102  m_borderHatchLines.emplace_back( SEG( pointbuffer[ip], pointbuffer[ ip + 1] ) );
1103  }
1104  else
1105  {
1106  double dy = pointbuffer[ip + 1].y - pointbuffer[ip].y;
1107  slope = dy / dx;
1108 
1109  if( dx > 0 )
1110  dx = hatch_line_len;
1111  else
1112  dx = -hatch_line_len;
1113 
1114  int x1 = KiROUND( pointbuffer[ip].x + dx );
1115  int x2 = KiROUND( pointbuffer[ip + 1].x - dx );
1116  int y1 = KiROUND( pointbuffer[ip].y + dx * slope );
1117  int y2 = KiROUND( pointbuffer[ip + 1].y - dx * slope );
1118 
1119  m_borderHatchLines.emplace_back( SEG( pointbuffer[ip].x, pointbuffer[ip].y, x1, y1 ) );
1120 
1121  m_borderHatchLines.emplace_back( SEG( pointbuffer[ip+1].x, pointbuffer[ip+1].y, x2, y2 ) );
1122  }
1123  }
1124  }
1125 }
std::vector< SEG > m_borderHatchLines
Definition: class_zone.h:928
SEGMENT_ITERATOR IterateSegmentsWithHoles()
Returns an iterator object, for all outlines in the set (with holes)
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Returns the index-th vertex in a given hole outline within a given outline
bool IsEmpty() const
Returns true if the set is empty (no polygons at all)
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:212
ZONE_BORDER_DISPLAY_STYLE m_borderStyle
Definition: class_zone.h:926
#define MAXPTS
bool sortEndsByDescendingX(const VECTOR2I &ref, const VECTOR2I &tst)
Definition: class_zone.cpp:955
ITERATOR IterateWithHoles(int aOutline)
Function IterateWithHoles.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:826
void UnHatchBorder()
Function UnHatchBorder clears the zone's hatch.
Definition: class_zone.cpp:947
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
Definition: seg.h:39
VECTOR2I A
Definition: seg.h:47
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68
int m_borderHatchPitch
Definition: class_zone.h:927
VECTOR2I B
Definition: seg.h:48

References SEG::A, SEG::B, SHAPE_POLY_SET::CVertex(), DIAGONAL_EDGE, DIAGONAL_FULL, ZONE_CONTAINER::GetLayer(), SHAPE_POLY_SET::IsEmpty(), SHAPE_POLY_SET::IterateSegmentsWithHoles(), SHAPE_POLY_SET::IterateWithHoles(), KiROUND(), ZONE_CONTAINER::m_borderHatchLines, ZONE_CONTAINER::m_borderHatchPitch, ZONE_CONTAINER::m_borderStyle, ZONE_CONTAINER::m_Poly, MAXPTS, NO_HATCH, sortEndsByDescendingX(), ZONE_CONTAINER::UnHatchBorder(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by BOARD::CombineAreas(), ZONE_CONTAINER::Mirror(), ZONE_CONTAINER::Move(), ZONE_CONTAINER::MoveEdge(), BOARD::NormalizeAreaPolygon(), ZONE_CONTAINER::Rotate(), ZONE_CONTAINER::SetBorderDisplayStyle(), and POINT_EDITOR::updateItem().

◆ HitTest() [1/2]

bool ZONE_CONTAINER::HitTest ( const wxPoint aPosition,
int  aAccuracy = 0 
) const
overridevirtualinherited

Function HitTest tests if a point is near an outline edge or a corner of this zone.

Parameters
aPositionthe wxPoint to test
Returns
bool - true if a hit, else false

Reimplemented from EDA_ITEM.

Definition at line 425 of file class_zone.cpp.

426 {
427  // Normally accuracy is zoom-relative, but for the generic HitTest we just use
428  // a fixed (small) value.
429  int accuracy = std::max( aAccuracy, Millimeter2iu( 0.1 ) );
430 
431  return HitTestForCorner( aPosition, accuracy * 2 ) || HitTestForEdge( aPosition, accuracy );
432 }
bool HitTestForCorner(const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
Function HitTestForCorner tests if the given wxPoint is near a corner.
Definition: class_zone.cpp:450
bool HitTestForEdge(const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
Function HitTestForEdge tests if the given wxPoint is near a segment defined by 2 corners.
Definition: class_zone.cpp:464
static constexpr int Millimeter2iu(double mm)

References ZONE_CONTAINER::HitTestForCorner(), ZONE_CONTAINER::HitTestForEdge(), and Millimeter2iu().

◆ HitTest() [2/2]

bool ZONE_CONTAINER::HitTest ( const EDA_RECT aRect,
bool  aContained = true,
int  aAccuracy = 0 
) const
overridevirtualinherited

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

Reimplemented from EDA_ITEM.

Definition at line 478 of file class_zone.cpp.

479 {
480  // Calculate bounding box for zone
481  EDA_RECT bbox = GetBoundingBox();
482  bbox.Normalize();
483 
484  EDA_RECT arect = aRect;
485  arect.Normalize();
486  arect.Inflate( aAccuracy );
487 
488  if( aContained )
489  {
490  return arect.Contains( bbox );
491  }
492  else // Test for intersection between aBox and the polygon
493  // For a polygon, using its bounding box has no sense here
494  {
495  // Fast test: if aBox is outside the polygon bounding box, rectangles cannot intersect
496  if( !arect.Intersects( bbox ) )
497  return false;
498 
499  int count = m_Poly->TotalVertices();
500 
501  for( int ii = 0; ii < count; ii++ )
502  {
503  auto vertex = m_Poly->CVertex( ii );
504  auto vertexNext = m_Poly->CVertex( ( ii + 1 ) % count );
505 
506  // Test if the point is within the rect
507  if( arect.Contains( ( wxPoint ) vertex ) )
508  {
509  return true;
510  }
511 
512  // Test if this edge intersects the rect
513  if( arect.Intersects( ( wxPoint ) vertex, ( wxPoint ) vertexNext ) )
514  {
515  return true;
516  }
517  }
518 
519  return false;
520  }
521 }
int TotalVertices() const
Returns total number of vertices stored in the set.
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox (virtual)
Definition: class_zone.cpp:311
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Returns the index-th vertex in a given hole outline within a given outline
bool Contains(const wxPoint &aPoint) const
Function Contains.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:826
void Normalize()
Function Normalize ensures that the height ant width are positive.
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.

References EDA_RECT::Contains(), SHAPE_POLY_SET::CVertex(), ZONE_CONTAINER::GetBoundingBox(), EDA_RECT::Inflate(), EDA_RECT::Intersects(), ZONE_CONTAINER::m_Poly, EDA_RECT::Normalize(), and SHAPE_POLY_SET::TotalVertices().

◆ HitTestCutout() [1/2]

bool ZONE_CONTAINER::HitTestCutout ( const VECTOR2I aRefPos,
int *  aOutlineIdx = nullptr,
int *  aHoleIdx = nullptr 
) const
inherited

Tests if the given point is contained within a cutout of the zone.

Parameters
aRefPosis the point to test
aOutlineIdxis the index of the outline containing the cutout
aHoleIdxis the index of the hole
Returns
true if aRefPos is inside a zone cutout

Definition at line 552 of file class_zone.cpp.

553 {
554  // Iterate over each outline polygon in the zone and then iterate over
555  // each hole it has to see if the point is in it.
556  for( int i = 0; i < m_Poly->OutlineCount(); i++ )
557  {
558  for( int j = 0; j < m_Poly->HoleCount( i ); j++ )
559  {
560  if( m_Poly->Hole( i, j ).PointInside( aRefPos ) )
561  {
562  if( aOutlineIdx )
563  *aOutlineIdx = i;
564 
565  if( aHoleIdx )
566  *aHoleIdx = j;
567 
568  return true;
569  }
570  }
571  }
572 
573  return false;
574 }
int OutlineCount() const
Returns the number of outlines in the set
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Returns the reference to aHole-th hole in the aIndex-th outline
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:826
int HoleCount(int aOutline) const
Returns the number of holes in a given outline
bool PointInside(const VECTOR2I &aPt, int aAccuracy=0, bool aUseBBoxCache=false) const
Function PointInside()

References SHAPE_POLY_SET::Hole(), SHAPE_POLY_SET::HoleCount(), ZONE_CONTAINER::m_Poly, SHAPE_POLY_SET::OutlineCount(), and SHAPE_LINE_CHAIN::PointInside().

Referenced by ZONE_CONTAINER::HitTestCutout().

◆ HitTestCutout() [2/2]

bool ZONE_CONTAINER::HitTestCutout ( const wxPoint aRefPos,
int *  aOutlineIdx = nullptr,
int *  aHoleIdx = nullptr 
) const
inlineinherited

Definition at line 316 of file class_zone.h.

318  {
319  return HitTestCutout( VECTOR2I( aRefPos.x, aRefPos.y ), aOutlineIdx, aHoleIdx );
320  }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
bool HitTestCutout(const VECTOR2I &aRefPos, int *aOutlineIdx=nullptr, int *aHoleIdx=nullptr) const
Tests if the given point is contained within a cutout of the zone.
Definition: class_zone.cpp:552

References ZONE_CONTAINER::HitTestCutout(), wxPoint::x, and wxPoint::y.

◆ HitTestFilledArea()

bool ZONE_CONTAINER::HitTestFilledArea ( PCB_LAYER_ID  aLayer,
const wxPoint aRefPos,
int  aAccuracy = 0 
) const
inherited

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

Parameters
aLayeris the layer to test on
aRefPosA wxPoint to test
aAccuracyExpand the distance by which the areas are expanded for the hittest
Returns
bool - true if a hit, else false

Definition at line 536 of file class_zone.cpp.

538 {
539  // Keepouts have no filled area, but it's generally nice to treat their interior as if it were
540  // filled so that people don't have to select keepouts by their outline (which is min-width)
541  if( GetIsKeepout() )
542  return m_Poly->Contains( VECTOR2I( aRefPos.x, aRefPos.y ), -1, aAccuracy );
543 
544  if( !m_FilledPolysList.count( aLayer ) )
545  return false;
546 
547  return m_FilledPolysList.at( aLayer ).Contains( VECTOR2I( aRefPos.x, aRefPos.y ), -1,
548  aAccuracy );
549 }
bool Contains(const VECTOR2I &aP, int aSubpolyIndex=-1, int aAccuracy=0, bool aUseBBoxCaches=false) const
Returns true if a given subpolygon contains the point aP.
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:826
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:712
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:920

References SHAPE_POLY_SET::Contains(), ZONE_CONTAINER::GetIsKeepout(), ZONE_CONTAINER::m_FilledPolysList, ZONE_CONTAINER::m_Poly, wxPoint::x, and wxPoint::y.

Referenced by CN_ANCHOR::ConnectedItemsCount(), GENERAL_COLLECTOR::Inspect(), and CN_ANCHOR::IsDangling().

◆ HitTestForCorner() [1/2]

bool ZONE_CONTAINER::HitTestForCorner ( const wxPoint refPos,
int  aAccuracy,
SHAPE_POLY_SET::VERTEX_INDEX aCornerHit 
) const
inherited

Function HitTestForCorner tests if the given wxPoint is near a corner.

Parameters
refPosis the wxPoint to test.
aAccuracyincrease the item bounding box by this amount.
aCornerHit[out] is the index of the closest vertex found, useless when return value is false.
Returns
bool - true if some corner was found to be closer to refPos than aClearance; false otherwise.

Definition at line 450 of file class_zone.cpp.

452 {
453  return m_Poly->CollideVertex( VECTOR2I( refPos ), aCornerHit, aAccuracy );
454 }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:826
bool CollideVertex(const VECTOR2I &aPoint, VERTEX_INDEX &aClosestVertex, int aClearance=0) const
Function CollideVertex Checks whether aPoint collides with any vertex of any of the contours of the p...

References SHAPE_POLY_SET::CollideVertex(), and ZONE_CONTAINER::m_Poly.

Referenced by ZONE_CONTAINER::HitTest(), ZONE_CONTAINER::HitTestForCorner(), GENERAL_COLLECTOR::Inspect(), and ZONE_CONTAINER::SetSelectedCorner().

◆ HitTestForCorner() [2/2]

bool ZONE_CONTAINER::HitTestForCorner ( const wxPoint refPos,
int  aAccuracy 
) const
inherited

Function HitTestForCorner tests if the given wxPoint is near a corner.

Parameters
refPosis the wxPoint to test.
aAccuracyincrease the item bounding box by this amount.
Returns
bool - true if some corner was found to be closer to refPos than aClearance; false otherwise.

Definition at line 457 of file class_zone.cpp.

458 {
460  return HitTestForCorner( refPos, aAccuracy, dummy );
461 }
bool HitTestForCorner(const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
Function HitTestForCorner tests if the given wxPoint is near a corner.
Definition: class_zone.cpp:450
Struct VERTEX_INDEX.
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.

References dummy(), and ZONE_CONTAINER::HitTestForCorner().

◆ HitTestForEdge() [1/2]

bool ZONE_CONTAINER::HitTestForEdge ( const wxPoint refPos,
int  aAccuracy,
SHAPE_POLY_SET::VERTEX_INDEX aCornerHit 
) const
inherited

Function HitTestForEdge tests if the given wxPoint is near a segment defined by 2 corners.

Parameters
refPosis the wxPoint to test.
aAccuracyincrease the item bounding box by this amount.
aCornerHit[out] is the index of the closest vertex found, useless when return value is false.
Returns
bool - true if some edge was found to be closer to refPos than aClearance.

Definition at line 464 of file class_zone.cpp.

466 {
467  return m_Poly->CollideEdge( VECTOR2I( refPos ), aCornerHit, aAccuracy );
468 }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:826
bool CollideEdge(const VECTOR2I &aPoint, VERTEX_INDEX &aClosestVertex, int aClearance=0) const
Function CollideEdge Checks whether aPoint collides with any edge of any of the contours of the polyg...

References SHAPE_POLY_SET::CollideEdge(), and ZONE_CONTAINER::m_Poly.

Referenced by ZONE_CONTAINER::HitTest(), ZONE_CONTAINER::HitTestForEdge(), GENERAL_COLLECTOR::Inspect(), and ZONE_CONTAINER::SetSelectedCorner().

◆ HitTestForEdge() [2/2]

bool ZONE_CONTAINER::HitTestForEdge ( const wxPoint refPos,
int  aAccuracy 
) const
inherited

Function HitTestForEdge tests if the given wxPoint is near a segment defined by 2 corners.

Parameters
refPosis the wxPoint to test.
aAccuracyincrease the item bounding box by this amount.
Returns
bool - true if some edge was found to be closer to refPos than aClearance.

Definition at line 471 of file class_zone.cpp.

472 {
474  return HitTestForEdge( refPos, aAccuracy, dummy );
475 }
Struct VERTEX_INDEX.
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
bool HitTestForEdge(const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
Function HitTestForEdge tests if the given wxPoint is near a segment defined by 2 corners.
Definition: class_zone.cpp:464

References dummy(), and ZONE_CONTAINER::HitTestForEdge().

◆ InitDataFromSrcInCopyCtor()

void ZONE_CONTAINER::InitDataFromSrcInCopyCtor ( const ZONE_CONTAINER aZone)
inherited

Copy aZone data to me.

Definition at line 102 of file class_zone.cpp.

103 {
104  // members are expected non initialize in this.
105  // InitDataFromSrcInCopyCtor() is expected to be called
106  // only from a copy constructor.
107 
108  // Copy only useful EDA_ITEM flags:
109  m_Flags = aZone.m_Flags;
111 
112  // Replace the outlines for aZone outlines.
113  delete m_Poly;
114  m_Poly = new SHAPE_POLY_SET( *aZone.m_Poly );
115 
118  m_zoneName = aZone.m_zoneName;
119  SetLayerSet( aZone.GetLayerSet() );
120  m_priority = aZone.m_priority;
121  m_isKeepout = aZone.m_isKeepout;
122 
128 
130  m_ZoneClearance = aZone.m_ZoneClearance; // clearance value
135 
136  m_IsFilled = aZone.m_IsFilled;
137  m_needRefill = aZone.m_needRefill;
138 
141 
142  m_FillMode = aZone.m_FillMode; // Filling mode (segments/polygons)
144  m_hatchGap = aZone.m_hatchGap;
150 
151  // For corner moving, corner index to drag, or nullptr if no selection
152  delete m_CornerSelection;
153  m_CornerSelection = nullptr;
154 
155  for( PCB_LAYER_ID layer : aZone.GetLayerSet().Seq() )
156  {
157  m_FilledPolysList[layer] = aZone.m_FilledPolysList.at( layer );
158  m_RawPolysList[layer] = aZone.m_RawPolysList.at( layer );
159  m_filledPolysHash[layer] = aZone.m_filledPolysHash.at( layer );
160  m_FillSegmList[layer] = aZone.m_FillSegmList.at( layer ); // vector <> copy
161  m_insulatedIslands[layer] = aZone.m_insulatedIslands.at( layer );
162  }
163 
167 
168  SetLocalFlags( aZone.GetLocalFlags() );
169 
170  m_netinfo = aZone.m_netinfo;
171 
172  m_hv45 = aZone.m_hv45;
173  m_area = aZone.m_area;
174 
175 }
int m_hatchBorderAlgorithm
Definition: class_zone.h:898
int m_ZoneClearance
Clearance value in internal units.
Definition: class_zone.h:856
std::vector< SEG > m_borderHatchLines
Definition: class_zone.h:928
double m_hatchSmoothingValue
Definition: class_zone.h:896
ISLAND_REMOVAL_MODE m_islandRemovalMode
Definition: class_zone.h:860
bool m_doNotAllowPads
Definition: class_zone.h:852
bool m_doNotAllowTracks
Definition: class_zone.h:851
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: class_zone.h:902
long long int m_minIslandArea
When island removal mode is set to AREA, islands below this area will be removed.
Definition: class_zone.h:866
std::map< PCB_LAYER_ID, std::set< int > > m_insulatedIslands
For each layer, a set of insulated islands that were not removed.
Definition: class_zone.h:931
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Function Seq returns an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:377
bool m_doNotAllowFootprints
Definition: class_zone.h:853
ZONE_BORDER_DISPLAY_STYLE m_borderStyle
Definition: class_zone.h:926
ZONE_CONNECTION m_PadConnection
Definition: class_zone.h:855
virtual LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_zone.cpp:288
void SetLayerSet(LSET aLayerSet)
Definition: class_zone.cpp:240
wxString m_zoneName
An optional unique name for this zone, used for identifying it in DRC checking.
Definition: class_zone.h:831
PCB_LAYER_ID
A quick note on layer IDs:
int m_ThermalReliefCopperBridge
Definition: class_zone.h:881
double m_hatchOrientation
Definition: class_zone.h:891
SHAPE_POLY_SET.
bool m_IsFilled
True when a zone was filled, false after deleting the filled areas.
Definition: class_zone.h:869
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:826
unsigned m_priority
Definition: class_zone.h:839
bool m_doNotAllowVias
Definition: class_zone.h:850
int m_cornerSmoothingType
Definition: class_zone.h:827
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_RawPolysList
Definition: class_zone.h:921
std::map< PCB_LAYER_ID, MD5_HASH > m_filledPolysHash
A hash value used in zone filling calculations to see if the filled areas are up to date.
Definition: class_zone.h:924
double m_hatchHoleMinArea
Definition: class_zone.h:897
unsigned int m_cornerRadius
Definition: class_zone.h:828
bool m_doNotAllowCopperPour
Definition: class_zone.h:849
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:910
int m_ThermalReliefGap
Width of the copper bridge in thermal reliefs.
Definition: class_zone.h:878
int m_ZoneMinThickness
Minimum thickness value in filled areas.
Definition: class_zone.h:857
ZONE_FILL_MODE m_FillMode
How to fill areas: ZONE_FILL_MODE::POLYGONS => use solid polygons ZONE_FILL_MODE::HATCH_PATTERN => us...
Definition: class_zone.h:888
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.
STATUS_FLAGS m_Flags
Definition: base_struct.h:176
void SetLocalFlags(int aFlags)
Definition: class_zone.h:268
bool m_needRefill
False when a zone was refilled, true after changes in zone params.
Definition: class_zone.h:875
int m_hatchSmoothingLevel
Definition: class_zone.h:892
int m_hatchThickness
Definition: class_zone.h:889
bool m_forceVisible
Definition: base_struct.h:175
int GetLocalFlags() const
Definition: class_zone.h:267
int m_borderHatchPitch
Definition: class_zone.h:927
bool m_FilledPolysUseThickness
outline of filled polygons have thickness.
Definition: class_zone.h:858
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:920

References ZONE_CONTAINER::GetLayerSet(), ZONE_CONTAINER::GetLocalFlags(), ZONE_CONTAINER::m_area, ZONE_CONTAINER::m_borderHatchLines, ZONE_CONTAINER::m_borderHatchPitch, ZONE_CONTAINER::m_borderStyle, ZONE_CONTAINER::m_cornerRadius, ZONE_CONTAINER::m_CornerSelection, ZONE_CONTAINER::m_cornerSmoothingType, ZONE_CONTAINER::m_doNotAllowCopperPour, ZONE_CONTAINER::m_doNotAllowFootprints, ZONE_CONTAINER::m_doNotAllowPads, ZONE_CONTAINER::m_doNotAllowTracks, ZONE_CONTAINER::m_doNotAllowVias, ZONE_CONTAINER::m_filledPolysHash, ZONE_CONTAINER::m_FilledPolysList, ZONE_CONTAINER::m_FilledPolysUseThickness, ZONE_CONTAINER::m_FillMode, ZONE_CONTAINER::m_FillSegmList, EDA_ITEM::m_Flags, EDA_ITEM::m_forceVisible, ZONE_CONTAINER::m_hatchBorderAlgorithm, ZONE_CONTAINER::m_hatchGap, ZONE_CONTAINER::m_hatchHoleMinArea, ZONE_CONTAINER::m_hatchOrientation, ZONE_CONTAINER::m_hatchSmoothingLevel, ZONE_CONTAINER::m_hatchSmoothingValue, ZONE_CONTAINER::m_hatchThickness, ZONE_CONTAINER::m_hv45, ZONE_CONTAINER::m_insulatedIslands, ZONE_CONTAINER::m_IsFilled, ZONE_CONTAINER::m_isKeepout, ZONE_CONTAINER::m_islandRemovalMode, ZONE_CONTAINER::m_minIslandArea, ZONE_CONTAINER::m_needRefill, BOARD_CONNECTED_ITEM::m_netinfo, ZONE_CONTAINER::m_PadConnection, ZONE_CONTAINER::m_Poly, ZONE_CONTAINER::m_priority, ZONE_CONTAINER::m_RawPolysList, ZONE_CONTAINER::m_ThermalReliefCopperBridge, ZONE_CONTAINER::m_ThermalReliefGap, ZONE_CONTAINER::m_ZoneClearance, ZONE_CONTAINER::m_ZoneMinThickness, ZONE_CONTAINER::m_zoneName, LSET::Seq(), ZONE_CONTAINER::SetLayerSet(), and ZONE_CONTAINER::SetLocalFlags().

Referenced by MODULE_ZONE_CONTAINER(), ZONE_CONTAINER::operator=(), CLIPBOARD_IO::SaveSelection(), and ZONE_CONTAINER::ZONE_CONTAINER().

◆ IsBrightened()

bool EDA_ITEM::IsBrightened ( ) const
inlineinherited

◆ IsConnected()

bool BOARD_CONNECTED_ITEM::IsConnected ( ) const
inlineoverridevirtualinherited

Reimplemented from BOARD_ITEM.

Definition at line 72 of file board_connected_item.h.

73  {
74  return true;
75  }

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 201 of file base_struct.h.

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

References IS_DRAGGED, and EDA_ITEM::m_Flags.

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

◆ IsFilled()

bool ZONE_CONTAINER::IsFilled ( ) const
inlineinherited

Definition at line 190 of file class_zone.h.

190 { return m_IsFilled; }
bool m_IsFilled
True when a zone was filled, false after deleting the filled areas.
Definition: class_zone.h:869

References ZONE_CONTAINER::m_IsFilled.

Referenced by PCB_EDIT_FRAME::Edit_Zone_Params(), export_vrml_zones(), PCB_IO::format(), test::DRC_TEST_PROVIDER_CLEARANCE_BASE::getLocation(), and DRC::GetLocation().

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 286 of file base_struct.h.

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

References EDA_ITEM::m_forceVisible.

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

◆ IsIsland()

bool ZONE_CONTAINER::IsIsland ( PCB_LAYER_ID  aLayer,
int  aPolyIdx 
)
inherited

Checks if a given filled polygon is an insulated island.

Parameters
aLayeris the layer to test
aPolyIdxis an inndex into m_FilledPolysList[aLayer]
Returns
true if the given polygon is insulated (i.e. has no net connection)

Definition at line 1155 of file class_zone.cpp.

1156 {
1157  if( GetNetCode() < 1 )
1158  return true;
1159 
1160  if( !m_insulatedIslands.count( aLayer ) )
1161  return false;
1162 
1163  return m_insulatedIslands.at( aLayer ).count( aPolyIdx );
1164 }
int GetNetCode() const
Function GetNetCode.
std::map< PCB_LAYER_ID, std::set< int > > m_insulatedIslands
For each layer, a set of insulated islands that were not removed.
Definition: class_zone.h:931

References BOARD_CONNECTED_ITEM::GetNetCode(), and ZONE_CONTAINER::m_insulatedIslands.

Referenced by PCB_IO::format().

◆ IsLocked()

virtual bool BOARD_ITEM::IsLocked ( ) const
inlinevirtualinherited

Function IsLocked.

Returns
bool - true if the object is locked, else false

Reimplemented in MODULE, and TRACK.

Definition at line 253 of file class_board_item.h.

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

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

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 198 of file base_struct.h.

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

References IS_CHANGED, and EDA_ITEM::m_Flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsNew()

◆ IsOnCopperLayer()

bool ZONE_CONTAINER::IsOnCopperLayer ( ) const
overridevirtualinherited

Function IsOnCopperLayer.

Returns
true if this zone is on a copper layer, false if on a technical layer

Reimplemented from BOARD_ITEM.

Definition at line 218 of file class_zone.cpp.

219 {
220  return ( m_layerSet & LSET::AllCuMask() ).count() > 0;
221 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:712

References LSET::AllCuMask(), and ZONE_CONTAINER::m_layerSet.

Referenced by GERBER_JOBFILE_WRITER::addJSONDesignRules(), BOARD_NETLIST_UPDATER::cacheCopperZoneConnections(), ZONE_FILLER::fillSingleZone(), ZONE_CONTAINER::GetMsgPanelInfo(), BRDITEMS_PLOTTER::PlotFilledAreas(), BOARD::SetAreasNetCodesFromNetNames(), test::DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZones(), DRC::testZones(), and BOARD_NETLIST_UPDATER::updateCopperZoneNets().

◆ IsOnLayer()

bool ZONE_CONTAINER::IsOnLayer ( PCB_LAYER_ID  aLayer) const
overridevirtualinherited

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 from BOARD_ITEM.

Definition at line 305 of file class_zone.cpp.

306 {
307  return m_layerSet.test( aLayer );
308 }

References ZONE_CONTAINER::m_layerSet.

Referenced by DRC_KEEPOUT_TESTER::checkTracksAndVias(), BOARD_ADAPTER::createLayers(), KIGFX::PCB_PAINTER::draw(), and DSN::SPECCTRA_DB::FromBOARD().

◆ IsReplaceable()

virtual bool EDA_ITEM::IsReplaceable ( ) const
inlinevirtualinherited

Function IsReplaceable.

Override this method in any derived object that supports test find and replace.

Returns
True if the item has replaceable text that can be modified using the find and replace dialog.

Reimplemented in SCH_COMPONENT, SCH_SHEET, SCH_LABEL, SCH_TEXT, SCH_SHEET_PIN, and SCH_FIELD.

Definition at line 501 of file base_struct.h.

501 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 204 of file base_struct.h.

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

References IS_RESIZED, and EDA_ITEM::m_Flags.

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

◆ IsSame()

bool ZONE_CONTAINER::IsSame ( const ZONE_CONTAINER aZoneToCompare)
inherited

Function IsSame tests if 2 zones are equivalent: 2 zones are equivalent if they have same parameters and same outlines info, filling is not taken into account.

Function IsSame test is 2 zones are equivalent: 2 zones are equivalent if they have same parameters and same outlines info relative to filling is not take in account.

Parameters
aZoneToCompare= zone to compare with "this"

Definition at line 62 of file zones_functions_for_undo_redo.cpp.

63 {
64  // compare basic parameters:
65  if( GetLayerSet() != aZoneToCompare.GetLayerSet() )
66  return false;
67 
68  if( GetNetCode() != aZoneToCompare.GetNetCode() )
69  return false;
70 
71  if( GetPriority() != aZoneToCompare.GetPriority() )
72  return false;
73 
74  // Compare zone specific parameters
75  if( GetIsKeepout() != aZoneToCompare.GetIsKeepout() )
76  return false;
77 
78  if( GetIsKeepout() )
79  {
80  if( GetDoNotAllowCopperPour() != aZoneToCompare.GetDoNotAllowCopperPour() )
81  return false;
82 
83  if( GetDoNotAllowVias() != aZoneToCompare.GetDoNotAllowVias() )
84  return false;
85 
86  if( GetDoNotAllowTracks() != aZoneToCompare.GetDoNotAllowTracks() )
87  return false;
88 
89  if( GetDoNotAllowPads() != aZoneToCompare.GetDoNotAllowPads() )
90  return false;
91 
92  if( GetDoNotAllowFootprints() != aZoneToCompare.GetDoNotAllowFootprints() )
93  return false;
94  }
95 
96  if( m_ZoneClearance != aZoneToCompare.m_ZoneClearance )
97  return false;
98 
99  if( m_ZoneMinThickness != aZoneToCompare.GetMinThickness() )
100  return false;
101 
102  if( m_FillMode != aZoneToCompare.GetFillMode() )
103  return false;
104 
105  if( m_PadConnection != aZoneToCompare.m_PadConnection )
106  return false;
107 
108  if( m_ThermalReliefGap != aZoneToCompare.m_ThermalReliefGap )
109  return false;
110 
112  return false;
113 
114  if( m_zoneName != aZoneToCompare.m_zoneName )
115  return false;
116 
117  if( m_islandRemovalMode != aZoneToCompare.m_islandRemovalMode )
118  return false;
119 
120  if( m_minIslandArea != aZoneToCompare.m_minIslandArea )
121  return false;
122 
123 
124  // Compare outlines
125  wxASSERT( m_Poly ); // m_Poly == NULL Should never happen
126  wxASSERT( aZoneToCompare.Outline() );
127 
128  if( Outline() != aZoneToCompare.Outline() ) // Compare vector
129  return false;
130 
131  return true;
132 }
bool GetDoNotAllowPads() const
Definition: class_zone.h:716
int m_ZoneClearance
Clearance value in internal units.
Definition: class_zone.h:856
int GetNetCode() const
Function GetNetCode.
ISLAND_REMOVAL_MODE m_islandRemovalMode
Definition: class_zone.h:860
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:282
long long int m_minIslandArea
When island removal mode is set to AREA, islands below this area will be removed.
Definition: class_zone.h:866
bool GetDoNotAllowVias() const
Definition: class_zone.h:714
ZONE_CONNECTION m_PadConnection
Definition: class_zone.h:855
virtual LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_zone.cpp:288
wxString m_zoneName
An optional unique name for this zone, used for identifying it in DRC checking.
Definition: class_zone.h:831
int m_ThermalReliefCopperBridge
Definition: class_zone.h:881
ZONE_FILL_MODE GetFillMode() const
Definition: class_zone.h:153
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:826
bool GetDoNotAllowCopperPour() const
Definition: class_zone.h:713
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:712
int m_ThermalReliefGap
Width of the copper bridge in thermal reliefs.
Definition: class_zone.h:878
int m_ZoneMinThickness
Minimum thickness value in filled areas.
Definition: class_zone.h:857
ZONE_FILL_MODE m_FillMode
How to fill areas: ZONE_FILL_MODE::POLYGONS => use solid polygons ZONE_FILL_MODE::HATCH_PATTERN => us...
Definition: class_zone.h:888
unsigned GetPriority() const
Function GetPriority.
Definition: class_zone.h:106
int GetMinThickness() const
Definition: class_zone.h:206
bool GetDoNotAllowTracks() const
Definition: class_zone.h:715
bool GetDoNotAllowFootprints() const
Definition: class_zone.h:717

References ZONE_CONTAINER::GetDoNotAllowCopperPour(), ZONE_CONTAINER::GetDoNotAllowFootprints(), ZONE_CONTAINER::GetDoNotAllowPads(), ZONE_CONTAINER::GetDoNotAllowTracks(), ZONE_CONTAINER::GetDoNotAllowVias(), ZONE_CONTAINER::GetFillMode(), ZONE_CONTAINER::GetIsKeepout(), ZONE_CONTAINER::GetLayerSet(), ZONE_CONTAINER::GetMinThickness(), BOARD_CONNECTED_ITEM::GetNetCode(), ZONE_CONTAINER::GetPriority(), ZONE_CONTAINER::m_FillMode, ZONE_CONTAINER::m_islandRemovalMode, ZONE_CONTAINER::m_minIslandArea, ZONE_CONTAINER::m_PadConnection, ZONE_CONTAINER::m_Poly, ZONE_CONTAINER::m_ThermalReliefCopperBridge, ZONE_CONTAINER::m_ThermalReliefGap, ZONE_CONTAINER::m_ZoneClearance, ZONE_CONTAINER::m_ZoneMinThickness, ZONE_CONTAINER::m_zoneName, and ZONE_CONTAINER::Outline().

Referenced by UpdateCopyOfZonesList().

◆ IsSelected()

◆ IsTrack()

bool BOARD_ITEM::IsTrack ( ) const
inlineinherited

Function IsTrack tests to see if this object is a track or via (or microvia).

form of testing.

Returns
bool - true if a track or via, else false.

Definition at line 244 of file class_board_item.h.

245  {
246  return ( Type() == PCB_TRACE_T ) || ( Type() == PCB_VIA_T );
247  }
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

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

◆ IsType()

virtual bool EDA_ITEM::IsType ( const KICAD_T  aScanTypes[]) const
inlinevirtualinherited

Function IsType Checks whether the item is one of the listed types.

Parameters
aScanTypesList of item types
Returns
true if the item type is contained in the list aScanTypes

Reimplemented in VIA, SCH_LABEL, DIMENSION, D_PAD, DRAWSEGMENT, TEXTE_MODULE, SCH_FIELD, SCH_LINE, EDGE_MODULE, and TEXTE_PCB.

Definition at line 262 of file base_struct.h.

263  {
264  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
265  return true;
266 
267  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
268  {
269  if( m_StructType == *p )
270  return true;
271  }
272 
273  return false;
274  }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it.
Definition: base_struct.h:170
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78

References EOT, EDA_ITEM::m_StructType, and SCH_LOCATE_ANY_T.

Referenced by SCH_LINE_WIRE_BUS_TOOL::IsDrawingBus(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLine(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingWire(), TEXTE_PCB::IsType(), EDGE_MODULE::IsType(), SCH_LINE::IsType(), SCH_FIELD::IsType(), TEXTE_MODULE::IsType(), DRAWSEGMENT::IsType(), D_PAD::IsType(), DIMENSION::IsType(), SCH_LABEL::IsType(), VIA::IsType(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), EE_SELECTION_TOOL::RequestSelection(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), EDA_ITEM::Visit(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 202 of file base_struct.h.

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

References IS_WIRE_IMAGE, and EDA_ITEM::m_Flags.

◆ Iterate()

SHAPE_POLY_SET::ITERATOR ZONE_CONTAINER::Iterate ( )
inlineinherited

Function Iterate returns an iterator to visit all points of the zone's main outline without holes.

Returns
SHAPE_POLY_SET::ITERATOR - an iterator to visit the zone vertices without holes.

Definition at line 499 of file class_zone.h.

500  {
501  return m_Poly->Iterate();
502  }
ITERATOR Iterate(int aFirst, int aLast, bool aIterateHoles=false)
Function Iterate returns an object to iterate through the points of the polygons between aFirst and a...
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:826

References SHAPE_POLY_SET::Iterate(), and ZONE_CONTAINER::m_Poly.

◆ IterateForward() [1/2]

template<class T >
static SEARCH_RESULT EDA_ITEM::IterateForward ( std::deque< T > &  aList,
INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
inlinestaticinherited

IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T )

IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T )

This changes first parameter to avoid the DList and use the main queue instead

Definition at line 383 of file base_struct.h.

387  {
388  for( auto it : aList )
389  {
390  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
392  return SEARCH_RESULT::QUIT;
393  }
394 
396  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
Function Visit may be re-implemented for each derived class in order to handle all the types given by...

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

Referenced by GERBER_FILE_IMAGE::Visit(), and BOARD::Visit().

◆ IterateForward() [2/2]

template<class T >
static SEARCH_RESULT EDA_ITEM::IterateForward ( std::vector< T > &  aList,
INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
inlinestaticinherited

IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T )

IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T )

This changes first parameter to avoid the DList and use std::vector instead

Definition at line 404 of file base_struct.h.

406  {
407  for( auto it : aList )
408  {
409  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
411  return SEARCH_RESULT::QUIT;
412  }
413 
415  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
Function Visit may be re-implemented for each derived class in order to handle all the types given by...

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

◆ IterateWithHoles()

SHAPE_POLY_SET::ITERATOR ZONE_CONTAINER::IterateWithHoles ( )
inlineinherited

Function IterateWithHoles returns an iterator to visit all points of the zone's main outline with holes.

Returns
SHAPE_POLY_SET::ITERATOR - an iterator to visit the zone vertices with holes.

Definition at line 509 of file class_zone.h.

510  {
511  return m_Poly->IterateWithHoles();
512  }
ITERATOR IterateWithHoles(int aOutline)
Function IterateWithHoles.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:826

References SHAPE_POLY_SET::IterateWithHoles(), and ZONE_CONTAINER::m_Poly.

Referenced by PCB_IO::format(), and DSN::SPECCTRA_DB::FromBOARD().

◆ LayerMaskDescribe()

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

Helper function Return a string (to be shown to the user) describing a layer mask.

The BOARD is needed because layer names are (somewhat) customizable

Definition at line 74 of file class_board_item.cpp.

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

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

Referenced by D_PAD::GetMsgPanelInfo(), and D_PAD::GetSelectMenuText().

◆ Matches() [1/2]

virtual bool EDA_ITEM::Matches ( wxFindReplaceData &  aSearchData,
void *  aAuxData 
)
inlinevirtualinherited

Function Matches compares the item against the search criteria in aSearchData.

The base class returns false since many of the objects derived from EDA_ITEM do not have any text to search.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search criteria.
aAuxDataA pointer to optional data required for the search or NULL if not used.
Returns
True if the item's text matches the search criteria in aSearchData.

Reimplemented in SCH_COMPONENT, SCH_SHEET, SCH_TEXT, SCH_SHEET_PIN, SCH_FIELD, SCH_PIN, TEXTE_MODULE, SCH_MARKER, MARKER_PCB, MARKER_PCB, and TEXTE_PCB.

Definition at line 457 of file base_struct.h.

458  {
459  return false;
460  }

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

◆ Matches() [2/2]

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

Function Matches compares aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

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

Definition at line 145 of file base_struct.cpp.

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

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

◆ Mirror()

void ZONE_CONTAINER::Mirror ( const wxPoint aMirrorRef,
bool  aMirrorLeftRight 
)
inherited

Function Mirror Mirror the outlines , relative to a given horizontal axis the layer is not changed.

Parameters
aMirrorRef= axis position
aMirrorLeftRightmirror across Y axis (otherwise mirror across X)

Definition at line 789 of file class_zone.cpp.

790 {
791  // ZONE_CONTAINERs mirror about the x-axis (why?!?)
792  m_Poly->Mirror( aMirrorLeftRight, !aMirrorLeftRight, VECTOR2I( aMirrorRef ) );
793 
794  HatchBorder();
795 
796  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
797  pair.second.Mirror( aMirrorLeftRight, !aMirrorLeftRight, VECTOR2I( aMirrorRef ) );
798 
799  for( std::pair<const PCB_LAYER_ID, ZONE_SEGMENT_FILL>& pair : m_FillSegmList )
800  {
801  for( SEG& seg : pair.second )
802  {
803  if( aMirrorLeftRight )
804  {
805  MIRROR( seg.A.x, aMirrorRef.x );
806  MIRROR( seg.B.x, aMirrorRef.x );
807  }
808  else
809  {
810  MIRROR( seg.A.y, aMirrorRef.y );
811  MIRROR( seg.B.y, aMirrorRef.y );
812  }
813  }
814  }
815 }
void HatchBorder()
Function HatchBorder computes the hatch lines depending on the hatch parameters and stores it in the ...
Definition: class_zone.cpp:961
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
void Mirror(bool aX=true, bool aY=false, const VECTOR2I &aRef={ 0, 0 })
Mirrors the line points about y or x (or both)
void MIRROR(T &aPoint, const T &aMirrorRef)
Definition: macros.h:175
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:826
Definition: seg.h:39
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:910
VECTOR2I A
Definition: seg.h:47
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:920
VECTOR2I B
Definition: seg.h:48

References SEG::A, SEG::B, ZONE_CONTAINER::HatchBorder(), ZONE_CONTAINER::m_FilledPolysList, ZONE_CONTAINER::m_FillSegmList, ZONE_CONTAINER::m_Poly, MIRROR(), SHAPE_POLY_SET::Mirror(), wxPoint::x, VECTOR2< T >::x, wxPoint::y, and VECTOR2< T >::y.

Referenced by ZONE_CONTAINER::Flip().

◆ Move() [1/2]

void BOARD_ITEM::Move ( const VECTOR2I aMoveVector)
inlineinherited

Definition at line 292 of file class_board_item.h.

293  {
294  Move( wxPoint( aMoveVector.x, aMoveVector.y ) );
295  }
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.

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

◆ Move() [2/2]

void ZONE_CONTAINER::Move ( const wxPoint offset)
overridevirtualinherited

Function Move Move the outlines.

Parameters
offset= moving vector

Reimplemented from BOARD_ITEM.

Definition at line 713 of file class_zone.cpp.

714 {
715  /* move outlines */
716  m_Poly->Move( offset );
717 
718  HatchBorder();
719 
720  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
721  pair.second.Move( offset );
722 
723  for( std::pair<const PCB_LAYER_ID, ZONE_SEGMENT_FILL>& pair : m_FillSegmList )
724  {
725  for( SEG& seg : pair.second )
726  {
727  seg.A += VECTOR2I( offset );
728  seg.B += VECTOR2I( offset );
729  }
730  }
731 }
void HatchBorder()
Function HatchBorder computes the hatch lines depending on the hatch parameters and stores it in the ...
Definition: class_zone.cpp:961
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
void Move(const VECTOR2I &aVector) override
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:826
Definition: seg.h:39
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:910
VECTOR2I A
Definition: seg.h:47
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:920
VECTOR2I B
Definition: seg.h:48

References SEG::A, SEG::B, ZONE_CONTAINER::HatchBorder(), ZONE_CONTAINER::m_FilledPolysList, ZONE_CONTAINER::m_FillSegmList, ZONE_CONTAINER::m_Poly, and SHAPE_POLY_SET::Move().

◆ MoveEdge()

void ZONE_CONTAINER::MoveEdge ( const wxPoint offset,
int  aEdge 
)
inherited

Function MoveEdge Move the outline Edge.

Parameters
offset= moving vector
aEdge= start point of the outline edge

Definition at line 734 of file class_zone.cpp.

735 {
736  int next_corner;
737 
738  if( m_Poly->GetNeighbourIndexes( aEdge, nullptr, &next_corner ) )
739  {
740  m_Poly->SetVertex( aEdge, m_Poly->CVertex( aEdge ) + VECTOR2I( offset ) );
741  m_Poly->SetVertex( next_corner, m_Poly->CVertex( next_corner ) + VECTOR2I( offset ) );
742  HatchBorder();
743 
744  SetNeedRefill( true );
745  }
746 }
void HatchBorder()
Function HatchBorder computes the hatch lines depending on the hatch parameters and stores it in the ...
Definition: class_zone.cpp:961
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Returns the index-th vertex in a given hole outline within a given outline
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
bool GetNeighbourIndexes(int aGlobalIndex, int *aPrevious, int *aNext)
Returns the global indexes of the previous and the next corner of the aGlobalIndex-th corner of a con...
void SetVertex(const VERTEX_INDEX &aIndex, const VECTOR2I &aPos)
Function SetVertex Accessor function to set the position of a specific point.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:826
void SetNeedRefill(bool aNeedRefill)
Definition: class_zone.h:194

References SHAPE_POLY_SET::CVertex(), SHAPE_POLY_SET::GetNeighbourIndexes(), ZONE_CONTAINER::HatchBorder(), ZONE_CONTAINER::m_Poly, ZONE_CONTAINER::SetNeedRefill(), and SHAPE_POLY_SET::SetVertex().

◆ NeedRefill()

bool ZONE_CONTAINER::NeedRefill ( ) const
inlineinherited

Definition at line 193 of file class_zone.h.

193 { return m_needRefill; }
bool m_needRefill
False when a zone was refilled, true after changes in zone params.
Definition: class_zone.h:875

References ZONE_CONTAINER::m_needRefill.

◆ NewHole()

void ZONE_CONTAINER::NewHole ( )
inlineinherited

Function NewHole creates a new hole on the zone; i.e., a new contour on the zone's outline.

Definition at line 562 of file class_zone.h.

563  {
564  m_Poly->NewHole();
565  }
int NewHole(int aOutline=-1)
Creates a new hole in a given outline
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:826

References ZONE_CONTAINER::m_Poly, and SHAPE_POLY_SET::NewHole().

Referenced by EAGLE_PLUGIN::loadPlain(), and EAGLE_PLUGIN::packageCircle().

◆ operator<()

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

Test if another item is less than this object.

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

Definition at line 199 of file base_struct.cpp.

200 {
201  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
202  GetChars( GetClass() ) ) );
203 
204  return false;
205 }
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:153
virtual wxString GetClass() const =0
Function GetClass returns the class name.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205

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

◆ operator=()

MODULE_ZONE_CONTAINER & MODULE_ZONE_CONTAINER::operator= ( const MODULE_ZONE_CONTAINER aOther)

Definition at line 1329 of file class_zone.cpp.

1330 {
1331  ZONE_CONTAINER::operator=( aOther );
1332  return *this;
1333 }
ZONE_CONTAINER & operator=(const ZONE_CONTAINER &aOther)
Definition: class_zone.cpp:85

References ZONE_CONTAINER::operator=().

◆ Outline() [1/2]

◆ Outline() [2/2]

const SHAPE_POLY_SET* ZONE_CONTAINER::Outline ( ) const
inlineinherited

Definition at line 283 of file class_zone.h.

283 { return const_cast< SHAPE_POLY_SET* >( m_Poly ); }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:826

References ZONE_CONTAINER::m_Poly.

◆ RawPolysList()

SHAPE_POLY_SET& ZONE_CONTAINER::RawPolysList ( PCB_LAYER_ID  aLayer)
inlineinherited

Definition at line 697 of file class_zone.h.

698  {
699  wxASSERT( m_RawPolysList.count( aLayer ) );
700  return m_RawPolysList.at( aLayer );
701  }
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_RawPolysList
Definition: class_zone.h:921

References ZONE_CONTAINER::m_RawPolysList.

◆ RemoveAllContours()

void ZONE_CONTAINER::RemoveAllContours ( void  )
inlineinherited

Definition at line 524 of file class_zone.h.

525  {
527  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:826
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.

References ZONE_CONTAINER::m_Poly, and SHAPE_POLY_SET::RemoveAllContours().

◆ RemoveCutout()

void ZONE_CONTAINER::RemoveCutout ( int  aOutlineIdx,
int  aHoleIdx 
)
inherited

Remove a cutout from the zone.

Parameters
aOutlineIdxis the zone outline the hole belongs to
aHoleIdxis the hole in the outline to remove

Definition at line 827 of file class_zone.cpp.

828 {
829  // Ensure the requested cutout is valid
830  if( m_Poly->OutlineCount() < aOutlineIdx || m_Poly->HoleCount( aOutlineIdx ) < aHoleIdx )
831  return;
832 
833  SHAPE_POLY_SET cutPoly( m_Poly->Hole( aOutlineIdx, aHoleIdx ) );
834 
835  // Add the cutout back to the zone
837 
838  SetNeedRefill( true );
839 }
int OutlineCount() const
Returns the number of outlines in the set
void BooleanAdd(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Performs boolean polyset union For aFastMode meaning, see function booleanOp
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Returns the reference to aHole-th hole in the aIndex-th outline
SHAPE_POLY_SET.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:826
int HoleCount(int aOutline) const
Returns the number of holes in a given outline
void SetNeedRefill(bool aNeedRefill)
Definition: class_zone.h:194

References SHAPE_POLY_SET::BooleanAdd(), SHAPE_POLY_SET::Hole(), SHAPE_POLY_SET::HoleCount(), ZONE_CONTAINER::m_Poly, SHAPE_POLY_SET::OutlineCount(), SHAPE_POLY_SET::PM_FAST, and ZONE_CONTAINER::SetNeedRefill().

◆ Replace() [1/2]

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

Helper function used in search and replace dialog Function Replace performs a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace.

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

Definition at line 172 of file base_struct.cpp.

173 {
174  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
175 
176  int result = searchString.Find( (aSearchData.GetFlags() & wxFR_MATCHCASE) ?
177  aSearchData.GetFindString() :
178  aSearchData.GetFindString().Upper() );
179 
180  if( result == wxNOT_FOUND )
181  return false;
182 
183  wxString prefix = aText.Left( result );
184  wxString suffix;
185 
186  if( aSearchData.GetFindString().length() + result < aText.length() )
187  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
188 
189  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
190  GetChars( aText ), GetChars( prefix ), GetChars( aSearchData.GetReplaceString() ),
191  GetChars( suffix ) );
192 
193  aText = prefix + aSearchData.GetReplaceString() + suffix;
194 
195  return true;
196 }
const wxChar *const traceFindReplace
Flag to enable find and replace debug tracing.
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:153

References GetChars(), and traceFindReplace.

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

◆ Replace() [2/2]

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

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

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

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

Reimplemented in SCH_TEXT, SCH_SHEET_PIN, SCH_FIELD, and SCH_PIN.

Definition at line 489 of file base_struct.h.

489 { return false; }

◆ Rotate() [1/2]

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

Definition at line 308 of file class_board_item.h.

309  {
310  Rotate( wxPoint( aRotCentre.x, aRotCentre.y ), aAngle );
311  }
virtual void Rotate(const wxPoint &aRotCentre, double aAngle)
Function Rotate Rotate this object.

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

◆ Rotate() [2/2]

void ZONE_CONTAINER::Rotate ( const wxPoint centre,
double  angle 
)
overridevirtualinherited

Function Rotate Move the outlines.

Parameters
centre= rot centre
angle= in 0.1 degree

Reimplemented from BOARD_ITEM.

Definition at line 749 of file class_zone.cpp.

750 {
751  wxPoint pos;
752 
753  angle = -DECIDEG2RAD( angle );
754 
755  m_Poly->Rotate( angle, VECTOR2I( centre ) );
756  HatchBorder();
757 
758  /* rotate filled areas: */
759  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
760  pair.second.Rotate( angle, VECTOR2I( centre ) );
761 
762  for( std::pair<const PCB_LAYER_ID, ZONE_SEGMENT_FILL>& pair : m_FillSegmList )
763  {
764  for( SEG& seg : pair.second )
765  {
766  wxPoint a( seg.A );
767  RotatePoint( &a, centre, angle );
768  seg.A = a;
769  wxPoint b( seg.B );
770  RotatePoint( &b, centre, angle );
771  seg.B = a;
772  }
773  }
774 }
void HatchBorder()
Function HatchBorder computes the hatch lines depending on the hatch parameters and stores it in the ...
Definition: class_zone.cpp:961
void Rotate(double aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Function Rotate rotates all vertices by a given angle.
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:826
Definition: seg.h:39
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:910
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
VECTOR2I A
Definition: seg.h:47
double DECIDEG2RAD(double deg)
Definition: trigo.h:218
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:920
VECTOR2I B
Definition: seg.h:48

References SEG::A, PNS::angle(), SEG::B, DECIDEG2RAD(), ZONE_CONTAINER::HatchBorder(), ZONE_CONTAINER::m_FilledPolysList, ZONE_CONTAINER::m_FillSegmList, ZONE_CONTAINER::m_Poly, SHAPE_POLY_SET::Rotate(), and RotatePoint().

Referenced by EAGLE_PLUGIN::loadPlain(), EAGLE_PLUGIN::packageRectangle(), and ALTIUM_PCB::ParseFills6Data().

◆ Set() [1/3]

bool INSPECTABLE::Set ( PROPERTY_BASE aProperty,
wxAny &  aValue 
)
inlineinherited

Definition at line 40 of file inspectable.h.

41  {
43  TYPE_ID thisType = TYPE_HASH( *this );
44  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
45 
46  if( object )
47  aProperty->setter( object, aValue );