KiCad PCB EDA Suite
ZONE Class Reference

Handle a list of polygons defining a copper zone. More...

#include <zone.h>

Inheritance diagram for ZONE:
BOARD_CONNECTED_ITEM BOARD_ITEM EDA_ITEM KIGFX::VIEW_ITEM INSPECTABLE FP_ZONE

Public Member Functions

 ZONE (BOARD_ITEM_CONTAINER *parent, bool aInFP=false)
 The ctor to build ZONE, but compatible with FP_ZONE requirement. More...
 
 ZONE (const ZONE &aZone)
 
ZONEoperator= (const ZONE &aOther)
 
 ~ZONE ()
 
bool IsConnected () const override
 Not all ZONEs are really BOARD_CONNECTED_ITEMs.... More...
 
NETCLASSGetNetClass () const override
 Return the NETCLASS for this item. More...
 
wxString GetNetClassName () const override
 Returns the netclass of the zone. More...
 
void InitDataFromSrcInCopyCtor (const ZONE &aZone)
 Copy aZone data to me. More...
 
wxPoint GetPosition () const override
 
void SetPosition (const wxPoint &aPos) override
 
void SetPriority (unsigned aPriority)
 
unsigned GetPriority () const
 
void GetMsgPanelInfo (EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
 Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes. More...
 
void SetLayerSet (LSET aLayerSet) override
 
virtual LSET GetLayerSet () const override
 Return a std::bitset of all layers on which the item physically resides. More...
 
wxString GetZoneName () const
 
void SetZoneName (const wxString &aName)
 
bool Matches (const wxFindReplaceData &aSearchData, void *aAuxData) const override
 Compare the item against the search criteria in aSearchData. More...
 
const EDA_RECT GetBoundingBox () const override
 
const EDA_RECT GetCachedBoundingBox () const
 ONLY TO BE USED BY CLIENTS WHICH SET UP THE CACHE! More...
 
void CacheBoundingBox ()
 
int GetLocalClearance (wxString *aSource) const override
 Return any local clearances set in the "classic" (ie: pre-rule) system. More...
 
int GetLocalClearance () const
 
void SetLocalClearance (int aClearance)
 
bool IsOnCopperLayer () const override
 
bool CommonLayerExists (const LSET aLayerSet) const
 Test if this zone shares a common layer with the given layer set. More...
 
virtual void SetLayer (PCB_LAYER_ID aLayer) override
 Set the layer this item is on. More...
 
virtual PCB_LAYER_ID GetLayer () const override
 Return the primary layer this item is on. More...
 
virtual bool IsOnLayer (PCB_LAYER_ID) const override
 Test to see if this object is on the given layer. More...
 
virtual void ViewGetLayers (int aLayers[], int &aCount) const override
 Return the all the layers within the VIEW the object is painted on. More...
 
double ViewGetLOD (int aLayer, KIGFX::VIEW *aView) const override
 Return the level of detail (LOD) of the item. More...
 
void SetFillMode (ZONE_FILL_MODE aFillMode)
 
ZONE_FILL_MODE GetFillMode () const
 
void SetThermalReliefGap (int aThermalReliefGap)
 
int GetThermalReliefGap () const
 
int GetThermalReliefGap (PAD *aPad, wxString *aSource=nullptr) const
 
void SetThermalReliefSpokeWidth (int aThermalReliefSpokeWidth)
 
int GetThermalReliefSpokeWidth () const
 
int GetThermalReliefSpokeWidth (PAD *aPad, wxString *aSource=nullptr) const
 
double CalculateFilledArea ()
 Compute the area currently occupied by the zone fill. More...
 
double GetFilledArea ()
 This area is cached from the most recent call to CalculateFilledArea(). More...
 
std::mutex & GetLock ()
 
int GetFillFlag (PCB_LAYER_ID aLayer)
 
void SetFillFlag (PCB_LAYER_ID aLayer, bool aFlag)
 
bool IsFilled () const
 
void SetIsFilled (bool isFilled)
 
bool NeedRefill () const
 
void SetNeedRefill (bool aNeedRefill)
 
ZONE_CONNECTION GetPadConnection (PAD *aPad, wxString *aSource=nullptr) const
 
ZONE_CONNECTION GetPadConnection () 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)
 
std::vector< SEG > & FillSegments (PCB_LAYER_ID aLayer)
 
const std::vector< SEG > & FillSegments (PCB_LAYER_ID aLayer) const
 
SHAPE_POLY_SETOutline ()
 
const SHAPE_POLY_SETOutline () const
 
void SetOutline (SHAPE_POLY_SET *aOutline)
 
virtual std::shared_ptr< SHAPEGetEffectiveShape (PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT) const override
 Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes. More...
 
bool HitTest (const wxPoint &aPosition, int aAccuracy=0) const override
 Test if a point is near an outline edge or a corner of this zone. More...
 
bool HitTestFilledArea (PCB_LAYER_ID aLayer, const wxPoint &aRefPos, int aAccuracy=0) const
 Test 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
 Test 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 GetInteractingZones (PCB_LAYER_ID aLayer, std::vector< ZONE * > *aZones) const
 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 TransformSolidAreasShapesToPolygon (PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aCornerBuffer, int aError=ARC_HIGH_DEF) const
 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 TransformSmoothedOutlineToPolygon (SHAPE_POLY_SET &aCornerBuffer, int aClearance, int aError, ERROR_LOC aErrorLoc, SHAPE_POLY_SET *aBoardOutline) const
 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, PCB_LAYER_ID aLayer, int aClearanceValue, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
 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
 Test if the given wxPoint is near a corner. More...
 
bool HitTestForCorner (const wxPoint &refPos, int aAccuracy) const
 Test if the given wxPoint is near a corner. More...
 
bool HitTestForEdge (const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
 Test if the given wxPoint is near a segment defined by 2 corners. More...
 
bool HitTestForEdge (const wxPoint &refPos, int aAccuracy) const
 Test if the given wxPoint is near a segment defined by 2 corners. More...
 
bool HitTest (const EDA_RECT &aRect, bool aContained=true, int aAccuracy=0) const override
 
bool UnFill ()
 Removes the zone filling. More...
 
void Move (const wxPoint &offset) override
 Move the outlines. More...
 
void MoveEdge (const wxPoint &offset, int aEdge)
 Move the outline Edge. More...
 
void Rotate (const wxPoint &aCentre, double aAngle) override
 Move the outlines. More...
 
virtual void Flip (const wxPoint &aCentre, bool aFlipLeftRight) override
 Flip this object, i.e. More...
 
void Mirror (const wxPoint &aMirrorRef, bool aMirrorLeftRight)
 Mirror the outlines relative to a given horizontal axis the layer is not changed. More...
 
wxString GetClass () const override
 
int GetNumCorners (void) const
 Access to m_Poly parameters. More...
 
SHAPE_POLY_SET::ITERATOR Iterate ()
 Return an iterator to visit all points of the zone's main outline without holes. More...
 
SHAPE_POLY_SET::ITERATOR IterateWithHoles ()
 Return an iterator to visit all points of the zone's main outline with holes. More...
 
SHAPE_POLY_SET::CONST_ITERATOR CIterateWithHoles () const
 Return 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, const wxPoint &new_pos)
 
void NewHole ()
 Create 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 &aZoneToCompare)
 Test if 2 zones are equivalent. More...
 
bool HasFilledPolysForLayer (PCB_LAYER_ID aLayer) const
 
const SHAPE_POLY_SETGetFilledPolysList (PCB_LAYER_ID aLayer) const
 
void CacheTriangulation (PCB_LAYER_ID aLayer=UNDEFINED_LAYER)
 Create a list of triangles that "fill" the solid areas used for instance to draw these solid areas on OpenGL. More...
 
void SetFilledPolysList (PCB_LAYER_ID aLayer, const SHAPE_POLY_SET &aPolysList)
 Set the list of filled polygons. More...
 
void SetRawPolysList (PCB_LAYER_ID aLayer, const SHAPE_POLY_SET &aPolysList)
 Set the list of filled polygons. More...
 
bool IsIsland (PCB_LAYER_ID aLayer, int aPolyIdx) const
 Check if a given filled polygon is an insulated island. More...
 
void SetIsIsland (PCB_LAYER_ID aLayer, int aPolyIdx)
 
bool BuildSmoothedPoly (SHAPE_POLY_SET &aSmoothedPoly, PCB_LAYER_ID aLayer, SHAPE_POLY_SET *aBoardOutline, SHAPE_POLY_SET *aSmoothedPolyWithApron=nullptr) const
 
void SetCornerSmoothingType (int aType)
 
int GetCornerSmoothingType () const
 
void SetCornerRadius (unsigned int aRadius)
 
unsigned int GetCornerRadius () const
 
bool GetFilledPolysUseThickness () const
 
bool GetFilledPolysUseThickness (PCB_LAYER_ID aLayer) const
 
int GetFillVersion () const
 
void SetFillVersion (int aVersion)
 
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. More...
 
void AddPolygon (const SHAPE_LINE_CHAIN &aPolygon)
 
void SetFillSegments (PCB_LAYER_ID aLayer, const std::vector< SEG > &aSegments)
 
SHAPE_POLY_SETRawPolysList (PCB_LAYER_ID aLayer)
 
wxString GetSelectMenuText (EDA_UNITS aUnits) const override
 Return the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position. More...
 
BITMAPS GetMenuImage () const override
 Return a pointer to an image to be used in menus. More...
 
EDA_ITEMClone () const override
 Create a duplicate of this item with linked list members set to NULL. More...
 
bool GetIsRuleArea () const
 Accessors to parameters used in Rule Area zones: More...
 
bool GetDoNotAllowCopperPour () const
 
bool GetDoNotAllowVias () const
 
bool GetDoNotAllowTracks () const
 
bool GetDoNotAllowPads () const
 
bool GetDoNotAllowFootprints () const
 
bool IsKeepout () const
 
bool KeepoutAll () const
 
void SetIsRuleArea (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)
 Set all hatch parameters for the zone. More...
 
void SetHatchPitch (int aPitch)
 Set the hatch pitch parameter for the zone. More...
 
void UnHatchBorder ()
 Clear the zone's hatch. More...
 
void HatchBorder ()
 Compute 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)
 
void BuildHashValue (PCB_LAYER_ID aLayer)
 Build the hash value of m_FilledPolysList, and store it internally in m_filledPolysHash. More...
 
MD5_HASH GetHashValue (PCB_LAYER_ID aLayer)
 
virtual void SwapData (BOARD_ITEM *aImage) override
 Swap data between aItem and aImage. More...
 
NETINFO_ITEMGetNet () const
 Return #NET_INFO object for a given item. More...
 
void SetNet (NETINFO_ITEM *aNetInfo)
 Set a NET_INFO object for the item. More...
 
int GetNetCode () const
 
bool SetNetCode (int aNetCode, bool aNoAssert)
 Set net using a net code. More...
 
void SetNetCode (int aNetCode)
 
wxString GetNetname () const
 
wxString GetNetnameMsg () const
 
wxString GetShortNetname () const
 
virtual int GetOwnClearance (PCB_LAYER_ID aLayer, wxString *aSource=nullptr) const
 Return an item's "own" clearance in internal units. More...
 
virtual int GetLocalClearanceOverrides (wxString *aSource) const
 Return any local clearance overrides set in the "classic" (ie: pre-rule) system. More...
 
virtual NETCLASSGetEffectiveNetclass () const
 Return the NETCLASS for this item, or the default netclass if none is defined. More...
 
void SetLocalRatsnestVisible (bool aVisible)
 
bool GetLocalRatsnestVisible () const
 
void SetParentGroup (PCB_GROUP *aGroup)
 
PCB_GROUPGetParentGroup () const
 
int GetX () const
 
int GetY () const
 
virtual wxPoint GetCenter () const
 This defaults to the center of the bounding box if not overridden. More...
 
void SetX (int aX)
 
void SetY (int aY)
 
BOARD_ITEM_CONTAINERGetParent () const
 
BOARD_ITEM_CONTAINERGetParentFootprint () const
 
virtual BOARD_ITEMDuplicate () const
 Create a copy of this BOARD_ITEM. More...
 
bool IsTrack () const
 Test to see if this object is a track or via (or microvia). More...
 
virtual bool IsLocked () const
 
virtual void SetLocked (bool aLocked)
 Modify the 'lock' status for of the item. More...
 
void DeleteStructure ()
 Delete this object after removing from its parent if it has one. More...
 
void Move (const VECTOR2I &aMoveVector)
 
void Rotate (const VECTOR2I &aRotCentre, double aAngle)
 
void Flip (const VECTOR2I &aCentre, bool aFlipLeftRight)
 
virtual const BOARDGetBoard () const
 Return the BOARD in which this BOARD_ITEM resides, or NULL if none. More...
 
virtual BOARDGetBoard ()
 
wxString GetLayerName () const
 Return the name of the PCB layer on which the item resides. More...
 
KICAD_T Type () const
 Returns the type of object. 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 IsEntered () const
 
bool IsResized () const
 
bool IsBrightened () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (EDA_ITEM_FLAGS type) const
 
void SetState (EDA_ITEM_FLAGS type, bool state)
 
EDA_ITEM_FLAGS GetStatus () const
 
void SetStatus (EDA_ITEM_FLAGS aStatus)
 
void SetFlags (EDA_ITEM_FLAGS aMask)
 
void ClearFlags (EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
EDA_ITEM_FLAGS GetFlags () const
 
bool HasFlag (EDA_ITEM_FLAGS aFlag) const
 
EDA_ITEM_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
virtual bool IsType (const KICAD_T aScanTypes[]) const
 Check whether the item is one of the listed types. More...
 
void SetForceVisible (bool aEnable)
 Set and clear 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
 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[])
 May be re-implemented for each derived class in order to handle all the types given by its member data. More...
 
virtual bool Replace (const wxFindReplaceData &aSearchData, void *aAuxData=nullptr)
 Perform a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Override this method in any derived object that supports test find and replace. More...
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
virtual const BOX2I ViewBBox () const override
 Return the bounding box of the item covering all its layers. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Draw 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 ()
 
template<class T >
static SEARCH_RESULT IterateForward (std::deque< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 This changes first parameter to avoid the DList and use the main queue instead. More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::vector< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 Change first parameter to avoid the DList and use std::vector instead. More...
 
static bool Replace (const wxFindReplaceData &aSearchData, wxString &aText)
 Perform 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)
 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

virtual wxString layerMaskDescribe () const
 Return a string (to be shown to the user) describing a layer mask. More...
 
bool Matches (const wxString &aText, const wxFindReplaceData &aSearchData) const
 Compare aText against search criteria in aSearchData. 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_isRuleArea
 
bool m_doNotAllowCopperPour
 
bool m_doNotAllowVias
 
bool m_doNotAllowTracks
 
bool m_doNotAllowPads
 
bool m_doNotAllowFootprints
 
ZONE_CONNECTION m_PadConnection
 
int m_ZoneClearance
 
int m_ZoneMinThickness
 
int m_fillVersion
 
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
 
int m_thermalReliefSpokeWidth
 
ZONE_FILL_MODE m_fillMode
 How to fill areas: 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
 
std::map< PCB_LAYER_ID, std::vector< SEG > > m_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
 
EDA_RECT m_bboxCache
 Temp variables used while filling. More...
 
std::map< PCB_LAYER_ID, bool > m_fillFlags
 
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
 Store all information about the net that item belongs to. More...
 
PCB_LAYER_ID m_layer
 
PCB_GROUPm_group
 
EDA_ITEM_FLAGS m_status
 
EDA_ITEMm_parent
 Linked list: Link (parent struct) More...
 
bool m_forceVisible
 
EDA_ITEM_FLAGS m_flags
 

Detailed Description

Handle a list of polygons defining a copper zone.

A zone is described by a main polygon, a time stamp, a layer or a layer set, and a net name. Other polygons inside the main polygon are holes in the zone.

a item ZONE is living in a board a variant FP_ZONE is living in a footprint

Definition at line 56 of file zone.h.

Constructor & Destructor Documentation

◆ ZONE() [1/2]

ZONE::ZONE ( BOARD_ITEM_CONTAINER parent,
bool  aInFP = false 
)

The ctor to build ZONE, but compatible with FP_ZONE requirement.

