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
30
31// ===========================================================================
32// class definitions
33// ===========================================================================
34
36
37public:
39 GNERouteRef(GNENet* net);
40
42 GNERouteRef(GNEDemandElement* distributionParent, GNEDemandElement* routeParent, const double probability);
43
46
49
51 GNEMoveElement* getMoveElement() const override;
52
54 Parameterised* getParameters() override;
55
57 const Parameterised* getParameters() const override;
58
60
64 void writeDemandElement(OutputDevice& device) const;
65
68
70 std::string getDemandElementProblem() const;
71
74
79
81 const RGBColor& getColor() const;
82
84
88 void updateGeometry() override;
89
93
96
105
109 std::string getParentName() const;
110
112 double getExaggeration(const GUIVisualizationSettings& s) 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 override;
164
165 /* @brief method for getting the Attribute of an XML key in double format
166 * @param[in] key The attribute key
167 * @return double with the value associated to key
168 */
169 double getAttributeDouble(SumoXMLAttr key) const override;
170
171 /* @brief method for getting the Attribute of an XML key in position format
172 * @param[in] key The attribute key
173 * @return position with the value associated to key
174 */
175 Position getAttributePosition(SumoXMLAttr key) const override;
176
177 /* @brief method for check if the value for certain attribute is set
178 * @param[in] key The attribute key
179 */
180 bool isAttributeEnabled(SumoXMLAttr key) const;
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 * @param[in] net optionally the GNENet to inform about gui updates
187 */
188 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
189
190 /* @brief method for setting the attribute and letting the object perform additional changes
191 * @param[in] key The attribute key
192 * @param[in] value The new value
193 * @param[in] undoList The undoList on which to register changes
194 */
195 bool isValid(SumoXMLAttr key, const std::string& value) override;
196
198 std::string getPopUpID() const override;
199
201 std::string getHierarchyName() const override;
203
204protected:
206 double myProbability = 1;
207
208private:
210 void setAttribute(SumoXMLAttr key, const std::string& value) override;
211
214
217};
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
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.
bool isValid(SumoXMLAttr key, const std::string &value) override
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
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this routeRef
double getAttributeDouble(SumoXMLAttr key) const override
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
void updateGeometry() override
update pre-computed geometry information
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.
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)
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...
Parameterised * getParameters() override
get parameters associated with this routeRef
GNELane * getLastPathLane() const
get last path lane
const RGBColor & getColor() const
get color
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
std::string getAttribute(SumoXMLAttr key) const override
inherited from GNEAttributeCarrier
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...
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Position getAttributePosition(SumoXMLAttr key) const override
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
void computePathElement()
compute pathElement
GNELane * getFirstPathLane() const
get first path lane
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
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.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37