-
-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cycleway overlay: Differentiate bicycle access on pedestrian roads (#…
- Loading branch information
1 parent
bc70db8
commit 7e2fd27
Showing
13 changed files
with
443 additions
and
110 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
59 changes: 59 additions & 0 deletions
59
.../westnordost/streetcomplete/osm/bicycle_in_pedestrian_street/BicycleInPedestrianStreet.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package de.westnordost.streetcomplete.osm.bicycle_in_pedestrian_street | ||
|
||
import de.westnordost.streetcomplete.osm.Tags | ||
import de.westnordost.streetcomplete.osm.bicycle_in_pedestrian_street.BicycleInPedestrianStreet.* | ||
|
||
enum class BicycleInPedestrianStreet { | ||
/** Pedestrian area also designated for pedestrians (like shared-use path) */ | ||
DESIGNATED, | ||
/** Bicycles explicitly allowed in pedestrian area */ | ||
ALLOWED, | ||
/** Bicycles explicitly not allowed in pedestrian area */ | ||
NOT_ALLOWED, | ||
/** Nothing is signed about bicycles in pedestrian area (probably disallowed, but depends on | ||
* legislation */ | ||
NOT_SIGNED | ||
} | ||
|
||
fun parseBicycleInPedestrianStreet(tags: Map<String, String>): BicycleInPedestrianStreet? { | ||
val bicycleSigned = tags["bicycle:signed"] == "yes" | ||
return when { | ||
tags["highway"] != "pedestrian" -> null | ||
tags["bicycle"] == "designated" -> DESIGNATED | ||
tags["bicycle"] in yesButNotDesignated && bicycleSigned -> ALLOWED | ||
tags["bicycle"] in noCycling && bicycleSigned -> NOT_ALLOWED | ||
else -> NOT_SIGNED | ||
} | ||
} | ||
|
||
private val yesButNotDesignated = setOf( | ||
"yes", "permissive", "private", "destination", "customers", "permit" | ||
) | ||
|
||
private val noCycling = setOf( | ||
"no", "dismount" | ||
) | ||
|
||
fun BicycleInPedestrianStreet.applyTo(tags: Tags) { | ||
// note the implementation is quite similar to that in SeparateCyclewayCreator | ||
when (this) { | ||
DESIGNATED -> { | ||
tags["bicycle"] = "designated" | ||
// if bicycle:signed is explicitly no, set it to yes | ||
if (tags["bicycle:signed"] == "no") tags["bicycle:signed"] = "yes" | ||
} | ||
ALLOWED -> { | ||
tags["bicycle"] = "yes" | ||
tags["bicycle:signed"] = "yes" | ||
} | ||
NOT_ALLOWED -> { | ||
if (tags["bicycle"] !in noCycling) tags["bicycle"] = "no" | ||
tags["bicycle:signed"] = "yes" | ||
} | ||
NOT_SIGNED -> { | ||
// only remove if designated before, it might still be allowed by legislation! | ||
if (tags["bicycle"] == "designated") tags.remove("bicycle") | ||
tags.remove("bicycle:signed") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
app/src/main/res/drawable/pedestrian_and_bicycle_white.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="128dp" | ||
android:height="128dp" | ||
android:viewportWidth="128" | ||
android:viewportHeight="128"> | ||
<path | ||
android:pathData="m41.731,54.845c-4.519,0 -8.185,3.665 -8.185,8.185 0,4.52 3.665,8.183 8.185,8.183 4.52,0 8.185,-3.663 8.185,-8.183 0,-4.52 -3.665,-8.185 -8.185,-8.185zM33.169,74.19c-8.281,3.097 -14.667,8.36 -14.738,17.114 0,2.241 1.816,4.056 4.058,4.056 2.242,0 4.059,-1.815 4.059,-4.056 0.067,-2.237 1.016,-4.137 2.402,-5.655 0.044,1.993 0.362,4.231 1.047,6.714 -0.422,0.703 -0.599,1.761 -0.432,3.309 -1.432,8.24 -10.516,13.601 -16.373,16.261 -2.048,0.91 -2.972,3.309 -2.062,5.358 0.911,2.048 3.309,2.972 5.358,2.062 7.772,-4.047 17.656,-10.576 20.502,-19.148 6.456,3.01 12.497,9.771 13.586,16.012 0.316,2.219 2.373,3.759 4.592,3.442 2.219,-0.317 3.761,-2.371 3.444,-4.589 -1.683,-10.015 -8.599,-17.426 -17.224,-21.769 -2.498,-1.073 -2.696,-6.905 -2.555,-9.008 7.568,4.296 15.326,6.215 23.004,2.447 2.005,-1.002 2.816,-3.441 1.814,-5.445 -1.003,-2.004 -3.438,-2.817 -5.442,-1.814 -9.024,4.461 -14.645,-2.371 -19.393,-5.136 -1.699,-1.19 -3.956,-1.193 -5.644,-0.155z" | ||
android:fillColor="#fff"/> | ||
<path | ||
android:pathData="M76.601,45.578A10.905,10.858 0,0 1,65.696 56.436,10.905 10.858,0 0,1 54.792,45.578 10.905,10.858 0,0 1,65.696 34.72,10.905 10.858,0 0,1 76.601,45.578ZM112.138,45.577A10.905,10.858 0,0 1,101.233 56.435,10.905 10.858,0 0,1 90.328,45.577 10.905,10.858 0,0 1,101.233 34.719,10.905 10.858,0 0,1 112.138,45.577ZM71.759,28.854 L85.541,45.518h15.751L90.464,28.854L71.759,28.854M85.541,45.518 L90.464,24.933m0,0 l4.798,-0.015M65.852,45.513 L74.057,21.188h7.876" | ||
android:strokeLineJoin="round" | ||
android:strokeWidth="4" | ||
android:strokeColor="#fff" | ||
android:strokeLineCap="round"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content"> | ||
|
||
<include layout="@layout/fragment_overlay_street_side_puzzle_with_last_answer_button"/> | ||
|
||
<FrameLayout | ||
android:id="@+id/signContainer" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_centerInParent="true" | ||
android:scaleX="0.5" | ||
android:scaleY="0.5" | ||
android:alpha="0.75"/> | ||
|
||
</RelativeLayout> |
Oops, something went wrong.