Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNERouteRef.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 route references
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
23#include "GNEDemandElement.h"
24
25// ===========================================================================
26// class declarations
27// ===========================================================================
28
29class GNERouteRef;
31
32// ===========================================================================
33// class definitions
34// ===========================================================================
35
37
38public:
40 GNERouteRef(GNENet* net);
41
43 GNERouteRef(GNEDemandElement* distributionParent, GNEDemandElement* routeParent, const double probability);
44
47
52
56 void writeDemandElement(OutputDevice& device) const;
57
60
62 std::string getDemandElementProblem() const;
63
66
71
73 const RGBColor& getColor() const;
74
76
80 void updateGeometry();
81
85
88
97
101 std::string getParentName() const;
102
104 double getExaggeration(const GUIVisualizationSettings& s) const;
105
110
112 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
113
118 void drawGL(const GUIVisualizationSettings& s) const;
119
121
124
126 void computePathElement();
127
133 void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;
134
140 void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;
141
143 GNELane* getFirstPathLane() const;
144
146 GNELane* getLastPathLane() const;
148
151 /* @brief method for getting the Attribute of an XML key
152 * @param[in] key The attribute key
153 * @return string with the value associated to key
154 */
155 std::string getAttribute(SumoXMLAttr key) const;
156
157 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
158 * @param[in] key The attribute key
159 * @return double with the value associated to key
160 */
161 double getAttributeDouble(SumoXMLAttr key) const;
162
163 /* @brief method for getting the Attribute of an XML key in Position format (used in person plans)
164 * @param[in] key The attribute key
165 * @return double with the value associated to key
166 */
168
169 /* @brief method for check if the value for certain attribute is set
170 * @param[in] key The attribute key
171 */
172 bool isAttributeEnabled(SumoXMLAttr key) const;
173
174 /* @brief method for setting the attribute and letting the object perform additional changes
175 * @param[in] key The attribute key
176 * @param[in] value The new value
177 * @param[in] undoList The undoList on which to register changes
178 * @param[in] net optionally the GNENet to inform about gui updates
179 */
180 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
181
182 /* @brief method for setting the attribute and letting the object perform additional changes
183 * @param[in] key The attribute key
184 * @param[in] value The new value
185 * @param[in] undoList The undoList on which to register changes
186 */
187 bool isValid(SumoXMLAttr key, const std::string& value);
188
190 std::string getPopUpID() const;
191
193 std::string getHierarchyName() const;
195
198
199protected:
201 double myProbability = 1;
202
203private:
205 void setAttribute(SumoXMLAttr key, const std::string& value);
206
208 void setMoveShape(const GNEMoveResult& moveResult);
209
211 void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
212
215
218};
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
A class that stores a 2D geometrical boundary.
Definition Boundary.h:39
Problem
enum class for demandElement problems
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
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over junction.
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Position getPositionInView() const
Returns position of additional in view.
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
GNERouteRef & operator=(GNERouteRef *)=delete
Invalidated assignment operator.
~GNERouteRef()
destructor
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
double myProbability
probability
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over lane.
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Position getAttributePosition(SumoXMLAttr key) const
const Parameterised::Map & getACParametersMap() const
get parameters map
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
std::string getParentName() const
Returns the name of the parent object.
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
GNELane * getLastPathLane() const
get last path lane
const RGBColor & getColor() const
get color
void updateGeometry()
update pre-computed geometry information
bool isAttributeEnabled(SumoXMLAttr key) const
Problem isDemandElementValid() const
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
GNEMoveOperation * getMoveOperation()
get move operation
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
void computePathElement()
compute pathElement
GNELane * getFirstPathLane() const
get first path lane
double getAttributeDouble(SumoXMLAttr key) const
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
GNERouteRef(GNERouteRef *)=delete
Invalidated copy constructor.
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