97 myChosenValue(0), myChosenTarget(myChosenValue, NULL, MID_OPTION),
98 myUsageProbability(o.getProbability()), myUsageProbabilityTarget(myUsageProbability),
100 myChosenTarget.setTarget(
this);
101 FXVerticalFrame* f1 =
102 new FXVerticalFrame(
this, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0);
104 FXGroupBox* gp =
new FXGroupBox(f1,
"Change Probability",
105 GROUPBOX_TITLE_LEFT | FRAME_SUNKEN | FRAME_RIDGE,
106 0, 0, 0, 0, 4, 4, 1, 1, 2, 0);
109 FXHorizontalFrame* gf1 =
110 new FXHorizontalFrame(gp, LAYOUT_TOP | LAYOUT_LEFT, 0, 0, 0, 0, 10, 10, 5, 5);
111 new FXRadioButton(gf1,
"Default", &myChosenTarget, FXDataTarget::ID_OPTION + 0,
112 ICON_BEFORE_TEXT | LAYOUT_SIDE_TOP,
113 0, 0, 0, 0, 2, 2, 0, 0);
117 FXHorizontalFrame* gf12 =
118 new FXHorizontalFrame(gp, LAYOUT_TOP | LAYOUT_LEFT, 0, 0, 0, 0, 10, 10, 5, 5);
119 new FXRadioButton(gf12,
"User Given: ", &myChosenTarget, FXDataTarget::ID_OPTION + 1,
120 ICON_BEFORE_TEXT | LAYOUT_SIDE_TOP | LAYOUT_CENTER_Y,
121 0, 0, 0, 0, 2, 2, 0, 0);
122 myUsageProbabilityDial =
124 LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
125 myUsageProbabilityDial->setFormatString(
"%.2f");
126 myUsageProbabilityDial->setIncrements(.1, .1, .1);
127 myUsageProbabilityDial->setRange(0, 1);
128 myUsageProbabilityDial->setValue(myObject->getUserProbability());
132 FXHorizontalFrame* gf13 =
133 new FXHorizontalFrame(gp, LAYOUT_TOP | LAYOUT_LEFT, 0, 0, 0, 0, 10, 10, 5, 5);
134 new FXRadioButton(gf13,
"Off", &myChosenTarget, FXDataTarget::ID_OPTION + 2,
135 ICON_BEFORE_TEXT | LAYOUT_SIDE_TOP,
136 0, 0, 0, 0, 2, 2, 0, 0);
138 myChosenValue = myObject->inUserMode()
139 ? myObject->getUserProbability() > 0
142 new FXButton(f1,
"Close", NULL,
this,
MID_CLOSE,
143 BUTTON_INITIAL | BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_CENTER_X, 0, 0, 0, 0, 30, 30, 4, 4);
170 myChosenValue != 1 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
225 const std::string&
id,
227 double prob,
const std::string& aXMLFilename,
bool off,
232 for (MSEdgeVector::const_iterator it = edges.begin(); it != edges.end(); ++it) {
254 for (MSEdgeVector::const_iterator it = ri.
closed.begin(); it != ri.
closed.end(); ++it) {
317 myAmClosedEdge(closed) {
318 const std::vector<MSLane*>& lanes = edge->
getLanes();
321 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
323 const double pos = closed ? 3 : v.
length() - (double) 6.;
324 myFGPositions.push_back((*i)->geometryPositionAtOffset(pos));
351 if (s.
scale * exaggeration >= 3) {
358 if (ri != 0 && prob > 0) {
362 for (
int j = 0; j < noLanes; ++j) {
366 glTranslated(pos.
x(), pos.
y(), 0);
367 glRotated(rot, 0, 0, 1);
368 glTranslated(0, -1.5, 0);
371 noPoints = (int)(9.0 + s.
scale / 10.0);
378 glColor3d(0.7, 0, 0);
380 glTranslated(0, 0, .1);
383 glTranslated(0, 0, .1);
385 glRotated(-90, 0, 0, 1);
386 glBegin(GL_TRIANGLES);
387 glVertex2d(0 - .3, -1.);
388 glVertex2d(0 - .3, 1.);
389 glVertex2d(0 + .3, 1.);
390 glVertex2d(0 + .3, -1.);
391 glVertex2d(0 - .3, -1.);
392 glVertex2d(0 + .3, 1.);
405 glTranslated(pos.
x(), pos.
y(), 0);
406 glRotated(rot, 0, 0, 1);
408 glScaled(exaggeration, exaggeration, 1);
409 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
411 glBegin(GL_TRIANGLES);
412 glColor3d(1, .8f, 0);
414 glVertex2d(0 - 1.4, 0);
415 glVertex2d(0 - 1.4, 6);
416 glVertex2d(0 + 1.4, 6);
417 glVertex2d(0 + 1.4, 0);
418 glVertex2d(0 - 1.4, 0);
419 glVertex2d(0 + 1.4, 6);
422 glTranslated(0, 0, .1);
427 glRotated(180, 0, 1, 0);
428 glTranslated(-w / 2., 2, 0);
431 glTranslated(w / 2., -2, 0);
432 std::string str =
toString((
int)(prob * 100)) +
"%";
436 glTranslated(-w / 2., 4, 0);
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
double getProbability() const
Returns the rerouting probability.
int pfDrawString(const char *c)
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
long onCmdClose(FXObject *, FXSelector, void *)
MSEdgeVector closed
The list of closed edges.
const RerouteInterval * getCurrentReroute(SUMOTime time, SUMOVehicle &veh) const
Returns the rerouting definition valid for the given time and vehicle, 0 if none. ...
GUITriggeredRerouterEdge(GUIEdge *edge, GUITriggeredRerouter *parent, bool closed)
double scale
information about a lane's width (temporary, used for a single view)
Reroutes vehicles passing an edge One rerouter can be active on multiple edges. To reduce drawing loa...
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
std::vector< GUITriggeredRerouterEdge * > myEdgeVisualizations
void pfSetScale(double s)
Open the object's manipulator.
FXDEFMAP(GUITriggeredRerouter::GUIManip_TriggeredRerouter) GUIManip_TriggeredRerouterMap[]
GUIManipulator * openManipulator(GUIMainWindow &app, GUISUMOAbstractView &parent)
Stores the information about how to visualize structures.
double y() const
Returns the y-position.
GUITriggeredRerouter(const std::string &id, const MSEdgeVector &edges, double prob, const std::string &aXMLFilename, bool off, SUMORTree &rtree)
Constructor.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
double x() const
Returns the x-position.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
GUITriggeredRerouter * myParent
The parent rerouter to which this edge instance belongs.
void setUserUsageProbability(double prob)
Sets the probability with which a vehicle is rerouted given by the user.
void pfSetPosition(double x, double y)
const std::string & getID() const
Returns the id.
void setUserMode(bool val)
Sets whether the process is currently steered by the user.
GUITriggeredRerouterPopupMenuMap[]
MSEdge * myEdge
The edge for which this visualization applies.
static void drawFilledCircle(double width, int steps=8)
Draws a filled circle around (0,0)
A RT-tree for efficient storing of SUMO's GL-objects.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used, also builds an entry for copying the geo-position.
#define UNUSED_PARAMETER(x)
A class that stores a 2D geometrical boundary.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
A road/street connecting two junctions (gui-version)
virtual void myEndElement(int element)
Called when a closing tag occurs.
GUIVisualizationSizeSettings addSize
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A point in 2D or 3D with translation and scaling methods.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
virtual ~GUIManip_TriggeredRerouter()
Destructor.
const bool myAmClosedEdge
whether this edge instance visualizes a closed edge
virtual ~GUITriggeredRerouterEdge()
Boundary & grow(double by)
extends the boundary by the given amount
GUITriggeredRerouter * myObject
long onCmdUserDef(FXObject *, FXSelector, void *)
Boundary myBoundary
The boundary of this rerouter.
long onUpdUserDef(FXObject *, FXSelector, void *)
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
long onCmdChangeOption(FXObject *, FXSelector, void *)
RotCont myFGRotations
The rotations in full-geometry mode.
FXRealSpinDial * myUsageProbabilityDial
void buildShowManipulatorPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the manipulator window.
Reroutes vehicles passing an edge.
double pfdkGetStringWidth(const char *c)
double length() const
Returns the length.
A MSNet extended by some values for usage within the gui.
void addAdditionalGLObject(GUIGlObject *o)
Adds an additional object (detector/shape/trigger) for visualisation.
std::vector< RerouteInterval > myIntervals
List of rerouting definition intervals.
FXdouble getValue() const
Return current value.
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.
double getExaggeration(const GUIVisualizationSettings &s, double factor=20) const
return the drawing size including exaggeration and constantSize values
an aggreagated-output interval
double myUsageProbability
std::vector< MSEdge * > MSEdgeVector
~GUITriggeredRerouter()
Destructor.
const std::string & getFullName() const
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
void myEndElement(int element)
Called when a closing tag occurs.
Boundary myBoundary
The boundary of this rerouter.
A window containing a gl-object's parameter.
PosCont myFGPositions
The positions in full-geometry mode.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.