Eclipse SUMO - Simulation of Urban MObility
GUIPerson.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/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/****************************************************************************/
20// A MSPerson extended by some values for usage within the gui
21/****************************************************************************/
22#include <config.h>
23
37
38#include "GUILane.h"
39#include "GUIPerson.h"
40
41//#define GUIPerson_DEBUG_DRAW_WALKINGAREA_PATHS 1
42
43// ===========================================================================
44// FOX callback mapping
45// ===========================================================================
46
47FXDEFMAP(GUIPerson::GUIPersonPopupMenu) GUIPersonPopupMenuMap[] = {
56};
57
58// Object implementation
59FXIMPLEMENT(GUIPerson::GUIPersonPopupMenu, GUIGLObjectPopupMenu, GUIPersonPopupMenuMap, ARRAYNUMBER(GUIPersonPopupMenuMap))
60
61// ===========================================================================
62// method definitions
63// ===========================================================================
64
65// -------------------------------------------------------------------------
66// GUIPerson::GUIPersonPopupMenu - methods
67// -------------------------------------------------------------------------
68
71 GUIGLObjectPopupMenu(app, parent, o) {
72}
73
74
76
77
78long
80 assert(myObject->getType() == GLO_PERSON);
81 if (!static_cast<GUIPerson*>(myObject)->hasActiveAddVisualisation(myParent, VO_SHOW_ROUTE)) {
82 static_cast<GUIPerson*>(myObject)->addActiveAddVisualisation(myParent, VO_SHOW_ROUTE);
83 }
84 return 1;
85}
86
87
88long
90 assert(myObject->getType() == GLO_PERSON);
91 static_cast<GUIPerson*>(myObject)->removeActiveAddVisualisation(myParent, VO_SHOW_ROUTE);
92 return 1;
93}
94
95
96long
98 assert(myObject->getType() == GLO_PERSON);
99 if (!static_cast<GUIPerson*>(myObject)->hasActiveAddVisualisation(myParent, VO_SHOW_WALKINGAREA_PATH)) {
100 static_cast<GUIPerson*>(myObject)->addActiveAddVisualisation(myParent, VO_SHOW_WALKINGAREA_PATH);
101 }
102 return 1;
103}
104
105
106long
108 assert(myObject->getType() == GLO_PERSON);
109 static_cast<GUIPerson*>(myObject)->removeActiveAddVisualisation(myParent, VO_SHOW_WALKINGAREA_PATH);
110 return 1;
111}
112
113
114long
115GUIPerson::GUIPersonPopupMenu::onCmdShowPlan(FXObject*, FXSelector, void*) {
116 GUIPerson* p = dynamic_cast<GUIPerson*>(myObject);
117 if (p == nullptr) {
118 return 1;
119 }
120 GUIParameterTableWindow* ret = new GUIParameterTableWindow(*myApplication, *p);
121 // add items
122 for (int stage = 1; stage < p->getNumStages(); stage++) {
123 ret->mkItem(toString(stage).c_str(), false, p->getStageSummary(stage));
124 }
125 // close building (use an object that is not Parameterised as argument)
126 Parameterised dummyParameterised;
127 ret->closeBuilding(&dummyParameterised);
128 return 1;
129}
130
131
132long
134 assert(myObject->getType() == GLO_PERSON);
135 if (myParent->getTrackedID() != static_cast<GUIPerson*>(myObject)->getGlID()) {
136 myParent->startTrack(static_cast<GUIPerson*>(myObject)->getGlID());
137 }
138 return 1;
139}
140
141
142long
144 assert(myObject->getType() == GLO_PERSON);
145 myParent->stopTrack();
146 return 1;
147}
148
149
150long
152 GUIPerson* person = static_cast<GUIPerson*>(myObject);
153 MSStage* stage = person->getCurrentStage();
154 stage->abort(person);
155 stage->getEdge()->removeTransportable(person);
156 if (stage->getDestinationStop() != nullptr) {
157 stage->getDestinationStop()->removeTransportable(person);
158 }
160 myParent->update();
161 return 1;
162}
163
164// -------------------------------------------------------------------------
165// GUIPerson - methods
166// -------------------------------------------------------------------------
167
169 MSPerson(pars, vtype, plan, speedFactor),
170 GUIGlObject(GLO_PERSON, pars->id, GUIIconSubSys::getIcon(GUIIcon::PERSON)),
171 myLock(true)
172{ }
173
174
176 myLock.lock();
177 for (std::map<GUISUMOAbstractView*, int>::iterator i = myAdditionalVisualizations.begin(); i != myAdditionalVisualizations.end(); ++i) {
178 if (i->first->getTrackedID() == getGlID()) {
179 i->first->stopTrack();
180 }
181 while (i->first->removeAdditionalGLVisualisation(this));
182 }
183 myLock.unlock();
184}
185
186
189 GUIGLObjectPopupMenu* ret = new GUIPersonPopupMenu(app, parent, *this);
190 buildPopupHeader(ret, app);
195 GUIDesigns::buildFXMenuCommand(ret, "Hide Current Route", nullptr, ret, MID_HIDE_CURRENTROUTE);
196 } else {
197 GUIDesigns::buildFXMenuCommand(ret, "Show Current Route", nullptr, ret, MID_SHOW_CURRENTROUTE);
198 }
200 GUIDesigns::buildFXMenuCommand(ret, "Hide Walkingarea Path", nullptr, ret, MID_HIDE_WALKINGAREA_PATH);
201 } else {
202 GUIDesigns::buildFXMenuCommand(ret, "Show Walkingarea Path", nullptr, ret, MID_SHOW_WALKINGAREA_PATH);
203 }
204 new FXMenuSeparator(ret);
205 if (parent.getTrackedID() != getGlID()) {
206 GUIDesigns::buildFXMenuCommand(ret, "Start Tracking", nullptr, ret, MID_START_TRACK);
207 } else {
208 GUIDesigns::buildFXMenuCommand(ret, "Stop Tracking", nullptr, ret, MID_STOP_TRACK);
209 }
210 GUIDesigns::buildFXMenuCommand(ret, "Remove", nullptr, ret, MID_REMOVE_OBJECT);
211 new FXMenuSeparator(ret);
212 //
216 new FXMenuSeparator(ret);
217 buildPositionCopyEntry(ret, app);
218 return ret;
219}
220
221
226 // add items
228 // there is always the "start" stage which we do not count here because it is not strictly part of the plan
230 ret->mkItem("start edge [id]", true, new FunctionBindingString<GUIPerson>(this, &GUIPerson::getFromEdgeID));
231 ret->mkItem("dest edge [id]", true, new FunctionBindingString<GUIPerson>(this, &GUIPerson::getDestinationEdgeID));
232 ret->mkItem("dest stop [id]", true, new FunctionBindingString<GUIPerson>(this, &GUIPerson::getDestinationStopID));
233 ret->mkItem("arrivalPos [m]", true, new FunctionBinding<GUIPerson, double>(this, &GUIPerson::getStageArrivalPos));
234 ret->mkItem("edge [id]", true, new FunctionBindingString<GUIPerson>(this, &GUIPerson::getEdgeID));
235 ret->mkItem("position [m]", true, new FunctionBinding<GUIPerson, double>(this, &GUIPerson::getEdgePos));
236 ret->mkItem("speed [m/s]", true, new FunctionBinding<GUIPerson, double>(this, &GUIPerson::getSpeed));
237 ret->mkItem("speed factor", false, getChosenSpeedFactor());
238 ret->mkItem("angle [degree]", true, new FunctionBinding<GUIPerson, double>(this, &GUIPerson::getNaviDegree));
239 ret->mkItem("waiting time [s]", true, new FunctionBinding<GUIPerson, double>(this, &GUIPerson::getWaitingSeconds));
240 ret->mkItem("vehicle [id]", true, new FunctionBindingString<GUIPerson>(this, &GUIPerson::getVehicleID));
241 ret->mkItem("stop duration [s]", true, new FunctionBinding<GUIPerson, double>(this, &GUIPerson::getStopDuration));
242 ret->mkItem("desired depart [s]", false, time2string(getParameter().depart));
243 // close building
245 return ret;
246}
247
248
253 // add items
254 ret->mkItem("Type Information:", false, "");
255 ret->mkItem("type [id]", false, myVType->getID());
256 ret->mkItem("length", false, myVType->getLength());
257 ret->mkItem("width", false, myVType->getWidth());
258 ret->mkItem("height", false, myVType->getHeight());
259 ret->mkItem("minGap", false, myVType->getMinGap());
260 ret->mkItem("desired max speed [m/s]", false, myVType->getDesiredMaxSpeed());
261 ret->mkItem("maximum speed [m/s]", false, myVType->getMaxSpeed());
262 // close building
264 return ret;
265}
266
267
268double
270 return s.personSize.getExaggeration(s, this, s.personQuality == 1 ? 40 : 80);
271}
272
273
276 Boundary b;
277 // ensure that the vehicle is drawn, otherwise myPositionInVehicle will not be updated
278 b.add(getGUIPosition());
279 b.grow(MAX2(getVehicleType().getWidth(), getVehicleType().getLength()));
280 return b;
281}
282
283
284void
288 Position p1 = getGUIPosition(&s);
289 double angle = getGUIAngle();
290 glTranslated(p1.x(), p1.y(), getType());
291 // set person color
292 setColor(s);
293 // scale
294 const double exaggeration = getExaggeration(s);
295 glScaled(exaggeration, exaggeration, 1);
296 switch (s.personQuality) {
297 case 0:
299 break;
300 case 1:
301 GUIBasePersonHelper::drawAction_drawAsCircle(angle, getVehicleType().getLength(), getVehicleType().getWidth(), s.scale * exaggeration);
302 break;
303 case 2:
305 break;
306 case 3:
307 default:
309 getVehicleType().getImgFile(), getVehicleType().getGuiShape(), 1);
310 break;
311 }
313#ifdef GUIPerson_DEBUG_DRAW_WALKINGAREA_PATHS
315#endif
316 drawName(p1, s.scale, s.personName, s.angle);
317 if (s.personValue.show(this)) {
318 Position p2 = p1 + Position(0, 0.6 * s.personName.scaledSize(s.scale));
319 const double value = getColorValue(s, s.personColorer.getActive());
321 }
323}
324
325
326void
329 if (stage != nullptr) {
330 setColor(s);
331 MSPModel_Striping::PState* stripingState = dynamic_cast<MSPModel_Striping::PState*>(stage->getState());
332 if (stripingState != nullptr) {
333 const MSPModel_Striping::WalkingAreaPath* waPath = stripingState->myWalkingAreaPath;
334 if (waPath != nullptr) {
336 glTranslated(0, 0, getType());
337 GLHelper::drawBoxLines(waPath->shape, 0.05);
339 }
340 }
341 }
342}
343
344void
348 glTranslated(0, 0, getType() - .1); // don't draw on top of other cars
351 }
354 setColor(s);
355 RGBColor current = GLHelper::getColor();
356 RGBColor darker = current.changedBrightness(-51);
357 GLHelper::setColor(darker);
359 assert(stage != 0);
360 const double exaggeration = getExaggeration(s);
361 const ConstMSEdgeVector& edges = stage->getRoute();
362 const bool s2 = s.secondaryShape;
363 for (ConstMSEdgeVector::const_iterator it = edges.begin(); it != edges.end(); ++it) {
364 GUILane* lane = static_cast<GUILane*>((*it)->getLanes()[0]);
365 GLHelper::drawBoxLines(lane->getShape(s2), lane->getShapeRotations(s2), lane->getShapeLengths(s2), exaggeration);
366 }
367 }
368 }
371}
372
373
374void
377}
378
379
380void
382 RGBColor col;
383 const GUIColorer& c = s.personColorer;
384 if (!setFunctionalColor(c.getActive(), this, col)) {
385 col = c.getScheme().getColor(getColorValue(s, c.getActive()));
386 }
388}
389
390
391bool
392GUIPerson::setFunctionalColor(int activeScheme, const MSPerson* person, RGBColor& col) {
393 switch (activeScheme) {
394 case 0: {
395 if (person->getParameter().wasSet(VEHPARS_COLOR_SET)) {
396 col = person->getParameter().color;
397 return true;
398 }
400 col = person->getVehicleType().getColor();
401 return true;
402 }
403 return false;
404 }
405 case 2: {
406 if (person->getParameter().wasSet(VEHPARS_COLOR_SET)) {
407 col = person->getParameter().color;
408 return true;
409 }
410 return false;
411 }
412 case 3: {
414 col = person->getVehicleType().getColor();
415 return true;
416 }
417 return false;
418 }
419 case 9: { // color by angle
420 double hue = GeomHelper::naviDegree(person->getAngle());
421 col = RGBColor::fromHSV(hue, 1., 1.);
422 return true;
423 }
424 case 10: { // color randomly (by pointer)
425 const double hue = (double)((long long int)person % 360); // [0-360]
426 const double sat = (double)(((long long int)person / 360) % 67) / 100. + 0.33; // [0.33-1]
427 col = RGBColor::fromHSV(hue, sat, 1.);
428 return true;
429 }
430 default:
431 return false;
432 }
433}
434
435
436double
437GUIPerson::getColorValue(const GUIVisualizationSettings& /* s */, int activeScheme) const {
438 switch (activeScheme) {
439 case 4:
440 switch (getCurrentStageType()) {
442 return -1;
444 return -2;
445 default:
446 return getSpeed();
447 }
448 case 5:
449 if (isWaiting4Vehicle()) {
450 return 5;
451 } else {
452 return (double)getCurrentStageType();
453 }
454 case 6:
455 return getWaitingSeconds();
456 case 7:
457 return isJammed() ? 1 : 0;
458 case 8:
460 }
461 return 0;
462}
463
464
465double
467 FXMutexLock locker(myLock);
468 if (hasArrived()) {
469 return -1;
470 }
471 return MSPerson::getEdgePos();
472}
473
474int
476 FXMutexLock locker(myLock);
477 if (hasArrived()) {
479 }
480 return MSPerson::getDirection();
481}
482
483
486 FXMutexLock locker(myLock);
487 if (hasArrived()) {
488 return Position::INVALID;
489 }
490 return MSPerson::getPosition();
491}
492
493
496 FXMutexLock locker(myLock);
497 if (hasArrived()) {
498 return Position::INVALID;
499 }
503 } else if (isWaiting4Vehicle()
504 && s != nullptr
505 && s->gaming
506 && getCurrentStage()->getOriginStop() != nullptr
507 && s->addSize.getExaggeration(*s, nullptr) > 1) {
508 // shift position away from stop center
511 Position shifted = ref + (pos - ref) * s->personSize.getExaggeration(*s, this);
512 return shifted;
513 }
514 }
515 return MSPerson::getPosition();
516}
517
518
519double
521 FXMutexLock locker(myLock);
522 if (hasArrived()) {
523 return INVALID_DOUBLE;
524 }
527 } else {
528 return MSPerson::getAngle();
529 }
530}
531
532
533double
535 FXMutexLock locker(myLock);
536 if (hasArrived()) {
537 return INVALID_DOUBLE;
538 }
540}
541
542
543double
545 FXMutexLock locker(myLock);
546 if (hasArrived()) {
547 return -1;
548 }
550}
551
552
553double
555 FXMutexLock locker(myLock);
556 if (hasArrived()) {
557 return -1;
558 }
559 return MSPerson::getSpeed();
560}
561
562
563std::string
565 FXMutexLock locker(myLock);
566 if (hasArrived()) {
567 return "arrived";
568 }
569 return toString(getNumStages() - getNumRemainingStages()) + " of " + toString(getNumStages() - 1);
570}
571
572
573std::string
575 FXMutexLock locker(myLock);
576 if (hasArrived()) {
577 return "arrived";
578 }
579 return getEdge()->getID();
580}
581
582
583std::string
585 FXMutexLock locker(myLock);
586 if (hasArrived()) {
587 return "arrived";
588 }
589 return getFromEdge()->getID();
590}
591
592
593std::string
595 FXMutexLock locker(myLock);
596 if (hasArrived()) {
597 return "arrived";
598 }
599 return getDestination()->getID();
600}
601
602
603std::string
605 FXMutexLock locker(myLock);
606 if (hasArrived()) {
607 return "";
608 }
610 if (destStop != nullptr) {
611 return destStop->getID();
612 } else {
613 return "";
614 }
615}
616
617
618std::string
620 FXMutexLock locker(myLock);
621 if (hasArrived()) {
622 return "";
623 }
625 if (veh != nullptr) {
626 return veh->getID();
627 } else {
628 return "";
629 }
630}
631
632
633double
635 FXMutexLock locker(myLock);
636 if (hasArrived()) {
637 return -1;
638 }
640 return STEPS2TIME(dynamic_cast<MSStageWaiting*>(getCurrentStage())->getStopEnd() - SIMSTEP);
641 } else {
642 return -1;
643 }
644}
645
646
647double
649 FXMutexLock locker(myLock);
650 if (hasArrived()) {
651 return INVALID_DOUBLE;
652 }
653 return getCurrentStage()->getArrivalPos();
654}
655
656bool
657GUIPerson::proceed(MSNet* net, SUMOTime time, const bool vehicleArrived) {
658 // acquire lock before locking the person to avoid mutual deadlock (#9468)
660 FXMutexLock locker(myLock);
661 return MSTransportable::proceed(net, time, vehicleArrived);
662}
663
664// -------------------------------------------------------------------------
665// GUIPerson - Additional Visualsation methods
666// -------------------------------------------------------------------------
667
668bool
670 return myAdditionalVisualizations.find(parent) != myAdditionalVisualizations.end() && (myAdditionalVisualizations.find(parent)->second & which) != 0;
671}
672
673
674void
676 if (myAdditionalVisualizations.find(parent) == myAdditionalVisualizations.end()) {
677 myAdditionalVisualizations[parent] = 0;
678 }
679 myAdditionalVisualizations[parent] |= which;
680 parent->addAdditionalGLVisualisation(this);
681}
682
683
684void
686 myAdditionalVisualizations[parent] &= ~which;
688}
689
690bool
693}
694
695
696/****************************************************************************/
long long int SUMOTime
Definition: GUI.h:36
@ MID_HIDE_CURRENTROUTE
Hide vehicle's current route.
Definition: GUIAppEnum.h:486
@ MID_SHOWPLAN
Show transportable plan.
Definition: GUIAppEnum.h:466
@ MID_HIDE_WALKINGAREA_PATH
Hide persons's path on walkingarea.
Definition: GUIAppEnum.h:520
@ MID_SHOW_WALKINGAREA_PATH
Show persons's path on walkingarea.
Definition: GUIAppEnum.h:518
@ MID_START_TRACK
Start to track a vehicle.
Definition: GUIAppEnum.h:504
@ MID_REMOVE_OBJECT
remove a vehicle or person
Definition: GUIAppEnum.h:516
@ MID_SHOW_CURRENTROUTE
Show vehicle's current route.
Definition: GUIAppEnum.h:484
@ MID_STOP_TRACK
Stop to track a vehicle.
Definition: GUIAppEnum.h:506
@ GLO_MAX
empty max
@ GLO_PERSON
a person
GUISelectedStorage gSelected
A global holder of selected objects.
GUIIcon
An enumeration of icons used by the gui applications.
Definition: GUIIcons.h:33
FXDEFMAP(GUIPerson::GUIPersonPopupMenu) GUIPersonPopupMenuMap[]
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:74
std::string time2string(SUMOTime t)
convert SUMOTime to string
Definition: SUMOTime.cpp:68
#define STEPS2TIME(x)
Definition: SUMOTime.h:54
#define SIMSTEP
Definition: SUMOTime.h:60
const long long int VTYPEPARS_COLOR_SET
const int VEHPARS_COLOR_SET
const double INVALID_DOUBLE
invalid double
Definition: StdDefs.h:64
T MAX2(T a, T b)
Definition: StdDefs.h:82
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:78
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:300
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:583
static void pushName(unsigned int name)
push Name
Definition: GLHelper.cpp:139
static void popMatrix()
pop matrix
Definition: GLHelper.cpp:130
static void drawBoxLines(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double width, int cornerDetail=0, double offset=0)
Draws thick lines.
Definition: GLHelper.cpp:329
static RGBColor getColor()
gets the gl-color
Definition: GLHelper.cpp:589
static void popName()
pop Name
Definition: GLHelper.cpp:148
static void pushMatrix()
push matrix
Definition: GLHelper.cpp:117
static void drawTextSettings(const GUIVisualizationTextSettings &settings, const std::string &text, const Position &pos, const double scale, const double angle=0, const double layer=2048, const int align=0)
Definition: GLHelper.cpp:716
static void drawAction_drawAsPoly(const double angle, const double length, const double width)
static void drawAction_drawAsImage(const double angle, const double length, const double width, const std::string &file, const SUMOVehicleShape guiShape, const double exaggeration)
static void drawAction_drawAsCircle(const double angle, const double length, const double width, double detail)
static void drawAction_drawAsTriangle(const double angle, const double length, const double width)
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
Definition: GUIDesigns.cpp:42
The popup menu of a globject.
void buildShowTypeParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the type parameter window.
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Definition: GUIGlObject.h:154
void buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to (de)select the object.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, const GUIMainWindow &app) const
Builds an entry which allows to copy the cursor position if geo projection is used,...
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.h:102
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0, bool forceShow=false) const
draw name of item
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
Representation of a lane in the micro simulation (gui-version)
Definition: GUILane.h:60
const std::vector< double > & getShapeRotations(bool secondary) const
Definition: GUILane.cpp:1065
const PositionVector & getShape(bool secondary) const override
Definition: GUILane.cpp:1059
const std::vector< double > & getShapeLengths(bool secondary) const
Definition: GUILane.cpp:1071
A window containing a gl-object's parameter.
void mkItem(const char *name, bool dynamic, ValueSource< T > *src)
Adds a row which obtains its value from a ValueSource.
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
long onCmdStartTrack(FXObject *, FXSelector, void *)
Called if the person shall be tracked.
Definition: GUIPerson.cpp:133
long onCmdShowPlan(FXObject *, FXSelector, void *)
Called if the plan shall be shown.
Definition: GUIPerson.cpp:115
long onCmdRemoveObject(FXObject *, FXSelector, void *)
Called when removing the person.
Definition: GUIPerson.cpp:151
long onCmdHideCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the person shall be hidden.
Definition: GUIPerson.cpp:89
long onCmdHideWalkingareaPath(FXObject *, FXSelector, void *)
Called if the walkingarea path of the person shall be hidden.
Definition: GUIPerson.cpp:107
~GUIPersonPopupMenu()
Destructor.
Definition: GUIPerson.cpp:75
long onCmdStopTrack(FXObject *, FXSelector, void *)
Called if the person shall not be tracked any longer.
Definition: GUIPerson.cpp:143
long onCmdShowCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the person shall be shown.
Definition: GUIPerson.cpp:79
long onCmdShowWalkingareaPath(FXObject *, FXSelector, void *)
Called if the walkingarea path of the person shall be shown.
Definition: GUIPerson.cpp:97
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUIPerson.cpp:381
void drawAction_drawWalkingareaPath(const GUIVisualizationSettings &s) const
draw walking area path
Definition: GUIPerson.cpp:327
bool proceed(MSNet *net, SUMOTime time, const bool vehicleArrived=false) override
Definition: GUIPerson.cpp:657
double getExaggeration(const GUIVisualizationSettings &s) const override
return exaggeration associated with this GLObject
Definition: GUIPerson.cpp:269
std::string getDestinationStopID() const
get destination stop ID
Definition: GUIPerson.cpp:604
std::string getDestinationEdgeID() const
get destination edge ID
Definition: GUIPerson.cpp:594
std::string getStageIndexDescription() const
get stage index description
Definition: GUIPerson.cpp:564
Position getPosition() const override
return the Network coordinate of the person
Definition: GUIPerson.cpp:485
virtual void drawGLAdditional(GUISUMOAbstractView *const parent, const GUIVisualizationSettings &s) const override
Draws additionally triggered visualisations.
Definition: GUIPerson.cpp:345
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
Definition: GUIPerson.cpp:188
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const override
gets the color value according to the current scheme index
Definition: GUIPerson.cpp:437
~GUIPerson()
destructor
Definition: GUIPerson.cpp:175
double getGUIAngle() const
return the angle of the person (only for drawing centering and tracking)
Definition: GUIPerson.cpp:520
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIPerson.cpp:275
bool isSelected() const override
whether this person is selected in the GUI
Definition: GUIPerson.cpp:691
Position getGUIPosition(const GUIVisualizationSettings *s=nullptr) const
return the Network coordinate of the person (only for drawing centering and tracking)
Definition: GUIPerson.cpp:495
double getStopDuration() const
get remaining duration of current stop or -1
Definition: GUIPerson.cpp:634
GUIBaseVehicle::Seat myPositionInVehicle
The position of a person while riding a vehicle.
Definition: GUIPerson.h:277
std::map< GUISUMOAbstractView *, int > myAdditionalVisualizations
Enabled visualisations, per view.
Definition: GUIPerson.h:280
@ VO_SHOW_WALKINGAREA_PATH
show the current walkingarea path
Definition: GUIPerson.h:234
@ VO_SHOW_ROUTE
show persons's current route
Definition: GUIPerson.h:236
double getEdgePos() const override
Return the position on the edge.
Definition: GUIPerson.cpp:466
double getSpeed() const override
the current speed of the person
Definition: GUIPerson.cpp:554
double getNaviDegree() const
return the current angle of the person
Definition: GUIPerson.cpp:534
std::string getVehicleID() const
get current vehicle id if applicable
Definition: GUIPerson.cpp:619
GUIPerson(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan, const double speedFactor)
Constructor.
Definition: GUIPerson.cpp:168
std::string getEdgeID() const
get edge ID
Definition: GUIPerson.cpp:574
bool hasActiveAddVisualisation(GUISUMOAbstractView *const parent, int which) const
Returns whether the named feature is enabled in the given view.
Definition: GUIPerson.cpp:669
double getWaitingSeconds() const override
the time this person spent waiting in seconds
Definition: GUIPerson.cpp:544
void setPositionInVehicle(const GUIBaseVehicle::Seat &pos)
Definition: GUIPerson.cpp:375
void removeActiveAddVisualisation(GUISUMOAbstractView *const parent, int which) override
Adds the named visualisation feature to the given view.
Definition: GUIPerson.cpp:685
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own parameter window.
Definition: GUIPerson.cpp:223
FXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUIPerson.h:274
int getDirection() const override
Return the movement directon on the edge.
Definition: GUIPerson.cpp:475
std::string getFromEdgeID() const
ger from edge ID
Definition: GUIPerson.cpp:584
double getStageArrivalPos() const
get stage arrival position
Definition: GUIPerson.cpp:648
static bool setFunctionalColor(int activeScheme, const MSPerson *person, RGBColor &col)
sets the color according to the current scheme index and some vehicle function
Definition: GUIPerson.cpp:392
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own type parameter window.
Definition: GUIPerson.cpp:250
void addActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
Definition: GUIPerson.cpp:675
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
Definition: GUIPerson.cpp:285
const T getColor(const double value) const
bool removeAdditionalGLVisualisation(GUIGlObject *const which)
Removes an object from the list of objects that show additional things.
bool addAdditionalGLVisualisation(GUIGlObject *const which)
Adds an object to call its additional visualisation method.
virtual GUIGlID getTrackedID() const
get tracked id
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
Stores the information about how to visualize structures.
GUIVisualizationTextSettings personValue
GUIVisualizationSizeSettings addSize
int personQuality
The quality of person drawing.
bool gaming
whether the application is in gaming mode or not
GUIVisualizationSizeSettings personSize
GUIColorer personColorer
The person colorer.
double scale
information about a lane's width (temporary, used for a single view)
bool secondaryShape
whether secondary lane shape shall be drawn
GUIVisualizationTextSettings personName
double angle
The current view rotation angle.
static double naviDegree(const double angle)
Definition: GeomHelper.cpp:192
virtual void removeTransportable(MSTransportable *t) const
Definition: MSEdge.cpp:1095
The simulated network and simulation perfomer.
Definition: MSNet.h:88
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:183
virtual MSTransportableControl & getPersonControl()
Returns the person control.
Definition: MSNet.cpp:1159
Container for pedestrian state and individual position update function.
const WalkingAreaPath * myWalkingAreaPath
the current walkingAreaPath or 0
static const int UNDEFINED_DIRECTION
Definition: MSPModel.h:121
double getChosenSpeedFactor() const
the current speed factor of the transportable (where applicable)
Definition: MSPerson.h:265
bool isJammed() const
whether the person is jammed as defined by the current pedestrian model
Definition: MSPerson.cpp:163
virtual double getArrivalPos() const
Definition: MSStage.h:89
virtual MSStoppingPlace * getOriginStop() const
returns the origin stop (if any). only needed for MSStageTrip
Definition: MSStage.h:85
MSStoppingPlace * getDestinationStop() const
returns the destination stop (if any)
Definition: MSStage.h:80
virtual SUMOVehicle * getVehicle() const
Current vehicle in which the transportable is driving (or nullptr)
Definition: MSStage.h:162
virtual void abort(MSTransportable *)
abort this stage (TraCI)
Definition: MSStage.h:136
virtual const MSEdge * getEdge() const
Returns the current edge.
Definition: MSStage.cpp:67
const std::vector< const MSEdge * > & getRoute() const
virtual MSTransportableStateAdapter * getState() const
Definition: MSStageMoving.h:49
A lane area vehicles can halt at.
Position getCenterPos() const
the position in the middle of the stop shape
void removeTransportable(const MSTransportable *p)
Removes a transportable from this stop.
virtual void erase(MSTransportable *transportable)
removes a single transportable
const MSEdge * getFromEdge() const
Returns the departure edge.
virtual double getEdgePos() const
Return the position on the edge.
std::string getCurrentStageDescription() const
Returns the current stage description as a string.
const MSEdge * getDestination() const
Returns the current destination.
virtual double getAngle() const
return the current angle of the transportable
MSStageType getStageType(int next) const
the stage type for the nth next stage
bool isWaiting4Vehicle() const
Whether the transportable waits for a vehicle.
int getNumRemainingStages() const
Return the number of remaining stages (including the current)
virtual double getSpeed() const
the current speed of the transportable
std::string getStageSummary(int stageIndex) const
return textual summary for the given stage
MSStage * getCurrentStage() const
Return the current stage.
virtual bool proceed(MSNet *net, SUMOTime time, const bool vehicleArrived=false)
MSVehicleType * myVType
This transportable's type. (mainly used for drawing related information Note sure if it is really nec...
virtual Position getPosition() const
Return the Network coordinate of the transportable.
const MSVehicleType & getVehicleType() const
Returns the object's "vehicle" type.
int getNumStages() const
Return the total number stages in this persons plan.
MSStageType getCurrentStageType() const
the current stage type of the transportable
virtual double getWaitingSeconds() const
the time this transportable spent waiting in seconds
bool hasArrived() const
return whether the person has reached the end of its plan
const MSEdge * getEdge() const
Returns the current edge.
virtual int getDirection() const
Return the movement directon on the edge.
std::vector< MSStage * > MSTransportablePlan
the structure holding the plan of a transportable
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
The car-following model and parameter.
Definition: MSVehicleType.h:63
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
double getMaxSpeed() const
Get vehicle's (technical) maximum speed [m/s].
double getDesiredMaxSpeed() const
Returns the vehicles's desired maximum speed.
const std::string & getID() const
Returns the name of the vehicle type.
Definition: MSVehicleType.h:91
double getMinGap() const
Get the free space in front of vehicles of this class.
double getHeight() const
Get the height which vehicles of this class shall have when being drawn.
double getLength() const
Get vehicle's length [m].
bool wasSet(int what) const
Returns whether the given parameter was set.
Definition: MSVehicleType.h:80
const SUMOVTypeParameter & getParameter() const
const RGBColor & getColor() const
Returns this type's color.
const std::string & getID() const
Returns the id.
Definition: Named.h:74
An upper class for objects with additional parameters.
Definition: Parameterised.h:41
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
static const Position INVALID
used to indicate that a position is valid
Definition: Position.h:300
double x() const
Returns the x-position.
Definition: Position.h:55
double y() const
Returns the y-position.
Definition: Position.h:60
static RGBColor fromHSV(double h, double s, double v)
Converts the given hsv-triplet to rgb, inspired by http://alvyray.com/Papers/CG/hsv2rgb....
Definition: RGBColor.cpp:371
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:200
Representation of a vehicle.
Definition: SUMOVehicle.h:62
Structure representing possible vehicle parameter.
RGBColor color
The vehicle's color, TraCI may change this.
bool wasSet(int what) const
Returns whether the given parameter was set.
A scoped lock which only triggers on condition.
Definition: ScopedLocker.h:40
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
bool show(const GUIGlObject *o) const
whether to show the text
double scaledSize(double scale, double constFactor=0.1) const
get scale size