KiCad PCB EDA Suite
ZONE_CONTAINER Class Reference

ZONE_CONTAINER handles a list of polygons defining a copper zone. More...

#include <class_zone.h>

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

Public Member Functions

 ZONE_CONTAINER (BOARD_ITEM_CONTAINER *parent, bool aInModule=false)
 The ctor to build ZONE_CONTAINER, but comaptible with MODULE_ZONE_CONTAINER requirement. More...
 
 ZONE_CONTAINER (const ZONE_CONTAINER &aZone)
 
ZONE_CONTAINERoperator= (const ZONE_CONTAINER &aOther)
 
 ~ZONE_CONTAINER ()
 
void InitDataFromSrcInCopyCtor (const ZONE_CONTAINER &aZone)
 Copy aZone data to me. More...
 
wxPoint GetPosition () const override
 
void SetPosition (const wxPoint &aPos) override
 
void SetPriority (unsigned aPriority)
 Function SetPriority. More...
 
unsigned GetPriority () const
 Function GetPriority. More...
 
void GetMsgPanelInfo (EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
 Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for display purposes. More...
 
void SetLayerSet (LSET aLayerSet) override
 
virtual LSET GetLayerSet () const override
 Function GetLayerSet returns a std::bitset of all layers on which the item physically resides. More...
 
wxString GetZoneName () const
 
void SetZoneName (const wxString &aName)
 
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
 Function SetLayer sets the layer this item is on. More...
 
virtual PCB_LAYER_ID GetLayer () const override
 Function GetLayer returns the primary layer this item is on. More...
 
virtual bool IsOnLayer (PCB_LAYER_ID) const override
 Function IsOnLayer tests to see if this object is on the given layer. More...
 
virtual void ViewGetLayers (int aLayers[], int &aCount) const override
 Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on. More...
 
double ViewGetLOD (int aLayer, KIGFX::VIEW *aView) const override
 Function ViewGetLOD() Returns 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 (D_PAD *aPad, wxString *aSource=nullptr) const
 
void SetThermalReliefSpokeWidth (int aThermalReliefSpokeWidth)
 
int GetThermalReliefSpokeWidth () const
 
int GetThermalReliefSpokeWidth (D_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 (D_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
 Function GetEffectiveShape 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_CONTAINER * > *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 TransformSmoothedOutlineWithClearanceToPolygon (SHAPE_POLY_SET &aCornerBuffer, int aClearance) const
 Function TransformSmoothedOutlineWithClearanceToPolygon 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=ARC_HIGH_DEF, bool ignoreLineWidth=false) const override
 Function TransformShapeWithClearanceToPolygon Convert the zone shape to a closed polygon Used in filling zones calculations Circles and arcs are approximated by segments. More...
 
bool HitTestForCorner (const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
 Function HitTestForCorner tests if the given wxPoint is near a corner. More...
 
bool HitTestForCorner (const wxPoint &refPos, int aAccuracy) const
 Function HitTestForCorner tests if the given wxPoint is near a corner. More...
 
bool HitTestForEdge (const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
 Function HitTestForEdge tests if the given wxPoint is near a segment defined by 2 corners. More...
 
bool HitTestForEdge (const wxPoint &refPos, int aAccuracy) const
 Function HitTestForEdge tests if the given wxPoint is near a segment defined by 2 corners. More...
 
bool 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_CONTAINER &aZoneToCompare)
 Function IsSame tests if 2 zones are equivalent: 2 zones are equivalent if they have same parameters and same outlines info, filling is not taken into account. More...
 
void ClearFilledPolysList ()
 Function ClearFilledPolysList clears the list of filled polygons. More...
 
bool HasFilledPolysForLayer (PCB_LAYER_ID aLayer) const
 
const SHAPE_POLY_SETGetFilledPolysList (PCB_LAYER_ID aLayer) const
 Function GetFilledPolysList returns a reference to the list of filled polygons. More...
 
void CacheTriangulation (PCB_LAYER_ID aLayer=UNDEFINED_LAYER)
 (re)create a list of triangles that "fill" the solid areas. More...
 
void SetFilledPolysList (PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aPolysList)
 Function SetFilledPolysList sets the list of filled polygons. More...
 
void SetRawPolysList (PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aPolysList)
 Function SetFilledPolysList sets the list of filled polygons. More...
 
bool IsIsland (PCB_LAYER_ID aLayer, int aPolyIdx)
 Checks if a given filled polygon is an insulated island. More...
 
void SetIsIsland (PCB_LAYER_ID aLayer, int aPolyIdx)
 
bool BuildSmoothedPoly (SHAPE_POLY_SET &aSmoothedPoly, PCB_LAYER_ID aLayer) const
 Function GetSmoothedPoly. More...
 
void SetCornerSmoothingType (int aType)
 
int GetCornerSmoothingType () const
 
void SetCornerRadius (unsigned int aRadius)
 
unsigned int GetCornerRadius () const
 
bool GetFilledPolysUseThickness () 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
 Function GetSelectMenuText returns the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position. More...
 
BITMAP_DEF GetMenuImage () const override
 Function GetMenuImage returns a pointer to an image to be used in menus. More...
 
EDA_ITEMClone () const override
 Function Clone creates 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)
 
MD5_HASH GetHashValue (PCB_LAYER_ID aLayer)
 
void BuildHashValue (PCB_LAYER_ID aLayer)
 Build the hash value of m_FilledPolysList, and store it internally in m_filledPolysHash. More...
 
virtual void SwapData (BOARD_ITEM *aImage) override
 Swap data between aItem and aImage. More...
 
bool IsConnected () const override
 

More...
 
NETINFO_ITEMGetNet () const
 Function GetNet Returns NET_INFO object for a given item. More...
 
void SetNet (NETINFO_ITEM *aNetInfo)
 Function SetNet Sets a NET_INFO object for the item. More...
 
int GetNetCode () const
 Function GetNetCode. More...
 
bool SetNetCode (int aNetCode, bool aNoAssert)
 Sets net using a net code. More...
 
void SetNetCode (int aNetCode)
 
wxString GetNetname () const
 Function GetNetname. More...
 
wxString GetNetnameMsg () const
 Function GetNetnameMsg. More...
 
wxString GetShortNetname () const
 Function GetShortNetname. More...
 
virtual int GetClearance (PCB_LAYER_ID aLayer, BOARD_ITEM *aItem=nullptr, wxString *aSource=nullptr) const
 Function GetClearance returns the clearance in internal units. More...
 
virtual int GetLocalClearanceOverrides (wxString *aSource) const
 Function GetLocalClearanceOverrides returns any local clearance overrides set in the "classic" (ie: pre-rule) system. More...
 
NETCLASSGetNetClass () const
 Function GetNetClassPtr returns the NETCLASS for this item. More...
 
NETCLASSGetEffectiveNetclass () const
 Function GetEffectiveNetclass returns the NETCLASS for this item, or the default netclass if none is defined. More...
 
wxString GetNetClassName () const
 Function GetNetClassName returns a pointer to the netclass of the zone. More...
 
void SetLocalRatsnestVisible (bool aVisible)
 
bool GetLocalRatsnestVisible () const
 
void SetGroup (const KIID &aGroup)
 Set the group that this item belongs to. More...
 
const KIIDGetGroup () const
 Get the group this item belongs to. More...
 
bool IsInGroup ()
 Test if this item is inside a group. More...
 
int GetX () const
 
int GetY () const
 
virtual wxPoint GetCenter () const
 Function GetCenter() More...
 
void SetX (int aX)
 
void SetY (int aY)
 
BOARD_ITEM_CONTAINERGetParent () const
 
virtual BOARD_ITEMDuplicate () const
 Function Duplicate creates a copy of a BOARD_ITEM. More...
 
bool IsTrack () const
 Function IsTrack tests to see if this object is a track or via (or microvia). More...
 
virtual bool IsLocked () const
 Function IsLocked. More...
 
virtual void SetLocked (bool aLocked)
 Function SetLocked modifies 'lock' status for of the item. More...
 
void DeleteStructure ()
 Function DeleteStructure deletes this object after removing from its parent if it has one. More...
 
void Move (const VECTOR2I &aMoveVector)
 
void Rotate (const VECTOR2I &aRotCentre, double aAngle)
 
void Flip (const VECTOR2I &aCentre, bool aFlipLeftRight)
 
virtual BOARDGetBoard () const
 Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none. More...
 
wxString GetLayerName () const
 Function GetLayerName returns the name of the PCB layer on which the item resides. More...
 
KICAD_T Type () const
 Function Type() More...
 
virtual void SetParent (EDA_ITEM *aParent)
 
bool IsModified () const
 
bool IsNew () const
 
bool IsMoving () const
 
bool IsDragging () const
 
bool IsWireImage () const
 
bool IsSelected () const
 
bool IsResized () const
 
bool IsBrightened () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (int type) const
 
void SetState (int type, int state)
 
STATUS_FLAGS GetStatus () const
 
void SetStatus (STATUS_FLAGS aStatus)
 
void SetFlags (STATUS_FLAGS aMask)
 
void ClearFlags (STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
STATUS_FLAGS GetFlags () const
 
bool HasFlag (STATUS_FLAGS aFlag)
 
STATUS_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
virtual bool IsType (const KICAD_T aScanTypes[]) const
 Function IsType Checks whether the item is one of the listed types. More...
 
void SetForceVisible (bool aEnable)
 Function SetForceVisible is used to set and cleag force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible. More...
 
bool IsForceVisible () const
 
virtual const wxPoint GetFocusPosition () const
 Function GetFocusPosition similar to GetPosition, but allows items to return their visual center rather than their anchor. More...
 
virtual SEARCH_RESULT Visit (INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 Function Visit may be re-implemented for each derived class in order to handle all the types given by its member data. More...
 
virtual bool Matches (wxFindReplaceData &aSearchData, void *aAuxData)
 Function Matches compares the item against the search criteria in aSearchData. More...
 
virtual bool Replace (wxFindReplaceData &aSearchData, void *aAuxData=NULL)
 Function Replace performs a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Function IsReplaceable. More...
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
virtual const BOX2I ViewBBox () const override
 Function ViewBBox() returns the bounding box of the item covering all its layers. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Function ViewDraw() Draws the parts of the object belonging to layer aLayer. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 
void ClearViewPrivData ()
 
bool Set (PROPERTY_BASE *aProperty, wxAny &aValue)
 
template<typename T >
bool Set (PROPERTY_BASE *aProperty, T aValue)
 
template<typename T >
bool Set (const wxString &aProperty, T aValue)
 
wxAny Get (PROPERTY_BASE *aProperty)
 
template<typename T >
Get (PROPERTY_BASE *aProperty)
 
template<typename T >
boost::optional< T > Get (const wxString &aProperty)
 

Static Public Member Functions

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

Public Attributes

const KIID m_Uuid
 

Static Public Attributes

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

Protected Member Functions

virtual wxString LayerMaskDescribe () const
 Helper function Return a string (to be shown to the user) describing a layer mask. More...
 
bool Matches (const wxString &aText, wxFindReplaceData &aSearchData)
 Function Matches compares 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
 Stores all informations about the net that item belongs to. More...
 
PCB_LAYER_ID m_Layer
 
KIID m_groupUuid
 
STATUS_FLAGS m_Status
 
EDA_ITEMm_Parent
 Linked list: Link (parent struct) More...
 
bool m_forceVisible
 
STATUS_FLAGS m_Flags
 

Detailed Description

ZONE_CONTAINER 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_CONTAINER is living in a board a variant MODULE_ZONE_CONTAINER is living in a footprint

Definition at line 61 of file class_zone.h.

Constructor & Destructor Documentation

◆ ZONE_CONTAINER() [1/2]

ZONE_CONTAINER::ZONE_CONTAINER ( BOARD_ITEM_CONTAINER parent,
bool  aInModule = false 
)

The ctor to build ZONE_CONTAINER, but comaptible with MODULE_ZONE_CONTAINER requirement.

if aInModule is true, a MODULE_ZONE_CONTAINER is actually built (same item, but with a specific type id: The type is PCB_ZONE_AREA_T for a ZONE_CONTAINER The type is PCB_MODULE_ZONE_AREA_T for a MODULE_ZONE_CONTAINER

Definition at line 41 of file class_zone.cpp.

43  m_area( 0.0 )
44 {
45  m_CornerSelection = nullptr; // no corner is selected
46  m_isFilled = false; // fill status : true when the zone is filled
50  m_hv45 = false;
51  m_hatchThickness = 0;
52  m_hatchGap = 0;
53  m_hatchOrientation = 0.0;
54  m_hatchSmoothingLevel = 0; // Grid pattern smoothing type. 0 = no smoothing
55  m_hatchSmoothingValue = 0.1; // Grid pattern chamfer value relative to the gap value
56  // used only if m_hatchSmoothingLevel > 0
57  m_hatchHoleMinArea = 0.3; // Min size before holes are dropped (ratio of hole size)
58  m_hatchBorderAlgorithm = 1; // 0 = use zone min thickness; 1 = use hatch width
59  m_priority = 0;
61  SetIsRuleArea( aInModule ? true : false ); // Zones living in modules have the rule area option
62  SetDoNotAllowCopperPour( false ); // has meaning only if m_isRuleArea == true
63  SetDoNotAllowVias( true ); // has meaning only if m_isRuleArea == true
64  SetDoNotAllowTracks( true ); // has meaning only if m_isRuleArea == true
65  SetDoNotAllowPads( true ); // has meaning only if m_isRuleArea == true
66  SetDoNotAllowFootprints( false ); // has meaning only if m_isRuleArea == true
67  m_cornerRadius = 0;
68  SetLocalFlags( 0 ); // flags tempoarry used in zone calculations
69  m_Poly = new SHAPE_POLY_SET(); // Outlines
70  m_fillVersion = 6; // set the "old" way to build filled polygon areas (before 6.0.x)
72  aParent->GetZoneSettings().ExportSetting( *this );
73 
74  m_needRefill = false; // True only after some edition.
75 }
bool m_isFilled
True when a zone was filled, false after deleting the filled areas.
Definition: class_zone.h:872
void SetDoNotAllowTracks(bool aEnable)
Definition: class_zone.h:734
int m_hatchBorderAlgorithm
Definition: class_zone.h:898
double m_hatchSmoothingValue
Definition: class_zone.h:896
ISLAND_REMOVAL_MODE m_islandRemovalMode
Definition: class_zone.h:863
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: class_zone.h:902
void SetDoNotAllowFootprints(bool aEnable)
Definition: class_zone.h:736
BOARD_CONNECTED_ITEM(BOARD_ITEM *aParent, KICAD_T idtype)
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:106
void SetIsRuleArea(bool aEnable)
Definition: class_zone.h:731
static int GetDefaultHatchPitch()
Function GetDefaultHatchPitchMils.
void SetDoNotAllowVias(bool aEnable)
Definition: class_zone.h:733
ZONE_BORDER_DISPLAY_STYLE m_borderStyle
Definition: class_zone.h:929
double m_hatchOrientation
Definition: class_zone.h:891
SHAPE_POLY_SET.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:829
unsigned m_priority
Definition: class_zone.h:842
int m_cornerSmoothingType
Definition: class_zone.h:830
void SetDoNotAllowPads(bool aEnable)
Definition: class_zone.h:735
double m_hatchHoleMinArea
Definition: class_zone.h:897
unsigned int m_cornerRadius
Definition: class_zone.h:831
void SetDoNotAllowCopperPour(bool aEnable)
Definition: class_zone.h:732
void SetLocalFlags(int aFlags)
Definition: class_zone.h:286
bool m_needRefill
False when a zone was refilled, true after changes in zone params.
Definition: class_zone.h:878
int m_hatchSmoothingLevel
Definition: class_zone.h:892
class ZONE_CONTAINER, managed by a footprint
Definition: typeinfo.h:95
ZONE_FILL_MODE m_fillMode
How to fill areas: ZONE_FILL_MODE::POLYGONS => use solid polygons ZONE_FILL_MODE::HATCH_PATTERN => us...
Definition: class_zone.h:888
int m_hatchThickness
Definition: class_zone.h:889
int m_borderHatchPitch
Definition: class_zone.h:930

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_CONTAINER() [2/2]

ZONE_CONTAINER::ZONE_CONTAINER ( const ZONE_CONTAINER aZone)

Definition at line 78 of file class_zone.cpp.

79  : BOARD_CONNECTED_ITEM( aZone ),
80  m_Poly( nullptr ),
81  m_CornerSelection( nullptr )
82 {
84 }
void InitDataFromSrcInCopyCtor(const ZONE_CONTAINER &aZone)
Copy aZone data to me.
Definition: class_zone.cpp:104
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: class_zone.h:902
BOARD_CONNECTED_ITEM(BOARD_ITEM *aParent, KICAD_T idtype)
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:829

References InitDataFromSrcInCopyCtor().

◆ ~ZONE_CONTAINER()

ZONE_CONTAINER::~ZONE_CONTAINER ( )

Definition at line 97 of file class_zone.cpp.

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

References m_CornerSelection, and m_Poly.

Member Function Documentation

◆ AddPolygon() [1/2]

void ZONE_CONTAINER::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 801 of file class_zone.cpp.

802 {
803  if( aPolygon.empty() )
804  return;
805 
806  SHAPE_LINE_CHAIN outline;
807 
808  // Create an outline and populate it with the points of aPolygon
809  for( const wxPoint& pt : aPolygon)
810  outline.Append( pt );
811 
812  outline.SetClosed( true );
813 
814  AddPolygon( outline );
815 }
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
void SetClosed(bool aClosed)
Function SetClosed()
void AddPolygon(std::vector< wxPoint > &aPolygon)
add a polygon to the zone outline if the zone outline is empty, this is the main outline else it is a...
Definition: class_zone.cpp:801
SHAPE_LINE_CHAIN.

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_CONTAINER::AddPolygon ( const SHAPE_LINE_CHAIN aPolygon)

Definition at line 787 of file class_zone.cpp.

788 {
789  wxASSERT( aPolygon.IsClosed() );
790 
791  // Add the outline as a new polygon in the polygon set
792  if( m_Poly->OutlineCount() == 0 )
793  m_Poly->AddOutline( aPolygon );
794  else
795  m_Poly->AddHole( aPolygon );
796 
797  SetNeedRefill( true );
798 }
int OutlineCount() const
Returns the number of outlines in the set
bool IsClosed() const override
Function IsClosed()
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:829
int AddHole(const SHAPE_LINE_CHAIN &aHole, int aOutline=-1)
Adds a new hole to the given outline (default: last) and returns its index
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new outline to the set and returns its index
void SetNeedRefill(bool aNeedRefill)
Definition: class_zone.h:218

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

◆ AppendCorner()

bool ZONE_CONTAINER::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 818 of file class_zone.cpp.

819 {
820  // Ensure the main outline exists:
821  if( m_Poly->OutlineCount() == 0 )
822  m_Poly->NewOutline();
823 
824  // If aHoleIdx >= 0, the corner musty be added to the hole, index aHoleIdx.
825  // (remember: the index of the first hole is 0)
826  // Return error if if does dot exist.
827  if( aHoleIdx >= m_Poly->HoleCount( 0 ) )
828  return false;
829 
830  m_Poly->Append( aPosition.x, aPosition.y, -1, aHoleIdx, aAllowDuplication );
831 
832  SetNeedRefill( true );
833 
834  return true;
835 }
int OutlineCount() const
Returns the number of outlines in the set
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:829
int NewOutline()
Creates a new empty polygon in the set and returns its index
int HoleCount(int aOutline) const
Returns the number of holes in a given outline
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)
void SetNeedRefill(bool aNeedRefill)
Definition: class_zone.h:218

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

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

◆ BuildHashValue()

void ZONE_CONTAINER::BuildHashValue ( PCB_LAYER_ID  aLayer)
inline

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 812 of file class_zone.h.

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

References m_filledPolysHash, and m_FilledPolysList.

◆ BuildSmoothedPoly()

bool ZONE_CONTAINER::BuildSmoothedPoly ( SHAPE_POLY_SET aSmoothedPoly,
PCB_LAYER_ID  aLayer 
) const

Function GetSmoothedPoly.

Definition at line 1151 of file class_zone.cpp.

1152 {
1153  if( GetNumCorners() <= 2 ) // malformed zone. polygon calculations will not like it ...
1154  return false;
1155 
1156  BOARD* board = GetBoard();
1157  int maxError = ARC_HIGH_DEF;
1158  bool keepExternalFillets = false;
1159 
1160  if( board )
1161  {
1162  maxError = board->GetDesignSettings().m_MaxError;
1163  keepExternalFillets = board->GetDesignSettings().m_ZoneKeepExternalFillets;
1164  }
1165 
1166  auto smooth = [&]( SHAPE_POLY_SET& aPoly )
1167  {
1168  switch( m_cornerSmoothingType )
1169  {
1171  aPoly = aPoly.Chamfer( (int) m_cornerRadius );
1172  break;
1173 
1175  {
1176  aPoly = aPoly.Fillet( (int) m_cornerRadius, maxError );
1177  break;
1178  }
1179 
1180  default:
1181  break;
1182  }
1183  };
1184 
1185  std::vector<ZONE_CONTAINER*> interactingZones;
1186  GetInteractingZones( aLayer, &interactingZones );
1187 
1188  SHAPE_POLY_SET* maxExtents = m_Poly;
1189  SHAPE_POLY_SET withFillets;
1190 
1191  aSmoothedPoly = *m_Poly;
1192 
1193  // Should external fillets (that is, those applied to concave corners) be kept? While it
1194  // seems safer to never have copper extend outside the zone outline, 5.1.x and prior did
1195  // indeed fill them so we leave the mode available.
1196  if( keepExternalFillets )
1197  {
1198  withFillets = *m_Poly;
1199  smooth( withFillets );
1200  withFillets.BooleanAdd( *m_Poly, SHAPE_POLY_SET::PM_FAST );
1201  maxExtents = &withFillets;
1202  }
1203 
1204  for( ZONE_CONTAINER* zone : interactingZones )
1205  aSmoothedPoly.BooleanAdd( *zone->Outline(), SHAPE_POLY_SET::PM_FAST );
1206 
1207  smooth( aSmoothedPoly );
1208 
1209  if( interactingZones.size() )
1210  aSmoothedPoly.BooleanIntersection( *maxExtents, SHAPE_POLY_SET::PM_FAST );
1211 
1212  return true;
1213 }
void GetInteractingZones(PCB_LAYER_ID aLayer, std::vector< ZONE_CONTAINER * > *aZones) const
Some intersecting zones, despite being on the same layer with the same net, cannot be merged due to o...
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
void BooleanAdd(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Performs boolean polyset union For aFastMode meaning, see function booleanOp
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:537
SHAPE_POLY_SET.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:829
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
int m_cornerSmoothingType
Definition: class_zone.h:830
int GetNumCorners(void) const
Access to m_Poly parameters.
Definition: class_zone.h:504
void BooleanIntersection(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Performs boolean polyset intersection For aFastMode meaning, see function booleanOp
unsigned int m_cornerRadius
Definition: class_zone.h:831
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:178

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

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

◆ CacheBoundingBox()

void ZONE_CONTAINER::CacheBoundingBox ( )
inline

Definition at line 126 of file class_zone.h.

const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox (virtual)
Definition: class_zone.cpp:318
EDA_RECT m_bboxCache
Temp variables used while filling.
Definition: class_zone.h:923

References GetBoundingBox(), and m_bboxCache.

◆ CacheTriangulation()

void ZONE_CONTAINER::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 1093 of file class_zone.cpp.

1094 {
1095  if( aLayer == UNDEFINED_LAYER )
1096  {
1097  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
1098  pair.second.CacheTriangulation();
1099  }
1100  else
1101  {
1102  if( m_FilledPolysList.count( aLayer ) )
1104  }
1105 }
void CacheTriangulation(PCB_LAYER_ID aLayer=UNDEFINED_LAYER)
(re)create a list of triangles that "fill" the solid areas.
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:919

References m_FilledPolysList, and UNDEFINED_LAYER.

◆ CalculateFilledArea()

double ZONE_CONTAINER::CalculateFilledArea ( )

Compute the area currently occupied by the zone fill.

Returns
the currently filled area

Definition at line 1216 of file class_zone.cpp.

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

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_CONTAINER::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 534 of file class_zone.h.

535  {
536  return m_Poly->CIterateWithHoles();
537  }
CONST_ITERATOR CIterateWithHoles(int aOutline) const
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:829

References SHAPE_POLY_SET::CIterateWithHoles(), and m_Poly.

◆ ClassOf()

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

Definition at line 80 of file class_zone.h.

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

References PCB_ZONE_AREA_T, and EDA_ITEM::Type().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

◆ ClearEditFlags()

◆ ClearFilledPolysList()

void ZONE_CONTAINER::ClearFilledPolysList ( )
inline

Function ClearFilledPolysList clears the list of filled polygons.

Definition at line 608 of file class_zone.h.

609  {
610  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
611  {
612  m_insulatedIslands[pair.first].clear();
613  pair.second.RemoveAllContours();
614  }
615  }
std::map< PCB_LAYER_ID, std::set< int > > m_insulatedIslands
For each layer, a set of insulated islands that were not removed.
Definition: class_zone.h:934
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:919

References m_FilledPolysList, and m_insulatedIslands.

Referenced by POINT_EDITOR::updateItem().

◆ ClearFlags()

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

Definition at line 233 of file base_struct.h.

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

References EDA_ITEM::m_Flags.

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

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 245 of file base_struct.h.

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

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

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 154 of file view_item.h.

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

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

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

◆ Clone()

EDA_ITEM * ZONE_CONTAINER::Clone ( ) const
overridevirtual

Function Clone creates a duplicate of this item with linked list members set to NULL.

The default version will return NULL in release builds and likely crash the program. In debug builds, a warning message indicating the derived class has not implemented cloning. This really should be a pure virtual function. Due to the fact that there are so many objects derived from EDA_ITEM, the decision was made to return NULL until all the objects derived from EDA_ITEM implement cloning. Once that happens, this function should be made pure.

Returns
A clone of the item.

Reimplemented from EDA_ITEM.

Reimplemented in MODULE_ZONE_CONTAINER.

Definition at line 179 of file class_zone.cpp.

180 {
181  return new ZONE_CONTAINER( *this );
182 }
ZONE_CONTAINER(BOARD_ITEM_CONTAINER *parent, bool aInModule=false)
The ctor to build ZONE_CONTAINER, but comaptible with MODULE_ZONE_CONTAINER requirement.
Definition: class_zone.cpp:41

References ZONE_CONTAINER().

◆ CommonLayerExists()

bool ZONE_CONTAINER::CommonLayerExists ( const LSET  aLayerSet) const

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

Definition at line 226 of file class_zone.cpp.

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

References GetLayerSet().

◆ DeleteStructure()

void BOARD_ITEM::DeleteStructure ( )
inherited

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

Definition at line 115 of file class_board_item.cpp.

116 {
117  auto parent = GetParent();
118 
119  if( parent )
120  parent->Remove( this );
121 
122  delete this;
123 }
BOARD_ITEM_CONTAINER * GetParent() const

References BOARD_ITEM::GetParent().

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

◆ Duplicate()

virtual BOARD_ITEM* BOARD_ITEM::Duplicate ( ) const
inlinevirtualinherited

Function Duplicate creates a copy of a BOARD_ITEM.

Reimplemented in MODULE.

Definition at line 233 of file class_board_item.h.

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

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

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

◆ FillSegments() [1/2]

ZONE_SEGMENT_FILL& ZONE_CONTAINER::FillSegments ( PCB_LAYER_ID  aLayer)
inline

Definition at line 288 of file class_zone.h.

289  {
290  wxASSERT( m_FillSegmList.count( aLayer ) );
291  return m_FillSegmList.at( aLayer );
292  }
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:909

References m_FillSegmList.

Referenced by PCB_IO::format().

◆ FillSegments() [2/2]

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

Definition at line 294 of file class_zone.h.

295  {
296  wxASSERT( m_FillSegmList.count( aLayer ) );
297  return m_FillSegmList.at( aLayer );
298  }
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:909

References m_FillSegmList.

◆ Flip() [1/2]

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

Definition at line 349 of file class_board_item.h.

350  {
351  Flip( wxPoint( aCentre.x, aCentre.y ), aFlipLeftRight );
352  }
virtual void Flip(const wxPoint &aCentre, bool aFlipLeftRight)
Function Flip Flip this object, i.e.

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

◆ Flip() [2/2]

void ZONE_CONTAINER::Flip ( const wxPoint aCentre,
bool  aFlipLeftRight 
)
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 715 of file class_zone.cpp.

716 {
717  Mirror( aCentre, aFlipLeftRight );
718  int copperLayerCount = GetBoard()->GetCopperLayerCount();
719 
720  if( GetIsRuleArea() )
721  SetLayerSet( FlipLayerMask( GetLayerSet(), copperLayerCount ) );
722  else
723  SetLayer( FlipLayer( GetLayer(), copperLayerCount ) );
724 }
void Mirror(const wxPoint &aMirrorRef, bool aMirrorLeftRight)
Function Mirror Mirror the outlines , relative to a given horizontal axis the layer is not changed.
Definition: class_zone.cpp:727
LSET FlipLayerMask(LSET aMask, int aCopperLayersCount)
Calculate the mask layer when flipping a footprint BACK and FRONT copper layers, mask,...
Definition: lset.cpp:536
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Function FlippedLayerNumber.
Definition: lset.cpp:490
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:214
virtual LSET GetLayerSet() const override
Function GetLayerSet returns a std::bitset of all layers on which the item physically resides.
Definition: class_zone.cpp:287
void SetLayerSet(LSET aLayerSet) override
Definition: class_zone.cpp:242
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Function SetLayer sets the layer this item is on.
Definition: class_zone.cpp:234
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: class_zone.h:724
int GetCopperLayerCount() const
Function GetCopperLayerCount.

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:61
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:53
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:38
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Casts a type to another type.
virtual wxAny getter(void *aObject) const =0
Provides class metadata.
Definition: property_mgr.h:58
virtual size_t OwnerHash() const =0
Returns type-id of the Owner class.

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

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

◆ Get() [2/3]

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

Definition at line 93 of file inspectable.h.

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

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

◆ Get() [3/3]

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

Definition at line 102 of file inspectable.h.

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

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

◆ GetBoard()

BOARD * BOARD_ITEM::GetBoard ( ) const
virtualinherited

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

Definition at line 48 of file class_board_item.cpp.

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

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

Referenced by D_PAD::BuildEffectiveShapes(), BuildSmoothedPoly(), TEXTE_PCB::Flip(), TRACK::Flip(), ARC::Flip(), VIA::Flip(), Flip(), BOARD_ITEM::GetBoard(), MODULE::GetBoundingBox(), MODULE::GetBoundingPoly(), BOARD_CONNECTED_ITEM::GetClearance(), BOARD_CONNECTED_ITEM::GetEffectiveNetclass(), GetInteractingZones(), BOARD_ITEM::GetLayerName(), VIA::GetMinAnnulus(), PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), GetMsgPanelInfo(), TRACK::GetMsgPanelInfo(), NETINFO_ITEM::GetMsgPanelInfo(), D_PAD::GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), GetSelectMenuText(), TEXTE_MODULE::GetShownText(), D_PAD::GetSolderMaskMargin(), D_PAD::GetSolderPasteMargin(), BOARD::GetTrackLength(), TRACK::GetWidthConstraints(), insideArea(), insideCourtyard(), VIA::IsPadOnLayer(), D_PAD::IsPadOnLayer(), BOARD_ITEM::LayerMaskDescribe(), VIA::LayerMaskDescribe(), D_PAD::MergePrimitivesAsPolygon(), EAGLE_PLUGIN::packageWire(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), BOARD_CONNECTED_ITEM::SetNetCode(), setupDummyPadForHole(), TransformSmoothedOutlineWithClearanceToPolygon(), TransformSolidAreasShapesToPolygon(), MODULE::ViewBBox(), and D_PAD::ViewGetLOD().

◆ GetBorderHatchPitch()

int ZONE_CONTAINER::GetBorderHatchPitch ( ) const

HatchBorder related methods.

Function GetBorderHatchPitch

Returns
int - the zone hatch pitch in iu.

Definition at line 869 of file class_zone.cpp.

870 {
871  return m_borderHatchPitch;
872 }
int m_borderHatchPitch
Definition: class_zone.h:930

References m_borderHatchPitch.

Referenced by PCB_IO::format().

◆ GetBoundingBox()

const EDA_RECT ZONE_CONTAINER::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 318 of file class_zone.cpp.

319 {
320  auto bb = m_Poly->BBox();
321 
322  EDA_RECT ret( (wxPoint) bb.GetOrigin(), wxSize( bb.GetWidth(), bb.GetHeight() ) );
323 
324  return ret;
325 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:829
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
const BOX2I BBox(int aClearance=0) const override
Function BBox()

References SHAPE_POLY_SET::BBox(), and m_Poly.

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

◆ GetCachedBoundingBox()

const EDA_RECT ZONE_CONTAINER::GetCachedBoundingBox ( ) const
inline

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

Definition at line 125 of file class_zone.h.

125 { return m_bboxCache; }
EDA_RECT m_bboxCache
Temp variables used while filling.
Definition: class_zone.h:923

References m_bboxCache.

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

◆ GetCenter()

virtual wxPoint BOARD_ITEM::GetCenter ( ) const
inlinevirtualinherited

Function GetCenter()

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

Returns
centre point of the item

Reimplemented in DRAWSEGMENT.

Definition at line 145 of file class_board_item.h.

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

References EDA_ITEM::GetPosition().

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

◆ GetClass()

wxString ZONE_CONTAINER::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Implements EDA_ITEM.

Definition at line 497 of file class_zone.h.

498  {
499  return wxT( "ZONE_CONTAINER" );
500  }

◆ GetClearance()

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

Function GetClearance returns the clearance in internal units.

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

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

Definition at line 84 of file board_connected_item.cpp.

86 {
87  DRC_CONSTRAINT constraint;
88 
89  if( GetBoard() && GetBoard()->GetDesignSettings().m_DRCEngine )
90  {
92 
93  constraint = bds.m_DRCEngine->EvalRulesForItems( DRC_CONSTRAINT_TYPE_CLEARANCE, this,
94  aItem, aLayer );
95  }
96 
97  if( constraint.Value().HasMin() )
98  {
99  if( aSource )
100  *aSource = constraint.GetName();
101 
102  return constraint.Value().Min();
103  }
104 
105  return 0;
106 }
bool HasMin() const
Definition: drc_rule.h:78
MINOPTMAX< int > & Value()
Definition: drc_rule.h:133
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:537
T Min() const
Definition: drc_rule.h:74
wxString GetName() const
Definition: drc_rule.h:138
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
std::shared_ptr< DRC_ENGINE > m_DRCEngine
BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.

References DRC_CONSTRAINT_TYPE_CLEARANCE, 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 ZONE_FILLER::buildCopperItemClearances(), KIGFX::PCB_PAINTER::draw(), GetMsgPanelInfo(), TRACK::GetMsgPanelInfo(), VIA::GetMsgPanelInfo(), D_PAD::GetMsgPanelInfo(), and TRACK::ViewBBox().

◆ GetCornerPosition()

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

Definition at line 544 of file class_zone.h.

545  {
547 
548  // Convert global to relative indices
549  if( !m_Poly->GetRelativeIndices( aCornerIndex, &index ) )
550  throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
551 
552  return m_Poly->CVertex( index );
553  }
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Returns the index-th vertex in a given hole outline within a given outline
Struct VERTEX_INDEX.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:829
bool GetRelativeIndices(int aGlobalIdx, VERTEX_INDEX *aRelativeIndices) const
Function GetRelativeIndices.

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

Referenced by GetPosition().

◆ GetCornerRadius()

unsigned int ZONE_CONTAINER::GetCornerRadius ( ) const
inline

Definition at line 680 of file class_zone.h.

680 { return m_cornerRadius; }
unsigned int m_cornerRadius
Definition: class_zone.h:831

References m_cornerRadius.

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

◆ GetCornerSmoothingType()

int ZONE_CONTAINER::GetCornerSmoothingType ( ) const
inline

◆ GetDefaultHatchPitch()

◆ GetDoNotAllowCopperPour()

bool ZONE_CONTAINER::GetDoNotAllowCopperPour ( ) const
inline

◆ GetDoNotAllowFootprints()

bool ZONE_CONTAINER::GetDoNotAllowFootprints ( ) const
inline

◆ GetDoNotAllowPads()

bool ZONE_CONTAINER::GetDoNotAllowPads ( ) const
inline

◆ GetDoNotAllowTracks()

bool ZONE_CONTAINER::GetDoNotAllowTracks ( ) const
inline

◆ GetDoNotAllowVias()

bool ZONE_CONTAINER::GetDoNotAllowVias ( ) const
inline

◆ GetEditFlags()

STATUS_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 237 of file base_struct.h.

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

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

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

◆ GetEffectiveNetclass()

NETCLASS * BOARD_CONNECTED_ITEM::GetEffectiveNetclass ( ) const
inherited

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

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

Definition at line 65 of file board_connected_item.cpp.

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

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

◆ GetEffectiveShape()

std::shared_ptr< SHAPE > ZONE_CONTAINER::GetEffectiveShape ( PCB_LAYER_ID  aLayer = UNDEFINED_LAYER) const
overridevirtual

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

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

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

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

Reimplemented from BOARD_ITEM.

Definition at line 1323 of file class_zone.cpp.

1324 {
1325  std::shared_ptr<SHAPE> shape;
1326 
1327  if( m_FilledPolysList.find( aLayer ) == m_FilledPolysList.end() )
1328  {
1329  shape.reset( new SHAPE_NULL );
1330  }
1331  else
1332  {
1333  shape.reset( m_FilledPolysList.at( aLayer ).Clone() );
1334  }
1335 
1336  return shape;
1337 }
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:919

References m_FilledPolysList.

◆ GetFilledArea()

double ZONE_CONTAINER::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 198 of file class_zone.h.

199  {
200  return m_area;
201  }

References m_area.

◆ GetFilledPolysList()

const SHAPE_POLY_SET& ZONE_CONTAINER::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 627 of file class_zone.h.

628  {
629  wxASSERT( m_FilledPolysList.count( aLayer ) );
630  return m_FilledPolysList.at( aLayer );
631  }
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:919

References m_FilledPolysList.

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

◆ GetFilledPolysUseThickness()

◆ GetFillFlag()

int ZONE_CONTAINER::GetFillFlag ( PCB_LAYER_ID  aLayer)
inline

Definition at line 208 of file class_zone.h.

209  {
210  return m_fillFlags.count( aLayer ) ? m_fillFlags[ aLayer ] : false;
211  }
std::map< PCB_LAYER_ID, bool > m_fillFlags
Definition: class_zone.h:924

References m_fillFlags.

◆ GetFillMode()

ZONE_FILL_MODE ZONE_CONTAINER::GetFillMode ( ) const
inline

Definition at line 163 of file class_zone.h.

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

References m_fillMode.

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

◆ GetFillVersion()

int ZONE_CONTAINER::GetFillVersion ( ) const
inline

Definition at line 684 of file class_zone.h.

684 { return m_fillVersion; }

References m_fillVersion.

◆ GetFlags()

◆ GetFocusPosition()

virtual const wxPoint EDA_ITEM::GetFocusPosition ( ) const
inlinevirtualinherited

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

Reimplemented in DRAWSEGMENT, and TRACK.

Definition at line 345 of file base_struct.h.

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

References EDA_ITEM::GetPosition().

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

◆ GetGroup()

const KIID& BOARD_ITEM::GetGroup ( ) const
inlineinherited

Get the group this item belongs to.

Returns
the group this item is in

Definition at line 114 of file class_board_item.h.

114 { return m_groupUuid; }

References BOARD_ITEM::m_groupUuid.

◆ GetHashValue()

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

Definition at line 800 of file class_zone.h.

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

References m_filledPolysHash.

◆ GetHatchBorderAlgorithm()

int ZONE_CONTAINER::GetHatchBorderAlgorithm ( ) const
inline

◆ GetHatchGap()

int ZONE_CONTAINER::GetHatchGap ( ) const
inline

Definition at line 236 of file class_zone.h.

236 { return m_hatchGap; }

References m_hatchGap.

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

◆ GetHatchHoleMinArea()

double ZONE_CONTAINER::GetHatchHoleMinArea ( ) const
inline

Definition at line 248 of file class_zone.h.

248 { return m_hatchHoleMinArea; }
double m_hatchHoleMinArea
Definition: class_zone.h:897

References m_hatchHoleMinArea.

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

◆ GetHatchLines()

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

Definition at line 792 of file class_zone.h.

792 { return m_borderHatchLines; }
std::vector< SEG > m_borderHatchLines
Definition: class_zone.h:931

References m_borderHatchLines.

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

◆ GetHatchOrientation()

double ZONE_CONTAINER::GetHatchOrientation ( ) const
inline

Definition at line 239 of file class_zone.h.

239 { return m_hatchOrientation; }
double m_hatchOrientation
Definition: class_zone.h:891

References m_hatchOrientation.

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

◆ GetHatchSmoothingLevel()

int ZONE_CONTAINER::GetHatchSmoothingLevel ( ) const
inline

◆ GetHatchSmoothingValue()

double ZONE_CONTAINER::GetHatchSmoothingValue ( ) const
inline

◆ GetHatchStyle()

ZONE_BORDER_DISPLAY_STYLE ZONE_CONTAINER::GetHatchStyle ( ) const
inline

Definition at line 592 of file class_zone.h.

592 { return m_borderStyle; }
ZONE_BORDER_DISPLAY_STYLE m_borderStyle
Definition: class_zone.h:929

References m_borderStyle.

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

◆ GetHatchThickness()

int ZONE_CONTAINER::GetHatchThickness ( ) const
inline

Definition at line 233 of file class_zone.h.

233 { return m_hatchThickness; }
int m_hatchThickness
Definition: class_zone.h:889

References m_hatchThickness.

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

◆ GetHV45()

bool ZONE_CONTAINER::GetHV45 ( ) const
inline

Definition at line 794 of file class_zone.h.

794 { return m_hv45; }

References m_hv45.

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

◆ GetInteractingZones()

void ZONE_CONTAINER::GetInteractingZones ( PCB_LAYER_ID  aLayer,
std::vector< ZONE_CONTAINER * > *  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 1120 of file class_zone.cpp.

1122 {
1123  int epsilon = Millimeter2iu( 0.001 );
1124 
1125  for( ZONE_CONTAINER* candidate : GetBoard()->Zones() )
1126  {
1127  if( candidate == this )
1128  continue;
1129 
1130  if( !candidate->GetLayerSet().test( aLayer ) )
1131  continue;
1132 
1133  if( candidate->GetIsRuleArea() )
1134  continue;
1135 
1136  if( candidate->GetNetCode() != GetNetCode() )
1137  continue;
1138 
1139  for( auto iter = m_Poly->CIterate(); iter; iter++ )
1140  {
1141  if( candidate->m_Poly->Collide( iter.Get(), epsilon ) )
1142  {
1143  aZones->push_back( candidate );
1144  break;
1145  }
1146  }
1147  }
1148 }
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
int GetNetCode() const
Function GetNetCode.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:829
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
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_CONTAINER::GetIslandRemovalMode ( ) const
inline

Definition at line 738 of file class_zone.h.

738 { return m_islandRemovalMode; }
ISLAND_REMOVAL_MODE m_islandRemovalMode
Definition: class_zone.h:863

References m_islandRemovalMode.

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

◆ GetIsRuleArea()

◆ GetLayer()

PCB_LAYER_ID ZONE_CONTAINER::GetLayer ( ) const
overridevirtual

Function GetLayer returns the primary layer this item is on.

Reimplemented from BOARD_ITEM.

Definition at line 214 of file class_zone.cpp.

215 {
216  return BOARD_ITEM::GetLayer();
217 }
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.

References BOARD_ITEM::GetLayer().

Referenced by BOARD::Add(), DRAWING_TOOL::DrawVia(), DRAWING_TOOL::DrawZone(), PCB_EDIT_FRAME::Edit_Zone_Params(), Flip(), DSN::SPECCTRA_DB::FromBOARD(), GetMsgPanelInfo(), HatchBorder(), BOARD::NormalizeAreaPolygon(), BRDITEMS_PLOTTER::PlotFilledAreas(), BOARD::TestAreaIntersection(), TransformSmoothedOutlineWithClearanceToPolygon(), and PCB_EDITOR_CONTROL::ZoneMerge().

◆ GetLayerName()

wxString BOARD_ITEM::GetLayerName ( ) const
inherited

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

Returns
wxString containing the layer name associated with this item.

Definition at line 62 of file class_board_item.cpp.

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

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

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

◆ GetLayerSet()

LSET ZONE_CONTAINER::GetLayerSet ( ) const
overridevirtual

Function GetLayerSet returns a std::bitset of all layers on which the item physically resides.

Reimplemented from BOARD_ITEM.

Definition at line 287 of file class_zone.cpp.

288 {
289  return m_layerSet;
290 }

References m_layerSet.

Referenced by BOARD::CombineAllAreasInNet(), CommonLayerExists(), Flip(), PCB_IO::format(), InitDataFromSrcInCopyCtor(), IsSame(), ZONE_SETTINGS::operator<<(), SaveCopyOfZones(), SELECTION_TOOL::Selectable(), PNS_KICAD_IFACE_BASE::syncZone(), and BOARD::TestAreaIntersections().

◆ GetLocalClearance() [1/2]

int ZONE_CONTAINER::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 460 of file class_zone.cpp.

461 {
462  if( m_isRuleArea )
463  return 0;
464 
465  if( aSource )
466  *aSource = _( "zone" );
467 
468  return m_ZoneClearance;
469 }
#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<<(), PCB_INSPECTION_TOOL::reportZoneConnection(), and BOARD::TestAreaIntersections().

◆ GetLocalClearance() [2/2]

int ZONE_CONTAINER::GetLocalClearance ( ) const
inline

Definition at line 137 of file class_zone.h.

137 { return GetLocalClearance( nullptr ); }
int GetLocalClearance() const
Definition: class_zone.h:137

References GetLocalClearance().

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

◆ GetLocalClearanceOverrides()

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

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

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

Reimplemented in D_PAD.

Definition at line 179 of file board_connected_item.h.

179 { return 0; }

Referenced by DRC_ENGINE::EvalRulesForItems().

◆ GetLocalFlags()

int ZONE_CONTAINER::GetLocalFlags ( ) const
inline

Definition at line 285 of file class_zone.h.

285 { return m_localFlgs; }

References m_localFlgs.

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

◆ GetLocalRatsnestVisible()

bool BOARD_CONNECTED_ITEM::GetLocalRatsnestVisible ( ) const
inlineinherited

Definition at line 223 of file board_connected_item.h.

224  {
225  return m_localRatsnestVisible;
226  }

References BOARD_CONNECTED_ITEM::m_localRatsnestVisible.

Referenced by PCB_EDIT_FRAME::Exchange_Module().

◆ GetLock()

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

Definition at line 203 of file class_zone.h.

204  {
205  return m_lock;
206  }
std::mutex m_lock
Lock used for multi-threaded filling on multi-layer zones.
Definition: class_zone.h:941

References m_lock.

Referenced by ZONE_FILLER::Fill().

◆ GetMenuImage()

BITMAP_DEF ZONE_CONTAINER::GetMenuImage ( ) const
overridevirtual

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

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

Returns
The menu image associated with the item.

Reimplemented from EDA_ITEM.

Definition at line 1079 of file class_zone.cpp.

1080 {
1081  return add_zone_xpm;
1082 }
const BITMAP_OPAQUE add_zone_xpm[1]
Definition: add_zone.cpp:74

References add_zone_xpm.

◆ GetMinIslandArea()

long long int ZONE_CONTAINER::GetMinIslandArea ( ) const
inline

Definition at line 742 of file class_zone.h.

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

References m_minIslandArea.

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

◆ GetMinThickness()

◆ GetMsgPanelInfo()

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

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

Parameters
aListis the list to populate.

Reimplemented from EDA_ITEM.

Definition at line 513 of file class_zone.cpp.

514 {
515  EDA_UNITS units = aFrame->GetUserUnits();
516  wxString msg, msg2;
517 
518  if( GetIsRuleArea() )
519  msg = _( "Rule Area" );
520  else if( IsOnCopperLayer() )
521  msg = _( "Copper Zone" );
522  else
523  msg = _( "Non-copper Zone" );
524 
525  // Display Cutout instead of Outline for holes inside a zone (i.e. when num contour !=0).
526  // Check whether the selected corner is in a hole; i.e., in any contour but the first one.
527  if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
528  msg << wxT( " " ) << _( "Cutout" );
529 
530  aList.emplace_back( _( "Type" ), msg, DARKCYAN );
531 
532  if( GetIsRuleArea() )
533  {
534  msg.Empty();
535 
536  if( GetDoNotAllowVias() )
537  AccumulateDescription( msg, _( "No vias" ) );
538 
539  if( GetDoNotAllowTracks() )
540  AccumulateDescription( msg, _( "No tracks" ) );
541 
542  if( GetDoNotAllowPads() )
543  AccumulateDescription( msg, _( "No pads" ) );
544 
546  AccumulateDescription( msg, _( "No copper zones" ) );
547 
549  AccumulateDescription( msg, _( "No footprints" ) );
550 
551  if( !msg.IsEmpty() )
552  aList.emplace_back( MSG_PANEL_ITEM( _( "Restrictions" ), msg, RED ) );
553  }
554  else if( IsOnCopperLayer() )
555  {
556  if( GetNetCode() >= 0 )
557  {
558  NETINFO_ITEM* net = GetNet();
559  NETCLASS* netclass = nullptr;
560 
561  if( net )
562  {
563  if( net->GetNet() )
564  netclass = GetNetClass();
565  else
566  netclass = GetBoard()->GetDesignSettings().GetDefault();
567 
568  msg = UnescapeString( net->GetNetname() );
569  }
570  else
571  {
572  msg = wxT( "<no name>" );
573  }
574 
575  aList.emplace_back( _( "Net" ), msg, RED );
576 
577  if( netclass )
578  aList.emplace_back( _( "NetClass" ), netclass->GetName(), DARKMAGENTA );
579  }
580 
581  // Display priority level
582  msg.Printf( wxT( "%d" ), GetPriority() );
583  aList.emplace_back( _( "Priority" ), msg, BLUE );
584  }
585 
586  wxString layerDesc;
587  int count = 0;
588 
589  for( PCB_LAYER_ID layer : m_layerSet.Seq() )
590  {
591  if( count == 0 )
592  layerDesc = GetBoard()->GetLayerName( layer );
593 
594  count++;
595  }
596 
597  if( count > 1 )
598  layerDesc.Printf( _( "%s and %d more" ), layerDesc, count - 1 );
599 
600  aList.emplace_back( _( "Layer" ), layerDesc, DARKGREEN );
601 
602  if( !m_zoneName.empty() )
603  aList.emplace_back( _( "Name" ), m_zoneName, DARKMAGENTA );
604 
605  switch( m_fillMode )
606  {
607  case ZONE_FILL_MODE::POLYGONS: msg = _( "Solid" ); break;
608  case ZONE_FILL_MODE::HATCH_PATTERN: msg = _( "Hatched" ); break;
609  default: msg = _( "Unknown" ); break;
610  }
611 
612  aList.emplace_back( _( "Fill Mode" ), msg, BROWN );
613 
614  msg = MessageTextFromValue( units, m_area, false, EDA_DATA_TYPE::AREA );
615  aList.emplace_back( _( "Filled Area" ), msg, BLUE );
616 
617  wxString source;
618  int clearance = GetClearance( GetLayer(), nullptr, &source );
619 
620  msg.Printf( _( "Min Clearance: %s" ), MessageTextFromValue( units, clearance, true ) );
621  msg2.Printf( _( "(from %s)" ), source );
622  aList.emplace_back( msg, msg2, BLACK );
623 
624  // Useful for statistics, especially when zones are complex the number of hatches
625  // and filled polygons can explain the display and DRC calculation time:
626  msg.Printf( wxT( "%d" ), (int) m_borderHatchLines.size() );
627  aList.emplace_back( MSG_PANEL_ITEM( _( "HatchBorder Lines" ), msg, BLUE ) );
628 
629  PCB_LAYER_ID layer = m_Layer;
630 
631  // NOTE: This brings in dependence on PCB_EDIT_FRAME to the qa tests, which isn't ideal.
632  // TODO: Figure out a way for items to know the active layer without the whole edit frame?
633 #if 0
634  if( PCB_EDIT_FRAME* pcbframe = dynamic_cast<PCB_EDIT_FRAME*>( aFrame ) )
635  if( m_FilledPolysList.count( pcbframe->GetActiveLayer() ) )
636  layer = pcbframe->GetActiveLayer();
637 #endif
638  auto layer_it = m_FilledPolysList.find( layer );
639 
640  if( layer_it == m_FilledPolysList.end() )
641  layer_it = m_FilledPolysList.begin();
642 
643  if( layer_it != m_FilledPolysList.end() )
644  {
645  msg.Printf( wxT( "%d" ), layer_it->second.TotalVertices() );
646  aList.emplace_back( MSG_PANEL_ITEM( _( "Corner Count" ), msg, BLUE ) );
647  }
648 }
EDA_UNITS
Definition: common.h:198
bool GetDoNotAllowPads() const
Definition: class_zone.h:728
std::vector< SEG > m_borderHatchLines
Definition: class_zone.h:931
int GetNetCode() const
Function GetNetCode.
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer.
NETINFO_ITEM * GetNet() const
Function GetNet Returns NET_INFO object for a given item.
const wxString & GetName() const
Definition: netclass.h:96
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: class_zone.h:902
NETCLASS * GetNetClass() const
Function GetNetClassPtr returns the NETCLASS for this item.
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:214
Definition: color4d.h:61
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:537
Definition: color4d.h:44
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Function Seq returns an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:380
bool GetDoNotAllowVias() const
Definition: class_zone.h:726
PCB_LAYER_ID m_Layer
virtual int GetClearance(PCB_LAYER_ID aLayer, BOARD_ITEM *aItem=nullptr, wxString *aSource=nullptr) const
Function GetClearance returns the clearance in internal units.
wxString m_zoneName
An optional unique name for this zone, used for identifying it in DRC checking.
Definition: class_zone.h:834
PCB_LAYER_ID
A quick note on layer IDs:
NETCLASS handles a collection of nets and the parameters used to route or test these nets.
Definition: netclass.h:49
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
bool GetDoNotAllowCopperPour() const
Definition: class_zone.h:725
const wxString & GetNetname() const
Function GetNetname.
Definition: netinfo.h:231
Definition: color4d.h:59
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: class_zone.h:724
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aUseMils, EDA_DATA_TYPE aType)
Definition: base_units.cpp:124
void AccumulateDescription(wxString &aDesc, const wxString &aItem)
Utility to build comma separated lists in messages.
Definition: macros.h:126
NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
Definition: color4d.h:56
unsigned GetPriority() const
Function GetPriority.
Definition: class_zone.h:106
int GetNet() const
Function GetNet.
Definition: netinfo.h:223
#define _(s)
Definition: 3d_actions.cpp:33
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:152
NETCLASS * GetDefault() const
Function GetDefault.
PCB_EDIT_FRAME is the main frame for Pcbnew.
bool GetDoNotAllowTracks() const
Definition: class_zone.h:727
bool GetDoNotAllowFootprints() const
Definition: class_zone.h:729
EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
ZONE_FILL_MODE m_fillMode
How to fill areas: ZONE_FILL_MODE::POLYGONS => use solid polygons ZONE_FILL_MODE::HATCH_PATTERN => us...
Definition: class_zone.h:888
bool IsOnCopperLayer() const override
Function IsOnCopperLayer.
Definition: class_zone.cpp:220
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:919

References _, AccumulateDescription(), AREA, BLACK, BLUE, BROWN, DARKCYAN, DARKGREEN, DARKMAGENTA, BOARD_ITEM::GetBoard(), BOARD_CONNECTED_ITEM::GetClearance(), BOARD_DESIGN_SETTINGS::GetDefault(), BOARD::GetDesignSettings(), GetDoNotAllowCopperPour(), GetDoNotAllowFootprints(), GetDoNotAllowPads(), GetDoNotAllowTracks(), GetDoNotAllowVias(), GetIsRuleArea(), GetLayer(), BOARD::GetLayerName(), NETCLASS::GetName(), BOARD_CONNECTED_ITEM::GetNet(), NETINFO_ITEM::GetNet(), BOARD_CONNECTED_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetNetCode(), NETINFO_ITEM::GetNetname(), 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, RED, LSET::Seq(), and UnescapeString().

◆ GetNet()

NETINFO_ITEM* BOARD_CONNECTED_ITEM::GetNet ( ) const
inlineinherited

Function GetNet Returns NET_INFO object for a given item.

Definition at line 82 of file board_connected_item.h.

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

References BOARD_CONNECTED_ITEM::m_netinfo.

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

◆ GetNetClass()

NETCLASS * BOARD_CONNECTED_ITEM::GetNetClass ( ) const
inherited

Function GetNetClassPtr returns the NETCLASS for this item.

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

Definition at line 111 of file board_connected_item.cpp.

112 {
113  NETCLASS* netclass = m_netinfo->GetNetClass();
114 
115  if( netclass )
116  return netclass;
117  else
118  return GetBoard()->GetDesignSettings().GetDefault();
119 }
NETCLASS * GetNetClass()
Function GetNetClass.
Definition: netinfo.h:128
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:537
NETCLASS handles a collection of nets and the parameters used to route or test these nets.
Definition: netclass.h:49
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.
NETCLASS * GetDefault() const
Function GetDefault.

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

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

◆ GetNetClassName()

wxString BOARD_CONNECTED_ITEM::GetNetClassName ( ) const
inherited

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

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

Returns
the Net Class name of this item

Definition at line 122 of file board_connected_item.cpp.

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

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

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

◆ GetNetCode()

int BOARD_CONNECTED_ITEM::GetNetCode ( ) const
inlineinherited

Function GetNetCode.

Returns
int - the net code.

Definition at line 100 of file board_connected_item.h.

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

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

Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), BOARD_CONNECTED_ITEM_DESC::BOARD_CONNECTED_ITEM_DESC(), ZONE_FILLER::buildCopperItemClearances(), BOARD::CombineAllAreasInNet(), connectedItemFilter(), CreateRoutesSection(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::doPadToPadsDrc(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::doTrackDrc(), KIGFX::PCB_PAINTER::draw(), DRAWING_TOOL::DrawVia(), PCB_EDIT_FRAME::Exchange_Module(), 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(), GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), hash_eda(), hasThermalConnection(), DIALOG_PAD_PROPERTIES::initValues(), PCB_INSPECTION_TOOL::InspectClearance(), IsIsland(), IsSame(), DSN::SPECCTRA_DB::makeIMAGE(), AR_AUTOPLACER::nearestPad(), ROUTER_TOOL::NeighboringSegmentFilter(), CN_ITEM::Net(), BOARD::NormalizeAreaPolygon(), BOARD::OnAreaPolygonModified(), TRACK::cmp_tracks::operator()(), ZONE_SETTINGS::operator<<(), DIALOG_PAD_PROPERTIES::PadTypeSelected(), process(), PCB_SELECTION_CONDITIONS::sameNetFunc(), SaveCopyOfZones(), SELECTION_TOOL::selectNet(), setupDummyPadForHole(), PNS_KICAD_IFACE_BASE::syncArc(), PNS_KICAD_IFACE_BASE::syncPad(), PNS_KICAD_IFACE_BASE::syncTrack(), PNS_KICAD_IFACE_BASE::syncVia(), BOARD::TestAreaIntersections(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZones(), BOARD::TracksInNet(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), and PCB_EDITOR_CONTROL::ZoneMerge().

◆ GetNetname()

wxString BOARD_CONNECTED_ITEM::GetNetname ( ) const
inlineinherited

◆ GetNetnameMsg()

wxString BOARD_CONNECTED_ITEM::GetNetnameMsg ( ) const
inlineinherited

Function GetNetnameMsg.

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

Definition at line 135 of file board_connected_item.h.

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

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_CONTAINER::GetNumCorners ( void  ) const
inline

Access to m_Poly parameters.

Definition at line 504 of file class_zone.h.

505  {
506  return m_Poly->TotalVertices();
507  }
int TotalVertices() const
Returns total number of vertices stored in the set.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:829

References m_Poly, and SHAPE_POLY_SET::TotalVertices().

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

◆ GetPadConnection() [1/2]

ZONE_CONNECTION ZONE_CONTAINER::GetPadConnection ( D_PAD aPad,
wxString *  aSource = nullptr 
) const

Definition at line 756 of file class_zone.cpp.

757 {
759  {
760  if( aSource )
761  *aSource = _( "zone" );
762 
763  return m_PadConnection;
764  }
765  else
766  {
767  return aPad->GetEffectiveZoneConnection( aSource );
768  }
769 }
ZONE_CONNECTION m_PadConnection
Definition: class_zone.h:858
#define NULL
ZONE_CONNECTION GetEffectiveZoneConnection(wxString *aSource=nullptr) const
Return the zone connection in effect (either locally overridden or overridden in the parent module).
Definition: class_pad.cpp:734
#define _(s)
Definition: 3d_actions.cpp:33

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

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

◆ GetPadConnection() [2/2]

ZONE_CONNECTION ZONE_CONTAINER::GetPadConnection ( ) const
inline

Definition at line 221 of file class_zone.h.

221 { return m_PadConnection; }
ZONE_CONNECTION m_PadConnection
Definition: class_zone.h:858

References m_PadConnection.

Referenced by ZONE_CONTAINER_DESC::ZONE_CONTAINER_DESC().

◆ GetParent()

BOARD_ITEM_CONTAINER* BOARD_ITEM::GetParent ( void  ) const
inlineinherited

Definition at line 197 of file class_board_item.h.

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

References EDA_ITEM::m_Parent.

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

◆ GetPosition()

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

Reimplemented from EDA_ITEM.

Definition at line 208 of file class_zone.cpp.

209 {
210  return (wxPoint) GetCornerPosition( 0 );
211 }
const VECTOR2I & GetCornerPosition(int aCornerIndex) const
Definition: class_zone.h:544

References GetCornerPosition().

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

◆ GetPriority()

◆ GetSelectedCorner()

int ZONE_CONTAINER::GetSelectedCorner ( ) const
inline

Definition at line 254 of file class_zone.h.

255  {
256  // Transform relative indices to global index
257  int globalIndex = -1;
258 
259  if( m_CornerSelection )
260  m_Poly->GetGlobalIndex( *m_CornerSelection, globalIndex );
261 
262  return globalIndex;
263  }
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: class_zone.h:902
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:829
bool GetGlobalIndex(VERTEX_INDEX aRelativeIndices, int &aGlobalIdx)
Function GetGlobalIndex computes the global index of a vertex from the relative indices of polygon,...

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

◆ GetSelectMenuText()

wxString ZONE_CONTAINER::GetSelectMenuText ( EDA_UNITS  aUnits) const
overridevirtual

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

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

Returns
The menu text string.

Reimplemented from EDA_ITEM.

Definition at line 838 of file class_zone.cpp.

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

Function GetShortNetname.

Returns
wxString - the short netname

Definition at line 154 of file board_connected_item.h.

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

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

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

◆ GetState()

int EDA_ITEM::GetState ( int  type) const
inlineinherited

Definition at line 216 of file base_struct.h.

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

References EDA_ITEM::m_Status.

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

◆ GetStatus()

STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 229 of file base_struct.h.

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

References EDA_ITEM::m_Status.

◆ GetThermalReliefGap() [1/2]

◆ GetThermalReliefGap() [2/2]

int ZONE_CONTAINER::GetThermalReliefGap ( D_PAD aPad,
wxString *  aSource = nullptr 
) const

Definition at line 328 of file class_zone.cpp.

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

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

◆ GetThermalReliefSpokeWidth() [1/2]

int ZONE_CONTAINER::GetThermalReliefSpokeWidth ( ) const
inline

◆ GetThermalReliefSpokeWidth() [2/2]

int ZONE_CONTAINER::GetThermalReliefSpokeWidth ( D_PAD aPad,
wxString *  aSource = nullptr 
) const

Definition at line 343 of file class_zone.cpp.

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

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

◆ GetX()

int BOARD_ITEM::GetX ( ) const
inlineinherited

◆ GetY()

int BOARD_ITEM::GetY ( ) const
inlineinherited

◆ GetZoneName()

wxString ZONE_CONTAINER::GetZoneName ( ) const
inline

Definition at line 113 of file class_zone.h.

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

References m_zoneName.

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

◆ HasFilledPolysForLayer()

bool ZONE_CONTAINER::HasFilledPolysForLayer ( PCB_LAYER_ID  aLayer) const
inline

Definition at line 617 of file class_zone.h.

618  {
619  return m_FilledPolysList.count( aLayer ) > 0;
620  }
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:919

References m_FilledPolysList.

Referenced by DRC_TEST_PROVIDER_CLEARANCE_BASE::getLocation().

◆ HasFlag()

◆ HatchBorder()

void ZONE_CONTAINER::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 906 of file class_zone.cpp.

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

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 BOARD::CombineAreas(), CONVERT_TOOL::LinesToPoly(), Mirror(), Move(), MoveEdge(), BOARD::NormalizeAreaPolygon(), EDIT_TOOL::Remove(), Rotate(), SetBorderDisplayStyle(), and POINT_EDITOR::updateItem().

◆ HitTest() [1/2]

bool ZONE_CONTAINER::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 366 of file class_zone.cpp.

367 {
368  // Normally accuracy is zoom-relative, but for the generic HitTest we just use
369  // a fixed (small) value.
370  int accuracy = std::max( aAccuracy, Millimeter2iu( 0.1 ) );
371 
372  return HitTestForCorner( aPosition, accuracy * 2 ) || HitTestForEdge( aPosition, accuracy );
373 }
bool HitTestForCorner(const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
Function HitTestForCorner tests if the given wxPoint is near a corner.
Definition: class_zone.cpp:391
bool HitTestForEdge(const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
Function HitTestForEdge tests if the given wxPoint is near a segment defined by 2 corners.
Definition: class_zone.cpp:405
static constexpr int Millimeter2iu(double mm)

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

◆ HitTest() [2/2]

bool ZONE_CONTAINER::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 419 of file class_zone.cpp.

420 {
421  // Calculate bounding box for zone
422  EDA_RECT bbox = GetBoundingBox();
423  bbox.Normalize();
424 
425  EDA_RECT arect = aRect;
426  arect.Normalize();
427  arect.Inflate( aAccuracy );
428 
429  if( aContained )
430  {
431  return arect.Contains( bbox );
432  }
433  else
434  {
435  // Fast test: if aBox is outside the polygon bounding box, rectangles cannot intersect
436  if( !arect.Intersects( bbox ) )
437  return false;
438 
439  int count = m_Poly->TotalVertices();
440 
441  for( int ii = 0; ii < count; ii++ )
442  {
443  auto vertex = m_Poly->CVertex( ii );
444  auto vertexNext = m_Poly->CVertex( ( ii + 1 ) % count );
445 
446  // Test if the point is within the rect
447  if( arect.Contains( ( wxPoint ) vertex ) )
448  return true;
449 
450  // Test if this edge intersects the rect
451  if( arect.Intersects( ( wxPoint ) vertex, ( wxPoint ) vertexNext ) )
452  return true;
453  }
454 
455  return false;
456  }
457 }
int TotalVertices() const
Returns total number of vertices stored in the set.
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox (virtual)
Definition: class_zone.cpp:318
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Returns the index-th vertex in a given hole outline within a given outline
bool Contains(const wxPoint &aPoint) const
Function Contains.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:829
void Normalize()
Function Normalize ensures that the height ant width are positive.
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.

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

◆ HitTestCutout() [1/2]

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

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 488 of file class_zone.cpp.

489 {
490  // Iterate over each outline polygon in the zone and then iterate over
491  // each hole it has to see if the point is in it.
492  for( int i = 0; i < m_Poly->OutlineCount(); i++ )
493  {
494  for( int j = 0; j < m_Poly->HoleCount( i ); j++ )
495  {
496  if( m_Poly->Hole( i, j ).PointInside( aRefPos ) )
497  {
498  if( aOutlineIdx )
499  *aOutlineIdx = i;
500 
501  if( aHoleIdx )
502  *aHoleIdx = j;
503 
504  return true;
505  }
506  }
507  }
508 
509  return false;
510 }
int OutlineCount() const
Returns the number of outlines in the set
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Returns the reference to aHole-th hole in the aIndex-th outline
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:829
bool PointInside(const VECTOR2I &aPt, int aAccuracy=0, bool aUseBBoxCache=false) const
Function PointInside()
int HoleCount(int aOutline) const
Returns the number of holes in a given outline

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_CONTAINER::HitTestCutout ( const wxPoint aRefPos,
int *  aOutlineIdx = nullptr,
int *  aHoleIdx = nullptr 
) const
inline

Definition at line 337 of file class_zone.h.

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

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

◆ HitTestFilledArea()

bool ZONE_CONTAINER::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 472 of file class_zone.cpp.

474 {
475  // Rule areas have no filled area, but it's generally nice to treat their interior as if it were
476  // filled so that people don't have to select them by their outline (which is min-width)
477  if( GetIsRuleArea() )
478  return m_Poly->Contains( VECTOR2I( aRefPos.x, aRefPos.y ), -1, aAccuracy );
479 
480  if( !m_FilledPolysList.count( aLayer ) )
481  return false;
482 
483  return m_FilledPolysList.at( aLayer ).Contains( VECTOR2I( aRefPos.x, aRefPos.y ), -1,
484  aAccuracy );
485 }
bool Contains(const VECTOR2I &aP, int aSubpolyIndex=-1, int aAccuracy=0, bool aUseBBoxCaches=false) const
Returns true if a given subpolygon contains the point aP.
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:829
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: class_zone.h:724
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:919

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

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

◆ HitTestForCorner() [1/2]

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

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 391 of file class_zone.cpp.

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

References SHAPE_POLY_SET::CollideVertex(), and m_Poly.

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

◆ HitTestForCorner() [2/2]

bool ZONE_CONTAINER::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 398 of file class_zone.cpp.

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

References dummy(), and HitTestForCorner().

◆ HitTestForEdge() [1/2]

bool ZONE_CONTAINER::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 405 of file class_zone.cpp.

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

References SHAPE_POLY_SET::CollideEdge(), and m_Poly.

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

◆ HitTestForEdge() [2/2]

bool ZONE_CONTAINER::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 412 of file class_zone.cpp.

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

References dummy(), and HitTestForEdge().

◆ InitDataFromSrcInCopyCtor()

void ZONE_CONTAINER::InitDataFromSrcInCopyCtor ( const ZONE_CONTAINER aZone)

Copy aZone data to me.

Definition at line 104 of file class_zone.cpp.

105 {
106  // members are expected non initialize in this.
107  // InitDataFromSrcInCopyCtor() is expected to be called
108  // only from a copy constructor.
109 
110  // Copy only useful EDA_ITEM flags:
111  m_Flags = aZone.m_Flags;
113 
114  // Replace the outlines for aZone outlines.
115  delete m_Poly;
116  m_Poly = new SHAPE_POLY_SET( *aZone.m_Poly );
117 
120  m_zoneName = aZone.m_zoneName;
121  SetLayerSet( aZone.GetLayerSet() );
122  m_priority = aZone.m_priority;
123  m_isRuleArea = aZone.m_isRuleArea;
124 
130 
132  m_ZoneClearance = aZone.m_ZoneClearance; // clearance value
137 
138  m_isFilled = aZone.m_isFilled;
139  m_needRefill = aZone.m_needRefill;
140 
143 
144  m_fillMode = aZone.m_fillMode; // solid vs. hatched
146  m_hatchGap = aZone.m_hatchGap;
152 
153  // For corner moving, corner index to drag, or nullptr if no selection
154  delete m_CornerSelection;
155  m_CornerSelection = nullptr;
156 
157  for( PCB_LAYER_ID layer : aZone.GetLayerSet().Seq() )
158  {
159  m_FilledPolysList[layer] = aZone.m_FilledPolysList.at( layer );
160  m_RawPolysList[layer] = aZone.m_RawPolysList.at( layer );
161  m_filledPolysHash[layer] = aZone.m_filledPolysHash.at( layer );
162  m_FillSegmList[layer] = aZone.m_FillSegmList.at( layer ); // vector <> copy
163  m_insulatedIslands[layer] = aZone.m_insulatedIslands.at( layer );
164  }
165 
169 
170  SetLocalFlags( aZone.GetLocalFlags() );
171 
172  m_netinfo = aZone.m_netinfo;
173 
174  m_hv45 = aZone.m_hv45;
175  m_area = aZone.m_area;
176 }
bool m_isFilled
True when a zone was filled, false after deleting the filled areas.
Definition: class_zone.h:872
int m_hatchBorderAlgorithm
Definition: class_zone.h:898
std::vector< SEG > m_borderHatchLines
Definition: class_zone.h:931
double m_hatchSmoothingValue
Definition: class_zone.h:896
ISLAND_REMOVAL_MODE m_islandRemovalMode
Definition: class_zone.h:863
bool m_doNotAllowPads
Definition: class_zone.h:855
bool m_doNotAllowTracks
Definition: class_zone.h:854
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: class_zone.h:902
int m_thermalReliefGap
Definition: class_zone.h:880
long long int m_minIslandArea
When island removal mode is set to AREA, islands below this area will be removed.
Definition: class_zone.h:869
int m_thermalReliefSpokeWidth
Definition: class_zone.h:881
std::map< PCB_LAYER_ID, std::set< int > > m_insulatedIslands
For each layer, a set of insulated islands that were not removed.
Definition: class_zone.h:934
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Function Seq returns an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:380
bool m_doNotAllowFootprints
Definition: class_zone.h:856
ZONE_BORDER_DISPLAY_STYLE m_borderStyle
Definition: class_zone.h:929
ZONE_CONNECTION m_PadConnection
Definition: class_zone.h:858
virtual LSET GetLayerSet() const override
Function GetLayerSet returns a std::bitset of all layers on which the item physically resides.
Definition: class_zone.cpp:287
wxString m_zoneName
An optional unique name for this zone, used for identifying it in DRC checking.
Definition: class_zone.h:834
PCB_LAYER_ID
A quick note on layer IDs:
double m_hatchOrientation
Definition: class_zone.h:891
void SetLayerSet(LSET aLayerSet) override
Definition: class_zone.cpp:242
SHAPE_POLY_SET.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:829
unsigned m_priority
Definition: class_zone.h:842
bool m_doNotAllowVias
Definition: class_zone.h:853
int m_cornerSmoothingType
Definition: class_zone.h:830
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_RawPolysList
Definition: class_zone.h:920
std::map< PCB_LAYER_ID, MD5_HASH > m_filledPolysHash
A hash value used in zone filling calculations to see if the filled areas are up to date.
Definition: class_zone.h:927
double m_hatchHoleMinArea
Definition: class_zone.h:897
unsigned int m_cornerRadius
Definition: class_zone.h:831
bool m_doNotAllowCopperPour
Definition: class_zone.h:852
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:909
int m_ZoneMinThickness
Definition: class_zone.h:860
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.
STATUS_FLAGS m_Flags
Definition: base_struct.h:176
void SetLocalFlags(int aFlags)
Definition: class_zone.h:286
bool m_needRefill
False when a zone was refilled, true after changes in zone params.
Definition: class_zone.h:878
int m_hatchSmoothingLevel
Definition: class_zone.h:892
ZONE_FILL_MODE m_fillMode
How to fill areas: ZONE_FILL_MODE::POLYGONS => use solid polygons ZONE_FILL_MODE::HATCH_PATTERN => us...
Definition: class_zone.h:888
int m_hatchThickness
Definition: class_zone.h:889
bool m_forceVisible
Definition: base_struct.h:175
int GetLocalFlags() const
Definition: class_zone.h:285
int m_borderHatchPitch
Definition: class_zone.h:930
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:919

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 MODULE_ZONE_CONTAINER::MODULE_ZONE_CONTAINER(), operator=(), CLIPBOARD_IO::SaveSelection(), and ZONE_CONTAINER().

◆ IsBrightened()

◆ IsConnected()

bool BOARD_CONNECTED_ITEM::IsConnected ( ) const
inlineoverridevirtualinherited

Reimplemented from BOARD_ITEM.

Definition at line 73 of file board_connected_item.h.

74  {
75  return true;
76  }

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 201 of file base_struct.h.

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

References IS_DRAGGED, and EDA_ITEM::m_Flags.

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

◆ IsFilled()

bool ZONE_CONTAINER::IsFilled ( ) const
inline

Definition at line 214 of file class_zone.h.

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

References m_isFilled.

Referenced by PCB_EDIT_FRAME::Edit_Zone_Params(), PCB_IO::format(), and DRC_TEST_PROVIDER_CLEARANCE_BASE::getLocation().

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 286 of file base_struct.h.

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

References EDA_ITEM::m_forceVisible.

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

◆ IsInGroup()

bool BOARD_ITEM::IsInGroup ( )
inlineinherited

Test if this item is inside a group.

Returns
true if inside a group

Definition at line 121 of file class_board_item.h.

121 { return m_groupUuid != niluuid; }
KIID niluuid(0)

References BOARD_ITEM::m_groupUuid, and niluuid.

Referenced by PCB_GROUP::AddItem(), and PCB_GROUP::RemoveItem().

◆ IsIsland()

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

Checks if a given filled polygon is an insulated island.

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

Definition at line 1108 of file class_zone.cpp.

1109 {
1110  if( GetNetCode() < 1 )
1111  return true;
1112 
1113  if( !m_insulatedIslands.count( aLayer ) )
1114  return false;
1115 
1116  return m_insulatedIslands.at( aLayer ).count( aPolyIdx );
1117 }
int GetNetCode() const
Function GetNetCode.
std::map< PCB_LAYER_ID, std::set< int > > m_insulatedIslands
For each layer, a set of insulated islands that were not removed.
Definition: class_zone.h:934

References BOARD_CONNECTED_ITEM::GetNetCode(), and m_insulatedIslands.

Referenced by PCB_IO::format().

◆ IsLocked()

virtual bool BOARD_ITEM::IsLocked ( ) const
inlinevirtualinherited

Function IsLocked.

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

Reimplemented in MODULE, and TRACK.

Definition at line 278 of file class_board_item.h.

279  {
280  // only MODULEs & TRACKs can be locked at this time.
281  return false;
282  }

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

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 198 of file base_struct.h.

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

References IS_CHANGED, and EDA_ITEM::m_Flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsNew()

◆ IsOnCopperLayer()

bool ZONE_CONTAINER::IsOnCopperLayer ( ) const
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 220 of file class_zone.cpp.

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

References LSET::AllCuMask(), and m_layerSet.

Referenced by ZONE_FILLER::fillSingleZone(), GetMsgPanelInfo(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), and BRDITEMS_PLOTTER::PlotFilledAreas().

◆ IsOnLayer()

bool ZONE_CONTAINER::IsOnLayer ( PCB_LAYER_ID  aLayer) const
overridevirtual

Function IsOnLayer tests to see if this object is on the given layer.

Is virtual so objects like D_PAD, which reside on multiple layers can do their own form of testing.

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

Reimplemented from BOARD_ITEM.

Definition at line 312 of file class_zone.cpp.

313 {
314  return m_layerSet.test( aLayer );
315 }

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

Function IsReplaceable.

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

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

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

Definition at line 502 of file base_struct.h.

502 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 204 of file base_struct.h.

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

References IS_RESIZED, and EDA_ITEM::m_Flags.

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

◆ IsSame()

bool ZONE_CONTAINER::IsSame ( const ZONE_CONTAINER aZoneToCompare)

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

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

Parameters
aZoneToCompare= zone to compare with "this"

Definition at line 62 of file zones_functions_for_undo_redo.cpp.

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

References 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

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

form of testing.

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

Definition at line 269 of file class_board_item.h.

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

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

◆ IsType()

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

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

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

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

Definition at line 262 of file base_struct.h.

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

References EOT, EDA_ITEM::m_StructType, and SCH_LOCATE_ANY_T.

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

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 202 of file base_struct.h.

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

References IS_WIRE_IMAGE, and EDA_ITEM::m_Flags.

◆ Iterate()

SHAPE_POLY_SET::ITERATOR ZONE_CONTAINER::Iterate ( )
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 514 of file class_zone.h.

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

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

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

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

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

Definition at line 384 of file base_struct.h.

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

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

Referenced by GERBER_FILE_IMAGE::Visit().

◆ IterateForward() [2/2]

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

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

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

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

Definition at line 405 of file base_struct.h.

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

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

◆ IterateWithHoles()

SHAPE_POLY_SET::ITERATOR ZONE_CONTAINER::IterateWithHoles ( )
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 524 of file class_zone.h.

525  {
526  return m_Poly->IterateWithHoles();
527  }
ITERATOR IterateWithHoles(int aOutline)
Function IterateWithHoles.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:829

References SHAPE_POLY_SET::IterateWithHoles(), and m_Poly.

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

◆ LayerMaskDescribe()

wxString BOARD_ITEM::LayerMaskDescribe ( ) const
protectedvirtualinherited

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

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

Reimplemented in VIA.

Definition at line 74 of file class_board_item.cpp.

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

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(), D_PAD::GetMsgPanelInfo(), and D_PAD::GetSelectMenuText().

◆ Matches() [1/2]

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

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

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

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

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

Definition at line 458 of file base_struct.h.

459  {
460  return false;
461  }

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

◆ Matches() [2/2]

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

Function Matches compares aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

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

Definition at line 140 of file base_struct.cpp.

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

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

◆ Mirror()

void ZONE_CONTAINER::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 727 of file class_zone.cpp.

728 {
729  // ZONE_CONTAINERs mirror about the x-axis (why?!?)
730  m_Poly->Mirror( aMirrorLeftRight, !aMirrorLeftRight, VECTOR2I( aMirrorRef ) );
731 
732  HatchBorder();
733 
734  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
735  pair.second.Mirror( aMirrorLeftRight, !aMirrorLeftRight, VECTOR2I( aMirrorRef ) );
736 
737  for( std::pair<const PCB_LAYER_ID, ZONE_SEGMENT_FILL>& pair : m_FillSegmList )
738  {
739  for( SEG& seg : pair.second )
740  {
741  if( aMirrorLeftRight )
742  {
743  MIRROR( seg.A.x, aMirrorRef.x );
744  MIRROR( seg.B.x, aMirrorRef.x );
745  }
746  else
747  {
748  MIRROR( seg.A.y, aMirrorRef.y );
749  MIRROR( seg.B.y, aMirrorRef.y );
750  }
751  }
752  }
753 }
void HatchBorder()
Function HatchBorder computes the hatch lines depending on the hatch parameters and stores it in the ...
Definition: class_zone.cpp:906
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
void Mirror(bool aX=true, bool aY=false, const VECTOR2I &aRef={ 0, 0 })
Mirrors the line points about y or x (or both)
void MIRROR(T &aPoint, const T &aMirrorRef)
Definition: macros.h:175
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:829
Definition: seg.h:39
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:909
VECTOR2I A
Definition: seg.h:47
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:919
VECTOR2I B
Definition: seg.h:48

References SEG::A, SEG::B, HatchBorder(), m_FilledPolysList, m_FillSegmList, m_Poly, MIRROR(), SHAPE_POLY_SET::Mirror(), wxPoint::x, VECTOR2< T >::x, wxPoint::y, 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 317 of file class_board_item.h.

318  {
319  Move( wxPoint( aMoveVector.x, aMoveVector.y ) );
320  }
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.

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

◆ Move() [2/2]

void ZONE_CONTAINER::Move ( const wxPoint offset)
overridevirtual

Function Move Move the outlines.

Parameters
offset= moving vector

Reimplemented from BOARD_ITEM.

Definition at line 653 of file class_zone.cpp.

654 {
655  /* move outlines */
656  m_Poly->Move( offset );
657 
658  HatchBorder();
659 
660  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
661  pair.second.Move( offset );
662 
663  for( std::pair<const PCB_LAYER_ID, ZONE_SEGMENT_FILL>& pair : m_FillSegmList )
664  {
665  for( SEG& seg : pair.second )
666  {
667  seg.A += VECTOR2I( offset );
668  seg.B += VECTOR2I( offset );
669  }
670  }
671 }
void HatchBorder()
Function HatchBorder computes the hatch lines depending on the hatch parameters and stores it in the ...
Definition: class_zone.cpp:906
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
void Move(const VECTOR2I &aVector) override
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:829
Definition: seg.h:39
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:909
VECTOR2I A
Definition: seg.h:47
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:919
VECTOR2I B
Definition: seg.h:48

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

◆ MoveEdge()

void ZONE_CONTAINER::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 674 of file class_zone.cpp.

675 {
676  int next_corner;
677 
678  if( m_Poly->GetNeighbourIndexes( aEdge, nullptr, &next_corner ) )
679  {
680  m_Poly->SetVertex( aEdge, m_Poly->CVertex( aEdge ) + VECTOR2I( offset ) );
681  m_Poly->SetVertex( next_corner, m_Poly->CVertex( next_corner ) + VECTOR2I( offset ) );
682  HatchBorder();
683 
684  SetNeedRefill( true );
685  }
686 }
void HatchBorder()
Function HatchBorder computes the hatch lines depending on the hatch parameters and stores it in the ...
Definition: class_zone.cpp:906
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Returns the index-th vertex in a given hole outline within a given outline
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
bool GetNeighbourIndexes(int aGlobalIndex, int *aPrevious, int *aNext)
Returns the global indexes of the previous and the next corner of the aGlobalIndex-th corner of a con...
void SetVertex(const VERTEX_INDEX &aIndex, const VECTOR2I &aPos)
Function SetVertex Accessor function to set the position of a specific point.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:829
void SetNeedRefill(bool aNeedRefill)
Definition: class_zone.h:218

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

◆ NeedRefill()

bool ZONE_CONTAINER::NeedRefill ( ) const
inline

Definition at line 217 of file class_zone.h.

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

References m_needRefill.

◆ NewHole()

void ZONE_CONTAINER::NewHole ( )
inline

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

Definition at line 577 of file class_zone.h.

578  {
579  m_Poly->NewHole();
580  }
int NewHole(int aOutline=-1)
Creates a new hole in a given outline
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:829

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

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

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

◆ operator=()

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

Definition at line 87 of file class_zone.cpp.

88 {
90 
91  InitDataFromSrcInCopyCtor( aOther );
92 
93  return *this;
94 }
void InitDataFromSrcInCopyCtor(const ZONE_CONTAINER &aZone)
Copy aZone data to me.
Definition: class_zone.cpp:104
EDA_ITEM & operator=(const EDA_ITEM &aItem)
Operator assignment is used to assign the members of aItem to another object.

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

Referenced by MODULE_ZONE_CONTAINER::operator=().

◆ Outline() [1/2]

◆ Outline() [2/2]

const SHAPE_POLY_SET* ZONE_CONTAINER::Outline ( ) const
inline

Definition at line 301 of file class_zone.h.

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

References m_Poly.

◆ RawPolysList()

SHAPE_POLY_SET& ZONE_CONTAINER::RawPolysList ( PCB_LAYER_ID  aLayer)
inline

Definition at line 709 of file class_zone.h.

710  {
711  wxASSERT( m_RawPolysList.count( aLayer ) );
712  return m_RawPolysList.at( aLayer );
713  }
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_RawPolysList
Definition: class_zone.h:920

References m_RawPolysList.

◆ RemoveAllContours()

void ZONE_CONTAINER::RemoveAllContours ( void  )
inline

Definition at line 539 of file class_zone.h.

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

References m_Poly, and SHAPE_POLY_SET::RemoveAllContours().

◆ RemoveCutout()

void ZONE_CONTAINER::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 772 of file class_zone.cpp.

773 {
774  // Ensure the requested cutout is valid
775  if( m_Poly->OutlineCount() < aOutlineIdx || m_Poly->HoleCount( aOutlineIdx ) < aHoleIdx )
776  return;
777 
778  SHAPE_POLY_SET cutPoly( m_Poly->Hole( aOutlineIdx, aHoleIdx ) );
779 
780  // Add the cutout back to the zone
782 
783  SetNeedRefill( true );
784 }
int OutlineCount() const
Returns the number of outlines in the set
void BooleanAdd(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Performs boolean polyset union For aFastMode meaning, see function booleanOp
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Returns the reference to aHole-th hole in the aIndex-th outline
SHAPE_POLY_SET.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:829
int HoleCount(int aOutline) const
Returns the number of holes in a given outline
void SetNeedRefill(bool aNeedRefill)
Definition: class_zone.h:218

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 ( wxFindReplaceData &  aSearchData,
wxString &  aText 
)
staticinherited

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

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

Definition at line 167 of file base_struct.cpp.

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

References GetChars(), and traceFindReplace.

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

◆ Replace() [2/2]

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

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

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

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

Reimplemented in SCH_TEXT, SCH_SHEET_PIN, SCH_FIELD, and SCH_PIN.

Definition at line 490 of file base_struct.h.

490 { return false; }

◆ Rotate() [1/2]

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

Definition at line 333 of file class_board_item.h.

334  {
335  Rotate( wxPoint( aRotCentre.x, aRotCentre.y ), aAngle );
336  }
virtual void Rotate(const wxPoint &aRotCentre, double aAngle)
Function Rotate Rotate this object.

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

◆ Rotate() [2/2]

void ZONE_CONTAINER::Rotate ( const wxPoint 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 689 of file class_zone.cpp.

690 {
691  aAngle = -DECIDEG2RAD( aAngle );
692 
693  m_Poly->Rotate( aAngle, VECTOR2I( aCentre ) );
694  HatchBorder();
695 
696  /* rotate filled areas: */
697  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
698  pair.second.Rotate( aAngle, VECTOR2I( aCentre ) );
699 
700  for( std::pair<const PCB_LAYER_ID, ZONE_SEGMENT_FILL>& pair : m_FillSegmList )
701  {
702  for( SEG& seg : pair.second )
703  {
704  wxPoint a( seg.A );
705  RotatePoint( &a, aCentre, aAngle );
706  seg.A = a;
707  wxPoint b( seg.B );
708  RotatePoint( &b, aCentre, aAngle );
709  seg.B = a;
710  }
711  }
712 }
void HatchBorder()
Function HatchBorder computes the hatch lines depending on the hatch parameters and stores it in the ...
Definition: class_zone.cpp:906
void Rotate(double aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Function Rotate rotates all vertices by a given angle.
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:829
Definition: seg.h:39
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:909
VECTOR2I A
Definition: seg.h:47
double DECIDEG2RAD(double deg)
Definition: trigo.h:223
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:919
VECTOR2I B
Definition: seg.h:48

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  }