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-2020 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 
29 #include <utils/gui/div/GLHelper.h>
35 
36 #include "GUILane.h"
37 #include "GUIPerson.h"
38 
39 //#define GUIPerson_DEBUG_DRAW_WALKINGAREA_PATHS 1
40 
41 // ===========================================================================
42 // FOX callback mapping
43 // ===========================================================================
44 
45 FXDEFMAP(GUIPerson::GUIPersonPopupMenu) GUIPersonPopupMenuMap[] = {
54 };
55 
56 // Object implementation
57 FXIMPLEMENT(GUIPerson::GUIPersonPopupMenu, GUIGLObjectPopupMenu, GUIPersonPopupMenuMap, ARRAYNUMBER(GUIPersonPopupMenuMap))
58 
59 // ===========================================================================
60 // method definitions
61 // ===========================================================================
62 
63 // -------------------------------------------------------------------------
64 // GUIPerson::GUIPersonPopupMenu - methods
65 // -------------------------------------------------------------------------
66 
68  GUIMainWindow& app, GUISUMOAbstractView& parent, GUIGlObject& o) :
69  GUIGLObjectPopupMenu(app, parent, o) {
70 }
71 
72 
74 
75 
76 long
78  assert(myObject->getType() == GLO_PERSON);
79  if (!static_cast<GUIPerson*>(myObject)->hasActiveAddVisualisation(myParent, VO_SHOW_ROUTE)) {
80  static_cast<GUIPerson*>(myObject)->addActiveAddVisualisation(myParent, VO_SHOW_ROUTE);
81  }
82  return 1;
83 }
84 
85 
86 long
88  assert(myObject->getType() == GLO_PERSON);
89  static_cast<GUIPerson*>(myObject)->removeActiveAddVisualisation(myParent, VO_SHOW_ROUTE);
90  return 1;
91 }
92 
93 
94 long
96  assert(myObject->getType() == GLO_PERSON);
97  if (!static_cast<GUIPerson*>(myObject)->hasActiveAddVisualisation(myParent, VO_SHOW_WALKINGAREA_PATH)) {
98  static_cast<GUIPerson*>(myObject)->addActiveAddVisualisation(myParent, VO_SHOW_WALKINGAREA_PATH);
99  }
100  return 1;
101 }
102 
103 
104 long
106  assert(myObject->getType() == GLO_PERSON);
107  static_cast<GUIPerson*>(myObject)->removeActiveAddVisualisation(myParent, VO_SHOW_WALKINGAREA_PATH);
108  return 1;
109 }
110 
111 
112 long
113 GUIPerson::GUIPersonPopupMenu::onCmdShowPlan(FXObject*, FXSelector, void*) {
114  GUIPerson* p = dynamic_cast<GUIPerson*>(myObject);
115  if (p == nullptr) {
116  return 1;
117  }
118  GUIParameterTableWindow* ret = new GUIParameterTableWindow(*myApplication, *p);
119  // add items
120  for (int stage = 1; stage < p->getNumStages(); stage++) {
121  ret->mkItem(toString(stage).c_str(), false, p->getStageSummary(stage));
122  }
123  // close building (use an object that is not Parameterised as argument)
124  Parameterised dummyParameterised;
125  ret->closeBuilding(&dummyParameterised);
126  return 1;
127 }
128 
129 
130 long
131 GUIPerson::GUIPersonPopupMenu::onCmdStartTrack(FXObject*, FXSelector, void*) {
132  assert(myObject->getType() == GLO_PERSON);
133  if (myParent->getTrackedID() != static_cast<GUIPerson*>(myObject)->getGlID()) {
134  myParent->startTrack(static_cast<GUIPerson*>(myObject)->getGlID());
135  }
136  return 1;
137 }
138 
139 
140 long
141 GUIPerson::GUIPersonPopupMenu::onCmdStopTrack(FXObject*, FXSelector, void*) {
142  assert(myObject->getType() == GLO_PERSON);
143  myParent->stopTrack();
144  return 1;
145 }
146 
147 
148 long
150  GUIPerson* person = static_cast<GUIPerson*>(myObject);
151  MSStage* stage = person->getCurrentStage();
152  stage->abort(person);
153  stage->getEdge()->removePerson(person);
154  if (stage->getDestinationStop() != nullptr) {
155  stage->getDestinationStop()->removeTransportable(person);
156  }
158  myParent->update();
159  return 1;
160 }
161 
162 // -------------------------------------------------------------------------
163 // GUIPerson - methods
164 // -------------------------------------------------------------------------
165 
167  MSPerson(pars, vtype, plan, speedFactor),
168  GUIGlObject(GLO_PERSON, pars->id),
169  myLock(true)
170 { }
171 
172 
174  myLock.lock();
175  for (std::map<GUISUMOAbstractView*, int>::iterator i = myAdditionalVisualizations.begin(); i != myAdditionalVisualizations.end(); ++i) {
176  if (i->first->getTrackedID() == getGlID()) {
177  i->first->stopTrack();
178  }
179  while (i->first->removeAdditionalGLVisualisation(this));
180  }
181  myLock.unlock();
182 }
183 
184 
187  GUIGLObjectPopupMenu* ret = new GUIPersonPopupMenu(app, parent, *this);
188  buildPopupHeader(ret, app);
193  GUIDesigns::buildFXMenuCommand(ret, "Hide Current Route", nullptr, ret, MID_HIDE_CURRENTROUTE);
194  } else {
195  GUIDesigns::buildFXMenuCommand(ret, "Show Current Route", nullptr, ret, MID_SHOW_CURRENTROUTE);
196  }
198  GUIDesigns::buildFXMenuCommand(ret, "Hide Walkingarea Path", nullptr, ret, MID_HIDE_WALKINGAREA_PATH);
199  } else {
200  GUIDesigns::buildFXMenuCommand(ret, "Show Walkingarea Path", nullptr, ret, MID_SHOW_WALKINGAREA_PATH);
201  }
202  new FXMenuSeparator(ret);
203  if (parent.getTrackedID() != getGlID()) {
204  GUIDesigns::buildFXMenuCommand(ret, "Start Tracking", nullptr, ret, MID_START_TRACK);
205  } else {
206  GUIDesigns::buildFXMenuCommand(ret, "Stop Tracking", nullptr, ret, MID_STOP_TRACK);
207  }
208  GUIDesigns::buildFXMenuCommand(ret, "Remove", nullptr, ret, MID_REMOVE_OBJECT);
209  new FXMenuSeparator(ret);
210  //
214  new FXMenuSeparator(ret);
215  buildPositionCopyEntry(ret, false);
216  return ret;
217 }
218 
219 
223  GUIParameterTableWindow* ret = new GUIParameterTableWindow(app, *this);
224  // add items
226  // there is always the "start" stage which we do not count here because it is not strictly part of the plan
227  ret->mkItem("stage index", true, new FunctionBindingString<GUIPerson>(this, &GUIPerson::getStageIndexDescription));
228  ret->mkItem("start edge [id]", true, new FunctionBindingString<GUIPerson>(this, &GUIPerson::getFromEdgeID));
229  ret->mkItem("dest edge [id]", true, new FunctionBindingString<GUIPerson>(this, &GUIPerson::getDestinationEdgeID));
230  ret->mkItem("arrivalPos [m]", true, new FunctionBinding<GUIPerson, double>(this, &GUIPerson::getStageArrivalPos));
231  ret->mkItem("edge [id]", true, new FunctionBindingString<GUIPerson>(this, &GUIPerson::getEdgeID));
232  ret->mkItem("position [m]", true, new FunctionBinding<GUIPerson, double>(this, &GUIPerson::getEdgePos));
233  ret->mkItem("speed [m/s]", true, new FunctionBinding<GUIPerson, double>(this, &GUIPerson::getSpeed));
234  ret->mkItem("speed factor", false, getSpeedFactor());
235  ret->mkItem("angle [degree]", true, new FunctionBinding<GUIPerson, double>(this, &GUIPerson::getNaviDegree));
236  ret->mkItem("waiting time [s]", true, new FunctionBinding<GUIPerson, double>(this, &GUIPerson::getWaitingSeconds));
237  ret->mkItem("desired depart [s]", false, time2string(getParameter().depart));
238  // close building
239  ret->closeBuilding(&getParameter());
240  return ret;
241 }
242 
243 
247  GUIParameterTableWindow* ret = new GUIParameterTableWindow(app, *this);
248  // add items
249  ret->mkItem("Type Information:", false, "");
250  ret->mkItem("type [id]", false, myVType->getID());
251  ret->mkItem("length", false, myVType->getLength());
252  ret->mkItem("width", false, myVType->getWidth());
253  ret->mkItem("height", false, myVType->getHeight());
254  ret->mkItem("minGap", false, myVType->getMinGap());
255  ret->mkItem("maximum speed [m/s]", false, myVType->getMaxSpeed());
256  // close building
257  ret->closeBuilding(&(myVType->getParameter()));
258  return ret;
259 }
260 
261 
262 Boundary
264  Boundary b;
265  // ensure that the vehicle is drawn, otherwise myPositionInVehicle will not be updated
266  b.add(getGUIPosition());
267  b.grow(MAX2(getVehicleType().getWidth(), getVehicleType().getLength()));
268  return b;
269 }
270 
271 
272 void
274  glPushName(getGlID());
275  glPushMatrix();
276  Position p1 = getGUIPosition();
277  double angle = getGUIAngle();
278  glTranslated(p1.x(), p1.y(), getType());
279  // set person color
280  setColor(s);
281  // scale
282  const double exaggeration = s.personSize.getExaggeration(s, this, 80);
283  glScaled(exaggeration, exaggeration, 1);
284  switch (s.personQuality) {
285  case 0:
287  break;
288  case 1:
290  break;
291  case 2:
293  break;
294  case 3:
295  default:
297  getVehicleType().getImgFile(), getVehicleType().getGuiShape(), exaggeration);
298  break;
299  }
300  glPopMatrix();
301 #ifdef GUIPerson_DEBUG_DRAW_WALKINGAREA_PATHS
303 #endif
304  drawName(p1, s.scale, s.personName, s.angle);
305  if (s.personValue.show) {
306  Position p2 = p1 + Position(0, 0.6 * s.personName.scaledSize(s.scale));
307  const double value = getColorValue(s, s.personColorer.getActive());
309  }
310  glPopName();
311 }
312 
313 
314 void
317  if (stage != nullptr) {
318  setColor(s);
319  MSPModel_Striping::PState* stripingState = dynamic_cast<MSPModel_Striping::PState*>(stage->getState());
320  if (stripingState != nullptr) {
321  const MSPModel_Striping::WalkingAreaPath* waPath = stripingState->myWalkingAreaPath;
322  if (waPath != nullptr) {
323  glPushMatrix();
324  glTranslated(0, 0, getType());
325  GLHelper::drawBoxLines(waPath->shape, 0.05);
326  glPopMatrix();
327  }
328  }
329  }
330 }
331 
332 bool
335  if (stage != nullptr) {
336  return stage->getState()->isJammed();
337  }
338  return false;
339 }
340 
341 
342 void
344  glPushName(getGlID());
345  glPushMatrix();
346  glTranslated(0, 0, getType() - .1); // don't draw on top of other cars
349  }
352  setColor(s);
353  RGBColor current = GLHelper::getColor();
354  RGBColor darker = current.changedBrightness(-51);
355  GLHelper::setColor(darker);
357  assert(stage != 0);
358  const double exaggeration = s.personSize.getExaggeration(s, this);
359  const ConstMSEdgeVector& edges = stage->getRoute();
360  for (ConstMSEdgeVector::const_iterator it = edges.begin(); it != edges.end(); ++it) {
361  GUILane* lane = static_cast<GUILane*>((*it)->getLanes()[0]);
362  GLHelper::drawBoxLines(lane->getShape(), lane->getShapeRotations(), lane->getShapeLengths(), exaggeration);
363  }
364  }
365  }
366  glPopMatrix();
367  glPopName();
368 }
369 
370 
371 void
373  myPositionInVehicle = pos;
374 }
375 
376 
377 void
379  const GUIColorer& c = s.personColorer;
380  if (!setFunctionalColor(c.getActive())) {
382  }
383 }
384 
385 
386 bool
387 GUIPerson::setFunctionalColor(int activeScheme) const {
388  switch (activeScheme) {
389  case 0: {
390  if (getParameter().wasSet(VEHPARS_COLOR_SET)) {
392  return true;
393  }
394  if (getVehicleType().wasSet(VTYPEPARS_COLOR_SET)) {
395  GLHelper::setColor(getVehicleType().getColor());
396  return true;
397  }
398  return false;
399  }
400  case 2: {
401  if (getParameter().wasSet(VEHPARS_COLOR_SET)) {
403  return true;
404  }
405  return false;
406  }
407  case 3: {
408  if (getVehicleType().wasSet(VTYPEPARS_COLOR_SET)) {
409  GLHelper::setColor(getVehicleType().getColor());
410  return true;
411  }
412  return false;
413  }
414  case 9: { // color by angle
415  double hue = GeomHelper::naviDegree(getAngle());
417  return true;
418  }
419  case 10: { // color randomly (by pointer)
420  const double hue = (double)((long long int)this % 360); // [0-360]
421  const double sat = (((long long int)this / 360) % 67) / 100.0 + 0.33; // [0.33-1]
422  GLHelper::setColor(RGBColor::fromHSV(hue, sat, 1.));
423  return true;
424  }
425  default:
426  return false;
427  }
428 }
429 
430 
431 double
432 GUIPerson::getColorValue(const GUIVisualizationSettings& /* s */, int activeScheme) const {
433  switch (activeScheme) {
434  case 4:
435  return getSpeed();
436  case 5:
437  if (isWaiting4Vehicle()) {
438  return 5;
439  } else {
440  return (double)getCurrentStageType();
441  }
442  case 6:
443  return getWaitingSeconds();
444  case 7:
445  return isJammed() ? 1 : 0;
446  case 8:
448  }
449  return 0;
450 }
451 
452 
453 double
455  FXMutexLock locker(myLock);
456  if (hasArrived()) {
457  return -1;
458  }
459  return MSPerson::getEdgePos();
460 }
461 
462 
463 Position
465  FXMutexLock locker(myLock);
466  if (hasArrived()) {
467  return Position::INVALID;
468  }
469  return MSPerson::getPosition();
470 }
471 
472 
473 Position
475  FXMutexLock locker(myLock);
476  if (hasArrived()) {
477  return Position::INVALID;
478  }
480  return myPositionInVehicle.pos;
481  } else {
482  return MSPerson::getPosition();
483  }
484 }
485 
486 
487 double
489  FXMutexLock locker(myLock);
490  if (hasArrived()) {
491  return INVALID_DOUBLE;
492  }
494  return myPositionInVehicle.angle;
495  } else {
496  return MSPerson::getAngle();
497  }
498 }
499 
500 
501 double
503  FXMutexLock locker(myLock);
504  if (hasArrived()) {
505  return INVALID_DOUBLE;
506  }
508 }
509 
510 
511 double
513  FXMutexLock locker(myLock);
514  if (hasArrived()) {
515  return -1;
516  }
518 }
519 
520 
521 double
523  FXMutexLock locker(myLock);
524  if (hasArrived()) {
525  return -1;
526  }
527  return MSPerson::getSpeed();
528 }
529 
530 
531 std::string
533  FXMutexLock locker(myLock);
534  if (hasArrived()) {
535  return "arrived";
536  }
537  return toString(getNumStages() - getNumRemainingStages()) + " of " + toString(getNumStages() - 1);
538 }
539 
540 
541 std::string
543  FXMutexLock locker(myLock);
544  if (hasArrived()) {
545  return "arrived";
546  }
547  return getEdge()->getID();
548 }
549 
550 
551 std::string
553  FXMutexLock locker(myLock);
554  if (hasArrived()) {
555  return "arrived";
556  }
557  return getFromEdge()->getID();
558 }
559 
560 
561 std::string
563  FXMutexLock locker(myLock);
564  if (hasArrived()) {
565  return "arrived";
566  }
567  return getDestination()->getID();
568 }
569 
570 
571 double
573  FXMutexLock locker(myLock);
574  if (hasArrived()) {
575  return INVALID_DOUBLE;
576  }
577  return getCurrentStage()->getArrivalPos();
578 }
579 
580 bool
581 GUIPerson::proceed(MSNet* net, SUMOTime time, const bool vehicleArrived) {
582  FXMutexLock locker(myLock);
583  return MSTransportable::proceed(net, time, vehicleArrived);
584 }
585 
586 // -------------------------------------------------------------------------
587 // GUIPerson - Additional Visualsation methods
588 // -------------------------------------------------------------------------
589 
590 bool
592  return myAdditionalVisualizations.find(parent) != myAdditionalVisualizations.end() && (myAdditionalVisualizations.find(parent)->second & which) != 0;
593 }
594 
595 
596 void
598  if (myAdditionalVisualizations.find(parent) == myAdditionalVisualizations.end()) {
599  myAdditionalVisualizations[parent] = 0;
600  }
601  myAdditionalVisualizations[parent] |= which;
602  parent->addAdditionalGLVisualisation(this);
603 }
604 
605 
606 void
608  myAdditionalVisualizations[parent] &= ~which;
609  parent->removeAdditionalGLVisualisation(this);
610 }
611 
612 bool
615 }
616 
617 
618 /****************************************************************************/
@ MID_HIDE_CURRENTROUTE
Hide vehicle's current route.
Definition: GUIAppEnum.h:437
@ MID_SHOWPLAN
Show transportable plan.
Definition: GUIAppEnum.h:417
@ MID_HIDE_WALKINGAREA_PATH
Hide persons's path on walkingarea.
Definition: GUIAppEnum.h:469
@ MID_SHOW_WALKINGAREA_PATH
Show persons's path on walkingarea.
Definition: GUIAppEnum.h:467
@ MID_START_TRACK
Start to track a vehicle.
Definition: GUIAppEnum.h:455
@ MID_REMOVE_OBJECT
remove a vehice or person
Definition: GUIAppEnum.h:465
@ MID_SHOW_CURRENTROUTE
Show vehicle's current route.
Definition: GUIAppEnum.h:435
@ MID_STOP_TRACK
Stop to track a vehicle.
Definition: GUIAppEnum.h:457
@ 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
long long int SUMOTime
Definition: SUMOTime.h:31
const int VTYPEPARS_COLOR_SET
const int VEHPARS_COLOR_SET
const double INVALID_DOUBLE
Definition: StdDefs.h:62
T MAX2(T a, T b)
Definition: StdDefs.h:79
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:44
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:446
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:181
static RGBColor getColor()
gets the gl-color
Definition: GLHelper.cpp:452
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:529
static void drawAction_drawAsCircle(const double length, const double width)
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_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:40
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) 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:919
const std::vector< double > & getShapeLengths() const
Definition: GUILane.cpp:931
const std::vector< double > & getShapeRotations() const
Definition: GUILane.cpp:925
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:131
long onCmdShowPlan(FXObject *, FXSelector, void *)
Called if the plan shall be shown.
Definition: GUIPerson.cpp:113
long onCmdRemoveObject(FXObject *, FXSelector, void *)
Called when removing the person.
Definition: GUIPerson.cpp:149
long onCmdHideCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the person shall be hidden.
Definition: GUIPerson.cpp:87
long onCmdHideWalkingareaPath(FXObject *, FXSelector, void *)
Called if the walkingarea path of the person shall be hidden.
Definition: GUIPerson.cpp:105
~GUIPersonPopupMenu()
Destructor.
Definition: GUIPerson.cpp:73
long onCmdStopTrack(FXObject *, FXSelector, void *)
Called if the person shall not be tracked any longer.
Definition: GUIPerson.cpp:141
long onCmdShowCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the person shall be shown.
Definition: GUIPerson.cpp:77
long onCmdShowWalkingareaPath(FXObject *, FXSelector, void *)
Called if the walkingarea path of the person shall be shown.
Definition: GUIPerson.cpp:95
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUIPerson.cpp:378
void drawAction_drawWalkingareaPath(const GUIVisualizationSettings &s) const
draw walking area path
Definition: GUIPerson.cpp:315
std::string getDestinationEdgeID() const
get destination edge ID
Definition: GUIPerson.cpp:562
std::string getStageIndexDescription() const
get stage index description
Definition: GUIPerson.cpp:532
Position getGUIPosition() const
return the Network coordinate of the person (only for drawing centering and tracking)
Definition: GUIPerson.cpp:474
~GUIPerson()
destructor
Definition: GUIPerson.cpp:173
double getGUIAngle() const
return the angle of the person (only for drawing centering and tracking)
Definition: GUIPerson.cpp:488
bool isJammed() const
whether the person is jammed as defined by the current pedestrian model
Definition: GUIPerson.cpp:333
GUIBaseVehicle::Seat myPositionInVehicle
The position of a person while riding a vehicle.
Definition: GUIPerson.h:265
std::map< GUISUMOAbstractView *, int > myAdditionalVisualizations
Enabled visualisations, per view.
Definition: GUIPerson.h:268
@ VO_SHOW_WALKINGAREA_PATH
show the current walkingarea path
Definition: GUIPerson.h:213
@ VO_SHOW_ROUTE
show persons's current route
Definition: GUIPerson.h:215
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIPerson.cpp:221
void removeActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
Definition: GUIPerson.cpp:607
double getSpeed() const
the current speed of the person
Definition: GUIPerson.cpp:522
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUIPerson.cpp:186
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIPerson.cpp:273
double getNaviDegree() const
return the current angle of the person
Definition: GUIPerson.cpp:502
virtual void drawGLAdditional(GUISUMOAbstractView *const parent, const GUIVisualizationSettings &s) const
Draws additionally triggered visualisations.
Definition: GUIPerson.cpp:343
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own type parameter window.
Definition: GUIPerson.cpp:245
GUIPerson(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan, const double speedFactor)
Constructor.
Definition: GUIPerson.cpp:166
std::string getEdgeID() const
get edge ID
Definition: GUIPerson.cpp:542
bool hasActiveAddVisualisation(GUISUMOAbstractView *const parent, int which) const
Returns whether the named feature is enabled in the given view.
Definition: GUIPerson.cpp:591
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some vehicle function
Definition: GUIPerson.cpp:387
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIPerson.cpp:263
bool proceed(MSNet *net, SUMOTime time, const bool vehicleArrived=false)
Definition: GUIPerson.cpp:581
Position getPosition() const
return the Network coordinate of the person
Definition: GUIPerson.cpp:464
void setPositionInVehicle(const GUIBaseVehicle::Seat &pos)
Definition: GUIPerson.cpp:372
bool isSelected() const
whether this person is selected in the GUI
Definition: GUIPerson.cpp:613
FXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUIPerson.h:262
std::string getFromEdgeID() const
ger from edge ID
Definition: GUIPerson.cpp:552
double getStageArrivalPos() const
get stage arrival position
Definition: GUIPerson.cpp:572
double getWaitingSeconds() const
the time this person spent waiting in seconds
Definition: GUIPerson.cpp:512
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIPerson.cpp:432
double getEdgePos() const
Return the position on the edge.
Definition: GUIPerson.cpp:454
void addActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
Definition: GUIPerson.cpp:597
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
int personQuality
The quality of person drawing.
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:953
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:171
virtual MSTransportableControl & getPersonControl()
Returns the person control.
Definition: MSNet.cpp:986
Container for pedestrian state and individual position update function.
const WalkingAreaPath * myWalkingAreaPath
the current walkingAreaPath or 0
double getSpeedFactor() const
the current speed factor of the transportable (where applicable)
Definition: MSPerson.h:265
virtual double getArrivalPos() const
Definition: MSStage.h:89
MSStoppingPlace * getDestinationStop() const
returns the destination stop (if any)
Definition: MSStage.h:80
virtual void abort(MSTransportable *)
abort this stage (TraCI)
Definition: MSStage.h:133
virtual const MSEdge * getEdge() const
Returns the current edge.
Definition: MSStage.cpp:76
virtual MSTransportableStateAdapter * getState() const
Definition: MSStage.h:463
const std::vector< const MSEdge * > & getRoute() const
Definition: MSStage.h:505
void removeTransportable(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
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
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:169
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:73
An upper class for objects with additional parameters.
Definition: Parameterised.h:39
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
static const Position INVALID
used to indicate that a position is valid
Definition: Position.h:282
double x() const
Returns the x-position.
Definition: Position.h:54
double y() const
Returns the y-position.
Definition: Position.h:59
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:300
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:145
Structure representing possible vehicle parameter.
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
double scaledSize(double scale, double constFactor=0.1) const
get scale size