Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
GNEAttributesEditorRow.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// Row used for edit attributes in GNEAttributesEditorType
19/****************************************************************************/
20
22#include <netedit/GNENet.h>
24#include <netedit/GNEViewNet.h>
34
36
37// ===========================================================================
38// FOX callback mapping
39// ===========================================================================
40
52
53// Object implementation
54FXIMPLEMENT(GNEAttributesEditorRow, FXHorizontalFrame, GNEAttributeRowMap, ARRAYNUMBER(GNEAttributeRowMap))
55
56// ===========================================================================
57// defines
58// ===========================================================================
59
60#define TEXTCOLOR_BLACK FXRGB(0, 0, 0)
61#define TEXTCOLOR_BLUE FXRGB(0, 0, 255)
62#define TEXTCOLOR_RED FXRGB(255, 0, 0)
63#define TEXTCOLOR_BACKGROUND_RED FXRGBA(255, 213, 213, 255)
64#define TEXTCOLOR_BACKGROUND_WHITE FXRGB(255, 255, 255)
65
66// ===========================================================================
67// method definitions
68// ===========================================================================
69
71 FXHorizontalFrame(attributeTable->getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame),
72 myAttributeTable(attributeTable) {
73 // get static tooltip menu
74 const auto tooltipMenu = attributeTable->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu();
75 // Create left label
76 myAttributeLabel = new MFXLabelTooltip(this, tooltipMenu, "Label", nullptr, GUIDesignLabelThickedFixed(100));
77 myAttributeLabel->hide();
78 // create lef boolean checkBox for enable/disable attributes
79 myAttributeToggleEnableCheckButton = new FXCheckButton(this, "Enable/Disable attribute checkBox", this,
82 // create left button parent
83 myAttributeButton = new MFXButtonTooltip(this, tooltipMenu, "button", nullptr, this,
85 // create right text field for string attributes
86 myValueTextField = new MFXTextFieldTooltip(this, tooltipMenu, GUIDesignTextFieldNCol, this,
88 myValueTextField->hide();
89 // create right combo box for discrete attributes
92 myValueComboBox->hide();
93 // Create right check button
94 myValueCheckButton = new FXCheckButton(this, "check button", this, MID_GNE_ATTRIBUTESEDITORROW_SETATTRIBUTE, GUIDesignCheckButton);
95 myValueCheckButton->hide();
96 // create right move lane up button
99 myValueLaneUpButton->hide();
100 // set tip texts
101 myValueLaneUpButton->setTipText(TL("Move element up one lane"));
102 myValueLaneUpButton->setHelpText(TL("Move element up one lane"));
103 // create right move lane down button
106 myValueLaneDownButton->hide();
107 // set tip texts
108 myValueLaneDownButton->setTipText(TL("Move element down one lane"));
109 myValueLaneDownButton->setHelpText(TL("Move element down one lane"));
110 // start hidden
111 hide();
112}
113
114
115bool
116GNEAttributesEditorRow::showAttributeRow(GNEAttributesEditorType* attributeTable, const GNEAttributeProperties* attrProperty, const bool forceDisable) {
117 // update parent table
118 myAttributeTable = attributeTable;
119 if (myAttributeTable->myEditedACs.empty()) {
120 return false;
121 } else {
123 }
124 myAttrProperty = attrProperty;
125 const auto attribute = myAttrProperty->getAttr();
126 const auto tagPropertyParent = attrProperty->getTagPropertyParent();
127 const auto firstEditedAC = myAttributeTable->myEditedACs.front();
128 // check if we're editing multiple ACs
129 const auto multipleEditedACs = (myAttributeTable->myEditedACs.size() > 1);
130 // declare flag for show attribute enabled
131 const bool attributeEnabled = isAttributeEnabled(attrProperty);
132 // check if this attribute is computed
133 const bool computedAttribute = multipleEditedACs ? false : firstEditedAC->isAttributeComputed(attribute);
134 // get string value depending if attribute is enabled
135 const std::string value = getAttributeValue(attributeEnabled);
136 // get parent if we're editing single vTypes
137 GNEAttributeCarrier* ACParent = nullptr;
138 if (!multipleEditedACs && attrProperty->isVType()) {
140 // parent can be either type or distribution
141 if (attribute == SUMO_ATTR_TYPE) {
142 ACParent = ACs->retrieveDemandElement(SUMO_TAG_VTYPE, firstEditedAC->getAttribute(SUMO_ATTR_TYPE), false);
143 }
144 if (ACParent == nullptr) {
145 ACParent = ACs->retrieveDemandElement(SUMO_TAG_VTYPE_DISTRIBUTION, firstEditedAC->getAttribute(SUMO_ATTR_TYPE), false);
146 }
147 }
148 // hide editing for unique attributes in case of multi-selection
149 if (multipleEditedACs && attrProperty->isUnique()) {
150 return hideAttributeRow();
151 }
152 // front element has their own button, and doesn't use the UndoList
153 if (attribute == GNE_ATTR_FRONTELEMENT) {
154 return hideAttributeRow();
155 }
156 // if we have a disabled flow attribute, don't show row
157 if (attrProperty->isFlow() && !attributeEnabled) {
158 return hideAttributeRow();
159 }
160 // expected and joins depend of triggered
161 if (tagPropertyParent->isVehicleStop() && !attributeEnabled) {
162 if (attribute == SUMO_ATTR_EXPECTED) {
163 return hideAttributeRow();
164 } else if (attribute == SUMO_ATTR_EXPECTED_CONTAINERS) {
165 return hideAttributeRow();
166 } else if (attribute == SUMO_ATTR_JOIN) {
167 return hideAttributeRow();
168 }
169 }
170 // don't show stop offset exception if stopOffset is zero
171 if ((attribute == GNE_ATTR_STOPOEXCEPTION) && !attributeEnabled) {
172 return hideAttributeRow();
173 }
174 // show elements depending of attribute properties
175 if (attrProperty->isActivatable()) {
176 showAttributeToggleEnable(attrProperty, attributeEnabled);
177 } else if (attrProperty->isFileOpen() || attrProperty->isFileSave()) {
178 showAttributeFile(attrProperty, attributeEnabled);
179 } else if (attribute == GNE_ATTR_PARENT) {
180 showAttributeReparent(attributeEnabled);
181 } else if ((attribute == SUMO_ATTR_TYPE) && tagPropertyParent->hasTypeParent()) {
182 showAttributeInspectParent(attrProperty, attributeEnabled);
183 } else if (attrProperty->isVClass() && (attribute != SUMO_ATTR_DISALLOW)) {
184 showAttributeVClass(attrProperty, attributeEnabled);
185 } else if (attribute == SUMO_ATTR_COLOR) {
186 showAttributeColor(attrProperty, attributeEnabled);
187 } else if (attribute == GNE_ATTR_PARAMETERS) {
189 } else {
190 showAttributeLabel(attrProperty);
191 }
192 // continue depending of type of attribute
193 if (attrProperty->isBool()) {
194 showValueCheckButton(value, attributeEnabled, computedAttribute);
195 } else if (attrProperty->isDiscrete() || attrProperty->isVType()) {
196 showValueComboBox(attrProperty, value, attributeEnabled, computedAttribute);
197 } else {
198 showValueString(value, attributeEnabled, computedAttribute);
199 }
200 // check if show move lane buttons
201 if (!multipleEditedACs && !tagPropertyParent->isNetworkElement() && (attribute == SUMO_ATTR_LANE)) {
202 showMoveLaneButtons(value);
203 myValueLaneUpButton->show();
204 myValueLaneDownButton->show();
205 } else {
206 myValueLaneUpButton->hide();
207 myValueLaneDownButton->hide();
208 }
209 // enable depending of supermode
210 enableElements(attrProperty, forceDisable);
211 // Show row
212 show();
213 return true;
214}
215
216
217bool
219 hide();
220 return false;
221}
222
223
224void
226 // disable all elements
228 myAttributeButton->disable();
229 myValueTextField->disable();
231 myValueCheckButton->disable();
232 myValueLaneUpButton->disable();
233 myValueLaneDownButton->disable();
234}
235
236
241
242
243std::string
245 if (myValueCheckButton->shown()) {
246 return (myValueCheckButton->getCheck() == TRUE) ? "true" : "false";
247 } else if (myValueComboBox->shown()) {
248 return myValueComboBox->getText().text();
249 } else if (myValueTextField->shown()) {
250 return myValueTextField->getText().text();
251 } else {
252 return "";
253 }
254}
255
256
257bool
259 if (myValueCheckButton->shown()) {
260 return true;
261 } else if (myValueComboBox->shown()) {
263 (myValueComboBox->getBackColor() != TEXTCOLOR_BACKGROUND_RED);
264 } else if (myValueTextField->shown()) {
265 return (myValueTextField->getTextColor() != TEXTCOLOR_RED) &&
266 (myValueTextField->getBackColor() != TEXTCOLOR_BACKGROUND_RED);
267 } else {
268 return true;
269 }
270}
271
272
273bool
275 return shown();
276}
277
278
280GNEAttributesEditorRow::fillSumoBaseObject(CommonXMLStructure::SumoBaseObject* baseObject, const bool insertDefaultValues) const {
281 const auto attribute = myAttrProperty->getAttr();
282 // check if this is the default value
283 const bool usingDefaultValue = isValueValid() && (myAttrProperty->getDefaultStringValue() == getCurrentValue());
284 // first check if insert default values
285 if (!insertDefaultValues && usingDefaultValue) {
286 return SUMO_ATTR_NOTHING;
287 }
288 // now check if attribute is activatable AND is enabled
289 if (myAttrProperty->isActivatable() && (myAttributeToggleEnableCheckButton->getCheck() == FALSE)) {
290 return SUMO_ATTR_NOTHING;
291 }
292 // continue depending of type
293 if (myAttrProperty->isBool()) {
294 baseObject->addBoolAttribute(attribute, myValueCheckButton->getCheck() == TRUE);
295 } else if (myAttrProperty->isDiscrete()) {
297 (myValueComboBox->getBackColor() == TEXTCOLOR_BACKGROUND_RED)) {
298 return attribute;
299 } else {
300 baseObject->addStringAttribute(attribute, myValueComboBox->getText().text());
301 }
302 } else if ((myValueTextField->getTextColor() == TEXTCOLOR_RED) ||
303 (myValueTextField->getBackColor() == TEXTCOLOR_BACKGROUND_RED)) {
304 return attribute;
305 } else if (myAttrProperty->isInt()) {
306 // int value
307 if (GNEAttributeCarrier::canParse<int>(myValueTextField->getText().text())) {
308 const auto intValue = GNEAttributeCarrier::parse<int>(myValueTextField->getText().text());
309 if (myAttrProperty->isPositive() && (intValue < 0)) {
310 return attribute;
311 } else {
312 baseObject->addIntAttribute(attribute, intValue);
313 }
314 } else if (myAttrProperty->hasDefaultValue() && (myValueTextField->getText().text() == myAttrProperty->getDefaultStringValue())) {
315 baseObject->addIntAttribute(attribute, myAttrProperty->getDefaultIntValue());
316 } else if (myAttrProperty->hasDefaultValue() && myValueTextField->getText().empty()) {
317 baseObject->addIntAttribute(attribute, myAttrProperty->getDefaultIntValue());
318 } else {
319 return attribute;
320 }
321 } else if (myAttrProperty->isFloat()) {
322 // double value
323 if (myAttrProperty->isList()) {
324 if (GNEAttributeCarrier::canParse<std::vector<double> >(myValueTextField->getText().text())) {
325 const auto doubleListValue = GNEAttributeCarrier::parse<std::vector<double> >(myValueTextField->getText().text());
326 // check every double
327 for (const auto doubleValue : doubleListValue) {
328 if (myAttrProperty->isPositive() && (doubleValue < 0)) {
329 return attribute;
330 } else if (myAttrProperty->isFloat() && ((doubleValue < 0) || (doubleValue > 1))) {
331 return attribute;
332 }
333 }
334 baseObject->addDoubleListAttribute(attribute, doubleListValue);
335 } else {
336 return attribute;
337 }
338 } else if (GNEAttributeCarrier::canParse<double>(myValueTextField->getText().text())) {
339 const auto doubleValue = GNEAttributeCarrier::parse<double>(myValueTextField->getText().text());
340 // check using default value for certain default values (for example, lenght = -1)
341 if (!usingDefaultValue && myAttrProperty->isPositive() && (doubleValue < 0)) {
342 return attribute;
343 } else if (!usingDefaultValue && myAttrProperty->isProbability() && ((doubleValue < 0) || (doubleValue > 1))) {
344 return attribute;
345 } else {
346 baseObject->addDoubleAttribute(attribute, doubleValue);
347 }
348 } else if (myAttrProperty->hasDefaultValue() && (myValueTextField->getText().text() == myAttrProperty->getDefaultStringValue())) {
350 } else if (myAttrProperty->hasDefaultValue() && myValueTextField->getText().empty()) {
352 } else {
353 return attribute;
354 }
355 } else if (myAttrProperty->isSUMOTime()) {
356 // time value
357 if (GNEAttributeCarrier::canParse<SUMOTime>(myValueTextField->getText().text())) {
358 const auto timeValue = GNEAttributeCarrier::parse<SUMOTime>(myValueTextField->getText().text());
359 if (timeValue < 0) {
360 return attribute;
361 } else {
362 baseObject->addTimeAttribute(attribute, timeValue);
363 }
364 } else if (myAttrProperty->hasDefaultValue() && (myValueTextField->getText().text() == myAttrProperty->getDefaultStringValue())) {
365 baseObject->addTimeAttribute(attribute, myAttrProperty->getDefaultTimeValue());
366 } else if (myAttrProperty->hasDefaultValue() && myValueTextField->getText().empty()) {
367 baseObject->addTimeAttribute(attribute, myAttrProperty->getDefaultTimeValue());
368 } else {
369 return attribute;
370 }
371 } else if (myAttrProperty->isPosition()) {
372 // position value
373 if (myAttrProperty->isList()) {
374 if (GNEAttributeCarrier::canParse<PositionVector>(myValueTextField->getText().text())) {
375 baseObject->addPositionVectorAttribute(attribute, GNEAttributeCarrier::parse<PositionVector>(myValueTextField->getText().text()));
376 } else {
377 return attribute;
378 }
379 } else if (GNEAttributeCarrier::canParse<Position>(myValueTextField->getText().text())) {
380 baseObject->addPositionAttribute(attribute, GNEAttributeCarrier::parse<Position>(myValueTextField->getText().text()));
381 } else if (myAttrProperty->hasDefaultValue() && (myValueTextField->getText().text() == myAttrProperty->getDefaultStringValue())) {
383 } else if (myAttrProperty->hasDefaultValue() && myValueTextField->getText().empty()) {
385 } else {
386 return attribute;
387 }
388 } else if (myAttrProperty->isColor()) {
389 // color value
390 if (GNEAttributeCarrier::canParse<RGBColor>(myValueTextField->getText().text())) {
391 baseObject->addColorAttribute(attribute, GNEAttributeCarrier::parse<RGBColor>(myValueTextField->getText().text()));
392 } else if (myAttrProperty->hasDefaultValue() && (myValueTextField->getText().text() == myAttrProperty->getDefaultStringValue())) {
393 baseObject->addColorAttribute(attribute, myAttrProperty->getDefaultColorValue());
394 } else if (myAttrProperty->hasDefaultValue() && myValueTextField->getText().empty()) {
395 baseObject->addColorAttribute(attribute, myAttrProperty->getDefaultColorValue());
396 } else {
397 return attribute;
398 }
399 } else if (myAttrProperty->isList()) {
400 baseObject->addStringListAttribute(attribute, GNEAttributeCarrier::parse<std::vector<std::string> >(myValueTextField->getText().text()));
401 } else if (attribute == GNE_ATTR_PARAMETERS) {
402 baseObject->addParameters(myValueTextField->getText().text());
403 } else {
404 baseObject->addStringAttribute(attribute, myValueTextField->getText().text());
405 }
406 // all ok, then return nothing
407 return SUMO_ATTR_NOTHING;
408}
409
410
411long
412GNEAttributesEditorRow::onCmdOpenColorDialog(FXObject*, FXSelector, void*) {
413 // create FXColorDialog
414 FXColorDialog colordialog(myAttributeTable->getFrameParent()->getViewNet(), TL("Color Dialog"));
415 colordialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::COLORWHEEL));
416 // If previous attribute wasn't correct, set black as default color
417 if (GNEAttributeCarrier::canParse<RGBColor>(myValueTextField->getText().text())) {
418 colordialog.setRGBA(MFXUtils::getFXColor(GNEAttributeCarrier::parse<RGBColor>(myValueTextField->getText().text())));
419 } else if (myAttrProperty->hasDefaultValue()) {
421 } else {
422 colordialog.setRGBA(MFXUtils::getFXColor(RGBColor::BLACK));
423 }
424 // execute dialog to get a new color in the text field
425 if (colordialog.execute()) {
426 myValueTextField->setText(toString(MFXUtils::getRGBColor(colordialog.getRGBA())).c_str(), TRUE);
427 }
428 return 1;
429}
430
431
432long
433GNEAttributesEditorRow::onCmdOpenAllowDialog(FXObject*, FXSelector, void*) {
434 // declare values to be modified
435 std::string allowedVehicles = myValueTextField->getText().text();
436 // declare accept changes
437 bool acceptChanges = false;
438 // open GNEAllowVClassesDialog (also used to modify SUMO_ATTR_CHANGE_LEFT etc)
439 GNEAllowVClassesDialog(myAttributeTable->getFrameParent()->getViewNet(), myAttrProperty->getAttr(), &allowedVehicles, &acceptChanges).execute();
440 // continue depending of acceptChanges
441 if (acceptChanges) {
442 myValueTextField->setText(allowedVehicles.c_str(), TRUE);
443 }
444 return 1;
445}
446
447
448long
449GNEAttributesEditorRow::onCmdOpenFileDialog(FXObject*, FXSelector, void*) {
450 // set title depending if we're loading or saving
451 const std::string title = myAttrProperty->isFileSave() ?
452 TLF("Select existent o create new file for % attribute", myAttrProperty->getAttrStr()) :
453 TLF("Select existent file for % attribute", myAttrProperty->getAttrStr());
454 // open dialog
455 const std::string value = GNEApplicationWindowHelper::openFileDialog(
459 // update text field
460 if (value.size() > 0) {
461 myValueTextField->setText(value.c_str(), TRUE);
462 }
463 return 1;
464}
465
466
467long
468GNEAttributesEditorRow::onCmdReparent(FXObject*, FXSelector, void*) {
470 return 1;
471}
472
473
474long
475GNEAttributesEditorRow::onCmdInspectParent(FXObject*, FXSelector, void*) {
477 return 1;
478}
479
480
481long
482GNEAttributesEditorRow::onCmdMoveLaneUp(FXObject*, FXSelector, void*) {
484 return 1;
485}
486
487
488long
489GNEAttributesEditorRow::onCmdMoveLaneDown(FXObject*, FXSelector, void*) {
491 return 1;
492}
493
494
495long
496GNEAttributesEditorRow::onCmdSetAttribute(FXObject* obj, FXSelector, void*) {
497 if (myAttributeTable->myEditedACs.empty()) {
498 return 0;
499 }
500 const auto& editedAC = myAttributeTable->myEditedACs.front();
501 const auto attribute = myAttrProperty->getAttr();
502 // continue depending of clicked object
503 if (obj == myValueCheckButton) {
504 // Set true o false depending of the checkBox
505 if (myValueCheckButton->getCheck()) {
506 myValueCheckButton->setText("true");
507 } else {
508 myValueCheckButton->setText("false");
509 }
510 myAttributeTable->setAttribute(attribute, myValueCheckButton->getText().text());
511 } else if (obj == myValueComboBox) {
512 const std::string newValue = myValueComboBox->getText().text();
513 // check if the new comboBox value is valid
514 if (editedAC->isValid(attribute, newValue)) {
517 myValueComboBox->killFocus();
518 myAttributeTable->setAttribute(attribute, newValue);
519 } else {
520 // edit colors
522 if (newValue.empty()) {
524 }
525 }
526 } else if (obj == myValueTextField) {
527 // first check if set default value
528 if (myValueTextField->getText().empty() && myAttrProperty->hasDefaultValue() && !myAttrProperty->isVClass()) {
529 // update text field without notify
530 myValueTextField->setText(myAttrProperty->getDefaultStringValue().c_str(), FALSE);
531 }
532 // if we're editing an angle, check if filter between [0,360]
533 if ((attribute == SUMO_ATTR_ANGLE) && GNEAttributeCarrier::canParse<double>(myValueTextField->getText().text())) {
534 // filter anglea and update text field without notify
535 const double angle = fmod(GNEAttributeCarrier::parse<double>(myValueTextField->getText().text()), 360);
536 myValueTextField->setText(toString(angle).c_str(), FALSE);
537 }
538 // if we're editing a position or a shape, strip whitespace after comma
539 if ((attribute == SUMO_ATTR_POSITION) || (attribute == SUMO_ATTR_SHAPE)) {
540 std::string shape(myValueTextField->getText().text());
541 while (shape.find(", ") != std::string::npos) {
542 shape = StringUtils::replace(shape, ", ", ",");
543 }
544 myValueTextField->setText(toString(shape).c_str(), FALSE);
545 }
546 // if we're editing a int, strip decimal value
547 if (myAttrProperty->isInt() && GNEAttributeCarrier::canParse<double>(myValueTextField->getText().text())) {
548 double doubleValue = GNEAttributeCarrier::parse<double>(myValueTextField->getText().text());
549 if ((doubleValue - (int)doubleValue) == 0) {
550 myValueTextField->setText(toString((int)doubleValue).c_str(), FALSE);
551 }
552 }
553 // after apply all filters, obtain value
554 const std::string newValue = myValueTextField->getText().text();
555 // check if the new textField value is valid
556 if (editedAC->isValid(attribute, newValue)) {
557 myValueTextField->setTextColor(TEXTCOLOR_BLACK);
559 myValueTextField->killFocus();
560 if (myAttributeTable->isEditorTypeEditor() || newValue.empty() || (attribute != SUMO_ATTR_ID)) {
561 myAttributeTable->setAttribute(attribute, newValue);
562 }
563 } else {
564 // edit colors
565 myValueTextField->setTextColor(TEXTCOLOR_RED);
566 if (newValue.empty()) {
568 }
569 }
570 }
571 return 1;
572}
573
574
575long
580
581
583 myAttributeTable(nullptr) {
584}
585
586
587const std::string
589 const auto attribute = myAttrProperty->getAttr();
590 // if we're in creator mode, generate ID
593 const auto parentTag = myAttrProperty->getTagPropertyParent()->getTag();
595 return ACs->generateEdgeID();
597 return ACs->generateAdditionalID(parentTag);
599 return ACs->generateDemandElementID(parentTag);
601 return ACs->generateMeanDataID(parentTag);
602 } else if (parentTag == SUMO_TAG_TYPE) {
603 return ACs->generateEdgeTypeID();
604 } else if (parentTag == SUMO_TAG_DATASET) {
605 return ACs->generateDataSetID();
606 }
607 }
608 if (enabled) {
609 // Declare a set of occurring values and insert attribute's values of item (note: We use a set to avoid repeated values)
610 std::set<std::string> values;
611 // iterate over edited attributes and insert every value in set
612 for (const auto& editedAC : myAttributeTable->myEditedACs) {
613 if (editedAC->hasAttribute(attribute)) {
614 values.insert(editedAC->getAttribute(attribute));
615 }
616 }
617 // merge all values in a single string
618 std::ostringstream oss;
619 for (auto it = values.begin(); it != values.end(); it++) {
620 if (it != values.begin()) {
621 oss << " ";
622 }
623 oss << *it;
624 }
625 // obtain value to be shown in row
626 return oss.str();
627 } else {
628 return myAttributeTable->myEditedACs.front()->getAlternativeValueForDisabledAttributes(attribute);
629 }
630}
631
632
633void
635 myAttributeToggleEnableCheckButton->setText(attrProperty->getAttrStr().c_str());
636 myAttributeToggleEnableCheckButton->setCheck(value);
639 // hide other elements
640 myAttributeLabel->hide();
641 myAttributeButton->hide();
642}
643
644
645void
647 // update attribute button
648 myAttributeButton->setText(TL("Reparent"));
649 myAttributeButton->setHelpText(TL("Change parent of this element"));
650 myAttributeButton->setTipText(myAttributeButton->getHelpText());
651 myAttributeButton->setIcon(nullptr);
653 if (enabled) {
654 myAttributeButton->enable();
655 } else {
656 myAttributeButton->disable();
657 }
658 myAttributeButton->show();
659 // hide other elements
660 myAttributeLabel->hide();
662}
663
664
665void
667 // update attribute button
668 myAttributeButton->setText(attrProperty->getAttrStr().c_str());
669 myAttributeButton->setHelpText(TLF("Inspect % parent", attrProperty->getAttrStr()).c_str());
670 myAttributeButton->setTipText(myAttributeButton->getHelpText());
673 if (enabled) {
674 myAttributeButton->enable();
675 } else {
676 myAttributeButton->disable();
677 }
678 myAttributeButton->show();
679 // hide other elements
680 myAttributeLabel->hide();
682}
683
684
685void
687 // update attribute button
688 myAttributeButton->setText(attrProperty->getAttrStr().c_str());
689 myAttributeButton->setHelpText(TL("Open dialog for editing vClasses"));
690 myAttributeButton->setTipText(myAttributeButton->getHelpText());
691 myAttributeButton->setIcon(nullptr);
693 if (enabled) {
694 myAttributeButton->enable();
695 } else {
696 myAttributeButton->disable();
697 }
698 myAttributeButton->show();
699 // hide other elements
700 myAttributeLabel->hide();
702}
703
704
705void
707 // update attribute button
708 myAttributeButton->setText(attrProperty->getAttrStr().c_str());
709 myAttributeButton->setHelpText(TL("Open dialog for editing color"));
710 myAttributeButton->setTipText(myAttributeButton->getHelpText());
713 if (enabled) {
714 myAttributeButton->enable();
715 } else {
716 myAttributeButton->disable();
717 }
718 myAttributeButton->show();
719 // hide other elements
720 myAttributeLabel->hide();
722}
723
724
725void
727 // update attribute button
728 myAttributeButton->setText(attrProperty->getAttrStr().c_str());
729 if (attrProperty->isFileOpen()) {
730 myAttributeButton->setHelpText(TL("Open dialog for select an existent file"));
731 } else {
732 myAttributeButton->setHelpText(TL("Open dialog for select or create an existent file"));
733 }
734 myAttributeButton->setTipText(myAttributeButton->getHelpText());
737 if (enabled) {
738 myAttributeButton->enable();
739 } else {
740 myAttributeButton->disable();
741 }
742 myAttributeButton->show();
743 // hide other elements
744 myAttributeLabel->hide();
746}
747
748
749void
751 myAttributeLabel->setText(attrProperty->getAttrStr().c_str());
752 myAttributeLabel->show();
753 // hide other elements
755 myAttributeButton->hide();
756}
757
758
759void
765
766
767void
769 const bool enabled, const bool computed) {
770 // first we need to check if all boolean values are equal
771 bool allValuesEqual = true;
772 // declare boolean vector
773 std::vector<bool> booleanVector;
774 // check if value can be parsed to a boolean vector
775 if (GNEAttributeCarrier::canParse<std::vector<bool> >(value)) {
776 booleanVector = GNEAttributeCarrier::parse<std::vector<bool> >(value);
777 }
778 // iterate over booleans comparing all element with the first
779 for (const auto& booleanValue : booleanVector) {
780 if (booleanValue != booleanVector.front()) {
781 allValuesEqual = false;
782 }
783 }
784 // use checkbox or textfield depending if all booleans are equal
785 if (allValuesEqual) {
786 if (enabled) {
787 myValueCheckButton->enable();
788 } else {
789 myValueCheckButton->disable();
790 }
791 // set check button
792 if ((booleanVector.size() > 0) && booleanVector.front()) {
793 myValueCheckButton->setCheck(true);
794 myValueCheckButton->setText("true");
795 } else {
796 myValueCheckButton->setCheck(false);
797 myValueCheckButton->setText("false");
798 }
799 // show check button
800 myValueCheckButton->show();
801 // hide other value elements
802 myValueTextField->hide();
803 myValueComboBox->hide();
804 myValueLaneUpButton->hide();
805 myValueLaneDownButton->hide();
806 } else {
807 // show value as string
808 showValueString(value, enabled, computed);
809 }
810}
811
812
813void
814GNEAttributesEditorRow::showValueComboBox(const GNEAttributeProperties* attrProperty, const std::string& value,
815 const bool enabled, const bool computed) {
816 // first we need to check if all boolean values are equal
817 bool allValuesEqual = true;
818 // declare boolean vector
819 std::vector<std::string> stringVector = GNEAttributeCarrier::parse<std::vector<std::string> >(value);
820 // iterate over string comparing all element with the first
821 for (const auto& stringValue : stringVector) {
822 if (stringValue != stringVector.front()) {
823 allValuesEqual = false;
824 }
825 }
826 // use checkbox or textfield depending if all booleans are equal
827 if (allValuesEqual) {
828 // clear and enable comboBox
832 if (enabled) {
834 } else {
836 }
837 // fill depeding of ACAttr
838 if (attrProperty->getAttr() == SUMO_ATTR_VCLASS) {
839 // add all vClasses with their icons
840 for (const auto& vClassStr : SumoVehicleClassStrings.getStrings()) {
842 }
843 } else if (attrProperty->isVType()) {
844 // get ACs
846 // fill comboBox with all vTypes and vType distributions sorted by ID
847 std::map<std::string, GNEDemandElement*> sortedTypes;
848 for (const auto& type : ACs->getDemandElements().at(SUMO_TAG_VTYPE)) {
849 sortedTypes[type.second->getID()] = type.second;
850 }
851 for (const auto& sortedType : sortedTypes) {
852 myValueComboBox->appendIconItem(sortedType.first.c_str(), sortedType.second->getACIcon());
853 }
854 sortedTypes.clear();
855 for (const auto& typeDistribution : ACs->getDemandElements().at(SUMO_TAG_VTYPE_DISTRIBUTION)) {
856 sortedTypes[typeDistribution.second->getID()] = typeDistribution.second;
857 }
858 for (const auto& sortedType : sortedTypes) {
859 myValueComboBox->appendIconItem(sortedType.first.c_str(), sortedType.second->getACIcon());
860 }
861 } else if (attrProperty->getAttr() == SUMO_ATTR_ICON) {
862 // add all POIIcons with their icons
863 for (const auto& POIIcon : SUMOXMLDefinitions::POIIcons.getValues()) {
865 }
866 } else if ((attrProperty->getAttr() == SUMO_ATTR_RIGHT_OF_WAY) && (myAttributeTable->myEditedACs.size() == 1) &&
867 (attrProperty->getTagPropertyParent()->getTag() == SUMO_TAG_JUNCTION)) {
868 // special case for junction types
869 if (myAttributeTable->myEditedACs.front()->getAttribute(SUMO_ATTR_TYPE) == "priority") {
872 } else if (myAttributeTable->myEditedACs.front()->getAttribute(SUMO_ATTR_TYPE) == "traffic_light") {
876 } else {
878 }
879 } else {
880 // fill comboBox with discrete values
881 for (const auto& discreteValue : attrProperty->getDiscreteValues()) {
882 myValueComboBox->appendIconItem(discreteValue.c_str(), nullptr);
883 }
884 }
885 // set current value (or disable)
886 const auto index = myValueComboBox->findItem(value.c_str());
887 if (index < 0) {
888 if (myValueComboBox->getNumItems() > 0) {
890 } else {
892 }
893 } else {
895 }
896 // show comboBox button
897 myValueComboBox->show();
898 // hide other value elements
899 myValueTextField->hide();
900 myValueCheckButton->hide();
901 myValueLaneUpButton->hide();
902 myValueLaneDownButton->hide();
903 } else {
904 // show value as string
905 showValueString(value, enabled, computed);
906 }
907}
908
909
910void
911GNEAttributesEditorRow::showValueString(const std::string& value, const bool enabled, const bool computed) {
912 // clear and enable comboBox
913 myValueTextField->setText(value.c_str());
914 if (computed) {
915 myValueTextField->setTextColor(TEXTCOLOR_BLUE);
916 } else {
917 myValueTextField->setTextColor(TEXTCOLOR_BLACK);
918 }
919 if (enabled) {
920 myValueTextField->enable();
921 } else {
922 myValueTextField->disable();
923 }
924 // show list of values
925 myValueTextField->show();
926 // hide other value elements
927 myValueCheckButton->hide();
928 myValueComboBox->hide();
929}
930
931
932void
934 // retrieve lane
935 const auto lane = myAttributeTable->myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveLane(laneID, false);
936 // check lane
937 if (lane) {
938 // check if disable move up
939 if ((lane->getIndex() + 1) >= (int)lane->getParentEdge()->getChildLanes().size()) {
940 myValueLaneUpButton->disable();
941 } else {
942 myValueLaneUpButton->enable();
943 }
944 // check if disable move down
945 if ((lane->getIndex() - 1) < 0) {
946 myValueLaneDownButton->disable();
947 } else {
948 myValueLaneDownButton->enable();
949 }
950 } else {
951 // if lane doesn't exist, disable both
952 myValueLaneUpButton->disable();
953 myValueLaneDownButton->disable();
954 }
955}
956
957
958void
959GNEAttributesEditorRow::enableElements(const GNEAttributeProperties* attrProperty, const bool forceDisable) {
960 const auto& editModes = myAttributeTable->myFrameParent->getViewNet()->getEditModes();
961 const auto tagProperty = attrProperty->getTagPropertyParent();
962 // by default we assume that elements are disabled
963 bool enableElements = false;
964 if (forceDisable) {
965 enableElements = false;
966 } else if (editModes.isCurrentSupermodeNetwork()) {
967 if (tagProperty->isNetworkElement() || tagProperty->isAdditionalElement()) {
968 enableElements = true;
969 } else if ((tagProperty->getTag() == SUMO_TAG_TAZSOURCE) || (tagProperty->getTag() == SUMO_TAG_TAZSINK)) {
970 enableElements = true;
971 }
972 } else if (editModes.isCurrentSupermodeDemand() && tagProperty->isDemandElement()) {
973 enableElements = true;
974 } else if (editModes.isCurrentSupermodeData() && (tagProperty->isDataElement() || tagProperty->isMeanData())) {
975 enableElements = true;
976 }
977 if (!enableElements) {
979 myAttributeButton->disable();
980 myValueTextField->disable();
982 myValueCheckButton->disable();
983 myValueLaneUpButton->disable();
984 myValueLaneDownButton->disable();
985 }
986}
987
988
989bool
991 if (attrProperty->isAlwaysEnabled()) {
992 return true;
993 } else {
994 for (const auto& AC : myAttributeTable->myEditedACs) {
995 if (AC->isAttributeEnabled(attrProperty->getAttr())) {
996 return true;
997 }
998 }
999 return false;
1000 }
1001}
1002
1003/****************************************************************************/
#define TEXTCOLOR_BLUE
#define TEXTCOLOR_RED
#define TEXTCOLOR_BLACK
FXDEFMAP(GNEAttributesEditorRow) GNEAttributeRowMap[]
#define TEXTCOLOR_BACKGROUND_WHITE
#define TEXTCOLOR_BACKGROUND_RED
@ MID_GNE_ATTRIBUTESEDITORROW_MOVELANEUP
move lane up
@ MID_GNE_ATTRIBUTESEDITORROW_OPENDIALOG_FILE
open file dialog in attributes editor row
@ MID_GNE_ATTRIBUTESEDITORROW_SETATTRIBUTE
set attribute (string, bool, etc.) in attributes editor row
@ MID_GNE_ATTRIBUTESEDITORROW_OPENDIALOG_COLOR
open color dialog in attributes editor row
@ MID_GNE_ATTRIBUTESEDITORROW_REPARENT
reparent
@ MID_GNE_ATTRIBUTESEDITORROW_TOGGLEENABLEATTRIBUTE
toogle enable attribute in attributes editor row
@ MID_GNE_ATTRIBUTESEDITORROW_OPENDIALOG_ALLOW
open allow dialog in attributes editor row
@ MID_GNE_ATTRIBUTESEDITORROW_MOVELANEDOWN
move lane down
@ MID_GNE_ATTRIBUTESEDITORROW_INSPECTPARENT
inspect parent
#define GUIDesignButtonAttribute
button extended over over column with thick and raise frame
Definition GUIDesigns.h:88
#define GUIDesignButtonIcon
button only with icon
Definition GUIDesigns.h:91
#define GUIDesignComboBoxAttribute
Combo box static (cannot be edited) extended over the matrix column.
Definition GUIDesigns.h:302
#define GUIDesignComboBoxNCol
number of column of every combo box
Definition GUIDesigns.h:311
#define GUIDesignTextField
Definition GUIDesigns.h:59
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition GUIDesigns.h:399
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition GUIDesigns.h:74
#define GUIDesignComboBoxVisibleItems
Definition GUIDesigns.h:49
#define GUIDesignCheckButton
checkButton placed in left position
Definition GUIDesigns.h:192
#define GUIDesignCheckButtonAttribute
checkButton without thick extended over the frame used for attributes
Definition GUIDesigns.h:201
#define GUIDesignLabelThickedFixed(width)
label thicked, icon before text, text centered and custom width
Definition GUIDesigns.h:252
@ OPEN
open icons
#define TL(string)
Definition MsgHandler.h:301
#define TLF(string,...)
Definition MsgHandler.h:303
SUMOVehicleClass getVehicleClassID(const std::string &name)
Returns the class id of the abstract class given by its name.
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
POIIcon
POI icons.
@ SUMO_TAG_VTYPE
description of a vehicle/person/container type
@ SUMO_TAG_TAZSINK
a sink within a district (connection road)
@ SUMO_TAG_JUNCTION
begin/end of the description of a junction
@ SUMO_TAG_VTYPE_DISTRIBUTION
distribution of a vehicle type
@ SUMO_TAG_DATASET
@ SUMO_TAG_TYPE
type (edge)
@ SUMO_TAG_TAZSOURCE
a source within a district (connection road)
@ SUMO_TAG_EDGE
begin/end of the description of an edge
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_DISALLOW
@ SUMO_ATTR_ICON
icon
@ SUMO_ATTR_LANE
@ GNE_ATTR_PARENT
parent of an additional element
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_EXPECTED
@ GNE_ATTR_STOPOEXCEPTION
stop exceptions (virtual, used by edge and lanes)
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
@ SUMO_ATTR_ANGLE
@ SUMO_ATTR_JOIN
@ SUMO_ATTR_VCLASS
@ GNE_ATTR_FRONTELEMENT
@ SUMO_ATTR_EXPECTED_CONTAINERS
@ SUMO_ATTR_TYPE
@ SUMO_ATTR_COLOR
A color information.
@ SUMO_ATTR_ID
@ SUMO_ATTR_RIGHT_OF_WAY
How to compute right of way.
@ SUMO_ATTR_POSITION
@ SUMO_ATTR_NOTHING
invalid attribute, must be the last one
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
void addDoubleListAttribute(const SumoXMLAttr attr, const std::vector< double > &value)
add double list attribute into current SumoBaseObject node
void addIntAttribute(const SumoXMLAttr attr, const int value)
add int attribute into current SumoBaseObject node
void addPositionVectorAttribute(const SumoXMLAttr attr, const PositionVector &value)
add PositionVector attribute into current SumoBaseObject node
void addBoolAttribute(const SumoXMLAttr attr, const bool value)
add bool attribute into current SumoBaseObject node
void addTimeAttribute(const SumoXMLAttr attr, const SUMOTime value)
add time attribute into current SumoBaseObject node
void addStringListAttribute(const SumoXMLAttr attr, const std::vector< std::string > &value)
add string list attribute into current SumoBaseObject node
void addDoubleAttribute(const SumoXMLAttr attr, const double value)
add double attribute into current SumoBaseObject node
void addPositionAttribute(const SumoXMLAttr attr, const Position &value)
add Position attribute into current SumoBaseObject node
void addStringAttribute(const SumoXMLAttr attr, const std::string &value)
add string attribute into current SumoBaseObject node
void addColorAttribute(const SumoXMLAttr attr, const RGBColor &value)
add color attribute into current SumoBaseObject node
void addParameters(const std::string &value)
add parameters into current SumoBaseObject node (format: key=value1|key2=value2|.....
Dialog for edit rerouters.
static T parse(const std::string &string)
parses a value of type T from string (used for basic types: int, double, bool, etc....
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
bool isVClass() const
return true if attribute is a VehicleClass
bool isProbability() const
return true if attribute is a probability
const std::string & getDefaultStringValue() const
get default value in string format
bool isColor() const
return true if attribute is a color
bool isBool() const
return true if attribute is boolean
const std::string & getAttrStr() const
get XML Attribute in string format (can be updated using alternative name)
bool isPosition() const
return true if attribute is a position
SUMOTime getDefaultTimeValue() const
get default time value
bool isList() const
return true if attribute is a list
double getDefaultDoubleValue() const
get default double value
bool isInt() const
return true if attribute is an integer
bool isDiscrete() const
return true if attribute is discrete
bool isFileOpen() const
return true if attribute is a filename open
int getDefaultIntValue() const
get default int value
bool isVType() const
return true if attribute is a VType or vTypeDistribution
bool isUnique() const
return true if attribute is unique
bool isFloat() const
return true if attribute is a float
const RGBColor & getDefaultColorValue() const
get default bool value
const GNETagProperties * getTagPropertyParent() const
get reference to tagProperty parent
bool isSUMOTime() const
return true if attribute is a SUMOTime
bool hasDefaultValue() const
return true if attribute owns a default value
bool isFileSave() const
return true if attribute is a filename save
bool isFlow() const
return true if attribute is part of a flow definition
bool isActivatable() const
return true if attribute is activatable
const std::string & getFilenameExtensions() const
get filename extensions in string format used in open dialogs
bool isPositive() const
return true if attribute is positive
const std::vector< std::string > & getDiscreteValues() const
get discrete values
const Position & getDefaultPositionValue() const
get default position value
bool isAlwaysEnabled() const
return true if attribute is always enabled
SumoXMLAttr getAttr() const
get XML Attribute
bool isAttributeRowShown() const
check if current attribute row is shown
void enableElements(const GNEAttributeProperties *attrProperty, const bool forceDisable)
check if enable or disable all elements depending of current supermode or forceDisable
MFXButtonTooltip * myValueLaneUpButton
Button for move lane up.
void showValueComboBox(const GNEAttributeProperties *attrProperty, const std::string &value, const bool enabled, const bool computed)
show value for combo Box
FXCheckButton * myAttributeToggleEnableCheckButton
pointer to attribute menu check
MFXButtonTooltip * myAttributeButton
pointer to button that can be used for files, color, parent, vclass or inspect
long onCmdInspectParent(FXObject *, FXSelector, void *)
called when user press "inspect parent"
long onCmdOpenAllowDialog(FXObject *, FXSelector, void *)
called when user press "open allow" dialog
long onCmdOpenColorDialog(FXObject *, FXSelector, void *)
called when user press "edit color" dialog
MFXButtonTooltip * myValueLaneDownButton
Button for move lane down.
const std::string getAttributeValue(const bool enabled) const
get value from edited ACs
void showAttributeColor(const GNEAttributeProperties *attrProperty, const bool enabled)
show attribute button color
bool isAttributeEnabled(const GNEAttributeProperties *attrProperty) const
check if the given attribute is enabled
void showAttributeVClass(const GNEAttributeProperties *attrProperty, const bool enabled)
show attribute button vClass
MFXLabelTooltip * myAttributeLabel
pointer to attribute label
MFXComboBoxIcon * myValueComboBox
pointer to combo box for select choices
SumoXMLAttr fillSumoBaseObject(CommonXMLStructure::SumoBaseObject *baseObject, const bool insertDefaultValues) const
fill sumo Base object
bool isValueValid() const
check if current attribute row is valid
bool hideAttributeRow()
hide attribute row (always return false)
void showAttributeLabel(const GNEAttributeProperties *attrProperty)
show attribute label
GNEAttributesEditorType * myAttributeTable
pointer to attribute table parent
long onCmdToggleEnableAttribute(FXObject *, FXSelector, void *)
called when user press the checkBox for toogle enable/disable attribute
std::string getCurrentValue() const
get current value in string format
const GNEAttributeProperties * getAttrProperty() const
get attribute property
GNEAttributesEditorRow()
default constructor (needed for FOX)
long onCmdMoveLaneDown(FXObject *, FXSelector, void *)
called when user press "move lane down"
long onCmdMoveLaneUp(FXObject *, FXSelector, void *)
called when user press "move lane up"
void showMoveLaneButtons(const std::string &laneID)
show move lane buttons
void showAttributeToggleEnable(const GNEAttributeProperties *attrProperty, const bool value)
show attribute toogle enable
FXCheckButton * myValueCheckButton
pointer to menu check
void showAttributeInspectParent(const GNEAttributeProperties *attrProperty, const bool enabled)
show attribute button inspect parent
const GNEAttributeProperties * myAttrProperty
edited attribute property
void showValueCheckButton(const std::string &value, const bool enabled, const bool computed)
show value for check button
void hideAllAttributeElements()
hide all attribute elements
long onCmdSetAttribute(FXObject *obj, FXSelector, void *)
set new string/bool attribute
bool showAttributeRow(GNEAttributesEditorType *attributeTable, const GNEAttributeProperties *attrProperty, const bool forceDisable)
return true if attribute row was successfully show
void showAttributeFile(const GNEAttributeProperties *attrProperty, const bool enabled)
show attribute button file
long onCmdOpenFileDialog(FXObject *, FXSelector, void *)
called when user press "open file" dialog
void showAttributeReparent(const bool enabled)
show attribute button reparent
MFXTextFieldTooltip * myValueTextField
pointer to text field for modify values
void showValueString(const std::string &value, const bool enabled, const bool computed)
show value for strings
long onCmdReparent(FXObject *, FXSelector, void *)
called when user press reparent button
GNEFrame * getFrameParent() const
pointer to GNEFrame parent
bool isEditorTypeEditor() const
check if this is an attribute editor of type "editor"
GNEFrame * myFrameParent
pointer to GNEFrame parent
std::vector< GNEAttributeCarrier * > myEditedACs
current edited ACs
void setAttribute(SumoXMLAttr attr, const std::string &value)
set attribute in the current ACs (Callend from row)
void inspectParent()
inspect parent (Callend from row)
const EditorType myEditorType
variable use for packing editorType type options
void enableReparent()
void enable reparent
void toggleEnableAttribute(SumoXMLAttr attr, const bool value)
set attribute in the current ACs (Callend from row)
GNEViewNet * getViewNet() const
get view net
Definition GNEFrame.cpp:154
GNELane * retrieveLane(const std::string &id, bool hardFail=true, bool checkVolatileChange=false) const
get lane by id
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:146
bool isMeanData() const
return true if tag correspond to a mean data element
GUIIcon getGUIIcon() const
get GUI icon associated to this tag property
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool isDemandElement() const
return true if tag correspond to a demand element
bool isAdditionalElement() const
return true if tag correspond to an additional element (note: this include TAZ, shapes and wires)
GNENet * getNet() const
get the net object
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
GNEViewParent * getViewParent() const
get the net object
GNEApplicationWindow * getGNEAppWindows() const
get GNE Application Windows
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
MFXStaticToolTip * getStaticTooltipMenu() const
get static toolTip for menus
long setCurrentItem(const FXint index, FXbool notify=FALSE)
Set the current item (index is zero-based)
FXint findItem(const FXString &text) const
find item
FXint getNumItems() const
Return the number of items in the list.
void setBackColor(FXColor clr)
Set window background color.
FXString getText() const
Get the text.
void setTextColor(FXColor clr)
Change text color.
virtual void clearItems()
Remove all items from the list.
void disable()
Disable combo box.
FXColor getTextColor() const
Return 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
void enable()
Enable combo box.
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toggled)
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 FXIcon * getPOIIcon(POIIcon iconType)
returns icon associated to the given POI image
Definition POIIcons.cpp:30
static const RGBColor BLACK
Definition RGBColor.h:196
static StringBijection< POIIcon > POIIcons
POI icon values.
static StringBijection< RightOfWay > RightOfWayValues
righ of way algorithms
std::vector< T > getValues() const
get all keys
static std::string replace(std::string str, const std::string &what, const std::string &by)
Replaces all occurrences of the second string by the third string within the first string.
static FXIcon * getVClassIcon(const SUMOVehicleClass vc)
returns icon associated to the given vClass
static std::string openFileDialog(FXWindow *window, const std::string title, GUIIcon icon, const std::string &extensions, bool save, bool multi=false)
open filename dialog (general)