SUMO - Simulation of Urban MObility
GNERerouterIntervalDialog.cpp
Go to the documentation of this file.
1 /****************************************************************************/
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>
34 
36 #include "GNERerouterDialog.h"
37 #include "GNERerouter.h"
38 #include "GNERerouterInterval.h"
39 #include "GNERerouterInterval.h"
40 #include "GNEClosingLaneReroute.h"
41 #include "GNEClosingReroute.h"
42 #include "GNEDestProbReroute.h"
43 #include "GNERouteProbReroute.h"
44 #include "GNEEdge.h"
45 #include "GNELane.h"
46 #include "GNEViewNet.h"
47 #include "GNENet.h"
48 
49 #ifdef CHECK_MEMORY_LEAKS
50 #include <foreign/nvwa/debug_new.h>
51 #endif
52 
53 // ===========================================================================
54 // FOX callback mapping
55 // ===========================================================================
56 
57 FXDEFMAP(GNERerouterIntervalDialog) GNERerouterIntervalDialogMap[] = {
75 };
76 
77 // Object implementation
78 FXIMPLEMENT(GNERerouterIntervalDialog, FXDialogBox, GNERerouterIntervalDialogMap, ARRAYNUMBER(GNERerouterIntervalDialogMap))
79 
80 // ===========================================================================
81 // member method definitions
82 // ===========================================================================
83 
85  GNEAdditionalDialog(rerouterInterval.getRerouterParent(), 640, 480),
86  myRerouterDialogParent(rerouterDialog),
87  myRerouterInterval(&rerouterInterval),
88  myBeginEndValid(true),
89  myClosingLaneReroutesValid(true),
90  myClosingReroutesValid(true),
91  myDestProbReroutesValid(true),
92  myRouteProbReroutesValid(true) {
93  // change default header
94  changeAdditionalDialogHeader("Edit " + toString(rerouterInterval.getTag()) + " of " + toString(rerouterInterval.getRerouterParent()->getTag()) +
95  " '" + rerouterInterval.getRerouterParent()->getID() + "'");
96 
97  // Create auxiliar frames for tables
98  FXHorizontalFrame* columns = new FXHorizontalFrame(myContentFrame, GUIDesignUniformHorizontalFrame);
99  FXVerticalFrame* columnLeft = new FXVerticalFrame(columns, GUIDesignAuxiliarFrame);
100  FXVerticalFrame* columnRight = new FXVerticalFrame(columns, GUIDesignAuxiliarFrame);
101 
102  // create horizontal frame for begin and end label
103  FXHorizontalFrame* beginEndElementsLeft = new FXHorizontalFrame(columnLeft, GUIDesignAuxiliarHorizontalFrame);
104  new FXLabel(beginEndElementsLeft, (toString(SUMO_ATTR_BEGIN) + " and " + toString(SUMO_ATTR_END) + " of " + toString(rerouterInterval.getTag())).c_str(), 0, GUIDesignLabelLeftThick);
105  myCheckLabel = new FXLabel(beginEndElementsLeft, "", 0, GUIDesignLabelOnlyIcon);
106 
107  // create horizontal frame for begin and end text fields
108  FXHorizontalFrame* beginEndElementsRight = new FXHorizontalFrame(columnRight, GUIDesignAuxiliarHorizontalFrame);
109  myBeginTextField = new FXTextField(beginEndElementsRight, GUIDesignTextFieldNCol, this, MID_GNE_REROUTEDIALOG_CHANGESTART, GUIDesignTextFieldReal);
110  myBeginTextField->setText(toString(myRerouterInterval->getBegin()).c_str());
111  myEndTextField = new FXTextField(beginEndElementsRight, GUIDesignTextFieldNCol, this, MID_GNE_REROUTEDIALOG_CHANGEEND, GUIDesignTextFieldReal);
112  myEndTextField->setText(toString(myRerouterInterval->getEnd()).c_str());
113 
114  // set interval flag depending if interval exists
115  if (myRerouterDialogParent->findInterval(myRerouterInterval->getBegin(), myRerouterInterval->getEnd())) {
116  myCheckLabel->setIcon(GUIIconSubSys::getIcon(ICON_CORRECT));
117  myBeginEndValid = true;
118  } else {
119  myCheckLabel->setIcon(GUIIconSubSys::getIcon(ICON_ERROR));
120  myBeginEndValid = false;
121  }
122 
123  // Create labels and tables
124  FXHorizontalFrame* buttonAndLabelClosingLaneReroute = new FXHorizontalFrame(columnLeft, GUIDesignAuxiliarHorizontalFrame);
125  myAddClosingLaneReroutes = new FXButton(buttonAndLabelClosingLaneReroute, "", GUIIconSubSys::getIcon(ICON_ADD), this, MID_GNE_REROUTEDIALOG_ADD_CLOSINGLANEREROUTE, GUIDesignButtonIcon);
126  new FXLabel(buttonAndLabelClosingLaneReroute, ("Add new " + toString(SUMO_TAG_CLOSING_LANE_REROUTE) + "s").c_str(), 0, GUIDesignLabelThick);
127  myClosingLaneRerouteList = new FXTable(columnLeft, this, MID_GNE_REROUTEDIALOG_TABLE_CLOSINGLANEREROUTE, GUIDesignTableAdditionals);
128  myClosingLaneRerouteList->setSelBackColor(FXRGBA(255, 255, 255, 255));
129  myClosingLaneRerouteList->setSelTextColor(FXRGBA(0, 0, 0, 255));
130 
131  FXHorizontalFrame* buttonAndLabelClosinReroute = new FXHorizontalFrame(columnLeft, GUIDesignAuxiliarHorizontalFrame);
132  myAddClosingReroutes = new FXButton(buttonAndLabelClosinReroute, "", GUIIconSubSys::getIcon(ICON_ADD), this, MID_GNE_REROUTEDIALOG_ADD_CLOSINGREROUTE, GUIDesignButtonIcon);
133  new FXLabel(buttonAndLabelClosinReroute, ("Add new " + toString(SUMO_TAG_CLOSING_REROUTE) + "s").c_str(), 0, GUIDesignLabelThick);
134  myClosingRerouteList = new FXTable(columnLeft, this, MID_GNE_REROUTEDIALOG_TABLE_CLOSINGREROUTE, GUIDesignTableAdditionals);
135  myClosingRerouteList->setSelBackColor(FXRGBA(255, 255, 255, 255));
136  myClosingRerouteList->setSelTextColor(FXRGBA(0, 0, 0, 255));
137 
138  FXHorizontalFrame* buttonAndLabelDestProbReroute = new FXHorizontalFrame(columnRight, GUIDesignAuxiliarHorizontalFrame);
139  myAddDestProbReroutes = new FXButton(buttonAndLabelDestProbReroute, "", GUIIconSubSys::getIcon(ICON_ADD), this, MID_GNE_REROUTEDIALOG_ADD_DESTPROBREROUTE, GUIDesignButtonIcon);
140  new FXLabel(buttonAndLabelDestProbReroute, ("Add new " + toString(SUMO_TAG_DEST_PROB_REROUTE) + "s").c_str(), 0, GUIDesignLabelThick);
141  myDestProbRerouteList = new FXTable(columnRight, this, MID_GNE_REROUTEDIALOG_TABLE_DESTPROBREROUTE, GUIDesignTableAdditionals);
142  myDestProbRerouteList->setSelBackColor(FXRGBA(255, 255, 255, 255));
143  myDestProbRerouteList->setSelTextColor(FXRGBA(0, 0, 0, 255));
144 
145  FXHorizontalFrame* buttonAndLabelRouteProbReroute = new FXHorizontalFrame(columnRight, GUIDesignAuxiliarHorizontalFrame);
146  myAddRouteProbReroute = new FXButton(buttonAndLabelRouteProbReroute, "", GUIIconSubSys::getIcon(ICON_ADD), this, MID_GNE_REROUTEDIALOG_ADD_ROUTEPROBREROUTE, GUIDesignButtonIcon);
147  new FXLabel(buttonAndLabelRouteProbReroute, ("Add new " + toString(SUMO_TAG_ROUTE_PROB_REROUTE) + "s").c_str(), 0, GUIDesignLabelThick);
148  myRouteProbRerouteList = new FXTable(columnRight, this, MID_GNE_REROUTEDIALOG_TABLE_ROUTEPROBREROUTE, GUIDesignTableAdditionals);
149  myRouteProbRerouteList->setSelBackColor(FXRGBA(255, 255, 255, 255));
150  myRouteProbRerouteList->setSelTextColor(FXRGBA(0, 0, 0, 255));
151 
152  // copy Elements
153  myCopyOfClosingLaneReroutes = myRerouterInterval->getClosingLaneReroutes();
154  myCopyOfClosingReroutes = myRerouterInterval->getClosingReroutes();
155  myCopyOfDestProbReroutes = myRerouterInterval->getDestProbReroutes();
156  myCopyOfRouteProbReroutes = myRerouterInterval->getRouteProbReroutes();
157 
158  // update tables
159  updateClosingLaneReroutesTable();
160  updateClosingReroutesTable();
161  updateDestProbReroutesTable();
162  updateRouteProbReroutesTable();
163 }
164 
165 
167 }
168 
169 
170 long
171 GNERerouterIntervalDialog::onCmdAccept(FXObject*, FXSelector, void*) {
172  if (myBeginEndValid == false) {
173  FXMessageBox::warning(getApp(), MBOX_OK,
174  ("Error updating " + toString(myRerouterInterval->getTag()) + " of " + toString(myRerouterInterval->getRerouterParent()->getTag())).c_str(), "%s",
176  " cannot be updated because " + toString(myRerouterInterval->getTag()) + " defined by " + toString(SUMO_ATTR_BEGIN) + " and " + toString(SUMO_ATTR_END) + " is invalid.").c_str());
177  return 0;
179  FXMessageBox::warning(getApp(), MBOX_OK,
180  ("Error updating " + toString(myRerouterInterval->getTag()) + " of " + toString(myRerouterInterval->getRerouterParent()->getTag())).c_str(), "%s",
182  " cannot be updated because at least one " + toString(myRerouterInterval->getTag()) + "'s element must be defined.").c_str());
183  return 0;
184  } else if (myClosingLaneReroutesValid == false) {
185  FXMessageBox::warning(getApp(), MBOX_OK,
186  ("Error updating " + toString(myRerouterInterval->getTag()) + " of " + toString(myRerouterInterval->getRerouterParent()->getTag())).c_str(), "%s",
188  " cannot be updated because there are invalid " + toString(SUMO_TAG_CLOSING_LANE_REROUTE) + "s.").c_str());
189  return 0;
190  } else if (myClosingReroutesValid == false) {
191  FXMessageBox::warning(getApp(), MBOX_OK,
192  ("Error updating " + toString(myRerouterInterval->getTag()) + " of " + toString(myRerouterInterval->getRerouterParent()->getTag())).c_str(), "%s",
194  " cannot be updated because there are invalid " + toString(SUMO_TAG_CLOSING_REROUTE) + "s.").c_str());
195  return 0;
196  } else if (myDestProbReroutesValid == false) {
197  FXMessageBox::warning(getApp(), MBOX_OK,
198  ("Error updating " + toString(myRerouterInterval->getTag()) + " of " + toString(myRerouterInterval->getRerouterParent()->getTag())).c_str(), "%s",
200  " cannot be updated because there are invalid " + toString(SUMO_TAG_DEST_PROB_REROUTE) + "s.").c_str());
201  return 0;
202  } else if (myRouteProbReroutesValid == false) {
203  FXMessageBox::warning(getApp(), MBOX_OK,
204  ("Error updating " + toString(myRerouterInterval->getTag()) + " of " + toString(myRerouterInterval->getRerouterParent()->getTag())).c_str(), "%s",
206  " cannot be updated because there are invalid " + toString(SUMO_TAG_ROUTE_PROB_REROUTE) + "s.").c_str());
207  return 0;
208  } else {
209  // set new values of rerouter interval
214  myRerouterInterval->setBegin(GNEAttributeCarrier::parse<SUMOReal>(myBeginTextField->getText().text()));
215  myRerouterInterval->setEnd(GNEAttributeCarrier::parse<SUMOReal>(myEndTextField->getText().text()));
216 
217  // Stop Modal
218  getApp()->stopModal(this, TRUE);
219  return 1;
220  }
221 }
222 
223 
224 long
225 GNERerouterIntervalDialog::onCmdCancel(FXObject*, FXSelector, void*) {
226  // Stop Modal
227  getApp()->stopModal(this, FALSE);
228  return 1;
229 }
230 
231 
232 long
233 GNERerouterIntervalDialog::onCmdReset(FXObject*, FXSelector, void*) {
234  // Copy original intervals again
239  // update tables
244  return 1;
245 }
246 
247 
248 long
250  // add new element and update table
254  return 1;
255 }
256 
257 
258 long
260  // add new element and update table
264  return 1;
265 }
266 
267 
268 long
270  // add new element and update table
273  onCmdEditDestProbReroute(0, 0, 0);
274  return 1;
275 }
276 
277 
278 long
280  // add new element and update table
283  onCmdEditRouteProbReroute(0, 0, 0);
284  return 1;
285 }
286 
287 
288 long
290  // check if some delete button was pressed
291  for (int i = 0; i < (int)myCopyOfClosingLaneReroutes.size(); i++) {
292  if (myClosingLaneRerouteList->getItem(i, 4)->hasFocus()) {
293  myClosingLaneRerouteList->removeRows(i);
296  return 1;
297  }
298  }
299  return 0;
300 }
301 
302 
303 long
305  // check if some delete button was pressed
306  for (int i = 0; i < (int)myCopyOfClosingReroutes.size(); i++) {
307  if (myClosingRerouteList->getItem(i, 4)->hasFocus()) {
308  myClosingRerouteList->removeRows(i);
311  return 1;
312  }
313  }
314  return 1;
315 }
316 
317 
318 long
320  // check if some delete button was pressed
321  for (int i = 0; i < (int)myCopyOfDestProbReroutes.size(); i++) {
322  if (myDestProbRerouteList->getItem(i, 3)->hasFocus()) {
323  myDestProbRerouteList->removeRows(i);
326  return 1;
327  }
328  }
329  return 0;
330 }
331 
332 
333 long
335  // check if some delete button was pressed
336  for (int i = 0; i < (int)myCopyOfRouteProbReroutes.size(); i++) {
337  if (myRouteProbRerouteList->getItem(i, 3)->hasFocus()) {
338  myRouteProbRerouteList->removeRows(i);
341  return 1;
342  }
343  }
344  return 0;
345 }
346 
347 
348 long
351  // iterate over table and check that all parameters are correct
352  for (int i = 0; i < myClosingLaneRerouteList->getNumRows(); i++) {
353  GNELane* lane = myRerouterInterval->getRerouterParent()->getViewNet()->getNet()->retrieveLane(myClosingLaneRerouteList->getItem(i, 0)->getText().text(), false);
354  if (lane == NULL) {
357  } else if (canParseVehicleClasses(myClosingLaneRerouteList->getItem(i, 1)->getText().text()) == false) {
360  } else if (canParseVehicleClasses(myClosingLaneRerouteList->getItem(i, 2)->getText().text()) == false) {
363  } else {
364  myCopyOfClosingLaneReroutes.at(i).setAllowedVehicles(parseVehicleClasses(myClosingLaneRerouteList->getItem(i, 1)->getText().text()));
365  myCopyOfClosingLaneReroutes.at(i).setDisallowedVehicles(parseVehicleClasses(myClosingLaneRerouteList->getItem(i, 2)->getText().text()));
366  myCopyOfClosingLaneReroutes.at(i).setClosedLane(lane);
368  }
369  }
370  // update list
371  myClosingLaneRerouteList->update();
372  return 1;
373 }
374 
375 
376 long
378  myClosingReroutesValid = true;
379  // iterate over table and check that all parameters are correct
380  for (int i = 0; i < myClosingRerouteList->getNumRows(); i++) {
381  GNEEdge* edge = myRerouterInterval->getRerouterParent()->getViewNet()->getNet()->retrieveEdge(myClosingRerouteList->getItem(i, 0)->getText().text(), false);
382  if (edge == NULL) {
383  myClosingReroutesValid = false;
384  myClosingRerouteList->getItem(i, 3)->setIcon(GUIIconSubSys::getIcon(ICON_ERROR));
385  } else if (canParseVehicleClasses(myClosingRerouteList->getItem(i, 1)->getText().text()) == false) {
386  myClosingReroutesValid = false;
387  myClosingRerouteList->getItem(i, 3)->setIcon(GUIIconSubSys::getIcon(ICON_ERROR));
388  } else if (canParseVehicleClasses(myClosingRerouteList->getItem(i, 2)->getText().text()) == false) {
389  myClosingReroutesValid = false;
390  myClosingRerouteList->getItem(i, 3)->setIcon(GUIIconSubSys::getIcon(ICON_ERROR));
391  } else {
392  myCopyOfClosingReroutes.at(i).setAllowedVehicles(parseVehicleClasses(myClosingRerouteList->getItem(i, 1)->getText().text()));
393  myCopyOfClosingReroutes.at(i).setDisallowedVehicles(parseVehicleClasses(myClosingRerouteList->getItem(i, 2)->getText().text()));
394  myCopyOfClosingReroutes.at(i).setClosedEdge(edge);
395  myClosingRerouteList->getItem(i, 3)->setIcon(GUIIconSubSys::getIcon(ICON_CORRECT));
396  }
397  }
398  // update list
399  myClosingRerouteList->update();
400  return 1;
401 }
402 
403 
404 long
407  // iterate over table and check that all parameters are correct
408  for (int i = 0; i < myDestProbRerouteList->getNumRows(); i++) {
409  GNEEdge* edge = myRerouterInterval->getRerouterParent()->getViewNet()->getNet()->retrieveEdge(myDestProbRerouteList->getItem(i, 0)->getText().text(), false);
410  SUMOReal probability = -1;
411  // try to parse probability
412  if (GNEAttributeCarrier::canParse<SUMOReal>(myDestProbRerouteList->getItem(i, 1)->getText().text())) {
413  probability = GNEAttributeCarrier::parse<SUMOReal>(myDestProbRerouteList->getItem(i, 1)->getText().text());
414  }
415  // check if values are valid
416  if (edge == NULL) {
417  myDestProbReroutesValid = false;
418  myDestProbRerouteList->getItem(i, 2)->setIcon(GUIIconSubSys::getIcon(ICON_ERROR));
419  } else if ((probability < 0) || (probability > 1)) {
420  myDestProbReroutesValid = false;
421  myDestProbRerouteList->getItem(i, 2)->setIcon(GUIIconSubSys::getIcon(ICON_ERROR));
422  } else {
423  myCopyOfDestProbReroutes.at(i).setNewDestination(edge);
424  myCopyOfDestProbReroutes.at(i).setProbability(probability);
426  myDestProbRerouteList->update();
427  }
428  }
429  // update list
430  myDestProbRerouteList->update();
431  return 1;
432 }
433 
434 
435 long
438  // iterate over table and check that all parameters are correct
439  for (int i = 0; i < myRouteProbRerouteList->getNumRows(); i++) {
440  SUMOReal probability = -1;
441  std::string route = myRouteProbRerouteList->getItem(i, 0)->getText().text();
442  // try to parse probability
443  if (GNEAttributeCarrier::canParse<SUMOReal>(myRouteProbRerouteList->getItem(i, 1)->getText().text())) {
444  probability = GNEAttributeCarrier::parse<SUMOReal>(myRouteProbRerouteList->getItem(i, 1)->getText().text());
445  }
446  // check if values are valid
447  if (route.empty()) {
448  myRouteProbReroutesValid = false;
449  myRouteProbRerouteList->getItem(i, 2)->setIcon(GUIIconSubSys::getIcon(ICON_ERROR));
450  } else if ((probability < 0) || (probability > 1)) {
451  myRouteProbReroutesValid = false;
452  myRouteProbRerouteList->getItem(i, 2)->setIcon(GUIIconSubSys::getIcon(ICON_ERROR));
453  } else {
454  myCopyOfRouteProbReroutes.at(i).setNewRouteId(myRouteProbRerouteList->getItem(i, 0)->getText().text());
455  myCopyOfRouteProbReroutes.at(i).setProbability(probability);
457  myRouteProbRerouteList->update();
458  }
459  }
460  // update list
461  myRouteProbRerouteList->update();
462  return 1;
463 }
464 
465 
466 long
467 GNERerouterIntervalDialog::onCmdChangeBegin(FXObject*, FXSelector, void*) {
468  if (GNEAttributeCarrier::canParse<SUMOReal>(myBeginTextField->getText().text()) &&
469  myRerouterDialogParent->checkInterval(GNEAttributeCarrier::parse<SUMOReal>(myBeginTextField->getText().text()), myRerouterInterval->getEnd())) {
470  myBeginEndValid = true;
472  return 1;
473  } else {
474  myBeginEndValid = false;
476  return 0;
477  }
478 }
479 
480 
481 long
482 GNERerouterIntervalDialog::onCmdChangeEnd(FXObject*, FXSelector, void*) {
483  if (GNEAttributeCarrier::canParse<SUMOReal>(myEndTextField->getText().text()) &&
484  myRerouterDialogParent->checkInterval(myRerouterInterval->getBegin(), GNEAttributeCarrier::parse<SUMOReal>(myEndTextField->getText().text()))) {
485  myBeginEndValid = true;
487  return 1;
488  } else {
489  myBeginEndValid = false;
491  return 0;
492  }
493 }
494 
495 
496 void
498  // clear table
499  myClosingLaneRerouteList->clearItems();
500  // set number of rows
501  myClosingLaneRerouteList->setTableSize(int(myCopyOfClosingLaneReroutes.size()), 5);
502  // Configure list
503  myClosingLaneRerouteList->setVisibleColumns(5);
504  myClosingLaneRerouteList->setColumnWidth(0, 83);
505  myClosingLaneRerouteList->setColumnWidth(1, 83);
506  myClosingLaneRerouteList->setColumnWidth(2, 82);
509  myClosingLaneRerouteList->setColumnText(0, toString(SUMO_ATTR_LANE).c_str());
510  myClosingLaneRerouteList->setColumnText(1, toString(SUMO_ATTR_ALLOW).c_str());
511  myClosingLaneRerouteList->setColumnText(2, toString(SUMO_ATTR_DISALLOW).c_str());
512  myClosingLaneRerouteList->setColumnText(3, "");
513  myClosingLaneRerouteList->setColumnText(4, "");
514  myClosingLaneRerouteList->getRowHeader()->setWidth(0);
515  // Declare index for rows and pointer to FXTableItem
516  int indexRow = 0;
517  FXTableItem* item = 0;
518  // iterate over values
519  for (std::vector<GNEClosingLaneReroute>::iterator i = myCopyOfClosingLaneReroutes.begin(); i != myCopyOfClosingLaneReroutes.end(); i++) {
520  // Set closing edge
521  if (i->getClosedLane() != NULL) {
522  item = new FXTableItem(i->getClosedLane()->getID().c_str());
523  myClosingLaneRerouteList->setItem(indexRow, 0, item);
524  } else {
525  item = new FXTableItem("");
526  myClosingLaneRerouteList->setItem(indexRow, 0, item);
527  }
528  // set allow vehicles
529  item = new FXTableItem(getVehicleClassNames(i->getAllowedVehicles()).c_str());
530  myClosingLaneRerouteList->setItem(indexRow, 1, item);
531  // set disallow vehicles
532  item = new FXTableItem(getVehicleClassNames(i->getDisallowedVehicles()).c_str());
533  myClosingLaneRerouteList->setItem(indexRow, 2, item);
534  // set valid icon
535  item = new FXTableItem("");
537  item->setIcon(GUIIconSubSys::getIcon(ICON_CORRECT));
538  } else {
539  item->setIcon(GUIIconSubSys::getIcon(ICON_ERROR));
540  }
541  item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y);
542  item->setEnabled(false);
543  myClosingLaneRerouteList->setItem(indexRow, 3, item);
544  // set remove
545  item = new FXTableItem("", GUIIconSubSys::getIcon(ICON_REMOVE));
546  item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y);
547  item->setEnabled(false);
548  myClosingLaneRerouteList->setItem(indexRow, 4, item);
549  // Update index
550  indexRow++;
551  }
552 }
553 
554 
555 void
557  // clear table
558  myClosingRerouteList->clearItems();
559  // set number of rows
560  myClosingRerouteList->setTableSize(int(myCopyOfClosingReroutes.size()), 5);
561  // Configure list
562  myClosingRerouteList->setVisibleColumns(5);
563  myClosingRerouteList->setColumnWidth(0, 83);
564  myClosingRerouteList->setColumnWidth(1, 83);
565  myClosingRerouteList->setColumnWidth(2, 82);
568  myClosingRerouteList->setColumnText(0, toString(SUMO_ATTR_EDGE).c_str());
569  myClosingRerouteList->setColumnText(1, toString(SUMO_ATTR_ALLOW).c_str());
570  myClosingRerouteList->setColumnText(2, toString(SUMO_ATTR_DISALLOW).c_str());
571  myClosingRerouteList->setColumnText(3, "");
572  myClosingRerouteList->setColumnText(4, "");
573  myClosingRerouteList->getRowHeader()->setWidth(0);
574  // Declare index for rows and pointer to FXTableItem
575  int indexRow = 0;
576  FXTableItem* item = 0;
577  // iterate over values
578  for (std::vector<GNEClosingReroute>::iterator i = myCopyOfClosingReroutes.begin(); i != myCopyOfClosingReroutes.end(); i++) {
579  // Set closing edge
580  if (i->getClosedEdge() != NULL) {
581  item = new FXTableItem(i->getClosedEdge()->getID().c_str());
582  myClosingRerouteList->setItem(indexRow, 0, item);
583  } else {
584  item = new FXTableItem("");
585  myClosingRerouteList->setItem(indexRow, 0, item);
586  }
587  // set allow vehicles
588  item = new FXTableItem(getVehicleClassNames(i->getAllowedVehicles()).c_str());
589  myClosingRerouteList->setItem(indexRow, 1, item);
590  // set disallow vehicles
591  item = new FXTableItem(getVehicleClassNames(i->getDisallowedVehicles()).c_str());
592  myClosingRerouteList->setItem(indexRow, 2, item);
593  // set valid
594  item = new FXTableItem("");
596  item->setIcon(GUIIconSubSys::getIcon(ICON_CORRECT));
597  } else {
598  item->setIcon(GUIIconSubSys::getIcon(ICON_ERROR));
599  }
600  item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y);
601  item->setEnabled(false);
602  myClosingRerouteList->setItem(indexRow, 3, item);
603  // set remove
604  item = new FXTableItem("", GUIIconSubSys::getIcon(ICON_REMOVE));
605  item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y);
606  item->setEnabled(false);
607  myClosingRerouteList->setItem(indexRow, 4, item);
608  // Update index
609  indexRow++;
610  }
611 }
612 
613 
614 void
616  // clear table
617  myDestProbRerouteList->clearItems();
618  // set number of rows
619  myDestProbRerouteList->setTableSize(int(myCopyOfDestProbReroutes.size()), 4);
620  // Configure list
621  myDestProbRerouteList->setVisibleColumns(4);
622  myDestProbRerouteList->setColumnWidth(0, 124);
623  myDestProbRerouteList->setColumnWidth(1, 124);
626  myDestProbRerouteList->setColumnText(0, toString(SUMO_ATTR_EDGE).c_str());
627  myDestProbRerouteList->setColumnText(1, toString(SUMO_ATTR_PROB).c_str());
628  myDestProbRerouteList->setColumnText(2, "");
629  myDestProbRerouteList->setColumnText(3, "");
630  myDestProbRerouteList->getRowHeader()->setWidth(0);
631  // Declare index for rows and pointer to FXTableItem
632  int indexRow = 0;
633  FXTableItem* item = 0;
634  // iterate over values
635  for (std::vector<GNEDestProbReroute>::iterator i = myCopyOfDestProbReroutes.begin(); i != myCopyOfDestProbReroutes.end(); i++) {
636  // Set new destination
637  if (i->getNewDestination() != NULL) {
638  item = new FXTableItem(i->getNewDestination()->getID().c_str());
639  myDestProbRerouteList->setItem(indexRow, 0, item);
640  } else {
641  item = new FXTableItem("");
642  myDestProbRerouteList->setItem(indexRow, 0, item);
643  }
644  // Set probability
645  item = new FXTableItem(toString(i->getProbability()).c_str());
646  myDestProbRerouteList->setItem(indexRow, 1, item);
647  // set valid
648  item = new FXTableItem("");
650  item->setIcon(GUIIconSubSys::getIcon(ICON_CORRECT));
651  } else {
652  item->setIcon(GUIIconSubSys::getIcon(ICON_ERROR));
653  }
654  item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y);
655  item->setEnabled(false);
656  myDestProbRerouteList->setItem(indexRow, 2, item);
657  // set remove
658  item = new FXTableItem("", GUIIconSubSys::getIcon(ICON_REMOVE));
659  item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y);
660  item->setEnabled(false);
661  myDestProbRerouteList->setItem(indexRow, 3, item);
662  // Update index
663  indexRow++;
664  }
665 }
666 
667 
668 void
670  // clear table
671  myRouteProbRerouteList->clearItems();
672  // set number of rows
673  myRouteProbRerouteList->setTableSize(int(myCopyOfRouteProbReroutes.size()), 4);
674  // Configure list
675  myRouteProbRerouteList->setVisibleColumns(4);
676  myRouteProbRerouteList->setColumnWidth(0, 124);
677  myRouteProbRerouteList->setColumnWidth(1, 124);
680  myRouteProbRerouteList->setColumnText(0, toString(SUMO_ATTR_ROUTE).c_str());
681  myRouteProbRerouteList->setColumnText(1, toString(SUMO_ATTR_PROB).c_str());
682  myRouteProbRerouteList->setColumnText(2, "");
683  myRouteProbRerouteList->setColumnText(3, "");
684  myRouteProbRerouteList->getRowHeader()->setWidth(0);
685  // Declare index for rows and pointer to FXTableItem
686  int indexRow = 0;
687  FXTableItem* item = 0;
688  // iterate over values
689  for (std::vector<GNERouteProbReroute>::iterator i = myCopyOfRouteProbReroutes.begin(); i != myCopyOfRouteProbReroutes.end(); i++) {
690  // Set new route
691  item = new FXTableItem(i->getNewRouteId().c_str());
692  myRouteProbRerouteList->setItem(indexRow, 0, item);
693  // Set probability
694  item = new FXTableItem(toString(i->getProbability()).c_str());
695  myRouteProbRerouteList->setItem(indexRow, 1, item);
696  // set valid
697  item = new FXTableItem("");
699  item->setIcon(GUIIconSubSys::getIcon(ICON_CORRECT));
700  } else {
701  item->setIcon(GUIIconSubSys::getIcon(ICON_ERROR));
702  }
703  item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y);
704  item->setEnabled(false);
705  myRouteProbRerouteList->setItem(indexRow, 2, item);
706  // set remove
707  item = new FXTableItem("", GUIIconSubSys::getIcon(ICON_REMOVE));
708  item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y);
709  item->setEnabled(false);
710  myRouteProbRerouteList->setItem(indexRow, 3, item);
711  // Update index
712  indexRow++;
713  }
714 }
715 
716 
717 /****************************************************************************/
#define GUIDesignTableIconCellWidth
width of cells that only contains an Icon
Definition: GUIDesigns.h:426
void updateDestProbReroutesTable()
update data of destiny probabilitry reroute table
GNERerouter * getRerouterParent() const
get rerouter parent
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Definition: GNENet.cpp:732
FXTable * myRouteProbRerouteList
list with route probability reroute
long onCmdEditDestProbReroute(FXObject *, FXSelector, void *)
/edit dest prob reroute
Dialog for edit rerouter intervals.
#define GUIDesignLabelOnlyIcon
label ticked filled only with an icon
Definition: GUIDesigns.h:163
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
void setEnd(SUMOReal end)
set end time
FXTable * myClosingRerouteList
list with closing reroutes
bool myClosingReroutesValid
flag to check if closing reroutes are valid
bool checkInterval(SUMOReal begin, SUMOReal end) const
check begin and end of an new interval
Dialog to edit sequences, parameters, etc.. of Additionals.
void updateRouteProbReroutesTable()
update data of probabilitry reroutes table
std::vector< GNEClosingLaneReroute > myCopyOfClosingLaneReroutes
vector with the closingLaneReroutes
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 setBegin(SUMOReal begin)
set begin time
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
bool myClosingLaneReroutesValid
flag to check if closing lane reroutes are valid
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
long onCmdAddRouteProbReroute(FXObject *, FXSelector, void *)
add route prob reroute
SUMOReal getEnd() const
get end time
Dialog for edit rerouters.
#define GUIDesignAuxiliarFrame
design for auxiliar (Without borders) frames used to pack another frames extended in all directions ...
Definition: GUIDesigns.h:223
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:55
#define GUIDesignUniformHorizontalFrame
design for horizontal frame used to pack another frames with a uniform width
Definition: GUIDesigns.h:232
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:226
GNELane * retrieveLane(const std::string &id, bool failHard=true)
get lane by id
Definition: GNENet.cpp:774
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
long onCmdChangeBegin(FXObject *, FXSelector, void *)
called when begin is changed
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:423
SUMOReal getBegin() const
get begin time
std::string getVehicleClassNames(SVCPermissions permissions)
Returns the ids of the given classes, divided using a &#39; &#39;.
long onCmdClickedClosingLaneReroute(FXObject *, FXSelector, void *)
remove closing lane reroute
#define GUIDesignButtonIcon
button only with icon with the same size as a Label
Definition: GUIDesigns.h:78
long onCmdChangeEnd(FXObject *, FXSelector, void *)
called when begin is changed
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
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:54
FXTable * myClosingLaneRerouteList
list with closing lane reroutes
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition: GUIDesigns.h:59
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 over frame with thick and with text justify to left
Definition: GUIDesigns.h:148
GNENet * getNet() const
get the net object
Definition: GNEViewNet.cpp:989
#define GUIDesignTextFieldReal
text field extended over Frame with thick frame and limited to Doubles/SUMOReals
Definition: GUIDesigns.h:47
SumoXMLTag getTag() const
get XML Tag assigned to this object
#define SUMOReal
Definition: config.h:208
long onCmdCancel(FXObject *, FXSelector, void *)
event after press cancel button
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
#define GUIDesignLabelLeftThick
label extended over over frame with thick and with text justify to left
Definition: GUIDesigns.h:151
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