forked from streetcomplete/StreetComplete
-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Swimming Pool Availability Quest (#667)
- Loading branch information
Showing
8 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
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
47 changes: 47 additions & 0 deletions
47
...stnordost/streetcomplete/quests/swimming_pool_availability/AddSwimmingPoolAvailability.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,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) | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...rdost/streetcomplete/quests/swimming_pool_availability/AddSwimmingPoolAvailabilityForm.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,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), | ||
) | ||
} |
8 changes: 8 additions & 0 deletions
8
.../westnordost/streetcomplete/quests/swimming_pool_availability/SwimmingPoolAvailability.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,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"), | ||
} |
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,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> |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.