78 const
std::
string& value, const
bool attributeEnabled, const
bool computed,
GNEAttributeCarrier* ACParent) :
80 myAttributesEditorParent(attributeEditorParent),
82 myACParent(ACParent) {
85 attributeEditorParent->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu(),
87 myAttributeLabel->hide();
90 myAttributeCheckButton->hide();
93 attributeEditorParent->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu(),
95 myAttributeButtonCombinableChoices->hide();
98 attributeEditorParent->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu(),
100 myAttributeColorButton->hide();
103 attributeEditorParent->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu(),
105 myAttributeVTypeButton->hide();
108 attributeEditorParent->getFrameParent()->getViewNet()->getViewParent()->getGNEAppWindows()->getStaticTooltipMenu(),
110 myValueTextField->hide();
113 myValueComboBoxChoices->hide();
116 myValueCheckButton->hide();
118 if (getParent()->
id()) {
120 FXHorizontalFrame::create();
122 if (attributeEnabled ==
false) {
123 myValueTextField->disable();
124 myValueComboBoxChoices->disable();
125 myValueCheckButton->disable();
127 myValueTextField->enable();
128 myValueComboBoxChoices->enable();
129 myValueCheckButton->enable();
133 if (isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr)) {
134 myAttributeButtonCombinableChoices->enable();
135 myAttributeColorButton->enable();
136 myAttributeVTypeButton->enable();
137 myAttributeCheckButton->enable();
139 myAttributeColorButton->disable();
140 myAttributeVTypeButton->disable();
141 myAttributeCheckButton->disable();
142 myValueTextField->disable();
143 myValueComboBoxChoices->disable();
144 myValueCheckButton->disable();
145 myAttributeButtonCombinableChoices->disable();
152 myAttributeVTypeButton->setTextColor(FXRGB(0, 0, 255));
154 myAttributeVTypeButton->setTextColor(FXRGB(0, 0, 0));
155 myAttributeVTypeButton->killFocus();
157 myAttributeVTypeButton->setText(myACAttr.getAttrStr().c_str());
158 myAttributeVTypeButton->setTipText((
"Inspect vehicle " + myACAttr.getAttrStr() +
" parent").c_str());
159 myAttributeVTypeButton->setHelpText((
"Inspect vehicle " + myACAttr.getAttrStr() +
" parent").c_str());
160 myAttributeVTypeButton->show();
161 }
else if (myACAttr.isColor()) {
164 myAttributeColorButton->setTextColor(FXRGB(0, 0, 255));
166 myAttributeColorButton->setTextColor(FXRGB(0, 0, 0));
167 myAttributeColorButton->killFocus();
169 myAttributeColorButton->setText(myACAttr.getAttrStr().c_str());
170 myAttributeColorButton->setTipText(
"Open dialog for editing color");
171 myAttributeColorButton->setHelpText(
"Open dialog for editing color");
172 myAttributeColorButton->show();
174 myAttributeButtonCombinableChoices->setText(myACAttr.getAttrStr().c_str());
175 myAttributeButtonCombinableChoices->setTipText(
"Open dialog for editing vClasses");
176 myAttributeButtonCombinableChoices->setHelpText(
"Open dialog for editing vClasses");
177 myAttributeButtonCombinableChoices->show();
178 }
else if (myACAttr.isActivatable()) {
181 myAttributeCheckButton->setTextColor(FXRGB(0, 0, 255));
183 myAttributeCheckButton->setTextColor(FXRGB(0, 0, 0));
184 myAttributeCheckButton->killFocus();
186 myAttributeCheckButton->setText(myACAttr.getAttrStr().c_str());
187 myAttributeCheckButton->show();
189 if (attributeEnabled) {
190 myAttributeCheckButton->setCheck(TRUE);
192 myAttributeCheckButton->setCheck(FALSE);
196 myAttributeLabel->setText(myACAttr.getAttrStr().c_str());
197 myAttributeLabel->setTipText(myACAttr.getDefinition().c_str());
198 myAttributeLabel->show();
201 if (myACAttr.isBool()) {
203 bool allBooleanValuesEqual =
true;
205 std::vector<bool> booleanVector;
208 booleanVector = GNEAttributeCarrier::parse<std::vector<bool> >(value);
211 for (
const auto& booleanValue : booleanVector) {
212 if (booleanValue != booleanVector.front()) {
213 allBooleanValuesEqual =
false;
217 if (allBooleanValuesEqual) {
219 if ((booleanVector.size() > 0) && booleanVector.front()) {
220 myValueCheckButton->setCheck(
true);
221 myValueCheckButton->setText(
TL(
"true"));
223 myValueCheckButton->setCheck(
false);
224 myValueCheckButton->setText(
TL(
"false"));
227 myValueCheckButton->show();
230 myValueTextField->setText(value.c_str());
233 myValueTextField->setTextColor(FXRGB(0, 0, 255));
235 myValueTextField->setTextColor(FXRGB(0, 0, 0));
236 myValueTextField->killFocus();
238 myValueTextField->show();
240 }
else if (myACAttr.isDiscrete()) {
242 if ((myACAttr.getDiscreteValues().size() > 0) && myACAttr.isVClasses()) {
244 myAttributeLabel->hide();
246 myAttributeButtonCombinableChoices->setText(myACAttr.getAttrStr().c_str());
247 myAttributeButtonCombinableChoices->setTipText(
"Open dialog for editing vClasses");
248 myAttributeButtonCombinableChoices->setHelpText(
"Open dialog for editing vClasses");
249 myAttributeButtonCombinableChoices->show();
251 myValueTextField->setText(value.c_str());
254 myValueTextField->setTextColor(FXRGB(0, 0, 255));
256 myValueTextField->setTextColor(FXRGB(0, 0, 0));
257 myValueTextField->killFocus();
259 myValueTextField->show();
262 myValueComboBoxChoices->clearItems();
270 for (
const auto& discreteValue : myACAttr.getDiscreteValues()) {
271 myValueComboBoxChoices->appendIconItem(discreteValue.c_str());
275 myValueComboBoxChoices->setNumVisible(myValueComboBoxChoices->getNumItems() < 10 ? myValueComboBoxChoices->getNumItems() : 10);
276 const int itemIndex = myValueComboBoxChoices->findItem(value.c_str());
277 if (itemIndex == -1) {
278 myValueComboBoxChoices->setText(value.c_str());
280 myValueComboBoxChoices->setCurrentItem(itemIndex);
284 myValueComboBoxChoices->setTextColor(FXRGB(0, 0, 255));
286 myValueComboBoxChoices->setTextColor(FXRGB(0, 0, 0));
287 myValueComboBoxChoices->killFocus();
289 myValueComboBoxChoices->show();
293 myValueTextField->setText(value.c_str());
296 myValueTextField->setTextColor(FXRGB(0, 0, 255));
298 myValueTextField->setTextColor(FXRGB(0, 0, 0));
299 myValueTextField->killFocus();
301 myValueTextField->show();
312 if (getParent()->
id()) {
313 FXHorizontalFrame::destroy();
320 const bool forceRefresh,
const bool attributeEnabled,
const bool computed,
GNEAttributeCarrier* ACParent) {
322 myACParent = ACParent;
325 if (attributeEnabled ==
false) {
326 myValueTextField->disable();
327 myValueComboBoxChoices->disable();
328 myValueCheckButton->disable();
330 myValueTextField->enable();
331 myValueComboBoxChoices->enable();
332 myValueCheckButton->enable();
336 if (
isSupermodeValid(myAttributesEditorParent->getFrameParent()->getViewNet(), myACAttr)) {
337 myAttributeButtonCombinableChoices->enable();
338 myAttributeColorButton->enable();
339 myAttributeCheckButton->enable();
341 myAttributeColorButton->disable();
342 myAttributeCheckButton->disable();
343 myValueTextField->disable();
344 myValueComboBoxChoices->disable();
345 myValueCheckButton->disable();
346 myAttributeButtonCombinableChoices->disable();
350 if (myAttributeCheckButton->shown()) {
351 myAttributeCheckButton->setCheck(attributeEnabled);
353 if (myValueTextField->shown()) {
355 if (myValueTextField->getTextColor() == FXRGB(0, 0, 0) || myValueTextField->getTextColor() == FXRGB(0, 0, 255) || forceRefresh) {
356 myValueTextField->setText(value.c_str());
359 myValueTextField->setTextColor(FXRGB(0, 0, 255));
361 myValueTextField->setTextColor(FXRGB(0, 0, 0));
362 myValueTextField->killFocus();
365 }
else if (myValueComboBoxChoices->shown()) {
367 myValueComboBoxChoices->clearItems();
375 for (
const auto& discreteValue : myACAttr.getDiscreteValues()) {
376 myValueComboBoxChoices->appendIconItem(discreteValue.c_str());
380 myValueComboBoxChoices->setNumVisible(myValueComboBoxChoices->getNumItems() < 10 ? myValueComboBoxChoices->getNumItems() : 10);
381 myValueComboBoxChoices->setCurrentItem(myValueComboBoxChoices->findItem(value.c_str()));
384 myValueComboBoxChoices->setTextColor(FXRGB(0, 0, 255));
386 myValueComboBoxChoices->setTextColor(FXRGB(0, 0, 0));
387 myValueComboBoxChoices->killFocus();
389 myValueComboBoxChoices->show();
390 }
else if (myValueCheckButton->shown()) {
391 if (GNEAttributeCarrier::canParse<bool>(value)) {
392 myValueCheckButton->setCheck(GNEAttributeCarrier::parse<bool>(value));
394 myValueCheckButton->setCheck(
false);
402 return ((myValueTextField->getTextColor() == FXRGB(0, 0, 0)) || (myValueTextField->getTextColor() == FXRGB(0, 0, 255))) &&
403 ((myValueComboBoxChoices->getTextColor() == FXRGB(0, 0, 0)) || (myValueComboBoxChoices->getTextColor() == FXRGB(0, 0, 255)));
409 const auto& ACs = myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
410 if (obj == myAttributeColorButton) {
412 FXColorDialog colordialog(
this, tr(
"Color Dialog"));
413 colordialog.setTarget(
this);
415 if (GNEAttributeCarrier::canParse<RGBColor>(myValueTextField->getText().text())) {
416 colordialog.setRGBA(
MFXUtils::getFXColor(GNEAttributeCarrier::parse<RGBColor>(myValueTextField->getText().text())));
417 }
else if (!myACAttr.getDefaultValue().empty()) {
418 colordialog.setRGBA(
MFXUtils::getFXColor(GNEAttributeCarrier::parse<RGBColor>(myACAttr.getDefaultValue())));
423 if (colordialog.execute()) {
425 myValueTextField->setText(newValue.c_str());
426 if (myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->isValid(myACAttr.getAttr(), newValue)) {
428 if (ACs.size() > 1) {
429 myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList()->begin(ACs.front()->getTagProperty().getGUIIcon(),
"Change multiple attributes");
432 for (
const auto& inspectedAC : myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers()) {
433 inspectedAC->setAttribute(myACAttr.getAttr(), newValue, myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList());
436 if (ACs.size() > 1) {
437 myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList()->end();
440 myValueTextField->setTextColor(FXRGB(0, 0, 0));
441 myValueTextField->killFocus();
445 }
else if (obj == myAttributeButtonCombinableChoices) {
447 if (ACs.size() > 1) {
448 myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList()->begin(ACs.front()->getTagProperty().getGUIIcon(),
"Change multiple attributes");
453 bool acceptChanges =
false;
455 GNEAllowVClassesDialog(myAttributesEditorParent->getFrameParent()->getViewNet(), myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front(), modifiedAttr, &acceptChanges).execute();
458 std::string allowed = myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getAttribute(modifiedAttr);
460 for (
const auto& inspectedAC : myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers()) {
461 inspectedAC->setAttribute(modifiedAttr, allowed, myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList());
464 if (ACs.size() > 1) {
465 myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList()->end();
468 myAttributesEditorParent->getFrameParent()->attributeUpdated();
472 throw ProcessError(
"Invalid call to onCmdOpenAttributeDialog");
479 auto viewnet = myAttributesEditorParent->getFrameParent()->getViewNet();
480 viewnet->getViewParent()->getInspectorFrame()->inspectChild(myACParent, viewnet->getInspectedAttributeCarriers().front());
490 if (myACAttr.isBool()) {
492 if (myValueCheckButton->shown()) {
494 if (myValueCheckButton->getCheck()) {
495 myValueCheckButton->setText(
TL(
"true"));
498 myValueCheckButton->setText(
TL(
"false"));
503 newVal = myValueTextField->getText().text();
505 }
else if (myACAttr.isDiscrete()) {
507 if ((myACAttr.getDiscreteValues().size() > 0) && myACAttr.isVClasses()) {
509 newVal = myValueTextField->getText().text();
512 newVal = myValueComboBoxChoices->getText().text();
516 if (myValueTextField->getText().empty() && myACAttr.hasDefaultValue()) {
517 newVal = myACAttr.getDefaultValue();
518 myValueTextField->setText(newVal.c_str());
519 }
else if (myACAttr.isInt() && GNEAttributeCarrier::canParse<double>(myValueTextField->getText().text())) {
521 double doubleValue = GNEAttributeCarrier::parse<double>(myValueTextField->getText().text());
523 if ((doubleValue - (
int)doubleValue) == 0) {
524 newVal =
toString((
int)doubleValue);
525 myValueTextField->setText(newVal.c_str(), FALSE);
527 }
else if ((myACAttr.getAttr() ==
SUMO_ATTR_ANGLE) && GNEAttributeCarrier::canParse<double>(myValueTextField->getText().text())) {
529 double angle = GNEAttributeCarrier::parse<double>(myValueTextField->getText().text());
531 if ((angle < 0) || (angle > 360)) {
533 angle = fmod(angle, 360);
538 myValueTextField->setText(newVal.c_str(), FALSE);
541 newVal = myValueTextField->getText().text();
546 newVal = stripWhitespaceAfterComma(newVal);
549 const auto& inspectedACs = myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
551 const bool useDefaultValue = (newVal.empty() && myACAttr.hasDefaultValue());
553 if ((inspectedACs.size() > 0) && (inspectedACs.front()->isValid(myACAttr.getAttr(), newVal) || useDefaultValue)) {
555 if (!mergeJunction(myACAttr.getAttr(), inspectedACs, newVal)) {
557 if (inspectedACs.size() > 1) {
558 myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList()->begin(inspectedACs.front()->getTagProperty().getGUIIcon(),
"Change multiple attributes");
561 myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList()->begin(inspectedACs.front()->getTagProperty().getGUIIcon(),
"change " + myACAttr.getTagPropertyParent().getTagStr() +
" attribute");
564 for (
const auto& inspectedAC : inspectedACs) {
565 if (useDefaultValue) {
566 inspectedAC->setAttribute(myACAttr.getAttr(), myACAttr.getDefaultValue(), myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList());
568 inspectedAC->setAttribute(myACAttr.getAttr(), newVal, myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList());
572 if (inspectedACs.size() > 1) {
573 myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList()->end();
575 myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList()->end();
578 if (myACAttr.isVClasses()) {
579 myValueTextField->setTextColor(FXRGB(0, 0, 0));
580 myValueTextField->setBackColor(FXRGB(255, 255, 255));
581 myValueTextField->killFocus();
583 myAttributesEditorParent->refreshAttributeEditor(
false,
false);
584 }
else if (myACAttr.isDiscrete()) {
585 myValueComboBoxChoices->setTextColor(FXRGB(0, 0, 0));
586 myValueComboBoxChoices->setBackColor(FXRGB(255, 255, 255));
587 myValueComboBoxChoices->killFocus();
588 }
else if (myValueTextField !=
nullptr) {
589 myValueTextField->setTextColor(FXRGB(0, 0, 0));
590 myValueTextField->setBackColor(FXRGB(255, 255, 255));
591 myValueTextField->killFocus();
594 myAttributesEditorParent->getFrameParent()->attributeUpdated();
598 if (myACAttr.isVClasses()) {
599 myValueTextField->setTextColor(FXRGB(255, 0, 0));
600 if (newVal.empty()) {
601 myValueTextField->setBackColor(FXRGBA(255, 213, 213, 255));
603 }
else if (myACAttr.isDiscrete()) {
604 myValueComboBoxChoices->setTextColor(FXRGB(255, 0, 0));
605 if (newVal.empty()) {
606 myValueComboBoxChoices->setBackColor(FXRGBA(255, 213, 213, 255));
608 }
else if (myValueTextField !=
nullptr) {
609 myValueTextField->setTextColor(FXRGB(255, 0, 0));
610 if (newVal.empty()) {
611 myValueTextField->setBackColor(FXRGBA(255, 213, 213, 255));
615 WRITE_DEBUG(
"Value '" + newVal +
"' for attribute " + myACAttr.getAttrStr() +
" of " + myACAttr.getTagPropertyParent().getTagStr() +
" isn't valid");
623 const auto& ACs = myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
625 GNEUndoList* undoList = myAttributesEditorParent->getFrameParent()->getViewNet()->getUndoList();
627 if (myAttributeCheckButton->getCheck()) {
629 myValueCheckButton->enable();
630 myValueTextField->enable();
632 undoList->
begin(ACs.front()->getTagProperty().getGUIIcon(),
"enable attribute '" + myACAttr.getAttrStr() +
"'");
633 ACs.front()->enableAttribute(myACAttr.getAttr(), undoList);
637 myValueCheckButton->disable();
638 myValueTextField->disable();
640 undoList->
begin(ACs.front()->getTagProperty().getGUIIcon(),
"disable attribute '" + myACAttr.getAttrStr() +
"'");
641 ACs.front()->disableAttribute(myACAttr.getAttr(), undoList);
649 myAttributesEditorParent(nullptr) {
655 std::string result(stringValue);
656 while (result.find(
", ") != std::string::npos) {
670 const Position newPosition = GNEAttributeCarrier::parse<Position>(newVal);
672 for (
const auto& junction : myAttributesEditorParent->getFrameParent()->getViewNet()->getNet()->getAttributeCarriers()->getJunctions()) {
674 if ((junction.second->getPositionInView().distanceTo2D(newPosition) < POSITION_EPS) &&
675 myAttributesEditorParent->getFrameParent()->getViewNet()->mergeJunctions(movedJunction, junction.second)) {
690 myFrameParent(frameParent),
691 myIncludeExtended(true) {
705 myIncludeExtended = includeExtended;
707 for (
auto& row : myAttributesEditorRows) {
709 if (row !=
nullptr) {
716 const auto& ACs = myFrameParent->getViewNet()->getInspectedAttributeCarriers();
718 bool showFlowEditor =
false;
719 if (ACs.size() > 0) {
721 for (
const auto& attrProperty : ACs.front()->getTagProperty()) {
723 bool editAttribute =
true;
725 if ((ACs.size() > 1) && attrProperty.isUnique()) {
726 editAttribute =
false;
729 if (attrProperty.isExtended() && !includeExtended) {
730 editAttribute =
false;
733 if (attrProperty.isFlowDefinition()) {
734 editAttribute =
false;
735 showFlowEditor =
true;
740 std::set<std::string> occurringValues;
742 for (
const auto& inspectedAC : ACs) {
743 occurringValues.insert(inspectedAC->getAttribute(attrProperty.getAttr()));
746 std::ostringstream oss;
747 for (
auto values = occurringValues.begin(); values != occurringValues.end(); values++) {
748 if (values != occurringValues.begin()) {
754 std::string value = oss.str();
756 bool attributeEnabled = ACs.front()->isAttributeEnabled(attrProperty.getAttr());
758 if (attributeEnabled ==
false) {
759 value = ACs.front()->getAlternativeValueForDisabledAttributes(attrProperty.getAttr());
762 if (ACs.front()->getTagProperty().isStop() || ACs.front()->getTagProperty().isStopPerson()) {
764 attributeEnabled =
false;
766 attributeEnabled =
false;
770 if (forceAttributeEnabled && (attrProperty.getAttr() !=
SUMO_ATTR_ID)) {
771 attributeEnabled =
true;
774 const bool computed = (ACs.size() > 1) ?
false : ACs.front()->isAttributeComputed(attrProperty.getAttr());
777 if ((ACs.size() == 1) && attrProperty.isVType()) {
785 myAttributesEditorRows[attrProperty.getPositionListed()] =
new AttributesEditorRow(
this, attrProperty, value, attributeEnabled, computed, ACParent);
789 if (showFlowEditor) {
790 myAttributesEditorFlow->showFlowEditor(ACs);
792 myAttributesEditorFlow->hideFlowEditor();
797 myAttributesEditorFlow->hideFlowEditor();
800 myHelpButton->reparent(
this);
807 myAttributesEditorFlow->hideFlowEditor();
816 const auto& ACs = myFrameParent->getViewNet()->getInspectedAttributeCarriers();
818 if (ACs.size() > 0) {
820 for (
const auto& attrProperty : ACs.front()->getTagProperty()) {
822 bool editAttribute =
true;
824 if ((ACs.size() > 1) && attrProperty.isUnique()) {
825 editAttribute =
false;
828 if (attrProperty.isExtended() && !myIncludeExtended) {
829 editAttribute =
false;
832 if (attrProperty.isFlowDefinition()) {
833 editAttribute =
false;
838 std::set<std::string> occurringValues;
840 for (
const auto& inspectedAC : ACs) {
841 occurringValues.insert(inspectedAC->getAttribute(attrProperty.getAttr()));
844 std::ostringstream oss;
845 for (
auto values = occurringValues.begin(); values != occurringValues.end(); values++) {
846 if (values != occurringValues.begin()) {
852 std::string value = oss.str();
854 bool attributeEnabled = ACs.front()->isAttributeEnabled(attrProperty.getAttr());
856 if (attributeEnabled ==
false) {
857 value = ACs.front()->getAlternativeValueForDisabledAttributes(attrProperty.getAttr());
860 if (ACs.front()->getTagProperty().isStop() || ACs.front()->getTagProperty().isStopPerson()) {
862 attributeEnabled =
false;
864 attributeEnabled =
false;
868 const bool computed = (ACs.size() > 1) ?
false : ACs.front()->isAttributeComputed(attrProperty.getAttr());
870 if ((attrProperty.getAttr() ==
SUMO_ATTR_SHAPE) && forceRefreshShape) {
871 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value,
true, attributeEnabled, computed,
nullptr);
873 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value,
true, attributeEnabled, computed,
nullptr);
874 }
else if (attrProperty.getAttr() ==
SUMO_ATTR_TYPE && (attrProperty.getTagPropertyParent().isVehicle() || attrProperty.getTagPropertyParent().isPerson() ||
875 attrProperty.getTagPropertyParent().isContainer())) {
877 auto vTypeParent = myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveDemandElement(
SUMO_TAG_VTYPE, ACs.front()->getAttribute(
SUMO_ATTR_TYPE),
false);
878 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value,
false, attributeEnabled, computed, vTypeParent);
881 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value,
false, attributeEnabled, computed,
nullptr);
886 if (myAttributesEditorFlow->shownFlowEditor()) {
887 myAttributesEditorFlow->refreshFlowEditor();
895 return myFrameParent;
902 if (myFrameParent->getViewNet()->getInspectedAttributeCarriers().size() > 0) {
904 myFrameParent->openHelpAttributesDialog(myFrameParent->getViewNet()->getInspectedAttributeCarriers().front());
915 myFrameParent(frameParent) {
939 myFrameParent->attributesEditorExtendedDialogOpened();
949 myFrameParent(frameParent) {
962 refreshGenericDataAttributes();
977 myTextFieldParameters->setText(getParametersStr().c_str());
978 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
979 myTextFieldParameters->killFocus();
993 for (
const auto& parameter : myParameters) {
994 result += parameter.first +
"=" + parameter.second +
"|";
997 if (!result.empty()) {
1004std::vector<std::pair<std::string, std::string> >
1006 std::vector<std::pair<std::string, std::string> > result;
1008 for (
const auto& parameter : myParameters) {
1009 result.push_back(std::make_pair(parameter.first, parameter.second));
1020 for (
const auto& parameter : parameters) {
1021 result += parameter.first +
"=" + parameter.second +
"|";
1024 if (!result.empty()) {
1028 myTextFieldParameters->setText(result.c_str(), TRUE);
1034 return myFrameParent;
1040 if (myTextFieldParameters->getText().empty()) {
1042 }
else if (myTextFieldParameters->getTextColor() == FXRGB(255, 0, 0)) {
1058 refreshGenericDataAttributes();
1070 myParameters.clear();
1074 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
1075 myTextFieldParameters->killFocus();
1077 std::vector<std::string> parameters =
StringTokenizer(myTextFieldParameters->getText().text(),
"|",
true).
getVector();
1079 for (
const auto& parameter : parameters) {
1083 myParameters[keyParam.front()] = keyParam.back();
1086 myTextFieldParameters->setText(getParametersStr().c_str(), FALSE);
1088 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 GUIDesignLabelAttribute
label extended over the matrix column with thick frame
#define GUIDesignButtonRectangular
little button rectangula 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
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_VTYPE_DISTRIBUTION
vehicle type distribution
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
@ SUMO_ATTR_EXPECTED_CONTAINERS
@ SUMO_ATTR_NOTHING
invalid attribute
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Dialog for edit rerouters.
static FXIcon * getVClassIcon(const SUMOVehicleClass vc)
returns icon associated to the given vClass
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
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)
void showAttributeEditorModule(bool includeExtended, bool forceAttributeEnabled)
show attributes of multiple ACs
FXButton * myHelpButton
button for help
GNEFlowEditor * myAttributesEditorFlow
GNEFlowEditor modul.
GNEFrame * getFrameParent() const
pointer to GNEFrame parent
long onCmdAttributesEditorHelp(FXObject *, FXSelector, void *)
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
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
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 isNetworkElement() const
return true if tag correspond to a network element
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
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)
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