Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/demand/GNERide.h
185832 views
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
/****************************************************************************/
14
/// @file GNERide.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Jun 2019
17
///
18
// A class for visualizing rides in Netedit
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
#include <utils/gui/globjects/GUIGLObjectPopupMenu.h>
23
24
#include "GNEDemandElement.h"
25
#include "GNEDemandElementPlan.h"
26
27
// ===========================================================================
28
// class declarations
29
// ===========================================================================
30
31
class GNEEdge;
32
class GNEConnection;
33
class GNEVehicle;
34
35
// ===========================================================================
36
// class definitions
37
// ===========================================================================
38
39
class GNERide : public GNEDemandElement, public GNEDemandElementPlan {
40
41
public:
42
/// @brief default constructor
43
GNERide(SumoXMLTag tag, GNENet* net);
44
45
/**@brief constructor called in buildRide
46
* @param[in] tag personTrip tag
47
* @param[in] personParent person parent
48
* @param[in] planParameters plan parameters
49
* @param[in] lines list of lines
50
* @param[in] group group
51
*/
52
GNERide(SumoXMLTag tag, GNEDemandElement* personParent, const GNEPlanParents& planParameters,
53
const double arrivalPosition, const std::vector<std::string>& lines, const std::string& group);
54
55
/// @brief destructor
56
~GNERide();
57
58
/// @brief methods to retrieve the elements linked to this ride
59
/// @{
60
61
/// @brief get GNEMoveElement associated with this ride
62
GNEMoveElement* getMoveElement() const override;
63
64
/// @brief get parameters associated with this ride
65
Parameterised* getParameters() override;
66
67
/// @brief get parameters associated with this ride (constant)
68
const Parameterised* getParameters() const override;
69
70
/// @}
71
72
/**@brief write demand element element into a xml file
73
* @param[in] device device in which write parameters of demand element element
74
*/
75
void writeDemandElement(OutputDevice& device) const override;
76
77
/// @brief check if current demand element is valid to be written into XML (by default true, can be reimplemented in children)
78
Problem isDemandElementValid() const override;
79
80
/// @brief return a string with the current demand element problem (by default empty, can be reimplemented in children)
81
std::string getDemandElementProblem() const override;
82
83
/// @brief fix demand element problem (by default throw an exception, has to be reimplemented in children)
84
void fixDemandElementProblem() override;
85
86
/// @name members and functions relative to elements common to all demand elements
87
/// @{
88
/// @brief obtain VClass related with this demand element
89
SUMOVehicleClass getVClass() const override;
90
91
/// @brief get color
92
const RGBColor& getColor() const override;
93
94
/// @}
95
96
/// @name Functions related with geometry of element
97
/// @{
98
/// @brief update pre-computed geometry information
99
void updateGeometry() override;
100
101
/// @brief Returns position of additional in view
102
Position getPositionInView() const override;
103
/// @}
104
105
/// @name inherited from GUIGlObject
106
/// @{
107
108
/**@brief Returns an own popup-menu
109
*
110
* @param[in] app The application needed to build the popup-menu
111
* @param[in] parent The parent window needed to build the popup-menu
112
* @return The built popup-menu
113
* @see GUIGlObject::getPopUpMenu
114
*/
115
GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent) override;
116
117
/**@brief Returns the name of the parent object
118
* @return This object's parent id
119
*/
120
std::string getParentName() const override;
121
122
/**@brief Returns the boundary to which the view shall be centered in order to show the object
123
* @return The boundary the object is within
124
*/
125
Boundary getCenteringBoundary() const override;
126
127
/// @brief split geometry
128
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) override;
129
130
/**@brief Draws the object
131
* @param[in] s The settings for the current view (may influence drawing)
132
* @see GUIGlObject::drawGL
133
*/
134
void drawGL(const GUIVisualizationSettings& s) const override;
135
136
/// @}
137
138
/// @name inherited from GNEPathElement
139
/// @{
140
141
/// @brief compute pathElement
142
void computePathElement() override;
143
144
/**@brief Draws partial object over lane
145
* @param[in] s The settings for the current view (may influence drawing)
146
* @param[in] segment lane segment
147
* @param[in] offsetFront front offset
148
*/
149
void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;
150
151
/**@brief Draws partial object over junction
152
* @param[in] s The settings for the current view (may influence drawing)
153
* @param[in] segment junction segment
154
* @param[in] offsetFront front offset
155
*/
156
void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;
157
158
/// @brief get first path lane
159
GNELane* getFirstPathLane() const override;
160
161
/// @brief get last path lane
162
GNELane* getLastPathLane() const override;
163
/// @}
164
165
/// @brief inherited from GNEAttributeCarrier
166
/// @{
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 override;
204
205
/// @brief get PopPup ID (Used in AC Hierarchy)
206
std::string getPopUpID() const override;
207
208
/// @brief get Hierarchy Name (Used in AC Hierarchy)
209
std::string getHierarchyName() const override;
210
/// @}
211
212
protected:
213
/// @brief valid line or vehicle ids or ANY
214
std::vector<std::string> myLines;
215
216
/// @brief group
217
std::string myGroup;
218
219
private:
220
/// @brief method for setting the attribute and nothing else
221
void setAttribute(SumoXMLAttr key, const std::string& value) override;
222
223
/// @brief Invalidated copy constructor.
224
GNERide(GNERide*) = delete;
225
226
/// @brief Invalidated assignment operator.
227
GNERide& operator=(GNERide*) = delete;
228
};
229
230