118 myAttributesCreatorParent(AttributesCreatorParent),
119 myAttrProperties(attrProperties) {
122 myAttributeLabel->hide();
124 myAttributeCheckButton->hide();
126 myAttributeColorButton->hide();
129 myValueTextField->hide();
131 myValueCheckButton->hide();
133 if ((attrProperties.getTagPropertyParent().isStop() || attrProperties.getTagPropertyParent().isPersonStop()) && (attrProperties.getAttr() ==
SUMO_ATTR_UNTIL)) {
134 myAttributeCheckButton->setCheck(FALSE);
136 myAttributeCheckButton->setCheck(TRUE);
139 if (getParent()->
id()) {
141 FXHorizontalFrame::create();
147 myAttributeCheckButton->setText(myAttrProperties.getAttrStr().c_str());
148 myAttributeCheckButton->setCheck(
false);
149 myAttributeCheckButton->show();
151 myValueTextField->setTextColor(FXRGB(0, 0, 0));
152 myValueTextField->disable();
154 myValueTextField->setText(generateID().c_str());
156 myValueTextField->show();
159 if (myAttrProperties.isColor()) {
160 myAttributeColorButton->setTextColor(FXRGB(0, 0, 0));
161 myAttributeColorButton->setText(myAttrProperties.getAttrStr().c_str());
162 myAttributeColorButton->show();
163 }
else if (myAttrProperties.isActivatable()) {
164 myAttributeCheckButton->setText(myAttrProperties.getAttrStr().c_str());
165 myAttributeCheckButton->show();
167 if ((myAttrProperties.getTagPropertyParent().isStop() || myAttrProperties.getTagPropertyParent().isPersonStop()) &&
170 myAttributeCheckButton->setCheck(FALSE);
172 myAttributeCheckButton->setCheck(TRUE);
175 myAttributeLabel->setText(myAttrProperties.getAttrStr().c_str());
176 myAttributeLabel->show();
178 if (myAttrProperties.isBool()) {
179 if (GNEAttributeCarrier::parse<bool>(attrProperties.getDefaultValue())) {
180 myValueCheckButton->setCheck(
true);
181 myValueCheckButton->setText(
"true");
183 myValueCheckButton->setCheck(
false);
184 myValueCheckButton->setText(
"false");
186 myValueCheckButton->show();
188 if (myAttributeCheckButton->shown() && (myAttributeCheckButton->getCheck() == FALSE)) {
189 myValueCheckButton->disable();
192 myValueTextField->setTextColor(FXRGB(0, 0, 0));
193 myValueTextField->setText(attrProperties.getDefaultValue().c_str());
194 myValueTextField->show();
196 if (myAttributeCheckButton->shown() && (myAttributeCheckButton->getCheck() == FALSE)) {
197 myValueTextField->disable();
210 if (getParent()->
id()) {
211 FXHorizontalFrame::destroy();
218 return myAttrProperties;
224 if (myAttrProperties.isBool()) {
225 return (myValueCheckButton->getCheck() == 1) ?
"1" :
"0";
227 return myValueTextField->getText().text();
235 return myAttributeCheckButton->getCheck() == TRUE;
246 myAttributeCheckButton->setCheck(value);
249 if (myAttrProperties.isBool()) {
250 myValueCheckButton->enable();
252 myValueTextField->enable();
255 if (myAttrProperties.isBool()) {
256 myValueCheckButton->disable();
258 myValueTextField->disable();
267 if (myAttrProperties.isBool()) {
268 return myValueCheckButton->enable();
270 return myValueTextField->enable();
277 if (myAttrProperties.isBool()) {
278 return myValueCheckButton->disable();
280 return myValueTextField->disable();
289 }
else if (myAttrProperties.isBool()) {
290 return myValueCheckButton->isEnabled();
292 return myValueTextField->isEnabled();
301 myValueTextField->setText(generateID().c_str());
308 return myInvalidValue;
314 return myAttributesCreatorParent;
323 if (obj == myValueCheckButton) {
324 if (myValueCheckButton->getCheck()) {
325 myValueCheckButton->setText(
"true");
327 myValueCheckButton->setText(
"false");
329 }
else if (myAttrProperties.isComplex()) {
331 myInvalidValue = checkComplexAttribute(myValueTextField->getText().text());
332 }
else if (myAttrProperties.isInt()) {
334 if (GNEAttributeCarrier::canParse<double>(myValueTextField->getText().text())) {
336 double parsedDouble = GNEAttributeCarrier::parse<double>(myValueTextField->getText().text());
338 if ((parsedDouble - (
int)parsedDouble) == 0) {
339 myValueTextField->setText(
toString((
int)parsedDouble).c_str(), FALSE);
341 if (myAttrProperties.isPositive() && (parsedDouble < 0)) {
342 myInvalidValue =
"'" + myAttrProperties.getAttrStr() +
"' cannot be negative";
345 myInvalidValue =
"'" + myAttrProperties.getAttrStr() +
"' doesn't have a valid 'int' format";
348 myInvalidValue =
"'" + myAttrProperties.getAttrStr() +
"' doesn't have a valid 'int' format";
352 if (GNEAttributeCarrier::canParse<double>(myValueTextField->getText().text())) {
354 double angle = GNEAttributeCarrier::parse<double>(myValueTextField->getText().text());
356 if ((angle < 0) || (angle > 360)) {
358 angle = fmod(angle, 360);
361 myValueTextField->setText(
toString(angle).c_str(), FALSE);
363 myInvalidValue =
"'" + myAttrProperties.getAttrStr() +
"' doesn't have a valid 'float' format between [0, 360]";
365 }
else if (myAttrProperties.isSUMOTime()) {
367 if (!GNEAttributeCarrier::canParse<SUMOTime>(myValueTextField->getText().text())) {
368 myInvalidValue =
"'" + myAttrProperties.getAttrStr() +
"' doesn't have a valid SUMOTime format";
370 }
else if (myAttrProperties.isFloat()) {
371 if (GNEAttributeCarrier::canParse<double>(myValueTextField->getText().text())) {
373 double doubleValue = GNEAttributeCarrier::parse<double>(myValueTextField->getText().text());
375 if (myAttrProperties.isPositive() && (doubleValue < 0)) {
376 myInvalidValue =
"'" + myAttrProperties.getAttrStr() +
"' cannot be negative";
378 }
else if (myAttrProperties.isProbability() && ((doubleValue < 0) || doubleValue > 1)) {
379 myInvalidValue =
"'" + myAttrProperties.getAttrStr() +
"' takes only values between 0 and 1";
380 }
else if (myAttrProperties.hasAttrRange() && ((doubleValue < myAttrProperties.getMinimumRange()) || doubleValue > myAttrProperties.getMaximumRange())) {
381 myInvalidValue =
"'" + myAttrProperties.getAttrStr() +
"' takes only values between " +
toString(myAttrProperties.getMinimumRange()) +
" and " +
toString(myAttrProperties.getMaximumRange());
382 }
else if ((myAttributesCreatorParent->getCurrentTagProperties().getTag() ==
SUMO_TAG_E2DETECTOR) && (myAttrProperties.getAttr() ==
SUMO_ATTR_LENGTH) && (doubleValue == 0)) {
383 myInvalidValue =
"E2 length cannot be 0";
386 myInvalidValue =
"'" + myAttrProperties.getAttrStr() +
"' doesn't have a valid 'float' format";
388 }
else if (myAttrProperties.isColor()) {
390 if (GNEAttributeCarrier::canParse<RGBColor>(myValueTextField->getText().text()) ==
false) {
391 myInvalidValue =
"'" + myAttrProperties.getAttrStr() +
"' doesn't have a valid 'RBGColor' format";
393 }
else if (myAttrProperties.isFilename()) {
394 const std::string file = myValueTextField->getText().text();
397 myInvalidValue =
"input contains invalid characters for a filename";
402 myInvalidValue =
"doesn't exist image '" + file +
"'";
407 const std::string name = myValueTextField->getText().text();
410 myInvalidValue =
"input contains invalid characters";
413 const std::string types = myValueTextField->getText().text();
416 myInvalidValue =
"list of IDs contains invalid characters";
420 const std::string index = myValueTextField->getText().text();
421 if ((index !=
"fit") && (index !=
"end") && !GNEAttributeCarrier::canParse<int>(index)) {
422 myInvalidValue =
"index isn't either 'fit' or 'end' or a valid positive int";
423 }
else if (GNEAttributeCarrier::canParse<int>(index) && (GNEAttributeCarrier::parse<int>(index) < 0)) {
424 myInvalidValue =
"index cannot be negative";
428 std::vector<std::string> vehicleIDs = GNEAttributeCarrier::parse<std::vector<std::string> >(myValueTextField->getText().text());
430 for (
const auto& i : vehicleIDs) {
432 myInvalidValue =
"invalid id used in " + myAttrProperties.getAttrStr();
437 myInvalidValue =
"invalid id used in " + myAttrProperties.getAttrStr();
439 }
else if (myAttrProperties.getAttr() ==
SUMO_ATTR_ID) {
442 myInvalidValue =
"invalid id used in " + myAttrProperties.getAttrStr();
444 myInvalidValue =
"invalid id used in " + myAttrProperties.getAttrStr();
446 myInvalidValue =
"invalid id used in " + myAttrProperties.getAttrStr();
448 myInvalidValue =
"invalid id used in " + myAttrProperties.getAttrStr();
450 myInvalidValue =
"invalid id used in " + myAttrProperties.getAttrStr();
454 if (myInvalidValue.size() == 0) {
455 myValueTextField->setTextColor(FXRGB(0, 0, 0));
456 myValueTextField->killFocus();
459 myValueTextField->setTextColor(FXRGB(255, 0, 0));
469 if (myAttributeCheckButton->getCheck()) {
471 myValueCheckButton->enable();
472 myValueTextField->enable();
477 myValueCheckButton->disable();
478 myValueTextField->disable();
487 FXColorDialog colordialog(
this, tr(
"Color Dialog"));
488 colordialog.setTarget(
this);
490 if (GNEAttributeCarrier::canParse<RGBColor>(myValueTextField->getText().text())) {
496 if (colordialog.execute()) {
498 onCmdSetAttribute(
nullptr, 0,
nullptr);
507 std::string errorMessage;
522 switch (myAttrProperties.getAttr()) {
564 if (myAttrProperties.getTagPropertyParent().isShape()) {
565 return myAttributesCreatorParent->getFrameParent()->getViewNet()->getNet()->generateShapeID(myAttrProperties.getTagPropertyParent().getTag());
566 }
else if (myAttrProperties.getTagPropertyParent().isAdditional()) {
567 return myAttributesCreatorParent->getFrameParent()->getViewNet()->getNet()->generateAdditionalID(myAttrProperties.getTagPropertyParent().getTag());
568 }
else if (myAttrProperties.getTagPropertyParent().isDemandElement()) {
569 return myAttributesCreatorParent->getFrameParent()->getViewNet()->getNet()->generateDemandElementID(
"", myAttrProperties.getTagPropertyParent().getTag());
578 return (myAttributesCreatorParent->getFrameParent()->getViewNet()->getNet()->retrieveAdditional(
579 myAttrProperties.getTagPropertyParent().getTag(),
580 myValueTextField->getText().text(),
false) ==
nullptr);
589 myFrameParent(frameParent) {
605 myTagProperties = tagProperties;
607 for (
int i = 0; i < (int)myAttributesCreatorRows.size(); i++) {
609 if (myAttributesCreatorRows.at(i) !=
nullptr) {
610 myAttributesCreatorRows.at(i)->destroy();
611 delete myAttributesCreatorRows.at(i);
612 myAttributesCreatorRows.at(i) =
nullptr;
616 bool showFlowEditor =
false;
618 for (
const auto& i : myTagProperties) {
620 bool showAttribute =
true;
623 showAttribute =
false;
626 if (std::find(hiddenAttributes.begin(), hiddenAttributes.end(), i.getAttr()) != hiddenAttributes.end()) {
627 showAttribute =
false;
630 if (i.isFlowDefinition()) {
631 showAttribute =
false;
632 showFlowEditor =
true;
636 showAttribute =
false;
644 myHelpButton->reparent(
this);
648 if (showFlowEditor) {
649 myAttributesCreatorFlow->showAttributesCreatorFlowModul();
651 myAttributesCreatorFlow->hideAttributesCreatorFlowModul();
666 return myFrameParent;
670 std::map<SumoXMLAttr, std::string>
672 std::map<SumoXMLAttr, std::string> values;
674 for (
int i = 0; i < (int)myAttributesCreatorRows.size(); i++) {
675 if (myAttributesCreatorRows.at(i) && myAttributesCreatorRows.at(i)->getAttrProperties().getAttr() !=
SUMO_ATTR_NOTHING) {
677 bool rowEnabled = myAttributesCreatorRows.at(i)->isAttributesCreatorRowEnabled();
679 bool hasDefaultStaticValue = !myAttributesCreatorRows.at(i)->getAttrProperties().hasStaticDefaultValue() || (myAttributesCreatorRows.at(i)->getAttrProperties().getDefaultValue() != myAttributesCreatorRows.at(i)->getValue());
681 bool isFlowDefinitionAttribute = myAttributesCreatorRows.at(i)->getAttrProperties().isFlowDefinition();
683 bool isActivatableAttribute = myAttributesCreatorRows.at(i)->getAttrProperties().isActivatable() && myAttributesCreatorRows.at(i)->getAttributeCheckButtonCheck();
685 if (rowEnabled && (includeAll || hasDefaultStaticValue || isFlowDefinitionAttribute || isActivatableAttribute)) {
686 values[myAttributesCreatorRows.at(i)->getAttrProperties().getAttr()] = myAttributesCreatorRows.at(i)->getValue();
691 myAttributesCreatorFlow->setFlowParameters(values);
699 return myTagProperties;
705 std::string errorMessage;
707 for (
const auto& i : myTagProperties) {
708 if (errorMessage.empty() && myAttributesCreatorRows.at(i.getPositionListed())) {
710 std::string attributeValue = myAttributesCreatorRows.at(i.getPositionListed())->isAttributeValid();
711 if (attributeValue.size() != 0) {
712 errorMessage = attributeValue;
717 if (extra.size() == 0) {
718 errorMessage =
"Invalid input parameter of " + myTagProperties.getTagStr() +
": " + errorMessage;
720 errorMessage =
"Invalid input parameter of " + myTagProperties.getTagStr() +
": " + extra;
724 myFrameParent->myViewNet->setStatusBarText(errorMessage);
733 for (
auto i : myTagProperties) {
735 if (myAttributesCreatorRows.at(i.getPositionListed()) && myAttributesCreatorRows.at(i.getPositionListed())->isAttributeValid().size() != 0) {
747 myAttributesCreatorRows[myTagProperties.getAttributeProperties(
SUMO_ATTR_ID).getPositionListed()]->refreshRow();
754 myFrameParent->openHelpAttributesDialog(myTagProperties);
763 FXGroupBox(attributesCreatorParent->getFrameParent()->myContentFrame,
"Flow attributes",
GUIDesignGroupBoxFrame),
764 myAttributesCreatorParent(attributesCreatorParent),
767 FXHorizontalFrame* auxiliarHorizontalFrame =
nullptr;
818 myAttributeEndRadioButton->setCheck(TRUE);
819 myValueEndTextField->enable();
821 myAttributeEndRadioButton->setCheck(FALSE);
822 myValueEndTextField->disable();
825 myAttributeNumberRadioButton->setCheck(TRUE);
826 myValueNumberTextField->enable();
828 myAttributeNumberRadioButton->setCheck(FALSE);
829 myValueNumberTextField->disable();
832 myAttributeVehsPerHourRadioButton->setCheck(TRUE);
833 myValueVehsPerHourTextField->enable();
835 myAttributeVehsPerHourRadioButton->setCheck(FALSE);
836 myValueVehsPerHourTextField->disable();
839 myAttributePeriodRadioButton->setCheck(TRUE);
840 myValuePeriodTextField->enable();
842 myAttributePeriodRadioButton->setCheck(FALSE);
843 myValuePeriodTextField->disable();
846 myAttributeProbabilityRadioButton->setCheck(TRUE);
847 myValueProbabilityTextField->enable();
849 myAttributeProbabilityRadioButton->setCheck(FALSE);
850 myValueProbabilityTextField->disable();
858 parameters[
SUMO_ATTR_END] = myValueEndTextField->getText().text();
870 parameters[
SUMO_ATTR_PROB] = myValueProbabilityTextField->getText().text();
877 std::string errorMessage;
897 myAttributesCreatorParent->getFrameParent()->myViewNet->setStatusBarText(errorMessage);
907 if (GNEAttributeCarrier::canParse<double>(myValueEndTextField->getText().text())) {
908 if (GNEAttributeCarrier::parse<double>(myValueEndTextField->getText().text()) < 0) {
916 if (GNEAttributeCarrier::canParse<double>(myValueNumberTextField->getText().text())) {
917 if (GNEAttributeCarrier::parse<double>(myValueNumberTextField->getText().text()) < 0) {
925 if (GNEAttributeCarrier::canParse<double>(myValueVehsPerHourTextField->getText().text())) {
926 if (GNEAttributeCarrier::parse<double>(myValueVehsPerHourTextField->getText().text()) < 0) {
934 if (GNEAttributeCarrier::canParse<double>(myValuePeriodTextField->getText().text())) {
935 if (GNEAttributeCarrier::parse<double>(myValuePeriodTextField->getText().text()) < 0) {
943 if (GNEAttributeCarrier::canParse<double>(myValueProbabilityTextField->getText().text())) {
944 if (GNEAttributeCarrier::parse<double>(myValueProbabilityTextField->getText().text()) < 0) {
958 FXTextField* textField =
nullptr;
960 if (obj == myValueEndTextField) {
961 textField = myValueEndTextField;
962 }
else if (obj == myValueNumberTextField) {
963 textField = myValueNumberTextField;
964 }
else if (obj == myValueVehsPerHourTextField) {
965 textField = myValueVehsPerHourTextField;
966 }
else if (obj == myValuePeriodTextField) {
967 textField = myValuePeriodTextField;
968 }
else if (obj == myValueProbabilityTextField) {
969 textField = myValueProbabilityTextField;
974 if (GNEAttributeCarrier::canParse<double>(textField->getText().text()) && (GNEAttributeCarrier::parse<double>(textField->getText().text()) >= 0)) {
975 textField->setTextColor(FXRGB(0, 0, 0));
977 textField->setTextColor(FXRGB(255, 0, 0));
979 textField->killFocus();
987 if (obj == myAttributeEndRadioButton) {
989 }
else if (obj == myAttributeNumberRadioButton) {
991 }
else if (obj == myAttributeVehsPerHourRadioButton) {
993 }
else if (obj == myAttributePeriodRadioButton) {
995 }
else if (obj == myAttributeProbabilityRadioButton) {
1001 refreshAttributesCreatorFlow();
1011 myAttributesEditorParent(attributeEditorParent),
1036 if (getParent()->
id()) {
1038 FXHorizontalFrame::create();
1040 if (attributeEnabled ==
false) {
1077 if (attributeEnabled) {
1090 bool allBooleanValuesEqual =
true;
1092 std::vector<bool> booleanVector;
1095 booleanVector = GNEAttributeCarrier::parse<std::vector<bool> >(value);
1098 for (
const auto& i : booleanVector) {
1099 if (i != booleanVector.front()) {
1100 allBooleanValuesEqual =
false;
1104 if (allBooleanValuesEqual) {
1106 if ((booleanVector.size() > 0) && booleanVector.front()) {
1165 if (getParent()->
id()) {
1166 FXHorizontalFrame::destroy();
1174 if (attributeEnabled ==
false) {
1175 myValueTextField->disable();
1176 myValueComboBoxChoices->disable();
1177 myValueCheckButton->disable();
1179 myValueTextField->enable();
1180 myValueComboBoxChoices->enable();
1181 myValueCheckButton->enable();
1185 if (((myAttributesEditorParent->getFrameParent()->myViewNet->getEditModes().currentSupermode ==
GNE_SUPERMODE_NETWORK) && myACAttr.getTagPropertyParent().isDemandElement()) ||
1186 ((myAttributesEditorParent->getFrameParent()->myViewNet->getEditModes().currentSupermode ==
GNE_SUPERMODE_DEMAND) && !myACAttr.getTagPropertyParent().isDemandElement())) {
1187 myAttributeColorButton->disable();
1188 myAttributeCheckButton->disable();
1189 myValueTextField->disable();
1190 myValueComboBoxChoices->disable();
1191 myValueCheckButton->disable();
1192 myAttributeButtonCombinableChoices->disable();
1194 myAttributeButtonCombinableChoices->enable();
1195 myAttributeColorButton->enable();
1196 myAttributeCheckButton->enable();
1200 if (myAttributeCheckButton->shown()) {
1201 myAttributeCheckButton->setCheck(attributeEnabled);
1203 if (myValueTextField->shown()) {
1205 if (myValueTextField->getTextColor() == FXRGB(0, 0, 0) || forceRefresh) {
1206 myValueTextField->setText(value.c_str());
1207 myValueTextField->setTextColor(FXRGB(0, 0, 0));
1209 }
else if (myValueComboBoxChoices->shown()) {
1211 myValueComboBoxChoices->clearItems();
1212 for (
const auto& it : myACAttr.getDiscreteValues()) {
1213 myValueComboBoxChoices->appendItem(it.c_str());
1216 myValueComboBoxChoices->setNumVisible((
int)myACAttr.getDiscreteValues().size());
1217 myValueComboBoxChoices->setCurrentItem(myValueComboBoxChoices->findItem(value.c_str()));
1218 myValueComboBoxChoices->setTextColor(FXRGB(0, 0, 0));
1219 myValueComboBoxChoices->show();
1220 }
else if (myValueCheckButton->shown()) {
1221 if (GNEAttributeCarrier::canParse<bool>(value)) {
1222 myValueCheckButton->setCheck(GNEAttributeCarrier::parse<bool>(value));
1224 myValueCheckButton->setCheck(
false);
1232 return ((myValueTextField->getTextColor() == FXRGB(0, 0, 0)) && (myValueComboBoxChoices->getTextColor() == FXRGB(0, 0, 0)));
1238 if (obj == myAttributeColorButton) {
1240 FXColorDialog colordialog(
this, tr(
"Color Dialog"));
1241 colordialog.setTarget(
this);
1243 if (GNEAttributeCarrier::canParse<RGBColor>(myValueTextField->getText().text())) {
1245 }
else if (!myACAttr.getDefaultValue().empty()) {
1251 if (colordialog.execute()) {
1253 myValueTextField->setText(newValue.c_str());
1254 if (myAttributesEditorParent->getEditedACs().front()->isValid(myACAttr.getAttr(), newValue)) {
1256 if (myAttributesEditorParent->getEditedACs().size() > 1) {
1257 myAttributesEditorParent->getFrameParent()->myViewNet->getUndoList()->p_begin(
"Change multiple attributes");
1260 for (
const auto& it_ac : myAttributesEditorParent->getEditedACs()) {
1261 it_ac->setAttribute(myACAttr.getAttr(), newValue, myAttributesEditorParent->getFrameParent()->myViewNet->getUndoList());
1264 myValueTextField->setTextColor(FXRGB(0, 0, 0));
1265 myValueTextField->killFocus();
1269 }
else if (obj == myAttributeButtonCombinableChoices) {
1271 if (myAttributesEditorParent->getEditedACs().size() > 1) {
1272 myAttributesEditorParent->getFrameParent()->myViewNet->getUndoList()->p_begin(
"Change multiple attributes");
1275 GNEAllowDisallow(myAttributesEditorParent->getFrameParent()->myViewNet, myAttributesEditorParent->getEditedACs().front()).execute();
1276 std::string allowed = myAttributesEditorParent->getEditedACs().front()->getAttribute(
SUMO_ATTR_ALLOW);
1278 for (
const auto& it_ac : myAttributesEditorParent->getEditedACs()) {
1279 it_ac->setAttribute(
SUMO_ATTR_ALLOW, allowed, myAttributesEditorParent->getFrameParent()->myViewNet->getUndoList());
1282 if (myAttributesEditorParent->getEditedACs().size() > 1) {
1283 myAttributesEditorParent->getFrameParent()->myViewNet->getUndoList()->p_end();
1286 myAttributesEditorParent->getFrameParent()->attributeUpdated();
1289 throw ProcessError(
"Invalid call to onCmdOpenAttributeDialog");
1299 if (myACAttr.isBool()) {
1301 if (myValueCheckButton->shown()) {
1303 if (myValueCheckButton->getCheck()) {
1304 myValueCheckButton->setText(
"true");
1307 myValueCheckButton->setText(
"false");
1312 newVal = myValueTextField->getText().text();
1314 }
else if (myACAttr.isDiscrete()) {
1316 if ((myACAttr.getDiscreteValues().size() > 0) && myACAttr.isVClasses()) {
1318 newVal = myValueTextField->getText().text();
1319 }
else if (!myMultiple) {
1321 newVal = myValueComboBoxChoices->getText().text();
1324 newVal = myValueTextField->getText().text();
1328 if (myValueTextField->getText().empty() && myACAttr.hasStaticDefaultValue()) {
1329 newVal = myACAttr.getDefaultValue();
1330 myValueTextField->setText(newVal.c_str());
1331 }
else if (myACAttr.isInt() && GNEAttributeCarrier::canParse<double>(myValueTextField->getText().text())) {
1333 double doubleValue = GNEAttributeCarrier::parse<double>(myValueTextField->getText().text());
1335 if ((doubleValue - (
int)doubleValue) == 0) {
1336 newVal =
toString((
int)doubleValue);
1337 myValueTextField->setText(newVal.c_str(), FALSE);
1339 }
else if ((myACAttr.getAttr() ==
SUMO_ATTR_ANGLE) && GNEAttributeCarrier::canParse<double>(myValueTextField->getText().text())) {
1341 double angle = GNEAttributeCarrier::parse<double>(myValueTextField->getText().text());
1343 if ((angle < 0) || (angle > 360)) {
1345 angle = fmod(angle, 360);
1350 myValueTextField->setText(newVal.c_str(), FALSE);
1353 newVal = myValueTextField->getText().text();
1358 newVal = stripWhitespaceAfterComma(newVal);
1361 if (myAttributesEditorParent->getEditedACs().front()->isValid(myACAttr.getAttr(), newVal)) {
1363 if (myAttributesEditorParent->getEditedACs().size() > 1) {
1364 myAttributesEditorParent->getFrameParent()->myViewNet->getUndoList()->p_begin(
"Change multiple attributes");
1367 myAttributesEditorParent->getFrameParent()->myViewNet->getUndoList()->p_begin(
"change " + myACAttr.getTagPropertyParent().getTagStr() +
" attribute");
1370 for (
const auto& it_ac : myAttributesEditorParent->getEditedACs()) {
1371 it_ac->setAttribute(myACAttr.getAttr(), newVal, myAttributesEditorParent->getFrameParent()->myViewNet->getUndoList());
1374 if (myAttributesEditorParent->getEditedACs().size() > 1) {
1375 myAttributesEditorParent->getFrameParent()->myViewNet->getUndoList()->p_end();
1377 myAttributesEditorParent->getFrameParent()->myViewNet->getUndoList()->p_end();
1380 if (myACAttr.isVClasses()) {
1381 myValueTextField->setTextColor(FXRGB(0, 0, 0));
1382 myValueTextField->killFocus();
1384 myAttributesEditorParent->refreshAttributeEditor(
false,
false);
1385 }
else if (myACAttr.isDiscrete()) {
1386 myValueComboBoxChoices->setTextColor(FXRGB(0, 0, 0));
1387 myValueComboBoxChoices->killFocus();
1388 }
else if (myValueTextField !=
nullptr) {
1389 myValueTextField->setTextColor(FXRGB(0, 0, 0));
1390 myValueTextField->killFocus();
1393 myAttributesEditorParent->getFrameParent()->attributeUpdated();
1396 if (myACAttr.isVClasses()) {
1397 myValueTextField->setTextColor(FXRGB(255, 0, 0));
1398 myValueTextField->killFocus();
1399 }
else if (myACAttr.isDiscrete()) {
1400 myValueComboBoxChoices->setTextColor(FXRGB(255, 0, 0));
1401 myValueComboBoxChoices->killFocus();
1402 }
else if (myValueTextField !=
nullptr) {
1403 myValueTextField->setTextColor(FXRGB(255, 0, 0));
1406 WRITE_DEBUG(
"Value '" + newVal +
"' for attribute " + myACAttr.getAttrStr() +
" of " + myACAttr.getTagPropertyParent().getTagStr() +
" isn't valid");
1414 if (myAttributeCheckButton->getCheck()) {
1416 myValueCheckButton->enable();
1417 myValueTextField->enable();
1420 myValueCheckButton->disable();
1421 myValueTextField->disable();
1434 std::string result(stringValue);
1435 while (result.find(
", ") != std::string::npos) {
1447 myFrameParent(FrameParent),
1448 myIncludeExtended(true) {
1463 myIncludeExtended = includeExtended;
1465 for (
int i = 0; i < (int)myAttributesEditorRows.size(); i++) {
1467 if (myAttributesEditorRows.at(i) !=
nullptr) {
1468 myAttributesEditorRows.at(i)->destroy();
1469 delete myAttributesEditorRows.at(i);
1470 myAttributesEditorRows.at(i) =
nullptr;
1474 bool showFlowEditor =
false;
1475 if (myEditedACs.size() > 0) {
1477 for (
const auto& tagProperty : myEditedACs.front()->getTagProperty()) {
1479 bool editAttribute =
true;
1481 if ((myEditedACs.size() > 1) && tagProperty.isUnique()) {
1482 editAttribute =
false;
1485 if (tagProperty.isExtended() && !includeExtended) {
1486 editAttribute =
false;
1489 if (tagProperty.isFlowDefinition()) {
1490 editAttribute =
false;
1491 showFlowEditor =
true;
1494 if (editAttribute) {
1496 std::set<std::string> occuringValues;
1498 for (
const auto& it_ac : myEditedACs) {
1499 occuringValues.insert(it_ac->getAttribute(tagProperty.getAttr()));
1502 std::ostringstream oss;
1503 for (
auto values = occuringValues.begin(); values != occuringValues.end(); values++) {
1504 if (values != occuringValues.begin()) {
1510 std::string value = oss.str();
1512 bool attributeEnabled = myEditedACs.front()->isAttributeEnabled(tagProperty.getAttr());
1514 if (attributeEnabled ==
false) {
1515 value = myEditedACs.front()->getAlternativeValueForDisabledAttributes(tagProperty.getAttr());
1518 if (myEditedACs.front()->getTagProperty().isStop() || myEditedACs.front()->getTagProperty().isPersonStop()) {
1520 attributeEnabled =
false;
1522 attributeEnabled =
false;
1526 if (forceAttributeEnabled && (tagProperty.getAttr() !=
SUMO_ATTR_ID)) {
1527 attributeEnabled =
true;
1530 myAttributesEditorRows[tagProperty.getPositionListed()] =
new AttributesEditorRow(
this, tagProperty, value, attributeEnabled);
1534 if (showFlowEditor) {
1535 myAttributesEditorFlow->showAttributeEditorFlowModul();
1537 myAttributesEditorFlow->hideAttributesEditorFlowModul();
1542 myAttributesEditorFlow->hideAttributesEditorFlowModul();
1545 myHelpButton->reparent(
this);
1552 myEditedACs.clear();
1554 myAttributesEditorFlow->hideAttributesEditorFlowModul();
1562 if (myEditedACs.size() > 0) {
1564 for (
const auto& tagProperty : myEditedACs.front()->getTagProperty()) {
1566 bool editAttribute =
true;
1568 if ((myEditedACs.size() > 1) && tagProperty.isUnique()) {
1569 editAttribute =
false;
1572 if (tagProperty.isExtended() && !myIncludeExtended) {
1573 editAttribute =
false;
1576 if (tagProperty.isFlowDefinition()) {
1577 editAttribute =
false;
1580 if (editAttribute) {
1582 std::set<std::string> occuringValues;
1584 for (
const auto& it_ac : myEditedACs) {
1585 occuringValues.insert(it_ac->getAttribute(tagProperty.getAttr()));
1588 std::ostringstream oss;
1589 for (
auto values = occuringValues.begin(); values != occuringValues.end(); values++) {
1590 if (values != occuringValues.begin()) {
1596 std::string value = oss.str();
1598 bool attributeEnabled = myEditedACs.front()->isAttributeEnabled(tagProperty.getAttr());
1600 if (attributeEnabled ==
false) {
1601 value = myEditedACs.front()->getAlternativeValueForDisabledAttributes(tagProperty.getAttr());
1604 if (myEditedACs.front()->getTagProperty().isStop() || myEditedACs.front()->getTagProperty().isPersonStop()) {
1606 attributeEnabled =
false;
1608 attributeEnabled =
false;
1618 if ((tagProperty.getAttr() ==
SUMO_ATTR_SHAPE) && forceRefreshShape) {
1619 myAttributesEditorRows[tagProperty.getPositionListed()]->refreshAttributesEditorRow(value,
true, attributeEnabled);
1622 myAttributesEditorRows[tagProperty.getPositionListed()]->refreshAttributesEditorRow(value,
true, attributeEnabled);
1625 myAttributesEditorRows[tagProperty.getPositionListed()]->refreshAttributesEditorRow(value,
false, attributeEnabled);
1630 if (myAttributesEditorFlow->isAttributesEditorFlowModulShown()) {
1631 myAttributesEditorFlow->refreshAttributeEditorFlow();
1639 return myFrameParent;
1643 const std::vector<GNEAttributeCarrier*>&
1652 if (myEditedACs.size() > 0) {
1654 auto i = std::find(myEditedACs.begin(), myEditedACs.end(), AC);
1656 if (i != myEditedACs.end()) {
1658 myEditedACs.erase(i);
1660 WRITE_DEBUG(
"Removed inspected element from Inspected ACs. " +
toString(myEditedACs.size()) +
" ACs remains.");
1662 showAttributeEditorModul(myEditedACs, myIncludeExtended,
false);
1671 if (myEditedACs.size() > 0) {
1673 myFrameParent->openHelpAttributesDialog(myEditedACs.front()->getTagProperty());
1683 FXGroupBox(attributesEditorParent->getFrameParent()->myContentFrame,
"Flow attributes",
GUIDesignGroupBoxFrame),
1684 myAttributesEditorParent(attributesEditorParent) {
1686 FXHorizontalFrame* auxiliarHorizontalFrame =
nullptr;
1712 if (myAttributesEditorParent->getEditedACs().size() > 0) {
1714 refreshAttributeEditorFlow();
1738 if (myAttributesEditorParent->getEditedACs().size() > 0) {
1742 refreshVehsPerHour();
1744 refreshProbability();
1752 GNEUndoList* undoList = myAttributesEditorParent->getFrameParent()->myViewNet->getUndoList();
1756 if (obj == myValueEndTextField) {
1758 value = myValueEndTextField->getText().text();
1759 }
else if (obj == myValueNumberTextField) {
1761 value = myValueNumberTextField->getText().text();
1762 }
else if (obj == myValueVehsPerHourTextField) {
1764 value = myValueVehsPerHourTextField->getText().text();
1765 }
else if (obj == myValuePeriodTextField) {
1767 value = myValuePeriodTextField->getText().text();
1768 }
else if (obj == myValueProbabilityTextField) {
1770 value = myValueProbabilityTextField->getText().text();
1777 if (myAttributesEditorParent->getEditedACs().size() > 1) {
1778 undoList->
p_begin(
"Change multiple " +
toString(attr) +
" attributes");
1781 for (
const auto& i : myAttributesEditorParent->getEditedACs()) {
1782 i->setAttribute(attr, value, undoList);
1785 if (myAttributesEditorParent->getEditedACs().size() > 1) {
1789 refreshAttributeEditorFlow();
1797 GNEUndoList* undoList = myAttributesEditorParent->getFrameParent()->myViewNet->getUndoList();
1800 if (obj == myAttributeEndRadioButton) {
1802 }
else if (obj == myAttributeNumberRadioButton) {
1804 }
else if (obj == myAttributeVehsPerHourRadioButton) {
1806 }
else if (obj == myAttributePeriodRadioButton) {
1808 }
else if (obj == myAttributeProbabilityRadioButton) {
1816 if (myAttributesEditorParent->getEditedACs().size() > 1) {
1817 undoList->
p_begin(
"enable multiple " +
toString(attr) +
" attributes");
1822 for (
const auto& i : myAttributesEditorParent->getEditedACs()) {
1823 i->enableAttribute(attr, undoList);
1828 refreshAttributeEditorFlow();
1836 int allAttributesEnabledOrDisabled = 0;
1837 for (
const auto& i : myAttributesEditorParent->getEditedACs()) {
1838 allAttributesEnabledOrDisabled += i->isAttributeEnabled(
SUMO_ATTR_END);
1840 if (allAttributesEnabledOrDisabled == (
int)myAttributesEditorParent->getEditedACs().size()) {
1842 std::set<std::string> occuringValues;
1843 for (
const auto& values : myAttributesEditorParent->getEditedACs()) {
1847 std::ostringstream endValue;
1848 for (
auto it_val = occuringValues.begin(); it_val != occuringValues.end(); it_val++) {
1849 if (it_val != occuringValues.begin()) {
1852 endValue << *it_val;
1855 myValueEndTextField->enable();
1856 myValueEndTextField->setText(endValue.str().c_str());
1857 myAttributeEndRadioButton->setCheck(TRUE);
1860 myValueEndTextField->disable();
1862 if ((allAttributesEnabledOrDisabled > 0) && (myAttributesEditorParent->getEditedACs().size() > 1)) {
1863 myValueEndTextField->setText(
"Different flow attributes");
1864 }
else if (myAttributesEditorParent->getEditedACs().size() == 1) {
1865 myValueEndTextField->setText(myAttributesEditorParent->getEditedACs().front()->getAlternativeValueForDisabledAttributes(
SUMO_ATTR_END).c_str());
1867 myValueEndTextField->setText(
"");
1869 myAttributeEndRadioButton->setCheck(FALSE);
1877 int allAttributesEnabledOrDisabled = 0;
1878 for (
const auto& i : myAttributesEditorParent->getEditedACs()) {
1881 if (allAttributesEnabledOrDisabled == (
int)myAttributesEditorParent->getEditedACs().size()) {
1883 std::set<std::string> occuringValues;
1884 for (
const auto& values : myAttributesEditorParent->getEditedACs()) {
1888 std::ostringstream numberValues;
1889 for (
auto it_val = occuringValues.begin(); it_val != occuringValues.end(); it_val++) {
1890 if (it_val != occuringValues.begin()) {
1891 numberValues <<
" ";
1893 numberValues << *it_val;
1896 myValueNumberTextField->enable();
1897 myValueNumberTextField->setText(numberValues.str().c_str());
1898 myAttributeNumberRadioButton->setCheck(TRUE);
1901 myValueNumberTextField->disable();
1903 if ((allAttributesEnabledOrDisabled > 0) && (myAttributesEditorParent->getEditedACs().size() > 1)) {
1904 myValueNumberTextField->setText(
"Different flow attributes");
1905 }
else if (myAttributesEditorParent->getEditedACs().size() == 1) {
1906 myValueNumberTextField->setText(myAttributesEditorParent->getEditedACs().front()->getAlternativeValueForDisabledAttributes(
SUMO_ATTR_NUMBER).c_str());
1908 myValueNumberTextField->setText(
"");
1910 myAttributeNumberRadioButton->setCheck(FALSE);
1918 int allAttributesEnabledOrDisabled = 0;
1919 for (
const auto& i : myAttributesEditorParent->getEditedACs()) {
1922 if (allAttributesEnabledOrDisabled == (
int)myAttributesEditorParent->getEditedACs().size()) {
1924 std::set<std::string> occuringValues;
1925 for (
const auto& values : myAttributesEditorParent->getEditedACs()) {
1929 std::ostringstream vehsPerHourValues;
1930 for (
auto it_val = occuringValues.begin(); it_val != occuringValues.end(); it_val++) {
1931 if (it_val != occuringValues.begin()) {
1932 vehsPerHourValues <<
" ";
1934 vehsPerHourValues << *it_val;
1937 myValueVehsPerHourTextField->enable();
1938 myValueVehsPerHourTextField->setText(vehsPerHourValues.str().c_str());
1939 myAttributeVehsPerHourRadioButton->setCheck(TRUE);
1942 myValueVehsPerHourTextField->disable();
1944 if ((allAttributesEnabledOrDisabled > 0) && (myAttributesEditorParent->getEditedACs().size() > 1)) {
1945 myValueVehsPerHourTextField->setText(
"Different flow attributes");
1946 }
else if (myAttributesEditorParent->getEditedACs().size() == 1) {
1947 myValueVehsPerHourTextField->setText(myAttributesEditorParent->getEditedACs().front()->getAlternativeValueForDisabledAttributes(
SUMO_ATTR_VEHSPERHOUR).c_str());
1949 myValueVehsPerHourTextField->setText(
"");
1951 myAttributeVehsPerHourRadioButton->setCheck(FALSE);
1959 int allAttributesEnabledOrDisabled = 0;
1960 for (
const auto& i : myAttributesEditorParent->getEditedACs()) {
1963 if (allAttributesEnabledOrDisabled == (
int)myAttributesEditorParent->getEditedACs().size()) {
1965 std::set<std::string> occuringValues;
1966 for (
const auto& values : myAttributesEditorParent->getEditedACs()) {
1970 std::ostringstream periodValues;
1971 for (
auto it_val = occuringValues.begin(); it_val != occuringValues.end(); it_val++) {
1972 if (it_val != occuringValues.begin()) {
1973 periodValues <<
" ";
1975 periodValues << *it_val;
1978 myValuePeriodTextField->enable();
1979 myValuePeriodTextField->setText(periodValues.str().c_str());
1980 myAttributePeriodRadioButton->setCheck(TRUE);
1983 myValuePeriodTextField->disable();
1985 if ((allAttributesEnabledOrDisabled > 0) && (myAttributesEditorParent->getEditedACs().size() > 1)) {
1986 myValuePeriodTextField->setText(
"Different flow attributes");
1987 }
else if (myAttributesEditorParent->getEditedACs().size() == 1) {
1988 myValuePeriodTextField->setText(myAttributesEditorParent->getEditedACs().front()->getAlternativeValueForDisabledAttributes(
SUMO_ATTR_PERIOD).c_str());
1990 myValuePeriodTextField->setText(
"");
1992 myAttributePeriodRadioButton->setCheck(FALSE);
2000 int allAttributesEnabledOrDisabled = 0;
2001 for (
const auto& i : myAttributesEditorParent->getEditedACs()) {
2002 allAttributesEnabledOrDisabled += i->isAttributeEnabled(
SUMO_ATTR_PROB);
2004 if (allAttributesEnabledOrDisabled == (
int)myAttributesEditorParent->getEditedACs().size()) {
2006 std::set<std::string> occuringValues;
2007 for (
const auto& values : myAttributesEditorParent->getEditedACs()) {
2011 std::ostringstream probabilityValues;
2012 for (
auto it_val = occuringValues.begin(); it_val != occuringValues.end(); it_val++) {
2013 if (it_val != occuringValues.begin()) {
2014 probabilityValues <<
" ";
2016 probabilityValues << *it_val;
2019 myValueProbabilityTextField->enable();
2020 myValueProbabilityTextField->setText(probabilityValues.str().c_str());
2021 myAttributeProbabilityRadioButton->enable();
2022 myAttributeProbabilityRadioButton->setCheck(TRUE);
2025 myValueProbabilityTextField->disable();
2027 if ((allAttributesEnabledOrDisabled > 0) && (myAttributesEditorParent->getEditedACs().size() > 1)) {
2028 myValueProbabilityTextField->setText(
"Different flow attributes");
2029 }
else if (myAttributesEditorParent->getEditedACs().size() == 1) {
2030 myValueProbabilityTextField->setText(myAttributesEditorParent->getEditedACs().front()->getAlternativeValueForDisabledAttributes(
SUMO_ATTR_PROB).c_str());
2032 myValueProbabilityTextField->setText(
"");
2034 myAttributeProbabilityRadioButton->setCheck(FALSE);
2044 myFrameParent(frameParent) {
2068 myFrameParent->attributesEditorExtendedDialogOpened();
2078 myFrameParent(inspectorFrameParent),
2099 myParameters.clear();
2103 while (parameters.
hasNext()) {
2105 const std::vector<std::string> keyValue =
StringTokenizer(parameters.
next(),
"=",
true).getVector();
2106 if (keyValue.size() == 2) {
2107 myParameters[keyValue.front()] = keyValue.back();
2112 refreshParametersEditor();
2123 if ((ACs.size() > 0) && ACs.front()->getTagProperty().hasParameters()) {
2127 bool differentsParameters =
false;
2129 for (
auto i : myACs) {
2131 differentsParameters =
true;
2135 if (differentsParameters) {
2136 myParameters.clear();
2141 myParameters.clear();
2145 for (
const auto& i : parameters) {
2148 myParameters[keyValue.front()] = keyValue.back();
2152 refreshParametersEditor();
2174 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
2176 if (((myFrameParent->myViewNet->getEditModes().currentSupermode ==
GNE_SUPERMODE_NETWORK) && myAC->getTagProperty().isDemandElement()) ||
2177 ((myFrameParent->myViewNet->getEditModes().currentSupermode ==
GNE_SUPERMODE_DEMAND) && !myAC->getTagProperty().isDemandElement())) {
2178 myTextFieldParameters->disable();
2179 myButtonEditParameters->disable();
2181 myTextFieldParameters->enable();
2182 myButtonEditParameters->enable();
2184 }
else if (myACs.size() > 0) {
2187 for (
auto i : myACs) {
2189 parameters =
"different parameters";
2192 myTextFieldParameters->setText(parameters.c_str());
2193 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
2195 if (((myFrameParent->myViewNet->getEditModes().currentSupermode ==
GNE_SUPERMODE_NETWORK) && myACs.front()->getTagProperty().isDemandElement()) ||
2196 ((myFrameParent->myViewNet->getEditModes().currentSupermode ==
GNE_SUPERMODE_DEMAND) && !myACs.front()->getTagProperty().isDemandElement())) {
2197 myTextFieldParameters->disable();
2198 myButtonEditParameters->disable();
2200 myTextFieldParameters->enable();
2201 myButtonEditParameters->enable();
2207 const std::map<std::string, std::string>&
2209 return myParameters;
2217 for (
const auto& i : myParameters) {
2218 result += i.first +
"=" + i.second +
"|";
2221 if (!result.empty()) {
2227 std::vector<std::pair<std::string, std::string> >
2229 std::vector<std::pair<std::string, std::string> > result;
2231 for (
const auto& i : myParameters) {
2232 result.push_back(std::make_pair(i.first, i.second));
2243 for (
const auto& i : parameters) {
2244 result += i.first +
"=" + i.second +
"|";
2247 if (!result.empty()) {
2251 myTextFieldParameters->setText(result.c_str(), TRUE);
2257 return myFrameParent;
2271 myAC->setAttribute(
GNE_ATTR_PARAMETERS, getParametersStr(), myFrameParent->myViewNet->getUndoList());
2272 }
else if (myACs.size() > 0) {
2273 myFrameParent->myViewNet->getUndoList()->p_begin(
"Change multiple parameters");
2274 for (
auto i : myACs) {
2275 i->setAttribute(
GNE_ATTR_PARAMETERS, getParametersStr(), myFrameParent->myViewNet->getUndoList());
2277 myFrameParent->myViewNet->getUndoList()->p_end();
2279 myFrameParent->attributeUpdated();
2282 refreshParametersEditor();
2295 myTextFieldParameters->setTextColor(FXRGB(255, 0, 0));
2298 myTextFieldParameters->setTextColor(FXRGB(0, 0, 0));
2299 myTextFieldParameters->killFocus();
2301 std::vector<std::string> parameters =
StringTokenizer(myTextFieldParameters->getText().text(),
"|",
true).getVector();
2303 myParameters.clear();
2305 for (
const auto& i : parameters) {
2309 myParameters[keyParam.front()] = keyParam.back();
2312 myTextFieldParameters->setText(getParametersStr().c_str(), FALSE);
2316 myFrameParent->myViewNet->getUndoList()->p_begin(
"change parameters");
2318 myAC->setAttribute(
GNE_ATTR_PARAMETERS, getParametersStr(), myFrameParent->myViewNet->getUndoList());
2320 myFrameParent->myViewNet->getUndoList()->p_end();
2321 }
else if (myACs.size() > 0) {
2323 myFrameParent->myViewNet->getUndoList()->p_begin(
"change multiple parameters");
2325 for (
const auto& i : myACs) {
2326 i->setAttribute(
GNE_ATTR_PARAMETERS, getParametersStr(), myFrameParent->myViewNet->getUndoList());
2329 myFrameParent->myViewNet->getUndoList()->p_end();
2331 myFrameParent->attributeUpdated();
2343 myFrameParent(frameParent),
2344 myDeleteLastCreatedPoint(false) {
2350 std::ostringstream information;
2352 <<
"- 'Start drawing' or ENTER\n"
2353 <<
" draws shape boundary.\n"
2354 <<
"- 'Stop drawing' or ENTER\n"
2355 <<
" creates shape.\n"
2356 <<
"- 'Shift + Click'removes\n"
2357 <<
" last created point.\n"
2358 <<
"- 'Abort drawing' or ESC\n"
2359 <<
" removes drawed shape.";
2391 myStartDrawingButton->disable();
2392 myStopDrawingButton->enable();
2393 myAbortDrawingButton->enable();
2401 if (myFrameParent->shapeDrawed()) {
2403 myTemporalShapeShape.clear();
2404 myFrameParent->myViewNet->update();
2406 myStartDrawingButton->enable();
2407 myStopDrawingButton->disable();
2408 myAbortDrawingButton->disable();
2419 myTemporalShapeShape.clear();
2420 myFrameParent->myViewNet->update();
2422 myStartDrawingButton->enable();
2423 myStopDrawingButton->disable();
2424 myAbortDrawingButton->disable();
2430 if (myStopDrawingButton->isEnabled()) {
2431 myTemporalShapeShape.push_back(P);
2433 throw ProcessError(
"A new point cannot be added if drawing wasn't started");
2446 return myTemporalShapeShape;
2452 return myStopDrawingButton->isEnabled();
2458 myDeleteLastCreatedPoint = value;
2464 return myDeleteLastCreatedPoint;
2494 myFrameParent(frameParent),
2495 myCurrentLengthValid(true),
2496 myActualAdditionalReferencePoint(GNE_ADDITIONALREFERENCEPOINT_LEFT) {
2539 bool showFrame =
false;
2542 myLengthFrame->show();
2543 myReferencePointMatchBox->show();
2546 myLengthFrame->hide();
2547 myReferencePointMatchBox->hide();
2551 myBlockMovementFrame->show();
2554 myBlockMovementFrame->hide();
2558 myBlockShapeFrame->show();
2561 myBlockShapeFrame->hide();
2565 myCloseShapeFrame->show();
2568 myCloseShapeFrame->hide();
2572 myCenterViewAfterCreationFrame->show();
2575 myCenterViewAfterCreationFrame->hide();
2596 if (myReferencePointMatchBox->shown()) {
2598 if (lane ==
nullptr) {
2600 }
else if (myCurrentLengthValid) {
2604 if (myActualAdditionalReferencePoint == GNE_ADDITIONALREFERENCEPOINT_INVALID) {
2605 std::string errorMessage =
"Current selected reference point isn't valid";
2606 myFrameParent->myViewNet->setStatusBarText(errorMessage);
2612 double length = GNEAttributeCarrier::parse<double>(myLengthTextField->getText().text());
2622 if (myBlockMovementCheckButton->shown()) {
2623 if (myBlockMovementCheckButton->getCheck() == 1) {
2630 if (myBlockShapeCheckButton->shown()) {
2631 if (myBlockShapeCheckButton->getCheck() == 1) {
2638 if (myCloseShapeCheckButton->shown()) {
2639 if (myCloseShapeCheckButton->getCheck() == 1) {
2646 if (myCenterViewAfterCreationButton->shown() && (myCenterViewAfterCreationButton->getCheck() == 1)) {
2656 if (obj == myBlockMovementCheckButton) {
2657 if (myBlockMovementCheckButton->getCheck()) {
2658 myBlockMovementCheckButton->setText(
"true");
2660 myBlockMovementCheckButton->setText(
"false");
2662 }
else if (obj == myBlockShapeCheckButton) {
2663 if (myBlockShapeCheckButton->getCheck()) {
2664 myBlockShapeCheckButton->setText(
"true");
2666 myBlockShapeCheckButton->setText(
"false");
2668 }
else if (obj == myCloseShapeCheckButton) {
2669 if (myCloseShapeCheckButton->getCheck()) {
2670 myCloseShapeCheckButton->setText(
"true");
2672 myCloseShapeCheckButton->setText(
"false");
2674 }
else if (obj == myCenterViewAfterCreationButton) {
2675 if (myCenterViewAfterCreationButton->getCheck()) {
2676 myCenterViewAfterCreationButton->setText(
"true");
2678 myCenterViewAfterCreationButton->setText(
"false");
2680 }
else if (obj == myLengthTextField) {
2682 if (GNEAttributeCarrier::canParse<double>(myLengthTextField->getText().text()) &&
2683 GNEAttributeCarrier::parse<double>(myLengthTextField->getText().text()) > 0) {
2684 myLengthTextField->setTextColor(FXRGB(0, 0, 0));
2685 myLengthTextField->killFocus();
2686 myCurrentLengthValid =
true;
2688 myLengthTextField->setTextColor(FXRGB(255, 0, 0));
2689 myCurrentLengthValid =
false;
2693 }
else if (obj == myReferencePointMatchBox) {
2695 if (myReferencePointMatchBox->getText() ==
"reference left") {
2696 myReferencePointMatchBox->setTextColor(FXRGB(0, 0, 0));
2697 myActualAdditionalReferencePoint = GNE_ADDITIONALREFERENCEPOINT_LEFT;
2698 myLengthTextField->enable();
2699 }
else if (myReferencePointMatchBox->getText() ==
"reference right") {
2700 myReferencePointMatchBox->setTextColor(FXRGB(0, 0, 0));
2701 myActualAdditionalReferencePoint = GNE_ADDITIONALREFERENCEPOINT_RIGHT;
2702 myLengthTextField->enable();
2703 }
else if (myReferencePointMatchBox->getText() ==
"reference center") {
2704 myLengthTextField->enable();
2705 myReferencePointMatchBox->setTextColor(FXRGB(0, 0, 0));
2706 myActualAdditionalReferencePoint = GNE_ADDITIONALREFERENCEPOINT_CENTER;
2707 myLengthTextField->enable();
2709 myReferencePointMatchBox->setTextColor(FXRGB(255, 0, 0));
2710 myActualAdditionalReferencePoint = GNE_ADDITIONALREFERENCEPOINT_INVALID;
2711 myLengthTextField->disable();
2722 FXDialogBox* additionalNeteditAttributesHelpDialog =
new FXDialogBox(
this,
"Netedit Parameters Help",
GUIDesignDialogBox);
2725 std::ostringstream help;
2727 <<
"- Referece point: Mark the initial position of the additional element.\n"
2728 <<
" Example: If you want to create a busStop with a length of 30 in the point 100 of the lane:\n"
2729 <<
" - Reference Left will create it with startPos = 70 and endPos = 100.\n"
2730 <<
" - Reference Right will create it with startPos = 100 and endPos = 130.\n"
2731 <<
" - Reference Center will create it with startPos = 85 and endPos = 115.\n"
2733 <<
"- Block movement: if is enabled, the created additional element will be blocked. i.e. cannot be moved with\n"
2734 <<
" the mouse. This option can be modified inspecting element.\n"
2735 <<
"- Center view: if is enabled, view will be center over created element.";
2747 WRITE_DEBUG(
"Opening NeteditAttributes help dialog");
2749 additionalNeteditAttributesHelpDialog->create();
2751 additionalNeteditAttributesHelpDialog->show(PLACEMENT_CURSOR);
2753 getApp()->refresh();
2755 getApp()->runModalFor(additionalNeteditAttributesHelpDialog);
2757 WRITE_DEBUG(
"Closing NeteditAttributes help dialog");
2776 switch (myActualAdditionalReferencePoint) {
2777 case GNE_ADDITIONALREFERENCEPOINT_LEFT:
2778 return positionOfTheMouseOverLane;
2779 case GNE_ADDITIONALREFERENCEPOINT_RIGHT:
2780 return positionOfTheMouseOverLane - lengthOfAdditional;
2781 case GNE_ADDITIONALREFERENCEPOINT_CENTER:
2782 return positionOfTheMouseOverLane - lengthOfAdditional / 2;
2791 switch (myActualAdditionalReferencePoint) {
2792 case GNE_ADDITIONALREFERENCEPOINT_LEFT:
2793 return positionOfTheMouseOverLane + lengthOfAdditional;
2794 case GNE_ADDITIONALREFERENCEPOINT_RIGHT:
2795 return positionOfTheMouseOverLane;
2796 case GNE_ADDITIONALREFERENCEPOINT_CENTER:
2797 return positionOfTheMouseOverLane + lengthOfAdditional / 2;