KiCad PCB EDA Suite
ZONE Class Reference

ZONE handles 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 comaptible 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)
 Function SetPriority. More...
 
unsigned GetPriority () const
 Function GetPriority. More...
 
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
 Function GetBoundingBox (virtual) More...
 
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
 Function GetLocalClearance returns any local clearances set in the "classic" (ie: pre-rule) system. More...
 
int GetLocalClearance () const
 
void SetLocalClearance (int aClearance)
 
bool IsOnCopperLayer () const override
 Function IsOnCopperLayer. More...
 
bool CommonLayerExists (const LSET aLayerSet) const
 Function CommonLayerExist Test if this zone shares a common layer with the given layer set. More...
 
virtual void SetLayer (PCB_LAYER_ID aLayer) override
 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 ()
 Get the area currently occupied by the zone fill. 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)
 
ZONE_SEGMENT_FILLFillSegments (PCB_LAYER_ID aLayer)
 
const ZONE_SEGMENT_FILLFillSegments (PCB_LAYER_ID aLayer) const
 
SHAPE_POLY_SETOutline ()
 
const SHAPE_POLY_SETOutline () const
 
void SetOutline (SHAPE_POLY_SET *aOutline)
 
virtual std::shared_ptr< SHAPEGetEffectiveShape (PCB_LAYER_ID aLayer=UNDEFINED_LAYER) 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
 Function HitTest tests 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
 Function HitTestFilledArea tests if the given wxPoint is within the bounds of a filled area of this zone. More...
 
bool HitTestCutout (const VECTOR2I &aRefPos, int *aOutlineIdx=nullptr, int *aHoleIdx=nullptr) const
 Tests if the given point is contained within a cutout of the zone. More...
 
bool HitTestCutout (const wxPoint &aRefPos, int *aOutlineIdx=nullptr, int *aHoleIdx=nullptr) const
 
void 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
 Function TransformSolidAreasShapesToPolygon 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, SHAPE_POLY_SET *aBoardOutline) const
 Function TransformSmoothedOutlineToPolygon 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
 Function TransformShapeWithClearanceToPolygon Convert the zone shape to a closed polygon Used in filling zones calculations Circles and arcs are approximated by segments. More...
 
