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.dev/sumo
3 // Copyright (C) 2001-2024 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 #include "GNEDemandElement.h"
26 #include "GNEDemandElementFlow.h"
27 
28 // ===========================================================================
29 // class definitions
30 // ===========================================================================
31 
33 
34 public:
37  FXDECLARE(GNEPersonPopupMenu)
38 
39  public:
46 
49 
51  long onCmdTransform(FXObject* obj, FXSelector, void*);
52 
53  protected:
54  FOX_CONSTRUCTOR(GNEPersonPopupMenu)
55 
56  private:
59 
61  FXMenuCommand* myTransformToPerson;
62 
64  FXMenuCommand* myTransformToPersonFlow;
65  };
66 
70 
71  public:
78  GNESelectedPersonsPopupMenu(GNEPerson* person, const std::vector<GNEPerson*>& selectedPerson, GUIMainWindow& app, GUISUMOAbstractView& parent);
79 
82 
84  long onCmdTransform(FXObject* obj, FXSelector, void*);
85 
86  protected:
87  FOX_CONSTRUCTOR(GNESelectedPersonsPopupMenu)
88 
89  private:
92 
94  std::vector<GNEPerson*> mySelectedPersons;
95 
97  FXMenuCommand* myTransformToPerson;
98 
100  FXMenuCommand* myTransformToPersonFlow;
101  };
102 
105 
107  GNEPerson(SumoXMLTag tag, GNENet* net, GNEDemandElement* pType, const SUMOVehicleParameter& personparameters);
108 
110  ~GNEPerson();
111 
116 
120  void writeDemandElement(OutputDevice& device) const;
121 
124 
126  std::string getDemandElementProblem() const;
127 
130 
134  SUMOVehicleClass getVClass() const;
135 
137  const RGBColor& getColor() const;
138 
140 
144  void updateGeometry();
145 
147  Position getPositionInView() const;
149 
152 
160 
164  std::string getParentName() const;
165 
167  double getExaggeration(const GUIVisualizationSettings& s) const;
168 
173 
175  void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
176 
181  void drawGL(const GUIVisualizationSettings& s) const;
182 
184 
187 
189  void computePathElement();
190 
196  void drawLanePartialGL(const GUIVisualizationSettings& s, const GNEPathManager::Segment* segment, const double offsetFront) const;
197 
203  void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNEPathManager::Segment* segment, const double offsetFront) const;
204 
206  GNELane* getFirstPathLane() const;
207 
209  GNELane* getLastPathLane() const;
211 
214  /* @brief method for getting the Attribute of an XML key
215  * @param[in] key The attribute key
216  * @return string with the value associated to key
217  */
218  std::string getAttribute(SumoXMLAttr key) const;
219 
220  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
221  * @param[in] key The attribute key
222  * @return double with the value associated to key
223  */
224  double getAttributeDouble(SumoXMLAttr key) const;
225 
226  /* @brief method for getting the Attribute of an XML key in Position format (used in person plans)
227  * @param[in] key The attribute key
228  * @return double with the value associated to key
229  */
231 
232  /* @brief method for setting the attribute and letting the object perform demand element changes
233  * @param[in] key The attribute key
234  * @param[in] value The new value
235  * @param[in] undoList The undoList on which to register changes
236  * @param[in] net optionally the GNENet to inform about gui updates
237  */
238  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
239 
240  /* @brief method for setting the attribute and letting the object perform demand element changes
241  * @param[in] key The attribute key
242  * @param[in] value The new value
243  * @param[in] undoList The undoList on which to register changes
244  */
245  bool isValid(SumoXMLAttr key, const std::string& value);
246 
247  /* @brief method for enable attribute
248  * @param[in] key The attribute key
249  * @param[in] undoList The undoList on which to register changes
250  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
251  */
252  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
253 
254  /* @brief method for disable attribute
255  * @param[in] key The attribute key
256  * @param[in] undoList The undoList on which to register changes
257  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
258  */
259  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
260 
261  /* @brief method for check if the value for certain attribute is set
262  * @param[in] key The attribute key
263  */
264  bool isAttributeEnabled(SumoXMLAttr key) const;
265 
267  std::string getPopUpID() const;
268 
270  std::string getHierarchyName() const;
272 
274  const Parameterised::Map& getACParametersMap() const;
275 
276 protected:
279 
282 
284  bool setFunctionalColor(int activeScheme) const;
285 
286 private:
287  // @brief struct used for calculating person plan geometry segments
290  personPlanSegment(GNEDemandElement* _personPlan);
291 
294 
297 
299  std::vector<GNEAdditional*> busStops;
300 
302  std::vector<GNEDemandElement*> stops;
303 
305  double arrivalPos;
306 
307  private:
310  };
311 
313  void setAttribute(SumoXMLAttr key, const std::string& value);
314 
316  void toggleAttribute(SumoXMLAttr key, const bool value);
317 
319  void setMoveShape(const GNEMoveResult& moveResult);
320 
322  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
323 
325  GNEPerson(const GNEPerson&) = delete;
326 
328  GNEPerson& operator=(const GNEPerson&) = delete;
329 };
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
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:36
FXMenuCommand * myTransformToPersonFlow
menu command for transform to personFlow
Definition: GNEPerson.h:64
GNEPerson * myPerson
current person
Definition: GNEPerson.h:58
GNEPersonPopupMenu(GNEPerson *person, GUIMainWindow &app, GUISUMOAbstractView &parent)
Constructor.
Definition: GNEPerson.cpp:53
FXMenuCommand * myTransformToPerson
menu command for transform to person
Definition: GNEPerson.h:61
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current person to another person type.
Definition: GNEPerson.cpp:93
~GNEPersonPopupMenu()
Destructor.
Definition: GNEPerson.cpp:89
class used in GUIGLObjectPopupMenu for single person transformations
Definition: GNEPerson.h:68
GNESelectedPersonsPopupMenu(GNEPerson *person, const std::vector< GNEPerson * > &selectedPerson, GUIMainWindow &app, GUISUMOAbstractView &parent)
Constructor.
Definition: GNEPerson.cpp:107
SumoXMLTag myPersonTag
tag of clicked person
Definition: GNEPerson.h:91
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current person to another person type.
Definition: GNEPerson.cpp:142
FXMenuCommand * myTransformToPerson
menu command for transform to person
Definition: GNEPerson.h:97
std::vector< GNEPerson * > mySelectedPersons
current selected persons
Definition: GNEPerson.h:94
FXMenuCommand * myTransformToPersonFlow
menu command for transform to personFlow
Definition: GNEPerson.h:100
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEPerson.cpp:328
GNEPerson & operator=(const GNEPerson &)=delete
Invalidated assignment operator.
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNEPerson.cpp:783
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNEPerson.cpp:186
Position getPositionInView() const
Returns position of demand element in view.
Definition: GNEPerson.cpp:279
void updateGeometry()
update pre-computed geometry information
Definition: GNEPerson.cpp:270
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
Definition: GNEPerson.cpp:298
const RGBColor & getColor() const
get color
Definition: GNEPerson.cpp:264
GNEPerson(const GNEPerson &)=delete
Invalidated copy constructor.
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEPerson.cpp:601
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
Definition: GNEPerson.cpp:205
GNELane * getLastPathLane() const
get last path lane
Definition: GNEPerson.cpp:457
Position getAttributePosition(SumoXMLAttr key) const
Definition: GNEPerson.cpp:511
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEPerson.cpp:252
void toggleAttribute(SumoXMLAttr key, const bool value)
method for enable or disable the attribute and nothing else (used in GNEChange_ToggleAttribute)
Definition: GNEPerson.cpp:767
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNEPerson.cpp:773
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some vehicle function
Definition: GNEPerson.cpp:640
RGBColor setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GNEPerson.cpp:628
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEPerson.cpp:613
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEPerson.cpp:589
~GNEPerson()
destructor
Definition: GNEPerson.cpp:182
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition: GNEPerson.cpp:258
void computePathElement()
compute pathElement
Definition: GNEPerson.cpp:429
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEPerson.cpp:292
GNEContour myPersonContour
variable used for contours
Definition: GNEPerson.h:278
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEPerson.cpp:560
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEPerson.cpp:322
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEPerson.cpp:595
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:541
GNEPerson(SumoXMLTag tag, GNENet *net)
default constructor
Definition: GNEPerson.cpp:160
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition: GNEPerson.cpp:464
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over lane.
Definition: GNEPerson.cpp:438
const Parameterised::Map & getACParametersMap() const
get parameters map
Definition: GNEPerson.cpp:619
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEPerson.cpp:304
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEPerson.cpp:496
Problem isDemandElementValid() const
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
Definition: GNEPerson.cpp:232
GNELane * getFirstPathLane() const
get first path lane
Definition: GNEPerson.cpp:450
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEPerson.cpp:285
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEPerson.cpp:242
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over junction.
Definition: GNEPerson.cpp:444
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEPerson.cpp:607
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
std::map< std::string, std::string > Map
parameters map
Definition: Parameterised.h:45
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:305
const GNEDemandElement * personPlan
person plan
Definition: GNEPerson.h:293
std::vector< GNEDemandElement * > stops
stops placed in this segment
Definition: GNEPerson.h:302
std::vector< GNEAdditional * > busStops
busStops placed in this segment
Definition: GNEPerson.h:299