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-2024 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#include "GNERouteHandler.h"
26
27
28// ===========================================================================
29// class declarations
30// ===========================================================================
31
32class GNEEdge;
33class GNEConnection;
34class GNEVehicle;
35
36// ===========================================================================
37// class definitions
38// ===========================================================================
39
40class GNERoute : public GNEDemandElement, public Parameterised {
41
42public:
43
46 FXDECLARE(GNERoutePopupMenu)
47
48 public:
56
59
61 long onCmdApplyDistance(FXObject*, FXSelector, void*);
62
63 protected:
66 };
67
69 GNERoute(SumoXMLTag tag, GNENet* net);
70
72 GNERoute(GNENet* net);
73
75 GNERoute(GNENet* net, const std::string& id, const GNEDemandElement* originalRoute);
76
78 GNERoute(GNENet* net, GNEVehicle* vehicleParent, const GNEDemandElement* originalRoute);
79
90 GNERoute(GNENet* net, const std::string& id, SUMOVehicleClass vClass, const std::vector<GNEEdge*>& edges, const RGBColor& color,
91 const int repeat, const SUMOTime cycleTime, const Parameterised::Map& parameters);
92
102 GNERoute(GNENet* net, GNEDemandElement* vehicleParent, const std::vector<GNEEdge*>& edges, const RGBColor& color,
103 const int repeat, const SUMOTime cycleTime, const Parameterised::Map& parameters);
104
106 ~GNERoute();
107
112
116 void writeDemandElement(OutputDevice& device) const;
117
120
122 std::string getDemandElementProblem() const;
123
126
131
133 const RGBColor& getColor() const;
134
136
140 void updateGeometry();
141
145
148
157
161 std::string getParentName() const;
162
164 double getExaggeration(const GUIVisualizationSettings& s) const;
165
170
172 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
173
178 void drawGL(const GUIVisualizationSettings& s) const;
179
181
184
186 void computePathElement();
187
193 void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;
194
200 void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;
201
203 GNELane* getFirstPathLane() const;
204
206 GNELane* getLastPathLane() const;
208
211 /* @brief method for getting the Attribute of an XML key
212 * @param[in] key The attribute key
213 * @return string with the value associated to key
214 */
215 std::string getAttribute(SumoXMLAttr key) const;
216
217 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
218 * @param[in] key The attribute key
219 * @return double with the value associated to key
220 */
221 double getAttributeDouble(SumoXMLAttr key) const;
222
223 /* @brief method for getting the Attribute of an XML key in Position format (used in person plans)
224 * @param[in] key The attribute key
225 * @return double with the value associated to key
226 */
228
229 /* @brief method for check if the value for certain attribute is set
230 * @param[in] key The attribute key
231 */
232 bool isAttributeEnabled(SumoXMLAttr key) const;
233
234 /* @brief method for setting the attribute and letting the object perform additional changes
235 * @param[in] key The attribute key
236 * @param[in] value The new value
237 * @param[in] undoList The undoList on which to register changes
238 * @param[in] net optionally the GNENet to inform about gui updates
239 */
240 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
241
242 /* @brief method for setting the attribute and letting the object perform additional changes
243 * @param[in] key The attribute key
244 * @param[in] value The new value
245 * @param[in] undoList The undoList on which to register changes
246 */
247 bool isValid(SumoXMLAttr key, const std::string& value);
248
250 std::string getPopUpID() const;
251
253 std::string getHierarchyName() const;
255
258
263 static std::string isRouteValid(const std::vector<GNEEdge*>& edges);
264
266 static GNEDemandElement* copyRoute(const GNERoute* originalRoute);
267
268protected:
271
274
277
280
281private:
284 const GNESegment* segment, const double offsetFront,
285 const GUIGeometry& geometry, const double exaggeration) const;
286
289 const double offsetFront, const GUIGeometry& geometry, const double exaggeration) const;
290
292 void setAttribute(SumoXMLAttr key, const std::string& value);
293
295 void setMoveShape(const GNEMoveResult& moveResult);
296
298 void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
299
301 GNERoute(GNERoute*) = delete;
302
305};
long long int SUMOTime
Definition GUI.h:36
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
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
class used in GUIGLObjectPopupMenu for routes
Definition GNERoute.h:45
~GNERoutePopupMenu()
Destructor.
Definition GNERoute.cpp:56
GNERoutePopupMenu()
default constructor needed by FOX
Definition GNERoute.h:65
long onCmdApplyDistance(FXObject *, FXSelector, void *)
Called to modify edge distance values along the route.
Definition GNERoute.cpp:60
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition GNERoute.cpp:677
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition GNERoute.cpp:295
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
Definition GNERoute.cpp:350
GNELane * getLastPathLane() const
get last path lane
Definition GNERoute.cpp:513
Position getPositionInView() const
Returns position of additional in view.
Definition GNERoute.cpp:338
SUMOVehicleClass myVClass
SUMOVehicleClass (Only used for drawing)
Definition GNERoute.h:279
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over junction.
Definition GNERoute.cpp:468
std::string getParentName() const
Returns the name of the parent object.
Definition GNERoute.cpp:344
SUMOTime myCycleTime
cycleTime
Definition GNERoute.h:276
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition GNERoute.cpp:671
GNERoute & operator=(GNERoute *)=delete
Invalidated assignment operator.
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition GNERoute.cpp:523
Position getAttributePosition(SumoXMLAttr key) const
Definition GNERoute.cpp:563
void updateGeometry()
update pre-computed geometry information
Definition GNERoute.cpp:325
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition GNERoute.cpp:166
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:781
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition GNERoute.cpp:372
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition GNERoute.cpp:848
const Parameterised::Map & getACParametersMap() const
get parameters map
Definition GNERoute.cpp:683
static GNEDemandElement * copyRoute(const GNERoute *originalRoute)
create a copy of the given route
Definition GNERoute.cpp:720
GNELane * getFirstPathLane() const
get first path lane
Definition GNERoute.cpp:503
double getAttributeDouble(SumoXMLAttr key) const
Definition GNERoute.cpp:550
GNEMoveOperation * getMoveOperation()
get move operation
Definition GNERoute.cpp:160
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition GNERoute.cpp:854
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition GNERoute.cpp:301
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:741
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition GNERoute.cpp:356
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition GNERoute.cpp:637
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition GNERoute.cpp:383
static std::string isRouteValid(const std::vector< GNEEdge * > &edges)
check if a route is valid
Definition GNERoute.cpp:689
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
Definition GNERoute.cpp:587
int myRepeat
repeat
Definition GNERoute.h:273
void computePathElement()
compute pathElement
Definition GNERoute.cpp:389
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over lane.
Definition GNERoute.cpp:406
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition GNERoute.cpp:266
RGBColor myColor
route color
Definition GNERoute.h:270
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
Definition GNERoute.cpp:199
~GNERoute()
destructor
Definition GNERoute.cpp:156
GNERoute(GNERoute *)=delete
Invalidated copy constructor.
bool isAttributeEnabled(SumoXMLAttr key) const
Definition GNERoute.cpp:576
const RGBColor & getColor() const
get color
Definition GNERoute.cpp:311
Problem isDemandElementValid() const
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
Definition GNERoute.cpp:232
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