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
109
113 void writeDemandElement(OutputDevice& device) const;
114
117
119 std::string getDemandElementProblem() const;
120
123
128
130 const RGBColor& getColor() const;
131
133
137 void updateGeometry();
138
142
145
154
158 std::string getParentName() const;
159
161 double getExaggeration(const GUIVisualizationSettings& s) const;
162
167
169 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
170
175 void drawGL(const GUIVisualizationSettings& s) const;
176
178
181
183 void computePathElement();
184
190 void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;
191
197 void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;
198
200 GNELane* getFirstPathLane() const;
201
203 GNELane* getLastPathLane() const;
205
208 /* @brief method for getting the Attribute of an XML key
209 * @param[in] key The attribute key
210 * @return string with the value associated to key
211 */
212 std::string getAttribute(SumoXMLAttr key) const;
213
214 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
215 * @param[in] key The attribute key
216 * @return double with the value associated to key
217 */
218 double getAttributeDouble(SumoXMLAttr key) const;
219
220 /* @brief method for getting the Attribute of an XML key in Position format (used in person plans)
221 * @param[in] key The attribute key
222 * @return double with the value associated to key
223 */
225
226 /* @brief method for check if the value for certain attribute is set
227 * @param[in] key The attribute key
228 */
229 bool isAttributeEnabled(SumoXMLAttr key) const;
230
231 /* @brief method for setting the attribute and letting the object perform additional changes
232 * @param[in] key The attribute key
233 * @param[in] value The new value
234 * @param[in] undoList The undoList on which to register changes
235 * @param[in] net optionally the GNENet to inform about gui updates
236 */
237 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
238
239 /* @brief method for setting the attribute and letting the object perform additional changes
240 * @param[in] key The attribute key
241 * @param[in] value The new value
242 * @param[in] undoList The undoList on which to register changes
243 */
244 bool isValid(SumoXMLAttr key, const std::string& value);
245
247 std::string getPopUpID() const;
248
250 std::string getHierarchyName() const;
252
255
260 static std::string isRouteValid(const std::vector<GNEEdge*>& edges);
261
263 static GNEDemandElement* copyRoute(const GNERoute* originalRoute);
264
265protected:
268
270 int myRepeat = 0;
271
274
277
278private:
281 const GNESegment* segment, const double offsetFront,
282 const GUIGeometry& geometry, const double exaggeration) const;
283
286 const double offsetFront, const GUIGeometry& geometry, const double exaggeration) const;
287
289 void setAttribute(SumoXMLAttr key, const std::string& value);
290
292 void setMoveShape(const GNEMoveResult& moveResult);
293
295 void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
296
298 GNERoute(GNERoute*) = delete;
299
302};
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 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:42
~GNERoutePopupMenu()
Destructor.
Definition GNERoute.cpp:58
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:62
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition GNERoute.cpp:663
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition GNERoute.cpp:294
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
Definition GNERoute.cpp:349
GNELane * getLastPathLane() const
get last path lane
Definition GNERoute.cpp:512
Position getPositionInView() const
Returns position of additional in view.
Definition GNERoute.cpp:337
SUMOVehicleClass myVClass
SUMOVehicleClass (Only used for drawing)
Definition GNERoute.h:276
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over junction.
Definition GNERoute.cpp:467
std::string getParentName() const
Returns the name of the parent object.
Definition GNERoute.cpp:343
SUMOTime myCycleTime
cycleTime
Definition GNERoute.h:273
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition GNERoute.cpp:657
GNERoute & operator=(GNERoute *)=delete
Invalidated assignment operator.
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition GNERoute.cpp:522
Position getAttributePosition(SumoXMLAttr key) const
Definition GNERoute.cpp:558
void updateGeometry()
update pre-computed geometry information
Definition GNERoute.cpp:324
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition GNERoute.cpp:164
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:767
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition GNERoute.cpp:371
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition GNERoute.cpp:840
const Parameterised::Map & getACParametersMap() const
get parameters map
Definition GNERoute.cpp:669
static GNEDemandElement * copyRoute(const GNERoute *originalRoute)
create a copy of the given route
Definition GNERoute.cpp:706
GNELane * getFirstPathLane() const
get first path lane
Definition GNERoute.cpp:502
double getAttributeDouble(SumoXMLAttr key) const
Definition GNERoute.cpp:545
GNEMoveOperation * getMoveOperation()
get move operation
Definition GNERoute.cpp:158
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition GNERoute.cpp:846
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition GNERoute.cpp:300
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:727
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition GNERoute.cpp:355
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition GNERoute.cpp:626
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition GNERoute.cpp:382
static std::string isRouteValid(const std::vector< GNEEdge * > &edges)
check if a route is valid
Definition GNERoute.cpp:675
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:577
int myRepeat
repeat
Definition GNERoute.h:270
void computePathElement()
compute pathElement
Definition GNERoute.cpp:388
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over lane.
Definition GNERoute.cpp:405
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition GNERoute.cpp:265
RGBColor myColor
route color
Definition GNERoute.h:267
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
Definition GNERoute.cpp:188
~GNERoute()
destructor
Definition GNERoute.cpp:154
GNERoute(GNERoute *)=delete
Invalidated copy constructor.
bool isAttributeEnabled(SumoXMLAttr key) const
Definition GNERoute.cpp:571
const RGBColor & getColor() const
get color
Definition GNERoute.cpp:310
Problem isDemandElementValid() const
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
Definition GNERoute.cpp:231
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