KiCad PCB EDA Suite
FP_ZONE Class Reference

A specialization of ZONE for use in footprints. More...

#include <zone.h>

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

Public Member Functions

 FP_ZONE (BOARD_ITEM_CONTAINER *aParent)
 
 FP_ZONE (const FP_ZONE &aZone)
 
FP_ZONEoperator= (const FP_ZONE &aOther)
 
EDA_ITEMClone () const override
 Create a duplicate of this item with linked list members set to NULL. More...
 
double ViewGetLOD (int aLayer, KIGFX::VIEW *aView) const override
 Return the level of detail (LOD) of the item. More...
 
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, bool aIncludeCourtyards=false) 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...
 
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 HitTest (const BOX2I &aRect, bool aContained=true, int aAccuracy=0) const override
 Test if aRect intersects this item. 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 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...
 
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

bool Matches (const wxString &aText, const EDA_SEARCH_DATA &aSearchData) const
 Compare aText against search criteria in aSearchData. More...
 
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...
 

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

A specialization of ZONE for use in footprints.

Definition at line 915 of file zone.h.

Constructor & Destructor Documentation

◆ FP_ZONE() [1/2]

FP_ZONE::FP_ZONE ( BOARD_ITEM_CONTAINER aParent)

Definition at line 1264 of file zone.cpp.

1264 :
1265 ZONE( aParent, true )
1266{
1267 // in a footprint, net classes are not managed.
1268 // so set the net to NETINFO_LIST::ORPHANED_ITEM
1269 SetNetCode( -1, true );
1270}
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
ZONE(BOARD_ITEM_CONTAINER *parent, bool aInFP=false)
The ctor to build ZONE, but compatible with FP_ZONE requirement.
Definition: zone.cpp:44

References BOARD_CONNECTED_ITEM::SetNetCode().

Referenced by Clone().

◆ FP_ZONE() [2/2]

FP_ZONE::FP_ZONE ( const FP_ZONE aZone)

Definition at line 1273 of file zone.cpp.

1273 :
1274 ZONE( aZone )
1275{
1277}
void InitDataFromSrcInCopyCtor(const ZONE &aZone)
Copy aZone data to me.
Definition: zone.cpp:108

References ZONE::InitDataFromSrcInCopyCtor().

Member Function Documentation

◆ AddPolygon() [1/2]

void ZONE::AddPolygon ( const SHAPE_LINE_CHAIN aPolygon)
inherited

Definition at line 735 of file zone.cpp.

736{
737 wxASSERT( aPolygon.IsClosed() );
738
739 // Add the outline as a new polygon in the polygon set
740 if( m_Poly->OutlineCount() == 0 )
741 m_Poly->AddOutline( aPolygon );
742 else
743 m_Poly->AddHole( aPolygon );
744
745 SetNeedRefill( true );
746}
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
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:795

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

◆ AddPolygon() [2/2]

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

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

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

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

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

◆ AppendCorner()

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

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

767{
768 // Ensure the main outline exists:
769 if( m_Poly->OutlineCount() == 0 )
771
772 // If aHoleIdx >= 0, the corner musty be added to the hole, index aHoleIdx.
773 // (remember: the index of the first hole is 0)
774 // Return error if it does not exist.
775 if( aHoleIdx >= m_Poly->HoleCount( 0 ) )
776 return false;
777
778 m_Poly->Append( aPosition.x, aPosition.y, -1, aHoleIdx, aAllowDuplication );
779
780 SetNeedRefill( true );
781
782 return true;
783}
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(), ZONE::m_Poly, SHAPE_POLY_SET::NewOutline(), SHAPE_POLY_SET::OutlineCount(), ZONE::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)
inherited

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

403{
404 if( !m_FilledPolysList.count( aLayer ) )
406 else
407 m_filledPolysHash[aLayer] = m_FilledPolysList.at( aLayer )->GetHash();
408}
MD5_HASH GetHash() const
std::map< PCB_LAYER_ID, std::shared_ptr< SHAPE_POLY_SET > > m_FilledPolysList
Definition: zone.h:889
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:895
static SHAPE_POLY_SET g_nullPoly
Definition: zone.cpp:390

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

◆ BuildSmoothedPoly()

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

Definition at line 1075 of file zone.cpp.

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

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(), ZONE::GetInteractingZones(), ZONE::GetIsRuleArea(), ZONE::GetNumCorners(), SHAPE_POLY_SET::Inflate(), ZONE::IsTeardropArea(), ZONE::m_cornerRadius, ZONE::m_cornerSmoothingType, BOARD_DESIGN_SETTINGS::m_MaxError, ZONE::m_Poly, BOARD_DESIGN_SETTINGS::m_ZoneKeepExternalFillets, ZONE::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 ZONE::TransformSmoothedOutlineToPolygon().

◆ CacheBoundingBox()

void ZONE::CacheBoundingBox ( )
inherited

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

Definition at line 351 of file zone.cpp.

352{
353 BOARD* board = GetBoard();
354 std::unordered_map<const ZONE*, BOX2I>& cache = board->m_ZoneBBoxCache;
355
356 auto cacheIter = cache.find( this );
357
358 if( cacheIter == cache.end() )
359 {
360 std::unique_lock<std::mutex> cacheLock( board->m_CachesMutex );
361 cache[ this ] = m_Poly->BBox();
362 }
363}
std::unordered_map< const ZONE *, BOX2I > m_ZoneBBoxCache
Definition: board.h:1166
std::mutex m_CachesMutex
Definition: board.h:1157
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, ZONE::m_Poly, and BOARD::m_ZoneBBoxCache.

◆ CacheTriangulation()

void ZONE::CacheTriangulation ( PCB_LAYER_ID  aLayer = UNDEFINED_LAYER)
inherited

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

