KiCad PCB EDA Suite
FP_ZONE Class Reference

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

#include <zone.h>

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

Public Member Functions

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

Static Public Member Functions

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

Public Attributes

const KIID m_Uuid
 

Static Public Attributes

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

Protected Member Functions

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

Protected Attributes

SHAPE_POLY_SETm_Poly
 Outline of the zone. More...
 
int m_cornerSmoothingType
 
unsigned int m_cornerRadius
 
wxString m_zoneName
 An optional unique name for this zone, used for identifying it in DRC checking. More...
 
LSET m_layerSet
 
unsigned m_priority
 
bool m_isRuleArea
 
bool m_doNotAllowCopperPour
 
bool m_doNotAllowVias
 
bool m_doNotAllowTracks
 
bool m_doNotAllowPads
 
bool m_doNotAllowFootprints
 
ZONE_CONNECTION m_PadConnection
 
int m_ZoneClearance
 
int m_ZoneMinThickness
 
int m_fillVersion
 
ISLAND_REMOVAL_MODE m_islandRemovalMode
 
long long int m_minIslandArea
 When island removal mode is set to AREA, islands below this area will be removed. More...
 
bool m_isFilled
 True when a zone was filled, false after deleting the filled areas. More...
 
bool m_needRefill
 False when a zone was refilled, true after changes in zone params. More...
 
int m_thermalReliefGap
 
int m_thermalReliefSpokeWidth
 
ZONE_FILL_MODE m_fillMode
 How to fill areas: More...
 
int m_hatchThickness
 
int m_hatchGap
 
double m_hatchOrientation
 
int m_hatchSmoothingLevel
 
double m_hatchSmoothingValue
 
double m_hatchHoleMinArea
 
int m_hatchBorderAlgorithm
 
SHAPE_POLY_SET::VERTEX_INDEXm_CornerSelection
 The index of the corner being moved or nullptr if no corner is selected. More...
 
int m_localFlgs
 
std::map< PCB_LAYER_ID, std::vector< SEG > > m_FillSegmList
 Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used. More...
 
std::map< PCB_LAYER_ID, SHAPE_POLY_SETm_FilledPolysList
 
std::map< PCB_LAYER_ID, SHAPE_POLY_SETm_RawPolysList
 
EDA_RECT m_bboxCache
 Temp variables used while filling. More...
 
std::map< PCB_LAYER_ID, bool > m_fillFlags
 
std::map< PCB_LAYER_ID, MD5_HASHm_filledPolysHash
 A hash value used in zone filling calculations to see if the filled areas are up to date. More...
 
ZONE_BORDER_DISPLAY_STYLE m_borderStyle
 
int m_borderHatchPitch
 
std::vector< SEGm_borderHatchLines
 
std::map< PCB_LAYER_ID, std::set< int > > m_insulatedIslands
 For each layer, a set of insulated islands that were not removed. More...
 
bool m_hv45
 
double m_area
 
std::mutex m_lock
 Lock used for multi-threaded filling on multi-layer zones. More...
 
NETINFO_ITEMm_netinfo
 Store all information about the net that item belongs to. More...
 
PCB_LAYER_ID m_layer
 
PCB_GROUPm_group
 
EDA_ITEM_FLAGS m_status
 
EDA_ITEMm_parent
 Linked list: Link (parent struct) More...
 
bool m_forceVisible
 
EDA_ITEM_FLAGS m_flags
 

Detailed Description

A specialization of ZONE for use in footprints.

Definition at line 945 of file zone.h.

Constructor & Destructor Documentation

◆ FP_ZONE() [1/2]

FP_ZONE::FP_ZONE ( BOARD_ITEM_CONTAINER aParent)

Definition at line 1340 of file zone.cpp.

1340  :
1341  ZONE( aParent, true )
1342 {
1343  // in a footprint, net classes are not managed.
1344  // so set the net to NETINFO_LIST::ORPHANED_ITEM
1345  SetNetCode( -1, true );
1346 }
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 1349 of file zone.cpp.

1349  :
1350  ZONE( aZone.GetParent(), true )
1351 {
1352  InitDataFromSrcInCopyCtor( aZone );
1353 }
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:111
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:135

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

