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_UNITS aUnits, 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...
 
void Print (PCB_BASE_FRAME *aFrame, wxDC *DC, const wxPoint &offset=ZeroOffset) override
 Function Print Prints the zone outline. More...
 
void PrintFilledArea (PCB_BASE_FRAME *aFrame, wxDC *DC, const wxPoint &offset=ZeroOffset)
 Function PrintFilledArea Draws the filled area for this zone (polygon list .m_FilledPolysList) More...
 
const EDA_RECT GetBoundingBox () const override
 Function GetBoundingBox (virtual) More...
 
int GetClearance (BOARD_CONNECTED_ITEM *aItem=NULL) const override
 Function GetClearance returns the clearance in internal units. 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...
 
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 ()
 
const ZONE_SEGMENT_FILLFillSegments () 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 (const wxPoint &aRefPos) const
 Function HitTestFilledArea tests if the given wxPoint is within the bounds of a filled area of this zone. More...
 
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 (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, bool aUseNetClearance, 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 () 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 (SHAPE_POLY_SET &aPolysList)
 Function SetFilledPolysList sets the list of filled polygons. More...
 
void SetRawPolysList (SHAPE_POLY_SET &aPolysList)
 Function SetFilledPolysList sets the list of filled polygons. More...
 
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 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 (const ZONE_SEGMENT_FILL &aSegments)
 
SHAPE_POLY_SETRawPolysList ()
 
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
 
void SetIsKeepout (bool aEnable)
 
void SetDoNotAllowCopperPour (bool aEnable)
 
void SetDoNotAllowVias (bool aEnable)
 
void SetDoNotAllowTracks (bool aEnable)
 
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 ()
 
void BuildHashValue ()
 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...
 
std::shared_ptr< NETCLASSGetNetClass () const
 Function GetNetClass returns the NETCLASS for this item. 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...
 
void SetParent (EDA_ITEM *aParent)
 
bool IsNew () const
 
bool IsModified () const
 
bool IsMoving () const
 
bool IsDragging () const
 
bool IsWireImage () const
 
bool IsSelected () const
 
bool IsResized () const
 
bool IsHighlighted () const
 
bool IsBrightened () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetHighlighted ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearHighlighted ()
 
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...
 
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 int getNextNumberInSequence (const std::set< int > &aSeq, bool aFillSequenceGaps)
 

Protected Attributes

SHAPE_POLY_SETm_Poly
 Outline of the zone. More...
 
int m_cornerSmoothingType
 
unsigned int m_cornerRadius
 
LSET m_layerSet
 
unsigned m_priority
 
bool m_isKeepout
 
bool m_doNotAllowCopperPour
 
bool m_doNotAllowVias
 
bool m_doNotAllowTracks
 
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...
 
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...
 
ZONE_SEGMENT_FILL m_FillSegmList
 Segments used to fill the zone (m_FillMode ==1 ), when fill zone by segment is used. More...
 
SHAPE_POLY_SET m_FilledPolysList
 
SHAPE_POLY_SET m_RawPolysList
 
MD5_HASH m_filledPolysHash
 
ZONE_HATCH_STYLE m_hatchStyle
 
int m_hatchPitch
 
std::vector< SEGm_HatchLines
 
std::vector< int > m_insulatedIslands
 
bool m_hv45
 
double m_area
 
NETINFO_ITEMm_netinfo
 Stores all informations about the net that item belongs to. More...
 
PCB_LAYER_ID m_Layer
 
EDA_ITEMm_Parent
 Linked list: Link (parent struct) More...
 
bool m_forceVisible
 Set to true to override the visibility setting of the item. More...
 
STATUS_FLAGS m_Flags
 Flag bits for editing and other uses. More...
 

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

51  m_area( 0.0 )
52 {
53  m_CornerSelection = nullptr; // no corner is selected
54  m_IsFilled = false; // fill status : true when the zone is filled
58  m_hv45 = false;
62  m_HatchFillTypeSmoothingLevel = 0; // Grid pattern smoothing type. 0 = no smoothing
63  m_HatchFillTypeSmoothingValue = 0.1; // Grid pattern chamfer value relative to the gap value
64  // used only if m_HatchFillTypeSmoothingLevel > 0
65  m_priority = 0;
67  SetIsKeepout( aInModule ? true : false ); // Zones living in modules have the keepout option.
68  SetDoNotAllowCopperPour( false ); // has meaning only if m_isKeepout == true
69  SetDoNotAllowVias( true ); // has meaning only if m_isKeepout == true
70  SetDoNotAllowTracks( true ); // has meaning only if m_isKeepout == true
71  m_cornerRadius = 0;
72  SetLocalFlags( 0 ); // flags tempoarry used in zone calculations
73  m_Poly = new SHAPE_POLY_SET(); // Outlines
74  m_FilledPolysUseThickness = true; // set the "old" way to build filled polygon areas (before 6.0.x)
75  aParent->GetZoneSettings().ExportSetting( *this );
76 
77  m_needRefill = false; // True only after some edition.
78 }
void SetDoNotAllowTracks(bool aEnable)
Definition: class_zone.h:657
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:806
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:656
int m_HatchFillTypeSmoothingLevel
Grid pattern smoothing type, similar to corner smoothing type 0 = no smoothing, 1 = fillet,...
Definition: class_zone.h:799
SHAPE_POLY_SET.
double m_HatchFillTypeOrientation
Grid style shape: orientation in degrees of the grid lines.
Definition: class_zone.h:795
bool m_IsFilled
True when a zone was filled, false after deleting the filled areas.
Definition: class_zone.h:767
ZONE_HATCH_STYLE m_hatchStyle
Definition: class_zone.h:829
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:737
unsigned m_priority
Definition: class_zone.h:747
int m_cornerSmoothingType
Definition: class_zone.h:738
double m_HatchFillTypeSmoothingValue
Grid pattern smoothing value for smoothing shape size calculations this is the ratio between the gap ...
Definition: class_zone.h:803
unsigned int m_cornerRadius
Definition: class_zone.h:739
void SetDoNotAllowCopperPour(bool aEnable)
Definition: class_zone.h:655
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:786
int m_HatchFillTypeThickness
Grid style shape: thickness of lines (if 0 -> solid shape)
Definition: class_zone.h:789
void SetLocalFlags(int aFlags)
Definition: class_zone.h:260
bool m_needRefill
False when a zone was refilled, true after changes in zone params.
Definition: class_zone.h:773
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:792
void SetIsKeepout(bool aEnable)
Definition: class_zone.h:654
bool m_FilledPolysUseThickness
outline of filled polygons have thickness.
Definition: class_zone.h:764

References 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_needRefill, m_Poly, m_priority, POLYGONS, SetDoNotAllowCopperPour(), 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 81 of file class_zone.cpp.

83 {
85 }
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:806
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:737

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

903 {
904  if( aPolygon.empty() )
905  return;
906 
907  SHAPE_LINE_CHAIN outline;
908 
909  // Create an outline and populate it with the points of aPolygon
910  for( unsigned i = 0; i < aPolygon.size(); i++ )
911  {
912  outline.Append( VECTOR2I( aPolygon[i] ) );
913  }
914 
915  outline.SetClosed( true );
916 
917  // Add the outline as a new polygon in the polygon set
918  if( m_Poly->OutlineCount() == 0 )
919  m_Poly->AddOutline( outline );
920  else
921  m_Poly->AddHole( outline );
922 
923  SetNeedRefill( true );
924 }
int OutlineCount() const
Returns the number of outlines in the set
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
void SetClosed(bool aClosed)
Function SetClosed()
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:737
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
SHAPE_LINE_CHAIN.
void SetNeedRefill(bool aNeedRefill)
Definition: class_zone.h:192

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

Referenced by EAGLE_PLUGIN::loadPolygon().

◆ AddPolygon() [2/2]

void ZONE_CONTAINER::AddPolygon ( const SHAPE_LINE_CHAIN aPolygon)

Definition at line 888 of file class_zone.cpp.

889 {
890  wxASSERT( aPolygon.IsClosed() );
891 
892  // Add the outline as a new polygon in the polygon set
893  if( m_Poly->OutlineCount() == 0 )
894  m_Poly->AddOutline( aPolygon );
895  else
896  m_Poly->AddHole( aPolygon );
897 
898  SetNeedRefill( true );
899 }
int OutlineCount() const
Returns the number of outlines in the set
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:737
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:192

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

928 {
929  // Ensure the main outline exists:
930  if( m_Poly->OutlineCount() == 0 )
931  m_Poly->NewOutline();
932 
933  // If aHoleIdx >= 0, the corner musty be added to the hole, index aHoleIdx.
934  // (remember: the index of the first hole is 0)
935  // Return error if if does dot exist.
936  if( aHoleIdx >= m_Poly->HoleCount( 0 ) )
937  return false;
938 
939  m_Poly->Append( aPosition.x, aPosition.y, -1, aHoleIdx, aAllowDuplication );
940 
941  SetNeedRefill( true );
942 
943  return true;
944 }
int OutlineCount() const
Returns the number of outlines in the set
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:737
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:192

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(), and EAGLE_PLUGIN::loadPlain().

◆ BuildHashValue()

void ZONE_CONTAINER::BuildHashValue ( )
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 720 of file class_zone.h.

MD5_HASH GetHash() const
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:824
MD5_HASH m_filledPolysHash
Definition: class_zone.h:826

References SHAPE_POLY_SET::GetHash(), 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 1237 of file class_zone.cpp.

1239 {
1240  if( GetNumCorners() <= 2 ) // malformed zone. polygon calculations do not like it ...
1241  return false;
1242 
1243  // Make a smoothed polygon out of the user-drawn polygon if required
1244  switch( m_cornerSmoothingType )
1245  {
1247  aSmoothedPoly = m_Poly->Chamfer( m_cornerRadius, aPreserveCorners );
1248  break;
1249 
1251  {
1252  auto board = GetBoard();
1253  int maxError = ARC_HIGH_DEF;
1254 
1255  if( board )
1256  maxError = board->GetDesignSettings().m_MaxError;
1257 
1258  aSmoothedPoly = m_Poly->Fillet( m_cornerRadius, maxError, aPreserveCorners );
1259  break;
1260  }
1261  default:
1262  // Acute angles between adjacent edges can create issues in calculations,
1263  // in inflate/deflate outlines transforms, especially when the angle is very small.
1264  // We can avoid issues by creating a very small chamfer which remove acute angles,
1265  // or left it without chamfer and use only CPOLYGONS_LIST::InflateOutline to create
1266  // clearance areas
1267  aSmoothedPoly = m_Poly->Chamfer( Millimeter2iu( 0.0 ), aPreserveCorners );
1268  break;
1269  }
1270 
1271  return true;
1272 };
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:737
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:738
int GetNumCorners(void) const
Access to m_Poly parameters.
Definition: class_zone.h:450
unsigned int m_cornerRadius
Definition: class_zone.h:739
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::TestZoneToZoneOutlines(), 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 1183 of file class_zone.cpp.

1184 {
1186 }
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:824

References SHAPE_POLY_SET::CacheTriangulation(), and m_FilledPolysList.

◆ CalculateFilledArea()

double ZONE_CONTAINER::CalculateFilledArea ( )

Compute the area currently occupied by the zone fill.

Returns
the currently filled area

Definition at line 1275 of file class_zone.cpp.

1276 {
1277  m_area = 0.0;
1278 
1279  // Iterate over each outline polygon in the zone and then iterate over
1280  // each hole it has to compute the total area.
1281  for( int i = 0; i < m_FilledPolysList.OutlineCount(); i++ )
1282  {
1284 
1285  for( int j = 0; m_FilledPolysList.HoleCount( i ); j++ )
1286  {
1287  m_area -= m_FilledPolysList.Hole( i, j ).Area();
1288  }
1289  }
1290 
1291  return m_area;
1292 }
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_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
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:824
double Area() const

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

481  {
482  return m_Poly->CIterateWithHoles();
483  }
CONST_ITERATOR CIterateWithHoles(int aOutline) const
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:737

References SHAPE_POLY_SET::CIterateWithHoles(), and m_Poly.

◆ ClassOf()

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

Definition at line 79 of file class_zone.h.

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

References PCB_ZONE_AREA_T, and EDA_ITEM::Type().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 237 of file base_struct.h.

237 { ClearFlags( BRIGHTENED ); }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:143
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:258

References BRIGHTENED, and EDA_ITEM::ClearFlags().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PCB_BASE_FRAME::FocusOnItem(), SCH_BASE_FRAME::FocusOnItem(), EE_SELECTION_TOOL::unhighlight(), SELECTION_TOOL::unhighlight(), and SCH_EDITOR_CONTROL::UpdateNetHighlighting().

◆ ClearEditFlags()

void EDA_ITEM::ClearEditFlags ( )
inlineinherited

◆ ClearFilledPolysList()

void ZONE_CONTAINER::ClearFilledPolysList ( )
inline

Function ClearFilledPolysList clears the list of filled polygons.

Definition at line 561 of file class_zone.h.

562  {
564  }
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:824
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.

References m_FilledPolysList, and SHAPE_POLY_SET::RemoveAllContours().

Referenced by POINT_EDITOR::updateItem().

◆ ClearFlags()

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

Definition at line 258 of file base_struct.h.

258 { m_Flags &= ~aMask; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189

References EDA_ITEM::m_Flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_COMPONENT::ClearAllHighlightFlags(), SCH_SCREEN::ClearAnnotation(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), EDA_ITEM::ClearHighlighted(), clearModuleItemFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), SCH_EDIT_FRAME::ConvertPart(), LIB_EDIT_TOOL::Copy(), MWAVE::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(), KIGFX::SCH_VIEW::HighlightItem(), MODULE_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().

◆ ClearHighlighted()

void EDA_ITEM::ClearHighlighted ( )
inlineinherited

Definition at line 236 of file base_struct.h.

236 { ClearFlags( HIGHLIGHTED ); }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:142
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:258

References EDA_ITEM::ClearFlags(), and HIGHLIGHTED.

◆ ClearSelected()

void EDA_ITEM::ClearSelected ( )
inlineinherited

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 270 of file base_struct.h.

271  {
273  }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:117
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: base_struct.h:131
#define CANDIDATE
flag indicating that the structure is connected
Definition: base_struct.h:130
#define ENDPOINT
ends. (Used to support dragging.)
Definition: base_struct.h:126
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:258
#define DO_NOT_DRAW
Used to disable draw function.
Definition: base_struct.h:132
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: base_struct.h:125

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

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

190 {
191  return new ZONE_CONTAINER( *this );
192 }
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:49

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

233 {
234  LSET common = GetLayerSet() & aLayerSet;
235 
236  return common.count() > 0;
237 }
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:277
LSET is a set of PCB_LAYER_IDs.

References GetLayerSet().

Referenced by ZONE_FILLER::buildCopperItemClearances().

◆ DeleteStructure()

void BOARD_ITEM::DeleteStructure ( )
inherited

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

Definition at line 117 of file class_board_item.cpp.

118 {
119  auto parent = GetParent();
120 
121  if( parent )
122  parent->Remove( this );
123 
124  delete this;
125 }
BOARD_ITEM_CONTAINER * GetParent() const

References BOARD_ITEM::GetParent().

Referenced by BOARD::PadDelete(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow(), 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 165 of file class_board_item.h.

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

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(), BOARD::InsertArea(), ARRAY_CREATOR::Invoke(), and FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD().

◆ FillSegments() [1/2]

ZONE_SEGMENT_FILL& ZONE_CONTAINER::FillSegments ( )
inline

Definition at line 262 of file class_zone.h.

262 { return m_FillSegmList; }
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:814

References m_FillSegmList.

Referenced by PCB_IO::format().

◆ FillSegments() [2/2]

const ZONE_SEGMENT_FILL& ZONE_CONTAINER::FillSegments ( ) const
inline

Definition at line 263 of file class_zone.h.

263 { return m_FillSegmList; }
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:814

References m_FillSegmList.

◆ Flip() [1/2]

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

Definition at line 281 of file class_board_item.h.

282  {
283  Flip( wxPoint( aCentre.x, aCentre.y ), aFlipLeftRight );
284  }
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 838 of file class_zone.cpp.

839 {
840  Mirror( aCentre, aFlipLeftRight );
841  int copperLayerCount = GetBoard()->GetCopperLayerCount();
842 
843  if( GetIsKeepout() )
844  {
845  SetLayerSet( FlipLayerMask( GetLayerSet(), copperLayerCount ) );
846  }
847  else
848  {
849  SetLayer( FlipLayer( GetLayer(), copperLayerCount ) );
850  }
851 }
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:854
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:213
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:277
void SetLayerSet(LSET aLayerSet)
Definition: class_zone.cpp:248
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:240
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:649
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:163
BOARD_ITEM_CONTAINER * GetParent() const
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212

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

Referenced by BuildSmoothedPoly(), DRC::checkClearancePadToPad(), DRC::checkClearanceSegmToPad(), TEXTE_PCB::Flip(), TRACK::Flip(), ARC::Flip(), VIA::Flip(), Flip(), BOARD_ITEM::GetBoard(), MODULE::GetBoundingPoly(), BOARD_CONNECTED_ITEM::GetClearance(), BOARD_ITEM::GetLayerName(), PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), TRACK::GetMsgPanelInfo(), NETINFO_ITEM::GetMsgPanelInfo(), D_PAD::GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase(), VIA::GetMsgPanelInfoBase(), TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), VIA::GetSelectMenuText(), D_PAD::GetSelectMenuText(), D_PAD::GetSolderMaskMargin(), D_PAD::GetSolderPasteMargin(), BOARD::GetTrackLength(), D_PAD::HitTest(), D_PAD::MergePrimitivesAsPolygon(), EAGLE_PLUGIN::packageWire(), TEXTE_PCB::Print(), PCB_TARGET::Print(), Print(), EDGE_MODULE::Print(), TRACK::Print(), TEXTE_MODULE::Print(), DIMENSION::Print(), DRAWSEGMENT::Print(), VIA::Print(), MODULE::Print(), D_PAD::Print(), PrintFilledArea(), BOARD_CONNECTED_ITEM::SetNet(), BOARD_CONNECTED_ITEM::SetNetCode(), TransformOutlinesShapeWithClearanceToPolygon(), TransformSolidAreasShapesToPolygonSet(), MODULE::ViewBBox(), VIA::ViewGetLOD(), 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 506 of file class_zone.cpp.

