KiCad PCB EDA Suite
ZONE_CONTAINER Class Reference

ZONE_CONTAINER handles a list of polygons defining a copper zone. More...

#include <class_zone.h>

Inheritance diagram for ZONE_CONTAINER:
BOARD_CONNECTED_ITEM BOARD_ITEM EDA_ITEM KIGFX::VIEW_ITEM MODULE_ZONE_CONTAINER

Public Member Functions

 ZONE_CONTAINER (BOARD_ITEM_CONTAINER *parent, bool aInModule=false)
 The ctor to build ZONE_CONTAINER, but comaptible with MODULE_ZONE_CONTAINER requirement. More...
 
 ZONE_CONTAINER (const ZONE_CONTAINER &aZone)
 
ZONE_CONTAINERoperator= (const ZONE_CONTAINER &aOther)
 
 ~ZONE_CONTAINER ()
 
const wxPoint GetPosition () const override
 
void SetPosition (const wxPoint &aPos) override
 
void SetPriority (unsigned aPriority)
 Function SetPriority. More...
 
unsigned GetPriority () const
 Function GetPriority. More...
 
void GetMsgPanelInfo (EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
 Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for display purposes. More...
 
void SetLayerSet (LSET aLayerSet)
 
virtual LSET GetLayerSet () const override
 Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segment or VIA physically resides. More...
 
wxString GetZoneName () const
 
void SetZoneName (const wxString &aName)
 
const EDA_RECT GetBoundingBox () const override
 Function GetBoundingBox (virtual) More...
 
int GetLocalClearance (wxString *aSource=nullptr) const override
 Function GetLocalClearance returns any local clearances set in the "classic" (ie: pre-rule) system. More...
 
bool IsOnCopperLayer () const override
 Function IsOnCopperLayer. More...
 
bool CommonLayerExists (const LSET aLayerSet) const
 Function CommonLayerExist Test if this zone shares a common layer with the given layer set. More...
 
virtual void SetLayer (PCB_LAYER_ID aLayer) override
 Function SetLayer sets the layer this item is on. More...
 
virtual PCB_LAYER_ID GetLayer () const override
 Function GetLayer returns the primary layer this item is on. More...
 
virtual bool IsOnLayer (PCB_LAYER_ID) const override
 Function IsOnLayer tests to see if this object is on the given layer. More...
 
virtual void ViewGetLayers (int aLayers[], int &aCount) const override
 Function ViewGetLayers() Returns 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 (D_PAD *aPad=NULL) const
 
void SetThermalReliefCopperBridge (int aThermalReliefCopperBridge)
 
int GetThermalReliefCopperBridge (D_PAD *aPad=NULL) const
 
double CalculateFilledArea ()
 Compute the area currently occupied by the zone fill. More...
 
double GetFilledArea ()
 Get the area currently occupied by the zone fill. More...
 
std::mutex & GetLock ()
 
bool IsFilled () const
 
void SetIsFilled (bool isFilled)
 
bool NeedRefill () const
 
void SetNeedRefill (bool aNeedRefill)
 
int GetZoneClearance () const
 
void SetZoneClearance (int aZoneClearance)
 
ZONE_CONNECTION GetPadConnection (D_PAD *aPad=NULL) const
 
void SetPadConnection (ZONE_CONNECTION aPadConnection)
 
int GetMinThickness () const
 
void SetMinThickness (int aMinThickness)
 
int GetHatchFillTypeThickness () const
 
void SetHatchFillTypeThickness (int aThickness)
 
int GetHatchFillTypeGap () const
 
void SetHatchFillTypeGap (int aStep)
 
double GetHatchFillTypeOrientation () const
 
void SetHatchFillTypeOrientation (double aStep)
 
int GetHatchFillTypeSmoothingLevel () const
 
void SetHatchFillTypeSmoothingLevel (int aLevel)
 
double GetHatchFillTypeSmoothingValue () const
 
void SetHatchFillTypeSmoothingValue (double aValue)
 
int GetSelectedCorner () const
 
void SetSelectedCorner (int aCorner)
 
void SetSelectedCorner (const wxPoint &aPosition, int aAccuracy)
 
int GetLocalFlags () const
 
void SetLocalFlags (int aFlags)
 
ZONE_SEGMENT_FILLFillSegments (PCB_LAYER_ID aLayer)
 
const ZONE_SEGMENT_FILLFillSegments (PCB_LAYER_ID aLayer) const
 
SHAPE_POLY_SETOutline ()
 
const SHAPE_POLY_SETOutline () const
 
void SetOutline (SHAPE_POLY_SET *aOutline)
 
bool HitTest (const wxPoint &aPosition, int aAccuracy=0) const override
 Function HitTest tests if a point is near an outline edge or a corner of this zone. More...
 
bool HitTestFilledArea (PCB_LAYER_ID aLayer, const wxPoint &aRefPos) const
 Function HitTestFilledArea tests 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
 Tests 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 GetColinearCorners (BOARD *aBoard, std::set< VECTOR2I > &colinearCorners)
 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 TransformSolidAreasShapesToPolygonSet (PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aCornerBuffer, int aError=ARC_HIGH_DEF) const
 Function TransformSolidAreasShapesToPolygonSet 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 TransformOutlinesShapeWithClearanceToPolygon (SHAPE_POLY_SET &aCornerBuffer, int aMinClearanceValue, std::set< VECTOR2I > *aPreserveCorners=nullptr) const
 Function TransformOutlinesShapeWithClearanceToPolygon 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, int aClearanceValue, int aError=ARC_HIGH_DEF, bool ignoreLineWidth=false) const override
 Function TransformShapeWithClearanceToPolygon 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
 Function HitTestForCorner tests if the given wxPoint is near a corner. More...
 
bool HitTestForCorner (const wxPoint &refPos, int aAccuracy) const
 Function HitTestForCorner tests if the given wxPoint is near a corner. More...
 
bool HitTestForEdge (const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
 Function HitTestForEdge tests if the given wxPoint is near a segment defined by 2 corners. More...
 
bool HitTestForEdge (const wxPoint &refPos, int aAccuracy) const
 Function HitTestForEdge tests if the given wxPoint is near a segment defined by 2 corners. More...
 
bool HitTest (const EDA_RECT &aRect, bool aContained=true, int aAccuracy=0) const override
 
bool UnFill ()
 Function UnFill Removes the zone filling. More...
 
void Move (const wxPoint &offset) override
 Function Move Move the outlines. More...
 
void MoveEdge (const wxPoint &offset, int aEdge)
 Function MoveEdge Move the outline Edge. More...
 
void Rotate (const wxPoint &centre, double angle) override
 Function Rotate Move the outlines. More...
 
virtual void Flip (const wxPoint &aCentre, bool aFlipLeftRight) override
 Function Flip Flip this object, i.e. More...
 
void Mirror (const wxPoint &aMirrorRef, bool aMirrorLeftRight)
 Function Mirror Mirror the outlines , relative to a given horizontal axis the layer is not changed. More...
 
wxString GetClass () const override
 Function GetClass returns the class name. More...
 
int GetNumCorners (void) const
 Access to m_Poly parameters. More...
 
SHAPE_POLY_SET::ITERATOR Iterate ()
 Function Iterate returns an iterator to visit all points of the zone's main outline without holes. More...
 
SHAPE_POLY_SET::ITERATOR IterateWithHoles ()
 Function IterateWithHoles returns an iterator to visit all points of the zone's main outline with holes. More...
 
SHAPE_POLY_SET::CONST_ITERATOR CIterateWithHoles () const
 Function CIterateWithHoles returns an iterator to visit all points of the zone's main outline with holes. More...
 
void RemoveAllContours (void)
 
const VECTOR2IGetCornerPosition (int aCornerIndex) const
 
void SetCornerPosition (int aCornerIndex, wxPoint new_pos)
 
void NewHole ()
 Function NewHole creates 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_HATCH_STYLE GetHatchStyle () const
 
void SetHatchStyle (ZONE_HATCH_STYLE aStyle)
 
bool IsSame (const ZONE_CONTAINER &aZoneToCompare)
 Function IsSame tests if 2 zones are equivalent: 2 zones are equivalent if they have same parameters and same outlines info, filling is not taken into account. More...
 
void ClearFilledPolysList ()
 Function ClearFilledPolysList clears the list of filled polygons. More...
 
const SHAPE_POLY_SETGetFilledPolysList (PCB_LAYER_ID aLayer) const
 Function GetFilledPolysList returns a reference to the list of filled polygons. More...
 
void CacheTriangulation ()
 (re)create a list of triangles that "fill" the solid areas. More...
 
void SetFilledPolysList (PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aPolysList)
 Function SetFilledPolysList sets the list of filled polygons. More...
 
void SetRawPolysList (PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aPolysList)
 Function SetFilledPolysList sets the list of filled polygons. More...
 
bool IsIsland (PCB_LAYER_ID aLayer, int aPolyIdx)
 Checks if a given filled polygon is an insulated island. More...
 
void SetIsIsland (PCB_LAYER_ID aLayer, int aPolyIdx)
 
bool BuildSmoothedPoly (SHAPE_POLY_SET &aSmoothedPoly, std::set< VECTOR2I > *aPreserveCorners) const
 Function GetSmoothedPoly returns a pointer to the corner-smoothed version of m_Poly. More...
 
void SetCornerSmoothingType (int aType)
 
int GetCornerSmoothingType () const
 
void SetCornerRadius (unsigned int aRadius)
 
unsigned int GetCornerRadius () const
 
bool GetFilledPolysUseThickness () const
 
void SetFilledPolysUseThickness (bool aOption)
 
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 if the zone outline is empty, this is the main outline else it is a hole inside the main outline More...
 
void AddPolygon (const SHAPE_LINE_CHAIN &aPolygon)
 
void SetFillSegments (PCB_LAYER_ID aLayer, const ZONE_SEGMENT_FILL &aSegments)
 
SHAPE_POLY_SETRawPolysList (PCB_LAYER_ID aLayer)
 
wxString GetSelectMenuText (EDA_UNITS aUnits) const override
 Function GetSelectMenuText returns the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position. More...
 
BITMAP_DEF GetMenuImage () const override
 Function GetMenuImage returns a pointer to an image to be used in menus. More...
 
EDA_ITEMClone () const override
 Function Clone creates a duplicate of this item with linked list members set to NULL. More...
 
bool GetIsKeepout () const
 Accessors to parameters used in Keepout zones: More...
 
bool GetDoNotAllowCopperPour () const
 
bool GetDoNotAllowVias () const
 
bool GetDoNotAllowTracks () const
 
bool GetDoNotAllowPads () const
 
bool GetDoNotAllowFootprints () const
 
int GetKeepouts (std::map< int, wxString > *aSources=nullptr) const
 Return a bitset of flags for keepouts. More...
 
void SetIsKeepout (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 GetHatchPitch () const
 Hatch related methods. More...
 
void SetHatch (ZONE_HATCH_STYLE aHatchStyle, int aHatchPitch, bool aRebuildHatch)
 Function SetHatch sets all hatch parameters for the zone. More...
 
void SetHatchPitch (int aPitch)
 Function SetHatchPitch sets the hatch pitch parameter for the zone. More...
 
void UnHatch ()
 Function UnHatch clears the zone's hatch. More...
 
void Hatch ()
 Function Hatch computes the hatch lines depending on the hatch parameters and stores it in the zone's attribute m_HatchLines. More...
 
const std::vector< SEG > & GetHatchLines () const
 
bool GetHV45 () const
 
void SetHV45 (bool aConstrain)
 
MD5_HASH GetHashValue (PCB_LAYER_ID aLayer)
 
void BuildHashValue (PCB_LAYER_ID aLayer)
 Build the hash value of m_FilledPolysList, and store it internally in m_filledPolysHash. More...
 
virtual void SwapData (BOARD_ITEM *aImage) override
 Swap data between aItem and aImage. More...
 
bool IsConnected () const override
 

More...
 
NETINFO_ITEMGetNet () const
 Function GetNet Returns NET_INFO object for a given item. More...
 
void SetNet (NETINFO_ITEM *aNetInfo)
 Function SetNet Sets a NET_INFO object for the item. More...
 
int GetNetCode () const
 Function GetNetCode. More...
 
bool SetNetCode (int aNetCode, bool aNoAssert=false)
 Sets net using a net code. More...
 
const wxString & GetNetname () const
 Function GetNetname. More...
 
wxString GetNetnameMsg () const
 Function GetNetnameMsg. More...
 
const wxString & GetShortNetname () const
 Function GetShortNetname. More...
 
virtual int GetClearance (BOARD_ITEM *aItem=nullptr, wxString *aSource=nullptr) const
 Function GetClearance returns the clearance in internal units. More...
 
virtual bool GetRuleClearance (BOARD_ITEM *aItem, int *aClearance, wxString *aSource) const
 Function GetRuleClearance returns any rule-based clearance. More...
 
virtual int GetLocalClearanceOverrides (wxString *aSource=nullptr) const
 Function GetLocalClearanceOverrides returns any local clearance overrides set in the "classic" (ie: pre-rule) system. More...
 
NETCLASSGetNetClass () const
 Function GetNetClassPtr returns the NETCLASS for this item. More...
 
NETCLASSGetEffectiveNetclass () const
 Function GetEffectiveNetclass returns the NETCLASS for this item, or the default netclass if none is defined. More...
 
wxString GetNetClassName () const
 Function GetNetClassName returns a pointer to the netclass of the zone. More...
 
void SetLocalRatsnestVisible (bool aVisible)
 
bool GetLocalRatsnestVisible () const
 
virtual const wxPoint GetCenter () const
 Function GetCenter() More...
 
BOARD_ITEM_CONTAINERGetParent () const
 
BOARD_ITEMDuplicate () const
 Function Duplicate creates a copy of a BOARD_ITEM. More...
 
bool IsTrack () const
 Function IsTrack tests to see if this object is a track or via (or microvia). More...
 
virtual bool IsLocked () const
 Function IsLocked. More...
 
virtual void SetLocked (bool aLocked)
 Function SetLocked modifies 'lock' status for of the item. More...
 
void DeleteStructure ()
 Function DeleteStructure deletes this object after removing from its parent if it has one. More...
 
void Move (const VECTOR2I &aMoveVector)
 
void Rotate (const VECTOR2I &aRotCentre, double aAngle)
 
void Flip (const VECTOR2I &aCentre, bool aFlipLeftRight)
 
virtual BOARDGetBoard () const
 Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none. More...
 
wxString GetLayerName () const
 Function GetLayerName returns the name of the PCB layer on which the item resides. More...
 
KICAD_T Type () const
 Function Type() 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 IsResized () const
 
bool IsBrightened () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (int type) const
 
void SetState (int type, int state)
 
STATUS_FLAGS GetStatus () const
 
void SetStatus (STATUS_FLAGS aStatus)
 
void SetFlags (STATUS_FLAGS aMask)
 
void ClearFlags (STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
STATUS_FLAGS GetFlags () const
 
bool HasFlag (STATUS_FLAGS aFlag)
 
STATUS_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
virtual bool IsType (const KICAD_T aScanTypes[]) const
 Function IsType Checks whether the item is one of the listed types. More...
 
void SetForceVisible (bool aEnable)
 Function SetForceVisible is used to set and cleag 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
 Function GetFocusPosition 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[])
 Function Visit may be re-implemented for each derived class in order to handle all the types given by its member data. More...
 
virtual bool Matches (wxFindReplaceData &aSearchData, void *aAuxData)
 Function Matches compares the item against the search criteria in aSearchData. More...
 
virtual bool Replace (wxFindReplaceData &aSearchData, void *aAuxData=NULL)
 Function Replace performs a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Function IsReplaceable. More...
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
virtual const BOX2I ViewBBox () const override
 Function ViewBBox() returns the bounding box of the item covering all its layers. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Function ViewDraw() Draws the parts of the object belonging to layer aLayer. More...
 
virtual unsigned int ViewGetLOD (int aLayer, VIEW *aView) const
 Function ViewGetLOD() Returns the level of detail (LOD) of the item. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 
void ClearViewPrivData ()
 

Static Public Member Functions

static bool ClassOf (const EDA_ITEM *aItem)
 
static int GetDefaultHatchPitch ()
 Function GetDefaultHatchPitchMils. More...
 
static wxString ShowShape (STROKE_T aShape)
 Function ShowShape converts the enum STROKE_T integer value to a wxString. More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::deque< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T ) More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::vector< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T ) More...
 
static bool Replace (wxFindReplaceData &aSearchData, wxString &aText)
 Helper function used in search and replace dialog Function Replace performs 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)
 Function Sort is a 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

void initDataFromSrcInCopyCtor (const ZONE_CONTAINER &aZone)
 Copy aZone data to me members are expected non initialize in this. More...
 
bool Matches (const wxString &aText, wxFindReplaceData &aSearchData)
 Function Matches compares aText against search criteria in aSearchData. More...
 

Static Protected Member Functions

static wxString LayerMaskDescribe (const BOARD *aBoard, LSET aMask)
 Helper function 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_isKeepout
 
bool m_doNotAllowCopperPour
 
bool m_doNotAllowVias
 
bool m_doNotAllowTracks
 
bool m_doNotAllowPads
 
bool m_doNotAllowFootprints
 
ZONE_CONNECTION m_PadConnection
 
int m_ZoneClearance
 Clearance value in internal units. More...
 
int m_ZoneMinThickness
 Minimum thickness value in filled areas. More...
 
bool m_FilledPolysUseThickness
 outline of filled polygons have thickness. More...
 
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
 Width of the copper bridge in thermal reliefs. More...
 
int m_ThermalReliefCopperBridge
 
ZONE_FILL_MODE m_FillMode
 How to fill areas: ZONE_FILL_MODE::POLYGONS => use solid polygons ZONE_FILL_MODE::HATCH_PATTERN => use a grid pattern as shape. More...
 
int m_HatchFillTypeThickness
 Grid style shape: thickness of lines (if 0 -> solid shape) More...
 
int m_HatchFillTypeGap
 Grid style shape: dist between center of lines (grid size) (0 -> solid shape) More...
 
double m_HatchFillTypeOrientation
 Grid style shape: orientation in degrees of the grid lines. More...
 
int m_HatchFillTypeSmoothingLevel
 Grid pattern smoothing type, similar to corner smoothing type 0 = no smoothing, 1 = fillet, >= 2 = arc. More...
 
double m_HatchFillTypeSmoothingValue
 Grid pattern smoothing value for smoothing shape size calculations this is the ratio between the gap and the chamfer size. More...
 
SHAPE_POLY_SET::VERTEX_INDEXm_CornerSelection
 The index of the corner being moved or nullptr if no corner is selected. More...
 
int m_localFlgs
 Variable used in polygon calculations. More...
 
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILLm_FillSegmList
 Segments used to fill the zone (m_FillMode ==1 ), when fill zone by segment is used. More...
 
std::map< PCB_LAYER_ID, SHAPE_POLY_SETm_FilledPolysList
 
std::map< PCB_LAYER_ID, SHAPE_POLY_SETm_RawPolysList
 
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_HATCH_STYLE m_hatchStyle
 
int m_hatchPitch
 
std::vector< SEGm_HatchLines
 
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
 Stores all informations about the net that item belongs to. More...
 
PCB_LAYER_ID m_Layer
 
STATUS_FLAGS m_Status
 
EDA_ITEMm_Parent
 Linked list: Link (parent struct) More...
 
bool m_forceVisible
 
STATUS_FLAGS m_Flags
 

Detailed Description

ZONE_CONTAINER handles a list of polygons defining a copper zone.

A zone is described by a main polygon, a time stamp, a layer or a lyer set, and a net name. Other polygons inside the main polygon are holes in the zone.

a item ZONE_CONTAINER is living in a board a variant MODULE_ZONE_CONTAINER is living in a footprint

Definition at line 61 of file class_zone.h.

Constructor & Destructor Documentation

◆ ZONE_CONTAINER() [1/2]

ZONE_CONTAINER::ZONE_CONTAINER ( BOARD_ITEM_CONTAINER parent,
bool  aInModule = false 
)

The ctor to build ZONE_CONTAINER, but comaptible with MODULE_ZONE_CONTAINER requirement.

