-
-
Notifications
You must be signed in to change notification settings - Fork 406
Add quest to specify whether a ferry requires payment #6726
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
Open
mcliquid
wants to merge
5
commits into
streetcomplete:master
Choose a base branch
from
mcliquid:feature/add-ferry-toll-quest-6333
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b09973e
Add quest to specify whether a ferry requires payment
mcliquid dbf060c
Adding icon
mcliquid 81bb033
remove filter for sub keys
mcliquid 06c6020
Update wiki link for ferry toll quest
mcliquid 2e90bff
Merge branch 'master' into feature/add-ferry-toll-quest-6333
mcliquid File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
app/src/androidMain/kotlin/de/westnordost/streetcomplete/quests/ferry/AddFerryToll.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| 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 | ||
| and toll !~ ".+" | ||
| and fee !~ ".+" | ||
| """.toElementFilterExpression() | ||
| } | ||
|
|
||
| override val changesetComment = "Specify whether a ferry requires payment" | ||
| override val wikiLink = "Key:toll" | ||
| 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 | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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,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6v3.2c0,0.9 0.7,1.6 1.6,1.6h3.2c0.9,0 1.6,-0.7 1.6,-1.6v-3.2c0,-0.9 -0.7,-1.6 -1.6,-1.6h-3.2ZM77.6,70.8c-0.9,0 -1.6,0.7 -1.6,1.6v3.2c0,0.9 0.7,1.6 1.6,1.6h3.2c0.9,0 1.6,-0.7 1.6,-1.6v-3.2c0,-0.9 -0.7,-1.6 -1.6,-1.6h-3.2ZM90.3,70.8c-0.9,0 -1.6,0.7 -1.6,1.6v3.2c0,0.9 0.7,1.6 1.6,1.6h3.2c0.9,0 1.6,-0.7 1.6,-1.6v-3.2c0,-0.9 -0.7,-1.6 -1.6,-1.6h-3.2ZM102.9,70.8c-0.9,0 -1.6,0.7 -1.6,1.6v3.2c0,0.9 0.7,1.6 1.6,1.6h3.2c0.9,0 1.6,-0.7 1.6,-1.6v-3.2c0,-0.9 -0.7,-1.6 -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> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.