KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pns_tool_base.h
Go to the documentation of this file.
1/*
2 * KiRouter - a push-and-(sometimes-)shove PCB router
3 *
4 * Copyright (C) 2013-2014 CERN
5 * Copyright (C) 2016-2023 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 __PNS_TOOL_BASE_H
24#define __PNS_TOOL_BASE_H
25
26#include <memory>
27
28#include <math/vector2d.h>
29#include <tools/pcb_tool_base.h>
30#include <board_commit.h>
31
32#include <widgets/msgpanel.h>
33
34#include "pns_router.h"
35
36class PCB_GRID_HELPER;
37
38class PNS_KICAD_IFACE;
39class PNS_TUNE_STATUS_POPUP;
40
41namespace PNS
42{
43
45{
46public:
47 TOOL_BASE( const std::string& aToolName );
48 virtual ~TOOL_BASE();
49
50 virtual void Reset( RESET_REASON aReason ) override;
51
52 ROUTER* Router() const;
53
55
56protected:
57 bool checkSnap( ITEM* aItem );
58
59 const VECTOR2I snapToItem( ITEM* aSnapToItem, const VECTOR2I& aP);
60
61 virtual ITEM* pickSingleItem( const VECTOR2I& aWhere, NET_HANDLE aNet = nullptr,
62 int aLayer = -1, bool aIgnorePads = false,
63 const std::vector<ITEM*> aAvoidItems = {} );
64
65 virtual void highlightNets( bool aEnabled, std::set<NET_HANDLE> aNetcodes = {} );
66
67 virtual void updateStartItem( const TOOL_EVENT& aEvent, bool aIgnorePads = false );
68 virtual void updateEndItem( const TOOL_EVENT& aEvent );
69
70 SIZES_SETTINGS m_savedSizes; // Stores sizes settings between router invocations
73 std::set<int> m_startHighlightNetcodes; // The set of nets highlighted before routing
74
77
81
83
84 static const unsigned int COORDS_PADDING; // Padding from coordinates limits for this tool
85};
86
87}
88
89#endif
Base class for PNS router board items.
Definition: pns_item.h:97
bool checkSnap(ITEM *aItem)
virtual void updateStartItem(const TOOL_EVENT &aEvent, bool aIgnorePads=false)
ROUTER * Router() const
PNS_KICAD_IFACE * GetInterface() const
std::set< int > m_startHighlightNetcodes
Definition: pns_tool_base.h:73
const VECTOR2I snapToItem(ITEM *aSnapToItem, const VECTOR2I &aP)
virtual void highlightNets(bool aEnabled, std::set< NET_HANDLE > aNetcodes={})
virtual ~TOOL_BASE()
SIZES_SETTINGS m_savedSizes
Definition: pns_tool_base.h:70
PNS_KICAD_IFACE * m_iface
Definition: pns_tool_base.h:79
virtual ITEM * pickSingleItem(const VECTOR2I &aWhere, NET_HANDLE aNet=nullptr, int aLayer=-1, bool aIgnorePads=false, const std::vector< ITEM * > aAvoidItems={})
ITEM * m_startItem
Definition: pns_tool_base.h:71
virtual void updateEndItem(const TOOL_EVENT &aEvent)
static const unsigned int COORDS_PADDING
Definition: pns_tool_base.h:84
ROUTER * m_router
Definition: pns_tool_base.h:80
VECTOR2I m_endSnapPoint
Definition: pns_tool_base.h:76
PCB_GRID_HELPER * m_gridHelper
Definition: pns_tool_base.h:78
VECTOR2I m_startSnapPoint
Definition: pns_tool_base.h:72
RESET_REASON
Determine the reason of reset for a tool.
Definition: tool_base.h:78
Generic, UI-independent tool event.
Definition: tool_event.h:167
void Reset() override
Message panel definition file.
Push and Shove diff pair dimensions (gap) settings dialog.
void * NET_HANDLE
Definition: pns_item.h:54