if aInModule is true, a MODULE_ZONE_CONTAINER is actually built (same item, but with a specific type id: The type is PCB_ZONE_AREA_T for a ZONE_CONTAINER The type is PCB_MODULE_ZONE_AREA_T for a MODULE_ZONE_CONTAINER

Definition at line 39 of file class_zone.cpp.

41  m_area( 0.0 )
42 {
43  m_CornerSelection = nullptr; // no corner is selected
44  m_IsFilled = false; // fill status : true when the zone is filled
48  m_hv45 = false;
52  m_HatchFillTypeSmoothingLevel = 0; // Grid pattern smoothing type. 0 = no smoothing
53  m_HatchFillTypeSmoothingValue = 0.1; // Grid pattern chamfer value relative to the gap value
54  // used only if m_HatchFillTypeSmoothingLevel > 0
55  m_priority = 0;
57  SetIsKeepout( aInModule ? true : false ); // Zones living in modules have the keepout option.
58  SetDoNotAllowCopperPour( false ); // has meaning only if m_isKeepout == true
59  SetDoNotAllowVias( true ); // has meaning only if m_isKeepout == true
60  SetDoNotAllowTracks( true ); // has meaning only if m_isKeepout == true
61  SetDoNotAllowPads( true ); // has meaning only if m_isKeepout == true
62  SetDoNotAllowFootprints( false ); // has meaning only if m_isKeepout == true
63  m_cornerRadius = 0;
64  SetLocalFlags( 0 ); // flags tempoarry used in zone calculations
65  m_Poly = new SHAPE_POLY_SET(); // Outlines
66  m_FilledPolysUseThickness = true; // set the "old" way to build filled polygon areas (before 6.0.x)
68  aParent->GetZoneSettings().ExportSetting( *this );
69 
70  m_needRefill = false; // True only after some edition.
71 }
void SetDoNotAllowTracks(bool aEnable)
Definition: class_zone.h:721
ISLAND_REMOVAL_MODE m_islandRemovalMode
Definition: class_zone.h:856
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: class_zone.h:904
void SetDoNotAllowFootprints(bool aEnable)
Definition: class_zone.h:723
BOARD_CONNECTED_ITEM(BOARD_ITEM *aParent, KICAD_T idtype)
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:102
static int GetDefaultHatchPitch()
Function GetDefaultHatchPitchMils.
void SetDoNotAllowVias(bool aEnable)
Definition: class_zone.h:720
int m_HatchFillTypeSmoothingLevel
Grid pattern smoothing type, similar to corner smoothing type 0 = no smoothing, 1 = fillet,...
Definition: class_zone.h:897
SHAPE_POLY_SET.
double m_HatchFillTypeOrientation
Grid style shape: orientation in degrees of the grid lines.
Definition: class_zone.h:893
bool m_IsFilled
True when a zone was filled, false after deleting the filled areas.
Definition: class_zone.h:865
ZONE_HATCH_STYLE m_hatchStyle
Definition: class_zone.h:928
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822
unsigned m_priority
Definition: class_zone.h:835
int m_cornerSmoothingType
Definition: class_zone.h:823
double m_HatchFillTypeSmoothingValue
Grid pattern smoothing value for smoothing shape size calculations this is the ratio between the gap ...
Definition: class_zone.h:901
void SetDoNotAllowPads(bool aEnable)
Definition: class_zone.h:722
unsigned int m_cornerRadius
Definition: class_zone.h:824
void SetDoNotAllowCopperPour(bool aEnable)
Definition: class_zone.h:719
ZONE_FILL_MODE m_FillMode
How to fill areas: ZONE_FILL_MODE::POLYGONS => use solid polygons ZONE_FILL_MODE::HATCH_PATTERN => us...
Definition: class_zone.h:884
int m_HatchFillTypeThickness
Grid style shape: thickness of lines (if 0 -> solid shape)
Definition: class_zone.h:887
void SetLocalFlags(int aFlags)
Definition: class_zone.h:257
bool m_needRefill
False when a zone was refilled, true after changes in zone params.
Definition: class_zone.h:871
class ZONE_CONTAINER, managed by a footprint
Definition: typeinfo.h:95
int m_HatchFillTypeGap
Grid style shape: dist between center of lines (grid size) (0 -> solid shape)
Definition: class_zone.h:890
void SetIsKeepout(bool aEnable)
Definition: class_zone.h:718
bool m_FilledPolysUseThickness
outline of filled polygons have thickness.
Definition: class_zone.h:854

References ALWAYS, DIAGONAL_EDGE, ZONE_SETTINGS::ExportSetting(), GetDefaultHatchPitch(), BOARD_ITEM_CONTAINER::GetZoneSettings(), m_cornerRadius, m_CornerSelection, m_cornerSmoothingType, m_FilledPolysUseThickness, m_FillMode, m_HatchFillTypeGap, m_HatchFillTypeOrientation, m_HatchFillTypeSmoothingLevel, m_HatchFillTypeSmoothingValue, m_HatchFillTypeThickness, m_hatchPitch, m_hatchStyle, m_hv45, m_IsFilled, m_islandRemovalMode, m_needRefill, m_Poly, m_priority, POLYGONS, SetDoNotAllowCopperPour(), SetDoNotAllowFootprints(), SetDoNotAllowPads(), SetDoNotAllowTracks(), SetDoNotAllowVias(), SetIsKeepout(), SetLocalFlags(), and ZONE_SETTINGS::SMOOTHING_NONE.

Referenced by Clone().

◆ ZONE_CONTAINER() [2/2]

ZONE_CONTAINER::ZONE_CONTAINER ( const ZONE_CONTAINER aZone)

Definition at line 74 of file class_zone.cpp.

76 {
78 }
BOARD_CONNECTED_ITEM(BOARD_ITEM *aParent, KICAD_T idtype)
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:102
void initDataFromSrcInCopyCtor(const ZONE_CONTAINER &aZone)
Copy aZone data to me members are expected non initialize in this.
Definition: class_zone.cpp:132
BOARD_ITEM_CONTAINER * GetParent() const

References initDataFromSrcInCopyCtor().

◆ ~ZONE_CONTAINER()

ZONE_CONTAINER::~ZONE_CONTAINER ( )

Definition at line 125 of file class_zone.cpp.

126 {
127  delete m_Poly;
128  delete m_CornerSelection;
129 }
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: class_zone.h:904
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822

References m_CornerSelection, and m_Poly.

Member Function Documentation

◆ AddPolygon() [1/2]

void ZONE_CONTAINER::AddPolygon ( std::vector< wxPoint > &  aPolygon)

add a polygon to the zone outline if the zone outline is empty, this is the main outline else it is a hole inside the main outline

Definition at line 877 of file class_zone.cpp.

878 {
879  if( aPolygon.empty() )
880  return;
881 
882  SHAPE_LINE_CHAIN outline;
883 
884  // Create an outline and populate it with the points of aPolygon
885  for( const wxPoint& pt : aPolygon)
886  outline.Append( pt );
887 
888  outline.SetClosed( true );
889 
890  AddPolygon( outline );
891 }
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
void SetClosed(bool aClosed)
Function SetClosed()
void AddPolygon(std::vector< wxPoint > &aPolygon)
add a polygon to the zone outline if the zone outline is empty, this is the main outline else it is a...
Definition: class_zone.cpp:877
SHAPE_LINE_CHAIN.

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

Referenced by EAGLE_PLUGIN::loadPolygon().

◆ AddPolygon() [2/2]

void ZONE_CONTAINER::AddPolygon ( const SHAPE_LINE_CHAIN aPolygon)

Definition at line 863 of file class_zone.cpp.

864 {
865  wxASSERT( aPolygon.IsClosed() );
866 
867  // Add the outline as a new polygon in the polygon set
868  if( m_Poly->OutlineCount() == 0 )
869  m_Poly->AddOutline( aPolygon );
870  else
871  m_Poly->AddHole( aPolygon );
872 
873  SetNeedRefill( true );
874 }
int OutlineCount() const
Returns the number of outlines in the set
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822
int AddHole(const SHAPE_LINE_CHAIN &aHole, int aOutline=-1)
Adds a new hole to the given outline (default: last) and returns its index
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new outline to the set and returns its index
bool IsClosed() const
Function IsClosed()
void SetNeedRefill(bool aNeedRefill)
Definition: class_zone.h:189

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

◆ AppendCorner()

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

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

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

Definition at line 894 of file class_zone.cpp.

895 {
896  // Ensure the main outline exists:
897  if( m_Poly->OutlineCount() == 0 )
898  m_Poly->NewOutline();
899 
900  // If aHoleIdx >= 0, the corner musty be added to the hole, index aHoleIdx.
901  // (remember: the index of the first hole is 0)
902  // Return error if if does dot exist.
903  if( aHoleIdx >= m_Poly->HoleCount( 0 ) )
904  return false;
905 
906  m_Poly->Append( aPosition.x, aPosition.y, -1, aHoleIdx, aAllowDuplication );
907 
908  SetNeedRefill( true );
909 
910  return true;
911 }
int OutlineCount() const
Returns the number of outlines in the set
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822
int NewOutline()
Creates a new empty polygon in the set and returns its index
int HoleCount(int aOutline) const
Returns the number of holes in a given outline
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)
void SetNeedRefill(bool aNeedRefill)
Definition: class_zone.h:189

References SHAPE_POLY_SET::Append(), SHAPE_POLY_SET::HoleCount(), m_Poly, SHAPE_POLY_SET::NewOutline(), SHAPE_POLY_SET::OutlineCount(), SetNeedRefill(), wxPoint::x, and wxPoint::y.

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

◆ BuildHashValue()

void ZONE_CONTAINER::BuildHashValue ( PCB_LAYER_ID  aLayer)
inline

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

800  {
801  if( !m_FilledPolysList.count( aLayer ) )
802  return;
803 
804  m_filledPolysHash[aLayer] = m_FilledPolysList.at( aLayer ).GetHash();
805  }
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: class_zone.h:926
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:922

References m_filledPolysHash, and m_FilledPolysList.

◆ BuildSmoothedPoly()

bool ZONE_CONTAINER::BuildSmoothedPoly ( SHAPE_POLY_SET aSmoothedPoly,
std::set< VECTOR2I > *  aPreserveCorners 
) const

Function GetSmoothedPoly returns a pointer to the corner-smoothed version of m_Poly.

Parameters
aPreserveCorners- set of corners which should /not/ be smoothed
Returns
SHAPE_POLY_SET* - pointer to the polygon.

Definition at line 1231 of file class_zone.cpp.

1233 {
1234  if( GetNumCorners() <= 2 ) // malformed zone. polygon calculations do not like it ...
1235  return false;
1236 
1237  // Make a smoothed polygon out of the user-drawn polygon if required
1238  switch( m_cornerSmoothingType )
1239  {
1241  aSmoothedPoly = m_Poly->Chamfer( m_cornerRadius, aPreserveCorners );
1242  break;
1243 
1245  {
1246  auto board = GetBoard();
1247  int maxError = ARC_HIGH_DEF;
1248 
1249  if( board )
1250  maxError = board->GetDesignSettings().m_MaxError;
1251 
1252  aSmoothedPoly = m_Poly->Fillet( m_cornerRadius, maxError, aPreserveCorners );
1253  break;
1254  }
1255  default:
1256  // Acute angles between adjacent edges can create issues in calculations,
1257  // in inflate/deflate outlines transforms, especially when the angle is very small.
1258  // We can avoid issues by creating a very small chamfer which remove acute angles,
1259  // or left it without chamfer and use only CPOLYGONS_LIST::InflateOutline to create
1260  // clearance areas
1261  aSmoothedPoly = m_Poly->Chamfer( Millimeter2iu( 0.0 ), aPreserveCorners );
1262  break;
1263  }
1264 
1265  return true;
1266 };
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
int m_cornerSmoothingType
Definition: class_zone.h:823
int GetNumCorners(void) const
Access to m_Poly parameters.
Definition: class_zone.h:477
unsigned int m_cornerRadius
Definition: class_zone.h:824
SHAPE_POLY_SET Fillet(int aRadius, int aErrorMax, std::set< VECTOR2I > *aPreserveCorners=nullptr)
Function Fillet returns a filleted version of the polygon set.
SHAPE_POLY_SET Chamfer(int aDistance, std::set< VECTOR2I > *aPreserveCorners=nullptr)
Function Chamfer returns a chamfered version of the polygon set.

References SHAPE_POLY_SET::Chamfer(), SHAPE_POLY_SET::Fillet(), BOARD_ITEM::GetBoard(), GetNumCorners(), m_cornerRadius, m_cornerSmoothingType, m_Poly, ZONE_SETTINGS::SMOOTHING_CHAMFER, and ZONE_SETTINGS::SMOOTHING_FILLET.

Referenced by ZONE_FILLER::fillSingleZone(), PNS_KICAD_IFACE_BASE::syncZone(), DRC::testZones(), and TransformOutlinesShapeWithClearanceToPolygon().

◆ CacheTriangulation()

void ZONE_CONTAINER::CacheTriangulation ( )

(re)create a list of triangles that "fill" the solid areas.

used for instance to draw these solid areas on opengl

Definition at line 1164 of file class_zone.cpp.

1165 {
1166  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
1167  pair.second.CacheTriangulation();
1168 }
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:922

References m_FilledPolysList.

◆ CalculateFilledArea()

double ZONE_CONTAINER::CalculateFilledArea ( )

Compute the area currently occupied by the zone fill.

Returns
the currently filled area

Definition at line 1269 of file class_zone.cpp.

1270 {
1271  m_area = 0.0;
1272 
1273  // Iterate over each outline polygon in the zone and then iterate over
1274  // each hole it has to compute the total area.
1275  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
1276  {
1277  SHAPE_POLY_SET& poly = pair.second;
1278 
1279  for( int i = 0; i < poly.OutlineCount(); i++ )
1280  {
1281  m_area += poly.Outline( i ).Area();
1282 
1283  for( int j = 0; j < poly.HoleCount( i ); j++ )
1284  {
1285  m_area -= poly.Hole( i, j ).Area();
1286  }
1287  }
1288  }
1289 
1290  return m_area;
1291 }
int OutlineCount() const
Returns the number of outlines in the set
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Returns the reference to aHole-th hole in the aIndex-th outline
SHAPE_POLY_SET.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Returns the reference to aIndex-th outline in the set
int HoleCount(int aOutline) const
Returns the number of holes in a given outline
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:922

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

◆ CIterateWithHoles()

SHAPE_POLY_SET::CONST_ITERATOR ZONE_CONTAINER::CIterateWithHoles ( ) const
inline

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

Returns
SHAPE_POLY_SET::ITERATOR - an iterator to visit the zone vertices with holes.

Definition at line 507 of file class_zone.h.

508  {
509  return m_Poly->CIterateWithHoles();
510  }
CONST_ITERATOR CIterateWithHoles(int aOutline) const
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822

References SHAPE_POLY_SET::CIterateWithHoles(), and m_Poly.

◆ ClassOf()

static bool ZONE_CONTAINER::ClassOf ( const EDA_ITEM aItem)
inlinestatic

Definition at line 80 of file class_zone.h.

81  {
82  return aItem && aItem->Type() == PCB_ZONE_AREA_T;
83  }
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:102
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References PCB_ZONE_AREA_T, and EDA_ITEM::Type().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

◆ ClearEditFlags()

◆ ClearFilledPolysList()

void ZONE_CONTAINER::ClearFilledPolysList ( )
inline

Function ClearFilledPolysList clears the list of filled polygons.

Definition at line 588 of file class_zone.h.

589  {
590  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
591  {
592  m_insulatedIslands[pair.first].clear();
593  pair.second.RemoveAllContours();
594  }
595  }
std::map< PCB_LAYER_ID, std::set< int > > m_insulatedIslands
For each layer, a set of insulated islands that were not removed.
Definition: class_zone.h:933
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:922

References m_FilledPolysList, and m_insulatedIslands.

Referenced by POINT_EDITOR::updateItem().

◆ ClearFlags()

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

Definition at line 233 of file base_struct.h.

233 { m_Flags &= ~aMask; }
STATUS_FLAGS m_Flags
Definition: base_struct.h:176

