KiCad PCB EDA Suite
ZONE_CONTAINER Class Reference

Class 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

Classes

union  WX_VECTOR_CONVERTER
 Union to handle conversion between references to wxPoint and to VECTOR2I. More...
 

Public Types

enum  HATCH_STYLE { NO_HATCH, DIAGONAL_FULL, DIAGONAL_EDGE }
 Zone hatch styles. More...
 
typedef enum ZONE_CONTAINER::HATCH_STYLE HATCH_STYLE
 Zone hatch styles. More...
 

Public Member Functions

 ZONE_CONTAINER (BOARD *parent)
 
 ZONE_CONTAINER (const ZONE_CONTAINER &aZone)
 
ZONE_CONTAINERoperator= (const ZONE_CONTAINER &aOther)
 
 ~ZONE_CONTAINER ()
 
const wxPoint GetPosition () const override
 Function GetPosition. More...
 
void SetPosition (const wxPoint &aPos) override
 
void SetPriority (unsigned aPriority)
 Function SetPriority. More...
 
unsigned GetPriority () const
 Function GetPriority. More...
 
void GetMsgPanelInfo (EDA_UNITS_T 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 Draw (EDA_DRAW_PANEL *panel, wxDC *DC, GR_DRAWMODE aDrawMode, const wxPoint &offset=ZeroOffset) override
 Function Draw Draws the zone outline. More...
 
void DrawFilledArea (EDA_DRAW_PANEL *panel, wxDC *DC, GR_DRAWMODE aDrawMode, const wxPoint &offset=ZeroOffset)
 Function DrawDrawFilledArea Draws the filled area for this zone (polygon list .m_FilledPolysList) More...
 
void DrawWhileCreateOutline (EDA_DRAW_PANEL *panel, wxDC *DC, GR_DRAWMODE draw_mode=GR_OR)
 Function DrawWhileCreateOutline Draws the zone outline when it is created. 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
 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
 
void SetArcSegmentCount (int aArcSegCount)
 
int GetArcSegmentCount () const
 
bool IsFilled () const
 
void SetIsFilled (bool isFilled)
 
int GetZoneClearance () const
 
void SetZoneClearance (int aZoneClearance)
 
ZoneConnection GetPadConnection (D_PAD *aPad=NULL) const
 
void SetPadConnection (ZoneConnection aPadConnection)
 
int GetMinThickness () const
 
void SetMinThickness (int aMinThickness)
 
int GetSelectedCorner () const
 
void SetSelectedCorner (int aCorner)
 
void SetSelectedCorner (const wxPoint &aPosition)
 
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)
 
virtual bool HitTest (const wxPoint &aPosition) const override
 Function HitTest tests if a point is near an outline edge or a corner of this zone. More...
 
bool HitTestInsideZone (const wxPoint &aPosition) const
 Function HitTest tests if a point is inside the zone area, i.e. 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 TransformSolidAreasShapesToPolygonSet (SHAPE_POLY_SET &aCornerBuffer, int aCircleToSegmentsCount, double aCorrectionFactor) 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) 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 aCircleToSegmentsCount, double aCorrectionFactor) const override
 
bool HitTestForCorner (const wxPoint &refPos, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
 Function HitTestForCorner tests if the given wxPoint is near a corner. More...
 
bool HitTestForCorner (const wxPoint &refPos) const
 Function HitTestForCorner tests if the given wxPoint is near a corner. More...
 
bool HitTestForEdge (const wxPoint &refPos, 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) 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) override
 Function Flip Flip this object, i.e. More...
 
void Mirror (const wxPoint &mirror_ref)
 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...
 
HATCH_STYLE GetHatchStyle () const
 
void SetHatchStyle (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 ()
 
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) const
 Function GetSmoothedPoly returns a pointer to the corner-smoothed version of m_Poly if it exists, otherwise it returns m_Poly. More...
 
void SetCornerSmoothingType (int aType)
 
int GetCornerSmoothingType () const
 
void SetCornerRadius (unsigned int aRadius)
 
unsigned int GetCornerRadius () const
 
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 SetFillSegments (const ZONE_SEGMENT_FILL &aSegments)
 
SHAPE_POLY_SETRawPolysList ()
 
wxString GetSelectMenuText (EDA_UNITS_T 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 (int 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)
 
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)
 Function SetNetCode 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_ITEMNext () const
 
BOARD_ITEMBack () const
 
BOARD_ITEM_CONTAINERGetParent () const
 
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...
 
virtual void UnLink ()
 Function UnLink detaches this object from its owner. More...
 
void DeleteStructure ()
 Function DeleteStructure deletes this object after UnLink()ing it from its owner if it has one. More...
 
void Move (const VECTOR2I &aMoveVector)
 
void Rotate (const VECTOR2I &aRotCentre, double aAngle)
 
void Flip (const VECTOR2I &aCentre)
 
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 SetTimeStamp (timestamp_t aNewTimeStamp)
 
timestamp_t GetTimeStamp () const
 
DHEADGetList () const
 
void SetNext (EDA_ITEM *aNext)
 
void SetBack (EDA_ITEM *aBack)
 
void SetParent (EDA_ITEM *aParent)
 
void SetList (DHEAD *aList)
 
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 IsType (const KICAD_T aScanTypes[])
 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, wxPoint *aFindLocation)
 Function Matches compares the item against the search criteria in aSearchData. More...
 
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...
 
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
 

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...
 
static std::string FormatInternalUnits (int aValue)
 Function FormatInternalUnits converts aValue from board internal units to a string appropriate for writing to file. More...
 
static std::string FormatInternalUnits (const wxPoint &aPoint)
 
static std::string FormatInternalUnits (const VECTOR2I &aPoint)
 
static std::string FormatInternalUnits (const wxSize &aSize)
 
static std::string FormatAngle (double aAngle)
 Function FormatAngle converts aAngle from board units to a string appropriate for writing to file. More...
 
static SEARCH_RESULT IterateForward (EDA_ITEM *listStart, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 Function IterateForward walks through the object tree calling the inspector() on each object type requested in scanTypes. 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...
 

Static Public Attributes

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

Protected Member Functions

bool Matches (const wxString &aText, wxFindReplaceData &aSearchData)
 Function Matches compares aText against search criteria in aSearchData. More...
 

Static Protected Member Functions

static int getTrailingInt (const wxString &aStr)
 
static int getNextNumberInSequence (const std::set< int > &aSeq, bool aFillSequenceGaps)
 

Protected Attributes

NETINFO_ITEMm_netinfo
 Stores all informations about the net that item belongs to. More...
 
PCB_LAYER_ID m_Layer
 
EDA_ITEMPnext
 next in linked list More...
 
EDA_ITEMPback
 previous in linked list More...
 
DHEADm_List
 which DLIST I am on. More...
 
EDA_ITEMm_Parent
 Linked list: Link (parent struct) More...
 
timestamp_t m_TimeStamp
 Time stamp used for logical links. 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...
 

Private 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
 
ZoneConnection m_PadConnection
 
int m_ZoneClearance
 Clearance value in internal units. More...
 
int m_ZoneMinThickness
 Minimum thickness value in filled areas. More...
 
int m_ArcToSegmentsCount
 The number of segments to convert a circle to a polygon. More...
 
bool m_IsFilled
 True when a zone was filled, false after deleting the filled areas. 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: ZFM_POLYGONS => use filled polygons, ZFM_SEGMENTS => fill with segments. 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
 
HATCH_STYLE m_hatchStyle
 
int m_hatchPitch
 
std::vector< SEGm_HatchLines
 
std::vector< int > m_insulatedIslands
 
bool m_hv45
 

Detailed Description

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

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

Definition at line 60 of file class_zone.h.

Member Typedef Documentation

Member Enumeration Documentation

Zone hatch styles.

Enumerator
NO_HATCH 
DIAGONAL_FULL 
DIAGONAL_EDGE 

Definition at line 67 of file class_zone.h.

Constructor & Destructor Documentation

ZONE_CONTAINER::ZONE_CONTAINER ( BOARD parent)

Definition at line 52 of file class_zone.cpp.

References DIAGONAL_EDGE, ZONE_SETTINGS::ExportSetting(), GetDefaultHatchPitch(), BOARD::GetZoneSettings(), m_cornerRadius, m_CornerSelection, m_cornerSmoothingType, m_FillMode, m_hatchPitch, m_hatchStyle, m_hv45, m_IsFilled, m_Poly, m_priority, SetDoNotAllowCopperPour(), SetDoNotAllowTracks(), SetDoNotAllowVias(), SetIsKeepout(), SetLocalFlags(), ZONE_SETTINGS::SMOOTHING_NONE, and ZFM_POLYGONS.

Referenced by Clone(), and SaveCopyOfZones().

52  :
54 {
55  m_CornerSelection = nullptr; // no corner is selected
56  m_IsFilled = false; // fill status : true when the zone is filled
60  m_hv45 = false;
61  m_priority = 0;
63  SetIsKeepout( false );
64  SetDoNotAllowCopperPour( false ); // has meaning only if m_isKeepout == true
65  SetDoNotAllowVias( true ); // has meaning only if m_isKeepout == true
66  SetDoNotAllowTracks( true ); // has meaning only if m_isKeepout == true
67  m_cornerRadius = 0;
68  SetLocalFlags( 0 ); // flags tempoarry used in zone calculations
69  m_Poly = new SHAPE_POLY_SET(); // Outlines
70  aBoard->GetZoneSettings().ExportSetting( *this );
71 }
void SetDoNotAllowTracks(bool aEnable)
Definition: class_zone.h:616
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:724
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:615
Class SHAPE_POLY_SET.
bool m_IsFilled
True when a zone was filled, false after deleting the filled areas.
Definition: class_zone.h:711
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:678
unsigned m_priority
Definition: class_zone.h:688
int m_cornerSmoothingType
Definition: class_zone.h:679
unsigned int m_cornerRadius
Definition: class_zone.h:680
HATCH_STYLE m_hatchStyle
Definition: class_zone.h:745
void SetDoNotAllowCopperPour(bool aEnable)
Definition: class_zone.h:614
ZONE_FILL_MODE m_FillMode
How to fill areas: ZFM_POLYGONS => use filled polygons, ZFM_SEGMENTS => fill with segments...
Definition: class_zone.h:721
void SetLocalFlags(int aFlags)
Definition: class_zone.h:237
void SetIsKeepout(bool aEnable)
Definition: class_zone.h:613
ZONE_CONTAINER::ZONE_CONTAINER ( const ZONE_CONTAINER aZone)

Definition at line 74 of file class_zone.cpp.

References SHAPE_POLY_SET::Append(), GetLayerSet(), GetLocalFlags(), BOARD_CONNECTED_ITEM::GetNetCode(), m_ArcToSegmentsCount, m_cornerRadius, m_CornerSelection, m_cornerSmoothingType, m_doNotAllowCopperPour, m_doNotAllowTracks, m_doNotAllowVias, m_FilledPolysList, m_FillMode, m_FillSegmList, m_HatchLines, m_hatchPitch, m_hatchStyle, m_hv45, m_IsFilled, m_isKeepout, m_PadConnection, m_Poly, m_priority, m_ThermalReliefCopperBridge, m_ThermalReliefGap, m_ZoneClearance, m_ZoneMinThickness, SetLayerSet(), SetLocalFlags(), and BOARD_CONNECTED_ITEM::SetNetCode().

74  :
75  BOARD_CONNECTED_ITEM( aZone )
76 {
77  // Should the copy be on the same net?
78  SetNetCode( aZone.GetNetCode() );
79  m_Poly = new SHAPE_POLY_SET( *aZone.m_Poly );
80 
81  // For corner moving, corner index to drag, or nullptr if no selection
82  m_CornerSelection = nullptr;
83  m_IsFilled = aZone.m_IsFilled;
84  m_ZoneClearance = aZone.m_ZoneClearance; // clearance value
86  m_FillMode = aZone.m_FillMode; // Filling mode (segments/polygons)
87  m_hv45 = aZone.m_hv45;
88  m_priority = aZone.m_priority;
94  m_FillSegmList = aZone.m_FillSegmList; // vector <> copy
95 
96  m_isKeepout = aZone.m_isKeepout;
100 
103 
104  m_hatchStyle = aZone.m_hatchStyle;
105  m_hatchPitch = aZone.m_hatchPitch;
106  m_HatchLines = aZone.m_HatchLines;
107 
108  SetLayerSet( aZone.GetLayerSet() );
109  SetLocalFlags( aZone.GetLocalFlags() );
110 }
int m_ZoneClearance
Clearance value in internal units.
Definition: class_zone.h:703
bool m_doNotAllowTracks
Definition: class_zone.h:700
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:724
BOARD_CONNECTED_ITEM(BOARD_ITEM *aParent, KICAD_T idtype)
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:732
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:230
void SetLayerSet(LSET aLayerSet)
Definition: class_zone.cpp:210
int m_ArcToSegmentsCount
The number of segments to convert a circle to a polygon.
Definition: class_zone.h:708
int m_ThermalReliefCopperBridge
Definition: class_zone.h:717
std::vector< SEG > m_HatchLines
Definition: class_zone.h:747
ZoneConnection m_PadConnection
Definition: class_zone.h:702
Class SHAPE_POLY_SET.
bool m_IsFilled
True when a zone was filled, false after deleting the filled areas.
Definition: class_zone.h:711
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:678
unsigned m_priority
Definition: class_zone.h:688
bool m_doNotAllowVias
Definition: class_zone.h:699
int m_cornerSmoothingType
Definition: class_zone.h:679
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Function SetNetCode sets net using a net code.
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:742
unsigned int m_cornerRadius
Definition: class_zone.h:680
int GetNetCode() const
Function GetNetCode.
HATCH_STYLE m_hatchStyle
Definition: class_zone.h:745
bool m_doNotAllowCopperPour
Definition: class_zone.h:698
int m_ThermalReliefGap
Width of the copper bridge in thermal reliefs.
Definition: class_zone.h:714
int m_ZoneMinThickness
Minimum thickness value in filled areas.
Definition: class_zone.h:704
ZONE_FILL_MODE m_FillMode
How to fill areas: ZFM_POLYGONS => use filled polygons, ZFM_SEGMENTS => fill with segments...
Definition: class_zone.h:721
int GetLocalFlags() const
Definition: class_zone.h:236
void SetLocalFlags(int aFlags)
Definition: class_zone.h:237
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) ...
ZONE_CONTAINER::~ZONE_CONTAINER ( )

Definition at line 143 of file class_zone.cpp.

References m_CornerSelection, and m_Poly.

144 {
145  delete m_Poly;
146  delete m_CornerSelection;
147 }
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:724
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:678

Member Function Documentation

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

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

Referenced by GetCornerRadius().

1006 {
1007  if( aPolygon.empty() )
1008  return;
1009 
1010  SHAPE_LINE_CHAIN outline;
1011 
1012  // Create an outline and populate it with the points of aPolygon
1013  for( unsigned i = 0; i < aPolygon.size(); i++ )
1014  {
1015  outline.Append( VECTOR2I( aPolygon[i] ) );
1016  }
1017 
1018  outline.SetClosed( true );
1019 
1020  // Add the outline as a new polygon in the polygon set
1021  if( m_Poly->OutlineCount() == 0 )
1022  m_Poly->AddOutline( outline );
1023  else
1024  m_Poly->AddHole( outline );
1025 }
int OutlineCount() const
Returns the number of outlines in the set
VECTOR2< int > VECTOR2I
Definition: vector2d.h:587
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:678
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
Class SHAPE_LINE_CHAIN.
size_t i
Definition: json11.cpp:597
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 1028 of file class_zone.cpp.

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

Referenced by PCAD2KICAD::PCB_POLYGON::AddToBoard(), PCB_EDIT_FRAME::Begin_Zone(), BOARD::InsertArea(), EAGLE_PLUGIN::loadPlain(), EAGLE_PLUGIN::loadPolygon(), and NewHole().

1029 {
1030  // Ensure the main outline exists:
1031  if( m_Poly->OutlineCount() == 0 )
1032  m_Poly->NewOutline();
1033 
1034  // If aHoleIdx >= 0, the corner musty be added to the hole, index aHoleIdx.
1035  // (remember: the index of the first hole is 0)
1036  // Return error if if does dot exist.
1037  if( aHoleIdx >= m_Poly->HoleCount( 0 ) )
1038  return false;
1039 
1040  m_Poly->Append( aPosition.x, aPosition.y, -1, aHoleIdx, aAllowDuplication );
1041 
1042  return true;
1043 }
int HoleCount(int aOutline) const
Returns the number of holes in a given outline
int OutlineCount() const
Returns the number of outlines in the set
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:678
int NewOutline()
Creates a new empty polygon in the set and returns its index
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) ...
BOARD_ITEM* BOARD_ITEM::Back ( ) const
inlineinherited

Definition at line 117 of file class_board_item.h.

References EDA_ITEM::Pback.

Referenced by SwapItemData().

117 { return static_cast<BOARD_ITEM*>( Pback ); }
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:165
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
bool ZONE_CONTAINER::BuildSmoothedPoly ( SHAPE_POLY_SET aSmoothedPoly) const

Function GetSmoothedPoly returns a pointer to the corner-smoothed version of m_Poly if it exists, otherwise it returns m_Poly.

Returns
SHAPE_POLY_SET* - pointer to the polygon.

Definition at line 1287 of file class_zone.cpp.

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

Referenced by ZONE_FILLER::fillSingleZone(), SetRawPolysList(), PNS_KICAD_IFACE::syncZone(), DRC::TestZoneToZoneOutline(), and TransformOutlinesShapeWithClearanceToPolygon().

1288 {
1289  if( GetNumCorners() <= 2 ) // malformed zone. polygon calculations do not like it ...
1290  return false;
1291 
1292  // Make a smoothed polygon out of the user-drawn polygon if required
1293  switch( m_cornerSmoothingType )
1294  {
1296  aSmoothedPoly = m_Poly->Chamfer( m_cornerRadius );
1297  break;
1298 
1300  // Note: we're now using m_ArcToSegmentsCount only as a hint to determine accuracy
1301  // vs. speed.
1303  aSmoothedPoly = m_Poly->Fillet( m_cornerRadius, ARC_HIGH_DEF );
1304  else
1305  aSmoothedPoly = m_Poly->Fillet( m_cornerRadius, ARC_LOW_DEF );
1306  break;
1307 
1308  default:
1309  // Acute angles between adjacent edges can create issues in calculations,
1310  // in inflate/deflate outlines transforms, especially when the angle is very small.
1311  // We can avoid issues by creating a very small chamfer which remove acute angles,
1312  // or left it without chamfer and use only CPOLYGONS_LIST::InflateOutline to create
1313  // clearance areas
1314  aSmoothedPoly = m_Poly->Chamfer( Millimeter2iu( 0.0 ) );
1315  break;
1316  }
1317 
1318  return true;
1319 };
int GetNumCorners(void) const
Access to m_Poly parameters.
Definition: class_zone.h:420
#define SEGMENT_COUNT_CROSSOVER
Definition: pcbnew.h:46
SHAPE_POLY_SET Fillet(int aRadius, int aErrorMax)
Function Fillet returns a filleted version of the polygon set.
int m_ArcToSegmentsCount
The number of segments to convert a circle to a polygon.
Definition: class_zone.h:708
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:678
int m_cornerSmoothingType
Definition: class_zone.h:679
unsigned int m_cornerRadius
Definition: class_zone.h:680
SHAPE_POLY_SET Chamfer(int aDistance)
Function Chamfer returns a chamfered version of the polygon set.
void ZONE_CONTAINER::CacheTriangulation ( )

