diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/QuestsModule.kt b/app/src/main/java/de/westnordost/streetcomplete/quests/QuestsModule.kt index 5adc8f567b..8e183f777f 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/quests/QuestsModule.kt +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/QuestsModule.kt @@ -124,6 +124,7 @@ import de.westnordost.streetcomplete.quests.police_type.AddPoliceType import de.westnordost.streetcomplete.quests.postbox_collection_times.AddPostboxCollectionTimes import de.westnordost.streetcomplete.quests.postbox_ref.AddPostboxRef import de.westnordost.streetcomplete.quests.postbox_royal_cypher.AddPostboxRoyalCypher +import de.westnordost.streetcomplete.quests.power_attachment.AddPowerAttachment import de.westnordost.streetcomplete.quests.powerpoles_material.AddPowerPolesMaterial import de.westnordost.streetcomplete.quests.railway_crossing.AddRailwayCrossingBarrier import de.westnordost.streetcomplete.quests.recycling.AddRecyclingType @@ -288,7 +289,8 @@ fun questTypeRegistry( 26 to AddReligionToPlaceOfWorship(), // icons on maps are different - OSM Carto, mapy.cz, OsmAnd, Sputnik etc 27 to AddReligionToWaysideShrine(), - + + 172 to AddPowerAttachment(), 28 to AddPowerPolesMaterial(), 29 to AddIsBuildingUnderground(), // should be before AddHousenumber to avoid asking for underground buildings diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/power_attachment/AddPowerAttachment.kt b/app/src/main/java/de/westnordost/streetcomplete/quests/power_attachment/AddPowerAttachment.kt new file mode 100644 index 0000000000..1569ce67d0 --- /dev/null +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/power_attachment/AddPowerAttachment.kt @@ -0,0 +1,42 @@ +package de.westnordost.streetcomplete.quests.power_attachment + +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.BUILDING +import de.westnordost.streetcomplete.osm.Tags + +class AddPowerAttachment : OsmFilterQuestType() { + + override val elementFilter = """ + nodes with + power ~ tower|pole|insulator + and !line_attachment + """ + override val changesetComment = "Specify line_attachment power support" + override val wikiLink = "Key:line_attachment" + override val icon = R.drawable.ic_quest_power + override val achievements = listOf(BUILDING) + + override fun getTitle(tags: Map) = R.string.quest_powerAttachment_title + + override fun getHighlightedElements(element: Element, getMapData: () -> MapDataWithGeometry): Sequence { + val mapData = getMapData() + // and also show the (power) lines themselves + return mapData.filter("nodes with power ~ tower|pole|insulator") + + mapData.filter("ways with power ~ line|minor_line") + } + + // map data density is usually lower where there are power poles and more context is necessary + // when looking at them from afar + override val highlightedElementsRadius get() = 100.0 + + override fun createForm() = AddPowerAttachmentForm() + + override fun applyAnswerTo(answer: PowerAttachment, tags: Tags, geometry: ElementGeometry, timestampEdited: Long) { + tags["line_attachment"] = answer.osmValue + } +} diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/power_attachment/AddPowerAttachmentForm.kt b/app/src/main/java/de/westnordost/streetcomplete/quests/power_attachment/AddPowerAttachmentForm.kt new file mode 100644 index 0000000000..f0b73daccd --- /dev/null +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/power_attachment/AddPowerAttachmentForm.kt @@ -0,0 +1,13 @@ +package de.westnordost.streetcomplete.quests.power_attachment + +import de.westnordost.streetcomplete.quests.AImageListQuestForm + +class AddPowerAttachmentForm : AImageListQuestForm() { + + override val items = PowerAttachment.entries.map { it.asItem() } + override val itemsPerRow = 3 + + override fun onClickOk(selectedItems: List) { + applyAnswer(selectedItems.single()) + } +} diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/power_attachment/PowerAttachment.kt b/app/src/main/java/de/westnordost/streetcomplete/quests/power_attachment/PowerAttachment.kt new file mode 100644 index 0000000000..1cb421fbed --- /dev/null +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/power_attachment/PowerAttachment.kt @@ -0,0 +1,7 @@ +package de.westnordost.streetcomplete.quests.power_attachment + +enum class PowerAttachment(val osmValue: String) { + SUSPENSION("suspension"), + ANCHOR("anchor"), + PIN("pin"), +} diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/power_attachment/PowerAttachmentItem.kt b/app/src/main/java/de/westnordost/streetcomplete/quests/power_attachment/PowerAttachmentItem.kt new file mode 100644 index 0000000000..d31faa11fd --- /dev/null +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/power_attachment/PowerAttachmentItem.kt @@ -0,0 +1,19 @@ +package de.westnordost.streetcomplete.quests.power_attachment + +import de.westnordost.streetcomplete.R +import de.westnordost.streetcomplete.quests.power_attachment.PowerAttachment.* +import de.westnordost.streetcomplete.view.image_select.Item + +fun PowerAttachment.asItem() = Item(this, iconResId, titleResId) + +private val PowerAttachment.titleResId: Int get() = when (this) { + SUSPENSION -> R.string.quest_powerAttachment_suspension + ANCHOR -> R.string.quest_powerAttachment_anchor + PIN -> R.string.quest_powerAttachment_pin +} + +private val PowerAttachment.iconResId: Int get() = when (this) { + SUSPENSION -> R.drawable.power_attachment_suspension + ANCHOR -> R.drawable.power_attachment_anchor + PIN -> R.drawable.power_attachment_pin +} diff --git a/app/src/main/res/authors.txt b/app/src/main/res/authors.txt index cbd40a3314..ed959934ac 100644 --- a/app/src/main/res/authors.txt +++ b/app/src/main/res/authors.txt @@ -161,6 +161,10 @@ power_pole_concrete.jpg CC-BY-SA 3.0 https://commons.wikimedia.org/w power_pole_steel.jpg Public Domain https://commons.wikimedia.org/wiki/File:Steel_tube_pylon.JPG power_pole_wood.jpg CC-BY 3.0 https://commons.wikimedia.org/wiki/File:Two_armed_power_pole_1.jpg +power_attachment_anchor.jpg CC-BY-SA 4.0 https://commons.wikimedia.org/wiki/File:Power_pole_anchor.jpg +power_attachment_pin.jpg CC-BY-SA 4.0 https://commons.wikimedia.org/wiki/File:Power_pole_pin.jpg +power_attachment_suspension... CC-BY-SA 4.0 https://commons.wikimedia.org/wiki/File:Power_pole_suspension.jpg + produce_agave.jpg CC-BY-SA 3.0 Marc Ryckaert, under username MJJR https://commons.wikimedia.org/wiki/File:Agave_americana_R01.jpg produce_almond.jpg CC-BY-SA 2.0 antcaesar https://commons.wikimedia.org/wiki/File:Madrigueras_(20578932389)_(cropped).jpg produce_apple.jpg CC0 https://www.pexels.com/photo/close-up-of-fruits-hanging-on-tree-257840/ - archived at https://web.archive.org/web/20210507233404/https://www.pexels.com/photo/close-up-of-fruits-hanging-on-tree-257840/ diff --git a/app/src/main/res/drawable-hdpi/power_attachment_anchor.jpg b/app/src/main/res/drawable-hdpi/power_attachment_anchor.jpg new file mode 100644 index 0000000000..f7e1062663 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/power_attachment_anchor.jpg differ diff --git a/app/src/main/res/drawable-hdpi/power_attachment_pin.jpg b/app/src/main/res/drawable-hdpi/power_attachment_pin.jpg new file mode 100644 index 0000000000..92cb592e60 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/power_attachment_pin.jpg differ diff --git a/app/src/main/res/drawable-hdpi/power_attachment_suspension.jpg b/app/src/main/res/drawable-hdpi/power_attachment_suspension.jpg new file mode 100644 index 0000000000..8e5f5c7ca0 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/power_attachment_suspension.jpg differ diff --git a/app/src/main/res/drawable-mdpi/power_attachment_anchor.jpg b/app/src/main/res/drawable-mdpi/power_attachment_anchor.jpg new file mode 100644 index 0000000000..4ecaecc57b Binary files /dev/null and b/app/src/main/res/drawable-mdpi/power_attachment_anchor.jpg differ diff --git a/app/src/main/res/drawable-mdpi/power_attachment_pin.jpg b/app/src/main/res/drawable-mdpi/power_attachment_pin.jpg new file mode 100644 index 0000000000..6b4c3c1aab Binary files /dev/null and b/app/src/main/res/drawable-mdpi/power_attachment_pin.jpg differ diff --git a/app/src/main/res/drawable-mdpi/power_attachment_suspension.jpg b/app/src/main/res/drawable-mdpi/power_attachment_suspension.jpg new file mode 100644 index 0000000000..b9f9d37d12 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/power_attachment_suspension.jpg differ diff --git a/app/src/main/res/drawable-xhdpi/power_attachment_anchor.jpg b/app/src/main/res/drawable-xhdpi/power_attachment_anchor.jpg new file mode 100644 index 0000000000..589e48370a Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/power_attachment_anchor.jpg differ diff --git a/app/src/main/res/drawable-xhdpi/power_attachment_pin.jpg b/app/src/main/res/drawable-xhdpi/power_attachment_pin.jpg new file mode 100644 index 0000000000..ab1159774f Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/power_attachment_pin.jpg differ diff --git a/app/src/main/res/drawable-xhdpi/power_attachment_suspension.jpg b/app/src/main/res/drawable-xhdpi/power_attachment_suspension.jpg new file mode 100644 index 0000000000..35114829bc Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/power_attachment_suspension.jpg differ diff --git a/app/src/main/res/drawable-xxhdpi/power_attachment_anchor.jpg b/app/src/main/res/drawable-xxhdpi/power_attachment_anchor.jpg new file mode 100644 index 0000000000..56e18e56f1 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/power_attachment_anchor.jpg differ diff --git a/app/src/main/res/drawable-xxhdpi/power_attachment_pin.jpg b/app/src/main/res/drawable-xxhdpi/power_attachment_pin.jpg new file mode 100644 index 0000000000..c80d3e35a0 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/power_attachment_pin.jpg differ diff --git a/app/src/main/res/drawable-xxhdpi/power_attachment_suspension.jpg b/app/src/main/res/drawable-xxhdpi/power_attachment_suspension.jpg new file mode 100644 index 0000000000..290cb64eef Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/power_attachment_suspension.jpg differ diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 66a7e64b3b..6e0e607f5e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1357,6 +1357,11 @@ If there are no signs along the whole street which apply for the highlighted sec What’s the royal cypher on this postbox? No royal cypher is visible The Crown of Scotland + + How is this power line attached? + Supported from above + Fixed horizontally + Supported from below What’s this pole made of?