Skip to content

Commit

Permalink
Add Swimming Pool Availability Quest (#667)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcliquid authored Sep 29, 2024
1 parent 781731a commit a504308
Show file tree
Hide file tree
Showing 8 changed files with 116 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ import de.westnordost.streetcomplete.quests.trail_visibility.AddTrailVisibility
import de.westnordost.streetcomplete.quests.tree.AddTreeGenus
import de.westnordost.streetcomplete.quests.sac_scale.AddSacScale
import de.westnordost.streetcomplete.quests.sauna_availability.AddSaunaAvailability
import de.westnordost.streetcomplete.quests.swimming_pool_availability.AddSwimmingPoolAvailability
import de.westnordost.streetcomplete.quests.valves.AddValves
import de.westnordost.streetcomplete.quests.via_ferrata_scale.AddViaFerrataScale
import de.westnordost.streetcomplete.quests.way_lit.AddWayLit
Expand Down Expand Up @@ -635,6 +636,7 @@ fun getQuestTypeList(
EE_QUEST_OFFSET + 47 to AddParkingOrientation(),
EE_QUEST_OFFSET + 50 to AddCaravanSiteType(),
EE_QUEST_OFFSET + 52 to AddSaunaAvailability(),
EE_QUEST_OFFSET + 53 to AddSwimmingPoolAvailability(),
EE_QUEST_OFFSET + 10 to OsmoseQuest(osmoseDao),
EE_QUEST_OFFSET + 11 to CustomQuest(customQuestList),
// POI quests
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package de.westnordost.streetcomplete.quests.swimming_pool_availability

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.osm.Tags
import de.westnordost.streetcomplete.osm.isPlaceOrDisusedPlace
import de.westnordost.streetcomplete.osm.updateWithCheckDate

class AddSwimmingPoolAvailability : OsmFilterQuestType<SwimmingPoolAvailability>() {

override val elementFilter = """
nodes, ways with
(
leisure = resort
or (leisure = sports_hall and sport = swimming)
or tourism ~ camp_site|hotel
)
and !swimming_pool
"""
override val changesetComment = "Survey whether places have a swimming pool"
override val wikiLink = "Key:swimming_pool"
override val icon = R.drawable.ic_quest_swimming_pool
override val isReplacePlaceEnabled = true
override val defaultDisabledMessage = R.string.default_disabled_msg_ee

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

override fun getHighlightedElements(element: Element, getMapData: () -> MapDataWithGeometry) =
getMapData().filter("""
nodes, ways with
(
leisure ~ resort|swimming_pool
or (leisure = sports_hall and sport = swimming)
or tourism ~ camp_site|hotel
)
""")

override fun createForm() = AddSwimmingPoolAvailabilityForm()

override fun applyAnswerTo(answer: SwimmingPoolAvailability, tags: Tags, geometry: ElementGeometry, timestampEdited: Long) {
tags.updateWithCheckDate("swimming_pool", answer.osmValue)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package de.westnordost.streetcomplete.quests.swimming_pool_availability

import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.quests.AListQuestForm
import de.westnordost.streetcomplete.quests.TextItem
import de.westnordost.streetcomplete.quests.swimming_pool_availability.SwimmingPoolAvailability.INDOOR_AND_OUTDOOR
import de.westnordost.streetcomplete.quests.swimming_pool_availability.SwimmingPoolAvailability.NO
import de.westnordost.streetcomplete.quests.swimming_pool_availability.SwimmingPoolAvailability.ONLY_INDOOR
import de.westnordost.streetcomplete.quests.swimming_pool_availability.SwimmingPoolAvailability.ONLY_OUTDOOR

class AddSwimmingPoolAvailabilityForm : AListQuestForm<SwimmingPoolAvailability>() {
override val items = listOf(
TextItem(INDOOR_AND_OUTDOOR, R.string.quest_swimming_pool_indoor_and_outdoor),
TextItem(ONLY_INDOOR, R.string.quest_swimming_pool_indoor_only),
TextItem(ONLY_OUTDOOR, R.string.quest_swimming_pool_outdoor_only),
TextItem(NO, R.string.quest_swimming_pool_no),
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package de.westnordost.streetcomplete.quests.swimming_pool_availability

enum class SwimmingPoolAvailability(val osmValue: String) {
NO("no"),
ONLY_INDOOR("indoor"),
ONLY_OUTDOOR("outdoor"),
INDOOR_AND_OUTDOOR("indoor;outdoor"),
}
12 changes: 12 additions & 0 deletions app/src/main/res/drawable/ic_quest_swimming_pool.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<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.3 -28.7,64 -64,64S0,99.3 0,64 28.7,0 64,0s64,28.7 64,64"
android:fillColor="#9bbe55"/>
<path
android:pathData="M74.3,22.8c-0.8,0 -1.5,0.3 -2.3,0.8l-25,13.3c-3.2,1.5 -4.4,6.1 -2.3,8.9l6.7,10.5 -28.9,16.3 0.3,5.1s3.9,-3.1 8,-3.1 11.7,6.1 16.5,6.1 12.3,-6.1 16.5,-6.1 12.2,6.1 16.5,6.1h2.8l-23.4,-36.7 17.3,-8.9c3.7,-2.1 4.9,-5.8 3.3,-8.4 -1.4,-2.4 -3.6,-4 -5.9,-3.8ZM88.5,44c-6.8,0 -12.4,5.5 -12.4,12.2s5.5,12.2 12.4,12.2 12.4,-5.5 12.4,-12.2 -5.5,-12.2 -12.4,-12.2ZM30.8,86.8c-2.6,0 -6.6,2.2 -10.2,4v12.4c3.7,-1.8 7.8,-4.2 10.2,-4.2 4.2,0 12.1,6.1 16.5,6.1s12.3,-6.1 16.5,-6.1 12.5,6.1 16.5,6.1 12.6,-6.1 16.5,-6.1 6.7,2.4 10.5,4.2l0.3,-12.4c-3.7,-1.8 -8.1,-4.2 -10.8,-4 -3.9,0 -12.1,6.1 -16.5,6.1s-12.3,-6.1 -16.5,-6.1 -12.8,6.1 -16.5,6.1 -12.1,-6.1 -16.5,-6.1Z"
android:fillColor="#fff"/>
</vector>
7 changes: 7 additions & 0 deletions app/src/main/res/values/strings_ee.xml
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,13 @@
<!-- sauna availability quest -->
<string name="quest_saunaAvailability_title">Is there a sauna here?</string>

<!-- swimming pool availability quest -->
<string name="quest_swimmingPoolAvailability_title">Is there a swimming pool here?</string>
<string name="quest_swimming_pool_indoor_and_outdoor">Both (indoor and outdoor)</string>
<string name="quest_swimming_pool_indoor_only">Only indoor</string>
<string name="quest_swimming_pool_outdoor_only">Only outdoor</string>
<string name="quest_swimming_pool_no">No swimming pool</string>

<!-- service building type -->
<string name="quest_service_building_type_title">What kind of service building is this?</string>
<string name="quest_service_building_type_substation">Electrical substation</string>
Expand Down
1 change: 1 addition & 0 deletions res/graphics/authors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ quest/
summit_cross.svg based on peak.svg which is (c) 2020 Mateusz Konieczny and Tobias Zwick (CC-BY-SA 4.0), with cross added by Flo Edelmann (so also CC-BY-SA 4.0)
surveillance.svg
surveillance_camera.svg
swimming_pool.svg modified by mcliquid based on Kocio CC0 1.0 from https://wiki.openstreetmap.org/wiki/File:Swimming-16.svg
tent.svg
toilets.svg
toilet_fee.svg
Expand Down
21 changes: 21 additions & 0 deletions res/graphics/quest/swimming_pool.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a504308

Please sign in to comment.