507 {
508  const int PRELOAD = 0x7FFFFFFF; // Biggest integer (32 bits)
509 
510  int ymax = -PRELOAD;
511  int ymin = PRELOAD;
512  int xmin = PRELOAD;
513  int xmax = -PRELOAD;
514 
515  int count = GetNumCorners();
516 
517  for( int i = 0; i<count; ++i )
518  {
519  wxPoint corner = static_cast<wxPoint>( GetCornerPosition( i ) );
520 
521  ymax = std::max( ymax, corner.y );
522  xmax = std::max( xmax, corner.x );
523  ymin = std::min( ymin, corner.y );
524  xmin = std::min( xmin, corner.x );
525  }
526 
527  EDA_RECT ret( wxPoint( xmin, ymin ), wxSize( xmax - xmin + 1, ymax - ymin + 1 ) );
528 
529  return ret;
530 }
int GetNumCorners(void) const
Access to m_Poly parameters.
Definition: class_zone.h:450
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
const VECTOR2I & GetCornerPosition(int aCornerIndex) const
Definition: class_zone.h:490

References GetCornerPosition(), GetNumCorners(), wxPoint::x, and wxPoint::y.

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

◆ 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 98 of file class_board_item.h.

98 { return GetPosition(); }
virtual const wxPoint GetPosition() const =0

References BOARD_ITEM::GetPosition().

Referenced by ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), KIGFX::PCB_PAINTER::draw(), and PNS_KICAD_IFACE_BASE::syncArc().

◆ GetClass()

wxString ZONE_CONTAINER::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Implements EDA_ITEM.

Definition at line 443 of file class_zone.h.

444  {
445  return wxT( "ZONE_CONTAINER" );
446  }

◆ GetClearance()

int ZONE_CONTAINER::GetClearance ( BOARD_CONNECTED_ITEM aItem = NULL) const
overridevirtual

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 another BOARD_CONNECTED_ITEM or NULL
Returns
int - the clearance in internal units.

Reimplemented from BOARD_CONNECTED_ITEM.

Definition at line 659 of file class_zone.cpp.

660 {
661  int myClearance = m_ZoneClearance;
662 
663  // The actual zone clearance is the biggest of the zone netclass clearance
664  // and the zone clearance setting in the zone properties dialog.
665  if( !m_isKeepout ) // Net class has no meaning for a keepout area.
666  {
667  NETCLASSPTR myClass = GetNetClass();
668 
669  if( myClass )
670  myClearance = std::max( myClearance, myClass->GetClearance() );
671  }
672 
673  // Get the final clearance between me and aItem
674  if( aItem )
675  {
676  int hisClearance = aItem->GetClearance( NULL );
677  myClearance = std::max( hisClearance, myClearance );
678  }
679 
680  return myClearance;
681 }
int m_ZoneClearance
Clearance value in internal units.
Definition: class_zone.h:762
#define NULL
virtual int GetClearance(BOARD_CONNECTED_ITEM *aItem=NULL) const
Function GetClearance returns the clearance in internal units.
std::shared_ptr< NETCLASS > GetNetClass() const
Function GetNetClass returns the NETCLASS for this item.

References BOARD_CONNECTED_ITEM::GetClearance(), BOARD_CONNECTED_ITEM::GetNetClass(), m_isKeepout, m_ZoneClearance, and NULL.

Referenced by GERBER_JOBFILE_WRITER::addJSONDesignRules(), ZONE_FILLER::buildCopperItemClearances(), BOARD::TestAreaIntersections(), DRC::TestZoneToZoneOutlines(), and TransformOutlinesShapeWithClearanceToPolygon().

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

1195 {
1196  int epsilon = Millimeter2iu( 0.001 );
1197 
1198  // Things get messy when zone of different nets intersect. To do it right we'd need to
1199  // run our colinear test with the final filled regions rather than the outline regions.
1200  // However, since there's no order dependance the only way to do that is to iterate
1201  // through successive zone fills until the results are no longer changing -- and that's
1202  // not going to happen. So we punt and ignore any "messy" corners.
1203  std::set<VECTOR2I> colinearCorners;
1204  std::set<VECTOR2I> messyCorners;
1205 
1206  for( ZONE_CONTAINER* candidate : aBoard->Zones() )
1207  {
1208  if( candidate == this )
1209  continue;
1210 
1211  if( candidate->GetLayerSet() != GetLayerSet() )
1212  continue;
1213 
1214  if( candidate->GetIsKeepout() != GetIsKeepout() )
1215  continue;
1216 
1217  for( auto iter = m_Poly->CIterate(); iter; iter++ )
1218  {
1219  if( candidate->m_Poly->Collide( iter.Get(), epsilon ) )
1220  {
1221  if( candidate->GetNetCode() == GetNetCode() )
1222  colinearCorners.insert( VECTOR2I( iter.Get() ) );
1223  else
1224  messyCorners.insert( VECTOR2I( iter.Get() ) );
1225  }
1226  }
1227  }
1228 
1229  for( VECTOR2I corner : colinearCorners )
1230  {
1231  if( messyCorners.count( corner ) == 0 )
1232  aCorners.insert( corner );
1233  }
1234 }
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
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:277
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:737
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:649
ZONE_CONTAINERS & Zones()
Definition: class_board.h:243

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

◆ GetCornerPosition()

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

Definition at line 490 of file class_zone.h.

491  {
493 
494  // Convert global to relative indices
495  if( !m_Poly->GetRelativeIndices( aCornerIndex, &index ) )
496  throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
497 
498  return m_Poly->CVertex( index );
499  }
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:737
bool GetRelativeIndices(int aGlobalIdx, VERTEX_INDEX *aRelativeIndices) const
Function GetRelativeIndices.

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

Referenced by GetBoundingBox(), and GetPosition().

◆ GetCornerRadius()

unsigned int ZONE_CONTAINER::GetCornerRadius ( ) const
inline

◆ GetCornerSmoothingType()

int ZONE_CONTAINER::GetCornerSmoothingType ( ) const
inline

Definition at line 611 of file class_zone.h.

611 { return m_cornerSmoothingType; }
int m_cornerSmoothingType
Definition: class_zone.h:738

References m_cornerSmoothingType.

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

◆ GetDefaultHatchPitch()

int ZONE_CONTAINER::GetDefaultHatchPitch ( )
static

Function GetDefaultHatchPitchMils.

Returns
int - the default hatch pitch in internal units.

Definition at line 1163 of file class_zone.cpp.

1164 {
1165  return Mils2iu( 20 );
1166 }

Referenced by PCAD2KICAD::PCB_POLYGON::AddToBoard(), ZONE_SETTINGS::ExportSetting(), EAGLE_PLUGIN::loadPlain(), LEGACY_PLUGIN::loadZONE_CONTAINER(), PCB_PARSER::parseZONE_CONTAINER(), and ZONE_CONTAINER().

◆ GetDoNotAllowCopperPour()

bool ZONE_CONTAINER::GetDoNotAllowCopperPour ( ) 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 262 of file base_struct.h.

263  {
267  return m_Flags & mask;
268  }
#define TEMP_SELECTED
flag indicating that the structure has already selected
Definition: base_struct.h:128
#define END_ONPAD
Pcbnew: flag set for track segment ending on a pad.
Definition: base_struct.h:139
#define BEGIN_ONPAD
Pcbnew: flag set for track segment starting on a pad.
Definition: base_struct.h:138
#define EDA_ITEM_ALL_FLAGS
Definition: base_struct.h:157
#define SELECTED
Definition: base_struct.h:127
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:143
#define DP_COUPLED
item is coupled with another item making a differential pair
Definition: base_struct.h:145
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:142
#define IS_DANGLING
indicates a pin is dangling
Definition: base_struct.h:149
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
#define ENDPOINT
ends. (Used to support dragging.)
Definition: base_struct.h:126
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: base_struct.h:125

