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
88 GNERoute(const std::string& id, GNENet* net, const std::string& filename, SUMOVehicleClass vClass, const std::vector<GNEEdge*>& edges,
89 const RGBColor& color, const int repeat, const SUMOTime cycleTime, const Parameterised::Map& parameters);
90
99 GNERoute(GNEDemandElement* vehicleParent, const std::vector<GNEEdge*>& edges, const RGBColor& color,
100 const int repeat, const SUMOTime cycleTime, const Parameterised::Map& parameters);
101
103 ~GNERoute();
104
107
109 GNEMoveElement* getMoveElement() const override;
110
112 Parameterised* getParameters() override;
113
115 const Parameterised* getParameters() const override;
116
118
122 void writeDemandElement(OutputDevice& device) const;
123
126
128 std::string getDemandElementProblem() const;
129
132
137
139 const RGBColor& getColor() const;
140
142
146 void updateGeometry() override;
147
151
154
163
167 std::string getParentName() const;
168
170 double getExaggeration(const GUIVisualizationSettings& s) const;
171
176
178 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
179
184 void drawGL(const GUIVisualizationSettings& s) const;
185
187
190
192 void computePathElement();
193
199 void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;
200
206 void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;
207
209 GNELane* getFirstPathLane() const;
210
212 GNELane* getLastPathLane() const;
214
217 /* @brief method for getting the Attribute of an XML key
218 * @param[in] key The attribute key
219 * @return string with the value associated to key
220 */
221 std::string getAttribute(SumoXMLAttr key) const override;
222
223 /* @brief method for getting the Attribute of an XML key in double format
224 * @param[in] key The attribute key
225 * @return double with the value associated to key
226 */
227 double getAttributeDouble(SumoXMLAttr key) const override;
228
229 /* @brief method for getting the Attribute of an XML key in position format
230 * @param[in] key The attribute key
231 * @return position with the value associated to key
232 */
233 Position getAttributePosition(SumoXMLAttr key) const override;
234
235 /* @brief method for setting the attribute and letting the object perform additional changes
236 * @param[in] key The attribute key
237 * @param[in] value The new value
238 * @param[in] undoList The undoList on which to register changes
239 * @param[in] net optionally the GNENet to inform about gui updates
240 */
241 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
242
243 /* @brief method for setting the attribute and letting the object perform additional changes
244 * @param[in] key The attribute key
245 * @param[in] value The new value
246 * @param[in] undoList The undoList on which to register changes
247 */
248 bool isValid(SumoXMLAttr key, const std::string& value) override;
249
251 std::string getPopUpID() const override;
252
254 std::string getHierarchyName() const override;
255
257
262 static std::string isRouteValid(const std::vector<GNEEdge*>& edges);
263
265 static GNEDemandElement* copyRoute(const GNERoute* originalRoute);
266
267protected:
270
272 int myRepeat = 0;
273
276
279
280private:
283 const GNESegment* segment, const double offsetFront,
284 const GUIGeometry& geometry, const double exaggeration) const;
285
288 const double offsetFront, const GUIGeometry& geometry, const double exaggeration) const;
289
291 void setAttribute(SumoXMLAttr key, const std::string& value) override;
292
295
297 GNERoute(GNERoute*) = delete;
298
301};
long long int SUMOTime
Definition GUI.h:36
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:643
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this route
Definition GNERoute.cpp:156
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition GNERoute.cpp:304
std::string getAttribute(SumoXMLAttr key) const override
inherited from GNEAttributeCarrier
Definition GNERoute.cpp:545
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
Definition GNERoute.cpp:359
GNELane * getLastPathLane() const
get last path lane
Definition GNERoute.cpp:535
Position getPositionInView() const
Returns position of additional in view.
Definition GNERoute.cpp:347
SUMOVehicleClass myVClass
SUMOVehicleClass (Only used for drawing)
Definition GNERoute.h:278
bool checkCreatingVehicleOverRoute() const
check if we're creating a vehicle or flow over route
Definition GNERoute.cpp:851
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over junction.
Definition GNERoute.cpp:489
std::string getParentName() const
Returns the name of the parent object.
Definition GNERoute.cpp:353
double getAttributeDouble(SumoXMLAttr key) const override
Definition GNERoute.cpp:568
SUMOTime myCycleTime
cycleTime
Definition GNERoute.h:275
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
Definition GNERoute.cpp:680
GNERoute & operator=(GNERoute *)=delete
Invalidated assignment operator.
void updateGeometry() override
update pre-computed geometry information
Definition GNERoute.cpp:334
Parameterised * getParameters() override
get parameters associated with this route
Definition GNERoute.cpp:162
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition GNERoute.cpp:174
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:778
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition GNERoute.cpp:381
static GNEDemandElement * copyRoute(const GNERoute *originalRoute)
create a copy of the given route
Definition GNERoute.cpp:717
GNELane * getFirstPathLane() const
get first path lane
Definition GNERoute.cpp:525
Position getAttributePosition(SumoXMLAttr key) const override
Definition GNERoute.cpp:581
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
Definition GNERoute.cpp:674
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition GNERoute.cpp:310
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:738
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition GNERoute.cpp:365
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition GNERoute.cpp:392
static std::string isRouteValid(const std::vector< GNEEdge * > &edges)
check if a route is valid
Definition GNERoute.cpp:686
int myRepeat
repeat
Definition GNERoute.h:272
void computePathElement()
compute pathElement
Definition GNERoute.cpp:398
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over lane.
Definition GNERoute.cpp:415
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition GNERoute.cpp:275
RGBColor myColor
route color
Definition GNERoute.h:269
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
Definition GNERoute.cpp:198
~GNERoute()
destructor
Definition GNERoute.cpp:153
GNERoute(GNERoute *)=delete
Invalidated copy constructor.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
Definition GNERoute.cpp:594
const RGBColor & getColor() const
get color
Definition GNERoute.cpp:320
Problem isDemandElementValid() const
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
Definition GNERoute.cpp:241
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