KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_picker_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) 2015 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 PCB_PICKER_TOOL_H
24
#define PCB_PICKER_TOOL_H
25
26
#include <
layer_ids.h
>
27
#include <set>
28
#include <
snap/snap_resolver.h
>
29
#include <
tool/picker_tool.h
>
30
#include <
tools/pcb_selection_tool.h
>
31
#include <
tools/pcb_tool_base.h
>
32
36
class
PCB_PICKER_TOOL
:
public
PCB_TOOL_BASE
,
public
PICKER_TOOL_BASE
37
{
38
public
:
44
class
RECEIVER
45
{
46
public
:
47
virtual
void
UpdatePickedPoint
(
const
std::optional<VECTOR2I>& aPoint ) = 0;
48
virtual
void
UpdatePickedItem
(
const
EDA_ITEM
* aItem ) = 0;
49
50
protected
:
51
~RECEIVER
() =
default
;
52
};
53
54
struct
INTERACTIVE_PARAMS
55
{
56
RECEIVER
*
m_Receiver
=
nullptr
;
57
wxString
m_Prompt
;
58
std::function<bool(
EDA_ITEM
*)>
m_ItemFilter
=
nullptr
;
59
};
60
61
PCB_PICKER_TOOL
();
62
virtual
~PCB_PICKER_TOOL
() =
default
;
63
65
bool
Init
()
override
;
66
68
int
Main
(
const
TOOL_EVENT
& aEvent );
69
73
inline
void
SetLayerSet
(
const
LSET
& aLayerSet ) {
m_layerMask
= aLayerSet; }
74
75
int
SelectPointInteractively
(
const
TOOL_EVENT
& aEvent );
76
int
SelectItemInteractively
(
const
TOOL_EVENT
& aEvent );
77
84
inline
void
SetAreaPreviewHandler
(
PCB_SELECTION_TOOL::AREA_PREVIEW
aHandler )
85
{
86
m_areaPreviewHandler
= aHandler;
87
}
88
90
inline
void
SetConstructionGeometry
(
bool
aEnable ) {
m_constructionGeometry
= aEnable; }
91
94
inline
void
SetSuppressedSnaps
( std::set<SNAP_CANDIDATE_SUBTYPE> aSubtypes )
95
{
96
m_suppressedSnaps
= std::move( aSubtypes );
97
}
98
101
inline
void
ClearHandlers
()
102
{
103
m_areaPreviewHandler
=
nullptr
;
104
PICKER_TOOL_BASE::ClearHandlers
();
105
}
106
107
protected
:
109
void
setTransitions
()
override
;
110
112
void
setControls
();
113
115
void
reset
()
override
;
116
117
private
:
119
LSET
m_layerMask
;
120
121
PCB_SELECTION_TOOL::AREA_PREVIEW
m_areaPreviewHandler
;
122
123
bool
m_constructionGeometry
=
true
;
124
125
std::set<SNAP_CANDIDATE_SUBTYPE>
m_suppressedSnaps
;
126
};
127
128
#endif
/* PCB_PICKER_TOOL_H */
EDA_ITEM
A base class for most all the KiCad significant classes used in schematics and boards.
Definition
eda_item.h:98
LSET
LSET is a set of PCB_LAYER_IDs.
Definition
lset.h:37
PCB_PICKER_TOOL::RECEIVER
Interface class for something that receives picked points or items from this tool.
Definition
pcb_picker_tool.h:45
PCB_PICKER_TOOL::RECEIVER::UpdatePickedItem
virtual void UpdatePickedItem(const EDA_ITEM *aItem)=0
PCB_PICKER_TOOL::RECEIVER::~RECEIVER
~RECEIVER()=default
PCB_PICKER_TOOL::RECEIVER::UpdatePickedPoint
virtual void UpdatePickedPoint(const std::optional< VECTOR2I > &aPoint)=0
PCB_PICKER_TOOL::SelectItemInteractively
int SelectItemInteractively(const TOOL_EVENT &aEvent)
Definition
pcb_picker_tool.cpp:358
PCB_PICKER_TOOL::m_layerMask
LSET m_layerMask
< The layer set to use for optional snapping.
Definition
pcb_picker_tool.h:119
PCB_PICKER_TOOL::m_areaPreviewHandler
PCB_SELECTION_TOOL::AREA_PREVIEW m_areaPreviewHandler
Definition
pcb_picker_tool.h:121
PCB_PICKER_TOOL::Init
bool Init() override
Main event loop.
Definition
pcb_picker_tool.cpp:42
PCB_PICKER_TOOL::SelectPointInteractively
int SelectPointInteractively(const TOOL_EVENT &aEvent)
Definition
pcb_picker_tool.cpp:288
PCB_PICKER_TOOL::m_constructionGeometry
bool m_constructionGeometry
Definition
pcb_picker_tool.h:123
PCB_PICKER_TOOL::~PCB_PICKER_TOOL
virtual ~PCB_PICKER_TOOL()=default
Init() is called once upon a registration of the tool.
PCB_PICKER_TOOL::m_suppressedSnaps
std::set< SNAP_CANDIDATE_SUBTYPE > m_suppressedSnaps
Definition
pcb_picker_tool.h:125
PCB_PICKER_TOOL::PCB_PICKER_TOOL
PCB_PICKER_TOOL()
Definition
pcb_picker_tool.cpp:35
PCB_PICKER_TOOL::SetSuppressedSnaps
void SetSuppressedSnaps(std::set< SNAP_CANDIDATE_SUBTYPE > aSubtypes)
Snap kinds this run never wants.
Definition
pcb_picker_tool.h:94
PCB_PICKER_TOOL::SetAreaPreviewHandler
void SetAreaPreviewHandler(PCB_SELECTION_TOOL::AREA_PREVIEW aHandler)
Set a handler called with the drag box each time it changes, before anything is selected.
Definition
pcb_picker_tool.h:84
PCB_PICKER_TOOL::Main
int Main(const TOOL_EVENT &aEvent)
Definition
pcb_picker_tool.cpp:75
PCB_PICKER_TOOL::setControls
void setControls()
Reinitialize tool to its initial state.
Definition
pcb_picker_tool.cpp:279
PCB_PICKER_TOOL::reset
void reset() override
Reinitializes tool to its initial state.
Definition
pcb_picker_tool.cpp:269
PCB_PICKER_TOOL::SetLayerSet
void SetLayerSet(const LSET &aLayerSet)
Set the tool's snap layer set.
Definition
pcb_picker_tool.h:73
PCB_PICKER_TOOL::SetConstructionGeometry
void SetConstructionGeometry(bool aEnable)
Whether the snap system may draw its explanatory geometry over the board this run.
Definition
pcb_picker_tool.h:90
PCB_PICKER_TOOL::setTransitions
void setTransitions() override
<
Definition
pcb_picker_tool.cpp:435
PCB_PICKER_TOOL::ClearHandlers
void ClearHandlers()
Handlers only.
Definition
pcb_picker_tool.h:101
PCB_SELECTION_TOOL::AREA_PREVIEW
std::function< void(KIGFX::PREVIEW::SELECTION_AREA &aArea)> AREA_PREVIEW
Called with the drag box every time it changes, before anything is selected.
Definition
pcb_selection_tool.h:66
PCB_TOOL_BASE::PCB_TOOL_BASE
PCB_TOOL_BASE(TOOL_ID aId, const std::string &aName)
Constructor.
Definition
pcb_tool_base.h:74
PICKER_TOOL_BASE::ClearHandlers
void ClearHandlers()
Definition
picker_tool.h:67
PICKER_TOOL_BASE::PICKER_TOOL_BASE
PICKER_TOOL_BASE()
Definition
picker_tool.h:53
TOOL_EVENT
Generic, UI-independent tool event.
Definition
tool_event.h:167
layer_ids.h
pcb_selection_tool.h
pcb_tool_base.h
picker_tool.h
snap_resolver.h
PCB_PICKER_TOOL::INTERACTIVE_PARAMS
Definition
pcb_picker_tool.h:55
PCB_PICKER_TOOL::INTERACTIVE_PARAMS::m_Prompt
wxString m_Prompt
Definition
pcb_picker_tool.h:57
PCB_PICKER_TOOL::INTERACTIVE_PARAMS::m_Receiver
RECEIVER * m_Receiver
Definition
pcb_picker_tool.h:56
PCB_PICKER_TOOL::INTERACTIVE_PARAMS::m_ItemFilter
std::function< bool(EDA_ITEM *)> m_ItemFilter
Definition
pcb_picker_tool.h:58
src
pcbnew
tools
pcb_picker_tool.h
Generated on Thu Sep 17 2026 00:06:22 for KiCad PCB EDA Suite by
1.13.2