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 fire hydrant position quest #3368

Merged
merged 19 commits into from Dec 30, 2021
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -35,6 +35,7 @@ import de.westnordost.streetcomplete.quests.diet_type.AddVegetarian
import de.westnordost.streetcomplete.quests.ferry.AddFerryAccessMotorVehicle
import de.westnordost.streetcomplete.quests.ferry.AddFerryAccessPedestrian
import de.westnordost.streetcomplete.quests.fire_hydrant.AddFireHydrantType
import de.westnordost.streetcomplete.quests.fire_hydrant.AddFireHydrantPosition
import de.westnordost.streetcomplete.quests.fire_hydrant_diameter.AddFireHydrantDiameter
import de.westnordost.streetcomplete.quests.foot.AddProhibitedForPedestrians
import de.westnordost.streetcomplete.quests.general_fee.AddGeneralFee
Expand Down Expand Up @@ -265,6 +266,7 @@ import javax.inject.Singleton
AddCameraType(),

AddFireHydrantType(),
AddFireHydrantPosition(),
AddFireHydrantDiameter(),

/* ↓ 2.solvable when right in front of it but takes longer to input --------------------- */
Expand Down
@@ -0,0 +1,29 @@
package de.westnordost.streetcomplete.quests.fire_hydrant

import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.data.osm.edits.update_tags.StringMapChangesBuilder
import de.westnordost.streetcomplete.data.osm.osmquests.OsmFilterQuestType
import de.westnordost.streetcomplete.data.user.achievements.QuestTypeAchievement

class AddFireHydrantPosition : OsmFilterQuestType<FireHydrantPosition>() {

override val elementFilter = """
nodes with
emergency = fire_hydrant and
(!fire_hydrant:position or fire_hydrant:position ~ "\?|fixme") and
(fire_hydrant:type = pillar or fire_hydrant:type = underground)
westnordost marked this conversation as resolved.
Show resolved Hide resolved
"""
override val commitMessage = "Add fire hydrant position"
override val wikiLink = "Tag:emergency=fire_hydrant"
override val icon = R.drawable.ic_quest_fire_hydrant_grass

override val questTypeAchievements = emptyList<QuestTypeAchievement>()

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

override fun createForm() = AddFireHydrantPositionForm()

override fun applyAnswerTo(answer: FireHydrantPosition, changes: StringMapChangesBuilder) {
changes.add("fire_hydrant:position", answer.osmValue)
}
}
@@ -0,0 +1,22 @@
package de.westnordost.streetcomplete.quests.fire_hydrant

import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.quests.AImageListQuestAnswerFragment
import de.westnordost.streetcomplete.view.image_select.Item
import de.westnordost.streetcomplete.quests.fire_hydrant.FireHydrantPosition.*

class AddFireHydrantPositionForm : AImageListQuestAnswerFragment<FireHydrantPosition, FireHydrantPosition>() {

override val items = listOf(
Item(GREEN, R.drawable.fire_hydrant_position_green, R.string.quest_fireHydrant_position_green),
Item(LANE, R.drawable.fire_hydrant_position_lane, R.string.quest_fireHydrant_position_lane),
Item(SIDEWALK, R.drawable.fire_hydrant_position_sidewalk, R.string.quest_fireHydrant_position_sidewalk),
Item(PARKING_LOT, R.drawable.fire_hydrant_position_parking, R.string.quest_fireHydrant_position_parking_lot)
)

override val itemsPerRow = 2

override fun onClickOk(selectedItems: List<FireHydrantPosition>) {
applyAnswer(selectedItems.single())
}
}
@@ -0,0 +1,8 @@
package de.westnordost.streetcomplete.quests.fire_hydrant

enum class FireHydrantPosition (val osmValue: String) {
GREEN("green"),
LANE("lane"),
SIDEWALK("sidewalk"),
PARKING_LOT("parking_lot"),
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/src/main/res/values/strings.xml
Expand Up @@ -1085,6 +1085,11 @@ If you are overwhelmed by the number of quests, you can always fine-tune which q
<string name="quest_presets_selected">Selected</string>
<string name="quest_presets_delete_message">"Delete preset “%s”? The quest selection and order for it will be irrevocably lost."</string>
<string name="quest_picnicTableCover_title">Is this picnic table covered (protected from rain)?</string>
<string name="quest_fireHydrant_position_title">Where is this fire hydrant located?</string>
<string name="quest_fireHydrant_position_green">In grass or dirt</string>
<string name="quest_fireHydrant_position_lane">On the roadway</string>
<string name="quest_fireHydrant_position_sidewalk">On the sidewalk</string>
<string name="quest_fireHydrant_position_parking_lot">In a parking spot</string>
<string name="quest_bicycle_barrier_type_title">What type of bicycle barrier is this?</string>
<string name="quest_barrier_bicycle_type_diagonal">Diagonal to the path</string>
<string name="quest_barrier_bicycle_type_tilted">Narrow passage, smaller toward top</string>
Expand Down
6 changes: 6 additions & 0 deletions res/graphics/authors.txt
Expand Up @@ -145,6 +145,12 @@ fire hydrant diameter graphics/
hydrant_sign_pl.svg modified from https://wiki.openstreetmap.org/w/images/3/3e/Tablica_orientacyjna_dla_hydrantu.svg, Marvin Feiter
hydrant_sign_uk.svg Marvin Feiter

fire hydrant position graphics/
Fire_hydrant_in_grass.jpg https://upload.wikimedia.org/wikipedia/commons/2/2d/Fire_hydrant_in_grass.jpg (CC BY-SA 4.0)
Fire_hydrant_on_sidewalk.jpg https://upload.wikimedia.org/wikipedia/commons/3/32/Fire_hydrant_on_sidewalk.jpg (CC BY-SA 4.0)
Fire_hydrant_lane.jpg modified from https://upload.wikimedia.org/wikipedia/commons/d/d0/Fire_hydrant_on_road_side.jpg (CC BY-SA 4.0)
Fire_hydrant_parking.jpg modified from https://upload.wikimedia.org/wikipedia/commons/3/33/Fire-fighting-facility_node-4279866277.jpg (CC BY 2.0)

housenumber graphics/
town_silhouette.svg

Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.