Skip to content
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

Barrier opening #5713

Merged
merged 27 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
55d619f
1st attempt at gates displaying only
Nick-Tallguy Jun 25, 2024
65c5fbc
Quest files created and mainly updated - still need to;
Nick-Tallguy Jun 29, 2024
c67d5a7
Merge branch 'streetcomplete:master' into barrier_opening
Nick-Tallguy Jun 29, 2024
d1ac501
update number applied to quest - had previously accidentally duplicat…
Nick-Tallguy Jun 29, 2024
d9642f1
remove own copy of WidthAnswer.kt - not needed
Nick-Tallguy Jun 29, 2024
d867ab4
Barriers are now displaying - need to sort the filters. Emulator show…
Nick-Tallguy Jun 30, 2024
7498974
Flters seem to be working okay on emulator - need to produce apk and …
Nick-Tallguy Jun 30, 2024
7112015
Amendments to pull request;
Nick-Tallguy Jul 5, 2024
1f7deea
amend indentation to remove warning on Android Studio - Lint issue
Nick-Tallguy Jul 5, 2024
01fd90b
remove reference to removed string in Form
Nick-Tallguy Jul 6, 2024
36b6331
remove reference to removed string in Form
Nick-Tallguy Jul 8, 2024
94dfa3d
remove unnecessary code & amend if / else statement
Nick-Tallguy Jul 8, 2024
3dc607f
Merge branch 'master' into barrier_opening
Nick-Tallguy Jul 11, 2024
b6205fd
remove duplicate strings brought in from merge.
Nick-Tallguy Jul 12, 2024
7dcdcf9
add wheelchair width icon
Nick-Tallguy Jul 12, 2024
061028d
add icon based on wheelchair icon, and amend files to include.
Nick-Tallguy Jul 12, 2024
8c8032c
Update app/src/main/java/de/westnordost/streetcomplete/quests/barrier…
Nick-Tallguy Jul 12, 2024
bf7ef42
Update app/src/main/java/de/westnordost/streetcomplete/quests/barrier…
Nick-Tallguy Jul 12, 2024
a611509
Merge branch 'master' into amend3
Nick-Tallguy Jul 21, 2024
bb96cc2
Merge branch 'master' into barrier_opening
Nick-Tallguy Jul 23, 2024
0d379f0
Merge branch 'master' into amend3
Nick-Tallguy Jul 23, 2024
981929d
remove if/else choice, update line 59 with maxwidth:physical as tag t…
Nick-Tallguy Jul 23, 2024
627fccf
Merge branch 'barrier_opening' into amend3
Nick-Tallguy Jul 23, 2024
5ccb88b
remove AddGateWidthForm.kt, amend AddWidthForm.kt and update AddBarri…
Nick-Tallguy Jul 23, 2024
0386224
amend indentation
Nick-Tallguy Jul 23, 2024
10cdf86
remove last changes to AddWidthForm &
Nick-Tallguy Jul 23, 2024
db00d20
fix indentation
westnordost Jul 24, 2024
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 @@ -25,6 +25,7 @@ import de.westnordost.streetcomplete.quests.atm_operator.AddAtmOperator
import de.westnordost.streetcomplete.quests.baby_changing_table.AddBabyChangingTable
import de.westnordost.streetcomplete.quests.barrier_bicycle_barrier_installation.AddBicycleBarrierInstallation
import de.westnordost.streetcomplete.quests.barrier_bicycle_barrier_type.AddBicycleBarrierType
import de.westnordost.streetcomplete.quests.barrier_opening.AddBarrierOpening
import de.westnordost.streetcomplete.quests.barrier_type.AddBarrierOnPath
import de.westnordost.streetcomplete.quests.barrier_type.AddBarrierOnRoad
import de.westnordost.streetcomplete.quests.barrier_type.AddBarrierType
Expand Down Expand Up @@ -501,6 +502,7 @@ fun questTypeRegistry(
140 to AddRoadWidth(arSupportChecker),
141 to AddRoadSmoothness(),
142 to AddPathSmoothness(),
170 to AddBarrierOpening(arSupportChecker),

// footways
143 to AddPathSurface(), // used by OSM Carto, BRouter, OsmAnd, OSRM, graphhopper...
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package de.westnordost.streetcomplete.quests.barrier_opening

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.osmquests.OsmElementQuestType
import de.westnordost.streetcomplete.data.user.achievements.EditTypeAchievement.BICYCLIST
import de.westnordost.streetcomplete.data.user.achievements.EditTypeAchievement.WHEELCHAIR
import de.westnordost.streetcomplete.osm.Tags
import de.westnordost.streetcomplete.quests.width.AddWidthForm
import de.westnordost.streetcomplete.quests.width.WidthAnswer
import de.westnordost.streetcomplete.screens.measure.ArSupportChecker

class AddBarrierOpening(
private val checkArSupport: ArSupportChecker
) : OsmElementQuestType<WidthAnswer> {

private val nodeFilter by lazy { """
nodes with
barrier ~ gate|entrance|sliding_gate|swing_gate|wicket_gate
and (!maxwidth:physical or source:maxwidth_physical ~ ".*estimat.*")
and (!width or source:width ~ ".*estimat.*")
and (!maxwidth or source:maxwidth ~ ".*estimat.*")
and access !~ private|no|customers|agricultural
""".toElementFilterExpression() }

private val excludedWaysFilter by lazy { """
ways with
highway and access ~ private|no|customers|agricultural
""".toElementFilterExpression() }

override val changesetComment = "Specify width of opening"
override val wikiLink = "Key:barrier"
override val icon = R.drawable.ic_quest_barrier_opening
override val achievements = listOf(BICYCLIST, WHEELCHAIR)
override val defaultDisabledMessage: Int
get() = if (!checkArSupport()) R.string.default_disabled_msg_no_ar else 0

override fun getTitle(tags: Map<String, String>) = R.string.quest_barrier_opening_width_gate

override fun getApplicableElements(mapData: MapDataWithGeometry): Iterable<Element> {
val excludedWayNodeIds = mapData.ways
.filter { excludedWaysFilter.matches(it) }
.flatMapTo(HashSet()) { it.nodeIds }

return mapData.nodes
.filter { nodeFilter.matches(it) && it.id !in excludedWayNodeIds }
}

override fun isApplicableTo(element: Element) =
if (nodeFilter.matches(element)) null else false

override fun createForm() = AddWidthForm()

override fun applyAnswerTo(answer: WidthAnswer, tags: Tags, geometry: ElementGeometry, timestampEdited: Long) {

val key = "maxwidth:physical"

tags[key] = answer.width.toOsmValue()

if (answer.isARMeasurement) {
tags["source:$key"] = "ARCore"
} else {
tags.remove("source:$key")
}

}
}
88 changes: 88 additions & 0 deletions app/src/main/res/drawable/ic_quest_barrier_opening.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<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="m128,64c0,35.35 -28.65,64 -64,64s-64,-28.65 -64,-64 28.65,-64 64,-64 64,28.65 64,64"
android:fillColor="#529add"/>
<path
android:pathData="m80.18,100.46a23.16,23.16 0,0 1,-23.57 8.84,23.16 23.16,0 0,1 -17.71,-17.89 23.16,23.16 0,0 1,9.09 -23.48"
android:strokeAlpha="0.2"
android:strokeWidth="10"
android:fillColor="#00000000"
android:strokeColor="#000"
android:strokeLineCap="round"/>
<path
android:pathData="m95.99,99.93 l-12.26,-24.9 -21.22,-3.9c3.14,-6.74 5.09,-18.54 5.22,-25.68"
android:strokeAlpha="0.2"
android:strokeLineJoin="round"
android:strokeWidth="12"
android:fillColor="#00000000"
android:strokeColor="#000"
android:strokeLineCap="round"/>
<path
android:pathData="m37.28,60.24c3.93,-11.54 13.21,-15 30.46,-14.79"
android:strokeAlpha="0.2"
android:strokeLineJoin="round"
android:strokeWidth="10"
android:fillColor="#00000000"
android:strokeColor="#000"
android:strokeLineCap="round"/>
<path
android:fillColor="#FF000000"
android:pathData="m86.33,27.37a10.15,10.15 0,0 1,-10.15 10.15,10.15 10.15,0 0,1 -10.15,-10.15 10.15,10.15 0,0 1,10.15 -10.15,10.15 10.15,0 0,1 10.15,10.15"
android:strokeAlpha="0.2"
android:fillAlpha="0.2"/>
<path
android:pathData="m80.18,96.53a23.16,23.16 0,0 1,-23.57 8.84,23.16 23.16,0 0,1 -17.71,-17.89 23.16,23.16 0,0 1,9.09 -23.48"
android:strokeWidth="10"
android:fillColor="#00000000"
android:strokeColor="#fff"
android:strokeLineCap="round"/>
<path
android:pathData="m95.99,96 l-12.26,-24.9 -21.22,-3.9c3.14,-6.74 5.09,-18.54 5.22,-25.68"
android:strokeLineJoin="round"
android:strokeWidth="12"
android:fillColor="#00000000"
android:strokeColor="#fff"
android:strokeLineCap="round"/>
<path
android:pathData="m37.28,56.31c3.93,-11.54 13.21,-15 30.46,-14.79"
android:strokeLineJoin="round"
android:strokeWidth="10"
android:fillColor="#00000000"
android:strokeColor="#fff"
android:strokeLineCap="round"/>
<path
android:pathData="m86.33,23.44a10.15,10.15 0,0 1,-10.15 10.15,10.15 10.15,0 0,1 -10.15,-10.15 10.15,10.15 0,0 1,10.15 -10.15,10.15 10.15,0 0,1 10.15,10.15"
android:fillColor="#fff"/>
<path
android:fillColor="#FF000000"
android:pathData="m30.8,80h80.46c1.53,0 2.77,1.24 2.77,2.77v18.46c0,1.53 -1.24,2.77 -2.77,2.77h-80.46c-1.53,0 -2.77,-1.24 -2.77,-2.77v-18.46c0,-1.53 1.24,-2.77 2.77,-2.77z"
android:fillAlpha="0.2"/>
<path
android:pathData="m30.69,76h80.69c1.47,0 2.65,1.24 2.65,2.77v18.46c0,1.53 -1.18,2.77 -2.65,2.77h-80.69c-1.47,0 -2.65,-1.24 -2.65,-2.77v-18.46c0,-1.53 1.18,-2.77 2.65,-2.77z"
android:fillColor="#cc826b"/>
<path
android:pathData="m57.03,76h6v16h-6z"
android:fillColor="#ac573d"/>
<path
android:pathData="m81.03,76h6v16h-6z"
android:fillColor="#ac573d"/>
<path
android:pathData="m45.03,76h6v8h-6z"
android:fillColor="#ac573d"/>
<path
android:pathData="m69.03,76h6v8h-6z"
android:fillColor="#ac573d"/>
<path
android:pathData="m93.41,76h5.62v8h-5.62z"
android:fillColor="#ac573d"/>
<path
android:pathData="m33.03,76h6v16h-6z"
android:fillColor="#ac573d"/>
<path
android:pathData="m105.03,76h6v16h-6z"
android:fillColor="#ac573d"/>
</vector>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1776,5 +1776,6 @@ Alternatively, you can leave a note (with a photo)."</string>
<string name="lane_narrowing_traffic_calming_chicane">Chicane</string>
<string name="lane_narrowing_traffic_calming_choked_island">Curb extension + traffic island</string>
<string name="lane_narrowing_traffic_calming_none">No narrowed lane here</string>
<string name="quest_barrier_opening_width_gate">What is the width of the opening here?</string>

</resources>
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
}
dependencies {
val kotlinVersion = "2.0.0"
classpath("com.android.tools.build:gradle:8.4.1")
classpath("com.android.tools.build:gradle:8.5.0")
classpath(kotlin("gradle-plugin", version = kotlinVersion))
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
31 changes: 31 additions & 0 deletions res/graphics/quest/wheelchair_width.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading