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-2025 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 can be moved
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
24
25#include "GNEMoveOffset.h"
26#include "GNEMoveResult.h"
27
28// ===========================================================================
29// class declaration
30// ===========================================================================
31
33class GNEUndoList;
34class GNEViewNet;
35class GUIGlObject;
36class Parameterised;
37
38// ===========================================================================
39// class definitions
40// ===========================================================================
41
43
44public:
47
49 virtual ~GNEMoveElement();
50
55
58
60 virtual std::string getMovingAttribute(SumoXMLAttr key) const = 0;
61
63 virtual double getMovingAttributeDouble(SumoXMLAttr key) const = 0;
64
67
70
72 virtual void setMovingAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
73
75 virtual bool isMovingAttributeValid(SumoXMLAttr key, const std::string& value) const = 0;
76
78 virtual void setMovingAttribute(SumoXMLAttr key, const std::string& value) = 0;
79
81
83 virtual void removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList) = 0;
84
86 static void moveElement(const GNEViewNet* viewNet, GNEMoveOperation* moveOperation, const GNEMoveOffset& offset);
87
89 static void commitMove(const GNEViewNet* viewNet, GNEMoveOperation* moveOperation, const GNEMoveOffset& offset, GNEUndoList* undoList);
90
93
94protected:
97
99 GNEMoveOperation* getEditShapeOperation(const GUIGlObject* obj, const PositionVector originalShape, const bool maintainShapeClosed);
100
101private:
103 virtual void setMoveShape(const GNEMoveResult& moveResult) = 0;
104
106 virtual void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList) = 0;
107
109 static double calculateLaneOffset(const GNEViewNet* viewNet, const GNELane* lane, const double firstPosition,
110 const double lastPosition, const GNEMoveOffset& offset);
111
113 static void calculateLanePosition(double& starPos, const GNEViewNet* viewNet, const GNELane* lane,
114 const double posOverLane, const GNEMoveOffset& offset);
115
117 static void calculateLanePositions(double& starPos, double& endPos, const GNEViewNet* viewNet, const GNELane* lane,
118 const double firstPosOverLane, const double lastPosOverLane, const GNEMoveOffset& offset);
119
121 static void calculateLanePositions(double& starPos, double& endPos, const GNEViewNet* viewNet, const GNELane* firstLane,
122 const double firstPosOverLane, const GNELane* lastLane, const double lastPosOverLane,
123 const bool firstLaneClicked, const GNEMoveOffset& offset);
124
126 static void calculateNewLaneChange(const GNEViewNet* viewNet, const GNELane* originalLane, const GNELane*& newLane, double& laneOffset);
127
129 static PositionVector calculateExtrapolatedVector(const GNEMoveOperation* moveOperation, const GNEMoveResult& moveResult);
130
132 GNEMoveElement() = delete;
133
136
139};
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
double myMovingLateralOffset
move element lateral offset
static PositionVector calculateExtrapolatedVector(const GNEMoveOperation *moveOperation, const GNEMoveResult &moveResult)
calculate width/height shape
virtual void setMoveShape(const GNEMoveResult &moveResult)=0
set move shape
virtual PositionVector getMovingAttributePositionVector(SumoXMLAttr key) const =0
get moving attribute positionVector
static void calculateLanePositions(double &starPos, double &endPos, const GNEViewNet *viewNet, const GNELane *lane, const double firstPosOverLane, const double lastPosOverLane, const GNEMoveOffset &offset)
calculate lane position over one lane with two positions (stoppingPlaces, E2 single lanes)
GNEAttributeCarrier * myMovedElement
pointer to element
virtual ~GNEMoveElement()
static void commitMove(const GNEViewNet *viewNet, GNEMoveOperation *moveOperation, const GNEMoveOffset &offset, GNEUndoList *undoList)
commit move element for the given offset
static void calculateLanePosition(double &starPos, const GNEViewNet *viewNet, const GNELane *lane, const double posOverLane, const GNEMoveOffset &offset)
calculate lane position over one lane with only one position (accesss, E1, star/end positions,...
virtual double getMovingAttributeDouble(SumoXMLAttr key) const =0
get moving attribute double
virtual void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)=0
commit move shape
GNEMoveElement & operator=(const GNEMoveElement &)=delete
Invalidated assignment operator.
virtual std::string getMovingAttribute(SumoXMLAttr key) const =0
get moving attribute
static void calculateNewLaneChange(const GNEViewNet *viewNet, const GNELane *originalLane, const GNELane *&newLane, double &laneOffset)
calculate new lane change
virtual void setMovingAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
set moving attribute (using undo-list)
GNEMoveElement(const GNEMoveElement &)=delete
Invalidated copy constructor.
GNEMoveElement()=delete
invalidate default constructor
GNEMoveOperation * getEditShapeOperation(const GUIGlObject *obj, const PositionVector originalShape, const bool maintainShapeClosed)
calculate move shape operation
virtual GNEMoveOperation * getMoveOperation()=0
get move operation
virtual bool isMovingAttributeValid(SumoXMLAttr key, const std::string &value) const =0
check if the given moving attribute is valid
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)
static double calculateLaneOffset(const GNEViewNet *viewNet, const GNELane *lane, const double firstPosition, const double lastPosition, const GNEMoveOffset &offset)
calculate lane offset (used in calculateLanePosition)
virtual Position getMovingAttributePosition(SumoXMLAttr key) const =0
get moving attribute position
virtual void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)=0
remove geometry point in the clicked position
An upper class for objects with additional parameters.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
A list of positions.