Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNERoute.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 routes in Netedit
19/****************************************************************************/
20#pragma once
21#include <config.h>
23
24#include "GNEDemandElement.h"
25
26// ===========================================================================
27// class declarations
28// ===========================================================================
29
30class GNEEdge;
31class GNEVehicle;
32
33// ===========================================================================
34// class definitions
35// ===========================================================================
36
37class GNERoute : public GNEDemandElement, public Parameterised {
38
39public:
40
43 FXDECLARE(GNERoutePopupMenu)
44
45 public:
53
56
58 long onCmdApplyDistance(FXObject*, FXSelector, void*);
59
60 protected:
63 };
64
66 GNERoute(SumoXMLTag tag, GNENet* net);
67
69 GNERoute(GNEAdditional* calibrator);
70
72 GNERoute(const std::string& id, const GNEDemandElement* originalRoute);
73
75 GNERoute(GNEVehicle* vehicleParent, const GNEDemandElement* originalRoute);
76
89 GNERoute(const std::string& id, GNENet* net, const std::string& filename, SUMOVehicleClass vClass, const std::vector<GNEEdge*>& edges,
90 const RGBColor& color, const int repeat, const SUMOTime cycleTime, const double probability, const Parameterised::Map& parameters);
91
100 GNERoute(GNEDemandElement* vehicleParent, const std::vector<GNEEdge*>& edges, const RGBColor& color,
101 const int repeat, const SUMOTime cycleTime, const Parameterised::Map& parameters);
102
104 ~GNERoute();
105
108
110 GNEMoveElement* getMoveElement() const override;
111
113 Parameterised* getParameters() override;
114
116 const Parameterised* getParameters() const override;
117
119
123 void writeDemandElement(OutputDevice& device) const override;
124
126 Problem isDemandElementValid() const override;
127
129 std::string getDemandElementProblem() const override;
130
132 void fixDemandElementProblem() override;
133
137 SUMOVehicleClass getVClass() const override;
138
140 const RGBColor& getColor() const override;
141
143
147 void updateGeometry() override;
148
150 Position getPositionInView() const override;
152
155
164
168 std::string getParentName() const override;
169
171 double getExaggeration(const GUIVisualizationSettings& s) const override;
172
176 Boundary getCenteringBoundary() const override;
177
179 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) override;
180
185 void drawGL(const GUIVisualizationSettings& s) const override;
186
188
191
193 void computePathElement() override;
194
200 void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;
201
207 void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;
208
210 GNELane* getFirstPathLane() const override;
211
213 GNELane* getLastPathLane() const override;
215
218 /* @brief method for getting the Attribute of an XML key
219 * @param[in] key The attribute key
220 * @return string with the value associated to key
221 */
222 std::string getAttribute(SumoXMLAttr key) const override;
223
224 /* @brief method for getting the Attribute of an XML key in double format
225 * @param[in] key The attribute key
226 * @return double with the value associated to key
227 */
228 double getAttributeDouble(SumoXMLAttr key) const override;
229
230 /* @brief method for getting the Attribute of an XML key in position format
231 * @param[in] key The attribute key
232 * @return position with the value associated to key
233 */
234 Position getAttributePosition(SumoXMLAttr key) const override;
235
236 /* @brief method for setting the attribute and letting the object perform additional changes
237 * @param[in] key The attribute key
238 * @param[in] value The new value
239 * @param[in] undoList The undoList on which to register changes
240 * @param[in] net optionally the GNENet to inform about gui updates
241 */
242 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
243
244 /* @brief method for setting the attribute and letting the object perform additional changes
245 * @param[in] key The attribute key
246 * @param[in] value The new value
247 * @param[in] undoList The undoList on which to register changes
248 */
249 bool isValid(SumoXMLAttr key, const std::string& value) override;
250
252 std::string getPopUpID() const override;
253
255 std::string getHierarchyName() const override;
256
258
263 static std::string isRouteValid(const std::vector<GNEEdge*>& edges);
264
266 static GNEDemandElement* copyRoute(const GNERoute* originalRoute);
267
268protected:
271
273 int myRepeat = 0;
274
277
280
283
284private:
287 const GNESegment* segment, const double offsetFront,
288 const GUIGeometry& geometry, const double exaggeration) const;
289
292 const double offsetFront, const GUIGeometry& geometry, const double exaggeration) const;
293
295 void setAttribute(SumoXMLAttr key, const std::string& value) override;
296
299
301 GNERoute(GNERoute*) = delete;
302
305};
long long int SUMOTime
Definition GUI.h:36
const double DEFAULT_VEH_PROB
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
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 NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
class used in GUIGLObjectPopupMenu for routes
Definition GNERoute.h:42
~GNERoutePopupMenu()
Destructor.
Definition GNERoute.cpp:57
GNERoutePopupMenu()
default constructor needed by FOX
Definition GNERoute.h:62
long onCmdApplyDistance(FXObject *, FXSelector, void *)
Called to modify edge distance values along the route.
Definition GNERoute.cpp:61
bool isValid(SumoXMLAttr key, const std::string &value) override
Definition GNERoute.cpp:648
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this route
Definition GNERoute.cpp:157
GNELane * getLastPathLane() const override
get last path lane
Definition GNERoute.cpp:535
std::string getParentName() const override
Returns the name of the parent object.
Definition GNERoute.cpp:353
std::string getAttribute(SumoXMLAttr key) const override
inherited from GNEAttributeCarrier
Definition GNERoute.cpp:545
SUMOVehicleClass myVClass
SUMOVehicleClass (Only used for drawing)
Definition GNERoute.h:282
bool checkCreatingVehicleOverRoute() const
check if we're creating a vehicle or flow over route
Definition GNERoute.cpp:869
double getAttributeDouble(SumoXMLAttr key) const override
Definition GNERoute.cpp:570
SUMOTime myCycleTime
cycleTime
Definition GNERoute.h:276
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
Definition GNERoute.cpp:691
Problem isDemandElementValid() const override
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
Definition GNERoute.cpp:242
GNERoute & operator=(GNERoute *)=delete
Invalidated assignment operator.
void writeDemandElement(OutputDevice &device) const override
write demand element element into a xml file
Definition GNERoute.cpp:199
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
Definition GNERoute.cpp:175
void updateGeometry() override
update pre-computed geometry information
Definition GNERoute.cpp:334
Parameterised * getParameters() override
get parameters associated with this route
Definition GNERoute.cpp:163
void drawRoutePartialJunction(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double offsetFront, const GUIGeometry &geometry, const double exaggeration) const
draw route partial junction
Definition GNERoute.cpp:789
void computePathElement() override
compute pathElement
Definition GNERoute.cpp:398
double getExaggeration(const GUIVisualizationSettings &s) const override
return exaggeration associated with this GLObject
Definition GNERoute.cpp:359
void fixDemandElementProblem() override
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition GNERoute.cpp:304
static GNEDemandElement * copyRoute(const GNERoute *originalRoute)
create a copy of the given route
Definition GNERoute.cpp:728
Position getAttributePosition(SumoXMLAttr key) const override
Definition GNERoute.cpp:585
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const override
Draws partial object over lane.
Definition GNERoute.cpp:415
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
Definition GNERoute.cpp:392
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
Definition GNERoute.cpp:685
std::string getDemandElementProblem() const override
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition GNERoute.cpp:275
void drawRoutePartialLane(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNESegment *segment, const double offsetFront, const GUIGeometry &geometry, const double exaggeration) const
draw route partial lane
Definition GNERoute.cpp:749
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList) override
split geometry
Definition GNERoute.cpp:381
const RGBColor & getColor() const override
get color
Definition GNERoute.cpp:320
SUMOVehicleClass getVClass() const override
obtain VClass related with this demand element
Definition GNERoute.cpp:310
static std::string isRouteValid(const std::vector< GNEEdge * > &edges)
check if a route is valid
Definition GNERoute.cpp:697
int myRepeat
repeat
Definition GNERoute.h:273
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const override
Draws partial object over junction.
Definition GNERoute.cpp:489
GNELane * getFirstPathLane() const override
get first path lane
Definition GNERoute.cpp:525
RGBColor myColor
route color
Definition GNERoute.h:270
~GNERoute()
destructor
Definition GNERoute.cpp:154
GNERoute(GNERoute *)=delete
Invalidated copy constructor.
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
Definition GNERoute.cpp:365
Position getPositionInView() const override
Returns position of additional in view.
Definition GNERoute.cpp:347
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
Definition GNERoute.cpp:598
double myProbability
probability
Definition GNERoute.h:279
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
static const RGBColor INVISIBLE
Definition RGBColor.h:198