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)
 
ZONE_SEGMENT_FILLFillSegments (PCB_LAYER_ID aLayer)
 
const ZONE_SEGMENT_FILLFillSegments (PCB_LAYER_ID aLayer) const
 
SHAPE_POLY_SETOutline ()
 
const SHAPE_POLY_SETOutline () const
 
void SetOutline (SHAPE_POLY_SET *aOutline)
 
virtual std::shared_ptr< SHAPEGetEffectiveShape (PCB_LAYER_ID aLayer=UNDEFINED_LAYER) const override
 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, 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 ZONE_SEGMENT_FILL &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 BOARDGetBoard () const
 Return the BOARD in which this BOARD_ITEM resides, or NULL if none. More...
 
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 (PCB_SHAPE_TYPE 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, ZONE_SEGMENT_FILLm_FillSegmList
 Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used. More...
 
std::map< PCB_LAYER_ID, SHAPE_POLY_SETm_FilledPolysList
 
std::map< PCB_LAYER_ID, SHAPE_POLY_SETm_RawPolysList
 
EDA_RECT m_bboxCache
 Temp variables used while filling. More...
 
std::map< PCB_LAYER_ID, bool > m_fillFlags
 
std::map< PCB_LAYER_ID, MD5_HASHm_filledPolysHash
 A hash value used in zone filling calculations to see if the filled areas are up to date. More...
 
ZONE_BORDER_DISPLAY_STYLE m_borderStyle
 
int m_borderHatchPitch
 
std::vector< SEGm_borderHatchLines
 
std::map< PCB_LAYER_ID, std::set< int > > m_insulatedIslands
 For each layer, a set of insulated islands that were not removed. More...
 
bool m_hv45
 
double m_area
 
std::mutex m_lock
 Lock used for multi-threaded filling on multi-layer zones. More...
 
NETINFO_ITEMm_netinfo
 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 943 of file zone.h.

Constructor & Destructor Documentation

◆ FP_ZONE() [1/2]

FP_ZONE::FP_ZONE ( BOARD_ITEM_CONTAINER aParent)

Definition at line 1324 of file zone.cpp.

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

1333  :
1334  ZONE( aZone.GetParent(), true )
1335 {
1336  InitDataFromSrcInCopyCtor( aZone );
1337 }
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 821 of file zone.cpp.

822 {
823  if( aPolygon.empty() )
824  return;
825 
826  SHAPE_LINE_CHAIN outline;
827 
828  // Create an outline and populate it with the points of aPolygon
829  for( const wxPoint& pt : aPolygon)
830  outline.Append( pt );
831 
832  outline.SetClosed( true );
833 
834  AddPolygon( outline );
835 }
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
void SetClosed(bool aClosed)
Function SetClosed()
SHAPE_LINE_CHAIN.
void AddPolygon(std::vector< wxPoint > &aPolygon)
Add a polygon to the zone outline.
Definition: zone.cpp:821

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

808 {
809  wxASSERT( aPolygon.IsClosed() );
810 
811  // Add the outline as a new polygon in the polygon set
812  if( m_Poly->OutlineCount() == 0 )
813  m_Poly->AddOutline( aPolygon );
814  else
815  m_Poly->AddHole( aPolygon );
816 
817  SetNeedRefill( true );
818 }
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:820
bool IsClosed() const override
Function IsClosed()
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:235

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

839 {
840  // Ensure the main outline exists:
841  if( m_Poly->OutlineCount() == 0 )
842  m_Poly->NewOutline();
843 
844  // If aHoleIdx >= 0, the corner musty be added to the hole, index aHoleIdx.
845  // (remember: the index of the first hole is 0)
846  // Return error if if does dot exist.
847  if( aHoleIdx >= m_Poly->HoleCount( 0 ) )
848  return false;
849 
850  m_Poly->Append( aPosition.x, aPosition.y, -1, aHoleIdx, aAllowDuplication );
851 
852  SetNeedRefill( true );
853 
854  return true;
855 }
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:820
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:235
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:922
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:914

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

1172 {
1173  if( GetNumCorners() <= 2 ) // malformed zone. polygon calculations will not like it ...
1174  return false;
1175 
1176  if( GetIsRuleArea() )
1177  {
1178  // We like keepouts just the way they are....
1179  aSmoothedPoly = *m_Poly;
1180  return true;
1181  }
1182 
1183  BOARD* board = GetBoard();
1184  int maxError = ARC_HIGH_DEF;
1185  bool keepExternalFillets = false;
1186 
1187  if( board )
1188  {
1189  BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings();
1190 
1191  maxError = bds.m_MaxError;
1192  keepExternalFillets = bds.m_ZoneKeepExternalFillets;
1193  }
1194 
1195  auto smooth = [&]( SHAPE_POLY_SET& aPoly )
1196  {
1197  switch( m_cornerSmoothingType )
1198  {
1200  aPoly = aPoly.Chamfer( (int) m_cornerRadius );
1201  break;
1202 
1204  {
1205  aPoly = aPoly.Fillet( (int) m_cornerRadius, maxError );
1206  break;
1207  }
1208 
1209  default:
1210  break;
1211  }
1212  };
1213 
1214  std::vector<ZONE*> interactingZones;
1215  GetInteractingZones( aLayer, &interactingZones );
1216 
1217  SHAPE_POLY_SET* maxExtents = m_Poly;
1218  SHAPE_POLY_SET withFillets;
1219 
1220  aSmoothedPoly = *m_Poly;
1221 
1222  // Should external fillets (that is, those applied to concave corners) be kept? While it
1223  // seems safer to never have copper extend outside the zone outline, 5.1.x and prior did
1224  // indeed fill them so we leave the mode available.
1225  if( keepExternalFillets )
1226  {
1227  withFillets = *m_Poly;
1228  smooth( withFillets );
1229  withFillets.BooleanAdd( *m_Poly, SHAPE_POLY_SET::PM_FAST );
1230  maxExtents = &withFillets;
1231  }
1232 
1233  for( ZONE* zone : interactingZones )
1234  aSmoothedPoly.BooleanAdd( *zone->Outline(), SHAPE_POLY_SET::PM_FAST );
1235 
1236  if( aBoardOutline )
1237  {
1238  SHAPE_POLY_SET poly = *aBoardOutline;
1240  }
1241 
1242  smooth( aSmoothedPoly );
1243 
1244  if( aSmoothedPolyWithApron )
1245  {
1246  SHAPE_POLY_SET poly = *maxExtents;
1247  poly.Inflate( m_ZoneMinThickness, 64 );
1248  *aSmoothedPolyWithApron = aSmoothedPoly;
1249  aSmoothedPolyWithApron->BooleanIntersection( poly, SHAPE_POLY_SET::PM_FAST );
1250  }
1251 
1252  aSmoothedPoly.BooleanIntersection( *maxExtents, SHAPE_POLY_SET::PM_FAST );
1253 
1254  return true;
1255 }
int GetNumCorners(void) const
Access to m_Poly parameters.
Definition: zone.h:520
unsigned int m_cornerRadius
Definition: zone.h:822
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:730
int m_cornerSmoothingType
Definition: zone.h:821
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:820
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:588
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:1139
Represent a set of closed polygons.
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:50
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
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:851
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
Container for design settings for a BOARD object.

References SHAPE_POLY_SET::BooleanAdd(), SHAPE_POLY_SET::BooleanIntersection(), 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::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:918
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 1112 of file zone.cpp.

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

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

1259 {
1260  m_area = 0.0;
1261 
1262  // Iterate over each outline polygon in the zone and then iterate over
1263  // each hole it has to compute the total area.
1264  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
1265  {
1266  SHAPE_POLY_SET& poly = pair.second;
1267 
1268  for( int i = 0; i < poly.OutlineCount(); i++ )
1269  {
1270  m_area += poly.Outline( i ).Area();
1271 
1272  for( int j = 0; j < poly.HoleCount( i ); j++ )
1273  m_area -= poly.Hole( i, j ).Area();
1274  }
1275  }
1276 
1277  return m_area;
1278 }
int OutlineCount() const
Return the number of vertices in a given outline/hole.
double m_area
Definition: zone.h:933
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Return the aIndex-th subpolygon in the set.
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:914

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

551  {
552  return m_Poly->CIterateWithHoles();
553  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:820
CONST_ITERATOR CIterateWithHoles(int aOutline) const

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

Referenced by PCB_IO::format().

◆ ClassOf()

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

Definition at line 75 of file zone.h.

76  {
77  return aItem && aItem->Type() == PCB_ZONE_T;
78  }
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 1347 of file zone.cpp.

1348 {
1349  return new FP_ZONE( *this );
1350 }
FP_ZONE(BOARD_ITEM_CONTAINER *aParent)
Definition: zone.cpp:1324

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.

References ZONE::GetLayerSet().

◆ DeleteStructure()

void BOARD_ITEM::DeleteStructure ( )
inherited

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

Definition at line 117 of file board_item.cpp.

118 {
119  BOARD_ITEM_CONTAINER* parent = GetParent();
120 
121  if( parent )
122  parent->Remove( this );
123 
124  delete this;
125 }
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]

ZONE_SEGMENT_FILL& ZONE::FillSegments ( PCB_LAYER_ID  aLayer)
inlineinherited

Definition at line 305 of file zone.h.

306  {
307  wxASSERT( m_FillSegmList.count( aLayer ) );
308  return m_FillSegmList.at( aLayer );
309  }
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: zone.h:904

References ZONE::m_FillSegmList.

Referenced by PCB_IO::format().

◆ FillSegments() [2/2]

const ZONE_SEGMENT_FILL& ZONE::FillSegments ( PCB_LAYER_ID  aLayer) const
inlineinherited

Definition at line 311 of file zone.h.

312  {
313  wxASSERT( m_FillSegmList.count( aLayer ) );
314  return m_FillSegmList.at( aLayer );
315  }
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: zone.h:904

References ZONE::m_FillSegmList.

◆ Flip() [1/2]

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

Definition at line 307 of file board_item.h.

308  {
309  Flip( wxPoint( aCentre.x, aCentre.y ), aFlipLeftRight );
310  }
virtual void Flip(const wxPoint &aCentre, bool aFlipLeftRight)
Flip this object, i.e.
Definition: board_item.cpp:173

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

736 {
737  Mirror( aCentre, aFlipLeftRight );
738  int copperLayerCount = GetBoard()->GetCopperLayerCount();
739 
740  if( GetIsRuleArea() )
741  SetLayerSet( FlipLayerMask( GetLayerSet(), copperLayerCount ) );
742  else
743  SetLayer( FlipLayer( GetLayer(), copperLayerCount ) );
744 }
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:730
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
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:50
int GetCopperLayerCount() const
Definition: board.cpp:453
void Mirror(const wxPoint &aMirrorRef, bool aMirrorLeftRight)
Mirror the outlines relative to a given horizontal axis the layer is not changed.
Definition: zone.cpp:747
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;
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()

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 (BOARD*) this;
54 
55  BOARD_ITEM* parent = GetParent();
56 
57  if( parent )
58  return parent->GetBoard();
59 
60  return NULL;
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
#define NULL
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:50
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
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(), NULL, PCB_T, and EDA_ITEM::Type().

Referenced by PAD::BuildEffectivePolygon(), PAD::BuildEffectiveShapes(), ZONE::BuildSmoothedPoly(), KIGFX::PCB_PAINTER::draw(), 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(), BOARD_ITEM::GetBoard(), FOOTPRINT::GetBoundingBox(), FOOTPRINT::GetBoundingHull(), BOARD_CONNECTED_ITEM::GetEffectiveNetclass(), 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(), 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().

◆ GetBorderHatchPitch()

int ZONE::GetBorderHatchPitch ( ) const
inherited

HatchBorder related methods.

Returns
the zone hatch pitch in iu.

Definition at line 892 of file zone.cpp.

893 {
894  return m_borderHatchPitch;
895 }
int m_borderHatchPitch
Definition: zone.h:925

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:820
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:918

References ZONE::m_bboxCache.

Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), ZONE_FILLER::buildCopperItemClearances(), ZONE_FILLER::buildThermalSpokes(), 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(), and ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically().

