diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/QuestsModule.kt b/app/src/main/java/de/westnordost/streetcomplete/quests/QuestsModule.kt index a8327c6c60..d088b6af6d 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/quests/QuestsModule.kt +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/QuestsModule.kt @@ -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 @@ -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 diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/swimming_pool_availability/AddSwimmingPoolAvailability.kt b/app/src/main/java/de/westnordost/streetcomplete/quests/swimming_pool_availability/AddSwimmingPoolAvailability.kt new file mode 100644 index 0000000000..7b577e3d44 --- /dev/null +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/swimming_pool_availability/AddSwimmingPoolAvailability.kt @@ -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() { + + 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) = 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) + } +} diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/swimming_pool_availability/AddSwimmingPoolAvailabilityForm.kt b/app/src/main/java/de/westnordost/streetcomplete/quests/swimming_pool_availability/AddSwimmingPoolAvailabilityForm.kt new file mode 100644 index 0000000000..1a76526bfb --- /dev/null +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/swimming_pool_availability/AddSwimmingPoolAvailabilityForm.kt @@ -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() { + 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), + ) +} diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/swimming_pool_availability/SwimmingPoolAvailability.kt b/app/src/main/java/de/westnordost/streetcomplete/quests/swimming_pool_availability/SwimmingPoolAvailability.kt new file mode 100644 index 0000000000..b7bc654f17 --- /dev/null +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/swimming_pool_availability/SwimmingPoolAvailability.kt @@ -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"), +} diff --git a/app/src/main/res/drawable/ic_quest_swimming_pool.xml b/app/src/main/res/drawable/ic_quest_swimming_pool.xml new file mode 100644 index 0000000000..4b2bf52776 --- /dev/null +++ b/app/src/main/res/drawable/ic_quest_swimming_pool.xml @@ -0,0 +1,12 @@ + + + + diff --git a/app/src/main/res/values/strings_ee.xml b/app/src/main/res/values/strings_ee.xml index b7c86b4880..c4dd52b6d4 100644 --- a/app/src/main/res/values/strings_ee.xml +++ b/app/src/main/res/values/strings_ee.xml @@ -325,6 +325,13 @@ Is there a sauna here? + + Is there a swimming pool here? + Both (indoor and outdoor) + Only indoor + Only outdoor + No swimming pool + What kind of service building is this? Electrical substation diff --git a/res/graphics/authors.txt b/res/graphics/authors.txt index d04790949e..61aaf598b4 100644 --- a/res/graphics/authors.txt +++ b/res/graphics/authors.txt @@ -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 diff --git a/res/graphics/quest/swimming_pool.svg b/res/graphics/quest/swimming_pool.svg new file mode 100644 index 0000000000..531c8aaf4e --- /dev/null +++ b/res/graphics/quest/swimming_pool.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + \ No newline at end of file