KiCad PCB EDA Suite
Loading...
Searching...
No Matches
multichannel_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) 2017-2021 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_MULTICHANNEL_TOOL_H
25#define TOOLS_MULTICHANNEL_TOOL_H
26
27#include <vector>
28#include <set>
29#include <unordered_map>
30#include <unordered_set>
31
32#include <tools/pcb_tool_base.h>
34
35#include <pad.h>
36#include <footprint.h>
37#include <reporter.h>
38
40{
41 INSIDE = 0,
43 CLIP
44};
45
47{
48 bool m_copyRouting = true;
49 bool m_copyPlacement = true;
50 bool m_groupItems = false;
53 bool m_keepOldRouting = false;
56};
57
58
59struct RULE_AREA;
60
62{
64 bool m_isOk;
66 wxString m_errorMsg;
68};
69
71{
72 ZONE* m_oldArea = nullptr;
74 std::set<FOOTPRINT*> m_raFootprints;
75 std::set<FOOTPRINT*> m_sheetComponents;
78 wxString m_sheetPath;
79 wxString m_sheetName;
80 wxString m_ruleName;
82};
83
84
86{
88 wxString m_sheetPath;
89 wxString m_sheetName;
90};
91
92
94{
99
100 std::vector<RULE_AREA> m_areas;
101 std::unordered_map<RULE_AREA*, RULE_AREA_COMPAT_DATA> m_compatMap;
102};
103
104
106{
107public:
110
112 int AutogenerateRuleAreas( const TOOL_EVENT& aEvent );
113 int RepeatLayout( const TOOL_EVENT& aEvent, ZONE* aRefZone );
114 void QuerySheets();
116 int CheckRACompatibility( ZONE *aRefZone );
117
118private:
119 void setTransitions() override;
120 int repeatLayout( const TOOL_EVENT& aEvent );
121
122 wxString stripComponentIndex( wxString aRef ) const;
123 bool identifyComponentsInRuleArea( ZONE* aRuleArea, std::set<FOOTPRINT*>& aComponents );
124 const SHAPE_LINE_CHAIN buildRAOutline( std::set<FOOTPRINT*>& aFootprints, int aMargin );
125 std::set<FOOTPRINT*> queryComponentsInSheet( wxString aSheetName );
126 RULE_AREA* findRAByName( const wxString& aName );
127 bool resolveConnectionTopology( RULE_AREA* aRefArea, RULE_AREA* aTargetArea,
128 RULE_AREA_COMPAT_DATA& aMatches );
129 bool copyRuleAreaContents( TMATCH::COMPONENT_MATCHES& aMatches, BOARD_COMMIT* aCommit, RULE_AREA* aRefArea,
130 RULE_AREA* aTargetArea, REPEAT_LAYOUT_OPTIONS aOpts, std::unordered_set<BOARD_ITEM*>& aAffectedItems,
131 std::unordered_set<BOARD_ITEM*>& aGroupableItems );
132 int findRoutedConnections( std::set<BOARD_ITEM*>& aOutput,
133 std::shared_ptr<CONNECTIVITY_DATA> aConnectivity,
134 const SHAPE_POLY_SET& aRAPoly, RULE_AREA* aRA, FOOTPRINT* aFp,
135 const REPEAT_LAYOUT_OPTIONS& aOpts ) const;
136
137 bool pruneExistingGroups( COMMIT& aCommit, const std::unordered_set<BOARD_ITEM*>& aItemsToCheck );
138
139 std::unique_ptr<REPORTER> m_reporter;
141};
142
143
144#endif // TOOLS_MULTICHANNEL_TOOL
Represent a set of changes (additions, deletions or modifications) of a data model (e....
Definition: commit.h:74
int CheckRACompatibility(ZONE *aRefZone)
std::unique_ptr< REPORTER > m_reporter
int findRoutedConnections(std::set< BOARD_ITEM * > &aOutput, std::shared_ptr< CONNECTIVITY_DATA > aConnectivity, const SHAPE_POLY_SET &aRAPoly, RULE_AREA *aRA, FOOTPRINT *aFp, const REPEAT_LAYOUT_OPTIONS &aOpts) const
int repeatLayout(const TOOL_EVENT &aEvent)
void setTransitions() override
This method is meant to be overridden in order to specify handlers for events.
const SHAPE_LINE_CHAIN buildRAOutline(std::set< FOOTPRINT * > &aFootprints, int aMargin)
RULE_AREAS_DATA * GetData()
bool resolveConnectionTopology(RULE_AREA *aRefArea, RULE_AREA *aTargetArea, RULE_AREA_COMPAT_DATA &aMatches)
RULE_AREAS_DATA m_areas
bool pruneExistingGroups(COMMIT &aCommit, const std::unordered_set< BOARD_ITEM * > &aItemsToCheck)
std::set< FOOTPRINT * > queryComponentsInSheet(wxString aSheetName)
int RepeatLayout(const TOOL_EVENT &aEvent, ZONE *aRefZone)
int AutogenerateRuleAreas(const TOOL_EVENT &aEvent)
bool identifyComponentsInRuleArea(ZONE *aRuleArea, std::set< FOOTPRINT * > &aComponents)
wxString stripComponentIndex(wxString aRef) const
RULE_AREA * findRAByName(const wxString &aName)
bool copyRuleAreaContents(TMATCH::COMPONENT_MATCHES &aMatches, BOARD_COMMIT *aCommit, RULE_AREA *aRefArea, RULE_AREA *aTargetArea, REPEAT_LAYOUT_OPTIONS aOpts, std::unordered_set< BOARD_ITEM * > &aAffectedItems, std::unordered_set< BOARD_ITEM * > &aGroupableItems)
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Represent a set of closed polygons.
Generic, UI-independent tool event.
Definition: tool_event.h:167
Handle a list of polygons defining a copper zone.
Definition: zone.h:73
REPEAT_LAYOUT_EDGE_MODE
std::map< FOOTPRINT *, FOOTPRINT * > COMPONENT_MATCHES
Definition: topo_match.h:148
wxString m_sheetName
wxString m_sheetPath
bool m_generateEnabled
REPEAT_LAYOUT_EDGE_MODE m_edgeMode
std::unordered_map< RULE_AREA *, RULE_AREA_COMPAT_DATA > m_compatMap
RULE_AREA * m_refRA
REPEAT_LAYOUT_OPTIONS m_options
std::vector< RULE_AREA > m_areas
TMATCH::COMPONENT_MATCHES m_matchingComponents
VECTOR2I m_center
wxString m_sheetName
std::set< FOOTPRINT * > m_sheetComponents
bool m_existsAlready
std::set< FOOTPRINT * > m_raFootprints
ZONE * m_oldArea
wxString m_ruleName
wxString m_sheetPath
bool m_generateEnabled