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-2023 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// Dialog for edit vehicleTypes
19/****************************************************************************/
20
21#include <netedit/GNENet.h>
22#include <netedit/GNEUndoList.h>
23#include <netedit/GNEViewNet.h>
32
34
35
36// ===========================================================================
37// FOX callback mapping
38// ===========================================================================
39
45
49
50// Object implementation
51FXIMPLEMENT(GNEVehicleTypeDialog::VTypeAttributes, FXVerticalFrame, VTypeAttributesMap, ARRAYNUMBER(VTypeAttributesMap))
52FXIMPLEMENT(GNEVehicleTypeDialog::CarFollowingModelParameters, FXGroupBox, CarFollowingModelParametersMap, ARRAYNUMBER(CarFollowingModelParametersMap))
53
54// ===========================================================================
55// member method definitions
56// ===========================================================================
57
58// ---------------------------------------------------------------------------
59// GNEVehicleTypeDialog::VClassRow - methods
60// ---------------------------------------------------------------------------
61
62GNEVehicleTypeDialog::VTypeAttributes::VClassRow::VClassRow(VTypeAttributes* VTypeAttributesParent, FXVerticalFrame* column) :
63 FXHorizontalFrame(column, GUIDesignAuxiliarHorizontalFrame),
64 myVTypeAttributesParent(VTypeAttributesParent) {
65 // create two auxiliary frames
66 FXVerticalFrame* verticalFrameLabelAndComboBox = new FXVerticalFrame(this, GUIDesignAuxiliarVerticalFrame);
67 // create FXComboBox for VClass
68 new FXLabel(verticalFrameLabelAndComboBox, toString(SUMO_ATTR_VCLASS).c_str(), nullptr, GUIDesignLabelThickedFixed(150));
69 myComboBoxVClass = new MFXComboBoxIcon(verticalFrameLabelAndComboBox, GUIDesignComboBoxNCol, true,
70 VTypeAttributesParent, MID_GNE_SET_ATTRIBUTE, GUIDesignComboBox);
71 myComboBoxVClassLabelImage = new FXLabel(this, "", nullptr, GUIDesignLabelTickedIcon180x46);
72 myComboBoxVClassLabelImage->setBackColor(FXRGBA(255, 255, 255, 255));
73 // fill combo Box with all allowed VClass for the current edited VType
74 for (const auto& vClass : myVTypeAttributesParent->myVehicleTypeDialog->getEditedDemandElement()->getTagProperty().getAttributeProperties(SUMO_ATTR_VCLASS).getDiscreteValues()) {
75 myComboBoxVClass->appendIconItem(vClass.c_str(), VClassIcons::getVClassIcon(SumoVehicleClassStrings.get(vClass)));
76 }
77 // only show as maximum 10 VClasses
78 if (myComboBoxVClass->getNumItems() > 10) {
79 myComboBoxVClass->setNumVisible(10);
80 } else {
81 myComboBoxVClass->setNumVisible(myComboBoxVClass->getNumItems());
82 }
83}
84
85
88 // set color of myComboBoxVClass, depending if current value is valid or not
89 myComboBoxVClass->setTextColor(FXRGB(0, 0, 0));
91 myComboBoxVClass->setTextColor(FXRGB(0, 0, 0));
92 // check if VType has to be updated
94 // update VClass in VType
97 // update label image
99 // obtain default vType parameters
101 // check if mutable rows need to be updated
104 }
107 }
110 }
113 }
116 }
119 }
121 myVTypeAttributesParent->myWidth->updateValue(toString(defaultVTypeParameters.width));
122 }
125 }
128 }
131 }
134 }
137 }
140 }
141 // update GUIShape
142 if (myComboBoxVClass->getText().empty()) {
144 } else {
146 }
147 }
148 } else {
149 myComboBoxVClass->setTextColor(FXRGB(255, 0, 0));
152 }
154}
155
156
159 const auto vClass = myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_VCLASS);
160 int index = 0;
161 for (int i = 0; i < myComboBoxVClass->getNumItems(); i++) {
162 if (myComboBoxVClass->getItem(i).text() == vClass) {
163 index = i;
164 }
165 }
166 myComboBoxVClass->setCurrentItem(index);
167 setVClassLabelImage();
168 return myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getVClass();
169}
170
171
172void
174 // by default vClass is passenger
175 if (myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_VCLASS).empty()) {
176 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_PASSENGER));
177 } else {
178 // set Icon in label depending of current VClass
179 switch (myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getVClass()) {
180 case SVC_PRIVATE:
181 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_PRIVATE));
182 break;
183 case SVC_EMERGENCY:
184 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_EMERGENCY));
185 break;
186 case SVC_AUTHORITY:
187 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_AUTHORITY));
188 break;
189 case SVC_ARMY:
190 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_ARMY));
191 break;
192 case SVC_VIP:
193 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_VIP));
194 break;
195 case SVC_PASSENGER:
196 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_PASSENGER));
197 break;
198 case SVC_HOV:
199 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_HOV));
200 break;
201 case SVC_TAXI:
202 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_TAXI));
203 break;
204 case SVC_BUS:
205 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_BUS));
206 break;
207 case SVC_COACH:
208 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_COACH));
209 break;
210 case SVC_DELIVERY:
211 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_DELIVERY));
212 break;
213 case SVC_TRUCK:
214 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_TRUCK));
215 break;
216 case SVC_TRAILER:
217 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_TRAILER));
218 break;
219 case SVC_TRAM:
220 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_TRAM));
221 break;
222 case SVC_RAIL_URBAN:
223 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_RAIL_URBAN));
224 break;
225 case SVC_RAIL:
226 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_RAIL));
227 break;
229 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_RAIL_ELECTRIC));
230 break;
231 case SVC_RAIL_FAST:
232 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_RAIL_FAST));
233 break;
234 case SVC_MOTORCYCLE:
235 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_MOTORCYCLE));
236 break;
237 case SVC_MOPED:
238 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_MOPED));
239 break;
240 case SVC_BICYCLE:
241 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_BICYCLE));
242 break;
243 case SVC_PEDESTRIAN:
244 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_PEDESTRIAN));
245 break;
246 case SVC_E_VEHICLE:
247 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_EVEHICLE));
248 break;
249 case SVC_SHIP:
250 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_SHIP));
251 break;
252 case SVC_CUSTOM1:
253 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_CUSTOM1));
254 break;
255 case SVC_CUSTOM2:
256 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_CUSTOM2));
257 break;
258 default:
259 myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_IGNORING));
260 break;
261 }
262 }
263}
264
265// ---------------------------------------------------------------------------
266// GNEVehicleTypeDialog::VShapeRow - methods
267// ---------------------------------------------------------------------------
268
269GNEVehicleTypeDialog::VTypeAttributes::VShapeRow::VShapeRow(VTypeAttributes* VTypeAttributesParent, FXVerticalFrame* column) :
270 FXHorizontalFrame(column, GUIDesignAuxiliarHorizontalFrame),
271 myVTypeAttributesParent(VTypeAttributesParent) {
272 // create two auxiliar frames
273 FXVerticalFrame* verticalFrameLabelAndComboBox = new FXVerticalFrame(this, GUIDesignAuxiliarVerticalFrame);
274 // create combo for vehicle shapes
275 new FXLabel(verticalFrameLabelAndComboBox, toString(SUMO_ATTR_GUISHAPE).c_str(), nullptr, GUIDesignLabelThickedFixed(150));
276 myComboBoxShape = new MFXComboBoxIcon(verticalFrameLabelAndComboBox, GUIDesignComboBoxNCol, false,
277 VTypeAttributesParent, MID_GNE_SET_ATTRIBUTE, GUIDesignComboBox);
278 myComboBoxShapeLabelImage = new FXLabel(this, "", nullptr, GUIDesignLabelTickedIcon180x46);
279 myComboBoxShapeLabelImage->setBackColor(FXRGBA(255, 255, 255, 255));
280 // fill combo Box with all vehicle shapes
281 std::vector<std::string> VShapeStrings = SumoVehicleShapeStrings.getStrings();
282 for (const auto& VShapeString : VShapeStrings) {
283 if (VShapeString != SumoVehicleShapeStrings.getString(SUMOVehicleShape::UNKNOWN)) {
284 myComboBoxShape->appendIconItem(VShapeString.c_str(), nullptr);
285 }
286 }
287 // only show 10 Shapes
289}
290
291
292void
294 // set color of myComboBoxShape, depending if current value is valid or not
295 if (myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(SUMO_ATTR_GUISHAPE, myComboBoxShape->getText().text())) {
296 myComboBoxShape->setTextColor(FXRGB(0, 0, 0));
297 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(SUMO_ATTR_GUISHAPE, myComboBoxShape->getText().text(),
298 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
299 setVShapeLabelImage();
300 } else {
301 myComboBoxShape->setTextColor(FXRGB(255, 0, 0));
302 myVTypeAttributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
303 myVTypeAttributesParent->myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_GUISHAPE;
304 }
305}
306
307
308void
310 myComboBoxShape->setText(myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_GUISHAPE).c_str());
311 setVShapeLabelImage();
312}
313
314
315void
317 // create new VClassDefaultValues using the new VClass
319 myComboBoxShape->setText(SumoVehicleShapeStrings.getString(newVClass.shape).c_str());
320 myComboBoxShape->setTextColor(FXRGB(0, 0, 0));
321 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(SUMO_ATTR_GUISHAPE, myComboBoxShape->getText().text(),
322 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
323 setVShapeLabelImage();
324}
325
326
327void
329 // set Icon in label depending of current VClass
330 switch (getVehicleShapeID(myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_GUISHAPE))) {
332 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_UNKNOWN));
333 break;
335 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PEDESTRIAN));
336 break;
338 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_BICYCLE));
339 break;
341 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_MOPED));
342 break;
344 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_MOTORCYCLE));
345 break;
347 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PASSENGER));
348 break;
350 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PASSENGER_SEDAN));
351 break;
353 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PASSENGER_HATCHBACK));
354 break;
356 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PASSENGER_WAGON));
357 break;
359 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_PASSENGER_VAN));
360 break;
362 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_TAXI));
363 break;
365 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_DELIVERY));
366 break;
368 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_TRUCK));
369 break;
371 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_TRUCK_SEMITRAILER));
372 break;
374 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_TRUCK_1TRAILER));
375 break;
377 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_BUS));
378 break;
380 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_BUS_COACH));
381 break;
383 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_BUS_FLEXIBLE));
384 break;
386 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_BUS_TROLLEY));
387 break;
389 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_RAIL));
390 break;
392 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_RAIL_CAR));
393 break;
395 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_RAIL_CARGO));
396 break;
398 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_E_VEHICLE));
399 break;
401 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_ANT));
402 break;
404 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_SHIP));
405 break;
407 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_EMERGENCY));
408 break;
410 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_FIREBRIGADE));
411 break;
413 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_POLICE));
414 break;
416 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_RICKSHAW));
417 break;
419 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_SCOOTER));
420 break;
422 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VSHAPE_AIRCRAFT));
423 break;
424 default:
425 myComboBoxShapeLabelImage->setIcon(GUIIconSubSys::getIcon(GUIIcon::VCLASS_IGNORING));
426 break;
427 }
428}
429
430// ---------------------------------------------------------------------------
431// GNEVehicleTypeDialog::VTypeAttributes - methods
432// ---------------------------------------------------------------------------
433
434GNEVehicleTypeDialog::VTypeAttributes::VTypeAttributeRow::VTypeAttributeRow(VTypeAttributes* VTypeAttributesParent, FXVerticalFrame* verticalFrame, const SumoXMLAttr attr, const RowAttrType rowAttrType, const std::vector<std::string>& values) :
435 FXHorizontalFrame(verticalFrame, GUIDesignAuxiliarHorizontalFrame),
436 myVTypeAttributesParent(VTypeAttributesParent),
437 myAttr(attr),
438 myRowAttrType(rowAttrType),
439 myButton(nullptr),
440 myTextField(nullptr),
441 myComboBox(nullptr) {
442 // first check if we have to create a button or a label
443 if ((rowAttrType == ROWTYPE_COLOR) || (rowAttrType == ROWTYPE_FILENAME)) {
444 myButton = new FXButton(this, filterAttributeName(attr), nullptr, VTypeAttributesParent, MID_GNE_SET_ATTRIBUTE_DIALOG, GUIDesignButtonRectangular150);
445 } else if (rowAttrType == ROWTYPE_PARAMETERS) {
446 myButton = new FXButton(this, TL("Edit parameters"), nullptr, VTypeAttributesParent, MID_GNE_OPEN_PARAMETERS_DIALOG, GUIDesignButtonRectangular150);
447 } else {
448 new FXLabel(this, filterAttributeName(attr), nullptr, GUIDesignLabelThickedFixed(150));
449 }
450 // now check if we have to create a textfield or a ComboBox
451 if ((rowAttrType == ROWTYPE_STRING) || (rowAttrType == ROWTYPE_COLOR) || (rowAttrType == ROWTYPE_FILENAME) || (rowAttrType == ROWTYPE_PARAMETERS)) {
452 myTextField = new FXTextField(this, GUIDesignTextFieldNCol, VTypeAttributesParent, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFieldFixed(180));
453 } else if (rowAttrType == ROWTYPE_COMBOBOX) {
455 // fill combo Box with values
456 for (const auto& value : values) {
457 myComboBox->appendIconItem(value.c_str(), nullptr);
458 }
459 // set 10 visible elements as maximum
460 if (myComboBox->getNumItems() < 10) {
462 } else {
464 }
465 } else {
466 throw ProcessError(TL("Invalid row type"));
467 }
468}
469
470
471void
473 if (myRowAttrType == ROWTYPE_COMBOBOX) {
474 // set color of myComboBox, depending if current value is valid or not
475 if (myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, myComboBox->getText().text())) {
476 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, myComboBox->getText().text(),
477 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
478 // update value after setting it
479 updateValue();
480 } else {
481 myComboBox->setTextColor(FXRGB(255, 0, 0));
482 // mark VType as invalid
483 myVTypeAttributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
484 myVTypeAttributesParent->myVehicleTypeDialog->myInvalidAttr = myAttr;
485 }
486 } else if (myRowAttrType == ROWTYPE_COLOR) {
487 // set color of myTextFieldColor, depending if current value is valid or not
488 if (myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(SUMO_ATTR_COLOR, myTextField->getText().text())) {
489 // set color depending if is a default value
490 if (myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getTagProperty().getDefaultValue(SUMO_ATTR_COLOR) != myTextField->getText().text()) {
491 myTextField->setTextColor(FXRGB(0, 0, 0));
492 } else {
493 myTextField->setTextColor(FXRGB(195, 195, 195));
494 }
495 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(SUMO_ATTR_COLOR, myTextField->getText().text(), myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
496 } else {
497 myTextField->setTextColor(FXRGB(255, 0, 0));
498 myVTypeAttributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
499 myVTypeAttributesParent->myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_COLOR;
500 }
501 } else {
502 // set color of textField, depending if current value is valid or not
503 if (myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, myTextField->getText().text())) {
504 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, myTextField->getText().text(),
505 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
506 // update value after setting it
507 updateValue();
508 } else {
509 myTextField->setTextColor(FXRGB(255, 0, 0));
510 // mark VType as invalid
511 myVTypeAttributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
512 myVTypeAttributesParent->myVehicleTypeDialog->myInvalidAttr = myAttr;
513 }
514 }
515}
516
517
518void
520 if (myComboBox) {
521 // set color of myComboBox, depending if current value is valid or not
522 if (myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, myComboBox->getText().text())) {
523 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, myComboBox->getText().text(),
524 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
525 // update value after setting it
526 updateValue(defaultValue);
527 } else {
528 myComboBox->setTextColor(FXRGB(255, 0, 0));
529 // mark VType as invalid
530 myVTypeAttributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
531 myVTypeAttributesParent->myVehicleTypeDialog->myInvalidAttr = myAttr;
532 }
533 } else {
534 // set color of textField, depending if current value is valid or not
535 if (myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, myTextField->getText().text())) {
536 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, myTextField->getText().text(),
537 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
538 // update value after setting it
539 updateValue(defaultValue);
540 } else {
541 myTextField->setTextColor(FXRGB(255, 0, 0));
542 // mark VType as invalid
543 myVTypeAttributesParent->myVehicleTypeDialog->myVehicleTypeValid = false;
544 myVTypeAttributesParent->myVehicleTypeDialog->myInvalidAttr = myAttr;
545 }
546 }
547}
548
549
550void
552 if (myRowAttrType == ROWTYPE_COMBOBOX) {
553 // set text of myComboBox using current value of VType
554 myComboBox->setText(myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr).c_str());
555 // set color depending if is a default value
556 if (myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getTagProperty().getDefaultValue(myAttr) != myComboBox->getText().text()) {
557 myComboBox->setTextColor(FXRGB(0, 0, 0));
558 } else {
559 myComboBox->setTextColor(FXRGB(195, 195, 195));
560 }
561 } else if (myRowAttrType == ROWTYPE_COLOR) {
562 // set field color
563 myTextField->setText(myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr).c_str());
564 // set color depending if is a default value
565 if (myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getTagProperty().getDefaultValue(myAttr) != myTextField->getText().text()) {
566 myTextField->setTextColor(FXRGB(0, 0, 0));
567 } else {
568 myTextField->setTextColor(FXRGB(195, 195, 195));
569 }
570 } else if (myAttr == GNE_ATTR_PARAMETERS) {
571 // get parameters
572 const std::string& parametersStr = myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr);
573 // set text of myTextField using current value of VType
574 myTextField->setText(parametersStr.c_str());
575 // set text color
576 myTextField->setTextColor(FXRGB(0, 0, 0));
577 // clear parameters
578 myParameters.clear();
579 // separate value in a vector of string using | as separator
580 StringTokenizer parameters(parametersStr, "|", true);
581 // iterate over all values
582 while (parameters.hasNext()) {
583 // obtain key and value and save it in myParameters
584 const std::vector<std::string> keyValue = StringTokenizer(parameters.next(), "=", true).getVector();
585 if (keyValue.size() == 2) {
586 myParameters[keyValue.front()] = keyValue.back();
587 }
588 }
589 } else {
590 // set text of myTextField using current value of VType
591 myTextField->setText(myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr).c_str());
592 // set color depending if is a default value
593 if (myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getTagProperty().getDefaultValue(myAttr) != myTextField->getText().text()) {
594 myTextField->setTextColor(FXRGB(0, 0, 0));
595 } else {
596 myTextField->setTextColor(FXRGB(195, 195, 195));
597 }
598 }
599}
600
601
602void
604 if (myComboBox) {
605 // set text of myComboBox using current value of VType
606 myComboBox->setText(myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr).c_str());
607 // set color depending if is a default value
608 if (defaultValue != myComboBox->getText().text()) {
609 myComboBox->setTextColor(FXRGB(0, 0, 0));
610 } else {
611 myComboBox->setTextColor(FXRGB(195, 195, 195));
612 }
613 } else {
614 // set text of myTextField using current value of VType
615 myTextField->setText(myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr).c_str());
616 // set color depending if is a default value
617 if (defaultValue != myTextField->getText().text()) {
618 myTextField->setTextColor(FXRGB(0, 0, 0));
619 } else {
620 myTextField->setTextColor(FXRGB(195, 195, 195));
621 }
622 }
623}
624
625
626const FXButton*
630
631
632void
634 // create FXColorDialog
635 FXColorDialog colordialog(this, TL("Color Dialog"));
636 colordialog.setTarget(this);
637 // If previous attribute wasn't correct, set black as default color
638 if (GNEAttributeCarrier::canParse<RGBColor>(myTextField->getText().text())) {
639 colordialog.setRGBA(MFXUtils::getFXColor(GNEAttributeCarrier::parse<RGBColor>(myTextField->getText().text())));
640 } else {
641 colordialog.setRGBA(MFXUtils::getFXColor(RGBColor::BLACK));
642 }
643 // execute dialog to get a new color
644 if (colordialog.execute()) {
645 std::string newValue = toString(MFXUtils::getRGBColor(colordialog.getRGBA()));
646 myTextField->setText(newValue.c_str());
647 if (myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, newValue)) {
648 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, newValue, myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
649 // If previously value was incorrect, change font color to black
650 myTextField->setTextColor(FXRGB(0, 0, 0));
651 myTextField->killFocus();
652 }
653 }
654}
655
656
657void
659 // get the new image file
660 FXFileDialog opendialog(this, TL("Open Image"));
661 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::VTYPE));
662 opendialog.setSelectMode(SELECTFILE_EXISTING);
663 opendialog.setPatternList("All files (*)");
664 if (gCurrentFolder.length() != 0) {
665 opendialog.setDirectory(gCurrentFolder);
666 }
667 if (opendialog.execute()) {
668 // update global current folder
669 gCurrentFolder = opendialog.getDirectory();
670 // get image path
671 std::string imagePath = opendialog.getFilename().text();
672 // check if image is valid
673 if (myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, imagePath)) {
674 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, imagePath, myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
675 myTextField->setText(imagePath.c_str());
676 // If previously value was incorrect, change font color to black
677 myTextField->setTextColor(FXRGB(0, 0, 0));
678 myTextField->killFocus();
679 }
680 }
681}
682
683
684void
686 // get the new file name
687 FXFileDialog opendialog(this, TL("Open OSG File"));
688 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::VTYPE));
689 opendialog.setSelectMode(SELECTFILE_EXISTING);
690 opendialog.setPatternList("OSG file (*.obj)");
691 if (gCurrentFolder.length() != 0) {
692 opendialog.setDirectory(gCurrentFolder);
693 }
694 if (opendialog.execute()) {
695 // update global current folder
696 gCurrentFolder = opendialog.getDirectory();
697 // get image path
698 std::string imagePath = opendialog.getFilename().text();
699 // check if image is valid
700 if (myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, imagePath)) {
701 myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, imagePath, myVTypeAttributesParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
702 myTextField->setText(imagePath.c_str());
703 // If previously value was incorrect, change font color to black
704 myTextField->setTextColor(FXRGB(0, 0, 0));
705 myTextField->killFocus();
706 }
707 }
708}
709
710
711std::string
713 return myTextField->getText().text();
714}
715
716
717std::vector<std::pair<std::string, std::string> >
719 std::vector<std::pair<std::string, std::string> > result;
720 // Generate a vector string using the following structure: "<key1,value1>, <key2, value2>,...
721 for (const auto& parameter : myParameters) {
722 result.push_back(std::make_pair(parameter.first, parameter.second));
723 }
724 return result;
725}
726
727
728void
729GNEVehicleTypeDialog::VTypeAttributes::VTypeAttributeRow::setParameters(const std::vector<std::pair<std::string, std::string> >& parameters) {
730 // first clear parameters
731 myParameters.clear();
732 // declare result
733 std::string result;
734 // iterate over parameters
735 for (const auto& parameter : parameters) {
736 // Generate an string using the following structure: "key1=value1|key2=value2|...
737 result += parameter.first + "=" + parameter.second + "|";
738 // fill parameters
739 myParameters[parameter.first] = parameter.second;
740 }
741 // remove the last "|"
742 if (!result.empty()) {
743 result.pop_back();
744 }
745 // set text field
746 myTextField->setText(result.c_str());
747}
748
749
750FXString
752 switch (attr) {
753 // JM
755 return "crossingGap";
757 return "driveAfterYellowTime";
759 return "driveAfterRedTime";
761 return "driveRedSpeed";
763 return "ignoreKeepClearTime";
765 return "ignoreFoeSpeed";
767 return "ignoreFoeProb";
769 return "sigmaMinor";
771 return "timegapMinor";
772 // LCM
774 return "strategic";
776 return "cooperative";
778 return "speedGain";
780 return "keepRight";
782 return "sublane";
784 return "opposite";
786 return "pushy";
788 return "pushyGap";
790 return "assertive";
792 return "impatience";
794 return "timeToImpatience";
796 return "accelLat";
798 return "lookaheadLeft";
800 return "speedGainRight";
802 return "maxSpeedLatStanding";
804 return "maxSpeedLatFactor";
806 return "turnAlignDistance";
808 return "overtakeRight";
810 return "keepRightAcceptanceTime";
812 return "overtakeDeltaSpeedFactor";
813 /* case SUMO_ATTR_LCA_EXPERIMENTAL1:
814 return "experimental1";
815 */
816 default:
817 return toString(attr).c_str();
818 }
819}
820
821// ---------------------------------------------------------------------------
822// GNEVehicleTypeDialog::VTypeAttributes - methods
823// ---------------------------------------------------------------------------
824
826 FXVerticalFrame(column, GUIDesignAuxiliarVerticalFrame),
827 myVehicleTypeDialog(vehicleTypeDialog) {
828 // declare two auxiliary horizontal frames
829 FXHorizontalFrame* firstAuxiliarHorizontalFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
830 FXVerticalFrame* firstAuxiliarVerticalFrame = new FXVerticalFrame(firstAuxiliarHorizontalFrame, GUIDesignAuxiliarVerticalFrame);
831 // create attributes for common attributes
832 FXGroupBox* commonAttributes = new FXGroupBox(firstAuxiliarVerticalFrame, "Vehicle Type attributes", GUIDesignGroupBoxFrame);
833 // create horizontal frame for columns of attributes
834 FXHorizontalFrame* columnsBasicVTypeAttributes = new FXHorizontalFrame(commonAttributes, GUIDesignAuxiliarHorizontalFrame);
835 // build left attributes
836 buildAttributesA(new FXVerticalFrame(columnsBasicVTypeAttributes, GUIDesignAuxiliarFrame));
837 // build right attributes
838 buildAttributesB(new FXVerticalFrame(columnsBasicVTypeAttributes, GUIDesignAuxiliarFrame));
839 // create GroupBox for Junction Model Attributes
840 FXGroupBox* JMAttributes = new FXGroupBox(firstAuxiliarVerticalFrame, "Junction Model attributes", GUIDesignGroupBoxFrame);
841 // create horizontal frame for columns of Junction Model attributes
842 FXHorizontalFrame* columnsJMVTypeAttributes = new FXHorizontalFrame(JMAttributes, GUIDesignAuxiliarHorizontalFrame);
843 // build left attributes
844 buildJunctionModelAttributesA(new FXVerticalFrame(columnsJMVTypeAttributes, GUIDesignAuxiliarFrame));
845 // build right attributes
846 buildJunctionModelAttributesB(new FXVerticalFrame(columnsJMVTypeAttributes, GUIDesignAuxiliarFrame));
847 // create GroupBox for Junction Model Attributes
848 FXGroupBox* LCMAttributes = new FXGroupBox(firstAuxiliarHorizontalFrame, "Lane Change Model attributes", GUIDesignGroupBoxFrame);
849 // create Lane Change Model Attributes
850 buildLaneChangeModelAttributes(new FXVerticalFrame(LCMAttributes, GUIDesignAuxiliarFrame));
851}
852
853
854void
856 // 01 Create VClassRow
857 myVClassRow = new VClassRow(this, column);
858
859 // 02 create FXTextField and Label for vehicleTypeID
860 FXHorizontalFrame* row = new FXHorizontalFrame(column, GUIDesignAuxiliarHorizontalFrame);
861 new FXLabel(row, toString(SUMO_ATTR_ID).c_str(), nullptr, GUIDesignLabelThickedFixed(150));
862 myTextFieldVehicleTypeID = new FXTextField(row, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFieldFixed(180));
863
864 // 03 create FXTextField and Button for Color
865 myColor = new VTypeAttributeRow(this, column, SUMO_ATTR_COLOR, VTypeAttributeRow::RowAttrType::ROWTYPE_COLOR);
866
867 // 04 create FXTextField and Label for Length
868 myLength = new VTypeAttributeRow(this, column, SUMO_ATTR_LENGTH, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
869
870 // 05 create FXTextField and Label for MinGap
871 myMinGap = new VTypeAttributeRow(this, column, SUMO_ATTR_MINGAP, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
872
873 // 06 create FXTextField and Label for MaxSpeed
874 myMaxSpeed = new VTypeAttributeRow(this, column, SUMO_ATTR_MAXSPEED, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
875
876 // 07 create VTypeAttributeRow and Label for desired max speed
877 myDesiredMaxSpeed = new VTypeAttributeRow(this, column, SUMO_ATTR_DESIRED_MAXSPEED, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
878
879 // 08 create FXTextField and Label for SpeedFactor
880 mySpeedFactor = new VTypeAttributeRow(this, column, SUMO_ATTR_SPEEDFACTOR, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
881
882 // 09 create FXTextField and Label for EmissionClass
883 myEmissionClass = new VTypeAttributeRow(this, column, SUMO_ATTR_EMISSIONCLASS, VTypeAttributeRow::RowAttrType::ROWTYPE_COMBOBOX, PollutantsInterface::getAllClassesStr());
884
885 // 10 create FXTextField and Label for Width
886 myWidth = new VTypeAttributeRow(this, column, SUMO_ATTR_WIDTH, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
887
888 // 11 create FXTextField and Label for Height
889 myHeight = new VTypeAttributeRow(this, column, SUMO_ATTR_HEIGHT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
890
891 // 12 create FXTextField and Label for Filename
892 myFilename = new VTypeAttributeRow(this, column, SUMO_ATTR_IMGFILE, VTypeAttributeRow::RowAttrType::ROWTYPE_FILENAME);
893
894 // 13 create FXTextField and Label for Filename
895 myOSGFile = new VTypeAttributeRow(this, column, SUMO_ATTR_OSGFILE, VTypeAttributeRow::RowAttrType::ROWTYPE_FILENAME);
896
897 // 14 create VTypeAttributeRow and Label for LaneChangeModel
898 myLaneChangeModel = new VTypeAttributeRow(this, column, SUMO_ATTR_LANE_CHANGE_MODEL, VTypeAttributeRow::RowAttrType::ROWTYPE_COMBOBOX, SUMOXMLDefinitions::LaneChangeModels.getStrings());
899}
900
901
902void
904 // 01 Create VShapeRow
905 myVShapeRow = new VShapeRow(this, column);
906
907 // 02 create VTypeAttributeRow and Label for Probability
908 myProbability = new VTypeAttributeRow(this, column, SUMO_ATTR_PROB, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
909
910 // 03 create VTypeAttributeRow and Label for PersonCapacity
911 myPersonCapacity = new VTypeAttributeRow(this, column, SUMO_ATTR_PERSON_CAPACITY, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
912
913 // 04 create VTypeAttributeRow and Label for ContainerCapacity
914 myContainerCapacity = new VTypeAttributeRow(this, column, SUMO_ATTR_CONTAINER_CAPACITY, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
915
916 // 05 create VTypeAttributeRow and Label for BoardingDuration
917 myBoardingDuration = new VTypeAttributeRow(this, column, SUMO_ATTR_BOARDING_DURATION, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
918
919 // 06 create VTypeAttributeRow and Label for LoadingDuration
920 myLoadingDuration = new VTypeAttributeRow(this, column, SUMO_ATTR_LOADING_DURATION, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
921
922 // 07 create ComboBox and Label for LatAlignment
923 myLatAlignment = new VTypeAttributeRow(this, column, SUMO_ATTR_LATALIGNMENT, VTypeAttributeRow::RowAttrType::ROWTYPE_COMBOBOX, SUMOVTypeParameter::getLatAlignmentStrings());
924
925 // 08 create VTypeAttributeRow and Label for MinGapLat
926 myMinGapLat = new VTypeAttributeRow(this, column, SUMO_ATTR_MINGAP_LAT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
927
928 // 09 create VTypeAttributeRow and Label for MaxSpeedLat
929 myMaxSpeedLat = new VTypeAttributeRow(this, column, SUMO_ATTR_MAXSPEED_LAT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
930
931 // 10 create VTypeAttributeRow and Label for ActionStepLength
932 myActionStepLength = new VTypeAttributeRow(this, column, SUMO_ATTR_ACTIONSTEPLENGTH, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
933
934 // 11 create FXTextField and Label for Carriage length
935 myCarriageLength = new VTypeAttributeRow(this, column, SUMO_ATTR_CARRIAGE_LENGTH, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
936
937 // 12 create FXTextField and Label for Locomotive length
938 myLocomotiveLength = new VTypeAttributeRow(this, column, SUMO_ATTR_LOCOMOTIVE_LENGTH, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
939
940 // 13 create FXTextField and Label for carriage GAP
941 myCarriageGap = new VTypeAttributeRow(this, column, SUMO_ATTR_CARRIAGE_GAP, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
942
943 // 14 create FXTextField and Label for parameters
944 myParameters = new VTypeAttributeRow(this, column, GNE_ATTR_PARAMETERS, VTypeAttributeRow::RowAttrType::ROWTYPE_PARAMETERS);
945}
946
947
948void
950 // 01 create VTypeAttributeRow and Label for JMCrossingGap
951 myJMCrossingGap = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_CROSSING_GAP, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
952
953 // 02 create VTypeAttributeRow and Label for JMIgnoreKeepclearTime
954 myJMIgnoreKeepclearTime = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_IGNORE_KEEPCLEAR_TIME, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
955
956 // 03 create VTypeAttributeRow and Label for JMDriveAfterYellowTime
957 myJMDriveAfterYellowTime = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_DRIVE_AFTER_YELLOW_TIME, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
958
959 // 04 create VTypeAttributeRow and Label for JMDriveAfterRedTime
960 myJMDriveAfterRedTime = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_DRIVE_AFTER_RED_TIME, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
961
962 // 05 create VTypeAttributeRow and Label for JMDriveRedSpeed
963 myJMDriveRedSpeed = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_DRIVE_RED_SPEED, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
964}
965
966
967void
969 // 01 create VTypeAttributeRow and Label for JMIgnoreFoeProb
970 myJMIgnoreFoeProb = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_IGNORE_FOE_PROB, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
971
972 // 02 create VTypeAttributeRow and Label for JMIgnoreFoeSpeed
973 myJMIgnoreFoeSpeed = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_IGNORE_FOE_SPEED, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
974
975 // 03 create VTypeAttributeRow and Label for JMSigmaMinor
976 myJMSigmaMinor = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_SIGMA_MINOR, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
977
978 // 04 create VTypeAttributeRow and Label for JMTimeGapMinor
979 myJMTimeGapMinor = new VTypeAttributeRow(this, column, SUMO_ATTR_JM_TIMEGAP_MINOR, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
980
981 // 05 create VTypeAttributeRow and Label for Impatience
982 myJMImpatience = new VTypeAttributeRow(this, column, SUMO_ATTR_IMPATIENCE, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
983}
984
985
986void
988 // 01 create VTypeAttributeRow and Label for strategic param
989 myLCAStrategicParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_STRATEGIC_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
990
991 // 02 create VTypeAttributeRow and Label for cooperative param
992 myLCACooperativeParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_COOPERATIVE_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
993
994 // 03 create VTypeAttributeRow and Label for speed gain param
995 myLCASpeedgainParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_SPEEDGAIN_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
996
997 // 04 create VTypeAttributeRow and Label for keepright param
998 myLCAKeeprightParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_KEEPRIGHT_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
999
1000 // 05 create VTypeAttributeRow and Label for sublane param
1001 myLCASublaneParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_SUBLANE_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1002
1003 // 06 create VTypeAttributeRow and Label for opposite param
1004 myLCAOppositeParam = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_OPPOSITE_PARAM, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1005
1006 // 07 create VTypeAttributeRow and Label for pushy
1007 myLCAPushy = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_PUSHY, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1008
1009 // 08 create VTypeAttributeRow and Label for pushy gap
1010 myLCAPushygap = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_PUSHYGAP, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1011
1012 // 09 create VTypeAttributeRow and Label for assertive
1013 myLCAAssertive = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_ASSERTIVE, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1014
1015 // 10 create VTypeAttributeRow and Label for impatience
1016 myLCAImpatience = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_IMPATIENCE, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1017
1018 // 11 create VTypeAttributeRow and Label for time to impatience
1019 myLCATimeToImpatience = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_TIME_TO_IMPATIENCE, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1020
1021 // 12 create VTypeAttributeRow and Label for accel lat
1022 myLCAAccelLat = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_ACCEL_LAT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1023
1024 // 13 create VTypeAttributeRow and Label for look ahead lefth
1025 myLCALookAheadLeft = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_LOOKAHEADLEFT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1026
1027 // 14 create VTypeAttributeRow and Label for speed gain right
1028 myLCASpeedGainRight = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_SPEEDGAINRIGHT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1029
1030 // 15 create VTypeAttributeRow and Label for max speed lat standing
1031 myLCAMaxSpeedLatStanding = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_MAXSPEEDLATSTANDING, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1032
1033 // 16 create VTypeAttributeRow and Label for max speed lat factor
1034 myLCAMaxSpeedLatFactor = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_MAXSPEEDLATFACTOR, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1035
1036 // 17 create VTypeAttributeRow and Label for turn alignment distance
1037 myLCATurnAlignmentDistance = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_TURN_ALIGNMENT_DISTANCE, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1038
1039 // 18 create VTypeAttributeRow and Label for overtake right
1040 myLCAOvertakeRight = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_OVERTAKE_RIGHT, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1041
1042 // 19 create VTypeAttributeRow and Label for keep right acceptance time
1043 myLCAKeepRightAcceptanceTime = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_KEEPRIGHT_ACCEPTANCE_TIME, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1044
1045 // 20 create VTypeAttributeRow and Label for overtake deltaspeed factor
1046 myLCAOvertakeDeltaSpeedFactor = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_OVERTAKE_DELTASPEED_FACTOR, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING);
1047
1048 // 21 create VTypeAttributeRow and Label for experimental
1049 /* myLCAExperimental = new VTypeAttributeRow(this, column, SUMO_ATTR_LCA_EXPERIMENTAL1, VTypeAttributeRow::RowAttrType::ROWTYPE_STRING); */
1050}
1051
1052
1053void
1055 //set values of myEditedDemandElement into fields
1056 myTextFieldVehicleTypeID->setText(myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_ID).c_str());
1057 // set variables of special rows VClass and VShape
1058 SUMOVTypeParameter::VClassDefaultValues defaultVTypeParameters(myVClassRow->updateValue());
1059 myVShapeRow->updateValues();
1060 // update rows
1061 myLaneChangeModel->updateValue();
1062 myLatAlignment->updateValue(toString(defaultVTypeParameters.latAlignmentProcedure));
1063 myColor->updateValue();
1064 myLength->updateValue(toString(defaultVTypeParameters.length));
1065 myMinGap->updateValue(toString(defaultVTypeParameters.minGap));
1066 myMaxSpeed->updateValue(toString(defaultVTypeParameters.maxSpeed));
1067 myDesiredMaxSpeed->updateValue(toString(defaultVTypeParameters.desiredMaxSpeed));
1068 mySpeedFactor->updateValue(toString(defaultVTypeParameters.speedFactor.getParameter()[0]));
1069 myEmissionClass->updateValue(toString(defaultVTypeParameters.emissionClass));
1070 myWidth->updateValue(toString(defaultVTypeParameters.width));
1071 myHeight->updateValue(toString(defaultVTypeParameters.height));
1072 myFilename->updateValue();
1073 myOSGFile->updateValue(toString(defaultVTypeParameters.osgFile));
1074 myPersonCapacity->updateValue(toString(defaultVTypeParameters.personCapacity));
1075 myContainerCapacity->updateValue(toString(defaultVTypeParameters.containerCapacity));
1076 myCarriageLength->updateValue(toString(defaultVTypeParameters.carriageLength));
1077 myLocomotiveLength->updateValue(toString(defaultVTypeParameters.locomotiveLength));
1078 myBoardingDuration->updateValue();
1079 myLoadingDuration->updateValue();
1080 myMinGapLat->updateValue();
1081 myMaxSpeedLat->updateValue();
1082 myActionStepLength->updateValue();
1083 myProbability->updateValue();
1084 myCarriageGap->updateValue();
1085 // JM Parameters
1086 myJMCrossingGap->updateValue();
1087 myJMIgnoreKeepclearTime->updateValue();
1088 myJMDriveAfterYellowTime->updateValue();
1089 myJMDriveAfterRedTime->updateValue();
1090 myJMDriveRedSpeed->updateValue();
1091 myJMIgnoreFoeProb->updateValue();
1092 myJMIgnoreFoeSpeed->updateValue();
1093 myJMSigmaMinor->updateValue();
1094 myJMTimeGapMinor->updateValue();
1095 myJMImpatience->updateValue();
1096 // LCM Attributes
1097 myLCAStrategicParam->updateValue();
1098 myLCACooperativeParam->updateValue();
1099 myLCASpeedgainParam->updateValue();
1100 myLCAKeeprightParam->updateValue();
1101 myLCASublaneParam->updateValue();
1102 myLCAOppositeParam->updateValue();
1103 myLCAPushy->updateValue();
1104 myLCAPushygap->updateValue();
1105 myLCAAssertive->updateValue();
1106 myLCAImpatience->updateValue();
1107 myLCATimeToImpatience->updateValue();
1108 myLCAAccelLat->updateValue();
1109 myLCALookAheadLeft->updateValue();
1110 myLCASpeedGainRight->updateValue();
1111 myLCAMaxSpeedLatStanding->updateValue();
1112 myLCAMaxSpeedLatFactor->updateValue();
1113 myLCATurnAlignmentDistance->updateValue();
1114 myLCAOvertakeRight->updateValue();
1115 myLCAKeepRightAcceptanceTime->updateValue();
1116 myLCAOvertakeDeltaSpeedFactor->updateValue();
1117 /* myLCAExperimental->updateValue(); */
1118 // parameters
1119 myParameters->updateValue();
1120}
1121
1122
1123long
1125 // At start we assumed, that all values are valid
1126 myVehicleTypeDialog->myVehicleTypeValid = true;
1127 myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_NOTHING;
1128 // set color of myTextFieldVehicleTypeID, depending if current value is valid or not
1129 if (myVehicleTypeDialog->myEditedDemandElement->isValid(SUMO_ATTR_ID, myTextFieldVehicleTypeID->getText().text())) {
1130 myTextFieldVehicleTypeID->setTextColor(FXRGB(0, 0, 0));
1131 myVehicleTypeDialog->myEditedDemandElement->setAttribute(SUMO_ATTR_ID, myTextFieldVehicleTypeID->getText().text(), myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
1132 } else if (myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_ID) == myTextFieldVehicleTypeID->getText().text()) {
1133 myTextFieldVehicleTypeID->setTextColor(FXRGB(0, 0, 0));
1134 myVehicleTypeDialog->myEditedDemandElement->setAttribute(SUMO_ATTR_ID, myTextFieldVehicleTypeID->getText().text(), myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
1135 } else {
1136 myTextFieldVehicleTypeID->setTextColor(FXRGB(255, 0, 0));
1137 myVehicleTypeDialog->myVehicleTypeValid = false;
1138 myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_ID;
1139 }
1140 // set variables of special rows VClass and VShape
1141 SUMOVTypeParameter::VClassDefaultValues defaultVTypeParameters(myVClassRow->setVariable());
1142 // set variables of special rows VShape
1143 myVShapeRow->setVariable();
1144 // set attributes in rest rows
1145 myColor->setVariable();
1146 myLength->setVariable(toString(defaultVTypeParameters.length));
1147 myMinGap->setVariable(toString(defaultVTypeParameters.minGap));
1148 myMaxSpeed->setVariable(toString(defaultVTypeParameters.maxSpeed));
1149 myDesiredMaxSpeed->setVariable(toString(defaultVTypeParameters.desiredMaxSpeed));
1150 mySpeedFactor->setVariable(toString(defaultVTypeParameters.speedFactor.getParameter()[0]));
1151 myEmissionClass->setVariable(toString(defaultVTypeParameters.emissionClass));
1152 myWidth->setVariable(toString(defaultVTypeParameters.width));
1153 myHeight->setVariable(toString(defaultVTypeParameters.height));
1154 myOSGFile->setVariable(toString(defaultVTypeParameters.osgFile));
1155 // set attributes in rows
1156 myLaneChangeModel->setVariable();
1157 myLatAlignment->setVariable(toString(defaultVTypeParameters.latAlignmentProcedure));
1158 myLength->setVariable(toString(defaultVTypeParameters.length));
1159 myMinGap->setVariable(toString(defaultVTypeParameters.minGap));
1160 myMaxSpeed->setVariable(toString(defaultVTypeParameters.maxSpeed));
1161 mySpeedFactor->setVariable(toString(defaultVTypeParameters.speedFactor.getParameter()[0]));
1162 myEmissionClass->setVariable(toString(defaultVTypeParameters.emissionClass));
1163 myWidth->setVariable(toString(defaultVTypeParameters.width));
1164 myHeight->setVariable(toString(defaultVTypeParameters.height));
1165 myFilename->setVariable();
1166 myOSGFile->setVariable(toString(defaultVTypeParameters.osgFile));
1167 myPersonCapacity->setVariable(toString(defaultVTypeParameters.personCapacity));
1168 myContainerCapacity->setVariable(toString(defaultVTypeParameters.containerCapacity));
1169 myCarriageLength->setVariable(toString(defaultVTypeParameters.carriageLength));
1170 myLocomotiveLength->setVariable(toString(defaultVTypeParameters.locomotiveLength));
1171 myBoardingDuration->setVariable();
1172 myLoadingDuration->setVariable();
1173 myMinGapLat->setVariable();
1174 myMaxSpeedLat->setVariable();
1175 myActionStepLength->setVariable();
1176 myProbability->setVariable();
1177 myCarriageGap->setVariable();
1178 // JM Variables
1179 myJMCrossingGap->setVariable();
1180 myJMIgnoreKeepclearTime->setVariable();
1181 myJMDriveAfterYellowTime->setVariable();
1182 myJMDriveAfterRedTime->setVariable();
1183 myJMDriveRedSpeed->setVariable();
1184 myJMIgnoreFoeProb->setVariable();
1185 myJMIgnoreFoeSpeed->setVariable();
1186 myJMSigmaMinor->setVariable();
1187 myJMTimeGapMinor->setVariable();
1188 myJMImpatience->setVariable();
1189 // LCM Attributes
1190 myLCAStrategicParam->setVariable();
1191 myLCACooperativeParam->setVariable();
1192 myLCASpeedgainParam->setVariable();
1193 myLCAKeeprightParam->setVariable();
1194 myLCASublaneParam->setVariable();
1195 myLCAOppositeParam->setVariable();
1196 myLCAPushy->setVariable();
1197 myLCAPushygap->setVariable();
1198 myLCAAssertive->setVariable();
1199 myLCAImpatience->setVariable();
1200 myLCATimeToImpatience->setVariable();
1201 myLCAAccelLat->setVariable();
1202 myLCALookAheadLeft->setVariable();
1203 myLCASpeedGainRight->setVariable();
1204 myLCAMaxSpeedLatStanding->setVariable();
1205 myLCAMaxSpeedLatFactor->setVariable();
1206 myLCATurnAlignmentDistance->setVariable();
1207 myLCAOvertakeRight->setVariable();
1208 myLCAKeepRightAcceptanceTime->setVariable();
1209 myLCAOvertakeDeltaSpeedFactor->setVariable();
1210 /* myLCAExperimental->setVariable(); */
1211 myParameters->setVariable();
1212 return true;
1213}
1214
1215
1216long
1218 // check what dialog has to be opened
1219 if (obj == myColor->getButton()) {
1220 myColor->openColorDialog();
1221 } else if (obj == myFilename->getButton()) {
1222 myFilename->openImageFileDialog();
1223 } else if (obj == myOSGFile->getButton()) {
1224 myFilename->openOSGFileDialog();
1225 }
1226 return 1;
1227}
1228
1229
1230long
1232 // write debug information
1233 WRITE_DEBUG("Open parameters dialog");
1234 // edit parameters using dialog
1235 if (GNESingleParametersDialog(myParameters, myVehicleTypeDialog->getEditedDemandElement()->getNet()->getViewNet()).execute()) {
1236 // write debug information
1237 WRITE_DEBUG("Close parameters dialog");
1238 // set values edited in Parameter dialog in Edited AC
1239 myVehicleTypeDialog->getEditedDemandElement()->setAttribute(GNE_ATTR_PARAMETERS, myParameters->getParametersStr(), myVehicleTypeDialog->getEditedDemandElement()->getNet()->getViewNet()->getUndoList());
1240 } else {
1241 // write debug information
1242 WRITE_DEBUG("Cancel parameters dialog");
1243 }
1244 return 1;
1245}
1246
1247// ---------------------------------------------------------------------------
1248// GNEVehicleTypeDialog::VShapeRow - methods
1249// ---------------------------------------------------------------------------
1250
1252 FXGroupBox(column, "Car Following Model attributes", GUIDesignGroupBoxFrame),
1253 myVehicleTypeDialog(vehicleTypeDialog) {
1254
1255 // create vertical frame for rows
1256 myVerticalFrameRows = new FXVerticalFrame(this, GUIDesignAuxiliarFrame);
1257
1258 // declare combo box
1259 FXHorizontalFrame* row = new FXHorizontalFrame(myVerticalFrameRows, GUIDesignAuxiliarHorizontalFrame);
1260 new FXLabel(row, "Algorithm", nullptr, GUIDesignLabelThickedFixed(150));
1262
1263 // fill combo Box with all Car following models
1264 std::vector<std::string> CFModels = SUMOXMLDefinitions::CarFollowModels.getStrings();
1265 for (const auto& CFModel : CFModels) {
1266 myComboBoxCarFollowModel->appendIconItem(CFModel.c_str(), nullptr);
1267 }
1269
1270 // 01 create FX and Label for Accel
1272 myRows.push_back(myAccelRow);
1273
1274 // 02 create FX and Label for Decel
1276 myRows.push_back(myDecelRow);
1277
1278 // 03 create FX and Label for Apparent decel
1280 myRows.push_back(myApparentDecelRow);
1281
1282 // 04 create FX and Label for emergency decel
1284 myRows.push_back(myEmergencyDecelRow);
1285
1286 // 05 create FX and Label for Sigma
1288 myRows.push_back(mySigmaRow);
1289
1290 // 06 create FX and Label for Tau
1292 myRows.push_back(myTauRow);
1293
1294 // 07 myMinGapFactor FX and Label for MinGapFactor
1296 myRows.push_back(myMinGapFactorRow);
1297
1298 // 08 create FX and Label for K
1300 myRows.push_back(myKRow);
1301
1302 // 09 create FX and Label for PHI
1304 myRows.push_back(myPhiRow);
1305
1306 // 10 create FX and Label for Deleta
1308 myRows.push_back(myDeltaRow);
1309
1310 // 11 create FX and Label for Stepping
1312 myRows.push_back(mySteppingRow);
1313
1314 // 12 create FX and Label for Security
1316 myRows.push_back(mySecurityRow);
1317
1318 // 13 create FX and Label for Estimation
1320 myRows.push_back(myEstimationRow);
1321
1322 // 14 create FX and Label for TMP1
1324 myRows.push_back(myTmp1Row);
1325
1326 // 15 create FX and Label for TMP2
1328 myRows.push_back(myTmp2Row);
1329
1330 // 16 create FX and Label for TMP3
1332 myRows.push_back(myTmp3Row);
1333
1334 // 17 create FX and Label for TMP4
1336 myRows.push_back(myTmp4Row);
1337
1338 // 18 create FX and Label for TMP5
1340 myRows.push_back(myTmp5Row);
1341
1342 // 19 create FX and Label for trainType (allow strings)
1344 myRows.push_back(myTrainTypeRow);
1345
1346 // 20 create FX and Label for Tau Last
1348 myRows.push_back(myTrauLastRow);
1349
1350 // 21 create FX and Label for Aprob
1352 myRows.push_back(myAprobRow);
1353
1354 // 22 create FX and Label for Adapt Factor
1356 myRows.push_back(myAdaptFactorRow);
1357
1358 // 23 create FX and Label for Adapt Time
1360 myRows.push_back(myAdaptTimeRow);
1361
1362 // 24 create FX and Label for W99 CC 01
1364 myRows.push_back(myW99CC1);
1365
1366 // 25 create FX and Label for W99 CC 02
1368 myRows.push_back(myW99CC2);
1369
1370 // 26 create FX and Label for W99 CC 03
1372 myRows.push_back(myW99CC3);
1373
1374 // 27 create FX and Label for W99 CC 04
1376 myRows.push_back(myW99CC4);
1377
1378 // 28 create FX and Label for W99 CC 05
1380 myRows.push_back(myW99CC5);
1381
1382 // 29 create FX and Label for W99 CC 06
1384 myRows.push_back(myW99CC6);
1385
1386 // 30 create FX and Label for W99 CC 07
1388 myRows.push_back(myW99CC7);
1389
1390 // 31 create FX and Label for W99 CC 08
1392 myRows.push_back(myW99CC8);
1393
1394 // 32 create FX and Label for W99 CC 09
1396 myRows.push_back(myW99CC9);
1397
1398 // X1 create FX and Label for Look ahead/preview Time
1400 myRows.push_back(myTpreviewRow);
1401
1402 // X2 create FX and Label for Reaction Time
1404 myRows.push_back(myTreactionRow);
1405
1406 // X3 create FX and Label for Wiener Process Driving Error
1408 myRows.push_back(myTPersDriveRow);
1409
1410 // X4 create FX and Label for Wiener Process Estimation Error
1412 myRows.push_back(myTPersEstimateRow);
1413
1414 // X5 create FX and Label for Coolness parameter
1416 myRows.push_back(myCcoolnessRow);
1417
1418 // X6 create FX and Label for leader speed estimation error
1420 myRows.push_back(mySigmaleaderRow);
1421
1422 // X7 create FX and Label for Gap estimation error
1424 myRows.push_back(mySigmagapRow);
1425
1426 // X8 create FX and Label for Driving Error
1428 myRows.push_back(mySigmaerrorRow);
1429
1430 // X9 create FX and Label for max jerk
1432 myRows.push_back(myJerkmaxRow);
1433
1434 // X10 create FX and Label for AP Driver Update threshold
1436 myRows.push_back(myEpsilonaccRow);
1437
1438 // X11 create FX and Label for Startup Time to acc_max
1440 myRows.push_back(myTaccmaxRow);
1441
1442 // X12 create FX and Label for Startup M flatness
1444 myRows.push_back(myMflatnessRow);
1445
1446 // X13 create FX and Label for Startup M begin
1448 myRows.push_back(myMbeginRow);
1449
1450 // X14 create FX and Label for using vehicle dynamics
1452 myRows.push_back(myUseVehDynamicsRow);
1453
1454 // X14 create FX and Label for using vehicle dynamics
1456 myRows.push_back(myMaxVehPreviewRow);
1457
1458 // create myLabelIncompleteAttribute
1459 myLabelIncompleteAttribute = new FXLabel(myVerticalFrameRows, "Some attributes wasn't\nimplemented yet", nullptr, GUIDesignLabelAboutInfoCenter);
1461
1462 // show or hide ComboBox depending of current selected CFM
1464}
1465
1466
1467void
1469 // start hiding all rows
1470 for (const auto& row : myRows) {
1471 row->hide();
1472 }
1473 // hide myLabelIncompleteAttribute
1474 myLabelIncompleteAttribute->hide();
1475 // show textfield depending of current CFM
1476 if (SUMOXMLDefinitions::CarFollowModels.hasString(myComboBoxCarFollowModel->getText().text())) {
1477 // show textfield depending of selected CFM
1478 switch (SUMOXMLDefinitions::CarFollowModels.get(myComboBoxCarFollowModel->getText().text())) {
1479 case SUMO_TAG_CF_KRAUSS:
1482 myTauRow->show();
1483 myAccelRow->show();
1484 myDecelRow->show();
1485 myApparentDecelRow->show();
1486 myEmergencyDecelRow->show();
1487 mySigmaRow->show();
1488 break;
1490 myTauRow->show();
1491 myTmp1Row->show();
1492 myTmp2Row->show();
1493 myTmp3Row->show();
1494 myTmp4Row->show();
1495 myTmp5Row->show();
1496 break;
1499 myTauRow->show();
1500 myAccelRow->show();
1501 myDecelRow->show();
1502 myEmergencyDecelRow->show();
1503 mySigmaRow->show();
1504 myMinGapFactorRow->show();
1505 myTmp1Row->show();
1506 myTmp2Row->show();
1507 myTmp3Row->show();
1508 myTmp4Row->show();
1509 myTmp5Row->show();
1510 break;
1512 myTauRow->show();
1513 myAccelRow->show();
1514 myDecelRow->show();
1515 myEmergencyDecelRow->show();
1516 mySigmaRow->show();
1517 myMinGapFactorRow->show();
1518 myTrauLastRow->show();
1519 myAprobRow->show();
1520 break;
1521 case SUMO_TAG_CF_IDM:
1522 myTauRow->show();
1523 myAccelRow->show();
1524 myDecelRow->show();
1525 myEmergencyDecelRow->show();
1526 myDeltaRow->show();
1527 mySteppingRow->show();
1528 myMinGapFactorRow->show();
1529 break;
1530 case SUMO_TAG_CF_IDMM:
1531 myTauRow->show();
1532 myAccelRow->show();
1533 myDecelRow->show();
1534 myEmergencyDecelRow->show();
1535 myDeltaRow->show();
1536 mySteppingRow->show();
1537 myMinGapFactorRow->show();
1538 myAdaptFactorRow->show();
1539 myAdaptTimeRow->show();
1540 break;
1541 case SUMO_TAG_CF_EIDM:
1542 myTauRow->show();
1543 myAccelRow->show();
1544 myDecelRow->show();
1545 myEmergencyDecelRow->show();
1546 myDeltaRow->show();
1547 mySteppingRow->show();
1548 myMinGapFactorRow->show();
1549 myTpreviewRow->show();
1550 myTreactionRow->show();
1551 myTPersDriveRow->show();
1552 myTPersEstimateRow->show();
1553 myCcoolnessRow->show();
1554 mySigmaleaderRow->show();
1555 mySigmagapRow->show();
1556 mySigmaerrorRow->show();
1557 myJerkmaxRow->show();
1558 myEpsilonaccRow->show();
1559 myTaccmaxRow->show();
1560 myMflatnessRow->show();
1561 myMbeginRow->show();
1562 myUseVehDynamicsRow->show();
1563 myMaxVehPreviewRow->show();
1564 break;
1566 myTauRow->show();
1567 myAccelRow->show();
1568 myDecelRow->show();
1569 myEmergencyDecelRow->show();
1570 myKRow->show();
1571 myPhiRow->show();
1572 myMinGapFactorRow->show();
1573 break;
1575 myTauRow->show();
1576 myAccelRow->show();
1577 myDecelRow->show();
1578 myEmergencyDecelRow->show();
1579 myMinGapFactorRow->show();
1580 mySecurityRow->show();
1581 myEstimationRow->show();
1582 break;
1583 case SUMO_TAG_CF_W99:
1584 myW99CC1->show();
1585 myW99CC2->show();
1586 myW99CC3->show();
1587 myW99CC4->show();
1588 myW99CC5->show();
1589 myW99CC6->show();
1590 myW99CC7->show();
1591 myW99CC8->show();
1592 myW99CC9->show();
1593 break;
1594 case SUMO_TAG_CF_RAIL:
1595 myTauRow->show();
1596 myTrainTypeRow->show();
1597 break;
1598 case SUMO_TAG_CF_ACC:
1599 myTauRow->show();
1600 myAccelRow->show();
1601 myDecelRow->show();
1602 myEmergencyDecelRow->show();
1603 myMinGapFactorRow->show();
1604 // show myLabelIncompleteAttribute
1605 myLabelIncompleteAttribute->show();
1616 break;
1617 case SUMO_TAG_CF_CACC:
1618 myTauRow->show();
1619 myAccelRow->show();
1620 myDecelRow->show();
1621 myEmergencyDecelRow->show();
1622 myMinGapFactorRow->show();
1623 // show myLabelIncompleteAttribute
1624 myLabelIncompleteAttribute->show();
1641 break;
1642 case SUMO_TAG_CF_CC:
1643 myTauRow->show();
1644 myAccelRow->show();
1645 myDecelRow->show();
1646 // show myLabelIncompleteAttribute
1647 myLabelIncompleteAttribute->show();
1669 break;
1670 default:
1671 break;
1672 }
1673 }
1674 myVerticalFrameRows->recalc();
1675 update();
1676}
1677
1678
1679void
1681 //set values of myEditedDemandElement into fields
1682 if (myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_CAR_FOLLOW_MODEL).empty()) {
1683 myComboBoxCarFollowModel->setCurrentItem(0);
1684 } else {
1685 myComboBoxCarFollowModel->setText(myVehicleTypeDialog->myEditedDemandElement->getAttribute(SUMO_ATTR_CAR_FOLLOW_MODEL).c_str());
1686 }
1687 // refresh fields
1688 refreshCFMFields();
1689 // update value in all Rows
1690 for (const auto& row : myRows) {
1691 row->updateValue();
1692 }
1693}
1694
1695
1696long
1698 // At start we assumed, that all values are valid
1699 myVehicleTypeDialog->myVehicleTypeValid = true;
1700 myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_NOTHING;
1701 // set color of myTextFieldCarFollowModel, depending if current value is valid or not
1702 if (myVehicleTypeDialog->myEditedDemandElement->isValid(SUMO_ATTR_CAR_FOLLOW_MODEL, myComboBoxCarFollowModel->getText().text())) {
1703 myComboBoxCarFollowModel->setTextColor(FXRGB(0, 0, 0));
1704 myVehicleTypeDialog->myEditedDemandElement->setAttribute(SUMO_ATTR_CAR_FOLLOW_MODEL, myComboBoxCarFollowModel->getText().text(), myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
1705 } else {
1706 myComboBoxCarFollowModel->setTextColor(FXRGB(255, 0, 0));
1707 myVehicleTypeDialog->myVehicleTypeValid = false;
1708 myVehicleTypeDialog->myInvalidAttr = SUMO_ATTR_CAR_FOLLOW_MODEL;
1709 }
1710 // set variable in all Rows
1711 for (const auto& row : myRows) {
1712 row->setVariable();
1713 }
1714 // refresh fields
1715 refreshCFMFields();
1716 return true;
1717}
1718
1719// ---------------------------------------------------------------------------
1720// GNEVehicleTypeDialog - public methods
1721// ---------------------------------------------------------------------------
1722
1723GNEVehicleTypeDialog::GNEVehicleTypeDialog(GNEDemandElement* editedVehicleType, bool updatingElement) :
1724 GNEDemandElementDialog(editedVehicleType, updatingElement, 1372, 575),
1725 myVehicleTypeValid(true),
1727
1728 // change default header
1730
1731 // Create auxiliar frames for values
1732 FXHorizontalFrame* columns = new FXHorizontalFrame(myContentFrame, GUIDesignAuxiliarHorizontalFrame);
1733
1734 // create vehicle type attributes
1735 myVTypeAttributes = new VTypeAttributes(this, columns);
1736
1737 // create car following model parameters
1739
1740 // start a undo list for editing local to this additional
1741 initChanges();
1742
1743 // add element if we aren't updating an existent element
1744 if (myUpdatingElement == false) {
1746 }
1747
1748 // update values of Vehicle Type common attributes
1750
1751 // update values of Car Following Model Parameters
1753
1754 // open as modal dialog
1756}
1757
1758
1760
1761
1762long
1763GNEVehicleTypeDialog::onCmdAccept(FXObject*, FXSelector, void*) {
1764 if (myVehicleTypeValid == false) {
1765 // write warning if netedit is running in testing mode
1766 WRITE_DEBUG("Opening FXMessageBox of type 'warning'");
1767 std::string operation1 = myUpdatingElement ? ("updating") : ("creating");
1768 std::string operation2 = myUpdatingElement ? ("updated") : ("created");
1769 std::string tagString = myEditedDemandElement->getTagStr();
1770 // open warning dialogBox
1771 FXMessageBox::warning(getApp(), MBOX_OK,
1772 ("Error " + operation1 + " " + tagString).c_str(), "%s",
1773 (tagString + " cannot be " + operation2 +
1774 " because parameter " + toString(myInvalidAttr) +
1775 " is invalid.").c_str());
1776 // write warning if netedit is running in testing mode
1777 WRITE_DEBUG("Closed FXMessageBox of type 'warning' with 'OK'");
1778 return 0;
1779 } else {
1780 // accept changes before closing dialog
1781 acceptChanges();
1782 // stop dialog successfully
1783 getApp()->stopModal(this, TRUE);
1784 return 1;
1785 }
1786}
1787
1788
1789long
1790GNEVehicleTypeDialog::onCmdCancel(FXObject*, FXSelector, void*) {
1791 // cancel changes
1792 cancelChanges();
1793 // Stop Modal
1794 getApp()->stopModal(this, FALSE);
1795 return 1;
1796}
1797
1798
1799long
1800GNEVehicleTypeDialog::onCmdReset(FXObject*, FXSelector, void*) {
1801 // reset changes
1802 resetChanges();
1803 // update values of Vehicle Type common attributes
1805 // update values of Car Following Model Parameters
1807 return 1;
1808}
1809
1810// ---------------------------------------------------------------------------
1811// GNEVehicleTypeDialog - private methods
1812// ---------------------------------------------------------------------------
1813
1815 FXHorizontalFrame(verticalFrame, GUIDesignAuxiliarHorizontalFrame),
1816 myCarFollowingModelParametersParent(carFollowingModelParametersParent),
1817 myAttr(attr),
1818 myTextField(nullptr) {
1819 new FXLabel(this, toString(attr).c_str(), nullptr, GUIDesignLabelThickedFixed(150));
1820 myTextField = new FXTextField(this, GUIDesignTextFieldNCol, carFollowingModelParametersParent, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFieldFixed(180));
1821}
1822
1823
1824void
1826 // set color of textField, depending if current value is valid or not
1827 if (myCarFollowingModelParametersParent->myVehicleTypeDialog->myEditedDemandElement->isValid(myAttr, myTextField->getText().text())) {
1828 // set color depending if is a default value
1829 if (myCarFollowingModelParametersParent->myVehicleTypeDialog->myEditedDemandElement->getTagProperty().getDefaultValue(myAttr) != myTextField->getText().text()) {
1830 myTextField->setTextColor(FXRGB(0, 0, 0));
1831 } else {
1832 myTextField->setTextColor(FXRGB(195, 195, 195));
1833 }
1834 myCarFollowingModelParametersParent->myVehicleTypeDialog->myEditedDemandElement->setAttribute(myAttr, myTextField->getText().text(),
1835 myCarFollowingModelParametersParent->myVehicleTypeDialog->myEditedDemandElement->getNet()->getViewNet()->getUndoList());
1836 // update value after setting it
1837 updateValue();
1838 } else {
1839 myTextField->setTextColor(FXRGB(255, 0, 0));
1840 // mark VType as invalid
1841 myCarFollowingModelParametersParent->myVehicleTypeDialog->myVehicleTypeValid = false;
1842 myCarFollowingModelParametersParent->myVehicleTypeDialog->myInvalidAttr = myAttr;
1843 }
1844}
1845
1846
1847void
1849 // set text of myTextField using current value of VType
1850 myTextField->setText(myCarFollowingModelParametersParent->myVehicleTypeDialog->myEditedDemandElement->getAttribute(myAttr).c_str());
1851 // set color depending if is a default value
1852 if (myCarFollowingModelParametersParent->myVehicleTypeDialog->myEditedDemandElement->getTagProperty().getDefaultValue(myAttr) != myTextField->getText().text()) {
1853 myTextField->setTextColor(FXRGB(0, 0, 0));
1854 } else {
1855 myTextField->setTextColor(FXRGB(195, 195, 195));
1856 }
1857}
1858
1859
1860/****************************************************************************/
FXDEFMAP(GNEVehicleTypeDialog::VTypeAttributes) VTypeAttributesMap[]
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition GUIAppEnum.h:907
@ MID_GNE_OPEN_PARAMETERS_DIALOG
open parameters dialog
Definition GUIAppEnum.h:947
@ MID_GNE_SET_ATTRIBUTE_DIALOG
attribute edited trough dialog
Definition GUIAppEnum.h:943
#define GUIDesignTextFieldFixed(width)
text field with fixed width
Definition GUIDesigns.h:57
#define GUIDesignComboBox
Definition GUIDesigns.h:288
#define GUIDesignComboBoxWidth180
comboBox with thick frame, width 180
Definition GUIDesigns.h:300
#define GUIDesignComboBoxNCol
number of column of every combo box
Definition GUIDesigns.h:306
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition GUIDesigns.h:394
#define GUIDesignLabelTickedIcon180x46
label ticked filled extended over frame used for VClasses/VShapes. (can be used by icons of 64x32 pix...
Definition GUIDesigns.h:271
#define GUIDesignLabelAboutInfoCenter
label extended over frame with thick and with text justify to center
Definition GUIDesigns.h:259
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition GUIDesigns.h:66
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
Definition GUIDesigns.h:341
#define GUIDesignAuxiliarVerticalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition GUIDesigns.h:400
#define GUIDesignButtonRectangular150
button rectangular with thick and raise frame with a width of 150
Definition GUIDesigns.h:92
#define GUIDesignAuxiliarFrame
design for auxiliar (Without borders) frame extended in all directions
Definition GUIDesigns.h:385
#define GUIDesignLabelThickedFixed(width)
label thicked, icon before text, text centered and custom width
Definition GUIDesigns.h:247
FXString gCurrentFolder
The folder used as last.
@ VCLASS_TRAILER
@ VCLASS_PASSENGER
@ VSHAPE_PEDESTRIAN
@ VSHAPE_PASSENGER
@ VCLASS_BICYCLE
@ VCLASS_RAIL_FAST
@ VSHAPE_UNKNOWN
@ VSHAPE_FIREBRIGADE
@ VSHAPE_EMERGENCY
@ VSHAPE_PASSENGER_VAN
@ VSHAPE_PASSENGER_WAGON
@ VSHAPE_MOPED
@ VCLASS_CUSTOM2
@ VSHAPE_RAIL_CAR
@ VCLASS_MOTORCYCLE
@ VCLASS_COACH
@ VCLASS_AUTHORITY
@ VCLASS_TRUCK
@ VCLASS_MOPED
@ VSHAPE_E_VEHICLE
@ VCLASS_PEDESTRIAN
@ VCLASS_PRIVATE
@ VSHAPE_PASSENGER_HATCHBACK
@ VSHAPE_TRUCK_1TRAILER
@ VSHAPE_POLICE
@ VSHAPE_RAIL_CARGO
@ VSHAPE_BICYCLE
@ VSHAPE_AIRCRAFT
@ VCLASS_CUSTOM1
@ VSHAPE_BUS_TROLLEY
@ VSHAPE_DELIVERY
@ VSHAPE_PASSENGER_SEDAN
@ VSHAPE_BUS_FLEXIBLE
@ VCLASS_DELIVERY
@ VSHAPE_RICKSHAW
@ VSHAPE_MOTORCYCLE
@ VCLASS_RAIL_ELECTRIC
@ VCLASS_IGNORING
@ VSHAPE_TRUCK
@ VCLASS_EMERGENCY
@ VSHAPE_BUS_COACH
@ VCLASS_RAIL_URBAN
@ VSHAPE_TRUCK_SEMITRAILER
@ VCLASS_EVEHICLE
@ VSHAPE_SCOOTER
#define WRITE_DEBUG(msg)
Definition MsgHandler.h:281
#define TL(string)
Definition MsgHandler.h:287
StringBijection< SUMOVehicleShape > SumoVehicleShapeStrings(sumoVehicleShapeStringInitializer, SUMOVehicleShape::UNKNOWN, false)
SUMOVehicleShape getVehicleShapeID(const std::string &name)
Returns the class id of the shape class given by its name.
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_SHIP
is an arbitrary ship
@ SVC_PRIVATE
private vehicles
@ SVC_VIP
vip vehicles
@ SVC_HOV
vehicle is a HOV
@ SVC_TRUCK
vehicle is a large transport vehicle
@ SVC_CUSTOM2
is a user-defined type
@ SVC_RAIL
vehicle is a not electrified rail
@ SVC_COACH
vehicle is a coach
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_RAIL_FAST
vehicle that is allowed to drive on high-speed rail tracks
@ SVC_TRAILER
vehicle is a large transport vehicle
@ SVC_CUSTOM1
is a user-defined type
@ SVC_ARMY
army vehicles
@ SVC_RAIL_ELECTRIC
rail vehicle that requires electrified tracks
@ SVC_DELIVERY
vehicle is a small delivery vehicle
@ SVC_RAIL_URBAN
vehicle is a city rail
@ SVC_MOTORCYCLE
vehicle is a motorcycle
@ SVC_EMERGENCY
public emergency vehicles
@ SVC_MOPED
vehicle is a moped
@ SVC_AUTHORITY
authorities vehicles
@ SVC_TRAM
vehicle is a light rail
@ SVC_TAXI
vehicle is a taxi
@ SVC_BUS
vehicle is a bus
@ SVC_E_VEHICLE
is an electric vehicle
@ SVC_PEDESTRIAN
pedestrian
@ RICKSHAW
render as a rickshaw
@ BUS
render as a bus
@ RAIL_CARGO
render as a cargo train
@ EMERGENCY
render as an emergency vehicle
@ RAIL
render as a rail
@ PASSENGER_VAN
render as a van
@ PASSENGER
render as a passenger vehicle
@ SCOOTER
render as a scooter
@ RAIL_CAR
render as a (city) rail without locomotive
@ SHIP
render as a arbitrary ship
@ DELIVERY
render as a delivery vehicle
@ BICYCLE
render as a bicycle
@ MOTORCYCLE
render as a motorcycle
@ UNKNOWN
not defined
@ BUS_TROLLEY
render as a trolley bus
@ TAXI
automated car (with cruise controllers)
@ E_VEHICLE
render as a (futuristic) e-vehicle
@ ANT
render as a giant ant
@ TRUCK
render as a transport vehicle
@ 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
@ 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_CARRIAGE_LENGTH
@ SUMO_ATTR_LATALIGNMENT
@ SUMO_ATTR_CF_IDM_STEPPING
@ SUMO_ATTR_CF_IDMM_ADAPT_FACTOR
@ SUMO_ATTR_IMPATIENCE
@ SUMO_ATTR_COLLISION_MINGAP_FACTOR
@ SUMO_ATTR_VCLASS
@ SUMO_ATTR_ACCEL
@ SUMO_ATTR_BOARDING_DURATION
@ SUMO_ATTR_CF_EIDM_M_FLATNESS
@ SUMO_ATTR_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_LOCOMOTIVE_LENGTH
@ SUMO_ATTR_TMP5
@ SUMO_ATTR_NOTHING
invalid attribute
@ SUMO_ATTR_JM_DRIVE_RED_SPEED
@ SUMO_ATTR_LCA_TIME_TO_IMPATIENCE
@ SUMO_ATTR_JM_TIMEGAP_MINOR
@ SUMO_ATTR_CARRIAGE_GAP
@ SUMO_ATTR_CF_WIEDEMANN_ESTIMATION
@ SUMO_ATTR_LCA_SPEEDGAINRIGHT
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
std::vector< double > & getParameter()
Returns the parameters of this distribution.
virtual bool isAttributeEnabled(SumoXMLAttr key) const
const std::string & getTagStr() const
get tag assigned to this object in string format
GNENet * getNet() const
get pointer to net
Dialog to edit sequences, parameters, etc.. of DemandElements.
void acceptChanges()
Accept changes did in this dialog.
GNEDemandElement * myEditedDemandElement
pointer to edited additional
FXVerticalFrame * myContentFrame
frame for contents
bool myUpdatingElement
flag to indicate if additional are being created or modified (cannot be changed after open dialog)
FXint openAsModalDialog(FXuint placement=PLACEMENT_CURSOR)
execute dialog as modal
void initChanges()
init a new group of changes that will be do it in dialog
void cancelChanges()
Cancel changes did in this dialog.
void changeDemandElementDialogHeader(const std::string &newHeader)
change additional dialog header
void resetChanges()
reset changes did in this dialog.
An Element which don't belong to GNENet but has influence in the simulation.
virtual SUMOVehicleClass getVClass() const =0
virtual std::string getAttribute(SumoXMLAttr key) const =0
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
method for setting the attribute and letting the object perform demand element changes
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
method for checking if the key and their conrrespond attribute are valids
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2030
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
FXComboBox for VClass.
MFXComboBoxIcon * myComboBoxShape
FXComboBox 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
FXString filterAttributeName(const SumoXMLAttr attr) const
filter attribute name
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
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 commmon 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 * myCarriageLength
VTypeAttributeRow for carriage length.
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 commmon attributes (B)
VTypeAttributeRow * myLocomotiveLength
VTypeAttributeRow for locomotive length.
long onCmdSetAttribute(FXObject *, FXSelector, void *)
VShapeRow * myVShapeRow
vehicle shape row
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 FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
ComboBox with icon.
FXint getNumItems() const
Return the number of items in the list.
FXString getText() const
Get the text.
void setTextColor(FXColor clr)
Change text color.
void setNumVisible(FXint nvis)
Set the number of visible items in the drop down list.
FXint appendIconItem(const FXString &text, FXIcon *icon=nullptr, FXColor bgColor=FXRGB(255, 255, 255), void *ptr=nullptr)
append icon
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Definition MFXUtils.cpp:112
static RGBColor getRGBColor(FXColor col)
converts FXColor to RGBColor
Definition MFXUtils.cpp:106
static const std::vector< std::string > & getAllClassesStr()
Get all SUMOEmissionClass in string format.
static const RGBColor BLACK
Definition RGBColor.h:193
static std::vector< std::string > getLatAlignmentStrings()
return all valid strings for latAlignment
static StringBijection< SumoXMLTag > CarFollowModels
car following models
static StringBijection< LaneChangeModel > LaneChangeModels
lane change models
std::vector< std::string > getStrings() const
std::vector< std::string > getVector()
return vector of strings
bool hasNext()
returns the information whether further substrings exist
std::string next()
returns the next substring when it exists. Otherwise the behaviour is undefined
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 carriageLength
the length of train carriages
double desiredMaxSpeed
The vehicle type's desired maximum speed [m/s].
std::string osgFile
3D model file for this class
SUMOEmissionClass emissionClass
The emission class of this vehicle.
double minGap
This class' free space in front of the vehicle itself.
int containerCapacity
The container capacity of the vehicle.
double maxSpeed
The vehicle type's maximum speed [m/s] (technical limit, not subject to speed deviation)
Distribution_Parameterized speedFactor
The factor by which the maximum speed may deviate from the allowed max speed on the street.
double length
The physical vehicle length.
SUMOVehicleShape shape
This class' shape.
LatAlignmentDefinition latAlignmentProcedure
the lateral alignment procedure
double locomotiveLength
the length of train locomotive