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>
23
24
25#include "GNEDemandElement.h"
26
27// ===========================================================================
28// class definitions
29// ===========================================================================
34
35public:
38 FXDECLARE(GNEPersonPopupMenu)
39
40 public:
47
50
52 long onCmdTransform(FXObject* obj, FXSelector, void*);
53
54 protected:
55 FOX_CONSTRUCTOR(GNEPersonPopupMenu)
56
57 private:
60
62 FXMenuCommand* myTransformToPerson;
63
66 };
67
71
72 public:
79 GNESelectedPersonsPopupMenu(GNEPerson* person, const std::vector<GNEPerson*>& selectedPerson, GUIMainWindow& app, GUISUMOAbstractView& parent);
80
83
85 long onCmdTransform(FXObject* obj, FXSelector, void*);
86
87 protected:
88 FOX_CONSTRUCTOR(GNESelectedPersonsPopupMenu)
89
90 private:
93
95 std::vector<GNEPerson*> mySelectedPersons;
96
98 FXMenuCommand* myTransformToPerson;
99
102 };
103
106
108 GNEPerson(SumoXMLTag tag, GNENet* net, GNEDemandElement* pType, const SUMOVehicleParameter& personparameters);
109
111 ~GNEPerson();
112
117
122 std::string getBegin() const;
123
127 void writeDemandElement(OutputDevice& device) const;
128
131
133 std::string getDemandElementProblem() const;
134
137
142
144 const RGBColor& getColor() const;
145
147
151 void updateGeometry();
152
156
159
167
171 std::string getParentName() const;
172
174 double getExaggeration(const GUIVisualizationSettings& s) const;
175
180
182 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
183
188 void drawGL(const GUIVisualizationSettings& s) const;
189
191
194
196 void computePathElement();
197
204 void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const;
205
213 void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* segment, const double offsetFront) const;
214
216 GNELane* getFirstPathLane() const;
217
219 GNELane* getLastPathLane() const;
221
224 /* @brief method for getting the Attribute of an XML key
225 * @param[in] key The attribute key
226 * @return string with the value associated to key
227 */
228 std::string getAttribute(SumoXMLAttr key) const;
229
230 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
231 * @param[in] key The attribute key
232 * @return double with the value associated to key
233 */
234 double getAttributeDouble(SumoXMLAttr key) const;
235
236 /* @brief method for getting the Attribute of an XML key in Position format (used in person plans)
237 * @param[in] key The attribute key
238 * @return double with the value associated to key
239 */
241
242 /* @brief method for setting the attribute and letting the object perform demand element changes
243 * @param[in] key The attribute key
244 * @param[in] value The new value
245 * @param[in] undoList The undoList on which to register changes
246 * @param[in] net optionally the GNENet to inform about gui updates
247 */
248 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
249
250 /* @brief method for setting the attribute and letting the object perform demand element changes
251 * @param[in] key The attribute key
252 * @param[in] value The new value
253 * @param[in] undoList The undoList on which to register changes
254 */
255 bool isValid(SumoXMLAttr key, const std::string& value);
256
257 /* @brief method for enable attribute
258 * @param[in] key The attribute key
259 * @param[in] undoList The undoList on which to register changes
260 * @note certain attributes can be only enabled, and can produce the disabling of other attributes
261 */
262 void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
263
264 /* @brief method for disable attribute
265 * @param[in] key The attribute key
266 * @param[in] undoList The undoList on which to register changes
267 * @note certain attributes can be only enabled, and can produce the disabling of other attributes
268 */
269 void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
270
271 /* @brief method for check if the value for certain attribute is set
272 * @param[in] key The attribute key
273 */
274 bool isAttributeEnabled(SumoXMLAttr key) const;
275
277 std::string getPopUpID() const;
278
280 std::string getHierarchyName() const;
282
285
286protected:
288 void setColor(const GUIVisualizationSettings& s) const;
289
291 bool setFunctionalColor(int activeScheme) const;
292
293private:
294 // @brief struct used for calculating person plan geometry segments
298
301
304
306 std::vector<GNEAdditional*> busStops;
307
309 std::vector<GNEDemandElement*> stops;
310
313
314 private:
317 };
318
320 void setAttribute(SumoXMLAttr key, const std::string& value);
321
323 void toggleAttribute(SumoXMLAttr key, const bool value);
324
326 void setMoveShape(const GNEMoveResult& moveResult);
327
329 void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
330
332 GNEPerson(const GNEPerson&) = delete;
333
335 GNEPerson& operator=(const GNEPerson&) = delete;
336};
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 belong to GNENet but has influence 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:37
FXMenuCommand * myTransformToPersonFlow
menu command for transform to personFlow
Definition: GNEPerson.h:65
GNEPerson * myPerson
current person
Definition: GNEPerson.h:59
GNEPersonPopupMenu(GNEPerson *person, GUIMainWindow &app, GUISUMOAbstractView &parent)
Constructor.
Definition: GNEPerson.cpp:57
FXMenuCommand * myTransformToPerson
menu command for transform to person
Definition: GNEPerson.h:62
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current person to another person type.
Definition: GNEPerson.cpp:97
~GNEPersonPopupMenu()
Destructor.
Definition: GNEPerson.cpp:93
class used in GUIGLObjectPopupMenu for single person transformations
Definition: GNEPerson.h:69
GNESelectedPersonsPopupMenu(GNEPerson *person, const std::vector< GNEPerson * > &selectedPerson, GUIMainWindow &app, GUISUMOAbstractView &parent)
Constructor.
Definition: GNEPerson.cpp:111
SumoXMLTag myPersonTag
tag of clicked person
Definition: GNEPerson.h:92
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current person to another person type.
Definition: GNEPerson.cpp:146
FXMenuCommand * myTransformToPerson
menu command for transform to person
Definition: GNEPerson.h:98
std::vector< GNEPerson * > mySelectedPersons
current selected persons
Definition: GNEPerson.h:95
FXMenuCommand * myTransformToPersonFlow
menu command for transform to personFlow
Definition: GNEPerson.h:101
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEPerson.cpp:367
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
Definition: GNEPerson.cpp:471
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNEPerson.cpp:969
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNEPerson.cpp:191
Position getPositionInView() const
Returns position of demand element in view.
Definition: GNEPerson.cpp:318
void updateGeometry()
update pre-computed geometry information
Definition: GNEPerson.cpp:309
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
Definition: GNEPerson.cpp:337
const RGBColor & getColor() const
get color
Definition: GNEPerson.cpp:303
GNEPerson(const GNEPerson &)=delete
Invalidated copy constructor.
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEPerson.cpp:749
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
Definition: GNEPerson.cpp:224
GNELane * getLastPathLane() const
get last path lane
Definition: GNEPerson.cpp:490
Position getAttributePosition(SumoXMLAttr key) const
Definition: GNEPerson.cpp:573
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GNEPerson.cpp:791
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEPerson.cpp:291
void toggleAttribute(SumoXMLAttr key, const bool value)
method for enable or disable the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNEPerson.cpp:953
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNEPerson.cpp:959
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some vehicle function
Definition: GNEPerson.cpp:800
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEPerson.cpp:776
std::string getBegin() const
get begin time of demand element
Definition: GNEPerson.cpp:210
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEPerson.cpp:715
~GNEPerson()
destructor
Definition: GNEPerson.cpp:187
SUMOVehicleClass getVClass() const
Definition: GNEPerson.cpp:297
void computePathElement()
compute pathElement
Definition: GNEPerson.cpp:462
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEPerson.cpp:331
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEPerson.cpp:637
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEPerson.cpp:361
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEPerson.cpp:732
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:609
GNEPerson(SumoXMLTag tag, GNENet *net)
default constructor
Definition: GNEPerson.cpp:164
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition: GNEPerson.cpp:497
const Parameterised::Map & getACParametersMap() const
get parameters map
Definition: GNEPerson.cpp:782
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEPerson.cpp:343
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEPerson.cpp:555
Problem isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNEPerson.cpp:271
GNELane * getFirstPathLane() const
get first path lane
Definition: GNEPerson.cpp:483
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEPerson.cpp:324
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEPerson.cpp:281
GNEPerson & operator=(const GNEPerson &)=delete
Invalidated assignment operator.
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEPerson.cpp:770
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:312
const GNEDemandElement * personPlan
person plan
Definition: GNEPerson.h:300
std::vector< GNEDemandElement * > stops
stops placed in this segment
Definition: GNEPerson.h:309
std::vector< GNEAdditional * > busStops
busStops placed in this segment
Definition: GNEPerson.h:306