References BEGIN_ONPAD, BRIGHTENED, DP_COUPLED, EDA_ITEM_ALL_FLAGS, END_ONPAD, ENDPOINT, HIGHLIGHTED, IS_DANGLING, EDA_ITEM::m_Flags, SELECTED, STARTPOINT, and TEMP_SELECTED.

Referenced by SCH_EDIT_TOOL::ChangeShape(), EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::ConvertTextType(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_TOOL::editFieldText(), SCH_EDITOR_CONTROL::EditWithLibEdit(), LIB_MOVE_TOOL::Main(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), 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().

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

184  {
185  return m_area;
186  }

References m_area.

◆ GetFilledPolysList()

const SHAPE_POLY_SET& ZONE_CONTAINER::GetFilledPolysList ( ) const
inline

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

Returns
Reference to the list of filled polygons.

Definition at line 571 of file class_zone.h.

572  {
573  return m_FilledPolysList;
574  }
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:824

References m_FilledPolysList.

Referenced by CN_LIST::Add(), CINFO3D_VISU::AddSolidAreasShapesToContainer(), CN_ZONE::CN_ZONE(), KIGFX::PCB_PAINTER::draw(), export_vrml_zones(), CN_CONNECTIVITY_ALGO::FindIsolatedCopperIslands(), PCB_IO::format(), DRC::getLocation(), and TransformSolidAreasShapesToPolygonSet().

◆ GetFilledPolysUseThickness()

bool ZONE_CONTAINER::GetFilledPolysUseThickness ( ) const
inline

◆ GetFillMode()

ZONE_FILL_MODE ZONE_CONTAINER::GetFillMode ( ) const
inline

Definition at line 156 of file class_zone.h.

156 { 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:786

References m_FillMode.

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

◆ GetFlags()

◆ GetHashValue()

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

Definition at line 714 of file class_zone.h.

714 { return m_filledPolysHash; }
MD5_HASH m_filledPolysHash
Definition: class_zone.h:826

References m_filledPolysHash.

◆ GetHatchFillTypeGap()

int ZONE_CONTAINER::GetHatchFillTypeGap ( ) const
inline

Definition at line 216 of file class_zone.h.

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

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

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

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 222 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:799

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 225 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:803

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

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

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

706 { return m_HatchLines; }
std::vector< SEG > m_HatchLines
Definition: class_zone.h:831

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

965 {
966  return m_hatchPitch;
967 }

References m_hatchPitch.

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

◆ GetHatchStyle()

ZONE_HATCH_STYLE ZONE_CONTAINER::GetHatchStyle ( ) const
inline

Definition at line 538 of file class_zone.h.

539  {
540  return m_hatchStyle;
541  }
ZONE_HATCH_STYLE m_hatchStyle
Definition: class_zone.h:829

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

708 { return m_hv45; }

References m_hv45.

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

◆ GetIsKeepout()

◆ GetLayer()

◆ 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 given by aLayer.
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:163
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:622

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

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

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

278 {
279  // TODO - Enable multi-layer zones for all zone types
280  // not just keepout zones
281  if( GetIsKeepout() )
282  {
283  return m_layerSet;
284  }
285  else
286  {
287  return LSET( m_Layer );
288  }
289 }
PCB_LAYER_ID m_Layer
LSET is a set of PCB_LAYER_IDs.
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:649

References GetIsKeepout(), BOARD_ITEM::m_Layer, and m_layerSet.

Referenced by CommonLayerExists(), Flip(), PCB_IO::format(), GetColinearCorners(), initDataFromSrcInCopyCtor(), ZONE_SETTINGS::operator<<(), operator=(), Print(), PNS_KICAD_IFACE_BASE::syncZone(), and BOARD::TestAreaIntersections().

◆ GetLocalFlags()

int ZONE_CONTAINER::GetLocalFlags ( ) const
inline

Definition at line 259 of file class_zone.h.

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

References m_localFlgs.

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

◆ GetLocalRatsnestVisible()

bool BOARD_CONNECTED_ITEM::GetLocalRatsnestVisible ( ) const
inlineinherited

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

1170 {
1171  return add_zone_xpm;
1172 }
const BITMAP_OPAQUE add_zone_xpm[1]
Definition: add_zone.cpp:74

References add_zone_xpm.

◆ GetMinThickness()

◆ GetMsgPanelInfo()

void ZONE_CONTAINER::GetMsgPanelInfo ( EDA_UNITS  aUnits,
std::vector< MSG_PANEL_ITEM > &  aList 
)
overridevirtual

Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.

Note
This method replaces DisplayInfo() so that KiCad objects no longer have any knowledge of wxWidgets UI objects.
Parameters
aListis the list to populate.

Reimplemented from EDA_ITEM.

Definition at line 690 of file class_zone.cpp.

691 {
692  wxString msg;
693 
694  msg = _( "Zone Outline" );
695 
696  // Display Cutout instead of Outline for holes inside a zone
697  // i.e. when num contour !=0
698  // Check whether the selected corner is in a hole; i.e., in any contour but the first one.
699  if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
700  msg << wxT( " " ) << _( "(Cutout)" );
701 
702  aList.emplace_back( MSG_PANEL_ITEM( _( "Type" ), msg, DARKCYAN ) );
703 
704  if( GetIsKeepout() )
705  {
706  msg.Empty();
707 
708  if( GetDoNotAllowVias() )
709  AccumulateDescription( msg, _( "No via" ) );
710 
711  if( GetDoNotAllowTracks() )
712  AccumulateDescription( msg, _("No track") );
713 
715  AccumulateDescription( msg, _("No copper pour") );
716 
717  aList.emplace_back( MSG_PANEL_ITEM( _( "Keepout" ), msg, RED ) );
718  }
719  else if( IsOnCopperLayer() )
720  {
721  if( GetNetCode() >= 0 )
722  {
723  NETINFO_ITEM* net = GetNet();
724 
725  if( net )
726  msg = UnescapeString( net->GetNetname() );
727  else // Should not occur
728  msg = _( "<unknown>" );
729  }
730  else // a netcode < 0 is an error
731  msg = wxT( "<error>" );
732 
733  aList.emplace_back( MSG_PANEL_ITEM( _( "NetName" ), msg, RED ) );
734 
735  // Display net code : (useful in test or debug)
736  msg.Printf( wxT( "%d" ), GetNetCode() );
737  aList.emplace_back( MSG_PANEL_ITEM( _( "NetCode" ), msg, RED ) );
738 
739  // Display priority level
740  msg.Printf( wxT( "%d" ), GetPriority() );
741  aList.emplace_back( MSG_PANEL_ITEM( _( "Priority" ), msg, BLUE ) );
742  }
743  else
744  {
745  aList.emplace_back( MSG_PANEL_ITEM( _( "Non Copper Zone" ), wxEmptyString, RED ) );
746  }
747 
748  aList.emplace_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), BROWN ) );
749 
750  msg.Printf( wxT( "%d" ), (int) m_Poly->TotalVertices() );
751  aList.emplace_back( MSG_PANEL_ITEM( _( "Vertices" ), msg, BLUE ) );
752 
753  switch( m_FillMode )
754  {
756  msg = _( "Solid" ); break;
758  msg = _( "Hatched" ); break;
759  default:
760  msg = _( "Unknown" ); break;
761  }
762 
763  aList.emplace_back( MSG_PANEL_ITEM( _( "Fill Mode" ), msg, BROWN ) );
764 
765  msg = MessageTextFromValue( aUnits, m_area, false, EDA_DATA_TYPE::AREA );
766  aList.emplace_back( MSG_PANEL_ITEM( _( "Filled Area" ), msg, BLUE ) );
767 
768  // Useful for statistics :
769  msg.Printf( wxT( "%d" ), (int) m_HatchLines.size() );
770  aList.emplace_back( MSG_PANEL_ITEM( _( "Hatch Lines" ), msg, BLUE ) );
771 
772  if( !m_FilledPolysList.IsEmpty() )
773  {
774  msg.Printf( wxT( "%d" ), m_FilledPolysList.TotalVertices() );
775  aList.emplace_back( MSG_PANEL_ITEM( _( "Corner Count" ), msg, BLUE ) );
776  }
777 }
Definition: colors.h:57
int TotalVertices() const
Returns total number of vertices stored in the set.
int GetNetCode() const
Function GetNetCode.
NETINFO_ITEM * GetNet() const
Function GetNet Returns NET_INFO object for a given item.
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:806
bool IsEmpty() const
Returns true if the set is empty (no polygons at all)
bool GetDoNotAllowVias() const
Definition: class_zone.h:651
std::vector< SEG > m_HatchLines
Definition: class_zone.h:831
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:737
bool GetDoNotAllowCopperPour() const
Definition: class_zone.h:650
const wxString & GetNetname() const
Function GetNetname.
Definition: netinfo.h:232
Definition: colors.h:60
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:824
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:649
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aUseMils, EDA_DATA_TYPE aType)
Definition: base_units.cpp:127
void AccumulateDescription(wxString &aDesc, const wxString &aItem)
Utility to build comma separated lists in messages.
Definition: macros.h:74
NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
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:786
unsigned GetPriority() const
Function GetPriority.
Definition: class_zone.h:100
#define _(s)
Definition: 3d_actions.cpp:33
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:131
bool GetDoNotAllowTracks() const
Definition: class_zone.h:652
EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
wxString GetLayerName() const
Function GetLayerName returns the name of the PCB layer on which the item resides.
bool IsOnCopperLayer() const override
Function IsOnCopperLayer.
Definition: class_zone.cpp:219
Definition: colors.h:62

References _, AccumulateDescription(), AREA, BLUE, BROWN, DARKCYAN, GetDoNotAllowCopperPour(), GetDoNotAllowTracks(), GetDoNotAllowVias(), GetIsKeepout(), BOARD_ITEM::GetLayerName(), BOARD_CONNECTED_ITEM::GetNet(), BOARD_CONNECTED_ITEM::GetNetCode(), NETINFO_ITEM::GetNetname(), GetPriority(), HATCH_PATTERN, SHAPE_POLY_SET::IsEmpty(), IsOnCopperLayer(), m_area, SHAPE_POLY_SET::VERTEX_INDEX::m_contour, m_CornerSelection, m_FilledPolysList, m_FillMode, m_HatchLines, m_Poly, MessageTextFromValue(), POLYGONS, RED, SHAPE_POLY_SET::TotalVertices(), 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(), VIA::GetMsgPanelInfoBase(), TRACK::GetMsgPanelInfoBase_Common(), VIA::Print(), BOARD::SetAreasNetCodesFromNetNames(), and PCB_EDIT_FRAME::SetTrackSegmentWidth().

◆ GetNetClass()

NETCLASSPTR BOARD_CONNECTED_ITEM::GetNetClass ( ) const
inherited

Function GetNetClass returns the NETCLASS for this item.

Definition at line 96 of file board_connected_item.cpp.

97 {
98  NETCLASSPTR netclass = m_netinfo->GetNetClass();
99 
100  if( netclass )
101  return netclass;
102  else
103  return GetBoard()->GetDesignSettings().GetDefault();
104 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:512
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
NETCLASSPTR GetDefault() const
Function GetDefault.
NETCLASSPTR GetNetClass()
Definition: netinfo.h:122
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.

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

Referenced by DRC::doTrackDrc(), GetClearance(), VIA::GetDrillValue(), TRACK::GetMsgPanelInfo(), 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 107 of file board_connected_item.cpp.

108 {
109  return m_netinfo->GetClassName();
110 }
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:131

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

Referenced by 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:224
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(), IsSame(), DSN::SPECCTRA_DB::makeIMAGE(), AR_AUTOPLACER::nearestPad(), CONNECTIVITY_DATA::NearestUnconnectedTargets(), ROUTER_TOOL::NeighboringSegmentFilter(), CN_ITEM::Net(), BOARD::NormalizeAreaPolygon(), BOARD::OnAreaPolygonModified(), ZONE_SETTINGS::operator<<(), DIALOG_PAD_PROPERTIES::PadTypeSelected(), VIA::Print(), D_PAD::PrintShape(), 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(), DRC::TestZoneToZoneOutlines(), 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:232
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().

◆ getNextNumberInSequence()

int BOARD_ITEM::getNextNumberInSequence ( const std::set< int > &  aSeq,
bool  aFillSequenceGaps 
)
staticprotectedinherited

Definition at line 88 of file class_board_item.cpp.

89 {
90  if( aSeq.empty() )
91  return 1;
92 
93  // By default go to the end of the sequence
94  int candidate = *aSeq.rbegin();
95 
96  // Filling in gaps in pad numbering
97  if( aFillSequenceGaps )
98  {
99  // start at the beginning
100  candidate = *aSeq.begin();
101 
102  for( auto it : aSeq )
103  {
104  if( it - candidate > 1 )
105  break;
106 
107  candidate = it;
108  }
109  }
110 
111  ++candidate;
112 
113  return candidate;
114 }

Referenced by MODULE::GetNextPadName().

◆ GetNumCorners()

int ZONE_CONTAINER::GetNumCorners ( void  ) const
inline

Access to m_Poly parameters.

Definition at line 450 of file class_zone.h.

451  {
452  return m_Poly->TotalVertices();
453  }
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:737

References m_Poly, and SHAPE_POLY_SET::TotalVertices().

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

◆ GetPadConnection()

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

Definition at line 879 of file class_zone.cpp.

880 {
881  if( aPad == NULL || aPad->GetZoneConnection() == ZONE_CONNECTION::INHERITED )
882  return m_PadConnection;
883  else
884  return aPad->GetZoneConnection();
885 }
ZONE_CONNECTION m_PadConnection
Definition: class_zone.h:761
#define NULL
ZONE_CONNECTION GetZoneConnection() const
Definition: class_pad.cpp:725

References D_PAD::GetZoneConnection(), 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 125 of file class_board_item.h.

125 { return (BOARD_ITEM_CONTAINER*) m_Parent; }
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:183
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_MODULE::GetShownText(), SELECTION_TOOL::GuessSelectionCandidates(), GENERAL_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), EDGE_MODULE::IsParentFlipped(), TEXTE_MODULE::IsParentFlipped(), LEGACY_PLUGIN::loadMODULE_TEXT(), BRDITEMS_PLOTTER::Plot_1_EdgeModule(), BRDITEMS_PLOTTER::PlotTextModule(), 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

