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 
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:134
GNEDemandElement
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEDemandElement.h:54
GNEAdditional
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
GNEPersonTrip::selectAttributeCarrier
void selectAttributeCarrier(bool changeFlag=true)
inherited from GNEAttributeCarrier
Definition: GNEPersonTrip.cpp:297
Parameterised
An upper class for objects with additional parameters.
Definition: Parameterised.h:43
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:73
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
GNEPersonTrip::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEPersonTrip.cpp:275
GNEPersonTrip::getPositionInView
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEPersonTrip.cpp:263
GUIGLObjectPopupMenu.h
GNEPersonTrip::setAttribute
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
Definition: GNEPersonTrip.cpp:368
GNEViewNet
Definition: GNEViewNet.h:43
GNEPersonTrip::myPersonTripMove
DemandElementMove myPersonTripMove
variable for move person trips
Definition: GNEPersonTrip.h:224
GNEPersonTrip::fixDemandElementProblem
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEPersonTrip.cpp:163
GNEPersonTrip::unselectAttributeCarrier
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNEPersonTrip.cpp:312
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:48
GNEPersonTrip::commitGeometryMoving
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNEPersonTrip.cpp:243
GNEPersonTrip::moveGeometry
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEPersonTrip.cpp:223
GNEEdge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
GNEPersonTrip::setEnabledAttribute
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNEPersonTrip.cpp:567
GNEPersonTrip::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEPersonTrip.cpp:439
GNEPersonTrip::getPopUpMenu
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEPersonTrip.cpp:71
RGBColor
Definition: RGBColor.h:40
GNEPersonTrip::getFromEdge
GNEEdge * getFromEdge() const
Definition: GNEPersonTrip.cpp:169
GNEPersonTrip::setGenericParametersStr
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
Definition: GNEPersonTrip.cpp:482
GNEDemandElement.h
GNEPersonTrip::isValid
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEPersonTrip.cpp:390
GNEPersonTrip::isDemandElementValid
bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNEPersonTrip.cpp:127
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
GNEPersonTrip::myVTypes
std::vector< std::string > myVTypes
valid line or vehicle types
Definition: GNEPersonTrip.h:227
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
GNEPersonTrip::startGeometryMoving
void startGeometryMoving()
Definition: GNEPersonTrip.cpp:199
GNEPersonTrip::~GNEPersonTrip
~GNEPersonTrip()
destructor
Definition: GNEPersonTrip.cpp:67
GNEPersonTrip::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEPersonTrip.cpp:328
GNEPersonTrip::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEPersonTrip.cpp:291
GNEPersonTrip::compute
void compute()
compute demand element
Definition: GNEPersonTrip.cpp:193
GNEPersonTrip::endGeometryMoving
void endGeometryMoving()
end geometry movement
Definition: GNEPersonTrip.cpp:213
GUIMainWindow
Definition: GUIMainWindow.h:47
GNEPersonTrip::writeDemandElement
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNEPersonTrip.cpp:96
GNEPersonTrip::operator=
GNEPersonTrip & operator=(GNEPersonTrip *)=delete
Invalidated assignment operator.
GNEPersonTrip::getGenericParametersStr
std::string getGenericParametersStr() const
return generic parameters in string format
Definition: GNEPersonTrip.cpp:456
GNEPersonTrip::enableAttribute
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEPersonTrip.cpp:427
GNEPersonTrip::getParentName
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEPersonTrip.cpp:269
GNEVehicle
Definition: GNEVehicle.h:36
GNEConnection
Definition: GNEConnection.h:38
GNEPersonTrip::getHierarchyName
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEPersonTrip.cpp:445
GNEPersonTrip::isAttributeEnabled
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEPersonTrip.cpp:433
GNEPersonTrip::myModes
std::vector< std::string > myModes
valid line or modes
Definition: GNEPersonTrip.h:230
GNEUndoList
Definition: GNEUndoList.h:49
GNEPersonTrip::getVClass
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition: GNEPersonTrip.cpp:181
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:346
GNEPersonTrip::getColor
const RGBColor & getColor() const
get color
Definition: GNEPersonTrip.cpp:187
GNEPersonTrip::getToEdge
GNEEdge * getToEdge() const
obtain to edge of this demand element
Definition: GNEPersonTrip.cpp:175
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:373
GNEPersonTrip::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNEPersonTrip.cpp:253
GNEPersonTrip::getAttributeDouble
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEPersonTrip.cpp:357
GNEPersonTrip::getDemandElementProblem
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEPersonTrip.cpp:146
GNEPersonTrip::GNEPersonTrip
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
Definition: GNEPersonTrip.cpp:45
GNEPersonTrip::getGenericParameters
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
Definition: GNEPersonTrip.cpp:471
GNEPersonTrip::myArrivalPosition
double myArrivalPosition
arrival position
Definition: GNEPersonTrip.h:233
GNEPersonTrip
Definition: GNEPersonTrip.h:40