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) {
480 auto viewNet = myAttributesEditorParent->getFrameParent()->getViewNet();
486 const Position newPosition = GNEAttributeCarrier::parse<Position>(newVal);
488 for (
const auto& targetjunction : viewNet->getNet()->getAttributeCarriers()->getJunctions()) {
490 if ((targetjunction.second->getPositionInView().distanceTo2D(newPosition) < POSITION_EPS) &&
491 viewNet->askMergeJunctions(movedJunction, targetjunction.second)) {
492 viewNet->getNet()->mergeJunctions(movedJunction, targetjunction.second, viewNet->getUndoList());
505 const auto tooltipMenu = myAttributesEditorParent->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu();
507 const bool disableRow = !
isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr);
510 myAttributeButton =
new MFXButtonTooltip(
this, tooltipMenu, myACAttr.getAttrStr().c_str(),
513 myAttributeButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
515 myAttributeButton->setTipText(
TLF(
"Inspect % parent", myACAttr.getAttrStr()).c_str());
516 myAttributeButton->setHelpText(
TLF(
"Inspect % parent", myACAttr.getAttrStr()).c_str());
519 myAttributeButton->disable();
521 }
else if (myACAttr.isActivatable()) {
524 if (attributeEnabled) {
525 myAttributeCheckButton->setCheck(TRUE);
527 myAttributeCheckButton->setCheck(FALSE);
530 myAttributeCheckButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
533 myAttributeCheckButton->disable();
535 }
else if (myACAttr.isSVCPermission() && (myACAttr.getAttr() !=
SUMO_ATTR_DISALLOW)) {
538 myAttributeButton->setTipText(
TL(
"Open dialog for editing vClasses"));
539 myAttributeButton->setHelpText(
TL(
"Open dialog for editing vClasses"));
541 if (!attributeEnabled || disableRow) {
542 myAttributeButton->disable();
544 }
else if (myACAttr.isColor()) {
549 myAttributeButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
551 myAttributeButton->setTipText(
TL(
"Open dialog for editing color"));
552 myAttributeButton->setHelpText(
TL(
"Open dialog for editing color"));
555 myAttributeButton->disable();
561 myAttributeLabel->setTipText(myACAttr.getDefinition().c_str());
562 myAttributeLabel->setHelpText(myACAttr.getDefinition().c_str());
571 myAttributesEditorParent->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu(),
573 myValueTextField->hide();
575 myValueTextField->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
579 myValueComboBox->hide();
581 myValueComboBox->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
584 myValueCheckButton->hide();
586 myValueCheckButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
588 if ((myACAttr.getAttr() ==
SUMO_ATTR_LANE) && !myACAttr.getTagPropertyParent().isNetworkElement()) {
590 const auto tooltipMenu = myAttributesEditorParent->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu();
595 myValueLaneUpButton->setTipText(
TL(
"Move element up one lane"));
596 myValueLaneUpButton->setHelpText(
TL(
"Move element up one lane"));
601 myValueLaneDownButton->setTipText(
TL(
"Move element down one lane"));
602 myValueLaneDownButton->setHelpText(
TL(
"Move element down one lane"));
605 if (!attributeEnabled || !
isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr)) {
606 myValueTextField->disable();
607 myValueComboBox->disable();
608 myValueCheckButton->disable();
609 if (myValueLaneUpButton) {
610 myValueLaneUpButton->disable();
612 if (myValueLaneDownButton) {
613 myValueLaneDownButton->disable();
622 const bool disableElement = !
isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr);
624 if (myAttributeCheckButton) {
626 myAttributeCheckButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
628 if (attributeEnabled) {
629 myAttributeCheckButton->setCheck(TRUE);
631 myAttributeCheckButton->setCheck(FALSE);
634 if (disableElement) {
635 myAttributeCheckButton->disable();
637 myAttributeCheckButton->enable();
639 }
else if (myAttributeButton) {
643 myAttributeButton->setText(
"vTypeDist.");
645 myAttributeButton->setText(myACParent->getTagStr().c_str());
647 myAttributeButton->setIcon(myACParent->getACIcon());
649 myAttributeButton->setTipText(
TLF(
"Inspect % parent", myACAttr.getAttrStr()).c_str());
650 myAttributeButton->setHelpText(
TLF(
"Inspect % parent", myACAttr.getAttrStr()).c_str());
652 myAttributeButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
655 myAttributeButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
658 if (!attributeEnabled || disableElement) {
659 myAttributeButton->disable();
661 myAttributeButton->enable();
665 if (myValueLaneUpButton && myValueLaneDownButton) {
666 updateMoveLaneButtons(value);
674 const bool disableElement = !attributeEnabled || !
isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr);
676 if (myValueTextField->shown()) {
678 if (forceRefreshAttribute ||
679 (myValueTextField->getTextColor() == FXRGB(0, 0, 0)) ||
680 (myValueTextField->getTextColor() == FXRGB(0, 0, 255))) {
681 myValueTextField->setText(value.c_str());
684 myValueTextField->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
686 if (disableElement) {
687 myValueTextField->disable();
689 myValueTextField->enable();
691 }
else if (myValueComboBox->shown()) {
695 myValueComboBox->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
697 if (disableElement) {
698 myValueComboBox->disable();
700 myValueComboBox->enable();
702 }
else if (myValueCheckButton->shown()) {
703 if (GNEAttributeCarrier::canParse<bool>(value)) {
704 myValueCheckButton->setCheck(GNEAttributeCarrier::parse<bool>(value));
706 myValueCheckButton->setCheck(
false);
709 if (myValueCheckButton) {
710 myValueComboBox->disable();
712 myValueComboBox->enable();
720 const auto inspectedACs = myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
722 myValueComboBox->clearItems();
729 }
else if (myACAttr.isVType()) {
731 const auto& ACs = myAttributesEditorParent->getFrameParent()->getViewNet()->getNet()->getAttributeCarriers();
733 std::map<std::string, GNEDemandElement*> sortedTypes;
734 for (
const auto& type : ACs->getDemandElements().at(
SUMO_TAG_VTYPE)) {
735 sortedTypes[type.second->getID()] = type.second;
737 for (
const auto& sortedType : sortedTypes) {
738 myValueComboBox->appendIconItem(sortedType.first.c_str(), sortedType.second->getACIcon());
742 sortedTypes[typeDistribution.second->getID()] = typeDistribution.second;
744 for (
const auto& sortedType : sortedTypes) {
745 myValueComboBox->appendIconItem(sortedType.first.c_str(), sortedType.second->getACIcon());
755 if (inspectedACs.front()->getAttribute(
SUMO_ATTR_TYPE) ==
"priority") {
758 }
else if (inspectedACs.front()->getAttribute(
SUMO_ATTR_TYPE) ==
"traffic_light") {
763 myValueComboBox->disable();
767 for (
const auto& discreteValue : myACAttr.getDiscreteValues()) {
768 myValueComboBox->appendIconItem(discreteValue.c_str(),
nullptr);
772 const auto index = myValueComboBox->findItem(value.c_str());
774 if (myValueComboBox->getNumItems() > 0) {
775 myValueComboBox->setCurrentItem(0);
777 myValueComboBox->disable();
780 myValueComboBox->setCurrentItem(index);
788 const auto lane = myAttributesEditorParent->getFrameParent()->getViewNet()->getNet()->getAttributeCarriers()->retrieveLane(value,
false);
792 if ((lane->getIndex() + 1) >= (
int)lane->getParentEdge()->getLanes().size()) {
793 myValueLaneUpButton->disable();
795 myValueLaneUpButton->enable();
798 if ((lane->getIndex() - 1) < 0) {
799 myValueLaneDownButton->disable();
801 myValueLaneDownButton->enable();
804 if (!
isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr)) {
805 myValueLaneUpButton->disable();
806 myValueLaneDownButton->disable();
816 myFrameParent(frameParent),
817 myIncludeExtended(true) {
831 myIncludeExtended = includeExtended;
833 for (
auto& row : myAttributesEditorRows) {
835 if (row !=
nullptr) {
842 const auto& ACs = myFrameParent->getViewNet()->getInspectedAttributeCarriers();
844 bool showFlowEditor =
false;
845 if (ACs.size() > 0) {
847 for (
const auto& attrProperty : ACs.front()->getTagProperty()) {
849 bool editAttribute =
true;
851 if ((ACs.size() > 1) && attrProperty.isUnique()) {
852 editAttribute =
false;
855 if (attrProperty.isExtended() && !includeExtended) {
856 editAttribute =
false;
859 if (attrProperty.isFlowDefinition()) {
860 editAttribute =
false;
861 showFlowEditor =
true;
866 std::set<std::string> occurringValues;
868 for (
const auto& inspectedAC : ACs) {
869 occurringValues.insert(inspectedAC->getAttribute(attrProperty.getAttr()));
872 std::ostringstream oss;
873 for (
auto values = occurringValues.begin(); values != occurringValues.end(); values++) {
874 if (values != occurringValues.begin()) {
880 std::string value = oss.str();
882 bool attributeEnabled = ACs.front()->isAttributeEnabled(attrProperty.getAttr());
884 if (!attributeEnabled) {
885 value = ACs.front()->getAlternativeValueForDisabledAttributes(attrProperty.getAttr());
888 if (ACs.front()->getTagProperty().isType() &&
893 attributeEnabled =
true;
896 if (ACs.front()->getTagProperty().isVehicleStop()) {
898 attributeEnabled =
false;
900 attributeEnabled =
false;
904 const bool computed = (ACs.size() > 1) ?
false : ACs.front()->isAttributeComputed(attrProperty.getAttr());
907 if ((ACs.size() == 1) && attrProperty.isVType()) {
910 if (ACParent ==
nullptr) {
916 myAttributesEditorRows[attrProperty.getPositionListed()] =
new AttributesEditorRow(
this, attrProperty, value, attributeEnabled, computed, ACParent);
920 if (showFlowEditor) {
921 myAttributesEditorFlow->showFlowEditor(ACs);
923 myAttributesEditorFlow->hideFlowEditor();
928 myAttributesEditorFlow->hideFlowEditor();
931 myHelpButton->reparent(
this);
938 myAttributesEditorFlow->hideFlowEditor();
947 const auto& ACs = myFrameParent->getViewNet()->getInspectedAttributeCarriers();
949 if (ACs.size() > 0) {
951 for (
const auto& attrProperty : ACs.front()->getTagProperty()) {
953 bool editAttribute =
true;
955 if ((ACs.size() > 1) && attrProperty.isUnique()) {
956 editAttribute =
false;
959 if (attrProperty.isExtended() && !myIncludeExtended) {
960 editAttribute =
false;
963 if (attrProperty.isFlowDefinition()) {
964 editAttribute =
false;
969 std::set<std::string> occurringValues;
971 for (
const auto& inspectedAC : ACs) {
972 occurringValues.insert(inspectedAC->getAttribute(attrProperty.getAttr()));
975 std::ostringstream oss;
976 for (
auto values = occurringValues.begin(); values != occurringValues.end(); values++) {
977 if (values != occurringValues.begin()) {
983 std::string value = oss.str();
985 bool attributeEnabled = ACs.front()->isAttributeEnabled(attrProperty.getAttr());
987 if (ACs.front()->getTagProperty().isType() &&
992 attributeEnabled =
true;
995 if (!attributeEnabled) {
996 value = ACs.front()->getAlternativeValueForDisabledAttributes(attrProperty.getAttr());
999 if (ACs.front()->getTagProperty().isVehicleStop()) {
1001 attributeEnabled =
false;
1003 attributeEnabled =
false;
1007 const bool computed = (ACs.size() > 1) ?
false : ACs.front()->isAttributeComputed(attrProperty.getAttr());
1009 if ((attrProperty.getAttr() ==
SUMO_ATTR_SHAPE) && forceRefreshShape) {
1010 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value,
true, attributeEnabled, computed,
nullptr);
1012 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value,
true, attributeEnabled, computed,
nullptr);
1013 }
else if (attrProperty.isVType() && (attrProperty.getTagPropertyParent().isVehicle() || attrProperty.getTagPropertyParent().isPerson() ||
1014 attrProperty.getTagPropertyParent().isContainer())) {
1016 auto typeParent = myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveDemandElement(
SUMO_TAG_VTYPE, ACs.front()->getAttribute(
SUMO_ATTR_TYPE),
false);
1017 if (typeParent ==
nullptr) {
1020 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value,
false, attributeEnabled, computed, typeParent);
1023 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value,
false, attributeEnabled, computed,
nullptr);
1028 if (myAttributesEditorFlow->shownFlowEditor()) {
1029 myAttributesEditorFlow->refreshFlowEditor();
1037 return myFrameParent;
1044 if (myFrameParent->getViewNet()->getInspectedAttributeCarriers().size() > 0) {
1057 myFrameParent(frameParent) {
1081 myFrameParent->attributesEditorExtendedDialogOpened();
1091 myFrameParent(frameParent) {
1104 refreshGenericDataAttributes();
1119 myTextFieldParameters->setText(getParametersStr().c_str());
1120 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1121 myTextFieldParameters->killFocus();
1127 return myParameters;
1135 for (
const auto& parameter : myParameters) {
1136 result += parameter.first +
"=" + parameter.second +
"|";
1139 if (!result.empty()) {
1146std::vector<std::pair<std::string, std::string> >
1148 std::vector<std::pair<std::string, std::string> > result;
1150 for (
const auto& parameter : myParameters) {
1151 result.push_back(std::make_pair(parameter.first, parameter.second));
1162 for (
const auto& parameter : parameters) {
1163 result += parameter.first +
"=" + parameter.second +
"|";
1166 if (!result.empty()) {
1170 myTextFieldParameters->setText(result.c_str(), TRUE);
1176 return myFrameParent;
1182 if (myTextFieldParameters->getText().empty()) {
1184 }
else if (myTextFieldParameters->getTextColor() == FXRGB(255, 0, 0)) {
1200 refreshGenericDataAttributes();
1212 myParameters.clear();
1216 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1217 myTextFieldParameters->killFocus();
1219 std::vector<std::string> parameters =
StringTokenizer(myTextFieldParameters->getText().text(),
"|",
true).
getVector();
1221 for (
const auto& parameter : parameters) {
1225 myParameters[keyParam.front()] = keyParam.back();
1228 myTextFieldParameters->setText(getParametersStr().c_str(), FALSE);
1230 myTextFieldParameters->setTextColor(FXRGB(255, 0, 0));
1241 myInspectorFrameParent(inspectorFrameParent) {
1250 myTypeFrameParent(typeFrameParent) {
1262 return myInspectorFrameParent ? myInspectorFrameParent->getViewNet() : myTypeFrameParent->getViewNet();
1268 if (myInspectorFrameParent) {
1271 if ((inspectedACs.size() > 0) && inspectedACs.front()->getTagProperty().hasParameters()) {
1273 refreshParametersEditor();
1277 hideParametersEditor();
1279 }
else if (myTypeFrameParent) {
1280 if (myTypeFrameParent->getTypeSelector()->getCurrentType() !=
nullptr) {
1282 refreshParametersEditor();
1286 hideParametersEditor();
1289 hideParametersEditor();
1303 if (myInspectorFrameParent) {
1305 const auto& inspectedACs = myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers();
1307 const GNEAttributeCarrier* frontAC = inspectedACs.size() > 0 ? inspectedACs.front() :
nullptr;
1311 if (inspectedACs.size() == 1) {
1314 }
else if (inspectedACs.size() > 0) {
1317 for (
const auto& AC : inspectedACs) {
1319 parameters =
"different parameters";
1323 myTextFieldParameters->setText(parameters.c_str());
1326 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1329 myTextFieldParameters->enable();
1330 myButtonEditParameters->enable();
1332 myTextFieldParameters->disable();
1333 myButtonEditParameters->disable();
1336 }
else if (myTypeFrameParent) {
1338 GNEDemandElement* type = myTypeFrameParent->getTypeSelector()->getCurrentType();
1344 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1347 myTextFieldParameters->enable();
1348 myButtonEditParameters->enable();
1350 myTextFieldParameters->disable();
1351 myButtonEditParameters->disable();
1360 return myInspectorFrameParent;
1366 return myTypeFrameParent;
1372 if (myInspectorFrameParent) {
1376 const GNEAttributeCarrier* frontAC = inspectedACs.size() > 0 ? inspectedACs.front() :
nullptr;
1379 if (inspectedACs.size() > 1) {
1389 refreshParametersEditor();
1403 refreshParametersEditor();
1410 }
else if (myTypeFrameParent) {
1412 GNEDemandElement* type = myTypeFrameParent->getTypeSelector()->getCurrentType();
1421 refreshParametersEditor();
1434 if (myInspectorFrameParent) {
1435 const auto& inspectedACs = myInspectorFrameParent->getAttributesEditor()->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
1443 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1444 myTextFieldParameters->killFocus();
1446 if (inspectedACs.size() == 1) {
1448 myInspectorFrameParent->getViewNet()->getUndoList()->begin(frontAC,
"change parameters");
1450 frontAC->
setACParameters(myTextFieldParameters->getText().text(), myInspectorFrameParent->getViewNet()->getUndoList());
1452 myInspectorFrameParent->getViewNet()->getUndoList()->end();
1453 }
else if (inspectedACs.size() > 0) {
1455 myInspectorFrameParent->getViewNet()->getUndoList()->begin(frontAC,
"change multiple parameters");
1457 for (
const auto& inspectedAC : inspectedACs) {
1458 inspectedAC->setACParameters(myTextFieldParameters->getText().text(), myInspectorFrameParent->getViewNet()->getUndoList());
1461 myInspectorFrameParent->getViewNet()->getUndoList()->end();
1466 myTextFieldParameters->setTextColor(FXRGB(255, 0, 0));
1469 }
else if (myTypeFrameParent) {
1471 GNEDemandElement* type = myTypeFrameParent->getTypeSelector()->getCurrentType();
1477 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1478 myTextFieldParameters->killFocus();
1480 myTypeFrameParent->getViewNet()->getUndoList()->begin(type,
"change parameters");
1482 type->
setACParameters(myTextFieldParameters->getText().text(), myTypeFrameParent->getViewNet()->getUndoList());
1484 myTypeFrameParent->getViewNet()->getUndoList()->end();
1486 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
void openHelpAttributesDialog(const GNEAttributeCarrier *AC) const
Open help attributes dialog.
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< T > getValues() const
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