Implements BOARD_ITEM.

Definition at line 207 of file class_zone.cpp.

208 {
209  return (wxPoint) GetCornerPosition( 0 );
210 }
const VECTOR2I & GetCornerPosition(int aCornerIndex) const
Definition: class_zone.h:490

References GetCornerPosition().

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

◆ GetPriority()

unsigned ZONE_CONTAINER::GetPriority ( ) const
inline

◆ GetSelectedCorner()

int ZONE_CONTAINER::GetSelectedCorner ( ) const
inline

Definition at line 228 of file class_zone.h.

229  {
230  // Transform relative indices to global index
231  int globalIndex = -1;
232 
233  if( m_CornerSelection )
234  m_Poly->GetGlobalIndex( *m_CornerSelection, globalIndex );
235 
236  return globalIndex;
237  }
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:806
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:737
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 947 of file class_zone.cpp.

948 {
949  wxString text;
950 
951  // Check whether the selected contour is a hole (contour index > 0)
952  if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
953  text << wxT( " " ) << _( "(Cutout)" );
954 
955  if( GetIsKeepout() )
956  text << wxT( " " ) << _( "(Keepout)" );
957  else
958  text << GetNetnameMsg();
959 
960  return wxString::Format( _( "Zone Outline %s on %s" ), text, GetLayerName() );
961 }
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:806
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:649
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
wxString GetLayerName() const
Function GetLayerName returns the name of the PCB layer on which the item resides.

References _, Format(), GetIsKeepout(), BOARD_ITEM::GetLayerName(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), SHAPE_POLY_SET::VERTEX_INDEX::m_contour, and m_CornerSelection.

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:238
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(), and D_PAD::PrintShape().

◆ GetState()

int EDA_ITEM::GetState ( int  type) const
inlineinherited

Definition at line 241 of file base_struct.h.

242  {
243  return m_Status & type;
244  }
STATUS_FLAGS m_Status
Definition: base_struct.h:179

References EDA_ITEM::m_Status.

Referenced by SELECTION_TOOL::expandConnection(), TRACK::GetMsgPanelInfoBase_Common(), TRACK::IsLocked(), TRACK::Print(), and PrintFilledArea().

◆ GetStatus()

STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 254 of file base_struct.h.

254 { return m_Status; }
STATUS_FLAGS m_Status
Definition: base_struct.h:179

References EDA_ITEM::m_Status.

Referenced by PCB_IO::format().

◆ GetThermalReliefCopperBridge()

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

Definition at line 542 of file class_zone.cpp.

543 {
544  if( aPad == NULL || aPad->GetThermalWidth() == 0 )
546  else
547  return aPad->GetThermalWidth();
548 }
int m_ThermalReliefCopperBridge
Definition: class_zone.h:779
#define NULL
int GetThermalWidth() const
Definition: class_pad.cpp:736

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

534 {
535  if( aPad == NULL || aPad->GetThermalGap() == 0 )
536  return m_ThermalReliefGap;
537  else
538  return aPad->GetThermalGap();
539 }
int GetThermalGap() const
Definition: class_pad.cpp:747
#define NULL
int m_ThermalReliefGap
Width of the copper bridge in thermal reliefs.
Definition: class_zone.h:776

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

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

1001 {
1002  UnHatch();
1003 
1005  return;
1006 
1007  // define range for hatch lines
1008  int min_x = m_Poly->CVertex( 0 ).x;
1009  int max_x = m_Poly->CVertex( 0 ).x;
1010  int min_y = m_Poly->CVertex( 0 ).y;
1011  int max_y = m_Poly->CVertex( 0 ).y;
1012 
1013  for( auto iterator = m_Poly->IterateWithHoles(); iterator; iterator++ )
1014  {
1015  if( iterator->x < min_x )
1016  min_x = iterator->x;
1017 
1018  if( iterator->x > max_x )
1019  max_x = iterator->x;
1020 
1021  if( iterator->y < min_y )
1022  min_y = iterator->y;
1023 
1024  if( iterator->y > max_y )
1025  max_y = iterator->y;
1026  }
1027 
1028  // Calculate spacing between 2 hatch lines
1029  int spacing;
1030 
1032  spacing = m_hatchPitch;
1033  else
1034  spacing = m_hatchPitch * 2;
1035 
1036  // set the "length" of hatch lines (the length on horizontal axis)
1037  int hatch_line_len = m_hatchPitch;
1038 
1039  // To have a better look, give a slope depending on the layer
1040  LAYER_NUM layer = GetLayer();
1041  int slope_flag = (layer & 1) ? 1 : -1; // 1 or -1
1042  double slope = 0.707106 * slope_flag; // 45 degrees slope
1043  int max_a, min_a;
1044 
1045  if( slope_flag == 1 )
1046  {
1047  max_a = KiROUND( max_y - slope * min_x );
1048  min_a = KiROUND( min_y - slope * max_x );
1049  }
1050  else
1051  {
1052  max_a = KiROUND( max_y - slope * max_x );
1053  min_a = KiROUND( min_y - slope * min_x );
1054  }
1055 
1056  min_a = (min_a / spacing) * spacing;
1057 
1058  // calculate an offset depending on layer number,
1059  // for a better look of hatches on a multilayer board
1060  int offset = (layer * 7) / 8;
1061  min_a += offset;
1062 
1063  // loop through hatch lines
1064  #define MAXPTS 200 // Usually we store only few values per one hatch line
1065  // depending on the complexity of the zone outline
1066 
1067  static std::vector<VECTOR2I> pointbuffer;
1068  pointbuffer.clear();
1069  pointbuffer.reserve( MAXPTS + 2 );
1070 
1071  for( int a = min_a; a < max_a; a += spacing )
1072  {
1073  // get intersection points for this hatch line
1074 
1075  // Note: because we should have an even number of intersections with the
1076  // current hatch line and the zone outline (a closed polygon,
1077  // or a set of closed polygons), if an odd count is found
1078  // we skip this line (should not occur)
1079  pointbuffer.clear();
1080 
1081  // Iterate through all vertices
1082  for( auto iterator = m_Poly->IterateSegmentsWithHoles(); iterator; iterator++ )
1083  {
1084  double x, y, x2, y2;
1085  int ok;
1086 
1087  SEG segment = *iterator;
1088 
1089  ok = FindLineSegmentIntersection( a, slope,
1090  segment.A.x, segment.A.y,
1091  segment.B.x, segment.B.y,
1092  &x, &y, &x2, &y2 );
1093 
1094  if( ok )
1095  {
1096  VECTOR2I point( KiROUND( x ), KiROUND( y ) );
1097  pointbuffer.push_back( point );
1098  }
1099 
1100  if( ok == 2 )
1101  {
1102  VECTOR2I point( KiROUND( x2 ), KiROUND( y2 ) );
1103  pointbuffer.push_back( point );
1104  }
1105 
1106  if( pointbuffer.size() >= MAXPTS ) // overflow
1107  {
1108  wxASSERT( 0 );
1109  break;
1110  }
1111  }
1112 
1113  // ensure we have found an even intersection points count
1114  // because intersections are the ends of segments
1115  // inside the polygon(s) and a segment has 2 ends.
1116  // if not, this is a strange case (a bug ?) so skip this hatch
1117  if( pointbuffer.size() % 2 != 0 )
1118  continue;
1119 
1120  // sort points in order of descending x (if more than 2) to
1121  // ensure the starting point and the ending point of the same segment
1122  // are stored one just after the other.
1123  if( pointbuffer.size() > 2 )
1124  sort( pointbuffer.begin(), pointbuffer.end(), sortEndsByDescendingX );
1125 
1126  // creates lines or short segments inside the complex polygon
1127  for( unsigned ip = 0; ip < pointbuffer.size(); ip += 2 )
1128  {
1129  int dx = pointbuffer[ip + 1].x - pointbuffer[ip].x;
1130 
1131  // Push only one line for diagonal hatch,
1132  // or for small lines < twice the line length
1133  // else push 2 small lines
1135  || std::abs( dx ) < 2 * hatch_line_len )
1136  {
1137  m_HatchLines.emplace_back( SEG( pointbuffer[ip], pointbuffer[ip + 1] ) );
1138  }
1139  else
1140  {
1141  double dy = pointbuffer[ip + 1].y - pointbuffer[ip].y;
1142  slope = dy / dx;
1143 
1144  if( dx > 0 )
1145  dx = hatch_line_len;
1146  else
1147  dx = -hatch_line_len;
1148 
1149  int x1 = KiROUND( pointbuffer[ip].x + dx );
1150  int x2 = KiROUND( pointbuffer[ip + 1].x - dx );
1151  int y1 = KiROUND( pointbuffer[ip].y + dx * slope );
1152  int y2 = KiROUND( pointbuffer[ip + 1].y - dx * slope );
1153 
1154  m_HatchLines.emplace_back( SEG( pointbuffer[ip].x, pointbuffer[ip].y, x1, y1 ) );
1155 
1156  m_HatchLines.emplace_back( SEG( pointbuffer[ip+1].x, pointbuffer[ip+1].y, x2, y2 ) );
1157  }
1158  }
1159  }
1160 }
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:213
#define MAXPTS
bool sortEndsByDescendingX(const VECTOR2I &ref, const VECTOR2I &tst)
Definition: class_zone.cpp:994
std::vector< SEG > m_HatchLines
Definition: class_zone.h:831
ITERATOR IterateWithHoles(int aOutline)
Function IterateWithHoles.
ZONE_HATCH_STYLE m_hatchStyle
Definition: class_zone.h:829
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:737
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:986
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:61
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 560 of file class_zone.cpp.

561 {
562  // Normally accuracy is zoom-relative, but for the generic HitTest we just use
563  // a fixed (small) value.
564  int accuracy = std::max( aAccuracy, Millimeter2iu( 0.1 ) );
565 
566  return HitTestForCorner( aPosition, accuracy * 2 ) || HitTestForEdge( aPosition, accuracy );
567 }
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:585
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:599

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

614 {
615  // Calculate bounding box for zone
616  EDA_RECT bbox = GetBoundingBox();
617  bbox.Normalize();
618 
619  EDA_RECT arect = aRect;
620  arect.Normalize();
621  arect.Inflate( aAccuracy );
622 
623  if( aContained )
624  {
625  return arect.Contains( bbox );
626  }
627  else // Test for intersection between aBox and the polygon
628  // For a polygon, using its bounding box has no sense here
629  {
630  // Fast test: if aBox is outside the polygon bounding box, rectangles cannot intersect
631  if( !arect.Intersects( bbox ) )
632  return false;
633 
634  int count = m_Poly->TotalVertices();
635 
636  for( int ii = 0; ii < count; ii++ )
637  {
638  auto vertex = m_Poly->CVertex( ii );
639  auto vertexNext = m_Poly->CVertex( ( ii + 1 ) % count );
640 
641  // Test if the point is within the rect
642  if( arect.Contains( ( wxPoint ) vertex ) )
643  {
644  return true;
645  }
646 
647  // Test if this edge intersects the rect
648  if( arect.Intersects( ( wxPoint ) vertex, ( wxPoint ) vertexNext ) )
649  {
650  return true;
651  }
652  }
653 
654  return false;
655  }
656 }
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:506
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:737
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().

◆ HitTestFilledArea()

bool ZONE_CONTAINER::HitTestFilledArea ( const wxPoint aRefPos) const

Function HitTestFilledArea tests if the given wxPoint is within the bounds of a filled area of this zone.

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

Definition at line 684 of file class_zone.cpp.

685 {
686  return m_FilledPolysList.Contains( VECTOR2I( aRefPos.x, aRefPos.y ) );
687 }
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_FilledPolysList
Definition: class_zone.h:824

References SHAPE_POLY_SET::Contains(), m_FilledPolysList, 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 585 of file class_zone.cpp.