◆ GetClass()

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

Implements EDA_ITEM.

Definition at line 512 of file zone.h.

513  {
514  return wxT( "ZONE" );
515  }

◆ GetCornerPosition()

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

Definition at line 560 of file zone.h.

561  {
563 
564  // Convert global to relative indices
565  if( !m_Poly->GetRelativeIndices( aCornerIndex, &index ) )
566  throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
567 
568  return m_Poly->CVertex( index );
569  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:820
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 684 of file zone.h.

684 { return m_cornerRadius; }
unsigned int m_cornerRadius
Definition: zone.h:822

References ZONE::m_cornerRadius.

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

◆ GetCornerSmoothingType()

int ZONE::GetCornerSmoothingType ( ) const
inlineinherited

Definition at line 680 of file zone.h.

680 { return m_cornerSmoothingType; }
int m_cornerSmoothingType
Definition: zone.h:821

References ZONE::m_cornerSmoothingType.

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

◆ GetDefaultHatchPitch()

◆ GetDoNotAllowCopperPour()

bool ZONE::GetDoNotAllowCopperPour ( ) const
inlineinherited

Definition at line 731 of file zone.h.

731 { return m_doNotAllowCopperPour; }
bool m_doNotAllowCopperPour
Definition: zone.h:843

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

735 { return m_doNotAllowFootprints; }
bool m_doNotAllowFootprints
Definition: zone.h:847

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

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

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_LABEL_EDITOR::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), and DIALOG_TEXT_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 71 of file board_connected_item.cpp.

