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

Allow bike walking through bicycle no thru traffic areas #6179

Merged
Show file tree
Hide file tree
Changes from all 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 @@ -381,6 +381,21 @@ else if (s0.currentMode() == TraverseMode.BICYCLE) {

State state = editor != null ? editor.makeState() : null;

// Add an explicit bike-walking state for no-thru-traffic edges, so that dismounting and walking
// is an option to avoid the restriction
if (
s0.getBackMode() == TraverseMode.BICYCLE &&
canTraverse(TraverseMode.BICYCLE) &&
isBicycleNoThruTraffic() &&
!s0.hasEnteredNoThruTrafficArea()
) {
var bikeWalk = doTraverse(s0, TraverseMode.WALK, true);
if (bikeWalk != null) {
State forkState = bikeWalk.makeState();
return State.ofNullable(forkState, state);
}
}

// we are transitioning into a no-drop-off zone therefore we add a second state for dropping
// off the vehicle and walking
if (state != null && !fromv.rentalDropOffBanned(s0) && tov.rentalDropOffBanned(s0)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,75 @@ public void testElevatorBiking() {
);
}

@Test
public void testBicycleBicycleNoThruTrafficStart() {
CD.setBicycleNoThruTraffic(true);

assertPath(
C,
F,
StreetMode.BIKE,
List.of(
"null - 0 / 0.0 - null",
"BICYCLE - 5 / 10.0 - CD street",
"BICYCLE - 5 / 10.0 - DE street",
"BICYCLE - 5 / 10.0 - EF street"
),
List.of(
"null - 0 / 0.0 - null",
"BICYCLE - 5 / 10.0 - CD street",
"BICYCLE - 5 / 10.0 - DE street",
"BICYCLE - 5 / 10.0 - EF street"
)
);
}

@Test
public void testBicycleBicycleNoThruTrafficMiddle() {
DE.setBicycleNoThruTraffic(true);

assertPath(
C,
F,
StreetMode.BIKE,
List.of(
"null - 0 / 0.0 - null",
"BICYCLE - 5 / 10.0 - CD street",
"🚲WALK - 120 / 1100.0 - DE street",
"BICYCLE - 105 / 1010.0 - EF street"
),
List.of(
"null - 0 / 0.0 - null",
"BICYCLE - 105 / 1010.0 - CD street",
"🚲WALK - 120 / 1100.0 - DE street",
"BICYCLE - 5 / 10.0 - EF street"
)
);
}

@Test
public void testBicycleBicycleNoThruTrafficEnd() {
EF.setBicycleNoThruTraffic(true);

assertPath(
C,
F,
StreetMode.BIKE,
List.of(
"null - 0 / 0.0 - null",
"BICYCLE - 5 / 10.0 - CD street",
"BICYCLE - 5 / 10.0 - DE street",
"BICYCLE - 5 / 10.0 - EF street"
),
List.of(
"null - 0 / 0.0 - null",
"BICYCLE - 5 / 10.0 - CD street",
"BICYCLE - 5 / 10.0 - DE street",
"BICYCLE - 5 / 10.0 - EF street"
)
);
}

@BeforeEach
protected void setUp() throws Exception {
// Generate a very simple graph
Expand Down
Loading