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-2023 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:
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
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
class used in GUIGLObjectPopupMenu for single person transformations
Definition GNEPerson.h:69
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.
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.
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial 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_EnableAttribute)
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some vehicle function
RGBColor setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
std::string getBegin() const
get begin time of demand element
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
~GNEPerson()
destructor
SUMOVehicleClass getVClass() const
void computePathElement()
compute pathElement
std::string getParentName() const
Returns the name of the parent object.
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
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 writed into XML (by default true, can be reimplemented...
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.
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: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