From be1b027a1e65202becec43e7c7f626071a4aeb2f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= <skunk@xover.mud.at>
Date: Sat, 2 May 2020 22:46:21 +0200
Subject: [PATCH] Lanes: fix order of backward turn lanes

---
 lanes-sign.template |  2 +-
 lanes.json          | 26 +++++++++++++-------------
 lanes.template      |  2 +-
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/lanes-sign.template b/lanes-sign.template
index 311a035..d50086e 100644
--- a/lanes-sign.template
+++ b/lanes-sign.template
@@ -8,7 +8,7 @@
             "pattern0-path-color": "white",
             "pattern0-path-width": "0.3m",
             "pattern0-lineOffset": "{{ lanes_width / -2 + @ * 3 - 1.5 }}m",
-            "patternThrough": "{% if 'through' in lane_turn %}arrowHead{% endif %}",
+            "patternThrough": "{% if 'through' in lane_turn or 'none' in lane_turn or '' in lane_turn %}arrowHead{% endif %}",
             "patternThrough-repeat": "30m",
             "patternThrough-offset": "{{ lane_forward ? '17m' : '12m' }}",
             "patternThrough-polygon": "true",
diff --git a/lanes.json b/lanes.json
index 5440298..590f5c7 100644
--- a/lanes.json
+++ b/lanes.json
@@ -33,7 +33,7 @@
             "{% set forward_lanes = attribute(tags, 'lanes:forward')|default(oneway ? lanes : lanes // 2) %}",
             "{% set backward_lanes = attribute(tags, 'lanes:backward')|default(oneway ? 0 : lanes // 2) %}",
             "{% if attribute(tags, 'turn:lanes:backward') %}",
-            "  {% set turn_lanes_backward = attribute(tags, 'turn:lanes:backward')|split('|') %}",
+            "  {% set turn_lanes_backward = attribute(tags, 'turn:lanes:backward')|split('|')|reverse %}",
             "{% else %}",
             "  {% set turn_lanes_backward = ['through','through','through','through','through','through','through','through','through','through','through','through']|slice(0, backward_lanes) %}",
             "{% endif %}",
@@ -306,7 +306,7 @@
             "pattern0-path-color": "white",
             "pattern0-path-width": "0.3m",
             "pattern0-lineOffset": "{{ lanes_width / -2 + 1 * 3 - 1.5 }}m",
-            "patternThrough": "{% if 'through' in lane_turn %}arrowHead{% endif %}",
+            "patternThrough": "{% if 'through' in lane_turn or 'none' in lane_turn or '' in lane_turn %}arrowHead{% endif %}",
             "patternThrough-repeat": "30m",
             "patternThrough-offset": "{{ lane_forward ? '17m' : '12m' }}",
             "patternThrough-polygon": "true",
@@ -367,7 +367,7 @@
             "pattern0-path-color": "white",
             "pattern0-path-width": "0.3m",
             "pattern0-lineOffset": "{{ lanes_width / -2 + 2 * 3 - 1.5 }}m",
-            "patternThrough": "{% if 'through' in lane_turn %}arrowHead{% endif %}",
+            "patternThrough": "{% if 'through' in lane_turn or 'none' in lane_turn or '' in lane_turn %}arrowHead{% endif %}",
             "patternThrough-repeat": "30m",
             "patternThrough-offset": "{{ lane_forward ? '17m' : '12m' }}",
             "patternThrough-polygon": "true",
@@ -428,7 +428,7 @@
             "pattern0-path-color": "white",
             "pattern0-path-width": "0.3m",
             "pattern0-lineOffset": "{{ lanes_width / -2 + 3 * 3 - 1.5 }}m",
-            "patternThrough": "{% if 'through' in lane_turn %}arrowHead{% endif %}",
+            "patternThrough": "{% if 'through' in lane_turn or 'none' in lane_turn or '' in lane_turn %}arrowHead{% endif %}",
             "patternThrough-repeat": "30m",
             "patternThrough-offset": "{{ lane_forward ? '17m' : '12m' }}",
             "patternThrough-polygon": "true",
@@ -489,7 +489,7 @@
             "pattern0-path-color": "white",
             "pattern0-path-width": "0.3m",
             "pattern0-lineOffset": "{{ lanes_width / -2 + 4 * 3 - 1.5 }}m",
-            "patternThrough": "{% if 'through' in lane_turn %}arrowHead{% endif %}",
+            "patternThrough": "{% if 'through' in lane_turn or 'none' in lane_turn or '' in lane_turn %}arrowHead{% endif %}",
             "patternThrough-repeat": "30m",
             "patternThrough-offset": "{{ lane_forward ? '17m' : '12m' }}",
             "patternThrough-polygon": "true",
@@ -550,7 +550,7 @@
             "pattern0-path-color": "white",
             "pattern0-path-width": "0.3m",
             "pattern0-lineOffset": "{{ lanes_width / -2 + 5 * 3 - 1.5 }}m",
-            "patternThrough": "{% if 'through' in lane_turn %}arrowHead{% endif %}",
+            "patternThrough": "{% if 'through' in lane_turn or 'none' in lane_turn or '' in lane_turn %}arrowHead{% endif %}",
             "patternThrough-repeat": "30m",
             "patternThrough-offset": "{{ lane_forward ? '17m' : '12m' }}",
             "patternThrough-polygon": "true",