References EDA_ITEM::m_Flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_SCREEN::ClearAnnotation(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), clearModuleItemFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), SCH_EDIT_FRAME::ConvertPart(), LIB_EDIT_TOOL::Copy(), MICROWAVE_TOOL::createMicrowaveInductor(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), KIGFX::SCH_PAINTER::draw(), LIB_EDIT_TOOL::Duplicate(), SCH_ITEM::Duplicate(), PCB_EDIT_FRAME::Exchange_Module(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), FOOTPRINT_EDIT_FRAME::LoadModuleFromLibrary(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), PCB_BASE_FRAME::PlaceModule(), LIB_PIN_TOOL::PlacePin(), DRAWING_TOOL::PlaceText(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_PIN_TOOL::RepeatPin(), LIB_EDIT_FRAME::RollbackPartFromUndo(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN_CACHE::savePin(), SCH_LEGACY_PLUGIN_CACHE::savePin(), EE_SELECTION_TOOL::SelectPoint(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 245 of file base_struct.h.

246  {
248  DO_NOT_DRAW );
249  }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:114
#define TEMP_SELECTED
flag indicating that the structure has already selected
Definition: base_struct.h:125
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: base_struct.h:128
#define CANDIDATE
flag indicating that the structure is connected
Definition: base_struct.h:127
#define ENDPOINT
ends. (Used to support dragging.)
Definition: base_struct.h:123
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:233
#define DO_NOT_DRAW
Used to disable draw function.
Definition: base_struct.h:129
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: base_struct.h:122

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

154  {
156  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:161
#define NULL

References KIGFX::VIEW_ITEM::m_viewPrivData, and NULL.

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

◆ Clone()

EDA_ITEM * ZONE_CONTAINER::Clone ( ) const
overridevirtual

Function Clone creates a duplicate of this item with linked list members set to NULL.

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

Returns
A clone of the item.

Reimplemented from EDA_ITEM.

Reimplemented in MODULE_ZONE_CONTAINER.

Definition at line 202 of file class_zone.cpp.

203 {
204  return new ZONE_CONTAINER( *this );
205 }
ZONE_CONTAINER(BOARD_ITEM_CONTAINER *parent, bool aInModule=false)
The ctor to build ZONE_CONTAINER, but comaptible with MODULE_ZONE_CONTAINER requirement.
Definition: class_zone.cpp:39

References ZONE_CONTAINER().

◆ CommonLayerExists()

bool ZONE_CONTAINER::CommonLayerExists ( const LSET  aLayerSet) const

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

Definition at line 248 of file class_zone.cpp.

249 {
250  LSET common = GetLayerSet() & aLayerSet;
251 
252  return common.count() > 0;
253 }
virtual LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_zone.cpp:312
LSET is a set of PCB_LAYER_IDs.

References GetLayerSet().

Referenced by DRC_KEEPOUT_TESTER::checkFootprints(), and DRC_KEEPOUT_TESTER::checkPads().

◆ DeleteStructure()

void BOARD_ITEM::DeleteStructure ( )
inherited

Function DeleteStructure deletes this object after removing from its parent if it has one.

Definition at line 124 of file class_board_item.cpp.

125 {
126  auto parent = GetParent();
127 
128  if( parent )
129  parent->Remove( this );
130 
131  delete this;
132 }
BOARD_ITEM_CONTAINER * GetParent() const

References BOARD_ITEM::GetParent().

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

◆ Duplicate()

BOARD_ITEM* BOARD_ITEM::Duplicate ( ) const
inlineinherited

Function Duplicate creates a copy of a BOARD_ITEM.

Definition at line 170 of file class_board_item.h.

171  {
172  EDA_ITEM* dupe = Clone();
173  const_cast<KIID&>( dupe->m_Uuid ) = KIID();
174 
175  return static_cast<BOARD_ITEM*>( dupe );
176  }
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: common.h:68
const KIID m_Uuid
Definition: base_struct.h:162
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159

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

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), EDIT_TOOL::Duplicate(), GPCB_PLUGIN::FootprintLoad(), PCB_IO::FootprintLoad(), PCB_IO::FootprintSave(), ARRAY_CREATOR::Invoke(), and FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD().

◆ FillSegments() [1/2]

ZONE_SEGMENT_FILL& ZONE_CONTAINER::FillSegments ( PCB_LAYER_ID  aLayer)
inline

Definition at line 259 of file class_zone.h.

260  {
261  wxASSERT( m_FillSegmList.count( aLayer ) );
262  return m_FillSegmList.at( aLayer );
263  }
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:912

References m_FillSegmList.

Referenced by PCB_IO::format().

◆ FillSegments() [2/2]

const ZONE_SEGMENT_FILL& ZONE_CONTAINER::FillSegments ( PCB_LAYER_ID  aLayer) const
inline

Definition at line 265 of file class_zone.h.

266  {
267  wxASSERT( m_FillSegmList.count( aLayer ) );
268  return m_FillSegmList.at( aLayer );
269  }
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:912

References m_FillSegmList.

◆ Flip() [1/2]

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

Definition at line 286 of file class_board_item.h.

287  {
288  Flip( wxPoint( aCentre.x, aCentre.y ), aFlipLeftRight );
289  }
virtual void Flip(const wxPoint &aCentre, bool aFlipLeftRight)
Function Flip Flip this object, i.e.

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

◆ Flip() [2/2]

void ZONE_CONTAINER::Flip ( const wxPoint aCentre,
bool  aFlipLeftRight 
)
overridevirtual

Function Flip Flip this object, i.e.

change the board side for this object (like Mirror() but changes layer)

Parameters
aCentre- the rotation point.

Reimplemented from BOARD_ITEM.

Definition at line 798 of file class_zone.cpp.

799 {
800  Mirror( aCentre, aFlipLeftRight );
801  int copperLayerCount = GetBoard()->GetCopperLayerCount();
802 
803  if( GetIsKeepout() )
804  SetLayerSet( FlipLayerMask( GetLayerSet(), copperLayerCount ) );
805  else
806  SetLayer( FlipLayer( GetLayer(), copperLayerCount ) );
807 }
void Mirror(const wxPoint &aMirrorRef, bool aMirrorLeftRight)
Function Mirror Mirror the outlines , relative to a given horizontal axis the layer is not changed.
Definition: class_zone.cpp:810
LSET FlipLayerMask(LSET aMask, int aCopperLayersCount)
Calculate the mask layer when flipping a footprint BACK and FRONT copper layers, mask,...
Definition: lset.cpp:531
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Function FlippedLayerNumber.
Definition: lset.cpp:485
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:236
virtual LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_zone.cpp:312
void SetLayerSet(LSET aLayerSet)
Definition: class_zone.cpp:264
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Function SetLayer sets the layer this item is on.
Definition: class_zone.cpp:256
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:702
int GetCopperLayerCount() const
Function GetCopperLayerCount.

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

◆ GetBoard()

BOARD * BOARD_ITEM::GetBoard ( ) const
virtualinherited

Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.

Definition at line 54 of file class_board_item.cpp.

55 {
56  if( Type() == PCB_T )
57  return (BOARD*) this;
58 
59  BOARD_ITEM* parent = GetParent();
60 
61  if( parent )
62  return parent->GetBoard();
63 
64  return NULL;
65 }
Definition: typeinfo.h:85
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
#define NULL
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:180
BOARD_ITEM_CONTAINER * GetParent() const
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

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

Referenced by D_PAD::BuildEffectiveShapes(), BuildSmoothedPoly(), DRC::checkClearanceSegmToPad(), TEXTE_PCB::Flip(), TRACK::Flip(), ARC::Flip(), VIA::Flip(), Flip(), BOARD_ITEM::GetBoard(), MODULE::GetBoundingPoly(), BOARD_CONNECTED_ITEM::GetClearance(), BOARD_CONNECTED_ITEM::GetEffectiveNetclass(), BOARD_ITEM::GetLayerName(), VIA::GetMinAnnulus(), PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), GetMsgPanelInfo(), TRACK::GetMsgPanelInfo(), NETINFO_ITEM::GetMsgPanelInfo(), VIA::GetMsgPanelInfo(), D_PAD::GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), GetRule(), VIA::GetSelectMenuText(), D_PAD::GetSelectMenuText(), GetSelectMenuText(), D_PAD::GetSolderMaskMargin(), D_PAD::GetSolderPasteMargin(), BOARD::GetTrackLength(), TRACK::GetWidthConstraints(), D_PAD::MergePrimitivesAsPolygon(), EAGLE_PLUGIN::packageWire(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), BOARD_CONNECTED_ITEM::SetNet(), BOARD_CONNECTED_ITEM::SetNetCode(), TransformOutlinesShapeWithClearanceToPolygon(), TransformSolidAreasShapesToPolygonSet(), MODULE::ViewBBox(), and D_PAD::ViewGetLOD().

◆ GetBoundingBox()

const EDA_RECT ZONE_CONTAINER::GetBoundingBox ( ) const
overridevirtual

Function GetBoundingBox (virtual)

Returns
an EDA_RECT that is the bounding box of the zone outline

Reimplemented from EDA_ITEM.

Definition at line 335 of file class_zone.cpp.

336 {
337  auto bb = m_Poly->BBox();
338 
339  EDA_RECT ret( (wxPoint) bb.GetOrigin(), wxSize( bb.GetWidth(), bb.GetHeight() ) );
340 
341  return ret;
342 }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
const BOX2I BBox(int aClearance=0) const override
Function BBox()

References SHAPE_POLY_SET::BBox(), and m_Poly.

Referenced by ZONE_FILLER::buildCopperItemClearances(), ZONE_FILLER::buildThermalSpokes(), hasThermalConnection(), HitTest(), and ALTIUM_PCB::ParsePolygons6Data().

◆ GetCenter()

virtual const wxPoint BOARD_ITEM::GetCenter ( ) const
inlinevirtualinherited

Function GetCenter()

This defaults to the same point as returned by GetPosition(), unless overridden

Returns
centre point of the item

Reimplemented in DRAWSEGMENT.

Definition at line 109 of file class_board_item.h.

109 { return GetPosition(); }
virtual const wxPoint GetPosition() const
Definition: base_struct.h:337

References EDA_ITEM::GetPosition().

Referenced by BOARD_ADAPTER::createNewTrack(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), KIGFX::PCB_PAINTER::draw(), export_vrml_tracks(), PlotStandardLayer(), and TRACK::TransformShapeWithClearanceToPolygon().

◆ GetClass()

wxString ZONE_CONTAINER::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Implements EDA_ITEM.

Definition at line 470 of file class_zone.h.

471  {
472  return wxT( "ZONE_CONTAINER" );
473  }

◆ GetClearance()

int BOARD_CONNECTED_ITEM::GetClearance ( BOARD_ITEM aItem = nullptr,
wxString *  aSource = nullptr 
) const
virtualinherited

Function GetClearance returns the clearance in internal units.

If aItem is not NULL then the returned clearance is the greater of this object's NETCLASS clearance and aItem's NETCLASS clearance. If aItem is NULL, then this objects clearance is returned.

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

Definition at line 94 of file board_connected_item.cpp.

