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-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"
27
28// ===========================================================================
29// class definitions
30// ===========================================================================
31
33
34public:
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
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
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
135
137 const RGBColor& getColor() const;
138
140
144 void updateGeometry();
145
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
275
276protected:
279
282
283private:
284 // @brief struct used for calculating person plan geometry segments
288
291
294
296 std::vector<GNEAdditional*> busStops;
297
299 std::vector<GNEDemandElement*> stops;
300
303
304 private:
307 };
308
310 void setAttribute(SumoXMLAttr key, const std::string& value);
311
313 void toggleAttribute(SumoXMLAttr key, const bool value);
314
316 void setMoveShape(const GNEMoveResult& moveResult);
317
319 void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
320
322 GNEPerson(const GNEPerson&) = delete;
323
325 GNEPerson& operator=(const GNEPerson&) = delete;
326};
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
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
class used in GUIGLObjectPopupMenu for single person transformations
Definition GNEPerson.h:68
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.
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.
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
GNEMoveOperation * getMoveOperation()
get move operation
Position getPositionInView() const
Returns position of demand element in view.
void updateGeometry()
update pre-computed geometry information
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
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
GNELane * getLastPathLane() const
get last path lane
Position getAttributePosition(SumoXMLAttr key) const
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 setMoveShape(const GNEMoveResult &moveResult)
set move shape
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
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.
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
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over lane.
const Parameterised::Map & getACParametersMap() const
get parameters map
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
double getAttributeDouble(SumoXMLAttr key) const
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
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.
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over junction.
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
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.
std::map< std::string, std::string > Map
parameters map
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:302
const GNEDemandElement * personPlan
person plan
Definition GNEPerson.h:290
std::vector< GNEDemandElement * > stops
stops placed in this segment
Definition GNEPerson.h:299
std::vector< GNEAdditional * > busStops
busStops placed in this segment
Definition GNEPerson.h:296