From d2262dac7c689b81d7cdafd977be52540e84d763 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Thu, 13 May 2021 22:09:28 +0200 Subject: [PATCH] cycle_infrastructure: cycleway:left, cycleway:right --- cycle_infrastructure.json | 99 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 97 insertions(+), 2 deletions(-) diff --git a/cycle_infrastructure.json b/cycle_infrastructure.json index 36a80582..d12d4d98 100644 --- a/cycle_infrastructure.json +++ b/cycle_infrastructure.json @@ -29,7 +29,44 @@ " {% if c in ['opposite_track'] %}{% set backward = 'cycleway' %}{% endif %}", " {% if c == 'track' %}{% set c = 'cycleway' %}{% endif %}", " {% if const[c] %}{% if oneway in ['yes', '1', '-1'] %}{% set forward = c %}{% else %}{% set forward = c %}{% set backward = c %}{% endif %}{% endif %}", - "{% endfor %}" + "{% endfor %}", + "", + "{% set left = false %}{% set right = false %}", + "{% set left_direction = 'forward' %}{% set right_direction = 'forward' %}", + "{% if attribute(tags, 'cycleway:left') %}", + " {% set left = attribute(tags, 'cycleway:left') %}", + " {% if left in ['opposite_lane'] %}", + " {% set left = 'lane' %}{% set left_direction = 'backward' %}", + " {% elseif left in ['opposite_track'] %}", + " {% set left = 'cycleway' %}{% set left_direction = 'backward' %}", + " {% elseif left in ['track'] %}", + " {% set left = 'cycleway' %}", + " {% elseif left in ['no'] %}", + " {% set left = 'shared_lane' %}", + " {% endif %}", + " {% if attribute(tags, 'cycleway:left:oneway') == 'no' %}", + " {% set left_direction = 'both' %}", + " {% elseif attribute(tags, 'cycleway:left:oneway') == '-1' %}", + " {% set left_direction = 'backward' %}", + " {% endif %}", + "{% endif %}", + "{% if attribute(tags, 'cycleway:right') %}", + " {% set right = attribute(tags, 'cycleway:right') %}", + " {% if right in ['opposite_lane'] %}", + " {% set right = 'lane' %}{% set right_direction = 'backward' %}", + " {% elseif right in ['opposite_track'] %}", + " {% set right = 'cycleway' %}{% set right_direction = 'backward' %}", + " {% elseif right in ['track'] %}", + " {% set right = 'cycleway' %}", + " {% elseif right in ['no'] %}", + " {% set right = 'shared_lane' %}", + " {% endif %}", + " {% if attribute(tags, 'cycleway:right:oneway') == 'no' %}", + " {% set right_direction = 'both' %}", + " {% elseif attribute(tags, 'cycleway:right:oneway') == '-1' %}", + " {% set right_direction = 'backward' %}", + " {% endif %}", + "{% endif %}" ], "body": [ "{{ keyTrans('highway') }}: {{ tagTrans('highway', tags.highway) }}
", @@ -38,7 +75,14 @@ ], "markerSymbol": null, "listMarkerSymbol": "line", - "styles": "{% if forward and backward and forward == backward %}default{% else %}{% if forward %},forward{% endif %}{% if backward %},backward{% endif %}{% endif %}", + "styles": [ + "{% if left or right %}", + " {% if left and left_direction == 'both' %},left_both{% elseif left %},left{% endif %}", + " {% if right and right_direction == 'both' %},right_both{% elseif right %},right{% endif %}", + "{% else %}", + " {% if forward and backward and forward == backward %}default{% else %}{% if forward %},forward{% endif %}{% if backward %},backward{% endif %}{% endif %}", + "{% endif %}" + ], "style": { "color": "{{ const[forward].color }}", "fill": "{% if tags.area == 'yes' %}true{% else %}false{% endif %}", @@ -89,6 +133,57 @@ "pattern2-lineOffset": "0", "pattern2-path-lineCap": "butt", "pattern2-path-fillOpacity": "1" + }, + "style:left_both": { + "width": "{{ const[left].width }}", + "color": "{{ const[left].color }}", + "offset": "{{ -1 - const[left].width / 2 }}" + }, + "style:left": { + "width": "0", + "fill": "false", + "pattern": "arrowHead", + "pattern-offset": "{{ left_direction == 'forward' ? 8 : 10 }}", + "pattern-repeat": "60", + "pattern-polygon": "true", + "pattern-pixelSize": "9", + "pattern-angleCorrection": "{{ left_direction == 'forward' ? 0 : 180 }}", + "pattern-path-width": "0", + "pattern-path-color": "{{ const[left].color }}", + "pattern-path-fillOpacity": "1", + "pattern-lineOffset": "{{ -1 - const[left].width / 2 }}", + "pattern2": "dash", + "pattern2-offset": "{{ left_direction == 'forward' ? 50 : 25 }}", + "pattern2-repeat": "60", + "pattern2-pixelSize": "22", + "pattern2-path-width": "{{ const[left].width }}", + "pattern2-path-color": "{{ const[left].color }}", + "pattern2-lineOffset": "{{ -1 - const[left].width / 2 }}", + "pattern2-path-lineCap": "butt", + "pattern2-path-fillOpacity": "1" + }, + "style:right": { + "width": "0", + "fill": "false", + "pattern": "arrowHead", + "pattern-offset": "{{ right_direction == 'forward' ? 8 : 10 }}", + "pattern-repeat": "60", + "pattern-polygon": "true", + "pattern-pixelSize": "9", + "pattern-angleCorrection": "{{ right_direction == 'forward' ? 0 : 180 }}", + "pattern-path-width": "0", + "pattern-path-color": "{{ const[right].color }}", + "pattern-path-fillOpacity": "1", + "pattern-lineOffset": "{{ 1 + const[right].width / 2 }}", + "pattern2": "dash", + "pattern2-offset": "{{ right_direction == 'forward' ? 50 : 25 }}", + "pattern2-repeat": "60", + "pattern2-pixelSize": "22", + "pattern2-path-width": "{{ const[right].width }}", + "pattern2-path-color": "{{ const[right].color }}", + "pattern2-lineOffset": "{{ 1 + const[right].width / 2 }}", + "pattern2-path-lineCap": "butt", + "pattern2-path-fillOpacity": "1" } }, "info": [