115 myAttributesCreatorParent(AttributesCreatorParent),
116 myAttrProperties(attrProperties) {
119 myAttributeLabel->hide();
121 myEnableAttributeCheckButton->hide();
123 myAttributeButton->hide();
126 myValueTextField->hide();
128 myValueCheckButton->hide();
130 myValueComboBox->hide();
132 if (getParent()->
id()) {
134 FXHorizontalFrame::create();
146 if (getParent()->
id()) {
147 FXHorizontalFrame::destroy();
154 return myAttrProperties;
160 if (myAttrProperties.isBool()) {
161 return (myValueCheckButton->getCheck() == 1) ?
"1" :
"0";
162 }
else if (myAttrProperties.isDiscrete()) {
163 return myValueComboBox->getText().text();
165 return myValueTextField->getText().text();
173 return myEnableAttributeCheckButton->getCheck() == TRUE;
184 myEnableAttributeCheckButton->setCheck(value);
187 if (myAttrProperties.isBool()) {
188 myValueCheckButton->enable();
189 }
else if (myAttrProperties.isDiscrete()) {
190 myValueComboBox->enable();
192 myValueTextField->enable();
195 if (myAttrProperties.isBool()) {
196 myValueCheckButton->disable();
197 }
else if (myAttrProperties.isDiscrete()) {
198 myValueComboBox->disable();
200 myValueTextField->disable();
209 if (myAttrProperties.isBool()) {
210 return myValueCheckButton->enable();
211 }
else if (myAttrProperties.isDiscrete()) {
212 myValueComboBox->enable();
214 return myValueTextField->enable();
221 if (myAttrProperties.isBool()) {
222 return myValueCheckButton->disable();
223 }
else if (myAttrProperties.isDiscrete()) {
224 myValueComboBox->disable();
226 return myValueTextField->disable();
235 }
else if (myAttrProperties.isBool()) {
236 return myValueCheckButton->isEnabled();
237 }
else if (myAttrProperties.isDiscrete()) {
238 myValueComboBox->isEnabled();
240 return myValueTextField->isEnabled();
248 myInvalidValue.clear();
250 if ((myAttrProperties.getAttr() ==
SUMO_ATTR_ID) && myAttrProperties.hasAutomaticID()) {
252 myEnableAttributeCheckButton->setText(myAttrProperties.getAttrStr().c_str());
253 myEnableAttributeCheckButton->setCheck(
false);
254 myEnableAttributeCheckButton->show();
256 myValueTextField->setTextColor(FXRGB(0, 0, 0));
257 myValueTextField->disable();
259 myValueTextField->setText(generateID().c_str());
261 myValueTextField->show();
266 myAttributeButton->setTextColor(FXRGB(0, 0, 0));
267 myAttributeButton->setText(myAttrProperties.getAttrStr().c_str());
268 myAttributeButton->show();
269 }
else if (myAttrProperties.isActivatable()) {
271 myEnableAttributeCheckButton->setText(myAttrProperties.getAttrStr().c_str());
272 myEnableAttributeCheckButton->show();
274 if (myAttributesCreatorParent->getCurrentTemplateAC()->isAttributeEnabled(myAttrProperties.getAttr())) {
275 myEnableAttributeCheckButton->setCheck(TRUE);
277 myEnableAttributeCheckButton->setCheck(FALSE);
281 myAttributeLabel->setText(myAttrProperties.getAttrStr().c_str());
282 myAttributeLabel->show();
285 if (myAttrProperties.isBool()) {
286 if (GNEAttributeCarrier::parse<bool>(myAttributesCreatorParent->getCurrentTemplateAC()->getAttribute(myAttrProperties.getAttr()))) {
287 myValueCheckButton->setCheck(
true);
288 myValueCheckButton->setText(
"true");
290 myValueCheckButton->setCheck(
false);
291 myValueCheckButton->setText(
"false");
293 myValueCheckButton->show();
295 if (myEnableAttributeCheckButton->shown() && (myEnableAttributeCheckButton->getCheck() == FALSE)) {
296 myValueCheckButton->disable();
298 }
else if (myAttrProperties.isDiscrete()) {
300 myValueComboBox->clearItems();
301 for (
const auto &item : myAttrProperties.getDiscreteValues()) {
302 myValueComboBox->appendItem(item.c_str());
304 myValueComboBox->setNumVisible(myValueComboBox->getNumItems());
305 myValueComboBox->setTextColor(FXRGB(0, 0, 0));
306 myValueComboBox->setText(myAttributesCreatorParent->getCurrentTemplateAC()->getAttribute(myAttrProperties.getAttr()).c_str());
307 myValueComboBox->show();
309 if (myEnableAttributeCheckButton->shown() && (myEnableAttributeCheckButton->getCheck() == FALSE)) {
310 myValueComboBox->disable();
313 myValueTextField->setTextColor(FXRGB(0, 0, 0));
314 myValueTextField->setText(myAttributesCreatorParent->getCurrentTemplateAC()->getAttribute(myAttrProperties.getAttr()).c_str());
315 myValueTextField->show();
317 if (myEnableAttributeCheckButton->shown() && (myEnableAttributeCheckButton->getCheck() == FALSE)) {
318 myValueTextField->disable();
327 myAttributeLabel->disable();
328 myEnableAttributeCheckButton->disable();
329 myAttributeButton->disable();
330 myValueTextField->disable();
331 myValueComboBox->disable();
332 myValueCheckButton->disable();
338 return (myValueTextField->getTextColor() != FXRGB(255, 0, 0) &&
339 myValueComboBox->getTextColor() != FXRGB(255, 0, 0));
345 return myAttributesCreatorParent;
352 if (obj == myEnableAttributeCheckButton) {
353 if (myEnableAttributeCheckButton->getCheck()) {
355 if (myValueTextField->shown()) {
356 myValueTextField->enable();
359 if (myValueComboBox->shown()) {
360 myValueComboBox->enable();
363 if (myValueCheckButton->shown()) {
364 myValueCheckButton->enable();
366 myAttributesCreatorParent->getCurrentTemplateAC()->toogleAttribute(myAttrProperties.getAttr(),
true, -1);
369 if (myValueTextField->shown()) {
370 myValueTextField->disable();
373 if (myValueComboBox->shown()) {
374 myValueComboBox->disable();
377 if (myValueCheckButton->shown()) {
378 myValueCheckButton->disable();
380 myAttributesCreatorParent->getCurrentTemplateAC()->toogleAttribute(myAttrProperties.getAttr(),
false, -1);
382 }
else if (obj == myValueCheckButton) {
383 if (myValueCheckButton->getCheck()) {
384 myValueCheckButton->setText(
"true");
385 myAttributesCreatorParent->getCurrentTemplateAC()->setAttribute(myAttrProperties.getAttr(),
"true");
387 myValueCheckButton->setText(
"false");
388 myAttributesCreatorParent->getCurrentTemplateAC()->setAttribute(myAttrProperties.getAttr(),
"false");
390 }
else if (obj == myValueComboBox) {
392 if (myAttributesCreatorParent->getCurrentTemplateAC()->isValid(myAttrProperties.getAttr(), myValueComboBox->getText().text())) {
394 if (myAttrProperties.hasDefaultValue() && (myAttrProperties.getDefaultValue() == myValueComboBox->getText().text())) {
395 myValueComboBox->setTextColor(FXRGB(128, 128, 128));
397 myValueComboBox->setTextColor(FXRGB(0, 0, 0));
399 myValueComboBox->killFocus();
400 myAttributesCreatorParent->getCurrentTemplateAC()->setAttribute(myAttrProperties.getAttr(), myValueComboBox->getText().text());
403 myValueComboBox->setTextColor(FXRGB(255, 0, 0));
405 }
else if (obj == myValueTextField) {
407 if (myAttributesCreatorParent->getCurrentTemplateAC()->isValid(myAttrProperties.getAttr(), myValueTextField->getText().text())) {
409 if (myAttrProperties.hasDefaultValue() && (myAttrProperties.getDefaultValue() == myValueTextField->getText().text())) {
410 myValueTextField->setTextColor(FXRGB(128, 128, 128));
412 myValueTextField->setTextColor(FXRGB(0, 0, 0));
414 myValueTextField->killFocus();
415 myAttributesCreatorParent->getCurrentTemplateAC()->setAttribute(myAttrProperties.getAttr(), myValueTextField->getText().text());
418 myValueTextField->setTextColor(FXRGB(255, 0, 0));
432 FXColorDialog colordialog(
this, tr(
"Color Dialog"));
433 colordialog.setTarget(
this);
435 if (GNEAttributeCarrier::canParse<RGBColor>(myValueTextField->getText().text())) {
436 colordialog.setRGBA(
MFXUtils::getFXColor(GNEAttributeCarrier::parse<RGBColor>(myValueTextField->getText().text())));
438 colordialog.setRGBA(
MFXUtils::getFXColor(GNEAttributeCarrier::parse<RGBColor>(myAttrProperties.getDefaultValue())));
441 if (colordialog.execute()) {
446 std::string allow = myValueTextField->getText().text();
448 bool acceptChanges =
false;
450 GNEAllowDisallow(myAttributesCreatorParent->getFrameParent()->getViewNet(), &allow, &acceptChanges).execute();
454 myValueTextField->setText(allow.c_str(), TRUE);
464 const auto& GNEAttributeCarriers = myAttributesCreatorParent->getFrameParent()->getViewNet()->getNet()->getAttributeCarriers();
466 if (myAttrProperties.getTagPropertyParent().isShape()) {
467 return GNEAttributeCarriers->generateShapeID(myAttrProperties.getTagPropertyParent().getXMLTag());
468 }
else if (myAttrProperties.getTagPropertyParent().isAdditionalElement()) {
469 return GNEAttributeCarriers->generateAdditionalID(myAttrProperties.getTagPropertyParent().getTag());
470 }
else if (myAttrProperties.getTagPropertyParent().isDemandElement()) {
471 return GNEAttributeCarriers->generateDemandElementID(myAttrProperties.getTagPropertyParent().getTag());
480 if (myAttrProperties.getTagPropertyParent().isAdditionalElement()) {
481 return (myAttributesCreatorParent->getFrameParent()->getViewNet()->getNet()->getAttributeCarriers()->retrieveAdditional(
482 myAttrProperties.getTagPropertyParent().getTag(), myValueTextField->getText().text(),
false) ==
nullptr);
483 }
else if (myAttrProperties.getTagPropertyParent().isDemandElement()) {
484 return (myAttributesCreatorParent->getFrameParent()->getViewNet()->getNet()->getAttributeCarriers()->retrieveAdditional(
485 myAttrProperties.getTagPropertyParent().getTag(), myValueTextField->getText().text(),
false) ==
nullptr);
497 myFrameParent(frameParent),
498 myTemplateAC(nullptr) {
516 for (
auto& row : myAttributesCreatorRows) {
518 if (row !=
nullptr) {
526 myTemplateAC = templateAC;
527 myHiddenAttributes = hiddenAttributes;
531 myResetButton->enable();
535 throw ProcessError(
"invalid templateAC in showAttributesCreatorModul");
543 myAttributesCreatorFlow->hideAttributesCreatorFlowModul();
551 return myFrameParent;
558 for (
const auto& row : myAttributesCreatorRows) {
560 const auto& attrProperties = row->getAttrProperties();
562 bool rowEnabled = row->isAttributesCreatorRowEnabled();
564 bool hasDefaultStaticValue = !attrProperties.hasDefaultValue() || (attrProperties.getDefaultValue() != row->getValue());
566 bool isFlowDefinitionAttribute = attrProperties.isFlowDefinition();
568 bool isActivatableAttribute = attrProperties.isActivatable() && row->getAttributeCheckButtonCheck();
570 if (rowEnabled && (includeAll || hasDefaultStaticValue || isFlowDefinitionAttribute || isActivatableAttribute)) {
572 if (attrProperties.isInt()) {
573 const int intValue = GNEAttributeCarrier::canParse<int>(row->getValue())? GNEAttributeCarrier::parse<int>(row->getValue()) : GNEAttributeCarrier::parse<int>(attrProperties.getDefaultValue());
575 }
else if (attrProperties.isFloat()) {
576 const double doubleValue = GNEAttributeCarrier::canParse<double>(row->getValue())? GNEAttributeCarrier::parse<double>(row->getValue()) : GNEAttributeCarrier::parse<double>(attrProperties.getDefaultValue());
578 }
else if (attrProperties.isBool()) {
579 const bool boolValue = GNEAttributeCarrier::canParse<bool>(row->getValue())? GNEAttributeCarrier::parse<bool>(row->getValue()) : GNEAttributeCarrier::parse<bool>(attrProperties.getDefaultValue());
581 }
else if (attrProperties.isposition()) {
582 const Position positionValue = GNEAttributeCarrier::canParse<Position>(row->getValue())? GNEAttributeCarrier::parse<Position>(row->getValue()) : GNEAttributeCarrier::parse<Position>(attrProperties.getDefaultValue());
584 }
else if (attrProperties.isSUMOTime()) {
585 const SUMOTime timeValue = GNEAttributeCarrier::canParse<SUMOTime>(row->getValue())? GNEAttributeCarrier::parse<SUMOTime>(row->getValue()) : GNEAttributeCarrier::parse<SUMOTime>(attrProperties.getDefaultValue());
587 }
else if (attrProperties.isColor()) {
588 const RGBColor colorValue = GNEAttributeCarrier::canParse<RGBColor>(row->getValue())? GNEAttributeCarrier::parse<RGBColor>(row->getValue()) : GNEAttributeCarrier::parse<RGBColor>(attrProperties.getDefaultValue());
590 }
else if (attrProperties.isList()) {
591 if (attrProperties.isposition()) {
592 const PositionVector positionVectorValue = GNEAttributeCarrier::canParse<PositionVector>(row->getValue())? GNEAttributeCarrier::parse<PositionVector>(row->getValue()) : GNEAttributeCarrier::parse<PositionVector>(attrProperties.getDefaultValue());
595 const std::vector<std::string> stringVectorValue = GNEAttributeCarrier::canParse<std::vector<std::string> >(row->getValue())?
GNEAttributeCarrier::parse<std::vector<std::string> >(row->getValue()) :
GNEAttributeCarrier::parse<std::vector<std::string> >(attrProperties.getDefaultValue());
605 myAttributesCreatorFlow->setFlowParameters(baseObject);
617 std::string errorMessage;
619 if (extra.size() == 0) {
620 errorMessage =
"Invalid input parameter of " + myTemplateAC->getTagProperty().getTagStr();
622 errorMessage =
"Invalid input parameter of " + myTemplateAC->getTagProperty().getTagStr() +
": " + extra;
625 myFrameParent->myViewNet->setStatusBarText(errorMessage);
634 if (shown() && myTemplateAC) {
643 for (
const auto &row : myAttributesCreatorRows) {
649 myResetButton->disable();
656 for (
const auto& attribute : myTemplateAC->getTagProperty()) {
658 if (myAttributesCreatorRows.at(attribute.getPositionListed()) && !myAttributesCreatorRows.at(attribute.getPositionListed())->isAttributeValid()) {
669 myTemplateAC->resetDefaultValues();
679 myFrameParent->openHelpAttributesDialog(myTemplateAC);
687 bool showFlowEditor =
false;
689 for (
const auto& attribute : myTemplateAC->getTagProperty()) {
691 bool showAttribute =
true;
693 if (attribute.isUnique() && (attribute.getAttr() !=
SUMO_ATTR_ID)) {
694 showAttribute =
false;
697 if (std::find(myHiddenAttributes.begin(), myHiddenAttributes.end(), attribute.getAttr()) != myHiddenAttributes.end()) {
698 showAttribute =
false;
701 if (attribute.isFlowDefinition()) {
702 showAttribute =
false;
703 showFlowEditor =
true;
707 showAttribute =
false;
710 if ((attribute.getAttr() ==
SUMO_ATTR_TYPE) && (myFrameParent->getViewNet()->getEditModes().isCurrentSupermodeDemand()) &&
712 showAttribute =
false;
718 myAttributesCreatorRows.at(attribute.getPositionListed()) =
new AttributesCreatorRow(
this, attribute);
720 myAttributesCreatorRows.at(attribute.getPositionListed())->refreshRow();
725 myFrameButtons->reparent(getCollapsableFrame());
729 if (showFlowEditor) {
730 myAttributesCreatorFlow->showAttributesCreatorFlowModul(
735 myAttributesCreatorFlow->hideAttributesCreatorFlowModul();
744 FXGroupBoxModule(attributesCreatorParent->getFrameParent()->myContentFrame,
"Flow attributes"),
745 myAttributesCreatorParent(attributesCreatorParent),
748 FXHorizontalFrame* auxiliarHorizontalFrame =
nullptr;
804 myAttributeEndRadioButton->setCheck(TRUE);
805 myValueEndTextField->enable();
807 myAttributeEndRadioButton->setCheck(FALSE);
808 myValueEndTextField->disable();
811 myAttributeNumberRadioButton->setCheck(TRUE);
812 myValueNumberTextField->enable();
814 myAttributeNumberRadioButton->setCheck(FALSE);
815 myValueNumberTextField->disable();
818 myAttributeVehsPerHourRadioButton->setCheck(TRUE);
819 myValueVehsPerHourTextField->enable();
821 myAttributeVehsPerHourRadioButton->setCheck(FALSE);
822 myValueVehsPerHourTextField->disable();
825 myAttributePeriodRadioButton->setCheck(TRUE);
826 myValuePeriodTextField->enable();
828 myAttributePeriodRadioButton->setCheck(FALSE);
829 myValuePeriodTextField->disable();
832 myAttributeProbabilityRadioButton->setCheck(TRUE);
833 myValueProbabilityTextField->enable();
835 myAttributeProbabilityRadioButton->setCheck(FALSE);
836 myValueProbabilityTextField->disable();
867 std::string errorMessage;
887 myAttributesCreatorParent->getFrameParent()->myViewNet->setStatusBarText(errorMessage);
897 if (GNEAttributeCarrier::canParse<double>(myValueEndTextField->getText().text())) {
898 if (GNEAttributeCarrier::parse<double>(myValueEndTextField->getText().text()) < 0) {
906 if (GNEAttributeCarrier::canParse<int>(myValueNumberTextField->getText().text())) {
907 if (GNEAttributeCarrier::parse<int>(myValueNumberTextField->getText().text()) < 0) {
915 if (GNEAttributeCarrier::canParse<double>(myValueVehsPerHourTextField->getText().text())) {
916 if (GNEAttributeCarrier::parse<double>(myValueVehsPerHourTextField->getText().text()) < 0) {
924 if (GNEAttributeCarrier::canParse<double>(myValuePeriodTextField->getText().text())) {
925 if (GNEAttributeCarrier::parse<double>(myValuePeriodTextField->getText().text()) < 0) {
933 if (GNEAttributeCarrier::canParse<double>(myValueProbabilityTextField->getText().text())) {
934 if (GNEAttributeCarrier::parse<double>(myValueProbabilityTextField->getText().text()) < 0) {
948 FXTextField* textField =
nullptr;
950 if (obj == myValueEndTextField) {
951 textField = myValueEndTextField;
952 }
else if (obj == myValueNumberTextField) {
953 textField = myValueNumberTextField;
954 }
else if (obj == myValueVehsPerHourTextField) {
955 textField = myValueVehsPerHourTextField;
956 }
else if (obj == myValuePeriodTextField) {
957 textField = myValuePeriodTextField;
958 }
else if (obj == myValueProbabilityTextField) {
959 textField = myValueProbabilityTextField;
964 if (GNEAttributeCarrier::canParse<double>(textField->getText().text()) && (GNEAttributeCarrier::parse<double>(textField->getText().text()) >= 0)) {
965 textField->setTextColor(FXRGB(0, 0, 0));
967 textField->setTextColor(FXRGB(255, 0, 0));
969 textField->killFocus();
977 if (obj == myAttributeEndRadioButton) {
979 }
else if (obj == myAttributeNumberRadioButton) {
981 }
else if (obj == myAttributeVehsPerHourRadioButton) {
987 }
else if (obj == myAttributePeriodRadioButton) {
989 }
else if (obj == myAttributeProbabilityRadioButton) {
995 refreshAttributesCreatorFlow();
1004 const std::string& value,
const bool attributeEnabled,
const bool computed) :
1006 myAttributesEditorParent(attributeEditorParent),
1031 if (getParent()->
id()) {
1033 FXHorizontalFrame::create();
1035 if (attributeEnabled ==
false) {
1079 if (attributeEnabled) {
1092 bool allBooleanValuesEqual =
true;
1094 std::vector<bool> booleanVector;
1097 booleanVector = GNEAttributeCarrier::parse<std::vector<bool> >(value);
1100 for (
const auto& booleanValue : booleanVector) {
1101 if (booleanValue != booleanVector.front()) {
1102 allBooleanValuesEqual =
false;
1106 if (allBooleanValuesEqual) {
1108 if ((booleanVector.size() > 0) && booleanVector.front()) {
1192 if (getParent()->
id()) {
1193 FXHorizontalFrame::destroy();
1200 const bool forceRefresh,
const bool attributeEnabled,
const bool computed) {
1202 if (attributeEnabled ==
false) {
1203 myValueTextField->disable();
1204 myValueComboBoxChoices->disable();
1205 myValueCheckButton->disable();
1207 myValueTextField->enable();
1208 myValueComboBoxChoices->enable();
1209 myValueCheckButton->enable();
1213 if (
isSupermodeValid(myAttributesEditorParent->getFrameParent()->myViewNet, myACAttr)) {
1214 myAttributeButtonCombinableChoices->enable();
1215 myAttributeColorButton->enable();
1216 myAttributeCheckButton->enable();
1218 myAttributeColorButton->disable();
1219 myAttributeCheckButton->disable();
1220 myValueTextField->disable();
1221 myValueComboBoxChoices->disable();
1222 myValueCheckButton->disable();
1223 myAttributeButtonCombinableChoices->disable();
1227 if (myAttributeCheckButton->shown()) {
1228 myAttributeCheckButton->setCheck(attributeEnabled);
1230 if (myValueTextField->shown()) {
1232 if (myValueTextField->getTextColor() == FXRGB(0, 0, 0) || myValueTextField->getTextColor() == FXRGB(0, 0, 255) || forceRefresh) {
1233 myValueTextField->setText(value.c_str());
1236 myValueTextField->setTextColor(FXRGB(0, 0, 255));
1238 myValueTextField->setTextColor(FXRGB(0, 0, 0));
1241 }
else if (myValueComboBoxChoices->shown()) {
1243 myValueComboBoxChoices->clearItems();
1244 for (
const auto& discreteValue : myACAttr.getDiscreteValues()) {
1245 myValueComboBoxChoices->appendItem(discreteValue.c_str());
1248 myValueComboBoxChoices->setNumVisible((
int)myACAttr.getDiscreteValues().size());
1249 myValueComboBoxChoices->setCurrentItem(myValueComboBoxChoices->findItem(value.c_str()));
1252 myValueComboBoxChoices->setTextColor(FXRGB(0, 0, 255));
1254 myValueComboBoxChoices->setTextColor(FXRGB(0, 0, 0));
1256 myValueComboBoxChoices->show();
1257 }
else if (myValueCheckButton->shown()) {
1258 if (GNEAttributeCarrier::canParse<bool>(value)) {
1259 myValueCheckButton->setCheck(GNEAttributeCarrier::parse<bool>(value));
1261 myValueCheckButton->setCheck(
false);
1269 return ((myValueTextField->getTextColor() == FXRGB(0, 0, 0)) || (myValueTextField->getTextColor() == FXRGB(0, 0, 255))) &&
1270 ((myValueComboBoxChoices->getTextColor() == FXRGB(0, 0, 0)) || (myValueComboBoxChoices->getTextColor() == FXRGB(0, 0, 255)));
1276 const auto& ACs = myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
1277 if (obj == myAttributeColorButton) {
1279 FXColorDialog colordialog(
this, tr(
"Color Dialog"));
1280 colordialog.setTarget(
this);
1282 if (GNEAttributeCarrier::canParse<RGBColor>(myValueTextField->getText().text())) {
1283 colordialog.setRGBA(
MFXUtils::getFXColor(GNEAttributeCarrier::parse<RGBColor>(myValueTextField->getText().text())));
1284 }
else if (!myACAttr.getDefaultValue().empty()) {
1285 colordialog.setRGBA(
MFXUtils::getFXColor(GNEAttributeCarrier::parse<RGBColor>(myACAttr.getDefaultValue())));
1290 if (colordialog.execute()) {
1292 myValueTextField->setText(newValue.c_str());
1293 if (myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->isValid(myACAttr.getAttr(), newValue)) {
1295 if (ACs.size() > 1) {
1296 myAttributesEditorParent->getFrameParent()->myViewNet->getUndoList()->begin(ACs.front()->getTagProperty().getGUIIcon(),
"Change multiple attributes");
1299 for (
const auto& inspectedAC : myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers()) {
1300 inspectedAC->setAttribute(myACAttr.getAttr(), newValue, myAttributesEditorParent->getFrameParent()->myViewNet->getUndoList());
1303 myValueTextField->setTextColor(FXRGB(0, 0, 0));
1304 myValueTextField->killFocus();
1308 }
else if (obj == myAttributeButtonCombinableChoices) {
1310 if (ACs.size() > 1) {
1311 myAttributesEditorParent->getFrameParent()->myViewNet->getUndoList()->begin(ACs.front()->getTagProperty().getGUIIcon(),
"Change multiple attributes");
1316 bool acceptChanges =
false;
1318 GNEAllowDisallow(myAttributesEditorParent->getFrameParent()->myViewNet, myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front(), modifiedAttr, &acceptChanges).execute();
1320 if (acceptChanges) {
1321 std::string allowed = myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getAttribute(modifiedAttr);
1323 for (
const auto& inspectedAC : myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers()) {
1324 inspectedAC->setAttribute(modifiedAttr, allowed, myAttributesEditorParent->getFrameParent()->myViewNet->getUndoList());
1327 if (ACs.size() > 1) {
1331 myAttributesEditorParent->getFrameParent()->attributeUpdated();
1335 throw ProcessError(
"Invalid call to onCmdOpenAttributeDialog");
1345 if (myACAttr.isBool()) {
1347 if (myValueCheckButton->shown()) {
1349 if (myValueCheckButton->getCheck()) {
1350 myValueCheckButton->setText(
"true");
1353 myValueCheckButton->setText(
"false");
1358 newVal = myValueTextField->getText().text();
1360 }
else if (myACAttr.isDiscrete()) {
1362 if ((myACAttr.getDiscreteValues().size() > 0) && myACAttr.isVClasses()) {
1364 newVal = myValueTextField->getText().text();
1365 }
else if (!myMultiple) {
1367 newVal = myValueComboBoxChoices->getText().text();
1370 newVal = myValueTextField->getText().text();
1374 if (myValueTextField->getText().empty() && myACAttr.hasDefaultValue()) {
1375 newVal = myACAttr.getDefaultValue();
1376 myValueTextField->setText(newVal.c_str());
1377 }
else if (myACAttr.isInt() && GNEAttributeCarrier::canParse<double>(myValueTextField->getText().text())) {
1379 double doubleValue = GNEAttributeCarrier::parse<double>(myValueTextField->getText().text());
1381 if ((doubleValue - (
int)doubleValue) == 0) {
1382 newVal =
toString((
int)doubleValue);
1383 myValueTextField->setText(newVal.c_str(), FALSE);
1385 }
else if ((myACAttr.getAttr() ==
SUMO_ATTR_ANGLE) && GNEAttributeCarrier::canParse<double>(myValueTextField->getText().text())) {
1387 double angle = GNEAttributeCarrier::parse<double>(myValueTextField->getText().text());
1389 if ((angle < 0) || (angle > 360)) {
1391 angle = fmod(angle, 360);
1396 myValueTextField->setText(newVal.c_str(), FALSE);
1399 newVal = myValueTextField->getText().text();
1404 newVal = stripWhitespaceAfterComma(newVal);
1407 const auto& inspectedACs = myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
1409 if ((inspectedACs.size() > 0) && inspectedACs.front()->isValid(myACAttr.getAttr(), newVal)) {
1411 if (!mergeJunction(myACAttr.getAttr(), inspectedACs, newVal)) {
1413 if (inspectedACs.size() > 1) {
1414 myAttributesEditorParent->getFrameParent()->myViewNet->getUndoList()->begin(inspectedACs.front()->getTagProperty().getGUIIcon(),
"Change multiple attributes");
1417 myAttributesEditorParent->getFrameParent()->myViewNet->getUndoList()->begin(inspectedACs.front()->getTagProperty().getGUIIcon(),
"change " + myACAttr.getTagPropertyParent().getTagStr() +
" attribute");
1420 for (
const auto& inspectedAC : inspectedACs) {
1421 inspectedAC->setAttribute(myACAttr.getAttr(), newVal, myAttributesEditorParent->getFrameParent()->myViewNet->getUndoList());
1424 if (inspectedACs.size() > 1) {
1425 myAttributesEditorParent->getFrameParent()->myViewNet->getUndoList()->end();
1427 myAttributesEditorParent->getFrameParent()->myViewNet->getUndoList()->end();
1430 if (myACAttr.isVClasses()) {
1431 myValueTextField->setTextColor(FXRGB(0, 0, 0));
1432 myValueTextField->killFocus();
1434 myAttributesEditorParent->refreshAttributeEditor(
false,
false);
1435 }
else if (myACAttr.isDiscrete()) {
1436 myValueComboBoxChoices->setTextColor(FXRGB(0, 0, 0));
1437 myValueComboBoxChoices->killFocus();
1438 }
else if (myValueTextField !=
nullptr) {
1439 myValueTextField->setTextColor(FXRGB(0, 0, 0));
1440 myValueTextField->killFocus();
1443 myAttributesEditorParent->getFrameParent()->attributeUpdated();
1447 if (myACAttr.isVClasses()) {
1448 myValueTextField->setTextColor(FXRGB(255, 0, 0));
1449 myValueTextField->killFocus();
1450 }
else if (myACAttr.isDiscrete()) {
1451 myValueComboBoxChoices->setTextColor(FXRGB(255, 0, 0));
1452 myValueComboBoxChoices->killFocus();
1453 }
else if (myValueTextField !=
nullptr) {
1454 myValueTextField->setTextColor(FXRGB(255, 0, 0));
1457 WRITE_DEBUG(
"Value '" + newVal +
"' for attribute " + myACAttr.getAttrStr() +
" of " + myACAttr.getTagPropertyParent().getTagStr() +
" isn't valid");
1465 const auto& ACs = myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
1467 GNEUndoList* undoList = myAttributesEditorParent->getFrameParent()->myViewNet->getUndoList();
1469 if (myAttributeCheckButton->getCheck()) {
1471 myValueCheckButton->enable();
1472 myValueTextField->enable();
1474 undoList->
begin(ACs.front()->getTagProperty().getGUIIcon(),
"enable attribute '" + myACAttr.getAttrStr() +
"'");
1475 ACs.front()->enableAttribute(myACAttr.getAttr(), undoList);
1479 myValueCheckButton->disable();
1480 myValueTextField->disable();
1482 undoList->
begin(ACs.front()->getTagProperty().getGUIIcon(),
"disable attribute '" + myACAttr.getAttrStr() +
"'");
1483 ACs.front()->disableAttribute(myACAttr.getAttr(), undoList);
1491 myAttributesEditorParent(nullptr),
1498 std::string result(stringValue);
1499 while (result.find(
", ") != std::string::npos) {
1513 const Position newPosition = GNEAttributeCarrier::parse<Position>(newVal);
1515 for (
const auto& junction : myAttributesEditorParent->getFrameParent()->getViewNet()->getNet()->getAttributeCarriers()->getJunctions()) {
1517 if ((junction.second->getPositionInView().distanceTo2D(newPosition) <
POSITION_EPS) &&
1518 myAttributesEditorParent->getFrameParent()->getViewNet()->mergeJunctions(movedJunction, junction.second)) {
1533 myFrameParent(FrameParent),
1534 myIncludeExtended(true) {
1548 myIncludeExtended = includeExtended;
1550 for (
auto& row : myAttributesEditorRows) {
1552 if (row !=
nullptr) {
1559 const auto& ACs = myFrameParent->getViewNet()->getInspectedAttributeCarriers();
1561 bool showFlowEditor =
false;
1562 if (ACs.size() > 0) {
1564 for (
const auto& attrProperty : ACs.front()->getTagProperty()) {
1566 bool editAttribute =
true;
1568 if ((ACs.size() > 1) && attrProperty.isUnique()) {
1569 editAttribute =
false;
1572 if (attrProperty.isExtended() && !includeExtended) {
1573 editAttribute =
false;
1576 if (attrProperty.isFlowDefinition()) {
1577 editAttribute =
false;
1578 showFlowEditor =
true;
1581 if (editAttribute) {
1583 std::set<std::string> occuringValues;
1585 for (
const auto& inspectedAC : ACs) {
1586 occuringValues.insert(inspectedAC->getAttribute(attrProperty.getAttr()));
1589 std::ostringstream oss;
1590 for (
auto values = occuringValues.begin(); values != occuringValues.end(); values++) {
1591 if (values != occuringValues.begin()) {
1597 std::string value = oss.str();
1599 bool attributeEnabled = ACs.front()->isAttributeEnabled(attrProperty.getAttr());
1601 if (attributeEnabled ==
false) {
1602 value = ACs.front()->getAlternativeValueForDisabledAttributes(attrProperty.getAttr());
1605 if (ACs.front()->getTagProperty().isStop() || ACs.front()->getTagProperty().isStopPerson()) {
1607 attributeEnabled =
false;
1609 attributeEnabled =
false;
1613 if (forceAttributeEnabled && (attrProperty.getAttr() !=
SUMO_ATTR_ID)) {
1614 attributeEnabled =
true;
1617 const bool computed = (ACs.size() > 1) ?
false : ACs.front()->isAttributeComputed(attrProperty.getAttr());
1619 myAttributesEditorRows[attrProperty.getPositionListed()] =
new AttributesEditorRow(
this, attrProperty, value, attributeEnabled, computed);
1623 if (showFlowEditor) {
1624 myAttributesEditorFlow->showAttributeEditorFlowModul();
1626 myAttributesEditorFlow->hideAttributesEditorFlowModul();
1631 myAttributesEditorFlow->hideAttributesEditorFlowModul();
1634 myHelpButton->reparent(
this);
1641 myAttributesEditorFlow->hideAttributesEditorFlowModul();
1650 const auto& ACs = myFrameParent->getViewNet()->getInspectedAttributeCarriers();
1652 if (ACs.size() > 0) {
1654 for (
const auto& attrProperty : ACs.front()->getTagProperty()) {
1656 bool editAttribute =
true;
1658 if ((ACs.size() > 1) && attrProperty.isUnique()) {
1659 editAttribute =
false;
1662 if (attrProperty.isExtended() && !myIncludeExtended) {
1663 editAttribute =
false;
1666 if (attrProperty.isFlowDefinition()) {
1667 editAttribute =
false;
1670 if (editAttribute) {
1672 std::set<std::string> occuringValues;
1674 for (
const auto& inspectedAC : ACs) {
1675 occuringValues.insert(inspectedAC->getAttribute(attrProperty.getAttr()));
1678 std::ostringstream oss;
1679 for (
auto values = occuringValues.begin(); values != occuringValues.end(); values++) {
1680 if (values != occuringValues.begin()) {
1686 std::string value = oss.str();
1688 bool attributeEnabled = ACs.front()->isAttributeEnabled(attrProperty.getAttr());
1690 if (attributeEnabled ==
false) {
1691 value = ACs.front()->getAlternativeValueForDisabledAttributes(attrProperty.getAttr());
1694 if (ACs.front()->getTagProperty().isStop() || ACs.front()->getTagProperty().isStopPerson()) {
1696 attributeEnabled =
false;
1698 attributeEnabled =
false;
1702 const bool computed = (ACs.size() > 1) ?
false : ACs.front()->isAttributeComputed(attrProperty.getAttr());
1704 if ((attrProperty.getAttr() ==
SUMO_ATTR_SHAPE) && forceRefreshShape) {
1705 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value,
true, attributeEnabled, computed);
1708 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value,
true, attributeEnabled, computed);
1711 myAttributesEditorRows[attrProperty.getPositionListed()]->refreshAttributesEditorRow(value,
false, attributeEnabled, computed);
1716 if (myAttributesEditorFlow->isAttributesEditorFlowModulShown()) {
1717 myAttributesEditorFlow->refreshAttributeEditorFlow();
1725 return myFrameParent;
1732 if (myFrameParent->getViewNet()->getInspectedAttributeCarriers().size() > 0) {
1734 myFrameParent->openHelpAttributesDialog(myFrameParent->getViewNet()->getInspectedAttributeCarriers().front());
1744 FXGroupBoxModule(attributesEditorParent->getFrameParent()->myContentFrame,
"Flow attributes"),
1745 myAttributesEditorParent(attributesEditorParent) {
1747 FXHorizontalFrame* auxiliarHorizontalFrame =
nullptr;
1773 if (myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() > 0) {
1775 refreshAttributeEditorFlow();
1799 if (myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() > 0) {
1803 refreshVehsPerHour();
1805 refreshProbability();
1812 const auto& ACs = myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
1814 GNEUndoList* undoList = myAttributesEditorParent->getFrameParent()->myViewNet->getUndoList();
1818 if (obj == myValueEndTextField) {
1820 value = myValueEndTextField->getText().text();
1821 }
else if (obj == myValueNumberTextField) {
1823 value = myValueNumberTextField->getText().text();
1824 }
else if (obj == myValueVehsPerHourTextField) {
1831 value = myValueVehsPerHourTextField->getText().text();
1832 }
else if (obj == myValuePeriodTextField) {
1834 value = myValuePeriodTextField->getText().text();
1835 }
else if (obj == myValueProbabilityTextField) {
1837 value = myValueProbabilityTextField->getText().text();
1844 if (ACs.size() > 1) {
1845 undoList->
begin(ACs.front()->getTagProperty().getGUIIcon(),
"Change multiple " +
toString(attr) +
" attributes");
1848 for (
const auto& inspectedAC : ACs) {
1849 inspectedAC->setAttribute(attr, value, undoList);
1852 if (ACs.size() > 1) {
1856 refreshAttributeEditorFlow();
1863 const auto& ACs = myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers();
1865 GNEUndoList* undoList = myAttributesEditorParent->getFrameParent()->myViewNet->getUndoList();
1868 if (obj == myAttributeEndRadioButton) {
1870 }
else if (obj == myAttributeNumberRadioButton) {
1872 }
else if (obj == myAttributeVehsPerHourRadioButton) {
1874 }
else if (obj == myAttributePeriodRadioButton) {
1876 }
else if (obj == myAttributeProbabilityRadioButton) {
1884 if (ACs.size() > 1) {
1885 undoList->
begin(ACs.front()->getTagProperty().getGUIIcon(),
"enable multiple " +
toString(attr) +
" attributes");
1887 undoList->
begin(ACs.front()->getTagProperty().getGUIIcon(),
"enable attribute '" +
toString(attr) +
"'");
1890 for (
const auto& inspectedAC : ACs) {
1891 inspectedAC->enableAttribute(attr, undoList);
1896 refreshAttributeEditorFlow();
1904 int allAttributesEnabledOrDisabled = 0;
1905 for (
const auto& inspectedAC : myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers()) {
1906 allAttributesEnabledOrDisabled += inspectedAC->isAttributeEnabled(
SUMO_ATTR_END);
1908 if (allAttributesEnabledOrDisabled == (
int)myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size()) {
1910 std::set<std::string> occuringValues;
1911 for (
const auto& values : myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers()) {
1915 std::ostringstream endValue;
1916 for (
const auto& occuringValue : occuringValues) {
1917 if (occuringValue != *occuringValues.begin()) {
1920 endValue << occuringValue;
1923 myValueEndTextField->enable();
1924 myValueEndTextField->setText(endValue.str().c_str());
1925 myAttributeEndRadioButton->setCheck(TRUE);
1928 myValueEndTextField->disable();
1930 if ((allAttributesEnabledOrDisabled > 0) && (myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() > 1)) {
1931 myValueEndTextField->setText(
"Different flow attributes");
1932 }
else if (myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() == 1) {
1933 myValueEndTextField->setText(myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getAlternativeValueForDisabledAttributes(
SUMO_ATTR_END).c_str());
1935 myValueEndTextField->setText(
"");
1937 myAttributeEndRadioButton->setCheck(FALSE);
1945 int allAttributesEnabledOrDisabled = 0;
1946 for (
const auto& inspectedAC : myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers()) {
1947 allAttributesEnabledOrDisabled += inspectedAC->isAttributeEnabled(
SUMO_ATTR_NUMBER);
1949 if (allAttributesEnabledOrDisabled == (
int)myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size()) {
1951 std::set<std::string> occuringValues;
1952 for (
const auto& inspectedAC : myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers()) {
1956 std::ostringstream numberValues;
1957 for (
const auto& occuringValue : occuringValues) {
1958 if (occuringValue != *occuringValues.begin()) {
1959 numberValues <<
" ";
1961 numberValues << occuringValue;
1964 myValueNumberTextField->enable();
1965 myValueNumberTextField->setText(numberValues.str().c_str());
1966 myAttributeNumberRadioButton->setCheck(TRUE);
1969 myValueNumberTextField->disable();
1971 if ((allAttributesEnabledOrDisabled > 0) && (myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() > 1)) {
1972 myValueNumberTextField->setText(
"Different flow attributes");
1973 }
else if (myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() == 1) {
1974 myValueNumberTextField->setText(myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getAlternativeValueForDisabledAttributes(
SUMO_ATTR_NUMBER).c_str());
1976 myValueNumberTextField->setText(
"");
1978 myAttributeNumberRadioButton->setCheck(FALSE);
1988 if (myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getTagProperty().hasAttribute(
SUMO_ATTR_PERSONSPERHOUR)) {
1992 myAttributeVehsPerHourRadioButton->setText(
toString(attr).c_str());
1994 int allAttributesEnabledOrDisabled = 0;
1995 for (
const auto& inspectedAC : myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers()) {
1996 allAttributesEnabledOrDisabled += inspectedAC->isAttributeEnabled(attr);
1998 if (allAttributesEnabledOrDisabled == (
int)myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size()) {
2000 std::set<std::string> occuringValues;
2001 for (
const auto& inspectedAC : myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers()) {
2002 occuringValues.insert(inspectedAC->getAttribute(attr));
2005 std::ostringstream vehsPerHourValues;
2006 for (
const auto& occuringValue : occuringValues) {
2007 if (occuringValue != *occuringValues.begin()) {
2008 vehsPerHourValues <<
" ";
2010 vehsPerHourValues << occuringValue;
2013 myValueVehsPerHourTextField->enable();
2014 myValueVehsPerHourTextField->setText(vehsPerHourValues.str().c_str());
2015 myAttributeVehsPerHourRadioButton->setCheck(TRUE);
2018 myValueVehsPerHourTextField->disable();
2020 if ((allAttributesEnabledOrDisabled > 0) && (myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() > 1)) {
2021 myValueVehsPerHourTextField->setText(
"Different flow attributes");
2022 }
else if (myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() == 1) {
2023 myValueVehsPerHourTextField->setText(myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getAlternativeValueForDisabledAttributes(attr).c_str());
2025 myValueVehsPerHourTextField->setText(
"");
2027 myAttributeVehsPerHourRadioButton->setCheck(FALSE);
2035 int allAttributesEnabledOrDisabled = 0;
2036 for (
const auto& inspectedAC : myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers()) {
2037 allAttributesEnabledOrDisabled += inspectedAC->isAttributeEnabled(
SUMO_ATTR_PERIOD);
2039 if (allAttributesEnabledOrDisabled == (
int)myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size()) {
2041 std::set<std::string> occuringValues;
2042 for (
const auto& inspectedAC : myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers()) {
2046 std::ostringstream periodValues;
2047 for (
const auto& occuringValue : occuringValues) {
2048 if (occuringValue != *occuringValues.begin()) {
2049 periodValues <<
" ";
2051 periodValues << occuringValue;
2054 myValuePeriodTextField->enable();
2055 myValuePeriodTextField->setText(periodValues.str().c_str());
2056 myAttributePeriodRadioButton->setCheck(TRUE);
2059 myValuePeriodTextField->disable();
2061 if ((allAttributesEnabledOrDisabled > 0) && (myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() > 1)) {
2062 myValuePeriodTextField->setText(
"Different flow attributes");
2063 }
else if (myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() == 1) {
2064 myValuePeriodTextField->setText(myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getAlternativeValueForDisabledAttributes(
SUMO_ATTR_PERIOD).c_str());
2066 myValuePeriodTextField->setText(
"");
2068 myAttributePeriodRadioButton->setCheck(FALSE);
2076 int allAttributesEnabledOrDisabled = 0;
2077 for (
const auto& inspectedAC : myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers()) {
2078 allAttributesEnabledOrDisabled += inspectedAC->isAttributeEnabled(
SUMO_ATTR_PROB);
2080 if (allAttributesEnabledOrDisabled == (
int)myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size()) {
2082 std::set<std::string> occuringValues;
2083 for (
const auto& inspectedAC : myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers()) {
2084 occuringValues.insert(inspectedAC->getAttribute(
SUMO_ATTR_PROB));
2087 std::ostringstream probabilityValues;
2088 for (
const auto& occuringValue : occuringValues) {
2089 if (occuringValue != *occuringValues.begin()) {
2090 probabilityValues <<
" ";
2092 probabilityValues << occuringValue;
2095 myValueProbabilityTextField->enable();
2096 myValueProbabilityTextField->setText(probabilityValues.str().c_str());
2097 myAttributeProbabilityRadioButton->enable();
2098 myAttributeProbabilityRadioButton->setCheck(TRUE);
2101 myValueProbabilityTextField->disable();
2103 if ((allAttributesEnabledOrDisabled > 0) && (myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() > 1)) {
2104 myValueProbabilityTextField->setText(
"Different flow attributes");
2105 }
else if (myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().size() == 1) {
2106 myValueProbabilityTextField->setText(myAttributesEditorParent->getFrameParent()->getViewNet()->getInspectedAttributeCarriers().front()->getAlternativeValueForDisabledAttributes(
SUMO_ATTR_PROB).c_str());
2108 myValueProbabilityTextField->setText(
"");
2110 myAttributeProbabilityRadioButton->setCheck(FALSE);
2120 myFrameParent(frameParent) {
2144 myFrameParent->attributesEditorExtendedDialogOpened();
2154 myFrameParent(frameParent) {
2167 refreshParametersEditorCreator();
2182 myTextFieldParameters->setText(getParametersStr().c_str());
2183 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
2187 const std::map<std::string, std::string>&
2189 return myParameters;
2197 for (
const auto& parameter : myParameters) {
2198 result += parameter.first +
"=" + parameter.second +
"|";
2201 if (!result.empty()) {
2208 std::vector<std::pair<std::string, std::string> >
2210 std::vector<std::pair<std::string, std::string> > result;
2212 for (
const auto& parameter : myParameters) {
2213 result.push_back(std::make_pair(parameter.first, parameter.second));
2224 for (
const auto& parameter : parameters) {
2225 result += parameter.first +
"=" + parameter.second +
"|";
2228 if (!result.empty()) {
2232 myTextFieldParameters->setText(result.c_str(), TRUE);
2238 return myFrameParent;
2250 refreshParametersEditorCreator();
2262 myParameters.clear();
2266 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
2267 myTextFieldParameters->killFocus();
2269 std::vector<std::string> parameters =
StringTokenizer(myTextFieldParameters->getText().text(),
"|",
true).
getVector();
2271 for (
const auto& parameter : parameters) {
2275 myParameters[keyParam.front()] = keyParam.back();
2278 myTextFieldParameters->setText(getParametersStr().c_str(), FALSE);
2280 myTextFieldParameters->setTextColor(FXRGB(255, 0, 0));
2291 myFrameParent(frameParent),
2292 myDeleteLastCreatedPoint(false) {
2298 std::ostringstream information;
2300 <<
"- 'Start drawing' or ENTER\n"
2301 <<
" draws shape boundary.\n"
2302 <<
"- 'Stop drawing' or ENTER\n"
2303 <<
" creates shape.\n"
2304 <<
"- 'Shift + Click'removes\n"
2305 <<
" last created point.\n"
2306 <<
"- 'Abort drawing' or ESC\n"
2307 <<
" removes drawed shape.";
2322 FXGroupBoxModule::show();
2330 FXGroupBoxModule::hide();
2339 myStartDrawingButton->disable();
2340 myStopDrawingButton->enable();
2341 myAbortDrawingButton->enable();
2349 if (myFrameParent->shapeDrawed()) {
2351 myTemporalShapeShape.clear();
2352 myFrameParent->myViewNet->updateViewNet();
2354 myStartDrawingButton->enable();
2355 myStopDrawingButton->disable();
2356 myAbortDrawingButton->disable();
2367 myTemporalShapeShape.clear();
2368 myFrameParent->myViewNet->updateViewNet();
2370 myStartDrawingButton->enable();
2371 myStopDrawingButton->disable();
2372 myAbortDrawingButton->disable();
2378 if (myStopDrawingButton->isEnabled()) {
2379 myTemporalShapeShape.push_back(P);
2381 throw ProcessError(
"A new point cannot be added if drawing wasn't started");
2394 return myTemporalShapeShape;
2400 return myStopDrawingButton->isEnabled();
2406 myDeleteLastCreatedPoint = value;
2412 return myDeleteLastCreatedPoint;
2442 myFrameParent(frameParent),
2443 myCurrentLengthValid(true),
2477 bool showFrame =
false;
2480 myLengthFrame->show();
2481 myReferencePointMatchBox->show();
2484 myLengthFrame->hide();
2485 myReferencePointMatchBox->hide();
2489 myCloseShapeFrame->show();
2492 myCloseShapeFrame->hide();
2496 myCenterViewAfterCreationFrame->show();
2499 myCenterViewAfterCreationFrame->hide();
2520 if (myReferencePointMatchBox->shown()) {
2522 if (lane ==
nullptr) {
2524 }
else if (myCurrentLengthValid) {
2528 if (myActualAdditionalReferencePoint == AdditionalReferencePoint::INVALID) {
2529 std::string errorMessage =
"Current selected reference point isn't valid";
2530 myFrameParent->myViewNet->setStatusBarText(errorMessage);
2536 double length = GNEAttributeCarrier::parse<double>(myLengthTextField->getText().text());
2546 if (myCloseShapeCheckButton->shown()) {
2550 if (myCenterViewAfterCreationButton->shown()) {
2560 if (obj == myCloseShapeCheckButton) {
2561 if (myCloseShapeCheckButton->getCheck()) {
2562 myCloseShapeCheckButton->setText(
"true");
2564 myCloseShapeCheckButton->setText(
"false");
2566 }
else if (obj == myCenterViewAfterCreationButton) {
2567 if (myCenterViewAfterCreationButton->getCheck()) {
2568 myCenterViewAfterCreationButton->setText(
"true");
2570 myCenterViewAfterCreationButton->setText(
"false");
2572 }
else if (obj == myLengthTextField) {
2574 if (GNEAttributeCarrier::canParse<double>(myLengthTextField->getText().text()) &&
2575 GNEAttributeCarrier::parse<double>(myLengthTextField->getText().text()) > 0) {
2576 myLengthTextField->setTextColor(FXRGB(0, 0, 0));
2577 myLengthTextField->killFocus();
2578 myCurrentLengthValid =
true;
2580 myLengthTextField->setTextColor(FXRGB(255, 0, 0));
2581 myCurrentLengthValid =
false;
2585 }
else if (obj == myReferencePointMatchBox) {
2587 if (myReferencePointMatchBox->getText() ==
"reference left") {
2588 myReferencePointMatchBox->setTextColor(FXRGB(0, 0, 0));
2589 myActualAdditionalReferencePoint = AdditionalReferencePoint::LEFT;
2590 myLengthTextField->enable();
2591 }
else if (myReferencePointMatchBox->getText() ==
"reference right") {
2592 myReferencePointMatchBox->setTextColor(FXRGB(0, 0, 0));
2593 myActualAdditionalReferencePoint = AdditionalReferencePoint::RIGHT;
2594 myLengthTextField->enable();
2595 }
else if (myReferencePointMatchBox->getText() ==
"reference center") {
2596 myLengthTextField->enable();
2597 myReferencePointMatchBox->setTextColor(FXRGB(0, 0, 0));
2598 myActualAdditionalReferencePoint = AdditionalReferencePoint::CENTER;
2599 myLengthTextField->enable();
2601 myReferencePointMatchBox->setTextColor(FXRGB(255, 0, 0));
2602 myActualAdditionalReferencePoint = AdditionalReferencePoint::INVALID;
2603 myLengthTextField->disable();
2614 FXDialogBox* additionalNeteditAttributesHelpDialog =
new FXDialogBox(getCollapsableFrame(),
"Netedit Parameters Help",
GUIDesignDialogBox);
2617 std::ostringstream help;
2619 <<
"- Referece point: Mark the initial position of the additional element.\n"
2620 <<
" Example: If you want to create a busStop with a length of 30 in the point 100 of the lane:\n"
2621 <<
" - Reference Left will create it with startPos = 70 and endPos = 100.\n"
2622 <<
" - Reference Right will create it with startPos = 100 and endPos = 130.\n"
2623 <<
" - Reference Center will create it with startPos = 85 and endPos = 115.\n"
2625 <<
"- Block movement: if is enabled, the created additional element will be blocked. i.e. cannot be moved with\n"
2626 <<
" the mouse. This option can be modified inspecting element.\n"
2627 <<
"- Center view: if is enabled, view will be center over created element.";
2639 WRITE_DEBUG(
"Opening NeteditAttributes help dialog");
2641 additionalNeteditAttributesHelpDialog->create();
2643 additionalNeteditAttributesHelpDialog->show(PLACEMENT_CURSOR);
2645 getApp()->refresh();
2647 getApp()->runModalFor(additionalNeteditAttributesHelpDialog);
2649 WRITE_DEBUG(
"Closing NeteditAttributes help dialog");
2668 switch (myActualAdditionalReferencePoint) {
2669 case AdditionalReferencePoint::LEFT:
2670 return positionOfTheMouseOverLane;
2671 case AdditionalReferencePoint::RIGHT:
2672 return positionOfTheMouseOverLane - lengthOfAdditional;
2673 case AdditionalReferencePoint::CENTER:
2674 return positionOfTheMouseOverLane - lengthOfAdditional / 2;
2683 switch (myActualAdditionalReferencePoint) {
2684 case AdditionalReferencePoint::LEFT:
2685 return positionOfTheMouseOverLane + lengthOfAdditional;
2686 case AdditionalReferencePoint::RIGHT:
2687 return positionOfTheMouseOverLane;
2688 case AdditionalReferencePoint::CENTER:
2689 return positionOfTheMouseOverLane + lengthOfAdditional / 2;