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

Add bike parking access and fee quests #2517

Merged
merged 9 commits into from
Jan 20, 2021
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,8 @@ object AchievementsModule {
"AddBikeParkingCapacity",
"AddBikeParkingCover",
"AddBikeParkingType",
"AddBikeParkingAccess",
"AddBikeParkingFee",
"AddCyclewaySegregation",
"AddPathSurface",
"AddStepsRamp",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ import de.westnordost.streetcomplete.quests.existence.CheckExistence
import de.westnordost.streetcomplete.quests.lanes.AddLanes
import de.westnordost.streetcomplete.quests.kerb_height.AddKerbHeight
import de.westnordost.streetcomplete.quests.orchard_produce.AddOrchardProduce
import de.westnordost.streetcomplete.quests.parking_access.AddBikeParkingAccess
import de.westnordost.streetcomplete.quests.parking_access.AddParkingAccess
import de.westnordost.streetcomplete.quests.parking_fee.AddBikeParkingFee
import de.westnordost.streetcomplete.quests.parking_fee.AddParkingFee
import de.westnordost.streetcomplete.quests.parking_type.AddParkingType
import de.westnordost.streetcomplete.quests.place_name.AddPlaceName
Expand Down Expand Up @@ -165,6 +167,8 @@ import javax.inject.Singleton
AddMaxWeight(), // used by OSRM and other routing engines
AddForestLeafType(), // used by OSM Carto
AddBikeParkingType(), // used by OsmAnd
AddBikeParkingAccess(),
AddBikeParkingFee(),
AddStepsRamp(),
AddWheelchairAccessToilets(), // used by wheelmap, OsmAnd, MAPS.ME
AddPlaygroundAccess(), //late as in many areas all needed access=private is already mapped
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package de.westnordost.streetcomplete.quests.parking_access

import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.data.osm.osmquest.OsmFilterQuestType
import de.westnordost.streetcomplete.data.osm.changes.StringMapChangesBuilder

class AddBikeParkingAccess : OsmFilterQuestType<ParkingAccess>() {

// Only include these bicycle_parking types, because access for these types is needed for
// AddBikeParkingFee and because those are uncontroversial. See #2496 and #2517
override val elementFilter = """
nodes, ways, relations with amenity = bicycle_parking
and bicycle_parking ~ building|lockers|shed
and (!access or access = unknown)
"""

override val commitMessage = "Add type of bike parking access"
override val wikiLink = "Tag:amenity=bicycle_parking"
override val icon = R.drawable.ic_quest_bicycle_parking_access

override fun getTitle(tags: Map<String, String>) = R.string.quest_bicycle_parking_access_title

override fun createForm() = AddParkingAccessForm()

override fun applyAnswerTo(answer: ParkingAccess, changes: StringMapChangesBuilder) {
changes.addOrModify("access", answer.osmValue)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package de.westnordost.streetcomplete.quests.parking_fee

import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.data.osm.osmquest.OsmFilterQuestType
import de.westnordost.streetcomplete.data.osm.changes.StringMapChangesBuilder

class AddBikeParkingFee : OsmFilterQuestType<FeeAnswer>() {

// element selection logic by @DerDings in #2507
override val elementFilter = """
nodes, ways, relations with amenity = bicycle_parking
and access ~ yes|customers|public
and (
name
or bicycle_parking ~ building|lockers|shed
or capacity >= 100
)
and (
!fee and !fee:conditional
or fee older today -8 years
)
"""
override val commitMessage = "Add whether there is a bike parking fee"
override val wikiLink = "Tag:amenity=bicycle_parking"
override val icon = R.drawable.ic_quest_bicycle_parking_fee

override fun getTitle(tags: Map<String, String>) = R.string.quest_bicycle_parking_fee_title

override fun createForm() = AddParkingFeeForm()

override fun applyAnswerTo(answer: FeeAnswer, changes: StringMapChangesBuilder) = answer.applyTo(changes)
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package de.westnordost.streetcomplete.quests.parking_fee

import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.data.meta.updateWithCheckDate
import de.westnordost.streetcomplete.data.osm.osmquest.OsmFilterQuestType
import de.westnordost.streetcomplete.data.osm.changes.StringMapChangesBuilder

Expand All @@ -23,24 +22,5 @@ class AddParkingFee : OsmFilterQuestType<FeeAnswer>() {

override fun createForm() = AddParkingFeeForm()

override fun applyAnswerTo(answer: FeeAnswer, changes: StringMapChangesBuilder) {
when(answer) {
is HasFee -> {
changes.updateWithCheckDate("fee", "yes")
changes.deleteIfExists("fee:conditional")
}
is HasNoFee -> {
changes.updateWithCheckDate("fee", "no")
changes.deleteIfExists("fee:conditional")
}
is HasFeeAtHours -> {
changes.updateWithCheckDate("fee", "no")
changes.addOrModify("fee:conditional", "yes @ (${answer.openingHours})")
}
is HasFeeExceptAtHours -> {
changes.updateWithCheckDate("fee", "yes")
changes.addOrModify("fee:conditional", "no @ (${answer.openingHours})")
}
}
}
override fun applyAnswerTo(answer: FeeAnswer, changes: StringMapChangesBuilder) = answer.applyTo(changes)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package de.westnordost.streetcomplete.quests.parking_fee

import de.westnordost.streetcomplete.data.meta.updateWithCheckDate
import de.westnordost.streetcomplete.data.osm.changes.StringMapChangesBuilder
import de.westnordost.streetcomplete.quests.opening_hours.model.OpeningHoursRuleList


Expand All @@ -9,3 +11,24 @@ object HasFee : FeeAnswer()
object HasNoFee : FeeAnswer()
data class HasFeeAtHours(val openingHours: OpeningHoursRuleList) : FeeAnswer()
data class HasFeeExceptAtHours(val openingHours: OpeningHoursRuleList) : FeeAnswer()

fun FeeAnswer.applyTo(changes: StringMapChangesBuilder) {
when(this) {
is HasFee -> {
changes.updateWithCheckDate("fee", "yes")
changes.deleteIfExists("fee:conditional")
}
is HasNoFee -> {
changes.updateWithCheckDate("fee", "no")
changes.deleteIfExists("fee:conditional")
}
is HasFeeAtHours -> {
changes.updateWithCheckDate("fee", "no")
changes.addOrModify("fee:conditional", "yes @ (${openingHours})")
}
is HasFeeExceptAtHours -> {
changes.updateWithCheckDate("fee", "yes")
changes.addOrModify("fee:conditional", "no @ (${openingHours})")
}
}
}
51 changes: 51 additions & 0 deletions app/src/main/res/drawable/ic_quest_bicycle_parking_access.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<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="m128,64c0,35.346 -28.654,64 -64,64s-64,-28.654 -64,-64 28.654,-64 64,-64 64,28.654 64,64"
android:strokeWidth=".2"
android:fillColor="#ca72e2"/>
<path
android:pathData="m36.222,24h55.056c4.694,0 8.472,3.779 8.472,8.472v63.056c0,4.694 -3.779,8.472 -8.472,8.472h-55.056c-4.694,0 -8.472,-3.779 -8.472,-8.472v-63.056c0,-4.694 3.779,-8.472 8.472,-8.472z"
android:strokeAlpha="0.2"
android:strokeWidth="8"
android:fillColor="#00000000"
android:strokeColor="#000"/>
<path
android:pathData="m36.347,20.111h55.056c4.694,0 8.472,3.779 8.472,8.472v63.056c0,4.694 -3.779,8.472 -8.472,8.472h-55.056c-4.694,0 -8.472,-3.779 -8.472,-8.472v-63.056c0,-4.694 3.779,-8.472 8.472,-8.472z"
android:strokeAlpha="0.98995"
android:strokeWidth="8"
android:fillColor="#495aad"
android:strokeColor="#fff"/>
<path
android:pathData="m67.194,83.081a7.194,7.194 0,0 1,-7.194 7.194,7.194 7.194,0 0,1 -7.194,-7.194 7.194,7.194 0,0 1,7.194 -7.194,7.194 7.194,0 0,1 7.194,7.194m23.443,-0.001a7.194,7.194 0,0 1,-7.194 7.194,7.194 7.194,0 0,1 -7.194,-7.194 7.194,7.194 0,0 1,7.194 -7.194,7.194 7.194,0 0,1 7.194,7.194m-26.637,-11.08 l9.092,11.04h10.391l-7.144,-11.04h-12.339m12.339,-2.598 l3.165,-0.007m-6.412,13.644 l3.247,-13.638m-16.236,13.638 l5.413,-16.115h5.195"
android:strokeLineJoin="round"
android:strokeWidth="2.5"
android:fillColor="#00000000"
android:strokeColor="#fff"
android:strokeLineCap="round"/>
<path
android:pathData="m44,76v-40h12s12,0 12,12 -12,12 -12,12h-12"
android:strokeWidth="8"
android:fillColor="#00000000"
android:strokeColor="#fff"
android:strokeLineCap="square"/>
<path
android:fillColor="#FF000000"
android:pathData="m97.3,58.6c-4.363,0 -8.712,1.675 -12.012,5.025 -5.5,5.5 -6.544,13.986 -3.145,20.486l-26,26v6l2,2h10l3,-3v-6l1,-1h6l6,-6v-6l5,-5c6.5,3.6 14.744,2.313 20.144,-3.188 6.8,-6.7 6.8,-17.599 0.1,-24.299 -3.35,-3.35 -7.725,-5.025 -12.088,-5.025zM100.939,66.924c1.325,0 2.65,0.5 3.65,1.5 2.1,2 2.1,5.3 0,7.4 -2,2 -5.301,2 -7.301,0s-2,-5.3 0,-7.4c1,-1 2.325,-1.5 3.65,-1.5z"
android:fillAlpha="0.2"/>
<path
android:pathData="m109.42,59.63c-6.7,-6.7 -17.5,-6.7 -24.1,0 -5.5,5.5 -6.544,13.988 -3.144,20.488l-26,26v6l2,2h4l27,-27c6.5,3.6 14.744,2.313 20.144,-3.188 6.8,-6.7 6.8,-17.6 0.1,-24.3m-4.8,12.2c-2,2 -5.3,2 -7.3,0s-2,-5.3 0,-7.4c2,-2 5.3,-2 7.3,0 2.1,2 2.1,5.3 0,7.4"
android:fillColor="#eda432"/>
<path
android:pathData="m71.15,111.12v-6l-9,9h6z"
android:fillColor="#d68c3a"/>
<path
android:pathData="m84.15,98.11v-6l-12.056,12h6.056z"
android:fillColor="#d68c3a"/>
<path
android:pathData="m85.15,83.11 l-29,29 2,2 29,-29z"
android:fillColor="#d68c3a"/>
</vector>
54 changes: 54 additions & 0 deletions app/src/main/res/drawable/ic_quest_bicycle_parking_fee.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<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="m128,64c0,35.346 -28.654,64 -64,64s-64,-28.654 -64,-64 28.654,-64 64,-64 64,28.654 64,64"
android:strokeWidth=".2"
android:fillColor="#ca72e2"/>
<path
android:pathData="m36.222,24h55.056c4.694,0 8.472,3.779 8.472,8.472v63.056c0,4.694 -3.779,8.472 -8.472,8.472h-55.056c-4.694,0 -8.472,-3.779 -8.472,-8.472v-63.056c0,-4.694 3.779,-8.472 8.472,-8.472z"
android:strokeAlpha="0.2"
android:strokeWidth="8"
android:fillColor="#00000000"
android:strokeColor="#000"/>
<path
android:pathData="m36.347,20.111h55.056c4.694,0 8.472,3.779 8.472,8.472v63.056c0,4.694 -3.779,8.472 -8.472,8.472h-55.056c-4.694,0 -8.472,-3.779 -8.472,-8.472v-63.056c0,-4.694 3.779,-8.472 8.472,-8.472z"
android:strokeAlpha="0.98995"
android:strokeWidth="8"
android:fillColor="#495aad"
android:strokeColor="#fff"/>
<path
android:pathData="m67.194,83.081a7.194,7.194 0,0 1,-7.194 7.194,7.194 7.194,0 0,1 -7.194,-7.194 7.194,7.194 0,0 1,7.194 -7.194,7.194 7.194,0 0,1 7.194,7.194m23.443,-0.001a7.194,7.194 0,0 1,-7.194 7.194,7.194 7.194,0 0,1 -7.194,-7.194 7.194,7.194 0,0 1,7.194 -7.194,7.194 7.194,0 0,1 7.194,7.194m-26.637,-11.08 l9.092,11.04h10.391l-7.144,-11.04h-12.339m12.339,-2.598 l3.165,-0.007m-6.412,13.644 l3.247,-13.638m-16.236,13.638 l5.413,-16.115h5.195"
android:strokeLineJoin="round"
android:strokeWidth="2.5"
android:fillColor="#00000000"
android:strokeColor="#fff"
android:strokeLineCap="round"/>
<path
android:pathData="m44,76v-40h12s12,0 12,12 -12,12 -12,12h-12"
android:strokeWidth="8"
android:fillColor="#00000000"
android:strokeColor="#fff"
android:strokeLineCap="square"/>
<path
android:pathData="m86.485,79.247a19.479,19.452 90,0 0,-19.452 19.479,19.479 19.452,90 0,0 19.452,19.479 19.479,19.452 90,0 0,19.452 -19.479,19.479 19.452,90 0,0 -19.452,-19.479z"
android:strokeAlpha="0.2"
android:strokeLineJoin="round"
android:strokeWidth="4.9318"
android:fillColor="#00000000"
android:strokeColor="#000"
android:strokeLineCap="round"/>
<path
android:pathData="m105.937,95.447a19.479,19.452 90,0 1,-19.452 19.479,19.479 19.452,90 0,1 -19.452,-19.479 19.479,19.452 90,0 1,19.452 -19.479,19.479 19.452,90 0,1 19.452,19.479"
android:strokeLineJoin="round"
android:strokeWidth="4.9318"
android:fillColor="#dbdbdb"
android:strokeColor="#a6a6a6"
android:strokeLineCap="round"/>
<path
android:pathData="m84.054,81.682l0,2.364c-1.242,0.284 -2.31,0.802 -3.204,1.555 -1.596,1.344 -2.394,3.094 -2.394,5.25 0,1.53 0.355,2.756 1.064,3.678s1.608,1.606 2.698,2.054c1.097,0.44 2.474,0.833 4.128,1.179 1.283,0.287 2.258,0.579 2.925,0.875 0.675,0.296 1.013,0.85 1.013,1.661 0,0.845 -0.355,1.458 -1.064,1.839 -0.709,0.372 -1.528,0.558 -2.457,0.558 -2.524,0 -4.082,-1.057 -4.673,-3.17l-4.825,1.141c0.473,2.071 1.532,3.623 3.179,4.654 1.073,0.667 2.278,1.112 3.609,1.344l0,2.612l4.863,0l0,-2.638c1.568,-0.273 2.876,-0.806 3.913,-1.611 1.832,-1.437 2.748,-3.306 2.748,-5.605 0,-2.257 -0.967,-4.024 -2.9,-5.301 -0.692,-0.473 -1.418,-0.816 -2.178,-1.027 -0.751,-0.211 -1.98,-0.507 -3.685,-0.888 -2.178,-0.364 -3.267,-1.112 -3.267,-2.245 0,-1.42 1.038,-2.131 3.115,-2.131 1.959,0 3.255,0.884 3.888,2.651l4.407,-1.446c-0.977,-2.813 -2.992,-4.493 -6.041,-5.046l0,-2.31z"
android:strokeWidth="1.5202"
android:fillColor="#a6a6a6"/>
</vector>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,8 @@ Otherwise, you can download another keyboard in the app store. Popular keyboards
<string name="quest_bicycle_parking_type_locker">Locker</string>
<string name="quest_bicycle_parking_type_building">Building</string>
<string name="quest_bicycle_parking_type_title">What type of bicycle parking is this?</string>
<string name="quest_bicycle_parking_access_title">Is it restricted who may park a bike here?</string>
<string name="quest_bicycle_parking_fee_title">Do you have to pay to park a bike here?</string>
<string name="quest_cycleway_value_suggestion_lane">bicycle suggestion lane</string>
<string name="quest_postboxCollectionTimes_title">What are the collection times of this postbox?</string>
<string name="quest_postboxCollectionTimes_name_title">What are the collection times of this %s postbox?</string>
Expand Down
19 changes: 19 additions & 0 deletions res/graphics/quest icons/bicycle_parking_access.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading