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 <[email protected]>
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_drag_algo.h"
32#include "pns_itemset.h"
33#include "pns_layerset.h"
35
36namespace PNS {
37
38class ROUTER;
39class SHOVE;
40class OPTIMIZER;
41
47class DRAGGER : public DRAG_ALGO
48{
49public:
50 DRAGGER( ROUTER* aRouter );
51 ~DRAGGER();
52
59 virtual bool Start( const VECTOR2I& aP, ITEM_SET& aPrimitives ) override;
60
67 bool Drag( const VECTOR2I& aP ) override;
68
76 bool FixRoute() override;
77
84 NODE* CurrentNode() const override;
85
91 const std::vector<int> CurrentNets() const override
92 {
93 return std::vector<int>( 1, m_draggedLine.Net() );
94 }
95
101 int CurrentLayer() const override
102 {
103 return m_draggedLine.Layer();
104 }
105
111 const ITEM_SET Traces() override;
112
113 void SetMode( int aDragMode ) override;
114
115private:
116 const ITEM_SET findViaFanoutByHandle ( NODE *aNode, const VIA_HANDLE& handle );
117
118 bool dragMarkObstacles( const VECTOR2I& aP );
119 bool dragShove(const VECTOR2I& aP );
120 bool dragWalkaround(const VECTOR2I& aP );
121 bool startDragSegment( const VECTOR2D& aP, SEGMENT* aSeg );
122 bool startDragArc( const VECTOR2D& aP, ARC* aArc );
123 bool startDragVia( VIA* aVia );
124 bool dragViaMarkObstacles( const VIA_HANDLE& aHandle, NODE* aNode, const VECTOR2I& aP );
125 bool dragViaWalkaround( const VIA_HANDLE& aHandle, NODE* aNode, const VECTOR2I& aP );
126 void optimizeAndUpdateDraggedLine( LINE& aDragged, const LINE& aOrig, const VECTOR2I& aP );
127 bool propagateViaForces( NODE* node, std::set<VIA*>& vias );
128 bool tryWalkaround( NODE* aNode, LINE& aOrig, LINE& aWalk );
129 VVIA* checkVirtualVia( const VECTOR2D& aP, SEGMENT* aSeg );
130
131
134
139 std::unique_ptr<SHOVE> m_shove;
145
148
152};
153
154}
155
156#endif
DRAGGER.
Definition: pns_dragger.h:48
ITEM_SET m_draggedItems
If true, moves the connection lines without maintaining 45 degrees corners.
Definition: pns_dragger.h:147
bool m_dragStatus
Definition: pns_dragger.h:141
void optimizeAndUpdateDraggedLine(LINE &aDragged, const LINE &aOrig, const VECTOR2I &aP)
ITEM_SET m_origViaConnections
Definition: pns_dragger.h:143
const ITEM_SET findViaFanoutByHandle(NODE *aNode, const VIA_HANDLE &handle)
bool startDragSegment(const VECTOR2D &aP, SEGMENT *aSeg)
VECTOR2D m_lastValidPoint
Contains the list of items that are currently modified by the dragger.
Definition: pns_dragger.h:144
virtual bool Start(const VECTOR2I &aP, ITEM_SET &aPrimitives) override
Function Start()
NODE * CurrentNode() const override
Function CurrentNode()
DRAGGER(ROUTER *aRouter)
Definition: pns_dragger.cpp:32
bool dragViaMarkObstacles(const VIA_HANDLE &aHandle, NODE *aNode, const VECTOR2I &aP)
bool Drag(const VECTOR2I &aP) override
Function Drag()
bool startDragVia(VIA *aVia)
LINE m_lastDragSolution
Definition: pns_dragger.h:138
int m_draggedSegmentIndex
Definition: pns_dragger.h:140
int CurrentLayer() const override
Function CurrentLayer()
Definition: pns_dragger.h:101
bool dragShove(const VECTOR2I &aP)
bool dragMarkObstacles(const VECTOR2I &aP)
std::unique_ptr< SHOVE > m_shove
Definition: pns_dragger.h:139
NODE * m_lastNode
Definition: pns_dragger.h:135
LINE m_draggedLine
Definition: pns_dragger.h:137
bool dragWalkaround(const VECTOR2I &aP)
bool FixRoute() override
Function FixRoute()
const std::vector< int > CurrentNets() const override
Function CurrentNets()
Definition: pns_dragger.h:91
VVIA * checkVirtualVia(const VECTOR2D &aP, SEGMENT *aSeg)
Definition: pns_dragger.cpp:71
VIA_HANDLE m_draggedVia
Definition: pns_dragger.h:133
bool dragViaWalkaround(const VIA_HANDLE &aHandle, NODE *aNode, const VECTOR2I &aP)
bool m_freeAngleMode
Definition: pns_dragger.h:150
PNS_MODE m_currentMode
Definition: pns_dragger.h:142
void SetMode(int aDragMode) override
const ITEM_SET Traces() override
Function Traces()
bool tryWalkaround(NODE *aNode, LINE &aOrig, LINE &aWalk)
bool startDragArc(const VECTOR2D &aP, ARC *aArc)
MOUSE_TRAIL_TRACER m_mouseTrailTracer
Definition: pns_dragger.h:151
VIA_HANDLE m_initialVia
Definition: pns_dragger.h:132
bool propagateViaForces(NODE *node, std::set< VIA * > &vias)
Definition: pns_dragger.cpp:52
DRAG_ALGO.
Definition: pns_drag_algo.h:43
virtual int Layer() const
Definition: pns_item.h:158
int Net() const
Definition: pns_item.h:152
Represents a track on a PCB, connecting two non-trivial joints (that is, vias, pads,...
Definition: pns_line.h:61
Keep the router "world" - i.e.
Definition: pns_node.h:150
Push and Shove diff pair dimensions (gap) settings dialog.
PNS_MODE
< Routing modes