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 wxPointGetPosition () 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 (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 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 1/10000 inches. More...
 
void TestForCopperIslandAndRemoveInsulatedIslands (BOARD *aPcb)
 Function TestForCopperIslandAndRemoveInsulatedIslands Remove insulated copper islands found in m_FilledPolysList. More...
 
bool IsOnCopperLayer () const
 Function IsOnCopperLayer. More...
 
void SetFillMode (int aFillMode)
 How to fill areas: 0 = use filled polygons, 1 => fill with segments. More...
 
int 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)
 
std::vector< SEGMENT > & FillSegments ()
 
const std::vector< SEGMENT > & FillSegments () 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...
 
bool BuildFilledSolidAreasPolygons (BOARD *aPcb, SHAPE_POLY_SET *aOutlineBuffer=NULL)
 Function BuildFilledSolidAreasPolygons Build the filled solid areas data from real outlines (stored in m_Poly) The solid areas can be more than one on copper layers, and do not have holes ( holes are linked by overlapping segments to the main outline) in order to have drawable (and plottable) filled polygons. More...
 
void AddClearanceAreasPolygonsToPolysList (BOARD *aPcb)
 Function AddClearanceAreasPolygonsToPolysList Add non copper areas polygons (pads and tracks with clearance) to a filled copper area used in BuildFilledSolidAreasPolygons when calculating filled areas in a zone Non copper areas are pads and track and their clearance area The filled copper area must be computed before BuildFilledSolidAreasPolygons() call this function just after creating the filled copper area polygon (without clearance areas. More...
 
void AddClearanceAreasPolygonsToPolysList_NG (BOARD *aPcb)
 Function AddClearanceAreasPolygonsToPolysList Supports a min thickness area constraint. More...
 
void TransformOutlinesShapeWithClearanceToPolygon (SHAPE_POLY_SET &aCornerBuffer, int aMinClearanceValue, bool aUseNetClearance)
 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...
 
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 FillZoneAreasWithSegments ()
 Function FillZoneAreasWithSegments Fill sub areas in a zone with segments with m_ZoneMinThickness width A scan is made line per line, on the whole filled areas, with a step of m_ZoneMinThickness. More...
 
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...
 
void AppendCorner (wxPoint position, bool aAllowDuplication=false)
 Function AppendCorner. 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 AddFilledPolysList (SHAPE_POLY_SET &aPolysList)
 Function AddFilledPolysList sets the list of filled polygons. More...
 
SHAPE_POLY_SETGetSmoothedPoly () 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 AddFilledPolygon (SHAPE_POLY_SET &aPolygon)
 add a polygon to the zone filled areas list. More...
 
void AddFillSegments (std::vector< SEGMENT > &aSegments)
 
wxString GetSelectMenuText () 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 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...
 
int GetSubNet () const
 Function GetSubNet. More...
 
void SetSubNet (int aSubNetCode)
 
int GetZoneSubNet () const
 Function GetZoneSubNet. More...
 
void SetZoneSubNet (int aSubNetCode)
 
const wxString & GetNetname () const
 Function GetNetname. 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...
 
virtual const wxPoint GetCenter () const
 Function GetCenter() More...
 
BOARD_ITEMNext () const
 
BOARD_ITEMBack () const
 
BOARD_ITEM_CONTAINERGetParent () const
 
PCB_LAYER_ID GetLayer () const
 Function GetLayer returns the primary layer this item is on. More...
 
virtual LSET GetLayerSet () const
 Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segment or VIA physically resides. More...
 
virtual void SetLayer (PCB_LAYER_ID aLayer)
 Function SetLayer sets the layer this item is on. More...
 
void SwapData (BOARD_ITEM *aImage)
 Swap data between aItem and aImage. More...
 
virtual bool IsOnLayer (PCB_LAYER_ID aLayer) const
 Function IsOnLayer tests to see if this object is on the given layer. More...
 
bool IsTrack () const
 Function IsTrack tests to see if this object is a track or via (or microvia). More...
 
virtual bool IsLocked () const
 Function IsLocked. More...
 
virtual void SetLocked (bool aLocked)
 Function SetLocked modifies 'lock' status for of the item. More...
 
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...
 
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...
 
virtual void ViewGetLayers (int aLayers[], int &aCount) const override
 
KICAD_T Type () const
 Function Type() More...
 
void SetTimeStamp (time_t aNewTimeStamp)
 
time_t GetTimeStamp () const
 
DHEADGetList () const
 
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
 
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
 
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 of the item. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 

Static Public Member Functions

static int GetDefaultHatchPitchMils ()
 Function GetDefaultHatchPitchMils. More...
 
static bool ClassOf (const EDA_ITEM *aItem)
 
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 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...
 

Public Attributes

std::vector< TRACK * > m_TracksConnected
 
std::vector< D_PAD * > m_PadsConnected
 

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 (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...
 
time_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 Member Functions

void buildFeatureHoleList (BOARD *aPcb, SHAPE_POLY_SET &aFeatures)
 

Private Attributes

SHAPE_POLY_SETm_Poly
 Outline of the zone. More...
 
SHAPE_POLY_SETm_smoothedPoly
 
int m_cornerSmoothingType
 
unsigned int m_cornerRadius
 
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
 
int m_FillMode
 How to fill areas: 0 => use filled polygons, 1 => 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...
 
std::vector< SEGMENTm_FillSegmList
 Segments used to fill the zone (m_FillMode ==1 ), when fill zone by segment is used. More...
 
SHAPE_POLY_SET m_FilledPolysList
 
HATCH_STYLE m_hatchStyle
 
int m_hatchPitch
 
std::vector< SEGm_HatchLines
 

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

Member Typedef Documentation

Member Enumeration Documentation

Zone hatch styles.

Enumerator
NO_HATCH 
DIAGONAL_FULL 
DIAGONAL_EDGE 

Definition at line 85 of file class_zone.h.

Constructor & Destructor Documentation

ZONE_CONTAINER::ZONE_CONTAINER ( BOARD parent)

Definition at line 53 of file class_zone.cpp.

References ZONE_SETTINGS::ExportSetting(), BOARD::GetZoneSettings(), m_cornerRadius, m_CornerSelection, m_cornerSmoothingType, m_FillMode, m_IsFilled, m_Poly, m_priority, m_smoothedPoly, SetDoNotAllowCopperPour(), SetDoNotAllowTracks(), SetDoNotAllowVias(), SetIsKeepout(), SetLocalFlags(), and ZONE_SETTINGS::SMOOTHING_NONE.

Referenced by Clone().

53  :
55 {
56  m_CornerSelection = nullptr; // no corner is selected
57  m_IsFilled = false; // fill status : true when the zone is filled
58  m_FillMode = 0; // How to fill areas: 0 = use filled polygons, != 0 fill with segments
59  m_priority = 0;
60  m_smoothedPoly = NULL;
62  SetIsKeepout( false );
63  SetDoNotAllowCopperPour( false ); // has meaning only if m_isKeepout == true
64  SetDoNotAllowVias( true ); // has meaning only if m_isKeepout == true
65  SetDoNotAllowTracks( true ); // has meaning only if m_isKeepout == true
66  m_cornerRadius = 0;
67  SetLocalFlags( 0 ); // flags tempoarry used in zone calculations
68  m_Poly = new SHAPE_POLY_SET(); // Outlines
69  aBoard->GetZoneSettings().ExportSetting( *this );
70 }
void SetDoNotAllowTracks(bool aEnable)
Definition: class_zone.h:662
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:770
BOARD_CONNECTED_ITEM(BOARD_ITEM *aParent, KICAD_T idtype)
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:114
void SetDoNotAllowVias(bool aEnable)
Definition: class_zone.h:661
SHAPE_POLY_SET * m_smoothedPoly
Definition: class_zone.h:726
Class SHAPE_POLY_SET.
bool m_IsFilled
True when a zone was filled, false after deleting the filled areas.
Definition: class_zone.h:757
int m_FillMode
How to fill areas: 0 => use filled polygons, 1 => fill with segments.
Definition: class_zone.h:767
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:725
unsigned m_priority
Definition: class_zone.h:734
int m_cornerSmoothingType
Definition: class_zone.h:727
unsigned int m_cornerRadius
Definition: class_zone.h:728
void SetDoNotAllowCopperPour(bool aEnable)
Definition: class_zone.h:660
void SetLocalFlags(int aFlags)
Definition: class_zone.h:242
void SetIsKeepout(bool aEnable)
Definition: class_zone.h:659
ZONE_CONTAINER::ZONE_CONTAINER ( const ZONE_CONTAINER aZone)

Definition at line 73 of file class_zone.cpp.

References SHAPE_POLY_SET::Append(), 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_IsFilled, m_isKeepout, m_PadConnection, m_Poly, m_priority, m_smoothedPoly, m_ThermalReliefCopperBridge, m_ThermalReliefGap, m_ZoneClearance, m_ZoneMinThickness, SetLocalFlags(), and BOARD_CONNECTED_ITEM::SetNetCode().

73  :
74  BOARD_CONNECTED_ITEM( aZone )
75 {
76  m_smoothedPoly = NULL;
77 
78  // Should the copy be on the same net?
79  SetNetCode( aZone.GetNetCode() );
80  m_Poly = new SHAPE_POLY_SET( *aZone.m_Poly );
81 
82  // For corner moving, corner index to drag, or nullptr if no selection
83  m_CornerSelection = nullptr;
84  m_IsFilled = aZone.m_IsFilled;
85  m_ZoneClearance = aZone.m_ZoneClearance; // clearance value
87  m_FillMode = aZone.m_FillMode; // Filling mode (segments/polygons)
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  SetLocalFlags( aZone.GetLocalFlags() );
109 }
int m_ZoneClearance
Clearance value in internal units.
Definition: class_zone.h:749
bool m_doNotAllowTracks
Definition: class_zone.h:746
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:770
BOARD_CONNECTED_ITEM(BOARD_ITEM *aParent, KICAD_T idtype)
SHAPE_POLY_SET * m_smoothedPoly
Definition: class_zone.h:726
int m_ArcToSegmentsCount
The number of segments to convert a circle to a polygon.
Definition: class_zone.h:754
int m_ThermalReliefCopperBridge
Definition: class_zone.h:763
std::vector< SEG > m_HatchLines
Definition: class_zone.h:792
ZoneConnection m_PadConnection
Definition: class_zone.h:748
Class SHAPE_POLY_SET.
bool m_IsFilled
True when a zone was filled, false after deleting the filled areas.
Definition: class_zone.h:757
int m_FillMode
How to fill areas: 0 => use filled polygons, 1 => fill with segments.
Definition: class_zone.h:767
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:725
unsigned m_priority
Definition: class_zone.h:734
bool m_doNotAllowVias
Definition: class_zone.h:745
int m_cornerSmoothingType
Definition: class_zone.h:727
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Function SetNetCode sets net using a net code.
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:788
unsigned int m_cornerRadius
Definition: class_zone.h:728
int GetNetCode() const
Function GetNetCode.
HATCH_STYLE m_hatchStyle
Definition: class_zone.h:790
bool m_doNotAllowCopperPour
Definition: class_zone.h:744
int m_ThermalReliefGap
Width of the copper bridge in thermal reliefs.
Definition: class_zone.h:760
int m_ZoneMinThickness
Minimum thickness value in filled areas.
Definition: class_zone.h:750
int GetLocalFlags() const
Definition: class_zone.h:241
void SetLocalFlags(int aFlags)
Definition: class_zone.h:242
std::vector< SEGMENT > m_FillSegmList
Segments used to fill the zone (m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:778
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 140 of file class_zone.cpp.

References m_CornerSelection, m_Poly, and m_smoothedPoly.

141 {
142  delete m_Poly;
143  delete m_smoothedPoly;
144  delete m_CornerSelection;
145 }
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:770
SHAPE_POLY_SET * m_smoothedPoly
Definition: class_zone.h:726
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:725

Member Function Documentation

void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList ( BOARD aPcb)

Function AddClearanceAreasPolygonsToPolysList Add non copper areas polygons (pads and tracks with clearance) to a filled copper area used in BuildFilledSolidAreasPolygons when calculating filled areas in a zone Non copper areas are pads and track and their clearance area The filled copper area must be computed before BuildFilledSolidAreasPolygons() call this function just after creating the filled copper area polygon (without clearance areas.

Parameters
aPcbthe current board _NG version uses SHAPE_POLY_SET instead of Boost.Polygon

Definition at line 517 of file zones_convert_brd_items_to_polygons_with_Boost.cpp.

518 {
519 }
void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList_NG ( BOARD aPcb)

Function AddClearanceAreasPolygonsToPolysList Supports a min thickness area constraint.

Add non copper areas polygons (pads and tracks with clearance) to the filled copper area found in BuildFilledPolysListData after calculating filled areas in a zone Non filled copper areas are pads and track and their clearance areas The filled copper area must be computed just before. BuildFilledPolysListData() call this function just after creating the filled copper area polygon (without clearance areas) to do that this function: 1 - Creates the main outline (zone outline) using a correction to shrink the resulting area with m_ZoneMinThickness/2 value. The result is areas with a margin of m_ZoneMinThickness/2 When drawing outline with segments having a thickness of m_ZoneMinThickness, the outlines will match exactly the initial outlines 3 - Add all non filled areas (pads, tracks) in group B with a clearance of m_Clearance + m_ZoneMinThickness/2 in a buffer

  • If Thermal shapes are wanted, add non filled area, in order to create these thermal shapes 4 - calculates the polygon A - B 5 - put resulting list of polygons (filled areas) in m_FilledPolysList This zone contains pads with the same net. 6 - Remove insulated copper islands 7 - If Thermal shapes are wanted, remove unconnected stubs in thermal shapes: creates a buffer of polygons corresponding to stubs to remove sub them to the filled areas. Remove new insulated copper islands

Definition at line 410 of file zones_convert_brd_items_to_polygons_with_Boost.cpp.

References ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF, ARC_APPROX_SEGMENTS_COUNT_LOW_DEF, SHAPE_POLY_SET::BooleanSubtract(), buildFeatureHoleList(), BuildUnconnectedThermalStubsPolygonList(), SHAPE_POLY_SET::Fracture(), g_DumpZonesWhenFilling, BOARD_CONNECTED_ITEM::GetNetCode(), SHAPE_POLY_SET::Inflate(), SHAPE_FILE_IO::IOM_APPEND, SHAPE_POLY_SET::IsEmpty(), m_ArcToSegmentsCount, m_FilledPolysList, m_smoothedPoly, m_ZoneMinThickness, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE, POLY_CALC_MODE, CPOLYGONS_LIST::RemoveAllContours(), s_thermalRot, SHAPE_POLY_SET::Simplify(), and TestForCopperIslandAndRemoveInsulatedIslands().

Referenced by BuildFilledSolidAreasPolygons().

411 {
412  int segsPerCircle;
413  double correctionFactor;
414  int outline_half_thickness = m_ZoneMinThickness / 2;
415 
416 
417  std::unique_ptr<SHAPE_FILE_IO> dumper( new SHAPE_FILE_IO(
418  g_DumpZonesWhenFilling ? "zones_dump.txt" : "", SHAPE_FILE_IO::IOM_APPEND ) );
419 
420  // Set the number of segments in arc approximations
422  segsPerCircle = ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF;
423  else
424  segsPerCircle = ARC_APPROX_SEGMENTS_COUNT_LOW_DEF;
425 
426  /* calculates the coeff to compensate radius reduction of holes clearance
427  * due to the segment approx.
428  * For a circle the min radius is radius * cos( 2PI / s_CircleToSegmentsCount / 2)
429  * s_Correction is 1 /cos( PI/s_CircleToSegmentsCount )
430  */
431  correctionFactor = 1.0 / cos( M_PI / (double) segsPerCircle );
432 
433  CPOLYGONS_LIST tmp;
434 
436  dumper->BeginGroup("clipper-zone");
437 
438  SHAPE_POLY_SET solidAreas = *m_smoothedPoly;
439 
440  solidAreas.Inflate( -outline_half_thickness, segsPerCircle );
441  solidAreas.Simplify( POLY_CALC_MODE );
442 
443  SHAPE_POLY_SET holes;
444 
446  dumper->Write( &solidAreas, "solid-areas" );
447 
448  tmp.RemoveAllContours();
449  buildFeatureHoleList( aPcb, holes );
450 
452  dumper->Write( &holes, "feature-holes" );
453 
454  holes.Simplify( POLY_CALC_MODE );
455 
457  dumper->Write( &holes, "feature-holes-postsimplify" );
458 
459  // Generate the filled areas (currently, without thermal shapes, which will
460  // be created later).
461  // Use SHAPE_POLY_SET::PM_STRICTLY_SIMPLE to generate strictly simple polygons
462  // needed by Gerber files and Fracture()
464 
466  dumper->Write( &solidAreas, "solid-areas-minus-holes" );
467 
468  SHAPE_POLY_SET areas_fractured = solidAreas;
469  areas_fractured.Fracture( POLY_CALC_MODE );
470 
472  dumper->Write( &areas_fractured, "areas_fractured" );
473 
474  m_FilledPolysList = areas_fractured;
475 
476  // Remove insulated islands:
477  if( GetNetCode() > 0 )
479 
480  SHAPE_POLY_SET thermalHoles;
481 
482  // Test thermal stubs connections and add polygons to remove unconnected stubs.
483  // (this is a refinement for thermal relief shapes)
484  if( GetNetCode() > 0 )
485  BuildUnconnectedThermalStubsPolygonList( thermalHoles, aPcb, this,
486  correctionFactor, s_thermalRot );
487 
488  // remove copper areas corresponding to not connected stubs
489  if( !thermalHoles.IsEmpty() )
490  {
491  thermalHoles.Simplify( POLY_CALC_MODE );
492  // Remove unconnected stubs. Use SHAPE_POLY_SET::PM_STRICTLY_SIMPLE to
493  // generate strictly simple polygons
494  // needed by Gerber files and Fracture()
495  solidAreas.BooleanSubtract( thermalHoles, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
496 
498  dumper->Write( &thermalHoles, "thermal-holes" );
499 
500  // put these areas in m_FilledPolysList
501  SHAPE_POLY_SET th_fractured = solidAreas;
502  th_fractured.Fracture( POLY_CALC_MODE );
503 
505  dumper->Write ( &th_fractured, "th_fractured" );
506 
507  m_FilledPolysList = th_fractured;
508 
509  if( GetNetCode() > 0 )
511  }
512 
514  dumper->EndGroup();
515 }
#define ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF
Definition: pcbnew.h:42
Class SHAPE_FILE_IO.
Definition: shape_file_io.h:38
#define ARC_APPROX_SEGMENTS_COUNT_LOW_DEF
Definition: pcbnew.h:41
void buildFeatureHoleList(BOARD *aPcb, SHAPE_POLY_SET &aFeatures)
SHAPE_POLY_SET * m_smoothedPoly
Definition: class_zone.h:726
int m_ArcToSegmentsCount
The number of segments to convert a circle to a polygon.
Definition: class_zone.h:754
void Inflate(int aFactor, int aCircleSegmentsCount)
Performs outline inflation/deflation, using round corners.
void TestForCopperIslandAndRemoveInsulatedIslands(BOARD *aPcb)
Function TestForCopperIslandAndRemoveInsulatedIslands Remove insulated copper islands found in m_Fill...
Class SHAPE_POLY_SET.
void Simplify(POLYGON_MODE aFastMode)
Simplifies the polyset (merges overlapping polys, eliminates degeneracy/self-intersections) For aFast...
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:788
void Fracture(POLYGON_MODE aFastMode)
Converts a set of polygons with holes to a singe outline with "slits"/"fractures" connecting the oute...
int GetNetCode() const
Function GetNetCode.
void BuildUnconnectedThermalStubsPolygonList(SHAPE_POLY_SET &aCornerBuffer, BOARD *aPcb, ZONE_CONTAINER *aZone, double aArcCorrection, double aRoundPadThermalRotation)
Function BuildUnconnectedThermalStubsPolygonList Creates a set of polygons corresponding to stubs cre...
int m_ZoneMinThickness
Minimum thickness value in filled areas.
Definition: class_zone.h:750
void RemoveAllContours(void)
Definition: PolyLine.h:143
static const bool g_DumpZonesWhenFilling
void BooleanSubtract(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Performs boolean polyset difference For aFastMode meaning, see function booleanOp ...
bool IsEmpty() const
Returns true if the set is empty (no polygons at all)
CPOLYGONS_LIST handle a list of contours (polygons corners).
Definition: PolyLine.h:114
void ZONE_CONTAINER::AddFilledPolygon ( SHAPE_POLY_SET aPolygon)
inline

add a polygon to the zone filled areas list.

these polygons have no hole, therefore any added polygon is a new filled area

Definition at line 635 of file class_zone.h.

References SHAPE_POLY_SET::Append(), and m_FilledPolysList.

636  {
637  m_FilledPolysList.Append( aPolygon );
638  }
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:788
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline) ...
void ZONE_CONTAINER::AddFilledPolysList ( SHAPE_POLY_SET aPolysList)
inline

Function AddFilledPolysList sets the list of filled polygons.

Definition at line 596 of file class_zone.h.

References m_FilledPolysList.

Referenced by PlotSolderMaskLayer().

597  {
598  m_FilledPolysList = aPolysList;
599  }
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:788
void ZONE_CONTAINER::AddFillSegments ( std::vector< SEGMENT > &  aSegments)
inline

Definition at line 640 of file class_zone.h.

References m_FillSegmList.

641  {
642  m_FillSegmList.insert( m_FillSegmList.end(), aSegments.begin(), aSegments.end() );
643  }
std::vector< SEGMENT > m_FillSegmList
Segments used to fill the zone (m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:778
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 823 of file class_zone.cpp.

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

824 {
825  if( aPolygon.empty() )
826  return;
827 
828  SHAPE_LINE_CHAIN outline;
829 
830  // Create an outline and populate it with the points of aPolygon
831  for( unsigned i = 0; i < aPolygon.size(); i++ )
832  {
833  outline.Append( VECTOR2I( aPolygon[i] ) );
834  }
835 
836  outline.SetClosed( true );
837 
838  // Add the outline as a new polygon in the polygon set
839  if( m_Poly->OutlineCount() == 0 )
840  m_Poly->AddOutline( outline );
841  else
842  m_Poly->AddHole( outline );
843 }
int OutlineCount() const
Returns the number of outlines in the set
VECTOR2< int > VECTOR2I
Definition: vector2d.h:590
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:725
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.
void ZONE_CONTAINER::AppendCorner ( wxPoint  position,
bool  aAllowDuplication = false 
)
inline

Function AppendCorner.

Parameters
positionis the position of the new corner.
aAllowDuplicationis a flag to indicate whether it is allowed to add this corner even if it is duplicated.

Definition at line 546 of file class_zone.h.

References SHAPE_POLY_SET::Append(), 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(), and EAGLE_PLUGIN::loadSignals().

547  {
548  if( m_Poly->OutlineCount() == 0 )
549  m_Poly->NewOutline();
550 
551  m_Poly->Append( position.x, position.y, -1, -1, aAllowDuplication );
552  }
int OutlineCount() const
Returns the number of outlines in the set
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:725
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 125 of file class_board_item.h.

References EDA_ITEM::Pback.

Referenced by PCB_EDIT_FRAME::Delete_Segment_Edge().

125 { 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...
void ZONE_CONTAINER::buildFeatureHoleList ( BOARD aPcb,
SHAPE_POLY_SET aFeatures 
)
private

Definition at line 99 of file zones_convert_brd_items_to_polygons_with_Boost.cpp.

References ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF, ARC_APPROX_SEGMENTS_COUNT_LOW_DEF, CreateThermalReliefPadPolygon(), Edge_Cuts, BOARD::GetArea(), BOARD::GetAreaCount(), BOARD_DESIGN_SETTINGS::GetBiggestClearanceValue(), BOARD_ITEM::GetBoard(), GetBoundingBox(), GetClearance(), D_PAD::GetClearance(), BOARD::GetDesignSettings(), GetDoNotAllowCopperPour(), GetIsKeepout(), BOARD_ITEM::GetLayer(), BOARD_CONNECTED_ITEM::GetNetCode(), GetPadConnection(), GetPriority(), GetThermalReliefCopperBridge(), GetThermalReliefGap(), EDA_RECT::Inflate(), EDA_RECT::Intersects(), m_ArcToSegmentsCount, BOARD::m_Drawings, BOARD::m_Modules, BOARD::m_Track, m_ZoneClearance, m_ZoneMinThickness, max, TRACK::Next(), MODULE::Next(), D_PAD::Next(), BOARD_ITEM::Next(), PAD_ATTRIB_STANDARD, PAD_DRILL_SHAPE_OBLONG, PAD_SHAPE_CIRCLE, PAD_SHAPE_OVAL, PAD_ZONE_CONN_NONE, PAD_ZONE_CONN_THERMAL, PAD_ZONE_CONN_THT_THERMAL, PCB_LINE_T, PCB_MODULE_EDGE_T, PCB_TEXT_T, SHAPE_POLY_SET::RemoveAllContours(), s_thermalRot, D_PAD::SetOrientation(), D_PAD::SetPosition(), D_PAD::SetShape(), D_PAD::SetSize(), and TransformOutlinesShapeWithClearanceToPolygon().

Referenced by AddClearanceAreasPolygonsToPolysList_NG().

100 {
101  int segsPerCircle;
102  double correctionFactor;
103 
104  // Set the number of segments in arc approximations
106  segsPerCircle = ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF;
107  else
108  segsPerCircle = ARC_APPROX_SEGMENTS_COUNT_LOW_DEF;
109 
110  /* calculates the coeff to compensate radius reduction of holes clearance
111  * due to the segment approx.
112  * For a circle the min radius is radius * cos( 2PI / s_CircleToSegmentsCount / 2)
113  * s_Correction is 1 /cos( PI/s_CircleToSegmentsCount )
114  */
115  correctionFactor = 1.0 / cos( M_PI / (double) segsPerCircle );
116 
117  aFeatures.RemoveAllContours();
118 
119  int outline_half_thickness = m_ZoneMinThickness / 2;
120 
121  int zone_clearance = std::max( m_ZoneClearance, GetClearance() );
122  zone_clearance += outline_half_thickness;
123 
124  /* store holes (i.e. tracks and pads areas as polygons outlines)
125  * in a polygon list
126  */
127 
128  /* items ouside the zone bounding box are skipped
129  * the bounding box is the zone bounding box + the biggest clearance found in Netclass list
130  */
131  EDA_RECT item_boundingbox;
132  EDA_RECT zone_boundingbox = GetBoundingBox();
133  int biggest_clearance = aPcb->GetDesignSettings().GetBiggestClearanceValue();
134  biggest_clearance = std::max( biggest_clearance, zone_clearance );
135  zone_boundingbox.Inflate( biggest_clearance );
136 
137  /*
138  * First : Add pads. Note: pads having the same net as zone are left in zone.
139  * Thermal shapes will be created later if necessary
140  */
141  int item_clearance;
142 
143  /* Use a dummy pad to calculate hole clerance when a pad is not on all copper layers
144  * and this pad has a hole
145  * This dummy pad has the size and shape of the hole
146  * Therefore, this dummy pad is a circle or an oval.
147  * A pad must have a parent because some functions expect a non null parent
148  * to find the parent board, and some other data
149  */
150  MODULE dummymodule( aPcb ); // Creates a dummy parent
151  D_PAD dummypad( &dummymodule );
152 
153  for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
154  {
155  D_PAD* nextpad;
156 
157  for( D_PAD* pad = module->Pads(); pad != NULL; pad = nextpad )
158  {
159  nextpad = pad->Next(); // pad pointer can be modified by next code, so
160  // calculate the next pad here
161 
162  if( !pad->IsOnLayer( GetLayer() ) )
163  {
164  /* Test for pads that are on top or bottom only and have a hole.
165  * There are curious pads but they can be used for some components that are
166  * inside the board (in fact inside the hole. Some photo diodes and Leds are
167  * like this)
168  */
169  if( pad->GetDrillSize().x == 0 && pad->GetDrillSize().y == 0 )
170  continue;
171 
172  // Use a dummy pad to calculate a hole shape that have the same dimension as
173  // the pad hole
174  dummypad.SetSize( pad->GetDrillSize() );
175  dummypad.SetOrientation( pad->GetOrientation() );
176  dummypad.SetShape( pad->GetDrillShape() == PAD_DRILL_SHAPE_OBLONG ?
178  dummypad.SetPosition( pad->GetPosition() );
179 
180  pad = &dummypad;
181  }
182 
183  // Note: netcode <=0 means not connected item
184  if( ( pad->GetNetCode() != GetNetCode() ) || ( pad->GetNetCode() <= 0 ) )
185  {
186  item_clearance = pad->GetClearance() + outline_half_thickness;
187  item_boundingbox = pad->GetBoundingBox();
188  item_boundingbox.Inflate( item_clearance );
189 
190  if( item_boundingbox.Intersects( zone_boundingbox ) )
191  {
192  int clearance = std::max( zone_clearance, item_clearance );
193  pad->TransformShapeWithClearanceToPolygon( aFeatures,
194  clearance,
195  segsPerCircle,
196  correctionFactor );
197  }
198 
199  continue;
200  }
201 
202  // Pads are removed from zone if the setup is PAD_ZONE_CONN_NONE
203  if( GetPadConnection( pad ) == PAD_ZONE_CONN_NONE )
204  {
205  int gap = zone_clearance;
206  int thermalGap = GetThermalReliefGap( pad );
207  gap = std::max( gap, thermalGap );
208  item_boundingbox = pad->GetBoundingBox();
209  item_boundingbox.Inflate( gap );
210 
211  if( item_boundingbox.Intersects( zone_boundingbox ) )
212  {
213  pad->TransformShapeWithClearanceToPolygon( aFeatures,
214  gap,
215  segsPerCircle,
216  correctionFactor );
217  }
218  }
219  }
220  }
221 
222  /* Add holes (i.e. tracks and vias areas as polygons outlines)
223  * in cornerBufferPolysToSubstract
224  */
225  for( TRACK* track = aPcb->m_Track; track; track = track->Next() )
226  {
227  if( !track->IsOnLayer( GetLayer() ) )
228  continue;
229 
230  if( track->GetNetCode() == GetNetCode() && (GetNetCode() != 0) )
231  continue;
232 
233  item_clearance = track->GetClearance() + outline_half_thickness;
234  item_boundingbox = track->GetBoundingBox();
235 
236  if( item_boundingbox.Intersects( zone_boundingbox ) )
237  {
238  int clearance = std::max( zone_clearance, item_clearance );
239  track->TransformShapeWithClearanceToPolygon( aFeatures,
240  clearance,
241  segsPerCircle,
242  correctionFactor );
243  }
244  }
245 
246  /* Add module edge items that are on copper layers
247  * Pcbnew allows these items to be on copper layers in microwave applictions
248  * This is a bad thing, but must be handled here, until a better way is found
249  */
250  for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
251  {
252  for( BOARD_ITEM* item = module->GraphicalItems(); item; item = item->Next() )
253  {
254  if( !item->IsOnLayer( GetLayer() ) && !item->IsOnLayer( Edge_Cuts ) )
255  continue;
256 
257  if( item->Type() != PCB_MODULE_EDGE_T )
258  continue;
259 
260  item_boundingbox = item->GetBoundingBox();
261 
262  if( item_boundingbox.Intersects( zone_boundingbox ) )
263  {
264  ( (EDGE_MODULE*) item )->TransformShapeWithClearanceToPolygon(
265  aFeatures, zone_clearance,
266  segsPerCircle, correctionFactor );
267  }
268  }
269  }
270 
271  // Add graphic items (copper texts) and board edges
272  for( BOARD_ITEM* item = aPcb->m_Drawings; item; item = item->Next() )
273  {
274  if( item->GetLayer() != GetLayer() && item->GetLayer() != Edge_Cuts )
275  continue;
276 
277  switch( item->Type() )
278  {
279  case PCB_LINE_T:
280  ( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon(
281  aFeatures,
282  zone_clearance, segsPerCircle, correctionFactor );
283  break;
284 
285  case PCB_TEXT_T:
286  ( (TEXTE_PCB*) item )->TransformBoundingBoxWithClearanceToPolygon(
287  aFeatures, zone_clearance );
288  break;
289 
290  default:
291  break;
292  }
293  }
294 
295  // Add zones outlines having an higher priority and keepout
296  for( int ii = 0; ii < GetBoard()->GetAreaCount(); ii++ )
297  {
298  ZONE_CONTAINER* zone = GetBoard()->GetArea( ii );
299  if( zone->GetLayer() != GetLayer() )
300  continue;
301 
302  if( !zone->GetIsKeepout() && zone->GetPriority() <= GetPriority() )
303  continue;
304 
305  if( zone->GetIsKeepout() && ! zone->GetDoNotAllowCopperPour() )
306  continue;
307 
308  // A highter priority zone or keepout area is found: remove this area
309  item_boundingbox = zone->GetBoundingBox();
310  if( !item_boundingbox.Intersects( zone_boundingbox ) )
311  continue;
312 
313  // Add the zone outline area.
314  // However if the zone has the same net as the current zone,
315  // do not add any clearance.
316  // the zone will be connected to the current zone, but filled areas
317  // will use different parameters (clearance, thermal shapes )
318  bool same_net = GetNetCode() == zone->GetNetCode();
319  bool use_net_clearance = true;
320  int min_clearance = zone_clearance;
321 
322  // Do not forget to make room to draw the thick outlines
323  // of the hole created by the area of the zone to remove
324  int holeclearance = zone->GetClearance() + outline_half_thickness;
325 
326  // The final clearance is obviously the max value of each zone clearance
327  min_clearance = std::max( min_clearance, holeclearance );
328 
329  if( zone->GetIsKeepout() || same_net )
330  {
331  // Just take in account the fact the outline has a thickness, so
332  // the actual area to substract is inflated to take in account this fact
333  min_clearance = outline_half_thickness;
334  use_net_clearance = false;
335  }
336 
338  aFeatures,
339  min_clearance, use_net_clearance );
340  }
341 
342  // Remove thermal symbols
343  for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
344  {
345  for( D_PAD* pad = module->Pads(); pad != NULL; pad = pad->Next() )
346  {
347  // Rejects non-standard pads with tht-only thermal reliefs
349  && pad->GetAttribute() != PAD_ATTRIB_STANDARD )
350  continue;
351 
354  continue;
355 
356  if( !pad->IsOnLayer( GetLayer() ) )
357  continue;
358 
359  if( pad->GetNetCode() != GetNetCode() )
360  continue;
361  item_boundingbox = pad->GetBoundingBox();
362  int thermalGap = GetThermalReliefGap( pad );
363  item_boundingbox.Inflate( thermalGap, thermalGap );
364 
365  if( item_boundingbox.Intersects( zone_boundingbox ) )
366  {
368  *pad, thermalGap,
371  segsPerCircle,
372  correctionFactor, s_thermalRot );
373  }
374  }
375  }
376 
377 }
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:78
#define ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF
Definition: pcbnew.h:42
int m_ZoneClearance
Clearance value in internal units.
Definition: class_zone.h:749
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
bool GetDoNotAllowCopperPour() const
Definition: class_zone.h:655
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox (virtual)
Definition: class_zone.cpp:349
int GetBiggestClearanceValue()
Function GetBiggestClearanceValue.
#define ARC_APPROX_SEGMENTS_COUNT_LOW_DEF
Definition: pcbnew.h:41
MODULE * Next() const
Definition: class_module.h:99
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:104
int GetThermalReliefCopperBridge(D_PAD *aPad=NULL) const
Definition: class_zone.cpp:466
void TransformOutlinesShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, int aMinClearanceValue, bool aUseNetClearance)
Function TransformOutlinesShapeWithClearanceToPolygon Convert the outlines shape to a polygon with no...
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:106
int GetClearance(BOARD_CONNECTED_ITEM *aItem=NULL) const override
Function GetClearance returns the clearance in 1/10000 inches.
Definition: class_zone.cpp:609
Pads are not covered.
Definition: zones.h:57
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:654
BOARD_ITEM * Next() const
int m_ArcToSegmentsCount
The number of segments to convert a circle to a polygon.
Definition: class_zone.h:754
ZoneConnection GetPadConnection(D_PAD *aPad=NULL) const
Definition: class_zone.cpp:814
int GetThermalReliefGap(D_PAD *aPad=NULL) const
Definition: class_zone.cpp:457
D_PAD * Next() const
Definition: class_pad.h:106
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:530
void SetSize(const wxSize &aSize)
Definition: class_pad.h:181
DLIST< BOARD_ITEM > m_Drawings
Definition: class_board.h:242
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:1051
Thermal relief only for THT pads.
Definition: zones.h:60
int GetNetCode() const
Function GetNetCode.
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
int m_ZoneMinThickness
Minimum thickness value in filled areas.
Definition: class_zone.h:750
TRACK * Next() const
Definition: class_track.h:98
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:1022
#define max(a, b)
Definition: auxiliary.h:86
DLIST< MODULE > m_Modules
Definition: class_board.h:243
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.
Class EDA_RECT handles the component boundary box.
Usual pad.
Definition: pad_shapes.h:58
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
DLIST< TRACK > m_Track
Definition: class_board.h:244
unsigned GetPriority() const
Function GetPriority.
Definition: class_zone.h:119
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:103
Use thermal relief for pads.
Definition: zones.h:58
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
void CreateThermalReliefPadPolygon(SHAPE_POLY_SET &aCornerBuffer, D_PAD &aPad, int aThermalGap, int aCopperThickness, int aMinThicknessValue, int aCircleToSegmentsCount, double aCorrectionFactor, double aThermalRot)
Function CreateThermalReliefPadPolygon Add holes around a pad to create a thermal relief copper thick...
bool ZONE_CONTAINER::BuildFilledSolidAreasPolygons ( BOARD aPcb,
SHAPE_POLY_SET aOutlineBuffer = NULL 
)

Function BuildFilledSolidAreasPolygons Build the filled solid areas data from real outlines (stored in m_Poly) The solid areas can be more than one on copper layers, and do not have holes ( holes are linked by overlapping segments to the main outline) in order to have drawable (and plottable) filled polygons.

Returns
true if OK, false if the solid polygons cannot be built
Parameters
aPcbthe current board (can be NULL for non copper zones)
aCornerBufferA reference to a buffer to store polygon corners, or NULL if NULL (default:
  • m_FilledPolysList is used to store solid areas polygons.
  • on copper layers, tracks and other items shapes of other nets are removed from solid areas if not null: Only the zone outline (with holes, if any) is stored in aOutlineBuffer with holes linked. Therefore only one polygon is created

When aOutlineBuffer is not null, his function calls AddClearanceAreasPolygonsToPolysList() to add holes for pads and tracks and other items not in net.

Definition at line 58 of file zone_filling_algorithm.cpp.

References AddClearanceAreasPolygonsToPolysList_NG(), SHAPE_POLY_SET::Append(), SHAPE_POLY_SET::Chamfer(), SHAPE_POLY_SET::Fillet(), FillZoneAreasWithSegments(), SHAPE_POLY_SET::Fracture(), GetNumCorners(), SHAPE_POLY_SET::Inflate(), IsOnCopperLayer(), m_ArcToSegmentsCount, m_cornerRadius, m_cornerSmoothingType, m_FilledPolysList, m_FillMode, m_IsFilled, m_Poly, m_smoothedPoly, m_ZoneMinThickness, SHAPE_POLY_SET::PM_FAST, SHAPE_POLY_SET::RemoveAllContours(), ZONE_SETTINGS::SMOOTHING_CHAMFER, and ZONE_SETTINGS::SMOOTHING_FILLET.

Referenced by export_vrml_zones(), PCB_EDIT_FRAME::Fill_Zone(), and TransformOutlinesShapeWithClearanceToPolygon().

59 {
60  /* convert outlines + holes to outlines without holes (adding extra segments if necessary)
61  * m_Poly data is expected normalized, i.e. NormalizeAreaOutlines was used after building
62  * this zone
63  */
64 
65  if( GetNumCorners() <= 2 ) // malformed zone. polygon calculations do not like it ...
66  return false;
67 
68  // Make a smoothed polygon out of the user-drawn polygon if required
69  if( m_smoothedPoly )
70  {
71  delete m_smoothedPoly;
72  m_smoothedPoly = NULL;
73  }
74 
75  switch( m_cornerSmoothingType )
76  {
80  break;
81 
85  break;
86 
87  default:
88  // Acute angles between adjacent edges can create issues in calculations,
89  // in inflate/deflate outlines transforms, especially when the angle is very small.
90  // We can avoid issues by creating a very small chamfer which remove acute angles,
91  // or left it without chamfer and use only CPOLYGONS_LIST::InflateOutline to create
92  // clearance areas
94  *m_smoothedPoly = m_Poly->Chamfer( Millimeter2iu( 0.0 ) );
95  break;
96  }
97 
98  if( aOutlineBuffer )
99  aOutlineBuffer->Append( *m_smoothedPoly );
100 
101  /* For copper layers, we now must add holes in the Polygon list.
102  * holes are pads and tracks with their clearance area
103  * For non copper layers, just recalculate the m_FilledPolysList
104  * with m_ZoneMinThickness taken in account
105  */
106  else
107  {
109 
110  if( IsOnCopperLayer() )
111  {
113 
114  if( m_FillMode ) // if fill mode uses segments, create them:
115  {
117  return false;
118  }
119  }
120  else
121  {
122  m_FillMode = 0; // Fill by segments is no more used in non copper layers
123  // force use solid polygons (usefull only for old boards)
125 
126  // The filled areas are deflated by -m_ZoneMinThickness / 2, because
127  // the outlines are drawn with a line thickness = m_ZoneMinThickness to
128  // give a good shape with the minimal thickness
131  }
132 
133  m_IsFilled = true;
134  }
135 
136  return true;
137 }
int GetNumCorners(void) const
Access to m_Poly parameters.
Definition: class_zone.h:466
SHAPE_POLY_SET * m_smoothedPoly
Definition: class_zone.h:726
int m_ArcToSegmentsCount
The number of segments to convert a circle to a polygon.
Definition: class_zone.h:754
void Inflate(int aFactor, int aCircleSegmentsCount)
Performs outline inflation/deflation, using round corners.
SHAPE_POLY_SET Fillet(int aRadius, int aSegments)
Function Fillet returns a filleted version of the polygon set.
Class SHAPE_POLY_SET.
bool m_IsFilled
True when a zone was filled, false after deleting the filled areas.
Definition: class_zone.h:757
int m_FillMode
How to fill areas: 0 => use filled polygons, 1 => fill with segments.
Definition: class_zone.h:767
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:725
int m_cornerSmoothingType
Definition: class_zone.h:727
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:788
bool FillZoneAreasWithSegments()
Function FillZoneAreasWithSegments Fill sub areas in a zone with segments with m_ZoneMinThickness wid...
void Fracture(POLYGON_MODE aFastMode)
Converts a set of polygons with holes to a singe outline with "slits"/"fractures" connecting the oute...
unsigned int m_cornerRadius
Definition: class_zone.h:728
void AddClearanceAreasPolygonsToPolysList_NG(BOARD *aPcb)
Function AddClearanceAreasPolygonsToPolysList Supports a min thickness area constraint.
bool IsOnCopperLayer() const
Function IsOnCopperLayer.
Definition: class_zone.h:179
int m_ZoneMinThickness
Minimum thickness value in filled areas.
Definition: class_zone.h:750
SHAPE_POLY_SET Chamfer(int aDistance)
Function Chamfer returns a chamfered version of the polygon set.
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.
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) ...
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 496 of file class_zone.h.

References SHAPE_POLY_SET::CIterateWithHoles(), and m_Poly.

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

497  {
498  return m_Poly->CIterateWithHoles();
499  }
CONST_ITERATOR CIterateWithHoles(int aOutline) const
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:725
static bool BOARD_CONNECTED_ITEM::ClassOf ( const EDA_ITEM aItem)
inlinestaticinherited

Definition at line 62 of file class_board_connected_item.h.

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

63  {
64  if( aItem == NULL )
65  return false;
66 
67  switch( aItem->Type() )
68  {
69  case PCB_PAD_T:
70  case PCB_TRACE_T:
71  case PCB_VIA_T:
72  case PCB_ZONE_AREA_T:
73  return true;
74 
75  default:
76  return false;
77  }
78  }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:114
class D_PAD, a pad in a footprint
Definition: typeinfo.h:102
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:107
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:108
void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 233 of file base_struct.h.

References BRIGHTENED, and EDA_ITEM::ClearFlags().

Referenced by SELECTION_TOOL::disambiguationMenu().

233 { ClearFlags( BRIGHTENED ); }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:137
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 577 of file class_zone.h.

References m_FilledPolysList, and SHAPE_POLY_SET::RemoveAllContours().

Referenced by PCB_EDIT_FRAME::Fill_Zone(), POINT_EDITOR::updateItem(), and PCB_EDITOR_CONTROL::ZoneUnfillAll().

578  {
580  }
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:788
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(), abortMoveBitmap(), AbortMoveDimensionText(), abortMoveItem(), AbortMoveTextModule(), AbortPinMove(), SCH_SCREEN::addConnectedItemsToBlock(), SCH_EDIT_FRAME::addCurrentItemToList(), PNS_KICAD_IFACE::AddItem(), PCB_EDIT_FRAME::AppendBoardFile(), SCH_EDIT_FRAME::AppendOneEEProject(), 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(), PCB_EDIT_FRAME::Change_Side_Module(), SCH_SCREEN::ClearAnnotation(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearHighlighted(), ClearMarkItems(), clearModuleItemFlags(), EDA_ITEM::ClearSelected(), SCH_EDIT_FRAME::ConvertPart(), SCH_EDIT_FRAME::copyBlockItems(), CopyMarkedItems(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), LIB_PART::CopySelectedItems(), MWAVE::CreateMicrowaveInductor(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), PCB_EDIT_FRAME::Delete_LastCreatedCorner(), PCB_EDIT_FRAME::Delete_Segment_Edge(), LIB_PART::DeleteSelectedItems(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), 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_Zone(), SCH_EDIT_FRAME::EndSegment(), PCB_EDIT_FRAME::Exchange_Module(), ExitSheet(), SCH_SCREEN::GetConnection(), PCB_BASE_FRAME::GlobalChange_PadSettings(), PCB_BASE_FRAME::Import_Pad_Settings(), SCH_JUNCTION::IsSelectStateChanged(), SCH_NO_CONNECT::IsSelectStateChanged(), SCH_MARKER::IsSelectStateChanged(), SCH_BUS_ENTRY_BASE::IsSelectStateChanged(), SCH_LINE::IsSelectStateChanged(), SCH_BITMAP::IsSelectStateChanged(), SCH_TEXT::IsSelectStateChanged(), SCH_COMPONENT::IsSelectStateChanged(), SCH_SHEET::IsSelectStateChanged(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), MarkItemsInBloc(), MirrorX(), MirrorY(), moveBitmap(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), LIB_EDIT_FRAME::OnEditPin(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnRotateItem(), SCH_EDIT_FRAME::OnSelectUnit(), 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(), EDIT_TOOL::Properties(), 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(), LIB_PIN::Save(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint(), SCH_EDIT_FRAME::SetRepeatItem(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::StartMoveModule(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), 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:136
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(), GAL_ARRAY_CREATOR::prePushAction(), SELECTION_TOOL::unselectVisually(), and PCB_EDITOR_CONTROL::ZoneDuplicate().

231 { ClearFlags( SELECTED ); }
#define SELECTED
Definition: base_struct.h:120
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 148 of file class_zone.cpp.

References ZONE_CONTAINER().

149 {
150  return new ZONE_CONTAINER( *this );
151 }
ZONE_CONTAINER(BOARD *parent)
Definition: class_zone.cpp:53
void BOARD_ITEM::DeleteStructure ( )
inherited
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 179 of file class_zone.cpp.

References SEG::A, KIGFX::COLOR4D::a, SEG::B, color, DARKDARKGRAY, BOARD_ITEM::GetBoard(), EDA_DRAW_PANEL::GetClipBox(), EDA_DRAW_PANEL::GetDisplayOptions(), BOARD::GetLayerColor(), GetNumCorners(), EDA_DRAW_PANEL::GetScreen(), GR_AND, GR_HIGHLIGHT, GRLineArray(), GRSetDrawMode(), BOARD::IsLayerVisible(), BOARD_ITEM::IsOnLayer(), SHAPE_POLY_SET::IterateSegmentsWithHoles(), DISPLAY_OPTIONS::m_ContrastModeDisplay, m_HatchLines, BOARD_ITEM::m_Layer, and m_Poly.

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

181 {
182  if( !DC )
183  return;
184 
185  wxPoint seg_start, seg_end;
186  PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
187  BOARD* brd = GetBoard();
188 
190 
191  if( brd->IsLayerVisible( m_Layer ) == false && !( aDrawMode & GR_HIGHLIGHT ) )
192  return;
193 
194  GRSetDrawMode( DC, aDrawMode );
195  DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions();
196 
197  if( displ_opts->m_ContrastModeDisplay )
198  {
199  if( !IsOnLayer( curr_layer ) )
200  color = COLOR4D( DARKDARKGRAY );
201  }
202 
203  if( ( aDrawMode & GR_HIGHLIGHT ) && !( aDrawMode & GR_AND ) )
204  color.SetToLegacyHighlightColor();
205 
206  color.a = 0.588;
207 
208  // draw the lines
209  std::vector<wxPoint> lines;
210  lines.reserve( (GetNumCorners() * 2) + 2 );
211 
212  // Iterate through the segments of the outline
213  for( auto iterator = m_Poly->IterateSegmentsWithHoles(); iterator; iterator++ )
214  {
215  // Create the segment
216  SEG segment = *iterator;
217 
218  lines.push_back( static_cast<wxPoint>( segment.A ) + offset );
219  lines.push_back( static_cast<wxPoint>( segment.B ) + offset );
220  }
221 
222  GRLineArray( panel->GetClipBox(), DC, lines, 0, color );
223 
224  // draw hatches
225  lines.clear();
226  lines.reserve( (m_HatchLines.size() * 2) + 2 );
227 
228  for( unsigned ic = 0; ic < m_HatchLines.size(); ic++ )
229  {
230  seg_start = static_cast<wxPoint>( m_HatchLines[ic].A ) + offset;
231  seg_end = static_cast<wxPoint>( m_HatchLines[ic].B ) + offset;
232  lines.push_back( seg_start );
233  lines.push_back( seg_end );
234  }
235 
236  GRLineArray( panel->GetClipBox(), DC, lines, 0, color );
237 }
COLOR4D GetLayerColor(PCB_LAYER_ID aLayer) const
Function GetLayerColor gets a layer color for any valid layer, including non-copper ones...
int GetNumCorners(void) const
Access to m_Poly parameters.
Definition: class_zone.h:466
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:290
SEGMENT_ITERATOR IterateSegmentsWithHoles()
Returns an iterator object, for all outlines in the set (with holes)
virtual bool IsOnLayer(PCB_LAYER_ID aLayer) const
Function IsOnLayer tests to see if this object is on the given layer.
PCB_LAYER_ID m_Layer
PCB_LAYER_ID
A quick note on layer IDs:
double a
Alpha component.
Definition: color4d.h:284
std::vector< SEG > m_HatchLines
Definition: class_zone.h:792
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:725
bool m_ContrastModeDisplay
Definition: pcbstruct.h:85
EDA_RECT * GetClipBox()
Class DISPLAY_OPTIONS handles display options like enable/disable some optional drawings.
Definition: pcbstruct.h:62
Definition: seg.h:37
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:166
VECTOR2I A
Definition: seg.h:47
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:188
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:427
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
void * GetDisplayOptions()
Function GetDisplayOptions A way to pass info to draw functions.
Definition: draw_panel.cpp:182
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:440
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
VECTOR2I B
Definition: seg.h:48
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 240 of file class_zone.cpp.

References KIGFX::COLOR4D::a, color, SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoint(), DARKDARKGRAY, FORCE_SKETCH, BOARD_ITEM::GetBoard(), EDA_DRAW_PANEL::GetClipBox(), EDA_DRAW_PANEL::GetDisplayOptions(), BOARD::GetLayerColor(), EDA_DRAW_PANEL::GetScreen(), EDA_ITEM::GetState(), GR_AND, GR_HIGHLIGHT, GRCSegm(), GRFillCSegm(), GRPoly(), GRSetDrawMode(), SHAPE_POLY_SET::IsEmpty(), BOARD::IsLayerVisible(), BOARD_ITEM::IsOnLayer(), DISPLAY_OPTIONS::m_ContrastModeDisplay, DISPLAY_OPTIONS::m_DisplayPcbTrackFill, DISPLAY_OPTIONS::m_DisplayZonesMode, m_FilledPolysList, m_FillMode, m_FillSegmList, BOARD_ITEM::m_Layer, m_ZoneMinThickness, SHAPE_POLY_SET::OutlineCount(), SHAPE_LINE_CHAIN::PointCount(), wxPoint::x, VECTOR2< T >::x, wxPoint::y, and VECTOR2< T >::y.

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

242 {
243  static std::vector <wxPoint> CornersBuffer;
244  DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions();
245 
246  // outline_mode is false to show filled polys,
247  // and true to show polygons outlines only (test and debug purposes)
248  bool outline_mode = displ_opts->m_DisplayZonesMode == 2 ? true : false;
249 
250  if( DC == NULL )
251  return;
252 
253  if( displ_opts->m_DisplayZonesMode == 1 ) // Do not show filled areas
254  return;
255 
256  if( m_FilledPolysList.IsEmpty() ) // Nothing to draw
257  return;
258 
259  BOARD* brd = GetBoard();
260  PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
262 
263  if( brd->IsLayerVisible( m_Layer ) == false && !( aDrawMode & GR_HIGHLIGHT ) )
264  return;
265 
266  GRSetDrawMode( DC, aDrawMode );
267 
268  if( displ_opts->m_ContrastModeDisplay )
269  {
270  if( !IsOnLayer( curr_layer ) )
271  color = COLOR4D( DARKDARKGRAY );
272  }
273 
274  if( ( aDrawMode & GR_HIGHLIGHT ) && !( aDrawMode & GR_AND ) )
275  color.SetToLegacyHighlightColor();
276 
277  color.a = 0.588;
278 
279 
280  for ( int ic = 0; ic < m_FilledPolysList.OutlineCount(); ic++ )
281  {
282  const SHAPE_LINE_CHAIN& path = m_FilledPolysList.COutline( ic );
283 
284  CornersBuffer.clear();
285 
286  wxPoint p0;
287 
288  for( int j = 0; j < path.PointCount(); j++ )
289  {
290  const VECTOR2I& corner = path.CPoint( j );
291 
292  wxPoint coord( corner.x + offset.x, corner.y + offset.y );
293 
294  if( j == 0 )
295  p0 = coord;
296 
297  CornersBuffer.push_back( coord );
298  }
299 
300  CornersBuffer.push_back( p0 );
301 
302  // Draw outlines:
303  if( ( m_ZoneMinThickness > 1 ) || outline_mode )
304  {
305  int ilim = CornersBuffer.size() - 1;
306 
307  for( int is = 0, ie = ilim; is <= ilim; ie = is, is++ )
308  {
309  int x0 = CornersBuffer[is].x;
310  int y0 = CornersBuffer[is].y;
311  int x1 = CornersBuffer[ie].x;
312  int y1 = CornersBuffer[ie].y;
313 
314  // Draw only basic outlines, not extra segments.
315  if( !displ_opts->m_DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
316  GRCSegm( panel->GetClipBox(), DC,
317  x0, y0, x1, y1,
319  else
320  GRFillCSegm( panel->GetClipBox(), DC,
321  x0, y0, x1, y1, m_ZoneMinThickness, color );
322  }
323  }
324 
325  // Draw areas:
326  if( m_FillMode == 0 && !outline_mode )
327  GRPoly( panel->GetClipBox(), DC, CornersBuffer.size(), &CornersBuffer[0],
328  true, 0, color, color );
329  }
330 
331  if( m_FillMode == 1 && !outline_mode ) // filled with segments
332  {
333  for( unsigned ic = 0; ic < m_FillSegmList.size(); ic++ )
334  {
335  wxPoint start = m_FillSegmList[ic].m_Start + offset;
336  wxPoint end = m_FillSegmList[ic].m_End + offset;
337 
338  if( !displ_opts->m_DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
339  GRCSegm( panel->GetClipBox(), DC, start.x, start.y, end.x, end.y,
341  else
342  GRFillCSegm( panel->GetClipBox(), DC, start.x, start.y, end.x, end.y,
344  }
345  }
346 }
COLOR4D GetLayerColor(PCB_LAYER_ID aLayer) const
Function GetLayerColor gets a layer color for any valid layer, including non-copper ones...
void GRPoly(EDA_RECT *ClipBox, wxDC *DC, int n, wxPoint Points[], bool Fill, int width, COLOR4D Color, COLOR4D BgColor)
Definition: gr_basic.cpp:767
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:290
virtual bool IsOnLayer(PCB_LAYER_ID aLayer) const
Function IsOnLayer tests to see if this object is on the given layer.
int PointCount() const
Function PointCount()
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:481
int OutlineCount() const
Returns the number of outlines in the set
int GetState(int type) const
Definition: base_struct.h:237
PCB_LAYER_ID m_Layer
bool m_DisplayPcbTrackFill
Definition: pcbstruct.h:71
PCB_LAYER_ID
A quick note on layer IDs:
double a
Alpha component.
Definition: color4d.h:284
void GRFillCSegm(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color)
Definition: gr_basic.cpp:584
int m_FillMode
How to fill areas: 0 => use filled polygons, 1 => fill with segments.
Definition: class_zone.h:767
bool m_ContrastModeDisplay
Definition: pcbstruct.h:85
EDA_RECT * GetClipBox()
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
int m_DisplayZonesMode
Definition: pcbstruct.h:77
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:788
Class DISPLAY_OPTIONS handles display options like enable/disable some optional drawings.
Definition: pcbstruct.h:62
int m_ZoneMinThickness
Minimum thickness value in filled areas.
Definition: class_zone.h:750
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:166
Class SHAPE_LINE_CHAIN.
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:188
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)
void * GetDisplayOptions()
Function GetDisplayOptions A way to pass info to draw functions.
Definition: draw_panel.cpp:182
#define FORCE_SKETCH
Definition: pcbnew.h:68
const VECTOR2I & CPoint(int aIndex) const
Function CPoint()
std::vector< SEGMENT > m_FillSegmList
Segments used to fill the zone (m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:778
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:440
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 376 of file class_zone.cpp.

References color, DARKDARKGRAY, BOARD_ITEM::GetBoard(), EDA_DRAW_PANEL::GetClipBox(), EDA_DRAW_PANEL::GetDisplayOptions(), BOARD::GetLayerColor(), EDA_DRAW_PANEL::GetScreen(), GR_XOR, GRLine(), GRSetDrawMode(), SHAPE_POLY_SET::ITERATOR_TEMPLATE< T >::IsEndContour(), BOARD_ITEM::IsOnLayer(), SHAPE_POLY_SET::Iterate(), DISPLAY_OPTIONS::m_ContrastModeDisplay, BOARD_ITEM::m_Layer, 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(), and Show_New_Edge_While_Move_Mouse().

378 {
379  GR_DRAWMODE current_gr_mode = draw_mode;
380  bool is_close_segment = false;
381 
382  if( !DC )
383  return;
384 
385  PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
386  BOARD* brd = GetBoard();
388  DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions();
389 
390  if( displ_opts->m_ContrastModeDisplay )
391  {
392  if( !IsOnLayer( curr_layer ) )
393  color = COLOR4D( DARKDARKGRAY );
394  }
395 
396  // Object to iterate through the corners of the outlines
398 
399  // Segment start and end
400  VECTOR2I seg_start, seg_end;
401 
402  // Remember the first point of this contour
403  VECTOR2I contour_first_point = *iterator;
404 
405  // Iterate through all the corners of the outlines and build the segments to draw
406  while( iterator )
407  {
408  // Get the first point of the current segment
409  seg_start = *iterator;
410 
411  // Get the last point of the current segment, handling the case where the end of the
412  // contour is reached, when the last point of the segment is the first point of the
413  // contour
414  if( !iterator.IsEndContour() )
415  {
416  // Set GR mode to default
417  current_gr_mode = draw_mode;
418 
419  SHAPE_POLY_SET::ITERATOR iterator_copy = iterator;
420  iterator_copy++;
421  if( iterator_copy.IsEndContour() )
422  current_gr_mode = GR_XOR;
423 
424  is_close_segment = false;
425 
426  iterator++;
427  seg_end = *iterator;
428  }
429  else
430  {
431  is_close_segment = true;
432 
433  seg_end = contour_first_point;
434 
435  // Reassign first point of the contour to the next contour start
436  iterator++;
437 
438  if( iterator )
439  contour_first_point = *iterator;
440 
441  // Set GR mode to XOR
442  current_gr_mode = GR_XOR;
443  }
444 
445  GRSetDrawMode( DC, current_gr_mode );
446 
447  if( is_close_segment )
448  GRLine( panel->GetClipBox(), DC, seg_start.x, seg_start.y, seg_end.x, seg_end.y, 0,
449  WHITE );
450  else
451  GRLine( panel->GetClipBox(), DC, seg_start.x, seg_start.y, seg_end.x, seg_end.y, 0,
452  color );
453  }
454 }
COLOR4D GetLayerColor(PCB_LAYER_ID aLayer) const
Function GetLayerColor gets a layer color for any valid layer, including non-copper ones...
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:290
virtual bool IsOnLayer(PCB_LAYER_ID aLayer) const
Function IsOnLayer tests to see if this object is on the given layer.
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color)
Definition: gr_basic.cpp:352
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.
PCB_LAYER_ID m_Layer
PCB_LAYER_ID
A quick note on layer IDs:
GR_DRAWMODE
Drawmode. Compositing mode plus a flag or two.
Definition: gr_basic.h:41
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:725
bool m_ContrastModeDisplay
Definition: pcbstruct.h:85
EDA_RECT * GetClipBox()
Class DISPLAY_OPTIONS handles display options like enable/disable some optional drawings.
Definition: pcbstruct.h:62
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:166
Class ITERATOR_TEMPLATE.
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:188
Definition: colors.h:49
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
void * GetDisplayOptions()
Function GetDisplayOptions A way to pass info to draw functions.
Definition: draw_panel.cpp:182
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
std::vector<SEGMENT>& ZONE_CONTAINER::FillSegments ( )
inline

Definition at line 244 of file class_zone.h.

References m_FillSegmList.

Referenced by BRDITEMS_PLOTTER::PlotFilledAreas().

244 { return m_FillSegmList; }
std::vector< SEGMENT > m_FillSegmList
Segments used to fill the zone (m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:778
const std::vector<SEGMENT>& ZONE_CONTAINER::FillSegments ( ) const
inline

Definition at line 245 of file class_zone.h.

References m_FillSegmList.

245 { return m_FillSegmList; }
std::vector< SEGMENT > m_FillSegmList
Segments used to fill the zone (m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:778
bool ZONE_CONTAINER::FillZoneAreasWithSegments ( )

Function FillZoneAreasWithSegments Fill sub areas in a zone with segments with m_ZoneMinThickness width A scan is made line per line, on the whole filled areas, with a step of m_ZoneMinThickness.

all intersecting points with the horizontal infinite line and polygons to fill are calculated a list of SEGZONE items is built, line per line

Returns
true if success, false on error

Definition at line 151 of file zone_filling_algorithm.cpp.

References SHAPE_LINE_CHAIN::Append(), SHAPE_POLY_SET::COutline(), fillPolygonWithHorizontalSegments(), SEGMENT::m_End, m_FilledPolysList, m_FillSegmList, m_IsFilled, SEGMENT::m_Start, m_ZoneMinThickness, max, SHAPE_POLY_SET::OutlineCount(), SHAPE_LINE_CHAIN::Point(), SHAPE_LINE_CHAIN::PointCount(), wxPoint::x, VECTOR2< T >::x, wxPoint::y, and VECTOR2< T >::y.

Referenced by BuildFilledSolidAreasPolygons().

152 {
153  bool success = true;
154  // segments are on something like a grid. Give it a minimal size
155  // to avoid too many segments, and use the m_ZoneMinThickness when (this is usually the case)
156  // the size is > mingrid_size.
157  // This is not perfect, but the actual purpose of this code
158  // is to allow filling zones on a grid, with grid size > m_ZoneMinThickness,
159  // in order to have really a grid.
160  //
161  // Using a user selectable grid size is for future Kicad versions.
162  // For now the area is fully filled.
163  int mingrid_size = Millimeter2iu( 0.05 );
164  int grid_size = std::max( mingrid_size, m_ZoneMinThickness );
165  // Make segments slightly overlapping to ensure a good full filling
166  grid_size -= grid_size/20;
167 
168  // All filled areas are in m_FilledPolysList
169  // m_FillSegmList will contain the horizontal and vertical segments
170  // the segment width is m_ZoneMinThickness.
171  m_FillSegmList.clear();
172 
173  // Creates the horizontal segments
174  for ( int index = 0; index < m_FilledPolysList.OutlineCount(); index++ )
175  {
176  const SHAPE_LINE_CHAIN& outline0 = m_FilledPolysList.COutline( index );
177  success = fillPolygonWithHorizontalSegments( outline0, m_FillSegmList, grid_size );
178 
179  if( !success )
180  break;
181 
182  // Creates the vertical segments. Because the filling algo creates horizontal segments,
183  // to reuse the fillPolygonWithHorizontalSegments function, we rotate the polygons to fill
184  // then fill them, then inverse rotate the result
185  SHAPE_LINE_CHAIN outline90;
186  outline90.Append( outline0 );
187 
188  // Rotate 90 degrees the outline:
189  for( int ii = 0; ii < outline90.PointCount(); ii++ )
190  {
191  VECTOR2I& point = outline90.Point( ii );
192  std::swap( point.x, point.y );
193  point.y = -point.y;
194  }
195 
196  int first_point = m_FillSegmList.size();
197  success = fillPolygonWithHorizontalSegments( outline90, m_FillSegmList, grid_size );
198 
199  if( !success )
200  break;
201 
202  // Rotate -90 degrees the segments:
203  for( unsigned ii = first_point; ii < m_FillSegmList.size(); ii++ )
204  {
205  SEGMENT& segm = m_FillSegmList[ii];
206  std::swap( segm.m_Start.x, segm.m_Start.y );
207  std::swap( segm.m_End.x, segm.m_End.y );
208  segm.m_Start.x = - segm.m_Start.x;
209  segm.m_End.x = - segm.m_End.x;
210  }
211  }
212 
213  if( success )
214  m_IsFilled = true;
215  else
216  m_FillSegmList.clear();
217 
218  return success;
219 }
wxPoint m_End
Definition: class_zone.h:60
int PointCount() const
Function PointCount()
bool fillPolygonWithHorizontalSegments(const SHAPE_LINE_CHAIN &aPolygon, std::vector< SEGMENT > &aFillSegmList, int aStep)
Helper function fillPolygonWithHorizontalSegments fills a polygon with horizontal segments...
int OutlineCount() const
Returns the number of outlines in the set
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
bool m_IsFilled
True when a zone was filled, false after deleting the filled areas.
Definition: class_zone.h:757
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:788
int m_ZoneMinThickness
Minimum thickness value in filled areas.
Definition: class_zone.h:750
#define max(a, b)
Definition: auxiliary.h:86
Class SHAPE_LINE_CHAIN.
Struct SEGMENT is a simple container used when filling areas with segments.
Definition: class_zone.h:57
VECTOR2I & Point(int aIndex)
Function Point()
wxPoint m_Start
Definition: class_zone.h:59
std::vector< SEGMENT > m_FillSegmList
Segments used to fill the zone (m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:778
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 782 of file class_zone.cpp.

References FlipLayer(), BOARD_ITEM::GetBoard(), BOARD::GetCopperLayerCount(), BOARD_ITEM::GetLayer(), Mirror(), and BOARD_ITEM::SetLayer().

783 {
784  Mirror( aCentre );
785  int copperLayerCount = GetBoard()->GetCopperLayerCount();
786  SetLayer( FlipLayer( GetLayer(), copperLayerCount ) );
787 }
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Function FlippedLayerNumber.
Definition: lset.cpp:445
int GetCopperLayerCount() const
Function GetCopperLayerCount.
PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
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:790
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 170 of file class_board_item.cpp.

171 {
172  char temp[50];
173 
174  int len = snprintf( temp, sizeof(temp), "%.10g", aAngle / 10.0 );
175 
176  return std::string( temp, len );
177 }
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 89 of file class_board_item.cpp.

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

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

Definition at line 180 of file class_board_item.cpp.

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

181 {
182  return FormatInternalUnits( aPoint.x ) + " " + FormatInternalUnits( aPoint.y );
183 }
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 186 of file class_board_item.cpp.

References BOARD_ITEM::FormatInternalUnits().

187 {
188  return FormatInternalUnits( aSize.GetWidth() ) + " " + FormatInternalUnits( aSize.GetHeight() );
189 }
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 198 of file class_zone.h.

References m_ArcToSegmentsCount.

Referenced by IsSame(), and ZONE_SETTINGS::operator<<().

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

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

Definition at line 63 of file class_board_item.cpp.

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

Referenced by buildFeatureHoleList(), DeleteMarkedItems(), TEXTE_PCB::Draw(), PCB_TARGET::Draw(), EDGE_MODULE::Draw(), Draw(), TEXTE_MODULE::Draw(), TRACK::Draw(), DRAWSEGMENT::Draw(), DIMENSION::Draw(), MODULE::Draw(), D_PAD::Draw(), SEGZONE::Draw(), VIA::Draw(), MODULE::DrawAncre(), DrawFilledArea(), BOARD_PRINTOUT_CONTROLLER::DrawPage(), DrawWhileCreateOutline(), EVT_COMMAND_RANGE(), POINT_EDITOR::finishItem(), TEXTE_PCB::Flip(), TRACK::Flip(), VIA::Flip(), Flip(), BOARD_ITEM::GetBoard(), MODULE::GetBoundingBox(), BOARD_ITEM::GetLayerName(), TRACK::GetMsgPanelInfo(), NETINFO_ITEM::GetMsgPanelInfo(), D_PAD::GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase(), SEGZONE::GetMsgPanelInfoBase(), VIA::GetMsgPanelInfoBase(), TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetClass(), TRACK::GetSelectMenuText(), SEGZONE::GetSelectMenuText(), VIA::GetSelectMenuText(), D_PAD::GetSelectMenuText(), GetSelectMenuText(), D_PAD::GetSolderMaskMargin(), D_PAD::GetSolderPasteMargin(), BRDITEMS_PLOTTER::PlotDimension(), PushTrack(), BOARD_CONNECTED_ITEM::SetNet(), BOARD_CONNECTED_ITEM::SetNetCode(), and VIA::ViewGetLOD().

64 {
65  if( Type() == PCB_T )
66  return (BOARD*) this;
67 
68  BOARD_ITEM* parent = GetParent();
69 
70  if( parent )
71  return parent->GetBoard();
72 
73  return NULL;
74 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
BOARD_ITEM_CONTAINER * GetParent() const
Definition: typeinfo.h:97
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:166
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 349 of file class_zone.cpp.

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

Referenced by buildFeatureHoleList(), BuildUnconnectedThermalStubsPolygonList(), BOARD::ComputeBoundingBox(), PCB_EDIT_FRAME::Delete_Zone_Contour(), HitTest(), and PCB_EDIT_FRAME::Remove_Zone_Corner().

350 {
351  const int PRELOAD = 0x7FFFFFFF; // Biggest integer (32 bits)
352 
353  int ymax = -PRELOAD;
354  int ymin = PRELOAD;
355  int xmin = PRELOAD;
356  int xmax = -PRELOAD;
357 
358  int count = GetNumCorners();
359 
360  for( int i = 0; i<count; ++i )
361  {
362  wxPoint corner = static_cast<wxPoint>( GetCornerPosition( i ) );
363 
364  ymax = std::max( ymax, corner.y );
365  xmax = std::max( xmax, corner.x );
366  ymin = std::min( ymin, corner.y );
367  xmin = std::min( xmin, corner.x );
368  }
369 
370  EDA_RECT ret( wxPoint( xmin, ymin ), wxSize( xmax - xmin + 1, ymax - ymin + 1 ) );
371 
372  return ret;
373 }
int GetNumCorners(void) const
Access to m_Poly parameters.
Definition: class_zone.h:466
const VECTOR2I & GetCornerPosition(int aCornerIndex) const
Definition: class_zone.h:506
#define max(a, b)
Definition: auxiliary.h:86
Class EDA_RECT handles the component boundary box.
#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 105 of file class_board_item.h.

References BOARD_ITEM::GetPosition().

Referenced by LEGACY_ARRAY_CREATOR::getRotationCentre(), and DIALOG_CREATE_ARRAY::ARRAY_CIRCULAR_OPTIONS::TransformItem().

105 { 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 457 of file class_zone.h.

458  {
459  return wxT( "ZONE_CONTAINER" );
460  }
int ZONE_CONTAINER::GetClearance ( BOARD_CONNECTED_ITEM aItem = NULL) const
overridevirtual

Function GetClearance returns the clearance in 1/10000 inches.

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 1/10000 inches.

Reimplemented from BOARD_CONNECTED_ITEM.

Definition at line 609 of file class_zone.cpp.

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

Referenced by buildFeatureHoleList(), ZONE_SETTINGS::operator<<(), BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines(), and TransformOutlinesShapeWithClearanceToPolygon().

610 {
611  int myClearance = m_ZoneClearance;
612 
613 #if 0 // Maybe the netclass clearance should not come into play for a zone?
614  // At least the policy decision can be controlled by the zone
615  // itself, i.e. here. On reasons of insufficient documentation,
616  // the user will be less bewildered if we simply respect the
617  // "zone clearance" setting in the zone properties dialog. (At least
618  // until there is a UI boolean for this.)
619 
620  NETCLASSPTR myClass = GetNetClass();
621 
622  if( myClass )
623  myClearance = std::max( myClearance, myClass->GetClearance() );
624 #endif
625 
626  if( aItem )
627  {
628  int hisClearance = aItem->GetClearance( NULL );
629  myClearance = std::max( hisClearance, myClearance );
630  }
631 
632  return myClearance;
633 }
int m_ZoneClearance
Clearance value in internal units.
Definition: class_zone.h:749
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 1/10000 inches.
#define max(a, b)
Definition: auxiliary.h:86
const VECTOR2I& ZONE_CONTAINER::GetCornerPosition ( int  aCornerIndex) const
inline

Definition at line 506 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(), ZONE_CREATE_HELPER::performZoneCutout(), Show_New_Edge_While_Move_Mouse(), and PCB_EDIT_FRAME::Start_Move_Zone_Corner().

507  {
509 
510  // Convert global to relative indices
511  if( !m_Poly->GetRelativeIndices( aCornerIndex, &index ) )
512  throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
513 
514  return m_Poly->CVertex( index );
515  }
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:725
unsigned int ZONE_CONTAINER::GetCornerRadius ( ) const
inline

Definition at line 621 of file class_zone.h.

References m_cornerRadius.

Referenced by ZONE_SETTINGS::operator<<().

621 { return m_cornerRadius; };
unsigned int m_cornerRadius
Definition: class_zone.h:728
int ZONE_CONTAINER::GetCornerSmoothingType ( ) const
inline

Definition at line 617 of file class_zone.h.

References m_cornerSmoothingType.

Referenced by ZONE_SETTINGS::operator<<().

617 { return m_cornerSmoothingType; };
int m_cornerSmoothingType
Definition: class_zone.h:727
static int ZONE_CONTAINER::GetDefaultHatchPitchMils ( )
inlinestatic

Function GetDefaultHatchPitchMils.

Returns
int - the default hatch pitch in mils.
Todo:
This value is hardcoded, but it should be user configurable.

Definition at line 680 of file class_zone.h.

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

680 { return 20; }
bool ZONE_CONTAINER::GetDoNotAllowCopperPour ( ) const
inline

Definition at line 655 of file class_zone.h.

References m_doNotAllowCopperPour.

Referenced by buildFeatureHoleList(), GetMsgPanelInfo(), IsSame(), and ZONE_SETTINGS::operator<<().

655 { return m_doNotAllowCopperPour; }
bool m_doNotAllowCopperPour
Definition: class_zone.h:744
bool ZONE_CONTAINER::GetDoNotAllowTracks ( ) const
inline
bool ZONE_CONTAINER::GetDoNotAllowVias ( ) const
inline
const SHAPE_POLY_SET& ZONE_CONTAINER::GetFilledPolysList ( ) const
inline

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

Returns
Reference to the list of filled polygons.

Definition at line 587 of file class_zone.h.

References m_FilledPolysList.

Referenced by RN_NET::AddItem(), CINFO3D_VISU::AddSolidAreasShapesToContainer(), PCB_EDIT_FRAME::createPopUpMenuForZones(), KIGFX::PCB_PAINTER::draw(), export_vrml_zones(), BRDITEMS_PLOTTER::PlotFilledAreas(), sort_areas(), BOARD::Test_Connections_To_Copper_Areas(), and TransformSolidAreasShapesToPolygonSet().

588  {
589  return m_FilledPolysList;
590  }
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:788
int ZONE_CONTAINER::GetFillMode ( ) const
inline

Definition at line 186 of file class_zone.h.

References m_FillMode.

Referenced by IsSame(), ZONE_SETTINGS::operator<<(), and BRDITEMS_PLOTTER::PlotFilledAreas().

186 { return m_FillMode; }
int m_FillMode
How to fill areas: 0 => use filled polygons, 1 => fill with segments.
Definition: class_zone.h:767
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(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), 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(), 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(), SCH_SCREEN::GetConnection(), InitialiseDragParameters(), LIB_EDIT_FRAME::LoadOneSymbol(), Magnetize(), SCH_EDIT_FRAME::MirrorImage(), SCH_EDIT_FRAME::MirrorSheet(), moveBitmap(), 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(), SCH_EDIT_FRAME::OnMoveItem(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick(), TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick(), 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(), PCB_EDIT_FRAME::PlaceTarget(), FOOTPRINT_EDIT_FRAME::PrepareItemForHotkey(), LIB_EDIT_FRAME::Process_Special_Functions(), EDIT_TOOL::Properties(), 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(), SCH_EDIT_FRAME::SaveCopyInUndoList(), SCH_SCREEN::SelectBlockItems(), SCH_EDIT_FRAME::SetBusEntryShape(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp(), Show_Drag_Track_Segment_With_Cte_Slope(), Show_MoveNode(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), DIALOG_LABEL_EDITOR::TextPropertiesAccept(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow(), and DIALOG_MODULE_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 713 of file class_zone.h.

References m_HatchLines.

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

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

Hatch related methods.

Function GetHatchPitch

Returns
int - the zone hatch pitch in iu.

Definition at line 896 of file class_zone.cpp.

References m_hatchPitch.

Referenced by operator=().

897 {
898  return m_hatchPitch;
899 }
HATCH_STYLE ZONE_CONTAINER::GetHatchStyle ( ) const
inline

Definition at line 554 of file class_zone.h.

References m_hatchStyle.

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

555  {
556  return m_hatchStyle;
557  }
HATCH_STYLE m_hatchStyle
Definition: class_zone.h:790
PCB_LAYER_ID BOARD_ITEM::GetLayer ( ) const
inlineinherited

Function GetLayer returns the primary layer this item is on.

Definition at line 132 of file class_board_item.h.

References BOARD_ITEM::m_Layer.

Referenced by Abort_MoveOrCopyModule(), DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), CINFO3D_VISU::AddGraphicsShapesWithClearanceToContainer(), DIMENSION::AdjustDimensionDetails(), PCB_EDIT_FRAME::Begin_DrawSegment(), PCB_EDIT_FRAME::Begin_Zone(), GRID_HELPER::BestSnapAnchor(), PCB_EDIT_FRAME::Block_SelectItems(), buildFeatureHoleList(), BuildUnconnectedThermalStubsPolygonList(), PCB_EDIT_FRAME::Change_Side_Module(), checkConnectedTo(), BOARD::CombineAllAreasInNet(), BOARD::ConvertBrdLayerToPolygonalContours(), MODULE::CopyNetlistSettings(), CreateBoardSection(), CINFO3D_VISU::createLayers(), MWAVE::CreateMicrowaveInductor(), CreateRoutesSection(), DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DRC::doEdgeZoneDrc(), PCB_EDIT_FRAME::DoGenFootprintsPositionFile(), DRC::doTrackKeepoutDrc(), TEXTE_MODULE::Draw(), DRAWSEGMENT::Draw(), KIGFX::PCB_PAINTER::draw(), PCB_EDIT_FRAME::duplicateZone(), FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer(), PCB_EDIT_FRAME::Edit_Zone_Params(), PCB_EDIT_FRAME::End_Zone(), export_vrml_drawsegment(), export_vrml_edge_module(), export_vrml_module(), export_vrml_pcbtext(), export_vrml_text_module(), export_vrml_zones(), PCB_EDIT_FRAME::ExportToGenCAD(), TEXTE_PCB::Flip(), PCB_TARGET::Flip(), EDGE_MODULE::Flip(), TEXTE_MODULE::Flip(), TRACK::Flip(), MODULE::Flip(), DIMENSION::Flip(), DRAWSEGMENT::Flip(), Flip(), PCB_IO::FootprintSave(), FootprintWriteShape(), PCB_IO::formatLayer(), DSN::SPECCTRA_DB::FromBOARD(), genModuleOnRoutingMatrix(), genPlacementRoutingMatrix(), BOARD::GetFootprint(), getOptimalModulePlacement(), BOARD::GetPad(), BOARD::GetVisibleTrack(), SELECTION_TOOL::guessSelectionCandidates(), Hatch(), BOARD::HitTestForAnyFilledArea(), idf_export_module(), DIALOG_NON_COPPER_ZONES_EDITOR::Init(), DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties(), GENERAL_COLLECTOR::Inspect(), D_PAD::IsFlipped(), MODULE::IsFlipped(), IsOnCopperLayer(), IsSame(), itemIsIncludedByFilter(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), BOARD::MarkTrace(), BOARD::NormalizeAreaPolygon(), BOARD::OnAreaPolygonModified(), PCB_EDIT_FRAME::OnRightClick(), ZONE_SETTINGS::operator<<(), PlaceCells(), PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment(), BRDITEMS_PLOTTER::Plot_1_EdgeModule(), BRDITEMS_PLOTTER::Plot_Edges_Modules(), BRDITEMS_PLOTTER::PlotAllTextsModule(), BRDITEMS_PLOTTER::PlotDimension(), BRDITEMS_PLOTTER::PlotDrawSegment(), BRDITEMS_PLOTTER::PlotFilledAreas(), BRDITEMS_PLOTTER::PlotPcbTarget(), PlotSilkScreen(), PlotSolderMaskLayer(), PlotStandardLayer(), BRDITEMS_PLOTTER::PlotTextePcb(), Print_Module(), PCB_EDIT_FRAME::PrintPage(), BOARD::RedrawAreasOutlines(), BOARD::RedrawFilledAreas(), TRACKS_CLEANER::remove_duplicates_of_track(), PCB_EDIT_FRAME::Remove_Zone_Corner(), SaveCopyOfZones(), SELECTION_TOOL::selectable(), ShowClearance(), 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::Swap_Layers(), PNS_KICAD_IFACE::syncTrack(), BOARD::Test_Connections_To_Copper_Areas(), BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines(), BOARD::TestAreaIntersection(), BOARD::TestAreaIntersections(), TestForCopperIslandAndRemoveInsulatedIslands(), DRC::testKeepoutAreas(), TEXTE_MODULE::TEXTE_MODULE(), TraceSegmentPcb(), TrackListSortByNetcode(), DialogEditModuleText::TransferDataFromWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), DIALOG_MODULE_BOARD_EDITOR::TransferDataFromWindow(), DialogEditModuleText::TransferDataToWindow(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::TransferDataToWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow(), CINFO3D_VISU::transformGraphicModuleEdgeToPolygonSet(), MODULE::TransformGraphicShapesWithClearanceToPolygonSet(), MODULE::TransformGraphicTextWithClearanceToPolygonSet(), TstModuleOnBoard(), TEXTE_MODULE::ViewGetLayers(), TRACK::ViewGetLayers(), TRACKS_CLEANER::zoneForTrackEndpoint(), and PCB_EDITOR_CONTROL::ZoneMerge().

132 { return m_Layer; }
PCB_LAYER_ID m_Layer
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 77 of file class_board_item.cpp.

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

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

78 {
79  BOARD* board = GetBoard();
80 
81  if( board )
82  return board->GetLayerName( m_Layer );
83 
84  // If no parent, return standard name
86 }
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:166
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:646
virtual LSET BOARD_ITEM::GetLayerSet ( ) const
inlinevirtualinherited

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 in VIA, and D_PAD.

Definition at line 140 of file class_board_item.h.

Referenced by build_pad_testpoints(), BOARD::chainMarkedSegments(), Collect_TrackSegmentsToDrag(), DRC::doTrackDrc(), PCB_EDIT_FRAME::EraseRedundantTrack(), find_vias_and_tracks_at(), TRACK::GetEndSegments(), TRACK::GetTrack(), BOARD::MarkTrace(), PCB_EDIT_FRAME::PrintPage(), RN_NET::processZones(), CONNECTIONS::SearchConnectedTracks(), CONNECTIONS::SearchTracksConnectedToPads(), and PCB_EDIT_FRAME::StartMoveOneNodeOrSegment().

140 { return LSET( m_Layer ); }
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 241 of file class_zone.h.

References m_localFlgs.

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

241 { return m_localFlgs; }
int m_localFlgs
Variable used in polygon calculations.
Definition: class_zone.h:773
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 1094 of file class_zone.cpp.

1095 {
1096  return add_zone_xpm;
1097 }
int ZONE_CONTAINER::GetMinThickness ( ) const
inline
void ZONE_CONTAINER::GetMsgPanelInfo ( 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 642 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().

643 {
644  wxString msg;
645 
646  msg = _( "Zone Outline" );
647 
648  // Display Cutout instead of Outline for holes inside a zone
649  // i.e. when num contour !=0
650  // Check whether the selected corner is in a hole; i.e., in any contour but the first one.
651  if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
652  msg << wxT( " " ) << _( "(Cutout)" );
653 
654  aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg, DARKCYAN ) );
655 
656  if( GetIsKeepout() )
657  {
658  msg.Empty();
659 
660  if( GetDoNotAllowVias() )
661  AccumulateDescription( msg, _( "No via" ) );
662 
663  if( GetDoNotAllowTracks() )
664  AccumulateDescription( msg, _("No track") );
665 
667  AccumulateDescription( msg, _("No copper pour") );
668 
669  aList.push_back( MSG_PANEL_ITEM( _( "Keepout" ), msg, RED ) );
670  }
671  else if( IsOnCopperLayer() )
672  {
673  if( GetNetCode() >= 0 )
674  {
675  NETINFO_ITEM* net = GetNet();
676 
677  if( net )
678  msg = net->GetNetname();
679  else // Should not occur
680  msg = _( "<unknown>" );
681  }
682  else // a netcode < 0 is an error
683  msg = wxT( "<error>" );
684 
685  aList.push_back( MSG_PANEL_ITEM( _( "NetName" ), msg, RED ) );
686 
687  // Display net code : (useful in test or debug)
688  msg.Printf( wxT( "%d" ), GetNetCode() );
689  aList.push_back( MSG_PANEL_ITEM( _( "NetCode" ), msg, RED ) );
690 
691  // Display priority level
692  msg.Printf( wxT( "%d" ), GetPriority() );
693  aList.push_back( MSG_PANEL_ITEM( _( "Priority" ), msg, BLUE ) );
694  }
695  else
696  {
697  aList.push_back( MSG_PANEL_ITEM( _( "Non Copper Zone" ), wxEmptyString, RED ) );
698  }
699 
700  aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), BROWN ) );
701 
702  msg.Printf( wxT( "%d" ), (int) m_Poly->TotalVertices() );
703  aList.push_back( MSG_PANEL_ITEM( _( "Corners" ), msg, BLUE ) );
704 
705  if( m_FillMode )
706  msg = _( "Segments" );
707  else
708  msg = _( "Polygons" );
709 
710  aList.push_back( MSG_PANEL_ITEM( _( "Fill Mode" ), msg, BROWN ) );
711 
712  // Useful for statistics :
713  msg.Printf( wxT( "%d" ), (int) m_HatchLines.size() );
714  aList.push_back( MSG_PANEL_ITEM( _( "Hatch Lines" ), msg, BLUE ) );
715 
716  if( !m_FilledPolysList.IsEmpty() )
717  {
718  msg.Printf( wxT( "%d" ), m_FilledPolysList.TotalVertices() );
719  aList.push_back( MSG_PANEL_ITEM( _( "Corner Count" ), msg, BLUE ) );
720  }
721 }
Definition: colors.h:57
bool GetDoNotAllowCopperPour() const
Definition: class_zone.h:655
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:770
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:654
std::vector< SEG > m_HatchLines
Definition: class_zone.h:792
int m_FillMode
How to fill areas: 0 => use filled polygons, 1 => fill with segments.
Definition: class_zone.h:767
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:725
Definition: colors.h:60
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:788
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.
bool IsOnCopperLayer() const
Function IsOnCopperLayer.
Definition: class_zone.h:179
bool GetDoNotAllowTracks() const
Definition: class_zone.h:657
bool GetDoNotAllowVias() const
Definition: class_zone.h:656
bool IsEmpty() const
Returns true if the set is empty (no polygons at all)
const wxString & GetNetname() const
Function GetNetname.
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:119
NETINFO_ITEM * GetNet() const
Function GetNet Returns NET_INFO object for a given item.
Definition: colors.h:62
NETCLASSPTR BOARD_CONNECTED_ITEM::GetNetClass ( ) const
inherited

Function GetNetClass returns the NETCLASS for this item.

Definition at line 104 of file class_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 DIALOG_TRACK_VIA_PROPERTIES::Apply(), DRC::doTrackDrc(), GetClearance(), BOARD_CONNECTED_ITEM::GetClearance(), VIA::GetDrillValue(), TRACK::GetMsgPanelInfo(), BOARD_CONNECTED_ITEM::GetNetClassName(), and ROUTER_TOOL::prepareInteractive().

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:530
int GetNetCode() const
Function GetNetCode.
Class NETINFO_ITEM handles the data for a net.
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:166
NETCLASSPTR GetNetClass()
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 class_board_connected_item.cpp.

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

Referenced by PCB_EDIT_FRAME::createPopUpMenuForFpPads(), and PCB_EDIT_FRAME::createPopupMenuForTracks().

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
const char * name
int BOARD_CONNECTED_ITEM::GetNetCode ( ) const
inlineinherited

Function GetNetCode.

Returns
int - the net code.

Definition at line 109 of file class_board_connected_item.h.

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

Referenced by RN_DATA::AddBlocked(), AddClearanceAreasPolygonsToPolysList_NG(), RN_DATA::AddSimple(), RN_DATA::AreConnected(), PCB_EDIT_FRAME::Attribut_net(), PCB_EDIT_FRAME::Autoroute(), PCB_EDIT_FRAME::Begin_Route(), PCB_EDIT_FRAME::Begin_Zone(), PCB_BASE_FRAME::build_ratsnest_module(), Build_Work(), PCB_BASE_FRAME::BuildAirWiresTargetsList(), buildFeatureHoleList(), NETINFO_LIST::buildListOfNets(), BuildUnconnectedThermalStubsPolygonList(), PCB_EDIT_FRAME::Change_Net_Tracks_And_Vias_Sizes(), Collect_TrackSegmentsToDrag(), BOARD::CombineAllAreasInNet(), D_PAD::CopyNetlistSettings(), CreateRoutesSection(), CreateSignalsSection(), PCB_EDIT_FRAME::Delete_net(), PCB_EDIT_FRAME::Delete_Segment(), PCB_EDIT_FRAME::Delete_Track(), DRC::doEdgeZoneDrc(), DRC::doPadToPadsDrc(), DRC::doTrackDrc(), KIGFX::PCB_PAINTER::draw(), VIA::Draw(), BOARD::DrawHighLight(), D_PAD::DrawShape(), TRACK::DrawShortNetname(), PCB_EDIT_FRAME::duplicateZone(), PCB_EDIT_FRAME::End_Zone(), PCB_EDIT_FRAME::EraseRedundantTrack(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), PCB_EDIT_FRAME::Fill_Zone(), PNS::NODE::FindItemByParent(), POINT_EDITOR::finishItem(), DSN::SPECCTRA_DB::FromBOARD(), TRACK::GetBestInsertPoint(), RN_DATA::GetConnectedItems(), TRACK::GetEndNetCode(), GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetClass(), TRACK::GetSelectMenuText(), VIA::GetSelectMenuText(), GetSelectMenuText(), TRACK::GetStartNetCode(), TRACK::GetTrack(), BOARD::HitTestForAnyFilledArea(), IsSame(), LocateIntrusion(), Magnetize(), DSN::SPECCTRA_DB::makeIMAGE(), Merge_SubNets_Connected_By_CopperAreas(), BOARD::NormalizeAreaPolygon(), BOARD::OnAreaPolygonModified(), ZONE_SETTINGS::operator<<(), PlaceCells(), PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment(), PCB_EDIT_FRAME::Process_Special_Functions(), RN_DATA::ProcessBoard(), PushTrack(), TRACKS_CLEANER::remove_duplicates_of_track(), PCB_EDIT_FRAME::Remove_One_Track(), PCB_EDIT_FRAME::Remove_Zone_Corner(), TRACKS_CLEANER::removeBadTrackSegments(), PCB_SELECTION_CONDITIONS::sameNetFunc(), SaveCopyOfZones(), BOARD::SetAreasNetCodesFromNetNames(), PCB_EDIT_FRAME::Show_1_Ratsnest(), sort_areas(), sortByNetcode(), SortTracksByNetCode(), 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::Test_Connections_To_Copper_Areas(), BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines(), BOARD::TestAreaIntersections(), TestForCopperIslandAndRemoveInsulatedIslands(), PCB_BASE_FRAME::TestNetConnection(), DRC::testZones(), TrackListSortByNetcode(), BOARD::TracksInNet(), NETINFO_MAPPING::Update(), ZONE_CONTAINER(), TRACKS_CLEANER::zoneForTrackEndpoint(), and PCB_EDITOR_CONTROL::ZoneMerge().

110  {
111  return m_netinfo->GetNet();
112  }
int GetNet() const
Function GetNet.
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.
int BOARD_ITEM::getNextNumberInSequence ( const std::set< int > &  aSeq,
bool  aFillSequenceGaps 
)
staticprotectedinherited

Definition at line 223 of file class_board_item.cpp.

Referenced by MODULE::GetNextPadName().

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

Access to m_Poly parameters.

Definition at line 466 of file class_zone.h.

References m_Poly, and SHAPE_POLY_SET::TotalVertices().

Referenced by PCB_EDIT_FRAME::Begin_Zone(), BuildFilledSolidAreasPolygons(), PCB_EDIT_FRAME::Delete_LastCreatedCorner(), Draw(), PCB_EDIT_FRAME::End_Zone(), GetBoundingBox(), BOARD::OnAreaPolygonModified(), ZONE_CREATE_HELPER::performZoneCutout(), POINT_EDITOR::removeCornerCondition(), and Show_New_Edge_While_Move_Mouse().

467  {
468  return m_Poly->TotalVertices();
469  }
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:725
ZoneConnection ZONE_CONTAINER::GetPadConnection ( D_PAD aPad = NULL) const

Definition at line 814 of file class_zone.cpp.

References D_PAD::GetZoneConnection(), m_PadConnection, and PAD_ZONE_CONN_INHERITED.

Referenced by buildFeatureHoleList(), BuildUnconnectedThermalStubsPolygonList(), and ZONE_SETTINGS::operator<<().

815 {
816  if( aPad == NULL || aPad->GetZoneConnection() == PAD_ZONE_CONN_INHERITED )
817  return m_PadConnection;
818  else
819  return aPad->GetZoneConnection();
820 }
ZoneConnection m_PadConnection
Definition: class_zone.h:748
ZoneConnection GetZoneConnection() const
Definition: class_pad.cpp:610
BOARD_ITEM_CONTAINER* BOARD_ITEM::GetParent ( void  ) const
inlineinherited

Definition at line 126 of file class_board_item.h.

References EDA_ITEM::m_Parent.

Referenced by Abort_Move_ModuleOutline(), AbortMoveTextModule(), POINT_EDITOR::addCorner(), CmpHoleSorting(), PCB_EDIT_FRAME::createPopUpMenuForFpTexts(), FOOTPRINT_EDIT_FRAME::Delete_Edge_Module(), BOARD_ITEM::DeleteStructure(), PCB_BASE_FRAME::DeleteTextModule(), DialogEditModuleText::DialogEditModuleText(), KIGFX::PCB_PAINTER::draw(), TEXTE_MODULE::DrawUmbilical(), PCB_EDIT_FRAME::duplicateItems(), PCB_IO::format(), FormatProbeItem(), BOARD_ITEM::GetBoard(), LEGACY_ARRAY_CREATOR::getModule(), EDGE_MODULE::GetMsgPanelInfo(), EDGE_MODULE::GetSelectMenuText(), TEXTE_MODULE::GetSelectMenuText(), TEXTE_MODULE::GetShownText(), GENERAL_COLLECTOR::Inspect(), 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(), and PCB_BASE_FRAME::StartMoveTexteModule().

126 { 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 167 of file class_zone.cpp.

References GetCornerPosition(), and ZONE_CONTAINER::WX_VECTOR_CONVERTER::wx.

Referenced by DRC::fillMarker().

168 {
169  const WX_VECTOR_CONVERTER* pos;
170 
171  // The retrieved vertex is a VECTOR2I. Casting it to a union WX_VECTOR_CONVERTER, we can later
172  // return the object shaped as a wxPoint. See the definition of the union in class_zone.h for
173  // more information on this hack.
174  pos = reinterpret_cast<const WX_VECTOR_CONVERTER*>( &GetCornerPosition( 0 ) );
175  return pos->wx;
176 }
const VECTOR2I & GetCornerPosition(int aCornerIndex) const
Definition: class_zone.h:506
unsigned ZONE_CONTAINER::GetPriority ( ) const
inline
int ZONE_CONTAINER::GetSelectedCorner ( ) const
inline

Definition at line 212 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().

213  {
214  // Transform relative indices to global index
215  int globalIndex;
216  m_Poly->GetGlobalIndex( *m_CornerSelection, globalIndex );
217 
218  return globalIndex;
219  }
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:770
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:725
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 ( ) 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 846 of file class_zone.cpp.

References Format(), BOARD_ITEM::GetBoard(), GetChars(), GetIsKeepout(), BOARD_ITEM::GetLayerName(), BOARD_CONNECTED_ITEM::GetNet(), BOARD_CONNECTED_ITEM::GetNetCode(), BOARD_CONNECTED_ITEM::GetNetname(), NETINFO_ITEM::GetNetname(), SHAPE_POLY_SET::VERTEX_INDEX::m_contour, m_CornerSelection, and EDA_ITEM::m_TimeStamp.

Referenced by DRC::fillMarker(), and BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines().

847 {
848  wxString text;
849  NETINFO_ITEM* net;
850  BOARD* board = GetBoard();
851 
852  // Check whether the selected contour is a hole (contour index > 0)
853  if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
854  text << wxT( " " ) << _( "(Cutout)" );
855 
856  if( GetIsKeepout() )
857  text << wxT( " " ) << _( "(Keepout)" );
858 
859  text << wxString::Format( wxT( " (%08lX)" ), m_TimeStamp );
860 
861  // Display net name for copper zones
862  if( !GetIsKeepout() )
863  {
864  if( GetNetCode() >= 0 )
865  {
866  if( board )
867  {
868  net = GetNet();
869 
870  if( net )
871  {
872  text << wxT( " [" ) << net->GetNetname() << wxT( "]" );
873  }
874  }
875  else
876  {
877  text << _( "** NO BOARD DEFINED **" );
878  }
879  }
880  else
881  { // A netcode < 0 is an error:
882  // Netname not found or area not initialised
883  text << wxT( " [" ) << GetNetname() << wxT( "]" );
884  text << wxT( " <" ) << _( "Not Found" ) << wxT( ">" );
885  }
886  }
887 
888  wxString msg;
889  msg.Printf( _( "Zone Outline %s on %s" ), GetChars( text ),
890  GetChars( GetLayerName() ) );
891 
892  return msg;
893 }
time_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:169
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:770
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:654
int GetNetCode() const
Function GetNetCode.
Class NETINFO_ITEM handles the data for a net.
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
const wxString & GetNetname() const
Function GetNetname.
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
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:166
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
const wxString & GetNetname() const
Function GetNetname.
NETINFO_ITEM * GetNet() const
Function GetNet Returns NET_INFO object for a given item.
const wxString& BOARD_CONNECTED_ITEM::GetShortNetname ( ) const
inlineinherited

Function GetShortNetname.

Returns
wxString - the short netname

Definition at line 165 of file class_board_connected_item.h.

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

Referenced by KIGFX::PCB_PAINTER::draw(), and D_PAD::DrawShape().

166  {
167  return m_netinfo->GetShortNetname();
168  }
const wxString & GetShortNetname() const
Function GetShortNetname.
NETINFO_ITEM * m_netinfo
Stores all informations about the net that item belongs to.
SHAPE_POLY_SET* ZONE_CONTAINER::GetSmoothedPoly ( ) const
inline

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

References m_Poly, and m_smoothedPoly.

Referenced by BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines().

608  {
609  if( m_smoothedPoly )
610  return m_smoothedPoly;
611  else
612  return m_Poly;
613  };
SHAPE_POLY_SET * m_smoothedPoly
Definition: class_zone.h:726
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:725
STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 250 of file base_struct.h.

References EDA_ITEM::m_Status.

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

Definition at line 466 of file class_zone.cpp.

References D_PAD::GetThermalWidth(), and m_ThermalReliefCopperBridge.

Referenced by buildFeatureHoleList(), BuildUnconnectedThermalStubsPolygonList(), and ZONE_SETTINGS::operator<<().

467 {
468  if( aPad == NULL || aPad->GetThermalWidth() == 0 )
470  else
471  return aPad->GetThermalWidth();
472 }
int m_ThermalReliefCopperBridge
Definition: class_zone.h:763
int GetThermalWidth() const
Definition: class_pad.cpp:621
int ZONE_CONTAINER::GetThermalReliefGap ( D_PAD aPad = NULL) const

Definition at line 457 of file class_zone.cpp.

References D_PAD::GetThermalGap(), and m_ThermalReliefGap.

Referenced by buildFeatureHoleList(), BuildUnconnectedThermalStubsPolygonList(), and ZONE_SETTINGS::operator<<().

458 {
459  if( aPad == NULL || aPad->GetThermalGap() == 0 )
460  return m_ThermalReliefGap;
461  else
462  return aPad->GetThermalGap();
463 }
int GetThermalGap() const
Definition: class_pad.cpp:632
int m_ThermalReliefGap
Width of the copper bridge in thermal reliefs.
Definition: class_zone.h:760
int BOARD_ITEM::getTrailingInt ( wxString  aStr)
staticprotectedinherited

Definition at line 200 of file class_board_item.cpp.

Referenced by MODULE::GetNextPadName().

201 {
202  int number = 0;
203  int base = 1;
204 
205  // Trim and extract the trailing numeric part
206  int index = aStr.Len() - 1;
207  while( index >= 0 )
208  {
209  const char chr = aStr.GetChar( index );
210 
211  if( chr < '0' || chr > '9' )
212  break;
213 
214  number += ( chr - '0' ) * base;
215  base *= 10;
216  index--;
217  }
218 
219  return number;
220 }
int ZONE_CONTAINER::GetZoneClearance ( ) const
inline

Definition at line 203 of file class_zone.h.

References m_ZoneClearance.

Referenced by BuildUnconnectedThermalStubsPolygonList(), and DRC::doEdgeZoneDrc().

203 { return m_ZoneClearance; }
int m_ZoneClearance
Clearance value in internal units.
Definition: class_zone.h:749
int BOARD_CONNECTED_ITEM::GetZoneSubNet ( ) const
inlineinherited

Function GetZoneSubNet.

Returns
int - the sub net code in zone connections.

Definition at line 142 of file class_board_connected_item.h.

References BOARD_CONNECTED_ITEM::m_ZoneSubnet.

Referenced by CmpZoneSubnetValue(), D_PAD::GetMsgPanelInfo(), Merge_SubNets_Connected_By_CopperAreas(), and BOARD::Test_Connections_To_Copper_Areas().

143  {
144  return m_ZoneSubnet;
145  }
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 932 of file class_zone.cpp.

References SEG::A, SEG::B, DIAGONAL_EDGE, DIAGONAL_FULL, FindLineSegmentIntersection(), BOARD_ITEM::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 POINT_EDITOR::addCorner(), BOARD::CombineAreas(), ZONE_CREATE_HELPER::commitZone(), PCB_EDIT_FRAME::duplicateZone(), Mirror(), Move(), MoveEdge(), BOARD::NormalizeAreaPolygon(), Rotate(), SetHatch(), and POINT_EDITOR::updateItem().

933 {
934  UnHatch();
935 
936  if( m_hatchStyle == NO_HATCH || m_hatchPitch == 0 || m_Poly->IsEmpty() )
937  return;
938 
939  // define range for hatch lines
940  int min_x = m_Poly->Vertex( 0 ).x;
941  int max_x = m_Poly->Vertex( 0 ).x;
942  int min_y = m_Poly->Vertex( 0 ).y;
943  int max_y = m_Poly->Vertex( 0 ).y;
944 
945  for( auto iterator = m_Poly->IterateWithHoles(); iterator; iterator++ )
946  {
947  if( iterator->x < min_x )
948  min_x = iterator->x;
949 
950  if( iterator->x > max_x )
951  max_x = iterator->x;
952 
953  if( iterator->y < min_y )
954  min_y = iterator->y;
955 
956  if( iterator->y > max_y )
957  max_y = iterator->y;
958  }
959 
960  // Calculate spacing between 2 hatch lines
961  int spacing;
962 
963  if( m_hatchStyle == DIAGONAL_EDGE )
964  spacing = m_hatchPitch;
965  else
966  spacing = m_hatchPitch * 2;
967 
968  // set the "length" of hatch lines (the length on horizontal axis)
969  int hatch_line_len = m_hatchPitch;
970 
971  // To have a better look, give a slope depending on the layer
972  LAYER_NUM layer = GetLayer();
973  int slope_flag = (layer & 1) ? 1 : -1; // 1 or -1
974  double slope = 0.707106 * slope_flag; // 45 degrees slope
975  int max_a, min_a;
976 
977  if( slope_flag == 1 )
978  {
979  max_a = KiROUND( max_y - slope * min_x );
980  min_a = KiROUND( min_y - slope * max_x );
981  }
982  else
983  {
984  max_a = KiROUND( max_y - slope * max_x );
985  min_a = KiROUND( min_y - slope * min_x );
986  }
987 
988  min_a = (min_a / spacing) * spacing;
989 
990  // calculate an offset depending on layer number,
991  // for a better look of hatches on a multilayer board
992  int offset = (layer * 7) / 8;
993  min_a += offset;
994 
995  // loop through hatch lines
996  #define MAXPTS 200 // Usually we store only few values per one hatch line
997  // depending on the complexity of the zone outline
998 
999  static std::vector<VECTOR2I> pointbuffer;
1000  pointbuffer.clear();
1001  pointbuffer.reserve( MAXPTS + 2 );
1002 
1003  for( int a = min_a; a < max_a; a += spacing )
1004  {
1005  // get intersection points for this hatch line
1006 
1007  // Note: because we should have an even number of intersections with the
1008  // current hatch line and the zone outline (a closed polygon,
1009  // or a set of closed polygons), if an odd count is found
1010  // we skip this line (should not occur)
1011  pointbuffer.clear();
1012 
1013  // Iterate through all vertices
1014  for( auto iterator = m_Poly->IterateSegmentsWithHoles(); iterator; iterator++ )
1015  {
1016  double x, y, x2, y2;
1017  int ok;
1018 
1019  SEG segment = *iterator;
1020 
1021  ok = FindLineSegmentIntersection( a, slope,
1022  segment.A.x, segment.A.y,
1023  segment.B.x, segment.B.y,
1024  &x, &y, &x2, &y2 );
1025 
1026  if( ok )
1027  {
1028  VECTOR2I point( KiROUND( x ), KiROUND( y ) );
1029  pointbuffer.push_back( point );
1030  }
1031 
1032  if( ok == 2 )
1033  {
1034  VECTOR2I point( KiROUND( x2 ), KiROUND( y2 ) );
1035  pointbuffer.push_back( point );
1036  }
1037 
1038  if( pointbuffer.size() >= MAXPTS ) // overflow
1039  {
1040  wxASSERT( 0 );
1041  break;
1042  }
1043  }
1044 
1045  // ensure we have found an even intersection points count
1046  // because intersections are the ends of segments
1047  // inside the polygon(s) and a segment has 2 ends.
1048  // if not, this is a strange case (a bug ?) so skip this hatch
1049  if( pointbuffer.size() % 2 != 0 )
1050  continue;
1051 
1052  // sort points in order of descending x (if more than 2) to
1053  // ensure the starting point and the ending point of the same segment
1054  // are stored one just after the other.
1055  if( pointbuffer.size() > 2 )
1056  sort( pointbuffer.begin(), pointbuffer.end(), sortEndsByDescendingX );
1057 
1058  // creates lines or short segments inside the complex polygon
1059  for( unsigned ip = 0; ip < pointbuffer.size(); ip += 2 )
1060  {
1061  int dx = pointbuffer[ip + 1].x - pointbuffer[ip].x;
1062 
1063  // Push only one line for diagonal hatch,
1064  // or for small lines < twice the line length
1065  // else push 2 small lines
1066  if( m_hatchStyle == DIAGONAL_FULL || fabs( dx ) < 2 * hatch_line_len )
1067  {
1068  m_HatchLines.push_back( SEG( pointbuffer[ip], pointbuffer[ip + 1] ) );
1069  }
1070  else
1071  {
1072  double dy = pointbuffer[ip + 1].y - pointbuffer[ip].y;
1073  slope = dy / dx;
1074 
1075  if( dx > 0 )
1076  dx = hatch_line_len;
1077  else
1078  dx = -hatch_line_len;
1079 
1080  int x1 = KiROUND( pointbuffer[ip].x + dx );
1081  int x2 = KiROUND( pointbuffer[ip + 1].x - dx );
1082  int y1 = KiROUND( pointbuffer[ip].y + dx * slope );
1083  int y2 = KiROUND( pointbuffer[ip + 1].y - dx * slope );
1084 
1085  m_HatchLines.push_back(SEG(pointbuffer[ip].x, pointbuffer[ip].y, x1, y1));
1086 
1087  m_HatchLines.push_back( SEG( pointbuffer[ip+1].x, pointbuffer[ip+1].y, x2, y2 ) );
1088  }
1089  }
1090  }
1091 }
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
SEGMENT_ITERATOR IterateSegmentsWithHoles()
Returns an iterator object, for all outlines in the set (with holes)
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)
Definition: class_zone.cpp:926
std::vector< SEG > m_HatchLines
Definition: class_zone.h:792
ITERATOR IterateWithHoles(int aOutline)
Function IterateWithHoles.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:725
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:790
Definition: seg.h:37
PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
void UnHatch()
Function UnHatch clears the zone's hatch.
Definition: class_zone.cpp:918
VECTOR2I A
Definition: seg.h:47
bool IsEmpty() const
Returns true if the set is empty (no polygons at all)
VECTOR2I B
Definition: seg.h:48
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 483 of file class_zone.cpp.

References HitTestForCorner(), and HitTestForEdge().

Referenced by PCB_EDIT_FRAME::Block_SelectItems().

484 {
485  return HitTestForCorner( aPosition ) || HitTestForEdge( aPosition );
486 }
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:524
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:508
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 540 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().

541 {
542  // Calculate bounding box for zone
543  EDA_RECT bbox = GetBoundingBox();
544  bbox.Normalize();
545 
546  EDA_RECT arect = aRect;
547  arect.Normalize();
548  arect.Inflate( aAccuracy );
549 
550  if( aContained )
551  {
552  return arect.Contains( bbox );
553  }
554  else // Test for intersection between aBox and the polygon
555  // For a polygon, using its bounding box has no sense here
556  {
557  // Fast test: if aBox is outside the polygon bounding box,
558  // rectangles cannot intersect
559  if( !arect.Intersects( bbox ) )
560  return false;
561 
562  // aBox is inside the polygon bounding box,
563  // and can intersect the polygon: use a fine test.
564  // aBox intersects the polygon if at least one aBox corner
565  // is inside the polygon
566 
567  /*
568  wxPoint origin = arect.GetOrigin();
569 
570  int w = arect.GetWidth();
571  int h = arect.GetHeight();
572 
573 
574  if ( HitTestInsideZone( origin ) ||
575  HitTestInsideZone( origin + wxPoint( w, 0 ) ) ||
576  HitTestInsideZone( origin + wxPoint( w, h ) ) ||
577  HitTestInsideZone( origin + wxPoint( 0, h ) ) )
578  {
579  return true;
580  }
581  */
582 
583  // No corner inside aBox, but outlines can intersect aBox
584  // if one of outline corners is inside aBox
585  int count = m_Poly->TotalVertices();
586  for( int ii =0; ii < count; ii++ )
587  {
588  auto vertex = m_Poly->Vertex( ii );
589  auto vertexNext = m_Poly->Vertex( ( ii + 1 ) % count );
590 
591  // Test if the point is within the rect
592  if( arect.Contains( ( wxPoint ) vertex ) )
593  {
594  return true;
595  }
596 
597  // Test if this edge intersects the rect
598  if( arect.Intersects( ( wxPoint ) vertex, ( wxPoint ) vertexNext ) )
599  {
600  return true;
601  }
602  }
603 
604  return false;
605  }
606 }
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox (virtual)
Definition: class_zone.cpp:349
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:725
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.
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 636 of file class_zone.cpp.

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

Referenced by BuildUnconnectedThermalStubsPolygonList(), and BOARD::HitTestForAnyFilledArea().

637 {
638  return m_FilledPolysList.Contains( VECTOR2I( aRefPos.x, aRefPos.y ) );
639 }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:590
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:788
bool Contains(const VECTOR2I &aP, int aSubpolyIndex=-1) const
Returns true if a given subpolygon contains the point aP.
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 508 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(), and SetSelectedCorner().

510 {
511  int distmax = Millimeter2iu( MAX_DIST_IN_MM );
512 
513  return m_Poly->CollideVertex( VECTOR2I( refPos ), aCornerHit, distmax );
514 }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:590
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:725
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:506
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 517 of file class_zone.cpp.

References dummy(), and HitTestForCorner().

518 {
520  return HitTestForCorner( refPos, dummy );
521 }
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:508
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 524 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(), and SetSelectedCorner().

526 {
527  int distmax = Millimeter2iu( MAX_DIST_IN_MM );
528 
529  return m_Poly->CollideEdge( VECTOR2I( refPos ), aCornerHit, distmax );
530 }
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:590
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:725
#define MAX_DIST_IN_MM
Definition: class_zone.cpp:506
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 533 of file class_zone.cpp.

References dummy(), and HitTestForEdge().

534 {
536  return HitTestForEdge( refPos, dummy );
537 }
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:524
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 267 of file class_zone.h.

References SHAPE_POLY_SET::Contains(), and m_Poly.

268  {
269  return m_Poly->Contains( VECTOR2I( aPosition ), 0 );
270  }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:590
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:725
bool Contains(const VECTOR2I &aP, int aSubpolyIndex=-1) const
Returns true if a given subpolygon contains the point aP.
bool EDA_ITEM::IsBrightened ( ) const
inlineinherited

Definition at line 224 of file base_struct.h.

References BRIGHTENED.

Referenced by SELECTION_TOOL::disambiguationMenu().

224 { return m_Flags & BRIGHTENED; }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:137
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 81 of file class_board_connected_item.h.

82  {
83  return true;
84  }
bool EDA_ITEM::IsDragging ( ) const
inlineinherited
bool ZONE_CONTAINER::IsFilled ( ) const
inline

Definition at line 200 of file class_zone.h.

References m_IsFilled.

Referenced by export_vrml_zones(), POINT_EDITOR::finishItem(), and ZONE_CREATE_HELPER::performZoneCutout().

200 { return m_IsFilled; }
bool m_IsFilled
True when a zone was filled, false after deleting the filled areas.
Definition: class_zone.h:757
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:136
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 202 of file class_board_item.h.

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

203  {
204  // only MODULEs & TRACKs can be locked at this time.
205  return false;
206  }
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:109
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(), abortMoveBitmap(), abortMoveItem(), AbortPinMove(), AbortSymbolTraceOn(), SCH_EDIT_FRAME::addCurrentItemToList(), 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(), DrawMovePin(), SCH_EDIT_FRAME::EditSheetPin(), LIB_PIN::EnableEditMode(), LIB_EDIT_FRAME::EndDrawGraphicItem(), SCH_EDIT_FRAME::EndSegment(), ExitSheet(), 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(), LIB_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), LIB_EDIT_FRAME::OnRightClick(), SCH_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(), and DIALOG_LABEL_EDITOR::TextPropertiesAccept().

216 { return m_Flags & IS_NEW; }
#define IS_NEW
New item, just created.
Definition: base_struct.h:113
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
bool ZONE_CONTAINER::IsOnCopperLayer ( ) const
inline
virtual bool BOARD_ITEM::IsOnLayer ( PCB_LAYER_ID  aLayer) const
inlinevirtualinherited

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 in D_PAD, VIA, and MARKER_PCB.

Definition at line 182 of file class_board_item.h.

Referenced by CINFO3D_VISU::createLayers(), TEXTE_PCB::Draw(), EDGE_MODULE::Draw(), Draw(), TEXTE_MODULE::Draw(), TRACK::Draw(), DRAWSEGMENT::Draw(), SEGZONE::Draw(), DrawFilledArea(), TRACK::DrawShortNetname(), DrawWhileCreateOutline(), GENERAL_COLLECTOR::Inspect(), SELECTION_TOOL::selectable(), BOARD::Test_Connections_To_Copper_Areas(), and TraceSegmentPcb().

183  {
184  return m_Layer == aLayer;
185  }
PCB_LAYER_ID m_Layer
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_SHEET_PIN, SCH_FIELD, and SCH_TEXT.

Definition at line 444 of file base_struct.h.

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

444 { 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:114
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 64 of file zones_functions_for_undo_redo.cpp.

References GetArcSegmentCount(), GetDoNotAllowCopperPour(), GetDoNotAllowTracks(), GetDoNotAllowVias(), GetFillMode(), GetIsKeepout(), BOARD_ITEM::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 UpdateCopyOfZonesList().

65 {
66  // compare basic parameters:
67  if( GetLayer() != aZoneToCompare.GetLayer() )
68  return false;
69 
70  if( GetNetCode() != aZoneToCompare.GetNetCode() )
71  return false;
72 
73  if( GetPriority() != aZoneToCompare.GetPriority() )
74  return false;
75 
76  // Compare zone specific parameters
77  if( GetIsKeepout() != aZoneToCompare.GetIsKeepout() )
78  return false;
79 
80  if( GetIsKeepout() )
81  {
82  if( GetDoNotAllowCopperPour() != aZoneToCompare.GetDoNotAllowCopperPour() )
83  return false;
84 
85  if( GetDoNotAllowVias() != aZoneToCompare.GetDoNotAllowVias() )
86  return false;
87 
88  if( GetDoNotAllowTracks() != aZoneToCompare.GetDoNotAllowTracks() )
89  return false;
90  }
91 
92  if( m_ArcToSegmentsCount != aZoneToCompare.GetArcSegmentCount() )
93  return false;
94 
95  if( m_ZoneClearance != aZoneToCompare.m_ZoneClearance )
96  return false;
97 
98  if( m_ZoneMinThickness != aZoneToCompare.GetMinThickness() )
99  return false;
100 
101  if( m_FillMode != aZoneToCompare.GetFillMode() )
102  return false;
103 
104  if( m_PadConnection != aZoneToCompare.m_PadConnection )
105  return false;
106 
107  if( m_ThermalReliefGap != aZoneToCompare.m_ThermalReliefGap )
108  return false;
109 
111  return false;
112 
113 
114  // Compare outlines
115  wxASSERT( m_Poly ); // m_Poly == NULL Should never happen
116  wxASSERT( aZoneToCompare.Outline() );
117 
118  if( Outline() != aZoneToCompare.Outline() ) // Compare vector
119  return false;
120 
121  return true;
122 }
int m_ZoneClearance
Clearance value in internal units.
Definition: class_zone.h:749
int GetMinThickness() const
Definition: class_zone.h:209
bool GetDoNotAllowCopperPour() const
Definition: class_zone.h:655
int GetArcSegmentCount() const
Definition: class_zone.h:198
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:247
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:654
int m_ArcToSegmentsCount
The number of segments to convert a circle to a polygon.
Definition: class_zone.h:754
int m_ThermalReliefCopperBridge
Definition: class_zone.h:763
ZoneConnection m_PadConnection
Definition: class_zone.h:748
int m_FillMode
How to fill areas: 0 => use filled polygons, 1 => fill with segments.
Definition: class_zone.h:767
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:725
int GetNetCode() const
Function GetNetCode.
PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
int m_ThermalReliefGap
Width of the copper bridge in thermal reliefs.
Definition: class_zone.h:760
bool GetDoNotAllowTracks() const
Definition: class_zone.h:657
int m_ZoneMinThickness
Minimum thickness value in filled areas.
Definition: class_zone.h:750
int GetFillMode() const
Definition: class_zone.h:186
bool GetDoNotAllowVias() const
Definition: class_zone.h:656
unsigned GetPriority() const
Function GetPriority.
Definition: class_zone.h:119
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 193 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().

194  {
195  return ( Type() == PCB_TRACE_T ) || ( Type() == PCB_VIA_T );
196  }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:107
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:108
bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 220 of file base_struct.h.

References IS_WIRE_IMAGE.

Referenced by abortMoveItem(), and 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:117
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 476 of file class_zone.h.

References SHAPE_POLY_SET::Iterate(), and m_Poly.

477  {
478  return m_Poly->Iterate();
479  }
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:725
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 132 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(), MODULE::Visit(), and BOARD::Visit().

136 {
137  EDA_ITEM* p = listStart;
138 
139  for( ; p; p = p->Pnext )
140  {
141  if( SEARCH_QUIT == p->Visit( inspector, testData, scanTypes ) )
142  return SEARCH_QUIT;
143  }
144 
145  return SEARCH_CONTINUE;
146 }
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 486 of file class_zone.h.

References SHAPE_POLY_SET::IterateWithHoles(), and m_Poly.

Referenced by DSN::SPECCTRA_DB::FromBOARD().

487  {
488  return m_Poly->IterateWithHoles();
489  }
ITERATOR IterateWithHoles(int aOutline)
Function IterateWithHoles.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:725
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_SHEET, SCH_COMPONENT, SCH_SHEET_PIN, SCH_FIELD, SCH_TEXT, LIB_PIN, and SCH_MARKER.

Definition at line 400 of file base_struct.h.

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

401  {
402  return false;
403  }
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 184 of file base_struct.cpp.

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

185 {
186  wxString text = aText;
187  wxString searchText = aSearchData.GetFindString();
188 
189  // Don't match if searching for replaceable item and the item doesn't support text replace.
190  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
191  return false;
192 
193  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
194  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
195 
196  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
197  {
198  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
199  return text.Matches( searchText );
200 
201  return text.MakeUpper().Matches( searchText.MakeUpper() );
202  }
203 
204  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
205  return aText.Find( searchText ) != wxNOT_FOUND;
206 
207  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
208 }
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:444
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 790 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().

791 {
792  for( auto iterator = m_Poly->IterateWithHoles(); iterator; iterator++ )
793  {
794  int py = mirror_ref.y - iterator->y;
795  iterator->y = py + mirror_ref.y;
796  }
797 
798  Hatch();
799 
800  for( auto ic = m_FilledPolysList.Iterate(); ic; ++ic )
801  {
802  int py = mirror_ref.y - ic->y;
803  ic->y = py + mirror_ref.y;
804  }
805 
806  for( unsigned ic = 0; ic < m_FillSegmList.size(); ic++ )
807  {
808  MIRROR( m_FillSegmList[ic].m_Start.y, mirror_ref.y );
809  MIRROR( m_FillSegmList[ic].m_End.y, mirror_ref.y );
810  }
811 }
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:725
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:788
void Hatch()
Function Hatch computes the hatch lines depending on the hatch parameters and stores it in the zone's...
Definition: class_zone.cpp:932
std::vector< SEGMENT > m_FillSegmList
Segments used to fill the zone (m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:778
void ZONE_CONTAINER::Move ( const wxPoint offset)
overridevirtual

Function Move Move the outlines.

Parameters
offset= moving vector

Reimplemented from BOARD_ITEM.

Definition at line 726 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(), and Show_Zone_Corner_Or_Outline_While_Move_Mouse().

727 {
728  /* move outlines */
729  m_Poly->Move( VECTOR2I( offset ) );
730 
731  Hatch();
732 
733  m_FilledPolysList.Move( VECTOR2I( offset.x, offset.y ) );
734 
735  for( unsigned ic = 0; ic < m_FillSegmList.size(); ic++ )
736  {
737  m_FillSegmList[ic].m_Start += offset;
738  m_FillSegmList[ic].m_End += offset;
739  }
740 }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:590
void Move(const VECTOR2I &aVector) override
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:725
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:788
void Hatch()
Function Hatch computes the hatch lines depending on the hatch parameters and stores it in the zone's...
Definition: class_zone.cpp:932
std::vector< SEGMENT > m_FillSegmList
Segments used to fill the zone (m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:778
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 743 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(), and Show_Zone_Corner_Or_Outline_While_Move_Mouse().

744 {
745  int next_corner;
746 
747  if( m_Poly->GetNeighbourIndexes( aEdge, nullptr, &next_corner ) )
748  {
749  m_Poly->Vertex( aEdge ) += VECTOR2I( offset );
750  m_Poly->Vertex( next_corner ) += VECTOR2I( offset );
751  Hatch();
752  }
753 }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:590
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:725
void Hatch()
Function Hatch computes the hatch lines depending on the hatch parameters and stores it in the zone's...
Definition: class_zone.cpp:932
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 535 of file class_zone.h.

References m_Poly, and SHAPE_POLY_SET::NewHole().

536  {
537  m_Poly->NewHole();
538  }
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:725
BOARD_ITEM* BOARD_ITEM::Next ( ) const
inlineinherited

Definition at line 124 of file class_board_item.h.

References EDA_ITEM::Pnext.

Referenced by DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), CINFO3D_VISU::AddGraphicsShapesWithClearanceToContainer(), PCBNEW_CONTROL::AppendBoard(), PCB_EDIT_FRAME::AppendBoardFile(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Block_SelectItems(), buildFeatureHoleList(), MODULE::BuildPolyCourtyard(), BOARD::ComputeBoundingBox(), BOARD::ConvertBrdLayerToPolygonalContours(), CopyMarkedItems(), CreateBoardSection(), CINFO3D_VISU::createLayers(), PCB_EDIT_FRAME::Delete_Drawings_All_Layer(), DeleteMarkedItems(), PCB_DRAW_PANEL_GAL::DisplayBoard(), PCB_EDIT_FRAME::DoGenFootprintsReport(), MODULE::Draw(), BOARD::Draw(), MODULE::DrawEdgesOnly(), DrawMovingBlockOutlines(), FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer(), FOOTPRINT_EDIT_FRAME::Edit_Edge_Width(), export_vrml_drawings(), export_vrml_module(), MODULE::Flip(), PCB_IO::format(), GENDRILL_WRITER_BASE::genDrillMapFile(), PCB_BASE_FRAME::GetFootprintFromBoardByReference(), MODULE::GetFootprintRect(), MODULE::HitTest(), idf_export_outline(), PCB_EDIT_FRAME::ImportSpecctraSession(), MirrorMarkedItems(), MODULE::MODULE(), MODULE_EDITOR_TOOLS::ModuleEdgeOutlines(), MODULE_EDITOR_TOOLS::ModuleTextOutlines(), MODULE::MoveAnchorPosition(), MODULE::operator=(), MODULE_EDITOR_TOOLS::PasteItems(), PlaceCells(), BRDITEMS_PLOTTER::Plot_Edges_Modules(), BRDITEMS_PLOTTER::PlotAllTextsModule(), BRDITEMS_PLOTTER::PlotBoardGraphicItems(), PlotSolderMaskLayer(), PlotStandardLayer(), Print_Module(), FOOTPRINT_EDIT_FRAME::PrintPage(), PCB_EDIT_FRAME::PrintPage(), FOOTPRINT_EDIT_FRAME::RedrawActiveWindow(), PCB_BASE_FRAME::ResetModuleTextSizes(), RotateMarkedItems(), MODULE::RunOnChildren(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), MODULE::SetOrientation(), MODULE::SetPosition(), PCB_EDIT_FRAME::Swap_Layers(), TestForExistingItem(), DRC::testTexts(), CINFO3D_VISU::transformGraphicModuleEdgeToPolygonSet(), MODULE::TransformGraphicShapesWithClearanceToPolygonSet(), and MODULE::TransformGraphicTextWithClearanceToPolygonSet().

124 { 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 241 of file base_struct.cpp.

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

242 {
243  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
244  GetChars( GetClass() ) ) );
245 
246  return false;
247 }
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 112 of file class_zone.cpp.

References SHAPE_POLY_SET::Append(), GetHatchPitch(), GetHatchStyle(), 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(), and SetHatchStyle().

113 {
115 
116  // Replace the outlines for aOther outlines.
117  delete m_Poly;
118  m_Poly = new SHAPE_POLY_SET( *aOther.m_Poly );
119 
120  m_CornerSelection = nullptr; // for corner moving, corner index to (null if no selection)
121  m_ZoneClearance = aOther.m_ZoneClearance; // clearance value
123  m_FillMode = aOther.m_FillMode; // filling mode (segments/polygons)
128  SetHatchStyle( aOther.GetHatchStyle() );
129  SetHatchPitch( aOther.GetHatchPitch() );
130  m_HatchLines = aOther.m_HatchLines; // copy vector <SEG>
133  m_FillSegmList.clear();
135 
136  return *this;
137 }
void SetHatchPitch(int aPitch)
Function SetHatchPitch sets the hatch pitch parameter for the zone.
Definition: class_zone.cpp:912
int m_ZoneClearance
Clearance value in internal units.
Definition: class_zone.h:749
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:770
int m_ArcToSegmentsCount
The number of segments to convert a circle to a polygon.
Definition: class_zone.h:754
int m_ThermalReliefCopperBridge
Definition: class_zone.h:763
std::vector< SEG > m_HatchLines
Definition: class_zone.h:792
ZoneConnection m_PadConnection
Definition: class_zone.h:748
Class SHAPE_POLY_SET.
int m_FillMode
How to fill areas: 0 => use filled polygons, 1 => fill with segments.
Definition: class_zone.h:767
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:725
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:788
int m_ThermalReliefGap
Width of the copper bridge in thermal reliefs.
Definition: class_zone.h:760
int m_ZoneMinThickness
Minimum thickness value in filled areas.
Definition: class_zone.h:750
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.
HATCH_STYLE GetHatchStyle() const
Definition: class_zone.h:554
void SetHatchStyle(HATCH_STYLE aStyle)
Definition: class_zone.h:559
int GetHatchPitch() const
Hatch related methods.
Definition: class_zone.cpp:896
std::vector< SEGMENT > m_FillSegmList
Segments used to fill the zone (m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:778
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 248 of file class_zone.h.

References m_Poly.

248 { 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:725
void ZONE_CONTAINER::RemoveAllContours ( void  )
inline

Definition at line 501 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().

502  {
504  }
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:725
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 211 of file base_struct.cpp.

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

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

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

432 { return false; }
void ZONE_CONTAINER::Rotate ( const wxPoint