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-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 // Representation of persons in NETEDIT
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
24 
25 
26 #include "GNEDemandElement.h"
27 
28 // ===========================================================================
29 // class definitions
30 // ===========================================================================
35 
36 public:
39  FXDECLARE(GNEPersonPopupMenu)
40 
41  public:
48 
51 
53  long onCmdTransform(FXObject* obj, FXSelector, void*);
54 
55  protected:
56  FOX_CONSTRUCTOR(GNEPersonPopupMenu)
57 
58  private:
61 
63  FXMenuCommand* myTransformToPerson;
64 
66  FXMenuCommand* myTransformToPersonFlow;
67  };
68 
72 
73  public:
80  GNESelectedPersonsPopupMenu(GNEPerson* person, const std::vector<GNEPerson*>& selectedPerson, GUIMainWindow& app, GUISUMOAbstractView& parent);
81 
84 
86  long onCmdTransform(FXObject* obj, FXSelector, void*);
87 
88  protected:
89  FOX_CONSTRUCTOR(GNESelectedPersonsPopupMenu)
90 
91  private:
94 
96  std::vector<GNEPerson*> mySelectedPersons;
97 
99  FXMenuCommand* myTransformToPerson;
100 
102  FXMenuCommand* myTransformToPersonFlow;
103  };
104 
107 
109  GNEPerson(SumoXMLTag tag, GNENet* net, GNEDemandElement* pType, const SUMOVehicleParameter& personparameters);
110 
112  ~GNEPerson();
113 
118 
123  std::string getBegin() const;
124 
128  void writeDemandElement(OutputDevice& device) const;
129 
132 
134  std::string getDemandElementProblem() const;
135 
138 
142  SUMOVehicleClass getVClass() const;
143 
145  const RGBColor& getColor() const;
146 
148 
152  void updateGeometry();
153 
155  Position getPositionInView() const;
157 
160 
168 
172  std::string getParentName() const;
173 
175  double getExaggeration(const GUIVisualizationSettings& s) const;
176 
181 
183  void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
184 
189  void drawGL(const GUIVisualizationSettings& s) const;
190 
192 
195 
197  void computePathElement();
198 
205  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const;
206 
214  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* segment, const double offsetFront) const;
215 
217  GNELane* getFirstPathLane() const;
218 
220  GNELane* getLastPathLane() const;
222 
225  /* @brief method for getting the Attribute of an XML key
226  * @param[in] key The attribute key
227  * @return string with the value associated to key
228  */
229  std::string getAttribute(SumoXMLAttr key) const;
230 
231  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
232  * @param[in] key The attribute key
233  * @return double with the value associated to key
234  */
235  double getAttributeDouble(SumoXMLAttr key) const;
236 
237  /* @brief method for getting the Attribute of an XML key in Position format (used in person plans)
238  * @param[in] key The attribute key
239  * @return double with the value associated to key
240  */
242 
243  /* @brief method for setting the attribute and letting the object perform demand element changes
244  * @param[in] key The attribute key
245  * @param[in] value The new value
246  * @param[in] undoList The undoList on which to register changes
247  * @param[in] net optionally the GNENet to inform about gui updates
248  */
249  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
250 
251  /* @brief method for setting the attribute and letting the object perform demand element changes
252  * @param[in] key The attribute key
253  * @param[in] value The new value
254  * @param[in] undoList The undoList on which to register changes
255  */
256  bool isValid(SumoXMLAttr key, const std::string& value);
257 
258  /* @brief method for enable attribute
259  * @param[in] key The attribute key
260  * @param[in] undoList The undoList on which to register changes
261  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
262  */
263  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
264 
265  /* @brief method for disable attribute
266  * @param[in] key The attribute key
267  * @param[in] undoList The undoList on which to register changes
268  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
269  */
270  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
271 
272  /* @brief method for check if the value for certain attribute is set
273  * @param[in] key The attribute key
274  */
275  bool isAttributeEnabled(SumoXMLAttr key) const;
276 
278  std::string getPopUpID() const;
279 
281  std::string getHierarchyName() const;
283 
285  const std::map<std::string, std::string>& getACParametersMap() const;
286 
287 protected:
289  void setColor(const GUIVisualizationSettings& s) const;
290 
292  bool setFunctionalColor(int activeScheme) const;
293 
294 private:
295  // @brief struct used for calculating person plan geometry segments
298  personPlanSegment(GNEDemandElement* _personPlan);
299 
302 
305 
307  std::vector<GNEAdditional*> busStops;
308 
310  std::vector<GNEDemandElement*> stops;
311 
313  double arrivalPos;
314 
315  private:
318  };
319 
321  void setAttribute(SumoXMLAttr key, const std::string& value);
322 
324  void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters);
325 
327  void setMoveShape(const GNEMoveResult& moveResult);
328 
330  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
331 
333  GNEPerson(const GNEPerson&) = delete;
334 
336  GNEPerson& operator=(const GNEPerson&) = delete;
337 };
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.
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
class used in GUIGLObjectPopupMenu for person transformations
Definition: GNEPerson.h:38
FXMenuCommand * myTransformToPersonFlow
menu command for transform to personFlow
Definition: GNEPerson.h:66
GNEPerson * myPerson
current person
Definition: GNEPerson.h:60
GNEPersonPopupMenu(GNEPerson *person, GUIMainWindow &app, GUISUMOAbstractView &parent)
Constructor.
Definition: GNEPerson.cpp:56
FXMenuCommand * myTransformToPerson
menu command for transform to person
Definition: GNEPerson.h:63
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current person to another person type.
Definition: GNEPerson.cpp:96
~GNEPersonPopupMenu()
Destructor.
Definition: GNEPerson.cpp:92
class used in GUIGLObjectPopupMenu for single person transformations
Definition: GNEPerson.h:70
GNESelectedPersonsPopupMenu(GNEPerson *person, const std::vector< GNEPerson * > &selectedPerson, GUIMainWindow &app, GUISUMOAbstractView &parent)
Constructor.
Definition: GNEPerson.cpp:110
SumoXMLTag myPersonTag
tag of clicked person
Definition: GNEPerson.h:93
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current person to another person type.
Definition: GNEPerson.cpp:145
FXMenuCommand * myTransformToPerson
menu command for transform to person
Definition: GNEPerson.h:99
std::vector< GNEPerson * > mySelectedPersons
current selected persons
Definition: GNEPerson.h:96
FXMenuCommand * myTransformToPersonFlow
menu command for transform to personFlow
Definition: GNEPerson.h:102
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEPerson.cpp:356
GNEPerson & operator=(const GNEPerson &)=delete
Invalidated assignment operator.
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
Definition: GNEPerson.cpp:441
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNEPerson.cpp:943
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNEPerson.cpp:184
Position getPositionInView() const
Returns position of demand element in view.
Definition: GNEPerson.cpp:307
void updateGeometry()
update pre-computed geometry information
Definition: GNEPerson.cpp:298
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration asociated with this GLObject
Definition: GNEPerson.cpp:326
const RGBColor & getColor() const
get color
Definition: GNEPerson.cpp:292
GNEPerson(const GNEPerson &)=delete
Invalidated copy constructor.
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEPerson.cpp:704
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNEPerson.cpp:222
GNELane * getLastPathLane() const
get last path lane
Definition: GNEPerson.cpp:460
Position getAttributePosition(SumoXMLAttr key) const
Definition: GNEPerson.cpp:530
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GNEPerson.cpp:764
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEPerson.cpp:280
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNEPerson.cpp:933
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some vehicle function
Definition: GNEPerson.cpp:773
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEPerson.cpp:729
std::string getBegin() const
get begin time of demand element
Definition: GNEPerson.cpp:203
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEPerson.cpp:682
~GNEPerson()
destructor
Definition: GNEPerson.cpp:180
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
Definition: GNEPerson.cpp:755
SUMOVehicleClass getVClass() const
Definition: GNEPerson.cpp:286
void computePathElement()
compute pathElement
Definition: GNEPerson.cpp:432
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEPerson.cpp:320
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEPerson.cpp:593
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEPerson.cpp:350
void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters)
method for enable or disable the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNEPerson.cpp:924
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEPerson.cpp:698
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:566
GNEPerson(SumoXMLTag tag, GNENet *net)
default constructor
Definition: GNEPerson.cpp:163
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition: GNEPerson.cpp:467
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEPerson.cpp:332
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEPerson.cpp:515
Problem isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNEPerson.cpp:266
GNELane * getFirstPathLane() const
get first path lane
Definition: GNEPerson.cpp:453
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEPerson.cpp:313
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEPerson.cpp:273
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEPerson.cpp:723
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
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
Structure representing possible vehicle parameter.
SumoXMLTag tag
The vehicle tag.
double arrivalPos
arrival position
Definition: GNEPerson.h:313
const GNEDemandElement * personPlan
person plan
Definition: GNEPerson.h:301
std::vector< GNEDemandElement * > stops
stops placed in this segment
Definition: GNEPerson.h:310
std::vector< GNEAdditional * > busStops
busStops placed in this segment
Definition: GNEPerson.h:307