Skip to content

Commit

Permalink
Only allow mtb:scale 0 or 1 and lower for trecking & racebikes, and s…
Browse files Browse the repository at this point in the history
…upport "+" and "-" values
  • Loading branch information
ratrun committed Sep 14, 2024
1 parent 2b75aa7 commit 4b6a117
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ boolean isSacScaleAllowed(String sacScale) {

boolean isMtbScaleAllowed(String mtbScale) {
// keep even more difficult accessible as one may push, see https://wiki.openstreetmap.org/wiki/Key:mtb:scale
return "0".equals(mtbScale) || "1".equals(mtbScale) || "2".equals(mtbScale);
if (mtbScale.length() == 2 && (mtbScale.charAt(1) == '+' || mtbScale.charAt(1) == '-'))
mtbScale = mtbScale.substring(0, 1);
return "0".equals(mtbScale) || "1".equals(mtbScale);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ boolean isSacScaleAllowed(String sacScale) {

@Override
boolean isMtbScaleAllowed(String mtbScale) {
if (mtbScale.length() == 2 && (mtbScale.charAt(1) == '+' || mtbScale.charAt(1) == '-'))
mtbScale = mtbScale.substring(0, 1);
return !"6".equals(mtbScale);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,11 @@ public void testMtbScaleAccess() {
way.setTag("highway", "path");
way.setTag("mtb:scale", "0");
assertTrue(accessParser.getAccess(way).isWay());
way.setTag("mtb:scale", "3");
way.setTag("mtb:scale", "1+");
assertTrue(accessParser.getAccess(way).isWay());
way.setTag("mtb:scale", "1-");
assertTrue(accessParser.getAccess(way).isWay());
way.setTag("mtb:scale", "2");
assertTrue(accessParser.getAccess(way).canSkip());
}

Expand Down

0 comments on commit 4b6a117

Please sign in to comment.