Skip to content

Commit

Permalink
Merge pull request #4892 from Helium314/Helium314-patch-3
Browse files Browse the repository at this point in the history
Ask sidewalk quest if nearby paths are not foot accessible
  • Loading branch information
westnordost committed Mar 20, 2023
2 parents eb06960 + e0954ce commit baa07cd
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ import de.westnordost.streetcomplete.util.math.isNearAndAligned

class AddSidewalk : OsmElementQuestType<LeftAndRightSidewalk> {
private val maybeSeparatelyMappedSidewalksFilter by lazy { """
ways with highway ~ path|footway|cycleway|construction
ways with
highway ~ path|footway|cycleway|construction
and foot !~ no|private
and access !~ no|private
""".toElementFilterExpression() }
// highway=construction included, as situation often changes during and after construction

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,29 @@ class AddSidewalkTest {
assertNull(questType.isApplicableTo(road))
}

@Test fun `applicable to road with nearby footway that is private`() {
val road = way(1, listOf(1, 2), mapOf(
"highway" to "primary",
"lit" to "yes",
"width" to "18"
))
val footway = way(2, listOf(3, 4), mapOf(
"access" to "private",
"highway" to "footway"
))
val mapData = TestMapDataWithGeometry(listOf(road, footway))
val p1 = p(0.0, 0.0)
val p2 = p1.translate(50.0, 45.0)
val p3 = p1.translate(12.999, 135.0)
val p4 = p3.translate(50.0, 45.0)

mapData.wayGeometriesById[1L] = ElementPolylinesGeometry(listOf(listOf(p1, p2)), p1)
mapData.wayGeometriesById[2L] = ElementPolylinesGeometry(listOf(listOf(p3, p4)), p3)

assertEquals(1, questType.getApplicableElements(mapData).toList().size)
assertNull(questType.isApplicableTo(road))
}

@Test fun `applicable to road with nearby footway that is not aligned to the road`() {
val road = way(1, listOf(1, 2), mapOf(
"highway" to "primary",
Expand Down

0 comments on commit baa07cd

Please sign in to comment.