forked from streetcomplete/StreetComplete
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
160 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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 was deleted.
Oops, something went wrong.
This file contains 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 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 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 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 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 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
45 changes: 45 additions & 0 deletions
45
app/src/main/java/de/westnordost/streetcomplete/quests/moped/AddMopedAccess.kt
This file contains 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,45 @@ | ||
package de.westnordost.streetcomplete.quests.moped | ||
|
||
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.quest.NoCountriesExcept | ||
import de.westnordost.streetcomplete.data.user.achievements.EditTypeAchievement | ||
import de.westnordost.streetcomplete.osm.Tags | ||
|
||
class AddProhibitedForMoped : OsmFilterQuestType<AddMopedAccessAnswer>() { | ||
|
||
override val elementFilter = """ | ||
ways with ( | ||
highway = cycleway | ||
or highway = path and bicycle = designated | ||
or highway = footway and bicycle = designated | ||
) | ||
and !moped | ||
and (motor_vehicle != no or !motor_vehicle) | ||
""" | ||
override val enabledInCountries = NoCountriesExcept("BE") | ||
override val defaultDisabledMessage = R.string.default_disabled_msg_visible_sign_moped | ||
override val changesetComment = "Specify if a moped is allowed on the cycleway" | ||
override val wikiLink = "Key:moped" | ||
override val icon = R.drawable.ic_quest_moped_access | ||
|
||
override val achievements = listOf(EditTypeAchievement.BICYCLIST) | ||
|
||
override fun getTitle(tags: Map<String, String>) = R.string.quest_moped_access_title | ||
|
||
override fun createForm() = AddMopedAccessForm() | ||
|
||
override fun applyAnswerTo( | ||
answer: AddMopedAccessAnswer, | ||
tags: Tags, | ||
geometry: ElementGeometry, | ||
timestampEdited: Long, | ||
) { | ||
tags["moped"] = when (answer) { | ||
AddMopedAccessAnswer.ALLOWED -> "yes" | ||
AddMopedAccessAnswer.FORBIDDEN -> "no" | ||
AddMopedAccessAnswer.DESIGNATED -> "designated" | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
app/src/main/java/de/westnordost/streetcomplete/quests/moped/AddMopedAccessAnswer.kt
This file contains 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,7 @@ | ||
package de.westnordost.streetcomplete.quests.moped | ||
|
||
enum class AddMopedAccessAnswer { | ||
ALLOWED, | ||
DESIGNATED, | ||
FORBIDDEN | ||
} |
19 changes: 19 additions & 0 deletions
19
app/src/main/java/de/westnordost/streetcomplete/quests/moped/AddMopedAccessForm.kt
This file contains 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,19 @@ | ||
package de.westnordost.streetcomplete.quests.moped | ||
|
||
import de.westnordost.streetcomplete.R | ||
import de.westnordost.streetcomplete.quests.AListQuestForm | ||
import de.westnordost.streetcomplete.quests.TextItem | ||
import de.westnordost.streetcomplete.quests.moped.AddMopedAccessAnswer.FORBIDDEN | ||
import de.westnordost.streetcomplete.quests.moped.AddMopedAccessAnswer.ALLOWED | ||
import de.westnordost.streetcomplete.quests.moped.AddMopedAccessAnswer.DESIGNATED | ||
|
||
|
||
|
||
class AddMopedAccessForm : AListQuestForm<AddMopedAccessAnswer>() { | ||
|
||
override val items = listOf( | ||
TextItem(DESIGNATED, R.string.quest_moped_access_designated), | ||
TextItem(FORBIDDEN, R.string.quest_moped_access_forbidden), | ||
TextItem(ALLOWED, R.string.quest_moped_access_allowed) | ||
) | ||
} |
4 changes: 4 additions & 0 deletions
4
app/src/main/java/de/westnordost/streetcomplete/util/ktx/Enum.kt
This file contains 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,4 @@ | ||
package de.westnordost.streetcomplete.util.ktx | ||
|
||
inline fun <reified E : Enum<E>> valueOfOrNull(str: String): E? = | ||
enumValues<E>().firstOrNull { str == it.name } |
This file contains 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 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,8 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:name="vector" android:width="128dp" android:height="128dp" android:viewportWidth="128" android:viewportHeight="128"> | ||
<path android:name="path" android:pathData="M 119.44 96.041 C 101.767 126.652 62.625 137.14 32.014 119.467 C 1.403 101.794 -9.085 62.652 8.588 32.041 C 26.261 1.43 65.403 -9.058 96.014 8.615 C 126.625 26.288 137.113 65.43 119.44 96.041" android:fillColor="#ca72e2" android:strokeWidth="1"/> | ||
<path android:name="path_1" android:pathData="M 68.002 128.04 C 71.368 127.862 74.718 127.344 78.002 126.645 L 125.123 45.184 C 124.086 41.99 123.419 39.478 121.002 36.184 C 121.002 36.184 68.002 128.184 68.002 128.04 Z" android:fillColor="#000000" android:fillAlpha="0.2" android:strokeWidth="1"/> | ||
<path android:name="path_2" android:pathData="M 96.003 8.651 C 85.901 2.819 74.871 0.072 63.989 0.084 L 8.577 96.061 C 14.007 105.491 21.901 113.67 32.003 119.502 C 42.087 125.324 53.095 128.071 63.958 128.069 L 119.399 32.042 C 113.97 22.633 106.086 14.473 96.003 8.652 Z" android:fillColor="#999999" android:strokeWidth="1"/> | ||
<path android:name="path_3" android:pathData="M 119.46 32 L 64.044 127.983 C 67.289 127.98 70.519 127.733 73.709 127.244 L 123.652 40.74 C 122.481 37.733 121.08 34.812 119.46 32 Z M 64.034 0 C 60.789 0.003 57.559 0.25 54.369 0.739 L 4.426 87.243 C 5.597 90.25 6.998 93.171 8.618 95.983 Z" android:fillColor="#ffffff" android:strokeWidth="1"/> | ||
<path android:name="path_4" android:pathData="M 56.221 50.498 L 58.115 51.626 L 45.914 63.161 C 46.414 63.637 46.869 64.126 47.272 64.623 C 46.873 64.138 46.427 63.661 45.94 63.192 C 42.71 60.235 38.946 59.698 34.749 61.14 L 37.067 64.442 L 46.902 78.477 C 47.482 77.717 47.97 76.963 48.368 76.228 C 48.314 76.335 48.258 76.446 48.196 76.555 L 63.647 85.376 C 61.76 88.691 62.915 92.911 66.232 94.804 C 69.547 96.697 73.765 95.545 75.664 92.237 L 80.72 95.124 C 84.999 88.451 83.232 80.434 77.838 76.684 L 80.901 78.433 C 81.506 78.778 82.289 78.564 82.635 77.958 L 83.327 76.747 C 83.669 76.147 83.457 75.379 82.859 75.038 L 66.873 65.91 L 64.928 69.317 L 64.05 70.854 C 65.801 75.163 63.628 80.086 59.477 80.623 L 52.37 76.566 C 54.386 72.756 53.971 68.512 51.862 63.965 L 57.71 58.648 C 59.737 57.118 60.04 55.254 59.384 53.447 C 60.513 52.394 61.422 51.46 61.848 50.523 L 63.806 52.247 C 64.443 52.809 64.48 53.174 65.11 52.61 C 65.22 52.512 65.319 52.415 65.409 52.304 C 66.129 51.457 65.982 51.458 65.298 50.864 L 63.191 49.054 L 62.477 48.646 L 61.886 47.659 C 61.533 47.065 61.104 46.579 60.588 46.195 L 59.854 45.711 C 59.075 45.266 58.32 44.547 57.455 45.007 C 57.44 45.015 57.411 45.057 57.37 45.119 C 56.991 45.046 56.583 45.127 56.186 45.338 C 55.706 45.591 55.244 46.038 54.907 46.628 C 54.572 47.214 54.419 47.845 54.445 48.387 C 54.473 48.994 54.724 49.505 55.179 49.786 C 55.34 50.129 55.832 50.264 56.221 50.498 Z M 37.075 64.456 L 40.98 70.05 L 39.698 68.26 C 38.358 67.83 36.855 68.381 36.129 69.653 C 35.294 71.115 35.803 72.976 37.263 73.809 C 38.724 74.643 40.586 74.137 41.421 72.674 C 41.677 72.226 41.806 71.736 41.818 71.248 L 44.483 75.063 C 42.475 78.015 38.496 78.969 35.341 77.167 C 32.022 75.272 30.868 71.046 32.763 67.727 C 33.735 66.036 35.317 64.907 37.075 64.456 Z M 56.791 46.162 C 56.374 46.95 55.859 47.972 55.512 48.662 C 55.481 48.569 55.458 48.459 55.455 48.335 C 55.436 47.975 55.546 47.542 55.784 47.124 C 56.025 46.702 56.34 46.391 56.659 46.225 C 56.705 46.202 56.75 46.18 56.791 46.162 Z M 67.008 87.301 L 72.297 90.321 C 71.462 91.775 69.604 92.28 68.148 91.449 C 66.692 90.612 66.181 88.756 67.008 87.301 Z" android:fillColor="#000" android:fillAlpha="0.2" android:strokeWidth="1"/> | ||
<path android:name="path_5" android:pathData="M 56.293 46.517 L 58.186 47.645 L 45.985 59.179 C 46.486 59.655 46.941 60.145 47.344 60.641 C 46.943 60.157 46.498 59.679 46.011 59.21 C 42.781 56.253 39.017 55.716 34.82 57.158 L 37.137 60.46 L 46.974 74.495 C 47.552 73.736 48.042 72.982 48.439 72.246 C 48.384 72.354 48.33 72.465 48.268 72.573 L 63.717 81.394 C 61.83 84.709 62.987 88.929 66.302 90.823 C 69.617 92.715 73.836 91.564 75.734 88.255 L 80.791 91.143 C 85.07 84.469 83.304 76.452 77.909 72.702 L 80.971 74.451 C 81.577 74.797 82.36 74.582 82.706 73.976 L 83.398 72.764 C 83.74 72.166 83.528 71.396 82.931 71.055 L 66.944 61.928 L 64.999 65.334 L 64.121 66.872 C 65.872 71.182 63.7 76.104 59.548 76.642 L 52.441 72.584 C 54.457 68.773 54.042 64.53 51.934 59.982 L 57.78 54.667 C 59.808 53.137 60.112 51.273 59.456 49.466 C 60.584 48.413 61.494 47.478 61.919 46.54 L 63.877 48.265 C 64.515 48.827 64.551 49.192 65.182 48.628 C 65.29 48.53 65.391 48.433 65.48 48.323 C 66.201 47.476 66.053 47.476 65.37 46.882 L 63.263 45.073 L 62.549 44.665 L 61.957 43.676 C 61.605 43.084 61.174 42.597 60.66 42.213 L 59.924 41.729 C 59.146 41.285 58.39 40.566 57.526 41.025 C 57.511 41.033 57.483 41.074 57.442 41.138 C 57.061 41.064 56.655 41.145 56.258 41.355 C 55.777 41.609 55.314 42.057 54.978 42.646 C 54.643 43.232 54.49 43.863 54.516 44.406 C 54.543 45.012 54.794 45.523 55.249 45.805 C 55.412 46.147 55.903 46.282 56.293 46.517 Z M 37.146 60.474 L 41.051 66.069 L 39.769 64.278 C 38.429 63.849 36.926 64.4 36.2 65.672 C 35.365 67.135 35.874 68.994 37.335 69.828 C 38.795 70.662 40.656 70.156 41.491 68.693 C 41.747 68.244 41.877 67.755 41.89 67.267 L 44.554 71.083 C 42.545 74.033 38.567 74.987 35.413 73.186 C 32.094 71.291 30.939 67.064 32.834 63.745 C 33.806 62.054 35.388 60.925 37.146 60.474 Z M 56.862 42.18 C 56.444 42.968 55.93 43.989 55.584 44.68 C 55.552 44.586 55.529 44.478 55.526 44.354 C 55.508 43.992 55.617 43.56 55.855 43.143 C 56.096 42.721 56.411 42.41 56.731 42.244 C 56.776 42.22 56.82 42.198 56.862 42.18 Z M 67.08 83.32 L 72.368 86.339 C 71.533 87.793 69.676 88.299 68.218 87.467 C 66.764 86.631 66.253 84.774 67.08 83.32 Z" android:fillColor="#ffffff" android:strokeWidth="1" android:fillType="evenOdd"/> | ||
</vector> |
This file contains 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
Oops, something went wrong.