SUMO - Simulation of Urban MObility
GNECalibratorFlowDialog.cpp
Go to the documentation of this file.
1 /****************************************************************************/
7 // Dialog for edit calibrator flows
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 "GNECalibratorDialog.h"
38 #include "GNECalibrator.h"
39 #include "GNEEdge.h"
40 #include "GNELane.h"
41 #include "GNEViewNet.h"
42 #include "GNENet.h"
43 
44 
45 // ===========================================================================
46 // FOX callback mapping
47 // ===========================================================================
48 
49 FXDEFMAP(GNECalibratorFlowDialog) GNECalibratorFlowDialogMap[] = {
55 };
56 
57 // Object implementation
58 FXIMPLEMENT(GNECalibratorFlowDialog, FXDialogBox, GNECalibratorFlowDialogMap, ARRAYNUMBER(GNECalibratorFlowDialogMap))
59 
60 // ===========================================================================
61 // member method definitions
62 // ===========================================================================
63 
64 GNECalibratorFlowDialog::GNECalibratorFlowDialog(GNECalibratorDialog* calibratorDialog, GNECalibratorFlow& calibratorFlow, bool updatingElement) :
65  GNEAdditionalDialog(calibratorFlow.getCalibratorParent(), 600, 300),
66  myCalibratorDialogParent(calibratorDialog),
67  myCalibratorFlow(&calibratorFlow),
68  myUpdatingElement(updatingElement),
69  myCalibratorFlowValid(true) {
70  // change default header
71  changeAdditionalDialogHeader("Edit " + toString(calibratorFlow.getTag()) + " of " + toString(calibratorFlow.getCalibratorParent()->getTag()) +
72  " '" + calibratorFlow.getCalibratorParent()->getID() + "'");
73  // Create auxiliar frames for tables
74  FXHorizontalFrame* columns = new FXHorizontalFrame(myContentFrame, GUIDesignUniformHorizontalFrame);
75  FXVerticalFrame* columnLeftLabel = new FXVerticalFrame(columns, GUIDesignAuxiliarFrame);
76  FXVerticalFrame* columnLeftValue = new FXVerticalFrame(columns, GUIDesignAuxiliarFrame);
77  FXVerticalFrame* columnRightLabel = new FXVerticalFrame(columns, GUIDesignAuxiliarFrame);
78  FXVerticalFrame* columnRightValue = new FXVerticalFrame(columns, GUIDesignAuxiliarFrame);
79 
80  // 1 create textfield for flowID
81  new FXLabel(columnLeftLabel, toString(SUMO_ATTR_ID).c_str(), 0, GUIDesignLabelThick);
82  myTextFieldFlowID = new FXTextField(columnLeftValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextField);
83  // 2 create combobox for type
84  new FXLabel(columnLeftLabel, toString(SUMO_TAG_VTYPE).c_str(), 0, GUIDesignLabelThick);
85  myComboBoxVehicleType = new FXComboBox(columnLeftValue, GUIDesignComboBoxNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignComboBox);
86  // 3 create combobox for route
87  new FXLabel(columnLeftLabel, toString(SUMO_ATTR_ROUTE).c_str(), 0, GUIDesignLabelThick);
88  myComboBoxRoute = new FXComboBox(columnLeftValue, GUIDesignComboBoxNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignComboBox);
89  // 4 create textfield for color
90  new FXLabel(columnLeftLabel, toString(SUMO_ATTR_COLOR).c_str(), 0, GUIDesignLabelThick);
91  myTextFieldColor = new FXTextField(columnLeftValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextField);
92  // 5 create textfield for lane
93  new FXLabel(columnLeftLabel, toString(SUMO_ATTR_DEPARTLANE).c_str(), 0, GUIDesignLabelThick);
94  myTextFieldDepartLane = new FXTextField(columnLeftValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextField);
95  // 6 create textfield for pos
96  new FXLabel(columnLeftLabel, toString(SUMO_ATTR_DEPARTPOS).c_str(), 0, GUIDesignLabelThick);
97  myTextFieldDepartPos = new FXTextField(columnLeftValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextField);
98  // 7 create textfield for speed
99  new FXLabel(columnLeftLabel, toString(SUMO_ATTR_DEPARTSPEED).c_str(), 0, GUIDesignLabelThick);
100  myTextFieldDepartSpeed = new FXTextField(columnLeftValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextField);
101  // 8 create textfield for lane
102  new FXLabel(columnLeftLabel, toString(SUMO_ATTR_ARRIVALLANE).c_str(), 0, GUIDesignLabelThick);
103  myTextFieldArrivalLane = new FXTextField(columnLeftValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextField);
104  // 9 create textfield for arrival pos
105  new FXLabel(columnLeftLabel, toString(SUMO_ATTR_ARRIVALPOS).c_str(), 0, GUIDesignLabelThick);
106  myTextFieldArrivalPos = new FXTextField(columnLeftValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextField);
107  // 10 create textfield for arrival speed
108  new FXLabel(columnLeftLabel, toString(SUMO_ATTR_ARRIVALSPEED).c_str(), 0, GUIDesignLabelThick);
109  myTextFieldArrivalSpeed = new FXTextField(columnLeftValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextField);
110  // 11 create textfield for arrival line
111  new FXLabel(columnLeftLabel, toString(SUMO_ATTR_LINE).c_str(), 0, GUIDesignLabelThick);
112  myTextFieldLine = new FXTextField(columnLeftValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextField);
113  // 1 create textfield for person number
114  new FXLabel(columnRightLabel, toString(SUMO_ATTR_PERSON_NUMBER).c_str(), 0, GUIDesignLabelThick);
115  myTextFieldPersonNumber = new FXTextField(columnRightValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldInt);
116  // 2 create textfield for container number
117  new FXLabel(columnRightLabel, toString(SUMO_ATTR_CONTAINER_NUMBER).c_str(), 0, GUIDesignLabelThick);
118  myTextFieldContainerNumber = new FXTextField(columnRightValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldInt);
119  // 3 create textfield for reroute
120  new FXLabel(columnRightLabel, toString(SUMO_ATTR_REROUTE).c_str(), 0, GUIDesignLabelThick);
121  myRerouteCheckButton = new FXCheckButton(columnRightValue, "false", this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignCheckButtonAttribute);
122  // 4 create textfield for depart pos lat
123  new FXLabel(columnRightLabel, toString(SUMO_ATTR_DEPARTPOS_LAT).c_str(), 0, GUIDesignLabelThick);
124  myTextFieldDepartPosLat = new FXTextField(columnRightValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextField);
125  // 5 create textfield for arrival pos lat
126  new FXLabel(columnRightLabel, toString(SUMO_ATTR_ARRIVALPOS_LAT).c_str(), 0, GUIDesignLabelThick);
127  myTextFieldArrivalPosLat = new FXTextField(columnRightValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextField);
128  // 6 create textfield for begin
129  new FXLabel(columnRightLabel, toString(SUMO_ATTR_BEGIN).c_str(), 0, GUIDesignLabelThick);
130  myTextFieldBegin = new FXTextField(columnRightValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldReal);
131  // 7 create textfield for end
132  new FXLabel(columnRightLabel, toString(SUMO_ATTR_END).c_str(), 0, GUIDesignLabelThick);
133  myTextFieldEnd = new FXTextField(columnRightValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldReal);
134  // 8 create textfield for vehicle number
135  new FXLabel(columnRightLabel, toString(SUMO_ATTR_NUMBER).c_str(), 0, GUIDesignLabelThick);
136  myTextFieldNumber = new FXTextField(columnRightValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldInt);
137  // 9 create textfield for vehs per hour
138  myRadioButtonVehsPerHour = new FXRadioButton(columnRightLabel, toString(SUMO_ATTR_VEHSPERHOUR).c_str(), this, MID_GNE_CALIBRATORDIALOG_SET_FLOWTYPE, GUIDesignRadioButtonAttribute);
139  myTextFieldVehsPerHour = new FXTextField(columnRightValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldReal);
140  // 10 create textfield for period
141  myRadioButtonPeriod = new FXRadioButton(columnRightLabel, toString(SUMO_ATTR_PERIOD).c_str(), this, MID_GNE_CALIBRATORDIALOG_SET_FLOWTYPE, GUIDesignRadioButtonAttribute);
142  myTextFieldPeriod = new FXTextField(columnRightValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldReal);
143  // 11 create textfield for probability
144  myRadioButtonProbability = new FXRadioButton(columnRightLabel, toString(SUMO_ATTR_PROB).c_str(), this, MID_GNE_CALIBRATORDIALOG_SET_FLOWTYPE, GUIDesignRadioButtonAttribute);
145  myTextFieldProbability = new FXTextField(columnRightValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldReal);
146 
147  // fill comboBox of VTypes
148  const std::vector<GNECalibratorVehicleType>& vtypes = myCalibratorFlow->getCalibratorParent()->getCalibratorVehicleTypes();
149  for (std::vector<GNECalibratorVehicleType>::const_iterator i = vtypes.begin(); i != vtypes.end(); i++) {
150  myComboBoxVehicleType->appendItem(i->getVehicleTypeID().c_str());
151  }
152  myComboBoxVehicleType->setNumVisible(10);
153 
154  // fill comboBox of Routes
155  const std::vector<GNECalibratorRoute>& routes = myCalibratorFlow->getCalibratorParent()->getCalibratorRoutes();
156  for (std::vector<GNECalibratorRoute>::const_iterator i = routes.begin(); i != routes.end(); i++) {
157  myComboBoxRoute->appendItem(i->getRouteID().c_str());
158  }
159  myComboBoxRoute->setNumVisible(10);
160 
161  // create copy of GNECalibratorFlow
162  myCopyOfCalibratorFlow = new GNECalibratorFlow(myCalibratorFlow->getCalibratorParent());
163 
164  // copy all values of myCalibratorFlow into myCopyOfCalibratorFlow to set initial values
165  (*myCopyOfCalibratorFlow) = (*myCalibratorFlow);
166 
167  // update tables
168  updateCalibratorFlowValues();
169 }
170 
171 
173  // delete copy
174  delete myCopyOfCalibratorFlow;
175 }
176 
177 
178 long
179 GNECalibratorFlowDialog::onCmdAccept(FXObject*, FXSelector, void*) {
180  if (myCalibratorFlowValid == false) {
181  // write warning if netedit is running in testing mode
182  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
183  WRITE_WARNING("Opening FXMessageBox of type 'warning'");
184  }
185  // open warning dialog box
186  FXMessageBox::warning(getApp(), MBOX_OK,
187  ("Error " + std::string(myUpdatingElement ? ("updating") : ("creating")) + " " + toString(myCalibratorFlow->getCalibratorParent()->getTag()) +
188  "'s " + toString(myCalibratorFlow->getTag())).c_str(), "%s",
190  " cannot be " + std::string(myUpdatingElement ? ("updated") : ("created")) + " because parameter " + toString(myInvalidAttr) +
191  " is invalid.").c_str());
192  // write warning if netedit is running in testing mode
193  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
194  WRITE_WARNING("Closed FXMessageBox of type 'warning' with 'OK'");
195  }
196  return 0;
197  } else {
198  // copy all values of myCopyOfCalibratorFlow into myCalibratorFlow
199  (*myCalibratorFlow) = (*myCopyOfCalibratorFlow);
200  getApp()->stopModal(this, TRUE);
201  return 1;
202  }
203 }
204 
205 
206 long
207 GNECalibratorFlowDialog::onCmdCancel(FXObject*, FXSelector, void*) {
208  // Stop Modal
209  getApp()->stopModal(this, FALSE);
210  return 1;
211 }
212 
213 
214 long
215 GNECalibratorFlowDialog::onCmdReset(FXObject*, FXSelector, void*) {
216  // copy all values of myCalibratorFlow into myCopyOfCalibratorFlow to set initial values
217  (*myCopyOfCalibratorFlow) = (*myCalibratorFlow);
218  // update fields
220  return 1;
221 }
222 
223 
224 long
225 GNECalibratorFlowDialog::onCmdSetVariable(FXObject*, FXSelector, void*) {
226  // At start we assumed, that all values are valid
227  myCalibratorFlowValid = true;
229  // set color of myTextFieldFlowID, depending if current value is valid or not
230  if (myCopyOfCalibratorFlow->getFlowID() == myTextFieldFlowID->getText().text()) {
231  myTextFieldFlowID->setTextColor(FXRGB(0, 0, 0));
232  } else if (myCopyOfCalibratorFlow->setFlowID(myTextFieldFlowID->getText().text())) {
233  myTextFieldFlowID->setTextColor(FXRGB(0, 0, 0));
234  } else {
235  myTextFieldFlowID->setTextColor(FXRGB(255, 0, 0));
236  myCalibratorFlowValid = false;
238  }
239  // set color of myComboBoxVehicleType, depending if current value is valid or not
241  myComboBoxVehicleType->setTextColor(FXRGB(0, 0, 0));
242  } else {
243  myComboBoxVehicleType->setTextColor(FXRGB(255, 0, 0));
244  myCalibratorFlowValid = false;
246  }
247  // set color of myComboBoxRoute, depending if current value is valid or not
248  if (myCopyOfCalibratorFlow->setRoute(myComboBoxRoute->getText().text())) {
249  myComboBoxRoute->setTextColor(FXRGB(0, 0, 0));
250  } else {
251  myComboBoxRoute->setTextColor(FXRGB(255, 0, 0));
252  myCalibratorFlowValid = false;
254  }
255  // set color of myTextFieldColor, depending if current value is valid or not
256  if (myCopyOfCalibratorFlow->setColor(myTextFieldColor->getText().text())) {
257  myTextFieldColor->setTextColor(FXRGB(0, 0, 0));
258  } else {
259  myTextFieldColor->setTextColor(FXRGB(255, 0, 0));
260  myCalibratorFlowValid = false;
262  }
263  // set color of myTextFieldDepartLane, depending if current value is valid or not
265  myTextFieldDepartLane->setTextColor(FXRGB(0, 0, 0));
266  } else {
267  myTextFieldDepartLane->setTextColor(FXRGB(255, 0, 0));
268  myCalibratorFlowValid = false;
270  }
271  // set color of myTextFieldDepartPos, depending if current value is valid or not
272  if (myCopyOfCalibratorFlow->setDepartPos(myTextFieldDepartPos->getText().text())) {
273  myTextFieldDepartPos->setTextColor(FXRGB(0, 0, 0));
274  } else {
275  myTextFieldDepartPos->setTextColor(FXRGB(255, 0, 0));
276  myCalibratorFlowValid = false;
278  }
279  // set color of setDepartSpeed, depending if current value is valid or not
281  myTextFieldDepartSpeed->setTextColor(FXRGB(0, 0, 0));
282  } else {
283  myTextFieldDepartSpeed->setTextColor(FXRGB(255, 0, 0));
284  myCalibratorFlowValid = false;
286  }
287  // set color of myTextFieldArrivalLane, depending if current value is valid or not
289  myTextFieldArrivalLane->setTextColor(FXRGB(0, 0, 0));
290  } else {
291  myTextFieldArrivalLane->setTextColor(FXRGB(255, 0, 0));
292  myCalibratorFlowValid = false;
294  }
295  // set color of myTextFieldArrivalPos, depending if current value is valid or not
297  myTextFieldArrivalPos->setTextColor(FXRGB(0, 0, 0));
298  } else {
299  myTextFieldArrivalPos->setTextColor(FXRGB(255, 0, 0));
300  myCalibratorFlowValid = false;
302  }
303  // set color of setArrivalSpeed, depending if current value is valid or not
305  myTextFieldArrivalSpeed->setTextColor(FXRGB(0, 0, 0));
306  } else {
307  myTextFieldArrivalSpeed->setTextColor(FXRGB(255, 0, 0));
308  myCalibratorFlowValid = false;
310  }
311  // set color of myTextFieldLine, depending if current value is valid or not
312  if (myCopyOfCalibratorFlow->setLine(myTextFieldLine->getText().text())) {
313  myTextFieldLine->setTextColor(FXRGB(0, 0, 0));
314  } else {
315  myTextFieldLine->setTextColor(FXRGB(255, 0, 0));
316  myCalibratorFlowValid = false;
318  }
319  // set color of myTextFieldPersonNumber, depending if current value is valid or not
321  myTextFieldPersonNumber->setTextColor(FXRGB(0, 0, 0));
322  } else {
323  myTextFieldPersonNumber->setTextColor(FXRGB(255, 0, 0));
324  myCalibratorFlowValid = false;
326  }
327  // set color of myTextFieldContainerNumber, depending if current value is valid or not
329  myTextFieldContainerNumber->setTextColor(FXRGB(0, 0, 0));
330  } else {
331  myTextFieldContainerNumber->setTextColor(FXRGB(255, 0, 0));
332  myCalibratorFlowValid = false;
334  }
335  // set reroute
336  if (myRerouteCheckButton->getCheck()) {
338  myRerouteCheckButton->setText("true");
339  } else {
341  myRerouteCheckButton->setText("false");
342  }
343  // set color of myTextFieldDepartPosLat, depending if current value is valid or not
345  myTextFieldDepartPosLat->setTextColor(FXRGB(0, 0, 0));
346  } else {
347  myTextFieldDepartPosLat->setTextColor(FXRGB(255, 0, 0));
348  myCalibratorFlowValid = false;
350  }
351  // set color of myTextFieldArrivalPosLat, depending if current value is valid or not
353  myTextFieldArrivalPosLat->setTextColor(FXRGB(0, 0, 0));
354  } else {
355  myTextFieldArrivalPosLat->setTextColor(FXRGB(255, 0, 0));
356  myCalibratorFlowValid = false;
358  }
359  // set color of myTextFieldBegin, depending if current value is valid or not
360  if (myCopyOfCalibratorFlow->setBegin(myTextFieldBegin->getText().text())) {
361  myTextFieldBegin->setTextColor(FXRGB(0, 0, 0));
362  } else {
363  myTextFieldBegin->setTextColor(FXRGB(255, 0, 0));
364  myCalibratorFlowValid = false;
366  }
367  // set color of myTextFieldEnd, depending if current value is valid or not
368  if (myCopyOfCalibratorFlow->setEnd(myTextFieldEnd->getText().text())) {
369  myTextFieldEnd->setTextColor(FXRGB(0, 0, 0));
370  } else {
371  myTextFieldEnd->setTextColor(FXRGB(255, 0, 0));
372  myCalibratorFlowValid = false;
374  }
375  // set color of myTextFieldNumber, depending if current value is valid or not
376  if (myCopyOfCalibratorFlow->setNumber(myTextFieldNumber->getText().text())) {
377  myTextFieldNumber->setTextColor(FXRGB(0, 0, 0));
378  } else {
379  myTextFieldNumber->setTextColor(FXRGB(255, 0, 0));
380  myCalibratorFlowValid = false;
382  }
383  // set color of myTextFieldVehsPerHour, depending if current value is valid or not
385  myTextFieldVehsPerHour->setTextColor(FXRGB(0, 0, 0));
386  } else if (myRadioButtonVehsPerHour->getCheck()) {
387  myTextFieldVehsPerHour->setTextColor(FXRGB(255, 0, 0));
388  myCalibratorFlowValid = false;
390  } else {
391  // if radio button is disabled, set default color
392  myTextFieldVehsPerHour->setTextColor(FXRGB(0, 0, 0));
393  }
394  // set color of myTextFieldPeriod, depending if current value is valid or not
395  if (myCopyOfCalibratorFlow->setPeriod(myTextFieldPeriod->getText().text())) {
396  myTextFieldPeriod->setTextColor(FXRGB(0, 0, 0));
397  } else if (myRadioButtonPeriod->getCheck()) {
398  myTextFieldPeriod->setTextColor(FXRGB(255, 0, 0));
399  myCalibratorFlowValid = false;
401  } else {
402  // if radio button is disabled, set default color
403  myTextFieldPeriod->setTextColor(FXRGB(0, 0, 0));
404  }
405  // set color of myTextFieldProbability, depending if current value is valid or not
407  myTextFieldProbability->setTextColor(FXRGB(0, 0, 0));
408  } else if (myRadioButtonProbability->getCheck()) {
409  myTextFieldProbability->setTextColor(FXRGB(255, 0, 0));
410  myCalibratorFlowValid = false;
412  } else {
413  // if radio button is disabled, set default color
414  myTextFieldProbability->setTextColor(FXRGB(0, 0, 0));
415  }
416  return 1;
417 }
418 
419 
420 long
421 GNECalibratorFlowDialog::onCmdSetTypeOfFlow(FXObject* radioButton, FXSelector, void*) {
422  if (radioButton == myRadioButtonVehsPerHour) {
423  myRadioButtonVehsPerHour->setCheck(true);
424  myTextFieldVehsPerHour->enable();
426  // disable other options
427  myRadioButtonPeriod->setCheck(false);
428  myTextFieldPeriod->disable();
429  myRadioButtonProbability->setCheck(false);
430  myTextFieldProbability->disable();
431  onCmdSetVariable(0, 0, 0);
432  return 1;
433  } else if (radioButton == myRadioButtonPeriod) {
434  myRadioButtonPeriod->setCheck(true);
435  myTextFieldPeriod->enable();
437  // disable other options
438  myRadioButtonVehsPerHour->setCheck(false);
439  myTextFieldVehsPerHour->disable();
440  myRadioButtonProbability->setCheck(false);
441  myTextFieldProbability->disable();
442  onCmdSetVariable(0, 0, 0);
443  return 1;
444  } else if (radioButton == myRadioButtonProbability) {
445  myRadioButtonProbability->setCheck(true);
446  myTextFieldProbability->enable();
448  // disable other options
449  myRadioButtonVehsPerHour->setCheck(false);
450  myTextFieldVehsPerHour->disable();
451  myRadioButtonPeriod->setCheck(false);
452  myTextFieldPeriod->disable();
453  onCmdSetVariable(0, 0, 0);
454  return 1;
455  } else {
456  return 0;
457  }
458 }
459 
460 
461 void
463  // update fields
466  myComboBoxRoute->setText(myCopyOfCalibratorFlow->getRoute().c_str());
474  myTextFieldLine->setText(myCopyOfCalibratorFlow->getLine().c_str());
486  // upsate type of flow
493  }
494 }
495 
496 
497 /****************************************************************************/
bool setLine(std::string line="")
set line of busStop/containerStop
bool setDepartSpeed(std::string departSpeed="0")
set depart speed
FXTextField * myTextFieldDepartPos
TextField for Depart Pos.
#define GUIDesignComboBoxNCol
number of column of every combo box
Definition: GUIDesigns.h:197
#define GUIDesignCheckButtonAttribute
checkButton without thick extended over the frame used for attributes
Definition: GUIDesigns.h:117
SumoXMLTag getTag() const
get tag
description of a vehicle type
const std::string & getArrivalLane() const
get arrival lane
bool setContainerNumber(int containerNumber=0)
set number of container
FXCheckButton * myRerouteCheckButton
checkButton for Reroute
FXTextField * myTextFieldDepartLane
TextField for Depart Lane.
int getNumber() const
get number of flows
bool setVehicleType(std::string vehicleType)
set vehicleType of flow
const std::string & getArrivalSpeed() const
get arrival speed
long onCmdCancel(FXObject *, FXSelector, void *)
event after press cancel button
const std::string & getDepartSpeed() const
get arrival speed
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
FXTextField * myTextFieldNumber
TextField for Number.
Dialog to edit sequences, parameters, etc.. of Additionals.
std::string getArrivalPosLat() const
const std::string & getArrivalPos() const
get arrival position
FXTextField * myTextFieldPeriod
TextField for Period.
weights: time range begin
GNECalibrator * getCalibratorParent() const
get pointer to calibrator parent
bool setPeriod(double period)
set period of flows
FXTextField * myTextFieldBegin
TextField for Begin.
bool setArrivalLane(std::string arrivalLane="current")
set arrival lane
FXDEFMAP(GNECalibratorFlowDialog) GNECalibratorFlowDialogMap[]
FXTextField * myTextFieldArrivalPos
TextField for Arrival Pos.
bool setArrivalPos(std::string arrivalPos="max")
set arrival position
const std::string & getVehicleType() const
get vehicle type of flow
double getBegin() const
FXTextField * myTextFieldArrivalPosLat
TextField for ArrivalPosLat.
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:200
std::string getDepartPosLat() const
get departPosLat
FXRadioButton * myRadioButtonPeriod
RadioButton for Period.
bool setVehsPerHour(double vehsPerHour)
set flows per hour
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:65
const std::string & getRoute() const
get route in which this flow is used
#define GUIDesignComboBox
Definition: GUIDesigns.h:187
long onCmdSetTypeOfFlow(FXObject *radioButton, FXSelector, void *)
event after change type of flow
bool setPersonNumber(int personNumber=0)
set number of persons
FXTextField * myTextFieldColor
TextField for Color.
FXRadioButton * myRadioButtonVehsPerHour
RadioButton for VehsPerHour.
#define GUIDesignAuxiliarFrame
design for auxiliar (Without borders) frames used to pack another frames extended in all directions ...
Definition: GUIDesigns.h:241
bool setBegin(double begin)
set begin step
TypeOfFlow getFlowType() const
get type of flow
bool setDepartPosLat(std::string departPosLat="center")
set departPosLat
FXComboBox * myComboBoxRoute
TextField for Route.
#define GUIDesignTextField
Definition: GUIDesigns.h:41
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
FXRadioButton * myRadioButtonProbability
RadioButton for Probability.
bool setRoute(std::string route)
set route in which this flow is used
bool setColor(const RGBColor &color)
set color of flow
double getPeriod() const
get period of flow
FXTextField * myTextFieldDepartPosLat
TextField for DepartPosLat.
FXTextField * myTextFieldArrivalLane
TextField for Arrival Lane.
const std::string & getDepartPos() const
get depart position
invalid attribute
bool myCalibratorFlowValid
flag to check if current calibrator flow is valid
bool setDepartPos(std::string departPos="base")
set depart position
bool setReroute(bool value)
set reroute
bool myUpdatingElement
flag to indicate if flow are being created or modified
FXTextField * myTextFieldEnd
TextField for End.
FXTextField * myTextFieldLine
TextField for Line.
const std::string & getFlowID() const
get ID of flow
FXComboBox * myComboBoxVehicleType
ComboBox for Type.
bool setArrivalSpeed(std::string arrivalSpeed="current")
set arrival speed
long onCmdAccept(FXObject *, FXSelector, void *)
bool setFlowID(std::string ID)
set ID of flow
const std::string & getDepartLane() const
get depart lane
FXTextField * myTextFieldArrivalSpeed
TextField for Arrival Speed.
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition: GUIDesigns.h:50
Dialog for edit calibrators.
int getContainerNumber() const
get number of containers
double getVehsPerHour() const
get flows per hour
bool setProbability(double probability)
set probability of flow
GNECalibratorFlow * myCopyOfCalibratorFlow
pointer in which save modifications of CalibratorFlow
GNECalibratorFlow * myCalibratorFlow
pointer to rerouter interval
FXTextField * myTextFieldDepartSpeed
TextField for Depart Speed.
weights: time range end
int getPersonNumber() const
get number of persons
bool setTypeOfFlow(TypeOfFlow type)
set type of flow
const std::string & getLine() const
get line of busStop/containerStop
bool setDepartLane(std::string departLane="first")
set depart lane
#define GUIDesignLabelThick
label extended over frame with thick and with text justify to left
Definition: GUIDesigns.h:153
bool setNumber(int number)
set number of flows
#define GUIDesignTextFieldInt
text field extended over Frame with thick frame and limited to Integers
Definition: GUIDesigns.h:44
#define GUIDesignTextFieldReal
text field extended over Frame with thick frame and limited to Doubles/doubles
Definition: GUIDesigns.h:47
double getProbability() const
get probability of flow
SumoXMLTag getTag() const
get XML Tag assigned to this object
SumoXMLAttr myInvalidAttr
current sumo attribute invalid
bool setArrivalPosLat(std::string arrivalPosLat="")
set arrivalPosLat
void updateCalibratorFlowValues()
update data fields
long onCmdSetVariable(FXObject *, FXSelector, void *)
event after change value
FXTextField * myTextFieldPersonNumber
TextField for PersonNumber.
FXTextField * myTextFieldVehsPerHour
TextField for VehsPerHour.
bool getReroute() const
get reroute
Dialog for edit rerouter intervals.
FXTextField * myTextFieldContainerNumber
TextField for Container Number.
bool setEnd(double end)
set end step
const RGBColor & getColor() const
get color of flow
#define GUIDesignRadioButtonAttribute
design for radio button with fixed height
Definition: GUIDesigns.h:137
A color information.
FXTextField * myTextFieldProbability
TextField for Probability.
double getEnd() const
get end time step
long onCmdReset(FXObject *, FXSelector, void *)
event after press reset button
FXTextField * myTextFieldFlowID
TextField for flow ID.