Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEVehicleTypeDialog.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2025 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
26#include <netedit/GNENet.h>
28#include <netedit/GNEUndoList.h>
34
36
37// ===========================================================================
38// FOX callback mapping
39// ===========================================================================
40
46
50
51// Object implementation
52FXIMPLEMENT(GNEVehicleTypeDialog::VTypeAttributes, FXVerticalFrame, VTypeAttributesMap, ARRAYNUMBER(VTypeAttributesMap))
53FXIMPLEMENT(GNEVehicleTypeDialog::CarFollowingModelParameters, FXGroupBox, CarFollowingModelParametersMap, ARRAYNUMBER(CarFollowingModelParametersMap))
54
55// ===========================================================================
56// member method definitions
57// ===========================================================================
58
59// ---------------------------------------------------------------------------
60// GNEVehicleTypeDialog::VClassRow - methods
61// ---------------------------------------------------------------------------
62
63GNEVehicleTypeDialog::VTypeAttributes::VClassRow::VClassRow(VTypeAttributes* VTypeAttributesParent, FXVerticalFrame* column) :
64 FXHorizontalFrame(column, GUIDesignAuxiliarHorizontalFrame),
65 myVTypeAttributesParent(VTypeAttributesParent) {
66 // create two auxiliary frames
67 FXVerticalFrame* verticalFrameLabelAndComboBox = new FXVerticalFrame(this, GUIDesignAuxiliarVerticalFrame);
68 // create MFXComboBoxIcon for VClass
69 new FXLabel(verticalFrameLabelAndComboBox, toString(SUMO_ATTR_VCLASS).c_str(), nullptr, GUIDesignLabelThickedFixed(150));
70 myComboBoxVClass = new MFXComboBoxIcon(verticalFrameLabelAndComboBox, myVTypeAttributesParent->myVehicleTypeDialog->getApplicationWindow()->getStaticTooltipMenu(),
72 myComboBoxVClassLabelImage = new FXLabel(this, "", nullptr, GUIDesignLabelTickedIcon180x46);
73 myComboBoxVClassLabelImage->setBackColor(FXRGBA(255, 255, 255, 255));
74 // fill combo Box with all allowed VClass for the current edited VType
75 for (const auto& vClass : myVTypeAttributesParent->myVehicleTypeDialog->getElement()->getTagProperty()->getAttributeProperties(SUMO_ATTR_VCLASS)->getDiscreteValues()) {
76 myComboBoxVClass->appendIconItem(vClass.c_str(), VClassIcons::getVClassIcon(SumoVehicleClassStrings.get(vClass)));
77 }
78}
79
80
83 // set color of myComboBoxVClass, depending if current value is valid or not
87 // check if VType has to be updated
89 // update VClass in VType
92 // update label image
94 // obtain default vType parameters
96 // check if mutable rows need to be updated
99 }
102 }
105 }
108 }
111 }
114 }
116 myVTypeAttributesParent->myWidth->updateValue(toString(defaultVTypeParameters.width));
117 }
120 }
123 }
126 }
129 }
130 /*
131 Waiting for #16343
132 if (!myVTypeAttributesParent->myVehicleTypeDialog->myElement->isAttributeEnabled(SUMO_ATTR_CARRIAGE_LENGTH)) {
133 myVTypeAttributesParent->myCarriageLength->updateValue(toString(defaultVTypeParameters.containerCapacity));
134 }
135 if (!myVTypeAttributesParent->myVehicleTypeDialog->myElement->isAttributeEnabled(SUMO_ATTR_LOCOMOTIVE_LENGTH)) {
136 myVTypeAttributesParent->myLocomotiveLength->updateValue(toString(defaultVTypeParameters.locomotiveLength));
137 }
138 // update GUIShape
139 if (SumoVehicleClassStrings.hasString(myComboBoxVClass->getText().text())) {
140 myVTypeAttributesParent->myVShapeRow->updateValue(SumoVehicleClassStrings.get(myComboBoxVClass->getText().text()));
141 }
142 */
143 }
144 } else {
148 }
150}
151
152
155 const auto vClass = myVTypeAttributesParent->myVehicleTypeDialog->myElement->getAttribute(SUMO_ATTR_VCLASS);
156 int index = 0;
157 for (int i = 0; i < myComboBoxVClass->getNumItems(); i++) {
158 if (myComboBoxVClass->getItemText(i) == vClass) {
159 index = i;
160 }
161 }
162 myComboBoxVClass->setCurrentItem(index);
163 setVClassLabelImage();
164 return myVTypeAttributesParent->myVehicleTypeDialog->myElement->getVClass();
165}
166
167
168void
170 // by default vClass is passenger
171 if (myVTypeAttributesParent->myVehicleTypeDialog->myElement->getAttribute(SUMO_ATTR_VCLASS).empty()) {
172 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_PASSENGER));
173 } else {
174 // set Icon in label depending of current VClass
175 switch (myVTypeAttributesParent->myVehicleTypeDialog->myElement->getVClass()) {
176 case SVC_PRIVATE:
177 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_PRIVATE));
178 break;
179 case SVC_EMERGENCY:
180 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_EMERGENCY));
181 break;
182 case SVC_AUTHORITY:
183 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_AUTHORITY));
184 break;
185 case SVC_ARMY:
186 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_ARMY));
187 break;
188 case SVC_VIP:
189 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_VIP));
190 break;
191 case SVC_PASSENGER:
192 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_PASSENGER));
193 break;
194 case SVC_HOV:
195 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_HOV));
196 break;
197 case SVC_TAXI:
198 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_TAXI));
199 break;
200 case SVC_BUS:
201 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_BUS));
202 break;
203 case SVC_COACH:
204 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_COACH));
205 break;
206 case SVC_DELIVERY:
207 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_DELIVERY));
208 break;
209 case SVC_TRUCK:
210 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_TRUCK));
211 break;
212 case SVC_TRAILER:
213 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_TRAILER));
214 break;
215 case SVC_TRAM:
216 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_TRAM));
217 break;
218 case SVC_RAIL_URBAN:
219 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_RAIL_URBAN));
220 break;
221 case SVC_RAIL:
222 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_RAIL));
223 break;
225 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_RAIL_ELECTRIC));
226 break;
227 case SVC_RAIL_FAST:
228 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_RAIL_FAST));
229 break;
230 case SVC_MOTORCYCLE:
231 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_MOTORCYCLE));
232 break;
233 case SVC_MOPED:
234 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_MOPED));
235 break;
236 case SVC_BICYCLE:
237 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_BICYCLE));
238 break;
239 case SVC_PEDESTRIAN:
240 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_PEDESTRIAN));
241 break;
242 case SVC_E_VEHICLE:
243 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_EVEHICLE));
244 break;
245 case SVC_SHIP:
246 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_SHIP));
247 break;
248 case SVC_CONTAINER:
249 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_CONTAINER));
250 break;
251 case SVC_CABLE_CAR:
252 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_CABLE_CAR));
253 break;
254 case SVC_SUBWAY:
255 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_SUBWAY));
256 break;
257 case SVC_AIRCRAFT:
258 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_AIRCRAFT));
259 break;
260 case SVC_WHEELCHAIR:
261 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_WHEELCHAIR));
262 break;
263 case SVC_SCOOTER:
264 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_SCOOTER));
265 break;
266 case SVC_DRONE:
267 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_DRONE));
268 break;
269 case SVC_CUSTOM1:
270 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_CUSTOM1));
271 break;
272 case SVC_CUSTOM2:
273 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_CUSTOM2));
274 break;
275 default:
276 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_IGNORING));
277 break;
278 }
279 }
280}
281
282// ---------------------------------------------------------------------------
283// GNEVehicleTypeDialog::VShapeRow - methods
284// ---------------------------------------------------------------------------
285
286GNEVehicleTypeDialog::VTypeAttributes::VShapeRow::VShapeRow(VTypeAttributes* VTypeAttributesParent, FXVerticalFrame* column) :
287 FXHorizontalFrame(column, GUIDesignAuxiliarHorizontalFrame),
288 myVTypeAttributesParent(VTypeAttributesParent) {
289 // create two auxiliar frames
290 FXVerticalFrame* verticalFrameLabelAndComboBox = new FXVerticalFrame(this, GUIDesignAuxiliarVerticalFrame);
291 // create combo for vehicle shapes
292 new FXLabel(verticalFrameLabelAndComboBox, toString(SUMO_ATTR_GUISHAPE).c_str(), nullptr, GUIDesignLabelThickedFixed(150));
295 myComboBoxShapeLabelImage = new FXLabel(this, "", nullptr, GUIDesignLabelTickedIcon180x46);
296 myComboBoxShapeLabelImage->setBackColor(FXRGBA(255, 255, 255, 255));
297 // fill combo Box with all vehicle shapes
298 std::vector<std::string> VShapeStrings = SumoVehicleShapeStrings.getStrings();
299 myComboBoxShape->appendIconItem("default", nullptr);
300 for (const auto& VShapeString : VShapeStrings) {
301 if (VShapeString != SumoVehicleShapeStrings.getString(SUMOVehicleShape::UNKNOWN)) {
302 myComboBoxShape->appendIconItem(VShapeString.c_str(), nullptr);
303 }
304 }
305}
306
307
308void
310 // set color of myComboBoxShape, depending if current value is valid or not
311 if (myVTypeAttributesParent->myVehicleTypeDialog->myElement->isValid(SUMO_ATTR_GUISHAPE, myComboBoxShape->getText().text())) {
312 myComboBoxShape->setTextColor(GUIDesignTextColorBlack);
313 myVTypeAttributesParent->myVehicleTypeDialog->myElement->setAttribute(SUMO_ATTR_GUISHAPE, myComboBoxShape->getText().text(),
314 myVTypeAttributesParent->myVehicleTypeDialog->myElement->getNet()->getViewNet()->getUndoList());
315 setVShapeLabelImage();
316 } else {
317 myComboBoxShape->setTextColor(GUIDesignTextColorRed);
318 myVTypeAttributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
319 myVTypeAttributesParent->myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_GUISHAPE;
320 }
321}
322
323
324void
326 // set value
327 const int index = myComboBoxShape->findItem(myVTypeAttributesParent->myVehicleTypeDialog->myElement->getAttribute(SUMO_ATTR_GUISHAPE).c_str());
328 if (index == -1) {
329 myComboBoxShape->setCurrentItem(0);
330 } else {
331 myComboBoxShape->setCurrentItem(index);
332 }
333 setVShapeLabelImage();
334}
335
336
337void
339 // create new VClassDefaultValues using the new VClass
341 // set value
342 const int index = myComboBoxShape->findItem(SumoVehicleShapeStrings.getString(newVClass.shape).c_str());
343 if (index == -1) {
344 myComboBoxShape->setCurrentItem(0);
345 } else {
346 myComboBoxShape->setCurrentItem(index);
347 }
348 myComboBoxShape->setTextColor(GUIDesignTextColorBlack);
349 myVTypeAttributesParent->myVehicleTypeDialog->myElement->setAttribute(SUMO_ATTR_GUISHAPE, myComboBoxShape->getText().text(),
350 myVTypeAttributesParent->myVehicleTypeDialog->myElement->getNet()->getViewNet()->getUndoList());
351 setVShapeLabelImage();
352}
353
354
355void
357 // set Icon in label depending of current VClass
358 switch (getVehicleShapeID(myVTypeAttributesParent->myVehicleTypeDialog->myElement->getAttribute(SUMO_ATTR_GUISHAPE))) {
360 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_UNKNOWN));
361 break;
363 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PEDESTRIAN));
364 break;
366 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_BICYCLE));
367 break;
369 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_MOPED));
370 break;
372 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_MOTORCYCLE));
373 break;
375 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PASSENGER));
376 break;
378 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PASSENGER_SEDAN));
379 break;
381 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PASSENGER_HATCHBACK));
382 break;
384 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PASSENGER_WAGON));
385 break;
387 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PASSENGER_VAN));
388 break;
390 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_TAXI));
391 break;
393 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_DELIVERY));
394 break;
396 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_TRUCK));
397 break;
399 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_TRUCK_SEMITRAILER));
400 break;
402 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_TRUCK_1TRAILER));
403 break;
405 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_BUS));
406 break;
408 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_BUS_COACH));
409 break;
411 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_BUS_FLEXIBLE));
412 break;
414 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_BUS_TROLLEY));
415 break;
417 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_RAIL));
418 break;
420 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_RAIL_CAR));
421 break;
423 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_RAIL_CARGO));
424 break;
426 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_E_VEHICLE));
427 break;
429 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_ANT));
430 break;
432 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_SHIP));
433 break;
435 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_EMERGENCY));
436 break;
438 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_FIREBRIGADE));
439 break;
441 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_POLICE));
442 break;
444 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_RICKSHAW));
445 break;
447 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_SCOOTER));
448 break;
450 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_AIRCRAFT));
451 break;
452 default:
453 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_IGNORING));
454 break;
455 }
456}
457
458// ---------------------------------------------------------------------------
459// GNEVehicleTypeDialog::VTypeAttributes - methods
460// ---------------------------------------------------------------------------
461
462GNEVehicleTypeDialog::VTypeAttributes::VTypeAttributeRow::VTypeAttributeRow(VTypeAttributes* VTypeAttributesParent, FXVerticalFrame* verticalFrame, const SumoXMLAttr attr, const RowAttrType rowAttrType, const std::vector<std::string>& values) :
463 FXHorizontalFrame(verticalFrame, GUIDesignAuxiliarHorizontalFrame),
464 myVTypeAttributesParent(VTypeAttributesParent),
465 myAttr(attr),
466 myRowAttrType(rowAttrType),
467 myButton(nullptr),
468 myTextField(nullptr),
469 myComboBox(nullptr) {
470 // first check if we have to create a button or a label
471 if ((rowAttrType == ROWTYPE_COLOR) || (rowAttrType == ROWTYPE_FILENAME)) {
472 myButton = GUIDesigns::buildFXButton(this, filterAttributeName(attr), "", "", nullptr, VTypeAttributesParent, MID_GNE_SET_ATTRIBUTE_DIALOG, GUIDesignButtonFixed(150));
473 if (rowAttrType == ROWTYPE_COLOR) {
475 }
476 } else if (rowAttrType == ROWTYPE_PARAMETERS) {
477 myButton = GUIDesigns::buildFXButton(this, TL("Edit parameters"), "", "", nullptr, VTypeAttributesParent, MID_GNE_ATTRIBUTESEDITOR_PARAMETERS, GUIDesignButtonFixed(150));
478 } else {
480 }
481 // now check if we have to create a textfield or a ComboBox
482 if ((rowAttrType == ROWTYPE_STRING) || (rowAttrType == ROWTYPE_COLOR) || (rowAttrType == ROWTYPE_FILENAME) || (rowAttrType == ROWTYPE_PARAMETERS)) {
483 myTextField = new FXTextField(this, GUIDesignTextFieldNCol, VTypeAttributesParent, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFieldFixed(180));
484 } else if (rowAttrType == ROWTYPE_COMBOBOX) {
487 // fill combo Box with values
488 for (const auto& value : values) {
489 myComboBox->appendIconItem(value.c_str(), nullptr);
490 }
491 } else {
492 throw ProcessError(TL("Invalid row type"));
493 }
494}
495
496
497void
499 if (myRowAttrType == ROWTYPE_COMBOBOX) {
500 // set color of myComboBox, depending if current value is valid or not
501 if (myVTypeAttributesParent->myVehicleTypeDialog->myElement->isValid(myAttr, myComboBox->getText().text())) {
502 myVTypeAttributesParent->myVehicleTypeDialog->myElement->setAttribute(myAttr, myComboBox->getText().text(),
503 myVTypeAttributesParent->myVehicleTypeDialog->myElement->getNet()->getViewNet()->getUndoList());
504 // update value after setting it
505 updateValue();
506 } else {
507 myComboBox->setTextColor(GUIDesignTextColorRed);
508 // mark VType as invalid
509 myVTypeAttributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
510 myVTypeAttributesParent->myVehicleTypeDialog->myInvalidAttr = myAttr;
511 }
512 } else if (myRowAttrType == ROWTYPE_COLOR) {
513 // set color of myTextFieldColor, depending if current value is valid or not
514 if (myVTypeAttributesParent->myVehicleTypeDialog->myElement->isValid(SUMO_ATTR_COLOR, myTextField->getText().text())) {
515 // set color depending if is a default value
516 if (myVTypeAttributesParent->myVehicleTypeDialog->myElement->getTagProperty()->getDefaultStringValue(SUMO_ATTR_COLOR) != myTextField->getText().text()) {
517 myTextField->setTextColor(GUIDesignTextColorBlack);
518 } else {
519 myTextField->setTextColor(FXRGB(195, 195, 195));
520 }
521 myVTypeAttributesParent->myVehicleTypeDialog->myElement->setAttribute(SUMO_ATTR_COLOR, myTextField->getText().text(), myVTypeAttributesParent->myVehicleTypeDialog->myElement->getNet()->getViewNet()->getUndoList());
522 } else {
523 myTextField->setTextColor(GUIDesignTextColorRed);
524 myVTypeAttributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
525 myVTypeAttributesParent->myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_COLOR;
526 }
527 } else {
528 // set color of textField, depending if current value is valid or not
529 if (myVTypeAttributesParent->myVehicleTypeDialog->myElement->isValid(myAttr, myTextField->getText().text())) {
530 myVTypeAttributesParent->myVehicleTypeDialog->myElement->setAttribute(myAttr, myTextField->getText().text(),
531 myVTypeAttributesParent->myVehicleTypeDialog->myElement->getNet()->getViewNet()->getUndoList());
532 // update value after setting it
533 updateValue();
534 } else {
535 myTextField->setTextColor(GUIDesignTextColorRed);
536 // mark VType as invalid
537 myVTypeAttributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
538 myVTypeAttributesParent->myVehicleTypeDialog->myInvalidAttr = myAttr;
539 }
540 }
541}
542
543
544void
546 if (myComboBox) {
547 // set color of myComboBox, depending if current value is valid or not
548 if (myVTypeAttributesParent->myVehicleTypeDialog->myElement->isValid(myAttr, myComboBox->getText().text())) {
549 myVTypeAttributesParent->myVehicleTypeDialog->myElement->setAttribute(myAttr, myComboBox->getText().text(),
550 myVTypeAttributesParent->myVehicleTypeDialog->myElement->getNet()->getViewNet()->getUndoList());
551 // update value after setting it
552 updateValue(defaultValue);
553 } else {
554 myComboBox->setTextColor(GUIDesignTextColorRed);
555 // mark VType as invalid
556 myVTypeAttributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
557 myVTypeAttributesParent->myVehicleTypeDialog->myInvalidAttr = myAttr;
558 }
559 } else {
560 // set color of textField, depending if current value is valid or not
561 if (myVTypeAttributesParent->myVehicleTypeDialog->myElement->isValid(myAttr, myTextField->getText().text())) {
562 myVTypeAttributesParent->myVehicleTypeDialog->myElement->setAttribute(myAttr, myTextField->getText().text(),
563 myVTypeAttributesParent->myVehicleTypeDialog->myElement->getNet()->getViewNet()->getUndoList());
564 // update value after setting it
565 updateValue(defaultValue);
566 } else {
567 myTextField->setTextColor(GUIDesignTextColorRed);
568 // mark VType as invalid
569 myVTypeAttributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
570 myVTypeAttributesParent->myVehicleTypeDialog->myInvalidAttr = myAttr;
571 }
572 }
573}
574
575
576void
578 if (myRowAttrType == ROWTYPE_COMBOBOX) {
579 // set value
580 const int index = myComboBox->findItem(myVTypeAttributesParent->myVehicleTypeDialog->myElement->getAttribute(myAttr).c_str());
581 if (index == -1) {
582 myComboBox->disable();
583 } else {
584 myComboBox->setCurrentItem(index);
585 myComboBox->enable();
586 }
587 // set color depending if is a default value
588 if (myVTypeAttributesParent->myVehicleTypeDialog->myElement->getTagProperty()->getDefaultStringValue(myAttr) != myComboBox->getText().text()) {
589 myComboBox->setTextColor(GUIDesignTextColorBlack);
590 } else {
591 myComboBox->setTextColor(FXRGB(195, 195, 195));
592 }
593 } else if (myRowAttrType == ROWTYPE_COLOR) {
594 // set field color
595 myTextField->setText(myVTypeAttributesParent->myVehicleTypeDialog->myElement->getAttribute(myAttr).c_str());
596 // set color depending if is a default value
597 if (myVTypeAttributesParent->myVehicleTypeDialog->myElement->getTagProperty()->getDefaultStringValue(myAttr) != myTextField->getText().text()) {
598 myTextField->setTextColor(GUIDesignTextColorBlack);
599 } else {
600 myTextField->setTextColor(FXRGB(195, 195, 195));
601 }
602 } else if (myAttr == GNE_ATTR_PARAMETERS) {
603 // get parameters
604 const std::string& parametersStr = myVTypeAttributesParent->myVehicleTypeDialog->myElement->getAttribute(myAttr);
605 // set text of myTextField using current value of VType
606 myTextField->setText(parametersStr.c_str());
607 // set text color
608 myTextField->setTextColor(GUIDesignTextColorBlack);
609 // clear parameters
610 myParameters.clear();
611 // separate value in a vector of string using | as separator
612 StringTokenizer parameters(parametersStr, "|", true);
613 // iterate over all values
614 while (parameters.hasNext()) {
615 // obtain key and value and save it in myParameters
616 const std::vector<std::string> keyValue = StringTokenizer(parameters.next(), "=", true).getVector();
617 if (keyValue.size() == 2) {
618 myParameters[keyValue.front()] = keyValue.back();
619 }
620 }
621 } else {
622 // set text of myTextField using current value of VType
623 myTextField->setText(myVTypeAttributesParent->myVehicleTypeDialog->myElement->getAttribute(myAttr).c_str());
624 // set color depending if is a default value
625 if (myVTypeAttributesParent->myVehicleTypeDialog->myElement->getTagProperty()->getDefaultStringValue(myAttr) != myTextField->getText().text()) {
626 myTextField->setTextColor(GUIDesignTextColorBlack);
627 } else {
628 myTextField->setTextColor(FXRGB(195, 195, 195));
629 }
630 }
631}
632
633
634void
636 if (myComboBox) {
637 // set value
638 const int index = myComboBox->findItem(myVTypeAttributesParent->myVehicleTypeDialog->myElement->getAttribute(myAttr).c_str());
639 if (index == -1) {
640 myComboBox->disable();
641 } else {
642 myComboBox->setCurrentItem(index);
643 myComboBox->enable();
644 }
645 // set color depending if is a default value
646 if (defaultValue != myComboBox->getText().text()) {
647 myComboBox->setTextColor(GUIDesignTextColorBlack);
648 } else {
649 myComboBox->setTextColor(FXRGB(195, 195, 195));
650 }
651 } else {
652 // set text of myTextField using current value of VType
653 myTextField->setText(myVTypeAttributesParent->myVehicleTypeDialog->myElement->getAttribute(myAttr).c_str());
654 // set color depending if is a default value
655 if (defaultValue != myTextField->getText().text()) {
656 myTextField->setTextColor(GUIDesignTextColorBlack);
657 } else {
658 myTextField->setTextColor(FXRGB(195, 195, 195));
659 }
660 }
661}
662
663
664const FXButton*
668
669
670void
672 const auto editedDemandElement = myVTypeAttributesParent->myVehicleTypeDialog->myElement;
674 // If previous attribute wasn't correct, set black as default color
675 if (GNEAttributeCarrier::canParse<RGBColor>(myTextField->getText().text())) {
676 color = GNEAttributeCarrier::parse<RGBColor>(myTextField->getText().text());
677 }
678 // declare colorDialog
679 const auto colorDialog = new GNEColorDialog(editedDemandElement->getNet()->getViewNet()->getViewParent()->getGNEAppWindows(), color);
680 // continue depending of result
681 if (colorDialog->getResult() == GNEDialog::Result::ACCEPT) {
682 std::string newValue = toString(colorDialog->getColor());
683 myTextField->setText(newValue.c_str());
684 if (editedDemandElement->isValid(myAttr, newValue)) {
685 editedDemandElement->setAttribute(myAttr, newValue, editedDemandElement->getNet()->getViewNet()->getUndoList());
686 // If previously value was incorrect, change font color to black
687 myTextField->setTextColor(GUIDesignTextColorBlack);
688 myTextField->killFocus();
689 }
690 }
691}
692
693
694void
696 // get the new image file
697 FXFileDialog opendialog(this, TL("Open Image"));
698 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::VTYPE));
699 opendialog.setSelectMode(SELECTFILE_EXISTING);
700 opendialog.setPatternList(SUMOXMLDefinitions::ImageFileExtensions.getMultilineString().c_str());
701 if (gCurrentFolder.length() != 0) {
702 opendialog.setDirectory(gCurrentFolder);
703 }
704 if (opendialog.execute()) {
705 // update global current folder
706 gCurrentFolder = opendialog.getDirectory();
707 // get image path
708 std::string imagePath = opendialog.getFilename().text();
709 // check if image is valid
710 if (myVTypeAttributesParent->myVehicleTypeDialog->myElement->isValid(myAttr, imagePath)) {
711 myVTypeAttributesParent->myVehicleTypeDialog->myElement->setAttribute(myAttr, imagePath, myVTypeAttributesParent->myVehicleTypeDialog->myElement->getNet()->getViewNet()->getUndoList());
712 myTextField->setText(imagePath.c_str());
713 // If previously value was incorrect, change font color to black
714 myTextField->setTextColor(GUIDesignTextColorBlack);
715 myTextField->killFocus();
716 }
717 }
718}
719
720
721void
723 // get the new file name
724 FXFileDialog opendialog(this, TL("Open OSG File"));
725 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::VTYPE));
726 opendialog.setSelectMode(SELECTFILE_EXISTING);
727 opendialog.setPatternList(SUMOXMLDefinitions::OSGFileExtensions.getMultilineString().c_str());
728 if (gCurrentFolder.length() != 0) {
729 opendialog.setDirectory(gCurrentFolder);
730 }
731 if (opendialog.execute()) {
732 // update global current folder
733 gCurrentFolder = opendialog.getDirectory();
734 // get image path
735 std::string imagePath = opendialog.getFilename().text();
736 // check if image is valid
737 if (myVTypeAttributesParent->myVehicleTypeDialog->myElement->isValid(myAttr, imagePath)) {
738 myVTypeAttributesParent->myVehicleTypeDialog->myElement->setAttribute(myAttr, imagePath, myVTypeAttributesParent->myVehicleTypeDialog->myElement->getNet()->getViewNet()->getUndoList());
739 myTextField->setText(imagePath.c_str());
740 // If previously value was incorrect, change font color to black
741 myTextField->setTextColor(GUIDesignTextColorBlack);
742 myTextField->killFocus();
743 }
744 }
745}
746
747
748std::string
750 return myTextField->getText().text();
751}
752
753
754std::vector<std::pair<std::string, std::string> >
756 std::vector<std::pair<std::string, std::string> > result;
757 // Generate a vector string using the following structure: "<key1,value1>, <key2, value2>,...
758 for (const auto& parameter : myParameters) {
759 result.push_back(std::make_pair(parameter.first, parameter.second));
760 }
761 return result;
762}
763
764
765void
766GNEVehicleTypeDialog::VTypeAttributes::VTypeAttributeRow::setParameters(const std::vector<std::pair<std::string, std::string> >& parameters) {
767 // first clear parameters
768 myParameters.clear();
769 // declare result
770 std::string result;
771 // iterate over parameters
772 for (const auto& parameter : parameters) {
773 // Generate an string using the following structure: "key1=value1|key2=value2|...
774 result += parameter.first + "=" + parameter.second + "|";
775 // fill parameters
776 myParameters[parameter.first] = parameter.second;
777 }
778 // remove the last "|"
779 if (!result.empty()) {
780 result.pop_back();
781 }
782 // set text field
783 myTextField->setText(result.c_str());
784}
785
786
787std::string
789 switch (attr) {
790 // JM
792 return "crossingGap";
794 return "driveAfterYellowTime";
796 return "driveAfterRedTime";
798 return "driveRedSpeed";
800 return "ignoreKeepClearTime";
802 return "ignoreFoeSpeed";
804 return "ignoreFoeProb";
806 return "sigmaMinor";
808 return "timegapMinor";
809 // LCM
811 return "strategic";
813 return "cooperative";
815 return "speedGain";
817 return "keepRight";
819 return "sublane";
821 return "opposite";
823 return "pushy";
825 return "pushyGap";
827 return "assertive";
829 return "impatience";
831 return "timeToImpatience";
833 return "accelLat";
835 return "lookaheadLeft";
837 return "speedGainRight";
839 return "maxSpeedLatStanding";
841 return "maxSpeedLatFactor";
843 return "turnAlignDistance";
845 return "overtakeRight";
847 return "keepRightAcceptanceTime";
849 return "overtakeDeltaSpeedFactor";
850 /* case SUMO_ATTR_LCA_EXPERIMENTAL1:
851 return "experimental1";
852 */
853 default:
854 return toString(attr);
855 }
856}
857
858// ---------------------------------------------------------------------------
859// GNEVehicleTypeDialog::VTypeAttributes - methods
860// ---------------------------------------------------------------------------
861
863 FXVerticalFrame(column, GUIDesignAuxiliarVerticalFrame),
864 myVehicleTypeDialog(vehicleTypeDialog) {
865 // declare two auxiliary horizontal frames
866 FXHorizontalFrame* firstAuxiliarHorizontalFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
867 FXVerticalFrame* firstAuxiliarVerticalFrame = new FXVerticalFrame(firstAuxiliarHorizontalFrame, GUIDesignAuxiliarVerticalFrame);
868 // create attributes for common attributes
869 FXGroupBox* commonAttributes = new FXGroupBox(firstAuxiliarVerticalFrame, "Vehicle Type attributes", GUIDesignGroupBoxFrame);
870 // create horizontal frame for columns of attributes
871 FXHorizontalFrame* columnsBasicVTypeAttributes = new FXHorizontalFrame(commonAttributes, GUIDesignAuxiliarHorizontalFrame);
872 // build left attributes
873 buildAttributesA(new FXVerticalFrame(columnsBasicVTypeAttributes, GUIDesignAuxiliarFrame));
874 // build right attributes
875 buildAttributesB(new FXVerticalFrame(columnsBasicVTypeAttributes, GUIDesignAuxiliarFrame));
876 // create GroupBox for Junction Model Attributes
877 FXGroupBox* JMAttributes = new FXGroupBox(firstAuxiliarVerticalFrame, "Junction Model attributes", GUIDesignGroupBoxFrame);
878 // create horizontal frame for columns of Junction Model attributes
879 FXHorizontalFrame* columnsJMVTypeAttributes = new FXHorizontalFrame(JMAttributes, GUIDesignAuxiliarHorizontalFrame);
880 // build left attributes
881 buildJunctionModelAttributesA(new FXVerticalFrame(columnsJMVTypeAttributes, GUIDesignAuxiliarFrame));
882 // build right attributes
883 buildJunctionModelAttributesB(new FXVerticalFrame(columnsJMVTypeAttributes, GUIDesignAuxiliarFrame));
884 // create GroupBox for Junction Model Attributes
885 FXGroupBox* LCMAttributes = new FXGroupBox(firstAuxiliarHorizontalFrame, "Lane Change Model attributes", GUIDesignGroupBoxFrame);
886 // create Lane Change Model Attributes
887 buildLaneChangeModelAttributes(new FXVerticalFrame(LCMAttributes, GUIDesignAuxiliarFrame));
888}
889
890
891void
893 // 01 Create VClassRow
894 myVClassRow = new VClassRow(this, column);
895
896 // 02 create FXTextField and Label for vehicleTypeID
897 FXHorizontalFrame* row = new FXHorizontalFrame(column, GUIDesignAuxiliarHorizontalFrame);
898 new FXLabel(row, toString(SUMO_ATTR_ID).c_str(), nullptr, GUIDesignLabelThickedFixed(150));
899 myTextFieldVehicleTypeID = new FXTextField(row, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFieldFixed(180));
900
901 // 03 create FXTextField and Button for Color
902 myColor = new VTypeAttributeRow(this, column, SUMO_ATTR_COLOR, VTypeAttributeRow::RowAttrType::ROWTYPE_COLOR);
903
904 // 04 create FXTextField and Label for Length
905 myLength = new VTypeAttributeRow(this, column, SUMO_ATTR_LENGTH, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
906
907 // 05 create FXTextField and Label for MinGap
908 myMinGap = new VTypeAttributeRow(this, column, SUMO_ATTR_MINGAP, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
909
910 // 06 create FXTextField and Label for MaxSpeed
911 myMaxSpeed = new VTypeAttributeRow(this, column, SUMO_ATTR_MAXSPEED, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
912
913 // 07 create VTypeAttributeRow and Label for desired max speed
914 myDesiredMaxSpeed = new VTypeAttributeRow(this, column, SUMO_ATTR_DESIRED_MAXSPEED, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
915
916 // 08 create FXTextField and Label for SpeedFactor
917 mySpeedFactor = new VTypeAttributeRow(this, column, SUMO_ATTR_SPEEDFACTOR, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
918
919 // 09 create FXTextField and Label for EmissionClass
920 myEmissionClass = new VTypeAttributeRow(this, column, SUMO_ATTR_EMISSIONCLASS, VTypeAttributeRow::RowAttrType::ROWTYPE_COMBOBOX, PollutantsInterface::getAllClassesStr());
921
922 // 10 create FXTextField and Label for Width
923 myWidth = new VTypeAttributeRow(this, column, SUMO_ATTR_WIDTH, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
924
925 // 11 create FXTextField and Label for Height
926 myHeight = new VTypeAttributeRow(this, column, SUMO_ATTR_HEIGHT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
927
928 // 12 create FXTextField and Label for Filename
929 myFilename = new VTypeAttributeRow(this, column, SUMO_ATTR_IMGFILE, VTypeAttributeRow::RowAttrType::ROWTYPE_FILENAME);
930
931 // 13 create FXTextField and Label for Filename
932 myOSGFile = new VTypeAttributeRow(this, column, SUMO_ATTR_OSGFILE, VTypeAttributeRow::RowAttrType::ROWTYPE_FILENAME);
933
934 // 14 create VTypeAttributeRow and Label for LaneChangeModel
935 myLaneChangeModel = new VTypeAttributeRow(this, column, SUMO_ATTR_LANE_CHANGE_MODEL, VTypeAttributeRow::RowAttrType::ROWTYPE_COMBOBOX, SUMOXMLDefinitions::LaneChangeModels.getStrings());
936}
937
938
939void
941 // 01 Create VShapeRow
942 myVShapeRow = new VShapeRow(this, column);
943
944 // 02 create VTypeAttributeRow and Label for Probability
945 myProbability = new VTypeAttributeRow(this, column, SUMO_ATTR_PROB, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
946
947 // 03 create VTypeAttributeRow and Label for PersonCapacity
948 myPersonCapacity = new VTypeAttributeRow(this, column, SUMO_ATTR_PERSON_CAPACITY, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
949
950 // 04 create VTypeAttributeRow and Label for ContainerCapacity
951 myContainerCapacity = new VTypeAttributeRow(this, column, SUMO_ATTR_CONTAINER_CAPACITY, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
952
953 // 05 create VTypeAttributeRow and Label for BoardingDuration
954 myBoardingDuration = new VTypeAttributeRow(this, column, SUMO_ATTR_BOARDING_DURATION, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
955
956 // 06 create VTypeAttributeRow and Label for LoadingDuration
957 myLoadingDuration = new VTypeAttributeRow(this, column, SUMO_ATTR_LOADING_DURATION, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
958
959 // 07 create ComboBox and Label for LatAlignment
960 myLatAlignment = new VTypeAttributeRow(this, column, SUMO_ATTR_LATALIGNMENT, VTypeAttributeRow::RowAttrType::ROWTYPE_COMBOBOX, SUMOVTypeParameter::getLatAlignmentStrings());
961
962 // 08 create VTypeAttributeRow and Label for MinGapLat
963 myMinGapLat = new VTypeAttributeRow(this, column, SUMO_ATTR_MINGAP_LAT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
964
965 // 09 create VTypeAttributeRow and Label for MaxSpeedLat
966 myMaxSpeedLat = new VTypeAttributeRow(this, column, SUMO_ATTR_MAXSPEED_LAT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
967
968 // 10 create VTypeAttributeRow and Label for ActionStepLength
969 myActionStepLength = new VTypeAttributeRow(this, column, SUMO_ATTR_ACTIONSTEPLENGTH, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
970 /*
971 Waiting for #16343
972 // 11 create FXTextField and Label for Carriage length
973 myCarriageLength = new VTypeAttributeRow(this, column, SUMO_ATTR_CARRIAGE_LENGTH, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
974
975 // 12 create FXTextField and Label for Locomotive length
976 myLocomotiveLength = new VTypeAttributeRow(this, column, SUMO_ATTR_LOCOMOTIVE_LENGTH, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
977
978 // 13 create FXTextField and Label for carriage GAP
979 myCarriageGap = new VTypeAttributeRow(this, column, SUMO_ATTR_CARRIAGE_GAP, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
980 */
981 // 14 create FXTextField and Label for parameters
982 myParameters = new VTypeAttributeRow(this, column, GNE_ATTR_PARAMETERS, VTypeAttributeRow::RowAttrType::ROWTYPE_PARAMETERS);
983}
984
985
986void
988 // 01 create VTypeAttributeRow and Label for JMCrossingGap
989 myJMCrossingGap = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_CROSSING_GAP, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
990
991 // 02 create VTypeAttributeRow and Label for JMIgnoreKeepclearTime
992 myJMIgnoreKeepclearTime = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_IGNORE_KEEPCLEAR_TIME, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
993
994 // 03 create VTypeAttributeRow and Label for JMDriveAfterYellowTime
995 myJMDriveAfterYellowTime = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_DRIVE_AFTER_YELLOW_TIME, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
996
997 // 04 create VTypeAttributeRow and Label for JMDriveAfterRedTime
998 myJMDriveAfterRedTime = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_DRIVE_AFTER_RED_TIME, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
999
1000 // 05 create VTypeAttributeRow and Label for JMDriveRedSpeed
1001 myJMDriveRedSpeed = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_DRIVE_RED_SPEED, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1002}
1003
1004
1005void
1007 // 01 create VTypeAttributeRow and Label for JMIgnoreFoeProb
1008 myJMIgnoreFoeProb = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_IGNORE_FOE_PROB, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1009
1010 // 02 create VTypeAttributeRow and Label for JMIgnoreFoeSpeed
1011 myJMIgnoreFoeSpeed = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_IGNORE_FOE_SPEED, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1012
1013 // 03 create VTypeAttributeRow and Label for JMSigmaMinor
1014 myJMSigmaMinor = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_SIGMA_MINOR, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1015
1016 // 04 create VTypeAttributeRow and Label for JMTimeGapMinor
1017 myJMTimeGapMinor = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_TIMEGAP_MINOR, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1018
1019 // 05 create VTypeAttributeRow and Label for Impatience
1020 myJMImpatience = new VTypeAttributeRow(this, column, SUMO_ATTR_IMPATIENCE, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1021}
1022
1023
1024void
1026 // 01 create VTypeAttributeRow and Label for strategic param
1027 myLCAStrategicParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_STRATEGIC_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1028
1029 // 02 create VTypeAttributeRow and Label for cooperative param
1030 myLCACooperativeParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_COOPERATIVE_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1031
1032 // 03 create VTypeAttributeRow and Label for speed gain param
1033 myLCASpeedgainParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_SPEEDGAIN_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1034
1035 // 04 create VTypeAttributeRow and Label for keepright param
1036 myLCAKeeprightParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_KEEPRIGHT_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1037
1038 // 05 create VTypeAttributeRow and Label for sublane param
1039 myLCASublaneParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_SUBLANE_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1040
1041 // 06 create VTypeAttributeRow and Label for opposite param
1042 myLCAOppositeParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_OPPOSITE_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1043
1044 // 07 create VTypeAttributeRow and Label for pushy
1045 myLCAPushy = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_PUSHY, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1046
1047 // 08 create VTypeAttributeRow and Label for pushy gap
1048 myLCAPushygap = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_PUSHYGAP, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1049
1050 // 09 create VTypeAttributeRow and Label for assertive
1051 myLCAAssertive = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_ASSERTIVE, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1052
1053 // 10 create VTypeAttributeRow and Label for impatience
1054 myLCAImpatience = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_IMPATIENCE, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1055
1056 // 11 create VTypeAttributeRow and Label for time to impatience
1057 myLCATimeToImpatience = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_TIME_TO_IMPATIENCE, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1058
1059 // 12 create VTypeAttributeRow and Label for accel lat
1060 myLCAAccelLat = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_ACCEL_LAT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1061
1062 // 13 create VTypeAttributeRow and Label for look ahead lefth
1063 myLCALookAheadLeft = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_LOOKAHEADLEFT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1064
1065 // 14 create VTypeAttributeRow and Label for speed gain right
1066 myLCASpeedGainRight = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_SPEEDGAINRIGHT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1067
1068 // 15 create VTypeAttributeRow and Label for max speed lat standing
1069 myLCAMaxSpeedLatStanding = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_MAXSPEEDLATSTANDING, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1070
1071 // 16 create VTypeAttributeRow and Label for max speed lat factor
1072 myLCAMaxSpeedLatFactor = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_MAXSPEEDLATFACTOR, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1073
1074 // 17 create VTypeAttributeRow and Label for turn alignment distance
1075 myLCATurnAlignmentDistance = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_TURN_ALIGNMENT_DISTANCE, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1076
1077 // 18 create VTypeAttributeRow and Label for overtake right
1078 myLCAOvertakeRight = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_OVERTAKE_RIGHT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1079
1080 // 19 create VTypeAttributeRow and Label for keep right acceptance time
1081 myLCAKeepRightAcceptanceTime = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_KEEPRIGHT_ACCEPTANCE_TIME, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1082
1083 // 20 create VTypeAttributeRow and Label for overtake deltaspeed factor
1084 myLCAOvertakeDeltaSpeedFactor = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_OVERTAKE_DELTASPEED_FACTOR, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1085
1086 // 21 create VTypeAttributeRow and Label for experimental
1087 /* myLCAExperimental = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_EXPERIMENTAL1, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING); */
1088}
1089
1090
1091void
1093 //set values of myElement into fields
1094 myTextFieldVehicleTypeID->setText(myVehicleTypeDialog->myElement->getAttribute(SUMO_ATTR_ID).c_str());
1095 // set variables of special rows VClass and VShape
1096 SUMOVTypeParameter::VClassDefaultValues defaultVTypeParameters(myVClassRow->updateValue());
1097 myVShapeRow->updateValues();
1098 // update rows
1099 myLaneChangeModel->updateValue();
1100 myLatAlignment->updateValue(toString(defaultVTypeParameters.latAlignmentProcedure));
1101 myColor->updateValue();
1102 myLength->updateValue(toString(defaultVTypeParameters.length));
1103 myMinGap->updateValue(toString(defaultVTypeParameters.minGap));
1104 myMaxSpeed->updateValue(toString(defaultVTypeParameters.maxSpeed));
1105 myDesiredMaxSpeed->updateValue(toString(defaultVTypeParameters.desiredMaxSpeed));
1106 mySpeedFactor->updateValue(toString(defaultVTypeParameters.speedFactor.getParameter(0)));
1107 myEmissionClass->updateValue(toString(defaultVTypeParameters.emissionClass));
1108 myWidth->updateValue(toString(defaultVTypeParameters.width));
1109 myHeight->updateValue(toString(defaultVTypeParameters.height));
1110 myFilename->updateValue();
1111 myOSGFile->updateValue(toString(defaultVTypeParameters.osgFile));
1112 myPersonCapacity->updateValue(toString(defaultVTypeParameters.personCapacity));
1113 myContainerCapacity->updateValue(toString(defaultVTypeParameters.containerCapacity));
1114 /*
1115 Waiting for #16343
1116 myCarriageLength->updateValue(toString(defaultVTypeParameters.carriageLength));
1117 myLocomotiveLength->updateValue(toString(defaultVTypeParameters.locomotiveLength));
1118 myCarriageGap->updateValue();
1119 */
1120 myBoardingDuration->updateValue();
1121 myLoadingDuration->updateValue();
1122 myMinGapLat->updateValue();
1123 myMaxSpeedLat->updateValue();
1124 myActionStepLength->updateValue();
1125 myProbability->updateValue();
1126 // JM Parameters
1127 myJMCrossingGap->updateValue();
1128 myJMIgnoreKeepclearTime->updateValue();
1129 myJMDriveAfterYellowTime->updateValue();
1130 myJMDriveAfterRedTime->updateValue();
1131 myJMDriveRedSpeed->updateValue();
1132 myJMIgnoreFoeProb->updateValue();
1133 myJMIgnoreFoeSpeed->updateValue();
1134 myJMSigmaMinor->updateValue();
1135 myJMTimeGapMinor->updateValue();
1136 myJMImpatience->updateValue();
1137 // LCM Attributes
1138 myLCAStrategicParam->updateValue();
1139 myLCACooperativeParam->updateValue();
1140 myLCASpeedgainParam->updateValue();
1141 myLCAKeeprightParam->updateValue();
1142 myLCASublaneParam->updateValue();
1143 myLCAOppositeParam->updateValue();
1144 myLCAPushy->updateValue();
1145 myLCAPushygap->updateValue();
1146 myLCAAssertive->updateValue();
1147 myLCAImpatience->updateValue();
1148 myLCATimeToImpatience->updateValue();
1149 myLCAAccelLat->updateValue();
1150 myLCALookAheadLeft->updateValue();
1151 myLCASpeedGainRight->updateValue();
1152 myLCAMaxSpeedLatStanding->updateValue();
1153 myLCAMaxSpeedLatFactor->updateValue();
1154 myLCATurnAlignmentDistance->updateValue();
1155 myLCAOvertakeRight->updateValue();
1156 myLCAKeepRightAcceptanceTime->updateValue();
1157 myLCAOvertakeDeltaSpeedFactor->updateValue();
1158 /* myLCAExperimental->updateValue(); */
1159 // parameters
1160 myParameters->updateValue();
1161}
1162
1163
1164long
1166 // At start we assumed, that all values are valid
1167 myVehicleTypeDialog->myVehicleTypeValid = true;
1168 myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_NOTHING;
1169 // set color of myTextFieldVehicleTypeID, depending if current value is valid or not
1170 if (myVehicleTypeDialog->myElement->isValid(SUMO_ATTR_ID, myTextFieldVehicleTypeID->getText().text())) {
1171 myTextFieldVehicleTypeID->setTextColor(GUIDesignTextColorBlack);
1172 myVehicleTypeDialog->myElement->setAttribute(SUMO_ATTR_ID, myTextFieldVehicleTypeID->getText().text(), myVehicleTypeDialog->myElement->getNet()->getViewNet()->getUndoList());
1173 } else if (myVehicleTypeDialog->myElement->getAttribute(SUMO_ATTR_ID) == myTextFieldVehicleTypeID->getText().text()) {
1174 myTextFieldVehicleTypeID->setTextColor(GUIDesignTextColorBlack);
1175 myVehicleTypeDialog->myElement->setAttribute(SUMO_ATTR_ID, myTextFieldVehicleTypeID->getText().text(), myVehicleTypeDialog->myElement->getNet()->getViewNet()->getUndoList());
1176 } else {
1177 myTextFieldVehicleTypeID->setTextColor(GUIDesignTextColorRed);
1178 myVehicleTypeDialog->myVehicleTypeValid = false;
1179 myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_ID;
1180 }
1181 // set variables of special rows VClass and VShape
1182 SUMOVTypeParameter::VClassDefaultValues defaultVTypeParameters(myVClassRow->setVariable());
1183 // set variables of special rows VShape
1184 myVShapeRow->setVariable();
1185 // set attributes in rest rows
1186 myColor->setVariable();
1187 myLength->setVariable(toString(defaultVTypeParameters.length));
1188 myMinGap->setVariable(toString(defaultVTypeParameters.minGap));
1189 myMaxSpeed->setVariable(toString(defaultVTypeParameters.maxSpeed));
1190 myDesiredMaxSpeed->setVariable(toString(defaultVTypeParameters.desiredMaxSpeed));
1191 mySpeedFactor->setVariable(toString(defaultVTypeParameters.speedFactor.getParameter(0)));
1192 myEmissionClass->setVariable(toString(defaultVTypeParameters.emissionClass));
1193 myWidth->setVariable(toString(defaultVTypeParameters.width));
1194 myHeight->setVariable(toString(defaultVTypeParameters.height));
1195 myOSGFile->setVariable(toString(defaultVTypeParameters.osgFile));
1196 // set attributes in rows
1197 myLaneChangeModel->setVariable();
1198 myLatAlignment->setVariable(toString(defaultVTypeParameters.latAlignmentProcedure));
1199 myLength->setVariable(toString(defaultVTypeParameters.length));
1200 myMinGap->setVariable(toString(defaultVTypeParameters.minGap));
1201 myMaxSpeed->setVariable(toString(defaultVTypeParameters.maxSpeed));
1202 mySpeedFactor->setVariable(toString(defaultVTypeParameters.speedFactor.getParameter(0)));
1203 myEmissionClass->setVariable(toString(defaultVTypeParameters.emissionClass));
1204 myWidth->setVariable(toString(defaultVTypeParameters.width));
1205 myHeight->setVariable(toString(defaultVTypeParameters.height));
1206 myFilename->setVariable();
1207 myOSGFile->setVariable(toString(defaultVTypeParameters.osgFile));
1208 myPersonCapacity->setVariable(toString(defaultVTypeParameters.personCapacity));
1209 myContainerCapacity->setVariable(toString(defaultVTypeParameters.containerCapacity));
1210 /*
1211 Waiting for #16343
1212 myCarriageLength->setVariable(toString(defaultVTypeParameters.carriageLength));
1213 myLocomotiveLength->setVariable(toString(defaultVTypeParameters.locomotiveLength));
1214 myCarriageGap->setVariable();
1215 */
1216 myBoardingDuration->setVariable();
1217 myLoadingDuration->setVariable();
1218 myMinGapLat->setVariable();
1219 myMaxSpeedLat->setVariable();
1220 myActionStepLength->setVariable();
1221 myProbability->setVariable();
1222 // JM Variables
1223 myJMCrossingGap->setVariable();
1224 myJMIgnoreKeepclearTime->setVariable();
1225 myJMDriveAfterYellowTime->setVariable();
1226 myJMDriveAfterRedTime->setVariable();
1227 myJMDriveRedSpeed->setVariable();
1228 myJMIgnoreFoeProb->setVariable();
1229 myJMIgnoreFoeSpeed->setVariable();
1230 myJMSigmaMinor->setVariable();
1231 myJMTimeGapMinor->setVariable();
1232 myJMImpatience->setVariable();
1233 // LCM Attributes
1234 myLCAStrategicParam->setVariable();
1235 myLCACooperativeParam->setVariable();
1236 myLCASpeedgainParam->setVariable();
1237 myLCAKeeprightParam->setVariable();
1238 myLCASublaneParam->setVariable();
1239 myLCAOppositeParam->setVariable();
1240 myLCAPushy->setVariable();
1241 myLCAPushygap->setVariable();
1242 myLCAAssertive->setVariable();
1243 myLCAImpatience->setVariable();
1244 myLCATimeToImpatience->setVariable();
1245 myLCAAccelLat->setVariable();
1246 myLCALookAheadLeft->setVariable();
1247 myLCASpeedGainRight->setVariable();
1248 myLCAMaxSpeedLatStanding->setVariable();
1249 myLCAMaxSpeedLatFactor->setVariable();
1250 myLCATurnAlignmentDistance->setVariable();
1251 myLCAOvertakeRight->setVariable();
1252 myLCAKeepRightAcceptanceTime->setVariable();
1253 myLCAOvertakeDeltaSpeedFactor->setVariable();
1254 /* myLCAExperimental->setVariable(); */
1255 myParameters->setVariable();
1256 return true;
1257}
1258
1259
1260long
1262 // check what dialog has to be opened
1263 if (obj == myColor->getButton()) {
1264 myColor->openColorDialog();
1265 } else if (obj == myFilename->getButton()) {
1266 myFilename->openImageFileDialog();
1267 } else if (obj == myOSGFile->getButton()) {
1268 myFilename->openOSGFileDialog();
1269 }
1270 return 1;
1271}
1272
1273
1274long
1276 auto viewNet = myVehicleTypeDialog->getElement()->getNet()->getViewNet();
1277 // create parameters dialog
1278 const auto singleParametersDialog = GNEParametersDialog(viewNet->getViewParent()->getGNEAppWindows(), myVehicleTypeDialog->getElement()->getParameters()->getParametersMap());
1279 // continue depending of result
1280 if (singleParametersDialog.getResult() == GNEDialog::Result::ACCEPT) {
1281 // set values edited in Parameter dialog in Edited AC
1282 myVehicleTypeDialog->getElement()->setAttribute(GNE_ATTR_PARAMETERS, myParameters->getParametersStr(), viewNet->getUndoList());
1283 }
1284 return 1;
1285}
1286
1287// ---------------------------------------------------------------------------
1288// GNEVehicleTypeDialog::VShapeRow - methods
1289// ---------------------------------------------------------------------------
1290
1292 FXGroupBox(column, "Car Following Model attributes", GUIDesignGroupBoxFrame),
1293 myVehicleTypeDialog(vehicleTypeDialog) {
1294
1295 // create vertical frame for rows
1296 myVerticalFrameRows = new FXVerticalFrame(this, GUIDesignAuxiliarFrame);
1297
1298 // declare combo box
1299 FXHorizontalFrame* row = new FXHorizontalFrame(myVerticalFrameRows, GUIDesignAuxiliarHorizontalFrame);
1300 new FXLabel(row, "Algorithm", nullptr, GUIDesignLabelThickedFixed(150));
1303 // fill combo Box with all Car following models
1304 std::vector<std::string> CFModels = SUMOXMLDefinitions::CarFollowModels.getStrings();
1305 for (const auto& CFModel : CFModels) {
1306 myComboBoxCarFollowModel->appendIconItem(CFModel.c_str(), nullptr);
1307 }
1308
1309 // 01 create FX and Label for Accel
1311 myRows.push_back(myAccelRow);
1312
1313 // 02 create FX and Label for Decel
1315 myRows.push_back(myDecelRow);
1316
1317 // 03 create FX and Label for Apparent decel
1319 myRows.push_back(myApparentDecelRow);
1320
1321 // 04 create FX and Label for emergency decel
1323 myRows.push_back(myEmergencyDecelRow);
1324
1325 // 05 create FX and Label for Sigma
1327 myRows.push_back(mySigmaRow);
1328
1329 // 06 create FX and Label for Tau
1331 myRows.push_back(myTauRow);
1332
1333 // 07 myMinGapFactor FX and Label for MinGapFactor
1335 myRows.push_back(myMinGapFactorRow);
1336
1337 // 08 create FX and Label for K
1339 myRows.push_back(myKRow);
1340
1341 // 09 create FX and Label for PHI
1343 myRows.push_back(myPhiRow);
1344
1345 // 10 create FX and Label for Deleta
1347 myRows.push_back(myDeltaRow);
1348
1349 // 11 create FX and Label for Stepping
1351 myRows.push_back(mySteppingRow);
1352
1353 // 12 create FX and Label for Security
1355 myRows.push_back(mySecurityRow);
1356
1357 // 13 create FX and Label for Estimation
1359 myRows.push_back(myEstimationRow);
1360
1361 // 14 create FX and Label for TMP1
1363 myRows.push_back(myTmp1Row);
1364
1365 // 15 create FX and Label for TMP2
1367 myRows.push_back(myTmp2Row);
1368
1369 // 16 create FX and Label for TMP3
1371 myRows.push_back(myTmp3Row);
1372
1373 // 17 create FX and Label for TMP4
1375 myRows.push_back(myTmp4Row);
1376
1377 // 18 create FX and Label for TMP5
1379 myRows.push_back(myTmp5Row);
1380
1381 // 19 create FX and Label for trainType (allow strings)
1383 myRows.push_back(myTrainTypeRow);
1384
1385 // 20 create FX and Label for Tau Last
1387 myRows.push_back(myTrauLastRow);
1388
1389 // 21 create FX and Label for Aprob
1391 myRows.push_back(myAprobRow);
1392
1393 // 22 create FX and Label for Adapt Factor
1395 myRows.push_back(myAdaptFactorRow);
1396
1397 // 23 create FX and Label for Adapt Time
1399 myRows.push_back(myAdaptTimeRow);
1400
1401 // 24 create FX and Label for W99 CC 01
1403 myRows.push_back(myW99CC1);
1404
1405 // 25 create FX and Label for W99 CC 02
1407 myRows.push_back(myW99CC2);
1408
1409 // 26 create FX and Label for W99 CC 03
1411 myRows.push_back(myW99CC3);
1412
1413 // 27 create FX and Label for W99 CC 04
1415 myRows.push_back(myW99CC4);
1416
1417 // 28 create FX and Label for W99 CC 05
1419 myRows.push_back(myW99CC5);
1420
1421 // 29 create FX and Label for W99 CC 06
1423 myRows.push_back(myW99CC6);
1424
1425 // 30 create FX and Label for W99 CC 07
1427 myRows.push_back(myW99CC7);
1428
1429 // 31 create FX and Label for W99 CC 08
1431 myRows.push_back(myW99CC8);
1432
1433 // 32 create FX and Label for W99 CC 09
1435 myRows.push_back(myW99CC9);
1436
1437 // X1 create FX and Label for Look ahead/preview Time
1439 myRows.push_back(myTpreviewRow);
1440
1441 // X2 create FX and Label for Reaction Time
1443 myRows.push_back(myTreactionRow);
1444
1445 // X3 create FX and Label for Wiener Process Driving Error
1447 myRows.push_back(myTPersDriveRow);
1448
1449 // X4 create FX and Label for Wiener Process Estimation Error
1451 myRows.push_back(myTPersEstimateRow);
1452
1453 // X5 create FX and Label for Coolness parameter
1455 myRows.push_back(myCcoolnessRow);
1456
1457 // X6 create FX and Label for leader speed estimation error
1459 myRows.push_back(mySigmaleaderRow);
1460
1461 // X7 create FX and Label for Gap estimation error
1463 myRows.push_back(mySigmagapRow);
1464
1465 // X8 create FX and Label for Driving Error
1467 myRows.push_back(mySigmaerrorRow);
1468
1469 // X9 create FX and Label for max jerk
1471 myRows.push_back(myJerkmaxRow);
1472
1473 // X10 create FX and Label for AP Driver Update threshold
1475 myRows.push_back(myEpsilonaccRow);
1476
1477 // X11 create FX and Label for Startup Time to acc_max
1479 myRows.push_back(myTaccmaxRow);
1480
1481 // X12 create FX and Label for Startup M flatness
1483 myRows.push_back(myMflatnessRow);
1484
1485 // X13 create FX and Label for Startup M begin
1487 myRows.push_back(myMbeginRow);
1488
1489 // X14 create FX and Label for using vehicle dynamics
1491 myRows.push_back(myUseVehDynamicsRow);
1492
1493 // X14 create FX and Label for using vehicle dynamics
1495 myRows.push_back(myMaxVehPreviewRow);
1496
1497 // create myLabelIncompleteAttribute
1498 myLabelIncompleteAttribute = new FXLabel(myVerticalFrameRows, "Some attributes wasn't\nimplemented yet", nullptr, GUIDesignLabelAboutInfoCenter);
1500
1501 // show or hide ComboBox depending of current selected CFM
1503}
1504
1505
1506void
1508 // start hiding all rows
1509 for (const auto& row : myRows) {
1510 row->hide();
1511 }
1512 // hide myLabelIncompleteAttribute
1513 myLabelIncompleteAttribute->hide();
1514 // show textfield depending of current CFM
1515 if (SUMOXMLDefinitions::CarFollowModels.hasString(myComboBoxCarFollowModel->getText().text())) {
1516 // show textfield depending of selected CFM
1517 switch (SUMOXMLDefinitions::CarFollowModels.get(myComboBoxCarFollowModel->getText().text())) {
1518 case SUMO_TAG_CF_KRAUSS:
1521 myTauRow->show();
1522 myAccelRow->show();
1523 myDecelRow->show();
1524 myApparentDecelRow->show();
1525 myEmergencyDecelRow->show();
1526 mySigmaRow->show();
1527 break;
1529 myTauRow->show();
1530 myTmp1Row->show();
1531 myTmp2Row->show();
1532 myTmp3Row->show();
1533 myTmp4Row->show();
1534 myTmp5Row->show();
1535 break;
1538 myTauRow->show();
1539 myAccelRow->show();
1540 myDecelRow->show();
1541 myEmergencyDecelRow->show();
1542 mySigmaRow->show();
1543 myMinGapFactorRow->show();
1544 myTmp1Row->show();
1545 myTmp2Row->show();
1546 myTmp3Row->show();
1547 myTmp4Row->show();
1548 myTmp5Row->show();
1549 break;
1551 myTauRow->show();
1552 myAccelRow->show();
1553 myDecelRow->show();
1554 myEmergencyDecelRow->show();
1555 mySigmaRow->show();
1556 myMinGapFactorRow->show();
1557 myTrauLastRow->show();
1558 myAprobRow->show();
1559 break;
1560 case SUMO_TAG_CF_IDM:
1561 myTauRow->show();
1562 myAccelRow->show();
1563 myDecelRow->show();
1564 myEmergencyDecelRow->show();
1565 myDeltaRow->show();
1566 mySteppingRow->show();
1567 myMinGapFactorRow->show();
1568 break;
1569 case SUMO_TAG_CF_IDMM:
1570 myTauRow->show();
1571 myAccelRow->show();
1572 myDecelRow->show();
1573 myEmergencyDecelRow->show();
1574 myDeltaRow->show();
1575 mySteppingRow->show();
1576 myMinGapFactorRow->show();
1577 myAdaptFactorRow->show();
1578 myAdaptTimeRow->show();
1579 break;
1580 case SUMO_TAG_CF_EIDM:
1581 myTauRow->show();
1582 myAccelRow->show();
1583 myDecelRow->show();
1584 myEmergencyDecelRow->show();
1585 myDeltaRow->show();
1586 mySteppingRow->show();
1587 myMinGapFactorRow->show();
1588 myTpreviewRow->show();
1589 myTreactionRow->show();
1590 myTPersDriveRow->show();
1591 myTPersEstimateRow->show();
1592 myCcoolnessRow->show();
1593 mySigmaleaderRow->show();
1594 mySigmagapRow->show();
1595 mySigmaerrorRow->show();
1596 myJerkmaxRow->show();
1597 myEpsilonaccRow->show();
1598 myTaccmaxRow->show();
1599 myMflatnessRow->show();
1600 myMbeginRow->show();
1601 myUseVehDynamicsRow->show();
1602 myMaxVehPreviewRow->show();
1603 break;
1605 myTauRow->show();
1606 myAccelRow->show();
1607 myDecelRow->show();
1608 myEmergencyDecelRow->show();
1609 myKRow->show();
1610 myPhiRow->show();
1611 myMinGapFactorRow->show();
1612 break;
1614 myTauRow->show();
1615 myAccelRow->show();
1616 myDecelRow->show();
1617 myEmergencyDecelRow->show();
1618 myMinGapFactorRow->show();
1619 mySecurityRow->show();
1620 myEstimationRow->show();
1621 break;
1622 case SUMO_TAG_CF_W99:
1623 myW99CC1->show();
1624 myW99CC2->show();
1625 myW99CC3->show();
1626 myW99CC4->show();
1627 myW99CC5->show();
1628 myW99CC6->show();
1629 myW99CC7->show();
1630 myW99CC8->show();
1631 myW99CC9->show();
1632 break;
1633 case SUMO_TAG_CF_RAIL:
1634 myTauRow->show();
1635 myTrainTypeRow->show();
1636 break;
1637 case SUMO_TAG_CF_ACC:
1638 myTauRow->show();
1639 myAccelRow->show();
1640 myDecelRow->show();
1641 myEmergencyDecelRow->show();
1642 myMinGapFactorRow->show();
1643 // show myLabelIncompleteAttribute
1644 myLabelIncompleteAttribute->show();
1655 break;
1656 case SUMO_TAG_CF_CACC:
1657 myTauRow->show();
1658 myAccelRow->show();
1659 myDecelRow->show();
1660 myEmergencyDecelRow->show();
1661 myMinGapFactorRow->show();
1662 // show myLabelIncompleteAttribute
1663 myLabelIncompleteAttribute->show();
1680 break;
1681 case SUMO_TAG_CF_CC:
1682 myTauRow->show();
1683 myAccelRow->show();
1684 myDecelRow->show();
1685 // show myLabelIncompleteAttribute
1686 myLabelIncompleteAttribute->show();
1708 break;
1709 default:
1710 break;
1711 }
1712 }
1713 myVerticalFrameRows->recalc();
1714 update();
1715}
1716
1717
1718void
1720 //set values of myElement into fields
1721 if (myVehicleTypeDialog->myElement->getAttribute(SUMO_ATTR_CAR_FOLLOW_MODEL).empty()) {
1722 myComboBoxCarFollowModel->setCurrentItem(0);
1723 } else {
1724 // set value
1725 const int index = myComboBoxCarFollowModel->findItem(myVehicleTypeDialog->myElement->getAttribute(SUMO_ATTR_CAR_FOLLOW_MODEL).c_str());
1726 if (index == -1) {
1727 myComboBoxCarFollowModel->disable();
1728 } else {
1729 myComboBoxCarFollowModel->setCurrentItem(index);
1730 myComboBoxCarFollowModel->enable();
1731 }
1732 }
1733 // refresh fields
1734 refreshCFMFields();
1735 // update value in all Rows
1736 for (const auto& row : myRows) {
1737 row->updateValue();
1738 }
1739}
1740
1741
1742long
1744 // At start we assumed, that all values are valid
1745 myVehicleTypeDialog->myVehicleTypeValid = true;
1746 myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_NOTHING;
1747 // set color of myTextFieldCarFollowModel, depending if current value is valid or not
1748 if (myVehicleTypeDialog->myElement->isValid(SUMO_ATTR_CAR_FOLLOW_MODEL, myComboBoxCarFollowModel->getText().text())) {
1749 myComboBoxCarFollowModel->setTextColor(GUIDesignTextColorBlack);
1750 myVehicleTypeDialog->myElement->setAttribute(SUMO_ATTR_CAR_FOLLOW_MODEL, myComboBoxCarFollowModel->getText().text(), myVehicleTypeDialog->myElement->getNet()->getViewNet()->getUndoList());
1751 } else {
1752 myComboBoxCarFollowModel->setTextColor(GUIDesignTextColorRed);
1753 myVehicleTypeDialog->myVehicleTypeValid = false;
1754 myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_CAR_FOLLOW_MODEL;
1755 }
1756 // set variable in all Rows
1757 for (const auto& row : myRows) {
1758 row->setVariable();
1759 }
1760 // refresh fields
1761 refreshCFMFields();
1762 return true;
1763}
1764
1765// ---------------------------------------------------------------------------
1766// GNEVehicleTypeDialog - public methods
1767// ---------------------------------------------------------------------------
1768
1771 myVehicleTypeValid(true),
1773 // Create auxiliar frames for values
1774 FXHorizontalFrame* columns = new FXHorizontalFrame(myContentFrame, GUIDesignAuxiliarHorizontalFrame);
1775 // create vehicle type attributes
1776 myVTypeAttributes = new VTypeAttributes(this, columns);
1777 // create car following model parameters
1779 // update values of Vehicle Type common attributes
1781 // update values of Car Following Model Parameters
1783 // open dialog
1784 openDialog();
1785}
1786
1787
1789
1790
1791void
1793 // nothing to do
1794}
1795
1796
1797long
1798GNEVehicleTypeDialog::onCmdAccept(FXObject*, FXSelector, void*) {
1799 if (!myVehicleTypeValid) {
1800 // show warning dialogbox about experimental state (only once)
1802 TLF("Error editing %", myElement->getTagStr()),
1803 TLF("The % cannot be updated because attribute % is invalid.",
1805 return 1;
1806 } else {
1807 // close dialog accepting changes
1808 return acceptElementDialog();
1809 }
1810}
1811
1812
1813long
1814GNEVehicleTypeDialog::onCmdReset(FXObject*, FXSelector, void*) {
1815 // reset changes
1816 resetChanges();
1817 // update values of Vehicle Type common attributes
1819 // update values of Car Following Model Parameters
1821 return 1;
1822}
1823
1824// ---------------------------------------------------------------------------
1825// GNEVehicleTypeDialog - private methods
1826// ---------------------------------------------------------------------------
1827
1829 FXVerticalFrame* verticalFrame, SumoXMLAttr attr) :
1830 FXHorizontalFrame(verticalFrame, GUIDesignAuxiliarHorizontalFrame),
1831 myCarFollowingModelParametersParent(carFollowingModelParametersParent),
1832 myAttr(attr),
1833 myTextField(nullptr) {
1834 new FXLabel(this, toString(attr).c_str(), nullptr, GUIDesignLabelThickedFixed(150));
1835 myTextField = new FXTextField(this, GUIDesignTextFieldNCol, carFollowingModelParametersParent, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFieldFixed(180));
1836}
1837
1838
1839void
1841 // set color of textField, depending if current value is valid or not
1842 if (myCarFollowingModelParametersParent->myVehicleTypeDialog->myElement->isValid(myAttr, myTextField->getText().text())) {
1843 // set color depending if is a default value
1844 if (myCarFollowingModelParametersParent->myVehicleTypeDialog->myElement->getTagProperty()->getDefaultStringValue(myAttr) != myTextField->getText().text()) {
1845 myTextField->setTextColor(GUIDesignTextColorBlack);
1846 } else {
1847 myTextField->setTextColor(FXRGB(195, 195, 195));
1848 }
1849 myCarFollowingModelParametersParent->myVehicleTypeDialog->myElement->setAttribute(myAttr, myTextField->getText().text(),
1850 myCarFollowingModelParametersParent->myVehicleTypeDialog->myElement->getNet()->getViewNet()->getUndoList());
1851 // update value after setting it
1852 updateValue();
1853 } else {
1854 myTextField->setTextColor(GUIDesignTextColorRed);
1855 // mark VType as invalid
1856 myCarFollowingModelParametersParent->myVehicleTypeDialog->myVehicleTypeValid = false;
1857 myCarFollowingModelParametersParent->myVehicleTypeDialog->myInvalidAttr = myAttr;
1858 }
1859}
1860
1861
1862void
1864 // set text of myTextField using current value of VType
1865 myTextField->setText(myCarFollowingModelParametersParent->myVehicleTypeDialog->myElement->getAttribute(myAttr).c_str());
1866 // set color depending if is a default value
1867 if (myCarFollowingModelParametersParent->myVehicleTypeDialog->myElement->getTagProperty()->getDefaultStringValue(myAttr) != myTextField->getText().text()) {
1868 myTextField->setTextColor(GUIDesignTextColorBlack);
1869 } else {
1870 myTextField->setTextColor(FXRGB(195, 195, 195));
1871 }
1872}
1873
1874
1875/****************************************************************************/
DialogType
FXDEFMAP(GNEVehicleTypeDialog::VTypeAttributes) VTypeAttributesMap[]
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition GUIAppEnum.h:993
@ MID_GNE_ATTRIBUTESEDITOR_PARAMETERS
open generic parameters editor
@ MID_GNE_SET_ATTRIBUTE_DIALOG
attribute edited trough dialog
#define GUIDesignTextFieldFixed(width)
text field with fixed width
Definition GUIDesigns.h:80
#define GUIDesignTextColorRed
red color (for invalid text)
Definition GUIDesigns.h:44
#define GUIDesignComboBox
Definition GUIDesigns.h:295
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition GUIDesigns.h:430
#define GUIDesignLabelTickedIcon180x46
label ticked filled extended over frame used for VClasses/VShapes. (can be used by icons of 64x32 pix...
Definition GUIDesigns.h:278
#define GUIDesignLabelAboutInfoCenter
label extended over frame with thick and with text justify to center
Definition GUIDesigns.h:266
#define GUIDesignComboBoxFixed(customWidth)
comboBox with thick frame, fixed width
Definition GUIDesigns.h:307
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition GUIDesigns.h:92
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
Definition GUIDesigns.h:365
#define GUIDesignAuxiliarVerticalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition GUIDesigns.h:439
#define GUIDesignComboBoxVisibleItems
Definition GUIDesigns.h:64
#define GUIDesignTextColorBlack
black color (for correct text)
Definition GUIDesigns.h:38
#define GUIDesignButtonFixed(width)
button rectangular with thick and raise frame with the given width
Definition GUIDesigns.h:115
#define GUIDesignAuxiliarFrame
design for auxiliar (Without borders) frame extended in all directions
Definition GUIDesigns.h:409
#define GUIDesignLabelThickedFixed(width)
label thicked, icon before text, text centered and custom width
Definition GUIDesigns.h:254
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
@ VCLASS_AIRCRAFT
@ VSHAPE_PASSENGER_VAN
@ VSHAPE_PASSENGER_WAGON
@ VSHAPE_MOPED
@ VCLASS_CUSTOM2
@ VSHAPE_RAIL_CAR
@ VCLASS_MOTORCYCLE
@ VCLASS_COACH
@ VCLASS_AUTHORITY
@ VCLASS_SCOOTER
@ VCLASS_TRUCK
@ VCLASS_MOPED
@ VSHAPE_E_VEHICLE
@ VCLASS_PEDESTRIAN
@ VCLASS_PRIVATE
@ VSHAPE_PASSENGER_HATCHBACK
@ VSHAPE_TRUCK_1TRAILER
@ VCLASS_CABLE_CAR
@ VSHAPE_POLICE
@ VSHAPE_RAIL_CARGO
@ VCLASS_SUBWAY
@ VSHAPE_BICYCLE
@ VSHAPE_AIRCRAFT
@ VCLASS_CONTAINER
@ VCLASS_CUSTOM1
@ VSHAPE_BUS_TROLLEY
@ VSHAPE_DELIVERY
@ VSHAPE_PASSENGER_SEDAN
@ VSHAPE_BUS_FLEXIBLE
@ VCLASS_DELIVERY
@ VSHAPE_RICKSHAW
@ VSHAPE_MOTORCYCLE
@ VCLASS_DRONE
@ VCLASS_RAIL_ELECTRIC
@ VCLASS_IGNORING
@ VSHAPE_TRUCK
@ VCLASS_WHEELCHAIR
@ VCLASS_EMERGENCY
@ VSHAPE_BUS_COACH
@ VCLASS_RAIL_URBAN
@ VSHAPE_TRUCK_SEMITRAILER
@ VCLASS_EVEHICLE
@ VSHAPE_SCOOTER
#define TL(string)
Definition MsgHandler.h:304
#define TLF(string,...)
Definition MsgHandler.h:306
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)
@ 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
@ AIRCRAFT
render as aircraft
@ 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
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_WHEELCHAIR
@ SVC_RAIL
vehicle is a not electrified rail
@ SVC_COACH
vehicle is a coach
@ SVC_CABLE_CAR
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_CONTAINER
@ SVC_SCOOTER
@ 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_DRONE
@ 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_AIRCRAFT
@ SVC_SUBWAY
@ SVC_PEDESTRIAN
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_W99
@ 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_W99_CC9
@ SUMO_ATTR_CF_EIDM_T_ACC_MAX
@ SUMO_ATTR_CF_EIDM_EPSILON_ACC
@ SUMO_ATTR_CF_W99_CC5
@ 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_CF_W99_CC8
@ 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_CF_W99_CC3
@ SUMO_ATTR_LCA_OVERTAKE_DELTASPEED_FACTOR
@ SUMO_ATTR_HEIGHT
@ SUMO_ATTR_LCA_SUBLANE_PARAM
@ SUMO_ATTR_JM_CROSSING_GAP
@ 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_CF_W99_CC2
@ SUMO_ATTR_CF_W99_CC4
@ SUMO_ATTR_JM_SIGMA_MINOR
@ SUMO_ATTR_CF_W99_CC6
@ 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_CF_W99_CC7
@ SUMO_ATTR_LCA_STRATEGIC_PARAM
@ SUMO_ATTR_CF_W99_CC1
@ SUMO_ATTR_TAU
@ SUMO_ATTR_IMGFILE
@ SUMO_ATTR_WIDTH
@ SUMO_ATTR_PERSON_CAPACITY
@ SUMO_ATTR_LCA_KEEPRIGHT_ACCEPTANCE_TIME
@ SUMO_ATTR_TMP5
@ SUMO_ATTR_NOTHING
invalid attribute, must be the last one
@ SUMO_ATTR_JM_DRIVE_RED_SPEED
@ SUMO_ATTR_LCA_TIME_TO_IMPATIENCE
@ SUMO_ATTR_JM_TIMEGAP_MINOR
@ SUMO_ATTR_CF_WIEDEMANN_ESTIMATION
@ SUMO_ATTR_LCA_SPEEDGAINRIGHT
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
double getParameter(const int index) const
Returns the nth parameter of this distribution.
virtual bool isAttributeEnabled(SumoXMLAttr key) const
const std::string & getTagStr() const
get tag assigned to this object in string format
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
GNENet * getNet() const
get pointer to net
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
virtual std::string getAttribute(SumoXMLAttr key) const =0
virtual SUMOVehicleClass getVClass() const =0
obtain VClass related with this demand element
FXVerticalFrame * myContentFrame
content frame
Definition GNEDialog.h:152
GNEApplicationWindow * getApplicationWindow() const
get pointer to the application window
void openDialog(FXWindow *focusableElement=nullptr)
open dialog
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2193
T * myElement
pointer to edited element
void resetChanges()
reset changes did in this dialog.
long acceptElementDialog()
close dialog commiting changes
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 * myW99CC1
Row for W99 CC 01.
CarFollowingModelRow * myTpreviewRow
Row for Look ahead/preview Time.
CarFollowingModelRow * myW99CC8
Row for W99 CC 08.
CarFollowingModelRow * myW99CC6
Row for W99 CC 06.
CarFollowingModelRow * mySteppingRow
Row for MinGap(only for IDM)
CarFollowingModelRow * myMflatnessRow
Row for Startup M flatness.
CarFollowingModelRow * myW99CC3
Row for W99 CC 03.
CarFollowingModelRow * myW99CC2
Row for W99 CC 02.
CarFollowingModelRow * myTreactionRow
Row for Reaction Time.
FXLabel * myLabelIncompleteAttribute
temporal label for incomplete attributes
CarFollowingModelRow * myCcoolnessRow
Row for Coolness parameter.
GNEVehicleTypeDialog * myVehicleTypeDialog
pointer to Vehicle Type dialog parent
CarFollowingModelRow * mySigmagapRow
Row for Gap estimation error.
CarFollowingModelRow * mySecurityRow
Row for Security (only for Wiedemann)
CarFollowingModelRow * myW99CC7
Row for W99 CC 07.
CarFollowingModelRow * myW99CC5
Row for W99 CC 05.
CarFollowingModelRow * myAccelRow
Row for Accel.
CarFollowingModelRow * myEpsilonaccRow
Row for AP Driver Update threshold.
CarFollowingModelRow * myAprobRow
Row for Aprob.
CarFollowingModelRow * myW99CC9
Row for W99 CC 09.
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.
MFXComboBoxIcon * myComboBoxCarFollowModel
Row for CarFollowModel.
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.
CarFollowingModelRow * myW99CC4
Row for W99 CC 04.
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.
CarFollowingModelRow * myMinGapFactorRow
Row for MinGapFactor.
VTypeAttributes * myVTypeAttributesParent
pointer to VTypeAttributes parent
MFXComboBoxIcon * myComboBoxVClass
MFXComboBoxIcon for VClass.
VTypeAttributes * myVTypeAttributesParent
pointer to VTypeAttributes parent
MFXComboBoxIcon * myComboBoxShape
MFXComboBoxIcon for Shape.
FXLabel * myComboBoxShapeLabelImage
label with image of Shape
VShapeRow(VTypeAttributes *VTypeAttributesParent, FXVerticalFrame *column)
constructor
void updateValue(SUMOVehicleClass vClass)
update value
class used for represent rows with Vehicle Type parameters
VTypeAttributeRow(VTypeAttributes *VTypeAttributesParent, FXVerticalFrame *verticalFrame, const SumoXMLAttr attr, const RowAttrType rowAttrType, const std::vector< std::string > &values={})
constructor
MFXComboBoxIcon * 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 setVariable()
set Variable in VehicleType (using default value obtained from GNEAttributeCarrier)
std::vector< std::pair< std::string, std::string > > getParametersVectorStr() const
get parameters as vector of strings
VTypeAttributes * myVTypeAttributesParent
pointer to VTypeAttributeParameters parent
void setParameters(const std::vector< std::pair< std::string, std::string > > &parameters)
set parameters
std::string filterAttributeName(const SumoXMLAttr attr) const
filter attribute name
GNEVehicleTypeDialog * myVehicleTypeDialog
VTypeAttributeRow for experimental.
VTypeAttributeRow * myHeight
VTypeAttributeRow for Height.
VTypeAttributeRow * myContainerCapacity
VTypeAttributeRow for ContainerCapacity.
VTypeAttributeRow * myMaxSpeed
VTypeAttributeRow for MaxSpeed.
void buildAttributesA(FXVerticalFrame *column)
build common attributes (A)
VTypeAttributeRow * myMinGap
VTypeAttributeRow for MinGap.
VTypeAttributeRow * myOSGFile
VTypeAttributeRow for OSG.
VTypeAttributeRow * myParameters
VTypeAttributeRow for parameters.
void buildJunctionModelAttributesA(FXVerticalFrame *column)
build JunctionModel attributes (A)
VTypeAttributeRow * myEmissionClass
VTypeAttributeRow for EmissionClass.
VTypeAttributeRow * mySpeedFactor
VTypeAttributeRow for SpeedFactor.
long onCmdOpenAttributeDialog(FXObject *obj, FXSelector, void *)
@event called after press a button dialog
void buildJunctionModelAttributesB(FXVerticalFrame *column)
build JunctionModel attributes (B)
void buildAttributesB(FXVerticalFrame *column)
build common attributes (B)
long onCmdSetAttribute(FXObject *, FXSelector, void *)
VTypeAttributeRow * myWidth
VTypeAttributeRow for Width.
VTypeAttributeRow * myPersonCapacity
VTypeAttributeRow for PersonCapacity.
void buildLaneChangeModelAttributes(FXVerticalFrame *column)
build LaneChangeModel attributes
VTypeAttributeRow * myDesiredMaxSpeed
VTypeAttributeRow for desired max speed.
long onCmdOpenParametersEditor(FXObject *obj, FXSelector, void *)
@event called after press a button dialog
VTypeAttributes(GNEVehicleTypeDialog *vehicleTypeDialog, FXHorizontalFrame *column)
constructor
VTypeAttributeRow * myLength
VTypeAttributeRow for Length.
void runInternalTest(const InternalTestStep::DialogArgument *dialogArgument)
run internal test
SumoXMLAttr myInvalidAttr
current sumo attribute invalid
bool myVehicleTypeValid
flag to check if current vehicleType is valid
VTypeAttributes * myVTypeAttributes
Vehicle Type Common Attributes.
long onCmdReset(FXObject *, FXSelector, void *)
event after press reset button
CarFollowingModelParameters * myCarFollowingModelParameters
Car Following model parameters.
long onCmdAccept(FXObject *, FXSelector, void *)
event after press accept button
GNEVehicleTypeDialog(GNEDemandElement *vehicleType)
constructor
GNEViewParent * getViewParent() const
get the net object
GNEUndoList * getUndoList() const
get the undoList object
GNEApplicationWindow * getGNEAppWindows() const
get GNE Application Windows
static FXLabel * buildFXLabel(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXuint opts, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
Construct label with given text and icon.
static FXButton * buildFXButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXObject *tgt, FXSelector sel, FXuint opts=BUTTON_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
build button
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
MFXStaticToolTip * getStaticTooltipMenu() const
get static toolTip for menus
dialog arguments, used for certain modal dialogs that can not be edited using tab
FXString getText() const
Get the text.
void setTextColor(FXColor clr)
Change text color.
FXint appendIconItem(const FXString &text, FXIcon *icon=nullptr, FXColor bgColor=FXRGB(255, 255, 255), void *ptr=nullptr)
append icon item in the last position
static const std::vector< std::string > & getAllClassesStr()
Get all SUMOEmissionClass in string format.
static const RGBColor BLACK
Definition RGBColor.h:196
static std::vector< std::string > getLatAlignmentStrings()
return all valid strings for latAlignment
static StringBijection< SumoXMLTag > CarFollowModels
car following models
static StringBijection< OSGFileExtension > OSGFileExtensions
OSG file Extensions.
static StringBijection< ImageFileExtension > ImageFileExtensions
image file extensions
static StringBijection< LaneChangeModel > LaneChangeModels
lane change models
std::vector< std::string > getStrings() const
get all strings
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
static FXIcon * getVClassIcon(const SUMOVehicleClass vc)
returns icon associated to the given vClass
struct for default values that depend of VClass
int personCapacity
The person capacity of the vehicle.
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