Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Shelter type quest #473

Merged
merged 20 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 118 additions & 0 deletions app/src/debug/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"
mcliquid marked this conversation as resolved.
Show resolved Hide resolved
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>
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
Expand Up @@ -31,8 +31,11 @@ class AddIsAmenityIndoor(private val getFeature: (tags: Map<String, String>) ->
""".toElementFilterExpression() }

/* We only want survey nodes within building outlines. */
// exclude building=roof, see https://github.com/streetcomplete/StreetComplete/issues/5333
private val buildingFilter by lazy { """
ways, relations with building
ways, relations with
building
and building != roof
""".toElementFilterExpression() }

override val changesetComment = "Determine whether amenities are inside buildings"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class AddChargingStationOperator : OsmFilterQuestType<String>() {
nodes, ways with
amenity = charging_station
and !operator and !name and !brand
and operator:signed != no
and brand:signed != no
"""
override val changesetComment = "Specify charging station operators"
override val wikiLink = "Tag:amenity=charging_station"
Expand Down
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.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
import de.westnordost.streetcomplete.quests.smoothness.applyTo

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: ShelterTypeAnswer, tags: Tags, geometry: ElementGeometry, timestampEdited: Long) {
when (answer) {
is WeatherShelterAnswer -> tags["shelter_type"] = "weather_shelter"
is ShelterTypeAnswer -> tags["shelter_type"] = answer.osmValue
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
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.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.view.image_select.Item

class AddShelterTypeForm : AImageListQuestForm<ShelterTypeAnswer, 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 itemsPerRow = 3

override fun onClickOk(selectedItems: List<ShelterType>) {
applyAnswer(selectedItems.single())
}

override val otherAnswers = listOf(
AnswerItem(R.string.quest_shelter_type_is_weather_shelter) { applyAnswer(WeatherShelterAnswer) }
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
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")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package de.westnordost.streetcomplete.quests.shelter_type

sealed interface ShelterTypeAnswer

data class ShelterTypeAnswer(val value: ShelterType) : ShelterTypeAnswer
mcliquid marked this conversation as resolved.
Show resolved Hide resolved
object WeatherShelterAnswer : ShelterTypeAnswer
10 changes: 10 additions & 0 deletions app/src/main/res/authors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,16 @@ 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-SA 4.0 Silar https://wiki.openstreetmap.org/wiki/File:02019_1048_(2)_Bus_station,_%C5%BBywiecka_street,_Bia%C5%82a.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 4.0 ermell https://wiki.openstreetmap.org/wiki/File:Bamberg-Hain-Pavillion-P1180860.jpg
shelter_type_weather_shelter… Fröstel https://wiki.openstreetmap.org/wiki/File:German-shelter-harz.jpg
shelter_type_lean_to.jpg CC-BY-SA 3.0 Mwanner https://wiki.openstreetmap.org/wiki/File:Adirondack_Lean-to.jpg
shelter_type_pavilion.jpg CC-BY-SA 4.0 Bwag https://wiki.openstreetmap.org/wiki/File:Obersiebenbrunn_-_Schloss,_Gartenpavillon.JPG
shelter_type_basic_hut.jpg CC-BY-SA 3.0 Luca Bergamasco https://wiki.openstreetmap.org/wiki/File:BivaccoBertoglioNebbia.jpg
shelter_type_sun_shelter.jpg CC-BY-SA 2.0 S2374 https://wiki.openstreetmap.org/wiki/File:Shelter_Providing_Shade_from_the_Sun.jpg
shelter_type_field_shelter… PB Imagic https://wiki.openstreetmap.org/wiki/File:Field_shelter.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.
7 changes: 2 additions & 5 deletions app/src/main/res/layout/quest_location.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingStart="24dp"
android:paddingEnd="24dp">
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/quest_defibrillator_location_description"
android:labelFor="@+id/commentInput"/>

<EditText xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
<EditText
android:id="@+id/locationInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down
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