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-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 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
54 GNERide(GNENet* net, SumoXMLTag tag, GUIIcon icon, GNEDemandElement* personParent, const GNEPlanParents& planParameters,
55 const double arrivalPosition, const std::vector<std::string>& lines, const std::string& group);
56
58 ~GNERide();
59
64
68 void writeDemandElement(OutputDevice& device) const;
69
72
74 std::string getDemandElementProblem() const;
75
78
83
85 const RGBColor& getColor() const;
86
88
92 void updateGeometry();
93
97
100
109
113 std::string getParentName() const;
114
119
121 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
122
127 void drawGL(const GUIVisualizationSettings& s) const;
128
130
133
135 void computePathElement();
136
142 void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;
143
149 void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;
150
152 GNELane* getFirstPathLane() const;
153
155 GNELane* getLastPathLane() const;
157
160 /* @brief method for getting the Attribute of an XML key
161 * @param[in] key The attribute key
162 * @return string with the value associated to key
163 */
164 std::string getAttribute(SumoXMLAttr key) const;
165
166 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
167 * @param[in] key The attribute key
168 * @return double with the value associated to key
169 */
170 double getAttributeDouble(SumoXMLAttr key) const;
171
172 /* @brief method for getting the Attribute of an XML key in Position format (used in person plans)
173 * @param[in] key The attribute key
174 * @return double with the value associated to key
175 */
177
178 /* @brief method for setting the attribute and letting the object perform additional changes
179 * @param[in] key The attribute key
180 * @param[in] value The new value
181 * @param[in] undoList The undoList on which to register changes
182 * @param[in] net optionally the GNENet to inform about gui updates
183 */
184 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
185
186 /* @brief method for setting the attribute and letting the object perform additional changes
187 * @param[in] key The attribute key
188 * @param[in] value The new value
189 * @param[in] undoList The undoList on which to register changes
190 */
191 bool isValid(SumoXMLAttr key, const std::string& value);
192
193 /* @brief method for check if the value for certain attribute is set
194 * @param[in] key The attribute key
195 */
196 bool isAttributeEnabled(SumoXMLAttr key) const;
197
199 std::string getPopUpID() const;
200
202 std::string getHierarchyName() const;
204
207
208protected:
210 std::vector<std::string> myLines;
211
213 std::string myGroup;
214
215private:
217 void setAttribute(SumoXMLAttr key, const std::string& value);
218
220 void setMoveShape(const GNEMoveResult& moveResult);
221
223 void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
224
226 GNERide(GNERide*) = delete;
227
230};
GUIIcon
An enumeration of icons used by the gui applications.
Definition GUIIcons.h:33
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
GNEPlanParents (used for group all plan parents)
std::string myGroup
group
Definition GNERide.h:213
double getAttributeDouble(SumoXMLAttr key) const
Definition GNERide.cpp:199
GNERide & operator=(GNERide *)=delete
Invalidated assignment operator.
Position getPositionInView() const
Returns position of additional in view.
Definition GNERide.cpp:126
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition GNERide.cpp:102
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition GNERide.cpp:144
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition GNERide.cpp:108
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition GNERide.cpp:96
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition GNERide.cpp:244
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition GNERide.cpp:138
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition GNERide.cpp:290
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition GNERide.cpp:150
std::string getParentName() const
Returns the name of the parent object.
Definition GNERide.cpp:132
~GNERide()
destructor
Definition GNERide.cpp:55
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over lane.
Definition GNERide.cpp:162
GNEMoveOperation * getMoveOperation()
get move operation
Definition GNERide.cpp:59
void updateGeometry()
update pre-computed geometry information
Definition GNERide.cpp:120
Problem isDemandElementValid() const
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
Definition GNERide.cpp:90
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition GNERide.cpp:65
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition GNERide.cpp:225
const RGBColor & getColor() const
get color
Definition GNERide.cpp:114
Position getAttributePosition(SumoXMLAttr key) const
Definition GNERide.cpp:205
const Parameterised::Map & getACParametersMap() const
get parameters map
Definition GNERide.cpp:256
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over junction.
Definition GNERide.cpp:168
std::vector< std::string > myLines
valid line or vehicle ids or ANY
Definition GNERide.h:210
GNELane * getLastPathLane() const
get last path lane
Definition GNERide.cpp:180
bool isAttributeEnabled(SumoXMLAttr key) const
Definition GNERide.cpp:238
void computePathElement()
compute pathElement
Definition GNERide.cpp:156
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:211
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition GNERide.cpp:186
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition GNERide.cpp:281
GNELane * getFirstPathLane() const
get first path lane
Definition GNERide.cpp:174
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition GNERide.cpp:250
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
Definition GNERide.cpp:71
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