Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GUITriggeredRerouter.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2023 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
20// Reroutes vehicles passing an edge (gui version)
21/****************************************************************************/
22#include <config.h>
23
24#include <string>
27#include <utils/geom/Boundary.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>
41#include <gui/GUIGlobals.h>
47
48
49// ===========================================================================
50// FOX callback mapping
51// ===========================================================================
52/* -------------------------------------------------------------------------
53 * GUITriggeredRerouter::GUITriggeredRerouterPopupMenu - mapping
54 * ----------------------------------------------------------------------- */
60
61// Object implementation
63
64
65/* -------------------------------------------------------------------------
66 * GUITriggeredRerouter::GUIManip_TriggeredRerouter - mapping
67 * ----------------------------------------------------------------------- */
75
76FXIMPLEMENT(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, const std::string& name, GUITriggeredRerouter& o) :
87 GUIManipulator(app, name, 0, 0), myParent(&app),
88 myChosenValue(0), myChosenTarget(myChosenValue, nullptr, MID_OPTION),
89 myUsageProbability(o.getProbability()), myUsageProbabilityTarget(myUsageProbability),
90 myObject(&o) {
91 myChosenTarget.setTarget(this);
92 FXVerticalFrame* f1 =
93 new FXVerticalFrame(this, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0);
94
95 FXGroupBox* gp = new FXGroupBox(f1, "Change Trigger Probability",
96 GROUPBOX_TITLE_LEFT | FRAME_SUNKEN | FRAME_RIDGE,
97 0, 0, 0, 0, 4, 4, 1, 1, 2, 0);
98 {
99 // default
100 FXHorizontalFrame* gf1 =
101 new FXHorizontalFrame(gp, LAYOUT_TOP | LAYOUT_LEFT, 0, 0, 0, 0, 10, 10, 5, 5);
102 new FXRadioButton(gf1, "Default", &myChosenTarget, FXDataTarget::ID_OPTION + 0,
103 ICON_BEFORE_TEXT | LAYOUT_SIDE_TOP,
104 0, 0, 0, 0, 2, 2, 0, 0);
105 }
106 {
107 // free
108 FXHorizontalFrame* gf12 =
109 new FXHorizontalFrame(gp, LAYOUT_TOP | LAYOUT_LEFT, 0, 0, 0, 0, 10, 10, 5, 5);
110 new FXRadioButton(gf12, "User Given: ", &myChosenTarget, FXDataTarget::ID_OPTION + 1,
111 ICON_BEFORE_TEXT | LAYOUT_SIDE_TOP | LAYOUT_CENTER_Y,
112 0, 0, 0, 0, 2, 2, 0, 0);
113 myUsageProbabilityDial =
114 new FXRealSpinner(gf12, 10, this, MID_USER_DEF,
115 LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
116 //myUsageProbabilityDial->setFormatString("%.2f");
117 //myUsageProbabilityDial->setIncrements(.1, .1, .1);
118 myUsageProbabilityDial->setIncrement(.1);
119 myUsageProbabilityDial->setRange(0, 1);
120 myUsageProbabilityDial->setValue(myObject->getUserProbability());
121 }
122 {
123 // off
124 FXHorizontalFrame* gf13 =
125 new FXHorizontalFrame(gp, LAYOUT_TOP | LAYOUT_LEFT, 0, 0, 0, 0, 10, 10, 5, 5);
126 new FXRadioButton(gf13, "Off", &myChosenTarget, FXDataTarget::ID_OPTION + 2,
127 ICON_BEFORE_TEXT | LAYOUT_SIDE_TOP,
128 0, 0, 0, 0, 2, 2, 0, 0);
129 }
130 myChosenValue = myObject->inUserMode()
131 ? myObject->getUserProbability() > 0
132 ? 1 : 2
133 : 0;
134
135 FXGroupBox* gp2 = new FXGroupBox(f1, "Change Route Probability",
136 GROUPBOX_TITLE_LEFT | FRAME_SUNKEN | FRAME_RIDGE,
137 0, 0, 0, 0, 4, 4, 1, 1, 2, 0);
138 new FXButton(gp2, "Shift", nullptr, this, MID_SHIFT_PROBS,
139 BUTTON_INITIAL | BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_CENTER_X, 0, 0, 0, 0, 30, 30, 4, 4);
140
141 new FXButton(f1, "Close", nullptr, this, MID_CLOSE,
142 BUTTON_INITIAL | BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_CENTER_X, 0, 0, 0, 0, 30, 30, 4, 4);
143
144}
145
146
148
149
150long
152 destroy();
153 return 1;
154}
155
156
157long
159 myUsageProbability = (double)(myUsageProbabilityDial->getValue());
160 static_cast<GUITriggeredRerouter*>(myObject)->setUserUsageProbability(myUsageProbability);
161 static_cast<GUITriggeredRerouter*>(myObject)->setUserMode(true);
162 myParent->updateChildren();
163 return 1;
164}
165
166
167long
169 sender->handle(this,
170 myChosenValue != 1 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
171 ptr);
172 myParent->updateChildren();
173 return 1;
174}
175
176
177long
179 static_cast<GUITriggeredRerouter*>(myObject)->setUserUsageProbability(myUsageProbability);
180 switch (myChosenValue) {
181 case 0:
182 static_cast<GUITriggeredRerouter*>(myObject)->setUserMode(false);
183 break;
184 case 1:
185 static_cast<GUITriggeredRerouter*>(myObject)->setUserMode(true);
186 break;
187 case 2:
188 static_cast<GUITriggeredRerouter*>(myObject)->setUserUsageProbability(0);
189 static_cast<GUITriggeredRerouter*>(myObject)->setUserMode(true);
190 break;
191 default:
192 throw 1;
193 }
194 myParent->updateChildren();
195 return 1;
196}
197
198long
200 static_cast<GUITriggeredRerouter*>(myObject)->shiftProbs();
201 myParent->updateChildren();
202 return 1;
203}
204
205
206
207/* -------------------------------------------------------------------------
208 * GUITriggeredRerouter::GUITriggeredRerouterPopupMenu - methods
209 * ----------------------------------------------------------------------- */
214
215
217
218
219long
221 FXSelector,
222 void*) {
223 static_cast<GUITriggeredRerouter*>(myObject)->openManipulator(
224 *myApplication, *myParent);
225 return 1;
226}
227
228// -------------------------------------------------------------------------
229// GUITriggeredRerouter - methods
230// -------------------------------------------------------------------------
231
232GUITriggeredRerouter::GUITriggeredRerouter(const std::string& id, const MSEdgeVector& edges, double prob,
233 bool off, SUMOTime timeThreshold, const std::string& vTypes, SUMORTree& rtree) :
234 MSTriggeredRerouter(id, edges, prob, off, timeThreshold, vTypes),
237 // add visualisation objects for edges which trigger the rerouter
238 for (MSEdgeVector::const_iterator it = edges.begin(); it != edges.end(); ++it) {
239 myEdgeVisualizations.push_back(new GUITriggeredRerouterEdge(dynamic_cast<GUIEdge*>(*it), this, REROUTER_TRIGGER_EDGE));
241 myBoundary.add(myEdgeVisualizations.back()->getCenteringBoundary());
242 }
243}
244
245
247 for (std::vector<GUITriggeredRerouterEdge*>::iterator it = myEdgeVisualizations.begin(); it != myEdgeVisualizations.end(); ++it) {
248 delete *it;
249 }
250 myEdgeVisualizations.clear();
251}
252
253
254void
257 if (element == SUMO_TAG_INTERVAL) {
258 // add visualisation objects for closed edges
259 const RerouteInterval& ri = myIntervals.back();
260 for (MSEdgeVector::const_iterator it = ri.closed.begin(); it != ri.closed.end(); ++it) {
261 myEdgeVisualizations.push_back(new GUITriggeredRerouterEdge(dynamic_cast<GUIEdge*>(*it), this, REROUTER_CLOSED_EDGE));
262 dynamic_cast<GUINet*>(GUINet::getInstance())->getVisualisationSpeedUp().addAdditionalGLObject(myEdgeVisualizations.back());
263 myBoundary.add(myEdgeVisualizations.back()->getCenteringBoundary());
264 }
265 // add visualisation objects for switches
266 if (ri.routeProbs.getProbs().size() > 1) {
267 // find last common edge of all routes
268 ConstMSRoutePtr route0 = ri.routeProbs.getVals()[0];
269 const MSEdge* lastEdge = nullptr;
270 int nextIndex = 0;
271 for (int i = 0; i < (int)route0->getEdges().size(); i++) {
272 const MSEdge* cand = route0->getEdges()[i];
273 for (ConstMSRoutePtr route : ri.routeProbs.getVals()) {
274 const MSEdge* nextEdge = i < (int)route->getEdges().size() ? route->getEdges()[i] : nullptr;
275 if (nextEdge != cand) {
276 cand = nullptr;
277 }
278 }
279 if (cand != nullptr) {
280 lastEdge = cand;
281 } else {
282 nextIndex = i;
283 break;
284 }
285 }
286 if (lastEdge != nullptr) {
287 for (int i = 0; i < (int)ri.routeProbs.getVals().size(); i++) {
288 const ConstMSEdgeVector& edges = ri.routeProbs.getVals()[i]->getEdges();
289 if (nextIndex < (int)edges.size()) {
290 GUIEdge* edge = dynamic_cast<GUIEdge*>(const_cast<MSEdge*>(edges[nextIndex]));
292 dynamic_cast<GUINet*>(GUINet::getInstance())->getVisualisationSpeedUp().addAdditionalGLObject(myEdgeVisualizations.back());
293 myBoundary.add(myEdgeVisualizations.back()->getCenteringBoundary());
294 }
295 }
296 }
297 }
298 }
299}
300
301
314
315
321
322
323void
327
328
332 b.grow(20);
333 return b;
334}
335
336
337double
341
342
347 gui->create();
348 gui->show(PLACEMENT_SCREEN);
349 return gui;
350}
351
352
353void
355 const RerouteInterval* const ri = getCurrentReroute(MSNet::getInstance()->getCurrentTimeStep());
356 if (ri != nullptr && ri->routeProbs.getProbs().size() > 1) {
357 auto& rp = const_cast<RandomDistributor<ConstMSRoutePtr>&>(ri->routeProbs);
359 double prob = rp.getProbs()[myShiftProbDistIndex];
360 rp.add(rp.getVals()[myShiftProbDistIndex], -prob);
361 myShiftProbDistIndex = (myShiftProbDistIndex + 1) % rp.getProbs().size();
362 rp.add(rp.getVals()[myShiftProbDistIndex], prob);
363 // notify vehicles currently on a trigger edge
364 for (auto rrEdge : myEdgeVisualizations) {
365 if (rrEdge->getRerouterEdgeType() == REROUTER_TRIGGER_EDGE) {
367 for (MSLane* lane : rrEdge->getEdge()->getLanes()) {
368 for (const MSVehicle* veh : lane->getVehiclesSecure()) {
369 const_cast<MSVehicle*>(veh)->addReminder(this);
370 }
371 lane->releaseVehicles();
372 }
373 }
374 }
375 }
376 }
377}
378
379
380/* -------------------------------------------------------------------------
381 * GUITriggeredRerouterEdge - methods
382 * ----------------------------------------------------------------------- */
384 GUIGlObject(GLO_REROUTER_EDGE, parent->getID() + ":" + edge->getID(), GUIIconSubSys::getIcon(GUIIcon::REROUTER)),
385 myParent(parent),
386 myEdge(edge),
387 myEdgeType(edgeType),
388 myDistIndex(distIndex) {
389 const std::vector<MSLane*>& lanes = edge->getLanes();
390 myFGPositions.reserve(lanes.size());
391 myFGRotations.reserve(lanes.size());
392 for (const MSLane* lane : lanes) {
393 if ((lane->getPermissions() & ~SVC_PEDESTRIAN) == 0) {
394 continue;
395 }
396 const PositionVector& v = lane->getShape();
397 const double pos = edgeType == REROUTER_TRIGGER_EDGE ? MAX2(0.0, v.length() - 6) : MIN2(v.length(), 3.0);
398 myFGPositions.push_back(v.positionAtOffset(pos));
399 myFGRotations.push_back(-v.rotationDegreeAtOffset(pos));
401 myHalfWidths.push_back(lane->getWidth() * 0.5 * 0.875);
402 }
403}
404
405
407
408
411 GUISUMOAbstractView& parent) {
412 return myParent->getPopUpMenu(app, parent);
413}
414
415
421
422
423void
425 const double exaggeration = getExaggeration(s);
426 if (s.scale * exaggeration >= 3) {
428 const double prob = myParent->getProbability();
429 if (myEdgeType == REROUTER_CLOSED_EDGE) {
430 // draw closing symbol onto all lanes
431 const RerouteInterval* const ri =
432 myParent->getCurrentReroute(MSNet::getInstance()->getCurrentTimeStep());
433 if (ri != nullptr && prob > 0) {
434 // draw only if the edge is closed at this time
435 if (std::find(ri->closed.begin(), ri->closed.end(), myEdge) != ri->closed.end()) {
436 const int noLanes = (int)myFGPositions.size();
437 for (int j = 0; j < noLanes; ++j) {
438 Position pos = myFGPositions[j];
439 double rot = myFGRotations[j];
441 glTranslated(pos.x(), pos.y(), 0);
442 glRotated(rot, 0, 0, 1);
443 glTranslated(0, -1.5, 0);
444 int noPoints = 9;
445 if (s.scale > 25) {
446 noPoints = (int)(9.0 + s.scale / 10.0);
447 if (noPoints > 36) {
448 noPoints = 36;
449 }
450 }
451 glTranslated(0, 0, getType());
452 //glScaled(exaggeration, exaggeration, 1);
453 glColor3d(0.7, 0, 0);
454 GLHelper::drawFilledCircle((double) 1.3, noPoints);
455 glTranslated(0, 0, .1);
456 glColor3d(1, 0, 0);
457 GLHelper::drawFilledCircle((double) 1.3, noPoints, 0, prob * 360);
458 glTranslated(0, 0, .1);
459 glColor3d(1, 1, 1);
460 glRotated(-90, 0, 0, 1);
461 glBegin(GL_TRIANGLES);
462 glVertex2d(0 - .3, -1.);
463 glVertex2d(0 - .3, 1.);
464 glVertex2d(0 + .3, 1.);
465 glVertex2d(0 + .3, -1.);
466 glVertex2d(0 - .3, -1.);
467 glVertex2d(0 + .3, 1.);
468 glEnd();
470 }
471 }
472 }
473
474 } else if (myEdgeType == REROUTER_TRIGGER_EDGE) {
475 // draw rerouter symbol onto all lanes
476 for (int i = 0; i < (int)myFGPositions.size(); ++i) {
477 const Position& pos = myFGPositions[i];
478 double rot = myFGRotations[i];
479 const double w = myHalfWidths[i];
481 glTranslated(pos.x(), pos.y(), 0);
482 glRotated(rot, 0, 0, 1);
483 glTranslated(0, 0, getType());
484 glScaled(exaggeration, exaggeration, 1);
485 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
486
487 glBegin(GL_TRIANGLES);
488 glColor3d(1, .8f, 0);
489 // base
490 glVertex2d(0 - w, 0);
491 glVertex2d(0 - w, 6);
492 glVertex2d(0 + w, 6);
493 glVertex2d(0 + w, 0);
494 glVertex2d(0 - w, 0);
495 glVertex2d(0 + w, 6);
496 glEnd();
497
498 // draw "U"
499 GLHelper::drawText("U", Position(0, 2), .1, 3 * (w / 1.4), RGBColor::BLACK, 180);
500
501 // draw Probability
502 GLHelper::drawText((toString((int)(prob * 100)) + "%").c_str(), Position(0, 4), .1, 0.7, RGBColor::BLACK, 180);
503
505 }
506 } else if (myEdgeType == REROUTER_SWITCH_EDGE) {
507 const RerouteInterval* const ri =
508 myParent->getCurrentReroute(MSNet::getInstance()->getCurrentTimeStep());
509 const double routeProb = ri != nullptr && prob > 0 ? ri->routeProbs.getProbs()[myDistIndex] / ri->routeProbs.getOverallProb() : 0;
510 if (routeProb > 0) {
511 for (int i = 0; i < (int)myFGPositions.size(); ++i) {
512 const Position& pos = myFGPositions[i];
513 double rot = myFGRotations[i];
514 const double w = myHalfWidths[i];
516 glTranslated(pos.x(), pos.y(), 0);
517 glRotated(rot, 0, 0, 1);
518 glTranslated(0, 0, getType());
519 glScaled(exaggeration, exaggeration, 1);
520 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
521
522 glBegin(GL_TRIANGLES);
523 glColor3d(0, 1, 1);
524 // base
525 glVertex2d(0 - 0.0, 0);
526 glVertex2d(0 - w, 6);
527 glVertex2d(0 + w, 6);
528 glVertex2d(0 + 0.0, 0);
529 glVertex2d(0 + w, 6);
530 glEnd();
531
532 // draw "P"
533 GLHelper::drawText("P", Position(0, 3.5), .1, 2, RGBColor::BLACK, 180);
534
535 // draw Probability for this target edge
536 GLHelper::drawText((toString((int)(routeProb * 100)) + "%").c_str(), Position(0, 5), .1, 0.7, RGBColor::BLACK, 180);
537
539 }
540 }
541 }
543 }
544}
545
546
547double
551
552
559
560
561void
563 myParent->shiftProbs();
564}
565
566
567/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
@ MID_MANIP
Open the object's manipulator.
Definition GUIAppEnum.h:482
@ GLO_REROUTER_EDGE
a Rerouter over edge
@ GLO_REROUTER
a Rerouter
GUIIcon
An enumeration of icons used by the gui applications.
Definition GUIIcons.h:33
FXDEFMAP(GUITriggeredRerouter::GUIManip_TriggeredRerouter) GUIManip_TriggeredRerouterMap[]
GUITriggeredRerouterPopupMenuMap[]
std::vector< const MSEdge * > ConstMSEdgeVector
Definition MSEdge.h:74
std::vector< MSEdge * > MSEdgeVector
Definition MSEdge.h:73
std::shared_ptr< const MSRoute > ConstMSRoutePtr
Definition Route.h:32
@ SVC_PEDESTRIAN
pedestrian
@ SUMO_TAG_INTERVAL
an aggreagated-output interval
#define UNUSED_PARAMETER(x)
Definition StdDefs.h:30
T MIN2(T a, T b)
Definition StdDefs.h:76
T MAX2(T a, T b)
Definition StdDefs.h:82
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
A class that stores a 2D geometrical boundary.
Definition Boundary.h:39
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition Boundary.cpp:78
Boundary & grow(double by)
extends the boundary by the given amount
Definition Boundary.cpp:300
static void drawFilledCircle(double width, int steps=8)
Draws a filled circle around (0,0)
Definition GLHelper.cpp:498
static void pushName(unsigned int name)
push Name
Definition GLHelper.cpp:139
static void popMatrix()
pop matrix
Definition GLHelper.cpp:130
static void popName()
pop Name
Definition GLHelper.cpp:148
static void pushMatrix()
push matrix
Definition GLHelper.cpp:117
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:685
A road/street connecting two junctions (gui-version)
Definition GUIEdge.h:51
The popup menu of a globject.
void buildShowManipulatorPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the manipulator window.
const std::string & getFullName() const
Definition GUIGlObject.h:92
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.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, const GUIMainWindow &app) const
Builds an entry which allows to copy the cursor position if geo projection is used,...
GUIGlID getGlID() const
Returns the numerical id of the object.
A MSNet extended by some values for usage within the gui.
Definition GUINet.h:82
A window containing a gl-object's parameter.
long onUpdUserDef(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.
std::vector< double > myHalfWidths
The sign half-widths.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
PosCont myFGPositions
The positions in full-geometry mode.
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
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, bool off, SUMOTime timeThreshold, const std::string &vTypes, SUMORTree &rtree)
Constructor.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
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:168
static bool gUseMesoSim
Definition MSGlobals.h:103
Representation of a lane in the micro simulation.
Definition MSLane.h:84
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition MSNet.cpp:183
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:37
double x() const
Returns the x-position.
Definition Position.h:55
double y() const
Returns the y-position.
Definition Position.h:60
A list of positions.
double length() const
Returns the length.
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
static const RGBColor BLACK
Definition RGBColor.h:193
Represents a generic random distribution.
double getOverallProb() const
Return the sum of the probabilites assigned to the members.
const std::vector< T > & getVals() const
Returns the members of the distribution.
const std::vector< double > & getProbs() const
Returns the probabilities assigned to the members of the distribution.
A RT-tree for efficient storing of SUMO's GL-objects.
Definition SUMORTree.h:66
void addAdditionalGLObject(GUIGlObject *o, const double exaggeration=1)
Adds an additional object (detector/shape/trigger) for visualisation.
Definition SUMORTree.h:124
Definition json.hpp:4471
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
RandomDistributor< ConstMSRoutePtr > routeProbs
The distributions of new routes to use.
MSEdgeVector closed
The list of closed edges.