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 @@ -124,6 +124,7 @@ import de.westnordost.streetcomplete.quests.moped.AddMopedAccess
import de.westnordost.streetcomplete.quests.motorcycle_parking_capacity.AddMotorcycleParkingCapacity
import de.westnordost.streetcomplete.quests.motorcycle_parking_cover.AddMotorcycleParkingCover
import de.westnordost.streetcomplete.quests.note_discussion.OsmNoteQuestType
import de.westnordost.streetcomplete.quests.oneway.AddCyclewayDirection
import de.westnordost.streetcomplete.quests.oneway.AddOneway
import de.westnordost.streetcomplete.quests.oneway.AddOnewayAerialway
import de.westnordost.streetcomplete.quests.opening_hours.AddOpeningHours
Expand Down Expand Up @@ -554,6 +555,7 @@ fun questTypeRegistry(
// footways
143 to AddPathSurface(), // used by OSM Carto, BRouter, OsmAnd, OSRM, graphhopper...
144 to AddCyclewaySegregation(), // Cyclosm, Valhalla, Bike Citizens Bicycle Navigation...
198 to AddCyclewayDirection(),
145 to AddFootwayPartSurface(),
146 to AddCyclewayPartSurface(),
147 to AddSidewalkSurface(),
Expand Down
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
"""
Comment thread
wielandb marked this conversation as resolved.

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")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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
}
6 changes: 5 additions & 1 deletion app/src/commonMain/composeResources/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,10 @@ Erfolge</string>
<string name="quest_oneway2_title">Ist dies eine Einbahnstraße? In welche Richtung?</string>
<string name="quest_oneway2_dir">Einbahn­straße in diese Richtung</string>
<string name="quest_oneway2_no_oneway">Keine Einbahn­straße</string>
<string name="quest_cycleway_direction_title">In welche Richtung darf man mit dem Fahrrad auf diesem Bürgersteig fahren?</string>
<string name="quest_cycleway_direction_dir">Nur in diese Richtung</string>
<string name="quest_cycleway_direction_no_oneway">In beide Richtungen</string>
<string name="default_disabled_msg_visible_sign_bicycle_sidewalk_access">Dieser Aufgabentyp ist standardmäßig deaktiviert, da der Zugang für für Fahrräder auf dem Bürgersteig nur durch bestimmte Schilder am Anfang/Ende einer Straße gekennzeichnet ist.</string>
<string name="quest_steps_incline_title">Welche Richtung führt hier nach oben?</string>
<string name="quest_steps_incline_up">Hier nach oben</string>
<string name="quest_step_count_title">Wie viele Stufen gibt es hier?</string>
Expand Down Expand Up @@ -1504,4 +1508,4 @@ Zum Beispiel 1,3 oder 2b,4,6.</string>
<string name="quest_shower_hot_water_title">Kann man hier warm duschen?</string>
<string name="calendar_new_event_title">Neues OSM-Event in deiner Gegend!</string>
<string name="pref_title_message_calendar">Neue OSM-Events in deiner Gegend</string>
</resources>
</resources>
6 changes: 6 additions & 0 deletions app/src/commonMain/composeResources/values-en/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1313,6 +1313,12 @@ 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>
<string name="quest_cycleway_direction_dir">Only this way</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>


<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>
Expand Down
5 changes: 5 additions & 0 deletions app/src/commonMain/composeResources/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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>
Expand Down