91 const
std::
string& value, const
bool attributeEnabled, const
bool computed,
GNEAttributeCarrier* ACParent) :
93 myAttributesEditorParent(attributeEditorParent),
95 myACParent(ACParent) {
97 buildAttributeElements(attributeEnabled, computed);
99 buildValueElements(attributeEnabled, computed);
101 if (getParent()->
id()) {
103 FXHorizontalFrame::create();
105 if (myACAttr.isBool()) {
107 bool allBooleanValuesEqual =
true;
109 std::vector<bool> booleanVector;
112 booleanVector = GNEAttributeCarrier::parse<std::vector<bool> >(value);
115 for (
const auto& booleanValue : booleanVector) {
116 if (booleanValue != booleanVector.front()) {
117 allBooleanValuesEqual =
false;
121 if (allBooleanValuesEqual) {
123 if ((booleanVector.size() > 0) && booleanVector.front()) {
124 myValueCheckButton->setCheck(
true);
125 myValueCheckButton->setText(
"true");
127 myValueCheckButton->setCheck(
false);
128 myValueCheckButton->setText(
"false");
131 myValueCheckButton->show();
134 myValueTextField->setText(value.c_str());
135 myValueTextField->show();
137 }
else if (myACAttr.isDiscrete()) {
139 if (myAttributeButton) {
141 myValueTextField->setText(value.c_str());
142 myValueTextField->show();
146 myValueComboBox->show();
148 }
else if (myACAttr.isVType()) {
151 myValueComboBox->show();
154 myValueTextField->setText(value.c_str());
155 myValueTextField->show();
158 if (myValueLaneUpButton && myValueLaneDownButton) {
159 updateMoveLaneButtons(value);
170 if (getParent()->
id()) {
171 FXHorizontalFrame::destroy();
178 const bool forceRefreshAttribute,
const bool attributeEnabled,
const bool computed,
GNEAttributeCarrier* ACParent) {
180 myACParent = ACParent;
182 refreshAttributeElements(value, attributeEnabled, computed);
183 refreshValueElements(value, attributeEnabled, computed, forceRefreshAttribute);
189 return ((myValueTextField->getTextColor() == FXRGB(0, 0, 0)) || (myValueTextField->getTextColor() == FXRGB(0, 0, 255))) &&
190 ((myValueComboBox->getTextColor() == FXRGB(0, 0, 0)) || (myValueComboBox->getTextColor() == FXRGB(0, 0, 255)));
196 GNEViewNet* viewNet = myAttributesEditorParent->getFrameParent()->getViewNet();
199 FXColorDialog colordialog(
this,
TL(
"Color Dialog"));
200 colordialog.setTarget(
this);
203 if (GNEAttributeCarrier::canParse<RGBColor>(myValueTextField->getText().text())) {
204 colordialog.setRGBA(
MFXUtils::getFXColor(GNEAttributeCarrier::parse<RGBColor>(myValueTextField->getText().text())));
205 }
else if (!myACAttr.getDefaultValue().empty()) {
206 colordialog.setRGBA(
MFXUtils::getFXColor(GNEAttributeCarrier::parse<RGBColor>(myACAttr.getDefaultValue())));
211 if (colordialog.execute()) {
213 myValueTextField->setText(newValue.c_str());
216 if (ACs.size() > 1) {
221 inspectedAC->setAttribute(myACAttr.getAttr(), newValue, viewNet->
getUndoList());
224 if (ACs.size() > 1) {
228 myValueTextField->setTextColor(FXRGB(0, 0, 0));
229 myValueTextField->killFocus();
238 GNEViewNet* viewNet = myAttributesEditorParent->getFrameParent()->getViewNet();
241 if (ACs.size() > 1) {
245 bool acceptChanges =
false;
248 myACAttr.getAttr(), &acceptChanges).execute();
254 inspectedAC->setAttribute(myACAttr.getAttr(), allowed, viewNet->
getUndoList());
257 if (ACs.size() > 1) {
261 myAttributesEditorParent->getFrameParent()->attributeUpdated(myACAttr.getAttr());
269 auto viewnet = myAttributesEditorParent->getFrameParent()->getViewNet();
270 viewnet->getViewParent()->getInspectorFrame()->inspectChild(myACParent, viewnet->getInspectedAttributeCarriers().front());
278 auto viewNet = myAttributesEditorParent->getFrameParent()->getViewNet();
280 auto AC = viewNet->getInspectedAttributeCarriers().front();
282 auto lane = viewNet->getNet()->getAttributeCarriers()->retrieveLane(AC->getAttribute(
SUMO_ATTR_LANE));
284 AC->setAttribute(
SUMO_ATTR_LANE, lane->getParentEdge()->getID() +
"_" +
toString(lane->getIndex() + 1), viewNet->getUndoList());
286 myAttributesEditorParent->getFrameParent()->attributeUpdated(myACAttr.getAttr());
294 auto viewNet = myAttributesEditorParent->getFrameParent()->getViewNet();
296 auto AC = viewNet->getInspectedAttributeCarriers().front();
298 auto lane = viewNet->getNet()->getAttributeCarriers()->retrieveLane(AC->getAttribute(
SUMO_ATTR_LANE));
300 AC->setAttribute(
SUMO_ATTR_LANE, lane->getParentEdge()->getID() +
"_" +
toString(lane->getIndex() - 1), viewNet->getUndoList());
302 myAttributesEditorParent->getFrameParent()->attributeUpdated(myACAttr.getAttr());
312 if (myACAttr.isBool()) {
314 if (myValueCheckButton->shown()) {
316 if (myValueCheckButton->getCheck()) {
317 myValueCheckButton->setText(
"true");
320 myValueCheckButton->setText(
"false");
325 newVal = myValueTextField->getText().text();
327 }
else if (myACAttr.isDiscrete()) {
329 if (myValueTextField->shown()) {
331 newVal = myValueTextField->getText().text();
334 newVal = myValueComboBox->getText().text();
336 }
else if (myACAttr.isVType()) {
338 newVal = myValueComboBox->getText().text();
341 if (myValueTextField->getText().empty() && myACAttr.hasDefaultValue()) {
342 newVal = myACAttr.getDefaultValue();
343 myValueTextField->setText(newVal.c_str());
344 }
else if (myACAttr.isInt() && GNEAttributeCarrier::canParse<double>(myValueTextField->getText().text())) {
346 double doubleValue = GNEAttributeCarrier::parse<double>(myValueTextField->getText().text());
348 if ((doubleValue - (
int)doubleValue) == 0) {
349 newVal =
toString((
int)doubleValue);
350 myValueTextField->setText(newVal.c_str(), FALSE);
352 }
else if ((myACAttr.getAttr() ==
SUMO_ATTR_ANGLE) && GNEAttributeCarrier::canParse<double>(myValueTextField->getText().text())) {
354 double angle = GNEAttributeCarrier::parse<double>(myValueTextField->getText().text());
356 if ((angle < 0) || (angle > 360)) {
358 angle = fmod(angle, 360);
363 myValueTextField->setText(newVal.c_str(), FALSE);
366 newVal = myValueTextField->getText().text();
371 newVal = stripWhitespaceAfterComma(newVal);
374 const auto& inspectedACs = myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
376 const bool useDefaultValue = (newVal.empty() && myACAttr.hasDefaultValue());
378 if ((inspectedACs.size() > 0) && (inspectedACs.front()->isValid(myACAttr.getAttr(), newVal) || useDefaultValue)) {
380 if (!mergeJunction(myACAttr.getAttr(), inspectedACs, newVal)) {
382 if (inspectedACs.size() > 1) {
383 myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList()->begin(inspectedACs.front(),
TL(
"change multiple attributes"));
386 myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList()->begin(inspectedACs.front(),
TLF(
"change % attribute", myACAttr.getTagPropertyParent().getTagStr()));
389 for (
const auto& inspectedAC : inspectedACs) {
390 if (useDefaultValue) {
391 inspectedAC->setAttribute(myACAttr.getAttr(), myACAttr.getDefaultValue(), myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList());
393 inspectedAC->setAttribute(myACAttr.getAttr(), newVal, myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList());
397 if (inspectedACs.size() > 1) {
398 myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList()->end();
400 myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList()->end();
403 if (myValueTextField->shown()) {
404 myValueTextField->setTextColor(FXRGB(0, 0, 0));
405 myValueTextField->setBackColor(FXRGB(255, 255, 255));
406 myValueTextField->killFocus();
407 }
else if (myValueComboBox->shown()) {
408 myValueComboBox->setTextColor(FXRGB(0, 0, 0));
409 myValueComboBox->setBackColor(FXRGB(255, 255, 255));
412 myAttributesEditorParent->refreshAttributeEditor(
false,
false);
414 myAttributesEditorParent->getFrameParent()->attributeUpdated(myACAttr.getAttr());
418 if (myValueTextField->shown()) {
419 myValueTextField->setTextColor(FXRGB(255, 0, 0));
420 if (newVal.empty()) {
421 myValueTextField->setBackColor(FXRGBA(255, 213, 213, 255));
423 }
else if (myValueComboBox->shown()) {
424 myValueComboBox->setTextColor(FXRGB(255, 0, 0));
425 if (newVal.empty()) {
426 myValueComboBox->setBackColor(FXRGBA(255, 213, 213, 255));
430 WRITE_DEBUG(
TLF(
"Value '%' for attribute % of % isn't valid", newVal, myACAttr.getAttrStr(), myACAttr.getTagPropertyParent().getTagStr()));
438 const auto& ACs = myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
440 GNEUndoList* undoList = myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList();
442 if (myAttributeCheckButton->getCheck()) {
444 myValueCheckButton->enable();
445 myValueTextField->enable();
447 undoList->
begin(ACs.front(),
TL(
"enable attribute '") + myACAttr.getAttrStr() +
"'");
448 ACs.front()->enableAttribute(myACAttr.getAttr(), undoList);
452 myValueCheckButton->disable();
453 myValueTextField->disable();
455 undoList->
begin(ACs.front(),
TL(
"disable attribute '") + myACAttr.getAttrStr() +
"'");
456 ACs.front()->disableAttribute(myACAttr.getAttr(), undoList);
464 myAttributesEditorParent(nullptr) {
470 std::string result(stringValue);
471 while (result.find(
", ") != std::string::npos) {
485 const Position newPosition = GNEAttributeCarrier::parse<Position>(newVal);
487 for (
const auto& junction : myAttributesEditorParent->getFrameParent()->getViewNet()->getNet()->getAttributeCarriers()->getJunctions()) {
489 if ((junction.second.second->getPositionInView().distanceTo2D(newPosition) < POSITION_EPS) &&
490 myAttributesEditorParent->getFrameParent()->getViewNet()->mergeJunctions(movedJunction, junction.second.second)) {
503 const auto tooltipMenu = myAttributesEditorParent->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu();
505 const bool disableRow = !
isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr);
508 myAttributeButton =
new MFXButtonTooltip(
this, tooltipMenu, myACAttr.getAttrStr().c_str(),
511 myAttributeButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
513 myAttributeButton->setTipText(
TLF(
"Inspect % parent", myACAttr.getAttrStr()).c_str());
514 myAttributeButton->setHelpText(
TLF(
"Inspect % parent", myACAttr.getAttrStr()).c_str());
517 myAttributeButton->disable();
519 }
else if (myACAttr.isActivatable()) {
522 if (attributeEnabled) {
523 myAttributeCheckButton->setCheck(TRUE);
525 myAttributeCheckButton->setCheck(FALSE);
528 myAttributeCheckButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
531 myAttributeCheckButton->disable();
533 }
else if (myACAttr.isSVCPermission() && (myACAttr.getAttr() !=
SUMO_ATTR_DISALLOW)) {
536 myAttributeButton->setTipText(
TL(
"Open dialog for editing vClasses"));
537 myAttributeButton->setHelpText(
TL(
"Open dialog for editing vClasses"));
539 if (!attributeEnabled || disableRow) {
540 myAttributeButton->disable();
542 }
else if (myACAttr.isColor()) {
547 myAttributeButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
549 myAttributeButton->setTipText(
TL(
"Open dialog for editing color"));
550 myAttributeButton->setHelpText(
TL(
"Open dialog for editing color"));
553 myAttributeButton->disable();
559 myAttributeLabel->setTipText(myACAttr.getDefinition().c_str());
560 myAttributeLabel->setHelpText(myACAttr.getDefinition().c_str());
569 myAttributesEditorParent->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu(),
571 myValueTextField->hide();
573 myValueTextField->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
577 myValueComboBox->hide();
579 myValueComboBox->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
582 myValueCheckButton->hide();
584 myValueCheckButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
586 if ((myACAttr.getAttr() ==
SUMO_ATTR_LANE) && !myACAttr.getTagPropertyParent().isNetworkElement()) {
588 const auto tooltipMenu = myAttributesEditorParent->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu();
593 myValueLaneUpButton->setTipText(
TL(
"Move element up one lane"));
594 myValueLaneUpButton->setHelpText(
TL(
"Move element up one lane"));
599 myValueLaneDownButton->setTipText(
TL(
"Move element down one lane"));
600 myValueLaneDownButton->setHelpText(
TL(
"Move element down one lane"));
603 if (!attributeEnabled || !
isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr)) {
604 myValueTextField->disable();
605 myValueComboBox->disable();
606 myValueCheckButton->disable();
607 if (myValueLaneUpButton) {
608 myValueLaneUpButton->disable();
610 if (myValueLaneDownButton) {
611 myValueLaneDownButton->disable();
620 const bool disableElement = !
isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr);
622 if (myAttributeCheckButton) {
624 myAttributeCheckButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
626 if (attributeEnabled) {
627 myAttributeCheckButton->setCheck(TRUE);
629 myAttributeCheckButton->setCheck(FALSE);
632 if (disableElement) {
633 myAttributeCheckButton->disable();
635 myAttributeCheckButton->enable();
637 }
else if (myAttributeButton) {
641 myAttributeButton->setText(
"vTypeDist.");
643 myAttributeButton->setText(myACParent->getTagStr().c_str());
645 myAttributeButton->setIcon(myACParent->getACIcon());
647 myAttributeButton->setTipText(
TLF(
"Inspect % parent", myACAttr.getAttrStr()).c_str());
648 myAttributeButton->setHelpText(
TLF(
"Inspect % parent", myACAttr.getAttrStr()).c_str());
650 myAttributeButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
653 myAttributeButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
656 if (!attributeEnabled || disableElement) {
657 myAttributeButton->disable();
659 myAttributeButton->enable();
663 if (myValueLaneUpButton && myValueLaneDownButton) {
664 updateMoveLaneButtons(value);
672 const bool disableElement = !attributeEnabled || !
isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr);
674 if (myValueTextField->shown()) {
676 if (forceRefreshAttribute ||
677 (myValueTextField->getTextColor() == FXRGB(0, 0, 0)) ||
678 (myValueTextField->getTextColor() == FXRGB(0, 0, 255))) {
679 myValueTextField->setText(value.c_str());
682 myValueTextField->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
684 if (disableElement) {
685 myValueTextField->disable();
687 myValueTextField->enable();
689 }
else if (myValueComboBox->shown()) {
693 myValueComboBox->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
695 if (disableElement) {
696 myValueComboBox->disable();
698 myValueComboBox->enable();
700 }
else if (myValueCheckButton->shown()) {
701 if (GNEAttributeCarrier::canParse<bool>(value)) {
702 myValueCheckButton->setCheck(GNEAttributeCarrier::parse<bool>(value));
704 myValueCheckButton->setCheck(
false);
707 if (myValueCheckButton) {
708 myValueComboBox->disable();
710 myValueComboBox->enable();
718 const auto inspectedACs = myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
720 myValueComboBox->clearItems();
727 }
else if (myACAttr.isVType()) {
729 const auto& ACs = myAttributesEditorParent->getFrameParent()->getViewNet()->getNet()->getAttributeCarriers();
731 std::map<std::string, GNEDemandElement*> sortedTypes;
732 for (
const auto& type : ACs->getDemandElements().at(
SUMO_TAG_VTYPE)) {
733 sortedTypes[type.second->getID()] = type.second;
735 for (
const auto& sortedType : sortedTypes) {
736 myValueComboBox->appendIconItem(sortedType.first.c_str(), sortedType.second->getACIcon());
740 sortedTypes[typeDistribution.second->getID()] = typeDistribution.second;
742 for (
const auto& sortedType : sortedTypes) {
743 myValueComboBox->appendIconItem(sortedType.first.c_str(), sortedType.second->getACIcon());
753 if (inspectedACs.front()->getAttribute(
SUMO_ATTR_TYPE) ==
"priority") {
756 }
else if (inspectedACs.front()->getAttribute(
SUMO_ATTR_TYPE) ==
"traffic_light") {
761 myValueComboBox->disable();
765 for (
const auto& discreteValue : myACAttr.getDiscreteValues()) {
766 myValueComboBox->appendIconItem(discreteValue.c_str(),
nullptr);
770 const auto index = myValueComboBox->findItem(value.c_str());
772 if (myValueComboBox->getNumItems() > 0) {
773 myValueComboBox->setCurrentItem(0);
775 myValueComboBox->disable();
778 myValueComboBox->setCurrentItem(index);
786 const auto lane = myAttributesEditorParent->getFrameParent()->getViewNet()->getNet()->getAttributeCarriers()->retrieveLane(value,
false);
790 if ((lane->getIndex() + 1) >= (
int)lane->getParentEdge()->getLanes().size()) {
791 myValueLaneUpButton->disable();
793 myValueLaneUpButton->enable();
796 if ((lane->getIndex() - 1) < 0) {
797 myValueLaneDownButton->disable();
799 myValueLaneDownButton->enable();
802 if (!
isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr)) {
803 myValueLaneUpButton->disable();
804 myValueLaneDownButton->disable();
814 myFrameParent(frameParent),
815 myIncludeExtended(true) {
829 myIncludeExtended = includeExtended;
831 for (
auto& row : myAttributesEditorRows) {
833 if (row !=
nullptr) {
840 const auto& ACs = myFrameParent->getViewNet()->getInspectedAttributeCarriers();
842 bool showFlowEditor =
false;
843 if (ACs.size() > 0) {
845 for (
const auto& attrProperty : ACs.front()->getTagProperty()) {
847 bool editAttribute =
true;
849 if ((ACs.size() > 1) && attrProperty.isUnique()) {
850 editAttribute =
false;
853 if (attrProperty.isExtended() && !includeExtended) {
854 editAttribute =
false;
857 if (attrProperty.isFlowDefinition()) {
858 editAttribute =
false;
859 showFlowEditor =
true;
864 std::set<std::string> occurringValues;
866 for (
const auto& inspectedAC : ACs) {
867 occurringValues.insert(inspectedAC->getAttribute(attrProperty.getAttr()));
870 std::ostringstream oss;
871 for (
auto values = occurringValues.begin(); values != occurringValues.end(); values++) {
872 if (values != occurringValues.begin()) {
878 std::string value = oss.str();
880 bool attributeEnabled = ACs.front()->isAttributeEnabled(attrProperty.getAttr());
882 if (!attributeEnabled) {
883 value = ACs.front()->getAlternativeValueForDisabledAttributes(attrProperty.getAttr());
886 if (ACs.front()->getTagProperty().isType() &&
891 attributeEnabled =
true;
894 if (ACs.front()->getTagProperty().isVehicleStop()) {
896 attributeEnabled =
false;
898 attributeEnabled =
false;
902 const bool computed = (ACs.size() > 1) ?
false : ACs.front()->isAttributeComputed(attrProperty.getAttr());
905 if ((ACs.size() == 1) && attrProperty.isVType()) {
908 if (ACParent ==
nullptr) {
914 myAttributesEditorRows[attrProperty.getPositionListed()] =
new AttributesEditorRow(
this, attrProperty, value, attributeEnabled, computed, ACParent);
918 if (showFlowEditor) {
919 myAttributesEditorFlow->showFlowEditor(ACs);
921 myAttributesEditorFlow->hideFlowEditor();
926 myAttributesEditorFlow->hideFlowEditor();
929 myHelpButton->reparent(
this);
936 myAttributesEditorFlow->hideFlowEditor();
945 const auto& ACs = myFrameParent->getViewNet()->getInspectedAttributeCarriers();
947 if (ACs.size() > 0) {
949 for (
const auto& attrProperty : ACs.front()->getTagProperty()) {
951 bool editAttribute =
true;
953 if ((ACs.size() > 1) && attrProperty.isUnique()) {
954 editAttribute =
false;
957 if (attrProperty.isExtended() && !myIncludeExtended) {
958 editAttribute =
false;
961 if (attrProperty.isFlowDefinition()) {
962 editAttribute =
false;
967 std::set<std::string> occurringValues;
969 for (
const auto& inspectedAC : ACs) {
970 occurringValues.insert(inspectedAC->getAttribute(attrProperty.getAttr()));
973 std::ostringstream oss;
974 for (
auto values = occurringValues.begin(); values != occurringValues.end(); values++) {
975 if (values != occurringValues.begin()) {
981 std::string value = oss.str();
983 bool attributeEnabled = ACs.front()->isAttributeEnabled(attrProperty.getAttr());
985 if (ACs.front()->getTagProperty().isType() &&
990 attributeEnabled =
true;
993 if (!attributeEnabled) {
994 value = ACs.front()->getAlternativeValueForDisabledAttributes(attrProperty.getAttr());
997 if (ACs.front()->getTagProperty().isVehicleStop()) {
999 attributeEnabled =
false;
1001 attributeEnabled =
false;
1005 const bool computed = (ACs.size() > 1) ?
false : ACs.front()->isAttributeComputed(attrProperty.getAttr());
1007 if ((attrProperty.getAttr() ==
SUMO_ATTR_SHAPE) && forceRefreshShape) {
1008 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value,
true, attributeEnabled, computed,
nullptr);
1010 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value,
true, attributeEnabled, computed,
nullptr);
1011 }
else if (attrProperty.isVType() && (attrProperty.getTagPropertyParent().isVehicle() || attrProperty.getTagPropertyParent().isPerson() ||
1012 attrProperty.getTagPropertyParent().isContainer())) {
1014 auto typeParent = myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveDemandElement(
SUMO_TAG_VTYPE, ACs.front()->getAttribute(
SUMO_ATTR_TYPE),
false);
1015 if (typeParent ==
nullptr) {
1018 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value,
false, attributeEnabled, computed, typeParent);
1021 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value,
false, attributeEnabled, computed,
nullptr);
1026 if (myAttributesEditorFlow->shownFlowEditor()) {
1027 myAttributesEditorFlow->refreshFlowEditor();
1035 return myFrameParent;
1042 if (myFrameParent->getViewNet()->getInspectedAttributeCarriers().size() > 0) {
1044 myFrameParent->openHelpAttributesDialog(myFrameParent->getViewNet()->getInspectedAttributeCarriers().front());
1055 myFrameParent(frameParent) {
1079 myFrameParent->attributesEditorExtendedDialogOpened();
1089 myFrameParent(frameParent) {
1102 refreshGenericDataAttributes();
1117 myTextFieldParameters->setText(getParametersStr().c_str());
1118 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1119 myTextFieldParameters->killFocus();
1125 return myParameters;
1133 for (
const auto& parameter : myParameters) {
1134 result += parameter.first +
"=" + parameter.second +
"|";
1137 if (!result.empty()) {
1144 std::vector<std::pair<std::string, std::string> >
1146 std::vector<std::pair<std::string, std::string> > result;
1148 for (
const auto& parameter : myParameters) {
1149 result.push_back(std::make_pair(parameter.first, parameter.second));
1160 for (
const auto& parameter : parameters) {
1161 result += parameter.first +
"=" + parameter.second +
"|";
1164 if (!result.empty()) {
1168 myTextFieldParameters->setText(result.c_str(), TRUE);
1174 return myFrameParent;
1180 if (myTextFieldParameters->getText().empty()) {
1182 }
else if (myTextFieldParameters->getTextColor() == FXRGB(255, 0, 0)) {
1198 refreshGenericDataAttributes();
1210 myParameters.clear();
1214 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1215 myTextFieldParameters->killFocus();
1217 std::vector<std::string> parameters =
StringTokenizer(myTextFieldParameters->getText().text(),
"|",
true).
getVector();
1219 for (
const auto& parameter : parameters) {
1223 myParameters[keyParam.front()] = keyParam.back();
1226 myTextFieldParameters->setText(getParametersStr().c_str(), FALSE);
1228 myTextFieldParameters->setTextColor(FXRGB(255, 0, 0));
1239 myInspectorFrameParent(inspectorFrameParent) {
1248 myTypeFrameParent(typeFrameParent) {
1260 return myInspectorFrameParent ? myInspectorFrameParent->getViewNet() : myTypeFrameParent->getViewNet();
1266 if (myInspectorFrameParent) {
1268 const auto& inspectedACs = myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers();
1269 if ((inspectedACs.size() > 0) && inspectedACs.front()->getTagProperty().hasParameters()) {
1271 refreshParametersEditor();
1275 hideParametersEditor();
1277 }
else if (myTypeFrameParent) {
1278 if (myTypeFrameParent->getTypeSelector()->getCurrentType() !=
nullptr) {
1280 refreshParametersEditor();
1284 hideParametersEditor();
1287 hideParametersEditor();
1301 if (myInspectorFrameParent) {
1303 const auto& inspectedACs = myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers();
1305 const GNEAttributeCarrier* frontAC = inspectedACs.size() > 0 ? inspectedACs.front() :
nullptr;
1309 if (inspectedACs.size() == 1) {
1312 }
else if (inspectedACs.size() > 0) {
1315 for (
const auto& AC : inspectedACs) {
1317 parameters =
"different parameters";
1321 myTextFieldParameters->setText(parameters.c_str());
1324 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1327 myTextFieldParameters->enable();
1328 myButtonEditParameters->enable();
1330 myTextFieldParameters->disable();
1331 myButtonEditParameters->disable();
1334 }
else if (myTypeFrameParent) {
1336 GNEDemandElement* type = myTypeFrameParent->getTypeSelector()->getCurrentType();
1342 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1345 myTextFieldParameters->enable();
1346 myButtonEditParameters->enable();
1348 myTextFieldParameters->disable();
1349 myButtonEditParameters->disable();
1358 return myInspectorFrameParent;
1364 return myTypeFrameParent;
1370 if (myInspectorFrameParent) {
1372 const auto& inspectedACs = myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers();
1374 const GNEAttributeCarrier* frontAC = inspectedACs.size() > 0 ? inspectedACs.front() :
nullptr;
1377 if (inspectedACs.size() > 1) {
1387 refreshParametersEditor();
1401 refreshParametersEditor();
1408 }
else if (myTypeFrameParent) {
1410 GNEDemandElement* type = myTypeFrameParent->getTypeSelector()->getCurrentType();
1419 refreshParametersEditor();
1432 if (myInspectorFrameParent) {
1433 const auto& inspectedACs = myInspectorFrameParent->getAttributesEditor()->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
1441 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1442 myTextFieldParameters->killFocus();
1444 if (inspectedACs.size() == 1) {
1446 myInspectorFrameParent->getViewNet()->getUndoList()->begin(frontAC,
"change parameters");
1448 frontAC->
setACParameters(myTextFieldParameters->getText().text(), myInspectorFrameParent->getViewNet()->getUndoList());
1450 myInspectorFrameParent->getViewNet()->getUndoList()->end();
1451 }
else if (inspectedACs.size() > 0) {
1453 myInspectorFrameParent->getViewNet()->getUndoList()->begin(frontAC,
"change multiple parameters");
1455 for (
const auto& inspectedAC : inspectedACs) {
1456 inspectedAC->setACParameters(myTextFieldParameters->getText().text(), myInspectorFrameParent->getViewNet()->getUndoList());
1459 myInspectorFrameParent->getViewNet()->getUndoList()->end();
1464 myTextFieldParameters->setTextColor(FXRGB(255, 0, 0));
1467 }
else if (myTypeFrameParent) {
1469 GNEDemandElement* type = myTypeFrameParent->getTypeSelector()->getCurrentType();
1475 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1476 myTextFieldParameters->killFocus();
1478 myTypeFrameParent->getViewNet()->getUndoList()->begin(type,
"change parameters");
1480 type->
setACParameters(myTextFieldParameters->getText().text(), myTypeFrameParent->getViewNet()->getUndoList());
1482 myTypeFrameParent->getViewNet()->getUndoList()->end();
1484 myTextFieldParameters->setTextColor(FXRGB(255, 0, 0));
FXDEFMAP(GNEFrameAttributeModules::AttributesEditorRow) AttributesEditorRowMap[]
@ MID_GNE_SET_ATTRIBUTE
attribute edited
@ MID_GNE_OPEN_PARAMETERS_DIALOG
open parameters dialog
@ MID_GNE_SET_ATTRIBUTE_DIALOG
attribute edited trough dialog
@ MID_GNE_SET_ATTRIBUTE_INSPECTPARENT
inspect attribute parent element
@ MID_GNE_SET_ATTRIBUTE_COLOR
edit attribute color
@ MID_GNE_SET_ATTRIBUTE_ALLOW
edit attribute allow
@ MID_GNE_SET_ATTRIBUTE_BOOL
bool attribute edited
@ MID_GNE_MOVEDOWN
move down
#define GUIDesignButtonAttribute
button extended over over column with thick and raise frame
#define GUIDesignButtonIcon
button only with icon
#define GUIDesignComboBoxAttribute
Combo box static (cannot be edited) extended over the matrix column.
#define GUIDesignComboBoxNCol
number of column of every combo box
#define GUIDesignTextField
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
#define GUIDesignButtonRectangular
little rectangular button used in frames (For example, in "help" buttons)
#define GUIDesignComboBoxVisibleItemsMedium
combo box medium small
#define GUIDesignTextFieldNCol
Num of column of text field.
#define GUIDesignCheckButton
checkButton placed in left position
#define GUIDesignCheckButtonAttribute
checkButton without thick extended over the frame used for attributes
#define GUIDesignLabelThickedFixed(width)
label thicked, icon before text, text centered and custom width
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)
@ SUMO_TAG_VTYPE
description of a vehicle/person/container type
@ SUMO_TAG_JUNCTION
begin/end of the description of a junction
@ SUMO_TAG_VTYPE_DISTRIBUTION
distribution of a vehicle type
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_CONTAINER_TRIGGERED
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
@ SUMO_ATTR_DESIRED_MAXSPEED
@ SUMO_ATTR_EXPECTED_CONTAINERS
@ SUMO_ATTR_RIGHT_OF_WAY
How to compute right of way.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Dialog for edit rerouters.
void setACParameters(const std::string ¶meters, GNEUndoList *undoList)
set parameters (string)
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
GNENet * getNet() const
get pointer to net
virtual std::string getAttribute(SumoXMLAttr key) const =0
static const size_t MAXNUMBEROFATTRIBUTES
max number of attributes allowed for every tag
const GNETagProperties & getTagPropertyParent() const
get reference to tagProperty parent
virtual std::string getAttribute(SumoXMLAttr key) const =0
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
method for checking if the key and their conrrespond attribute are valids
void hideFlowEditor()
hide group box
void hideAttributesEditorExtendedModule()
hide group box
void showAttributesEditorExtendedModule()
show AttributesEditorExtended modul
~AttributesEditorExtended()
destructor
AttributesEditorExtended(GNEFrame *frameParent)
FOX-declaration.
long onCmdOpenDialog(FXObject *, FXSelector, void *)
void refreshAttributeEditor(bool forceRefreshShape, bool forceRefreshPosition)
refresh attribute editor (only the valid values will be refresh)
FXButton * myHelpButton
button for help
GNEFlowEditor * myAttributesEditorFlow
GNEFlowEditor modul.
GNEFrame * getFrameParent() const
pointer to GNEFrame parent
long onCmdAttributesEditorHelp(FXObject *, FXSelector, void *)
void showAttributeEditorModule(bool includeExtended)
show attributes of multiple ACs
std::vector< AttributesEditorRow * > myAttributesEditorRows
list of Attribute editor rows
AttributesEditor(GNEFrame *inspectorFrameParent)
FOX-declaration.
void hideAttributesEditorModule()
hide attribute editor
bool mergeJunction(SumoXMLAttr attr, const std::vector< GNEAttributeCarrier * > &inspectedACs, const std::string &newVal) const
check junction merging
long onCmdSetAttribute(FXObject *, FXSelector, void *)
try to set new attribute value
long onCmdMoveElementLaneDown(FXObject *, FXSelector, void *)
inspect vType/VTypeDistribution parent
std::string stripWhitespaceAfterComma(const std::string &stringValue)
removed invalid spaces of Positions and shapes
long onCmdOpenAllowDialog(FXObject *, FXSelector, void *)
open model dialog for edit allow
void refreshValueElements(const std::string &value, const bool attributeEnabled, const bool computed, const bool forceRefreshAttribute)
build value elements();
bool isAttributesEditorRowValid() const
check if current attribute of TextField/ComboBox is valid
AttributesEditorRow()
default constructor
void destroy()
destroy GNEAttributesCreatorRow (but don't delete)
long onCmdInspectParent(FXObject *, FXSelector, void *)
inspect parent
void fillComboBox(const std::string &value)
fill comboBox with discrete values
long onCmdSelectCheckButton(FXObject *, FXSelector, void *)
called when user press a check button
long onCmdMoveElementLaneUp(FXObject *, FXSelector, void *)
inspect vType/VTypeDistribution parent
void buildAttributeElements(const bool attributeEnabled, const bool computed)
build Attribute elements
void refreshAttributeElements(const std::string &value, const bool attributeEnabled, const bool computed)
refresh Attribute elements
long onCmdOpenColorDialog(FXObject *, FXSelector, void *)
open model dialog for edit color
void updateMoveLaneButtons(const std::string &value)
update move lane buttons
void buildValueElements(const bool attributeEnabled, const bool computed)
build value elements();
void refreshAttributesEditorRow(const std::string &value, const bool forceRefreshAttribute, const bool attributeEnabled, const bool computed, GNEAttributeCarrier *ACParent)
refresh current row
~GenericDataAttributes()
destructor
long onCmdSetParameters(FXObject *, FXSelector, void *)
Called when user udpate the parameter text field.
bool areAttributesValid() const
check if current attributes are valid
const Parameterised::Map & getParametersMap() const
get parameters as map
FXButton * myButtonEditParameters
button for edit parameters using specific dialog
void refreshGenericDataAttributes()
refresh netedit attributes
FXTextField * myTextFieldParameters
text field for write parameters
void showGenericDataAttributes()
show netedit attributes EditorCreator
long onCmdEditParameters(FXObject *, FXSelector, void *)
GNEFrame * getFrameParent() const
pointer to frame parent
std::vector< std::pair< std::string, std::string > > getParameters() const
get parameters as vector of strings
std::string getParametersStr() const
get parameters as string
GenericDataAttributes(GNEFrame *frameParent)
FOX-declaration.
void hideGenericDataAttributes()
hide netedit attributes EditorCreator
void setParameters(const std::vector< std::pair< std::string, std::string > > ¶meters)
set parameters
GNEViewNet * getViewNet() const
@get viewNet
~ParametersEditor()
destructor
void refreshParametersEditor()
refresh netedit attributes
long onCmdSetParameters(FXObject *, FXSelector, void *)
Called when user udpate the parameter text field.
long onCmdEditParameters(FXObject *, FXSelector, void *)
ParametersEditor(GNEInspectorFrame *inspectorFrameParent)
FOX-declaration.
void hideParametersEditor()
hide netedit attributes EditorInspector
GNEInspectorFrame * getInspectorFrameParent() const
get inspector frame parent
FXButton * myButtonEditParameters
button for edit parameters using specific dialog
FXTextField * myTextFieldParameters
text field for write parameters
GNETypeFrame * getTypeFrameParent() const
get type frame parent
void showParametersEditor()
show netedit attributes EditorInspector
static bool isSupermodeValid(const GNEViewNet *viewNet, const GNEAttributeCarrier *AC)
return true if AC can be edited in the current supermode
GNEViewNet * getViewNet() const
get view net
Dialog for edit parameters.
GNEJunction * retrieveJunction(const std::string &id, bool hardFail=true) const
get junction by id
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Dialog for edit parameters.
bool isMeanData() const
return true if tag correspond to a mean data element
bool isNetworkElement() const
element sets
bool isDataElement() const
return true if tag correspond to a data element
bool hasParameters() const
return true if Tag correspond to an element that supports parameters "key1=value1|key2=value2|....
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)
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
GNEUndoList * getUndoList() const
get the undoList object
const std::vector< GNEAttributeCarrier * > & getInspectedAttributeCarriers() const
get inspected attribute carriers
static FXButton * buildFXButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXObject *tgt, FXSelector sel, FXuint opts=BUTTON_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
build button
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
MFXGroupBoxModule (based on FXGroupBox)
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
static RGBColor getRGBColor(FXColor col)
converts FXColor to RGBColor
static FXIcon * getPOIIcon(POIIcon iconType)
returns icon associated to the given POI image
static bool areAttributesValid(const std::string &value, bool report=false, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to an attributes map "key1=value1|key2=value2|....
static bool areParametersValid(const std::string &value, bool report=false, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
std::map< std::string, std::string > Map
parameters map
A point in 2D or 3D with translation and scaling methods.
static const RGBColor BLACK
static StringBijection< POIIcon > POIIcons
POI icon values.
static StringBijection< RightOfWay > RightOfWayValues
righ of way algorithms
std::vector< std::string > getVector()
return vector of strings
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
bool isCurrentSupermodeDemand() const
@check if current supermode is Demand
bool isCurrentSupermodeData() const
@check if current supermode is Data
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network