KiCad PCB EDA Suite
Loading...
Searching...
No Matches
router_tool.h
Go to the documentation of this file.
1
/*
2
* KiRouter - a push-and-(sometimes-)shove PCB router
3
*
4
* Copyright (C) 2013-2017 CERN
5
* Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
6
* Author: Tomasz Wlostowski <
[email protected]
>
7
* Author: Maciej Suminski <
[email protected]
>
8
*
9
* This program is free software: you can redistribute it and/or modify it
10
* under the terms of the GNU General Public License as published by the
11
* Free Software Foundation, either version 3 of the License, or (at your
12
* option) any later version.
13
*
14
* This program is distributed in the hope that it will be useful, but
15
* WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
* General Public License for more details.
18
*
19
* You should have received a copy of the GNU General Public License along
20
* with this program. If not, see <http://www.gnu.org/licenses/>.
21
*/
22
23
#ifndef __ROUTER_TOOL_H
24
#define __ROUTER_TOOL_H
25
26
#include "
pns_tool_base.h
"
27
28
class
PCB_SELECTION_TOOL
;
29
30
class
ROUTER_TOOL
:
public
PNS::TOOL_BASE
31
{
32
public
:
33
ROUTER_TOOL
();
34
~ROUTER_TOOL
();
35
36
bool
Init
()
override
;
37
void
Reset
(
RESET_REASON
aReason )
override
;
38
39
int
MainLoop
(
const
TOOL_EVENT
& aEvent );
40
int
RouteSelected
(
const
TOOL_EVENT
& aEvent );
41
42
int
InlineBreakTrack
(
const
TOOL_EVENT
& aEvent );
43
bool
CanInlineDrag
(
int
aDragMode );
44
int
InlineDrag
(
const
TOOL_EVENT
& aEvent );
45
46
int
SelectCopperLayerPair
(
const
TOOL_EVENT
& aEvent );
47
int
DpDimensionsDialog
(
const
TOOL_EVENT
& aEvent );
48
int
SettingsDialog
(
const
TOOL_EVENT
& aEvent );
49
int
ChangeRouterMode
(
const
TOOL_EVENT
& aEvent );
50
int
CycleRouterMode
(
const
TOOL_EVENT
& aEvent );
51
int
CustomTrackWidthDialog
(
const
TOOL_EVENT
& aEvent );
52
53
PNS::PNS_MODE
GetRouterMode
();
54
61
bool
RoutingInProgress
();
62
63
void
setTransitions
()
override
;
64
65
// A filter for narrowing a collection representing a simple corner
66
// or a non-fanout-via to a single PCB_TRACK item.
67
static
void
NeighboringSegmentFilter
(
const
VECTOR2I
& aPt,
GENERAL_COLLECTOR
& aCollector,
68
PCB_SELECTION_TOOL
* aSelTool );
69
70
void
UpdateMessagePanel
();
71
72
private
:
73
void
performRouting
(
VECTOR2D
aStartPosition );
74
void
performDragging
(
int
aMode =
PNS::DM_ANY
);
75
void
breakTrack
();
76
void
restoreSelection
(
const
PCB_SELECTION
& aOriginalSelection );
77
78
void
handleCommonEvents
(
TOOL_EVENT
& evt );
79
int
handleLayerSwitch
(
const
TOOL_EVENT
& aEvent,
bool
aForceVia );
80
81
// Returns the board layer ID for the start layer of the router
82
PCB_LAYER_ID
getStartLayer
(
const
PNS::ITEM
* aItem );
83
84
void
switchLayerOnViaPlacement
();
85
void
updateSizesAfterRouterEvent
(
int
targetLayer,
const
VECTOR2I
& aPos );
86
87
int
onLayerCommand
(
const
TOOL_EVENT
& aEvent );
88
int
onViaCommand
(
const
TOOL_EVENT
& aEvent );
89
int
onTrackViaSizeChanged
(
const
TOOL_EVENT
& aEvent );
90
91
bool
prepareInteractive
(
VECTOR2D
aStartPosition );
92
bool
finishInteractive
();
93
void
saveRouterDebugLog
();
94
95
private
:
96
std::shared_ptr<ACTION_MENU>
m_diffPairMenu
;
97
std::shared_ptr<ACTION_MENU>
m_trackViaMenu
;
98
99
// Both of these are in board layer ID format and must be converted to PNS layer ID format
100
// when used with the PNS interface.
101
PCB_LAYER_ID
m_lastTargetLayer
;
102
PCB_LAYER_ID
m_originalActiveLayer
;
103
104
bool
m_inRouterTool
;
// Re-entrancy guard
105
};
106
107
#endif
GENERAL_COLLECTOR
Used when the right click button is pressed, or when the select tool is in effect.
Definition:
collectors.h:202
PCB_SELECTION_TOOL
The selection tool: currently supports:
Definition:
pcb_selection_tool.h:68
PCB_SELECTION
Definition:
pcb_selection.h:32
PNS::ITEM
Base class for PNS router board items.
Definition:
pns_item.h:97
PNS::TOOL_BASE
Definition:
pns_tool_base.h:45
ROUTER_TOOL
Definition:
router_tool.h:31
ROUTER_TOOL::~ROUTER_TOOL
~ROUTER_TOOL()
Definition:
router_tool.cpp:462
ROUTER_TOOL::onViaCommand
int onViaCommand(const TOOL_EVENT &aEvent)
Definition:
router_tool.cpp:851
ROUTER_TOOL::ROUTER_TOOL
ROUTER_TOOL()
Definition:
router_tool.cpp:207
ROUTER_TOOL::InlineDrag
int InlineDrag(const TOOL_EVENT &aEvent)
Definition:
router_tool.cpp:2103
ROUTER_TOOL::m_trackViaMenu
std::shared_ptr< ACTION_MENU > m_trackViaMenu
Definition:
router_tool.h:97
ROUTER_TOOL::setTransitions
void setTransitions() override
This method is meant to be overridden in order to specify handlers for events.
Definition:
router_tool.cpp:2788
ROUTER_TOOL::onTrackViaSizeChanged
int onTrackViaSizeChanged(const TOOL_EVENT &aEvent)
Definition:
router_tool.cpp:2625
ROUTER_TOOL::CustomTrackWidthDialog
int CustomTrackWidthDialog(const TOOL_EVENT &aEvent)
Definition:
router_tool.cpp:2607
ROUTER_TOOL::NeighboringSegmentFilter
static void NeighboringSegmentFilter(const VECTOR2I &aPt, GENERAL_COLLECTOR &aCollector, PCB_SELECTION_TOOL *aSelTool)
Definition:
router_tool.cpp:1992
ROUTER_TOOL::GetRouterMode
PNS::PNS_MODE GetRouterMode()
Definition:
router_tool.cpp:1533
ROUTER_TOOL::saveRouterDebugLog
void saveRouterDebugLog()
Definition:
router_tool.cpp:576
ROUTER_TOOL::performDragging
void performDragging(int aMode=PNS::DM_ANY)
Definition:
router_tool.cpp:1832
ROUTER_TOOL::m_originalActiveLayer
PCB_LAYER_ID m_originalActiveLayer
Definition:
router_tool.h:102
ROUTER_TOOL::onLayerCommand
int onLayerCommand(const TOOL_EVENT &aEvent)
Definition:
router_tool.cpp:842
ROUTER_TOOL::getStartLayer
PCB_LAYER_ID getStartLayer(const PNS::ITEM *aItem)
Definition:
router_tool.cpp:685
ROUTER_TOOL::CycleRouterMode
int CycleRouterMode(const TOOL_EVENT &aEvent)
Definition:
router_tool.cpp:1514
ROUTER_TOOL::updateSizesAfterRouterEvent
void updateSizesAfterRouterEvent(int targetLayer, const VECTOR2I &aPos)
Definition:
router_tool.cpp:726
ROUTER_TOOL::m_inRouterTool
bool m_inRouterTool
Definition:
router_tool.h:104
ROUTER_TOOL::handleLayerSwitch
int handleLayerSwitch(const TOOL_EVENT &aEvent, bool aForceVia)
Definition:
router_tool.cpp:871
ROUTER_TOOL::switchLayerOnViaPlacement
void switchLayerOnViaPlacement()
Definition:
router_tool.cpp:704
ROUTER_TOOL::RouteSelected
int RouteSelected(const TOOL_EVENT &aEvent)
Definition:
router_tool.cpp:1555
ROUTER_TOOL::finishInteractive
bool finishInteractive()
Definition:
router_tool.cpp:1235
ROUTER_TOOL::ChangeRouterMode
int ChangeRouterMode(const TOOL_EVENT &aEvent)
Definition:
router_tool.cpp:1502
ROUTER_TOOL::m_diffPairMenu
std::shared_ptr< ACTION_MENU > m_diffPairMenu
Definition:
router_tool.h:96
ROUTER_TOOL::m_lastTargetLayer
PCB_LAYER_ID m_lastTargetLayer
Definition:
router_tool.h:101
ROUTER_TOOL::handleCommonEvents
void handleCommonEvents(TOOL_EVENT &evt)
Definition:
router_tool.cpp:658
ROUTER_TOOL::performRouting
void performRouting(VECTOR2D aStartPosition)
Definition:
router_tool.cpp:1254
ROUTER_TOOL::Init
bool Init() override
Init() is called once upon a registration of the tool.
Definition:
router_tool.cpp:467
ROUTER_TOOL::InlineBreakTrack
int InlineBreakTrack(const TOOL_EVENT &aEvent)
Definition:
router_tool.cpp:2543
ROUTER_TOOL::prepareInteractive
bool prepareInteractive(VECTOR2D aStartPosition)
Definition:
router_tool.cpp:1160
ROUTER_TOOL::restoreSelection
void restoreSelection(const PCB_SELECTION &aOriginalSelection)
Definition:
router_tool.cpp:2095
ROUTER_TOOL::RoutingInProgress
bool RoutingInProgress()
Returns whether routing is currently active.
Definition:
router_tool.cpp:1539
ROUTER_TOOL::breakTrack
void breakTrack()
Definition:
router_tool.cpp:1545
ROUTER_TOOL::UpdateMessagePanel
void UpdateMessagePanel()
Definition:
router_tool.cpp:2646
ROUTER_TOOL::MainLoop
int MainLoop(const TOOL_EVENT &aEvent)
Definition:
router_tool.cpp:1687
ROUTER_TOOL::CanInlineDrag
bool CanInlineDrag(int aDragMode)
Definition:
router_tool.cpp:2065
ROUTER_TOOL::SettingsDialog
int SettingsDialog(const TOOL_EVENT &aEvent)
Definition:
router_tool.cpp:1490
ROUTER_TOOL::DpDimensionsDialog
int DpDimensionsDialog(const TOOL_EVENT &aEvent)
Definition:
router_tool.cpp:1470
ROUTER_TOOL::SelectCopperLayerPair
int SelectCopperLayerPair(const TOOL_EVENT &aEvent)
Definition:
sel_layer.cpp:748
TOOL_BASE::RESET_REASON
RESET_REASON
Determine the reason of reset for a tool.
Definition:
tool_base.h:78
TOOL_EVENT
Generic, UI-independent tool event.
Definition:
tool_event.h:167
VECTOR2< int32_t >
Reset
void Reset() override
PCB_LAYER_ID
PCB_LAYER_ID
A quick note on layer IDs:
Definition:
layer_ids.h:60
PNS::PNS_MODE
PNS_MODE
< Routing modes
Definition:
pns_routing_settings.h:40
PNS::DM_ANY
@ DM_ANY
Definition:
pns_router.h:77
pns_tool_base.h
src
pcbnew
router
router_tool.h
Generated on Thu Nov 21 2024 00:06:49 for KiCad PCB EDA Suite by
1.9.6