KiCad PCB EDA Suite
zone_create_helper.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-2019 Kicad Developers, see AUTHORS.txt for contributors.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you may find one here:
18  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19  * or you may search the http://www.gnu.org website for the version 2 license,
20  * or you may write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22  */
23 
24 #ifndef TOOLS_ZONE_CREATE_HELPER__H_
25 #define TOOLS_ZONE_CREATE_HELPER__H_
26 
29 
30 #include <tools/drawing_tool.h>
31 
32 namespace KIGFX
33 {
34 class VIEW;
35 }
36 
43 {
44 public:
45 
49  struct PARAMS
50  {
52  bool m_keepout;
53 
56 
59 
62 
65  };
66 
71  ZONE_CREATE_HELPER( DRAWING_TOOL& aTool, PARAMS& aParams );
72 
73  virtual ~ZONE_CREATE_HELPER();
74 
75  ZONE* GetZone() const { return m_zone.get(); }
76 
77  /*
78  * Interface for receiving POLYGON_GEOM_MANAGER update
79  */
80 
81  void OnGeometryChange( const POLYGON_GEOM_MANAGER& aMgr ) override;
82 
83  bool OnFirstPoint( POLYGON_GEOM_MANAGER& aMgr ) override;
84 
85  void OnComplete( const POLYGON_GEOM_MANAGER& aMgr ) override;
86 
96  std::unique_ptr<ZONE> createNewZone( bool aKeepout );
97 
106  std::unique_ptr<ZONE> createZoneFromExisting( const ZONE& aSrcZone );
107 
117  void performZoneCutout( ZONE& aZone, ZONE& aCutout );
118 
126  void commitZone( std::unique_ptr<ZONE> aZone );
127 
128 private:
129 
131 
134 
137 
140 
142  std::unique_ptr<ZONE> m_zone;
143 };
144 
145 #endif /* __DRAWING_TOOL_H */
void OnComplete(const POLYGON_GEOM_MANAGER &aMgr) override
Called when the polygon is complete
LEADER_MODE
The kind of the leader line.
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:175
ZONE * m_sourceZone
Zone settings source (for similar and cutout zones)
ZONE_CREATE_HELPER(DRAWING_TOOL &aTool, PARAMS &aParams)
void performZoneCutout(ZONE &aZone, ZONE &aCutout)
Function performZoneCutout()
PCB_LAYER_ID m_layer
Layer to begin drawing
KIGFX::PREVIEW::POLYGON_ITEM m_previewItem
The preview item to display
Parameters used to fully describe a zone creation process.
PCB_LAYER_ID
A quick note on layer IDs:
"Listener" interface for a class that wants to be updated about polygon geometry changes
DRAWING_TOOL.
Definition: drawing_tool.h:50
KIGFX::VIEW & m_parentView
view that show the preview item
bool OnFirstPoint(POLYGON_GEOM_MANAGER &aMgr) override
Called before the first point is added - clients can do initialisation here, and can veto the start o...
void commitZone(std::unique_ptr< ZONE > aZone)
Commit the current zone-in-progress to the BOARD.
ZONE handles a list of polygons defining a copper zone.
Definition: zone.h:57
ZONE_MODE
Definition: pcb_actions.h:36
PARAMS & m_params
Parameters of the zone to be drawn
void OnGeometryChange(const POLYGON_GEOM_MANAGER &aMgr) override
Sent when the polygon geometry changes
std::unique_ptr< ZONE > createZoneFromExisting(const ZONE &aSrcZone)
Function createZoneFromExisting.
std::unique_ptr< ZONE > m_zone
The zone-in-progress
This class is an adjuct helper to the DRAWING_TOOL interactive tool, which handles incoming geometry ...
ZONE * GetZone() const
std::unique_ptr< ZONE > createNewZone(bool aKeepout)
Function createNewZone()
VIEW.
Definition: view.h:63
POLYGON_GEOM_MANAGER::LEADER_MODE m_leaderMode
Zone leader mode
bool m_keepout
Should create a keepout zone?
Class that handles the drawing of a polygon, including management of last corner deletion and drawing...
ZONE_MODE m_mode
The zone mode to operate in