Definition at line 1281 of file class_zone.cpp.

References SHAPE_POLY_SET::CacheTriangulation(), and m_FilledPolysList.

Referenced by GetFilledPolysList().

1282 {
1284 }
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:742
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 450 of file class_zone.h.

References SHAPE_POLY_SET::CIterateWithHoles(), and m_Poly.

451  {
452  return m_Poly->CIterateWithHoles();
453  }
CONST_ITERATOR CIterateWithHoles(int aOutline) const
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:678
static bool ZONE_CONTAINER::ClassOf ( const EDA_ITEM aItem)
inlinestatic

Definition at line 76 of file class_zone.h.

References GetPosition(), PCB_SEGZONE_T, PCB_ZONE_AREA_T, and EDA_ITEM::Type().

77  {
78  return aItem && ( ( PCB_ZONE_AREA_T == aItem->Type() ) ||
79  ( PCB_SEGZONE_T == aItem->Type() ) );
80  }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:102
class SEGZONE, a segment used to fill a zone area (segment on a
Definition: typeinfo.h:97
void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 233 of file base_struct.h.

References BRIGHTENED, EDA_ITEM::ClearFlags(), and EDA_ITEM::SetModified().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), and SELECTION_TOOL::unhighlight().

233 { ClearFlags( BRIGHTENED ); }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:135
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:254
void ZONE_CONTAINER::ClearFilledPolysList ( )
inline

Function ClearFilledPolysList clears the list of filled polygons.

Definition at line 527 of file class_zone.h.

References m_FilledPolysList, and SHAPE_POLY_SET::RemoveAllContours().

Referenced by POINT_EDITOR::updateItem().

528  {
530  }
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:742
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.
void EDA_ITEM::ClearFlags ( STATUS_FLAGS  aMask = EDA_ITEM_ALL_FLAGS)
inlineinherited

Definition at line 254 of file base_struct.h.

