57 #ifdef CHECK_MEMORY_LEAKS
59 #endif // CHECK_MEMORY_LEAKS
102 myChosenValue(0), myChosenTarget(myChosenValue, NULL, MID_OPTION),
103 myUsageProbability(o.getProbability()), myUsageProbabilityTarget(myUsageProbability),
105 myChosenTarget.setTarget(
this);
106 FXVerticalFrame* f1 =
107 new FXVerticalFrame(
this, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0);
109 FXGroupBox* gp =
new FXGroupBox(f1,
"Change Probability",
110 GROUPBOX_TITLE_LEFT | FRAME_SUNKEN | FRAME_RIDGE,
111 0, 0, 0, 0, 4, 4, 1, 1, 2, 0);
116 new FXRadioButton(gf1,
"Default", &myChosenTarget, FXDataTarget::ID_OPTION + 0,
117 ICON_BEFORE_TEXT | LAYOUT_SIDE_TOP,
118 0, 0, 0, 0, 2, 2, 0, 0);
124 new FXRadioButton(gf12,
"User Given: ", &myChosenTarget, FXDataTarget::ID_OPTION + 1,
125 ICON_BEFORE_TEXT | LAYOUT_SIDE_TOP | LAYOUT_CENTER_Y,
126 0, 0, 0, 0, 2, 2, 0, 0);
127 myUsageProbabilityDial =
129 LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
130 myUsageProbabilityDial->setFormatString(
"%.2f");
131 myUsageProbabilityDial->setIncrements(.1, .1, .1);
132 myUsageProbabilityDial->setRange(0, 1);
133 myUsageProbabilityDial->setValue(myObject->getUserProbability());
139 new FXRadioButton(gf13,
"Off", &myChosenTarget, FXDataTarget::ID_OPTION + 2,
140 ICON_BEFORE_TEXT | LAYOUT_SIDE_TOP,
141 0, 0, 0, 0, 2, 2, 0, 0);
143 myChosenValue = myObject->inUserMode()
144 ? myObject->getUserProbability() > 0
148 BUTTON_INITIAL | BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_CENTER_X, 0, 0, 0, 0, 30, 30, 4, 4);
164 myUsageProbability = (
SUMOReal)(myUsageProbabilityDial->getValue());
167 myParent->updateChildren();
175 myChosenValue != 1 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
177 myParent->updateChildren();
185 switch (myChosenValue) {
199 myParent->updateChildren();
221 *myApplication, *myParent);
230 const std::string&
id,
232 SUMOReal prob,
const std::string& aXMLFilename,
bool off,
237 for (MSEdgeVector::const_iterator it = edges.begin(); it != edges.end(); ++it) {
259 for (MSEdgeVector::const_iterator it = ri.
closed.begin(); it != ri.
closed.end(); ++it) {
322 myAmClosedEdge(closed) {
323 const std::vector<MSLane*>& lanes = edge->
getLanes();
326 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
329 myFGPositions.push_back((*i)->geometryPositionAtOffset(pos));
342 return myParent->getPopUpMenu(app, parent);
356 if (s.
scale * exaggeration >= 3) {
358 const SUMOReal prob = myParent->getProbability();
359 if (myAmClosedEdge) {
363 if (ri != 0 && prob > 0) {
366 const size_t noLanes = myFGPositions.size();
367 for (
size_t j = 0; j < noLanes; ++j) {
371 glTranslated(pos.
x(), pos.
y(), 0);
372 glRotated(rot, 0, 0, 1);
373 glTranslated(0, -1.5, 0);
376 noPoints = (int)(9.0 + s.
scale / 10.0);
383 glColor3d(0.7, 0, 0);
385 glTranslated(0, 0, .1);
388 glTranslated(0, 0, .1);
390 glRotated(-90, 0, 0, 1);
391 glBegin(GL_TRIANGLES);
392 glVertex2d(0 - .3, -1.);
393 glVertex2d(0 - .3, 1.);
394 glVertex2d(0 + .3, 1.);
395 glVertex2d(0 + .3, -1.);
396 glVertex2d(0 - .3, -1.);
397 glVertex2d(0 + .3, 1.);
406 for (
size_t i = 0; i < myFGPositions.size(); ++i) {
407 const Position& pos = myFGPositions[i];
410 glTranslated(pos.
x(), pos.
y(), 0);
411 glRotated(rot, 0, 0, 1);
413 glScaled(exaggeration, exaggeration, 1);
414 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
416 glBegin(GL_TRIANGLES);
417 glColor3d(1, .8f, 0);
419 glVertex2d(0 - 1.4, 0);
420 glVertex2d(0 - 1.4, 6);
421 glVertex2d(0 + 1.4, 6);
422 glVertex2d(0 + 1.4, 0);
423 glVertex2d(0 - 1.4, 0);
424 glVertex2d(0 + 1.4, 6);
427 glTranslated(0, 0, .1);
432 glRotated(180, 0, 1, 0);
433 glTranslated(-w / 2., 2, 0);
436 glTranslated(w / 2., -2, 0);
437 std::string str =
toString((
int)(prob * 100)) +
"%";
441 glTranslated(-w / 2., 4, 0);
int pfDrawString(const char *c)
long onCmdClose(FXObject *, FXSelector, void *)
MSEdgeVector closed
The list of closed edges.
GUITriggeredRerouterEdge(GUIEdge *edge, GUITriggeredRerouter *parent, bool closed)
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
FXDEFMAP(GUITriggeredRerouter::GUIManip_TriggeredRerouter) GUIManip_TriggeredRerouterMap[]
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
GUIManipulator * openManipulator(GUIMainWindow &app, GUISUMOAbstractView &parent)
Stores the information about how to visualize structures.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
void pfSetPosition(SUMOReal x, SUMOReal y)
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
void setUserUsageProbability(SUMOReal prob)
Sets the probability with which a vehicle is rerouted given by the user.
void setUserMode(bool val)
Sets whether the process is currently steered by the user.
GUITriggeredRerouterPopupMenuMap[]
A RT-tree for efficient storing of SUMO's GL-objects.
SUMOReal x() const
Returns the x-position.
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.
GUIGlID getGlID() const
Returns the numerical id of the object.
#define UNUSED_PARAMETER(x)
A class that stores a 2D geometrical boundary.
SUMOReal scale
information about a lane's width (temporary, used for a single view)
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
static void drawFilledCircle(SUMOReal width, int steps=8)
Draws a filled circle around (0,0)
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.
A point in 2D or 3D with translation and scaling methods.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
virtual ~GUIManip_TriggeredRerouter()
Destructor.
virtual ~GUITriggeredRerouterEdge()
Open the object's manipulator.
long onCmdUserDef(FXObject *, FXSelector, void *)
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
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.
SUMOReal length() const
Returns the length.
SUMOReal rotationDegreeAtOffset(SUMOReal pos) const
Returns the rotation at the given length.
void buildShowManipulatorPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the manipulator window.
Reroutes vehicles passing an edge.
void add(SUMOReal x, SUMOReal y)
Makes the boundary include the given coordinate.
Boundary & grow(SUMOReal by)
extends the boundary by the given amount
A MSNet extended by some values for usage within the gui.
void pfSetScale(SUMOReal s)
void addAdditionalGLObject(GUIGlObject *o)
Adds an additional object (detector/shape/trigger) for visualisation.
SUMOReal y() const
Returns the y-position.
std::vector< RerouteInterval > myIntervals
List of rerouting definition intervals.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to (de)select the object.
SUMOReal pfdkGetStringWidth(const char *c)
std::vector< MSEdge * > MSEdgeVector
~GUITriggeredRerouter()
Destructor.
void myEndElement(int element)
Called when a closing tag occurs.
Boundary myBoundary
The boundary of this rerouter.
const std::string & getFullName() const
Returns the full name appearing in the tool tip.
A window containing a gl-object's parameter.
GUITriggeredRerouter(const std::string &id, const MSEdgeVector &edges, SUMOReal prob, const std::string &aXMLFilename, bool off, SUMORTree &rtree)
Constructor.
SUMOReal getExaggeration(const GUIVisualizationSettings &s) const
return the drawing size including exaggeration and constantSize values
PosCont myFGPositions
The positions in full-geometry mode.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.