Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/demand/GNEPersonTrip.h
185790 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 GNEPersonTrip.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Jun 2019
17
///
18
// A class for visualizing person trips 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 GNEPersonTrip : public GNEDemandElement, public GNEDemandElementPlan {
40
41
public:
42
/// @brief default constructor
43
GNEPersonTrip(SumoXMLTag tag, GNENet* net);
44
45
/**@brief constructor called in buildPersonTrip
46
* @param[in] tag personTrip tag
47
* @param[in] planParameters plan parameters
48
* @param[in] types list of possible vehicle types to take
49
* @param[in] modes list of possible traffic modes
50
* @param[in] lines list of lines
51
* @param[in] walkFactor walk factor
52
* @param[in] group group
53
*/
54
GNEPersonTrip(SumoXMLTag tag, GNEDemandElement* personParent, const GNEPlanParents& planParameters,
55
const double arrivalPosition, const std::vector<std::string>& types, const std::vector<std::string>& modes,
56
const std::vector<std::string>& lines, const double walkFactor, const std::string& group);
57
58
/// @brief destructor
59
~GNEPersonTrip();
60
61
/// @brief methods to retrieve the elements linked to this personTrip
62
/// @{
63
64
/// @brief get GNEMoveElement associated with this personTrip
65
GNEMoveElement* getMoveElement() const override;
66
67
/// @brief get parameters associated with this personTrip
68
Parameterised* getParameters() override;
69
70
/// @brief get parameters associated with this personTrip
71
const Parameterised* getParameters() const override;
72
73
/// @}
74
75
/**@brief write demand element element into a xml file
76
* @param[in] device device in which write parameters of demand element element
77
*/
78
void writeDemandElement(OutputDevice& device) const override;
79
80
/// @brief check if current demand element is valid to be written into XML (by default true, can be reimplemented in children)
81
Problem isDemandElementValid() const override;
82
83
/// @brief return a string with the current demand element problem (by default empty, can be reimplemented in children)
84
std::string getDemandElementProblem() const override;
85
86
/// @brief fix demand element problem (by default throw an exception, has to be reimplemented in children)
87
void fixDemandElementProblem() override;
88
89
/// @name members and functions relative to elements common to all demand elements
90
/// @{
91
/// @brief obtain VClass related with this demand element
92
SUMOVehicleClass getVClass() const override;
93
94
/// @brief get color
95
const RGBColor& getColor() const override;
96
97
/// @}
98
99
/// @name Functions related with geometry of element
100
/// @{
101
/// @brief update pre-computed geometry information
102
void updateGeometry() override;
103
104
/// @brief Returns position of additional in view
105
Position getPositionInView() const override;
106
/// @}
107
108
/// @name inherited from GUIGlObject
109
/// @{
110
111
/**@brief Returns an own popup-menu
112
*
113
* @param[in] app The application needed to build the popup-menu
114
* @param[in] parent The parent window needed to build the popup-menu
115
* @return The built popup-menu
116
* @see GUIGlObject::getPopUpMenu
117
*/
118
GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent) override;
119
120
/**@brief Returns the name of the parent object
121
* @return This object's parent id
122
*/
123
std::string getParentName() const override;
124
125
/**@brief Returns the boundary to which the view shall be centered in order to show the object
126
* @return The boundary the object is within
127
*/
128
Boundary getCenteringBoundary() const override;
129
130
/// @brief split geometry
131
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) override;
132
133
/**@brief Draws the object
134
* @param[in] s The settings for the current view (may influence drawing)
135
* @see GUIGlObject::drawGL
136
*/
137
void drawGL(const GUIVisualizationSettings& s) const override;
138
139
/// @}
140
141
/// @name inherited from GNEPathElement
142
/// @{
143
144
/// @brief compute pathElement
145
void computePathElement() override;
146
147
/**@brief Draws partial object over lane
148
* @param[in] s The settings for the current view (may influence drawing)
149
* @param[in] segment lane segment
150
* @param[in] offsetFront front offset
151
*/
152
void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;
153
154
/**@brief Draws partial object over junction
155
* @param[in] s The settings for the current view (may influence drawing)
156
* @param[in] segment junction segment
157
* @param[in] offsetFront front offset
158
*/
159
void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;
160
161
/// @brief get first path lane
162
GNELane* getFirstPathLane() const override;
163
164
/// @brief get last path lane
165
GNELane* getLastPathLane() const override;
166
/// @}
167
168
/// @brief inherited from GNEAttributeCarrier
169
/// @{
170
/* @brief method for getting the Attribute of an XML key
171
* @param[in] key The attribute key
172
* @return string with the value associated to key
173
*/
174
std::string getAttribute(SumoXMLAttr key) const override;
175
176
/* @brief method for getting the Attribute of an XML key in double format
177
* @param[in] key The attribute key
178
* @return double with the value associated to key
179
*/
180
double getAttributeDouble(SumoXMLAttr key) const override;
181
182
/* @brief method for getting the Attribute of an XML key in position format
183
* @param[in] key The attribute key
184
* @return position with the value associated to key
185
*/
186
Position getAttributePosition(SumoXMLAttr key) const override;
187
188
/* @brief method for setting the attribute and letting the object perform additional changes
189
* @param[in] key The attribute key
190
* @param[in] value The new value
191
* @param[in] undoList The undoList on which to register changes
192
* @param[in] net optionally the GNENet to inform about gui updates
193
*/
194
void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
195
196
/* @brief method for setting the attribute and letting the object perform additional changes
197
* @param[in] key The attribute key
198
* @param[in] value The new value
199
* @param[in] undoList The undoList on which to register changes
200
*/
201
bool isValid(SumoXMLAttr key, const std::string& value) 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 valid line or vehicle types
217
std::vector<std::string> myVTypes;
218
219
/// @brief valid line or modes
220
std::vector<std::string> myModes;
221
222
/// @brief valid line or vehicle ids or ANY
223
std::vector<std::string> myLines;
224
225
/// @brief walk factor
226
double myWalkFactor = 0;
227
228
/// @brief group
229
std::string myGroup;
230
231
private:
232
/// @brief method for setting the attribute and nothing else
233
void setAttribute(SumoXMLAttr key, const std::string& value) override;
234
235
/// @brief Invalidated copy constructor.
236
GNEPersonTrip(GNEPersonTrip*) = delete;
237
238
/// @brief Invalidated assignment operator.
239
GNEPersonTrip& operator=(GNEPersonTrip*) = delete;
240
};
241
242