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
23#include <netedit/GNENet.h>
25#include <netedit/GNEUndoList.h>
26#include <netedit/GNEViewNet.h>
36
38
39// ===========================================================================
40// FOX callback mapping
41// ===========================================================================
42
48
52
53// Object implementation
54FXIMPLEMENT(GNEVehicleTypeDialog::VTypeAttributes, FXVerticalFrame, VTypeAttributesMap, ARRAYNUMBER(VTypeAttributesMap))
55FXIMPLEMENT(GNEVehicleTypeDialog::CarFollowingModelParameters, FXGroupBox, CarFollowingModelParametersMap, ARRAYNUMBER(CarFollowingModelParametersMap))
56
57// ===========================================================================
58// member method definitions
59// ===========================================================================
60
61// ---------------------------------------------------------------------------
62// GNEVehicleTypeDialog::VClassRow - methods
63// ---------------------------------------------------------------------------
64
65GNEVehicleTypeDialog::VTypeAttributes::VClassRow::VClassRow(VTypeAttributes* VTypeAttributesParent, FXVerticalFrame* column) :
66 FXHorizontalFrame(column, GUIDesignAuxiliarHorizontalFrame),
67 myVTypeAttributesParent(VTypeAttributesParent) {
68 // create two auxiliary frames
69 FXVerticalFrame* verticalFrameLabelAndComboBox = new FXVerticalFrame(this, GUIDesignAuxiliarVerticalFrame);
70 // create MFXComboBoxIcon for VClass
71 new FXLabel(verticalFrameLabelAndComboBox, toString(SUMO_ATTR_VCLASS).c_str(), nullptr, GUIDesignLabelThickedFixed(150));
72 myComboBoxVClass = new MFXComboBoxIcon(verticalFrameLabelAndComboBox, GUIDesignComboBoxNCol, true, GUIDesignComboBoxVisibleItems,
73 VTypeAttributesParent, MID_GNE_SET_ATTRIBUTE, GUIDesignComboBox);
74 myComboBoxVClassLabelImage = new FXLabel(this, "", nullptr, GUIDesignLabelTickedIcon180x46);
75 myComboBoxVClassLabelImage->setBackColor(FXRGBA(255, 255, 255, 255));
76 // fill combo Box with all allowed VClass for the current edited VType
77 for (const auto& vClass : myVTypeAttributesParent->myVehicleTypeDialog->getEditedDemandElement()->getTagProperty()->getAttributeProperties(SUMO_ATTR_VCLASS)->getDiscreteValues()) {
78 myComboBoxVClass->appendIconItem(vClass.c_str(), VClassIcons::getVClassIcon(SumoVehicleClassStrings.get(vClass)));
79 }
80}
81
82
85 // set color of myComboBoxVClass, depending if current value is valid or not
86 myComboBoxVClass->setTextColor(FXRGB(0, 0, 0));
88 myComboBoxVClass->setTextColor(FXRGB(0, 0, 0));
89 // check if VType has to be updated
91 // update VClass in VType
94 // update label image
96 // obtain default vType parameters
98 // check if mutable rows need to be updated
101 }
104 }
107 }
110 }
113 }
116 }
118 myVTypeAttributesParent->myWidth->updateValue(toString(defaultVTypeParameters.width));
119 }
122 }
125 }
128 }
131 }
132 /*
133 Waiting for #16343
134 if (!myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->isAttributeEnabled(SUMO_ATTR_CARRIAGE_LENGTH)) {
135 myVTypeAttributesParent->myCarriageLength->updateValue(toString(defaultVTypeParameters.containerCapacity));
136 }
137 if (!myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->isAttributeEnabled(SUMO_ATTR_LOCOMOTIVE_LENGTH)) {
138 myVTypeAttributesParent->myLocomotiveLength->updateValue(toString(defaultVTypeParameters.locomotiveLength));
139 }
140 // update GUIShape
141 if (SumoVehicleClassStrings.hasString(myComboBoxVClass->getText().text())) {
142 myVTypeAttributesParent->myVShapeRow->updateValue(SumoVehicleClassStrings.get(myComboBoxVClass->getText().text()));
143 }
144 */
145 }
146 } else {
147 myComboBoxVClass->setTextColor(FXRGB(255, 0, 0));
150 }
152}
153
154
157 const auto vClass = myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_VCLASS);
158 int index = 0;
159 for (int i = 0; i < myComboBoxVClass->getNumItems(); i++) {
160 if (myComboBoxVClass->getItemText(i) == vClass) {
161 index = i;
162 }
163 }
164 myComboBoxVClass->setCurrentItem(index);
165 setVClassLabelImage();
166 return myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getVClass();
167}
168
169
170void
172 // by default vClass is passenger
173 if (myVTypeAttributesParent->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 (myVTypeAttributesParent->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_CONTAINER:
251 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_CONTAINER));
252 break;
253 case SVC_CABLE_CAR:
254 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_CABLE_CAR));
255 break;
256 case SVC_SUBWAY:
257 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_SUBWAY));
258 break;
259 case SVC_AIRCRAFT:
260 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_AIRCRAFT));
261 break;
262 case SVC_WHEELCHAIR:
263 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_WHEELCHAIR));
264 break;
265 case SVC_SCOOTER:
266 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_SCOOTER));
267 break;
268 case SVC_DRONE:
269 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_DRONE));
270 break;
271 case SVC_CUSTOM1:
272 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_CUSTOM1));
273 break;
274 case SVC_CUSTOM2:
275 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_CUSTOM2));
276 break;
277 default:
278 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_IGNORING));
279 break;
280 }
281 }
282}
283
284// ---------------------------------------------------------------------------
285// GNEVehicleTypeDialog::VShapeRow - methods
286// ---------------------------------------------------------------------------
287
288GNEVehicleTypeDialog::VTypeAttributes::VShapeRow::VShapeRow(VTypeAttributes* VTypeAttributesParent, FXVerticalFrame* column) :
289 FXHorizontalFrame(column, GUIDesignAuxiliarHorizontalFrame),
290 myVTypeAttributesParent(VTypeAttributesParent) {
291 // create two auxiliar frames
292 FXVerticalFrame* verticalFrameLabelAndComboBox = new FXVerticalFrame(this, GUIDesignAuxiliarVerticalFrame);
293 // create combo for vehicle shapes
294 new FXLabel(verticalFrameLabelAndComboBox, toString(SUMO_ATTR_GUISHAPE).c_str(), nullptr, GUIDesignLabelThickedFixed(150));
296 VTypeAttributesParent, MID_GNE_SET_ATTRIBUTE, GUIDesignComboBox);
297 myComboBoxShapeLabelImage = new FXLabel(this, "", nullptr, GUIDesignLabelTickedIcon180x46);
298 myComboBoxShapeLabelImage->setBackColor(FXRGBA(255, 255, 255, 255));
299 // fill combo Box with all vehicle shapes
300 std::vector<std::string> VShapeStrings = SumoVehicleShapeStrings.getStrings();
301 myComboBoxShape->appendIconItem("default", nullptr);
302 for (const auto& VShapeString : VShapeStrings) {
303 if (VShapeString != SumoVehicleShapeStrings.getString(SUMOVehicleShape::UNKNOWN)) {
304 myComboBoxShape->appendIconItem(VShapeString.c_str(), nullptr);
305 }
306 }
307}
308
309
310void
312 // set color of myComboBoxShape, depending if current value is valid or not
313 if (myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(SUMO_ATTR_GUISHAPE, myComboBoxShape->getText().text())) {
314 myComboBoxShape->setTextColor(FXRGB(0, 0, 0));
315 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(SUMO_ATTR_GUISHAPE, myComboBoxShape->getText().text(),
316 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
317 setVShapeLabelImage();
318 } else {
319 myComboBoxShape->setTextColor(FXRGB(255, 0, 0));
320 myVTypeAttributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
321 myVTypeAttributesParent->myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_GUISHAPE;
322 }
323}
324
325
326void
328 // set value
329 const int index = myComboBoxShape->findItem(myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_GUISHAPE).c_str());
330 if (index == -1) {
331 myComboBoxShape->setCurrentItem(0);
332 } else {
333 myComboBoxShape->setCurrentItem(index);
334 }
335 setVShapeLabelImage();
336}
337
338
339void
341 // create new VClassDefaultValues using the new VClass
343 // set value
344 const int index = myComboBoxShape->findItem(SumoVehicleShapeStrings.getString(newVClass.shape).c_str());
345 if (index == -1) {
346 myComboBoxShape->setCurrentItem(0);
347 } else {
348 myComboBoxShape->setCurrentItem(index);
349 }
350 myComboBoxShape->setTextColor(FXRGB(0, 0, 0));
351 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(SUMO_ATTR_GUISHAPE, myComboBoxShape->getText().text(),
352 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
353 setVShapeLabelImage();
354}
355
356
357void
359 // set Icon in label depending of current VClass
360 switch (getVehicleShapeID(myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_GUISHAPE))) {
362 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_UNKNOWN));
363 break;
365 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PEDESTRIAN));
366 break;
368 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_BICYCLE));
369 break;
371 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_MOPED));
372 break;
374 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_MOTORCYCLE));
375 break;
377 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PASSENGER));
378 break;
380 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PASSENGER_SEDAN));
381 break;
383 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PASSENGER_HATCHBACK));
384 break;
386 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PASSENGER_WAGON));
387 break;
389 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PASSENGER_VAN));
390 break;
392 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_TAXI));
393 break;
395 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_DELIVERY));
396 break;
398 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_TRUCK));
399 break;
401 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_TRUCK_SEMITRAILER));
402 break;
404 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_TRUCK_1TRAILER));
405 break;
407 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_BUS));
408 break;
410 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_BUS_COACH));
411 break;
413 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_BUS_FLEXIBLE));
414 break;
416 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_BUS_TROLLEY));
417 break;
419 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_RAIL));
420 break;
422 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_RAIL_CAR));
423 break;
425 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_RAIL_CARGO));
426 break;
428 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_E_VEHICLE));
429 break;
431 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_ANT));
432 break;
434 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_SHIP));
435 break;
437 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_EMERGENCY));
438 break;
440 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_FIREBRIGADE));
441 break;
443 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_POLICE));
444 break;
446 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_RICKSHAW));
447 break;
449 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_SCOOTER));
450 break;
452 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_AIRCRAFT));
453 break;
454 default:
455 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_IGNORING));
456 break;
457 }
458}
459
460// ---------------------------------------------------------------------------
461// GNEVehicleTypeDialog::VTypeAttributes - methods
462// ---------------------------------------------------------------------------
463
464GNEVehicleTypeDialog::VTypeAttributes::VTypeAttributeRow::VTypeAttributeRow(VTypeAttributes* VTypeAttributesParent, FXVerticalFrame* verticalFrame, const SumoXMLAttr attr, const RowAttrType rowAttrType, const std::vector<std::string>& values) :
465 FXHorizontalFrame(verticalFrame, GUIDesignAuxiliarHorizontalFrame),
466 myVTypeAttributesParent(VTypeAttributesParent),
467 myAttr(attr),
468 myRowAttrType(rowAttrType),
469 myButton(nullptr),
470 myTextField(nullptr),
471 myComboBox(nullptr) {
472 // first check if we have to create a button or a label
473 if ((rowAttrType == ROWTYPE_COLOR) || (rowAttrType == ROWTYPE_FILENAME)) {
474 myButton = GUIDesigns::buildFXButton(this, filterAttributeName(attr), "", "", nullptr, VTypeAttributesParent, MID_GNE_SET_ATTRIBUTE_DIALOG, GUIDesignButtonFixed(150));
475 if (rowAttrType == ROWTYPE_COLOR) {
477 }
478 } else if (rowAttrType == ROWTYPE_PARAMETERS) {
479 myButton = GUIDesigns::buildFXButton(this, TL("Edit parameters"), "", "", nullptr, VTypeAttributesParent, MID_GNE_ATTRIBUTESEDITOR_PARAMETERS, GUIDesignButtonFixed(150));
480 } else {
482 }
483 // now check if we have to create a textfield or a ComboBox
484 if ((rowAttrType == ROWTYPE_STRING) || (rowAttrType == ROWTYPE_COLOR) || (rowAttrType == ROWTYPE_FILENAME) || (rowAttrType == ROWTYPE_PARAMETERS)) {
485 myTextField = new FXTextField(this, GUIDesignTextFieldNCol, VTypeAttributesParent, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFieldFixed(180));
486 } else if (rowAttrType == ROWTYPE_COMBOBOX) {
488 VTypeAttributesParent, MID_GNE_SET_ATTRIBUTE, GUIDesignComboBoxWidth180);
489 // fill combo Box with values
490 for (const auto& value : values) {
491 myComboBox->appendIconItem(value.c_str(), nullptr);
492 }
493 } else {
494 throw ProcessError(TL("Invalid row type"));
495 }
496}
497
498
499void
501 if (myRowAttrType == ROWTYPE_COMBOBOX) {
502 // set color of myComboBox, depending if current value is valid or not
503 if (myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, myComboBox->getText().text())) {
504 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, myComboBox->getText().text(),
505 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
506 // update value after setting it
507 updateValue();
508 } else {
509 myComboBox->setTextColor(FXRGB(255, 0, 0));
510 // mark VType as invalid
511 myVTypeAttributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
512 myVTypeAttributesParent->myVehicleTypeDialog->myInvalidAttr = myAttr;
513 }
514 } else if (myRowAttrType == ROWTYPE_COLOR) {
515 // set color of myTextFieldColor, depending if current value is valid or not
516 if (myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(SUMO_ATTR_COLOR, myTextField->getText().text())) {
517 // set color depending if is a default value
518 if (myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getTagProperty()->getDefaultStringValue(SUMO_ATTR_COLOR) != myTextField->getText().text()) {
519 myTextField->setTextColor(FXRGB(0, 0, 0));
520 } else {
521 myTextField->setTextColor(FXRGB(195, 195, 195));
522 }
523 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(SUMO_ATTR_COLOR, myTextField->getText().text(), myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
524 } else {
525 myTextField->setTextColor(FXRGB(255, 0, 0));
526 myVTypeAttributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
527 myVTypeAttributesParent->myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_COLOR;
528 }
529 } else {
530 // set color of textField, depending if current value is valid or not
531 if (myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, myTextField->getText().text())) {
532 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, myTextField->getText().text(),
533 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
534 // update value after setting it
535 updateValue();
536 } else {
537 myTextField->setTextColor(FXRGB(255, 0, 0));
538 // mark VType as invalid
539 myVTypeAttributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
540 myVTypeAttributesParent->myVehicleTypeDialog->myInvalidAttr = myAttr;
541 }
542 }
543}
544
545
546void
548 if (myComboBox) {
549 // set color of myComboBox, depending if current value is valid or not
550 if (myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, myComboBox->getText().text())) {
551 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, myComboBox->getText().text(),
552 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
553 // update value after setting it
554 updateValue(defaultValue);
555 } else {
556 myComboBox->setTextColor(FXRGB(255, 0, 0));
557 // mark VType as invalid
558 myVTypeAttributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
559 myVTypeAttributesParent->myVehicleTypeDialog->myInvalidAttr = myAttr;
560 }
561 } else {
562 // set color of textField, depending if current value is valid or not
563 if (myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, myTextField->getText().text())) {
564 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, myTextField->getText().text(),
565 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
566 // update value after setting it
567 updateValue(defaultValue);
568 } else {
569 myTextField->setTextColor(FXRGB(255, 0, 0));
570 // mark VType as invalid
571 myVTypeAttributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
572 myVTypeAttributesParent->myVehicleTypeDialog->myInvalidAttr = myAttr;
573 }
574 }
575}
576
577
578void
580 if (myRowAttrType == ROWTYPE_COMBOBOX) {
581 // set value
582 const int index = myComboBox->findItem(myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr).c_str());
583 if (index == -1) {
584 myComboBox->disable();
585 } else {
586 myComboBox->setCurrentItem(index);
587 myComboBox->enable();
588 }
589 // set color depending if is a default value
590 if (myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getTagProperty()->getDefaultStringValue(myAttr) != myComboBox->getText().text()) {
591 myComboBox->setTextColor(FXRGB(0, 0, 0));
592 } else {
593 myComboBox->setTextColor(FXRGB(195, 195, 195));
594 }
595 } else if (myRowAttrType == ROWTYPE_COLOR) {
596 // set field color
597 myTextField->setText(myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr).c_str());
598 // set color depending if is a default value
599 if (myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getTagProperty()->getDefaultStringValue(myAttr) != myTextField->getText().text()) {
600 myTextField->setTextColor(FXRGB(0, 0, 0));
601 } else {
602 myTextField->setTextColor(FXRGB(195, 195, 195));
603 }
604 } else if (myAttr == GNE_ATTR_PARAMETERS) {
605 // get parameters
606 const std::string& parametersStr = myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr);
607 // set text of myTextField using current value of VType
608 myTextField->setText(parametersStr.c_str());
609 // set text color
610 myTextField->setTextColor(FXRGB(0, 0, 0));
611 // clear parameters
612 myParameters.clear();
613 // separate value in a vector of string using | as separator
614 StringTokenizer parameters(parametersStr, "|", true);
615 // iterate over all values
616 while (parameters.hasNext()) {
617 // obtain key and value and save it in myParameters
618 const std::vector<std::string> keyValue = StringTokenizer(parameters.next(), "=", true).getVector();
619 if (keyValue.size() == 2) {
620 myParameters[keyValue.front()] = keyValue.back();
621 }
622 }
623 } else {
624 // set text of myTextField using current value of VType
625 myTextField->setText(myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr).c_str());
626 // set color depending if is a default value
627 if (myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getTagProperty()->getDefaultStringValue(myAttr) != myTextField->getText().text()) {
628 myTextField->setTextColor(FXRGB(0, 0, 0));
629 } else {
630 myTextField->setTextColor(FXRGB(195, 195, 195));
631 }
632 }
633}
634
635
636void
638 if (myComboBox) {
639 // set value
640 const int index = myComboBox->findItem(myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr).c_str());
641 if (index == -1) {
642 myComboBox->disable();
643 } else {
644 myComboBox->setCurrentItem(index);
645 myComboBox->enable();
646 }
647 // set color depending if is a default value
648 if (defaultValue != myComboBox->getText().text()) {
649 myComboBox->setTextColor(FXRGB(0, 0, 0));
650 } else {
651 myComboBox->setTextColor(FXRGB(195, 195, 195));
652 }
653 } else {
654 // set text of myTextField using current value of VType
655 myTextField->setText(myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr).c_str());
656 // set color depending if is a default value
657 if (defaultValue != myTextField->getText().text()) {
658 myTextField->setTextColor(FXRGB(0, 0, 0));
659 } else {
660 myTextField->setTextColor(FXRGB(195, 195, 195));
661 }
662 }
663}
664
665
666const FXButton*
670
671
672void
674 const auto editedDemandElement = myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement;
675 // check if get the value of the modal arguments
676 if (editedDemandElement->getNet()->getViewNet()->getViewParent()->getGNEAppWindows()->getInternalTest()) {
677 myTextField->setText(InternalTestStep::DialogTest::colorValue.c_str(), TRUE);
678 } else {
679 // create FXColorDialog
680 FXColorDialog colordialog(this, TL("Color Dialog"));
681 colordialog.setTarget(this);
682 colordialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::COLORWHEEL));
683 // If previous attribute wasn't correct, set black as default color
684 if (GNEAttributeCarrier::canParse<RGBColor>(myTextField->getText().text())) {
685 colordialog.setRGBA(MFXUtils::getFXColor(GNEAttributeCarrier::parse<RGBColor>(myTextField->getText().text())));
686 } else {
687 colordialog.setRGBA(MFXUtils::getFXColor(RGBColor::BLACK));
688 }
689 // execute dialog to get a new color
690 if (colordialog.execute() == 1) {
691 std::string newValue = toString(MFXUtils::getRGBColor(colordialog.getRGBA()));
692 myTextField->setText(newValue.c_str());
693 if (editedDemandElement->isValid(myAttr, newValue)) {
694 editedDemandElement->setAttribute(myAttr, newValue, editedDemandElement->getNet()->getViewNet()->getUndoList());
695 // If previously value was incorrect, change font color to black
696 myTextField->setTextColor(FXRGB(0, 0, 0));
697 myTextField->killFocus();
698 }
699 }
700 }
701}
702
703
704void
706 // get the new image file
707 FXFileDialog opendialog(this, TL("Open Image"));
708 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::VTYPE));
709 opendialog.setSelectMode(SELECTFILE_EXISTING);
710 opendialog.setPatternList(SUMOXMLDefinitions::ImageFileExtensions.getMultilineString().c_str());
711 if (gCurrentFolder.length() != 0) {
712 opendialog.setDirectory(gCurrentFolder);
713 }
714 if (opendialog.execute()) {
715 // update global current folder
716 gCurrentFolder = opendialog.getDirectory();
717 // get image path
718 std::string imagePath = opendialog.getFilename().text();
719 // check if image is valid
720 if (myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, imagePath)) {
721 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, imagePath, myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
722 myTextField->setText(imagePath.c_str());
723 // If previously value was incorrect, change font color to black
724 myTextField->setTextColor(FXRGB(0, 0, 0));
725 myTextField->killFocus();
726 }
727 }
728}
729
730
731void
733 // get the new file name
734 FXFileDialog opendialog(this, TL("Open OSG File"));
735 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::VTYPE));
736 opendialog.setSelectMode(SELECTFILE_EXISTING);
737 opendialog.setPatternList(SUMOXMLDefinitions::OSGFileExtensions.getMultilineString().c_str());
738 if (gCurrentFolder.length() != 0) {
739 opendialog.setDirectory(gCurrentFolder);
740 }
741 if (opendialog.execute()) {
742 // update global current folder
743 gCurrentFolder = opendialog.getDirectory();
744 // get image path
745 std::string imagePath = opendialog.getFilename().text();
746 // check if image is valid
747 if (myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, imagePath)) {
748 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, imagePath, myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
749 myTextField->setText(imagePath.c_str());
750 // If previously value was incorrect, change font color to black
751 myTextField->setTextColor(FXRGB(0, 0, 0));
752 myTextField->killFocus();
753 }
754 }
755}
756
757
758std::string
760 return myTextField->getText().text();
761}
762
763
764std::vector<std::pair<std::string, std::string> >
766 std::vector<std::pair<std::string, std::string> > result;
767 // Generate a vector string using the following structure: "<key1,value1>, <key2, value2>,...
768 for (const auto& parameter : myParameters) {
769 result.push_back(std::make_pair(parameter.first, parameter.second));
770 }
771 return result;
772}
773
774
775void
776GNEVehicleTypeDialog::VTypeAttributes::VTypeAttributeRow::setParameters(const std::vector<std::pair<std::string, std::string> >& parameters) {
777 // first clear parameters
778 myParameters.clear();
779 // declare result
780 std::string result;
781 // iterate over parameters
782 for (const auto& parameter : parameters) {
783 // Generate an string using the following structure: "key1=value1|key2=value2|...
784 result += parameter.first + "=" + parameter.second + "|";
785 // fill parameters
786 myParameters[parameter.first] = parameter.second;
787 }
788 // remove the last "|"
789 if (!result.empty()) {
790 result.pop_back();
791 }
792 // set text field
793 myTextField->setText(result.c_str());
794}
795
796
797std::string
799 switch (attr) {
800 // JM
802 return "crossingGap";
804 return "driveAfterYellowTime";
806 return "driveAfterRedTime";
808 return "driveRedSpeed";
810 return "ignoreKeepClearTime";
812 return "ignoreFoeSpeed";
814 return "ignoreFoeProb";
816 return "sigmaMinor";
818 return "timegapMinor";
819 // LCM
821 return "strategic";
823 return "cooperative";
825 return "speedGain";
827 return "keepRight";
829 return "sublane";
831 return "opposite";
833 return "pushy";
835 return "pushyGap";
837 return "assertive";
839 return "impatience";
841 return "timeToImpatience";
843 return "accelLat";
845 return "lookaheadLeft";
847 return "speedGainRight";
849 return "maxSpeedLatStanding";
851 return "maxSpeedLatFactor";
853 return "turnAlignDistance";
855 return "overtakeRight";
857 return "keepRightAcceptanceTime";
859 return "overtakeDeltaSpeedFactor";
860 /* case SUMO_ATTR_LCA_EXPERIMENTAL1:
861 return "experimental1";
862 */
863 default:
864 return toString(attr);
865 }
866}
867
868// ---------------------------------------------------------------------------
869// GNEVehicleTypeDialog::VTypeAttributes - methods
870// ---------------------------------------------------------------------------
871
873 FXVerticalFrame(column, GUIDesignAuxiliarVerticalFrame),
874 myVehicleTypeDialog(vehicleTypeDialog) {
875 // declare two auxiliary horizontal frames
876 FXHorizontalFrame* firstAuxiliarHorizontalFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
877 FXVerticalFrame* firstAuxiliarVerticalFrame = new FXVerticalFrame(firstAuxiliarHorizontalFrame, GUIDesignAuxiliarVerticalFrame);
878 // create attributes for common attributes
879 FXGroupBox* commonAttributes = new FXGroupBox(firstAuxiliarVerticalFrame, "Vehicle Type attributes", GUIDesignGroupBoxFrame);
880 // create horizontal frame for columns of attributes
881 FXHorizontalFrame* columnsBasicVTypeAttributes = new FXHorizontalFrame(commonAttributes, GUIDesignAuxiliarHorizontalFrame);
882 // build left attributes
883 buildAttributesA(new FXVerticalFrame(columnsBasicVTypeAttributes, GUIDesignAuxiliarFrame));
884 // build right attributes
885 buildAttributesB(new FXVerticalFrame(columnsBasicVTypeAttributes, GUIDesignAuxiliarFrame));
886 // create GroupBox for Junction Model Attributes
887 FXGroupBox* JMAttributes = new FXGroupBox(firstAuxiliarVerticalFrame, "Junction Model attributes", GUIDesignGroupBoxFrame);
888 // create horizontal frame for columns of Junction Model attributes
889 FXHorizontalFrame* columnsJMVTypeAttributes = new FXHorizontalFrame(JMAttributes, GUIDesignAuxiliarHorizontalFrame);
890 // build left attributes
891 buildJunctionModelAttributesA(new FXVerticalFrame(columnsJMVTypeAttributes, GUIDesignAuxiliarFrame));
892 // build right attributes
893 buildJunctionModelAttributesB(new FXVerticalFrame(columnsJMVTypeAttributes, GUIDesignAuxiliarFrame));
894 // create GroupBox for Junction Model Attributes
895 FXGroupBox* LCMAttributes = new FXGroupBox(firstAuxiliarHorizontalFrame, "Lane Change Model attributes", GUIDesignGroupBoxFrame);
896 // create Lane Change Model Attributes
897 buildLaneChangeModelAttributes(new FXVerticalFrame(LCMAttributes, GUIDesignAuxiliarFrame));
898}
899
900
901void
903 // 01 Create VClassRow
904 myVClassRow = new VClassRow(this, column);
905
906 // 02 create FXTextField and Label for vehicleTypeID
907 FXHorizontalFrame* row = new FXHorizontalFrame(column, GUIDesignAuxiliarHorizontalFrame);
908 new FXLabel(row, toString(SUMO_ATTR_ID).c_str(), nullptr, GUIDesignLabelThickedFixed(150));
909 myTextFieldVehicleTypeID = new FXTextField(row, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFieldFixed(180));
910
911 // 03 create FXTextField and Button for Color
912 myColor = new VTypeAttributeRow(this, column, SUMO_ATTR_COLOR, VTypeAttributeRow::RowAttrType::ROWTYPE_COLOR);
913
914 // 04 create FXTextField and Label for Length
915 myLength = new VTypeAttributeRow(this, column, SUMO_ATTR_LENGTH, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
916
917 // 05 create FXTextField and Label for MinGap
918 myMinGap = new VTypeAttributeRow(this, column, SUMO_ATTR_MINGAP, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
919
920 // 06 create FXTextField and Label for MaxSpeed
921 myMaxSpeed = new VTypeAttributeRow(this, column, SUMO_ATTR_MAXSPEED, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
922
923 // 07 create VTypeAttributeRow and Label for desired max speed
924 myDesiredMaxSpeed = new VTypeAttributeRow(this, column, SUMO_ATTR_DESIRED_MAXSPEED, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
925
926 // 08 create FXTextField and Label for SpeedFactor
927 mySpeedFactor = new VTypeAttributeRow(this, column, SUMO_ATTR_SPEEDFACTOR, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
928
929 // 09 create FXTextField and Label for EmissionClass
930 myEmissionClass = new VTypeAttributeRow(this, column, SUMO_ATTR_EMISSIONCLASS, VTypeAttributeRow::RowAttrType::ROWTYPE_COMBOBOX, PollutantsInterface::getAllClassesStr());
931
932 // 10 create FXTextField and Label for Width
933 myWidth = new VTypeAttributeRow(this, column, SUMO_ATTR_WIDTH, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
934
935 // 11 create FXTextField and Label for Height
936 myHeight = new VTypeAttributeRow(this, column, SUMO_ATTR_HEIGHT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
937
938 // 12 create FXTextField and Label for Filename
939 myFilename = new VTypeAttributeRow(this, column, SUMO_ATTR_IMGFILE, VTypeAttributeRow::RowAttrType::ROWTYPE_FILENAME);
940
941 // 13 create FXTextField and Label for Filename
942 myOSGFile = new VTypeAttributeRow(this, column, SUMO_ATTR_OSGFILE, VTypeAttributeRow::RowAttrType::ROWTYPE_FILENAME);
943
944 // 14 create VTypeAttributeRow and Label for LaneChangeModel
945 myLaneChangeModel = new VTypeAttributeRow(this, column, SUMO_ATTR_LANE_CHANGE_MODEL, VTypeAttributeRow::RowAttrType::ROWTYPE_COMBOBOX, SUMOXMLDefinitions::LaneChangeModels.getStrings());
946}
947
948
949void
951 // 01 Create VShapeRow
952 myVShapeRow = new VShapeRow(this, column);
953
954 // 02 create VTypeAttributeRow and Label for Probability
955 myProbability = new VTypeAttributeRow(this, column, SUMO_ATTR_PROB, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
956
957 // 03 create VTypeAttributeRow and Label for PersonCapacity
958 myPersonCapacity = new VTypeAttributeRow(this, column, SUMO_ATTR_PERSON_CAPACITY, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
959
960 // 04 create VTypeAttributeRow and Label for ContainerCapacity
961 myContainerCapacity = new VTypeAttributeRow(this, column, SUMO_ATTR_CONTAINER_CAPACITY, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
962
963 // 05 create VTypeAttributeRow and Label for BoardingDuration
964 myBoardingDuration = new VTypeAttributeRow(this, column, SUMO_ATTR_BOARDING_DURATION, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
965
966 // 06 create VTypeAttributeRow and Label for LoadingDuration
967 myLoadingDuration = new VTypeAttributeRow(this, column, SUMO_ATTR_LOADING_DURATION, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
968
969 // 07 create ComboBox and Label for LatAlignment
970 myLatAlignment = new VTypeAttributeRow(this, column, SUMO_ATTR_LATALIGNMENT, VTypeAttributeRow::RowAttrType::ROWTYPE_COMBOBOX, SUMOVTypeParameter::getLatAlignmentStrings());
971
972 // 08 create VTypeAttributeRow and Label for MinGapLat
973 myMinGapLat = new VTypeAttributeRow(this, column, SUMO_ATTR_MINGAP_LAT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
974
975 // 09 create VTypeAttributeRow and Label for MaxSpeedLat
976 myMaxSpeedLat = new VTypeAttributeRow(this, column, SUMO_ATTR_MAXSPEED_LAT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
977
978 // 10 create VTypeAttributeRow and Label for ActionStepLength
979 myActionStepLength = new VTypeAttributeRow(this, column, SUMO_ATTR_ACTIONSTEPLENGTH, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
980 /*
981 Waiting for #16343
982 // 11 create FXTextField and Label for Carriage length
983 myCarriageLength = new VTypeAttributeRow(this, column, SUMO_ATTR_CARRIAGE_LENGTH, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
984
985 // 12 create FXTextField and Label for Locomotive length
986 myLocomotiveLength = new VTypeAttributeRow(this, column, SUMO_ATTR_LOCOMOTIVE_LENGTH, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
987
988 // 13 create FXTextField and Label for carriage GAP
989 myCarriageGap = new VTypeAttributeRow(this, column, SUMO_ATTR_CARRIAGE_GAP, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
990 */
991 // 14 create FXTextField and Label for parameters
992 myParameters = new VTypeAttributeRow(this, column, GNE_ATTR_PARAMETERS, VTypeAttributeRow::RowAttrType::ROWTYPE_PARAMETERS);
993}
994
995
996void
998 // 01 create VTypeAttributeRow and Label for JMCrossingGap
999 myJMCrossingGap = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_CROSSING_GAP, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1000
1001 // 02 create VTypeAttributeRow and Label for JMIgnoreKeepclearTime
1002 myJMIgnoreKeepclearTime = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_IGNORE_KEEPCLEAR_TIME, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1003
1004 // 03 create VTypeAttributeRow and Label for JMDriveAfterYellowTime
1005 myJMDriveAfterYellowTime = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_DRIVE_AFTER_YELLOW_TIME, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1006
1007 // 04 create VTypeAttributeRow and Label for JMDriveAfterRedTime
1008 myJMDriveAfterRedTime = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_DRIVE_AFTER_RED_TIME, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1009
1010 // 05 create VTypeAttributeRow and Label for JMDriveRedSpeed
1011 myJMDriveRedSpeed = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_DRIVE_RED_SPEED, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1012}
1013
1014
1015void
1017 // 01 create VTypeAttributeRow and Label for JMIgnoreFoeProb
1018 myJMIgnoreFoeProb = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_IGNORE_FOE_PROB, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1019
1020 // 02 create VTypeAttributeRow and Label for JMIgnoreFoeSpeed
1021 myJMIgnoreFoeSpeed = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_IGNORE_FOE_SPEED, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1022
1023 // 03 create VTypeAttributeRow and Label for JMSigmaMinor
1024 myJMSigmaMinor = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_SIGMA_MINOR, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1025
1026 // 04 create VTypeAttributeRow and Label for JMTimeGapMinor
1027 myJMTimeGapMinor = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_TIMEGAP_MINOR, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1028
1029 // 05 create VTypeAttributeRow and Label for Impatience
1030 myJMImpatience = new VTypeAttributeRow(this, column, SUMO_ATTR_IMPATIENCE, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1031}
1032
1033
1034void
1036 // 01 create VTypeAttributeRow and Label for strategic param
1037 myLCAStrategicParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_STRATEGIC_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1038
1039 // 02 create VTypeAttributeRow and Label for cooperative param
1040 myLCACooperativeParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_COOPERATIVE_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1041
1042 // 03 create VTypeAttributeRow and Label for speed gain param
1043 myLCASpeedgainParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_SPEEDGAIN_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1044
1045 // 04 create VTypeAttributeRow and Label for keepright param
1046 myLCAKeeprightParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_KEEPRIGHT_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1047
1048 // 05 create VTypeAttributeRow and Label for sublane param
1049 myLCASublaneParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_SUBLANE_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1050
1051 // 06 create VTypeAttributeRow and Label for opposite param
1052 myLCAOppositeParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_OPPOSITE_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1053
1054 // 07 create VTypeAttributeRow and Label for pushy
1055 myLCAPushy = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_PUSHY, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1056
1057 // 08 create VTypeAttributeRow and Label for pushy gap
1058 myLCAPushygap = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_PUSHYGAP, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1059
1060 // 09 create VTypeAttributeRow and Label for assertive
1061 myLCAAssertive = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_ASSERTIVE, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1062
1063 // 10 create VTypeAttributeRow and Label for impatience
1064 myLCAImpatience = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_IMPATIENCE, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1065
1066 // 11 create VTypeAttributeRow and Label for time to impatience
1067 myLCATimeToImpatience = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_TIME_TO_IMPATIENCE, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1068
1069 // 12 create VTypeAttributeRow and Label for accel lat
1070 myLCAAccelLat = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_ACCEL_LAT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1071
1072 // 13 create VTypeAttributeRow and Label for look ahead lefth
1073 myLCALookAheadLeft = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_LOOKAHEADLEFT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1074
1075 // 14 create VTypeAttributeRow and Label for speed gain right
1076 myLCASpeedGainRight = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_SPEEDGAINRIGHT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1077
1078 // 15 create VTypeAttributeRow and Label for max speed lat standing
1079 myLCAMaxSpeedLatStanding = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_MAXSPEEDLATSTANDING, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1080
1081 // 16 create VTypeAttributeRow and Label for max speed lat factor
1082 myLCAMaxSpeedLatFactor = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_MAXSPEEDLATFACTOR, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1083
1084 // 17 create VTypeAttributeRow and Label for turn alignment distance
1085 myLCATurnAlignmentDistance = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_TURN_ALIGNMENT_DISTANCE, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1086
1087 // 18 create VTypeAttributeRow and Label for overtake right
1088 myLCAOvertakeRight = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_OVERTAKE_RIGHT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1089
1090 // 19 create VTypeAttributeRow and Label for keep right acceptance time
1091 myLCAKeepRightAcceptanceTime = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_KEEPRIGHT_ACCEPTANCE_TIME, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1092
1093 // 20 create VTypeAttributeRow and Label for overtake deltaspeed factor
1094 myLCAOvertakeDeltaSpeedFactor = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_OVERTAKE_DELTASPEED_FACTOR, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1095
1096 // 21 create VTypeAttributeRow and Label for experimental
1097 /* myLCAExperimental = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_EXPERIMENTAL1, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING); */
1098}
1099
1100
1101void
1103 //set values of myEditedDemandElement into fields
1104 myTextFieldVehicleTypeID->setText(myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_ID).c_str());
1105 // set variables of special rows VClass and VShape
1106 SUMOVTypeParameter::VClassDefaultValues defaultVTypeParameters(myVClassRow->updateValue());
1107 myVShapeRow->updateValues();
1108 // update rows
1109 myLaneChangeModel->updateValue();
1110 myLatAlignment->updateValue(toString(defaultVTypeParameters.latAlignmentProcedure));
1111 myColor->updateValue();
1112 myLength->updateValue(toString(defaultVTypeParameters.length));
1113 myMinGap->updateValue(toString(defaultVTypeParameters.minGap));
1114 myMaxSpeed->updateValue(toString(defaultVTypeParameters.maxSpeed));
1115 myDesiredMaxSpeed->updateValue(toString(defaultVTypeParameters.desiredMaxSpeed));
1116 mySpeedFactor->updateValue(toString(defaultVTypeParameters.speedFactor.getParameter(0)));
1117 myEmissionClass->updateValue(toString(defaultVTypeParameters.emissionClass));
1118 myWidth->updateValue(toString(defaultVTypeParameters.width));
1119 myHeight->updateValue(toString(defaultVTypeParameters.height));
1120 myFilename->updateValue();
1121 myOSGFile->updateValue(toString(defaultVTypeParameters.osgFile));
1122 myPersonCapacity->updateValue(toString(defaultVTypeParameters.personCapacity));
1123 myContainerCapacity->updateValue(toString(defaultVTypeParameters.containerCapacity));
1124 /*
1125 Waiting for #16343
1126 myCarriageLength->updateValue(toString(defaultVTypeParameters.carriageLength));
1127 myLocomotiveLength->updateValue(toString(defaultVTypeParameters.locomotiveLength));
1128 myCarriageGap->updateValue();
1129 */
1130 myBoardingDuration->updateValue();
1131 myLoadingDuration->updateValue();
1132 myMinGapLat->updateValue();
1133 myMaxSpeedLat->updateValue();
1134 myActionStepLength->updateValue();
1135 myProbability->updateValue();
1136 // JM Parameters
1137 myJMCrossingGap->updateValue();
1138 myJMIgnoreKeepclearTime->updateValue();
1139 myJMDriveAfterYellowTime->updateValue();
1140 myJMDriveAfterRedTime->updateValue();
1141 myJMDriveRedSpeed->updateValue();
1142 myJMIgnoreFoeProb->updateValue();
1143 myJMIgnoreFoeSpeed->updateValue();
1144 myJMSigmaMinor->updateValue();
1145 myJMTimeGapMinor->updateValue();
1146 myJMImpatience->updateValue();
1147 // LCM Attributes
1148 myLCAStrategicParam->updateValue();
1149 myLCACooperativeParam->updateValue();
1150 myLCASpeedgainParam->updateValue();
1151 myLCAKeeprightParam->updateValue();
1152 myLCASublaneParam->updateValue();
1153 myLCAOppositeParam->updateValue();
1154 myLCAPushy->updateValue();
1155 myLCAPushygap->updateValue();
1156 myLCAAssertive->updateValue();
1157 myLCAImpatience->updateValue();
1158 myLCATimeToImpatience->updateValue();
1159 myLCAAccelLat->updateValue();
1160 myLCALookAheadLeft->updateValue();
1161 myLCASpeedGainRight->updateValue();
1162 myLCAMaxSpeedLatStanding->updateValue();
1163 myLCAMaxSpeedLatFactor->updateValue();
1164 myLCATurnAlignmentDistance->updateValue();
1165 myLCAOvertakeRight->updateValue();
1166 myLCAKeepRightAcceptanceTime->updateValue();
1167 myLCAOvertakeDeltaSpeedFactor->updateValue();
1168 /* myLCAExperimental->updateValue(); */
1169 // parameters
1170 myParameters->updateValue();
1171}
1172
1173
1174long
1176 // At start we assumed, that all values are valid
1177 myVehicleTypeDialog->myVehicleTypeValid = true;
1178 myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_NOTHING;
1179 // set color of myTextFieldVehicleTypeID, depending if current value is valid or not
1180 if (myVehicleTypeDialog->myEditedDemandElement->isValid(SUMO_ATTR_ID, myTextFieldVehicleTypeID->getText().text())) {
1181 myTextFieldVehicleTypeID->setTextColor(FXRGB(0, 0, 0));
1182 myVehicleTypeDialog->myEditedDemandElement->setAttribute(SUMO_ATTR_ID, myTextFieldVehicleTypeID->getText().text(), myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
1183 } else if (myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_ID) == myTextFieldVehicleTypeID->getText().text()) {
1184 myTextFieldVehicleTypeID->setTextColor(FXRGB(0, 0, 0));
1185 myVehicleTypeDialog->myEditedDemandElement->setAttribute(SUMO_ATTR_ID, myTextFieldVehicleTypeID->getText().text(), myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
1186 } else {
1187 myTextFieldVehicleTypeID->setTextColor(FXRGB(255, 0, 0));
1188 myVehicleTypeDialog->myVehicleTypeValid = false;
1189 myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_ID;
1190 }
1191 // set variables of special rows VClass and VShape
1192 SUMOVTypeParameter::VClassDefaultValues defaultVTypeParameters(myVClassRow->setVariable());
1193 // set variables of special rows VShape
1194 myVShapeRow->setVariable();
1195 // set attributes in rest rows
1196 myColor->setVariable();
1197 myLength->setVariable(toString(defaultVTypeParameters.length));
1198 myMinGap->setVariable(toString(defaultVTypeParameters.minGap));
1199 myMaxSpeed->setVariable(toString(defaultVTypeParameters.maxSpeed));
1200 myDesiredMaxSpeed->setVariable(toString(defaultVTypeParameters.desiredMaxSpeed));
1201 mySpeedFactor->setVariable(toString(defaultVTypeParameters.speedFactor.getParameter(0)));
1202 myEmissionClass->setVariable(toString(defaultVTypeParameters.emissionClass));
1203 myWidth->setVariable(toString(defaultVTypeParameters.width));
1204 myHeight->setVariable(toString(defaultVTypeParameters.height));
1205 myOSGFile->setVariable(toString(defaultVTypeParameters.osgFile));
1206 // set attributes in rows
1207 myLaneChangeModel->setVariable();
1208 myLatAlignment->setVariable(toString(defaultVTypeParameters.latAlignmentProcedure));
1209 myLength->setVariable(toString(defaultVTypeParameters.length));
1210 myMinGap->setVariable(toString(defaultVTypeParameters.minGap));
1211 myMaxSpeed->setVariable(toString(defaultVTypeParameters.maxSpeed));
1212 mySpeedFactor->setVariable(toString(defaultVTypeParameters.speedFactor.getParameter(0)));
1213 myEmissionClass->setVariable(toString(defaultVTypeParameters.emissionClass));
1214 myWidth->setVariable(toString(defaultVTypeParameters.width));
1215 myHeight->setVariable(toString(defaultVTypeParameters.height));
1216 myFilename->setVariable();
1217 myOSGFile->setVariable(toString(defaultVTypeParameters.osgFile));
1218 myPersonCapacity->setVariable(toString(defaultVTypeParameters.personCapacity));
1219 myContainerCapacity->setVariable(toString(defaultVTypeParameters.containerCapacity));
1220 /*
1221 Waiting for #16343
1222 myCarriageLength->setVariable(toString(defaultVTypeParameters.carriageLength));
1223 myLocomotiveLength->setVariable(toString(defaultVTypeParameters.locomotiveLength));
1224 myCarriageGap->setVariable();
1225 */
1226 myBoardingDuration->setVariable();
1227 myLoadingDuration->setVariable();
1228 myMinGapLat->setVariable();
1229 myMaxSpeedLat->setVariable();
1230 myActionStepLength->setVariable();
1231 myProbability->setVariable();
1232 // JM Variables
1233 myJMCrossingGap->setVariable();
1234 myJMIgnoreKeepclearTime->setVariable();
1235 myJMDriveAfterYellowTime->setVariable();
1236 myJMDriveAfterRedTime->setVariable();
1237 myJMDriveRedSpeed->setVariable();
1238 myJMIgnoreFoeProb->setVariable();
1239 myJMIgnoreFoeSpeed->setVariable();
1240 myJMSigmaMinor->setVariable();
1241 myJMTimeGapMinor->setVariable();
1242 myJMImpatience->setVariable();
1243 // LCM Attributes
1244 myLCAStrategicParam->setVariable();
1245 myLCACooperativeParam->setVariable();
1246 myLCASpeedgainParam->setVariable();
1247 myLCAKeeprightParam->setVariable();
1248 myLCASublaneParam->setVariable();
1249 myLCAOppositeParam->setVariable();
1250 myLCAPushy->setVariable();
1251 myLCAPushygap->setVariable();
1252 myLCAAssertive->setVariable();
1253 myLCAImpatience->setVariable();
1254 myLCATimeToImpatience->setVariable();
1255 myLCAAccelLat->setVariable();
1256 myLCALookAheadLeft->setVariable();
1257 myLCASpeedGainRight->setVariable();
1258 myLCAMaxSpeedLatStanding->setVariable();
1259 myLCAMaxSpeedLatFactor->setVariable();
1260 myLCATurnAlignmentDistance->setVariable();
1261 myLCAOvertakeRight->setVariable();
1262 myLCAKeepRightAcceptanceTime->setVariable();
1263 myLCAOvertakeDeltaSpeedFactor->setVariable();
1264 /* myLCAExperimental->setVariable(); */
1265 myParameters->setVariable();
1266 return true;
1267}
1268
1269
1270long
1272 // check what dialog has to be opened
1273 if (obj == myColor->getButton()) {
1274 myColor->openColorDialog();
1275 } else if (obj == myFilename->getButton()) {
1276 myFilename->openImageFileDialog();
1277 } else if (obj == myOSGFile->getButton()) {
1278 myFilename->openOSGFileDialog();
1279 }
1280 return 1;
1281}
1282
1283
1284long
1286 const auto viewNet = myVehicleTypeDialog->getEditedDemandElement()->getNet()->getViewNet();
1287 // edit parameters using dialog
1288 if (GNESingleParametersDialog(myParameters, viewNet).openModalDialog(viewNet->getViewParent()->getGNEAppWindows()->getInternalTest())) {
1289 // set values edited in Parameter dialog in Edited AC
1290 myVehicleTypeDialog->getEditedDemandElement()->setAttribute(GNE_ATTR_PARAMETERS, myParameters->getParametersStr(), viewNet->getUndoList());
1291 }
1292 return 1;
1293}
1294
1295// ---------------------------------------------------------------------------
1296// GNEVehicleTypeDialog::VShapeRow - methods
1297// ---------------------------------------------------------------------------
1298
1300 FXGroupBox(column, "Car Following Model attributes", GUIDesignGroupBoxFrame),
1301 myVehicleTypeDialog(vehicleTypeDialog) {
1302
1303 // create vertical frame for rows
1304 myVerticalFrameRows = new FXVerticalFrame(this, GUIDesignAuxiliarFrame);
1305
1306 // declare combo box
1307 FXHorizontalFrame* row = new FXHorizontalFrame(myVerticalFrameRows, GUIDesignAuxiliarHorizontalFrame);
1308 new FXLabel(row, "Algorithm", nullptr, GUIDesignLabelThickedFixed(150));
1311
1312 // fill combo Box with all Car following models
1313 std::vector<std::string> CFModels = SUMOXMLDefinitions::CarFollowModels.getStrings();
1314 for (const auto& CFModel : CFModels) {
1315 myComboBoxCarFollowModel->appendIconItem(CFModel.c_str(), nullptr);
1316 }
1317
1318 // 01 create FX and Label for Accel
1320 myRows.push_back(myAccelRow);
1321
1322 // 02 create FX and Label for Decel
1324 myRows.push_back(myDecelRow);
1325
1326 // 03 create FX and Label for Apparent decel
1328 myRows.push_back(myApparentDecelRow);
1329
1330 // 04 create FX and Label for emergency decel
1332 myRows.push_back(myEmergencyDecelRow);
1333
1334 // 05 create FX and Label for Sigma
1336 myRows.push_back(mySigmaRow);
1337
1338 // 06 create FX and Label for Tau
1340 myRows.push_back(myTauRow);
1341
1342 // 07 myMinGapFactor FX and Label for MinGapFactor
1344 myRows.push_back(myMinGapFactorRow);
1345
1346 // 08 create FX and Label for K
1348 myRows.push_back(myKRow);
1349
1350 // 09 create FX and Label for PHI
1352 myRows.push_back(myPhiRow);
1353
1354 // 10 create FX and Label for Deleta
1356 myRows.push_back(myDeltaRow);
1357
1358 // 11 create FX and Label for Stepping
1360 myRows.push_back(mySteppingRow);
1361
1362 // 12 create FX and Label for Security
1364 myRows.push_back(mySecurityRow);
1365
1366 // 13 create FX and Label for Estimation
1368 myRows.push_back(myEstimationRow);
1369
1370 // 14 create FX and Label for TMP1
1372 myRows.push_back(myTmp1Row);
1373
1374 // 15 create FX and Label for TMP2
1376 myRows.push_back(myTmp2Row);
1377
1378 // 16 create FX and Label for TMP3
1380 myRows.push_back(myTmp3Row);
1381
1382 // 17 create FX and Label for TMP4
1384 myRows.push_back(myTmp4Row);
1385
1386 // 18 create FX and Label for TMP5
1388 myRows.push_back(myTmp5Row);
1389
1390 // 19 create FX and Label for trainType (allow strings)
1392 myRows.push_back(myTrainTypeRow);
1393
1394 // 20 create FX and Label for Tau Last
1396 myRows.push_back(myTrauLastRow);
1397
1398 // 21 create FX and Label for Aprob
1400 myRows.push_back(myAprobRow);
1401
1402 // 22 create FX and Label for Adapt Factor
1404 myRows.push_back(myAdaptFactorRow);
1405
1406 // 23 create FX and Label for Adapt Time
1408 myRows.push_back(myAdaptTimeRow);
1409
1410 // 24 create FX and Label for W99 CC 01
1412 myRows.push_back(myW99CC1);
1413
1414 // 25 create FX and Label for W99 CC 02
1416 myRows.push_back(myW99CC2);
1417
1418 // 26 create FX and Label for W99 CC 03
1420 myRows.push_back(myW99CC3);
1421
1422 // 27 create FX and Label for W99 CC 04
1424 myRows.push_back(myW99CC4);
1425
1426 // 28 create FX and Label for W99 CC 05
1428 myRows.push_back(myW99CC5);
1429
1430 // 29 create FX and Label for W99 CC 06
1432 myRows.push_back(myW99CC6);
1433
1434 // 30 create FX and Label for W99 CC 07
1436 myRows.push_back(myW99CC7);
1437
1438 // 31 create FX and Label for W99 CC 08
1440 myRows.push_back(myW99CC8);
1441
1442 // 32 create FX and Label for W99 CC 09
1444 myRows.push_back(myW99CC9);
1445
1446 // X1 create FX and Label for Look ahead/preview Time
1448 myRows.push_back(myTpreviewRow);
1449
1450 // X2 create FX and Label for Reaction Time
1452 myRows.push_back(myTreactionRow);
1453
1454 // X3 create FX and Label for Wiener Process Driving Error
1456 myRows.push_back(myTPersDriveRow);
1457
1458 // X4 create FX and Label for Wiener Process Estimation Error
1460 myRows.push_back(myTPersEstimateRow);
1461
1462 // X5 create FX and Label for Coolness parameter
1464 myRows.push_back(myCcoolnessRow);
1465
1466 // X6 create FX and Label for leader speed estimation error
1468 myRows.push_back(mySigmaleaderRow);
1469
1470 // X7 create FX and Label for Gap estimation error
1472 myRows.push_back(mySigmagapRow);
1473
1474 // X8 create FX and Label for Driving Error
1476 myRows.push_back(mySigmaerrorRow);
1477
1478 // X9 create FX and Label for max jerk
1480 myRows.push_back(myJerkmaxRow);
1481
1482 // X10 create FX and Label for AP Driver Update threshold
1484 myRows.push_back(myEpsilonaccRow);
1485
1486 // X11 create FX and Label for Startup Time to acc_max
1488 myRows.push_back(myTaccmaxRow);
1489
1490 // X12 create FX and Label for Startup M flatness
1492 myRows.push_back(myMflatnessRow);
1493
1494 // X13 create FX and Label for Startup M begin
1496 myRows.push_back(myMbeginRow);
1497
1498 // X14 create FX and Label for using vehicle dynamics
1500 myRows.push_back(myUseVehDynamicsRow);
1501
1502 // X14 create FX and Label for using vehicle dynamics
1504 myRows.push_back(myMaxVehPreviewRow);
1505
1506 // create myLabelIncompleteAttribute
1507 myLabelIncompleteAttribute = new FXLabel(myVerticalFrameRows, "Some attributes wasn't\nimplemented yet", nullptr, GUIDesignLabelAboutInfoCenter);
1509
1510 // show or hide ComboBox depending of current selected CFM
1512}
1513
1514
1515void
1517 // start hiding all rows
1518 for (const auto& row : myRows) {
1519 row->hide();
1520 }
1521 // hide myLabelIncompleteAttribute
1522 myLabelIncompleteAttribute->hide();
1523 // show textfield depending of current CFM
1524 if (SUMOXMLDefinitions::CarFollowModels.hasString(myComboBoxCarFollowModel->getText().text())) {
1525 // show textfield depending of selected CFM
1526 switch (SUMOXMLDefinitions::CarFollowModels.get(myComboBoxCarFollowModel->getText().text())) {
1527 case SUMO_TAG_CF_KRAUSS:
1530 myTauRow->show();
1531 myAccelRow->show();
1532 myDecelRow->show();
1533 myApparentDecelRow->show();
1534 myEmergencyDecelRow->show();
1535 mySigmaRow->show();
1536 break;
1538 myTauRow->show();
1539 myTmp1Row->show();
1540 myTmp2Row->show();
1541 myTmp3Row->show();
1542 myTmp4Row->show();
1543 myTmp5Row->show();
1544 break;
1547 myTauRow->show();
1548 myAccelRow->show();
1549 myDecelRow->show();
1550 myEmergencyDecelRow->show();
1551 mySigmaRow->show();
1552 myMinGapFactorRow->show();
1553 myTmp1Row->show();
1554 myTmp2Row->show();
1555 myTmp3Row->show();
1556 myTmp4Row->show();
1557 myTmp5Row->show();
1558 break;
1560 myTauRow->show();
1561 myAccelRow->show();
1562 myDecelRow->show();
1563 myEmergencyDecelRow->show();
1564 mySigmaRow->show();
1565 myMinGapFactorRow->show();
1566 myTrauLastRow->show();
1567 myAprobRow->show();
1568 break;
1569 case SUMO_TAG_CF_IDM:
1570 myTauRow->show();
1571 myAccelRow->show();
1572 myDecelRow->show();
1573 myEmergencyDecelRow->show();
1574 myDeltaRow->show();
1575 mySteppingRow->show();
1576 myMinGapFactorRow->show();
1577 break;
1578 case SUMO_TAG_CF_IDMM:
1579 myTauRow->show();
1580 myAccelRow->show();
1581 myDecelRow->show();
1582 myEmergencyDecelRow->show();
1583 myDeltaRow->show();
1584 mySteppingRow->show();
1585 myMinGapFactorRow->show();
1586 myAdaptFactorRow->show();
1587 myAdaptTimeRow->show();
1588 break;
1589 case SUMO_TAG_CF_EIDM:
1590 myTauRow->show();
1591 myAccelRow->show();
1592 myDecelRow->show();
1593 myEmergencyDecelRow->show();
1594 myDeltaRow->show();
1595 mySteppingRow->show();
1596 myMinGapFactorRow->show();
1597 myTpreviewRow->show();
1598 myTreactionRow->show();
1599 myTPersDriveRow->show();
1600 myTPersEstimateRow->show();
1601 myCcoolnessRow->show();
1602 mySigmaleaderRow->show();
1603 mySigmagapRow->show();
1604 mySigmaerrorRow->show();
1605 myJerkmaxRow->show();
1606 myEpsilonaccRow->show();
1607 myTaccmaxRow->show();
1608 myMflatnessRow->show();
1609 myMbeginRow->show();
1610 myUseVehDynamicsRow->show();
1611 myMaxVehPreviewRow->show();
1612 break;
1614 myTauRow->show();
1615 myAccelRow->show();
1616 myDecelRow->show();
1617 myEmergencyDecelRow->show();
1618 myKRow->show();
1619 myPhiRow->show();
1620 myMinGapFactorRow->show();
1621 break;
1623 myTauRow->show();
1624 myAccelRow->show();
1625 myDecelRow->show();
1626 myEmergencyDecelRow->show();
1627 myMinGapFactorRow->show();
1628 mySecurityRow->show();
1629 myEstimationRow->show();
1630 break;
1631 case SUMO_TAG_CF_W99:
1632 myW99CC1->show();
1633 myW99CC2->show();
1634 myW99CC3->show();
1635 myW99CC4->show();
1636 myW99CC5->show();
1637 myW99CC6->show();
1638 myW99CC7->show();
1639 myW99CC8->show();
1640 myW99CC9->show();
1641 break;
1642 case SUMO_TAG_CF_RAIL:
1643 myTauRow->show();
1644 myTrainTypeRow->show();
1645 break;
1646 case SUMO_TAG_CF_ACC:
1647 myTauRow->show();
1648 myAccelRow->show();
1649 myDecelRow->show();
1650 myEmergencyDecelRow->show();
1651 myMinGapFactorRow->show();
1652 // show myLabelIncompleteAttribute
1653 myLabelIncompleteAttribute->show();
1664 break;
1665 case SUMO_TAG_CF_CACC:
1666 myTauRow->show();
1667 myAccelRow->show();
1668 myDecelRow->show();
1669 myEmergencyDecelRow->show();
1670 myMinGapFactorRow->show();
1671 // show myLabelIncompleteAttribute
1672 myLabelIncompleteAttribute->show();
1689 break;
1690 case SUMO_TAG_CF_CC:
1691 myTauRow->show();
1692 myAccelRow->show();
1693 myDecelRow->show();
1694 // show myLabelIncompleteAttribute
1695 myLabelIncompleteAttribute->show();
1717 break;
1718 default:
1719 break;
1720 }
1721 }
1722 myVerticalFrameRows->recalc();
1723 update();
1724}
1725
1726
1727void
1729 //set values of myEditedDemandElement into fields
1730 if (myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_CAR_FOLLOW_MODEL).empty()) {
1731 myComboBoxCarFollowModel->setCurrentItem(0);
1732 } else {
1733 // set value
1734 const int index = myComboBoxCarFollowModel->findItem(myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_CAR_FOLLOW_MODEL).c_str());
1735 if (index == -1) {
1736 myComboBoxCarFollowModel->disable();
1737 } else {
1738 myComboBoxCarFollowModel->setCurrentItem(index);
1739 myComboBoxCarFollowModel->enable();
1740 }
1741 }
1742 // refresh fields
1743 refreshCFMFields();
1744 // update value in all Rows
1745 for (const auto& row : myRows) {
1746 row->updateValue();
1747 }
1748}
1749
1750
1751long
1753 // At start we assumed, that all values are valid
1754 myVehicleTypeDialog->myVehicleTypeValid = true;
1755 myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_NOTHING;
1756 // set color of myTextFieldCarFollowModel, depending if current value is valid or not
1757 if (myVehicleTypeDialog->myEditedDemandElement->isValid(SUMO_ATTR_CAR_FOLLOW_MODEL, myComboBoxCarFollowModel->getText().text())) {
1758 myComboBoxCarFollowModel->setTextColor(FXRGB(0, 0, 0));
1759 myVehicleTypeDialog->myEditedDemandElement->setAttribute(SUMO_ATTR_CAR_FOLLOW_MODEL, myComboBoxCarFollowModel->getText().text(), myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
1760 } else {
1761 myComboBoxCarFollowModel->setTextColor(FXRGB(255, 0, 0));
1762 myVehicleTypeDialog->myVehicleTypeValid = false;
1763 myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_CAR_FOLLOW_MODEL;
1764 }
1765 // set variable in all Rows
1766 for (const auto& row : myRows) {
1767 row->setVariable();
1768 }
1769 // refresh fields
1770 refreshCFMFields();
1771 return true;
1772}
1773
1774// ---------------------------------------------------------------------------
1775// GNEVehicleTypeDialog - public methods
1776// ---------------------------------------------------------------------------
1777
1778GNEVehicleTypeDialog::GNEVehicleTypeDialog(GNEDemandElement* editedVehicleType, bool updatingElement) :
1779 GNEDemandElementDialog(editedVehicleType, updatingElement, 1372, 575),
1780 myVehicleTypeValid(true),
1782
1783 // change default header
1785
1786 // Create auxiliar frames for values
1787 FXHorizontalFrame* columns = new FXHorizontalFrame(myContentFrame, GUIDesignAuxiliarHorizontalFrame);
1788
1789 // create vehicle type attributes
1790 myVTypeAttributes = new VTypeAttributes(this, columns);
1791
1792 // create car following model parameters
1794
1795 // start a undo list for editing local to this additional
1796 initChanges();
1797
1798 // add element if we aren't updating an existent element
1799 if (!myUpdatingElement) {
1801 }
1802
1803 // update values of Vehicle Type common attributes
1805
1806 // update values of Car Following Model Parameters
1808
1809 // open as modal dialog
1811}
1812
1813
1815
1816
1817long
1818GNEVehicleTypeDialog::onCmdAccept(FXObject*, FXSelector, void*) {
1819 if (!myVehicleTypeValid) {
1820 std::string operation1 = myUpdatingElement ? ("updating") : ("creating");
1821 std::string operation2 = myUpdatingElement ? ("updated") : ("created");
1822 std::string tagString = myEditedDemandElement->getTagStr();
1823 // open warning dialogBox
1824 FXMessageBox::warning(getApp(), MBOX_OK,
1825 ("Error " + operation1 + " " + tagString).c_str(), "%s",
1826 (tagString + " cannot be " + operation2 +
1827 " because parameter " + toString(myInvalidAttr) +
1828 " is invalid.").c_str());
1829 return 0;
1830 } else {
1831 // accept changes before closing dialog
1832 acceptChanges();
1833 // stop dialog successfully
1834 getApp()->stopModal(this, TRUE);
1835 return 1;
1836 }
1837}
1838
1839
1840long
1841GNEVehicleTypeDialog::onCmdCancel(FXObject*, FXSelector, void*) {
1842 // cancel changes
1843 cancelChanges();
1844 // Stop Modal
1845 getApp()->stopModal(this, FALSE);
1846 return 1;
1847}
1848
1849
1850long
1851GNEVehicleTypeDialog::onCmdReset(FXObject*, FXSelector, void*) {
1852 // reset changes
1853 resetChanges();
1854 // update values of Vehicle Type common attributes
1856 // update values of Car Following Model Parameters
1858 return 1;
1859}
1860
1861// ---------------------------------------------------------------------------
1862// GNEVehicleTypeDialog - private methods
1863// ---------------------------------------------------------------------------
1864
1866 FXHorizontalFrame(verticalFrame, GUIDesignAuxiliarHorizontalFrame),
1867 myCarFollowingModelParametersParent(carFollowingModelParametersParent),
1868 myAttr(attr),
1869 myTextField(nullptr) {
1870 new FXLabel(this, toString(attr).c_str(), nullptr, GUIDesignLabelThickedFixed(150));
1871 myTextField = new FXTextField(this, GUIDesignTextFieldNCol, carFollowingModelParametersParent, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFieldFixed(180));
1872}
1873
1874
1875void
1877 // set color of textField, depending if current value is valid or not
1878 if (myCarFollowingModelParametersParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, myTextField->getText().text())) {
1879 // set color depending if is a default value
1880 if (myCarFollowingModelParametersParent->myVehicleTypeDialog->myEditedDemandElement->getTagProperty()->getDefaultStringValue(myAttr) != myTextField->getText().text()) {
1881 myTextField->setTextColor(FXRGB(0, 0, 0));
1882 } else {
1883 myTextField->setTextColor(FXRGB(195, 195, 195));
1884 }
1885 myCarFollowingModelParametersParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, myTextField->getText().text(),
1886 myCarFollowingModelParametersParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
1887 // update value after setting it
1888 updateValue();
1889 } else {
1890 myTextField->setTextColor(FXRGB(255, 0, 0));
1891 // mark VType as invalid
1892 myCarFollowingModelParametersParent->myVehicleTypeDialog->myVehicleTypeValid = false;
1893 myCarFollowingModelParametersParent->myVehicleTypeDialog->myInvalidAttr = myAttr;
1894 }
1895}
1896
1897
1898void
1900 // set text of myTextField using current value of VType
1901 myTextField->setText(myCarFollowingModelParametersParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr).c_str());
1902 // set color depending if is a default value
1903 if (myCarFollowingModelParametersParent->myVehicleTypeDialog->myEditedDemandElement->getTagProperty()->getDefaultStringValue(myAttr) != myTextField->getText().text()) {
1904 myTextField->setTextColor(FXRGB(0, 0, 0));
1905 } else {
1906 myTextField->setTextColor(FXRGB(195, 195, 195));
1907 }
1908}
1909
1910
1911/****************************************************************************/
FXDEFMAP(GNEVehicleTypeDialog::VTypeAttributes) VTypeAttributesMap[]
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition GUIAppEnum.h:991
@ 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:65
#define GUIDesignComboBox
Definition GUIDesigns.h:293
#define GUIDesignComboBoxWidth180
comboBox with thick frame, width 180
Definition GUIDesigns.h:305
#define GUIDesignComboBoxNCol
number of column of every combo box
Definition GUIDesigns.h:311
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition GUIDesigns.h:399
#define GUIDesignLabelTickedIcon180x46
label ticked filled extended over frame used for VClasses/VShapes. (can be used by icons of 64x32 pix...
Definition GUIDesigns.h:276
#define GUIDesignLabelAboutInfoCenter
label extended over frame with thick and with text justify to center
Definition GUIDesigns.h:264
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition GUIDesigns.h:74
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
Definition GUIDesigns.h:346
#define GUIDesignAuxiliarVerticalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition GUIDesigns.h:408
#define GUIDesignComboBoxVisibleItems
Definition GUIDesigns.h:49
#define GUIDesignButtonFixed(width)
button rectangular with thick and raise frame with the given width
Definition GUIDesigns.h:97
#define GUIDesignAuxiliarFrame
design for auxiliar (Without borders) frame extended in all directions
Definition GUIDesigns.h:390
#define GUIDesignLabelThickedFixed(width)
label thicked, icon before text, text centered and custom width
Definition GUIDesigns.h:252
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:305
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
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.
virtual SUMOVehicleClass getVClass() const =0
obtain VClass related with this demand element
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:2195
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 * 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.
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.
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
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.
Dialog for editing calibrator vehicle types.
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
VTypeAttributes * myVTypeAttributes
Vehicle Type Common Attributes.
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 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
static const std::string colorValue
color dialog value
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 FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Definition MFXUtils.cpp:145
static RGBColor getRGBColor(FXColor col)
converts FXColor to RGBColor
Definition MFXUtils.cpp:139
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