Eclipse SUMO - Simulation of Urban MObility
GUITriggeredRerouter.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 // Reroutes vehicles passing an edge (gui version)
21 /****************************************************************************/
22 #include <config.h>
23 
24 #include <string>
27 #include <utils/geom/Boundary.h>
28 #include <utils/gui/div/GLHelper.h>
29 #include <utils/common/ToString.h>
30 #include <utils/common/Command.h>
31 #include <microsim/MSNet.h>
32 #include <microsim/MSLane.h>
33 #include <microsim/MSEdge.h>
34 #include <microsim/MSRoute.h>
35 #include <microsim/MSVehicle.h>
36 #include <guisim/GUINet.h>
37 #include <guisim/GUIEdge.h>
38 #include "GUITriggeredRerouter.h"
41 #include <gui/GUIGlobals.h>
47 
48 
49 // ===========================================================================
50 // FOX callback mapping
51 // ===========================================================================
52 /* -------------------------------------------------------------------------
53  * GUITriggeredRerouter::GUITriggeredRerouterPopupMenu - mapping
54  * ----------------------------------------------------------------------- */
58 
59 };
60 
61 // Object implementation
63 
64 
65 /* -------------------------------------------------------------------------
66  * GUITriggeredRerouter::GUIManip_TriggeredRerouter - mapping
67  * ----------------------------------------------------------------------- */
68 FXDEFMAP(GUITriggeredRerouter::GUIManip_TriggeredRerouter) GUIManip_TriggeredRerouterMap[] = {
74 };
75 
76 FXIMPLEMENT(GUITriggeredRerouter::GUIManip_TriggeredRerouter, GUIManipulator, GUIManip_TriggeredRerouterMap, ARRAYNUMBER(GUIManip_TriggeredRerouterMap))
77 
78 
79 // ===========================================================================
80 // method definitions
81 // ===========================================================================
82 /* -------------------------------------------------------------------------
83  * GUITriggeredRerouter::GUIManip_TriggeredRerouter - methods
84  * ----------------------------------------------------------------------- */
86  GUIMainWindow& app,
87  const std::string& name, GUITriggeredRerouter& o,
88  int /*xpos*/, int /*ypos*/)
89  : GUIManipulator(app, name, 0, 0), myParent(&app),
90  myChosenValue(0), myChosenTarget(myChosenValue, nullptr, MID_OPTION),
91  myUsageProbability(o.getProbability()), myUsageProbabilityTarget(myUsageProbability),
92  myObject(&o) {
93  myChosenTarget.setTarget(this);
94  FXVerticalFrame* f1 =
95  new FXVerticalFrame(this, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0);
96 
97  FXGroupBox* gp = new FXGroupBox(f1, "Change Trigger Probability",
98  GROUPBOX_TITLE_LEFT | FRAME_SUNKEN | FRAME_RIDGE,
99  0, 0, 0, 0, 4, 4, 1, 1, 2, 0);
100  {
101  // default
102  FXHorizontalFrame* gf1 =
103  new FXHorizontalFrame(gp, LAYOUT_TOP | LAYOUT_LEFT, 0, 0, 0, 0, 10, 10, 5, 5);
104  new FXRadioButton(gf1, "Default", &myChosenTarget, FXDataTarget::ID_OPTION + 0,
105  ICON_BEFORE_TEXT | LAYOUT_SIDE_TOP,
106  0, 0, 0, 0, 2, 2, 0, 0);
107  }
108  {
109  // free
110  FXHorizontalFrame* gf12 =
111  new FXHorizontalFrame(gp, LAYOUT_TOP | LAYOUT_LEFT, 0, 0, 0, 0, 10, 10, 5, 5);
112  new FXRadioButton(gf12, "User Given: ", &myChosenTarget, FXDataTarget::ID_OPTION + 1,
113  ICON_BEFORE_TEXT | LAYOUT_SIDE_TOP | LAYOUT_CENTER_Y,
114  0, 0, 0, 0, 2, 2, 0, 0);
115  myUsageProbabilityDial =
116  new FXRealSpinner(gf12, 10, this, MID_USER_DEF,
117  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
118  //myUsageProbabilityDial->setFormatString("%.2f");
119  //myUsageProbabilityDial->setIncrements(.1, .1, .1);
120  myUsageProbabilityDial->setIncrement(.1);
121  myUsageProbabilityDial->setRange(0, 1);
122  myUsageProbabilityDial->setValue(myObject->getUserProbability());
123  }
124  {
125  // off
126  FXHorizontalFrame* gf13 =
127  new FXHorizontalFrame(gp, LAYOUT_TOP | LAYOUT_LEFT, 0, 0, 0, 0, 10, 10, 5, 5);
128  new FXRadioButton(gf13, "Off", &myChosenTarget, FXDataTarget::ID_OPTION + 2,
129  ICON_BEFORE_TEXT | LAYOUT_SIDE_TOP,
130  0, 0, 0, 0, 2, 2, 0, 0);
131  }
132  myChosenValue = myObject->inUserMode()
133  ? myObject->getUserProbability() > 0
134  ? 1 : 2
135  : 0;
136 
137  FXGroupBox* gp2 = new FXGroupBox(f1, "Change Route Probability",
138  GROUPBOX_TITLE_LEFT | FRAME_SUNKEN | FRAME_RIDGE,
139  0, 0, 0, 0, 4, 4, 1, 1, 2, 0);
140  new FXButton(gp2, "Shift", nullptr, this, MID_SHIFT_PROBS,
141  BUTTON_INITIAL | BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_CENTER_X, 0, 0, 0, 0, 30, 30, 4, 4);
142 
143  new FXButton(f1, "Close", nullptr, this, MID_CLOSE,
144  BUTTON_INITIAL | BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_CENTER_X, 0, 0, 0, 0, 30, 30, 4, 4);
145 
146 }
147 
148 
150 
151 
152 long
154  destroy();
155  return 1;
156 }
157 
158 
159 long
161  myUsageProbability = (double)(myUsageProbabilityDial->getValue());
162  static_cast<GUITriggeredRerouter*>(myObject)->setUserUsageProbability(myUsageProbability);
163  static_cast<GUITriggeredRerouter*>(myObject)->setUserMode(true);
164  myParent->updateChildren();
165  return 1;
166 }
167 
168 
169 long
170 GUITriggeredRerouter::GUIManip_TriggeredRerouter::onUpdUserDef(FXObject* sender, FXSelector, void* ptr) {
171  sender->handle(this,
172  myChosenValue != 1 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
173  ptr);
174  myParent->updateChildren();
175  return 1;
176 }
177 
178 
179 long
181  static_cast<GUITriggeredRerouter*>(myObject)->setUserUsageProbability(myUsageProbability);
182  switch (myChosenValue) {
183  case 0:
184  static_cast<GUITriggeredRerouter*>(myObject)->setUserMode(false);
185  break;
186  case 1:
187  static_cast<GUITriggeredRerouter*>(myObject)->setUserMode(true);
188  break;
189  case 2:
190  static_cast<GUITriggeredRerouter*>(myObject)->setUserUsageProbability(0);
191  static_cast<GUITriggeredRerouter*>(myObject)->setUserMode(true);
192  break;
193  default:
194  throw 1;
195  }
196  myParent->updateChildren();
197  return 1;
198 }
199 
200 long
202  static_cast<GUITriggeredRerouter*>(myObject)->shiftProbs();
203  myParent->updateChildren();
204  return 1;
205 }
206 
207 
208 
209 /* -------------------------------------------------------------------------
210  * GUITriggeredRerouter::GUITriggeredRerouterPopupMenu - methods
211  * ----------------------------------------------------------------------- */
213  GUIMainWindow& app, GUISUMOAbstractView& parent,
214  GUIGlObject& o)
215  : GUIGLObjectPopupMenu(app, parent, o) {}
216 
217 
219 
220 
221 long
223  FXSelector,
224  void*) {
225  static_cast<GUITriggeredRerouter*>(myObject)->openManipulator(
226  *myApplication, *myParent);
227  return 1;
228 }
229 
230 // -------------------------------------------------------------------------
231 // GUITriggeredRerouter - methods
232 // -------------------------------------------------------------------------
233 
234 GUITriggeredRerouter::GUITriggeredRerouter(const std::string& id, const MSEdgeVector& edges, double prob,
235  const std::string& aXMLFilename, bool off, SUMOTime timeThreshold, const std::string& vTypes, SUMORTree& rtree) :
236  MSTriggeredRerouter(id, edges, prob, aXMLFilename, off, timeThreshold, vTypes),
239  // add visualisation objects for edges which trigger the rerouter
240  for (MSEdgeVector::const_iterator it = edges.begin(); it != edges.end(); ++it) {
241  myEdgeVisualizations.push_back(new GUITriggeredRerouterEdge(dynamic_cast<GUIEdge*>(*it), this, REROUTER_TRIGGER_EDGE));
243  myBoundary.add(myEdgeVisualizations.back()->getCenteringBoundary());
244  }
245 }
246 
247 
249  for (std::vector<GUITriggeredRerouterEdge*>::iterator it = myEdgeVisualizations.begin(); it != myEdgeVisualizations.end(); ++it) {
250  delete *it;
251  }
252  myEdgeVisualizations.clear();
253 }
254 
255 
256 void
259  if (element == SUMO_TAG_INTERVAL) {
260  // add visualisation objects for closed edges
261  const RerouteInterval& ri = myIntervals.back();
262  for (MSEdgeVector::const_iterator it = ri.closed.begin(); it != ri.closed.end(); ++it) {
263  myEdgeVisualizations.push_back(new GUITriggeredRerouterEdge(dynamic_cast<GUIEdge*>(*it), this, REROUTER_CLOSED_EDGE));
264  dynamic_cast<GUINet*>(GUINet::getInstance())->getVisualisationSpeedUp().addAdditionalGLObject(myEdgeVisualizations.back());
265  myBoundary.add(myEdgeVisualizations.back()->getCenteringBoundary());
266  }
267  // add visualisation objects for switches
268  if (ri.routeProbs.getProbs().size() > 1) {
269  // find last common edge of all routes
270  const MSRoute* route0 = ri.routeProbs.getVals()[0];
271  const MSEdge* lastEdge = nullptr;
272  int nextIndex = 0;
273  for (int i = 0; i < (int)route0->getEdges().size(); i++) {
274  const MSEdge* cand = route0->getEdges()[i];
275  for (const MSRoute* route : ri.routeProbs.getVals()) {
276  const MSEdge* nextEdge = i < (int)route->getEdges().size() ? route->getEdges()[i] : nullptr;
277  if (nextEdge != cand) {
278  cand = nullptr;
279  }
280  }
281  if (cand != nullptr) {
282  lastEdge = cand;
283  } else {
284  nextIndex = i;
285  break;
286  }
287  }
288  if (lastEdge != nullptr) {
289  for (int i = 0; i < (int)ri.routeProbs.getVals().size(); i++) {
290  const ConstMSEdgeVector& edges = ri.routeProbs.getVals()[i]->getEdges();
291  if (nextIndex < (int)edges.size()) {
292  GUIEdge* edge = dynamic_cast<GUIEdge*>(const_cast<MSEdge*>(edges[nextIndex]));
294  dynamic_cast<GUINet*>(GUINet::getInstance())->getVisualisationSpeedUp().addAdditionalGLObject(myEdgeVisualizations.back());
295  myBoundary.add(myEdgeVisualizations.back()->getCenteringBoundary());
296  }
297  }
298  }
299  }
300  }
301 }
302 
303 
306  GUISUMOAbstractView& parent) {
307  GUIGLObjectPopupMenu* ret = new GUITriggeredRerouterPopupMenu(app, parent, *this);
308  buildPopupHeader(ret, app);
310  buildShowManipulatorPopupEntry(ret, false);
313  buildPositionCopyEntry(ret, false);
314  return ret;
315 }
316 
317 
321  return nullptr;
322 }
323 
324 
325 void
327  UNUSED_PARAMETER(s);
328 }
329 
330 
331 Boundary
333  Boundary b(myBoundary);
334  b.grow(20);
335  return b;
336 }
337 
338 
339 
344  new GUIManip_TriggeredRerouter(app, getFullName(), *this, 0, 0);
345  gui->create();
346  gui->show();
347  return gui;
348 }
349 
350 
351 void
353  const RerouteInterval* const ri = getCurrentReroute(MSNet::getInstance()->getCurrentTimeStep());
354  if (ri != nullptr && ri->routeProbs.getProbs().size() > 1) {
355  auto& rp = const_cast<RandomDistributor<const MSRoute*>&>(ri->routeProbs);
356  myShiftProbDistIndex = myShiftProbDistIndex % rp.getProbs().size();
357  double prob = rp.getProbs()[myShiftProbDistIndex];
358  rp.add(rp.getVals()[myShiftProbDistIndex], -prob);
359  myShiftProbDistIndex = (myShiftProbDistIndex + 1) % rp.getProbs().size();
360  rp.add(rp.getVals()[myShiftProbDistIndex], prob);
361  // notify vehicles currently on a trigger edge
362  for (auto rrEdge : myEdgeVisualizations) {
363  if (rrEdge->getRerouterEdgeType() == REROUTER_TRIGGER_EDGE) {
364  if (!MSGlobals::gUseMesoSim) {
365  for (MSLane* lane : rrEdge->getEdge()->getLanes()) {
366  for (const MSVehicle* veh : lane->getVehiclesSecure()) {
367  const_cast<MSVehicle*>(veh)->addReminder(this);
368  }
369  lane->releaseVehicles();
370  }
371  }
372  }
373  }
374  }
375 }
376 
377 
378 /* -------------------------------------------------------------------------
379  * GUITriggeredRerouterEdge - methods
380  * ----------------------------------------------------------------------- */
382  GUIGlObject(GLO_REROUTER_EDGE, parent->getID() + ":" + edge->getID()),
383  myParent(parent),
384  myEdge(edge),
385  myEdgeType(edgeType),
386  myDistIndex(distIndex) {
387  const std::vector<MSLane*>& lanes = edge->getLanes();
388  myFGPositions.reserve(lanes.size());
389  myFGRotations.reserve(lanes.size());
390  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
391  const PositionVector& v = (*i)->getShape();
392  const double pos = edgeType == REROUTER_TRIGGER_EDGE ? v.length() - (double) 6. : 3;
393  myFGPositions.push_back((*i)->geometryPositionAtOffset(pos));
394  myFGRotations.push_back(-v.rotationDegreeAtOffset(pos));
395  myBoundary.add(myFGPositions.back());
396  }
397 }
398 
399 
401 
402 
405  GUISUMOAbstractView& parent) {
406  return myParent->getPopUpMenu(app, parent);
407 }
408 
409 
413  return nullptr;
414 }
415 
416 
417 void
419  const double exaggeration = s.addSize.getExaggeration(s, this);
420  if (s.scale * exaggeration >= 3) {
421  glPushName(getGlID());
422  const double prob = myParent->getProbability();
423  if (myEdgeType == REROUTER_CLOSED_EDGE) {
424  // draw closing symbol onto all lanes
425  const RerouteInterval* const ri =
426  myParent->getCurrentReroute(MSNet::getInstance()->getCurrentTimeStep());
427  if (ri != nullptr && prob > 0) {
428  // draw only if the edge is closed at this time
429  if (std::find(ri->closed.begin(), ri->closed.end(), myEdge) != ri->closed.end()) {
430  const int noLanes = (int)myFGPositions.size();
431  for (int j = 0; j < noLanes; ++j) {
432  Position pos = myFGPositions[j];
433  double rot = myFGRotations[j];
434  glPushMatrix();
435  glTranslated(pos.x(), pos.y(), 0);
436  glRotated(rot, 0, 0, 1);
437  glTranslated(0, -1.5, 0);
438  int noPoints = 9;
439  if (s.scale > 25) {
440  noPoints = (int)(9.0 + s.scale / 10.0);
441  if (noPoints > 36) {
442  noPoints = 36;
443  }
444  }
445  glTranslated(0, 0, getType());
446  //glScaled(exaggeration, exaggeration, 1);
447  glColor3d(0.7, 0, 0);
448  GLHelper::drawFilledCircle((double) 1.3, noPoints);
449  glTranslated(0, 0, .1);
450  glColor3d(1, 0, 0);
451  GLHelper::drawFilledCircle((double) 1.3, noPoints, 0, prob * 360);
452  glTranslated(0, 0, .1);
453  glColor3d(1, 1, 1);
454  glRotated(-90, 0, 0, 1);
455  glBegin(GL_TRIANGLES);
456  glVertex2d(0 - .3, -1.);
457  glVertex2d(0 - .3, 1.);
458  glVertex2d(0 + .3, 1.);
459  glVertex2d(0 + .3, -1.);
460  glVertex2d(0 - .3, -1.);
461  glVertex2d(0 + .3, 1.);
462  glEnd();
463  glPopMatrix();
464  }
465  }
466  }
467 
468  } else if (myEdgeType == REROUTER_TRIGGER_EDGE) {
469  // draw rerouter symbol onto all lanes
470  for (int i = 0; i < (int)myFGPositions.size(); ++i) {
471  const Position& pos = myFGPositions[i];
472  double rot = myFGRotations[i];
473  glPushMatrix();
474  glTranslated(pos.x(), pos.y(), 0);
475  glRotated(rot, 0, 0, 1);
476  glTranslated(0, 0, getType());
477  glScaled(exaggeration, exaggeration, 1);
478  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
479 
480  glBegin(GL_TRIANGLES);
481  glColor3d(1, .8f, 0);
482  // base
483  glVertex2d(0 - 1.4, 0);
484  glVertex2d(0 - 1.4, 6);
485  glVertex2d(0 + 1.4, 6);
486  glVertex2d(0 + 1.4, 0);
487  glVertex2d(0 - 1.4, 0);
488  glVertex2d(0 + 1.4, 6);
489  glEnd();
490 
491  // draw "U"
492  GLHelper::drawText("U", Position(0, 2), .1, 3, RGBColor::BLACK, 180);
493 
494  // draw Probability
495  GLHelper::drawText((toString((int)(prob * 100)) + "%").c_str(), Position(0, 4), .1, 0.7, RGBColor::BLACK, 180);
496 
497  glPopMatrix();
498  }
499  } else if (myEdgeType == REROUTER_SWITCH_EDGE) {
500  const RerouteInterval* const ri =
501  myParent->getCurrentReroute(MSNet::getInstance()->getCurrentTimeStep());
502  const double routeProb = ri != nullptr && prob > 0 ? ri->routeProbs.getProbs()[myDistIndex] / ri->routeProbs.getOverallProb() : 0;
503  if (routeProb > 0) {
504  for (int i = 0; i < (int)myFGPositions.size(); ++i) {
505  const Position& pos = myFGPositions[i];
506  double rot = myFGRotations[i];
507  glPushMatrix();
508  glTranslated(pos.x(), pos.y(), 0);
509  glRotated(rot, 0, 0, 1);
510  glTranslated(0, 0, getType());
511  glScaled(exaggeration, exaggeration, 1);
512  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
513 
514  glBegin(GL_TRIANGLES);
515  glColor3d(0, 1, 1);
516  // base
517  glVertex2d(0 - 0.0, 0);
518  glVertex2d(0 - 1.4, 6);
519  glVertex2d(0 + 1.4, 6);
520  glVertex2d(0 + 0.0, 0);
521  glVertex2d(0 + 1.4, 6);
522  glEnd();
523 
524  // draw "P"
525  GLHelper::drawText("P", Position(0, 3.5), .1, 2, RGBColor::BLACK, 180);
526 
527  // draw Probability for this target edge
528  GLHelper::drawText((toString((int)(routeProb * 100)) + "%").c_str(), Position(0, 5), .1, 0.7, RGBColor::BLACK, 180);
529 
530  glPopMatrix();
531  }
532  }
533  }
534  glPopName();
535  }
536 }
537 
538 
539 Boundary
541  Boundary b(myBoundary);
542  b.grow(20);
543  return b;
544 }
545 
546 
547 void
549  myParent->shiftProbs();
550 }
551 
552 
553 /****************************************************************************/
@ MID_MANIP
Open the object's manipulator.
Definition: GUIAppEnum.h:431
@ GLO_REROUTER_EDGE
a Rerouter
@ GLO_REROUTER
a Rerouter
FXDEFMAP(GUITriggeredRerouter::GUIManip_TriggeredRerouter) GUIManip_TriggeredRerouterMap[]
GUITriggeredRerouterPopupMenuMap[]
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:74
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdge.h:73
long long int SUMOTime
Definition: SUMOTime.h:31
@ SUMO_TAG_INTERVAL
an aggreagated-output interval
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:29
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 drawFilledCircle(double width, int steps=8)
Draws a filled circle around (0,0)
Definition: GLHelper.cpp:347
static void drawText(const std::string &text, const Position &pos, const double layer, const double size, const RGBColor &col=RGBColor::BLACK, const double angle=0, const int align=0, double width=-1)
Definition: GLHelper.cpp:498
A road/street connecting two junctions (gui-version)
Definition: GUIEdge.h:50
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 buildShowManipulatorPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the manipulator window.
const std::string & getFullName() const
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.
A MSNet extended by some values for usage within the gui.
Definition: GUINet.h:81
A window containing a gl-object's parameter.
long onUpdUserDef(FXObject *, FXSelector, void *)
long onCmdClose(FXObject *, FXSelector, void *)
long onCmdChangeOption(FXObject *, FXSelector, void *)
long onCmdShiftProbs(FXObject *, FXSelector, void *)
long onCmdUserDef(FXObject *, FXSelector, void *)
void onLeftBtnPress(void *data)
notify object about left click
Boundary myBoundary
The boundary of this rerouter.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
GUITriggeredRerouterEdge(GUIEdge *edge, GUITriggeredRerouter *parent, RerouterEdgeType edgeType, int distIndex=-1)
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
PosCont myFGPositions
The positions in full-geometry mode.
RotCont myFGRotations
The rotations in full-geometry mode.
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
long onCmdOpenManip(FXObject *, FXSelector, void *)
Called if the object's manipulator shall be shown.
Reroutes vehicles passing an edge One rerouter can be active on multiple edges. To reduce drawing loa...
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
std::vector< GUITriggeredRerouterEdge * > myEdgeVisualizations
void shiftProbs()
shit route probabilities
GUIManipulator * openManipulator(GUIMainWindow &app, GUISUMOAbstractView &parent)
void myEndElement(int element)
Called when a closing tag occurs.
GUITriggeredRerouter(const std::string &id, const MSEdgeVector &edges, double prob, const std::string &aXMLFilename, bool off, SUMOTime timeThreshold, const std::string &vTypes, SUMORTree &rtree)
Constructor.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Boundary myBoundary
The boundary of this rerouter.
Stores the information about how to visualize structures.
GUIVisualizationSizeSettings addSize
double scale
information about a lane's width (temporary, used for a single view)
A road/street connecting two junctions.
Definition: MSEdge.h:77
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:166
static bool gUseMesoSim
Definition: MSGlobals.h:88
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
MSEdge & getEdge() const
Returns the lane's edge.
Definition: MSLane.h:673
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:171
const ConstMSEdgeVector & getEdges() const
Definition: MSRoute.h:120
Reroutes vehicles passing an edge.
void setUserUsageProbability(double prob)
Sets the probability with which a vehicle is rerouted given by the user.
virtual void myEndElement(int element)
Called when a closing tag occurs.
const RerouteInterval * getCurrentReroute(SUMOTime time, SUMOVehicle &veh) const
Returns the rerouting definition valid for the given time and vehicle, 0 if none.
std::vector< RerouteInterval > myIntervals
List of rerouting definition intervals.
void setUserMode(bool val)
Sets whether the process is currently steered by the user.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:77
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
double x() const
Returns the x-position.
Definition: Position.h:54
double y() const
Returns the y-position.
Definition: Position.h:59
A list of positions.
double length() const
Returns the length.
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
static const RGBColor BLACK
Definition: RGBColor.h:188
double getOverallProb() const
Return the sum of the probabilites assigned to the members.
const std::vector< double > & getProbs() const
Returns the probabilities assigned to the members of the distribution.
const std::vector< T > & getVals() const
Returns the members of the distribution.
A RT-tree for efficient storing of SUMO's GL-objects.
Definition: SUMORTree.h:66
void addAdditionalGLObject(GUIGlObject *o)
Adds an additional object (detector/shape/trigger) for visualisation.
Definition: SUMORTree.h:124
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
RandomDistributor< const MSRoute * > routeProbs
The distributions of new routes to use.
MSEdgeVector closed
The list of closed edges.