Referenced by Abort_Edit_Pcb_Text(), Abort_EditEdge(), Abort_Move_ModuleOutline(), Abort_Move_Pad(), Abort_MoveOrCopyModule(), Abort_MoveTrack(), Abort_Zone_Create_Outline(), Abort_Zone_Move_Corner_Or_Outlines(), AbortMoveAndEditTarget(), AbortMoveDimensionText(), abortMoveItem(), AbortMoveTextModule(), AbortPinMove(), SCH_SCREEN::addConnectedItemsToBlock(), SCH_EDIT_FRAME::addCurrentItemToScreen(), PNS_KICAD_IFACE::AddItem(), PCB_EDIT_FRAME::AppendBoardFile(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Zone(), SCH_EDIT_FRAME::BeginSegment(), PCB_EDIT_FRAME::Block_Delete(), PCB_EDIT_FRAME::Block_Flip(), PCB_EDIT_FRAME::Block_Move(), LIB_EDIT_FRAME::BlockCopySelectedItems(), PCB_EDIT_FRAME::Change_Side_Module(), SCH_SCREEN::ClearAnnotation(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearHighlighted(), DRAG_LIST::ClearList(), ClearMarkItems(), clearModuleItemFlags(), EDA_ITEM::ClearSelected(), SCH_EDIT_FRAME::ConvertPart(), SCH_EDIT_FRAME::copyBlockItems(), CopyMarkedItems(), MWAVE::CreateMicrowaveInductor(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), PCB_EDIT_FRAME::Delete_LastCreatedCorner(), PCB_EDIT_FRAME::Delete_Segment_Edge(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), PCB_EDIT_FRAME::EditDimension(), PCB_EDIT_FRAME::End_Edge(), FOOTPRINT_EDIT_FRAME::End_Edge_Module(), PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines(), PCB_EDIT_FRAME::End_Route(), PCB_EDIT_FRAME::End_Zone(), EraseDragList(), PCB_EDIT_FRAME::Exchange_Module(), ExitSheet(), SCH_SCREEN::GetConnection(), PCB_BASE_FRAME::Import_Pad_Settings(), SCH_JUNCTION::IsSelectStateChanged(), SCH_NO_CONNECT::IsSelectStateChanged(), SCH_MARKER::IsSelectStateChanged(), SCH_BUS_ENTRY_BASE::IsSelectStateChanged(), SCH_BITMAP::IsSelectStateChanged(), SCH_LINE::IsSelectStateChanged(), SCH_TEXT::IsSelectStateChanged(), SCH_SHEET::IsSelectStateChanged(), SCH_COMPONENT::IsSelectStateChanged(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), FOOTPRINT_EDIT_FRAME::LoadModuleFromLibrary(), MarkItemsInBloc(), MirrorX(), MirrorY(), LIB_EDIT_FRAME::OnEditPin(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnOrient(), LIB_EDIT_FRAME::OnRotate(), SCH_EDIT_FRAME::OnSelectUnit(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), SCH_FIELD::Place(), PCB_EDIT_FRAME::Place_DrawItem(), FOOTPRINT_EDIT_FRAME::Place_EdgeMod(), PCB_EDIT_FRAME::Place_Texte_Pcb(), PCB_EDIT_FRAME::PlaceDimensionText(), PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment(), PCB_BASE_FRAME::PlaceModule(), PCB_BASE_FRAME::PlacePad(), PCB_EDIT_FRAME::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCB_BASE_FRAME::PlaceTexteModule(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), LIB_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), BOARD_COMMIT::Revert(), PCB_BASE_FRAME::Rotate_Module(), RotateListOfItems(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_LEGACY_PLUGIN_CACHE::savePin(), SCH_EDIT_FRAME::SetRepeatItem(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::StartMoveModule(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), and DIALOG_PAD_PROPERTIES::TransferDataFromWindow().

254 { m_Flags &= ~aMask; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
void EDA_ITEM::ClearHighlighted ( )
inlineinherited

Definition at line 232 of file base_struct.h.

References EDA_ITEM::ClearFlags(), and HIGHLIGHTED.

232 { ClearFlags( HIGHLIGHTED ); }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:134
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:254
void EDA_ITEM::ClearSelected ( )
inlineinherited

Definition at line 231 of file base_struct.h.

References EDA_ITEM::ClearFlags(), and SELECTED.

Referenced by POINT_EDITOR::addCorner(), EDIT_TOOL::Duplicate(), GAL_ARRAY_CREATOR::prePushAction(), SELECTION_TOOL::unhighlight(), and GERBVIEW_SELECTION_TOOL::unselectVisually().

231 { ClearFlags( SELECTED ); }
#define SELECTED
Definition: base_struct.h:118
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:254
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.

Definition at line 150 of file class_zone.cpp.

References ZONE_CONTAINER().

Referenced by RawPolysList().

151 {
152  return new ZONE_CONTAINER( *this );
153 }
ZONE_CONTAINER(BOARD *parent)
Definition: class_zone.cpp:52
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 194 of file class_zone.cpp.

References GetLayerSet().

Referenced by ZONE_FILLER::buildZoneFeatureHoleList(), DRC::doTrackKeepoutDrc(), GetPriority(), and DRC::testKeepoutAreas().

195 {
196  LSET common = GetLayerSet() & aLayerSet;
197 
198  return common.count() > 0;
199 }
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:230
Class LSET is a set of PCB_LAYER_IDs.
void ZONE_CONTAINER::Draw ( EDA_DRAW_PANEL panel,
wxDC *  DC,
GR_DRAWMODE  aDrawMode,
const wxPoint offset = ZeroOffset 
)
overridevirtual

Function Draw Draws the zone outline.

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

Implements BOARD_ITEM.

Definition at line 276 of file class_zone.cpp.

References SEG::A, SEG::B, color, DARKDARKGRAY, BOARD_ITEM::GetBoard(), EDA_DRAW_PANEL::GetClipBox(), EDA_DRAW_PANEL::GetDisplayOptions(), GetIsKeepout(), GetLayer(), GetLayerSet(), GetNumCorners(), EDA_DRAW_PANEL::GetParent(), EDA_DRAW_PANEL::GetScreen(), BOARD::GetVisibleLayers(), GR_AND, GR_HIGHLIGHT, GRLineArray(), GRSetDrawMode(), BOARD::IsLayerVisible(), IsOnLayer(), SHAPE_POLY_SET::IterateSegmentsWithHoles(), m_HatchLines, m_Poly, LSET::Seq(), and UNDEFINED_LAYER.

Referenced by BOARD::Draw(), BOARD::DrawHighLight(), PCB_EDIT_FRAME::Edit_Zone_Params(), PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines(), GetPriority(), PCB_EDIT_FRAME::Process_Special_Functions(), BOARD::RedrawAreasOutlines(), and Show_Zone_Corner_Or_Outline_While_Move_Mouse().

278 {
279  if( !DC )
280  return;
281 
282  wxPoint seg_start, seg_end;
283  PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
284  BOARD* brd = GetBoard();
285 
286  auto frame = static_cast<PCB_BASE_FRAME*> ( panel->GetParent() );
287 
288  PCB_LAYER_ID draw_layer = UNDEFINED_LAYER;
289 
290  LSET layers = GetLayerSet() & brd->GetVisibleLayers();
291 
292  // If there are no visible layers and the zone is not highlighted, return
293  if( layers.count() == 0 && !( aDrawMode & GR_HIGHLIGHT ) )
294  {
295  return;
296  }
297 
298  /* Keepout zones can exist on multiple layers
299  * Thus, determining which color to use to render them is a bit tricky.
300  * In descending order of priority:
301  *
302  * 1. If in GR_HIGHLIGHT mode:
303  * a. If zone is on selected layer, use layer color!
304  * b. Else, use grey
305  * 1. Not in GR_HIGHLIGHT mode
306  * a. If zone is on selected layer, use layer color
307  * b. Else, use color of top-most (visible) layer
308  *
309  */
310  if( GetIsKeepout() )
311  {
312  // At least one layer must be provided!
313  assert( GetLayerSet().count() > 0 );
314 
315  // Not on any visible layer?
316  if( layers.count() == 0 && !( aDrawMode & GR_HIGHLIGHT ) )
317  {
318  return;
319  }
320 
321  // Is keepout zone present on the selected layer?
322  if( layers.test( curr_layer ) )
323  {
324  draw_layer = curr_layer;
325  }
326  else
327  {
328  // Select the first (top) visible layer
329  if( layers.count() > 0 )
330  {
331  draw_layer = layers.Seq()[0];
332  }
333  else
334  {
335  draw_layer = GetLayerSet().Seq()[0];
336  }
337  }
338 
339  }
340  /* Non-keepout zones are easier to deal with
341  */
342  else
343  {
344  if( brd->IsLayerVisible( GetLayer() ) == false && !( aDrawMode & GR_HIGHLIGHT ) )
345  {
346  return;
347  }
348 
349  draw_layer = GetLayer();
350  }
351 
352  assert( draw_layer != UNDEFINED_LAYER );
353 
354  auto color = frame->Settings().Colors().GetLayerColor( draw_layer );
355 
356  GRSetDrawMode( DC, aDrawMode );
357  auto displ_opts = (PCB_DISPLAY_OPTIONS*)( panel->GetDisplayOptions() );
358 
359  if( displ_opts->m_ContrastModeDisplay )
360  {
361  if( !IsOnLayer( curr_layer ) )
362  {
364  }
365  }
366 
367  if( ( aDrawMode & GR_HIGHLIGHT ) && !( aDrawMode & GR_AND ) )
368  {
369  color.SetToLegacyHighlightColor();
370  }
371 
372  color.a = 0.588;
373 
374  // draw the lines
375  std::vector<wxPoint> lines;
376  lines.reserve( (GetNumCorners() * 2) + 2 );
377 
378  // Iterate through the segments of the outline
379  for( auto iterator = m_Poly->IterateSegmentsWithHoles(); iterator; iterator++ )
380  {
381  // Create the segment
382  SEG segment = *iterator;
383 
384  lines.push_back( static_cast<wxPoint>( segment.A ) + offset );
385  lines.push_back( static_cast<wxPoint>( segment.B ) + offset );
386  }
387 
388  GRLineArray( panel->GetClipBox(), DC, lines, 0, color );
389 
390  // draw hatches
391  lines.clear();
392  lines.reserve( (m_HatchLines.size() * 2) + 2 );
393 
394  for( unsigned ic = 0; ic < m_HatchLines.size(); ic++ )
395  {
396  seg_start = static_cast<wxPoint>( m_HatchLines[ic].A ) + offset;
397  seg_end = static_cast<wxPoint>( m_HatchLines[ic].B ) + offset;
398  lines.push_back( seg_start );
399  lines.push_back( seg_end );
400  }
401 
402  GRLineArray( panel->GetClipBox(), DC, lines, 0, color );
403 }
virtual BASE_SCREEN * GetScreen()=0
int GetNumCorners(void) const
Access to m_Poly parameters.
Definition: class_zone.h:420
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:223
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:265
int color
Definition: DXF_plotter.cpp:62
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:175
virtual EDA_RECT * GetClipBox()
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:608
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:364
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:230
virtual EDA_DRAW_FRAME * GetParent() const =0
Class PCB_DISPLAY_OPTIONS handles display options like enable/disable some optional drawings...
PCB_LAYER_ID
A quick note on layer IDs:
Class LSET is a set of PCB_LAYER_IDs.
std::vector< SEG > m_HatchLines
Definition: class_zone.h:747
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:678
Definition: seg.h:36
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
LSET GetVisibleLayers() const
Function GetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
VECTOR2I A
Definition: seg.h:46
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:361
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
virtual void * GetDisplayOptions()
Function GetDisplayOptions A way to pass info to draw functions.
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...
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:457
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
VECTOR2I B
Definition: seg.h:47
void ZONE_CONTAINER::DrawFilledArea ( EDA_DRAW_PANEL panel,
wxDC *  DC,
GR_DRAWMODE  aDrawMode,
const wxPoint offset = ZeroOffset 
)

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

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

Definition at line 406 of file class_zone.cpp.

References color, SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoint(), DARKDARKGRAY, FORCE_SKETCH, BOARD_ITEM::GetBoard(), EDA_DRAW_PANEL::GetClipBox(), EDA_DRAW_PANEL::GetDisplayOptions(), GetLayer(), EDA_DRAW_PANEL::GetParent(), EDA_DRAW_PANEL::GetScreen(), EDA_ITEM::GetState(), GR_AND, GR_HIGHLIGHT, GRCSegm(), GRFillCSegm(), GRPoly(), GRSetDrawMode(), SHAPE_POLY_SET::IsEmpty(), BOARD::IsLayerVisible(), IsOnLayer(), m_FilledPolysList, m_FillMode, m_FillSegmList, m_ZoneMinThickness, SHAPE_POLY_SET::OutlineCount(), SHAPE_LINE_CHAIN::PointCount(), wxPoint::x, VECTOR2< T >::x, wxPoint::y, VECTOR2< T >::y, and ZFM_POLYGONS.

Referenced by BOARD::Draw(), GetPriority(), PCB_EDIT_FRAME::PrintPage(), BOARD::RedrawFilledAreas(), and PCB_EDIT_FRAME::Remove_Zone_Corner().

408 {
409 
410  static std::vector <wxPoint> CornersBuffer;
411  auto displ_opts = (PCB_DISPLAY_OPTIONS*)( panel->GetDisplayOptions() );
412 
413  // outline_mode is false to show filled polys,
414  // and true to show polygons outlines only (test and debug purposes)
415  bool outline_mode = displ_opts->m_DisplayZonesMode == 2 ? true : false;
416 
417  if( DC == NULL )
418  return;
419 
420  if( displ_opts->m_DisplayZonesMode == 1 ) // Do not show filled areas
421  return;
422 
423  if( m_FilledPolysList.IsEmpty() ) // Nothing to draw
424  return;
425 
426  BOARD* brd = GetBoard();
427  PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
428 
429  auto frame = static_cast<PCB_BASE_FRAME*> ( panel->GetParent() );
430  auto color = frame->Settings().Colors().GetLayerColor( GetLayer() );
431 
432  if( brd->IsLayerVisible( GetLayer() ) == false && !( aDrawMode & GR_HIGHLIGHT ) )
433  return;
434 
435  GRSetDrawMode( DC, aDrawMode );
436 
437  if( displ_opts->m_ContrastModeDisplay )
438  {
439  if( !IsOnLayer( curr_layer ) )
441  }
442 
443  if( ( aDrawMode & GR_HIGHLIGHT ) && !( aDrawMode & GR_AND ) )
444  color.SetToLegacyHighlightColor();
445 
446  color.a = 0.588;
447 
448 
449  for ( int ic = 0; ic < m_FilledPolysList.OutlineCount(); ic++ )
450  {
451  const SHAPE_LINE_CHAIN& path = m_FilledPolysList.COutline( ic );
452 
453  CornersBuffer.clear();
454 
455  wxPoint p0;
456 
457  for( int j = 0; j < path.PointCount(); j++ )
458  {
459  const VECTOR2I& corner = path.CPoint( j );
460 
461  wxPoint coord( corner.x + offset.x, corner.y + offset.y );
462 
463  if( j == 0 )
464  p0 = coord;
465 
466  CornersBuffer.push_back( coord );
467  }
468 
469  CornersBuffer.push_back( p0 );
470 
471  // Draw outlines:
472  if( ( m_ZoneMinThickness > 1 ) || outline_mode )
473  {
474  int ilim = CornersBuffer.size() - 1;
475 
476  for( int is = 0, ie = ilim; is <= ilim; ie = is, is++ )
477  {
478  int x0 = CornersBuffer[is].x;
479  int y0 = CornersBuffer[is].y;
480  int x1 = CornersBuffer[ie].x;
481  int y1 = CornersBuffer[ie].y;
482 
483  // Draw only basic outlines, not extra segments.
484  if( !displ_opts->m_DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
485  GRCSegm( panel->GetClipBox(), DC,
486  x0, y0, x1, y1,
488  else
489  GRFillCSegm( panel->GetClipBox(), DC,
490  x0, y0, x1, y1, m_ZoneMinThickness, color );
491  }
492  }
493 
494  // Draw areas:
495  if( m_FillMode == ZFM_POLYGONS && !outline_mode )
496  GRPoly( panel->GetClipBox(), DC, CornersBuffer.size(), &CornersBuffer[0],
497  true, 0, color, color );
498  }
499 
500  if( m_FillMode == 1 && !outline_mode ) // filled with segments
501  {
502  for( unsigned ic = 0; ic < m_FillSegmList.size(); ic++ )
503  {
504  wxPoint start = (wxPoint) ( m_FillSegmList[ic].A + VECTOR2I(offset) );
505  wxPoint end = (wxPoint) ( m_FillSegmList[ic].B + VECTOR2I(offset) );
506 
507  if( !displ_opts->m_DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
508  GRCSegm( panel->GetClipBox(), DC, start.x, start.y, end.x, end.y,
510  else
511  GRFillCSegm( panel->GetClipBox(), DC, start.x, start.y, end.x, end.y,
513  }
514  }
515 }
virtual BASE_SCREEN * GetScreen()=0
void GRPoly(EDA_RECT *ClipBox, wxDC *DC, int n, wxPoint Points[], bool Fill, int width, COLOR4D Color, COLOR4D BgColor)
Definition: gr_basic.cpp:701
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:223
int PointCount() const
Function PointCount()
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:265
int color
Definition: DXF_plotter.cpp:62
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:175
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:415
virtual EDA_RECT * GetClipBox()
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:732
int OutlineCount() const
Returns the number of outlines in the set
int GetState(int type) const
Definition: base_struct.h:237
VECTOR2< int > VECTOR2I
Definition: vector2d.h:587
virtual EDA_DRAW_FRAME * GetParent() const =0
Class PCB_DISPLAY_OPTIONS handles display options like enable/disable some optional drawings...
PCB_LAYER_ID
A quick note on layer IDs:
void GRFillCSegm(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color)
Definition: gr_basic.cpp:518
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:742
int m_ZoneMinThickness
Minimum thickness value in filled areas.
Definition: class_zone.h:704
ZONE_FILL_MODE m_FillMode
How to fill areas: ZFM_POLYGONS => use filled polygons, ZFM_SEGMENTS => fill with segments...
Definition: class_zone.h:721
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
Class SHAPE_LINE_CHAIN.
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
bool IsEmpty() const
Returns true if the set is empty (no polygons at all)
virtual void * GetDisplayOptions()
Function GetDisplayOptions A way to pass info to draw functions.
#define FORCE_SKETCH
Definition: pcbnew.h:73
const VECTOR2I & CPoint(int aIndex) const
Function CPoint()
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...
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:457
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void ZONE_CONTAINER::DrawWhileCreateOutline ( EDA_DRAW_PANEL panel,
wxDC *  DC,
GR_DRAWMODE  draw_mode = GR_OR 
)

Function DrawWhileCreateOutline Draws the zone outline when it is created.

The moving edges are in XOR graphic mode, old segment in draw_mode graphic mode (usually GR_OR). The closing edge has its own shape.

Parameters
panel= current Draw Panel
DC= current Device Context
draw_mode= draw mode: OR, XOR ..

Definition at line 545 of file class_zone.cpp.

References color, DARKDARKGRAY, EDA_DRAW_PANEL::GetClipBox(), EDA_DRAW_PANEL::GetDisplayOptions(), GetLayer(), EDA_DRAW_PANEL::GetParent(), EDA_DRAW_PANEL::GetScreen(), GR_XOR, GRLine(), GRSetDrawMode(), SHAPE_POLY_SET::ITERATOR_TEMPLATE< T >::IsEndContour(), IsOnLayer(), SHAPE_POLY_SET::Iterate(), m_Poly, WHITE, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Abort_Zone_Create_Outline(), PCB_EDIT_FRAME::Delete_LastCreatedCorner(), PCB_EDIT_FRAME::End_Zone(), GetPriority(), and Show_New_Edge_While_Move_Mouse().

547 {
548  GR_DRAWMODE current_gr_mode = draw_mode;
549  bool is_close_segment = false;
550 
551  if( !DC )
552  return;
553 
554  PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
555 
556  auto frame = static_cast<PCB_BASE_FRAME*> ( panel->GetParent() );
557  auto color = frame->Settings().Colors().GetLayerColor( GetLayer() );
558 
559  auto displ_opts = (PCB_DISPLAY_OPTIONS*)( panel->GetDisplayOptions() );
560 
561  if( displ_opts->m_ContrastModeDisplay )
562  {
563  if( !IsOnLayer( curr_layer ) )
565  }
566 
567  // Object to iterate through the corners of the outlines
569 
570  // Segment start and end
571  VECTOR2I seg_start, seg_end;
572 
573  // Remember the first point of this contour
574  VECTOR2I contour_first_point = *iterator;
575 
576  // Iterate through all the corners of the outlines and build the segments to draw
577  while( iterator )
578  {
579  // Get the first point of the current segment
580  seg_start = *iterator;
581 
582  // Get the last point of the current segment, handling the case where the end of the
583  // contour is reached, when the last point of the segment is the first point of the
584  // contour
585  if( !iterator.IsEndContour() )
586  {
587  // Set GR mode to default
588  current_gr_mode = draw_mode;
589 
590  SHAPE_POLY_SET::ITERATOR iterator_copy = iterator;
591  iterator_copy++;
592  if( iterator_copy.IsEndContour() )
593  current_gr_mode = GR_XOR;
594 
595  is_close_segment = false;
596 
597  iterator++;
598  seg_end = *iterator;
599  }
600  else
601  {
602  is_close_segment = true;
603 
604  seg_end = contour_first_point;
605 
606  // Reassign first point of the contour to the next contour start
607  iterator++;
608 
609  if( iterator )
610  contour_first_point = *iterator;
611 
612  // Set GR mode to XOR
613  current_gr_mode = GR_XOR;
614  }
615 
616  GRSetDrawMode( DC, current_gr_mode );
617 
618  if( is_close_segment )
619  GRLine( panel->GetClipBox(), DC, seg_start.x, seg_start.y, seg_end.x, seg_end.y, 0,
620  WHITE );
621  else
622  GRLine( panel->GetClipBox(), DC, seg_start.x, seg_start.y, seg_end.x, seg_end.y, 0,
623  color );
624  }
625 }
virtual BASE_SCREEN * GetScreen()=0
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:223
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:265
int color
Definition: DXF_plotter.cpp:62
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:175
virtual EDA_RECT * GetClipBox()
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...
bool IsEndContour() const
Function IsEndContour.
virtual EDA_DRAW_FRAME * GetParent() const =0
Class PCB_DISPLAY_OPTIONS handles display options like enable/disable some optional drawings...
PCB_LAYER_ID
A quick note on layer IDs:
GR_DRAWMODE
Drawmode. Compositing mode plus a flag or two.
Definition: gr_basic.h:37
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:678
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:285
Class ITERATOR_TEMPLATE.
Definition: colors.h:49
virtual void * GetDisplayOptions()
Function GetDisplayOptions A way to pass info to draw functions.
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
ZONE_SEGMENT_FILL& ZONE_CONTAINER::FillSegments ( )
inline

Definition at line 239 of file class_zone.h.

References m_FillSegmList.

Referenced by PCB_IO::format(), and BRDITEMS_PLOTTER::PlotFilledAreas().

239 { 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:732
const ZONE_SEGMENT_FILL& ZONE_CONTAINER::FillSegments ( ) const
inline

Definition at line 240 of file class_zone.h.

References m_FillSegmList.

240 { 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:732
void BOARD_ITEM::Flip ( const VECTOR2I aCentre)
inlineinherited

Definition at line 271 of file class_board_item.h.

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

272  {
273  Flip( wxPoint( aCentre.x, aCentre.y ) );
274  }
virtual void Flip(const wxPoint &aCentre)
Function Flip Flip this object, i.e.
void ZONE_CONTAINER::Flip ( const wxPoint aCentre)
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 956 of file class_zone.cpp.

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

Referenced by HitTestInsideZone().

957 {
958  Mirror( aCentre );
959  int copperLayerCount = GetBoard()->GetCopperLayerCount();
960 
961  if( GetIsKeepout() )
962  {
963  SetLayerSet( FlipLayerMask( GetLayerSet(), copperLayerCount ) );
964  }
965  else
966  {
967  SetLayer( FlipLayer( GetLayer(), copperLayerCount ) );
968  }
969 }
LSET FlipLayerMask(LSET aMask, int aCopperLayersCount)
Calculate the mask layer when flipping a footprint BACK and FRONT copper layers, mask, paste, solder layers are swapped internal layers are flipped only if the copper layers count is known.
Definition: lset.cpp:518
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Function FlippedLayerNumber.
Definition: lset.cpp:472
int GetCopperLayerCount() const
Function GetCopperLayerCount.
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:175
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:608
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:230
void SetLayerSet(LSET aLayerSet)
Definition: class_zone.cpp:210
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Function SetLayer sets the layer this item is on.
Definition: class_zone.cpp:202
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
void Mirror(const wxPoint &mirror_ref)
Function Mirror Mirror the outlines , relative to a given horizontal axis the layer is not changed...
Definition: class_zone.cpp:972
std::string BOARD_ITEM::FormatAngle ( double  aAngle)
staticinherited

Function FormatAngle converts aAngle from board units to a string appropriate for writing to file.

Note
Internal angles for board items can be either degrees or tenths of degree on how KiCad is built.
Parameters
aAngleA angle value to convert.
Returns
A std::string object containing the converted angle.

Definition at line 171 of file class_board_item.cpp.

Referenced by BOARD_ITEM::HitTest().

172 {
173  char temp[50];
174 
175  int len = snprintf( temp, sizeof(temp), "%.10g", aAngle / 10.0 );
176 
177  return std::string( temp, len );
178 }
std::string BOARD_ITEM::FormatInternalUnits ( int  aValue)
staticinherited

Function FormatInternalUnits converts aValue from board internal units to a string appropriate for writing to file.

Note
Internal units for board items can be either deci-mils or nanometers depending on how KiCad is build.
Parameters
aValueA coordinate value to convert.
Returns
A std::string object containing the converted value.

Definition at line 90 of file class_board_item.cpp.

Referenced by checkConnectedTo(), BOARD_ITEM::FormatInternalUnits(), BOARD_ITEM::HitTest(), and BOARD::TracksInNetBetweenPoints().

91 {
92 #if 1
93 
94  char buf[50];
95  int len;
96  double mm = aValue / IU_PER_MM;
97 
98  if( mm != 0.0 && fabs( mm ) <= 0.0001 )
99  {
100  len = sprintf( buf, "%.10f", mm );
101 
102  while( --len > 0 && buf[len] == '0' )
103  buf[len] = '\0';
104 
105  if( buf[len] == '.' )
106  buf[len] = '\0';
107  else
108  ++len;
109  }
110  else
111  {
112  len = sprintf( buf, "%.10g", mm );
113  }
114 
115  return std::string( buf, len );
116 
117 #else
118 
119  // Assume aValue is in nanometers, and that we want the result in millimeters,
120  // and that int is 32 bits wide. Then perform an alternative algorithm.
121  // Can be used to verify that the above algorithm is correctly generating text.
122  // Convert aValue into an integer string, then insert a decimal point manually.
123  // Results are the same as above general purpose algorithm.
124 
125  wxASSERT( sizeof(int) == 4 );
126 
127  if( aValue == 0 )
128  return std::string( 1, '0' );
129  else
130  {
131  char buf[50];
132  int len = sprintf( buf, aValue > 0 ? "%06d" : "%07d", aValue ); // optionally pad w/leading zeros
133 
134  std::string ret( buf, len );
135 
136  std::string::iterator it = ret.end() - 1; // last byte
137 
138  // insert '.' at 6 positions from end, dividing by 10e6 (a million), nm => mm
139  std::string::iterator decpoint = ret.end() - 6;
140 
141  // truncate trailing zeros, up to decimal point position
142  for( ; *it=='0' && it >= decpoint; --it )
143  ret.erase( it ); // does not invalidate iterators it or decpoint
144 
145  if( it >= decpoint )
146  {
147  ret.insert( decpoint, '.' );
148 
149  // decpoint is invalidated here, after insert()
150 
151 #if 1 // want a leading zero when decimal point is in first position?
152  if( ret[0] == '.' )
153  {
154  // insert leading zero ahead of decimal point.
155  ret.insert( ret.begin(), '0' );
156  }
157  else if( ret[0]=='-' && ret[1]=='.' )
158  {
159  ret.insert( ret.begin() + 1, '0' );
160  }
161 #endif
162  }
163 
164  return ret;
165  }
166 
167 #endif
168 }
std::string BOARD_ITEM::FormatInternalUnits ( const wxPoint aPoint)
staticinherited

Definition at line 181 of file class_board_item.cpp.

References BOARD_ITEM::FormatInternalUnits(), wxPoint::x, and wxPoint::y.

182 {
183  return FormatInternalUnits( aPoint.x ) + " " + FormatInternalUnits( aPoint.y );
184 }
static std::string FormatInternalUnits(int aValue)
Function FormatInternalUnits converts aValue from board internal units to a string appropriate for wr...
std::string BOARD_ITEM::FormatInternalUnits ( const VECTOR2I aPoint)
staticinherited

Definition at line 187 of file class_board_item.cpp.

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

188 {
189  return FormatInternalUnits( aPoint.x ) + " " + FormatInternalUnits( aPoint.y );
190 }
static std::string FormatInternalUnits(int aValue)
Function FormatInternalUnits converts aValue from board internal units to a string appropriate for wr...
std::string BOARD_ITEM::FormatInternalUnits ( const wxSize &  aSize)
staticinherited

Definition at line 193 of file class_board_item.cpp.

References BOARD_ITEM::FormatInternalUnits().

194 {
195  return FormatInternalUnits( aSize.GetWidth() ) + " " + FormatInternalUnits( aSize.GetHeight() );
196 }
static std::string FormatInternalUnits(int aValue)
Function FormatInternalUnits converts aValue from board internal units to a string appropriate for wr...
int ZONE_CONTAINER::GetArcSegmentCount ( ) const
inline

Definition at line 193 of file class_zone.h.

References m_ArcToSegmentsCount.

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

193 { return m_ArcToSegmentsCount; }
int m_ArcToSegmentsCount
The number of segments to convert a circle to a polygon.
Definition: class_zone.h:708
BOARD * BOARD_ITEM::GetBoard ( ) const
virtualinherited

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

Definition at line 64 of file class_board_item.cpp.

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

Referenced by DIALOG_GEN_FOOTPRINT_POSITION::CreateFiles(), DeleteMarkedItems(), TEXTE_PCB::Draw(), PCB_TARGET::Draw(), EDGE_MODULE::Draw(), Draw(), TEXTE_MODULE::Draw(), TRACK::Draw(), DIMENSION::Draw(), DRAWSEGMENT::Draw(), MODULE::Draw(), SEGZONE::Draw(), VIA::Draw(), MODULE::DrawAncre(), DrawFilledArea(), BOARD_PRINTOUT_CONTROLLER::DrawPage(), TEXTE_PCB::Flip(), TRACK::Flip(), BOARD_ITEM::Flip(), Flip(), VIA::Flip(), BOARD_ITEM::GetBoard(), GAL_ARRAY_CREATOR::getBoard(), LEGACY_ARRAY_CREATOR::getBoard(), MODULE::GetBoundingPoly(), BOARD_ITEM::GetLayerName(), TRACK::GetMsgPanelInfo(), NETINFO_ITEM::GetMsgPanelInfo(), D_PAD::GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase(), SEGZONE::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(), PushTrack(), BOARD_CONNECTED_ITEM::SetNet(), BOARD_CONNECTED_ITEM::SetNetCode(), MODULE::ViewBBox(), VIA::ViewGetLOD(), and D_PAD::ViewGetLOD().

65 {
66  if( Type() == PCB_T )
67  return (BOARD*) this;
68 
69  BOARD_ITEM* parent = GetParent();
70 
71  if( parent )
72  return parent->GetBoard();
73 
74  return NULL;
75 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
BOARD_ITEM_CONTAINER * GetParent() const
Definition: typeinfo.h:85
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
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 518 of file class_zone.cpp.

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

Referenced by ZONE_FILLER::buildZoneFeatureHoleList(), PCB_EDIT_FRAME::Delete_Zone_Contour(), GetPriority(), HitTest(), and PCB_EDIT_FRAME::Remove_Zone_Corner().

519 {
520  const int PRELOAD = 0x7FFFFFFF; // Biggest integer (32 bits)
521 
522  int ymax = -PRELOAD;
523  int ymin = PRELOAD;
524  int xmin = PRELOAD;
525  int xmax = -PRELOAD;
526 
527  int count = GetNumCorners();
528 
529  for( int i = 0; i<count; ++i )
530  {
531  wxPoint corner = static_cast<wxPoint>( GetCornerPosition( i ) );
532 
533  ymax = std::max( ymax, corner.y );
534  xmax = std::max( xmax, corner.x );
535  ymin = std::min( ymin, corner.y );
536  xmin = std::min( xmin, corner.x );
537  }
538 
539  EDA_RECT ret( wxPoint( xmin, ymin ), wxSize( xmax - xmin + 1, ymax - ymin + 1 ) );
540 
541  return ret;
542 }
int GetNumCorners(void) const
Access to m_Poly parameters.
Definition: class_zone.h:420
const VECTOR2I & GetCornerPosition(int aCornerIndex) const
Definition: class_zone.h:460
#define max(a, b)
Definition: auxiliary.h:86
size_t i
Definition: json11.cpp:597
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
#define min(a, b)
Definition: auxiliary.h:85
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 97 of file class_board_item.h.

References BOARD_ITEM::GetPosition(), and BOARD_ITEM::SetPosition().

Referenced by BOARD::chainMarkedSegments(), and DIALOG_CREATE_ARRAY::ARRAY_CIRCULAR_OPTIONS::TransformItem().

97 { return GetPosition(); }
virtual const wxPoint GetPosition() const =0
wxString ZONE_CONTAINER::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Implements EDA_ITEM.

Definition at line 411 of file class_zone.h.

412  {
413  return wxT( "ZONE_CONTAINER" );
414  }
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 779 of file class_zone.cpp.

References BOARD_CONNECTED_ITEM::GetClearance(), BOARD_CONNECTED_ITEM::GetNetClass(), m_ZoneClearance, and max.

Referenced by GERBER_JOBFILE_WRITER::addJSONDesignRules(), ZONE_FILLER::buildZoneFeatureHoleList(), GetPriority(), BOARD::TestAreaIntersections(), DRC::TestZoneToZoneOutline(), and TransformOutlinesShapeWithClearanceToPolygon().

780 {
781  int myClearance = m_ZoneClearance;
782 
783 #if 1 // Maybe the netclass clearance should not come into play for a zone?
784  // At least the policy decision can be controlled by the zone
785  // itself, i.e. here. On reasons of insufficient documentation,
786  // the user will be less bewildered if we simply respect the
787  // "zone clearance" setting in the zone properties dialog. (At least
788  // until there is a UI boolean for this.)
789 
790  NETCLASSPTR myClass = GetNetClass();
791 
792  if( myClass )
793  myClearance = std::max( myClearance, myClass->GetClearance() );
794 #endif
795 
796  if( aItem )
797  {
798  int hisClearance = aItem->GetClearance( NULL );
799  myClearance = std::max( hisClearance, myClearance );
800  }
801 
802  return myClearance;
803 }
int m_ZoneClearance
Clearance value in internal units.
Definition: class_zone.h:703
std::shared_ptr< NETCLASS > GetNetClass() const
Function GetNetClass returns the NETCLASS for this item.
virtual int GetClearance(BOARD_CONNECTED_ITEM *aItem=NULL) const
Function GetClearance returns the clearance in internal units.
#define max(a, b)
Definition: auxiliary.h:86
const VECTOR2I& ZONE_CONTAINER::GetCornerPosition ( int  aCornerIndex) const
inline

Definition at line 460 of file class_zone.h.

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

Referenced by PCB_EDIT_FRAME::Begin_Zone(), GetBoundingBox(), GetPosition(), Show_New_Edge_While_Move_Mouse(), and PCB_EDIT_FRAME::Start_Move_Zone_Corner().

461  {
463 
464  // Convert global to relative indices
465  if( !m_Poly->GetRelativeIndices( aCornerIndex, &index ) )
466  throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
467 
468  return m_Poly->CVertex( index );
469  }
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.
bool GetRelativeIndices(int aGlobalIdx, VERTEX_INDEX *aRelativeIndices) const
Function GetRelativeIndices.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:678
unsigned int ZONE_CONTAINER::GetCornerRadius ( ) const
inline

Definition at line 580 of file class_zone.h.

References AddPolygon(), and m_cornerRadius.

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

580 { return m_cornerRadius; };
unsigned int m_cornerRadius
Definition: class_zone.h:680
int ZONE_CONTAINER::GetCornerSmoothingType ( ) const
inline
int ZONE_CONTAINER::GetDefaultHatchPitch ( )
static

Function GetDefaultHatchPitchMils.

Returns
int - the default hatch pitch in internal units.

Definition at line 1261 of file class_zone.cpp.

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

1262 {
1263  return Mils2iu( 20 );
1264 }
bool ZONE_CONTAINER::GetDoNotAllowCopperPour ( ) const
inline
bool ZONE_CONTAINER::GetDoNotAllowVias ( ) const
inline
const SHAPE_POLY_SET& ZONE_CONTAINER::GetFilledPolysList ( ) const
inline
ZONE_FILL_MODE ZONE_CONTAINER::GetFillMode ( ) const
inline

Definition at line 181 of file class_zone.h.

References m_FillMode.

Referenced by ZONE_FILLER::Fill(), PCB_IO::format(), IsSame(), ZONE_SETTINGS::operator<<(), and BRDITEMS_PLOTTER::PlotFilledAreas().

181 { return m_FillMode; }
ZONE_FILL_MODE m_FillMode
How to fill areas: ZFM_POLYGONS => use filled polygons, ZFM_SEGMENTS => fill with segments...
Definition: class_zone.h:721
STATUS_FLAGS EDA_ITEM::GetFlags ( ) const
inlineinherited

Definition at line 255 of file base_struct.h.

References EDA_ITEM::m_Flags.

Referenced by AbortMoveAndEditTarget(), SCH_SCREEN::addConnectedItemsToBlock(), AddMenusForBitmap(), AddMenusForBusEntry(), AddMenusForComponent(), AddMenusForComponentField(), AddMenusForEditComponent(), AddMenusForGLabel(), AddMenusForHierchicalSheet(), AddMenusForHLabel(), AddMenusForLabel(), AddMenusForSheetPin(), AddMenusForText(), SCH_EDIT_FRAME::BeginSegment(), SCH_EDIT_FRAME::ChangeTextOrient(), Collect_TrackSegmentsToDrag(), SCH_EDIT_FRAME::ConvertPart(), SCH_EDIT_FRAME::copyBlockItems(), LIB_EDIT_FRAME::copySelectedItems(), LIB_EDIT_FRAME::CreatePin(), PCB_EDIT_FRAME::createPopUpMenuForFootprints(), PCB_EDIT_FRAME::createPopUpMenuForFpPads(), PCB_EDIT_FRAME::createPopUpMenuForFpTexts(), PCB_EDIT_FRAME::createPopUpMenuForTexts(), PCB_EDIT_FRAME::createPopupMenuForTracks(), PCB_EDIT_FRAME::createPopUpMenuForZones(), PCB_EDIT_FRAME::Delete_Segment_Edge(), SCH_EDIT_FRAME::DeleteItem(), SCH_EDIT_FRAME::DeleteItemsInList(), SCH_EDIT_FRAME::DeleteJunction(), PCB_BASE_FRAME::DeleteTextModule(), BOARD::Draw(), PCB_EDIT_FRAME::Edit_TrackSegm_Width(), SCH_EDIT_FRAME::EditComponentFieldText(), SCH_EDIT_FRAME::EditImage(), PCB_EDIT_FRAME::FlipTextePcb(), LIB_VIEW_FRAME::GeneralControl(), SCH_EDIT_FRAME::GeneralControl(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), SCH_SCREEN::GetConnection(), InitialiseDragParameters(), EDA_DRAW_FRAME::isBusy(), Magnetize(), SCH_EDIT_FRAME::MirrorImage(), SCH_EDIT_FRAME::MirrorSheet(), SCH_EDIT_FRAME::OnAutoplaceFields(), SCH_EDIT_FRAME::OnConvertTextType(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), SCH_EDIT_FRAME::OnDragItem(), SCH_EDIT_FRAME::OnEditItem(), LIB_EDIT_FRAME::OnEditPin(), FOOTPRINT_EDIT_FRAME::OnHotKey(), SCH_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotkeyBeginRoute(), PCB_EDIT_FRAME::OnHotkeyCopyItem(), PCB_EDIT_FRAME::OnHotkeyDeleteItem(), PCB_EDIT_FRAME::OnHotkeyDuplicateOrArrayItem(), PCB_EDIT_FRAME::OnHotkeyEditItem(), PCB_EDIT_FRAME::OnHotkeyFlipItem(), PCB_EDIT_FRAME::OnHotkeyMoveItem(), PCB_EDIT_FRAME::OnHotkeyPlaceItem(), PCB_EDIT_FRAME::OnHotkeyRotateItem(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), FOOTPRINT_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), EDA_DRAW_PANEL::OnMouseEvent(), SCH_EDIT_FRAME::OnMoveItem(), SCH_EDIT_FRAME::OnOpenLibraryEditor(), SCH_EDIT_FRAME::OnOrient(), FOOTPRINT_EDIT_FRAME::OnRightClick(), GERBVIEW_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRightClick(), PCB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRotate(), SCH_EDIT_FRAME::OnSelectUnit(), SCH_EDIT_FRAME::OrientComponent(), PCB_EDIT_FRAME::PlaceTarget(), FOOTPRINT_EDIT_FRAME::PrepareItemForHotkey(), LIB_EDIT_FRAME::Process_Special_Functions(), TRACKS_CLEANER::removeDuplicatesOfTrack(), PCB_BASE_FRAME::Rotate_Module(), PCB_EDIT_FRAME::Rotate_Texte_Pcb(), SCH_EDIT_FRAME::RotateField(), SCH_EDIT_FRAME::RotateHierarchicalSheet(), SCH_EDIT_FRAME::RotateImage(), PCB_BASE_FRAME::RotateTextModule(), LIB_EDIT_FRAME::SaveCopyInUndoList(), SCH_EDIT_FRAME::SaveCopyInUndoList(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_SCREEN::SelectBlockItems(), SCH_EDIT_FRAME::SetBusEntryShape(), Show_Drag_Track_Segment_With_Cte_Slope(), Show_MoveNode(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), and DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow().

255 { return m_Flags; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
const std::vector<SEG>& ZONE_CONTAINER::GetHatchLines ( ) const
inline

Definition at line 665 of file class_zone.h.

References m_HatchLines.

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

665 { return m_HatchLines; }
std::vector< SEG > m_HatchLines
Definition: class_zone.h:747
int ZONE_CONTAINER::GetHatchPitch ( ) const

Hatch related methods.

Function GetHatchPitch

Returns
int - the zone hatch pitch in iu.

Definition at line 1063 of file class_zone.cpp.

References m_hatchPitch.

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

1064 {
1065  return m_hatchPitch;
1066 }
HATCH_STYLE ZONE_CONTAINER::GetHatchStyle ( ) const
inline

Definition at line 504 of file class_zone.h.

References m_hatchStyle.

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

505  {
506  return m_hatchStyle;
507  }
HATCH_STYLE m_hatchStyle
Definition: class_zone.h:745
bool ZONE_CONTAINER::GetHV45 ( ) const
inline

Definition at line 667 of file class_zone.h.

References m_hv45.

Referenced by ZONE_SETTINGS::operator<<().

667 { return m_hv45; }
PCB_LAYER_ID ZONE_CONTAINER::GetLayer ( ) const
overridevirtual

Function GetLayer returns the primary layer this item is on.

Reimplemented from BOARD_ITEM.

Definition at line 175 of file class_zone.cpp.

References BOARD_ITEM::GetLayer().

Referenced by CN_LIST::Add(), GERBER_JOBFILE_WRITER::addJSONDesignRules(), PCB_EDIT_FRAME::Begin_Zone(), PCB_EDIT_FRAME::Block_SelectItems(), ZONE_FILLER::buildUnconnectedThermalStubsPolygonList(), ZONE_FILLER::buildZoneFeatureHoleList(), BOARD::CombineAllAreasInNet(), BOARD::ConvertBrdLayerToPolygonalContours(), CINFO3D_VISU::createLayers(), DRC::doEdgeZoneDrc(), Draw(), DrawFilledArea(), DRAWING_TOOL::DrawVia(), DrawWhileCreateOutline(), DRAWING_TOOL::drawZone(), PCB_EDIT_FRAME::duplicateZone(), PCB_EDIT_FRAME::Edit_Zone_Params(), PCB_EDIT_FRAME::End_Zone(), export_vrml_zones(), Flip(), DSN::SPECCTRA_DB::FromBOARD(), GetPriority(), Hatch(), IsOnCopperLayer(), IsSame(), BOARD::NormalizeAreaPolygon(), ZONE_SETTINGS::operator<<(), BRDITEMS_PLOTTER::PlotFilledAreas(), PlotSilkScreen(), PlotSolderMaskLayer(), PlotStandardLayer(), PCB_EDIT_FRAME::PrintPage(), BOARD::RedrawAreasOutlines(), BOARD::RedrawFilledAreas(), PCB_EDIT_FRAME::Remove_Zone_Corner(), SaveCopyOfZones(), PCB_EDIT_FRAME::Start_Move_Zone_Corner(), PCB_EDIT_FRAME::Start_Move_Zone_Drag_Outline_Edge(), PCB_EDIT_FRAME::Start_Move_Zone_Outlines(), BOARD::TestAreaIntersection(), DRC::TestZoneToZoneOutline(), and PCB_EDITOR_CONTROL::ZoneMerge().

176 {
177  return BOARD_ITEM::GetLayer();
178 }
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
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 78 of file class_board_item.cpp.

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

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

79 {
80  BOARD* board = GetBoard();
81 
82  if( board )
83  return board->GetLayerName( m_Layer );
84 
85  // If no parent, return standard name
87 }
PCB_LAYER_ID m_Layer
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer given by aLayer.
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
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:653
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 230 of file class_zone.cpp.

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

Referenced by ZONE_FILLER::buildZoneFeatureHoleList(), CommonLayerExists(), Draw(), Flip(), PCB_IO::format(), GetPriority(), ZONE_SETTINGS::operator<<(), operator=(), SELECTION_TOOL::selectable(), PNS_KICAD_IFACE::syncZone(), BOARD::TestAreaIntersections(), and ZONE_CONTAINER().

231 {
232  // TODO - Enable multi-layer zones for all zone types
233  // not just keepout zones
234  if( GetIsKeepout() )
235  {
236  return m_layerSet;
237  }
238  else
239  {
240  return LSET( m_Layer );
241  }
242 }
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:608
PCB_LAYER_ID m_Layer
Class LSET is a set of PCB_LAYER_IDs.
DHEAD* EDA_ITEM::GetList ( ) const
inlineinherited
int ZONE_CONTAINER::GetLocalFlags ( ) const
inline

Definition at line 236 of file class_zone.h.

References m_localFlgs.

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

236 { return m_localFlgs; }
int m_localFlgs
Variable used in polygon calculations.
Definition: class_zone.h:727
bool BOARD_CONNECTED_ITEM::GetLocalRatsnestVisible ( ) const
inlineinherited

Definition at line 188 of file board_connected_item.h.

References BOARD_CONNECTED_ITEM::m_localRatsnestVisible.

189  {
190  return m_localRatsnestVisible;
191  }
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 1267 of file class_zone.cpp.

Referenced by RawPolysList().

1268 {
1269  return add_zone_xpm;
1270 }
void ZONE_CONTAINER::GetMsgPanelInfo ( EDA_UNITS_T  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 812 of file class_zone.cpp.

References AccumulateDescription(), BLUE, BROWN, DARKCYAN, GetDoNotAllowCopperPour(), GetDoNotAllowTracks(), GetDoNotAllowVias(), GetIsKeepout(), BOARD_ITEM::GetLayerName(), BOARD_CONNECTED_ITEM::GetNet(), BOARD_CONNECTED_ITEM::GetNetCode(), NETINFO_ITEM::GetNetname(), GetPriority(), SHAPE_POLY_SET::IsEmpty(), IsOnCopperLayer(), SHAPE_POLY_SET::VERTEX_INDEX::m_contour, m_CornerSelection, m_FilledPolysList, m_FillMode, m_HatchLines, m_Poly, RED, and SHAPE_POLY_SET::TotalVertices().

Referenced by GetPriority().

813 {
814  wxString msg;
815 
816  msg = _( "Zone Outline" );
817 
818  // Display Cutout instead of Outline for holes inside a zone
819  // i.e. when num contour !=0
820  // Check whether the selected corner is in a hole; i.e., in any contour but the first one.
821  if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
822  msg << wxT( " " ) << _( "(Cutout)" );
823 
824  aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg, DARKCYAN ) );
825 
826  if( GetIsKeepout() )
827  {
828  msg.Empty();
829 
830  if( GetDoNotAllowVias() )
831  AccumulateDescription( msg, _( "No via" ) );
832 
833  if( GetDoNotAllowTracks() )
834  AccumulateDescription( msg, _("No track") );
835 
837  AccumulateDescription( msg, _("No copper pour") );
838 
839  aList.push_back( MSG_PANEL_ITEM( _( "Keepout" ), msg, RED ) );
840  }
841  else if( IsOnCopperLayer() )
842  {
843  if( GetNetCode() >= 0 )
844  {
845  NETINFO_ITEM* net = GetNet();
846 
847  if( net )
848  msg = net->GetNetname();
849  else // Should not occur
850  msg = _( "<unknown>" );
851  }
852  else // a netcode < 0 is an error
853  msg = wxT( "<error>" );
854 
855  aList.push_back( MSG_PANEL_ITEM( _( "NetName" ), msg, RED ) );
856 
857  // Display net code : (useful in test or debug)
858  msg.Printf( wxT( "%d" ), GetNetCode() );
859  aList.push_back( MSG_PANEL_ITEM( _( "NetCode" ), msg, RED ) );
860 
861  // Display priority level
862  msg.Printf( wxT( "%d" ), GetPriority() );
863  aList.push_back( MSG_PANEL_ITEM( _( "Priority" ), msg, BLUE ) );
864  }
865  else
866  {
867  aList.push_back( MSG_PANEL_ITEM( _( "Non Copper Zone" ), wxEmptyString, RED ) );
868  }
869 
870  aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), BROWN ) );
871 
872  msg.Printf( wxT( "%d" ), (int) m_Poly->TotalVertices() );
873  aList.push_back( MSG_PANEL_ITEM( _( "Corners" ), msg, BLUE ) );
874 
875  if( m_FillMode )
876  msg = _( "Segments" );
877  else
878  msg = _( "Polygons" );
879 
880  aList.push_back( MSG_PANEL_ITEM( _( "Fill Mode" ), msg, BROWN ) );
881 
882  // Useful for statistics :
883  msg.Printf( wxT( "%d" ), (int) m_HatchLines.size() );
884  aList.push_back( MSG_PANEL_ITEM( _( "Hatch Lines" ), msg, BLUE ) );
885 
886  if( !m_FilledPolysList.IsEmpty() )
887  {
888  msg.Printf( wxT( "%d" ), m_FilledPolysList.TotalVertices() );
889  aList.push_back( MSG_PANEL_ITEM( _( "Corner Count" ), msg, BLUE ) );
890  }
891 }
Definition: colors.h:57
bool GetDoNotAllowCopperPour() const
Definition: class_zone.h:609
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:724
int TotalVertices() const
Returns total number of vertices stored in the set.
wxString GetLayerName() const
Function GetLayerName returns the name of the PCB layer on which the item resides.
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:608
std::vector< SEG > m_HatchLines
Definition: class_zone.h:747
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:678
Definition: colors.h:60
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:742
int GetNetCode() const
Function GetNetCode.
void AccumulateDescription(wxString &aDesc, const wxString &aItem)
Utility to build comma separated lists in messages.
Definition: macros.h:65
Class NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:69
bool IsOnCopperLayer() const
Function IsOnCopperLayer.
Definition: class_zone.cpp:181
bool GetDoNotAllowTracks() const
Definition: class_zone.h:611
ZONE_FILL_MODE m_FillMode
How to fill areas: ZFM_POLYGONS => use filled polygons, ZFM_SEGMENTS => fill with segments...
Definition: class_zone.h:721
bool GetDoNotAllowVias() const
Definition: class_zone.h:610
bool IsEmpty() const
Returns true if the set is empty (no polygons at all)
const wxString & GetNetname() const
Function GetNetname.
Definition: netinfo.h:239
Class EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
unsigned GetPriority() const
Function GetPriority.
Definition: class_zone.h:107
NETINFO_ITEM * GetNet() const
Function GetNet Returns NET_INFO object for a given item.
Definition: colors.h:62
NETINFO_ITEM* BOARD_CONNECTED_ITEM::GetNet ( ) const
inlineinherited
NETCLASSPTR BOARD_CONNECTED_ITEM::GetNetClass ( ) const
inherited

Function GetNetClass returns the NETCLASS for this item.

Definition at line 104 of file board_connected_item.cpp.

References DBG, BOARD::FindNet(), BOARD_ITEM::GetBoard(), BOARD_DESIGN_SETTINGS::GetDefault(), BOARD::GetDesignSettings(), NETINFO_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetNetCode(), and EDA_ITEM::Type().

Referenced by DRC::doTrackDrc(), GetClearance(), BOARD_CONNECTED_ITEM::GetClearance(), VIA::GetDrillValue(), TRACK::GetMsgPanelInfo(), BOARD_CONNECTED_ITEM::GetNetClassName(), BOARD_CONNECTED_ITEM::GetShortNetname(), ROUTER_TOOL::prepareInteractive(), and DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow().

105 {
106  // It is important that this be implemented without any sequential searching.
107  // Simple array lookups should be fine, performance-wise.
108  BOARD* board = GetBoard();
109 
110  // DO NOT use wxASSERT, because GetNetClass is called inside an OnPaint event
111  // and a call to wxASSERT can crash the application.
112 
113  if( board == NULL ) // Should not occur
114  {
115  DBG(printf( "%s: NULL board,type %d", __func__, Type() );)
116 
117  return NETCLASSPTR();
118  }
119 
120  NETCLASSPTR netclass;
121  NETINFO_ITEM* net = board->FindNet( GetNetCode() );
122 
123  if( net )
124  {
125  netclass = net->GetNetClass();
126 
127  //DBG( if(!netclass) printf( "%s: NULL netclass,type %d", __func__, Type() );)
128  }
129 
130  if( netclass )
131  return netclass;
132  else
133  return board->GetDesignSettings().GetDefault();
134 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
NETCLASSPTR GetDefault() const
Function GetDefault.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:538
int GetNetCode() const
Function GetNetCode.
Class NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:69
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
NETCLASSPTR GetNetClass()
Definition: netinfo.h:126
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
#define DBG(x)
Definition: fctsys.h:33
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 137 of file board_connected_item.cpp.

References NETCLASS::Default, BOARD_CONNECTED_ITEM::GetNetClass(), and name.

Referenced by PCB_EDIT_FRAME::createPopUpMenuForFpPads(), PCB_EDIT_FRAME::createPopupMenuForTracks(), BOARD_CONNECTED_ITEM::GetShortNetname(), and DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem().

138 {
139  wxString name;
140  NETCLASSPTR myclass = GetNetClass();
141 
142  if( myclass )
143  name = myclass->GetName();
144  else
145  name = NETCLASS::Default;
146 
147  return name;
148 }
std::shared_ptr< NETCLASS > GetNetClass() const
Function GetNetClass returns the NETCLASS for this item.
static const char Default[]
the name of the default NETCLASS
Definition: netclass.h:80
const char * name
Definition: DXF_plotter.cpp:61
int BOARD_CONNECTED_ITEM::GetNetCode ( ) const
inlineinherited

Function GetNetCode.

Returns
int - the net code.

Definition at line 103 of file board_connected_item.h.

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

Referenced by PCB_EDIT_FRAME::Attribut_net(), PCB_EDIT_FRAME::Begin_Route(), PCB_EDIT_FRAME::Begin_Zone(), ZONE_FILLER::buildUnconnectedThermalStubsPolygonList(), ZONE_FILLER::buildZoneFeatureHoleList(), Collect_TrackSegmentsToDrag(), BOARD::CombineAllAreasInNet(), ZONE_FILLER::computeRawFilledAreas(), connectedItemFilter(), D_PAD::CopyNetlistSettings(), CreateRoutesSection(), CreateSignalsSection(), PCB_EDIT_FRAME::Delete_net(), PCB_EDIT_FRAME::Delete_Segment(), DRC::doEdgeZoneDrc(), DRC::doPadToPadsDrc(), DRC::doTrackDrc(), KIGFX::PCB_PAINTER::draw(), VIA::Draw(), BOARD::DrawHighLight(), TRACK::DrawShortNetname(), DRAWING_TOOL::DrawVia(), PCB_EDIT_FRAME::duplicateZone(), PCB_EDIT_FRAME::End_Zone(), PCB_EDIT_FRAME::EraseRedundantTrack(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), PNS::NODE::FindItemByParent(), PCB_IO::format(), DSN::SPECCTRA_DB::FromBOARD(), TRACK::GetBestInsertPoint(), CONNECTIVITY_DATA::GetConnectedItems(), TRACK::GetEndNetCode(), GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), TRACK::GetStartNetCode(), TRACK::GetTrack(), hash_eda(), highlightNet(), DIALOG_PAD_PROPERTIES::initValues(), IsSame(), LocateIntrusion(), Magnetize(), 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(), PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment(), PCB_EDIT_FRAME::Process_Special_Functions(), PushTrack(), PCB_EDIT_FRAME::Remove_One_Track(), PCB_EDIT_FRAME::Remove_Zone_Corner(), TRACKS_CLEANER::removeDuplicatesOfTrack(), BOARD::ReplaceNetlist(), PCB_SELECTION_CONDITIONS::sameNetFunc(), SaveCopyOfZones(), BOARD::SetAreasNetCodesFromNetNames(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::Start_Move_Zone_Corner(), PCB_EDIT_FRAME::Start_Move_Zone_Drag_Outline_Edge(), PCB_EDIT_FRAME::Start_Move_Zone_Outlines(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), PNS_KICAD_IFACE::syncPad(), PNS_KICAD_IFACE::syncTrack(), PNS_KICAD_IFACE::syncVia(), BOARD::TestAreaIntersections(), DRC::testZones(), DRC::TestZoneToZoneOutline(), TrackListSortByNetcode(), BOARD::TracksInNet(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), ZONE_CONTAINER(), and PCB_EDITOR_CONTROL::ZoneMerge().

104  {
105  return m_netinfo->GetNet();
106  }
int GetNet() const
Function GetNet.
Definition: netinfo.h:231
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.
const wxString& BOARD_CONNECTED_ITEM::GetNetname ( ) const
inlineinherited

Function GetNetname.

Returns
wxString - the full netname

Definition at line 122 of file board_connected_item.h.

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(), BRDITEMS_PLOTTER::PlotFilledAreas(), BRDITEMS_PLOTTER::PlotPad(), PlotStandardLayer(), BOARD::ReplaceNetlist(), and BOARD_NETLIST_UPDATER::updateCopperZoneNets().

123  {
124  return m_netinfo->GetNetname();
125  }
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.
const wxString & GetNetname() const
Function GetNetname.
Definition: netinfo.h:239
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 132 of file board_connected_item.h.

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

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

133  {
134  if( !GetBoard() )
135  return wxT( "[** NO BOARD DEFINED **]" );
136 
137  wxString netname = GetNetname();
138 
139  if( !netname.length() )
140  return wxT( "[<no net>]" );
141  else if( GetNetCode() < 0 )
142  return wxT( "[" + netname + "](" + _( "Not Found" ) + ")" );
143  else
144  return wxT( "[" + netname + "]" );
145  }
int GetNetCode() const
Function GetNetCode.
const wxString & GetNetname() const
Function GetNetname.
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
int BOARD_ITEM::getNextNumberInSequence ( const std::set< int > &  aSeq,
bool  aFillSequenceGaps 
)
staticprotectedinherited

Definition at line 230 of file class_board_item.cpp.

Referenced by MODULE::GetNextPadName().

231 {
232  if( aSeq.empty() )
233  return 1;
234 
235  // By default go to the end of the sequence
236  int candidate = *aSeq.rbegin();
237 
238  // Filling in gaps in pad numbering
239  if( aFillSequenceGaps )
240  {
241  // start at the beginning
242  candidate = *aSeq.begin();
243 
244  for( auto it : aSeq )
245  {
246  if( it - candidate > 1 )
247  break;
248 
249  candidate = it;
250  }
251  }
252 
253  ++candidate;
254 
255  return candidate;
256 }
int ZONE_CONTAINER::GetNumCorners ( void  ) const
inline

Access to m_Poly parameters.

Definition at line 420 of file class_zone.h.

References m_Poly, and SHAPE_POLY_SET::TotalVertices().

Referenced by PCB_EDIT_FRAME::Begin_Zone(), BuildSmoothedPoly(), PCB_EDIT_FRAME::Delete_LastCreatedCorner(), Draw(), PCB_EDIT_FRAME::End_Zone(), PCB_IO::format(), GetBoundingBox(), BOARD::OnAreaPolygonModified(), and Show_New_Edge_While_Move_Mouse().

421  {
422  return m_Poly->TotalVertices();
423  }
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:678
ZoneConnection ZONE_CONTAINER::GetPadConnection ( D_PAD aPad = NULL) const
BOARD_ITEM_CONTAINER* BOARD_ITEM::GetParent ( void  ) const
inlineinherited

Definition at line 118 of file class_board_item.h.

References EDA_ITEM::m_Parent.

Referenced by Abort_Move_ModuleOutline(), AbortMoveTextModule(), POINT_EDITOR::addCorner(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), CmpHoleSorting(), PCB_EDIT_FRAME::createPopUpMenuForFpTexts(), FOOTPRINT_EDIT_FRAME::Delete_Edge_Module(), BOARD_ITEM::DeleteStructure(), PCB_BASE_FRAME::DeleteTextModule(), 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(), TEXTE_MODULE::DrawUmbilical(), PCB_EDIT_FRAME::duplicateItems(), EditToolSelectionFilter(), PCB_IO::format(), FormatProbeItem(), BOARD_ITEM::GetBoard(), EDGE_MODULE::GetMsgPanelInfo(), EDGE_MODULE::GetSelectMenuText(), TEXTE_MODULE::GetSelectMenuText(), TEXTE_MODULE::GetShownText(), SELECTION_TOOL::guessSelectionCandidates(), GENERAL_COLLECTOR::Inspect(), EDGE_MODULE::IsParentFlipped(), TEXTE_MODULE::IsParentFlipped(), LEGACY_PLUGIN::loadMODULE_TEXT(), PCB_EDIT_FRAME::moveExact(), FOOTPRINT_EDIT_FRAME::OnRightClick(), FOOTPRINT_EDIT_FRAME::Place_EdgeMod(), PCB_BASE_FRAME::PlaceTexteModule(), BRDITEMS_PLOTTER::Plot_1_EdgeModule(), BRDITEMS_PLOTTER::PlotTextModule(), PCB_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), PAD_TOOL::pushPadSettings(), PCB_BASE_FRAME::ResetTextSize(), PCB_BASE_FRAME::RotateTextModule(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), SELECTION_TOOL::select(), ShowCurrentOutlineWhileMoving(), ShowNewEdgeModule(), PCB_BASE_FRAME::StartMoveTexteModule(), SwapItemData(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

118 { return (BOARD_ITEM_CONTAINER*) m_Parent; }
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:168
Abstract interface for BOARD_ITEMs capable of storing other items inside.
const wxPoint ZONE_CONTAINER::GetPosition ( ) const
overridevirtual

Function GetPosition.

Returns a reference to the first corner of the polygon set.

Warning
The implementation of this function relies on the fact that wxPoint and VECTOR2I have the same layout. If you intend to use the returned reference directly, please note that you are only allowed to use members x and y. Any use on anything that is not one of these members will have undefined behaviour.
Returns
a wxPoint, position of the first point of the outline

Implements BOARD_ITEM.

Definition at line 169 of file class_zone.cpp.

References GetCornerPosition().

Referenced by ClassOf(), EAGLE_PLUGIN::loadPlain(), DRC::newMarker(), PNS_KICAD_IFACE::syncZone(), and DRC::testZones().

170 {
171  return (wxPoint) GetCornerPosition( 0 );
172 }
const VECTOR2I & GetCornerPosition(int aCornerIndex) const
Definition: class_zone.h:460
int ZONE_CONTAINER::GetSelectedCorner ( ) const
inline

Definition at line 207 of file class_zone.h.

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

Referenced by Abort_Zone_Move_Corner_Or_Outlines(), PCB_EDIT_FRAME::createPopUpMenuForZones(), PCB_EDIT_FRAME::Delete_Zone_Contour(), PCB_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Remove_Zone_Corner(), and Show_Zone_Corner_Or_Outline_While_Move_Mouse().

208  {
209  // Transform relative indices to global index
210  int globalIndex;
211  m_Poly->GetGlobalIndex( *m_CornerSelection, globalIndex );
212 
213  return globalIndex;
214  }
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:724
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:678
bool GetGlobalIndex(VERTEX_INDEX aRelativeIndices, int &aGlobalIdx)
Function GetGlobalIndex computes the global index of a vertex from the relative indices of polygon...
wxString ZONE_CONTAINER::GetSelectMenuText ( EDA_UNITS_T  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 1046 of file class_zone.cpp.

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

Referenced by RawPolysList(), and PNS_KICAD_IFACE::syncZone().

1047 {
1048  wxString text;
1049 
1050  // Check whether the selected contour is a hole (contour index > 0)
1051  if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
1052  text << wxT( " " ) << _( "(Cutout)" );
1053 
1054  if( GetIsKeepout() )
1055  text << wxT( " " ) << _( "(Keepout)" );
1056  else
1057  text << GetNetnameMsg();
1058 
1059  return wxString::Format( _( "Zone Outline %s on %s" ), text, GetLayerName() );
1060 }
wxString GetNetnameMsg() const
Function GetNetnameMsg.
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:724
wxString GetLayerName() const
Function GetLayerName returns the name of the PCB layer on which the item resides.
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:608
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
const wxString& BOARD_CONNECTED_ITEM::GetShortNetname ( ) const
inlineinherited

Function GetShortNetname.

Returns
wxString - the short netname

Definition at line 151 of file board_connected_item.h.

References BOARD_CONNECTED_ITEM::GetClearance(), BOARD_CONNECTED_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetNetClassName(), NETINFO_ITEM::GetShortNetname(), and BOARD_CONNECTED_ITEM::m_netinfo.

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

152  {
153  return m_netinfo->GetShortNetname();
154  }
const wxString & GetShortNetname() const
Function GetShortNetname.
Definition: netinfo.h:245
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.
STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 250 of file base_struct.h.

References EDA_ITEM::m_Status.

Referenced by PCB_IO::format(), and GERBER_DRAW_ITEM::HitTest().

250 { return m_Status; }
STATUS_FLAGS m_Status
Definition: base_struct.h:161
int ZONE_CONTAINER::GetThermalReliefCopperBridge ( D_PAD aPad = NULL) const
int ZONE_CONTAINER::GetThermalReliefGap ( D_PAD aPad = NULL) const

Definition at line 628 of file class_zone.cpp.

References D_PAD::GetThermalGap(), and m_ThermalReliefGap.

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

629 {
630  if( aPad == NULL || aPad->GetThermalGap() == 0 )
631  return m_ThermalReliefGap;
632  else
633  return aPad->GetThermalGap();
634 }
int GetThermalGap() const
Definition: class_pad.cpp:709
int m_ThermalReliefGap
Width of the copper bridge in thermal reliefs.
Definition: class_zone.h:714
timestamp_t EDA_ITEM::GetTimeStamp ( ) const
inlineinherited

Definition at line 204 of file base_struct.h.

References EDA_ITEM::m_TimeStamp.

Referenced by FIELDS_EDITOR_GRID_DATA_MODEL::AddColumn(), SCH_COMPONENT::AddSheetPathReferenceEntryIfMissing(), SCH_EDIT_FRAME::AnnotateComponents(), FIELDS_EDITOR_GRID_DATA_MODEL::ApplyData(), PCB_EDIT_FRAME::Delete_OldZone_Fill(), PCB_EDIT_FRAME::Delete_Zone_Contour(), DuplicateStruct(), DIALOG_FOOTPRINT_BOARD_EDITOR::EditFootprint(), EDIT_TOOL::editFootprintInFpEditor(), SCH_EDIT_FRAME::EditSheet(), PCB_EDIT_FRAME::Exchange_Module(), PCB_IO::format(), FormatProbeItem(), EDGE_MODULE::GetMsgPanelInfo(), NETLIST_OBJECT::GetShortNetName(), FIELDS_EDITOR_GRID_DATA_MODEL::groupMatch(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), NETLIST_EXPORTER_GENERIC::makeComponents(), mapExistingAnnotation(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), SCH_SHEET_PATH::Path(), PCB_BASE_FRAME::PcbGeneralLocateAndDisplay(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), SCH_LEGACY_PLUGIN::saveComponent(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_LEGACY_PLUGIN::saveSheet(), SCH_REFERENCE::SCH_REFERENCE(), ZONE_FILLER_TOOL::SegzoneDeleteFill(), SortByTimeStamp(), SwapItemData(), DIALOG_SCH_SHEET_PROPS::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataToWindow(), and DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::~DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS().

204 { return m_TimeStamp; }
timestamp_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:169
int BOARD_ITEM::getTrailingInt ( const wxString &  aStr)
staticprotectedinherited

Definition at line 207 of file class_board_item.cpp.

Referenced by MODULE::GetNextPadName(), and MODULE::IncrementReference().

208 {
209  int number = 0;
210  int base = 1;
211 
212  // Trim and extract the trailing numeric part
213  int index = aStr.Len() - 1;
214  while( index >= 0 )
215  {
216  const char chr = aStr.GetChar( index );
217 
218  if( chr < '0' || chr > '9' )
219  break;
220 
221  number += ( chr - '0' ) * base;
222  base *= 10;
223  index--;
224  }
225 
226  return number;
227 }
int ZONE_CONTAINER::GetZoneClearance ( ) const
inline
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 1099 of file class_zone.cpp.

References SEG::A, abs, SEG::B, DIAGONAL_EDGE, DIAGONAL_FULL, FindLineSegmentIntersection(), 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(), SHAPE_POLY_SET::Vertex(), VECTOR2< T >::x, and VECTOR2< T >::y.

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

1100 {
1101  UnHatch();
1102 
1103  if( m_hatchStyle == NO_HATCH || m_hatchPitch == 0 || m_Poly->IsEmpty() )
1104  return;
1105 
1106  // define range for hatch lines
1107  int min_x = m_Poly->Vertex( 0 ).x;
1108  int max_x = m_Poly->Vertex( 0 ).x;
1109  int min_y = m_Poly->Vertex( 0 ).y;
1110  int max_y = m_Poly->Vertex( 0 ).y;
1111 
1112  for( auto iterator = m_Poly->IterateWithHoles(); iterator; iterator++ )
1113  {
1114  if( iterator->x < min_x )
1115  min_x = iterator->x;
1116 
1117  if( iterator->x > max_x )
1118  max_x = iterator->x;
1119 
1120  if( iterator->y < min_y )
1121  min_y = iterator->y;
1122 
1123  if( iterator->y > max_y )
1124  max_y = iterator->y;
1125  }
1126 
1127  // Calculate spacing between 2 hatch lines
1128  int spacing;
1129 
1130  if( m_hatchStyle == DIAGONAL_EDGE )
1131  spacing = m_hatchPitch;
1132  else
1133  spacing = m_hatchPitch * 2;
1134 
1135  // set the "length" of hatch lines (the length on horizontal axis)
1136  int hatch_line_len = m_hatchPitch;
1137 
1138  // To have a better look, give a slope depending on the layer
1139  LAYER_NUM layer = GetLayer();
1140  int slope_flag = (layer & 1) ? 1 : -1; // 1 or -1
1141  double slope = 0.707106 * slope_flag; // 45 degrees slope
1142  int max_a, min_a;
1143 
1144  if( slope_flag == 1 )
1145  {
1146  max_a = KiROUND( max_y - slope * min_x );
1147  min_a = KiROUND( min_y - slope * max_x );
1148  }
1149  else
1150  {
1151  max_a = KiROUND( max_y - slope * max_x );
1152  min_a = KiROUND( min_y - slope * min_x );
1153  }
1154 
1155  min_a = (min_a / spacing) * spacing;
1156 
1157  // calculate an offset depending on layer number,
1158  // for a better look of hatches on a multilayer board
1159  int offset = (layer * 7) / 8;
1160  min_a += offset;
1161 
1162  // loop through hatch lines
1163  #define MAXPTS 200 // Usually we store only few values per one hatch line
1164  // depending on the complexity of the zone outline
1165 
1166  static std::vector<VECTOR2I> pointbuffer;
1167  pointbuffer.clear();
1168  pointbuffer.reserve( MAXPTS + 2 );
1169 
1170  for( int a = min_a; a < max_a; a += spacing )
1171  {
1172  // get intersection points for this hatch line
1173 
1174  // Note: because we should have an even number of intersections with the
1175  // current hatch line and the zone outline (a closed polygon,
1176  // or a set of closed polygons), if an odd count is found
1177  // we skip this line (should not occur)
1178  pointbuffer.clear();
1179 
1180  // Iterate through all vertices
1181  for( auto iterator = m_Poly->IterateSegmentsWithHoles(); iterator; iterator++ )
1182  {
1183  double x, y, x2, y2;
1184  int ok;
1185 
1186  SEG segment = *iterator;
1187 
1188  ok = FindLineSegmentIntersection( a, slope,
1189  segment.A.x, segment.A.y,
1190  segment.B.x, segment.B.y,
1191  &x, &y, &x2, &y2 );
1192 
1193  if( ok )
1194  {
1195  VECTOR2I point( KiROUND( x ), KiROUND( y ) );
1196  pointbuffer.push_back( point );
1197  }
1198 
1199  if( ok == 2 )
1200  {
1201  VECTOR2I point( KiROUND( x2 ), KiROUND( y2 ) );
1202  pointbuffer.push_back( point );
1203  }
1204 
1205  if( pointbuffer.size() >= MAXPTS ) // overflow
1206  {
1207  wxASSERT( 0 );
1208  break;
1209  }
1210  }
1211 
1212  // ensure we have found an even intersection points count
1213  // because intersections are the ends of segments
1214  // inside the polygon(s) and a segment has 2 ends.
1215  // if not, this is a strange case (a bug ?) so skip this hatch
1216  if( pointbuffer.size() % 2 != 0 )
1217  continue;
1218 
1219  // sort points in order of descending x (if more than 2) to
1220  // ensure the starting point and the ending point of the same segment
1221  // are stored one just after the other.
1222  if( pointbuffer.size() > 2 )
1223  sort( pointbuffer.begin(), pointbuffer.end(), sortEndsByDescendingX );
1224 
1225  // creates lines or short segments inside the complex polygon
1226  for( unsigned ip = 0; ip < pointbuffer.size(); ip += 2 )
1227  {
1228  int dx = pointbuffer[ip + 1].x - pointbuffer[ip].x;
1229 
1230  // Push only one line for diagonal hatch,
1231  // or for small lines < twice the line length
1232  // else push 2 small lines
1233  if( m_hatchStyle == DIAGONAL_FULL || std::abs( dx ) < 2 * hatch_line_len )
1234  {
1235  m_HatchLines.push_back( SEG( pointbuffer[ip], pointbuffer[ip + 1] ) );
1236  }
1237  else
1238  {
1239  double dy = pointbuffer[ip + 1].y - pointbuffer[ip].y;
1240  slope = dy / dx;
1241 
1242  if( dx > 0 )
1243  dx = hatch_line_len;
1244  else
1245  dx = -hatch_line_len;
1246 
1247  int x1 = KiROUND( pointbuffer[ip].x + dx );
1248  int x2 = KiROUND( pointbuffer[ip + 1].x - dx );
1249  int y1 = KiROUND( pointbuffer[ip].y + dx * slope );
1250  int y2 = KiROUND( pointbuffer[ip + 1].y - dx * slope );
1251 
1252  m_HatchLines.push_back(SEG(pointbuffer[ip].x, pointbuffer[ip].y, x1, y1));
1253 
1254  m_HatchLines.push_back( SEG( pointbuffer[ip+1].x, pointbuffer[ip+1].y, x2, y2 ) );
1255  }
1256  }
1257  }
1258 }
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:120
SEGMENT_ITERATOR IterateSegmentsWithHoles()
Returns an iterator object, for all outlines in the set (with holes)
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:175
#define abs(a)
Definition: auxiliary.h:84
VECTOR2I & Vertex(int aIndex, int aOutline, int aHole)
Returns the index-th vertex in a given hole outline within a given outline
#define MAXPTS
bool sortEndsByDescendingX(const VECTOR2I &ref, const VECTOR2I &tst)
std::vector< SEG > m_HatchLines
Definition: class_zone.h:747
ITERATOR IterateWithHoles(int aOutline)
Function IterateWithHoles.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:678
bool FindLineSegmentIntersection(double a, double b, int xi, int yi, int xf, int yf, double *x1, double *y1, double *x2, double *y2, double *dist)
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
HATCH_STYLE m_hatchStyle
Definition: class_zone.h:745
Definition: seg.h:36
void UnHatch()
Function UnHatch clears the zone&#39;s hatch.
VECTOR2I A
Definition: seg.h:46
bool IsEmpty() const
Returns true if the set is empty (no polygons at all)
VECTOR2I B
Definition: seg.h:47
bool ZONE_CONTAINER::HitTest ( const wxPoint aPosition) 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 BOARD_ITEM.

Definition at line 652 of file class_zone.cpp.

References HitTestFilledArea(), HitTestForCorner(), and HitTestForEdge().

Referenced by PCB_EDIT_FRAME::Block_SelectItems(), HitTestInsideZone(), and SetOutline().

653 {
654  return HitTestForCorner( aPosition ) || HitTestForEdge( aPosition ) ||
655  HitTestFilledArea( aPosition );
656 }
bool HitTestForEdge(const wxPoint &refPos, 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:694
bool HitTestFilledArea(const wxPoint &aRefPos) const
Function HitTestFilledArea tests if the given wxPoint is within the bounds of a filled area of this z...
Definition: class_zone.cpp:806
bool HitTestForCorner(const wxPoint &refPos, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
Function HitTestForCorner tests if the given wxPoint is near a corner.
Definition: class_zone.cpp:678
bool ZONE_CONTAINER::HitTest ( const EDA_RECT aRect,
bool  aContained = true,
int  aAccuracy = 0 
) const
overridevirtual

Parameters
aRectA reference to an EDA_RECT object containg the area to test.
aContainedTest if aRect contains this object completly.
aAccuracyIncrease the item bounding box by this amount.
Returns
bool - True if aRect contains this object completly or if aRect intersects the object and aContained is False, otherwise false.

Reimplemented from BOARD_ITEM.

Definition at line 710 of file class_zone.cpp.

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

711 {
712  // Calculate bounding box for zone
713  EDA_RECT bbox = GetBoundingBox();
714  bbox.Normalize();
715 
716  EDA_RECT arect = aRect;
717  arect.Normalize();
718  arect.Inflate( aAccuracy );
719 
720  if( aContained )
721  {
722  return arect.Contains( bbox );
723  }
724  else // Test for intersection between aBox and the polygon
725  // For a polygon, using its bounding box has no sense here
726  {
727  // Fast test: if aBox is outside the polygon bounding box,
728  // rectangles cannot intersect
729  if( !arect.Intersects( bbox ) )
730  return false;
731 
732  // aBox is inside the polygon bounding box,
733  // and can intersect the polygon: use a fine test.
734  // aBox intersects the polygon if at least one aBox corner
735  // is inside the polygon
736 
737  /*
738  wxPoint origin = arect.GetOrigin();
739 
740  int w = arect.GetWidth();
741  int h = arect.GetHeight();
742 
743 
744  if ( HitTestInsideZone( origin ) ||
745  HitTestInsideZone( origin + wxPoint( w, 0 ) ) ||
746  HitTestInsideZone( origin + wxPoint( w, h ) ) ||
747  HitTestInsideZone( origin + wxPoint( 0, h ) ) )
748  {
749  return true;
750  }
751  */
752 
753  // No corner inside aBox, but outlines can intersect aBox
754  // if one of outline corners is inside aBox
755  int count = m_Poly->TotalVertices();
756  for( int ii =0; ii < count; ii++ )
757  {
758  auto vertex = m_Poly->Vertex( ii );
759  auto vertexNext = m_Poly->Vertex( ( ii + 1 ) % count );
760 
761  // Test if the point is within the rect
762  if( arect.Contains( ( wxPoint ) vertex ) )
763  {
764  return true;
765  }
766 
767  // Test if this edge intersects the rect
768  if( arect.Intersects( ( wxPoint ) vertex, ( wxPoint ) vertexNext ) )
769  {
770  return true;
771  }
772  }
773 
774  return false;
775  }
776 }
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox (virtual)
Definition: class_zone.cpp:518
bool Contains(const wxPoint &aPoint) const
Function Contains.
int TotalVertices() const
Returns total number of vertices stored in the set.
VECTOR2I & Vertex(int aIndex, int aOutline, int aHole)
Returns the index-th vertex in a given hole outline within a given outline
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:678
void Normalize()
Function Normalize ensures that the height ant width are positive.
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
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 806 of file class_zone.cpp.

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

Referenced by HitTest(), and HitTestInsideZone().

807 {
808  return m_FilledPolysList.Contains( VECTOR2I( aRefPos.x, aRefPos.y ) );
809 }
bool Contains(const VECTOR2I &aP, int aSubpolyIndex=-1, bool aIgnoreHoles=false) const
Returns true if a given subpolygon contains the point aP.
VECTOR2< int > VECTOR2I
Definition: vector2d.h:587
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:742
bool ZONE_CONTAINER::HitTestForCorner ( const wxPoint refPos,
SHAPE_POLY_SET::VERTEX_INDEX aCornerHit 
) const

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

Parameters
refPosis the wxPoint to test.
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 678 of file class_zone.cpp.

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

Referenced by PCB_EDIT_FRAME::createPopUpMenuForZones(), HitTest(), HitTestForCorner(), HitTestInsideZone(), and SetSelectedCorner().

680 {
681  int distmax = Millimeter2iu( MAX_DIST_IN_MM );
682 
683  return m_Poly->CollideVertex( VECTOR2I( refPos ), aCornerHit, distmax );
684 }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:587
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:678
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...
#define MAX_DIST_IN_MM
Definition: class_zone.cpp:676
bool ZONE_CONTAINER::HitTestForCorner ( const wxPoint refPos) const

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

Parameters
refPosis the wxPoint to test.
Returns
bool - true if some corner was found to be closer to refPos than aClearance; false otherwise.

Definition at line 687 of file class_zone.cpp.

References dummy(), and HitTestForCorner().

688 {
690  return HitTestForCorner( refPos, dummy );
691 }
Struct VERTEX_INDEX.
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...
bool HitTestForCorner(const wxPoint &refPos, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
Function HitTestForCorner tests if the given wxPoint is near a corner.
Definition: class_zone.cpp:678
bool ZONE_CONTAINER::HitTestForEdge ( const wxPoint refPos,
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.
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 694 of file class_zone.cpp.

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

Referenced by PCB_EDIT_FRAME::createPopUpMenuForZones(), HitTest(), HitTestForEdge(), HitTestInsideZone(), and SetSelectedCorner().

696 {
697  int distmax = Millimeter2iu( MAX_DIST_IN_MM );
698 
699  return m_Poly->CollideEdge( VECTOR2I( refPos ), aCornerHit, distmax );
700 }
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:587
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:678
#define MAX_DIST_IN_MM
Definition: class_zone.cpp:676
bool ZONE_CONTAINER::HitTestForEdge ( const wxPoint refPos) const

Function HitTestForEdge tests if the given wxPoint is near a segment defined by 2 corners.

Parameters
refPosis the wxPoint to test.
Returns
bool - true if some edge was found to be closer to refPos than aClearance.

Definition at line 703 of file class_zone.cpp.

References dummy(), and HitTestForEdge().

704 {
706  return HitTestForEdge( refPos, dummy );
707 }
bool HitTestForEdge(const wxPoint &refPos, 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:694
Struct VERTEX_INDEX.
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...
bool ZONE_CONTAINER::HitTestInsideZone ( const wxPoint aPosition) const
inline

Function HitTest tests if a point is inside the zone area, i.e.

inside the main outline and outside holes.

Parameters
aPosition: the wxPoint to test
Returns
bool - true if a hit, else false

Definition at line 262 of file class_zone.h.

References PNS::angle(), SHAPE_POLY_SET::Contains(), Flip(), HitTest(), HitTestFilledArea(), HitTestForCorner(), HitTestForEdge(), m_Poly, Mirror(), Move(), MoveEdge(), Rotate(), TransformOutlinesShapeWithClearanceToPolygon(), TransformShapeWithClearanceToPolygon(), TransformSolidAreasShapesToPolygonSet(), and UnFill().

Referenced by CN_ANCHOR::IsDangling().

263  {
264  return m_Poly->Contains( VECTOR2I( aPosition ), 0 );
265  }
bool Contains(const VECTOR2I &aP, int aSubpolyIndex=-1, bool aIgnoreHoles=false) const
Returns true if a given subpolygon contains the point aP.
VECTOR2< int > VECTOR2I
Definition: vector2d.h:587
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:678
bool EDA_ITEM::IsBrightened ( ) const
inlineinherited

Definition at line 224 of file base_struct.h.

References BRIGHTENED.

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), KIGFX::GERBVIEW_PAINTER::draw(), and KIGFX::PCB_RENDER_SETTINGS::GetColor().

224 { return m_Flags & BRIGHTENED; }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:135
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
bool BOARD_CONNECTED_ITEM::IsConnected ( ) const
inlineoverridevirtualinherited

>

Function IsConnected() Returns information if the object is derived from BOARD_CONNECTED_ITEM.

Returns
True if the object is of BOARD_CONNECTED_ITEM type, false otherwise.

Reimplemented from BOARD_ITEM.

Definition at line 75 of file board_connected_item.h.

76  {
77  return true;
78  }
bool EDA_ITEM::IsDragging ( ) const
inlineinherited
bool ZONE_CONTAINER::IsFilled ( ) const
inline

Definition at line 195 of file class_zone.h.

References m_IsFilled.

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

195 { return m_IsFilled; }
bool m_IsFilled
True when a zone was filled, false after deleting the filled areas.
Definition: class_zone.h:711
bool EDA_ITEM::IsHighlighted ( ) const
inlineinherited

Definition at line 223 of file base_struct.h.

References HIGHLIGHTED.

223 { return m_Flags & HIGHLIGHTED; }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:134
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
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 194 of file class_board_item.h.

Referenced by DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), EditToolSelectionFilter(), GENERAL_COLLECTOR::Inspect(), PCB_EDITOR_CONTROL::modifyLockSelected(), and PCB_EDIT_FRAME::OnHotkeyDeleteItem().

195  {
196  // only MODULEs & TRACKs can be locked at this time.
197  return false;
198  }
bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 217 of file base_struct.h.

References IS_CHANGED.

Referenced by LIB_EDIT_FRAME::OnEditPin().

217 { return m_Flags & IS_CHANGED; }
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:107
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
bool EDA_ITEM::IsNew ( ) const
inlineinherited

Definition at line 216 of file base_struct.h.

References IS_NEW.

Referenced by Abort_Edit_Pcb_Text(), Abort_EditEdge(), Abort_Move_ModuleOutline(), Abort_MoveOrCopyModule(), Abort_Zone_Create_Outline(), AbortBuildDimension(), AbortMoveAndEditTarget(), abortMoveItem(), AbortPinMove(), AbortSymbolTraceOn(), SCH_EDIT_FRAME::addCurrentItemToScreen(), SCH_EDIT_FRAME::addJunctionMenuEntries(), AddMenusForBus(), AddMenusForWire(), PCB_EDIT_FRAME::Delete_Segment(), PCB_EDIT_FRAME::Delete_Segment_Edge(), SCH_EDIT_FRAME::DeleteCurrentSegment(), LIB_ARC::drawEditGraphics(), LIB_ARC::drawGraphic(), LIB_PIN::EnableEditMode(), LIB_EDIT_FRAME::EndDrawGraphicItem(), SCH_EDIT_FRAME::EndSegment(), ExitSheet(), LIB_PART::LIB_PART(), EDIT_TOOL::MoveExact(), SCH_EDIT_FRAME::OnAutoplaceFields(), SCH_EDIT_FRAME::OnConvertTextType(), LIB_EDIT_FRAME::OnEditPin(), SCH_EDIT_FRAME::OnHotKey(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), FOOTPRINT_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnLeftDClick(), LIB_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnRightClick(), LIB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRotate(), PCB_EDIT_FRAME::Place_Texte_Pcb(), PCB_BASE_FRAME::PlaceModule(), LIB_EDIT_FRAME::PlacePin(), PCB_EDIT_FRAME::PlaceTarget(), SCH_EDIT_FRAME::PrepareMoveItem(), SCH_EDIT_FRAME::ReSizeSheet(), ShowClearance(), PCB_EDIT_FRAME::StartMoveTextePcb(), PCB_EDIT_FRAME::SwitchLayer(), DIALOG_SCH_EDIT_SHEET_PIN::TransferDataFromWindow(), and DIALOG_LABEL_EDITOR::TransferDataFromWindow().

216 { return m_Flags & IS_NEW; }
#define IS_NEW
New item, just created.
Definition: base_struct.h:111
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
bool ZONE_CONTAINER::IsOnCopperLayer ( ) const

Function IsOnCopperLayer.

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

Definition at line 181 of file class_zone.cpp.

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

Referenced by GERBER_JOBFILE_WRITER::addJSONDesignRules(), PCB_EDIT_FRAME::Begin_Zone(), BOARD_NETLIST_UPDATER::cacheCopperZoneConnections(), DRC::doEdgeZoneDrc(), PCB_EDIT_FRAME::End_Zone(), ZONE_FILLER::fillSingleZone(), GetMsgPanelInfo(), GetPriority(), BRDITEMS_PLOTTER::PlotFilledAreas(), BOARD::ReplaceNetlist(), BOARD::SetAreasNetCodesFromNetNames(), PCB_EDIT_FRAME::Start_Move_Zone_Corner(), PCB_EDIT_FRAME::Start_Move_Zone_Outlines(), DRC::testZones(), DRC::TestZoneToZoneOutline(), TransformOutlinesShapeWithClearanceToPolygon(), and BOARD_NETLIST_UPDATER::updateCopperZoneNets().

182 {
183  if( GetIsKeepout() )
184  {
185  return ( m_layerSet & LSET::AllCuMask() ).count() > 0;
186  }
187  else
188  {
189  return IsCopperLayer( GetLayer() );
190  }
191 }
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:673
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:175
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:608
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
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 265 of file class_zone.cpp.

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

Referenced by CINFO3D_VISU::createLayers(), DRC::doTrackKeepoutDrc(), Draw(), KIGFX::PCB_PAINTER::draw(), DrawFilledArea(), DrawWhileCreateOutline(), DSN::SPECCTRA_DB::FromBOARD(), GetPriority(), and DRC::testKeepoutAreas().

266 {
267  if( GetIsKeepout() )
268  {
269  return m_layerSet.test( aLayer );
270  }
271 
272  return BOARD_ITEM::IsOnLayer( aLayer );
273 }
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:608
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_FIELD, SCH_SHEET_PIN, and SCH_TEXT.

Definition at line 461 of file base_struct.h.

References EDA_ITEM::operator<().

Referenced by EDA_ITEM::Matches(), and EDA_ITEM::Replace().

461 { return false; }
bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 222 of file base_struct.h.

References IS_RESIZED.

Referenced by ExitSheet().

222 { return m_Flags & IS_RESIZED; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:112
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 63 of file zones_functions_for_undo_redo.cpp.

References GetArcSegmentCount(), GetDoNotAllowCopperPour(), GetDoNotAllowTracks(), GetDoNotAllowVias(), GetFillMode(), GetIsKeepout(), GetLayer(), GetMinThickness(), BOARD_CONNECTED_ITEM::GetNetCode(), GetPriority(), m_ArcToSegmentsCount, m_FillMode, m_PadConnection, m_Poly, m_ThermalReliefCopperBridge, m_ThermalReliefGap, m_ZoneClearance, m_ZoneMinThickness, and Outline().

Referenced by SetHatchStyle(), and UpdateCopyOfZonesList().

64 {
65  // compare basic parameters:
66  if( GetLayer() != aZoneToCompare.GetLayer() )
67  return false;
68 
69  if( GetNetCode() != aZoneToCompare.GetNetCode() )
70  return false;
71 
72  if( GetPriority() != aZoneToCompare.GetPriority() )
73  return false;
74 
75  // Compare zone specific parameters
76  if( GetIsKeepout() != aZoneToCompare.GetIsKeepout() )
77  return false;
78 
79  if( GetIsKeepout() )
80  {
81  if( GetDoNotAllowCopperPour() != aZoneToCompare.GetDoNotAllowCopperPour() )
82  return false;
83 
84  if( GetDoNotAllowVias() != aZoneToCompare.GetDoNotAllowVias() )
85  return false;
86 
87  if( GetDoNotAllowTracks() != aZoneToCompare.GetDoNotAllowTracks() )
88  return false;
89  }
90 
91  if( m_ArcToSegmentsCount != aZoneToCompare.GetArcSegmentCount() )
92  return false;
93 
94  if( m_ZoneClearance != aZoneToCompare.m_ZoneClearance )
95  return false;
96 
97  if( m_ZoneMinThickness != aZoneToCompare.GetMinThickness() )
98  return false;
99 
100  if( m_FillMode != aZoneToCompare.GetFillMode() )
101  return false;
102 
103  if( m_PadConnection != aZoneToCompare.m_PadConnection )
104  return false;
105 
106  if( m_ThermalReliefGap != aZoneToCompare.m_ThermalReliefGap )
107  return false;
108 
110  return false;
111 
112 
113  // Compare outlines
114  wxASSERT( m_Poly ); // m_Poly == NULL Should never happen
115  wxASSERT( aZoneToCompare.Outline() );
116 
117  if( Outline() != aZoneToCompare.Outline() ) // Compare vector
118  return false;
119 
120  return true;
121 }
int m_ZoneClearance
Clearance value in internal units.
Definition: class_zone.h:703
int GetMinThickness() const
Definition: class_zone.h:204
bool GetDoNotAllowCopperPour() const
Definition: class_zone.h:609
int GetArcSegmentCount() const
Definition: class_zone.h:193
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:175
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:242
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:608
int m_ArcToSegmentsCount
The number of segments to convert a circle to a polygon.
Definition: class_zone.h:708
int m_ThermalReliefCopperBridge
Definition: class_zone.h:717
ZoneConnection m_PadConnection
Definition: class_zone.h:702
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:678
ZONE_FILL_MODE GetFillMode() const
Definition: class_zone.h:181
int GetNetCode() const
Function GetNetCode.
int m_ThermalReliefGap
Width of the copper bridge in thermal reliefs.
Definition: class_zone.h:714
bool GetDoNotAllowTracks() const
Definition: class_zone.h:611
int m_ZoneMinThickness
Minimum thickness value in filled areas.
Definition: class_zone.h:704
ZONE_FILL_MODE m_FillMode
How to fill areas: ZFM_POLYGONS => use filled polygons, ZFM_SEGMENTS => fill with segments...
Definition: class_zone.h:721
bool GetDoNotAllowVias() const
Definition: class_zone.h:610
unsigned GetPriority() const
Function GetPriority.
Definition: class_zone.h:107
bool EDA_ITEM::IsSelected ( ) const
inlineinherited

Definition at line 221 of file base_struct.h.

References SELECTED.

Referenced by SCH_SCREEN::addConnectedItemsToBlock(), AddMenusForPin(), LIB_EDIT_FRAME::BlockCopySelectedItems(), KIGFX::PCB_PAINTER::draw(), LIB_CIRCLE::drawGraphic(), LIB_POLYLINE::drawGraphic(), LIB_RECTANGLE::drawGraphic(), LIB_BEZIER::drawGraphic(), LIB_TEXT::drawGraphic(), LIB_ARC::drawGraphic(), LIB_FIELD::drawGraphic(), DrawMovingBlockOutlines(), LIB_PIN::DrawPinElectricalTypeName(), LIB_PIN::DrawPinSymbol(), LIB_PIN::DrawPinTexts(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), LIB_EDIT_FRAME::GlobalSetPins(), SCH_JUNCTION::IsSelectStateChanged(), SCH_NO_CONNECT::IsSelectStateChanged(), SCH_MARKER::IsSelectStateChanged(), SCH_BUS_ENTRY_BASE::IsSelectStateChanged(), SCH_BITMAP::IsSelectStateChanged(), SCH_LINE::IsSelectStateChanged(), SCH_TEXT::IsSelectStateChanged(), SCH_SHEET::IsSelectStateChanged(), SCH_COMPONENT::IsSelectStateChanged(), MirrorMarkedItems(), MoveMarkedItems(), MoveMarkedItemsExactly(), LIB_TEXT::Plot(), GRID_HELPER::queryVisible(), RotateMarkedItems(), GERBVIEW_SELECTION_TOOL::select(), SELECTION_TOOL::select(), SCH_SCREEN::SelectBlockItems(), GERBVIEW_SELECTION_TOOL::toggleSelection(), SELECTION_TOOL::toggleSelection(), and GERBVIEW_SELECTION_TOOL::unselect().

221 { return m_Flags & SELECTED; }
#define SELECTED
Definition: base_struct.h:118
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
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 185 of file class_board_item.h.

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

Referenced by PCB_EDIT_FRAME::OnHotKey(), and PCB_EDIT_FRAME::OnHotkeyDeleteItem().

186  {
187  return ( Type() == PCB_TRACE_T ) || ( Type() == PCB_VIA_T );
188  }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
bool EDA_ITEM::IsType ( const KICAD_T  aScanTypes[])
inlineinherited

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

Definition at line 263 of file base_struct.h.

References EOT.

264  {
265  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
266  {
267  if( m_StructType == *p )
268  return true;
269  }
270 
271  return false;
272  }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it...
Definition: base_struct.h:160
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
bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 220 of file base_struct.h.

References IS_WIRE_IMAGE.

Referenced by SCH_FIELD::Draw().

220 { return m_Flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:115
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
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 430 of file class_zone.h.

References SHAPE_POLY_SET::Iterate(), and m_Poly.

431  {
432  return m_Poly->Iterate();
433  }
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:678
SEARCH_RESULT EDA_ITEM::IterateForward ( EDA_ITEM listStart,
INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
staticinherited

Function IterateForward walks through the object tree calling the inspector() on each object type requested in scanTypes.

Parameters
listStartThe first in a list of EDA_ITEMs to iterate over.
inspectorIs an INSPECTOR to call on each object that is one of the requested scanTypes.
testDataIs an aid to testFunc, and should be sufficient to allow it to fully determine if an item meets the match criteria, but it may also be used to collect output.
scanTypesA KICAD_T array that is EOT terminated, and provides both the order and interest level of of the types of objects to be iterated over.
Returns
SEARCH_RESULT SEARCH_QUIT if the called INSPECTOR returned SEARCH_QUIT, else SCAN_CONTINUE;

Definition at line 130 of file base_struct.cpp.

References EDA_ITEM::Pnext, SEARCH_CONTINUE, SEARCH_QUIT, and EDA_ITEM::Visit().

Referenced by SCH_COLLECTOR::Collect(), SCH_FIND_COLLECTOR::Collect(), SCH_TYPE_COLLECTOR::Collect(), SCH_FIND_COLLECTOR::GetItem(), EDA_ITEM::HitTest(), GERBER_FILE_IMAGE::Visit(), MODULE::Visit(), and BOARD::Visit().

134 {
135  EDA_ITEM* p = listStart;
136 
137  for( ; p; p = p->Pnext )
138  {
139  if( SEARCH_QUIT == p->Visit( inspector, testData, scanTypes ) )
140  return SEARCH_QUIT;
141  }
142 
143  return SEARCH_CONTINUE;
144 }
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...
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:151
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:164
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 440 of file class_zone.h.

References SHAPE_POLY_SET::IterateWithHoles(), and m_Poly.

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

441  {
442  return m_Poly->IterateWithHoles();
443  }
ITERATOR IterateWithHoles(int aOutline)
Function IterateWithHoles.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:678
virtual bool EDA_ITEM::Matches ( wxFindReplaceData &  aSearchData,
void *  aAuxData,
wxPoint aFindLocation 
)
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.
aFindLocationA pointer to a wxPoint object to store the location of matched item. The pointer can be NULL if it is not used.
Returns
True if the item's text matches the search criteria in aSearchData.

Reimplemented in SCH_COMPONENT, SCH_SHEET, SCH_SHEET_PIN, SCH_FIELD, SCH_TEXT, LIB_PIN, and SCH_MARKER.

Definition at line 417 of file base_struct.h.

References EDA_ITEM::Replace().

Referenced by SCH_FIND_COLLECTOR::Inspect(), SCH_MARKER::Matches(), LIB_PIN::Matches(), SCH_TEXT::Matches(), SCH_FIELD::Matches(), SCH_SHEET_PIN::Matches(), SCH_SHEET::Matches(), and EDA_ITEM::Sort().

418  {
419  return false;
420  }
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 182 of file base_struct.cpp.

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

183 {
184  wxString text = aText;
185  wxString searchText = aSearchData.GetFindString();
186 
187  // Don't match if searching for replaceable item and the item doesn't support text replace.
188  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
189  return false;
190 
191  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
192  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
193 
194  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
195  {
196  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
197  return text.Matches( searchText );
198 
199  return text.MakeUpper().Matches( searchText.MakeUpper() );
200  }
201 
202  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
203  return aText.Find( searchText ) != wxNOT_FOUND;
204 
205  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
206 }
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:461
Perform search using simple wild card matching (* & ?).
Perform a search for a item that has replaceable text.
void ZONE_CONTAINER::Mirror ( const wxPoint mirror_ref)

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

Parameters
mirror_ref= vertical axis position

Definition at line 972 of file class_zone.cpp.

References Hatch(), SHAPE_POLY_SET::Iterate(), SHAPE_POLY_SET::IterateWithHoles(), m_FilledPolysList, m_FillSegmList, m_Poly, MIRROR(), and wxPoint::y.

Referenced by Flip(), and HitTestInsideZone().

973 {
974  for( auto iterator = m_Poly->IterateWithHoles(); iterator; iterator++ )
975  {
976  int py = mirror_ref.y - iterator->y;
977  iterator->y = py + mirror_ref.y;
978  }
979 
980  Hatch();
981 
982  for( auto ic = m_FilledPolysList.Iterate(); ic; ++ic )
983  {
984  int py = mirror_ref.y - ic->y;
985  ic->y = py + mirror_ref.y;
986  }
987 
988  for( unsigned ic = 0; ic < m_FillSegmList.size(); ic++ )
989  {
990  MIRROR( m_FillSegmList[ic].A.y, mirror_ref.y );
991  MIRROR( m_FillSegmList[ic].B.y, mirror_ref.y );
992  }
993 }
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:732
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...
void MIRROR(T &aPoint, const T &aMirrorRef)
Definition: macros.h:111
ITERATOR IterateWithHoles(int aOutline)
Function IterateWithHoles.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:678
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:742
void Hatch()
Function Hatch computes the hatch lines depending on the hatch parameters and stores it in the zone&#39;s...
void BOARD_ITEM::Move ( const VECTOR2I aMoveVector)
inlineinherited

Definition at line 240 of file class_board_item.h.

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

241  {
242  Move( wxPoint( aMoveVector.x, aMoveVector.y ) );
243  }
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.
void ZONE_CONTAINER::Move ( const wxPoint offset)
overridevirtual

Function Move Move the outlines.

Parameters
offset= moving vector

Reimplemented from BOARD_ITEM.

Definition at line 896 of file class_zone.cpp.

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

Referenced by Abort_Zone_Move_Corner_Or_Outlines(), HitTestInsideZone(), and Show_Zone_Corner_Or_Outline_While_Move_Mouse().

897 {
898  /* move outlines */
899  m_Poly->Move( VECTOR2I( offset ) );
900 
901  Hatch();
902 
903  m_FilledPolysList.Move( VECTOR2I( offset.x, offset.y ) );
904 
905  for( unsigned ic = 0; ic < m_FillSegmList.size(); ic++ )
906  {
907  m_FillSegmList[ic].A += VECTOR2I(offset);
908  m_FillSegmList[ic].B += VECTOR2I(offset);
909  }
910 }
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:732
VECTOR2< int > VECTOR2I
Definition: vector2d.h:587
void Move(const VECTOR2I &aVector) override
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:678
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:742
void Hatch()
Function Hatch computes the hatch lines depending on the hatch parameters and stores it in the zone&#39;s...
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 913 of file class_zone.cpp.

References SHAPE_POLY_SET::GetNeighbourIndexes(), Hatch(), m_Poly, and SHAPE_POLY_SET::Vertex().

Referenced by Abort_Zone_Move_Corner_Or_Outlines(), HitTestInsideZone(), and Show_Zone_Corner_Or_Outline_While_Move_Mouse().

914 {
915  int next_corner;
916 
917  if( m_Poly->GetNeighbourIndexes( aEdge, nullptr, &next_corner ) )
918  {
919  m_Poly->Vertex( aEdge ) += VECTOR2I( offset );
920  m_Poly->Vertex( next_corner ) += VECTOR2I( offset );
921  Hatch();
922  }
923 }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:587
VECTOR2I & Vertex(int aIndex, int aOutline, int aHole)
Returns the index-th vertex in a given hole outline within a given outline
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...
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:678
void Hatch()
Function Hatch computes the hatch lines depending on the hatch parameters and stores it in the zone&#39;s...
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 489 of file class_zone.h.

References AppendCorner(), m_Poly, and SHAPE_POLY_SET::NewHole().

490  {
491  m_Poly->NewHole();
492  }
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:678
BOARD_ITEM* BOARD_ITEM::Next ( ) const
inlineinherited

Definition at line 116 of file class_board_item.h.

References EDA_ITEM::Pnext.

Referenced by DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), CINFO3D_VISU::AddGraphicsShapesWithClearanceToContainer(), PCB_EDIT_FRAME::AppendBoardFile(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), MODULE::BuildPolyCourtyard(), BOARD::ComputeBoundingBox(), BOARD::ConvertBrdLayerToPolygonalContours(), CopyMarkedItems(), DeleteMarkedItems(), PYTHON_ACTION_PLUGINS::deregister_action(), PCB_EDIT_FRAME::DoGenFootprintsReport(), MODULE::Draw(), BOARD::Draw(), MODULE::DrawEdgesOnly(), DrawMovingBlockOutlines(), FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer(), FOOTPRINT_EDIT_FRAME::Edit_Edge_Width(), PCB_EDIT_FRAME::Exchange_Module(), export_vrml_module(), MODULE::Flip(), PCB_IO::format(), MODULE::GetAllDrawingLayers(), MODULE::GetBoundingBox(), PCB_BASE_FRAME::GetFootprintFromBoardByReference(), MODULE::GetFootprintRect(), getMatchingTextItem(), MODULE::HitTest(), PCB_EDIT_FRAME::ImportSpecctraSession(), MirrorMarkedItems(), MODULE::MODULE(), MODULE::MoveAnchorPosition(), MODULE::operator=(), BRDITEMS_PLOTTER::Plot_Edges_Modules(), BRDITEMS_PLOTTER::PlotAllTextsModule(), PlotSolderMaskLayer(), PlotStandardLayer(), Print_Module(), FOOTPRINT_EDIT_FRAME::PrintPage(), FOOTPRINT_EDIT_FRAME::RedrawActiveWindow(), RotateMarkedItems(), MODULE::RunOnChildren(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), MODULE::SetOrientation(), MODULE::SetPosition(), PCB_EDIT_FRAME::ShowBoardSetupDialog(), PCB_EDIT_FRAME::Swap_Layers(), SwapItemData(), DRC::testCopperTextAndGraphics(), TestForExistingItem(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), CINFO3D_VISU::transformGraphicModuleEdgeToPolygonSet(), and MODULE::ViewGetLayers().

116 { return static_cast<BOARD_ITEM*>( Pnext ); }
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:164
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 239 of file base_struct.cpp.

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

Referenced by EDA_ITEM::IsReplaceable(), and LIB_ALIAS::operator==().

240 {
241  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
242  GetChars( GetClass() ) ) );
243 
244  return false;
245 }
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:92
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
ZONE_CONTAINER & ZONE_CONTAINER::operator= ( const ZONE_CONTAINER aOther)

Definition at line 113 of file class_zone.cpp.

References SHAPE_POLY_SET::Append(), GetHatchPitch(), GetHatchStyle(), GetLayerSet(), m_ArcToSegmentsCount, m_CornerSelection, m_FilledPolysList, m_FillMode, m_FillSegmList, m_HatchLines, m_PadConnection, m_Poly, m_ThermalReliefCopperBridge, m_ThermalReliefGap, m_ZoneClearance, m_ZoneMinThickness, EDA_ITEM::operator=(), SHAPE_POLY_SET::RemoveAllContours(), SetHatchPitch(), SetHatchStyle(), and SetLayerSet().

114 {
116 
117  // Replace the outlines for aOther outlines.
118  delete m_Poly;
119  m_Poly = new SHAPE_POLY_SET( *aOther.m_Poly );
120 
121  m_CornerSelection = nullptr; // for corner moving, corner index to (null if no selection)
122  m_ZoneClearance = aOther.m_ZoneClearance; // clearance value
124  m_FillMode = aOther.m_FillMode; // filling mode (segments/polygons)
129  SetHatchStyle( aOther.GetHatchStyle() );
130  SetHatchPitch( aOther.GetHatchPitch() );
131  m_HatchLines = aOther.m_HatchLines; // copy vector <SEG>
134  m_FillSegmList.clear();
136 
137  SetLayerSet( aOther.GetLayerSet() );
138 
139  return *this;
140 }
void SetHatchPitch(int aPitch)
Function SetHatchPitch sets the hatch pitch parameter for the zone.
int m_ZoneClearance
Clearance value in internal units.
Definition: class_zone.h:703
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:724
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:732
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:230
void SetLayerSet(LSET aLayerSet)
Definition: class_zone.cpp:210
int m_ArcToSegmentsCount
The number of segments to convert a circle to a polygon.
Definition: class_zone.h:708
int m_ThermalReliefCopperBridge
Definition: class_zone.h:717
std::vector< SEG > m_HatchLines
Definition: class_zone.h:747
ZoneConnection m_PadConnection
Definition: class_zone.h:702
Class SHAPE_POLY_SET.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:678
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:742
int m_ThermalReliefGap
Width of the copper bridge in thermal reliefs.
Definition: class_zone.h:714
int m_ZoneMinThickness
Minimum thickness value in filled areas.
Definition: class_zone.h:704
ZONE_FILL_MODE m_FillMode
How to fill areas: ZFM_POLYGONS => use filled polygons, ZFM_SEGMENTS => fill with segments...
Definition: class_zone.h:721
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.
HATCH_STYLE GetHatchStyle() const
Definition: class_zone.h:504
void SetHatchStyle(HATCH_STYLE aStyle)
Definition: class_zone.h:509
int GetHatchPitch() const
Hatch related methods.
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) ...
const SHAPE_POLY_SET* ZONE_CONTAINER::Outline ( ) const
inline

Definition at line 243 of file class_zone.h.

References m_Poly.

243 { return const_cast< SHAPE_POLY_SET* >( m_Poly ); }
Class SHAPE_POLY_SET.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:678
SHAPE_POLY_SET& ZONE_CONTAINER::RawPolysList ( )
inline

Definition at line 594 of file class_zone.h.

References Clone(), GetMenuImage(), GetSelectMenuText(), and m_RawPolysList.

595  {
596  return m_RawPolysList;
597  }
SHAPE_POLY_SET m_RawPolysList
Definition: class_zone.h:743
void ZONE_CONTAINER::RemoveAllContours ( void  )
inline

Definition at line 455 of file class_zone.h.

References m_Poly, and SHAPE_POLY_SET::RemoveAllContours().

Referenced by Abort_Zone_Create_Outline(), PCB_EDIT_FRAME::Begin_Zone(), PCB_EDIT_FRAME::Delete_LastCreatedCorner(), and PCB_EDIT_FRAME::End_Zone().

456  {
458  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:678
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.
bool EDA_ITEM::Replace ( wxFindReplaceData &  aSearchData,
wxString &  aText 
)
inherited

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

References GetChars(), EDA_ITEM::GetClass(), EDA_ITEM::IsReplaceable(), and traceFindReplace.

Referenced by EDA_ITEM::Matches(), SCH_TEXT::Replace(), SCH_FIELD::Replace(), SCH_SHEET_PIN::Replace(), SCH_SHEET::Replace(), and SCH_FIND_COLLECTOR::ReplaceItem().

210 {
211  wxCHECK_MSG( IsReplaceable(), false,
212  wxT( "Attempt to replace text in <" ) + GetClass() + wxT( "> item." ) );
213 
214  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
215 
216  int result = searchString.Find( (aSearchData.GetFlags() & wxFR_MATCHCASE) ?
217  aSearchData.GetFindString() :
218  aSearchData.GetFindString().Upper() );
219 
220  if( result == wxNOT_FOUND )
221  return false;
222 
223  wxString prefix = aText.Left( result );
224  wxString suffix;
225 
226  if( aSearchData.GetFindString().length() + result < aText.length() )
227  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
228 
229  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
230  GetChars( aText ), GetChars( prefix ), GetChars( aSearchData.GetReplaceString() ),
231  GetChars( suffix ) );
232 
233  aText = prefix + aSearchData.GetReplaceString() + suffix;
234 
235  return true;
236 }
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:461
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:92
virtual wxString GetClass() const =0
Function GetClass returns the class name.
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_SHEET, SCH_SHEET_PIN, SCH_FIELD, and SCH_TEXT.

Definition at line 449 of file base_struct.h.

449 { return false; }
void BOARD_ITEM::Rotate ( const VECTOR2I aRotCentre,
double  aAngle 
)
inlineinherited

Definition at line 256 of file class_board_item.h.

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

257  {
258  Rotate( wxPoint( aRotCentre.x, aRotCentre.y ), aAngle );
259  }
virtual void Rotate(const wxPoint &aRotCentre, double aAngle)
Function Rotate Rotate this object.
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 926 of file class_zone.cpp.

References Hatch(), SHAPE_POLY_SET::Iterate(), SHAPE_POLY_SET::IterateWithHoles(), m_FilledPolysList, m_FillSegmList, m_Poly, RotatePoint(), wxPoint::x, and wxPoint::y.

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

927 {
928  wxPoint pos;
929 
930  for( auto iterator = m_Poly->IterateWithHoles(); iterator; iterator++ )
931  {
932  pos = static_cast<wxPoint>( *iterator );
933  RotatePoint( &pos, centre, angle );
934  iterator->x = pos.x;
935  iterator->y = pos.y;
936  }
937 
938  Hatch();
939 
940  /* rotate filled areas: */
941  for( auto ic = m_FilledPolysList.Iterate(); ic; ++ic )
942  RotatePoint( &ic->x, &ic->y, centre.x, centre.y, angle );
943 
944  for( unsigned ic = 0; ic < m_FillSegmList.size(); ic++ )
945  {
946  wxPoint a( m_FillSegmList[ic].A );
947  RotatePoint( &a, centre, angle );
948  m_FillSegmList[ic].A = a;
949  wxPoint b( m_FillSegmList[ic].B );
950  RotatePoint( &b, centre, angle );
951  m_FillSegmList[ic].B = a;
952  }
953 }
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:216
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:732
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...
ITERATOR IterateWithHoles(int aOutline)
Function IterateWithHoles.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:678
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:742
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
void Hatch()
Function Hatch computes the hatch lines depending on the hatch parameters and stores it in the zone&#39;s...
void ZONE_CONTAINER::SetArcSegmentCount ( int  aArcSegCount)
inline

Definition at line 192 of file class_zone.h.

References m_ArcToSegmentsCount.

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

192 { m_ArcToSegmentsCount = aArcSegCount; }
int m_ArcToSegmentsCount
The number of segments to convert a circle to a polygon.
Definition: class_zone.h:708
void EDA_ITEM::SetBack ( EDA_ITEM aBack)
inlineinherited

Definition at line 212 of file base_struct.h.

Referenced by DHEAD::append(), DHEAD::insert(), SCH_EDIT_FRAME::PutDataInPreviousState(), DHEAD::remove(), and SwapItemData().

212 { Pback = aBack; }
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:165
void EDA_ITEM::SetBrightened ( )
inlineinherited

Definition at line 229 of file base_struct.h.

References BRIGHTENED, and EDA_ITEM::SetFlags().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), and SELECTION_TOOL::highlight().

229 { SetFlags( BRIGHTENED ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:253
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:135
void ZONE_CONTAINER::SetCornerPosition ( int  aCornerIndex,
wxPoint  new_pos 
)
inline

Definition at line 471 of file class_zone.h.

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

Referenced by Show_New_Edge_While_Move_Mouse().

472  {
473  SHAPE_POLY_SET::VERTEX_INDEX relativeIndices;
474 
475  // Convert global to relative indices
476  if( m_Poly->GetRelativeIndices( aCornerIndex, &relativeIndices ) )
477  {
478  m_Poly->Vertex( relativeIndices ).x = new_pos.x;
479  m_Poly->Vertex( relativeIndices ).y = new_pos.y;
480  }
481  else
482  throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
483  }
Struct VERTEX_INDEX.
VECTOR2I & Vertex(int aIndex, int aOutline, int aHole)
Returns the index-th vertex in a given hole outline within a given outline
bool GetRelativeIndices(int aGlobalIdx, VERTEX_INDEX *aRelativeIndices) const
Function GetRelativeIndices.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:678
void ZONE_CONTAINER::SetCornerRadius ( unsigned int  aRadius)

Definition at line 646 of file class_zone.cpp.

References m_cornerRadius.

Referenced by ZONE_SETTINGS::ExportSetting(), and GetCornerSmoothingType().

647 {
648  m_cornerRadius = aRadius;
649 }
unsigned int m_cornerRadius
Definition: class_zone.h:680
void ZONE_CONTAINER::SetCornerSmoothingType ( int  aType)
inline

Definition at line 574 of file class_zone.h.

References m_cornerSmoothingType.

Referenced by ZONE_SETTINGS::ExportSetting().

574 { m_cornerSmoothingType = aType; };
int m_cornerSmoothingType
Definition: class_zone.h:679
void ZONE_CONTAINER::SetDoNotAllowCopperPour ( bool  aEnable)
inline
void ZONE_CONTAINER::SetDoNotAllowTracks ( bool  aEnable)
inline
void ZONE_CONTAINER::SetDoNotAllowVias ( bool  aEnable)
inline
void ZONE_CONTAINER::SetFilledPolysList ( SHAPE_POLY_SET aPolysList)
inline

Function SetFilledPolysList sets the list of filled polygons.

Definition at line 551 of file class_zone.h.

References m_FilledPolysList.

Referenced by ZONE_FILLER::Fill(), and PlotSolderMaskLayer().

552  {
553  m_FilledPolysList = aPolysList;
554  }
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:742
void ZONE_CONTAINER::SetFillMode ( ZONE_FILL_MODE  aFillMode)
inline

Definition at line 180 of file class_zone.h.

References m_FillMode.

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

180 { m_FillMode = aFillMode; }
ZONE_FILL_MODE m_FillMode
How to fill areas: ZFM_POLYGONS => use filled polygons, ZFM_SEGMENTS => fill with segments...
Definition: class_zone.h:721
void ZONE_CONTAINER::SetFillSegments ( const ZONE_SEGMENT_FILL aSegments)
inline

Definition at line 589 of file class_zone.h.

References m_FillSegmList.

Referenced by ZONE_FILLER::Fill().

590  {
591  m_FillSegmList = aSegments;
592  }
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:732
void EDA_ITEM::SetFlags ( STATUS_FLAGS  aMask)
inlineinherited

Definition at line 253 of file base_struct.h.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), SCH_SCREEN::addConnectedItemsToBlock(), PCB_BASE_FRAME::AddModuleToBoard(), AddSegmentToDragList(), PCBNEW_CONTROL::AppendBoard(), PCB_EDIT_FRAME::AppendBoardFile(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Route(), PCB_EDIT_FRAME::Begin_Zone(), PCB_EDIT_FRAME::BeginMoveDimensionText(), PCB_EDIT_FRAME::BeginMoveTarget(), SCH_EDIT_FRAME::BeginSegment(), LIB_EDIT_FRAME::BlockCopySelectedItems(), PCB_EDIT_FRAME::Change_Side_Module(), SCH_EDIT_FRAME::ConvertPart(), SCH_EDIT_FRAME::copyBlockItems(), CopyMarkedItems(), LIB_EDIT_FRAME::copySelectedItems(), SCH_EDIT_FRAME::CreateBusBusEntry(), SCH_EDIT_FRAME::CreateBusWireEntry(), SCH_EDIT_FRAME::CreateNewImage(), SCH_EDIT_FRAME::CreateNewText(), LIB_EDIT_FRAME::CreatePin(), SCH_EDIT_FRAME::CreateSheet(), SCH_EDIT_FRAME::CreateSheetPin(), PCB_EDIT_FRAME::CreateTarget(), PCB_EDIT_FRAME::CreateTextePcb(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), SCH_EDIT_FRAME::DeleteItem(), DrawMovingBlockOutlines(), PCB_EDIT_FRAME::EditDimension(), PCB_EDIT_FRAME::FlipTextePcb(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), SCH_SCREEN::GetConnection(), FOOTPRINT_EDIT_FRAME::HandleBlockEnd(), SCH_EDIT_FRAME::HandleBlockPlace(), PCB_BASE_FRAME::Import_Pad_Settings(), SCH_EDIT_FRAME::ImportSheetPin(), SCH_JUNCTION::IsSelectStateChanged(), SCH_NO_CONNECT::IsSelectStateChanged(), SCH_MARKER::IsSelectStateChanged(), SCH_BUS_ENTRY_BASE::IsSelectStateChanged(), SCH_BITMAP::IsSelectStateChanged(), SCH_LINE::IsSelectStateChanged(), SCH_TEXT::IsSelectStateChanged(), SCH_SHEET::IsSelectStateChanged(), SCH_COMPONENT::IsSelectStateChanged(), SCH_EDIT_FRAME::Load_Component(), SCH_SCREEN::MarkConnections(), MarkItemsInBloc(), SCH_EDIT_FRAME::OnConvertTextType(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), LIB_EDIT_FRAME::OnEditPin(), SCH_EDIT_FRAME::OnSelectUnit(), KIGFX::ORIGIN_VIEWITEM::ORIGIN_VIEWITEM(), PCB_EDIT_FRAME::Other_Layer_Route(), DRAWING_TOOL::PlaceText(), SCH_EDIT_FRAME::PrepareMoveItem(), LIB_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), SCH_EDIT_FRAME::ReSizeSheet(), PCB_BASE_FRAME::Rotate_Module(), PCB_EDIT_FRAME::Rotate_Texte_Pcb(), LIB_EDIT_FRAME::SaveCopyInUndoList(), SCH_SCREEN::SelectBlockItems(), EDA_ITEM::SetBrightened(), LIB_PIN::SetConversion(), BLOCK_SELECTOR::SetFlags(), EDA_ITEM::SetHighlighted(), EDA_ITEM::SetModified(), EDA_ITEM::SetSelected(), EDA_ITEM::SetWireImage(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::Start_Move_DrawItem(), FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod(), PCB_EDIT_FRAME::Start_Move_Zone_Corner(), PCB_EDIT_FRAME::Start_Move_Zone_Drag_Outline_Edge(), PCB_EDIT_FRAME::Start_Move_Zone_Outlines(), PCB_EDIT_FRAME::StartMoveModule(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), PCB_BASE_FRAME::StartMovePad(), LIB_EDIT_FRAME::StartMovePin(), PCB_BASE_FRAME::StartMoveTexteModule(), PCB_EDIT_FRAME::StartMoveTextePcb(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and UndrawAndMarkSegmentsToDrag().

253 { m_Flags |= aMask; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
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 282 of file base_struct.h.

Referenced by SCH_EDIT_FRAME::OnFindSchematicItem(), and SCH_EDIT_FRAME::updateFindReplaceView().

282 { m_forceVisible = aEnable; }
bool m_forceVisible
Set to true to override the visibility setting of the item.
Definition: base_struct.h:172
void ZONE_CONTAINER::SetHatch ( int  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 1069 of file class_zone.cpp.

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

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

1070 {
1071  SetHatchPitch( aHatchPitch );
1072  m_hatchStyle = (ZONE_CONTAINER::HATCH_STYLE) aHatchStyle;
1073 
1074  if( aRebuildHatch )
1075  Hatch();
1076 }
void SetHatchPitch(int aPitch)
Function SetHatchPitch sets the hatch pitch parameter for the zone.
HATCH_STYLE
Zone hatch styles.
Definition: class_zone.h:67
HATCH_STYLE m_hatchStyle
Definition: class_zone.h:745
void Hatch()
Function Hatch computes the hatch lines depending on the hatch parameters and stores it in the zone&#39;s...
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 1079 of file class_zone.cpp.

References m_hatchPitch.

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

1080 {
1081  m_hatchPitch = aPitch;
1082 }
void ZONE_CONTAINER::SetHatchStyle ( HATCH_STYLE  aStyle)
inline

Definition at line 509 of file class_zone.h.

References IsSame(), and m_hatchStyle.

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

510  {
511  m_hatchStyle = aStyle;
512  }
HATCH_STYLE m_hatchStyle
Definition: class_zone.h:745
void EDA_ITEM::SetHighlighted ( )
inlineinherited

Definition at line 228 of file base_struct.h.

References HIGHLIGHTED, and EDA_ITEM::SetFlags().

228 { SetFlags( HIGHLIGHTED ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:253
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:134
void ZONE_CONTAINER::SetHV45 ( bool  aConstrain)
inline

Definition at line 668 of file class_zone.h.

References m_hv45, and SwapData().

Referenced by ZONE_SETTINGS::ExportSetting().

668 { m_hv45 = aConstrain; }
void ZONE_CONTAINER::SetIsFilled ( bool  isFilled)
inline

Definition at line 196 of file class_zone.h.

References m_IsFilled.

Referenced by ZONE_FILLER::Fill().

196 { m_IsFilled = isFilled; }
bool m_IsFilled
True when a zone was filled, false after deleting the filled areas.
Definition: class_zone.h:711
void ZONE_CONTAINER::SetIsKeepout ( bool  aEnable)
inline
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 202 of file class_zone.cpp.

References BOARD_ITEM::m_Layer, and SetLayerSet().

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

203 {
204  SetLayerSet( LSET( aLayer ) );
205 
206  m_Layer = aLayer;
207 }
PCB_LAYER_ID m_Layer
void SetLayerSet(LSET aLayerSet)
Definition: class_zone.cpp:210
Class LSET is a set of PCB_LAYER_IDs.
void ZONE_CONTAINER::SetLayerSet ( LSET  aLayerSet)

Definition at line 210 of file class_zone.cpp.

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

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

211 {
212  if( GetIsKeepout() )
213  {
214  // Keepouts can only exist on copper layers
215  aLayerSet &= LSET::AllCuMask();
216  }
217 
218  if( aLayerSet.count() == 0 )
219  {
220  return;
221  }
222 
223  m_layerSet = aLayerSet;
224 
225  // Set the single layer to the first selected layer
226  m_Layer = aLayerSet.Seq()[0];
227 }
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:673
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:608
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:364
PCB_LAYER_ID m_Layer
void EDA_ITEM::SetList ( DHEAD aList)
inlineinherited

Definition at line 214 of file base_struct.h.

Referenced by DHEAD::append(), DHEAD::insert(), DHEAD::remove(), and SwapItemData().

214 { m_List = aList; }
DHEAD * m_List
which DLIST I am on.
Definition: base_struct.h:166
void ZONE_CONTAINER::SetLocalFlags ( int  aFlags)
inline

Definition at line 237 of file class_zone.h.

References m_localFlgs.

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

237 { m_localFlgs = aFlags; }
int m_localFlgs
Variable used in polygon calculations.
Definition: class_zone.h:727
void BOARD_CONNECTED_ITEM::SetLocalRatsnestVisible ( bool  aVisible)
inlineinherited

Definition at line 183 of file board_connected_item.h.

References BOARD_CONNECTED_ITEM::m_localRatsnestVisible.

184  {
185  m_localRatsnestVisible = aVisible;
186  }
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 204 of file class_board_item.h.

References BOARD_ITEM::DeleteStructure(), BOARD_ITEM::ShowShape(), and BOARD_ITEM::UnLink().

205  {
206  // only MODULEs & TRACKs can be locked at this time.
207  }
void ZONE_CONTAINER::SetMinThickness ( int  aMinThickness)
inline

Definition at line 205 of file class_zone.h.

References m_ZoneMinThickness.

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

205 { m_ZoneMinThickness = aMinThickness; }
int m_ZoneMinThickness
Minimum thickness value in filled areas.
Definition: class_zone.h:704
void EDA_ITEM::SetModified ( )
inherited
void BOARD_CONNECTED_ITEM::SetNet ( NETINFO_ITEM aNetInfo)
inlineinherited

Function SetNet Sets a NET_INFO object for the item.

Definition at line 93 of file board_connected_item.h.

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

94  {
95  assert( aNetInfo->GetBoard() == GetBoard() );
96  m_netinfo = aNetInfo;
97  }
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
bool BOARD_CONNECTED_ITEM::SetNetCode ( int  aNetCode,
bool  aNoAssert = false 
)
inherited

Function SetNetCode 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

Definition at line 46 of file board_connected_item.cpp.

References BOARD::FindNet(), BOARD_ITEM::GetBoard(), BOARD_CONNECTED_ITEM::m_netinfo, and NETINFO_LIST::ORPHANED_ITEM.

Referenced by PNS_KICAD_IFACE::AddItem(), PCAD2KICAD::PCB_LINE::AddToBoard(), PCAD2KICAD::PCB_PAD::AddToBoard(), PCAD2KICAD::PCB_POLYGON::AddToBoard(), PCAD2KICAD::PCB_PAD::AddToModule(), PCB_EDIT_FRAME::Begin_Zone(), D_PAD::CopyNetlistSettings(), BOARD_NETLIST_UPDATER::deleteSinglePadNets(), DRAWING_TOOL::DrawVia(), PCB_EDIT_FRAME::Edit_Zone_Params(), ZONE_SETTINGS::ExportSetting(), AR_AUTOPLACER::genPlacementRoutingMatrix(), BOARD_CONNECTED_ITEM::GetNetCode(), BOARD::InsertArea(), EAGLE_PLUGIN::loadPlain(), EAGLE_PLUGIN::loadSignals(), LEGACY_PLUGIN::loadTrackList(), DSN::SPECCTRA_DB::makeTRACK(), PCB_EDIT_FRAME::Other_Layer_Route(), BOARD::ReplaceNetlist(), CLIPBOARD_IO::SaveSelection(), BOARD::SetAreasNetCodesFromNetNames(), DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::transferDataToPad(), and ZONE_CONTAINER().

47 {
48  // if aNetCode < 0 ( typically NETINFO_LIST::FORCE_ORPHANED )
49  // or no parent board,
50  // set the m_netinfo to the dummy NETINFO_LIST::ORPHANED
51 
52  BOARD* board = GetBoard();
53  //auto connectivity = board ? board->GetConnectivity() : nullptr;
54  //bool addRatsnest = false;
55 
56  //if( connectivity )
57  //addRatsnest = connectivity->Remove( this );
58 
59  if( ( aNetCode >= 0 ) && board )
60  m_netinfo = board->FindNet( aNetCode );
61  else
63 
64  if( !aNoAssert )
65  assert( m_netinfo );
66 
67  // Add only if it was previously added to the ratsnest
68  //if( addRatsnest )
69  // connectivity->Add( this );
70 
71  return ( m_netinfo != NULL );
72 }
static NETINFO_ITEM ORPHANED_ITEM
NETINFO_ITEM meaning that there was no net assigned for an item, as there was no board storing net li...
Definition: netinfo.h:477
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: cl