Permalink
Browse files

do not decrement 0-numbered floors

  • Loading branch information...
1 parent 87cad80 commit b92f9679ded49a888e524310bb788e368d70bb59 @abyrd abyrd committed Feb 24, 2012
@@ -84,21 +84,27 @@ public static OSMLevel fromString (String spec, Source source, boolean increment
Integer floorNumber = null;
try {
floorNumber = Integer.parseInt(longName);
- if (incrementNonNegative && floorNumber >= 0) {
- if (source == Source.LEVEL_MAP)
- floorNumber -= 1; // level maps are localized, floor numbers are 0-based
- else
- longName = Integer.toString(floorNumber + 1); // level and layer tags are 0-based
+ if (incrementNonNegative) {
+ if (source == Source.LEVEL_MAP) {
+ if (floorNumber >= 1)
+ floorNumber -= 1; // level maps are localized, floor numbers are 0-based
+ } else {
+ if (floorNumber >= 0)
+ longName = Integer.toString(floorNumber + 1); // level and layer tags are 0-based
+ }
}
} catch (NumberFormatException e) {}
try {
// short name takes precedence over long name for floor numbering
floorNumber = Integer.parseInt(shortName);
- if (incrementNonNegative && floorNumber >= 0) {
- if (source == Source.LEVEL_MAP)
- floorNumber -= 1;
- else
- shortName = Integer.toString(floorNumber + 1);
+ if (incrementNonNegative) {
+ if (source == Source.LEVEL_MAP) {
+ if (floorNumber >= 1)
+ floorNumber -= 1; // level maps are localized, floor numbers are 0-based
+ } else {
+ if (floorNumber >= 0)
+ shortName = Integer.toString(floorNumber + 1); // level and layer tags are 0-based
+ }
}
} catch (NumberFormatException e) {}

0 comments on commit b92f967

Please sign in to comment.