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 <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 );
43  ~ZONE_FILLER();
44 
45  void SetProgressReporter( PROGRESS_REPORTER* aReporter );
46  void InstallNewProgressReporter( wxWindow* aParent, const wxString& aTitle, int aNumPhases );
47  bool Fill( std::vector<ZONE*>& aZones, bool aCheck = false, wxWindow* aParent = nullptr );
48 
49  bool IsDebug() const { return m_debugZoneFiller; }
50 
51 private:
52 
53  void addKnockout( PAD* aPad, PCB_LAYER_ID aLayer, int aGap, SHAPE_POLY_SET& aHoles );
54 
55  void addKnockout( BOARD_ITEM* aItem, PCB_LAYER_ID aLayer, int aGap, bool aIgnoreLineWidth,
56  SHAPE_POLY_SET& aHoles );
57 
58  void knockoutThermalReliefs( const ZONE* aZone, PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aFill );
59 
60  void buildCopperItemClearances( const ZONE* aZone, PCB_LAYER_ID aLayer,
61  SHAPE_POLY_SET& aHoles );
62 
63  void subtractHigherPriorityZones( const ZONE* aZone, PCB_LAYER_ID aLayer,
64  SHAPE_POLY_SET& aRawFill );
65 
77  bool computeRawFilledArea( const ZONE* aZone, PCB_LAYER_ID aLayer, PCB_LAYER_ID aDebugLayer,
78  const SHAPE_POLY_SET& aSmoothedOutline,
79  const SHAPE_POLY_SET& aMaxExtents, SHAPE_POLY_SET& aRawPolys );
80 
85  void buildThermalSpokes( const ZONE* aZone, PCB_LAYER_ID aLayer,
86  std::deque<SHAPE_LINE_CHAIN>& aSpokes );
87 
102  bool fillSingleZone( ZONE* aZone, PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aRawPolys,
103  SHAPE_POLY_SET& aFinalPolys );
104 
112  bool addHatchFillTypeOnZone( const ZONE* aZone, PCB_LAYER_ID aLayer, PCB_LAYER_ID aDebugLayer,
113  SHAPE_POLY_SET& aRawPolys );
114 
116  SHAPE_POLY_SET m_boardOutline; // the board outlines, if exists
117  bool m_brdOutlinesValid; // true if m_boardOutline is well-formed
120 
121  std::unique_ptr<WX_PROGRESS_REPORTER> m_uniqueReporter;
122 
125 
127 };
128 
129 #endif
PROGRESS_REPORTER * m_progressReporter
Definition: zone_filler.h:119
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
Definition: board_item.h:86
BOARD * m_board
Definition: zone_filler.h:115
A progress reporter for use in multi-threaded environments.
COMMIT.
Definition: commit.h:71
ZONE_FILLER(BOARD *aBoard, COMMIT *aCommit)
Definition: zone_filler.cpp:54
std::unique_ptr< WX_PROGRESS_REPORTER > m_uniqueReporter
Definition: zone_filler.h:121
void InstallNewProgressReporter(wxWindow *aParent, const wxString &aTitle, int aNumPhases)
Definition: zone_filler.cpp:72
void buildCopperItemClearances(const ZONE *aZone, PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aHoles)
Removes clearance from the shape for copper items which share the zone's layer but are not connected ...
bool Fill(std::vector< ZONE * > &aZones, bool aCheck=false, wxWindow *aParent=nullptr)
Definition: zone_filler.cpp:87
PCB_LAYER_ID
A quick note on layer IDs:
Multi-thread safe progress reporter dialog, intended for use of tasks that paralleize reporting back ...
void SetProgressReporter(PROGRESS_REPORTER *aReporter)
Definition: zone_filler.cpp:80
COMMIT * m_commit
Definition: zone_filler.h:118
SHAPE_POLY_SET.
void addKnockout(PAD *aPad, PCB_LAYER_ID aLayer, int aGap, SHAPE_POLY_SET &aHoles)
Add a knockout for a pad.
bool addHatchFillTypeOnZone(const ZONE *aZone, PCB_LAYER_ID aLayer, PCB_LAYER_ID aDebugLayer, SHAPE_POLY_SET &aRawPolys)
for zones having the ZONE_FILL_MODE::ZONE_FILL_MODE::HATCH_PATTERN, create a grid pattern in filled a...
ZONE handles a list of polygons defining a copper zone.
Definition: zone.h:57
bool IsDebug() const
Definition: zone_filler.h:49
void knockoutThermalReliefs(const ZONE *aZone, PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aFill)
Removes thermal reliefs from the shape for any pads connected to the zone.
bool computeRawFilledArea(const ZONE *aZone, PCB_LAYER_ID aLayer, PCB_LAYER_ID aDebugLayer, const SHAPE_POLY_SET &aSmoothedOutline, const SHAPE_POLY_SET &aMaxExtents, SHAPE_POLY_SET &aRawPolys)
Function computeRawFilledArea Add non copper areas polygons (pads and tracks with clearance) to a fil...
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:186
SHAPE_LINE_CHAIN.
bool m_debugZoneFiller
Definition: zone_filler.h:126
void subtractHigherPriorityZones(const ZONE *aZone, PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aRawFill)
Removes the outlines of higher-proirity zones with the same net.
SHAPE_POLY_SET m_boardOutline
Definition: zone_filler.h:116
bool fillSingleZone(ZONE *aZone, PCB_LAYER_ID aLayer, 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...
bool m_brdOutlinesValid
Definition: zone_filler.h:117
Definition: pad.h:59
void buildThermalSpokes(const ZONE *aZone, PCB_LAYER_ID aLayer, std::deque< SHAPE_LINE_CHAIN > &aSpokes)
Function buildThermalSpokes Constructs a list of all thermal spokes for the given zone.
int m_worstClearance
Definition: zone_filler.h:124