88 myChosenValue(0), myChosenTarget(myChosenValue,
nullptr, MID_OPTION),
89 myUsageProbability(o.getProbability()), myUsageProbabilityTarget(myUsageProbability),
91 myChosenTarget.setTarget(
this);
93 new FXVerticalFrame(
this, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0);
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);
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);
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);
118 myUsageProbabilityDial->setIncrement(.1);
119 myUsageProbabilityDial->setRange(0, 1);
120 myUsageProbabilityDial->setValue(myObject->getUserProbability());
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);
130 myChosenValue = myObject->inUserMode()
131 ? myObject->getUserProbability() > 0
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);
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);
159 myUsageProbability = (double)(myUsageProbabilityDial->getValue());
162 myParent->updateChildren();
170 myChosenValue != 1 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
172 myParent->updateChildren();
180 switch (myChosenValue) {
194 myParent->updateChildren();
201 myParent->updateChildren();
224 *myApplication, *myParent);
238 for (MSEdgeVector::const_iterator it = edges.begin(); it != edges.end(); ++it) {
260 for (MSEdgeVector::const_iterator it = ri.
closed.begin(); it != ri.
closed.end(); ++it) {
269 const MSEdge* lastEdge =
nullptr;
271 for (
int i = 0; i < (int)route0->getEdges().size(); i++) {
272 const MSEdge* cand = route0->getEdges()[i];
274 const MSEdge* nextEdge = i < (int)route->getEdges().size() ? route->getEdges()[i] :
nullptr;
275 if (nextEdge != cand) {
279 if (cand !=
nullptr) {
286 if (lastEdge !=
nullptr) {
289 if (nextIndex < (
int)edges.size()) {
348 gui->show(PLACEMENT_SCREEN);
368 for (
const MSVehicle* veh : lane->getVehiclesSecure()) {
369 const_cast<MSVehicle*
>(veh)->addReminder(
this);
371 lane->releaseVehicles();
387 myEdgeType(edgeType),
388 myDistIndex(distIndex) {
389 const std::vector<MSLane*>& lanes = edge->
getLanes();
392 for (
const MSLane* lane : lanes) {
412 return myParent->getPopUpMenu(app, parent);
426 if (s.
scale * exaggeration >= 3) {
428 const double prob = myParent->getProbability();
433 if (ri !=
nullptr && prob > 0) {
436 const int noLanes = (int)myFGPositions.size();
437 for (
int j = 0; j < noLanes; ++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);
446 noPoints = (int)(9.0 + s.
scale / 10.0);
453 glColor3d(0.7, 0, 0);
455 glTranslated(0, 0, .1);
458 glTranslated(0, 0, .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.);
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);
484 glScaled(exaggeration, exaggeration, 1);
485 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
487 glBegin(GL_TRIANGLES);
488 glColor3d(1, .8f, 0);
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);
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);
519 glScaled(exaggeration, exaggeration, 1);
520 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
522 glBegin(GL_TRIANGLES);
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);
563 myParent->shiftProbs();
@ MID_MANIP
Open the object's manipulator.
@ GLO_REROUTER_EDGE
a Rerouter over edge
GUIIcon
An enumeration of icons used by the gui applications.
FXDEFMAP(GUITriggeredRerouter::GUIManip_TriggeredRerouter) GUIManip_TriggeredRerouterMap[]
GUITriggeredRerouterPopupMenuMap[]
std::vector< const MSEdge * > ConstMSEdgeVector
std::vector< MSEdge * > MSEdgeVector
std::shared_ptr< const MSRoute > ConstMSRoutePtr
@ SVC_PEDESTRIAN
pedestrian
@ SUMO_TAG_INTERVAL
an aggreagated-output interval
#define UNUSED_PARAMETER(x)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A class that stores a 2D geometrical boundary.
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Boundary & grow(double by)
extends the boundary by the given amount
static void drawFilledCircle(double width, int steps=8)
Draws a filled circle around (0,0)
static void pushName(unsigned int name)
push Name
static void popMatrix()
pop matrix
static void popName()
pop Name
static void pushMatrix()
push matrix
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)
A road/street connecting two junctions (gui-version)
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.
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.
A window containing a gl-object's parameter.
long onUpdUserDef(FXObject *, FXSelector, void *)
virtual ~GUIManip_TriggeredRerouter()
Destructor.
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.
virtual ~GUITriggeredRerouterEdge()
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.
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.
~GUITriggeredRerouter()
Destructor.
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.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Representation of a lane in the micro simulation.
MSEdge & getEdge() const
Returns the lane's edge.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
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.
A point in 2D or 3D with translation and scaling methods.
double x() const
Returns the x-position.
double y() const
Returns the y-position.
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
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.
void addAdditionalGLObject(GUIGlObject *o, const double exaggeration=1)
Adds an additional object (detector/shape/trigger) for visualisation.
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.