Eclipse SUMO - Simulation of Urban MObility
GNEPerson.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-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 // Representation of persons in NETEDIT
16 /****************************************************************************/
17 #ifndef GNEPerson_h
18 #define GNEPerson_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 
27 
28 
29 #include "GNEDemandElement.h"
30 
31 // ===========================================================================
32 // class definitions
33 // ===========================================================================
38 
39 public:
42  FXDECLARE(GNEPersonPopupMenu)
43 
44  public:
51 
54 
56  long onCmdTransform(FXObject* obj, FXSelector, void*);
57 
58  protected:
61 
62  private:
65 
67  FXMenuCommand* myTransformToPerson;
68 
70  FXMenuCommand* myTransformToPersonFlow;
71  };
72 
76 
77  public:
84  GNESelectedPersonsPopupMenu(GNEPerson* person, const std::vector<GNEPerson*>& selectedPerson, GUIMainWindow& app, GUISUMOAbstractView& parent);
85 
88 
90  long onCmdTransform(FXObject* obj, FXSelector, void*);
91 
92  protected:
95 
96  private:
99 
101  std::vector<GNEPerson*> mySelectedPersons;
102 
104  FXMenuCommand* myTransformToPerson;
105 
107  FXMenuCommand* myTransformToPersonFlow;
108  };
109 
111  GNEPerson(SumoXMLTag tag, GNEViewNet* viewNet, GNEDemandElement* pType, const SUMOVehicleParameter& personparameters);
112 
114  ~GNEPerson();
115 
120  std::string getBegin() const;
121 
125  void writeDemandElement(OutputDevice& device) const;
126 
128  bool isDemandElementValid() const;
129 
131  std::string getDemandElementProblem() const;
132 
135 
139  GNEEdge* getFromEdge() const;
140 
142  GNEEdge* getToEdge() const;
143 
145  SUMOVehicleClass getVClass() const;
146 
148  const RGBColor& getColor() const;
149 
151  void compute();
152 
154 
158  void startGeometryMoving();
159 
161  void endGeometryMoving();
162 
166  void moveGeometry(const Position& offset);
167 
171  void commitGeometryMoving(GNEUndoList* undoList);
172 
174  void updateGeometry();
175 
177  Position getPositionInView() const;
179 
182 
190 
194  std::string getParentName() const;
195 
200 
205  void drawGL(const GUIVisualizationSettings& s) const;
207 
211  void selectAttributeCarrier(bool changeFlag = true);
212 
214  void unselectAttributeCarrier(bool changeFlag = true);
215 
216  /* @brief method for getting the Attribute of an XML key
217  * @param[in] key The attribute key
218  * @return string with the value associated to key
219  */
220  std::string getAttribute(SumoXMLAttr key) const;
221 
222  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
223  * @param[in] key The attribute key
224  * @return double with the value associated to key
225  */
226  double getAttributeDouble(SumoXMLAttr key) const;
227 
228  /* @brief method for setting the attribute and letting the object perform demand element changes
229  * @param[in] key The attribute key
230  * @param[in] value The new value
231  * @param[in] undoList The undoList on which to register changes
232  * @param[in] net optionally the GNENet to inform about gui updates
233  */
234  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
235 
236  /* @brief method for setting the attribute and letting the object perform demand element changes
237  * @param[in] key The attribute key
238  * @param[in] value The new value
239  * @param[in] undoList The undoList on which to register changes
240  */
241  bool isValid(SumoXMLAttr key, const std::string& value);
242 
243  /* @brief method for enabling attribute
244  * @param[in] key The attribute key
245  * @param[in] undoList The undoList on which to register changes
246  * @note only certain attributes can be enabled, and can produce the disabling of other attributes
247  */
248  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
249 
250  /* @brief method for check if the value for certain attribute is set
251  * @param[in] key The attribute key
252  */
253  bool isAttributeEnabled(SumoXMLAttr key) const;
254 
256  std::string getPopUpID() const;
257 
259  std::string getHierarchyName() const;
261 
265  std::string getGenericParametersStr() const;
266 
268  std::vector<std::pair<std::string, std::string> > getGenericParameters() const;
269 
271  void setGenericParametersStr(const std::string& value);
272 
274 
275 protected:
277  void setColor(const GUIVisualizationSettings& s) const;
278 
280  bool setFunctionalColor(int activeScheme) const;
281 
282 private:
283  // @brief struct used for calculating person plan geometry segments
286  personPlanSegment(GNEDemandElement* _personPlan);
287 
290 
293 
295  std::vector<GNEAdditional*> busStops;
296 
298  std::vector<GNEDemandElement*> stops;
299 
301  double arrivalPos;
302 
303  private:
306  };
307 
309  void setAttribute(SumoXMLAttr key, const std::string& value);
310 
312  void setEnabledAttribute(const int enabledAttributes);
313 
315  void calculateSmoothPersonPlanConnection(const GNEDemandElement* personPlanElement, const GNEEdge* edgeFrom, const GNEEdge* edgeTo);
316 
318  std::pair<PositionVector, PositionVector> calculatePersonPlanConnectionBusStop(GNELane* previousLane, GNEAdditional* busStop, GNELane* nextLane);
319 
321  std::pair<PositionVector, PositionVector> calculatePersonPlanConnectionStop(GNELane* previousLane, GNEDemandElement* stop, GNELane* nextLane);
322 
324  std::pair<PositionVector, PositionVector> calculatePersonPlanConnectionArrivalPos(GNELane* previousLane, double arrivalPosPersonPlan, GNELane* nextLane);
325 
327  GNEPerson(const GNEPerson&) = delete;
328 
330  GNEPerson& operator=(const GNEPerson&) = delete;
331 };
332 
333 #endif
334 /****************************************************************************/
GNEPerson::GNESelectedPersonsPopupMenu::onCmdTransform
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current person to another person type.
Definition: GNEPerson.cpp:154
GNEPerson::personPlanSegment
Definition: GNEPerson.h:284
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:134
GNEPerson::setColor
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GNEPerson.cpp:938
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
GNEPerson::enableAttribute
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEPerson.cpp:822
GNEPerson::getAttributeDouble
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEPerson.cpp:697
GNEPerson::GNEPerson
GNEPerson(SumoXMLTag tag, GNEViewNet *viewNet, GNEDemandElement *pType, const SUMOVehicleParameter &personparameters)
constructor for persons
Definition: GNEPerson.cpp:172
GNEPerson::GNESelectedPersonsPopupMenu::GNESelectedPersonsPopupMenu
GNESelectedPersonsPopupMenu()
default constructor needed by FOX
Definition: GNEPerson.h:94
GNEPerson::getGenericParametersStr
std::string getGenericParametersStr() const
return generic parameters in string format
Definition: GNEPerson.cpp:995
GNEPerson::personPlanSegment::edge
GNEEdge * edge
edge
Definition: GNEPerson.h:292
GNEPerson::GNEPersonPopupMenu::myTransformToPerson
FXMenuCommand * myTransformToPerson
menu command for transform to person
Definition: GNEPerson.h:67
GNEPerson::getGenericParameters
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
Definition: GNEPerson.cpp:1010
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:73
GNEPerson::compute
void compute()
compute demand element
Definition: GNEPerson.cpp:292
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
GNEPerson::calculateSmoothPersonPlanConnection
void calculateSmoothPersonPlanConnection(const GNEDemandElement *personPlanElement, const GNEEdge *edgeFrom, const GNEEdge *edgeTo)
calculate smooth shape between personPlans
Definition: GNEPerson.cpp:1152
GNEPerson::setGenericParametersStr
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
Definition: GNEPerson.cpp:1021
GNEPerson::getBegin
std::string getBegin() const
get begin time of demand element
Definition: GNEPerson.cpp:185
GNEPerson::commitGeometryMoving
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNEPerson.cpp:316
GNEPerson::unselectAttributeCarrier
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNEPerson.cpp:633
GNEPerson::GNEPersonPopupMenu::myTransformToPersonFlow
FXMenuCommand * myTransformToPersonFlow
menu command for transform to personFlow
Definition: GNEPerson.h:70
GNEPerson::GNESelectedPersonsPopupMenu::myTransformToPersonFlow
FXMenuCommand * myTransformToPersonFlow
menu command for transform to personFlow
Definition: GNEPerson.h:107
GUIGLObjectPopupMenu.h
GNEPerson::~GNEPerson
~GNEPerson()
destructor
Definition: GNEPerson.cpp:181
GNEPerson::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEPerson.cpp:547
GNEPerson::getColor
const RGBColor & getColor() const
get color
Definition: GNEPerson.cpp:286
GNEPerson::personPlanSegment::arrivalPos
double arrivalPos
arrival position
Definition: GNEPerson.h:301
GNEPerson::GNEPersonPopupMenu
class used in GUIGLObjectPopupMenu for person transformations
Definition: GNEPerson.h:41
GNEViewNet
Definition: GNEViewNet.h:43
SUMOVehicleParameter
Structure representing possible vehicle parameter.
Definition: SUMOVehicleParameter.h:291
GNEPerson::GNESelectedPersonsPopupMenu
class used in GUIGLObjectPopupMenu for single person transformations
Definition: GNEPerson.h:74
GNEPerson::writeDemandElement
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNEPerson.cpp:204
GNEPerson::moveGeometry
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEPerson.cpp:310
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:48
GNEPerson::GNESelectedPersonsPopupMenu::mySelectedPersons
std::vector< GNEPerson * > mySelectedPersons
current selected persons
Definition: GNEPerson.h:101
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:42
GNEPerson::isDemandElementValid
bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNEPerson.cpp:248
GNEPerson::GNEPersonPopupMenu::GNEPersonPopupMenu
GNEPersonPopupMenu()
default constructor needed by FOX
Definition: GNEPerson.h:60
SUMOVehicleParameter::tag
SumoXMLTag tag
The vehicle tag.
Definition: SUMOVehicleParameter.h:459
SUMOVehicleParameter.h
GNEPerson::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEPerson.cpp:560
GNEEdge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
GNEPerson::getDemandElementProblem
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEPerson.cpp:255
GNEPerson::calculatePersonPlanConnectionStop
std::pair< PositionVector, PositionVector > calculatePersonPlanConnectionStop(GNELane *previousLane, GNEDemandElement *stop, GNELane *nextLane)
return two shapes used for calculate person plan conections between stops
Definition: GNEPerson.cpp:1207
GNEPerson::calculatePersonPlanConnectionBusStop
std::pair< PositionVector, PositionVector > calculatePersonPlanConnectionBusStop(GNELane *previousLane, GNEAdditional *busStop, GNELane *nextLane)
return two shapes used for calculate person plan conections between busStops
Definition: GNEPerson.cpp:1173
RGBColor
Definition: RGBColor.h:40
GNEPerson::GNESelectedPersonsPopupMenu::~GNESelectedPersonsPopupMenu
~GNESelectedPersonsPopupMenu()
Destructor.
Definition: GNEPerson.cpp:150
GNEPerson::selectAttributeCarrier
void selectAttributeCarrier(bool changeFlag=true)
inherited from GNEAttributeCarrier
Definition: GNEPerson.cpp:618
GNEPerson::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEPerson.cpp:903
GNEPerson::getFromEdge
GNEEdge * getFromEdge() const
Definition: GNEPerson.cpp:268
GNEDemandElement.h
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
GNEPerson::calculatePersonPlanConnectionArrivalPos
std::pair< PositionVector, PositionVector > calculatePersonPlanConnectionArrivalPos(GNELane *previousLane, double arrivalPosPersonPlan, GNELane *nextLane)
return two shapes used for calculate person plan conections between arrival position
Definition: GNEPerson.cpp:1240
GNEPerson::isValid
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEPerson.cpp:733
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
GNEPerson::setEnabledAttribute
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNEPerson.cpp:1146
GNEPerson
Definition: GNEPerson.h:37
GNEPerson::GNESelectedPersonsPopupMenu::myPersonTag
SumoXMLTag myPersonTag
tag of clicked person
Definition: GNEPerson.h:98
GNEPerson::setFunctionalColor
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some vehicle function
Definition: GNEPerson.cpp:947
GNEPerson::getVClass
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition: GNEPerson.cpp:280
GNEPerson::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: GNEPerson.cpp:703
GUIMainWindow
Definition: GUIMainWindow.h:47
GNEPerson::getToEdge
GNEEdge * getToEdge() const
obtain to edge of this demand element
Definition: GNEPerson.cpp:274
GNEPerson::GNESelectedPersonsPopupMenu::myTransformToPerson
FXMenuCommand * myTransformToPerson
menu command for transform to person
Definition: GNEPerson.h:104
GNEPerson::fixDemandElementProblem
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEPerson.cpp:262
GNEPerson::personPlanSegment::stops
std::vector< GNEDemandElement * > stops
stops placed in this segment
Definition: GNEPerson.h:298
GNEPerson::personPlanSegment::personPlanSegment
personPlanSegment()
constructor
Definition: GNEPerson.cpp:1055
GNEPerson::getHierarchyName
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEPerson.cpp:909
GNEPerson::GNEPersonPopupMenu::onCmdTransform
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current person to another person type.
Definition: GNEPerson.cpp:105
GNEPerson::GNEPersonPopupMenu::myPerson
GNEPerson * myPerson
current person
Definition: GNEPerson.h:64
GNEPerson::personPlanSegment::busStops
std::vector< GNEAdditional * > busStops
busStops placed in this segment
Definition: GNEPerson.h:295
GNEPerson::endGeometryMoving
void endGeometryMoving()
end geometry movement
Definition: GNEPerson.cpp:304
GNEUndoList
Definition: GNEUndoList.h:49
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:346
GNEPerson::operator=
GNEPerson & operator=(const GNEPerson &)=delete
Invalidated assignment operator.
GNEPerson::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNEPerson.cpp:322
GNEPerson::getParentName
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEPerson.cpp:541
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:373
GNEPerson::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEPerson.cpp:649
GNEPerson::getPopUpMenu
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEPerson.cpp:534
GNELane
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
GNEPerson::isAttributeEnabled
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEPerson.cpp:884
GNEPerson::personPlanSegment::personPlan
const GNEDemandElement * personPlan
person plan
Definition: GNEPerson.h:289
GNEPerson::startGeometryMoving
void startGeometryMoving()
Definition: GNEPerson.cpp:298
GNEPerson::getPositionInView
Position getPositionInView() const
Returns position of demand element in view.
Definition: GNEPerson.cpp:508
GNEPerson::GNEPersonPopupMenu::~GNEPersonPopupMenu
~GNEPersonPopupMenu()
Destructor.
Definition: GNEPerson.cpp:101