Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEMoveElement.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 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
24
25// ===========================================================================
26// class declaration
27// ===========================================================================
28
29class GNELane;
30class GNEMoveElement;
31class GNEUndoList;
32class GNEViewNet;
33class GUIGlObject;
34
35// ===========================================================================
36// class definitions
37// ===========================================================================
38
41
42public:
59
62 const Position originalPosition);
63
67
71 const bool firstGeometryPoint,
73
77 const std::vector<int> originalgeometryPoints,
79 const std::vector<int> geometryPointsToMove);
80
83 const GNELane* lane,
84 const double firstPosition,
85 const bool allowChangeLane);
86
89 const GNELane* lane,
90 const double firstPosition,
91 const double lastPosition,
92 const bool allowChangeLane,
94
97 const GNELane* firstLane,
98 const double firstStartPos,
99 const GNELane* lastLane,
100 const double lastStartPos,
101 const bool allowChangeLane,
103
106
109
112
114 const std::vector<int> originalGeometryPoints;
115
117 const GNELane* firstLane = nullptr;
118
121
123 const GNELane* lastLane = nullptr;
124
127
132
134 const std::vector<int> geometryPointsToMove;
135
137 const bool allowChangeLane;
138
141
144
145private:
148
151};
152
155
156public:
159
161 GNEMoveOffset(const double x, const double y);
162
164 GNEMoveOffset(const double z);
165
168
170 const double x;
171
173 const double y;
174
176 const double z;
177};
178
181
182public:
184 GNEMoveResult(const GNEMoveOperation* moveOperation);
185
188
190 void clearLanes();
191
194
196 std::vector<int> geometryPointsToMove;
197
200
203
206
209
212
215
218
219private:
221 GNEMoveResult(const GNEMoveResult&) = delete;
222};
223
224
227
228public:
231
233 virtual ~GNEMoveElement() {}
234
239
241 virtual void removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList) = 0;
242
244 static void moveElement(const GNEViewNet* viewNet, GNEMoveOperation* moveOperation, const GNEMoveOffset& offset);
245
247 static void commitMove(const GNEViewNet* viewNet, GNEMoveOperation* moveOperation, const GNEMoveOffset& offset, GNEUndoList* undoList);
248
249protected:
252
254 GNEMoveOperation* calculateMoveShapeOperation(const GUIGlObject* obj, const PositionVector originalShape, const bool maintainShapeClosed);
255
256private:
258 virtual void setMoveShape(const GNEMoveResult& moveResult) = 0;
259
261 virtual void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList) = 0;
262
264 static double calculateLaneOffset(const GNEViewNet* viewNet, const GNELane* lane, const double firstPosition, const double lastPosition,
265 const GNEMoveOffset& offset, const double extremFrom, const double extremTo);
266
268 static void calculateMoveResult(GNEMoveResult& moveResult, const GNEViewNet* viewNet, const GNELane* lane, const double pos,
269 const GNEMoveOffset& offset, const double extremFrom, const double extremTo);
270
272 static void calculateMoveResult(GNEMoveResult& moveResult, const GNEViewNet* viewNet, const GNELane* lane, const double firstPos,
273 const double lastPos, const GNEMoveOffset& offset);
274
276 static void calculateMoveResult(GNEMoveResult& moveResult, const GNEViewNet* viewNet, const GNELane* firstLane, const double firstPos,
277 const GNELane* lastLane, const double lastPos, const GNEMoveOffset& offset);
278
280 static void calculateNewLaneChange(const GNEViewNet* viewNet, const GNELane* originalLane, const GNELane*& newLane, double& laneOffset);
281
283 static PositionVector calculateExtrapolatedVector(const GNEMoveOperation* moveOperation, const GNEMoveResult& moveResult);
284
287
290};
const double INVALID_DOUBLE
invalid double
Definition StdDefs.h:64
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition GNELane.h:46
move element
static PositionVector calculateExtrapolatedVector(const GNEMoveOperation *moveOperation, const GNEMoveResult &moveResult)
calculate width/height shape
virtual void setMoveShape(const GNEMoveResult &moveResult)=0
set move shape
GNEMoveElement()
constructor
static void calculateMoveResult(GNEMoveResult &moveResult, const GNEViewNet *viewNet, const GNELane *lane, const double pos, const GNEMoveOffset &offset, const double extremFrom, const double extremTo)
calculate single movement over one lane
static void commitMove(const GNEViewNet *viewNet, GNEMoveOperation *moveOperation, const GNEMoveOffset &offset, GNEUndoList *undoList)
commit move element for the given offset
virtual void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)=0
commit move shape
GNEMoveElement & operator=(const GNEMoveElement &)=delete
Invalidated assignment operator.
virtual ~GNEMoveElement()
static void calculateNewLaneChange(const GNEViewNet *viewNet, const GNELane *originalLane, const GNELane *&newLane, double &laneOffset)
calculate new lane change
GNEMoveElement(const GNEMoveElement &)=delete
Invalidated copy constructor.
static double calculateLaneOffset(const GNEViewNet *viewNet, const GNELane *lane, const double firstPosition, const double lastPosition, const GNEMoveOffset &offset, const double extremFrom, const double extremTo)
calculate lane offset
GNEMoveOperation * calculateMoveShapeOperation(const GUIGlObject *obj, const PositionVector originalShape, const bool maintainShapeClosed)
calculate move shape operation
double myMoveElementLateralOffset
move element lateral offset (used by elements placed over lanes
virtual GNEMoveOperation * getMoveOperation()=0
get move operation
static void moveElement(const GNEViewNet *viewNet, GNEMoveOperation *moveOperation, const GNEMoveOffset &offset)
move element the for given offset (note: offset can be X-Y-0, 0-0-Z or X-Y-Z)
virtual void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)=0
remove geometry point in the clicked position
move offset
const double z
Z.
const double x
X.
const double y
Y.
GNEMoveOffset()
constructor
~GNEMoveOffset()
destructor
move operation
const OperationType operationType
operation type
GNEMoveOperation & operator=(const GNEMoveOperation &)=delete
Invalidated assignment operator.
const PositionVector originalShape
original shape
const std::vector< int > originalGeometryPoints
original shape points to move (of original shape)
const PositionVector shapeToMove
shape to move
const GNELane * lastLane
original last lane
const double lastPosition
original last Position
~GNEMoveOperation()
destructor
GNEMoveOperation(const GNEMoveOperation &)=delete
Invalidated copy constructor.
const GNELane * firstLane
original first lane
const std::vector< int > geometryPointsToMove
shape points to move (of shapeToMove)
const double firstPosition
original first Position
const bool allowChangeLane
allow change lane
GNEMoveElement * moveElement
move element
const bool firstGeometryPoint
first position (used for edit with/height
move result
const GNELane * newFirstLane
new first Lane
double newFirstPos
new first position
double lastLaneOffset
lane offset
const GNELane * newLastLane
new last Lane
GNEMoveResult(const GNEMoveResult &)=delete
Invalidated copy constructor.
~GNEMoveResult()
destructor
void clearLanes()
clear lanes
const GNEMoveOperation::OperationType operationType
move operation
double firstLaneOffset
lane offset
std::vector< int > geometryPointsToMove
shape points to move (of shapeToMove)
double newLastPos
new last position
PositionVector shapeToUpdate
shape to update (edited in moveElement)
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
A list of positions.