Horizon
pns_dragger.h
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 <math/vector2d.h>
26 
27 #include "pns_node.h"
28 #include "pns_via.h"
29 #include "pns_line.h"
30 #include "pns_algo_base.h"
31 #include "pns_itemset.h"
32 
33 namespace PNS {
34 
35 class ROUTER;
36 class SHOVE;
37 class OPTIMIZER;
38 
44 class DRAGGER : public ALGO_BASE
45 {
46 public:
47  DRAGGER( ROUTER* aRouter );
48  ~DRAGGER();
49 
55  void SetWorld( NODE* aWorld );
56 
63  bool Start( const VECTOR2I& aP, ITEM* aStartItem );
64 
71  bool Drag( const VECTOR2I& aP );
72 
80  bool FixRoute();
81 
88  NODE* CurrentNode() const;
89 
95  const ITEM_SET Traces();
96 
98  virtual LOGGER* Logger() override;
99 
100  void SetMode( int aDragMode );
101 
102 private:
103 
104 
105  bool dragMarkObstacles( const VECTOR2I& aP );
106  bool dragShove(const VECTOR2I& aP );
107  bool startDragSegment( const VECTOR2D& aP, SEGMENT* aSeg );
108  bool startDragVia( const VECTOR2D& aP, VIA* aVia );
109  void dumbDragVia( VIA* aVia, NODE* aNode, const VECTOR2I& aP );
110 
111  NODE* m_world;
112  NODE* m_lastNode;
113  int m_mode;
114  LINE m_draggedLine;
115  VIA* m_draggedVia;
116  LINE m_lastValidDraggedLine;
117  SHOVE* m_shove;
118  int m_draggedSegmentIndex;
119  bool m_dragStatus;
120  PNS_MODE m_currentMode;
121  ITEM_SET m_origViaConnections;
122  VIA* m_initialVia;
123  ITEM_SET m_draggedItems;
124  bool m_freeAngleMode;
125 };
126 
127 }
128 
129 #endif
PNS::LINE
Definition: pns_line.h:61
PNS::DRAGGER
Class DRAGGER.
Definition: pns_dragger.h:45
PNS::SEGMENT
Definition: pns_segment.h:39
PNS::ROUTER
Definition: pns_router.h:113
VECTOR2< int >
PNS::DRAGGER::SetWorld
void SetWorld(NODE *aWorld)
Function SetWorld()
Definition: pns_dragger.cpp:51
PNS::VIA
Definition: pns_via.h:38
PNS::DRAGGER::CurrentNode
NODE * CurrentNode() const
Function CurrentNode()
Definition: pns_dragger.cpp:359
PNS::LOGGER
Definition: pns_logger.h:40
PNS::ALGO_BASE
Class ALGO_BASE.
Definition: pns_algo_base.h:40
PNS::DRAGGER::Drag
bool Drag(const VECTOR2I &aP)
Function Drag()
Definition: pns_dragger.cpp:338
PNS::DRAGGER::FixRoute
bool FixRoute()
Function FixRoute()
Definition: pns_dragger.cpp:320
PNS::SHOVE
Class SHOVE.
Definition: pns_shove.h:47
PNS::DRAGGER::Traces
const ITEM_SET Traces()
Function Traces()
Definition: pns_dragger.cpp:365
PNS::DRAGGER::Logger
virtual LOGGER * Logger() override
Returns the logger object, allowing to dump geometry to a file.
Definition: pns_dragger.cpp:371
PNS::ITEM_SET
Definition: pns_itemset.h:40
PNS::ITEM
Class ITEM.
Definition: pns_item.h:55
PNS::NODE
Class NODE.
Definition: pns_node.h:138
PNS::DRAGGER::Start
bool Start(const VECTOR2I &aP, ITEM *aStartItem)
Function Start()
Definition: pns_dragger.cpp:127