Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
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-2025 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"
27
28// ===========================================================================
29// class declaration
30// ===========================================================================
31
33
34// ===========================================================================
35// class definitions
36// ===========================================================================
37
39
40public:
43 FXDECLARE(GNEPersonPopupMenu)
44
45 public:
52
55
57 long onCmdTransform(FXObject* obj, FXSelector, void*);
58
59 protected:
60 FOX_CONSTRUCTOR(GNEPersonPopupMenu)
61
62 private:
65
67 FXMenuCommand* myTransformToPerson;
68
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:
93 FOX_CONSTRUCTOR(GNESelectedPersonsPopupMenu)
94
95 private:
98
100 std::vector<GNEPerson*> mySelectedPersons;
101
103 FXMenuCommand* myTransformToPerson;
104
107 };
108
111
113 GNEPerson(SumoXMLTag tag, GNENet* net, const std::string& filename, GNEDemandElement* pType, const SUMOVehicleParameter& personparameters);
114
116 ~GNEPerson();
117
120
122 GNEMoveElement* getMoveElement() const override;
123
125 Parameterised* getParameters() override;
126
128 const Parameterised* getParameters() const override;
129
131
135 void writeDemandElement(OutputDevice& device) const;
136
139
141 std::string getDemandElementProblem() const;
142
145
150
152 const RGBColor& getColor() const;
153
155
159 void updateGeometry() override;
160
164
167
175
179 std::string getParentName() const;
180
182 double getExaggeration(const GUIVisualizationSettings& s) const;
183
188
190 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
191
196 void drawGL(const GUIVisualizationSettings& s) const;
197
199
202
204 void computePathElement();
205
211 void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;
212
218 void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;
219
221 GNELane* getFirstPathLane() const;
222
224 GNELane* getLastPathLane() const;
226
229 /* @brief method for getting the Attribute of an XML key
230 * @param[in] key The attribute key
231 * @return string with the value associated to key
232 */
233 std::string getAttribute(SumoXMLAttr key) const override;
234
235 /* @brief method for getting the Attribute of an XML key in double format
236 * @param[in] key The attribute key
237 * @return double with the value associated to key
238 */
239 double getAttributeDouble(SumoXMLAttr key) const override;
240
241 /* @brief method for getting the Attribute of an XML key in position format
242 * @param[in] key The attribute key
243 * @return position with the value associated to key
244 */
245 Position getAttributePosition(SumoXMLAttr key) const override;
246
247 /* @brief method for setting the attribute and letting the object perform demand element changes
248 * @param[in] key The attribute key
249 * @param[in] value The new value
250 * @param[in] undoList The undoList on which to register changes
251 * @param[in] net optionally the GNENet to inform about gui updates
252 */
253 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
254
255 /* @brief method for setting the attribute and letting the object perform demand element changes
256 * @param[in] key The attribute key
257 * @param[in] value The new value
258 * @param[in] undoList The undoList on which to register changes
259 */
260 bool isValid(SumoXMLAttr key, const std::string& value) override;
261
262 /* @brief method for enable attribute
263 * @param[in] key The attribute key
264 * @param[in] undoList The undoList on which to register changes
265 * @note certain attributes can be only enabled, and can produce the disabling of other attributes
266 */
267 void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
268
269 /* @brief method for disable attribute
270 * @param[in] key The attribute key
271 * @param[in] undoList The undoList on which to register changes
272 * @note certain attributes can be only enabled, and can produce the disabling of other attributes
273 */
274 void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
275
276 /* @brief method for check if the value for certain attribute is set
277 * @param[in] key The attribute key
278 */
279 bool isAttributeEnabled(SumoXMLAttr key) const;
280
282 std::string getPopUpID() const override;
283
285 std::string getHierarchyName() const override;
287
288protected:
291
294
297
298private:
299 // @brief struct used for calculating person plan geometry segments
303
306
309
311 std::vector<GNEAdditional*> busStops;
312
314 std::vector<GNEDemandElement*> stops;
315
318
319 private:
322 };
323
325 void setAttribute(SumoXMLAttr key, const std::string& value) override;
326
328 void toggleAttribute(SumoXMLAttr key, const bool value);
329
331 GNEPerson(const GNEPerson&) = delete;
332
334 GNEPerson& operator=(const GNEPerson&) = delete;
335};
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 NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
class used in GUIGLObjectPopupMenu for person transformations
Definition GNEPerson.h:42
FXMenuCommand * myTransformToPersonFlow
menu command for transform to personFlow
Definition GNEPerson.h:70
GNEPerson * myPerson
current person
Definition GNEPerson.h:64
FXMenuCommand * myTransformToPerson
menu command for transform to person
Definition GNEPerson.h:67
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current person to another person type.
Definition GNEPerson.cpp:85
class used in GUIGLObjectPopupMenu for single person transformations
Definition GNEPerson.h:74
SumoXMLTag myPersonTag
tag of clicked person
Definition GNEPerson.h:97
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current person to another person type.
FXMenuCommand * myTransformToPerson
menu command for transform to person
Definition GNEPerson.h:103
std::vector< GNEPerson * > mySelectedPersons
current selected persons
Definition GNEPerson.h:100
FXMenuCommand * myTransformToPersonFlow
menu command for transform to personFlow
Definition GNEPerson.h:106
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Position getPositionInView() const
Returns position of demand element in view.
double getAttributeDouble(SumoXMLAttr key) const override
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
const RGBColor & getColor() const
get color
GNEPerson(const GNEPerson &)=delete
Invalidated copy constructor.
bool isAttributeEnabled(SumoXMLAttr key) const
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
std::string getAttribute(SumoXMLAttr key) const override
inherited from GNEAttributeCarrier
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
bool isValid(SumoXMLAttr key, const std::string &value) override
GNELane * getLastPathLane() const
get last path lane
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
void toggleAttribute(SumoXMLAttr key, const bool value)
method for enable or disable the attribute and nothing else (used in GNEChange_ToggleAttribute)
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over lane.
RGBColor getDrawingColor(const GUIVisualizationSettings &s) const
get drawing color
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
~GNEPerson()
destructor
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
void computePathElement()
compute pathElement
std::string getParentName() const
Returns the name of the parent object.
Parameterised * getParameters() override
get parameters associated with this person
GNEContour myPersonContour
variable used for contours
Definition GNEPerson.h:293
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
void updateGeometry() override
update pre-computed geometry information
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
GNEMoveElementPlanParent * myMoveElementPlanParent
move element plan parent
Definition GNEPerson.h:290
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
Problem isDemandElementValid() const
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
GNELane * getFirstPathLane() const
get first path lane
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over junction.
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
GNEPerson & operator=(const GNEPerson &)=delete
Invalidated assignment operator.
Position getAttributePosition(SumoXMLAttr key) const override
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this person
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.
An upper class for objects with additional parameters.
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:317
const GNEDemandElement * personPlan
person plan
Definition GNEPerson.h:305
std::vector< GNEDemandElement * > stops
stops placed in this segment
Definition GNEPerson.h:314
std::vector< GNEAdditional * > busStops
busStops placed in this segment
Definition GNEPerson.h:311