Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
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
23#include <netedit/GNENet.h>
25#include <netedit/GNEViewNet.h>
35
37
38// ===========================================================================
39// FOX callback mapping
40// ===========================================================================
41
53
54// Object implementation
55FXIMPLEMENT(GNEAttributesEditorRow, FXHorizontalFrame, GNEAttributeRowMap, ARRAYNUMBER(GNEAttributeRowMap))
56
57// ===========================================================================
58// defines
59// ===========================================================================
60
61#define TEXTCOLOR_BLACK FXRGB(0, 0, 0)
62#define TEXTCOLOR_BLUE FXRGB(0, 0, 255)
63#define TEXTCOLOR_RED FXRGB(255, 0, 0)
64#define TEXTCOLOR_BACKGROUND_RED FXRGBA(255, 213, 213, 255)
65#define TEXTCOLOR_BACKGROUND_WHITE FXRGB(255, 255, 255)
66
67// ===========================================================================
68// method definitions
69// ===========================================================================
70
72 FXHorizontalFrame(attributeTable->getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame),
73 myAttributeTable(attributeTable) {
74 // get static tooltip menu
75 const auto tooltipMenu = attributeTable->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu();
76 // Create left label
77 myAttributeLabel = new MFXLabelTooltip(this, tooltipMenu, "Label", nullptr, GUIDesignLabelThickedFixed(100));
78 myAttributeLabel->hide();
79 // create lef boolean checkBox for enable/disable attributes
80 myAttributeToggleEnableCheckButton = new FXCheckButton(this, "Enable/Disable attribute checkBox", this,
83 // create left button parent
84 myAttributeButton = new MFXButtonTooltip(this, tooltipMenu, "button", nullptr, this,
86 // create right text field for string attributes
87 myValueTextField = new MFXTextFieldTooltip(this, tooltipMenu, GUIDesignTextFieldNCol, this,
89 myValueTextField->hide();
90 // create right combo box for discrete attributes
93 myValueComboBox->hide();
94 // Create right check button
95 myValueCheckButton = new FXCheckButton(this, "check button", this, MID_GNE_ATTRIBUTESEDITORROW_SETATTRIBUTE, GUIDesignCheckButton);
96 myValueCheckButton->hide();
97 // create right move lane up button
100 myValueLaneUpButton->hide();
101 // set tip texts
102 myValueLaneUpButton->setTipText(TL("Move element up one lane"));
103 myValueLaneUpButton->setHelpText(TL("Move element up one lane"));
104 // create right move lane down button
107 myValueLaneDownButton->hide();
108 // set tip texts
109 myValueLaneDownButton->setTipText(TL("Move element down one lane"));
110 myValueLaneDownButton->setHelpText(TL("Move element down one lane"));
111 // start hidden
112 hide();
113}
114
115
116bool
117GNEAttributesEditorRow::showAttributeRow(GNEAttributesEditorType* attributeTable, const GNEAttributeProperties* attrProperty, const bool forceDisable) {
118 // update parent table
119 myAttributeTable = attributeTable;
120 if (myAttributeTable->myEditedACs.empty()) {
121 return false;
122 } else {
124 }
125 myAttrProperty = attrProperty;
126 const auto attribute = myAttrProperty->getAttr();
127 const auto tagPropertyParent = attrProperty->getTagPropertyParent();
128 const auto firstEditedAC = myAttributeTable->myEditedACs.front();
129 // check if we're editing multiple ACs
130 const auto multipleEditedACs = (myAttributeTable->myEditedACs.size() > 1);
131 // declare flag for show attribute enabled
132 const bool attributeEnabled = isAttributeEnabled(attrProperty);
133 // check if this attribute is computed
134 const bool computedAttribute = multipleEditedACs ? false : firstEditedAC->isAttributeComputed(attribute);
135 // get string value depending if attribute is enabled
136 const std::string value = getAttributeValue(attributeEnabled);
137 // get parent if we're editing single vTypes
138 GNEAttributeCarrier* ACParent = nullptr;
139 if (!multipleEditedACs && attrProperty->isVType()) {
141 // parent can be either type or distribution
142 if (attribute == SUMO_ATTR_TYPE) {
143 ACParent = ACs->retrieveDemandElement(SUMO_TAG_VTYPE, firstEditedAC->getAttribute(SUMO_ATTR_TYPE), false);
144 }
145 if (ACParent == nullptr) {
146 ACParent = ACs->retrieveDemandElement(SUMO_TAG_VTYPE_DISTRIBUTION, firstEditedAC->getAttribute(SUMO_ATTR_TYPE), false);
147 }
148 }
149 // hide editing for unique attributes in case of multi-selection
150 if (multipleEditedACs && attrProperty->isUnique()) {
151 return hideAttributeRow();
152 }
153 // front element has their own button, and doesn't use the UndoList
154 if (attribute == GNE_ATTR_FRONTELEMENT) {
155 return hideAttributeRow();
156 }
157 // if we have a disabled flow attribute, don't show row
158 if (attrProperty->isFlow() && !attributeEnabled) {
159 return hideAttributeRow();
160 }
161 // expected and joins depend of triggered
162 if (tagPropertyParent->isVehicleStop() && !attributeEnabled) {
163 if (attribute == SUMO_ATTR_EXPECTED) {
164 return hideAttributeRow();
165 } else if (attribute == SUMO_ATTR_EXPECTED_CONTAINERS) {
166 return hideAttributeRow();
167 } else if (attribute == SUMO_ATTR_JOIN) {
168 return hideAttributeRow();
169 }
170 }
171 // don't show stop offset exception if stopOffset is zero
172 if ((attribute == GNE_ATTR_STOPOEXCEPTION) && !attributeEnabled) {
173 return hideAttributeRow();
174 }
175 // show elements depending of attribute properties
176 if (attrProperty->isActivatable()) {
177 showAttributeToggleEnable(attrProperty, attributeEnabled);
178 } else if (attrProperty->isFileOpen() || attrProperty->isFileSave()) {
179 showAttributeFile(attrProperty, attributeEnabled);
180 } else if (attribute == GNE_ATTR_PARENT) {
181 showAttributeReparent(attributeEnabled);
182 } else if ((attribute == SUMO_ATTR_TYPE) && tagPropertyParent->hasTypeParent()) {
183 showAttributeInspectParent(attrProperty, attributeEnabled);
184 } else if (attrProperty->isVClass() && (attribute != SUMO_ATTR_DISALLOW)) {
185 showAttributeVClass(attrProperty, attributeEnabled);
186 } else if (attribute == SUMO_ATTR_COLOR) {
187 showAttributeColor(attrProperty, attributeEnabled);
188 } else if (attribute == GNE_ATTR_PARAMETERS) {
190 } else {
191 showAttributeLabel(attrProperty);
192 }
193 // continue depending of type of attribute
194 if (attrProperty->isBool()) {
195 showValueCheckButton(value, attributeEnabled, computedAttribute);
196 } else if (attrProperty->isDiscrete() || attrProperty->isVType()) {
197 showValueComboBox(attrProperty, value, attributeEnabled, computedAttribute);
198 } else {
199 showValueString(value, attributeEnabled, computedAttribute);
200 }
201 // check if show move lane buttons
202 if (!multipleEditedACs && !tagPropertyParent->isNetworkElement() && (attribute == SUMO_ATTR_LANE)) {
203 showMoveLaneButtons(value);
204 myValueLaneUpButton->show();
205 myValueLaneDownButton->show();
206 } else {
207 myValueLaneUpButton->hide();
208 myValueLaneDownButton->hide();
209 }
210 // enable depending of supermode
211 enableElements(attrProperty, forceDisable);
212 // Show row
213 show();
214 return true;
215}
216
217
218bool
220 hide();
221 return false;
222}
223
224
225void
227 // disable all elements
229 myAttributeButton->disable();
230 myValueTextField->disable();
232 myValueCheckButton->disable();
233 myValueLaneUpButton->disable();
234 myValueLaneDownButton->disable();
235}
236
237
242
243
244std::string
246 if (myValueCheckButton->shown()) {
247 return (myValueCheckButton->getCheck() == TRUE) ? "true" : "false";
248 } else if (myValueComboBox->shown()) {
249 return myValueComboBox->getText().text();
250 } else if (myValueTextField->shown()) {
251 return myValueTextField->getText().text();
252 } else {
253 return "";
254 }
255}
256
257
258bool
260 if (myValueCheckButton->shown()) {
261 return true;
262 } else if (myValueComboBox->shown()) {
264 (myValueComboBox->getBackColor() != TEXTCOLOR_BACKGROUND_RED);
265 } else if (myValueTextField->shown()) {
266 return (myValueTextField->getTextColor() != TEXTCOLOR_RED) &&
267 (myValueTextField->getBackColor() != TEXTCOLOR_BACKGROUND_RED);
268 } else {
269 return true;
270 }
271}
272
273
274bool
276 return shown();
277}
278
279
281GNEAttributesEditorRow::fillSumoBaseObject(CommonXMLStructure::SumoBaseObject* baseObject, const bool insertDefaultValues) const {
282 const auto attribute = myAttrProperty->getAttr();
283 // check if this is the default value
284 const bool usingDefaultValue = isValueValid() && (myAttrProperty->getDefaultStringValue() == getCurrentValue());
285 // first check if insert default values
286 if (!insertDefaultValues && usingDefaultValue) {
287 return SUMO_ATTR_NOTHING;
288 }
289 // now check if attribute is activatable AND is enabled
290 if (myAttrProperty->isActivatable() && (myAttributeToggleEnableCheckButton->getCheck() == FALSE)) {
291 return SUMO_ATTR_NOTHING;
292 }
293 // continue depending of type
294 if (myAttrProperty->isBool()) {
295 baseObject->addBoolAttribute(attribute, myValueCheckButton->getCheck() == TRUE);
296 } else if (myAttrProperty->isDiscrete()) {
298 (myValueComboBox->getBackColor() == TEXTCOLOR_BACKGROUND_RED)) {
299 return attribute;
300 } else {
301 baseObject->addStringAttribute(attribute, myValueComboBox->getText().text());
302 }
303 } else if ((myValueTextField->getTextColor() == TEXTCOLOR_RED) ||
304 (myValueTextField->getBackColor() == TEXTCOLOR_BACKGROUND_RED)) {
305 return attribute;
306 } else if (myAttrProperty->isInt()) {
307 // int value
308 if (GNEAttributeCarrier::canParse<int>(myValueTextField->getText().text())) {
309 const auto intValue = GNEAttributeCarrier::parse<int>(myValueTextField->getText().text());
310 if (myAttrProperty->isPositive() && (intValue < 0)) {
311 return attribute;
312 } else {
313 baseObject->addIntAttribute(attribute, intValue);
314 }
315 } else if (myAttrProperty->hasDefaultValue() && (myValueTextField->getText().text() == myAttrProperty->getDefaultStringValue())) {
316 baseObject->addIntAttribute(attribute, myAttrProperty->getDefaultIntValue());
317 } else if (myAttrProperty->hasDefaultValue() && myValueTextField->getText().empty()) {
318 baseObject->addIntAttribute(attribute, myAttrProperty->getDefaultIntValue());
319 } else {
320 return attribute;
321 }
322 } else if (myAttrProperty->isFloat()) {
323 // double value
324 if (myAttrProperty->isList()) {
325 if (GNEAttributeCarrier::canParse<std::vector<double> >(myValueTextField->getText().text())) {
326 const auto doubleListValue = GNEAttributeCarrier::parse<std::vector<double> >(myValueTextField->getText().text());
327 // check every double
328 for (const auto doubleValue : doubleListValue) {
329 if (myAttrProperty->isPositive() && (doubleValue < 0)) {
330 return attribute;
331 } else if (myAttrProperty->isFloat() && ((doubleValue < 0) || (doubleValue > 1))) {
332 return attribute;
333 }
334 }
335 baseObject->addDoubleListAttribute(attribute, doubleListValue);
336 } else {
337 return attribute;
338 }
339 } else if (GNEAttributeCarrier::canParse<double>(myValueTextField->getText().text())) {
340 const auto doubleValue = GNEAttributeCarrier::parse<double>(myValueTextField->getText().text());
341 // check using default value for certain default values (for example, lenght = -1)
342 if (!usingDefaultValue && myAttrProperty->isPositive() && (doubleValue < 0)) {
343 return attribute;
344 } else if (!usingDefaultValue && myAttrProperty->isProbability() && ((doubleValue < 0) || (doubleValue > 1))) {
345 return attribute;
346 } else {
347 baseObject->addDoubleAttribute(attribute, doubleValue);
348 }
349 } else if (myAttrProperty->hasDefaultValue() && (myValueTextField->getText().text() == myAttrProperty->getDefaultStringValue())) {
351 } else if (myAttrProperty->hasDefaultValue() && myValueTextField->getText().empty()) {
353 } else {
354 return attribute;
355 }
356 } else if (myAttrProperty->isSUMOTime()) {
357 // time value
358 if (GNEAttributeCarrier::canParse<SUMOTime>(myValueTextField->getText().text())) {
359 const auto timeValue = GNEAttributeCarrier::parse<SUMOTime>(myValueTextField->getText().text());
360 if (timeValue < 0) {
361 return attribute;
362 } else {
363 baseObject->addTimeAttribute(attribute, timeValue);
364 }
365 } else if (myAttrProperty->hasDefaultValue() && (myValueTextField->getText().text() == myAttrProperty->getDefaultStringValue())) {
366 baseObject->addTimeAttribute(attribute, myAttrProperty->getDefaultTimeValue());
367 } else if (myAttrProperty->hasDefaultValue() && myValueTextField->getText().empty()) {
368 baseObject->addTimeAttribute(attribute, myAttrProperty->getDefaultTimeValue());
369 } else {
370 return attribute;
371 }
372 } else if (myAttrProperty->isPosition()) {
373 // position value
374 if (myAttrProperty->isList()) {
375 if (GNEAttributeCarrier::canParse<PositionVector>(myValueTextField->getText().text())) {
376 baseObject->addPositionVectorAttribute(attribute, GNEAttributeCarrier::parse<PositionVector>(myValueTextField->getText().text()));
377 } else {
378 return attribute;
379 }
380 } else if (GNEAttributeCarrier::canParse<Position>(myValueTextField->getText().text())) {
381 baseObject->addPositionAttribute(attribute, GNEAttributeCarrier::parse<Position>(myValueTextField->getText().text()));
382 } else if (myAttrProperty->hasDefaultValue() && (myValueTextField->getText().text() == myAttrProperty->getDefaultStringValue())) {
384 } else if (myAttrProperty->hasDefaultValue() && myValueTextField->getText().empty()) {
386 } else {
387 return attribute;
388 }
389 } else if (myAttrProperty->isColor()) {
390 // color value
391 if (GNEAttributeCarrier::canParse<RGBColor>(myValueTextField->getText().text())) {
392 baseObject->addColorAttribute(attribute, GNEAttributeCarrier::parse<RGBColor>(myValueTextField->getText().text()));
393 } else if (myAttrProperty->hasDefaultValue() && (myValueTextField->getText().text() == myAttrProperty->getDefaultStringValue())) {
394 baseObject->addColorAttribute(attribute, myAttrProperty->getDefaultColorValue());
395 } else if (myAttrProperty->hasDefaultValue() && myValueTextField->getText().empty()) {
396 baseObject->addColorAttribute(attribute, myAttrProperty->getDefaultColorValue());
397 } else {
398 return attribute;
399 }
400 } else if (myAttrProperty->isList()) {
401 baseObject->addStringListAttribute(attribute, GNEAttributeCarrier::parse<std::vector<std::string> >(myValueTextField->getText().text()));
402 } else if (attribute == GNE_ATTR_PARAMETERS) {
403 baseObject->addParameters(myValueTextField->getText().text());
404 } else {
405 baseObject->addStringAttribute(attribute, myValueTextField->getText().text());
406 }
407 // all ok, then return nothing
408 return SUMO_ATTR_NOTHING;
409}
410
411
412long
413GNEAttributesEditorRow::onCmdOpenColorDialog(FXObject*, FXSelector, void*) {
414 // check if get the value of the modal arguments
417 } else {
418 // create FXColorDialog
419 FXColorDialog colordialog(myAttributeTable->getFrameParent()->getViewNet(), TL("Color Dialog"));
420 colordialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::COLORWHEEL));
421 // If previous attribute wasn't correct, set black as default color
422 if (GNEAttributeCarrier::canParse<RGBColor>(myValueTextField->getText().text())) {
423 colordialog.setRGBA(MFXUtils::getFXColor(GNEAttributeCarrier::parse<RGBColor>(myValueTextField->getText().text())));
424 } else if (myAttrProperty->hasDefaultValue()) {
426 } else {
427 colordialog.setRGBA(MFXUtils::getFXColor(RGBColor::BLACK));
428 }
429 // execute dialog to get a new color in the text field
430 if (colordialog.execute() == 1) {
431 myValueTextField->setText(toString(MFXUtils::getRGBColor(colordialog.getRGBA())).c_str(), TRUE);
432 }
433 }
434 return 1;
435}
436
437
438long
439GNEAttributesEditorRow::onCmdOpenAllowDialog(FXObject*, FXSelector, void*) {
441 const auto allowVClassesDialog = myAttributeTable->getFrameParent()->getViewNet()->getAllowVClassesDialog();
442 // open dialog
443 if (allowVClassesDialog->openDialog(myAttrProperty->getAttr(), myValueTextField->getText().text(), internalTests) == 1) {
444 myValueTextField->setText(allowVClassesDialog->getModifiedVClasses().c_str(), TRUE);
445 }
446 return 1;
447}
448
449
450long
451GNEAttributesEditorRow::onCmdOpenFileDialog(FXObject*, FXSelector, void*) {
452 // set title depending if we're loading or saving
453 const std::string title = myAttrProperty->isFileSave() ?
454 TLF("Select existent o create new file for % attribute", myAttrProperty->getAttrStr()) :
455 TLF("Select existent file for % attribute", myAttrProperty->getAttrStr());
456 // open dialog
457 const std::string value = GNEApplicationWindowHelper::openFileDialog(
461 // update text field
462 if (value.size() > 0) {
463 myValueTextField->setText(value.c_str(), TRUE);
464 }
465 return 1;
466}
467
468
469long
470GNEAttributesEditorRow::onCmdReparent(FXObject*, FXSelector, void*) {
472 return 1;
473}
474
475
476long
477GNEAttributesEditorRow::onCmdInspectParent(FXObject*, FXSelector, void*) {
479 return 1;
480}
481
482
483long
484GNEAttributesEditorRow::onCmdMoveLaneUp(FXObject*, FXSelector, void*) {
486 return 1;
487}
488
489
490long
491GNEAttributesEditorRow::onCmdMoveLaneDown(FXObject*, FXSelector, void*) {
493 return 1;
494}
495
496
497long
498GNEAttributesEditorRow::onCmdSetAttribute(FXObject* obj, FXSelector, void*) {
499 if (myAttributeTable->myEditedACs.empty()) {
500 return 0;
501 }
502 const auto& editedAC = myAttributeTable->myEditedACs.front();
503 const auto attribute = myAttrProperty->getAttr();
504 // continue depending of clicked object
505 if (obj == myValueCheckButton) {
506 // Set true o false depending of the checkBox
507 if (myValueCheckButton->getCheck()) {
508 myValueCheckButton->setText("true");
509 } else {
510 myValueCheckButton->setText("false");
511 }
512 myAttributeTable->setAttribute(attribute, myValueCheckButton->getText().text());
513 } else if (obj == myValueComboBox) {
514 const std::string newValue = myValueComboBox->getText().text();
515 // check if the new comboBox value is valid
516 if (editedAC->isValid(attribute, newValue)) {
519 myValueComboBox->killFocus();
520 myAttributeTable->setAttribute(attribute, newValue);
521 } else {
522 // edit colors
524 if (newValue.empty()) {
526 }
527 }
528 } else if (obj == myValueTextField) {
529 // first check if set default value
530 if (myValueTextField->getText().empty() && myAttrProperty->hasDefaultValue() && !myAttrProperty->isVClass()) {
531 // update text field without notify
532 myValueTextField->setText(myAttrProperty->getDefaultStringValue().c_str(), FALSE);
533 }
534 // if we're editing an angle, check if filter between [0,360]
535 if ((attribute == SUMO_ATTR_ANGLE) && GNEAttributeCarrier::canParse<double>(myValueTextField->getText().text())) {
536 // filter anglea and update text field without notify
537 const double angle = fmod(GNEAttributeCarrier::parse<double>(myValueTextField->getText().text()), 360);
538 myValueTextField->setText(toString(angle).c_str(), FALSE);
539 }
540 // if we're editing a position or a shape, strip whitespace after comma
541 if ((attribute == SUMO_ATTR_POSITION) || (attribute == SUMO_ATTR_SHAPE)) {
542 std::string shape(myValueTextField->getText().text());
543 while (shape.find(", ") != std::string::npos) {
544 shape = StringUtils::replace(shape, ", ", ",");
545 }
546 myValueTextField->setText(toString(shape).c_str(), FALSE);
547 }
548 // if we're editing a int, strip decimal value
549 if (myAttrProperty->isInt() && GNEAttributeCarrier::canParse<double>(myValueTextField->getText().text())) {
550 double doubleValue = GNEAttributeCarrier::parse<double>(myValueTextField->getText().text());
551 if ((doubleValue - (int)doubleValue) == 0) {
552 myValueTextField->setText(toString((int)doubleValue).c_str(), FALSE);
553 }
554 }
555 // after apply all filters, obtain value
556 const std::string newValue = myValueTextField->getText().text();
557 // check if the new textField value is valid
558 if (editedAC->isValid(attribute, newValue)) {
559 myValueTextField->setTextColor(TEXTCOLOR_BLACK);
561 myValueTextField->killFocus();
562 if (myAttributeTable->isEditorTypeEditor() || newValue.empty() || (attribute != SUMO_ATTR_ID)) {
563 myAttributeTable->setAttribute(attribute, newValue);
564 }
565 } else {
566 // edit colors
567 myValueTextField->setTextColor(TEXTCOLOR_RED);
568 if (newValue.empty()) {
570 }
571 }
572 }
573 return 1;
574}
575
576
577long
582
583
585 myAttributeTable(nullptr) {
586}
587
588
589const std::string
591 const auto attribute = myAttrProperty->getAttr();
592 // if we're in creator mode, generate ID
595 const auto parentTag = myAttrProperty->getTagPropertyParent()->getTag();
597 return ACs->generateEdgeID();
599 return ACs->generateAdditionalID(parentTag);
601 return ACs->generateDemandElementID(parentTag);
603 return ACs->generateMeanDataID(parentTag);
604 } else if (parentTag == SUMO_TAG_TYPE) {
605 return ACs->generateEdgeTypeID();
606 } else if (parentTag == SUMO_TAG_DATASET) {
607 return ACs->generateDataSetID();
608 }
609 }
610 if (enabled) {
611 // Declare a set of occurring values and insert attribute's values of item (note: We use a set to avoid repeated values)
612 std::set<std::string> values;
613 // iterate over edited attributes and insert every value in set
614 for (const auto& editedAC : myAttributeTable->myEditedACs) {
615 if (editedAC->hasAttribute(attribute)) {
616 values.insert(editedAC->getAttribute(attribute));
617 }
618 }
619 // merge all values in a single string
620 std::ostringstream oss;
621 for (auto it = values.begin(); it != values.end(); it++) {
622 if (it != values.begin()) {
623 oss << " ";
624 }
625 oss << *it;
626 }
627 // obtain value to be shown in row
628 return oss.str();
629 } else {
630 return myAttributeTable->myEditedACs.front()->getAlternativeValueForDisabledAttributes(attribute);
631 }
632}
633
634
635void
637 myAttributeToggleEnableCheckButton->setText(attrProperty->getAttrStr().c_str());
638 myAttributeToggleEnableCheckButton->setCheck(value);
641 // hide other elements
642 myAttributeLabel->hide();
643 myAttributeButton->hide();
644}
645
646
647void
649 // update attribute button
650 myAttributeButton->setText(TL("Reparent"));
651 myAttributeButton->setHelpText(TL("Change parent of this element"));
652 myAttributeButton->setTipText(myAttributeButton->getHelpText());
653 myAttributeButton->setIcon(nullptr);
655 if (enabled) {
656 myAttributeButton->enable();
657 } else {
658 myAttributeButton->disable();
659 }
660 myAttributeButton->show();
661 // hide other elements
662 myAttributeLabel->hide();
664}
665
666
667void
669 // update attribute button
670 myAttributeButton->setText(attrProperty->getAttrStr().c_str());
671 myAttributeButton->setHelpText(TLF("Inspect % parent", attrProperty->getAttrStr()).c_str());
672 myAttributeButton->setTipText(myAttributeButton->getHelpText());
675 if (enabled) {
676 myAttributeButton->enable();
677 } else {
678 myAttributeButton->disable();
679 }
680 myAttributeButton->show();
681 // hide other elements
682 myAttributeLabel->hide();
684}
685
686
687void
689 // update attribute button
690 myAttributeButton->setText(attrProperty->getAttrStr().c_str());
691 myAttributeButton->setHelpText(TL("Open dialog for editing vClasses"));
692 myAttributeButton->setTipText(myAttributeButton->getHelpText());
693 myAttributeButton->setIcon(nullptr);
695 if (enabled) {
696 myAttributeButton->enable();
697 } else {
698 myAttributeButton->disable();
699 }
700 myAttributeButton->show();
701 // hide other elements
702 myAttributeLabel->hide();
704}
705
706
707void
709 // update attribute button
710 myAttributeButton->setText(attrProperty->getAttrStr().c_str());
711 myAttributeButton->setHelpText(TL("Open dialog for editing color"));
712 myAttributeButton->setTipText(myAttributeButton->getHelpText());
715 if (enabled) {
716 myAttributeButton->enable();
717 } else {
718 myAttributeButton->disable();
719 }
720 myAttributeButton->show();
721 // hide other elements
722 myAttributeLabel->hide();
724}
725
726
727void
729 // update attribute button
730 myAttributeButton->setText(attrProperty->getAttrStr().c_str());
731 if (attrProperty->isFileOpen()) {
732 myAttributeButton->setHelpText(TL("Open dialog to select an existent file"));
733 } else {
734 myAttributeButton->setHelpText(TL("Open dialog to select or create an existent file"));
735 }
736 myAttributeButton->setTipText(myAttributeButton->getHelpText());
739 if (enabled) {
740 myAttributeButton->enable();
741 } else {
742 myAttributeButton->disable();
743 }
744 myAttributeButton->show();
745 // hide other elements
746 myAttributeLabel->hide();
748}
749
750
751void
753 myAttributeLabel->setText(attrProperty->getAttrStr().c_str());
754 myAttributeLabel->show();
755 // hide other elements
757 myAttributeButton->hide();
758}
759
760
761void
767
768
769void
771 const bool enabled, const bool computed) {
772 // first we need to check if all boolean values are equal
773 bool allValuesEqual = true;
774 // declare boolean vector
775 std::vector<bool> booleanVector;
776 // check if value can be parsed to a boolean vector
777 if (GNEAttributeCarrier::canParse<std::vector<bool> >(value)) {
778 booleanVector = GNEAttributeCarrier::parse<std::vector<bool> >(value);
779 }
780 // iterate over booleans comparing all element with the first
781 for (const auto& booleanValue : booleanVector) {
782 if (booleanValue != booleanVector.front()) {
783 allValuesEqual = false;
784 }
785 }
786 // use checkbox or textfield depending if all booleans are equal
787 if (allValuesEqual) {
788 if (enabled) {
789 myValueCheckButton->enable();
790 } else {
791 myValueCheckButton->disable();
792 }
793 // set check button
794 if ((booleanVector.size() > 0) && booleanVector.front()) {
795 myValueCheckButton->setCheck(true);
796 myValueCheckButton->setText("true");
797 } else {
798 myValueCheckButton->setCheck(false);
799 myValueCheckButton->setText("false");
800 }
801 // show check button
802 myValueCheckButton->show();
803 // hide other value elements
804 myValueTextField->hide();
805 myValueComboBox->hide();
806 myValueLaneUpButton->hide();
807 myValueLaneDownButton->hide();
808 } else {
809 // show value as string
810 showValueString(value, enabled, computed);
811 }
812}
813
814
815void
816GNEAttributesEditorRow::showValueComboBox(const GNEAttributeProperties* attrProperty, const std::string& value,
817 const bool enabled, const bool computed) {
818 // first we need to check if all boolean values are equal
819 bool allValuesEqual = true;
820 // declare boolean vector
821 std::vector<std::string> stringVector = GNEAttributeCarrier::parse<std::vector<std::string> >(value);
822 // iterate over string comparing all element with the first
823 for (const auto& stringValue : stringVector) {
824 if (stringValue != stringVector.front()) {
825 allValuesEqual = false;
826 }
827 }
828 // use checkbox or textfield depending if all booleans are equal
829 if (allValuesEqual) {
830 // clear and enable comboBox
834 if (enabled) {
836 } else {
838 }
839 // fill depeding of ACAttr
840 if (attrProperty->getAttr() == SUMO_ATTR_VCLASS) {
841 // add all vClasses with their icons
842 for (const auto& vClassStr : SumoVehicleClassStrings.getStrings()) {
844 }
845 } else if (attrProperty->isVType()) {
846 // get ACs
848 // fill comboBox with all vTypes and vType distributions sorted by ID
849 std::map<std::string, GNEDemandElement*> sortedTypes;
850 for (const auto& type : ACs->getDemandElements().at(SUMO_TAG_VTYPE)) {
851 sortedTypes[type.second->getID()] = type.second;
852 }
853 for (const auto& sortedType : sortedTypes) {
854 myValueComboBox->appendIconItem(sortedType.first.c_str(), sortedType.second->getACIcon());
855 }
856 sortedTypes.clear();
857 for (const auto& typeDistribution : ACs->getDemandElements().at(SUMO_TAG_VTYPE_DISTRIBUTION)) {
858 sortedTypes[typeDistribution.second->getID()] = typeDistribution.second;
859 }
860 for (const auto& sortedType : sortedTypes) {
861 myValueComboBox->appendIconItem(sortedType.first.c_str(), sortedType.second->getACIcon());
862 }
863 } else if (attrProperty->getAttr() == SUMO_ATTR_ICON) {
864 // add all POIIcons with their icons
865 for (const auto& POIIcon : SUMOXMLDefinitions::POIIcons.getValues()) {
867 }
868 } else if ((attrProperty->getAttr() == SUMO_ATTR_RIGHT_OF_WAY) && (myAttributeTable->myEditedACs.size() == 1) &&
869 (attrProperty->getTagPropertyParent()->getTag() == SUMO_TAG_JUNCTION)) {
870 // special case for junction types
871 if (myAttributeTable->myEditedACs.front()->getAttribute(SUMO_ATTR_TYPE) == "priority") {
874 } else if (myAttributeTable->myEditedACs.front()->getAttribute(SUMO_ATTR_TYPE) == "traffic_light") {
878 } else {
880 }
881 } else {
882 // fill comboBox with discrete values
883 for (const auto& discreteValue : attrProperty->getDiscreteValues()) {
884 myValueComboBox->appendIconItem(discreteValue.c_str(), nullptr);
885 }
886 }
887 // set current value (or disable)
888 const auto index = myValueComboBox->findItem(value.c_str());
889 if (index < 0) {
890 if (myValueComboBox->getNumItems() > 0) {
892 } else {
894 }
895 } else {
897 }
898 // show comboBox button
899 myValueComboBox->show();
900 // hide other value elements
901 myValueTextField->hide();
902 myValueCheckButton->hide();
903 myValueLaneUpButton->hide();
904 myValueLaneDownButton->hide();
905 } else {
906 // show value as string
907 showValueString(value, enabled, computed);
908 }
909}
910
911
912void
913GNEAttributesEditorRow::showValueString(const std::string& value, const bool enabled, const bool computed) {
914 // clear and enable comboBox
915 myValueTextField->setText(value.c_str());
916 if (computed) {
917 myValueTextField->setTextColor(TEXTCOLOR_BLUE);
918 } else {
919 myValueTextField->setTextColor(TEXTCOLOR_BLACK);
920 }
921 if (enabled) {
922 myValueTextField->enable();
923 } else {
924 myValueTextField->disable();
925 }
926 // show list of values
927 myValueTextField->show();
928 // hide other value elements
929 myValueCheckButton->hide();
930 myValueComboBox->hide();
931}
932
933
934void
936 // retrieve lane
937 const auto lane = myAttributeTable->myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveLane(laneID, false);
938 // check lane
939 if (lane) {
940 // check if disable move up
941 if ((lane->getIndex() + 1) >= (int)lane->getParentEdge()->getChildLanes().size()) {
942 myValueLaneUpButton->disable();
943 } else {
944 myValueLaneUpButton->enable();
945 }
946 // check if disable move down
947 if ((lane->getIndex() - 1) < 0) {
948 myValueLaneDownButton->disable();
949 } else {
950 myValueLaneDownButton->enable();
951 }
952 } else {
953 // if lane doesn't exist, disable both
954 myValueLaneUpButton->disable();
955 myValueLaneDownButton->disable();
956 }
957}
958
959
960void
961GNEAttributesEditorRow::enableElements(const GNEAttributeProperties* attrProperty, const bool forceDisable) {
962 const auto& editModes = myAttributeTable->myFrameParent->getViewNet()->getEditModes();
963 const auto tagProperty = attrProperty->getTagPropertyParent();
964 // by default we assume that elements are disabled
965 bool enableElements = false;
966 if (forceDisable) {
967 enableElements = false;
968 } else if (editModes.isCurrentSupermodeNetwork()) {
969 if (tagProperty->isNetworkElement() || tagProperty->isAdditionalElement()) {
970 enableElements = true;
971 } else if ((tagProperty->getTag() == SUMO_TAG_TAZSOURCE) || (tagProperty->getTag() == SUMO_TAG_TAZSINK)) {
972 enableElements = true;
973 }
974 } else if (editModes.isCurrentSupermodeDemand() && tagProperty->isDemandElement()) {
975 enableElements = true;
976 } else if (editModes.isCurrentSupermodeData() && (tagProperty->isDataElement() || tagProperty->isMeanData())) {
977 enableElements = true;
978 }
979 if (!enableElements) {
981 myAttributeButton->disable();
982 myValueTextField->disable();
984 myValueCheckButton->disable();
985 myValueLaneUpButton->disable();
986 myValueLaneDownButton->disable();
987 }
988}
989
990
991bool
993 if (attrProperty->isAlwaysEnabled()) {
994 return true;
995 } else {
996 for (const auto& AC : myAttributeTable->myEditedACs) {
997 if (AC->isAttributeEnabled(attrProperty->getAttr())) {
998 return true;
999 }
1000 }
1001 return false;
1002 }
1003}
1004
1005/****************************************************************************/
#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:305
#define TLF(string,...)
Definition MsgHandler.h:307
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|.....
GNEInternalTest * getInternalTest() const
get netedit test system
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
MFXButtonTooltip * myValueLaneDownButton
Button for move lane down.
const std::string getAttributeValue(const bool enabled) const
get value from edited ACs
long onCmdOpenColorDialog(FXObject *sender, FXSelector, void *arg)
called when user press "edit color" dialog
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:155
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:147
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
GNEAllowVClassesDialog * getAllowVClassesDialog() const
get allow vClasses dialog
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
static const std::string colorValue
color dialog value
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)