Skip to content

Commit

Permalink
Allowing combination vehicle=no without bicycle=no even though not su…
Browse files Browse the repository at this point in the history
…re if this is a good idea
  • Loading branch information
ratrun committed Apr 22, 2024
1 parent 81ef8ea commit 5ead1a5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,25 @@ public WayAccess getAccess(ReaderWay way) {
}

// use the way for pushing
if (way.hasTag("bicycle", "dismount") || way.hasTag("vehicle", "no"))
if (way.hasTag("bicycle", "dismount"))
return WayAccess.WAY;

if (way.hasTag("access", "no") && (!way.hasTag("bicycle:conditional")) && (!way.hasTag("bicycle", intendedValues)))
return WayAccess.CAN_SKIP;

int firstIndex = way.getFirstIndex(restrictionKeys);
if (firstIndex >= 0) {
String firstValue = way.getTag(restrictionKeys.get(firstIndex), "");
String firstRestrictedKey = restrictionKeys.get(firstIndex);
String firstValue = way.getTag(firstRestrictedKey, "");
String[] restrict = firstValue.split(";");
for (String value : restrict) {
if (value.equals("no")) {
if (firstRestrictedKey.equals("vehicle"))
return WayAccess.WAY;
if (firstRestrictedKey.equals("bicycle") && way.hasTag("vehicle", "no")) {
if (way.hasTag("highway", "cycleway"))
return WayAccess.WAY; // Tagging error, we follow the highway value
else
return WayAccess.CAN_SKIP;
}
}
if (restrictedValues.contains(value) && !hasTemporalRestriction(way, firstIndex, restrictionKeys))
return WayAccess.CAN_SKIP;
if (intendedValues.contains(value))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,18 @@ public void testAccess() {
way.clearTags();
way.setTag("highway", "path");
assertTrue(accessParser.getAccess(way).isWay());
way.setTag("vehicle", "no");
assertTrue(accessParser.getAccess(way).isWay());
way.setTag("bicycle", "no");
assertTrue(accessParser.getAccess(way).canSkip());

way.clearTags();
way.setTag("highway", "path");
assertTrue(accessParser.getAccess(way).isWay());
way.setTag("access", "no");
assertTrue(accessParser.getAccess(way).canSkip());
way.setTag("bicycle", "no");
assertTrue(accessParser.getAccess(way).canSkip());

way.setTag("highway", "path");
way.setTag("bicycle", "yes");
Expand Down Expand Up @@ -195,6 +207,8 @@ public void testAccess() {
assertTrue(accessParser.getAccess(way).isWay());
way.setTag("bicycle", "dismount");
assertTrue(accessParser.getAccess(way).isWay());
way.setTag("bicycle", "no");
assertTrue(accessParser.getAccess(way).canSkip());


way.clearTags();
Expand Down

0 comments on commit 5ead1a5

Please sign in to comment.