KiCad PCB EDA Suite
ZONE Class Reference

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

#include <zone.h>

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

Public Member Functions

 ZONE (BOARD_ITEM_CONTAINER *parent, bool aInFP=false)
 The ctor to build ZONE, but compatible with FP_ZONE requirement. More...
 
 ZONE (const ZONE &aZone)
 
ZONEoperator= (const ZONE &aOther)
 
 ~ZONE ()
 
bool IsConnected () const override
 Not all ZONEs are really BOARD_CONNECTED_ITEMs.... More...
 
void InitDataFromSrcInCopyCtor (const ZONE &aZone)
 Copy aZone data to me. More...
 
VECTOR2I GetPosition () const override
 
void SetPosition (const VECTOR2I &aPos) override
 
void SetAssignedPriority (unsigned aPriority)
 
unsigned GetAssignedPriority () const
 
bool HigherPriority (const ZONE *aOther) const
 
bool SameNet (const ZONE *aOther) const
 
void GetMsgPanelInfo (EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
 Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes. More...
 
void SetLayerSet (LSET aLayerSet) override
 
virtual LSET GetLayerSet () const override
 Return a std::bitset of all layers on which the item physically resides. More...
 
wxString GetZoneName () const
 
void SetZoneName (const wxString &aName)
 
bool Matches (const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
 Compare the item against the search criteria in aSearchData. More...
 
const BOX2I GetBoundingBox () const override
 
const BOX2I GetCachedBoundingBox () const
 ONLY TO BE USED BY CLIENTS WHICH SET UP THE CACHE! More...
 
void CacheBoundingBox ()
 
int GetLocalClearance (wxString *aSource) const override
 Return any local clearances set in the "classic" (ie: pre-rule) system. More...
 
int GetLocalClearance () const
 
void SetLocalClearance (int aClearance)
 
bool IsOnCopperLayer () const override
 
virtual void SetLayer (PCB_LAYER_ID aLayer) override
 Set the layer this item is on. More...
 
virtual PCB_LAYER_ID GetLayer () const override
 Return the primary layer this item is on. More...
 
PCB_LAYER_ID GetFirstLayer () const
 
virtual bool IsOnLayer (PCB_LAYER_ID) const override
 Test to see if this object is on the given layer. More...
 
virtual void ViewGetLayers (int aLayers[], int &aCount) const override
 Return the all the layers within the VIEW the object is painted on. More...
 
double ViewGetLOD (int aLayer, KIGFX::VIEW *aView) const override
 Return the level of detail (LOD) of the item. More...
 
void SetFillMode (ZONE_FILL_MODE aFillMode)
 
ZONE_FILL_MODE GetFillMode () const
 
void SetThermalReliefGap (int aThermalReliefGap)
 
int GetThermalReliefGap () const
 
int GetThermalReliefGap (PAD *aPad, wxString *aSource=nullptr) const
 
void SetThermalReliefSpokeWidth (int aThermalReliefSpokeWidth)
 
int GetThermalReliefSpokeWidth () const
 
double CalculateFilledArea ()
 Compute the area currently occupied by the zone fill. More...
 
double CalculateOutlineArea ()
 Compute the area of the zone outline (not the filled area). More...
 
double GetFilledArea ()
 This area is cached from the most recent call to CalculateFilledArea(). More...
 
double GetOutlineArea ()
 This area is cached from the most recent call to CalculateOutlineArea(). 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 () 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)
 
EDA_ANGLE GetHatchOrientation () const
 
void SetHatchOrientation (const EDA_ANGLE &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)
 
int GetLocalFlags () const
 
void SetLocalFlags (int aFlags)
 
SHAPE_POLY_SETOutline ()
 
const SHAPE_POLY_SETOutline () const
 
void SetOutline (SHAPE_POLY_SET *aOutline)
 
virtual std::shared_ptr< SHAPEGetEffectiveShape (PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT) const override
 Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes. More...
 
bool HitTest (const VECTOR2I &aPosition, int aAccuracy=0) const override
 Test if a point is near an outline edge or a corner of this zone. More...
 
bool HitTestFilledArea (PCB_LAYER_ID aLayer, const VECTOR2I &aRefPos, int aAccuracy=0) const
 Test if the given VECTOR2I is within the bounds of a filled area of this zone. More...
 
bool HitTestCutout (const VECTOR2I &aRefPos, int *aOutlineIdx=nullptr, int *aHoleIdx=nullptr) const
 Test if the given point is contained within a cutout of the zone. More...
 
void GetInteractingZones (PCB_LAYER_ID aLayer, std::vector< ZONE * > *aZones) const
 Some intersecting zones, despite being on the same layer with the same net, cannot be merged due to other parameters such as fillet radius. More...
 
void TransformSolidAreasShapesToPolygon (PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aCornerBuffer, int aError=ARC_HIGH_DEF) const
 Convert solid areas full shapes to polygon set (the full shape is the polygon area with a thick outline) Used in 3D view Arcs (ends of segments) are approximated by segments. More...
 
void TransformSmoothedOutlineToPolygon (SHAPE_POLY_SET &aCornerBuffer, int aClearance, int aError, ERROR_LOC aErrorLoc, SHAPE_POLY_SET *aBoardOutline) const
 Convert the outlines shape to a polygon with no holes inflated (optional) by max( aClearanceValue, the zone clearance) (holes are linked to external outline by overlapping segments) Used in filling zones calculations Circles (vias) and arcs (ends of tracks) are approximated by segments. More...
 
void TransformShapeWithClearanceToPolygon (SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearanceValue, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
 Convert the zone shape to a closed polygon Used in filling zones calculations Circles and arcs are approximated by segments. More...
 
bool HitTestForCorner (const VECTOR2I &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX *aCornerHit=nullptr) const
 Test if the given VECTOR2I is near a corner. More...
 
bool HitTestForEdge (const VECTOR2I &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX *aCornerHit=nullptr) const
 Test if the given VECTOR2I is near a segment defined by 2 corners. More...
 
bool HitTest (const BOX2I &aRect, bool aContained=true, int aAccuracy=0) const override
 Test if aRect intersects this item. More...
 
bool UnFill ()
 Removes the zone filling. More...
 
void Move (const VECTOR2I &offset) override
 Move the outlines. More...
 
void MoveEdge (const VECTOR2I &offset, int aEdge)
 Move the outline Edge. More...
 
void Rotate (const VECTOR2I &aCentre, const EDA_ANGLE &aAngle) override
 Rotate the outlines. More...
 
virtual void Flip (const VECTOR2I &aCentre, bool aFlipLeftRight) override
 Flip this object, i.e. More...
 
void Mirror (const VECTOR2I &aMirrorRef, bool aMirrorLeftRight)
 Mirror the outlines relative to a given horizontal axis the layer is not changed. More...
 
wxString GetClass () const override
 
int GetNumCorners (void) const
 Access to m_Poly parameters. More...
 
SHAPE_POLY_SET::ITERATOR Iterate ()
 Return an iterator to visit all points of the zone's main outline without holes. More...
 
SHAPE_POLY_SET::ITERATOR IterateWithHoles ()
 Return an iterator to visit all points of the zone's main outline with holes. More...
 
SHAPE_POLY_SET::CONST_ITERATOR CIterateWithHoles () const
 Return an iterator to visit all points of the zone's main outline with holes. More...
 
void RemoveAllContours (void)
 
const VECTOR2IGetCornerPosition (int aCornerIndex) const
 
void SetCornerPosition (int aCornerIndex, const VECTOR2I &new_pos)
 
void NewHole ()
 Create a new hole on the zone; i.e., a new contour on the zone's outline. More...
 
bool AppendCorner (VECTOR2I aPosition, int aHoleIdx, bool aAllowDuplication=false)
 Add a new corner to the zone outline (to the main outline or a hole) More...
 
ZONE_BORDER_DISPLAY_STYLE GetHatchStyle () const
 
void SetHatchStyle (ZONE_BORDER_DISPLAY_STYLE aStyle)
 
bool IsSame (const ZONE &aZoneToCompare)
 Test if 2 zones are equivalent. More...
 
bool HasFilledPolysForLayer (PCB_LAYER_ID aLayer) const
 
const std::shared_ptr< SHAPE_POLY_SET > & GetFilledPolysList (PCB_LAYER_ID aLayer) const
 
SHAPE_POLY_SETGetFill (PCB_LAYER_ID aLayer)
 
void CacheTriangulation (PCB_LAYER_ID aLayer=UNDEFINED_LAYER)
 Create a list of triangles that "fill" the solid areas used for instance to draw these solid areas on OpenGL. More...
 
void SetFilledPolysList (PCB_LAYER_ID aLayer, const SHAPE_POLY_SET &aPolysList)
 Set the list of filled polygons. More...
 
bool IsIsland (PCB_LAYER_ID aLayer, int aPolyIdx) const
 Check if a given filled polygon is an insulated island. More...
 
void SetIsIsland (PCB_LAYER_ID aLayer, int aPolyIdx)
 
bool BuildSmoothedPoly (SHAPE_POLY_SET &aSmoothedPoly, PCB_LAYER_ID aLayer, SHAPE_POLY_SET *aBoardOutline, SHAPE_POLY_SET *aSmoothedPolyWithApron=nullptr) const
 
void SetCornerSmoothingType (int aType)
 
int GetCornerSmoothingType () const
 
void SetCornerRadius (unsigned int aRadius)
 
unsigned int GetCornerRadius () const
 
void RemoveCutout (int aOutlineIdx, int aHoleIdx)
 Remove a cutout from the zone. More...
 
void AddPolygon (std::vector< VECTOR2I > &aPolygon)
 Add a polygon to the zone outline. More...
 
void AddPolygon (const SHAPE_LINE_CHAIN &aPolygon)
 
wxString GetSelectMenuText (UNITS_PROVIDER *aUnitsProvider) const override
 Return the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position. More...
 
BITMAPS GetMenuImage () const override
 Return a pointer to an image to be used in menus. More...
 
EDA_ITEMClone () const override
 Create a duplicate of this item with linked list members set to NULL. More...
 
bool IsTeardropArea () const
 
void SetTeardropAreaType (TEARDROP_TYPE aType)
 Set the type of teardrop if the zone is a teardrop area for non teardrop area, the type must be TEARDROP_TYPE::TD_NONE. More...
 
TEARDROP_TYPE GetTeardropAreaType () const
 
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 aBorderHatchStyle, int aBorderHatchPitch, bool aRebuilBorderdHatch)
 Set all hatch parameters for the zone. More...
 
void SetBorderHatchPitch (int aPitch)
 Set the hatch pitch parameter for the zone. More...
 
void UnHatchBorder ()
 Clear the zone's hatch. More...
 
void HatchBorder ()
 Compute the hatch lines depending on the hatch parameters and stores it in the zone's attribute m_borderHatchLines. More...
 
const std::vector< SEG > & GetHatchLines () const
 
void BuildHashValue (PCB_LAYER_ID aLayer)
 Build the hash value of m_FilledPolysList, and store it internally in m_filledPolysHash. More...
 
MD5_HASH GetHashValue (PCB_LAYER_ID aLayer)
 
virtual void SwapData (BOARD_ITEM *aImage) override
 Swap data between aItem and aImage. More...
 
NETINFO_ITEMGetNet () const
 Return #NET_INFO object for a given item. More...
 
void SetNet (NETINFO_ITEM *aNetInfo)
 Set a NET_INFO object for the item. More...
 
int GetNetCode () const
 
bool SetNetCode (int aNetCode, bool aNoAssert)
 Set net using a net code. More...
 
void SetNetCode (int aNetCode)
 
wxString GetNetname () const
 
wxString GetNetnameMsg () const
 
wxString GetShortNetname () const
 
virtual int GetOwnClearance (PCB_LAYER_ID aLayer, wxString *aSource=nullptr) const
 Return an item's "own" clearance in internal units. More...
 
virtual int GetLocalClearanceOverrides (wxString *aSource) const
 Return any local clearance overrides set in the "classic" (ie: pre-rule) system. More...
 
virtual NETCLASSGetEffectiveNetClass () const
 Return the NETCLASS for this item. More...
 
wxString GetNetClassName () const
 Returns the name of the effective netclass. More...
 
void SetLocalRatsnestVisible (bool aVisible)
 
bool GetLocalRatsnestVisible () const
 
void SetParentGroup (PCB_GROUP *aGroup)
 
PCB_GROUPGetParentGroup () const
 
int GetX () const
 
int GetY () const
 
virtual VECTOR2I GetCenter () const
 This defaults to the center of the bounding box if not overridden. More...
 
void SetX (int aX)
 
void SetY (int aY)
 
virtual bool HasHole () const
 
virtual bool IsTented () const
 
virtual std::shared_ptr< SHAPE_SEGMENTGetEffectiveHoleShape () const
 
BOARD_ITEM_CONTAINERGetParent () const
 
BOARD_ITEM_CONTAINERGetParentFootprint () const
 
virtual bool HasLineStroke () const
 Check if this item has line stoke properties. More...
 
virtual STROKE_PARAMS GetStroke () const
 
virtual void SetStroke (const STROKE_PARAMS &aStroke)
 
virtual BOARD_ITEMDuplicate () const
 Create a copy of this BOARD_ITEM. More...
 
virtual bool IsKnockout () const
 
virtual void SetIsKnockout (bool aKnockout)
 
virtual bool IsLocked () const
 
virtual void SetLocked (bool aLocked)
 
void DeleteStructure ()
 Delete this object after removing from its parent if it has one. More...
 
virtual const BOARDGetBoard () const
 Return the BOARD in which this BOARD_ITEM resides, or NULL if none. More...
 
virtual BOARDGetBoard ()
 
wxString GetLayerName () const
 Return the name of the PCB layer on which the item resides. More...
 
KICAD_T Type () const
 Returns the type of object. More...
 
virtual void SetParent (EDA_ITEM *aParent)
 
bool IsModified () const
 
bool IsNew () const
 
bool IsMoving () const
 
bool IsDragging () const
 
bool IsWireImage () const
 
bool IsSelected () const
 
bool IsEntered () const
 
bool IsResized () const
 
bool IsBrightened () const
 
bool IsRollover () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (EDA_ITEM_FLAGS type) const
 
void SetState (EDA_ITEM_FLAGS type, bool state)
 
EDA_ITEM_FLAGS GetStatus () const
 
void SetStatus (EDA_ITEM_FLAGS aStatus)
 
void SetFlags (EDA_ITEM_FLAGS aMask)
 
void ClearFlags (EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
EDA_ITEM_FLAGS GetFlags () const
 
bool HasFlag (EDA_ITEM_FLAGS aFlag) const
 
EDA_ITEM_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
virtual bool RenderAsBitmap (double aWorldScale) const
 
void SetIsShownAsBitmap (bool aBitmap)
 
bool IsShownAsBitmap () const
 
virtual bool IsType (const std::vector< KICAD_T > &aScanTypes) const
 Check whether the item is one of the listed types. More...
 
void SetForceVisible (bool aEnable)
 Set and clear force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible. More...
 
bool IsForceVisible () const
 
virtual const VECTOR2I GetFocusPosition () const
 Similar to GetPosition, but allows items to return their visual center rather than their anchor. More...
 
virtual VECTOR2I GetSortPosition () const
 Return the coordinates that should be used for sorting this element visually compared to other elements. More...
 
virtual INSPECT_RESULT Visit (INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &aScanTypes)
 May be re-implemented for each derived class in order to handle all the types given by its member data. More...
 
wxString GetTypeDesc ()
 Return a translated description of the type for this EDA_ITEM for display in user facing messages. More...
 
virtual bool Replace (const EDA_SEARCH_DATA &aSearchData, void *aAuxData=nullptr)
 Perform a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Override this method in any derived object that supports test find and replace. More...
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
virtual const BOX2I ViewBBox () const override
 Return the bounding box of the item covering all its layers. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Draw the parts of the object belonging to layer aLayer. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 
void ClearViewPrivData ()
 
bool Set (PROPERTY_BASE *aProperty, wxAny &aValue)
 
template<typename T >
bool Set (PROPERTY_BASE *aProperty, T aValue)
 
template<typename T >
bool Set (const wxString &aProperty, T aValue)
 
wxAny Get (PROPERTY_BASE *aProperty) const
 
template<typename T >
Get (PROPERTY_BASE *aProperty) const
 
template<typename T >
std::optional< T > Get (const wxString &aProperty) const
 

Static Public Member Functions

static bool ClassOf (const EDA_ITEM *aItem)
 
static int GetDefaultHatchPitch ()
 
template<class T >
static INSPECT_RESULT IterateForward (std::deque< T > &aList, INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &scanTypes)
 This changes first parameter to avoid the DList and use the main queue instead. More...
 
template<class T >
static INSPECT_RESULT IterateForward (std::vector< T > &aList, INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &scanTypes)
 Change first parameter to avoid the DList and use std::vector instead. More...
 
static bool Replace (const EDA_SEARCH_DATA &aSearchData, wxString &aText)
 Perform a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
static bool Sort (const EDA_ITEM *aLeft, const EDA_ITEM *aRight)
 Helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers. More...
 

Public Attributes

const KIID m_Uuid
 

Static Public Attributes

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

Protected Member Functions

virtual wxString layerMaskDescribe () const
 Return a string (to be shown to the user) describing a layer mask. More...
 
bool Matches (const wxString &aText, const EDA_SEARCH_DATA &aSearchData) const
 Compare aText against search criteria in aSearchData. More...
 

Protected Attributes

SHAPE_POLY_SETm_Poly
 Outline of the zone. More...
 
int m_cornerSmoothingType
 
unsigned int m_cornerRadius
 
wxString m_zoneName
 An optional unique name for this zone, used for identifying it in DRC checking. More...
 
LSET m_layerSet
 
unsigned m_priority
 
bool m_isRuleArea
 
TEARDROP_TYPE m_teardropType
 
bool m_doNotAllowCopperPour
 
bool m_doNotAllowVias
 
bool m_doNotAllowTracks
 
bool m_doNotAllowPads
 
bool m_doNotAllowFootprints
 
ZONE_CONNECTION m_PadConnection
 
int m_ZoneClearance
 
int m_ZoneMinThickness
 
int m_fillVersion
 
ISLAND_REMOVAL_MODE m_islandRemovalMode
 
long long int m_minIslandArea
 When island removal mode is set to AREA, islands below this area will be removed. More...
 
bool m_isFilled
 True when a zone was filled, false after deleting the filled areas. More...
 
bool m_needRefill
 False when a zone was refilled, true after changes in zone params. More...
 
int m_thermalReliefGap
 
int m_thermalReliefSpokeWidth
 
ZONE_FILL_MODE m_fillMode
 How to fill areas: More...
 
int m_hatchThickness
 
int m_hatchGap
 
EDA_ANGLE m_hatchOrientation
 
int m_hatchSmoothingLevel
 
double m_hatchSmoothingValue
 
double m_hatchHoleMinArea
 
int m_hatchBorderAlgorithm
 
SHAPE_POLY_SET::VERTEX_INDEXm_CornerSelection
 The index of the corner being moved or nullptr if no corner is selected. More...
 
int m_localFlgs
 
std::map< PCB_LAYER_ID, std::shared_ptr< SHAPE_POLY_SET > > m_FilledPolysList
 
BOX2I m_bboxCache
 Temp variables used while filling. More...
 
LSET 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...
 
double m_area
 
double m_outlinearea
 
std::mutex m_lock
 Lock used for multi-threaded filling on multi-layer zones. More...
 
NETINFO_ITEMm_netinfo
 Store all information about the net that item belongs to. More...
 
PCB_LAYER_ID m_layer
 
bool m_isKnockout
 
bool m_isLocked
 
PCB_GROUPm_group
 
EDA_ITEM_FLAGS m_status
 
EDA_ITEMm_parent
 Linked list: Link (parent struct) More...
 
bool m_forceVisible
 
EDA_ITEM_FLAGS m_flags
 

Private Attributes

bool m_localRatsnestVisible
 
KICAD_T m_structType
 Run time identification, keep private so it can never be changed after a ctor sets it. More...
 
VIEW_ITEM_DATA * m_viewPrivData
 

Detailed Description

Handle a list of polygons defining a copper zone.

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

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

Definition at line 56 of file zone.h.

Constructor & Destructor Documentation

◆ ZONE() [1/2]

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

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

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

Definition at line 43 of file zone.cpp.

43 :
44 BOARD_CONNECTED_ITEM( aParent, aInFP ? PCB_FP_ZONE_T : PCB_ZONE_T ),
45 m_area( 0.0 ),
46 m_outlinearea( 0.0 )
47{
48 m_Poly = new SHAPE_POLY_SET(); // Outlines
51 m_zoneName = wxEmptyString;
52 m_CornerSelection = nullptr; // no corner is selected
53 m_isFilled = false; // fill status : true when the zone is filled
58 m_priority = 0;
59 SetIsRuleArea( aInFP ); // Zones living in footprints have the rule area option
60 SetLocalFlags( 0 ); // flags temporary used in zone calculations
61 m_fillVersion = 5; // set the "old" way to build filled polygon areas (< 6.0.x)
62
63 aParent->GetZoneSettings().ExportSetting( *this );
64
68
69 m_needRefill = false; // True only after edits.
70}
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:109
BOARD_CONNECTED_ITEM(BOARD_ITEM *aParent, KICAD_T idtype)
Represent a set of closed polygons.
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: zone.h:857
int m_borderHatchPitch
Definition: zone.h:879
int m_cornerSmoothingType
Definition: zone.h:776
int m_ZoneMinThickness
Definition: zone.h:812
void SetLocalFlags(int aFlags)
Definition: zone.h:303
int m_thermalReliefSpokeWidth
Definition: zone.h:834
wxString m_zoneName
An optional unique name for this zone, used for identifying it in DRC checking.
Definition: zone.h:780
double m_outlinearea
Definition: zone.h:886
bool m_needRefill
False when a zone was refilled, true after changes in zone params.
Definition: zone.h:831
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:775
TEARDROP_TYPE m_teardropType
Definition: zone.h:799
void SetIsRuleArea(bool aEnable)
Definition: zone.h:698
int m_fillVersion
Definition: zone.h:813
unsigned m_priority
Definition: zone.h:788
ISLAND_REMOVAL_MODE m_islandRemovalMode
Definition: zone.h:815
bool m_isFilled
True when a zone was filled, false after deleting the filled areas.
Definition: zone.h:824
int m_thermalReliefGap
Definition: zone.h:833
double m_area
Definition: zone.h:885
unsigned int m_cornerRadius
Definition: zone.h:777
static int GetDefaultHatchPitch()
Definition: zone.cpp:923
ZONE_BORDER_DISPLAY_STYLE m_borderStyle
Definition: zone.h:878
constexpr int Mils2IU(const EDA_IU_SCALE &aIuScale, int mils)
Definition: eda_units.h:123
@ PCB_ZONE_T
class ZONE, a copper pour area
Definition: typeinfo.h:112
@ PCB_FP_ZONE_T
class ZONE, managed by a footprint
Definition: typeinfo.h:100
#define ZONE_THICKNESS_MIL
Definition: zones.h:35
#define ZONE_THERMAL_RELIEF_GAP_MIL
Definition: zones.h:33
#define ZONE_THERMAL_RELIEF_COPPER_WIDTH_MIL
Definition: zones.h:34

References ALWAYS, DIAGONAL_EDGE, ZONE_SETTINGS::ExportSetting(), GetDefaultHatchPitch(), BOARD_ITEM_CONTAINER::GetZoneSettings(), m_borderHatchPitch, m_borderStyle, m_cornerRadius, m_CornerSelection, m_cornerSmoothingType, m_fillVersion, m_isFilled, m_islandRemovalMode, m_needRefill, m_Poly, m_priority, m_teardropType, m_thermalReliefGap, m_thermalReliefSpokeWidth, m_ZoneMinThickness, m_zoneName, EDA_UNIT_UTILS::Mils2IU(), pcbIUScale, SetIsRuleArea(), SetLocalFlags(), ZONE_SETTINGS::SMOOTHING_NONE, TD_NONE, ZONE_THERMAL_RELIEF_COPPER_WIDTH_MIL, ZONE_THERMAL_RELIEF_GAP_MIL, and ZONE_THICKNESS_MIL.

Referenced by Clone().

◆ ZONE() [2/2]

ZONE::ZONE ( const ZONE aZone)

Definition at line 73 of file zone.cpp.

73 :
74 BOARD_CONNECTED_ITEM( aZone ),
75 m_Poly( nullptr ),
76 m_CornerSelection( nullptr )
77{
79}
void InitDataFromSrcInCopyCtor(const ZONE &aZone)
Copy aZone data to me.
Definition: zone.cpp:99

References InitDataFromSrcInCopyCtor().

◆ ~ZONE()

ZONE::~ZONE ( )

Definition at line 92 of file zone.cpp.

93{
94 delete m_Poly;
95 delete m_CornerSelection;
96}

References m_CornerSelection, and m_Poly.

Member Function Documentation

◆ AddPolygon() [1/2]

void ZONE::AddPolygon ( const SHAPE_LINE_CHAIN aPolygon)

Definition at line 665 of file zone.cpp.

666{
667 wxASSERT( aPolygon.IsClosed() );
668
669 // Add the outline as a new polygon in the polygon set
670 if( m_Poly->OutlineCount() == 0 )
671 m_Poly->AddOutline( aPolygon );
672 else
673 m_Poly->AddHole( aPolygon );
674
675 SetNeedRefill( true );
676}
bool IsClosed() const override
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new hole to the given outline (default: last) and returns its index.
int AddHole(const SHAPE_LINE_CHAIN &aHole, int aOutline=-1)
Return the area of this poly set.
int OutlineCount() const
Return the number of vertices in a given outline/hole.
void SetNeedRefill(bool aNeedRefill)
Definition: zone.h:239

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

◆ AddPolygon() [2/2]

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

Add a polygon to the zone outline.

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

Definition at line 679 of file zone.cpp.

680{
681 if( aPolygon.empty() )
682 return;
683
684 SHAPE_LINE_CHAIN outline;
685
686 // Create an outline and populate it with the points of aPolygon
687 for( const VECTOR2I& pt : aPolygon )
688 outline.Append( pt );
689
690 outline.SetClosed( true );
691
692 AddPolygon( outline );
693}
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
void SetClosed(bool aClosed)
Mark the line chain as closed (i.e.
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
void AddPolygon(std::vector< VECTOR2I > &aPolygon)
Add a polygon to the zone outline.
Definition: zone.cpp:679

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

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

◆ AppendCorner()

bool ZONE::AppendCorner ( VECTOR2I  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 696 of file zone.cpp.

697{
698 // Ensure the main outline exists:
699 if( m_Poly->OutlineCount() == 0 )
701
702 // If aHoleIdx >= 0, the corner musty be added to the hole, index aHoleIdx.
703 // (remember: the index of the first hole is 0)
704 // Return error if it does not exist.
705 if( aHoleIdx >= m_Poly->HoleCount( 0 ) )
706 return false;
707
708 m_Poly->Append( aPosition.x, aPosition.y, -1, aHoleIdx, aAllowDuplication );
709
710 SetNeedRefill( true );
711
712 return true;
713}
int HoleCount(int aOutline) const
Return the reference to aIndex-th outline in the set.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...
int NewOutline()
Creates a new hole in a given outline.

References SHAPE_POLY_SET::Append(), SHAPE_POLY_SET::HoleCount(), m_Poly, SHAPE_POLY_SET::NewOutline(), SHAPE_POLY_SET::OutlineCount(), SetNeedRefill(), VECTOR2< T >::x, and VECTOR2< T >::y.

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

◆ BuildHashValue()

void ZONE::BuildHashValue ( PCB_LAYER_ID  aLayer)

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

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

Definition at line 351 of file zone.cpp.

352{
353 if( !m_FilledPolysList.count( aLayer ) )
355 else
356 m_filledPolysHash[aLayer] = m_FilledPolysList.at( aLayer )->GetHash();
357}
MD5_HASH GetHash() const
std::map< PCB_LAYER_ID, std::shared_ptr< SHAPE_POLY_SET > > m_FilledPolysList
Definition: zone.h:869
std::map< PCB_LAYER_ID, MD5_HASH > m_filledPolysHash
A hash value used in zone filling calculations to see if the filled areas are up to date.
Definition: zone.h:876
static SHAPE_POLY_SET g_nullPoly
Definition: zone.cpp:339

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

◆ BuildSmoothedPoly()

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

Definition at line 1008 of file zone.cpp.

1011{
1012 if( GetNumCorners() <= 2 ) // malformed zone. polygon calculations will not like it ...
1013 return false;
1014
1015 // Processing of arc shapes in zones is not yet supported because Clipper can't do boolean
1016 // operations on them. The poly outline must be converted to segments first.
1018 flattened.ClearArcs();
1019
1020 if( GetIsRuleArea() )
1021 {
1022 // We like keepouts just the way they are....
1023 aSmoothedPoly = flattened;
1024 return true;
1025 }
1026
1027 const BOARD* board = GetBoard();
1028 int maxError = ARC_HIGH_DEF;
1029 bool keepExternalFillets = false;
1032
1033 if( IsTeardropArea() ) // We use teardrop shapes with no smoothing
1034 // these shapes are already optimized
1035 smooth_requested = false;
1036
1037 if( board )
1038 {
1040
1041 maxError = bds.m_MaxError;
1042 keepExternalFillets = bds.m_ZoneKeepExternalFillets;
1043 }
1044
1045 auto smooth = [&]( SHAPE_POLY_SET& aPoly )
1046 {
1047
1048 if( !smooth_requested )
1049 return;
1050
1051 switch( m_cornerSmoothingType )
1052 {
1054 aPoly = aPoly.Chamfer( (int) m_cornerRadius );
1055 break;
1056
1058 {
1059 aPoly = aPoly.Fillet( (int) m_cornerRadius, maxError );
1060 break;
1061 }
1062
1063 default:
1064 break;
1065 }
1066 };
1067
1068 std::vector<ZONE*> interactingZones;
1069 GetInteractingZones( aLayer, &interactingZones );
1070
1071 SHAPE_POLY_SET* maxExtents = &flattened;
1072 SHAPE_POLY_SET withFillets;
1073
1074 aSmoothedPoly = flattened;
1075
1076 // Should external fillets (that is, those applied to concave corners) be kept? While it
1077 // seems safer to never have copper extend outside the zone outline, 5.1.x and prior did
1078 // indeed fill them so we leave the mode available.
1079 if( keepExternalFillets && smooth_requested )
1080 {
1081 withFillets = flattened;
1082 smooth( withFillets );
1083 withFillets.BooleanAdd( flattened, SHAPE_POLY_SET::PM_FAST );
1084 maxExtents = &withFillets;
1085 }
1086
1087 for( ZONE* zone : interactingZones )
1088 {
1089 SHAPE_POLY_SET flattened_outline = zone->Outline()->CloneDropTriangulation();
1090 flattened_outline.ClearArcs();
1091 aSmoothedPoly.BooleanAdd( flattened_outline, SHAPE_POLY_SET::PM_FAST );
1092 }
1093
1094 if( aBoardOutline )
1095 aSmoothedPoly.BooleanIntersection( *aBoardOutline, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
1096
1097 smooth( aSmoothedPoly );
1098
1099 if( aSmoothedPolyWithApron )
1100 {
1101 SHAPE_POLY_SET poly = maxExtents->CloneDropTriangulation();
1102 poly.Inflate( m_ZoneMinThickness, 64 );
1103 *aSmoothedPolyWithApron = aSmoothedPoly;
1104 aSmoothedPolyWithApron->BooleanIntersection( poly, SHAPE_POLY_SET::PM_FAST );
1105 }
1106
1107 aSmoothedPoly.BooleanIntersection( *maxExtents, SHAPE_POLY_SET::PM_FAST );
1108
1109 return true;
1110}
constexpr int ARC_HIGH_DEF
Definition: base_units.h:121
Container for design settings for a BOARD object.
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:37
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:602
void ClearArcs()
Appends a vertex at the end of the given outline/hole (default: the last outline)
void BooleanAdd(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset difference For aFastMode meaning, see function booleanOp.
void Inflate(int aAmount, int aCircleSegCount, CORNER_STRATEGY aCornerStrategy=ROUND_ALL_CORNERS)
Perform outline inflation/deflation.
void BooleanIntersection(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset union between a and b, store the result in it self For aFastMode meaning,...
SHAPE_LINE_CHAIN & Outline(int aIndex)
SHAPE_POLY_SET CloneDropTriangulation() const
Creates a new empty polygon in the set and returns its index.
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:691
void GetInteractingZones(PCB_LAYER_ID aLayer, std::vector< ZONE * > *aZones) const
Some intersecting zones, despite being on the same layer with the same net, cannot be merged due to o...
Definition: zone.cpp:972
bool IsTeardropArea() const
Definition: zone.h:675
int GetNumCorners(void) const
Access to m_Poly parameters.
Definition: zone.h:484

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

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

◆ CacheBoundingBox()

void ZONE::CacheBoundingBox ( )
inline

Definition at line 134 of file zone.h.

const BOX2I GetBoundingBox() const override
Definition: zone.cpp:309
BOX2I m_bboxCache
Temp variables used while filling.
Definition: zone.h:872

References GetBoundingBox(), and m_bboxCache.

◆ CacheTriangulation()

void ZONE::CacheTriangulation ( PCB_LAYER_ID  aLayer = UNDEFINED_LAYER)

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

Definition at line 943 of file zone.cpp.

944{
945 if( aLayer == UNDEFINED_LAYER )
946 {
947 for( std::pair<const PCB_LAYER_ID, std::shared_ptr<SHAPE_POLY_SET>>& pair : m_FilledPolysList )
948 pair.second->CacheTriangulation();
949
950 m_Poly->CacheTriangulation( false );
951 }
952 else
953 {
954 if( m_FilledPolysList.count( aLayer ) )
955 m_FilledPolysList[ aLayer ]->CacheTriangulation();
956 }
957}
void CacheTriangulation(bool aPartition=true)
Build a polygon triangulation, needed to draw a polygon on OpenGL and in some other calculations.
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59
@ UNDEFINED_LAYER
Definition: layer_ids.h:60

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

Referenced by DRC_TEST_PROVIDER_SOLDER_MASK::buildRTrees(), and ZONE_FILLER::Fill().

◆ CalculateFilledArea()

double ZONE::CalculateFilledArea ( )

Compute the area currently occupied by the zone fill.

Returns
the currently filled area

Definition at line 1113 of file zone.cpp.

1114{
1115 m_area = 0.0;
1116
1117 // Iterate over each outline polygon in the zone and then iterate over
1118 // each hole it has to compute the total area.
1119 for( std::pair<const PCB_LAYER_ID, std::shared_ptr<SHAPE_POLY_SET>>& pair : m_FilledPolysList )
1120 {
1121 std::shared_ptr<SHAPE_POLY_SET>& poly = pair.second;
1122
1123 for( int i = 0; i < poly->OutlineCount(); i++ )
1124 {
1125 m_area += poly->Outline( i ).Area();
1126
1127 for( int j = 0; j < poly->HoleCount( i ); j++ )
1128 m_area -= poly->Hole( i, j ).Area();
1129 }
1130 }
1131
1132 return m_area;
1133}

References m_area, and m_FilledPolysList.

Referenced by TEARDROP_MANAGER::createTeardrop().

◆ CalculateOutlineArea()

double ZONE::CalculateOutlineArea ( )

Compute the area of the zone outline (not the filled area).

Returns
the currently calculated area

Definition at line 1136 of file zone.cpp.

1137{
1139 return m_outlinearea;
1140}
double Area()
Count the number of arc shapes present.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:401

References std::abs(), SHAPE_POLY_SET::Area(), m_outlinearea, and m_Poly.

◆ CIterateWithHoles()

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

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

Returns
an iterator to visit the zone vertices with holes.

Definition at line 514 of file zone.h.

515 {
516 return m_Poly->CIterateWithHoles();
517 }
CONST_ITERATOR CIterateWithHoles(int aOutline) const

References SHAPE_POLY_SET::CIterateWithHoles(), and m_Poly.

◆ ClassOf()

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

Definition at line 74 of file zone.h.

75 {
76 return aItem && aItem->Type() == PCB_ZONE_T;
77 }
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:111

References PCB_ZONE_T, and EDA_ITEM::Type().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 136 of file eda_item.h.

void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:157
#define BRIGHTENED
item is drawn with a bright contour

References BRIGHTENED, and EDA_ITEM::ClearFlags().

Referenced by SCH_EDIT_FRAME::FocusOnItem(), PCB_BASE_FRAME::FocusOnItems(), EE_SELECTION_TOOL::unhighlight(), PL_SELECTION_TOOL::unhighlight(), PCB_SELECTION_TOOL::unhighlightInternal(), and SCH_EDITOR_CONTROL::UpdateNetHighlighting().

◆ ClearEditFlags()

◆ ClearFlags()

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

Definition at line 157 of file eda_item.h.

157{ m_flags &= ~aMask; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:512

References EDA_ITEM::m_flags.

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

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 169 of file eda_item.h.

170 {
172 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
#define SELECTED_BY_DRAG
Item was algorithmically selected as a dragged item.
#define DO_NOT_DRAW
Used to disable draw function.
#define SKIP_STRUCT
flag indicating that the structure should be ignored
#define CANDIDATE
flag indicating that the structure is connected

References CANDIDATE, EDA_ITEM::ClearFlags(), DO_NOT_DRAW, IS_LINKED, SELECTED_BY_DRAG, and SKIP_STRUCT.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles(), and SCH_EDIT_FRAME::PutDataInPreviousState().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 143 of file view_item.h.

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

References KIGFX::VIEW_ITEM::m_viewPrivData.

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

◆ Clone()

EDA_ITEM * ZONE::Clone ( ) const
overridevirtual

Create a duplicate of this item with linked list members set to NULL.

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

Returns
A clone of the item.

Reimplemented from EDA_ITEM.

Reimplemented in FP_ZONE.

Definition at line 177 of file zone.cpp.

178{
179 return new ZONE( *this );
180}
ZONE(BOARD_ITEM_CONTAINER *parent, bool aInFP=false)
The ctor to build ZONE, but compatible with FP_ZONE requirement.
Definition: zone.cpp:43

References ZONE().

◆ DeleteStructure()

void BOARD_ITEM::DeleteStructure ( )
inherited

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

Definition at line 144 of file board_item.cpp.

145{
147
148 if( parent )
149 parent->Remove( this );
150
151 delete this;
152}
Abstract interface for BOARD_ITEMs capable of storing other items inside.
virtual void Remove(BOARD_ITEM *aItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL)=0
Removes an item from the container.
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:152

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

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

◆ Duplicate()

BOARD_ITEM * BOARD_ITEM::Duplicate ( ) const
virtualinherited

Create a copy of this BOARD_ITEM.

Reimplemented in FOOTPRINT.

Definition at line 160 of file board_item.cpp.

161{
162 BOARD_ITEM* dupe = static_cast<BOARD_ITEM*>( Clone() );
163 const_cast<KIID&>( dupe->m_Uuid ) = KIID();
164
165 if( dupe->GetParentGroup() )
166 dupe->GetParentGroup()->AddItem( dupe );
167
168 return static_cast<BOARD_ITEM*>( dupe );
169}
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:52
PCB_GROUP * GetParentGroup() const
Definition: board_item.h:64
const KIID m_Uuid
Definition: eda_item.h:506
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition: eda_item.cpp:82
Definition: kiid.h:47
bool AddItem(BOARD_ITEM *aItem)
Add item to group.
Definition: pcb_group.cpp:39

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

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

◆ Flip()

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

Flip this object, i.e.

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

Parameters
aCentreis the rotation point.

Reimplemented from BOARD_ITEM.

Definition at line 631 of file zone.cpp.

632{
633 Mirror( aCentre, aFlipLeftRight );
634
635 SetLayerSet( FlipLayerMask( GetLayerSet(), GetBoard()->GetCopperLayerCount() ) );
636}
void Mirror(const VECTOR2I &aMirrorRef, bool aMirrorLeftRight)
Mirror the outlines relative to a given horizontal axis the layer is not changed.
Definition: zone.cpp:639
void SetLayerSet(LSET aLayerSet) override
Definition: zone.cpp:257
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: zone.h:115
LSET FlipLayerMask(LSET aMask, int aCopperLayersCount)
Calculate the mask layer when flipping a footprint.
Definition: lset.cpp:590

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

◆ Get() [1/3]

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

Definition at line 104 of file inspectable.h.

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

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

◆ Get() [2/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty) const
inlineinherited

Definition at line 84 of file inspectable.h.

85 {
87 const void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
88 return object ? aProperty->getter( object ) : wxAny();
89 }
virtual wxAny getter(const void *aObject) const =0

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

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

◆ Get() [3/3]

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

Definition at line 92 of file inspectable.h.

93 {
95 const void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
96
97 if( !object )
98 throw std::runtime_error( "Could not cast INSPECTABLE to the requested type" );
99
100 return aProperty->get<T>( object );
101 }

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

◆ GetAssignedPriority()

◆ GetBoard() [1/2]

BOARD * BOARD_ITEM::GetBoard ( )
virtualinherited

Definition at line 51 of file board_item.cpp.

52{
53 if( Type() == PCB_T )
54 return static_cast<BOARD*>( this );
55
56 BOARD_ITEM* parent = GetParent();
57
58 if( parent )
59 return parent->GetBoard();
60
61 return nullptr;
62}
@ PCB_T
Definition: typeinfo.h:82

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

◆ GetBoard() [2/2]

const BOARD * BOARD_ITEM::GetBoard ( ) const
virtualinherited

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

Definition at line 37 of file board_item.cpp.

38{
39 if( Type() == PCB_T )
40 return static_cast<const BOARD*>( this );
41
42 BOARD_ITEM* parent = GetParent();
43
44 if( parent )
45 return parent->GetBoard();
46
47 return nullptr;
48}

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

Referenced by ZONE_FILLER::addHoleKnockout(), BOARD_ADAPTER::addShape(), FOOTPRINT::BuildCourtyardCaches(), PAD::BuildEffectivePolygon(), PAD::BuildEffectiveShapes(), BuildSmoothedPoly(), collidesWithArea(), KIGFX::PCB_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), enclosedByAreaFunc(), existsOnLayerFunc(), PAD::FlashLayer(), PCB_VIA::FlashLayer(), FP_SHAPE::Flip(), FP_TEXT::Flip(), FP_TEXTBOX::Flip(), PCB_DIMENSION_BASE::Flip(), PCB_SHAPE::Flip(), PCB_TARGET::Flip(), PCB_TEXT::Flip(), PCB_TEXTBOX::Flip(), PCB_TRACK::Flip(), PCB_ARC::Flip(), PCB_VIA::Flip(), Flip(), fromToFunc(), BOARD_ITEM::GetBoard(), PCB_EXPR_CONTEXT::GetBoard(), NETINFO_ITEM::GetBoundingBox(), FOOTPRINT::GetBoundingBox(), FOOTPRINT::GetBoundingHull(), FOOTPRINT::GetCourtyard(), BOARD_CONNECTED_ITEM::GetEffectiveNetClass(), PCB_VIA::GetEffectiveShape(), getFieldFunc(), GetInteractingZones(), BOARD_ITEM::GetLayerName(), PCB_VIA::GetMinAnnulus(), NETINFO_ITEM::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfo(), GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), BOARD_CONNECTED_ITEM::GetOwnClearance(), PAD::GetOwnClearance(), GetSelectMenuText(), PCB_MARKER::GetSeverity(), FP_TEXT::GetShownText(), FP_TEXTBOX::GetShownText(), PAD::GetSolderMaskExpansion(), PCB_VIA::GetSolderMaskExpansion(), PAD::GetSolderPasteMargin(), BOARD::GetTrackLength(), PCB_TRACK::GetWidthConstraint(), inDiffPairFunc(), intersectsAreaFunc(), intersectsBackCourtyardFunc(), intersectsCourtyardFunc(), intersectsFrontCourtyardFunc(), BOARD_ITEM::IsLocked(), PCB_VIA::IsTented(), BOARD_ITEM::layerMaskDescribe(), PCB_VIA::layerMaskDescribe(), PAD::MergePrimitivesAsPolygon(), DIALOG_TEXTBOX_PROPERTIES::onBorderChecked(), EAGLE_PLUGIN::packageWire(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), BOARD::ResolveDRCExclusions(), BOARD_CONNECTED_ITEM::SetNetCode(), TEARDROP_DIALOG::TEARDROP_DIALOG(), DRC_TEST_PROVIDER_SOLDER_MASK::testItemAgainstItems(), CONNECTIVITY_DATA::TestTrackEndpointDangling(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow(), TransformSmoothedOutlineToPolygon(), FOOTPRINT::ViewBBox(), PCB_TRACK::ViewBBox(), PAD::ViewGetLOD(), PCB_BITMAP::ViewGetLOD(), and PCB_VIA::ViewGetLOD().

◆ GetBorderHatchPitch()

int ZONE::GetBorderHatchPitch ( ) const

HatchBorder related methods.

Returns
the zone hatch pitch in iu.

Definition at line 750 of file zone.cpp.

751{
752 return m_borderHatchPitch;
753}

References m_borderHatchPitch.

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

◆ GetBoundingBox()

const BOX2I ZONE::GetBoundingBox ( ) const
overridevirtual
Returns
the bounding box of the zone outline.

Reimplemented from EDA_ITEM.

Definition at line 309 of file zone.cpp.

310{
311 return m_Poly->BBox();
312}
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.

References SHAPE_POLY_SET::BBox(), and m_Poly.

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

◆ GetCachedBoundingBox()

◆ GetCenter()

virtual VECTOR2I BOARD_ITEM::GetCenter ( ) const
inlinevirtualinherited

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

Returns
center point of the item

Reimplemented in PAD, PCB_MARKER, PCB_SHAPE, and PCB_ARC.

Definition at line 85 of file board_item.h.

86 {
87 return GetBoundingBox().GetCenter();
88 }
const Vec GetCenter() const
Definition: box2.h:195
virtual const BOX2I GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
Definition: eda_item.cpp:74

References EDA_ITEM::GetBoundingBox(), and BOX2< Vec >::GetCenter().

Referenced by PCB_GRID_HELPER::computeAnchors(), PCB_SELECTION_TOOL::FindItem(), and ALTIUM_PCB::HelperParseDimensions6Radial().

◆ GetClass()

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

Implements EDA_ITEM.

Definition at line 476 of file zone.h.

477 {
478 return wxT( "ZONE" );
479 }

◆ GetCornerPosition()

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

Definition at line 524 of file zone.h.

525 {
527
528 // Convert global to relative indices
529 if( !m_Poly->GetRelativeIndices( aCornerIndex, &index ) )
530 throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
531
532 return m_Poly->CVertex( index );
533 }
bool GetRelativeIndices(int aGlobalIdx, VERTEX_INDEX *aRelativeIndices) const
Convert a global vertex index —i.e., a number that globally identifies a vertex in a concatenated lis...
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the aGlobalIndex-th vertex in the poly set.
Structure to hold the necessary information in order to index a vertex on a SHAPE_POLY_SET object: th...

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

Referenced by GetPosition().

◆ GetCornerRadius()

unsigned int ZONE::GetCornerRadius ( ) const
inline

Definition at line 646 of file zone.h.

646{ return m_cornerRadius; }

References m_cornerRadius.

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

◆ GetCornerSmoothingType()

int ZONE::GetCornerSmoothingType ( ) const
inline

◆ GetDefaultHatchPitch()

◆ GetDoNotAllowCopperPour()

bool ZONE::GetDoNotAllowCopperPour ( ) const
inline

◆ GetDoNotAllowFootprints()

bool ZONE::GetDoNotAllowFootprints ( ) const
inline

◆ GetDoNotAllowPads()

bool ZONE::GetDoNotAllowPads ( ) const
inline

◆ GetDoNotAllowTracks()

bool ZONE::GetDoNotAllowTracks ( ) const
inline

◆ GetDoNotAllowVias()

bool ZONE::GetDoNotAllowVias ( ) const
inline

◆ GetEditFlags()

EDA_ITEM_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 161 of file eda_item.h.

162 {
163 constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVING | IS_RESIZING | IS_DRAGGING
165
166 return m_flags & mask;
167 }
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
#define IS_CHANGED
Item was edited, and modified.
#define IS_NEW
New item, just created.
#define IS_DRAGGING
Item being dragged.
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
#define STRUCT_DELETED
flag indication structures to be erased
#define IS_MOVING
Item being moved.
#define IS_RESIZING
Item being resized.

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

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

◆ GetEffectiveHoleShape()

std::shared_ptr< SHAPE_SEGMENT > BOARD_ITEM::GetEffectiveHoleShape ( ) const
virtualinherited

Reimplemented in PAD, and PCB_VIA.

Definition at line 207 of file board_item.cpp.

208{
209 static std::shared_ptr<SHAPE_SEGMENT> slot;
210
212
213 return slot;
214}
virtual wxString GetClass() const =0
Return the class name.
#define UNIMPLEMENTED_FOR(type)
Definition: macros.h:120

References EDA_ITEM::GetClass(), and UNIMPLEMENTED_FOR.

Referenced by collidesWithArea(), DRAWING_TOOL::DrawVia(), DRC_RTREE::Insert(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::testAgainstEdge(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testItemAgainstItem(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZone(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testItemAgainstZones(), and PCB_CONTROL::UpdateMessagePanel().

◆ GetEffectiveNetClass()

NETCLASS * BOARD_CONNECTED_ITEM::GetEffectiveNetClass ( ) const
virtualinherited

Return the NETCLASS for this item.

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

Definition at line 97 of file board_connected_item.cpp.

98{
100 return m_netinfo->GetNetClass();
101 else
102 return GetBoard()->GetDesignSettings().m_NetSettings->m_DefaultNetClass.get();
103}
NETINFO_ITEM * m_netinfo
Store all information about the net that item belongs to.
std::shared_ptr< NET_SETTINGS > m_NetSettings
NETCLASS * GetNetClass()
Definition: netinfo.h:111

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

Referenced by PCB_VIA::GetDrillValue(), BOARD_INSPECTION_TOOL::getItemDescription(), PAD::GetMsgPanelInfo(), GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetClassName(), PCB_EXPR_NETCLASS_REF::GetValue(), PCB_EDIT_FRAME::SetTrackSegmentWidth(), DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow(), and DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem().

◆ GetEffectiveShape()

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

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

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

Note
This list can contain a SHAPE_SIMPLE (a simple single-outline non-intersecting polygon), but should never contain a SHAPE_POLY_SET (a complex polygon consisting of multiple outlines and/or holes).
Parameters
aLayerin case of items spanning multiple layers, only the shapes belonging to aLayer will be returned. Pass UNDEFINED_LAYER to return shapes for all layers.

Reimplemented from BOARD_ITEM.

Definition at line 1229 of file zone.cpp.

1230{
1231 if( m_FilledPolysList.find( aLayer ) == m_FilledPolysList.end() )
1232 return std::make_shared<SHAPE_NULL>();
1233 else
1234 return m_FilledPolysList.at( aLayer );
1235}

References m_FilledPolysList.

◆ GetFill()

◆ GetFilledArea()

double ZONE::GetFilledArea ( )
inline

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

Returns
the filled area

Definition at line 208 of file zone.h.

209 {
210 return m_area;
211 }

References m_area.

◆ GetFilledPolysList()

◆ GetFillFlag()

int ZONE::GetFillFlag ( PCB_LAYER_ID  aLayer)
inline

Definition at line 228 of file zone.h.

229 {
230 return m_fillFlags.test( aLayer );
231 }
LSET m_fillFlags
Definition: zone.h:873

References m_fillFlags.

◆ GetFillMode()

ZONE_FILL_MODE ZONE::GetFillMode ( ) const
inline

Definition at line 167 of file zone.h.

167{ return m_fillMode; }
ZONE_FILL_MODE m_fillMode
How to fill areas:
Definition: zone.h:843

References m_fillMode.

Referenced by KI_TEST::CheckFpZone(), ZONE_FILLER::fillCopperZone(), ZONE_FILLER::fillNonCopperZone(), PCB_PLUGIN::format(), IsSame(), ZONE_SETTINGS::operator<<(), and zonesNeedUpdate().

◆ GetFirstLayer()

PCB_LAYER_ID ZONE::GetFirstLayer ( ) const

◆ GetFlags()

◆ GetFocusPosition()

virtual const VECTOR2I EDA_ITEM::GetFocusPosition ( ) const
inlinevirtualinherited

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

Reimplemented in BOARD, PCB_SHAPE, and PCB_TRACK.

Definition at line 270 of file eda_item.h.

270{ return GetPosition(); }
virtual VECTOR2I GetPosition() const
Definition: eda_item.h:263

References EDA_ITEM::GetPosition().

Referenced by SCH_EDIT_FRAME::FocusOnItem().

◆ GetHashValue()

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

Definition at line 342 of file zone.cpp.

343{
344 if( !m_filledPolysHash.count( aLayer ) )
345 return g_nullPoly.GetHash();
346 else
347 return m_filledPolysHash.at( aLayer );
348}

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

◆ GetHatchBorderAlgorithm()

int ZONE::GetHatchBorderAlgorithm ( ) const
inline

◆ GetHatchGap()

int ZONE::GetHatchGap ( ) const
inline

◆ GetHatchHoleMinArea()

double ZONE::GetHatchHoleMinArea ( ) const
inline

◆ GetHatchLines()

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

Definition at line 755 of file zone.h.

755{ return m_borderHatchLines; }
std::vector< SEG > m_borderHatchLines
Definition: zone.h:880

References m_borderHatchLines.

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

◆ GetHatchOrientation()

EDA_ANGLE ZONE::GetHatchOrientation ( ) const
inline

◆ GetHatchSmoothingLevel()

int ZONE::GetHatchSmoothingLevel ( ) const
inline

◆ GetHatchSmoothingValue()

double ZONE::GetHatchSmoothingValue ( ) const
inline

◆ GetHatchStyle()

ZONE_BORDER_DISPLAY_STYLE ZONE::GetHatchStyle ( ) const
inline

Definition at line 574 of file zone.h.

574{ return m_borderStyle; }

References m_borderStyle.

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

◆ GetHatchThickness()

int ZONE::GetHatchThickness ( ) const
inline

◆ GetInteractingZones()

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

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

The copper pour will end up effectively merged though, so we need to do some calculations with them in mind.

Definition at line 972 of file zone.cpp.

973{
974 int epsilon = pcbIUScale.mmToIU( 0.001 );
976
977 bbox.Inflate( epsilon );
978
979 for( ZONE* candidate : GetBoard()->Zones() )
980 {
981 if( candidate == this )
982 continue;
983
984 if( !candidate->GetLayerSet().test( aLayer ) )
985 continue;
986
987 if( candidate->GetIsRuleArea() )
988 continue;
989
990 if( candidate->GetNetCode() != GetNetCode() )
991 continue;
992
993 if( !candidate->GetCachedBoundingBox().Intersects( bbox ) )
994 continue;
995
996 for( auto iter = m_Poly->CIterate(); iter; iter++ )
997 {
998 if( candidate->m_Poly->Collide( iter.Get(), epsilon ) )
999 {
1000 aZones->push_back( candidate );
1001 break;
1002 }
1003 }
1004 }
1005}
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:506
CONST_ITERATOR CIterate(int aFirst, int aLast, bool aIterateHoles=false) const
const BOX2I GetCachedBoundingBox() const
ONLY TO BE USED BY CLIENTS WHICH SET UP THE CACHE!
Definition: zone.h:133
constexpr int mmToIU(double mm) const
Definition: base_units.h:89

References SHAPE_POLY_SET::CIterate(), BOARD_ITEM::GetBoard(), GetCachedBoundingBox(), BOARD_CONNECTED_ITEM::GetNetCode(), BOX2< Vec >::Inflate(), m_Poly, EDA_IU_SCALE::mmToIU(), and pcbIUScale.

Referenced by BuildSmoothedPoly().

◆ GetIslandRemovalMode()

const ISLAND_REMOVAL_MODE ZONE::GetIslandRemovalMode ( ) const
inline

◆ GetIsRuleArea()

◆ GetLayer()

PCB_LAYER_ID ZONE::GetLayer ( ) const
overridevirtual

Return the primary layer this item is on.

Reimplemented from BOARD_ITEM.

Definition at line 230 of file zone.cpp.

231{
232 return BOARD_ITEM::GetLayer();
233}
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:169

References BOARD_ITEM::GetLayer().

Referenced by DRAWING_TOOL::DrawZone(), and BOARD_EDITOR_CONTROL::ZoneDuplicate().

◆ GetLayerName()

wxString BOARD_ITEM::GetLayerName ( ) const
inherited

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

Returns
the layer name associated with this item.

Definition at line 88 of file board_item.cpp.

89{
90 const BOARD* board = GetBoard();
91
92 if( board )
93 return board->GetLayerName( m_layer );
94
95 // If no parent, return standard name
97}
PCB_LAYER_ID m_layer
Definition: board_item.h:319
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition: board.h:689
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:384

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

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

◆ GetLayerSet()

◆ GetLocalClearance() [1/2]

int ZONE::GetLocalClearance ( ) const
inline

Definition at line 145 of file zone.h.

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

References GetLocalClearance().

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

◆ GetLocalClearance() [2/2]

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

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

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

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

Reimplemented from BOARD_CONNECTED_ITEM.

Definition at line 425 of file zone.cpp.

426{
427 if( m_isRuleArea )
428 return 0;
429
430 if( aSource )
431 *aSource = _( "zone" );
432
433 return m_ZoneClearance;
434}
int m_ZoneClearance
Definition: zone.h:811
#define _(s)

References _, m_isRuleArea, and m_ZoneClearance.

Referenced by ZONE_FILLER::buildThermalSpokes(), CADSTAR_PCB_ARCHIVE_LOADER::calculateZonePriorities(), KI_TEST::CheckFpZone(), PCB_PLUGIN::format(), BOARD_INSPECTION_TOOL::InspectClearance(), ZONE_FILLER::knockoutThermalReliefs(), ZONE_SETTINGS::operator<<(), and zonesNeedUpdate().

◆ GetLocalClearanceOverrides()

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

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

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

Reimplemented in PAD.

Definition at line 142 of file board_connected_item.h.

142{ return 0; }

Referenced by DRC_ENGINE::EvalRules().

◆ GetLocalFlags()

int ZONE::GetLocalFlags ( ) const
inline

Definition at line 302 of file zone.h.

302{ return m_localFlgs; }
int m_localFlgs
Definition: zone.h:859

References m_localFlgs.

Referenced by InitDataFromSrcInCopyCtor().

◆ GetLocalRatsnestVisible()

bool BOARD_CONNECTED_ITEM::GetLocalRatsnestVisible ( ) const
inlineinherited

◆ GetLock()

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

Definition at line 223 of file zone.h.

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

References m_lock.

Referenced by ZONE_FILLER::Fill().

◆ GetMenuImage()

BITMAPS ZONE::GetMenuImage ( ) const
overridevirtual

Return a pointer to an image to be used in menus.

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

Returns
The menu image associated with the item.

Reimplemented from EDA_ITEM.

Definition at line 929 of file zone.cpp.

930{
931 return BITMAPS::add_zone;
932}

References add_zone.

◆ GetMinIslandArea()

long long int ZONE::GetMinIslandArea ( ) const
inline

Definition at line 708 of file zone.h.

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

References m_minIslandArea.

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

◆ GetMinThickness()

◆ GetMsgPanelInfo()

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

Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.

Parameters
aListis the list to populate.

Reimplemented from EDA_ITEM.

Definition at line 476 of file zone.cpp.

477{
478 wxString msg;
479
480 if( GetIsRuleArea() )
481 msg = _( "Rule Area" );
482 else if( IsTeardropArea() )
483 msg = _( "Teardrop Area" );
484 else if( IsOnCopperLayer() )
485 msg = _( "Copper Zone" );
486 else
487 msg = _( "Non-copper Zone" );
488
489 // Display Cutout instead of Outline for holes inside a zone (i.e. when num contour !=0).
490 // Check whether the selected corner is in a hole; i.e., in any contour but the first one.
491 if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
492 msg << wxT( " " ) << _( "Cutout" );
493
494 aList.emplace_back( _( "Type" ), msg );
495
496 if( GetIsRuleArea() )
497 {
498 msg.Empty();
499
500 if( GetDoNotAllowVias() )
501 AccumulateDescription( msg, _( "No vias" ) );
502
503 if( GetDoNotAllowTracks() )
504 AccumulateDescription( msg, _( "No tracks" ) );
505
506 if( GetDoNotAllowPads() )
507 AccumulateDescription( msg, _( "No pads" ) );
508
510 AccumulateDescription( msg, _( "No copper zones" ) );
511
513 AccumulateDescription( msg, _( "No footprints" ) );
514
515 if( !msg.IsEmpty() )
516 aList.emplace_back( _( "Restrictions" ), msg );
517 }
518 else if( IsOnCopperLayer() )
519 {
520 if( aFrame->GetName() == PCB_EDIT_FRAME_NAME )
521 {
522 aList.emplace_back( _( "Net" ), UnescapeString( GetNetname() ) );
523
524 aList.emplace_back( _( "Resolved Netclass" ),
525 UnescapeString( GetEffectiveNetClass()->GetName() ) );
526 }
527
528 // Display priority level
529 aList.emplace_back( _( "Priority" ),
530 wxString::Format( wxT( "%d" ), GetAssignedPriority() ) );
531 }
532
533 if( aFrame->GetName() == PCB_EDIT_FRAME_NAME )
534 {
535 if( IsLocked() )
536 aList.emplace_back( _( "Status" ), _( "Locked" ) );
537 }
538
539 wxString layerDesc;
540 int count = 0;
541
542 for( PCB_LAYER_ID layer : m_layerSet.Seq() )
543 {
544 if( count == 0 )
545 layerDesc = GetBoard()->GetLayerName( layer );
546
547 count++;
548 }
549
550 if( count > 1 )
551 layerDesc.Printf( _( "%s and %d more" ), layerDesc, count - 1 );
552
553 aList.emplace_back( _( "Layer" ), layerDesc );
554
555 if( !m_zoneName.empty() )
556 aList.emplace_back( _( "Name" ), m_zoneName );
557
558 switch( m_fillMode )
559 {
560 case ZONE_FILL_MODE::POLYGONS: msg = _( "Solid" ); break;
561 case ZONE_FILL_MODE::HATCH_PATTERN: msg = _( "Hatched" ); break;
562 default: msg = _( "Unknown" ); break;
563 }
564
565 aList.emplace_back( _( "Fill Mode" ), msg );
566
567 aList.emplace_back( _( "Filled Area" ),
569
570 wxString source;
571 int clearance = GetOwnClearance( UNDEFINED_LAYER, &source );
572
573 if( !source.IsEmpty() )
574 {
575 aList.emplace_back( wxString::Format( _( "Min Clearance: %s" ),
576 aFrame->MessageTextFromValue( clearance ) ),
577 wxString::Format( _( "(from %s)" ),
578 source ) );
579 }
580
581 if( !m_FilledPolysList.empty() )
582 {
583 count = 0;
584
585 for( std::pair<const PCB_LAYER_ID, std::shared_ptr<SHAPE_POLY_SET>>& ii: m_FilledPolysList )
586 count += ii.second->TotalVertices();
587
588 aList.emplace_back( _( "Corner Count" ), wxString::Format( wxT( "%d" ), count ) );
589 }
590}
virtual NETCLASS * GetEffectiveNetClass() const
Return the NETCLASS for this item.
virtual int GetOwnClearance(PCB_LAYER_ID aLayer, wxString *aSource=nullptr) const
Return an item's "own" clearance in internal units.
virtual bool IsLocked() const
Definition: board_item.cpp:65
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:411
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A lower-precision version of StringFromValue().
bool GetDoNotAllowVias() const
Definition: zone.h:693
bool GetDoNotAllowPads() const
Definition: zone.h:695
bool GetDoNotAllowTracks() const
Definition: zone.h:694
bool GetDoNotAllowFootprints() const
Definition: zone.h:696
bool GetDoNotAllowCopperPour() const
Definition: zone.h:692
bool IsOnCopperLayer() const override
Definition: zone.cpp:245
unsigned GetAssignedPriority() const
Definition: zone.h:106
#define PCB_EDIT_FRAME_NAME
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
wxString UnescapeString(const wxString &aSource)
void AccumulateDescription(wxString &aDesc, const wxString &aItem)
Utility to build comma separated lists in messages.
Definition: string_utils.h:322

References _, AccumulateDescription(), AREA, Format(), GetAssignedPriority(), BOARD_ITEM::GetBoard(), GetDoNotAllowCopperPour(), GetDoNotAllowFootprints(), GetDoNotAllowPads(), GetDoNotAllowTracks(), GetDoNotAllowVias(), BOARD_CONNECTED_ITEM::GetEffectiveNetClass(), GetIsRuleArea(), BOARD::GetLayerName(), BOARD_CONNECTED_ITEM::GetNetname(), BOARD_CONNECTED_ITEM::GetOwnClearance(), HATCH_PATTERN, BOARD_ITEM::IsLocked(), IsOnCopperLayer(), IsTeardropArea(), m_area, SHAPE_POLY_SET::VERTEX_INDEX::m_contour, m_CornerSelection, m_FilledPolysList, m_fillMode, m_layerSet, m_zoneName, UNITS_PROVIDER::MessageTextFromValue(), PCB_EDIT_FRAME_NAME, POLYGONS, LSET::Seq(), UNDEFINED_LAYER, and UnescapeString().

◆ GetNet()

◆ GetNetClassName()

wxString BOARD_CONNECTED_ITEM::GetNetClassName ( ) const
inherited

Returns the name of the effective netclass.

Primarily for the use of the property system.

Definition at line 106 of file board_connected_item.cpp.

107{
108 return GetEffectiveNetClass()->GetName();
109}
const wxString GetName() const
Definition: netclass.h:65

References BOARD_CONNECTED_ITEM::GetEffectiveNetClass(), and NETCLASS::GetName().

Referenced by BOARD_CONNECTED_ITEM_DESC::BOARD_CONNECTED_ITEM_DESC(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), and main().

◆ GetNetCode()

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

Definition at line 89 of file board_connected_item.cpp.

90{
91 return m_netinfo ? m_netinfo->GetNetCode() : -1;
92}
int GetNetCode() const
Definition: netinfo.h:113

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

Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), BOARD_CONNECTED_ITEM_DESC::BOARD_CONNECTED_ITEM_DESC(), ZONE_FILLER::buildCopperItemClearances(), KI_TEST::CheckFpPad(), KI_TEST::CheckFpZone(), connectedItemFilter(), CreateRoutesSection(), TEARDROP_MANAGER::createTeardrop(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), KIGFX::PCB_PAINTER::draw(), DRAWING_TOOL::DrawVia(), PCB_EDIT_FRAME::ExchangeFootprint(), PNS::NODE::FindItemByParent(), TEARDROP_MANAGER::findTouchingTrack(), PCB_PLUGIN::format(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), CONNECTIVITY_DATA::GetConnectedItems(), GetInteractingZones(), PCB_TRACK::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), CONNECTIVITY_DATA::GetRatsnestForPad(), BOARD_INSPECTION_TOOL::highlightNet(), DIALOG_PAD_PROPERTIES::initValues(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectDRCError(), CONNECTIVITY_DATA::IsConnectedOnLayer(), IsIsland(), IsSame(), TEARDROP_MANAGER::isViaAndTrackInSameZone(), ZONE_FILLER::knockoutThermalReliefs(), CN_CONNECTIVITY_ALGO::markItemNetAsDirty(), AR_AUTOPLACER::nearestPad(), ROUTER_TOOL::NeighboringSegmentFilter(), CN_ITEM::Net(), DIALOG_DRC::OnDRCItemSelected(), PCB_TRACK::cmp_tracks::operator()(), ZONE_SETTINGS::operator<<(), DIALOG_PAD_PROPERTIES::PadTypeSelected(), process(), BOARD_EDITOR_CONTROL::RepairBoard(), DRC_TEST_PROVIDER_CONNECTION_WIDTH::Run(), DRC_TEST_PROVIDER_MATCHED_LENGTH::runInternal(), SameNet(), PCB_SELECTION_CONDITIONS::sameNetFunc(), SaveCopyOfZones(), PCB_SELECTION_TOOL::selectNet(), PNS_KICAD_IFACE_BASE::syncArc(), PNS_KICAD_IFACE_BASE::syncPad(), PNS_KICAD_IFACE_BASE::syncTrack(), PNS_KICAD_IFACE_BASE::syncVia(), DRC_TEST_PROVIDER_SOLDER_MASK::testItemAgainstItems(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZone(), DRC_TEST_PROVIDER_SOLDER_MASK::testMaskItemAgainstZones(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackAgainstItem(), DRC_TEST_PROVIDER_ZONE_CONNECTIONS::testZoneLayer(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZonesToZones(), BOARD::TracksInNet(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow(), PCB_CONTROL::UpdateMessagePanel(), VIAPAD::VIAPAD(), PCB_TRACK::ViewGetLOD(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), and BOARD_EDITOR_CONTROL::ZoneMerge().

◆ GetNetname()

◆ GetNetnameMsg()

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

Definition at line 118 of file board_connected_item.cpp.

119{
120 if( !GetBoard() )
121 return wxT( "[** NO BOARD DEFINED **]" );
122
123 wxString netname = GetNetname();
124
125 if( !netname.length() )
126 return wxT( "[<no net>]" );
127 else if( GetNetCode() < 0 )
128 return wxT( "[" ) + UnescapeString( netname ) + wxT( "](" ) + _( "Not Found" ) + wxT( ")" );
129 else
130 return wxT( "[" ) + UnescapeString( netname ) + wxT( "]" );
131}

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

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

◆ GetNumCorners()

int ZONE::GetNumCorners ( void  ) const
inline

Access to m_Poly parameters.

Definition at line 484 of file zone.h.

485 {
486 return m_Poly->TotalVertices();
487 }
int TotalVertices() const
Delete aIdx-th polygon from the set.

References m_Poly, and SHAPE_POLY_SET::TotalVertices().

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

◆ GetOutlineArea()

double ZONE::GetOutlineArea ( )
inline

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

Returns
the outline area

Definition at line 218 of file zone.h.

219 {
220 return m_outlinearea;
221 }

References m_outlinearea.

Referenced by TEARDROP_MANAGER::setTeardropPriorities().

◆ GetOwnClearance()

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

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

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

Reimplemented in PAD.

Definition at line 66 of file board_connected_item.cpp.

67{
68 DRC_CONSTRAINT constraint;
69
70 if( GetBoard() && GetBoard()->GetDesignSettings().m_DRCEngine )
71 {
73
74 constraint = bds.m_DRCEngine->EvalRules( CLEARANCE_CONSTRAINT, this, nullptr, aLayer );
75 }
76
77 if( constraint.Value().HasMin() )
78 {
79 if( aSource )
80 *aSource = constraint.GetName();
81
82 return constraint.Value().Min();
83 }
84
85 return 0;
86}
std::shared_ptr< DRC_ENGINE > m_DRCEngine
wxString GetName() const
Definition: drc_rule.h:147
MINOPTMAX< int > & Value()
Definition: drc_rule.h:140
T Min() const
Definition: minoptmax.h:33
bool HasMin() const
Definition: minoptmax.h:37
@ CLEARANCE_CONSTRAINT
Definition: drc_rule.h:46

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

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

◆ GetPadConnection()

ZONE_CONNECTION ZONE::GetPadConnection ( ) const
inline

Definition at line 241 of file zone.h.

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

References m_PadConnection.

Referenced by KI_TEST::CheckFpZone(), DRC_ENGINE::EvalRules(), PCB_PLUGIN::format(), ZONE_SETTINGS::operator<<(), ZONE_DESC::ZONE_DESC(), and zonesNeedUpdate().

◆ GetParent()

BOARD_ITEM_CONTAINER * BOARD_ITEM::GetParent ( void  ) const
inlineinherited

Definition at line 152 of file board_item.h.

152{ return (BOARD_ITEM_CONTAINER*) m_parent; }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:510

References EDA_ITEM::m_parent.

Referenced by PCB_POINT_EDITOR::addCorner(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), PNS_KICAD_IFACE::Commit(), FOOTPRINT::CoverageRatio(), BOARD_ITEM::DeleteStructure(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), EDIT_TOOL::DragArcTrack(), KIGFX::PCB_PAINTER::draw(), EDIT_TOOL::Duplicate(), PCB_SELECTION_TOOL::FilterCollectorForFreePads(), PCB_SELECTION_TOOL::FilterCollectorForHierarchy(), PCB_PLUGIN::format(), FormatProbeItem(), BOARD_ITEM::GetBoard(), BOARD_ITEM::GetParentFootprint(), ALIGN_DISTRIBUTE_TOOL::GetSelections(), FP_TEXT::GetSelectMenuText(), FP_TEXTBOX::GetSelectMenuText(), FP_TEXT::GetShownText(), FP_TEXTBOX::GetShownText(), PCB_TEXT::GetShownText(), PCB_TEXTBOX::GetShownText(), getTopLevelGroup(), ALTIUM_PCB::HelperShapeSetLocalCoord(), GENERAL_COLLECTOR::Inspect(), FP_SHAPE::IsParentFlipped(), FP_TEXT::IsParentFlipped(), PCB_SELECTION_TOOL::itemPassesFilter(), memberOfFunc(), EDIT_TOOL::MoveExact(), BRDITEMS_PLOTTER::PlotFootprintShape(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BOARD_COMMIT::Push(), PCB_PARSER::resolveGroups(), PCB_BASE_EDIT_FRAME::saveCopyInUndoList(), CLIPBOARD_IO::SaveSelection(), PCB_SELECTION_TOOL::Selectable(), SwapItemData(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem(), FP_ZONE::ViewGetLOD(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ GetParentFootprint()

◆ GetParentGroup()

◆ GetPosition()

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

Reimplemented from EDA_ITEM.

Definition at line 224 of file zone.cpp.

225{
226 return GetCornerPosition( 0 );
227}
const VECTOR2I & GetCornerPosition(int aCornerIndex) const
Definition: zone.h:524

References GetCornerPosition().

Referenced by EAGLE_PLUGIN::loadPlain().

◆ GetSelectedCorner()

int ZONE::GetSelectedCorner ( ) const
inline

Definition at line 274 of file zone.h.

275 {
276 // Transform relative indices to global index
277 int globalIndex = -1;
278
280 m_Poly->GetGlobalIndex( *m_CornerSelection, globalIndex );
281
282 return globalIndex;
283 }
bool GetGlobalIndex(VERTEX_INDEX aRelativeIndices, int &aGlobalIdx) const
Compute the global index of a vertex from the relative indices of polygon, contour and vertex.

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

◆ GetSelectMenuText()

wxString ZONE::GetSelectMenuText ( UNITS_PROVIDER aUnitsProvider) const
overridevirtual

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

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

Returns
The menu text string.

Reimplemented from EDA_ITEM.

Definition at line 716 of file zone.cpp.

717{
718 wxString layerDesc;
719 int count = 0;
720
721 for( PCB_LAYER_ID layer : m_layerSet.Seq() )
722 {
723 if( count == 0 )
724 layerDesc = GetBoard()->GetLayerName( layer );
725
726 count++;
727 }
728
729 if( count > 1 )
730 layerDesc.Printf( _( "%s and %d more" ), layerDesc, count - 1 );
731
732 // Check whether the selected contour is a hole (contour index > 0)
733 if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
734 {
735 if( GetIsRuleArea() )
736 return wxString::Format( _( "Rule Area Cutout on %s" ), layerDesc );
737 else
738 return wxString::Format( _( "Zone Cutout on %s" ), layerDesc );
739 }
740 else
741 {
742 if( GetIsRuleArea() )
743 return wxString::Format( _( "Rule Area on %s" ), layerDesc );
744 else
745 return wxString::Format( _( "Zone %s on %s" ), GetNetnameMsg(), layerDesc );
746 }
747}
wxString GetNetnameMsg() const

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 DRC_ENGINE::EvalRules(), and PNS_KICAD_IFACE_BASE::syncZone().

◆ GetShortNetname()

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

Definition at line 134 of file board_connected_item.cpp.

135{
136 return m_netinfo->GetShortNetname();
137}
const wxString & GetShortNetname() const
Definition: netinfo.h:124

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

Referenced by KIGFX::PCB_PAINTER::draw(), PAD::IsFreePad(), and PAD::IsNoConnectPad().

◆ GetSortPosition()

virtual VECTOR2I EDA_ITEM::GetSortPosition ( ) const
inlinevirtualinherited

Return the coordinates that should be used for sorting this element visually compared to other elements.

For instance, for lines the midpoint might be a better sorting point than either end.

Returns
X,Y coordinate of the sort point

Reimplemented in SCH_LINE.

Definition at line 279 of file eda_item.h.

279{ return GetPosition(); }

References EDA_ITEM::GetPosition().

◆ GetState()

int EDA_ITEM::GetState ( EDA_ITEM_FLAGS  type) const
inlineinherited

Definition at line 140 of file eda_item.h.

141 {
142 return m_status & type;
143 }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:509

References EDA_ITEM::m_status.

◆ GetStatus()

EDA_ITEM_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 153 of file eda_item.h.

153{ return m_status; }

References EDA_ITEM::m_status.

◆ GetStroke()

STROKE_PARAMS BOARD_ITEM::GetStroke ( ) const
virtualinherited

Reimplemented in PCB_SHAPE.

Definition at line 76 of file board_item.cpp.

77{
78 wxCHECK( false, STROKE_PARAMS( pcbIUScale.mmToIU( DEFAULT_LINE_WIDTH ) ) );
79}
#define DEFAULT_LINE_WIDTH
Simple container to manage line stroke parameters.
Definition: stroke_params.h:88

References DEFAULT_LINE_WIDTH, EDA_IU_SCALE::mmToIU(), and pcbIUScale.

Referenced by PCB_BASE_EDIT_FRAME::ShowGraphicItemPropertiesDialog().

◆ GetTeardropAreaType()

TEARDROP_TYPE ZONE::GetTeardropAreaType ( ) const
inline
Returns
the type of the teardrop ( has meaning only if the zone is a teardrop area)

Definition at line 686 of file zone.h.

686{ return m_teardropType; }

References m_teardropType.

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

◆ GetThermalReliefGap() [1/2]

int ZONE::GetThermalReliefGap ( ) const
inline

◆ GetThermalReliefGap() [2/2]

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

Definition at line 315 of file zone.cpp.

316{
317 if( aPad->GetLocalThermalGapOverride() == 0 )
318 {
319 if( aSource )
320 *aSource = _( "zone" );
321
322 return m_thermalReliefGap;
323 }
324
325 return aPad->GetLocalThermalGapOverride( aSource );
326
327}
int GetLocalThermalGapOverride(wxString *aSource=nullptr) const
Definition: pad.cpp:925

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

◆ GetThermalReliefSpokeWidth()

int ZONE::GetThermalReliefSpokeWidth ( ) const
inline

◆ GetTypeDesc()

wxString EDA_ITEM::GetTypeDesc ( )
inherited

Return a translated description of the type for this EDA_ITEM for display in user facing messages.

Definition at line 301 of file eda_item.cpp.

302{
303 //@see EDA_ITEM_DESC for definition of ENUM_MAP<KICAD_T>
304 wxString typeDescr = ENUM_MAP<KICAD_T>::Instance().ToString( Type() );
305
306 return wxGetTranslation( typeDescr );
307}
static ENUM_MAP< T > & Instance()
Definition: property.h:512

References ENUM_MAP< T >::Instance(), and EDA_ITEM::Type().

Referenced by PROPERTIES_PANEL::update().

◆ GetX()

◆ GetY()

◆ GetZoneName()

◆ HasFilledPolysForLayer()

bool ZONE::HasFilledPolysForLayer ( PCB_LAYER_ID  aLayer) const
inline

Definition at line 588 of file zone.h.

589 {
590 return m_FilledPolysList.count( aLayer ) > 0;
591 }

References m_FilledPolysList.

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

◆ HasFlag()

◆ HasHole()

◆ HasLineStroke()

virtual bool BOARD_ITEM::HasLineStroke ( ) const
inlinevirtualinherited

Check if this item has line stoke properties.

See also
STROKE_PARAMS

Reimplemented in PCB_SHAPE.

Definition at line 161 of file board_item.h.

161{ return false; }

◆ HatchBorder()

void ZONE::HatchBorder ( )

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

Definition at line 791 of file zone.cpp.

792{
794
796 || m_borderHatchPitch == 0
797 || m_Poly->IsEmpty() )
798 {
799 return;
800 }
801
802 // define range for hatch lines
803 int min_x = m_Poly->CVertex( 0 ).x;
804 int max_x = m_Poly->CVertex( 0 ).x;
805 int min_y = m_Poly->CVertex( 0 ).y;
806 int max_y = m_Poly->CVertex( 0 ).y;
807
808 for( auto iterator = m_Poly->IterateWithHoles(); iterator; iterator++ )
809 {
810 if( iterator->x < min_x )
811 min_x = iterator->x;
812
813 if( iterator->x > max_x )
814 max_x = iterator->x;
815
816 if( iterator->y < min_y )
817 min_y = iterator->y;
818
819 if( iterator->y > max_y )
820 max_y = iterator->y;
821 }
822
823 // Calculate spacing between 2 hatch lines
824 int spacing;
825
827 spacing = m_borderHatchPitch;
828 else
829 spacing = m_borderHatchPitch * 2;
830
831 // set the "length" of hatch lines (the length on horizontal axis)
832 int hatch_line_len = m_borderHatchPitch;
833
834 // To have a better look, give a slope depending on the layer
835 int layer = GetFirstLayer();
836 int slope_flag = (layer & 1) ? 1 : -1; // 1 or -1
837 double slope = 0.707106 * slope_flag; // 45 degrees slope
838 int max_a, min_a;
839
840 if( slope_flag == 1 )
841 {
842 max_a = KiROUND( max_y - slope * min_x );
843 min_a = KiROUND( min_y - slope * max_x );
844 }
845 else
846 {
847 max_a = KiROUND( max_y - slope * max_x );
848 min_a = KiROUND( min_y - slope * min_x );
849 }
850
851 min_a = (min_a / spacing) * spacing;
852
853 // calculate an offset depending on layer number,
854 // for a better look of hatches on a multilayer board
855 int offset = (layer * 7) / 8;
856 min_a += offset;
857
858 // loop through hatch lines
859 std::vector<VECTOR2I> pointbuffer;
860 pointbuffer.reserve( 256 );
861
862 for( int a = min_a; a < max_a; a += spacing )
863 {
864 pointbuffer.clear();
865
866 // Iterate through all vertices
867 for( auto iterator = m_Poly->IterateSegmentsWithHoles(); iterator; iterator++ )
868 {
869 double x, y;
870
871 SEG segment = *iterator;
872
873 if( FindLineSegmentIntersection( a, slope, segment.A.x, segment.A.y, segment.B.x,
874 segment.B.y, x, y ) )
875 pointbuffer.emplace_back( KiROUND( x ), KiROUND( y ) );
876 }
877
878 // sort points in order of descending x (if more than 2) to
879 // ensure the starting point and the ending point of the same segment
880 // are stored one just after the other.
881 if( pointbuffer.size() > 2 )
882 sort( pointbuffer.begin(), pointbuffer.end(), sortEndsByDescendingX );
883
884 // creates lines or short segments inside the complex polygon
885 for( size_t ip = 0; ip + 1 < pointbuffer.size(); ip += 2 )
886 {
887 int dx = pointbuffer[ip + 1].x - pointbuffer[ip].x;
888
889 // Push only one line for diagonal hatch,
890 // or for small lines < twice the line length
891 // else push 2 small lines
893 || std::abs( dx ) < 2 * hatch_line_len )
894 {
895 m_borderHatchLines.emplace_back( SEG( pointbuffer[ip], pointbuffer[ ip + 1] ) );
896 }
897 else
898 {
899 double dy = pointbuffer[ip + 1].y - pointbuffer[ip].y;
900 slope = dy / dx;
901
902 if( dx > 0 )
903 dx = hatch_line_len;
904 else
905 dx = -hatch_line_len;
906
907 int x1 = KiROUND( pointbuffer[ip].x + dx );
908 int x2 = KiROUND( pointbuffer[ip + 1].x - dx );
909 int y1 = KiROUND( pointbuffer[ip].y + dx * slope );
910 int y2 = KiROUND( pointbuffer[ip + 1].y - dx * slope );
911
912 m_borderHatchLines.emplace_back( SEG( pointbuffer[ip].x, pointbuffer[ip].y,
913 x1, y1 ) );
914
915 m_borderHatchLines.emplace_back( SEG( pointbuffer[ip+1].x, pointbuffer[ip+1].y,
916 x2, y2 ) );
917 }
918 }
919 }
920}
Definition: seg.h:42
VECTOR2I A
Definition: seg.h:49
VECTOR2I B
Definition: seg.h:50
ITERATOR IterateWithHoles(int aOutline)
bool IsEmpty() const
SEGMENT_ITERATOR IterateSegmentsWithHoles()
Return an iterator object, for the aOutline-th outline in the set (with holes).
void UnHatchBorder()
Clear the zone's hatch.
Definition: zone.cpp:777
PCB_LAYER_ID GetFirstLayer() const
Definition: zone.cpp:236
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:80
bool sortEndsByDescendingX(const VECTOR2I &ref, const VECTOR2I &tst)
Definition: zone.cpp:785

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

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

◆ HigherPriority()

bool ZONE::HigherPriority ( const ZONE aOther) const

Definition at line 183 of file zone.cpp.

184{
185 // Teardrops are always higher priority than regular zones, so if one zone is a teardrop
186 // and the other is not, then return higher priority as the teardrop
188 ^ ( aOther->m_teardropType == TEARDROP_TYPE::TD_NONE ) )
189 {
190 return static_cast<int>( m_teardropType ) > static_cast<int>( aOther->m_teardropType );
191 }
192
193 if( m_priority != aOther->m_priority )
194 return m_priority > aOther->m_priority;
195
196 return m_Uuid > aOther->m_Uuid;
197}

References m_priority, m_teardropType, EDA_ITEM::m_Uuid, and TD_NONE.

Referenced by ZONE_FILLER::Fill().

◆ HitTest() [1/2]

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

Test if aRect intersects this item.

Parameters
aRectA reference to a BOX2I 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 384 of file zone.cpp.

385{
386 // Calculate bounding box for zone
387 BOX2I bbox = GetBoundingBox();
388 bbox.Normalize();
389
390 BOX2I arect = aRect;
391 arect.Normalize();
392 arect.Inflate( aAccuracy );
393
394 if( aContained )
395 {
396 return arect.Contains( bbox );
397 }
398 else
399 {
400 // Fast test: if aBox is outside the polygon bounding box, rectangles cannot intersect
401 if( !arect.Intersects( bbox ) )
402 return false;
403
404 int count = m_Poly->TotalVertices();
405
406 for( int ii = 0; ii < count; ii++ )
407 {
408 VECTOR2I vertex = m_Poly->CVertex( ii );
409 VECTOR2I vertexNext = m_Poly->CVertex( ( ii + 1 ) % count );
410
411 // Test if the point is within the rect
412 if( arect.Contains( vertex ) )
413 return true;
414
415 // Test if this edge intersects the rect
416 if( arect.Intersects( vertex, vertexNext ) )
417 return true;
418 }
419
420 return false;
421 }
422}
BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
Definition: box2.h:119
bool Intersects(const BOX2< Vec > &aRect) const
Definition: box2.h:269
bool Contains(const Vec &aPoint) const
Definition: box2.h:141

References BOX2< Vec >::Contains(), SHAPE_POLY_SET::CVertex(), GetBoundingBox(), BOX2< Vec >::Inflate(), BOX2< Vec >::Intersects(), m_Poly, BOX2< Vec >::Normalize(), and SHAPE_POLY_SET::TotalVertices().

◆ HitTest() [2/2]

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

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

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

Reimplemented from EDA_ITEM.

Definition at line 360 of file zone.cpp.

361{
362 // When looking for an "exact" hit aAccuracy will be 0 which works poorly for very thin
363 // lines. Give it a floor.
364 int accuracy = std::max( aAccuracy, pcbIUScale.mmToIU( 0.1 ) );
365
366 return HitTestForCorner( aPosition, accuracy * 2 ) || HitTestForEdge( aPosition, accuracy );
367}
bool HitTestForCorner(const VECTOR2I &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX *aCornerHit=nullptr) const
Test if the given VECTOR2I is near a corner.
Definition: zone.cpp:370
bool HitTestForEdge(const VECTOR2I &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX *aCornerHit=nullptr) const
Test if the given VECTOR2I is near a segment defined by 2 corners.
Definition: zone.cpp:377

References HitTestForCorner(), HitTestForEdge(), EDA_IU_SCALE::mmToIU(), and pcbIUScale.

◆ HitTestCutout()

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

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

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

Definition at line 451 of file zone.cpp.

452{
453 // Iterate over each outline polygon in the zone and then iterate over
454 // each hole it has to see if the point is in it.
455 for( int i = 0; i < m_Poly->OutlineCount(); i++ )
456 {
457 for( int j = 0; j < m_Poly->HoleCount( i ); j++ )
458 {
459 if( m_Poly->Hole( i, j ).PointInside( aRefPos ) )
460 {
461 if( aOutlineIdx )
462 *aOutlineIdx = i;
463
464 if( aHoleIdx )
465 *aHoleIdx = j;
466
467 return true;
468 }
469 }
470 }
471
472 return false;
473}
bool PointInside(const VECTOR2I &aPt, int aAccuracy=0, bool aUseBBoxCache=false) const
Check if point aP lies inside a polygon (any type) defined by the line chain.
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Return the aIndex-th subpolygon in the set.

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

Referenced by EDIT_TOOL::Remove().

◆ HitTestFilledArea()

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

Test if the given VECTOR2I is within the bounds of a filled area of this zone.

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

Definition at line 437 of file zone.cpp.

438{
439 // Rule areas have no filled area, but it's generally nice to treat their interior as if it were
440 // filled so that people don't have to select them by their outline (which is min-width)
441 if( GetIsRuleArea() )
442 return m_Poly->Contains( aRefPos, -1, aAccuracy );
443
444 if( !m_FilledPolysList.count( aLayer ) )
445 return false;
446
447 return m_FilledPolysList.at( aLayer )->Contains( aRefPos, -1, aAccuracy );
448}
bool Contains(const VECTOR2I &aP, int aSubpolyIndex=-1, int aAccuracy=0, bool aUseBBoxCaches=false) const
Return true if a given subpolygon contains the point aP.

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

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

◆ HitTestForCorner()

bool ZONE::HitTestForCorner ( const VECTOR2I refPos,
int  aAccuracy,
SHAPE_POLY_SET::VERTEX_INDEX aCornerHit = nullptr 
) const

Test if the given VECTOR2I is near a corner.

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

Definition at line 370 of file zone.cpp.

372{
373 return m_Poly->CollideVertex( VECTOR2I( refPos ), aCornerHit, aAccuracy );
374}
bool CollideVertex(const VECTOR2I &aPoint, VERTEX_INDEX *aClosestVertex=nullptr, int aClearance=0) const
Check whether aPoint collides with any vertex of any of the contours of the polygon.
VECTOR2< int > VECTOR2I
Definition: vector2d.h:618

References SHAPE_POLY_SET::CollideVertex(), and m_Poly.

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

◆ HitTestForEdge()

bool ZONE::HitTestForEdge ( const VECTOR2I refPos,
int  aAccuracy,
SHAPE_POLY_SET::VERTEX_INDEX aCornerHit = nullptr 
) const

Test if the given VECTOR2I is near a segment defined by 2 corners.

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

Definition at line 377 of file zone.cpp.

379{
380 return m_Poly->CollideEdge( VECTOR2I( refPos ), aCornerHit, aAccuracy );
381}
bool CollideEdge(const VECTOR2I &aPoint, VERTEX_INDEX *aClosestVertex=nullptr, int aClearance=0) const
Check whether aPoint collides with any edge of any of the contours of the polygon.

References SHAPE_POLY_SET::CollideEdge(), and m_Poly.

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

◆ InitDataFromSrcInCopyCtor()

void ZONE::InitDataFromSrcInCopyCtor ( const ZONE aZone)

Copy aZone data to me.

Definition at line 99 of file zone.cpp.

100{
101 // members are expected non initialize in this.
102 // InitDataFromSrcInCopyCtor() is expected to be called only from a copy constructor.
103
104 // Copy only useful EDA_ITEM flags:
105 m_flags = aZone.m_flags;
107
108 // Replace the outlines for aZone outlines.
109 delete m_Poly;
110 m_Poly = new SHAPE_POLY_SET( *aZone.m_Poly );
111
114 m_zoneName = aZone.m_zoneName;
115 m_priority = aZone.m_priority;
117 SetLayerSet( aZone.GetLayerSet() );
118
124
126 m_ZoneClearance = aZone.m_ZoneClearance; // clearance value
131
132 m_isFilled = aZone.m_isFilled;
135
138
139 m_fillMode = aZone.m_fillMode; // solid vs. hatched
141 m_hatchGap = aZone.m_hatchGap;
147
148 // For corner moving, corner index to drag, or nullptr if no selection
149 delete m_CornerSelection;
150 m_CornerSelection = nullptr;
151
152 for( PCB_LAYER_ID layer : aZone.GetLayerSet().Seq() )
153 {
154 std::shared_ptr<SHAPE_POLY_SET> fill = aZone.m_FilledPolysList.at( layer );
155
156 if( fill )
157 m_FilledPolysList[layer] = std::make_shared<SHAPE_POLY_SET>( *fill );
158 else
159 m_FilledPolysList[layer] = std::make_shared<SHAPE_POLY_SET>();
160
161 m_filledPolysHash[layer] = aZone.m_filledPolysHash.at( layer );
162 m_insulatedIslands[layer] = aZone.m_insulatedIslands.at( layer );
163 }
164
168
169 SetLocalFlags( aZone.GetLocalFlags() );
170
171 m_netinfo = aZone.m_netinfo;
172 m_area = aZone.m_area;
174}
bool m_forceVisible
Definition: eda_item.h:511
std::map< PCB_LAYER_ID, std::set< int > > m_insulatedIslands
For each layer, a set of insulated islands that were not removed.
Definition: zone.h:883
int GetLocalFlags() const
Definition: zone.h:302

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_fillVersion, EDA_ITEM::m_flags, EDA_ITEM::m_forceVisible, m_hatchBorderAlgorithm, m_hatchGap, m_hatchHoleMinArea, m_hatchOrientation, m_hatchSmoothingLevel, m_hatchSmoothingValue, m_hatchThickness, m_insulatedIslands, m_isFilled, m_islandRemovalMode, m_isRuleArea, m_minIslandArea, m_needRefill, BOARD_CONNECTED_ITEM::m_netinfo, m_outlinearea, m_PadConnection, m_Poly, m_priority, m_teardropType, m_thermalReliefGap, m_thermalReliefSpokeWidth, m_ZoneClearance, m_ZoneMinThickness, m_zoneName, LSET::Seq(), SetLayerSet(), and SetLocalFlags().

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

◆ IsBrightened()

◆ IsConnected()

bool ZONE::IsConnected ( ) const
inlineoverridevirtual

Not all ZONEs are really BOARD_CONNECTED_ITEMs....

Reimplemented from BOARD_CONNECTED_ITEM.

Definition at line 82 of file zone.h.

83 {
84 return !GetIsRuleArea();
85 }

References GetIsRuleArea().

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 119 of file eda_item.h.

119{ return m_flags & IS_DRAGGING; }

References IS_DRAGGING, and EDA_ITEM::m_flags.

Referenced by DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES().

◆ IsEntered()

bool EDA_ITEM::IsEntered ( ) const
inlineinherited

Definition at line 122 of file eda_item.h.

122{ return m_flags & ENTERED; }
#define ENTERED
indicates a group has been entered

References ENTERED, and EDA_ITEM::m_flags.

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

◆ IsFilled()

bool ZONE::IsFilled ( ) const
inline

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 217 of file eda_item.h.

217{ return m_forceVisible; }

References EDA_ITEM::m_forceVisible.

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

◆ IsIsland()

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

Check if a given filled polygon is an insulated island.

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

Definition at line 960 of file zone.cpp.

961{
962 if( GetNetCode() < 1 )
963 return true;
964
965 if( !m_insulatedIslands.count( aLayer ) )
966 return false;
967
968 return m_insulatedIslands.at( aLayer ).count( aPolyIdx );
969}

References BOARD_CONNECTED_ITEM::GetNetCode(), and m_insulatedIslands.

Referenced by PCB_PLUGIN::format().

◆ IsKnockout()

◆ IsLocked()

bool BOARD_ITEM::IsLocked ( ) const
virtualinherited

Reimplemented in FOOTPRINT, and PAD.

Definition at line 65 of file board_item.cpp.

66{
67 if( GetParentGroup() )
68 return GetParentGroup()->IsLocked();
69
70 const BOARD* board = GetBoard();
71
72 return board && board->GetBoardUse() != BOARD_USE::FPHOLDER && m_isLocked;
73}
bool m_isLocked
Definition: board_item.h:322
BOARD_USE GetBoardUse() const
Get what the board use is.
Definition: board.h:284

References FPHOLDER, BOARD_ITEM::GetBoard(), BOARD::GetBoardUse(), BOARD_ITEM::GetParentGroup(), BOARD_ITEM::IsLocked(), and BOARD_ITEM::m_isLocked.

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

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 116 of file eda_item.h.

116{ return m_flags & IS_CHANGED; }

References IS_CHANGED, and EDA_ITEM::m_flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsNew()

◆ IsOnCopperLayer()

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

Reimplemented from BOARD_ITEM.

Definition at line 245 of file zone.cpp.

246{
247 return ( m_layerSet & LSET::AllCuMask() ).count() > 0;
248}
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:773

References LSET::AllCuMask(), and m_layerSet.

Referenced by ZONE_FILLER::fillSingleZone(), PCB_PLUGIN::format(), GetMsgPanelInfo(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), EDA_3D_CANVAS::OnMouseMove(), BRDITEMS_PLOTTER::PlotFilledAreas(), DRC_TEST_PROVIDER_DISALLOW::Run(), and BOARD_EDITOR_CONTROL::ZoneDuplicate().

◆ IsOnLayer()

bool ZONE::IsOnLayer ( PCB_LAYER_ID  aLayer) const
overridevirtual

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

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

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

Reimplemented from BOARD_ITEM.

Definition at line 303 of file zone.cpp.

304{
305 return m_layerSet.test( aLayer );
306}

References m_layerSet.

Referenced by DRC_TEST_PROVIDER_SOLDER_MASK::addItemToRTrees(), KIGFX::PCB_PAINTER::draw(), BOARD_INSPECTION_TOOL::InspectClearance(), DRC_TEST_PROVIDER_CONNECTION_WIDTH::Run(), and DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZonesToZones().

◆ IsReplaceable()

virtual bool EDA_ITEM::IsReplaceable ( ) const
inlinevirtualinherited

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

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

Reimplemented in LIB_TEXTBOX, SCH_FIELD, SCH_LABEL, SCH_SHEET, SCH_SHEET_PIN, SCH_SYMBOL, SCH_TEXT, and SCH_TEXTBOX.

Definition at line 434 of file eda_item.h.

434{ return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 123 of file eda_item.h.

123{ return m_flags & IS_RESIZING; }

References IS_RESIZING, and EDA_ITEM::m_flags.

◆ IsRollover()

bool EDA_ITEM::IsRollover ( ) const
inlineinherited

Definition at line 126 of file eda_item.h.

127 {
128 return ( m_flags & ( IS_ROLLOVER | IS_MOVING ) ) == IS_ROLLOVER;
129 }
#define IS_ROLLOVER
Rollover active. Used for hyperlink highlighting.

References IS_MOVING, IS_ROLLOVER, and EDA_ITEM::m_flags.

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

◆ IsSame()

bool ZONE::IsSame ( const ZONE aZoneToCompare)

Test if 2 zones are equivalent.

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

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

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

Definition at line 60 of file zones_functions_for_undo_redo.cpp.

61{
62 // compare basic parameters:
63 if( GetLayerSet() != aZoneToCompare.GetLayerSet() )
64 return false;
65
66 if( GetNetCode() != aZoneToCompare.GetNetCode() )
67 return false;
68
69 if( GetAssignedPriority() != aZoneToCompare.GetAssignedPriority() )
70 return false;
71
72 // Compare zone specific parameters
73 if( GetIsRuleArea() != aZoneToCompare.GetIsRuleArea() )
74 return false;
75
76 if( GetIsRuleArea() )
77 {
78 if( GetDoNotAllowCopperPour() != aZoneToCompare.GetDoNotAllowCopperPour() )
79 return false;
80
81 if( GetDoNotAllowVias() != aZoneToCompare.GetDoNotAllowVias() )
82 return false;
83
84 if( GetDoNotAllowTracks() != aZoneToCompare.GetDoNotAllowTracks() )
85 return false;
86
87 if( GetDoNotAllowPads() != aZoneToCompare.GetDoNotAllowPads() )
88 return false;
89
90 if( GetDoNotAllowFootprints() != aZoneToCompare.GetDoNotAllowFootprints() )
91 return false;
92 }
93
94 if( m_ZoneClearance != aZoneToCompare.m_ZoneClearance )
95 return false;
96
97 if( m_ZoneMinThickness != aZoneToCompare.GetMinThickness() )
98 return false;
99
100 if( m_fillMode != aZoneToCompare.GetFillMode() )
101 return false;
102
103 if( m_PadConnection != aZoneToCompare.m_PadConnection )
104 return false;
105
106 if( m_thermalReliefGap != aZoneToCompare.m_thermalReliefGap )
107 return false;
108
110 return false;
111
112 if( m_zoneName != aZoneToCompare.m_zoneName )
113 return false;
114
115 if( m_islandRemovalMode != aZoneToCompare.m_islandRemovalMode )
116 return false;
117
118 if( m_minIslandArea != aZoneToCompare.m_minIslandArea )
119 return false;
120
121
122 // Compare outlines
123 wxASSERT( m_Poly ); // m_Poly == NULL Should never happen
124 wxASSERT( aZoneToCompare.Outline() );
125
126 if( Outline() != aZoneToCompare.Outline() ) // Compare vector
127 return false;
128
129 return true;
130}
SHAPE_POLY_SET * Outline()
Definition: zone.h:305
int GetMinThickness() const
Definition: zone.h:244
ZONE_FILL_MODE GetFillMode() const
Definition: zone.h:167

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

Referenced by UpdateCopyOfZonesList().

◆ IsSelected()

bool EDA_ITEM::IsSelected ( ) const
inlineinherited

Definition at line 121 of file eda_item.h.

121{ return m_flags & SELECTED; }

References EDA_ITEM::m_flags, and SELECTED.

Referenced by ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), SCH_EDIT_TOOL::ChangeTextType(), SCH_EDIT_FRAME::ConvertPart(), DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), DS_PROXY_UNDO_ITEM::DS_PROXY_UNDO_ITEM(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::DS_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), SCH_MOVE_TOOL::getConnectedDragItems(), KIGFX::SCH_PAINTER::getLineWidth(), DIALOG_EXCHANGE_FOOTPRINTS::isMatch(), DIALOG_CHANGE_SYMBOLS::isMatch(), SCH_MOVE_TOOL::Main(), SCH_SCREEN::MarkConnections(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), KIGFX::SCH_PAINTER::nonCached(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), BOARD_COMMIT::Push(), EE_SELECTION_TOOL::RebuildSelection(), PCB_SELECTION_TOOL::RebuildSelection(), RENDER_3D_OPENGL::renderFootprint(), SCH_EDIT_TOOL::Rotate(), EE_TOOL_BASE< T >::saveCopyInUndoList(), GERBVIEW_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::selectionContains(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), KIGFX::SCH_PAINTER::setDeviceColors(), PCB_BASE_EDIT_FRAME::unitsChangeRefresh(), GERBVIEW_SELECTION_TOOL::unselect(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem(), and DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem().

◆ IsShownAsBitmap()

bool EDA_ITEM::IsShownAsBitmap ( ) const
inlineinherited

Definition at line 189 of file eda_item.h.

189{ return m_flags & IS_SHOWN_AS_BITMAP; }
#define IS_SHOWN_AS_BITMAP

References IS_SHOWN_AS_BITMAP, and EDA_ITEM::m_flags.

◆ IsTeardropArea()

bool ZONE::IsTeardropArea ( ) const
inline
Returns
true if the zone is a teardrop area

Definition at line 675 of file zone.h.

References m_teardropType, and TD_NONE.

Referenced by ZONE_FILLER::buildCopperItemClearances(), BuildSmoothedPoly(), PCB_PLUGIN::format(), GetMsgPanelInfo(), and ZONE_FILLER::knockoutThermalReliefs().

◆ IsTented()

virtual bool BOARD_ITEM::IsTented ( ) const
inlinevirtualinherited

Reimplemented in PCB_VIA.

Definition at line 125 of file board_item.h.

126 {
127 return false;
128 }

Referenced by BOARD_INSPECTION_TOOL::InspectClearance(), and DRC_TEST_PROVIDER_SILK_CLEARANCE::Run().

◆ IsType()

virtual bool EDA_ITEM::IsType ( const std::vector< KICAD_T > &  aScanTypes) const
inlinevirtualinherited

Check whether the item is one of the listed types.

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

Reimplemented in SCH_FIELD, SCH_ITEM, SCH_LABEL_BASE, SCH_LINE, FP_SHAPE, FP_TEXT, FP_TEXTBOX, PAD, PCB_DIMENSION_BASE, PCB_SHAPE, PCB_TEXT, PCB_TEXTBOX, and PCB_VIA.

Definition at line 197 of file eda_item.h.

198 {
199 for( KICAD_T scanType : aScanTypes )
200 {
201 if( scanType == SCH_LOCATE_ANY_T || scanType == m_structType )
202 return true;
203 }
204
205 return false;
206 }
KICAD_T m_structType
Run time identification, keep private so it can never be changed after a ctor sets it.
Definition: eda_item.h:519
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ SCH_LOCATE_ANY_T
Definition: typeinfo.h:182

References EDA_ITEM::m_structType, and SCH_LOCATE_ANY_T.

Referenced by SCH_EDIT_TOOL::AutoplaceFields(), ROUTER_TOOL::CanInlineDrag(), DIALOG_SCH_FIELD_PROPERTIES::DIALOG_SCH_FIELD_PROPERTIES(), SCH_FIELD::GetCanonicalName(), KIGFX::SCH_PAINTER::getLineWidth(), SCH_FIELD::GetName(), KIGFX::SCH_PAINTER::getRenderColor(), SCH_FIELD::GetShownText(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingBus(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLine(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingWire(), SCH_ITEM::IsType(), FP_TEXT::IsType(), FP_TEXTBOX::IsType(), PAD::IsType(), PCB_DIMENSION_BASE::IsType(), PCB_SHAPE::IsType(), PCB_TEXT::IsType(), PCB_TEXTBOX::IsType(), PCB_VIA::IsType(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), EE_SELECTION_TOOL::RequestSelection(), SCH_FIELD::SetId(), SCH_BASE_FRAME::UpdateItem(), and EDA_ITEM::Visit().

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 120 of file eda_item.h.

120{ return m_flags & IS_WIRE_IMAGE; }

References IS_WIRE_IMAGE, and EDA_ITEM::m_flags.

◆ Iterate()

SHAPE_POLY_SET::ITERATOR ZONE::Iterate ( )
inline

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

Returns
an iterator to visit the zone vertices without holes.

Definition at line 494 of file zone.h.

495 {
496 return m_Poly->Iterate();
497 }
ITERATOR Iterate(int aFirst, int aLast, bool aIterateHoles=false)
Return an object to iterate through the points of the polygons between aFirst and aLast.

References SHAPE_POLY_SET::Iterate(), and m_Poly.

◆ IterateForward() [1/2]

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

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

Definition at line 316 of file eda_item.h.

318 {
319 for( const auto& it : aList )
320 {
321 if( static_cast<EDA_ITEM*>( it )->Visit( inspector,
322 testData,
323 scanTypes ) == INSPECT_RESULT::QUIT )
324 {
326 }
327 }
328
330 }
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
virtual INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &aScanTypes)
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:91

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

Referenced by GERBER_FILE_IMAGE::Visit().

◆ IterateForward() [2/2]

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

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

Definition at line 336 of file eda_item.h.

338 {
339 for( const auto& it : aList )
340 {
341 if( static_cast<EDA_ITEM*>( it )->Visit( inspector,
342 testData,
343 scanTypes ) == INSPECT_RESULT::QUIT )
344 {
346 }
347 }
348
350 }

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

◆ IterateWithHoles()

SHAPE_POLY_SET::ITERATOR ZONE::IterateWithHoles ( )
inline

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

Returns
an iterator to visit the zone vertices with holes.

Definition at line 504 of file zone.h.

505 {
506 return m_Poly->IterateWithHoles();
507 }

References SHAPE_POLY_SET::IterateWithHoles(), and m_Poly.

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

◆ layerMaskDescribe()

wxString BOARD_ITEM::layerMaskDescribe ( ) const
protectedvirtualinherited

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

Reimplemented in PCB_VIA.

Definition at line 100 of file board_item.cpp.

101{
102 const BOARD* board = GetBoard();
103 LSET layers = GetLayerSet();
104
105 // Try to be smart and useful. Check all copper first.
106 if( layers[F_Cu] && layers[B_Cu] )
107 return _( "all copper layers" );
108
109 LSET copperLayers = layers & board->GetEnabledLayers().AllCuMask();
110 LSET techLayers = layers & board->GetEnabledLayers().AllTechMask();
111
112 for( LSET testLayers : { copperLayers, techLayers, layers } )
113 {
114 for( int bit = PCBNEW_LAYER_ID_START; bit < PCB_LAYER_ID_COUNT; ++bit )
115 {
116 if( testLayers[ bit ] )
117 {
118 wxString layerInfo = board->GetLayerName( static_cast<PCB_LAYER_ID>( bit ) );
119
120 if( testLayers.count() > 1 )
121 layerInfo << wxS( " " ) + _( "and others" );
122
123 return layerInfo;
124 }
125 }
126 }
127
128 // No copper, no technicals: no layer
129 return _( "no layers" );
130}
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
Definition: board_item.h:174
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:485
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:530
static LSET AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
Definition: lset.cpp:841
@ PCBNEW_LAYER_ID_START
Definition: layer_ids.h:63
@ B_Cu
Definition: layer_ids.h:95
@ PCB_LAYER_ID_COUNT
Definition: layer_ids.h:137
@ F_Cu
Definition: layer_ids.h:64

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

◆ Matches() [1/2]

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

Compare the item against the search criteria in aSearchData.

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

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

Reimplemented from EDA_ITEM.

Definition at line 120 of file zone.h.

121 {
122 return BOARD_ITEM::Matches( GetZoneName(), aSearchData );
123 }
virtual bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
Definition: eda_item.h:396
wxString GetZoneName() const
Definition: zone.h:117

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

Referenced by DIALOG_FIND::search(), and ZONE_SEARCH_HANDLER::Search().

◆ Matches() [2/2]

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

Compare aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

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

Definition at line 117 of file eda_item.cpp.

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

References EDA_SEARCH_DATA::findString, EDA_ITEM::IsReplaceable(), EDA_SEARCH_DATA::matchCase, EDA_SEARCH_DATA::matchMode, next(), EDA_SEARCH_DATA::searchAndReplace, text, WHOLEWORD, and WILDCARD.

◆ Mirror()

void ZONE::Mirror ( const VECTOR2I aMirrorRef,
bool  aMirrorLeftRight 
)

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

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

Definition at line 639 of file zone.cpp.

640{
641 m_Poly->Mirror( aMirrorLeftRight, !aMirrorLeftRight, aMirrorRef );
642
643 HatchBorder();
644
645 for( std::pair<const PCB_LAYER_ID, std::shared_ptr<SHAPE_POLY_SET>>& pair : m_FilledPolysList )
646 pair.second->Mirror( aMirrorLeftRight, !aMirrorLeftRight, aMirrorRef );
647}
void Mirror(bool aX=true, bool aY=false, const VECTOR2I &aRef={ 0, 0 })
Mirror the line points about y or x (or both)
void HatchBorder()
Compute the hatch lines depending on the hatch parameters and stores it in the zone's attribute m_bor...
Definition: zone.cpp:791

References HatchBorder(), m_FilledPolysList, m_Poly, and SHAPE_POLY_SET::Mirror().

Referenced by Flip().

◆ Move()

void ZONE::Move ( const VECTOR2I offset)
overridevirtual

Move the outlines.

Parameters
offsetis moving vector

Reimplemented from BOARD_ITEM.

Definition at line 593 of file zone.cpp.

594{
595 /* move outlines */
596 m_Poly->Move( offset );
597
598 HatchBorder();
599
600 for( std::pair<const PCB_LAYER_ID, std::shared_ptr<SHAPE_POLY_SET>>& pair : m_FilledPolysList )
601 pair.second->Move( offset );
602}
void Move(const VECTOR2I &aVector) override

References HatchBorder(), m_FilledPolysList, m_Poly, and SHAPE_POLY_SET::Move().

◆ MoveEdge()

void ZONE::MoveEdge ( const VECTOR2I offset,
int  aEdge 
)

Move the outline Edge.

Parameters
offsetis moving vector
aEdgeis start point of the outline edge

Definition at line 605 of file zone.cpp.

606{
607 int next_corner;
608
609 if( m_Poly->GetNeighbourIndexes( aEdge, nullptr, &next_corner ) )
610 {
611 m_Poly->SetVertex( aEdge, m_Poly->CVertex( aEdge ) + VECTOR2I( offset ) );
612 m_Poly->SetVertex( next_corner, m_Poly->CVertex( next_corner ) + VECTOR2I( offset ) );
613 HatchBorder();
614
615 SetNeedRefill( true );
616 }
617}
void SetVertex(const VERTEX_INDEX &aIndex, const VECTOR2I &aPos)
Accessor function to set the position of a specific point.
bool GetNeighbourIndexes(int aGlobalIndex, int *aPrevious, int *aNext)
Return the global indexes of the previous and the next corner of the aGlobalIndex-th corner of a cont...

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

◆ NeedRefill()

bool ZONE::NeedRefill ( ) const
inline

Definition at line 238 of file zone.h.

238{ return m_needRefill; }

References m_needRefill.

◆ NewHole()

void ZONE::NewHole ( )
inline

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

Definition at line 558 of file zone.h.

559 {
560 m_Poly->NewHole();
561 }
int NewHole(int aOutline=-1)
Adds a new outline to the set and returns its index.

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

232{
233 wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
234 GetClass() ) );
235
236 return false;
237}

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

◆ operator=()

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

Definition at line 82 of file zone.cpp.

83{
85
87
88 return *this;
89}
EDA_ITEM & operator=(const EDA_ITEM &aItem)
Assign the members of aItem to another object.
Definition: eda_item.cpp:240

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

Referenced by FP_ZONE::operator=().

◆ Outline() [1/2]

◆ Outline() [2/2]

const SHAPE_POLY_SET * ZONE::Outline ( ) const
inline

Definition at line 306 of file zone.h.

306{ return m_Poly; }

References m_Poly.

◆ RemoveAllContours()

void ZONE::RemoveAllContours ( void  )
inline

Definition at line 519 of file zone.h.

520 {
522 }

References m_Poly, and SHAPE_POLY_SET::RemoveAllContours().

◆ RemoveCutout()

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

Remove a cutout from the zone.

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

Definition at line 650 of file zone.cpp.

651{
652 // Ensure the requested cutout is valid
653 if( m_Poly->OutlineCount() < aOutlineIdx || m_Poly->HoleCount( aOutlineIdx ) < aHoleIdx )
654 return;
655
656 SHAPE_POLY_SET cutPoly( m_Poly->Hole( aOutlineIdx, aHoleIdx ) );
657
658 // Add the cutout back to the zone
660
661 SetNeedRefill( true );
662}

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

◆ RenderAsBitmap()

virtual bool EDA_ITEM::RenderAsBitmap ( double  aWorldScale) const
inlinevirtualinherited

Reimplemented in SCH_ITEM.

Definition at line 179 of file eda_item.h.

179{ return false; }

◆ Replace() [1/2]

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

Perform a text replace using the find and replace criteria in aSearchData on items that support text find and replace.

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

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

Reimplemented in LIB_TEXTBOX, SCH_PIN, SCH_TEXT, SCH_TEXTBOX, SCH_FIELD, and SCH_SHEET_PIN.

Definition at line 423 of file eda_item.h.

424 {
425 return false;
426 }

◆ Replace() [2/2]

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

Perform a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace.

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

Definition at line 168 of file eda_item.cpp.

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

References EDA_SEARCH_DATA::findString, EDA_SEARCH_DATA::matchCase, EDA_SEARCH_DATA::matchMode, next(), EDA_SEARCH_DATA::replaceString, text, and WHOLEWORD.

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

◆ Rotate()

void ZONE::Rotate ( const VECTOR2I aCentre,
const EDA_ANGLE aAngle 
)
overridevirtual

Rotate the outlines.

Parameters
aCentreis rot centre

Reimplemented from BOARD_ITEM.

Definition at line 620 of file zone.cpp.

621{
622 m_Poly->Rotate( aAngle, VECTOR2I( aCentre ) );
623 HatchBorder();
624
625 /* rotate filled areas: */
626 for( std::pair<const PCB_LAYER_ID, std::shared_ptr<SHAPE_POLY_SET>>& pair : m_FilledPolysList )
627 pair.second->Rotate( aAngle, aCentre );
628}
void Rotate(const EDA_ANGLE &aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Rotate all vertices by a given angle.

References HatchBorder(), m_FilledPolysList, m_Poly, and SHAPE_POLY_SET::Rotate().

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

◆ SameNet()

bool ZONE::SameNet ( const ZONE aOther) const

Definition at line 200 of file zone.cpp.

201{
202 return GetNetCode() == aOther->GetNetCode();
203}

References BOARD_CONNECTED_ITEM::GetNetCode().

◆ Set() [1/3]

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

Definition at line 66 of file inspectable.h.

67 {
69 TYPE_ID thisType = TYPE_HASH( *this );
70 PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
71 void* object = nullptr;
72
73 if( prop )
74 {
75 object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
76
77 if( object )
78 prop->set<T>( object, aValue );
79 }
80
81 return object != nullptr;
82 }
void set(void *aObject, T aValue)
Definition: property.h:263

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

◆ Set() [2/3]

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

Definition at line 54 of file inspectable.h.

55 {
57 void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
58
59 if( object )
60 aProperty->set<T>( object, aValue );
61
62 return object != nullptr;
63 }

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

◆ Set() [3/3]

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

Definition at line 42 of file inspectable.h.

43 {
45 void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
46
47 if( object )
48 aProperty->setter( object, aValue );
49
50 return object != nullptr;
51 }
virtual void setter(void *aObject, wxAny &aValue)=0

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

Referenced by PCB_PROPERTIES_PANEL::valueChanged().

◆ SetAssignedPriority()

◆ SetBorderDisplayStyle()

void ZONE::SetBorderDisplayStyle ( ZONE_BORDER_DISPLAY_STYLE  aBorderHatchStyle,
int  aBorderHatchPitch,
bool  aRebuilBorderdHatch 
)

Set all hatch parameters for the zone.

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

Definition at line 756 of file zone.cpp.

758{
759 aBorderHatchPitch = std::max( aBorderHatchPitch,
761 aBorderHatchPitch = std::min( aBorderHatchPitch,
763 SetBorderHatchPitch( aBorderHatchPitch );
764 m_borderStyle = aBorderHatchStyle;
765
766 if( aRebuildBorderHatch )
767 HatchBorder();
768}
void SetBorderHatchPitch(int aPitch)
Set the hatch pitch parameter for the zone.
Definition: zone.cpp:771
#define ZONE_BORDER_HATCH_MINDIST_MM
Definition: zones.h:40
#define ZONE_BORDER_HATCH_MAXDIST_MM
Definition: zones.h:41

References HatchBorder(), m_borderStyle, EDA_IU_SCALE::mmToIU(), pcbIUScale, SetBorderHatchPitch(), ZONE_BORDER_HATCH_MAXDIST_MM, and ZONE_BORDER_HATCH_MINDIST_MM.

Referenced by PCAD2KICAD::PCB_POLYGON::AddToBoard(), ALTIUM_PCB::ConvertFills6ToBoardItemWithNet(), ALTIUM_PCB::ConvertShapeBasedRegions6ToBoardItem(), ALTIUM_PCB::ConvertShapeBasedRegions6ToFootprintItem(), ZONE_SETTINGS::ExportSetting(), ALTIUM_PCB::HelperPcpShapeAsBoardKeepoutRegion(), ALTIUM_PCB::HelperPcpShapeAsFootprintKeepoutRegion(), EAGLE_PLUGIN::loadPlain(), EAGLE_PLUGIN::packageCircle(), EAGLE_PLUGIN::packagePolygon(), EAGLE_PLUGIN::packageRectangle(), and ALTIUM_PCB::ParsePolygons6Data().

◆ SetBorderHatchPitch()

void ZONE::SetBorderHatchPitch ( int  aPitch)

Set the hatch pitch parameter for the zone.

Parameters
aPitchis the hatch pitch in iu.

Definition at line 771 of file zone.cpp.

772{
773 m_borderHatchPitch = aPitch;
774}

References m_borderHatchPitch.

Referenced by SetBorderDisplayStyle().

◆ SetBrightened()

◆ SetCornerPosition()

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

Definition at line 535 of file zone.h.

536 {
537 SHAPE_POLY_SET::VERTEX_INDEX relativeIndices;
538
539 // Convert global to relative indices
540 if( m_Poly->GetRelativeIndices( aCornerIndex, &relativeIndices ) )
541 {
542 if( m_Poly->CVertex( relativeIndices ).x != new_pos.x
543 || m_Poly->CVertex( relativeIndices ).y != new_pos.y )
544 {
545 SetNeedRefill( true );
546 m_Poly->SetVertex( relativeIndices, new_pos );
547 }
548 }
549 else
550 {
551 throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
552 }
553 }

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

◆ SetCornerRadius()

void ZONE::SetCornerRadius ( unsigned int  aRadius)

Definition at line 330 of file zone.cpp.

331{
332 if( m_cornerRadius != aRadius )
333 SetNeedRefill( true );
334
335 m_cornerRadius = aRadius;
336}

References m_cornerRadius, and SetNeedRefill().

Referenced by ZONE_SETTINGS::ExportSetting().

◆ SetCornerSmoothingType()

void ZONE::SetCornerSmoothingType ( int  aType)
inline

Definition at line 640 of file zone.h.

640{ m_cornerSmoothingType = aType; };

References m_cornerSmoothingType.

Referenced by ZONE_SETTINGS::ExportSetting().

◆ SetDoNotAllowCopperPour()

◆ SetDoNotAllowFootprints()

◆ SetDoNotAllowPads()

◆ SetDoNotAllowTracks()

◆ SetDoNotAllowVias()

◆ SetFilledPolysList()

void ZONE::SetFilledPolysList ( PCB_LAYER_ID  aLayer,
const SHAPE_POLY_SET aPolysList 
)
inline

Set the list of filled polygons.

Definition at line 617 of file zone.h.

618 {
619 m_FilledPolysList[aLayer] = std::make_shared<SHAPE_POLY_SET>( aPolysList );
620 }

References m_FilledPolysList.

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

◆ SetFillFlag()

void ZONE::SetFillFlag ( PCB_LAYER_ID  aLayer,
bool  aFlag 
)
inline

Definition at line 233 of file zone.h.

233{ m_fillFlags.set( aLayer, aFlag); }

References m_fillFlags.

Referenced by DRC_TEST_PROVIDER_SOLDER_MASK::buildRTrees(), and ZONE_FILLER::Fill().

◆ SetFillMode()

◆ SetFlags()

void EDA_ITEM::SetFlags ( EDA_ITEM_FLAGS  aMask)
inlineinherited

Definition at line 156 of file eda_item.h.

156{ m_flags |= aMask; }

References EDA_ITEM::m_flags.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), PCB_BASE_FRAME::AddFootprintToBoard(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), SCH_ALTIUM_PLUGIN::AddTextBox(), SCH_MOVE_TOOL::AlignElements(), PCB_CONTROL::AppendBoard(), FOOTPRINT::BuildCourtyardCaches(), SCH_EDIT_TOOL::ChangeTextType(), GRAPHICS_CLEANER::cleanupShapes(), ConvertOutlineToPolygon(), SCH_EDIT_FRAME::ConvertPart(), SCH_DRAWING_TOOLS::createNewText(), SCH_DRAWING_TOOLS::createSheetPin(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), EDIT_TOOL::DragArcTrack(), KIGFX::SCH_PAINTER::draw(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), DRAWING_TOOL::DrawRectangle(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PCB_SELECTION_TOOL::EnterGroup(), PAD_TOOL::explodePad(), SCH_MOVE_TOOL::getConnectedDragItems(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), EE_COLLECTOR::Inspect(), SCH_MOVE_TOOL::Main(), CONVERT_TOOL::makePolysFromChainedSegs(), SCH_SCREEN::MarkConnections(), TRACKS_CLEANER::mergeCollinearSegments(), SCH_MOVE_TOOL::moveItem(), SYMBOL_EDITOR_MOVE_TOOL::moveItem(), DIALOG_SYMBOL_PROPERTIES::OnUnitChoice(), KIGFX::ORIGIN_VIEWITEM::ORIGIN_VIEWITEM(), SCH_ALTIUM_PLUGIN::ParseBezier(), SCH_ALTIUM_PLUGIN::ParseBus(), SCH_ALTIUM_PLUGIN::ParseBusEntry(), SCH_ALTIUM_PLUGIN::ParseHarnessConnector(), SCH_ALTIUM_PLUGIN::ParseHarnessPort(), SCH_ALTIUM_PLUGIN::ParseJunction(), SCH_ALTIUM_PLUGIN::ParseLabel(), SCH_ALTIUM_PLUGIN::ParseLine(), SCH_ALTIUM_PLUGIN::ParseNetLabel(), SCH_ALTIUM_PLUGIN::ParseNoERC(), SCH_ALTIUM_PLUGIN::ParsePolygon(), SCH_ALTIUM_PLUGIN::ParsePolyline(), SCH_ALTIUM_PLUGIN::ParsePort(), SCH_ALTIUM_PLUGIN::ParseRectangle(), SCH_ALTIUM_PLUGIN::ParseRoundRectangle(), SCH_ALTIUM_PLUGIN::ParseSheetSymbol(), SCH_ALTIUM_PLUGIN::ParseSignalHarness(), SCH_ALTIUM_PLUGIN::ParseWire(), SCH_EDITOR_CONTROL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PL_DRAWING_TOOLS::PlaceItem(), DRAWING_TOOL::PlaceText(), SCH_SYMBOL::Plot(), BACK_ANNOTATE::processNetNameChange(), SCH_EDIT_FRAME::PutDataInPreviousState(), PCB_SELECTION_TOOL::RebuildSelection(), BOARD::Remove(), FOOTPRINT::Remove(), SCH_EDIT_TOOL::RepeatDrawItem(), SCH_EDIT_TOOL::Rotate(), SYMBOL_EDIT_FRAME::SaveCopyInUndoList(), EE_SELECTION_TOOL::SelectAll(), SCH_EDIT_FRAME::SelectUnit(), EDA_ITEM::SetBrightened(), EDA_ITEM::SetIsShownAsBitmap(), EDA_ITEM::SetModified(), EDA_ITEM::SetSelected(), EDA_ITEM::SetWireImage(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_LINE_WIRE_BUS_TOOL::startSegments(), DS_DATA_ITEM::SyncDrawItems(), DS_DATA_ITEM_BITMAP::SyncDrawItems(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXTBOX_PROPERTIES::TransferDataFromWindow(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace().

◆ SetForceVisible()

void EDA_ITEM::SetForceVisible ( bool  aEnable)
inlineinherited

Set and clear force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible.

Parameters
aEnableTrue forces the item to be drawn. False uses the item's visibility setting to determine if the item is to be drawn.

Definition at line 215 of file eda_item.h.

215{ m_forceVisible = aEnable; }

References EDA_ITEM::m_forceVisible.

Referenced by SCH_EDITOR_CONTROL::UpdateFind().

◆ SetHatchBorderAlgorithm()

void ZONE::SetHatchBorderAlgorithm ( int  aAlgo)
inline

Definition at line 272 of file zone.h.

272{ m_hatchBorderAlgorithm = aAlgo; }

References m_hatchBorderAlgorithm.

Referenced by ZONE_SETTINGS::ExportSetting().

◆ SetHatchGap()

◆ SetHatchHoleMinArea()

void ZONE::SetHatchHoleMinArea ( double  aPct)
inline

Definition at line 269 of file zone.h.

269{ m_hatchHoleMinArea = aPct; }

References m_hatchHoleMinArea.

Referenced by ZONE_SETTINGS::ExportSetting().

◆ SetHatchOrientation()

◆ SetHatchSmoothingLevel()

void ZONE::SetHatchSmoothingLevel ( int  aLevel)
inline

Definition at line 263 of file zone.h.

263{ m_hatchSmoothingLevel = aLevel; }

References m_hatchSmoothingLevel.

Referenced by ZONE_SETTINGS::ExportSetting().

◆ SetHatchSmoothingValue()

void ZONE::SetHatchSmoothingValue ( double  aValue)
inline

Definition at line 266 of file zone.h.

266{ m_hatchSmoothingValue = aValue; }

References m_hatchSmoothingValue.

Referenced by ZONE_SETTINGS::ExportSetting().

◆ SetHatchStyle()

void ZONE::SetHatchStyle ( ZONE_BORDER_DISPLAY_STYLE  aStyle)
inline

◆ SetHatchThickness()

void ZONE::SetHatchThickness ( int  aThickness)
inline

◆ SetIsFilled()

void ZONE::SetIsFilled ( bool  isFilled)
inline

◆ SetIsIsland()

void ZONE::SetIsIsland ( PCB_LAYER_ID  aLayer,
int  aPolyIdx 
)
inline

Definition at line 631 of file zone.h.

632 {
633 m_insulatedIslands[aLayer].insert( aPolyIdx );
634 }

References m_insulatedIslands.

◆ SetIsKnockout()

virtual void BOARD_ITEM::SetIsKnockout ( bool  aKnockout)
inlinevirtualinherited

Definition at line 240 of file board_item.h.

240{ m_isKnockout = aKnockout; }

References BOARD_ITEM::m_isKnockout.

◆ SetIslandRemovalMode()

◆ SetIsRuleArea()

◆ SetIsShownAsBitmap()

void EDA_ITEM::SetIsShownAsBitmap ( bool  aBitmap)
inlineinherited

Definition at line 181 of file eda_item.h.

182 {
183 if( aBitmap )
185 else
187 }

References EDA_ITEM::ClearFlags(), IS_SHOWN_AS_BITMAP, and EDA_ITEM::SetFlags().

◆ SetLayer()

void ZONE::SetLayer ( PCB_LAYER_ID  aLayer)
overridevirtual

Set the layer this item is on.

This method is virtual because some items (in fact: class DIMENSION) have a slightly different initialization.

Parameters
aLayerThe layer number.

Reimplemented from BOARD_ITEM.

Definition at line 251 of file zone.cpp.

252{
253 SetLayerSet( LSET( aLayer ) );
254}

References SetLayerSet().

Referenced by BOARD::AddArea(), PCAD2KICAD::PCB_POLYGON::AddToBoard(), TEARDROP_MANAGER::createTeardrop(), CADSTAR_PCB_ARCHIVE_LOADER::loadAreas(), CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers(), CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryAreas(), EAGLE_PLUGIN::loadPlain(), EAGLE_PLUGIN::loadPolygon(), CADSTAR_PCB_ARCHIVE_LOADER::loadTemplates(), FABMASTER::loadZone(), PlotSolderMaskLayer(), and setKeepoutSettingsToZone().

◆ SetLayerSet()

void ZONE::SetLayerSet ( LSET  aLayerSet)
overridevirtual

Reimplemented from BOARD_ITEM.

Definition at line 257 of file zone.cpp.

258{
259 if( aLayerSet.count() == 0 )
260 return;
261
262 if( m_layerSet != aLayerSet )
263 {
264 SetNeedRefill( true );
265
266 UnFill();
267
268 m_FilledPolysList.clear();
269 m_filledPolysHash.clear();
270 m_insulatedIslands.clear();
271
272 for( PCB_LAYER_ID layer : aLayerSet.Seq() )
273 {
274 m_FilledPolysList[layer] = std::make_shared<SHAPE_POLY_SET>();
275 m_filledPolysHash[layer] = {};
276 m_insulatedIslands[layer] = {};
277 }
278 }
279
280 m_layerSet = aLayerSet;
281}
bool UnFill()
Removes the zone filling.
Definition: zone.cpp:206

References m_filledPolysHash, m_FilledPolysList, m_insulatedIslands, m_layerSet, LSET::Seq(), SetNeedRefill(), and UnFill().

Referenced by BOARD::BOARD(), ZONE_SETTINGS::ExportSetting(), Flip(), ALTIUM_PCB::HelperSetZoneLayers(), InitDataFromSrcInCopyCtor(), CADSTAR_PCB_ARCHIVE_LOADER::loadAreas(), CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryAreas(), FABMASTER::loadZone(), setKeepoutSettingsToZone(), and SetLayer().

◆ SetLocalClearance()

◆ SetLocalFlags()

void ZONE::SetLocalFlags ( int  aFlags)
inline

Definition at line 303 of file zone.h.

303{ m_localFlgs = aFlags; }

References m_localFlgs.

Referenced by InitDataFromSrcInCopyCtor(), and ZONE().

◆ SetLocalRatsnestVisible()

void BOARD_CONNECTED_ITEM::SetLocalRatsnestVisible ( bool  aVisible)
inlineinherited

Definition at line 166 of file board_connected_item.h.

167 {
168 m_localRatsnestVisible = aVisible;
169 }

References BOARD_CONNECTED_ITEM::m_localRatsnestVisible.

◆ SetLocked()

◆ SetMinIslandArea()

void ZONE::SetMinIslandArea ( long long int  aArea)
inline

Definition at line 709 of file zone.h.

709{ m_minIslandArea = aArea; }

References m_minIslandArea.

Referenced by ZONE_SETTINGS::ExportSetting(), and CADSTAR_PCB_ARCHIVE_LOADER::loadTemplates().

◆ SetMinThickness()

void ZONE::SetMinThickness ( int  aMinThickness)
inline

◆ SetModified()

◆ SetNeedRefill()

◆ SetNet()

◆ SetNetCode() [1/2]

void BOARD_CONNECTED_ITEM::SetNetCode ( int  aNetCode)
inlineinherited

Definition at line 106 of file board_connected_item.h.

107 {
108 SetNetCode( aNetCode, false );
109 }
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.

References BOARD_CONNECTED_ITEM::SetNetCode().

◆ SetNetCode() [2/2]

bool BOARD_CONNECTED_ITEM::SetNetCode ( int  aNetCode,
bool  aNoAssert 
)
inherited

Set net using a net code.

Note
Pads not on copper layers will have their net code always set to 0 (not connected).
Parameters
aNetCodeis a net code for the new net. It has to exist in NETINFO_LIST held by BOARD.
aNoAssertif true, do not assert that the net exists. Otherwise, item is assigned to the unconnected net.
Returns
true on success, false if the net did not exist

Definition at line 44 of file board_connected_item.cpp.

45{
46 if( !IsOnCopperLayer() )
47 aNetCode = 0;
48
49 // if aNetCode < 0 (typically NETINFO_LIST::FORCE_ORPHANED) or no parent board,
50 // set the m_netinfo to the dummy NETINFO_LIST::ORPHANED
51
52 BOARD* board = GetBoard();
53
54 if( ( aNetCode >= 0 ) && board )
55 m_netinfo = board->FindNet( aNetCode );
56 else
58
59 if( !aNoAssert )
60 wxASSERT( m_netinfo );
61
62 return ( m_netinfo != nullptr );
63}
virtual bool IsOnCopperLayer() const
Definition: board_item.h:115
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition: board.cpp:1382
static NETINFO_ITEM * OrphanedItem()
Wrapper class, so you can iterate through NETINFO_ITEM*s, not std::pair<int/wxString,...
Definition: netinfo.h:381

References BOARD::FindNet(), BOARD_ITEM::GetBoard(), BOARD_ITEM::IsOnCopperLayer(), BOARD_CONNECTED_ITEM::m_netinfo, and NETINFO_LIST::OrphanedItem().

Referenced by BOARD::AddArea(), PNS_KICAD_IFACE::AddItem(), PCAD2KICAD::PCB_LINE::AddToBoard(), PCAD2KICAD::PCB_POLYGON::AddToBoard(), BOARD_CONNECTED_ITEM_DESC::BOARD_CONNECTED_ITEM_DESC(), ALTIUM_PCB::ConvertArcs6ToBoardItemOnLayer(), ALTIUM_PCB::ConvertFills6ToBoardItemWithNet(), ALTIUM_PCB::ConvertTracks6ToBoardItemOnLayer(), TEARDROP_MANAGER::createTeardrop(), PCB_EDIT_FRAME::Edit_Zone_Params(), ZONE_SETTINGS::ExportSetting(), FOOTPRINT::FOOTPRINT(), FP_ZONE::FP_ZONE(), ROUTER_TOOL::handleLayerSwitch(), EAGLE_PLUGIN::loadPlain(), EAGLE_PLUGIN::loadSignals(), LEGACY_PLUGIN::loadTrackList(), DSN::SPECCTRA_DB::makeTRACK(), CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromShapes(), FOOTPRINT::operator=(), ALTIUM_PCB::ParsePolygons6Data(), BOARD_CONNECTED_ITEM::SetNetCode(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::transferDataToPad(), and PNS_KICAD_IFACE::UpdateItem().

◆ SetOutline()

void ZONE::SetOutline ( SHAPE_POLY_SET aOutline)
inline

Definition at line 308 of file zone.h.

308{ m_Poly = aOutline; }

References m_Poly.

Referenced by FABMASTER::loadZone().

◆ SetPadConnection()

◆ SetParent()

virtual void EDA_ITEM::SetParent ( EDA_ITEM aParent)
inlinevirtualinherited

Reimplemented in LIB_SYMBOL, and PCB_DIMENSION_BASE.

Definition at line 114 of file eda_item.h.

114{ m_parent = aParent; }

References EDA_ITEM::m_parent.

Referenced by BOARD::Add(), FOOTPRINT::Add(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), BOARD_NETLIST_UPDATER::addNewFootprint(), SCH_SHEET::AddPin(), PAD::AddPrimitive(), PAD::AddPrimitiveAnnotationBox(), PAD::AddPrimitiveArc(), PAD::AddPrimitiveCircle(), PAD::AddPrimitiveCurve(), PAD::AddPrimitivePoly(), PAD::AddPrimitiveRect(), PAD::AddPrimitiveSegment(), SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic(), SCH_SCREEN::Append(), LIB_FIELD::Copy(), SYMBOL_EDIT_FRAME::CreateNewSymbol(), SCH_DRAWING_TOOLS::createNewText(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PCB_EDIT_FRAME::ExchangeFootprint(), LIB_SYMBOL::Flatten(), FOOTPRINT::FOOTPRINT(), PCB_PLUGIN::FootprintSave(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), CADSTAR_SCH_ARCHIVE_LOADER::getKiCadSchText(), LIB_SYMBOL::LIB_SYMBOL(), SCH_LEGACY_PLUGIN_CACHE::loadAliases(), CADSTAR_SCH_ARCHIVE_LOADER::loadChildSheets(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), SCH_SEXPR_PLUGIN::loadHierarchy(), SCH_LEGACY_PLUGIN::loadHierarchy(), DIALOG_LIB_EDIT_PIN_TABLE::OnAddRow(), LIB_SYMBOL::operator=(), FOOTPRINT::operator=(), PCB_PARSER::parseFOOTPRINT_unchecked(), SCH_SEXPR_PARSER::ParseSchematic(), SCH_SEXPR_PARSER::ParseSymbol(), SCH_EDITOR_CONTROL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PCB_CONTROL::Paste(), pasteFootprintItemsToFootprintEditor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), BACK_ANNOTATE::processNetNameChange(), BOARD_COMMIT::Push(), SCH_LIB_PLUGIN_CACHE::removeSymbol(), PCB_BASE_EDIT_FRAME::saveCopyInUndoList(), SaveCopyOfZones(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SHEET_PIN::SCH_SHEET_PIN(), LIB_SYMBOL::SetFields(), PCB_DIMENSION_BASE::SetParent(), PIN_TABLE_DATA_MODEL::SetValue(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_LINE_WIRE_BUS_TOOL::startSegments(), SCH_LABEL_BASE::SwapData(), SCH_SHEET::SwapData(), SCH_SYMBOL::SwapData(), SwapItemData(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ SetParentGroup()

void BOARD_ITEM::SetParentGroup ( PCB_GROUP aGroup)
inlineinherited

◆ SetPosition()

void ZONE::SetPosition ( const VECTOR2I aPos)
inlineoverridevirtual

◆ SetSelected()

◆ SetSelectedCorner()

void ZONE::SetSelectedCorner ( int  aCorner)
inline

Definition at line 285 of file zone.h.

286 {
287 SHAPE_POLY_SET::VERTEX_INDEX selectedCorner;
288
289 // If the global index of the corner is correct, assign it to m_CornerSelection
290 if( m_Poly->GetRelativeIndices( aCorner, &selectedCorner ) )
291 {
292 if( m_CornerSelection == nullptr )
294
295 *m_CornerSelection = selectedCorner;
296 }
297 else
298 throw( std::out_of_range( "aCorner-th vertex does not exist" ) );
299 }

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

◆ SetState()

void EDA_ITEM::SetState ( EDA_ITEM_FLAGS  type,
bool  state 
)
inlineinherited

Definition at line 145 of file eda_item.h.

146 {
147 if( state )
148 m_status |= type; // state = ON or OFF
149 else
150 m_status &= ~type;
151 }

References EDA_ITEM::m_status.

Referenced by LEGACY_PLUGIN::loadTrackList(), and TRACKS_CLEANER::mergeCollinearSegments().

◆ SetStatus()

void EDA_ITEM::SetStatus ( EDA_ITEM_FLAGS  aStatus)
inlineinherited

Definition at line 154 of file eda_item.h.

154{ m_status = aStatus; }

References EDA_ITEM::m_status.

Referenced by BOARD_NETLIST_UPDATER::UpdateNetlist().

◆ SetStroke()

void BOARD_ITEM::SetStroke ( const STROKE_PARAMS aStroke)
virtualinherited

Reimplemented in PCB_SHAPE.

Definition at line 82 of file board_item.cpp.

83{
84 wxCHECK( false, /* void */ );
85}

◆ SetTeardropAreaType()

void ZONE::SetTeardropAreaType ( TEARDROP_TYPE  aType)
inline

Set the type of teardrop if the zone is a teardrop area for non teardrop area, the type must be TEARDROP_TYPE::TD_NONE.

Definition at line 681 of file zone.h.

681{ m_teardropType = aType; }

References m_teardropType.

Referenced by TEARDROP_MANAGER::createTeardrop(), and ZONE_SETTINGS::ExportSetting().

◆ SetThermalReliefGap()

void ZONE::SetThermalReliefGap ( int  aThermalReliefGap)
inline

Definition at line 169 of file zone.h.

170 {
171 if( m_thermalReliefGap != aThermalReliefGap )
172 SetNeedRefill( true );
173
174 m_thermalReliefGap = aThermalReliefGap;
175 }

References m_thermalReliefGap, and SetNeedRefill().

Referenced by ZONE_SETTINGS::ExportSetting(), EAGLE_PLUGIN::loadPolygon(), CADSTAR_PCB_ARCHIVE_LOADER::loadTemplates(), ALTIUM_PCB::ParsePolygons6Data(), and ZONE_DESC::ZONE_DESC().

◆ SetThermalReliefSpokeWidth()

void ZONE::SetThermalReliefSpokeWidth ( int  aThermalReliefSpokeWidth)
inline

Definition at line 180 of file zone.h.

181 {
182 if( m_thermalReliefSpokeWidth != aThermalReliefSpokeWidth )
183 SetNeedRefill( true );
184
185 m_thermalReliefSpokeWidth = aThermalReliefSpokeWidth;
186 }

References m_thermalReliefSpokeWidth, and SetNeedRefill().

Referenced by ZONE_SETTINGS::ExportSetting(), EAGLE_PLUGIN::loadPolygon(), CADSTAR_PCB_ARCHIVE_LOADER::loadTemplates(), ALTIUM_PCB::ParsePolygons6Data(), and ZONE_DESC::ZONE_DESC().

◆ SetWireImage()

void EDA_ITEM::SetWireImage ( )
inlineinherited

Definition at line 131 of file eda_item.h.

References IS_WIRE_IMAGE, and EDA_ITEM::SetFlags().

◆ SetX()

void BOARD_ITEM::SetX ( int  aX)
inlineinherited

Definition at line 90 of file board_item.h.

91 {
92 VECTOR2I p( aX, GetY() );
93 SetPosition( p );
94 }
int GetY() const
Definition: board_item.h:74
virtual void SetPosition(const VECTOR2I &aPos)
Definition: eda_item.h:264

References BOARD_ITEM::GetY(), and EDA_ITEM::SetPosition().

Referenced by BOARD_ITEM_DESC::BOARD_ITEM_DESC(), and TRACK_VIA_DESC::TRACK_VIA_DESC().

◆ SetY()

void BOARD_ITEM::SetY ( int  aY)
inlineinherited

Definition at line 96 of file board_item.h.

97 {
98 VECTOR2I p( GetX(), aY );
99 SetPosition( p );
100 }
int GetX() const
Definition: board_item.h:68

References BOARD_ITEM::GetX(), and EDA_ITEM::SetPosition().

Referenced by BOARD_ITEM_DESC::BOARD_ITEM_DESC(), and TRACK_VIA_DESC::TRACK_VIA_DESC().

◆ SetZoneName()

◆ Sort()

static bool EDA_ITEM::Sort ( const EDA_ITEM aLeft,
const EDA_ITEM aRight 
)
inlinestaticinherited

Helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers.

Parameters
aLeftThe left hand item to compare.
aRightThe right hand item to compare.
Returns
True if aLeft is less than aRight.

Definition at line 452 of file eda_item.h.

452{ return *aLeft < *aRight; }

◆ SwapData()

void ZONE::SwapData ( BOARD_ITEM aImage)
overridevirtual

Swap data between aItem and aImage.

aItem and aImage should have the same type.

Used in undo and redo commands to swap values between an item and its copy. Only values like layer, size .. which are modified by editing are swapped.

Parameters
aImagethe item image which contains data to swap.

Reimplemented from BOARD_ITEM.

Definition at line 935 of file zone.cpp.

936{
937 assert( aImage->Type() == PCB_ZONE_T || aImage->Type() == PCB_FP_ZONE_T );
938
939 std::swap( *((ZONE*) this), *((ZONE*) aImage) );
940}

References PCB_FP_ZONE_T, PCB_ZONE_T, and EDA_ITEM::Type().

◆ TransformShapeWithClearanceToPolygon()

void ZONE::TransformShapeWithClearanceToPolygon ( SHAPE_POLY_SET aCornerBuffer,
PCB_LAYER_ID  aLayer,
int  aClearanceValue,
int  aError,
ERROR_LOC  aErrorLoc,
bool  ignoreLineWidth = false 
) const
overridevirtual

Convert the zone shape to a closed polygon Used in filling zones calculations Circles and arcs are approximated by segments.

Parameters
aLayeris the layer of the filled zone to retrieve
aCornerBufferis a buffer to store the polygon
aClearanceValueis the clearance around the pad
aErroris the maximum deviation from true circle
ignoreLineWidthis used for edge cut items where the line width is only for visualization

Reimplemented from BOARD_ITEM.

Definition at line 1238 of file zone.cpp.

1241{
1242 wxASSERT_MSG( !aIgnoreLineWidth, wxT( "IgnoreLineWidth has no meaning for zones." ) );
1243
1244 if( !m_FilledPolysList.count( aLayer ) )
1245 return;
1246
1247 if( !aClearance )
1248 {
1249 aCornerBuffer.Append( *m_FilledPolysList.at( aLayer ) );
1250 return;
1251 }
1252
1253 SHAPE_POLY_SET temp_buf = m_FilledPolysList.at( aLayer )->CloneDropTriangulation();
1254
1255 // Rebuild filled areas only if clearance is not 0
1256 int numSegs = GetArcToSegmentCount( aClearance, aError, FULL_CIRCLE );
1257
1258 if( aErrorLoc == ERROR_OUTSIDE )
1259 aClearance += aError;
1260
1261 temp_buf.InflateWithLinkedHoles( aClearance, numSegs, SHAPE_POLY_SET::PM_FAST );
1262
1263 aCornerBuffer.Append( temp_buf );
1264}
void InflateWithLinkedHoles(int aFactor, int aCircleSegmentsCount, POLYGON_MODE aFastMode)
Perform outline inflation/deflation, using round corners.
static constexpr EDA_ANGLE & FULL_CIRCLE
Definition: eda_angle.h:410
@ ERROR_OUTSIDE
int GetArcToSegmentCount(int aRadius, int aErrorMax, const EDA_ANGLE &aArcAngle)

References SHAPE_POLY_SET::Append(), ERROR_OUTSIDE, FULL_CIRCLE, GetArcToSegmentCount(), SHAPE_POLY_SET::InflateWithLinkedHoles(), m_FilledPolysList, and SHAPE_POLY_SET::PM_FAST.

Referenced by PCB_BASE_FRAME::FocusOnItems().