Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNERide.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 rides in Netedit
19/****************************************************************************/
20#pragma once
21#include <config.h>
23
24#include "GNEDemandElement.h"
26
27// ===========================================================================
28// class declarations
29// ===========================================================================
30
31class GNEEdge;
32class GNEConnection;
33class GNEVehicle;
34
35// ===========================================================================
36// class definitions
37// ===========================================================================
38
40
41public:
43 GNERide(SumoXMLTag tag, GNENet* net);
44
52 GNERide(SumoXMLTag tag, GNEDemandElement* personParent, const GNEPlanParents& planParameters,
53 const double arrivalPosition, const std::vector<std::string>& lines, const std::string& group);
54
56 ~GNERide();
57
60
62 GNEMoveElement* getMoveElement() const override;
63
65 Parameterised* getParameters() override;
66
68 const Parameterised* getParameters() const override;
69
71
75 void writeDemandElement(OutputDevice& device) const;
76
79
81 std::string getDemandElementProblem() const;
82
85
90
92 const RGBColor& getColor() const;
93
95
99 void updateGeometry() override;
100
104
107
116
120 std::string getParentName() const;
121
126
128 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
129
134 void drawGL(const GUIVisualizationSettings& s) const;
135
137
140
142 void computePathElement();
143
149 void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;
150
156 void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;
157
159 GNELane* getFirstPathLane() const;
160
162 GNELane* getLastPathLane() const;
164
167 /* @brief method for getting the Attribute of an XML key
168 * @param[in] key The attribute key
169 * @return string with the value associated to key
170 */
171 std::string getAttribute(SumoXMLAttr key) const override;
172
173 /* @brief method for getting the Attribute of an XML key in double format
174 * @param[in] key The attribute key
175 * @return double with the value associated to key
176 */
177 double getAttributeDouble(SumoXMLAttr key) const override;
178
179 /* @brief method for getting the Attribute of an XML key in position format
180 * @param[in] key The attribute key
181 * @return position with the value associated to key
182 */
183 Position getAttributePosition(SumoXMLAttr key) const override;
184
185 /* @brief method for setting the attribute and letting the object perform additional changes
186 * @param[in] key The attribute key
187 * @param[in] value The new value
188 * @param[in] undoList The undoList on which to register changes
189 * @param[in] net optionally the GNENet to inform about gui updates
190 */
191 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
192
193 /* @brief method for setting the attribute and letting the object perform additional changes
194 * @param[in] key The attribute key
195 * @param[in] value The new value
196 * @param[in] undoList The undoList on which to register changes
197 */
198 bool isValid(SumoXMLAttr key, const std::string& value) override;
199
200 /* @brief method for check if the value for certain attribute is set
201 * @param[in] key The attribute key
202 */
203 bool isAttributeEnabled(SumoXMLAttr key) const;
204
206 std::string getPopUpID() const override;
207
209 std::string getHierarchyName() const override;
211
212protected:
214 std::vector<std::string> myLines;
215
217 std::string myGroup;
218
219private:
221 void setAttribute(SumoXMLAttr key, const std::string& value) override;
222
224 GNERide(GNERide*) = delete;
225
228};
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 NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
GNEPlanParents (used for group all plan parents)
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
Definition GNERide.cpp:226
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this ride
Definition GNERide.cpp:62
std::string myGroup
group
Definition GNERide.h:217
GNERide & operator=(GNERide *)=delete
Invalidated assignment operator.
Position getPositionInView() const
Returns position of additional in view.
Definition GNERide.cpp:141
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition GNERide.cpp:117
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition GNERide.cpp:159
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition GNERide.cpp:123
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition GNERide.cpp:111
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition GNERide.cpp:153
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition GNERide.cpp:165
std::string getParentName() const
Returns the name of the parent object.
Definition GNERide.cpp:147
~GNERide()
destructor
Definition GNERide.cpp:58
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
Definition GNERide.cpp:264
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over lane.
Definition GNERide.cpp:177
Problem isDemandElementValid() const
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
Definition GNERide.cpp:105
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition GNERide.cpp:80
const RGBColor & getColor() const
get color
Definition GNERide.cpp:129
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
Definition GNERide.cpp:258
double getAttributeDouble(SumoXMLAttr key) const override
Definition GNERide.cpp:214
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over junction.
Definition GNERide.cpp:183
std::vector< std::string > myLines
valid line or vehicle ids or ANY
Definition GNERide.h:214
GNELane * getLastPathLane() const
get last path lane
Definition GNERide.cpp:195
bool isAttributeEnabled(SumoXMLAttr key) const
Definition GNERide.cpp:252
void computePathElement()
compute pathElement
Definition GNERide.cpp:171
std::string getAttribute(SumoXMLAttr key) const override
inherited from GNEAttributeCarrier
Definition GNERide.cpp:201
GNELane * getFirstPathLane() const
get first path lane
Definition GNERide.cpp:189
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
Definition GNERide.cpp:86
Parameterised * getParameters() override
get parameters associated with this ride
Definition GNERide.cpp:68
GNERide(GNERide *)=delete
Invalidated copy constructor.
Position getAttributePosition(SumoXMLAttr key) const override
Definition GNERide.cpp:220
void updateGeometry() override
update pre-computed geometry information
Definition GNERide.cpp:135
bool isValid(SumoXMLAttr key, const std::string &value) override
Definition GNERide.cpp:240
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