Definition at line 1011 of file zone.cpp.

1012{
1013 if( aLayer == UNDEFINED_LAYER )
1014 {
1015 for( auto& [ layer, poly ] : m_FilledPolysList )
1016 poly->CacheTriangulation();
1017
1018 m_Poly->CacheTriangulation( false );
1019 }
1020 else
1021 {
1022 if( m_FilledPolysList.count( aLayer ) )
1023 m_FilledPolysList[ aLayer ]->CacheTriangulation();
1024 }
1025}
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(), ZONE::m_FilledPolysList, ZONE::m_Poly, and UNDEFINED_LAYER.

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

◆ CalculateFilledArea()

double ZONE::CalculateFilledArea ( )
inherited

Compute the area currently occupied by the zone fill.

Returns
the currently filled area

Definition at line 1201 of file zone.cpp.

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

References ZONE::m_area, and ZONE::m_FilledPolysList.

Referenced by TEARDROP_MANAGER::createTeardrop().

◆ CalculateOutlineArea()

double ZONE::CalculateOutlineArea ( )
inherited

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

Returns
the currently calculated area

Definition at line 1224 of file zone.cpp.

1225{
1227 return m_outlinearea;
1228}
double Area()
Count the number of arc shapes present.
double m_outlinearea
Definition: zone.h:905
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:418

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

◆ CIterateWithHoles()

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

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

527 {
528 return m_Poly->CIterateWithHoles();
529 }
CONST_ITERATOR CIterateWithHoles(int aOutline) const

References SHAPE_POLY_SET::CIterateWithHoles(), and ZONE::m_Poly.

◆ ClassOf()

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

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
@ PCB_ZONE_T
class ZONE, a copper pour area
Definition: typeinfo.h:112

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(), BOARD_COMMIT::dirtyIntersectingZones(), 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 * FP_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 ZONE.

Definition at line 1287 of file zone.cpp.

1288{
1289 return new FP_ZONE( *this );
1290}
FP_ZONE(BOARD_ITEM_CONTAINER *aParent)
Definition: zone.cpp:1264

References FP_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:175

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:70
PCB_GROUP * GetParentGroup() const
Definition: board_item.h:84
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 
)
overridevirtualinherited

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

702{
703 Mirror( aCentre, aFlipLeftRight );
704
705 SetLayerSet( FlipLayerMask( GetLayerSet(), GetBoard()->GetCopperLayerCount() ) );
706}
void Mirror(const VECTOR2I &aMirrorRef, bool aMirrorLeftRight)
Mirror the outlines relative to a given horizontal axis the layer is not changed.
Definition: zone.cpp:709
void SetLayerSet(LSET aLayerSet) override
Definition: zone.cpp:272
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(), ZONE::GetLayerSet(), ZONE::Mirror(), and ZONE::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:352
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:63
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(), ZONE::BuildSmoothedPoly(), ZONE::CacheBoundingBox(), collidesWithArea(), KIGFX::PCB_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), enclosedByAreaFunc(), existsOnLayerFunc(), PCB_VIA::FlashLayer(), PAD::FlashLayer(), FP_SHAPE::Flip(), FP_TEXT::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(), ZONE::Flip(), PCB_PLUGIN::format(), fromToFunc(), BOARD_ITEM::GetBoard(), PCB_EXPR_CONTEXT::GetBoard(), NETINFO_ITEM::GetBoundingBox(), ZONE::GetBoundingBox(), FOOTPRINT::GetBoundingBox(), FOOTPRINT::GetBoundingHull(), FOOTPRINT::GetCourtyard(), BOARD_CONNECTED_ITEM::GetEffectiveNetClass(), FP_TEXT::GetEffectiveShape(), PCB_TEXT::GetEffectiveShape(), getFieldFunc(), ZONE::GetInteractingZones(), ZONE::GetItemDescription(), BOARD_ITEM::GetLayerName(), PCB_VIA::GetMinAnnulus(), NETINFO_ITEM::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfo(), ZONE::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(), ZONE::Move(), DIALOG_TEXTBOX_PROPERTIES::onBorderChecked(), EAGLE_PLUGIN::packageWire(), padsNeedUpdate(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), BOARD::ResolveDRCExclusions(), FOOTPRINT::ResolveTextVar(), BOARD_CONNECTED_ITEM::SetNetCode(), PCB_DIMENSION_BASE::SetUnitsMode(), TEARDROP_DIALOG::TEARDROP_DIALOG(), DRC_TEST_PROVIDER_SOLDER_MASK::testItemAgainstItems(), CONNECTIVITY_DATA::TestTrackEndpointDangling(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow(), ZONE::TransformSmoothedOutlineToPolygon(), BOARD::UpdateRatsnestExclusions(), FOOTPRINT::ViewBBox(), PAD::ViewBBox(), PCB_TRACK::ViewBBox(), PAD::ViewGetLOD(), PCB_BITMAP::ViewGetLOD(), PCB_VIA::ViewGetLOD(), FOOTPRINT::~FOOTPRINT(), and ZONE::~ZONE().

◆ GetBorderHatchPitch()

int ZONE::GetBorderHatchPitch ( ) const
inherited

HatchBorder related methods.

Returns
the zone hatch pitch in iu.

Definition at line 820 of file zone.cpp.

821{
822 return m_borderHatchPitch;
823}
int m_borderHatchPitch
Definition: zone.h:898

References ZONE::m_borderHatchPitch.

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

◆ GetBoundingBox()

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

Reimplemented from EDA_ITEM.

Definition at line 329 of file zone.cpp.

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

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

Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), ZONE_FILLER::buildCopperItemClearances(), ZONE_FILLER::buildThermalSpokes(), collidesWithArea(), ZONE_FILLER::Fill(), ZONE_FILLER::fillNonCopperZone(), ZONE::GetInteractingZones(), ZONE::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 105 of file board_item.h.

