58 #ifdef CHECK_MEMORY_LEAKS
60 #endif // CHECK_MEMORY_LEAKS
103 myChosenValue(0), myChosenTarget(myChosenValue, NULL, MID_OPTION),
104 myUsageProbability(o.getProbability()), myUsageProbabilityTarget(myUsageProbability),
106 myChosenTarget.setTarget(
this);
107 FXVerticalFrame* f1 =
108 new FXVerticalFrame(
this, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0);
110 FXGroupBox* gp =
new FXGroupBox(f1,
"Change Probability",
111 GROUPBOX_TITLE_LEFT | FRAME_SUNKEN | FRAME_RIDGE,
112 0, 0, 0, 0, 4, 4, 1, 1, 2, 0);
117 new FXRadioButton(gf1,
"Default", &myChosenTarget, FXDataTarget::ID_OPTION + 0,
118 ICON_BEFORE_TEXT | LAYOUT_SIDE_TOP,
119 0, 0, 0, 0, 2, 2, 0, 0);
125 new FXRadioButton(gf12,
"User Given: ", &myChosenTarget, FXDataTarget::ID_OPTION + 1,
126 ICON_BEFORE_TEXT | LAYOUT_SIDE_TOP | LAYOUT_CENTER_Y,
127 0, 0, 0, 0, 2, 2, 0, 0);
128 myUsageProbabilityDial =
130 LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
131 myUsageProbabilityDial->setFormatString(
"%.2f");
132 myUsageProbabilityDial->setIncrements(.1, .1, .1);
133 myUsageProbabilityDial->setRange(0, 1);
134 myUsageProbabilityDial->setValue(myObject->getUserProbability());
140 new FXRadioButton(gf13,
"Off", &myChosenTarget, FXDataTarget::ID_OPTION + 2,
141 ICON_BEFORE_TEXT | LAYOUT_SIDE_TOP,
142 0, 0, 0, 0, 2, 2, 0, 0);
144 myChosenValue = myObject->inUserMode()
145 ? myObject->getUserProbability() > 0
149 BUTTON_INITIAL | BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_CENTER_X, 0, 0, 0, 0, 30, 30, 4, 4);
165 myUsageProbability = (
SUMOReal)(myUsageProbabilityDial->getValue());
168 myParent->updateChildren();
176 myChosenValue != 1 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
178 myParent->updateChildren();
186 switch (myChosenValue) {
200 myParent->updateChildren();
222 *myApplication, *myParent);
231 const std::string&
id,
232 const std::vector<MSEdge*>& edges,
233 SUMOReal prob,
const std::string& aXMLFilename,
bool off,
238 for (std::vector<MSEdge*>::const_iterator it = edges.begin(); it != edges.end(); ++it) {
242 for (std::vector<RerouteInterval>::const_iterator it_interval =
myIntervals.begin();
244 const std::vector<MSEdge*>& closed = it_interval->closed;
245 for (std::vector<MSEdge*>::const_iterator it = closed.begin(); it != closed.end(); ++it) {
319 myAmClosedEdge(closed) {
320 const std::vector<MSLane*>& lanes = edge->
getLanes();
321 const size_t noLanes = lanes.size();
324 for (
size_t i = 0; i < noLanes; ++i) {
340 return myParent->getPopUpMenu(app, parent);
355 const SUMOReal prob = myParent->getProbability();
356 if (myAmClosedEdge) {
363 const size_t noLanes = myFGPositions.size();
364 for (
size_t j = 0; j < noLanes; ++j) {
368 glTranslated(pos.
x(), pos.
y(), 0);
369 glRotated(rot, 0, 0, 1);
370 glTranslated(0, -1.5, 0);
373 noPoints = (
int)(9.0 + s.
scale / 10.0);
380 glColor3d(0.7, 0, 0);
382 glTranslated(0, 0, .1);
385 glTranslated(0, 0, .1);
387 glRotated(-90, 0, 0, 1);
388 glBegin(GL_TRIANGLES);
389 glVertex2d(0 - .3, -1.);
390 glVertex2d(0 - .3, 1.);
391 glVertex2d(0 + .3, 1.);
392 glVertex2d(0 + .3, -1.);
393 glVertex2d(0 - .3, -1.);
394 glVertex2d(0 + .3, 1.);
403 for (
size_t i = 0; i < myFGPositions.size(); ++i) {
404 const Position& pos = myFGPositions[i];
407 glTranslated(pos.
x(), pos.
y(), 0);
408 glRotated(rot, 0, 0, 1);
411 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
413 glBegin(GL_TRIANGLES);
414 glColor3d(1, .8f, 0);
416 glVertex2d(0 - 1.4, 0);
417 glVertex2d(0 - 1.4, 6);
418 glVertex2d(0 + 1.4, 6);
419 glVertex2d(0 + 1.4, 0);
420 glVertex2d(0 - 1.4, 0);
421 glVertex2d(0 + 1.4, 6);
424 glTranslated(0, 0, .1);
429 glRotated(180, 0, 1, 0);
430 glTranslated(-w / 2., 2, 0);
433 glTranslated(w / 2., -2, 0);
434 std::string str =
toString((
int)(prob * 100)) +
"%";
438 glTranslated(-w / 2., 4, 0);