587 {
588  return m_Poly->CollideVertex( VECTOR2I( refPos ), aCornerHit, aAccuracy );
589 }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:737
bool CollideVertex(const VECTOR2I &aPoint, VERTEX_INDEX &aClosestVertex, int aClearance=0)
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 592 of file class_zone.cpp.

593 {
595  return HitTestForCorner( refPos, aAccuracy, dummy );
596 }
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:585
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 599 of file class_zone.cpp.

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

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

607 {
609  return HitTestForEdge( refPos, aAccuracy, dummy );
610 }
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:599

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_Poly = new SHAPE_POLY_SET( *aZone.m_Poly );
146 
147  // For corner moving, corner index to drag, or nullptr if no selection
148  m_CornerSelection = nullptr;
149  m_IsFilled = aZone.m_IsFilled;
150  m_ZoneClearance = aZone.m_ZoneClearance; // clearance value
153  m_FillMode = aZone.m_FillMode; // Filling mode (segments/polygons)
154  m_hv45 = aZone.m_hv45;
155  m_priority = aZone.m_priority;
160  m_FillSegmList = aZone.m_FillSegmList; // vector <> copy
161 
165 
168 
169  m_hatchStyle = aZone.m_hatchStyle;
170  m_hatchPitch = aZone.m_hatchPitch;
171  m_HatchLines = aZone.m_HatchLines;
172 
178 
179  SetLocalFlags( aZone.GetLocalFlags() );
180 
181  // Now zone type and layer are set, transfer net info
182  // (has meaning only for copper zones)
183  m_netinfo = aZone.m_netinfo;
184 
185  SetNeedRefill( aZone.NeedRefill() );
186 }
int m_ZoneClearance
Clearance value in internal units.
Definition: class_zone.h:762
bool m_doNotAllowTracks
Definition: class_zone.h:759
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:806
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:814
ZONE_CONNECTION m_PadConnection
Definition: class_zone.h:761
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:277
void SetLayerSet(LSET aLayerSet)
Definition: class_zone.cpp:248
int m_HatchFillTypeSmoothingLevel
Grid pattern smoothing type, similar to corner smoothing type 0 = no smoothing, 1 = fillet,...
Definition: class_zone.h:799
int m_ThermalReliefCopperBridge
Definition: class_zone.h:779
std::vector< SEG > m_HatchLines
Definition: class_zone.h:831
SHAPE_POLY_SET.
double m_HatchFillTypeOrientation
Grid style shape: orientation in degrees of the grid lines.
Definition: class_zone.h:795
bool m_IsFilled
True when a zone was filled, false after deleting the filled areas.
Definition: class_zone.h:767
ZONE_HATCH_STYLE m_hatchStyle
Definition: class_zone.h:829
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:737
unsigned m_priority
Definition: class_zone.h:747
bool m_doNotAllowVias
Definition: class_zone.h:758
int m_cornerSmoothingType
Definition: class_zone.h:738
double m_HatchFillTypeSmoothingValue
Grid pattern smoothing value for smoothing shape size calculations this is the ratio between the gap ...
Definition: class_zone.h:803
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:824
unsigned int m_cornerRadius
Definition: class_zone.h:739
bool NeedRefill() const
Definition: class_zone.h:191
bool m_doNotAllowCopperPour
Definition: class_zone.h:757
int m_ThermalReliefGap
Width of the copper bridge in thermal reliefs.
Definition: class_zone.h:776
int m_ZoneMinThickness
Minimum thickness value in filled areas.
Definition: class_zone.h:763
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:786
int m_HatchFillTypeThickness
Grid style shape: thickness of lines (if 0 -> solid shape)
Definition: class_zone.h:789
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
void SetLocalFlags(int aFlags)
Definition: class_zone.h:260
int m_HatchFillTypeGap
Grid style shape: dist between center of lines (grid size) (0 -> solid shape)
Definition: class_zone.h:792
bool m_forceVisible
Set to true to override the visibility setting of the item.
Definition: base_struct.h:186
int GetLocalFlags() const
Definition: class_zone.h:259
bool m_FilledPolysUseThickness
outline of filled polygons have thickness.
Definition: class_zone.h:764
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:192

References SHAPE_POLY_SET::Append(), GetLayerSet(), GetLocalFlags(), m_cornerRadius, m_CornerSelection, m_cornerSmoothingType, m_doNotAllowCopperPour, m_doNotAllowTracks, m_doNotAllowVias, 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_IsFilled, m_isKeepout, BOARD_CONNECTED_ITEM::m_netinfo, m_PadConnection, m_Poly, m_priority, m_ThermalReliefCopperBridge, m_ThermalReliefGap, m_ZoneClearance, m_ZoneMinThickness, NeedRefill(), 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 223 of file base_struct.h.

223 { return m_Flags & IS_DRAGGED; }
#define IS_DRAGGED
Item being dragged.
Definition: base_struct.h:122
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189

References IS_DRAGGED, and EDA_ITEM::m_Flags.

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

◆ IsFilled()

bool ZONE_CONTAINER::IsFilled ( ) const
inline

Definition at line 188 of file class_zone.h.

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

References m_IsFilled.

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

◆ IsHighlighted()

bool EDA_ITEM::IsHighlighted ( ) const
inlineinherited

Definition at line 227 of file base_struct.h.

227 { return m_Flags & HIGHLIGHTED; }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:142
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189

References HIGHLIGHTED, and EDA_ITEM::m_Flags.

Referenced by SCH_COMPONENT::ClearAllHighlightFlags(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), and KIGFX::SCH_VIEW::HighlightItem().

◆ 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 210 of file class_board_item.h.

211  {
212  // only MODULEs & TRACKs can be locked at this time.
213  return false;
214  }

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

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 221 of file base_struct.h.

221 { return m_Flags & IS_CHANGED; }
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:116
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189

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

220 {
221  if( GetIsKeepout() )
222  {
223  return ( m_layerSet & LSET::AllCuMask() ).count() > 0;
224  }
225  else
226  {
227  return IsCopperLayer( GetLayer() );
228  }
229 }
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:686
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:213
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:649
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.

References LSET::AllCuMask(), GetIsKeepout(), GetLayer(), IsCopperLayer(), and m_layerSet.

Referenced by GERBER_JOBFILE_WRITER::addJSONDesignRules(), BOARD_NETLIST_UPDATER::cacheCopperZoneConnections(), ZONE_FILLER::fillSingleZone(), GetMsgPanelInfo(), BRDITEMS_PLOTTER::PlotFilledAreas(), BOARD::SetAreasNetCodesFromNetNames(), DRC::testZones(), DRC::TestZoneToZoneOutlines(), TransformOutlinesShapeWithClearanceToPolygon(), 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 310 of file class_zone.cpp.

311 {
312  if( GetIsKeepout() )
313  return m_layerSet.test( aLayer );
314 
315  return BOARD_ITEM::IsOnLayer( aLayer );
316 }
virtual bool IsOnLayer(PCB_LAYER_ID aLayer) const
Function IsOnLayer tests to see if this object is on the given layer.
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:649

References GetIsKeepout(), BOARD_ITEM::IsOnLayer(), and m_layerSet.

Referenced by CINFO3D_VISU::createLayers(), KIGFX::PCB_PAINTER::draw(), DSN::SPECCTRA_DB::FromBOARD(), and Print().

◆ 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 517 of file base_struct.h.

517 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 226 of file base_struct.h.

226 { return m_Flags & IS_RESIZED; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:121

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( GetLayer() != aZoneToCompare.GetLayer() )
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 
90  if( m_ZoneClearance != aZoneToCompare.m_ZoneClearance )
91  return false;
92 
93  if( m_ZoneMinThickness != aZoneToCompare.GetMinThickness() )
94  return false;
95 
96  if( m_FillMode != aZoneToCompare.GetFillMode() )
97  return false;
98 
99  if( m_PadConnection != aZoneToCompare.m_PadConnection )
100  return false;
101 
102  if( m_ThermalReliefGap != aZoneToCompare.m_ThermalReliefGap )
103  return false;
104 
106  return false;
107 
108 
109  // Compare outlines
110  wxASSERT( m_Poly ); // m_Poly == NULL Should never happen
111  wxASSERT( aZoneToCompare.Outline() );
112 
113  if( Outline() != aZoneToCompare.Outline() ) // Compare vector
114  return false;
115 
116  return true;
117 }
int m_ZoneClearance
Clearance value in internal units.
Definition: class_zone.h:762
int GetNetCode() const
Function GetNetCode.
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:213
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:265
bool GetDoNotAllowVias() const
Definition: class_zone.h:651
ZONE_CONNECTION m_PadConnection
Definition: class_zone.h:761
int m_ThermalReliefCopperBridge
Definition: class_zone.h:779
ZONE_FILL_MODE GetFillMode() const
Definition: class_zone.h:156
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:737
bool GetDoNotAllowCopperPour() const
Definition: class_zone.h:650
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:649
int m_ThermalReliefGap
Width of the copper bridge in thermal reliefs.
Definition: class_zone.h:776
int m_ZoneMinThickness
Minimum thickness value in filled areas.
Definition: class_zone.h:763
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:786
unsigned GetPriority() const
Function GetPriority.
Definition: class_zone.h:100
int GetMinThickness() const
Definition: class_zone.h:204
bool GetDoNotAllowTracks() const
Definition: class_zone.h:652

References GetDoNotAllowCopperPour(), GetDoNotAllowTracks(), GetDoNotAllowVias(), GetFillMode(), GetIsKeepout(), GetLayer(), GetMinThickness(), BOARD_CONNECTED_ITEM::GetNetCode(), GetPriority(), m_FillMode, m_PadConnection, m_Poly, m_ThermalReliefCopperBridge, m_ThermalReliefGap, m_ZoneClearance, m_ZoneMinThickness, 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 201 of file class_board_item.h.

202  {
203  return ( Type() == PCB_TRACE_T ) || ( Type() == PCB_VIA_T );
204  }
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:212

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, SCH_FIELD, and SCH_LINE.

Definition at line 286 of file base_struct.h.

