Skip to content

Commit

Permalink
Fix #15: Steps should be treated as sidewalks for crossing purposes
Browse files Browse the repository at this point in the history
Signed-off-by: Taylor Smock <[email protected]>
  • Loading branch information
tsmock committed Oct 17, 2024
1 parent 90dea63 commit 7231a90
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ public boolean isEditableDataLayer(Layer l) {

private static final String CROSSING = "crossing";
private static final String FOOTWAY = "footway";
private static final String STEPS = "steps";
private static final String HIGHWAY = "highway";
private static final String SIDEWALK = "sidewalk";
private static final String SURFACE = "surface";
Expand Down Expand Up @@ -306,12 +307,11 @@ private void createCrossingWay(Way way, Way crossingWay, Way possibleCrossing, C
final var undoRedoHandler = UndoRedoHandler.getInstance();
final var newNodes = new ArrayList<>(way.getNodes());
final var usuallyRightCommands = new ArrayList<Command>(6);
final boolean isCrossing = !possibleCrossing.hasTag(HIGHWAY, "pedestrian", FOOTWAY, "path")
final boolean isCrossing = !possibleCrossing.hasTag(HIGHWAY, "pedestrian", FOOTWAY, "path", STEPS)
&& !(possibleCrossing.hasTag(HIGHWAY, "service")
// Service roads with these "common" tags are often small and don't have a real
// crossing from a pedestrian perspective. We do want to add crossing
// information
// when there is no service information.
// information when there is no service information.
&& possibleCrossing.hasTag("service", "alley", "drive-through", "driveway",
"emergency_access"));
crossingWay.put(HIGHWAY, FOOTWAY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,18 @@ void testDividedHighwayReversed() throws UserCancelException {
() -> assertEquals(4, crossing.getNodesCount()));
}

@Test
void testCrossingSteps() {
final var steps = newWay("highway=steps", 42.983577, -70.9456852, 42.9836648, -70.9454839);
this.ds.addPrimitiveRecursive(steps);
clickAt(42.9833574, -70.9452684);
clickAt(42.9835067, -70.9453736);
clickAt(42.9836879, -70.9455033);
clickAt(42.9836879, -70.9455033);
assertFalse(steps.lastNode().isTagged());
assertEquals(2, steps.lastNode().getParentWays().size());
}

@Test
void testFourWayIntersectionCrossing() {
final var neSidewalk = newWay("highway=footway footway=sidewalk", 39.0995956, -108.5016914, 39.0995628,
Expand Down

0 comments on commit 7231a90

Please sign in to comment.