106 {
107 return GetBoundingBox().GetCenter();
108 }
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(), and PCB_SELECTION_TOOL::FindItem().

◆ GetClass()

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

Implements EDA_ITEM.

Definition at line 488 of file zone.h.

489 {
490 return wxT( "ZONE" );
491 }

◆ GetCornerPosition()

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

Definition at line 536 of file zone.h.

537 {
539
540 // Convert global to relative indices
541 if( !m_Poly->GetRelativeIndices( aCornerIndex, &index ) )
542 throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
543
544 return m_Poly->CVertex( index );
545 }
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 ZONE::m_Poly.

Referenced by ZONE::GetPosition().

◆ GetCornerRadius()

unsigned int ZONE::GetCornerRadius ( ) const
inlineinherited

Definition at line 658 of file zone.h.

658{ return m_cornerRadius; }

References ZONE::m_cornerRadius.

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

◆ GetCornerSmoothingType()

int ZONE::GetCornerSmoothingType ( ) const
inlineinherited

◆ GetDefaultHatchPitch()

◆ GetDoNotAllowCopperPour()

bool ZONE::GetDoNotAllowCopperPour ( ) const
inlineinherited

◆ GetDoNotAllowFootprints()

bool ZONE::GetDoNotAllowFootprints ( ) const
inlineinherited

◆ GetDoNotAllowPads()

bool ZONE::GetDoNotAllowPads ( ) const
inlineinherited

◆ GetDoNotAllowTracks()

bool ZONE::GetDoNotAllowTracks ( ) const
inlineinherited

◆ GetDoNotAllowVias()

bool ZONE::GetDoNotAllowVias ( ) const
inlineinherited

◆ 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(), ZONE::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
overridevirtualinherited

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

1318{
1319 if( m_FilledPolysList.find( aLayer ) == m_FilledPolysList.end() )
1320 return std::make_shared<SHAPE_NULL>();
1321 else
1322 return m_FilledPolysList.at( aLayer );
1323}

References ZONE::m_FilledPolysList.

◆ GetFill()

◆ GetFilledArea()

double ZONE::GetFilledArea ( )
inlineinherited

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 ZONE::m_area.

◆ GetFilledPolysList()

◆ GetFillFlag()

int ZONE::GetFillFlag ( PCB_LAYER_ID  aLayer)
inlineinherited

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

References ZONE::m_fillFlags.

◆ GetFillMode()

ZONE_FILL_MODE ZONE::GetFillMode ( ) const
inlineinherited

◆ GetFirstLayer()

PCB_LAYER_ID ZONE::GetFirstLayer ( ) const
inherited

◆ 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
overridevirtualinherited

Reimplemented from EDA_ITEM.

Definition at line 662 of file zone.cpp.

663{
664 if( GetIsRuleArea() )
665 return _( "Rule Area" );
666 else if( IsTeardropArea() )
667 return _( "Teardrop Area" );
668 else if( IsOnCopperLayer() )
669 return _( "Copper Zone" );
670 else
671 return _( "Non-copper Zone" );
672}
bool IsOnCopperLayer() const override
Definition: zone.cpp:260
#define _(s)

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

Referenced by ZONE::GetMsgPanelInfo().

◆ GetHashValue()

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

Definition at line 393 of file zone.cpp.

394{
395 if( !m_filledPolysHash.count( aLayer ) )
396 return g_nullPoly.GetHash();
397 else
398 return m_filledPolysHash.at( aLayer );
399}

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

◆ GetHatchBorderAlgorithm()

int ZONE::GetHatchBorderAlgorithm ( ) const
inlineinherited

◆ GetHatchGap()

int ZONE::GetHatchGap ( ) const
inlineinherited

◆ GetHatchHoleMinArea()

double ZONE::GetHatchHoleMinArea ( ) const
inlineinherited

◆ GetHatchLines()

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

Definition at line 767 of file zone.h.

767{ return m_borderHatchLines; }
std::vector< SEG > m_borderHatchLines
Definition: zone.h:899

References ZONE::m_borderHatchLines.

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

◆ GetHatchOrientation()

EDA_ANGLE ZONE::GetHatchOrientation ( ) const
inlineinherited

◆ GetHatchSmoothingLevel()

int ZONE::GetHatchSmoothingLevel ( ) const
inlineinherited

◆ GetHatchSmoothingValue()

double ZONE::GetHatchSmoothingValue ( ) const
inlineinherited

◆ GetHatchStyle()

ZONE_BORDER_DISPLAY_STYLE ZONE::GetHatchStyle ( ) const
inlineinherited

Definition at line 586 of file zone.h.

586{ return m_borderStyle; }
ZONE_BORDER_DISPLAY_STYLE m_borderStyle
Definition: zone.h:897

References ZONE::m_borderStyle.

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

◆ GetHatchThickness()

int ZONE::GetHatchThickness ( ) const
inlineinherited

◆ GetInteractingZones()

void ZONE::GetInteractingZones ( PCB_LAYER_ID  aLayer,
std::vector< ZONE * > *  aSameNetCollidingZones,
std::vector< ZONE * > *  aOtherNetIntersectingZones 
) const
inherited

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