287  {
288  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
289  return true;
290 
291  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
292  {
293  if( m_StructType == *p )
294  return true;
295  }
296 
297  return false;
298  }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it.
Definition: base_struct.h:178
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 SCH_LINE_WIRE_BUS_TOOL::IsDrawingBus(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLine(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingWire(), SCH_LINE::IsType(), SCH_FIELD::IsType(), SCH_LABEL::IsType(), EE_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 224 of file base_struct.h.

224 { return m_Flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:124
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189

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

461  {
462  return m_Poly->Iterate();
463  }
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:737

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 399 of file base_struct.h.

403  {
404  for( auto it : aList )
405  {
406  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
408  return SEARCH_RESULT::QUIT;
409  }
410 
412  }
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 420 of file base_struct.h.

422  {
423  for( auto it : aList )
424  {
425  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
427  return SEARCH_RESULT::QUIT;
428  }
429 
431  }
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 470 of file class_zone.h.

471  {
472  return m_Poly->IterateWithHoles();
473  }
ITERATOR IterateWithHoles(int aOutline)
Function IterateWithHoles.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:737

References SHAPE_POLY_SET::IterateWithHoles(), and m_Poly.

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

◆ 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, MARKER_PCB, LIB_PIN, SCH_PIN, SCH_MARKER, TEXTE_MODULE, and TEXTE_PCB.

Definition at line 473 of file base_struct.h.

474  {
475  return false;
476  }

Referenced by SCH_EDITOR_CONTROL::HasMatch(), TEXTE_PCB::Matches(), TEXTE_MODULE::Matches(), SCH_MARKER::Matches(), LIB_PIN::Matches(), MARKER_PCB::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 152 of file base_struct.cpp.

153 {
154  wxString text = aText;
155  wxString searchText = aSearchData.GetFindString();
156 
157  // Don't match if searching for replaceable item and the item doesn't support text replace.
158  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
159  return false;
160 
161  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
162  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
163 
164  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
165  {
166  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
167  return text.Matches( searchText );
168 
169  return text.MakeUpper().Matches( searchText.MakeUpper() );
170  }
171 
172  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
173  return aText.Find( searchText ) != wxNOT_FOUND;
174 
175  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
176 }
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:517

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

855 {
856  // ZONE_CONTAINERs mirror about the x-axis (why?!?)
857  m_Poly->Mirror( aMirrorLeftRight, !aMirrorLeftRight, VECTOR2I( aMirrorRef ) );
858 
859  Hatch();
860 
861  m_FilledPolysList.Mirror( aMirrorLeftRight, !aMirrorLeftRight, VECTOR2I( aMirrorRef ) );
862 
863  for( SEG& seg : m_FillSegmList )
864  {
865  if( aMirrorLeftRight )
866  {
867  MIRROR( seg.A.x, aMirrorRef.x );
868  MIRROR( seg.B.x, aMirrorRef.x );
869  }
870  else
871  {
872  MIRROR( seg.A.y, aMirrorRef.y );
873  MIRROR( seg.B.y, aMirrorRef.y );
874  }
875  }
876 }
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:814
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:123
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:737
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:824
Definition: seg.h:39
void Hatch()
Function Hatch computes the hatch lines depending on the hatch parameters and stores it in the zone's...

References Hatch(), m_FilledPolysList, m_FillSegmList, m_Poly, MIRROR(), SHAPE_POLY_SET::Mirror(), wxPoint::x, and wxPoint::y.

Referenced by Flip().

◆ Move() [1/2]

void BOARD_ITEM::Move ( const VECTOR2I aMoveVector)
inlineinherited

Definition at line 249 of file class_board_item.h.

250  {
251  Move( wxPoint( aMoveVector.x, aMoveVector.y ) );
252  }
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 782 of file class_zone.cpp.

783 {
784  /* move outlines */
785  m_Poly->Move( offset );
786 
787  Hatch();
788 
789  m_FilledPolysList.Move( offset );
790 
791  for( SEG& seg : m_FillSegmList )
792  {
793  seg.A += VECTOR2I( offset );
794  seg.B += VECTOR2I( offset );
795  }
796 }
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:814
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:737
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:824
Definition: seg.h:39
void Hatch()
Function Hatch computes the hatch lines depending on the hatch parameters and stores it in the zone's...

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

800 {
801  int next_corner;
802 
803  if( m_Poly->GetNeighbourIndexes( aEdge, nullptr, &next_corner ) )
804  {
805  m_Poly->SetVertex( aEdge, m_Poly->CVertex( aEdge ) + VECTOR2I( offset ) );
806  m_Poly->SetVertex( next_corner, m_Poly->CVertex( next_corner ) + VECTOR2I( offset ) );
807  Hatch();
808 
809  SetNeedRefill( true );
810  }
811 }
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:737
void Hatch()
Function Hatch computes the hatch lines depending on the hatch parameters and stores it in the zone's...
void SetNeedRefill(bool aNeedRefill)
Definition: class_zone.h:192

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

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

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

524  {
525  m_Poly->NewHole();
526  }
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:737

References m_Poly, and SHAPE_POLY_SET::NewHole().

◆ 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 206 of file base_struct.cpp.

207 {
208  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
209  GetChars( GetClass() ) ) );
210 
211  return false;
212 }
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:101
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 88 of file class_zone.cpp.

89 {
91 
92  // Replace the outlines for aOther outlines.
93  delete m_Poly;
94  m_Poly = new SHAPE_POLY_SET( *aOther.m_Poly );
95 
96  m_isKeepout = aOther.m_isKeepout;
97  m_CornerSelection = nullptr; // for corner moving, corner index to (null if no selection)
98  m_ZoneClearance = aOther.m_ZoneClearance; // clearance value
101  m_FillMode = aOther.m_FillMode; // filling mode (segments/polygons)
105  SetHatchStyle( aOther.GetHatchStyle() );
106  SetHatchPitch( aOther.GetHatchPitch() );
107  m_HatchLines = aOther.m_HatchLines; // copy vector <SEG>
110  m_FillSegmList.clear();
112 
118 
119  SetLayerSet( aOther.GetLayerSet() );
120 
121  return *this;
122 }
void SetHatchPitch(int aPitch)
Function SetHatchPitch sets the hatch pitch parameter for the zone.
Definition: class_zone.cpp:980
int m_ZoneClearance
Clearance value in internal units.
Definition: class_zone.h:762
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:806
void SetHatchStyle(ZONE_HATCH_STYLE aStyle)
Definition: class_zone.h:543
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:814
ZONE_CONNECTION m_PadConnection
Definition: class_zone.h:761
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:277
void SetLayerSet(LSET aLayerSet)
Definition: class_zone.cpp:248
int m_HatchFillTypeSmoothingLevel
Grid pattern smoothing type, similar to corner smoothing type 0 = no smoothing, 1 = fillet,...
Definition: class_zone.h:799
int m_ThermalReliefCopperBridge
Definition: class_zone.h:779
std::vector< SEG > m_HatchLines
Definition: class_zone.h:831
SHAPE_POLY_SET.
double m_HatchFillTypeOrientation
Grid style shape: orientation in degrees of the grid lines.
Definition: class_zone.h:795
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:737
double m_HatchFillTypeSmoothingValue
Grid pattern smoothing value for smoothing shape size calculations this is the ratio between the gap ...
Definition: class_zone.h:803
ZONE_HATCH_STYLE GetHatchStyle() const
Definition: class_zone.h:538
EDA_ITEM & operator=(const EDA_ITEM &aItem)
Operator assignment is used to assign the members of aItem to another object.
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:824
int m_ThermalReliefGap
Width of the copper bridge in thermal reliefs.
Definition: class_zone.h:776
int m_ZoneMinThickness
Minimum thickness value in filled areas.
Definition: class_zone.h:763
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:786
int m_HatchFillTypeThickness
Grid style shape: thickness of lines (if 0 -> solid shape)
Definition: class_zone.h:789
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.
int GetHatchPitch() const
Hatch related methods.
Definition: class_zone.cpp:964
int m_HatchFillTypeGap
Grid style shape: dist between center of lines (grid size) (0 -> solid shape)
Definition: class_zone.h:792
bool m_FilledPolysUseThickness
outline of filled polygons have thickness.
Definition: class_zone.h:764
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)

References SHAPE_POLY_SET::Append(), GetHatchPitch(), GetHatchStyle(), GetLayerSet(), m_CornerSelection, m_FilledPolysList, m_FilledPolysUseThickness, m_FillMode, m_FillSegmList, m_HatchFillTypeGap, m_HatchFillTypeOrientation, m_HatchFillTypeSmoothingLevel, m_HatchFillTypeSmoothingValue, m_HatchFillTypeThickness, m_HatchLines, m_isKeepout, m_PadConnection, m_Poly, m_ThermalReliefCopperBridge, m_ThermalReliefGap, m_ZoneClearance, m_ZoneMinThickness, EDA_ITEM::operator=(), SHAPE_POLY_SET::RemoveAllContours(), 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 266 of file class_zone.h.

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

References m_Poly.

◆ Print()

void ZONE_CONTAINER::Print ( PCB_BASE_FRAME aFrame,
wxDC *  DC,
const wxPoint offset = ZeroOffset 
)
overridevirtual

Function Print Prints the zone outline.

Parameters
aFrame= current Frame
DC= current Device Context
aDrawMode= GR_OR, GR_XOR, GR_COPY ..
offset= Draw offset (usually wxPoint(0,0))

Implements BOARD_ITEM.

Definition at line 319 of file class_zone.cpp.

320 {
321  if( !DC )
322  return;
323 
324  wxPoint seg_start, seg_end;
325  PCB_LAYER_ID curr_layer = aFrame->GetActiveLayer();
326  BOARD* brd = GetBoard();
327  PCB_LAYER_ID draw_layer = UNDEFINED_LAYER;
328 
329  LSET layers = GetLayerSet() & brd->GetVisibleLayers();
330 
331  // If there are no visible layers, return
332  if( layers.count() == 0 )
333  return;
334 
335  /* Keepout zones can exist on multiple layers
336  * Thus, determining which color to use to render them is a bit tricky.
337  * In descending order of priority:
338  *
339  * 1. If in GR_HIGHLIGHT mode:
340  * a. If zone is on selected layer, use layer color!
341  * b. Else, use grey
342  * 1. Not in GR_HIGHLIGHT mode
343  * a. If zone is on selected layer, use layer color
344  * b. Else, use color of top-most (visible) layer
345  *
346  */
347  if( GetIsKeepout() )
348  {
349  // At least one layer must be provided!
350  assert( GetLayerSet().count() > 0 );
351 
352  // Not on any visible layer?
353  if( layers.count() == 0 )
354  return;
355 
356  // Is keepout zone present on the selected layer?
357  if( layers.test( curr_layer ) )
358  {
359  draw_layer = curr_layer;
360  }
361  else
362  {
363  // Select the first (top) visible layer
364  if( layers.count() > 0 )
365  {
366  draw_layer = layers.Seq()[0];
367  }
368  else
369  {
370  draw_layer = GetLayerSet().Seq()[0];
371  }
372  }
373 
374  }
375  /* Non-keepout zones are easier to deal with
376  */
377  else
378  {
379  if( brd->IsLayerVisible( GetLayer() ) == false )
380  return;
381 
382  draw_layer = GetLayer();
383  }
384 
385  assert( draw_layer != UNDEFINED_LAYER );
386 
387  COLOR4D color = Pgm().GetSettingsManager().GetColorSettings()->GetColor( draw_layer );
388 
389  auto displ_opts = aFrame->GetDisplayOptions();
390 
391  if( displ_opts.m_ContrastModeDisplay )
392  {
393  if( !IsOnLayer( curr_layer ) )
395  }
396 
397  color.a = 0.588;
398 
399  // draw the lines
400  std::vector<wxPoint> lines;
401  lines.reserve( (GetNumCorners() * 2) + 2 );
402 
403  // Iterate through the segments of the outline
404  for( auto iterator = m_Poly->IterateSegmentsWithHoles(); iterator; iterator++ )
405  {
406  // Create the segment
407  SEG segment = *iterator;
408 
409  lines.push_back( static_cast<wxPoint>( segment.A ) + offset );
410  lines.push_back( static_cast<wxPoint>( segment.B ) + offset );
411  }
412 
413  GRLineArray( nullptr, DC, lines, 0, color );
414 
415  // draw hatches
416  lines.clear();
417  lines.reserve( (m_HatchLines.size() * 2) + 2 );
418 
419  for( unsigned ic = 0; ic < m_HatchLines.size(); ic++ )
420  {
421  seg_start = static_cast<wxPoint>( m_HatchLines[ic].A ) + offset;
422  seg_end = static_cast<wxPoint>( m_HatchLines[ic].B ) + offset;
423  lines.push_back( seg_start );
424  lines.push_back( seg_end );
425  }
426 
427  GRLineArray( nullptr, DC, lines, 0, color );
428 }
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:103
SEGMENT_ITERATOR IterateSegmentsWithHoles()
Returns an iterator object, for all outlines in the set (with holes)
virtual bool IsOnLayer(PCB_LAYER_ID) const override
Function IsOnLayer tests to see if this object is on the given layer.
Definition: class_zone.cpp:310
int color
Definition: DXF_plotter.cpp:61
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:213
LSET GetVisibleLayers() const
Function GetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
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
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Function GetDisplayOptions returns the display options current in use Display options are relative to...
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:277
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
PCB_LAYER_ID
A quick note on layer IDs:
LSET is a set of PCB_LAYER_IDs.
std::vector< SEG > m_HatchLines
Definition: class_zone.h:831
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:737
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
int GetNumCorners(void) const
Access to m_Poly parameters.
Definition: class_zone.h:450
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:649
Definition: seg.h:39
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
Function IsLayerVisible is a proxy function that calls the correspondent function in m_BoardSettings ...
Definition: class_board.h:431
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:163
VECTOR2I A
Definition: seg.h:47
void GRLineArray(EDA_RECT *aClipBox, wxDC *aDC, std::vector< wxPoint > &aLines, int aWidth, COLOR4D aColor)
Function GRLineArray draws an array of lines (not a polygon).
Definition: gr_basic.cpp:284
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:40
VECTOR2I B
Definition: seg.h:48

References SEG::A, SEG::B, color, DARKDARKGRAY, PCB_BASE_FRAME::GetActiveLayer(), BOARD_ITEM::GetBoard(), PCB_BASE_FRAME::GetDisplayOptions(), GetIsKeepout(), GetLayer(), GetLayerSet(), GetNumCorners(), BOARD::GetVisibleLayers(), GRLineArray(), BOARD::IsLayerVisible(), IsOnLayer(), SHAPE_POLY_SET::IterateSegmentsWithHoles(), m_HatchLines, m_Poly, Pgm(), LSET::Seq(), and UNDEFINED_LAYER.

◆ PrintFilledArea()

void ZONE_CONTAINER::PrintFilledArea ( PCB_BASE_FRAME aFrame,
wxDC *  DC,
const wxPoint offset = ZeroOffset 
)

Function PrintFilledArea Draws the filled area for this zone (polygon list .m_FilledPolysList)

Parameters
aFrame= current Frame
DC= current Device Context
offset= Draw offset (usually wxPoint(0,0))
aDrawMode= GR_OR, GR_XOR, GR_COPY ..

Definition at line 431 of file class_zone.cpp.

