Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
GNETransport.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2016-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// A class for visualizing transports in Netedit
19/****************************************************************************/
20#pragma once
21#include <config.h>
23
24#include "GNEDemandElement.h"
26
27// ===========================================================================
28// class declarations
29// ===========================================================================
30
31class GNEEdge;
32class GNEConnection;
33class GNEVehicle;
34
35// ===========================================================================
36// class definitions
37// ===========================================================================
38
40
41public:
44
53 GNETransport(SumoXMLTag tag, GNEDemandElement* containerParent, const GNEPlanParents& planParameters,
54 const double arrivalPosition, const std::vector<std::string>& lines, const std::string& group);
55
58
63
67 void writeDemandElement(OutputDevice& device) const;
68
71
73 std::string getDemandElementProblem() const;
74
77
82
84 const RGBColor& getColor() const;
85
87
91 void updateGeometry();
92
96
99
108
112 std::string getParentName() const;
113
118
120 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
121
126 void drawGL(const GUIVisualizationSettings& s) const;
127
129
132
134 void computePathElement();
135
141 void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;
142
148 void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;
149
151 GNELane* getFirstPathLane() const;
152
154 GNELane* getLastPathLane() const;
156
159 /* @brief method for getting the Attribute of an XML key
160 * @param[in] key The attribute key
161 * @return string with the value associated to key
162 */
163 std::string getAttribute(SumoXMLAttr key) const;
164
165 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
166 * @param[in] key The attribute key
167 * @return double with the value associated to key
168 */
169 double getAttributeDouble(SumoXMLAttr key) const;
170
171 /* @brief method for getting the Attribute of an XML key in Position format (used in container plans)
172 * @param[in] key The attribute key
173 * @return double with the value associated to key
174 */
176
177 /* @brief method for setting the attribute and letting the object perform additional changes
178 * @param[in] key The attribute key
179 * @param[in] value The new value
180 * @param[in] undoList The undoList on which to register changes
181 * @param[in] net optionally the GNENet to inform about gui updates
182 */
183 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
184
185 /* @brief method for setting the attribute and letting the object perform additional changes
186 * @param[in] key The attribute key
187 * @param[in] value The new value
188 * @param[in] undoList The undoList on which to register changes
189 */
190 bool isValid(SumoXMLAttr key, const std::string& value);
191
192 /* @brief method for check if the value for certain attribute is set
193 * @param[in] key The attribute key
194 */
195 bool isAttributeEnabled(SumoXMLAttr key) const;
196
198 std::string getPopUpID() const;
199
201 std::string getHierarchyName() const;
203
206
207protected:
209 std::vector<std::string> myLines;
210
212 std::string myGroup;
213
214private:
216 void setAttribute(SumoXMLAttr key, const std::string& value);
217
219 void setMoveShape(const GNEMoveResult& moveResult);
220
222 void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
223
226
229};
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
A class that stores a 2D geometrical boundary.
Definition Boundary.h:39
Problem
enum class for demandElement problems
A road/street connecting two junctions (netedit-version)
Definition GNEEdge.h:53
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition GNELane.h:46
move operation
move result
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
GNEPlanParents (used for group all plan parents)
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
GNELane * getLastPathLane() const
get last path lane
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
void computePathElement()
compute pathElement
std::string myGroup
group
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
GNETransport & operator=(GNETransport *)=delete
Invalidated assignment operator.
Problem isDemandElementValid() const
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
GNELane * getFirstPathLane() const
get first path lane
Position getAttributePosition(SumoXMLAttr key) const
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
GNEMoveOperation * getMoveOperation()
get move operation
const RGBColor & getColor() const
get color
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
GNETransport(GNETransport *)=delete
Invalidated copy constructor.
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
const Parameterised::Map & getACParametersMap() const
get parameters map
double getAttributeDouble(SumoXMLAttr key) const
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over junction.
bool isAttributeEnabled(SumoXMLAttr key) const
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
std::vector< std::string > myLines
The list of lines that are assigned to this stop.
std::string getParentName() const
Returns the name of the parent object.
~GNETransport()
destructor
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Position getPositionInView() const
Returns position of additional in view.
void updateGeometry()
update pre-computed geometry information
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over lane.
The popup menu of a globject.
Stores the information about how to visualize structures.
Static storage of an output device and its base (abstract) implementation.
An upper class for objects with additional parameters.
std::map< std::string, std::string > Map
parameters map
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37