95 {
96  BOARD* board = GetBoard();
97  int clearance = 0;
98  wxString source;
99  wxString* localSource = aSource ? &source : nullptr;
100  BOARD_CONNECTED_ITEM* second = dynamic_cast<BOARD_CONNECTED_ITEM*>( aItem );
101 
102  // No clearance if "this" is not (yet) linked to a board therefore no available netclass
103  if( !board )
104  return clearance;
105 
106  // LEVEL 1: local overrides (pad, footprint, etc.)
107  //
108  if( GetLocalClearanceOverrides() > clearance )
109  clearance = GetLocalClearanceOverrides( localSource );
110 
111  if( second && second->GetLocalClearanceOverrides() > clearance )
112  clearance = second->GetLocalClearanceOverrides( localSource );
113 
114  if( clearance )
115  {
116  if( aSource )
117  *aSource = *localSource;
118 
119  return clearance;
120  }
121 
122  // LEVEL 2: Rules
123  //
124  if( GetRuleClearance( aItem, &clearance, aSource ) )
125  return clearance;
126 
127  // LEVEL 3: Accumulated local settings, netclass settings, & board design settings
128  //
130  NETCLASS* netclass = GetEffectiveNetclass();
131  NETCLASS* secondNetclass = second ? second->GetEffectiveNetclass() : nullptr;
132 
133  if( bds.m_MinClearance > clearance )
134  {
135  if( aSource )
136  *aSource = _( "board minimum" );
137 
138  clearance = bds.m_MinClearance;
139  }
140 
141  if( netclass && netclass->GetClearance() > clearance )
142  clearance = netclass->GetClearance( aSource );
143 
144  if( secondNetclass && secondNetclass->GetClearance() > clearance )
145  clearance = secondNetclass->GetClearance( aSource );
146 
147  if( aItem && aItem->GetLayer() == Edge_Cuts && bds.m_CopperEdgeClearance > clearance )
148  {
149  if( aSource )
150  *aSource = _( "board edge" );
151 
152  clearance = bds.m_CopperEdgeClearance;
153  }
154 
155  if( GetLocalClearance() > clearance )
156  clearance = GetLocalClearance( aSource );
157 
158  if( second && second->GetLocalClearance() > clearance )
159  clearance = second->GetLocalClearance( aSource );
160 
161  return clearance;
162 }
virtual int GetLocalClearance(wxString *aSource=nullptr) const
Function GetLocalClearance returns any local clearances set in the "classic" (ie: pre-rule) system.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:551
int GetClearance(wxString *aSource=nullptr) const
Definition: netclass.h:162
BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected and have...
NETCLASS handles a collection of nets and the parameters used to route or test these nets.
Definition: netclass.h:55
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
virtual int GetLocalClearanceOverrides(wxString *aSource=nullptr) const
Function GetLocalClearanceOverrides returns any local clearance overrides set in the "classic" (ie: p...
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:180
#define _(s)
Definition: 3d_actions.cpp:33
NETCLASS * GetEffectiveNetclass() const
Function GetEffectiveNetclass returns the NETCLASS for this item, or the default netclass if none is ...
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
virtual bool GetRuleClearance(BOARD_ITEM *aItem, int *aClearance, wxString *aSource) const
Function GetRuleClearance returns any rule-based clearance.
BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.

References _, Edge_Cuts, BOARD_ITEM::GetBoard(), NETCLASS::GetClearance(), BOARD::GetDesignSettings(), BOARD_CONNECTED_ITEM::GetEffectiveNetclass(), BOARD_ITEM::GetLayer(), BOARD_CONNECTED_ITEM::GetLocalClearance(), BOARD_CONNECTED_ITEM::GetLocalClearanceOverrides(), BOARD_CONNECTED_ITEM::GetRuleClearance(), BOARD_DESIGN_SETTINGS::m_CopperEdgeClearance, and BOARD_DESIGN_SETTINGS::m_MinClearance.

Referenced by GERBER_JOBFILE_WRITER::addJSONDesignRules(), ZONE_FILLER::buildCopperItemClearances(), DRC::doPadToPadsDrc(), DRC::doTrackDrc(), KIGFX::PCB_PAINTER::draw(), GetMsgPanelInfo(), TRACK::GetMsgPanelInfo(), VIA::GetMsgPanelInfo(), D_PAD::GetMsgPanelInfo(), DRC::testZones(), and TRACK::ViewBBox().

◆ GetColinearCorners()

void ZONE_CONTAINER::GetColinearCorners ( BOARD aBoard,
std::set< VECTOR2I > &  colinearCorners 
)

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 want to keep the corners of such intersections sharp.

Definition at line 1188 of file class_zone.cpp.

1189 {
1190  int epsilon = Millimeter2iu( 0.001 );
1191 
1192  // Things get messy when zone of different nets intersect. To do it right we'd need to
1193  // run our colinear test with the final filled regions rather than the outline regions.
1194  // However, since there's no order dependance the only way to do that is to iterate
1195  // through successive zone fills until the results are no longer changing -- and that's
1196  // not going to happen. So we punt and ignore any "messy" corners.
1197  std::set<VECTOR2I> colinearCorners;
1198  std::set<VECTOR2I> messyCorners;
1199 
1200  for( ZONE_CONTAINER* candidate : aBoard->Zones() )
1201  {
1202  if( candidate == this )
1203  continue;
1204 
1205  if( candidate->GetLayerSet() != GetLayerSet() )
1206  continue;
1207 
1208  if( candidate->GetIsKeepout() != GetIsKeepout() )
1209  continue;
1210 
1211  for( auto iter = m_Poly->CIterate(); iter; iter++ )
1212  {
1213  if( candidate->m_Poly->Collide( iter.Get(), epsilon ) )
1214  {
1215  if( candidate->GetNetCode() == GetNetCode() )
1216  colinearCorners.insert( VECTOR2I( iter.Get() ) );
1217  else
1218  messyCorners.insert( VECTOR2I( iter.Get() ) );
1219  }
1220  }
1221  }
1222 
1223  for( VECTOR2I corner : colinearCorners )
1224  {
1225  if( messyCorners.count( corner ) == 0 )
1226  aCorners.insert( corner );
1227  }
1228 }
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
int GetNetCode() const
Function GetNetCode.
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
virtual LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_zone.cpp:312
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822
CONST_ITERATOR CIterate(int aFirst, int aLast, bool aIterateHoles=false) const
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:702
ZONE_CONTAINERS & Zones()
Definition: class_board.h:280

References SHAPE_POLY_SET::CIterate(), GetIsKeepout(), GetLayerSet(), BOARD_CONNECTED_ITEM::GetNetCode(), m_Poly, and BOARD::Zones().

Referenced by ZONE_FILLER::fillSingleZone(), PNS_KICAD_IFACE_BASE::syncZone(), and DRC::testZones().

◆ GetCornerPosition()

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

Definition at line 517 of file class_zone.h.

518  {
520 
521  // Convert global to relative indices
522  if( !m_Poly->GetRelativeIndices( aCornerIndex, &index ) )
523  throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
524 
525  return m_Poly->CVertex( index );
526  }
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Returns the index-th vertex in a given hole outline within a given outline
Struct VERTEX_INDEX.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822
bool GetRelativeIndices(int aGlobalIdx, VERTEX_INDEX *aRelativeIndices) const
Function GetRelativeIndices.

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

Referenced by GetPosition().

◆ GetCornerRadius()

unsigned int ZONE_CONTAINER::GetCornerRadius ( ) const
inline

◆ GetCornerSmoothingType()

int ZONE_CONTAINER::GetCornerSmoothingType ( ) const
inline

Definition at line 655 of file class_zone.h.

655 { return m_cornerSmoothingType; }
int m_cornerSmoothingType
Definition: class_zone.h:823

References m_cornerSmoothingType.

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

◆ GetDefaultHatchPitch()

◆ GetDoNotAllowCopperPour()

bool ZONE_CONTAINER::GetDoNotAllowCopperPour ( ) const
inline

◆ GetDoNotAllowFootprints()

bool ZONE_CONTAINER::GetDoNotAllowFootprints ( ) const
inline

◆ GetDoNotAllowPads()

bool ZONE_CONTAINER::GetDoNotAllowPads ( ) const
inline

◆ GetDoNotAllowTracks()

bool ZONE_CONTAINER::GetDoNotAllowTracks ( ) const
inline

◆ GetDoNotAllowVias()

bool ZONE_CONTAINER::GetDoNotAllowVias ( ) const
inline

◆ GetEditFlags()

STATUS_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 237 of file base_struct.h.

238  {
239  constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVED | IS_RESIZED | IS_DRAGGED |
241 
242  return m_Flags & mask;
243  }
#define IS_NEW
New item, just created.
Definition: base_struct.h:117
#define IS_DRAGGED
Item being dragged.
Definition: base_struct.h:119
#define STRUCT_DELETED
flag indication structures to be erased
Definition: base_struct.h:126
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:121
STATUS_FLAGS m_Flags
Definition: base_struct.h:176
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:118
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
Definition: base_struct.h:130
#define IS_MOVED
Item being moved.
Definition: base_struct.h:116

References IS_DRAGGED, IS_MOVED, IS_NEW, IS_PASTED, IS_RESIZED, IS_WIRE_IMAGE, EDA_ITEM::m_Flags, and STRUCT_DELETED.

Referenced by SCH_EDIT_TOOL::ChangeTextType(), EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_TOOL::editFieldText(), SCH_EDITOR_CONTROL::EditWithLibEdit(), SCH_COMPONENT::GetMsgPanelInfo(), LIB_MOVE_TOOL::Main(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), PAD_TOOL::recombinePad(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_EDIT_PIN::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), and SCH_EDIT_FRAME::TrimWire().

◆ GetEffectiveNetclass()

NETCLASS * BOARD_CONNECTED_ITEM::GetEffectiveNetclass ( ) const
inherited

Function GetEffectiveNetclass returns 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 75 of file board_connected_item.cpp.

76 {
77  // NB: we must check the net first, as when it is 0 GetNetClass() will return the
78  // orphaned net netclass, not the default netclass.
79  if( m_netinfo->GetNet() == 0 )
81  else
82  return GetNetClass();
83 }
NETCLASS * GetNetClass() const
Function GetNetClassPtr returns the NETCLASS for this item.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:551
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
int GetNet() const
Function GetNet.
Definition: netinfo.h:223
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.
NETCLASS * GetDefault() const
Function GetDefault.

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

Referenced by BOARD_CONNECTED_ITEM::GetClearance().

◆ GetFilledArea()

double ZONE_CONTAINER::GetFilledArea ( )
inline

Get the area currently occupied by the zone fill.

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

Returns
the filled area

Definition at line 175 of file class_zone.h.

176  {
177  return m_area;
178  }

References m_area.

◆ GetFilledPolysList()

const SHAPE_POLY_SET& ZONE_CONTAINER::GetFilledPolysList ( PCB_LAYER_ID  aLayer) const
inline

Function GetFilledPolysList returns a reference to the list of filled polygons.

Returns
Reference to the list of filled polygons.

Definition at line 602 of file class_zone.h.

603  {
604  wxASSERT( m_FilledPolysList.count( aLayer ) );
605  return m_FilledPolysList.at( aLayer );
606  }
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:922

References m_FilledPolysList.

Referenced by CN_LIST::Add(), BOARD_ADAPTER::AddSolidAreasShapesToContainer(), CN_ZONE::CN_ZONE(), KIGFX::PCB_PAINTER::draw(), export_vrml_zones(), CN_CONNECTIVITY_ALGO::FindIsolatedCopperIslands(), PCB_IO::format(), DRC::GetLocation(), and ALTIUM_PCB::ParseRegions6Data().

◆ GetFilledPolysUseThickness()

bool ZONE_CONTAINER::GetFilledPolysUseThickness ( ) const
inline

◆ GetFillMode()

ZONE_FILL_MODE ZONE_CONTAINER::GetFillMode ( ) const
inline

Definition at line 148 of file class_zone.h.

148 { return m_FillMode; }
ZONE_FILL_MODE m_FillMode
How to fill areas: ZONE_FILL_MODE::POLYGONS => use solid polygons ZONE_FILL_MODE::HATCH_PATTERN => us...
Definition: class_zone.h:884

References m_FillMode.

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

◆ GetFlags()

◆ GetFocusPosition()

virtual const wxPoint EDA_ITEM::GetFocusPosition ( ) const
inlinevirtualinherited

Function GetFocusPosition similar to GetPosition, but allows items to return their visual center rather than their anchor.

Reimplemented in DRAWSEGMENT, and TRACK.

Definition at line 344 of file base_struct.h.

344 { return GetPosition(); }
virtual const wxPoint GetPosition() const
Definition: base_struct.h:337

References EDA_ITEM::GetPosition().

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

◆ GetHashValue()

MD5_HASH ZONE_CONTAINER::GetHashValue ( PCB_LAYER_ID  aLayer)
inline
Returns
the hash value previously calculated by BuildHashValue(). used in zone filling calculations

Definition at line 787 of file class_zone.h.

788  {
789  if( !m_filledPolysHash.count( aLayer ) )
790  return MD5_HASH();
791 
792  return m_filledPolysHash.at( aLayer );
793  }
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: class_zone.h:926

References m_filledPolysHash.

◆ GetHatchFillTypeGap()

int ZONE_CONTAINER::GetHatchFillTypeGap ( ) const
inline

Definition at line 213 of file class_zone.h.

213 { return m_HatchFillTypeGap; }
int m_HatchFillTypeGap
Grid style shape: dist between center of lines (grid size) (0 -> solid shape)
Definition: class_zone.h:890

References m_HatchFillTypeGap.

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

◆ GetHatchFillTypeOrientation()

double ZONE_CONTAINER::GetHatchFillTypeOrientation ( ) const
inline

Definition at line 216 of file class_zone.h.

216 { return m_HatchFillTypeOrientation; }
double m_HatchFillTypeOrientation
Grid style shape: orientation in degrees of the grid lines.
Definition: class_zone.h:893

References m_HatchFillTypeOrientation.

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

◆ GetHatchFillTypeSmoothingLevel()

int ZONE_CONTAINER::GetHatchFillTypeSmoothingLevel ( ) const
inline

Definition at line 219 of file class_zone.h.

int m_HatchFillTypeSmoothingLevel
Grid pattern smoothing type, similar to corner smoothing type 0 = no smoothing, 1 = fillet,...
Definition: class_zone.h:897

References m_HatchFillTypeSmoothingLevel.

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

◆ GetHatchFillTypeSmoothingValue()

double ZONE_CONTAINER::GetHatchFillTypeSmoothingValue ( ) const
inline

Definition at line 222 of file class_zone.h.

double m_HatchFillTypeSmoothingValue
Grid pattern smoothing value for smoothing shape size calculations this is the ratio between the gap ...
Definition: class_zone.h:901

References m_HatchFillTypeSmoothingValue.

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

◆ GetHatchFillTypeThickness()

int ZONE_CONTAINER::GetHatchFillTypeThickness ( ) const
inline

Definition at line 210 of file class_zone.h.

210 { return m_HatchFillTypeThickness; }
int m_HatchFillTypeThickness
Grid style shape: thickness of lines (if 0 -> solid shape)
Definition: class_zone.h:887

References m_HatchFillTypeThickness.

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

◆ GetHatchLines()

const std::vector<SEG>& ZONE_CONTAINER::GetHatchLines ( ) const
inline

Definition at line 779 of file class_zone.h.

779 { return m_HatchLines; }
std::vector< SEG > m_HatchLines
Definition: class_zone.h:930

References m_HatchLines.

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

◆ GetHatchPitch()

int ZONE_CONTAINER::GetHatchPitch ( ) const

Hatch related methods.

Function GetHatchPitch

Returns
int - the zone hatch pitch in iu.

Definition at line 945 of file class_zone.cpp.

946 {
947  return m_hatchPitch;
948 }

References m_hatchPitch.

Referenced by PCB_IO::format(), and operator=().

◆ GetHatchStyle()

ZONE_HATCH_STYLE ZONE_CONTAINER::GetHatchStyle ( ) const
inline

Definition at line 565 of file class_zone.h.

566  {
567  return m_hatchStyle;
568  }
ZONE_HATCH_STYLE m_hatchStyle
Definition: class_zone.h:928

References m_hatchStyle.

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

◆ GetHV45()

bool ZONE_CONTAINER::GetHV45 ( ) const
inline

Definition at line 781 of file class_zone.h.

781 { return m_hv45; }

References m_hv45.

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

◆ GetIsKeepout()

◆ GetIslandRemovalMode()

const ISLAND_REMOVAL_MODE ZONE_CONTAINER::GetIslandRemovalMode ( ) const
inline

Definition at line 725 of file class_zone.h.

725 { return m_islandRemovalMode; }
ISLAND_REMOVAL_MODE m_islandRemovalMode
Definition: class_zone.h:856

References m_islandRemovalMode.

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

◆ GetKeepouts()

int ZONE_CONTAINER::GetKeepouts ( std::map< int, wxString > *  aSources = nullptr) const

Return a bitset of flags for keepouts.

Includes both those set via the GUI and those set via DRC rules. @aSources indicates the source ("zone properties" or rule name) of each flag.

Returns
a bitset of DISALLOW_* flags.

Definition at line 363 of file class_zone.cpp.

364 {
365  wxString source;
366  int keepouts = 0;
367 
368  auto setFlag = [&]( int aFlag )
369  {
370  keepouts |= aFlag;
371 
372  if( aSources )
373  (*aSources)[ aFlag ] = source;
374  };
375 
376  if( m_isKeepout )
377  {
378  if( aSources )
379  source = _( "zone properties" );
380 
381  if( m_doNotAllowTracks )
382  setFlag( DISALLOW_TRACKS );
383 
384  if( m_doNotAllowVias )
385  setFlag( DISALLOW_VIAS );
386 
387  if( m_doNotAllowPads )
388  setFlag( DISALLOW_PADS );
389 
391  setFlag( DISALLOW_FOOTPRINTS );
392 
394  setFlag( DISALLOW_ZONES );
395  }
396 
397  DRC_RULE* rule = GetRule( this, nullptr, DISALLOW_CONSTRAINT );
398 
399  if( rule )
400  {
401  if( aSources )
402  source = wxString::Format( _( "'%s' rule" ), rule->m_Name );
403 
404  if( ( rule->m_DisallowFlags & DISALLOW_VIAS ) > 0 )
405  setFlag( DISALLOW_VIAS );
406 
407  if( ( rule->m_DisallowFlags & DISALLOW_MICRO_VIAS ) > 0 )
408  setFlag( DISALLOW_MICRO_VIAS );
409 
410  if( ( rule->m_DisallowFlags & DISALLOW_BB_VIAS ) > 0 )
411  setFlag( DISALLOW_BB_VIAS );
412 
413  if( ( rule->m_DisallowFlags & DISALLOW_TRACKS ) > 0 )
414  setFlag( DISALLOW_TRACKS );
415 
416  if( ( rule->m_DisallowFlags & DISALLOW_PADS ) > 0 )
417  setFlag( DISALLOW_PADS );
418 
419  if( ( rule->m_DisallowFlags & DISALLOW_ZONES ) > 0 )
420  setFlag( DISALLOW_ZONES );
421 
422  if( ( rule->m_DisallowFlags & DISALLOW_TEXTS ) > 0 )
423  setFlag( DISALLOW_TEXTS );
424 
425  if( ( rule->m_DisallowFlags & DISALLOW_GRAPHICS ) > 0 )
426  setFlag( DISALLOW_GRAPHICS );
427 
428  if( ( rule->m_DisallowFlags & DISALLOW_HOLES ) > 0 )
429  setFlag( DISALLOW_HOLES );
430 
431  if( ( rule->m_DisallowFlags & DISALLOW_FOOTPRINTS ) > 0 )
432  setFlag( DISALLOW_FOOTPRINTS );
433  }
434 
435  return keepouts;
436 }
#define DISALLOW_TRACKS
Definition: drc_rule.h:44
#define DISALLOW_TEXTS
Definition: drc_rule.h:47
bool m_doNotAllowPads
Definition: class_zone.h:848
bool m_doNotAllowTracks
Definition: class_zone.h:847
wxString m_Name
Definition: drc_rule.h:73
#define DISALLOW_MICRO_VIAS
Definition: drc_rule.h:42
#define DISALLOW_HOLES
Definition: drc_rule.h:49
int m_DisallowFlags
Definition: drc_rule.h:75
#define DISALLOW_PADS
Definition: drc_rule.h:45
bool m_doNotAllowFootprints
Definition: class_zone.h:849
#define DISALLOW_GRAPHICS
Definition: drc_rule.h:48
DRC_RULE * GetRule(const BOARD_ITEM *aItem, const BOARD_ITEM *bItem, int aConstraint)
Definition: drc_rule.cpp:67
#define DISALLOW_CONSTRAINT
Definition: drc_rule.h:39
#define DISALLOW_FOOTPRINTS
Definition: drc_rule.h:50
bool m_doNotAllowVias
Definition: class_zone.h:846
#define DISALLOW_VIAS
Definition: drc_rule.h:41
bool m_doNotAllowCopperPour
Definition: class_zone.h:845
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:33
#define DISALLOW_BB_VIAS
Definition: drc_rule.h:43
#define DISALLOW_ZONES
Definition: drc_rule.h:46

References _, DISALLOW_BB_VIAS, DISALLOW_CONSTRAINT, DISALLOW_FOOTPRINTS, DISALLOW_GRAPHICS, DISALLOW_HOLES, DISALLOW_MICRO_VIAS, DISALLOW_PADS, DISALLOW_TEXTS, DISALLOW_TRACKS, DISALLOW_VIAS, DISALLOW_ZONES, Format(), GetRule(), DRC_RULE::m_DisallowFlags, m_doNotAllowCopperPour, m_doNotAllowFootprints, m_doNotAllowPads, m_doNotAllowTracks, m_doNotAllowVias, m_isKeepout, and DRC_RULE::m_Name.

◆ GetLayer()

PCB_LAYER_ID ZONE_CONTAINER::GetLayer ( ) const
overridevirtual

Function GetLayer returns the primary layer this item is on.

Reimplemented from BOARD_ITEM.

Definition at line 236 of file class_zone.cpp.

237 {
238  return BOARD_ITEM::GetLayer();
239 }
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.

References BOARD_ITEM::GetLayer().

Referenced by BOARD::Add(), GERBER_JOBFILE_WRITER::addJSONDesignRules(), DRAWING_TOOL::DrawVia(), DRAWING_TOOL::DrawZone(), PCB_EDIT_FRAME::Edit_Zone_Params(), Flip(), DSN::SPECCTRA_DB::FromBOARD(), Hatch(), BOARD::NormalizeAreaPolygon(), BRDITEMS_PLOTTER::PlotFilledAreas(), BOARD::TestAreaIntersection(), DRC::testZones(), and PCB_EDITOR_CONTROL::ZoneMerge().

◆ GetLayerName()

wxString BOARD_ITEM::GetLayerName ( ) const
inherited

Function GetLayerName returns the name of the PCB layer on which the item resides.

Returns
wxString containing the layer name associated with this item.

Definition at line 68 of file class_board_item.cpp.

69 {
70  BOARD* board = GetBoard();
71 
72  if( board )
73  return board->GetLayerName( m_Layer );
74 
75  // If no parent, return standard name
77 }
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer.
PCB_LAYER_ID m_Layer
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:180
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Function GetStandardLayerName returns an "English Standard" name of a PCB layer when given aLayerNumb...
Definition: class_board.h:648

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

Referenced by PCB_IO::format(), PCB_IO::formatLayer(), TEXTE_PCB::GetMsgPanelInfo(), TEXTE_MODULE::GetMsgPanelInfo(), DRAWSEGMENT::GetMsgPanelInfo(), TEXTE_PCB::GetSelectMenuText(), EDGE_MODULE::GetSelectMenuText(), TRACK::GetSelectMenuText(), TEXTE_MODULE::GetSelectMenuText(), DIMENSION::GetSelectMenuText(), DRAWSEGMENT::GetSelectMenuText(), MODULE::GetSelectMenuText(), TEXTE_PCB::GetShownText(), TEXT_MOD_GRID_TABLE::GetValue(), MODULE::ResolveTextVar(), and DRC::testDisabledLayers().

◆ GetLayerSet()

LSET ZONE_CONTAINER::GetLayerSet ( ) const
overridevirtual

Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segment or VIA physically resides.

Returns
int - a layer mask, see layers_id_colors_visibility.h.

Reimplemented from BOARD_ITEM.

Definition at line 312 of file class_zone.cpp.

313 {
314  return m_layerSet;
315 }

References m_layerSet.

Referenced by BOARD::CombineAllAreasInNet(), CommonLayerExists(), BOARD::ConvertBrdLayerToPolygonalContours(), BOARD_ADAPTER::createLayers(), export_vrml_zones(), Flip(), PCB_IO::format(), GetColinearCorners(), initDataFromSrcInCopyCtor(), IsSame(), ZONE_SETTINGS::operator<<(), operator=(), SaveCopyOfZones(), PNS_KICAD_IFACE_BASE::syncZone(), and BOARD::TestAreaIntersections().

◆ GetLocalClearance()

int ZONE_CONTAINER::GetLocalClearance ( wxString *  aSource = nullptr) const
overridevirtual

Function GetLocalClearance returns 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
int - the clearance in internal units.

Reimplemented from BOARD_CONNECTED_ITEM.

Definition at line 547 of file class_zone.cpp.

548 {
549  if( m_isKeepout )
550  return 0;
551 
552  if( aSource )
553  *aSource = _( "zone" );
554 
555  return m_ZoneClearance;
556 }
int m_ZoneClearance
Clearance value in internal units.
Definition: class_zone.h:852
#define _(s)
Definition: 3d_actions.cpp:33

References _, m_isKeepout, and m_ZoneClearance.

Referenced by ZONE_FILLER::buildCopperItemClearances(), and BOARD::TestAreaIntersections().

◆ GetLocalClearanceOverrides()

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

Function GetLocalClearanceOverrides returns 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
int - the clearance in internal units.

Reimplemented in D_PAD.

Definition at line 181 of file board_connected_item.h.

181 { return 0; }

Referenced by BOARD_CONNECTED_ITEM::GetClearance().

◆ GetLocalFlags()

int ZONE_CONTAINER::GetLocalFlags ( ) const
inline

Definition at line 256 of file class_zone.h.

256 { return m_localFlgs; }
int m_localFlgs
Variable used in polygon calculations.
Definition: class_zone.h:907

References m_localFlgs.

Referenced by BOARD::CombineAllAreasInNet(), and initDataFromSrcInCopyCtor().

◆ GetLocalRatsnestVisible()

bool BOARD_CONNECTED_ITEM::GetLocalRatsnestVisible ( ) const
inlineinherited

◆ GetLock()

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

Definition at line 180 of file class_zone.h.

181  {
182  return m_lock;
183  }
std::mutex m_lock
Lock used for multi-threaded filling on multi-layer zones.
Definition: class_zone.h:940

References m_lock.

Referenced by ZONE_FILLER::Fill().

◆ GetMenuImage()

BITMAP_DEF ZONE_CONTAINER::GetMenuImage ( ) const
overridevirtual

Function GetMenuImage returns 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 1150 of file class_zone.cpp.

1151 {
1152  return add_zone_xpm;
1153 }
const BITMAP_OPAQUE add_zone_xpm[1]
Definition: add_zone.cpp:74

References add_zone_xpm.

◆ GetMinIslandArea()

long long int ZONE_CONTAINER::GetMinIslandArea ( ) const
inline

Definition at line 729 of file class_zone.h.

729 { return m_minIslandArea; }
long long int m_minIslandArea
When island removal mode is set to AREA, islands below this area will be removed.
Definition: class_zone.h:862

References m_minIslandArea.

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

◆ GetMinThickness()

◆ GetMsgPanelInfo()

void ZONE_CONTAINER::GetMsgPanelInfo ( EDA_DRAW_FRAME aFrame,
std::vector< MSG_PANEL_ITEM > &  aList 
)
overridevirtual

Function GetMsgPanelInfo populates 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 598 of file class_zone.cpp.

599 {
600  EDA_UNITS units = aFrame->GetUserUnits();
601  wxString msg, msg2;
602 
603  if( GetIsKeepout() )
604  msg = _( "Keepout Area" );
605  else if( IsOnCopperLayer() )
606  msg = _( "Copper Zone" );
607  else
608  msg = _( "Non-copper Zone" );
609 
610  // Display Cutout instead of Outline for holes inside a zone
611  // i.e. when num contour !=0
612  // Check whether the selected corner is in a hole; i.e., in any contour but the first one.
613  if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
614  msg << wxT( " " ) << _( "Cutout" );
615 
616  aList.emplace_back( _( "Type" ), msg, DARKCYAN );
617 
618  if( GetIsKeepout() )
619  {
620  msg.Empty();
621 
622  if( GetDoNotAllowVias() )
623  AccumulateDescription( msg, _( "No vias" ) );
624 
625  if( GetDoNotAllowTracks() )
626  AccumulateDescription( msg, _( "No tracks" ) );
627 
628  if( GetDoNotAllowPads() )
629  AccumulateDescription( msg, _( "No pads" ) );
630 
632  AccumulateDescription( msg, _( "No copper zones" ) );
633 
635  AccumulateDescription( msg, _( "No footprints" ) );
636 
637  aList.emplace_back( MSG_PANEL_ITEM( _( "Keepout" ), msg, RED ) );
638  }
639  else if( IsOnCopperLayer() )
640  {
641  if( GetNetCode() >= 0 )
642  {
643  NETINFO_ITEM* net = GetNet();
644  NETCLASS* netclass = nullptr;
645 
646  if( net )
647  {
648  if( net->GetNet() )
649  netclass = GetNetClass();
650  else
651  netclass = GetBoard()->GetDesignSettings().GetDefault();
652 
653  msg = UnescapeString( net->GetNetname() );
654  }
655  else
656  {
657  msg = wxT( "<no name>" );
658  }
659 
660  aList.emplace_back( _( "Net" ), msg, RED );
661 
662  if( netclass )
663  aList.emplace_back( _( "NetClass" ), netclass->GetName(), DARKMAGENTA );
664  }
665 
666  // Display priority level
667  msg.Printf( wxT( "%d" ), GetPriority() );
668  aList.emplace_back( _( "Priority" ), msg, BLUE );
669  }
670 
671  wxString layerDesc;
672  int count = 0;
673 
674  for( PCB_LAYER_ID layer : m_layerSet.Seq() )
675  {
676  if( count == 0 )
677  layerDesc = GetBoard()->GetLayerName( layer );
678 
679  count++;
680  }
681 
682  if( count > 1 )
683  layerDesc.Printf( _( "%s and %d more" ), layerDesc, count - 1 );
684 
685  aList.emplace_back( _( "Layer" ), layerDesc, DARKGREEN );
686 
687  if( !m_zoneName.empty() )
688  aList.emplace_back( _( "Name" ), m_zoneName, DARKMAGENTA );
689 
690  switch( m_FillMode )
691  {
692  case ZONE_FILL_MODE::POLYGONS: msg = _( "Solid" ); break;
693  case ZONE_FILL_MODE::HATCH_PATTERN: msg = _( "Hatched" ); break;
694  default: msg = _( "Unknown" ); break;
695  }
696 
697  aList.emplace_back( _( "Fill Mode" ), msg, BROWN );
698 
699  msg = MessageTextFromValue( units, m_area, false, EDA_DATA_TYPE::AREA );
700  aList.emplace_back( _( "Filled Area" ), msg, BLUE );
701 
702  wxString source;
703  int clearance = GetClearance( nullptr, &source );
704 
705  msg.Printf( _( "Min Clearance: %s" ), MessageTextFromValue( units, clearance, true ) );
706  msg2.Printf( _( "(from %s)" ), source );
707  aList.emplace_back( msg, msg2, BLACK );
708 
709  // Useful for statistics, especially when zones are complex the number of hatches
710  // and filled polygons can explain the display and DRC calculation time:
711  msg.Printf( wxT( "%d" ), (int) m_HatchLines.size() );
712  aList.emplace_back( MSG_PANEL_ITEM( _( "Hatch Lines" ), msg, BLUE ) );
713 
714  PCB_LAYER_ID layer = m_Layer;
715 
716  // NOTE: This brings in dependence on PCB_EDIT_FRAME to the qa tests, which isn't ideal.
717  // TODO: Figure out a way for items to know the active layer without the whole edit frame?
718 #if 0
719  if( PCB_EDIT_FRAME* pcbframe = dynamic_cast<PCB_EDIT_FRAME*>( aFrame ) )
720  if( m_FilledPolysList.count( pcbframe->GetActiveLayer() ) )
721  layer = pcbframe->GetActiveLayer();
722 #endif
723 
724  if( !m_FilledPolysList.at( layer ).IsEmpty() )
725  {
726  msg.Printf( wxT( "%d" ), m_FilledPolysList.at( layer ).TotalVertices() );
727  aList.emplace_back( MSG_PANEL_ITEM( _( "Corner Count" ), msg, BLUE ) );
728  }
729 }
EDA_UNITS
Definition: common.h:198
bool GetDoNotAllowPads() const
Definition: class_zone.h:706
int GetNetCode() const
Function GetNetCode.
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer.
NETINFO_ITEM * GetNet() const
Function GetNet Returns NET_INFO object for a given item.
const wxString & GetName() const
Definition: netclass.h:96
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: class_zone.h:904
NETCLASS * GetNetClass() const
Function GetNetClassPtr returns the NETCLASS for this item.
Definition: color4d.h:61
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:551
Definition: color4d.h:44
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Function Seq returns an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:377
bool GetDoNotAllowVias() const
Definition: class_zone.h:704
PCB_LAYER_ID m_Layer
wxString m_zoneName
An optional unique name for this zone, used for identifying it in DRC checking.
Definition: class_zone.h:827
PCB_LAYER_ID
A quick note on layer IDs:
std::vector< SEG > m_HatchLines
Definition: class_zone.h:930
NETCLASS handles a collection of nets and the parameters used to route or test these nets.
Definition: netclass.h:55
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
bool GetDoNotAllowCopperPour() const
Definition: class_zone.h:703
const wxString & GetNetname() const
Function GetNetname.
Definition: netinfo.h:231
Definition: color4d.h:59
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:702
virtual int GetClearance(BOARD_ITEM *aItem=nullptr, wxString *aSource=nullptr) const
Function GetClearance returns the clearance in internal units.
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aUseMils, EDA_DATA_TYPE aType)
Definition: base_units.cpp:124
void AccumulateDescription(wxString &aDesc, const wxString &aItem)
Utility to build comma separated lists in messages.
Definition: macros.h:126
NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
Definition: color4d.h:56
ZONE_FILL_MODE m_FillMode
How to fill areas: ZONE_FILL_MODE::POLYGONS => use solid polygons ZONE_FILL_MODE::HATCH_PATTERN => us...
Definition: class_zone.h:884
unsigned GetPriority() const
Function GetPriority.
Definition: class_zone.h:101
int GetNet() const
Function GetNet.
Definition: netinfo.h:223
#define _(s)
Definition: 3d_actions.cpp:33
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:131
NETCLASS * GetDefault() const
Function GetDefault.
PCB_EDIT_FRAME is the main frame for Pcbnew.
bool GetDoNotAllowTracks() const
Definition: class_zone.h:705
bool GetDoNotAllowFootprints() const
Definition: class_zone.h:707
EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
bool IsOnCopperLayer() const override
Function IsOnCopperLayer.
Definition: class_zone.cpp:242
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:922

