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) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 1992-2018 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 && aItem->Type() == PCB_ZONE_AREA_T;
78  }
79 
83  const wxPoint GetPosition() const override;
84  void SetPosition( const wxPoint& aPos ) override {}
85 
90  void SetPriority( unsigned aPriority ) { m_priority = aPriority; }
91 
96  unsigned GetPriority() const { return m_priority; }
97 
98  void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
99 
100  void SetLayerSet( LSET aLayerSet );
101 
102  virtual LSET GetLayerSet() const override;
103 
112  void Draw( EDA_DRAW_PANEL* panel,
113  wxDC* DC,
114  GR_DRAWMODE aDrawMode,
115  const wxPoint& offset = ZeroOffset ) override;
116 
125  void DrawFilledArea( EDA_DRAW_PANEL* panel,
126  wxDC* DC,
127  GR_DRAWMODE aDrawMode,
128  const wxPoint& offset = ZeroOffset );
129 
139  void DrawWhileCreateOutline( EDA_DRAW_PANEL* panel, wxDC* DC,
140  GR_DRAWMODE draw_mode = GR_OR );
141 
145  const EDA_RECT GetBoundingBox() const override;
146 
147  int GetClearance( BOARD_CONNECTED_ITEM* aItem = NULL ) const override;
148 
153  bool IsOnCopperLayer() const;
154 
159  bool CommonLayerExists( const LSET aLayerSet ) const;
160 
161  virtual void SetLayer( PCB_LAYER_ID aLayer ) override;
162 
163  virtual PCB_LAYER_ID GetLayer() const override;
164 
165  virtual bool IsOnLayer( PCB_LAYER_ID ) const override;
166 
167  virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
168 
169  void SetFillMode( ZONE_FILL_MODE aFillMode ) { m_FillMode = aFillMode; }
171 
172  void SetThermalReliefGap( int aThermalReliefGap ) { m_ThermalReliefGap = aThermalReliefGap; }
173  int GetThermalReliefGap( D_PAD* aPad = NULL ) const;
174 
175  void SetThermalReliefCopperBridge( int aThermalReliefCopperBridge )
176  {
177  if( m_ThermalReliefCopperBridge != aThermalReliefCopperBridge )
178  SetNeedRefill( true );
179 
180  m_ThermalReliefCopperBridge = aThermalReliefCopperBridge;
181  }
182  int GetThermalReliefCopperBridge( D_PAD* aPad = NULL ) const;
183 
184  void SetArcSegmentCount( int aArcSegCount ) { m_ArcToSegmentsCount = aArcSegCount; }
185  int GetArcSegmentCount() const { return m_ArcToSegmentsCount; }
186 
187  bool IsFilled() const { return m_IsFilled; }
188  void SetIsFilled( bool isFilled ) { m_IsFilled = isFilled; }
189 
190  bool NeedRefill() const { return m_needRefill; }
191  void SetNeedRefill( bool aNeedRefill ) { m_needRefill = aNeedRefill; }
192 
193  int GetZoneClearance() const { return m_ZoneClearance; }
194  void SetZoneClearance( int aZoneClearance ) { m_ZoneClearance = aZoneClearance; }
195 
196  ZoneConnection GetPadConnection( D_PAD* aPad = NULL ) const;
197  void SetPadConnection( ZoneConnection aPadConnection ) { m_PadConnection = aPadConnection; }
198 
199  int GetMinThickness() const { return m_ZoneMinThickness; }
200  void SetMinThickness( int aMinThickness )
201  {
202  if( m_ZoneMinThickness != aMinThickness )
203  SetNeedRefill( true );
204 
205  m_ZoneMinThickness = aMinThickness;
206  }
207 
209  void SetHatchFillTypeThickness( int aThickness ) { m_HatchFillTypeThickness = aThickness; }
210 
211  int GetHatchFillTypeGap() const { return m_HatchFillTypeGap; }
212  void SetHatchFillTypeGap( int aStep ) { m_HatchFillTypeGap = aStep; }
213 
215  void SetHatchFillTypeOrientation( double aStep ) { m_HatchFillTypeOrientation = aStep; }
216 
219 
222 
223  int GetSelectedCorner() const
224  {
225  // Transform relative indices to global index
226  int globalIndex = -1;
227 
228  if( m_CornerSelection )
229  m_Poly->GetGlobalIndex( *m_CornerSelection, globalIndex );
230 
231  return globalIndex;
232  }
233 
234  void SetSelectedCorner( int aCorner )
235  {
236  SHAPE_POLY_SET::VERTEX_INDEX selectedCorner;
237 
238  // If the global index of the corner is correct, assign it to m_CornerSelection
239  if( m_Poly->GetRelativeIndices( aCorner, &selectedCorner ) )
240  {
241  if( m_CornerSelection == nullptr )
243 
244  *m_CornerSelection = selectedCorner;
245  }
246  else
247  throw( std::out_of_range( "aCorner-th vertex does not exist" ) );
248  }
249 
251  // Like HitTest but selects the current corner to be operated on
252  void SetSelectedCorner( const wxPoint& aPosition, int aAccuracy );
253 
254  int GetLocalFlags() const { return m_localFlgs; }
255  void SetLocalFlags( int aFlags ) { m_localFlgs = aFlags; }
256 
258  const ZONE_SEGMENT_FILL& FillSegments() const { return m_FillSegmList; }
259 
261  const SHAPE_POLY_SET* Outline() const { return const_cast< SHAPE_POLY_SET* >( m_Poly ); }
262 
263  void SetOutline( SHAPE_POLY_SET* aOutline ) { m_Poly = aOutline; }
264 
271  bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
272 
280  bool HitTestInsideZone( const wxPoint& aPosition ) const
281  {
282  return m_Poly->Contains( VECTOR2I( aPosition ), 0 );
283  }
284 
291  bool HitTestFilledArea( const wxPoint& aRefPos ) const;
292 
305  int aCircleToSegmentsCount,
306  double aCorrectionFactor ) const;
307 
323  int aMinClearanceValue,
324  bool aUseNetClearance ) const;
325 
341  int aClearanceValue,
342  int aCircleToSegmentsCount,
343  double aCorrectionFactor,
344  bool ignoreLineWidth = false ) const override;
345 
356  bool HitTestForCorner( const wxPoint& refPos, int aAccuracy,
357  SHAPE_POLY_SET::VERTEX_INDEX& aCornerHit ) const;
358 
367  bool HitTestForCorner( const wxPoint& refPos, int aAccuracy ) const;
368 
378  bool HitTestForEdge( const wxPoint& refPos, int aAccuracy,
379  SHAPE_POLY_SET::VERTEX_INDEX& aCornerHit ) const;
380 
388  bool HitTestForEdge( const wxPoint& refPos, int aAccuracy ) const;
389 
393  bool HitTest( const EDA_RECT& aRect, bool aContained = true, int aAccuracy = 0 ) const override;
394 
395 
402  bool UnFill();
403 
404  /* Geometric transformations: */
405 
411  void Move( const wxPoint& offset ) override;
412 
419  void MoveEdge( const wxPoint& offset, int aEdge );
420 
427  void Rotate( const wxPoint& centre, double angle ) override;
428 
435  virtual void Flip( const wxPoint& aCentre ) override;
436 
443  void Mirror( const wxPoint& mirror_ref );
444 
450  wxString GetClass() const override
451  {
452  return wxT( "ZONE_CONTAINER" );
453  }
454 
459  int GetNumCorners( void ) const
460  {
461  return m_Poly->TotalVertices();
462  }
463 
470  {
471  return m_Poly->Iterate();
472  }
473 
480  {
481  return m_Poly->IterateWithHoles();
482  }
483 
490  {
491  return m_Poly->CIterateWithHoles();
492  }
493 
494  void RemoveAllContours( void )
495  {
497  }
498 
499  const VECTOR2I& GetCornerPosition( int aCornerIndex ) const
500  {
502 
503  // Convert global to relative indices
504  if( !m_Poly->GetRelativeIndices( aCornerIndex, &index ) )
505  throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
506 
507  return m_Poly->CVertex( index );
508  }
509 
510  void SetCornerPosition( int aCornerIndex, wxPoint new_pos )
511  {
512  SHAPE_POLY_SET::VERTEX_INDEX relativeIndices;
513 
514  // Convert global to relative indices
515  if( m_Poly->GetRelativeIndices( aCornerIndex, &relativeIndices ) )
516  {
517  if( m_Poly->Vertex( relativeIndices ).x != new_pos.x ||
518  m_Poly->Vertex( relativeIndices ).y != new_pos.y )
519  SetNeedRefill( true );
520 
521  m_Poly->Vertex( relativeIndices ).x = new_pos.x;
522  m_Poly->Vertex( relativeIndices ).y = new_pos.y;
523  }
524  else
525  throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
526  }
527 
532  void NewHole()
533  {
534  m_Poly->NewHole();
535  }
536 
545  bool AppendCorner( wxPoint aPosition, int aHoleIdx, bool aAllowDuplication = false );
546 
548  {
549  return m_hatchStyle;
550  }
551 
552  void SetHatchStyle( HATCH_STYLE aStyle )
553  {
554  m_hatchStyle = aStyle;
555  }
556 
564  bool IsSame( const ZONE_CONTAINER &aZoneToCompare );
565 
571  {
573  }
574 
581  {
582  return m_FilledPolysList;
583  }
584 
588  void CacheTriangulation();
589 
594  void SetFilledPolysList( SHAPE_POLY_SET& aPolysList )
595  {
596  m_FilledPolysList = aPolysList;
597  }
598 
603  void SetRawPolysList( SHAPE_POLY_SET& aPolysList )
604  {
605  m_RawPolysList = aPolysList;
606  }
607 
608 
615  bool BuildSmoothedPoly( SHAPE_POLY_SET& aSmoothedPoly ) const;
616 
617  void SetCornerSmoothingType( int aType ) { m_cornerSmoothingType = aType; };
618 
620 
621  void SetCornerRadius( unsigned int aRadius );
622 
623  unsigned int GetCornerRadius() const { return m_cornerRadius; };
624 
630  void AddPolygon( std::vector< wxPoint >& aPolygon );
631 
632  void SetFillSegments( const ZONE_SEGMENT_FILL& aSegments )
633  {
634  m_FillSegmList = aSegments;
635  }
636 
638  {
639  return m_RawPolysList;
640  }
641 
642  wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
643 
644  BITMAP_DEF GetMenuImage() const override;
645 
646  EDA_ITEM* Clone() const override;
647 
651  bool GetIsKeepout() const { return m_isKeepout; }
653  bool GetDoNotAllowVias() const { return m_doNotAllowVias; }
654  bool GetDoNotAllowTracks() const { return m_doNotAllowTracks; }
655 
656  void SetIsKeepout( bool aEnable ) { m_isKeepout = aEnable; }
657  void SetDoNotAllowCopperPour( bool aEnable ) { m_doNotAllowCopperPour = aEnable; }
658  void SetDoNotAllowVias( bool aEnable ) { m_doNotAllowVias = aEnable; }
659  void SetDoNotAllowTracks( bool aEnable ) { m_doNotAllowTracks = aEnable; }
660 
669  int GetHatchPitch() const;
670 
675  static int GetDefaultHatchPitch();
676 
686  void SetHatch( int aHatchStyle, int aHatchPitch, bool aRebuildHatch );
687 
693  void SetHatchPitch( int aPitch );
694 
699  void UnHatch();
700 
706  void Hatch();
707 
708  const std::vector<SEG>& GetHatchLines() const { return m_HatchLines; }
709 
710  bool GetHV45() const { return m_hv45; }
711  void SetHV45( bool aConstrain ) { m_hv45 = aConstrain; }
712 
717 
723 
724 
725 
726 #if defined(DEBUG)
727  virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
728 #endif
729 
730  virtual void SwapData( BOARD_ITEM* aImage ) override;
731 
732 private:
733 
736  unsigned int m_cornerRadius;
737 
739 
740  /* Priority: when a zone outline is inside and other zone, if its priority is higher
741  * the other zone priority, it will be created inside.
742  * if priorities are equal, a DRC error is set
743  */
744  unsigned m_priority;
745 
746  /* A zone outline can be a keepout zone.
747  * It will be never filled, and DRC should test for pads, tracks and vias
748  */
750 
751  /* For keepout zones only:
752  * what is not allowed inside the keepout ( pads, tracks and vias )
753  */
757 
761 
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  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 
837 
838 #endif // CLASS_ZONE_H_
void SetFilledPolysList(SHAPE_POLY_SET &aPolysList)
Function SetFilledPolysList sets the list of filled polygons.
Definition: class_zone.h:594
void SetDoNotAllowTracks(bool aEnable)
Definition: class_zone.h:659
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:617
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:289
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:59
bool IsFilled() const
Definition: class_zone.h:187
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:759
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:543
void SetHatchFillTypeSmoothingLevel(int aLevel)
Definition: class_zone.h:218
void SetHatchFillTypeSmoothingValue(double aValue)
Definition: class_zone.h:221
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:204
int GetThermalReliefCopperBridge(D_PAD *aPad=NULL) const
Definition: class_zone.cpp:635
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: class_zone.cpp:160
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:756
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox (virtual)
Definition: class_zone.cpp:516
const ZONE_SEGMENT_FILL & FillSegments() const
Definition: class_zone.h:258
void SetCornerRadius(unsigned int aRadius)
Definition: class_zone.cpp:644
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...
int GetHatchFillTypeThickness() const
Definition: class_zone.h:208
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:223
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:278
std::vector< int > m_insulatedIslands
Definition: class_zone.h:832
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:419
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:678
ZoneConnection
How pads are covered by copper in zone.
Definition: zones.h:50
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:100
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:185
ZONE_SEGMENT_FILL & FillSegments()
Definition: class_zone.h:257
MD5_HASH GetHashValue()
Definition: class_zone.h:716
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:260
CONST_ITERATOR CIterateWithHoles(int aOutline) const
double GetHatchFillTypeOrientation() const
Definition: class_zone.h:214
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:802
double GetHatchFillTypeSmoothingValue() const
Definition: class_zone.h:220
void SetArcSegmentCount(int aArcSegCount)
Definition: class_zone.h:184
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:632
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:626
int m_localFlgs
Variable used in polygon calculations.
Definition: class_zone.h:809
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:188
const wxPoint GetPosition() const override
Definition: class_zone.cpp:179
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:263
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:775
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:658
SHAPE_POLY_SET m_RawPolysList
Definition: class_zone.h:825
bool GetDoNotAllowVias() const
Definition: class_zone.h:653
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:90
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:243
void SetLayerSet(LSET aLayerSet)
Definition: class_zone.cpp:220
int GetArcSegmentCount() const
Definition: class_zone.h:185
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:469
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:489
int m_HatchFillTypeSmoothingLevel
Grid pattern smoothing type, similar to corner smoothing type 0 = no smoothing, 1 = fillet,...
Definition: class_zone.h:799
int m_ArcToSegmentsCount
The number of segments to convert a circle to a polygon.
Definition: class_zone.h:764
PCB_LAYER_ID
A quick note on layer IDs:
void SetHatchFillTypeGap(int aStep)
Definition: class_zone.h:212
Class LSET is a set of PCB_LAYER_IDs.
int m_ThermalReliefCopperBridge
Definition: class_zone.h:779
HATCH_STYLE GetHatchStyle() const
Definition: class_zone.h:547
unsigned int GetCornerRadius() const
Definition: class_zone.h:623
std::vector< SEG > m_HatchLines
Definition: class_zone.h:831
ZoneConnection m_PadConnection
Definition: class_zone.h:758
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:123
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:532
double m_HatchFillTypeOrientation
Grid style shape: orientation in degrees of the grid lines.
Definition: class_zone.h:795
ZONE_FILL_MODE GetFillMode() const
Definition: class_zone.h:170
bool m_IsFilled
True when a zone was filled, false after deleting the filled areas.
Definition: class_zone.h:767
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:734
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:653
bool GetDoNotAllowCopperPour() const
Definition: class_zone.h:652
ZONE_CONTAINER(BOARD *parent)
Definition: class_zone.cpp:52
unsigned m_priority
Definition: class_zone.h:744
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:755
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Function SetLayer sets the layer this item is on.
Definition: class_zone.cpp:212
bool UnFill()
Function UnFill Removes the zone filling.
Definition: class_zone.cpp:166
int m_cornerSmoothingType
Definition: class_zone.h:735
int GetNumCorners(void) const
Access to m_Poly parameters.
Definition: class_zone.h:459
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
bool HitTestInsideZone(const wxPoint &aPosition) const
Function HitTest tests if a point is inside the zone area, i.e.
Definition: class_zone.h:280
HATCH_STYLE
Zone hatch styles.
Definition: class_zone.h:66
void SetZoneClearance(int aZoneClearance)
Definition: class_zone.h:194
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:257
void BuildHashValue()
Build the hash value of m_FilledPolysList, and store it internally in m_filledPolysHash.
Definition: class_zone.h:722
bool GetRelativeIndices(int aGlobalIdx, VERTEX_INDEX *aRelativeIndices) const
Function GetRelativeIndices.
const std::vector< SEG > & GetHatchLines() const
Definition: class_zone.h:708
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:619
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:824
void SetSelectedCorner(int aCorner)
Definition: class_zone.h:234
void SetRawPolysList(SHAPE_POLY_SET &aPolysList)
Function SetFilledPolysList sets the list of filled polygons.
Definition: class_zone.h:603
MD5_HASH m_filledPolysHash
Definition: class_zone.h:826
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:651
unsigned int m_cornerRadius
Definition: class_zone.h:736
bool GetHV45() const
Definition: class_zone.h:710
void SetThermalReliefCopperBridge(int aThermalReliefCopperBridge)
Definition: class_zone.h:175
bool NeedRefill() const
Definition: class_zone.h:190
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:829
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:657
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:754
wxString GetClass() const override
Function GetClass returns the class name.
Definition: class_zone.h:450
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:760
void SetFillMode(ZONE_FILL_MODE aFillMode)
Definition: class_zone.h:169
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:786
unsigned GetPriority() const
Function GetPriority.
Definition: class_zone.h:96
void SetCornerPosition(int aCornerIndex, wxPoint new_pos)
Definition: class_zone.h:510
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:170
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:479
void SetHatchFillTypeOrientation(double aStep)
Definition: class_zone.h:215
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:711
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:552
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:157
void SetLocalFlags(int aFlags)
Definition: class_zone.h:255
int GetMinThickness() const
Definition: class_zone.h:199
bool GetDoNotAllowTracks() const
Definition: class_zone.h:654
void SetHatchFillTypeThickness(int aThickness)
Definition: class_zone.h:209
void SetPosition(const wxPoint &aPos) override
Definition: class_zone.h:84
bool AppendCorner(wxPoint aPosition, int aHoleIdx, bool aAllowDuplication=false)
Add a new corner to the zone outline (to the main outline or a hole)
int GetHatchFillTypeSmoothingLevel() const
Definition: class_zone.h:217
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:692
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:261
int GetZoneClearance() const
Definition: class_zone.h:193
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
int m_HatchFillTypeGap
Grid style shape: dist between center of lines (grid size) (0 -> solid shape)
Definition: class_zone.h:792
void SetIsKeepout(bool aEnable)
Definition: class_zone.h:656
void SetPadConnection(ZoneConnection aPadConnection)
Definition: class_zone.h:197
Class BOARD_CONNECTED_ITEM.
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:200
int GetHatchFillTypeGap() const
Definition: class_zone.h:211
SHAPE_POLY_SET & RawPolysList()
Definition: class_zone.h:637
bool IsOnCopperLayer() const
Function IsOnCopperLayer.
Definition: class_zone.cpp:191
const VECTOR2I & GetCornerPosition(int aCornerIndex) const
Definition: class_zone.h:499
ZONE_FILL_MODE
Definition: zone_settings.h:37
void SetThermalReliefGap(int aThermalReliefGap)
Definition: class_zone.h:172
EDA_UNITS_T
Definition: common.h:157
int GetLocalFlags() const
Definition: class_zone.h:254
void ClearFilledPolysList()
Function ClearFilledPolysList clears the list of filled polygons.
Definition: class_zone.h:570
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204
const SHAPE_POLY_SET & GetFilledPolysList() const
Function GetFilledPolysList returns a reference to the list of filled polygons.
Definition: class_zone.h:580
void RemoveAllContours(void)
Definition: class_zone.h:494
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:808
void SetNeedRefill(bool aNeedRefill)
Definition: class_zone.h:191