KiCad PCB EDA Suite
zone_filler.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) 2014-2017 CERN
5  * Copyright (C) 2014-2017 KiCad Developers, see AUTHORS.txt for contributors.
6  * @author Tomasz W┼éostowski <tomasz.wlostowski@cern.ch>
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
26 #ifndef __ZONE_FILLER_H
27 #define __ZONE_FILLER_H
28 
29 #include <vector>
30 #include <class_zone.h>
31 
33 class BOARD;
34 class COMMIT;
35 class SHAPE_POLY_SET;
36 class SHAPE_LINE_CHAIN;
37 
38 
40 {
41 public:
42  ZONE_FILLER( BOARD* aBoard, COMMIT* aCommit = nullptr );
43  ~ZONE_FILLER();
44 
45  void InstallNewProgressReporter( wxWindow* aParent, const wxString& aTitle, int aNumPhases );
46  bool Fill( const std::vector<ZONE_CONTAINER*>& aZones, bool aCheck = false );
47 
48 private:
49 
50  void addKnockout( D_PAD* aPad, int aGap, SHAPE_POLY_SET& aHoles );
51 
52  void addKnockout( BOARD_ITEM* aItem, int aGap, bool aIgnoreLineWidth, SHAPE_POLY_SET& aHoles );
53 
54  void knockoutThermalReliefs( const ZONE_CONTAINER* aZone, SHAPE_POLY_SET& aFill );
55 
56  void buildCopperItemClearances( const ZONE_CONTAINER* aZone, SHAPE_POLY_SET& aHoles );
57 
69  void computeRawFilledArea( const ZONE_CONTAINER* aZone,
70  const SHAPE_POLY_SET& aSmoothedOutline,
71  std::set<VECTOR2I>* aPreserveCorners,
72  SHAPE_POLY_SET& aRawPolys, SHAPE_POLY_SET& aFinalPolys );
73 
78  void buildThermalSpokes( const ZONE_CONTAINER* aZone, std::deque<SHAPE_LINE_CHAIN>& aSpokes );
79 
94  bool fillSingleZone( ZONE_CONTAINER* aZone, SHAPE_POLY_SET& aRawPolys,
95  SHAPE_POLY_SET& aFinalPolys );
96 
104  void addHatchFillTypeOnZone( const ZONE_CONTAINER* aZone, SHAPE_POLY_SET& aRawPolys );
105 
107  SHAPE_POLY_SET m_boardOutline; // The board outlines, if exists
108  bool m_brdOutlinesValid; // true if m_boardOutline can be calculated
109  // false if not (not closed outlines for instance)
112  std::unique_ptr<WX_PROGRESS_REPORTER> m_uniqueReporter;
113 
114  // m_high_def can be used to define a high definition arc to polygon approximation
116 
117  // m_low_def can be used to define a low definition arc to polygon approximation
118  // Used when converting some pad shapes that can accept lower resolution, vias and track ends.
119  // Rect pads use m_low_def to reduce the number of segments. For these shapes a low def
120  // gives a good shape, because the arc is small (90 degrees) and a small part of the shape.
122 };
123 
124 #endif
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
BOARD * m_board
Definition: zone_filler.h:106
void addKnockout(D_PAD *aPad, int aGap, SHAPE_POLY_SET &aHoles)
Add a knockout for a pad.
WX_PROGRESS_REPORTER * m_progressReporter
Definition: zone_filler.h:111
void computeRawFilledArea(const ZONE_CONTAINER *aZone, const SHAPE_POLY_SET &aSmoothedOutline, std::set< VECTOR2I > *aPreserveCorners, SHAPE_POLY_SET &aRawPolys, SHAPE_POLY_SET &aFinalPolys)
Function computeRawFilledArea Add non copper areas polygons (pads and tracks with clearance) to a fil...
void buildCopperItemClearances(const ZONE_CONTAINER *aZone, SHAPE_POLY_SET &aHoles)
Removes clearance from the shape for copper items which share the zone's layer but are not connected ...
Class COMMIT.
Definition: commit.h:71
std::unique_ptr< WX_PROGRESS_REPORTER > m_uniqueReporter
Definition: zone_filler.h:112
void InstallNewProgressReporter(wxWindow *aParent, const wxString &aTitle, int aNumPhases)
Definition: zone_filler.cpp:95
COMMIT * m_commit
Definition: zone_filler.h:110
Class SHAPE_POLY_SET.
ZONE_FILLER(BOARD *aBoard, COMMIT *aCommit=nullptr)
Definition: zone_filler.cpp:83
bool Fill(const std::vector< ZONE_CONTAINER * > &aZones, bool aCheck=false)
void knockoutThermalReliefs(const ZONE_CONTAINER *aZone, SHAPE_POLY_SET &aFill)
Removes thermal reliefs from the shape for any pads connected to the zone.
void addHatchFillTypeOnZone(const ZONE_CONTAINER *aZone, SHAPE_POLY_SET &aRawPolys)
for zones having the ZONE_FILL_MODE::ZFM_HATCH_PATTERN, create a grid pattern in filled areas of aZon...
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:161
Class SHAPE_LINE_CHAIN.
SHAPE_POLY_SET m_boardOutline
Definition: zone_filler.h:107
bool m_brdOutlinesValid
Definition: zone_filler.h:108
void buildThermalSpokes(const ZONE_CONTAINER *aZone, std::deque< SHAPE_LINE_CHAIN > &aSpokes)
Function buildThermalSpokes Constructs a list of all thermal spokes for the given zone.
bool fillSingleZone(ZONE_CONTAINER *aZone, SHAPE_POLY_SET &aRawPolys, SHAPE_POLY_SET &aFinalPolys)
Build the filled solid areas polygons from zone outlines (stored in m_Poly) The solid areas can be mo...