References _, AccumulateDescription(), AREA, BLACK, BLUE, BROWN, DARKCYAN, DARKGREEN, DARKMAGENTA, BOARD_ITEM::GetBoard(), BOARD_CONNECTED_ITEM::GetClearance(), BOARD_DESIGN_SETTINGS::GetDefault(), BOARD::GetDesignSettings(), GetDoNotAllowCopperPour(), GetDoNotAllowFootprints(), GetDoNotAllowPads(), GetDoNotAllowTracks(), GetDoNotAllowVias(), GetIsKeepout(), BOARD::GetLayerName(), NETCLASS::GetName(), BOARD_CONNECTED_ITEM::GetNet(), NETINFO_ITEM::GetNet(), BOARD_CONNECTED_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetNetCode(), NETINFO_ITEM::GetNetname(), GetPriority(), EDA_BASE_FRAME::GetUserUnits(), HATCH_PATTERN, IsOnCopperLayer(), m_area, SHAPE_POLY_SET::VERTEX_INDEX::m_contour, m_CornerSelection, m_FilledPolysList, m_FillMode, m_HatchLines, BOARD_ITEM::m_Layer, m_layerSet, m_zoneName, MessageTextFromValue(), POLYGONS, RED, LSET::Seq(), and UnescapeString().

◆ GetNet()

NETINFO_ITEM* BOARD_CONNECTED_ITEM::GetNet ( ) const
inlineinherited

Function GetNet Returns NET_INFO object for a given item.

Definition at line 81 of file board_connected_item.h.

82  {
83  return m_netinfo;
84  }
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.

References BOARD_CONNECTED_ITEM::m_netinfo.

Referenced by PNS_PCBNEW_RULE_RESOLVER::DpNetPair(), DRAWING_TOOL::DrawVia(), GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase_Common(), BOARD::SetAreasNetCodesFromNetNames(), and PCB_EDIT_FRAME::SetTrackSegmentWidth().

◆ GetNetClass()

NETCLASS * BOARD_CONNECTED_ITEM::GetNetClass ( ) const
inherited

Function GetNetClassPtr returns the NETCLASS for this item.

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

Definition at line 185 of file board_connected_item.cpp.

186 {
187  NETCLASS* netclass = m_netinfo->GetNetClass();
188 
189  if( netclass )
190  return netclass;
191  else
192  return GetBoard()->GetDesignSettings().GetDefault();
193 }
NETCLASS * GetNetClass()
Function GetNetClass.
Definition: netinfo.h:128
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:551
NETCLASS handles a collection of nets and the parameters used to route or test these nets.
Definition: netclass.h:55
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.
NETCLASS * GetDefault() const
Function GetDefault.

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

Referenced by VIA::GetDrillValue(), BOARD_CONNECTED_ITEM::GetEffectiveNetclass(), GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase_Common(), ROUTER_TOOL::prepareInteractive(), and DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow().

◆ GetNetClassName()

wxString BOARD_CONNECTED_ITEM::GetNetClassName ( ) const
inherited

Function GetNetClassName returns a pointer to 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

Definition at line 196 of file board_connected_item.cpp.

197 {
198  return m_netinfo->GetClassName();
199 }
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.
wxString GetClassName() const
Function GetClassName returns the class name.
Definition: netinfo.h:137

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

Referenced by D_PAD::GetMsgPanelInfo(), and DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem().

◆ GetNetCode()

int BOARD_CONNECTED_ITEM::GetNetCode ( ) const
inlineinherited

Function GetNetCode.

Returns
int - the net code.

Definition at line 100 of file board_connected_item.h.

101  {
102  return m_netinfo ? m_netinfo->GetNet() : -1;
103  }
int GetNet() const
Function GetNet.
Definition: netinfo.h:223
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.

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

Referenced by ZONE_FILLER::buildCopperItemClearances(), BOARD::CombineAllAreasInNet(), connectedItemFilter(), CreateRoutesSection(), DRC::doPadToPadsDrc(), DRC::doTrackDrc(), KIGFX::PCB_PAINTER::draw(), DRAWING_TOOL::DrawVia(), PCB_EDIT_FRAME::Exchange_Module(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), PNS::NODE::FindItemByParent(), PCB_IO::format(), DSN::SPECCTRA_DB::FromBOARD(), GetColinearCorners(), CONNECTIVITY_DATA::GetConnectedItems(), GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), hash_eda(), hasThermalConnection(), DIALOG_PAD_PROPERTIES::initValues(), IsIsland(), IsSame(), DSN::SPECCTRA_DB::makeIMAGE(), AR_AUTOPLACER::nearestPad(), ROUTER_TOOL::NeighboringSegmentFilter(), CN_ITEM::Net(), BOARD::NormalizeAreaPolygon(), BOARD::OnAreaPolygonModified(), ZONE_SETTINGS::operator<<(), DIALOG_PAD_PROPERTIES::PadTypeSelected(), process(), PCB_SELECTION_CONDITIONS::sameNetFunc(), SaveCopyOfZones(), SELECTION_TOOL::selectNet(), BOARD::SetAreasNetCodesFromNetNames(), setupDummyPadForHole(), PNS_KICAD_IFACE_BASE::syncArc(), PNS_KICAD_IFACE_BASE::syncPad(), PNS_KICAD_IFACE_BASE::syncTrack(), PNS_KICAD_IFACE_BASE::syncVia(), BOARD::TestAreaIntersections(), DRC::testZones(), BOARD::TracksInNet(), NETINFO_MAPPING::Update(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), and PCB_EDITOR_CONTROL::ZoneMerge().

◆ GetNetname()

const wxString& BOARD_CONNECTED_ITEM::GetNetname ( ) const
inlineinherited

Function GetNetname.

Returns
wxString - the full netname

Definition at line 120 of file board_connected_item.h.

121  {
122  return m_netinfo->GetNetname();
123  }
const wxString & GetNetname() const
Function GetNetname.
Definition: netinfo.h:231
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.

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

Referenced by KIGFX::PCB_PAINTER::draw(), PCB_IO::format(), DSN::SPECCTRA_DB::FromBOARD(), D_PAD::GetMsgPanelInfo(), BOARD_NETLIST_UPDATER::getNetname(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), CN_CLUSTER::OriginNetName(), BRDITEMS_PLOTTER::PlotFilledAreas(), BRDITEMS_PLOTTER::PlotPad(), PlotStandardLayer(), and BOARD_NETLIST_UPDATER::updateCopperZoneNets().

◆ GetNetnameMsg()

wxString BOARD_CONNECTED_ITEM::GetNetnameMsg ( ) const
inlineinherited

Function GetNetnameMsg.

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

Definition at line 130 of file board_connected_item.h.

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

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

Referenced by TRACK::GetSelectMenuText(), VIA::GetSelectMenuText(), and GetSelectMenuText().

◆ GetNumCorners()

int ZONE_CONTAINER::GetNumCorners ( void  ) const
inline

Access to m_Poly parameters.

Definition at line 477 of file class_zone.h.

478  {
479  return m_Poly->TotalVertices();
480  }
int TotalVertices() const
Returns total number of vertices stored in the set.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822

References m_Poly, and SHAPE_POLY_SET::TotalVertices().

Referenced by BuildSmoothedPoly(), PCB_IO::format(), and BOARD::OnAreaPolygonModified().

◆ GetPadConnection()

ZONE_CONNECTION ZONE_CONTAINER::GetPadConnection ( D_PAD aPad = NULL) const

Definition at line 839 of file class_zone.cpp.

840 {
842  return m_PadConnection;
843  else
844  return aPad->GetEffectiveZoneConnection();
845 }
ZONE_CONNECTION m_PadConnection
Definition: class_zone.h:851
#define NULL
ZONE_CONNECTION GetEffectiveZoneConnection() const
Return the zone connection in effect (either locally overridden or overridden in the parent module).
Definition: class_pad.cpp:628

References D_PAD::GetEffectiveZoneConnection(), INHERITED, m_PadConnection, and NULL.

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

◆ GetParent()

BOARD_ITEM_CONTAINER* BOARD_ITEM::GetParent ( void  ) const
inlineinherited

Definition at line 136 of file class_board_item.h.

136 { return (BOARD_ITEM_CONTAINER*) m_Parent; }
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:174
Abstract interface for BOARD_ITEMs capable of storing other items inside.

References EDA_ITEM::m_Parent.

Referenced by POINT_EDITOR::addCorner(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), 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(), KIGFX::PCB_PAINTER::draw(), EDIT_TOOL::Duplicate(), EditToolSelectionFilter(), PCB_IO::format(), FormatProbeItem(), BOARD_ITEM::GetBoard(), MARKER_PCB::GetColorLayer(), EDGE_MODULE::GetMsgPanelInfo(), EDGE_MODULE::GetSelectMenuText(), TEXTE_MODULE::GetSelectMenuText(), TEXTE_PCB::GetShownText(), TEXTE_MODULE::GetShownText(), SELECTION_TOOL::GuessSelectionCandidates(), GENERAL_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), EDGE_MODULE::IsParentFlipped(), TEXTE_MODULE::IsParentFlipped(), LEGACY_PLUGIN::loadMODULE_TEXT(), ALTIUM_PCB::ParseTexts6Data(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), SELECTION_TOOL::select(), SELECTION_TOOL::Selectable(), SwapItemData(), DRC::testCopperDrawItem(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), MARKER_PCB::ViewGetLayers(), MODULE_ZONE_CONTAINER::ViewGetLOD(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ GetPosition()

const wxPoint ZONE_CONTAINER::GetPosition ( ) const
overridevirtual
Returns
a wxPoint, position of the first point of the outline

Reimplemented from EDA_ITEM.

Definition at line 230 of file class_zone.cpp.

231 {
232  return (wxPoint) GetCornerPosition( 0 );
233 }
const VECTOR2I & GetCornerPosition(int aCornerIndex) const
Definition: class_zone.h:517

References GetCornerPosition().

Referenced by EAGLE_PLUGIN::loadPlain(), PNS_KICAD_IFACE_BASE::syncZone(), and DRC::testZones().

◆ GetPriority()

unsigned ZONE_CONTAINER::GetPriority ( ) const
inline

◆ GetRuleClearance()

bool BOARD_CONNECTED_ITEM::GetRuleClearance ( BOARD_ITEM aItem,
int *  aClearance,
wxString *  aSource 
) const
virtualinherited

Function GetRuleClearance returns any rule-based clearance.

Parameters
aClearance[out] the clearance value in internal units
aSource[out] reports the source as a user-readable string
Returns
true if a rule was fired

Definition at line 165 of file board_connected_item.cpp.

167 {
168  DRC_RULE* rule = GetRule( this, aItem, CLEARANCE_CONSTRAINT );
169 
170  if( rule )
171  {
172  if( aSource )
173  *aSource = wxString::Format( _( "'%s' rule" ), rule->m_Name );
174 
175  *aClearance = rule->m_Clearance.Min;
176  return true;
177  }
178 
179  return false;
180 }
wxString m_Name
Definition: drc_rule.h:73
#define CLEARANCE_CONSTRAINT
Definition: drc_rule.h:35
DRC_RULE * GetRule(const BOARD_ITEM *aItem, const BOARD_ITEM *bItem, int aConstraint)
Definition: drc_rule.cpp:67
MINOPTMAX m_Clearance
Definition: drc_rule.h:79
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:33

References _, CLEARANCE_CONSTRAINT, Format(), GetRule(), DRC_RULE::m_Clearance, DRC_RULE::m_Name, and DRC_RULE::MINOPTMAX::Min.

Referenced by DRC::doTrackDrc(), and BOARD_CONNECTED_ITEM::GetClearance().

◆ GetSelectedCorner()

int ZONE_CONTAINER::GetSelectedCorner ( ) const
inline

Definition at line 225 of file class_zone.h.

226  {
227  // Transform relative indices to global index
228  int globalIndex = -1;
229 
230  if( m_CornerSelection )
231  m_Poly->GetGlobalIndex( *m_CornerSelection, globalIndex );
232 
233  return globalIndex;
234  }
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: class_zone.h:904
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822
bool GetGlobalIndex(VERTEX_INDEX aRelativeIndices, int &aGlobalIdx)
Function GetGlobalIndex computes the global index of a vertex from the relative indices of polygon,...

References SHAPE_POLY_SET::GetGlobalIndex(), m_CornerSelection, and m_Poly.

◆ GetSelectMenuText()

wxString ZONE_CONTAINER::GetSelectMenuText ( EDA_UNITS  aUnits) const
overridevirtual

Function GetSelectMenuText returns 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 914 of file class_zone.cpp.

915 {
916  wxString text;
917 
918  // Check whether the selected contour is a hole (contour index > 0)
919  if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
920  text << wxT( " " ) << _( "(Cutout)" );
921 
922  if( GetIsKeepout() )
923  text << wxT( " " ) << _( "(Keepout)" );
924  else
925  text << GetNetnameMsg();
926 
927  wxString layerDesc;
928  int count = 0;
929 
930  for( PCB_LAYER_ID layer : m_layerSet.Seq() )
931  {
932  if( count == 0 )
933  layerDesc = GetBoard()->GetLayerName( layer );
934 
935  count++;
936  }
937 
938  if( count > 1 )
939  layerDesc.Printf( _( "%s and %d more" ), layerDesc, count - 1 );
940 
941  return wxString::Format( _( "Zone Outline %s on %s" ), text, layerDesc );
942 }
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer.
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: class_zone.h:904
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Function Seq returns an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:377
PCB_LAYER_ID
A quick note on layer IDs:
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:702
wxString GetNetnameMsg() const
Function GetNetnameMsg.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:33

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

Referenced by PNS_KICAD_IFACE_BASE::syncZone().

◆ GetShortNetname()

const wxString& BOARD_CONNECTED_ITEM::GetShortNetname ( ) const
inlineinherited

Function GetShortNetname.

Returns
wxString - the short netname

Definition at line 149 of file board_connected_item.h.

150  {
151  return m_netinfo->GetShortNetname();
152  }
const wxString & GetShortNetname() const
Function GetShortNetname.
Definition: netinfo.h:237
NETINFO_ITEM * m_netinfo
Stores all informations 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 ( int  type) const
inlineinherited

Definition at line 216 of file base_struct.h.

217  {
218  return m_Status & type;
219  }
STATUS_FLAGS m_Status
Definition: base_struct.h:173

References EDA_ITEM::m_Status.

Referenced by TRACK::GetMsgPanelInfoBase_Common(), and TRACK::IsLocked().

◆ GetStatus()

STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 229 of file base_struct.h.

229 { return m_Status; }
STATUS_FLAGS m_Status
Definition: base_struct.h:173

References EDA_ITEM::m_Status.

Referenced by PCB_IO::format().

◆ GetThermalReliefCopperBridge()

int ZONE_CONTAINER::GetThermalReliefCopperBridge ( D_PAD aPad = NULL) const

Definition at line 354 of file class_zone.cpp.

355 {
356  if( aPad == NULL || aPad->GetThermalWidth() == 0 )
358  else
359  return aPad->GetThermalWidth();
360 }
int m_ThermalReliefCopperBridge
Definition: class_zone.h:877
#define NULL
int GetThermalWidth() const
Definition: class_pad.cpp:639

References D_PAD::GetThermalWidth(), m_ThermalReliefCopperBridge, and NULL.

Referenced by ZONE_FILLER::buildThermalSpokes(), PCB_IO::format(), ZONE_SETTINGS::operator<<(), and BOARD::TestAreaIntersections().

◆ GetThermalReliefGap()

int ZONE_CONTAINER::GetThermalReliefGap ( D_PAD aPad = NULL) const

Definition at line 345 of file class_zone.cpp.

346 {
347  if( aPad == NULL || aPad->GetThermalGap() == 0 )
348  return m_ThermalReliefGap;
349  else
350  return aPad->GetThermalGap();
351 }
int GetThermalGap() const
Definition: class_pad.cpp:650
#define NULL
int m_ThermalReliefGap
Width of the copper bridge in thermal reliefs.
Definition: class_zone.h:874

References D_PAD::GetThermalGap(), m_ThermalReliefGap, and NULL.

Referenced by ZONE_FILLER::buildCopperItemClearances(), ZONE_FILLER::buildThermalSpokes(), PCB_IO::format(), hasThermalConnection(), ZONE_FILLER::knockoutThermalReliefs(), ZONE_SETTINGS::operator<<(), and BOARD::TestAreaIntersections().

◆ GetZoneClearance()

int ZONE_CONTAINER::GetZoneClearance ( ) const
inline

Definition at line 191 of file class_zone.h.

191 { return m_ZoneClearance; }
int m_ZoneClearance
Clearance value in internal units.
Definition: class_zone.h:852

References m_ZoneClearance.

Referenced by ZONE_FILLER::buildThermalSpokes(), PCB_IO::format(), ZONE_SETTINGS::operator<<(), and BOARD::TestAreaIntersections().

◆ GetZoneName()

wxString ZONE_CONTAINER::GetZoneName ( ) const
inline

Definition at line 109 of file class_zone.h.

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

References m_zoneName.

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

◆ HasFlag()

◆ Hatch()

void ZONE_CONTAINER::Hatch ( )

Function Hatch computes the hatch lines depending on the hatch parameters and stores it in the zone's attribute m_HatchLines.

Definition at line 981 of file class_zone.cpp.

982 {
983  UnHatch();
984 
986  return;
987 
988  // define range for hatch lines
989  int min_x = m_Poly->CVertex( 0 ).x;
990  int max_x = m_Poly->CVertex( 0 ).x;
991  int min_y = m_Poly->CVertex( 0 ).y;
992  int max_y = m_Poly->CVertex( 0 ).y;
993 
994  for( auto iterator = m_Poly->IterateWithHoles(); iterator; iterator++ )
995  {
996  if( iterator->x < min_x )
997  min_x = iterator->x;
998 
999  if( iterator->x > max_x )
1000  max_x = iterator->x;
1001 
1002  if( iterator->y < min_y )
1003  min_y = iterator->y;
1004 
1005  if( iterator->y > max_y )
1006  max_y = iterator->y;
1007  }
1008 
1009  // Calculate spacing between 2 hatch lines
1010  int spacing;
1011 
1013  spacing = m_hatchPitch;
1014  else
1015  spacing = m_hatchPitch * 2;
1016 
1017  // set the "length" of hatch lines (the length on horizontal axis)
1018  int hatch_line_len = m_hatchPitch;
1019 
1020  // To have a better look, give a slope depending on the layer
1021  LAYER_NUM layer = GetLayer();
1022  int slope_flag = (layer & 1) ? 1 : -1; // 1 or -1
1023  double slope = 0.707106 * slope_flag; // 45 degrees slope
1024  int max_a, min_a;
1025 
1026  if( slope_flag == 1 )
1027  {
1028  max_a = KiROUND( max_y - slope * min_x );
1029  min_a = KiROUND( min_y - slope * max_x );
1030  }
1031  else
1032  {
1033  max_a = KiROUND( max_y - slope * max_x );
1034  min_a = KiROUND( min_y - slope * min_x );
1035  }
1036 
1037  min_a = (min_a / spacing) * spacing;
1038 
1039  // calculate an offset depending on layer number,
1040  // for a better look of hatches on a multilayer board
1041  int offset = (layer * 7) / 8;
1042  min_a += offset;
1043 
1044  // loop through hatch lines
1045  #define MAXPTS 200 // Usually we store only few values per one hatch line
1046  // depending on the complexity of the zone outline
1047 
1048  static std::vector<VECTOR2I> pointbuffer;
1049  pointbuffer.clear();
1050  pointbuffer.reserve( MAXPTS + 2 );
1051 
1052  for( int a = min_a; a < max_a; a += spacing )
1053  {
1054  // get intersection points for this hatch line
1055 
1056  // Note: because we should have an even number of intersections with the
1057  // current hatch line and the zone outline (a closed polygon,
1058  // or a set of closed polygons), if an odd count is found
1059  // we skip this line (should not occur)
1060  pointbuffer.clear();
1061 
1062  // Iterate through all vertices
1063  for( auto iterator = m_Poly->IterateSegmentsWithHoles(); iterator; iterator++ )
1064  {
1065  double x, y, x2, y2;
1066  int ok;
1067 
1068  SEG segment = *iterator;
1069 
1070  ok = FindLineSegmentIntersection( a, slope,
1071  segment.A.x, segment.A.y,
1072  segment.B.x, segment.B.y,
1073  &x, &y, &x2, &y2 );
1074 
1075  if( ok )
1076  {
1077  VECTOR2I point( KiROUND( x ), KiROUND( y ) );
1078  pointbuffer.push_back( point );
1079  }
1080 
1081  if( ok == 2 )
1082  {
1083  VECTOR2I point( KiROUND( x2 ), KiROUND( y2 ) );
1084  pointbuffer.push_back( point );
1085  }
1086 
1087  if( pointbuffer.size() >= MAXPTS ) // overflow
1088  {
1089  wxASSERT( 0 );
1090  break;
1091  }
1092  }
1093 
1094  // ensure we have found an even intersection points count
1095  // because intersections are the ends of segments
1096  // inside the polygon(s) and a segment has 2 ends.
1097  // if not, this is a strange case (a bug ?) so skip this hatch
1098  if( pointbuffer.size() % 2 != 0 )
1099  continue;
1100 
1101  // sort points in order of descending x (if more than 2) to
1102  // ensure the starting point and the ending point of the same segment
1103  // are stored one just after the other.
1104  if( pointbuffer.size() > 2 )
1105  sort( pointbuffer.begin(), pointbuffer.end(), sortEndsByDescendingX );
1106 
1107  // creates lines or short segments inside the complex polygon
1108  for( unsigned ip = 0; ip < pointbuffer.size(); ip += 2 )
1109  {
1110  int dx = pointbuffer[ip + 1].x - pointbuffer[ip].x;
1111 
1112  // Push only one line for diagonal hatch,
1113  // or for small lines < twice the line length
1114  // else push 2 small lines
1116  || std::abs( dx ) < 2 * hatch_line_len )
1117  {
1118  m_HatchLines.emplace_back( SEG( pointbuffer[ip], pointbuffer[ip + 1] ) );
1119  }
1120  else
1121  {
1122  double dy = pointbuffer[ip + 1].y - pointbuffer[ip].y;
1123  slope = dy / dx;
1124 
1125  if( dx > 0 )
1126  dx = hatch_line_len;
1127  else
1128  dx = -hatch_line_len;
1129 
1130  int x1 = KiROUND( pointbuffer[ip].x + dx );
1131  int x2 = KiROUND( pointbuffer[ip + 1].x - dx );
1132  int y1 = KiROUND( pointbuffer[ip].y + dx * slope );
1133  int y2 = KiROUND( pointbuffer[ip + 1].y - dx * slope );
1134 
1135  m_HatchLines.emplace_back( SEG( pointbuffer[ip].x, pointbuffer[ip].y, x1, y1 ) );
1136 
1137  m_HatchLines.emplace_back( SEG( pointbuffer[ip+1].x, pointbuffer[ip+1].y, x2, y2 ) );
1138  }
1139  }
1140  }
1141 }
SEGMENT_ITERATOR IterateSegmentsWithHoles()
Returns an iterator object, for all outlines in the set (with holes)
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Returns the index-th vertex in a given hole outline within a given outline
bool IsEmpty() const
Returns true if the set is empty (no polygons at all)
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:236
#define MAXPTS
bool sortEndsByDescendingX(const VECTOR2I &ref, const VECTOR2I &tst)
Definition: class_zone.cpp:975
std::vector< SEG > m_HatchLines
Definition: class_zone.h:930
ITERATOR IterateWithHoles(int aOutline)
Function IterateWithHoles.
ZONE_HATCH_STYLE m_hatchStyle
Definition: class_zone.h:928
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
Definition: seg.h:39
void UnHatch()
Function UnHatch clears the zone's hatch.
Definition: class_zone.cpp:967
VECTOR2I A
Definition: seg.h:47
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:68
VECTOR2I B
Definition: seg.h:48