72 {
73  // NB: we must check the net first, as when it is 0 GetNetClass() will return the
74  // orphaned net netclass, not the default netclass.
75  if( !m_netinfo || m_netinfo->GetNetCode() == 0 )
77  else
78  return GetNetClass();
79 }
virtual NETCLASS * GetNetClass() const
Return the NETCLASS for this item.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:588
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:50
NETINFO_ITEM * m_netinfo
Store all information about the net that item belongs to.
NETCLASS * GetDefault() const
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 1377 of file zone.cpp.

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

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

216  {
217  return m_area;
218  }
double m_area
Definition: zone.h:933

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

633  {
634  wxASSERT( m_FilledPolysList.count( aLayer ) );
635  return m_FilledPolysList.at( aLayer );
636  }
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:914

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

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

◆ GetFillFlag()

int ZONE::GetFillFlag ( PCB_LAYER_ID  aLayer)
inlineinherited

Definition at line 225 of file zone.h.

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

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

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

689 { return m_fillVersion; }
int m_fillVersion
Definition: zone.h:852

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

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

◆ GetHatchBorderAlgorithm()

int ZONE::GetHatchBorderAlgorithm ( ) const
inlineinherited

Definition at line 268 of file zone.h.

268 { return m_hatchBorderAlgorithm; }
int m_hatchBorderAlgorithm
Definition: zone.h:892

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

