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-2025 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
20// 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>
49
50
51// ===========================================================================
52// FOX callback mapping
53// ===========================================================================
54/* -------------------------------------------------------------------------
55 * GUITriggeredRerouter::GUITriggeredRerouterPopupMenu - mapping
56 * ----------------------------------------------------------------------- */
62
63// Object implementation
65
66
67/* -------------------------------------------------------------------------
68 * GUITriggeredRerouter::GUIManip_TriggeredRerouter - mapping
69 * ----------------------------------------------------------------------- */
77
78FXIMPLEMENT(GUITriggeredRerouter::GUIManip_TriggeredRerouter, GUIManipulator, GUIManip_TriggeredRerouterMap, ARRAYNUMBER(GUIManip_TriggeredRerouterMap))
79
80
81// ===========================================================================
82// method definitions
83// ===========================================================================
84/* -------------------------------------------------------------------------
85 * GUITriggeredRerouter::GUIManip_TriggeredRerouter - methods
86 * ----------------------------------------------------------------------- */
88 GUIMainWindow& app, const std::string& name, GUITriggeredRerouter& o) :
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 GUIDesigns::buildFXButton(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 GUIDesigns::buildFXButton(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
152long
154 destroy();
155 return 1;
156}
157
158
159long
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
169long
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
179long
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
200long
202 static_cast<GUITriggeredRerouter*>(myObject)->shiftProbs();
203 myParent->updateChildren();
204 return 1;
205}
206
207/* -------------------------------------------------------------------------
208 * GUITriggeredRerouter::GUITriggeredRerouterPopupMenu - methods
209 * ----------------------------------------------------------------------- */
210
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, bool optional, SUMOTime timeThreshold, const std::string& vTypes, const Position& pos, const double radius, SUMORTree& rtree) :
234 MSTriggeredRerouter(id, edges, prob, off, optional, timeThreshold, vTypes, pos, radius),
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, -1, pos, radius));
241 myBoundary.add(myEdgeVisualizations.back()->getCenteringBoundary());
242 if (pos != Position::INVALID && radius != std::numeric_limits<double>::max()) {
243 break;
244 }
245 }
246}
247
248
250 for (std::vector<GUITriggeredRerouterEdge*>::iterator it = myEdgeVisualizations.begin(); it != myEdgeVisualizations.end(); ++it) {
251 delete *it;
252 }
253 myEdgeVisualizations.clear();
254}
255
256
257void
260 if (element == SUMO_TAG_INTERVAL) {
261 // add visualisation objects for closed edges
262 const RerouteInterval& ri = myIntervals.back();
263 for (auto item : ri.getClosed()) {
264 const GUIEdge* edge = dynamic_cast<const GUIEdge*>(item.first);
265 myEdgeVisualizations.push_back(new GUITriggeredRerouterEdge(const_cast<GUIEdge*>(edge), this, REROUTER_CLOSED_EDGE));
266 dynamic_cast<GUINet*>(GUINet::getInstance())->getVisualisationSpeedUp().addAdditionalGLObject(myEdgeVisualizations.back());
267 myBoundary.add(myEdgeVisualizations.back()->getCenteringBoundary());
268 }
269 // add visualisation objects for switches
270 if (ri.routeProbs.getProbs().size() > 1) {
271 // find last common edge of all routes
272 ConstMSRoutePtr route0 = ri.routeProbs.getVals()[0];
273 const MSEdge* lastEdge = nullptr;
274 int nextIndex = 0;
275 for (int i = 0; i < (int)route0->getEdges().size(); i++) {
276 const MSEdge* cand = route0->getEdges()[i];
277 for (ConstMSRoutePtr route : ri.routeProbs.getVals()) {
278 const MSEdge* nextEdge = i < (int)route->getEdges().size() ? route->getEdges()[i] : nullptr;
279 if (nextEdge != cand) {
280 cand = nullptr;
281 }
282 }
283 if (cand != nullptr) {
284 lastEdge = cand;
285 } else {
286 nextIndex = i;
287 break;
288 }
289 }
290 if (lastEdge != nullptr) {
291 double maxProb = ri.routeProbs.getProbs()[myShiftProbDistIndex];
292 for (int i = 0; i < (int)ri.routeProbs.getVals().size(); i++) {
293 const ConstMSEdgeVector& edges = ri.routeProbs.getVals()[i]->getEdges();
294 if (nextIndex < (int)edges.size()) {
295 GUIEdge* edge = dynamic_cast<GUIEdge*>(const_cast<MSEdge*>(edges[nextIndex]));
297 dynamic_cast<GUINet*>(GUINet::getInstance())->getVisualisationSpeedUp().addAdditionalGLObject(myEdgeVisualizations.back());
298 myBoundary.add(myEdgeVisualizations.back()->getCenteringBoundary());
299 }
300 double prob = ri.routeProbs.getProbs()[i];
301 if (prob > maxProb) {
302 maxProb = prob;
304 }
305 }
306 }
307 }
308 }
309}
310
311
323
324
330
331
332void
336
337
341 b.grow(20);
342 return b;
343}
344
345
346double
350
351
356 gui->create();
357 gui->show(PLACEMENT_SCREEN);
358 return gui;
359}
360
361
362void
364 const RerouteInterval* const ri = getCurrentReroute(MSNet::getInstance()->getCurrentTimeStep());
365 if (ri != nullptr && ri->routeProbs.getProbs().size() > 1) {
366 auto& rp = const_cast<RandomDistributor<ConstMSRoutePtr>&>(ri->routeProbs);
367 double prob = rp.getProbs()[myShiftProbDistIndex];
368 rp.add(rp.getVals()[myShiftProbDistIndex], -prob);
369 myShiftProbDistIndex = (myShiftProbDistIndex + 1) % rp.getProbs().size();
370 rp.add(rp.getVals()[myShiftProbDistIndex], prob);
371 // notify vehicles currently on a trigger edge
372 for (auto rrEdge : myEdgeVisualizations) {
373 if (rrEdge->getRerouterEdgeType() == REROUTER_TRIGGER_EDGE) {
375 for (MSLane* lane : rrEdge->getEdge()->getLanes()) {
376 for (const MSVehicle* veh : lane->getVehiclesSecure()) {
377 const_cast<MSVehicle*>(veh)->addReminder(this);
378 }
379 lane->releaseVehicles();
380 }
381 }
382 }
383 }
384 }
385}
386
387
388/* -------------------------------------------------------------------------
389 * GUITriggeredRerouterEdge - methods
390 * ----------------------------------------------------------------------- */
392 const Position& pos, const double radius) :
393 GUIGlObject(GLO_REROUTER_EDGE, parent->getID() + ":" + edge->getID(), GUIIconSubSys::getIcon(GUIIcon::REROUTER)),
394 myParent(parent),
395 myEdge(edge),
396 myEdgeType(edgeType),
397 myDistIndex(distIndex) {
398 const std::vector<MSLane*>& lanes = edge->getLanes();
399 if (pos == Position::INVALID || radius == std::numeric_limits<double>::max()) {
400 for (const MSLane* lane : lanes) {
401 if ((lane->getPermissions() & ~SVC_PEDESTRIAN) == 0) {
402 continue;
403 }
404 const PositionVector& v = lane->getShape();
405 double lanePos;
406 double centerPos;
407 switch (edgeType) {
409 // U sign at end of edge
410 // (note: symbol is drawn downstream of lanePos and extends 6m)
411 lanePos = MAX2(0.0, v.length() - 10);
412 centerPos = MIN2(lanePos + 3, v.length());
413 break;
415 // triangle with switch probability
416 lanePos = 0;
417 centerPos = lanePos;
418 break;
419 default:
420 // closing sign on start of edge
421 lanePos = MIN2(v.length(), 3.0);
422 centerPos = MIN2(lanePos + 3, v.length());
423 }
424 myFGPositions.push_back(v.positionAtOffset(lanePos));
425 myFGRotations.push_back(-v.rotationDegreeAtOffset(lanePos));
426 myBoundary.add(v.positionAtOffset(centerPos));
427 myHalfWidths.push_back(lane->getWidth() * 0.5 * 0.875);
428 }
429 } else {
430 myFGPositions.push_back(pos);
431 const PositionVector& v = lanes.front()->getShape();
432 myFGRotations.push_back(-v.rotationDegreeAtOffset(lanes.front()->getLength()));
434 myHalfWidths.push_back(SUMO_const_halfLaneWidth * 0.875);
435 }
436}
437
438
440
441
444 GUISUMOAbstractView& parent) {
445 return myParent->getPopUpMenu(app, parent);
446}
447
448
454
455
456void
458 const double exaggeration = getExaggeration(s);
459 if (s.scale * exaggeration >= 3) {
461 const double prob = myParent->getProbability();
462 if (myEdgeType == REROUTER_CLOSED_EDGE) {
463 // draw closing symbol onto all lanes
464 const RerouteInterval* const ri =
465 myParent->getCurrentReroute(MSNet::getInstance()->getCurrentTimeStep());
466 if (ri != nullptr && prob > 0) {
467 // draw only if the edge is closed at this time
468 const auto& closedEdges = ri->getClosed();
469 if (closedEdges.find(myEdge) != closedEdges.end()) {
470 const int noLanes = (int)myFGPositions.size();
471 for (int j = 0; j < noLanes; ++j) {
472 Position pos = myFGPositions[j];
473 double rot = myFGRotations[j];
475 glTranslated(pos.x(), pos.y(), 0);
476 glRotated(rot, 0, 0, 1);
477 glTranslated(0, -1.5, 0);
478 int noPoints = 9;
479 if (s.scale > 25) {
480 noPoints = (int)(9.0 + s.scale / 10.0);
481 if (noPoints > 36) {
482 noPoints = 36;
483 }
484 }
485 glTranslated(0, 0, getType());
486 //glScaled(exaggeration, exaggeration, 1);
487 glColor3d(0.7, 0, 0);
488 GLHelper::drawFilledCircle((double) 1.3, noPoints);
489 glTranslated(0, 0, .1);
490 glColor3d(1, 0, 0);
491 GLHelper::drawFilledCircle((double) 1.3, noPoints, 0, prob * 360);
492 glTranslated(0, 0, .1);
493 glColor3d(1, 1, 1);
494 glRotated(-90, 0, 0, 1);
495 glBegin(GL_TRIANGLES);
496 glVertex2d(0 - .3, -1.);
497 glVertex2d(0 - .3, 1.);
498 glVertex2d(0 + .3, 1.);
499 glVertex2d(0 + .3, -1.);
500 glVertex2d(0 - .3, -1.);
501 glVertex2d(0 + .3, 1.);
502 glEnd();
504 }
505 }
506 }
507
508 } else if (myEdgeType == REROUTER_TRIGGER_EDGE) {
509 // draw rerouter symbol onto all lanes
510 for (int i = 0; i < (int)myFGPositions.size(); ++i) {
511 const Position& pos = myFGPositions[i];
512 double rot = myFGRotations[i];
513 const double w = myHalfWidths[i];
515 glTranslated(pos.x(), pos.y(), 0);
516 glRotated(rot, 0, 0, 1);
517 // draw the symbol downstream of pos (without touching the older drawing code)
518 glTranslated(0, -6, 0);
519 glTranslated(0, 0, getType());
520 glScaled(exaggeration, exaggeration, 1);
521 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
522
523 glBegin(GL_TRIANGLES);
524 glColor3d(1, .8f, 0);
525 // base
526 glVertex2d(0 - w, 0);
527 glVertex2d(0 - w, 6);
528 glVertex2d(0 + w, 6);
529 glVertex2d(0 + w, 0);
530 glVertex2d(0 - w, 0);
531 glVertex2d(0 + w, 6);
532 glEnd();
533
534 // draw "U"
535 GLHelper::drawText("U", Position(0, 2), .1, 3 * (w / 1.4), RGBColor::BLACK, 180);
536
537 // draw Probability
538 GLHelper::drawText((toString((int)(prob * 100)) + "%").c_str(), Position(0, 4), .1, 0.7, RGBColor::BLACK, 180);
539
541 }
542 } else if (myEdgeType == REROUTER_SWITCH_EDGE) {
543 const RerouteInterval* const ri =
544 myParent->getCurrentReroute(MSNet::getInstance()->getCurrentTimeStep());
545 const double routeProb = ri != nullptr && prob > 0 ? ri->routeProbs.getProbs()[myDistIndex] / ri->routeProbs.getOverallProb() : 0;
546 if (routeProb > 0) {
547 for (int i = 0; i < (int)myFGPositions.size(); ++i) {
548 const Position& pos = myFGPositions[i];
549 double rot = myFGRotations[i];
550 const double w = myHalfWidths[i];
552 glTranslated(pos.x(), pos.y(), 0);
553 glRotated(rot, 0, 0, 1);
554 glTranslated(0, 0, getType());
555 glScaled(exaggeration, exaggeration, 1);
556 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
557
558 glBegin(GL_TRIANGLES);
559 glColor3d(0, 1, 1);
560 // base
561 glVertex2d(0 - 0.0, 0);
562 glVertex2d(0 - w, 6);
563 glVertex2d(0 + w, 6);
564 glVertex2d(0 + 0.0, 0);
565 glVertex2d(0 + w, 6);
566 glEnd();
567
568 // draw "P"
569 GLHelper::drawText("P", Position(0, 3.5), .1, 2, RGBColor::BLACK, 180);
570
571 // draw Probability for this target edge
572 GLHelper::drawText((toString((int)(routeProb * 100)) + "%").c_str(), Position(0, 5), .1, 0.7, RGBColor::BLACK, 180);
573
575 }
576 }
577 }
579 }
580 if (myEdgeType == REROUTER_TRIGGER_EDGE && s.addName.show(myParent)) {
581 GLHelper::drawTextSettings(s.addName, myParent->getMicrosimID(), myFGPositions.back(), s.scale, s.angle);
582 }
583}
584
585
586double
590
591
598
599
600void
602 myParent->shiftProbs();
603}
604
605
606/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
@ MID_MANIP
Open the object's manipulator.
Definition GUIAppEnum.h:491
@ 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
T MIN2(T a, T b)
Definition StdDefs.h:80
T MAX2(T a, T b)
Definition StdDefs.h:86
const double SUMO_const_halfLaneWidth
Definition StdDefs.h:53
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
A class that stores a 2D geometrical boundary.
Definition Boundary.h:39
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition Boundary.cpp:75
Boundary & grow(double by)
extends the boundary by the given amount
Definition Boundary.cpp:340
static void pushName(unsigned int name)
push Name
Definition GLHelper.cpp:140
static void drawFilledCircle(const double widradiusth, const int steps=8)
Draws a filled circle around (0,0)
Definition GLHelper.cpp:564
static void popMatrix()
pop matrix
Definition GLHelper.cpp:131
static void popName()
pop Name
Definition GLHelper.cpp:149
static void pushMatrix()
push matrix
Definition GLHelper.cpp:118
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:742
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:773
static FXButton * buildFXButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXObject *tgt, FXSelector sel, FXuint opts=BUTTON_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
build button
A road/street connecting two junctions (gui-version)
Definition GUIEdge.h:51
The popup menu of a globject.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, const GUIMainWindow &app, bool addSeparator=true) const
Builds an entry which allows to copy the cursor position if geo projection is used,...
void buildShowManipulatorPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the manipulator window.
const std::string & getFullName() const
Definition GUIGlObject.h:95
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: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) override
notify object about left click
Boundary myBoundary
The boundary of this rerouter.
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
std::vector< double > myHalfWidths
The sign half-widths.
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own parameter window.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
double getExaggeration(const GUIVisualizationSettings &s) const override
return exaggeration associated with this GLObject
GUITriggeredRerouterEdge(GUIEdge *edge, GUITriggeredRerouter *parent, RerouterEdgeType edgeType, int distIndex=-1, const Position &pos=Position::INVALID, const double radius=std::numeric_limits< double >::max())
PosCont myFGPositions
The positions in full-geometry mode.
RotCont myFGRotations
The rotations in full-geometry mode.
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...
double getExaggeration(const GUIVisualizationSettings &s) const override
return exaggeration associated with this GLObject
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
std::vector< GUITriggeredRerouterEdge * > myEdgeVisualizations
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
void shiftProbs()
shift route probabilities
void myEndElement(int element) override
Called when a closing tag occurs.
GUIManipulator * openManipulator(GUIMainWindow &app, GUISUMOAbstractView &parent)
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
GUITriggeredRerouter(const std::string &id, const MSEdgeVector &edges, double prob, bool off, bool optional, SUMOTime timeThreshold, const std::string &vTypes, const Position &pos, const double radius, SUMORTree &rtree)
Constructor.
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own parameter window.
Boundary myBoundary
The boundary of this rerouter.
Stores the information about how to visualize structures.
GUIVisualizationTextSettings addName
GUIVisualizationSizeSettings addSize
double scale
information about a lane's width (temporary, used for a single view)
double angle
The current view rotation angle.
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:106
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:187
Reroutes traffic objects 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, SUMOTrafficObject &obj) const
Returns the rerouting definition valid for the given time and object, nullptr 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
static const Position INVALID
used to indicate that a position is valid
Definition Position.h:323
double x() const
Returns the x-position.
Definition Position.h:52
double y() const
Returns the y-position.
Definition Position.h:57
A list of positions.
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:196
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:122
#define UNUSED_PARAMETER(x)
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
bool show(const GUIGlObject *o) const
whether to show the text
RandomDistributor< ConstMSRoutePtr > routeProbs
The distributions of new routes to use.