Skip to content

Commit

Permalink
add bicycle repair station equipment quest (fixes #5910) (#6008)
Browse files Browse the repository at this point in the history
  • Loading branch information
westnordost authored Nov 18, 2024
1 parent b8e75ef commit 147cb25
Show file tree
Hide file tree
Showing 28 changed files with 196 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import de.westnordost.streetcomplete.quests.address.AddAddressStreet
import de.westnordost.streetcomplete.quests.address.AddHousenumber
import de.westnordost.streetcomplete.quests.air_conditioning.AddAirConditioning
import de.westnordost.streetcomplete.quests.air_pump.AddAirCompressor
import de.westnordost.streetcomplete.quests.air_pump.AddBicyclePump
import de.westnordost.streetcomplete.quests.bike_shop.AddBicyclePump
import de.westnordost.streetcomplete.quests.amenity_cover.AddAmenityCover
import de.westnordost.streetcomplete.quests.amenity_indoor.AddIsAmenityIndoor
import de.westnordost.streetcomplete.quests.atm_cashin.AddAtmCashIn
Expand All @@ -32,6 +32,7 @@ import de.westnordost.streetcomplete.quests.barrier_type.AddBarrierType
import de.westnordost.streetcomplete.quests.barrier_type.AddStileType
import de.westnordost.streetcomplete.quests.bbq_fuel.AddBbqFuel
import de.westnordost.streetcomplete.quests.bench_backrest.AddBenchBackrest
import de.westnordost.streetcomplete.quests.bicycle_repair_station.AddBicycleRepairStationServices
import de.westnordost.streetcomplete.quests.bike_parking_capacity.AddBikeParkingCapacity
import de.westnordost.streetcomplete.quests.bike_parking_cover.AddBikeParkingCover
import de.westnordost.streetcomplete.quests.bike_parking_type.AddBikeParkingType
Expand Down Expand Up @@ -289,7 +290,7 @@ fun questTypeRegistry(

26 to AddReligionToPlaceOfWorship(), // icons on maps are different - OSM Carto, mapy.cz, OsmAnd, Sputnik etc
27 to AddReligionToWaysideShrine(),

172 to AddPowerAttachment(),
28 to AddPowerPolesMaterial(),

Expand Down Expand Up @@ -383,6 +384,8 @@ fun questTypeRegistry(
73 to AddBikeRentalCapacity(), // less ambiguous than bike parking
74 to AddBikeParkingCapacity(), // used by cycle map layer on osm.org, OsmAnd

173 to AddBicycleRepairStationServices(),

167 to AddParcelLockerBrand(),

// address: usually only visible when just in front + sometimes requires to take "other answer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ import de.westnordost.streetcomplete.util.ktx.toYesNo
class AddAirCompressor : OsmFilterQuestType<Boolean>() {

override val elementFilter = """
nodes, ways with
amenity = fuel
and (
!compressed_air
or compressed_air older today -6 years
)
and access !~ private|no
nodes, ways with
amenity = fuel
and (
!compressed_air
or compressed_air older today -6 years
)
"""

override val changesetComment = "Survey availability of air compressors"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package de.westnordost.streetcomplete.quests.bicycle_repair_station

import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.data.osm.geometry.ElementGeometry
import de.westnordost.streetcomplete.data.osm.mapdata.Element
import de.westnordost.streetcomplete.data.osm.mapdata.MapDataWithGeometry
import de.westnordost.streetcomplete.data.osm.mapdata.filter
import de.westnordost.streetcomplete.data.osm.osmquests.OsmFilterQuestType
import de.westnordost.streetcomplete.data.user.achievements.EditTypeAchievement.BICYCLIST
import de.westnordost.streetcomplete.osm.Tags
import de.westnordost.streetcomplete.util.ktx.toYesNo

class AddBicycleRepairStationServices : OsmFilterQuestType<List<BicycleRepairStationService>>() {

override val elementFilter = """
nodes, ways with
amenity = bicycle_repair_station
and (
!service:bicycle:pump
or !service:bicycle:stand
or !service:bicycle:tools
or !service:bicycle:chain_tool
)
and access !~ private|no
"""

override val changesetComment = "Specify features of bicycle repair stations"
override val wikiLink = "Tag:amenity=bicycle_repair_station"
override val icon = R.drawable.ic_quest_bicycle_repair_amenity
override val isDeleteElementEnabled = true
override val achievements = listOf(BICYCLIST)

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

override fun createForm() = AddBicycleRepairStationServicesForm()

override fun getHighlightedElements(element: Element, getMapData: () -> MapDataWithGeometry) =
getMapData().filter("""
nodes, ways with
amenity ~ bicycle_repair_station|compressed_air
""")

override fun applyAnswerTo(answer: List<BicycleRepairStationService>, tags: Tags, geometry: ElementGeometry, timestampEdited: Long) {
for (entry in BicycleRepairStationService.entries) {
tags["service:bicycle:${entry.value}"] = (entry in answer).toYesNo()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package de.westnordost.streetcomplete.quests.bicycle_repair_station

import de.westnordost.streetcomplete.quests.AImageListQuestForm

class AddBicycleRepairStationServicesForm : AImageListQuestForm<BicycleRepairStationService, List<BicycleRepairStationService>>() {

override val items get() = BicycleRepairStationService.entries.map { it.asItem() }

override val maxSelectableItems = -1
override val itemsPerRow = 3

override fun onClickOk(selectedItems: List<BicycleRepairStationService>) {
applyAnswer(selectedItems)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package de.westnordost.streetcomplete.quests.bicycle_repair_station

enum class BicycleRepairStationService(val value: String) {
PUMP("pump"),
TOOLS("tools"),
STAND("stand"),
CHAIN_TOOL("chain_tool"),
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package de.westnordost.streetcomplete.quests.bicycle_repair_station

import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.quests.bicycle_repair_station.BicycleRepairStationService.*
import de.westnordost.streetcomplete.view.image_select.Item

fun BicycleRepairStationService.asItem(): Item<BicycleRepairStationService> =
Item(this, iconResId, titleResId)

val BicycleRepairStationService.titleResId: Int get() = when (this) {
PUMP -> R.string.quest_bicycle_repair_station_pump
TOOLS -> R.string.quest_bicycle_repair_station_tools
STAND -> R.string.quest_bicycle_repair_station_stand
CHAIN_TOOL -> R.string.quest_bicycle_repair_station_chain_tool
}

val BicycleRepairStationService.iconResId: Int get() = when (this) {
PUMP -> R.drawable.bicycle_repair_station_pump
TOOLS -> R.drawable.bicycle_repair_station_tools
STAND -> R.drawable.bicycle_repair_station_stand
CHAIN_TOOL -> R.drawable.bicycle_repair_station_chain_tool
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.westnordost.streetcomplete.quests.air_pump
package de.westnordost.streetcomplete.quests.bike_shop

import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.data.osm.geometry.ElementGeometry
Expand All @@ -8,47 +8,31 @@ import de.westnordost.streetcomplete.data.osm.mapdata.filter
import de.westnordost.streetcomplete.data.osm.osmquests.OsmFilterQuestType
import de.westnordost.streetcomplete.data.user.achievements.EditTypeAchievement.BICYCLIST
import de.westnordost.streetcomplete.osm.Tags
import de.westnordost.streetcomplete.osm.isPlaceOrDisusedPlace
import de.westnordost.streetcomplete.osm.updateWithCheckDate
import de.westnordost.streetcomplete.quests.YesNoQuestForm
import de.westnordost.streetcomplete.util.ktx.toYesNo

class AddBicyclePump : OsmFilterQuestType<Boolean>() {

/* if service:bicycle:pump is undefined, nothing has been said about its existence;
* see https://wiki.openstreetmap.org/wiki/Tag:shop=bicycle#Additional_keys
*
* Also, "access=customers" + "service:bicycle:pump=yes" is an invalid combination, as the wiki states that
* "yes" means "a feature has a bicycle pump which can be used by anybody, not only customers"
*/
override val elementFilter = """
nodes, ways with
(amenity = bicycle_repair_station or shop = bicycle)
shop = bicycle
and !compressed_air
and (
!compressed_air and !service:bicycle:pump
!service:bicycle:pump
or service:bicycle:pump older today -6 years
)
and access !~ private|no|customers
"""
override val changesetComment = "Survey whether bicycle pumps are available"
override val changesetComment = "Survey whether shop offers public pump"
override val wikiLink = "Key:service:bicycle:pump"
override val icon = R.drawable.ic_quest_bicycle_pump
override val achievements = listOf(BICYCLIST)

override fun getTitle(tags: Map<String, String>) =
if (tags["shop"] == "bicycle") {
R.string.quest_air_pump_bicycle_shop_title
} else {
R.string.quest_air_pump_bicycle_repair_station_title
}
override fun getTitle(tags: Map<String, String>) = R.string.quest_air_pump_bicycle_shop_title

override fun getHighlightedElements(element: Element, getMapData: () -> MapDataWithGeometry) =
getMapData().filter("""
nodes, ways with
compressed_air = yes
or service:bicycle:pump = yes
or amenity ~ compressed_air|bicycle_repair_station
or shop = bicycle
""")
getMapData().asSequence().filter { it.isPlaceOrDisusedPlace() }

override fun createForm() = YesNoQuestForm()

Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/authors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ bicycle_rental_dropoff_poin... CC-BY-SA 4.0 Alexander Migl https://commons.
bicycle_rental_human.jpg CC-BY-SA 2.0 TijsB https://commons.wikimedia.org/wiki/File:Tel_Aviv-_bike_rental_(5889990605).jpg
bicycle_rental_shop_with_re... CC-BY-SA 2.0 Darb02 https://commons.wikimedia.org/wiki/File:Rydjor_Bike_Shop_and_Antique_Bike_Museum.jpg

bicycle_repair_station_pump CC-BY-SA 4.0 Richard Huber https://commons.wikimedia.org/wiki/File:Station%C3%A4re_Fahrradpumpe.jpg
bicycle_repair_station_tools CC-BY-SA 4.0 Runner1928 https://commons.wikimedia.org/wiki/File:Bicycle_repair_stand_at_Fairview_Community_Center_02.jpg
bicycle_repair_station_stand CC-BY-SA 2.0 Takerlamar https://commons.wikimedia.org/wiki/File:Bicycle_repair_stand,_North_Balwyn_(30998499100).jpg
bicycle_repair_station_chai... CC-BY-SA 3.0 Magnus Manske https://commons.wikimedia.org/wiki/File:Kettennieter-3-g.jpg

bicycleway_moped.svg PD Ionutneagu https://www.svgrepo.com/download/490323/scooter-2.svg

bollard_fixed.jpg CC-BY-SA 4.0 Matija Nalis https://github.com/streetcomplete/StreetComplete/issues/3657#issuecomment-1020666101
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 56 additions & 0 deletions app/src/main/res/drawable/ic_quest_bicycle_repair_amenity.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<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.35 -28.65,64 -64,64s-64,-28.65 -64,-64 28.65,-64 64,-64 64,28.65 64,64"
android:fillColor="#ca72e2"/>
<path
android:fillColor="#000"
android:pathData="m61.25,57.77 l-10.48,0.07c-0.96,0.01 -1.81,0.62 -2.11,1.53l-5.83,17.36c-1.25,-0.27 -2.54,-0.42 -3.87,-0.42 -10.14,0 -18.43,8.29 -18.43,18.43 0,10.14 8.29,18.43 18.43,18.43 9.94,0 18.05,-7.97 18.37,-17.84 0.04,-0.2 0.06,-0.39 0.06,-0.59 -0,-0.19 -0.02,-0.39 -0.06,-0.58 -0.22,-6.98 -4.35,-13 -10.26,-15.94l1.02,-3.05 17.22,20.91c0.52,0.61 1.07,0.78 1.84,0.82h3.82c1.08,9.13 8.88,16.27 18.29,16.27 9.94,0 18.05,-7.97 18.37,-17.84 0.04,-0.2 0.06,-0.39 0.06,-0.59 -0,-0.2 -0.02,-0.4 -0.06,-0.59 -0.32,-9.87 -8.43,-17.84 -18.37,-17.84 -2.84,0 -5.52,0.67 -7.93,1.83l-5.43,-8.39c-0.13,-0.2 -0.29,-0.38 -0.48,-0.53l0.4,-1.67 4.94,0.09c1.24,0.02 2.27,-0.97 2.29,-2.21 0.02,-1.24 -0.96,-2.27 -2.21,-2.29l-10.65,-0.2c-1.24,-0.02 -2.27,0.97 -2.29,2.21 -0.02,1.24 0.97,2.26 2.21,2.29l1.1,0.02 -0.3,1.27h-20.65l2.15,-6.4 8.87,-0.06c1.24,-0.01 2.24,-1.02 2.23,-2.26 -0.01,-1.24 -1.02,-2.24 -2.26,-2.23zM52.3,73.23h17.53l-3.93,16.51zM74.01,75.12 L77.53,80.56c-3.52,2.92 -5.93,7.12 -6.54,11.86h-1.1zM38.96,82.32c0.66,0 1.31,0.07 1.94,0.16l-3.85,11.47c-0.4,1.18 0.24,2.45 1.41,2.85 1.18,0.39 2.45,-0.24 2.85,-1.42l3.84,-11.43c3.74,2.14 6.25,6.15 6.25,10.8 0,6.9 -5.53,12.43 -12.43,12.43 -6.9,0 -12.44,-5.53 -12.44,-12.43 0,-6.9 5.53,-12.44 12.44,-12.44zM89.25,82.32c6.9,0 12.44,5.53 12.44,12.44 0,6.9 -5.53,12.43 -12.44,12.43 -6.16,0 -11.22,-4.41 -12.24,-10.27h12.32c1.78,0 2.86,-1.97 1.89,-3.47l-6.62,-10.23c1.44,-0.57 3,-0.9 4.65,-0.9zM80.8,85.62 L85.2,92.42h-8.16c0.5,-2.67 1.85,-5.03 3.76,-6.8z"
android:fillAlpha="0.2"/>
<path
android:pathData="m54.29,90.66a15.44,15.44 0,0 1,-15.44 15.44,15.44 15.44,0 0,1 -15.44,-15.44 15.44,15.44 0,0 1,15.44 -15.44,15.44 15.44,0 0,1 15.44,15.44"
android:strokeLineJoin="round"
android:strokeWidth="6"
android:strokeColor="#555"
android:strokeLineCap="round"/>
<path
android:pathData="m66.95,90.58 l6.97,-29.28"
android:strokeLineJoin="round"
android:strokeWidth="4.5"
android:strokeColor="#ffe420"
android:strokeLineCap="round"/>
<path
android:pathData="m70.06,61.09 l10.65,0.2"
android:strokeLineJoin="round"
android:strokeWidth="4.5"
android:strokeColor="#555"
android:strokeLineCap="round"/>
<path
android:pathData="m104.62,90.66a15.44,15.44 0,0 1,-15.44 15.44,15.44 15.44,0 0,1 -15.44,-15.44 15.44,15.44 0,0 1,15.44 -15.44,15.44 15.44,0 0,1 15.44,15.44"
android:strokeLineJoin="round"
android:strokeWidth="6"
android:strokeColor="#555"
android:strokeLineCap="round"/>
<path
android:pathData="m47.43,66.88 l19.52,23.7l22.31,0l-15.34,-23.7l-26.49,0"
android:strokeLineJoin="round"
android:strokeWidth="4.5"
android:strokeColor="#ffe420"
android:strokeLineCap="round"/>
<path
android:pathData="m39.06,90.58 l11.62,-34.6 10.49,-0.08"
android:strokeLineJoin="round"
android:strokeWidth="4.5"
android:strokeColor="#ffe420"
android:strokeLineCap="round"/>
<path
android:fillColor="#000"
android:pathData="m36,22a16,16 0,0 0,-14.39 9h16.39v14h-16.39a16,16 0,0 0,14.39 9,16 16,0 0,0 14.83,-10h26.34a16,16 0,0 0,14.83 10,16 16,0 0,0 14.39,-9h-16.39v-14h16.39a16,16 0,0 0,-14.39 -9,16 16,0 0,0 -14.83,10h-26.34a16,16 0,0 0,-14.83 -10z"
android:fillAlpha="0.2"/>
<path
android:pathData="m36,18a16,16 0,0 0,-14.39 9h16.39v14h-16.39a16,16 0,0 0,14.39 9,16 16,0 0,0 14.83,-10h26.34a16,16 0,0 0,14.83 10,16 16,0 0,0 14.39,-9h-16.39v-14h16.39a16,16 0,0 0,-14.39 -9,16 16,0 0,0 -14.83,10h-26.34a16,16 0,0 0,-14.83 -10z"
android:fillColor="#fff"/>
</vector>
7 changes: 6 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,12 @@ Before uploading your changes, the app checks with a &lt;a href=\"https://www.we
<string name="quest_bicycle_rental_type_human">Staffed bicycle rental</string>
<string name="quest_bicycle_rental_type_shop_with_rental">Bicycle store that also rents bicycles</string>

<string name="quest_bicycle_repair_station_services_title">What bicycle equipment is available here?</string>
<string name="quest_bicycle_repair_station_pump">Pump</string>
<string name="quest_bicycle_repair_station_tools">Various tools</string>
<string name="quest_bicycle_repair_station_stand">Work stand</string>
<string name="quest_bicycle_repair_station_chain_tool">Chain tool</string>

<string name="quest_bicycle_shop_repair_title">Are bicycle repair services offered here?</string>

<string name="quest_bicycle_shop_second_hand_title">Are second-hand bicycles sold here?</string>
Expand All @@ -797,7 +803,6 @@ Before uploading your changes, the app checks with a &lt;a href=\"https://www.we
<string name="quest_bikeParkingCapacity_hint">"Note that you can usually park one bicycle on each side of a stand."</string>

<string name="quest_air_pump_bicycle_shop_title">Is there a public bicycle pump here (at least when it’s open)?</string>
<string name="quest_air_pump_bicycle_repair_station_title">Is there a working bicycle pump here?</string>
<string name="quest_air_pump_compressor_title">Is there an air compressor available here?</string>

<string name="quest_board_name_title">"What’s the title of this information board?"</string>
Expand Down
3 changes: 2 additions & 1 deletion res/graphics/authors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ boat_rental/
jetski.svg Australian Water Safety Council, License: PD
kayak.svg Australian Water Safety Council, License: PD
motorboat.svg modified images from Australian Water Safety Council, License: PD
pedalboat.svg
pedalboat.svg
rowboat.svg mashup of different images from Australian Water Safety Council, License: PD
sailboard.svg Australian Water Safety Council, License: PD
sailboat.svg Australian Water Safety Council, License: PD
Expand Down Expand Up @@ -291,6 +291,7 @@ quest/
bicycle_rental.svg
bicycle_rental_capacity.svg Flo Edelmann edited bicycle_rental.svg made by Tobias Zwick (CC-BY-SA 4.0)
bicycle_repair.svg
bicycle_repair_amenity.svg
bicycle_second_hand.svg
bicycleway.svg
bicycleway_surface.svg
Expand Down
Loading

0 comments on commit 147cb25

Please sign in to comment.