Horizon
pns_component_dragger.h
1 /*
2  * KiRouter - a push-and-(sometimes-)shove PCB router
3  *
4  * Copyright (C) 2013-2020 CERN
5  * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
6  *
7  * This program is free software: you can redistribute it and/or modify it
8  * under the terms of the GNU General Public License as published by the
9  * Free Software Foundation, either version 3 of the License, or (at your
10  * option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef __PNS_COMPONENT_DRAGGER_H
22 #define __PNS_COMPONENT_DRAGGER_H
23 
24 #include <math/vector2d.h>
25 
26 #include "pns_drag_algo.h"
27 #include "layer_ids.h"
28 
29 namespace PNS
30 {
31 class ROUTER;
32 class OPTIMIZER;
33 
40 {
41 public:
42  COMPONENT_DRAGGER( ROUTER* aRouter );
44 
45 
52  bool Start( const VECTOR2I& aP, ITEM_SET& aPrimitives ) override;
53 
60  bool Drag( const VECTOR2I& aP ) override;
61 
69  bool FixRoute() override;
70 
77  NODE* CurrentNode() const override;
78 
85  const std::vector<int> CurrentNets() const override
86  {
87  return std::vector<int>();
88  }
89 
96  virtual int CurrentLayer() const override
97  {
98  return UNDEFINED_LAYER;
99  }
100 
106  const ITEM_SET Traces() override;
107 
108 private:
109  struct DRAGGED_CONNECTION
110  {
111  LINE origLine;
112  SOLID* attachedPad;
113  VECTOR2I p_orig, p_next;
114  VECTOR2I offset;
115  };
116 
117  std::set<SOLID*> m_solids; // Pads being dragged
118  std::set<ITEM*> m_fixedItems; // Items being moved along with pads
119  std::vector<DRAGGED_CONNECTION> m_conns; // Lines being dragged with pads
120 
121  bool m_dragStatus;
122  ITEM_SET m_draggedItems;
123  ITEM_SET m_initialDraggedItems;
124  NODE* m_currentNode;
125  VECTOR2I m_p0;
126 };
127 
128 }; // namespace PNS
129 
130 #endif
COMPONENT_DRAGGER.
Definition: pns_component_dragger.h:40
const ITEM_SET Traces() override
Function Traces()
Definition: pns_component_dragger.cpp:270
NODE * CurrentNode() const override
Function CurrentNode()
Definition: pns_component_dragger.cpp:264
const std::vector< int > CurrentNets() const override
Function CurrentNets()
Definition: pns_component_dragger.h:85
bool Start(const VECTOR2I &aP, ITEM_SET &aPrimitives) override
Function Start()
Definition: pns_component_dragger.cpp:48
bool FixRoute() override
Function FixRoute()
Definition: pns_component_dragger.cpp:247
virtual int CurrentLayer() const override
Function CurrentLayer()
Definition: pns_component_dragger.h:96
bool Drag(const VECTOR2I &aP) override
Function Drag()
Definition: pns_component_dragger.cpp:156
DRAG_ALGO.
Definition: pns_drag_algo.h:43
Definition: pns_itemset.h:37
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:148
Definition: pns_router.h:116
Definition: pns_solid.h:36