432 {
433  static std::vector <wxPoint> CornersBuffer;
434 
435  BOARD* brd = GetBoard();
436  COLOR4D color = Pgm().GetSettingsManager().GetColorSettings()->GetColor( GetLayer() );
437  auto& displ_opts = aFrame->GetDisplayOptions();
438  bool outline_mode = displ_opts.m_DisplayZonesMode == 2;
439 
440  if( DC == NULL )
441  return;
442 
443  if( displ_opts.m_DisplayZonesMode == 1 ) // Do not show filled areas
444  return;
445 
446  if( m_FilledPolysList.IsEmpty() ) // Nothing to draw
447  return;
448 
449  if( brd->IsLayerVisible( GetLayer() ) == false )
450  return;
451 
452  color.a = 0.588;
453 
454  for( int ic = 0; ic < m_FilledPolysList.OutlineCount(); ic++ )
455  {
456  const SHAPE_LINE_CHAIN& path = m_FilledPolysList.COutline( ic );
457 
458  CornersBuffer.clear();
459 
460  wxPoint p0;
461 
462  for( int j = 0; j < path.PointCount(); j++ )
463  {
464  const VECTOR2I& corner = path.CPoint( j );
465 
466  wxPoint coord( corner.x + offset.x, corner.y + offset.y );
467 
468  if( j == 0 )
469  p0 = coord;
470 
471  CornersBuffer.push_back( coord );
472  }
473 
474  CornersBuffer.push_back( p0 );
475 
476  // Draw outlines:
477  int outline_thickness = GetFilledPolysUseThickness() ? GetMinThickness() : 0;
478 
479  if( ( outline_thickness > 1 ) || outline_mode )
480  {
481  int ilim = CornersBuffer.size() - 1;
482 
483  for( int is = 0, ie = ilim; is <= ilim; ie = is, is++ )
484  {
485  // Draw only basic outlines, not extra segments.
486  if( !displ_opts.m_DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
487  {
488  GRCSegm( nullptr, DC, CornersBuffer[is], CornersBuffer[ie],
489  outline_thickness, color );
490  }
491  else
492  {
493  GRFilledSegment( nullptr, DC, CornersBuffer[is], CornersBuffer[ie],
494  outline_thickness, color );
495  }
496  }
497  }
498 
499  // Draw fill:
500  if( !outline_mode )
501  GRPoly( nullptr, DC, CornersBuffer.size(), &CornersBuffer[0], true, 0, color, color );
502  }
503 }
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:103
int OutlineCount() const
Returns the number of outlines in the set
void GRPoly(EDA_RECT *ClipBox, wxDC *DC, int n, const wxPoint *Points, bool Fill, int width, COLOR4D Color, COLOR4D BgColor)
Definition: gr_basic.cpp:542
int color
Definition: DXF_plotter.cpp:61
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:213
bool GetFilledPolysUseThickness() const
Definition: class_zone.h:617
void GRCSegm(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, int aPenSize, COLOR4D Color)
Definition: gr_basic.cpp:312
int PointCount() const
Function PointCount()
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Function GetDisplayOptions returns the display options current in use Display options are relative to...
const VECTOR2I & CPoint(int aIndex) const
Function Point()
#define NULL
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:824
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
Function IsLayerVisible is a proxy function that calls the correspondent function in m_BoardSettings ...
Definition: class_board.h:431
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:163
SHAPE_LINE_CHAIN.
void GRFilledSegment(EDA_RECT *aClipBox, wxDC *aDC, wxPoint aStart, wxPoint aEnd, int aWidth, COLOR4D aColor)
Definition: gr_basic.cpp:423
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
int GetMinThickness() const
Definition: class_zone.h:204
#define FORCE_SKETCH
Definition: pcbnew.h:44
int GetState(int type) const
Definition: base_struct.h:241
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:40

References color, SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoint(), FORCE_SKETCH, BOARD_ITEM::GetBoard(), PCB_BASE_FRAME::GetDisplayOptions(), GetFilledPolysUseThickness(), GetLayer(), GetMinThickness(), EDA_ITEM::GetState(), GRCSegm(), GRFilledSegment(), GRPoly(), SHAPE_POLY_SET::IsEmpty(), BOARD::IsLayerVisible(), PCB_DISPLAY_OPTIONS::m_DisplayZonesMode, m_FilledPolysList, NULL, SHAPE_POLY_SET::OutlineCount(), Pgm(), SHAPE_LINE_CHAIN::PointCount(), wxPoint::x, VECTOR2< T >::x, wxPoint::y, and VECTOR2< T >::y.

◆ RawPolysList()

SHAPE_POLY_SET& ZONE_CONTAINER::RawPolysList ( )
inline

Definition at line 635 of file class_zone.h.

636  {
637  return m_RawPolysList;
638  }
SHAPE_POLY_SET m_RawPolysList
Definition: class_zone.h:825

References m_RawPolysList.

◆ RemoveAllContours()

void ZONE_CONTAINER::RemoveAllContours ( void  )
inline

Definition at line 485 of file class_zone.h.

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

References m_Poly, and SHAPE_POLY_SET::RemoveAllContours().

◆ 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 179 of file base_struct.cpp.

180 {
181  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
182 
183  int result = searchString.Find( (aSearchData.GetFlags() & wxFR_MATCHCASE) ?
184  aSearchData.GetFindString() :
185  aSearchData.GetFindString().Upper() );
186 
187  if( result == wxNOT_FOUND )
188  return false;
189 
190  wxString prefix = aText.Left( result );
191  wxString suffix;
192 
193  if( aSearchData.GetFindString().length() + result < aText.length() )
194  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
195 
196  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
197  GetChars( aText ), GetChars( prefix ), GetChars( aSearchData.GetReplaceString() ),
198  GetChars( suffix ) );
199 
200  aText = prefix + aSearchData.GetReplaceString() + suffix;
201 
202  return true;
203 }
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:101

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 505 of file base_struct.h.

505 { return false; }

◆ Rotate() [1/2]

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

Definition at line 265 of file class_board_item.h.

266  {
267  Rotate( wxPoint( aRotCentre.x, aRotCentre.y ), aAngle );
268  }
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 814 of file class_zone.cpp.

815 {
816  wxPoint pos;
817 
818  angle = -DECIDEG2RAD( angle );
819 
820  m_Poly->Rotate( angle, VECTOR2I( centre ) );
821  Hatch();
822 
823  /* rotate filled areas: */
824  m_FilledPolysList.Rotate( angle, VECTOR2I( centre ) );
825 
826  for( unsigned ic = 0; ic < m_FillSegmList.size(); ic++ )
827  {
828  wxPoint a( m_FillSegmList[ic].A );
829  RotatePoint( &a, centre, angle );
830  m_FillSegmList[ic].A = a;
831  wxPoint b( m_FillSegmList[ic].B );
832  RotatePoint( &b, centre, angle );
833  m_FillSegmList[ic].B = a;
834  }
835 }
void Rotate(double aAngle, const VECTOR2I &aCenter={ 0, 0 })
Function Rotate rotates all vertices by a given angle.
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:814
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:737
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:824
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
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...

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

Referenced by EAGLE_PLUGIN::loadPlain().

◆ SetBrightened()

void EDA_ITEM::SetBrightened ( )
inlineinherited

◆ SetCornerPosition()

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

Definition at line 501 of file class_zone.h.

502  {
503  SHAPE_POLY_SET::VERTEX_INDEX relativeIndices;
504 
505  // Convert global to relative indices
506  if( m_Poly->GetRelativeIndices( aCornerIndex, &relativeIndices ) )
507  {
508  if( m_Poly->CVertex( relativeIndices ).x != new_pos.x
509  || m_Poly->CVertex( relativeIndices ).y != new_pos.y )
510  {
511  SetNeedRefill( true );
512  m_Poly->SetVertex( relativeIndices, new_pos );
513  }
514  }
515  else
516  throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
517  }
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:737
bool GetRelativeIndices(int aGlobalIdx, VERTEX_INDEX *aRelativeIndices) const
Function GetRelativeIndices.
void SetNeedRefill(bool aNeedRefill)
Definition: class_zone.h:192

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

552 {
553  if( m_cornerRadius != aRadius )
554  SetNeedRefill( true );
555 
556  m_cornerRadius = aRadius;
557 }
unsigned int m_cornerRadius
Definition: class_zone.h:739
void SetNeedRefill(bool aNeedRefill)
Definition: class_zone.h:192

References m_cornerRadius, and SetNeedRefill().

Referenced by ZONE_SETTINGS::ExportSetting().

◆ SetCornerSmoothingType()

void ZONE_CONTAINER::SetCornerSmoothingType ( int  aType)
inline

Definition at line 609 of file class_zone.h.

609 { m_cornerSmoothingType = aType; };
int m_cornerSmoothingType
Definition: class_zone.h:738

References m_cornerSmoothingType.

Referenced by ZONE_SETTINGS::ExportSetting().

◆ SetDoNotAllowCopperPour()

void ZONE_CONTAINER::SetDoNotAllowCopperPour ( bool  aEnable)
inline

◆ SetDoNotAllowTracks()

void ZONE_CONTAINER::SetDoNotAllowTracks ( bool  aEnable)
inline

◆ SetDoNotAllowVias()

void ZONE_CONTAINER::SetDoNotAllowVias ( bool  aEnable)
inline

◆ SetFilledPolysList()

void ZONE_CONTAINER::SetFilledPolysList ( SHAPE_POLY_SET aPolysList)
inline

Function SetFilledPolysList sets the list of filled polygons.

Definition at line 585 of file class_zone.h.

586  {
587  m_FilledPolysList = aPolysList;
588  }
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:824

References m_FilledPolysList.

Referenced by ZONE_FILLER::Fill().

◆ SetFilledPolysUseThickness()

void ZONE_CONTAINER::SetFilledPolysUseThickness ( bool  aOption)
inline

Definition at line 618 of file class_zone.h.

618 { m_FilledPolysUseThickness = aOption; }
bool m_FilledPolysUseThickness
outline of filled polygons have thickness.
Definition: class_zone.h:764

References m_FilledPolysUseThickness.

Referenced by ZONE_FILLER::Fill().

◆ SetFillMode()

void ZONE_CONTAINER::SetFillMode ( ZONE_FILL_MODE  aFillMode)
inline

Definition at line 155 of file class_zone.h.

155 { m_FillMode = aFillMode; }
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:786

References m_FillMode.

Referenced by export_vrml_zones(), ZONE_SETTINGS::ExportSetting(), and EAGLE_PLUGIN::loadPolygon().

◆ SetFillSegments()

void ZONE_CONTAINER::SetFillSegments ( const ZONE_SEGMENT_FILL aSegments)
inline

Definition at line 630 of file class_zone.h.

631  {
632  m_FillSegmList = aSegments;
633  }
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:814

References m_FillSegmList.

◆ SetFlags()

void EDA_ITEM::SetFlags ( STATUS_FLAGS  aMask)
inlineinherited

Definition at line 257 of file base_struct.h.

