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...
 
bool IsConflicting () const
 For rule areas which exclude footprints (and therefore participate in courtyard conflicts during move). 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...
 
wxString GetFriendlyName () const override
 
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
 
void CacheBoundingBox ()
 Used to preload the zone bounding box cache so we don't have to worry about mutex-locking it each time. More...
 
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 * > *aSameNetCollidingZones, std::vector< ZONE * > *aOtherNetIntersectingZones) 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 &aBuffer) 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 &aBuffer, 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 TransformShapeToPolygon (SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, 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 GetItemDescription (UNITS_PROVIDER *aUnitsProvider) const override
 Return a user-visible description string of this item. 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)
 
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
 
wxString GetUnescapedShortNetname () 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...
 
void SwapItemData (BOARD_ITEM *aImage)
 Swap data between aItem and aImage. 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 IsSelected () const
 
bool IsEntered () const
 
bool IsBrightened () const
 
bool IsRollover () const
 
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 XorFlags (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 () const
 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 void swapData (BOARD_ITEM *aImage) override
 
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
 
LSET m_fillFlags
 Temp variables used while filling. More...
 
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
66
67 aParent->GetZoneSettings().ExportSetting( *this );
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:871
int m_borderHatchPitch
Definition: zone.h:892
int m_cornerSmoothingType
Definition: zone.h:790
int m_ZoneMinThickness
Definition: zone.h:826
void SetLocalFlags(int aFlags)
Definition: zone.h:310
int m_thermalReliefSpokeWidth
Definition: zone.h:848
wxString m_zoneName
An optional unique name for this zone, used for identifying it in DRC checking.
Definition: zone.h:794
double m_outlinearea
Definition: zone.h:899
bool m_needRefill
False when a zone was refilled, true after changes in zone params.
Definition: zone.h:845
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:789
TEARDROP_TYPE m_teardropType
Definition: zone.h:813
void SetIsRuleArea(bool aEnable)
Definition: zone.h:704
int m_fillVersion
Definition: zone.h:827
unsigned m_priority
Definition: zone.h:802
ISLAND_REMOVAL_MODE m_islandRemovalMode
Definition: zone.h:829
bool m_isFilled
True when a zone was filled, false after deleting the filled areas.
Definition: zone.h:838
int m_thermalReliefGap
Definition: zone.h:847
double m_area
Definition: zone.h:898
unsigned int m_cornerRadius
Definition: zone.h:791
static int GetDefaultHatchPitch()
Definition: zone.cpp:985
ZONE_BORDER_DISPLAY_STYLE m_borderStyle
Definition: zone.h:891
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:102

References InitDataFromSrcInCopyCtor().

◆ ~ZONE()

ZONE::~ZONE ( )

Definition at line 92 of file zone.cpp.

93{
94 delete m_Poly;
95 delete m_CornerSelection;
96
97 if( BOARD* board = GetBoard() )
98 board->IncrementTimeStamp();
99}
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:43
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265

References BOARD_ITEM::GetBoard(), m_CornerSelection, and m_Poly.

Member Function Documentation

◆ AddPolygon() [1/2]

void ZONE::AddPolygon ( const SHAPE_LINE_CHAIN aPolygon)

Definition at line 729 of file zone.cpp.

730{
731 wxASSERT( aPolygon.IsClosed() );
732
733 // Add the outline as a new polygon in the polygon set
734 if( m_Poly->OutlineCount() == 0 )
735 m_Poly->AddOutline( aPolygon );
736 else
737 m_Poly->AddHole( aPolygon );
738
739 SetNeedRefill( true );
740}
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:246

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

744{
745 if( aPolygon.empty() )
746 return;
747
748 SHAPE_LINE_CHAIN outline;
749
750 // Create an outline and populate it with the points of aPolygon
751 for( const VECTOR2I& pt : aPolygon )
752 outline.Append( pt );
753
754 outline.SetClosed( true );
755
756 AddPolygon( outline );
757}
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:743

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

761{
762 // Ensure the main outline exists:
763 if( m_Poly->OutlineCount() == 0 )
765
766 // If aHoleIdx >= 0, the corner musty be added to the hole, index aHoleIdx.
767 // (remember: the index of the first hole is 0)
768 // Return error if it does not exist.
769 if( aHoleIdx >= m_Poly->HoleCount( 0 ) )
770 return false;
771
772 m_Poly->Append( aPosition.x, aPosition.y, -1, aHoleIdx, aAllowDuplication );
773
774 SetNeedRefill( true );
775
776 return true;
777}
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 396 of file zone.cpp.

397{
398 if( !m_FilledPolysList.count( aLayer ) )
400 else
401 m_filledPolysHash[aLayer] = m_FilledPolysList.at( aLayer )->GetHash();
402}
MD5_HASH GetHash() const
std::map< PCB_LAYER_ID, std::shared_ptr< SHAPE_POLY_SET > > m_FilledPolysList
Definition: zone.h:883
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:889
static SHAPE_POLY_SET g_nullPoly
Definition: zone.cpp:384

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

Referenced by ZONE_FILLER::Fill().

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

1072{
1073 if( GetNumCorners() <= 2 ) // malformed zone. polygon calculations will not like it ...
1074 return false;
1075
1076 // Processing of arc shapes in zones is not yet supported because Clipper can't do boolean
1077 // operations on them. The poly outline must be converted to segments first.
1079 flattened.ClearArcs();
1080
1081 if( GetIsRuleArea() )
1082 {
1083 // We like keepouts just the way they are....
1084 aSmoothedPoly = flattened;
1085 return true;
1086 }
1087
1088 const BOARD* board = GetBoard();
1089 int maxError = ARC_HIGH_DEF;
1090 bool keepExternalFillets = false;
1093
1094 if( IsTeardropArea() )
1095 {
1096 // We use teardrop shapes with no smoothing; these shapes are already optimized
1097 smooth_requested = false;
1098 }
1099
1100 if( board )
1101 {
1103
1104 maxError = bds.m_MaxError;
1105 keepExternalFillets = bds.m_ZoneKeepExternalFillets;
1106 }
1107
1108 auto smooth = [&]( SHAPE_POLY_SET& aPoly )
1109 {
1110 if( !smooth_requested )
1111 return;
1112
1113 switch( m_cornerSmoothingType )
1114 {
1116 aPoly = aPoly.Chamfer( (int) m_cornerRadius );
1117 break;
1118
1120 {
1121 aPoly = aPoly.Fillet( (int) m_cornerRadius, maxError );
1122 break;
1123 }
1124
1125 default:
1126 break;
1127 }
1128 };
1129
1130 SHAPE_POLY_SET* maxExtents = &flattened;
1131 SHAPE_POLY_SET withFillets;
1132
1133 aSmoothedPoly = flattened;
1134
1135 // Should external fillets (that is, those applied to concave corners) be kept? While it
1136 // seems safer to never have copper extend outside the zone outline, 5.1.x and prior did
1137 // indeed fill them so we leave the mode available.
1138 if( keepExternalFillets && smooth_requested )
1139 {
1140 withFillets = flattened;
1141 smooth( withFillets );
1142 withFillets.BooleanAdd( flattened, SHAPE_POLY_SET::PM_FAST );
1143 maxExtents = &withFillets;
1144 }
1145
1146 // We now add in the areas of any same-net, intersecting zones. This keeps us from smoothing
1147 // corners at an intersection (which often produces undesired divots between the intersecting
1148 // zones -- see #2752).
1149 //
1150 // After smoothing, we'll subtract back out everything outside of our zone.
1151 std::vector<ZONE*> sameNetCollidingZones;
1152 std::vector<ZONE*> otherNetIntersectingZones;
1153 GetInteractingZones( aLayer, &sameNetCollidingZones, &otherNetIntersectingZones );
1154
1155 for( ZONE* sameNetZone : sameNetCollidingZones )
1156 {
1157 BOX2I sameNetBoundingBox = sameNetZone->GetBoundingBox();
1158 SHAPE_POLY_SET sameNetPoly = sameNetZone->Outline()->CloneDropTriangulation();
1159
1160 sameNetPoly.ClearArcs();
1161
1162 // Of course there's always a wrinkle. The same-net intersecting zone *might* get knocked
1163 // out along the border by a higher-priority, different-net zone. #12797
1164 for( ZONE* otherNetZone : otherNetIntersectingZones )
1165 {
1166 if( otherNetZone->HigherPriority( sameNetZone )
1167 && otherNetZone->GetBoundingBox().Intersects( sameNetBoundingBox ) )
1168 {
1169 sameNetPoly.BooleanSubtract( *otherNetZone->Outline(), SHAPE_POLY_SET::PM_FAST );
1170 }
1171 }
1172
1173 aSmoothedPoly.BooleanAdd( sameNetPoly, SHAPE_POLY_SET::PM_FAST );
1174 }
1175
1176 if( aBoardOutline )
1177 aSmoothedPoly.BooleanIntersection( *aBoardOutline, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
1178
1179 smooth( aSmoothedPoly );
1180
1181 if( aSmoothedPolyWithApron )
1182 {
1183 SHAPE_POLY_SET poly = maxExtents->CloneDropTriangulation();
1184 poly.Inflate( m_ZoneMinThickness, 64 );
1185 *aSmoothedPolyWithApron = aSmoothedPoly;
1186 aSmoothedPolyWithApron->BooleanIntersection( poly, SHAPE_POLY_SET::PM_FAST );
1187 }
1188
1189 aSmoothedPoly.BooleanIntersection( *maxExtents, SHAPE_POLY_SET::PM_FAST );
1190
1191 return true;
1192}
constexpr int ARC_HIGH_DEF
Definition: base_units.h:121
Container for design settings for a BOARD object.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:682
void BooleanSubtract(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset intersection For aFastMode meaning, see function booleanOp.
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:697
bool IsTeardropArea() const
Definition: zone.h:681
void GetInteractingZones(PCB_LAYER_ID aLayer, std::vector< ZONE * > *aSameNetCollidingZones, std::vector< ZONE * > *aOtherNetIntersectingZones) const
Some intersecting zones, despite being on the same layer with the same net, cannot be merged due to o...
Definition: zone.cpp:1034
int GetNumCorners(void) const
Access to m_Poly parameters.
Definition: zone.h:490

References ARC_HIGH_DEF, SHAPE_POLY_SET::BooleanAdd(), SHAPE_POLY_SET::BooleanIntersection(), SHAPE_POLY_SET::BooleanSubtract(), 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 ( )

Used to preload the zone bounding box cache so we don't have to worry about mutex-locking it each time.

Definition at line 345 of file zone.cpp.

346{
347 BOARD* board = GetBoard();
348 std::unordered_map<const ZONE*, BOX2I>& cache = board->m_ZoneBBoxCache;
349
350 auto cacheIter = cache.find( this );
351
352 if( cacheIter == cache.end() )
353 {
354 std::unique_lock<std::mutex> cacheLock( board->m_CachesMutex );
355 cache[ this ] = m_Poly->BBox();
356 }
357}
std::unordered_map< const ZONE *, BOX2I > m_ZoneBBoxCache
Definition: board.h:1147
std::mutex m_CachesMutex
Definition: board.h:1138
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(), BOARD_ITEM::GetBoard(), BOARD::m_CachesMutex, m_Poly, and BOARD::m_ZoneBBoxCache.

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

1006{
1007 if( aLayer == UNDEFINED_LAYER )
1008 {
1009 for( auto& [ layer, poly ] : m_FilledPolysList )
1010 poly->CacheTriangulation();
1011
1012 m_Poly->CacheTriangulation( false );
1013 }
1014 else
1015 {
1016 if( m_FilledPolysList.count( aLayer ) )
1017 m_FilledPolysList[ aLayer ]->CacheTriangulation();
1018 }
1019}
void CacheTriangulation(bool aPartition=true, bool aSimplify=false)
Build a polygon triangulation, needed to draw a polygon on OpenGL and in some other calculations.
@ 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 1195 of file zone.cpp.

1196{
1197 m_area = 0.0;
1198
1199 // Iterate over each outline polygon in the zone and then iterate over
1200 // each hole it has to compute the total area.
1201 for( std::pair<const PCB_LAYER_ID, std::shared_ptr<SHAPE_POLY_SET>>& pair : m_FilledPolysList )
1202 {
1203 std::shared_ptr<SHAPE_POLY_SET>& poly = pair.second;
1204
1205 for( int i = 0; i < poly->OutlineCount(); i++ )
1206 {
1207 m_area += poly->Outline( i ).Area();
1208
1209 for( int j = 0; j < poly->HoleCount( i ); j++ )
1210 m_area -= poly->Hole( i, j ).Area();
1211 }
1212 }
1213
1214 return m_area;
1215}
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59

References m_area, and m_FilledPolysList.

Referenced by TEARDROP_MANAGER::createTeardrop(), and ZONE_FILLER::Fill().

◆ CalculateOutlineArea()

double ZONE::CalculateOutlineArea ( )

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

Returns
the currently calculated area

Definition at line 1218 of file zone.cpp.

1219{
1221 return m_outlinearea;
1222}
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 520 of file zone.h.

521 {
522 return m_Poly->CIterateWithHoles();
523 }
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:97

References PCB_ZONE_T, and EDA_ITEM::Type().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 119 of file eda_item.h.

void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:141
#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 141 of file eda_item.h.

141{ m_flags &= ~aMask; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:498

References EDA_ITEM::m_flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_MOVE_TOOL::AlignElements(), SCH_EDIT_TOOL::BreakWire(), FOOTPRINT::BuildCourtyardCaches(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), 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(), PCB_TOOL_BASE::doInteractiveItemPlacement(), 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_INTERACTIVE_COURTYARD_CLEARANCE::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(), EE_SELECTION_TOOL::selectMultiple(), SCH_EDIT_FRAME::SelectUnit(), EDA_ITEM::SetIsShownAsBitmap(), BOARD_COMMIT::Stage(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), SCH_DRAWING_TOOLS::TwoClickPlace(), and EE_SELECTION_TOOL::unhighlight().

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 153 of file eda_item.h.

154 {
156 }
#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 SKIP_STRUCT
flag indicating that the structure should be ignored
#define CANDIDATE
flag indicating that the structure is connected

References CANDIDATE, EDA_ITEM::ClearFlags(), 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 180 of file zone.cpp.

181{
182 return new ZONE( *this );
183}
ZONE(BOARD_ITEM_CONTAINER *parent, bool aInFP=false)
The ctor to build ZONE, but 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 150 of file board_item.cpp.

151{
153
154 if( parent )
155 parent->Remove( this );
156
157 delete this;
158}
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:163

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

Referenced by 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 184 of file board_item.cpp.

185{
186 BOARD_ITEM* dupe = static_cast<BOARD_ITEM*>( Clone() );
187 const_cast<KIID&>( dupe->m_Uuid ) = KIID();
188
189 if( dupe->GetParentGroup() )
190 dupe->GetParentGroup()->AddItem( dupe );
191
192 return static_cast<BOARD_ITEM*>( dupe );
193}
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:58
PCB_GROUP * GetParentGroup() const
Definition: board_item.h:72
const KIID m_Uuid
Definition: eda_item.h:492
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:48
bool AddItem(BOARD_ITEM *aItem)
Add item to group.
Definition: pcb_group.cpp:80

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

696{
697 Mirror( aCentre, aFlipLeftRight );
698
699 SetLayerSet( FlipLayerMask( GetLayerSet(), GetBoard()->GetCopperLayerCount() ) );
700}
void Mirror(const VECTOR2I &aMirrorRef, bool aMirrorLeftRight)
Mirror the outlines relative to a given horizontal axis the layer is not changed.
Definition: zone.cpp:703
void SetLayerSet(LSET aLayerSet) override
Definition: zone.cpp:266
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: zone.h:122
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:316
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:74
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:76
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:62
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:46

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(), PROPERTIES_PANEL::getItemValue(), 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 57 of file board_item.cpp.

58{
59 if( Type() == PCB_T )
60 return static_cast<BOARD*>( this );
61
62 BOARD_ITEM* parent = GetParent();
63
64 if( parent )
65 return parent->GetBoard();
66
67 return nullptr;
68}
@ 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 43 of file board_item.cpp.

44{
45 if( Type() == PCB_T )
46 return static_cast<const BOARD*>( this );
47
48 BOARD_ITEM* parent = GetParent();
49
50 if( parent )
51 return parent->GetBoard();
52
53 return nullptr;
54}

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

Referenced by BOARD_ADAPTER::addShape(), FOOTPRINT::BuildCourtyardCaches(), PAD::BuildEffectivePolygon(), PAD::BuildEffectiveShapes(), BuildSmoothedPoly(), CacheBoundingBox(), collidesWithArea(), KIGFX::PCB_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), enclosedByAreaFunc(), existsOnLayerFunc(), PCB_VIA::FlashLayer(), PAD::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(), PCB_PLUGIN::format(), fromToFunc(), BOARD_ITEM::GetBoard(), PCB_EXPR_CONTEXT::GetBoard(), NETINFO_ITEM::GetBoundingBox(), GetBoundingBox(), FOOTPRINT::GetBoundingBox(), FOOTPRINT::GetBoundingHull(), FOOTPRINT::GetCourtyard(), BOARD_CONNECTED_ITEM::GetEffectiveNetClass(), FP_TEXT::GetEffectiveShape(), PCB_TEXT::GetEffectiveShape(), getFieldFunc(), GetInteractingZones(), GetItemDescription(), 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(), PCB_MARKER::GetSeverity(), PAD::GetSolderMaskExpansion(), PCB_VIA::GetSolderMaskExpansion(), PAD::GetSolderPasteMargin(), BOARD::GetTrackLength(), PCB_TRACK::GetWidthConstraint(), inDiffPairFunc(), ROUTER_TOOL::Init(), intersectsAreaFunc(), intersectsBackCourtyardFunc(), intersectsCourtyardFunc(), intersectsFrontCourtyardFunc(), BOARD_ITEM::IsLocked(), PCB_VIA::IsTented(), BOARD_ITEM::layerMaskDescribe(), PCB_VIA::layerMaskDescribe(), PAD::MergePrimitivesAsPolygon(), Move(), DIALOG_TEXTBOX_PROPERTIES::onBorderChecked(), EAGLE_PLUGIN::packageWire(), padsNeedUpdate(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), BOARD::ResolveDRCExclusions(), FOOTPRINT::ResolveTextVar(), 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(), BOARD::UpdateRatsnestExclusions(), FOOTPRINT::ViewBBox(), PAD::ViewBBox(), PCB_TRACK::ViewBBox(), PAD::ViewGetLOD(), PCB_BITMAP::ViewGetLOD(), PCB_VIA::ViewGetLOD(), FOOTPRINT::~FOOTPRINT(), and ~ZONE().

◆ GetBorderHatchPitch()

int ZONE::GetBorderHatchPitch ( ) const

HatchBorder related methods.

Returns
the zone hatch pitch in iu.

Definition at line 814 of file zone.cpp.

815{
816 return m_borderHatchPitch;
817}

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

324{
325 if( const BOARD* board = GetBoard() )
326 {
327 std::unordered_map<const ZONE*, BOX2I>& cache = board->m_ZoneBBoxCache;
328 auto cacheIter = cache.find( this );
329
330 if( cacheIter != cache.end() )
331 return cacheIter->second;
332
333 BOX2I bbox = m_Poly->BBox();
334
335 std::unique_lock<std::mutex> cacheLock( const_cast<BOARD*>( board )->m_CachesMutex );
336 cache[ this ] = bbox;
337
338 return bbox;
339 }
340
341 return m_Poly->BBox();
342}

References SHAPE_POLY_SET::BBox(), BOARD_ITEM::GetBoard(), and m_Poly.

Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), ZONE_FILLER::buildCopperItemClearances(), ZONE_FILLER::buildThermalSpokes(), collidesWithArea(), ZONE_FILLER::Fill(), ZONE_FILLER::fillNonCopperZone(), GetInteractingZones(), HitTest(), ZONE_FILLER::knockoutThermalReliefs(), ALTIUM_PCB::ParsePolygons6Data(), DRC_TEST_PROVIDER_DISALLOW::Run(), ZONE_FILLER::subtractHigherPriorityZones(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZone(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testItemAgainstZones(), DRC_TEST_PROVIDER_SOLDER_MASK::testMaskItemAgainstZones(), and DRC_TEST_PROVIDER_ZONE_CONNECTIONS::testZoneLayer().

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

94 {
95 return GetBoundingBox().GetCenter();
96 }
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 482 of file zone.h.

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

◆ GetCornerPosition()

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

Definition at line 530 of file zone.h.

531 {
533
534 // Convert global to relative indices
535 if( !m_Poly->GetRelativeIndices( aCornerIndex, &index ) )
536 throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
537
538 return m_Poly->CVertex( index );
539 }
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 652 of file zone.h.

652{ 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 145 of file eda_item.h.

146 {
147 constexpr int mask =
149
150 return m_flags & mask;
151 }
#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_BROKEN
Is a segment just broken by BreakSegment.
#define STRUCT_DELETED
flag indication structures to be erased
#define IS_MOVING
Item being moved.

References IS_BROKEN, IS_CHANGED, IS_MOVING, IS_NEW, IS_PASTED, 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 229 of file board_item.cpp.

230{
231 static std::shared_ptr<SHAPE_SEGMENT> slot;
232
234
235 return slot;
236}
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:112

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.
aFlashoptional parameter allowing a caller to force the pad to be flashed (or not flashed) on the current layer (default is to honour the pad's setting and the current connections for the given layer).

Reimplemented from BOARD_ITEM.

Definition at line 1311 of file zone.cpp.

1312{
1313 if( m_FilledPolysList.find( aLayer ) == m_FilledPolysList.end() )
1314 return std::make_shared<SHAPE_NULL>();
1315 else
1316 return m_FilledPolysList.at( aLayer );
1317}

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

216 {
217 return m_area;
218 }

References m_area.

◆ GetFilledPolysList()

◆ GetFillFlag()

int ZONE::GetFillFlag ( PCB_LAYER_ID  aLayer)
inline

Definition at line 235 of file zone.h.

236 {
237 return m_fillFlags.test( aLayer );
238 }
LSET m_fillFlags
Temp variables used while filling.
Definition: zone.h:886

References m_fillFlags.

◆ GetFillMode()

ZONE_FILL_MODE ZONE::GetFillMode ( ) const
inline

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

256{ return GetPosition(); }
virtual VECTOR2I GetPosition() const
Definition: eda_item.h:249

References EDA_ITEM::GetPosition().

Referenced by SCH_EDIT_FRAME::FocusOnItem().

◆ GetFriendlyName()

wxString ZONE::GetFriendlyName ( ) const
overridevirtual

Reimplemented from EDA_ITEM.

Definition at line 656 of file zone.cpp.

657{
658 if( GetIsRuleArea() )
659 return _( "Rule Area" );
660 else if( IsTeardropArea() )
661 return _( "Teardrop Area" );
662 else if( IsOnCopperLayer() )
663 return _( "Copper Zone" );
664 else
665 return _( "Non-copper Zone" );
666}
bool IsOnCopperLayer() const override
Definition: zone.cpp:254
#define _(s)

References _, GetIsRuleArea(), IsOnCopperLayer(), and IsTeardropArea().

Referenced by GetMsgPanelInfo().

◆ GetHashValue()

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

Definition at line 387 of file zone.cpp.

388{
389 if( !m_filledPolysHash.count( aLayer ) )
390 return g_nullPoly.GetHash();
391 else
392 return m_filledPolysHash.at( aLayer );
393}

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

Referenced by ZONE_FILLER::Fill().

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

761{ return m_borderHatchLines; }
std::vector< SEG > m_borderHatchLines
Definition: zone.h:893

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

580{ 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 * > *  aSameNetCollidingZones,
std::vector< ZONE * > *  aOtherNetIntersectingZones 
) 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 1034 of file zone.cpp.

1036{
1037 int epsilon = pcbIUScale.mmToIU( 0.001 );
1038 BOX2I bbox = GetBoundingBox();
1039
1040 bbox.Inflate( epsilon );
1041
1042 for( ZONE* candidate : GetBoard()->Zones() )
1043 {
1044 if( candidate == this )
1045 continue;
1046
1047 if( !candidate->GetLayerSet().test( aLayer ) )
1048 continue;
1049
1050 if( candidate->GetIsRuleArea() || candidate->IsTeardropArea() )
1051 continue;
1052
1053 if( !candidate->GetBoundingBox().Intersects( bbox ) )
1054 continue;
1055
1056 if( candidate->GetNetCode() == GetNetCode() )
1057 {
1058 if( m_Poly->Collide( candidate->m_Poly ) )
1059 aSameNetCollidingZones->push_back( candidate );
1060 }
1061 else
1062 {
1063 aOtherNetIntersectingZones->push_back( candidate );
1064 }
1065 }
1066}
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:506
bool Collide(const SHAPE *aShape, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
Check if the boundary of shape (this) lies closer to the shape aShape than aClearance,...
const BOX2I GetBoundingBox() const override
Definition: zone.cpp:323
constexpr int mmToIU(double mm) const
Definition: base_units.h:89

References SHAPE_POLY_SET::Collide(), BOARD_ITEM::GetBoard(), GetBoundingBox(), 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()

◆ GetItemDescription()

wxString ZONE::GetItemDescription ( UNITS_PROVIDER aUnitsProvider) const
overridevirtual

Return a user-visible description string of this item.

This description is used in disambiguation menus, the message panel, ERC/DRC reports, etc.

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

781{
782 wxString layerDesc;
783 int count = 0;
784
785 for( PCB_LAYER_ID layer : m_layerSet.Seq() )
786 {
787 if( count == 0 )
788 layerDesc = GetBoard()->GetLayerName( layer );
789
790 count++;
791 }
792
793 if( count > 1 )
794 layerDesc.Printf( _( "%s and %d more" ), layerDesc, count - 1 );
795
796 // Check whether the selected contour is a hole (contour index > 0)
797 if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
798 {
799 if( GetIsRuleArea() )
800 return wxString::Format( _( "Rule Area Cutout on %s" ), layerDesc );
801 else
802 return wxString::Format( _( "Zone Cutout on %s" ), layerDesc );
803 }
804 else
805 {
806 if( GetIsRuleArea() )
807 return wxString::Format( _( "Rule Area on %s" ), layerDesc );
808 else
809 return wxString::Format( _( "Zone %s on %s" ), GetNetnameMsg(), layerDesc );
810 }
811}
wxString GetNetnameMsg() const
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:452
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
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

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

◆ GetLayer()

PCB_LAYER_ID ZONE::GetLayer ( ) const
overridevirtual

Return the primary layer this item is on.

Reimplemented from BOARD_ITEM.

Definition at line 239 of file zone.cpp.

240{
241 return BOARD_ITEM::GetLayer();
242}
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:180

References BOARD_ITEM::GetLayer().

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

◆ GetLayerName()

wxString BOARD_ITEM::GetLayerName ( ) const
inherited

◆ GetLayerSet()

◆ GetLocalClearance() [1/2]

int ZONE::GetLocalClearance ( ) const
inline

Definition at line 152 of file zone.h.

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

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

471{
472 if( m_isRuleArea )
473 return 0;
474
475 if( aSource )
476 *aSource = _( "zone" );
477
478 return m_ZoneClearance;
479}
int m_ZoneClearance
Definition: zone.h:825

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

147{ return 0; }

Referenced by DRC_ENGINE::EvalRules().

◆ GetLocalFlags()

int ZONE::GetLocalFlags ( ) const
inline

Definition at line 309 of file zone.h.

309{ return m_localFlgs; }
int m_localFlgs
Definition: zone.h:873

References m_localFlgs.

Referenced by InitDataFromSrcInCopyCtor().

◆ GetLocalRatsnestVisible()

bool BOARD_CONNECTED_ITEM::GetLocalRatsnestVisible ( ) const
inlineinherited

◆ GetLock()

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

Definition at line 230 of file zone.h.

231 {
232 return m_lock;
233 }
std::mutex m_lock
Lock used for multi-threaded filling on multi-layer zones.
Definition: zone.h:902

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

992{
993 return BITMAPS::add_zone;
994}

References add_zone.

◆ GetMinIslandArea()

long long int ZONE::GetMinIslandArea ( ) const
inline

Definition at line 714 of file zone.h.

714{ 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:835

References m_minIslandArea.

Referenced by KI_TEST::CheckFpZone(), ZONE_FILLER::Fill(), 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 521 of file zone.cpp.

522{
523 wxString msg = GetFriendlyName();
524
525 // Display Cutout instead of Outline for holes inside a zone (i.e. when num contour !=0).
526 // Check whether the selected corner is in a hole; i.e., in any contour but the first one.
527 if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
528 msg << wxT( " " ) << _( "Cutout" );
529
530 aList.emplace_back( _( "Type" ), msg );
531
532 if( GetIsRuleArea() )
533 {
534 msg.Empty();
535
536 if( GetDoNotAllowVias() )
537 AccumulateDescription( msg, _( "No vias" ) );
538
539 if( GetDoNotAllowTracks() )
540 AccumulateDescription( msg, _( "No tracks" ) );
541
542 if( GetDoNotAllowPads() )
543 AccumulateDescription( msg, _( "No pads" ) );
544
546 AccumulateDescription( msg, _( "No copper zones" ) );
547
549 AccumulateDescription( msg, _( "No footprints" ) );
550
551 if( !msg.IsEmpty() )
552 aList.emplace_back( _( "Restrictions" ), msg );
553 }
554 else if( IsOnCopperLayer() )
555 {
556 if( aFrame->GetName() == PCB_EDIT_FRAME_NAME )
557 {
558 aList.emplace_back( _( "Net" ), UnescapeString( GetNetname() ) );
559
560 aList.emplace_back( _( "Resolved Netclass" ),
561 UnescapeString( GetEffectiveNetClass()->GetName() ) );
562 }
563
564 // Display priority level
565 aList.emplace_back( _( "Priority" ),
566 wxString::Format( wxT( "%d" ), GetAssignedPriority() ) );
567 }
568
569 if( aFrame->GetName() == PCB_EDIT_FRAME_NAME )
570 {
571 if( IsLocked() )
572 aList.emplace_back( _( "Status" ), _( "Locked" ) );
573 }
574
575 wxString layerDesc;
576 int count = 0;
577
578 for( PCB_LAYER_ID layer : m_layerSet.Seq() )
579 {
580 if( count == 0 )
581 layerDesc = GetBoard()->GetLayerName( layer );
582
583 count++;
584 }
585
586 if( count > 1 )
587 layerDesc.Printf( _( "%s and %d more" ), layerDesc, count - 1 );
588
589 aList.emplace_back( _( "Layer" ), layerDesc );
590
591 if( !m_zoneName.empty() )
592 aList.emplace_back( _( "Name" ), m_zoneName );
593
594 switch( m_fillMode )
595 {
596 case ZONE_FILL_MODE::POLYGONS: msg = _( "Solid" ); break;
597 case ZONE_FILL_MODE::HATCH_PATTERN: msg = _( "Hatched" ); break;
598 default: msg = _( "Unknown" ); break;
599 }
600
601 aList.emplace_back( _( "Fill Mode" ), msg );
602
603 aList.emplace_back( _( "Filled Area" ),
605
606 wxString source;
607 int clearance = GetOwnClearance( UNDEFINED_LAYER, &source );
608
609 if( !source.IsEmpty() )
610 {
611 aList.emplace_back( wxString::Format( _( "Min Clearance: %s" ),
612 aFrame->MessageTextFromValue( clearance ) ),
613 wxString::Format( _( "(from %s)" ),
614 source ) );
615 }
616
617 if( !m_FilledPolysList.empty() )
618 {
619 count = 0;
620
621 for( std::pair<const PCB_LAYER_ID, std::shared_ptr<SHAPE_POLY_SET>>& ii: m_FilledPolysList )
622 count += ii.second->TotalVertices();
623
624 aList.emplace_back( _( "Corner Count" ), wxString::Format( wxT( "%d" ), count ) );
625 }
626}
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:71
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:699
bool GetDoNotAllowPads() const
Definition: zone.h:701
wxString GetFriendlyName() const override
Definition: zone.cpp:656
bool GetDoNotAllowTracks() const
Definition: zone.h:700
bool GetDoNotAllowFootprints() const
Definition: zone.h:702
bool GetDoNotAllowCopperPour() const
Definition: zone.h:698
unsigned GetAssignedPriority() const
Definition: zone.h:112
#define PCB_EDIT_FRAME_NAME
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(), GetFriendlyName(), GetIsRuleArea(), BOARD::GetLayerName(), BOARD_CONNECTED_ITEM::GetNetname(), BOARD_CONNECTED_ITEM::GetOwnClearance(), HATCH_PATTERN, BOARD_ITEM::IsLocked(), IsOnCopperLayer(), 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:114

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::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(), 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::GetItemDescription(), PCB_TRACK::GetItemDescription(), PCB_VIA::GetItemDescription(), and GetItemDescription().

◆ GetNumCorners()

int ZONE::GetNumCorners ( void  ) const
inline

Access to m_Poly parameters.

Definition at line 490 of file zone.h.

491 {
492 return m_Poly->TotalVertices();
493 }
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 225 of file zone.h.

226 {
227 return m_outlinearea;
228 }

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:149
MINOPTMAX< int > & Value()
Definition: drc_rule.h:142
T Min() const
Definition: minoptmax.h:33
bool HasMin() const
Definition: minoptmax.h:37
@ CLEARANCE_CONSTRAINT
Definition: drc_rule.h:47

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

248{ return m_PadConnection; }
ZONE_CONNECTION m_PadConnection
Definition: zone.h:824

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

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

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(), getClosestGroup(), FP_TEXT::GetItemDescription(), FP_TEXTBOX::GetItemDescription(), BOARD_ITEM::GetParentFootprint(), ALIGN_DISTRIBUTE_TOOL::GetSelections(), FP_TEXT::GetShownText(), FP_TEXTBOX::GetShownText(), PCB_TEXT::GetShownText(), PCB_TEXTBOX::GetShownText(), 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(), BOARD_ITEM::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 233 of file zone.cpp.

234{
235 return GetCornerPosition( 0 );
236}
const VECTOR2I & GetCornerPosition(int aCornerIndex) const
Definition: zone.h:530

References GetCornerPosition().

Referenced by EAGLE_PLUGIN::loadPlain().

◆ GetSelectedCorner()

int ZONE::GetSelectedCorner ( ) const
inline

Definition at line 281 of file zone.h.

282 {
283 // Transform relative indices to global index
284 int globalIndex = -1;
285
287 m_Poly->GetGlobalIndex( *m_CornerSelection, globalIndex );
288
289 return globalIndex;
290 }
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.

◆ 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 ? m_netinfo->GetShortNetname() : wxString();
137}
const wxString & GetShortNetname() const
Definition: netinfo.h:125

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

Referenced by 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 265 of file eda_item.h.

265{ return GetPosition(); }

References EDA_ITEM::GetPosition().

◆ GetState()

int EDA_ITEM::GetState ( EDA_ITEM_FLAGS  type) const
inlineinherited

Definition at line 123 of file eda_item.h.

124 {
125 return m_status & type;
126 }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:495

References EDA_ITEM::m_status.

◆ GetStatus()

EDA_ITEM_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 136 of file eda_item.h.

136{ return m_status; }

References EDA_ITEM::m_status.

◆ GetStroke()

STROKE_PARAMS BOARD_ITEM::GetStroke ( ) const
virtualinherited

Reimplemented in PCB_SHAPE.

Definition at line 82 of file board_item.cpp.

83{
84 wxCHECK( false, STROKE_PARAMS( pcbIUScale.mmToIU( DEFAULT_LINE_WIDTH ) ) );
85}
#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 CONVERT_TOOL::CreatePolys(), and 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 692 of file zone.h.

692{ 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 360 of file zone.cpp.

361{
362 if( aPad->GetLocalThermalGapOverride() == 0 )
363 {
364 if( aSource )
365 *aSource = _( "zone" );
366
367 return m_thermalReliefGap;
368 }
369
370 return aPad->GetLocalThermalGapOverride( aSource );
371
372}
int GetLocalThermalGapOverride(wxString *aSource=nullptr) const
Definition: pad.cpp:962

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

◆ GetThermalReliefSpokeWidth()

int ZONE::GetThermalReliefSpokeWidth ( ) const
inline

◆ GetTypeDesc()

wxString EDA_ITEM::GetTypeDesc ( ) const
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:573

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

Referenced by PCB_GROUP::AddItem(), EDIT_TOOL::doMoveSelection(), and EDA_ITEM::GetFriendlyName().

◆ GetUnescapedShortNetname()

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

Definition at line 140 of file board_connected_item.cpp.

141{
142 return m_netinfo ? m_netinfo->GetUnescapedShortNetname() : wxString();
143}
const wxString & GetUnescapedShortNetname() const
Definition: netinfo.h:130

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

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

◆ GetX()

◆ GetY()

◆ GetZoneName()

◆ HasFilledPolysForLayer()

bool ZONE::HasFilledPolysForLayer ( PCB_LAYER_ID  aLayer) const
inline

Definition at line 594 of file zone.h.

595 {
596 return m_FilledPolysList.count( aLayer ) > 0;
597 }

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

172{ 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 855 of file zone.cpp.

856{
858
860 || m_borderHatchPitch == 0
861 || m_Poly->IsEmpty() )
862 {
863 return;
864 }
865
866 // define range for hatch lines
867 int min_x = m_Poly->CVertex( 0 ).x;
868 int max_x = m_Poly->CVertex( 0 ).x;
869 int min_y = m_Poly->CVertex( 0 ).y;
870 int max_y = m_Poly->CVertex( 0 ).y;
871
872 for( auto iterator = m_Poly->IterateWithHoles(); iterator; iterator++ )
873 {
874 if( iterator->x < min_x )
875 min_x = iterator->x;
876
877 if( iterator->x > max_x )
878 max_x = iterator->x;
879
880 if( iterator->y < min_y )
881 min_y = iterator->y;
882
883 if( iterator->y > max_y )
884 max_y = iterator->y;
885 }
886
887 // Calculate spacing between 2 hatch lines
888 int spacing;
889
891 spacing = m_borderHatchPitch;
892 else
893 spacing = m_borderHatchPitch * 2;
894
895 // set the "length" of hatch lines (the length on horizontal axis)
896 int hatch_line_len = m_borderHatchPitch;
897
898 // To have a better look, give a slope depending on the layer
899 int layer = GetFirstLayer();
900 int slope_flag = (layer & 1) ? 1 : -1; // 1 or -1
901 double slope = 0.707106 * slope_flag; // 45 degrees slope
902 int max_a, min_a;
903
904 if( slope_flag == 1 )
905 {
906 max_a = KiROUND( max_y - slope * min_x );
907 min_a = KiROUND( min_y - slope * max_x );
908 }
909 else
910 {
911 max_a = KiROUND( max_y - slope * max_x );
912 min_a = KiROUND( min_y - slope * min_x );
913 }
914
915 min_a = (min_a / spacing) * spacing;
916
917 // calculate an offset depending on layer number,
918 // for a better look of hatches on a multilayer board
919 int offset = (layer * 7) / 8;
920 min_a += offset;
921
922 // loop through hatch lines
923 std::vector<VECTOR2I> pointbuffer;
924 pointbuffer.reserve( 256 );
925
926 for( int a = min_a; a < max_a; a += spacing )
927 {
928 pointbuffer.clear();
929
930 // Iterate through all vertices
931 for( auto iterator = m_Poly->IterateSegmentsWithHoles(); iterator; iterator++ )
932 {
933 const SEG seg = *iterator;
934 double x, y;
935
936 if( FindLineSegmentIntersection( a, slope, seg.A.x, seg.A.y, seg.B.x, seg.B.y, x, y ) )
937 pointbuffer.emplace_back( KiROUND( x ), KiROUND( y ) );
938 }
939
940 // sort points in order of descending x (if more than 2) to
941 // ensure the starting point and the ending point of the same segment
942 // are stored one just after the other.
943 if( pointbuffer.size() > 2 )
944 sort( pointbuffer.begin(), pointbuffer.end(), sortEndsByDescendingX );
945
946 // creates lines or short segments inside the complex polygon
947 for( size_t ip = 0; ip + 1 < pointbuffer.size(); ip += 2 )
948 {
949 int dx = pointbuffer[ip + 1].x - pointbuffer[ip].x;
950
951 // Push only one line for diagonal hatch,
952 // or for small lines < twice the line length
953 // else push 2 small lines
955 || std::abs( dx ) < 2 * hatch_line_len )
956 {
957 m_borderHatchLines.emplace_back( SEG( pointbuffer[ip], pointbuffer[ ip + 1] ) );
958 }
959 else
960 {
961 double dy = pointbuffer[ip + 1].y - pointbuffer[ip].y;
962 slope = dy / dx;
963
964 if( dx > 0 )
965 dx = hatch_line_len;
966 else
967 dx = -hatch_line_len;
968
969 int x1 = KiROUND( pointbuffer[ip].x + dx );
970 int x2 = KiROUND( pointbuffer[ip + 1].x - dx );
971 int y1 = KiROUND( pointbuffer[ip].y + dx * slope );
972 int y2 = KiROUND( pointbuffer[ip + 1].y - dx * slope );
973
974 m_borderHatchLines.emplace_back( SEG( pointbuffer[ip].x, pointbuffer[ip].y,
975 x1, y1 ) );
976
977 m_borderHatchLines.emplace_back( SEG( pointbuffer[ip+1].x, pointbuffer[ip+1].y,
978 x2, y2 ) );
979 }
980 }
981 }
982}
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:841
PCB_LAYER_ID GetFirstLayer() const
Definition: zone.cpp:245
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:85
bool sortEndsByDescendingX(const VECTOR2I &ref, const VECTOR2I &tst)
Definition: zone.cpp:849

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(), EDIT_TOOL::DeleteItems(), Mirror(), Move(), MoveEdge(), Rotate(), SetBorderDisplayStyle(), and PCB_POINT_EDITOR::updateItem().

◆ HigherPriority()

bool ZONE::HigherPriority ( const ZONE aOther) const

Definition at line 186 of file zone.cpp.

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

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

430{
431 // Calculate bounding box for zone
432 BOX2I bbox = GetBoundingBox();
433 bbox.Normalize();
434
435 BOX2I arect = aRect;
436 arect.Normalize();
437 arect.Inflate( aAccuracy );
438
439 if( aContained )
440 {
441 return arect.Contains( bbox );
442 }
443 else
444 {
445 // Fast test: if aBox is outside the polygon bounding box, rectangles cannot intersect
446 if( !arect.Intersects( bbox ) )
447 return false;
448
449 int count = m_Poly->TotalVertices();
450
451 for( int ii = 0; ii < count; ii++ )
452 {
453 VECTOR2I vertex = m_Poly->CVertex( ii );
454 VECTOR2I vertexNext = m_Poly->CVertex( ( ii + 1 ) % count );
455
456 // Test if the point is within the rect
457 if( arect.Contains( vertex ) )
458 return true;
459
460 // Test if this edge intersects the rect
461 if( arect.Intersects( vertex, vertexNext ) )
462 return true;
463 }
464
465 return false;
466 }
467}
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 405 of file zone.cpp.

406{
407 // When looking for an "exact" hit aAccuracy will be 0 which works poorly for very thin
408 // lines. Give it a floor.
409 int accuracy = std::max( aAccuracy, pcbIUScale.mmToIU( 0.1 ) );
410
411 return HitTestForCorner( aPosition, accuracy * 2 ) || HitTestForEdge( aPosition, accuracy );
412}
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:415
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:422

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

497{
498 // Iterate over each outline polygon in the zone and then iterate over
499 // each hole it has to see if the point is in it.
500 for( int i = 0; i < m_Poly->OutlineCount(); i++ )
501 {
502 for( int j = 0; j < m_Poly->HoleCount( i ); j++ )
503 {
504 if( m_Poly->Hole( i, j ).PointInside( aRefPos ) )
505 {
506 if( aOutlineIdx )
507 *aOutlineIdx = i;
508
509 if( aHoleIdx )
510 *aHoleIdx = j;
511
512 return true;
513 }
514 }
515 }
516
517 return false;
518}
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::DeleteItems().

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

483{
484 // Rule areas have no filled area, but it's generally nice to treat their interior as if it were
485 // filled so that people don't have to select them by their outline (which is min-width)
486 if( GetIsRuleArea() )
487 return m_Poly->Contains( aRefPos, -1, aAccuracy );
488
489 if( !m_FilledPolysList.count( aLayer ) )
490 return false;
491
492 return m_FilledPolysList.at( aLayer )->Contains( aRefPos, -1, aAccuracy );
493}
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 415 of file zone.cpp.

417{
418 return m_Poly->CollideVertex( VECTOR2I( refPos ), aCornerHit, aAccuracy );
419}
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 422 of file zone.cpp.

424{
425 return m_Poly->CollideEdge( VECTOR2I( refPos ), aCornerHit, aAccuracy );
426}
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 102 of file zone.cpp.

103{
104 // members are expected non initialize in this.
105 // InitDataFromSrcInCopyCtor() is expected to be called only from a copy constructor.
106
107 // Copy only useful EDA_ITEM flags:
108 m_flags = aZone.m_flags;
110
111 // Replace the outlines for aZone outlines.
112 delete m_Poly;
113 m_Poly = new SHAPE_POLY_SET( *aZone.m_Poly );
114
117 m_zoneName = aZone.m_zoneName;
118 m_priority = aZone.m_priority;
120 SetLayerSet( aZone.GetLayerSet() );
121
127
129 m_ZoneClearance = aZone.m_ZoneClearance; // clearance value
134
135 m_isFilled = aZone.m_isFilled;
138
141
142 m_fillMode = aZone.m_fillMode; // solid vs. hatched
144 m_hatchGap = aZone.m_hatchGap;
150
151 // For corner moving, corner index to drag, or nullptr if no selection
152 delete m_CornerSelection;
153 m_CornerSelection = nullptr;
154
155 for( PCB_LAYER_ID layer : aZone.GetLayerSet().Seq() )
156 {
157 std::shared_ptr<SHAPE_POLY_SET> fill = aZone.m_FilledPolysList.at( layer );
158
159 if( fill )
160 m_FilledPolysList[layer] = std::make_shared<SHAPE_POLY_SET>( *fill );
161 else
162 m_FilledPolysList[layer] = std::make_shared<SHAPE_POLY_SET>();
163
164 m_filledPolysHash[layer] = aZone.m_filledPolysHash.at( layer );
165 m_insulatedIslands[layer] = aZone.m_insulatedIslands.at( layer );
166 }
167
171
172 SetLocalFlags( aZone.GetLocalFlags() );
173
174 m_netinfo = aZone.m_netinfo;
175 m_area = aZone.m_area;
177}
bool m_forceVisible
Definition: eda_item.h:497
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:896
int GetLocalFlags() const
Definition: zone.h:309

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

◆ IsConflicting()

bool ZONE::IsConflicting ( ) const

For rule areas which exclude footprints (and therefore participate in courtyard conflicts during move).

Definition at line 227 of file zone.cpp.

228{
229 return HasFlag( COURTYARD_CONFLICT );
230}
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
Definition: eda_item.h:143
#define COURTYARD_CONFLICT
temporary set when moving footprints having courtyard overlapping

References COURTYARD_CONFLICT, and EDA_ITEM::HasFlag().

Referenced by ViewGetLayers().

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

◆ IsEntered()

bool EDA_ITEM::IsEntered ( ) const
inlineinherited

Definition at line 107 of file eda_item.h.

107{ 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 201 of file eda_item.h.

201{ 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 1022 of file zone.cpp.

1023{
1024 if( GetNetCode() < 1 )
1025 return true;
1026
1027 if( !m_insulatedIslands.count( aLayer ) )
1028 return false;
1029
1030 return m_insulatedIslands.at( aLayer ).count( aPolyIdx );
1031}

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

72{
73 if( GetParentGroup() )
74 return GetParentGroup()->IsLocked();
75
76 const BOARD* board = GetBoard();
77
78 return board && board->GetBoardUse() != BOARD_USE::FPHOLDER && m_isLocked;
79}
bool m_isLocked
Definition: board_item.h:332
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::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(), PCB_SELECTION_CONDITIONS::HasLockedItems(), PCB_SELECTION_CONDITIONS::HasUnlockedItems(), 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<<(), 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 102 of file eda_item.h.

102{ 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 254 of file zone.cpp.

255{
256 return ( m_layerSet & LSET::AllCuMask() ).count() > 0;
257}
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::Fill(), ZONE_FILLER::fillSingleZone(), PCB_PLUGIN::format(), GetFriendlyName(), 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 317 of file zone.cpp.

318{
319 return m_layerSet.test( aLayer );
320}

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

420{ return false; }

Referenced by EDA_ITEM::Matches().

◆ IsRollover()

bool EDA_ITEM::IsRollover ( ) const
inlineinherited

Definition at line 110 of file eda_item.h.

111 {
112 return ( m_flags & ( IS_ROLLOVER | IS_MOVING ) ) == IS_ROLLOVER;
113 }
#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 54 of file zones_functions_for_undo_redo.cpp.

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

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

106{ 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(), EDIT_TOOL::doMoveSelection(), 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_SCREEN::MarkConnections(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), KIGFX::SCH_PAINTER::nonCached(), SCH_MOVE_TOOL::orthoLineDrag(), 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(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), KIGFX::SCH_PAINTER::setDeviceColors(), GERBVIEW_SELECTION_TOOL::unselect(), HIERARCHY_PANE::UpdateHierarchySelection(), PCB_BASE_FRAME::UpdateUserUnits(), 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 173 of file eda_item.h.

173{ 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

◆ IsTented()

virtual bool BOARD_ITEM::IsTented ( ) const
inlinevirtualinherited

Reimplemented in PCB_VIA.

Definition at line 133 of file board_item.h.

134 {
135 return false;
136 }

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

182 {
183 for( KICAD_T scanType : aScanTypes )
184 {
185 if( scanType == SCH_LOCATE_ANY_T || scanType == m_structType )
186 return true;
187 }
188
189 return false;
190 }
KICAD_T m_structType
Run time identification, keep private so it can never be changed after a ctor sets it.
Definition: eda_item.h:505
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:183

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(), CONVERT_TOOL::makePolysFromChainedSegs(), EE_SELECTION_TOOL::RequestSelection(), SCH_FIELD::SetId(), SCH_BASE_FRAME::UpdateItem(), and EDA_ITEM::Visit().

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

501 {
502 return m_Poly->Iterate();
503 }
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 302 of file eda_item.h.

304 {
305 for( const auto& it : aList )
306 {
307 if( static_cast<EDA_ITEM*>( it )->Visit( inspector,
308 testData,
309 scanTypes ) == INSPECT_RESULT::QUIT )
310 {
312 }
313 }
314
316 }
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
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 322 of file eda_item.h.

324 {
325 for( const auto& it : aList )
326 {
327 if( static_cast<EDA_ITEM*>( it )->Visit( inspector,
328 testData,
329 scanTypes ) == INSPECT_RESULT::QUIT )
330 {
332 }
333 }
334
336 }

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

511 {
512 return m_Poly->IterateWithHoles();
513 }

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

107{
108 const BOARD* board = GetBoard();
109 LSET layers = GetLayerSet();
110
111 // Try to be smart and useful. Check all copper first.
112 if( layers[F_Cu] && layers[B_Cu] )
113 return _( "all copper layers" );
114
115 LSET copperLayers = layers & board->GetEnabledLayers().AllCuMask();
116 LSET techLayers = layers & board->GetEnabledLayers().AllTechMask();
117
118 for( LSET testLayers : { copperLayers, techLayers, layers } )
119 {
120 for( int bit = PCBNEW_LAYER_ID_START; bit < PCB_LAYER_ID_COUNT; ++bit )
121 {
122 if( testLayers[ bit ] )
123 {
124 wxString layerInfo = board->GetLayerName( static_cast<PCB_LAYER_ID>( bit ) );
125
126 if( testLayers.count() > 1 )
127 layerInfo << wxS( " " ) + _( "and others" );
128
129 return layerInfo;
130 }
131 }
132 }
133
134 // No copper, no technicals: no layer
135 return _( "no layers" );
136}
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
Definition: board_item.h:185
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:565
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::GetItemDescription(), PAD::GetMsgPanelInfo(), and PCB_TRACK::GetMsgPanelInfo().

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

128 {
129 return BOARD_ITEM::Matches( GetZoneName(), aSearchData );
130 }
virtual bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
Definition: eda_item.h:382
wxString GetZoneName() const
Definition: zone.h:124

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:420
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 703 of file zone.cpp.

704{
705 m_Poly->Mirror( aMirrorLeftRight, !aMirrorLeftRight, aMirrorRef );
706
707 HatchBorder();
708
709 for( std::pair<const PCB_LAYER_ID, std::shared_ptr<SHAPE_POLY_SET>>& pair : m_FilledPolysList )
710 pair.second->Mirror( aMirrorLeftRight, !aMirrorLeftRight, aMirrorRef );
711}
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:855

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

630{
631 /* move outlines */
632 m_Poly->Move( offset );
633
634 HatchBorder();
635
636 /* move fills */
637 for( std::pair<const PCB_LAYER_ID, std::shared_ptr<SHAPE_POLY_SET>>& pair : m_FilledPolysList )
638 pair.second->Move( offset );
639
640 /*
641 * move boundingbox cache
642 *
643 * While the cache will get nuked at the conclusion of the operation, we use it for some
644 * things (such as drawing the parent group) during the move.
645 */
646 if( GetBoard() )
647 {
648 auto it = GetBoard()->m_ZoneBBoxCache.find( this );
649
650 if( it != GetBoard()->m_ZoneBBoxCache.end() )
651 it->second.Move( offset );
652 }
653}
void Move(const VECTOR2I &aVector) override

References BOARD_ITEM::GetBoard(), HatchBorder(), m_FilledPolysList, m_Poly, BOARD::m_ZoneBBoxCache, 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 669 of file zone.cpp.

670{
671 int next_corner;
672
673 if( m_Poly->GetNeighbourIndexes( aEdge, nullptr, &next_corner ) )
674 {
675 m_Poly->SetVertex( aEdge, m_Poly->CVertex( aEdge ) + VECTOR2I( offset ) );
676 m_Poly->SetVertex( next_corner, m_Poly->CVertex( next_corner ) + VECTOR2I( offset ) );
677 HatchBorder();
678
679 SetNeedRefill( true );
680 }
681}
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 245 of file zone.h.

245{ 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 564 of file zone.h.

565 {
566 m_Poly->NewHole();
567 }
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 313 of file zone.h.

313{ return m_Poly; }

References m_Poly.

◆ RemoveAllContours()

void ZONE::RemoveAllContours ( void  )
inline

Definition at line 525 of file zone.h.

526 {
528 }

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

715{
716 // Ensure the requested cutout is valid
717 if( m_Poly->OutlineCount() < aOutlineIdx || m_Poly->HoleCount( aOutlineIdx ) < aHoleIdx )
718 return;
719
720 SHAPE_POLY_SET cutPoly( m_Poly->Hole( aOutlineIdx, aHoleIdx ) );
721
722 // Add the cutout back to the zone
724
725 SetNeedRefill( true );
726}

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

◆ RenderAsBitmap()

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

Reimplemented in SCH_ITEM.

Definition at line 163 of file eda_item.h.

163{ 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_LABEL_BASE, SCH_PIN, SCH_TEXT, SCH_TEXTBOX, SCH_FIELD, and SCH_SHEET_PIN.

Definition at line 409 of file eda_item.h.

410 {
411 return false;
412 }

◆ 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_FIND_REPLACE_TOOL::ReplaceAll(), and SCH_FIND_REPLACE_TOOL::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 684 of file zone.cpp.

685{
686 m_Poly->Rotate( aAngle, VECTOR2I( aCentre ) );
687 HatchBorder();
688
689 /* rotate filled areas: */
690 for( std::pair<const PCB_LAYER_ID, std::shared_ptr<SHAPE_POLY_SET>>& pair : m_FilledPolysList )
691 pair.second->Rotate( aAngle, aCentre );
692}
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 203 of file zone.cpp.

204{
205 return GetNetCode() == aOther->GetNetCode();
206}

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:289

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

822{
823 aBorderHatchPitch = std::max( aBorderHatchPitch,
825 aBorderHatchPitch = std::min( aBorderHatchPitch,
827 SetBorderHatchPitch( aBorderHatchPitch );
828 m_borderStyle = aBorderHatchStyle;
829
830 if( aRebuildBorderHatch )
831 HatchBorder();
832}
void SetBorderHatchPitch(int aPitch)
Set the hatch pitch parameter for the zone.
Definition: zone.cpp:835
#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 835 of file zone.cpp.

836{
837 m_borderHatchPitch = aPitch;
838}

References m_borderHatchPitch.

Referenced by SetBorderDisplayStyle().

◆ SetBrightened()

◆ SetCornerPosition()

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

Definition at line 541 of file zone.h.

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

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

376{
377 if( m_cornerRadius != aRadius )
378 SetNeedRefill( true );
379
380 m_cornerRadius = aRadius;
381}

References m_cornerRadius, and SetNeedRefill().

Referenced by ZONE_SETTINGS::ExportSetting().

◆ SetCornerSmoothingType()

void ZONE::SetCornerSmoothingType ( int  aType)
inline

Definition at line 646 of file zone.h.

646{ 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 623 of file zone.h.

624 {
625 m_FilledPolysList[aLayer] = std::make_shared<SHAPE_POLY_SET>( aPolysList );
626 }

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

240{ 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 139 of file eda_item.h.

139{ 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(), SCH_EDIT_FRAME::BreakSegment(), SCH_EDIT_TOOL::BreakWire(), 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(), PCBNEW_JOBS_HANDLER::doFpExportSvg(), PCB_TOOL_BASE::doInteractiveItemPlacement(), 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(), CONVERT_TOOL::makePolysFromChainedSegs(), CONVERT_TOOL::makePolysFromClosedGraphics(), CONVERT_TOOL::makePolysFromOpenGraphics(), 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_MOVE_TOOL::orthoLineDrag(), SCH_ALTIUM_PLUGIN::ParseBezier(), SCH_ALTIUM_PLUGIN::ParseBus(), SCH_ALTIUM_PLUGIN::ParseBusEntry(), 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(), EE_SELECTION_TOOL::selectMultiple(), SCH_EDIT_FRAME::SelectUnit(), EDA_ITEM::SetBrightened(), EDA_ITEM::SetIsShownAsBitmap(), EDA_ITEM::SetModified(), EDA_ITEM::SetSelected(), SCH_DRAWING_TOOLS::SingleClickPlace(), BOARD_COMMIT::Stage(), SCH_LINE_WIRE_BUS_TOOL::startSegments(), DS_DATA_ITEM::SyncDrawItems(), DS_DATA_ITEM_BITMAP::SyncDrawItems(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_DIMENSION_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 199 of file eda_item.h.

199{ m_forceVisible = aEnable; }

References EDA_ITEM::m_forceVisible.

Referenced by SCH_FIND_REPLACE_TOOL::FindNext(), and SCH_FIND_REPLACE_TOOL::UpdateFind().

◆ SetHatchBorderAlgorithm()

void ZONE::SetHatchBorderAlgorithm ( int  aAlgo)
inline

Definition at line 279 of file zone.h.

279{ m_hatchBorderAlgorithm = aAlgo; }

References m_hatchBorderAlgorithm.

Referenced by ZONE_SETTINGS::ExportSetting().

◆ SetHatchGap()

◆ SetHatchHoleMinArea()

void ZONE::SetHatchHoleMinArea ( double  aPct)
inline

Definition at line 276 of file zone.h.

276{ m_hatchHoleMinArea = aPct; }

References m_hatchHoleMinArea.

Referenced by ZONE_SETTINGS::ExportSetting().

◆ SetHatchOrientation()

◆ SetHatchSmoothingLevel()

void ZONE::SetHatchSmoothingLevel ( int  aLevel)
inline

Definition at line 270 of file zone.h.

270{ m_hatchSmoothingLevel = aLevel; }

References m_hatchSmoothingLevel.

Referenced by ZONE_SETTINGS::ExportSetting().

◆ SetHatchSmoothingValue()

void ZONE::SetHatchSmoothingValue ( double  aValue)
inline

Definition at line 273 of file zone.h.

273{ m_hatchSmoothingValue = aValue; }

References m_hatchSmoothingValue.

Referenced by ZONE_SETTINGS::ExportSetting().

◆ SetHatchStyle()

void ZONE::SetHatchStyle ( ZONE_BORDER_DISPLAY_STYLE  aStyle)
inline

◆ SetHatchThickness()

◆ SetIsFilled()

void ZONE::SetIsFilled ( bool  isFilled)
inline

◆ SetIsIsland()

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

Definition at line 637 of file zone.h.

638 {
639 m_insulatedIslands[aLayer].insert( aPolyIdx );
640 }

References m_insulatedIslands.

Referenced by ZONE_FILLER::Fill().

◆ SetIsKnockout()

virtual void BOARD_ITEM::SetIsKnockout ( bool  aKnockout)
inlinevirtualinherited

Definition at line 251 of file board_item.h.

251{ m_isKnockout = aKnockout; }

References BOARD_ITEM::m_isKnockout.

Referenced by PCB_TEXT_DESC::PCB_TEXT_DESC().

◆ SetIslandRemovalMode()

◆ SetIsRuleArea()

◆ SetIsShownAsBitmap()

void EDA_ITEM::SetIsShownAsBitmap ( bool  aBitmap)
inlineinherited

Definition at line 165 of file eda_item.h.

166 {
167 if( aBitmap )
169 else
171 }

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

261{
262 SetLayerSet( LSET( aLayer ) );
263}

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(), EAGLE_PLUGIN::setKeepoutSettingsToZone(), and ZONE_DESC::ZONE_DESC().

◆ SetLayerSet()

void ZONE::SetLayerSet ( LSET  aLayerSet)
overridevirtual

Reimplemented from BOARD_ITEM.

Definition at line 266 of file zone.cpp.

267{
268 if( aLayerSet.count() == 0 )
269 return;
270
271 if( m_layerSet != aLayerSet )
272 {
273 SetNeedRefill( true );
274
275 UnFill();
276
277 m_FilledPolysList.clear();
278 m_filledPolysHash.clear();
279 m_insulatedIslands.clear();
280
281 for( PCB_LAYER_ID layer : aLayerSet.Seq() )
282 {
283 m_FilledPolysList[layer] = std::make_shared<SHAPE_POLY_SET>();
284 m_filledPolysHash[layer] = {};
285 m_insulatedIslands[layer] = {};
286 }
287 }
288
289 m_layerSet = aLayerSet;
290}
bool UnFill()
Removes the zone filling.
Definition: zone.cpp:209

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(), EAGLE_PLUGIN::setKeepoutSettingsToZone(), and SetLayer().

◆ SetLocalClearance()

◆ SetLocalFlags()

void ZONE::SetLocalFlags ( int  aFlags)
inline

Definition at line 310 of file zone.h.

310{ m_localFlgs = aFlags; }

References m_localFlgs.

Referenced by InitDataFromSrcInCopyCtor(), and ZONE().

◆ SetLocalRatsnestVisible()

void BOARD_CONNECTED_ITEM::SetLocalRatsnestVisible ( bool  aVisible)
inlineinherited

Definition at line 171 of file board_connected_item.h.

172 {
173 m_localRatsnestVisible = aVisible;
174 }

References BOARD_CONNECTED_ITEM::m_localRatsnestVisible.

◆ SetLocked()

◆ SetMinIslandArea()

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

Definition at line 715 of file zone.h.

715{ 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:123
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition: board.cpp:1456
static NETINFO_ITEM * OrphanedItem()
Wrapper class, so you can iterate through NETINFO_ITEM*s, not std::pair<int/wxString,...
Definition: netinfo.h:390

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(), PNS_KICAD_IFACE::UpdateItem(), and ROUTER_TOOL::updateSizesAfterLayerSwitch().

◆ SetOutline()

void ZONE::SetOutline ( SHAPE_POLY_SET aOutline)
inline

Definition at line 315 of file zone.h.

315{ 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 100 of file eda_item.h.

100{ 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(), PCBNEW_JOBS_HANDLER::doFpExportSvg(), 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(), KI_TEST::LoadHierarchy(), 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(), CLIPBOARD_IO::SaveSelection(), SCH_SHEET_PIN::SCH_SHEET_PIN(), LIB_SYMBOL::SetFields(), PCB_DIMENSION_BASE::SetParent(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_LINE_WIRE_BUS_TOOL::startSegments(), SCH_LABEL_BASE::SwapData(), SCH_SHEET::SwapData(), SCH_SYMBOL::SwapData(), BOARD_ITEM::SwapItemData(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ SetParentGroup()

◆ SetPosition()

void ZONE::SetPosition ( const VECTOR2I aPos)
inlineoverridevirtual

◆ SetSelected()

◆ SetSelectedCorner()

void ZONE::SetSelectedCorner ( int  aCorner)
inline

Definition at line 292 of file zone.h.

293 {
294 SHAPE_POLY_SET::VERTEX_INDEX selectedCorner;
295
296 // If the global index of the corner is correct, assign it to m_CornerSelection
297 if( m_Poly->GetRelativeIndices( aCorner, &selectedCorner ) )
298 {
299 if( m_CornerSelection == nullptr )
301
302 *m_CornerSelection = selectedCorner;
303 }
304 else
305 throw( std::out_of_range( "aCorner-th vertex does not exist" ) );
306 }

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

129 {
130 if( state )
131 m_status |= type; // state = ON or OFF
132 else
133 m_status &= ~type;
134 }

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

137{ 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 88 of file board_item.cpp.

89{
90 wxCHECK( false, /* void */ );
91}

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

687{ 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 176 of file zone.h.

177 {
178 if( m_thermalReliefGap != aThermalReliefGap )
179 SetNeedRefill( true );
180
181 m_thermalReliefGap = aThermalReliefGap;
182 }

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

188 {
189 if( m_thermalReliefSpokeWidth != aThermalReliefSpokeWidth )
190 SetNeedRefill( true );
191
192 m_thermalReliefSpokeWidth = aThermalReliefSpokeWidth;
193 }

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

◆ SetX()

void BOARD_ITEM::SetX ( int  aX)
inlineinherited

Definition at line 98 of file board_item.h.

99 {
100 VECTOR2I p( aX, GetY() );
101 SetPosition( p );
102 }
int GetY() const
Definition: board_item.h:82
virtual void SetPosition(const VECTOR2I &aPos)
Definition: eda_item.h:250

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

105 {
106 VECTOR2I p( GetX(), aY );
107 SetPosition( p );
108 }
int GetX() const
Definition: board_item.h:76

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

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

◆ SetZoneName()

void ZONE::SetZoneName ( const wxString &  aName)
inline

Definition at line 125 of file zone.h.

125{ m_zoneName = aName; }

References m_zoneName.