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 /****************************************************************************/
14 // A class for visualizing person trips in Netedit
15 /****************************************************************************/
16 #ifndef GNEPersonTrip_h
17 #define GNEPersonTrip_h
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 
24 #include "GNEDemandElement.h"
26 
27 // ===========================================================================
28 // class declarations
29 // ===========================================================================
30 class GNEEdge;
31 class GNEConnection;
32 class GNEVehicle;
33 
34 // ===========================================================================
35 // class definitions
36 // ===========================================================================
37 
39 
40 public:
49  GNEPersonTrip(GNEViewNet* viewNet, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEEdge* toEdge,
50  const std::vector<GNEEdge*>& via, double arrivalPosition, const std::vector<std::string>& types,
51  const std::vector<std::string>& modes);
52 
61  GNEPersonTrip(GNEViewNet* viewNet, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEAdditional* busStop,
62  const std::vector<GNEEdge*>& via, const std::vector<std::string>& types, const std::vector<std::string>& modes);
63 
66 
70  void writeDemandElement(OutputDevice& device) const;
71 
73  bool isDemandElementValid() const;
74 
76  std::string getDemandElementProblem() const;
77 
80 
84  GNEEdge* getFromEdge() const;
85 
87  GNEEdge* getToEdge() const;
88 
91 
93  const RGBColor& getColor() const;
94 
96 
100  void startGeometryMoving();
101 
103  void endGeometryMoving();
104 
108  void moveGeometry(const Position& offset);
109 
113  void commitGeometryMoving(GNEUndoList* undoList);
114 
116  void updateGeometry();
117 
119  void updatePartialGeometry(const GNEEdge* edge);
120 
122  void computePath();
123 
125  void invalidatePath();
126 
128  Position getPositionInView() const;
130 
133 
142 
146  std::string getParentName() const;
147 
152 
154  void splitEdgeGeometry(const double splitPosition, const GNENetElement* originalElement, const GNENetElement* newElement, GNEUndoList* undoList);
155 
160  void drawGL(const GUIVisualizationSettings& s) const;
162 
166  void selectAttributeCarrier(bool changeFlag = true);
167 
169  void unselectAttributeCarrier(bool changeFlag = true);
170 
171  /* @brief method for getting the Attribute of an XML key
172  * @param[in] key The attribute key
173  * @return string with the value associated to key
174  */
175  std::string getAttribute(SumoXMLAttr key) const;
176 
177  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
178  * @param[in] key The attribute key
179  * @return double with the value associated to key
180  */
181  double getAttributeDouble(SumoXMLAttr key) const;
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  * @param[in] net optionally the GNENet to inform about gui updates
188  */
189  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
190 
191  /* @brief method for setting the attribute and letting the object perform additional changes
192  * @param[in] key The attribute key
193  * @param[in] value The new value
194  * @param[in] undoList The undoList on which to register changes
195  */
196  bool isValid(SumoXMLAttr key, const std::string& value);
197 
198  /* @brief method for enable attribute
199  * @param[in] key The attribute key
200  * @param[in] undoList The undoList on which to register changes
201  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
202  */
203  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
204 
205  /* @brief method for disable attribute
206  * @param[in] key The attribute key
207  * @param[in] undoList The undoList on which to register changes
208  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
209  */
210  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
211 
212  /* @brief method for check if the value for certain attribute is set
213  * @param[in] key The attribute key
214  */
215  bool isAttributeEnabled(SumoXMLAttr key) const;
216 
218  std::string getPopUpID() const;
219 
221  std::string getHierarchyName() const;
223 
224 protected:
226  DemandElementMove myPersonTripMove;
227 
230 
232  std::vector<std::string> myVTypes;
233 
235  std::vector<std::string> myModes;
236 
237 private:
239  void setAttribute(SumoXMLAttr key, const std::string& value);
240 
242  void setEnabledAttribute(const int enabledAttributes);
243 
246 
249 };
250 
251 
252 #endif
253 
254 /****************************************************************************/
255 
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:133
GNEDemandElement
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEDemandElement.h:55
GNEAdditional
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
GNEPersonTrip::selectAttributeCarrier
void selectAttributeCarrier(bool changeFlag=true)
inherited from GNEAttributeCarrier
Definition: GNEPersonTrip.cpp:395
Parameterised
An upper class for objects with additional parameters.
Definition: Parameterised.h:42
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:72
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
GNEPersonTrip::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEPersonTrip.cpp:367
GNEPersonTrip::getPositionInView
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEPersonTrip.cpp:355
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:476
GNEViewNet
Definition: GNEViewNet.h:42
GNEPersonTrip::myPersonTripMove
DemandElementMove myPersonTripMove
variable for move person trips
Definition: GNEPersonTrip.h:226
GNEPersonTrip::GNEPersonTrip
GNEPersonTrip(GNEViewNet *viewNet, GNEDemandElement *personParent, GNEEdge *fromEdge, GNEEdge *toEdge, const std::vector< GNEEdge * > &via, double arrivalPosition, const std::vector< std::string > &types, const std::vector< std::string > &modes)
parameter constructor for person tripEdges
Definition: GNEPersonTrip.cpp:44
GNEPersonTrip::fixDemandElementProblem
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEPersonTrip.cpp:174
GNEPersonTrip::unselectAttributeCarrier
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNEPersonTrip.cpp:410
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:47
GNEPersonTrip::commitGeometryMoving
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNEPersonTrip.cpp:260
GNEPersonTrip::moveGeometry
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEPersonTrip.cpp:238
GNEEdge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:51
GNEPersonTrip::setEnabledAttribute
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNEPersonTrip.cpp:640
GNEPersonTrip::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEPersonTrip.cpp:561
GNEPersonTrip::getPopUpMenu
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEPersonTrip.cpp:80
RGBColor
Definition: RGBColor.h:39
GNEPersonTrip::getFromEdge
GNEEdge * getFromEdge() const
Definition: GNEPersonTrip.cpp:180
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:499
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:138
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
GNEPersonTrip::myVTypes
std::vector< std::string > myVTypes
valid line or vehicle types
Definition: GNEPersonTrip.h:232
GNEPersonTrip::updatePartialGeometry
void updatePartialGeometry(const GNEEdge *edge)
partial update pre-computed geometry information
Definition: GNEPersonTrip.cpp:298
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
GNEPersonTrip::startGeometryMoving
void startGeometryMoving()
Definition: GNEPersonTrip.cpp:214
GNEPersonTrip::splitEdgeGeometry
void splitEdgeGeometry(const double splitPosition, const GNENetElement *originalElement, const GNENetElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEPersonTrip.cpp:383
GNENetElement
Definition: GNENetElement.h:43
GNEPersonTrip::~GNEPersonTrip
~GNEPersonTrip()
destructor
Definition: GNEPersonTrip.cpp:76
GNEPersonTrip::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEPersonTrip.cpp:426
GNEPersonTrip::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEPersonTrip.cpp:389
GNEPersonTrip::endGeometryMoving
void endGeometryMoving()
end geometry movement
Definition: GNEPersonTrip.cpp:228
GUIMainWindow
Definition: GUIMainWindow.h:46
GNEPersonTrip::invalidatePath
void invalidatePath()
invalidate path
Definition: GNEPersonTrip.cpp:337
GNEPersonTrip::disableAttribute
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEPersonTrip.cpp:549
GNEPersonTrip::GNEPersonTrip
GNEPersonTrip(GNEPersonTrip *)=delete
Invalidated copy constructor.
GNEPersonTrip::writeDemandElement
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNEPersonTrip.cpp:105
GNEPersonTrip::operator=
GNEPersonTrip & operator=(GNEPersonTrip *)=delete
Invalidated assignment operator.
GNEPersonTrip::enableAttribute
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEPersonTrip.cpp:543
GNEPersonTrip::getParentName
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEPersonTrip.cpp:361
GNEVehicle
Definition: GNEVehicle.h:35
GNEConnection
Definition: GNEConnection.h:38
GNEPersonTrip::computePath
void computePath()
compute path
Definition: GNEPersonTrip.cpp:319
GNEPersonTrip::getHierarchyName
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEPersonTrip.cpp:567
GNEPersonTrip::isAttributeEnabled
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEPersonTrip.cpp:555
GNEPersonTrip::myModes
std::vector< std::string > myModes
valid line or modes
Definition: GNEPersonTrip.h:235
GNEUndoList
Definition: GNEUndoList.h:48
GNEPersonTrip::getVClass
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition: GNEPersonTrip.cpp:202
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
GNEPersonTrip::getColor
const RGBColor & getColor() const
get color
Definition: GNEPersonTrip.cpp:208
GNEPersonTrip::getToEdge
GNEEdge * getToEdge() const
obtain to edge of this demand element
Definition: GNEPersonTrip.cpp:191
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:372
GNEPersonTrip::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNEPersonTrip.cpp:271
GNEPersonTrip::getAttributeDouble
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEPersonTrip.cpp:461
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:157
GNEPersonTrip::myArrivalPosition
double myArrivalPosition
arrival position
Definition: GNEPersonTrip.h:229
GNEPersonTrip
Definition: GNEPersonTrip.h:38