SUMO - Simulation of Urban MObility
GNERerouterIntervalDialog.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
17 // Dialog for edit rerouter intervals
18 /****************************************************************************/
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #ifdef _MSC_VER
24 #include <windows_config.h>
25 #else
26 #include <config.h>
27 #endif
28 
29 #include <iostream>
34 
36 #include "GNERerouterDialog.h"
37 #include "GNERerouter.h"
38 #include "GNERerouterInterval.h"
39 #include "GNEClosingLaneReroute.h"
40 #include "GNEClosingReroute.h"
41 #include "GNEDestProbReroute.h"
42 #include "GNERouteProbReroute.h"
43 #include "GNEEdge.h"
44 #include "GNELane.h"
45 #include "GNEViewNet.h"
46 #include "GNENet.h"
47 #include "GNEUndoList.h"
48 #include "GNEChange_RerouterItem.h"
49 
50 
51 // ===========================================================================
52 // FOX callback mapping
53 // ===========================================================================
54 
55 FXDEFMAP(GNERerouterIntervalDialog) GNERerouterIntervalDialogMap[] = {
56  // called when user click over buttons
61 
62  // clicked table (Double and triple clicks allow to remove element more fast)
75 
76  // use "update" instead of "command" to avoid problems mit icons
82 };
83 
84 // Object implementation
85 FXIMPLEMENT(GNERerouterIntervalDialog, GNEAdditionalDialog, GNERerouterIntervalDialogMap, ARRAYNUMBER(GNERerouterIntervalDialogMap))
86 
87 // ===========================================================================
88 // member method definitions
89 // ===========================================================================
90 
91 GNERerouterIntervalDialog::GNERerouterIntervalDialog(GNERerouterInterval* rerouterInterval, bool updatingElement) :
92  GNEAdditionalDialog(rerouterInterval->getRerouterParent(), 640, 480),
93  myEditedRerouterInterval(rerouterInterval),
94  myUpdatingElement(updatingElement),
95  myBeginEndValid(true),
96  myClosingLaneReroutesValid(true),
97  myClosingReroutesValid(true),
98  myDestProbReroutesValid(true),
99  myRouteProbReroutesValid(true) {
100  // change default header
101  std::string typeOfOperation = myUpdatingElement ? "Edit " + toString(myEditedRerouterInterval->getTag()) + " of " : "Create " + toString(myEditedRerouterInterval->getTag()) + " for ";
102  changeAdditionalDialogHeader(typeOfOperation + toString(myEditedRerouterInterval->getRerouterParent()->getTag()) + " '" + myEditedRerouterInterval->getRerouterParent()->getID() + "'");
103 
104  // Create auxiliar frames for tables
105  FXHorizontalFrame* columns = new FXHorizontalFrame(myContentFrame, GUIDesignUniformHorizontalFrame);
106  FXVerticalFrame* columnLeft = new FXVerticalFrame(columns, GUIDesignAuxiliarFrame);
107  FXVerticalFrame* columnRight = new FXVerticalFrame(columns, GUIDesignAuxiliarFrame);
108 
109  // create horizontal frame for begin and end label
110  FXHorizontalFrame* beginEndElementsLeft = new FXHorizontalFrame(columnLeft, GUIDesignAuxiliarHorizontalFrame);
111  new FXLabel(beginEndElementsLeft, (toString(SUMO_ATTR_BEGIN) + " and " + toString(SUMO_ATTR_END) + " of " + toString(myEditedRerouterInterval->getTag())).c_str(), 0, GUIDesignLabelLeftThick);
112  myCheckLabel = new FXLabel(beginEndElementsLeft, "", GUIIconSubSys::getIcon(ICON_CORRECT), GUIDesignLabelIcon32x32Thicked);
113 
114  // create horizontal frame for begin and end text fields
115  FXHorizontalFrame* beginEndElementsRight = new FXHorizontalFrame(columnRight, GUIDesignAuxiliarHorizontalFrame);
116  myBeginTextField = new FXTextField(beginEndElementsRight, GUIDesignTextFieldNCol, this, MID_GNE_REROUTEDIALOG_EDIT_INTERVAL, GUIDesignTextFieldReal);
117  myBeginTextField->setText(toString(myEditedRerouterInterval->getAttribute(SUMO_ATTR_BEGIN)).c_str());
118  myEndTextField = new FXTextField(beginEndElementsRight, GUIDesignTextFieldNCol, this, MID_GNE_REROUTEDIALOG_EDIT_INTERVAL, GUIDesignTextFieldReal);
119  myEndTextField->setText(toString(myEditedRerouterInterval->getAttribute(SUMO_ATTR_END)).c_str());
120 
121  // Create labels and tables
122  FXHorizontalFrame* buttonAndLabelClosingLaneReroute = new FXHorizontalFrame(columnLeft, GUIDesignAuxiliarHorizontalFrame);
123  myAddClosingLaneReroutes = new FXButton(buttonAndLabelClosingLaneReroute, "", GUIIconSubSys::getIcon(ICON_ADD), this, MID_GNE_REROUTEDIALOG_ADD_CLOSINGLANEREROUTE, GUIDesignButtonIcon);
124  new FXLabel(buttonAndLabelClosingLaneReroute, ("Add new " + toString(SUMO_TAG_CLOSING_LANE_REROUTE) + "s").c_str(), 0, GUIDesignLabelThick);
125  myClosingLaneRerouteTable = new FXTable(columnLeft, this, MID_GNE_REROUTEDIALOG_TABLE_CLOSINGLANEREROUTE, GUIDesignTableAdditionals);
126  myClosingLaneRerouteTable->setSelBackColor(FXRGBA(255, 255, 255, 255));
127  myClosingLaneRerouteTable->setSelTextColor(FXRGBA(0, 0, 0, 255));
128 
129  FXHorizontalFrame* buttonAndLabelClosinReroute = new FXHorizontalFrame(columnLeft, GUIDesignAuxiliarHorizontalFrame);
130  myAddClosingReroutes = new FXButton(buttonAndLabelClosinReroute, "", GUIIconSubSys::getIcon(ICON_ADD), this, MID_GNE_REROUTEDIALOG_ADD_CLOSINGREROUTE, GUIDesignButtonIcon);
131  new FXLabel(buttonAndLabelClosinReroute, ("Add new " + toString(SUMO_TAG_CLOSING_REROUTE) + "s").c_str(), 0, GUIDesignLabelThick);
132  myClosingRerouteTable = new FXTable(columnLeft, this, MID_GNE_REROUTEDIALOG_TABLE_CLOSINGREROUTE, GUIDesignTableAdditionals);
133  myClosingRerouteTable->setSelBackColor(FXRGBA(255, 255, 255, 255));
134  myClosingRerouteTable->setSelTextColor(FXRGBA(0, 0, 0, 255));
135 
136  FXHorizontalFrame* buttonAndLabelDestProbReroute = new FXHorizontalFrame(columnRight, GUIDesignAuxiliarHorizontalFrame);
137  myAddDestProbReroutes = new FXButton(buttonAndLabelDestProbReroute, "", GUIIconSubSys::getIcon(ICON_ADD), this, MID_GNE_REROUTEDIALOG_ADD_DESTPROBREROUTE, GUIDesignButtonIcon);
138  new FXLabel(buttonAndLabelDestProbReroute, ("Add new " + toString(SUMO_TAG_DEST_PROB_REROUTE) + "s").c_str(), 0, GUIDesignLabelThick);
139  myDestProbRerouteTable = new FXTable(columnRight, this, MID_GNE_REROUTEDIALOG_TABLE_DESTPROBREROUTE, GUIDesignTableAdditionals);
140  myDestProbRerouteTable->setSelBackColor(FXRGBA(255, 255, 255, 255));
141  myDestProbRerouteTable->setSelTextColor(FXRGBA(0, 0, 0, 255));
142 
143  FXHorizontalFrame* buttonAndLabelRouteProbReroute = new FXHorizontalFrame(columnRight, GUIDesignAuxiliarHorizontalFrame);
144  myAddRouteProbReroute = new FXButton(buttonAndLabelRouteProbReroute, "", GUIIconSubSys::getIcon(ICON_ADD), this, MID_GNE_REROUTEDIALOG_ADD_ROUTEPROBREROUTE, GUIDesignButtonIcon);
145  new FXLabel(buttonAndLabelRouteProbReroute, ("Add new " + toString(SUMO_TAG_ROUTE_PROB_REROUTE) + "s").c_str(), 0, GUIDesignLabelThick);
146  myRouteProbRerouteTable = new FXTable(columnRight, this, MID_GNE_REROUTEDIALOG_TABLE_ROUTEPROBREROUTE, GUIDesignTableAdditionals);
147  myRouteProbRerouteTable->setSelBackColor(FXRGBA(255, 255, 255, 255));
148  myRouteProbRerouteTable->setSelTextColor(FXRGBA(0, 0, 0, 255));
149 
150  // update tables
151  updateClosingLaneReroutesTable();
152  updateClosingReroutesTable();
153  updateDestProbReroutesTable();
154  updateRouteProbReroutesTable();
155 
156  // start a undo list for editing local to this additional
157  initChanges();
158 
159  // add element if we aren't updating an existent element
160  if (myUpdatingElement == false) {
161  myEditedRerouterInterval->getRerouterParent()->getViewNet()->getUndoList()->add(new GNEChange_RerouterItem(myEditedRerouterInterval, true), true);
162  }
163 
164  // open as modal dialog
165  openAsModalDialog();
166 }
167 
168 
170 
171 
175 }
176 
177 
178 long
179 GNERerouterIntervalDialog::onCmdAccept(FXObject*, FXSelector, void*) {
180  // set strings for dialogs
181  std::string errorTitle = "Error" + toString(myUpdatingElement ? "updating" : "creating") + " " + toString(myEditedRerouterInterval->getTag()) + " of " + toString(myEditedRerouterInterval->getRerouterParent()->getTag());
182  std::string operationType = toString(myEditedRerouterInterval->getRerouterParent()->getTag()) + "'s " + toString(myEditedRerouterInterval->getTag()) + " cannot be " + (myUpdatingElement ? "updated" : "created") + " because ";
183  if (myBeginEndValid == false) {
184  // write warning if netedit is running in testing mode
185  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
186  WRITE_WARNING("Opening FXMessageBox of type 'warning'");
187  }
188  // open warning Box
189  FXMessageBox::warning(getApp(), MBOX_OK, errorTitle.c_str(), "%s", (operationType + toString(myEditedRerouterInterval->getTag()) + " defined by " + toString(SUMO_ATTR_BEGIN) + " and " + toString(SUMO_ATTR_END) + " is invalid.").c_str());
190  // write warning if netedit is running in testing mode
191  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
192  WRITE_WARNING("Closed FXMessageBox of type 'warning' with 'OK'");
193  }
194  return 0;
195  } else if (myEditedRerouterInterval->getClosingLaneReroutes().empty() &&
199  // write warning if netedit is running in testing mode
200  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
201  WRITE_WARNING("Opening FXMessageBox of type 'warning'");
202  }
203  // open warning Box
204  FXMessageBox::warning(getApp(), MBOX_OK, errorTitle.c_str(), "%s", (operationType + "at least one " + toString(myEditedRerouterInterval->getTag()) + "'s element must be defined.").c_str());
205  // write warning if netedit is running in testing mode
206  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
207  WRITE_WARNING("Closed FXMessageBox of type 'warning' with 'OK'");
208  }
209  return 0;
210  } else if ((myEditedRerouterInterval->getClosingLaneReroutes().size() > 0) && (myClosingLaneReroutesValid == false)) {
211  // write warning if netedit is running in testing mode
212  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
213  WRITE_WARNING("Opening FXMessageBox of type 'warning'");
214  }
215  // open warning Box
216  FXMessageBox::warning(getApp(), MBOX_OK, errorTitle.c_str(), "%s", (operationType + "there are invalid " + toString(SUMO_TAG_CLOSING_LANE_REROUTE) + "s.").c_str());
217  // write warning if netedit is running in testing mode
218  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
219  WRITE_WARNING("Closed FXMessageBox of type 'warning' with 'OK'");
220  }
221  return 0;
222  } else if ((myEditedRerouterInterval->getClosingReroutes().size() > 0) && (myClosingReroutesValid == false)) {
223  // write warning if netedit is running in testing mode
224  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
225  WRITE_WARNING("Opening FXMessageBox of type 'warning'");
226  }
227  // open warning Box
228  FXMessageBox::warning(getApp(), MBOX_OK, errorTitle.c_str(), "%s", (operationType + "there are invalid " + toString(SUMO_TAG_CLOSING_REROUTE) + "s.").c_str());
229  // write warning if netedit is running in testing mode
230  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
231  WRITE_WARNING("Closed FXMessageBox of type 'warning' with 'OK'");
232  }
233  return 0;
234  } else if ((myEditedRerouterInterval->getDestProbReroutes().size() > 0) && (myDestProbReroutesValid == false)) {
235  // write warning if netedit is running in testing mode
236  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
237  WRITE_WARNING("Opening FXMessageBox of type 'warning'");
238  }
239  // open warning Box
240  FXMessageBox::warning(getApp(), MBOX_OK, errorTitle.c_str(), "%s", (operationType + "there are invalid " + toString(SUMO_TAG_DEST_PROB_REROUTE) + "s.").c_str());
241  // write warning if netedit is running in testing mode
242  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
243  WRITE_WARNING("Closed FXMessageBox of type 'warning' with 'OK'");
244  }
245  return 0;
246  } else if ((myEditedRerouterInterval->getRouteProbReroutes().size() > 0) && (myRouteProbReroutesValid == false)) {
247  // write warning if netedit is running in testing mode
248  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
249  WRITE_WARNING("Opening FXMessageBox of type 'warning'");
250  }
251  // open warning Box
252  FXMessageBox::warning(getApp(), MBOX_OK, errorTitle.c_str(), "%s", (operationType + "there are invalid " + toString(SUMO_TAG_ROUTE_PROB_REROUTE) + "s.").c_str());
253  // write warning if netedit is running in testing mode
254  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
255  WRITE_WARNING("Closed FXMessageBox of type 'warning' with 'OK'");
256  }
257  return 0;
258  } else {
259  // accept changes before closing dialog
260  acceptChanges();
261  // Stop Modal
262  getApp()->stopModal(this, TRUE);
263  return 1;
264  }
265 }
266 
267 
268 long
269 GNERerouterIntervalDialog::onCmdCancel(FXObject*, FXSelector, void*) {
270  // cancel changes
271  cancelChanges();
272  // Stop Modal
273  getApp()->stopModal(this, FALSE);
274  return 1;
275 }
276 
277 
278 long
279 GNERerouterIntervalDialog::onCmdReset(FXObject*, FXSelector, void*) {
280  // reset changes
281  resetChanges();
282  // update tables
287  return 1;
288 }
289 
290 
291 long
293  // create closing lane reroute
294  GNEClosingLaneReroute* closingLaneReroute = new GNEClosingLaneReroute(this);
295  myEditedRerouterInterval->getRerouterParent()->getViewNet()->getUndoList()->add(new GNEChange_RerouterItem(closingLaneReroute, true), true);
296  // update closing lane reroutes table
298  return 1;
299 }
300 
301 
302 long
304  // create closing reroute
305  GNEClosingReroute* closingReroute = new GNEClosingReroute(this);
306  myEditedRerouterInterval->getRerouterParent()->getViewNet()->getUndoList()->add(new GNEChange_RerouterItem(closingReroute, true), true);
307  // update closing reroutes table
309  return 1;
310 }
311 
312 
313 long
315  // create closing reroute and add it to table
316  GNEDestProbReroute* destProbReroute = new GNEDestProbReroute(this);
317  myEditedRerouterInterval->getRerouterParent()->getViewNet()->getUndoList()->add(new GNEChange_RerouterItem(destProbReroute, true), true);
318  // update dest Prob reroutes table
320  return 1;
321 }
322 
323 
324 long
326  // create route Prob Reroute
327  GNERouteProbReroute* routeProbReroute = new GNERouteProbReroute(this);
328  myEditedRerouterInterval->getRerouterParent()->getViewNet()->getUndoList()->add(new GNEChange_RerouterItem(routeProbReroute, true), true);
329  // update route prob reroutes table
331  return 1;
332 }
333 
334 
335 long
337  // check if some delete button was pressed
338  for (int i = 0; i < (int)myEditedRerouterInterval->getClosingLaneReroutes().size(); i++) {
339  if (myClosingLaneRerouteTable->getItem(i, 4)->hasFocus()) {
340  myClosingLaneRerouteTable->removeRows(i);
343  return 1;
344  }
345  }
346  return 0;
347 }
348 
349 
350 long
352  // check if some delete button was pressed
353  for (int i = 0; i < (int)myEditedRerouterInterval->getClosingReroutes().size(); i++) {
354  if (myClosingRerouteTable->getItem(i, 4)->hasFocus()) {
355  myClosingRerouteTable->removeRows(i);
358  return 1;
359  }
360  }
361  return 1;
362 }
363 
364 
365 long
367  // check if some delete button was pressed
368  for (int i = 0; i < (int)myEditedRerouterInterval->getDestProbReroutes().size(); i++) {
369  if (myDestProbRerouteTable->getItem(i, 3)->hasFocus()) {
370  myDestProbRerouteTable->removeRows(i);
373  return 1;
374  }
375  }
376  return 0;
377 }
378 
379 
380 long
382  // check if some delete button was pressed
383  for (int i = 0; i < (int)myEditedRerouterInterval->getRouteProbReroutes().size(); i++) {
384  if (myRouteProbRerouteTable->getItem(i, 3)->hasFocus()) {
385  myRouteProbRerouteTable->removeRows(i);
388  return 1;
389  }
390  }
391  return 0;
392 }
393 
394 
395 long
398  // iterate over table and check that all parameters are correct
399  for (int i = 0; i < myClosingLaneRerouteTable->getNumRows(); i++) {
401  if (closingLaneReroute->isValid(SUMO_ATTR_ID, myClosingLaneRerouteTable->getItem(i, 0)->getText().text()) == false) {
404  } else if (closingLaneReroute->isValid(SUMO_ATTR_ALLOW, myClosingLaneRerouteTable->getItem(i, 1)->getText().text()) == false) {
407  } else if (closingLaneReroute->isValid(SUMO_ATTR_DISALLOW, myClosingLaneRerouteTable->getItem(i, 2)->getText().text()) == false) {
410  } else {
411  // set new values in Closing Lane reroute
412  closingLaneReroute->setAttribute(SUMO_ATTR_ID, myClosingLaneRerouteTable->getItem(i, 0)->getText().text(), myEditedRerouterInterval->getRerouterParent()->getViewNet()->getUndoList());
413  closingLaneReroute->setAttribute(SUMO_ATTR_ALLOW, myClosingLaneRerouteTable->getItem(i, 1)->getText().text(), myEditedRerouterInterval->getRerouterParent()->getViewNet()->getUndoList());
414  closingLaneReroute->setAttribute(SUMO_ATTR_DISALLOW, myClosingLaneRerouteTable->getItem(i, 2)->getText().text(), myEditedRerouterInterval->getRerouterParent()->getViewNet()->getUndoList());
415  // set Correct label
417  }
418  }
419  // update list
420  myClosingLaneRerouteTable->update();
421  return 1;
422 }
423 
424 
425 long
427  myClosingReroutesValid = true;
428  // iterate over table and check that all parameters are correct
429  for (int i = 0; i < myClosingRerouteTable->getNumRows(); i++) {
431  if (closingReroute->isValid(SUMO_ATTR_ID, myClosingRerouteTable->getItem(i, 0)->getText().text()) == false) {
432  myClosingReroutesValid = false;
433  myClosingRerouteTable->getItem(i, 3)->setIcon(GUIIconSubSys::getIcon(ICON_ERROR));
434  } else if (closingReroute->isValid(SUMO_ATTR_ALLOW, myClosingRerouteTable->getItem(i, 1)->getText().text()) == false) {
435  myClosingReroutesValid = false;
436  myClosingRerouteTable->getItem(i, 3)->setIcon(GUIIconSubSys::getIcon(ICON_ERROR));
437  } else if (closingReroute->isValid(SUMO_ATTR_DISALLOW, myClosingRerouteTable->getItem(i, 2)->getText().text()) == false) {
438  myClosingReroutesValid = false;
439  myClosingRerouteTable->getItem(i, 3)->setIcon(GUIIconSubSys::getIcon(ICON_ERROR));
440  } else {
441  // set new values in Closing reroute
442  closingReroute->setAttribute(SUMO_ATTR_ID, myClosingRerouteTable->getItem(i, 0)->getText().text(), myEditedRerouterInterval->getRerouterParent()->getViewNet()->getUndoList());
443  closingReroute->setAttribute(SUMO_ATTR_ALLOW, myClosingRerouteTable->getItem(i, 1)->getText().text(), myEditedRerouterInterval->getRerouterParent()->getViewNet()->getUndoList());
445  // set Correct label
447  }
448  }
449  // update list
450  myClosingRerouteTable->update();
451  return 1;
452 }
453 
454 
455 long
458  // iterate over table and check that all parameters are correct
459  for (int i = 0; i < myDestProbRerouteTable->getNumRows(); i++) {
461  if (destProbReroute->isValid(SUMO_ATTR_ID, myDestProbRerouteTable->getItem(i, 0)->getText().text()) == false) {
462  myDestProbReroutesValid = false;
463  myDestProbRerouteTable->getItem(i, 2)->setIcon(GUIIconSubSys::getIcon(ICON_ERROR));
464  } else if (destProbReroute->isValid(SUMO_ATTR_PROB, myDestProbRerouteTable->getItem(i, 1)->getText().text()) == false) {
465  myDestProbReroutesValid = false;
466  myDestProbRerouteTable->getItem(i, 2)->setIcon(GUIIconSubSys::getIcon(ICON_ERROR));
467  } else {
468  // set new values in Closing reroute
469  destProbReroute->setAttribute(SUMO_ATTR_ID, myDestProbRerouteTable->getItem(i, 0)->getText().text(), myEditedRerouterInterval->getRerouterParent()->getViewNet()->getUndoList());
470  destProbReroute->setAttribute(SUMO_ATTR_PROB, myDestProbRerouteTable->getItem(i, 1)->getText().text(), myEditedRerouterInterval->getRerouterParent()->getViewNet()->getUndoList());
471  // set Correct label
473  }
474  }
475  // update list
476  myDestProbRerouteTable->update();
477  return 1;
478 }
479 
480 
481 long
484  // iterate over table and check that all parameters are correct
485  for (int i = 0; i < myRouteProbRerouteTable->getNumRows(); i++) {
487  if (routeProbReroute->isValid(SUMO_ATTR_ID, myRouteProbRerouteTable->getItem(i, 0)->getText().text()) == false) {
488  myRouteProbReroutesValid = false;
490  } else if (routeProbReroute->isValid(SUMO_ATTR_PROB, myRouteProbRerouteTable->getItem(i, 1)->getText().text()) == false) {
491  myRouteProbReroutesValid = false;
493  } else {
494  // set new values in Closing reroute
495  routeProbReroute->setAttribute(SUMO_ATTR_ID, myRouteProbRerouteTable->getItem(i, 0)->getText().text(), myEditedRerouterInterval->getRerouterParent()->getViewNet()->getUndoList());
496  routeProbReroute->setAttribute(SUMO_ATTR_PROB, myRouteProbRerouteTable->getItem(i, 1)->getText().text(), myEditedRerouterInterval->getRerouterParent()->getViewNet()->getUndoList());
497  // set Correct label
499  }
500  }
501  // update list
502  myRouteProbRerouteTable->update();
503  return 1;
504 }
505 
506 
507 long
508 GNERerouterIntervalDialog::onCmdChangeBeginEnd(FXObject*, FXSelector, void*) {
511  // set new values in rerouter interval
514  // sort intervals of rerouter
516  // change icon
517  myBeginEndValid = true;
519  } else {
520  myBeginEndValid = false;
522  }
523  return 0;
524 }
525 
526 
527 void
529  // clear table
530  myClosingLaneRerouteTable->clearItems();
531  // set number of rows
533  // Configure list
534  myClosingLaneRerouteTable->setVisibleColumns(5);
535  myClosingLaneRerouteTable->setColumnWidth(0, 83);
536  myClosingLaneRerouteTable->setColumnWidth(1, 83);
537  myClosingLaneRerouteTable->setColumnWidth(2, 82);
540  myClosingLaneRerouteTable->setColumnText(0, toString(SUMO_ATTR_LANE).c_str());
541  myClosingLaneRerouteTable->setColumnText(1, toString(SUMO_ATTR_ALLOW).c_str());
542  myClosingLaneRerouteTable->setColumnText(2, toString(SUMO_ATTR_DISALLOW).c_str());
543  myClosingLaneRerouteTable->setColumnText(3, "");
544  myClosingLaneRerouteTable->setColumnText(4, "");
545  myClosingLaneRerouteTable->getRowHeader()->setWidth(0);
546  // Declare pointer to FXTableItem
547  FXTableItem* item = 0;
548  // iterate over values
549  for (int i = 0; i < (int)myEditedRerouterInterval->getClosingLaneReroutes().size(); i++) {
550  // Set closing edge
551  item = new FXTableItem(myEditedRerouterInterval->getClosingLaneReroutes().at(i)->getAttribute(SUMO_ATTR_ID).c_str());
552  myClosingLaneRerouteTable->setItem(i, 0, item);
553  // set allow vehicles
554  item = new FXTableItem(myEditedRerouterInterval->getClosingLaneReroutes().at(i)->getAttribute(SUMO_ATTR_ALLOW).c_str());
555  myClosingLaneRerouteTable->setItem(i, 1, item);
556  // set disallow vehicles
557  item = new FXTableItem(myEditedRerouterInterval->getClosingLaneReroutes().at(i)->getAttribute(SUMO_ATTR_DISALLOW).c_str());
558  myClosingLaneRerouteTable->setItem(i, 2, item);
559  // set valid icon
560  item = new FXTableItem("");
561  item->setIcon(GUIIconSubSys::getIcon(ICON_CORRECT));
562  item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y);
563  item->setEnabled(false);
564  myClosingLaneRerouteTable->setItem(i, 3, item);
565  // set remove
566  item = new FXTableItem("", GUIIconSubSys::getIcon(ICON_REMOVE));
567  item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y);
568  item->setEnabled(false);
569  myClosingLaneRerouteTable->setItem(i, 4, item);
570  }
571 }
572 
573 
574 void
576  // clear table
577  myClosingRerouteTable->clearItems();
578  // set number of rows
579  myClosingRerouteTable->setTableSize(int(myEditedRerouterInterval->getClosingReroutes().size()), 5);
580  // Configure list
581  myClosingRerouteTable->setVisibleColumns(5);
582  myClosingRerouteTable->setColumnWidth(0, 83);
583  myClosingRerouteTable->setColumnWidth(1, 83);
584  myClosingRerouteTable->setColumnWidth(2, 82);
587  myClosingRerouteTable->setColumnText(0, toString(SUMO_ATTR_EDGE).c_str());
588  myClosingRerouteTable->setColumnText(1, toString(SUMO_ATTR_ALLOW).c_str());
589  myClosingRerouteTable->setColumnText(2, toString(SUMO_ATTR_DISALLOW).c_str());
590  myClosingRerouteTable->setColumnText(3, "");
591  myClosingRerouteTable->setColumnText(4, "");
592  myClosingRerouteTable->getRowHeader()->setWidth(0);
593  // Declare pointer to FXTableItem
594  FXTableItem* item = 0;
595  // iterate over values
596  for (int i = 0; i < (int)myEditedRerouterInterval->getClosingReroutes().size(); i++) {
597  // Set closing edge
598  item = new FXTableItem(myEditedRerouterInterval->getClosingReroutes().at(i)->getAttribute(SUMO_ATTR_ID).c_str());
599  myClosingRerouteTable->setItem(i, 0, item);
600  // set allow vehicles
601  item = new FXTableItem(myEditedRerouterInterval->getClosingReroutes().at(i)->getAttribute(SUMO_ATTR_ALLOW).c_str());
602  myClosingRerouteTable->setItem(i, 1, item);
603  // set disallow vehicles
604  item = new FXTableItem(myEditedRerouterInterval->getClosingReroutes().at(i)->getAttribute(SUMO_ATTR_DISALLOW).c_str());
605  myClosingRerouteTable->setItem(i, 2, item);
606  // set valid icon
607  item = new FXTableItem("");
608  item->setIcon(GUIIconSubSys::getIcon(ICON_CORRECT));
609  item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y);
610  item->setEnabled(false);
611  myClosingRerouteTable->setItem(i, 3, item);
612  // set remove
613  item = new FXTableItem("", GUIIconSubSys::getIcon(ICON_REMOVE));
614  item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y);
615  item->setEnabled(false);
616  myClosingRerouteTable->setItem(i, 4, item);
617  }
618 }
619 
620 
621 void
623  // clear table
624  myDestProbRerouteTable->clearItems();
625  // set number of rows
627  // Configure list
628  myDestProbRerouteTable->setVisibleColumns(4);
629  myDestProbRerouteTable->setColumnWidth(0, 124);
630  myDestProbRerouteTable->setColumnWidth(1, 124);
633  myDestProbRerouteTable->setColumnText(0, toString(SUMO_ATTR_EDGE).c_str());
634  myDestProbRerouteTable->setColumnText(1, toString(SUMO_ATTR_PROB).c_str());
635  myDestProbRerouteTable->setColumnText(2, "");
636  myDestProbRerouteTable->setColumnText(3, "");
637  myDestProbRerouteTable->getRowHeader()->setWidth(0);
638  // Declare pointer to FXTableItem
639  FXTableItem* item = 0;
640  // iterate over values
641  for (int i = 0; i < (int)myEditedRerouterInterval->getDestProbReroutes().size(); i++) {
642  // Set new destination
643  item = new FXTableItem(myEditedRerouterInterval->getDestProbReroutes().at(i)->getAttribute(SUMO_ATTR_ID).c_str());
644  myDestProbRerouteTable->setItem(i, 0, item);
645  // Set probability
646  item = new FXTableItem(myEditedRerouterInterval->getDestProbReroutes().at(i)->getAttribute(SUMO_ATTR_PROB).c_str());
647  myDestProbRerouteTable->setItem(i, 1, item);
648  // set valid icon
649  item = new FXTableItem("");
650  item->setIcon(GUIIconSubSys::getIcon(ICON_CORRECT));
651  item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y);
652  item->setEnabled(false);
653  myDestProbRerouteTable->setItem(i, 2, item);
654  // set remove
655  item = new FXTableItem("", GUIIconSubSys::getIcon(ICON_REMOVE));
656  item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y);
657  item->setEnabled(false);
658  myDestProbRerouteTable->setItem(i, 3, item);
659  }
660 }
661 
662 
663 void
665  // clear table
666  myRouteProbRerouteTable->clearItems();
667  // set number of rows
669  // Configure list
670  myRouteProbRerouteTable->setVisibleColumns(4);
671  myRouteProbRerouteTable->setColumnWidth(0, 124);
672  myRouteProbRerouteTable->setColumnWidth(1, 124);
675  myRouteProbRerouteTable->setColumnText(0, toString(SUMO_ATTR_ROUTE).c_str());
676  myRouteProbRerouteTable->setColumnText(1, toString(SUMO_ATTR_PROB).c_str());
677  myRouteProbRerouteTable->setColumnText(2, "");
678  myRouteProbRerouteTable->setColumnText(3, "");
679  myRouteProbRerouteTable->getRowHeader()->setWidth(0);
680  // Declare pointer to FXTableItem
681  FXTableItem* item = 0;
682  // iterate over values
683  for (int i = 0; i < (int)myEditedRerouterInterval->getRouteProbReroutes().size(); i++) {
684  // Set new route
685  item = new FXTableItem(myEditedRerouterInterval->getRouteProbReroutes().at(i)->getAttribute(SUMO_ATTR_ID).c_str());
686  myRouteProbRerouteTable->setItem(i, 0, item);
687  // Set probability
688  item = new FXTableItem(myEditedRerouterInterval->getRouteProbReroutes().at(i)->getAttribute(SUMO_ATTR_PROB).c_str());
689  myRouteProbRerouteTable->setItem(i, 1, item);
690  // set valid icon
691  item = new FXTableItem("");
692  item->setIcon(GUIIconSubSys::getIcon(ICON_CORRECT));
693  item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y);
694  item->setEnabled(false);
695  myRouteProbRerouteTable->setItem(i, 2, item);
696  // set remove
697  item = new FXTableItem("", GUIIconSubSys::getIcon(ICON_REMOVE));
698  item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y);
699  item->setEnabled(false);
700  myRouteProbRerouteTable->setItem(i, 3, item);
701  }
702 }
703 
704 
705 /****************************************************************************/
#define GUIDesignTableIconCellWidth
width of cells that only contains an Icon
Definition: GUIDesigns.h:414
void updateDestProbReroutesTable()
update data of destiny probabilitry reroute table
void resetChanges()
reset changes did in this dialog.
const std::vector< GNEDestProbReroute * > & getDestProbReroutes() const
get destiny probability reroutes
const std::vector< GNEClosingLaneReroute * > & getClosingLaneReroutes() const
get closing reroutes
long onCmdEditDestProbReroute(FXObject *, FXSelector, void *)
/edit dest prob reroute
change table clisng lane reroute reroute
Definition: GUIAppEnum.h:816
Dialog for edit rerouter intervals.
bool myBeginEndValid
flag to check if begin an end are valid
long onCmdClickedDestProbReroute(FXObject *, FXSelector, void *)
remove dest prob reroute
GNERerouterInterval * getEditedRerouterInterval() const
get edited Rerouter Interval
lane of a reroute of type closing
#define GUIDesignLabelIcon32x32Thicked
label ticked filled only with an icon of 32x32
Definition: GUIDesigns.h:170
bool myClosingReroutesValid
flag to check if closing reroutes are valid
Dialog to edit sequences, parameters, etc.. of Additionals.
void updateRouteProbReroutesTable()
update data of probabilitry reroutes table
bool isValid(SumoXMLAttr key, const std::string &value)
weights: time range begin
long onCmdClickedRouteProbReroute(FXObject *, FXSelector, void *)
remove route prob reroute
void updateClosingLaneReroutesTable()
update data of closing lane reroute table
FXTable * myClosingLaneRerouteTable
list with closing lane reroutes
bool myRouteProbReroutesValid
flag to check if route prob reroutes are valid
FXTextField * myBeginTextField
begin time text field
const std::vector< GNERouteProbReroute * > & getRouteProbReroutes() const
get reoute probability reroutes
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
add destiny probability route
Definition: GUIAppEnum.h:830
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:199
bool myClosingLaneReroutesValid
flag to check if closing lane reroutes are valid
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:64
long onCmdAddClosingLaneReroute(FXObject *, FXSelector, void *)
add closing lane reroute
long onCmdEditRouteProbReroute(FXObject *, FXSelector, void *)
/edit route prob reroute
bool isValid(SumoXMLAttr key, const std::string &value)
long onCmdReset(FXObject *, FXSelector, void *)
event after press reset button
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
long onCmdAddRouteProbReroute(FXObject *, FXSelector, void *)
add route prob reroute
GNEUndoList * getUndoList() const
get the undoList object
#define GUIDesignAuxiliarFrame
design for auxiliar (Without borders) frames used to pack another frames extended in all directions ...
Definition: GUIDesigns.h:243
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:55
#define GUIDesignUniformHorizontalFrame
design for horizontal frame used to pack another frames with a uniform width
Definition: GUIDesigns.h:252
void updateClosingReroutesTable()
update data of closing reroute table
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames ...
Definition: GUIDesigns.h:246
long onCmdAddClosingReroute(FXObject *, FXSelector, void *)
add closing reroute
long onCmdEditClosingReroute(FXObject *, FXSelector, void *)
/edit closing reroute
long onCmdEditClosingLaneReroute(FXObject *, FXSelector, void *)
/edit closing lane reroute
bool myUpdatingElement
flag to indicate if rerouter interval is being created or modified
GNERerouter * getRerouterParent() const
get rerouter parent
probability of route of a reroute
probability of destiny of a reroute
long onCmdAccept(FXObject *, FXSelector, void *)
bool isValid(SumoXMLAttr key, const std::string &value)
#define GUIDesignTableAdditionals
design for tables used in additional dialogs
Definition: GUIDesigns.h:411
long onCmdClickedClosingLaneReroute(FXObject *, FXSelector, void *)
remove closing lane reroute
#define GUIDesignButtonIcon
button only with icon (23x23)
Definition: GUIDesigns.h:65
FXTable * myDestProbRerouteTable
list with destiny probability reroutes
bool myDestProbReroutesValid
flag to check if Destiny probability reroutes are valid
reroute of type closing
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition: GUIDesigns.h:49
change table route probability reroute
Definition: GUIAppEnum.h:822
FXTable * myRouteProbRerouteTable
list with route probability reroute
FXTextField * myEndTextField
end time text field
const std::vector< GNEClosingReroute * > & getClosingReroutes() const
get closing reroutes
long onCmdAddDestProbReroute(FXObject *, FXSelector, void *)
add dest prob reroute
FXLabel * myCheckLabel
begin/end time check label
void sortIntervals()
sort intervals
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
GNEViewNet * getViewNet() const
Returns a pointer to GNEViewNet in which additional element is located.
void acceptChanges()
Accept changes did in this dialog.
GNERerouterInterval * myEditedRerouterInterval
pointer to rerouter interval
long onCmdClickedClosingReroute(FXObject *, FXSelector, void *)
remove closing reroute
weights: time range end
void cancelChanges()
Cancel changes did in this dialog.
bool isValid(SumoXMLAttr key, const std::string &value)
#define GUIDesignLabelThick
label extended over frame with thick and with text justify to left and height of 23 ...
Definition: GUIDesigns.h:152
bool isValid(SumoXMLAttr key, const std::string &value)
#define GUIDesignTextFieldReal
text field extended over Frame with thick frame and limited to Doubles/doubles
Definition: GUIDesigns.h:46
change table route closing reroute
Definition: GUIAppEnum.h:818
change table destiny probability reroute
Definition: GUIAppEnum.h:820
FXTable * myClosingRerouteTable
list with closing reroutes
long onCmdCancel(FXObject *, FXSelector, void *)
event after press cancel button
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
long onCmdChangeBeginEnd(FXObject *, FXSelector, void *)
called when begin or endis changed
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
#define GUIDesignLabelLeftThick
label extended over frame with thick and with text justify to left and height of 23 ...
Definition: GUIDesigns.h:155
add route probability route
Definition: GUIAppEnum.h:832
FXDEFMAP(GNERerouterIntervalDialog) GNERerouterIntervalDialogMap[]
SumoXMLTag getTag() const
get XML Tag assigned to this object