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);