1042{
1043 int epsilon = pcbIUScale.mmToIU( 0.001 );
1044 BOX2I bbox = GetBoundingBox();
1045
1046 bbox.Inflate( epsilon );
1047
1048 for( ZONE* candidate : GetBoard()->Zones() )
1049 {
1050 if( candidate == this )
1051 continue;
1052
1053 if( !candidate->GetLayerSet().test( aLayer ) )
1054 continue;
1055
1056 if( candidate->GetIsRuleArea() || candidate->IsTeardropArea() )
1057 continue;
1058
1059 if( !candidate->GetBoundingBox().Intersects( bbox ) )
1060 continue;
1061
1062 if( candidate->GetNetCode() == GetNetCode() )
1063 {
1064 if( m_Poly->Collide( candidate->m_Poly ) )
1065 aSameNetCollidingZones->push_back( candidate );
1066 }
1067 else
1068 {
1069 aOtherNetIntersectingZones->push_back( candidate );
1070 }
1071 }
1072}
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:329

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

Referenced by ZONE::BuildSmoothedPoly().

◆ GetIslandRemovalMode()

const ISLAND_REMOVAL_MODE ZONE::GetIslandRemovalMode ( ) const
inlineinherited

Definition at line 717 of file zone.h.

717{ return m_islandRemovalMode; }
ISLAND_REMOVAL_MODE m_islandRemovalMode
Definition: zone.h:835

References ZONE::m_islandRemovalMode.

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

◆ GetIsRuleArea()

◆ GetItemDescription()

wxString ZONE::GetItemDescription ( UNITS_PROVIDER aUnitsProvider) const
overridevirtualinherited

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

787{
788 wxString layerDesc;
789 int count = 0;
790
791 for( PCB_LAYER_ID layer : m_layerSet.Seq() )
792 {
793 if( count == 0 )
794 layerDesc = GetBoard()->GetLayerName( layer );
795
796 count++;
797 }
798
799 if( count > 1 )
800 layerDesc.Printf( _( "%s and %d more" ), layerDesc, count - 1 );
801
802 // Check whether the selected contour is a hole (contour index > 0)
803 if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
804 {
805 if( GetIsRuleArea() )
806 return wxString::Format( _( "Rule Area Cutout on %s" ), layerDesc );
807 else
808 return wxString::Format( _( "Zone Cutout on %s" ), layerDesc );
809 }
810 else
811 {
812 if( GetIsRuleArea() )
813 return wxString::Format( _( "Rule Area on %s" ), layerDesc );
814 else
815 return wxString::Format( _( "Zone %s on %s" ), GetNetnameMsg(), layerDesc );
816 }
817}
wxString GetNetnameMsg() const
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:474
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
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: zone.h:877
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(), ZONE::GetIsRuleArea(), BOARD::GetLayerName(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), SHAPE_POLY_SET::VERTEX_INDEX::m_contour, ZONE::m_CornerSelection, ZONE::m_layerSet, and LSET::Seq().

Referenced by DRC_ENGINE::EvalRules(), and PNS_KICAD_IFACE_BASE::syncZone().

◆ GetLayer()

PCB_LAYER_ID ZONE::GetLayer ( ) const
overridevirtualinherited

Return the primary layer this item is on.

Reimplemented from BOARD_ITEM.

Definition at line 245 of file zone.cpp.

246{
247 return BOARD_ITEM::GetLayer();
248}
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:192

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
inlineinherited

Definition at line 152 of file zone.h.

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

References ZONE::GetLocalClearance().

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

◆ GetLocalClearance() [2/2]

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

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

477{
478 if( m_isRuleArea )
479 return 0;
480
481 if( aSource )
482 *aSource = _( "zone" );
483
484 return m_ZoneClearance;
485}
int m_ZoneClearance
Definition: zone.h:831

References _, ZONE::m_isRuleArea, and ZONE::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
inlineinherited

Definition at line 315 of file zone.h.

315{ return m_localFlgs; }
int m_localFlgs
Definition: zone.h:879

References ZONE::m_localFlgs.

Referenced by ZONE::InitDataFromSrcInCopyCtor().

◆ GetLocalRatsnestVisible()

bool BOARD_CONNECTED_ITEM::GetLocalRatsnestVisible ( ) const
inlineinherited

◆ GetLock()

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

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

References ZONE::m_lock.

Referenced by ZONE_FILLER::Fill().

◆ GetMenuImage()

BITMAPS ZONE::GetMenuImage ( ) const
overridevirtualinherited

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

998{
999 return BITMAPS::add_zone;
1000}

References add_zone.

◆ GetMinIslandArea()

long long int ZONE::GetMinIslandArea ( ) const
inlineinherited

Definition at line 720 of file zone.h.

