Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/demand/GNEStopPlan.h
185790 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-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 GNEStopPlan.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Oct 2023
17
///
18
// Representation of Stops in netedit
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include "GNEDemandElement.h"
24
#include "GNEDemandElementPlan.h"
25
26
// ===========================================================================
27
// class definitions
28
// ===========================================================================
29
30
class GNEStopPlan : public GNEDemandElement, public GNEDemandElementPlan {
31
32
public:
33
/// @brief default constructor
34
GNEStopPlan(SumoXMLTag tag, GNENet* net);
35
36
/**@brief constructor called in buildStopPlan
37
* @param[in] tag stop tag
38
* @param[in] planParameters plan parameters
39
* @param[in] additionals from-to additionals
40
* @param[in] endPos end position
41
* @param[in] duration stop duration
42
* @param[in] until stop until
43
* @param[in] actType act type
44
* @param[in] friendlyPos friendly pos
45
* @param[in] parameterSet parameter sets
46
*/
47
GNEStopPlan(SumoXMLTag tag, GNEDemandElement* personParent, const GNEPlanParents& planParameters,
48
const double endPos, const SUMOTime duration, const SUMOTime until, const std::string& actType,
49
const bool friendlyPos, const int parameterSet);
50
51
/// @brief destructor
52
~GNEStopPlan();
53
54
/// @brief methods to retrieve the elements linked to this stopPlan
55
/// @{
56
57
/// @brief get GNEMoveElement associated with this stopPlan
58
GNEMoveElement* getMoveElement() const override;
59
60
/// @brief get parameters associated with this stopPlan
61
Parameterised* getParameters() override;
62
63
/// @brief get parameters associated with this stopPlan
64
const Parameterised* getParameters() const override;
65
66
/// @}
67
68
/**@brief write demand element element into a xml file
69
* @param[in] device device in which write parameters of demand element element
70
*/
71
void writeDemandElement(OutputDevice& device) const override;
72
73
/// @brief check if current demand element is valid to be written into XML (by default true, can be reimplemented in children)
74
Problem isDemandElementValid() const override;
75
76
/// @brief return a string with the current demand element problem (by default empty, can be reimplemented in children)
77
std::string getDemandElementProblem() const override;
78
79
/// @brief fix demand element problem (by default throw an exception, has to be reimplemented in children)
80
void fixDemandElementProblem() override;
81
82
/// @name members and functions relative to elements common to all demand elements
83
/// @{
84
/// @brief obtain VClass related with this demand element
85
SUMOVehicleClass getVClass() const override;
86
87
/// @brief get color
88
const RGBColor& getColor() const override;
89
90
/// @}
91
92
/// @name Functions related with geometry of element
93
/// @{
94
/// @brief update pre-computed geometry information
95
void updateGeometry() override;
96
97
/// @brief Returns position of demand element in view
98
Position getPositionInView() const override;
99
/// @}
100
101
/// @name inherited from GUIGlObject
102
/// @{
103
/**@brief Returns the name of the parent object
104
* @return This object's parent id
105
*/
106
std::string getParentName() const override;
107
108
/// @brief return exaggeration associated with this GLObject
109
double getExaggeration(const GUIVisualizationSettings& s) const override;
110
111
/**@brief Returns the boundary to which the view shall be centered in order to show the object
112
* @return The boundary the object is within
113
*/
114
Boundary getCenteringBoundary() const override;
115
116
/// @brief split geometry
117
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) override;
118
119
/**@brief Draws the object
120
* @param[in] s The settings for the current view (may influence drawing)
121
* @see GUIGlObject::drawGL
122
*/
123
void drawGL(const GUIVisualizationSettings& s) const override;
124
125
/// @}
126
127
/// @name inherited from GNEPathElement
128
/// @{
129
130
/// @brief compute pathElement
131
void computePathElement() override;
132
133
/**@brief Draws partial object over lane
134
* @param[in] s The settings for the current view (may influence drawing)
135
* @param[in] segment lane segment
136
* @param[in] offsetFront front offset
137
*/
138
void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;
139
140
/**@brief Draws partial object over junction
141
* @param[in] s The settings for the current view (may influence drawing)
142
* @param[in] segment junction segment
143
* @param[in] offsetFront front offset
144
*/
145
void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;
146
147
/// @brief get first path lane
148
GNELane* getFirstPathLane() const override;
149
150
/// @brief get last path lane
151
GNELane* getLastPathLane() const override;
152
/// @}
153
154
/// @brief inherited from GNEAttributeCarrier
155
/// @{
156
/* @brief method for getting the Attribute of an XML key
157
* @param[in] key The attribute key
158
* @return string with the value associated to key
159
*/
160
std::string getAttribute(SumoXMLAttr key) const override;
161
162
/* @brief method for getting the Attribute of an XML key in double format
163
* @param[in] key The attribute key
164
* @return double with the value associated to key
165
*/
166
double getAttributeDouble(SumoXMLAttr key) const override;
167
168
/* @brief method for getting the Attribute of an XML key in position format
169
* @param[in] key The attribute key
170
* @return position with the value associated to key
171
*/
172
Position getAttributePosition(SumoXMLAttr key) const override;
173
174
/* @brief method for setting the attribute and letting the object perform demand element changes
175
* @param[in] key The attribute key
176
* @param[in] value The new value
177
* @param[in] undoList The undoList on which to register changes
178
* @param[in] net optionally the GNENet to inform about gui updates
179
*/
180
void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
181
182
/* @brief method for setting the attribute and letting the object perform demand element changes
183
* @param[in] key The attribute key
184
* @param[in] value The new value
185
* @param[in] undoList The undoList on which to register changes
186
*/
187
bool isValid(SumoXMLAttr key, const std::string& value) override;
188
189
/* @brief method for enable attribute
190
* @param[in] key The attribute key
191
* @param[in] undoList The undoList on which to register changes
192
* @note certain attributes can be only enabled, and can produce the disabling of other attributes
193
*/
194
void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList) override;
195
196
/* @brief method for disable attribute
197
* @param[in] key The attribute key
198
* @param[in] undoList The undoList on which to register changes
199
* @note certain attributes can be only enabled, and can produce the disabling of other attributes
200
*/
201
void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList) override;
202
203
/* @brief method for check if the value for certain attribute is set
204
* @param[in] key The attribute key
205
*/
206
bool isAttributeEnabled(SumoXMLAttr key) const override;
207
208
/// @brief get PopPup ID (Used in AC Hierarchy)
209
std::string getPopUpID() const override;
210
211
/// @brief get Hierarchy Name (Used in AC Hierarchy)
212
std::string getHierarchyName() const override;
213
/// @}
214
215
protected:
216
/// @brief variable used for draw contours
217
GNEContour myStopContour;
218
219
/// @brief variable used for draw sign contours
220
GNEContour myStopSignContour;
221
222
/// @brief sign position
223
Position mySignPosition;
224
225
/// @brief duration
226
SUMOTime myDuration;
227
228
/// @brief until
229
SUMOTime myUntil;
230
231
/// @brief act type
232
std::string myActType;
233
234
/// @brief friendly pos
235
bool myFriendlyPos = false;
236
237
/// @brief parameter set
238
int myParametersSet = 0;
239
240
private:
241
/// @brief method for setting the attribute and nothing else
242
void setAttribute(SumoXMLAttr key, const std::string& value) override;
243
244
/// @brief method for enable or disable the attribute and nothing else (used in GNEChange_ToggleAttribute)
245
void toggleAttribute(SumoXMLAttr key, const bool value) override;
246
247
/// @brief Invalidated copy constructor.
248
GNEStopPlan(const GNEStopPlan&) = delete;
249
250
/// @brief Invalidated assignment operator
251
GNEStopPlan& operator=(const GNEStopPlan&) = delete;
252
};
253
254