KiCad PCB EDA Suite
Loading...
Searching...
No Matches
zone_filler_tool.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 CERN
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * @author Maciej Suminski <[email protected]>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
23#ifndef ZONE_FILLER_TOOL_H
24#define ZONE_FILLER_TOOL_H
25
26#include <tools/pcb_tool_base.h>
27#include <zone.h>
28
29
30class PCB_EDIT_FRAME;
33class ZONE_FILLER;
34class PCB_GENERATOR;
35class BOARD_COMMIT;
36
37#define ZONE_FILLER_TOOL_NAME "pcbnew.ZoneFiller"
38
43{
44public:
47
49 void Reset( RESET_REASON aReason ) override;
50
51 void CheckAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aReporter = nullptr );
52 void FillAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aReporter = nullptr, bool aHeadless = false );
53
62 void PostFillRefresh( bool aHeadless = false );
63
64 int ZoneFill( const TOOL_EVENT& aEvent );
65 int ZoneFillAll( const TOOL_EVENT& aEvent );
66 int ZoneFillDirty( const TOOL_EVENT& aEvent );
67 int ZoneUnfill( const TOOL_EVENT& aEvent );
68 int ZoneUnfillAll( const TOOL_EVENT& aEvent );
69
70 bool IsBusy() { return m_fillInProgress; }
71
73
74 void DirtyZone( ZONE* aZone )
75 {
76 m_dirtyZoneIDs.insert( aZone->m_Uuid );
77 }
78
79 static bool IsZoneFillAction( const TOOL_EVENT* aEvent );
80
81private:
83 void singleShotRefocus( wxIdleEvent& );
84
85 void rebuildConnectivity( bool aHeadless = false );
86 void refresh();
87
91 std::vector<PCB_GENERATOR*> regenerateDirtyGenerators( BOARD_COMMIT& aCommit );
92
96 void refillAroundGenerators( const std::vector<PCB_GENERATOR*>& aRegenerated );
97
99 void setTransitions() override;
100
101private:
102 std::unique_ptr<ZONE_FILLER> m_filler;
104
105 std::set<KIID> m_dirtyZoneIDs;
106};
107
108#endif
const KIID m_Uuid
Definition eda_item.h:597
The main frame for Pcbnew.
PCB_TOOL_BASE(TOOL_ID aId, const std::string &aName)
Constructor.
A progress reporter interface for use in multi-threaded environments.
RESET_REASON
Determine the reason of reset for a tool.
Definition tool_base.h:74
Generic, UI-independent tool event.
Definition tool_event.h:167
Multi-thread safe progress reporter dialog, intended for use of tasks that parallel reporting back of...
void CheckAllZones(wxWindow *aCaller, PROGRESS_REPORTER *aReporter=nullptr)
static bool IsZoneFillAction(const TOOL_EVENT *aEvent)
void DirtyZone(ZONE *aZone)
int ZoneFill(const TOOL_EVENT &aEvent)
void FillAllZones(wxWindow *aCaller, PROGRESS_REPORTER *aReporter=nullptr, bool aHeadless=false)
void PostFillRefresh(bool aHeadless=false)
Run the shared post-fill refresh once a fill commit has been pushed with connectivity updates skipped...
std::unique_ptr< ZONE_FILLER > m_filler
PROGRESS_REPORTER * GetProgressReporter()
int ZoneUnfillAll(const TOOL_EVENT &aEvent)
void setTransitions() override
This method is meant to be overridden in order to specify handlers for events.
std::vector< PCB_GENERATOR * > regenerateDirtyGenerators(BOARD_COMMIT &aCommit)
Kicks all the generators as they may need to update after a zone fill update.
std::set< KIID > m_dirtyZoneIDs
int ZoneFillAll(const TOOL_EVENT &aEvent)
int ZoneFillDirty(const TOOL_EVENT &aEvent)
void singleShotRefocus(wxIdleEvent &)
< Refocus on an idle event (used after the Progress Reporter messes up the focus).
int ZoneUnfill(const TOOL_EVENT &aEvent)
void refillAroundGenerators(const std::vector< PCB_GENERATOR * > &aRegenerated)
Triggers refill of zones near the given generators.
void rebuildConnectivity(bool aHeadless=false)
Handle a list of polygons defining a copper zone.
Definition zone.h:70
void Reset() override