KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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-2024 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( bool aForceCommit ) override;
77
84 NODE* CurrentNode() const override;
85
91 const std::vector<NET_HANDLE> CurrentNets() const override;
92
98 int CurrentLayer() const override
99 {
100 return m_draggedLine.Layer();
101 }
102
104 {
105 return m_draggedLine;
106 }
107
109 {
110 return m_lastDragSolution;
111 }
112
118 const ITEM_SET Traces() override;
119
120 void SetMode( PNS::DRAG_MODE aDragMode ) override;
121
122 PNS::DRAG_MODE Mode() const override;
123
124 bool GetForceMarkObstaclesMode( bool* aDragStatus ) const override
125 {
126 *aDragStatus = m_dragStatus;
128 }
129
130private:
131 const ITEM_SET findViaFanoutByHandle ( NODE *aNode, const VIA_HANDLE& handle );
132
133 bool dragMarkObstacles( const VECTOR2I& aP );
134 bool dragShove(const VECTOR2I& aP );
135 bool dragWalkaround(const VECTOR2I& aP );
136 bool startDragSegment( const VECTOR2D& aP, SEGMENT* aSeg );
137 bool startDragArc( const VECTOR2D& aP, ARC* aArc );
138 bool startDragVia( VIA* aVia );
139 bool dragViaMarkObstacles( const VIA_HANDLE& aHandle, NODE* aNode, const VECTOR2I& aP );
140 bool dragViaWalkaround( const VIA_HANDLE& aHandle, NODE* aNode, const VECTOR2I& aP );
141 void optimizeAndUpdateDraggedLine( LINE& aDragged, const LINE& aOrig, const VECTOR2I& aP );
142 bool propagateViaForces( NODE* node, std::set<VIA*>& vias );
143 bool tryWalkaround( NODE* aNode, LINE& aOrig, LINE& aWalk );
144 VVIA* checkVirtualVia( const VECTOR2D& aP, SEGMENT* aSeg );
145
146
149
154 std::unique_ptr<SHOVE> m_shove;
160
163
168};
169
170}
171
172#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:162
PNS::DRAG_MODE Mode() const override
bool m_dragStatus
Definition: pns_dragger.h:156
void optimizeAndUpdateDraggedLine(LINE &aDragged, const LINE &aOrig, const VECTOR2I &aP)
ITEM_SET m_origViaConnections
Definition: pns_dragger.h:158
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:159
virtual bool Start(const VECTOR2I &aP, ITEM_SET &aPrimitives) override
Function Start()
NODE * CurrentNode() const override
Function CurrentNode()
bool dragViaMarkObstacles(const VIA_HANDLE &aHandle, NODE *aNode, const VECTOR2I &aP)
bool Drag(const VECTOR2I &aP) override
Function Drag()
const LINE & GetOriginalLine()
Definition: pns_dragger.h:103
bool startDragVia(VIA *aVia)
LINE m_lastDragSolution
Definition: pns_dragger.h:153
int m_draggedSegmentIndex
Definition: pns_dragger.h:155
const std::vector< NET_HANDLE > CurrentNets() const override
Function CurrentNets()
int CurrentLayer() const override
Function CurrentLayer()
Definition: pns_dragger.h:98
bool dragShove(const VECTOR2I &aP)
void SetMode(PNS::DRAG_MODE aDragMode) override
bool dragMarkObstacles(const VECTOR2I &aP)
bool FixRoute(bool aForceCommit) override
Function FixRoute()
std::unique_ptr< SHOVE > m_shove
Definition: pns_dragger.h:154
NODE * m_lastNode
Definition: pns_dragger.h:150
LINE m_draggedLine
Definition: pns_dragger.h:152
bool dragWalkaround(const VECTOR2I &aP)
const LINE & GetLastDragSolution()
Definition: pns_dragger.h:108
VVIA * checkVirtualVia(const VECTOR2D &aP, SEGMENT *aSeg)
Definition: pns_dragger.cpp:72
VIA_HANDLE m_draggedVia
Definition: pns_dragger.h:148
bool dragViaWalkaround(const VIA_HANDLE &aHandle, NODE *aNode, const VECTOR2I &aP)
bool GetForceMarkObstaclesMode(bool *aDragStatus) const override
Definition: pns_dragger.h:124
bool m_freeAngleMode
Definition: pns_dragger.h:165
bool m_forceMarkObstaclesMode
Definition: pns_dragger.h:166
PNS_MODE m_currentMode
Definition: pns_dragger.h:157
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:167
VIA_HANDLE m_initialVia
Definition: pns_dragger.h:147
bool propagateViaForces(NODE *node, std::set< VIA * > &vias)
Definition: pns_dragger.cpp:53
DRAG_ALGO.
Definition: pns_drag_algo.h:44
virtual int Layer() const
Definition: pns_item.h:199
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:207
Push and Shove diff pair dimensions (gap) settings dialog.
PNS_MODE
< Routing modes
DRAG_MODE
Definition: pns_router.h:71