253 { return m_hatchGap; }
int m_hatchGap
Definition: zone.h:884

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

265 { return m_hatchHoleMinArea; }
double m_hatchHoleMinArea
Definition: zone.h:891

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

797 { return m_borderHatchLines; }
std::vector< SEG > m_borderHatchLines
Definition: zone.h:926

References ZONE::m_borderHatchLines.

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

◆ GetHatchOrientation()

double ZONE::GetHatchOrientation ( ) const
inlineinherited

Definition at line 256 of file zone.h.

256 { return m_hatchOrientation; }
double m_hatchOrientation
Definition: zone.h:885

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

259 { return m_hatchSmoothingLevel; }
int m_hatchSmoothingLevel
Definition: zone.h:886

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

262 { return m_hatchSmoothingValue; }
double m_hatchSmoothingValue
Definition: zone.h:890

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

610 { return m_borderStyle; }
ZONE_BORDER_DISPLAY_STYLE m_borderStyle
Definition: zone.h:924

References ZONE::m_borderStyle.

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

◆ GetHatchThickness()

int ZONE::GetHatchThickness ( ) const
inlineinherited

Definition at line 250 of file zone.h.

250 { return m_hatchThickness; }
int m_hatchThickness
Definition: zone.h:883

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

799 { return m_hv45; }
bool m_hv45
Definition: zone.h:931

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

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

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

Referenced by ZONE::BuildSmoothedPoly().

◆ GetIslandRemovalMode()

const ISLAND_REMOVAL_MODE ZONE::GetIslandRemovalMode ( ) const
inlineinherited

Definition at line 746 of file zone.h.

746 { return m_islandRemovalMode; }
ISLAND_REMOVAL_MODE m_islandRemovalMode
Definition: zone.h:854

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

65 {
66  BOARD* board = GetBoard();
67 
68  if( board )
69  return board->GetLayerName( m_layer );
70 
71  // If no parent, return standard name
73 }
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:360
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:50
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
PCB_LAYER_ID m_layer
Definition: board_item.h:355
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_TEXT::GetMsgPanelInfo(), PCB_TARGET::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

Return a std::bitset of all layers on which the item physically resides.

Reimplemented from BOARD_ITEM.

Definition at line 291 of file zone.cpp.

292 {
293  return m_layerSet;
294 }
LSET m_layerSet
Definition: zone.h:827

References ZONE::m_layerSet.

Referenced by CN_CONNECTIVITY_ALGO::Add(), ZONE::CommonLayerExists(), ZONE::Flip(), PCB_IO::format(), ZONE::InitDataFromSrcInCopyCtor(), ZONE::IsSame(), ZONE_SETTINGS::operator<<(), DRC_ENGINE::RunTests(), SaveCopyOfZones(), PCB_SELECTION_TOOL::Selectable(), and PNS_KICAD_IFACE_BASE::syncZone().

◆ 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:850
#define _(s)
bool m_isRuleArea
Definition: zone.h:838

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

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

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

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

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

221  {
222  return m_lock;
223  }
std::mutex m_lock
Lock used for multi-threaded filling on multi-layer zones.
Definition: zone.h:936

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

1099 {
1100  return BITMAPS::add_zone;
1101 }

References add_zone.

◆ GetMinIslandArea()

long long int ZONE::GetMinIslandArea ( ) const
inlineinherited

Definition at line 750 of file zone.h.