References SEG::A, SEG::B, SHAPE_POLY_SET::CVertex(), DIAGONAL_EDGE, DIAGONAL_FULL, GetLayer(), SHAPE_POLY_SET::IsEmpty(), SHAPE_POLY_SET::IterateSegmentsWithHoles(), SHAPE_POLY_SET::IterateWithHoles(), KiROUND(), m_HatchLines, m_hatchPitch, m_hatchStyle, m_Poly, MAXPTS, NO_HATCH, sortEndsByDescendingX(), UnHatch(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by BOARD::CombineAreas(), Mirror(), Move(), MoveEdge(), BOARD::NormalizeAreaPolygon(), Rotate(), SetHatch(), and POINT_EDITOR::updateItem().

◆ HitTest() [1/2]

bool ZONE_CONTAINER::HitTest ( const wxPoint aPosition,
int  aAccuracy = 0 
) const
overridevirtual

Function HitTest tests if a point is near an outline edge or a corner of this zone.

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

Reimplemented from EDA_ITEM.

Definition at line 448 of file class_zone.cpp.

449 {
450  // Normally accuracy is zoom-relative, but for the generic HitTest we just use
451  // a fixed (small) value.
452  int accuracy = std::max( aAccuracy, Millimeter2iu( 0.1 ) );
453 
454  return HitTestForCorner( aPosition, accuracy * 2 ) || HitTestForEdge( aPosition, accuracy );
455 }
bool HitTestForCorner(const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
Function HitTestForCorner tests if the given wxPoint is near a corner.
Definition: class_zone.cpp:473
bool HitTestForEdge(const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
Function HitTestForEdge tests if the given wxPoint is near a segment defined by 2 corners.
Definition: class_zone.cpp:487

References HitTestForCorner(), and HitTestForEdge().

◆ HitTest() [2/2]

bool ZONE_CONTAINER::HitTest ( const EDA_RECT aRect,
bool  aContained = true,
int  aAccuracy = 0 
) const
overridevirtual

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 501 of file class_zone.cpp.

502 {
503  // Calculate bounding box for zone
504  EDA_RECT bbox = GetBoundingBox();
505  bbox.Normalize();
506 
507  EDA_RECT arect = aRect;
508  arect.Normalize();
509  arect.Inflate( aAccuracy );
510 
511  if( aContained )
512  {
513  return arect.Contains( bbox );
514  }
515  else // Test for intersection between aBox and the polygon
516  // For a polygon, using its bounding box has no sense here
517  {
518  // Fast test: if aBox is outside the polygon bounding box, rectangles cannot intersect
519  if( !arect.Intersects( bbox ) )
520  return false;
521 
522  int count = m_Poly->TotalVertices();
523 
524  for( int ii = 0; ii < count; ii++ )
525  {
526  auto vertex = m_Poly->CVertex( ii );
527  auto vertexNext = m_Poly->CVertex( ( ii + 1 ) % count );
528 
529  // Test if the point is within the rect
530  if( arect.Contains( ( wxPoint ) vertex ) )
531  {
532  return true;
533  }
534 
535  // Test if this edge intersects the rect
536  if( arect.Intersects( ( wxPoint ) vertex, ( wxPoint ) vertexNext ) )
537  {
538  return true;
539  }
540  }
541 
542  return false;
543  }
544 }
int TotalVertices() const
Returns total number of vertices stored in the set.
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox (virtual)
Definition: class_zone.cpp:335
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Returns the index-th vertex in a given hole outline within a given outline
bool Contains(const wxPoint &aPoint) const
Function Contains.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822
void Normalize()
Function Normalize ensures that the height ant width are positive.
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.

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

◆ HitTestCutout() [1/2]

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

Tests 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 573 of file class_zone.cpp.

574 {
575  // Iterate over each outline polygon in the zone and then iterate over
576  // each hole it has to see if the point is in it.
577  for( int i = 0; i < m_Poly->OutlineCount(); i++ )
578  {
579  for( int j = 0; j < m_Poly->HoleCount( i ); j++ )
580  {
581  if( m_Poly->Hole( i, j ).PointInside( aRefPos ) )
582  {
583  if( aOutlineIdx )
584  *aOutlineIdx = i;
585 
586  if( aHoleIdx )
587  *aHoleIdx = j;
588 
589  return true;
590  }
591  }
592  }
593 
594  return false;
595 }
int OutlineCount() const
Returns the number of outlines in the set
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Returns the reference to aHole-th hole in the aIndex-th outline
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822
int HoleCount(int aOutline) const
Returns the number of holes in a given outline
bool PointInside(const VECTOR2I &aPt, int aAccuracy=0, bool aUseBBoxCache=false) const
Function PointInside()

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

Referenced by HitTestCutout().

◆ HitTestCutout() [2/2]

bool ZONE_CONTAINER::HitTestCutout ( const wxPoint aRefPos,
int *  aOutlineIdx = nullptr,
int *  aHoleIdx = nullptr 
) const
inline

Definition at line 304 of file class_zone.h.

306  {
307  return HitTestCutout( VECTOR2I( aRefPos.x, aRefPos.y ), aOutlineIdx, aHoleIdx );
308  }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
bool HitTestCutout(const VECTOR2I &aRefPos, int *aOutlineIdx=nullptr, int *aHoleIdx=nullptr) const
Tests if the given point is contained within a cutout of the zone.
Definition: class_zone.cpp:573

References HitTestCutout(), wxPoint::x, and wxPoint::y.

◆ HitTestFilledArea()

bool ZONE_CONTAINER::HitTestFilledArea ( PCB_LAYER_ID  aLayer,
const wxPoint aRefPos 
) const

Function HitTestFilledArea tests 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
Returns
bool - true if a hit, else false

Definition at line 559 of file class_zone.cpp.

560 {
561  // Keepouts have no filled area, but it's generally nice to treat their interior as if it were
562  // filled so that people don't have to select keepouts by their outline (which is min-width)
563  if( GetIsKeepout() )
564  return m_Poly->Contains( VECTOR2I( aRefPos.x, aRefPos.y ) );
565 
566  if( !m_FilledPolysList.count( aLayer ) )
567  return false;
568 
569  return m_FilledPolysList.at( aLayer ).Contains( VECTOR2I( aRefPos.x, aRefPos.y ) );
570 }
bool Contains(const VECTOR2I &aP, int aSubpolyIndex=-1, int aAccuracy=0, bool aUseBBoxCaches=false) const
Returns true if a given subpolygon contains the point aP.
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:702
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:922

References SHAPE_POLY_SET::Contains(), GetIsKeepout(), m_FilledPolysList, m_Poly, wxPoint::x, and wxPoint::y.

Referenced by CN_ANCHOR::ConnectedItemsCount(), GENERAL_COLLECTOR::Inspect(), and CN_ANCHOR::IsDangling().

◆ HitTestForCorner() [1/2]

bool ZONE_CONTAINER::HitTestForCorner ( const wxPoint refPos,
int  aAccuracy,
SHAPE_POLY_SET::VERTEX_INDEX aCornerHit 
) const

Function HitTestForCorner tests 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
bool - true if some corner was found to be closer to refPos than aClearance; false otherwise.

Definition at line 473 of file class_zone.cpp.

475 {
476  return m_Poly->CollideVertex( VECTOR2I( refPos ), aCornerHit, aAccuracy );
477 }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822
bool CollideVertex(const VECTOR2I &aPoint, VERTEX_INDEX &aClosestVertex, int aClearance=0) const
Function CollideVertex Checks whether aPoint collides with any vertex of any of the contours of the p...

References SHAPE_POLY_SET::CollideVertex(), and m_Poly.

Referenced by HitTest(), HitTestForCorner(), GENERAL_COLLECTOR::Inspect(), and SetSelectedCorner().

◆ HitTestForCorner() [2/2]

bool ZONE_CONTAINER::HitTestForCorner ( const wxPoint refPos,
int  aAccuracy 
) const

Function HitTestForCorner tests if the given wxPoint is near a corner.

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

Definition at line 480 of file class_zone.cpp.

481 {
483  return HitTestForCorner( refPos, aAccuracy, dummy );
484 }
bool HitTestForCorner(const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
Function HitTestForCorner tests if the given wxPoint is near a corner.
Definition: class_zone.cpp:473
Struct VERTEX_INDEX.
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.

References dummy(), and HitTestForCorner().

◆ HitTestForEdge() [1/2]

bool ZONE_CONTAINER::HitTestForEdge ( const wxPoint refPos,
int  aAccuracy,
SHAPE_POLY_SET::VERTEX_INDEX aCornerHit 
) const

Function HitTestForEdge tests 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
bool - true if some edge was found to be closer to refPos than aClearance.

Definition at line 487 of file class_zone.cpp.

489 {
490  return m_Poly->CollideEdge( VECTOR2I( refPos ), aCornerHit, aAccuracy );
491 }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822
bool CollideEdge(const VECTOR2I &aPoint, VERTEX_INDEX &aClosestVertex, int aClearance=0) const
Function CollideEdge Checks whether aPoint collides with any edge of any of the contours of the polyg...

References SHAPE_POLY_SET::CollideEdge(), and m_Poly.

Referenced by HitTest(), HitTestForEdge(), GENERAL_COLLECTOR::Inspect(), and SetSelectedCorner().

◆ HitTestForEdge() [2/2]

bool ZONE_CONTAINER::HitTestForEdge ( const wxPoint refPos,
int  aAccuracy 
) const

Function HitTestForEdge tests 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
bool - true if some edge was found to be closer to refPos than aClearance.

Definition at line 494 of file class_zone.cpp.

495 {
497  return HitTestForEdge( refPos, aAccuracy, dummy );
498 }
Struct VERTEX_INDEX.
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
bool HitTestForEdge(const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
Function HitTestForEdge tests if the given wxPoint is near a segment defined by 2 corners.
Definition: class_zone.cpp:487

References dummy(), and HitTestForEdge().

◆ initDataFromSrcInCopyCtor()

void ZONE_CONTAINER::initDataFromSrcInCopyCtor ( const ZONE_CONTAINER aZone)
protected

Copy aZone data to me members are expected non initialize in this.

copyDataFromSrc() is expected to be called only from a copy constructor.

Definition at line 132 of file class_zone.cpp.

133 {
134  // members are expected non initialize in this.
135  // initDataFromSrcInCopyCtor() is expected to be called
136  // only from a copy constructor.
137 
138  // Copy only useful EDA_ITEM flags:
139  m_Flags = aZone.m_Flags;
141 
142  m_isKeepout = aZone.m_isKeepout;
143  SetLayerSet( aZone.GetLayerSet() );
144 
145  m_zoneName = aZone.m_zoneName;
146 
147  m_Poly = new SHAPE_POLY_SET( *aZone.m_Poly );
148 
149  // For corner moving, corner index to drag, or nullptr if no selection
150  m_CornerSelection = nullptr;
151  m_IsFilled = aZone.m_IsFilled;
152  m_ZoneClearance = aZone.m_ZoneClearance; // clearance value
155  m_FillMode = aZone.m_FillMode; // Filling mode (segments/polygons)
156  m_hv45 = aZone.m_hv45;
157  m_priority = aZone.m_priority;
161 
162  for( PCB_LAYER_ID layer : aZone.GetLayerSet().Seq() )
163  {
164  m_FilledPolysList[layer] = aZone.m_FilledPolysList.at( layer );
165  m_RawPolysList[layer] = aZone.m_RawPolysList.at( layer );
166  m_filledPolysHash[layer] = aZone.m_filledPolysHash.at( layer );
167  m_FillSegmList[layer] = aZone.m_FillSegmList.at( layer ); // vector <> copy
168  m_insulatedIslands[layer] = aZone.m_insulatedIslands.at( layer );
169  }
170 
176 
179 
180  m_hatchStyle = aZone.m_hatchStyle;
181  m_hatchPitch = aZone.m_hatchPitch;
182  m_HatchLines = aZone.m_HatchLines;
183 
189 
190  SetLocalFlags( aZone.GetLocalFlags() );
191 
192  // Now zone type and layer are set, transfer net info
193  // (has meaning only for copper zones)
194  m_netinfo = aZone.m_netinfo;
195 
196  m_area = aZone.m_area;
197 
198  SetNeedRefill( aZone.NeedRefill() );
199 }
int m_ZoneClearance
Clearance value in internal units.
Definition: class_zone.h:852
bool m_doNotAllowPads
Definition: class_zone.h:848
bool m_doNotAllowTracks
Definition: class_zone.h:847
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: class_zone.h:904
std::map< PCB_LAYER_ID, std::set< int > > m_insulatedIslands
For each layer, a set of insulated islands that were not removed.
Definition: class_zone.h:933
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Function Seq returns an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:377
bool m_doNotAllowFootprints
Definition: class_zone.h:849
ZONE_CONNECTION m_PadConnection
Definition: class_zone.h:851
virtual LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_zone.cpp:312
void SetLayerSet(LSET aLayerSet)
Definition: class_zone.cpp:264
int m_HatchFillTypeSmoothingLevel
Grid pattern smoothing type, similar to corner smoothing type 0 = no smoothing, 1 = fillet,...
Definition: class_zone.h:897
wxString m_zoneName
An optional unique name for this zone, used for identifying it in DRC checking.
Definition: class_zone.h:827
PCB_LAYER_ID
A quick note on layer IDs:
int m_ThermalReliefCopperBridge
Definition: class_zone.h:877
std::vector< SEG > m_HatchLines
Definition: class_zone.h:930
SHAPE_POLY_SET.
double m_HatchFillTypeOrientation
Grid style shape: orientation in degrees of the grid lines.
Definition: class_zone.h:893
bool m_IsFilled
True when a zone was filled, false after deleting the filled areas.
Definition: class_zone.h:865
ZONE_HATCH_STYLE m_hatchStyle
Definition: class_zone.h:928
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822
unsigned m_priority
Definition: class_zone.h:835
bool m_doNotAllowVias
Definition: class_zone.h:846
int m_cornerSmoothingType
Definition: class_zone.h:823
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_RawPolysList
Definition: class_zone.h:923
double m_HatchFillTypeSmoothingValue
Grid pattern smoothing value for smoothing shape size calculations this is the ratio between the gap ...
Definition: class_zone.h:901
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: class_zone.h:926
unsigned int m_cornerRadius
Definition: class_zone.h:824
bool NeedRefill() const
Definition: class_zone.h:188
bool m_doNotAllowCopperPour
Definition: class_zone.h:845
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:912
int m_ThermalReliefGap
Width of the copper bridge in thermal reliefs.
Definition: class_zone.h:874
int m_ZoneMinThickness
Minimum thickness value in filled areas.
Definition: class_zone.h:853
ZONE_FILL_MODE m_FillMode
How to fill areas: ZONE_FILL_MODE::POLYGONS => use solid polygons ZONE_FILL_MODE::HATCH_PATTERN => us...
Definition: class_zone.h:884
int m_HatchFillTypeThickness
Grid style shape: thickness of lines (if 0 -> solid shape)
Definition: class_zone.h:887
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.
STATUS_FLAGS m_Flags
Definition: base_struct.h:176
void SetLocalFlags(int aFlags)
Definition: class_zone.h:257
int m_HatchFillTypeGap
Grid style shape: dist between center of lines (grid size) (0 -> solid shape)
Definition: class_zone.h:890
bool m_forceVisible
Definition: base_struct.h:175
int GetLocalFlags() const
Definition: class_zone.h:256
bool m_FilledPolysUseThickness
outline of filled polygons have thickness.
Definition: class_zone.h:854
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:922
void SetNeedRefill(bool aNeedRefill)
Definition: class_zone.h:189

References GetLayerSet(), GetLocalFlags(), m_area, m_cornerRadius, m_CornerSelection, m_cornerSmoothingType, m_doNotAllowCopperPour, m_doNotAllowFootprints, m_doNotAllowPads, m_doNotAllowTracks, m_doNotAllowVias, m_filledPolysHash, m_FilledPolysList, m_FilledPolysUseThickness, m_FillMode, m_FillSegmList, EDA_ITEM::m_Flags, EDA_ITEM::m_forceVisible, m_HatchFillTypeGap, m_HatchFillTypeOrientation, m_HatchFillTypeSmoothingLevel, m_HatchFillTypeSmoothingValue, m_HatchFillTypeThickness, m_HatchLines, m_hatchPitch, m_hatchStyle, m_hv45, m_insulatedIslands, m_IsFilled, m_isKeepout, BOARD_CONNECTED_ITEM::m_netinfo, m_PadConnection, m_Poly, m_priority, m_RawPolysList, m_ThermalReliefCopperBridge, m_ThermalReliefGap, m_ZoneClearance, m_ZoneMinThickness, m_zoneName, NeedRefill(), LSET::Seq(), SetLayerSet(), SetLocalFlags(), and SetNeedRefill().

Referenced by MODULE_ZONE_CONTAINER::MODULE_ZONE_CONTAINER(), and ZONE_CONTAINER().

◆ IsBrightened()

bool EDA_ITEM::IsBrightened ( ) const
inlineinherited

◆ IsConnected()

bool BOARD_CONNECTED_ITEM::IsConnected ( ) const
inlineoverridevirtualinherited

Reimplemented from BOARD_ITEM.

Definition at line 72 of file board_connected_item.h.

73  {
74  return true;
75  }

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 201 of file base_struct.h.

201 { return m_Flags & IS_DRAGGED; }
#define IS_DRAGGED
Item being dragged.
Definition: base_struct.h:119
STATUS_FLAGS m_Flags
Definition: base_struct.h:176

References IS_DRAGGED, and EDA_ITEM::m_Flags.

Referenced by DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC(), and KIGFX::SCH_PAINTER::setDeviceColors().

◆ IsFilled()

bool ZONE_CONTAINER::IsFilled ( ) const
inline

Definition at line 185 of file class_zone.h.

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

References m_IsFilled.

Referenced by PCB_EDIT_FRAME::Edit_Zone_Params(), export_vrml_zones(), PCB_IO::format(), and DRC::GetLocation().

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 286 of file base_struct.h.

286 { return m_forceVisible; }
bool m_forceVisible
Definition: base_struct.h:175

References EDA_ITEM::m_forceVisible.

Referenced by KIGFX::SCH_PAINTER::draw(), and SCH_FIELD::Print().

◆ IsIsland()

bool ZONE_CONTAINER::IsIsland ( PCB_LAYER_ID  aLayer,
int  aPolyIdx 
)

Checks if a given filled polygon is an insulated island.

Parameters
aLayeris the layer to test
aPolyIdxis an inndex into m_FilledPolysList[aLayer]
Returns
true if the given polygon is insulated (i.e. has no net connection)

Definition at line 1171 of file class_zone.cpp.

1172 {
1173  if( GetNetCode() < 1 )
1174  return true;
1175 
1176  if( !m_insulatedIslands.count( aLayer ) )
1177  return false;
1178 
1179  return m_insulatedIslands.at( aLayer ).count( aPolyIdx );
1180 }
int GetNetCode() const
Function GetNetCode.
std::map< PCB_LAYER_ID, std::set< int > > m_insulatedIslands
For each layer, a set of insulated islands that were not removed.
Definition: class_zone.h:933

References BOARD_CONNECTED_ITEM::GetNetCode(), and m_insulatedIslands.

Referenced by PCB_IO::format().

◆ IsLocked()

virtual bool BOARD_ITEM::IsLocked ( ) const
inlinevirtualinherited

Function IsLocked.

Returns
bool - true if the object is locked, else false

Reimplemented in MODULE, and TRACK.

Definition at line 215 of file class_board_item.h.

216  {
217  // only MODULEs & TRACKs can be locked at this time.
218  return false;
219  }

Referenced by PCBNEW_CONTROL::DeleteItemCursor(), EditToolSelectionFilter(), GENERAL_COLLECTOR::Inspect(), SELECTION_TOOL::itemPassesFilter(), and PCB_EDITOR_CONTROL::modifyLockSelected().

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 198 of file base_struct.h.

198 { return m_Flags & IS_CHANGED; }
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:113
STATUS_FLAGS m_Flags
Definition: base_struct.h:176

References IS_CHANGED, and EDA_ITEM::m_Flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsNew()

◆ IsOnCopperLayer()

bool ZONE_CONTAINER::IsOnCopperLayer ( ) const
overridevirtual

Function IsOnCopperLayer.

Returns
true if this zone is on a copper layer, false if on a technical layer

Reimplemented from BOARD_ITEM.

Definition at line 242 of file class_zone.cpp.

243 {
244  return ( m_layerSet & LSET::AllCuMask() ).count() > 0;
245 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:712

References LSET::AllCuMask(), and m_layerSet.

Referenced by GERBER_JOBFILE_WRITER::addJSONDesignRules(), BOARD_NETLIST_UPDATER::cacheCopperZoneConnections(), ZONE_FILLER::fillSingleZone(), GetMsgPanelInfo(), BRDITEMS_PLOTTER::PlotFilledAreas(), BOARD::SetAreasNetCodesFromNetNames(), DRC::testZones(), and BOARD_NETLIST_UPDATER::updateCopperZoneNets().

◆ IsOnLayer()

bool ZONE_CONTAINER::IsOnLayer ( PCB_LAYER_ID  aLayer) const
overridevirtual

Function IsOnLayer tests to see if this object is on the given layer.

Is virtual so objects like D_PAD, which reside on multiple layers can do their own form of testing.

Parameters
aLayerThe layer to test for.
Returns
bool - true if on given layer, else false.

Reimplemented from BOARD_ITEM.

Definition at line 329 of file class_zone.cpp.

330 {
331  return m_layerSet.test( aLayer );
332 }

References m_layerSet.

Referenced by DRC_KEEPOUT_TESTER::checkTracksAndVias(), BOARD_ADAPTER::createLayers(), KIGFX::PCB_PAINTER::draw(), and DSN::SPECCTRA_DB::FromBOARD().

◆ IsReplaceable()

virtual bool EDA_ITEM::IsReplaceable ( ) const
inlinevirtualinherited

Function IsReplaceable.

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_COMPONENT, SCH_SHEET, SCH_LABEL, SCH_TEXT, SCH_SHEET_PIN, and SCH_FIELD.

Definition at line 501 of file base_struct.h.

501 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 204 of file base_struct.h.

204 { return m_Flags & IS_RESIZED; }
STATUS_FLAGS m_Flags
Definition: base_struct.h:176
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:118

References IS_RESIZED, and EDA_ITEM::m_Flags.

Referenced by KIGFX::SCH_PAINTER::setDeviceColors().

◆ IsSame()

bool ZONE_CONTAINER::IsSame ( const ZONE_CONTAINER aZoneToCompare)

Function IsSame tests if 2 zones are equivalent: 2 zones are equivalent if they have same parameters and same outlines info, filling is not taken into account.

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.

Parameters
aZoneToCompare= zone to compare with "this"

Definition at line 62 of file zones_functions_for_undo_redo.cpp.

63 {
64  // compare basic parameters:
65  if( GetLayerSet() != aZoneToCompare.GetLayerSet() )
66  return false;
67 
68  if( GetNetCode() != aZoneToCompare.GetNetCode() )
69  return false;
70 
71  if( GetPriority() != aZoneToCompare.GetPriority() )
72  return false;
73 
74  // Compare zone specific parameters
75  if( GetIsKeepout() != aZoneToCompare.GetIsKeepout() )
76  return false;
77 
78  if( GetIsKeepout() )
79  {
80  if( GetDoNotAllowCopperPour() != aZoneToCompare.GetDoNotAllowCopperPour() )
81  return false;
82 
83  if( GetDoNotAllowVias() != aZoneToCompare.GetDoNotAllowVias() )
84  return false;
85 
86  if( GetDoNotAllowTracks() != aZoneToCompare.GetDoNotAllowTracks() )
87  return false;
88 
89  if( GetDoNotAllowPads() != aZoneToCompare.GetDoNotAllowPads() )
90  return false;
91 
92  if( GetDoNotAllowFootprints() != aZoneToCompare.GetDoNotAllowFootprints() )
93  return false;
94  }
95 
96  if( m_ZoneClearance != aZoneToCompare.m_ZoneClearance )
97  return false;
98 
99  if( m_ZoneMinThickness != aZoneToCompare.GetMinThickness() )
100  return false;
101 
102  if( m_FillMode != aZoneToCompare.GetFillMode() )
103  return false;
104 
105  if( m_PadConnection != aZoneToCompare.m_PadConnection )
106  return false;
107 
108  if( m_ThermalReliefGap != aZoneToCompare.m_ThermalReliefGap )
109  return false;
110 
112  return false;
113 
114  if( m_zoneName != aZoneToCompare.m_zoneName )
115  return false;
116 
117  if( m_islandRemovalMode != aZoneToCompare.m_islandRemovalMode )
118  return false;
119 
120  if( m_minIslandArea != aZoneToCompare.m_minIslandArea )
121  return false;
122 
123 
124  // Compare outlines
125  wxASSERT( m_Poly ); // m_Poly == NULL Should never happen
126  wxASSERT( aZoneToCompare.Outline() );
127 
128  if( Outline() != aZoneToCompare.Outline() ) // Compare vector
129  return false;
130 
131  return true;
132 }
bool GetDoNotAllowPads() const
Definition: class_zone.h:706
int m_ZoneClearance
Clearance value in internal units.
Definition: class_zone.h:852
int GetNetCode() const
Function GetNetCode.
ISLAND_REMOVAL_MODE m_islandRemovalMode
Definition: class_zone.h:856
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:271
long long int m_minIslandArea
When island removal mode is set to AREA, islands below this area will be removed.
Definition: class_zone.h:862
bool GetDoNotAllowVias() const
Definition: class_zone.h:704
ZONE_CONNECTION m_PadConnection
Definition: class_zone.h:851
virtual LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_zone.cpp:312
wxString m_zoneName
An optional unique name for this zone, used for identifying it in DRC checking.
Definition: class_zone.h:827
int m_ThermalReliefCopperBridge
Definition: class_zone.h:877
ZONE_FILL_MODE GetFillMode() const
Definition: class_zone.h:148
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822
bool GetDoNotAllowCopperPour() const
Definition: class_zone.h:703
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:702
int m_ThermalReliefGap
Width of the copper bridge in thermal reliefs.
Definition: class_zone.h:874
int m_ZoneMinThickness
Minimum thickness value in filled areas.
Definition: class_zone.h:853
ZONE_FILL_MODE m_FillMode
How to fill areas: ZONE_FILL_MODE::POLYGONS => use solid polygons ZONE_FILL_MODE::HATCH_PATTERN => us...
Definition: class_zone.h:884
unsigned GetPriority() const
Function GetPriority.
Definition: class_zone.h:101
int GetMinThickness() const
Definition: class_zone.h:201
bool GetDoNotAllowTracks() const
Definition: class_zone.h:705
bool GetDoNotAllowFootprints() const
Definition: class_zone.h:707

References GetDoNotAllowCopperPour(), GetDoNotAllowFootprints(), GetDoNotAllowPads(), GetDoNotAllowTracks(), GetDoNotAllowVias(), GetFillMode(), GetIsKeepout(), GetLayerSet(), GetMinThickness(), BOARD_CONNECTED_ITEM::GetNetCode(), GetPriority(), m_FillMode, m_islandRemovalMode, m_minIslandArea, m_PadConnection, m_Poly, m_ThermalReliefCopperBridge, m_ThermalReliefGap, m_ZoneClearance, m_ZoneMinThickness, m_zoneName, and Outline().

Referenced by UpdateCopyOfZonesList().

◆ IsSelected()

◆ IsTrack()

bool BOARD_ITEM::IsTrack ( ) const
inlineinherited

Function IsTrack tests to see if this object is a track or via (or microvia).

form of testing.

Returns
bool - true if a track or via, else false.

Definition at line 206 of file class_board_item.h.

207  {
208  return ( Type() == PCB_TRACE_T ) || ( Type() == PCB_VIA_T );
209  }
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

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

◆ IsType()

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

Function IsType Checks whether the item is one of the listed types.

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

Reimplemented in SCH_LABEL, VIA, DIMENSION, D_PAD, DRAWSEGMENT, TEXTE_MODULE, SCH_FIELD, SCH_LINE, EDGE_MODULE, and TEXTE_PCB.

Definition at line 262 of file base_struct.h.

263  {
264  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
265  return true;
266 
267  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
268  {
269  if( m_StructType == *p )
270  return true;
271  }
272 
273  return false;
274  }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it.
Definition: base_struct.h:170
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78

References EOT, EDA_ITEM::m_StructType, and SCH_LOCATE_ANY_T.

Referenced by GetRule(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingBus(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLine(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingWire(), TEXTE_PCB::IsType(), EDGE_MODULE::IsType(), SCH_LINE::IsType(), SCH_FIELD::IsType(), TEXTE_MODULE::IsType(), DRAWSEGMENT::IsType(), D_PAD::IsType(), DIMENSION::IsType(), VIA::IsType(), SCH_LABEL::IsType(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), EE_SELECTION_TOOL::RequestSelection(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), EDA_ITEM::Visit(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 202 of file base_struct.h.

202 { return m_Flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:121
STATUS_FLAGS m_Flags
Definition: base_struct.h:176

References IS_WIRE_IMAGE, and EDA_ITEM::m_Flags.

◆ Iterate()

SHAPE_POLY_SET::ITERATOR ZONE_CONTAINER::Iterate ( )
inline

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

Returns
SHAPE_POLY_SET::ITERATOR - an iterator to visit the zone vertices without holes.

Definition at line 487 of file class_zone.h.

488  {
489  return m_Poly->Iterate();
490  }
ITERATOR Iterate(int aFirst, int aLast, bool aIterateHoles=false)
Function Iterate returns an object to iterate through the points of the polygons between aFirst and a...
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822

References SHAPE_POLY_SET::Iterate(), and 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

IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T )

IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T )

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

Definition at line 383 of file base_struct.h.

387  {
388  for( auto it : aList )
389  {
390  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
392  return SEARCH_RESULT::QUIT;
393  }
394 
396  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
Function Visit may be re-implemented for each derived class in order to handle all the types given by...

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

Referenced by GERBER_FILE_IMAGE::Visit(), and BOARD::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

IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T )

IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T )

This changes first parameter to avoid the DList and use std::vector instead

Definition at line 404 of file base_struct.h.

406  {
407  for( auto it : aList )
408  {
409  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
411  return SEARCH_RESULT::QUIT;
412  }
413 
415  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
Function Visit may be re-implemented for each derived class in order to handle all the types given by...

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

◆ IterateWithHoles()

SHAPE_POLY_SET::ITERATOR ZONE_CONTAINER::IterateWithHoles ( )
inline

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

Returns
SHAPE_POLY_SET::ITERATOR - an iterator to visit the zone vertices with holes.

Definition at line 497 of file class_zone.h.

498  {
499  return m_Poly->IterateWithHoles();
500  }
ITERATOR IterateWithHoles(int aOutline)
Function IterateWithHoles.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822

References SHAPE_POLY_SET::IterateWithHoles(), and m_Poly.

Referenced by PCB_IO::format(), and DSN::SPECCTRA_DB::FromBOARD().

◆ LayerMaskDescribe()

wxString BOARD_ITEM::LayerMaskDescribe ( const BOARD aBoard,
LSET  aMask 
)
staticprotectedinherited

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

The BOARD is needed because layer names are (somewhat) customizable

Definition at line 80 of file class_board_item.cpp.

81 {
82  // Try to be smart and useful. Check all copper first.
83  if( aMask[F_Cu] && aMask[B_Cu] )
84  return _( "All copper layers" );
85 
86  // Check for copper.
87  auto layer = aBoard->GetEnabledLayers().AllCuMask() & aMask;
88 
89  for( int i = 0; i < 3; i++ )
90  {
91  for( int bit = PCBNEW_LAYER_ID_START; bit < PCB_LAYER_ID_COUNT; ++bit )
92  {
93  if( layer[ bit ] )
94  {
95  wxString layerInfo = aBoard->GetLayerName( static_cast<PCB_LAYER_ID>( bit ) );
96 
97  if( aMask.count() > 1 )
98  layerInfo << _( " and others" );
99 
100  return layerInfo;
101  }
102  }
103 
104  // No copper; first, check for technicals and then for all layers.
105  if( i < 1 ) // first, check for technicals
106  layer = aBoard->GetEnabledLayers().AllTechMask() & aMask;
107  else // then check for all other layers
108  layer = aMask;
109  }
110 
111  // No copper, no technicals: no layer
112  return _( "no layers" );
113 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:712
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer.
LSET GetEnabledLayers() const
Function GetEnabledLayers is a proxy function that calls the corresponding function in m_BoardSetting...
static LSET AllTechMask()
Function AllTechMask returns a mask holding all technical layers (no CU layer) on both side.
Definition: lset.cpp:782
#define _(s)
Definition: 3d_actions.cpp:33

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

Referenced by D_PAD::GetMsgPanelInfo(), and D_PAD::GetSelectMenuText().

◆ Matches() [1/2]

virtual bool EDA_ITEM::Matches ( wxFindReplaceData &  aSearchData,
void *  aAuxData 
)
inlinevirtualinherited

Function Matches compares 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 in SCH_COMPONENT, SCH_SHEET, SCH_TEXT, SCH_SHEET_PIN, SCH_FIELD, LIB_PIN, SCH_PIN, TEXTE_MODULE, SCH_MARKER, MARKER_PCB, and TEXTE_PCB.

Definition at line 457 of file base_struct.h.

458  {
459  return false;
460  }

Referenced by SCH_EDITOR_CONTROL::HasMatch(), TEXTE_PCB::Matches(), MARKER_PCB::Matches(), SCH_MARKER::Matches(), TEXTE_MODULE::Matches(), LIB_PIN::Matches(), SCH_FIELD::Matches(), SCH_SHEET_PIN::Matches(), SCH_TEXT::Matches(), and SCH_EDITOR_CONTROL::ReplaceAndFindNext().

◆ Matches() [2/2]

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

Function Matches compares 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 143 of file base_struct.cpp.

144 {
145  wxString text = aText;
146  wxString searchText = aSearchData.GetFindString();
147 
148  // Don't match if searching for replaceable item and the item doesn't support text replace.
149  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
150  return false;
151 
152  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
153  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
154 
155  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
156  {
157  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
158  return text.Matches( searchText );
159 
160  return text.MakeUpper().Matches( searchText.MakeUpper() );
161  }
162 
163  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
164  return aText.Find( searchText ) != wxNOT_FOUND;
165 
166  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
167 }
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:501

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

◆ Mirror()

void ZONE_CONTAINER::Mirror ( const wxPoint aMirrorRef,
bool  aMirrorLeftRight 
)

Function Mirror Mirror the outlines , relative to a given horizontal axis the layer is not changed.

Parameters
aMirrorRef= axis position
aMirrorLeftRightmirror across Y axis (otherwise mirror across X)

Definition at line 810 of file class_zone.cpp.

811 {
812  // ZONE_CONTAINERs mirror about the x-axis (why?!?)
813  m_Poly->Mirror( aMirrorLeftRight, !aMirrorLeftRight, VECTOR2I( aMirrorRef ) );
814 
815  Hatch();
816 
817  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
818  pair.second.Mirror( aMirrorLeftRight, !aMirrorLeftRight, VECTOR2I( aMirrorRef ) );
819 
820  for( std::pair<const PCB_LAYER_ID, ZONE_SEGMENT_FILL>& pair : m_FillSegmList )
821  {
822  for( SEG& seg : pair.second )
823  {
824  if( aMirrorLeftRight )
825  {
826  MIRROR( seg.A.x, aMirrorRef.x );
827  MIRROR( seg.B.x, aMirrorRef.x );
828  }
829  else
830  {
831  MIRROR( seg.A.y, aMirrorRef.y );
832  MIRROR( seg.B.y, aMirrorRef.y );
833  }
834  }
835  }
836 }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
void Mirror(bool aX=true, bool aY=false, const VECTOR2I &aRef={ 0, 0 })
Mirrors the line points about y or x (or both)
void MIRROR(T &aPoint, const T &aMirrorRef)
Definition: macros.h:175
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822
Definition: seg.h:39
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:912
VECTOR2I A
Definition: seg.h:47
void Hatch()
Function Hatch computes the hatch lines depending on the hatch parameters and stores it in the zone's...
Definition: class_zone.cpp:981
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:922
VECTOR2I B
Definition: seg.h:48

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

Referenced by Flip().

◆ Move() [1/2]

void BOARD_ITEM::Move ( const VECTOR2I aMoveVector)
inlineinherited

Definition at line 254 of file class_board_item.h.

255  {
256  Move( wxPoint( aMoveVector.x, aMoveVector.y ) );
257  }
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.

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

◆ Move() [2/2]

void ZONE_CONTAINER::Move ( const wxPoint offset)
overridevirtual

Function Move Move the outlines.

Parameters
offset= moving vector

Reimplemented from BOARD_ITEM.

Definition at line 734 of file class_zone.cpp.

735 {
736  /* move outlines */
737  m_Poly->Move( offset );
738 
739  Hatch();
740 
741  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
742  pair.second.Move( offset );
743 
744  for( std::pair<const PCB_LAYER_ID, ZONE_SEGMENT_FILL>& pair : m_FillSegmList )
745  {
746  for( SEG& seg : pair.second )
747  {
748  seg.A += VECTOR2I( offset );
749  seg.B += VECTOR2I( offset );
750  }
751  }
752 }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
void Move(const VECTOR2I &aVector) override
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822
Definition: seg.h:39
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:912
VECTOR2I A
Definition: seg.h:47
void Hatch()
Function Hatch computes the hatch lines depending on the hatch parameters and stores it in the zone's...
Definition: class_zone.cpp:981
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:922
VECTOR2I B
Definition: seg.h:48

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

◆ MoveEdge()

void ZONE_CONTAINER::MoveEdge ( const wxPoint offset,
int  aEdge 
)

Function MoveEdge Move the outline Edge.

Parameters
offset= moving vector
aEdge= start point of the outline edge

Definition at line 755 of file class_zone.cpp.

756 {
757  int next_corner;
758 
759  if( m_Poly->GetNeighbourIndexes( aEdge, nullptr, &next_corner ) )
760  {
761  m_Poly->SetVertex( aEdge, m_Poly->CVertex( aEdge ) + VECTOR2I( offset ) );
762  m_Poly->SetVertex( next_corner, m_Poly->CVertex( next_corner ) + VECTOR2I( offset ) );
763  Hatch();
764 
765  SetNeedRefill( true );
766  }
767 }
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Returns the index-th vertex in a given hole outline within a given outline
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
bool GetNeighbourIndexes(int aGlobalIndex, int *aPrevious, int *aNext)
Returns the global indexes of the previous and the next corner of the aGlobalIndex-th corner of a con...
void SetVertex(const VERTEX_INDEX &aIndex, const VECTOR2I &aPos)
Function SetVertex Accessor function to set the position of a specific point.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822
void Hatch()
Function Hatch computes the hatch lines depending on the hatch parameters and stores it in the zone's...
Definition: class_zone.cpp:981
void SetNeedRefill(bool aNeedRefill)
Definition: class_zone.h:189

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

◆ NeedRefill()

bool ZONE_CONTAINER::NeedRefill ( ) const
inline

Definition at line 188 of file class_zone.h.

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

References m_needRefill.

Referenced by initDataFromSrcInCopyCtor().

◆ NewHole()

void ZONE_CONTAINER::NewHole ( )
inline

Function NewHole creates a new hole on the zone; i.e., a new contour on the zone's outline.

Definition at line 550 of file class_zone.h.

551  {
552  m_Poly->NewHole();
553  }
int NewHole(int aOutline=-1)
Creates a new hole in a given outline
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822

References m_Poly, and SHAPE_POLY_SET::NewHole().

Referenced by EAGLE_PLUGIN::loadPlain(), and EAGLE_PLUGIN::packageCircle().

◆ operator<()

bool EDA_ITEM::operator< ( const EDA_ITEM aItem) const
inherited

Test if another item is less than this object.

Parameters
aItem- Item to compare against.
Returns
- True if aItem is less than the item.

Definition at line 197 of file base_struct.cpp.

198 {
199  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
200  GetChars( GetClass() ) ) );
201 
202  return false;
203 }
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:153
virtual wxString GetClass() const =0
Function GetClass returns the class name.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205

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

◆ operator=()

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

Definition at line 81 of file class_zone.cpp.

82 {
84 
85  // Replace the outlines for aOther outlines.
86  delete m_Poly;
87  m_Poly = new SHAPE_POLY_SET( *aOther.m_Poly );
88 
89  m_isKeepout = aOther.m_isKeepout;
90  SetLayerSet( aOther.GetLayerSet() );
91 
92  m_zoneName = aOther.m_zoneName;
93  m_IsFilled = aOther.m_IsFilled;
94  m_CornerSelection = nullptr; // for corner moving, corner index to (null if no selection)
95  m_ZoneClearance = aOther.m_ZoneClearance; // clearance value
98  m_FillMode = aOther.m_FillMode; // filling mode (segments/polygons)
102  SetHatchStyle( aOther.GetHatchStyle() );
103  SetHatchPitch( aOther.GetHatchPitch() );
104  m_HatchLines = aOther.m_HatchLines; // copy vector <SEG>
105 
106  for( PCB_LAYER_ID layer : aOther.GetLayerSet().Seq() )
107  {
108  m_FilledPolysList[layer] = aOther.m_FilledPolysList.at( layer );
109  m_RawPolysList[layer] = aOther.m_RawPolysList.at( layer );
110  m_filledPolysHash[layer] = aOther.m_filledPolysHash.at( layer );
111  m_FillSegmList[layer] = aOther.m_FillSegmList.at( layer ); // vector <> copy
112  m_insulatedIslands[layer] = aOther.m_insulatedIslands.at( layer );
113  }
114 
120 
121  return *this;
122 }
void SetHatchPitch(int aPitch)
Function SetHatchPitch sets the hatch pitch parameter for the zone.
Definition: class_zone.cpp:961
int m_ZoneClearance
Clearance value in internal units.
Definition: class_zone.h:852
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: class_zone.h:904
void SetHatchStyle(ZONE_HATCH_STYLE aStyle)
Definition: class_zone.h:570
std::map< PCB_LAYER_ID, std::set< int > > m_insulatedIslands
For each layer, a set of insulated islands that were not removed.
Definition: class_zone.h:933
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Function Seq returns an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:377
ZONE_CONNECTION m_PadConnection
Definition: class_zone.h:851
virtual LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_zone.cpp:312
void SetLayerSet(LSET aLayerSet)
Definition: class_zone.cpp:264
int m_HatchFillTypeSmoothingLevel
Grid pattern smoothing type, similar to corner smoothing type 0 = no smoothing, 1 = fillet,...
Definition: class_zone.h:897
wxString m_zoneName
An optional unique name for this zone, used for identifying it in DRC checking.
Definition: class_zone.h:827
PCB_LAYER_ID
A quick note on layer IDs:
int m_ThermalReliefCopperBridge
Definition: class_zone.h:877
std::vector< SEG > m_HatchLines
Definition: class_zone.h:930
SHAPE_POLY_SET.
double m_HatchFillTypeOrientation
Grid style shape: orientation in degrees of the grid lines.
Definition: class_zone.h:893
bool m_IsFilled
True when a zone was filled, false after deleting the filled areas.
Definition: class_zone.h:865
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_RawPolysList
Definition: class_zone.h:923
double m_HatchFillTypeSmoothingValue
Grid pattern smoothing value for smoothing shape size calculations this is the ratio between the gap ...
Definition: class_zone.h:901
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: class_zone.h:926
ZONE_HATCH_STYLE GetHatchStyle() const
Definition: class_zone.h:565
EDA_ITEM & operator=(const EDA_ITEM &aItem)
Operator assignment is used to assign the members of aItem to another object.
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:912
int m_ThermalReliefGap
Width of the copper bridge in thermal reliefs.
Definition: class_zone.h:874
int m_ZoneMinThickness
Minimum thickness value in filled areas.
Definition: class_zone.h:853
ZONE_FILL_MODE m_FillMode
How to fill areas: ZONE_FILL_MODE::POLYGONS => use solid polygons ZONE_FILL_MODE::HATCH_PATTERN => us...
Definition: class_zone.h:884
int m_HatchFillTypeThickness
Grid style shape: thickness of lines (if 0 -> solid shape)
Definition: class_zone.h:887
int GetHatchPitch() const
Hatch related methods.
Definition: class_zone.cpp:945
int m_HatchFillTypeGap
Grid style shape: dist between center of lines (grid size) (0 -> solid shape)
Definition: class_zone.h:890
bool m_FilledPolysUseThickness
outline of filled polygons have thickness.
Definition: class_zone.h:854
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:922

References GetHatchPitch(), GetHatchStyle(), GetLayerSet(), m_CornerSelection, m_filledPolysHash, m_FilledPolysList, m_FilledPolysUseThickness, m_FillMode, m_FillSegmList, m_HatchFillTypeGap, m_HatchFillTypeOrientation, m_HatchFillTypeSmoothingLevel, m_HatchFillTypeSmoothingValue, m_HatchFillTypeThickness, m_HatchLines, m_insulatedIslands, m_IsFilled, m_isKeepout, m_PadConnection, m_Poly, m_RawPolysList, m_ThermalReliefCopperBridge, m_ThermalReliefGap, m_ZoneClearance, m_ZoneMinThickness, m_zoneName, EDA_ITEM::operator=(), LSET::Seq(), SetHatchPitch(), SetHatchStyle(), and SetLayerSet().

Referenced by MODULE_ZONE_CONTAINER::operator=().

◆ Outline() [1/2]

◆ Outline() [2/2]

const SHAPE_POLY_SET* ZONE_CONTAINER::Outline ( ) const
inline

Definition at line 272 of file class_zone.h.

272 { return const_cast< SHAPE_POLY_SET* >( m_Poly ); }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822

References m_Poly.

◆ RawPolysList()

SHAPE_POLY_SET& ZONE_CONTAINER::RawPolysList ( PCB_LAYER_ID  aLayer)
inline

Definition at line 687 of file class_zone.h.

688  {
689  wxASSERT( m_RawPolysList.count( aLayer ) );
690  return m_RawPolysList.at( aLayer );
691  }
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_RawPolysList
Definition: class_zone.h:923

References m_RawPolysList.

◆ RemoveAllContours()

void ZONE_CONTAINER::RemoveAllContours ( void  )
inline

Definition at line 512 of file class_zone.h.

513  {
515  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.

References m_Poly, and SHAPE_POLY_SET::RemoveAllContours().

◆ RemoveCutout()

void ZONE_CONTAINER::RemoveCutout ( int  aOutlineIdx,
int  aHoleIdx 
)

Remove a cutout from the zone.

Parameters
aOutlineIdxis the zone outline the hole belongs to
aHoleIdxis the hole in the outline to remove

Definition at line 848 of file class_zone.cpp.

849 {
850  // Ensure the requested cutout is valid
851  if( m_Poly->OutlineCount() < aOutlineIdx || m_Poly->HoleCount( aOutlineIdx ) < aHoleIdx )
852  return;
853 
854  SHAPE_POLY_SET cutPoly( m_Poly->Hole( aOutlineIdx, aHoleIdx ) );
855 
856  // Add the cutout back to the zone
858 
859  SetNeedRefill( true );
860 }
int OutlineCount() const
Returns the number of outlines in the set
void BooleanAdd(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Performs boolean polyset union For aFastMode meaning, see function booleanOp
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Returns the reference to aHole-th hole in the aIndex-th outline
SHAPE_POLY_SET.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822
int HoleCount(int aOutline) const
Returns the number of holes in a given outline
void SetNeedRefill(bool aNeedRefill)
Definition: class_zone.h:189

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

◆ Replace() [1/2]

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

Helper function used in search and replace dialog Function Replace performs 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 base_struct.cpp.

171 {
172  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
173 
174  int result = searchString.Find( (aSearchData.GetFlags() & wxFR_MATCHCASE) ?
175  aSearchData.GetFindString() :
176  aSearchData.GetFindString().Upper() );
177 
178  if( result == wxNOT_FOUND )
179  return false;
180 
181  wxString prefix = aText.Left( result );
182  wxString suffix;
183 
184  if( aSearchData.GetFindString().length() + result < aText.length() )
185  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
186 
187  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
188  GetChars( aText ), GetChars( prefix ), GetChars( aSearchData.GetReplaceString() ),
189  GetChars( suffix ) );
190 
191  aText = prefix + aSearchData.GetReplaceString() + suffix;
192 
193  return true;
194 }
const wxChar *const traceFindReplace
Flag to enable find and replace debug tracing.
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:153

References GetChars(), and traceFindReplace.

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

◆ Replace() [2/2]

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

Function Replace performs 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_SHEET_PIN, and SCH_FIELD.

Definition at line 489 of file base_struct.h.

489 { return false; }

◆ Rotate() [1/2]

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

Definition at line 270 of file class_board_item.h.

271  {
272  Rotate( wxPoint( aRotCentre.x, aRotCentre.y ), aAngle );
273  }
virtual void Rotate(const wxPoint &aRotCentre, double aAngle)
Function Rotate Rotate this object.

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

◆ Rotate() [2/2]

void ZONE_CONTAINER::Rotate ( const wxPoint centre,
double  angle 
)
overridevirtual

Function Rotate Move the outlines.

Parameters
centre= rot centre
angle= in 0.1 degree

Reimplemented from BOARD_ITEM.

Definition at line 770 of file class_zone.cpp.

771 {
772  wxPoint pos;
773 
774  angle = -DECIDEG2RAD( angle );
775 
776  m_Poly->Rotate( angle, VECTOR2I( centre ) );
777  Hatch();
778 
779  /* rotate filled areas: */
780  for( std::pair<const PCB_LAYER_ID, SHAPE_POLY_SET>& pair : m_FilledPolysList )
781  pair.second.Rotate( angle, VECTOR2I( centre ) );
782 
783  for( std::pair<const PCB_LAYER_ID, ZONE_SEGMENT_FILL>& pair : m_FillSegmList )
784  {
785  for( SEG& seg : pair.second )
786  {
787  wxPoint a( seg.A );
788  RotatePoint( &a, centre, angle );
789  seg.A = a;
790  wxPoint b( seg.B );
791  RotatePoint( &b, centre, angle );
792  seg.B = a;
793  }
794  }
795 }
void Rotate(double aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Function Rotate rotates all vertices by a given angle.
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822
Definition: seg.h:39
std::map< PCB_LAYER_ID, ZONE_SEGMENT_FILL > m_FillSegmList
Segments used to fill the zone (m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:912
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
VECTOR2I A
Definition: seg.h:47
double DECIDEG2RAD(double deg)
Definition: trigo.h:218
void Hatch()
Function Hatch computes the hatch lines depending on the hatch parameters and stores it in the zone's...
Definition: class_zone.cpp:981
std::map< PCB_LAYER_ID, SHAPE_POLY_SET > m_FilledPolysList
Definition: class_zone.h:922
VECTOR2I B
Definition: seg.h:48

References SEG::A, PNS::angle(), SEG::B, DECIDEG2RAD(), Hatch(), m_FilledPolysList, m_FillSegmList, m_Poly, SHAPE_POLY_SET::Rotate(), and RotatePoint().

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

◆ SetBrightened()

void EDA_ITEM::SetBrightened ( )
inlineinherited

◆ SetCornerPosition()

void ZONE_CONTAINER::SetCornerPosition ( int  aCornerIndex,
wxPoint  new_pos 
)
inline

Definition at line 528 of file class_zone.h.

529  {
530  SHAPE_POLY_SET::VERTEX_INDEX relativeIndices;
531 
532  // Convert global to relative indices
533  if( m_Poly->GetRelativeIndices( aCornerIndex, &relativeIndices ) )
534  {
535  if( m_Poly->CVertex( relativeIndices ).x != new_pos.x
536  || m_Poly->CVertex( relativeIndices ).y != new_pos.y )
537  {
538  SetNeedRefill( true );
539  m_Poly->SetVertex( relativeIndices, new_pos );
540  }
541  }
542  else
543  throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
544  }
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Returns the index-th vertex in a given hole outline within a given outline
Struct VERTEX_INDEX.
void SetVertex(const VERTEX_INDEX &aIndex, const VECTOR2I &aPos)
Function SetVertex Accessor function to set the position of a specific point.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:822
bool GetRelativeIndices(int aGlobalIdx, VERTEX_INDEX *aRelativeIndices) const
Function GetRelativeIndices.
void SetNeedRefill(bool aNeedRefill)
Definition: class_zone.h:189

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

◆ SetCornerRadius()

void ZONE_CONTAINER::SetCornerRadius ( unsigned int  aRadius)

Definition at line 439 of file class_zone.cpp.

440 {
441  if( m_cornerRadius != aRadius )
442  SetNeedRefill( true );
443 
444  m_cornerRadius = aRadius;
445 }
unsigned int m_cornerRadius
Definition: class_zone.h:824
void SetNeedRefill(bool aNeedRefill)
Definition: class_zone.h:189

References m_cornerRadius, and SetNeedRefill().

Referenced by ZONE_SETTINGS::ExportSetting().

◆ SetCornerSmoothingType()

void ZONE_CONTAINER::SetCornerSmoothingType ( int  aType)
inline

Definition at line 653 of file class_zone.h.

653 { m_cornerSmoothingType = aType; };
int m_cornerSmoothingType
Definition: class_zone.h:823

References m_cornerSmoothingType.

Referenced by ZONE_SETTINGS::ExportSetting().