720{ 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:841

References ZONE::m_minIslandArea.

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

◆ GetMinThickness()

◆ GetMsgPanelInfo()

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

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

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

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(), ZONE_FILLER::Fill(), PNS::NODE::FindItemByParent(), TEARDROP_MANAGER::findTouchingTrack(), PCB_PLUGIN::format(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), CONNECTIVITY_DATA::GetConnectedItems(), ZONE::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(), ZONE::IsIsland(), ZONE::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(), ZONE::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 ZONE::GetItemDescription().

◆ GetNumCorners()

int ZONE::GetNumCorners ( void  ) const
inlineinherited

Access to m_Poly parameters.

Definition at line 496 of file zone.h.

497 {
498 return m_Poly->TotalVertices();
499 }
int TotalVertices() const
Delete aIdx-th polygon from the set.

References ZONE::m_Poly, and SHAPE_POLY_SET::TotalVertices().

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

◆ GetOutlineArea()

double ZONE::GetOutlineArea ( )
inlineinherited

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

◆ GetPadConnection()

ZONE_CONNECTION ZONE::GetPadConnection ( ) const
inlineinherited

◆ GetParent()

BOARD_ITEM_CONTAINER * BOARD_ITEM::GetParent ( void  ) const
inlineinherited

Definition at line 175 of file board_item.h.

175{ 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(), ViewGetLOD(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ GetParentFootprint()

◆ GetParentGroup()

◆ GetPosition()

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

Reimplemented from EDA_ITEM.

Definition at line 239 of file zone.cpp.

240{
241 return GetCornerPosition( 0 );
242}
const VECTOR2I & GetCornerPosition(int aCornerIndex) const
Definition: zone.h:536

References ZONE::GetCornerPosition().

Referenced by EAGLE_PLUGIN::loadPlain().

◆ GetSelectedCorner()

int ZONE::GetSelectedCorner ( ) const
inlineinherited

Definition at line 287 of file zone.h.

288 {
289 // Transform relative indices to global index
290 int globalIndex = -1;
291
293 m_Poly->GetGlobalIndex( *m_CornerSelection, globalIndex );
294
295 return globalIndex;
296 }
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(), ZONE::m_CornerSelection, and ZONE::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:130

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
inlineinherited
Returns
the type of the teardrop ( has meaning only if the zone is a teardrop area)

Definition at line 698 of file zone.h.

698{ return m_teardropType; }
TEARDROP_TYPE m_teardropType
Definition: zone.h:819

References ZONE::m_teardropType.

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

◆ GetThermalReliefGap() [1/2]

int ZONE::GetThermalReliefGap ( ) const
inlineinherited

◆ GetThermalReliefGap() [2/2]

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

Definition at line 366 of file zone.cpp.

367{
368 if( aPad->GetLocalThermalGapOverride() == 0 )
369 {
370 if( aSource )
371 *aSource = _( "zone" );
372
373 return m_thermalReliefGap;
374 }
375
376 return aPad->GetLocalThermalGapOverride( aSource );
377
378}
int GetLocalThermalGapOverride(wxString *aSource=nullptr) const
Definition: pad.cpp:947

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

◆ GetThermalReliefSpokeWidth()

int ZONE::GetThermalReliefSpokeWidth ( ) const
inlineinherited

◆ 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:623

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

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
inlineinherited

Definition at line 600 of file zone.h.

601 {
602 return m_FilledPolysList.count( aLayer ) > 0;
603 }

References ZONE::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 184 of file board_item.h.

184{ return false; }

◆ HatchBorder()

void ZONE::HatchBorder ( )
inherited

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

Definition at line 861 of file zone.cpp.

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

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

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

◆ HigherPriority()

bool ZONE::HigherPriority ( const ZONE aOther) const
inherited

Definition at line 192 of file zone.cpp.

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

References ZONE::m_priority, ZONE::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
overridevirtualinherited

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

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

◆ HitTest() [2/2]

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

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

412{
413 // When looking for an "exact" hit aAccuracy will be 0 which works poorly for very thin
414 // lines. Give it a floor.
415 int accuracy = std::max( aAccuracy, pcbIUScale.mmToIU( 0.1 ) );
416
417 return HitTestForCorner( aPosition, accuracy * 2 ) || HitTestForEdge( aPosition, accuracy );
418}
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:421
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:428

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

◆ HitTestCutout()

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

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

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

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

489{
490 // Rule areas have no filled area, but it's generally nice to treat their interior as if it were
491 // filled so that people don't have to select them by their outline (which is min-width)
492 if( GetIsRuleArea() )
493 return m_Poly->Contains( aRefPos, -1, aAccuracy );
494
495 if( !m_FilledPolysList.count( aLayer ) )
496 return false;
497
498 return m_FilledPolysList.at( aLayer )->Contains( aRefPos, -1, aAccuracy );
499}
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(), ZONE::GetIsRuleArea(), ZONE::m_FilledPolysList, and ZONE::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
inherited

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

423{
424 return m_Poly->CollideVertex( VECTOR2I( refPos ), aCornerHit, aAccuracy );
425}
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:590

References SHAPE_POLY_SET::CollideVertex(), and ZONE::m_Poly.

Referenced by ZONE::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
inherited

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

430{
431 return m_Poly->CollideEdge( VECTOR2I( refPos ), aCornerHit, aAccuracy );
432}
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 ZONE::m_Poly.

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

◆ InitDataFromSrcInCopyCtor()

void ZONE::InitDataFromSrcInCopyCtor ( const ZONE aZone)
inherited

Copy aZone data to me.

Definition at line 108 of file zone.cpp.

109{
110 // members are expected non initialize in this.
111 // InitDataFromSrcInCopyCtor() is expected to be called only from a copy constructor.
112
113 // Copy only useful EDA_ITEM flags:
114 m_flags = aZone.m_flags;
116
117 // Replace the outlines for aZone outlines.
118 delete m_Poly;
119 m_Poly = new SHAPE_POLY_SET( *aZone.m_Poly );
120
123 m_zoneName = aZone.m_zoneName;
124 m_priority = aZone.m_priority;
126 SetLayerSet( aZone.GetLayerSet() );
127
133
135 m_ZoneClearance = aZone.m_ZoneClearance; // clearance value
140
141 m_isFilled = aZone.m_isFilled;
144
147
148 m_fillMode = aZone.m_fillMode; // solid vs. hatched
150 m_hatchGap = aZone.m_hatchGap;
156
157 // For corner moving, corner index to drag, or nullptr if no selection
158 delete m_CornerSelection;
159 m_CornerSelection = nullptr;
160
161 for( PCB_LAYER_ID layer : aZone.GetLayerSet().Seq() )
162 {
163 std::shared_ptr<SHAPE_POLY_SET> fill = aZone.m_FilledPolysList.at( layer );
164
165 if( fill )
166 m_FilledPolysList[layer] = std::make_shared<SHAPE_POLY_SET>( *fill );
167 else
168 m_FilledPolysList[layer] = std::make_shared<SHAPE_POLY_SET>();
169
170 m_filledPolysHash[layer] = aZone.m_filledPolysHash.at( layer );
171 m_insulatedIslands[layer] = aZone.m_insulatedIslands.at( layer );
172 }
173
177
178 SetLocalFlags( aZone.GetLocalFlags() );
179
180 m_netinfo = aZone.m_netinfo;
181 m_area = aZone.m_area;
183}
bool m_forceVisible
Definition: eda_item.h:497
void SetLocalFlags(int aFlags)
Definition: zone.h:316
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:902
int GetLocalFlags() const
Definition: zone.h:315
bool m_needRefill
False when a zone was refilled, true after changes in zone params.
Definition: zone.h:851
int m_fillVersion
Definition: zone.h:833
bool m_isFilled
True when a zone was filled, false after deleting the filled areas.
Definition: zone.h:844

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

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

◆ IsBrightened()

◆ IsConflicting()

bool ZONE::IsConflicting ( ) const
inherited

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

Definition at line 233 of file zone.cpp.

234{
235 return HasFlag( COURTYARD_CONFLICT );
236}
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 ZONE::ViewGetLayers().

◆ IsConnected()

bool ZONE::IsConnected ( ) const
inlineoverridevirtualinherited

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 ZONE::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
inlineinherited

◆ 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
inherited

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

1029{
1030 if( GetNetCode() < 1 )
1031 return true;
1032
1033 if( !m_insulatedIslands.count( aLayer ) )
1034 return false;
1035
1036 return m_insulatedIslands.at( aLayer ).count( aPolyIdx );
1037}

References BOARD_CONNECTED_ITEM::GetNetCode(), and ZONE::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:344
BOARD_USE GetBoardUse() const
Get what the board use is.
Definition: board.h:288

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(), ZONE::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
overridevirtualinherited
Returns
true if this zone is on a copper layer, false if on a technical layer.

Reimplemented from BOARD_ITEM.

Definition at line 260 of file zone.cpp.

261{
262 return ( m_layerSet & LSET::AllCuMask() ).count() > 0;
263}
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 ZONE::m_layerSet.

Referenced by ZONE_FILLER::fillSingleZone(), PCB_PLUGIN::format(), ZONE::GetFriendlyName(), ZONE::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,
bool  aIncludeCourtyards = false 
) const
overridevirtualinherited

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

324{
325 return m_layerSet.test( aLayer );
326}

References ZONE::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)
inherited

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:318
int GetMinThickness() const
Definition: zone.h:251
ZONE_FILL_MODE GetFillMode() const
Definition: zone.h:174

References ZONE::GetAssignedPriority(), ZONE::GetDoNotAllowCopperPour(), ZONE::GetDoNotAllowFootprints(), ZONE::GetDoNotAllowPads(), ZONE::GetDoNotAllowTracks(), ZONE::GetDoNotAllowVias(), ZONE::GetFillMode(), ZONE::GetIsRuleArea(), ZONE::GetLayerSet(), ZONE::GetMinThickness(), BOARD_CONNECTED_ITEM::GetNetCode(), ZONE::m_fillMode, ZONE::m_islandRemovalMode, ZONE::m_minIslandArea, ZONE::m_PadConnection, ZONE::m_Poly, ZONE::m_thermalReliefGap, ZONE::m_thermalReliefSpokeWidth, ZONE::m_ZoneClearance, ZONE::m_ZoneMinThickness, ZONE::m_zoneName, and ZONE::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(), RENDER_3D_OPENGL::get3dModelsFromFootprint(), 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(), SCH_FIND_REPLACE_TOOL::ReplaceAll(), 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(), SCH_FIND_REPLACE_TOOL::UpdateFind(), 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
inlineinherited

◆ IsTented()

virtual bool BOARD_ITEM::IsTented ( ) const
inlinevirtualinherited

Reimplemented in PCB_VIA.

Definition at line 145 of file board_item.h.

146 {
147 return false;
148 }

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

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

507 {
508 return m_Poly->Iterate();
509 }
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 ZONE::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 ( )
inlineinherited

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

517 {
518 return m_Poly->IterateWithHoles();
519 }

References SHAPE_POLY_SET::IterateWithHoles(), and ZONE::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() & board->GetEnabledLayers();
110
111 LSET copperLayers = layers & LSET::AllCuMask();
112 LSET techLayers = layers & LSET::AllTechMask();
113
114 // Try to be smart and useful. Check all copper first.
115 if( (int) copperLayers.count() == board->GetCopperLayerCount() )
116 return _( "all copper layers" );
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:197
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:587
int GetCopperLayerCount() const
Definition: board.cpp:563
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:532
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
@ PCB_LAYER_ID_COUNT
Definition: layer_ids.h:137

References _, LSET::AllCuMask(), LSET::AllTechMask(), BOARD_ITEM::GetBoard(), BOARD::GetCopperLayerCount(), 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
inlineoverridevirtualinherited

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 ZONE::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 
)
inherited

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