750 { 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:860

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:103
bool GetDoNotAllowFootprints() const
Definition: zone.h:735
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:360
ZONE_FILL_MODE m_fillMode
How to fill areas:
Definition: zone.h:882
unsigned GetPriority() const
Definition: zone.h:122
NETCLASS * GetNetClass() const override
Return the NETCLASS for this item.
Definition: zone.h:88
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:730
wxString m_zoneName
An optional unique name for this zone, used for identifying it in DRC checking.
Definition: zone.h:825
bool GetDoNotAllowVias() const
Definition: zone.h:732
double m_area
Definition: zone.h:933
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:827
void AccumulateDescription(wxString &aDesc, const wxString &aItem)
Utility to build comma separated lists in messages.
Definition: kicad_string.h:316
bool GetDoNotAllowPads() const
Definition: zone.h:734
PCB_LAYER_ID
A quick note on layer IDs:
bool GetDoNotAllowCopperPour() const
Definition: zone.h:731
virtual PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: zone.cpp:218
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:50
bool GetDoNotAllowTracks() const
Definition: zone.h:733
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: zone.h:896
#define _(s)
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:926
virtual bool IsLocked() const
Definition: board_item.h:247
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:214
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:355
EDA_MSG_PANEL items for displaying messages.
Definition: msgpanel.h:53
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:914
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 88 of file zone.h.

89  {
90  if( GetIsRuleArea() )
91  return nullptr;
92 
94  }
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:730
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 96 of file zone.h.

97  {
98  if( GetIsRuleArea() )
99  return "UNDEFINED";
100 
102  }
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:730
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 108 of file board_connected_item.cpp.

109 {
110  return m_netinfo ? m_netinfo->GetNetCode() : -1;
111 }
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::testZones(), 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 140 of file board_connected_item.cpp.

141 {
142  if( !GetBoard() )
143  return wxT( "[** NO BOARD DEFINED **]" );
144 
145  wxString netname = GetNetname();
146 
147  if( !netname.length() )
148  return wxT( "[<no net>]" );
149  else if( GetNetCode() < 0 )
150  return wxT( "[" + UnescapeString( netname ) + "](" + _( "Not Found" ) + ")" );
151  else
152  return wxT( "[" + UnescapeString( netname ) + "]" );
153 }
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:50
#define _(s)
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:214

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

521  {
522  return m_Poly->TotalVertices();
523  }
int TotalVertices() const
Delete aIdx-th polygon from the set.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:820

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 85 of file board_connected_item.cpp.

86 {
87  DRC_CONSTRAINT constraint;
88 
89  if( GetBoard() && GetBoard()->GetDesignSettings().m_DRCEngine )
90  {
92 
93  constraint = bds.m_DRCEngine->EvalRules( CLEARANCE_CONSTRAINT, this, nullptr, aLayer );
94  }
95 
96  if( constraint.Value().HasMin() )
97  {
98  if( aSource )
99  *aSource = constraint.GetName();
100 
101  return constraint.Value().Min();
102  }
103 
104  return 0;
105 }
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:588
wxString GetName() const
Definition: drc_rule.h:128
virtual 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 776 of file zone.cpp.

777 {
779  {
780  if( aSource )
781  *aSource = _( "zone" );
782 
783  return m_PadConnection;
784  }
785  else
786  {
787  return aPad->GetEffectiveZoneConnection( aSource );
788  }
789 }
ZONE_CONNECTION m_PadConnection
Definition: zone.h:849
#define NULL
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:795
#define _(s)

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

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

◆ GetPadConnection() [2/2]

ZONE_CONNECTION ZONE::GetPadConnection ( ) const
inlineinherited

Definition at line 238 of file zone.h.

238 { return m_PadConnection; }
ZONE_CONNECTION m_PadConnection
Definition: zone.h:849

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(), insideArea(), GENERAL_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), 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:560

References ZONE::GetCornerPosition().

Referenced by EAGLE_PLUGIN::loadPlain().

◆ GetPriority()

◆ GetSelectedCorner()

int ZONE::GetSelectedCorner ( ) const
inlineinherited

Definition at line 271 of file zone.h.

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

859 {
860  wxString layerDesc;
861  int count = 0;
862 
863  for( PCB_LAYER_ID layer : m_layerSet.Seq() )
864  {
865  if( count == 0 )
866  layerDesc = GetBoard()->GetLayerName( layer );
867 
868  count++;
869  }
870 
871  if( count > 1 )
872  layerDesc.Printf( _( "%s and %d more" ), layerDesc, count - 1 );
873 
874  // Check whether the selected contour is a hole (contour index > 0)
875  if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
876  {
877  if( GetIsRuleArea() )
878  return wxString::Format( _( "Rule Area Cutout on %s" ), layerDesc );
879  else
880  return wxString::Format( _( "Zone Cutout on %s" ), layerDesc );
881  }
882  else
883  {
884  if( GetIsRuleArea() )
885  return wxString::Format( _( "Rule Area on %s" ), layerDesc );
886  else
887  return wxString::Format( _( "Zone %s on %s" ), GetNetnameMsg(), layerDesc );
888  }
889 }
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:360
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:730
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:827
PCB_LAYER_ID
A quick note on layer IDs:
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:50
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: zone.h:896
#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

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 156 of file board_connected_item.cpp.

157 {
158  return m_netinfo->GetShortNetname();
159 }
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:835
int m_thermalReliefGap
Definition: zone.h:872
#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:816
#define _(s)
int m_thermalReliefSpokeWidth
Definition: zone.h:873

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

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

625  {
626  return m_FilledPolysList.count( aLayer ) > 0;
627  }
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:914

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

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

357  {
358  return HitTestCutout( VECTOR2I( aRefPos.x, aRefPos.y ), aOutlineIdx, aHoleIdx );
359  }
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:730
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:820
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:914

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:820
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(), ZONE::HitTestForCorner(), 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:70

