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,
231 const std::vector<MSEdge*>& edges,
232 SUMOReal prob,
const std::string& aXMLFilename,
bool off,
237 for (std::vector<MSEdge*>::const_iterator it = edges.begin(); it != edges.end(); ++it) {
241 for (std::vector<RerouteInterval>::const_iterator it_interval =
myIntervals.begin();
243 const std::vector<MSEdge*>& closed = it_interval->closed;
244 for (std::vector<MSEdge*>::const_iterator it = closed.begin(); it != closed.end(); ++it) {
318 myAmClosedEdge(closed) {
319 const std::vector<MSLane*>& lanes = edge->
getLanes();
322 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
325 myFGPositions.push_back((*i)->geometryPositionAtOffset(pos));
338 return myParent->getPopUpMenu(app, parent);
353 const SUMOReal prob = myParent->getProbability();
354 if (myAmClosedEdge) {
361 const size_t noLanes = myFGPositions.size();
362 for (
size_t 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.);
401 for (
size_t i = 0; i < myFGPositions.size(); ++i) {
402 const Position& pos = myFGPositions[i];
405 glTranslated(pos.
x(), pos.
y(), 0);
406 glRotated(rot, 0, 0, 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);
int pfDrawString(const char *c)
long onCmdClose(FXObject *, FXSelector, void *)
GUITriggeredRerouterEdge(GUIEdge *edge, GUITriggeredRerouter *parent, bool closed)
Reroutes vehicles passing an edge One rerouter can be active on multiple edges. To reduce drawing loa...
std::vector< MSEdge * > closed
The list of closed edges.
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)
GUITriggeredRerouter(const std::string &id, const std::vector< MSEdge * > &edges, SUMOReal prob, const std::string &aXMLFilename, bool off, SUMORTree &rtree)
Constructor.
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[]
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
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)
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
float addExaggeration
The additional structures exaggeration (upscale)
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()
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
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)
~GUITriggeredRerouter()
Destructor.
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.
PosCont myFGPositions
The positions in full-geometry mode.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
Open the object's manipulator.