KiCad PCB EDA Suite
pns_dragger.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 KiCad Developers, see AUTHORS.txt for contributors.
6  * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
7  *
8  * This program is free software: you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation, either version 3 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef __PNS_DRAGGER_H
23 #define __PNS_DRAGGER_H
24 
25 #include <memory>
26 #include <math/vector2d.h>
27 
28 #include "pns_node.h"
29 #include "pns_via.h"
30 #include "pns_line.h"
31 #include "pns_algo_base.h"
32 #include "pns_itemset.h"
33 #include "pns_layerset.h"
34 
35 
36 namespace PNS {
37 
38 class ROUTER;
39 class SHOVE;
40 class OPTIMIZER;
41 
47 class DRAGGER : public ALGO_BASE
48 {
49 public:
50  DRAGGER( ROUTER* aRouter );
51  ~DRAGGER();
52 
58  void SetWorld( NODE* aWorld );
59 
66  bool Start( const VECTOR2I& aP, ITEM* aStartItem );
67 
74  bool Drag( const VECTOR2I& aP );
75 
83  bool FixRoute();
84 
91  NODE* CurrentNode() const;
92 
98  const ITEM_SET Traces();
99 
101  virtual LOGGER* Logger() override;
102 
103  void SetMode( int aDragMode );
104 
105 private:
106 
107  const ITEM_SET findViaFanoutByHandle ( NODE *aNode, const VIA_HANDLE& handle );
108 
109  bool dragMarkObstacles( const VECTOR2I& aP );
110  bool dragShove(const VECTOR2I& aP );
111  bool startDragSegment( const VECTOR2D& aP, SEGMENT* aSeg );
112  bool startDragVia( VIA* aVia );
113  void dumbDragVia( const VIA_HANDLE& aHandle, NODE* aNode, const VECTOR2I& aP );
114 
117 
120  int m_mode;
122  //VIA* m_draggedVia;
123  //LINE m_lastValidDraggedLine;
124  std::unique_ptr<SHOVE> m_shove;
131 };
132 
133 }
134 
135 #endif
Class ITEM.
Definition: pns_item.h:53
ITEM_SET m_draggedItems
Definition: pns_dragger.h:129
void dumbDragVia(const VIA_HANDLE &aHandle, NODE *aNode, const VECTOR2I &aP)
virtual LOGGER * Logger() override
Returns the logger object, allowing to dump geometry to a file.
Class NODE.
Definition: pns_node.h:140
NODE * m_world
Definition: pns_dragger.h:118
PNS_MODE
Routing modes
DRAGGER(ROUTER *aRouter)
Definition: pns_dragger.cpp:28
std::unique_ptr< SHOVE > m_shove
Definition: pns_dragger.h:124
NODE * CurrentNode() const
Function CurrentNode()
Class ALGO_BASE.
Definition: pns_algo_base.h:39
bool m_dragStatus
Definition: pns_dragger.h:126
bool startDragSegment(const VECTOR2D &aP, SEGMENT *aSeg)
Definition: pns_dragger.cpp:52
VIA_HANDLE m_draggedVia
Definition: pns_dragger.h:116
LINE m_draggedLine
Definition: pns_dragger.h:121
bool startDragVia(VIA *aVia)
Definition: pns_dragger.cpp:92
bool Drag(const VECTOR2I &aP)
Function Drag()
void SetWorld(NODE *aWorld)
Function SetWorld()
Definition: pns_dragger.cpp:46
const ITEM_SET Traces()
Function Traces()
int m_draggedSegmentIndex
Definition: pns_dragger.h:125
bool FixRoute()
Function FixRoute()
Class DRAGGER.
Definition: pns_dragger.h:47
ITEM_SET m_origViaConnections
Definition: pns_dragger.h:128
bool Start(const VECTOR2I &aP, ITEM *aStartItem)
Function Start()
void SetMode(int aDragMode)
NODE * m_lastNode
Definition: pns_dragger.h:119
const ITEM_SET findViaFanoutByHandle(NODE *aNode, const VIA_HANDLE &handle)
bool dragShove(const VECTOR2I &aP)
PNS_MODE m_currentMode
Definition: pns_dragger.h:127
VIA_HANDLE m_initialVia
Definition: pns_dragger.h:115
bool dragMarkObstacles(const VECTOR2I &aP)
bool m_freeAngleMode
Definition: pns_dragger.h:130
Push and Shove diff pair dimensions (gap) settings dialog.