References dummy(), and 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:820
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:70
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:924
bool m_doNotAllowFootprints
Definition: zone.h:847
unsigned int m_cornerRadius
Definition: zone.h:822
ZONE_FILL_MODE m_fillMode
How to fill areas:
Definition: zone.h:882
int m_ZoneClearance
Definition: zone.h:850
int m_cornerSmoothingType
Definition: zone.h:821
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:820
wxString m_zoneName
An optional unique name for this zone, used for identifying it in DRC checking.
Definition: zone.h:825
int m_hatchSmoothingLevel
Definition: zone.h:886
void SetLayerSet(LSET aLayerSet) override
Definition: zone.cpp:246
ZONE_CONNECTION m_PadConnection
Definition: zone.h:849
double m_area
Definition: zone.h:933
bool m_doNotAllowTracks
Definition: zone.h:845
long long int m_minIslandArea
When island removal mode is set to AREA, islands below this area will be removed.
Definition: zone.h:860
double m_hatchOrientation
Definition: zone.h:885
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:929
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:883
bool m_doNotAllowVias
Definition: zone.h:844
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: zone.h:904
PCB_LAYER_ID
A quick note on layer IDs:
Represent a set of closed polygons.
int GetLocalFlags() const
Definition: zone.h:302
int m_thermalReliefGap
Definition: zone.h:872
bool m_hv45
Definition: zone.h:931
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: zone.h:896
ISLAND_REMOVAL_MODE m_islandRemovalMode
Definition: zone.h:854
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:922
int m_ZoneMinThickness
Definition: zone.h:851
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_RawPolysList
Definition: zone.h:915
bool m_isRuleArea
Definition: zone.h:838
int m_borderHatchPitch
Definition: zone.h:925
std::vector< SEG > m_borderHatchLines
Definition: zone.h:926
void SetLocalFlags(int aFlags)
Definition: zone.h:303
int m_hatchBorderAlgorithm
Definition: zone.h:892
bool m_isFilled
True when a zone was filled, false after deleting the filled areas.
Definition: zone.h:863
NETINFO_ITEM * m_netinfo
Store all information about the net that item belongs to.
int m_hatchGap
Definition: zone.h:884
bool m_doNotAllowCopperPour
Definition: zone.h:843
int m_fillVersion
Definition: zone.h:852
double m_hatchHoleMinArea
Definition: zone.h:891
bool m_needRefill
False when a zone was refilled, true after changes in zone params.
Definition: zone.h:870
bool m_forceVisible
Definition: eda_item.h:480
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:914
unsigned m_priority
Definition: zone.h:833
double m_hatchSmoothingValue
Definition: zone.h:890
int m_thermalReliefSpokeWidth
Definition: zone.h:873
bool m_doNotAllowPads
Definition: zone.h:846

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

84  {
85  return !GetIsRuleArea();
86  }
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:730

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

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

References ZONE::m_isFilled.

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

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

1128 {
1129  if( GetNetCode() < 1 )
1130  return true;
1131 
1132  if( !m_insulatedIslands.count( aLayer ) )
1133  return false;
1134 
1135  return m_insulatedIslands.at( aLayer ).count( aPolyIdx );
1136 }
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:929

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

Referenced by PCB_IO::format().

◆ IsKeepout()

bool ZONE::IsKeepout ( ) const
inherited

Definition at line 1307 of file zone.cpp.

1308 {
1311 }
bool m_doNotAllowFootprints
Definition: zone.h:847
bool m_doNotAllowTracks
Definition: zone.h:845
bool m_doNotAllowVias
Definition: zone.h:844
bool m_doNotAllowCopperPour
Definition: zone.h:843
bool m_doNotAllowPads
Definition: zone.h:846

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

◆ IsLocked()

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

Reimplemented in FOOTPRINT, and PAD.

Definition at line 247 of file board_item.h.

248  {
249  return GetState( LOCKED );
250  }
#define LOCKED
Pcbnew: locked from movement and deletion.
int GetState(EDA_ITEM_FLAGS type) const
Definition: eda_item.h:137

References EDA_ITEM::GetState(), and LOCKED.

