-
-
Notifications
You must be signed in to change notification settings - Fork 412
New quest: In what direction can bicycles ride on this sidewalk? #6817
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
base: master
Are you sure you want to change the base?
Changes from all commits
1168569
5c342e9
9531030
a08fa73
fa8844a
b6541e3
00b0e39
913d326
268cb79
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| package de.westnordost.streetcomplete.quests.oneway | ||
|
|
||
| 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.AndroidQuest | ||
| import de.westnordost.streetcomplete.data.quest.NoCountriesExcept | ||
| import de.westnordost.streetcomplete.data.user.achievements.EditTypeAchievement.BICYCLIST | ||
| import de.westnordost.streetcomplete.osm.Tags | ||
| import de.westnordost.streetcomplete.quests.oneway.OnewayAnswer.BACKWARD | ||
| import de.westnordost.streetcomplete.quests.oneway.OnewayAnswer.FORWARD | ||
| import de.westnordost.streetcomplete.quests.oneway.OnewayAnswer.NO_ONEWAY | ||
| import de.westnordost.streetcomplete.resources.Res | ||
| import de.westnordost.streetcomplete.resources.default_disabled_msg_maxspeed | ||
| import de.westnordost.streetcomplete.resources.quest_arrow_tutorial | ||
| import de.westnordost.streetcomplete.resources.quest_cycleway_direction_title | ||
|
|
||
| class AddCyclewayDirection : OsmFilterQuestType<OnewayAnswer>(), AndroidQuest { | ||
|
|
||
| override val elementFilter = """ | ||
| ways with | ||
| highway ~ path|footway|cycleway | ||
| and (footway = sidewalk or is_sidepath = yes) | ||
| and bicycle ~ yes|designated | ||
| and !oneway | ||
| and !oneway:bicycle | ||
| and area != yes | ||
| and junction != roundabout | ||
| and access !~ private|no | ||
| """ | ||
|
|
||
| override val changesetComment = "Specify in which direction cyclists may ride this path" | ||
| override val wikiLink = "Key:oneway:bicycle" | ||
| override val icon = R.drawable.quest_bicycleway_oneway | ||
| override val title = Res.string.quest_cycleway_direction_title | ||
| override val hasMarkersAtEnds = true | ||
| override val achievements = listOf(BICYCLIST) | ||
| override val hint = Res.string.quest_arrow_tutorial | ||
| override val defaultDisabledMessage = Res.string.default_disabled_msg_visible_sign_bicycle_sidewalk_access | ||
| override val enabledInCountries = NoCountriesExcept("DE", "AT", "DK", "NL", "FI", "NO") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. better to each link to the source of this information, as comments, if known. @RubenKelevra did some research in the linked ticket. |
||
|
|
||
| override fun createForm() = AddCyclewayDirectionForm() | ||
|
|
||
| override fun applyAnswerTo( | ||
| answer: OnewayAnswer, | ||
| tags: Tags, | ||
| geometry: ElementGeometry, | ||
| timestampEdited: Long, | ||
| ) { | ||
| val key = if (tags["highway"] == "cycleway" && | ||
| tags["foot"] !in setOf("yes", "designated") && | ||
| tags["segregated"] != "yes" | ||
| ) { | ||
| "oneway" | ||
| } else { | ||
| "oneway:bicycle" | ||
| } | ||
|
|
||
| tags[key] = when (answer) { | ||
| FORWARD -> "yes" | ||
| BACKWARD -> "-1" | ||
| NO_ONEWAY -> "no" | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| package de.westnordost.streetcomplete.quests.oneway | ||
|
|
||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.runtime.remember | ||
| import de.westnordost.streetcomplete.quests.AItemSelectQuestForm | ||
| import de.westnordost.streetcomplete.resources.Res | ||
| import de.westnordost.streetcomplete.resources.quest_cycleway_direction_dir | ||
| import de.westnordost.streetcomplete.resources.quest_cycleway_direction_no_oneway | ||
| import de.westnordost.streetcomplete.ui.common.item_select.ImageWithLabel | ||
| import de.westnordost.streetcomplete.ui.util.ClipCirclePainter | ||
| import kotlinx.serialization.serializer | ||
| import org.jetbrains.compose.resources.StringResource | ||
| import org.jetbrains.compose.resources.painterResource | ||
| import org.jetbrains.compose.resources.stringResource | ||
|
|
||
| class AddCyclewayDirectionForm : AItemSelectQuestForm<OnewayAnswer, OnewayAnswer>() { | ||
|
|
||
| override val items = OnewayAnswer.entries | ||
| override val itemsPerRow = 3 | ||
| override val serializer = serializer<OnewayAnswer>() | ||
|
|
||
| @Composable override fun ItemContent(item: OnewayAnswer) { | ||
| val painter = painterResource(item.icon) | ||
| ImageWithLabel( | ||
| painter = remember(painter) { ClipCirclePainter(painter) }, | ||
| label = stringResource(item.cyclewayDirectionTitle), | ||
| imageRotation = geometryRotation.floatValue - mapRotation.floatValue, | ||
| ) | ||
| } | ||
|
|
||
| override fun onClickOk(selectedItem: OnewayAnswer) { | ||
| applyAnswer(selectedItem) | ||
| } | ||
| } | ||
|
|
||
| private val OnewayAnswer.cyclewayDirectionTitle: StringResource get() = when (this) { | ||
| OnewayAnswer.FORWARD, OnewayAnswer.BACKWARD -> Res.string.quest_cycleway_direction_dir | ||
| OnewayAnswer.NO_ONEWAY -> Res.string.quest_cycleway_direction_no_oneway | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1315,6 +1315,11 @@ If there are no signs along the whole street which apply for the highlighted sec | |
| <string name="quest_oneway2_title">Is this a one-way street? In which direction?</string> | ||
| <string name="quest_oneway2_dir">Oneway in this direction</string> | ||
| <string name="quest_oneway2_no_oneway">Not a oneway</string> | ||
| <string name="quest_cycleway_direction_title">In what direction are you allowed to cycle on this sidewalk?</string> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As noted in the linked ticket, it must be clear that the user must look for an explicit sign, just like it must be clear in the maxspeed quest. Something like "Does a sign indicate that cyclists may go both directions here? If not, in which direction do cyclists go here?". Now, that's a bit long, but this is the information that must come across. So, another option is, if not to put this into the question, put it below the question into the quest form but above the item selection. Also, I wouldn't refer to a cycle track as a "sidewalk", also not in German. I don't think this is an issue though, you can just write "here" instead of "on this sidewalk". The type of thing should already be written below the quest title. |
||
| <string name="quest_cycleway_direction_dir">Only this direction</string> | ||
| <string name="quest_cycleway_direction_no_oneway">In both directions</string> | ||
|
|
||
| <string name="default_disabled_msg_visible_sign_bicycle_sidewalk_access">This quest type is disabled by default because bicycle access on sidewalks is only indicated by specific signs at start/end of a sidewalk.</string> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This explanation doesn't really explain why it is disabled. The reason why it is disabled is not that it is specific signs, but because the user potentially needs to walk to the next intersection to see that sign, and that may be a little far. Maybe use similar wording as for the maxspeed quest. |
||
|
|
||
| <string name="quest_openingHours_title">What are the opening hours here?</string> | ||
| <string name="quest_openingHours_signed_title">Are the opening hours here signed?</string> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.