if aInFP is true, a FP_ZONE is actually built (same item, but with a specific type id: The type is PCB_ZONE_T for a ZONE The type is PCB_FP_ZONE_T for a FP_ZONE

Definition at line 44 of file zone.cpp.

44  :
45  BOARD_CONNECTED_ITEM( aParent, aInFP ? PCB_FP_ZONE_T : PCB_ZONE_T ),
46  m_area( 0.0 )
47 {
48  m_CornerSelection = nullptr; // no corner is selected
49  m_isFilled = false; // fill status : true when the zone is filled
53  m_hv45 = false;
54  m_hatchThickness = 0;
55  m_hatchGap = 0;
56  m_hatchOrientation = 0.0;
57  m_hatchSmoothingLevel = 0; // Grid pattern smoothing type. 0 = no smoothing
58  m_hatchSmoothingValue = 0.1; // Grid pattern chamfer value relative to the gap value
59  // used only if m_hatchSmoothingLevel > 0
60  m_hatchHoleMinArea = 0.3; // Min size before holes are dropped (ratio of hole size)
61  m_hatchBorderAlgorithm = 1; // 0 = use zone min thickness; 1 = use hatch width
62  m_priority = 0;
64  SetIsRuleArea( aInFP ); // Zones living in footprints have the rule area option
65  SetDoNotAllowCopperPour( false ); // has meaning only if m_isRuleArea == true
66  SetDoNotAllowVias( true ); // has meaning only if m_isRuleArea == true
67  SetDoNotAllowTracks( true ); // has meaning only if m_isRuleArea == true
68  SetDoNotAllowPads( true ); // has meaning only if m_isRuleArea == true
69  SetDoNotAllowFootprints( false ); // has meaning only if m_isRuleArea == true
70  m_cornerRadius = 0;
71  SetLocalFlags( 0 ); // flags temporary used in zone calculations
72  m_Poly = new SHAPE_POLY_SET(); // Outlines
73  m_fillVersion = 5; // set the "old" way to build filled polygon areas (< 6.0.x)
75  aParent->GetZoneSettings().ExportSetting( *this );
76 
80 
81  m_needRefill = false; // True only after edits.
82 }
ZONE_BORDER_DISPLAY_STYLE m_borderStyle
Definition: zone.h:928
unsigned int m_cornerRadius
Definition: zone.h:826
void SetDoNotAllowTracks(bool aEnable)
Definition: zone.h:747
ZONE_FILL_MODE m_fillMode
How to fill areas:
Definition: zone.h:886
int m_cornerSmoothingType
Definition: zone.h:825
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824
int m_hatchSmoothingLevel
Definition: zone.h:890
double m_area
Definition: zone.h:937
BOARD_CONNECTED_ITEM(BOARD_ITEM *aParent, KICAD_T idtype)
double m_hatchOrientation
Definition: zone.h:889
#define ZONE_THERMAL_RELIEF_COPPER_WIDTH_MIL
Definition: zones.h:30
int m_hatchThickness
Definition: zone.h:887
void SetIsRuleArea(bool aEnable)
Definition: zone.h:744
static int GetDefaultHatchPitch()
Definition: zone.cpp:1038
void SetDoNotAllowPads(bool aEnable)
Definition: zone.h:748
Represent a set of closed polygons.
int m_thermalReliefGap
Definition: zone.h:876
bool m_hv45
Definition: zone.h:935
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: zone.h:900
ISLAND_REMOVAL_MODE m_islandRemovalMode
Definition: zone.h:858
void SetDoNotAllowVias(bool aEnable)
Definition: zone.h:746
class ZONE, a copper pour area
Definition: typeinfo.h:105
#define ZONE_THICKNESS_MIL
Definition: zones.h:31
int m_ZoneMinThickness
Definition: zone.h:855
int m_borderHatchPitch
Definition: zone.h:929
void SetLocalFlags(int aFlags)
Definition: zone.h:306
int m_hatchBorderAlgorithm
Definition: zone.h:896
bool m_isFilled
True when a zone was filled, false after deleting the filled areas.
Definition: zone.h:867
void SetDoNotAllowCopperPour(bool aEnable)
Definition: zone.h:745
int m_hatchGap
Definition: zone.h:888
class ZONE, managed by a footprint
Definition: typeinfo.h:94
int m_fillVersion
Definition: zone.h:856
double m_hatchHoleMinArea
Definition: zone.h:895
#define ZONE_THERMAL_RELIEF_GAP_MIL
Definition: zones.h:29
bool m_needRefill
False when a zone was refilled, true after changes in zone params.
Definition: zone.h:874
unsigned m_priority
Definition: zone.h:837
double m_hatchSmoothingValue
Definition: zone.h:894
int m_thermalReliefSpokeWidth
Definition: zone.h:877
void SetDoNotAllowFootprints(bool aEnable)
Definition: zone.h:749

References ALWAYS, DIAGONAL_EDGE, ZONE_SETTINGS::ExportSetting(), GetDefaultHatchPitch(), BOARD_ITEM_CONTAINER::GetZoneSettings(), m_borderHatchPitch, m_borderStyle, m_cornerRadius, m_CornerSelection, m_cornerSmoothingType, m_fillMode, m_fillVersion, m_hatchBorderAlgorithm, m_hatchGap, m_hatchHoleMinArea, m_hatchOrientation, m_hatchSmoothingLevel, m_hatchSmoothingValue, m_hatchThickness, m_hv45, m_isFilled, m_islandRemovalMode, m_needRefill, m_Poly, m_priority, m_thermalReliefGap, m_thermalReliefSpokeWidth, m_ZoneMinThickness, POLYGONS, SetDoNotAllowCopperPour(), SetDoNotAllowFootprints(), SetDoNotAllowPads(), SetDoNotAllowTracks(), SetDoNotAllowVias(), SetIsRuleArea(), SetLocalFlags(), ZONE_SETTINGS::SMOOTHING_NONE, ZONE_THERMAL_RELIEF_COPPER_WIDTH_MIL, ZONE_THERMAL_RELIEF_GAP_MIL, and ZONE_THICKNESS_MIL.

Referenced by Clone().

◆ ZONE() [2/2]

ZONE::ZONE ( const ZONE aZone)

Definition at line 85 of file zone.cpp.

86  : BOARD_CONNECTED_ITEM( aZone ),
87  m_Poly( nullptr ),
88  m_CornerSelection( nullptr )
89 {
91 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824
BOARD_CONNECTED_ITEM(BOARD_ITEM *aParent, KICAD_T idtype)
void InitDataFromSrcInCopyCtor(const ZONE &aZone)
Copy aZone data to me.
Definition: zone.cpp:111
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: zone.h:900

References InitDataFromSrcInCopyCtor().

◆ ~ZONE()

ZONE::~ZONE ( )

Definition at line 104 of file zone.cpp.

105 {
106  delete m_Poly;
107  delete m_CornerSelection;
108 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: zone.h:900

References m_CornerSelection, and m_Poly.

Member Function Documentation

◆ AddPolygon() [1/2]

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

Add a polygon to the zone outline.

If the zone outline is empty, this is the main outline. Otherwise it is a hole inside the main outline.

Definition at line 798 of file zone.cpp.

799 {
800  if( aPolygon.empty() )
801  return;
802 
803  SHAPE_LINE_CHAIN outline;
804 
805  // Create an outline and populate it with the points of aPolygon
806  for( const wxPoint& pt : aPolygon)
807  outline.Append( pt );
808 
809  outline.SetClosed( true );
810 
811  AddPolygon( outline );
812 }
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
void SetClosed(bool aClosed)
Mark the line chain as closed (i.e.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
void AddPolygon(std::vector< wxPoint > &aPolygon)
Add a polygon to the zone outline.
Definition: zone.cpp:798

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

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::getZoneFromCadstarShape(), and EAGLE_PLUGIN::loadPolygon().

◆ AddPolygon() [2/2]

void ZONE::AddPolygon ( const SHAPE_LINE_CHAIN aPolygon)

Definition at line 784 of file zone.cpp.

785 {
786  wxASSERT( aPolygon.IsClosed() );
787 
788  // Add the outline as a new polygon in the polygon set
789  if( m_Poly->OutlineCount() == 0 )
790  m_Poly->AddOutline( aPolygon );
791  else
792  m_Poly->AddHole( aPolygon );
793 
794  SetNeedRefill( true );
795 }
int OutlineCount() const
Return the number of vertices in a given outline/hole.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824
bool IsClosed() const override
int AddHole(const SHAPE_LINE_CHAIN &aHole, int aOutline=-1)
Return the area of this poly set.
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new hole to the given outline (default: last) and returns its index.
void SetNeedRefill(bool aNeedRefill)
Definition: zone.h:238

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

◆ AppendCorner()

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

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 815 of file zone.cpp.

816 {
817  // Ensure the main outline exists:
818  if( m_Poly->OutlineCount() == 0 )
819  m_Poly->NewOutline();
820 
821  // If aHoleIdx >= 0, the corner musty be added to the hole, index aHoleIdx.
822  // (remember: the index of the first hole is 0)
823  // Return error if if does dot exist.
824  if( aHoleIdx >= m_Poly->HoleCount( 0 ) )
825  return false;
826 
827  m_Poly->Append( aPosition.x, aPosition.y, -1, aHoleIdx, aAllowDuplication );
828 
829  SetNeedRefill( true );
830 
831  return true;
832 }
int OutlineCount() const
Return the number of vertices in a given outline/hole.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824
int NewOutline()
Creates a new hole in a given outline.
int HoleCount(int aOutline) const
Return the reference to aIndex-th outline in the set.
void SetNeedRefill(bool aNeedRefill)
Definition: zone.h:238
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...

References SHAPE_POLY_SET::Append(), SHAPE_POLY_SET::HoleCount(), m_Poly, SHAPE_POLY_SET::NewOutline(), SHAPE_POLY_SET::OutlineCount(), and SetNeedRefill().

Referenced by BOARD::AddArea(), PCAD2KICAD::PCB_POLYGON::AddToBoard(), TEST_BOARD_ITEM_FIXTURE::Instantiate(), EAGLE_PLUGIN::loadPlain(), EAGLE_PLUGIN::packageCircle(), EAGLE_PLUGIN::packageRectangle(), and ALTIUM_PCB::ParseFills6Data().

◆ BuildHashValue()

void ZONE::BuildHashValue ( PCB_LAYER_ID  aLayer)

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 389 of file zone.cpp.

390 {
391  if( !m_FilledPolysList.count( aLayer ) )
393  else
394  m_filledPolysHash[aLayer] = m_FilledPolysList.at( aLayer ).GetHash();
395 }
MD5_HASH GetHash() const
static SHAPE_POLY_SET g_nullPoly
Definition: zone.cpp:377
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: zone.h:926
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:918

References g_nullPoly, SHAPE_POLY_SET::GetHash(), m_filledPolysHash, and m_FilledPolysList.

◆ BuildSmoothedPoly()

bool ZONE::BuildSmoothedPoly ( SHAPE_POLY_SET aSmoothedPoly,
PCB_LAYER_ID  aLayer,
SHAPE_POLY_SET aBoardOutline,
SHAPE_POLY_SET aSmoothedPolyWithApron = nullptr 
) const

Definition at line 1117 of file zone.cpp.

1120 {
1121  if( GetNumCorners() <= 2 ) // malformed zone. polygon calculations will not like it ...
1122  return false;
1123 
1124  // Processing of arc shapes in zones is not yet supported because Clipper can't do boolean
1125  // operations on them. The poly outline must be converted to segments first.
1126  SHAPE_POLY_SET flattened = *m_Poly;
1127  flattened.ClearArcs();
1128 
1129  if( GetIsRuleArea() )
1130  {
1131  // We like keepouts just the way they are....
1132  aSmoothedPoly = flattened;
1133  return true;
1134  }
1135 
1136  const BOARD* board = GetBoard();
1137  int maxError = ARC_HIGH_DEF;
1138  bool keepExternalFillets = false;
1139 
1140  if( board )
1141  {
1142  BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings();
1143 
1144  maxError = bds.m_MaxError;
1145  keepExternalFillets = bds.m_ZoneKeepExternalFillets;
1146  }
1147 
1148  auto smooth = [&]( SHAPE_POLY_SET& aPoly )
1149  {
1150  switch( m_cornerSmoothingType )
1151  {
1153  aPoly = aPoly.Chamfer( (int) m_cornerRadius );
1154  break;
1155 
1157  {
1158  aPoly = aPoly.Fillet( (int) m_cornerRadius, maxError );
1159  break;
1160  }
1161 
1162  default:
1163  break;
1164  }
1165  };
1166 
1167  std::vector<ZONE*> interactingZones;
1168  GetInteractingZones( aLayer, &interactingZones );
1169 
1170  SHAPE_POLY_SET* maxExtents = &flattened;
1171  SHAPE_POLY_SET withFillets;
1172 
1173  aSmoothedPoly = flattened;
1174 
1175  // Should external fillets (that is, those applied to concave corners) be kept? While it
1176  // seems safer to never have copper extend outside the zone outline, 5.1.x and prior did
1177  // indeed fill them so we leave the mode available.
1178  if( keepExternalFillets )
1179  {
1180  withFillets = flattened;
1181  smooth( withFillets );
1182  withFillets.BooleanAdd( flattened, SHAPE_POLY_SET::PM_FAST );
1183  maxExtents = &withFillets;
1184  }
1185 
1186  for( ZONE* zone : interactingZones )
1187  {
1188  SHAPE_POLY_SET flattened_outline = *zone->Outline();
1189  flattened_outline.ClearArcs();
1190  aSmoothedPoly.BooleanAdd( flattened_outline, SHAPE_POLY_SET::PM_FAST );
1191  }
1192 
1193  if( aBoardOutline )
1194  {
1195  SHAPE_POLY_SET poly = *aBoardOutline;
1197  }
1198 
1199  smooth( aSmoothedPoly );
1200 
1201  if( aSmoothedPolyWithApron )
1202  {
1203  SHAPE_POLY_SET poly = *maxExtents;
1204  poly.Inflate( m_ZoneMinThickness, 64 );
1205  *aSmoothedPolyWithApron = aSmoothedPoly;
1206  aSmoothedPolyWithApron->BooleanIntersection( poly, SHAPE_POLY_SET::PM_FAST );
1207  }
1208 
1209  aSmoothedPoly.BooleanIntersection( *maxExtents, SHAPE_POLY_SET::PM_FAST );
1210 
1211  return true;
1212 }
int GetNumCorners(void) const
Access to m_Poly parameters.
Definition: zone.h:525
unsigned int m_cornerRadius
Definition: zone.h:826
void BooleanAdd(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset difference For aFastMode meaning, see function booleanOp.
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:735
int m_cornerSmoothingType
Definition: zone.h:825
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:590
void GetInteractingZones(PCB_LAYER_ID aLayer, std::vector< ZONE * > *aZones) const
Some intersecting zones, despite being on the same layer with the same net, cannot be merged due to o...
Definition: zone.cpp:1087
Represent a set of closed polygons.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
void BooleanIntersection(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset union between a and b, store the result in it self For aFastMode meaning,...
int m_ZoneMinThickness
Definition: zone.h:855
void Inflate(int aAmount, int aCircleSegCount, CORNER_STRATEGY aCornerStrategy=ROUND_ALL_CORNERS)
Perform outline inflation/deflation.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:191
void ClearArcs()
Appends a vertex at the end of the given outline/hole (default: the last outline)
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
Container for design settings for a BOARD object.

References SHAPE_POLY_SET::BooleanAdd(), SHAPE_POLY_SET::BooleanIntersection(), SHAPE_POLY_SET::ClearArcs(), BOARD_ITEM::GetBoard(), BOARD::GetDesignSettings(), GetInteractingZones(), GetIsRuleArea(), GetNumCorners(), SHAPE_POLY_SET::Inflate(), m_cornerRadius, m_cornerSmoothingType, BOARD_DESIGN_SETTINGS::m_MaxError, m_Poly, BOARD_DESIGN_SETTINGS::m_ZoneKeepExternalFillets, m_ZoneMinThickness, SHAPE_POLY_SET::Outline(), SHAPE_POLY_SET::PM_FAST, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE, ZONE_SETTINGS::SMOOTHING_CHAMFER, and ZONE_SETTINGS::SMOOTHING_FILLET.

Referenced by ZONE_FILLER::fillSingleZone(), and TransformSmoothedOutlineToPolygon().

◆ CacheBoundingBox()

void ZONE::CacheBoundingBox ( )
inline

Definition at line 146 of file zone.h.

EDA_RECT m_bboxCache
Temp variables used while filling.
Definition: zone.h:922
const EDA_RECT GetBoundingBox() const override
Definition: zone.cpp:320

References GetBoundingBox(), and m_bboxCache.

◆ CacheTriangulation()

void ZONE::CacheTriangulation ( PCB_LAYER_ID  aLayer = UNDEFINED_LAYER)

Create a list of triangles that "fill" the solid areas used for instance to draw these solid areas on OpenGL.

Definition at line 1058 of file zone.cpp.

1059 {
1060  if( aLayer == UNDEFINED_LAYER )
1061  {
1062  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
1063  pair.second.CacheTriangulation();
1064 
1065  m_Poly->CacheTriangulation( false );
1066  }
1067  else
1068  {
1069  if( m_FilledPolysList.count( aLayer ) )
1071  }
1072 }
void CacheTriangulation(PCB_LAYER_ID aLayer=UNDEFINED_LAYER)
Create a list of triangles that "fill" the solid areas used for instance to draw these solid areas on...
Definition: zone.cpp:1058
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824
void CacheTriangulation(bool aPartition=true)
Build a polygon triangulation, needed to draw a polygon on OpenGL and in some other calculations.
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:918

References SHAPE_POLY_SET::CacheTriangulation(), m_FilledPolysList, m_Poly, and UNDEFINED_LAYER.

Referenced by DRC_TEST_PROVIDER_SOLDER_MASK::buildRTrees().

◆ CalculateFilledArea()

double ZONE::CalculateFilledArea ( )

Compute the area currently occupied by the zone fill.

Returns
the currently filled area

Definition at line 1215 of file zone.cpp.

1216 {
1217  m_area = 0.0;
1218 
1219  // Iterate over each outline polygon in the zone and then iterate over
1220  // each hole it has to compute the total area.
1221  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
1222  {
1223  SHAPE_POLY_SET& poly = pair.second;
1224 
1225  for( int i = 0; i < poly.OutlineCount(); i++ )
1226  {
1227  m_area += poly.Outline( i ).Area();
1228 
1229  for( int j = 0; j < poly.HoleCount( i ); j++ )
1230  m_area -= poly.Hole( i, j ).Area();
1231  }
1232  }
1233 
1234  return m_area;
1235 }
int OutlineCount() const
Return the number of vertices in a given outline/hole.
double m_area
Definition: zone.h:937
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Return the aIndex-th subpolygon in the set.
double Area(bool aAbsolute=true) const
Return the area of this chain.
Represent a set of closed polygons.
SHAPE_LINE_CHAIN & Outline(int aIndex)
int HoleCount(int aOutline) const
Return the reference to aIndex-th outline in the set.
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:918

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

◆ CIterateWithHoles()

SHAPE_POLY_SET::CONST_ITERATOR ZONE::CIterateWithHoles ( ) const
inline

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

Returns
an iterator to visit the zone vertices with holes.

Definition at line 555 of file zone.h.

556  {
557  return m_Poly->CIterateWithHoles();
558  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824
CONST_ITERATOR CIterateWithHoles(int aOutline) const

References SHAPE_POLY_SET::CIterateWithHoles(), and m_Poly.

◆ ClassOf()

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

Definition at line 74 of file zone.h.

75  {
76  return aItem && aItem->Type() == PCB_ZONE_T;
77  }
class ZONE, a copper pour area
Definition: typeinfo.h:105
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112

References PCB_ZONE_T, and EDA_ITEM::Type().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

◆ ClearEditFlags()

◆ ClearFlags()

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

Definition at line 153 of file eda_item.h.

153 { m_flags &= ~aMask; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480

References EDA_ITEM::m_flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_MOVE_TOOL::AlignElements(), FOOTPRINT::BuildPolyCourtyards(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), ConvertOutlineToPolygon(), SCH_EDIT_FRAME::ConvertPart(), SYMBOL_EDITOR_EDIT_TOOL::Copy(), FOOTPRINT_EDITOR_CONTROL::CreateFootprint(), SYMBOL_EDITOR_PIN_TOOL::CreateImagePins(), MICROWAVE_TOOL::createMicrowaveInductor(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), KIGFX::SCH_PAINTER::draw(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), SCH_ITEM::Duplicate(), PCB_EDIT_FRAME::ExchangeFootprint(), PCB_SELECTION_TOOL::ExitGroup(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary(), EE_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::narrowSelection(), FOOTPRINT_EDITOR_CONTROL::NewFootprint(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), PCB_BASE_FRAME::PlaceFootprint(), SYMBOL_EDITOR_PIN_TOOL::PlacePin(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDIT_FRAME::RollbackSymbolFromUndo(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN_CACHE::savePin(), EE_SELECTION_TOOL::selectMultiple(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 165 of file eda_item.h.

166  {
168  DO_NOT_DRAW );
169  }
#define DO_NOT_DRAW
Used to disable draw function.
#define STARTPOINT
When a line is selected, these flags indicate which.
#define ENDPOINT
ends. (Used to support dragging.)
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
#define CANDIDATE
flag indicating that the structure is connected
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:153
#define SKIP_STRUCT
flag indicating that the structure should be ignored
#define TEMP_SELECTED
flag indicating that the structure has already selected

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 143 of file view_item.h.

144  {
145  m_viewPrivData = nullptr;
146  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:151

References KIGFX::VIEW_ITEM::m_viewPrivData.

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

◆ Clone()

EDA_ITEM * ZONE::Clone ( ) const
overridevirtual

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

Reimplemented in FP_ZONE.

Definition at line 186 of file zone.cpp.

187 {
188  return new ZONE( *this );
189 }
ZONE(BOARD_ITEM_CONTAINER *parent, bool aInFP=false)
The ctor to build ZONE, but compatible with FP_ZONE requirement.
Definition: zone.cpp:44

References ZONE().

◆ CommonLayerExists()

bool ZONE::CommonLayerExists ( const LSET  aLayerSet) const

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

Definition at line 234 of file zone.cpp.

235 {
236  LSET common = GetLayerSet() & aLayerSet;
237 
238  return common.count() > 0;
239 }
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: zone.cpp:289
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516

References GetLayerSet().

◆ DeleteStructure()

void BOARD_ITEM::DeleteStructure ( )
inherited

Delete this object after removing from its parent if it has one.

Definition at line 128 of file board_item.cpp.

129 {
130  BOARD_ITEM_CONTAINER* parent = GetParent();
131 
132  if( parent )
133  parent->Remove( this );
134 
135  delete this;
136 }
virtual void Remove(BOARD_ITEM *aItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL)=0
Removes an item from the container.
Abstract interface for BOARD_ITEMs capable of storing other items inside.
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:136

References BOARD_ITEM::GetParent(), and BOARD_ITEM_CONTAINER::Remove().

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

◆ Duplicate()

BOARD_ITEM * BOARD_ITEM::Duplicate ( ) const
virtualinherited

Create a copy of this BOARD_ITEM.

Reimplemented in FOOTPRINT.

Definition at line 144 of file board_item.cpp.

145 {
146  BOARD_ITEM* dupe = static_cast<BOARD_ITEM*>( Clone() );
147  const_cast<KIID&>( dupe->m_Uuid ) = KIID();
148 
149  if( dupe->GetParentGroup() )
150  dupe->GetParentGroup()->AddItem( dupe );
151 
152  return static_cast<BOARD_ITEM*>( dupe );
153 }
PCB_GROUP * GetParentGroup() const
Definition: board_item.h:60
bool AddItem(BOARD_ITEM *aItem)
Add item to group.
Definition: pcb_group.cpp:39
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:49
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition: eda_item.cpp:83
Definition: kiid.h:44
const KIID m_Uuid
Definition: eda_item.h:474

References PCB_GROUP::AddItem(), EDA_ITEM::Clone(), BOARD_ITEM::GetParentGroup(), and EDA_ITEM::m_Uuid.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), BOOST_AUTO_TEST_CASE(), PCB_GROUP::DeepDuplicate(), KIGFX::PCB_PAINTER::draw(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), EDIT_TOOL::Duplicate(), FOOTPRINT::Duplicate(), and ARRAY_CREATOR::Invoke().

◆ FillSegments() [1/2]

std::vector<SEG>& ZONE::FillSegments ( PCB_LAYER_ID  aLayer)
inline

Definition at line 308 of file zone.h.

309  {
310  wxASSERT( m_FillSegmList.count( aLayer ) );
311  return m_FillSegmList.at( aLayer );
312  }
std::map< PCB_LAYER_ID, std::vector< SEG > > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: zone.h:908

References m_FillSegmList.

Referenced by PCB_PLUGIN::format().

◆ FillSegments() [2/2]

const std::vector<SEG>& ZONE::FillSegments ( PCB_LAYER_ID  aLayer) const
inline

Definition at line 314 of file zone.h.

315  {
316  wxASSERT( m_FillSegmList.count( aLayer ) );
317  return m_FillSegmList.at( aLayer );
318  }
std::map< PCB_LAYER_ID, std::vector< SEG > > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: zone.h:908

References m_FillSegmList.

◆ Flip() [1/2]

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

Definition at line 264 of file board_item.h.

265  {
266  Flip( wxPoint( aCentre.x, aCentre.y ), aFlipLeftRight );
267  }
virtual void Flip(const wxPoint &aCentre, bool aFlipLeftRight)
Flip this object, i.e.
Definition: board_item.cpp:208

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

◆ Flip() [2/2]

void ZONE::Flip ( const wxPoint &  aCentre,
bool  aFlipLeftRight 
)
overridevirtual

Flip this object, i.e.

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

Parameters
aCentreis the rotation point.

Reimplemented from BOARD_ITEM.

Definition at line 715 of file zone.cpp.

716 {
717  Mirror( aCentre, aFlipLeftRight );
718  int copperLayerCount = GetBoard()->GetCopperLayerCount();
719 
720  SetLayerSet( FlipLayerMask( GetLayerSet(), copperLayerCount ) );
721 }
LSET FlipLayerMask(LSET aMask, int aCopperLayersCount)
Calculate the mask layer when flipping a footprint.
Definition: lset.cpp:576
void SetLayerSet(LSET aLayerSet) override
Definition: zone.cpp:250
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: zone.cpp:289
int GetCopperLayerCount() const
Definition: board.cpp:455
void Mirror(const wxPoint &aMirrorRef, bool aMirrorLeftRight)
Mirror the outlines relative to a given horizontal axis the layer is not changed.
Definition: zone.cpp:724
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36

References FlipLayerMask(), BOARD_ITEM::GetBoard(), BOARD::GetCopperLayerCount(), GetLayerSet(), Mirror(), and SetLayerSet().

◆ Get() [1/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty)
inlineinherited

Definition at line 86 of file inspectable.h.

87  {
89  TYPE_ID thisType = TYPE_HASH( *this );
90  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
91  return object ? aProperty->getter( object ) : wxAny();
92  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
virtual wxAny getter(void *aObject) const =0
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

Referenced by BOOST_AUTO_TEST_CASE(), 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 95 of file inspectable.h.

96  {
98  TYPE_ID thisType = TYPE_HASH( *this );
99  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
100  return object ? aProperty->get<T>( object ) : T();
101  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
T get(void *aObject)
Definition: property.h:268
virtual size_t OwnerHash() const =0
Return 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 104 of file inspectable.h.

105  {
107  TYPE_ID thisType = TYPE_HASH( *this );
108  PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
109  boost::optional<T> ret = T();
110 
111  if( prop )
112  {
113  void* object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
114 
115  if( object )
116  ret = prop->get<T>( object );
117  }
118 
119  return ret;
120  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
T get(void *aObject)
Definition: property.h:268
virtual size_t OwnerHash() const =0
Return 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() [1/2]

const BOARD * BOARD_ITEM::GetBoard ( ) const
virtualinherited

Return the BOARD in which this BOARD_ITEM resides, or NULL if none.

Definition at line 36 of file board_item.cpp.

37 {
38  if( Type() == PCB_T )
39  return static_cast<const BOARD*>( this );
40 
41  BOARD_ITEM* parent = GetParent();
42 
43  if( parent )
44  return parent->GetBoard();
45 
46  return nullptr;
47 }
Definition: typeinfo.h:84
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:49
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:136
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112

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

Referenced by ZONE_FILLER::addHoleKnockout(), PAD::BuildEffectivePolygon(), PAD::BuildEffectiveShapes(), BuildSmoothedPoly(), calcIsInsideArea(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), PCB_LAYER_VALUE::EqualTo(), existsOnLayer(), exprFromTo(), PCB_VIA::FlashLayer(), PAD::FlashLayer(), PCB_TARGET::Flip(), PCB_TEXT::Flip(), PCB_TRACK::Flip(), FP_SHAPE::Flip(), PCB_SHAPE::Flip(), FP_TEXT::Flip(), PCB_DIMENSION_BASE::Flip(), PCB_ARC::Flip(), PCB_VIA::Flip(), Flip(), PCB_EXPR_CONTEXT::GetBoard(), BOARD_ITEM::GetBoard(), FOOTPRINT::GetBoundingBox(), FOOTPRINT::GetBoundingHull(), BOARD_CONNECTED_ITEM::GetEffectiveNetclass(), PAD::GetEffectiveShape(), PCB_VIA::GetEffectiveShape(), GetInteractingZones(), BOARD_ITEM::GetLayerName(), PCB_VIA::GetMinAnnulus(), PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), GetMsgPanelInfo(), NETINFO_ITEM::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), BOARD_CONNECTED_ITEM::GetOwnClearance(), GetSelectMenuText(), DRC_ENGINE::GetShape(), FP_TEXT::GetShownText(), PAD::GetSolderMaskMargin(), PAD::GetSolderPasteMargin(), BOARD::GetTrackLength(), inDiffPair(), insideArea(), insideBackCourtyard(), insideCourtyard(), insideFrontCourtyard(), isInsideArea(), isInsideCourtyard(), BOARD_ITEM::IsLocked(), BOARD_ITEM::layerMaskDescribe(), PCB_VIA::layerMaskDescribe(), CONVERT_TOOL::makePolysFromCircles(), PAD::MergePrimitivesAsPolygon(), EAGLE_PLUGIN::packageWire(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), BOARD::ResolveDRCExclusions(), BOARD_CONNECTED_ITEM::SetNetCode(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow(), TransformSmoothedOutlineToPolygon(), TransformSolidAreasShapesToPolygon(), PCB_TRACK::ViewBBox(), FOOTPRINT::ViewBBox(), PCB_VIA::ViewGetLOD(), and PAD::ViewGetLOD().

◆ GetBoard() [2/2]

BOARD * BOARD_ITEM::GetBoard ( )
virtualinherited

Definition at line 50 of file board_item.cpp.

51 {
52  if( Type() == PCB_T )
53  return static_cast<BOARD*>( this );
54 
55  BOARD_ITEM* parent = GetParent();
56 
57  if( parent )
58  return parent->GetBoard();
59 
60  return nullptr;
61 }
Definition: typeinfo.h:84
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:49
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:136
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112

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

◆ GetBorderHatchPitch()

int ZONE::GetBorderHatchPitch ( ) const

HatchBorder related methods.

Returns
the zone hatch pitch in iu.

Definition at line 869 of file zone.cpp.

870 {
871  return m_borderHatchPitch;
872 }
int m_borderHatchPitch
Definition: zone.h:929

References m_borderHatchPitch.

Referenced by PCB_PLUGIN::format().

◆ GetBoundingBox()

const EDA_RECT ZONE::GetBoundingBox ( ) const
overridevirtual
Returns
an EDA_RECT that is the bounding box of the zone outline.

Reimplemented from EDA_ITEM.

Definition at line 320 of file zone.cpp.

321 {
322  auto bb = m_Poly->BBox();
323 
324  EDA_RECT ret( (wxPoint) bb.GetOrigin(), wxSize( bb.GetWidth(), bb.GetHeight() ) );
325 
326  return ret;
327 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824
Handle the component boundary box.
Definition: eda_rect.h:42
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.

References SHAPE_POLY_SET::BBox(), and m_Poly.

Referenced by CacheBoundingBox(), calcIsInsideArea(), HitTest(), FABMASTER::orderZones(), and ALTIUM_PCB::ParsePolygons6Data().

◆ GetCachedBoundingBox()

const EDA_RECT ZONE::GetCachedBoundingBox ( ) const
inline

ONLY TO BE USED BY CLIENTS WHICH SET UP THE CACHE!

Definition at line 145 of file zone.h.

145 { return m_bboxCache; }
EDA_RECT m_bboxCache
Temp variables used while filling.
Definition: zone.h:922

References m_bboxCache.

Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), ZONE_FILLER::buildCopperItemClearances(), ZONE_FILLER::buildThermalSpokes(), ZONE_FILLER::Fill(), hasThermalConnection(), and ZONE_FILLER::subtractHigherPriorityZones().

◆ GetCenter()

virtual wxPoint BOARD_ITEM::GetCenter ( ) const
inlinevirtualinherited

This defaults to the center of the bounding box if not overridden.

Returns
center point of the item

Reimplemented in PCB_ARC, PAD, PCB_SHAPE, and PCB_MARKER.

Definition at line 81 of file board_item.h.

82  {
83  return GetBoundingBox().GetCenter();
84  }
virtual const EDA_RECT GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
Definition: eda_item.cpp:75
const wxPoint GetCenter() const
Definition: eda_rect.h:113

References EDA_ITEM::GetBoundingBox(), and EDA_RECT::GetCenter().

Referenced by PCB_GRID_HELPER::computeAnchors(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), and ALTIUM_PCB::HelperParseDimensions6Radial().

◆ GetClass()

wxString ZONE::GetClass ( ) const
inlineoverridevirtual
Returns
the class name.

Implements EDA_ITEM.

Definition at line 517 of file zone.h.

518  {
519  return wxT( "ZONE" );
520  }

◆ GetCornerPosition()

const VECTOR2I& ZONE::GetCornerPosition ( int  aCornerIndex) const
inline

Definition at line 565 of file zone.h.

566  {
568 
569  // Convert global to relative indices
570  if( !m_Poly->GetRelativeIndices( aCornerIndex, &index ) )
571  throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
572 
573  return m_Poly->CVertex( index );
574  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the aGlobalIndex-th vertex in the poly set.
Structure to hold the necessary information in order to index a vertex on a SHAPE_POLY_SET object: th...
bool GetRelativeIndices(int aGlobalIdx, VERTEX_INDEX *aRelativeIndices) const
Convert a global vertex index —i.e., a number that globally identifies a vertex in a concatenated lis...

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

Referenced by GetPosition().

◆ GetCornerRadius()

unsigned int ZONE::GetCornerRadius ( ) const
inline

Definition at line 689 of file zone.h.

689 { return m_cornerRadius; }
unsigned int m_cornerRadius
Definition: zone.h:826

References m_cornerRadius.

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

◆ GetCornerSmoothingType()

int ZONE::GetCornerSmoothingType ( ) const
inline

Definition at line 685 of file zone.h.

685 { return m_cornerSmoothingType; }
int m_cornerSmoothingType
Definition: zone.h:825

References m_cornerSmoothingType.

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

◆ GetDefaultHatchPitch()

◆ GetDoNotAllowCopperPour()

bool ZONE::GetDoNotAllowCopperPour ( ) const
inline

Definition at line 736 of file zone.h.

736 { return m_doNotAllowCopperPour; }
bool m_doNotAllowCopperPour
Definition: zone.h:847

References m_doNotAllowCopperPour.

Referenced by PCB_PLUGIN::format(), GetMsgPanelInfo(), isKeepoutZone(), IsSame(), and ZONE_SETTINGS::operator<<().

◆ GetDoNotAllowFootprints()

bool ZONE::GetDoNotAllowFootprints ( ) const
inline

◆ GetDoNotAllowPads()

bool ZONE::GetDoNotAllowPads ( ) const
inline

Definition at line 739 of file zone.h.

739 { return m_doNotAllowPads; }
bool m_doNotAllowPads
Definition: zone.h:850

References m_doNotAllowPads.

Referenced by PNS::ITEM::collideSimple(), PCB_PLUGIN::format(), GetMsgPanelInfo(), isKeepoutZone(), IsSame(), and ZONE_SETTINGS::operator<<().

◆ GetDoNotAllowTracks()

bool ZONE::GetDoNotAllowTracks ( ) const
inline

◆ GetDoNotAllowVias()

bool ZONE::GetDoNotAllowVias ( ) const
inline

◆ GetEditFlags()

EDA_ITEM_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 157 of file eda_item.h.

158  {
159  constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVING | IS_RESIZING | IS_DRAGGING
161 
162  return m_flags & mask;
163  }
#define IS_NEW
New item, just created.
#define IS_RESIZING
Item being resized.
#define IS_DRAGGING
Item being dragged.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
#define IS_MOVING
Item being moved.
#define STRUCT_DELETED
flag indication structures to be erased
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.

References IS_DRAGGING, IS_MOVING, IS_NEW, IS_PASTED, IS_RESIZING, IS_WIRE_IMAGE, EDA_ITEM::m_flags, and STRUCT_DELETED.

Referenced by EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_TOOL::editFieldText(), SYMBOL_EDITOR_PIN_TOOL::EditPinProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), SCH_SYMBOL::GetMsgPanelInfo(), SELECTION_CONDITIONS::Idle(), SELECTION_CONDITIONS::IdleSelection(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PCB_POINT_EDITOR::OnSelectionChange(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), PAD_TOOL::recombinePad(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), and DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow().

◆ GetEffectiveNetclass()

NETCLASS * BOARD_CONNECTED_ITEM::GetEffectiveNetclass ( ) const
virtualinherited

Return 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 66 of file board_connected_item.cpp.

67 {
68  // NB: we must check the net first, as when it is 0 GetNetClass() will return the
69  // orphaned net netclass, not the default netclass.
70  if( !m_netinfo || m_netinfo->GetNetCode() == 0 )
72  else
73  return GetNetClass();
74 }
virtual NETCLASS * GetNetClass() const
Return the NETCLASS for this item.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:590
NETINFO_ITEM * m_netinfo
Store all information about the net that item belongs to.
NETCLASS * GetDefault() const
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
int GetNetCode() const
Definition: netinfo.h:120

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

◆ GetEffectiveShape()

std::shared_ptr< SHAPE > ZONE::GetEffectiveShape ( PCB_LAYER_ID  aLayer = UNDEFINED_LAYER,
FLASHING  aFlash = FLASHING::DEFAULT 
) const
overridevirtual

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 for use with routing, collision determination, etc).

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

Definition at line 1336 of file zone.cpp.

1337 {
1338  std::shared_ptr<SHAPE> shape;
1339 
1340  if( m_FilledPolysList.find( aLayer ) == m_FilledPolysList.end() )
1341  {
1342  shape = std::make_shared<SHAPE_NULL>();
1343  }
1344  else
1345  {
1346  shape.reset( m_FilledPolysList.at( aLayer ).Clone() );
1347  }
1348 
1349  return shape;
1350 }
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:918

References m_FilledPolysList.

◆ GetFilledArea()

double ZONE::GetFilledArea ( )
inline

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

Returns
the filled area

Definition at line 217 of file zone.h.

218  {
219  return m_area;
220  }
double m_area
Definition: zone.h:937

References m_area.

◆ GetFilledPolysList()

◆ GetFilledPolysUseThickness() [1/2]

◆ GetFilledPolysUseThickness() [2/2]

bool ZONE::GetFilledPolysUseThickness ( PCB_LAYER_ID  aLayer) const

Definition at line 368 of file zone.cpp.

369 {
370  if( ADVANCED_CFG::GetCfg().m_DebugZoneFiller && LSET::InternalCuMask().Contains( aLayer ) )
371  return false;
372 
374 }
static LSET InternalCuMask()
Return a complete set of internal copper layers which is all Cu layers except F_Cu and B_Cu.
Definition: lset.cpp:719
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
bool GetFilledPolysUseThickness() const
Definition: zone.h:691

References ADVANCED_CFG::GetCfg(), GetFilledPolysUseThickness(), and LSET::InternalCuMask().

◆ GetFillFlag()

int ZONE::GetFillFlag ( PCB_LAYER_ID  aLayer)
inline

Definition at line 227 of file zone.h.

228  {
229  return m_fillFlags.count( aLayer ) ? m_fillFlags[ aLayer ] : false;
230  }
std::map< PCB_LAYER_ID, bool > m_fillFlags
Definition: zone.h:923

References m_fillFlags.

◆ GetFillMode()

ZONE_FILL_MODE ZONE::GetFillMode ( ) const
inline

Definition at line 181 of file zone.h.

181 { return m_fillMode; }
ZONE_FILL_MODE m_fillMode
How to fill areas:
Definition: zone.h:886

References m_fillMode.

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

◆ GetFillVersion()

int ZONE::GetFillVersion ( ) const
inline

Definition at line 694 of file zone.h.

694 { return m_fillVersion; }
int m_fillVersion
Definition: zone.h:856

References m_fillVersion.

◆ GetFlags()

◆ GetFocusPosition()

virtual const wxPoint EDA_ITEM::GetFocusPosition ( ) const
inlinevirtualinherited

Similar to GetPosition, but allows items to return their visual center rather than their anchor.

Reimplemented in BOARD, PCB_TRACK, and PCB_SHAPE.

Definition at line 258 of file eda_item.h.

258 { return GetPosition(); }
virtual wxPoint GetPosition() const
Definition: eda_item.h:251

References EDA_ITEM::GetPosition().

Referenced by SCH_EDIT_FRAME::FocusOnItem().

◆ GetHashValue()

MD5_HASH ZONE::GetHashValue ( PCB_LAYER_ID  aLayer)
Returns
the hash value previously calculated by BuildHashValue().

Definition at line 380 of file zone.cpp.

381 {
382  if( !m_filledPolysHash.count( aLayer ) )
383  return g_nullPoly.GetHash();
384  else
385  return m_filledPolysHash.at( aLayer );
386 }
MD5_HASH GetHash() const
static SHAPE_POLY_SET g_nullPoly
Definition: zone.cpp:377
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: zone.h:926

References g_nullPoly, SHAPE_POLY_SET::GetHash(), and m_filledPolysHash.

◆ GetHatchBorderAlgorithm()

int ZONE::GetHatchBorderAlgorithm ( ) const
inline

Definition at line 271 of file zone.h.

271 { return m_hatchBorderAlgorithm; }
int m_hatchBorderAlgorithm
Definition: zone.h:896

References m_hatchBorderAlgorithm.

Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), PCB_PLUGIN::format(), and ZONE_SETTINGS::operator<<().

◆ GetHatchGap()

int ZONE::GetHatchGap ( ) const
inline

Definition at line 256 of file zone.h.

256 { return m_hatchGap; }
int m_hatchGap
Definition: zone.h:888

References m_hatchGap.

Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), PCB_PLUGIN::format(), and ZONE_SETTINGS::operator<<().

◆ GetHatchHoleMinArea()

double ZONE::GetHatchHoleMinArea ( ) const
inline

Definition at line 268 of file zone.h.

268 { return m_hatchHoleMinArea; }
double m_hatchHoleMinArea
Definition: zone.h:895

References m_hatchHoleMinArea.

Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), PCB_PLUGIN::format(), and ZONE_SETTINGS::operator<<().

◆ GetHatchLines()

const std::vector<SEG>& ZONE::GetHatchLines ( ) const
inline

Definition at line 801 of file zone.h.

801 { return m_borderHatchLines; }
std::vector< SEG > m_borderHatchLines
Definition: zone.h:930

References m_borderHatchLines.

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

◆ GetHatchOrientation()

double ZONE::GetHatchOrientation ( ) const
inline

Definition at line 259 of file zone.h.

259 { return m_hatchOrientation; }
double m_hatchOrientation
Definition: zone.h:889

References m_hatchOrientation.

Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), PCB_PLUGIN::format(), and ZONE_SETTINGS::operator<<().

◆ GetHatchSmoothingLevel()

int ZONE::GetHatchSmoothingLevel ( ) const
inline

Definition at line 262 of file zone.h.

262 { return m_hatchSmoothingLevel; }
int m_hatchSmoothingLevel
Definition: zone.h:890

References m_hatchSmoothingLevel.

Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), PCB_PLUGIN::format(), and ZONE_SETTINGS::operator<<().

◆ GetHatchSmoothingValue()

double ZONE::GetHatchSmoothingValue ( ) const
inline

Definition at line 265 of file zone.h.

265 { return m_hatchSmoothingValue; }
double m_hatchSmoothingValue
Definition: zone.h:894

References m_hatchSmoothingValue.

Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), PCB_PLUGIN::format(), and ZONE_SETTINGS::operator<<().

◆ GetHatchStyle()

ZONE_BORDER_DISPLAY_STYLE ZONE::GetHatchStyle ( ) const
inline

Definition at line 615 of file zone.h.

615 { return m_borderStyle; }
ZONE_BORDER_DISPLAY_STYLE m_borderStyle
Definition: zone.h:928

References m_borderStyle.

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

◆ GetHatchThickness()

int ZONE::GetHatchThickness ( ) const
inline

Definition at line 253 of file zone.h.

253 { return m_hatchThickness; }
int m_hatchThickness
Definition: zone.h:887

References m_hatchThickness.

Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), PCB_PLUGIN::format(), and ZONE_SETTINGS::operator<<().

◆ GetHV45()

bool ZONE::GetHV45 ( ) const
inline

Definition at line 803 of file zone.h.

803 { return m_hv45; }
bool m_hv45
Definition: zone.h:935

References m_hv45.

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

◆ GetInteractingZones()

void ZONE::GetInteractingZones ( PCB_LAYER_ID  aLayer,
std::vector< ZONE * > *  aZones 
) const

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 need to do some calculations with them in mind.

Definition at line 1087 of file zone.cpp.

1088 {
1089  int epsilon = Millimeter2iu( 0.001 );
1090 
1091  for( ZONE* candidate : GetBoard()->Zones() )
1092  {
1093  if( candidate == this )
1094  continue;
1095 
1096  if( !candidate->GetLayerSet().test( aLayer ) )
1097  continue;
1098 
1099  if( candidate->GetIsRuleArea() )
1100  continue;
1101 
1102  if( candidate->GetNetCode() != GetNetCode() )
1103  continue;
1104 
1105  for( auto iter = m_Poly->CIterate(); iter; iter++ )
1106  {
1107  if( candidate->m_Poly->Collide( iter.Get(), epsilon ) )
1108  {
1109  aZones->push_back( candidate );
1110  break;
1111  }
1112  }
1113  }
1114 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
CONST_ITERATOR CIterate(int aFirst, int aLast, bool aIterateHoles=false) const
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
static constexpr int Millimeter2iu(double mm)

References SHAPE_POLY_SET::CIterate(), BOARD_ITEM::GetBoard(), BOARD_CONNECTED_ITEM::GetNetCode(), m_Poly, and Millimeter2iu().

Referenced by BuildSmoothedPoly().

◆ GetIslandRemovalMode()

const ISLAND_REMOVAL_MODE ZONE::GetIslandRemovalMode ( ) const
inline

Definition at line 751 of file zone.h.

751 { return m_islandRemovalMode; }
ISLAND_REMOVAL_MODE m_islandRemovalMode
Definition: zone.h:858

References m_islandRemovalMode.

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

◆ GetIsRuleArea()

◆ GetLayer()

PCB_LAYER_ID ZONE::GetLayer ( ) const
overridevirtual

Return the primary layer this item is on.

Reimplemented from BOARD_ITEM.

Definition at line 222 of file zone.cpp.

223 {
224  return BOARD_ITEM::GetLayer();
225 }
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:143

References BOARD_ITEM::GetLayer().

Referenced by BOARD::Add(), DRAWING_TOOL::DrawZone(), PCB_EDIT_FRAME::Edit_Zone_Params(), DSN::SPECCTRA_DB::FromBOARD(), GetMsgPanelInfo(), HatchBorder(), FABMASTER::orderZones(), BRDITEMS_PLOTTER::PlotFilledAreas(), BOARD::TestZoneIntersection(), TransformSmoothedOutlineToPolygon(), and BOARD_EDITOR_CONTROL::ZoneMerge().

◆ GetLayerName()

wxString BOARD_ITEM::GetLayerName ( ) const
inherited

Return the name of the PCB layer on which the item resides.

Returns
the layer name associated with this item.

Definition at line 75 of file board_item.cpp.

76 {
77  const BOARD* board = GetBoard();
78 
79  if( board )
80  return board->GetLayerName( m_layer );
81 
82  // If no parent, return standard name
84 }
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:362
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:191
PCB_LAYER_ID m_layer
Definition: board_item.h:313
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition: board.h:606

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

Referenced by PCB_TEXT::GetMsgPanelInfo(), PCB_TARGET::GetMsgPanelInfo(), PCB_SHAPE::GetMsgPanelInfo(), FP_TEXT::GetMsgPanelInfo(), PCB_DIMENSION_BASE::GetMsgPanelInfo(), PCB_DIM_LEADER::GetMsgPanelInfo(), PCB_SHAPE::GetSelectMenuText(), PCB_TEXT::GetSelectMenuText(), FP_SHAPE::GetSelectMenuText(), PCB_TRACK::GetSelectMenuText(), PCB_DIMENSION_BASE::GetSelectMenuText(), PCB_TEXT::GetShownText(), and FOOTPRINT::ResolveTextVar().

◆ GetLayerSet()

LSET ZONE::GetLayerSet ( ) const
overridevirtual

◆ GetLocalClearance() [1/2]

int ZONE::GetLocalClearance ( wxString *  aSource) const
overridevirtual

Return 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
the clearance in internal units.

Reimplemented from BOARD_CONNECTED_ITEM.

Definition at line 492 of file zone.cpp.

493 {
494  if( m_isRuleArea )
495  return 0;
496 
497  if( aSource )
498  *aSource = _( "zone" );
499 
500  return m_ZoneClearance;
501 }
int m_ZoneClearance
Definition: zone.h:854
#define _(s)
bool m_isRuleArea
Definition: zone.h:842

References _, m_isRuleArea, and m_ZoneClearance.

Referenced by ZONE_FILLER::buildCopperItemClearances(), ZONE_FILLER::buildThermalSpokes(), CADSTAR_PCB_ARCHIVE_LOADER::calculateZonePriorities(), PCB_PLUGIN::format(), BOARD_INSPECTION_TOOL::InspectClearance(), and ZONE_SETTINGS::operator<<().

◆ GetLocalClearance() [2/2]

int ZONE::GetLocalClearance ( ) const
inline

Definition at line 157 of file zone.h.

157 { return GetLocalClearance( nullptr ); }
int GetLocalClearance() const
Definition: zone.h:157

References GetLocalClearance().

Referenced by GetLocalClearance(), and ZONE_DESC::ZONE_DESC().

◆ GetLocalClearanceOverrides()

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

Return 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
the clearance in internal units.

Reimplemented in PAD.

Definition at line 142 of file board_connected_item.h.

142 { return 0; }

Referenced by DRC_ENGINE::EvalRules().

◆ GetLocalFlags()

int ZONE::GetLocalFlags ( ) const
inline

Definition at line 305 of file zone.h.

305 { return m_localFlgs; }
int m_localFlgs
Definition: zone.h:902

References m_localFlgs.

Referenced by InitDataFromSrcInCopyCtor().

◆ GetLocalRatsnestVisible()

bool BOARD_CONNECTED_ITEM::GetLocalRatsnestVisible ( ) const
inlineinherited

◆ GetLock()

std::mutex& ZONE::GetLock ( )
inline

Definition at line 222 of file zone.h.

223  {
224  return m_lock;
225  }
std::mutex m_lock
Lock used for multi-threaded filling on multi-layer zones.
Definition: zone.h:940

References m_lock.

Referenced by ZONE_FILLER::Fill().

◆ GetMenuImage()

BITMAPS ZONE::GetMenuImage ( ) const
overridevirtual

Return 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 1044 of file zone.cpp.

1045 {
1046  return BITMAPS::add_zone;
1047 }

References add_zone.

◆ GetMinIslandArea()

long long int ZONE::GetMinIslandArea ( ) const
inline

Definition at line 754 of file zone.h.

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

References m_minIslandArea.

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

◆ GetMinThickness()

◆ GetMsgPanelInfo()

void ZONE::GetMsgPanelInfo ( EDA_DRAW_FRAME aFrame,
std::vector< MSG_PANEL_ITEM > &  aList 
)
overridevirtual

Populate 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 544 of file zone.cpp.

545 {
546  EDA_UNITS units = aFrame->GetUserUnits();
547  wxString msg;
548 
549  if( GetIsRuleArea() )
550  msg = _( "Rule Area" );
551  else if( IsOnCopperLayer() )
552  msg = _( "Copper Zone" );
553  else
554  msg = _( "Non-copper Zone" );
555 
556  // Display Cutout instead of Outline for holes inside a zone (i.e. when num contour !=0).
557  // Check whether the selected corner is in a hole; i.e., in any contour but the first one.
558  if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
559  msg << wxT( " " ) << _( "Cutout" );
560 
561  aList.emplace_back( _( "Type" ), msg );
562 
563  if( GetIsRuleArea() )
564  {
565  msg.Empty();
566 
567  if( GetDoNotAllowVias() )
568  AccumulateDescription( msg, _( "No vias" ) );
569 
570  if( GetDoNotAllowTracks() )
571  AccumulateDescription( msg, _( "No tracks" ) );
572 
573  if( GetDoNotAllowPads() )
574  AccumulateDescription( msg, _( "No pads" ) );
575 
577  AccumulateDescription( msg, _( "No copper zones" ) );
578 
580  AccumulateDescription( msg, _( "No footprints" ) );
581 
582  if( !msg.IsEmpty() )
583  aList.emplace_back( MSG_PANEL_ITEM( _( "Restrictions" ), msg ) );
584  }
585  else if( IsOnCopperLayer() )
586  {
587  if( aFrame->GetName() == PCB_EDIT_FRAME_NAME )
588  {
589  aList.emplace_back( _( "Net" ), UnescapeString( GetNetname() ) );
590 
591  aList.emplace_back( _( "Net Class" ), UnescapeString( GetNetClass()->GetName() ) );
592  }
593 
594  // Display priority level
595  aList.emplace_back( _( "Priority" ), wxString::Format( wxT( "%d" ), GetPriority() ) );
596  }
597 
598  if( aFrame->GetName() == PCB_EDIT_FRAME_NAME )
599  {
600  if( IsLocked() )
601  aList.emplace_back( _( "Status" ), _( "Locked" ) );
602  }
603 
604  wxString layerDesc;
605  int count = 0;
606 
607  for( PCB_LAYER_ID layer : m_layerSet.Seq() )
608  {
609  if( count == 0 )
610  layerDesc = GetBoard()->GetLayerName( layer );
611 
612  count++;
613  }
614 
615  if( count > 1 )
616  layerDesc.Printf( _( "%s and %d more" ), layerDesc, count - 1 );
617 
618  aList.emplace_back( _( "Layer" ), layerDesc );
619 
620  if( !m_zoneName.empty() )
621  aList.emplace_back( _( "Name" ), m_zoneName );
622 
623  switch( m_fillMode )
624  {
625  case ZONE_FILL_MODE::POLYGONS: msg = _( "Solid" ); break;
626  case ZONE_FILL_MODE::HATCH_PATTERN: msg = _( "Hatched" ); break;
627  default: msg = _( "Unknown" ); break;
628  }
629 
630  aList.emplace_back( _( "Fill Mode" ), msg );
631 
632  msg = MessageTextFromValue( units, m_area, true, EDA_DATA_TYPE::AREA );
633  aList.emplace_back( _( "Filled Area" ), msg );
634 
635  wxString source;
636  int clearance = GetOwnClearance( GetLayer(), &source );
637 
638  if( !source.IsEmpty() )
639  {
640  aList.emplace_back( wxString::Format( _( "Min Clearance: %s" ),
641  MessageTextFromValue( units, clearance ) ),
642  wxString::Format( _( "(from %s)" ),
643  source ) );
644  }
645 
646  // Useful for statistics, especially when zones are complex the number of hatches
647  // and filled polygons can explain the display and DRC calculation time:
648  msg.Printf( wxT( "%d" ), (int) m_borderHatchLines.size() );
649  aList.emplace_back( MSG_PANEL_ITEM( _( "HatchBorder Lines" ), msg ) );
650 }
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:104
bool GetDoNotAllowFootprints() const
Definition: zone.h:740
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:362
ZONE_FILL_MODE m_fillMode
How to fill areas:
Definition: zone.h:886
unsigned GetPriority() const
Definition: zone.h:122
NETCLASS * GetNetClass() const override
Return the NETCLASS for this item.
Definition: zone.h:87
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:735
wxString m_zoneName
An optional unique name for this zone, used for identifying it in DRC checking.
Definition: zone.h:829
bool GetDoNotAllowVias() const
Definition: zone.h:737
double m_area
Definition: zone.h:937
virtual bool IsLocked() const
Definition: board_item.cpp:64
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:411
LSET m_layerSet
Definition: zone.h:831
bool GetDoNotAllowPads() const
Definition: zone.h:739
bool GetDoNotAllowCopperPour() const
Definition: zone.h:736
virtual PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: zone.cpp:222
bool GetDoNotAllowTracks() const
Definition: zone.h:738
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: zone.h:900
#define _(s)
wxString UnescapeString(const wxString &aSource)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
EDA_UNITS
Definition: eda_units.h:38
std::vector< SEG > m_borderHatchLines
Definition: zone.h:930
void AccumulateDescription(wxString &aDesc, const wxString &aItem)
Utility to build comma separated lists in messages.
Definition: string_utils.h:319
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
bool IsOnCopperLayer() const override
Definition: zone.cpp:228
virtual int GetOwnClearance(PCB_LAYER_ID aLayer, wxString *aSource=nullptr) const
Return an item's "own" clearance in internal units.
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
#define PCB_EDIT_FRAME_NAME
EDA_MSG_PANEL items for displaying messages.
Definition: msgpanel.h:53
EDA_UNITS GetUserUnits() const
Return the user units currently in use.

References _, AccumulateDescription(), AREA, Format(), BOARD_ITEM::GetBoard(), GetDoNotAllowCopperPour(), GetDoNotAllowFootprints(), GetDoNotAllowPads(), GetDoNotAllowTracks(), GetDoNotAllowVias(), GetIsRuleArea(), GetLayer(), BOARD::GetLayerName(), GetNetClass(), BOARD_CONNECTED_ITEM::GetNetname(), BOARD_CONNECTED_ITEM::GetOwnClearance(), GetPriority(), EDA_BASE_FRAME::GetUserUnits(), HATCH_PATTERN, BOARD_ITEM::IsLocked(), IsOnCopperLayer(), m_area, m_borderHatchLines, SHAPE_POLY_SET::VERTEX_INDEX::m_contour, m_CornerSelection, m_fillMode, m_layerSet, m_zoneName, MessageTextFromValue(), PCB_EDIT_FRAME_NAME, POLYGONS, LSET::Seq(), and UnescapeString().

◆ GetNet()

◆ GetNetClass()

NETCLASS* ZONE::GetNetClass ( ) const
inlineoverridevirtual

Return 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.

Reimplemented from BOARD_CONNECTED_ITEM.

Definition at line 87 of file zone.h.

88  {
89  if( GetIsRuleArea() )
90  return nullptr;
91 
93  }
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:735
virtual NETCLASS * GetNetClass() const
Return the NETCLASS for this item.

References GetIsRuleArea(), and BOARD_CONNECTED_ITEM::GetNetClass().

Referenced by GetMsgPanelInfo().

◆ GetNetClassName()

wxString ZONE::GetNetClassName ( ) const
inlineoverridevirtual

Returns 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.

Reimplemented from BOARD_CONNECTED_ITEM.

Definition at line 95 of file zone.h.

96  {
97  if( GetIsRuleArea() )
98  return "UNDEFINED";
99 
101  }
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:735
virtual wxString GetNetClassName() const
Returns the netclass of the zone.

References GetIsRuleArea(), and BOARD_CONNECTED_ITEM::GetNetClassName().

◆ GetNetCode()

int BOARD_CONNECTED_ITEM::GetNetCode ( ) const
inherited
Returns
the net code.

Definition at line 100 of file board_connected_item.cpp.

101 {
102  return m_netinfo ? m_netinfo->GetNetCode() : -1;
103 }
NETINFO_ITEM * m_netinfo
Store all information about the net that item belongs to.
int GetNetCode() const
Definition: netinfo.h:120

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

Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), BOARD_CONNECTED_ITEM_DESC::BOARD_CONNECTED_ITEM_DESC(), ZONE_FILLER::buildCopperItemClearances(), connectedItemFilter(), CreateRoutesSection(), KIGFX::PCB_PAINTER::draw(), DRAWING_TOOL::DrawVia(), PCB_EDIT_FRAME::ExchangeFootprint(), ZONE_FILLER::Fill(), PNS::NODE::FindItemByParent(), PCB_PLUGIN::format(), DSN::SPECCTRA_DB::FromBOARD(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), CONNECTIVITY_DATA::GetConnectedItems(), GetInteractingZones(), PCB_TRACK::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), CONNECTIVITY_DATA::GetRatsnestForPad(), hasThermalConnection(), BOARD_INSPECTION_TOOL::highlightNet(), DIALOG_PAD_PROPERTIES::initValues(), BOARD_INSPECTION_TOOL::InspectClearance(), CONNECTIVITY_DATA::IsConnectedOnLayer(), IsIsland(), IsSame(), ZONE_FILLER::knockoutThermalReliefs(), AR_AUTOPLACER::nearestPad(), ROUTER_TOOL::NeighboringSegmentFilter(), CN_ITEM::Net(), DIALOG_DRC::OnDRCItemSelected(), PCB_TRACK::cmp_tracks::operator()(), ZONE_SETTINGS::operator<<(), DIALOG_PAD_PROPERTIES::PadTypeSelected(), process(), BOARD_EDITOR_CONTROL::RepairBoard(), PCB_SELECTION_CONDITIONS::sameNetFunc(), SaveCopyOfZones(), PCB_SELECTION_TOOL::selectNet(), ZONE_FILLER::subtractHigherPriorityZones(), PNS_KICAD_IFACE_BASE::syncArc(), PNS_KICAD_IFACE_BASE::syncPad(), PNS_KICAD_IFACE_BASE::syncTrack(), PNS_KICAD_IFACE_BASE::syncVia(), DRC_TEST_PROVIDER_SOLDER_MASK::testMaskItemAgainstZones(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZonesToZones(), BOARD::TracksInNet(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), and BOARD_EDITOR_CONTROL::ZoneMerge().

◆ GetNetname()

◆ GetNetnameMsg()

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

Definition at line 132 of file board_connected_item.cpp.

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

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

Referenced by PCB_TRACK::GetSelectMenuText(), PCB_VIA::GetSelectMenuText(), PAD::GetSelectMenuText(), and GetSelectMenuText().

◆ GetNumCorners()

int ZONE::GetNumCorners ( void  ) const
inline

Access to m_Poly parameters.

Definition at line 525 of file zone.h.

526  {
527  return m_Poly->TotalVertices();
528  }
int TotalVertices() const
Delete aIdx-th polygon from the set.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824

References m_Poly, and SHAPE_POLY_SET::TotalVertices().

Referenced by BuildSmoothedPoly(), and PCB_PLUGIN::format().

◆ GetOwnClearance()

int BOARD_CONNECTED_ITEM::GetOwnClearance ( PCB_LAYER_ID  aLayer,
wxString *  aSource = nullptr 
) const
virtualinherited

Return an item's "own" clearance in internal units.

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

Definition at line 77 of file board_connected_item.cpp.

78 {
79  DRC_CONSTRAINT constraint;
80 
81  if( GetBoard() && GetBoard()->GetDesignSettings().m_DRCEngine )
82  {
84 
85  constraint = bds.m_DRCEngine->EvalRules( CLEARANCE_CONSTRAINT, this, nullptr, aLayer );
86  }
87 
88  if( constraint.Value().HasMin() )
89  {
90  if( aSource )
91  *aSource = constraint.GetName();
92 
93  return constraint.Value().Min();
94  }
95 
96  return 0;
97 }
bool HasMin() const
Definition: minoptmax.h:37
MINOPTMAX< int > & Value()
Definition: drc_rule.h:123
T Min() const
Definition: minoptmax.h:33
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:590
wxString GetName() const
Definition: drc_rule.h:130
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
std::shared_ptr< DRC_ENGINE > m_DRCEngine
Container for design settings for a BOARD object.

References CLEARANCE_CONSTRAINT, BOARD_ITEM::GetBoard(), BOARD::GetDesignSettings(), DRC_CONSTRAINT::GetName(), MINOPTMAX< T >::HasMin(), BOARD_DESIGN_SETTINGS::m_DRCEngine, MINOPTMAX< T >::Min(), and DRC_CONSTRAINT::Value().

Referenced by KIGFX::PCB_PAINTER::draw(), GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfo(), PCB_VIA::GetMsgPanelInfo(), PAD::GetMsgPanelInfo(), and PAD::ViewBBox().

◆ GetPadConnection() [1/2]

ZONE_CONNECTION ZONE::GetPadConnection ( PAD aPad,
wxString *  aSource = nullptr 
) const

Definition at line 753 of file zone.cpp.

754 {
755  if( aPad == nullptr || aPad->GetEffectiveZoneConnection() == ZONE_CONNECTION::INHERITED )
756  {
757  if( aSource )
758  *aSource = _( "zone" );
759 
760  return m_PadConnection;
761  }
762  else
763  {
764  return aPad->GetEffectiveZoneConnection( aSource );
765  }
766 }
ZONE_CONNECTION m_PadConnection
Definition: zone.h:853
ZONE_CONNECTION GetEffectiveZoneConnection(wxString *aSource=nullptr) const
Return the zone connection in effect (either locally overridden or overridden in the parent footprint...
Definition: pad.cpp:839
#define _(s)

References _, PAD::GetEffectiveZoneConnection(), INHERITED, and m_PadConnection.

Referenced by ZONE_FILLER::buildCopperItemClearances(), PCB_PLUGIN::format(), hasThermalConnection(), BOARD_INSPECTION_TOOL::InspectClearance(), and ZONE_SETTINGS::operator<<().

◆ GetPadConnection() [2/2]

ZONE_CONNECTION ZONE::GetPadConnection ( ) const
inline

Definition at line 241 of file zone.h.

241 { return m_PadConnection; }
ZONE_CONNECTION m_PadConnection
Definition: zone.h:853

References m_PadConnection.

Referenced by ZONE_DESC::ZONE_DESC().

◆ GetParent()

BOARD_ITEM_CONTAINER* BOARD_ITEM::GetParent ( void  ) const
inlineinherited

Definition at line 136 of file board_item.h.

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

References EDA_ITEM::m_parent.

Referenced by PCB_POINT_EDITOR::addCorner(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), PNS_KICAD_IFACE::Commit(), EDIT_TOOL::copyToClipboard(), FOOTPRINT::CoverageRatio(), 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(), EDIT_TOOL::DragArcTrack(), KIGFX::PCB_PAINTER::draw(), EDIT_TOOL::Duplicate(), PCB_SELECTION_TOOL::FilterCollectorForFreePads(), PCB_SELECTION_TOOL::FilterCollectorForHierarchy(), PCB_PLUGIN::format(), FormatProbeItem(), BOARD_ITEM::GetBoard(), PCB_MARKER::GetColorLayer(), BOARD_ITEM::GetParentFootprint(), ALIGN_DISTRIBUTE_TOOL::GetSelections(), FP_TEXT::GetSelectMenuText(), PCB_TEXT::GetShownText(), FP_TEXT::GetShownText(), getTopLevelGroup(), GENERAL_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), isInsideArea(), DRC_ENGINE::IsNetTie(), FP_SHAPE::IsParentFlipped(), FP_TEXT::IsParentFlipped(), PCB_SELECTION_TOOL::itemPassesFilter(), LEGACY_PLUGIN::loadMODULE_TEXT(), memberOf(), EDIT_TOOL::MoveExact(), ALTIUM_PCB::ParseTexts6Data(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), POSITION_RELATIVE_TOOL::PositionRelative(), BOARD_COMMIT::Push(), DRC_TEST_PROVIDER_SILK_CLEARANCE::Run(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), CLIPBOARD_IO::SaveSelection(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::Selectable(), SwapItemData(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), PCB_MARKER::ViewGetLayers(), FP_ZONE::ViewGetLOD(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ GetParentFootprint()

BOARD_ITEM_CONTAINER * BOARD_ITEM::GetParentFootprint ( ) const
inherited

Definition at line 191 of file board_item.cpp.

192 {
193  BOARD_ITEM_CONTAINER* ancestor = GetParent();
194 
195  while( ancestor && ancestor->Type() == PCB_GROUP_T )
196  ancestor = ancestor->GetParent();
197 
198  return ( ancestor && ancestor->Type() == PCB_FOOTPRINT_T ) ? ancestor : nullptr;
199 }
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:108
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
Abstract interface for BOARD_ITEMs capable of storing other items inside.
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:136
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112

References BOARD_ITEM::GetParent(), PCB_FOOTPRINT_T, PCB_GROUP_T, and EDA_ITEM::Type().

Referenced by CN_CONNECTIVITY_ALGO::Add(), PNS::ITEM::collideSimple(), CONVERT_TOOL::CreatePolys(), and DRC_TEST_PROVIDER_SOLDER_MASK::testItemAgainstItems().

◆ GetParentGroup()

◆ GetPosition()

wxPoint ZONE::GetPosition ( ) const
overridevirtual
Returns
a wxPoint, position of the first point of the outline

Reimplemented from EDA_ITEM.

Definition at line 216 of file zone.cpp.

217 {
218  return (wxPoint) GetCornerPosition( 0 );
219 }
const VECTOR2I & GetCornerPosition(int aCornerIndex) const
Definition: zone.h:565

References GetCornerPosition().

Referenced by EAGLE_PLUGIN::loadPlain().

◆ GetPriority()

◆ GetSelectedCorner()

int ZONE::GetSelectedCorner ( ) const
inline

Definition at line 274 of file zone.h.

275  {
276  // Transform relative indices to global index
277  int globalIndex = -1;
278 
279  if( m_CornerSelection )
280  m_Poly->GetGlobalIndex( *m_CornerSelection, globalIndex );
281 
282  return globalIndex;
283  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: zone.h:900
bool GetGlobalIndex(VERTEX_INDEX aRelativeIndices, int &aGlobalIdx) const
Compute the global index of a vertex from the relative indices of polygon, contour and vertex.

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

◆ GetSelectMenuText()

wxString ZONE::GetSelectMenuText ( EDA_UNITS  aUnits) const
overridevirtual

Return 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 835 of file zone.cpp.

836 {
837  wxString layerDesc;
838  int count = 0;
839 
840  for( PCB_LAYER_ID layer : m_layerSet.Seq() )
841  {
842  if( count == 0 )
843  layerDesc = GetBoard()->GetLayerName( layer );
844 
845  count++;
846  }
847 
848  if( count > 1 )
849  layerDesc.Printf( _( "%s and %d more" ), layerDesc, count - 1 );
850 
851  // Check whether the selected contour is a hole (contour index > 0)
852  if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
853  {
854  if( GetIsRuleArea() )
855  return wxString::Format( _( "Rule Area Cutout on %s" ), layerDesc );
856  else
857  return wxString::Format( _( "Zone Cutout on %s" ), layerDesc );
858  }
859  else
860  {
861  if( GetIsRuleArea() )
862  return wxString::Format( _( "Rule Area on %s" ), layerDesc );
863  else
864  return wxString::Format( _( "Zone %s on %s" ), GetNetnameMsg(), layerDesc );
865  }
866 }
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:362
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:735
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:411
LSET m_layerSet
Definition: zone.h:831
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: zone.h:900
#define _(s)
wxString GetNetnameMsg() const
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36

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

Referenced by PNS_KICAD_IFACE_BASE::syncZone().

◆ GetShortNetname()

wxString BOARD_CONNECTED_ITEM::GetShortNetname ( ) const
inherited
Returns
the short netname.

Definition at line 148 of file board_connected_item.cpp.

149 {
150  return m_netinfo->GetShortNetname();
151 }
const wxString & GetShortNetname() const
Definition: netinfo.h:131
NETINFO_ITEM * m_netinfo
Store all information 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 ( EDA_ITEM_FLAGS  type) const
inlineinherited

Definition at line 136 of file eda_item.h.

137  {
138  return m_status & type;
139  }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:477

References EDA_ITEM::m_status.

Referenced by BOARD_ITEM::IsLocked().

◆ GetStatus()

EDA_ITEM_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 149 of file eda_item.h.

149 { return m_status; }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:477

References EDA_ITEM::m_status.

◆ GetThermalReliefGap() [1/2]

◆ GetThermalReliefGap() [2/2]

int ZONE::GetThermalReliefGap ( PAD aPad,
wxString *  aSource = nullptr 
) const

Definition at line 330 of file zone.cpp.

331 {
332  if( aPad->GetEffectiveThermalGap() == 0 )
333  {
334  if( aSource )
335  *aSource = _( "zone" );
336 
337  return m_thermalReliefGap;
338  }
339 
340  return aPad->GetEffectiveThermalGap( aSource );
341 
342 }
int GetEffectiveThermalGap(wxString *aSource=nullptr) const
Return the effective thermal gap having resolved any inheritance.
Definition: pad.cpp:879
int m_thermalReliefGap
Definition: zone.h:876
#define _(s)

References _, PAD::GetEffectiveThermalGap(), and m_thermalReliefGap.

◆ GetThermalReliefSpokeWidth() [1/2]

int ZONE::GetThermalReliefSpokeWidth ( ) const
inline

◆ GetThermalReliefSpokeWidth() [2/2]

int ZONE::GetThermalReliefSpokeWidth ( PAD aPad,
wxString *  aSource = nullptr 
) const

Definition at line 345 of file zone.cpp.

346 {
347  if( aPad->GetEffectiveThermalSpokeWidth() == 0 )
348  {
349  if( aSource )
350  *aSource = _( "zone" );
351 
353  }
354 
355  return aPad->GetEffectiveThermalSpokeWidth( aSource );
356 }
int GetEffectiveThermalSpokeWidth(wxString *aSource=nullptr) const
Return the effective thermal spoke width having resolved any inheritance.
Definition: pad.cpp:860
#define _(s)
int m_thermalReliefSpokeWidth
Definition: zone.h:877

References _, PAD::GetEffectiveThermalSpokeWidth(), and m_thermalReliefSpokeWidth.

◆ GetX()

int BOARD_ITEM::GetX ( ) const
inlineinherited

◆ GetY()

int BOARD_ITEM::GetY ( ) const
inlineinherited

◆ GetZoneName()

wxString ZONE::GetZoneName ( ) const
inline

Definition at line 129 of file zone.h.

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

References m_zoneName.

Referenced by PCB_PLUGIN::format(), PNS::ROUTER::isStartingPointRoutable(), Matches(), ZONE_SETTINGS::operator<<(), PNS_KICAD_IFACE_BASE::syncZone(), and ZONE_DESC::ZONE_DESC().

◆ HasFilledPolysForLayer()

bool ZONE::HasFilledPolysForLayer ( PCB_LAYER_ID  aLayer) const
inline

Definition at line 629 of file zone.h.

630  {
631  return m_FilledPolysList.count( aLayer ) > 0;
632  }
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:918

References m_FilledPolysList.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers(), and ALTIUM_PCB::ParseRegions6Data().

◆ HasFlag()

◆ HatchBorder()

void ZONE::HatchBorder ( )

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

Definition at line 906 of file zone.cpp.

907 {
908  UnHatchBorder();
909 
911  || m_borderHatchPitch == 0
912  || m_Poly->IsEmpty() )
913  {
914  return;
915  }
916 
917  // define range for hatch lines
918  int min_x = m_Poly->CVertex( 0 ).x;
919  int max_x = m_Poly->CVertex( 0 ).x;
920  int min_y = m_Poly->CVertex( 0 ).y;
921  int max_y = m_Poly->CVertex( 0 ).y;
922 
923  for( auto iterator = m_Poly->IterateWithHoles(); iterator; iterator++ )
924  {
925  if( iterator->x < min_x )
926  min_x = iterator->x;
927 
928  if( iterator->x > max_x )
929  max_x = iterator->x;
930 
931  if( iterator->y < min_y )
932  min_y = iterator->y;
933 
934  if( iterator->y > max_y )
935  max_y = iterator->y;
936  }
937 
938  // Calculate spacing between 2 hatch lines
939  int spacing;
940 
942  spacing = m_borderHatchPitch;
943  else
944  spacing = m_borderHatchPitch * 2;
945 
946  // set the "length" of hatch lines (the length on horizontal axis)
947  int hatch_line_len = m_borderHatchPitch;
948 
949  // To have a better look, give a slope depending on the layer
950  LAYER_NUM layer = GetLayer();
951  int slope_flag = (layer & 1) ? 1 : -1; // 1 or -1
952  double slope = 0.707106 * slope_flag; // 45 degrees slope
953  int max_a, min_a;
954 
955  if( slope_flag == 1 )
956  {
957  max_a = KiROUND( max_y - slope * min_x );
958  min_a = KiROUND( min_y - slope * max_x );
959  }
960  else
961  {
962  max_a = KiROUND( max_y - slope * max_x );
963  min_a = KiROUND( min_y - slope * min_x );
964  }
965 
966  min_a = (min_a / spacing) * spacing;
967 
968  // calculate an offset depending on layer number,
969  // for a better look of hatches on a multilayer board
970  int offset = (layer * 7) / 8;
971  min_a += offset;
972 
973  // loop through hatch lines
974  std::vector<VECTOR2I> pointbuffer;
975  pointbuffer.reserve( 256 );
976 
977  for( int a = min_a; a < max_a; a += spacing )
978  {
979  pointbuffer.clear();
980 
981  // Iterate through all vertices
982  for( auto iterator = m_Poly->IterateSegmentsWithHoles(); iterator; iterator++ )
983  {
984  double x, y;
985 
986  SEG segment = *iterator;
987 
988  if( FindLineSegmentIntersection( a, slope, segment.A.x, segment.A.y, segment.B.x,
989  segment.B.y, x, y ) )
990  pointbuffer.emplace_back( KiROUND( x ), KiROUND( y ) );
991  }
992 
993  // sort points in order of descending x (if more than 2) to
994  // ensure the starting point and the ending point of the same segment
995  // are stored one just after the other.
996  if( pointbuffer.size() > 2 )
997  sort( pointbuffer.begin(), pointbuffer.end(), sortEndsByDescendingX );
998 
999  // creates lines or short segments inside the complex polygon
1000  for( size_t ip = 0; ip + 1 < pointbuffer.size(); ip += 2 )
1001  {
1002  int dx = pointbuffer[ip + 1].x - pointbuffer[ip].x;
1003 
1004  // Push only one line for diagonal hatch,
1005  // or for small lines < twice the line length
1006  // else push 2 small lines
1008  || std::abs( dx ) < 2 * hatch_line_len )
1009  {
1010  m_borderHatchLines.emplace_back( SEG( pointbuffer[ip], pointbuffer[ ip + 1] ) );
1011  }
1012  else
1013  {
1014  double dy = pointbuffer[ip + 1].y - pointbuffer[ip].y;
1015  slope = dy / dx;
1016 
1017  if( dx > 0 )
1018  dx = hatch_line_len;
1019  else
1020  dx = -hatch_line_len;
1021 
1022  int x1 = KiROUND( pointbuffer[ip].x + dx );
1023  int x2 = KiROUND( pointbuffer[ip + 1].x - dx );
1024  int y1 = KiROUND( pointbuffer[ip].y + dx * slope );
1025  int y2 = KiROUND( pointbuffer[ip + 1].y - dx * slope );
1026 
1027  m_borderHatchLines.emplace_back( SEG( pointbuffer[ip].x, pointbuffer[ip].y,
1028  x1, y1 ) );
1029 
1030  m_borderHatchLines.emplace_back( SEG( pointbuffer[ip+1].x, pointbuffer[ip+1].y,
1031  x2, y2 ) );
1032  }
1033  }
1034  }
1035 }
ZONE_BORDER_DISPLAY_STYLE m_borderStyle
Definition: zone.h:928
void UnHatchBorder()
Clear the zone's hatch.
Definition: zone.cpp:892
SEGMENT_ITERATOR IterateSegmentsWithHoles()
Return an iterator object, for the aOutline-th outline in the set (with holes).
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the aGlobalIndex-th vertex in the poly set.
bool IsEmpty() const
int LAYER_NUM
This can be replaced with int and removed.
Definition: layer_ids.h:41
ITERATOR IterateWithHoles(int aOutline)
virtual PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: zone.cpp:222
bool sortEndsByDescendingX(const VECTOR2I &ref, const VECTOR2I &tst)
Definition: zone.cpp:900
int m_borderHatchPitch
Definition: zone.h:929
Definition: seg.h:40
std::vector< SEG > m_borderHatchLines
Definition: zone.h:930
VECTOR2I A
Definition: seg.h:48
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:73
VECTOR2I B
Definition: seg.h:49

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

Referenced by CONVERT_TOOL::CreatePolys(), Mirror(), Move(), MoveEdge(), EDIT_TOOL::Remove(), Rotate(), SetBorderDisplayStyle(), and PCB_POINT_EDITOR::updateItem().

◆ HitTest() [1/2]

bool ZONE::HitTest ( const wxPoint &  aPosition,
int  aAccuracy = 0 
) const
overridevirtual

Test if a point is near an outline edge or a corner of this zone.

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

Reimplemented from EDA_ITEM.

Definition at line 398 of file zone.cpp.

399 {
400  // When looking for an "exact" hit aAccuracy will be 0 which works poorly for very thin
401  // lines. Give it a floor.
402  int accuracy = std::max( aAccuracy, Millimeter2iu( 0.1 ) );
403 
404  return HitTestForCorner( aPosition, accuracy * 2 ) || HitTestForEdge( aPosition, accuracy );
405 }
bool HitTestForCorner(const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
Test if the given wxPoint is near a corner.
Definition: zone.cpp:423
bool HitTestForEdge(const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
Test if the given wxPoint is near a segment defined by 2 corners.
Definition: zone.cpp:437
static constexpr int Millimeter2iu(double mm)

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

◆ HitTest() [2/2]

bool ZONE::HitTest ( const EDA_RECT aRect,
bool  aContained = true,
int  aAccuracy = 0 
) const
overridevirtual

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 451 of file zone.cpp.

452 {
453  // Calculate bounding box for zone
454  EDA_RECT bbox = GetBoundingBox();
455  bbox.Normalize();
456 
457  EDA_RECT arect = aRect;
458  arect.Normalize();
459  arect.Inflate( aAccuracy );
460 
461  if( aContained )
462  {
463  return arect.Contains( bbox );
464  }
465  else
466  {
467  // Fast test: if aBox is outside the polygon bounding box, rectangles cannot intersect
468  if( !arect.Intersects( bbox ) )
469  return false;
470 
471  int count = m_Poly->TotalVertices();
472 
473  for( int ii = 0; ii < count; ii++ )
474  {
475  auto vertex = m_Poly->CVertex( ii );
476  auto vertexNext = m_Poly->CVertex( ( ii + 1 ) % count );
477 
478  // Test if the point is within the rect
479  if( arect.Contains( ( wxPoint ) vertex ) )
480  return true;
481 
482  // Test if this edge intersects the rect
483  if( arect.Intersects( ( wxPoint ) vertex, ( wxPoint ) vertexNext ) )
484  return true;
485  }
486 
487  return false;
488  }
489 }
int TotalVertices() const
Delete aIdx-th polygon from the set.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the aGlobalIndex-th vertex in the poly set.
bool Contains(const wxPoint &aPoint) const
Definition: eda_rect.cpp:57
const EDA_RECT GetBoundingBox() const override
Definition: zone.cpp:320
void Normalize()
Ensures that the height ant width are positive.
Definition: eda_rect.cpp:35
Handle the component boundary box.
Definition: eda_rect.h:42
bool Intersects(const EDA_RECT &aRect) const
Test for a common area between rectangles.
Definition: eda_rect.cpp:150
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:364

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

◆ HitTestCutout() [1/2]

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

Test 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 519 of file zone.cpp.

520 {
521  // Iterate over each outline polygon in the zone and then iterate over
522  // each hole it has to see if the point is in it.
523  for( int i = 0; i < m_Poly->OutlineCount(); i++ )
524  {
525  for( int j = 0; j < m_Poly->HoleCount( i ); j++ )
526  {
527  if( m_Poly->Hole( i, j ).PointInside( aRefPos ) )
528  {
529  if( aOutlineIdx )
530  *aOutlineIdx = i;
531 
532  if( aHoleIdx )
533  *aHoleIdx = j;
534 
535  return true;
536  }
537  }
538  }
539 
540  return false;
541 }
int OutlineCount() const
Return the number of vertices in a given outline/hole.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Return the aIndex-th subpolygon in the set.
bool PointInside(const VECTOR2I &aPt, int aAccuracy=0, bool aUseBBoxCache=false) const
Check if point aP lies inside a polygon (any type) defined by the line chain.
int HoleCount(int aOutline) const
Return the reference to aIndex-th outline in the set.

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

Referenced by HitTestCutout(), and EDIT_TOOL::Remove().

◆ HitTestCutout() [2/2]

bool ZONE::HitTestCutout ( const wxPoint &  aRefPos,
int *  aOutlineIdx = nullptr,
int *  aHoleIdx = nullptr 
) const
inline

Definition at line 359 of file zone.h.

361  {
362  return HitTestCutout( VECTOR2I( aRefPos.x, aRefPos.y ), aOutlineIdx, aHoleIdx );
363  }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:622
bool HitTestCutout(const VECTOR2I &aRefPos, int *aOutlineIdx=nullptr, int *aHoleIdx=nullptr) const
Test if the given point is contained within a cutout of the zone.
Definition: zone.cpp:519

References HitTestCutout().

◆ HitTestFilledArea()

bool ZONE::HitTestFilledArea ( PCB_LAYER_ID  aLayer,
const wxPoint &  aRefPos,
int  aAccuracy = 0 
) const

Test 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
true if a hit, else false

Definition at line 504 of file zone.cpp.

505 {
506  // Rule areas have no filled area, but it's generally nice to treat their interior as if it were
507  // filled so that people don't have to select them by their outline (which is min-width)
508  if( GetIsRuleArea() )
509  return m_Poly->Contains( VECTOR2I( aRefPos.x, aRefPos.y ), -1, aAccuracy );
510 
511  if( !m_FilledPolysList.count( aLayer ) )
512  return false;
513 
514  return m_FilledPolysList.at( aLayer ).Contains( VECTOR2I( aRefPos.x, aRefPos.y ), -1,
515  aAccuracy );
516 }
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:735
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824
bool Contains(const VECTOR2I &aP, int aSubpolyIndex=-1, int aAccuracy=0, bool aUseBBoxCaches=false) const
Return true if a given subpolygon contains the point aP.
VECTOR2< int > VECTOR2I
Definition: vector2d.h:622
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:918

References SHAPE_POLY_SET::Contains(), GetIsRuleArea(), m_FilledPolysList, and m_Poly.

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

◆ HitTestForCorner() [1/2]

bool ZONE::HitTestForCorner ( const wxPoint &  refPos,
int  aAccuracy,
SHAPE_POLY_SET::VERTEX_INDEX aCornerHit 
) const

Test 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
true if some corner was found to be closer to refPos than aClearance; false otherwise.

Definition at line 423 of file zone.cpp.

425 {
426  return m_Poly->CollideVertex( VECTOR2I( refPos ), aCornerHit, aAccuracy );
427 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824
VECTOR2< int > VECTOR2I
Definition: vector2d.h:622
bool CollideVertex(const VECTOR2I &aPoint, VERTEX_INDEX &aClosestVertex, int aClearance=0) const
Check whether aPoint collides with any vertex of any of the contours of the polygon.

References SHAPE_POLY_SET::CollideVertex(), and m_Poly.

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

◆ HitTestForCorner() [2/2]

bool ZONE::HitTestForCorner ( const wxPoint &  refPos,
int  aAccuracy 
) const

Test if the given wxPoint is near a corner.

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

Definition at line 430 of file zone.cpp.

431 {
433  return HitTestForCorner( refPos, aAccuracy, dummy );
434 }
Structure to hold the necessary information in order to index a vertex on a SHAPE_POLY_SET object: th...
bool HitTestForCorner(const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
Test if the given wxPoint is near a corner.
Definition: zone.cpp:423
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:72

References dummy(), and HitTestForCorner().

◆ HitTestForEdge() [1/2]

bool ZONE::HitTestForEdge ( const wxPoint &  refPos,
int  aAccuracy,
SHAPE_POLY_SET::VERTEX_INDEX aCornerHit 
) const

Test 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
true if some edge was found to be closer to refPos than aClearance.

Definition at line 437 of file zone.cpp.

439 {
440  return m_Poly->CollideEdge( VECTOR2I( refPos ), aCornerHit, aAccuracy );
441 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824
VECTOR2< int > VECTOR2I
Definition: vector2d.h:622
bool CollideEdge(const VECTOR2I &aPoint, VERTEX_INDEX &aClosestVertex, int aClearance=0) const
Check whether aPoint collides with any edge of any of the contours of the polygon.

References SHAPE_POLY_SET::CollideEdge(), and m_Poly.

Referenced by HitTest(), PCB_SELECTION_TOOL::hitTestDistance(), HitTestForEdge(), GENERAL_COLLECTOR::Inspect(), PCB_SELECTION_TOOL::Main(), and SetSelectedCorner().

◆ HitTestForEdge() [2/2]

bool ZONE::HitTestForEdge ( const wxPoint &  refPos,
int  aAccuracy 
) const

Test 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
true if some edge was found to be closer to refPos than aClearance.

Definition at line 444 of file zone.cpp.

445 {
447  return HitTestForEdge( refPos, aAccuracy, dummy );
448 }
Structure to hold the necessary information in order to index a vertex on a SHAPE_POLY_SET object: th...
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:72
bool HitTestForEdge(const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
Test if the given wxPoint is near a segment defined by 2 corners.
Definition: zone.cpp:437

References dummy(), and HitTestForEdge().

◆ InitDataFromSrcInCopyCtor()

void ZONE::InitDataFromSrcInCopyCtor ( const ZONE aZone)

Copy aZone data to me.

Definition at line 111 of file zone.cpp.

112 {
113  // members are expected non initialize in this.
114  // InitDataFromSrcInCopyCtor() is expected to be called
115  // only from a copy constructor.
116 
117  // Copy only useful EDA_ITEM flags:
118  m_flags = aZone.m_flags;
120 
121  // Replace the outlines for aZone outlines.
122  delete m_Poly;
123  m_Poly = new SHAPE_POLY_SET( *aZone.m_Poly );
124 
127  m_zoneName = aZone.m_zoneName;
128  m_priority = aZone.m_priority;
129  m_isRuleArea = aZone.m_isRuleArea;
130  SetLayerSet( aZone.GetLayerSet() );
131 
137 
139  m_ZoneClearance = aZone.m_ZoneClearance; // clearance value
144 
145  m_isFilled = aZone.m_isFilled;
146  m_needRefill = aZone.m_needRefill;
147 
150 
151  m_fillMode = aZone.m_fillMode; // solid vs. hatched
153  m_hatchGap = aZone.m_hatchGap;
159 
160  // For corner moving, corner index to drag, or nullptr if no selection
161  delete m_CornerSelection;
162  m_CornerSelection = nullptr;
163 
164  for( PCB_LAYER_ID layer : aZone.GetLayerSet().Seq() )
165  {
166  m_FilledPolysList[layer] = aZone.m_FilledPolysList.at( layer );
167  m_RawPolysList[layer] = aZone.m_RawPolysList.at( layer );
168  m_filledPolysHash[layer] = aZone.m_filledPolysHash.at( layer );
169  m_FillSegmList[layer] = aZone.m_FillSegmList.at( layer ); // vector <> copy
170  m_insulatedIslands[layer] = aZone.m_insulatedIslands.at( layer );
171  }
172 
176 
177  SetLocalFlags( aZone.GetLocalFlags() );
178 
179  m_netinfo = aZone.m_netinfo;
180 
181  m_hv45 = aZone.m_hv45;
182  m_area = aZone.m_area;
183 }
ZONE_BORDER_DISPLAY_STYLE m_borderStyle
Definition: zone.h:928
bool m_doNotAllowFootprints
Definition: zone.h:851
unsigned int m_cornerRadius
Definition: zone.h:826
ZONE_FILL_MODE m_fillMode
How to fill areas:
Definition: zone.h:886
int m_ZoneClearance
Definition: zone.h:854
int m_cornerSmoothingType
Definition: zone.h:825
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824
wxString m_zoneName
An optional unique name for this zone, used for identifying it in DRC checking.
Definition: zone.h:829
int m_hatchSmoothingLevel
Definition: zone.h:890
void SetLayerSet(LSET aLayerSet) override
Definition: zone.cpp:250
ZONE_CONNECTION m_PadConnection
Definition: zone.h:853
double m_area
Definition: zone.h:937
bool m_doNotAllowTracks
Definition: zone.h:849
long long int m_minIslandArea
When island removal mode is set to AREA, islands below this area will be removed.
Definition: zone.h:864
double m_hatchOrientation
Definition: zone.h:889
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: zone.cpp:289
std::map< PCB_LAYER_ID, std::set< int > > m_insulatedIslands
For each layer, a set of insulated islands that were not removed.
Definition: zone.h:933
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:411
int m_hatchThickness
Definition: zone.h:887
bool m_doNotAllowVias
Definition: zone.h:848
Represent a set of closed polygons.
int GetLocalFlags() const
Definition: zone.h:305
int m_thermalReliefGap
Definition: zone.h:876
bool m_hv45
Definition: zone.h:935
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: zone.h:900
ISLAND_REMOVAL_MODE m_islandRemovalMode
Definition: zone.h:858
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: zone.h:926
int m_ZoneMinThickness
Definition: zone.h:855
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_RawPolysList
Definition: zone.h:919
bool m_isRuleArea
Definition: zone.h:842
std::map< PCB_LAYER_ID, std::vector< SEG > > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: zone.h:908
int m_borderHatchPitch
Definition: zone.h:929
std::vector< SEG > m_borderHatchLines
Definition: zone.h:930
void SetLocalFlags(int aFlags)
Definition: zone.h:306
int m_hatchBorderAlgorithm
Definition: zone.h:896
bool m_isFilled
True when a zone was filled, false after deleting the filled areas.
Definition: zone.h:867
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
NETINFO_ITEM * m_netinfo
Store all information about the net that item belongs to.
int m_hatchGap
Definition: zone.h:888
bool m_doNotAllowCopperPour
Definition: zone.h:847
int m_fillVersion
Definition: zone.h:856
double m_hatchHoleMinArea
Definition: zone.h:895
bool m_needRefill
False when a zone was refilled, true after changes in zone params.
Definition: zone.h:874
bool m_forceVisible
Definition: eda_item.h:479
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:918
unsigned m_priority
Definition: zone.h:837
double m_hatchSmoothingValue
Definition: zone.h:894
int m_thermalReliefSpokeWidth
Definition: zone.h:877
bool m_doNotAllowPads
Definition: zone.h:850

References GetLayerSet(), GetLocalFlags(), m_area, m_borderHatchLines, m_borderHatchPitch, m_borderStyle, m_cornerRadius, m_CornerSelection, m_cornerSmoothingType, m_doNotAllowCopperPour, m_doNotAllowFootprints, m_doNotAllowPads, m_doNotAllowTracks, m_doNotAllowVias, m_filledPolysHash, m_FilledPolysList, m_fillMode, m_FillSegmList, m_fillVersion, EDA_ITEM::m_flags, EDA_ITEM::m_forceVisible, m_hatchBorderAlgorithm, m_hatchGap, m_hatchHoleMinArea, m_hatchOrientation, m_hatchSmoothingLevel, m_hatchSmoothingValue, m_hatchThickness, m_hv45, m_insulatedIslands, m_isFilled, m_islandRemovalMode, m_isRuleArea, m_minIslandArea, m_needRefill, BOARD_CONNECTED_ITEM::m_netinfo, m_PadConnection, m_Poly, m_priority, m_RawPolysList, m_thermalReliefGap, m_thermalReliefSpokeWidth, m_ZoneClearance, m_ZoneMinThickness, m_zoneName, LSET::Seq(), SetLayerSet(), and SetLocalFlags().

Referenced by FP_ZONE::FP_ZONE(), operator=(), CLIPBOARD_IO::SaveSelection(), and ZONE().

◆ IsBrightened()

◆ IsConnected()

bool ZONE::IsConnected ( ) const
inlineoverridevirtual

Not all ZONEs are really BOARD_CONNECTED_ITEMs....

Reimplemented from BOARD_CONNECTED_ITEM.

Definition at line 82 of file zone.h.

83  {
84  return !GetIsRuleArea();
85  }
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:735

References GetIsRuleArea().

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 120 of file eda_item.h.

120 { return m_flags & IS_DRAGGING; }
#define IS_DRAGGING
Item being dragged.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480

References IS_DRAGGING, and EDA_ITEM::m_flags.

Referenced by DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES().

◆ IsEntered()

bool EDA_ITEM::IsEntered ( ) const
inlineinherited

Definition at line 123 of file eda_item.h.

123 { return m_flags & ENTERED; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480
#define ENTERED
indicates a group has been entered

References ENTERED, and EDA_ITEM::m_flags.

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

◆ IsFilled()

bool ZONE::IsFilled ( ) const
inline

Definition at line 234 of file zone.h.

234 { return m_isFilled; }
bool m_isFilled
True when a zone was filled, false after deleting the filled areas.
Definition: zone.h:867

References m_isFilled.

Referenced by calcIsInsideArea(), PCB_EDIT_FRAME::Edit_Zone_Params(), PCB_PLUGIN::format(), and CONNECTIVITY_DATA::IsConnectedOnLayer().

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 205 of file eda_item.h.

205 { return m_forceVisible; }
bool m_forceVisible
Definition: eda_item.h:479

References EDA_ITEM::m_forceVisible.

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

◆ IsIsland()

bool ZONE::IsIsland ( PCB_LAYER_ID  aLayer,
int  aPolyIdx 
) const

Check if a given filled polygon is an insulated island.

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

Definition at line 1075 of file zone.cpp.

1076 {
1077  if( GetNetCode() < 1 )
1078  return true;
1079 
1080  if( !m_insulatedIslands.count( aLayer ) )
1081  return false;
1082 
1083  return m_insulatedIslands.at( aLayer ).count( aPolyIdx );
1084 }
std::map< PCB_LAYER_ID, std::set< int > > m_insulatedIslands
For each layer, a set of insulated islands that were not removed.
Definition: zone.h:933

References BOARD_CONNECTED_ITEM::GetNetCode(), and m_insulatedIslands.

Referenced by PCB_PLUGIN::format().

◆ IsKeepout()

bool ZONE::IsKeepout ( ) const

Definition at line 1269 of file zone.cpp.

1270 {
1273 }
bool m_doNotAllowFootprints
Definition: zone.h:851
bool m_doNotAllowTracks
Definition: zone.h:849
bool m_doNotAllowVias
Definition: zone.h:848
bool m_doNotAllowCopperPour
Definition: zone.h:847
bool m_doNotAllowPads
Definition: zone.h:850

References m_doNotAllowCopperPour, m_doNotAllowFootprints, m_doNotAllowPads, m_doNotAllowTracks, and m_doNotAllowVias.

◆ IsLocked()

bool BOARD_ITEM::IsLocked ( ) const
virtualinherited
Returns
true if the object is locked, else false.

Reimplemented in FOOTPRINT, and PAD.

Definition at line 64 of file board_item.cpp.

65 {
66  if( GetParentGroup() )
67  return GetParentGroup()->IsLocked();
68 
69  const BOARD* board = GetBoard();
70 
71  return board && board->GetBoardUse() != BOARD_USE::FPHOLDER && GetState( LOCKED );
72 }
PCB_GROUP * GetParentGroup() const
Definition: board_item.h:60
virtual bool IsLocked() const
Definition: board_item.cpp:64
#define LOCKED
Pcbnew: locked from movement and deletion.
int GetState(EDA_ITEM_FLAGS type) const
Definition: eda_item.h:136
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:191
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
BOARD_USE GetBoardUse() const
Get what the board use is.
Definition: board.h:211

References FPHOLDER, BOARD_ITEM::GetBoard(), BOARD::GetBoardUse(), BOARD_ITEM::GetParentGroup(), EDA_ITEM::GetState(), BOARD_ITEM::IsLocked(), and LOCKED.

Referenced by BOARD_ITEM_DESC::BOARD_ITEM_DESC(), PCB_CONTROL::DeleteItemCursor(), DIALOG_GROUP_PROPERTIES::DIALOG_GROUP_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), EDIT_TOOL::DragArcTrack(), EDIT_TOOL::FilletTracks(), PCB_PLUGIN::format(), DSN::SPECCTRA_DB::FromBOARD(), DSN::SPECCTRA_DB::FromSESSION(), PCB_TEXT::GetMsgPanelInfo(), PCB_SHAPE::GetMsgPanelInfo(), GetMsgPanelInfo(), FP_TEXT::GetMsgPanelInfo(), PCB_GROUP::GetMsgPanelInfo(), PCB_DIMENSION_BASE::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfoBase_Common(), ALIGN_DISTRIBUTE_TOOL::GetSelections(), GROUP_TOOL::Group(), ROUTER_TOOL::InlineDrag(), GENERAL_COLLECTOR::Inspect(), PAD::IsLocked(), BOARD_ITEM::IsLocked(), PCB_SELECTION_TOOL::itemPassesFilter(), CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromShapes(), TRACKS_CLEANER::mergeCollinearSegments(), BOARD_EDITOR_CONTROL::modifyLockSelected(), PCB_POINT_EDITOR::OnSelectionChange(), ZONE_SETTINGS::operator<<(), POSITION_RELATIVE_TOOL::PositionRelative(), processTextItem(), PCB_SELECTION_TOOL::RequestSelection(), PNS_KICAD_IFACE_BASE::syncArc(), PNS_KICAD_IFACE_BASE::syncTrack(), PNS_KICAD_IFACE_BASE::syncVia(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), and DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow().

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 117 of file eda_item.h.

117 { return m_flags & IS_CHANGED; }
#define IS_CHANGED
Item was edited, and modified.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480

References IS_CHANGED, and EDA_ITEM::m_flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsNew()

◆ IsOnCopperLayer()

bool ZONE::IsOnCopperLayer ( ) const
overridevirtual
Returns
true if this zone is on a copper layer, false if on a technical layer.

Reimplemented from BOARD_ITEM.

Definition at line 228 of file zone.cpp.

229 {
230  return ( m_layerSet & LSET::AllCuMask() ).count() > 0;
231 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:759
LSET m_layerSet
Definition: zone.h:831

References LSET::AllCuMask(), and m_layerSet.

Referenced by DRC_TEST_PROVIDER_SOLDER_MASK::addItemToRTrees(), ZONE_FILLER::fillSingleZone(), GetMsgPanelInfo(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), EDA_3D_CANVAS::OnMouseMove(), and BRDITEMS_PLOTTER::PlotFilledAreas().

◆ IsOnLayer()

bool ZONE::IsOnLayer ( PCB_LAYER_ID  aLayer) const
overridevirtual

Test to see if this object is on the given layer.

Virtual so objects like PAD, which reside on multiple layers can do their own form of testing.

Parameters
aLayerThe layer to test for.
Returns
true if on given layer, else false.

Reimplemented from BOARD_ITEM.

Definition at line 314 of file zone.cpp.

315 {
316  return m_layerSet.test( aLayer );
317 }
LSET m_layerSet
Definition: zone.h:831

References m_layerSet.

Referenced by DRC_TEST_PROVIDER_SOLDER_MASK::addItemToRTrees(), KIGFX::PCB_PAINTER::draw(), DSN::SPECCTRA_DB::FromBOARD(), BOARD_INSPECTION_TOOL::InspectClearance(), and DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZonesToZones().

◆ IsReplaceable()

virtual bool EDA_ITEM::IsReplaceable ( ) const
inlinevirtualinherited

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_SYMBOL, SCH_SHEET, SCH_LABEL, SCH_TEXT, SCH_FIELD, and SCH_SHEET_PIN.

Definition at line 402 of file eda_item.h.

402 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 124 of file eda_item.h.

124 { return m_flags & IS_RESIZING; }
#define IS_RESIZING
Item being resized.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480

References IS_RESIZING, and EDA_ITEM::m_flags.

◆ IsSame()

bool ZONE::IsSame ( const ZONE aZoneToCompare)

Test if 2 zones are equivalent.

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.

Zones are equivalent if they have same parameters and same outline info.

Note
Filling is not taken into account.
Parameters
aZoneToCompareis the zone to compare with "this"
aZoneToCompare= zone to compare with "this"

Definition at line 60 of file zones_functions_for_undo_redo.cpp.

61 {
62  // compare basic parameters:
63  if( GetLayerSet() != aZoneToCompare.GetLayerSet() )
64  return false;
65 
66  if( GetNetCode() != aZoneToCompare.GetNetCode() )
67  return false;
68 
69  if( GetPriority() != aZoneToCompare.GetPriority() )
70  return false;
71 
72  // Compare zone specific parameters
73  if( GetIsRuleArea() != aZoneToCompare.GetIsRuleArea() )
74  return false;
75 
76  if( GetIsRuleArea() )
77  {
78  if( GetDoNotAllowCopperPour() != aZoneToCompare.GetDoNotAllowCopperPour() )
79  return false;
80 
81  if( GetDoNotAllowVias() != aZoneToCompare.GetDoNotAllowVias() )
82  return false;
83 
84  if( GetDoNotAllowTracks() != aZoneToCompare.GetDoNotAllowTracks() )
85  return false;
86 
87  if( GetDoNotAllowPads() != aZoneToCompare.GetDoNotAllowPads() )
88  return false;
89 
90  if( GetDoNotAllowFootprints() != aZoneToCompare.GetDoNotAllowFootprints() )
91  return false;
92  }
93 
94  if( m_ZoneClearance != aZoneToCompare.m_ZoneClearance )
95  return false;
96 
97  if( m_ZoneMinThickness != aZoneToCompare.GetMinThickness() )
98  return false;
99 
100  if( m_fillMode != aZoneToCompare.GetFillMode() )
101  return false;
102 
103  if( m_PadConnection != aZoneToCompare.m_PadConnection )
104  return false;
105 
106  if( m_thermalReliefGap != aZoneToCompare.m_thermalReliefGap )
107  return false;
108 
110  return false;
111 
112  if( m_zoneName != aZoneToCompare.m_zoneName )
113  return false;
114 
115  if( m_islandRemovalMode != aZoneToCompare.m_islandRemovalMode )
116  return false;
117 
118  if( m_minIslandArea != aZoneToCompare.m_minIslandArea )
119  return false;
120 
121 
122  // Compare outlines
123  wxASSERT( m_Poly ); // m_Poly == NULL Should never happen
124  wxASSERT( aZoneToCompare.Outline() );
125 
126  if( Outline() != aZoneToCompare.Outline() ) // Compare vector
127  return false;
128 
129  return true;
130 }
bool GetDoNotAllowFootprints() const
Definition: zone.h:740
ZONE_FILL_MODE m_fillMode
How to fill areas:
Definition: zone.h:886
int m_ZoneClearance
Definition: zone.h:854
unsigned GetPriority() const
Definition: zone.h:122
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:735
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824
wxString m_zoneName
An optional unique name for this zone, used for identifying it in DRC checking.
Definition: zone.h:829
ZONE_CONNECTION m_PadConnection
Definition: zone.h:853
SHAPE_POLY_SET * Outline()
Definition: zone.h:320
bool GetDoNotAllowVias() const
Definition: zone.h:737
long long int m_minIslandArea
When island removal mode is set to AREA, islands below this area will be removed.
Definition: zone.h:864
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: zone.cpp:289
ZONE_FILL_MODE GetFillMode() const
Definition: zone.h:181
bool GetDoNotAllowPads() const
Definition: zone.h:739
bool GetDoNotAllowCopperPour() const
Definition: zone.h:736
int GetMinThickness() const
Definition: zone.h:244
bool GetDoNotAllowTracks() const
Definition: zone.h:738
int m_thermalReliefGap
Definition: zone.h:876
ISLAND_REMOVAL_MODE m_islandRemovalMode
Definition: zone.h:858
int m_ZoneMinThickness
Definition: zone.h:855
int m_thermalReliefSpokeWidth
Definition: zone.h:877

References GetDoNotAllowCopperPour(), GetDoNotAllowFootprints(), GetDoNotAllowPads(), GetDoNotAllowTracks(), GetDoNotAllowVias(), GetFillMode(), GetIsRuleArea(), GetLayerSet(), GetMinThickness(), BOARD_CONNECTED_ITEM::GetNetCode(), GetPriority(), m_fillMode, m_islandRemovalMode, m_minIslandArea, m_PadConnection, m_Poly, m_thermalReliefGap, m_thermalReliefSpokeWidth, m_ZoneClearance, m_ZoneMinThickness, m_zoneName, and Outline().

Referenced by UpdateCopyOfZonesList().

◆ IsSelected()

bool EDA_ITEM::IsSelected ( ) const
inlineinherited

Definition at line 122 of file eda_item.h.

122 { return m_flags & SELECTED; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480
#define SELECTED

References EDA_ITEM::m_flags, and SELECTED.

Referenced by ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), SCH_EDIT_FRAME::ConvertPart(), DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS(), 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::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), DS_PROXY_UNDO_ITEM::DS_PROXY_UNDO_ITEM(), KIGFX::DS_RENDER_SETTINGS::GetColor(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), SCH_MOVE_TOOL::getConnectedDragItems(), KIGFX::SCH_PAINTER::getLineWidth(), KIGFX::SCH_PAINTER::getRenderColor(), KIGFX::SCH_PAINTER::getTextThickness(), DIALOG_EXCHANGE_FOOTPRINTS::isMatch(), DIALOG_CHANGE_SYMBOLS::isMatch(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), EE_SELECTION_TOOL::RebuildSelection(), RENDER_3D_OPENGL::renderFootprint(), SCH_EDIT_TOOL::Rotate(), EE_TOOL_BASE< SCH_BASE_FRAME >::saveCopyInUndoList(), SCH_EDIT_FRAME::SchematicCleanUp(), GERBVIEW_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::selectionContains(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), KIGFX::SCH_PAINTER::setDeviceColors(), GERBVIEW_SELECTION_TOOL::unselect(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ IsTrack()

bool BOARD_ITEM::IsTrack ( ) const
inlineinherited

Test to see if this object is a track or via (or microvia).

Returns
true if a track or via, else false.

Definition at line 205 of file board_item.h.

206  {
207  return ( Type() == PCB_TRACE_T ) || ( Type() == PCB_VIA_T );
208  }
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112

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

◆ IsType()

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

Check 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 PCB_VIA, SCH_LABEL, PCB_DIMENSION_BASE, PAD, SCH_FIELD, FP_TEXT, SCH_LINE, PCB_SHAPE, FP_SHAPE, and PCB_TEXT.

Definition at line 182 of file eda_item.h.

183  {
184  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
185  return true;
186 
187  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
188  {
189  if( m_structType == *p )
190  return true;
191  }
192 
193  return false;
194  }
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
KICAD_T m_structType
Run time identification, keep private so it can never be changed after a ctor sets it.
Definition: eda_item.h:487

References EOT, EDA_ITEM::m_structType, and SCH_LOCATE_ANY_T.

Referenced by SCH_EDIT_TOOL::AutoplaceFields(), ROUTER_TOOL::CanInlineDrag(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingBus(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLine(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingWire(), PCB_TEXT::IsType(), FP_SHAPE::IsType(), PCB_SHAPE::IsType(), SCH_LINE::IsType(), FP_TEXT::IsType(), SCH_FIELD::IsType(), PAD::IsType(), PCB_DIMENSION_BASE::IsType(), SCH_LABEL::IsType(), PCB_VIA::IsType(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), EE_SELECTION_TOOL::RequestSelection(), SCH_BASE_FRAME::UpdateItem(), EDA_ITEM::Visit(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 121 of file eda_item.h.

121 { return m_flags & IS_WIRE_IMAGE; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.

References IS_WIRE_IMAGE, and EDA_ITEM::m_flags.

◆ Iterate()

SHAPE_POLY_SET::ITERATOR ZONE::Iterate ( )
inline

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

Returns
an iterator to visit the zone vertices without holes.

Definition at line 535 of file zone.h.

536  {
537  return m_Poly->Iterate();
538  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824
ITERATOR Iterate(int aFirst, int aLast, bool aIterateHoles=false)
Return an object to iterate through the points of the polygons between aFirst and aLast.

References SHAPE_POLY_SET::Iterate(), and 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

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

Definition at line 294 of file eda_item.h.

298  {
299  for( auto it : aList )
300  {
301  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
303  return SEARCH_RESULT::QUIT;
304  }
305 
307  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:93

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

Referenced by GERBER_FILE_IMAGE::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

Change first parameter to avoid the DList and use std::vector instead.

Definition at line 313 of file eda_item.h.

315  {
316  for( auto it : aList )
317  {
318  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
320  return SEARCH_RESULT::QUIT;
321  }
322 
324  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:93

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

◆ IterateWithHoles()

SHAPE_POLY_SET::ITERATOR ZONE::IterateWithHoles ( )
inline

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

Returns
an iterator to visit the zone vertices with holes.

Definition at line 545 of file zone.h.

546  {
547  return m_Poly->IterateWithHoles();
548  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824
ITERATOR IterateWithHoles(int aOutline)

References SHAPE_POLY_SET::IterateWithHoles(), and m_Poly.

Referenced by DSN::SPECCTRA_DB::FromBOARD(), and DSN::SPECCTRA_DB::makeIMAGE().

◆ KeepoutAll()

bool ZONE::KeepoutAll ( ) const

Definition at line 1276 of file zone.cpp.

1277 {
1280 }
bool m_doNotAllowFootprints
Definition: zone.h:851
bool m_doNotAllowTracks
Definition: zone.h:849
bool m_doNotAllowVias
Definition: zone.h:848
bool m_doNotAllowCopperPour
Definition: zone.h:847
bool m_doNotAllowPads
Definition: zone.h:850

References m_doNotAllowCopperPour, m_doNotAllowFootprints, m_doNotAllowPads, m_doNotAllowTracks, and m_doNotAllowVias.

◆ layerMaskDescribe()

wxString BOARD_ITEM::layerMaskDescribe ( ) const
protectedvirtualinherited

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

The BOARD is needed because layer names are customizable.

Reimplemented in PCB_VIA.

Definition at line 87 of file board_item.cpp.

88 {
89  const BOARD* board = GetBoard();
90  LSET layers = GetLayerSet();
91 
92  // Try to be smart and useful. Check all copper first.
93  if( layers[F_Cu] && layers[B_Cu] )
94  return _( "all copper layers" );
95 
96  LSET copperLayers = layers & board->GetEnabledLayers().AllCuMask();
97  LSET techLayers = layers & board->GetEnabledLayers().AllTechMask();
98 
99  for( LSET testLayers : { copperLayers, techLayers, layers } )
100  {
101  for( int bit = PCBNEW_LAYER_ID_START; bit < PCB_LAYER_ID_COUNT; ++bit )
102  {
103  if( testLayers[ bit ] )
104  {
105  wxString layerInfo = board->GetLayerName( static_cast<PCB_LAYER_ID>( bit ) );
106 
107  if( testLayers.count() > 1 )
108  layerInfo << wxS( " " ) + _( "and others" );
109 
110  return layerInfo;
111  }
112  }
113  }
114 
115  // No copper, no technicals: no layer
116  return _( "no layers" );
117 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:759
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:362
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:467
static LSET AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
Definition: lset.cpp:829
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516
#define _(s)
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:191
Definition: layer_ids.h:71
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
Definition: board_item.h:148

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

Referenced by PCB_TRACK::GetMsgPanelInfo(), PAD::GetMsgPanelInfo(), and PAD::GetSelectMenuText().

◆ Matches() [1/2]

bool ZONE::Matches ( const wxFindReplaceData &  aSearchData,
void *  aAuxData 
) const
inlineoverridevirtual

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

Definition at line 132 of file zone.h.

133  {
134  return BOARD_ITEM::Matches( GetZoneName(), aSearchData );
135  }
virtual bool Matches(const wxFindReplaceData &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
Definition: eda_item.h:364
wxString GetZoneName() const
Definition: zone.h:129

References GetZoneName(), and EDA_ITEM::Matches().

Referenced by DIALOG_FIND::search().

◆ Matches() [2/2]

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

Compare 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 118 of file eda_item.cpp.

119 {
120  wxString text = aText;
121  int flags = aSearchData.GetFlags();
122  wxString searchText = aSearchData.GetFindString();
123 
124  // Don't match if searching for replaceable item and the item doesn't support text replace.
125  if( ( flags & FR_SEARCH_REPLACE ) && !IsReplaceable() )
126  return false;
127 
128  if( !( flags & wxFR_MATCHCASE ) )
129  {
130  text.MakeUpper();
131  searchText.MakeUpper();
132  }
133 
134  if( flags & wxFR_WHOLEWORD )
135  {
136  int ii = 0;
137 
138  while( ii < (int) text.length() )
139  {
140  int next = text.find( searchText, ii );
141 
142  if( next == wxNOT_FOUND )
143  return false;
144 
145  ii = next;
146  next += searchText.length();
147 
148  bool startOK = ( ii == 0 || !wxIsalnum( text.GetChar( ii - 1 ) ) );
149  bool endOK = ( next == (int) text.length() || !wxIsalnum( text.GetChar( next ) ) );
150 
151  if( startOK && endOK )
152  return true;
153  else
154  ii++;
155  }
156 
157  return false;
158  }
159  else if( flags & FR_MATCH_WILDCARD )
160  {
161  return text.Matches( searchText );
162  }
163  else
164  {
165  return text.Find( searchText ) != wxNOT_FOUND;
166  }
167 }
CITER next(CITER it)
Definition: ptree.cpp:126
virtual bool IsReplaceable() const
Override this method in any derived object that supports test find and replace.
Definition: eda_item.h:402

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

◆ Mirror()

void ZONE::Mirror ( const wxPoint &  aMirrorRef,
bool  aMirrorLeftRight 
)

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

Parameters
aMirrorRefis axis position
aMirrorLeftRightmirror across Y axis (otherwise mirror across X)

Definition at line 724 of file zone.cpp.

725 {
726  // ZONEs mirror about the x-axis (why?!?)
727  m_Poly->Mirror( aMirrorLeftRight, !aMirrorLeftRight, VECTOR2I( aMirrorRef ) );
728 
729  HatchBorder();
730 
731  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
732  pair.second.Mirror( aMirrorLeftRight, !aMirrorLeftRight, VECTOR2I( aMirrorRef ) );
733 
734  for( std::pair<const PCB_LAYER_ID, std::vector<SEG> >& pair : m_FillSegmList )
735  {
736  for( SEG& seg : pair.second )
737  {
738  if( aMirrorLeftRight )
739  {
740  MIRROR( seg.A.x, aMirrorRef.x );
741  MIRROR( seg.B.x, aMirrorRef.x );
742  }
743  else
744  {
745  MIRROR( seg.A.y, aMirrorRef.y );
746  MIRROR( seg.B.y, aMirrorRef.y );
747  }
748  }
749  }
750 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824
VECTOR2< int > VECTOR2I
Definition: vector2d.h:622
void Mirror(bool aX=true, bool aY=false, const VECTOR2I &aRef={ 0, 0 })
Mirror the line points about y or x (or both)
void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
Definition: mirror.h:40
void HatchBorder()
Compute the hatch lines depending on the hatch parameters and stores it in the zone's attribute m_bor...
Definition: zone.cpp:906
std::map< PCB_LAYER_ID, std::vector< SEG > > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: zone.h:908
Definition: seg.h:40
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
VECTOR2I A
Definition: seg.h:48
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:918
VECTOR2I B
Definition: seg.h:49

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

Referenced by Flip(), and EDIT_TOOL::Mirror().

◆ Move() [1/2]

void BOARD_ITEM::Move ( const VECTOR2I aMoveVector)
inlineinherited

Definition at line 238 of file board_item.h.

239  {
240  Move( wxPoint( aMoveVector.x, aMoveVector.y ) );
241  }
virtual void Move(const wxPoint &aMoveVector)
Move this object.
Definition: board_item.h:233

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

◆ Move() [2/2]

void ZONE::Move ( const wxPoint &  offset)
overridevirtual

Move the outlines.

Parameters
offsetis moving vector

Reimplemented from BOARD_ITEM.

Definition at line 653 of file zone.cpp.

654 {
655  /* move outlines */
656  m_Poly->Move( offset );
657 
658  HatchBorder();
659 
660  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
661  pair.second.Move( offset );
662 
663  for( std::pair<const PCB_LAYER_ID, std::vector<SEG> >& pair : m_FillSegmList )
664  {
665  for( SEG& seg : pair.second )
666  {
667  seg.A += VECTOR2I( offset );
668  seg.B += VECTOR2I( offset );
669  }
670  }
671 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824
VECTOR2< int > VECTOR2I
Definition: vector2d.h:622
void Move(const VECTOR2I &aVector) override
void HatchBorder()
Compute the hatch lines depending on the hatch parameters and stores it in the zone's attribute m_bor...
Definition: zone.cpp:906
std::map< PCB_LAYER_ID, std::vector< SEG > > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: zone.h:908
Definition: seg.h:40
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
VECTOR2I A
Definition: seg.h:48
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:918
VECTOR2I B
Definition: seg.h:49

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

◆ MoveEdge()

void ZONE::MoveEdge ( const wxPoint &  offset,
int  aEdge 
)

Move the outline Edge.

Parameters
offsetis moving vector
aEdgeis start point of the outline edge

Definition at line 674 of file zone.cpp.

675 {
676  int next_corner;
677 
678  if( m_Poly->GetNeighbourIndexes( aEdge, nullptr, &next_corner ) )
679  {
680  m_Poly->SetVertex( aEdge, m_Poly->CVertex( aEdge ) + VECTOR2I( offset ) );
681  m_Poly->SetVertex( next_corner, m_Poly->CVertex( next_corner ) + VECTOR2I( offset ) );
682  HatchBorder();
683 
684  SetNeedRefill( true );
685  }
686 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the aGlobalIndex-th vertex in the poly set.
VECTOR2< int > VECTOR2I
Definition: vector2d.h:622
bool GetNeighbourIndexes(int aGlobalIndex, int *aPrevious, int *aNext)
Return the global indexes of the previous and the next corner of the aGlobalIndex-th corner of a cont...
void SetVertex(const VERTEX_INDEX &aIndex, const VECTOR2I &aPos)
Accessor function to set the position of a specific point.
void HatchBorder()
Compute the hatch lines depending on the hatch parameters and stores it in the zone's attribute m_bor...
Definition: zone.cpp:906
void SetNeedRefill(bool aNeedRefill)
Definition: zone.h:238

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

◆ NeedRefill()

bool ZONE::NeedRefill ( ) const
inline

Definition at line 237 of file zone.h.

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

References m_needRefill.

◆ NewHole()

void ZONE::NewHole ( )
inline

Create a new hole on the zone; i.e., a new contour on the zone's outline.

Definition at line 599 of file zone.h.

600  {
601  m_Poly->NewHole();
602  }
int NewHole(int aOutline=-1)
Adds a new outline to the set and returns its index.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824

References 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 234 of file eda_item.cpp.

235 {
236  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
237  GetClass() ) );
238 
239  return false;
240 }
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
virtual wxString GetClass() const =0
Return the class name.

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

◆ operator=()

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

Definition at line 94 of file zone.cpp.

95 {
97 
98  InitDataFromSrcInCopyCtor( aOther );
99 
100  return *this;
101 }
void InitDataFromSrcInCopyCtor(const ZONE &aZone)
Copy aZone data to me.
Definition: zone.cpp:111
EDA_ITEM & operator=(const EDA_ITEM &aItem)
Assign the members of aItem to another object.
Definition: eda_item.cpp:243

References InitDataFromSrcInCopyCtor(), and EDA_ITEM::operator=().

Referenced by FP_ZONE::operator=().

◆ Outline() [1/2]

◆ Outline() [2/2]

const SHAPE_POLY_SET* ZONE::Outline ( ) const
inline

Definition at line 321 of file zone.h.

321 { return m_Poly; }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824

References m_Poly.

◆ RawPolysList()

SHAPE_POLY_SET& ZONE::RawPolysList ( PCB_LAYER_ID  aLayer)
inline

Definition at line 720 of file zone.h.

721  {
722  wxASSERT( m_RawPolysList.count( aLayer ) );
723  return m_RawPolysList.at( aLayer );
724  }
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_RawPolysList
Definition: zone.h:919

References m_RawPolysList.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers(), and ALTIUM_PCB::ParseRegions6Data().

◆ RemoveAllContours()

void ZONE::RemoveAllContours ( void  )
inline

Definition at line 560 of file zone.h.

561  {
563  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824

References m_Poly, and SHAPE_POLY_SET::RemoveAllContours().

Referenced by DRC_TEST_PROVIDER_SOLDER_MASK::buildRTrees().

◆ RemoveCutout()

void ZONE::RemoveCutout ( int  aOutlineIdx,
int  aHoleIdx 
)

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 769 of file zone.cpp.

770 {
771  // Ensure the requested cutout is valid
772  if( m_Poly->OutlineCount() < aOutlineIdx || m_Poly->HoleCount( aOutlineIdx ) < aHoleIdx )
773  return;
774 
775  SHAPE_POLY_SET cutPoly( m_Poly->Hole( aOutlineIdx, aHoleIdx ) );
776 
777  // Add the cutout back to the zone
779 
780  SetNeedRefill( true );
781 }
int OutlineCount() const
Return the number of vertices in a given outline/hole.
void BooleanAdd(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset difference For aFastMode meaning, see function booleanOp.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Return the aIndex-th subpolygon in the set.
Represent a set of closed polygons.
int HoleCount(int aOutline) const
Return the reference to aIndex-th outline in the set.
void SetNeedRefill(bool aNeedRefill)
Definition: zone.h:238

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

Referenced by EDIT_TOOL::Remove().

◆ Replace() [1/2]

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

Perform 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 170 of file eda_item.cpp.

171 {
172  wxString text = aText;
173  int flags = aSearchData.GetFlags();
174  wxString searchText = aSearchData.GetFindString();
175  wxString result;
176  bool replaced = false;
177 
178  if( flags & wxFR_MATCHCASE )
179  {
180  text = text.Upper();
181  searchText = searchText.Upper();
182  }
183 
184  int ii = 0;
185 
186  while( ii < (int) text.length() )
187  {
188  int next = text.find( searchText, ii );
189 
190  if( next == wxNOT_FOUND )
191  {
192  result += aText.Mid( ii, wxString::npos );
193  break;
194  }
195 
196  if( next > ii )
197  result += aText.Mid( ii, next - ii );
198 
199  ii = next;
200  next += searchText.length();
201 
202  bool startOK;
203  bool endOK;
204 
205  if( flags & wxFR_WHOLEWORD )
206  {
207  startOK = ( ii == 0 || !wxIsalnum( text.GetChar( ii - 1 ) ) );
208  endOK = ( next == (int) text.length() || !wxIsalnum( text.GetChar( next ) ) );
209  }
210  else
211  {
212  startOK = true;
213  endOK = true;
214  }
215 
216  if( startOK && endOK )
217  {
218  result += aSearchData.GetReplaceString();
219  replaced = true;
220  ii = next;
221  }
222  else
223  {
224  result += aText.GetChar( ii );
225  ii++;
226  }
227  }
228 
229  aText = result;
230  return replaced;
231 }
CITER next(CITER it)
Definition: ptree.cpp:126

References next(), and text.

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

◆ Replace() [2/2]

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

Perform 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_FIELD, SCH_SHEET_PIN, and SCH_PIN.

Definition at line 391 of file eda_item.h.

392  {
393  return false;
394  }

◆ Rotate() [1/2]

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

Definition at line 251 of file board_item.h.

252  {
253  Rotate( wxPoint( aRotCentre.x, aRotCentre.y ), aAngle );
254  }
virtual void Rotate(const wxPoint &aRotCentre, double aAngle)
Rotate this object.
Definition: board_item.cpp:202

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

◆ Rotate() [2/2]

void ZONE::Rotate ( const wxPoint &  aCentre,
double  aAngle 
)
overridevirtual

Move the outlines.

Parameters
aCentreis rot centre
aAngleis in 0.1 degree

Reimplemented from BOARD_ITEM.

Definition at line 689 of file zone.cpp.

690 {
691  aAngle = -DECIDEG2RAD( aAngle );
692 
693  m_Poly->Rotate( aAngle, VECTOR2I( aCentre ) );
694  HatchBorder();
695 
696  /* rotate filled areas: */
697  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
698  pair.second.Rotate( aAngle, VECTOR2I( aCentre ) );
699 
700  for( std::pair<const PCB_LAYER_ID, std::vector<SEG> >& pair : m_FillSegmList )
701  {
702  for( SEG& seg : pair.second )
703  {
704  wxPoint a( seg.A );
705  RotatePoint( &a, aCentre, aAngle );
706  seg.A = a;
707  wxPoint b( seg.B );
708  RotatePoint( &b, aCentre, aAngle );
709  seg.B = a;
710  }
711  }
712 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824
void Rotate(double aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Rotate all vertices by a given angle.
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:229
VECTOR2< int > VECTOR2I
Definition: vector2d.h:622
void HatchBorder()
Compute the hatch lines depending on the hatch parameters and stores it in the zone's attribute m_bor...
Definition: zone.cpp:906
std::map< PCB_LAYER_ID, std::vector< SEG > > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: zone.h:908
Definition: seg.h:40
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
VECTOR2I A
Definition: seg.h:48
double DECIDEG2RAD(double deg)
Definition: trigo.h:233
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:918
VECTOR2I B
Definition: seg.h:49

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

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

◆ Set() [1/3]

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

Definition at line 42 of file inspectable.h.

43  {
45  TYPE_ID thisType = TYPE_HASH( *this );
46  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
47 
48  if( object )
49  aProperty->setter( object, aValue );
50 
51  return object != nullptr;
52  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
virtual void setter(void *aObject, wxAny &aValue)=0
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

◆ Set() [2/3]

template<typename T >
bool INSPECTABLE::Set ( PROPERTY_BASE aProperty,
aValue 
)
inlineinherited

Definition at line 55 of file inspectable.h.

56  {
58  TYPE_ID thisType = TYPE_HASH( *this );
59  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
60 
61  if( object )
62  aProperty->set<T>( object, aValue );
63 
64  return object != nullptr;
65  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
void set(void *aObject, T aValue)
Definition: property.h:261
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

◆ Set() [3/3]

template<typename T >
bool INSPECTABLE::Set ( const wxString &  aProperty,
aValue 
)
inlineinherited

Definition at line 68 of file inspectable.h.

69  {
71  TYPE_ID thisType = TYPE_HASH( *this );
72  PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
73  void* object = nullptr;
74 
75  if( prop )
76  {
77  object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
78 
79  if( object )
80  prop->set<T>( object, aValue );
81  }
82 
83  return object != nullptr;
84  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
void set(void *aObject, T aValue)
Definition: property.h:261
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

◆ SetBorderDisplayStyle()

void ZONE::SetBorderDisplayStyle ( ZONE_BORDER_DISPLAY_STYLE  aHatchStyle,
int  aHatchPitch,
bool  aRebuildHatch 
)

Set all hatch parameters for the zone.

Parameters
aHatchStyleis the style of the hatch, specified as one of HATCH_STYLE possible values.
aHatchPitchis the hatch pitch in iu.
aRebuildHatchis a flag to indicate whether to re-hatch after having set the previous parameters.

Definition at line 875 of file zone.cpp.

877 {
878  SetHatchPitch( aHatchPitch );
879  m_borderStyle = aHatchStyle;
880 
881  if( aRebuildHatch )
882  HatchBorder();
883 }
ZONE_BORDER_DISPLAY_STYLE m_borderStyle
Definition: zone.h:928
void HatchBorder()
Compute the hatch lines depending on the hatch parameters and stores it in the zone's attribute m_bor...
Definition: zone.cpp:906
void SetHatchPitch(int aPitch)
Set the hatch pitch parameter for the zone.
Definition: zone.cpp:886

References HatchBorder(), m_borderStyle, and SetHatchPitch().

Referenced by PCAD2KICAD::PCB_POLYGON::AddToBoard(), ZONE_SETTINGS::ExportSetting(), EAGLE_PLUGIN::loadPlain(), EAGLE_PLUGIN::packageCircle(), EAGLE_PLUGIN::packagePolygon(), EAGLE_PLUGIN::packageRectangle(), ALTIUM_PCB::ParseArcs6Data(), ALTIUM_PCB::ParseFills6Data(), ALTIUM_PCB::ParsePolygons6Data(), ALTIUM_PCB::ParseShapeBasedRegions6Data(), and ALTIUM_PCB::ParseTracks6Data().

◆ SetBrightened()

◆ SetCornerPosition()

void ZONE::SetCornerPosition ( int  aCornerIndex,
const wxPoint &  new_pos 
)
inline

Definition at line 576 of file zone.h.

577  {
578  SHAPE_POLY_SET::VERTEX_INDEX relativeIndices;
579 
580  // Convert global to relative indices
581  if( m_Poly->GetRelativeIndices( aCornerIndex, &relativeIndices ) )
582  {
583  if( m_Poly->CVertex( relativeIndices ).x != new_pos.x
584  || m_Poly->CVertex( relativeIndices ).y != new_pos.y )
585  {
586  SetNeedRefill( true );
587  m_Poly->SetVertex( relativeIndices, new_pos );
588  }
589  }
590  else
591  {
592  throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
593  }
594  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:824
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the aGlobalIndex-th vertex in the poly set.
Structure to hold the necessary information in order to index a vertex on a SHAPE_POLY_SET object: th...
void SetVertex(const VERTEX_INDEX &aIndex, const VECTOR2I &aPos)
Accessor function to set the position of a specific point.
bool GetRelativeIndices(int aGlobalIdx, VERTEX_INDEX *aRelativeIndices) const
Convert a global vertex index —i.e., a number that globally identifies a vertex in a concatenated lis...
void SetNeedRefill(bool aNeedRefill)
Definition: zone.h:238

References SHAPE_POLY_SET::CVertex(), SHAPE_POLY_SET::GetRelativeIndices(), m_Poly, SetNeedRefill(), SHAPE_POLY_SET::SetVertex(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ SetCornerRadius()

void ZONE::SetCornerRadius ( unsigned int  aRadius)

Definition at line 359 of file zone.cpp.

360 {
361  if( m_cornerRadius != aRadius )
362  SetNeedRefill( true );
363 
364  m_cornerRadius = aRadius;
365 }
unsigned int m_cornerRadius
Definition: zone.h:826
void SetNeedRefill(bool aNeedRefill)
Definition: zone.h:238

References m_cornerRadius, and SetNeedRefill().

Referenced by ZONE_SETTINGS::ExportSetting().

◆ SetCornerSmoothingType()

void ZONE::SetCornerSmoothingType ( int  aType)
inline

Definition at line 683 of file zone.h.

683 {