1 /* 2 * KiRouter - a push-and-(sometimes-)shove PCB router 3 * 4 * Copyright (C) 2013-2014 CERN 5 * Copyright (C) 2016-2020 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 __PNS_TOOL_BASE_H 24 #define __PNS_TOOL_BASE_H 25 26 #include <memory> 27 #include <import_export.h> 28 29 #include <math/vector2d.h> 30 #include <tools/pcb_tool_base.h> 31 #include <board_commit.h> 32 33 #include <widgets/msgpanel.h> 34 35 #include "pns_router.h" 36 37 class PCB_GRID_HELPER; 38 39 class PNS_KICAD_IFACE; 40 class PNS_TUNE_STATUS_POPUP; 41 42 namespace PNS { 43 44 class APIEXPORT TOOL_BASE : public PCB_TOOL_BASE 45 { 46 public: 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 54 protected: 55 bool checkSnap( ITEM* aItem ); 56 57 const VECTOR2I snapToItem( ITEM* aSnapToItem, const VECTOR2I& aP); 58 59 virtual ITEM* pickSingleItem( const VECTOR2I& aWhere, int aNet = -1, int aLayer = -1, 60 bool aIgnorePads = false, 61 const std::vector<ITEM*> aAvoidItems = {} ); 62 63 virtual void highlightNet( bool aEnabled, int aNetcode = -1 ); 64 65 virtual void updateStartItem( const TOOL_EVENT& aEvent, bool aIgnorePads = false ); 66 virtual void updateEndItem( const TOOL_EVENT& aEvent ); 67 68 SIZES_SETTINGS m_savedSizes; // Stores sizes settings between router invocations 69 ITEM* m_startItem; 70 VECTOR2I m_startSnapPoint; 71 bool m_startHighlight; // Was net highlighted before routing? 72 73 ITEM* m_endItem; 74 VECTOR2I m_endSnapPoint; 75 76 PCB_GRID_HELPER* m_gridHelper; 77 PNS_KICAD_IFACE* m_iface; 78 ROUTER* m_router; 79 80 bool m_cancelled; 81 }; 82 83 } 84 85 #endif 86