Skip to content

Commit

Permalink
Fixed #3488
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Mar 1, 2018
1 parent 2c42382 commit 0757042
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/netedit/GNEAttributeCarrier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,6 @@ GNEAttributeCarrier::isInt(SumoXMLTag tag, SumoXMLAttr attr) {
myNumericalIntAttrs[SUMO_TAG_CROSSING].insert(SUMO_ATTR_TLLINKINDEX);
myNumericalIntAttrs[SUMO_TAG_CROSSING].insert(SUMO_ATTR_TLLINKINDEX2);
// flow
myNumericalIntAttrs[SUMO_TAG_FLOW].insert(SUMO_ATTR_PROB);
myNumericalIntAttrs[SUMO_TAG_FLOW].insert(SUMO_ATTR_PERSON_NUMBER);
myNumericalIntAttrs[SUMO_TAG_FLOW].insert(SUMO_ATTR_CONTAINER_NUMBER);
myNumericalIntAttrs[SUMO_TAG_FLOW].insert(SUMO_ATTR_NUMBER);
Expand Down Expand Up @@ -1227,7 +1226,6 @@ GNEAttributeCarrier::isPositive(SumoXMLTag tag, SumoXMLAttr attr) {
myPositiveAttrs[SUMO_TAG_CONNECTION].insert(SUMO_ATTR_SPEED);
// charging station
myPositiveAttrs[SUMO_TAG_CHARGING_STATION].insert(SUMO_ATTR_CHARGINGPOWER);
myPositiveAttrs[SUMO_TAG_CHARGING_STATION].insert(SUMO_ATTR_EFFICIENCY);
myPositiveAttrs[SUMO_TAG_CHARGING_STATION].insert(SUMO_ATTR_CHARGEINTRANSIT);
// E2
myPositiveAttrs[SUMO_TAG_E2DETECTOR].insert(SUMO_ATTR_LENGTH);
Expand Down
16 changes: 16 additions & 0 deletions src/netedit/GNEAttributeCarrier.h
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,22 @@ class GNEAttributeCarrier : public GNEReferenceCounter {
parsedOk = false;
}
}
// set extra check for probability values
if (isProbability(tag, attribute)) {
if (canParse<double>(parsedAttribute)) {
// parse to SUMO Real and check if is negative
if (parse<double>(parsedAttribute) < 0) {
errorFormat = "Probability cannot be smaller than 0; ";
parsedOk = false;
} else if (parse<double>(parsedAttribute) > 1) {
errorFormat = "Probability cannot be greather than 1; ";
parsedOk = false;
}
} else {
errorFormat = "Cannot be parsed to probability; ";
parsedOk = false;
}
}
// set extra check for color values
if (isColor(tag, attribute) && !canParse<RGBColor>(parsedAttribute)) {
errorFormat = "Invalid RGB format or named color; ";
Expand Down

0 comments on commit 0757042

Please sign in to comment.