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
21#include <netedit/GNENet.h>
22#include <netedit/GNEUndoList.h>
23#include <netedit/GNEViewNet.h>
30
32
33
34// ===========================================================================
35// FOX callback mapping
36// ===========================================================================
37
42};
43
46};
47
48// Object implementation
49FXIMPLEMENT(GNEVehicleTypeDialog::VTypeAtributes, FXVerticalFrame, VTypeAtributesMap, ARRAYNUMBER(VTypeAtributesMap))
50FXIMPLEMENT(GNEVehicleTypeDialog::CarFollowingModelParameters, FXGroupBox, CarFollowingModelParametersMap, ARRAYNUMBER(CarFollowingModelParametersMap))
51
52// ===========================================================================
53// member method definitions
54// ===========================================================================
55
56// ---------------------------------------------------------------------------
57// GNEVehicleTypeDialog::VClassRow - methods
58// ---------------------------------------------------------------------------
59
60GNEVehicleTypeDialog::VTypeAtributes::VClassRow::VClassRow(VTypeAtributes* VTypeAtributesParent, FXVerticalFrame* column) :
61 FXHorizontalFrame(column, GUIDesignAuxiliarHorizontalFrame),
62 myVTypeAtributesParent(VTypeAtributesParent) {
63 // create two auxiliary frames
64 FXVerticalFrame* verticalFrameLabelAndComboBox = new FXVerticalFrame(this, GUIDesignAuxiliarVerticalFrame);
65 // create FXComboBox for VClass
66 new FXLabel(verticalFrameLabelAndComboBox, toString(SUMO_ATTR_VCLASS).c_str(), nullptr, GUIDesignLabelAttribute150);
67 myComboBoxVClass = new MFXIconComboBox(verticalFrameLabelAndComboBox, GUIDesignComboBoxNCol, true,
68 VTypeAtributesParent, MID_GNE_SET_ATTRIBUTE, GUIDesignComboBox);
69 myComboBoxVClassLabelImage = new FXLabel(this, "", nullptr, GUIDesignLabelTickedIcon180x46);
70 myComboBoxVClassLabelImage->setBackColor(FXRGBA(255, 255, 255, 255));
71 // fill combo Box with all allowed VClass for the current edited VType
72 for (const auto& vClass : myVTypeAtributesParent->myVehicleTypeDialog->getEditedDemandElement()->getTagProperty().getAttributeProperties(SUMO_ATTR_VCLASS).getDiscreteValues()) {
73 myComboBoxVClass->appendIconItem(vClass.c_str(), GNEAttributeCarrier::getVClassIcon(SumoVehicleClassStrings.get(vClass)));
74 }
75 // only show as maximum 10 VClasses
76 if (myComboBoxVClass->getNumItems() > 10) {
77 myComboBoxVClass->setNumVisible(10);
78 } else {
79 myComboBoxVClass->setNumVisible(myComboBoxVClass->getNumItems());
80 }
81}
82
83
86 // set color of myComboBoxVClass, depending if current value is valid or not
87 myComboBoxVClass->setTextColor(FXRGB(0, 0, 0));
89 myComboBoxVClass->setTextColor(FXRGB(0, 0, 0));
90 // check if VType has to be updated
92 // update VClass in VType
95 // update label image
97 // obtain default vType parameters
99 // check if mutable rows need to be updated
101 myVTypeAtributesParent->myLength->updateValue(toString(defaultVTypeParameters.length));
102 }
104 myVTypeAtributesParent->myMinGap->updateValue(toString(defaultVTypeParameters.minGap));
105 }
108 }
111 }
114 }
117 }
119 myVTypeAtributesParent->myWidth->updateValue(toString(defaultVTypeParameters.width));
120 }
122 myVTypeAtributesParent->myHeight->updateValue(toString(defaultVTypeParameters.height));
123 }
126 }
129 }
132 }
135 }
138 }
139 // update GUIShape
140 if (myComboBoxVClass->getText().empty()) {
142 } else {
144 }
145 }
146 } else {
147 myComboBoxVClass->setTextColor(FXRGB(255, 0, 0));
150 }
152}
153
154
157 const auto vClass = myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_VCLASS);
158 int index = 0;
159 for (int i = 0; i < myComboBoxVClass->getNumItems(); i++) {
160 if (myComboBoxVClass->getItem(i).text() == vClass) {
161 index = i;
162 }
163 }
164 myComboBoxVClass->setCurrentItem(index);
165 setVClassLabelImage();
166 return myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getVClass();
167}
168
169
170void
172 // by default vClass is passenger
173 if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_VCLASS).empty()) {
174 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_PASSENGER));
175 } else {
176 // set Icon in label depending of current VClass
177 switch (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getVClass()) {
178 case SVC_PRIVATE:
179 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_PRIVATE));
180 break;
181 case SVC_EMERGENCY:
182 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_EMERGENCY));
183 break;
184 case SVC_AUTHORITY:
185 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_AUTHORITY));
186 break;
187 case SVC_ARMY:
188 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_ARMY));
189 break;
190 case SVC_VIP:
191 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_VIP));
192 break;
193 case SVC_PASSENGER:
194 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_PASSENGER));
195 break;
196 case SVC_HOV:
197 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_HOV));
198 break;
199 case SVC_TAXI:
200 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_TAXI));
201 break;
202 case SVC_BUS:
203 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_BUS));
204 break;
205 case SVC_COACH:
206 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_COACH));
207 break;
208 case SVC_DELIVERY:
209 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_DELIVERY));
210 break;
211 case SVC_TRUCK:
212 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_TRUCK));
213 break;
214 case SVC_TRAILER:
215 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_TRAILER));
216 break;
217 case SVC_TRAM:
218 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_TRAM));
219 break;
220 case SVC_RAIL_URBAN:
221 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_RAIL_URBAN));
222 break;
223 case SVC_RAIL:
224 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_RAIL));
225 break;
227 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_RAIL_ELECTRIC));
228 break;
229 case SVC_RAIL_FAST:
230 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_RAIL_FAST));
231 break;
232 case SVC_MOTORCYCLE:
233 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_MOTORCYCLE));
234 break;
235 case SVC_MOPED:
236 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_MOPED));
237 break;
238 case SVC_BICYCLE:
239 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_BICYCLE));
240 break;
241 case SVC_PEDESTRIAN:
242 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_PEDESTRIAN));
243 break;
244 case SVC_E_VEHICLE:
245 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_EVEHICLE));
246 break;
247 case SVC_SHIP:
248 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_SHIP));
249 break;
250 case SVC_CUSTOM1:
251 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_CUSTOM1));
252 break;
253 case SVC_CUSTOM2:
254 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_CUSTOM2));
255 break;
256 default:
257 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_IGNORING));
258 break;
259 }
260 }
261}
262
263// ---------------------------------------------------------------------------
264// GNEVehicleTypeDialog::VShapeRow - methods
265// ---------------------------------------------------------------------------
266
267GNEVehicleTypeDialog::VTypeAtributes::VShapeRow::VShapeRow(VTypeAtributes* VTypeAtributesParent, FXVerticalFrame* column) :
268 FXHorizontalFrame(column, GUIDesignAuxiliarHorizontalFrame),
269 myVTypeAtributesParent(VTypeAtributesParent) {
270 // create two auxiliar frames
271 FXVerticalFrame* verticalFrameLabelAndComboBox = new FXVerticalFrame(this, GUIDesignAuxiliarVerticalFrame);
272 // create combo for vehicle shapes
273 new FXLabel(verticalFrameLabelAndComboBox, toString(SUMO_ATTR_GUISHAPE).c_str(), nullptr, GUIDesignLabelAttribute150);
274 myComboBoxShape = new MFXIconComboBox(verticalFrameLabelAndComboBox, GUIDesignComboBoxNCol, false,
275 VTypeAtributesParent, MID_GNE_SET_ATTRIBUTE, GUIDesignComboBox);
276 myComboBoxShapeLabelImage = new FXLabel(this, "", nullptr, GUIDesignLabelTickedIcon180x46);
277 myComboBoxShapeLabelImage->setBackColor(FXRGBA(255, 255, 255, 255));
278 // fill combo Box with all vehicle shapes
279 std::vector<std::string> VShapeStrings = SumoVehicleShapeStrings.getStrings();
280 for (const auto& VShapeString : VShapeStrings) {
281 if (VShapeString != SumoVehicleShapeStrings.getString(SUMOVehicleShape::UNKNOWN)) {
282 myComboBoxShape->appendIconItem(VShapeString.c_str(), nullptr);
283 }
284 }
285 // only show 10 Shapes
287}
288
289
290void
292 // set color of myComboBoxShape, depending if current value is valid or not
293 if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(SUMO_ATTR_GUISHAPE, myComboBoxShape->getText().text())) {
294 myComboBoxShape->setTextColor(FXRGB(0, 0, 0));
295 myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(SUMO_ATTR_GUISHAPE, myComboBoxShape->getText().text(),
296 myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
297 setVShapeLabelImage();
298 } else {
299 myComboBoxShape->setTextColor(FXRGB(255, 0, 0));
300 myVTypeAtributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
301 myVTypeAtributesParent->myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_GUISHAPE;
302 }
303}
304
305
306void
308 myComboBoxShape->setText(myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_GUISHAPE).c_str());
309 setVShapeLabelImage();
310}
311
312
313void
315 // create new VClassDefaultValues using the new VClass
317 myComboBoxShape->setText(SumoVehicleShapeStrings.getString(newVClass.shape).c_str());
318 myComboBoxShape->setTextColor(FXRGB(0, 0, 0));
319 myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(SUMO_ATTR_GUISHAPE, myComboBoxShape->getText().text(),
320 myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
321 setVShapeLabelImage();
322}
323
324
325void
327 // set Icon in label depending of current VClass
328 switch (getVehicleShapeID(myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_GUISHAPE))) {
330 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_UNKNOWN));
331 break;
333 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PEDESTRIAN));
334 break;
336 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_BICYCLE));
337 break;
339 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_MOPED));
340 break;
342 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_MOTORCYCLE));
343 break;
345 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PASSENGER));
346 break;
348 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PASSENGER_SEDAN));
349 break;
351 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PASSENGER_HATCHBACK));
352 break;
354 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PASSENGER_WAGON));
355 break;
357 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PASSENGER_VAN));
358 break;
360 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_TAXI));
361 break;
363 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_DELIVERY));
364 break;
366 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_TRUCK));
367 break;
369 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_TRUCK_SEMITRAILER));
370 break;
372 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_TRUCK_1TRAILER));
373 break;
375 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_BUS));
376 break;
378 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_BUS_COACH));
379 break;
381 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_BUS_FLEXIBLE));
382 break;
384 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_BUS_TROLLEY));
385 break;
387 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_RAIL));
388 break;
390 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_RAIL_CAR));
391 break;
393 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_RAIL_CARGO));
394 break;
396 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_E_VEHICLE));
397 break;
399 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_ANT));
400 break;
402 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_SHIP));
403 break;
405 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_EMERGENCY));
406 break;
408 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_FIREBRIGADE));
409 break;
411 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_POLICE));
412 break;
414 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_RICKSHAW));
415 break;
417 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_SCOOTER));
418 break;
419 default:
420 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_IGNORING));
421 break;
422 }
423}
424
425// ---------------------------------------------------------------------------
426// GNEVehicleTypeDialog::VTypeAtributes - methods
427// ---------------------------------------------------------------------------
428
429GNEVehicleTypeDialog::VTypeAtributes::VTypeAttributeRow::VTypeAttributeRow(VTypeAtributes* VTypeAtributesParent, FXVerticalFrame* verticalFrame, const SumoXMLAttr attr, const RowAttrType rowAttrType, const std::vector<std::string>& values) :
430 FXHorizontalFrame(verticalFrame, GUIDesignAuxiliarHorizontalFrame),
431 myVTypeAtributesParent(VTypeAtributesParent),
432 myAttr(attr),
433 myRowAttrType(rowAttrType),
434 myButton(nullptr),
435 myTextField(nullptr),
436 myComboBox(nullptr) {
437 // first check if we have to create a button or a label
438 if ((rowAttrType == ROWTYPE_COLOR) || (rowAttrType == ROWTYPE_FILENAME)) {
439 myButton = new FXButton(this, filterAttributeName(attr), nullptr, VTypeAtributesParent, MID_GNE_SET_ATTRIBUTE_DIALOG, GUIDesignButtonRectangular150);
440 } else if (rowAttrType == ROWTYPE_PARAMETERS) {
441 myButton = new FXButton(this, TL("Edit parameters"), nullptr, VTypeAtributesParent, MID_GNE_OPEN_PARAMETERS_DIALOG, GUIDesignButtonRectangular150);
442 } else {
443 new FXLabel(this, filterAttributeName(attr), nullptr, GUIDesignLabelAttribute150);
444 }
445 // now check if we have to create a textfield or a ComboBox
446 if ((rowAttrType == ROWTYPE_STRING) || (rowAttrType == ROWTYPE_COLOR) || (rowAttrType == ROWTYPE_FILENAME) || (rowAttrType == ROWTYPE_PARAMETERS)) {
447 myTextField = new FXTextField(this, GUIDesignTextFieldNCol, VTypeAtributesParent, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFielWidth180);
448 } else if (rowAttrType == ROWTYPE_COMBOBOX) {
450 // fill combo Box with values
451 for (const auto& value : values) {
452 myComboBox->appendIconItem(value.c_str(), nullptr);
453 }
454 // set 10 visible elements as maximum
455 if (myComboBox->getNumItems() < 10) {
457 } else {
459 }
460 } else {
461 throw ProcessError("Invalid row type");
462 }
463}
464
465
466void
468 if (myRowAttrType == ROWTYPE_COMBOBOX) {
469 // set color of myComboBox, depending if current value is valid or not
470 if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, myComboBox->getText().text())) {
471 myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, myComboBox->getText().text(),
472 myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
473 // update value after setting it
474 updateValue();
475 } else {
476 myComboBox->setTextColor(FXRGB(255, 0, 0));
477 // mark VType as invalid
478 myVTypeAtributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
479 myVTypeAtributesParent->myVehicleTypeDialog->myInvalidAttr = myAttr;
480 }
481 } else if (myRowAttrType == ROWTYPE_COLOR) {
482 // set color of myTextFieldColor, depending if current value is valid or not
483 if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(SUMO_ATTR_COLOR, myTextField->getText().text())) {
484 // set color depending if is a default value
485 if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getTagProperty().getDefaultValue(SUMO_ATTR_COLOR) != myTextField->getText().text()) {
486 myTextField->setTextColor(FXRGB(0, 0, 0));
487 } else {
488 myTextField->setTextColor(FXRGB(195, 195, 195));
489 }
490 myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(SUMO_ATTR_COLOR, myTextField->getText().text(), myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
491 } else {
492 myTextField->setTextColor(FXRGB(255, 0, 0));
493 myVTypeAtributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
494 myVTypeAtributesParent->myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_COLOR;
495 }
496 } else {
497 // set color of textField, depending if current value is valid or not
498 if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, myTextField->getText().text())) {
499 myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, myTextField->getText().text(),
500 myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
501 // update value after setting it
502 updateValue();
503 } else {
504 myTextField->setTextColor(FXRGB(255, 0, 0));
505 // mark VType as invalid
506 myVTypeAtributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
507 myVTypeAtributesParent->myVehicleTypeDialog->myInvalidAttr = myAttr;
508 }
509 }
510}
511
512
513void
515 if (myComboBox) {
516 // set color of myComboBox, depending if current value is valid or not
517 if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, myComboBox->getText().text())) {
518 myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, myComboBox->getText().text(),
519 myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
520 // update value after setting it
521 updateValue(defaultValue);
522 } else {
523 myComboBox->setTextColor(FXRGB(255, 0, 0));
524 // mark VType as invalid
525 myVTypeAtributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
526 myVTypeAtributesParent->myVehicleTypeDialog->myInvalidAttr = myAttr;
527 }
528 } else {
529 // set color of textField, depending if current value is valid or not
530 if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, myTextField->getText().text())) {
531 myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, myTextField->getText().text(),
532 myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
533 // update value after setting it
534 updateValue(defaultValue);
535 } else {
536 myTextField->setTextColor(FXRGB(255, 0, 0));
537 // mark VType as invalid
538 myVTypeAtributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
539 myVTypeAtributesParent->myVehicleTypeDialog->myInvalidAttr = myAttr;
540 }
541 }
542}
543
544
545void
547 if (myRowAttrType == ROWTYPE_COMBOBOX) {
548 // set text of myComboBox using current value of VType
549 myComboBox->setText(myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr).c_str());
550 // set color depending if is a default value
551 if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getTagProperty().getDefaultValue(myAttr) != myComboBox->getText().text()) {
552 myComboBox->setTextColor(FXRGB(0, 0, 0));
553 } else {
554 myComboBox->setTextColor(FXRGB(195, 195, 195));
555 }
556 } else if (myRowAttrType == ROWTYPE_COLOR) {
557 // set field color
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 } else if (myAttr == GNE_ATTR_PARAMETERS) {
566 // get parameters
567 const std::string& parametersStr = myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr);
568 // set text of myTextField using current value of VType
569 myTextField->setText(parametersStr.c_str());
570 // set text color
571 myTextField->setTextColor(FXRGB(0, 0, 0));
572 // clear parameters
573 myParameters.clear();
574 // separate value in a vector of string using | as separator
575 StringTokenizer parameters(parametersStr, "|", true);
576 // iterate over all values
577 while (parameters.hasNext()) {
578 // obtain key and value and save it in myParameters
579 const std::vector<std::string> keyValue = StringTokenizer(parameters.next(), "=", true).getVector();
580 if (keyValue.size() == 2) {
581 myParameters[keyValue.front()] = keyValue.back();
582 }
583 }
584 } else {
585 // set text of myTextField using current value of VType
586 myTextField->setText(myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr).c_str());
587 // set color depending if is a default value
588 if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getTagProperty().getDefaultValue(myAttr) != myTextField->getText().text()) {
589 myTextField->setTextColor(FXRGB(0, 0, 0));
590 } else {
591 myTextField->setTextColor(FXRGB(195, 195, 195));
592 }
593 }
594}
595
596
597void
599 if (myComboBox) {
600 // set text of myComboBox using current value of VType
601 myComboBox->setText(myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr).c_str());
602 // set color depending if is a default value
603 if (defaultValue != myComboBox->getText().text()) {
604 myComboBox->setTextColor(FXRGB(0, 0, 0));
605 } else {
606 myComboBox->setTextColor(FXRGB(195, 195, 195));
607 }
608 } else {
609 // set text of myTextField using current value of VType
610 myTextField->setText(myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr).c_str());
611 // set color depending if is a default value
612 if (defaultValue != myTextField->getText().text()) {
613 myTextField->setTextColor(FXRGB(0, 0, 0));
614 } else {
615 myTextField->setTextColor(FXRGB(195, 195, 195));
616 }
617 }
618}
619
620
621const FXButton*
623 return myButton;
624}
625
626
627void
629 // create FXColorDialog
630 FXColorDialog colordialog(this, tr("Color Dialog"));
631 colordialog.setTarget(this);
632 // If previous attribute wasn't correct, set black as default color
633 if (GNEAttributeCarrier::canParse<RGBColor>(myTextField->getText().text())) {
634 colordialog.setRGBA(MFXUtils::getFXColor(GNEAttributeCarrier::parse<RGBColor>(myTextField->getText().text())));
635 } else {
636 colordialog.setRGBA(MFXUtils::getFXColor(RGBColor::BLACK));
637 }
638 // execute dialog to get a new color
639 if (colordialog.execute()) {
640 std::string newValue = toString(MFXUtils::getRGBColor(colordialog.getRGBA()));
641 myTextField->setText(newValue.c_str());
642 if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, newValue)) {
643 myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, newValue, myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
644 // If previously value was incorrect, change font color to black
645 myTextField->setTextColor(FXRGB(0, 0, 0));
646 myTextField->killFocus();
647 }
648 }
649}
650
651
652void
654 // get the new image file
655 FXFileDialog opendialog(this, TL("Open Image"));
656 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::VTYPE));
657 opendialog.setSelectMode(SELECTFILE_EXISTING);
658 opendialog.setPatternList("All files (*)");
659 if (gCurrentFolder.length() != 0) {
660 opendialog.setDirectory(gCurrentFolder);
661 }
662 if (opendialog.execute()) {
663 // update global current folder
664 gCurrentFolder = opendialog.getDirectory();
665 // get image path
666 std::string imagePath = opendialog.getFilename().text();
667 // check if image is valid
668 if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, imagePath)) {
669 myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, imagePath, myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
670 myTextField->setText(imagePath.c_str());
671 // If previously value was incorrect, change font color to black
672 myTextField->setTextColor(FXRGB(0, 0, 0));
673 myTextField->killFocus();
674 }
675 }
676}
677
678
679void
681 // get the new file name
682 FXFileDialog opendialog(this, TL("Open OSG File"));
683 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::VTYPE));
684 opendialog.setSelectMode(SELECTFILE_EXISTING);
685 opendialog.setPatternList("OSG file (*.obj)");
686 if (gCurrentFolder.length() != 0) {
687 opendialog.setDirectory(gCurrentFolder);
688 }
689 if (opendialog.execute()) {
690 // update global current folder
691 gCurrentFolder = opendialog.getDirectory();
692 // get image path
693 std::string imagePath = opendialog.getFilename().text();
694 // check if image is valid
695 if (myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, imagePath)) {
696 myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, imagePath, myVTypeAtributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
697 myTextField->setText(imagePath.c_str());
698 // If previously value was incorrect, change font color to black
699 myTextField->setTextColor(FXRGB(0, 0, 0));
700 myTextField->killFocus();
701 }
702 }
703}
704
705
706std::string
708 return myTextField->getText().text();
709}
710
711
712std::vector<std::pair<std::string, std::string> >
714 std::vector<std::pair<std::string, std::string> > result;
715 // Generate a vector string using the following structure: "<key1,value1>, <key2, value2>,...
716 for (const auto& parameter : myParameters) {
717 result.push_back(std::make_pair(parameter.first, parameter.second));
718 }
719 return result;
720}
721
722
723void
724GNEVehicleTypeDialog::VTypeAtributes::VTypeAttributeRow::setParameters(const std::vector<std::pair<std::string, std::string> >& parameters) {
725 // first clear parameters
726 myParameters.clear();
727 // declare result
728 std::string result;
729 // iterate over parameters
730 for (const auto& parameter : parameters) {
731 // Generate an string using the following structure: "key1=value1|key2=value2|...
732 result += parameter.first + "=" + parameter.second + "|";
733 // fill parameters
734 myParameters[parameter.first] = parameter.second;
735 }
736 // remove the last "|"
737 if (!result.empty()) {
738 result.pop_back();
739 }
740 // set text field
741 myTextField->setText(result.c_str());
742}
743
744
745FXString
747 switch (attr) {
748 // JM
750 return "crossingGap";
752 return "driveAfterYellowTime";
754 return "driveAfterRedTime";
756 return "driveRedSpeed";
758 return "ignoreKeepClearTime";
760 return "ignoreFoeSpeed";
762 return "ignoreFoeProb";
764 return "sigmaMinor";
766 return "timegapMinor";
767 // LCM
769 return "strategic";
771 return "cooperative";
773 return "speedGain";
775 return "keepRight";
777 return "sublane";
779 return "opposite";
781 return "pushy";
783 return "pushyGap";
785 return "assertive";
787 return "impatience";
789 return "timeToImpatience";
791 return "accelLat";
793 return "lookaheadLeft";
795 return "speedGainRight";
797 return "maxSpeedLatStanding";
799 return "maxSpeedLatFactor";
801 return "turnAlignDistance";
803 return "overtakeRight";
805 return "keepRightAcceptanceTime";
807 return "overtakeDeltaSpeedFactor";
808 /* case SUMO_ATTR_LCA_EXPERIMENTAL1:
809 return "experimental1";
810 */
811 default:
812 return toString(attr).c_str();
813 }
814}
815
816// ---------------------------------------------------------------------------
817// GNEVehicleTypeDialog::VTypeAtributes - methods
818// ---------------------------------------------------------------------------
819
821 FXVerticalFrame(column, GUIDesignAuxiliarVerticalFrame),
822 myVehicleTypeDialog(vehicleTypeDialog) {
823 // declare two auxiliary horizontal frames
824 FXHorizontalFrame* firstAuxiliarHorizontalFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
825 FXVerticalFrame* firstAuxiliarVerticalFrame = new FXVerticalFrame(firstAuxiliarHorizontalFrame, GUIDesignAuxiliarVerticalFrame);
826 // create attributes for common attributes
827 FXGroupBox* commonAttributes = new FXGroupBox(firstAuxiliarVerticalFrame, "Vehicle Type attributes", GUIDesignGroupBoxFrame);
828 // create horizontal frame for columns of attributes
829 FXHorizontalFrame* columnsBasicVTypeAttributes = new FXHorizontalFrame(commonAttributes, GUIDesignAuxiliarHorizontalFrame);
830 // build left attributes
831 buildAttributesA(new FXVerticalFrame(columnsBasicVTypeAttributes, GUIDesignAuxiliarFrame));
832 // build right attributes
833 buildAttributesB(new FXVerticalFrame(columnsBasicVTypeAttributes, GUIDesignAuxiliarFrame));
834 // create GroupBox for Junction Model Attributes
835 FXGroupBox* JMAttributes = new FXGroupBox(firstAuxiliarVerticalFrame, "Junction Model attributes", GUIDesignGroupBoxFrame);
836 // create horizontal frame for columns of Junction Model attributes
837 FXHorizontalFrame* columnsJMVTypeAttributes = new FXHorizontalFrame(JMAttributes, GUIDesignAuxiliarHorizontalFrame);
838 // build left attributes
839 buildJunctionModelAttributesA(new FXVerticalFrame(columnsJMVTypeAttributes, GUIDesignAuxiliarFrame));
840 // build right attributes
841 buildJunctionModelAttributesB(new FXVerticalFrame(columnsJMVTypeAttributes, GUIDesignAuxiliarFrame));
842 // create GroupBox for Junction Model Attributes
843 FXGroupBox* LCMAttributes = new FXGroupBox(firstAuxiliarHorizontalFrame, "Lane Change Model attributes", GUIDesignGroupBoxFrame);
844 // create Lane Change Model Attributes
845 buildLaneChangeModelAttributes(new FXVerticalFrame(LCMAttributes, GUIDesignAuxiliarFrame));
846}
847
848
849void
851 // 01 Create VClassRow
852 myVClassRow = new VClassRow(this, column);
853
854 // 02 create FXTextField and Label for vehicleTypeID
855 FXHorizontalFrame* row = new FXHorizontalFrame(column, GUIDesignAuxiliarHorizontalFrame);
856 new FXLabel(row, toString(SUMO_ATTR_ID).c_str(), nullptr, GUIDesignLabelAttribute150);
857 myTextFieldVehicleTypeID = new FXTextField(row, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFielWidth180);
858
859 // 03 create FXTextField and Button for Color
860 myColor = new VTypeAttributeRow(this, column, SUMO_ATTR_COLOR, VTypeAttributeRow::RowAttrType::ROWTYPE_COLOR);
861
862 // 04 create FXTextField and Label for Length
863 myLength = new VTypeAttributeRow(this, column, SUMO_ATTR_LENGTH, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
864
865 // 05 create FXTextField and Label for MinGap
866 myMinGap = new VTypeAttributeRow(this, column, SUMO_ATTR_MINGAP, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
867
868 // 06 create FXTextField and Label for MaxSpeed
869 myMaxSpeed = new VTypeAttributeRow(this, column, SUMO_ATTR_MAXSPEED, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
870
871 // 07 create VTypeAttributeRow and Label for desired max speed
872 myDesiredMaxSpeed = new VTypeAttributeRow(this, column, SUMO_ATTR_DESIRED_MAXSPEED, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
873
874 // 08 create FXTextField and Label for SpeedFactor
875 mySpeedFactor = new VTypeAttributeRow(this, column, SUMO_ATTR_SPEEDFACTOR, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
876
877 // 09 create FXTextField and Label for EmissionClass
878 myEmissionClass = new VTypeAttributeRow(this, column, SUMO_ATTR_EMISSIONCLASS, VTypeAttributeRow::RowAttrType::ROWTYPE_COMBOBOX, PollutantsInterface::getAllClassesStr());
879
880 // 10 create FXTextField and Label for Width
881 myWidth = new VTypeAttributeRow(this, column, SUMO_ATTR_WIDTH, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
882
883 // 11 create FXTextField and Label for Height
884 myHeight = new VTypeAttributeRow(this, column, SUMO_ATTR_HEIGHT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
885
886 // 12 create FXTextField and Label for Filename
887 myFilename = new VTypeAttributeRow(this, column, SUMO_ATTR_IMGFILE, VTypeAttributeRow::RowAttrType::ROWTYPE_FILENAME);
888
889 // 13 create FXTextField and Label for Filename
890 myOSGFile = new VTypeAttributeRow(this, column, SUMO_ATTR_OSGFILE, VTypeAttributeRow::RowAttrType::ROWTYPE_FILENAME);
891
892 // 14 create VTypeAttributeRow and Label for LaneChangeModel
893 myLaneChangeModel = new VTypeAttributeRow(this, column, SUMO_ATTR_LANE_CHANGE_MODEL, VTypeAttributeRow::RowAttrType::ROWTYPE_COMBOBOX, SUMOXMLDefinitions::LaneChangeModels.getStrings());
894}
895
896
897void
899 // 01 Create VShapeRow
900 myVShapeRow = new VShapeRow(this, column);
901
902 // 02 create VTypeAttributeRow and Label for Probability
903 myProbability = new VTypeAttributeRow(this, column, SUMO_ATTR_PROB, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
904
905 // 03 create VTypeAttributeRow and Label for PersonCapacity
906 myPersonCapacity = new VTypeAttributeRow(this, column, SUMO_ATTR_PERSON_CAPACITY, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
907
908 // 04 create VTypeAttributeRow and Label for ContainerCapacity
909 myContainerCapacity = new VTypeAttributeRow(this, column, SUMO_ATTR_CONTAINER_CAPACITY, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
910
911 // 05 create VTypeAttributeRow and Label for BoardingDuration
912 myBoardingDuration = new VTypeAttributeRow(this, column, SUMO_ATTR_BOARDING_DURATION, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
913
914 // 06 create VTypeAttributeRow and Label for LoadingDuration
915 myLoadingDuration = new VTypeAttributeRow(this, column, SUMO_ATTR_LOADING_DURATION, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
916
917 // 07 create ComboBox and Label for LatAlignment
918 myLatAlignment = new VTypeAttributeRow(this, column, SUMO_ATTR_LATALIGNMENT, VTypeAttributeRow::RowAttrType::ROWTYPE_COMBOBOX, SUMOVTypeParameter::getLatAlignmentStrings());
919
920 // 08 create VTypeAttributeRow and Label for MinGapLat
921 myMinGapLat = new VTypeAttributeRow(this, column, SUMO_ATTR_MINGAP_LAT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
922
923 // 09 create VTypeAttributeRow and Label for MaxSpeedLat
924 myMaxSpeedLat = new VTypeAttributeRow(this, column, SUMO_ATTR_MAXSPEED_LAT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
925
926 // 10 create VTypeAttributeRow and Label for ActionStepLength
927 myActionStepLength = new VTypeAttributeRow(this, column, SUMO_ATTR_ACTIONSTEPLENGTH, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
928
929 // 11 create FXTextField and Label for Carriage length
930 myCarriageLength = new VTypeAttributeRow(this, column, SUMO_ATTR_CARRIAGE_LENGTH, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
931
932 // 12 create FXTextField and Label for Locomotive length
933 myLocomotiveLength = new VTypeAttributeRow(this, column, SUMO_ATTR_LOCOMOTIVE_LENGTH, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
934
935 // 13 create FXTextField and Label for carriage GAP
936 myCarriageGap = new VTypeAttributeRow(this, column, SUMO_ATTR_CARRIAGE_GAP, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
937
938 // 14 create FXTextField and Label for parameters
939 myParameters = new VTypeAttributeRow(this, column, GNE_ATTR_PARAMETERS, VTypeAttributeRow::RowAttrType::ROWTYPE_PARAMETERS);
940}
941
942
943void
945 // 01 create VTypeAttributeRow and Label for JMCrossingGap
946 myJMCrossingGap = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_CROSSING_GAP, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
947
948 // 02 create VTypeAttributeRow and Label for JMIgnoreKeepclearTime
949 myJMIgnoreKeepclearTime = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_IGNORE_KEEPCLEAR_TIME, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
950
951 // 03 create VTypeAttributeRow and Label for JMDriveAfterYellowTime
952 myJMDriveAfterYellowTime = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_DRIVE_AFTER_YELLOW_TIME, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
953
954 // 04 create VTypeAttributeRow and Label for JMDriveAfterRedTime
955 myJMDriveAfterRedTime = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_DRIVE_AFTER_RED_TIME, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
956
957 // 05 create VTypeAttributeRow and Label for JMDriveRedSpeed
958 myJMDriveRedSpeed = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_DRIVE_RED_SPEED, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
959}
960
961
962void
964 // 01 create VTypeAttributeRow and Label for JMIgnoreFoeProb
965 myJMIgnoreFoeProb = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_IGNORE_FOE_PROB, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
966
967 // 02 create VTypeAttributeRow and Label for JMIgnoreFoeSpeed
968 myJMIgnoreFoeSpeed = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_IGNORE_FOE_SPEED, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
969
970 // 03 create VTypeAttributeRow and Label for JMSigmaMinor
971 myJMSigmaMinor = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_SIGMA_MINOR, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
972
973 // 04 create VTypeAttributeRow and Label for JMTimeGapMinor
974 myJMTimeGapMinor = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_TIMEGAP_MINOR, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
975
976 // 05 create VTypeAttributeRow and Label for Impatience
977 myJMImpatience = new VTypeAttributeRow(this, column, SUMO_ATTR_IMPATIENCE, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
978}
979
980
981void
983 // 01 create VTypeAttributeRow and Label for strategic param
984 myLCAStrategicParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_STRATEGIC_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
985
986 // 02 create VTypeAttributeRow and Label for cooperative param
987 myLCACooperativeParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_COOPERATIVE_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
988
989 // 03 create VTypeAttributeRow and Label for speed gain param
990 myLCASpeedgainParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_SPEEDGAIN_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
991
992 // 04 create VTypeAttributeRow and Label for keepright param
993 myLCAKeeprightParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_KEEPRIGHT_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
994
995 // 05 create VTypeAttributeRow and Label for sublane param
996 myLCASublaneParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_SUBLANE_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
997
998 // 06 create VTypeAttributeRow and Label for opposite param
999 myLCAOppositeParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_OPPOSITE_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1000
1001 // 07 create VTypeAttributeRow and Label for pushy
1002 myLCAPushy = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_PUSHY, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1003
1004 // 08 create VTypeAttributeRow and Label for pushy gap
1005 myLCAPushygap = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_PUSHYGAP, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1006
1007 // 09 create VTypeAttributeRow and Label for assertive
1008 myLCAAssertive = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_ASSERTIVE, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1009
1010 // 10 create VTypeAttributeRow and Label for impatience
1011 myLCAImpatience = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_IMPATIENCE, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1012
1013 // 11 create VTypeAttributeRow and Label for time to impatience
1014 myLCATimeToImpatience = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_TIME_TO_IMPATIENCE, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1015
1016 // 12 create VTypeAttributeRow and Label for accel lat
1017 myLCAAccelLat = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_ACCEL_LAT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1018
1019 // 13 create VTypeAttributeRow and Label for look ahead lefth
1020 myLCALookAheadLeft = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_LOOKAHEADLEFT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1021
1022 // 14 create VTypeAttributeRow and Label for speed gain right
1023 myLCASpeedGainRight = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_SPEEDGAINRIGHT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1024
1025 // 15 create VTypeAttributeRow and Label for max speed lat standing
1026 myLCAMaxSpeedLatStanding = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_MAXSPEEDLATSTANDING, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1027
1028 // 16 create VTypeAttributeRow and Label for max speed lat factor
1029 myLCAMaxSpeedLatFactor = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_MAXSPEEDLATFACTOR, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1030
1031 // 17 create VTypeAttributeRow and Label for turn alignment distance
1032 myLCATurnAlignmentDistance = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_TURN_ALIGNMENT_DISTANCE, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1033
1034 // 18 create VTypeAttributeRow and Label for overtake right
1035 myLCAOvertakeRight = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_OVERTAKE_RIGHT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1036
1037 // 19 create VTypeAttributeRow and Label for keep right acceptance time
1038 myLCAKeepRightAcceptanceTime = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_KEEPRIGHT_ACCEPTANCE_TIME, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1039
1040 // 20 create VTypeAttributeRow and Label for overtake deltaspeed factor
1041 myLCAOvertakeDeltaSpeedFactor = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_OVERTAKE_DELTASPEED_FACTOR, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1042
1043 // 21 create VTypeAttributeRow and Label for experimental
1044 /* myLCAExperimental = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_EXPERIMENTAL1, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING); */
1045}
1046
1047
1048void
1050 //set values of myEditedDemandElement into fields
1051 myTextFieldVehicleTypeID->setText(myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_ID).c_str());
1052 // set variables of special rows VClass and VShape
1053 SUMOVTypeParameter::VClassDefaultValues defaultVTypeParameters(myVClassRow->updateValue());
1054 myVShapeRow->updateValues();
1055 // update rows
1056 myLaneChangeModel->updateValue();
1057 myLatAlignment->updateValue(toString(defaultVTypeParameters.latAlignmentProcedure));
1058 myColor->updateValue();
1059 myLength->updateValue(toString(defaultVTypeParameters.length));
1060 myMinGap->updateValue(toString(defaultVTypeParameters.minGap));
1061 myMaxSpeed->updateValue(toString(defaultVTypeParameters.maxSpeed));
1062 myDesiredMaxSpeed->updateValue(toString(defaultVTypeParameters.desiredMaxSpeed));
1063 mySpeedFactor->updateValue(toString(defaultVTypeParameters.speedFactor.getParameter()[0]));
1064 myEmissionClass->updateValue(toString(defaultVTypeParameters.emissionClass));
1065 myWidth->updateValue(toString(defaultVTypeParameters.width));
1066 myHeight->updateValue(toString(defaultVTypeParameters.height));
1067 myFilename->updateValue();
1068 myOSGFile->updateValue(toString(defaultVTypeParameters.osgFile));
1069 myPersonCapacity->updateValue(toString(defaultVTypeParameters.personCapacity));
1070 myContainerCapacity->updateValue(toString(defaultVTypeParameters.containerCapacity));
1071 myCarriageLength->updateValue(toString(defaultVTypeParameters.carriageLength));
1072 myLocomotiveLength->updateValue(toString(defaultVTypeParameters.locomotiveLength));
1073 myBoardingDuration->updateValue();
1074 myLoadingDuration->updateValue();
1075 myMinGapLat->updateValue();
1076 myMaxSpeedLat->updateValue();
1077 myActionStepLength->updateValue();
1078 myProbability->updateValue();
1079 myCarriageGap->updateValue();
1080 // JM Parameters
1081 myJMCrossingGap->updateValue();
1082 myJMIgnoreKeepclearTime->updateValue();
1083 myJMDriveAfterYellowTime->updateValue();
1084 myJMDriveAfterRedTime->updateValue();
1085 myJMDriveRedSpeed->updateValue();
1086 myJMIgnoreFoeProb->updateValue();
1087 myJMIgnoreFoeSpeed->updateValue();
1088 myJMSigmaMinor->updateValue();
1089 myJMTimeGapMinor->updateValue();
1090 myJMImpatience->updateValue();
1091 // LCM Attributes
1092 myLCAStrategicParam->updateValue();
1093 myLCACooperativeParam->updateValue();
1094 myLCASpeedgainParam->updateValue();
1095 myLCAKeeprightParam->updateValue();
1096 myLCASublaneParam->updateValue();
1097 myLCAOppositeParam->updateValue();
1098 myLCAPushy->updateValue();
1099 myLCAPushygap->updateValue();
1100 myLCAAssertive->updateValue();
1101 myLCAImpatience->updateValue();
1102 myLCATimeToImpatience->updateValue();
1103 myLCAAccelLat->updateValue();
1104 myLCALookAheadLeft->updateValue();
1105 myLCASpeedGainRight->updateValue();
1106 myLCAMaxSpeedLatStanding->updateValue();
1107 myLCAMaxSpeedLatFactor->updateValue();
1108 myLCATurnAlignmentDistance->updateValue();
1109 myLCAOvertakeRight->updateValue();
1110 myLCAKeepRightAcceptanceTime->updateValue();
1111 myLCAOvertakeDeltaSpeedFactor->updateValue();
1112 /* myLCAExperimental->updateValue(); */
1113 // parameters
1114 myParameters->updateValue();
1115}
1116
1117
1118long
1120 // At start we assumed, that all values are valid
1121 myVehicleTypeDialog->myVehicleTypeValid = true;
1122 myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_NOTHING;
1123 // set color of myTextFieldVehicleTypeID, depending if current value is valid or not
1124 if (myVehicleTypeDialog->myEditedDemandElement->isValid(SUMO_ATTR_ID, myTextFieldVehicleTypeID->getText().text())) {
1125 myTextFieldVehicleTypeID->setTextColor(FXRGB(0, 0, 0));
1126 myVehicleTypeDialog->myEditedDemandElement->setAttribute(SUMO_ATTR_ID, myTextFieldVehicleTypeID->getText().text(), myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
1127 } else if (myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_ID) == myTextFieldVehicleTypeID->getText().text()) {
1128 myTextFieldVehicleTypeID->setTextColor(FXRGB(0, 0, 0));
1129 myVehicleTypeDialog->myEditedDemandElement->setAttribute(SUMO_ATTR_ID, myTextFieldVehicleTypeID->getText().text(), myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
1130 } else {
1131 myTextFieldVehicleTypeID->setTextColor(FXRGB(255, 0, 0));
1132 myVehicleTypeDialog->myVehicleTypeValid = false;
1133 myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_ID;
1134 }
1135 // set variables of special rows VClass and VShape
1136 SUMOVTypeParameter::VClassDefaultValues defaultVTypeParameters(myVClassRow->setVariable());
1137 // set variables of special rows VShape
1138 myVShapeRow->setVariable();
1139 // set attributes in rest rows
1140 myColor->setVariable();
1141 myLength->setVariable(toString(defaultVTypeParameters.length));
1142 myMinGap->setVariable(toString(defaultVTypeParameters.minGap));
1143 myMaxSpeed->setVariable(toString(defaultVTypeParameters.maxSpeed));
1144 myDesiredMaxSpeed->setVariable(toString(defaultVTypeParameters.desiredMaxSpeed));
1145 mySpeedFactor->setVariable(toString(defaultVTypeParameters.speedFactor.getParameter()[0]));
1146 myEmissionClass->setVariable(toString(defaultVTypeParameters.emissionClass));
1147 myWidth->setVariable(toString(defaultVTypeParameters.width));
1148 myHeight->setVariable(toString(defaultVTypeParameters.height));
1149 myOSGFile->setVariable(toString(defaultVTypeParameters.osgFile));
1150 // set attributes in rows
1151 myLaneChangeModel->setVariable();
1152 myLatAlignment->setVariable(toString(defaultVTypeParameters.latAlignmentProcedure));
1153 myLength->setVariable(toString(defaultVTypeParameters.length));
1154 myMinGap->setVariable(toString(defaultVTypeParameters.minGap));
1155 myMaxSpeed->setVariable(toString(defaultVTypeParameters.maxSpeed));
1156 mySpeedFactor->setVariable(toString(defaultVTypeParameters.speedFactor.getParameter()[0]));
1157 myEmissionClass->setVariable(toString(defaultVTypeParameters.emissionClass));
1158 myWidth->setVariable(toString(defaultVTypeParameters.width));
1159 myHeight->setVariable(toString(defaultVTypeParameters.height));
1160 myFilename->setVariable();
1161 myOSGFile->setVariable(toString(defaultVTypeParameters.osgFile));
1162 myPersonCapacity->setVariable(toString(defaultVTypeParameters.personCapacity));
1163 myContainerCapacity->setVariable(toString(defaultVTypeParameters.containerCapacity));
1164 myCarriageLength->setVariable(toString(defaultVTypeParameters.carriageLength));
1165 myLocomotiveLength->setVariable(toString(defaultVTypeParameters.locomotiveLength));
1166 myBoardingDuration->setVariable();
1167 myLoadingDuration->setVariable();
1168 myMinGapLat->setVariable();
1169 myMaxSpeedLat->setVariable();
1170 myActionStepLength->setVariable();
1171 myProbability->setVariable();
1172 myCarriageGap->setVariable();
1173 // JM Variables
1174 myJMCrossingGap->setVariable();
1175 myJMIgnoreKeepclearTime->setVariable();
1176 myJMDriveAfterYellowTime->setVariable();
1177 myJMDriveAfterRedTime->setVariable();
1178 myJMDriveRedSpeed->setVariable();
1179 myJMIgnoreFoeProb->setVariable();
1180 myJMIgnoreFoeSpeed->setVariable();
1181 myJMSigmaMinor->setVariable();
1182 myJMTimeGapMinor->setVariable();
1183 myJMImpatience->setVariable();
1184 // LCM Attributes
1185 myLCAStrategicParam->setVariable();
1186 myLCACooperativeParam->setVariable();
1187 myLCASpeedgainParam->setVariable();
1188 myLCAKeeprightParam->setVariable();
1189 myLCASublaneParam->setVariable();
1190 myLCAOppositeParam->setVariable();
1191 myLCAPushy->setVariable();
1192 myLCAPushygap->setVariable();
1193 myLCAAssertive->setVariable();
1194 myLCAImpatience->setVariable();
1195 myLCATimeToImpatience->setVariable();
1196 myLCAAccelLat->setVariable();
1197 myLCALookAheadLeft->setVariable();
1198 myLCASpeedGainRight->setVariable();
1199 myLCAMaxSpeedLatStanding->setVariable();
1200 myLCAMaxSpeedLatFactor->setVariable();
1201 myLCATurnAlignmentDistance->setVariable();
1202 myLCAOvertakeRight->setVariable();
1203 myLCAKeepRightAcceptanceTime->setVariable();
1204 myLCAOvertakeDeltaSpeedFactor->setVariable();
1205 /* myLCAExperimental->setVariable(); */
1206 myParameters->setVariable();
1207 return true;
1208}
1209
1210
1211long
1213 // check what dialog has to be opened
1214 if (obj == myColor->getButton()) {
1215 myColor->openColorDialog();
1216 } else if (obj == myFilename->getButton()) {
1217 myFilename->openImageFileDialog();
1218 } else if (obj == myOSGFile->getButton()) {
1219 myFilename->openOSGFileDialog();
1220 }
1221 return 1;
1222}
1223
1224
1225long
1227 // write debug information
1228 WRITE_DEBUG("Open parameters dialog");
1229 // edit parameters using dialog
1230 if (GNESingleParametersDialog(myParameters, myVehicleTypeDialog->getEditedDemandElement()->getNet()->getViewNet()).execute()) {
1231 // write debug information
1232 WRITE_DEBUG("Close parameters dialog");
1233 // set values edited in Parameter dialog in Edited AC
1234 myVehicleTypeDialog->getEditedDemandElement()->setAttribute(GNE_ATTR_PARAMETERS, myParameters->getParametersStr(), myVehicleTypeDialog->getEditedDemandElement()->getNet()->getViewNet()->getUndoList());
1235 } else {
1236 // write debug information
1237 WRITE_DEBUG("Cancel parameters dialog");
1238 }
1239 return 1;
1240}
1241
1242// ---------------------------------------------------------------------------
1243// GNEVehicleTypeDialog::VShapeRow - methods
1244// ---------------------------------------------------------------------------
1245
1247 FXGroupBox(column, "Car Following Model attributes", GUIDesignGroupBoxFrame),
1248 myVehicleTypeDialog(vehicleTypeDialog) {
1249
1250 // create vertical frame for rows
1251 myVerticalFrameRows = new FXVerticalFrame(this, GUIDesignAuxiliarFrame);
1252
1253 // declare combo box
1254 FXHorizontalFrame* row = new FXHorizontalFrame(myVerticalFrameRows, GUIDesignAuxiliarHorizontalFrame);
1255 new FXLabel(row, "Algorithm", nullptr, GUIDesignLabelAttribute150);
1257
1258 // fill combo Box with all Car following models
1259 std::vector<std::string> CFModels = SUMOXMLDefinitions::CarFollowModels.getStrings();
1260 for (const auto& CFModel : CFModels) {
1261 myComboBoxCarFollowModel->appendIconItem(CFModel.c_str(), nullptr);
1262 }
1264
1265 // 01 create FX and Label for Accel
1267 myRows.push_back(myAccelRow);
1268
1269 // 02 create FX and Label for Decel
1271 myRows.push_back(myDecelRow);
1272
1273 // 03 create FX and Label for Apparent decel
1275 myRows.push_back(myApparentDecelRow);
1276
1277 // 04 create FX and Label for emergency decel
1279 myRows.push_back(myEmergencyDecelRow);
1280
1281 // 05 create FX and Label for Sigma
1283 myRows.push_back(mySigmaRow);
1284
1285 // 06 create FX and Label for Tau
1287 myRows.push_back(myTauRow);
1288
1289 // 07 myMinGapFactor FX and Label for MinGapFactor
1291 myRows.push_back(myMinGapFactorRow);
1292
1293 // 08 create FX and Label for K
1295 myRows.push_back(myKRow);
1296
1297 // 09 create FX and Label for PHI
1299 myRows.push_back(myPhiRow);
1300
1301 // 10 create FX and Label for Deleta
1303 myRows.push_back(myDeltaRow);
1304
1305 // 11 create FX and Label for Stepping
1307 myRows.push_back(mySteppingRow);
1308
1309 // 12 create FX and Label for Security
1311 myRows.push_back(mySecurityRow);
1312
1313 // 13 create FX and Label for Estimation
1315 myRows.push_back(myEstimationRow);
1316
1317 // 14 create FX and Label for TMP1
1319 myRows.push_back(myTmp1Row);
1320
1321 // 15 create FX and Label for TMP2
1323 myRows.push_back(myTmp2Row);
1324
1325 // 16 create FX and Label for TMP3
1327 myRows.push_back(myTmp3Row);
1328
1329 // 17 create FX and Label for TMP4
1331 myRows.push_back(myTmp4Row);
1332
1333 // 18 create FX and Label for TMP5
1335 myRows.push_back(myTmp5Row);
1336
1337 // 19 create FX and Label for trainType (allow strings)
1339 myRows.push_back(myTrainTypeRow);
1340
1341 // 20 create FX and Label for Tau Last
1343 myRows.push_back(myTrauLastRow);
1344
1345 // 21 create FX and Label for Aprob
1347 myRows.push_back(myAprobRow);
1348
1349 // 22 create FX and Label for Adapt Factor
1351 myRows.push_back(myAdaptFactorRow);
1352
1353 // 23 create FX and Label for Adapt Time
1355 myRows.push_back(myAdaptTimeRow);
1356
1357 // X1 create FX and Label for Look ahead/preview Time
1359 myRows.push_back(myTpreviewRow);
1360
1361 // X2 create FX and Label for Reaction Time
1363 myRows.push_back(myTreactionRow);
1364
1365 // X3 create FX and Label for Wiener Process Driving Error
1367 myRows.push_back(myTPersDriveRow);
1368
1369 // X4 create FX and Label for Wiener Process Estimation Error
1371 myRows.push_back(myTPersEstimateRow);
1372
1373 // X5 create FX and Label for Coolness parameter
1375 myRows.push_back(myCcoolnessRow);
1376
1377 // X6 create FX and Label for leader speed estimation error
1379 myRows.push_back(mySigmaleaderRow);
1380
1381 // X7 create FX and Label for Gap estimation error
1383 myRows.push_back(mySigmagapRow);
1384
1385 // X8 create FX and Label for Driving Error
1387 myRows.push_back(mySigmaerrorRow);
1388
1389 // X9 create FX and Label for max jerk
1391 myRows.push_back(myJerkmaxRow);
1392
1393 // X10 create FX and Label for AP Driver Update threshold
1395 myRows.push_back(myEpsilonaccRow);
1396
1397 // X11 create FX and Label for Startup Time to acc_max
1399 myRows.push_back(myTaccmaxRow);
1400
1401 // X12 create FX and Label for Startup M flatness
1403 myRows.push_back(myMflatnessRow);
1404
1405 // X13 create FX and Label for Startup M begin
1407 myRows.push_back(myMbeginRow);
1408
1409 // X14 create FX and Label for using vehicle dynamics
1411 myRows.push_back(myUseVehDynamicsRow);
1412
1413 // X14 create FX and Label for using vehicle dynamics
1415 myRows.push_back(myMaxVehPreviewRow);
1416
1417 // create myLabelIncompleteAttribute
1418 myLabelIncompleteAttribute = new FXLabel(myVerticalFrameRows, "Some attributes wasn't\nimplemented yet", nullptr, GUIDesignLabelAboutInfoCenter);
1420
1421 // show or hide ComboBox depending of current selected CFM
1423}
1424
1425
1426void
1428 // start hidding all rows
1429 for (const auto& row : myRows) {
1430 row->hide();
1431 }
1432 // hide myLabelIncompleteAttribute
1433 myLabelIncompleteAttribute->hide();
1434 // show textfield depending of current CFM
1435 if (SUMOXMLDefinitions::CarFollowModels.hasString(myComboBoxCarFollowModel->getText().text())) {
1436 // show textfield depending of selected CFM
1437 switch (SUMOXMLDefinitions::CarFollowModels.get(myComboBoxCarFollowModel->getText().text())) {
1438 case SUMO_TAG_CF_KRAUSS:
1441 myTauRow->show();
1442 myAccelRow->show();
1443 myDecelRow->show();
1444 myApparentDecelRow->show();
1445 myEmergencyDecelRow->show();
1446 mySigmaRow->show();
1447 break;
1449 myTauRow->show();
1450 myTmp1Row->show();
1451 myTmp2Row->show();
1452 myTmp3Row->show();
1453 myTmp4Row->show();
1454 myTmp5Row->show();
1455 break;
1458 myTauRow->show();
1459 myAccelRow->show();
1460 myDecelRow->show();
1461 myEmergencyDecelRow->show();
1462 mySigmaRow->show();
1463 myMinGapFactorRow->show();
1464 myTmp1Row->show();
1465 myTmp2Row->show();
1466 myTmp3Row->show();
1467 myTmp4Row->show();
1468 myTmp5Row->show();
1469 break;
1471 myTauRow->show();
1472 myAccelRow->show();
1473 myDecelRow->show();
1474 myEmergencyDecelRow->show();
1475 mySigmaRow->show();
1476 myMinGapFactorRow->show();
1477 myTrauLastRow->show();
1478 myAprobRow->show();
1479 break;
1480 case SUMO_TAG_CF_IDM:
1481 myTauRow->show();
1482 myAccelRow->show();
1483 myDecelRow->show();
1484 myEmergencyDecelRow->show();
1485 myDeltaRow->show();
1486 mySteppingRow->show();
1487 myMinGapFactorRow->show();
1488 break;
1489 case SUMO_TAG_CF_IDMM:
1490 myTauRow->show();
1491 myAccelRow->show();
1492 myDecelRow->show();
1493 myEmergencyDecelRow->show();
1494 myDeltaRow->show();
1495 mySteppingRow->show();
1496 myMinGapFactorRow->show();
1497 myAdaptFactorRow->show();
1498 myAdaptTimeRow->show();
1499 break;
1500 case SUMO_TAG_CF_EIDM:
1501 myTauRow->show();
1502 myAccelRow->show();
1503 myDecelRow->show();
1504 myEmergencyDecelRow->show();
1505 myDeltaRow->show();
1506 mySteppingRow->show();
1507 myMinGapFactorRow->show();
1508 myTpreviewRow->show();
1509 myTreactionRow->show();
1510 myTPersDriveRow->show();
1511 myTPersEstimateRow->show();
1512 myCcoolnessRow->show();
1513 mySigmaleaderRow->show();
1514 mySigmagapRow->show();
1515 mySigmaerrorRow->show();
1516 myJerkmaxRow->show();
1517 myEpsilonaccRow->show();
1518 myTaccmaxRow->show();
1519 myMflatnessRow->show();
1520 myMbeginRow->show();
1521 myUseVehDynamicsRow->show();
1522 myMaxVehPreviewRow->show();
1523 break;
1525 myTauRow->show();
1526 myAccelRow->show();
1527 myDecelRow->show();
1528 myEmergencyDecelRow->show();
1529 myKRow->show();
1530 myPhiRow->show();
1531 myMinGapFactorRow->show();
1532 break;
1534 myTauRow->show();
1535 myAccelRow->show();
1536 myDecelRow->show();
1537 myEmergencyDecelRow->show();
1538 myMinGapFactorRow->show();
1539 mySecurityRow->show();
1540 myEstimationRow->show();
1541 break;
1542 case SUMO_TAG_CF_RAIL:
1543 myTauRow->show();
1544 myTrainTypeRow->show();
1545 break;
1546 case SUMO_TAG_CF_ACC:
1547 myTauRow->show();
1548 myAccelRow->show();
1549 myDecelRow->show();
1550 myEmergencyDecelRow->show();
1551 myMinGapFactorRow->show();
1552 // show myLabelIncompleteAttribute
1553 myLabelIncompleteAttribute->show();
1564 break;
1565 case SUMO_TAG_CF_CACC:
1566 myTauRow->show();
1567 myAccelRow->show();
1568 myDecelRow->show();
1569 myEmergencyDecelRow->show();
1570 myMinGapFactorRow->show();
1571 // show myLabelIncompleteAttribute
1572 myLabelIncompleteAttribute->show();
1589 break;
1590 case SUMO_TAG_CF_CC:
1591 myTauRow->show();
1592 myAccelRow->show();
1593 myDecelRow->show();
1594 // show myLabelIncompleteAttribute
1595 myLabelIncompleteAttribute->show();
1617 break;
1618 default:
1619 break;
1620 }
1621 }
1622 myVerticalFrameRows->recalc();
1623 update();
1624}
1625
1626
1627void
1629 //set values of myEditedDemandElement into fields
1630 if (myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_CAR_FOLLOW_MODEL).empty()) {
1631 myComboBoxCarFollowModel->setCurrentItem(0);
1632 } else {
1633 myComboBoxCarFollowModel->setText(myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_CAR_FOLLOW_MODEL).c_str());
1634 }
1635 // refresh fields
1636 refreshCFMFields();
1637 // update value in all Rows
1638 for (const auto& row : myRows) {
1639 row->updateValue();
1640 }
1641}
1642
1643
1644long
1646 // At start we assumed, that all values are valid
1647 myVehicleTypeDialog->myVehicleTypeValid = true;
1648 myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_NOTHING;
1649 // set color of myTextFieldCarFollowModel, depending if current value is valid or not
1650 if (myVehicleTypeDialog->myEditedDemandElement->isValid(SUMO_ATTR_CAR_FOLLOW_MODEL, myComboBoxCarFollowModel->getText().text())) {
1651 myComboBoxCarFollowModel->setTextColor(FXRGB(0, 0, 0));
1652 myVehicleTypeDialog->myEditedDemandElement->setAttribute(SUMO_ATTR_CAR_FOLLOW_MODEL, myComboBoxCarFollowModel->getText().text(), myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
1653 } else {
1654 myComboBoxCarFollowModel->setTextColor(FXRGB(255, 0, 0));
1655 myVehicleTypeDialog->myVehicleTypeValid = false;
1656 myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_CAR_FOLLOW_MODEL;
1657 }
1658 // set variable in all Rows
1659 for (const auto& row : myRows) {
1660 row->setVariable();
1661 }
1662 // refresh fields
1663 refreshCFMFields();
1664 return true;
1665}
1666
1667// ---------------------------------------------------------------------------
1668// GNEVehicleTypeDialog - public methods
1669// ---------------------------------------------------------------------------
1670
1671GNEVehicleTypeDialog::GNEVehicleTypeDialog(GNEDemandElement* editedVehicleType, bool updatingElement) :
1672 GNEDemandElementDialog(editedVehicleType, updatingElement, 1372, 575),
1673 myVehicleTypeValid(true),
1675
1676 // change default header
1678
1679 // Create auxiliar frames for values
1680 FXHorizontalFrame* columns = new FXHorizontalFrame(myContentFrame, GUIDesignAuxiliarHorizontalFrame);
1681
1682 // create vehicle type attributes
1683 myVTypeAtributes = new VTypeAtributes(this, columns);
1684
1685 // create car following model parameters
1687
1688 // start a undo list for editing local to this additional
1689 initChanges();
1690
1691 // add element if we aren't updating an existent element
1692 if (myUpdatingElement == false) {
1694 }
1695
1696 // update values of Vehicle Type common attributes
1698
1699 // update values of Car Following Model Parameters
1701
1702 // open as modal dialog
1704}
1705
1706
1708
1709
1710long
1711GNEVehicleTypeDialog::onCmdAccept(FXObject*, FXSelector, void*) {
1712 if (myVehicleTypeValid == false) {
1713 // write warning if netedit is running in testing mode
1714 WRITE_DEBUG("Opening FXMessageBox of type 'warning'");
1715 std::string operation1 = myUpdatingElement ? ("updating") : ("creating");
1716 std::string operation2 = myUpdatingElement ? ("updated") : ("created");
1717 std::string tagString = myEditedDemandElement->getTagStr();
1718 // open warning dialogBox
1719 FXMessageBox::warning(getApp(), MBOX_OK,
1720 ("Error " + operation1 + " " + tagString).c_str(), "%s",
1721 (tagString + " cannot be " + operation2 +
1722 " because parameter " + toString(myInvalidAttr) +
1723 " is invalid.").c_str());
1724 // write warning if netedit is running in testing mode
1725 WRITE_DEBUG("Closed FXMessageBox of type 'warning' with 'OK'");
1726 return 0;
1727 } else {
1728 // accept changes before closing dialog
1729 acceptChanges();
1730 // stop dialog successfully
1731 getApp()->stopModal(this, TRUE);
1732 return 1;
1733 }
1734}
1735
1736
1737long
1738GNEVehicleTypeDialog::onCmdCancel(FXObject*, FXSelector, void*) {
1739 // cancel changes
1740 cancelChanges();
1741 // Stop Modal
1742 getApp()->stopModal(this, FALSE);
1743 return 1;
1744}
1745
1746
1747long
1748GNEVehicleTypeDialog::onCmdReset(FXObject*, FXSelector, void*) {
1749 // reset changes
1750 resetChanges();
1751 // update values of Vehicle Type common attributes
1753 // update values of Car Following Model Parameters
1755 return 1;
1756}
1757
1758// ---------------------------------------------------------------------------
1759// GNEVehicleTypeDialog - private methods
1760// ---------------------------------------------------------------------------
1761
1763 FXHorizontalFrame(verticalFrame, GUIDesignAuxiliarHorizontalFrame),
1764 myCarFollowingModelParametersParent(carFollowingModelParametersParent),
1765 myAttr(attr),
1766 myTextField(nullptr) {
1767 new FXLabel(this, toString(attr).c_str(), nullptr, GUIDesignLabelAttribute150);
1768 myTextField = new FXTextField(this, GUIDesignTextFieldNCol, carFollowingModelParametersParent, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFielWidth180);
1769}
1770
1771
1772void
1774 // set color of textField, depending if current value is valid or not
1775 if (myCarFollowingModelParametersParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, myTextField->getText().text())) {
1776 // set color depending if is a default value
1777 if (myCarFollowingModelParametersParent->myVehicleTypeDialog->myEditedDemandElement->getTagProperty().getDefaultValue(myAttr) != myTextField->getText().text()) {
1778 myTextField->setTextColor(FXRGB(0, 0, 0));
1779 } else {
1780 myTextField->setTextColor(FXRGB(195, 195, 195));
1781 }
1782 myCarFollowingModelParametersParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, myTextField->getText().text(),
1783 myCarFollowingModelParametersParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
1784 // update value after setting it
1785 updateValue();
1786 } else {
1787 myTextField->setTextColor(FXRGB(255, 0, 0));
1788 // mark VType as invalid
1789 myCarFollowingModelParametersParent->myVehicleTypeDialog->myVehicleTypeValid = false;
1790 myCarFollowingModelParametersParent->myVehicleTypeDialog->myInvalidAttr = myAttr;
1791 }
1792}
1793
1794
1795void
1797 // set text of myTextField using current value of VType
1798 myTextField->setText(myCarFollowingModelParametersParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr).c_str());
1799 // set color depending if is a default value
1800 if (myCarFollowingModelParametersParent->myVehicleTypeDialog->myEditedDemandElement->getTagProperty().getDefaultValue(myAttr) != myTextField->getText().text()) {
1801 myTextField->setTextColor(FXRGB(0, 0, 0));
1802 } else {
1803 myTextField->setTextColor(FXRGB(195, 195, 195));
1804 }
1805}
1806
1807
1808/****************************************************************************/
FXDEFMAP(GNEVehicleTypeDialog::VTypeAtributes) VTypeAtributesMap[]
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition: GUIAppEnum.h:870
@ MID_GNE_OPEN_PARAMETERS_DIALOG
open parameters dialog
Definition: GUIAppEnum.h:908
@ MID_GNE_SET_ATTRIBUTE_DIALOG
attribute edited trough dialog
Definition: GUIAppEnum.h:904
#define GUIDesignComboBox
Definition: GUIDesigns.h:306
#define GUIDesignComboBoxWidth180
comboBox with thick frame, width 180
Definition: GUIDesigns.h:318
#define GUIDesignComboBoxNCol
number of column of every combo box
Definition: GUIDesigns.h:321
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition: GUIDesigns.h:397
#define GUIDesignTextFielWidth180
text field with thick frame, width of 180 (Used in type frame)
Definition: GUIDesigns.h:63
#define GUIDesignLabelTickedIcon180x46
label ticked filled extended over frame used for VClasses/VShapes. (can be used by icons of 64x32 pix...
Definition: GUIDesigns.h:268
#define GUIDesignLabelAboutInfoCenter
label extended over frame with thick and with text justify to center
Definition: GUIDesigns.h:253
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition: GUIDesigns.h:69
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
Definition: GUIDesigns.h:350
#define GUIDesignAuxiliarVerticalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition: GUIDesigns.h:403
#define GUIDesignButtonRectangular150
button rectangular with thick and raise frame with a width of 150
Definition: GUIDesigns.h:95
#define GUIDesignLabelAttribute150
label extended over the matrix column with thick frame
Definition: GUIDesigns.h:244
#define GUIDesignAuxiliarFrame
design for auxiliar (Without borders) frames used to pack another frames extended in all directions
Definition: GUIDesigns.h:394
FXString gCurrentFolder
The folder used as last.
@ VCLASS_TRAILER
@ VCLASS_PASSENGER
@ VSHAPE_PEDESTRIAN
@ VSHAPE_PASSENGER
@ VCLASS_BICYCLE
@ VCLASS_RAIL_FAST
@ 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:276
#define TL(string)
Definition: MsgHandler.h:282
StringBijection< SUMOVehicleShape > SumoVehicleShapeStrings(sumoVehicleShapeStringInitializer, SUMOVehicleShape::UNKNOWN, false)
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)
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_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
render as a delivery vehicle
@ BICYCLE
render as a bicycle
@ MOTORCYCLE
render as a motorcycle
@ UNKNOWN
not defined
@ BUS_TROLLEY
render as a trolley bus
@ TAXI
automated car (with cruise controllers)
@ 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_DESIRED_MAXSPEED
@ 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_LCA_OVERTAKE_DELTASPEED_FACTOR
@ 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_LCA_KEEPRIGHT_ACCEPTANCE_TIME
@ 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.
static FXIcon * getVClassIcon(const SUMOVehicleClass vc)
returns icon associated to the given vClass
virtual bool isAttributeEnabled(SumoXMLAttr key) const
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 additional
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 belong to GNENet but has influence in the simulation.
virtual SUMOVehicleClass getVClass() 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:1987
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 apparent Decel.
CarFollowingModelRow * myDecelRow
Row for Decel.
std::vector< CarFollowingModelRow * > myRows
vector with the Car Following Model Row
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.
MFXIconComboBox * myComboBoxCarFollowModel
Row for CarFollowModel.
CarFollowingModelRow * myMinGapFactorRow
Row for MinGapFactor.
VTypeAtributes * myVTypeAtributesParent
pointer to VTypeAtributes parent
MFXIconComboBox * myComboBoxVClass
FXComboBox for VClass.
SUMOVehicleClass setVariable()
set vehicle class
VShapeRow(VTypeAtributes *VTypeAtributesParent, FXVerticalFrame *column)
constructor
FXLabel * myComboBoxShapeLabelImage
label with image of Shape
MFXIconComboBox * myComboBoxShape
FXComboBox for Shape.
void updateValue(SUMOVehicleClass vClass)
update value
class used for represent rows with Vehicle Type parameters
MFXIconComboBox * myComboBox
ComboBox for attributes with limited values.
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
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 Variable 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.
VTypeAttributeRow * myDesiredMaxSpeed
VTypeAttributeRow for desired max speed.
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)
VShapeRow * myVShapeRow
vehicle shape row
Dialog for editing calibrator vehicle types.
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
ComboBox with icon.
FXString getText() const
Get the text.
void setTextColor(FXColor clr)
Change text color.
FXint getNumItems() const
Return the number of items in the list.
void setNumVisible(FXint nvis)
Set the number of visible items in the drop down list.
FXint appendIconItem(const FXString &text, FXIcon *icon=nullptr, FXColor bgColor=FXRGB(255, 255, 255), void *ptr=nullptr)
append icon
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
auto get(const nlohmann::detail::iteration_proxy_value< IteratorType > &i) -> decltype(i.key())
Definition: json.hpp:4451
struct for default values that depend of VClass
int personCapacity
The person capacity of the vehicle.
double carriageLength
the length of train carriages
double desiredMaxSpeed
The vehicle type's desired maximum speed [m/s].
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] (technical limit, not subject to speed deviation)
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.
SUMOVehicleShape shape
This class' shape.
LatAlignmentDefinition latAlignmentProcedure
the lateral alignment procedure
double locomotiveLength
the length of train locomotive