Skip to content

Commit

Permalink
Add Shelter type quest (#473)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcliquid authored Nov 1, 2023
1 parent 251eddc commit 36debbf
Show file tree
Hide file tree
Showing 41 changed files with 292 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ import de.westnordost.streetcomplete.quests.segregated.AddCyclewaySegregation
import de.westnordost.streetcomplete.quests.self_service.AddSelfServiceLaundry
import de.westnordost.streetcomplete.quests.service_building.AddServiceBuildingOperator
import de.westnordost.streetcomplete.quests.service_building.AddServiceBuildingType
import de.westnordost.streetcomplete.quests.shelter_type.AddShelterType
import de.westnordost.streetcomplete.quests.shop_type.CheckShopExistence
import de.westnordost.streetcomplete.quests.shop_type.CheckShopType
import de.westnordost.streetcomplete.quests.shop_type.SpecifyShopType
Expand Down Expand Up @@ -588,6 +589,7 @@ fun getQuestTypeList(
EE_QUEST_OFFSET + 23 to AddRailwayPlatformRef(),
EE_QUEST_OFFSET + 9 to AddTreeGenus(),
EE_QUEST_OFFSET + 26 to AddIsPharmacyDispensing(),
EE_QUEST_OFFSET + 30 to AddShelterType(),
EE_QUEST_OFFSET + 28 to AddFootwayWidth(arSupportChecker),
EE_QUEST_OFFSET + 10 to OsmoseQuest(osmoseDao),
EE_QUEST_OFFSET + 11 to CustomQuest(customQuestList),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package de.westnordost.streetcomplete.quests.shelter_type

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

class AddShelterType : OsmFilterQuestType<ShelterType>() {

override val elementFilter = """
nodes, ways with
amenity = shelter
and !shelter_type
"""
override val changesetComment = "Specify shelter types"
override val wikiLink = "Key:shelter_type"
override val icon = R.drawable.ic_quest_shelter_type
override val isDeleteElementEnabled = true
override val achievements = listOf(EditTypeAchievement.OUTDOORS)
override val defaultDisabledMessage: Int = R.string.quest_shelter_type_disabled_msg

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

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

override fun createForm() = AddShelterTypeForm()

override fun applyAnswerTo(answer: ShelterType, tags: Tags, geometry: ElementGeometry, timestampEdited: Long) {
tags["shelter_type"] = answer.osmValue
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package de.westnordost.streetcomplete.quests.shelter_type

import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.quests.AImageListQuestForm
import de.westnordost.streetcomplete.quests.AnswerItem
import de.westnordost.streetcomplete.quests.IAnswerItem
import de.westnordost.streetcomplete.quests.shelter_type.ShelterType.PUBLIC_TRANSPORT
import de.westnordost.streetcomplete.quests.shelter_type.ShelterType.PICNIC_SHELTER
import de.westnordost.streetcomplete.quests.shelter_type.ShelterType.GAZEBO
import de.westnordost.streetcomplete.quests.shelter_type.ShelterType.LEAN_TO
import de.westnordost.streetcomplete.quests.shelter_type.ShelterType.BASIC_HUT
import de.westnordost.streetcomplete.quests.shelter_type.ShelterType.SUN_SHELTER
import de.westnordost.streetcomplete.quests.shelter_type.ShelterType.FIELD_SHELTER
import de.westnordost.streetcomplete.quests.shelter_type.ShelterType.ROCK_SHELTER
import de.westnordost.streetcomplete.quests.shelter_type.ShelterType.WEATHER_SHELTER
import de.westnordost.streetcomplete.view.image_select.Item

class AddShelterTypeForm : AImageListQuestForm<ShelterType, ShelterType>() {

override val items = listOf(
Item(PUBLIC_TRANSPORT, R.drawable.shelter_type_public_transport, R.string.quest_shelter_type_public_transport),
Item(PICNIC_SHELTER, R.drawable.shelter_type_picnic_shelter, R.string.quest_shelter_type_picnic_shelter),
Item(GAZEBO, R.drawable.shelter_type_gazebo, R.string.quest_shelter_type_gazebo),
Item(LEAN_TO, R.drawable.shelter_type_lean_to, R.string.quest_shelter_type_lean_to),
Item(BASIC_HUT, R.drawable.shelter_type_basic_hut, R.string.quest_shelter_type_basic_hut),
Item(SUN_SHELTER, R.drawable.shelter_type_sun_shelter, R.string.quest_shelter_type_sun_shelter),
Item(FIELD_SHELTER, R.drawable.shelter_type_field_shelter, R.string.quest_shelter_type_field_shelter),
Item(ROCK_SHELTER, R.drawable.shelter_type_rock_shelter, R.string.quest_shelter_type_rock_shelter)
)

override val otherAnswers = listOf(
AnswerItem(R.string.quest_shelter_type_is_weather_shelter) { applyAnswer(WEATHER_SHELTER) }
)

override val itemsPerRow = 3

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

enum class ShelterType(val osmValue: String) {
PUBLIC_TRANSPORT("public_transport"),
PICNIC_SHELTER("picnic_shelter"),
GAZEBO("gazebo"),
LEAN_TO("lean_to"),
BASIC_HUT("basic_hut"),
SUN_SHELTER("sun_shelter"),
FIELD_SHELTER("field_shelter"),
ROCK_SHELTER("rock_shelter"),
WEATHER_SHELTER("weather_shelter")
}
9 changes: 9 additions & 0 deletions app/src/main/res/authors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,15 @@ recycling_centre.jpg Public Domain https://commons.wikimedia.org/w
recycling_container.jpg CC0 https://commons.wikimedia.org/wiki/File:Vitoria_-_Contenedores_de_reciclaje_en_la_Avenida_de_Gasteiz.jpg
recycling_container_undergr... CC0 https://commons.wikimedia.org/wiki/File:San_Fernando_de_Henares_-_reciclaje_de_residuos_urbanos_04.JPG

shelter_type_public_transpor… CC-BY 2.0 Janusz Jakubowski https://commons.wikimedia.org/wiki/File:Bus_shelter_in_Warsaw_(25843621920).jpg
shelter_type_picnic_shelter.… CC-BY-SA 3.0 B.navez https://wiki.openstreetmap.org/wiki/File:R%C3%A9union_Ma%C3%AFdo_kiosque_pique-nique.JPG
shelter_type_gazebo.jpg CC-BY 2.0 Tim Green https://commons.wikimedia.org/wiki/File:Shelter,_Roundhay_Park_(3511090304).jpg
shelter_type_lean_to.jpg CC-BY-SA 3.0 j doll https://commons.wikimedia.org/wiki/File:Keauhou_Shelter_(145211875).jpeg
shelter_type_basic_hut.jpg CC-BY-SA 4.0 Eginhard https://commons.wikimedia.org/wiki/File:Schutzh%C3%BCtte_Lauchb%C3%BChl_2021-06-19.jpg
shelter_type_sun_shelter.jpg CC-BY-SA 2.0 blmoregon https://commons.wikimedia.org/wiki/File:Oregon_Trail_-_Keeney_Historic_Site.jpg
shelter_type_field_shelter… CC-BY-SA 4.0 Kolforn https://commons.wikimedia.org/wiki/File:-2018-10-03_Free_range_pigs,_Southrepps_(1).JPG
shelter_type_rock_shelter.jpg CC-BY 2.0 Bureau of Land Management Oregon and Washington https://commons.wikimedia.org/wiki/File:Rock_Shelter_(11410676553).jpg

sliding_envelope.wav CC0 https://freesound.org/people/MTJohnson/sounds/444431/
snip.wav CC0 https://freesound.org/people/Godowan/sounds/240473/

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.
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.
118 changes: 118 additions & 0 deletions app/src/main/res/drawable/ic_quest_shelter_type.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<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="M119.4,96c-17.7,30.6 -56.8,41.1 -87.4,23.4S-9.1,62.6 8.6,32S65.4,-9.1 96,8.6C126.6,26.2 137.1,65.4 119.4,96"
android:fillColor="#9BBE55"/>
<path
android:fillColor="#FF000000"
android:pathData="M92.3,27.3H35.7c-4.9,0 -9.4,4.6 -9.4,9.4v56.6c0,4.9 4.6,9.4 9.4,9.4h56.6c4.9,0 9.4,-4.6 9.4,-9.4V36.7C101.7,31.9 97.2,27.3 92.3,27.3L92.3,27.3L92.3,27.3zM94.2,75.1H74.1v20.1H53.9V75.1H33.8V55h20.2V34.8h20.2V55h20.2V75.1z"
android:strokeAlpha="0.25"
android:fillAlpha="0.25"/>
<path
android:pathData="M92.3,24.2H35.7c-4.9,0 -9.4,4.6 -9.4,9.4v56.6c0,4.9 4.6,9.4 9.4,9.4h56.6c4.9,0 9.4,-4.6 9.4,-9.4V33.6C101.7,28.8 97.2,24.2 92.3,24.2L92.3,24.2L92.3,24.2zM94.2,72H74.1v20.1H53.9V72H33.8V51.9h20.2V31.8h20.2v20.1h20.2V72z"
android:fillColor="#FFFFFF"/>
<path
android:pathData="M119.4,96c-17.7,30.6 -56.8,41.1 -87.4,23.4S-9.1,62.6 8.6,32S65.4,-9.1 96,8.6C126.6,26.2 137.1,65.4 119.4,96"
android:fillColor="#9BBE55"/>
<path
android:fillColor="#FF000000"
android:pathData="M108.1,65.1l-44.4,-17.6l0,0l0,0l-44.4,17.6l2.5,6.1l15,-6l0,41.3l6.5,0l0,-43.9l20.4,-8.1l20.9,8.3l0,43.7l6.5,0l0,-41.1l14.6,5.8z"
android:strokeAlpha="0.2"
android:fillAlpha="0.2"/>
<path
android:fillColor="#FF000000"
android:pathData="M48.9,14.2l-5.2,10.4l2.4,0l5.5,-10.4z"
android:strokeAlpha="0.2"
android:fillType="evenOdd"
android:fillAlpha="0.2"/>
<path
android:fillColor="#FF000000"
android:pathData="M69.8,14.2l-5.2,10.4l2.4,0l5.5,-10.4z"
android:strokeAlpha="0.2"
android:fillType="evenOdd"
android:fillAlpha="0.2"/>
<path
android:fillColor="#FF000000"
android:pathData="M90.7,14.2l-5.2,10.4l2.4,0l5.5,-10.4z"
android:strokeAlpha="0.2"
android:fillType="evenOdd"
android:fillAlpha="0.2"/>
<path
android:fillColor="#FF000000"
android:pathData="M33.2,24.6l-5.2,10.5l2.4,0l5.5,-10.5z"
android:strokeAlpha="0.2"
android:fillType="evenOdd"
android:fillAlpha="0.2"/>
<path
android:fillColor="#FF000000"
android:pathData="M54.1,24.6l-5.2,10.5l2.5,0l5.4,-10.5z"
android:strokeAlpha="0.2"
android:fillType="evenOdd"
android:fillAlpha="0.2"/>
<path
android:fillColor="#FF000000"
android:pathData="M75,24.6l-5.2,10.5l2.4,0l5.5,-10.5z"
android:strokeAlpha="0.2"
android:fillType="evenOdd"
android:fillAlpha="0.2"/>
<path
android:fillColor="#FF000000"
android:pathData="M95.9,24.6l-5.2,10.5l2.4,0l5.5,-10.5z"
android:strokeAlpha="0.2"
android:fillType="evenOdd"
android:fillAlpha="0.2"/>
<path
android:fillColor="#FF000000"
android:pathData="M41,35.1l-5.2,10.4l2.5,0l5.4,-10.4z"
android:strokeAlpha="0.2"
android:fillType="evenOdd"
android:fillAlpha="0.2"/>
<path
android:fillColor="#FF000000"
android:pathData="M82.7,35.1l-5.2,10.4l2.4,0l5.5,-10.4z"
android:strokeAlpha="0.2"
android:fillType="evenOdd"
android:fillAlpha="0.2"/>
<path
android:pathData="M108.1,62.5l-44.4,-17.6l0,0l0,0l-44.4,17.6l2.5,6.1l15,-6l0,41.3l6.5,0l0,-43.9l20.4,-8.1l20.9,8.3l0,43.7l6.5,0l0,-41.1l14.6,5.8z"
android:fillColor="#FFFFFF"/>
<path
android:pathData="M48.9,11.6l-5.2,10.5l2.4,0l5.5,-10.5z"
android:fillColor="#FFFFFF"
android:fillType="evenOdd"/>
<path
android:pathData="M69.8,11.6l-5.2,10.5l2.4,0l5.5,-10.5z"
android:fillColor="#FFFFFF"
android:fillType="evenOdd"/>
<path
android:pathData="M90.7,11.6l-5.2,10.5l2.4,0l5.5,-10.5z"
android:fillColor="#FFFFFF"
android:fillType="evenOdd"/>
<path
android:pathData="M33.2,22.1l-5.2,10.4l2.4,0l5.5,-10.4z"
android:fillColor="#FFFFFF"
android:fillType="evenOdd"/>
<path
android:pathData="M54.1,22.1l-5.2,10.4l2.5,0l5.4,-10.4z"
android:fillColor="#FFFFFF"
android:fillType="evenOdd"/>
<path
android:pathData="M75,22.1l-5.2,10.4l2.4,0l5.5,-10.4z"
android:fillColor="#FFFFFF"
android:fillType="evenOdd"/>
<path
android:pathData="M95.9,22.1l-5.2,10.4l2.4,0l5.5,-10.4z"
android:fillColor="#FFFFFF"
android:fillType="evenOdd"/>
<path
android:pathData="M41,32.5l-5.2,10.4l2.5,0l5.4,-10.4z"
android:fillColor="#FFFFFF"
android:fillType="evenOdd"/>
<path
android:pathData="M82.7,32.5l-5.2,10.4l2.4,0l5.5,-10.4z"
android:fillColor="#FFFFFF"
android:fillType="evenOdd"/>
</vector>
13 changes: 13 additions & 0 deletions app/src/main/res/values/strings_ee.xml
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,19 @@
<string name="quest_seating_beach">At a beach</string>
<string name="quest_outdoor_seating_name_title">What kind of outdoor seating does this place have?</string>

<!-- shelter type -->
<string name="quest_shelter_type_title">What kind of shelter is this?</string>
<string name="quest_shelter_type_disabled_msg">This quest is disabled by default because it’s not easy to answer. The shelter type must be chosen from suggestions, which are taken from most used values and these are often not easy to differentiate.</string>
<string name="quest_shelter_type_is_weather_shelter">This is a generic weather shelter</string>
<string name="quest_shelter_type_public_transport">Public Transport</string>
<string name="quest_shelter_type_picnic_shelter">Picnic Shelter</string>
<string name="quest_shelter_type_gazebo">Gazebo</string>
<string name="quest_shelter_type_lean_to">Lean-to</string>
<string name="quest_shelter_type_basic_hut">Basic hut</string>
<string name="quest_shelter_type_sun_shelter">Sun shelter</string>
<string name="quest_shelter_type_field_shelter">Field shelter</string>
<string name="quest_shelter_type_rock_shelter">Rock shelter</string>

<!-- artwork type -->
<string name="quest_artwork_title">What kind of artwork is this?</string>
<string name="quest_artwork_sculpture">Sculpture</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 @@ -4,7 +4,7 @@ URLs to other sources used:
- Twemoji 2 (MIT license) https://github.com/twitter/twemoji/
- EmojiOne 2 (CC-BY 4 license) https://github.com/emojione/emojione/tree/2.2.7
- Google Noto Color Emoji https://github.com/googlefonts/noto-emoji/tree/main
(Apache license, version 2.0)
(Apache license, version 2.0)

File Author if not Tobias Zwick / Source
===============================================================================
Expand Down Expand Up @@ -397,6 +397,7 @@ quest/
road_construction.svg
roof_shape.svg
seating.svg
shelter_type.svg modified from https://wiki.openstreetmap.org/wiki/File:Shelter-14.svg
shower.svg
sidewalk.svg
sidewalk_surface.svg @krisdoodle45 (based on way_surface.svg)
Expand Down
59 changes: 59 additions & 0 deletions res/graphics/quest/shelter_type.svg

0 comments on commit 36debbf

Please sign in to comment.