Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/#1177 waterway lock gate #1180

Merged
merged 3 commits into from
Jun 3, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ private Keys() {}
public static final String MAN_MADE = "man_made";
public static final String TUNNEL = "tunnel";
public static final String BICYCLE = "bicycle";
public static final String WATERWAY = "waterway";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,15 @@ private EncodingManager.Access handleNonHighways(ReaderWay way) {
if (way.hasTag(OSMTags.Keys.MAN_MADE, "pier"))
acceptPotentially = EncodingManager.Access.WAY;


// only route via lock_gate if foot-tag allows for it.
if (way.hasTag(OSMTags.Keys.WATERWAY, "lock_gate")) {
if (way.hasTag(OSMTags.Keys.FOOT, intendedValues)) {
acceptPotentially = EncodingManager.Access.WAY;
}
}


if (!acceptPotentially.canSkip()) {
if (way.hasTag(restrictions, restrictedValues) && !getConditionalTagInspector().isRestrictedWayConditionallyPermitted(way))
return EncodingManager.Access.CAN_SKIP;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,4 +336,27 @@ public void getWeighting() {
// assertTrue(throwsError);
}

@Test
public void acceptLockGateFootAllowed() {
way.setTag("waterway", "lock_gate");
way.setTag("foot", "yes");

assertTrue(flagEncoder.getAccess(way).isWay());
}

@Test
public void rejectLockGateFootAccessMissing() {
way.setTag("waterway", "lock_gate");

assertTrue(flagEncoder.getAccess(way).canSkip());
}

@Test
public void rejectLockGateFootForbidden() {
way.setTag("waterway", "lock_gate");
way.setTag("foot", "no");

assertTrue(flagEncoder.getAccess(way).canSkip());
}

}