710{
711 m_Poly->Mirror( aMirrorLeftRight, !aMirrorLeftRight, aMirrorRef );
712
713 HatchBorder();
714
715 for( std::pair<const PCB_LAYER_ID, std::shared_ptr<SHAPE_POLY_SET>>& pair : m_FilledPolysList )
716 pair.second->Mirror( aMirrorLeftRight, !aMirrorLeftRight, aMirrorRef );
717}
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:861

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

Referenced by ZONE::Flip().

◆ Move()

void ZONE::Move ( const VECTOR2I offset)
overridevirtualinherited

Move the outlines.

Parameters
offsetis moving vector

Reimplemented from BOARD_ITEM.

Definition at line 635 of file zone.cpp.

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

References BOARD_ITEM::GetBoard(), ZONE::HatchBorder(), ZONE::m_FilledPolysList, ZONE::m_Poly, BOARD::m_ZoneBBoxCache, and SHAPE_POLY_SET::Move().

◆ MoveEdge()

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

Move the outline Edge.

Parameters
offsetis moving vector
aEdgeis start point of the outline edge

Definition at line 675 of file zone.cpp.

676{
677 int next_corner;
678
679 if( m_Poly->GetNeighbourIndexes( aEdge, nullptr, &next_corner ) )
680 {
681 m_Poly->SetVertex( aEdge, m_Poly->CVertex( aEdge ) + VECTOR2I( offset ) );
682 m_Poly->SetVertex( next_corner, m_Poly->CVertex( next_corner ) + VECTOR2I( offset ) );
683 HatchBorder();
684
685 SetNeedRefill( true );
686 }
687}
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(), ZONE::HatchBorder(), ZONE::m_Poly, ZONE::SetNeedRefill(), and SHAPE_POLY_SET::SetVertex().