257 { m_Flags |= aMask; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189

References EDA_ITEM::m_Flags.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), PCB_BASE_FRAME::AddModuleToBoard(), PCBNEW_CONTROL::AppendBoard(), SCH_EDIT_FRAME::ConvertPart(), SCH_EDIT_FRAME::ConvertTextType(), SCH_EDIT_FRAME::CreateNewText(), LIB_PIN_TOOL::CreatePin(), SCH_EDIT_FRAME::CreateSheetPin(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), KIGFX::SCH_PAINTER::draw(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), LIB_DRAWING_TOOLS::DrawShape(), SCH_EDIT_TOOL::Duplicate(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), SCH_MOVE_TOOL::getConnectedDragItems(), KIGFX::SCH_VIEW::HighlightItem(), EDIT_POINTS_FACTORY::Make(), TRACKS_CLEANER::mergeCollinearSegments(), SCH_MOVE_TOOL::moveItem(), LIB_MOVE_TOOL::moveItem(), KIGFX::ORIGIN_VIEWITEM::ORIGIN_VIEWITEM(), LIB_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), PCB_EDITOR_CONTROL::PlaceModule(), DRAWING_TOOL::PlaceText(), SCH_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_PIN_TOOL::RepeatPin(), LIB_EDIT_FRAME::SaveCopyInUndoList(), EE_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectPoint(), SCH_EDIT_FRAME::SelectUnit(), EDA_ITEM::SetBrightened(), LIB_PIN::SetConversion(), EDA_ITEM::SetHighlighted(), EDA_ITEM::SetModified(), EDA_ITEM::SetSelected(), EDA_ITEM::SetWireImage(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_LINE_WIRE_BUS_TOOL::startSegments(), WS_DATA_ITEM::SyncDrawItems(), WS_DATA_ITEM_TEXT::SyncDrawItems(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), LIB_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ SetForceVisible()

void EDA_ITEM::SetForceVisible ( bool  aEnable)
inlineinherited

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.

Parameters
aEnableTrue forces the item to be drawn. False uses the item's visibility setting to determine if the item is to be drawn.

Definition at line 308 of file base_struct.h.

308 { m_forceVisible = aEnable; }
bool m_forceVisible
Set to true to override the visibility setting of the item.
Definition: base_struct.h:186

References EDA_ITEM::m_forceVisible.

◆ SetHatch()

void ZONE_CONTAINER::SetHatch ( ZONE_HATCH_STYLE  aHatchStyle,
int  aHatchPitch,
bool  aRebuildHatch 
)

Function SetHatch sets all hatch parameters for the zone.

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

Definition at line 970 of file class_zone.cpp.

971 {
972  SetHatchPitch( aHatchPitch );
973  m_hatchStyle = aHatchStyle;
974 
975  if( aRebuildHatch )
976  Hatch();
977 }
void SetHatchPitch(int aPitch)
Function SetHatchPitch sets the hatch pitch parameter for the zone.
Definition: class_zone.cpp:980
ZONE_HATCH_STYLE m_hatchStyle
Definition: class_zone.h:829
void Hatch()
Function Hatch computes the hatch lines depending on the hatch parameters and stores it in the zone's...

References Hatch(), m_hatchStyle, and SetHatchPitch().

Referenced by PCAD2KICAD::PCB_POLYGON::AddToBoard(), ZONE_SETTINGS::ExportSetting(), and EAGLE_PLUGIN::loadPlain().

◆ SetHatchFillTypeGap()

void ZONE_CONTAINER::SetHatchFillTypeGap ( int  aStep)
inline

Definition at line 217 of file class_zone.h.

217 { m_HatchFillTypeGap = aStep; }
int m_HatchFillTypeGap
Grid style shape: dist between center of lines (grid size) (0 -> solid shape)
Definition: class_zone.h:792

References m_HatchFillTypeGap.

Referenced by ZONE_SETTINGS::ExportSetting(), and EAGLE_PLUGIN::loadPolygon().

◆ SetHatchFillTypeOrientation()

void ZONE_CONTAINER::SetHatchFillTypeOrientation ( double  aStep)
inline

Definition at line 220 of file class_zone.h.

220 { m_HatchFillTypeOrientation = aStep; }
double m_HatchFillTypeOrientation
Grid style shape: orientation in degrees of the grid lines.
Definition: class_zone.h:795

References m_HatchFillTypeOrientation.

Referenced by ZONE_SETTINGS::ExportSetting(), and EAGLE_PLUGIN::loadPolygon().

◆ SetHatchFillTypeSmoothingLevel()

void ZONE_CONTAINER::SetHatchFillTypeSmoothingLevel ( int  aLevel)
inline

Definition at line 223 of file class_zone.h.

223 { m_HatchFillTypeSmoothingLevel = aLevel; }
int m_HatchFillTypeSmoothingLevel
Grid pattern smoothing type, similar to corner smoothing type 0 = no smoothing, 1 = fillet,...
Definition: class_zone.h:799

References m_HatchFillTypeSmoothingLevel.

Referenced by ZONE_SETTINGS::ExportSetting().

◆ SetHatchFillTypeSmoothingValue()

void ZONE_CONTAINER::SetHatchFillTypeSmoothingValue ( double  aValue)
inline

Definition at line 226 of file class_zone.h.

226 { m_HatchFillTypeSmoothingValue = aValue; }
double m_HatchFillTypeSmoothingValue
Grid pattern smoothing value for smoothing shape size calculations this is the ratio between the gap ...
Definition: class_zone.h:803

References m_HatchFillTypeSmoothingValue.

Referenced by ZONE_SETTINGS::ExportSetting().

◆ SetHatchFillTypeThickness()

void ZONE_CONTAINER::SetHatchFillTypeThickness ( int  aThickness)
inline

Definition at line 214 of file class_zone.h.

214 { m_HatchFillTypeThickness = aThickness; }
int m_HatchFillTypeThickness
Grid style shape: thickness of lines (if 0 -> solid shape)
Definition: class_zone.h:789

References m_HatchFillTypeThickness.

Referenced by ZONE_SETTINGS::ExportSetting(), and EAGLE_PLUGIN::loadPolygon().

◆ SetHatchPitch()

void ZONE_CONTAINER::SetHatchPitch ( int  aPitch)

Function SetHatchPitch sets the hatch pitch parameter for the zone.

Parameters
aPitchis the hatch pitch in iu.

Definition at line 980 of file class_zone.cpp.

981 {
982  m_hatchPitch = aPitch;
983 }

References m_hatchPitch.

Referenced by operator=(), and SetHatch().

◆ SetHatchStyle()

void ZONE_CONTAINER::SetHatchStyle ( ZONE_HATCH_STYLE  aStyle)
inline

Definition at line 543 of file class_zone.h.

544  {
545  m_hatchStyle = aStyle;
546  }
ZONE_HATCH_STYLE m_hatchStyle
Definition: class_zone.h:829

References m_hatchStyle.

Referenced by BOARD::InsertArea(), EAGLE_PLUGIN::loadPolygon(), and operator=().

◆ SetHighlighted()

void EDA_ITEM::SetHighlighted ( )
inlineinherited

Definition at line 232 of file base_struct.h.

232 { SetFlags( HIGHLIGHTED ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:257
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:142

References HIGHLIGHTED, and EDA_ITEM::SetFlags().

◆ SetHV45()

void ZONE_CONTAINER::SetHV45 ( bool  aConstrain)
inline

Definition at line 709 of file class_zone.h.

709 { m_hv45 = aConstrain; }

References m_hv45.

Referenced by ZONE_SETTINGS::ExportSetting().

◆ SetIsFilled()

void ZONE_CONTAINER::SetIsFilled ( bool  isFilled)
inline

Definition at line 189 of file class_zone.h.

189 { m_IsFilled = isFilled; }
bool m_IsFilled
True when a zone was filled, false after deleting the filled areas.
Definition: class_zone.h:767

References m_IsFilled.

Referenced by ZONE_FILLER::Fill().

◆ SetIsKeepout()

void ZONE_CONTAINER::SetIsKeepout ( bool  aEnable)
inline

◆ SetLayer()

void ZONE_CONTAINER::SetLayer ( PCB_LAYER_ID  aLayer)
overridevirtual

Function SetLayer sets the layer this item is on.

Parameters
aLayerThe layer number. is virtual because some items (in fact: class DIMENSION) have a slightly different initialization

Reimplemented from BOARD_ITEM.

Definition at line 240 of file class_zone.cpp.

241 {
242  SetLayerSet( LSET( aLayer ) );
243 
244  m_Layer = aLayer;
245 }
PCB_LAYER_ID m_Layer
void SetLayerSet(LSET aLayerSet)
Definition: class_zone.cpp:248
LSET is a set of PCB_LAYER_IDs.

References BOARD_ITEM::m_Layer, and SetLayerSet().

Referenced by PCAD2KICAD::PCB_POLYGON::AddToBoard(), ZONE_SETTINGS::ExportSetting(), Flip(), BOARD::InsertArea(), EAGLE_PLUGIN::loadPlain(), EAGLE_PLUGIN::loadPolygon(), and PlotSolderMaskLayer().

◆ SetLayerSet()

void ZONE_CONTAINER::SetLayerSet ( LSET  aLayerSet)

Definition at line 248 of file class_zone.cpp.

249 {
250  if( GetIsKeepout() )
251  {
252  // Keepouts can only exist on copper layers
253  aLayerSet &= LSET::AllCuMask();
254  }
255 
256  if( aLayerSet.count() == 0 )
257  return;
258 
259  if( m_layerSet != aLayerSet )
260  SetNeedRefill( true );
261 
262  m_layerSet = aLayerSet;
263 
264  // Set the single layer parameter.
265  // For keepout zones that can be on many layers, this parameter does not have
266  // really meaning and is a bit arbitrary if more than one layer is set.
267  // But many functions are using it.
268  // So we need to initialize it to a reasonable value.
269  // Priority is F_Cu then B_Cu then to the first selected layer
270  m_Layer = aLayerSet.Seq()[0];
271 
272  if( m_Layer != F_Cu && aLayerSet[B_Cu] )
273  m_Layer = B_Cu;
274 }
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:686
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 m_Layer
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:649
void SetNeedRefill(bool aNeedRefill)
Definition: class_zone.h:192

References LSET::AllCuMask(), B_Cu, F_Cu, GetIsKeepout(), BOARD_ITEM::m_Layer, m_layerSet, LSET::Seq(), and SetNeedRefill().

Referenced by ZONE_SETTINGS::ExportSetting(), Flip(), initDataFromSrcInCopyCtor(), operator=(), and SetLayer().

◆ SetLocalFlags()

void ZONE_CONTAINER::SetLocalFlags ( int  aFlags)
inline

Definition at line 260 of file class_zone.h.

260 { m_localFlgs = aFlags; }
int m_localFlgs
Variable used in polygon calculations.
Definition: class_zone.h:809

References m_localFlgs.

Referenced by BOARD::CombineAreas(), initDataFromSrcInCopyCtor(), BOARD::NormalizeAreaPolygon(), and ZONE_CONTAINER().

◆ SetLocalRatsnestVisible()

void BOARD_CONNECTED_ITEM::SetLocalRatsnestVisible ( bool  aVisible)
inlineinherited

Definition at line 181 of file board_connected_item.h.

182  {
183  m_localRatsnestVisible = aVisible;
184  }

References BOARD_CONNECTED_ITEM::m_localRatsnestVisible.

Referenced by PCB_EDIT_FRAME::Exchange_Module().

◆ SetLocked()

virtual void BOARD_ITEM::SetLocked ( bool  aLocked)
inlinevirtualinherited

Function SetLocked modifies 'lock' status for of the item.

Reimplemented in MODULE, and TRACK.

Definition at line 220 of file class_board_item.h.

221  {
222  // only MODULEs & TRACKs can be locked at this time.
223  }

Referenced by PCB_EDITOR_CONTROL::modifyLockSelected().

◆ SetMinThickness()

void ZONE_CONTAINER::SetMinThickness ( int  aMinThickness)
inline

Definition at line 205 of file class_zone.h.

206  {
207  if( m_ZoneMinThickness != aMinThickness )
208  SetNeedRefill( true );
209 
210  m_ZoneMinThickness = aMinThickness;
211  }
int m_ZoneMinThickness
Minimum thickness value in filled areas.
Definition: class_zone.h:763
void SetNeedRefill(bool aNeedRefill)
Definition: class_zone.h:192

References m_ZoneMinThickness, and SetNeedRefill().

Referenced by ZONE_SETTINGS::ExportSetting(), EAGLE_PLUGIN::loadPolygon(), and PlotSolderMaskLayer().

◆ SetModified()

◆ SetNeedRefill()

void ZONE_CONTAINER::SetNeedRefill ( bool  aNeedRefill)
inline

◆ SetNet()

void BOARD_CONNECTED_ITEM::SetNet ( NETINFO_ITEM aNetInfo)
inlineinherited

Function SetNet Sets a NET_INFO object for the item.

Definition at line 90 of file board_connected_item.h.

91  {
92  wxASSERT( aNetInfo->GetBoard() == GetBoard() || aNetInfo == NETINFO_LIST::OrphanedItem() );
93  m_netinfo = aNetInfo;
94  }
static NETINFO_ITEM * OrphanedItem()
NETINFO_ITEM meaning that there was no net assigned for an item, as there was no board storing net li...
Definition: netinfo.h:470
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.

References BOARD_ITEM::GetBoard(), BOARD_CONNECTED_ITEM::m_netinfo, and NETINFO_LIST::OrphanedItem().

◆ SetNetCode()

bool BOARD_CONNECTED_ITEM::SetNetCode ( int  aNetCode,
bool  aNoAssert = false 
)
inherited

Sets net using a net code.

Parameters
aNetCodeis a net code for the new net. It has to exist in NETINFO_LIST held by BOARD.
aNoAssertif true, do not assert that the net exists. Otherwise, item is assigned to the unconnected net.
Returns
true on success, false if the net did not exist Note also items (in fact pads) not on copper layers will have their net code always set to 0 (not connected)

Definition at line 50 of file board_connected_item.cpp.

51 {
52  if( !IsOnCopperLayer() )
53  aNetCode = 0;
54 
55  // if aNetCode < 0 ( typically NETINFO_LIST::FORCE_ORPHANED )
56  // or no parent board,
57  // set the m_netinfo to the dummy NETINFO_LIST::ORPHANED
58 
59  BOARD* board = GetBoard();
60  //auto connectivity = board ? board->GetConnectivity() : nullptr;
61  //bool addRatsnest = false;
62 
63  //if( connectivity )
64  //addRatsnest = connectivity->Remove( this );
65 
66  if( ( aNetCode >= 0 ) && board )
67  m_netinfo = board->FindNet( aNetCode );
68  else
70 
71  if( !aNoAssert )
72  wxASSERT( m_netinfo );
73 
74  // Add only if it was previously added to the ratsnest
75  //if( addRatsnest )
76  // connectivity->Add( this );
77 
78  return ( m_netinfo != NULL );
79 }
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
static NETINFO_ITEM * OrphanedItem()
NETINFO_ITEM meaning that there was no net assigned for an item, as there was no board storing net li...
Definition: netinfo.h:470
#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:163
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.
virtual bool IsOnCopperLayer() const

References BOARD::FindNet(), BOARD_ITEM::GetBoard(), BOARD_ITEM::IsOnCopperLayer(), BOARD_CONNECTED_ITEM::m_netinfo, NULL, and NETINFO_LIST::OrphanedItem().

Referenced by PNS_KICAD_IFACE::AddItem(), PCAD2KICAD::PCB_LINE::AddToBoard(), PCAD2KICAD::PCB_PAD::AddToBoard(), PCAD2KICAD::PCB_POLYGON::AddToBoard(), PCAD2KICAD::PCB_PAD::AddToModule(), BOARD_NETLIST_UPDATER::deleteSinglePadNets(), DRAWING_TOOL::DrawVia(), PCB_EDIT_FRAME::Edit_Zone_Params(), ZONE_SETTINGS::ExportSetting(), BOARD::InsertArea(), EAGLE_PLUGIN::loadPlain(), EAGLE_PLUGIN::loadSignals(), LEGACY_PLUGIN::loadTrackList(),