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-2023 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>
22#include "GNEDemandElement.h"
24
25// ===========================================================================
26// class declarations
27// ===========================================================================
28class GNEEdge;
29class GNEConnection;
30class GNEVehicle;
31
32// ===========================================================================
33// class definitions
34// ===========================================================================
35
36class GNERide : public GNEDemandElement, public Parameterised {
37
38public:
40 GNERide(SumoXMLTag tag, GNENet* net);
41
51 GNERide(GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEEdge* toEdge,
52 double arrivalPosition, const std::vector<std::string>& lines);
53
63 GNERide(bool isTrain, GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEAdditional* toBusStop,
64 double arrivalPosition, const std::vector<std::string>& lines);
65
67 ~GNERide();
68
73
77 void writeDemandElement(OutputDevice& device) const;
78
81
83 std::string getDemandElementProblem() const;
84
87
92
94 const RGBColor& getColor() const;
95
97
101 void updateGeometry();
102
106
109
118
122 std::string getParentName() const;
123
128
130 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
131
136 void drawGL(const GUIVisualizationSettings& s) const;
137
139
142
144 void computePathElement();
145
152 void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const;
153
161 void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* segment, const double offsetFront) const;
162
164 GNELane* getFirstPathLane() const;
165
167 GNELane* getLastPathLane() const;
169
172 /* @brief method for getting the Attribute of an XML key
173 * @param[in] key The attribute key
174 * @return string with the value associated to key
175 */
176 std::string getAttribute(SumoXMLAttr key) const;
177
178 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
179 * @param[in] key The attribute key
180 * @return double with the value associated to key
181 */
182 double getAttributeDouble(SumoXMLAttr key) const;
183
184 /* @brief method for getting the Attribute of an XML key in Position format (used in person plans)
185 * @param[in] key The attribute key
186 * @return double with the value associated to key
187 */
189
190 /* @brief method for setting the attribute and letting the object perform additional changes
191 * @param[in] key The attribute key
192 * @param[in] value The new value
193 * @param[in] undoList The undoList on which to register changes
194 * @param[in] net optionally the GNENet to inform about gui updates
195 */
196 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
197
198 /* @brief method for setting the attribute and letting the object perform additional changes
199 * @param[in] key The attribute key
200 * @param[in] value The new value
201 * @param[in] undoList The undoList on which to register changes
202 */
203 bool isValid(SumoXMLAttr key, const std::string& value);
204
205 /* @brief method for check if the value for certain attribute is set
206 * @param[in] key The attribute key
207 */
208 bool isAttributeEnabled(SumoXMLAttr key) const;
209
211 std::string getPopUpID() const;
212
214 std::string getHierarchyName() const;
216
219
220protected:
223
225 std::vector<std::string> myLines;
226
227private:
229 void setAttribute(SumoXMLAttr key, const std::string& value);
230
232 void setMoveShape(const GNEMoveResult& moveResult);
233
235 void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
236
238 GNERide(GNERide*) = delete;
239
242};
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
An Element which don't belong to GNENet but has influence in the simulation.
An Element which don't belong to GNENet but has influence in the simulation.
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
double getAttributeDouble(SumoXMLAttr key) const
Definition GNERide.cpp:315
GNERide & operator=(GNERide *)=delete
Invalidated assignment operator.
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
Definition GNERide.cpp:253
Position getPositionInView() const
Returns position of additional in view.
Definition GNERide.cpp:185
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition GNERide.cpp:158
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition GNERide.cpp:213
SUMOVehicleClass getVClass() const
Definition GNERide.cpp:164
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition GNERide.cpp:152
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition GNERide.cpp:473
double myArrivalPosition
arrival position
Definition GNERide.h:222
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition GNERide.cpp:197
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition GNERide.cpp:568
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition GNERide.cpp:219
std::string getParentName() const
Returns the name of the parent object.
Definition GNERide.cpp:191
~GNERide()
destructor
Definition GNERide.cpp:64
GNEMoveOperation * getMoveOperation()
get move operation
Definition GNERide.cpp:68
void updateGeometry()
update pre-computed geometry information
Definition GNERide.cpp:176
Problem isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition GNERide.cpp:146
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition GNERide.cpp:87
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition GNERide.cpp:417
const RGBColor & getColor() const
get color
Definition GNERide.cpp:170
Position getAttributePosition(SumoXMLAttr key) const
Definition GNERide.cpp:330
const Parameterised::Map & getACParametersMap() const
get parameters map
Definition GNERide.cpp:491
std::vector< std::string > myLines
valid line or vehicle ids or ANY
Definition GNERide.h:225
GNELane * getLastPathLane() const
get last path lane
Definition GNERide.cpp:273
bool isAttributeEnabled(SumoXMLAttr key) const
Definition GNERide.cpp:463
void computePathElement()
compute pathElement
Definition GNERide.cpp:226
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
Definition GNERide.cpp:351
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition GNERide.cpp:284
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition GNERide.cpp:559
GNELane * getFirstPathLane() const
get first path lane
Definition GNERide.cpp:267
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition GNERide.cpp:479
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
Definition GNERide.cpp:112
GNERide(GNERide *)=delete
Invalidated copy constructor.
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