Eclipse SUMO - Simulation of Urban MObility
GNEVehicleTypeDialog.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2022 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // Dialog for edit vehicleTypes
19 /****************************************************************************/
20 #include <config.h>
21 
22 #include <netedit/GNENet.h>
23 #include <netedit/GNEUndoList.h>
24 #include <netedit/GNEViewNet.h>
31 
32 #include "GNEVehicleTypeDialog.h"
33 
34 
35 // ===========================================================================
36 // FOX callback mapping
37 // ===========================================================================
38 
43 };
44 
45 FXDEFMAP(GNEVehicleTypeDialog::CarFollowingModelParameters) CarFollowingModelParametersMap[] = {
47 };
48 
49 // Object implementation
50 FXIMPLEMENT(GNEVehicleTypeDialog::VTypeAtributes, FXVerticalFrame, VTypeAtributesMap, ARRAYNUMBER(VTypeAtributesMap))
51 FXIMPLEMENT(GNEVehicleTypeDialog::CarFollowingModelParameters, FXGroupBox, CarFollowingModelParametersMap, ARRAYNUMBER(CarFollowingModelParametersMap))
52 
53 // ===========================================================================
54 // member method definitions
55 // ===========================================================================
56 
57 // ---------------------------------------------------------------------------
58 // GNEVehicleTypeDialog::VClassRow - methods
59 // ---------------------------------------------------------------------------
60 
61 GNEVehicleTypeDialog::VTypeAtributes::VClassRow::VClassRow(VTypeAtributes* VTypeAtributesParent, FXVerticalFrame* column) :
62  FXHorizontalFrame(column, GUIDesignAuxiliarHorizontalFrame),
63  myVTypeAtributesParent(VTypeAtributesParent) {
64  // create two auxiliar frames
65  FXVerticalFrame* verticalFrameLabelAndComboBox = new FXVerticalFrame(this, GUIDesignAuxiliarVerticalFrame);
66  // create FXComboBox for VClass
67  new FXLabel(verticalFrameLabelAndComboBox, toString(SUMO_ATTR_VCLASS).c_str(), nullptr, GUIDesignLabelAttribute150);
68  myComboBoxVClass = new FXComboBox(verticalFrameLabelAndComboBox, GUIDesignComboBoxNCol,
69  VTypeAtributesParent, MID_GNE_SET_ATTRIBUTE, GUIDesignComboBox);
70  myComboBoxVClassLabelImage = new FXLabel(this, "", nullptr, GUIDesignLabelTickedIcon180x46);
71  myComboBoxVClassLabelImage->setBackColor(FXRGBA(255, 255, 255, 255));
72  // fill combo Box with all allowed VClass for the current edited VType
73  for (const auto& i : myVTypeAtributesParent->myVehicleTypeDialog->getEditedDemandElement()->getTagProperty().getAttributeProperties(SUMO_ATTR_VCLASS).getDiscreteValues()) {
74  if (i != SumoVehicleClassStrings.getString(SVC_IGNORING)) {
75  myComboBoxVClass->appendItem(i.c_str());
76  }
77  }
78  // only show as maximum 10 VClasses
79  if (myComboBoxVClass->getNumItems() > 10) {
80  myComboBoxVClass->setNumVisible(10);
81  } else {
82  myComboBoxVClass->setNumVisible(myComboBoxVClass->getNumItems());
83  }
84 }
85 
86 
89  // set color of myComboBoxVClass, depending if current value is valid or not
90  myComboBoxVClass->setTextColor(FXRGB(0, 0, 0));
92  myComboBoxVClass->setTextColor(FXRGB(0, 0, 0));
93  // check if VType has to be updated
95  // update VClass in VType
98  // update label image
100  // obtain default vType parameters
102  // check if mutable rows haben to be updated
104  myVTypeAtributesParent->myLength->updateValue(toString(defaultVTypeParameters.length));
105  }
107  myVTypeAtributesParent->myMinGap->updateValue(toString(defaultVTypeParameters.minGap));
108  }
111  }
114  }
117  }
119  myVTypeAtributesParent->myWidth->updateValue(toString(defaultVTypeParameters.width));
120  }
122  myVTypeAtributesParent->myHeight->updateValue(toString(defaultVTypeParameters.height));
123  }
125  myVTypeAtributesParent->myOSGFile->updateValue(toString(defaultVTypeParameters.osgFile));
126  }
129  }
132  }
135  }
138  }
139  }
140  } else {
141  myComboBoxVClass->setTextColor(FXRGB(255, 0, 0));
144  }
146 }
147 
148 
151  myComboBoxVClass->setText(myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_VCLASS).c_str());
152  setVClassLabelImage();
153  return myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getVClass();
154 }
155 
156 
157 void
159  // by default vclass is passenger
160  if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_VCLASS).empty()) {
161  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_PASSENGER));
162  } else {
163  // set Icon in label depending of current VClass
164  switch (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getVClass()) {
165  case SVC_PRIVATE:
166  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_PRIVATE));
167  break;
168  case SVC_EMERGENCY:
169  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_EMERGENCY));
170  break;
171  case SVC_AUTHORITY:
172  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_AUTHORITY));
173  break;
174  case SVC_ARMY:
175  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_ARMY));
176  break;
177  case SVC_VIP:
178  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_VIP));
179  break;
180  case SVC_PASSENGER:
181  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_PASSENGER));
182  break;
183  case SVC_HOV:
184  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_HOV));
185  break;
186  case SVC_TAXI:
187  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_TAXI));
188  break;
189  case SVC_BUS:
190  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_BUS));
191  break;
192  case SVC_COACH:
193  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_COACH));
194  break;
195  case SVC_DELIVERY:
196  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_DELIVERY));
197  break;
198  case SVC_TRUCK:
199  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_TRUCK));
200  break;
201  case SVC_TRAILER:
202  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_TRAILER));
203  break;
204  case SVC_TRAM:
205  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_TRAM));
206  break;
207  case SVC_RAIL_URBAN:
208  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_RAIL_URBAN));
209  break;
210  case SVC_RAIL:
211  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_RAIL));
212  break;
213  case SVC_RAIL_ELECTRIC:
214  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_RAIL_ELECTRIC));
215  break;
216  case SVC_RAIL_FAST:
217  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_RAIL_ELECTRIC));
218  break;
219  case SVC_MOTORCYCLE:
220  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_MOTORCYCLE));
221  break;
222  case SVC_MOPED:
223  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_MOPED));
224  break;
225  case SVC_BICYCLE:
226  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_BICYCLE));
227  break;
228  case SVC_PEDESTRIAN:
229  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_PEDESTRIAN));
230  break;
231  case SVC_E_VEHICLE:
232  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_EVEHICLE));
233  break;
234  case SVC_SHIP:
235  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_SHIP));
236  break;
237  case SVC_CUSTOM1:
238  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_CUSTOM1));
239  break;
240  case SVC_CUSTOM2:
241  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_CUSTOM2));
242  break;
243  default:
244  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_IGNORING));
245  break;
246  }
247  }
248 }
249 
250 // ---------------------------------------------------------------------------
251 // GNEVehicleTypeDialog::VShapeRow - methods
252 // ---------------------------------------------------------------------------
253 
254 GNEVehicleTypeDialog::VTypeAtributes::VShapeRow::VShapeRow(VTypeAtributes* VTypeAtributesParent, FXVerticalFrame* column) :
255  FXHorizontalFrame(column, GUIDesignAuxiliarHorizontalFrame),
256  myVTypeAtributesParent(VTypeAtributesParent) {
257  // create two auxiliar frames
258  FXVerticalFrame* verticalFrameLabelAndComboBox = new FXVerticalFrame(this, GUIDesignAuxiliarVerticalFrame);
259  // create combo for for vehicle shapes
260  new FXLabel(verticalFrameLabelAndComboBox, toString(SUMO_ATTR_GUISHAPE).c_str(), nullptr, GUIDesignLabelAttribute150);
261  myComboBoxShape = new FXComboBox(verticalFrameLabelAndComboBox, GUIDesignComboBoxNCol,
262  VTypeAtributesParent, MID_GNE_SET_ATTRIBUTE, GUIDesignComboBox);
263  myComboBoxShapeLabelImage = new FXLabel(this, "", nullptr, GUIDesignLabelTickedIcon180x46);
264  myComboBoxShapeLabelImage->setBackColor(FXRGBA(255, 255, 255, 255));
265  // fill combo Box with all vehicle shapes
266  std::vector<std::string> VShapeStrings = SumoVehicleShapeStrings.getStrings();
267  for (auto i : VShapeStrings) {
269  myComboBoxShape->appendItem(i.c_str());
270  }
271  }
272  // only show 10 Shapes
273  myComboBoxShape->setNumVisible(10);
274 }
275 
276 
277 void
279  // set color of myComboBoxShape, depending if current value is valid or not
280  if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(SUMO_ATTR_GUISHAPE, myComboBoxShape->getText().text())) {
281  myComboBoxShape->setTextColor(FXRGB(0, 0, 0));
282  myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(SUMO_ATTR_GUISHAPE, myComboBoxShape->getText().text(),
283  myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
284  setVShapeLabelImage();
285  } else {
286  myComboBoxShape->setTextColor(FXRGB(255, 0, 0));
287  myVTypeAtributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
288  myVTypeAtributesParent->myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_GUISHAPE;
289  }
290 }
291 
292 
293 void
295  myComboBoxShape->setText(myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_GUISHAPE).c_str());
296  setVShapeLabelImage();
297 }
298 
299 
300 void
302  // set Icon in label depending of current VClass
303  switch (getVehicleShapeID(myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_GUISHAPE))) {
305  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_UNKNOWN));
306  break;
308  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PEDESTRIAN));
309  break;
311  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_BICYCLE));
312  break;
314  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_MOPED));
315  break;
317  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_MOTORCYCLE));
318  break;
320  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PASSENGER));
321  break;
323  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PASSENGER_SEDAN));
324  break;
326  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PASSENGER_HATCHBACK));
327  break;
329  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PASSENGER_WAGON));
330  break;
332  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PASSENGER_VAN));
333  break;
335  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_DELIVERY));
336  break;
338  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_TRUCK));
339  break;
341  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_TRUCK_SEMITRAILER));
342  break;
344  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_TRUCK_1TRAILER));
345  break;
347  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_BUS));
348  break;
350  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_BUS_COACH));
351  break;
353  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_BUS_FLEXIBLE));
354  break;
356  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_BUS_TROLLEY));
357  break;
359  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_RAIL));
360  break;
362  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_RAIL_CAR));
363  break;
365  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_RAIL_CARGO));
366  break;
368  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_E_VEHICLE));
369  break;
371  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_ANT));
372  break;
374  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_SHIP));
375  break;
377  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_EMERGENCY));
378  break;
380  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_FIREBRIGADE));
381  break;
383  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_POLICE));
384  break;
386  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_RICKSHAW));
387  break;
389  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_SCOOTER));
390  break;
391  default:
392  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_IGNORING));
393  break;
394  }
395 }
396 
397 // ---------------------------------------------------------------------------
398 // GNEVehicleTypeDialog::VTypeAtributes - methods
399 // ---------------------------------------------------------------------------
400 
401 GNEVehicleTypeDialog::VTypeAtributes::VTypeAttributeRow::VTypeAttributeRow(VTypeAtributes* VTypeAtributesParent, FXVerticalFrame* verticalFrame, const SumoXMLAttr attr, const RowAttrType rowAttrType, const std::vector<std::string>& values) :
402  FXHorizontalFrame(verticalFrame, GUIDesignAuxiliarHorizontalFrame),
403  myVTypeAtributesParent(VTypeAtributesParent),
404  myAttr(attr),
405  myRowAttrType(rowAttrType),
406  myButton(nullptr),
407  myTextField(nullptr),
408  myComboBox(nullptr) {
409  // first check if we have to create a button or a label
410  if ((rowAttrType == ROWTYPE_COLOR) || (rowAttrType == ROWTYPE_FILENAME)) {
411  myButton = new FXButton(this, filterAttributeName(attr), nullptr, VTypeAtributesParent, MID_GNE_SET_ATTRIBUTE_DIALOG, GUIDesignButtonRectangular150);
412  } else if (rowAttrType == ROWTYPE_PARAMETERS) {
413  myButton = new FXButton(this, "Edit parameters", nullptr, VTypeAtributesParent, MID_GNE_OPEN_PARAMETERS_DIALOG, GUIDesignButtonRectangular150);
414  } else {
415  new FXLabel(this, filterAttributeName(attr), nullptr, GUIDesignLabelAttribute150);
416  }
417  // now check if we have to create a textfield or a ComboBox
418  if ((rowAttrType == ROWTYPE_STRING) || (rowAttrType == ROWTYPE_COLOR) || (rowAttrType == ROWTYPE_FILENAME) || (rowAttrType == ROWTYPE_PARAMETERS)) {
419  myTextField = new FXTextField(this, GUIDesignTextFieldNCol, VTypeAtributesParent, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFielWidth180);
420  } else if (rowAttrType == ROWTYPE_COMBOBOX) {
421  myComboBox = new FXComboBox(this, GUIDesignComboBoxNCol, VTypeAtributesParent, MID_GNE_SET_ATTRIBUTE, GUIDesignComboBoxWidth180);
422  // fill combo Box with values
423  for (const auto& value : values) {
424  myComboBox->appendItem(value.c_str());
425  }
426  // set 10 visible elements as maximum
427  if (myComboBox->getNumItems() < 10) {
428  myComboBox->setNumVisible(myComboBox->getNumItems());
429  } else {
430  myComboBox->setNumVisible(10);
431  }
432  } else {
433  throw ProcessError("Invalid row type");
434  }
435 }
436 
437 
438 void
440  if (myRowAttrType == ROWTYPE_COMBOBOX) {
441  // set color of myComboBox, depending if current value is valid or not
442  if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, myComboBox->getText().text())) {
443  myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, myComboBox->getText().text(),
444  myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
445  // update value after setting it
446  updateValue();
447  } else {
448  myComboBox->setTextColor(FXRGB(255, 0, 0));
449  // mark VType as invalid
450  myVTypeAtributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
451  myVTypeAtributesParent->myVehicleTypeDialog->myInvalidAttr = myAttr;
452  }
453  } else if (myRowAttrType == ROWTYPE_COLOR) {
454  // set color of myTextFieldColor, depending if current value is valid or not
455  if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(SUMO_ATTR_COLOR, myTextField->getText().text())) {
456  // set color depending if is a default value
457  if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getTagProperty().getDefaultValue(SUMO_ATTR_COLOR) != myTextField->getText().text()) {
458  myTextField->setTextColor(FXRGB(0, 0, 0));
459  } else {
460  myTextField->setTextColor(FXRGB(195, 195, 195));
461  }
462  myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(SUMO_ATTR_COLOR, myTextField->getText().text(), myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
463  } else {
464  myTextField->setTextColor(FXRGB(255, 0, 0));
465  myVTypeAtributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
466  myVTypeAtributesParent->myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_COLOR;
467  }
468  } else {
469  // set color of textField, depending if current value is valid or not
470  if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, myTextField->getText().text())) {
471  myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, myTextField->getText().text(),
472  myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
473  // update value after setting it
474  updateValue();
475  } else {
476  myTextField->setTextColor(FXRGB(255, 0, 0));
477  // mark VType as invalid
478  myVTypeAtributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
479  myVTypeAtributesParent->myVehicleTypeDialog->myInvalidAttr = myAttr;
480  }
481  }
482 }
483 
484 
485 void
487  if (myComboBox) {
488  // set color of myComboBox, depending if current value is valid or not
489  if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, myComboBox->getText().text())) {
490  myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, myComboBox->getText().text(),
491  myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
492  // update value after setting it
493  updateValue(defaultValue);
494  } else {
495  myComboBox->setTextColor(FXRGB(255, 0, 0));
496  // mark VType as invalid
497  myVTypeAtributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
498  myVTypeAtributesParent->myVehicleTypeDialog->myInvalidAttr = myAttr;
499  }
500  } else {
501  // set color of textField, depending if current value is valid or not
502  if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, myTextField->getText().text())) {
503  myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, myTextField->getText().text(),
504  myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
505  // update value after setting it
506  updateValue(defaultValue);
507  } else {
508  myTextField->setTextColor(FXRGB(255, 0, 0));
509  // mark VType as invalid
510  myVTypeAtributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
511  myVTypeAtributesParent->myVehicleTypeDialog->myInvalidAttr = myAttr;
512  }
513  }
514 }
515 
516 
517 void
519  if (myRowAttrType == ROWTYPE_COMBOBOX) {
520  // set text of myComboBox using current value of VType
521  myComboBox->setText(myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr).c_str());
522  // set color depending if is a default value
523  if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getTagProperty().getDefaultValue(myAttr) != myComboBox->getText().text()) {
524  myComboBox->setTextColor(FXRGB(0, 0, 0));
525  } else {
526  myComboBox->setTextColor(FXRGB(195, 195, 195));
527  }
528  } else if (myRowAttrType == ROWTYPE_COLOR) {
529  // set field color
530  myTextField->setText(myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr).c_str());
531  // set color depending if is a default value
532  if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getTagProperty().getDefaultValue(myAttr) != myTextField->getText().text()) {
533  myTextField->setTextColor(FXRGB(0, 0, 0));
534  } else {
535  myTextField->setTextColor(FXRGB(195, 195, 195));
536  }
537  } else if (myAttr == GNE_ATTR_PARAMETERS) {
538  // get parameters
539  const std::string& parametersStr = myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr);
540  // set text of myTextField using current value of VType
541  myTextField->setText(parametersStr.c_str());
542  // set text color
543  myTextField->setTextColor(FXRGB(0, 0, 0));
544  // clear parameters
545  myParameters.clear();
546  // separate value in a vector of string using | as separator
547  StringTokenizer parameters(parametersStr, "|", true);
548  // iterate over all values
549  while (parameters.hasNext()) {
550  // obtain key and value and save it in myParameters
551  const std::vector<std::string> keyValue = StringTokenizer(parameters.next(), "=", true).getVector();
552  if (keyValue.size() == 2) {
553  myParameters[keyValue.front()] = keyValue.back();
554  }
555  }
556  } else {
557  // set text of myTextField using current value of VType
558  myTextField->setText(myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr).c_str());
559  // set color depending if is a default value
560  if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getTagProperty().getDefaultValue(myAttr) != myTextField->getText().text()) {
561  myTextField->setTextColor(FXRGB(0, 0, 0));
562  } else {
563  myTextField->setTextColor(FXRGB(195, 195, 195));
564  }
565  }
566 }
567 
568 
569 void
571  if (myComboBox) {
572  // set text of myComboBox using current value of VType
573  myComboBox->setText(myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr).c_str());
574  // set color depending if is a default value
575  if (defaultValue != myComboBox->getText().text()) {
576  myComboBox->setTextColor(FXRGB(0, 0, 0));
577  } else {
578  myComboBox->setTextColor(FXRGB(195, 195, 195));
579  }
580  } else {
581  // set text of myTextField using current value of VType
582  myTextField->setText(myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr).c_str());
583  // set color depending if is a default value
584  if (defaultValue != myTextField->getText().text()) {
585  myTextField->setTextColor(FXRGB(0, 0, 0));
586  } else {
587  myTextField->setTextColor(FXRGB(195, 195, 195));
588  }
589  }
590 }
591 
592 
593 const FXButton*
595  return myButton;
596 }
597 
598 
599 void
601  // create FXColorDialog
602  FXColorDialog colordialog(this, tr("Color Dialog"));
603  colordialog.setTarget(this);
604  // If previous attribute wasn't correct, set black as default color
605  if (GNEAttributeCarrier::canParse<RGBColor>(myTextField->getText().text())) {
606  colordialog.setRGBA(MFXUtils::getFXColor(GNEAttributeCarrier::parse<RGBColor>(myTextField->getText().text())));
607  } else {
608  colordialog.setRGBA(MFXUtils::getFXColor(RGBColor::BLACK));
609  }
610  // execute dialog to get a new color
611  if (colordialog.execute()) {
612  std::string newValue = toString(MFXUtils::getRGBColor(colordialog.getRGBA()));
613  myTextField->setText(newValue.c_str());
614  if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, newValue)) {
615  myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, newValue, myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
616  // If previously value was incorrect, change font color to black
617  myTextField->setTextColor(FXRGB(0, 0, 0));
618  myTextField->killFocus();
619  }
620  }
621 }
622 
623 
624 void
626  // get the new image file
627  FXFileDialog opendialog(this, "Open Image");
628  opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::VTYPE));
629  opendialog.setSelectMode(SELECTFILE_EXISTING);
630  opendialog.setPatternList("All files (*)");
631  if (gCurrentFolder.length() != 0) {
632  opendialog.setDirectory(gCurrentFolder);
633  }
634  if (opendialog.execute()) {
635  // update global current folder
636  gCurrentFolder = opendialog.getDirectory();
637  // get image path
638  std::string imagePath = opendialog.getFilename().text();
639  // check if image is valid
640  if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, imagePath)) {
641  myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, imagePath, myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
642  myTextField->setText(imagePath.c_str());
643  // If previously value was incorrect, change font color to black
644  myTextField->setTextColor(FXRGB(0, 0, 0));
645  myTextField->killFocus();
646  }
647  }
648 }
649 
650 
651 void
653  // get the new file name
654  FXFileDialog opendialog(this, "Open OSG File");
655  opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::VTYPE));
656  opendialog.setSelectMode(SELECTFILE_EXISTING);
657  opendialog.setPatternList("OSG file (*.obj)");
658  if (gCurrentFolder.length() != 0) {
659  opendialog.setDirectory(gCurrentFolder);
660  }
661  if (opendialog.execute()) {
662  // update global current folder
663  gCurrentFolder = opendialog.getDirectory();
664  // get image path
665  std::string imagePath = opendialog.getFilename().text();
666  // check if image is valid
667  if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, imagePath)) {
668  myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, imagePath, myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
669  myTextField->setText(imagePath.c_str());
670  // If previously value was incorrect, change font color to black
671  myTextField->setTextColor(FXRGB(0, 0, 0));
672  myTextField->killFocus();
673  }
674  }
675 }
676 
677 
678 std::string
680  return myTextField->getText().text();
681 }
682 
683 
684 std::vector<std::pair<std::string, std::string> >
686  std::vector<std::pair<std::string, std::string> > result;
687  // Generate a vector string using the following structure: "<key1,value1>, <key2, value2>,...
688  for (const auto& parameter : myParameters) {
689  result.push_back(std::make_pair(parameter.first, parameter.second));
690  }
691  return result;
692 }
693 
694 
695 void
696 GNEVehicleTypeDialog::VTypeAtributes::VTypeAttributeRow::setParameters(const std::vector<std::pair<std::string, std::string> >& parameters) {
697  // first clear parameters
698  myParameters.clear();
699  // declare result
700  std::string result;
701  // iterate over parameters
702  for (const auto& parameter : parameters) {
703  // Generate an string using the following structure: "key1=value1|key2=value2|...
704  result += parameter.first + "=" + parameter.second + "|";
705  // fill parameters
706  myParameters[parameter.first] = parameter.second;
707  }
708  // remove the last "|"
709  if (!result.empty()) {
710  result.pop_back();
711  }
712  // set text field
713  myTextField->setText(result.c_str());
714 }
715 
716 
717 FXString
719  switch (attr) {
720  // JM
722  return "crossingGap";
724  return "driveAfterYellowTime";
726  return "driveAfterRedTime";
728  return "driveRedSpeed";
730  return "ignoreKeepClearTime";
732  return "ignoreFoeSpeed";
734  return "ignoreFoeProb";
736  return "sigmaMinor";
738  return "timegapMinor";
739  // LCM
741  return "strategic";
743  return "cooperative";
745  return "speedGain";
747  return "keepRight";
749  return "sublane";
751  return "opposite";
752  case SUMO_ATTR_LCA_PUSHY:
753  return "pushy";
755  return "pushyGap";
757  return "assertive";
759  return "impatience";
761  return "timeToImpatience";
763  return "accelLat";
765  return "lookaheadLeft";
767  return "speedGainRight";
769  return "maxSpeedLatStanding";
771  return "maxSpeedLatFactor";
773  return "turnAlignDistance";
775  return "overtakeRight";
776  /* case SUMO_ATTR_LCA_EXPERIMENTAL1:
777  return "experimental1";
778  */
779  default:
780  return toString(attr).c_str();
781  }
782 }
783 
784 // ---------------------------------------------------------------------------
785 // GNEVehicleTypeDialog::VTypeAtributes - methods
786 // ---------------------------------------------------------------------------
787 
788 GNEVehicleTypeDialog::VTypeAtributes::VTypeAtributes(GNEVehicleTypeDialog* vehicleTypeDialog, FXHorizontalFrame* column) :
789  FXVerticalFrame(column, GUIDesignAuxiliarVerticalFrame),
790  myVehicleTypeDialog(vehicleTypeDialog) {
791  // declare two auxiliar horizontal frames
792  FXHorizontalFrame* firstAuxiliarHorizontalFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
793  FXVerticalFrame* firstAuxiliarVerticalFrame = new FXVerticalFrame(firstAuxiliarHorizontalFrame, GUIDesignAuxiliarVerticalFrame);
794  // create attributes for common attributes
795  FXGroupBox* commonAttributes = new FXGroupBox(firstAuxiliarVerticalFrame, "Vehicle Type attributes", GUIDesignGroupBoxFrame);
796  // create horizontal frame for columns of attributes
797  FXHorizontalFrame* columnsBasicVTypeAttributes = new FXHorizontalFrame(commonAttributes, GUIDesignAuxiliarHorizontalFrame);
798  // build left attributes
799  buildAttributesA(new FXVerticalFrame(columnsBasicVTypeAttributes, GUIDesignAuxiliarFrame));
800  // build right attributes
801  buildAttributesB(new FXVerticalFrame(columnsBasicVTypeAttributes, GUIDesignAuxiliarFrame));
802  // create GroupBox for Junction Model Attributes
803  FXGroupBox* JMAttributes = new FXGroupBox(firstAuxiliarVerticalFrame, "Junction Model attributes", GUIDesignGroupBoxFrame);
804  // create horizontal frame for columns of Junction Model attributes
805  FXHorizontalFrame* columnsJMVTypeAttributes = new FXHorizontalFrame(JMAttributes, GUIDesignAuxiliarHorizontalFrame);
806  // build left attributes
807  buildJunctionModelAttributesA(new FXVerticalFrame(columnsJMVTypeAttributes, GUIDesignAuxiliarFrame));
808  // build right attributes
809  buildJunctionModelAttributesB(new FXVerticalFrame(columnsJMVTypeAttributes, GUIDesignAuxiliarFrame));
810  // create GroupBox for Junction Model Attributes
811  FXGroupBox* LCMAttributes = new FXGroupBox(firstAuxiliarHorizontalFrame, "Lane Change Model attributes", GUIDesignGroupBoxFrame);
812  // create Lane Change Model Attributes
813  buildLaneChangeModelAttributes(new FXVerticalFrame(LCMAttributes, GUIDesignAuxiliarFrame));
814 }
815 
816 
817 void
819  // 01 Create VClassRow
820  myVClassRow = new VClassRow(this, column);
821 
822  // 02 create FXTextField and Label for vehicleTypeID
823  FXHorizontalFrame* row = new FXHorizontalFrame(column, GUIDesignAuxiliarHorizontalFrame);
824  new FXLabel(row, toString(SUMO_ATTR_ID).c_str(), nullptr, GUIDesignLabelAttribute150);
825  myTextFieldVehicleTypeID = new FXTextField(row, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFielWidth180);
826 
827  // 03 create FXTextField and Button for Color
828  myColor = new VTypeAttributeRow(this, column, SUMO_ATTR_COLOR, VTypeAttributeRow::RowAttrType::ROWTYPE_COLOR);
829 
830  // 04 create FXTextField and Label for Length
831  myLength = new VTypeAttributeRow(this, column, SUMO_ATTR_LENGTH, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
832 
833  // 05 create FXTextField and Label for MinGap
834  myMinGap = new VTypeAttributeRow(this, column, SUMO_ATTR_MINGAP, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
835 
836  // 06 create FXTextField and Label for MaxSpeed
837  myMaxSpeed = new VTypeAttributeRow(this, column, SUMO_ATTR_MAXSPEED, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
838 
839  // 07 create FXTextField and Label for SpeedFactor
840  mySpeedFactor = new VTypeAttributeRow(this, column, SUMO_ATTR_SPEEDFACTOR, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
841 
842  // 08 create FXTextField and Label for EmissionClass
843  myEmissionClass = new VTypeAttributeRow(this, column, SUMO_ATTR_EMISSIONCLASS, VTypeAttributeRow::RowAttrType::ROWTYPE_COMBOBOX, PollutantsInterface::getAllClassesStr());
844 
845  // 09 create FXTextField and Label for Width
846  myWidth = new VTypeAttributeRow(this, column, SUMO_ATTR_WIDTH, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
847 
848  // 10 create FXTextField and Label for Height
849  myHeight = new VTypeAttributeRow(this, column, SUMO_ATTR_HEIGHT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
850 
851  // 11 create FXTextField and Label for Filename
852  myFilename = new VTypeAttributeRow(this, column, SUMO_ATTR_IMGFILE, VTypeAttributeRow::RowAttrType::ROWTYPE_FILENAME);
853 
854  // 12 create FXTextField and Label for Filename
855  myOSGFile = new VTypeAttributeRow(this, column, SUMO_ATTR_OSGFILE, VTypeAttributeRow::RowAttrType::ROWTYPE_FILENAME);
856 
857  // 13 create VTypeAttributeRow and Label for Probability
858  myProbability = new VTypeAttributeRow(this, column, SUMO_ATTR_PROB, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
859 
860  // 14 create VTypeAttributeRow and Label for LaneChangeModel
861  myLaneChangeModel = new VTypeAttributeRow(this, column, SUMO_ATTR_LANE_CHANGE_MODEL, VTypeAttributeRow::RowAttrType::ROWTYPE_COMBOBOX, SUMOXMLDefinitions::LaneChangeModels.getStrings());
862 }
863 
864 
865 void
867  // 01 Create VShapeRow
868  myVShapeRow = new VShapeRow(this, column);
869 
870  // 02 create VTypeAttributeRow and Label for PersonCapacity
871  myPersonCapacity = new VTypeAttributeRow(this, column, SUMO_ATTR_PERSON_CAPACITY, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
872 
873  // 03 create VTypeAttributeRow and Label for ContainerCapacity
874  myContainerCapacity = new VTypeAttributeRow(this, column, SUMO_ATTR_CONTAINER_CAPACITY, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
875 
876  // 04 create VTypeAttributeRow and Label for BoardingDuration
877  myBoardingDuration = new VTypeAttributeRow(this, column, SUMO_ATTR_BOARDING_DURATION, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
878 
879  // 05 create VTypeAttributeRow and Label for LoadingDuration
880  myLoadingDuration = new VTypeAttributeRow(this, column, SUMO_ATTR_LOADING_DURATION, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
881 
882  // 06 create ComboBox and Label for LatAlignment
883  myLatAlignment = new VTypeAttributeRow(this, column, SUMO_ATTR_LATALIGNMENT, VTypeAttributeRow::RowAttrType::ROWTYPE_COMBOBOX, SUMOVTypeParameter::getLatAlignmentStrings());
884 
885  // 07 create VTypeAttributeRow and Label for MinGapLat
886  myMinGapLat = new VTypeAttributeRow(this, column, SUMO_ATTR_MINGAP_LAT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
887 
888  // 08 create VTypeAttributeRow and Label for MaxSpeedLat
889  myMaxSpeedLat = new VTypeAttributeRow(this, column, SUMO_ATTR_MAXSPEED_LAT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
890 
891  // 09 create VTypeAttributeRow and Label for ActionStepLength
892  myActionStepLength = new VTypeAttributeRow(this, column, SUMO_ATTR_ACTIONSTEPLENGTH, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
893 
894  // 10 create FXTextField and Label for Carriage length
895  myCarriageLength = new VTypeAttributeRow(this, column, SUMO_ATTR_CARRIAGE_LENGTH, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
896 
897  // 11 create FXTextField and Label for Locomotive length
898  myLocomotiveLength = new VTypeAttributeRow(this, column, SUMO_ATTR_LOCOMOTIVE_LENGTH, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
899 
900  // 12 create FXTextField and Label for carriage GAP
901  myCarriageGap = new VTypeAttributeRow(this, column, SUMO_ATTR_CARRIAGE_GAP, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
902 
903  // 13 create FXTextField and Label for parameters
904  myParameters = new VTypeAttributeRow(this, column, GNE_ATTR_PARAMETERS, VTypeAttributeRow::RowAttrType::ROWTYPE_PARAMETERS);
905 }
906 
907 
908 void
910  // 01 create VTypeAttributeRow and Label for JMCrossingGap
911  myJMCrossingGap = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_CROSSING_GAP, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
912 
913  // 02 create VTypeAttributeRow and Label for JMIgnoreKeepclearTime
914  myJMIgnoreKeepclearTime = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_IGNORE_KEEPCLEAR_TIME, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
915 
916  // 03 create VTypeAttributeRow and Label for JMDriveAfterYellowTime
917  myJMDriveAfterYellowTime = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_DRIVE_AFTER_YELLOW_TIME, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
918 
919  // 04 create VTypeAttributeRow and Label for JMDriveAfterRedTime
920  myJMDriveAfterRedTime = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_DRIVE_AFTER_RED_TIME, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
921 
922  // 05 create VTypeAttributeRow and Label for JMDriveRedSpeed
923  myJMDriveRedSpeed = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_DRIVE_RED_SPEED, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
924 }
925 
926 
927 void
929  // 01 create VTypeAttributeRow and Label for JMIgnoreFoeProb
930  myJMIgnoreFoeProb = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_IGNORE_FOE_PROB, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
931 
932  // 02 create VTypeAttributeRow and Label for JMIgnoreFoeSpeed
933  myJMIgnoreFoeSpeed = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_IGNORE_FOE_SPEED, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
934 
935  // 03 create VTypeAttributeRow and Label for JMSigmaMinor
936  myJMSigmaMinor = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_SIGMA_MINOR, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
937 
938  // 04 create VTypeAttributeRow and Label for JMTimeGapMinor
939  myJMTimeGapMinor = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_TIMEGAP_MINOR, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
940 
941  // 05 create VTypeAttributeRow and Label for Impatience
942  myJMImpatience = new VTypeAttributeRow(this, column, SUMO_ATTR_IMPATIENCE, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
943 }
944 
945 
946 void
948  // 01 create VTypeAttributeRow and Label for strategic param
949  myLCAStrategicParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_STRATEGIC_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
950 
951  // 02 create VTypeAttributeRow and Label for cooperative param
952  myLCACooperativeParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_COOPERATIVE_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
953 
954  // 03 create VTypeAttributeRow and Label for speed gain param
955  myLCASpeedgainParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_SPEEDGAIN_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
956 
957  // 04 create VTypeAttributeRow and Label for keepright param
958  myLCAKeeprightParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_KEEPRIGHT_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
959 
960  // 05 create VTypeAttributeRow and Label for sublane param
961  myLCASublaneParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_SUBLANE_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
962 
963  // 06 create VTypeAttributeRow and Label for opposite param
964  myLCAOppositeParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_OPPOSITE_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
965 
966  // 07 create VTypeAttributeRow and Label for pushy
967  myLCAPushy = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_PUSHY, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
968 
969  // 08 create VTypeAttributeRow and Label for pushy gap
970  myLCAPushygap = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_PUSHYGAP, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
971 
972  // 09 create VTypeAttributeRow and Label for assertive
973  myLCAAssertive = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_ASSERTIVE, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
974 
975  // 10 create VTypeAttributeRow and Label for impatience
976  myLCAImpatience = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_IMPATIENCE, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
977 
978  // 11 create VTypeAttributeRow and Label for time to impatience
979  myLCATimeToImpatience = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_TIME_TO_IMPATIENCE, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
980 
981  // 12 create VTypeAttributeRow and Label for accel lat
982  myLCAAccelLat = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_ACCEL_LAT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
983 
984  // 13 create VTypeAttributeRow and Label for look ahead lefth
985  myLCALookAheadLeft = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_LOOKAHEADLEFT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
986 
987  // 14 create VTypeAttributeRow and Label for speed gain right
988  myLCASpeedGainRight = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_SPEEDGAINRIGHT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
989 
990  // 15 create VTypeAttributeRow and Label for max speed lat standing
991  myLCAMaxSpeedLatStanding = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_MAXSPEEDLATSTANDING, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
992 
993  // 16 create VTypeAttributeRow and Label for max speed lat factor
994  myLCAMaxSpeedLatFactor = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_MAXSPEEDLATFACTOR, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
995 
996  // 17 create VTypeAttributeRow and Label for turn alignment distance
997  myLCATurnAlignmentDistance = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_TURN_ALIGNMENT_DISTANCE, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
998 
999  // 18 create VTypeAttributeRow and Label for overtake right
1000  myLCAOvertakeRight = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_OVERTAKE_RIGHT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1001 
1002  // 19 create VTypeAttributeRow and Label for experimental
1003  /* myLCAExperimental = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_EXPERIMENTAL1, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING); */
1004 }
1005 
1006 
1007 void
1009  //set values of myEditedDemandElement into fields
1010  myTextFieldVehicleTypeID->setText(myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_ID).c_str());
1011  // set variables of special rows VClass and VShape
1012  SUMOVTypeParameter::VClassDefaultValues defaultVTypeParameters(myVClassRow->updateValue());
1013  myVShapeRow->updateValues();
1014  // update rows
1015  myLaneChangeModel->updateValue();
1016  myLatAlignment->updateValue();
1017  myColor->updateValue();
1018  myLength->updateValue(toString(defaultVTypeParameters.length));
1019  myMinGap->updateValue(toString(defaultVTypeParameters.minGap));
1020  myMaxSpeed->updateValue(toString(defaultVTypeParameters.maxSpeed));
1021  mySpeedFactor->updateValue(toString(defaultVTypeParameters.speedFactor.getParameter()[0]));
1022  myEmissionClass->updateValue(toString(defaultVTypeParameters.emissionClass));
1023  myWidth->updateValue(toString(defaultVTypeParameters.width));
1024  myHeight->updateValue(toString(defaultVTypeParameters.height));
1025  myFilename->updateValue();
1026  myOSGFile->updateValue(toString(defaultVTypeParameters.osgFile));
1027  myPersonCapacity->updateValue(toString(defaultVTypeParameters.personCapacity));
1028  myContainerCapacity->updateValue(toString(defaultVTypeParameters.containerCapacity));
1029  myCarriageLength->updateValue(toString(defaultVTypeParameters.carriageLength));
1030  myLocomotiveLength->updateValue(toString(defaultVTypeParameters.locomotiveLength));
1031  myBoardingDuration->updateValue();
1032  myLoadingDuration->updateValue();
1033  myMinGapLat->updateValue();
1034  myMaxSpeedLat->updateValue();
1035  myActionStepLength->updateValue();
1036  myProbability->updateValue();
1037  myCarriageGap->updateValue();
1038  // JM Parameters
1039  myJMCrossingGap->updateValue();
1040  myJMIgnoreKeepclearTime->updateValue();
1041  myJMDriveAfterYellowTime->updateValue();
1042  myJMDriveAfterRedTime->updateValue();
1043  myJMDriveRedSpeed->updateValue();
1044  myJMIgnoreFoeProb->updateValue();
1045  myJMIgnoreFoeSpeed->updateValue();
1046  myJMSigmaMinor->updateValue();
1047  myJMTimeGapMinor->updateValue();
1048  myJMImpatience->updateValue();
1049  // LCM Attributes
1050  myLCAStrategicParam->updateValue();
1051  myLCACooperativeParam->updateValue();
1052  myLCASpeedgainParam->updateValue();
1053  myLCAKeeprightParam->updateValue();
1054  myLCASublaneParam->updateValue();
1055  myLCAOppositeParam->updateValue();
1056  myLCAPushy->updateValue();
1057  myLCAPushygap->updateValue();
1058  myLCAAssertive->updateValue();
1059  myLCAImpatience->updateValue();
1060  myLCATimeToImpatience->updateValue();
1061  myLCAAccelLat->updateValue();
1062  myLCALookAheadLeft->updateValue();
1063  myLCASpeedGainRight->updateValue();
1064  myLCAMaxSpeedLatStanding->updateValue();
1065  myLCAMaxSpeedLatFactor->updateValue();
1066  myLCATurnAlignmentDistance->updateValue();
1067  myLCAOvertakeRight->updateValue();
1068  /* myLCAExperimental->updateValue(); */
1069  // parameters
1070  myParameters->updateValue();
1071 }
1072 
1073 
1074 long
1076  // At start we assumed, that all values are valid
1077  myVehicleTypeDialog->myVehicleTypeValid = true;
1078  myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_NOTHING;
1079  // set color of myTextFieldVehicleTypeID, depending if current value is valid or not
1080  if (myVehicleTypeDialog->myEditedDemandElement->isValid(SUMO_ATTR_ID, myTextFieldVehicleTypeID->getText().text())) {
1081  myTextFieldVehicleTypeID->setTextColor(FXRGB(0, 0, 0));
1082  myVehicleTypeDialog->myEditedDemandElement->setAttribute(SUMO_ATTR_ID, myTextFieldVehicleTypeID->getText().text(), myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
1083  } else if (myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_ID) == myTextFieldVehicleTypeID->getText().text()) {
1084  myTextFieldVehicleTypeID->setTextColor(FXRGB(0, 0, 0));
1085  myVehicleTypeDialog->myEditedDemandElement->setAttribute(SUMO_ATTR_ID, myTextFieldVehicleTypeID->getText().text(), myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
1086  } else {
1087  myTextFieldVehicleTypeID->setTextColor(FXRGB(255, 0, 0));
1088  myVehicleTypeDialog->myVehicleTypeValid = false;
1089  myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_ID;
1090  }
1091  // set variables of special rows VClass and VShape
1092  SUMOVTypeParameter::VClassDefaultValues defaultVTypeParameters(myVClassRow->setVariable());
1093  // set variables of special rows VShape
1094  myVShapeRow->setVariable();
1095  // set attributes in rest rows
1096  myColor->setVariable();
1097  myLength->setVariable(toString(defaultVTypeParameters.length));
1098  myMinGap->setVariable(toString(defaultVTypeParameters.minGap));
1099  myMaxSpeed->setVariable(toString(defaultVTypeParameters.maxSpeed));
1100  mySpeedFactor->setVariable(toString(defaultVTypeParameters.speedFactor.getParameter()[0]));
1101  myEmissionClass->setVariable(toString(defaultVTypeParameters.emissionClass));
1102  myWidth->setVariable(toString(defaultVTypeParameters.width));
1103  myHeight->setVariable(toString(defaultVTypeParameters.height));
1104  myOSGFile->setVariable(toString(defaultVTypeParameters.osgFile));
1105  // set attributes in rows
1106  myLaneChangeModel->setVariable();
1107  myLatAlignment->setVariable();
1108  myLength->setVariable(toString(defaultVTypeParameters.length));
1109  myMinGap->setVariable(toString(defaultVTypeParameters.minGap));
1110  myMaxSpeed->setVariable(toString(defaultVTypeParameters.maxSpeed));
1111  mySpeedFactor->setVariable(toString(defaultVTypeParameters.speedFactor.getParameter()[0]));
1112  myEmissionClass->setVariable(toString(defaultVTypeParameters.emissionClass));
1113  myWidth->setVariable(toString(defaultVTypeParameters.width));
1114  myHeight->setVariable(toString(defaultVTypeParameters.height));
1115  myFilename->setVariable();
1116  myOSGFile->setVariable(toString(defaultVTypeParameters.osgFile));
1117  myPersonCapacity->setVariable(toString(defaultVTypeParameters.personCapacity));
1118  myContainerCapacity->setVariable(toString(defaultVTypeParameters.containerCapacity));
1119  myCarriageLength->setVariable(toString(defaultVTypeParameters.carriageLength));
1120  myLocomotiveLength->setVariable(toString(defaultVTypeParameters.locomotiveLength));
1121  myBoardingDuration->setVariable();
1122  myLoadingDuration->setVariable();
1123  myMinGapLat->setVariable();
1124  myMaxSpeedLat->setVariable();
1125  myActionStepLength->setVariable();
1126  myProbability->setVariable();
1127  myCarriageGap->setVariable();
1128  // JM Variables
1129  myJMCrossingGap->setVariable();
1130  myJMIgnoreKeepclearTime->setVariable();
1131  myJMDriveAfterYellowTime->setVariable();
1132  myJMDriveAfterRedTime->setVariable();
1133  myJMDriveRedSpeed->setVariable();
1134  myJMIgnoreFoeProb->setVariable();
1135  myJMIgnoreFoeSpeed->setVariable();
1136  myJMSigmaMinor->setVariable();
1137  myJMTimeGapMinor->setVariable();
1138  myJMImpatience->setVariable();
1139  // LCM Attributes
1140  myLCAStrategicParam->setVariable();
1141  myLCACooperativeParam->setVariable();
1142  myLCASpeedgainParam->setVariable();
1143  myLCAKeeprightParam->setVariable();
1144  myLCASublaneParam->setVariable();
1145  myLCAOppositeParam->setVariable();
1146  myLCAPushy->setVariable();
1147  myLCAPushygap->setVariable();
1148  myLCAAssertive->setVariable();
1149  myLCAImpatience->setVariable();
1150  myLCATimeToImpatience->setVariable();
1151  myLCAAccelLat->setVariable();
1152  myLCALookAheadLeft->setVariable();
1153  myLCASpeedGainRight->setVariable();
1154  myLCAMaxSpeedLatStanding->setVariable();
1155  myLCAMaxSpeedLatFactor->setVariable();
1156  myLCATurnAlignmentDistance->setVariable();
1157  myLCAOvertakeRight->setVariable();
1158  /* myLCAExperimental->setVariable(); */
1159  myParameters->setVariable();
1160  return true;
1161 }
1162 
1163 
1164 long
1166  // check what dialog has to be opened
1167  if (obj == myColor->getButton()) {
1168  myColor->openColorDialog();
1169  } else if (obj == myFilename->getButton()) {
1170  myFilename->openImageFileDialog();
1171  } else if (obj == myOSGFile->getButton()) {
1172  myFilename->openOSGFileDialog();
1173  }
1174  return 1;
1175 }
1176 
1177 
1178 long
1180  // write debug information
1181  WRITE_DEBUG("Open parameters dialog");
1182  // edit parameters using dialog
1183  if (GNESingleParametersDialog(myParameters, myVehicleTypeDialog->getEditedDemandElement()->getNet()->getViewNet()).execute()) {
1184  // write debug information
1185  WRITE_DEBUG("Close parameters dialog");
1186  // set values edited in Parameter dialog in Edited AC
1187  myVehicleTypeDialog->getEditedDemandElement()->setAttribute(GNE_ATTR_PARAMETERS, myParameters->getParametersStr(), myVehicleTypeDialog->getEditedDemandElement()->getNet()->getViewNet()->getUndoList());
1188  } else {
1189  // write debug information
1190  WRITE_DEBUG("Cancel parameters dialog");
1191  }
1192  return 1;
1193 }
1194 
1195 // ---------------------------------------------------------------------------
1196 // GNEVehicleTypeDialog::VShapeRow - methods
1197 // ---------------------------------------------------------------------------
1198 
1200  FXGroupBox(column, "Car Following Model attributes", GUIDesignGroupBoxFrame),
1201  myVehicleTypeDialog(vehicleTypeDialog) {
1202 
1203  // create vertical frame for rows
1204  myVerticalFrameRows = new FXVerticalFrame(this, GUIDesignAuxiliarFrame);
1205 
1206  // declare combo box
1207  FXHorizontalFrame* row = new FXHorizontalFrame(myVerticalFrameRows, GUIDesignAuxiliarHorizontalFrame);
1208  new FXLabel(row, "Algorithm", nullptr, GUIDesignLabelAttribute150);
1210 
1211  // fill combo Box with all Car following models
1212  std::vector<std::string> CFModels = SUMOXMLDefinitions::CarFollowModels.getStrings();
1213  for (auto i : CFModels) {
1214  myComboBoxCarFollowModel->appendItem(i.c_str());
1215  }
1216  myComboBoxCarFollowModel->setNumVisible(10);
1217 
1218  // 01 create FX and Label for Accel
1220  myRows.push_back(myAccelRow);
1221 
1222  // 02 create FX and Label for Decel
1224  myRows.push_back(myDecelRow);
1225 
1226  // 03 create FX and Label for Apparent decel
1228  myRows.push_back(myApparentDecelRow);
1229 
1230  // 04 create FX and Label for emergency decel
1232  myRows.push_back(myEmergencyDecelRow);
1233 
1234  // 05 create FX and Label for Sigma
1236  myRows.push_back(mySigmaRow);
1237 
1238  // 06 create FX and Label for Tau
1240  myRows.push_back(myTauRow);
1241 
1242  // 07 myMinGapFactor FX and Label for MinGapFactor
1244  myRows.push_back(myMinGapFactorRow);
1245 
1246  // 08 create FX and Label for K
1248  myRows.push_back(myKRow);
1249 
1250  // 09 create FX and Label for PHI
1252  myRows.push_back(myPhiRow);
1253 
1254  // 10 create FX and Label for Deleta
1256  myRows.push_back(myDeltaRow);
1257 
1258  // 11 create FX and Label for Stepping
1260  myRows.push_back(mySteppingRow);
1261 
1262  // 12 create FX and Label for Security
1264  myRows.push_back(mySecurityRow);
1265 
1266  // 13 create FX and Label for Estimation
1268  myRows.push_back(myEstimationRow);
1269 
1270  // 14 create FX and Label for TMP1
1272  myRows.push_back(myTmp1Row);
1273 
1274  // 15 create FX and Label for TMP2
1276  myRows.push_back(myTmp2Row);
1277 
1278  // 16 create FX and Label for TMP3
1280  myRows.push_back(myTmp3Row);
1281 
1282  // 17 create FX and Label for TMP4
1284  myRows.push_back(myTmp4Row);
1285 
1286  // 18 create FX and Label for TMP5
1288  myRows.push_back(myTmp5Row);
1289 
1290  // 19 create FX and Label for trainType (allow strings)
1292  myRows.push_back(myTrainTypeRow);
1293 
1294  // 20 create FX and Label for Tau Last
1296  myRows.push_back(myTrauLastRow);
1297 
1298  // 21 create FX and Label for Aprob
1300  myRows.push_back(myAprobRow);
1301 
1302  // 22 create FX and Label for Adapt Factor
1304  myRows.push_back(myAdaptFactorRow);
1305 
1306  // 23 create FX and Label for Adapt Time
1308  myRows.push_back(myAdaptTimeRow);
1309 
1310  // X1 create FX and Label for Look ahead/preview Time
1312  myRows.push_back(myTpreviewRow);
1313 
1314  // X2 create FX and Label for Reaction Time
1316  myRows.push_back(myTreactionRow);
1317 
1318  // X3 create FX and Label for Wiener Process Driving Error
1320  myRows.push_back(myTPersDriveRow);
1321 
1322  // X4 create FX and Label for Wiener Process Estimation Error
1324  myRows.push_back(myTPersEstimateRow);
1325 
1326  // X5 create FX and Label for Coolness parameter
1328  myRows.push_back(myCcoolnessRow);
1329 
1330  // X6 create FX and Label for leader speed estimation error
1332  myRows.push_back(mySigmaleaderRow);
1333 
1334  // X7 create FX and Label for Gap estimation error
1336  myRows.push_back(mySigmagapRow);
1337 
1338  // X8 create FX and Label for Driving Error
1340  myRows.push_back(mySigmaerrorRow);
1341 
1342  // X9 create FX and Label for max jerk
1344  myRows.push_back(myJerkmaxRow);
1345 
1346  // X10 create FX and Label for AP Driver Update threshold
1348  myRows.push_back(myEpsilonaccRow);
1349 
1350  // X11 create FX and Label for Startup Time to acc_max
1352  myRows.push_back(myTaccmaxRow);
1353 
1354  // X12 create FX and Label for Startup M flatness
1356  myRows.push_back(myMflatnessRow);
1357 
1358  // X13 create FX and Label for Startup M begin
1360  myRows.push_back(myMbeginRow);
1361 
1362  // X14 create FX and Label for using vehicle dynamics
1364  myRows.push_back(myUseVehDynamicsRow);
1365 
1366  // X14 create FX and Label for using vehicle dynamics
1368  myRows.push_back(myMaxVehPreviewRow);
1369 
1370  // create myLabelIncompleteAttribute
1371  myLabelIncompleteAttribute = new FXLabel(myVerticalFrameRows, "Some attributes wasn't\nimplemented yet", nullptr, GUIDesignLabelAboutInfoCenter);
1373 
1374  // show or hidde ComboBox depending of current selected CFM
1375  refreshCFMFields();
1376 }
1377 
1378 
1379 void
1381  // start hidding all rows
1382  for (const auto& i : myRows) {
1383  i->hide();
1384  }
1385  // hide myLabelIncompleteAttribute
1386  myLabelIncompleteAttribute->hide();
1387  // show textfield depending of current CFM
1388  if (SUMOXMLDefinitions::CarFollowModels.hasString(myComboBoxCarFollowModel->getText().text())) {
1389  // show textfield depending of selected CFM
1390  switch (SUMOXMLDefinitions::CarFollowModels.get(myComboBoxCarFollowModel->getText().text())) {
1391  case SUMO_TAG_CF_KRAUSS:
1394  myTauRow->show();
1395  myAccelRow->show();
1396  myDecelRow->show();
1397  myApparentDecelRow->show();
1398  myEmergencyDecelRow->show();
1399  mySigmaRow->show();
1400  break;
1401  case SUMO_TAG_CF_KRAUSSX:
1402  myTauRow->show();
1403  myTmp1Row->show();
1404  myTmp2Row->show();
1405  myTmp3Row->show();
1406  myTmp4Row->show();
1407  myTmp5Row->show();
1408  break;
1409  case SUMO_TAG_CF_SMART_SK:
1410  case SUMO_TAG_CF_DANIEL1:
1411  myTauRow->show();
1412  myAccelRow->show();
1413  myDecelRow->show();
1414  myEmergencyDecelRow->show();
1415  mySigmaRow->show();
1416  myMinGapFactorRow->show();
1417  myTmp1Row->show();
1418  myTmp2Row->show();
1419  myTmp3Row->show();
1420  myTmp4Row->show();
1421  myTmp5Row->show();
1422  break;
1424  myTauRow->show();
1425  myAccelRow->show();
1426  myDecelRow->show();
1427  myEmergencyDecelRow->show();
1428  mySigmaRow->show();
1429  myMinGapFactorRow->show();
1430  myTrauLastRow->show();
1431  myAprobRow->show();
1432  break;
1433  case SUMO_TAG_CF_IDM:
1434  myTauRow->show();
1435  myAccelRow->show();
1436  myDecelRow->show();
1437  myEmergencyDecelRow->show();
1438  myDeltaRow->show();
1439  mySteppingRow->show();
1440  myMinGapFactorRow->show();
1441  break;
1442  case SUMO_TAG_CF_IDMM:
1443  myTauRow->show();
1444  myAccelRow->show();
1445  myDecelRow->show();
1446  myEmergencyDecelRow->show();
1447  myDeltaRow->show();
1448  mySteppingRow->show();
1449  myMinGapFactorRow->show();
1450  myAdaptFactorRow->show();
1451  myAdaptTimeRow->show();
1452  break;
1453  case SUMO_TAG_CF_EIDM:
1454  myTauRow->show();
1455  myAccelRow->show();
1456  myDecelRow->show();
1457  myEmergencyDecelRow->show();
1458  myDeltaRow->show();
1459  mySteppingRow->show();
1460  myMinGapFactorRow->show();
1461  myTpreviewRow->show();
1462  myTreactionRow->show();
1463  myTPersDriveRow->show();
1464  myTPersEstimateRow->show();
1465  myCcoolnessRow->show();
1466  mySigmaleaderRow->show();
1467  mySigmagapRow->show();
1468  mySigmaerrorRow->show();
1469  myJerkmaxRow->show();
1470  myEpsilonaccRow->show();
1471  myTaccmaxRow->show();
1472  myMflatnessRow->show();
1473  myMbeginRow->show();
1474  myUseVehDynamicsRow->show();
1475  myMaxVehPreviewRow->show();
1476  break;
1477  case SUMO_TAG_CF_BKERNER:
1478  myTauRow->show();
1479  myAccelRow->show();
1480  myDecelRow->show();
1481  myEmergencyDecelRow->show();
1482  myKRow->show();
1483  myPhiRow->show();
1484  myMinGapFactorRow->show();
1485  break;
1486  case SUMO_TAG_CF_WIEDEMANN:
1487  myTauRow->show();
1488  myAccelRow->show();
1489  myDecelRow->show();
1490  myEmergencyDecelRow->show();
1491  myMinGapFactorRow->show();
1492  mySecurityRow->show();
1493  myEstimationRow->show();
1494  break;
1495  case SUMO_TAG_CF_RAIL:
1496  myTauRow->show();
1497  myTrainTypeRow->show();
1498  break;
1499  case SUMO_TAG_CF_ACC:
1500  myTauRow->show();
1501  myAccelRow->show();
1502  myDecelRow->show();
1503  myEmergencyDecelRow->show();
1504  myMinGapFactorRow->show();
1505  // show myLabelIncompleteAttribute
1506  myLabelIncompleteAttribute->show();
1517  break;
1518  case SUMO_TAG_CF_CACC:
1519  myTauRow->show();
1520  myAccelRow->show();
1521  myDecelRow->show();
1522  myEmergencyDecelRow->show();
1523  myMinGapFactorRow->show();
1524  // show myLabelIncompleteAttribute
1525  myLabelIncompleteAttribute->show();
1542  break;
1543  case SUMO_TAG_CF_CC:
1544  myTauRow->show();
1545  myAccelRow->show();
1546  myDecelRow->show();
1547  // show myLabelIncompleteAttribute
1548  myLabelIncompleteAttribute->show();
1570  break;
1571  default:
1572  break;
1573  }
1574  }
1575  myVerticalFrameRows->recalc();
1576  update();
1577 }
1578 
1579 
1580 void
1582  //set values of myEditedDemandElement into fields
1583  if (myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_CAR_FOLLOW_MODEL).empty()) {
1584  myComboBoxCarFollowModel->setCurrentItem(0);
1585  } else {
1586  myComboBoxCarFollowModel->setText(myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_CAR_FOLLOW_MODEL).c_str());
1587  }
1588  // refresh fields
1589  refreshCFMFields();
1590  // update value in all Rows
1591  for (const auto& i : myRows) {
1592  i->updateValue();
1593  }
1594 }
1595 
1596 
1597 long
1599  // At start we assumed, that all values are valid
1600  myVehicleTypeDialog->myVehicleTypeValid = true;
1601  myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_NOTHING;
1602  // set color of myTextFieldCarFollowModel, depending if current value is valid or not
1603  if (myVehicleTypeDialog->myEditedDemandElement->isValid(SUMO_ATTR_CAR_FOLLOW_MODEL, myComboBoxCarFollowModel->getText().text())) {
1604  myComboBoxCarFollowModel->setTextColor(FXRGB(0, 0, 0));
1605  myVehicleTypeDialog->myEditedDemandElement->setAttribute(SUMO_ATTR_CAR_FOLLOW_MODEL, myComboBoxCarFollowModel->getText().text(), myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
1606  } else {
1607  myComboBoxCarFollowModel->setTextColor(FXRGB(255, 0, 0));
1608  myVehicleTypeDialog->myVehicleTypeValid = false;
1609  myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_CAR_FOLLOW_MODEL;
1610  }
1611  // set variable in all Rows
1612  for (const auto& i : myRows) {
1613  i->setVariable();
1614  }
1615  // refresh fields
1616  refreshCFMFields();
1617  return true;
1618 }
1619 
1620 // ---------------------------------------------------------------------------
1621 // GNEVehicleTypeDialog - public methods
1622 // ---------------------------------------------------------------------------
1623 
1624 GNEVehicleTypeDialog::GNEVehicleTypeDialog(GNEDemandElement* editedVehicleType, bool updatingElement) :
1625  GNEDemandElementDialog(editedVehicleType, updatingElement, /*1022*/ /*1322*/ 1372, 575),
1626  myVehicleTypeValid(true),
1628 
1629  // change default header
1630  changeDemandElementDialogHeader(updatingElement ? "Edit " + myEditedDemandElement->getTagStr() : "Create " + myEditedDemandElement->getTagStr());
1631 
1632  // Create auxiliar frames for values
1633  FXHorizontalFrame* columns = new FXHorizontalFrame(myContentFrame, GUIDesignAuxiliarHorizontalFrame);
1634 
1635  // create vehicle type attributes
1636  myVTypeAtributes = new VTypeAtributes(this, columns);
1637 
1638  // create car following model parameters
1640 
1641  // start a undo list for editing local to this additional
1642  initChanges();
1643 
1644  // add element if we aren't updating an existent element
1645  if (myUpdatingElement == false) {
1647  }
1648 
1649  // update values of Vehicle Type common attributes
1651 
1652  // update values of Car Following Model Parameters
1654 
1655  // open as modal dialog
1657 }
1658 
1659 
1661 
1662 
1663 long
1664 GNEVehicleTypeDialog::onCmdAccept(FXObject*, FXSelector, void*) {
1665  if (myVehicleTypeValid == false) {
1666  // write warning if netedit is running in testing mode
1667  WRITE_DEBUG("Opening FXMessageBox of type 'warning'");
1668  std::string operation1 = myUpdatingElement ? ("updating") : ("creating");
1669  std::string operation2 = myUpdatingElement ? ("updated") : ("created");
1670  std::string tagString = myEditedDemandElement->getTagStr();
1671  // open warning dialogBox
1672  FXMessageBox::warning(getApp(), MBOX_OK,
1673  ("Error " + operation1 + " " + tagString).c_str(), "%s",
1674  (tagString + " cannot be " + operation2 +
1675  " because parameter " + toString(myInvalidAttr) +
1676  " is invalid.").c_str());
1677  // write warning if netedit is running in testing mode
1678  WRITE_DEBUG("Closed FXMessageBox of type 'warning' with 'OK'");
1679  return 0;
1680  } else {
1681  // accept changes before closing dialog
1682  acceptChanges();
1683  // stop dialgo sucesfully
1684  getApp()->stopModal(this, TRUE);
1685  return 1;
1686  }
1687 }
1688 
1689 
1690 long
1691 GNEVehicleTypeDialog::onCmdCancel(FXObject*, FXSelector, void*) {
1692  // cancel changes
1693  cancelChanges();
1694  // Stop Modal
1695  getApp()->stopModal(this, FALSE);
1696  return 1;
1697 }
1698 
1699 
1700 long
1701 GNEVehicleTypeDialog::onCmdReset(FXObject*, FXSelector, void*) {
1702  // reset changes
1703  resetChanges();
1704  // update values of Vehicle Type common attributes
1706  // update values of Car Following Model Parameters
1708  return 1;
1709 }
1710 
1711 // ---------------------------------------------------------------------------
1712 // GNEVehicleTypeDialog - private methods
1713 // ---------------------------------------------------------------------------
1714 
1716  FXHorizontalFrame(verticalFrame, GUIDesignAuxiliarHorizontalFrame),
1717  myCarFollowingModelParametersParent(carFollowingModelParametersParent),
1718  myAttr(attr),
1719  myTextField(nullptr) {
1720  new FXLabel(this, toString(attr).c_str(), nullptr, GUIDesignLabelAttribute150);
1721  myTextField = new FXTextField(this, GUIDesignTextFieldNCol, carFollowingModelParametersParent, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFielWidth180);
1722 }
1723 
1724 
1725 void
1727  // set color of textField, depending if current value is valid or not
1728  if (myCarFollowingModelParametersParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, myTextField->getText().text())) {
1729  // set color depending if is a default value
1730  if (myCarFollowingModelParametersParent->myVehicleTypeDialog->myEditedDemandElement->getTagProperty().getDefaultValue(myAttr) != myTextField->getText().text()) {
1731  myTextField->setTextColor(FXRGB(0, 0, 0));
1732  } else {
1733  myTextField->setTextColor(FXRGB(195, 195, 195));
1734  }
1735  myCarFollowingModelParametersParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, myTextField->getText().text(),
1736  myCarFollowingModelParametersParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
1737  // update value after setting it
1738  updateValue();
1739  } else {
1740  myTextField->setTextColor(FXRGB(255, 0, 0));
1741  // mark VType as invalid
1742  myCarFollowingModelParametersParent->myVehicleTypeDialog->myVehicleTypeValid = false;
1743  myCarFollowingModelParametersParent->myVehicleTypeDialog->myInvalidAttr = myAttr;
1744  }
1745 }
1746 
1747 
1748 void
1750  // set text of myTextField using current value of VType
1751  myTextField->setText(myCarFollowingModelParametersParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr).c_str());
1752  // set color depending if is a default value
1753  if (myCarFollowingModelParametersParent->myVehicleTypeDialog->myEditedDemandElement->getTagProperty().getDefaultValue(myAttr) != myTextField->getText().text()) {
1754  myTextField->setTextColor(FXRGB(0, 0, 0));
1755  } else {
1756  myTextField->setTextColor(FXRGB(195, 195, 195));
1757  }
1758 }
1759 
1760 
1761 /****************************************************************************/
FXDEFMAP(GNEVehicleTypeDialog::VTypeAtributes) VTypeAtributesMap[]
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition: GUIAppEnum.h:797
@ MID_GNE_OPEN_PARAMETERS_DIALOG
open parameters dialog
Definition: GUIAppEnum.h:833
@ MID_GNE_SET_ATTRIBUTE_DIALOG
attribute edited trought dialog
Definition: GUIAppEnum.h:831
#define GUIDesignComboBox
Definition: GUIDesigns.h:267
#define GUIDesignComboBoxWidth180
comboBox with thick frame, width 180 (Used in GNEVType)
Definition: GUIDesigns.h:279
#define GUIDesignComboBoxNCol
number of column of every combo box
Definition: GUIDesigns.h:285
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition: GUIDesigns.h:343
#define GUIDesignTextFielWidth180
text field with thick frame, width of 180 (Used in type frame)
Definition: GUIDesigns.h:57
#define GUIDesignLabelTickedIcon180x46
label ticked filled extended over frame used for VClasses/VShapes. (can be used by icons of 64x32 pix...
Definition: GUIDesigns.h:241
#define GUIDesignLabelAboutInfoCenter
label extended over frame with thick and with text justify to center
Definition: GUIDesigns.h:226
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition: GUIDesigns.h:60
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
Definition: GUIDesigns.h:308
#define GUIDesignAuxiliarVerticalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition: GUIDesigns.h:346
#define GUIDesignButtonRectangular150
button rectangular with thick and raise frame with a width of 150
Definition: GUIDesigns.h:86
#define GUIDesignLabelAttribute150
label extended over the matrix column with thick frame
Definition: GUIDesigns.h:220
#define GUIDesignAuxiliarFrame
design for auxiliar (Without borders) frames used to pack another frames extended in all directions
Definition: GUIDesigns.h:340
FXString gCurrentFolder
The folder used as last.
@ VCLASS_TRAILER
@ VCLASS_PASSENGER
@ VSHAPE_PEDESTRIAN
@ VSHAPE_PASSENGER
@ VCLASS_BICYCLE
@ VSHAPE_UNKNOWN
@ VSHAPE_FIREBRIGADE
@ VSHAPE_EMERGENCY
@ VSHAPE_PASSENGER_VAN
@ VSHAPE_PASSENGER_WAGON
@ VSHAPE_MOPED
@ VCLASS_CUSTOM2
@ VSHAPE_RAIL_CAR
@ VCLASS_MOTORCYCLE
@ VCLASS_COACH
@ VCLASS_AUTHORITY
@ VCLASS_TRUCK
@ VCLASS_MOPED
@ VSHAPE_E_VEHICLE
@ VCLASS_PEDESTRIAN
@ VCLASS_PRIVATE
@ VSHAPE_PASSENGER_HATCHBACK
@ VSHAPE_TRUCK_1TRAILER
@ VSHAPE_POLICE
@ VSHAPE_RAIL_CARGO
@ VSHAPE_BICYCLE
@ VCLASS_CUSTOM1
@ VSHAPE_BUS_TROLLEY
@ VSHAPE_DELIVERY
@ VSHAPE_PASSENGER_SEDAN
@ VSHAPE_BUS_FLEXIBLE
@ VCLASS_DELIVERY
@ VSHAPE_RICKSHAW
@ VSHAPE_MOTORCYCLE
@ VCLASS_RAIL_ELECTRIC
@ VCLASS_IGNORING
@ VSHAPE_TRUCK
@ VCLASS_EMERGENCY
@ VSHAPE_BUS_COACH
@ VCLASS_RAIL_URBAN
@ VSHAPE_TRUCK_SEMITRAILER
@ VCLASS_EVEHICLE
@ VSHAPE_SCOOTER
#define WRITE_DEBUG(msg)
Definition: MsgHandler.h:290
SUMOVehicleShape getVehicleShapeID(const std::string &name)
Returns the class id of the shape class given by its name.
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
StringBijection< SUMOVehicleShape > SumoVehicleShapeStrings(sumoVehicleShapeStringInitializer, SUMOVehicleShape::UNKNOWN, false)
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_SHIP
is an arbitrary ship
@ SVC_PRIVATE
private vehicles
@ SVC_VIP
vip vehicles
@ SVC_HOV
vehicle is a HOV
@ SVC_TRUCK
vehicle is a large transport vehicle
@ SVC_IGNORING
vehicles ignoring classes
@ SVC_CUSTOM2
is a user-defined type
@ SVC_RAIL
vehicle is a not electrified rail
@ SVC_COACH
vehicle is a coach
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_RAIL_FAST
vehicle that is allowed to drive on high-speed rail tracks
@ SVC_TRAILER
vehicle is a large transport vehicle
@ SVC_CUSTOM1
is a user-defined type
@ SVC_ARMY
army vehicles
@ SVC_RAIL_ELECTRIC
rail vehicle that requires electrified tracks
@ SVC_DELIVERY
vehicle is a small delivery vehicle
@ SVC_RAIL_URBAN
vehicle is a city rail
@ SVC_MOTORCYCLE
vehicle is a motorcycle
@ SVC_EMERGENCY
public emergency vehicles
@ SVC_MOPED
vehicle is a moped
@ SVC_AUTHORITY
authorities vehicles
@ SVC_TRAM
vehicle is a light rail
@ SVC_TAXI
vehicle is a taxi
@ SVC_BUS
vehicle is a bus
@ SVC_E_VEHICLE
is an electric vehicle
@ SVC_PEDESTRIAN
pedestrian
@ RICKSHAW
render as a rickshaw
@ BUS
render as a bus
@ RAIL_CARGO
render as a cargo train
@ EMERGENCY
render as an emergency vehicle
@ RAIL
render as a rail
@ PASSENGER_VAN
render as a van
@ PASSENGER
render as a passenger vehicle
@ SCOOTER
render as a scooter
@ RAIL_CAR
render as a (city) rail without locomotive
@ SHIP
render as a arbitrary ship
@ DELIVERY
automated car (with cruise controllers)
@ BICYCLE
render as a bicycle
@ MOTORCYCLE
render as a motorcycle
@ UNKNOWN
not defined
@ BUS_TROLLEY
render as a trolley bus
@ E_VEHICLE
render as a (futuristic) e-vehicle
@ ANT
render as a giant ant
@ TRUCK
render as a transport vehicle
@ FIREBRIGADE
render as a fire brigade
@ PASSENGER_HATCHBACK
render as a hatchback passenger vehicle ("Fliessheck")
@ MOPED
render as a moped
@ BUS_FLEXIBLE
render as a flexible city bus
@ TRUCK_1TRAILER
render as a transport vehicle with one trailer
@ PASSENGER_SEDAN
render as a sedan passenger vehicle ("Stufenheck")
@ BUS_COACH
render as a coach
@ POLICE
render as a police car
@ PASSENGER_WAGON
render as a wagon passenger vehicle ("Combi")
@ TRUCK_SEMITRAILER
render as a semi-trailer transport vehicle ("Sattelschlepper")
@ PEDESTRIAN
render as a pedestrian
@ SUMO_TAG_CF_KRAUSS
@ SUMO_TAG_CF_BKERNER
@ SUMO_TAG_CF_KRAUSSX
@ SUMO_TAG_CF_CACC
@ SUMO_TAG_CF_CC
@ SUMO_TAG_CF_KRAUSS_PLUS_SLOPE
@ SUMO_TAG_CF_IDM
@ SUMO_TAG_CF_RAIL
@ SUMO_TAG_CF_SMART_SK
@ SUMO_TAG_CF_EIDM
@ SUMO_TAG_CF_PWAGNER2009
@ SUMO_TAG_CF_KRAUSS_ORIG1
@ SUMO_TAG_CF_WIEDEMANN
@ SUMO_TAG_CF_IDMM
@ SUMO_TAG_CF_DANIEL1
@ SUMO_TAG_CF_ACC
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_TMP4
@ SUMO_ATTR_CF_EIDM_T_ACC_MAX
@ SUMO_ATTR_CF_EIDM_EPSILON_ACC
@ SUMO_ATTR_LCA_PUSHY
@ SUMO_ATTR_EMISSIONCLASS
@ SUMO_ATTR_JM_IGNORE_FOE_SPEED
@ SUMO_ATTR_JM_IGNORE_KEEPCLEAR_TIME
@ SUMO_ATTR_CF_EIDM_T_LOOK_AHEAD
@ SUMO_ATTR_CF_WIEDEMANN_SECURITY
@ SUMO_ATTR_LCA_ASSERTIVE
@ SUMO_ATTR_TRAIN_TYPE
@ SUMO_ATTR_CF_EIDM_USEVEHDYNAMICS
@ SUMO_ATTR_CF_IDMM_ADAPT_TIME
@ SUMO_ATTR_LANE_CHANGE_MODEL
@ SUMO_ATTR_CF_KERNER_PHI
@ SUMO_ATTR_LCA_TURN_ALIGNMENT_DISTANCE
@ SUMO_ATTR_CF_EIDM_C_COOLNESS
@ SUMO_ATTR_CF_EIDM_SIG_ERROR
@ SUMO_ATTR_LCA_PUSHYGAP
@ SUMO_ATTR_LCA_LOOKAHEADLEFT
@ SUMO_ATTR_APPARENTDECEL
@ SUMO_ATTR_MAXSPEED_LAT
@ SUMO_ATTR_LCA_SPEEDGAIN_PARAM
@ SUMO_ATTR_TMP3
@ SUMO_ATTR_ACTIONSTEPLENGTH
@ SUMO_ATTR_LCA_IMPATIENCE
@ SUMO_ATTR_MINGAP
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_JM_DRIVE_AFTER_RED_TIME
@ SUMO_ATTR_TMP2
@ SUMO_ATTR_LOADING_DURATION
@ SUMO_ATTR_CF_IDM_DELTA
@ SUMO_ATTR_CF_EIDM_MAX_VEH_PREVIEW
@ SUMO_ATTR_LCA_MAXSPEEDLATFACTOR
@ SUMO_ATTR_CF_EIDM_T_REACTION
@ SUMO_ATTR_CF_EIDM_T_PERSISTENCE_ESTIMATE
@ SUMO_ATTR_CF_PWAGNER2009_TAULAST
@ SUMO_ATTR_CF_EIDM_SIG_GAP
@ SUMO_ATTR_CAR_FOLLOW_MODEL
@ SUMO_ATTR_CF_EIDM_JERK_MAX
@ SUMO_ATTR_DECEL
@ SUMO_ATTR_LCA_MAXSPEEDLATSTANDING
@ SUMO_ATTR_JM_DRIVE_AFTER_YELLOW_TIME
@ SUMO_ATTR_LCA_KEEPRIGHT_PARAM
@ SUMO_ATTR_GUISHAPE
@ SUMO_ATTR_JM_IGNORE_FOE_PROB
@ SUMO_ATTR_CONTAINER_CAPACITY
@ SUMO_ATTR_LCA_COOPERATIVE_PARAM
@ SUMO_ATTR_LCA_OPPOSITE_PARAM
@ SUMO_ATTR_MINGAP_LAT
@ SUMO_ATTR_EMERGENCYDECEL
@ SUMO_ATTR_HEIGHT
@ SUMO_ATTR_LCA_SUBLANE_PARAM
@ SUMO_ATTR_JM_CROSSING_GAP
@ SUMO_ATTR_CARRIAGE_LENGTH
@ SUMO_ATTR_LATALIGNMENT
@ SUMO_ATTR_CF_IDM_STEPPING
@ SUMO_ATTR_CF_IDMM_ADAPT_FACTOR
@ SUMO_ATTR_IMPATIENCE
@ SUMO_ATTR_COLLISION_MINGAP_FACTOR
@ SUMO_ATTR_VCLASS
@ SUMO_ATTR_ACCEL
@ SUMO_ATTR_BOARDING_DURATION
@ SUMO_ATTR_CF_EIDM_M_FLATNESS
@ SUMO_ATTR_JM_SIGMA_MINOR
@ SUMO_ATTR_PROB
@ SUMO_ATTR_CF_EIDM_M_BEGIN
@ SUMO_ATTR_CF_EIDM_T_PERSISTENCE_DRIVE
@ SUMO_ATTR_SPEEDFACTOR
@ SUMO_ATTR_CF_EIDM_SIG_LEADER
@ SUMO_ATTR_LENGTH
@ SUMO_ATTR_COLOR
A color information.
@ SUMO_ATTR_CF_PWAGNER2009_APPROB
@ SUMO_ATTR_MAXSPEED
@ SUMO_ATTR_ID
@ SUMO_ATTR_SIGMA
@ SUMO_ATTR_K
@ SUMO_ATTR_TMP1
@ SUMO_ATTR_OSGFILE
@ SUMO_ATTR_LCA_OVERTAKE_RIGHT
@ SUMO_ATTR_LCA_ACCEL_LAT
@ SUMO_ATTR_LCA_STRATEGIC_PARAM
@ SUMO_ATTR_TAU
@ SUMO_ATTR_IMGFILE
@ SUMO_ATTR_WIDTH
@ SUMO_ATTR_PERSON_CAPACITY
@ SUMO_ATTR_LOCOMOTIVE_LENGTH
@ SUMO_ATTR_TMP5
@ SUMO_ATTR_NOTHING
invalid attribute
@ SUMO_ATTR_JM_DRIVE_RED_SPEED
@ SUMO_ATTR_LCA_TIME_TO_IMPATIENCE
@ SUMO_ATTR_JM_TIMEGAP_MINOR
@ SUMO_ATTR_CARRIAGE_GAP
@ SUMO_ATTR_CF_WIEDEMANN_ESTIMATION
@ SUMO_ATTR_LCA_SPEEDGAINRIGHT
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
std::vector< double > & getParameter()
Returns the parameters of this distribution.
const std::string & getTagStr() const
get tag assigned to this object in string format
GNENet * getNet() const
get pointer to net
Dialog to edit sequences, parameters, etc.. of DemandElements.
void acceptChanges()
Accept changes did in this dialog.
GNEDemandElement * myEditedDemandElement
pointer to edited aditional
FXVerticalFrame * myContentFrame
frame for contents
bool myUpdatingElement
flag to indicate if additional are being created or modified (cannot be changed after open dialog)
FXint openAsModalDialog(FXuint placement=PLACEMENT_CURSOR)
execute dialog as modal
void initChanges()
init a new group of changes that will be do it in dialog
void cancelChanges()
Cancel changes did in this dialog.
void changeDemandElementDialogHeader(const std::string &newHeader)
change additional dialog header
void resetChanges()
reset changes did in this dialog.
An Element which don't belongs to GNENet but has influency in the simulation.
virtual SUMOVehicleClass getVClass() const =0
virtual bool isAttributeEnabled(SumoXMLAttr key) const =0
virtual std::string getAttribute(SumoXMLAttr key) const =0
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
method for setting the attribute and letting the object perform demand element changes
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
method for checking if the key and their conrrespond attribute are valids
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1964
Dialog for edit parameters.
void add(GNEChange *command, bool doit=false, bool merge=true)
Add new command, executing it if desired. The new command will be merged with the previous command if...
class used for represent rows with Car Following Model parameters
CarFollowingModelRow(CarFollowingModelParameters *carFollowingModelParametersParent, FXVerticalFrame *verticalFrame, SumoXMLAttr attr)
constructor
CarFollowingModelRow * myPhiRow
Row for MinGap (only for Kerner)
CarFollowingModelRow * myTpreviewRow
Row for Look ahead/preview Time.
CarFollowingModelRow * mySteppingRow
Row for MinGap(only for IDM)
CarFollowingModelRow * myMflatnessRow
Row for Startup M flatness.
CarFollowingModelRow * myTreactionRow
Row for Reaction Time.
FXLabel * myLabelIncompleteAttribute
temporal label for incomplete attributes
CarFollowingModelRow * myCcoolnessRow
Row for Coolness parameter.
CarFollowingModelRow * mySigmagapRow
Row for Gap estimation error.
CarFollowingModelRow * mySecurityRow
Row for Security (only for Wiedemann)
CarFollowingModelRow * myAccelRow
Row for Accel.
CarFollowingModelRow * myEpsilonaccRow
Row for AP Driver Update threshold.
CarFollowingModelRow * myAprobRow
Row for Aprob.
CarFollowingModelRow * myKRow
Row for MinGap (only for Kerner)
CarFollowingModelRow * myTPersDriveRow
Row for Wiener Process Driving Error.
long onCmdSetVariable(FXObject *, FXSelector, void *)
CarFollowingModelRow * myMaxVehPreviewRow
Row for Using vehicle preview.
CarFollowingModelRow * myAdaptFactorRow
Row for Adapt Factor.
CarFollowingModelRow * myTPersEstimateRow
Row for Wiener Process Estimation Error.
CarFollowingModelRow * myJerkmaxRow
Row for max jerk.
FXVerticalFrame * myVerticalFrameRows
Vertical Frame for CarFollowingModelRow.
CarFollowingModelRow * myTaccmaxRow
Row for Startup Time to acc_max.
CarFollowingModelRow * myApparentDecelRow
Row for aparent Decel.
CarFollowingModelRow * myDecelRow
Row for Decel.
std::vector< CarFollowingModelRow * > myRows
vector with the Car Following Model Row
FXComboBox * myComboBoxCarFollowModel
Row for CarFollowModel.
CarFollowingModelRow * myEmergencyDecelRow
Row for emergency Decel.
CarFollowingModelRow * mySigmaleaderRow
Row for leader speed estimation error.
CarFollowingModelRow * myTrainTypeRow
Row for TrainType.
void refreshCFMFields()
refresh Car Following Model Fields
CarFollowingModelRow * myEstimationRow
Row for Estimation (only for Wiedemann)
CarFollowingModelRow * mySigmaRow
Row for Sigma.
CarFollowingModelRow * myMbeginRow
Row for Startup M begin.
CarFollowingModelRow * mySigmaerrorRow
Row for Driving Error.
CarFollowingModelRow * myAdaptTimeRow
Row for Adapt Time.
CarFollowingModelRow * myDeltaRow
Row for MinGap (only for IDM)
CarFollowingModelRow * myTrauLastRow
Row for TauLast.
CarFollowingModelRow * myUseVehDynamicsRow
Row for Using vehicle dynamics.
CarFollowingModelParameters(GNEVehicleTypeDialog *vehicleTypeDialog, FXHorizontalFrame *column)
FOX-declaration.
CarFollowingModelRow * myMinGapFactorRow
Row for MinGapFactor.
FXComboBox * myComboBoxVClass
FXComboBox for VClass.
VTypeAtributes * myVTypeAtributesParent
pointer to VTypeAtributes parent
SUMOVehicleClass setVariable()
set vehicle class
VShapeRow(VTypeAtributes *VTypeAtributesParent, FXVerticalFrame *column)
constructor
FXLabel * myComboBoxShapeLabelImage
label with image of Shape
FXComboBox * myComboBoxShape
FXComboBox for Shape.
class used for represent rows with Vehicle Type parameters
std::string getParametersStr() const
get parameters as string
void updateValue()
update value of Vehicle Type (using default value obtained from GNEAttributeCarrier)
void setParameters(const std::vector< std::pair< std::string, std::string > > &parameters)
set parameters
FXComboBox * myComboBox
ComboBox for attributes with limited values.
std::vector< std::pair< std::string, std::string > > getParametersVectorStr() const
get parameters as vector of strings
FXString filterAttributeName(const SumoXMLAttr attr) const
filter attribute name
void setVariable()
set Variablen in VehicleType (using default value obtained from GNEAttributeCarrier)
VTypeAttributeRow(VTypeAtributes *VTypeAtributesParent, FXVerticalFrame *verticalFrame, const SumoXMLAttr attr, const RowAttrType rowAttrType, const std::vector< std::string > &values={})
constructor
VTypeAttributeRow * myContainerCapacity
VTypeAttributeRow for ContainerCapacity.
VTypeAttributeRow * myHeight
VTypeAttributeRow for Height.
VTypeAttributeRow * myLocomotiveLength
VTypeAttributeRow for locomotive length.
void buildJunctionModelAttributesB(FXVerticalFrame *column)
build JunctionModel attributes (B)
GNEVehicleTypeDialog * myVehicleTypeDialog
VTypeAttributeRow for experimental.
long onCmdSetAttribute(FXObject *, FXSelector, void *)
VTypeAttributeRow * myLength
VTypeAttributeRow for Length.
VTypeAttributeRow * myParameters
VTypeAttributeRow for parameters.
VTypeAttributeRow * myCarriageLength
VTypeAttributeRow for carriage length.
long onCmdOpenAttributeDialog(FXObject *obj, FXSelector, void *)
@event called after press a button dialog
VTypeAttributeRow * myMinGap
VTypeAttributeRow for MinGap.
VTypeAttributeRow * myPersonCapacity
VTypeAttributeRow for PersonCapacity.
VTypeAttributeRow * myEmissionClass
VTypeAttributeRow for EmissionClass.
void buildAttributesB(FXVerticalFrame *column)
build commmon attributes (B)
void buildLaneChangeModelAttributes(FXVerticalFrame *column)
build LaneChangeModel attributes
VTypeAttributeRow * myOSGFile
VTypeAttributeRow for OSG.
void buildAttributesA(FXVerticalFrame *column)
build commmon attributes (A)
VTypeAttributeRow * myMaxSpeed
VTypeAttributeRow for MaxSpeed.
VTypeAtributes(GNEVehicleTypeDialog *vehicleTypeDialog, FXHorizontalFrame *column)
constructor
VTypeAttributeRow * mySpeedFactor
VTypeAttributeRow for SpeedFactor.
VTypeAttributeRow * myWidth
VTypeAttributeRow for Width.
long onCmdOpenParametersEditor(FXObject *obj, FXSelector, void *)
@event called after press a button dialog
void buildJunctionModelAttributesA(FXVerticalFrame *column)
build JunctionModel attributes (A)
Dialog for edit rerouter intervals.
VTypeAtributes * myVTypeAtributes
Vehicle Type Common Attributes.
long onCmdCancel(FXObject *, FXSelector, void *)
event after press cancel button
SumoXMLAttr myInvalidAttr
current sumo attribute invalid
bool myVehicleTypeValid
flag to check if current vehicleType is valid
long onCmdReset(FXObject *, FXSelector, void *)
event after press reset button
CarFollowingModelParameters * myCarFollowingModelParameters
Car Following model parameters.
GNEVehicleTypeDialog(GNEDemandElement *editedVehicleType, bool updatingElement)
constructor
long onCmdAccept(FXObject *, FXSelector, void *)
GNEUndoList * getUndoList() const
get the undoList object
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Definition: MFXUtils.cpp:112
static RGBColor getRGBColor(FXColor col)
converts FXColor to RGBColor
Definition: MFXUtils.cpp:106
static const std::vector< std::string > & getAllClassesStr()
Get all SUMOEmissionClass in string format.
static const RGBColor BLACK
Definition: RGBColor.h:193
static std::vector< std::string > getLatAlignmentStrings()
return all valid strings for latAlignment
static StringBijection< SumoXMLTag > CarFollowModels
car following models
static StringBijection< LaneChangeModel > LaneChangeModels
lane change models
std::vector< std::string > getStrings() const
std::vector< std::string > getVector()
return vector of strings
bool hasNext()
returns the information whether further substrings exist
std::string next()
returns the next substring when it exists. Otherwise the behaviour is undefined
struct for default values that depend of VClass
int personCapacity
The person capacity of the vehicle.
double carriageLength
the length of train carriages
std::string osgFile
3D model file for this class
SUMOEmissionClass emissionClass
The emission class of this vehicle.
double minGap
This class' free space in front of the vehicle itself.
int containerCapacity
The container capacity of the vehicle.
double maxSpeed
The vehicle type's maximum speed [m/s].
Distribution_Parameterized speedFactor
The factor by which the maximum speed may deviate from the allowed max speed on the street.
double length
The physical vehicle length.
double locomotiveLength
the length of train locomotive