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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // A class for visualizing personTrips in Netedit
16 /****************************************************************************/
17 #ifndef GNEPersonTrip_h
18 #define GNEPersonTrip_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 
26 
27 #include "GNEDemandElement.h"
28 
29 // ===========================================================================
30 // class declarations
31 // ===========================================================================
32 class GNEEdge;
33 class GNEConnection;
34 class GNEVehicle;
35 
36 // ===========================================================================
37 // class definitions
38 // ===========================================================================
39 
41 
42 public:
51  GNEPersonTrip(GNEViewNet* viewNet, GNEDemandElement* personParent, const std::vector<GNEEdge*>& edges, const std::vector<std::string>& types,
52  const std::vector<std::string>& modes, double arrivalPosition);
53 
62  GNEPersonTrip(GNEViewNet* viewNet, GNEDemandElement* personParent, const std::vector<GNEEdge*>& edges, GNEAdditional* busStop,
63  const std::vector<std::string>& types, const std::vector<std::string>& modes);
64 
67 
71  void writeDemandElement(OutputDevice& device) const;
72 
74  bool isDemandElementValid() const;
75 
77  std::string getDemandElementProblem() const;
78 
81 
85  GNEEdge* getFromEdge() const;
86 
88  GNEEdge* getToEdge() const;
89 
92 
94  const RGBColor& getColor() const;
95 
97  void compute();
98 
100 
104  void startGeometryMoving();
105 
107  void endGeometryMoving();
108 
112  void moveGeometry(const Position& offset);
113 
117  void commitGeometryMoving(GNEUndoList* undoList);
118 
120  void updateGeometry();
121 
123  Position getPositionInView() const;
125 
128 
137 
141  std::string getParentName() const;
142 
147 
152  void drawGL(const GUIVisualizationSettings& s) const;
154 
158  void selectAttributeCarrier(bool changeFlag = true);
159 
161  void unselectAttributeCarrier(bool changeFlag = true);
162 
163  /* @brief method for getting the Attribute of an XML key
164  * @param[in] key The attribute key
165  * @return string with the value associated to key
166  */
167  std::string getAttribute(SumoXMLAttr key) const;
168 
169  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
170  * @param[in] key The attribute key
171  * @return double with the value associated to key
172  */
173  double getAttributeDouble(SumoXMLAttr key) const;
174 
175  /* @brief method for setting the attribute and letting the object perform additional changes
176  * @param[in] key The attribute key
177  * @param[in] value The new value
178  * @param[in] undoList The undoList on which to register changes
179  * @param[in] net optionally the GNENet to inform about gui updates
180  */
181  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
182 
183  /* @brief method for setting the attribute and letting the object perform additional changes
184  * @param[in] key The attribute key
185  * @param[in] value The new value
186  * @param[in] undoList The undoList on which to register changes
187  */
188  bool isValid(SumoXMLAttr key, const std::string& value);
189 
190  /* @brief method for enabling attribute
191  * @param[in] key The attribute key
192  * @param[in] undoList The undoList on which to register changes
193  * @note only certain attributes can be enabled, and can produce the disabling of other attributes
194  */
195  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
196 
197  /* @brief method for check if the value for certain attribute is set
198  * @param[in] key The attribute key
199  */
200  bool isAttributeEnabled(SumoXMLAttr key) const;
201 
203  std::string getPopUpID() const;
204 
206  std::string getHierarchyName() const;
208 
212  std::string getGenericParametersStr() const;
213 
215  std::vector<std::pair<std::string, std::string> > getGenericParameters() const;
216 
218  void setGenericParametersStr(const std::string& value);
219 
221 
222 protected:
224  DemandElementMove myPersonTripMove;
225 
227  std::vector<std::string> myVTypes;
228 
230  std::vector<std::string> myModes;
231 
234 
235 private:
237  void setAttribute(SumoXMLAttr key, const std::string& value);
238 
240  void setEnabledAttribute(const int enabledAttributes);
241 
243  GNEPersonTrip(GNEPersonTrip*) = delete;
244 
247 };
248 
249 
250 #endif
251 
252 /****************************************************************************/
253 
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
~GNEPersonTrip()
destructor
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes ...
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
std::vector< std::string > myVTypes
valid line or vehicle types
void updateGeometry()
update pre-computed geometry information
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(...)
GNEEdge * getFromEdge() const
Stores the information about how to visualize structures.
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
double getAttributeDouble(SumoXMLAttr key) const
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
std::string getAttribute(SumoXMLAttr key) const
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
void selectAttributeCarrier(bool changeFlag=true)
inherited from GNEAttributeCarrier
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
std::vector< std::string > myModes
valid line or modes
double myArrivalPosition
arrival position
DemandElementMove myPersonTripMove
variable for move person trips
void compute()
compute demand element
Position getPositionInView() const
Returns position of additional in view.
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute) ...
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children) ...
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
GNEEdge * getToEdge() const
obtain to edge of this demand element
An upper class for objects with additional parameters.
Definition: Parameterised.h:43
bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
GNEPersonTrip & operator=(GNEPersonTrip *)=delete
Invalidated assignment operator.
void startGeometryMoving()
std::string getParentName() const
Returns the name of the parent object.
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
GNEPersonTrip(GNEViewNet *viewNet, GNEDemandElement *personParent, const std::vector< GNEEdge *> &edges, const std::vector< std::string > &types, const std::vector< std::string > &modes, double arrivalPosition)
parameter constructor
bool isAttributeEnabled(SumoXMLAttr key) const
The popup menu of a globject.
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
const RGBColor & getColor() const
get color
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
std::string getGenericParametersStr() const
return generic parameters in string format
void endGeometryMoving()
end geometry movement
An Element which don&#39;t belongs to GNENet but has influency in the simulation.