Skip to content
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 @@ -91,6 +91,7 @@ import de.westnordost.streetcomplete.quests.existence.CheckExistence
import de.westnordost.streetcomplete.quests.ferry.AddFerryAccessBicycle
import de.westnordost.streetcomplete.quests.ferry.AddFerryAccessMotorVehicle
import de.westnordost.streetcomplete.quests.ferry.AddFerryAccessPedestrian
import de.westnordost.streetcomplete.quests.ferry.AddFerryToll
import de.westnordost.streetcomplete.quests.fire_hydrant.AddFireHydrantType
import de.westnordost.streetcomplete.quests.fire_hydrant_diameter.AddFireHydrantDiameter
import de.westnordost.streetcomplete.quests.fire_hydrant_position.AddFireHydrantPosition
Expand Down Expand Up @@ -460,6 +461,7 @@ fun questTypeRegistry(
// ferry: usually visible from looking at the boat, but not always...
101 to AddFerryAccessPedestrian(),
102 to AddFerryAccessMotorVehicle(),
195 to AddFerryToll(),
196 to AddFerryAccessBicycle(),

// aerial way: usually visible from looking at the aerial way, but not always...
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package de.westnordost.streetcomplete.quests.ferry

import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.data.elementfilter.toElementFilterExpression
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.Way
import de.westnordost.streetcomplete.data.osm.mapdata.filter
import de.westnordost.streetcomplete.data.osm.osmquests.OsmElementQuestType
import de.westnordost.streetcomplete.data.quest.AndroidQuest
import de.westnordost.streetcomplete.data.user.achievements.EditTypeAchievement.RARE
import de.westnordost.streetcomplete.osm.Tags
import de.westnordost.streetcomplete.quests.YesNoQuestForm
import de.westnordost.streetcomplete.util.ktx.toYesNo

class AddFerryToll : OsmElementQuestType<Boolean>, AndroidQuest {

private val filter by lazy {
"""
ways, relations with
route = ferry
and !toll
and !fee
""".toElementFilterExpression()
}

override val changesetComment = "Specify whether a ferry requires payment"
override val wikiLink = "Tag:route=ferry"
override val icon = R.drawable.ic_quest_ferry_fee
override val hasMarkersAtEnds = true
override val achievements = listOf(RARE)

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

override fun createForm() = YesNoQuestForm()

override fun applyAnswerTo(
answer: Boolean,
tags: Tags,
geometry: ElementGeometry,
timestampEdited: Long
) {
tags["toll"] = answer.toYesNo()
}

override fun getApplicableElements(mapData: MapDataWithGeometry): Iterable<Element> {
// same logic as other ferry access quests
val wayIdsInFerryRoutes = wayIdsInFerryRoutes(mapData.relations)
return mapData
.filter(filter)
.filter { it !is Way || it.id !in wayIdsInFerryRoutes }
.asIterable()
}

override fun isApplicableTo(element: Element): Boolean? {
if (!filter.matches(element)) return false
if (element is Way) return null
return true
}
}
1 change: 1 addition & 0 deletions app/src/androidMain/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1152,6 +1152,7 @@ A level counts as a roof level when its windows are in the roof. Subsequently, r
<string name="quest_ferry_pedestrian_title">Does this ferry route transport pedestrians?</string>

<string name="quest_ferry_motor_vehicle_title">Does this ferry route transport motor vehicles?</string>
<string name="quest_ferry_toll_title">Do you generally have to pay to use this ferry?</string>

<string name="quest_ferry_bicycle_title">Are bicycles allowed on this ferry?</string>

Expand Down
50 changes: 50 additions & 0 deletions app/src/main/res/drawable/ic_quest_ferry_fee.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<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.4C1.4,101.7 -9.1,62.6 8.6,32 26.3,1.4 65.4,-9.1 96,8.6c30.6,17.7 41.1,56.8 23.4,87.4"
android:fillColor="#9bbe55"/>
<path
android:fillColor="#FF000000"
android:pathData="M30.4,40c-0.9,0 -1.6,0.4 -1.6,0.8v1.6c0,0.4 0.7,0.8 1.5,0.8l-2.7,18.9h2.8c0.9,0 1.6,0.7 1.6,1.6v4.2H10.1c2.2,7.5 8,16 8,16 1.6,2.4 3.7,4.9 5.2,6.2 15.8,14.5 88.8,5.8 88.8,5.8 0,0 1.6,-5.3 3,-12 0,0 3,-11 3,-16h-19.9v-4.2c0,-0.9 0.7,-1.6 1.6,-1.6h6l-1.3,-6.3h-50.4v-12.6c0.9,0 1.6,-0.4 1.6,-0.8v-1.6c0,-0.4 -0.7,-0.8 -1.6,-0.8h-23.6Z"
android:fillAlpha="0.2"/>
<path
android:pathData="M18,80c1.6,2.4 3.7,4.9 5.2,6.2 15.8,14.5 88.8,5.8 88.8,5.8 0,0 1.6,-5.3 3,-12H18Z"
android:fillColor="#dd2e44"/>
<path
android:pathData="M49.3,23.5c-0.9,0 -1.6,0.7 -1.6,1.6v12.6c0,0.3 0.1,0.7 0.3,0.9h-3.5v-7.2c0,-0.9 -0.7,-1.6 -1.6,-1.6s-1.6,0.7 -1.6,1.6v7.2h-11l-2.8,19.6h2.8c0.9,0 1.6,0.7 1.6,1.6v4.2H10c2.2,7.5 8,16 8,16h97s3,-11 3,-16h-19.9v-4.2c0,-0.9 0.7,-1.6 1.6,-1.6h6l-1.3,-6.3h-50.4v-13.3h-3.5c0.2,-0.3 0.3,-0.6 0.3,-0.9v-12.6c0,-0.9 -0.7,-1.6 -1.6,-1.6h0Z"
android:fillColor="#ccd6dd"/>
<path
android:pathData="M29.9,42.4l-0.9,6.3h12.5v-6.3h-11.5ZM44.5,42.4v6.3h4.7c0.9,0 1.6,-0.7 1.6,-1.6v-3.2c0,-0.9 -0.7,-1.6 -1.6,-1.6h-4.7ZM36.7,58.2c-0.9,0 -1.6,0.7 -1.6,1.6v4.2h15.8v-4.2c0,-0.9 -0.7,-1.6 -1.6,-1.6h-12.6ZM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1.6,-1.6h-3.2Z"
android:fillColor="#66757f"/>
<path
android:pathData="M55.6,38.5c0,0.4 -0.7,0.8 -1.6,0.8h-23.6c-0.9,0 -1.6,-0.4 -1.6,-0.8v-1.6c0,-0.4 0.7,-0.8 1.6,-0.8h23.6c0.9,0 1.6,0.4 1.6,0.8v1.6Z"
android:fillColor="#269"/>
<path
android:pathData="M4.5,88.4c5.2,12.8 14.5,24 27.3,31.5 7.8,4.5 16.1,7.1 24.4,8.1h15.1c19.3,-2.3 37.4,-13.4 47.9,-31.6 1.5,-2.6 2.8,-5.3 3.9,-8 -10,-2 -19.7,-1.6 -29.7,0 -10.1,1.6 -21.6,2.2 -29.7,0 -18,-4.8 -22.9,1.9 -29.7,0 -5.7,-1.6 -14.6,-9.3 -17.1,-0.4l-12.5,0.4Z"
android:fillColor="#3e74c9"/>
<path
android:fillColor="#FF000000"
android:pathData="M21.7,88.1c-1,0 -2,0.3 -2.8,1.1 1.5,2.1 3.2,4.1 4.5,5.2 15.8,14.5 88.8,5.8 88.8,5.8 0,0 1.1,-3.6 2.2,-8.6 -6.9,-0.5 -13.8,0 -20.8,1.1 -10.1,1.6 -21.6,2.2 -29.7,0 -18,-4.8 -22.9,1.9 -29.7,0 -3.7,-1.1 -8.8,-4.7 -12.6,-4.6h0Z"
android:fillAlpha="0.1"/>
<path
android:pathData="M82.1,70.3c-13.3,0 -24,10.7 -24,24s10.7,24 24,24 24,-10.7 24,-24 -10.7,-24 -24,-24Z"
android:strokeAlpha="0.2"
android:strokeLineJoin="round"
android:strokeWidth="4"
android:fillColor="#00000000"
android:strokeColor="#000"
android:strokeLineCap="round"/>
<path
android:pathData="M106.1,90.3c0,13.3 -10.7,24 -24,24s-24,-10.7 -24,-24 10.7,-24 24,-24 24,10.7 24,24"
android:strokeLineJoin="round"
android:strokeWidth="4"
android:fillColor="#dbdbdb"
android:strokeColor="#a6a6a6"
android:strokeLineCap="round"/>
<path
android:pathData="M79.1,72v4.2c-1.5,0.3 -2.8,1 -4,1.9 -2,1.7 -3,3.8 -3,6.5s0.4,3.4 1.3,4.5 2,2 3.3,2.5c1.4,0.5 3.1,1 5.1,1.5 1.6,0.4 2.8,0.7 3.6,1.1 0.8,0.4 1.2,1 1.2,2s-0.4,1.8 -1.3,2.3c-0.9,0.5 -1.9,0.7 -3,0.7 -3.1,0 -5,-1.3 -5.8,-3.9l-6,1.4c0.6,2.6 1.9,4.5 3.9,5.7 1.3,0.8 2.8,1.4 4.5,1.7v3.2h6v-3.2c1.9,-0.3 3.5,-1 4.8,-2 2.3,-1.8 3.4,-4.1 3.4,-6.9s-1.2,-5 -3.6,-6.5c-0.9,-0.6 -1.7,-1 -2.7,-1.3 -0.9,-0.3 -2.4,-0.6 -4.5,-1.1 -2.7,-0.4 -4,-1.4 -4,-2.8s1.3,-2.6 3.8,-2.6 4,1.1 4.8,3.3l5.4,-1.8c-1.2,-3.5 -3.7,-5.5 -7.5,-6.2v-4.1h-6Z"
android:fillColor="#a6a6a6"/>
</vector>
18 changes: 18 additions & 0 deletions res/graphics/quest/ferry_fee.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.