834 {
835  if( aPolygon.empty() )
836  return;
837 
838  SHAPE_LINE_CHAIN outline;
839 
840  // Create an outline and populate it with the points of aPolygon
841  for( const wxPoint& pt : aPolygon)
842  outline.Append( pt );
843 
844  outline.SetClosed( true );
845 
846  AddPolygon( outline );
847 }
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
void SetClosed(bool aClosed)
Mark the line chain as closed (i.e.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
void AddPolygon(std::vector< wxPoint > &aPolygon)
Add a polygon to the zone outline.
Definition: zone.cpp:833

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

820 {
821  wxASSERT( aPolygon.IsClosed() );
822 
823  // Add the outline as a new polygon in the polygon set
824  if( m_Poly->OutlineCount() == 0 )
825  m_Poly->AddOutline( aPolygon );
826  else
827  m_Poly->AddHole( aPolygon );
828 
829  SetNeedRefill( true );
830 }
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:822
bool IsClosed() const override
int AddHole(const SHAPE_LINE_CHAIN &aHole, int aOutline=-1)
Return the area of this poly set.
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new hole to the given outline (default: last) and returns its index.
void SetNeedRefill(bool aNeedRefill)
Definition: zone.h:238

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

◆ AppendCorner()

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

Add a new corner to the zone outline (to the main outline or a hole)

Parameters
aPositionis the position of the new corner.
aHoleIdxis the index of the hole (-1 for the main outline, >= 0 for hole).
aAllowDuplicationis a flag to indicate whether it is allowed to add this corner even if it is duplicated.
Returns
true if the corner was added, false if error (aHoleIdx > hole count -1)

Definition at line 850 of file zone.cpp.

851 {
852  // Ensure the main outline exists:
853  if( m_Poly->OutlineCount() == 0 )
854  m_Poly->NewOutline();
855 
856  // If aHoleIdx >= 0, the corner musty be added to the hole, index aHoleIdx.
857  // (remember: the index of the first hole is 0)
858  // Return error if if does dot exist.
859  if( aHoleIdx >= m_Poly->HoleCount( 0 ) )
860  return false;
861 
862  m_Poly->Append( aPosition.x, aPosition.y, -1, aHoleIdx, aAllowDuplication );
863 
864  SetNeedRefill( true );
865 
866  return true;
867 }
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:822
int NewOutline()
Creates a new hole in a given outline.
int HoleCount(int aOutline) const
Return the reference to aIndex-th outline in the set.
void SetNeedRefill(bool aNeedRefill)
Definition: zone.h:238
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...

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

Referenced by BOARD::AddArea(), PCAD2KICAD::PCB_POLYGON::AddToBoard(), TEST_BOARD_ITEM_FIXTURE::Instantiate(), 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 395 of file zone.cpp.

396 {
397  if( !m_FilledPolysList.count( aLayer ) )
399  else
400  m_filledPolysHash[aLayer] = m_FilledPolysList.at( aLayer ).GetHash();
401 }
MD5_HASH GetHash() const
static SHAPE_POLY_SET g_nullPoly
Definition: zone.cpp:383
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:924
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:916

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

1182 {
1183  if( GetNumCorners() <= 2 ) // malformed zone. polygon calculations will not like it ...
1184  return false;
1185 
1186  // Processing of arc shapes in zones is not yet supported because Clipper can't do boolean
1187  // operations on them. The poly outline must be flattened first.
1188  SHAPE_POLY_SET flattened = *m_Poly;
1189  flattened.ClearArcs();
1190 
1191  if( GetIsRuleArea() )
1192  {
1193  // We like keepouts just the way they are....
1194  aSmoothedPoly = flattened;
1195  return true;
1196  }
1197 
1198  const BOARD* board = GetBoard();
1199  int maxError = ARC_HIGH_DEF;
1200  bool keepExternalFillets = false;
1201 
1202  if( board )
1203  {
1204  BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings();
1205 
1206  maxError = bds.m_MaxError;
1207  keepExternalFillets = bds.m_ZoneKeepExternalFillets;
1208  }
1209 
1210  auto smooth = [&]( SHAPE_POLY_SET& aPoly )
1211  {
1212  switch( m_cornerSmoothingType )
1213  {
1215  aPoly = aPoly.Chamfer( (int) m_cornerRadius );
1216  break;
1217 
1219  {
1220  aPoly = aPoly.Fillet( (int) m_cornerRadius, maxError );
1221  break;
1222  }
1223 
1224  default:
1225  break;
1226  }
1227  };
1228 
1229  std::vector<ZONE*> interactingZones;
1230  GetInteractingZones( aLayer, &interactingZones );
1231 
1232  SHAPE_POLY_SET* maxExtents = &flattened;
1233  SHAPE_POLY_SET withFillets;
1234 
1235  aSmoothedPoly = flattened;
1236 
1237  // Should external fillets (that is, those applied to concave corners) be kept? While it
1238  // seems safer to never have copper extend outside the zone outline, 5.1.x and prior did
1239  // indeed fill them so we leave the mode available.
1240  if( keepExternalFillets )
1241  {
1242  withFillets = flattened;
1243  smooth( withFillets );
1244  withFillets.BooleanAdd( flattened, SHAPE_POLY_SET::PM_FAST );
1245  maxExtents = &withFillets;
1246  }
1247 
1248  for( ZONE* zone : interactingZones )
1249  {
1250  SHAPE_POLY_SET flattened_outline = *zone->Outline();
1251  flattened_outline.ClearArcs();
1252  aSmoothedPoly.BooleanAdd( flattened_outline, SHAPE_POLY_SET::PM_FAST );
1253  }
1254 
1255  if( aBoardOutline )
1256  {
1257  SHAPE_POLY_SET poly = *aBoardOutline;
1259  }
1260 
1261  smooth( aSmoothedPoly );
1262 
1263  if( aSmoothedPolyWithApron )
1264  {
1265  SHAPE_POLY_SET poly = *maxExtents;
1266  poly.Inflate( m_ZoneMinThickness, 64 );
1267  *aSmoothedPolyWithApron = aSmoothedPoly;
1268  aSmoothedPolyWithApron->BooleanIntersection( poly, SHAPE_POLY_SET::PM_FAST );
1269  }
1270 
1271  aSmoothedPoly.BooleanIntersection( *maxExtents, SHAPE_POLY_SET::PM_FAST );
1272 
1273  return true;
1274 }
int GetNumCorners(void) const
Access to m_Poly parameters.
Definition: zone.h:523
unsigned int m_cornerRadius
Definition: zone.h:824
void BooleanAdd(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset difference For aFastMode meaning, see function booleanOp.
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:733
int m_cornerSmoothingType
Definition: zone.h:823
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:822
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:590
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:1149
Represent a set of closed polygons.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
void BooleanIntersection(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset union between a and b, store the result in it self For aFastMode meaning,...
int m_ZoneMinThickness
Definition: zone.h:853
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:191
void ClearArcs()
Appends a vertex at the end of the given outline/hole (default: the last outline)
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
Container for design settings for a BOARD object.

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

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

◆ CacheBoundingBox()

void ZONE::CacheBoundingBox ( )
inlineinherited

Definition at line 146 of file zone.h.

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

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

1123 {
1124  if( aLayer == UNDEFINED_LAYER )
1125  {
1126  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
1127  pair.second.CacheTriangulation();
1128  }
1129  else
1130  {
1131  if( m_FilledPolysList.count( aLayer ) )
1133  }
1134 }
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:1122
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:916

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

1278 {
1279  m_area = 0.0;
1280 
1281  // Iterate over each outline polygon in the zone and then iterate over
1282  // each hole it has to compute the total area.
1283  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
1284  {
1285  SHAPE_POLY_SET& poly = pair.second;
1286 
1287  for( int i = 0; i < poly.OutlineCount(); i++ )
1288  {
1289  m_area += poly.Outline( i ).Area();
1290 
1291  for( int j = 0; j < poly.HoleCount( i ); j++ )
1292  m_area -= poly.Hole( i, j ).Area();
1293  }
1294  }
1295 
1296  return m_area;
1297 }
int OutlineCount() const
Return the number of vertices in a given outline/hole.
double m_area
Definition: zone.h:935
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Return the aIndex-th subpolygon in the set.
double Area(bool aAbsolute=true) const
Return the area of this chain.
Represent a set of closed polygons.
SHAPE_LINE_CHAIN & Outline(int aIndex)
int HoleCount(int aOutline) const
Return the reference to aIndex-th outline in the set.
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:916

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

◆ CIterateWithHoles()

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

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

Returns
an iterator to visit the zone vertices with holes.

Definition at line 553 of file zone.h.

554  {
555  return m_Poly->CIterateWithHoles();
556  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:822
CONST_ITERATOR CIterateWithHoles(int aOutline) const

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

◆ ClassOf()

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

Definition at line 74 of file zone.h.

75  {
76  return aItem && aItem->Type() == PCB_ZONE_T;
77  }
class ZONE, a copper pour area
Definition: typeinfo.h:105
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112

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

153 { m_flags &= ~aMask; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480

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(), EE_SELECTION_TOOL::selectMultiple(), 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 165 of file eda_item.h.

166  {
168  DO_NOT_DRAW );
169  }
#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:153
#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 143 of file view_item.h.

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

References KIGFX::VIEW_ITEM::m_viewPrivData.

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

◆ Clone()

EDA_ITEM * FP_ZONE::Clone ( ) const
overridevirtual

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

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

Returns
A clone of the item.

Reimplemented from ZONE.

Definition at line 1363 of file zone.cpp.

1364 {
1365  return new FP_ZONE( *this );
1366 }
FP_ZONE(BOARD_ITEM_CONTAINER *aParent)
Definition: zone.cpp:1340

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

235 {
236  LSET common = GetLayerSet() & aLayerSet;
237 
238  return common.count() > 0;
239 }
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: zone.cpp:295
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:505

References ZONE::GetLayerSet().

◆ DeleteStructure()

void BOARD_ITEM::DeleteStructure ( )
inherited

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

Definition at line 128 of file board_item.cpp.

129 {
130  BOARD_ITEM_CONTAINER* parent = GetParent();
131 
132  if( parent )
133  parent->Remove( this );
134 
135  delete this;
136 }
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:135

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

172  {
173  EDA_ITEM* dupe = Clone();
174  const_cast<KIID&>( dupe->m_Uuid ) = KIID();
175 
176  return static_cast<BOARD_ITEM*>( dupe );
177  }
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:474
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99

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

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

◆ FillSegments() [1/2]

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

Definition at line 308 of file zone.h.

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

References ZONE::m_FillSegmList.

Referenced by PCB_PLUGIN::format().

◆ FillSegments() [2/2]

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

Definition at line 314 of file zone.h.

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

References ZONE::m_FillSegmList.

◆ Flip() [1/2]

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

Definition at line 269 of file board_item.h.

270  {
271  Flip( wxPoint( aCentre.x, aCentre.y ), aFlipLeftRight );
272  }
virtual void Flip(const wxPoint &aCentre, bool aFlipLeftRight)
Flip this object, i.e.
Definition: board_item.cpp:196

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

748 {
749  Mirror( aCentre, aFlipLeftRight );
750  int copperLayerCount = GetBoard()->GetCopperLayerCount();
751 
752  if( GetIsRuleArea() )
753  SetLayerSet( FlipLayerMask( GetLayerSet(), copperLayerCount ) );
754  else
755  SetLayer( FlipLayer( GetLayer(), copperLayerCount ) );
756 }
LSET FlipLayerMask(LSET aMask, int aCopperLayersCount)
Calculate the mask layer when flipping a footprint.
Definition: lset.cpp:576
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:733
void SetLayerSet(LSET aLayerSet) override
Definition: zone.cpp:250
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Definition: lset.cpp:530
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: zone.cpp:295
virtual PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: zone.cpp:222
int GetCopperLayerCount() const
Definition: board.cpp:455
void Mirror(const wxPoint &aMirrorRef, bool aMirrorLeftRight)
Mirror the outlines relative to a given horizontal axis the layer is not changed.
Definition: zone.cpp:759
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
Definition: zone.cpp:242

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

◆ Get() [1/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty)
inlineinherited

Definition at line 86 of file inspectable.h.

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

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

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

◆ Get() [2/3]

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

Definition at line 95 of file inspectable.h.

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

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

◆ Get() [3/3]

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

Definition at line 104 of file inspectable.h.

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

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

◆ GetBoard() [1/2]

const BOARD * BOARD_ITEM::GetBoard ( ) const
virtualinherited

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

Definition at line 36 of file board_item.cpp.

37 {
38  if( Type() == PCB_T )
39  return static_cast<const BOARD*>( this );
40 
41  BOARD_ITEM* parent = GetParent();
42 
43  if( parent )
44  return parent->GetBoard();
45 
46  return nullptr;
47 }
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:49
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:135
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112

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

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

◆ GetBoard() [2/2]

BOARD * BOARD_ITEM::GetBoard ( )
virtualinherited

Definition at line 50 of file board_item.cpp.

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

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

◆ GetBorderHatchPitch()

int ZONE::GetBorderHatchPitch ( ) const
inherited

HatchBorder related methods.

Returns
the zone hatch pitch in iu.

Definition at line 904 of file zone.cpp.

905 {
906  return m_borderHatchPitch;
907 }
int m_borderHatchPitch
Definition: zone.h:927

References ZONE::m_borderHatchPitch.

Referenced by PCB_PLUGIN::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 326 of file zone.cpp.

327 {
328  auto bb = m_Poly->BBox();
329 
330  EDA_RECT ret( (wxPoint) bb.GetOrigin(), wxSize( bb.GetWidth(), bb.GetHeight() ) );
331 
332  return ret;
333 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:822
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:920

References ZONE::m_bboxCache.

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

◆ GetCenter()

virtual wxPoint BOARD_ITEM::GetCenter ( ) const
inlinevirtualinherited

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

Returns
center point of the item

Reimplemented in PCB_ARC, PAD, PCB_SHAPE, and PCB_MARKER.

Definition at line 81 of file board_item.h.

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

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

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

◆ GetClass()

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

Implements EDA_ITEM.

Definition at line 515 of file zone.h.

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

◆ GetCornerPosition()

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

Definition at line 563 of file zone.h.

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

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

Referenced by ZONE::GetPosition().

◆ GetCornerRadius()

unsigned int ZONE::GetCornerRadius ( ) const
inlineinherited

Definition at line 687 of file zone.h.

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

References ZONE::m_cornerRadius.

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

◆ GetCornerSmoothingType()

int ZONE::GetCornerSmoothingType ( ) const
inlineinherited

Definition at line 683 of file zone.h.

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

References ZONE::m_cornerSmoothingType.

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

◆ GetDefaultHatchPitch()

◆ GetDoNotAllowCopperPour()

bool ZONE::GetDoNotAllowCopperPour ( ) const
inlineinherited

◆ GetDoNotAllowFootprints()

bool ZONE::GetDoNotAllowFootprints ( ) const
inlineinherited

◆ GetDoNotAllowPads()

bool ZONE::GetDoNotAllowPads ( ) const
inlineinherited

◆ GetDoNotAllowTracks()

bool ZONE::GetDoNotAllowTracks ( ) const
inlineinherited

◆ GetDoNotAllowVias()

bool ZONE::GetDoNotAllowVias ( ) const
inlineinherited

◆ GetEditFlags()

EDA_ITEM_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 157 of file eda_item.h.

158  {
159  constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVING | IS_RESIZING | IS_DRAGGING
161 
162  return m_flags & mask;
163  }
#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:480
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
#define IS_MOVING
Item being moved.
#define STRUCT_DELETED
flag indication structures to be erased
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.

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

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

◆ GetEffectiveNetclass()

NETCLASS * BOARD_CONNECTED_ITEM::GetEffectiveNetclass ( ) const
virtualinherited

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

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

Definition at line 66 of file board_connected_item.cpp.

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

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

1394 {
1395  std::shared_ptr<SHAPE> shape;
1396 
1397  if( m_FilledPolysList.find( aLayer ) == m_FilledPolysList.end() )
1398  {
1399  shape = std::make_shared<SHAPE_NULL>();
1400  }
1401  else
1402  {
1403  shape.reset( m_FilledPolysList.at( aLayer ).Clone() );
1404  }
1405 
1406  return shape;
1407 }
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:916

References ZONE::m_FilledPolysList.

◆ GetFilledArea()

double ZONE::GetFilledArea ( )
inlineinherited

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

Returns
the filled area

Definition at line 217 of file zone.h.

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

References ZONE::m_area.

◆ GetFilledPolysList()

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

Definition at line 635 of file zone.h.

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

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_PLUGIN::format(), and CN_ZONE_LAYER::GetAnchor().

◆ GetFilledPolysUseThickness() [1/2]

◆ GetFilledPolysUseThickness() [2/2]

bool ZONE::GetFilledPolysUseThickness ( PCB_LAYER_ID  aLayer) const
inherited

Definition at line 374 of file zone.cpp.

375 {
376  if( ADVANCED_CFG::GetCfg().m_DebugZoneFiller && LSET::InternalCuMask().Contains( aLayer ) )
377  return false;
378 
380 }
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:719
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
bool GetFilledPolysUseThickness() const
Definition: zone.h:689

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

◆ GetFillFlag()

int ZONE::GetFillFlag ( PCB_LAYER_ID  aLayer)
inlineinherited

Definition at line 227 of file zone.h.

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

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

References ZONE::m_fillMode.

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

◆ GetFillVersion()

int ZONE::GetFillVersion ( ) const
inlineinherited

Definition at line 692 of file zone.h.

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

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_TRACK, and PCB_SHAPE.

Definition at line 258 of file eda_item.h.

258 { return GetPosition(); }
virtual wxPoint GetPosition() const
Definition: eda_item.h:251

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

387 {
388  if( !m_filledPolysHash.count( aLayer ) )
389  return g_nullPoly.GetHash();
390  else
391  return m_filledPolysHash.at( aLayer );
392 }
MD5_HASH GetHash() const
static SHAPE_POLY_SET g_nullPoly
Definition: zone.cpp:383
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:924

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

◆ GetHatchBorderAlgorithm()

int ZONE::GetHatchBorderAlgorithm ( ) const
inlineinherited

Definition at line 271 of file zone.h.

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

References ZONE::m_hatchBorderAlgorithm.

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

◆ GetHatchGap()

int ZONE::GetHatchGap ( ) const
inlineinherited

Definition at line 256 of file zone.h.

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

References ZONE::m_hatchGap.

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

◆ GetHatchHoleMinArea()

double ZONE::GetHatchHoleMinArea ( ) const
inlineinherited

Definition at line 268 of file zone.h.

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

References ZONE::m_hatchHoleMinArea.

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

◆ GetHatchLines()

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

Definition at line 799 of file zone.h.

799 { return m_borderHatchLines; }
std::vector< SEG > m_borderHatchLines
Definition: zone.h:928

References ZONE::m_borderHatchLines.

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

◆ GetHatchOrientation()

double ZONE::GetHatchOrientation ( ) const
inlineinherited

Definition at line 259 of file zone.h.

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

References ZONE::m_hatchOrientation.

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

◆ GetHatchSmoothingLevel()

int ZONE::GetHatchSmoothingLevel ( ) const
inlineinherited

Definition at line 262 of file zone.h.

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

References ZONE::m_hatchSmoothingLevel.

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

◆ GetHatchSmoothingValue()

double ZONE::GetHatchSmoothingValue ( ) const
inlineinherited

Definition at line 265 of file zone.h.

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

References ZONE::m_hatchSmoothingValue.

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

◆ GetHatchStyle()

ZONE_BORDER_DISPLAY_STYLE ZONE::GetHatchStyle ( ) const
inlineinherited

Definition at line 613 of file zone.h.

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

References ZONE::m_borderStyle.

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

◆ GetHatchThickness()

int ZONE::GetHatchThickness ( ) const
inlineinherited

Definition at line 253 of file zone.h.

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

References ZONE::m_hatchThickness.

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

◆ GetHV45()

bool ZONE::GetHV45 ( ) const
inlineinherited

Definition at line 801 of file zone.h.

801 { return m_hv45; }
bool m_hv45
Definition: zone.h:933

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

1150 {
1151  int epsilon = Millimeter2iu( 0.001 );
1152 
1153  for( ZONE* candidate : GetBoard()->Zones() )
1154  {
1155  if( candidate == this )
1156  continue;
1157 
1158  if( !candidate->GetLayerSet().test( aLayer ) )
1159  continue;
1160 
1161  if( candidate->GetIsRuleArea() )
1162  continue;
1163 
1164  if( candidate->GetNetCode() != GetNetCode() )
1165  continue;
1166 
1167  for( auto iter = m_Poly->CIterate(); iter; iter++ )
1168  {
1169  if( candidate->m_Poly->Collide( iter.Get(), epsilon ) )
1170  {
1171  aZones->push_back( candidate );
1172  break;
1173  }
1174  }
1175  }
1176 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:822
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
CONST_ITERATOR CIterate(int aFirst, int aLast, bool aIterateHoles=false) const
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
static constexpr int Millimeter2iu(double mm)

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

Referenced by ZONE::BuildSmoothedPoly().

◆ GetIslandRemovalMode()

const ISLAND_REMOVAL_MODE ZONE::GetIslandRemovalMode ( ) const
inlineinherited

Definition at line 749 of file zone.h.

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

References ZONE::m_islandRemovalMode.

Referenced by PCB_PLUGIN::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 75 of file board_item.cpp.

76 {
77  const BOARD* board = GetBoard();
78 
79  if( board )
80  return board->GetLayerName( m_layer );
81 
82  // If no parent, return standard name
84 }
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:362
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:191
PCB_LAYER_ID m_layer
Definition: board_item.h:318
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition: board.h:606

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

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

◆ GetLayerSet()

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

499 {
500  if( m_isRuleArea )
501  return 0;
502 
503  if( aSource )
504  *aSource = _( "zone" );
505 
506  return m_ZoneClearance;
507 }
int m_ZoneClearance
Definition: zone.h:852
#define _(s)
bool m_isRuleArea
Definition: zone.h:840

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

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

◆ GetLocalClearance() [2/2]

int ZONE::GetLocalClearance ( ) const
inlineinherited

Definition at line 157 of file zone.h.

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

References ZONE::GetLocalClearance().

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

◆ GetLocalClearanceOverrides()

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

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

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

Reimplemented in PAD.

Definition at line 142 of file board_connected_item.h.

142 { return 0; }

Referenced by DRC_ENGINE::EvalRules().

◆ GetLocalFlags()

int ZONE::GetLocalFlags ( ) const
inlineinherited

Definition at line 305 of file zone.h.

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

References ZONE::m_localFlgs.

Referenced by ZONE::InitDataFromSrcInCopyCtor().

◆ GetLocalRatsnestVisible()

bool BOARD_CONNECTED_ITEM::GetLocalRatsnestVisible ( ) const
inlineinherited

◆ GetLock()

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

Definition at line 222 of file zone.h.

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

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

1109 {
1110  return BITMAPS::add_zone;
1111 }

References add_zone.

◆ GetMinIslandArea()

long long int ZONE::GetMinIslandArea ( ) const
inlineinherited

Definition at line 752 of file zone.h.

752 { 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:862

References ZONE::m_minIslandArea.

Referenced by PCB_PLUGIN::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 550 of file zone.cpp.

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

◆ GetNet()

◆ GetNetClass()

NETCLASS* ZONE::GetNetClass ( ) const
inlineoverridevirtualinherited

Return the NETCLASS for this item.

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

Reimplemented from BOARD_CONNECTED_ITEM.

Definition at line 87 of file zone.h.

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

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

Referenced by ZONE::GetMsgPanelInfo().

◆ GetNetClassName()

wxString ZONE::GetNetClassName ( ) const
inlineoverridevirtualinherited

Returns the netclass of the zone.

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

Returns
the net class name of this item.

Reimplemented from BOARD_CONNECTED_ITEM.

Definition at line 95 of file zone.h.

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

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

◆ GetNetCode()

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

Definition at line 100 of file board_connected_item.cpp.

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

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_PLUGIN::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(), CONNECTIVITY_DATA::GetRatsnestForPad(), hasThermalConnection(), BOARD_INSPECTION_TOOL::highlightNet(), DIALOG_PAD_PROPERTIES::initValues(), BOARD_INSPECTION_TOOL::InspectClearance(), CONNECTIVITY_DATA::IsConnectedOnLayer(), ZONE::IsIsland(), ZONE::IsSame(), ZONE_FILLER::knockoutThermalReliefs(), AR_AUTOPLACER::nearestPad(), ROUTER_TOOL::NeighboringSegmentFilter(), CN_ITEM::Net(), BOARD::NormalizeAreaPolygon(), PCB_TRACK::cmp_tracks::operator()(), ZONE_SETTINGS::operator<<(), DIALOG_PAD_PROPERTIES::PadTypeSelected(), process(), BOARD_EDITOR_CONTROL::RepairBoard(), PCB_SELECTION_CONDITIONS::sameNetFunc(), SaveCopyOfZones(), PCB_SELECTION_TOOL::selectNet(), ZONE_FILLER::subtractHigherPriorityZones(), PNS_KICAD_IFACE_BASE::syncArc(), PNS_KICAD_IFACE_BASE::syncPad(), PNS_KICAD_IFACE_BASE::syncTrack(), PNS_KICAD_IFACE_BASE::syncVia(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZonesToZones(), BOARD::TracksInNet(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), and BOARD_EDITOR_CONTROL::ZoneMerge().

◆ GetNetname()

◆ GetNetnameMsg()

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

Definition at line 132 of file board_connected_item.cpp.

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

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

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

◆ GetNumCorners()

int ZONE::GetNumCorners ( void  ) const
inlineinherited

Access to m_Poly parameters.

Definition at line 523 of file zone.h.

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

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

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

◆ GetOwnClearance()

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

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

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

Definition at line 77 of file board_connected_item.cpp.

78 {
79  DRC_CONSTRAINT constraint;
80 
81  if( GetBoard() && GetBoard()->GetDesignSettings().m_DRCEngine )
82  {
84 
85  constraint = bds.m_DRCEngine->EvalRules( CLEARANCE_CONSTRAINT, this, nullptr, aLayer );
86  }
87 
88  if( constraint.Value().HasMin() )
89  {
90  if( aSource )
91  *aSource = constraint.GetName();
92 
93  return constraint.Value().Min();
94  }
95 
96  return 0;
97 }
bool HasMin() const
Definition: minoptmax.h:37
MINOPTMAX< int > & Value()
Definition: drc_rule.h:123
T Min() const
Definition: minoptmax.h:33
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:590
wxString GetName() const
Definition: drc_rule.h:130
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
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 788 of file zone.cpp.

789 {
790  if( aPad == nullptr || aPad->GetEffectiveZoneConnection() == ZONE_CONNECTION::INHERITED )
791  {
792  if( aSource )
793  *aSource = _( "zone" );
794 
795  return m_PadConnection;
796  }
797  else
798  {
799  return aPad->GetEffectiveZoneConnection( aSource );
800  }
801 }
ZONE_CONNECTION m_PadConnection
Definition: zone.h:851
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:822
#define _(s)

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

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

◆ GetPadConnection() [2/2]

ZONE_CONNECTION ZONE::GetPadConnection ( ) const
inlineinherited

Definition at line 241 of file zone.h.

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

References ZONE::m_PadConnection.

Referenced by ZONE_DESC::ZONE_DESC().

◆ GetParent()

BOARD_ITEM_CONTAINER* BOARD_ITEM::GetParent ( void  ) const
inlineinherited

Definition at line 135 of file board_item.h.

135 { return (BOARD_ITEM_CONTAINER*) m_parent; }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:478
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::DragArcTrack(), KIGFX::PCB_PAINTER::draw(), EDIT_TOOL::Duplicate(), PCB_SELECTION_TOOL::FilterCollectorForFreePads(), PCB_SELECTION_TOOL::FilterCollectorForHierarchy(), PCB_PLUGIN::format(), FormatProbeItem(), BOARD_ITEM::GetBoard(), PCB_MARKER::GetColorLayer(), BOARD_ITEM::GetParentFootprint(), ALIGN_DISTRIBUTE_TOOL::GetSelections(), FP_TEXT::GetSelectMenuText(), PCB_TEXT::GetShownText(), FP_TEXT::GetShownText(), getTopLevelGroup(), GENERAL_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), isInsideArea(), DRC_ENGINE::IsNetTie(), FP_SHAPE::IsParentFlipped(), FP_TEXT::IsParentFlipped(), PCB_SELECTION_TOOL::itemPassesFilter(), 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().

◆ GetParentFootprint()

BOARD_ITEM_CONTAINER * BOARD_ITEM::GetParentFootprint ( ) const
inherited

Definition at line 179 of file board_item.cpp.

180 {
181  BOARD_ITEM_CONTAINER* ancestor = GetParent();
182 
183  while( ancestor && ancestor->Type() == PCB_GROUP_T )
184  ancestor = ancestor->GetParent();
185 
186  return ( ancestor && ancestor->Type() == PCB_FOOTPRINT_T ) ? ancestor : nullptr;
187 }
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:108
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
Abstract interface for BOARD_ITEMs capable of storing other items inside.
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:135
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112

References BOARD_ITEM::GetParent(), PCB_FOOTPRINT_T, PCB_GROUP_T, and EDA_ITEM::Type().

Referenced by CN_CONNECTIVITY_ALGO::Add(), PNS::ITEM::collideSimple(), and CONVERT_TOOL::CreatePolys().

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

217 {
218  return (wxPoint) GetCornerPosition( 0 );
219 }
const VECTOR2I & GetCornerPosition(int aCornerIndex) const
Definition: zone.h:563

References ZONE::GetCornerPosition().

Referenced by EAGLE_PLUGIN::loadPlain().

◆ GetPriority()

◆ GetSelectedCorner()

int ZONE::GetSelectedCorner ( ) const
inlineinherited

Definition at line 274 of file zone.h.

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

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

References _, Format(), BOARD_ITEM::GetBoard(), ZONE::GetIsRuleArea(), BOARD::GetLayerName(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), SHAPE_POLY_SET::VERTEX_INDEX::m_contour, ZONE::m_CornerSelection, ZONE::m_layerSet, and LSET::Seq().

Referenced by PNS_KICAD_IFACE_BASE::syncZone().

◆ GetShortNetname()

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

Definition at line 148 of file board_connected_item.cpp.

149 {
150  return m_netinfo->GetShortNetname();
151 }
const wxString & GetShortNetname() const
Definition: netinfo.h:131
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 136 of file eda_item.h.

137  {
138  return m_status & type;
139  }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:477

References EDA_ITEM::m_status.

Referenced by BOARD_ITEM::IsLocked().

◆ GetStatus()

EDA_ITEM_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 149 of file eda_item.h.

149 { return m_status; }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:477

References EDA_ITEM::m_status.

◆ GetThermalReliefGap() [1/2]

◆ GetThermalReliefGap() [2/2]

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

Definition at line 336 of file zone.cpp.

337 {
338  if( aPad->GetEffectiveThermalGap() == 0 )
339  {
340  if( aSource )
341  *aSource = _( "zone" );
342 
343  return m_thermalReliefGap;
344  }
345 
346  return aPad->GetEffectiveThermalGap( aSource );
347 
348 }
int GetEffectiveThermalGap(wxString *aSource=nullptr) const
Return the effective thermal gap having resolved any inheritance.
Definition: pad.cpp:862
int m_thermalReliefGap
Definition: zone.h:874
#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 351 of file zone.cpp.

352 {
353  if( aPad->GetEffectiveThermalSpokeWidth() == 0 )
354  {
355  if( aSource )
356  *aSource = _( "zone" );
357 
359  }
360 
361  return aPad->GetEffectiveThermalSpokeWidth( aSource );
362 }
int GetEffectiveThermalSpokeWidth(wxString *aSource=nullptr) const
Return the effective thermal spoke width having resolved any inheritance.
Definition: pad.cpp:843
#define _(s)
int m_thermalReliefSpokeWidth
Definition: zone.h:875

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

References ZONE::m_zoneName.

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

◆ HasFilledPolysForLayer()

bool ZONE::HasFilledPolysForLayer ( PCB_LAYER_ID  aLayer) const
inlineinherited

Definition at line 627 of file zone.h.

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

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

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

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

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

◆ HitTest() [1/2]

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

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

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

Reimplemented from EDA_ITEM.

Definition at line 404 of file zone.cpp.

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

458 {
459  // Calculate bounding box for zone
460  EDA_RECT bbox = GetBoundingBox();
461  bbox.Normalize();
462 
463  EDA_RECT arect = aRect;
464  arect.Normalize();
465  arect.Inflate( aAccuracy );
466 
467  if( aContained )
468  {
469  return arect.Contains( bbox );
470  }
471  else
472  {
473  // Fast test: if aBox is outside the polygon bounding box, rectangles cannot intersect
474  if( !arect.Intersects( bbox ) )
475  return false;
476 
477  int count = m_Poly->TotalVertices();
478 
479  for( int ii = 0; ii < count; ii++ )
480  {
481  auto vertex = m_Poly->CVertex( ii );
482  auto vertexNext = m_Poly->CVertex( ( ii + 1 ) % count );
483 
484  // Test if the point is within the rect
485  if( arect.Contains( ( wxPoint ) vertex ) )
486  return true;
487 
488  // Test if this edge intersects the rect
489  if( arect.Intersects( ( wxPoint ) vertex, ( wxPoint ) vertexNext ) )
490  return true;
491  }
492 
493  return false;
494  }
495 }
int TotalVertices() const
Delete aIdx-th polygon from the set.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:822
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:326
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 525 of file zone.cpp.

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

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

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

◆ HitTestCutout() [2/2]

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

Definition at line 358 of file zone.h.

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

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

511 {
512  // Rule areas have no filled area, but it's generally nice to treat their interior as if it were
513  // filled so that people don't have to select them by their outline (which is min-width)
514  if( GetIsRuleArea() )
515  return m_Poly->Contains( VECTOR2I( aRefPos.x, aRefPos.y ), -1, aAccuracy );
516 
517  if( !m_FilledPolysList.count( aLayer ) )
518  return false;
519 
520  return m_FilledPolysList.at( aLayer ).Contains( VECTOR2I( aRefPos.x, aRefPos.y ), -1,
521  aAccuracy );
522 }
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:733
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:822
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:622
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:916

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

431 {
432  return m_Poly->CollideVertex( VECTOR2I( refPos ), aCornerHit, aAccuracy );
433 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:822
VECTOR2< int > VECTOR2I
Definition: vector2d.h:622
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 436 of file zone.cpp.

437 {
439  return HitTestForCorner( refPos, aAccuracy, dummy );
440 }
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:429
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:72

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

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

445 {
446  return m_Poly->CollideEdge( VECTOR2I( refPos ), aCornerHit, aAccuracy );
447 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:822
VECTOR2< int > VECTOR2I
Definition: vector2d.h:622
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 450 of file zone.cpp.

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

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

◆ InitDataFromSrcInCopyCtor()

void ZONE::InitDataFromSrcInCopyCtor ( const ZONE aZone)
inherited

Copy aZone data to me.

Definition at line 111 of file zone.cpp.

112 {
113  // members are expected non initialize in this.
114  // InitDataFromSrcInCopyCtor() is expected to be called
115  // only from a copy constructor.
116 
117  // Copy only useful EDA_ITEM flags:
118  m_flags = aZone.m_flags;
120 
121  // Replace the outlines for aZone outlines.
122  delete m_Poly;
123  m_Poly = new SHAPE_POLY_SET( *aZone.m_Poly );
124 
127  m_zoneName = aZone.m_zoneName;
128  m_priority = aZone.m_priority;
129  m_isRuleArea = aZone.m_isRuleArea;
130  SetLayerSet( aZone.GetLayerSet() );
131 
137 
139  m_ZoneClearance = aZone.m_ZoneClearance; // clearance value
144 
145  m_isFilled = aZone.m_isFilled;
146  m_needRefill = aZone.m_needRefill;
147 
150 
151  m_fillMode = aZone.m_fillMode; // solid vs. hatched
153  m_hatchGap = aZone.m_hatchGap;
159 
160  // For corner moving, corner index to drag, or nullptr if no selection
161  delete m_CornerSelection;
162  m_CornerSelection = nullptr;
163 
164  for( PCB_LAYER_ID layer : aZone.GetLayerSet().Seq() )
165  {
166  m_FilledPolysList[layer] = aZone.m_FilledPolysList.at( layer );
167  m_RawPolysList[layer] = aZone.m_RawPolysList.at( layer );
168  m_filledPolysHash[layer] = aZone.m_filledPolysHash.at( layer );
169  m_FillSegmList[layer] = aZone.m_FillSegmList.at( layer ); // vector <> copy
170  m_insulatedIslands[layer] = aZone.m_insulatedIslands.at( layer );
171  }
172 
176 
177  SetLocalFlags( aZone.GetLocalFlags() );
178 
179  m_netinfo = aZone.m_netinfo;
180 
181  m_hv45 = aZone.m_hv45;
182  m_area = aZone.m_area;
183 }
ZONE_BORDER_DISPLAY_STYLE m_borderStyle
Definition: zone.h:926
bool m_doNotAllowFootprints
Definition: zone.h:849
unsigned int m_cornerRadius
Definition: zone.h:824
ZONE_FILL_MODE m_fillMode
How to fill areas:
Definition: zone.h:884
int m_ZoneClearance
Definition: zone.h:852
int m_cornerSmoothingType
Definition: zone.h:823
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:822
wxString m_zoneName
An optional unique name for this zone, used for identifying it in DRC checking.
Definition: zone.h:827
int m_hatchSmoothingLevel
Definition: zone.h:888
void SetLayerSet(LSET aLayerSet) override
Definition: zone.cpp:250
ZONE_CONNECTION m_PadConnection
Definition: zone.h:851
double m_area
Definition: zone.h:935
bool m_doNotAllowTracks
Definition: zone.h:847
long long int m_minIslandArea
When island removal mode is set to AREA, islands below this area will be removed.
Definition: zone.h:862
double m_hatchOrientation
Definition: zone.h:887
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: zone.cpp:295
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:931
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480
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:885
bool m_doNotAllowVias
Definition: zone.h:846
Represent a set of closed polygons.
int GetLocalFlags() const
Definition: zone.h:305
int m_thermalReliefGap
Definition: zone.h:874
bool m_hv45
Definition: zone.h:933
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: zone.h:898
ISLAND_REMOVAL_MODE m_islandRemovalMode
Definition: zone.h:856
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:924
int m_ZoneMinThickness
Definition: zone.h:853
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_RawPolysList
Definition: zone.h:917
bool m_isRuleArea
Definition: zone.h:840
std::map< PCB_LAYER_ID, std::vector< SEG > > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: zone.h:906
int m_borderHatchPitch
Definition: zone.h:927
std::vector< SEG > m_borderHatchLines
Definition: zone.h:928
void SetLocalFlags(int aFlags)
Definition: zone.h:306
int m_hatchBorderAlgorithm
Definition: zone.h:894
bool m_isFilled
True when a zone was filled, false after deleting the filled areas.
Definition: zone.h:865
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
NETINFO_ITEM * m_netinfo
Store all information about the net that item belongs to.
int m_hatchGap
Definition: zone.h:886
bool m_doNotAllowCopperPour
Definition: zone.h:845
int m_fillVersion
Definition: zone.h:854
double m_hatchHoleMinArea
Definition: zone.h:893
bool m_needRefill
False when a zone was refilled, true after changes in zone params.
Definition: zone.h:872
bool m_forceVisible
Definition: eda_item.h:479
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:916
unsigned m_priority
Definition: zone.h:835
double m_hatchSmoothingValue
Definition: zone.h:892
int m_thermalReliefSpokeWidth
Definition: zone.h:875
bool m_doNotAllowPads
Definition: zone.h:848

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

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

◆ IsBrightened()

◆ IsConnected()

bool ZONE::IsConnected ( ) const
inlineoverridevirtualinherited

Not all ZONEs are really BOARD_CONNECTED_ITEMs....

Reimplemented from BOARD_CONNECTED_ITEM.

Definition at line 82 of file zone.h.

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

References ZONE::GetIsRuleArea().

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 120 of file eda_item.h.

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

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

123 { return m_flags & ENTERED; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480
#define ENTERED
indicates a group has been entered

References ENTERED, and EDA_ITEM::m_flags.

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

◆ IsFilled()

bool ZONE::IsFilled ( ) const
inlineinherited

Definition at line 234 of file zone.h.

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

References ZONE::m_isFilled.

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

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 205 of file eda_item.h.

205 { return m_forceVisible; }
bool m_forceVisible
Definition: eda_item.h:479

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

1138 {
1139  if( GetNetCode() < 1 )
1140  return true;
1141 
1142  if( !m_insulatedIslands.count( aLayer ) )
1143  return false;
1144 
1145  return m_insulatedIslands.at( aLayer ).count( aPolyIdx );
1146 }
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:931

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

Referenced by PCB_PLUGIN::format().

◆ IsKeepout()

bool ZONE::IsKeepout ( ) const
inherited

Definition at line 1326 of file zone.cpp.

1327 {
1330 }
bool m_doNotAllowFootprints
Definition: zone.h:849
bool m_doNotAllowTracks
Definition: zone.h:847
bool m_doNotAllowVias
Definition: zone.h:846
bool m_doNotAllowCopperPour
Definition: zone.h:845
bool m_doNotAllowPads
Definition: zone.h:848

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

◆ IsLocked()

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

Reimplemented in FOOTPRINT, and PAD.

Definition at line 64 of file board_item.cpp.

65 {
66  if( GetParentGroup() )
67  return GetParentGroup()->IsLocked();
68 
69  const BOARD* board = GetBoard();
70 
71  return board && board->GetBoardUse() != BOARD_USE::FPHOLDER && GetState( LOCKED );
72 }
PCB_GROUP * GetParentGroup() const
Definition: board_item.h:60
virtual bool IsLocked() const
Definition: board_item.cpp:64
#define LOCKED
Pcbnew: locked from movement and deletion.
int GetState(EDA_ITEM_FLAGS type) const
Definition: eda_item.h:136
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:191
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
BOARD_USE GetBoardUse() const
Get what the board use is.
Definition: board.h:211

References FPHOLDER, BOARD_ITEM::GetBoard(), BOARD::GetBoardUse(), BOARD_ITEM::GetParentGroup(), EDA_ITEM::GetState(), BOARD_ITEM::IsLocked(), and LOCKED.

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

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 117 of file eda_item.h.

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

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

229 {
230  return ( m_layerSet & LSET::AllCuMask() ).count() > 0;
231 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:759
LSET m_layerSet
Definition: zone.h:829

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

321 {
322  return m_layerSet.test( aLayer );
323 }
LSET m_layerSet
Definition: zone.h:829

References ZONE::m_layerSet.

Referenced by KIGFX::PCB_PAINTER::draw(), DSN::SPECCTRA_DB::FromBOARD(), BOARD_INSPECTION_TOOL::InspectClearance(), and DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZonesToZones().

◆ IsReplaceable()

virtual bool EDA_ITEM::IsReplaceable ( ) const
inlinevirtualinherited

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

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

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

Definition at line 402 of file eda_item.h.

402 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 124 of file eda_item.h.

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

References IS_RESIZING, and EDA_ITEM::m_flags.

◆ IsSame()

bool ZONE::IsSame ( const ZONE aZoneToCompare)
inherited

Test if 2 zones are equivalent.

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

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

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

Definition at line 60 of file zones_functions_for_undo_redo.cpp.

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

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

122 { return m_flags & SELECTED; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480
#define SELECTED

References EDA_ITEM::m_flags, and SELECTED.

Referenced by ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), SCH_EDIT_FRAME::ConvertPart(), DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), DS_PROXY_UNDO_ITEM::DS_PROXY_UNDO_ITEM(), KIGFX::DS_RENDER_SETTINGS::GetColor(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), SCH_MOVE_TOOL::getConnectedDragItems(), KIGFX::SCH_PAINTER::getLineWidth(), KIGFX::SCH_PAINTER::getRenderColor(), KIGFX::SCH_PAINTER::getTextThickness(), DIALOG_EXCHANGE_FOOTPRINTS::isMatch(), DIALOG_CHANGE_SYMBOLS::isMatch(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), EE_SELECTION_TOOL::RebuildSelection(), RENDER_3D_OPENGL::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(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), KIGFX::SCH_PAINTER::setDeviceColors(), GERBVIEW_SELECTION_TOOL::unselect(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ IsTrack()

bool BOARD_ITEM::IsTrack ( ) const
inlineinherited

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

Returns
true if a track or via, else false.

Definition at line 210 of file board_item.h.

211  {
212  return ( Type() == PCB_TRACE_T ) || ( Type() == PCB_VIA_T );
213  }
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:112

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

183  {
184  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
185  return true;
186 
187  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
188  {
189  if( m_structType == *p )
190  return true;
191  }
192 
193  return false;
194  }
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:487

References EOT, EDA_ITEM::m_structType, and SCH_LOCATE_ANY_T.

Referenced by SCH_EDIT_TOOL::AutoplaceFields(), 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 121 of file eda_item.h.

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

References IS_WIRE_IMAGE, and EDA_ITEM::m_flags.

◆ Iterate()

SHAPE_POLY_SET::ITERATOR ZONE::Iterate ( )
inlineinherited

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

Returns
an iterator to visit the zone vertices without holes.

Definition at line 533 of file zone.h.

534  {
535  return m_Poly->Iterate();
536  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:822
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 294 of file eda_item.h.

298  {
299  for( auto it : aList )
300  {
301  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
303  return SEARCH_RESULT::QUIT;
304  }
305 
307  }
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 313 of file eda_item.h.

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

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

◆ IterateWithHoles()

SHAPE_POLY_SET::ITERATOR ZONE::IterateWithHoles ( )
inlineinherited

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

Returns
an iterator to visit the zone vertices with holes.

Definition at line 543 of file zone.h.

544  {
545  return m_Poly->IterateWithHoles();
546  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:822
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 1333 of file zone.cpp.

1334 {
1337 }
bool m_doNotAllowFootprints
Definition: zone.h:849
bool m_doNotAllowTracks
Definition: zone.h:847
bool m_doNotAllowVias
Definition: zone.h:846
bool m_doNotAllowCopperPour
Definition: zone.h:845
bool m_doNotAllowPads
Definition: zone.h:848

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

88 {
89  const BOARD* board = GetBoard();
90  LSET layers = GetLayerSet();
91 
92  // Try to be smart and useful. Check all copper first.
93  if( layers[F_Cu] && layers[B_Cu] )
94  return _( "all copper layers" );
95 
96  LSET copperLayers = layers & board->GetEnabledLayers().AllCuMask();
97  LSET techLayers = layers & board->GetEnabledLayers().AllTechMask();
98 
99  for( LSET testLayers : { copperLayers, techLayers, layers } )
100  {
101  for( int bit = PCBNEW_LAYER_ID_START; bit < PCB_LAYER_ID_COUNT; ++bit )
102  {
103  if( testLayers[ bit ] )
104  {
105  wxString layerInfo = board->GetLayerName( static_cast<PCB_LAYER_ID>( bit ) );
106 
107  if( testLayers.count() > 1 )
108  layerInfo << wxS( " " ) + _( "and others" );
109 
110  return layerInfo;
111  }
112  }
113  }
114 
115  // No copper, no technicals: no layer
116  return _( "no layers" );
117 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:759
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:362
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:467
static LSET AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
Definition: lset.cpp:829
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:505
#define _(s)
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:191
Definition: layer_ids.h:71
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
Definition: board_item.h:147

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

References FR_MATCH_WILDCARD, FR_SEARCH_REPLACE, EDA_ITEM::IsReplaceable(), next(), 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 759 of file zone.cpp.

760 {
761  // ZONEs mirror about the x-axis (why?!?)
762  m_Poly->Mirror( aMirrorLeftRight, !aMirrorLeftRight, VECTOR2I( aMirrorRef ) );
763 
764  HatchBorder();
765 
766  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
767  pair.second.Mirror( aMirrorLeftRight, !aMirrorLeftRight, VECTOR2I( aMirrorRef ) );
768 
769  for( std::pair<const PCB_LAYER_ID, std::vector<SEG> >& pair : m_FillSegmList )
770  {
771  for( SEG& seg : pair.second )
772  {
773  if( aMirrorLeftRight )
774  {
775  MIRROR( seg.A.x, aMirrorRef.x );
776  MIRROR( seg.B.x, aMirrorRef.x );
777  }
778  else
779  {
780  MIRROR( seg.A.y, aMirrorRef.y );
781  MIRROR( seg.B.y, aMirrorRef.y );
782  }
783  }
784  }
785 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:822
VECTOR2< int > VECTOR2I
Definition: vector2d.h:622
void Mirror(bool aX=true, bool aY=false, const VECTOR2I &aRef={ 0, 0 })
Mirror the line points about y or x (or both)
void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
Definition: mirror.h:40
void HatchBorder()
Compute the hatch lines depending on the hatch parameters and stores it in the zone's attribute m_bor...
Definition: zone.cpp:941
std::map< PCB_LAYER_ID, std::vector< SEG > > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: zone.h:906
Definition: seg.h:40
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
VECTOR2I A
Definition: seg.h:48
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:916
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 243 of file board_item.h.

244  {
245  Move( wxPoint( aMoveVector.x, aMoveVector.y ) );
246  }
virtual void Move(const wxPoint &aMoveVector)
Move this object.
Definition: board_item.h:238

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

686 {
687  /* move outlines */
688  m_Poly->Move( offset );
689 
690  HatchBorder();
691 
692  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
693  pair.second.Move( offset );
694 
695  for( std::pair<const PCB_LAYER_ID, std::vector<SEG> >& pair : m_FillSegmList )
696  {
697  for( SEG& seg : pair.second )
698  {
699  seg.A += VECTOR2I( offset );
700  seg.B += VECTOR2I( offset );
701  }
702  }
703 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:822
VECTOR2< int > VECTOR2I
Definition: vector2d.h:622
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:941
std::map< PCB_LAYER_ID, std::vector< SEG > > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: zone.h:906
Definition: seg.h:40
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
VECTOR2I A
Definition: seg.h:48
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:916
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 706 of file zone.cpp.

707 {
708  int next_corner;
709 
710  if( m_Poly->GetNeighbourIndexes( aEdge, nullptr, &next_corner ) )
711  {
712  m_Poly->SetVertex( aEdge, m_Poly->CVertex( aEdge ) + VECTOR2I( offset ) );
713  m_Poly->SetVertex( next_corner, m_Poly->CVertex( next_corner ) + VECTOR2I( offset ) );
714  HatchBorder();
715 
716  SetNeedRefill( true );
717  }
718 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:822
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:622
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:941
void SetNeedRefill(bool aNeedRefill)
Definition: zone.h:238

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

◆ NeedRefill()

bool ZONE::NeedRefill ( ) const
inlineinherited

Definition at line 237 of file zone.h.

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

References ZONE::m_needRefill.

◆ NewHole()

void ZONE::NewHole ( )
inlineinherited

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

Definition at line 597 of file zone.h.

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

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

235 {
236  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
237  GetClass() ) );
238 
239  return false;
240 }
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 1356 of file zone.cpp.

1357 {
1358  ZONE::operator=( aOther );
1359  return *this;
1360 }
ZONE & operator=(const ZONE &aOther)
Definition: zone.cpp:94

References ZONE::operator=().

◆ Outline() [1/2]

◆ Outline() [2/2]

const SHAPE_POLY_SET* ZONE::Outline ( ) const
inlineinherited

Definition at line 321 of file zone.h.

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

References ZONE::m_Poly.

◆ RawPolysList()

SHAPE_POLY_SET& ZONE::RawPolysList ( PCB_LAYER_ID  aLayer)
inlineinherited

Definition at line 718 of file zone.h.

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

References ZONE::m_RawPolysList.

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

◆ RemoveAllContours()

void ZONE::RemoveAllContours ( void  )
inlineinherited

Definition at line 558 of file zone.h.

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

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

805 {
806  // Ensure the requested cutout is valid
807  if( m_Poly->OutlineCount() < aOutlineIdx || m_Poly->HoleCount( aOutlineIdx ) < aHoleIdx )
808  return;
809 
810  SHAPE_POLY_SET cutPoly( m_Poly->Hole( aOutlineIdx, aHoleIdx ) );
811 
812  // Add the cutout back to the zone
814 
815  SetNeedRefill( true );
816 }
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:822
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Return the aIndex-th subpolygon in the set.
Represent a set of closed polygons.
int HoleCount(int aOutline) const
Return the reference to aIndex-th outline in the set.
void SetNeedRefill(bool aNeedRefill)
Definition: zone.h:238

References SHAPE_POLY_SET::BooleanAdd(), SHAPE_POLY_SET::Hole(), SHAPE_POLY_SET::HoleCount(), ZONE::m_Poly, SHAPE_POLY_SET::OutlineCount(), SHAPE_POLY_SET::PM_FAST, and ZONE::SetNeedRefill().

Referenced by EDIT_TOOL::Remove().

◆ Replace() [1/2]

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

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

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

Definition at line 170 of file eda_item.cpp.

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

References next(), and text.

Referenced by SCH_FIELD::Replace(), EDA_TEXT::Replace(), SCH_EDITOR_CONTROL::ReplaceAll(), 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 391 of file eda_item.h.

392  {
393  return false;
394  }

◆ Rotate() [1/2]

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

Definition at line 256 of file board_item.h.

257  {
258  Rotate( wxPoint( aRotCentre.x, aRotCentre.y ), aAngle );
259  }
virtual void Rotate(const wxPoint &aRotCentre, double aAngle)
Rotate this object.
Definition: board_item.cpp:190

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

722 {
723  aAngle = -DECIDEG2RAD( aAngle );
724 
725  m_Poly->Rotate( aAngle, VECTOR2I( aCentre ) );
726  HatchBorder();
727 
728  /* rotate filled areas: */
729  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
730  pair.second.Rotate( aAngle, VECTOR2I( aCentre ) );
731 
732  for( std::pair<const PCB_LAYER_ID, std::vector<SEG> >& pair : m_FillSegmList )
733  {
734  for( SEG& seg : pair.second )
735  {
736  wxPoint a( seg.A );
737  RotatePoint( &a, aCentre, aAngle );
738  seg.A = a;
739  wxPoint b( seg.B );
740  RotatePoint( &b, aCentre, aAngle );
741  seg.B = a;
742  }
743  }
744 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:822
void Rotate(double aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Rotate all vertices by a given angle.
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:229
VECTOR2< int > VECTOR2I
Definition: vector2d.h:622
void HatchBorder()
Compute the hatch lines depending on the hatch parameters and stores it in the zone's attribute m_bor...
Definition: zone.cpp:941
std::map< PCB_LAYER_ID, std::vector< SEG > > m_FillSegmList
Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
Definition: zone.h:906
Definition: seg.h:40
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
VECTOR2I A
Definition: seg.h:48
double DECIDEG2RAD(double deg)
Definition: trigo.h:233
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: zone.h:916
VECTOR2I B
Definition: seg.h:49

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

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

◆ Set() [1/3]

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

Definition at line 42 of file inspectable.h.

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

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

◆ Set() [2/3]

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

Definition at line 55 of file inspectable.h.

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

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

◆ Set() [3/3]

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

Definition at line 68 of file inspectable.h.

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

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

◆ SetBorderDisplayStyle()

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

Set all hatch parameters for the zone.

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

Definition at line 910 of file zone.cpp.

912 {
913  SetHatchPitch( aHatchPitch );
914  m_borderStyle = aHatchStyle;
915 
916  if( aRebuildHatch )
917  HatchBorder();
918 }
ZONE_BORDER_DISPLAY_STYLE m_borderStyle
Definition: zone.h:926
void HatchBorder()
Compute the hatch lines depending on the hatch parameters and stores it in the zone's attribute m_bor...
Definition: zone.cpp:941
void SetHatchPitch(int aPitch)
Set the hatch pitch parameter for the zone.
Definition: zone.cpp:921

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

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

◆ SetBrightened()

◆ SetCornerPosition()

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

Definition at line 574 of file zone.h.

575  {
576  SHAPE_POLY_SET::VERTEX_INDEX relativeIndices;
577 
578  // Convert global to relative indices
579  if( m_Poly->GetRelativeIndices( aCornerIndex, &relativeIndices ) )
580  {
581  if( m_Poly->CVertex( relativeIndices ).x != new_pos.x
582  || m_Poly->CVertex( relativeIndices ).y != new_pos.y )
583  {
584  SetNeedRefill( true );
585  m_Poly->SetVertex( relativeIndices, new_pos );
586  }
587  }
588  else
589  {
590  throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
591  }
592  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: zone.h:822
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the aGlobalIndex-th vertex in the poly set.
Structure to hold the necessary information in order to index a vertex on a SHAPE_POLY_SET object: th...
void SetVertex(const VERTEX_INDEX &aIndex, const VECTOR2I &aPos)
Accessor function to set the position of a specific point.
bool GetRelativeIndices(int aGlobalIdx, VERTEX_INDEX *aRelativeIndices) const
Convert a global vertex index —i.e., a number that globally identifies a vertex in a concatenated lis...
void SetNeedRefill(bool aNeedRefill)
Definition: zone.h:238

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

◆ SetCornerRadius()

void ZONE::SetCornerRadius ( unsigned int  aRadius)
inherited

Definition at line 365 of file zone.cpp.

366 {
367  if( m_cornerRadius != aRadius )
368  SetNeedRefill( true );
369 
370  m_cornerRadius = aRadius;
371 }
unsigned int m_cornerRadius
Definition: zone.h:824
void SetNeedRefill(bool aNeedRefill)
Definition: zone.h:238

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

Referenced by ZONE_SETTINGS::ExportSetting().

◆ SetCornerSmoothingType()

void ZONE::SetCornerSmoothingType ( int  aType)
inlineinherited

Definition at line 681 of file zone.h.

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

References ZONE::m_cornerSmoothingType.

Referenced by ZONE_SETTINGS::ExportSetting().

◆ SetDoNotAllowCopperPour()

◆ SetDoNotAllowFootprints()

◆ SetDoNotAllowPads()

◆ SetDoNotAllowTracks()

◆ SetDoNotAllowVias()

void ZONE::SetDoNotAllowVias ( bool  aEnable)
inlineinherited