SUMO - Simulation of Urban MObility
GNERerouterIntervalDialog.cpp
Go to the documentation of this file.
1 /****************************************************************************/
7 // Dialog for edit rerouter intervals
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #ifdef _MSC_VER
25 #include <windows_config.h>
26 #else
27 #include <config.h>
28 #endif
29 
30 #include <iostream>
35 
37 #include "GNERerouterDialog.h"
38 #include "GNERerouter.h"
39 #include "GNERerouterInterval.h"
40 #include "GNERerouterInterval.h"
41 #include "GNEClosingLaneReroute.h"
42 #include "GNEClosingReroute.h"
43 #include "GNEDestProbReroute.h"
44 #include "GNERouteProbReroute.h"
45 #include "GNEEdge.h"
46 #include "GNELane.h"
47 #include "GNEViewNet.h"
48 #include "GNENet.h"
49 
50 
51 // ===========================================================================
52 // FOX callback mapping
53 // ===========================================================================
54 
55 FXDEFMAP(GNERerouterIntervalDialog) GNERerouterIntervalDialogMap[] = {
72 };
73 
74 // Object implementation
75 FXIMPLEMENT(GNERerouterIntervalDialog, FXDialogBox, GNERerouterIntervalDialogMap, ARRAYNUMBER(GNERerouterIntervalDialogMap))
76 
77 // ===========================================================================
78 // member method definitions
79 // ===========================================================================
80 
82  GNEAdditionalDialog(rerouterInterval.getRerouterParent(), 640, 480),
83  myRerouterDialogParent(rerouterDialog),
84  myRerouterInterval(&rerouterInterval),
85  myBeginEndValid(true),
86  myClosingLaneReroutesValid(true),
87  myClosingReroutesValid(true),
88  myDestProbReroutesValid(true),
89  myRouteProbReroutesValid(true) {
90  // change default header
91  changeAdditionalDialogHeader("Edit " + toString(rerouterInterval.getTag()) + " of " + toString(rerouterInterval.getRerouterParent()->getTag()) +
92  " '" + rerouterInterval.getRerouterParent()->getID() + "'");
93 
94  // Create auxiliar frames for tables
95  FXHorizontalFrame* columns = new FXHorizontalFrame(myContentFrame, GUIDesignUniformHorizontalFrame);
96  FXVerticalFrame* columnLeft = new FXVerticalFrame(columns, GUIDesignAuxiliarFrame);
97  FXVerticalFrame* columnRight = new FXVerticalFrame(columns, GUIDesignAuxiliarFrame);
98 
99  // create horizontal frame for begin and end label
100  FXHorizontalFrame* beginEndElementsLeft = new FXHorizontalFrame(columnLeft, GUIDesignAuxiliarHorizontalFrame);
101  new FXLabel(beginEndElementsLeft, (toString(SUMO_ATTR_BEGIN) + " and " + toString(SUMO_ATTR_END) + " of " + toString(rerouterInterval.getTag())).c_str(), 0, GUIDesignLabelLeftThick);
102  myCheckLabel = new FXLabel(beginEndElementsLeft, "", 0, GUIDesignLabelIcon32x32Thicked);
103 
104  // create horizontal frame for begin and end text fields
105  FXHorizontalFrame* beginEndElementsRight = new FXHorizontalFrame(columnRight, GUIDesignAuxiliarHorizontalFrame);
106  myBeginTextField = new FXTextField(beginEndElementsRight, GUIDesignTextFieldNCol, this, MID_GNE_REROUTEDIALOG_EDIT_INTERVAL, GUIDesignTextFieldReal);
107  myBeginTextField->setText(toString(myRerouterInterval->getBegin()).c_str());
108  myEndTextField = new FXTextField(beginEndElementsRight, GUIDesignTextFieldNCol, this, MID_GNE_REROUTEDIALOG_EDIT_INTERVAL, GUIDesignTextFieldReal);
109  myEndTextField->setText(toString(myRerouterInterval->getEnd()).c_str());
110 
111  // set interval flag depending if interval exists
112  if (myRerouterDialogParent->findInterval(myRerouterInterval->getBegin(), myRerouterInterval->getEnd())) {
113  myCheckLabel->setIcon(GUIIconSubSys::getIcon(ICON_CORRECT));
114  myBeginEndValid = true;
115  } else {
116  myCheckLabel->setIcon(GUIIconSubSys::getIcon(ICON_ERROR));
117  myBeginEndValid = false;
118  }
119 
120  // Create labels and tables
121  FXHorizontalFrame* buttonAndLabelClosingLaneReroute = new FXHorizontalFrame(columnLeft, GUIDesignAuxiliarHorizontalFrame);
122  myAddClosingLaneReroutes = new FXButton(buttonAndLabelClosingLaneReroute, "", GUIIconSubSys::getIcon(ICON_ADD), this, MID_GNE_REROUTEDIALOG_ADD_CLOSINGLANEREROUTE, GUIDesignButtonIcon);
123  new FXLabel(buttonAndLabelClosingLaneReroute, ("Add new " + toString(SUMO_TAG_CLOSING_LANE_REROUTE) + "s").c_str(), 0, GUIDesignLabelThick);
124  myClosingLaneRerouteList = new FXTable(columnLeft, this, MID_GNE_REROUTEDIALOG_TABLE_CLOSINGLANEREROUTE, GUIDesignTableAdditionals);
125  myClosingLaneRerouteList->setSelBackColor(FXRGBA(255, 255, 255, 255));
126  myClosingLaneRerouteList->setSelTextColor(FXRGBA(0, 0, 0, 255));
127 
128  FXHorizontalFrame* buttonAndLabelClosinReroute = new FXHorizontalFrame(columnLeft, GUIDesignAuxiliarHorizontalFrame);
129  myAddClosingReroutes = new FXButton(buttonAndLabelClosinReroute, "", GUIIconSubSys::getIcon(ICON_ADD), this, MID_GNE_REROUTEDIALOG_ADD_CLOSINGREROUTE, GUIDesignButtonIcon);
130  new FXLabel(buttonAndLabelClosinReroute, ("Add new " + toString(SUMO_TAG_CLOSING_REROUTE) + "s").c_str(), 0, GUIDesignLabelThick);
131  myClosingRerouteList = new FXTable(columnLeft, this, MID_GNE_REROUTEDIALOG_TABLE_CLOSINGREROUTE, GUIDesignTableAdditionals);
132  myClosingRerouteList->setSelBackColor(FXRGBA(255, 255, 255, 255));
133  myClosingRerouteList->setSelTextColor(FXRGBA(0, 0, 0, 255));
134 
135  FXHorizontalFrame* buttonAndLabelDestProbReroute = new FXHorizontalFrame(columnRight, GUIDesignAuxiliarHorizontalFrame);
136  myAddDestProbReroutes = new FXButton(buttonAndLabelDestProbReroute, "", GUIIconSubSys::getIcon(ICON_ADD), this, MID_GNE_REROUTEDIALOG_ADD_DESTPROBREROUTE, GUIDesignButtonIcon);
137  new FXLabel(buttonAndLabelDestProbReroute, ("Add new " + toString(SUMO_TAG_DEST_PROB_REROUTE) + "s").c_str(), 0, GUIDesignLabelThick);
138  myDestProbRerouteList = new FXTable(columnRight, this, MID_GNE_REROUTEDIALOG_TABLE_DESTPROBREROUTE, GUIDesignTableAdditionals);
139  myDestProbRerouteList->setSelBackColor(FXRGBA(255, 255, 255, 255));
140  myDestProbRerouteList->setSelTextColor(FXRGBA(0, 0, 0, 255));
141 
142  FXHorizontalFrame* buttonAndLabelRouteProbReroute = new FXHorizontalFrame(columnRight, GUIDesignAuxiliarHorizontalFrame);
143  myAddRouteProbReroute = new FXButton(buttonAndLabelRouteProbReroute, "", GUIIconSubSys::getIcon(ICON_ADD), this, MID_GNE_REROUTEDIALOG_ADD_ROUTEPROBREROUTE, GUIDesignButtonIcon);
144  new FXLabel(buttonAndLabelRouteProbReroute, ("Add new " + toString(SUMO_TAG_ROUTE_PROB_REROUTE) + "s").c_str(), 0, GUIDesignLabelThick);
145  myRouteProbRerouteList = new FXTable(columnRight, this, MID_GNE_REROUTEDIALOG_TABLE_ROUTEPROBREROUTE, GUIDesignTableAdditionals);
146  myRouteProbRerouteList->setSelBackColor(FXRGBA(255, 255, 255, 255));
147  myRouteProbRerouteList->setSelTextColor(FXRGBA(0, 0, 0, 255));
148 
149  // copy Elements
150  myCopyOfClosingLaneReroutes = myRerouterInterval->getClosingLaneReroutes();
151  myCopyOfClosingReroutes = myRerouterInterval->getClosingReroutes();
152  myCopyOfDestProbReroutes = myRerouterInterval->getDestProbReroutes();
153  myCopyOfRouteProbReroutes = myRerouterInterval->getRouteProbReroutes();
154 
155  // update tables
156  updateClosingLaneReroutesTable();
157  updateClosingReroutesTable();
158  updateDestProbReroutesTable();
159  updateRouteProbReroutesTable();
160 }
161 
162 
164 }
165 
166 
167 long
168 GNERerouterIntervalDialog::onCmdAccept(FXObject*, FXSelector, void*) {
169  if (myBeginEndValid == false) {
170  // write warning if netedit is running in testing mode
171  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
172  WRITE_WARNING("Opening FXMessageBox of type 'warning'");
173  }
174  // open warning Box
175  FXMessageBox::warning(getApp(), MBOX_OK,
176  ("Error updating " + toString(myRerouterInterval->getTag()) + " of " + toString(myRerouterInterval->getRerouterParent()->getTag())).c_str(), "%s",
178  " cannot be updated because " + toString(myRerouterInterval->getTag()) + " defined by " + toString(SUMO_ATTR_BEGIN) + " and " + toString(SUMO_ATTR_END) + " is invalid.").c_str());
179 
180 
181  // write warning if netedit is running in testing mode
182  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
183  WRITE_WARNING("Closed FXMessageBox of type 'warning' with 'OK'");
184  }
185  return 0;
187  // write warning if netedit is running in testing mode
188  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
189  WRITE_WARNING("Opening FXMessageBox of type 'warning'");
190  }
191  // open warning Box
192  FXMessageBox::warning(getApp(), MBOX_OK,
193  ("Error updating " + toString(myRerouterInterval->getTag()) + " of " + toString(myRerouterInterval->getRerouterParent()->getTag())).c_str(), "%s",
195  " cannot be updated because at least one " + toString(myRerouterInterval->getTag()) + "'s element must be defined.").c_str());
196  // write warning if netedit is running in testing mode
197  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
198  WRITE_WARNING("Closed FXMessageBox of type 'warning' with 'OK'");
199  }
200  return 0;
201  } else if (myClosingLaneReroutesValid == false) {
202  // write warning if netedit is running in testing mode
203  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
204  WRITE_WARNING("Opening FXMessageBox of type 'warning'");
205  }
206  // open warning Box
207  FXMessageBox::warning(getApp(), MBOX_OK,
208  ("Error updating " + toString(myRerouterInterval->getTag()) + " of " + toString(myRerouterInterval->getRerouterParent()->getTag())).c_str(), "%s",
210  " cannot be updated because there are invalid " + toString(SUMO_TAG_CLOSING_LANE_REROUTE) + "s.").c_str());
211  // write warning if netedit is running in testing mode
212  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
213  WRITE_WARNING("Closed FXMessageBox of type 'warning' with 'OK'");
214  }
215  return 0;
216  } else if (myClosingReroutesValid == false) {
217  // write warning if netedit is running in testing mode
218  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
219  WRITE_WARNING("Opening FXMessageBox of type 'warning'");
220  }
221  // open warning Box
222  FXMessageBox::warning(getApp(), MBOX_OK,
223  ("Error updating " + toString(myRerouterInterval->getTag()) + " of " + toString(myRerouterInterval->getRerouterParent()->getTag())).c_str(), "%s",
225  " cannot be updated because there are invalid " + toString(SUMO_TAG_CLOSING_REROUTE) + "s.").c_str());
226  // write warning if netedit is running in testing mode
227  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
228  WRITE_WARNING("Closed FXMessageBox of type 'warning' with 'OK'");
229  }
230  return 0;
231  } else if (myDestProbReroutesValid == false) {
232  // write warning if netedit is running in testing mode
233  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
234  WRITE_WARNING("Opening FXMessageBox of type 'warning'");
235  }
236  // open warning Box
237  FXMessageBox::warning(getApp(), MBOX_OK,
238  ("Error updating " + toString(myRerouterInterval->getTag()) + " of " + toString(myRerouterInterval->getRerouterParent()->getTag())).c_str(), "%s",
240  " cannot be updated because 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 (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,
253  ("Error updating " + toString(myRerouterInterval->getTag()) + " of " + toString(myRerouterInterval->getRerouterParent()->getTag())).c_str(), "%s",
255  " cannot be updated because there are invalid " + toString(SUMO_TAG_ROUTE_PROB_REROUTE) + "s.").c_str());
256  // write warning if netedit is running in testing mode
257  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
258  WRITE_WARNING("Closed FXMessageBox of type 'warning' with 'OK'");
259  }
260  return 0;
261  } else {
262  // set new values of rerouter interval
267  myRerouterInterval->setBegin(GNEAttributeCarrier::parse<double>(myBeginTextField->getText().text()));
268  myRerouterInterval->setEnd(GNEAttributeCarrier::parse<double>(myEndTextField->getText().text()));
269 
270  // Stop Modal
271  getApp()->stopModal(this, TRUE);
272  return 1;
273  }
274 }
275 
276 
277 long
278 GNERerouterIntervalDialog::onCmdCancel(FXObject*, FXSelector, void*) {
279  // Stop Modal
280  getApp()->stopModal(this, FALSE);
281  return 1;
282 }
283 
284 
285 long
286 GNERerouterIntervalDialog::onCmdReset(FXObject*, FXSelector, void*) {
287  // Copy original intervals again
292  // update tables
297  return 1;
298 }
299 
300 
301 long
303  // add new element and update table
307  return 1;
308 }
309 
310 
311 long
313  // add new element and update table
317  return 1;
318 }
319 
320 
321 long
323  // add new element and update table
326  onCmdEditDestProbReroute(0, 0, 0);
327  return 1;
328 }
329 
330 
331 long
333  // add new element and update table
336  onCmdEditRouteProbReroute(0, 0, 0);
337  return 1;
338 }
339 
340 
341 long
343  // check if some delete button was pressed
344  for (int i = 0; i < (int)myCopyOfClosingLaneReroutes.size(); i++) {
345  if (myClosingLaneRerouteList->getItem(i, 4)->hasFocus()) {
346  myClosingLaneRerouteList->removeRows(i);
349  return 1;
350  }
351  }
352  return 0;
353 }
354 
355 
356 long
358  // check if some delete button was pressed
359  for (int i = 0; i < (int)myCopyOfClosingReroutes.size(); i++) {
360  if (myClosingRerouteList->getItem(i, 4)->hasFocus()) {
361  myClosingRerouteList->removeRows(i);
364  return 1;
365  }
366  }
367  return 1;
368 }
369 
370 
371 long
373  // check if some delete button was pressed
374  for (int i = 0; i < (int)myCopyOfDestProbReroutes.size(); i++) {
375  if (myDestProbRerouteList->getItem(i, 3)->hasFocus()) {
376  myDestProbRerouteList->removeRows(i);
379  return 1;
380  }
381  }
382  return 0;
383 }
384 
385 
386 long
388  // check if some delete button was pressed
389  for (int i = 0; i < (int)myCopyOfRouteProbReroutes.size(); i++) {
390  if (myRouteProbRerouteList->getItem(i, 3)->hasFocus()) {
391  myRouteProbRerouteList->removeRows(i);
394  return 1;
395  }
396  }
397  return 0;
398 }
399 
400 
401 long
404  // iterate over table and check that all parameters are correct
405  for (int i = 0; i < myClosingLaneRerouteList->getNumRows(); i++) {
406  GNELane* lane = myRerouterInterval->getRerouterParent()->getViewNet()->getNet()->retrieveLane(myClosingLaneRerouteList->getItem(i, 0)->getText().text(), false);
407  if (lane == NULL) {
410  } else if (canParseVehicleClasses(myClosingLaneRerouteList->getItem(i, 1)->getText().text()) == false) {
413  } else if (canParseVehicleClasses(myClosingLaneRerouteList->getItem(i, 2)->getText().text()) == false) {
416  } else {
417  myCopyOfClosingLaneReroutes.at(i).setAllowedVehicles(parseVehicleClasses(myClosingLaneRerouteList->getItem(i, 1)->getText().text()));
418  myCopyOfClosingLaneReroutes.at(i).setDisallowedVehicles(parseVehicleClasses(myClosingLaneRerouteList->getItem(i, 2)->getText().text()));
419  myCopyOfClosingLaneReroutes.at(i).setClosedLane(lane);
421  }
422  }
423  // update list
424  myClosingLaneRerouteList->update();
425  return 1;
426 }
427 
428 
429 long
431  myClosingReroutesValid = true;
432  // iterate over table and check that all parameters are correct
433  for (int i = 0; i < myClosingRerouteList->getNumRows(); i++) {
434  GNEEdge* edge = myRerouterInterval->getRerouterParent()->getViewNet()->getNet()->retrieveEdge(myClosingRerouteList->getItem(i, 0)->getText().text(), false);
435  if (edge == NULL) {
436  myClosingReroutesValid = false;
437  myClosingRerouteList->getItem(i, 3)->setIcon(GUIIconSubSys::getIcon(ICON_ERROR));
438  } else if (canParseVehicleClasses(myClosingRerouteList->getItem(i, 1)->getText().text()) == false) {
439  myClosingReroutesValid = false;
440  myClosingRerouteList->getItem(i, 3)->setIcon(GUIIconSubSys::getIcon(ICON_ERROR));
441  } else if (canParseVehicleClasses(myClosingRerouteList->getItem(i, 2)->getText().text()) == false) {
442  myClosingReroutesValid = false;
443  myClosingRerouteList->getItem(i, 3)->setIcon(GUIIconSubSys::getIcon(ICON_ERROR));
444  } else {
445  myCopyOfClosingReroutes.at(i).setAllowedVehicles(parseVehicleClasses(myClosingRerouteList->getItem(i, 1)->getText().text()));
446  myCopyOfClosingReroutes.at(i).setDisallowedVehicles(parseVehicleClasses(myClosingRerouteList->getItem(i, 2)->getText().text()));
447  myCopyOfClosingReroutes.at(i).setClosedEdge(edge);
448  myClosingRerouteList->getItem(i, 3)->setIcon(GUIIconSubSys::getIcon(ICON_CORRECT));
449  }
450  }
451  // update list
452  myClosingRerouteList->update();
453  return 1;
454 }
455 
456 
457 long
460  // iterate over table and check that all parameters are correct
461  for (int i = 0; i < myDestProbRerouteList->getNumRows(); i++) {
462  GNEEdge* edge = myRerouterInterval->getRerouterParent()->getViewNet()->getNet()->retrieveEdge(myDestProbRerouteList->getItem(i, 0)->getText().text(), false);
463  double probability = -1;
464  // try to parse probability
465  if (GNEAttributeCarrier::canParse<double>(myDestProbRerouteList->getItem(i, 1)->getText().text())) {
466  probability = GNEAttributeCarrier::parse<double>(myDestProbRerouteList->getItem(i, 1)->getText().text());
467  }
468  // check if values are valid
469  if (edge == NULL) {
470  myDestProbReroutesValid = false;
471  myDestProbRerouteList->getItem(i, 2)->setIcon(GUIIconSubSys::getIcon(ICON_ERROR));
472  } else if ((probability < 0) || (probability > 1)) {
473  myDestProbReroutesValid = false;
474  myDestProbRerouteList->getItem(i, 2)->setIcon(GUIIconSubSys::getIcon(ICON_ERROR));
475  } else {
476  myCopyOfDestProbReroutes.at(i).setNewDestination(edge);
477  myCopyOfDestProbReroutes.at(i).setProbability(probability);
479  myDestProbRerouteList->update();
480  }
481  }
482  // update list
483  myDestProbRerouteList->update();
484  return 1;
485 }
486 
487 
488 long
491  // iterate over table and check that all parameters are correct
492  for (int i = 0; i < myRouteProbRerouteList->getNumRows(); i++) {
493  double probability = -1;
494  std::string route = myRouteProbRerouteList->getItem(i, 0)->getText().text();
495  // try to parse probability
496  if (GNEAttributeCarrier::canParse<double>(myRouteProbRerouteList->getItem(i, 1)->getText().text())) {
497  probability = GNEAttributeCarrier::parse<double>(myRouteProbRerouteList->getItem(i, 1)->getText().text());
498  }
499  // check if values are valid
500  if (route.empty()) {
501  myRouteProbReroutesValid = false;
502  myRouteProbRerouteList->getItem(i, 2)->setIcon(GUIIconSubSys::getIcon(ICON_ERROR));
503  } else if ((probability < 0) || (probability > 1)) {
504  myRouteProbReroutesValid = false;
505  myRouteProbRerouteList->getItem(i, 2)->setIcon(GUIIconSubSys::getIcon(ICON_ERROR));
506  } else {
507  myCopyOfRouteProbReroutes.at(i).setNewRouteId(myRouteProbRerouteList->getItem(i, 0)->getText().text());
508  myCopyOfRouteProbReroutes.at(i).setProbability(probability);
510  myRouteProbRerouteList->update();
511  }
512  }
513  // update list
514  myRouteProbRerouteList->update();
515  return 1;
516 }
517 
518 
519 long
520 GNERerouterIntervalDialog::onCmdChangeBeginEnd(FXObject*, FXSelector, void*) {
521  double newBegin;
522  double newEnd;
523  // check if interval is valid
524  if (GNEAttributeCarrier::canParse<double>(myBeginTextField->getText().text()) == false) {
525  return false;
526  } else {
527  newBegin = GNEAttributeCarrier::parse<double>(myBeginTextField->getText().text());
528  }
529  if (GNEAttributeCarrier::canParse<double>(myEndTextField->getText().text()) == false) {
530  return false;
531  } else {
532  newEnd = GNEAttributeCarrier::parse<double>(myEndTextField->getText().text());
533  }
534  // check if new begin provoke an overlapping
536  myBeginEndValid = true;
538  return 1;
539  } else {
540  myBeginEndValid = false;
542  return 0;
543  }
544 }
545 
546 
547 void
549  // clear table
550  myClosingLaneRerouteList->clearItems();
551  // set number of rows
552  myClosingLaneRerouteList->setTableSize(int(myCopyOfClosingLaneReroutes.size()), 5);
553  // Configure list
554  myClosingLaneRerouteList->setVisibleColumns(5);
555  myClosingLaneRerouteList->setColumnWidth(0, 83);
556  myClosingLaneRerouteList->setColumnWidth(1, 83);
557  myClosingLaneRerouteList->setColumnWidth(2, 82);
560  myClosingLaneRerouteList->setColumnText(0, toString(SUMO_ATTR_LANE).c_str());
561  myClosingLaneRerouteList->setColumnText(1, toString(SUMO_ATTR_ALLOW).c_str());
562  myClosingLaneRerouteList->setColumnText(2, toString(SUMO_ATTR_DISALLOW).c_str());
563  myClosingLaneRerouteList->setColumnText(3, "");
564  myClosingLaneRerouteList->setColumnText(4, "");
565  myClosingLaneRerouteList->getRowHeader()->setWidth(0);
566  // Declare index for rows and pointer to FXTableItem
567  int indexRow = 0;
568  FXTableItem* item = 0;
569  // iterate over values
570  for (std::vector<GNEClosingLaneReroute>::iterator i = myCopyOfClosingLaneReroutes.begin(); i != myCopyOfClosingLaneReroutes.end(); i++) {
571  // Set closing edge
572  if (i->getClosedLane() != NULL) {
573  item = new FXTableItem(i->getClosedLane()->getID().c_str());
574  myClosingLaneRerouteList->setItem(indexRow, 0, item);
575  } else {
576  item = new FXTableItem("");
577  myClosingLaneRerouteList->setItem(indexRow, 0, item);
578  }
579  // set allow vehicles
580  item = new FXTableItem(getVehicleClassNames(i->getAllowedVehicles()).c_str());
581  myClosingLaneRerouteList->setItem(indexRow, 1, item);
582  // set disallow vehicles
583  item = new FXTableItem(getVehicleClassNames(i->getDisallowedVehicles()).c_str());
584  myClosingLaneRerouteList->setItem(indexRow, 2, item);
585  // set valid icon
586  item = new FXTableItem("");
588  item->setIcon(GUIIconSubSys::getIcon(ICON_CORRECT));
589  } else {
590  item->setIcon(GUIIconSubSys::getIcon(ICON_ERROR));
591  }
592  item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y);
593  item->setEnabled(false);
594  myClosingLaneRerouteList->setItem(indexRow, 3, item);
595  // set remove
596  item = new FXTableItem("", GUIIconSubSys::getIcon(ICON_REMOVE));
597  item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y);
598  item->setEnabled(false);
599  myClosingLaneRerouteList->setItem(indexRow, 4, item);
600  // Update index
601  indexRow++;
602  }
603 }
604 
605 
606 void
608  // clear table
609  myClosingRerouteList->clearItems();
610  // set number of rows
611  myClosingRerouteList->setTableSize(int(myCopyOfClosingReroutes.size()), 5);
612  // Configure list
613  myClosingRerouteList->setVisibleColumns(5);
614  myClosingRerouteList->setColumnWidth(0, 83);
615  myClosingRerouteList->setColumnWidth(1, 83);
616  myClosingRerouteList->setColumnWidth(2, 82);
619  myClosingRerouteList->setColumnText(0, toString(SUMO_ATTR_EDGE).c_str());
620  myClosingRerouteList->setColumnText(1, toString(SUMO_ATTR_ALLOW).c_str());
621  myClosingRerouteList->setColumnText(2, toString(SUMO_ATTR_DISALLOW).c_str());
622  myClosingRerouteList->setColumnText(3, "");
623  myClosingRerouteList->setColumnText(4, "");
624  myClosingRerouteList->getRowHeader()->setWidth(0);
625  // Declare index for rows and pointer to FXTableItem
626  int indexRow = 0;
627  FXTableItem* item = 0;
628  // iterate over values
629  for (std::vector<GNEClosingReroute>::iterator i = myCopyOfClosingReroutes.begin(); i != myCopyOfClosingReroutes.end(); i++) {
630  // Set closing edge
631  if (i->getClosedEdge() != NULL) {
632  item = new FXTableItem(i->getClosedEdge()->getID().c_str());
633  myClosingRerouteList->setItem(indexRow, 0, item);
634  } else {
635  item = new FXTableItem("");
636  myClosingRerouteList->setItem(indexRow, 0, item);
637  }
638  // set allow vehicles
639  item = new FXTableItem(getVehicleClassNames(i->getAllowedVehicles()).c_str());
640  myClosingRerouteList->setItem(indexRow, 1, item);
641  // set disallow vehicles
642  item = new FXTableItem(getVehicleClassNames(i->getDisallowedVehicles()).c_str());
643  myClosingRerouteList->setItem(indexRow, 2, item);
644  // set valid
645  item = new FXTableItem("");
647  item->setIcon(GUIIconSubSys::getIcon(ICON_CORRECT));
648  } else {
649  item->setIcon(GUIIconSubSys::getIcon(ICON_ERROR));
650  }
651  item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y);
652  item->setEnabled(false);
653  myClosingRerouteList->setItem(indexRow, 3, 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  myClosingRerouteList->setItem(indexRow, 4, item);
659  // Update index
660  indexRow++;
661  }
662 }
663 
664 
665 void
667  // clear table
668  myDestProbRerouteList->clearItems();
669  // set number of rows
670  myDestProbRerouteList->setTableSize(int(myCopyOfDestProbReroutes.size()), 4);
671  // Configure list
672  myDestProbRerouteList->setVisibleColumns(4);
673  myDestProbRerouteList->setColumnWidth(0, 124);
674  myDestProbRerouteList->setColumnWidth(1, 124);
677  myDestProbRerouteList->setColumnText(0, toString(SUMO_ATTR_EDGE).c_str());
678  myDestProbRerouteList->setColumnText(1, toString(SUMO_ATTR_PROB).c_str());
679  myDestProbRerouteList->setColumnText(2, "");
680  myDestProbRerouteList->setColumnText(3, "");
681  myDestProbRerouteList->getRowHeader()->setWidth(0);
682  // Declare index for rows and pointer to FXTableItem
683  int indexRow = 0;
684  FXTableItem* item = 0;
685  // iterate over values
686  for (std::vector<GNEDestProbReroute>::iterator i = myCopyOfDestProbReroutes.begin(); i != myCopyOfDestProbReroutes.end(); i++) {
687  // Set new destination
688  if (i->getNewDestination() != NULL) {
689  item = new FXTableItem(i->getNewDestination()->getID().c_str());
690  myDestProbRerouteList->setItem(indexRow, 0, item);
691  } else {
692  item = new FXTableItem("");
693  myDestProbRerouteList->setItem(indexRow, 0, item);
694  }
695  // Set probability
696  item = new FXTableItem(toString(i->getProbability()).c_str());
697  myDestProbRerouteList->setItem(indexRow, 1, item);
698  // set valid
699  item = new FXTableItem("");
701  item->setIcon(GUIIconSubSys::getIcon(ICON_CORRECT));
702  } else {
703  item->setIcon(GUIIconSubSys::getIcon(ICON_ERROR));
704  }
705  item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y);
706  item->setEnabled(false);
707  myDestProbRerouteList->setItem(indexRow, 2, item);
708  // set remove
709  item = new FXTableItem("", GUIIconSubSys::getIcon(ICON_REMOVE));
710  item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y);
711  item->setEnabled(false);
712  myDestProbRerouteList->setItem(indexRow, 3, item);
713  // Update index
714  indexRow++;
715  }
716 }
717 
718 
719 void
721  // clear table
722  myRouteProbRerouteList->clearItems();
723  // set number of rows
724  myRouteProbRerouteList->setTableSize(int(myCopyOfRouteProbReroutes.size()), 4);
725  // Configure list
726  myRouteProbRerouteList->setVisibleColumns(4);
727  myRouteProbRerouteList->setColumnWidth(0, 124);
728  myRouteProbRerouteList->setColumnWidth(1, 124);
731  myRouteProbRerouteList->setColumnText(0, toString(SUMO_ATTR_ROUTE).c_str());
732  myRouteProbRerouteList->setColumnText(1, toString(SUMO_ATTR_PROB).c_str());
733  myRouteProbRerouteList->setColumnText(2, "");
734  myRouteProbRerouteList->setColumnText(3, "");
735  myRouteProbRerouteList->getRowHeader()->setWidth(0);
736  // Declare index for rows and pointer to FXTableItem
737  int indexRow = 0;
738  FXTableItem* item = 0;
739  // iterate over values
740  for (std::vector<GNERouteProbReroute>::iterator i = myCopyOfRouteProbReroutes.begin(); i != myCopyOfRouteProbReroutes.end(); i++) {
741  // Set new route
742  item = new FXTableItem(i->getNewRouteId().c_str());
743  myRouteProbRerouteList->setItem(indexRow, 0, item);
744  // Set probability
745  item = new FXTableItem(toString(i->getProbability()).c_str());
746  myRouteProbRerouteList->setItem(indexRow, 1, item);
747  // set valid
748  item = new FXTableItem("");
750  item->setIcon(GUIIconSubSys::getIcon(ICON_CORRECT));
751  } else {
752  item->setIcon(GUIIconSubSys::getIcon(ICON_ERROR));
753  }
754  item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y);
755  item->setEnabled(false);
756  myRouteProbRerouteList->setItem(indexRow, 2, item);
757  // set remove
758  item = new FXTableItem("", GUIIconSubSys::getIcon(ICON_REMOVE));
759  item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y);
760  item->setEnabled(false);
761  myRouteProbRerouteList->setItem(indexRow, 3, item);
762  // Update index
763  indexRow++;
764  }
765 }
766 
767 
768 /****************************************************************************/
#define GUIDesignTableIconCellWidth
width of cells that only contains an Icon
Definition: GUIDesigns.h:412
void updateDestProbReroutesTable()
update data of destiny probabilitry reroute table
std::string getVehicleClassNames(SVCPermissions permissions, bool expand)
Returns the ids of the given classes, divided using a &#39; &#39;.
GNERerouter * getRerouterParent() const
get rerouter parent
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Definition: GNENet.cpp:899
FXTable * myRouteProbRerouteList
list with route probability reroute
long onCmdEditDestProbReroute(FXObject *, FXSelector, void *)
/edit dest prob reroute
Dialog for edit rerouter intervals.
std::vector< GNEClosingReroute > myCopyOfClosingReroutes
vector with a copy of the closingReroutes
bool myBeginEndValid
flag to check if begin an end are valid
long onCmdClickedDestProbReroute(FXObject *, FXSelector, void *)
remove dest prob reroute
const std::vector< GNEClosingLaneReroute > & getClosingLaneReroutes() const
get closing reroutes
lane of a reroute of type closing
FXTable * myDestProbRerouteList
list with destiny probability reroutes
#define GUIDesignLabelIcon32x32Thicked
label ticked filled only with an icon of 32x32
Definition: GUIDesigns.h:171
FXTable * myClosingRerouteList
list with closing reroutes
bool myClosingReroutesValid
flag to check if closing reroutes are valid
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
Dialog to edit sequences, parameters, etc.. of Additionals.
void updateRouteProbReroutesTable()
update data of probabilitry reroutes table
std::vector< GNEClosingLaneReroute > myCopyOfClosingLaneReroutes
vector with the closingLaneReroutes
void setBegin(double begin)
set begin time
weights: time range begin
long onCmdClickedRouteProbReroute(FXObject *, FXSelector, void *)
remove route prob reroute
void updateClosingLaneReroutesTable()
update data of closing lane reroute table
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:54
bool myRouteProbReroutesValid
flag to check if route prob reroutes are valid
FXTextField * myBeginTextField
begin time text field
void setClosingLaneReroutes(const std::vector< GNEClosingLaneReroute > &closingLaneReroutes)
set closing reroutes
const std::vector< GNEClosingReroute > & getClosingReroutes() const
get closing reroutes
std::vector< GNERouteProbReroute > myCopyOfRouteProbReroutes
vector with a copy of the routeProbReroutes
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:200
bool myClosingLaneReroutesValid
flag to check if closing lane reroutes are valid
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:65
long onCmdAddClosingLaneReroute(FXObject *, FXSelector, void *)
add closing lane reroute
long onCmdEditRouteProbReroute(FXObject *, FXSelector, void *)
/edit route prob reroute
long onCmdReset(FXObject *, FXSelector, void *)
event after press reset button
bool checkModifyInterval(const GNERerouterInterval &rerouterInterval, double newBegin, double newEnd) const
check if begin and end of an existent interval can be modified
long onCmdAddRouteProbReroute(FXObject *, FXSelector, void *)
add route prob reroute
Dialog for edit rerouters.
#define GUIDesignAuxiliarFrame
design for auxiliar (Without borders) frames used to pack another frames extended in all directions ...
Definition: GUIDesigns.h:241
GNEViewNet * getViewNet() const
Returns a pointer to GNEViewNet in which additional element is located.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:56
#define GUIDesignUniformHorizontalFrame
design for horizontal frame used to pack another frames with a uniform width
Definition: GUIDesigns.h:250
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:244
GNELane * retrieveLane(const std::string &id, bool failHard=true)
get lane by id
Definition: GNENet.cpp:958
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
void setRouteProbReroutes(const std::vector< GNERouteProbReroute > &rerouteProbabilityReroutes)
set reoute probability reroutes
SumoXMLTag getTag() const
get tag
probability of route of a reroute
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
probability of destiny of a reroute
long onCmdAccept(FXObject *, FXSelector, void *)
GNERerouterDialog * myRerouterDialogParent
pointer to GNERerouterDialog parent
const std::vector< GNERouteProbReroute > & getRouteProbReroutes() const
get reoute probability reroutes
#define GUIDesignTableAdditionals
design for tables used in additional dialogs
Definition: GUIDesigns.h:409
long onCmdClickedClosingLaneReroute(FXObject *, FXSelector, void *)
remove closing lane reroute
#define GUIDesignButtonIcon
button only with icon (23x23)
Definition: GUIDesigns.h:66
bool myDestProbReroutesValid
flag to check if Destiny probability reroutes are valid
const std::vector< GNEDestProbReroute > & getDestProbReroutes() const
get destiny probability reroutes
bool canParseVehicleClasses(const std::string &classes)
Checks whether the given string contains only known vehicle classes.
reroute of type closing
void setEnd(double end)
set end time
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:58
FXTable * myClosingLaneRerouteList
list with closing lane reroutes
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition: GUIDesigns.h:50
FXTextField * myEndTextField
end time text field
long onCmdAddDestProbReroute(FXObject *, FXSelector, void *)
add dest prob reroute
FXLabel * myCheckLabel
begin/end time check label
long onCmdClickedClosingReroute(FXObject *, FXSelector, void *)
remove closing reroute
weights: time range end
#define GUIDesignLabelThick
label extended over frame with thick and with text justify to left
Definition: GUIDesigns.h:153
GNENet * getNet() const
get the net object
#define GUIDesignTextFieldReal
text field extended over Frame with thick frame and limited to Doubles/doubles
Definition: GUIDesigns.h:47
SumoXMLTag getTag() const
get XML Tag assigned to this object
long onCmdCancel(FXObject *, FXSelector, void *)
event after press cancel button
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
#define GUIDesignLabelLeftThick
label extended over frame with thick and with text justify to left
Definition: GUIDesigns.h:156
GNERerouterInterval * myRerouterInterval
pointer to rerouter interval
std::vector< GNEDestProbReroute > myCopyOfDestProbReroutes
vector with a copy of the destProbReroutes
void setClosingReroutes(const std::vector< GNEClosingReroute > &closingReroutes)
set closing reroutes
FXDEFMAP(GNERerouterIntervalDialog) GNERerouterIntervalDialogMap[]
void setDestProbReroutes(const std::vector< GNEDestProbReroute > &destProbReroutes)
set destiny probability reroutes