KiCad PCB EDA Suite
class_zone.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
29 #ifndef CLASS_ZONE_H_
30 #define CLASS_ZONE_H_
31 
32 
33 #include <vector>
34 #include <gr_basic.h>
35 #include <class_board_item.h>
36 #include <board_connected_item.h>
39 #include <zone_settings.h>
40 
41 
42 class EDA_RECT;
43 class LINE_READER;
44 class PCB_EDIT_FRAME;
45 class BOARD;
46 class ZONE_CONTAINER;
48 
49 typedef std::vector<SEG> ZONE_SEGMENT_FILL;
50 
61 {
62 public:
63 
66 
75  ZONE_CONTAINER( BOARD_ITEM_CONTAINER* parent, bool aInModule = false );
76 
77  ZONE_CONTAINER( const ZONE_CONTAINER& aZone );
78  ZONE_CONTAINER& operator=( const ZONE_CONTAINER &aOther );
79 
81 
82  static inline bool ClassOf( const EDA_ITEM* aItem )
83  {
84  return aItem && aItem->Type() == PCB_ZONE_AREA_T;
85  }
86 
90  const wxPoint GetPosition() const override;
91  void SetPosition( const wxPoint& aPos ) override {}
92 
97  void SetPriority( unsigned aPriority ) { m_priority = aPriority; }
98 
103  unsigned GetPriority() const { return m_priority; }
104 
105  void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
106 
107  void SetLayerSet( LSET aLayerSet );
108 
109  virtual LSET GetLayerSet() const override;
110 
119  void Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset = ZeroOffset ) override;
120 
129  void PrintFilledArea( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset = ZeroOffset );
130 
134  const EDA_RECT GetBoundingBox() const override;
135 
136  int GetClearance( BOARD_CONNECTED_ITEM* aItem = NULL ) const override;
137 
142  bool IsOnCopperLayer() const override;
143 
148  bool CommonLayerExists( const LSET aLayerSet ) const;
149 
150  virtual void SetLayer( PCB_LAYER_ID aLayer ) override;
151 
152  virtual PCB_LAYER_ID GetLayer() const override;
153 
154  virtual bool IsOnLayer( PCB_LAYER_ID ) const override;
155 
156  virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
157 
158  void SetFillMode( ZONE_FILL_MODE aFillMode ) { m_FillMode = aFillMode; }
160 
161  void SetThermalReliefGap( int aThermalReliefGap ) { m_ThermalReliefGap = aThermalReliefGap; }
162  int GetThermalReliefGap( D_PAD* aPad = NULL ) const;
163 
164  void SetThermalReliefCopperBridge( int aThermalReliefCopperBridge )
165  {
166  if( m_ThermalReliefCopperBridge != aThermalReliefCopperBridge )
167  SetNeedRefill( true );
168 
169  m_ThermalReliefCopperBridge = aThermalReliefCopperBridge;
170  }
171  int GetThermalReliefCopperBridge( D_PAD* aPad = NULL ) const;
172 
173  bool IsFilled() const { return m_IsFilled; }
174  void SetIsFilled( bool isFilled ) { m_IsFilled = isFilled; }
175 
176  bool NeedRefill() const { return m_needRefill; }
177  void SetNeedRefill( bool aNeedRefill ) { m_needRefill = aNeedRefill; }
178 
179  int GetZoneClearance() const { return m_ZoneClearance; }
180  void SetZoneClearance( int aZoneClearance ) { m_ZoneClearance = aZoneClearance; }
181 
182  ZoneConnection GetPadConnection( D_PAD* aPad = NULL ) const;
183  void SetPadConnection( ZoneConnection aPadConnection ) { m_PadConnection = aPadConnection; }
184 
185  int GetMinThickness() const { return m_ZoneMinThickness; }
186  void SetMinThickness( int aMinThickness )
187  {
188  if( m_ZoneMinThickness != aMinThickness )
189  SetNeedRefill( true );
190 
191  m_ZoneMinThickness = aMinThickness;
192  }
193 
195  void SetHatchFillTypeThickness( int aThickness ) { m_HatchFillTypeThickness = aThickness; }
196 
197  int GetHatchFillTypeGap() const { return m_HatchFillTypeGap; }
198  void SetHatchFillTypeGap( int aStep ) { m_HatchFillTypeGap = aStep; }
199 
201  void SetHatchFillTypeOrientation( double aStep ) { m_HatchFillTypeOrientation = aStep; }
202 
205 
208 
209  int GetSelectedCorner() const
210  {
211  // Transform relative indices to global index
212  int globalIndex = -1;
213 
214  if( m_CornerSelection )
215  m_Poly->GetGlobalIndex( *m_CornerSelection, globalIndex );
216 
217  return globalIndex;
218  }
219 
220  void SetSelectedCorner( int aCorner )
221  {
222  SHAPE_POLY_SET::VERTEX_INDEX selectedCorner;
223 
224  // If the global index of the corner is correct, assign it to m_CornerSelection
225  if( m_Poly->GetRelativeIndices( aCorner, &selectedCorner ) )
226  {
227  if( m_CornerSelection == nullptr )
229 
230  *m_CornerSelection = selectedCorner;
231  }
232  else
233  throw( std::out_of_range( "aCorner-th vertex does not exist" ) );
234  }
235 
237  // Like HitTest but selects the current corner to be operated on
238  void SetSelectedCorner( const wxPoint& aPosition, int aAccuracy );
239 
240  int GetLocalFlags() const { return m_localFlgs; }
241  void SetLocalFlags( int aFlags ) { m_localFlgs = aFlags; }
242 
244  const ZONE_SEGMENT_FILL& FillSegments() const { return m_FillSegmList; }
245 
247  const SHAPE_POLY_SET* Outline() const { return const_cast< SHAPE_POLY_SET* >( m_Poly ); }
248 
249  void SetOutline( SHAPE_POLY_SET* aOutline ) { m_Poly = aOutline; }
250 
257  bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
258 
265  bool HitTestFilledArea( const wxPoint& aRefPos ) const;
266 
272  void GetColinearCorners( BOARD* aBoard, std::set<VECTOR2I>& colinearCorners );
273 
284  SHAPE_POLY_SET& aCornerBuffer, int aError = ARC_HIGH_DEF ) const;
285 
302  int aMinClearanceValue, bool aUseNetClearance,
303  std::set<VECTOR2I>* aPreserveCorners = nullptr ) const;
304 
316  void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, int aClearanceValue,
317  int aError = ARC_HIGH_DEF, bool ignoreLineWidth = false ) const override;
318 
329  bool HitTestForCorner( const wxPoint& refPos, int aAccuracy,
330  SHAPE_POLY_SET::VERTEX_INDEX& aCornerHit ) const;
331 
340  bool HitTestForCorner( const wxPoint& refPos, int aAccuracy ) const;
341 
351  bool HitTestForEdge( const wxPoint& refPos, int aAccuracy,
352  SHAPE_POLY_SET::VERTEX_INDEX& aCornerHit ) const;
353 
361  bool HitTestForEdge( const wxPoint& refPos, int aAccuracy ) const;
362 
366  bool HitTest( const EDA_RECT& aRect, bool aContained = true, int aAccuracy = 0 ) const override;
367 
368 
375  bool UnFill();
376 
377  /* Geometric transformations: */
378 
384  void Move( const wxPoint& offset ) override;
385 
392  void MoveEdge( const wxPoint& offset, int aEdge );
393 
400  void Rotate( const wxPoint& centre, double angle ) override;
401 
408  virtual void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override;
409 
417  void Mirror( const wxPoint& aMirrorRef, bool aMirrorLeftRight );
418 
424  wxString GetClass() const override
425  {
426  return wxT( "ZONE_CONTAINER" );
427  }
428 
431  int GetNumCorners( void ) const
432  {
433  return m_Poly->TotalVertices();
434  }
435 
442  {
443  return m_Poly->Iterate();
444  }
445 
452  {
453  return m_Poly->IterateWithHoles();
454  }
455 
462  {
463  return m_Poly->CIterateWithHoles();
464  }
465 
466  void RemoveAllContours( void )
467  {
469  }
470 
471  const VECTOR2I& GetCornerPosition( int aCornerIndex ) const
472  {
474 
475  // Convert global to relative indices
476  if( !m_Poly->GetRelativeIndices( aCornerIndex, &index ) )
477  throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
478 
479  return m_Poly->CVertex( index );
480  }
481 
482  void SetCornerPosition( int aCornerIndex, wxPoint new_pos )
483  {
484  SHAPE_POLY_SET::VERTEX_INDEX relativeIndices;
485 
486  // Convert global to relative indices
487  if( m_Poly->GetRelativeIndices( aCornerIndex, &relativeIndices ) )
488  {
489  if( m_Poly->CVertex( relativeIndices ).x != new_pos.x
490  || m_Poly->CVertex( relativeIndices ).y != new_pos.y )
491  {
492  SetNeedRefill( true );
493  m_Poly->SetVertex( relativeIndices, new_pos );
494  }
495  }
496  else
497  throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
498  }
499 
504  void NewHole()
505  {
506  m_Poly->NewHole();
507  }
508 
517  bool AppendCorner( wxPoint aPosition, int aHoleIdx, bool aAllowDuplication = false );
518 
520  {
521  return m_hatchStyle;
522  }
523 
524  void SetHatchStyle( HATCH_STYLE aStyle )
525  {
526  m_hatchStyle = aStyle;
527  }
528 
536  bool IsSame( const ZONE_CONTAINER &aZoneToCompare );
537 
543  {
545  }
546 
553  {
554  return m_FilledPolysList;
555  }
556 
560  void CacheTriangulation();
561 
566  void SetFilledPolysList( SHAPE_POLY_SET& aPolysList )
567  {
568  m_FilledPolysList = aPolysList;
569  }
570 
575  void SetRawPolysList( SHAPE_POLY_SET& aPolysList )
576  {
577  m_RawPolysList = aPolysList;
578  }
579 
580 
587  bool BuildSmoothedPoly( SHAPE_POLY_SET& aSmoothedPoly,
588  std::set<VECTOR2I>* aPreserveCorners ) const;
589 
590  void SetCornerSmoothingType( int aType ) { m_cornerSmoothingType = aType; };
591 
593 
594  void SetCornerRadius( unsigned int aRadius );
595 
596  unsigned int GetCornerRadius() const { return m_cornerRadius; }
597 
599  void SetFilledPolysUseThickness( bool aOption ) { m_FilledPolysUseThickness = aOption; }
600 
601 
607  void AddPolygon( std::vector< wxPoint >& aPolygon );
608 
609  void AddPolygon( const SHAPE_LINE_CHAIN& aPolygon );
610 
611  void SetFillSegments( const ZONE_SEGMENT_FILL& aSegments )
612  {
613  m_FillSegmList = aSegments;
614  }
615 
617  {
618  return m_RawPolysList;
619  }
620 
621  wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
622 
623  BITMAP_DEF GetMenuImage() const override;
624 
625  EDA_ITEM* Clone() const override;
626 
630  bool GetIsKeepout() const { return m_isKeepout; }
632  bool GetDoNotAllowVias() const { return m_doNotAllowVias; }
633  bool GetDoNotAllowTracks() const { return m_doNotAllowTracks; }
634 
635  void SetIsKeepout( bool aEnable ) { m_isKeepout = aEnable; }
636  void SetDoNotAllowCopperPour( bool aEnable ) { m_doNotAllowCopperPour = aEnable; }
637  void SetDoNotAllowVias( bool aEnable ) { m_doNotAllowVias = aEnable; }
638  void SetDoNotAllowTracks( bool aEnable ) { m_doNotAllowTracks = aEnable; }
639 
648  int GetHatchPitch() const;
649 
654  static int GetDefaultHatchPitch();
655 
665  void SetHatch( int aHatchStyle, int aHatchPitch, bool aRebuildHatch );
666 
672  void SetHatchPitch( int aPitch );
673 
678  void UnHatch();
679 
685  void Hatch();
686 
687  const std::vector<SEG>& GetHatchLines() const { return m_HatchLines; }
688 
689  bool GetHV45() const { return m_hv45; }
690  void SetHV45( bool aConstrain ) { m_hv45 = aConstrain; }
691 
696 
702 
703 
704 
705 #if defined(DEBUG)
706  virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
707 #endif
708 
709  virtual void SwapData( BOARD_ITEM* aImage ) override;
710 
711 protected:
716  void initDataFromSrcInCopyCtor( const ZONE_CONTAINER& aZone );
717 
720  unsigned int m_cornerRadius;
721 
723 
724  /* Priority: when a zone outline is inside and other zone, if its priority is higher
725  * the other zone priority, it will be created inside.
726  * if priorities are equal, a DRC error is set
727  */
728  unsigned m_priority;
729 
730  /* A zone outline can be a keepout zone.
731  * It will be never filled, and DRC should test for pads, tracks and vias
732  */
734 
735  /* For keepout zones only:
736  * what is not allowed inside the keepout ( pads, tracks and vias )
737  */
741 
746 
749 
755 
758 
761 
762 
768 
771 
774 
777 
781 
785 
788 
791 
796 
797  /* set of filled polygons used to draw a zone as a filled area.
798  * from outlines (m_Poly) but unlike m_Poly these filled polygons have no hole
799  * (they are all in one piece) In very simple cases m_FilledPolysList is same
800  * as m_Poly. In less simple cases (when m_Poly has holes) m_FilledPolysList is
801  * a polygon equivalent to m_Poly, without holes but with extra outline segment
802  * connecting "holes" with external main outline. In complex cases an outline
803  * described by m_Poly can have many filled areas
804  */
807  MD5_HASH m_filledPolysHash; // A hash value used in zone filling calculations
808  // to see if the filled areas are up to date
809 
810  HATCH_STYLE m_hatchStyle; // hatch style, see enum above
811  int m_hatchPitch; // for DIAGONAL_EDGE, distance between 2 hatch lines
812  std::vector<SEG> m_HatchLines; // hatch lines
813  std::vector<int> m_insulatedIslands;
814 
815  bool m_hv45; // constrain edges to horizontal, vertical or 45ยบ
816 };
817 
818 
828 {
829 public:
833 
834  EDA_ITEM* Clone() const override;
835 
836  unsigned int ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
837 };
838 
839 #endif // CLASS_ZONE_H_
void SetFilledPolysList(SHAPE_POLY_SET &aPolysList)
Function SetFilledPolysList sets the list of filled polygons.
Definition: class_zone.h:566
void SetDoNotAllowTracks(bool aEnable)
Definition: class_zone.h:638
int TotalVertices() const
Returns total number of vertices stored in the set.
void MoveEdge(const wxPoint &offset, int aEdge)
Function MoveEdge Move the outline Edge.
Definition: class_zone.cpp:786
int NewHole(int aOutline=-1)
Creates a new hole in a given outline
void SetCornerSmoothingType(int aType)
Definition: class_zone.h:590
void SetHatchPitch(int aPitch)
Function SetHatchPitch sets the hatch pitch parameter for the zone.
Definition: class_zone.cpp:967
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
bool IsFilled() const
Definition: class_zone.h:173
virtual void SwapData(BOARD_ITEM *aImage) override
Swap data between aItem and aImage.
std::vector< SEG > ZONE_SEGMENT_FILL
Definition: class_zone.h:47
Class LINE_READER is an abstract class from which implementation specific LINE_READERs may be derived...
Definition: richio.h:81
int m_ZoneClearance
Clearance value in internal units.
Definition: class_zone.h:743
void Mirror(const wxPoint &aMirrorRef, bool aMirrorLeftRight)
Function Mirror Mirror the outlines , relative to a given horizontal axis the layer is not changed.
Definition: class_zone.cpp:841
void SetHatchFillTypeSmoothingLevel(int aLevel)
Definition: class_zone.h:204
void SetHatchFillTypeSmoothingValue(double aValue)
Definition: class_zone.h:207
bool CommonLayerExists(const LSET aLayerSet) const
Function CommonLayerExist Test if this zone shares a common layer with the given layer set.
Definition: class_zone.cpp:222
int GetThermalReliefCopperBridge(D_PAD *aPad=NULL) const
Definition: class_zone.cpp:532
void SetFilledPolysUseThickness(bool aOption)
Definition: class_zone.h:599
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: class_zone.cpp:179
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
bool m_doNotAllowTracks
Definition: class_zone.h:740
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox (virtual)
Definition: class_zone.cpp:496
const ZONE_SEGMENT_FILL & FillSegments() const
Definition: class_zone.h:244
void SetCornerRadius(unsigned int aRadius)
Definition: class_zone.cpp:541
Classes BOARD_ITEM and BOARD_CONNECTED_ITEM.
int GetHatchFillTypeThickness() const
Definition: class_zone.h:194
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:787
int GetSelectedCorner() const
Definition: class_zone.h:209
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Returns the index-th vertex in a given hole outline within a given outline
wxString GetSelectMenuText(EDA_UNITS_T aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
Definition: class_zone.cpp:934
virtual bool IsOnLayer(PCB_LAYER_ID) const override
Function IsOnLayer tests to see if this object is on the given layer.
Definition: class_zone.cpp:300
std::vector< int > m_insulatedIslands
Definition: class_zone.h:813
bool HitTestForCorner(const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
Function HitTestForCorner tests if the given wxPoint is near a corner.
Definition: class_zone.cpp:575
ZoneConnection
How pads are covered by copper in zone.
Definition: zones.h:50
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:101
ZONE_CONTAINER(BOARD_ITEM_CONTAINER *parent, bool aInModule=false)
The ctor to build ZONE_CONTAINER, but comaptible with MODULE_ZONE_CONTAINER requirement.
Definition: class_zone.cpp:45
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:203
ZONE_SEGMENT_FILL & FillSegments()
Definition: class_zone.h:243
MD5_HASH GetHashValue()
Definition: class_zone.h:695
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:246
CONST_ITERATOR CIterateWithHoles(int aOutline) const
bool GetFilledPolysUseThickness() const
Definition: class_zone.h:598
double GetHatchFillTypeOrientation() const
Definition: class_zone.h:200
Struct VERTEX_INDEX.
bool HitTestFilledArea(const wxPoint &aRefPos) const
Function HitTestFilledArea tests if the given wxPoint is within the bounds of a filled area of this z...
Definition: class_zone.cpp:674
double GetHatchFillTypeSmoothingValue() const
Definition: class_zone.h:206
MODULE_ZONE_CONTAINER(BOARD_ITEM_CONTAINER *aParent)
void SetHatch(int aHatchStyle, int aHatchPitch, bool aRebuildHatch)
Function SetHatch sets all hatch parameters for the zone.
Definition: class_zone.cpp:957
void SetFillSegments(const ZONE_SEGMENT_FILL &aSegments)
Definition: class_zone.h:611
ZONE_SEGMENT_FILL m_FillSegmList
Segments used to fill the zone (m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:795
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...
int GetThermalReliefGap(D_PAD *aPad=NULL) const
Definition: class_zone.cpp:523
int m_localFlgs
Variable used in polygon calculations.
Definition: class_zone.h:790
static bool ClassOf(const EDA_ITEM *aItem)
Definition: class_zone.h:82
void SetIsFilled(bool isFilled)
Definition: class_zone.h:174
const wxPoint GetPosition() const override
Definition: class_zone.cpp:197
Class BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected an...
void SetOutline(SHAPE_POLY_SET *aOutline)
Definition: class_zone.h:249
static int GetDefaultHatchPitch()
Function GetDefaultHatchPitchMils.
int GetClearance(BOARD_CONNECTED_ITEM *aItem=NULL) const override
Function GetClearance returns the clearance in internal units.
Definition: class_zone.cpp:649
static wxPoint ZeroOffset
A value of wxPoint(0,0) which can be passed to the Draw() functions.
struct SHAPE_POLY_SET::VERTEX_INDEX VERTEX_INDEX
Struct VERTEX_INDEX.
void SetDoNotAllowVias(bool aEnable)
Definition: class_zone.h:637
SHAPE_POLY_SET m_RawPolysList
Definition: class_zone.h:806
bool GetDoNotAllowVias() const
Definition: class_zone.h:632
void SetPriority(unsigned aPriority)
Function SetPriority.
Definition: class_zone.h:97
virtual LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_zone.cpp:267
void SetVertex(const VERTEX_INDEX &aIndex, const VECTOR2I &aPos)
Function SetVertex Accessor function to set the position of a specific point.
void SetLayerSet(LSET aLayerSet)
Definition: class_zone.cpp:238
void GetColinearCorners(BOARD *aBoard, std::set< VECTOR2I > &colinearCorners)
Some intersecting zones, despite being on the same layer with the same net, cannot be merged due to o...
SHAPE_POLY_SET::ITERATOR Iterate()
Function Iterate returns an iterator to visit all points of the zone's main outline without holes.
Definition: class_zone.h:441
SHAPE_POLY_SET::CONST_ITERATOR CIterateWithHoles() const
Function CIterateWithHoles returns an iterator to visit all points of the zone's main outline with ho...
Definition: class_zone.h:461
int m_HatchFillTypeSmoothingLevel
Grid pattern smoothing type, similar to corner smoothing type 0 = no smoothing, 1 = fillet,...
Definition: class_zone.h:780
PCB_LAYER_ID
A quick note on layer IDs:
void SetHatchFillTypeGap(int aStep)
Definition: class_zone.h:198
Class LSET is a set of PCB_LAYER_IDs.
int m_ThermalReliefCopperBridge
Definition: class_zone.h:760
HATCH_STYLE GetHatchStyle() const
Definition: class_zone.h:519
unsigned int GetCornerRadius() const
Definition: class_zone.h:596
std::vector< SEG > m_HatchLines
Definition: class_zone.h:812
ZoneConnection m_PadConnection
Definition: class_zone.h:742
MD5_HASH GetHash() const
void Print(PCB_BASE_FRAME *aFrame, wxDC *DC, const wxPoint &offset=ZeroOffset) override
Function Print Prints the zone outline.
Definition: class_zone.cpp:309
ZONE_CONTAINER & operator=(const ZONE_CONTAINER &aOther)
Definition: class_zone.cpp:83
unsigned int ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Function ViewGetLOD() Returns the level of detail (LOD) of the item.
bool IsSame(const ZONE_CONTAINER &aZoneToCompare)
Function IsSame tests if 2 zones are equivalent: 2 zones are equivalent if they have same parameters ...
ITERATOR IterateWithHoles(int aOutline)
Function IterateWithHoles.
Class SHAPE_POLY_SET.
void NewHole()
Function NewHole creates a new hole on the zone; i.e., a new contour on the zone's outline.
Definition: class_zone.h:504
double m_HatchFillTypeOrientation
Grid style shape: orientation in degrees of the grid lines.
Definition: class_zone.h:776
bool BuildSmoothedPoly(SHAPE_POLY_SET &aSmoothedPoly, std::set< VECTOR2I > *aPreserveCorners) const
Function GetSmoothedPoly returns a pointer to the corner-smoothed version of m_Poly.
ZONE_FILL_MODE GetFillMode() const
Definition: class_zone.h:159
bool m_IsFilled
True when a zone was filled, false after deleting the filled areas.
Definition: class_zone.h:748
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:718
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Function HitTest tests if a point is near an outline edge or a corner of this zone.
Definition: class_zone.cpp:550
bool GetDoNotAllowCopperPour() const
Definition: class_zone.h:631
unsigned m_priority
Definition: class_zone.h:728
void TransformSolidAreasShapesToPolygonSet(SHAPE_POLY_SET &aCornerBuffer, int aError=ARC_HIGH_DEF) const
Function TransformSolidAreasShapesToPolygonSet Convert solid areas full shapes to polygon set (the fu...
void TransformOutlinesShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, int aMinClearanceValue, bool aUseNetClearance, std::set< VECTOR2I > *aPreserveCorners=nullptr) const
Function TransformOutlinesShapeWithClearanceToPolygon Convert the outlines shape to a polygon with no...
void Rotate(const wxPoint &centre, double angle) override
Function Rotate Move the outlines.
Definition: class_zone.cpp:801
bool m_doNotAllowVias
Definition: class_zone.h:739
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Function SetLayer sets the layer this item is on.
Definition: class_zone.cpp:230
bool UnFill()
Function UnFill Removes the zone filling.
Definition: class_zone.cpp:185
int m_cornerSmoothingType
Definition: class_zone.h:719
int GetNumCorners(void) const
Access to m_Poly parameters.
Definition: class_zone.h:431
void CacheTriangulation()
(re)create a list of triangles that "fill" the solid areas.
double m_HatchFillTypeSmoothingValue
Grid pattern smoothing value for smoothing shape size calculations this is the ratio between the gap ...
Definition: class_zone.h:784
HATCH_STYLE
Zone hatch styles.
Definition: class_zone.h:65
void SetZoneClearance(int aZoneClearance)
Definition: class_zone.h:180
virtual void ViewGetLayers(int aLayers[], int &aCount) const override
Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on.
Definition: class_zone.cpp:281
void BuildHashValue()
Build the hash value of m_FilledPolysList, and store it internally in m_filledPolysHash.
Definition: class_zone.h:701
bool GetRelativeIndices(int aGlobalIdx, VERTEX_INDEX *aRelativeIndices) const
Function GetRelativeIndices.
const std::vector< SEG > & GetHatchLines() const
Definition: class_zone.h:687
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
void AddPolygon(std::vector< wxPoint > &aPolygon)
add a polygon to the zone outline if the zone outline is empty, this is the main outline else it is a...
Definition: class_zone.cpp:889
int GetCornerSmoothingType() const
Definition: class_zone.h:592
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:805
void SetSelectedCorner(int aCorner)
Definition: class_zone.h:220
void SetRawPolysList(SHAPE_POLY_SET &aPolysList)
Function SetFilledPolysList sets the list of filled polygons.
Definition: class_zone.h:575
MD5_HASH m_filledPolysHash
Definition: class_zone.h:807
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:630
unsigned int m_cornerRadius
Definition: class_zone.h:720
bool GetHV45() const
Definition: class_zone.h:689
void SetThermalReliefCopperBridge(int aThermalReliefCopperBridge)
Definition: class_zone.h:164
bool NeedRefill() const
Definition: class_zone.h:176
void Move(const wxPoint &offset) override
Function Move Move the outlines.
Definition: class_zone.cpp:769
bool GetGlobalIndex(VERTEX_INDEX aRelativeIndices, int &aGlobalIdx)
Function GetGlobalIndex computes the global index of a vertex from the relative indices of polygon,...
HATCH_STYLE m_hatchStyle
Definition: class_zone.h:810
void SetDoNotAllowCopperPour(bool aEnable)
Definition: class_zone.h:636
bool m_doNotAllowCopperPour
Definition: class_zone.h:738
wxString GetClass() const override
Function GetClass returns the class name.
Definition: class_zone.h:424
int m_ThermalReliefGap
Width of the copper bridge in thermal reliefs.
Definition: class_zone.h:757
int m_ZoneMinThickness
Minimum thickness value in filled areas.
Definition: class_zone.h:744
void SetFillMode(ZONE_FILL_MODE aFillMode)
Definition: class_zone.h:158
ZONE_FILL_MODE m_FillMode
How to fill areas: ZFM_POLYGONS => use solid polygons ZFM_HATCH_PATTERN => use a grid pattern as shap...
Definition: class_zone.h:767
unsigned GetPriority() const
Function GetPriority.
Definition: class_zone.h:103
void SetCornerPosition(int aCornerIndex, wxPoint new_pos)
Definition: class_zone.h:482
Board layer functions and definitions.
MODULE_ZONE_CONTAINER & operator=(const MODULE_ZONE_CONTAINER &aOther)
void UnHatch()
Function UnHatch clears the zone's hatch.
Definition: class_zone.cpp:973
ZoneConnection GetPadConnection(D_PAD *aPad=NULL) const
Definition: class_zone.cpp:866
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:161
Class SHAPE_LINE_CHAIN.
int m_HatchFillTypeThickness
Grid style shape: thickness of lines (if 0 -> solid shape)
Definition: class_zone.h:770
SHAPE_POLY_SET::ITERATOR IterateWithHoles()
Function IterateWithHoles returns an iterator to visit all points of the zone's main outline with hol...
Definition: class_zone.h:451
void initDataFromSrcInCopyCtor(const ZONE_CONTAINER &aZone)
Copy aZone data to me members are expected non initialize in this.
Definition: class_zone.cpp:127
void SetHatchFillTypeOrientation(double aStep)
Definition: class_zone.h:201
void PrintFilledArea(PCB_BASE_FRAME *aFrame, wxDC *DC, const wxPoint &offset=ZeroOffset)
Function PrintFilledArea Draws the filled area for this zone (polygon list .m_FilledPolysList)
Definition: class_zone.cpp:421
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
Class ITERATOR_TEMPLATE.
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.
void SetHV45(bool aConstrain)
Definition: class_zone.h:690
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
Class PCB_EDIT_FRAME is the main frame for Pcbnew.
void Hatch()
Function Hatch computes the hatch lines depending on the hatch parameters and stores it in the zone's...
Definition: class_zone.cpp:987
int GetHatchPitch() const
Hatch related methods.
Definition: class_zone.cpp:951
void SetHatchStyle(HATCH_STYLE aStyle)
Definition: class_zone.h:524
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
void SetLocalFlags(int aFlags)
Definition: class_zone.h:241
MODULE_ZONE_CONTAINER is the same item as ZONE_CONTAINER, but with a specific type id ZONE_CONTAINER ...
Definition: class_zone.h:827
int GetMinThickness() const
Definition: class_zone.h:185
bool GetDoNotAllowTracks() const
Definition: class_zone.h:633
void SetHatchFillTypeThickness(int aThickness)
Definition: class_zone.h:195
void SetPosition(const wxPoint &aPos) override
Definition: class_zone.h:91
bool AppendCorner(wxPoint aPosition, int aHoleIdx, bool aAllowDuplication=false)
Add a new corner to the zone outline (to the main outline or a hole)
Definition: class_zone.cpp:914
int GetHatchFillTypeSmoothingLevel() const
Definition: class_zone.h:203
bool HitTestForEdge(const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
Function HitTestForEdge tests if the given wxPoint is near a segment defined by 2 corners.
Definition: class_zone.cpp:589
bool m_needRefill
False when a zone was refilled, true after changes in zone params.
Definition: class_zone.h:754
const SHAPE_POLY_SET * Outline() const
Definition: class_zone.h:247
Abstract interface for BOARD_ITEMs capable of storing other items inside.
int GetZoneClearance() const
Definition: class_zone.h:179
Class EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
int m_HatchFillTypeGap
Grid style shape: dist between center of lines (grid size) (0 -> solid shape)
Definition: class_zone.h:773
Class VIEW.
Definition: view.h:61
void SetIsKeepout(bool aEnable)
Definition: class_zone.h:635
void SetPadConnection(ZoneConnection aPadConnection)
Definition: class_zone.h:183
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
void SetMinThickness(int aMinThickness)
Definition: class_zone.h:186
int GetHatchFillTypeGap() const
Definition: class_zone.h:197
SHAPE_POLY_SET & RawPolysList()
Definition: class_zone.h:616
const VECTOR2I & GetCornerPosition(int aCornerIndex) const
Definition: class_zone.h:471
virtual void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Function Flip Flip this object, i.e.
Definition: class_zone.cpp:825
ZONE_FILL_MODE
Definition: zone_settings.h:37
void SetThermalReliefGap(int aThermalReliefGap)
Definition: class_zone.h:161
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
EDA_UNITS_T
Definition: common.h:133
bool IsOnCopperLayer() const override
Function IsOnCopperLayer.
Definition: class_zone.cpp:209
int GetLocalFlags() const
Definition: class_zone.h:240
void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, int aClearanceValue, int aError=ARC_HIGH_DEF, bool ignoreLineWidth=false) const override
Function TransformShapeWithClearanceToPolygon Convert the zone shape to a closed polygon Used in fill...
bool m_FilledPolysUseThickness
outline of filled polygons have thickness.
Definition: class_zone.h:745
void ClearFilledPolysList()
Function ClearFilledPolysList clears the list of filled polygons.
Definition: class_zone.h:542
KICAD_T Type() const
Function Type()
Definition: base_struct.h:210
const SHAPE_POLY_SET & GetFilledPolysList() const
Function GetFilledPolysList returns a reference to the list of filled polygons.
Definition: class_zone.h:552
void RemoveAllContours(void)
Definition: class_zone.h:466
void GetMsgPanelInfo(EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for displ...
Definition: class_zone.cpp:680
void SetNeedRefill(bool aNeedRefill)
Definition: class_zone.h:177