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();
198 if (inspectedElements.getFirstAC()) {
200 FXColorDialog colordialog(
this,
TL(
"Color Dialog"));
201 colordialog.setTarget(
this);
204 if (GNEAttributeCarrier::canParse<RGBColor>(myValueTextField->getText().text())) {
205 colordialog.setRGBA(
MFXUtils::getFXColor(GNEAttributeCarrier::parse<RGBColor>(myValueTextField->getText().text())));
206 }
else if (!myACAttr.getDefaultValue().empty()) {
207 colordialog.setRGBA(
MFXUtils::getFXColor(GNEAttributeCarrier::parse<RGBColor>(myACAttr.getDefaultValue())));
212 if (colordialog.execute()) {
214 myValueTextField->setText(newValue.c_str());
215 if (inspectedElements.getFirstAC()->isValid(myACAttr.getAttr(), newValue)) {
217 if (inspectedElements.isInspectingMultipleElements()) {
218 viewNet->
getUndoList()->
begin(inspectedElements.getFirstAC(),
TL(
"change multiple attributes"));
221 for (
const auto& inspectedAC : inspectedElements.getACs()) {
222 inspectedAC->setAttribute(myACAttr.getAttr(), newValue, viewNet->
getUndoList());
225 if (inspectedElements.isInspectingMultipleElements()) {
229 myValueTextField->setTextColor(FXRGB(0, 0, 0));
230 myValueTextField->killFocus();
240 GNEViewNet* viewNet = myAttributesEditorParent->getFrameParent()->getViewNet();
242 if (inspectedElements.getFirstAC()) {
244 if (inspectedElements.isInspectingMultipleElements()) {
245 viewNet->
getUndoList()->
begin(inspectedElements.getFirstAC(),
TL(
"change multiple attributes"));
248 bool acceptChanges =
false;
250 GNEAllowVClassesDialog(viewNet, inspectedElements.getFirstAC(), myACAttr.getAttr(), &acceptChanges).execute();
253 std::string allowed = inspectedElements.getFirstAC()->getAttribute(myACAttr.getAttr());
255 for (
const auto& inspectedAC : inspectedElements.getACs()) {
256 inspectedAC->setAttribute(myACAttr.getAttr(), allowed, viewNet->
getUndoList());
259 if (inspectedElements.isInspectingMultipleElements()) {
263 myAttributesEditorParent->getFrameParent()->attributeUpdated(myACAttr.getAttr());
272 auto viewnet = myAttributesEditorParent->getFrameParent()->getViewNet();
273 viewnet->getViewParent()->getInspectorFrame()->inspectChild(myACParent, viewnet->getInspectedElements().getFirstAC());
281 auto viewNet = myAttributesEditorParent->getFrameParent()->getViewNet();
282 const auto& inspectedElements = viewNet->getInspectedElements();
283 if (inspectedElements.getFirstAC()) {
285 auto lane = viewNet->getNet()->getAttributeCarriers()->retrieveLane(inspectedElements.getFirstAC()->getAttribute(
SUMO_ATTR_LANE));
287 inspectedElements.getFirstAC()->setAttribute(
SUMO_ATTR_LANE, lane->getParentEdge()->getID() +
"_" +
toString(lane->getIndex() + 1), viewNet->getUndoList());
289 myAttributesEditorParent->getFrameParent()->attributeUpdated(myACAttr.getAttr());
297 auto viewNet = myAttributesEditorParent->getFrameParent()->getViewNet();
298 const auto& inspectedElements = viewNet->getInspectedElements();
299 if (inspectedElements.getFirstAC()) {
301 auto lane = viewNet->getNet()->getAttributeCarriers()->retrieveLane(inspectedElements.getFirstAC()->getAttribute(
SUMO_ATTR_LANE));
303 inspectedElements.getFirstAC()->setAttribute(
SUMO_ATTR_LANE, lane->getParentEdge()->getID() +
"_" +
toString(lane->getIndex() - 1), viewNet->getUndoList());
305 myAttributesEditorParent->getFrameParent()->attributeUpdated(myACAttr.getAttr());
313 const auto& inspectedElements = myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedElements();
317 if (myACAttr.isBool()) {
319 if (myValueCheckButton->shown()) {
321 if (myValueCheckButton->getCheck()) {
322 myValueCheckButton->setText(
"true");
325 myValueCheckButton->setText(
"false");
330 newVal = myValueTextField->getText().text();
332 }
else if (myACAttr.isDiscrete()) {
334 if (myValueTextField->shown()) {
336 newVal = myValueTextField->getText().text();
339 newVal = myValueComboBox->getText().text();
341 }
else if (myACAttr.isVType()) {
343 newVal = myValueComboBox->getText().text();
346 if (myValueTextField->getText().empty() && myACAttr.hasDefaultValue()) {
347 newVal = myACAttr.getDefaultValue();
348 myValueTextField->setText(newVal.c_str());
349 }
else if (myACAttr.isInt() && GNEAttributeCarrier::canParse<double>(myValueTextField->getText().text())) {
351 double doubleValue = GNEAttributeCarrier::parse<double>(myValueTextField->getText().text());
353 if ((doubleValue - (
int)doubleValue) == 0) {
354 newVal =
toString((
int)doubleValue);
355 myValueTextField->setText(newVal.c_str(), FALSE);
357 }
else if ((myACAttr.getAttr() ==
SUMO_ATTR_ANGLE) && GNEAttributeCarrier::canParse<double>(myValueTextField->getText().text())) {
359 double angle = GNEAttributeCarrier::parse<double>(myValueTextField->getText().text());
361 if ((angle < 0) || (angle > 360)) {
363 angle = fmod(angle, 360);
368 myValueTextField->setText(newVal.c_str(), FALSE);
371 newVal = myValueTextField->getText().text();
376 newVal = stripWhitespaceAfterComma(newVal);
379 const bool useDefaultValue = (newVal.empty() && myACAttr.hasDefaultValue());
381 if ((inspectedElements.isInspectingElements()) && (inspectedElements.getFirstAC()->isValid(myACAttr.getAttr(), newVal) || useDefaultValue)) {
383 if (!mergeJunction(myACAttr.getAttr(), newVal)) {
385 if (inspectedElements.isInspectingMultipleElements()) {
386 myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList()->begin(inspectedElements.getFirstAC(),
TL(
"change multiple attributes"));
389 myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList()->begin(inspectedElements.getFirstAC(),
TLF(
"change % attribute", myACAttr.getTagPropertyParent().getTagStr()));
392 for (
const auto& inspectedAC : inspectedElements.getACs()) {
393 if (useDefaultValue) {
394 inspectedAC->setAttribute(myACAttr.getAttr(), myACAttr.getDefaultValue(), myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList());
396 inspectedAC->setAttribute(myACAttr.getAttr(), newVal, myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList());
400 if (inspectedElements.isInspectingMultipleElements()) {
401 myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList()->end();
403 myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList()->end();
406 if (myValueTextField->shown()) {
407 myValueTextField->setTextColor(FXRGB(0, 0, 0));
408 myValueTextField->setBackColor(FXRGB(255, 255, 255));
409 myValueTextField->killFocus();
410 }
else if (myValueComboBox->shown()) {
411 myValueComboBox->setTextColor(FXRGB(0, 0, 0));
412 myValueComboBox->setBackColor(FXRGB(255, 255, 255));
415 myAttributesEditorParent->refreshAttributeEditor(
false,
false);
417 myAttributesEditorParent->getFrameParent()->attributeUpdated(myACAttr.getAttr());
421 if (myValueTextField->shown()) {
422 myValueTextField->setTextColor(FXRGB(255, 0, 0));
423 if (newVal.empty()) {
424 myValueTextField->setBackColor(FXRGBA(255, 213, 213, 255));
426 }
else if (myValueComboBox->shown()) {
427 myValueComboBox->setTextColor(FXRGB(255, 0, 0));
428 if (newVal.empty()) {
429 myValueComboBox->setBackColor(FXRGBA(255, 213, 213, 255));
433 WRITE_DEBUG(
TLF(
"Value '%' for attribute % of % isn't valid", newVal, myACAttr.getAttrStr(), myACAttr.getTagPropertyParent().getTagStr()));
441 const auto& inspectedElements = myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedElements();
443 GNEUndoList* undoList = myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList();
445 if (myAttributeCheckButton->getCheck()) {
447 myValueCheckButton->enable();
448 myValueTextField->enable();
450 undoList->
begin(inspectedElements.getFirstAC(),
TL(
"enable attribute '") + myACAttr.getAttrStr() +
"'");
451 inspectedElements.getFirstAC()->enableAttribute(myACAttr.getAttr(), undoList);
455 myValueCheckButton->disable();
456 myValueTextField->disable();
458 undoList->
begin(inspectedElements.getFirstAC(),
TL(
"disable attribute '") + myACAttr.getAttrStr() +
"'");
459 inspectedElements.getFirstAC()->disableAttribute(myACAttr.getAttr(), undoList);
467 myAttributesEditorParent(nullptr) {
473 std::string result(stringValue);
474 while (result.find(
", ") != std::string::npos) {
483 const auto viewNet = myAttributesEditorParent->getFrameParent()->getViewNet();
484 const auto& inspectedElements = viewNet->getInspectedElements();
490 const Position newPosition = GNEAttributeCarrier::parse<Position>(newVal);
492 for (
const auto& targetjunction : viewNet->getNet()->getAttributeCarriers()->getJunctions()) {
494 if ((targetjunction.second->getPositionInView().distanceTo2D(newPosition) < POSITION_EPS) &&
495 viewNet->askMergeJunctions(movedJunction, targetjunction.second)) {
496 viewNet->getNet()->mergeJunctions(movedJunction, targetjunction.second, viewNet->getUndoList());
509 const auto tooltipMenu = myAttributesEditorParent->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu();
511 const bool disableRow = !
isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr);
514 myAttributeButton =
new MFXButtonTooltip(
this, tooltipMenu, myACAttr.getAttrStr().c_str(),
517 myAttributeButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
519 myAttributeButton->setTipText(
TLF(
"Inspect % parent", myACAttr.getAttrStr()).c_str());
520 myAttributeButton->setHelpText(
TLF(
"Inspect % parent", myACAttr.getAttrStr()).c_str());
523 myAttributeButton->disable();
525 }
else if (myACAttr.isActivatable()) {
528 if (attributeEnabled) {
529 myAttributeCheckButton->setCheck(TRUE);
531 myAttributeCheckButton->setCheck(FALSE);
534 myAttributeCheckButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
537 myAttributeCheckButton->disable();
539 }
else if (myACAttr.isSVCPermission() && (myACAttr.getAttr() !=
SUMO_ATTR_DISALLOW)) {
542 myAttributeButton->setTipText(
TL(
"Open dialog for editing vClasses"));
543 myAttributeButton->setHelpText(
TL(
"Open dialog for editing vClasses"));
545 if (!attributeEnabled || disableRow) {
546 myAttributeButton->disable();
548 }
else if (myACAttr.isColor()) {
553 myAttributeButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
555 myAttributeButton->setTipText(
TL(
"Open dialog for editing color"));
556 myAttributeButton->setHelpText(
TL(
"Open dialog for editing color"));
559 myAttributeButton->disable();
565 myAttributeLabel->setTipText(myACAttr.getDefinition().c_str());
566 myAttributeLabel->setHelpText(myACAttr.getDefinition().c_str());
575 myAttributesEditorParent->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu(),
577 myValueTextField->hide();
579 myValueTextField->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
583 myValueComboBox->hide();
585 myValueComboBox->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
588 myValueCheckButton->hide();
590 myValueCheckButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
592 if ((myACAttr.getAttr() ==
SUMO_ATTR_LANE) && !myACAttr.getTagPropertyParent().isNetworkElement()) {
594 const auto tooltipMenu = myAttributesEditorParent->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu();
599 myValueLaneUpButton->setTipText(
TL(
"Move element up one lane"));
600 myValueLaneUpButton->setHelpText(
TL(
"Move element up one lane"));
605 myValueLaneDownButton->setTipText(
TL(
"Move element down one lane"));
606 myValueLaneDownButton->setHelpText(
TL(
"Move element down one lane"));
609 if (!attributeEnabled || !
isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr)) {
610 myValueTextField->disable();
611 myValueComboBox->disable();
612 myValueCheckButton->disable();
613 if (myValueLaneUpButton) {
614 myValueLaneUpButton->disable();
616 if (myValueLaneDownButton) {
617 myValueLaneDownButton->disable();
626 const bool disableElement = !
isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr);
628 if (myAttributeCheckButton) {
630 myAttributeCheckButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
632 if (attributeEnabled) {
633 myAttributeCheckButton->setCheck(TRUE);
635 myAttributeCheckButton->setCheck(FALSE);
638 if (disableElement) {
639 myAttributeCheckButton->disable();
641 myAttributeCheckButton->enable();
643 }
else if (myAttributeButton) {
647 myAttributeButton->setText(
"vTypeDist.");
649 myAttributeButton->setText(myACParent->getTagStr().c_str());
651 myAttributeButton->setIcon(myACParent->getACIcon());
653 myAttributeButton->setTipText(
TLF(
"Inspect % parent", myACAttr.getAttrStr()).c_str());
654 myAttributeButton->setHelpText(
TLF(
"Inspect % parent", myACAttr.getAttrStr()).c_str());
656 myAttributeButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
659 myAttributeButton->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
662 if (!attributeEnabled || disableElement) {
663 myAttributeButton->disable();
665 myAttributeButton->enable();
669 if (myValueLaneUpButton && myValueLaneDownButton) {
670 updateMoveLaneButtons(value);
678 const bool disableElement = !attributeEnabled || !
isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr);
680 if (myValueTextField->shown()) {
682 if (forceRefreshAttribute ||
683 (myValueTextField->getTextColor() == FXRGB(0, 0, 0)) ||
684 (myValueTextField->getTextColor() == FXRGB(0, 0, 255))) {
685 myValueTextField->setText(value.c_str());
688 myValueTextField->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
690 if (disableElement) {
691 myValueTextField->disable();
693 myValueTextField->enable();
695 }
else if (myValueComboBox->shown()) {
699 myValueComboBox->setTextColor(computed ? FXRGB(0, 0, 255) : FXRGB(0, 0, 0));
701 if (disableElement) {
702 myValueComboBox->disable();
704 myValueComboBox->enable();
706 }
else if (myValueCheckButton->shown()) {
707 if (GNEAttributeCarrier::canParse<bool>(value)) {
708 myValueCheckButton->setCheck(GNEAttributeCarrier::parse<bool>(value));
710 myValueCheckButton->setCheck(
false);
713 if (myValueCheckButton) {
714 myValueComboBox->disable();
716 myValueComboBox->enable();
724 const auto& inspectedElements = myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedElements();
726 myValueComboBox->clearItems();
733 }
else if (myACAttr.isVType()) {
735 const auto& ACs = myAttributesEditorParent->getFrameParent()->getViewNet()->getNet()->getAttributeCarriers();
737 std::map<std::string, GNEDemandElement*> sortedTypes;
738 for (
const auto& type : ACs->getDemandElements().at(
SUMO_TAG_VTYPE)) {
739 sortedTypes[type.second->getID()] = type.second;
741 for (
const auto& sortedType : sortedTypes) {
742 myValueComboBox->appendIconItem(sortedType.first.c_str(), sortedType.second->getACIcon());
746 sortedTypes[typeDistribution.second->getID()] = typeDistribution.second;
748 for (
const auto& sortedType : sortedTypes) {
749 myValueComboBox->appendIconItem(sortedType.first.c_str(), sortedType.second->getACIcon());
756 }
else if ((myACAttr.getAttr() ==
SUMO_ATTR_RIGHT_OF_WAY) && (inspectedElements.isInspectingSingleElement()) &&
757 (inspectedElements.getFirstAC()->getTagProperty().getTag() ==
SUMO_TAG_JUNCTION)) {
759 if (inspectedElements.getFirstAC()->getAttribute(
SUMO_ATTR_TYPE) ==
"priority") {
762 }
else if (inspectedElements.getFirstAC()->getAttribute(
SUMO_ATTR_TYPE) ==
"traffic_light") {
767 myValueComboBox->disable();
771 for (
const auto& discreteValue : myACAttr.getDiscreteValues()) {
772 myValueComboBox->appendIconItem(discreteValue.c_str(),
nullptr);
776 const auto index = myValueComboBox->findItem(value.c_str());
778 if (myValueComboBox->getNumItems() > 0) {
779 myValueComboBox->setCurrentItem(0);
781 myValueComboBox->disable();
784 myValueComboBox->setCurrentItem(index);
792 const auto lane = myAttributesEditorParent->getFrameParent()->getViewNet()->getNet()->getAttributeCarriers()->retrieveLane(value,
false);
796 if ((lane->getIndex() + 1) >= (
int)lane->getParentEdge()->getLanes().size()) {
797 myValueLaneUpButton->disable();
799 myValueLaneUpButton->enable();
802 if ((lane->getIndex() - 1) < 0) {
803 myValueLaneDownButton->disable();
805 myValueLaneDownButton->enable();
808 if (!
isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr)) {
809 myValueLaneUpButton->disable();
810 myValueLaneDownButton->disable();
820 myFrameParent(frameParent),
821 myIncludeExtended(true) {
835 const auto& inspectedElements = myFrameParent->getViewNet()->getInspectedElements();
836 myIncludeExtended = includeExtended;
838 for (
auto& row : myAttributesEditorRows) {
840 if (row !=
nullptr) {
847 bool showFlowEditor =
false;
848 if (inspectedElements.isInspectingElements()) {
850 for (
const auto& attrProperty : inspectedElements.getFirstAC()->getTagProperty()) {
852 bool editAttribute =
true;
854 if (inspectedElements.isInspectingMultipleElements() && attrProperty.isUnique()) {
855 editAttribute =
false;
858 if (attrProperty.isExtended() && !includeExtended) {
859 editAttribute =
false;
862 if (attrProperty.isFlowDefinition()) {
863 editAttribute =
false;
864 showFlowEditor =
true;
869 std::set<std::string> occurringValues;
871 for (
const auto& inspectedAC : inspectedElements.getACs()) {
872 occurringValues.insert(inspectedAC->getAttribute(attrProperty.getAttr()));
875 std::ostringstream oss;
876 for (
auto values = occurringValues.begin(); values != occurringValues.end(); values++) {
877 if (values != occurringValues.begin()) {
883 std::string value = oss.str();
885 bool attributeEnabled = inspectedElements.getFirstAC()->isAttributeEnabled(attrProperty.getAttr());
887 if (!attributeEnabled) {
888 value = inspectedElements.getFirstAC()->getAlternativeValueForDisabledAttributes(attrProperty.getAttr());
891 if (inspectedElements.getFirstAC()->getTagProperty().isType() &&
896 attributeEnabled =
true;
899 if (inspectedElements.getFirstAC()->getTagProperty().isVehicleStop()) {
901 attributeEnabled =
false;
903 attributeEnabled =
false;
907 const bool computed = inspectedElements.isInspectingMultipleElements() ? false : inspectedElements.getFirstAC()->isAttributeComputed(attrProperty.getAttr());
910 if (inspectedElements.isInspectingSingleElement() && attrProperty.isVType()) {
913 if (ACParent ==
nullptr) {
919 myAttributesEditorRows[attrProperty.getPositionListed()] =
new AttributesEditorRow(
this, attrProperty, value, attributeEnabled, computed, ACParent);
923 if (showFlowEditor) {
924 myAttributesEditorFlow->showFlowEditor(inspectedElements.getFirstAC(), inspectedElements.getACs());
926 myAttributesEditorFlow->hideFlowEditor();
931 myAttributesEditorFlow->hideFlowEditor();
934 myHelpButton->reparent(
this);
941 myAttributesEditorFlow->hideFlowEditor();
949 const auto& inspectedElements = myFrameParent->getViewNet()->getInspectedElements();
951 if (inspectedElements.isInspectingElements()) {
953 for (
const auto& attrProperty : inspectedElements.getFirstAC()->getTagProperty()) {
955 bool editAttribute =
true;
957 if (inspectedElements.isInspectingMultipleElements() && attrProperty.isUnique()) {
958 editAttribute =
false;
961 if (attrProperty.isExtended() && !myIncludeExtended) {
962 editAttribute =
false;
965 if (attrProperty.isFlowDefinition()) {
966 editAttribute =
false;
971 std::set<std::string> occurringValues;
973 for (
const auto& inspectedAC : inspectedElements.getACs()) {
974 occurringValues.insert(inspectedAC->getAttribute(attrProperty.getAttr()));
977 std::ostringstream oss;
978 for (
auto values = occurringValues.begin(); values != occurringValues.end(); values++) {
979 if (values != occurringValues.begin()) {
985 std::string value = oss.str();
987 bool attributeEnabled = inspectedElements.getFirstAC()->isAttributeEnabled(attrProperty.getAttr());
989 if (inspectedElements.getFirstAC()->getTagProperty().isType() &&
994 attributeEnabled =
true;
997 if (!attributeEnabled) {
998 value = inspectedElements.getFirstAC()->getAlternativeValueForDisabledAttributes(attrProperty.getAttr());
1001 if (inspectedElements.getFirstAC()->getTagProperty().isVehicleStop()) {
1003 attributeEnabled =
false;
1005 attributeEnabled =
false;
1009 const bool computed = inspectedElements.isInspectingMultipleElements() ? false : inspectedElements.getFirstAC()->isAttributeComputed(attrProperty.getAttr());
1011 if ((attrProperty.getAttr() ==
SUMO_ATTR_SHAPE) && forceRefreshShape) {
1012 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value,
true, attributeEnabled, computed,
nullptr);
1014 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value,
true, attributeEnabled, computed,
nullptr);
1015 }
else if (attrProperty.isVType() && (attrProperty.getTagPropertyParent().isVehicle() || attrProperty.getTagPropertyParent().isPerson() ||
1016 attrProperty.getTagPropertyParent().isContainer())) {
1018 auto typeParent = myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveDemandElement(
SUMO_TAG_VTYPE, inspectedElements.getFirstAC()->getAttribute(
SUMO_ATTR_TYPE),
false);
1019 if (typeParent ==
nullptr) {
1022 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value,
false, attributeEnabled, computed, typeParent);
1025 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value,
false, attributeEnabled, computed,
nullptr);
1030 if (myAttributesEditorFlow->shownFlowEditor()) {
1031 myAttributesEditorFlow->refreshFlowEditor();
1039 return myFrameParent;
1046 if (myFrameParent->getViewNet()->getInspectedElements().getFirstAC()) {
1059 myFrameParent(frameParent) {
1083 myFrameParent->attributesEditorExtendedDialogOpened();
1093 myFrameParent(frameParent) {
1106 refreshGenericDataAttributes();
1121 myTextFieldParameters->setText(getParametersStr().c_str());
1122 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1123 myTextFieldParameters->killFocus();
1129 return myParameters;
1137 for (
const auto& parameter : myParameters) {
1138 result += parameter.first +
"=" + parameter.second +
"|";
1141 if (!result.empty()) {
1148std::vector<std::pair<std::string, std::string> >
1150 std::vector<std::pair<std::string, std::string> > result;
1152 for (
const auto& parameter : myParameters) {
1153 result.push_back(std::make_pair(parameter.first, parameter.second));
1164 for (
const auto& parameter : parameters) {
1165 result += parameter.first +
"=" + parameter.second +
"|";
1168 if (!result.empty()) {
1172 myTextFieldParameters->setText(result.c_str(), TRUE);
1178 return myFrameParent;
1184 if (myTextFieldParameters->getText().empty()) {
1186 }
else if (myTextFieldParameters->getTextColor() == FXRGB(255, 0, 0)) {
1202 refreshGenericDataAttributes();
1214 myParameters.clear();
1218 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1219 myTextFieldParameters->killFocus();
1221 std::vector<std::string> parameters =
StringTokenizer(myTextFieldParameters->getText().text(),
"|",
true).
getVector();
1223 for (
const auto& parameter : parameters) {
1227 myParameters[keyParam.front()] = keyParam.back();
1230 myTextFieldParameters->setText(getParametersStr().c_str(), FALSE);
1232 myTextFieldParameters->setTextColor(FXRGB(255, 0, 0));
1243 myInspectorFrameParent(inspectorFrameParent) {
1252 myTypeFrameParent(typeFrameParent) {
1264 return myInspectorFrameParent ? myInspectorFrameParent->getViewNet() : myTypeFrameParent->getViewNet();
1270 if (myInspectorFrameParent) {
1272 if (inspectedElements.getFirstAC() && inspectedElements.getFirstAC()->getTagProperty().hasParameters()) {
1274 refreshParametersEditor();
1278 hideParametersEditor();
1280 }
else if (myTypeFrameParent) {
1281 if (myTypeFrameParent->getTypeSelector()->getCurrentType() !=
nullptr) {
1283 refreshParametersEditor();
1287 hideParametersEditor();
1290 hideParametersEditor();
1304 if (myInspectorFrameParent) {
1305 const auto& inspectedElements = myInspectorFrameParent->getViewNet()->getInspectedElements();
1307 if (inspectedElements.getFirstAC() && inspectedElements.getFirstAC()->getTagProperty().hasParameters()) {
1309 if (inspectedElements.isInspectingSingleElement()) {
1311 myTextFieldParameters->setText(inspectedElements.getFirstAC()->getAttribute(
GNE_ATTR_PARAMETERS).c_str());
1314 std::string parameters = inspectedElements.getFirstAC()->getAttribute(
GNE_ATTR_PARAMETERS);
1315 for (
const auto& AC : inspectedElements.getACs()) {
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) {
1373 if (inspectedElements.getFirstAC() && inspectedElements.getFirstAC()->getTagProperty().hasParameters()) {
1374 if (inspectedElements.isInspectingMultipleElements()) {
1384 refreshParametersEditor();
1398 refreshParametersEditor();
1405 }
else if (myTypeFrameParent) {
1407 GNEDemandElement* type = myTypeFrameParent->getTypeSelector()->getCurrentType();
1416 refreshParametersEditor();
1429 if (myInspectorFrameParent) {
1430 const auto& inspectedElements = myInspectorFrameParent->getViewNet()->getInspectedElements();
1432 if (inspectedElements.getFirstAC() && inspectedElements.getFirstAC()->getTagProperty().hasParameters()) {
1434 if (inspectedElements.getFirstAC()->isValid(
GNE_ATTR_PARAMETERS, myTextFieldParameters->getText().text())) {
1436 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1437 myTextFieldParameters->killFocus();
1439 if (inspectedElements.isInspectingSingleElement()) {
1441 myInspectorFrameParent->getViewNet()->getUndoList()->begin(inspectedElements.getFirstAC(),
"change parameters");
1443 inspectedElements.getFirstAC()->setACParameters(myTextFieldParameters->getText().text(), myInspectorFrameParent->getViewNet()->getUndoList());
1445 myInspectorFrameParent->getViewNet()->getUndoList()->end();
1446 }
else if (inspectedElements.isInspectingMultipleElements()) {
1448 myInspectorFrameParent->getViewNet()->getUndoList()->begin(inspectedElements.getFirstAC(),
"change multiple parameters");
1450 for (
const auto& inspectedAC : inspectedElements.getACs()) {
1451 inspectedAC->setACParameters(myTextFieldParameters->getText().text(), myInspectorFrameParent->getViewNet()->getUndoList());
1454 myInspectorFrameParent->getViewNet()->getUndoList()->end();
1459 myTextFieldParameters->setTextColor(FXRGB(255, 0, 0));
1462 }
else if (myTypeFrameParent) {
1464 GNEDemandElement* type = myTypeFrameParent->getTypeSelector()->getCurrentType();
1470 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1471 myTextFieldParameters->killFocus();
1473 myTypeFrameParent->getViewNet()->getUndoList()->begin(type,
"change parameters");
1475 type->
setACParameters(myTextFieldParameters->getText().text(), myTypeFrameParent->getViewNet()->getUndoList());
1477 myTypeFrameParent->getViewNet()->getUndoList()->end();
1479 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
GNENet * getNet() const
get pointer to net
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
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
bool mergeJunction(SumoXMLAttr attr, const std::string &newVal) const
check junction merging
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 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
GNEViewNetHelper::InspectedElements & getInspectedElements()
get inspected elements
GNEUndoList * getUndoList() const
get the undoList object
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