Eclipse SUMO - Simulation of Urban MObility
GNEMoveElement.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // Class used for elements that own a movable shape
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
22 
23 #include "GNEGeometry.h"
24 
25 // ===========================================================================
26 // class declaration
27 // ===========================================================================
28 
29 class GNEMoveElement;
30 class GNEUndoList;
31 
32 // ===========================================================================
33 // class definitions
34 // ===========================================================================
35 
38 
39 public:
42  const Position originalPosition);
43 
47 
51  const std::vector<int> originalgeometryPoints,
53  const std::vector<int> geometryPointsToMove);
54 
57  const GNELane* lane,
58  const std::vector<double> originalPosOverLanes);
59 
62  const GNELane* lane,
63  const std::vector<double> originalPosOverLanes,
64  const std::vector<int> geometryPointsToMove);
65 
68 
71 
74 
76  const std::vector<int> originalGeometryPoints;
77 
82 
84  const std::vector<int> geometryPointsToMove;
85 
87  const GNELane* lane;
88 
90  const std::vector<double> originalPosOverLanes;
91 
92 private:
95 
98 };
99 
100 
103 
104 public:
106  GNEMoveResult();
107 
109  ~GNEMoveResult();
110 
113 
115  std::vector<int> geometryPointsToMove;
116 
117 private:
119  GNEMoveResult(const GNEMoveResult&) = delete;
120 };
121 
122 
125 
126 public:
128  GNEMoveElement();
129 
133  virtual GNEMoveOperation* getMoveOperation(const double shapeOffset) = 0;
134 
136  virtual void removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList) = 0;
137 
139  static void moveElement(const GNEViewNet* viewNet, GNEMoveOperation* moveOperation, const Position& offset);
140 
142  static void commitMove(const GNEViewNet* viewNet, GNEMoveOperation* moveOperation, const Position& offset, GNEUndoList* undoList);
143 
144 private:
146  virtual void setMoveShape(const GNEMoveResult& moveResult) = 0;
147 
149  virtual void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList) = 0;
150 
152  static const PositionVector calculateMovementOverLane(const GNEViewNet* viewNet, const GNEMoveOperation* moveOperation, const Position& offset);
153 
155  GNEMoveElement(const GNEMoveElement&) = delete;
156 
159 };
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
move element
virtual void setMoveShape(const GNEMoveResult &moveResult)=0
set move shape
static const PositionVector calculateMovementOverLane(const GNEViewNet *viewNet, const GNEMoveOperation *moveOperation, const Position &offset)
calculate movement over lane
virtual GNEMoveOperation * getMoveOperation(const double shapeOffset)=0
get move operation for the given shapeOffset
GNEMoveElement()
constructor
static void commitMove(const GNEViewNet *viewNet, GNEMoveOperation *moveOperation, const Position &offset, GNEUndoList *undoList)
commit move element for the given offset
virtual void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)=0
commit move shape
GNEMoveElement(const GNEMoveElement &)=delete
Invalidated copy constructor.
static void moveElement(const GNEViewNet *viewNet, GNEMoveOperation *moveOperation, const Position &offset)
move element the for given offset (note: offset can be X-Y-0, 0-0-Z or X-Y-Z)
GNEMoveElement & operator=(const GNEMoveElement &)=delete
Invalidated assignment operator.
virtual void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)=0
remove geometry point in the clicked position
move operation
const PositionVector originalShape
original shape
const std::vector< int > originalGeometryPoints
original shape points to move (of original shape)
GNEMoveOperation & operator=(const GNEMoveOperation &)=delete
Invalidated assignment operator.
const PositionVector shapeToMove
shape to move
const std::vector< double > originalPosOverLanes
original position over lanes
GNEMoveOperation(GNEMoveElement *moveElement, const Position originalPosition)
constructor for values with a single position (junctions, E3, ParkingSpaces...)
~GNEMoveOperation()
destructor
const GNELane * lane
original lane
GNEMoveOperation(const GNEMoveOperation &)=delete
Invalidated copy constructor.
const std::vector< int > geometryPointsToMove
shape points to move (of shapeToMove)
GNEMoveElement * moveElement
move element
move result
GNEMoveResult(const GNEMoveResult &)=delete
Invalidated copy constructor.
~GNEMoveResult()
destructor
GNEMoveResult()
constructor
std::vector< int > geometryPointsToMove
shape points to move (of shapeToMove)
PositionVector shapeToUpdate
shape to update (edited in moveElement)
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
A list of positions.