◆ NeedRefill()

bool ZONE::NeedRefill ( ) const
inlineinherited

Definition at line 245 of file zone.h.

245{ return m_needRefill; }

References ZONE::m_needRefill.

◆ NewHole()

void ZONE::NewHole ( )
inlineinherited

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

Definition at line 570 of file zone.h.

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

References ZONE::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=()

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

Definition at line 1280 of file zone.cpp.

1281{
1282 ZONE::operator=( aOther );
1283 return *this;
1284}
ZONE & operator=(const ZONE &aOther)
Definition: zone.cpp:88

References ZONE::operator=().

◆ Outline() [1/2]

◆ Outline() [2/2]

const SHAPE_POLY_SET * ZONE::Outline ( ) const
inlineinherited

Definition at line 319 of file zone.h.

319{ return m_Poly; }

References ZONE::m_Poly.

◆ RemoveAllContours()

void ZONE::RemoveAllContours ( void  )
inlineinherited

Definition at line 531 of file zone.h.

532 {
534 }

References ZONE::m_Poly, and SHAPE_POLY_SET::RemoveAllContours().

◆ RemoveCutout()

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

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

721{
722 // Ensure the requested cutout is valid
723 if( m_Poly->OutlineCount() < aOutlineIdx || m_Poly->HoleCount( aOutlineIdx ) < aHoleIdx )
724 return;
725
726 SHAPE_POLY_SET cutPoly( m_Poly->Hole( aOutlineIdx, aHoleIdx ) );
727
728 // Add the cutout back to the zone
730
731 SetNeedRefill( true );
732}

References SHAPE_POLY_SET::BooleanAdd(), SHAPE_POLY_SET::Hole(), SHAPE_POLY_SET::HoleCount(), ZONE::m_Poly, SHAPE_POLY_SET::OutlineCount(), SHAPE_POLY_SET::PM_FAST, and ZONE::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 
)
overridevirtualinherited

Rotate the outlines.

Parameters
aCentreis rot centre

Reimplemented from BOARD_ITEM.

Definition at line 690 of file zone.cpp.

691{
692 m_Poly->Rotate( aAngle, VECTOR2I( aCentre ) );
693 HatchBorder();
694
695 /* rotate filled areas: */
696 for( std::pair<const PCB_LAYER_ID, std::shared_ptr<SHAPE_POLY_SET>>& pair : m_FilledPolysList )
697 pair.second->Rotate( aAngle, aCentre );
698}
void Rotate(const EDA_ANGLE &aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Rotate all vertices by a given angle.

References ZONE::HatchBorder(), ZONE::m_FilledPolysList, ZONE::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
inherited

Definition at line 209 of file zone.cpp.

210{
211 return GetNetCode() == aOther->GetNetCode();
212}

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

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

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

828{
829 aBorderHatchPitch = std::max( aBorderHatchPitch,
831 aBorderHatchPitch = std::min( aBorderHatchPitch,
833 SetBorderHatchPitch( aBorderHatchPitch );
834 m_borderStyle = aBorderHatchStyle;
835
836 if( aRebuildBorderHatch )
837 HatchBorder();
838}
void SetBorderHatchPitch(int aPitch)
Set the hatch pitch parameter for the zone.
Definition: zone.cpp:841
#define ZONE_BORDER_HATCH_MINDIST_MM
Definition: zones.h:40
#define ZONE_BORDER_HATCH_MAXDIST_MM
Definition: zones.h:41

References ZONE::HatchBorder(), ZONE::m_borderStyle, EDA_IU_SCALE::mmToIU(), pcbIUScale, ZONE::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)
inherited

Set the hatch pitch parameter for the zone.

Parameters
aPitchis the hatch pitch in iu.

Definition at line 841 of file zone.cpp.

842{
843 m_borderHatchPitch = aPitch;
844}

References ZONE::m_borderHatchPitch.

Referenced by ZONE::SetBorderDisplayStyle().

◆ SetBrightened()

◆ SetCornerPosition()

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

Definition at line 547 of file zone.h.

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

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

◆ SetCornerRadius()

void ZONE::SetCornerRadius ( unsigned int  aRadius)
inherited

Definition at line 381 of file zone.cpp.

382{
383 if( m_cornerRadius != aRadius )
384 SetNeedRefill( true );
385
386 m_cornerRadius = aRadius;
387}

References ZONE::m_cornerRadius, and ZONE::SetNeedRefill().

Referenced by ZONE_SETTINGS::ExportSetting().

◆ SetCornerSmoothingType()

void ZONE::SetCornerSmoothingType ( int  aType)
inlineinherited

Definition at line 652 of file zone.h.

652{ m_cornerSmoothingType = aType; };

References ZONE::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 
)
inlineinherited

Set the list of filled polygons.

Definition at line 629 of file zone.h.

630 {
631 m_FilledPolysList[aLayer] = std::make_shared<SHAPE_POLY_SET>( aPolysList );
632 }

References ZONE::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 
)
inlineinherited