@@ -611,7 +611,7 @@
             "pattern0-path-color": "white",
             "pattern0-path-width": "0.3m",
             "pattern0-lineOffset": "{{ lanes_width / -2 + 6 * 3 - 1.5 }}m",
-            "patternThrough": "{% if 'through' in lane_turn %}arrowHead{% endif %}",
+            "patternThrough": "{% if 'through' in lane_turn or 'none' in lane_turn or '' in lane_turn %}arrowHead{% endif %}",
             "patternThrough-repeat": "30m",
             "patternThrough-offset": "{{ lane_forward ? '17m' : '12m' }}",
             "patternThrough-polygon": "true",
@@ -672,7 +672,7 @@
             "pattern0-path-color": "white",
             "pattern0-path-width": "0.3m",
             "pattern0-lineOffset": "{{ lanes_width / -2 + 7 * 3 - 1.5 }}m",
-            "patternThrough": "{% if 'through' in lane_turn %}arrowHead{% endif %}",
+            "patternThrough": "{% if 'through' in lane_turn or 'none' in lane_turn or '' in lane_turn %}arrowHead{% endif %}",
             "patternThrough-repeat": "30m",
             "patternThrough-offset": "{{ lane_forward ? '17m' : '12m' }}",
             "patternThrough-polygon": "true",
@@ -733,7 +733,7 @@
             "pattern0-path-color": "white",
             "pattern0-path-width": "0.3m",
             "pattern0-lineOffset": "{{ lanes_width / -2 + 8 * 3 - 1.5 }}m",
-            "patternThrough": "{% if 'through' in lane_turn %}arrowHead{% endif %}",
+            "patternThrough": "{% if 'through' in lane_turn or 'none' in lane_turn or '' in lane_turn %}arrowHead{% endif %}",
             "patternThrough-repeat": "30m",
             "patternThrough-offset": "{{ lane_forward ? '17m' : '12m' }}",
             "patternThrough-polygon": "true",
@@ -794,7 +794,7 @@
             "pattern0-path-color": "white",
             "pattern0-path-width": "0.3m",
             "pattern0-lineOffset": "{{ lanes_width / -2 + 9 * 3 - 1.5 }}m",
-            "patternThrough": "{% if 'through' in lane_turn %}arrowHead{% endif %}",
+            "patternThrough": "{% if 'through' in lane_turn or 'none' in lane_turn or '' in lane_turn %}arrowHead{% endif %}",
             "patternThrough-repeat": "30m",
             "patternThrough-offset": "{{ lane_forward ? '17m' : '12m' }}",
             "patternThrough-polygon": "true",
@@ -855,7 +855,7 @@
             "pattern0-path-color": "white",
             "pattern0-path-width": "0.3m",
             "pattern0-lineOffset": "{{ lanes_width / -2 + 10 * 3 - 1.5 }}m",
-            "patternThrough": "{% if 'through' in lane_turn %}arrowHead{% endif %}",
+            "patternThrough": "{% if 'through' in lane_turn or 'none' in lane_turn or '' in lane_turn %}arrowHead{% endif %}",
             "patternThrough-repeat": "30m",
             "patternThrough-offset": "{{ lane_forward ? '17m' : '12m' }}",
             "patternThrough-polygon": "true",
@@ -916,7 +916,7 @@
             "pattern0-path-color": "white",
             "pattern0-path-width": "0.3m",
             "pattern0-lineOffset": "{{ lanes_width / -2 + 11 * 3 - 1.5 }}m",
-            "patternThrough": "{% if 'through' in lane_turn %}arrowHead{% endif %}",
+            "patternThrough": "{% if 'through' in lane_turn or 'none' in lane_turn or '' in lane_turn %}arrowHead{% endif %}",
             "patternThrough-repeat": "30m",
             "patternThrough-offset": "{{ lane_forward ? '17m' : '12m' }}",
             "patternThrough-polygon": "true",
@@ -977,7 +977,7 @@
             "pattern0-path-color": "white",
             "pattern0-path-width": "0.3m",
             "pattern0-lineOffset": "{{ lanes_width / -2 + 12 * 3 - 1.5 }}m",
-            "patternThrough": "{% if 'through' in lane_turn %}arrowHead{% endif %}",
+            "patternThrough": "{% if 'through' in lane_turn or 'none' in lane_turn or '' in lane_turn %}arrowHead{% endif %}",
             "patternThrough-repeat": "30m",
             "patternThrough-offset": "{{ lane_forward ? '17m' : '12m' }}",
             "patternThrough-polygon": "true",
diff --git a/lanes.template b/lanes.template
index 9d20b13..8d4c198 100644
--- a/lanes.template
+++ b/lanes.template
@@ -33,7 +33,7 @@
             "{% set forward_lanes = attribute(tags, 'lanes:forward')|default(oneway ? lanes : lanes // 2) %}",
             "{% set backward_lanes = attribute(tags, 'lanes:backward')|default(oneway ? 0 : lanes // 2) %}",
             "{% if attribute(tags, 'turn:lanes:backward') %}",
-            "  {% set turn_lanes_backward = attribute(tags, 'turn:lanes:backward')|split('|') %}",
+            "  {% set turn_lanes_backward = attribute(tags, 'turn:lanes:backward')|split('|')|reverse %}",
             "{% else %}",
             "  {% set turn_lanes_backward = ['through','through','through','through','through','through','through','through','through','through','through','through']|slice(0, backward_lanes) %}",
             "{% endif %}",