Referenced by BOARD_ITEM_DESC::BOARD_ITEM_DESC(), PCB_CONTROL::DeleteItemCursor(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::FilletTracks(), PCB_IO::format(), PCB_TEXT::GetMsgPanelInfo(), ZONE::GetMsgPanelInfo(), FP_TEXT::GetMsgPanelInfo(), PCB_DIMENSION_BASE::GetMsgPanelInfo(), PCB_SHAPE::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfoBase_Common(), ALIGN_DISTRIBUTE_TOOL::GetSelections(), GENERAL_COLLECTOR::Inspect(), PAD::IsLocked(), PCB_SELECTION_TOOL::itemPassesFilter(), CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromDrawsegments(), 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:827

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

References ZONE::m_layerSet.

Referenced by KIGFX::PCB_PAINTER::draw(), DSN::SPECCTRA_DB::FromBOARD(), and DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZones().

◆ IsReplaceable()

virtual bool EDA_ITEM::IsReplaceable ( ) const
inlinevirtualinherited

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:735
ZONE_FILL_MODE m_fillMode
How to fill areas:
Definition: zone.h:882
int m_ZoneClearance
Definition: zone.h:850
unsigned GetPriority() const
Definition: zone.h:122
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:730
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:820
wxString m_zoneName
An optional unique name for this zone, used for identifying it in DRC checking.
Definition: zone.h:825
ZONE_CONNECTION m_PadConnection
Definition: zone.h:849
SHAPE_POLY_SET * Outline()
Definition: zone.h:317
bool GetDoNotAllowVias() const
Definition: zone.h:732
long long int m_minIslandArea
When island removal mode is set to AREA, islands below this area will be removed.
Definition: zone.h:860
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:734
bool GetDoNotAllowCopperPour() const
Definition: zone.h:731
int GetMinThickness() const
Definition: zone.h:241
bool GetDoNotAllowTracks() const
Definition: zone.h:733
int m_thermalReliefGap
Definition: zone.h:872
ISLAND_REMOVAL_MODE m_islandRemovalMode
Definition: zone.h:854
int m_ZoneMinThickness
Definition: zone.h:851
int m_thermalReliefSpokeWidth
Definition: zone.h:873

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(), 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(), and GERBVIEW_SELECTION_TOOL::unselect().

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

531  {
532  return m_Poly->Iterate();
533  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:820
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 540 of file zone.h.

541  {
542  return m_Poly->IterateWithHoles();
543  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:820
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 1314 of file zone.cpp.

1315 {
1318 }
bool m_doNotAllowFootprints
Definition: zone.h:847
bool m_doNotAllowTracks
Definition: zone.h:845
bool m_doNotAllowVias
Definition: zone.h:844
bool m_doNotAllowCopperPour
Definition: zone.h:843
bool m_doNotAllowPads
Definition: zone.h:846

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

77 {
78  BOARD* board = GetBoard();
79  LSET layers = GetLayerSet();
80 
81  // Try to be smart and useful. Check all copper first.
82  if( layers[F_Cu] && layers[B_Cu] )
83  return _( "all copper layers" );
84 
85  LSET copperLayers = layers & board->GetEnabledLayers().AllCuMask();
86  LSET techLayers = layers & board->GetEnabledLayers().AllTechMask();
87 
88  for( LSET testLayers : { copperLayers, techLayers, layers } )
89  {
90  for( int bit = PCBNEW_LAYER_ID_START; bit < PCB_LAYER_ID_COUNT; ++bit )
91  {
92  if( testLayers[ bit ] )
93  {
94  wxString layerInfo = board->GetLayerName( static_cast<PCB_LAYER_ID>( bit ) );
95 
96  if( testLayers.count() > 1 )
97  layerInfo << wxS( " " ) + _( "and others" );
98 
99  return layerInfo;
100  }
101  }
102  }
103 
104  // No copper, no technicals: no layer
105  return _( "no layers" );
106 }
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:360
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:465
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.
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:50
#define _(s)
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
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 747 of file zone.cpp.

748 {
749  // ZONEs mirror about the x-axis (why?!?)
750  m_Poly->Mirror( aMirrorLeftRight, !aMirrorLeftRight, VECTOR2I( aMirrorRef ) );
751 
752  HatchBorder();
753 
754  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
755  pair.second.Mirror( aMirrorLeftRight, !aMirrorLeftRight, VECTOR2I( aMirrorRef ) );
756 
757  for( std::pair<const PCB_LAYER_ID, ZONE_SEGMENT_FILL>& pair : m_FillSegmList )
758  {
759  for( SEG& seg : pair.second )
760  {
761  if( aMirrorLeftRight )
762  {
763  MIRROR( seg.A.x, aMirrorRef.x );
764  MIRROR( seg.B.x, aMirrorRef.x );
765  }
766  else
767  {
768  MIRROR( seg.A.y, aMirrorRef.y );
769  MIRROR( seg.B.y, aMirrorRef.y );
770  }
771  }
772  }
773 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:820
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
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: zone.h:904
void HatchBorder()
Compute the hatch lines depending on the hatch parameters and stores it in the zone's attribute m_bor...
Definition: zone.cpp:929
Definition: seg.h:40
VECTOR2I A
Definition: seg.h:48
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:914
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 281 of file board_item.h.

282  {
283  Move( wxPoint( aMoveVector.x, aMoveVector.y ) );
284  }
virtual void Move(const wxPoint &aMoveVector)
Move this object.
Definition: board_item.h:275

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

674 {
675  /* move outlines */
676  m_Poly->Move( offset );
677 
678  HatchBorder();
679 
680  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
681  pair.second.Move( offset );
682 
683  for( std::pair<const PCB_LAYER_ID, ZONE_SEGMENT_FILL>& pair : m_FillSegmList )
684  {
685  for( SEG& seg : pair.second )
686  {
687  seg.A += VECTOR2I( offset );
688  seg.B += VECTOR2I( offset );
689  }
690  }
691 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:820
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: zone.h:904
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:929
Definition: seg.h:40
VECTOR2I A
Definition: seg.h:48
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:914
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 694 of file zone.cpp.

695 {
696  int next_corner;
697 
698  if( m_Poly->GetNeighbourIndexes( aEdge, nullptr, &next_corner ) )
699  {
700  m_Poly->SetVertex( aEdge, m_Poly->CVertex( aEdge ) + VECTOR2I( offset ) );
701  m_Poly->SetVertex( next_corner, m_Poly->CVertex( next_corner ) + VECTOR2I( offset ) );
702  HatchBorder();
703 
704  SetNeedRefill( true );
705  }
706 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:820
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:929
void SetNeedRefill(bool aNeedRefill)
Definition: zone.h:235

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

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

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

595  {
596  m_Poly->NewHole();
597  }
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:820

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

1341 {
1342  ZONE::operator=( aOther );
1343  return *this;
1344 }
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 318 of file zone.h.

318 { return m_Poly; }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:820

References ZONE::m_Poly.

◆ RawPolysList()

SHAPE_POLY_SET& ZONE::RawPolysList ( PCB_LAYER_ID  aLayer)
inlineinherited

Definition at line 715 of file zone.h.

716  {
717  wxASSERT( m_RawPolysList.count( aLayer ) );
718  return m_RawPolysList.at( aLayer );
719  }
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_RawPolysList
Definition: zone.h:915

References ZONE::m_RawPolysList.

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

◆ RemoveAllContours()

void ZONE::RemoveAllContours ( void  )
inlineinherited

Definition at line 555 of file zone.h.

556  {
558  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:820

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

793 {
794  // Ensure the requested cutout is valid
795  if( m_Poly->OutlineCount() < aOutlineIdx || m_Poly->HoleCount( aOutlineIdx ) < aHoleIdx )
796  return;
797 
798  SHAPE_POLY_SET cutPoly( m_Poly->Hole( aOutlineIdx, aHoleIdx ) );
799 
800  // Add the cutout back to the zone
802 
803  SetNeedRefill( true );
804 }
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:820
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:235

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

295  {
296  Rotate( wxPoint( aRotCentre.x, aRotCentre.y ), aAngle );
297  }
virtual void Rotate(const wxPoint &aRotCentre, double aAngle)
Rotate this object.
Definition: board_item.cpp:167

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

710 {
711  aAngle = -DECIDEG2RAD( aAngle );
712 
713  m_Poly->Rotate( aAngle, VECTOR2I( aCentre ) );
714  HatchBorder();
715 
716  /* rotate filled areas: */
717  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
718  pair.second.Rotate( aAngle, VECTOR2I( aCentre ) );
719 
720  for( std::pair<const PCB_LAYER_ID, ZONE_SEGMENT_FILL>& pair : m_FillSegmList )
721  {
722  for( SEG& seg : pair.second )
723  {
724  wxPoint a( seg.A );
725  RotatePoint( &a, aCentre, aAngle );
726  seg.A = a;
727  wxPoint b( seg.B );
728  RotatePoint( &b, aCentre, aAngle );
729  seg.B = a;
730  }
731  }
732 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:820
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:228
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: zone.h:904
void HatchBorder()
Compute the hatch lines depending on the hatch parameters and stores it in the zone's attribute m_bor...
Definition: zone.cpp:929
Definition: seg.h:40
VECTOR2I A
Definition: seg.h:48
double DECIDEG2RAD(double deg)
Definition: trigo.h:235
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:914
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().

Referenced by isCoupledDiffPair().

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

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

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,
wxPoint  new_pos 
)
inlineinherited

Definition at line 571 of file zone.h.

572  {
573  SHAPE_POLY_SET::VERTEX_INDEX relativeIndices;
574 
575  // Convert global to relative indices
576  if( m_Poly->GetRelativeIndices( aCornerIndex, &relativeIndices ) )
577  {
578  if( m_Poly->CVertex( relativeIndices ).x != new_pos.x
579  || m_Poly->CVertex( relativeIndices ).y != new_pos.y )
580  {
581  SetNeedRefill( true );
582  m_Poly->SetVertex( relativeIndices, new_pos );
583  }
584  }
585  else
586  {
587  throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
588  }
589  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:820
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:235

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:822
void SetNeedRefill(bool aNeedRefill)
Definition: zone.h:235

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

Referenced by ZONE_SETTINGS::ExportSetting().

◆ SetCornerSmoothingType()

void ZONE::SetCornerSmoothingType ( int  aType)
inlineinherited

Definition at line 678 of file zone.h.

678 { m_cornerSmoothingType = aType; };
int m_cornerSmoothingType
Definition: zone.h:821

References ZONE::m_cornerSmoothingType.

Referenced by ZONE_SETTINGS::ExportSetting().

◆ SetDoNotAllowCopperPour()

◆ SetDoNotAllowFootprints()

◆ SetDoNotAllowPads()

◆ SetDoNotAllowTracks()