87 const
std::
string& value, const
bool attributeEnabled, const
bool computed,
GNEAttributeCarrier* ACParent) :
89 myAttributesEditorParent(attributeEditorParent),
91 myACParent(ACParent) {
94 attributeEditorParent->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu(),
96 myAttributeLabel->hide();
99 myAttributeCheckButton->hide();
102 attributeEditorParent->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu(),
104 myAttributeAllowButton->hide();
107 attributeEditorParent->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu(),
109 myAttributeColorButton->hide();
112 attributeEditorParent->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu(),
114 myAttributeVTypeButton->hide();
117 attributeEditorParent->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu(),
119 myValueTextField->hide();
122 myValueChoicesComboBox->hide();
125 myValueCheckButton->hide();
127 if (getParent()->
id()) {
129 FXHorizontalFrame::create();
131 if (attributeEnabled ==
false) {
132 myValueTextField->disable();
133 myValueChoicesComboBox->disable();
134 myValueCheckButton->disable();
136 myValueTextField->enable();
137 myValueChoicesComboBox->enable();
138 myValueCheckButton->enable();
142 if (isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr)) {
143 myAttributeAllowButton->enable();
144 myAttributeColorButton->enable();
145 myAttributeVTypeButton->enable();
146 myAttributeCheckButton->enable();
148 myAttributeColorButton->disable();
149 myAttributeVTypeButton->disable();
150 myAttributeCheckButton->disable();
151 myValueTextField->disable();
152 myValueChoicesComboBox->disable();
153 myValueCheckButton->disable();
154 myAttributeAllowButton->disable();
161 myAttributeVTypeButton->setTextColor(FXRGB(0, 0, 255));
163 myAttributeVTypeButton->setTextColor(FXRGB(0, 0, 0));
164 myAttributeVTypeButton->killFocus();
166 myAttributeVTypeButton->setText(myACAttr.getAttrStr().c_str());
167 myAttributeVTypeButton->setTipText((
TL(
"Inspect vehicle ") + myACAttr.getAttrStr() +
" parent").c_str());
168 myAttributeVTypeButton->setHelpText((
TL(
"Inspect vehicle ") + myACAttr.getAttrStr() +
" parent").c_str());
169 myAttributeVTypeButton->show();
170 }
else if (myACAttr.isColor()) {
173 myAttributeColorButton->setTextColor(FXRGB(0, 0, 255));
175 myAttributeColorButton->setTextColor(FXRGB(0, 0, 0));
176 myAttributeColorButton->killFocus();
178 myAttributeColorButton->setText(myACAttr.getAttrStr().c_str());
179 myAttributeColorButton->setTipText(
TL(
"Open dialog for editing color"));
180 myAttributeColorButton->setHelpText(
TL(
"Open dialog for editing color"));
181 myAttributeColorButton->show();
183 myAttributeAllowButton->setText(myACAttr.getAttrStr().c_str());
184 myAttributeAllowButton->setTipText(
TL(
"Open dialog for editing allowed vClasses"));
185 myAttributeAllowButton->setHelpText(
TL(
"Open dialog for editing allowed vClasses"));
186 myAttributeAllowButton->show();
187 }
else if (myACAttr.isActivatable()) {
190 myAttributeCheckButton->setTextColor(FXRGB(0, 0, 255));
192 myAttributeCheckButton->setTextColor(FXRGB(0, 0, 0));
193 myAttributeCheckButton->killFocus();
195 myAttributeCheckButton->setText(myACAttr.getAttrStr().c_str());
196 myAttributeCheckButton->show();
198 if (attributeEnabled) {
199 myAttributeCheckButton->setCheck(TRUE);
201 myAttributeCheckButton->setCheck(FALSE);
205 myAttributeLabel->setText(myACAttr.getAttrStr().c_str());
206 myAttributeLabel->setTipText(myACAttr.getDefinition().c_str());
207 myAttributeLabel->show();
210 if (myACAttr.isBool()) {
212 bool allBooleanValuesEqual =
true;
214 std::vector<bool> booleanVector;
217 booleanVector = GNEAttributeCarrier::parse<std::vector<bool> >(value);
220 for (
const auto& booleanValue : booleanVector) {
221 if (booleanValue != booleanVector.front()) {
222 allBooleanValuesEqual =
false;
226 if (allBooleanValuesEqual) {
228 if ((booleanVector.size() > 0) && booleanVector.front()) {
229 myValueCheckButton->setCheck(
true);
230 myValueCheckButton->setText(
"true");
232 myValueCheckButton->setCheck(
false);
233 myValueCheckButton->setText(
"false");
236 myValueCheckButton->show();
239 myValueTextField->setText(value.c_str());
242 myValueTextField->setTextColor(FXRGB(0, 0, 255));
244 myValueTextField->setTextColor(FXRGB(0, 0, 0));
245 myValueTextField->killFocus();
247 myValueTextField->show();
249 }
else if (myACAttr.isDiscrete()) {
251 if ((myACAttr.getDiscreteValues().size() > 0) && myACAttr.isVClasses()) {
253 myAttributeLabel->hide();
255 myAttributeAllowButton->setText(myACAttr.getAttrStr().c_str());
256 myAttributeAllowButton->setTipText(
TL(
"Open dialog for editing allowed vClasses"));
257 myAttributeAllowButton->setHelpText(
TL(
"Open dialog for editing allowed vClasses"));
258 myAttributeAllowButton->show();
260 myValueTextField->setText(value.c_str());
263 myValueTextField->setTextColor(FXRGB(0, 0, 255));
265 myValueTextField->setTextColor(FXRGB(0, 0, 0));
266 myValueTextField->killFocus();
268 myValueTextField->show();
271 myValueChoicesComboBox->clearItems();
279 for (
const auto& discreteValue : myACAttr.getDiscreteValues()) {
280 myValueChoicesComboBox->appendIconItem(discreteValue.c_str());
284 if (myACAttr.showAllDiscreteValues()) {
285 myValueChoicesComboBox->setNumVisible(myValueChoicesComboBox->getNumItems());
287 myValueChoicesComboBox->setNumVisible(myValueChoicesComboBox->getNumItems() < 10 ? myValueChoicesComboBox->getNumItems() : 10);
289 const int itemIndex = myValueChoicesComboBox->findItem(value.c_str());
290 if (itemIndex == -1) {
291 myValueChoicesComboBox->setText(value.c_str());
293 myValueChoicesComboBox->setCurrentItem(itemIndex);
297 myValueChoicesComboBox->setTextColor(FXRGB(0, 0, 255));
299 myValueChoicesComboBox->setTextColor(FXRGB(0, 0, 0));
300 myValueChoicesComboBox->killFocus();
302 myValueChoicesComboBox->show();
304 }
else if (ACParent && myACAttr.isVType() && (myACAttr.getAttr() ==
SUMO_ATTR_TYPE)) {
306 myValueChoicesComboBox->clearItems();
307 for (
const auto& vType : ACParent->getNet()->getAttributeCarriers()->getDemandElements().at(
SUMO_TAG_VTYPE)) {
308 myValueChoicesComboBox->appendIconItem(vType->getID().c_str(), vType->getACIcon());
311 myValueChoicesComboBox->appendIconItem(vType->getID().c_str(), vType->getACIcon());
314 myValueChoicesComboBox->setNumVisible(myValueChoicesComboBox->getNumItems() < 10 ? myValueChoicesComboBox->getNumItems() : 10);
315 const int itemIndex = myValueChoicesComboBox->findItem(value.c_str());
316 if (itemIndex == -1) {
317 myValueChoicesComboBox->setText(value.c_str());
319 myValueChoicesComboBox->setCurrentItem(itemIndex);
323 myValueChoicesComboBox->setTextColor(FXRGB(0, 0, 255));
325 myValueChoicesComboBox->setTextColor(FXRGB(0, 0, 0));
326 myValueChoicesComboBox->killFocus();
328 myValueChoicesComboBox->show();
331 myValueTextField->setText(value.c_str());
334 myValueTextField->setTextColor(FXRGB(0, 0, 255));
336 myValueTextField->setTextColor(FXRGB(0, 0, 0));
337 myValueTextField->killFocus();
339 myValueTextField->show();
350 if (getParent()->
id()) {
351 FXHorizontalFrame::destroy();
358 const bool forceRefresh,
const bool attributeEnabled,
const bool computed,
GNEAttributeCarrier* ACParent) {
360 myACParent = ACParent;
363 if (attributeEnabled ==
false) {
364 myValueTextField->disable();
365 myValueChoicesComboBox->disable();
366 myValueCheckButton->disable();
368 myValueTextField->enable();
369 myValueChoicesComboBox->enable();
370 myValueCheckButton->enable();
374 if (
isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr)) {
375 myAttributeAllowButton->enable();
376 myAttributeColorButton->enable();
377 myAttributeCheckButton->enable();
379 myAttributeColorButton->disable();
380 myAttributeCheckButton->disable();
381 myValueTextField->disable();
382 myValueChoicesComboBox->disable();
383 myValueCheckButton->disable();
384 myAttributeAllowButton->disable();
388 if (myAttributeCheckButton->shown()) {
389 myAttributeCheckButton->setCheck(attributeEnabled);
391 if ((myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() == 1) &&
392 ACParent && myACAttr.isVType() && (myACAttr.getAttr() ==
SUMO_ATTR_TYPE)) {
394 myValueChoicesComboBox->clearItems();
396 myValueChoicesComboBox->appendIconItem(vType->getID().c_str(), vType->getACIcon());
399 myValueChoicesComboBox->appendIconItem(vType->getID().c_str(), vType->getACIcon());
402 myValueChoicesComboBox->setNumVisible(myValueChoicesComboBox->getNumItems() < 10 ? myValueChoicesComboBox->getNumItems() : 10);
403 myValueChoicesComboBox->setCurrentItem(myValueChoicesComboBox->findItem(value.c_str()));
404 myValueChoicesComboBox->show();
405 }
else if (myValueTextField->shown()) {
407 if (myValueTextField->getTextColor() == FXRGB(0, 0, 0) || myValueTextField->getTextColor() == FXRGB(0, 0, 255) || forceRefresh) {
408 myValueTextField->setText(value.c_str());
411 myValueTextField->setTextColor(FXRGB(0, 0, 255));
413 myValueTextField->setTextColor(FXRGB(0, 0, 0));
414 myValueTextField->killFocus();
417 }
else if (myValueChoicesComboBox->shown()) {
419 myValueChoicesComboBox->clearItems();
427 for (
const auto& discreteValue : myACAttr.getDiscreteValues()) {
428 myValueChoicesComboBox->appendIconItem(discreteValue.c_str(),
nullptr);
432 if (myACAttr.showAllDiscreteValues()) {
433 myValueChoicesComboBox->setNumVisible(myValueChoicesComboBox->getNumItems());
435 myValueChoicesComboBox->setNumVisible(myValueChoicesComboBox->getNumItems() < 10 ? myValueChoicesComboBox->getNumItems() : 10);
437 myValueChoicesComboBox->setCurrentItem(myValueChoicesComboBox->findItem(value.c_str()));
440 myValueChoicesComboBox->setTextColor(FXRGB(0, 0, 255));
442 myValueChoicesComboBox->setTextColor(FXRGB(0, 0, 0));
443 myValueChoicesComboBox->killFocus();
445 myValueChoicesComboBox->show();
446 }
else if (myValueCheckButton->shown()) {
447 if (GNEAttributeCarrier::canParse<bool>(value)) {
448 myValueCheckButton->setCheck(GNEAttributeCarrier::parse<bool>(value));
450 myValueCheckButton->setCheck(
false);
458 return ((myValueTextField->getTextColor() == FXRGB(0, 0, 0)) || (myValueTextField->getTextColor() == FXRGB(0, 0, 255))) &&
459 ((myValueChoicesComboBox->getTextColor() == FXRGB(0, 0, 0)) || (myValueChoicesComboBox->getTextColor() == FXRGB(0, 0, 255)));
465 GNEViewNet* viewNet = myAttributesEditorParent->getFrameParent()->getViewNet();
467 if (obj == myAttributeColorButton) {
469 FXColorDialog colordialog(
this,
TL(
"Color Dialog"));
470 colordialog.setTarget(
this);
472 if (GNEAttributeCarrier::canParse<RGBColor>(myValueTextField->getText().text())) {
473 colordialog.setRGBA(
MFXUtils::getFXColor(GNEAttributeCarrier::parse<RGBColor>(myValueTextField->getText().text())));
474 }
else if (!myACAttr.getDefaultValue().empty()) {
475 colordialog.setRGBA(
MFXUtils::getFXColor(GNEAttributeCarrier::parse<RGBColor>(myACAttr.getDefaultValue())));
480 if (colordialog.execute()) {
482 myValueTextField->setText(newValue.c_str());
485 if (ACs.size() > 1) {
486 viewNet->
getUndoList()->
begin(ACs.front()->getTagProperty().getGUIIcon(),
TL(
"change multiple attributes"));
490 inspectedAC->setAttribute(myACAttr.getAttr(), newValue, viewNet->
getUndoList());
493 if (ACs.size() > 1) {
497 myValueTextField->setTextColor(FXRGB(0, 0, 0));
498 myValueTextField->killFocus();
502 }
else if (obj == myAttributeAllowButton) {
504 if (ACs.size() > 1) {
505 viewNet->
getUndoList()->
begin(ACs.front()->getTagProperty().getGUIIcon(),
TL(
"change multiple attributes"));
508 bool acceptChanges =
false;
517 inspectedAC->setAttribute(myACAttr.getAttr(), allowed, viewNet->
getUndoList());
520 if (ACs.size() > 1) {
524 myAttributesEditorParent->getFrameParent()->attributeUpdated(myACAttr.getAttr());
528 throw ProcessError(
"Invalid call to onCmdOpenAttributeDialog");
535 auto viewnet = myAttributesEditorParent->getFrameParent()->getViewNet();
536 viewnet->getViewParent()->getInspectorFrame()->inspectChild(myACParent, viewnet->getInspectedAttributeCarriers().front());
546 if (myACAttr.isBool()) {
548 if (myValueCheckButton->shown()) {
550 if (myValueCheckButton->getCheck()) {
551 myValueCheckButton->setText(
"true");
554 myValueCheckButton->setText(
"false");
559 newVal = myValueTextField->getText().text();
561 }
else if (myACAttr.isDiscrete()) {
563 if ((myACAttr.getDiscreteValues().size() > 0) && myACAttr.isVClasses()) {
565 newVal = myValueTextField->getText().text();
568 newVal = myValueChoicesComboBox->getText().text();
570 }
else if (myACParent && myACAttr.isVType() && (myACAttr.getAttr() ==
SUMO_ATTR_TYPE)) {
572 if (myValueChoicesComboBox->shown()) {
573 newVal = myValueChoicesComboBox->getText().text();
575 newVal = myValueTextField->getText().text();
579 if (myValueTextField->getText().empty() && myACAttr.hasDefaultValue()) {
580 newVal = myACAttr.getDefaultValue();
581 myValueTextField->setText(newVal.c_str());
582 }
else if (myACAttr.isInt() && GNEAttributeCarrier::canParse<double>(myValueTextField->getText().text())) {
584 double doubleValue = GNEAttributeCarrier::parse<double>(myValueTextField->getText().text());
586 if ((doubleValue - (
int)doubleValue) == 0) {
587 newVal =
toString((
int)doubleValue);
588 myValueTextField->setText(newVal.c_str(), FALSE);
590 }
else if ((myACAttr.getAttr() ==
SUMO_ATTR_ANGLE) && GNEAttributeCarrier::canParse<double>(myValueTextField->getText().text())) {
592 double angle = GNEAttributeCarrier::parse<double>(myValueTextField->getText().text());
594 if ((angle < 0) || (angle > 360)) {
596 angle = fmod(angle, 360);
601 myValueTextField->setText(newVal.c_str(), FALSE);
604 newVal = myValueTextField->getText().text();
609 newVal = stripWhitespaceAfterComma(newVal);
612 const auto& inspectedACs = myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
614 const bool useDefaultValue = (newVal.empty() && myACAttr.hasDefaultValue());
616 if ((inspectedACs.size() > 0) && (inspectedACs.front()->isValid(myACAttr.getAttr(), newVal) || useDefaultValue)) {
618 if (!mergeJunction(myACAttr.getAttr(), inspectedACs, newVal)) {
620 if (inspectedACs.size() > 1) {
621 myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList()->begin(inspectedACs.front()->getTagProperty().getGUIIcon(),
TL(
"change multiple attributes"));
624 myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList()->begin(inspectedACs.front()->getTagProperty().getGUIIcon(),
TL(
"change ") + myACAttr.getTagPropertyParent().getTagStr() +
TL(
" attribute"));
627 for (
const auto& inspectedAC : inspectedACs) {
628 if (useDefaultValue) {
629 inspectedAC->setAttribute(myACAttr.getAttr(), myACAttr.getDefaultValue(), myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList());
631 inspectedAC->setAttribute(myACAttr.getAttr(), newVal, myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList());
635 if (inspectedACs.size() > 1) {
636 myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList()->end();
638 myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList()->end();
641 if (myACAttr.isVClasses()) {
642 myValueTextField->setTextColor(FXRGB(0, 0, 0));
643 myValueTextField->setBackColor(FXRGB(255, 255, 255));
644 myValueTextField->killFocus();
645 }
else if (myACAttr.isDiscrete()) {
646 myValueChoicesComboBox->setTextColor(FXRGB(0, 0, 0));
647 myValueChoicesComboBox->setBackColor(FXRGB(255, 255, 255));
648 myValueChoicesComboBox->killFocus();
649 }
else if (myValueTextField !=
nullptr) {
650 myValueTextField->setTextColor(FXRGB(0, 0, 0));
651 myValueTextField->setBackColor(FXRGB(255, 255, 255));
652 myValueTextField->killFocus();
655 myAttributesEditorParent->refreshAttributeEditor(
false,
false);
657 myAttributesEditorParent->getFrameParent()->attributeUpdated(myACAttr.getAttr());
661 if (myACAttr.isVClasses()) {
662 myValueTextField->setTextColor(FXRGB(255, 0, 0));
663 if (newVal.empty()) {
664 myValueTextField->setBackColor(FXRGBA(255, 213, 213, 255));
666 }
else if (myACAttr.isDiscrete()) {
667 myValueChoicesComboBox->setTextColor(FXRGB(255, 0, 0));
668 if (newVal.empty()) {
669 myValueChoicesComboBox->setBackColor(FXRGBA(255, 213, 213, 255));
671 }
else if (myValueTextField !=
nullptr) {
672 myValueTextField->setTextColor(FXRGB(255, 0, 0));
673 if (newVal.empty()) {
674 myValueTextField->setBackColor(FXRGBA(255, 213, 213, 255));
678 WRITE_DEBUG(
TL(
"Value '") + newVal +
TL(
"' for attribute ") + myACAttr.getAttrStr() +
TL(
" of ") + myACAttr.getTagPropertyParent().getTagStr() +
TL(
" isn't valid"));
686 const auto& ACs = myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
688 GNEUndoList* undoList = myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList();
690 if (myAttributeCheckButton->getCheck()) {
692 myValueCheckButton->enable();
693 myValueTextField->enable();
695 undoList->
begin(ACs.front()->getTagProperty().getGUIIcon(),
TL(
"enable attribute '") + myACAttr.getAttrStr() +
"'");
696 ACs.front()->enableAttribute(myACAttr.getAttr(), undoList);
700 myValueCheckButton->disable();
701 myValueTextField->disable();
703 undoList->
begin(ACs.front()->getTagProperty().getGUIIcon(),
TL(
"disable attribute '") + myACAttr.getAttrStr() +
"'");
704 ACs.front()->disableAttribute(myACAttr.getAttr(), undoList);
712 myAttributesEditorParent(nullptr) {
718 std::string result(stringValue);
719 while (result.find(
", ") != std::string::npos) {
733 const Position newPosition = GNEAttributeCarrier::parse<Position>(newVal);
735 for (
const auto& junction : myAttributesEditorParent->getFrameParent()->getViewNet()->getNet()->getAttributeCarriers()->getJunctions()) {
737 if ((junction.second->getPositionInView().distanceTo2D(newPosition) < POSITION_EPS) &&
738 myAttributesEditorParent->getFrameParent()->getViewNet()->mergeJunctions(movedJunction, junction.second)) {
753 myFrameParent(frameParent),
754 myIncludeExtended(true) {
768 myIncludeExtended = includeExtended;
770 for (
auto& row : myAttributesEditorRows) {
772 if (row !=
nullptr) {
779 const auto& ACs = myFrameParent->getViewNet()->getInspectedAttributeCarriers();
781 bool showFlowEditor =
false;
782 if (ACs.size() > 0) {
784 for (
const auto& attrProperty : ACs.front()->getTagProperty()) {
786 bool editAttribute =
true;
788 if ((ACs.size() > 1) && attrProperty.isUnique()) {
789 editAttribute =
false;
792 if (attrProperty.isExtended() && !includeExtended) {
793 editAttribute =
false;
796 if (attrProperty.isFlowDefinition()) {
797 editAttribute =
false;
798 showFlowEditor =
true;
803 std::set<std::string> occurringValues;
805 for (
const auto& inspectedAC : ACs) {
806 occurringValues.insert(inspectedAC->getAttribute(attrProperty.getAttr()));
809 std::ostringstream oss;
810 for (
auto values = occurringValues.begin(); values != occurringValues.end(); values++) {
811 if (values != occurringValues.begin()) {
817 std::string value = oss.str();
819 bool attributeEnabled = ACs.front()->isAttributeEnabled(attrProperty.getAttr());
821 if (attributeEnabled ==
false) {
822 value = ACs.front()->getAlternativeValueForDisabledAttributes(attrProperty.getAttr());
825 if (ACs.front()->getTagProperty().isType() &&
830 attributeEnabled =
true;
833 if (ACs.front()->getTagProperty().isStop() || ACs.front()->getTagProperty().isStopPerson()) {
835 attributeEnabled =
false;
837 attributeEnabled =
false;
841 const bool computed = (ACs.size() > 1) ?
false : ACs.front()->isAttributeComputed(attrProperty.getAttr());
844 if ((ACs.size() == 1) && attrProperty.isVType()) {
847 if (ACParent ==
nullptr) {
853 myAttributesEditorRows[attrProperty.getPositionListed()] =
new AttributesEditorRow(
this, attrProperty, value, attributeEnabled, computed, ACParent);
857 if (showFlowEditor) {
858 myAttributesEditorFlow->showFlowEditor(ACs);
860 myAttributesEditorFlow->hideFlowEditor();
865 myAttributesEditorFlow->hideFlowEditor();
868 myHelpButton->reparent(
this);
875 myAttributesEditorFlow->hideFlowEditor();
884 const auto& ACs = myFrameParent->getViewNet()->getInspectedAttributeCarriers();
886 if (ACs.size() > 0) {
888 for (
const auto& attrProperty : ACs.front()->getTagProperty()) {
890 bool editAttribute =
true;
892 if ((ACs.size() > 1) && attrProperty.isUnique()) {
893 editAttribute =
false;
896 if (attrProperty.isExtended() && !myIncludeExtended) {
897 editAttribute =
false;
900 if (attrProperty.isFlowDefinition()) {
901 editAttribute =
false;
906 std::set<std::string> occurringValues;
908 for (
const auto& inspectedAC : ACs) {
909 occurringValues.insert(inspectedAC->getAttribute(attrProperty.getAttr()));
912 std::ostringstream oss;
913 for (
auto values = occurringValues.begin(); values != occurringValues.end(); values++) {
914 if (values != occurringValues.begin()) {
920 std::string value = oss.str();
922 bool attributeEnabled = ACs.front()->isAttributeEnabled(attrProperty.getAttr());
924 if (ACs.front()->getTagProperty().isType() &&
929 attributeEnabled =
true;
932 if (attributeEnabled ==
false) {
933 value = ACs.front()->getAlternativeValueForDisabledAttributes(attrProperty.getAttr());
936 if (ACs.front()->getTagProperty().isStop() || ACs.front()->getTagProperty().isStopPerson()) {
938 attributeEnabled =
false;
940 attributeEnabled =
false;
944 const bool computed = (ACs.size() > 1) ?
false : ACs.front()->isAttributeComputed(attrProperty.getAttr());
946 if ((attrProperty.getAttr() ==
SUMO_ATTR_SHAPE) && forceRefreshShape) {
947 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value,
true, attributeEnabled, computed,
nullptr);
949 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value,
true, attributeEnabled, computed,
nullptr);
950 }
else if (attrProperty.isVType() && (attrProperty.getTagPropertyParent().isVehicle() || attrProperty.getTagPropertyParent().isPerson() ||
951 attrProperty.getTagPropertyParent().isContainer())) {
953 auto typeParent = myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveDemandElement(
SUMO_TAG_VTYPE, ACs.front()->getAttribute(
SUMO_ATTR_TYPE),
false);
954 if (typeParent ==
nullptr) {
957 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value,
false, attributeEnabled, computed, typeParent);
960 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value,
false, attributeEnabled, computed,
nullptr);
965 if (myAttributesEditorFlow->shownFlowEditor()) {
966 myAttributesEditorFlow->refreshFlowEditor();
974 return myFrameParent;
981 if (myFrameParent->getViewNet()->getInspectedAttributeCarriers().size() > 0) {
994 myFrameParent(frameParent) {
1018 myFrameParent->attributesEditorExtendedDialogOpened();
1028 myFrameParent(frameParent) {
1041 refreshGenericDataAttributes();
1056 myTextFieldParameters->setText(getParametersStr().c_str());
1057 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1058 myTextFieldParameters->killFocus();
1064 return myParameters;
1072 for (
const auto& parameter : myParameters) {
1073 result += parameter.first +
"=" + parameter.second +
"|";
1076 if (!result.empty()) {
1083std::vector<std::pair<std::string, std::string> >
1085 std::vector<std::pair<std::string, std::string> > result;
1087 for (
const auto& parameter : myParameters) {
1088 result.push_back(std::make_pair(parameter.first, parameter.second));
1099 for (
const auto& parameter : parameters) {
1100 result += parameter.first +
"=" + parameter.second +
"|";
1103 if (!result.empty()) {
1107 myTextFieldParameters->setText(result.c_str(), TRUE);
1113 return myFrameParent;
1119 if (myTextFieldParameters->getText().empty()) {
1121 }
else if (myTextFieldParameters->getTextColor() == FXRGB(255, 0, 0)) {
1137 refreshGenericDataAttributes();
1149 myParameters.clear();
1153 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1154 myTextFieldParameters->killFocus();
1156 std::vector<std::string> parameters =
StringTokenizer(myTextFieldParameters->getText().text(),
"|",
true).
getVector();
1158 for (
const auto& parameter : parameters) {
1162 myParameters[keyParam.front()] = keyParam.back();
1165 myTextFieldParameters->setText(getParametersStr().c_str(), FALSE);
1167 myTextFieldParameters->setTextColor(FXRGB(255, 0, 0));
1178 myInspectorFrameParent(inspectorFrameParent) {
1187 myTypeFrameParent(typeFrameParent) {
1199 return myInspectorFrameParent ? myInspectorFrameParent->getViewNet() : myTypeFrameParent->getViewNet();
1205 if (myInspectorFrameParent) {
1208 if ((inspectedACs.size() > 0) && inspectedACs.front()->getTagProperty().hasParameters()) {
1210 refreshParametersEditor();
1214 hideParametersEditor();
1216 }
else if (myTypeFrameParent) {
1217 if (myTypeFrameParent->getTypeSelector()->getCurrentType() !=
nullptr) {
1219 refreshParametersEditor();
1223 hideParametersEditor();
1226 hideParametersEditor();
1240 if (myInspectorFrameParent) {
1242 const auto& inspectedACs = myInspectorFrameParent->getViewNet()->getInspectedAttributeCarriers();
1244 const GNEAttributeCarrier* frontAC = inspectedACs.size() > 0 ? inspectedACs.front() :
nullptr;
1248 if (inspectedACs.size() == 1) {
1251 }
else if (inspectedACs.size() > 0) {
1254 for (
const auto& AC : inspectedACs) {
1256 parameters =
"different parameters";
1260 myTextFieldParameters->setText(parameters.c_str());
1263 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1266 myTextFieldParameters->enable();
1267 myButtonEditParameters->enable();
1269 myTextFieldParameters->disable();
1270 myButtonEditParameters->disable();
1273 }
else if (myTypeFrameParent) {
1275 GNEDemandElement* type = myTypeFrameParent->getTypeSelector()->getCurrentType();
1281 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1284 myTextFieldParameters->enable();
1285 myButtonEditParameters->enable();
1287 myTextFieldParameters->disable();
1288 myButtonEditParameters->disable();
1297 return myInspectorFrameParent;
1303 return myTypeFrameParent;
1309 if (myInspectorFrameParent) {
1313 const GNEAttributeCarrier* frontAC = inspectedACs.size() > 0 ? inspectedACs.front() :
nullptr;
1316 if (inspectedACs.size() > 1) {
1326 refreshParametersEditor();
1340 refreshParametersEditor();
1347 }
else if (myTypeFrameParent) {
1349 GNEDemandElement* type = myTypeFrameParent->getTypeSelector()->getCurrentType();
1358 refreshParametersEditor();
1371 if (myInspectorFrameParent) {
1372 const auto& inspectedACs = myInspectorFrameParent->getAttributesEditor()->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
1380 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1381 myTextFieldParameters->killFocus();
1383 if (inspectedACs.size() == 1) {
1385 myInspectorFrameParent->getViewNet()->getUndoList()->begin(frontAC->
getTagProperty().
getGUIIcon(),
"change parameters");
1387 frontAC->
setACParameters(myTextFieldParameters->getText().text(), myInspectorFrameParent->getViewNet()->getUndoList());
1389 myInspectorFrameParent->getViewNet()->getUndoList()->end();
1390 }
else if (inspectedACs.size() > 0) {
1392 myInspectorFrameParent->getViewNet()->getUndoList()->begin(frontAC->
getTagProperty().
getGUIIcon(),
"change multiple parameters");
1394 for (
const auto& inspectedAC : inspectedACs) {
1395 inspectedAC->setACParameters(myTextFieldParameters->getText().text(), myInspectorFrameParent->getViewNet()->getUndoList());
1398 myInspectorFrameParent->getViewNet()->getUndoList()->end();
1403 myTextFieldParameters->setTextColor(FXRGB(255, 0, 0));
1406 }
else if (myTypeFrameParent) {
1408 GNEDemandElement* type = myTypeFrameParent->getTypeSelector()->getCurrentType();
1414 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1415 myTextFieldParameters->killFocus();
1419 type->
setACParameters(myTextFieldParameters->getText().text(), myTypeFrameParent->getViewNet()->getUndoList());
1421 myTypeFrameParent->getViewNet()->getUndoList()->end();
1423 myTextFieldParameters->setTextColor(FXRGB(255, 0, 0));
FXDEFMAP(GNEFrameAttributeModules::AttributesEditorRow) AttributesEditorRowMap[]
@ MID_GNE_SET_ATTRIBUTE_VTYPE
inspect attribute vType/vTypeDistribution
@ 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_BOOL
bool attribute edited
#define GUIDesignButtonAttribute
button extended over over column with thick and raise frame
#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 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_NOTHING
invalid attribute
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
An Element which don't belong to GNENet but has influence in the simulation.
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
void refreshAttributesEditorRow(const std::string &value, const bool forceRefresh, const bool attributeEnabled, const bool computed, GNEAttributeCarrier *ACParent)
refresh current row
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
std::string stripWhitespaceAfterComma(const std::string &stringValue)
removed invalid spaces of Positions and shapes
long onCmdInspectVTypeParent(FXObject *, FXSelector, void *)
inspect vType/VTypeDistribution parent
bool isAttributesEditorRowValid() const
check if current attribute of TextField/ComboBox is valid
AttributesEditorRow()
default constructor
void destroy()
destroy GNEAttributesCreatorRow (but don't delete)
long onCmdOpenAttributeDialog(FXObject *, FXSelector, void *)
open model dialog for more comfortable attribute editing
long onCmdSelectCheckButton(FXObject *, FXSelector, void *)
called when user press a check button
~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.
const std::map< SumoXMLTag, std::set< GNEDemandElement * > > & getDemandElements() const
get demand elements
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
return true if tag correspond to a network element
bool isDataElement() const
return true if tag correspond to a data element
GUIIcon getGUIIcon() const
get GUI icon associated to this Tag
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
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 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
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