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 Quest: roof:material #567

Open
wants to merge 1 commit into
base: modified
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ import de.westnordost.streetcomplete.quests.religion.AddReligionToWaysideShrine
import de.westnordost.streetcomplete.quests.road_name.AddRoadName
import de.westnordost.streetcomplete.quests.road_name.RoadNameSuggestionsSource
import de.westnordost.streetcomplete.quests.roof_colour.AddRoofColour
import de.westnordost.streetcomplete.quests.roof_material.AddRoofMaterial
import de.westnordost.streetcomplete.quests.roof_shape.AddRoofShape
import de.westnordost.streetcomplete.quests.sanitary_dump_station.AddSanitaryDumpStation
import de.westnordost.streetcomplete.quests.seating.AddOutdoorSeatingType
Expand Down Expand Up @@ -612,6 +613,7 @@ fun getQuestTypeList(
EE_QUEST_OFFSET + 0 to AddBenchMaterial(),
EE_QUEST_OFFSET + 27 to AddBuildingColour(),
EE_QUEST_OFFSET + 24 to AddRoofColour(),
EE_QUEST_OFFSET + 48 to AddRoofMaterial(),
EE_QUEST_OFFSET + 1 to AddContactPhone(),
EE_QUEST_OFFSET + 2 to AddContactWebsite(),
EE_QUEST_OFFSET + 4 to AddCuisine(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package de.westnordost.streetcomplete.quests.roof_material

import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.data.osm.geometry.ElementGeometry
import de.westnordost.streetcomplete.data.osm.osmquests.OsmFilterQuestType
import de.westnordost.streetcomplete.data.user.achievements.EditTypeAchievement.BUILDING
import de.westnordost.streetcomplete.osm.Tags

class AddRoofMaterial : OsmFilterQuestType<RoofMaterial>() {

override val elementFilter = """
ways, relations with
roof:shape
and !roof:material
and building !~ no|construction
and location != underground
and ruins != yes
"""
override val changesetComment = "Specify roof material"
override val wikiLink = "Key:roof:material"
override val icon = R.drawable.ic_quest_roof_material
override val achievements = listOf(BUILDING)
override val defaultDisabledMessage = R.string.default_disabled_msg_roofMaterial

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

override fun createForm() = AddRoofMaterialForm()

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

import android.os.Bundle
import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.quests.AImageListQuestForm

class AddRoofMaterialForm : AImageListQuestForm<RoofMaterial, RoofMaterial>() {

override val items = RoofMaterial.entries.map { it.asItem() }

override val itemsPerRow = 3

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
imageSelector.cellLayoutId = R.layout.cell_labeled_icon_select
}

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

import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.view.image_select.DisplayItem
import de.westnordost.streetcomplete.view.image_select.Item

enum class RoofMaterial(
val osmValue: String,
@DrawableRes val imageResId: Int,
@StringRes val titleResId: Int,
) {
ROOF_TILES(
osmValue = "roof_tiles",
imageResId = R.drawable.roof_material_roof_tiles,
titleResId = R.string.quest_roof_material_value_roof_tiles
),
METAL_SHEET(
osmValue = "metal_sheet",
imageResId = R.drawable.roof_material_metal_sheet,
titleResId = R.string.quest_roof_material_value_metal_sheet
),
CONCRETE(
osmValue = "concrete",
imageResId = R.drawable.roof_material_concrete,
titleResId = R.string.quest_roof_material_value_concrete
),
TAR_PAPER(
osmValue = "tar_paper",
imageResId = R.drawable.roof_material_tar_paper,
titleResId = R.string.quest_roof_material_value_tar_paper
),
ETERNIT(
osmValue = "eternit",
imageResId = R.drawable.roof_material_eternit,
titleResId = R.string.quest_roof_material_value_eternit
),
SLATE(
osmValue = "slate",
imageResId = R.drawable.roof_material_slate,
titleResId = R.string.quest_roof_material_value_slate
),
GLASS(
osmValue = "glass",
imageResId = R.drawable.roof_material_glass,
titleResId = R.string.quest_roof_material_value_glass
),
ACRYLIC_GLASS(
osmValue = "acrylic_glass",
imageResId = R.drawable.roof_material_acrylic_glass,
titleResId = R.string.quest_roof_material_value_acrylic_glass
),
TIN(
osmValue = "tin",
imageResId = R.drawable.roof_material_tin,
titleResId = R.string.quest_roof_material_value_tin
),
GRASS(
osmValue = "grass",
imageResId = R.drawable.roof_material_grass,
titleResId = R.string.quest_roof_material_value_grass
),
COPPER(
osmValue = "copper",
imageResId = R.drawable.roof_material_copper,
titleResId = R.string.quest_roof_material_value_copper
),
THATCH(
osmValue = "thatch",
imageResId = R.drawable.roof_material_thatch,
titleResId = R.string.quest_roof_material_value_thatch
),
GRAVEL(
osmValue = "gravel",
imageResId = R.drawable.roof_material_gravel,
titleResId = R.string.quest_roof_material_value_gravel
),
STONE(
osmValue = "stone",
imageResId = R.drawable.roof_material_stone,
titleResId = R.string.quest_roof_material_value_stone
),
WOOD(
osmValue = "wood",
imageResId = R.drawable.roof_material_wood,
titleResId = R.string.quest_roof_material_value_wood
),
PLASTIC(
osmValue = "plastic",
imageResId = R.drawable.roof_material_plastic,
titleResId = R.string.quest_roof_material_value_plastic
),
ASPHALT(
osmValue = "asphalt",
imageResId = R.drawable.roof_material_asphalt,
titleResId = R.string.quest_roof_material_value_asphalt
),
ASPHALT_SHINGLE(
osmValue = "asphalt_shingle",
imageResId = R.drawable.roof_material_asphalt_shingle,
titleResId = R.string.quest_roof_material_value_asphalt_shingle
),
ZINC(
osmValue = "zinc",
imageResId = R.drawable.roof_material_zinc,
titleResId = R.string.quest_roof_material_value_zinc
),
SANDSTONE(
osmValue = "sandstone",
imageResId = R.drawable.roof_material_sandstone,
titleResId = R.string.quest_roof_material_value_sandstone
),
BAMBOO(
osmValue = "bamboo",
imageResId = R.drawable.roof_material_bamboo,
titleResId = R.string.quest_roof_material_value_bamboo
),
PALM_LEAVES(
osmValue = "palm_leaves",
imageResId = R.drawable.roof_material_palm_leaves,
titleResId = R.string.quest_roof_material_value_palm_leaves
),
SOLAR_PANELS(
osmValue = "solar_panels",
imageResId = R.drawable.roof_material_solar_panels,
titleResId = R.string.quest_roof_material_value_solar_panels
),
}

fun Collection<RoofMaterial>.toItems() = map { it.asItem() }

fun RoofMaterial.asItem(): DisplayItem<RoofMaterial> = Item(this, imageResId, titleResId)
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.
26 changes: 26 additions & 0 deletions app/src/main/res/drawable/ic_quest_roof_material.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="128dp"
android:height="128dp"
android:viewportWidth="34"
android:viewportHeight="34">
<path
android:pathData="m32.64,23.28c-3.51,8.67 -13.38,12.85 -22.05,9.35 -8.67,-3.51 -12.85,-13.38 -9.35,-22.05 3.51,-8.67 13.38,-12.85 22.05,-9.35 8.67,3.51 12.85,13.38 9.35,22.05"
android:fillColor="#c8c4b7"/>
<path
android:pathData="m16.98,5.29 l-9.53,3.17 -0.05,17.99 9.57,-3.17 9.48,3.17 0.05,-17.99z"
android:fillAlpha="0.2"
android:fillColor="#000"/>
<path
android:pathData="m8.21,26.72 l8.73,-2.91 8.73,2.91v2.91h-6.35v-2.38h-4.76v2.38L8.21,29.63Z"
android:fillAlpha="0.2"
android:fillColor="#000"/>
<path
android:pathData="m7.41,7.41 l9.52,-3.17v17.99l-9.53,3.17z"
android:fillColor="#B6EF28"/>
<path
android:pathData="m16.94,4.23 l9.52,3.17v17.99l-9.52,-3.17z"
android:fillColor="#9CCC20"/>
<path
android:pathData="m8.21,25.67 l8.78,-2.91 8.68,2.91v2.91h-6.35v-2.38h-4.76v2.38L8.21,28.58Z"
android:fillColor="#fff"/>
</vector>
26 changes: 26 additions & 0 deletions app/src/main/res/values/strings_ee.xml
Original file line number Diff line number Diff line change
Expand Up @@ -671,4 +671,30 @@ Out of the box SCEE is configured to behave very similar to StreetComplete.</str
<!-- actually there are still SC translations available, as only the main string has been removed from SC. -->
<string name="close">Close</string>

<!-- roof material -->
<string name="quest_roofMaterial_title">"What overall material does this building’s roof have?"</string>
<string name="default_disabled_msg_roofMaterial">This quest type is disabled by default because roof materials are often not easily visible from the street. This quest type is also quite time-consuming; in most cases it is easier and more efficient to map this from aerial imagery at home.</string>
<string name="quest_roof_material_value_roof_tiles">Roof tiles</string>
<string name="quest_roof_material_value_concrete">Concrete</string>
<string name="quest_roof_material_value_tar_paper">Tar paper</string>
<string name="quest_roof_material_value_eternit">Eternit</string>
<string name="quest_roof_material_value_glass">Glass</string>
<string name="quest_roof_material_value_acrylic_glass">Acrylic glass</string>
<string name="quest_roof_material_value_metal_sheet">Metal sheet</string>
<string name="quest_roof_material_value_slate">Slate</string>
<string name="quest_roof_material_value_tin">Tin</string>
<string name="quest_roof_material_value_grass">Grass</string>
<string name="quest_roof_material_value_copper">Copper</string>
<string name="quest_roof_material_value_thatch">Thatch</string>
<string name="quest_roof_material_value_gravel">Gravel</string>
<string name="quest_roof_material_value_stone">Stone</string>
<string name="quest_roof_material_value_wood">Wood</string>
<string name="quest_roof_material_value_plastic">Plastic</string>
<string name="quest_roof_material_value_asphalt">Asphalt</string>
<string name="quest_roof_material_value_asphalt_shingle">Asphalt shingle</string>
<string name="quest_roof_material_value_zinc">Zinc</string>
<string name="quest_roof_material_value_sandstone">Sandstone</string>
<string name="quest_roof_material_value_bamboo">Bamboo</string>
<string name="quest_roof_material_value_palm_leaves">Palm leaves</string>
<string name="quest_roof_material_value_solar_panels">Solar panels</string>
</resources>