KiCad PCB EDA Suite
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 <tomasz.wlostowski@cern.ch>
7  * Author: Maciej Suminski <maciej.suminski@cern.ch>
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 
29 {
30 public:
31  ROUTER_TOOL();
32  ~ROUTER_TOOL();
33 
34  bool Init() override;
35  void Reset( RESET_REASON aReason ) override;
36 
37  int MainLoop( const TOOL_EVENT& aEvent );
38 
39  int InlineBreakTrack( const TOOL_EVENT& aEvent );
40  bool CanInlineDrag();
41  int InlineDrag( const TOOL_EVENT& aEvent );
42 
43  int SelectCopperLayerPair( const TOOL_EVENT& aEvent );
44  int DpDimensionsDialog( const TOOL_EVENT& aEvent );
45  int SettingsDialog( const TOOL_EVENT& aEvent );
46  int CustomTrackWidthDialog( const TOOL_EVENT& aEvent );
47 
48  void setTransitions() override;
49 
50  // A filter for narrowing a collection representing a simple corner
51  // or a non-fanout-via to a single TRACK item.
52  static void NeighboringSegmentFilter( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector );
53 
54 private:
55  void performRouting();
56  void performDragging( int aMode = PNS::DM_ANY );
57  void breakTrack();
58 
59  void handleCommonEvents( const TOOL_EVENT& evt );
60 
61  int getStartLayer( const PNS::ITEM* aItem );
62  void switchLayerOnViaPlacement();
63 
64  int onViaCommand( const TOOL_EVENT& aEvent );
65  int onTrackViaSizeChanged( const TOOL_EVENT& aEvent );
66 
67  bool prepareInteractive();
68  bool finishInteractive();
69 };
70 
71 #endif
Class ITEM.
Definition: pns_item.h:53
#define APIEXPORT
Macros which export functions from a DLL/DSO.
Definition: import_export.h:44
virtual void Reset(RESET_REASON aReason) override
Function Reset() Brings the tool to a known, initial state.
virtual void setTransitions() override
This method is meant to be overridden in order to specify handlers for events.
Class TOOL_EVENT.
Definition: tool_event.h:171
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:240
virtual bool Init() override
Function Init() Init() is called once upon a registration of the tool.
RESET_REASON
Determines the reason of reset for a tool
Definition: tool_base.h:79