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>
39 #include <PolyLine.h>
41 #include <class_zone_settings.h>
42 
43 
44 class EDA_RECT;
45 class LINE_READER;
46 class EDA_DRAW_PANEL;
47 class PCB_EDIT_FRAME;
48 class BOARD;
49 class ZONE_CONTAINER;
50 class MSG_PANEL_ITEM;
51 
52 
57 struct SEGMENT
58 {
59  wxPoint m_Start; // starting point of a segment
60  wxPoint m_End; // ending point of a segment
61 
62  SEGMENT() {}
63 
64  SEGMENT( const wxPoint& aStart, const wxPoint& aEnd )
65  {
66  m_Start = aStart;
67  m_End = aEnd;
68  }
69 };
70 
71 
79 {
80 public:
81 
86 
87  ZONE_CONTAINER( BOARD* parent );
88 
89  ZONE_CONTAINER( const ZONE_CONTAINER& aZone );
90  ZONE_CONTAINER& operator=( const ZONE_CONTAINER &aOther );
91 
93 
106  const wxPoint& GetPosition() const override;
107  void SetPosition( const wxPoint& aPos ) override {}
108 
113  void SetPriority( unsigned aPriority ) { m_priority = aPriority; }
114 
119  unsigned GetPriority() const { return m_priority; }
120 
121  void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override;
122 
123  void SetLayerSet( LSET aLayerSet );
124 
125  virtual LSET GetLayerSet() const override;
126 
135  void Draw( EDA_DRAW_PANEL* panel,
136  wxDC* DC,
137  GR_DRAWMODE aDrawMode,
138  const wxPoint& offset = ZeroOffset ) override;
139 
148  void DrawFilledArea( EDA_DRAW_PANEL* panel,
149  wxDC* DC,
150  GR_DRAWMODE aDrawMode,
151  const wxPoint& offset = ZeroOffset );
152 
162  void DrawWhileCreateOutline( EDA_DRAW_PANEL* panel, wxDC* DC,
163  GR_DRAWMODE draw_mode = GR_OR );
164 
168  const EDA_RECT GetBoundingBox() const override;
169 
170  int GetClearance( BOARD_CONNECTED_ITEM* aItem = NULL ) const override;
171 
178 
183  bool IsOnCopperLayer() const;
184 
189  bool CommonLayerExists( const LSET aLayerSet ) const;
190 
191  virtual void SetLayer( PCB_LAYER_ID aLayer ) override;
192 
193  virtual PCB_LAYER_ID GetLayer() const override;
194 
195  virtual bool IsOnLayer( PCB_LAYER_ID ) const override;
196 
197  virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
198 
200  void SetFillMode( int aFillMode ) { m_FillMode = aFillMode; }
201  int GetFillMode() const { return m_FillMode; }
202 
203  void SetThermalReliefGap( int aThermalReliefGap ) { m_ThermalReliefGap = aThermalReliefGap; }
204  int GetThermalReliefGap( D_PAD* aPad = NULL ) const;
205 
206  void SetThermalReliefCopperBridge( int aThermalReliefCopperBridge )
207  {
208  m_ThermalReliefCopperBridge = aThermalReliefCopperBridge;
209  }
210  int GetThermalReliefCopperBridge( D_PAD* aPad = NULL ) const;
211 
212  void SetArcSegmentCount( int aArcSegCount ) { m_ArcToSegmentsCount = aArcSegCount; }
213  int GetArcSegmentCount() const { return m_ArcToSegmentsCount; }
214 
215  bool IsFilled() const { return m_IsFilled; }
216  void SetIsFilled( bool isFilled ) { m_IsFilled = isFilled; }
217 
218  int GetZoneClearance() const { return m_ZoneClearance; }
219  void SetZoneClearance( int aZoneClearance ) { m_ZoneClearance = aZoneClearance; }
220 
221  ZoneConnection GetPadConnection( D_PAD* aPad = NULL ) const;
222  void SetPadConnection( ZoneConnection aPadConnection ) { m_PadConnection = aPadConnection; }
223 
224  int GetMinThickness() const { return m_ZoneMinThickness; }
225  void SetMinThickness( int aMinThickness ) { m_ZoneMinThickness = aMinThickness; }
226 
227  int GetSelectedCorner() const
228  {
229  // Transform relative indices to global index
230  int globalIndex;
231  m_Poly->GetGlobalIndex( *m_CornerSelection, globalIndex );
232 
233  return globalIndex;
234  }
235 
236  void SetSelectedCorner( int aCorner )
237  {
238  SHAPE_POLY_SET::VERTEX_INDEX selectedCorner;
239 
240  // If the global index of the corner is correct, assign it to m_CornerSelection
241  if( m_Poly->GetRelativeIndices( aCorner, &selectedCorner ) )
242  {
243  if( m_CornerSelection == nullptr )
245 
246  *m_CornerSelection = selectedCorner;
247  }
248  else
249  throw( std::out_of_range( "aCorner-th vertex does not exist" ) );
250  }
251 
253  // Like HitTest but selects the current corner to be operated on
254  void SetSelectedCorner( const wxPoint& aPosition );
255 
256  int GetLocalFlags() const { return m_localFlgs; }
257  void SetLocalFlags( int aFlags ) { m_localFlgs = aFlags; }
258 
259  std::vector <SEGMENT>& FillSegments() { return m_FillSegmList; }
260  const std::vector <SEGMENT>& FillSegments() const { return m_FillSegmList; }
261 
263  const SHAPE_POLY_SET* Outline() const { return const_cast< SHAPE_POLY_SET* >( m_Poly ); }
264 
265  void SetOutline( SHAPE_POLY_SET* aOutline ) { m_Poly = aOutline; }
266 
273  virtual bool HitTest( const wxPoint& aPosition ) const override;
274 
282  bool HitTestInsideZone( const wxPoint& aPosition ) const
283  {
284  return m_Poly->Contains( VECTOR2I( aPosition ), 0 );
285  }
286 
293  bool HitTestFilledArea( const wxPoint& aRefPos ) const;
294 
307  int aCircleToSegmentsCount,
308  double aCorrectionFactor ) const;
329  bool BuildFilledSolidAreasPolygons( BOARD* aPcb, SHAPE_POLY_SET* aOutlineBuffer = NULL );
330 
345 
346 
362  int aMinClearanceValue,
363  bool aUseNetClearance );
373  bool HitTestForCorner( const wxPoint& refPos, SHAPE_POLY_SET::VERTEX_INDEX& aCornerHit ) const;
374 
382  bool HitTestForCorner( const wxPoint& refPos ) const;
383 
392  bool HitTestForEdge( const wxPoint& refPos, SHAPE_POLY_SET::VERTEX_INDEX& aCornerHit ) const;
393 
400  bool HitTestForEdge( const wxPoint& refPos ) const;
401 
405  bool HitTest( const EDA_RECT& aRect, bool aContained = true, int aAccuracy = 0 ) const override;
406 
416 
423  bool UnFill();
424 
425  /* Geometric transformations: */
426 
432  void Move( const wxPoint& offset ) override;
433 
440  void MoveEdge( const wxPoint& offset, int aEdge );
441 
448  void Rotate( const wxPoint& centre, double angle ) override;
449 
456  virtual void Flip( const wxPoint& aCentre ) override;
457 
464  void Mirror( const wxPoint& mirror_ref );
465 
471  wxString GetClass() const override
472  {
473  return wxT( "ZONE_CONTAINER" );
474  }
475 
480  int GetNumCorners( void ) const
481  {
482  return m_Poly->TotalVertices();
483  }
484 
491  {
492  return m_Poly->Iterate();
493  }
494 
501  {
502  return m_Poly->IterateWithHoles();
503  }
504 
511  {
512  return m_Poly->CIterateWithHoles();
513  }
514 
515  void RemoveAllContours( void )
516  {
518  }
519 
520  const VECTOR2I& GetCornerPosition( int aCornerIndex ) const
521  {
523 
524  // Convert global to relative indices
525  if( !m_Poly->GetRelativeIndices( aCornerIndex, &index ) )
526  throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
527 
528  return m_Poly->CVertex( index );
529  }
530 
531  void SetCornerPosition( int aCornerIndex, wxPoint new_pos )
532  {
533  SHAPE_POLY_SET::VERTEX_INDEX relativeIndices;
534 
535  // Convert global to relative indices
536  if( m_Poly->GetRelativeIndices( aCornerIndex, &relativeIndices ) )
537  {
538  m_Poly->Vertex( relativeIndices ).x = new_pos.x;
539  m_Poly->Vertex( relativeIndices ).y = new_pos.y;
540  }
541  else
542  throw( std::out_of_range( "aCornerIndex-th vertex does not exist" ) );
543  }
544 
549  void NewHole()
550  {
551  m_Poly->NewHole();
552  }
553 
562  bool AppendCorner( wxPoint aPosition, int aHoleIdx, bool aAllowDuplication = false );
563 
565  {
566  return m_hatchStyle;
567  }
568 
569  void SetHatchStyle( HATCH_STYLE aStyle )
570  {
571  m_hatchStyle = aStyle;
572  }
573 
581  bool IsSame( const ZONE_CONTAINER &aZoneToCompare );
582 
588  {
590  }
591 
598  //TODO - This should be called for each layer on which the zone exists
599 
601  {
602  return m_FilledPolysList;
603  }
604 
609  void AddFilledPolysList( SHAPE_POLY_SET& aPolysList )
610  {
611  m_FilledPolysList = aPolysList;
612  }
613 
621  {
622  if( m_smoothedPoly )
623  return m_smoothedPoly;
624  else
625  return m_Poly;
626  };
627 
628  void SetCornerSmoothingType( int aType ) { m_cornerSmoothingType = aType; };
629 
631 
632  void SetCornerRadius( unsigned int aRadius );
633 
634  unsigned int GetCornerRadius() const { return m_cornerRadius; };
635 
641  void AddPolygon( std::vector< wxPoint >& aPolygon );
642 
649  {
650  m_FilledPolysList.Append( aPolygon );
651  }
652 
653  void AddFillSegments( std::vector< SEGMENT >& aSegments )
654  {
655  m_FillSegmList.insert( m_FillSegmList.end(), aSegments.begin(), aSegments.end() );
656  }
657 
659  {
660  return m_RawPolysList;
661  }
662 
663  wxString GetSelectMenuText() const override;
664 
665  BITMAP_DEF GetMenuImage() const override;
666 
667  EDA_ITEM* Clone() const override;
668 
672  bool GetIsKeepout() const { return m_isKeepout; }
674  bool GetDoNotAllowVias() const { return m_doNotAllowVias; }
675  bool GetDoNotAllowTracks() const { return m_doNotAllowTracks; }
676 
677  void SetIsKeepout( bool aEnable ) { m_isKeepout = aEnable; }
678  void SetDoNotAllowCopperPour( bool aEnable ) { m_doNotAllowCopperPour = aEnable; }
679  void SetDoNotAllowVias( bool aEnable ) { m_doNotAllowVias = aEnable; }
680  void SetDoNotAllowTracks( bool aEnable ) { m_doNotAllowTracks = aEnable; }
681 
690  int GetHatchPitch() const;
691 
696  static int GetDefaultHatchPitch();
697 
707  void SetHatch( int aHatchStyle, int aHatchPitch, bool aRebuildHatch );
708 
714  void SetHatchPitch( int aPitch );
715 
720  void UnHatch();
721 
727  void Hatch();
728 
729  const std::vector<SEG>& GetHatchLines() const { return m_HatchLines; }
730 
731 
732 #if defined(DEBUG)
733  virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
734 #endif
735 
736 
737 
738 private:
739  void buildFeatureHoleList( BOARD* aPcb, SHAPE_POLY_SET& aFeatures );
740 
742  SHAPE_POLY_SET* m_smoothedPoly; // Corner-smoothed version of m_Poly
744  unsigned int m_cornerRadius;
745 
747 
748  /* Priority: when a zone outline is inside and other zone, if its priority is higher
749  * the other zone priority, it will be created inside.
750  * if priorities are equal, a DRC error is set
751  */
752  unsigned m_priority;
753 
754  /* A zone outline can be a keepout zone.
755  * It will be never filled, and DRC should test for pads, tracks and vias
756  */
758 
759  /* For keepout zones only:
760  * what is not allowed inside the keepout ( pads, tracks and vias )
761  */
765 
769 
773 
776 
779 
782 
783 
786 
789 
792 
796  std::vector <SEGMENT> m_FillSegmList;
797 
798  /* set of filled polygons used to draw a zone as a filled area.
799  * from outlines (m_Poly) but unlike m_Poly these filled polygons have no hole
800  * (they are all in one piece) In very simple cases m_FilledPolysList is same
801  * as m_Poly. In less simple cases (when m_Poly has holes) m_FilledPolysList is
802  * a polygon equivalent to m_Poly, without holes but with extra outline segment
803  * connecting "holes" with external main outline. In complex cases an outline
804  * described by m_Poly can have many filled areas
805  */
808 
809  HATCH_STYLE m_hatchStyle; // hatch style, see enum above
810  int m_hatchPitch; // for DIAGONAL_EDGE, distance between 2 hatch lines
811  std::vector<SEG> m_HatchLines; // hatch lines
812 
836  typedef union {
840 
841  // Sanity check: assure that the conversion VECTOR2I->wxPoint using the previous union is
842  // correct, making sure that the access for x and y attributes is still safe.
843  static_assert(offsetof(wxPoint,x) == offsetof(VECTOR2I,x),
844  "wxPoint::x and VECTOR2I::x have different offsets");
845 
846  static_assert(offsetof(wxPoint,y) == offsetof(VECTOR2I,y),
847  "wxPoint::y and VECTOR2I::y have different offsets");
848 
849 };
850 
851 
852 #endif // CLASS_ZONE_H_
wxPoint m_End
Definition: class_zone.h:60
void SetDoNotAllowTracks(bool aEnable)
Definition: class_zone.h:680
void MoveEdge(const wxPoint &offset, int aEdge)
Function MoveEdge Move the outline Edge.
Definition: class_zone.cpp:921
int NewHole(int aOutline=-1)
Creates a new hole in a given outline
void SetCornerSmoothingType(int aType)
Definition: class_zone.h:628
void SetHatchPitch(int aPitch)
Function SetHatchPitch sets the hatch pitch parameter for the zone.
Class BOARD_CONNECTED_ITEM.
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:78
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:767
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:552
void GetMsgPanelInfo(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:820
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Returns the index-th vertex in a given hole outline within a given outline
int GetNumCorners(void) const
Access to m_Poly parameters.
Definition: class_zone.h:480
wxString GetSelectMenuText() const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
PNG memory record (file in memory).
Definition: bitmap_types.h:38
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:201
bool HitTestForEdge(const wxPoint &refPos, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
Function HitTestForEdge tests if the given wxPoint is near a segment defined by 2 corners...
Definition: class_zone.cpp:702
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: class_zone.cpp:151
int GetMinThickness() const
Definition: class_zone.h:224
bool GetDoNotAllowCopperPour() const
Definition: class_zone.h:673
bool m_doNotAllowTracks
Definition: class_zone.h:764
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox (virtual)
Definition: class_zone.cpp:525
int GetArcSegmentCount() const
Definition: class_zone.h:213
void SetCornerRadius(unsigned int aRadius)
Definition: class_zone.cpp:653
Classes BOARD_ITEM and BOARD_CONNECTED_ITEM.
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:788
bool BuildFilledSolidAreasPolygons(BOARD *aPcb, SHAPE_POLY_SET *aOutlineBuffer=NULL)
Build the filled solid areas polygons from zone outlines (stored in m_Poly) The solid areas can be mo...
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
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 IsFilled() const
Definition: class_zone.h:215
ZoneConnection
How pads are covered by copper in zone.
Definition: zones.h:55
CONST_ITERATOR CIterateWithHoles(int aOutline) const
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:182
int TotalVertices() const
Returns total number of vertices stored in the set.
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:262
Struct VERTEX_INDEX.
int GetCornerSmoothingType() const
Definition: class_zone.h:630
void SetArcSegmentCount(int aArcSegCount)
Definition: class_zone.h:212
void SetHatch(int aHatchStyle, int aHatchPitch, bool aRebuildHatch)
Function SetHatch sets all hatch parameters for the zone.
ITERATOR Iterate(int aFirst, int aLast, bool aIterateHoles=false)
Function Iterate returns an object to iterate through the points of the polygons between aFirst and a...
SHAPE_POLY_SET::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:510
void buildFeatureHoleList(BOARD *aPcb, SHAPE_POLY_SET &aFeatures)
int m_localFlgs
Variable used in polygon calculations.
Definition: class_zone.h:791
VECTOR2< int > VECTOR2I
Definition: vector2d.h:590
int GetThermalReliefCopperBridge(D_PAD *aPad=NULL) const
Definition: class_zone.cpp:644
void SetIsFilled(bool isFilled)
Definition: class_zone.h:216
void AddFilledPolysList(SHAPE_POLY_SET &aPolysList)
Function AddFilledPolysList sets the list of filled polygons.
Definition: class_zone.h:609
Class BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected an...
const VECTOR2I & GetCornerPosition(int aCornerIndex) const
Definition: class_zone.h:520
unsigned int GetCornerRadius() const
Definition: class_zone.h:634
void TransformOutlinesShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, int aMinClearanceValue, bool aUseNetClearance)
Function TransformOutlinesShapeWithClearanceToPolygon Convert the outlines shape to a polygon with no...
void SetOutline(SHAPE_POLY_SET *aOutline)
Definition: class_zone.h:265
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:787
const std::vector< SEG > & GetHatchLines() const
Definition: class_zone.h:729
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:679
SHAPE_POLY_SET m_RawPolysList
Definition: class_zone.h:807
void TransformSolidAreasShapesToPolygonSet(SHAPE_POLY_SET &aCornerBuffer, int aCircleToSegmentsCount, double aCorrectionFactor) const
Function TransformSolidAreasShapesToPolygonSet Convert solid areas full shapes to polygon set (the fu...
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:113
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:672
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:217
std::vector< SEGMENT > & FillSegments()
Definition: class_zone.h:259
SHAPE_POLY_SET * m_smoothedPoly
Definition: class_zone.h:742
void AddFillSegments(std::vector< SEGMENT > &aSegments)
Definition: class_zone.h:653
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:490
int m_ArcToSegmentsCount
The number of segments to convert a circle to a polygon.
Definition: class_zone.h:772
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:781
ZoneConnection GetPadConnection(D_PAD *aPad=NULL) const
std::vector< SEG > m_HatchLines
Definition: class_zone.h:811
ZoneConnection m_PadConnection
Definition: class_zone.h:766
void TestForCopperIslandAndRemoveInsulatedIslands(BOARD *aPcb)
Function TestForCopperIslandAndRemoveInsulatedIslands Remove insulated copper islands found in m_Fill...
ZONE_CONTAINER & operator=(const ZONE_CONTAINER &aOther)
Definition: class_zone.cpp:113
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:41
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:549
bool HitTestInsideZone(const wxPoint &aPosition) const
Function HitTest tests if a point is inside the zone area, i.e.
Definition: class_zone.h:282
bool m_IsFilled
True when a zone was filled, false after deleting the filled areas.
Definition: class_zone.h:775
int m_FillMode
How to fill areas: 0 => use filled polygons, 1 => fill with segments.
Definition: class_zone.h:785
virtual void Flip(const wxPoint &aCentre) override
Function Flip Flip this object, i.e.
Definition: class_zone.cpp:960
bool GetRelativeIndices(int aGlobalIdx, VERTEX_INDEX *aRelativeIndices) const
Function GetRelativeIndices.
SHAPE_POLY_SET * m_Poly
Outline of the zone.
Definition: class_zone.h:741
int GetThermalReliefGap(D_PAD *aPad=NULL) const
Definition: class_zone.cpp:635
ZONE_CONTAINER(BOARD *parent)
Definition: class_zone.cpp:53
unsigned m_priority
Definition: class_zone.h:752
void AddFilledPolygon(SHAPE_POLY_SET &aPolygon)
add a polygon to the zone filled areas list.
Definition: class_zone.h:648
void Rotate(const wxPoint &centre, double angle) override
Function Rotate Move the outlines.
Definition: class_zone.cpp:934
bool m_doNotAllowVias
Definition: class_zone.h:763
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Function SetLayer sets the layer this item is on.
Definition: class_zone.cpp:209
bool UnFill()
Function UnFill Removes the zone filling.
Definition: class_zone.cpp:157
int m_cornerSmoothingType
Definition: class_zone.h:743
SEGMENT(const wxPoint &aStart, const wxPoint &aEnd)
Definition: class_zone.h:64
const SHAPE_POLY_SET * Outline() const
Definition: class_zone.h:263
HATCH_STYLE
Zone hatch styles.
Definition: class_zone.h:85
void SetZoneClearance(int aZoneClearance)
Definition: class_zone.h:219
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
SHAPE_POLY_SET * GetSmoothedPoly() const
Function GetSmoothedPoly returns a pointer to the corner-smoothed version of m_Poly if it exists...
Definition: class_zone.h:620
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...
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:806
const SHAPE_POLY_SET & GetFilledPolysList() const
Function GetFilledPolysList returns a reference to the list of filled polygons.
Definition: class_zone.h:600
bool FillZoneAreasWithSegments()
Function FillZoneAreasWithSegments Fill sub areas in a zone with segments with m_ZoneMinThickness wid...
void SetSelectedCorner(int aCorner)
Definition: class_zone.h:236
unsigned int m_cornerRadius
Definition: class_zone.h:744
void SetThermalReliefCopperBridge(int aThermalReliefCopperBridge)
Definition: class_zone.h:206
void AddClearanceAreasPolygonsToPolysList_NG(BOARD *aPcb)
Function AddClearanceAreasPolygonsToPolysList Supports a min thickness area constraint.
void Move(const wxPoint &offset) override
Function Move Move the outlines.
Definition: class_zone.cpp:904
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:42
HATCH_STYLE m_hatchStyle
Definition: class_zone.h:809
const wxPoint & GetPosition() const override
Function GetPosition.
Definition: class_zone.cpp:170
void SetDoNotAllowCopperPour(bool aEnable)
Definition: class_zone.h:678
bool m_doNotAllowCopperPour
Definition: class_zone.h:762
wxString GetClass() const override
Function GetClass returns the class name.
Definition: class_zone.h:471
bool IsOnCopperLayer() const
Function IsOnCopperLayer.
Definition: class_zone.cpp:188
int m_ThermalReliefGap
Width of the copper bridge in thermal reliefs.
Definition: class_zone.h:778
bool GetDoNotAllowTracks() const
Definition: class_zone.h:675
int m_ZoneMinThickness
Minimum thickness value in filled areas.
Definition: class_zone.h:768
void SetCornerPosition(int aCornerIndex, wxPoint new_pos)
Definition: class_zone.h:531
Board layer functions and definitions.
int GetFillMode() const
Definition: class_zone.h:201
void UnHatch()
Function UnHatch clears the zone's hatch.
int GetLocalFlags() const
Definition: class_zone.h:256
bool GetDoNotAllowVias() const
Definition: class_zone.h:674
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:169
const std::vector< SEGMENT > & FillSegments() const
Definition: class_zone.h:260
Class ZONE_SETTINGS used to handle zones parameters in dialogs.
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:500
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:661
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.
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:814
Class EDA_RECT handles the component boundary box.
HATCH_STYLE GetHatchStyle() const
Definition: class_zone.h:564
void Hatch()
Function Hatch computes the hatch lines depending on the hatch parameters and stores it in the zone's...
void SetHatchStyle(HATCH_STYLE aStyle)
Definition: class_zone.h:569
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:165
void SetLocalFlags(int aFlags)
Definition: class_zone.h:257
int GetSelectedCorner() const
Definition: class_zone.h:227
Struct SEGMENT is a simple container used when filling areas with segments.
Definition: class_zone.h:57
void SetPosition(const wxPoint &aPos) override
Definition: class_zone.h:107
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 GetHatchPitch() const
Hatch related methods.
void AddClearanceAreasPolygonsToPolysList(BOARD *aPcb)
Function AddClearanceAreasPolygonsToPolysList Add non copper areas polygons (pads and tracks with cle...
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:976
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:677
void SetPadConnection(ZoneConnection aPadConnection)
Definition: class_zone.h:222
unsigned GetPriority() const
Function GetPriority.
Definition: class_zone.h:119
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
void SetFillMode(int aFillMode)
How to fill areas: 0 = use filled polygons, 1 => fill with segments.
Definition: class_zone.h:200
bool HitTestForCorner(const wxPoint &refPos, SHAPE_POLY_SET::VERTEX_INDEX &aCornerHit) const
Function HitTestForCorner tests if the given wxPoint is near a corner.
Definition: class_zone.cpp:686
void SetMinThickness(int aMinThickness)
Definition: class_zone.h:225
SHAPE_POLY_SET & RawPolysList()
Definition: class_zone.h:658
void SetThermalReliefGap(int aThermalReliefGap)
Definition: class_zone.h:203
wxPoint m_Start
Definition: class_zone.h:59
int GetZoneClearance() const
Definition: class_zone.h:218
Union to handle conversion between references to wxPoint and to VECTOR2I.
Definition: class_zone.h:836
SEGMENT()
Definition: class_zone.h:62
bool Contains(const VECTOR2I &aP, int aSubpolyIndex=-1) const
Returns true if a given subpolygon contains the point aP.
std::vector< SEGMENT > m_FillSegmList
Segments used to fill the zone (m_FillMode ==1 ), when fill zone by segment is used.
Definition: class_zone.h:796
void ClearFilledPolysList()
Function ClearFilledPolysList clears the list of filled polygons.
Definition: class_zone.h:587
void RemoveAllContours(void)
Definition: class_zone.h:515
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline) ...