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-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 /****************************************************************************/
20 // A MSPerson extended by some values for usage within the gui
21 /****************************************************************************/
22 #include <config.h>
23 
30 #include <utils/gui/div/GLHelper.h>
36 
37 #include "GUILane.h"
38 #include "GUIPerson.h"
39 
40 //#define GUIPerson_DEBUG_DRAW_WALKINGAREA_PATHS 1
41 
42 // ===========================================================================
43 // FOX callback mapping
44 // ===========================================================================
45 
46 FXDEFMAP(GUIPerson::GUIPersonPopupMenu) GUIPersonPopupMenuMap[] = {
55 };
56 
57 // Object implementation
58 FXIMPLEMENT(GUIPerson::GUIPersonPopupMenu, GUIGLObjectPopupMenu, GUIPersonPopupMenuMap, ARRAYNUMBER(GUIPersonPopupMenuMap))
59 
60 // ===========================================================================
61 // method definitions
62 // ===========================================================================
63 
64 // -------------------------------------------------------------------------
65 // GUIPerson::GUIPersonPopupMenu - methods
66 // -------------------------------------------------------------------------
67 
69  GUIMainWindow& app, GUISUMOAbstractView& parent, GUIGlObject& o) :
70  GUIGLObjectPopupMenu(app, parent, o) {
71 }
72 
73 
75 
76 
77 long
79  assert(myObject->getType() == GLO_PERSON);
80  if (!static_cast<GUIPerson*>(myObject)->hasActiveAddVisualisation(myParent, VO_SHOW_ROUTE)) {
81  static_cast<GUIPerson*>(myObject)->addActiveAddVisualisation(myParent, VO_SHOW_ROUTE);
82  }
83  return 1;
84 }
85 
86 
87 long
89  assert(myObject->getType() == GLO_PERSON);
90  static_cast<GUIPerson*>(myObject)->removeActiveAddVisualisation(myParent, VO_SHOW_ROUTE);
91  return 1;
92 }
93 
94 
95 long
97  assert(myObject->getType() == GLO_PERSON);
98  if (!static_cast<GUIPerson*>(myObject)->hasActiveAddVisualisation(myParent, VO_SHOW_WALKINGAREA_PATH)) {
99  static_cast<GUIPerson*>(myObject)->addActiveAddVisualisation(myParent, VO_SHOW_WALKINGAREA_PATH);
100  }
101  return 1;
102 }
103 
104 
105 long
107  assert(myObject->getType() == GLO_PERSON);
108  static_cast<GUIPerson*>(myObject)->removeActiveAddVisualisation(myParent, VO_SHOW_WALKINGAREA_PATH);
109  return 1;
110 }
111 
112 
113 long
114 GUIPerson::GUIPersonPopupMenu::onCmdShowPlan(FXObject*, FXSelector, void*) {
115  GUIPerson* p = dynamic_cast<GUIPerson*>(myObject);
116  if (p == nullptr) {
117  return 1;
118  }
119  GUIParameterTableWindow* ret = new GUIParameterTableWindow(*myApplication, *p);
120  // add items
121  for (int stage = 1; stage < p->getNumStages(); stage++) {
122  ret->mkItem(toString(stage).c_str(), false, p->getStageSummary(stage));
123  }
124  // close building (use an object that is not Parameterised as argument)
125  Parameterised dummyParameterised;
126  ret->closeBuilding(&dummyParameterised);
127  return 1;
128 }
129 
130 
131 long
132 GUIPerson::GUIPersonPopupMenu::onCmdStartTrack(FXObject*, FXSelector, void*) {
133  assert(myObject->getType() == GLO_PERSON);
134  if (myParent->getTrackedID() != static_cast<GUIPerson*>(myObject)->getGlID()) {
135  myParent->startTrack(static_cast<GUIPerson*>(myObject)->getGlID());
136  }
137  return 1;
138 }
139 
140 
141 long
142 GUIPerson::GUIPersonPopupMenu::onCmdStopTrack(FXObject*, FXSelector, void*) {
143  assert(myObject->getType() == GLO_PERSON);
144  myParent->stopTrack();
145  return 1;
146 }
147 
148 
149 long
151  GUIPerson* person = static_cast<GUIPerson*>(myObject);
152  MSStage* stage = person->getCurrentStage();
153  stage->abort(person);
154  stage->getEdge()->removePerson(person);
155  if (stage->getDestinationStop() != nullptr) {
156  stage->getDestinationStop()->removeTransportable(person);
157  }
159  myParent->update();
160  return 1;
161 }
162 
163 // -------------------------------------------------------------------------
164 // GUIPerson - methods
165 // -------------------------------------------------------------------------
166 
168  MSPerson(pars, vtype, plan, speedFactor),
169  GUIGlObject(GLO_PERSON, pars->id),
170  myLock(true)
171 { }
172 
173 
175  myLock.lock();
176  for (std::map<GUISUMOAbstractView*, int>::iterator i = myAdditionalVisualizations.begin(); i != myAdditionalVisualizations.end(); ++i) {
177  if (i->first->getTrackedID() == getGlID()) {
178  i->first->stopTrack();
179  }
180  while (i->first->removeAdditionalGLVisualisation(this));
181  }
182  myLock.unlock();
183 }
184 
185 
188  GUIGLObjectPopupMenu* ret = new GUIPersonPopupMenu(app, parent, *this);
189  buildPopupHeader(ret, app);
194  GUIDesigns::buildFXMenuCommand(ret, "Hide Current Route", nullptr, ret, MID_HIDE_CURRENTROUTE);
195  } else {
196  GUIDesigns::buildFXMenuCommand(ret, "Show Current Route", nullptr, ret, MID_SHOW_CURRENTROUTE);
197  }
199  GUIDesigns::buildFXMenuCommand(ret, "Hide Walkingarea Path", nullptr, ret, MID_HIDE_WALKINGAREA_PATH);
200  } else {
201  GUIDesigns::buildFXMenuCommand(ret, "Show Walkingarea Path", nullptr, ret, MID_SHOW_WALKINGAREA_PATH);
202  }
203  new FXMenuSeparator(ret);
204  if (parent.getTrackedID() != getGlID()) {
205  GUIDesigns::buildFXMenuCommand(ret, "Start Tracking", nullptr, ret, MID_START_TRACK);
206  } else {
207  GUIDesigns::buildFXMenuCommand(ret, "Stop Tracking", nullptr, ret, MID_STOP_TRACK);
208  }
209  GUIDesigns::buildFXMenuCommand(ret, "Remove", nullptr, ret, MID_REMOVE_OBJECT);
210  new FXMenuSeparator(ret);
211  //
215  new FXMenuSeparator(ret);
216  buildPositionCopyEntry(ret, false);
217  return ret;
218 }
219 
220 
224  GUIParameterTableWindow* ret = new GUIParameterTableWindow(app, *this);
225  // add items
227  // there is always the "start" stage which we do not count here because it is not strictly part of the plan
228  ret->mkItem("stage index", true, new FunctionBindingString<GUIPerson>(this, &GUIPerson::getStageIndexDescription));
229  ret->mkItem("start edge [id]", true, new FunctionBindingString<GUIPerson>(this, &GUIPerson::getFromEdgeID));
230  ret->mkItem("dest edge [id]", true, new FunctionBindingString<GUIPerson>(this, &GUIPerson::getDestinationEdgeID));
231  ret->mkItem("dest stop [id]", true, new FunctionBindingString<GUIPerson>(this, &GUIPerson::getDestinationStopID));
232  ret->mkItem("arrivalPos [m]", true, new FunctionBinding<GUIPerson, double>(this, &GUIPerson::getStageArrivalPos));
233  ret->mkItem("edge [id]", true, new FunctionBindingString<GUIPerson>(this, &GUIPerson::getEdgeID));
234  ret->mkItem("position [m]", true, new FunctionBinding<GUIPerson, double>(this, &GUIPerson::getEdgePos));
235  ret->mkItem("speed [m/s]", true, new FunctionBinding<GUIPerson, double>(this, &GUIPerson::getSpeed));
236  ret->mkItem("speed factor", false, getSpeedFactor());
237  ret->mkItem("angle [degree]", true, new FunctionBinding<GUIPerson, double>(this, &GUIPerson::getNaviDegree));
238  ret->mkItem("waiting time [s]", true, new FunctionBinding<GUIPerson, double>(this, &GUIPerson::getWaitingSeconds));
239  ret->mkItem("vehicle [id]", true, new FunctionBindingString<GUIPerson>(this, &GUIPerson::getVehicleID));
240  ret->mkItem("stop duration [s]", true, new FunctionBinding<GUIPerson, double>(this, &GUIPerson::getStopDuration));
241  ret->mkItem("desired depart [s]", false, time2string(getParameter().depart));
242  // close building
243  ret->closeBuilding(&getParameter());
244  return ret;
245 }
246 
247 
251  GUIParameterTableWindow* ret = new GUIParameterTableWindow(app, *this);
252  // add items
253  ret->mkItem("Type Information:", false, "");
254  ret->mkItem("type [id]", false, myVType->getID());
255  ret->mkItem("length", false, myVType->getLength());
256  ret->mkItem("width", false, myVType->getWidth());
257  ret->mkItem("height", false, myVType->getHeight());
258  ret->mkItem("minGap", false, myVType->getMinGap());
259  ret->mkItem("maximum speed [m/s]", false, myVType->getMaxSpeed());
260  // close building
261  ret->closeBuilding(&(myVType->getParameter()));
262  return ret;
263 }
264 
265 
266 double
268  return s.personSize.getExaggeration(s, this, 80);
269 }
270 
271 
272 Boundary
274  Boundary b;
275  // ensure that the vehicle is drawn, otherwise myPositionInVehicle will not be updated
276  b.add(getGUIPosition());
277  b.grow(MAX2(getVehicleType().getWidth(), getVehicleType().getLength()));
278  return b;
279 }
280 
281 
282 void
286  Position p1 = getGUIPosition(&s);
287  double angle = getGUIAngle();
288  glTranslated(p1.x(), p1.y(), getType());
289  // set person color
290  setColor(s);
291  // scale
292  const double exaggeration = getExaggeration(s);
293  glScaled(exaggeration, exaggeration, 1);
294  switch (s.personQuality) {
295  case 0:
297  break;
298  case 1:
299  GUIBasePersonHelper::drawAction_drawAsCircle(getVehicleType().getLength(), getVehicleType().getWidth(), s.scale * exaggeration);
300  break;
301  case 2:
303  break;
304  case 3:
305  default:
307  getVehicleType().getImgFile(), getVehicleType().getGuiShape(), exaggeration);
308  break;
309  }
311 #ifdef GUIPerson_DEBUG_DRAW_WALKINGAREA_PATHS
313 #endif
314  drawName(p1, s.scale, s.personName, s.angle);
315  if (s.personValue.show(this)) {
316  Position p2 = p1 + Position(0, 0.6 * s.personName.scaledSize(s.scale));
317  const double value = getColorValue(s, s.personColorer.getActive());
319  }
321 }
322 
323 
324 void
327  if (stage != nullptr) {
328  setColor(s);
329  MSPModel_Striping::PState* stripingState = dynamic_cast<MSPModel_Striping::PState*>(stage->getState());
330  if (stripingState != nullptr) {
331  const MSPModel_Striping::WalkingAreaPath* waPath = stripingState->myWalkingAreaPath;
332  if (waPath != nullptr) {
334  glTranslated(0, 0, getType());
335  GLHelper::drawBoxLines(waPath->shape, 0.05);
337  }
338  }
339  }
340 }
341 
342 bool
345  if (stage != nullptr) {
346  return stage->getState()->isJammed();
347  }
348  return false;
349 }
350 
351 
352 void
356  glTranslated(0, 0, getType() - .1); // don't draw on top of other cars
359  }
362  setColor(s);
363  RGBColor current = GLHelper::getColor();
364  RGBColor darker = current.changedBrightness(-51);
365  GLHelper::setColor(darker);
367  assert(stage != 0);
368  const double exaggeration = getExaggeration(s);
369  const ConstMSEdgeVector& edges = stage->getRoute();
370  for (ConstMSEdgeVector::const_iterator it = edges.begin(); it != edges.end(); ++it) {
371  GUILane* lane = static_cast<GUILane*>((*it)->getLanes()[0]);
372  GLHelper::drawBoxLines(lane->getShape(), lane->getShapeRotations(), lane->getShapeLengths(), exaggeration);
373  }
374  }
375  }
378 }
379 
380 
381 void
383  myPositionInVehicle = pos;
384 }
385 
386 
387 void
389  const GUIColorer& c = s.personColorer;
390  if (!setFunctionalColor(c.getActive())) {
392  }
393 }
394 
395 
396 bool
397 GUIPerson::setFunctionalColor(int activeScheme) const {
398  switch (activeScheme) {
399  case 0: {
400  if (getParameter().wasSet(VEHPARS_COLOR_SET)) {
402  return true;
403  }
404  if (getVehicleType().wasSet(VTYPEPARS_COLOR_SET)) {
405  GLHelper::setColor(getVehicleType().getColor());
406  return true;
407  }
408  return false;
409  }
410  case 2: {
411  if (getParameter().wasSet(VEHPARS_COLOR_SET)) {
413  return true;
414  }
415  return false;
416  }
417  case 3: {
418  if (getVehicleType().wasSet(VTYPEPARS_COLOR_SET)) {
419  GLHelper::setColor(getVehicleType().getColor());
420  return true;
421  }
422  return false;
423  }
424  case 9: { // color by angle
425  double hue = GeomHelper::naviDegree(getAngle());
427  return true;
428  }
429  case 10: { // color randomly (by pointer)
430  const double hue = (double)((long long int)this % 360); // [0-360]
431  const double sat = (((long long int)this / 360) % 67) / 100.0 + 0.33; // [0.33-1]
432  GLHelper::setColor(RGBColor::fromHSV(hue, sat, 1.));
433  return true;
434  }
435  default:
436  return false;
437  }
438 }
439 
440 
441 double
442 GUIPerson::getColorValue(const GUIVisualizationSettings& /* s */, int activeScheme) const {
443  switch (activeScheme) {
444  case 4:
445  switch (getCurrentStageType()) {
447  return -1;
449  return -2;
450  default:
451  return getSpeed();
452  }
453  case 5:
454  if (isWaiting4Vehicle()) {
455  return 5;
456  } else {
457  return (double)getCurrentStageType();
458  }
459  case 6:
460  return getWaitingSeconds();
461  case 7:
462  return isJammed() ? 1 : 0;
463  case 8:
465  }
466  return 0;
467 }
468 
469 
470 double
472  FXMutexLock locker(myLock);
473  if (hasArrived()) {
474  return -1;
475  }
476  return MSPerson::getEdgePos();
477 }
478 
479 int
481  FXMutexLock locker(myLock);
482  if (hasArrived()) {
484  }
485  return MSPerson::getDirection();
486 }
487 
488 
489 Position
491  FXMutexLock locker(myLock);
492  if (hasArrived()) {
493  return Position::INVALID;
494  }
495  return MSPerson::getPosition();
496 }
497 
498 
499 Position
501  FXMutexLock locker(myLock);
502  if (hasArrived()) {
503  return Position::INVALID;
504  }
507  return myPositionInVehicle.pos;
508  } else if (isWaiting4Vehicle()
509  && s != nullptr
510  && s->gaming
511  && getCurrentStage()->getOriginStop() != nullptr
512  && s->addSize.getExaggeration(s, nullptr) > 1) {
513  // shift position away from stop center
516  Position shifted = ref + (pos - ref) * s->personSize.getExaggeration(*s, this);
517  return shifted;
518  }
519  }
520  return MSPerson::getPosition();
521 }
522 
523 
524 double
526  FXMutexLock locker(myLock);
527  if (hasArrived()) {
528  return INVALID_DOUBLE;
529  }
531  return myPositionInVehicle.angle;
532  } else {
533  return MSPerson::getAngle();
534  }
535 }
536 
537 
538 double
540  FXMutexLock locker(myLock);
541  if (hasArrived()) {
542  return INVALID_DOUBLE;
543  }
545 }
546 
547 
548 double
550  FXMutexLock locker(myLock);
551  if (hasArrived()) {
552  return -1;
553  }
555 }
556 
557 
558 double
560  FXMutexLock locker(myLock);
561  if (hasArrived()) {
562  return -1;
563  }
564  return MSPerson::getSpeed();
565 }
566 
567 
568 std::string
570  FXMutexLock locker(myLock);
571  if (hasArrived()) {
572  return "arrived";
573  }
574  return toString(getNumStages() - getNumRemainingStages()) + " of " + toString(getNumStages() - 1);
575 }
576 
577 
578 std::string
580  FXMutexLock locker(myLock);
581  if (hasArrived()) {
582  return "arrived";
583  }
584  return getEdge()->getID();
585 }
586 
587 
588 std::string
590  FXMutexLock locker(myLock);
591  if (hasArrived()) {
592  return "arrived";
593  }
594  return getFromEdge()->getID();
595 }
596 
597 
598 std::string
600  FXMutexLock locker(myLock);
601  if (hasArrived()) {
602  return "arrived";
603  }
604  return getDestination()->getID();
605 }
606 
607 
608 std::string
610  FXMutexLock locker(myLock);
611  if (hasArrived()) {
612  return "";
613  }
615  if (destStop != nullptr) {
616  return destStop->getID();
617  } else {
618  return "";
619  }
620 }
621 
622 
623 std::string
625  FXMutexLock locker(myLock);
626  if (hasArrived()) {
627  return "";
628  }
630  if (veh != nullptr) {
631  return veh->getID();
632  } else {
633  return "";
634  }
635 }
636 
637 
638 double
640  FXMutexLock locker(myLock);
641  if (hasArrived()) {
642  return -1;
643  }
645  return STEPS2TIME(dynamic_cast<MSStageWaiting*>(getCurrentStage())->getStopEnd() - SIMSTEP);
646  } else {
647  return -1;
648  }
649 }
650 
651 
652 double
654  FXMutexLock locker(myLock);
655  if (hasArrived()) {
656  return INVALID_DOUBLE;
657  }
658  return getCurrentStage()->getArrivalPos();
659 }
660 
661 bool
662 GUIPerson::proceed(MSNet* net, SUMOTime time, const bool vehicleArrived) {
663  // acquire lock before locking the person to avoid mutual deadlock (#9468)
665  FXMutexLock locker(myLock);
666  return MSTransportable::proceed(net, time, vehicleArrived);
667 }
668 
669 // -------------------------------------------------------------------------
670 // GUIPerson - Additional Visualsation methods
671 // -------------------------------------------------------------------------
672 
673 bool
675  return myAdditionalVisualizations.find(parent) != myAdditionalVisualizations.end() && (myAdditionalVisualizations.find(parent)->second & which) != 0;
676 }
677 
678 
679 void
681  if (myAdditionalVisualizations.find(parent) == myAdditionalVisualizations.end()) {
682  myAdditionalVisualizations[parent] = 0;
683  }
684  myAdditionalVisualizations[parent] |= which;
685  parent->addAdditionalGLVisualisation(this);
686 }
687 
688 
689 void
691  myAdditionalVisualizations[parent] &= ~which;
692  parent->removeAdditionalGLVisualisation(this);
693 }
694 
695 bool
698 }
699 
700 
701 /****************************************************************************/
@ MID_HIDE_CURRENTROUTE
Hide vehicle's current route.
Definition: GUIAppEnum.h:449
@ MID_SHOWPLAN
Show transportable plan.
Definition: GUIAppEnum.h:429
@ MID_HIDE_WALKINGAREA_PATH
Hide persons's path on walkingarea.
Definition: GUIAppEnum.h:483
@ MID_SHOW_WALKINGAREA_PATH
Show persons's path on walkingarea.
Definition: GUIAppEnum.h:481
@ MID_START_TRACK
Start to track a vehicle.
Definition: GUIAppEnum.h:467
@ MID_REMOVE_OBJECT
remove a vehice or person
Definition: GUIAppEnum.h:479
@ MID_SHOW_CURRENTROUTE
Show vehicle's current route.
Definition: GUIAppEnum.h:447
@ MID_STOP_TRACK
Stop to track a vehicle.
Definition: GUIAppEnum.h:469
@ GLO_MAX
empty max
@ GLO_PERSON
a person
GUISelectedStorage gSelected
A global holder of selected objects.
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:53
#define SIMSTEP
Definition: SUMOTime.h:59
long long int SUMOTime
Definition: SUMOTime.h:32
const int VTYPEPARS_COLOR_SET
const int VEHPARS_COLOR_SET
const double INVALID_DOUBLE
Definition: StdDefs.h:63
T MAX2(T a, T b)
Definition: StdDefs.h:80
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:77
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:299
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:507
static void pushName(unsigned int name)
push Name
Definition: GLHelper.cpp:132
static void popMatrix()
pop matrix
Definition: GLHelper.cpp:123
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:277
static RGBColor getColor()
gets the gl-color
Definition: GLHelper.cpp:513
static void popName()
pop Name
Definition: GLHelper.cpp:141
static void pushMatrix()
push matrix
Definition: GLHelper.cpp:114
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:640
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 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 buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
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:59
const PositionVector & getShape() const
Definition: GUILane.cpp:987
const std::vector< double > & getShapeLengths() const
Definition: GUILane.cpp:999
const std::vector< double > & getShapeRotations() const
Definition: GUILane.cpp:993
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:132
long onCmdShowPlan(FXObject *, FXSelector, void *)
Called if the plan shall be shown.
Definition: GUIPerson.cpp:114
long onCmdRemoveObject(FXObject *, FXSelector, void *)
Called when removing the person.
Definition: GUIPerson.cpp:150
long onCmdHideCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the person shall be hidden.
Definition: GUIPerson.cpp:88
long onCmdHideWalkingareaPath(FXObject *, FXSelector, void *)
Called if the walkingarea path of the person shall be hidden.
Definition: GUIPerson.cpp:106
~GUIPersonPopupMenu()
Destructor.
Definition: GUIPerson.cpp:74
long onCmdStopTrack(FXObject *, FXSelector, void *)
Called if the person shall not be tracked any longer.
Definition: GUIPerson.cpp:142
long onCmdShowCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the person shall be shown.
Definition: GUIPerson.cpp:78
long onCmdShowWalkingareaPath(FXObject *, FXSelector, void *)
Called if the walkingarea path of the person shall be shown.
Definition: GUIPerson.cpp:96
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUIPerson.cpp:388
void drawAction_drawWalkingareaPath(const GUIVisualizationSettings &s) const
draw walking area path
Definition: GUIPerson.cpp:325
bool proceed(MSNet *net, SUMOTime time, const bool vehicleArrived=false) override
Definition: GUIPerson.cpp:662
double getExaggeration(const GUIVisualizationSettings &s) const override
return exaggeration asociated with this GLObject
Definition: GUIPerson.cpp:267
std::string getDestinationStopID() const
get destination stop ID
Definition: GUIPerson.cpp:609
std::string getDestinationEdgeID() const
get destination edge ID
Definition: GUIPerson.cpp:599
std::string getStageIndexDescription() const
get stage index description
Definition: GUIPerson.cpp:569
Position getPosition() const override
return the Network coordinate of the person
Definition: GUIPerson.cpp:490
virtual void drawGLAdditional(GUISUMOAbstractView *const parent, const GUIVisualizationSettings &s) const override
Draws additionally triggered visualisations.
Definition: GUIPerson.cpp:353
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
Definition: GUIPerson.cpp:187
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const override
gets the color value according to the current scheme index
Definition: GUIPerson.cpp:442
~GUIPerson()
destructor
Definition: GUIPerson.cpp:174
double getGUIAngle() const
return the angle of the person (only for drawing centering and tracking)
Definition: GUIPerson.cpp:525
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIPerson.cpp:273
bool isSelected() const override
whether this person is selected in the GUI
Definition: GUIPerson.cpp:696
Position getGUIPosition(const GUIVisualizationSettings *s=nullptr) const
return the Network coordinate of the person (only for drawing centering and tracking)
Definition: GUIPerson.cpp:500
bool isJammed() const
whether the person is jammed as defined by the current pedestrian model
Definition: GUIPerson.cpp:343
double getStopDuration() const
get remaining duration of current stop or -1
Definition: GUIPerson.cpp:639
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:228
@ VO_SHOW_ROUTE
show persons's current route
Definition: GUIPerson.h:230
double getEdgePos() const override
Return the position on the edge.
Definition: GUIPerson.cpp:471
double getSpeed() const override
the current speed of the person
Definition: GUIPerson.cpp:559
double getNaviDegree() const
return the current angle of the person
Definition: GUIPerson.cpp:539
std::string getVehicleID() const
get current vehicle id if applicable
Definition: GUIPerson.cpp:624
GUIPerson(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan, const double speedFactor)
Constructor.
Definition: GUIPerson.cpp:167
std::string getEdgeID() const
get edge ID
Definition: GUIPerson.cpp:579
bool hasActiveAddVisualisation(GUISUMOAbstractView *const parent, int which) const
Returns whether the named feature is enabled in the given view.
Definition: GUIPerson.cpp:674
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some vehicle function
Definition: GUIPerson.cpp:397
double getWaitingSeconds() const override
the time this person spent waiting in seconds
Definition: GUIPerson.cpp:549
void setPositionInVehicle(const GUIBaseVehicle::Seat &pos)
Definition: GUIPerson.cpp:382
void removeActiveAddVisualisation(GUISUMOAbstractView *const parent, int which) override
Adds the named visualisation feature to the given view.
Definition: GUIPerson.cpp:690
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own parameter window.
Definition: GUIPerson.cpp:222
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.
Definition: GUIPerson.cpp:480
std::string getFromEdgeID() const
ger from edge ID
Definition: GUIPerson.cpp:589
double getStageArrivalPos() const
get stage arrival position
Definition: GUIPerson.cpp:653
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own type parameter window.
Definition: GUIPerson.cpp:249
void addActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
Definition: GUIPerson.cpp:680
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
Definition: GUIPerson.cpp:283
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)
GUIVisualizationTextSettings personName
double angle
The current view rotation angle.
static double naviDegree(const double angle)
Definition: GeomHelper.cpp:192
virtual void removePerson(MSTransportable *p) const
Definition: MSEdge.cpp:1024
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:174
virtual MSTransportableControl & getPersonControl()
Returns the person control.
Definition: MSNet.cpp:1059
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:110
double getSpeedFactor() const
the current speed factor of the transportable (where applicable)
Definition: MSPerson.h:270
virtual MSStoppingPlace * getOriginStop() const
returns the origin stop (if any). only needed for MSStageTrip
Definition: MSStage.h:85
virtual double getArrivalPos() const
Definition: MSStage.h:89
virtual SUMOVehicle * getVehicle() const
Current vehicle in which the transportable is driving (or nullptr)
Definition: MSStage.h:162
MSStoppingPlace * getDestinationStop() const
returns the destination stop (if any)
Definition: MSStage.h:80
virtual void abort(MSTransportable *)
abort this stage (TraCI)
Definition: MSStage.h:136
virtual const MSEdge * getEdge() const
Returns the current edge.
Definition: MSStage.cpp:76
virtual MSTransportableStateAdapter * getState() const
Definition: MSStage.h:478
const std::vector< const MSEdge * > & getRoute() const
Definition: MSStage.h:523
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
virtual double getEdgePos() const
Return the position on the edge.
std::string getCurrentStageDescription() const
Returns the current stage description as a string.
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
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
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...
const MSVehicleType & getVehicleType() const
Returns the object's "vehicle" type.
virtual Position getPosition() const
Return the Network coordinate of the transportable.
const MSEdge * getFromEdge() const
Returns the departure edge.
int getNumStages() const
Return the total number stages in this persons plan.
MSStageType getCurrentStageType() const
the current stage type of the transportable
const MSEdge * getEdge() const
Returns the current edge.
MSStage * getCurrentStage() const
Return the current stage.
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
virtual int getDirection() const
Return the movement directon on the edge.
std::vector< MSStage * > MSTransportablePlan
the structure holding the plan of a transportable
const MSEdge * getDestination() const
Returns the current destination.
virtual bool isJammed() const
whether the transportable is jammed
Definition: MSPModel.h:175
The car-following model and parameter.
Definition: MSVehicleType.h:62
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
double getMaxSpeed() const
Get vehicle's maximum speed [m/s].
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.
const std::string & getID() const
Returns the name of the vehicle type.
Definition: MSVehicleType.h:90
double getLength() const
Get vehicle's length [m].
const SUMOVTypeParameter & getParameter() const
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:293
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:368
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:197
Representation of a vehicle.
Definition: SUMOVehicle.h:60
Structure representing possible vehicle parameter.
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