Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
GUIPerson.cpp
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/****************************************************************************/
20// A MSPerson extended by some values for usage within the gui
21/****************************************************************************/
22#include <config.h>
23
39
40#include "GUILane.h"
41#include "GUIPerson.h"
42
43//#define GUIPerson_DEBUG_DRAW_WALKINGAREA_PATHS 1
44
45// ===========================================================================
46// FOX callback mapping
47// ===========================================================================
48
59
60// Object implementation
61FXIMPLEMENT(GUIPerson::GUIPersonPopupMenu, GUIGLObjectPopupMenu, GUIPersonPopupMenuMap, ARRAYNUMBER(GUIPersonPopupMenuMap))
62
63// ===========================================================================
64// method definitions
65// ===========================================================================
66
67// -------------------------------------------------------------------------
68// GUIPerson::GUIPersonPopupMenu - methods
69// -------------------------------------------------------------------------
70
75
76
78
79
80long
82 assert(myObject->getType() == GLO_PERSON);
83 if (!static_cast<GUIPerson*>(myObject)->hasActiveAddVisualisation(myParent, VO_SHOW_ROUTE)) {
84 static_cast<GUIPerson*>(myObject)->addActiveAddVisualisation(myParent, VO_SHOW_ROUTE);
85 }
86 return 1;
87}
88
89
90long
92 assert(myObject->getType() == GLO_PERSON);
93 static_cast<GUIPerson*>(myObject)->removeActiveAddVisualisation(myParent, VO_SHOW_ROUTE);
94 return 1;
95}
96
97
98long
100 assert(myObject->getType() == GLO_PERSON);
101 if (!static_cast<GUIPerson*>(myObject)->hasActiveAddVisualisation(myParent, VO_SHOW_WALKINGAREA_PATH)) {
102 static_cast<GUIPerson*>(myObject)->addActiveAddVisualisation(myParent, VO_SHOW_WALKINGAREA_PATH);
103 }
104 return 1;
105}
106
107
108long
110 assert(myObject->getType() == GLO_PERSON);
111 static_cast<GUIPerson*>(myObject)->removeActiveAddVisualisation(myParent, VO_SHOW_WALKINGAREA_PATH);
112 return 1;
113}
114
115
116long
117GUIPerson::GUIPersonPopupMenu::onCmdShowPlan(FXObject*, FXSelector, void*) {
118 GUIPerson* p = dynamic_cast<GUIPerson*>(myObject);
119 if (p == nullptr) {
120 return 1;
121 }
122 GUIParameterTableWindow* ret = new GUIParameterTableWindow(*myApplication, *p);
123 // add items
124 for (int stage = 1; stage < p->getNumStages(); stage++) {
125 ret->mkItem(toString(stage).c_str(), false, p->getStageSummary(stage));
126 }
127 // close building (use an object that is not Parameterised as argument)
128 Parameterised dummyParameterised;
129 ret->closeBuilding(&dummyParameterised);
130 return 1;
131}
132
133
134long
136 assert(myObject->getType() == GLO_PERSON);
137 if (myParent->getTrackedID() != static_cast<GUIPerson*>(myObject)->getGlID()) {
138 myParent->startTrack(static_cast<GUIPerson*>(myObject)->getGlID());
139 }
140 return 1;
141}
142
143
144long
146 assert(myObject->getType() == GLO_PERSON);
147 myParent->stopTrack();
148 return 1;
149}
150
151
152long
154 GUIPerson* person = static_cast<GUIPerson*>(myObject);
155 MSStage* stage = person->getCurrentStage();
156 stage->abort(person);
157 stage->getEdge()->removeTransportable(person);
158 if (stage->getDestinationStop() != nullptr) {
159 stage->getDestinationStop()->removeTransportable(person);
160 }
162 myParent->update();
163 return 1;
164}
165
166// -------------------------------------------------------------------------
167// GUIPerson - methods
168// -------------------------------------------------------------------------
169
171 MSPerson(pars, vtype, plan, speedFactor),
172 GUIGlObject(GLO_PERSON, pars->id, GUIIconSubSys::getIcon(GUIIcon::PERSON)),
173 myLock(true)
174{ }
175
176
178 myLock.lock();
179 for (std::map<GUISUMOAbstractView*, int>::iterator i = myAdditionalVisualizations.begin(); i != myAdditionalVisualizations.end(); ++i) {
180 if (i->first->getTrackedID() == getGlID()) {
181 i->first->stopTrack();
182 }
183 while (i->first->removeAdditionalGLVisualisation(this));
184 }
185 myLock.unlock();
186}
187
188
191 GUIGLObjectPopupMenu* ret = new GUIPersonPopupMenu(app, parent, this);
192 buildPopupHeader(ret, app);
197 GUIDesigns::buildFXMenuCommand(ret, "Hide Current Route", nullptr, ret, MID_HIDE_CURRENTROUTE);
198 } else {
199 GUIDesigns::buildFXMenuCommand(ret, "Show Current Route", nullptr, ret, MID_SHOW_CURRENTROUTE);
200 }
202 GUIDesigns::buildFXMenuCommand(ret, "Hide Walkingarea Path", nullptr, ret, MID_HIDE_WALKINGAREA_PATH);
203 } else {
204 GUIDesigns::buildFXMenuCommand(ret, "Show Walkingarea Path", nullptr, ret, MID_SHOW_WALKINGAREA_PATH);
205 }
206 new FXMenuSeparator(ret);
207 if (parent.getTrackedID() != getGlID()) {
208 GUIDesigns::buildFXMenuCommand(ret, "Start Tracking", nullptr, ret, MID_START_TRACK);
209 } else {
210 GUIDesigns::buildFXMenuCommand(ret, "Stop Tracking", nullptr, ret, MID_STOP_TRACK);
211 }
212 GUIDesigns::buildFXMenuCommand(ret, "Remove", nullptr, ret, MID_REMOVE_OBJECT);
213 new FXMenuSeparator(ret);
214 //
218 new FXMenuSeparator(ret);
219 buildPositionCopyEntry(ret, app);
220 return ret;
221}
222
223
228 // add items
230 // there is always the "start" stage which we do not count here because it is not strictly part of the plan
232 ret->mkItem(TL("start edge [id]"), true, new FunctionBindingString<GUIPerson>(this, &GUIPerson::getFromEdgeID));
233 ret->mkItem(TL("dest edge [id]"), true, new FunctionBindingString<GUIPerson>(this, &GUIPerson::getDestinationEdgeID));
234 ret->mkItem(TL("dest stop [id]"), true, new FunctionBindingString<GUIPerson>(this, &GUIPerson::getDestinationStopID));
235 ret->mkItem(TL("arrival position [m]"), true, new FunctionBinding<GUIPerson, double>(this, &GUIPerson::getStageArrivalPos));
236 ret->mkItem(TL("edge [id]"), true, new FunctionBindingString<GUIPerson>(this, &GUIPerson::getEdgeID));
237 ret->mkItem(TL("lane [id]"), true, new FunctionBindingString<GUIPerson>(this, &GUIPerson::getLaneID));
238 ret->mkItem(TL("position [m]"), true, new FunctionBinding<GUIPerson, double>(this, &GUIPerson::getEdgePos));
239 ret->mkItem(TL("speed [m/s]"), true, new FunctionBinding<GUIPerson, double>(this, &GUIPerson::getSpeed));
240 ret->mkItem(TL("speed factor"), false, getChosenSpeedFactor());
241 ret->mkItem(TL("angle [degree]"), true, new FunctionBinding<GUIPerson, double>(this, &GUIPerson::getNaviDegree));
242 ret->mkItem(TL("waiting time [s]"), true, new FunctionBinding<GUIPerson, double>(this, &GUIPerson::getWaitingSeconds));
243 ret->mkItem(TL("vehicle [id]"), true, new FunctionBindingString<GUIPerson>(this, &GUIPerson::getVehicleID));
244 ret->mkItem(TL("stop duration [s]"), true, new FunctionBinding<GUIPerson, double>(this, &GUIPerson::getStopDuration));
245 ret->mkItem(TL("desired depart [s]"), false, time2string(getParameter().depart));
246 // close building
248 return ret;
249}
250
251
254 GUIParameterTableWindow* ret = new GUIParameterTableWindow(app, *this, "vType:" + myVType->getID());
255 ret->mkItem(TL("length"), false, myVType->getLength());
256 ret->mkItem(TL("width"), false, myVType->getWidth());
257 ret->mkItem(TL("height"), false, myVType->getHeight());
258 ret->mkItem(TL("minGap"), false, myVType->getMinGap());
259 ret->mkItem(TL("mass [kg]"), false, myVType->getMass());
260 ret->mkItem(TL("desired max speed [m/s]"), false, myVType->getDesiredMaxSpeed());
261 ret->mkItem(TL("maximum speed [m/s]"), false, myVType->getMaxSpeed());
263 return ret;
264}
265
266
267double
269 return s.personSize.getExaggeration(s, this, s.personQuality == 1 ? 40 : 80);
270}
271
272
275 Boundary b;
276 // ensure that the vehicle is drawn, otherwise myPositionInVehicle will not be updated
277 b.add(getGUIPosition());
278 b.grow(MAX2(getVehicleType().getWidth(), getVehicleType().getLength()));
279 return b;
280}
281
282
283void
287 Position p1 = getGUIPosition(&s);
288 double angle = getGUIAngle();
289 glTranslated(p1.x(), p1.y(), getType());
290 // set person color
291 setColor(s);
292 // scale
293 const double exaggeration = getExaggeration(s);
294 glScaled(exaggeration, exaggeration, 1);
295 switch (s.personQuality) {
296 case 0:
298 break;
299 case 1:
300 GUIBasePersonHelper::drawAction_drawAsCircle(angle, getVehicleType().getLength(), getVehicleType().getWidth(), s.scale * exaggeration);
301 break;
302 case 2:
304 break;
305 case 3:
306 default:
308 getVehicleType().getImgFile(), getVehicleType().getGuiShape(), 1);
309 break;
310 }
312#ifdef GUIPerson_DEBUG_DRAW_WALKINGAREA_PATHS
314#endif
315 drawName(p1, s.scale, s.personName, s.angle);
316 if (s.personValue.show(this)) {
317 Position p2 = p1 + Position(0, 0.6 * s.personName.scaledSize(s.scale));
318 const double value = getColorValue(s, s.personColorer.getActive());
320 }
322}
323
324
325void
327 MSStageWalking* stage = dynamic_cast<MSStageWalking*>(getCurrentStage());
328 if (stage != nullptr) {
329 setColor(s);
330 MSPModel_Striping::PState* stripingState = dynamic_cast<MSPModel_Striping::PState*>(stage->getPState());
331 if (stripingState != nullptr) {
332 const MSPModel_Striping::WalkingAreaPath* waPath = stripingState->myWalkingAreaPath;
333 if (waPath != nullptr) {
335 glTranslated(0, 0, getType());
336 GLHelper::drawBoxLines(waPath->shape, 0.05);
338 }
339 }
340 }
341}
342
343void
347 glTranslated(0, 0, getType() - .1); // don't draw on top of other cars
350 }
353 setColor(s);
354 RGBColor current = GLHelper::getColor();
355 RGBColor darker = current.changedBrightness(-51);
356 GLHelper::setColor(darker);
357 MSStageWalking* stage = dynamic_cast<MSStageWalking*>(getCurrentStage());
358 assert(stage != 0);
359 const double exaggeration = getExaggeration(s);
360 const ConstMSEdgeVector& edges = stage->getRoute();
361 const bool s2 = s.secondaryShape;
362 for (ConstMSEdgeVector::const_iterator it = edges.begin(); it != edges.end(); ++it) {
363 GUILane* lane = static_cast<GUILane*>((*it)->getLanes()[0]);
364 GLHelper::drawBoxLines(lane->getShape(s2), lane->getShapeRotations(s2), lane->getShapeLengths(s2), exaggeration);
365 }
366 }
367 }
370}
371
372
373void
377
378
379void
381 RGBColor col;
382 const GUIColorer& c = s.personColorer;
383 if (!setFunctionalColor(c.getActive(), this, col)) {
384 col = c.getScheme().getColor(getColorValue(s, c.getActive()));
385 }
387}
388
389
390bool
391GUIPerson::setFunctionalColor(int activeScheme, const MSPerson* person, RGBColor& col) {
392 switch (activeScheme) {
393 case 0: {
394 if (person->getParameter().wasSet(VEHPARS_COLOR_SET)) {
395 col = person->getParameter().color;
396 return true;
397 }
399 col = person->getVehicleType().getColor();
400 return true;
401 }
402 return false;
403 }
404 case 2: {
405 if (person->getParameter().wasSet(VEHPARS_COLOR_SET)) {
406 col = person->getParameter().color;
407 return true;
408 }
409 return false;
410 }
411 case 3: {
413 col = person->getVehicleType().getColor();
414 return true;
415 }
416 return false;
417 }
418 case 9: { // color by angle
419 double hue = GeomHelper::naviDegree(person->getAngle());
420 col = RGBColor::fromHSV(hue, 1., 1.);
421 return true;
422 }
423 case 10: { // color randomly (by pointer)
424 const double hue = (double)((long long int)person % 360); // [0-360]
425 const double sat = (double)(((long long int)person / 360) % 67) / 100. + 0.33; // [0.33-1]
426 col = RGBColor::fromHSV(hue, sat, 1.);
427 return true;
428 }
429 default:
430 return false;
431 }
432}
433
434
435double
436GUIPerson::getColorValue(const GUIVisualizationSettings& /* s */, int activeScheme) const {
437 switch (activeScheme) {
438 case 4:
439 switch (getCurrentStageType()) {
441 return -1;
443 return -2;
444 default:
445 return getSpeed();
446 }
447 case 5:
448 if (isWaiting4Vehicle()) {
449 return 5;
450 } else {
451 return (double)getCurrentStageType();
452 }
453 case 6:
454 return getWaitingSeconds();
455 case 7:
456 return isJammed() ? 1 : 0;
457 case 8:
459 }
460 return 0;
461}
462
463
464double
466 FXMutexLock locker(myLock);
467 if (hasArrived()) {
468 return -1;
469 }
470 return MSPerson::getEdgePos();
471}
472
473int
475 FXMutexLock locker(myLock);
476 if (hasArrived()) {
478 }
479 return MSPerson::getDirection();
480}
481
482
485 FXMutexLock locker(myLock);
486 if (hasArrived()) {
487 return Position::INVALID;
488 }
489 return MSPerson::getPosition();
490}
491
492
495 FXMutexLock locker(myLock);
496 if (hasArrived()) {
497 return Position::INVALID;
498 }
501 if (s != nullptr) {
503 } else {
504 // centering boundary must cover the vehicle regardless of exaggeration and zoom
506 if (veh == nullptr) {
507 // should not happen
509 }
513 } else {
514 return b.getCentroid();
515 }
516 }
517 } else if (isWaiting4Vehicle()
518 && s != nullptr
519 && s->gaming
520 && getCurrentStage()->getOriginStop() != nullptr
521 && s->addSize.getExaggeration(*s, nullptr) > 1) {
522 // shift position away from stop center
525 Position shifted = ref + (pos - ref) * s->personSize.getExaggeration(*s, this);
526 return shifted;
527 }
528 }
529 return MSPerson::getPosition();
530}
531
532
533double
535 FXMutexLock locker(myLock);
536 if (hasArrived()) {
537 return INVALID_DOUBLE;
538 }
541 } else {
542 return MSPerson::getAngle();
543 }
544}
545
546
547double
549 FXMutexLock locker(myLock);
550 if (hasArrived()) {
551 return INVALID_DOUBLE;
552 }
554}
555
556
557double
559 FXMutexLock locker(myLock);
560 if (hasArrived()) {
561 return -1;
562 }
564}
565
566
567double
569 FXMutexLock locker(myLock);
570 if (hasArrived()) {
571 return -1;
572 }
573 return MSPerson::getSpeed();
574}
575
576
577std::string
579 FXMutexLock locker(myLock);
580 if (hasArrived()) {
581 return "arrived";
582 }
583 // there is always the "start" stage which we do not count here because it is not strictly part of the plan
584 return toString(getCurrentStageIndex()) + " of " + toString(getNumStages() - 1);
585}
586
587
588std::string
590 FXMutexLock locker(myLock);
591 if (hasArrived()) {
592 return "arrived";
593 }
594 return getEdge()->getID();
595}
596
597
598std::string
600 FXMutexLock locker(myLock);
601 if (hasArrived()) {
602 return "arrived";
603 }
604 return getLane() != nullptr ? getLane()->getID() : "";
605}
606
607
608std::string
610 FXMutexLock locker(myLock);
611 if (hasArrived()) {
612 return "arrived";
613 }
614 return getFromEdge()->getID();
615}
616
617
618std::string
620 FXMutexLock locker(myLock);
621 if (hasArrived()) {
622 return "arrived";
623 }
624 return getDestination()->getID();
625}
626
627
628std::string
630 FXMutexLock locker(myLock);
631 if (hasArrived()) {
632 return "";
633 }
635 if (destStop != nullptr) {
636 return destStop->getID();
637 } else {
638 return "";
639 }
640}
641
642
643std::string
645 FXMutexLock locker(myLock);
646 if (hasArrived()) {
647 return "";
648 }
650 if (veh != nullptr) {
651 return veh->getID();
652 } else {
653 return "";
654 }
655}
656
657
658double
660 FXMutexLock locker(myLock);
661 if (hasArrived()) {
662 return -1;
663 }
665 return STEPS2TIME(dynamic_cast<MSStageWaiting*>(getCurrentStage())->getStopEnd() - SIMSTEP);
666 } else {
667 return -1;
668 }
669}
670
671
672double
674 FXMutexLock locker(myLock);
675 if (hasArrived()) {
676 return INVALID_DOUBLE;
677 }
678 return getCurrentStage()->getArrivalPos();
679}
680
681bool
682GUIPerson::proceed(MSNet* net, SUMOTime time, const bool vehicleArrived) {
683 // acquire lock before locking the person to avoid mutual deadlock (#9468)
685 FXMutexLock locker(myLock);
686 return MSTransportable::proceed(net, time, vehicleArrived);
687}
688
689// -------------------------------------------------------------------------
690// GUIPerson - Additional Visualsation methods
691// -------------------------------------------------------------------------
692
693bool
695 return myAdditionalVisualizations.find(parent) != myAdditionalVisualizations.end() && (myAdditionalVisualizations.find(parent)->second & which) != 0;
696}
697
698
699void
701 if (myAdditionalVisualizations.find(parent) == myAdditionalVisualizations.end()) {
702 myAdditionalVisualizations[parent] = 0;
703 }
704 myAdditionalVisualizations[parent] |= which;
705 parent->addAdditionalGLVisualisation(this);
706}
707
708
709void
714
715bool
719
720
721/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
@ MID_HIDE_CURRENTROUTE
Hide vehicle's current route.
Definition GUIAppEnum.h:495
@ MID_SHOWPLAN
Show transportable plan.
Definition GUIAppEnum.h:475
@ MID_HIDE_WALKINGAREA_PATH
Hide persons's path on walkingarea.
Definition GUIAppEnum.h:529
@ MID_SHOW_WALKINGAREA_PATH
Show persons's path on walkingarea.
Definition GUIAppEnum.h:527
@ MID_START_TRACK
Start to track a vehicle.
Definition GUIAppEnum.h:513
@ MID_REMOVE_OBJECT
remove a vehicle or person
Definition GUIAppEnum.h:525
@ MID_SHOW_CURRENTROUTE
Show vehicle's current route.
Definition GUIAppEnum.h:493
@ MID_STOP_TRACK
Stop to track a vehicle.
Definition GUIAppEnum.h:515
@ 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
#define TL(string)
Definition MsgHandler.h:301
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition SUMOTime.cpp:91
#define STEPS2TIME(x)
Definition SUMOTime.h:55
#define SIMSTEP
Definition SUMOTime.h:61
const long long int VTYPEPARS_COLOR_SET
const long long 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:75
Boundary & grow(double by)
extends the boundary by the given amount
Definition Boundary.cpp:340
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition GLHelper.cpp:649
static void pushName(unsigned int name)
push Name
Definition GLHelper.cpp:140
static void popMatrix()
pop matrix
Definition GLHelper.cpp:131
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:348
static RGBColor getColor()
gets the gl-color
Definition GLHelper.cpp:655
static void popName()
pop Name
Definition GLHelper.cpp:149
static void pushMatrix()
push matrix
Definition GLHelper.cpp:118
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:779
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, const bool disable=false)
build menu command
The popup menu of a globject.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, const GUIMainWindow &app, bool addSeparator=true) const
Builds an entry which allows to copy the cursor position if geo projection is used,...
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.
void buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to (de)select the object.
GUIGlID getGlID() const
Returns the numerical id of the object.
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:1115
const PositionVector & getShape(bool secondary) const override
Definition GUILane.cpp:1109
const std::vector< double > & getShapeLengths(bool secondary) const
Definition GUILane.cpp:1121
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.
long onCmdShowPlan(FXObject *, FXSelector, void *)
Called if the plan shall be shown.
long onCmdRemoveObject(FXObject *, FXSelector, void *)
Called when removing the person.
long onCmdHideCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the person shall be hidden.
Definition GUIPerson.cpp:91
long onCmdHideWalkingareaPath(FXObject *, FXSelector, void *)
Called if the walkingarea path of the person shall be hidden.
long onCmdStopTrack(FXObject *, FXSelector, void *)
Called if the person shall not be tracked any longer.
long onCmdShowCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the person shall be shown.
Definition GUIPerson.cpp:81
long onCmdShowWalkingareaPath(FXObject *, FXSelector, void *)
Called if the walkingarea path of the person shall be shown.
Definition GUIPerson.cpp:99
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
void drawAction_drawWalkingareaPath(const GUIVisualizationSettings &s) const
draw walking area path
bool proceed(MSNet *net, SUMOTime time, const bool vehicleArrived=false) override
double getExaggeration(const GUIVisualizationSettings &s) const override
return exaggeration associated with this GLObject
std::string getDestinationStopID() const
get destination stop ID
std::string getDestinationEdgeID() const
get destination edge ID
std::string getStageIndexDescription() const
get stage index description
Position getPosition() const override
return the Network coordinate of the person
virtual void drawGLAdditional(GUISUMOAbstractView *const parent, const GUIVisualizationSettings &s) const override
Draws additionally triggered visualisations.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const override
gets the color value according to the current scheme index
~GUIPerson()
destructor
double getGUIAngle() const
return the angle of the person (only for drawing centering and tracking)
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
bool isSelected() const override
whether this person is selected in the GUI
Position getGUIPosition(const GUIVisualizationSettings *s=nullptr) const
return the Network coordinate of the person (only for drawing centering and tracking)
double getStopDuration() const
get remaining duration of current stop or -1
GUIBaseVehicle::Seat myPositionInVehicle
The position of a person while riding a vehicle.
Definition GUIPerson.h:280
std::map< GUISUMOAbstractView *, int > myAdditionalVisualizations
Enabled visualisations, per view.
Definition GUIPerson.h:283
@ VO_SHOW_WALKINGAREA_PATH
show the current walkingarea path
Definition GUIPerson.h:237
@ VO_SHOW_ROUTE
show persons's current route
Definition GUIPerson.h:239
double getEdgePos() const override
Return the position on the edge.
double getSpeed() const override
the current speed of the person
double getNaviDegree() const
return the current angle of the person
std::string getVehicleID() const
get current vehicle id if applicable
GUIPerson(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan, const double speedFactor)
Constructor.
std::string getEdgeID() const
get edge ID
bool hasActiveAddVisualisation(GUISUMOAbstractView *const parent, int which) const
Returns whether the named feature is enabled in the given view.
double getWaitingSeconds() const override
the time this person spent waiting in seconds
void setPositionInVehicle(const GUIBaseVehicle::Seat &pos)
void removeActiveAddVisualisation(GUISUMOAbstractView *const parent, int which) override
Adds the named visualisation feature to the given view.
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own parameter window.
FXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition GUIPerson.h:277
int getDirection() const override
Return the movement directon on the edge.
std::string getLaneID() const
get lane ID
std::string getFromEdgeID() const
get from edge ID
double getStageArrivalPos() const
get stage arrival position
static bool setFunctionalColor(int activeScheme, const MSPerson *person, RGBColor &col)
sets the color according to the current scheme index and some vehicle function
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own type parameter window.
void addActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
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)
virtual void removeTransportable(MSTransportable *t) const
Definition MSEdge.cpp:1197
The simulated network and simulation perfomer.
Definition MSNet.h:89
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition MSNet.cpp:186
virtual MSTransportableControl & getPersonControl()
Returns the person control.
Definition MSNet.cpp:1201
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:56
double getChosenSpeedFactor() const
the current speed factor of the transportable (where applicable)
Definition MSPerson.h:154
bool isJammed() const
whether the person is jammed as defined by the current pedestrian model
virtual double getArrivalPos() const
Definition MSStage.h:97
virtual MSStoppingPlace * getOriginStop() const
returns the origin stop (if any). only needed for MSStageTrip
Definition MSStage.h:93
MSStoppingPlace * getDestinationStop() const
returns the destination stop (if any)
Definition MSStage.h:88
virtual SUMOVehicle * getVehicle() const
Current vehicle in which the transportable is driving (or nullptr)
Definition MSStage.h:193
virtual void abort(MSTransportable *)
abort this stage (TraCI)
Definition MSStage.h:157
virtual const MSEdge * getEdge() const
Returns the current edge.
Definition MSStage.cpp:71
const std::vector< const MSEdge * > & getRoute() const
MSTransportableStateAdapter * getPState() const
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 MSLane * getLane() const
Returns the current lane (may be nullptr)
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.
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 person's plan.
int getCurrentStageIndex() const
Return the index of the current stage.
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.
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.
double getMinGap() const
Get the free space in front of vehicles of this class.
bool wasSet(long long int what) const
Returns whether the given parameter was set.
double getHeight() const
Get the height which vehicles of this class shall have when being drawn.
double getLength() const
Get vehicle's length [m].
double getMass() const
Get this vehicle type's mass.
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.
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:319
double x() const
Returns the x-position.
Definition Position.h:52
double y() const
Returns the y-position.
Definition Position.h:57
A list of positions.
Position getCentroid() const
Returns the centroid (closes the polygon if unclosed)
bool around(const Position &p, double offset=0) const
Returns the information whether the position vector describes a polygon lying around the given point.
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:403
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
virtual PositionVector getBoundingBox(double offset=0) const =0
get bounding rectangle
Structure representing possible vehicle parameter.
bool wasSet(long long int what) const
Returns whether the given parameter was set.
RGBColor color
The vehicle's color, TraCI may change this.
A scoped lock which only triggers on condition.
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