bool HitTestForCorner (const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
 Function HitTestForCorner tests if the given wxPoint is near a corner. More...
 
bool HitTestForCorner (const wxPoint &refPos, int aAccuracy) const
 Function HitTestForCorner tests if the given wxPoint is near a corner. More...
 
bool HitTestForEdge (const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
 Function HitTestForEdge tests if the given wxPoint is near a segment defined by 2 corners. More...
 
bool HitTestForEdge (const wxPoint &refPos, int aAccuracy) const
 Function HitTestForEdge tests if the given wxPoint is near a segment defined by 2 corners. More...
 
bool HitTest (const EDA_RECT &aRect, bool aContained=true, int aAccuracy=0) const override
 
bool UnFill ()
 Function UnFill Removes the zone filling. More...
 
void Move (const wxPoint &offset) override
 Function Move Move the outlines. More...
 
void MoveEdge (const wxPoint &offset, int aEdge)
 Function MoveEdge Move the outline Edge. More...
 
void Rotate (const wxPoint &aCentre, double aAngle) override
 Function Rotate Move the outlines. More...
 
virtual void Flip (const wxPoint &aCentre, bool aFlipLeftRight) override
 Function Flip Flip this object, i.e. More...
 
void Mirror (const wxPoint &aMirrorRef, bool aMirrorLeftRight)
 Function Mirror Mirror the outlines , relative to a given horizontal axis the layer is not changed. More...
 
wxString GetClass () const override
 Function GetClass returns the class name. More...
 
int GetNumCorners (void) const
 Access to m_Poly parameters. More...
 
SHAPE_POLY_SET::ITERATOR Iterate ()
 Function Iterate returns an iterator to visit all points of the zone's main outline without holes. More...
 
SHAPE_POLY_SET::ITERATOR IterateWithHoles ()
 Function IterateWithHoles returns an iterator to visit all points of the zone's main outline with holes. More...
 
SHAPE_POLY_SET::CONST_ITERATOR CIterateWithHoles () const
 Function CIterateWithHoles returns an iterator to visit all points of the zone's main outline with holes. More...
 
void RemoveAllContours (void)
 
const VECTOR2IGetCornerPosition (int aCornerIndex) const
 
void SetCornerPosition (int aCornerIndex, wxPoint new_pos)
 
void NewHole ()
 Function NewHole creates a new hole on the zone; i.e., a new contour on the zone's outline. More...
 
bool AppendCorner (wxPoint aPosition, int aHoleIdx, bool aAllowDuplication=false)
 Add a new corner to the zone outline (to the main outline or a hole) More...
 
ZONE_BORDER_DISPLAY_STYLE GetHatchStyle () const
 
void SetHatchStyle (ZONE_BORDER_DISPLAY_STYLE aStyle)
 
bool IsSame (const ZONE &aZoneToCompare)
 Function IsSame tests if 2 zones are equivalent: 2 zones are equivalent if they have same parameters and same outlines info, filling is not taken into account. More...
 
void ClearFilledPolysList ()
 Function ClearFilledPolysList clears the list of filled polygons. More...
 
bool HasFilledPolysForLayer (PCB_LAYER_ID aLayer) const
 
const SHAPE_POLY_SETGetFilledPolysList (PCB_LAYER_ID aLayer) const
 Function GetFilledPolysList returns a reference to the list of filled polygons. More...
 
void CacheTriangulation (PCB_LAYER_ID aLayer=UNDEFINED_LAYER)
 (re)create a list of triangles that "fill" the solid areas. More...
 
void SetFilledPolysList (PCB_LAYER_ID aLayer, const SHAPE_POLY_SET &aPolysList)
 Function SetFilledPolysList sets the list of filled polygons. More...
 
void SetRawPolysList (PCB_LAYER_ID aLayer, const SHAPE_POLY_SET &aPolysList)
 Function SetFilledPolysList sets the list of filled polygons. More...
 
bool IsIsland (PCB_LAYER_ID aLayer, int aPolyIdx) const
 Checks if a given filled polygon is an insulated island. More...
 
void SetIsIsland (PCB_LAYER_ID aLayer, int aPolyIdx)
 
bool BuildSmoothedPoly (SHAPE_POLY_SET &aSmoothedPoly, PCB_LAYER_ID aLayer, SHAPE_POLY_SET *aBoardOutline, SHAPE_POLY_SET *aSmoothedPolyWithApron=nullptr) const
 Function GetSmoothedPoly. More...
 
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 if the zone outline is empty, this is the main outline else it is a hole inside the main outline More...
 
void AddPolygon (const SHAPE_LINE_CHAIN &aPolygon)
 
void SetFillSegments (PCB_LAYER_ID aLayer, const ZONE_SEGMENT_FILL &aSegments)
 
SHAPE_POLY_SETRawPolysList (PCB_LAYER_ID aLayer)
 
wxString GetSelectMenuText (EDA_UNITS aUnits) const override
 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...
 
BITMAP_DEF 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
 
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)
 Function SetBorderDisplayStyle sets all hatch parameters for the zone. More...
 
void SetHatchPitch (int aPitch)
 Function SetHatchPitch sets the hatch pitch parameter for the zone. More...
 
void UnHatchBorder ()
 Function UnHatchBorder clears the zone's hatch. More...
 
void HatchBorder ()
 Function HatchBorder computes the hatch lines depending on the hatch parameters and stores it in the zone's attribute m_borderHatchLines. More...
 
const std::vector< SEG > & GetHatchLines () const
 
bool GetHV45 () const
 
void SetHV45 (bool aConstrain)
 
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
 
virtual BOARD_ITEMDuplicate () const
 Create a copy of a 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 BOARDGetBoard () const
 Return the BOARD in which this BOARD_ITEM resides, or NULL if none. More...
 
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 (int type) const
 
void SetState (int type, bool state)
 
STATUS_FLAGS GetStatus () const
 
void SetStatus (STATUS_FLAGS aStatus)
 
void SetFlags (STATUS_FLAGS aMask)
 
void ClearFlags (STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
STATUS_FLAGS GetFlags () const
 
bool HasFlag (STATUS_FLAGS aFlag) const
 
STATUS_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 ()
 Function GetDefaultHatchPitchMils. More...
 
static wxString ShowShape (PCB_SHAPE_TYPE_T aShape)
 Convert the enum PCB_SHAPE_TYPE_T integer value to a wxString. More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::deque< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 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: ZONE_FILL_MODE::POLYGONS => use solid polygons ZONE_FILL_MODE::HATCH_PATTERN => use a grid pattern as shape. More...
 
int m_hatchThickness
 
int m_hatchGap
 
double m_hatchOrientation
 
int m_hatchSmoothingLevel
 
double m_hatchSmoothingValue
 
double m_hatchHoleMinArea
 
int m_hatchBorderAlgorithm
 
SHAPE_POLY_SET::VERTEX_INDEXm_CornerSelection
 The index of the corner being moved or nullptr if no corner is selected. More...
 
int m_localFlgs
 
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILLm_FillSegmList
 Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used. More...
 
std::map< PCB_LAYER_ID, SHAPE_POLY_SETm_FilledPolysList
 
std::map< PCB_LAYER_ID, SHAPE_POLY_SETm_RawPolysList
 
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
 
STATUS_FLAGS m_status
 
EDA_ITEMm_parent
 Linked list: Link (parent struct) More...
 
bool m_forceVisible
 
STATUS_FLAGS m_flags
 

Detailed Description

ZONE handles a list of polygons defining a copper zone.

A zone is described by a main polygon, a time stamp, a layer or a lyer 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 57 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 comaptible 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 42 of file zone.cpp.

42  :
43  BOARD_CONNECTED_ITEM( aParent, aInFP ? PCB_FP_ZONE_T : PCB_ZONE_T ),
44  m_area( 0.0 )
45 {
46  m_CornerSelection = nullptr; // no corner is selected
47  m_isFilled = false; // fill status : true when the zone is filled
51  m_hv45 = false;
52  m_hatchThickness = 0;
53  m_hatchGap = 0;
54  m_hatchOrientation = 0.0;
55  m_hatchSmoothingLevel = 0; // Grid pattern smoothing type. 0 = no smoothing
56  m_hatchSmoothingValue = 0.1; // Grid pattern chamfer value relative to the gap value
57  // used only if m_hatchSmoothingLevel > 0
58  m_hatchHoleMinArea = 0.3; // Min size before holes are dropped (ratio of hole size)
59  m_hatchBorderAlgorithm = 1; // 0 = use zone min thickness; 1 = use hatch width
60  m_priority = 0;
62  SetIsRuleArea( aInFP ); // Zones living in footprints have the rule area option
63  SetDoNotAllowCopperPour( false ); // has meaning only if m_isRuleArea == true
64  SetDoNotAllowVias( true ); // has meaning only if m_isRuleArea == true
65  SetDoNotAllowTracks( true ); // has meaning only if m_isRuleArea == true
66  SetDoNotAllowPads( true ); // has meaning only if m_isRuleArea == true
67  SetDoNotAllowFootprints( false ); // has meaning only if m_isRuleArea == true
68  m_cornerRadius = 0;
69  SetLocalFlags( 0 ); // flags tempoarry used in zone calculations
70  m_Poly = new SHAPE_POLY_SET(); // Outlines
71  m_fillVersion = 5; // set the "old" way to build filled polygon areas (< 6.0.x)
73  aParent->GetZoneSettings().ExportSetting( *this );
74 
75  m_needRefill = false; // True only after some edition.
76 }
ZONE_BORDER_DISPLAY_STYLE m_borderStyle
Definition: zone.h:946
unsigned int m_cornerRadius
Definition: zone.h:848
void SetDoNotAllowTracks(bool aEnable)
Definition: zone.h:765
ZONE_FILL_MODE m_fillMode
How to fill areas: ZONE_FILL_MODE::POLYGONS => use solid polygons ZONE_FILL_MODE::HATCH_PATTERN => us...
Definition: zone.h:905
int m_cornerSmoothingType
Definition: zone.h:847
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:846
int m_hatchSmoothingLevel
Definition: zone.h:909
double m_area
Definition: zone.h:955
BOARD_CONNECTED_ITEM(BOARD_ITEM *aParent, KICAD_T idtype)
double m_hatchOrientation
Definition: zone.h:908
int m_hatchThickness
Definition: zone.h:906
void SetIsRuleArea(bool aEnable)
Definition: zone.h:762
static int GetDefaultHatchPitch()
Function GetDefaultHatchPitchMils.
Definition: zone.cpp:1084
void SetDoNotAllowPads(bool aEnable)
Definition: zone.h:766
Represent a set of closed polygons.
bool m_hv45
Definition: zone.h:953
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: zone.h:919
ISLAND_REMOVAL_MODE m_islandRemovalMode
Definition: zone.h:880
void SetDoNotAllowVias(bool aEnable)
Definition: zone.h:764
class ZONE, a copper pour area
Definition: typeinfo.h:105
int m_borderHatchPitch
Definition: zone.h:947
void SetLocalFlags(int aFlags)
Definition: zone.h:309
int m_hatchBorderAlgorithm
Definition: zone.h:915
bool m_isFilled
True when a zone was filled, false after deleting the filled areas.
Definition: zone.h:889
void SetDoNotAllowCopperPour(bool aEnable)
Definition: zone.h:763
int m_hatchGap
Definition: zone.h:907
class ZONE, managed by a footprint
Definition: typeinfo.h:94
int m_fillVersion
Definition: zone.h:878
double m_hatchHoleMinArea
Definition: zone.h:914
bool m_needRefill
False when a zone was refilled, true after changes in zone params.
Definition: zone.h:895
unsigned m_priority
Definition: zone.h:859
double m_hatchSmoothingValue
Definition: zone.h:913
void SetDoNotAllowFootprints(bool aEnable)
Definition: zone.h:767

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, POLYGONS, SetDoNotAllowCopperPour(), SetDoNotAllowFootprints(), SetDoNotAllowPads(), SetDoNotAllowTracks(), SetDoNotAllowVias(), SetIsRuleArea(), SetLocalFlags(), and ZONE_SETTINGS::SMOOTHING_NONE.

Referenced by Clone().

◆ ZONE() [2/2]

ZONE::ZONE ( const ZONE aZone)

Definition at line 79 of file zone.cpp.

80  : BOARD_CONNECTED_ITEM( aZone ),
81  m_Poly( nullptr ),
82  m_CornerSelection( nullptr )
83 {
85 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:846
BOARD_CONNECTED_ITEM(BOARD_ITEM *aParent, KICAD_T idtype)
void InitDataFromSrcInCopyCtor(const ZONE &aZone)
Copy aZone data to me.
Definition: zone.cpp:105
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: zone.h:919

References InitDataFromSrcInCopyCtor().

◆ ~ZONE()

ZONE::~ZONE ( )

Definition at line 98 of file zone.cpp.

99 {
100  delete m_Poly;
101  delete m_CornerSelection;
102 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:846
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: zone.h:919

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 else it is a hole inside the main outline

Definition at line 815 of file zone.cpp.

816 {
817  if( aPolygon.empty() )
818  return;
819 
820  SHAPE_LINE_CHAIN outline;
821 
822  // Create an outline and populate it with the points of aPolygon
823  for( const wxPoint& pt : aPolygon)
824  outline.Append( pt );
825 
826  outline.SetClosed( true );
827 
828  AddPolygon( outline );
829 }
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
void SetClosed(bool aClosed)
Function SetClosed()
SHAPE_LINE_CHAIN.
void AddPolygon(std::vector< wxPoint > &aPolygon)
add a polygon to the zone outline if the zone outline is empty, this is the main outline else it is a...
Definition: zone.cpp:815

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

802 {
803  wxASSERT( aPolygon.IsClosed() );
804 
805  // Add the outline as a new polygon in the polygon set
806  if( m_Poly->OutlineCount() == 0 )
807  m_Poly->AddOutline( aPolygon );
808  else
809  m_Poly->AddHole( aPolygon );
810 
811  SetNeedRefill( true );
812 }
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:846
bool IsClosed() const override
Function IsClosed()
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:241

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

833 {
834  // Ensure the main outline exists:
835  if( m_Poly->OutlineCount() == 0 )
836  m_Poly->NewOutline();
837 
838  // If aHoleIdx >= 0, the corner musty be added to the hole, index aHoleIdx.
839  // (remember: the index of the first hole is 0)
840  // Return error if if does dot exist.
841  if( aHoleIdx >= m_Poly->HoleCount( 0 ) )
842  return false;
843 
844  m_Poly->Append( aPosition.x, aPosition.y, -1, aHoleIdx, aAllowDuplication );
845 
846  SetNeedRefill( true );
847 
848  return true;
849 }
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:846
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:241
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(), 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 388 of file zone.cpp.

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

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

Function GetSmoothedPoly.

Definition at line 1161 of file zone.cpp.

1164 {
1165  if( GetNumCorners() <= 2 ) // malformed zone. polygon calculations will not like it ...
1166  return false;
1167 
1168  int zoneClearance = m_ZoneClearance;
1169 
1170  if( GetIsRuleArea() )
1171  {
1172  // We like keepouts just the way they are....
1173  aSmoothedPoly = *m_Poly;
1174  return true;
1175  }
1176  else if( !IsOnCopperLayer() )
1177  {
1178  // Non-copper zones don't have electrical clearances
1179  zoneClearance = 0;
1180  }
1181 
1182  BOARD* board = GetBoard();
1183  int edgeClearance = 0;
1184  int maxError = ARC_HIGH_DEF;
1185  bool keepExternalFillets = false;
1186 
1187  if( board )
1188  {
1189  BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings();
1190 
1191  DRC_CONSTRAINT c = bds.m_DRCEngine->EvalRules( EDGE_CLEARANCE_CONSTRAINT, this, nullptr,
1192  aLayer );
1193  edgeClearance = c.Value().Min();
1194  maxError = bds.m_MaxError;
1195  keepExternalFillets = bds.m_ZoneKeepExternalFillets;
1196  }
1197 
1198  auto smooth = [&]( SHAPE_POLY_SET& aPoly )
1199  {
1200  switch( m_cornerSmoothingType )
1201  {
1203  aPoly = aPoly.Chamfer( (int) m_cornerRadius );
1204  break;
1205 
1207  {
1208  aPoly = aPoly.Fillet( (int) m_cornerRadius, maxError );
1209  break;
1210  }
1211 
1212  default:
1213  break;
1214  }
1215  };
1216 
1217  std::vector<ZONE*> interactingZones;
1218  GetInteractingZones( aLayer, &interactingZones );
1219 
1220  SHAPE_POLY_SET* maxExtents = m_Poly;
1221  SHAPE_POLY_SET withFillets;
1222 
1223  aSmoothedPoly = *m_Poly;
1224 
1225  // Should external fillets (that is, those applied to concave corners) be kept? While it
1226  // seems safer to never have copper extend outside the zone outline, 5.1.x and prior did
1227  // indeed fill them so we leave the mode available.
1228  if( keepExternalFillets )
1229  {
1230  withFillets = *m_Poly;
1231  smooth( withFillets );
1232  withFillets.BooleanAdd( *m_Poly, SHAPE_POLY_SET::PM_FAST );
1233  maxExtents = &withFillets;
1234  }
1235 
1236  for( ZONE* zone : interactingZones )
1237  aSmoothedPoly.BooleanAdd( *zone->Outline(), SHAPE_POLY_SET::PM_FAST );
1238 
1239  if( aBoardOutline )
1240  {
1241  SHAPE_POLY_SET poly = *aBoardOutline;
1242  poly.Deflate( std::max( zoneClearance, edgeClearance ), 16 );
1244  }
1245 
1246  smooth( aSmoothedPoly );
1247 
1248  if( aSmoothedPolyWithApron )
1249  {
1250  SHAPE_POLY_SET poly = *maxExtents;
1251  poly.Inflate( m_ZoneMinThickness, 16 );
1252  *aSmoothedPolyWithApron = aSmoothedPoly;
1253  aSmoothedPolyWithApron->BooleanIntersection( poly, SHAPE_POLY_SET::PM_FAST );
1254  }
1255 
1256  aSmoothedPoly.BooleanIntersection( *maxExtents, SHAPE_POLY_SET::PM_FAST );
1257 
1258  return true;
1259 }
int GetNumCorners(void) const
Access to m_Poly parameters.
Definition: zone.h:530
unsigned int m_cornerRadius
Definition: zone.h:848
int m_ZoneClearance
Definition: zone.h:876
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:755
int m_cornerSmoothingType
Definition: zone.h:847
MINOPTMAX< int > & Value()
Definition: drc_rule.h:122
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:846
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.h:591
T Min() const
Definition: minoptmax.h:33
void Inflate(int aAmount, int aCircleSegmentsCount, CORNER_STRATEGY aCornerStrategy=ROUND_ALL_CORNERS)
Perform outline inflation/deflation.
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:1131
Represent a set of closed polygons.
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:46
void Deflate(int aAmount, int aCircleSegmentsCount, CORNER_STRATEGY aCornerStrategy=ROUND_ALL_CORNERS)
ZONE handles a list of polygons defining a copper zone.
Definition: zone.h:57
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:877
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
bool IsOnCopperLayer() const override
Function IsOnCopperLayer.
Definition: zone.cpp:221
std::shared_ptr< DRC_ENGINE > m_DRCEngine
Container for design settings for a BOARD object.

References SHAPE_POLY_SET::BooleanAdd(), SHAPE_POLY_SET::BooleanIntersection(), SHAPE_POLY_SET::Deflate(), EDGE_CLEARANCE_CONSTRAINT, BOARD_ITEM::GetBoard(), BOARD::GetDesignSettings(), GetInteractingZones(), GetIsRuleArea(), GetNumCorners(), SHAPE_POLY_SET::Inflate(), IsOnCopperLayer(), m_cornerRadius, m_cornerSmoothingType, BOARD_DESIGN_SETTINGS::m_DRCEngine, BOARD_DESIGN_SETTINGS::m_MaxError, m_Poly, m_ZoneClearance, BOARD_DESIGN_SETTINGS::m_ZoneKeepExternalFillets, m_ZoneMinThickness, MINOPTMAX< T >::Min(), SHAPE_POLY_SET::PM_FAST, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE, ZONE_SETTINGS::SMOOTHING_CHAMFER, ZONE_SETTINGS::SMOOTHING_FILLET, and DRC_CONSTRAINT::Value().

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

◆ CacheBoundingBox()

void ZONE::CacheBoundingBox ( )
inline

Definition at line 149 of file zone.h.

EDA_RECT m_bboxCache
Temp variables used while filling.
Definition: zone.h:940
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox (virtual)
Definition: zone.cpp:319

References GetBoundingBox(), and m_bboxCache.

Referenced by PNS_KICAD_IFACE_BASE::syncZone().

◆ CacheTriangulation()

void ZONE::CacheTriangulation ( PCB_LAYER_ID  aLayer = UNDEFINED_LAYER)

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

used for instance to draw these solid areas on opengl

Definition at line 1104 of file zone.cpp.

1105 {
1106  if( aLayer == UNDEFINED_LAYER )
1107  {
1108  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
1109  pair.second.CacheTriangulation();
1110  }
1111  else
1112  {
1113  if( m_FilledPolysList.count( aLayer ) )
1115  }
1116 }
void CacheTriangulation(PCB_LAYER_ID aLayer=UNDEFINED_LAYER)
(re)create a list of triangles that "fill" the solid areas.
Definition: zone.cpp:1104
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:936

References m_FilledPolysList, and UNDEFINED_LAYER.

◆ CalculateFilledArea()

double ZONE::CalculateFilledArea ( )

Compute the area currently occupied by the zone fill.

Returns
the currently filled area

Definition at line 1262 of file zone.cpp.

1263 {
1264  m_area = 0.0;
1265 
1266  // Iterate over each outline polygon in the zone and then iterate over
1267  // each hole it has to compute the total area.
1268  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
1269  {
1270  SHAPE_POLY_SET& poly = pair.second;
1271 
1272  for( int i = 0; i < poly.OutlineCount(); i++ )
1273  {
1274  m_area += poly.Outline( i ).Area();
1275 
1276  for( int j = 0; j < poly.HoleCount( i ); j++ )
1277  m_area -= poly.Hole( i, j ).Area();
1278  }
1279  }
1280 
1281  return m_area;
1282 }
int OutlineCount() const
Return the number of vertices in a given outline/hole.
double m_area
Definition: zone.h:955
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Return the aIndex-th subpolygon in the set.
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:936

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

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

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

Definition at line 560 of file zone.h.

561  {
562  return m_Poly->CIterateWithHoles();
563  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:846
CONST_ITERATOR CIterateWithHoles(int aOutline) const

References SHAPE_POLY_SET::CIterateWithHoles(), and m_Poly.

Referenced by PCB_IO::format().

◆ ClassOf()

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

Definition at line 75 of file zone.h.

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

References PCB_ZONE_T, and EDA_ITEM::Type().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

◆ ClearEditFlags()

◆ ClearFilledPolysList()

void ZONE::ClearFilledPolysList ( )
inline

Function ClearFilledPolysList clears the list of filled polygons.

Definition at line 636 of file zone.h.

637  {
638  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
639  {
640  m_insulatedIslands[pair.first].clear();
641  pair.second.RemoveAllContours();
642  }
643  }
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:951
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:936

References m_FilledPolysList, and m_insulatedIslands.

Referenced by PCB_POINT_EDITOR::updateItem().

◆ ClearFlags()

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

Definition at line 203 of file eda_item.h.

203 { m_flags &= ~aMask; }
STATUS_FLAGS m_flags
Definition: eda_item.h:530

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(), DRAWING_TOOL::PlaceText(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDITOR_PIN_TOOL::RepeatPin(), SYMBOL_EDIT_FRAME::RollbackSymbolFromUndo(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN_CACHE::savePin(), 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 215 of file eda_item.h.

216  {
218  DO_NOT_DRAW );
219  }
#define TEMP_SELECTED
flag indicating that the structure has already selected
Definition: eda_item.h:114
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: eda_item.h:103
#define CANDIDATE
flag indicating that the structure is connected
Definition: eda_item.h:116
#define DO_NOT_DRAW
Used to disable draw function.
Definition: eda_item.h:118
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: eda_item.h:111
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:203
#define ENDPOINT
ends. (Used to support dragging.)
Definition: eda_item.h:112
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: eda_item.h:117

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

149  {
150  m_viewPrivData = nullptr;
151  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:156

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

181 {
182  return new ZONE( *this );
183 }
ZONE(BOARD_ITEM_CONTAINER *parent, bool aInFP=false)
The ctor to build ZONE, but comaptible with FP_ZONE requirement.
Definition: zone.cpp:42

References ZONE().

◆ CommonLayerExists()

bool ZONE::CommonLayerExists ( const LSET  aLayerSet) const

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

Definition at line 227 of file zone.cpp.

228 {
229  LSET common = GetLayerSet() & aLayerSet;
230 
231  return common.count() > 0;
232 }
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: zone.cpp:288
LSET is a set of PCB_LAYER_IDs.

References GetLayerSet().

◆ DeleteStructure()

void BOARD_ITEM::DeleteStructure ( )
inherited

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

Definition at line 113 of file board_item.cpp.

114 {
115  BOARD_ITEM_CONTAINER* parent = GetParent();
116 
117  if( parent )
118  parent->Remove( this );
119 
120  delete this;
121 }
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:168

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

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

◆ Duplicate()

virtual BOARD_ITEM* BOARD_ITEM::Duplicate ( ) const
inlinevirtualinherited

Create a copy of a of this BOARD_ITEM.

Reimplemented in FOOTPRINT.

Definition at line 202 of file board_item.h.

203  {
204  EDA_ITEM* dupe = Clone();
205  const_cast<KIID&>( dupe->m_Uuid ) = KIID();
206 
207  return static_cast<BOARD_ITEM*>( dupe );
208  }
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition: eda_item.cpp:97
Definition: kiid.h:44
const KIID m_Uuid
Definition: eda_item.h:524
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:149

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

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

◆ FillSegments() [1/2]

ZONE_SEGMENT_FILL& ZONE::FillSegments ( PCB_LAYER_ID  aLayer)
inline

Definition at line 311 of file zone.h.

312  {
313  wxASSERT( m_FillSegmList.count( aLayer ) );
314  return m_FillSegmList.at( aLayer );
315  }
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: zone.h:926

References m_FillSegmList.

Referenced by PCB_IO::format().

◆ FillSegments() [2/2]

const ZONE_SEGMENT_FILL& ZONE::FillSegments ( PCB_LAYER_ID  aLayer) const
inline

Definition at line 317 of file zone.h.

318  {
319  wxASSERT( m_FillSegmList.count( aLayer ) );
320  return m_FillSegmList.at( aLayer );
321  }
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: zone.h:926

References m_FillSegmList.

◆ Flip() [1/2]

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

Definition at line 315 of file board_item.h.

316  {
317  Flip( wxPoint( aCentre.x, aCentre.y ), aFlipLeftRight );
318  }
virtual void Flip(const wxPoint &aCentre, bool aFlipLeftRight)
Flip this object, i.e.
Definition: board_item.h:310

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

◆ Flip() [2/2]

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

Function Flip Flip this object, i.e.

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

Parameters
aCentre- the rotation point.

Reimplemented from BOARD_ITEM.

Definition at line 729 of file zone.cpp.

730 {
731  Mirror( aCentre, aFlipLeftRight );
732  int copperLayerCount = GetBoard()->GetCopperLayerCount();
733 
734  if( GetIsRuleArea() )
735  SetLayerSet( FlipLayerMask( GetLayerSet(), copperLayerCount ) );
736  else
737  SetLayer( FlipLayer( GetLayer(), copperLayerCount ) );
738 }
LSET FlipLayerMask(LSET aMask, int aCopperLayersCount)
Calculate the mask layer when flipping a footprint.
Definition: lset.cpp:567
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:755
void SetLayerSet(LSET aLayerSet) override
Definition: zone.cpp:243
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Definition: lset.cpp:521
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: zone.cpp:288
virtual PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: zone.cpp:215
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:46
int GetCopperLayerCount() const
Definition: board.cpp:435
void Mirror(const wxPoint &aMirrorRef, bool aMirrorLeftRight)
Function Mirror Mirror the outlines , relative to a given horizontal axis the layer is not changed.
Definition: zone.cpp:741
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
Definition: zone.cpp:235

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

◆ Get() [1/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty)
inlineinherited

Definition at line 84 of file inspectable.h.

85  {
87  TYPE_ID thisType = TYPE_HASH( *this );
88  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
89  return object ? aProperty->getter( object ) : wxAny();
90  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:66
#define TYPE_HASH(x)
Definition: property.h:57
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:43
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:63
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 CLASS_D_DESC::CLASS_D_DESC(), PCB_EXPR_VAR_REF::GetValue(), and PAD_DESC::PAD_DESC().

◆ Get() [2/3]

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

Definition at line 93 of file inspectable.h.

94  {
96  TYPE_ID thisType = TYPE_HASH( *this );
97  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
98  return object ? aProperty->get<T>( object ) : T();
99  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:66
#define TYPE_HASH(x)
Definition: property.h:57
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:43
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:63
T get(void *aObject)
Definition: property.h:266
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 102 of file inspectable.h.

103  {
105  TYPE_ID thisType = TYPE_HASH( *this );
106  PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
107  boost::optional<T> ret;
108 
109  if( prop )
110  {
111  void* object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
112 
113  if( object )
114  ret = prop->get<T>( object );
115  }
116 
117  return ret;
118  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:66
#define TYPE_HASH(x)
Definition: property.h:57
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:43
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:63
T get(void *aObject)
Definition: property.h:266
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()

BOARD * BOARD_ITEM::GetBoard ( ) const
virtualinherited

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

Definition at line 46 of file board_item.cpp.

47 {
48  if( Type() == PCB_T )
49  return (BOARD*) this;
50 
51  BOARD_ITEM* parent = GetParent();
52 
53  if( parent )
54  return parent->GetBoard();
55 
56  return NULL;
57 }
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:82
#define NULL
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:46
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:168
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:162

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

Referenced by PAD::BuildEffectivePolygon(), PAD::BuildEffectiveShapes(), BuildSmoothedPoly(), KIGFX::PCB_PAINTER::draw(), exprFromTo(), VIA::FlashLayer(), PAD::FlashLayer(), PCB_TARGET::Flip(), PCB_TEXT::Flip(), TRACK::Flip(), FP_SHAPE::Flip(), FP_TEXT::Flip(), DIMENSION_BASE::Flip(), ARC::Flip(), PCB_SHAPE::Flip(), VIA::Flip(), Flip(), BOARD_ITEM::GetBoard(), FOOTPRINT::GetBoundingBox(), FOOTPRINT::GetBoundingHull(), BOARD_CONNECTED_ITEM::GetEffectiveNetclass(), GetInteractingZones(), BOARD_ITEM::GetLayerName(), VIA::GetMinAnnulus(), PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), GetMsgPanelInfo(), NETINFO_ITEM::GetMsgPanelInfo(), TRACK::GetMsgPanelInfo(), 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(), TRACK::GetWidthConstraints(), insideArea(), insideCourtyard(), isDiffPair(), BOARD_ITEM::layerMaskDescribe(), VIA::layerMaskDescribe(), CONVERT_TOOL::makePolysFromCircles(), PAD::MergePrimitivesAsPolygon(), EAGLE_PLUGIN::packageWire(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), BOARD::ResolveDRCExclusions(), BOARD_CONNECTED_ITEM::SetNetCode(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow(), TransformSmoothedOutlineToPolygon(), TransformSolidAreasShapesToPolygon(), TRACK::ViewBBox(), FOOTPRINT::ViewBBox(), VIA::ViewGetLOD(), and PAD::ViewGetLOD().

◆ GetBorderHatchPitch()

int ZONE::GetBorderHatchPitch ( ) const

HatchBorder related methods.

Function GetBorderHatchPitch

Returns
int - the zone hatch pitch in iu.

Definition at line 886 of file zone.cpp.

887 {
888  return m_borderHatchPitch;
889 }
int m_borderHatchPitch
Definition: zone.h:947

References m_borderHatchPitch.

Referenced by PCB_IO::format().

◆ GetBoundingBox()

const EDA_RECT ZONE::GetBoundingBox ( ) const
overridevirtual

Function GetBoundingBox (virtual)

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

Reimplemented from EDA_ITEM.

Definition at line 319 of file zone.cpp.

320 {
321  auto bb = m_Poly->BBox();
322 
323  EDA_RECT ret( (wxPoint) bb.GetOrigin(), wxSize( bb.GetWidth(), bb.GetHeight() ) );
324 
325  return ret;
326 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:846
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(), 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 148 of file zone.h.

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

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 ARC, PAD, PCB_SHAPE, and PCB_MARKER.

Definition at line 114 of file board_item.h.

115  {
116  return GetBoundingBox().GetCenter();
117  }
virtual const EDA_RECT GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
Definition: eda_item.cpp:89
const wxPoint GetCenter() const
Definition: eda_rect.h:109

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

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

◆ GetClass()

wxString ZONE::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Implements EDA_ITEM.

Definition at line 523 of file zone.h.

524  {
525  return wxT( "ZONE" );
526  }

◆ GetCornerPosition()

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

Definition at line 570 of file zone.h.

571  {
573 
574  // Convert global to relative indices
575  if( !m_Poly->GetRelativeIndices( aCornerIndex, &index ) )
576  throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
577 
578  return m_Poly->CVertex( index );
579  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:846
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 710 of file zone.h.

710 { return m_cornerRadius; }
unsigned int m_cornerRadius
Definition: zone.h:848

References m_cornerRadius.

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

◆ GetCornerSmoothingType()

int ZONE::GetCornerSmoothingType ( ) const
inline

Definition at line 706 of file zone.h.

706 { return m_cornerSmoothingType; }
int m_cornerSmoothingType
Definition: zone.h:847

References m_cornerSmoothingType.

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

◆ GetDefaultHatchPitch()

◆ GetDoNotAllowCopperPour()

bool ZONE::GetDoNotAllowCopperPour ( ) const
inline

Definition at line 756 of file zone.h.

756 { return m_doNotAllowCopperPour; }
bool m_doNotAllowCopperPour
Definition: zone.h:869

References m_doNotAllowCopperPour.

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

◆ GetDoNotAllowFootprints()

bool ZONE::GetDoNotAllowFootprints ( ) const
inline

Definition at line 760 of file zone.h.

760 { return m_doNotAllowFootprints; }
bool m_doNotAllowFootprints
Definition: zone.h:873

References m_doNotAllowFootprints.

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

◆ GetDoNotAllowPads()

bool ZONE::GetDoNotAllowPads ( ) const
inline

Definition at line 759 of file zone.h.

759 { return m_doNotAllowPads; }
bool m_doNotAllowPads
Definition: zone.h:872

References m_doNotAllowPads.

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

◆ GetDoNotAllowTracks()

bool ZONE::GetDoNotAllowTracks ( ) const
inline

◆ GetDoNotAllowVias()

bool ZONE::GetDoNotAllowVias ( ) const
inline

Definition at line 757 of file zone.h.

757 { return m_doNotAllowVias; }
bool m_doNotAllowVias
Definition: zone.h:870

References m_doNotAllowVias.

Referenced by PCB_IO::format(), DSN::SPECCTRA_DB::FromBOARD(), GetMsgPanelInfo(), isKeepoutZone(), IsSame(), and ZONE_SETTINGS::operator<<().

◆ GetEditFlags()

STATUS_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 207 of file eda_item.h.

208  {
209  constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVED | IS_RESIZED | IS_DRAGGED |
211 
212  return m_flags & mask;
213  }
#define IS_RESIZED
Item being resized.
Definition: eda_item.h:107
#define STRUCT_DELETED
flag indication structures to be erased
Definition: eda_item.h:115
#define IS_MOVED
Item being moved.
Definition: eda_item.h:105
#define IS_DRAGGED
Item being dragged.
Definition: eda_item.h:108
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
Definition: eda_item.h:119
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: eda_item.h:110
STATUS_FLAGS m_flags
Definition: eda_item.h:530
#define IS_NEW
New item, just created.
Definition: eda_item.h:106

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

Referenced by SCH_EDIT_TOOL::ChangeTextType(), EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_TOOL::editFieldText(), SYMBOL_EDITOR_PIN_TOOL::EditPinProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), SCH_COMPONENT::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_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), and DIALOG_FOOTPRINT_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 69 of file board_connected_item.cpp.

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

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

1373 {
1374  std::shared_ptr<SHAPE> shape;
1375 
1376  if( m_FilledPolysList.find( aLayer ) == m_FilledPolysList.end() )
1377  {
1378  shape = std::make_shared<SHAPE_NULL>();
1379  }
1380  else
1381  {
1382  shape.reset( m_FilledPolysList.at( aLayer ).Clone() );
1383  }
1384 
1385  return shape;
1386 }
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:936

References m_FilledPolysList.

◆ GetFilledArea()

double ZONE::GetFilledArea ( )
inline

Get the area currently occupied by the zone fill.

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

Returns
the filled area

Definition at line 221 of file zone.h.

222  {
223  return m_area;
224  }
double m_area
Definition: zone.h:955

References m_area.

◆ GetFilledPolysList()

const SHAPE_POLY_SET& ZONE::GetFilledPolysList ( PCB_LAYER_ID  aLayer) const
inline

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

Returns
Reference to the list of filled polygons.

Definition at line 655 of file zone.h.

656  {
657  wxASSERT( m_FilledPolysList.count( aLayer ) );
658  return m_FilledPolysList.at( aLayer );
659  }
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:936

References m_FilledPolysList.

Referenced by CN_LIST::Add(), BOARD_ADAPTER::addSolidAreasShapes(), CN_ZONE_LAYER::AnchorCount(), CADSTAR_PCB_ARCHIVE_LOADER::calculateZonePriorities(), CN_VISITOR::checkZoneZoneConnection(), CN_ZONE_LAYER::CN_ZONE_LAYER(), KIGFX::PCB_PAINTER::draw(), CN_CONNECTIVITY_ALGO::FindIsolatedCopperIslands(), PCB_IO::format(), and CN_ZONE_LAYER::GetAnchor().

◆ GetFilledPolysUseThickness() [1/2]

◆ GetFilledPolysUseThickness() [2/2]

bool ZONE::GetFilledPolysUseThickness ( PCB_LAYER_ID  aLayer) const

Definition at line 367 of file zone.cpp.

368 {
369  if( ADVANCED_CFG::GetCfg().m_DebugZoneFiller && LSET::InternalCuMask().Contains( aLayer ) )
370  return false;
371 
373 }
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:710
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
bool GetFilledPolysUseThickness() const
Definition: zone.h:712

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

◆ GetFillFlag()

int ZONE::GetFillFlag ( PCB_LAYER_ID  aLayer)
inline

Definition at line 231 of file zone.h.

232  {
233  return m_fillFlags.count( aLayer ) ? m_fillFlags[ aLayer ] : false;
234  }
std::map< PCB_LAYER_ID, bool > m_fillFlags
Definition: zone.h:941

References m_fillFlags.

◆ GetFillMode()

ZONE_FILL_MODE ZONE::GetFillMode ( ) const
inline

Definition at line 186 of file zone.h.

186 { return m_fillMode; }
ZONE_FILL_MODE m_fillMode
How to fill areas: ZONE_FILL_MODE::POLYGONS => use solid polygons ZONE_FILL_MODE::HATCH_PATTERN => us...
Definition: zone.h:905

References m_fillMode.

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

◆ GetFillVersion()

int ZONE::GetFillVersion ( ) const
inline

Definition at line 715 of file zone.h.

715 { return m_fillVersion; }
int m_fillVersion
Definition: zone.h:878

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_SHAPE, and TRACK.

Definition at line 308 of file eda_item.h.

308 { return GetPosition(); }
virtual wxPoint GetPosition() const
Definition: eda_item.h:301

References EDA_ITEM::GetPosition().

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

◆ GetHashValue()

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

Definition at line 379 of file zone.cpp.

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

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

◆ GetHatchBorderAlgorithm()

int ZONE::GetHatchBorderAlgorithm ( ) const
inline

Definition at line 274 of file zone.h.

274 { return m_hatchBorderAlgorithm; }
int m_hatchBorderAlgorithm
Definition: zone.h:915

References m_hatchBorderAlgorithm.

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

◆ GetHatchGap()

int ZONE::GetHatchGap ( ) const
inline

Definition at line 259 of file zone.h.

259 { return m_hatchGap; }
int m_hatchGap
Definition: zone.h:907

References m_hatchGap.

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

◆ GetHatchHoleMinArea()

double ZONE::GetHatchHoleMinArea ( ) const
inline

Definition at line 271 of file zone.h.

271 { return m_hatchHoleMinArea; }
double m_hatchHoleMinArea
Definition: zone.h:914

References m_hatchHoleMinArea.

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

◆ GetHatchLines()

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

Definition at line 823 of file zone.h.

823 { return m_borderHatchLines; }
std::vector< SEG > m_borderHatchLines
Definition: zone.h:948

References m_borderHatchLines.

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

◆ GetHatchOrientation()

double ZONE::GetHatchOrientation ( ) const
inline

Definition at line 262 of file zone.h.

262 { return m_hatchOrientation; }
double m_hatchOrientation
Definition: zone.h:908

References m_hatchOrientation.

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

◆ GetHatchSmoothingLevel()

int ZONE::GetHatchSmoothingLevel ( ) const
inline

Definition at line 265 of file zone.h.

265 { return m_hatchSmoothingLevel; }
int m_hatchSmoothingLevel
Definition: zone.h:909

References m_hatchSmoothingLevel.

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

◆ GetHatchSmoothingValue()

double ZONE::GetHatchSmoothingValue ( ) const
inline

Definition at line 268 of file zone.h.

268 { return m_hatchSmoothingValue; }
double m_hatchSmoothingValue
Definition: zone.h:913

References m_hatchSmoothingValue.

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

◆ GetHatchStyle()

ZONE_BORDER_DISPLAY_STYLE ZONE::GetHatchStyle ( ) const
inline

Definition at line 620 of file zone.h.

620 { return m_borderStyle; }
ZONE_BORDER_DISPLAY_STYLE m_borderStyle
Definition: zone.h:946

References m_borderStyle.

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

◆ GetHatchThickness()

int ZONE::GetHatchThickness ( ) const
inline

Definition at line 256 of file zone.h.

256 { return m_hatchThickness; }
int m_hatchThickness
Definition: zone.h:906

References m_hatchThickness.

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

◆ GetHV45()

bool ZONE::GetHV45 ( ) const
inline

Definition at line 825 of file zone.h.

825 { return m_hv45; }
bool m_hv45
Definition: zone.h:953

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

1132 {
1133  int epsilon = Millimeter2iu( 0.001 );
1134 
1135  for( ZONE* candidate : GetBoard()->Zones() )
1136  {
1137  if( candidate == this )
1138  continue;
1139 
1140  if( !candidate->GetLayerSet().test( aLayer ) )
1141  continue;
1142 
1143  if( candidate->GetIsRuleArea() )
1144  continue;
1145 
1146  if( candidate->GetNetCode() != GetNetCode() )
1147  continue;
1148 
1149  for( auto iter = m_Poly->CIterate(); iter; iter++ )
1150  {
1151  if( candidate->m_Poly->Collide( iter.Get(), epsilon ) )
1152  {
1153  aZones->push_back( candidate );
1154  break;
1155  }
1156  }
1157  }
1158 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:846
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:46
ZONE handles a list of polygons defining a copper zone.
Definition: zone.h:57
CONST_ITERATOR CIterate(int aFirst, int aLast, bool aIterateHoles=false) const
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 769 of file zone.h.

769 { return m_islandRemovalMode; }
ISLAND_REMOVAL_MODE m_islandRemovalMode
Definition: zone.h:880

References m_islandRemovalMode.

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

◆ GetIsRuleArea()

◆ GetLayer()

PCB_LAYER_ID ZONE::GetLayer ( ) const
overridevirtual

◆ 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 60 of file board_item.cpp.

61 {
62  BOARD* board = GetBoard();
63 
64  if( board )
65  return board->GetLayerName( m_layer );
66 
67  // If no parent, return standard name
69 }
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:342
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:46
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
PCB_LAYER_ID m_layer
Definition: board_item.h:363
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition: board.h:674

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

Referenced by PCB_TEXT::GetMsgPanelInfo(), PCB_TARGET::GetMsgPanelInfo(), FP_TEXT::GetMsgPanelInfo(), DIMENSION_BASE::GetMsgPanelInfo(), PCB_SHAPE::GetMsgPanelInfo(), LEADER::GetMsgPanelInfo(), PCB_TEXT::GetSelectMenuText(), FP_SHAPE::GetSelectMenuText(), TRACK::GetSelectMenuText(), DIMENSION_BASE::GetSelectMenuText(), PCB_SHAPE::GetSelectMenuText(), PCB_TEXT::GetShownText(), FP_TEXT_GRID_TABLE::GetValue(), and FOOTPRINT::ResolveTextVar().

◆ GetLayerSet()

LSET ZONE::GetLayerSet ( ) const
overridevirtual

Return a std::bitset of all layers on which the item physically resides.

Reimplemented from BOARD_ITEM.

Definition at line 288 of file zone.cpp.

289 {
290  return m_layerSet;
291 }
LSET m_layerSet
Definition: zone.h:853

References m_layerSet.

Referenced by CN_CONNECTIVITY_ALGO::Add(), CommonLayerExists(), Flip(), PCB_IO::format(), InitDataFromSrcInCopyCtor(), IsSame(), ZONE_SETTINGS::operator<<(), DRC_ENGINE::RunTests(), SaveCopyOfZones(), PCB_SELECTION_TOOL::Selectable(), and PNS_KICAD_IFACE_BASE::syncZone().

◆ GetLocalClearance() [1/2]

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

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

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

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

Reimplemented from BOARD_CONNECTED_ITEM.

Definition at line 491 of file zone.cpp.

492 {
493  if( m_isRuleArea )
494  return 0;
495 
496  if( aSource )
497  *aSource = _( "zone" );
498 
499  return m_ZoneClearance;
500 }
int m_ZoneClearance
Definition: zone.h:876
bool m_isRuleArea
Definition: zone.h:864
#define _(s)
Definition: 3d_actions.cpp:33

References _, m_isRuleArea, and m_ZoneClearance.

Referenced by ZONE_FILLER::buildCopperItemClearances(), ZONE_FILLER::buildThermalSpokes(), PCB_IO::format(), ZONE_SETTINGS::operator<<(), and BOARD_INSPECTION_TOOL::reportZoneConnection().

◆ GetLocalClearance() [2/2]

int ZONE::GetLocalClearance ( ) const
inline

Definition at line 160 of file zone.h.

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

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 153 of file board_connected_item.h.

153 { return 0; }

Referenced by DRC_ENGINE::EvalRules().

◆ GetLocalFlags()

int ZONE::GetLocalFlags ( ) const
inline

Definition at line 308 of file zone.h.

308 { return m_localFlgs; }
int m_localFlgs
Definition: zone.h:921

References m_localFlgs.

Referenced by InitDataFromSrcInCopyCtor().

◆ GetLocalRatsnestVisible()

bool BOARD_CONNECTED_ITEM::GetLocalRatsnestVisible ( ) const
inlineinherited

◆ GetLock()

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

Definition at line 226 of file zone.h.

227  {
228  return m_lock;
229  }
std::mutex m_lock
Lock used for multi-threaded filling on multi-layer zones.
Definition: zone.h:958

References m_lock.

Referenced by ZONE_FILLER::Fill().

◆ GetMenuImage()

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

1091 {
1092  return add_zone_xpm;
1093 }
const BITMAP_OPAQUE add_zone_xpm[1]
Definition: add_zone.cpp:25

References add_zone_xpm.

◆ GetMinIslandArea()

long long int ZONE::GetMinIslandArea ( ) const
inline

Definition at line 773 of file zone.h.

773 { 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:886

References m_minIslandArea.

Referenced by PCB_IO::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 543 of file zone.cpp.

544 {
545  EDA_UNITS units = aFrame->GetUserUnits();
546  wxString msg;
547 
548  if( GetIsRuleArea() )
549  msg = _( "Rule Area" );
550  else if( IsOnCopperLayer() )
551  msg = _( "Copper Zone" );
552  else
553  msg = _( "Non-copper Zone" );
554 
555  // Display Cutout instead of Outline for holes inside a zone (i.e. when num contour !=0).
556  // Check whether the selected corner is in a hole; i.e., in any contour but the first one.
557  if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
558  msg << wxT( " " ) << _( "Cutout" );
559 
560  aList.emplace_back( _( "Type" ), msg );
561 
562  if( GetIsRuleArea() )
563  {
564  msg.Empty();
565 
566  if( GetDoNotAllowVias() )
567  AccumulateDescription( msg, _( "No vias" ) );
568 
569  if( GetDoNotAllowTracks() )
570  AccumulateDescription( msg, _( "No tracks" ) );
571 
572  if( GetDoNotAllowPads() )
573  AccumulateDescription( msg, _( "No pads" ) );
574 
576  AccumulateDescription( msg, _( "No copper zones" ) );
577 
579  AccumulateDescription( msg, _( "No footprints" ) );
580 
581  if( !msg.IsEmpty() )
582  aList.emplace_back( MSG_PANEL_ITEM( _( "Restrictions" ), msg ) );
583  }
584  else if( IsOnCopperLayer() )
585  {
586  aList.emplace_back( _( "Net" ), UnescapeString( GetNetname() ) );
587 
588  aList.emplace_back( _( "NetClass" ), UnescapeString( GetNetClass()->GetName() ) );
589 
590  // Display priority level
591  aList.emplace_back( _( "Priority" ), wxString::Format( "%d", GetPriority() ) );
592  }
593 
594  wxString layerDesc;
595  int count = 0;
596 
597  for( PCB_LAYER_ID layer : m_layerSet.Seq() )
598  {
599  if( count == 0 )
600  layerDesc = GetBoard()->GetLayerName( layer );
601 
602  count++;
603  }
604 
605  if( count > 1 )
606  layerDesc.Printf( _( "%s and %d more" ), layerDesc, count - 1 );
607 
608  aList.emplace_back( _( "Layer" ), layerDesc );
609 
610  if( !m_zoneName.empty() )
611  aList.emplace_back( _( "Name" ), m_zoneName );
612 
613  switch( m_fillMode )
614  {
615  case ZONE_FILL_MODE::POLYGONS: msg = _( "Solid" ); break;
616  case ZONE_FILL_MODE::HATCH_PATTERN: msg = _( "Hatched" ); break;
617  default: msg = _( "Unknown" ); break;
618  }
619 
620  aList.emplace_back( _( "Fill Mode" ), msg );
621 
622  msg = MessageTextFromValue( units, m_area, true, EDA_DATA_TYPE::AREA );
623  aList.emplace_back( _( "Filled Area" ), msg );
624 
625  wxString source;
626  int clearance = GetOwnClearance( GetLayer(), &source );
627 
628  aList.emplace_back( wxString::Format( _( "Min Clearance: %s" ),
629  MessageTextFromValue( units, clearance ) ),
630  wxString::Format( _( "(from %s)" ), source ) );
631 
632  // Useful for statistics, especially when zones are complex the number of hatches
633  // and filled polygons can explain the display and DRC calculation time:
634  msg.Printf( wxT( "%d" ), (int) m_borderHatchLines.size() );
635  aList.emplace_back( MSG_PANEL_ITEM( _( "HatchBorder Lines" ), msg ) );
636 
637  PCB_LAYER_ID layer = m_layer;
638 
639  // NOTE: This brings in dependence on PCB_EDIT_FRAME to the qa tests, which isn't ideal.
640  // TODO: Figure out a way for items to know the active layer without the whole edit frame?
641 #if 0
642  if( PCB_EDIT_FRAME* pcbframe = dynamic_cast<PCB_EDIT_FRAME*>( aFrame ) )
643  {
644  if( m_FilledPolysList.count( pcbframe->GetActiveLayer() ) )
645  layer = pcbframe->GetActiveLayer();
646  }
647 #endif
648 
649  if( !GetIsRuleArea() )
650  {
651  auto layer_it = m_FilledPolysList.find( layer );
652 
653  if( layer_it == m_FilledPolysList.end() )
654  layer_it = m_FilledPolysList.begin();
655 
656  if( layer_it != m_FilledPolysList.end() )
657  {
658  msg.Printf( wxT( "%d" ), layer_it->second.TotalVertices() );
659  aList.emplace_back( MSG_PANEL_ITEM( _( "Corner Count" ), msg ) );
660  }
661  }
662 }
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:125
bool GetDoNotAllowFootprints() const
Definition: zone.h:760
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:342
ZONE_FILL_MODE m_fillMode
How to fill areas: ZONE_FILL_MODE::POLYGONS => use solid polygons ZONE_FILL_MODE::HATCH_PATTERN => us...
Definition: zone.h:905
unsigned GetPriority() const
Function GetPriority.
Definition: zone.h:124
NETCLASS * GetNetClass() const override
Return the NETCLASS for this item.
Definition: zone.h:88
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:755
wxString m_zoneName
An optional unique name for this zone, used for identifying it in DRC checking.
Definition: zone.h:851
bool GetDoNotAllowVias() const
Definition: zone.h:757
double m_area
Definition: zone.h:955
wxString GetNetname() const
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:853
void AccumulateDescription(wxString &aDesc, const wxString &aItem)
Utility to build comma separated lists in messages.
Definition: kicad_string.h:299
bool GetDoNotAllowPads() const
Definition: zone.h:759
PCB_LAYER_ID
A quick note on layer IDs:
bool GetDoNotAllowCopperPour() const
Definition: zone.h:756
virtual PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: zone.cpp:215
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:46
bool GetDoNotAllowTracks() const
Definition: zone.h:758
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: zone.h:919
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:948
#define _(s)
Definition: 3d_actions.cpp:33
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:150
The main frame for Pcbnew.
bool IsOnCopperLayer() const override
Function IsOnCopperLayer.
Definition: zone.cpp:221
virtual int GetOwnClearance(PCB_LAYER_ID aLayer, wxString *aSource=nullptr) const
Return an item's "own" clearance in internal units.
PCB_LAYER_ID m_layer
Definition: board_item.h:363
EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:54
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:936
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, IsOnCopperLayer(), m_area, m_borderHatchLines, SHAPE_POLY_SET::VERTEX_INDEX::m_contour, m_CornerSelection, m_FilledPolysList, m_fillMode, BOARD_ITEM::m_layer, m_layerSet, m_zoneName, MessageTextFromValue(), POLYGONS, LSET::Seq(), and UnescapeString().

◆ GetNet()

NETINFO_ITEM* BOARD_CONNECTED_ITEM::GetNet ( ) const
inlineinherited

◆ 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 88 of file zone.h.

89  {
90  if( GetIsRuleArea() )
91  return nullptr;
92 
94  }
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:755
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 96 of file zone.h.

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

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

◆ GetNetCode()

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

Definition at line 93 of file board_connected_item.h.

94  {
95  return m_netinfo ? m_netinfo->GetNetCode() : -1;
96  }
NETINFO_ITEM * m_netinfo
Store all information about the net that item belongs to.
int GetNetCode() const
Definition: netinfo.h:113

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(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), ZONE_FILLER::Fill(), PNS::NODE::FindItemByParent(), PCB_IO::format(), DSN::SPECCTRA_DB::FromBOARD(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), CONNECTIVITY_DATA::GetConnectedItems(), GetInteractingZones(), TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), hash_fp_item(), hasThermalConnection(), BOARD_INSPECTION_TOOL::highlightNet(), DIALOG_PAD_PROPERTIES::initValues(), BOARD_INSPECTION_TOOL::InspectClearance(), CONNECTIVITY_DATA::IsConnectedOnLayer(), IsIsland(), IsSame(), ZONE_FILLER::knockoutThermalReliefs(), DSN::SPECCTRA_DB::makeIMAGE(), AR_AUTOPLACER::nearestPad(), ROUTER_TOOL::NeighboringSegmentFilter(), CN_ITEM::Net(), BOARD::NormalizeAreaPolygon(), 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_COPPER_CLEARANCE::testPadAgainstItem(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZones(), BOARD::TracksInNet(), DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow(), 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 126 of file board_connected_item.cpp.

127 {
128  if( !GetBoard() )
129  return wxT( "[** NO BOARD DEFINED **]" );
130 
131  wxString netname = GetNetname();
132 
133  if( !netname.length() )
134  return wxT( "[<no net>]" );
135  else if( GetNetCode() < 0 )
136  return wxT( "[" + UnescapeString( netname ) + "](" + _( "Not Found" ) + ")" );
137  else
138  return wxT( "[" + UnescapeString( netname ) + "]" );
139 }
wxString GetNetname() const
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:46
#define _(s)
Definition: 3d_actions.cpp:33
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:150

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

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

◆ GetNumCorners()

int ZONE::GetNumCorners ( void  ) const
inline

Access to m_Poly parameters.

Definition at line 530 of file zone.h.

531  {
532  return m_Poly->TotalVertices();
533  }
int TotalVertices() const
Delete aIdx-th polygon from the set.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:846

References m_Poly, and SHAPE_POLY_SET::TotalVertices().

Referenced by BuildSmoothedPoly(), and PCB_IO::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 83 of file board_connected_item.cpp.

84 {
85  DRC_CONSTRAINT constraint;
86 
87  if( GetBoard() && GetBoard()->GetDesignSettings().m_DRCEngine )
88  {
90 
91  constraint = bds.m_DRCEngine->EvalRules( CLEARANCE_CONSTRAINT, this, nullptr, aLayer );
92  }
93 
94  if( constraint.Value().HasMin() )
95  {
96  if( aSource )
97  *aSource = constraint.GetName();
98 
99  return constraint.Value().Min();
100  }
101 
102  return 0;
103 }
bool HasMin() const
Definition: minoptmax.h:37
MINOPTMAX< int > & Value()
Definition: drc_rule.h:122
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.h:591
T Min() const
Definition: minoptmax.h:33
wxString GetName() const
Definition: drc_rule.h:127
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:46
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(), TRACK::GetMsgPanelInfo(), VIA::GetMsgPanelInfo(), PAD::GetMsgPanelInfo(), and PAD::ViewBBox().

◆ GetPadConnection() [1/2]

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

Definition at line 770 of file zone.cpp.

771 {
773  {
774  if( aSource )
775  *aSource = _( "zone" );
776 
777  return m_PadConnection;
778  }
779  else
780  {
781  return aPad->GetEffectiveZoneConnection( aSource );
782  }
783 }
ZONE_CONNECTION m_PadConnection
Definition: zone.h:875
#define NULL
ZONE_CONNECTION GetEffectiveZoneConnection(wxString *aSource=nullptr) const
Return the zone connection in effect (either locally overridden or overridden in the parent footprint...
Definition: pcbnew/pad.cpp:792
#define _(s)
Definition: 3d_actions.cpp:33

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

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

◆ GetPadConnection() [2/2]

ZONE_CONNECTION ZONE::GetPadConnection ( ) const
inline

Definition at line 244 of file zone.h.

244 { return m_PadConnection; }
ZONE_CONNECTION m_PadConnection
Definition: zone.h:875

References m_PadConnection.

Referenced by ZONE_DESC::ZONE_DESC().

◆ GetParent()

BOARD_ITEM_CONTAINER* BOARD_ITEM::GetParent ( void  ) const
inlineinherited

Definition at line 168 of file board_item.h.

168 { return (BOARD_ITEM_CONTAINER*) m_parent; }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:528
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(), EDIT_TOOL::CreateArray(), 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::doMoveSelection(), EDIT_TOOL::Drag(), EDIT_TOOL::DragArcTrack(), KIGFX::PCB_PAINTER::draw(), EDIT_TOOL::Duplicate(), PCB_SELECTION_TOOL::FilterCollectorForGroups(), EDIT_TOOL::Flip(), PCB_IO::format(), FormatProbeItem(), BOARD_ITEM::GetBoard(), PCB_MARKER::GetColorLayer(), ALIGN_DISTRIBUTE_TOOL::GetSelections(), FP_TEXT::GetSelectMenuText(), PCB_TEXT::GetShownText(), FP_TEXT::GetShownText(), insideArea(), GENERAL_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), DRC_ENGINE::IsNetTie(), FP_SHAPE::IsParentFlipped(), FP_TEXT::IsParentFlipped(), LEGACY_PLUGIN::loadMODULE_TEXT(), memberOf(), EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), ALTIUM_PCB::ParseTexts6Data(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), POSITION_RELATIVE_TOOL::PositionRelative(), BOARD_COMMIT::Push(), PCB_PARSER::resolveGroups(), EDIT_TOOL::Rotate(), 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(), PCB_GROUP::TopLevelGroup(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), PCB_MARKER::ViewGetLayers(), FP_ZONE::ViewGetLOD(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem(), and PCB_GROUP::WithinScope().

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

210 {
211  return (wxPoint) GetCornerPosition( 0 );
212 }
const VECTOR2I & GetCornerPosition(int aCornerIndex) const
Definition: zone.h:570

References GetCornerPosition().

Referenced by EAGLE_PLUGIN::loadPlain().

◆ GetPriority()

unsigned ZONE::GetPriority ( ) const
inline

◆ GetSelectedCorner()

int ZONE::GetSelectedCorner ( ) const
inline

Definition at line 277 of file zone.h.

278  {
279  // Transform relative indices to global index
280  int globalIndex = -1;
281 
282  if( m_CornerSelection )
283  m_Poly->GetGlobalIndex( *m_CornerSelection, globalIndex );
284 
285  return globalIndex;
286  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:846
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: zone.h:919
bool GetGlobalIndex(VERTEX_INDEX aRelativeIndices, int &aGlobalIdx)
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 852 of file zone.cpp.

853 {
854  wxString layerDesc;
855  int count = 0;
856 
857  for( PCB_LAYER_ID layer : m_layerSet.Seq() )
858  {
859  if( count == 0 )
860  layerDesc = GetBoard()->GetLayerName( layer );
861 
862  count++;
863  }
864 
865  if( count > 1 )
866  layerDesc.Printf( _( "%s and %d more" ), layerDesc, count - 1 );
867 
868  // Check whether the selected contour is a hole (contour index > 0)
869  if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
870  {
871  if( GetIsRuleArea() )
872  return wxString::Format( _( "Rule Area Cutout on %s" ), layerDesc );
873  else
874  return wxString::Format( _( "Zone Cutout on %s" ), layerDesc );
875  }
876  else
877  {
878  if( GetIsRuleArea() )
879  return wxString::Format( _( "Rule Area on %s" ), layerDesc );
880  else
881  return wxString::Format( _( "Zone %s on %s" ), GetNetnameMsg(), layerDesc );
882  }
883 }
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:342
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:755
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:853
PCB_LAYER_ID
A quick note on layer IDs:
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:46
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: zone.h:919
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
#define _(s)
Definition: 3d_actions.cpp:33

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
inlineinherited
Returns
the short netname.

Definition at line 133 of file board_connected_item.h.

134  {
135  return m_netinfo->GetShortNetname();
136  }
const wxString & GetShortNetname() const
Definition: netinfo.h:124
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 ( int  type) const
inlineinherited

Definition at line 186 of file eda_item.h.

187  {
188  return m_status & type;
189  }
STATUS_FLAGS m_status
Definition: eda_item.h:527

References EDA_ITEM::m_status.

Referenced by BOARD_ITEM::IsLocked().

◆ GetStatus()

STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 199 of file eda_item.h.

199 { return m_status; }
STATUS_FLAGS m_status
Definition: eda_item.h:527

References EDA_ITEM::m_status.

◆ GetThermalReliefGap() [1/2]

◆ GetThermalReliefGap() [2/2]

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

Definition at line 329 of file zone.cpp.

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

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

345 {
346  if( aPad->GetEffectiveThermalSpokeWidth() == 0 )
347  {
348  if( aSource )
349  *aSource = _( "zone" );
350 
352  }
353 
354  return aPad->GetEffectiveThermalSpokeWidth( aSource );
355 }
int GetEffectiveThermalSpokeWidth(wxString *aSource=nullptr) const
Return the effective thermal spoke width having resolved any inheritance.
Definition: pcbnew/pad.cpp:813
#define _(s)
Definition: 3d_actions.cpp:33
int m_thermalReliefSpokeWidth
Definition: zone.h:898

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 131 of file zone.h.

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

References m_zoneName.

Referenced by PCB_IO::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 645 of file zone.h.

646  {
647  return m_FilledPolysList.count( aLayer ) > 0;
648  }
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:936

References m_FilledPolysList.

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

◆ HasFlag()

◆ HatchBorder()

void ZONE::HatchBorder ( )

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

Definition at line 923 of file zone.cpp.

924 {
925  UnHatchBorder();
926 
928  || m_borderHatchPitch == 0
929  || m_Poly->IsEmpty() )
930  {
931  return;
932  }
933 
934  // define range for hatch lines
935  int min_x = m_Poly->CVertex( 0 ).x;
936  int max_x = m_Poly->CVertex( 0 ).x;
937  int min_y = m_Poly->CVertex( 0 ).y;
938  int max_y = m_Poly->CVertex( 0 ).y;
939 
940  for( auto iterator = m_Poly->IterateWithHoles(); iterator; iterator++ )
941  {
942  if( iterator->x < min_x )
943  min_x = iterator->x;
944 
945  if( iterator->x > max_x )
946  max_x = iterator->x;
947 
948  if( iterator->y < min_y )
949  min_y = iterator->y;
950 
951  if( iterator->y > max_y )
952  max_y = iterator->y;
953  }
954 
955  // Calculate spacing between 2 hatch lines
956  int spacing;
957 
959  spacing = m_borderHatchPitch;
960  else
961  spacing = m_borderHatchPitch * 2;
962 
963  // set the "length" of hatch lines (the length on horizontal axis)
964  int hatch_line_len = m_borderHatchPitch;
965 
966  // To have a better look, give a slope depending on the layer
967  LAYER_NUM layer = GetLayer();
968  int slope_flag = (layer & 1) ? 1 : -1; // 1 or -1
969  double slope = 0.707106 * slope_flag; // 45 degrees slope
970  int max_a, min_a;
971 
972  if( slope_flag == 1 )
973  {
974  max_a = KiROUND( max_y - slope * min_x );
975  min_a = KiROUND( min_y - slope * max_x );
976  }
977  else
978  {
979  max_a = KiROUND( max_y - slope * max_x );
980  min_a = KiROUND( min_y - slope * min_x );
981  }
982 
983  min_a = (min_a / spacing) * spacing;
984 
985  // calculate an offset depending on layer number,
986  // for a better look of hatches on a multilayer board
987  int offset = (layer * 7) / 8;
988  min_a += offset;
989 
990  // loop through hatch lines
991  #define MAXPTS 200 // Usually we store only few values per one hatch line
992  // depending on the complexity of the zone outline
993 
994  static std::vector<VECTOR2I> pointbuffer;
995  pointbuffer.clear();
996  pointbuffer.reserve( MAXPTS + 2 );
997 
998  for( int a = min_a; a < max_a; a += spacing )
999  {
1000  // get intersection points for this hatch line
1001 
1002  // Note: because we should have an even number of intersections with the
1003  // current hatch line and the zone outline (a closed polygon,
1004  // or a set of closed polygons), if an odd count is found
1005  // we skip this line (should not occur)
1006  pointbuffer.clear();
1007 
1008  // Iterate through all vertices
1009  for( auto iterator = m_Poly->IterateSegmentsWithHoles(); iterator; iterator++ )
1010  {
1011  double x, y;
1012  bool ok;
1013 
1014  SEG segment = *iterator;
1015 
1016  ok = FindLineSegmentIntersection( a, slope,
1017  segment.A.x, segment.A.y,
1018  segment.B.x, segment.B.y,
1019  x, y );
1020 
1021  if( ok )
1022  {
1023  VECTOR2I point( KiROUND( x ), KiROUND( y ) );
1024  pointbuffer.push_back( point );
1025  }
1026 
1027  if( pointbuffer.size() >= MAXPTS ) // overflow
1028  {
1029  wxASSERT( 0 );
1030  break;
1031  }
1032  }
1033 
1034  // ensure we have found an even intersection points count
1035  // because intersections are the ends of segments
1036  // inside the polygon(s) and a segment has 2 ends.
1037  // if not, this is a strange case (a bug ?) so skip this hatch
1038  if( pointbuffer.size() % 2 != 0 )
1039  continue;
1040 
1041  // sort points in order of descending x (if more than 2) to
1042  // ensure the starting point and the ending point of the same segment
1043  // are stored one just after the other.
1044  if( pointbuffer.size() > 2 )
1045  sort( pointbuffer.begin(), pointbuffer.end(), sortEndsByDescendingX );
1046 
1047  // creates lines or short segments inside the complex polygon
1048  for( unsigned ip = 0; ip < pointbuffer.size(); ip += 2 )
1049  {
1050  int dx = pointbuffer[ip + 1].x - pointbuffer[ip].x;
1051 
1052  // Push only one line for diagonal hatch,
1053  // or for small lines < twice the line length
1054  // else push 2 small lines
1056  || std::abs( dx ) < 2 * hatch_line_len )
1057  {
1058  m_borderHatchLines.emplace_back( SEG( pointbuffer[ip], pointbuffer[ ip + 1] ) );
1059  }
1060  else
1061  {
1062  double dy = pointbuffer[ip + 1].y - pointbuffer[ip].y;
1063  slope = dy / dx;
1064 
1065  if( dx > 0 )
1066  dx = hatch_line_len;
1067  else
1068  dx = -hatch_line_len;
1069 
1070  int x1 = KiROUND( pointbuffer[ip].x + dx );
1071  int x2 = KiROUND( pointbuffer[ip + 1].x - dx );
1072  int y1 = KiROUND( pointbuffer[ip].y + dx * slope );
1073  int y2 = KiROUND( pointbuffer[ip + 1].y - dx * slope );
1074 
1075  m_borderHatchLines.emplace_back( SEG( pointbuffer[ip].x, pointbuffer[ip].y, x1, y1 ) );
1076 
1077  m_borderHatchLines.emplace_back( SEG( pointbuffer[ip+1].x, pointbuffer[ip+1].y, x2, y2 ) );
1078  }
1079  }
1080  }
1081 }
ZONE_BORDER_DISPLAY_STYLE m_borderStyle
Definition: zone.h:946
void UnHatchBorder()
Function UnHatchBorder clears the zone's hatch.
Definition: zone.cpp:909
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:846
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the aGlobalIndex-th vertex in the poly set.
bool IsEmpty() const
ITERATOR IterateWithHoles(int aOutline)
virtual PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: zone.cpp:215
#define MAXPTS
bool sortEndsByDescendingX(const VECTOR2I &ref, const VECTOR2I &tst)
Definition: zone.cpp:917
int LAYER_NUM
This can be replaced with int and removed.
int m_borderHatchPitch
Definition: zone.h:947
Definition: seg.h:41
std::vector< SEG > m_borderHatchLines
Definition: zone.h:948
VECTOR2I A
Definition: seg.h:49
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68
VECTOR2I B
Definition: seg.h:50

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, MAXPTS, NO_HATCH, sortEndsByDescendingX(), UnHatchBorder(), VECTOR2< T >::x, and VECTOR2< T >::y.

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

◆ HitTest() [1/2]

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

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

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

Reimplemented from EDA_ITEM.

Definition at line 397 of file zone.cpp.

398 {
399  // Normally accuracy is zoom-relative, but for the generic HitTest we just use
400  // a fixed (small) value.
401  int accuracy = std::max( aAccuracy, Millimeter2iu( 0.1 ) );
402 
403  return HitTestForCorner( aPosition, accuracy * 2 ) || HitTestForEdge( aPosition, accuracy );
404 }
bool HitTestForCorner(const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
Function HitTestForCorner tests if the given wxPoint is near a corner.
Definition: zone.cpp:422
bool HitTestForEdge(const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
Function HitTestForEdge tests if the given wxPoint is near a segment defined by 2 corners.
Definition: zone.cpp:436
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 450 of file zone.cpp.

451 {
452  // Calculate bounding box for zone
453  EDA_RECT bbox = GetBoundingBox();
454  bbox.Normalize();
455 
456  EDA_RECT arect = aRect;
457  arect.Normalize();
458  arect.Inflate( aAccuracy );
459 
460  if( aContained )
461  {
462  return arect.Contains( bbox );
463  }
464  else
465  {
466  // Fast test: if aBox is outside the polygon bounding box, rectangles cannot intersect
467  if( !arect.Intersects( bbox ) )
468  return false;
469 
470  int count = m_Poly->TotalVertices();
471 
472  for( int ii = 0; ii < count; ii++ )
473  {
474  auto vertex = m_Poly->CVertex( ii );
475  auto vertexNext = m_Poly->CVertex( ( ii + 1 ) % count );
476 
477  // Test if the point is within the rect
478  if( arect.Contains( ( wxPoint ) vertex ) )
479  return true;
480 
481  // Test if this edge intersects the rect
482  if( arect.Intersects( ( wxPoint ) vertex, ( wxPoint ) vertexNext ) )
483  return true;
484  }
485 
486  return false;
487  }
488 }
int TotalVertices() const
Delete aIdx-th polygon from the set.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:846
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
Function GetBoundingBox (virtual)
Definition: zone.cpp:319
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:363

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

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

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

Definition at line 518 of file zone.cpp.

519 {
520  // Iterate over each outline polygon in the zone and then iterate over
521  // each hole it has to see if the point is in it.
522  for( int i = 0; i < m_Poly->OutlineCount(); i++ )
523  {
524  for( int j = 0; j < m_Poly->HoleCount( i ); j++ )
525  {
526  if( m_Poly->Hole( i, j ).PointInside( aRefPos ) )
527  {
528  if( aOutlineIdx )
529  *aOutlineIdx = i;
530 
531  if( aHoleIdx )
532  *aHoleIdx = j;
533 
534  return true;
535  }
536  }
537  }
538 
539  return false;
540 }
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:846
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 361 of file zone.h.

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

References HitTestCutout().

◆ HitTestFilledArea()

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

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

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

Definition at line 503 of file zone.cpp.

504 {
505  // Rule areas have no filled area, but it's generally nice to treat their interior as if it were
506  // filled so that people don't have to select them by their outline (which is min-width)
507  if( GetIsRuleArea() )
508  return m_Poly->Contains( VECTOR2I( aRefPos.x, aRefPos.y ), -1, aAccuracy );
509 
510  if( !m_FilledPolysList.count( aLayer ) )
511  return false;
512 
513  return m_FilledPolysList.at( aLayer ).Contains( VECTOR2I( aRefPos.x, aRefPos.y ), -1,
514  aAccuracy );
515 }
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:755
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:846
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:623
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:936

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

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

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

Definition at line 422 of file zone.cpp.

424 {
425  return m_Poly->CollideVertex( VECTOR2I( refPos ), aCornerHit, aAccuracy );
426 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:846
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
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

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

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

Definition at line 429 of file zone.cpp.

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

References dummy(), and HitTestForCorner().

◆ HitTestForEdge() [1/2]

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

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

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

Definition at line 436 of file zone.cpp.

438 {
439  return m_Poly->CollideEdge( VECTOR2I( refPos ), aCornerHit, aAccuracy );
440 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:846
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
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

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

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

Definition at line 443 of file zone.cpp.

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

References dummy(), and HitTestForEdge().

◆ InitDataFromSrcInCopyCtor()

void ZONE::InitDataFromSrcInCopyCtor ( const ZONE aZone)

Copy aZone data to me.

Definition at line 105 of file zone.cpp.

106 {
107  // members are expected non initialize in this.
108  // InitDataFromSrcInCopyCtor() is expected to be called
109  // only from a copy constructor.
110 
111  // Copy only useful EDA_ITEM flags:
112  m_flags = aZone.m_flags;
114 
115  // Replace the outlines for aZone outlines.
116  delete m_Poly;
117  m_Poly = new SHAPE_POLY_SET( *aZone.m_Poly );
118 
121  m_zoneName = aZone.m_zoneName;
122  m_priority = aZone.m_priority;
123  m_isRuleArea = aZone.m_isRuleArea;
124  SetLayerSet( aZone.GetLayerSet() );
125 
131 
133  m_ZoneClearance = aZone.m_ZoneClearance; // clearance value
138 
139  m_isFilled = aZone.m_isFilled;
140  m_needRefill = aZone.m_needRefill;
141 
144 
145  m_fillMode = aZone.m_fillMode; // solid vs. hatched
147  m_hatchGap = aZone.m_hatchGap;
153 
154  // For corner moving, corner index to drag, or nullptr if no selection
155  delete m_CornerSelection;
156  m_CornerSelection = nullptr;
157 
158  for( PCB_LAYER_ID layer : aZone.GetLayerSet().Seq() )
159  {
160  m_FilledPolysList[layer] = aZone.m_FilledPolysList.at( layer );
161  m_RawPolysList[layer] = aZone.m_RawPolysList.at( layer );
162  m_filledPolysHash[layer] = aZone.m_filledPolysHash.at( layer );
163  m_FillSegmList[layer] = aZone.m_FillSegmList.at( layer ); // vector <> copy
164  m_insulatedIslands[layer] = aZone.m_insulatedIslands.at( layer );
165  }
166 
170 
171  SetLocalFlags( aZone.GetLocalFlags() );
172 
173  m_netinfo = aZone.m_netinfo;
174 
175  m_hv45 = aZone.m_hv45;
176  m_area = aZone.m_area;
177 }
ZONE_BORDER_DISPLAY_STYLE m_borderStyle
Definition: zone.h:946
bool m_doNotAllowFootprints
Definition: zone.h:873
unsigned int m_cornerRadius
Definition: zone.h:848
ZONE_FILL_MODE m_fillMode
How to fill areas: ZONE_FILL_MODE::POLYGONS => use solid polygons ZONE_FILL_MODE::HATCH_PATTERN => us...
Definition: zone.h:905
int m_ZoneClearance
Definition: zone.h:876
int m_cornerSmoothingType
Definition: zone.h:847
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:846
wxString m_zoneName
An optional unique name for this zone, used for identifying it in DRC checking.
Definition: zone.h:851
int m_hatchSmoothingLevel
Definition: zone.h:909
void SetLayerSet(LSET aLayerSet) override
Definition: zone.cpp:243
ZONE_CONNECTION m_PadConnection
Definition: zone.h:875
double m_area
Definition: zone.h:955
bool m_doNotAllowTracks
Definition: zone.h:871
long long int m_minIslandArea
When island removal mode is set to AREA, islands below this area will be removed.
Definition: zone.h:886
double m_hatchOrientation
Definition: zone.h:908
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: zone.cpp:288
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:951
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:906
bool m_doNotAllowVias
Definition: zone.h:870
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: zone.h:926
PCB_LAYER_ID
A quick note on layer IDs:
Represent a set of closed polygons.
int GetLocalFlags() const
Definition: zone.h:308
int m_thermalReliefGap
Definition: zone.h:897
bool m_hv45
Definition: zone.h:953
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: zone.h:919
ISLAND_REMOVAL_MODE m_islandRemovalMode
Definition: zone.h:880
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:944
int m_ZoneMinThickness
Definition: zone.h:877
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_RawPolysList
Definition: zone.h:937
bool m_isRuleArea
Definition: zone.h:864
int m_borderHatchPitch
Definition: zone.h:947
std::vector< SEG > m_borderHatchLines
Definition: zone.h:948
void SetLocalFlags(int aFlags)
Definition: zone.h:309
int m_hatchBorderAlgorithm
Definition: zone.h:915
bool m_isFilled
True when a zone was filled, false after deleting the filled areas.
Definition: zone.h:889
NETINFO_ITEM * m_netinfo
Store all information about the net that item belongs to.
int m_hatchGap
Definition: zone.h:907
bool m_doNotAllowCopperPour
Definition: zone.h:869
int m_fillVersion
Definition: zone.h:878
double m_hatchHoleMinArea
Definition: zone.h:914
bool m_needRefill
False when a zone was refilled, true after changes in zone params.
Definition: zone.h:895
STATUS_FLAGS m_flags
Definition: eda_item.h:530
bool m_forceVisible
Definition: eda_item.h:529
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:936
unsigned m_priority
Definition: zone.h:859
double m_hatchSmoothingValue
Definition: zone.h:913
int m_thermalReliefSpokeWidth
Definition: zone.h:898
bool m_doNotAllowPads
Definition: zone.h:872

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 83 of file zone.h.

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

References GetIsRuleArea().

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 170 of file eda_item.h.

170 { return m_flags & IS_DRAGGED; }
#define IS_DRAGGED
Item being dragged.
Definition: eda_item.h:108
STATUS_FLAGS m_flags
Definition: eda_item.h:530

References IS_DRAGGED, and EDA_ITEM::m_flags.

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

◆ IsEntered()

bool EDA_ITEM::IsEntered ( ) const
inlineinherited

Definition at line 173 of file eda_item.h.

173 { return m_flags & ENTERED; }
#define ENTERED
indicates a group has been entered
Definition: eda_item.h:137
STATUS_FLAGS m_flags
Definition: eda_item.h:530

References ENTERED, and EDA_ITEM::m_flags.

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

◆ IsFilled()

bool ZONE::IsFilled ( ) const
inline

Definition at line 237 of file zone.h.

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

References m_isFilled.

Referenced by PCB_EDIT_FRAME::Edit_Zone_Params(), PCB_POINT_EDITOR::finishItem(), PCB_IO::format(), and insideArea().

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 255 of file eda_item.h.

255 { return m_forceVisible; }
bool m_forceVisible
Definition: eda_item.h:529

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

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

1120 {
1121  if( GetNetCode() < 1 )
1122  return true;
1123 
1124  if( !m_insulatedIslands.count( aLayer ) )
1125  return false;
1126 
1127  return m_insulatedIslands.at( aLayer ).count( aPolyIdx );
1128 }
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:951

References BOARD_CONNECTED_ITEM::GetNetCode(), and m_insulatedIslands.

Referenced by PCB_IO::format().

◆ IsLocked()

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 167 of file eda_item.h.

167 { return m_flags & IS_CHANGED; }
#define IS_CHANGED
Item was edited, and modified.
Definition: eda_item.h:102
STATUS_FLAGS m_flags
Definition: eda_item.h:530

References IS_CHANGED, and EDA_ITEM::m_flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsNew()

◆ IsOnCopperLayer()

bool ZONE::IsOnCopperLayer ( ) const
overridevirtual

Function IsOnCopperLayer.

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

Reimplemented from BOARD_ITEM.

Definition at line 221 of file zone.cpp.

222 {
223  return ( m_layerSet & LSET::AllCuMask() ).count() > 0;
224 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:750
LSET m_layerSet
Definition: zone.h:853

References LSET::AllCuMask(), and m_layerSet.

Referenced by BuildSmoothedPoly(), 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 313 of file zone.cpp.

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

References m_layerSet.

Referenced by KIGFX::PCB_PAINTER::draw(), DSN::SPECCTRA_DB::FromBOARD(), and DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZones().

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

Definition at line 452 of file eda_item.h.

452 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 174 of file eda_item.h.

174 { return m_flags & IS_RESIZED; }
#define IS_RESIZED
Item being resized.
Definition: eda_item.h:107
STATUS_FLAGS m_flags
Definition: eda_item.h:530

References IS_RESIZED, and EDA_ITEM::m_flags.

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

◆ IsSame()

bool ZONE::IsSame ( const ZONE aZoneToCompare)

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

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

Parameters
aZoneToCompare= zone to compare with "this"

Definition at line 61 of file zones_functions_for_undo_redo.cpp.

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

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

◆ 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 241 of file board_item.h.

242  {
243  return ( Type() == PCB_TRACE_T ) || ( Type() == PCB_VIA_T );
244  }
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:162

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 VIA, SCH_LABEL, DIMENSION_BASE, PAD, PCB_SHAPE, SCH_FIELD, SCH_LINE, FP_TEXT, FP_SHAPE, and PCB_TEXT.

Definition at line 232 of file eda_item.h.

233  {
234  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
235  return true;
236 
237  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
238  {
239  if( m_structType == *p )
240  return true;
241  }
242 
243  return false;
244  }
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:537

References EOT, EDA_ITEM::m_structType, and SCH_LOCATE_ANY_T.

Referenced by 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(), FP_TEXT::IsType(), SCH_LINE::IsType(), SCH_FIELD::IsType(), PCB_SHAPE::IsType(), PAD::IsType(), DIMENSION_BASE::IsType(), SCH_LABEL::IsType(), 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 171 of file eda_item.h.

171 { return m_flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: eda_item.h:110
STATUS_FLAGS m_flags
Definition: eda_item.h:530

References IS_WIRE_IMAGE, and EDA_ITEM::m_flags.

◆ Iterate()

SHAPE_POLY_SET::ITERATOR ZONE::Iterate ( )
inline

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

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

Definition at line 540 of file zone.h.

541  {
542  return m_Poly->Iterate();
543  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:846
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 344 of file eda_item.h.

348  {
349  for( auto it : aList )
350  {
351  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
353  return SEARCH_RESULT::QUIT;
354  }
355 
357  }
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:107

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 363 of file eda_item.h.

365  {
366  for( auto it : aList )
367  {
368  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
370  return SEARCH_RESULT::QUIT;
371  }
372 
374  }
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:107

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

◆ IterateWithHoles()

SHAPE_POLY_SET::ITERATOR ZONE::IterateWithHoles ( )
inline

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

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

Definition at line 550 of file zone.h.

551  {
552  return m_Poly->IterateWithHoles();
553  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:846
ITERATOR IterateWithHoles(int aOutline)

References SHAPE_POLY_SET::IterateWithHoles(), and m_Poly.

Referenced by DSN::SPECCTRA_DB::FromBOARD().

◆ 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 VIA.

Definition at line 72 of file board_item.cpp.

73 {
74  BOARD* board = GetBoard();
75  LSET layers = GetLayerSet();
76 
77  // Try to be smart and useful. Check all copper first.
78  if( layers[F_Cu] && layers[B_Cu] )
79  return _( "all copper layers" );
80 
81  LSET copperLayers = layers & board->GetEnabledLayers().AllCuMask();
82  LSET techLayers = layers & board->GetEnabledLayers().AllTechMask();
83 
84  for( LSET testLayers : { copperLayers, techLayers, layers } )
85  {
86  for( int bit = PCBNEW_LAYER_ID_START; bit < PCB_LAYER_ID_COUNT; ++bit )
87  {
88  if( testLayers[ bit ] )
89  {
90  wxString layerInfo = board->GetLayerName( static_cast<PCB_LAYER_ID>( bit ) );
91 
92  if( testLayers.count() > 1 )
93  layerInfo << wxS( " " ) + _( "and others" );
94 
95  return layerInfo;
96  }
97  }
98  }
99 
100  // No copper, no technicals: no layer
101  return _( "no layers" );
102 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:750
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:342
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings Returns a bit-mask of all t...
Definition: board.cpp:447
static LSET AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
Definition: lset.cpp:820
LSET is a set of PCB_LAYER_IDs.
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:46
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
#define _(s)
Definition: 3d_actions.cpp:33
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
Definition: board_item.h:178

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 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 134 of file zone.h.

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

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

133 {
134  wxString text = aText;
135  wxString searchText = aSearchData.GetFindString();
136 
137  // Don't match if searching for replaceable item and the item doesn't support text replace.
138  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
139  return false;
140 
141  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
142  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
143 
144  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
145  {
146  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
147  return text.Matches( searchText );
148 
149  return text.MakeUpper().Matches( searchText.MakeUpper() );
150  }
151 
152  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
153  return aText.Find( searchText ) != wxNOT_FOUND;
154 
155  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
156 }
virtual bool IsReplaceable() const
Override this method in any derived object that supports test find and replace.
Definition: eda_item.h:452

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

◆ Mirror()

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

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

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

Definition at line 741 of file zone.cpp.

742 {
743  // ZONEs mirror about the x-axis (why?!?)
744  m_Poly->Mirror( aMirrorLeftRight, !aMirrorLeftRight, VECTOR2I( aMirrorRef ) );
745 
746  HatchBorder();
747 
748  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
749  pair.second.Mirror( aMirrorLeftRight, !aMirrorLeftRight, VECTOR2I( aMirrorRef ) );
750 
751  for( std::pair<const PCB_LAYER_ID, ZONE_SEGMENT_FILL>& pair : m_FillSegmList )
752  {
753  for( SEG& seg : pair.second )
754  {
755  if( aMirrorLeftRight )
756  {
757  MIRROR( seg.A.x, aMirrorRef.x );
758  MIRROR( seg.B.x, aMirrorRef.x );
759  }
760  else
761  {
762  MIRROR( seg.A.y, aMirrorRef.y );
763  MIRROR( seg.B.y, aMirrorRef.y );
764  }
765  }
766  }
767 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:846
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
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
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: zone.h:926
void HatchBorder()
Function HatchBorder computes the hatch lines depending on the hatch parameters and stores it in the ...
Definition: zone.cpp:923
Definition: seg.h:41
VECTOR2I A
Definition: seg.h:49
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:936
VECTOR2I B
Definition: seg.h:50

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 283 of file board_item.h.

284  {
285  Move( wxPoint( aMoveVector.x, aMoveVector.y ) );
286  }
virtual void Move(const wxPoint &aMoveVector)
Move this object.
Definition: board_item.h:277

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

◆ Move() [2/2]

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

Function Move Move the outlines.

Parameters
offset= moving vector

Reimplemented from BOARD_ITEM.

Definition at line 667 of file zone.cpp.

668 {
669  /* move outlines */
670  m_Poly->Move( offset );
671 
672  HatchBorder();
673 
674  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
675  pair.second.Move( offset );
676 
677  for( std::pair<const PCB_LAYER_ID, ZONE_SEGMENT_FILL>& pair : m_FillSegmList )
678  {
679  for( SEG& seg : pair.second )
680  {
681  seg.A += VECTOR2I( offset );
682  seg.B += VECTOR2I( offset );
683  }
684  }
685 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:846
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: zone.h:926
void Move(const VECTOR2I &aVector) override
void HatchBorder()
Function HatchBorder computes the hatch lines depending on the hatch parameters and stores it in the ...
Definition: zone.cpp:923
Definition: seg.h:41
VECTOR2I A
Definition: seg.h:49
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:936
VECTOR2I B
Definition: seg.h:50

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 
)

Function MoveEdge Move the outline Edge.

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

Definition at line 688 of file zone.cpp.

689 {
690  int next_corner;
691 
692  if( m_Poly->GetNeighbourIndexes( aEdge, nullptr, &next_corner ) )
693  {
694  m_Poly->SetVertex( aEdge, m_Poly->CVertex( aEdge ) + VECTOR2I( offset ) );
695  m_Poly->SetVertex( next_corner, m_Poly->CVertex( next_corner ) + VECTOR2I( offset ) );
696  HatchBorder();
697 
698  SetNeedRefill( true );
699  }
700 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:846
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:623
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()
Function HatchBorder computes the hatch lines depending on the hatch parameters and stores it in the ...
Definition: zone.cpp:923
void SetNeedRefill(bool aNeedRefill)
Definition: zone.h:241

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 240 of file zone.h.

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

References m_needRefill.

Referenced by PCB_POINT_EDITOR::finishItem().

◆ NewHole()

void ZONE::NewHole ( )
inline

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

Definition at line 605 of file zone.h.

606  {
607  m_Poly->NewHole();
608  }
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:846

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

186 {
187  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
188  GetClass() ) );
189 
190  return false;
191 }
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 88 of file zone.cpp.

89 {
91 
92  InitDataFromSrcInCopyCtor( aOther );
93 
94  return *this;
95 }
void InitDataFromSrcInCopyCtor(const ZONE &aZone)
Copy aZone data to me.
Definition: zone.cpp:105
EDA_ITEM & operator=(const EDA_ITEM &aItem)
Assign the members of aItem to another object.
Definition: eda_item.cpp:193

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 324 of file zone.h.

324 { return m_Poly; }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:846

References m_Poly.

◆ RawPolysList()

SHAPE_POLY_SET& ZONE::RawPolysList ( PCB_LAYER_ID  aLayer)
inline

Definition at line 740 of file zone.h.

741  {
742  wxASSERT( m_RawPolysList.count( aLayer ) );
743  return m_RawPolysList.at( aLayer );
744  }
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_RawPolysList
Definition: zone.h:937

References m_RawPolysList.

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

◆ RemoveAllContours()

void ZONE::RemoveAllContours ( void  )
inline

Definition at line 565 of file zone.h.

566  {
568  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:846

References m_Poly, and SHAPE_POLY_SET::RemoveAllContours().

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

787 {
788  // Ensure the requested cutout is valid
789  if( m_Poly->OutlineCount() < aOutlineIdx || m_Poly->HoleCount( aOutlineIdx ) < aHoleIdx )
790  return;
791 
792  SHAPE_POLY_SET cutPoly( m_Poly->Hole( aOutlineIdx, aHoleIdx ) );
793 
794  // Add the cutout back to the zone
796 
797  SetNeedRefill( true );
798 }
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:846
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:241

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

160 {
161  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
162 
163  int result = searchString.Find( (aSearchData.GetFlags() & wxFR_MATCHCASE) ?
164  aSearchData.GetFindString() :
165  aSearchData.GetFindString().Upper() );
166 
167  if( result == wxNOT_FOUND )
168  return false;
169 
170  wxString prefix = aText.Left( result );
171  wxString suffix;
172 
173  if( aSearchData.GetFindString().length() + result < aText.length() )
174  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
175 
176  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
177  aText, prefix, aSearchData.GetReplaceString(), suffix );
178 
179  aText = prefix + aSearchData.GetReplaceString() + suffix;
180 
181  return true;
182 }
const wxChar *const traceFindReplace
Flag to enable find and replace debug tracing.

References traceFindReplace.

Referenced by SCH_FIELD::Replace(), EDA_TEXT::Replace(), 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_SHEET_PIN, SCH_FIELD, and SCH_PIN.

Definition at line 441 of file eda_item.h.

442  {
443  return false;
444  }

◆ Rotate() [1/2]

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

Definition at line 299 of file board_item.h.

300  {
301  Rotate( wxPoint( aRotCentre.x, aRotCentre.y ), aAngle );
302  }
virtual void Rotate(const wxPoint &aRotCentre, double aAngle)
Rotate this object.
Definition: board_item.h:294

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

◆ Rotate() [2/2]

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

Function Rotate Move the outlines.

Parameters
aCentre= rot centre
aAngle= in 0.1 degree

Reimplemented from BOARD_ITEM.

Definition at line 703 of file zone.cpp.

704 {
705  aAngle = -DECIDEG2RAD( aAngle );
706 
707  m_Poly->Rotate( aAngle, VECTOR2I( aCentre ) );
708  HatchBorder();
709 
710  /* rotate filled areas: */
711  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
712  pair.second.Rotate( aAngle, VECTOR2I( aCentre ) );
713 
714  for( std::pair<const PCB_LAYER_ID, ZONE_SEGMENT_FILL>& pair : m_FillSegmList )
715  {
716  for( SEG& seg : pair.second )
717  {
718  wxPoint a( seg.A );
719  RotatePoint( &a, aCentre, aAngle );
720  seg.A = a;
721  wxPoint b( seg.B );
722  RotatePoint( &b, aCentre, aAngle );
723  seg.B = a;
724  }
725  }
726 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:846
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:228
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: zone.h:926
void HatchBorder()
Function HatchBorder computes the hatch lines depending on the hatch parameters and stores it in the ...
Definition: zone.cpp:923
Definition: seg.h:41
VECTOR2I A
Definition: seg.h:49
double DECIDEG2RAD(double deg)
Definition: trigo.h:235
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:936
VECTOR2I B
Definition: seg.h:50

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

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

◆ Set() [1/3]

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

Definition at line 40 of file inspectable.h.

41  {
43  TYPE_ID thisType = TYPE_HASH( *this );
44  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
45 
46  if( object )
47  aProperty->setter( object, aValue );
48 
49  return object != nullptr;
50  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:66
#define TYPE_HASH(x)
Definition: property.h:57
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:43
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:63
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 53 of file inspectable.h.

54  {
56  TYPE_ID thisType = TYPE_HASH( *this );
57  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
58 
59  if( object )
60  aProperty->set<T>( object, aValue );
61 
62  return object != nullptr;
63  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:66
#define TYPE_HASH(x)
Definition: property.h:57
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:43
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:63
void set(void *aObject, T aValue)
Definition: property.h:259
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 66 of file inspectable.h.

67  {
69  TYPE_ID thisType = TYPE_HASH( *this );
70  PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
71  void* object = nullptr;
72 
73  if( prop )
74  {
75  object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
76 
77  if( object )
78  prop->set<T>( object, aValue );
79  }
80 
81  return object != nullptr;
82  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:66
#define TYPE_HASH(x)
Definition: property.h:57
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:43
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:63
void set(void *aObject, T aValue)
Definition: property.h:259
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 
)

Function SetBorderDisplayStyle sets 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 892 of file zone.cpp.

894 {
895  SetHatchPitch( aHatchPitch );
896  m_borderStyle = aHatchStyle;
897 
898  if( aRebuildHatch )
899  HatchBorder();
900 }
ZONE_BORDER_DISPLAY_STYLE m_borderStyle
Definition: zone.h:946
void HatchBorder()
Function HatchBorder computes the hatch lines depending on the hatch parameters and stores it in the ...
Definition: zone.cpp:923
void SetHatchPitch(int aPitch)
Function SetHatchPitch sets the hatch pitch parameter for the zone.
Definition: zone.cpp:903

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

void EDA_ITEM::SetBrightened ( )
inlineinherited

◆ SetCornerPosition()

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

Definition at line 581 of file zone.h.

582  {
583  SHAPE_POLY_SET::VERTEX_INDEX relativeIndices;
584 
585  // Convert global to relative indices
586  if( m_Poly->GetRelativeIndices( aCornerIndex, &relativeIndices ) )
587  {
588  if( m_Poly->CVertex( relativeIndices ).x != new_pos.x
589  || m_Poly->CVertex( relativeIndices ).y != new_pos.y )
590  {
591  SetNeedRefill( true );
592  m_Poly->SetVertex( relativeIndices, new_pos );
593  }