From 0e0e7b487a45e1730066bfa36b686a01a7e5354a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Apitzsch?= Date: Wed, 3 Apr 2024 12:15:37 +0200 Subject: [PATCH] Improve differentiation between different types of crossings --- assets/question_catalog/definition.json | 95 ++++++++++++++++++++++- lib/models/map_features/map_features.dart | 58 +++++++++----- 2 files changed, 130 insertions(+), 23 deletions(-) diff --git a/assets/question_catalog/definition.json b/assets/question_catalog/definition.json index 6a395d89..b76a54fe 100644 --- a/assets/question_catalog/definition.json +++ b/assets/question_catalog/definition.json @@ -2809,23 +2809,40 @@ "!parent": [ { "osm_tags": { - "highway": "footway", "footway": "crossing" } }, { "osm_tags": { - "highway": "cycleway", "cycleway": "crossing" } }, { "osm_tags": { - "highway": "path", "path": "crossing" } } ], + "parent": [ + { + "osm_tags": { + "highway": "footway", + "bicycle": ["designated", "dismount", "yes"] + } + }, + { + "osm_tags": { + "highway": "cycleway", + "foot": ["designated", "yes"] + } + }, + { + "osm_tags": { + "bicycle": ["designated", "dismount", "yes"], + "foot": ["designated", "yes"] + } + } + ], "osm_element": "Node" }, { @@ -2967,6 +2984,42 @@ ], "osm_element": "Node" }, + { + "osm_tags": { + "highway": "crossing", + "crossing": [false, "island", "traffic_signals"], + "crossing:markings": false, + "bicycle": [false, "no"] + }, + "!parent": [ + { + "osm_tags": { + "footway": "crossing" + } + }, + { + "osm_tags": { + "cycleway": "crossing" + } + }, + { + "osm_tags": { + "path": "crossing" + } + } + ], + "parent": [ + { + "osm_tags": { + "highway": "footway" + }, + "!osm_tags": { + "bicycle": ["yes", "dismount", "designated"] + } + } + ], + "osm_element": "Node" + }, { "osm_tags": { "highway": "path", @@ -3073,6 +3126,42 @@ ], "osm_element": "Node" }, + { + "osm_tags": { + "highway": "crossing", + "crossing": [false, "island", "traffic_signals"], + "crossing:markings": false, + "foot": [false, "no"] + }, + "!parent": [ + { + "osm_tags": { + "footway": "crossing" + } + }, + { + "osm_tags": { + "cycleway": "crossing" + } + }, + { + "osm_tags": { + "path": "crossing" + } + } + ], + "parent": [ + { + "osm_tags": { + "highway": "cycleway" + }, + "!osm_tags": { + "foot": ["yes", "designated"] + } + } + ], + "osm_element": "Node" + }, { "osm_tags": { "highway": "path", diff --git a/lib/models/map_features/map_features.dart b/lib/models/map_features/map_features.dart index dbf4bd32..ce60e348 100644 --- a/lib/models/map_features/map_features.dart +++ b/lib/models/map_features/map_features.dart @@ -640,6 +640,25 @@ final _globalDefinitions = [ ]), }), ]), + ElementCondition([ + TagsSubCondition({ + 'highway': StringValueMatcher('crossing'), + }), + ParentSubCondition([ + ElementCondition([ + TagsSubCondition({ + 'highway': StringValueMatcher('footway') + }), + NegatedSubCondition(TagsSubCondition({ + 'bicycle': MultiValueMatcher([ + StringValueMatcher('yes'), + StringValueMatcher('designated'), + ]), + })) + ]) + ]), + ElementTypeSubCondition([OSMElementType.node]) + ]) ], ), MapFeatureDefinition( @@ -667,38 +686,37 @@ final _globalDefinitions = [ }), ElementTypeSubCondition([OSMElementType.openWay]) ]), - ], - ), - MapFeatureDefinition( - label: (locale, _) => locale.mapFeatureCurb, - icon: TemakiIcons.kerbRaised, - conditions: const [ ElementCondition([ TagsSubCondition({ - 'barrier': StringValueMatcher('kerb'), + 'highway': StringValueMatcher('crossing'), }), + ParentSubCondition([ + ElementCondition([ + TagsSubCondition({ + 'highway': StringValueMatcher('cycleway') + }), + NegatedSubCondition(TagsSubCondition({ + 'foot': MultiValueMatcher([ + StringValueMatcher('yes'), + StringValueMatcher('designated'), + ]), + })) + ]) + ]), ElementTypeSubCondition([OSMElementType.node]) ]), ], ), MapFeatureDefinition( - label: (locale, _) => locale.mapFeaturePedestrianLights, - icon: TemakiIcons.trafficSignals, + label: (locale, _) => locale.mapFeatureCurb, + icon: TemakiIcons.kerbRaised, conditions: const [ ElementCondition([ TagsSubCondition({ - 'highway': StringValueMatcher('crossing'), - 'crossing': StringValueMatcher('traffic_signals'), - }), - ElementTypeSubCondition([OSMElementType.node, OSMElementType.openWay]) - ]), - ElementCondition([ - TagsSubCondition({ - 'highway': StringValueMatcher('crossing'), - 'crossing:signals': StringValueMatcher('yes'), + 'barrier': StringValueMatcher('kerb'), }), - ElementTypeSubCondition([OSMElementType.node, OSMElementType.openWay]) + ElementTypeSubCondition([OSMElementType.node]) ]), ], - ), + ) ];