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
33namespace PNS {
34
35class ROUTER;
36class SHOVE;
37class OPTIMIZER;
38
44class DRAGGER : public ALGO_BASE
45{
46public:
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
102private:
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
Class ALGO_BASE.
Definition: pns_algo_base.h:40
Class DRAGGER.
Definition: pns_dragger.h:45
bool FixRoute()
Function FixRoute()
Definition: pns_dragger.cpp:320
NODE * CurrentNode() const
Function CurrentNode()
Definition: pns_dragger.cpp:359
virtual LOGGER * Logger() override
‍Returns the logger object, allowing to dump geometry to a file.
Definition: pns_dragger.cpp:371
bool Start(const VECTOR2I &aP, ITEM *aStartItem)
Function Start()
Definition: pns_dragger.cpp:127
void SetWorld(NODE *aWorld)
Function SetWorld()
Definition: pns_dragger.cpp:51
bool Drag(const VECTOR2I &aP)
Function Drag()
Definition: pns_dragger.cpp:338
const ITEM_SET Traces()
Function Traces()
Definition: pns_dragger.cpp:365
Definition: pns_itemset.h:40
Class ITEM.
Definition: pns_item.h:55
Definition: pns_line.h:61
Definition: pns_logger.h:40
Class NODE.
Definition: pns_node.h:138
Definition: pns_router.h:113
Definition: pns_segment.h:39
Class SHOVE.
Definition: pns_shove.h:47
Definition: pns_via.h:38