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...
 
NETCLASSGetNetClass () const override
 Return the NETCLASS for this item. More...
 
wxString GetNetClassName () const override
 Returns the netclass of the zone. More...
 
void InitDataFromSrcInCopyCtor (const ZONE &aZone)
 Copy aZone data to me. More...
 
wxPoint GetPosition () const override
 
void SetPosition (const wxPoint &aPos) override
 
void SetPriority (unsigned aPriority)
 
unsigned GetPriority () const
 
void GetMsgPanelInfo (EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
 Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes. More...
 
void SetLayerSet (LSET aLayerSet) override
 
virtual LSET GetLayerSet () const override
 Return a std::bitset of all layers on which the item physically resides. More...
 
wxString GetZoneName () const
 
void SetZoneName (const wxString &aName)
 
bool Matches (const wxFindReplaceData &aSearchData, void *aAuxData) const override
 Compare the item against the search criteria in aSearchData. More...
 
const EDA_RECT GetBoundingBox () const override
 
const EDA_RECT GetCachedBoundingBox () const
 ONLY TO BE USED BY CLIENTS WHICH SET UP THE CACHE! More...
 
void CacheBoundingBox ()
 
int GetLocalClearance (wxString *aSource) const override
 Return any local clearances set in the "classic" (ie: pre-rule) system. More...
 
int GetLocalClearance () const
 
void SetLocalClearance (int aClearance)
 
bool IsOnCopperLayer () const override
 
bool CommonLayerExists (const LSET aLayerSet) const
 Test if this zone shares a common layer with the given layer set. More...
 
virtual void SetLayer (PCB_LAYER_ID aLayer) override
 Set the layer this item is on. More...
 
virtual PCB_LAYER_ID GetLayer () const override
 Return the primary layer this item is on. More...
 
virtual bool IsOnLayer (PCB_LAYER_ID) const override
 Test to see if this object is on the given layer. More...
 
virtual void ViewGetLayers (int aLayers[], int &aCount) const override
 Return the all the layers within the VIEW the object is painted on. More...
 
void SetFillMode (ZONE_FILL_MODE aFillMode)
 
ZONE_FILL_MODE GetFillMode () const
 
void SetThermalReliefGap (int aThermalReliefGap)
 
int GetThermalReliefGap () const
 
int GetThermalReliefGap (PAD *aPad, wxString *aSource=nullptr) const
 
void SetThermalReliefSpokeWidth (int aThermalReliefSpokeWidth)
 
int GetThermalReliefSpokeWidth () const
 
int GetThermalReliefSpokeWidth (PAD *aPad, wxString *aSource=nullptr) const
 
double CalculateFilledArea ()
 Compute the area currently occupied by the zone fill. More...
 
double GetFilledArea ()
 This area is cached from the most recent call to CalculateFilledArea(). More...
 
std::mutex & GetLock ()
 
int GetFillFlag (PCB_LAYER_ID aLayer)
 
void SetFillFlag (PCB_LAYER_ID aLayer, bool aFlag)
 
bool IsFilled () const
 
void SetIsFilled (bool isFilled)
 
bool NeedRefill () const
 
void SetNeedRefill (bool aNeedRefill)
 
ZONE_CONNECTION GetPadConnection (PAD *aPad, wxString *aSource=nullptr) const
 
ZONE_CONNECTION GetPadConnection () const
 
void SetPadConnection (ZONE_CONNECTION aPadConnection)
 
int GetMinThickness () const
 
void SetMinThickness (int aMinThickness)
 
int GetHatchThickness () const
 
void SetHatchThickness (int aThickness)
 
int GetHatchGap () const
 
void SetHatchGap (int aStep)
 
double GetHatchOrientation () const
 
void SetHatchOrientation (double aStep)
 
int GetHatchSmoothingLevel () const
 
void SetHatchSmoothingLevel (int aLevel)
 
double GetHatchSmoothingValue () const
 
void SetHatchSmoothingValue (double aValue)
 
double GetHatchHoleMinArea () const
 
void SetHatchHoleMinArea (double aPct)
 
int GetHatchBorderAlgorithm () const
 
void SetHatchBorderAlgorithm (int aAlgo)
 
int GetSelectedCorner () const
 
void SetSelectedCorner (int aCorner)
 
void SetSelectedCorner (const wxPoint &aPosition, int aAccuracy)
 
int GetLocalFlags () const
 
void SetLocalFlags (int aFlags)
 
std::vector< SEG > & FillSegments (PCB_LAYER_ID aLayer)
 
const std::vector< SEG > & FillSegments (PCB_LAYER_ID aLayer) const
 
SHAPE_POLY_SETOutline ()
 
const SHAPE_POLY_SETOutline () const
 
void SetOutline (SHAPE_POLY_SET *aOutline)
 
virtual std::shared_ptr< SHAPEGetEffectiveShape (PCB_LAYER_ID aLayer=UNDEFINED_LAYER) const override
 Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes. More...
 
bool HitTest (const wxPoint &aPosition, int aAccuracy=0) const override
 Test if a point is near an outline edge or a corner of this zone. More...
 
bool HitTest (const EDA_RECT &aRect, bool aContained=true, int aAccuracy=0) const override
 
bool HitTestFilledArea (PCB_LAYER_ID aLayer, const wxPoint &aRefPos, int aAccuracy=0) const
 Test if the given wxPoint is within the bounds of a filled area of this zone. More...
 
bool HitTestCutout (const VECTOR2I &aRefPos, int *aOutlineIdx=nullptr, int *aHoleIdx=nullptr) const
 Test if the given point is contained within a cutout of the zone. More...
 
bool HitTestCutout (const wxPoint &aRefPos, int *aOutlineIdx=nullptr, int *aHoleIdx=nullptr) const
 
void GetInteractingZones (PCB_LAYER_ID aLayer, std::vector< ZONE * > *aZones) const
 Some intersecting zones, despite being on the same layer with the same net, cannot be merged due to other parameters such as fillet radius. More...
 
void TransformSolidAreasShapesToPolygon (PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aCornerBuffer, int aError=ARC_HIGH_DEF) const
 Convert solid areas full shapes to polygon set (the full shape is the polygon area with a thick outline) Used in 3D view Arcs (ends of segments) are approximated by segments. More...
 
void TransformSmoothedOutlineToPolygon (SHAPE_POLY_SET &aCornerBuffer, int aClearance, SHAPE_POLY_SET *aBoardOutline) const
 Convert the outlines shape to a polygon with no holes inflated (optional) by max( aClearanceValue, the zone clearance) (holes are linked to external outline by overlapping segments) Used in filling zones calculations Circles (vias) and arcs (ends of tracks) are approximated by segments. More...
 
void TransformShapeWithClearanceToPolygon (SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearanceValue, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
 Convert the zone shape to a closed polygon Used in filling zones calculations Circles and arcs are approximated by segments. More...
 
bool HitTestForCorner (const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
 Test if the given wxPoint is near a corner. More...
 
bool HitTestForCorner (const wxPoint &refPos, int aAccuracy) const
 Test if the given wxPoint is near a corner. More...
 
bool HitTestForEdge (const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
 Test if the given wxPoint is near a segment defined by 2 corners. More...
 
bool HitTestForEdge (const wxPoint &refPos, int aAccuracy) const
 Test if the given wxPoint is near a segment defined by 2 corners. More...
 
bool UnFill ()
 Removes the zone filling. More...
 
void Move (const wxPoint &offset) override
 Move the outlines. More...
 
void Move (const VECTOR2I &aMoveVector)
 
void MoveEdge (const wxPoint &offset, int aEdge)
 Move the outline Edge. More...
 
void Rotate (const wxPoint &aCentre, double aAngle) override
 Move the outlines. More...
 
void Rotate (const VECTOR2I &aRotCentre, double aAngle)
 
virtual void Flip (const wxPoint &aCentre, bool aFlipLeftRight) override
 Flip this object, i.e. More...
 
void Flip (const VECTOR2I &aCentre, bool aFlipLeftRight)
 
void Mirror (const wxPoint &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 wxPoint &new_pos)
 
void NewHole ()
 Create a new hole on the zone; i.e., a new contour on the zone's outline. More...
 
bool AppendCorner (wxPoint aPosition, int aHoleIdx, bool aAllowDuplication=false)
 Add a new corner to the zone outline (to the main outline or a hole) More...
 
ZONE_BORDER_DISPLAY_STYLE GetHatchStyle () const
 
void SetHatchStyle (ZONE_BORDER_DISPLAY_STYLE aStyle)
 
bool IsSame (const ZONE &aZoneToCompare)
 Test if 2 zones are equivalent. More...
 
bool HasFilledPolysForLayer (PCB_LAYER_ID aLayer) const
 
const SHAPE_POLY_SETGetFilledPolysList (PCB_LAYER_ID aLayer) const
 
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...
 
void SetRawPolysList (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
 
bool GetFilledPolysUseThickness () const
 
bool GetFilledPolysUseThickness (PCB_LAYER_ID aLayer) const
 
int GetFillVersion () const
 
void SetFillVersion (int aVersion)
 
void RemoveCutout (int aOutlineIdx, int aHoleIdx)
 Remove a cutout from the zone. More...
 
void AddPolygon (std::vector< wxPoint > &aPolygon)
 Add a polygon to the zone outline. More...
 
void AddPolygon (const SHAPE_LINE_CHAIN &aPolygon)
 
void SetFillSegments (PCB_LAYER_ID aLayer, const std::vector< SEG > &aSegments)
 
SHAPE_POLY_SETRawPolysList (PCB_LAYER_ID aLayer)
 
wxString GetSelectMenuText (EDA_UNITS aUnits) const override
 Return the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position. More...
 
BITMAPS GetMenuImage () const override
 Return a pointer to an image to be used in menus. More...
 
bool GetIsRuleArea () const
 Accessors to parameters used in Rule Area zones: More...
 
bool GetDoNotAllowCopperPour () const
 
bool GetDoNotAllowVias () const
 
bool GetDoNotAllowTracks () const
 
bool GetDoNotAllowPads () const
 
bool GetDoNotAllowFootprints () const
 
bool IsKeepout () const
 
bool KeepoutAll () const
 
void SetIsRuleArea (bool aEnable)
 
void SetDoNotAllowCopperPour (bool aEnable)
 
void SetDoNotAllowVias (bool aEnable)
 
void SetDoNotAllowTracks (bool aEnable)
 
void SetDoNotAllowPads (bool aEnable)
 
void SetDoNotAllowFootprints (bool aEnable)
 
const ISLAND_REMOVAL_MODE GetIslandRemovalMode () const
 
void SetIslandRemovalMode (ISLAND_REMOVAL_MODE aRemove)
 
long long int GetMinIslandArea () const
 
void SetMinIslandArea (long long int aArea)
 
int GetBorderHatchPitch () const
 HatchBorder related methods. More...
 
void SetBorderDisplayStyle (ZONE_BORDER_DISPLAY_STYLE aHatchStyle, int aHatchPitch, bool aRebuildHatch)
 Set all hatch parameters for the zone. More...
 
void SetHatchPitch (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
 
bool GetHV45 () const
 
void SetHV45 (bool aConstrain)
 
void BuildHashValue (PCB_LAYER_ID aLayer)
 Build the hash value of m_FilledPolysList, and store it internally in m_filledPolysHash. More...
 
MD5_HASH GetHashValue (PCB_LAYER_ID aLayer)
 
virtual void SwapData (BOARD_ITEM *aImage) override
 Swap data between aItem and aImage. More...
 
NETINFO_ITEMGetNet () const
 Return #NET_INFO object for a given item. More...
 
void SetNet (NETINFO_ITEM *aNetInfo)
 Set a NET_INFO object for the item. More...
 
int GetNetCode () const
 
bool SetNetCode (int aNetCode, bool aNoAssert)
 Set net using a net code. More...
 
void SetNetCode (int aNetCode)
 
wxString GetNetname () const
 
wxString GetNetnameMsg () const
 
wxString GetShortNetname () const
 
virtual int GetOwnClearance (PCB_LAYER_ID aLayer, wxString *aSource=nullptr) const
 Return an item's "own" clearance in internal units. More...
 
virtual int GetLocalClearanceOverrides (wxString *aSource) const
 Return any local clearance overrides set in the "classic" (ie: pre-rule) system. More...
 
virtual NETCLASSGetEffectiveNetclass () const
 Return the NETCLASS for this item, or the default netclass if none is defined. More...
 
void SetLocalRatsnestVisible (bool aVisible)
 
bool GetLocalRatsnestVisible () const
 
void SetParentGroup (PCB_GROUP *aGroup)
 
PCB_GROUPGetParentGroup () const
 
int GetX () const
 
int GetY () const
 
virtual wxPoint GetCenter () const
 This defaults to the center of the bounding box if not overridden. More...
 
void SetX (int aX)
 
void SetY (int aY)
 
BOARD_ITEM_CONTAINERGetParent () const
 
virtual BOARD_ITEMDuplicate () const
 Create a copy of this BOARD_ITEM. More...
 
bool IsTrack () const
 Test to see if this object is a track or via (or microvia). More...
 
virtual bool IsLocked () const
 
virtual void SetLocked (bool aLocked)
 Modify the 'lock' status for of the item. More...
 
void DeleteStructure ()
 Delete this object after removing from its parent if it has one. More...
 
virtual const BOARDGetBoard () const
 Return the BOARD in which this BOARD_ITEM resides, or NULL if none. More...
 
virtual BOARDGetBoard ()
 
wxString GetLayerName () const
 Return the name of the PCB layer on which the item resides. More...
 
KICAD_T Type () const
 Returns the type of object. More...
 
virtual void SetParent (EDA_ITEM *aParent)
 
bool IsModified () const
 
bool IsNew () const
 
bool IsMoving () const
 
bool IsDragging () const
 
bool IsWireImage () const
 
bool IsSelected () const
 
bool IsEntered () const
 
bool IsResized () const
 
bool IsBrightened () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (EDA_ITEM_FLAGS type) const
 
void SetState (EDA_ITEM_FLAGS type, bool state)
 
EDA_ITEM_FLAGS GetStatus () const
 
void SetStatus (EDA_ITEM_FLAGS aStatus)
 
void SetFlags (EDA_ITEM_FLAGS aMask)
 
void ClearFlags (EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
EDA_ITEM_FLAGS GetFlags () const
 
bool HasFlag (EDA_ITEM_FLAGS aFlag) const
 
EDA_ITEM_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
virtual bool IsType (const KICAD_T aScanTypes[]) const
 Check whether the item is one of the listed types. More...
 
void SetForceVisible (bool aEnable)
 Set and clear force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible. More...
 
bool IsForceVisible () const
 
virtual const wxPoint GetFocusPosition () const
 Similar to GetPosition, but allows items to return their visual center rather than their anchor. More...
 
virtual SEARCH_RESULT Visit (INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 May be re-implemented for each derived class in order to handle all the types given by its member data. More...
 
virtual bool Replace (const wxFindReplaceData &aSearchData, void *aAuxData=nullptr)
 Perform a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Override this method in any derived object that supports test find and replace. More...
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
virtual const BOX2I ViewBBox () const override
 Return the bounding box of the item covering all its layers. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Draw the parts of the object belonging to layer aLayer. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 
void ClearViewPrivData ()
 
bool Set (PROPERTY_BASE *aProperty, wxAny &aValue)
 
template<typename T >
bool Set (PROPERTY_BASE *aProperty, T aValue)
 
template<typename T >
bool Set (const wxString &aProperty, T aValue)
 
wxAny Get (PROPERTY_BASE *aProperty)
 
template<typename T >
Get (PROPERTY_BASE *aProperty)
 
template<typename T >
boost::optional< T > Get (const wxString &aProperty)
 

Static Public Member Functions

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

Public Attributes

const KIID m_Uuid
 

Static Public Attributes

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

Protected Member Functions

bool Matches (const wxString &aText, const wxFindReplaceData &aSearchData) const
 Compare aText against search criteria in aSearchData. More...
 
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
 
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
 
double m_hatchOrientation
 
int m_hatchSmoothingLevel
 
double m_hatchSmoothingValue
 
double m_hatchHoleMinArea
 
int m_hatchBorderAlgorithm
 
SHAPE_POLY_SET::VERTEX_INDEXm_CornerSelection
 The index of the corner being moved or nullptr if no corner is selected. More...
 
int m_localFlgs
 
std::map< PCB_LAYER_ID, std::vector< SEG > > m_FillSegmList
 Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used. More...
 
std::map< PCB_LAYER_ID, SHAPE_POLY_SETm_FilledPolysList
 
std::map< PCB_LAYER_ID, SHAPE_POLY_SETm_RawPolysList
 
EDA_RECT m_bboxCache
 Temp variables used while filling. More...
 
std::map< PCB_LAYER_ID, bool > m_fillFlags
 
std::map< PCB_LAYER_ID, MD5_HASHm_filledPolysHash
 A hash value used in zone filling calculations to see if the filled areas are up to date. More...
 
ZONE_BORDER_DISPLAY_STYLE m_borderStyle
 
int m_borderHatchPitch
 
std::vector< SEGm_borderHatchLines
 
std::map< PCB_LAYER_ID, std::set< int > > m_insulatedIslands
 For each layer, a set of insulated islands that were not removed. More...
 
bool m_hv45
 
double m_area
 
std::mutex m_lock
 Lock used for multi-threaded filling on multi-layer zones. More...
 
NETINFO_ITEMm_netinfo
 Store all information about the net that item belongs to. More...
 
PCB_LAYER_ID m_layer
 
PCB_GROUPm_group
 
EDA_ITEM_FLAGS m_status
 
EDA_ITEMm_parent
 Linked list: Link (parent struct) More...
 
bool m_forceVisible
 
EDA_ITEM_FLAGS m_flags
 

Detailed Description

A specialization of ZONE for use in footprints.

Definition at line 946 of file zone.h.

Constructor & Destructor Documentation

◆ FP_ZONE() [1/2]

FP_ZONE::FP_ZONE ( BOARD_ITEM_CONTAINER aParent)

Definition at line 1326 of file zone.cpp.

1326  :
1327  ZONE( aParent, true )
1328 {
1329  // in a footprint, net classes are not managed.
1330  // so set the net to NETINFO_LIST::ORPHANED_ITEM
1331  SetNetCode( -1, true );
1332 }
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 1335 of file zone.cpp.

1335  :
1336  ZONE( aZone.GetParent(), true )
1337 {
1338  InitDataFromSrcInCopyCtor( aZone );
1339 }
ZONE(BOARD_ITEM_CONTAINER *parent, bool aInFP=false)
The ctor to build ZONE, but compatible with FP_ZONE requirement.
Definition: zone.cpp:44
void InitDataFromSrcInCopyCtor(const ZONE &aZone)
Copy aZone data to me.
Definition: zone.cpp:107
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:166

References ZONE::InitDataFromSrcInCopyCtor().

Member Function Documentation

◆ AddPolygon() [1/2]

void ZONE::AddPolygon ( std::vector< wxPoint > &  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 819 of file zone.cpp.

820 {
821  if( aPolygon.empty() )
822  return;
823 
824  SHAPE_LINE_CHAIN outline;
825 
826  // Create an outline and populate it with the points of aPolygon
827  for( const wxPoint& pt : aPolygon)
828  outline.Append( pt );
829 
830  outline.SetClosed( true );
831 
832  AddPolygon( outline );
833 }
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
void SetClosed(bool aClosed)
Mark the line chain as closed (i.e.
Represent a polyline (an zero-thickness chain of connected line segments).
void AddPolygon(std::vector< wxPoint > &aPolygon)
Add a polygon to the zone outline.
Definition: zone.cpp:819

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

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

◆ AddPolygon() [2/2]

void ZONE::AddPolygon ( const SHAPE_LINE_CHAIN aPolygon)
inherited

Definition at line 805 of file zone.cpp.

806 {
807  wxASSERT( aPolygon.IsClosed() );
808 
809  // Add the outline as a new polygon in the polygon set
810  if( m_Poly->OutlineCount() == 0 )
811  m_Poly->AddOutline( aPolygon );
812  else
813  m_Poly->AddHole( aPolygon );
814 
815  SetNeedRefill( true );
816 }
int OutlineCount() const
Return the number of vertices in a given outline/hole.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:823
bool IsClosed() const override
int AddHole(const SHAPE_LINE_CHAIN &aHole, int aOutline=-1)
Return the area of this poly set.
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new hole to the given outline (default: last) and returns its index.
void SetNeedRefill(bool aNeedRefill)
Definition: zone.h:238

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

◆ AppendCorner()

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

837 {
838  // Ensure the main outline exists:
839  if( m_Poly->OutlineCount() == 0 )
840  m_Poly->NewOutline();
841 
842  // If aHoleIdx >= 0, the corner musty be added to the hole, index aHoleIdx.
843  // (remember: the index of the first hole is 0)
844  // Return error if if does dot exist.
845  if( aHoleIdx >= m_Poly->HoleCount( 0 ) )
846  return false;
847 
848  m_Poly->Append( aPosition.x, aPosition.y, -1, aHoleIdx, aAllowDuplication );
849 
850  SetNeedRefill( true );
851 
852  return true;
853 }
int OutlineCount() const
Return the number of vertices in a given outline/hole.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:823
int NewOutline()
Creates a new hole in a given outline.
int HoleCount(int aOutline) const
Return the reference to aIndex-th outline in the set.
void SetNeedRefill(bool aNeedRefill)
Definition: zone.h:238
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...

References SHAPE_POLY_SET::Append(), SHAPE_POLY_SET::HoleCount(), ZONE::m_Poly, SHAPE_POLY_SET::NewOutline(), SHAPE_POLY_SET::OutlineCount(), and ZONE::SetNeedRefill().

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

◆ BuildHashValue()

void ZONE::BuildHashValue ( PCB_LAYER_ID  aLayer)
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 391 of file zone.cpp.

392 {
393  if( !m_FilledPolysList.count( aLayer ) )
395  else
396  m_filledPolysHash[aLayer] = m_FilledPolysList.at( aLayer ).GetHash();
397 }
MD5_HASH GetHash() const
static SHAPE_POLY_SET g_nullPoly
Definition: zone.cpp:379
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:925
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:917

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

1168 {
1169  if( GetNumCorners() <= 2 ) // malformed zone. polygon calculations will not like it ...
1170  return false;
1171 
1172  // Processing of arc shapes in zones is not yet supported because Clipper can't do boolean
1173  // operations on them. The poly outline must be flattened first.
1174  SHAPE_POLY_SET flattened = *m_Poly;
1175  flattened.ClearArcs();
1176 
1177  if( GetIsRuleArea() )
1178  {
1179  // We like keepouts just the way they are....
1180  aSmoothedPoly = flattened;
1181  return true;
1182  }
1183 
1184  const BOARD* board = GetBoard();
1185  int maxError = ARC_HIGH_DEF;
1186  bool keepExternalFillets = false;
1187 
1188  if( board )
1189  {
1190  BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings();
1191 
1192  maxError = bds.m_MaxError;
1193  keepExternalFillets = bds.m_ZoneKeepExternalFillets;
1194  }
1195 
1196  auto smooth = [&]( SHAPE_POLY_SET& aPoly )
1197  {
1198  switch( m_cornerSmoothingType )
1199  {
1201  aPoly = aPoly.Chamfer( (int) m_cornerRadius );
1202  break;
1203 
1205  {
1206  aPoly = aPoly.Fillet( (int) m_cornerRadius, maxError );
1207  break;
1208  }
1209 
1210  default:
1211  break;
1212  }
1213  };
1214 
1215  std::vector<ZONE*> interactingZones;
1216  GetInteractingZones( aLayer, &interactingZones );
1217 
1218  SHAPE_POLY_SET* maxExtents = &flattened;
1219  SHAPE_POLY_SET withFillets;
1220 
1221  aSmoothedPoly = flattened;
1222 
1223  // Should external fillets (that is, those applied to concave corners) be kept? While it
1224  // seems safer to never have copper extend outside the zone outline, 5.1.x and prior did
1225  // indeed fill them so we leave the mode available.
1226  if( keepExternalFillets )
1227  {
1228  withFillets = flattened;
1229  smooth( withFillets );
1230  withFillets.BooleanAdd( flattened, SHAPE_POLY_SET::PM_FAST );
1231  maxExtents = &withFillets;
1232  }
1233 
1234  for( ZONE* zone : interactingZones )
1235  {
1236  SHAPE_POLY_SET flattened_outline = *zone->Outline();
1237  flattened_outline.ClearArcs();
1238  aSmoothedPoly.BooleanAdd( flattened_outline, SHAPE_POLY_SET::PM_FAST );
1239  }
1240 
1241  if( aBoardOutline )
1242  {
1243  SHAPE_POLY_SET poly = *aBoardOutline;
1245  }
1246 
1247  smooth( aSmoothedPoly );
1248 
1249  if( aSmoothedPolyWithApron )
1250  {
1251  SHAPE_POLY_SET poly = *maxExtents;
1252  poly.Inflate( m_ZoneMinThickness, 64 );
1253  *aSmoothedPolyWithApron = aSmoothedPoly;
1254  aSmoothedPolyWithApron->BooleanIntersection( poly, SHAPE_POLY_SET::PM_FAST );
1255  }
1256 
1257  aSmoothedPoly.BooleanIntersection( *maxExtents, SHAPE_POLY_SET::PM_FAST );
1258 
1259  return true;
1260 }
int GetNumCorners(void) const
Access to m_Poly parameters.
Definition: zone.h:523
unsigned int m_cornerRadius
Definition: zone.h:825
void BooleanAdd(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset difference For aFastMode meaning, see function booleanOp.
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:733
int m_cornerSmoothingType
Definition: zone.h:824
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:823
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:589
void GetInteractingZones(PCB_LAYER_ID aLayer, std::vector< ZONE * > *aZones) const
Some intersecting zones, despite being on the same layer with the same net, cannot be merged due to o...
Definition: zone.cpp:1135
Represent a set of closed polygons.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
void BooleanIntersection(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset union between a and b, store the result in it self For aFastMode meaning,...
int m_ZoneMinThickness
Definition: zone.h:854
void Inflate(int aAmount, int aCircleSegCount, CORNER_STRATEGY aCornerStrategy=ROUND_ALL_CORNERS)
Perform outline inflation/deflation.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
void ClearArcs()
Appends a vertex at the end of the given outline/hole (default: the last outline)
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:50
Container for design settings for a BOARD object.

References SHAPE_POLY_SET::BooleanAdd(), SHAPE_POLY_SET::BooleanIntersection(), SHAPE_POLY_SET::ClearArcs(), BOARD_ITEM::GetBoard(), BOARD::GetDesignSettings(), ZONE::GetInteractingZones(), ZONE::GetIsRuleArea(), ZONE::GetNumCorners(), SHAPE_POLY_SET::Inflate(), 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 ( )
inlineinherited

Definition at line 146 of file zone.h.

EDA_RECT m_bboxCache
Temp variables used while filling.
Definition: zone.h:921
const EDA_RECT GetBoundingBox() const override
Definition: zone.cpp:322

References ZONE::GetBoundingBox(), and ZONE::m_bboxCache.

Referenced by PNS_KICAD_IFACE_BASE::syncZone().

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

1109 {
1110  if( aLayer == UNDEFINED_LAYER )
1111  {
1112  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
1113  pair.second.CacheTriangulation();
1114  }
1115  else
1116  {
1117  if( m_FilledPolysList.count( aLayer ) )
1119  }
1120 }
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...
Definition: zone.cpp:1108
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:917

References ZONE::m_FilledPolysList, and UNDEFINED_LAYER.

◆ CalculateFilledArea()

double ZONE::CalculateFilledArea ( )
inherited

Compute the area currently occupied by the zone fill.

Returns
the currently filled area

Definition at line 1263 of file zone.cpp.

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

References SHAPE_LINE_CHAIN::Area(), SHAPE_POLY_SET::Hole(), SHAPE_POLY_SET::HoleCount(), ZONE::m_area, ZONE::m_FilledPolysList, SHAPE_POLY_SET::Outline(), and SHAPE_POLY_SET::OutlineCount().

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

554  {
555  return m_Poly->CIterateWithHoles();
556  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:823
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  }
class ZONE, a copper pour area
Definition: typeinfo.h:105
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

References PCB_ZONE_T, and EDA_ITEM::Type().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

◆ ClearEditFlags()

◆ ClearFlags()

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

Definition at line 154 of file eda_item.h.

154 { m_flags &= ~aMask; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481

References EDA_ITEM::m_flags.

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

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 166 of file eda_item.h.

167  {
169  DO_NOT_DRAW );
170  }
#define DO_NOT_DRAW
Used to disable draw function.
#define STARTPOINT
When a line is selected, these flags indicate which.
#define ENDPOINT
ends. (Used to support dragging.)
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
#define CANDIDATE
flag indicating that the structure is connected
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:154
#define SKIP_STRUCT
flag indicating that the structure should be ignored
#define TEMP_SELECTED
flag indicating that the structure has already selected

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

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 148 of file view_item.h.

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

References KIGFX::VIEW_ITEM::m_viewPrivData.

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

◆ Clone()

EDA_ITEM * 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 1349 of file zone.cpp.

1350 {
1351  return new FP_ZONE( *this );
1352 }
FP_ZONE(BOARD_ITEM_CONTAINER *aParent)
Definition: zone.cpp:1326

References FP_ZONE().

◆ CommonLayerExists()

bool ZONE::CommonLayerExists ( const LSET  aLayerSet) const
inherited

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

Definition at line 230 of file zone.cpp.

231 {
232  LSET common = GetLayerSet() & aLayerSet;
233 
234  return common.count() > 0;
235 }
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: zone.cpp:291
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:502

References ZONE::GetLayerSet().

◆ DeleteStructure()

void BOARD_ITEM::DeleteStructure ( )
inherited

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

Definition at line 140 of file board_item.cpp.

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

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

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

◆ Duplicate()

virtual BOARD_ITEM* BOARD_ITEM::Duplicate ( ) const
inlinevirtualinherited

Create a copy of this BOARD_ITEM.

Reimplemented in FOOTPRINT.

Definition at line 200 of file board_item.h.

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

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

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

◆ FillSegments() [1/2]

std::vector<SEG>& ZONE::FillSegments ( PCB_LAYER_ID  aLayer)
inlineinherited

Definition at line 308 of file zone.h.

309  {
310  wxASSERT( m_FillSegmList.count( aLayer ) );
311  return m_FillSegmList.at( aLayer );
312  }
std::map< PCB_LAYER_ID, std::vector< SEG > > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: zone.h:907

References ZONE::m_FillSegmList.

Referenced by PCB_IO::format().

◆ FillSegments() [2/2]

const std::vector<SEG>& ZONE::FillSegments ( PCB_LAYER_ID  aLayer) const
inlineinherited

Definition at line 314 of file zone.h.

315  {
316  wxASSERT( m_FillSegmList.count( aLayer ) );
317  return m_FillSegmList.at( aLayer );
318  }
std::map< PCB_LAYER_ID, std::vector< SEG > > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: zone.h:907

References ZONE::m_FillSegmList.

◆ Flip() [1/2]

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

Definition at line 304 of file board_item.h.

305  {
306  Flip( wxPoint( aCentre.x, aCentre.y ), aFlipLeftRight );
307  }
virtual void Flip(const wxPoint &aCentre, bool aFlipLeftRight)
Flip this object, i.e.
Definition: board_item.cpp:197

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

◆ Flip() [2/2]

void ZONE::Flip ( const wxPoint &  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 733 of file zone.cpp.

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

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

◆ Get() [1/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty)
inlineinherited

Definition at line 86 of file inspectable.h.

87  {
89  TYPE_ID thisType = TYPE_HASH( *this );
90  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
91  return object ? aProperty->getter( object ) : wxAny();
92  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
virtual wxAny getter(void *aObject) const =0
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

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

◆ Get() [2/3]

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

Definition at line 95 of file inspectable.h.

96  {
98  TYPE_ID thisType = TYPE_HASH( *this );
99  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
100  return object ? aProperty->get<T>( object ) : T();
101  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
T get(void *aObject)
Definition: property.h:268
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

◆ Get() [3/3]

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

Definition at line 104 of file inspectable.h.

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

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

◆ GetBoard() [1/2]

const BOARD * BOARD_ITEM::GetBoard ( ) const
virtualinherited

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

Definition at line 50 of file board_item.cpp.

51 {
52  if( Type() == PCB_T )
53  return static_cast<const BOARD*>( this );
54 
55  BOARD_ITEM* parent = GetParent();
56 
57  if( parent )
58  return parent->GetBoard();
59 
60  return nullptr;
61 }
Definition: typeinfo.h:84
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:80
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:50
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:166
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

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

Referenced by ZONE_FILLER::addHoleKnockout(), PAD::BuildEffectivePolygon(), PAD::BuildEffectiveShapes(), ZONE::BuildSmoothedPoly(), calcIsInsideArea(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), PCB_LAYER_VALUE::EqualTo(), existsOnLayer(), exprFromTo(), PCB_VIA::FlashLayer(), PAD::FlashLayer(), PCB_TARGET::Flip(), PCB_TEXT::Flip(), PCB_TRACK::Flip(), FP_SHAPE::Flip(), FP_TEXT::Flip(), PCB_DIMENSION_BASE::Flip(), PCB_ARC::Flip(), PCB_SHAPE::Flip(), PCB_VIA::Flip(), ZONE::Flip(), PCB_EXPR_CONTEXT::GetBoard(), BOARD_ITEM::GetBoard(), FOOTPRINT::GetBoundingBox(), FOOTPRINT::GetBoundingHull(), BOARD_CONNECTED_ITEM::GetEffectiveNetclass(), PCB_VIA::GetEffectiveShape(), ZONE::GetInteractingZones(), BOARD_ITEM::GetLayerName(), PCB_VIA::GetMinAnnulus(), PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), ZONE::GetMsgPanelInfo(), NETINFO_ITEM::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), BOARD_CONNECTED_ITEM::GetOwnClearance(), ZONE::GetSelectMenuText(), DRC_ENGINE::GetShape(), FP_TEXT::GetShownText(), PAD::GetSolderMaskMargin(), PAD::GetSolderPasteMargin(), BOARD::GetTrackLength(), PCB_TRACK::GetWidthConstraints(), inDiffPair(), insideArea(), insideBackCourtyard(), insideCourtyard(), insideFrontCourtyard(), isInsideArea(), isInsideCourtyard(), BOARD_ITEM::layerMaskDescribe(), PCB_VIA::layerMaskDescribe(), CONVERT_TOOL::makePolysFromCircles(), PAD::MergePrimitivesAsPolygon(), EAGLE_PLUGIN::packageWire(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), BOARD::ResolveDRCExclusions(), BOARD_CONNECTED_ITEM::SetNetCode(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow(), ZONE::TransformSmoothedOutlineToPolygon(), ZONE::TransformSolidAreasShapesToPolygon(), PCB_TRACK::ViewBBox(), FOOTPRINT::ViewBBox(), PCB_VIA::ViewGetLOD(), and PAD::ViewGetLOD().

◆ GetBoard() [2/2]

BOARD * BOARD_ITEM::GetBoard ( )
virtualinherited

Definition at line 64 of file board_item.cpp.

65 {
66  if( Type() == PCB_T )
67  return static_cast<BOARD*>( this );
68 
69  BOARD_ITEM* parent = GetParent();
70 
71  if( parent )
72  return parent->GetBoard();
73 
74  return nullptr;
75 }
Definition: typeinfo.h:84
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:80
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:50
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:166
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

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

◆ GetBorderHatchPitch()

int ZONE::GetBorderHatchPitch ( ) const
inherited

HatchBorder related methods.

Returns
the zone hatch pitch in iu.

Definition at line 890 of file zone.cpp.

891 {
892  return m_borderHatchPitch;
893 }
int m_borderHatchPitch
Definition: zone.h:928

References ZONE::m_borderHatchPitch.

Referenced by PCB_IO::format().

◆ GetBoundingBox()

const EDA_RECT ZONE::GetBoundingBox ( ) const
overridevirtualinherited
Returns
an EDA_RECT that is the bounding box of the zone outline.

Reimplemented from EDA_ITEM.

Definition at line 322 of file zone.cpp.

323 {
324  auto bb = m_Poly->BBox();
325 
326  EDA_RECT ret( (wxPoint) bb.GetOrigin(), wxSize( bb.GetWidth(), bb.GetHeight() ) );
327 
328  return ret;
329 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:823
Handle the component boundary box.
Definition: eda_rect.h:42
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.

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

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

◆ GetCachedBoundingBox()

const EDA_RECT ZONE::GetCachedBoundingBox ( ) const
inlineinherited

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

Definition at line 145 of file zone.h.

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

References ZONE::m_bboxCache.

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

◆ GetCenter()

virtual wxPoint BOARD_ITEM::GetCenter ( ) const
inlinevirtualinherited

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

Returns
center point of the item

Reimplemented in PCB_ARC, PAD, PCB_SHAPE, and PCB_MARKER.

Definition at line 112 of file board_item.h.

113  {
114  return GetBoundingBox().GetCenter();
115  }
virtual const EDA_RECT GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
Definition: eda_item.cpp:75
const wxPoint GetCenter() const
Definition: eda_rect.h:104

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

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

◆ GetClass()

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

Implements EDA_ITEM.

Definition at line 515 of file zone.h.

516  {
517  return wxT( "ZONE" );
518  }

◆ GetCornerPosition()

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

Definition at line 563 of file zone.h.

564  {
566 
567  // Convert global to relative indices
568  if( !m_Poly->GetRelativeIndices( aCornerIndex, &index ) )
569  throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
570 
571  return m_Poly->CVertex( index );
572  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:823
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the aGlobalIndex-th vertex in the poly set.
Structure to hold the necessary information in order to index a vertex on a SHAPE_POLY_SET object: th...
bool GetRelativeIndices(int aGlobalIdx, VERTEX_INDEX *aRelativeIndices) const
Convert a global vertex index —i.e., a number that globally identifies a vertex in a concatenated lis...

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

Referenced by ZONE::GetPosition().

◆ GetCornerRadius()

unsigned int ZONE::GetCornerRadius ( ) const
inlineinherited

Definition at line 687 of file zone.h.

687 { return m_cornerRadius; }
unsigned int m_cornerRadius
Definition: zone.h:825

References ZONE::m_cornerRadius.

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

◆ GetCornerSmoothingType()

int ZONE::GetCornerSmoothingType ( ) const
inlineinherited

Definition at line 683 of file zone.h.

683 { return m_cornerSmoothingType; }
int m_cornerSmoothingType
Definition: zone.h:824

References ZONE::m_cornerSmoothingType.

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

◆ GetDefaultHatchPitch()

◆ GetDoNotAllowCopperPour()

bool ZONE::GetDoNotAllowCopperPour ( ) const
inlineinherited

Definition at line 734 of file zone.h.

734 { return m_doNotAllowCopperPour; }
bool m_doNotAllowCopperPour
Definition: zone.h:846

References ZONE::m_doNotAllowCopperPour.

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

◆ GetDoNotAllowFootprints()

bool ZONE::GetDoNotAllowFootprints ( ) const
inlineinherited

Definition at line 738 of file zone.h.

738 { return m_doNotAllowFootprints; }
bool m_doNotAllowFootprints
Definition: zone.h:850

References ZONE::m_doNotAllowFootprints.

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

◆ GetDoNotAllowPads()

bool ZONE::GetDoNotAllowPads ( ) const
inlineinherited

Definition at line 737 of file zone.h.

737 { return m_doNotAllowPads; }
bool m_doNotAllowPads
Definition: zone.h:849

References ZONE::m_doNotAllowPads.

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

◆ GetDoNotAllowTracks()

bool ZONE::GetDoNotAllowTracks ( ) const
inlineinherited

◆ GetDoNotAllowVias()

bool ZONE::GetDoNotAllowVias ( ) const
inlineinherited

◆ GetEditFlags()

EDA_ITEM_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 158 of file eda_item.h.

159  {
160  constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVING | IS_RESIZING | IS_DRAGGING
162 
163  return m_flags & mask;
164  }
#define IS_NEW
New item, just created.
#define IS_RESIZING
Item being resized.
#define IS_DRAGGING
Item being dragged.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
#define IS_MOVING
Item being moved.
#define STRUCT_DELETED
flag indication structures to be erased
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.

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

Referenced by 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_TOOL::Properties(), PAD_TOOL::recombinePad(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), and DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow().

◆ GetEffectiveNetclass()

NETCLASS * BOARD_CONNECTED_ITEM::GetEffectiveNetclass ( ) const
virtualinherited

Return the NETCLASS for this item, or the default netclass if none is defined.

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

Definition at line 66 of file board_connected_item.cpp.

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

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

◆ GetEffectiveShape()

std::shared_ptr< SHAPE > ZONE::GetEffectiveShape ( PCB_LAYER_ID  aLayer = UNDEFINED_LAYER) const
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.

Reimplemented from BOARD_ITEM.

Definition at line 1379 of file zone.cpp.

1380 {
1381  std::shared_ptr<SHAPE> shape;
1382 
1383  if( m_FilledPolysList.find( aLayer ) == m_FilledPolysList.end() )
1384  {
1385  shape = std::make_shared<SHAPE_NULL>();
1386  }
1387  else
1388  {
1389  shape.reset( m_FilledPolysList.at( aLayer ).Clone() );
1390  }
1391 
1392  return shape;
1393 }
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:917

References ZONE::m_FilledPolysList.

◆ GetFilledArea()

double ZONE::GetFilledArea ( )
inlineinherited

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

Returns
the filled area

Definition at line 217 of file zone.h.

218  {
219  return m_area;
220  }
double m_area
Definition: zone.h:936

References ZONE::m_area.

◆ GetFilledPolysList()

const SHAPE_POLY_SET& ZONE::GetFilledPolysList ( PCB_LAYER_ID  aLayer) const
inlineinherited
Returns
a reference to the list of filled polygons.

Definition at line 635 of file zone.h.

636  {
637  wxASSERT( m_FilledPolysList.count( aLayer ) );
638  return m_FilledPolysList.at( aLayer );
639  }
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:917

References ZONE::m_FilledPolysList.

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

◆ GetFilledPolysUseThickness() [1/2]

◆ GetFilledPolysUseThickness() [2/2]

bool ZONE::GetFilledPolysUseThickness ( PCB_LAYER_ID  aLayer) const
inherited

Definition at line 370 of file zone.cpp.

371 {
372  if( ADVANCED_CFG::GetCfg().m_DebugZoneFiller && LSET::InternalCuMask().Contains( aLayer ) )
373  return false;
374 
376 }
static LSET InternalCuMask()
Return a complete set of internal copper layers which is all Cu layers except F_Cu and B_Cu.
Definition: lset.cpp:710
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
bool GetFilledPolysUseThickness() const
Definition: zone.h:689

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

◆ GetFillFlag()

int ZONE::GetFillFlag ( PCB_LAYER_ID  aLayer)
inlineinherited

Definition at line 227 of file zone.h.

228  {
229  return m_fillFlags.count( aLayer ) ? m_fillFlags[ aLayer ] : false;
230  }
std::map< PCB_LAYER_ID, bool > m_fillFlags
Definition: zone.h:922

References ZONE::m_fillFlags.

◆ GetFillMode()

ZONE_FILL_MODE ZONE::GetFillMode ( ) const
inlineinherited

Definition at line 181 of file zone.h.

181 { return m_fillMode; }
ZONE_FILL_MODE m_fillMode
How to fill areas:
Definition: zone.h:885

References ZONE::m_fillMode.

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

◆ GetFillVersion()

int ZONE::GetFillVersion ( ) const
inlineinherited

Definition at line 692 of file zone.h.

692 { return m_fillVersion; }
int m_fillVersion
Definition: zone.h:855

References ZONE::m_fillVersion.

◆ GetFlags()

◆ GetFocusPosition()

virtual const wxPoint EDA_ITEM::GetFocusPosition ( ) const
inlinevirtualinherited

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

Reimplemented in BOARD, PCB_SHAPE, and PCB_TRACK.

Definition at line 259 of file eda_item.h.

259 { return GetPosition(); }
virtual wxPoint GetPosition() const
Definition: eda_item.h:252

References EDA_ITEM::GetPosition().

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

◆ GetHashValue()

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

Definition at line 382 of file zone.cpp.

383 {
384  if( !m_filledPolysHash.count( aLayer ) )
385  return g_nullPoly.GetHash();
386  else
387  return m_filledPolysHash.at( aLayer );
388 }
MD5_HASH GetHash() const
static SHAPE_POLY_SET g_nullPoly
Definition: zone.cpp:379
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:925

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

◆ GetHatchBorderAlgorithm()

int ZONE::GetHatchBorderAlgorithm ( ) const
inlineinherited

Definition at line 271 of file zone.h.

271 { return m_hatchBorderAlgorithm; }
int m_hatchBorderAlgorithm
Definition: zone.h:895

References ZONE::m_hatchBorderAlgorithm.

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

◆ GetHatchGap()

int ZONE::GetHatchGap ( ) const
inlineinherited

Definition at line 256 of file zone.h.

256 { return m_hatchGap; }
int m_hatchGap
Definition: zone.h:887

References ZONE::m_hatchGap.

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

◆ GetHatchHoleMinArea()

double ZONE::GetHatchHoleMinArea ( ) const
inlineinherited

Definition at line 268 of file zone.h.

268 { return m_hatchHoleMinArea; }
double m_hatchHoleMinArea
Definition: zone.h:894

References ZONE::m_hatchHoleMinArea.

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

◆ GetHatchLines()

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

Definition at line 800 of file zone.h.

800 { return m_borderHatchLines; }
std::vector< SEG > m_borderHatchLines
Definition: zone.h:929

References ZONE::m_borderHatchLines.

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

◆ GetHatchOrientation()

double ZONE::GetHatchOrientation ( ) const
inlineinherited

Definition at line 259 of file zone.h.

259 { return m_hatchOrientation; }
double m_hatchOrientation
Definition: zone.h:888

References ZONE::m_hatchOrientation.

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

◆ GetHatchSmoothingLevel()

int ZONE::GetHatchSmoothingLevel ( ) const
inlineinherited

Definition at line 262 of file zone.h.

262 { return m_hatchSmoothingLevel; }
int m_hatchSmoothingLevel
Definition: zone.h:889

References ZONE::m_hatchSmoothingLevel.

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

◆ GetHatchSmoothingValue()

double ZONE::GetHatchSmoothingValue ( ) const
inlineinherited

Definition at line 265 of file zone.h.

265 { return m_hatchSmoothingValue; }
double m_hatchSmoothingValue
Definition: zone.h:893

References ZONE::m_hatchSmoothingValue.

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

◆ GetHatchStyle()

ZONE_BORDER_DISPLAY_STYLE ZONE::GetHatchStyle ( ) const
inlineinherited

Definition at line 613 of file zone.h.

613 { return m_borderStyle; }
ZONE_BORDER_DISPLAY_STYLE m_borderStyle
Definition: zone.h:927

References ZONE::m_borderStyle.

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

◆ GetHatchThickness()

int ZONE::GetHatchThickness ( ) const
inlineinherited

Definition at line 253 of file zone.h.

253 { return m_hatchThickness; }
int m_hatchThickness
Definition: zone.h:886

References ZONE::m_hatchThickness.

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

◆ GetHV45()

bool ZONE::GetHV45 ( ) const
inlineinherited

Definition at line 802 of file zone.h.

802 { return m_hv45; }
bool m_hv45
Definition: zone.h:934

References ZONE::m_hv45.

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

◆ GetInteractingZones()

void ZONE::GetInteractingZones ( PCB_LAYER_ID  aLayer,
std::vector< ZONE * > *  aZones 
) 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 1135 of file zone.cpp.

1136 {
1137  int epsilon = Millimeter2iu( 0.001 );
1138 
1139  for( ZONE* candidate : GetBoard()->Zones() )
1140  {
1141  if( candidate == this )
1142  continue;
1143 
1144  if( !candidate->GetLayerSet().test( aLayer ) )
1145  continue;
1146 
1147  if( candidate->GetIsRuleArea() )
1148  continue;
1149 
1150  if( candidate->GetNetCode() != GetNetCode() )
1151  continue;
1152 
1153  for( auto iter = m_Poly->CIterate(); iter; iter++ )
1154  {
1155  if( candidate->m_Poly->Collide( iter.Get(), epsilon ) )
1156  {
1157  aZones->push_back( candidate );
1158  break;
1159  }
1160  }
1161  }
1162 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:823
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
CONST_ITERATOR CIterate(int aFirst, int aLast, bool aIterateHoles=false) const
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:50
static constexpr int Millimeter2iu(double mm)

References SHAPE_POLY_SET::CIterate(), BOARD_ITEM::GetBoard(), BOARD_CONNECTED_ITEM::GetNetCode(), ZONE::m_Poly, and Millimeter2iu().

Referenced by ZONE::BuildSmoothedPoly().

◆ GetIslandRemovalMode()

const ISLAND_REMOVAL_MODE ZONE::GetIslandRemovalMode ( ) const
inlineinherited

Definition at line 749 of file zone.h.

749 { return m_islandRemovalMode; }
ISLAND_REMOVAL_MODE m_islandRemovalMode
Definition: zone.h:857

References ZONE::m_islandRemovalMode.

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

◆ GetIsRuleArea()

◆ GetLayer()

PCB_LAYER_ID ZONE::GetLayer ( ) const
overridevirtualinherited

◆ GetLayerName()

wxString BOARD_ITEM::GetLayerName ( ) const
inherited

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

Returns
the layer name associated with this item.

Definition at line 87 of file board_item.cpp.

88 {
89  const BOARD* board = GetBoard();
90 
91  if( board )
92  return board->GetLayerName( m_layer );
93 
94  // If no parent, return standard name
96 }
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:361
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
PCB_LAYER_ID m_layer
Definition: board_item.h:353
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:50
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition: board.h:605

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

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

◆ GetLayerSet()

LSET ZONE::GetLayerSet ( ) const
overridevirtualinherited

◆ GetLocalClearance() [1/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 494 of file zone.cpp.

495 {
496  if( m_isRuleArea )
497  return 0;
498 
499  if( aSource )
500  *aSource = _( "zone" );
501 
502  return m_ZoneClearance;
503 }
int m_ZoneClearance
Definition: zone.h:853
#define _(s)
bool m_isRuleArea
Definition: zone.h:841

References _, ZONE::m_isRuleArea, and ZONE::m_ZoneClearance.

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

◆ GetLocalClearance() [2/2]

int ZONE::GetLocalClearance ( ) const
inlineinherited

Definition at line 157 of file zone.h.

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

References ZONE::GetLocalClearance().

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

◆ GetLocalClearanceOverrides()

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

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

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

Reimplemented in PAD.

Definition at line 142 of file board_connected_item.h.

142 { return 0; }

Referenced by DRC_ENGINE::EvalRules().

◆ GetLocalFlags()

int ZONE::GetLocalFlags ( ) const
inlineinherited

Definition at line 305 of file zone.h.

305 { return m_localFlgs; }
int m_localFlgs
Definition: zone.h:901

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

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

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

1095 {
1096  return BITMAPS::add_zone;
1097 }

References add_zone.

◆ GetMinIslandArea()

long long int ZONE::GetMinIslandArea ( ) const
inlineinherited

Definition at line 753 of file zone.h.

753 { 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:863

References ZONE::m_minIslandArea.

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

◆ GetMinThickness()

◆ GetMsgPanelInfo()

void ZONE::GetMsgPanelInfo ( EDA_DRAW_FRAME aFrame,
std::vector< MSG_PANEL_ITEM > &  aList 
)
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 546 of file zone.cpp.

547 {
548  EDA_UNITS units = aFrame->GetUserUnits();
549  wxString msg;
550 
551  if( GetIsRuleArea() )
552  msg = _( "Rule Area" );
553  else if( IsOnCopperLayer() )
554  msg = _( "Copper Zone" );
555  else
556  msg = _( "Non-copper Zone" );
557 
558  // Display Cutout instead of Outline for holes inside a zone (i.e. when num contour !=0).
559  // Check whether the selected corner is in a hole; i.e., in any contour but the first one.
560  if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
561  msg << wxT( " " ) << _( "Cutout" );
562 
563  aList.emplace_back( _( "Type" ), msg );
564 
565  if( GetIsRuleArea() )
566  {
567  msg.Empty();
568 
569  if( GetDoNotAllowVias() )
570  AccumulateDescription( msg, _( "No vias" ) );
571 
572  if( GetDoNotAllowTracks() )
573  AccumulateDescription( msg, _( "No tracks" ) );
574 
575  if( GetDoNotAllowPads() )
576  AccumulateDescription( msg, _( "No pads" ) );
577 
579  AccumulateDescription( msg, _( "No copper zones" ) );
580 
582  AccumulateDescription( msg, _( "No footprints" ) );
583 
584  if( !msg.IsEmpty() )
585  aList.emplace_back( MSG_PANEL_ITEM( _( "Restrictions" ), msg ) );
586  }
587  else if( IsOnCopperLayer() )
588  {
589  aList.emplace_back( _( "Net" ), UnescapeString( GetNetname() ) );
590 
591  aList.emplace_back( _( "NetClass" ), UnescapeString( GetNetClass()->GetName() ) );
592 
593  // Display priority level
594  aList.emplace_back( _( "Priority" ), wxString::Format( "%d", GetPriority() ) );
595  }
596 
597  if( IsLocked() )
598  aList.emplace_back( _( "Status" ), _( "Locked" ) );
599 
600  wxString layerDesc;
601  int count = 0;
602 
603  for( PCB_LAYER_ID layer : m_layerSet.Seq() )
604  {
605  if( count == 0 )
606  layerDesc = GetBoard()->GetLayerName( layer );
607 
608  count++;
609  }
610 
611  if( count > 1 )
612  layerDesc.Printf( _( "%s and %d more" ), layerDesc, count - 1 );
613 
614  aList.emplace_back( _( "Layer" ), layerDesc );
615 
616  if( !m_zoneName.empty() )
617  aList.emplace_back( _( "Name" ), m_zoneName );
618 
619  switch( m_fillMode )
620  {
621  case ZONE_FILL_MODE::POLYGONS: msg = _( "Solid" ); break;
622  case ZONE_FILL_MODE::HATCH_PATTERN: msg = _( "Hatched" ); break;
623  default: msg = _( "Unknown" ); break;
624  }
625 
626  aList.emplace_back( _( "Fill Mode" ), msg );
627 
628  msg = MessageTextFromValue( units, m_area, true, EDA_DATA_TYPE::AREA );
629  aList.emplace_back( _( "Filled Area" ), msg );
630 
631  wxString source;
632  int clearance = GetOwnClearance( GetLayer(), &source );
633 
634  aList.emplace_back( wxString::Format( _( "Min Clearance: %s" ),
635  MessageTextFromValue( units, clearance ) ),
636  wxString::Format( _( "(from %s)" ), source ) );
637 
638  // Useful for statistics, especially when zones are complex the number of hatches
639  // and filled polygons can explain the display and DRC calculation time:
640  msg.Printf( wxT( "%d" ), (int) m_borderHatchLines.size() );
641  aList.emplace_back( MSG_PANEL_ITEM( _( "HatchBorder Lines" ), msg ) );
642 
643  PCB_LAYER_ID layer = m_layer;
644 
645  // NOTE: This brings in dependence on PCB_EDIT_FRAME to the qa tests, which isn't ideal.
646  // TODO: Figure out a way for items to know the active layer without the whole edit frame?
647 #if 0
648  if( PCB_EDIT_FRAME* pcbframe = dynamic_cast<PCB_EDIT_FRAME*>( aFrame ) )
649  {
650  if( m_FilledPolysList.count( pcbframe->GetActiveLayer() ) )
651  layer = pcbframe->GetActiveLayer();
652  }
653 #endif
654 
655  if( !GetIsRuleArea() )
656  {
657  auto layer_it = m_FilledPolysList.find( layer );
658 
659  if( layer_it == m_FilledPolysList.end() )
660  layer_it = m_FilledPolysList.begin();
661 
662  if( layer_it != m_FilledPolysList.end() )
663  {
664  msg.Printf( wxT( "%d" ), layer_it->second.TotalVertices() );
665  aList.emplace_back( MSG_PANEL_ITEM( _( "Corner Count" ), msg ) );
666  }
667  }
668 }
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:104
bool GetDoNotAllowFootprints() const
Definition: zone.h:738
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:361
ZONE_FILL_MODE m_fillMode
How to fill areas:
Definition: zone.h:885
unsigned GetPriority() const
Definition: zone.h:122
NETCLASS * GetNetClass() const override
Return the NETCLASS for this item.
Definition: zone.h:87
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:733
wxString m_zoneName
An optional unique name for this zone, used for identifying it in DRC checking.
Definition: zone.h:828
bool GetDoNotAllowVias() const
Definition: zone.h:735
double m_area
Definition: zone.h:936
virtual bool IsLocked() const
Definition: board_item.cpp:78
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:411
LSET m_layerSet
Definition: zone.h:830
bool GetDoNotAllowPads() const
Definition: zone.h:737
bool GetDoNotAllowCopperPour() const
Definition: zone.h:734
virtual PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: zone.cpp:218
bool GetDoNotAllowTracks() const
Definition: zone.h:736
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: zone.h:899
#define _(s)
wxString UnescapeString(const wxString &aSource)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
EDA_UNITS
Definition: eda_units.h:38
std::vector< SEG > m_borderHatchLines
Definition: zone.h:929
void AccumulateDescription(wxString &aDesc, const wxString &aItem)
Utility to build comma separated lists in messages.
Definition: string_utils.h:319
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:64
The main frame for Pcbnew.
bool IsOnCopperLayer() const override
Definition: zone.cpp:224
virtual int GetOwnClearance(PCB_LAYER_ID aLayer, wxString *aSource=nullptr) const
Return an item's "own" clearance in internal units.
PCB_LAYER_ID m_layer
Definition: board_item.h:353
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:50
EDA_MSG_PANEL items for displaying messages.
Definition: msgpanel.h:53
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:917
EDA_UNITS GetUserUnits() const
Return the user units currently in use.

References _, AccumulateDescription(), AREA, Format(), BOARD_ITEM::GetBoard(), ZONE::GetDoNotAllowCopperPour(), ZONE::GetDoNotAllowFootprints(), ZONE::GetDoNotAllowPads(), ZONE::GetDoNotAllowTracks(), ZONE::GetDoNotAllowVias(), ZONE::GetIsRuleArea(), ZONE::GetLayer(), BOARD::GetLayerName(), ZONE::GetNetClass(), BOARD_CONNECTED_ITEM::GetNetname(), BOARD_CONNECTED_ITEM::GetOwnClearance(), ZONE::GetPriority(), EDA_BASE_FRAME::GetUserUnits(), HATCH_PATTERN, BOARD_ITEM::IsLocked(), ZONE::IsOnCopperLayer(), ZONE::m_area, ZONE::m_borderHatchLines, SHAPE_POLY_SET::VERTEX_INDEX::m_contour, ZONE::m_CornerSelection, ZONE::m_FilledPolysList, ZONE::m_fillMode, BOARD_ITEM::m_layer, ZONE::m_layerSet, ZONE::m_zoneName, MessageTextFromValue(), POLYGONS, LSET::Seq(), and UnescapeString().

◆ GetNet()

◆ GetNetClass()

NETCLASS* ZONE::GetNetClass ( ) const
inlineoverridevirtualinherited

Return the NETCLASS for this item.

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

Reimplemented from BOARD_CONNECTED_ITEM.

Definition at line 87 of file zone.h.

88  {
89  if( GetIsRuleArea() )
90  return nullptr;
91 
93  }
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:733
virtual NETCLASS * GetNetClass() const
Return the NETCLASS for this item.

References ZONE::GetIsRuleArea(), and BOARD_CONNECTED_ITEM::GetNetClass().

Referenced by ZONE::GetMsgPanelInfo().

◆ GetNetClassName()

wxString ZONE::GetNetClassName ( ) const
inlineoverridevirtualinherited

Returns the netclass of the zone.

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

Returns
the net class name of this item.

Reimplemented from BOARD_CONNECTED_ITEM.

Definition at line 95 of file zone.h.

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

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

◆ GetNetCode()

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

Definition at line 100 of file board_connected_item.cpp.

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

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

Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), BOARD_CONNECTED_ITEM_DESC::BOARD_CONNECTED_ITEM_DESC(), ZONE_FILLER::buildCopperItemClearances(), connectedItemFilter(), CreateRoutesSection(), KIGFX::PCB_PAINTER::draw(), DRAWING_TOOL::DrawVia(), PCB_EDIT_FRAME::ExchangeFootprint(), ZONE_FILLER::Fill(), PNS::NODE::FindItemByParent(), PCB_IO::format(), DSN::SPECCTRA_DB::FromBOARD(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), CONNECTIVITY_DATA::GetConnectedItems(), ZONE::GetInteractingZones(), PCB_TRACK::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), hasThermalConnection(), BOARD_INSPECTION_TOOL::highlightNet(), DIALOG_PAD_PROPERTIES::initValues(), BOARD_INSPECTION_TOOL::InspectClearance(), CONNECTIVITY_DATA::IsConnectedOnLayer(), ZONE::IsIsland(), ZONE::IsSame(), ZONE_FILLER::knockoutThermalReliefs(), AR_AUTOPLACER::nearestPad(), ROUTER_TOOL::NeighboringSegmentFilter(), CN_ITEM::Net(), BOARD::NormalizeAreaPolygon(), PCB_TRACK::cmp_tracks::operator()(), ZONE_SETTINGS::operator<<(), DIALOG_PAD_PROPERTIES::PadTypeSelected(), process(), BOARD_EDITOR_CONTROL::RepairBoard(), PCB_SELECTION_CONDITIONS::sameNetFunc(), SaveCopyOfZones(), PCB_SELECTION_TOOL::selectNet(), ZONE_FILLER::subtractHigherPriorityZones(), PNS_KICAD_IFACE_BASE::syncArc(), PNS_KICAD_IFACE_BASE::syncPad(), PNS_KICAD_IFACE_BASE::syncTrack(), PNS_KICAD_IFACE_BASE::syncVia(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZonesToZones(), BOARD::TracksInNet(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), and BOARD_EDITOR_CONTROL::ZoneMerge().

◆ GetNetname()

◆ GetNetnameMsg()

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

Definition at line 132 of file board_connected_item.cpp.

133 {
134  if( !GetBoard() )
135  return wxT( "[** NO BOARD DEFINED **]" );
136 
137  wxString netname = GetNetname();
138 
139  if( !netname.length() )
140  return wxT( "[<no net>]" );
141  else if( GetNetCode() < 0 )
142  return wxT( "[" + UnescapeString( netname ) + "](" + _( "Not Found" ) + ")" );
143  else
144  return wxT( "[" + UnescapeString( netname ) + "]" );
145 }
#define _(s)
wxString UnescapeString(const wxString &aSource)
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:50

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

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

◆ GetNumCorners()

int ZONE::GetNumCorners ( void  ) const
inlineinherited

Access to m_Poly parameters.

Definition at line 523 of file zone.h.

524  {
525  return m_Poly->TotalVertices();
526  }
int TotalVertices() const
Delete aIdx-th polygon from the set.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:823

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

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

◆ GetOwnClearance()

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

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

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

Definition at line 77 of file board_connected_item.cpp.

78 {
79  DRC_CONSTRAINT constraint;
80 
81  if( GetBoard() && GetBoard()->GetDesignSettings().m_DRCEngine )
82  {
84 
85  constraint = bds.m_DRCEngine->EvalRules( CLEARANCE_CONSTRAINT, this, nullptr, aLayer );
86  }
87 
88  if( constraint.Value().HasMin() )
89  {
90  if( aSource )
91  *aSource = constraint.GetName();
92 
93  return constraint.Value().Min();
94  }
95 
96  return 0;
97 }
bool HasMin() const
Definition: minoptmax.h:37
MINOPTMAX< int > & Value()
Definition: drc_rule.h:123
T Min() const
Definition: minoptmax.h:33
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:589
wxString GetName() const
Definition: drc_rule.h:130
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:50
std::shared_ptr< DRC_ENGINE > m_DRCEngine
Container for design settings for a BOARD object.

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

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

◆ GetPadConnection() [1/2]

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

Definition at line 774 of file zone.cpp.

775 {
776  if( aPad == nullptr || aPad->GetEffectiveZoneConnection() == ZONE_CONNECTION::INHERITED )
777  {
778  if( aSource )
779  *aSource = _( "zone" );
780 
781  return m_PadConnection;
782  }
783  else
784  {
785  return aPad->GetEffectiveZoneConnection( aSource );
786  }
787 }
ZONE_CONNECTION m_PadConnection
Definition: zone.h:852
ZONE_CONNECTION GetEffectiveZoneConnection(wxString *aSource=nullptr) const
Return the zone connection in effect (either locally overridden or overridden in the parent footprint...
Definition: pad.cpp:806
#define _(s)

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

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

◆ GetPadConnection() [2/2]

ZONE_CONNECTION ZONE::GetPadConnection ( ) const
inlineinherited

Definition at line 241 of file zone.h.

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

References ZONE::m_PadConnection.

Referenced by ZONE_DESC::ZONE_DESC().

◆ GetParent()

BOARD_ITEM_CONTAINER* BOARD_ITEM::GetParent ( void  ) const
inlineinherited

Definition at line 166 of file board_item.h.

166 { return (BOARD_ITEM_CONTAINER*) m_parent; }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:479
Abstract interface for BOARD_ITEMs capable of storing other items inside.

References EDA_ITEM::m_parent.

Referenced by PCB_POINT_EDITOR::addCorner(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), PNS_KICAD_IFACE::Commit(), EDIT_TOOL::copyToClipboard(), FOOTPRINT::CoverageRatio(), BOARD_ITEM::DeleteStructure(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::Drag(), EDIT_TOOL::DragArcTrack(), KIGFX::PCB_PAINTER::draw(), EDIT_TOOL::Duplicate(), PCB_SELECTION_TOOL::FilterCollectorForHierarchy(), PCB_IO::format(), FormatProbeItem(), BOARD_ITEM::GetBoard(), PCB_MARKER::GetColorLayer(), ALIGN_DISTRIBUTE_TOOL::GetSelections(), FP_TEXT::GetSelectMenuText(), PCB_TEXT::GetShownText(), FP_TEXT::GetShownText(), getTopLevelGroup(), GENERAL_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), isInsideArea(), DRC_ENGINE::IsNetTie(), FP_SHAPE::IsParentFlipped(), FP_TEXT::IsParentFlipped(), LEGACY_PLUGIN::loadMODULE_TEXT(), memberOf(), EDIT_TOOL::MoveExact(), ALTIUM_PCB::ParseTexts6Data(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), POSITION_RELATIVE_TOOL::PositionRelative(), BOARD_COMMIT::Push(), DRC_TEST_PROVIDER_SILK_CLEARANCE::Run(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), CLIPBOARD_IO::SaveSelection(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::Selectable(), SwapItemData(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), PCB_MARKER::ViewGetLayers(), ViewGetLOD(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ GetParentGroup()

◆ GetPosition()

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

Reimplemented from EDA_ITEM.

Definition at line 212 of file zone.cpp.

213 {
214  return (wxPoint) GetCornerPosition( 0 );
215 }
const VECTOR2I & GetCornerPosition(int aCornerIndex) const
Definition: zone.h:563

References ZONE::GetCornerPosition().

Referenced by EAGLE_PLUGIN::loadPlain().

◆ GetPriority()

◆ GetSelectedCorner()

int ZONE::GetSelectedCorner ( ) const
inlineinherited

Definition at line 274 of file zone.h.

275  {
276  // Transform relative indices to global index
277  int globalIndex = -1;
278 
279  if( m_CornerSelection )
280  m_Poly->GetGlobalIndex( *m_CornerSelection, globalIndex );
281 
282  return globalIndex;
283  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:823
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: zone.h:899
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.

◆ GetSelectMenuText()

wxString ZONE::GetSelectMenuText ( EDA_UNITS  aUnits) const
overridevirtualinherited

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

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

Returns
The menu text string.

Reimplemented from EDA_ITEM.

Definition at line 856 of file zone.cpp.

857 {
858  wxString layerDesc;
859  int count = 0;
860 
861  for( PCB_LAYER_ID layer : m_layerSet.Seq() )
862  {
863  if( count == 0 )
864  layerDesc = GetBoard()->GetLayerName( layer );
865 
866  count++;
867  }
868 
869  if( count > 1 )
870  layerDesc.Printf( _( "%s and %d more" ), layerDesc, count - 1 );
871 
872  // Check whether the selected contour is a hole (contour index > 0)
873  if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
874  {
875  if( GetIsRuleArea() )
876  return wxString::Format( _( "Rule Area Cutout on %s" ), layerDesc );
877  else
878  return wxString::Format( _( "Zone Cutout on %s" ), layerDesc );
879  }
880  else
881  {
882  if( GetIsRuleArea() )
883  return wxString::Format( _( "Rule Area on %s" ), layerDesc );
884  else
885  return wxString::Format( _( "Zone %s on %s" ), GetNetnameMsg(), layerDesc );
886  }
887 }
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:361
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:733
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:411
LSET m_layerSet
Definition: zone.h:830
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: zone.h:899
#define _(s)
wxString GetNetnameMsg() const
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:64
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:50

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

◆ GetShortNetname()

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

Definition at line 148 of file board_connected_item.cpp.

149 {
150  return m_netinfo->GetShortNetname();
151 }
const wxString & GetShortNetname() const
Definition: netinfo.h:124
NETINFO_ITEM * m_netinfo
Store all information about the net that item belongs to.

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

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

◆ GetState()

int EDA_ITEM::GetState ( EDA_ITEM_FLAGS  type) const
inlineinherited

Definition at line 137 of file eda_item.h.

138  {
139  return m_status & type;
140  }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:478

References EDA_ITEM::m_status.

Referenced by BOARD_ITEM::IsLocked().

◆ GetStatus()

EDA_ITEM_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 150 of file eda_item.h.

150 { return m_status; }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:478

References EDA_ITEM::m_status.

◆ GetThermalReliefGap() [1/2]

◆ GetThermalReliefGap() [2/2]

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

Definition at line 332 of file zone.cpp.

333 {
334  if( aPad->GetEffectiveThermalGap() == 0 )
335  {
336  if( aSource )
337  *aSource = _( "zone" );
338 
339  return m_thermalReliefGap;
340  }
341 
342  return aPad->GetEffectiveThermalGap( aSource );
343 
344 }
int GetEffectiveThermalGap(wxString *aSource=nullptr) const
Return the effective thermal gap having resolved any inheritance.
Definition: pad.cpp:846
int m_thermalReliefGap
Definition: zone.h:875
#define _(s)

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

◆ GetThermalReliefSpokeWidth() [1/2]

int ZONE::GetThermalReliefSpokeWidth ( ) const
inlineinherited

◆ GetThermalReliefSpokeWidth() [2/2]

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

Definition at line 347 of file zone.cpp.

348 {
349  if( aPad->GetEffectiveThermalSpokeWidth() == 0 )
350  {
351  if( aSource )
352  *aSource = _( "zone" );
353 
355  }
356 
357  return aPad->GetEffectiveThermalSpokeWidth( aSource );
358 }
int GetEffectiveThermalSpokeWidth(wxString *aSource=nullptr) const
Return the effective thermal spoke width having resolved any inheritance.
Definition: pad.cpp:827
#define _(s)
int m_thermalReliefSpokeWidth
Definition: zone.h:876

References _, PAD::GetEffectiveThermalSpokeWidth(), and ZONE::m_thermalReliefSpokeWidth.

◆ GetX()

int BOARD_ITEM::GetX ( ) const
inlineinherited

◆ GetY()

int BOARD_ITEM::GetY ( ) const
inlineinherited

◆ GetZoneName()

wxString ZONE::GetZoneName ( ) const
inlineinherited

Definition at line 129 of file zone.h.

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

References ZONE::m_zoneName.

Referenced by PCB_IO::format(), PNS::ROUTER::isStartingPointRoutable(), ZONE::Matches(), ZONE_SETTINGS::operator<<(), PNS_KICAD_IFACE_BASE::syncZone(), and ZONE_DESC::ZONE_DESC().

◆ HasFilledPolysForLayer()

bool ZONE::HasFilledPolysForLayer ( PCB_LAYER_ID  aLayer) const
inlineinherited

Definition at line 627 of file zone.h.

628  {
629  return m_FilledPolysList.count( aLayer ) > 0;
630  }
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:917

References ZONE::m_FilledPolysList.

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

◆ HasFlag()

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

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

References SEG::A, SEG::B, SHAPE_POLY_SET::CVertex(), DIAGONAL_EDGE, DIAGONAL_FULL, ZONE::GetLayer(), 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, MAXPTS, NO_HATCH, sortEndsByDescendingX(), ZONE::UnHatchBorder(), VECTOR2< T >::x, and VECTOR2< T >::y.

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

◆ HitTest() [1/2]

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

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

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

Reimplemented from EDA_ITEM.

Definition at line 400 of file zone.cpp.

401 {
402  // When looking for an "exact" hit aAccuracy will be 0 which works poorly for very thin
403  // lines. Give it a floor.
404  int accuracy = std::max( aAccuracy, Millimeter2iu( 0.1 ) );
405 
406  return HitTestForCorner( aPosition, accuracy * 2 ) || HitTestForEdge( aPosition, accuracy );
407 }
bool HitTestForCorner(const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
Test if the given wxPoint is near a corner.
Definition: zone.cpp:425
bool HitTestForEdge(const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
Test if the given wxPoint is near a segment defined by 2 corners.
Definition: zone.cpp:439
static constexpr int Millimeter2iu(double mm)

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

◆ HitTest() [2/2]

bool ZONE::HitTest ( const EDA_RECT aRect,
bool  aContained = true,
int  aAccuracy = 0 
) const
overridevirtualinherited

Parameters
aRectA reference to a EDA_RECT object containing the rectangle to test.
aContainedSet to true to test for containment instead of an intersection.
aAccuracyIncrease aRect by this amount.
Returns
True if aRect contains or intersects the item bounding box.

Reimplemented from EDA_ITEM.

Definition at line 453 of file zone.cpp.

454 {
455  // Calculate bounding box for zone
456  EDA_RECT bbox = GetBoundingBox();
457  bbox.Normalize();
458 
459  EDA_RECT arect = aRect;
460  arect.Normalize();
461  arect.Inflate( aAccuracy );
462 
463  if( aContained )
464  {
465  return arect.Contains( bbox );
466  }
467  else
468  {
469  // Fast test: if aBox is outside the polygon bounding box, rectangles cannot intersect
470  if( !arect.Intersects( bbox ) )
471  return false;
472 
473  int count = m_Poly->TotalVertices();
474 
475  for( int ii = 0; ii < count; ii++ )
476  {
477  auto vertex = m_Poly->CVertex( ii );
478  auto vertexNext = m_Poly->CVertex( ( ii + 1 ) % count );
479 
480  // Test if the point is within the rect
481  if( arect.Contains( ( wxPoint ) vertex ) )
482  return true;
483 
484  // Test if this edge intersects the rect
485  if( arect.Intersects( ( wxPoint ) vertex, ( wxPoint ) vertexNext ) )
486  return true;
487  }
488 
489  return false;
490  }
491 }
int TotalVertices() const
Delete aIdx-th polygon from the set.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:823
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the aGlobalIndex-th vertex in the poly set.
bool Contains(const wxPoint &aPoint) const
Definition: eda_rect.cpp:57
const EDA_RECT GetBoundingBox() const override
Definition: zone.cpp:322
void Normalize()
Ensures that the height ant width are positive.
Definition: eda_rect.cpp:35
Handle the component boundary box.
Definition: eda_rect.h:42
bool Intersects(const EDA_RECT &aRect) const
Test for a common area between rectangles.
Definition: eda_rect.cpp:150
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:364

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

◆ HitTestCutout() [1/2]

bool ZONE::HitTestCutout ( const VECTOR2I aRefPos,
int *  aOutlineIdx = nullptr,
int *  aHoleIdx = nullptr 
) const
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 521 of file zone.cpp.

522 {
523  // Iterate over each outline polygon in the zone and then iterate over
524  // each hole it has to see if the point is in it.
525  for( int i = 0; i < m_Poly->OutlineCount(); i++ )
526  {
527  for( int j = 0; j < m_Poly->HoleCount( i ); j++ )
528  {
529  if( m_Poly->Hole( i, j ).PointInside( aRefPos ) )
530  {
531  if( aOutlineIdx )
532  *aOutlineIdx = i;
533 
534  if( aHoleIdx )
535  *aHoleIdx = j;
536 
537  return true;
538  }
539  }
540  }
541 
542  return false;
543 }
int OutlineCount() const
Return the number of vertices in a given outline/hole.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:823
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Return the aIndex-th subpolygon in the set.
bool PointInside(const VECTOR2I &aPt, int aAccuracy=0, bool aUseBBoxCache=false) const
Check if point aP lies inside a polygon (any type) defined by the line chain.
int HoleCount(int aOutline) const
Return the reference to aIndex-th outline in the set.

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

Referenced by ZONE::HitTestCutout(), and EDIT_TOOL::Remove().

◆ HitTestCutout() [2/2]

bool ZONE::HitTestCutout ( const wxPoint &  aRefPos,
int *  aOutlineIdx = nullptr,
int *  aHoleIdx = nullptr 
) const
inlineinherited

Definition at line 358 of file zone.h.

360  {
361  return HitTestCutout( VECTOR2I( aRefPos.x, aRefPos.y ), aOutlineIdx, aHoleIdx );
362  }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
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.
Definition: zone.cpp:521

References ZONE::HitTestCutout().

◆ HitTestFilledArea()

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

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

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

Definition at line 506 of file zone.cpp.

507 {
508  // Rule areas have no filled area, but it's generally nice to treat their interior as if it were
509  // filled so that people don't have to select them by their outline (which is min-width)
510  if( GetIsRuleArea() )
511  return m_Poly->Contains( VECTOR2I( aRefPos.x, aRefPos.y ), -1, aAccuracy );
512 
513  if( !m_FilledPolysList.count( aLayer ) )
514  return false;
515 
516  return m_FilledPolysList.at( aLayer ).Contains( VECTOR2I( aRefPos.x, aRefPos.y ), -1,
517  aAccuracy );
518 }
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:733
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:823
bool Contains(const VECTOR2I &aP, int aSubpolyIndex=-1, int aAccuracy=0, bool aUseBBoxCaches=false) const
Return true if a given subpolygon contains the point aP.
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:917

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

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

Test if the given wxPoint is near a corner.

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

Definition at line 425 of file zone.cpp.

427 {
428  return m_Poly->CollideVertex( VECTOR2I( refPos ), aCornerHit, aAccuracy );
429 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:823
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
bool CollideVertex(const VECTOR2I &aPoint, VERTEX_INDEX &aClosestVertex, int aClearance=0) const
Check whether aPoint collides with any vertex of any of the contours of the polygon.

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

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

◆ HitTestForCorner() [2/2]

bool ZONE::HitTestForCorner ( const wxPoint &  refPos,
int  aAccuracy 
) const
inherited

Test if the given wxPoint is near a corner.

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

Definition at line 432 of file zone.cpp.

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

References dummy(), and ZONE::HitTestForCorner().

Referenced by ZONE::HitTestForCorner().

◆ HitTestForEdge() [1/2]

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

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

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

Definition at line 439 of file zone.cpp.

441 {
442  return m_Poly->CollideEdge( VECTOR2I( refPos ), aCornerHit, aAccuracy );
443 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:823
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
bool CollideEdge(const VECTOR2I &aPoint, VERTEX_INDEX &aClosestVertex, int aClearance=0) const
Check whether aPoint collides with any edge of any of the contours of the polygon.

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

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

◆ HitTestForEdge() [2/2]

bool ZONE::HitTestForEdge ( const wxPoint &  refPos,
int  aAccuracy 
) const
inherited

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

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

Definition at line 446 of file zone.cpp.

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

References dummy(), and ZONE::HitTestForEdge().

◆ InitDataFromSrcInCopyCtor()

void ZONE::InitDataFromSrcInCopyCtor ( const ZONE aZone)
inherited

Copy aZone data to me.

Definition at line 107 of file zone.cpp.

108 {
109  // members are expected non initialize in this.
110  // InitDataFromSrcInCopyCtor() is expected to be called
111  // 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;
125  m_isRuleArea = aZone.m_isRuleArea;
126  SetLayerSet( aZone.GetLayerSet() );
127 
133 
135  m_ZoneClearance = aZone.m_ZoneClearance; // clearance value
140 
141  m_isFilled = aZone.m_isFilled;
142  m_needRefill = aZone.m_needRefill;
143 
146 
147  m_fillMode = aZone.m_fillMode; // solid vs. hatched
149  m_hatchGap = aZone.m_hatchGap;
155 
156  // For corner moving, corner index to drag, or nullptr if no selection
157  delete m_CornerSelection;
158  m_CornerSelection = nullptr;
159 
160  for( PCB_LAYER_ID layer : aZone.GetLayerSet().Seq() )
161  {
162  m_FilledPolysList[layer] = aZone.m_FilledPolysList.at( layer );
163  m_RawPolysList[layer] = aZone.m_RawPolysList.at( layer );
164  m_filledPolysHash[layer] = aZone.m_filledPolysHash.at( layer );
165  m_FillSegmList[layer] = aZone.m_FillSegmList.at( layer ); // vector <> copy
166  m_insulatedIslands[layer] = aZone.m_insulatedIslands.at( layer );
167  }
168 
172 
173  SetLocalFlags( aZone.GetLocalFlags() );
174 
175  m_netinfo = aZone.m_netinfo;
176 
177  m_hv45 = aZone.m_hv45;
178  m_area = aZone.m_area;
179 }
ZONE_BORDER_DISPLAY_STYLE m_borderStyle
Definition: zone.h:927
bool m_doNotAllowFootprints
Definition: zone.h:850
unsigned int m_cornerRadius
Definition: zone.h:825
ZONE_FILL_MODE m_fillMode
How to fill areas:
Definition: zone.h:885
int m_ZoneClearance
Definition: zone.h:853
int m_cornerSmoothingType
Definition: zone.h:824
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:823
wxString m_zoneName
An optional unique name for this zone, used for identifying it in DRC checking.
Definition: zone.h:828
int m_hatchSmoothingLevel
Definition: zone.h:889
void SetLayerSet(LSET aLayerSet) override
Definition: zone.cpp:246
ZONE_CONNECTION m_PadConnection
Definition: zone.h:852
double m_area
Definition: zone.h:936
bool m_doNotAllowTracks
Definition: zone.h:848
long long int m_minIslandArea
When island removal mode is set to AREA, islands below this area will be removed.
Definition: zone.h:863
double m_hatchOrientation
Definition: zone.h:888
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: zone.cpp:291
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:932
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:411
int m_hatchThickness
Definition: zone.h:886
bool m_doNotAllowVias
Definition: zone.h:847
Represent a set of closed polygons.
int GetLocalFlags() const
Definition: zone.h:305
int m_thermalReliefGap
Definition: zone.h:875
bool m_hv45
Definition: zone.h:934
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: zone.h:899
ISLAND_REMOVAL_MODE m_islandRemovalMode
Definition: zone.h:857
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:925
int m_ZoneMinThickness
Definition: zone.h:854
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_RawPolysList
Definition: zone.h:918
bool m_isRuleArea
Definition: zone.h:841
std::map< PCB_LAYER_ID, std::vector< SEG > > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: zone.h:907
int m_borderHatchPitch
Definition: zone.h:928
std::vector< SEG > m_borderHatchLines
Definition: zone.h:929
void SetLocalFlags(int aFlags)
Definition: zone.h:306
int m_hatchBorderAlgorithm
Definition: zone.h:895
bool m_isFilled
True when a zone was filled, false after deleting the filled areas.
Definition: zone.h:866
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:64
NETINFO_ITEM * m_netinfo
Store all information about the net that item belongs to.
int m_hatchGap
Definition: zone.h:887
bool m_doNotAllowCopperPour
Definition: zone.h:846
int m_fillVersion
Definition: zone.h:855
double m_hatchHoleMinArea
Definition: zone.h:894
bool m_needRefill
False when a zone was refilled, true after changes in zone params.
Definition: zone.h:873
bool m_forceVisible
Definition: eda_item.h:480
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:917
unsigned m_priority
Definition: zone.h:836
double m_hatchSmoothingValue
Definition: zone.h:893
int m_thermalReliefSpokeWidth
Definition: zone.h:876
bool m_doNotAllowPads
Definition: zone.h:849

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_FillSegmList, 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_hv45, 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_PadConnection, ZONE::m_Poly, ZONE::m_priority, ZONE::m_RawPolysList, 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()

◆ 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  }
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:733

References ZONE::GetIsRuleArea().

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 121 of file eda_item.h.

121 { return m_flags & IS_DRAGGING; }
#define IS_DRAGGING
Item being dragged.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481

References IS_DRAGGING, and EDA_ITEM::m_flags.

Referenced by DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES().

◆ IsEntered()

bool EDA_ITEM::IsEntered ( ) const
inlineinherited

Definition at line 124 of file eda_item.h.

124 { return m_flags & ENTERED; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481
#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

Definition at line 234 of file zone.h.

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

References ZONE::m_isFilled.

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

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 206 of file eda_item.h.

206 { return m_forceVisible; }
bool m_forceVisible
Definition: eda_item.h:480

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

1124 {
1125  if( GetNetCode() < 1 )
1126  return true;
1127 
1128  if( !m_insulatedIslands.count( aLayer ) )
1129  return false;
1130 
1131  return m_insulatedIslands.at( aLayer ).count( aPolyIdx );
1132 }
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:932

References BOARD_CONNECTED_ITEM::GetNetCode(), and ZONE::m_insulatedIslands.

Referenced by PCB_IO::format().

◆ IsKeepout()

bool ZONE::IsKeepout ( ) const
inherited

Definition at line 1312 of file zone.cpp.

1313 {
1316 }
bool m_doNotAllowFootprints
Definition: zone.h:850
bool m_doNotAllowTracks
Definition: zone.h:848
bool m_doNotAllowVias
Definition: zone.h:847
bool m_doNotAllowCopperPour
Definition: zone.h:846
bool m_doNotAllowPads
Definition: zone.h:849

References ZONE::m_doNotAllowCopperPour, ZONE::m_doNotAllowFootprints, ZONE::m_doNotAllowPads, ZONE::m_doNotAllowTracks, and ZONE::m_doNotAllowVias.

◆ IsLocked()

bool BOARD_ITEM::IsLocked ( ) const
virtualinherited
Returns
true if the object is locked, else false.

Reimplemented in FOOTPRINT, and PAD.

Definition at line 78 of file board_item.cpp.

79 {
80  if( GetParentGroup() )
81  return GetParentGroup()->IsLocked();
82 
83  return GetState( LOCKED );
84 }
PCB_GROUP * GetParentGroup() const
Definition: board_item.h:91
virtual bool IsLocked() const
Definition: board_item.cpp:78
#define LOCKED
Pcbnew: locked from movement and deletion.
int GetState(EDA_ITEM_FLAGS type) const
Definition: eda_item.h:137

References BOARD_ITEM::GetParentGroup(), EDA_ITEM::GetState(), BOARD_ITEM::IsLocked(), and LOCKED.

Referenced by BOARD_ITEM_DESC::BOARD_ITEM_DESC(), PCB_CONTROL::DeleteItemCursor(), DIALOG_GROUP_PROPERTIES::DIALOG_GROUP_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), EDIT_TOOL::FilletTracks(), PCB_IO::format(), PCB_TEXT::GetMsgPanelInfo(), ZONE::GetMsgPanelInfo(), FP_TEXT::GetMsgPanelInfo(), PCB_GROUP::GetMsgPanelInfo(), PCB_DIMENSION_BASE::GetMsgPanelInfo(), PCB_SHAPE::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfoBase_Common(), ALIGN_DISTRIBUTE_TOOL::GetSelections(), ROUTER_TOOL::InlineDrag(), GENERAL_COLLECTOR::Inspect(), PAD::IsLocked(), BOARD_ITEM::IsLocked(), PCB_SELECTION_TOOL::itemPassesFilter(), CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromShapes(), TRACKS_CLEANER::mergeCollinearSegments(), BOARD_EDITOR_CONTROL::modifyLockSelected(), PCB_POINT_EDITOR::OnSelectionChange(), ZONE_SETTINGS::operator<<(), POSITION_RELATIVE_TOOL::PositionRelative(), processTextItem(), PCB_SELECTION_TOOL::RequestSelection(), PNS_KICAD_IFACE_BASE::syncArc(), PNS_KICAD_IFACE_BASE::syncTrack(), PNS_KICAD_IFACE_BASE::syncVia(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), and DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow().

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 118 of file eda_item.h.

118 { return m_flags & IS_CHANGED; }
#define IS_CHANGED
Item was edited, and modified.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481

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

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

References LSET::AllCuMask(), and ZONE::m_layerSet.

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

◆ IsOnLayer()

bool ZONE::IsOnLayer ( PCB_LAYER_ID  aLayer) 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 316 of file zone.cpp.

317 {
318  return m_layerSet.test( aLayer );
319 }
LSET m_layerSet
Definition: zone.h:830

References ZONE::m_layerSet.

Referenced by KIGFX::PCB_PAINTER::draw(), DSN::SPECCTRA_DB::FromBOARD(), BOARD_INSPECTION_TOOL::InspectClearance(), 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 SCH_SYMBOL, SCH_SHEET, SCH_LABEL, SCH_TEXT, SCH_FIELD, and SCH_SHEET_PIN.

Definition at line 403 of file eda_item.h.

403 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 125 of file eda_item.h.

125 { return m_flags & IS_RESIZING; }
#define IS_RESIZING
Item being resized.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481

References IS_RESIZING, and EDA_ITEM::m_flags.

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

61 {
62  // compare basic parameters:
63  if( GetLayerSet() != aZoneToCompare.GetLayerSet() )
64  return false;
65 
66  if( GetNetCode() != aZoneToCompare.GetNetCode() )
67  return false;
68 
69  if( GetPriority() != aZoneToCompare.GetPriority() )
70  return false;
71 
72  // Compare zone specific parameters
73  if( GetIsRuleArea() != aZoneToCompare.GetIsRuleArea() )
74  return false;
75 
76  if( GetIsRuleArea() )
77  {
78  if( GetDoNotAllowCopperPour() != aZoneToCompare.GetDoNotAllowCopperPour() )
79  return false;
80 
81  if( GetDoNotAllowVias() != aZoneToCompare.GetDoNotAllowVias() )
82  return false;
83 
84  if( GetDoNotAllowTracks() != aZoneToCompare.GetDoNotAllowTracks() )
85  return false;
86 
87  if( GetDoNotAllowPads() != aZoneToCompare.GetDoNotAllowPads() )
88  return false;
89 
90  if( GetDoNotAllowFootprints() != aZoneToCompare.GetDoNotAllowFootprints() )
91  return false;
92  }
93 
94  if( m_ZoneClearance != aZoneToCompare.m_ZoneClearance )
95  return false;
96 
97  if( m_ZoneMinThickness != aZoneToCompare.GetMinThickness() )
98  return false;
99 
100  if( m_fillMode != aZoneToCompare.GetFillMode() )
101  return false;
102 
103  if( m_PadConnection != aZoneToCompare.m_PadConnection )
104  return false;
105 
106  if( m_thermalReliefGap != aZoneToCompare.m_thermalReliefGap )
107  return false;
108 
110  return false;
111 
112  if( m_zoneName != aZoneToCompare.m_zoneName )
113  return false;
114 
115  if( m_islandRemovalMode != aZoneToCompare.m_islandRemovalMode )
116  return false;
117 
118  if( m_minIslandArea != aZoneToCompare.m_minIslandArea )
119  return false;
120 
121 
122  // Compare outlines
123  wxASSERT( m_Poly ); // m_Poly == NULL Should never happen
124  wxASSERT( aZoneToCompare.Outline() );
125 
126  if( Outline() != aZoneToCompare.Outline() ) // Compare vector
127  return false;
128 
129  return true;
130 }
bool GetDoNotAllowFootprints() const
Definition: zone.h:738
ZONE_FILL_MODE m_fillMode
How to fill areas:
Definition: zone.h:885
int m_ZoneClearance
Definition: zone.h:853
unsigned GetPriority() const
Definition: zone.h:122
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:733
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:823
wxString m_zoneName
An optional unique name for this zone, used for identifying it in DRC checking.
Definition: zone.h:828
ZONE_CONNECTION m_PadConnection
Definition: zone.h:852
SHAPE_POLY_SET * Outline()
Definition: zone.h:320
bool GetDoNotAllowVias() const
Definition: zone.h:735
long long int m_minIslandArea
When island removal mode is set to AREA, islands below this area will be removed.
Definition: zone.h:863
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: zone.cpp:291
ZONE_FILL_MODE GetFillMode() const
Definition: zone.h:181
bool GetDoNotAllowPads() const
Definition: zone.h:737
bool GetDoNotAllowCopperPour() const
Definition: zone.h:734
int GetMinThickness() const
Definition: zone.h:244
bool GetDoNotAllowTracks() const
Definition: zone.h:736
int m_thermalReliefGap
Definition: zone.h:875
ISLAND_REMOVAL_MODE m_islandRemovalMode
Definition: zone.h:857
int m_ZoneMinThickness
Definition: zone.h:854
int m_thermalReliefSpokeWidth
Definition: zone.h:876

References ZONE::GetDoNotAllowCopperPour(), ZONE::GetDoNotAllowFootprints(), ZONE::GetDoNotAllowPads(), ZONE::GetDoNotAllowTracks(), ZONE::GetDoNotAllowVias(), ZONE::GetFillMode(), ZONE::GetIsRuleArea(), ZONE::GetLayerSet(), ZONE::GetMinThickness(), BOARD_CONNECTED_ITEM::GetNetCode(), ZONE::GetPriority(), 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 123 of file eda_item.h.

123 { return m_flags & SELECTED; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481
#define 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_FRAME::ConvertPart(), DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), DS_PROXY_UNDO_ITEM::DS_PROXY_UNDO_ITEM(), KIGFX::DS_RENDER_SETTINGS::GetColor(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), SCH_MOVE_TOOL::getConnectedDragItems(), KIGFX::SCH_PAINTER::getLineWidth(), KIGFX::SCH_PAINTER::getRenderColor(), KIGFX::SCH_PAINTER::getTextThickness(), DIALOG_EXCHANGE_FOOTPRINTS::isMatch(), DIALOG_CHANGE_SYMBOLS::isMatch(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), EE_SELECTION_TOOL::RebuildSelection(), RENDER_3D_LEGACY::renderFootprint(), SCH_EDIT_TOOL::Rotate(), EE_TOOL_BASE< SCH_BASE_FRAME >::saveCopyInUndoList(), SCH_EDIT_FRAME::SchematicCleanUp(), GERBVIEW_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), KIGFX::SCH_PAINTER::setDeviceColors(), GERBVIEW_SELECTION_TOOL::unselect(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ IsTrack()

bool BOARD_ITEM::IsTrack ( ) const
inlineinherited

Test to see if this object is a track or via (or microvia).

Returns
true if a track or via, else false.

Definition at line 239 of file board_item.h.

240  {
241  return ( Type() == PCB_TRACE_T ) || ( Type() == PCB_VIA_T );
242  }
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

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

◆ IsType()

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

Check whether the item is one of the listed types.

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

Reimplemented in PCB_VIA, SCH_LABEL, PCB_DIMENSION_BASE, PAD, SCH_FIELD, FP_TEXT, SCH_LINE, PCB_SHAPE, FP_SHAPE, and PCB_TEXT.

Definition at line 183 of file eda_item.h.

184  {
185  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
186  return true;
187 
188  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
189  {
190  if( m_structType == *p )
191  return true;
192  }
193 
194  return false;
195  }
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
KICAD_T m_structType
Run time identification, keep private so it can never be changed after a ctor sets it.
Definition: eda_item.h:488

References EOT, EDA_ITEM::m_structType, and SCH_LOCATE_ANY_T.

Referenced by ROUTER_TOOL::CanInlineDrag(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingBus(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLine(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingWire(), PCB_TEXT::IsType(), FP_SHAPE::IsType(), PCB_SHAPE::IsType(), SCH_LINE::IsType(), FP_TEXT::IsType(), SCH_FIELD::IsType(), PAD::IsType(), PCB_DIMENSION_BASE::IsType(), SCH_LABEL::IsType(), PCB_VIA::IsType(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), EE_SELECTION_TOOL::RequestSelection(), SCH_BASE_FRAME::UpdateItem(), EDA_ITEM::Visit(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 122 of file eda_item.h.

122 { return m_flags & IS_WIRE_IMAGE; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.

References IS_WIRE_IMAGE, and EDA_ITEM::m_flags.

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

534  {
535  return m_Poly->Iterate();
536  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:823
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 SEARCH_RESULT EDA_ITEM::IterateForward ( std::deque< T > &  aList,
INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
inlinestaticinherited

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

Definition at line 295 of file eda_item.h.

299  {
300  for( auto it : aList )
301  {
302  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
304  return SEARCH_RESULT::QUIT;
305  }
306 
308  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:93

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

Referenced by GERBER_FILE_IMAGE::Visit().

◆ IterateForward() [2/2]

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

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

Definition at line 314 of file eda_item.h.

316  {
317  for( auto it : aList )
318  {
319  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
321  return SEARCH_RESULT::QUIT;
322  }
323 
325  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:93

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

544  {
545  return m_Poly->IterateWithHoles();
546  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:823
ITERATOR IterateWithHoles(int aOutline)

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

Referenced by DSN::SPECCTRA_DB::FromBOARD(), and DSN::SPECCTRA_DB::makeIMAGE().

◆ KeepoutAll()

bool ZONE::KeepoutAll ( ) const
inherited

Definition at line 1319 of file zone.cpp.

1320 {
1323 }
bool m_doNotAllowFootprints
Definition: zone.h:850
bool m_doNotAllowTracks
Definition: zone.h:848
bool m_doNotAllowVias
Definition: zone.h:847
bool m_doNotAllowCopperPour
Definition: zone.h:846
bool m_doNotAllowPads
Definition: zone.h:849

References ZONE::m_doNotAllowCopperPour, ZONE::m_doNotAllowFootprints, ZONE::m_doNotAllowPads, ZONE::m_doNotAllowTracks, and ZONE::m_doNotAllowVias.

◆ layerMaskDescribe()

wxString BOARD_ITEM::layerMaskDescribe ( ) const
protectedvirtualinherited

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

The BOARD is needed because layer names are customizable.

Reimplemented in PCB_VIA.

Definition at line 99 of file board_item.cpp.

100 {
101  const BOARD* board = GetBoard();
102  LSET layers = GetLayerSet();
103 
104  // Try to be smart and useful. Check all copper first.
105  if( layers[F_Cu] && layers[B_Cu] )
106  return _( "all copper layers" );
107 
108  LSET copperLayers = layers & board->GetEnabledLayers().AllCuMask();
109  LSET techLayers = layers & board->GetEnabledLayers().AllTechMask();
110 
111  for( LSET testLayers : { copperLayers, techLayers, layers } )
112  {
113  for( int bit = PCBNEW_LAYER_ID_START; bit < PCB_LAYER_ID_COUNT; ++bit )
114  {
115  if( testLayers[ bit ] )
116  {
117  wxString layerInfo = board->GetLayerName( static_cast<PCB_LAYER_ID>( bit ) );
118 
119  if( testLayers.count() > 1 )
120  layerInfo << wxS( " " ) + _( "and others" );
121 
122  return layerInfo;
123  }
124  }
125  }
126 
127  // No copper, no technicals: no layer
128  return _( "no layers" );
129 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:750
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:361
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:466
static LSET AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
Definition: lset.cpp:820
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:502
#define _(s)
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
Definition: layer_ids.h:70
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:50
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
Definition: board_item.h:176

References _, LSET::AllCuMask(), LSET::AllTechMask(), B_Cu, F_Cu, BOARD_ITEM::GetBoard(), BOARD::GetEnabledLayers(), BOARD::GetLayerName(), BOARD_ITEM::GetLayerSet(), PCB_LAYER_ID_COUNT, and PCBNEW_LAYER_ID_START.

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

◆ Matches() [1/2]

bool ZONE::Matches ( const wxFindReplaceData &  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 132 of file zone.h.

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

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

Referenced by DIALOG_FIND::search().

◆ Matches() [2/2]

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

Compare aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

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

Definition at line 118 of file eda_item.cpp.

119 {
120  wxString text = aText;
121  wxString searchText = aSearchData.GetFindString();
122 
123  // Don't match if searching for replaceable item and the item doesn't support text replace.
124  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
125  return false;
126 
127  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
128  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
129 
130  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
131  {
132  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
133  return text.Matches( searchText );
134 
135  return text.MakeUpper().Matches( searchText.MakeUpper() );
136  }
137 
138  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
139  return aText.Find( searchText ) != wxNOT_FOUND;
140 
141  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
142 }
virtual bool IsReplaceable() const
Override this method in any derived object that supports test find and replace.
Definition: eda_item.h:403

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

◆ Mirror()

void ZONE::Mirror ( const wxPoint &  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 745 of file zone.cpp.

746 {
747  // ZONEs mirror about the x-axis (why?!?)
748  m_Poly->Mirror( aMirrorLeftRight, !aMirrorLeftRight, VECTOR2I( aMirrorRef ) );
749 
750  HatchBorder();
751 
752  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
753  pair.second.Mirror( aMirrorLeftRight, !aMirrorLeftRight, VECTOR2I( aMirrorRef ) );
754 
755  for( std::pair<const PCB_LAYER_ID, std::vector<SEG> >& pair : m_FillSegmList )
756  {
757  for( SEG& seg : pair.second )
758  {
759  if( aMirrorLeftRight )
760  {
761  MIRROR( seg.A.x, aMirrorRef.x );
762  MIRROR( seg.B.x, aMirrorRef.x );
763  }
764  else
765  {
766  MIRROR( seg.A.y, aMirrorRef.y );
767  MIRROR( seg.B.y, aMirrorRef.y );
768  }
769  }
770  }
771 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:823
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
void Mirror(bool aX=true, bool aY=false, const VECTOR2I &aRef={ 0, 0 })
Mirror the line points about y or x (or both)
void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
Definition: mirror.h:40
void HatchBorder()
Compute the hatch lines depending on the hatch parameters and stores it in the zone's attribute m_bor...
Definition: zone.cpp:927
std::map< PCB_LAYER_ID, std::vector< SEG > > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: zone.h:907
Definition: seg.h:40
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:64
VECTOR2I A
Definition: seg.h:48
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:917
VECTOR2I B
Definition: seg.h:49

References SEG::A, SEG::B, ZONE::HatchBorder(), ZONE::m_FilledPolysList, ZONE::m_FillSegmList, ZONE::m_Poly, MIRROR(), SHAPE_POLY_SET::Mirror(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by ZONE::Flip(), and EDIT_TOOL::Mirror().

◆ Move() [1/2]

void BOARD_ITEM::Move ( const VECTOR2I aMoveVector)
inlineinherited

Definition at line 278 of file board_item.h.

279  {
280  Move( wxPoint( aMoveVector.x, aMoveVector.y ) );
281  }
virtual void Move(const wxPoint &aMoveVector)
Move this object.
Definition: board_item.h:272

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

◆ Move() [2/2]

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

Move the outlines.

Parameters
offsetis moving vector

Reimplemented from BOARD_ITEM.

Definition at line 671 of file zone.cpp.

672 {
673  /* move outlines */
674  m_Poly->Move( offset );
675 
676  HatchBorder();
677 
678  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
679  pair.second.Move( offset );
680 
681  for( std::pair<const PCB_LAYER_ID, std::vector<SEG> >& pair : m_FillSegmList )
682  {
683  for( SEG& seg : pair.second )
684  {
685  seg.A += VECTOR2I( offset );
686  seg.B += VECTOR2I( offset );
687  }
688  }
689 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:823
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
void Move(const VECTOR2I &aVector) override
void HatchBorder()
Compute the hatch lines depending on the hatch parameters and stores it in the zone's attribute m_bor...
Definition: zone.cpp:927
std::map< PCB_LAYER_ID, std::vector< SEG > > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: zone.h:907
Definition: seg.h:40
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:64
VECTOR2I A
Definition: seg.h:48
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:917
VECTOR2I B
Definition: seg.h:49

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

◆ MoveEdge()

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

Move the outline Edge.

Parameters
offsetis moving vector
aEdgeis start point of the outline edge

Definition at line 692 of file zone.cpp.

693 {
694  int next_corner;
695 
696  if( m_Poly->GetNeighbourIndexes( aEdge, nullptr, &next_corner ) )
697  {
698  m_Poly->SetVertex( aEdge, m_Poly->CVertex( aEdge ) + VECTOR2I( offset ) );
699  m_Poly->SetVertex( next_corner, m_Poly->CVertex( next_corner ) + VECTOR2I( offset ) );
700  HatchBorder();
701 
702  SetNeedRefill( true );
703  }
704 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:823
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the aGlobalIndex-th vertex in the poly set.
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
bool GetNeighbourIndexes(int aGlobalIndex, int *aPrevious, int *aNext)
Return the global indexes of the previous and the next corner of the aGlobalIndex-th corner of a cont...
void SetVertex(const VERTEX_INDEX &aIndex, const VECTOR2I &aPos)
Accessor function to set the position of a specific point.
void HatchBorder()
Compute the hatch lines depending on the hatch parameters and stores it in the zone's attribute m_bor...
Definition: zone.cpp:927
void SetNeedRefill(bool aNeedRefill)
Definition: zone.h:238

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

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

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

598  {
599  m_Poly->NewHole();
600  }
int NewHole(int aOutline=-1)
Adds a new outline to the set and returns its index.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:823

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

172 {
173  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
174  GetClass() ) );
175 
176  return false;
177 }
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
virtual wxString GetClass() const =0
Return the class name.

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

◆ operator=()

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

Definition at line 1342 of file zone.cpp.

1343 {
1344  ZONE::operator=( aOther );
1345  return *this;
1346 }
ZONE & operator=(const ZONE &aOther)
Definition: zone.cpp:90

References ZONE::operator=().

◆ Outline() [1/2]

◆ Outline() [2/2]

const SHAPE_POLY_SET* ZONE::Outline ( ) const
inlineinherited

Definition at line 321 of file zone.h.

321 { return m_Poly; }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:823

References ZONE::m_Poly.

◆ RawPolysList()

SHAPE_POLY_SET& ZONE::RawPolysList ( PCB_LAYER_ID  aLayer)
inlineinherited

Definition at line 718 of file zone.h.

719  {
720  wxASSERT( m_RawPolysList.count( aLayer ) );
721  return m_RawPolysList.at( aLayer );
722  }
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_RawPolysList
Definition: zone.h:918

References ZONE::m_RawPolysList.

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

◆ RemoveAllContours()

void ZONE::RemoveAllContours ( void  )
inlineinherited

Definition at line 558 of file zone.h.

559  {
561  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:823

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

791 {
792  // Ensure the requested cutout is valid
793  if( m_Poly->OutlineCount() < aOutlineIdx || m_Poly->HoleCount( aOutlineIdx ) < aHoleIdx )
794  return;
795 
796  SHAPE_POLY_SET cutPoly( m_Poly->Hole( aOutlineIdx, aHoleIdx ) );
797 
798  // Add the cutout back to the zone
800 
801  SetNeedRefill( true );
802 }
int OutlineCount() const
Return the number of vertices in a given outline/hole.
void BooleanAdd(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset difference For aFastMode meaning, see function booleanOp.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:823
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Return the aIndex-th subpolygon in the set.
Represent a set of closed polygons.
int HoleCount(int aOutline) const
Return the reference to aIndex-th outline in the set.
void SetNeedRefill(bool aNeedRefill)
Definition: zone.h:238

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

◆ Replace() [1/2]

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

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

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

Definition at line 145 of file eda_item.cpp.

146 {
147  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
148 
149  int result = searchString.Find( ( aSearchData.GetFlags() & wxFR_MATCHCASE ) ?
150  aSearchData.GetFindString() :
151  aSearchData.GetFindString().Upper() );
152 
153  if( result == wxNOT_FOUND )
154  return false;
155 
156  wxString prefix = aText.Left( result );
157  wxString suffix;
158 
159  if( aSearchData.GetFindString().length() + result < aText.length() )
160  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
161 
162  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
163  aText, prefix, aSearchData.GetReplaceString(), suffix );
164 
165  aText = prefix + aSearchData.GetReplaceString() + suffix;
166 
167  return true;
168 }
const wxChar *const traceFindReplace
Flag to enable find and replace debug tracing.

References traceFindReplace.

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

◆ Replace() [2/2]

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

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

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

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

Reimplemented in SCH_TEXT, SCH_FIELD, SCH_SHEET_PIN, and SCH_PIN.

Definition at line 392 of file eda_item.h.

393  {
394  return false;
395  }

◆ Rotate() [1/2]

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

Definition at line 291 of file board_item.h.

292  {
293  Rotate( wxPoint( aRotCentre.x, aRotCentre.y ), aAngle );
294  }
virtual void Rotate(const wxPoint &aRotCentre, double aAngle)
Rotate this object.
Definition: board_item.cpp:191

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

◆ Rotate() [2/2]

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

Move the outlines.

Parameters
aCentreis rot centre
aAngleis in 0.1 degree

Reimplemented from BOARD_ITEM.

Definition at line 707 of file zone.cpp.

708 {
709  aAngle = -DECIDEG2RAD( aAngle );
710 
711  m_Poly->Rotate( aAngle, VECTOR2I( aCentre ) );
712  HatchBorder();
713 
714  /* rotate filled areas: */
715  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
716  pair.second.Rotate( aAngle, VECTOR2I( aCentre ) );
717 
718  for( std::pair<const PCB_LAYER_ID, std::vector<SEG> >& pair : m_FillSegmList )
719  {
720  for( SEG& seg : pair.second )
721  {
722  wxPoint a( seg.A );
723  RotatePoint( &a, aCentre, aAngle );
724  seg.A = a;
725  wxPoint b( seg.B );
726  RotatePoint( &b, aCentre, aAngle );
727  seg.B = a;
728  }
729  }
730 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:823
void Rotate(double aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Rotate all vertices by a given angle.
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:229
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
void HatchBorder()
Compute the hatch lines depending on the hatch parameters and stores it in the zone's attribute m_bor...
Definition: zone.cpp:927
std::map< PCB_LAYER_ID, std::vector< SEG > > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: zone.h:907
Definition: seg.h:40
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:64
VECTOR2I A
Definition: seg.h:48
double DECIDEG2RAD(double deg)
Definition: trigo.h:233
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:917
VECTOR2I B
Definition: seg.h:49

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

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

◆ Set() [1/3]

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

Definition at line 42 of file inspectable.h.

43  {
45  TYPE_ID thisType = TYPE_HASH( *this );
46  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
47 
48  if( object )
49  aProperty->setter( object, aValue );
50 
51  return object != nullptr;
52  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
virtual void setter(void *aObject, wxAny &aValue)=0
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

◆ Set() [2/3]

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

Definition at line 55 of file inspectable.h.

56  {
58  TYPE_ID thisType = TYPE_HASH( *this );
59  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
60 
61  if( object )
62  aProperty->set<T>( object, aValue );
63 
64  return object != nullptr;
65  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
void set(void *aObject, T aValue)
Definition: property.h:261
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

◆ Set() [3/3]

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

Definition at line 68 of file inspectable.h.

69  {
71  TYPE_ID thisType = TYPE_HASH( *this );
72  PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
73  void* object = nullptr;
74 
75  if( prop )
76  {
77  object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
78 
79  if( object )
80  prop->set<T>( object, aValue );
81  }
82 
83  return object != nullptr;
84  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
void set(void *aObject, T aValue)
Definition: property.h:261
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

◆ SetBorderDisplayStyle()

void ZONE::SetBorderDisplayStyle ( ZONE_BORDER_DISPLAY_STYLE  aHatchStyle,
int  aHatchPitch,
bool  aRebuildHatch 
)
inherited

Set all hatch parameters for the zone.

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

Definition at line 896 of file zone.cpp.

898 {
899  SetHatchPitch( aHatchPitch );
900  m_borderStyle = aHatchStyle;
901 
902  if( aRebuildHatch )
903  HatchBorder();
904 }
ZONE_BORDER_DISPLAY_STYLE m_borderStyle
Definition: zone.h:927
void HatchBorder()
Compute the hatch lines depending on the hatch parameters and stores it in the zone's attribute m_bor...
Definition: zone.cpp:927
void SetHatchPitch(int aPitch)
Set the hatch pitch parameter for the zone.
Definition: zone.cpp:907

References ZONE::HatchBorder(), ZONE::m_borderStyle, and ZONE::SetHatchPitch().

Referenced by PCAD2KICAD::PCB_POLYGON::AddToBoard(), ZONE_SETTINGS::ExportSetting(), EAGLE_PLUGIN::loadPlain(), EAGLE_PLUGIN::packageCircle(), EAGLE_PLUGIN::packagePolygon(), EAGLE_PLUGIN::packageRectangle(), ALTIUM_PCB::ParseArcs6Data(), ALTIUM_PCB::ParseFills6Data(), ALTIUM_PCB::ParsePolygons6Data(), ALTIUM_PCB::ParseShapeBasedRegions6Data(), and ALTIUM_PCB::ParseTracks6Data().

◆ SetBrightened()

◆ SetCornerPosition()

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

Definition at line 574 of file zone.h.

575  {
576  SHAPE_POLY_SET::VERTEX_INDEX relativeIndices;
577 
578  // Convert global to relative indices
579  if( m_Poly->GetRelativeIndices( aCornerIndex, &relativeIndices ) )
580  {
581  if( m_Poly->CVertex( relativeIndices ).x != new_pos.x
582  || m_Poly->CVertex( relativeIndices ).y != new_pos.y )
583  {
584  SetNeedRefill( true );
585  m_Poly->SetVertex( relativeIndices, new_pos );
586  }
587  }
588  else
589  {
590  throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
591  }
592  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:823
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...
void SetVertex(const VERTEX_INDEX &aIndex, const VECTOR2I &aPos)
Accessor function to set the position of a specific point.
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...
void SetNeedRefill(bool aNeedRefill)
Definition: zone.h:238

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

362 {
363  if( m_cornerRadius != aRadius )
364  SetNeedRefill( true );
365 
366  m_cornerRadius = aRadius;
367 }
unsigned int m_cornerRadius
Definition: zone.h:825
void SetNeedRefill(bool aNeedRefill)
Definition: zone.h:238

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

Referenced by ZONE_SETTINGS::ExportSetting().

◆ SetCornerSmoothingType()

void ZONE::SetCornerSmoothingType ( int  aType)
inlineinherited

Definition at line 681 of file zone.h.

681 { m_cornerSmoothingType = aType; };
int m_cornerSmoothingType
Definition: zone.h:824

References ZONE::m_cornerSmoothingType.

Referenced by ZONE_SETTINGS::ExportSetting().

◆ SetDoNotAllowCopperPour()

void ZONE::SetDoNotAllowCopperPour ( bool  aEnable)
inlineinherited

Definition at line 743 of file zone