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-2020 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  }
120  }
122  myVTypeAtributesParent->myWidth->updateValue(toString(defaultVTypeParameters.width));
123  }
125  myVTypeAtributesParent->myHeight->updateValue(toString(defaultVTypeParameters.height));
126  }
128  myVTypeAtributesParent->myOSGFile->updateValue(toString(defaultVTypeParameters.osgFile));
129  }
132  }
135  }
138  }
141  }
142  }
143  } else {
144  myComboBoxVClass->setTextColor(FXRGB(255, 0, 0));
147  }
149 }
150 
151 
154  myComboBoxVClass->setText(myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_VCLASS).c_str());
155  setVClassLabelImage();
156  return myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getVClass();
157 }
158 
159 
160 void
162  // by default vclass is passenger
163  if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_VCLASS).empty()) {
164  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_PASSENGER));
165  } else {
166  // set Icon in label depending of current VClass
167  switch (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getVClass()) {
168  case SVC_PRIVATE:
169  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_PRIVATE));
170  break;
171  case SVC_EMERGENCY:
172  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_EMERGENCY));
173  break;
174  case SVC_AUTHORITY:
175  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_AUTHORITY));
176  break;
177  case SVC_ARMY:
178  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_ARMY));
179  break;
180  case SVC_VIP:
181  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_VIP));
182  break;
183  case SVC_PASSENGER:
184  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_PASSENGER));
185  break;
186  case SVC_HOV:
187  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_HOV));
188  break;
189  case SVC_TAXI:
190  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_TAXI));
191  break;
192  case SVC_BUS:
193  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_BUS));
194  break;
195  case SVC_COACH:
196  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_COACH));
197  break;
198  case SVC_DELIVERY:
199  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_DELIVERY));
200  break;
201  case SVC_TRUCK:
202  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_TRUCK));
203  break;
204  case SVC_TRAILER:
205  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_TRAILER));
206  break;
207  case SVC_TRAM:
208  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_TRAM));
209  break;
210  case SVC_RAIL_URBAN:
211  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_RAIL_URBAN));
212  break;
213  case SVC_RAIL:
214  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_RAIL));
215  break;
216  case SVC_RAIL_ELECTRIC:
217  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_RAIL_ELECTRIC));
218  break;
219  case SVC_RAIL_FAST:
220  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_RAIL_ELECTRIC));
221  break;
222  case SVC_MOTORCYCLE:
223  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_MOTORCYCLE));
224  break;
225  case SVC_MOPED:
226  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_MOPED));
227  break;
228  case SVC_BICYCLE:
229  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_BICYCLE));
230  break;
231  case SVC_PEDESTRIAN:
232  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_PEDESTRIAN));
233  break;
234  case SVC_E_VEHICLE:
235  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_EVEHICLE));
236  break;
237  case SVC_SHIP:
238  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_SHIP));
239  break;
240  case SVC_CUSTOM1:
241  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_CUSTOM1));
242  break;
243  case SVC_CUSTOM2:
244  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_CUSTOM2));
245  break;
246  default:
247  myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_IGNORING));
248  break;
249  }
250  }
251 }
252 
253 // ---------------------------------------------------------------------------
254 // GNEVehicleTypeDialog::VShapeRow - methods
255 // ---------------------------------------------------------------------------
256 
257 GNEVehicleTypeDialog::VTypeAtributes::VShapeRow::VShapeRow(VTypeAtributes* VTypeAtributesParent, FXVerticalFrame* column) :
258  FXHorizontalFrame(column, GUIDesignAuxiliarHorizontalFrame),
259  myVTypeAtributesParent(VTypeAtributesParent) {
260  // create two auxiliar frames
261  FXVerticalFrame* verticalFrameLabelAndComboBox = new FXVerticalFrame(this, GUIDesignAuxiliarVerticalFrame);
262  // create combo for for vehicle shapes
263  new FXLabel(verticalFrameLabelAndComboBox, toString(SUMO_ATTR_GUISHAPE).c_str(), nullptr, GUIDesignLabelAttribute150);
264  myComboBoxShape = new FXComboBox(verticalFrameLabelAndComboBox, GUIDesignComboBoxNCol,
265  VTypeAtributesParent, MID_GNE_SET_ATTRIBUTE, GUIDesignComboBox);
266  myComboBoxShapeLabelImage = new FXLabel(this, "", nullptr, GUIDesignLabelTickedIcon180x46);
267  myComboBoxShapeLabelImage->setBackColor(FXRGBA(255, 255, 255, 255));
268  // fill combo Box with all vehicle shapes
269  std::vector<std::string> VShapeStrings = SumoVehicleShapeStrings.getStrings();
270  for (auto i : VShapeStrings) {
271  if (i != SumoVehicleShapeStrings.getString(SVS_UNKNOWN)) {
272  myComboBoxShape->appendItem(i.c_str());
273  }
274  }
275  // only show 10 Shapes
276  myComboBoxShape->setNumVisible(10);
277 }
278 
279 
280 void
282  // set color of myComboBoxShape, depending if current value is valid or not
283  if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(SUMO_ATTR_GUISHAPE, myComboBoxShape->getText().text())) {
284  myComboBoxShape->setTextColor(FXRGB(0, 0, 0));
285  myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(SUMO_ATTR_GUISHAPE, myComboBoxShape->getText().text(),
286  myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
287  setVShapeLabelImage();
288  } else {
289  myComboBoxShape->setTextColor(FXRGB(255, 0, 0));
290  myVTypeAtributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
291  myVTypeAtributesParent->myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_GUISHAPE;
292  }
293 }
294 
295 
296 void
298  myComboBoxShape->setText(myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_GUISHAPE).c_str());
299  setVShapeLabelImage();
300 }
301 
302 
303 void
305  // set Icon in label depending of current VClass
306  switch (getVehicleShapeID(myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_GUISHAPE))) {
307  case SVS_UNKNOWN:
308  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_UNKNOWN));
309  break;
310  case SVS_PEDESTRIAN:
311  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PEDESTRIAN));
312  break;
313  case SVS_BICYCLE:
314  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_BICYCLE));
315  break;
316  case SVS_MOPED:
317  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_MOPED));
318  break;
319  case SVS_MOTORCYCLE:
320  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_MOTORCYCLE));
321  break;
322  case SVS_PASSENGER:
323  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PASSENGER));
324  break;
325  case SVS_PASSENGER_SEDAN:
326  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PASSENGER_SEDAN));
327  break;
329  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PASSENGER_HATCHBACK));
330  break;
331  case SVS_PASSENGER_WAGON:
332  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PASSENGER_WAGON));
333  break;
334  case SVS_PASSENGER_VAN:
335  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PASSENGER_VAN));
336  break;
337  case SVS_DELIVERY:
338  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_DELIVERY));
339  break;
340  case SVS_TRUCK:
341  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_TRUCK));
342  break;
344  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_TRUCK_SEMITRAILER));
345  break;
346  case SVS_TRUCK_1TRAILER:
347  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_TRUCK_1TRAILER));
348  break;
349  case SVS_BUS:
350  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_BUS));
351  break;
352  case SVS_BUS_COACH:
353  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_BUS_COACH));
354  break;
355  case SVS_BUS_FLEXIBLE:
356  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_BUS_FLEXIBLE));
357  break;
358  case SVS_BUS_TROLLEY:
359  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_BUS_TROLLEY));
360  break;
361  case SVS_RAIL:
362  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_RAIL));
363  break;
364  case SVS_RAIL_CAR:
365  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_RAIL_CAR));
366  break;
367  case SVS_RAIL_CARGO:
368  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_RAIL_CARGO));
369  break;
370  case SVS_E_VEHICLE:
371  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_E_VEHICLE));
372  break;
373  case SVS_ANT:
374  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_ANT));
375  break;
376  case SVS_SHIP:
377  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_SHIP));
378  break;
379  case SVS_EMERGENCY:
380  case SVS_FIREBRIGADE:
381  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_EMERGENCY));
382  break;
383  case SVS_POLICE:
384  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_POLICE));
385  break;
386  case SVS_RICKSHAW:
387  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_RICKSHAW));
388  break;
389  default:
390  myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_IGNORING));
391  break;
392  }
393 }
394 
395 // ---------------------------------------------------------------------------
396 // GNEVehicleTypeDialog::VTypeAtributes - methods
397 // ---------------------------------------------------------------------------
398 
399 GNEVehicleTypeDialog::VTypeAtributes::VTypeAttributeRow::VTypeAttributeRow(VTypeAtributes* VTypeAtributesParent, FXVerticalFrame* verticalFrame, const SumoXMLAttr attr, const RowAttrType rowAttrType, const std::vector<std::string>& values) :
400  FXHorizontalFrame(verticalFrame, GUIDesignAuxiliarHorizontalFrame),
401  myVTypeAtributesParent(VTypeAtributesParent),
402  myAttr(attr),
403  myRowAttrType(rowAttrType),
404  myButton(nullptr),
405  myTextField(nullptr),
406  myComboBox(nullptr) {
407  // first check if we have to create a button or a label
408  if ((rowAttrType == ROWTYPE_COLOR) || (rowAttrType == ROWTYPE_FILENAME)) {
409  myButton = new FXButton(this, filterAttributeName(attr), nullptr, VTypeAtributesParent, MID_GNE_SET_ATTRIBUTE_DIALOG, GUIDesignButtonRectangular150);
410  } else if (rowAttrType == ROWTYPE_PARAMETERS) {
411  myButton = new FXButton(this, "Edit parameters", nullptr, VTypeAtributesParent, MID_GNE_OPEN_PARAMETERS_DIALOG, GUIDesignButtonRectangular150);
412  } else {
413  new FXLabel(this, filterAttributeName(attr), nullptr, GUIDesignLabelAttribute150);
414  }
415  // now check if we have to create a textfield or a ComboBox
416  if ((rowAttrType == ROWTYPE_STRING) || (rowAttrType == ROWTYPE_COLOR) || (rowAttrType == ROWTYPE_FILENAME) || (rowAttrType == ROWTYPE_PARAMETERS)) {
417  myTextField = new FXTextField(this, GUIDesignTextFieldNCol, VTypeAtributesParent, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFielWidth180);
418  } else if (rowAttrType == ROWTYPE_COMBOBOX) {
419  myComboBox = new FXComboBox(this, GUIDesignComboBoxNCol, VTypeAtributesParent, MID_GNE_SET_ATTRIBUTE, GUIDesignComboBoxWidth180);
420  // fill combo Box with values
421  for (const auto& value : values) {
422  myComboBox->appendItem(value.c_str());
423  }
424  // set 10 visible elements as maximum
425  if (myComboBox->getNumItems() < 10) {
426  myComboBox->setNumVisible(myComboBox->getNumItems());
427  } else {
428  myComboBox->setNumVisible(10);
429  }
430  } else {
431  throw ProcessError("Invalid row type");
432  }
433 }
434 
435 
436 void
438  if (myRowAttrType == ROWTYPE_COMBOBOX) {
439  // set color of myComboBox, depending if current value is valid or not
440  if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, myComboBox->getText().text())) {
441  myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, myComboBox->getText().text(),
442  myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
443  // update value after setting it
444  updateValue();
445  } else {
446  myComboBox->setTextColor(FXRGB(255, 0, 0));
447  // mark VType as invalid
448  myVTypeAtributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
449  myVTypeAtributesParent->myVehicleTypeDialog->myInvalidAttr = myAttr;
450  }
451  } else if (myRowAttrType == ROWTYPE_COLOR) {
452  // set color of myTextFieldColor, depending if current value is valid or not
453  if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(SUMO_ATTR_COLOR, myTextField->getText().text())) {
454  // set color depending if is a default value
455  if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getTagProperty().getDefaultValue(SUMO_ATTR_COLOR) != myTextField->getText().text()) {
456  myTextField->setTextColor(FXRGB(0, 0, 0));
457  } else {
458  myTextField->setTextColor(FXRGB(195, 195, 195));
459  }
460  myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(SUMO_ATTR_COLOR, myTextField->getText().text(), myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
461  } else {
462  myTextField->setTextColor(FXRGB(255, 0, 0));
463  myVTypeAtributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
464  myVTypeAtributesParent->myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_COLOR;
465  }
466  } else {
467  // set color of textField, depending if current value is valid or not
468  if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, myTextField->getText().text())) {
469  myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, myTextField->getText().text(),
470  myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
471  // update value after setting it
472  updateValue();
473  } else {
474  myTextField->setTextColor(FXRGB(255, 0, 0));
475  // mark VType as invalid
476  myVTypeAtributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
477  myVTypeAtributesParent->myVehicleTypeDialog->myInvalidAttr = myAttr;
478  }
479  }
480 }
481 
482 
483 void
485  if (myComboBox) {
486  // set color of myComboBox, depending if current value is valid or not
487  if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, myComboBox->getText().text())) {
488  myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, myComboBox->getText().text(),
489  myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
490  // update value after setting it
491  updateValue(defaultValue);
492  } else {
493  myComboBox->setTextColor(FXRGB(255, 0, 0));
494  // mark VType as invalid
495  myVTypeAtributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
496  myVTypeAtributesParent->myVehicleTypeDialog->myInvalidAttr = myAttr;
497  }
498  } else {
499  // set color of textField, depending if current value is valid or not
500  if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, myTextField->getText().text())) {
501  myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, myTextField->getText().text(),
502  myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
503  // update value after setting it
504  updateValue(defaultValue);
505  } else {
506  myTextField->setTextColor(FXRGB(255, 0, 0));
507  // mark VType as invalid
508  myVTypeAtributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
509  myVTypeAtributesParent->myVehicleTypeDialog->myInvalidAttr = myAttr;
510  }
511  }
512 }
513 
514 
515 void
517  if (myRowAttrType == ROWTYPE_COMBOBOX) {
518  // set text of myComboBox using current value of VType
519  myComboBox->setText(myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr).c_str());
520  // set color depending if is a default value
521  if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getTagProperty().getDefaultValue(myAttr) != myComboBox->getText().text()) {
522  myComboBox->setTextColor(FXRGB(0, 0, 0));
523  } else {
524  myComboBox->setTextColor(FXRGB(195, 195, 195));
525  }
526  } else if (myRowAttrType == ROWTYPE_COLOR) {
527  // set field color
528  myTextField->setText(myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr).c_str());
529  // set color depending if is a default value
530  if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getTagProperty().getDefaultValue(myAttr) != myTextField->getText().text()) {
531  myTextField->setTextColor(FXRGB(0, 0, 0));
532  } else {
533  myTextField->setTextColor(FXRGB(195, 195, 195));
534  }
535  } else if (myAttr == GNE_ATTR_PARAMETERS) {
536  // get parameters
537  const std::string& parametersStr = myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr);
538  // set text of myTextField using current value of VType
539  myTextField->setText(parametersStr.c_str());
540  // set text color
541  myTextField->setTextColor(FXRGB(0, 0, 0));
542  // clear parameters
543  myParameters.clear();
544  // separate value in a vector of string using | as separator
545  StringTokenizer parameters(parametersStr, "|", true);
546  // iterate over all values
547  while (parameters.hasNext()) {
548  // obtain key and value and save it in myParameters
549  const std::vector<std::string> keyValue = StringTokenizer(parameters.next(), "=", true).getVector();
550  if (keyValue.size() == 2) {
551  myParameters[keyValue.front()] = keyValue.back();
552  }
553  }
554  } else {
555  // set text of myTextField using current value of VType
556  myTextField->setText(myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr).c_str());
557  // set color depending if is a default value
558  if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getTagProperty().getDefaultValue(myAttr) != myTextField->getText().text()) {
559  myTextField->setTextColor(FXRGB(0, 0, 0));
560  } else {
561  myTextField->setTextColor(FXRGB(195, 195, 195));
562  }
563  }
564 }
565 
566 
567 void
569  if (myComboBox) {
570  // set text of myComboBox using current value of VType
571  myComboBox->setText(myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr).c_str());
572  // set color depending if is a default value
573  if (defaultValue != myComboBox->getText().text()) {
574  myComboBox->setTextColor(FXRGB(0, 0, 0));
575  } else {
576  myComboBox->setTextColor(FXRGB(195, 195, 195));
577  }
578  } else {
579  // set text of myTextField using current value of VType
580  myTextField->setText(myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr).c_str());
581  // set color depending if is a default value
582  if (defaultValue != myTextField->getText().text()) {
583  myTextField->setTextColor(FXRGB(0, 0, 0));
584  } else {
585  myTextField->setTextColor(FXRGB(195, 195, 195));
586  }
587  }
588 }
589 
590 
591 const FXButton*
593  return myButton;
594 }
595 
596 
597 void
599  // create FXColorDialog
600  FXColorDialog colordialog(this, tr("Color Dialog"));
601  colordialog.setTarget(this);
602  // If previous attribute wasn't correct, set black as default color
603  if (GNEAttributeCarrier::canParse<RGBColor>(myTextField->getText().text())) {
604  colordialog.setRGBA(MFXUtils::getFXColor(RGBColor::parseColor(myTextField->getText().text())));
605  } else {
606  colordialog.setRGBA(MFXUtils::getFXColor(RGBColor::BLACK));
607  }
608  // execute dialog to get a new color
609  if (colordialog.execute()) {
610  std::string newValue = toString(MFXUtils::getRGBColor(colordialog.getRGBA()));
611  myTextField->setText(newValue.c_str());
612  if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, newValue)) {
613  myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, newValue, myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
614  // If previously value was incorrect, change font color to black
615  myTextField->setTextColor(FXRGB(0, 0, 0));
616  myTextField->killFocus();
617  }
618  }
619 }
620 
621 
622 void
624  // get the new image file
625  FXFileDialog opendialog(this, "Open Image");
626  opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::VTYPE));
627  opendialog.setSelectMode(SELECTFILE_EXISTING);
628  opendialog.setPatternList("All files (*)");
629  if (gCurrentFolder.length() != 0) {
630  opendialog.setDirectory(gCurrentFolder);
631  }
632  if (opendialog.execute()) {
633  // update global current folder
634  gCurrentFolder = opendialog.getDirectory();
635  // get image path
636  std::string imagePath = opendialog.getFilename().text();
637  // check if image is valid
638  if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, imagePath)) {
639  myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, imagePath, myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
640  myTextField->setText(imagePath.c_str());
641  // If previously value was incorrect, change font color to black
642  myTextField->setTextColor(FXRGB(0, 0, 0));
643  myTextField->killFocus();
644  }
645  }
646 }
647 
648 
649 void
651  // get the new file name
652  FXFileDialog opendialog(this, "Open OSG File");
653  opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::VTYPE));
654  opendialog.setSelectMode(SELECTFILE_EXISTING);
655  opendialog.setPatternList("OSG file (*.obj)");
656  if (gCurrentFolder.length() != 0) {
657  opendialog.setDirectory(gCurrentFolder);
658  }
659  if (opendialog.execute()) {
660  // update global current folder
661  gCurrentFolder = opendialog.getDirectory();
662  // get image path
663  std::string imagePath = opendialog.getFilename().text();
664  // check if image is valid
665  if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, imagePath)) {
666  myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, imagePath, myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
667  myTextField->setText(imagePath.c_str());
668  // If previously value was incorrect, change font color to black
669  myTextField->setTextColor(FXRGB(0, 0, 0));
670  myTextField->killFocus();
671  }
672  }
673 }
674 
675 
676 std::string
678  return myTextField->getText().text();
679 }
680 
681 
682 std::vector<std::pair<std::string, std::string> >
684  std::vector<std::pair<std::string, std::string> > result;
685  // Generate a vector string using the following structure: "<key1,value1>, <key2, value2>,...
686  for (const auto& parameter : myParameters) {
687  result.push_back(std::make_pair(parameter.first, parameter.second));
688  }
689  return result;
690 }
691 
692 
693 void
694 GNEVehicleTypeDialog::VTypeAtributes::VTypeAttributeRow::setParameters(const std::vector<std::pair<std::string, std::string> >& parameters) {
695  // first clear parameters
696  myParameters.clear();
697  // declare result
698  std::string result;
699  // iterate over parameters
700  for (const auto& parameter : parameters) {
701  // Generate an string using the following structure: "key1=value1|key2=value2|...
702  result += parameter.first + "=" + parameter.second + "|";
703  // fill parameters
704  myParameters[parameter.first] = parameter.second;
705  }
706  // remove the last "|"
707  if (!result.empty()) {
708  result.pop_back();
709  }
710  // set text field
711  myTextField->setText(result.c_str());
712 }
713 
714 
715 FXString
717  switch (attr) {
718  // JM
720  return "crossingGap";
722  return "driveAfterYellowTime";
724  return "driveAfterRedTime";
726  return "driveRedSpeed";
728  return "ignoreKeepClearTime";
730  return "ignoreFoeSpeed";
732  return "ignoreFoeProb";
734  return "sigmaMinor";
736  return "timegapMinor";
737  // LCM
739  return "strategic";
741  return "cooperative";
743  return "speedGain";
745  return "keepRight";
747  return "sublane";
749  return "opposite";
750  case SUMO_ATTR_LCA_PUSHY:
751  return "pushy";
753  return "pushyGap";
755  return "assertive";
757  return "impatience";
759  return "timeToImpatience";
761  return "accelLat";
763  return "lookaheadLeft";
765  return "speedGainRight";
767  return "maxSpeedLatStanding";
769  return "maxSpeedLatFactor";
771  return "turnAlignDistance";
773  return "overtakeRight";
774  /* case SUMO_ATTR_LCA_EXPERIMENTAL1:
775  return "experimental1";
776  */
777  default:
778  return toString(attr).c_str();
779  }
780 }
781 
782 // ---------------------------------------------------------------------------
783 // GNEVehicleTypeDialog::VTypeAtributes - methods
784 // ---------------------------------------------------------------------------
785 
786 GNEVehicleTypeDialog::VTypeAtributes::VTypeAtributes(GNEVehicleTypeDialog* vehicleTypeDialog, FXHorizontalFrame* column) :
787  FXVerticalFrame(column, GUIDesignAuxiliarVerticalFrame),
788  myVehicleTypeDialog(vehicleTypeDialog) {
789  // declare two auxiliar horizontal frames
790  FXHorizontalFrame* firstAuxiliarHorizontalFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
791  FXVerticalFrame* firstAuxiliarVerticalFrame = new FXVerticalFrame(firstAuxiliarHorizontalFrame, GUIDesignAuxiliarVerticalFrame);
792  // create attributes for common attributes
793  FXGroupBox* commonAttributes = new FXGroupBox(firstAuxiliarVerticalFrame, "Vehicle Type attributes", GUIDesignGroupBoxFrame);
794  // create horizontal frame for columns of attributes
795  FXHorizontalFrame* columnsBasicVTypeAttributes = new FXHorizontalFrame(commonAttributes, GUIDesignAuxiliarHorizontalFrame);
796  // build left attributes
797  buildAttributesA(new FXVerticalFrame(columnsBasicVTypeAttributes, GUIDesignAuxiliarFrame));
798  // build right attributes
799  buildAttributesB(new FXVerticalFrame(columnsBasicVTypeAttributes, GUIDesignAuxiliarFrame));
800  // create GroupBox for Junction Model Attributes
801  FXGroupBox* JMAttributes = new FXGroupBox(firstAuxiliarVerticalFrame, "Junction Model attributes", GUIDesignGroupBoxFrame);
802  // create horizontal frame for columns of Junction Model attributes
803  FXHorizontalFrame* columnsJMVTypeAttributes = new FXHorizontalFrame(JMAttributes, GUIDesignAuxiliarHorizontalFrame);
804  // build left attributes
805  buildJunctionModelAttributesA(new FXVerticalFrame(columnsJMVTypeAttributes, GUIDesignAuxiliarFrame));
806  // build right attributes
807  buildJunctionModelAttributesB(new FXVerticalFrame(columnsJMVTypeAttributes, GUIDesignAuxiliarFrame));
808  // create GroupBox for Junction Model Attributes
809  FXGroupBox* LCMAttributes = new FXGroupBox(firstAuxiliarHorizontalFrame, "Lane Change Model attributes", GUIDesignGroupBoxFrame);
810  // create Lane Change Model Attributes
811  buildLaneChangeModelAttributes(new FXVerticalFrame(LCMAttributes, GUIDesignAuxiliarFrame));
812 }
813 
814 
815 void
817  // 01 Create VClassRow
818  myVClassRow = new VClassRow(this, column);
819 
820  // 02 create FXTextField and Label for vehicleTypeID
821  FXHorizontalFrame* row = new FXHorizontalFrame(column, GUIDesignAuxiliarHorizontalFrame);
822  new FXLabel(row, toString(SUMO_ATTR_ID).c_str(), nullptr, GUIDesignLabelAttribute150);
823  myTextFieldVehicleTypeID = new FXTextField(row, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFielWidth180);
824 
825  // 03 create FXTextField and Button for Color
826  myColor = new VTypeAttributeRow(this, column, SUMO_ATTR_COLOR, VTypeAttributeRow::RowAttrType::ROWTYPE_COLOR);
827 
828  // 04 create FXTextField and Label for Length
829  myLength = new VTypeAttributeRow(this, column, SUMO_ATTR_LENGTH, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
830 
831  // 05 create FXTextField and Label for MinGap
832  myMinGap = new VTypeAttributeRow(this, column, SUMO_ATTR_MINGAP, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
833 
834  // 06 create FXTextField and Label for MaxSpeed
835  myMaxSpeed = new VTypeAttributeRow(this, column, SUMO_ATTR_MAXSPEED, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
836 
837  // 07 create FXTextField and Label for SpeedFactor
838  mySpeedFactor = new VTypeAttributeRow(this, column, SUMO_ATTR_SPEEDFACTOR, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
839 
840  // 08 create FXTextField and Label for SpeedDev
841  mySpeedDev = new VTypeAttributeRow(this, column, SUMO_ATTR_SPEEDDEV, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
842 
843  // 09 create FXTextField and Label for EmissionClass
844  myEmissionClass = new VTypeAttributeRow(this, column, SUMO_ATTR_EMISSIONCLASS, VTypeAttributeRow::RowAttrType::ROWTYPE_COMBOBOX, PollutantsInterface::getAllClassesStr());
845 
846  // 10 create FXTextField and Label for Width
847  myWidth = new VTypeAttributeRow(this, column, SUMO_ATTR_WIDTH, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
848 
849  // 11 create FXTextField and Label for Height
850  myHeight = new VTypeAttributeRow(this, column, SUMO_ATTR_HEIGHT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
851 
852  // 12 create FXTextField and Label for Filename
853  myFilename = new VTypeAttributeRow(this, column, SUMO_ATTR_IMGFILE, VTypeAttributeRow::RowAttrType::ROWTYPE_FILENAME);
854 
855  // 13 create FXTextField and Label for Filename
856  myOSGFile = new VTypeAttributeRow(this, column, SUMO_ATTR_OSGFILE, VTypeAttributeRow::RowAttrType::ROWTYPE_FILENAME);
857 
858  // 14 create VTypeAttributeRow and Label for Probability
859  myProbability = new VTypeAttributeRow(this, column, SUMO_ATTR_PROB, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
860 }
861 
862 
863 void
865  // 01 Create VShapeRow
866  myVShapeRow = new VShapeRow(this, column);
867 
868  // 02 create VTypeAttributeRow and Label for LaneChangeModel
869  myLaneChangeModel = new VTypeAttributeRow(this, column, SUMO_ATTR_LANE_CHANGE_MODEL, VTypeAttributeRow::RowAttrType::ROWTYPE_COMBOBOX, SUMOXMLDefinitions::LaneChangeModels.getStrings());
870 
871  // 03 create VTypeAttributeRow and Label for PersonCapacity
872  myPersonCapacity = new VTypeAttributeRow(this, column, SUMO_ATTR_PERSON_CAPACITY, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
873 
874  // 04 create VTypeAttributeRow and Label for ContainerCapacity
875  myContainerCapacity = new VTypeAttributeRow(this, column, SUMO_ATTR_CONTAINER_CAPACITY, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
876 
877  // 05 create VTypeAttributeRow and Label for BoardingDuration
878  myBoardingDuration = new VTypeAttributeRow(this, column, SUMO_ATTR_BOARDING_DURATION, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
879 
880  // 06 create VTypeAttributeRow and Label for LoadingDuration
881  myLoadingDuration = new VTypeAttributeRow(this, column, SUMO_ATTR_LOADING_DURATION, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
882 
883  // 07 create ComboBox and Label for LatAlignment
884  myLatAlignment = new VTypeAttributeRow(this, column, SUMO_ATTR_LATALIGNMENT, VTypeAttributeRow::RowAttrType::ROWTYPE_COMBOBOX, SUMOXMLDefinitions::LateralAlignments.getStrings());
885 
886  // 08 create VTypeAttributeRow and Label for MinGapLat
887  myMinGapLat = new VTypeAttributeRow(this, column, SUMO_ATTR_MINGAP_LAT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
888 
889  // 09 create VTypeAttributeRow and Label for MaxSpeedLat
890  myMaxSpeedLat = new VTypeAttributeRow(this, column, SUMO_ATTR_MAXSPEED_LAT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
891 
892  // 10 create VTypeAttributeRow and Label for ActionStepLength
893  myActionStepLength = new VTypeAttributeRow(this, column, SUMO_ATTR_ACTIONSTEPLENGTH, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
894 
895  // 11 create FXTextField and Label for Carriage length
896  myCarriageLength = new VTypeAttributeRow(this, column, SUMO_ATTR_CARRIAGE_LENGTH, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
897 
898  // 12 create FXTextField and Label for Locomotive length
899  myLocomotiveLength = new VTypeAttributeRow(this, column, SUMO_ATTR_LOCOMOTIVE_LENGTH, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
900 
901  // 13 create FXTextField and Label for carriage GAP
902  myCarriageGap = new VTypeAttributeRow(this, column, SUMO_ATTR_CARRIAGE_GAP, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
903 
904  // 24 create FXTextField and Label for parameters
905  myParameters = new VTypeAttributeRow(this, column, GNE_ATTR_PARAMETERS, VTypeAttributeRow::RowAttrType::ROWTYPE_PARAMETERS);
906 }
907 
908 
909 void
911  // 01 create VTypeAttributeRow and Label for JMCrossingGap
912  myJMCrossingGap = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_CROSSING_GAP, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
913 
914  // 02 create VTypeAttributeRow and Label for JMIgnoreKeepclearTime
915  myJMIgnoreKeepclearTime = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_IGNORE_KEEPCLEAR_TIME, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
916 
917  // 03 create VTypeAttributeRow and Label for JMDriveAfterYellowTime
918  myJMDriveAfterYellowTime = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_DRIVE_AFTER_YELLOW_TIME, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
919 
920  // 04 create VTypeAttributeRow and Label for JMDriveAfterRedTime
921  myJMDriveAfterRedTime = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_DRIVE_AFTER_RED_TIME, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
922 
923  // 05 create VTypeAttributeRow and Label for JMDriveRedSpeed
924  myJMDriveRedSpeed = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_DRIVE_RED_SPEED, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
925 }
926 
927 
928 void
930  // 01 create VTypeAttributeRow and Label for JMIgnoreFoeProb
931  myJMIgnoreFoeProb = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_IGNORE_FOE_PROB, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
932 
933  // 02 create VTypeAttributeRow and Label for JMIgnoreFoeSpeed
934  myJMIgnoreFoeSpeed = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_IGNORE_FOE_SPEED, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
935 
936  // 03 create VTypeAttributeRow and Label for JMSigmaMinor
937  myJMSigmaMinor = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_SIGMA_MINOR, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
938 
939  // 04 create VTypeAttributeRow and Label for JMTimeGapMinor
940  myJMTimeGapMinor = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_TIMEGAP_MINOR, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
941 
942  // 05 create VTypeAttributeRow and Label for Impatience
943  myJMImpatience = new VTypeAttributeRow(this, column, SUMO_ATTR_IMPATIENCE, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
944 }
945 
946 
947 void
949  // 01 create VTypeAttributeRow and Label for strategic param
950  myLCAStrategicParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_STRATEGIC_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
951 
952  // 02 create VTypeAttributeRow and Label for cooperative param
953  myLCACooperativeParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_COOPERATIVE_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
954 
955  // 03 create VTypeAttributeRow and Label for speed gain param
956  myLCASpeedgainParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_SPEEDGAIN_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
957 
958  // 04 create VTypeAttributeRow and Label for keepright param
959  myLCAKeeprightParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_KEEPRIGHT_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
960 
961  // 05 create VTypeAttributeRow and Label for sublane param
962  myLCASublaneParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_SUBLANE_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
963 
964  // 06 create VTypeAttributeRow and Label for opposite param
965  myLCAOppositeParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_OPPOSITE_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
966 
967  // 07 create VTypeAttributeRow and Label for pushy
968  myLCAPushy = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_PUSHY, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
969 
970  // 08 create VTypeAttributeRow and Label for pushy gap
971  myLCAPushygap = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_PUSHYGAP, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
972 
973  // 09 create VTypeAttributeRow and Label for assertive
974  myLCAAssertive = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_ASSERTIVE, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
975 
976  // 10 create VTypeAttributeRow and Label for impatience
977  myLCAImpatience = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_IMPATIENCE, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
978 
979  // 11 create VTypeAttributeRow and Label for time to impatience
980  myLCATimeToImpatience = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_TIME_TO_IMPATIENCE, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
981 
982  // 12 create VTypeAttributeRow and Label for accel lat
983  myLCAAccelLat = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_ACCEL_LAT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
984 
985  // 13 create VTypeAttributeRow and Label for look ahead lefth
986  myLCALookAheadLeft = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_LOOKAHEADLEFT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
987 
988  // 14 create VTypeAttributeRow and Label for speed gain right
989  myLCASpeedGainRight = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_SPEEDGAINRIGHT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
990 
991  // 15 create VTypeAttributeRow and Label for max speed lat standing
992  myLCAMaxSpeedLatStanding = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_MAXSPEEDLATSTANDING, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
993 
994  // 16 create VTypeAttributeRow and Label for max speed lat factor
995  myLCAMaxSpeedLatFactor = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_MAXSPEEDLATFACTOR, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
996 
997  // 17 create VTypeAttributeRow and Label for turn alignment distance
998  myLCATurnAlignmentDistance = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_TURN_ALIGNMENT_DISTANCE, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
999 
1000  // 18 create VTypeAttributeRow and Label for overtake right
1001  myLCAOvertakeRight = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_OVERTAKE_RIGHT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1002 
1003  // 19 create VTypeAttributeRow and Label for experimental
1004  /* myLCAExperimental = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_EXPERIMENTAL1, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING); */
1005 }
1006 
1007 
1008 void
1010  //set values of myEditedDemandElement into fields
1011  myTextFieldVehicleTypeID->setText(myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_ID).c_str());
1012  // set variables of special rows VClass and VShape
1013  SUMOVTypeParameter::VClassDefaultValues defaultVTypeParameters(myVClassRow->updateValue());
1014  myVShapeRow->updateValues();
1015  // update rows
1016  myLaneChangeModel->updateValue();
1017  myLatAlignment->updateValue();
1018  myColor->updateValue();
1019  myLength->updateValue(toString(defaultVTypeParameters.length));
1020  myMinGap->updateValue(toString(defaultVTypeParameters.minGap));
1021  myMaxSpeed->updateValue(toString(defaultVTypeParameters.maxSpeed));
1022  mySpeedFactor->updateValue(toString(defaultVTypeParameters.speedFactor.getParameter()[0]));
1023  mySpeedDev->updateValue(toString(defaultVTypeParameters.speedFactor.getParameter()[1]));
1024  myEmissionClass->updateValue(toString(defaultVTypeParameters.emissionClass));
1025  myWidth->updateValue(toString(defaultVTypeParameters.width));
1026  myHeight->updateValue(toString(defaultVTypeParameters.height));
1027  myFilename->updateValue();
1028  myOSGFile->updateValue(toString(defaultVTypeParameters.osgFile));
1029  myPersonCapacity->updateValue(toString(defaultVTypeParameters.personCapacity));
1030  myContainerCapacity->updateValue(toString(defaultVTypeParameters.containerCapacity));
1031  myCarriageLength->updateValue(toString(defaultVTypeParameters.carriageLength));
1032  myLocomotiveLength->updateValue(toString(defaultVTypeParameters.locomotiveLength));
1033  myBoardingDuration->updateValue();
1034  myLoadingDuration->updateValue();
1035  myMinGapLat->updateValue();
1036  myMaxSpeedLat->updateValue();
1037  myActionStepLength->updateValue();
1038  myProbability->updateValue();
1039  myCarriageGap->updateValue();
1040  // JM Parameters
1041  myJMCrossingGap->updateValue();
1042  myJMIgnoreKeepclearTime->updateValue();
1043  myJMDriveAfterYellowTime->updateValue();
1044  myJMDriveAfterRedTime->updateValue();
1045  myJMDriveRedSpeed->updateValue();
1046  myJMIgnoreFoeProb->updateValue();
1047  myJMIgnoreFoeSpeed->updateValue();
1048  myJMSigmaMinor->updateValue();
1049  myJMTimeGapMinor->updateValue();
1050  myJMImpatience->updateValue();
1051  // LCM Attributes
1052  myLCAStrategicParam->updateValue();
1053  myLCACooperativeParam->updateValue();
1054  myLCASpeedgainParam->updateValue();
1055  myLCAKeeprightParam->updateValue();
1056  myLCASublaneParam->updateValue();
1057  myLCAOppositeParam->updateValue();
1058  myLCAPushy->updateValue();
1059  myLCAPushygap->updateValue();
1060  myLCAAssertive->updateValue();
1061  myLCAImpatience->updateValue();
1062  myLCATimeToImpatience->updateValue();
1063  myLCAAccelLat->updateValue();
1064  myLCALookAheadLeft->updateValue();
1065  myLCASpeedGainRight->updateValue();
1066  myLCAMaxSpeedLatStanding->updateValue();
1067  myLCAMaxSpeedLatFactor->updateValue();
1068  myLCATurnAlignmentDistance->updateValue();
1069  myLCAOvertakeRight->updateValue();
1070  /* myLCAExperimental->updateValue(); */
1071  // parameters
1072  myParameters->updateValue();
1073 }
1074 
1075 
1076 long
1078  // At start we assumed, that all values are valid
1079  myVehicleTypeDialog->myVehicleTypeValid = true;
1080  myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_NOTHING;
1081  // set color of myTextFieldVehicleTypeID, depending if current value is valid or not
1082  if (myVehicleTypeDialog->myEditedDemandElement->isValid(SUMO_ATTR_ID, myTextFieldVehicleTypeID->getText().text())) {
1083  myTextFieldVehicleTypeID->setTextColor(FXRGB(0, 0, 0));
1084  myVehicleTypeDialog->myEditedDemandElement->setAttribute(SUMO_ATTR_ID, myTextFieldVehicleTypeID->getText().text(), myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
1085  } else if (myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_ID) == myTextFieldVehicleTypeID->getText().text()) {
1086  myTextFieldVehicleTypeID->setTextColor(FXRGB(0, 0, 0));
1087  myVehicleTypeDialog->myEditedDemandElement->setAttribute(SUMO_ATTR_ID, myTextFieldVehicleTypeID->getText().text(), myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
1088  } else {
1089  myTextFieldVehicleTypeID->setTextColor(FXRGB(255, 0, 0));
1090  myVehicleTypeDialog->myVehicleTypeValid = false;
1091  myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_ID;
1092  }
1093  // set variables of special rows VClass and VShape
1094  SUMOVTypeParameter::VClassDefaultValues defaultVTypeParameters(myVClassRow->setVariable());
1095  // set variables of special rows VShape
1096  myVShapeRow->setVariable();
1097  // set attributes in rest rows
1098  myColor->setVariable();
1099  myLength->setVariable(toString(defaultVTypeParameters.length));
1100  myMinGap->setVariable(toString(defaultVTypeParameters.minGap));
1101  myMaxSpeed->setVariable(toString(defaultVTypeParameters.maxSpeed));
1102  mySpeedFactor->setVariable(toString(defaultVTypeParameters.speedFactor.getParameter()[0]));
1103  mySpeedDev->setVariable(toString(defaultVTypeParameters.speedFactor.getParameter()[1]));
1104  myEmissionClass->setVariable(toString(defaultVTypeParameters.emissionClass));
1105  myWidth->setVariable(toString(defaultVTypeParameters.width));
1106  myHeight->setVariable(toString(defaultVTypeParameters.height));
1107  myOSGFile->setVariable(toString(defaultVTypeParameters.osgFile));
1108  // set attributes in rows
1109  myLaneChangeModel->setVariable();
1110  myLatAlignment->setVariable();
1111  myLength->setVariable(toString(defaultVTypeParameters.length));
1112  myMinGap->setVariable(toString(defaultVTypeParameters.minGap));
1113  myMaxSpeed->setVariable(toString(defaultVTypeParameters.maxSpeed));
1114  mySpeedFactor->setVariable(toString(defaultVTypeParameters.speedFactor.getParameter()[0]));
1115  mySpeedDev->setVariable(toString(defaultVTypeParameters.speedFactor.getParameter()[1]));
1116  myEmissionClass->setVariable(toString(defaultVTypeParameters.emissionClass));
1117  myWidth->setVariable(toString(defaultVTypeParameters.width));
1118  myHeight->setVariable(toString(defaultVTypeParameters.height));
1119  myFilename->setVariable();
1120  myOSGFile->setVariable(toString(defaultVTypeParameters.osgFile));
1121  myPersonCapacity->setVariable(toString(defaultVTypeParameters.personCapacity));
1122  myContainerCapacity->setVariable(toString(defaultVTypeParameters.containerCapacity));
1123  myCarriageLength->setVariable(toString(defaultVTypeParameters.carriageLength));
1124  myLocomotiveLength->setVariable(toString(defaultVTypeParameters.locomotiveLength));
1125  myBoardingDuration->setVariable();
1126  myLoadingDuration->setVariable();
1127  myMinGapLat->setVariable();
1128  myMaxSpeedLat->setVariable();
1129  myActionStepLength->setVariable();
1130  myProbability->setVariable();
1131  myCarriageGap->setVariable();
1132  // JM Variables
1133  myJMCrossingGap->setVariable();
1134  myJMIgnoreKeepclearTime->setVariable();
1135  myJMDriveAfterYellowTime->setVariable();
1136  myJMDriveAfterRedTime->setVariable();
1137  myJMDriveRedSpeed->setVariable();
1138  myJMIgnoreFoeProb->setVariable();
1139  myJMIgnoreFoeSpeed->setVariable();
1140  myJMSigmaMinor->setVariable();
1141  myJMTimeGapMinor->setVariable();
1142  myJMImpatience->setVariable();
1143  // LCM Attributes
1144  myLCAStrategicParam->setVariable();
1145  myLCACooperativeParam->setVariable();
1146  myLCASpeedgainParam->setVariable();
1147  myLCAKeeprightParam->setVariable();
1148  myLCASublaneParam->setVariable();
1149  myLCAOppositeParam->setVariable();
1150  myLCAPushy->setVariable();
1151  myLCAPushygap->setVariable();
1152  myLCAAssertive->setVariable();
1153  myLCAImpatience->setVariable();
1154  myLCATimeToImpatience->setVariable();
1155  myLCAAccelLat->setVariable();
1156  myLCALookAheadLeft->setVariable();
1157  myLCASpeedGainRight->setVariable();
1158  myLCAMaxSpeedLatStanding->setVariable();
1159  myLCAMaxSpeedLatFactor->setVariable();
1160  myLCATurnAlignmentDistance->setVariable();
1161  myLCAOvertakeRight->setVariable();
1162  /* myLCAExperimental->setVariable(); */
1163  myParameters->setVariable();
1164  return true;
1165 }
1166 
1167 
1168 long
1170  // check what dialog has to be opened
1171  if (obj == myColor->getButton()) {
1172  myColor->openColorDialog();
1173  } else if (obj == myFilename->getButton()) {
1174  myFilename->openImageFileDialog();
1175  } else if (obj == myOSGFile->getButton()) {
1176  myFilename->openOSGFileDialog();
1177  }
1178  return 1;
1179 }
1180 
1181 
1182 long
1184  // write debug information
1185  WRITE_DEBUG("Open parameters dialog");
1186  // edit parameters using dialog
1187  if (GNESingleParametersDialog(myParameters, myVehicleTypeDialog->getEditedDemandElement()->getNet()->getViewNet()).execute()) {
1188  // write debug information
1189  WRITE_DEBUG("Close parameters dialog");
1190  // set values edited in Parameter dialog in Edited AC
1191  myVehicleTypeDialog->getEditedDemandElement()->setAttribute(GNE_ATTR_PARAMETERS, myParameters->getParametersStr(), myVehicleTypeDialog->getEditedDemandElement()->getNet()->getViewNet()->getUndoList());
1192  } else {
1193  // write debug information
1194  WRITE_DEBUG("Cancel parameters dialog");
1195  }
1196  return 1;
1197 }
1198 
1199 // ---------------------------------------------------------------------------
1200 // GNEVehicleTypeDialog::VShapeRow - methods
1201 // ---------------------------------------------------------------------------
1202 
1204  FXGroupBox(column, "Car Following Model attributes", GUIDesignGroupBoxFrame),
1205  myVehicleTypeDialog(vehicleTypeDialog) {
1206 
1207  // create vertical frame for rows
1208  myVerticalFrameRows = new FXVerticalFrame(this, GUIDesignAuxiliarFrame);
1209 
1210  // declare combo box
1211  FXHorizontalFrame* row = new FXHorizontalFrame(myVerticalFrameRows, GUIDesignAuxiliarHorizontalFrame);
1212  new FXLabel(row, "Algorithm", nullptr, GUIDesignLabelAttribute150);
1214 
1215  // fill combo Box with all Car following models
1216  std::vector<std::string> CFModels = SUMOXMLDefinitions::CarFollowModels.getStrings();
1217  for (auto i : CFModels) {
1218  myComboBoxCarFollowModel->appendItem(i.c_str());
1219  }
1220  myComboBoxCarFollowModel->setNumVisible(10);
1221 
1222  // 01 create FX and Label for Accel
1224  myRows.push_back(myAccelRow);
1225 
1226  // 02 create FX and Label for Decel
1228  myRows.push_back(myDecelRow);
1229 
1230  // 03 create FX and Label for Apparent decel
1232  myRows.push_back(myApparentDecelRow);
1233 
1234  // 04 create FX and Label for emergency decel
1236  myRows.push_back(myEmergencyDecelRow);
1237 
1238  // 05 create FX and Label for Sigma
1240  myRows.push_back(mySigmaRow);
1241 
1242  // 06 create FX and Label for Tau
1244  myRows.push_back(myTauRow);
1245 
1246  // 07 myMinGapFactor FX and Label for MinGapFactor
1248  myRows.push_back(myMinGapFactorRow);
1249 
1250  // 08 create FX and Label for K
1252  myRows.push_back(myKRow);
1253 
1254  // 09 create FX and Label for PHI
1256  myRows.push_back(myPhiRow);
1257 
1258  // 10 create FX and Label for Deleta
1260  myRows.push_back(myDeltaRow);
1261 
1262  // 11 create FX and Label for Stepping
1264  myRows.push_back(mySteppingRow);
1265 
1266  // 12 create FX and Label for Security
1268  myRows.push_back(mySecurityRow);
1269 
1270  // 13 create FX and Label for Estimation
1272  myRows.push_back(myEstimationRow);
1273 
1274  // 14 create FX and Label for TMP1
1276  myRows.push_back(myTmp1Row);
1277 
1278  // 15 create FX and Label for TMP2
1280  myRows.push_back(myTmp2Row);
1281 
1282  // 16 create FX and Label for TMP3
1284  myRows.push_back(myTmp3Row);
1285 
1286  // 17 create FX and Label for TMP4
1288  myRows.push_back(myTmp4Row);
1289 
1290  // 18 create FX and Label for TMP5
1292  myRows.push_back(myTmp5Row);
1293 
1294  // 19 create FX and Label for trainType (allow strings)
1296  myRows.push_back(myTrainTypeRow);
1297 
1298  // 20 create FX and Label for Tau Last
1300  myRows.push_back(myTrauLastRow);
1301 
1302  // 21 create FX and Label for Aprob
1304  myRows.push_back(myAprobRow);
1305 
1306  // 22 create FX and Label for Adapt Factor
1308  myRows.push_back(myAdaptFactorRow);
1309 
1310  // 23 create FX and Label for Adapt Time
1312  myRows.push_back(myAdaptTimeRow);
1313 
1314  // create myLabelIncompleteAttribute
1315  myLabelIncompleteAttribute = new FXLabel(myVerticalFrameRows, "Some attributes wasn't\nimplemented yet", nullptr, GUIDesignLabelAboutInfoCenter);
1317 
1318  // show or hidde ComboBox depending of current selected CFM
1319  refreshCFMFields();
1320 }
1321 
1322 
1323 void
1325  // start hidding all rows
1326  for (const auto& i : myRows) {
1327  i->hide();
1328  }
1329  // hide myLabelIncompleteAttribute
1330  myLabelIncompleteAttribute->hide();
1331  // show textfield depending of current CFM
1332  if (SUMOXMLDefinitions::CarFollowModels.hasString(myComboBoxCarFollowModel->getText().text())) {
1333  // show textfield depending of selected CFM
1334  switch (SUMOXMLDefinitions::CarFollowModels.get(myComboBoxCarFollowModel->getText().text())) {
1335  case SUMO_TAG_CF_KRAUSS:
1338  myTauRow->show();
1339  myAccelRow->show();
1340  myDecelRow->show();
1341  myApparentDecelRow->show();
1342  myEmergencyDecelRow->show();
1343  mySigmaRow->show();
1344  break;
1345  case SUMO_TAG_CF_KRAUSSX:
1346  myTauRow->show();
1347  myTmp1Row->show();
1348  myTmp2Row->show();
1349  myTmp3Row->show();
1350  myTmp4Row->show();
1351  myTmp5Row->show();
1352  break;
1353  case SUMO_TAG_CF_SMART_SK:
1354  case SUMO_TAG_CF_DANIEL1:
1355  myTauRow->show();
1356  myAccelRow->show();
1357  myDecelRow->show();
1358  myEmergencyDecelRow->show();
1359  mySigmaRow->show();
1360  myMinGapFactorRow->show();
1361  myTmp1Row->show();
1362  myTmp2Row->show();
1363  myTmp3Row->show();
1364  myTmp4Row->show();
1365  myTmp5Row->show();
1366  break;
1368  myTauRow->show();
1369  myAccelRow->show();
1370  myDecelRow->show();
1371  myEmergencyDecelRow->show();
1372  mySigmaRow->show();
1373  myMinGapFactorRow->show();
1374  myTrauLastRow->show();
1375  myAprobRow->show();
1376  break;
1377  case SUMO_TAG_CF_IDM:
1378  myTauRow->show();
1379  myAccelRow->show();
1380  myDecelRow->show();
1381  myEmergencyDecelRow->show();
1382  mySteppingRow->show();
1383  myMinGapFactorRow->show();
1384  break;
1385  case SUMO_TAG_CF_IDMM:
1386  myTauRow->show();
1387  myAccelRow->show();
1388  myDecelRow->show();
1389  myEmergencyDecelRow->show();
1390  mySteppingRow->show();
1391  myMinGapFactorRow->show();
1392  myAdaptFactorRow->show();
1393  myAdaptTimeRow->show();
1394  break;
1395  case SUMO_TAG_CF_BKERNER:
1396  myTauRow->show();
1397  myAccelRow->show();
1398  myDecelRow->show();
1399  myEmergencyDecelRow->show();
1400  myKRow->show();
1401  myPhiRow->show();
1402  myMinGapFactorRow->show();
1403  break;
1404  case SUMO_TAG_CF_WIEDEMANN:
1405  myTauRow->show();
1406  myAccelRow->show();
1407  myDecelRow->show();
1408  myEmergencyDecelRow->show();
1409  myMinGapFactorRow->show();
1410  mySecurityRow->show();
1411  myEstimationRow->show();
1412  break;
1413  case SUMO_TAG_CF_RAIL:
1414  myTauRow->show();
1415  myTrainTypeRow->show();
1416  break;
1417  case SUMO_TAG_CF_ACC:
1418  myTauRow->show();
1419  myAccelRow->show();
1420  myDecelRow->show();
1421  myEmergencyDecelRow->show();
1422  myMinGapFactorRow->show();
1423  // show myLabelIncompleteAttribute
1424  myLabelIncompleteAttribute->show();
1435  break;
1436  case SUMO_TAG_CF_CACC:
1437  myTauRow->show();
1438  myAccelRow->show();
1439  myDecelRow->show();
1440  myEmergencyDecelRow->show();
1441  myMinGapFactorRow->show();
1442  // show myLabelIncompleteAttribute
1443  myLabelIncompleteAttribute->show();
1460  break;
1461  case SUMO_TAG_CF_CC:
1462  myTauRow->show();
1463  myAccelRow->show();
1464  myDecelRow->show();
1465  // show myLabelIncompleteAttribute
1466  myLabelIncompleteAttribute->show();
1488  break;
1489  default:
1490  break;
1491  }
1492  }
1493  myVerticalFrameRows->recalc();
1494  update();
1495 }
1496 
1497 
1498 void
1500  //set values of myEditedDemandElement into fields
1501  if (myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_CAR_FOLLOW_MODEL).empty()) {
1502  myComboBoxCarFollowModel->setCurrentItem(0);
1503  } else {
1504  myComboBoxCarFollowModel->setText(myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_CAR_FOLLOW_MODEL).c_str());
1505  }
1506  // refresh fields
1507  refreshCFMFields();
1508  // update value in all Rows
1509  for (const auto& i : myRows) {
1510  i->updateValue();
1511  }
1512 }
1513 
1514 
1515 long
1517  // At start we assumed, that all values are valid
1518  myVehicleTypeDialog->myVehicleTypeValid = true;
1519  myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_NOTHING;
1520  // set color of myTextFieldCarFollowModel, depending if current value is valid or not
1521  if (myVehicleTypeDialog->myEditedDemandElement->isValid(SUMO_ATTR_CAR_FOLLOW_MODEL, myComboBoxCarFollowModel->getText().text())) {
1522  myComboBoxCarFollowModel->setTextColor(FXRGB(0, 0, 0));
1523  myVehicleTypeDialog->myEditedDemandElement->setAttribute(SUMO_ATTR_CAR_FOLLOW_MODEL, myComboBoxCarFollowModel->getText().text(), myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
1524  } else {
1525  myComboBoxCarFollowModel->setTextColor(FXRGB(255, 0, 0));
1526  myVehicleTypeDialog->myVehicleTypeValid = false;
1527  myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_CAR_FOLLOW_MODEL;
1528  }
1529  // set variable in all Rows
1530  for (const auto& i : myRows) {
1531  i->setVariable();
1532  }
1533  // refresh fields
1534  refreshCFMFields();
1535  return true;
1536 }
1537 
1538 // ---------------------------------------------------------------------------
1539 // GNEVehicleTypeDialog - public methods
1540 // ---------------------------------------------------------------------------
1541 
1542 GNEVehicleTypeDialog::GNEVehicleTypeDialog(GNEDemandElement* editedVehicleType, bool updatingElement) :
1543  GNEDemandElementDialog(editedVehicleType, updatingElement, /*1022*/ /*1322*/ 1372, 575),
1544  myVehicleTypeValid(true),
1546 
1547  // change default header
1548  changeDemandElementDialogHeader(updatingElement ? "Edit " + myEditedDemandElement->getTagStr() : "Create " + myEditedDemandElement->getTagStr());
1549 
1550  // Create auxiliar frames for values
1551  FXHorizontalFrame* columns = new FXHorizontalFrame(myContentFrame, GUIDesignAuxiliarHorizontalFrame);
1552 
1553  // create vehicle type attributes
1554  myVTypeAtributes = new VTypeAtributes(this, columns);
1555 
1556  // create car following model parameters
1558 
1559  // start a undo list for editing local to this additional
1560  initChanges();
1561 
1562  // add element if we aren't updating an existent element
1563  if (myUpdatingElement == false) {
1565  }
1566 
1567  // update values of Vehicle Type common attributes
1569 
1570  // update values of Car Following Model Parameters
1572 
1573  // open as modal dialog
1575 }
1576 
1577 
1579 
1580 
1581 long
1582 GNEVehicleTypeDialog::onCmdAccept(FXObject*, FXSelector, void*) {
1583  if (myVehicleTypeValid == false) {
1584  // write warning if netedit is running in testing mode
1585  WRITE_DEBUG("Opening FXMessageBox of type 'warning'");
1586  std::string operation1 = myUpdatingElement ? ("updating") : ("creating");
1587  std::string operation2 = myUpdatingElement ? ("updated") : ("created");
1588  std::string tagString = myEditedDemandElement->getTagStr();
1589  // open warning dialogBox
1590  FXMessageBox::warning(getApp(), MBOX_OK,
1591  ("Error " + operation1 + " " + tagString).c_str(), "%s",
1592  (tagString + " cannot be " + operation2 +
1593  " because parameter " + toString(myInvalidAttr) +
1594  " is invalid.").c_str());
1595  // write warning if netedit is running in testing mode
1596  WRITE_DEBUG("Closed FXMessageBox of type 'warning' with 'OK'");
1597  return 0;
1598  } else {
1599  // accept changes before closing dialog
1600  acceptChanges();
1601  // stop dialgo sucesfully
1602  getApp()->stopModal(this, TRUE);
1603  return 1;
1604  }
1605 }
1606 
1607 
1608 long
1609 GNEVehicleTypeDialog::onCmdCancel(FXObject*, FXSelector, void*) {
1610  // cancel changes
1611  cancelChanges();
1612  // Stop Modal
1613  getApp()->stopModal(this, FALSE);
1614  return 1;
1615 }
1616 
1617 
1618 long
1619 GNEVehicleTypeDialog::onCmdReset(FXObject*, FXSelector, void*) {
1620  // reset changes
1621  resetChanges();
1622  // update values of Vehicle Type common attributes
1624  // update values of Car Following Model Parameters
1626  return 1;
1627 }
1628 
1629 // ---------------------------------------------------------------------------
1630 // GNEVehicleTypeDialog - private methods
1631 // ---------------------------------------------------------------------------
1632 
1634  FXHorizontalFrame(verticalFrame, GUIDesignAuxiliarHorizontalFrame),
1635  myCarFollowingModelParametersParent(carFollowingModelParametersParent),
1636  myAttr(attr),
1637  myTextField(nullptr) {
1638  new FXLabel(this, toString(attr).c_str(), nullptr, GUIDesignLabelAttribute150);
1639  myTextField = new FXTextField(this, GUIDesignTextFieldNCol, carFollowingModelParametersParent, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFielWidth180);
1640 }
1641 
1642 
1643 void
1645  // set color of textField, depending if current value is valid or not
1646  if (myCarFollowingModelParametersParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, myTextField->getText().text())) {
1647  // set color depending if is a default value
1648  if (myCarFollowingModelParametersParent->myVehicleTypeDialog->myEditedDemandElement->getTagProperty().getDefaultValue(myAttr) != myTextField->getText().text()) {
1649  myTextField->setTextColor(FXRGB(0, 0, 0));
1650  } else {
1651  myTextField->setTextColor(FXRGB(195, 195, 195));
1652  }
1653  myCarFollowingModelParametersParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, myTextField->getText().text(),
1654  myCarFollowingModelParametersParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
1655  // update value after setting it
1656  updateValue();
1657  } else {
1658  myTextField->setTextColor(FXRGB(255, 0, 0));
1659  // mark VType as invalid
1660  myCarFollowingModelParametersParent->myVehicleTypeDialog->myVehicleTypeValid = false;
1661  myCarFollowingModelParametersParent->myVehicleTypeDialog->myInvalidAttr = myAttr;
1662  }
1663 }
1664 
1665 
1666 void
1668  // set text of myTextField using current value of VType
1669  myTextField->setText(myCarFollowingModelParametersParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr).c_str());
1670  // set color depending if is a default value
1671  if (myCarFollowingModelParametersParent->myVehicleTypeDialog->myEditedDemandElement->getTagProperty().getDefaultValue(myAttr) != myTextField->getText().text()) {
1672  myTextField->setTextColor(FXRGB(0, 0, 0));
1673  } else {
1674  myTextField->setTextColor(FXRGB(195, 195, 195));
1675  }
1676 }
1677 
1678 
1679 /****************************************************************************/
FXDEFMAP(GNEVehicleTypeDialog::VTypeAtributes) VTypeAtributesMap[]
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition: GUIAppEnum.h:717
@ MID_GNE_OPEN_PARAMETERS_DIALOG
open parameters dialog
Definition: GUIAppEnum.h:751
@ MID_GNE_SET_ATTRIBUTE_DIALOG
attribute edited trought dialog
Definition: GUIAppEnum.h:749
#define GUIDesignComboBox
Definition: GUIDesigns.h:237
#define GUIDesignComboBoxWidth180
comboBox with thick frame, width 180 (Used in GNEVehicleType)
Definition: GUIDesigns.h:249
#define GUIDesignComboBoxNCol
number of column of every combo box
Definition: GUIDesigns.h:255
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition: GUIDesigns.h:313
#define GUIDesignTextFielWidth180
text field with thick frame, width of 180 (Used in GNEVehicleType)
Definition: GUIDesigns.h:51
#define GUIDesignLabelTickedIcon180x46
label ticked filled extended over frame used for VClasses/VShapes. (can be used by icons of 64x32 pix...
Definition: GUIDesigns.h:220
#define GUIDesignLabelAboutInfoCenter
label extended over frame with thick and with text justify to center
Definition: GUIDesigns.h:208
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition: GUIDesigns.h:54
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
Definition: GUIDesigns.h:278
#define GUIDesignAuxiliarVerticalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition: GUIDesigns.h:316
#define GUIDesignButtonRectangular150
button rectangular with thick and raise frame with a width of 150
Definition: GUIDesigns.h:80
#define GUIDesignLabelAttribute150
label extended over the matrix column with thick frame
Definition: GUIDesigns.h:202
#define GUIDesignAuxiliarFrame
design for auxiliar (Without borders) frames used to pack another frames extended in all directions
Definition: GUIDesigns.h:310
FXString gCurrentFolder
The folder used as last.
@ VCLASS_TRAILER
@ VCLASS_PASSENGER
@ VSHAPE_PEDESTRIAN
@ VSHAPE_PASSENGER
@ VCLASS_BICYCLE
@ VSHAPE_UNKNOWN
@ 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
#define WRITE_DEBUG(msg)
Definition: MsgHandler.h:286
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, SVS_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
@ SVS_BICYCLE
render as a bicycle
@ SVS_FIREBRIGADE
render as a fire brigade
@ SVS_ANT
render as a giant ant
@ SVS_PASSENGER_HATCHBACK
render as a hatchback passenger vehicle ("Fliessheck")
@ SVS_TRUCK_SEMITRAILER
render as a semi-trailer transport vehicle ("Sattelschlepper")
@ SVS_RAIL
render as a rail
@ SVS_EMERGENCY
render as an emergency vehicle
@ SVS_DELIVERY
automated car (with cruise controllers)
@ SVS_MOTORCYCLE
render as a motorcycle
@ SVS_UNKNOWN
not defined
@ SVS_PASSENGER
render as a passenger vehicle
@ SVS_TRUCK
render as a transport vehicle
@ SVS_PASSENGER_SEDAN
render as a sedan passenger vehicle ("Stufenheck")
@ SVS_BUS
render as a bus
@ SVS_MOPED
render as a moped
@ SVS_E_VEHICLE
render as a (futuristic) e-vehicle
@ SVS_BUS_FLEXIBLE
render as a flexible city bus
@ SVS_BUS_TROLLEY
render as a trolley bus
@ SVS_RAIL_CARGO
render as a cargo train
@ SVS_BUS_COACH
render as a coach
@ SVS_SHIP
render as a arbitrary ship
@ SVS_RAIL_CAR
render as a (city) rail without locomotive
@ SVS_PASSENGER_WAGON
render as a wagon passenger vehicle ("Combi")
@ SVS_PASSENGER_VAN
render as a van
@ SVS_PEDESTRIAN
render as a pedestrian
@ SVS_POLICE
render as a police car
@ SVS_RICKSHAW
render as a rickshaw
@ SVS_TRUCK_1TRAILER
render as a transport vehicle with one trailer
@ 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_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_LCA_PUSHY
@ SUMO_ATTR_EMISSIONCLASS
@ SUMO_ATTR_JM_IGNORE_FOE_SPEED
@ SUMO_ATTR_JM_IGNORE_KEEPCLEAR_TIME
@ SUMO_ATTR_CF_WIEDEMANN_SECURITY
@ SUMO_ATTR_LCA_ASSERTIVE
@ SUMO_ATTR_TRAIN_TYPE
@ SUMO_ATTR_CF_IDMM_ADAPT_TIME
@ SUMO_ATTR_LANE_CHANGE_MODEL
@ SUMO_ATTR_CF_KERNER_PHI
@ SUMO_ATTR_LCA_TURN_ALIGNMENT_DISTANCE
@ 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_LCA_MAXSPEEDLATFACTOR
@ SUMO_ATTR_CF_PWAGNER2009_TAULAST
@ SUMO_ATTR_CAR_FOLLOW_MODEL
@ 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_JM_SIGMA_MINOR
@ SUMO_ATTR_PROB
@ SUMO_ATTR_SPEEDFACTOR
@ 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_SPEEDDEV
@ SUMO_ATTR_CF_WIEDEMANN_ESTIMATION
@ SUMO_ATTR_LCA_SPEEDGAINRIGHT
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:44
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:2245
Dialog for edit parameters.
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 * mySteppingRow
Row for MinGap(only for IDM)
FXLabel * myLabelIncompleteAttribute
temporal label for incomplete attributes
CarFollowingModelRow * mySecurityRow
Row for Security (only for Wiedemann)
CarFollowingModelRow * myAccelRow
Row for Accel.
CarFollowingModelRow * myAprobRow
Row for Aprob.
CarFollowingModelRow * myKRow
Row for MinGap (only for Kerner)
long onCmdSetVariable(FXObject *, FXSelector, void *)
CarFollowingModelRow * myAdaptFactorRow
Row for Adapt Factor.
FXVerticalFrame * myVerticalFrameRows
Vertical Frame for CarFollowingModelRow.
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 * 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 * myAdaptTimeRow
Row for Adapt Time.
CarFollowingModelRow * myDeltaRow
Row for MinGap (only for IDM)
CarFollowingModelRow * myTrauLastRow
Row for TauLast.
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 * mySpeedDev
VTypeAttributeRow for SpeedDev.
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 RGBColor parseColor(std::string coldef)
Parses a color information.
Definition: RGBColor.cpp:168
static const RGBColor BLACK
Definition: RGBColor.h:188
static StringBijection< SumoXMLTag > CarFollowModels
car following models
static StringBijection< LaneChangeModel > LaneChangeModels
lane change models
static StringBijection< LateralAlignment > LateralAlignments
lateral alignments
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