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) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 1992-2017 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 
30 #ifndef CLASS_ZONE_H_
31 #define CLASS_ZONE_H_
32 
33 
34 #include <vector>
35 #include <gr_basic.h>
36 #include <class_board_item.h>
37 #include <board_connected_item.h>
40 #include <zone_settings.h>
41 
42 
43 class EDA_RECT;
44 class LINE_READER;
45 class EDA_DRAW_PANEL;
46 class PCB_EDIT_FRAME;
47 class BOARD;
48 class ZONE_CONTAINER;
50 
51 typedef std::vector<SEG> ZONE_SEGMENT_FILL;
52 
60 {
61 public:
62 
67 
68  ZONE_CONTAINER( BOARD* parent );
69 
70  ZONE_CONTAINER( const ZONE_CONTAINER& aZone );
71  ZONE_CONTAINER& operator=( const ZONE_CONTAINER &aOther );
72 
74 
75  static inline bool ClassOf( const EDA_ITEM* aItem )
76  {
77  return aItem && ( ( PCB_ZONE_AREA_T == aItem->Type() ) ||
78  ( PCB_SEGZONE_T == aItem->Type() ) );
79  }
80 
84  const wxPoint GetPosition() const override;
85  void SetPosition( const wxPoint& aPos ) override {}
86 
91  void SetPriority( unsigned aPriority ) { m_priority = aPriority; }
92 
97  unsigned GetPriority() const { return m_priority; }
98 
99  void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
100 
101  void SetLayerSet( LSET aLayerSet );
102 
103  virtual LSET GetLayerSet() const override;
104 
113  void Draw( EDA_DRAW_PANEL* panel,
114  wxDC* DC,
115  GR_DRAWMODE aDrawMode,
116  const wxPoint& offset = ZeroOffset ) override;
117 
126  void DrawFilledArea( EDA_DRAW_PANEL* panel,
127  wxDC* DC,
128  GR_DRAWMODE aDrawMode,
129  const wxPoint& offset = ZeroOffset );
130 
140  void DrawWhileCreateOutline( EDA_DRAW_PANEL* panel, wxDC* DC,
141  GR_DRAWMODE draw_mode = GR_OR );
142 
146  const EDA_RECT GetBoundingBox() const override;
147 
148  int GetClearance( BOARD_CONNECTED_ITEM* aItem = NULL ) const override;
149 
154  bool IsOnCopperLayer() const;
155 
160  bool CommonLayerExists( const LSET aLayerSet ) const;
161 
162  virtual void SetLayer( PCB_LAYER_ID aLayer ) override;
163 
164  virtual PCB_LAYER_ID GetLayer() const override;
165 
166  virtual bool IsOnLayer( PCB_LAYER_ID ) const override;
167 
168  virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
169 
170  void SetFillMode( ZONE_FILL_MODE aFillMode ) { m_FillMode = aFillMode; }
172 
173  void SetThermalReliefGap( int aThermalReliefGap ) { m_ThermalReliefGap = aThermalReliefGap; }
174  int GetThermalReliefGap( D_PAD* aPad = NULL ) const;
175 
176  void SetThermalReliefCopperBridge( int aThermalReliefCopperBridge )
177  {
178  if( m_ThermalReliefCopperBridge != aThermalReliefCopperBridge )
179  SetNeedRefill( true );
180 
181  m_ThermalReliefCopperBridge = aThermalReliefCopperBridge;
182  }
183  int GetThermalReliefCopperBridge( D_PAD* aPad = NULL ) const;
184 
185  void SetArcSegmentCount( int aArcSegCount ) { m_ArcToSegmentsCount = aArcSegCount; }
186  int GetArcSegmentCount() const { return m_ArcToSegmentsCount; }
187 
188  bool IsFilled() const { return m_IsFilled; }
189  void SetIsFilled( bool isFilled ) { m_IsFilled = isFilled; }
190 
191  bool NeedRefill() const { return m_needRefill; }
192  void SetNeedRefill( bool aNeedRefill ) { m_needRefill = aNeedRefill; }
193 
194  int GetZoneClearance() const { return m_ZoneClearance; }
195  void SetZoneClearance( int aZoneClearance ) { m_ZoneClearance = aZoneClearance; }
196 
197  ZoneConnection GetPadConnection( D_PAD* aPad = NULL ) const;
198  void SetPadConnection( ZoneConnection aPadConnection ) { m_PadConnection = aPadConnection; }
199 
200  int GetMinThickness() const { return m_ZoneMinThickness; }
201  void SetMinThickness( int aMinThickness )
202  {
203  if( m_ZoneMinThickness != aMinThickness )
204  SetNeedRefill( true );
205 
206  m_ZoneMinThickness = aMinThickness;
207  }
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  virtual bool HitTest( const wxPoint& aPosition ) const override;
258 
266  bool HitTestInsideZone( const wxPoint& aPosition ) const
267  {
268  return m_Poly->Contains( VECTOR2I( aPosition ), 0 );
269  }
270 
277  bool HitTestFilledArea( const wxPoint& aRefPos ) const;
278 
291  int aCircleToSegmentsCount,
292  double aCorrectionFactor ) const;
293 
309  int aMinClearanceValue,
310  bool aUseNetClearance ) const;
311 
327  int aClearanceValue,
328  int aCircleToSegmentsCount,
329  double aCorrectionFactor,
330  bool ignoreLineWidth = false ) const override;
331 
342  bool HitTestForCorner( const wxPoint& refPos, int aAccuracy,
343  SHAPE_POLY_SET::VERTEX_INDEX& aCornerHit ) const;
344 
353  bool HitTestForCorner( const wxPoint& refPos, int aAccuracy ) const;
354 
364  bool HitTestForEdge( const wxPoint& refPos, int aAccuracy,
365  SHAPE_POLY_SET::VERTEX_INDEX& aCornerHit ) const;
366 
374  bool HitTestForEdge( const wxPoint& refPos, int aAccuracy ) const;
375 
379  bool HitTest( const EDA_RECT& aRect, bool aContained = true, int aAccuracy = 0 ) const override;
380 
381 
388  bool UnFill();
389 
390  /* Geometric transformations: */
391 
397  void Move( const wxPoint& offset ) override;
398 
405  void MoveEdge( const wxPoint& offset, int aEdge );
406 
413  void Rotate( const wxPoint& centre, double angle ) override;
414 
421  virtual void Flip( const wxPoint& aCentre ) override;
422 
429  void Mirror( const wxPoint& mirror_ref );
430 
436  wxString GetClass() const override
437  {
438  return wxT( "ZONE_CONTAINER" );
439  }
440 
445  int GetNumCorners( void ) const
446  {
447  return m_Poly->TotalVertices();
448  }
449 
456  {
457  return m_Poly->Iterate();
458  }
459 
466  {
467  return m_Poly->IterateWithHoles();
468  }
469 
476  {
477  return m_Poly->CIterateWithHoles();
478  }
479 
480  void RemoveAllContours( void )
481  {
483  }
484 
485  const VECTOR2I& GetCornerPosition( int aCornerIndex ) const
486  {
488 
489  // Convert global to relative indices
490  if( !m_Poly->GetRelativeIndices( aCornerIndex, &index ) )
491  throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
492 
493  return m_Poly->CVertex( index );
494  }
495 
496  void SetCornerPosition( int aCornerIndex, wxPoint new_pos )
497  {
498  SHAPE_POLY_SET::VERTEX_INDEX relativeIndices;
499 
500  // Convert global to relative indices
501  if( m_Poly->GetRelativeIndices( aCornerIndex, &relativeIndices ) )
502  {
503  if( m_Poly->Vertex( relativeIndices ).x != new_pos.x ||
504  m_Poly->Vertex( relativeIndices ).y != new_pos.y )
505  SetNeedRefill( true );
506 
507  m_Poly->Vertex( relativeIndices ).x = new_pos.x;
508  m_Poly->Vertex( relativeIndices ).y = new_pos.y;
509  }
510  else
511  throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
512  }
513 
518  void NewHole()
519  {
520  m_Poly->NewHole();
521  }
522 
531  bool AppendCorner( wxPoint aPosition, int aHoleIdx, bool aAllowDuplication = false );
532 
534  {
535  return m_hatchStyle;
536  }
537 
538  void SetHatchStyle( HATCH_STYLE aStyle )
539  {
540  m_hatchStyle = aStyle;
541  }
542 
550  bool IsSame( const ZONE_CONTAINER &aZoneToCompare );
551 
557  {
559  }
560 
567  {
568  return m_FilledPolysList;
569  }
570 
574  void CacheTriangulation();
575 
580  void SetFilledPolysList( SHAPE_POLY_SET& aPolysList )
581  {
582  m_FilledPolysList = aPolysList;
583  }
584 
589  void SetRawPolysList( SHAPE_POLY_SET& aPolysList )
590  {
591  m_RawPolysList = aPolysList;
592  }
593 
594 
601  bool BuildSmoothedPoly( SHAPE_POLY_SET& aSmoothedPoly ) const;
602 
603  void SetCornerSmoothingType( int aType ) { m_cornerSmoothingType = aType; };
604 
606 
607  void SetCornerRadius( unsigned int aRadius );
608 
609  unsigned int GetCornerRadius() const { return m_cornerRadius; };
610 
616  void AddPolygon( std::vector< wxPoint >& aPolygon );
617 
618  void SetFillSegments( const ZONE_SEGMENT_FILL& aSegments )
619  {
620  m_FillSegmList = aSegments;
621  }
622 
624  {
625  return m_RawPolysList;
626  }
627 
628  wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
629 
630  BITMAP_DEF GetMenuImage() const override;
631 
632  EDA_ITEM* Clone() const override;
633 
637  bool GetIsKeepout() const { return m_isKeepout; }
639  bool GetDoNotAllowVias() const { return m_doNotAllowVias; }
640  bool GetDoNotAllowTracks() const { return m_doNotAllowTracks; }
641 
642  void SetIsKeepout( bool aEnable ) { m_isKeepout = aEnable; }
643  void SetDoNotAllowCopperPour( bool aEnable ) { m_doNotAllowCopperPour = aEnable; }
644  void SetDoNotAllowVias( bool aEnable ) { m_doNotAllowVias = aEnable; }
645  void SetDoNotAllowTracks( bool aEnable ) { m_doNotAllowTracks = aEnable; }
646 
655  int GetHatchPitch() const;
656 
661  static int GetDefaultHatchPitch();
662 
672  void SetHatch( int aHatchStyle, int aHatchPitch, bool aRebuildHatch );
673 
679  void SetHatchPitch( int aPitch );
680 
685  void UnHatch();
686 
692  void Hatch();
693 
694  const std::vector<SEG>& GetHatchLines() const { return m_HatchLines; }
695 
696  bool GetHV45() const { return m_hv45; }
697  void SetHV45( bool aConstrain ) { m_hv45 = aConstrain; }
698 
703 
709 
710 
711 
712 #if defined(DEBUG)
713  virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
714 #endif
715 
716  virtual void SwapData( BOARD_ITEM* aImage ) override;
717 
718 private:
719 
722  unsigned int m_cornerRadius;
723 
725 
726  /* Priority: when a zone outline is inside and other zone, if its priority is higher
727  * the other zone priority, it will be created inside.
728  * if priorities are equal, a DRC error is set
729  */
730  unsigned m_priority;
731 
732  /* A zone outline can be a keepout zone.
733  * It will be never filled, and DRC should test for pads, tracks and vias
734  */
736 
737  /* For keepout zones only:
738  * what is not allowed inside the keepout ( pads, tracks and vias )
739  */
743 
747 
751 
754 
760 
763 
766 
767 
770 
773 
776 
781 
782  /* set of filled polygons used to draw a zone as a filled area.
783  * from outlines (m_Poly) but unlike m_Poly these filled polygons have no hole
784  * (they are all in one piece) In very simple cases m_FilledPolysList is same
785  * as m_Poly. In less simple cases (when m_Poly has holes) m_FilledPolysList is
786  * a polygon equivalent to m_Poly, without holes but with extra outline segment
787  * connecting "holes" with external main outline. In complex cases an outline
788  * described by m_Poly can have many filled areas
789  */
792  MD5_HASH m_filledPolysHash; // A hash value used in zone filling calculations
793  // to see if the filled areas are up to date
794 
795  HATCH_STYLE m_hatchStyle; // hatch style, see enum above
796  int m_hatchPitch; // for DIAGONAL_EDGE, distance between 2 hatch lines
797  std::vector<SEG> m_HatchLines; // hatch lines
798  std::vector<int> m_insulatedIslands;
799 
800  bool m_hv45; // constrain edges to horizontal, vertical or 45ยบ
801 };
802 
803 
804 #endif // CLASS_ZONE_H_
void SetFilledPolysList(SHAPE_POLY_SET &aPolysList)
Function SetFilledPolysList sets the list of filled polygons.
Definition: class_zone.h:580
void SetDoNotAllowTracks(bool aEnable)
Definition: class_zone.h:645
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:914
int NewHole(int aOutline=-1)
Creates a new hole in a given outline
void SetCornerSmoothingType(int aType)
Definition: class_zone.h:603
bool Contains(const VECTOR2I &aP, int aSubpolyIndex=-1, bool aIgnoreHoles=false) const
Returns true if a given subpolygon contains the point aP.
void SetHatchPitch(int aPitch)
Function SetHatchPitch sets the hatch pitch parameter for the zone.
void Draw(EDA_DRAW_PANEL *panel, wxDC *DC, GR_DRAWMODE aDrawMode, const wxPoint &offset=ZeroOffset) override
Function Draw Draws the zone outline.
Definition: class_zone.cpp:283
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:59
bool IsFilled() const
Definition: class_zone.h:188
virtual void SwapData(BOARD_ITEM *aImage) override
Swap data between aItem and aImage.
std::vector< SEG > ZONE_SEGMENT_FILL
Definition: class_zone.h:49
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:745
void DrawWhileCreateOutline(EDA_DRAW_PANEL *panel, wxDC *DC, GR_DRAWMODE draw_mode=GR_OR)
Function DrawWhileCreateOutline Draws the zone outline when it is created.
Definition: class_zone.cpp:548
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:198
int GetThermalReliefCopperBridge(D_PAD *aPad=NULL) const
Definition: class_zone.cpp:640
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: class_zone.cpp:154
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:742
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox (virtual)
Definition: class_zone.cpp:521
const ZONE_SEGMENT_FILL & FillSegments() const
Definition: class_zone.h:244
void SetCornerRadius(unsigned int aRadius)
Definition: class_zone.cpp:649
Classes BOARD_ITEM and BOARD_CONNECTED_ITEM.
void TransformOutlinesShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, int aMinClearanceValue, bool aUseNetClearance) const
Function TransformOutlinesShapeWithClearanceToPolygon Convert the outlines shape to a polygon with no...
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:772
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...
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:272
std::vector< int > m_insulatedIslands
Definition: class_zone.h:798
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)
Definition: class_zone.cpp:413
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:683
ZoneConnection
How pads are covered by copper in zone.
Definition: zones.h:50
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:102
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:179
ZONE_SEGMENT_FILL & FillSegments()
Definition: class_zone.h:243
MD5_HASH GetHashValue()
Definition: class_zone.h:702
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:246
CONST_ITERATOR CIterateWithHoles(int aOutline) const
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:807
void SetArcSegmentCount(int aArcSegCount)
Definition: class_zone.h:185
void SetHatch(int aHatchStyle, int aHatchPitch, bool aRebuildHatch)
Function SetHatch sets all hatch parameters for the zone.
void SetFillSegments(const ZONE_SEGMENT_FILL &aSegments)
Definition: class_zone.h:618
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:780
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:631
int m_localFlgs
Variable used in polygon calculations.
Definition: class_zone.h:775
VECTOR2< int > VECTOR2I
Definition: vector2d.h:587
static bool ClassOf(const EDA_ITEM *aItem)
Definition: class_zone.h:75
void SetIsFilled(bool isFilled)
Definition: class_zone.h:189
const wxPoint GetPosition() const override
Definition: class_zone.cpp:173
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:780
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:644
SHAPE_POLY_SET m_RawPolysList
Definition: class_zone.h:791
bool GetDoNotAllowVias() const
Definition: class_zone.h:639
VECTOR2I & Vertex(int aIndex, int aOutline, int aHole)
Returns the index-th vertex in a given hole outline within a given outline
void SetPriority(unsigned aPriority)
Function SetPriority.
Definition: class_zone.h:91
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:237
void SetLayerSet(LSET aLayerSet)
Definition: class_zone.cpp:214
int GetArcSegmentCount() const
Definition: class_zone.h:186
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:455
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:475
int m_ArcToSegmentsCount
The number of segments to convert a circle to a polygon.
Definition: class_zone.h:750
PCB_LAYER_ID
A quick note on layer IDs:
Class LSET is a set of PCB_LAYER_IDs.
int m_ThermalReliefCopperBridge
Definition: class_zone.h:765
HATCH_STYLE GetHatchStyle() const
Definition: class_zone.h:533
unsigned int GetCornerRadius() const
Definition: class_zone.h:609
std::vector< SEG > m_HatchLines
Definition: class_zone.h:797
ZoneConnection m_PadConnection
Definition: class_zone.h:744
void TransformSolidAreasShapesToPolygonSet(SHAPE_POLY_SET &aCornerBuffer, int aCircleToSegmentsCount, double aCorrectionFactor) const
Function TransformSolidAreasShapesToPolygonSet Convert solid areas full shapes to polygon set (the fu...
MD5_HASH GetHash() const
ZONE_CONTAINER & operator=(const ZONE_CONTAINER &aOther)
Definition: class_zone.cpp:117
bool IsSame(const ZONE_CONTAINER &aZoneToCompare)
Function IsSame tests if 2 zones are equivalent: 2 zones are equivalent if they have same parameters ...
GR_DRAWMODE
Drawmode. Compositing mode plus a flag or two.
Definition: gr_basic.h:37
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:518
ZONE_FILL_MODE GetFillMode() const
Definition: class_zone.h:171
bool m_IsFilled
True when a zone was filled, false after deleting the filled areas.
Definition: class_zone.h:753
virtual void Flip(const wxPoint &aCentre) override
Function Flip Flip this object, i.e.
Definition: class_zone.cpp:959
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:720
bool GetDoNotAllowCopperPour() const
Definition: class_zone.h:638
ZONE_CONTAINER(BOARD *parent)
Definition: class_zone.cpp:52
unsigned m_priority
Definition: class_zone.h:730
void Rotate(const wxPoint &centre, double angle) override
Function Rotate Move the outlines.
Definition: class_zone.cpp:929
bool m_doNotAllowVias
Definition: class_zone.h:741
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Function SetLayer sets the layer this item is on.
Definition: class_zone.cpp:206
bool UnFill()
Function UnFill Removes the zone filling.
Definition: class_zone.cpp:160
int m_cornerSmoothingType
Definition: class_zone.h:721
int GetNumCorners(void) const
Access to m_Poly parameters.
Definition: class_zone.h:445
void CacheTriangulation()
(re)create a list of triangles that "fill" the solid areas.
bool HitTestInsideZone(const wxPoint &aPosition) const
Function HitTest tests if a point is inside the zone area, i.e.
Definition: class_zone.h:266
HATCH_STYLE
Zone hatch styles.
Definition: class_zone.h:66
void SetZoneClearance(int aZoneClearance)
Definition: class_zone.h:195
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:251
void BuildHashValue()
Build the hash value of m_FilledPolysList, and store it internally in m_filledPolysHash.
Definition: class_zone.h:708
bool GetRelativeIndices(int aGlobalIdx, VERTEX_INDEX *aRelativeIndices) const
Function GetRelativeIndices.
const std::vector< SEG > & GetHatchLines() const
Definition: class_zone.h:694
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...
int GetCornerSmoothingType() const
Definition: class_zone.h:605
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:790
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:589
MD5_HASH m_filledPolysHash
Definition: class_zone.h:792
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:637
unsigned int m_cornerRadius
Definition: class_zone.h:722
bool GetHV45() const
Definition: class_zone.h:696
void SetThermalReliefCopperBridge(int aThermalReliefCopperBridge)
Definition: class_zone.h:176
bool NeedRefill() const
Definition: class_zone.h:191
void Move(const wxPoint &offset) override
Function Move Move the outlines.
Definition: class_zone.cpp:897
bool GetGlobalIndex(VERTEX_INDEX aRelativeIndices, int &aGlobalIdx)
Function GetGlobalIndex computes the global index of a vertex from the relative indices of polygon,...
Definition: gr_basic.h:38
HATCH_STYLE m_hatchStyle
Definition: class_zone.h:795
void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, int aClearanceValue, int aCircleToSegmentsCount, double aCorrectionFactor, bool ignoreLineWidth=false) const override
Function TransformShapeWithClearanceToPolygon Convert the zone shape to a closed polygon Used in fill...
void SetDoNotAllowCopperPour(bool aEnable)
Definition: class_zone.h:643
bool BuildSmoothedPoly(SHAPE_POLY_SET &aSmoothedPoly) const
Function GetSmoothedPoly returns a pointer to the corner-smoothed version of m_Poly if it exists,...
bool m_doNotAllowCopperPour
Definition: class_zone.h:740
wxString GetClass() const override
Function GetClass returns the class name.
Definition: class_zone.h:436
int m_ThermalReliefGap
Width of the copper bridge in thermal reliefs.
Definition: class_zone.h:762
int m_ZoneMinThickness
Minimum thickness value in filled areas.
Definition: class_zone.h:746
void SetFillMode(ZONE_FILL_MODE aFillMode)
Definition: class_zone.h:170
ZONE_FILL_MODE m_FillMode
How to fill areas: ZFM_POLYGONS => use filled polygons, ZFM_SEGMENTS => fill with segments.
Definition: class_zone.h:769
unsigned GetPriority() const
Function GetPriority.
Definition: class_zone.h:97
void SetCornerPosition(int aCornerIndex, wxPoint new_pos)
Definition: class_zone.h:496
Board layer functions and definitions.
void UnHatch()
Function UnHatch clears the zone's hatch.
ZoneConnection GetPadConnection(D_PAD *aPad=NULL) const
Definition: class_zone.cpp:999
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:171
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:465
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
Class ITERATOR_TEMPLATE.
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.
Definition: class_zone.cpp:658
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.
void SetHV45(bool aConstrain)
Definition: class_zone.h:697
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...
int GetHatchPitch() const
Hatch related methods.
void SetHatchStyle(HATCH_STYLE aStyle)
Definition: class_zone.h:538
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:154
void SetLocalFlags(int aFlags)
Definition: class_zone.h:241
int GetMinThickness() const
Definition: class_zone.h:200
bool GetDoNotAllowTracks() const
Definition: class_zone.h:640
void SetPosition(const wxPoint &aPos) override
Definition: class_zone.h:85
bool AppendCorner(wxPoint aPosition, int aHoleIdx, bool aAllowDuplication=false)
Add a new corner to the zone outline (to the main outline or a hole)
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:697
bool m_needRefill
False when a zone was refilled, true after changes in zone params.
Definition: class_zone.h:759
const SHAPE_POLY_SET * Outline() const
Definition: class_zone.h:247
int GetZoneClearance() const
Definition: class_zone.h:194
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:975
Class EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
void SetIsKeepout(bool aEnable)
Definition: class_zone.h:642
void SetPadConnection(ZoneConnection aPadConnection)
Definition: class_zone.h:198
Class BOARD_CONNECTED_ITEM.
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
class SEGZONE, a segment used to fill a zone area (segment on a
Definition: typeinfo.h:97
void SetMinThickness(int aMinThickness)
Definition: class_zone.h:201
SHAPE_POLY_SET & RawPolysList()
Definition: class_zone.h:623
bool IsOnCopperLayer() const
Function IsOnCopperLayer.
Definition: class_zone.cpp:185
const VECTOR2I & GetCornerPosition(int aCornerIndex) const
Definition: class_zone.h:485
ZONE_FILL_MODE
Definition: zone_settings.h:36
void SetThermalReliefGap(int aThermalReliefGap)
Definition: class_zone.h:173
EDA_UNITS_T
Definition: common.h:160
int GetLocalFlags() const
Definition: class_zone.h:240
void ClearFilledPolysList()
Function ClearFilledPolysList clears the list of filled polygons.
Definition: class_zone.h:556
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
const SHAPE_POLY_SET & GetFilledPolysList() const
Function GetFilledPolysList returns a reference to the list of filled polygons.
Definition: class_zone.h:566
void RemoveAllContours(void)
Definition: class_zone.h:480
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:813
void SetNeedRefill(bool aNeedRefill)
Definition: class_zone.h:192