Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEPersonTrip.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 person trips 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// ===========================================================================
34// class definitions
35// ===========================================================================
37public:
40
51 GNEPersonTrip(GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEEdge* toEdge,
52 double arrivalPosition, const std::vector<std::string>& types, const std::vector<std::string>& modes,
53 const std::vector<std::string>& lines);
54
65 GNEPersonTrip(bool isTrain, GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEAdditional* toStoppingPlace,
66 double arrivalPosition, const std::vector<std::string>& types, const std::vector<std::string>& modes,
67 const std::vector<std::string>& lines);
68
79 GNEPersonTrip(GNENet* net, GNEDemandElement* personParent, GNEJunction* fromJunction, GNEJunction* toJunction,
80 double arrivalPosition, const std::vector<std::string>& types, const std::vector<std::string>& modes,
81 const std::vector<std::string>& lines);
82
85
90
94 void writeDemandElement(OutputDevice& device) const;
95
98
100 std::string getDemandElementProblem() const;
101
104
109
111 const RGBColor& getColor() const;
112
114
118 void updateGeometry();
119
123
126
135
139 std::string getParentName() const;
140
145
147 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
148
153 void drawGL(const GUIVisualizationSettings& s) const;
154
156
159
161 void computePathElement();
162
169 void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const;
170
178 void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* segment, const double offsetFront) const;
179
181 GNELane* getFirstPathLane() const;
182
184 GNELane* getLastPathLane() const;
186
189 /* @brief method for getting the Attribute of an XML key
190 * @param[in] key The attribute key
191 * @return string with the value associated to key
192 */
193 std::string getAttribute(SumoXMLAttr key) const;
194
195 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
196 * @param[in] key The attribute key
197 * @return double with the value associated to key
198 */
199 double getAttributeDouble(SumoXMLAttr key) const;
200
201 /* @brief method for getting the Attribute of an XML key in Position format (used in person plans)
202 * @param[in] key The attribute key
203 * @return double with the value associated to key
204 */
206
207 /* @brief method for setting the attribute and letting the object perform additional changes
208 * @param[in] key The attribute key
209 * @param[in] value The new value
210 * @param[in] undoList The undoList on which to register changes
211 * @param[in] net optionally the GNENet to inform about gui updates
212 */
213 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
214
215 /* @brief method for setting the attribute and letting the object perform additional changes
216 * @param[in] key The attribute key
217 * @param[in] value The new value
218 * @param[in] undoList The undoList on which to register changes
219 */
220 bool isValid(SumoXMLAttr key, const std::string& value);
221
222 /* @brief method for check if the value for certain attribute is set
223 * @param[in] key The attribute key
224 */
225 bool isAttributeEnabled(SumoXMLAttr key) const;
226
228 std::string getPopUpID() const;
229
231 std::string getHierarchyName() const;
233
236
237protected:
240
242 std::vector<std::string> myVTypes;
243
245 std::vector<std::string> myModes;
246
248 std::vector<std::string> myLines;
249
250private:
252 void setAttribute(SumoXMLAttr key, const std::string& value);
253
255 void setMoveShape(const GNEMoveResult& moveResult);
256
258 void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
259
262
265};
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
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
GNEPersonTrip(GNEPersonTrip *)=delete
Invalidated copy constructor.
double myArrivalPosition
arrival position
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
GNELane * getLastPathLane() const
get last path lane
GNEMoveOperation * getMoveOperation()
get move operation
GNEPersonTrip & operator=(GNEPersonTrip *)=delete
Invalidated assignment operator.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
Position getPositionInView() const
Returns position of additional in view.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
bool isAttributeEnabled(SumoXMLAttr key) const
void updateGeometry()
update pre-computed geometry information
std::vector< std::string > myModes
valid line or modes
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Position getAttributePosition(SumoXMLAttr key) const
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
const RGBColor & getColor() const
get color
std::vector< std::string > myVTypes
valid line or vehicle types
std::string getParentName() const
Returns the name of the parent object.
double getAttributeDouble(SumoXMLAttr key) const
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
~GNEPersonTrip()
destructor
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Problem isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
SUMOVehicleClass getVClass() const
const Parameterised::Map & getACParametersMap() const
get parameters map
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
std::vector< std::string > myLines
valid line or vehicle ids or ANY
void computePathElement()
compute pathElement
GNELane * getFirstPathLane() const
get first path lane
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