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.org/sumo
3 // Copyright (C) 2016-2022 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 // ===========================================================================
28 class GNEEdge;
29 class GNEConnection;
30 class GNEVehicle;
31 
32 // ===========================================================================
33 // class definitions
34 // ===========================================================================
35 
37 
38 public:
40  GNEPersonTrip(SumoXMLTag tag, GNENet* net);
41 
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 
63  GNEPersonTrip(GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEAdditional* toBusStop,
64  double arrivalPosition, const std::vector<std::string>& types, const std::vector<std::string>& modes);
65 
75  GNEPersonTrip(GNENet* net, GNEDemandElement* personParent, GNEJunction* fromJunction, GNEJunction* toJunction,
76  double arrivalPosition, const std::vector<std::string>& types, const std::vector<std::string>& modes);
77 
80 
85 
89  void writeDemandElement(OutputDevice& device) const;
90 
93 
95  std::string getDemandElementProblem() const;
96 
99 
103  SUMOVehicleClass getVClass() const;
104 
106  const RGBColor& getColor() const;
107 
109 
113  void updateGeometry();
114 
116  Position getPositionInView() const;
118 
121 
130 
134  std::string getParentName() const;
135 
137  double getExaggeration(const GUIVisualizationSettings& s) const;
138 
143 
145  void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
146 
151  void drawGL(const GUIVisualizationSettings& s) const;
152 
154 
157 
159  void computePathElement();
160 
167  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const;
168 
176  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* segment, const double offsetFront) const;
177 
179  GNELane* getFirstPathLane() const;
180 
182  GNELane* getLastPathLane() const;
184 
187  /* @brief method for getting the Attribute of an XML key
188  * @param[in] key The attribute key
189  * @return string with the value associated to key
190  */
191  std::string getAttribute(SumoXMLAttr key) const;
192 
193  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
194  * @param[in] key The attribute key
195  * @return double with the value associated to key
196  */
197  double getAttributeDouble(SumoXMLAttr key) const;
198 
199  /* @brief method for getting the Attribute of an XML key in Position format (used in person plans)
200  * @param[in] key The attribute key
201  * @return double with the value associated to key
202  */
204 
205  /* @brief method for setting the attribute and letting the object perform additional changes
206  * @param[in] key The attribute key
207  * @param[in] value The new value
208  * @param[in] undoList The undoList on which to register changes
209  * @param[in] net optionally the GNENet to inform about gui updates
210  */
211  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
212 
213  /* @brief method for setting the attribute and letting the object perform additional changes
214  * @param[in] key The attribute key
215  * @param[in] value The new value
216  * @param[in] undoList The undoList on which to register changes
217  */
218  bool isValid(SumoXMLAttr key, const std::string& value);
219 
220  /* @brief method for enable attribute
221  * @param[in] key The attribute key
222  * @param[in] undoList The undoList on which to register changes
223  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
224  */
225  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
226 
227  /* @brief method for disable attribute
228  * @param[in] key The attribute key
229  * @param[in] undoList The undoList on which to register changes
230  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
231  */
232  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
233 
234  /* @brief method for check if the value for certain attribute is set
235  * @param[in] key The attribute key
236  */
237  bool isAttributeEnabled(SumoXMLAttr key) const;
238 
240  std::string getPopUpID() const;
241 
243  std::string getHierarchyName() const;
245 
247  const std::map<std::string, std::string>& getACParametersMap() const;
248 
249 protected:
252 
254  std::vector<std::string> myVTypes;
255 
257  std::vector<std::string> myModes;
258 
259 private:
261  void setAttribute(SumoXMLAttr key, const std::string& value);
262 
264  void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters);
265 
267  void setMoveShape(const GNEMoveResult& moveResult);
268 
270  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
271 
274 
277 };
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 belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
An Element which don't belongs to GNENet but has influency 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
writte 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.
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
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
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration asociated with this GLObject
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)
void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters)
method for enable or disable the attribute and nothing else (used in GNEChange_EnableAttribute)
Problem isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
SUMOVehicleClass getVClass() const
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
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
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
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37