Eclipse SUMO - Simulation of Urban MObility
GNETransport.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3// Copyright (C) 2016-2022 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>
22#include "GNEDemandElement.h"
24
25// ===========================================================================
26// class declarations
27// ===========================================================================
28class GNEEdge;
29class GNEConnection;
30class GNEVehicle;
31
32// ===========================================================================
33// class definitions
34// ===========================================================================
35
37
38public:
41
50 GNETransport(GNENet* net, GNEDemandElement* containerParent, GNEEdge* fromEdge, GNEEdge* toEdge, const std::vector<std::string>& lines, const double arrivalPosition);
51
60 GNETransport(GNENet* net, GNEDemandElement* containerParent, GNEEdge* fromEdge, GNEAdditional* toContainerStop, const std::vector<std::string>& lines, const double arrivalPosition);
61
64
69
73 void writeDemandElement(OutputDevice& device) const;
74
77
79 std::string getDemandElementProblem() const;
80
83
88
90 const RGBColor& getColor() const;
91
93
97 void updateGeometry();
98
102
105
114
118 std::string getParentName() const;
119
121 double getExaggeration(const GUIVisualizationSettings& s) const;
122
127
129 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
130
135 void drawGL(const GUIVisualizationSettings& s) const;
136
138
141
143 void computePathElement();
144
151 void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const;
152
160 void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* segment, const double offsetFront) const;
161
163 GNELane* getFirstPathLane() const;
164
166 GNELane* getLastPathLane() const;
168
171 /* @brief method for getting the Attribute of an XML key
172 * @param[in] key The attribute key
173 * @return string with the value associated to key
174 */
175 std::string getAttribute(SumoXMLAttr key) const;
176
177 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
178 * @param[in] key The attribute key
179 * @return double with the value associated to key
180 */
181 double getAttributeDouble(SumoXMLAttr key) const;
182
183 /* @brief method for getting the Attribute of an XML key in Position format (used in container plans)
184 * @param[in] key The attribute key
185 * @return double with the value associated to key
186 */
188
189 /* @brief method for setting the attribute and letting the object perform additional changes
190 * @param[in] key The attribute key
191 * @param[in] value The new value
192 * @param[in] undoList The undoList on which to register changes
193 * @param[in] net optionally the GNENet to inform about gui updates
194 */
195 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
196
197 /* @brief method for setting the attribute and letting the object perform additional changes
198 * @param[in] key The attribute key
199 * @param[in] value The new value
200 * @param[in] undoList The undoList on which to register changes
201 */
202 bool isValid(SumoXMLAttr key, const std::string& value);
203
204 /* @brief method for check if the value for certain attribute is set
205 * @param[in] key The attribute key
206 */
207 bool isAttributeEnabled(SumoXMLAttr key) const;
208
210 std::string getPopUpID() const;
211
213 std::string getHierarchyName() const;
215
218
219protected:
221 std::vector<std::string> myLines;
222
225
226private:
228 void setAttribute(SumoXMLAttr key, const std::string& value);
229
231 void setMoveShape(const GNEMoveResult& moveResult);
232
234 void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
235
238
241};
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
An Element which don't belong to GNENet but has influence in the simulation.
Definition: GNEAdditional.h:48
An Element which don't belong to GNENet but has influence in the simulation.
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
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
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
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 writed into XML (by default true, can be reimplemented...
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
double myArrivalPosition
arrival position
Definition: GNETransport.h:224
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
GNETransport(SumoXMLTag tag, GNENet *net)
default constructor
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
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.
Definition: GNETransport.h:221
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
std::string getParentName() const
Returns the name of the parent object.
~GNETransport()
destructor
SUMOVehicleClass getVClass() const
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
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.
Definition: OutputDevice.h:61
An upper class for objects with additional parameters.
Definition: Parameterised.h:41
std::map< std::string, std::string > Map
parameters map
Definition: Parameterised.h:45
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37