Skip to content

Commit

Permalink
58.22
Browse files Browse the repository at this point in the history
  • Loading branch information
Helium314 committed Aug 25, 2024
1 parent 8c71e8e commit 1578082
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 44 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ android {
applicationId = "de.westnordost.streetcomplete.expert"
minSdk = 21
targetSdk = 34
versionCode = 5804
versionName = "58.21"
versionCode = 5805
versionName = "58.22"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,16 @@ import de.westnordost.streetcomplete.data.osm.osmquests.OsmElementQuestType
import de.westnordost.streetcomplete.data.user.achievements.EditTypeAchievement.PEDESTRIAN
import de.westnordost.streetcomplete.osm.Tags
import de.westnordost.streetcomplete.osm.isCrossing
import de.westnordost.streetcomplete.osm.updateCheckDateForKey

private const val PREF_CROSSING_MARKING_EXTENDED = "quest_pedestrian_crossing_markings_extended"

class AddCrossingMarkings : OsmElementQuestType<CrossingMarkings> {

private val crossingFilter
get() =
"""
private val crossingFilter by lazy { """
nodes with
highway = crossing
and foot != no
and $crossingMarkingExpression
and (!crossing:signals or crossing:signals = no)
""".toElementFilterExpression()
""".toElementFilterExpression() }

/* only looking for crossings that have no crossing=* at all set because if the crossing was
* - if it had markings, it would be tagged with "marked","zebra" or "uncontrolled"
Expand All @@ -34,13 +29,11 @@ class AddCrossingMarkings : OsmElementQuestType<CrossingMarkings> {
* it would be spammy to ask about markings because the answer would almost always be "yes".
* Might differ per country, research necessary. */

private val excludedWaysFilter by lazy {
"""
private val excludedWaysFilter by lazy { """
ways with
highway and access ~ private|no
or highway = service and service = driveway
""".toElementFilterExpression()
}
""".toElementFilterExpression() }

override val changesetComment = "Specify type or existence of pedestrian crossing markings"
override val wikiLink = "Key:crossing:markings"
Expand All @@ -65,26 +58,14 @@ class AddCrossingMarkings : OsmElementQuestType<CrossingMarkings> {
if (!crossingFilter.matches(element)) false else null

override fun createForm() =
if (isCrossingMarkingExtended) {
if (prefs.getBoolean(PREF_CROSSING_MARKING_EXTENDED, false)) {
AddCrossingMarkingsForm()
} else {
AddCrossingMarkingsYesNoForm()
}

override fun applyAnswerTo(
answer: CrossingMarkings,
tags: Tags,
geometry: ElementGeometry,
timestampEdited: Long
) {
override fun applyAnswerTo(answer: CrossingMarkings, tags: Tags, geometry: ElementGeometry, timestampEdited: Long) {
tags["crossing:markings"] = answer.osmValue
if (isCrossingMarkingExtended) {
tags.updateCheckDateForKey("check_date:crossing")
}
/* We only tag yes/no, however, in countries where depending on the kind of marking,
* different traffic rules apply, it makes sense to ask which marking it is. But to know
* which kinds exist per country needs research. (Whose results should be added to the
* wiki page for crossing:markings first) */
}

override val hasQuestSettings: Boolean = true
Expand All @@ -100,20 +81,11 @@ class AddCrossingMarkings : OsmElementQuestType<CrossingMarkings> {
}
.create()

private val isCrossingMarkingExtended
get() = prefs.getBoolean(PREF_CROSSING_MARKING_EXTENDED, false)

private val crossingMarkingExpression: String
get() =
if (isCrossingMarkingExtended) {
"""
( !crossing:markings or crossing:markings=yes )
""".trimIndent()
} else {
"""
!crossing:markings
and (!crossing or crossing = island )
""".trimIndent()
}

private val crossingMarkingExpression = if (prefs.getBoolean(PREF_CROSSING_MARKING_EXTENDED, false)) {
"( !crossing:markings or crossing:markings=yes )"
} else {
"!crossing:markings and (!crossing or crossing = island )"
}
}

private const val PREF_CROSSING_MARKING_EXTENDED = "qs_AddCrossingMarkings_extended"
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ class SceneMapComponent(
private fun getSceneFilePath(): String {
val currentNightMode = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
val isNightMode = currentNightMode == Configuration.UI_MODE_NIGHT_YES
val theme = Theme.valueOf(prefs.getString(Preferences.THEME_SELECT, "SYSTEM"))
val themeString = prefs.getString(Preferences.THEME_SELECT, "SYSTEM")
val theme = Theme.valueOf(if (themeString == "AUTO") "SYSTEM" else themeString)
val isHighContrastNightMode = theme == Theme.DARK_CONTRAST
val offsetFix = if (prefs.getBoolean(Prefs.OFFSET_FIX, false)) "-offset-fix" else ""
val noSatelliteLabel = if (prefs.getBoolean(Prefs.NO_SATELLITE_LABEL, false)) "-no-label" else ""
Expand Down

0 comments on commit 1578082

Please sign in to comment.