Definition at line 240 of file zone.h.

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

References ZONE::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)
inlineinherited

Definition at line 285 of file zone.h.

285{ m_hatchBorderAlgorithm = aAlgo; }

References ZONE::m_hatchBorderAlgorithm.

Referenced by ZONE_SETTINGS::ExportSetting().

◆ SetHatchGap()

◆ SetHatchHoleMinArea()

void ZONE::SetHatchHoleMinArea ( double  aPct)
inlineinherited

Definition at line 282 of file zone.h.

282{ m_hatchHoleMinArea = aPct; }

References ZONE::m_hatchHoleMinArea.

Referenced by ZONE_SETTINGS::ExportSetting().

◆ SetHatchOrientation()

◆ SetHatchSmoothingLevel()

void ZONE::SetHatchSmoothingLevel ( int  aLevel)
inlineinherited

Definition at line 276 of file zone.h.

276{ m_hatchSmoothingLevel = aLevel; }

References ZONE::m_hatchSmoothingLevel.

Referenced by ZONE_SETTINGS::ExportSetting().

◆ SetHatchSmoothingValue()

void ZONE::SetHatchSmoothingValue ( double  aValue)
inlineinherited

Definition at line 279 of file zone.h.

279{ m_hatchSmoothingValue = aValue; }

References ZONE::m_hatchSmoothingValue.

Referenced by ZONE_SETTINGS::ExportSetting().

◆ SetHatchStyle()

void ZONE::SetHatchStyle ( ZONE_BORDER_DISPLAY_STYLE  aStyle)
inlineinherited

◆ SetHatchThickness()

◆ SetIsFilled()

void ZONE::SetIsFilled ( bool  isFilled)
inlineinherited

◆ SetIsIsland()

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

Definition at line 643 of file zone.h.

644 {
645 m_insulatedIslands[aLayer].insert( aPolyIdx );
646 }

References ZONE::m_insulatedIslands.

◆ SetIsKnockout()

virtual void BOARD_ITEM::SetIsKnockout ( bool  aKnockout)
inlinevirtualinherited

Definition at line 263 of file board_item.h.

263{ 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)
overridevirtualinherited

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

267{
268 SetLayerSet( LSET( aLayer ) );
269}

References ZONE::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)
overridevirtualinherited

Reimplemented from BOARD_ITEM.

Definition at line 272 of file zone.cpp.

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

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

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

◆ SetLocalClearance()

◆ SetLocalFlags()

void ZONE::SetLocalFlags ( int  aFlags)
inlineinherited

Definition at line 316 of file zone.h.

316{ m_localFlgs = aFlags; }

References ZONE::m_localFlgs.

Referenced by ZONE::InitDataFromSrcInCopyCtor(), and ZONE::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)
inlineinherited

Definition at line 721 of file zone.h.

721{ m_minIslandArea = aArea; }

References ZONE::m_minIslandArea.

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

◆ SetMinThickness()

void ZONE::SetMinThickness ( int  aMinThickness)
inlineinherited

◆ 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 }

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

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

Definition at line 321 of file zone.h.

321{ m_Poly = aOutline; }

References ZONE::m_Poly.

Referenced by FABMASTER::loadZone().

◆ SetPadConnection()

◆ SetParent()

virtual void EDA_ITEM::SetParent ( EDA_ITEM aParent)
inlinevirtualinherited

Reimplemented in LIB_SYMBOL.

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_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), 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(), 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)
inlineoverridevirtualinherited

◆ SetSelected()

◆ SetSelectedCorner()

void ZONE::SetSelectedCorner ( int  aCorner)
inlineinherited

Definition at line 298 of file zone.h.

299 {
300 SHAPE_POLY_SET::VERTEX_INDEX selectedCorner;
301
302 // If the global index of the corner is correct, assign it to m_CornerSelection
303 if( m_Poly->GetRelativeIndices( aCorner, &selectedCorner ) )
304 {
305 if( m_CornerSelection == nullptr )
307
308 *m_CornerSelection = selectedCorner;
309 }
310 else
311 throw( std::out_of_range( "aCorner-th vertex does not exist" ) );
312 }

References SHAPE_POLY_SET::GetRelativeIndices(), ZONE::m_CornerSelection, and ZONE::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)
inlineinherited

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

693{ m_teardropType = aType; }

References ZONE::m_teardropType.

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

◆ SetThermalReliefGap()

void ZONE::SetThermalReliefGap ( int  aThermalReliefGap)
inlineinherited

◆ SetThermalReliefSpokeWidth()

void ZONE::SetThermalReliefSpokeWidth ( int  aThermalReliefSpokeWidth)
inlineinherited

◆ SetX()

void BOARD_ITEM::SetX ( int  aX)
inlineinherited

Definition at line 110 of file board_item.h.

111 {
112 VECTOR2I p( aX, GetY() );
113 SetPosition( p );
114 }
int GetY() const
Definition: board_item.h:94
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 116 of file board_item.h.

117 {
118 VECTOR2I p( GetX(), aY );
119 SetPosition( p );
120 }
int GetX() const
Definition: board_item.h:88

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

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

◆ SetZoneName()

◆ Sort()

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

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

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

Definition at line 438 of file eda_item.h.

438{ return *aLeft < *aRight; }

◆ swapData()

void ZONE::swapData ( BOARD_ITEM aImage)
overrideprotectedvirtualinherited

Reimplemented from BOARD_ITEM.

Definition at line 1003 of file zone.cpp.

1004{
1005 assert( aImage->