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 
72  ZONE_CONTAINER( BOARD_ITEM_CONTAINER* parent, bool aInModule = false );
73 
74  ZONE_CONTAINER( const ZONE_CONTAINER& aZone );
75  ZONE_CONTAINER& operator=( const ZONE_CONTAINER &aOther );
76 
78 
79  static inline bool ClassOf( const EDA_ITEM* aItem )
80  {
81  return aItem && aItem->Type() == PCB_ZONE_AREA_T;
82  }
83 
87  const wxPoint GetPosition() const override;
88  void SetPosition( const wxPoint& aPos ) override {}
89 
94  void SetPriority( unsigned aPriority ) { m_priority = aPriority; }
95 
100  unsigned GetPriority() const { return m_priority; }
101 
102  void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
103 
104  void SetLayerSet( LSET aLayerSet );
105 
106  virtual LSET GetLayerSet() const override;
107 
116  void Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset = ZeroOffset ) override;
117 
126  void PrintFilledArea( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset = ZeroOffset );
127 
131  const EDA_RECT GetBoundingBox() const override;
132 
133  int GetClearance( BOARD_CONNECTED_ITEM* aItem = NULL ) const override;
134 
139  bool IsOnCopperLayer() const override;
140 
145  bool CommonLayerExists( const LSET aLayerSet ) const;
146 
147  virtual void SetLayer( PCB_LAYER_ID aLayer ) override;
148 
149  virtual PCB_LAYER_ID GetLayer() const override;
150 
151  virtual bool IsOnLayer( PCB_LAYER_ID ) const override;
152 
153  virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
154 
155  void SetFillMode( ZONE_FILL_MODE aFillMode ) { m_FillMode = aFillMode; }
157 
158  void SetThermalReliefGap( int aThermalReliefGap ) { m_ThermalReliefGap = aThermalReliefGap; }
159  int GetThermalReliefGap( D_PAD* aPad = NULL ) const;
160 
161  void SetThermalReliefCopperBridge( int aThermalReliefCopperBridge )
162  {
163  if( m_ThermalReliefCopperBridge != aThermalReliefCopperBridge )
164  SetNeedRefill( true );
165 
166  m_ThermalReliefCopperBridge = aThermalReliefCopperBridge;
167  }
168  int GetThermalReliefCopperBridge( D_PAD* aPad = NULL ) const;
169 
175  double CalculateFilledArea();
176 
183  double GetFilledArea()
184  {
185  return m_area;
186  }
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  ZONE_CONNECTION GetPadConnection( D_PAD* aPad = NULL ) const;
198 
199  void SetPadConnection( ZONE_CONNECTION aPadConnection )
200  {
201  m_PadConnection = aPadConnection;
202  }
203 
204  int GetMinThickness() const { return m_ZoneMinThickness; }
205  void SetMinThickness( int aMinThickness )
206  {
207  if( m_ZoneMinThickness != aMinThickness )
208  SetNeedRefill( true );
209 
210  m_ZoneMinThickness = aMinThickness;
211  }
212 
214  void SetHatchFillTypeThickness( int aThickness ) { m_HatchFillTypeThickness = aThickness; }
215 
216  int GetHatchFillTypeGap() const { return m_HatchFillTypeGap; }
217  void SetHatchFillTypeGap( int aStep ) { m_HatchFillTypeGap = aStep; }
218 
220  void SetHatchFillTypeOrientation( double aStep ) { m_HatchFillTypeOrientation = aStep; }
221 
224 
227 
228  int GetSelectedCorner() const
229  {
230  // Transform relative indices to global index
231  int globalIndex = -1;
232 
233  if( m_CornerSelection )
234  m_Poly->GetGlobalIndex( *m_CornerSelection, globalIndex );
235 
236  return globalIndex;
237  }
238 
239  void SetSelectedCorner( int aCorner )
240  {
241  SHAPE_POLY_SET::VERTEX_INDEX selectedCorner;
242 
243  // If the global index of the corner is correct, assign it to m_CornerSelection
244  if( m_Poly->GetRelativeIndices( aCorner, &selectedCorner ) )
245  {
246  if( m_CornerSelection == nullptr )
248 
249  *m_CornerSelection = selectedCorner;
250  }
251  else
252  throw( std::out_of_range( "aCorner-th vertex does not exist" ) );
253  }
254 
256  // Like HitTest but selects the current corner to be operated on
257  void SetSelectedCorner( const wxPoint& aPosition, int aAccuracy );
258 
259  int GetLocalFlags() const { return m_localFlgs; }
260  void SetLocalFlags( int aFlags ) { m_localFlgs = aFlags; }
261 
263  const ZONE_SEGMENT_FILL& FillSegments() const { return m_FillSegmList; }
264 
266  const SHAPE_POLY_SET* Outline() const { return const_cast< SHAPE_POLY_SET* >( m_Poly ); }
267 
268  void SetOutline( SHAPE_POLY_SET* aOutline ) { m_Poly = aOutline; }
269 
276  bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
277 
284  bool HitTestFilledArea( const wxPoint& aRefPos ) const;
285 
291  void GetColinearCorners( BOARD* aBoard, std::set<VECTOR2I>& colinearCorners );
292 
303  SHAPE_POLY_SET& aCornerBuffer, int aError = ARC_HIGH_DEF ) const;
304 
321  int aMinClearanceValue, bool aUseNetClearance,
322  std::set<VECTOR2I>* aPreserveCorners = nullptr ) const;
323 
335  void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, int aClearanceValue,
336  int aError = ARC_HIGH_DEF, bool ignoreLineWidth = false ) const override;
337 
348  bool HitTestForCorner( const wxPoint& refPos, int aAccuracy,
349  SHAPE_POLY_SET::VERTEX_INDEX& aCornerHit ) const;
350 
359  bool HitTestForCorner( const wxPoint& refPos, int aAccuracy ) const;
360 
370  bool HitTestForEdge( const wxPoint& refPos, int aAccuracy,
371  SHAPE_POLY_SET::VERTEX_INDEX& aCornerHit ) const;
372 
380  bool HitTestForEdge( const wxPoint& refPos, int aAccuracy ) const;
381 
385  bool HitTest( const EDA_RECT& aRect, bool aContained = true, int aAccuracy = 0 ) const override;
386 
387 
394  bool UnFill();
395 
396  /* Geometric transformations: */
397 
403  void Move( const wxPoint& offset ) override;
404 
411  void MoveEdge( const wxPoint& offset, int aEdge );
412 
419  void Rotate( const wxPoint& centre, double angle ) override;
420 
427  virtual void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override;
428 
436  void Mirror( const wxPoint& aMirrorRef, bool aMirrorLeftRight );
437 
443  wxString GetClass() const override
444  {
445  return wxT( "ZONE_CONTAINER" );
446  }
447 
450  int GetNumCorners( void ) const
451  {
452  return m_Poly->TotalVertices();
453  }
454 
461  {
462  return m_Poly->Iterate();
463  }
464 
471  {
472  return m_Poly->IterateWithHoles();
473  }
474 
481  {
482  return m_Poly->CIterateWithHoles();
483  }
484 
485  void RemoveAllContours( void )
486  {
488  }
489 
490  const VECTOR2I& GetCornerPosition( int aCornerIndex ) const
491  {
493 
494  // Convert global to relative indices
495  if( !m_Poly->GetRelativeIndices( aCornerIndex, &index ) )
496  throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
497 
498  return m_Poly->CVertex( index );
499  }
500 
501  void SetCornerPosition( int aCornerIndex, wxPoint new_pos )
502  {
503  SHAPE_POLY_SET::VERTEX_INDEX relativeIndices;
504 
505  // Convert global to relative indices
506  if( m_Poly->GetRelativeIndices( aCornerIndex, &relativeIndices ) )
507  {
508  if( m_Poly->CVertex( relativeIndices ).x != new_pos.x
509  || m_Poly->CVertex( relativeIndices ).y != new_pos.y )
510  {
511  SetNeedRefill( true );
512  m_Poly->SetVertex( relativeIndices, new_pos );
513  }
514  }
515  else
516  throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
517  }
518 
523  void NewHole()
524  {
525  m_Poly->NewHole();
526  }
527 
536  bool AppendCorner( wxPoint aPosition, int aHoleIdx, bool aAllowDuplication = false );
537 
539  {
540  return m_hatchStyle;
541  }
542 
544  {
545  m_hatchStyle = aStyle;
546  }
547 
555  bool IsSame( const ZONE_CONTAINER &aZoneToCompare );
556 
562  {
564  }
565 
572  {
573  return m_FilledPolysList;
574  }
575 
579  void CacheTriangulation();
580 
585  void SetFilledPolysList( SHAPE_POLY_SET& aPolysList )
586  {
587  m_FilledPolysList = aPolysList;
588  }
589 
594  void SetRawPolysList( SHAPE_POLY_SET& aPolysList )
595  {
596  m_RawPolysList = aPolysList;
597  }
598 
599 
606  bool BuildSmoothedPoly( SHAPE_POLY_SET& aSmoothedPoly,
607  std::set<VECTOR2I>* aPreserveCorners ) const;
608 
609  void SetCornerSmoothingType( int aType ) { m_cornerSmoothingType = aType; };
610 
612 
613  void SetCornerRadius( unsigned int aRadius );
614 
615  unsigned int GetCornerRadius() const { return m_cornerRadius; }
616 
618  void SetFilledPolysUseThickness( bool aOption ) { m_FilledPolysUseThickness = aOption; }
619 
620 
626  void AddPolygon( std::vector< wxPoint >& aPolygon );
627 
628  void AddPolygon( const SHAPE_LINE_CHAIN& aPolygon );
629 
630  void SetFillSegments( const ZONE_SEGMENT_FILL& aSegments )
631  {
632  m_FillSegmList = aSegments;
633  }
634 
636  {
637  return m_RawPolysList;
638  }
639 
640  wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
641 
642  BITMAP_DEF GetMenuImage() const override;
643 
644  EDA_ITEM* Clone() const override;
645 
649  bool GetIsKeepout() const { return m_isKeepout; }
651  bool GetDoNotAllowVias() const { return m_doNotAllowVias; }
652  bool GetDoNotAllowTracks() const { return m_doNotAllowTracks; }
653 
654  void SetIsKeepout( bool aEnable ) { m_isKeepout = aEnable; }
655  void SetDoNotAllowCopperPour( bool aEnable ) { m_doNotAllowCopperPour = aEnable; }
656  void SetDoNotAllowVias( bool aEnable ) { m_doNotAllowVias = aEnable; }
657  void SetDoNotAllowTracks( bool aEnable ) { m_doNotAllowTracks = aEnable; }
658 
667  int GetHatchPitch() const;
668 
673  static int GetDefaultHatchPitch();
674 
684  void SetHatch( ZONE_HATCH_STYLE aHatchStyle, int aHatchPitch, bool aRebuildHatch );
685 
691  void SetHatchPitch( int aPitch );
692 
697  void UnHatch();
698 
704  void Hatch();
705 
706  const std::vector<SEG>& GetHatchLines() const { return m_HatchLines; }
707 
708  bool GetHV45() const { return m_hv45; }
709  void SetHV45( bool aConstrain ) { m_hv45 = aConstrain; }
710 
715 
721 
722 
723 
724 #if defined(DEBUG)
725  virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
726 #endif
727 
728  virtual void SwapData( BOARD_ITEM* aImage ) override;
729 
730 protected:
735  void initDataFromSrcInCopyCtor( const ZONE_CONTAINER& aZone );
736 
739  unsigned int m_cornerRadius;
740 
742 
743  /* Priority: when a zone outline is inside and other zone, if its priority is higher
744  * the other zone priority, it will be created inside.
745  * if priorities are equal, a DRC error is set
746  */
747  unsigned m_priority;
748 
749  /* A zone outline can be a keepout zone.
750  * It will be never filled, and DRC should test for pads, tracks and vias
751  */
753 
754  /* For keepout zones only:
755  * what is not allowed inside the keepout ( pads, tracks and vias )
756  */
760 
765 
768 
774 
777 
780 
781 
787 
790 
793 
796 
800 
804 
807 
810 
815 
816  /* set of filled polygons used to draw a zone as a filled area.
817  * from outlines (m_Poly) but unlike m_Poly these filled polygons have no hole
818  * (they are all in one piece) In very simple cases m_FilledPolysList is same
819  * as m_Poly. In less simple cases (when m_Poly has holes) m_FilledPolysList is
820  * a polygon equivalent to m_Poly, without holes but with extra outline segment
821  * connecting "holes" with external main outline. In complex cases an outline
822  * described by m_Poly can have many filled areas
823  */
826  MD5_HASH m_filledPolysHash; // A hash value used in zone filling calculations
827  // to see if the filled areas are up to date
828 
829  ZONE_HATCH_STYLE m_hatchStyle; // hatch style, see enum above
830  int m_hatchPitch; // for DIAGONAL_EDGE, distance between 2 hatch lines
831  std::vector<SEG> m_HatchLines; // hatch lines
832  std::vector<int> m_insulatedIslands;
833 
834  bool m_hv45; // constrain edges to horizontal, vertical or 45ยบ
835 
836  double m_area; // The filled zone area
837 };
838 
839 
849 {
850 public:
854 
855  EDA_ITEM* Clone() const override;
856 
857  unsigned int ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
858 };
859 
860 #endif // CLASS_ZONE_H_
void SetFilledPolysList(SHAPE_POLY_SET &aPolysList)
Function SetFilledPolysList sets the list of filled polygons.
Definition: class_zone.h:585
void SetDoNotAllowTracks(bool aEnable)
Definition: class_zone.h:657
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:799
EDA_UNITS
Definition: common.h:184
int NewHole(int aOutline=-1)
Creates a new hole in a given outline
void SetCornerSmoothingType(int aType)
Definition: class_zone.h:609
ZONE_CONNECTION
How pads are covered by copper in zone.
Definition: zones.h:41
void SetHatchPitch(int aPitch)
Function SetHatchPitch sets the hatch pitch parameter for the zone.
Definition: class_zone.cpp:980
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
void SetHatch(ZONE_HATCH_STYLE aHatchStyle, int aHatchPitch, bool aRebuildHatch)
Function SetHatch sets all hatch parameters for the zone.
Definition: class_zone.cpp:970
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:47
LINE_READER is an abstract class from which implementation specific LINE_READERs may be derived to re...
Definition: richio.h:81
int m_ZoneClearance
Clearance value in internal units.
Definition: class_zone.h:762
void Mirror(const wxPoint &aMirrorRef, bool aMirrorLeftRight)
Function Mirror Mirror the outlines , relative to a given horizontal axis the layer is not changed.
Definition: class_zone.cpp:854
void SetHatchFillTypeSmoothingLevel(int aLevel)
Definition: class_zone.h:223
void SetHatchFillTypeSmoothingValue(double aValue)
Definition: class_zone.h:226
PNG memory record (file in memory).
Definition: bitmap_def.h:29
void SetPadConnection(ZONE_CONNECTION aPadConnection)
Definition: class_zone.h:199
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:232
int GetThermalReliefCopperBridge(D_PAD *aPad=NULL) const
Definition: class_zone.cpp:542
void SetFilledPolysUseThickness(bool aOption)
Definition: class_zone.h:618
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: class_zone.cpp:189
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:759
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox (virtual)
Definition: class_zone.cpp:506
const ZONE_SEGMENT_FILL & FillSegments() const
Definition: class_zone.h:263
void SetCornerRadius(unsigned int aRadius)
Definition: class_zone.cpp:551
Classes BOARD_ITEM and BOARD_CONNECTED_ITEM.
int GetHatchFillTypeThickness() const
Definition: class_zone.h:213
SHAPE_POLY_SET::VERTEX_INDEX * m_CornerSelection
The index of the corner being moved or nullptr if no corner is selected.
Definition: class_zone.h:806
int GetSelectedCorner() const
Definition: class_zone.h:228
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Returns the index-th vertex in a given hole outline within a given outline
virtual bool IsOnLayer(PCB_LAYER_ID) const override
Function IsOnLayer tests to see if this object is on the given layer.
Definition: class_zone.cpp:310
std::vector< int > m_insulatedIslands
Definition: class_zone.h:832
bool HitTestForCorner(const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
Function HitTestForCorner tests if the given wxPoint is near a corner.
Definition: class_zone.cpp:585
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:102
ZONE_CONTAINER(BOARD_ITEM_CONTAINER *parent, bool aInModule=false)
The ctor to build ZONE_CONTAINER, but comaptible with MODULE_ZONE_CONTAINER requirement.
Definition: class_zone.cpp:49
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:213
ZONE_SEGMENT_FILL & FillSegments()
Definition: class_zone.h:262
MD5_HASH GetHashValue()
Definition: class_zone.h:714
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:265
CONST_ITERATOR CIterateWithHoles(int aOutline) const
bool GetFilledPolysUseThickness() const
Definition: class_zone.h:617
double GetHatchFillTypeOrientation() const
Definition: class_zone.h:219
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:684
void SetHatchStyle(ZONE_HATCH_STYLE aStyle)
Definition: class_zone.h:543
double GetHatchFillTypeSmoothingValue() const
Definition: class_zone.h:225
MODULE_ZONE_CONTAINER(BOARD_ITEM_CONTAINER *aParent)
void SetFillSegments(const ZONE_SEGMENT_FILL &aSegments)
Definition: class_zone.h:630
ZONE_SEGMENT_FILL m_FillSegmList
Segments used to fill the zone (m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:814
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:533
int m_localFlgs
Variable used in polygon calculations.
Definition: class_zone.h:809
static bool ClassOf(const EDA_ITEM *aItem)
Definition: class_zone.h:79
void SetIsFilled(bool isFilled)
Definition: class_zone.h:189
const wxPoint GetPosition() const override
Definition: class_zone.cpp:207
BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected and have...
void SetOutline(SHAPE_POLY_SET *aOutline)
Definition: class_zone.h:268
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:659
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:656
SHAPE_POLY_SET m_RawPolysList
Definition: class_zone.h:825
bool GetDoNotAllowVias() const
Definition: class_zone.h:651
ZONE_CONNECTION m_PadConnection
Definition: class_zone.h:761
void SetPriority(unsigned aPriority)
Function SetPriority.
Definition: class_zone.h:94
virtual LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_zone.cpp:277
void 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:248
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:460
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:480
int m_HatchFillTypeSmoothingLevel
Grid pattern smoothing type, similar to corner smoothing type 0 = no smoothing, 1 = fillet,...
Definition: class_zone.h:799
PCB_LAYER_ID
A quick note on layer IDs:
void SetHatchFillTypeGap(int aStep)
Definition: class_zone.h:217
LSET is a set of PCB_LAYER_IDs.
int m_ThermalReliefCopperBridge
Definition: class_zone.h:779
unsigned int GetCornerRadius() const
Definition: class_zone.h:615
std::vector< SEG > m_HatchLines
Definition: class_zone.h:831
#define NULL
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:319
ZONE_CONTAINER & operator=(const ZONE_CONTAINER &aOther)
Definition: class_zone.cpp:88
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.
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:523
double m_HatchFillTypeOrientation
Grid style shape: orientation in degrees of the grid lines.
Definition: class_zone.h:795
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:156
bool m_IsFilled
True when a zone was filled, false after deleting the filled areas.
Definition: class_zone.h:767
ZONE_HATCH_STYLE m_hatchStyle
Definition: class_zone.h:829
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:737
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:560
bool GetDoNotAllowCopperPour() const
Definition: class_zone.h:650
unsigned m_priority
Definition: class_zone.h:747
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:814
bool m_doNotAllowVias
Definition: class_zone.h:758
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Function SetLayer sets the layer this item is on.
Definition: class_zone.cpp:240
bool UnFill()
Function UnFill Removes the zone filling.
Definition: class_zone.cpp:195
int m_cornerSmoothingType
Definition: class_zone.h:738
int GetNumCorners(void) const
Access to m_Poly parameters.
Definition: class_zone.h:450
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:803
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:291
ZONE_CONNECTION GetPadConnection(D_PAD *aPad=NULL) const
Definition: class_zone.cpp:879
void BuildHashValue()
Build the hash value of m_FilledPolysList, and store it internally in m_filledPolysHash.
Definition: class_zone.h:720
bool GetRelativeIndices(int aGlobalIdx, VERTEX_INDEX *aRelativeIndices) const
Function GetRelativeIndices.
const std::vector< SEG > & GetHatchLines() const
Definition: class_zone.h:706
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
ZONE_HATCH_STYLE GetHatchStyle() const
Definition: class_zone.h:538
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:902
int GetCornerSmoothingType() const
Definition: class_zone.h:611
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:824
void SetSelectedCorner(int aCorner)
Definition: class_zone.h:239
void SetRawPolysList(SHAPE_POLY_SET &aPolysList)
Function SetFilledPolysList sets the list of filled polygons.
Definition: class_zone.h:594
MD5_HASH m_filledPolysHash
Definition: class_zone.h:826
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:649
unsigned int m_cornerRadius
Definition: class_zone.h:739
bool GetHV45() const
Definition: class_zone.h:708
void SetThermalReliefCopperBridge(int aThermalReliefCopperBridge)
Definition: class_zone.h:161
bool NeedRefill() const
Definition: class_zone.h:191
void Move(const wxPoint &offset) override
Function Move Move the outlines.
Definition: class_zone.cpp:782
bool GetGlobalIndex(VERTEX_INDEX aRelativeIndices, int &aGlobalIdx)
Function GetGlobalIndex computes the global index of a vertex from the relative indices of polygon,...
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
Definition: class_zone.cpp:947
void SetDoNotAllowCopperPour(bool aEnable)
Definition: class_zone.h:655
bool m_doNotAllowCopperPour
Definition: class_zone.h:757
wxString GetClass() const override
Function GetClass returns the class name.
Definition: class_zone.h:443
double CalculateFilledArea()
Compute the area currently occupied by the zone fill.
int m_ThermalReliefGap
Width of the copper bridge in thermal reliefs.
Definition: class_zone.h:776
int m_ZoneMinThickness
Minimum thickness value in filled areas.
Definition: class_zone.h:763
void SetFillMode(ZONE_FILL_MODE aFillMode)
Definition: class_zone.h:155
ZONE_FILL_MODE m_FillMode
How to fill areas: ZONE_FILL_MODE::POLYGONS => use solid polygons ZONE_FILL_MODE::HATCH_PATTERN => us...
Definition: class_zone.h:786
unsigned GetPriority() const
Function GetPriority.
Definition: class_zone.h:100
void SetCornerPosition(int aCornerIndex, wxPoint new_pos)
Definition: class_zone.h:501
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:986
ZONE_HATCH_STYLE
Zone hatch styles.
Definition: zone_settings.h:45
void GetMsgPanelInfo(EDA_UNITS aUnits, std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for displ...
Definition: class_zone.cpp:690
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:163
SHAPE_LINE_CHAIN.
int m_HatchFillTypeThickness
Grid style shape: thickness of lines (if 0 -> solid shape)
Definition: class_zone.h:789
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:470
void initDataFromSrcInCopyCtor(const ZONE_CONTAINER &aZone)
Copy aZone data to me members are expected non initialize in this.
Definition: class_zone.cpp:132
void SetHatchFillTypeOrientation(double aStep)
Definition: class_zone.h:220
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:431
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.
void SetHV45(bool aConstrain)
Definition: class_zone.h:709
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
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.
Definition: class_zone.cpp:964
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:166
void SetLocalFlags(int aFlags)
Definition: class_zone.h:260
MODULE_ZONE_CONTAINER is the same item as ZONE_CONTAINER, but with a specific type id ZONE_CONTAINER ...
Definition: class_zone.h:848
int GetMinThickness() const
Definition: class_zone.h:204
bool GetDoNotAllowTracks() const
Definition: class_zone.h:652
void SetHatchFillTypeThickness(int aThickness)
Definition: class_zone.h:214
void SetPosition(const wxPoint &aPos) override
Definition: class_zone.h:88
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:927
int GetHatchFillTypeSmoothingLevel() const
Definition: class_zone.h:222
bool HitTestForEdge(const wxPoint &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
Function HitTestForEdge tests if the given wxPoint is near a segment defined by 2 corners.
Definition: class_zone.cpp:599
double GetFilledArea()
Get the area currently occupied by the zone fill.
Definition: class_zone.h:183
bool m_needRefill
False when a zone was refilled, true after changes in zone params.
Definition: class_zone.h:773
const SHAPE_POLY_SET * Outline() const
Definition: class_zone.h:266
Abstract interface for BOARD_ITEMs capable of storing other items inside.
int GetZoneClearance() const
Definition: class_zone.h:194
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:792
VIEW.
Definition: view.h:61
void SetIsKeepout(bool aEnable)
Definition: class_zone.h:654
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:205
int GetHatchFillTypeGap() const
Definition: class_zone.h:216
SHAPE_POLY_SET & RawPolysList()
Definition: class_zone.h:635
const VECTOR2I & GetCornerPosition(int aCornerIndex) const
Definition: class_zone.h:490
virtual void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Function Flip Flip this object, i.e.
Definition: class_zone.cpp:838
ZONE_FILL_MODE
Definition: zone_settings.h:37
void SetThermalReliefGap(int aThermalReliefGap)
Definition: class_zone.h:158
PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
bool IsOnCopperLayer() const override
Function IsOnCopperLayer.
Definition: class_zone.cpp:219
int GetLocalFlags() const
Definition: class_zone.h:259
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:764
void ClearFilledPolysList()
Function ClearFilledPolysList clears the list of filled polygons.
Definition: class_zone.h:561
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
const SHAPE_POLY_SET & GetFilledPolysList() const
Function GetFilledPolysList returns a reference to the list of filled polygons.
Definition: class_zone.h:571
void RemoveAllContours(void)
Definition: class_zone.h:485
void SetNeedRefill(bool aNeedRefill)
Definition: class_zone.h:192