Eclipse SUMO - Simulation of Urban MObility
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-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 person trips in Netedit
19 /****************************************************************************/
20 #pragma once
21 #include <config.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 
40 
41 public:
60  static GNEPersonTrip* buildPersonTrip(GNENet* net, GNEDemandElement* personParent,
61  GNEEdge* fromEdge, GNEAdditional* fromTAZ, GNEJunction* fromJunction, GNEAdditional* fromBusStop, GNEAdditional* fromTrainStop,
62  GNEEdge* toEdge, GNEAdditional* toTAZ, GNEJunction* toJunction, GNEAdditional* toBusStop, GNEAdditional* toTrainStop,
63  double arrivalPosition, const std::vector<std::string>& types, const std::vector<std::string>& modes,
64  const std::vector<std::string>& lines);
65 
67  GNEPersonTrip(SumoXMLTag tag, GNENet* net);
68 
71 
76 
80  void writeDemandElement(OutputDevice& device) const;
81 
84 
86  std::string getDemandElementProblem() const;
87 
90 
95 
97  const RGBColor& getColor() const;
98 
100 
104  void updateGeometry();
105 
107  Position getPositionInView() const;
109 
112 
121 
125  std::string getParentName() const;
126 
131 
133  void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
134 
139  void drawGL(const GUIVisualizationSettings& s) const;
140 
142 
145 
147  void computePathElement();
148 
154  void drawLanePartialGL(const GUIVisualizationSettings& s, const GNEPathManager::Segment* segment, const double offsetFront) const;
155 
161  void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNEPathManager::Segment* segment, const double offsetFront) const;
162 
164  GNELane* getFirstPathLane() const;
165 
167  GNELane* getLastPathLane() const;
169 
172  /* @brief method for getting the Attribute of an XML key
173  * @param[in] key The attribute key
174  * @return string with the value associated to key
175  */
176  std::string getAttribute(SumoXMLAttr key) const;
177 
178  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
179  * @param[in] key The attribute key
180  * @return double with the value associated to key
181  */
182  double getAttributeDouble(SumoXMLAttr key) const;
183 
184  /* @brief method for getting the Attribute of an XML key in Position format (used in person plans)
185  * @param[in] key The attribute key
186  * @return double with the value associated to key
187  */
189 
190  /* @brief method for setting the attribute and letting the object perform additional changes
191  * @param[in] key The attribute key
192  * @param[in] value The new value
193  * @param[in] undoList The undoList on which to register changes
194  * @param[in] net optionally the GNENet to inform about gui updates
195  */
196  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
197 
198  /* @brief method for setting the attribute and letting the object perform additional changes
199  * @param[in] key The attribute key
200  * @param[in] value The new value
201  * @param[in] undoList The undoList on which to register changes
202  */
203  bool isValid(SumoXMLAttr key, const std::string& value);
204 
205  /* @brief method for check if the value for certain attribute is set
206  * @param[in] key The attribute key
207  */
208  bool isAttributeEnabled(SumoXMLAttr key) const;
209 
211  std::string getPopUpID() const;
212 
214  std::string getHierarchyName() const;
216 
218  const Parameterised::Map& getACParametersMap() const;
219 
220 protected:
222  std::vector<std::string> myVTypes;
223 
225  std::vector<std::string> myModes;
226 
228  std::vector<std::string> myLines;
229 
230 private:
232  void setAttribute(SumoXMLAttr key, const std::string& value);
233 
235  void setMoveShape(const GNEMoveResult& moveResult);
236 
238  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
239 
252  GNEPersonTrip(GNENet* net, SumoXMLTag tag, GUIIcon icon, GNEDemandElement* personParent, const std::vector<GNEJunction*>& junctions,
253  const std::vector<GNEEdge*>& edges, const std::vector<GNEAdditional*>& additionals, double arrivalPosition,
254  const std::vector<std::string>& types, const std::vector<std::string>& modes, const std::vector<std::string>& lines);
255 
258 
261 };
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
An Element which don't belong to GNENet but has influence in the simulation.
Definition: GNEAdditional.h:49
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
GNEPersonTrip & operator=(GNEPersonTrip *)=delete
Invalidated assignment operator.
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
GNEPersonTrip(GNEPersonTrip *)=delete
Invalidated copy constructor.
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over junction.
GNELane * getLastPathLane() const
get last path lane
GNEMoveOperation * getMoveOperation()
get move operation
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 drawLanePartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over lane.
static GNEPersonTrip * buildPersonTrip(GNENet *net, GNEDemandElement *personParent, GNEEdge *fromEdge, GNEAdditional *fromTAZ, GNEJunction *fromJunction, GNEAdditional *fromBusStop, GNEAdditional *fromTrainStop, GNEEdge *toEdge, GNEAdditional *toTAZ, GNEJunction *toJunction, GNEAdditional *toBusStop, GNEAdditional *toTrainStop, double arrivalPosition, const std::vector< std::string > &types, const std::vector< std::string > &modes, const std::vector< std::string > &lines)
general constructor for personTrip
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 written into XML (by default true, can be reimplemente...
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
const Parameterised::Map & getACParametersMap() const
get parameters map
GNEPersonTrip(SumoXMLTag tag, GNENet *net)
default constructor
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.
Definition: OutputDevice.h:61
An upper class for objects with additional parameters.
Definition: Parameterised.h:41
std::map< std::string, std::string > Map
parameters map
Definition: Parameterised.h:45
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37