From cea94ff1790a2bf016309d0955baf86ff63a34df Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= <skunk@xover.mud.at>
Date: Tue, 2 Jul 2019 21:22:36 +0200
Subject: [PATCH] cycle_directions: new attempt with patterns

---
 cycle_directions-pattern.json | 78 +++++++++++++++++++++++++++++++++++
 1 file changed, 78 insertions(+)
 create mode 100644 cycle_directions-pattern.json

diff --git a/cycle_directions-pattern.json b/cycle_directions-pattern.json
new file mode 100644
index 0000000..d2da7b4
--- /dev/null
+++ b/cycle_directions-pattern.json
@@ -0,0 +1,78 @@
+{
+    "type": "overpass",
+    "name": {
+        "de": "Radwegrichtungen (patterns)",
+        "en": "Cycleway Directions (patterns)"
+    },
+    "query": {
+        "14": [
+            "(",
+            "way[highway=cycleway];",
+            "way[cycleway];",
+            "way[\"cycleway:left\"];",
+            "way[\"cycleway:right\"];",
+            "way[highway][oneway];",
+            ")"
+        ]
+    },
+    "feature": {
+        "pre": [
+            "{% set oneway = 0 %}",
+            "{% if tags.oneway in [ 'yes', '1' ] %}{% set oneway = 1 %}",
+            "{% elseif tags.oneway in [ '-1' ] %}{% set oneway = -1 %}",
+            "{% endif %}",
+            "",
+            "{% set driving_side = 'right' %}"
+        ],
+        "markerSymbol": null,
+        "listMarkerSymbol": "line",
+        "styles": "{% if oneway != 0 %}default,{% endif %}left,right",
+        "style": {
+            "width": "0",
+            "pattern": "arrowHead",
+            "pattern-offset": "14",
+            "pattern-repeat": "25",
+            "pattern-polygon": "true",
+            "pattern-pixelSize": "{% if tags.highway == 'cycleway' %}5{% else %}7{% endif %}",
+            "pattern-path-color": "{% if tags.highway == 'cycleway' %}#007f00{% else %}#000000{% endif %}",
+            "pattern-path-fillOpacity": "1",
+            "pattern-angleCorrection": "{% if oneway == -1 %}180{% else %}0{% endif %}"
+        },
+        "style:highlight": null,
+        "style:left": {
+            "width": "0",
+            "pattern": "{% if tags.cycleway in [ 'opposite', 'opposite_lane', 'opposite_track' ] %}arrowHead{% endif %}",
+            "pattern-offset": "0",
+            "pattern-repeat": "25",
+            "pattern-polygon": "true",
+            "pattern-pixelSize": "5",
+            "pattern-path-color": [
+                "{% if tags.oneway in [ 'yes', '1' ] and tags.cycleway in [ 'opposite_lane', 'opposite' ] %}",
+                "#00ff00",
+                "{% elseif tags.oneway in [ 'yes', '1' ] and tags.cycleway in [ 'opposite_track' ] %}",
+                "#00af00",
+                "{% endif %}"
+            ],
+            "pattern-path-fillOpacity": "1",
+            "pattern-angleCorrection": [
+                "{% if oneway == -1 %}0{% else %}180{% endif %}"
+            ]
+        }
+    },
+    "info": [
+        "<table>",
+        "  <tr>",
+        "    <td>{{ markerLine(evaluate({ \"highway\": \"cycleway\" }))|raw }}</td>",
+        "    <td>{{ tagTrans('highway', 'cycleway') }}</td>",
+        "  </tr>",
+        "  <tr>",
+        "    <td>{{ markerLine(evaluate({ \"cycleway\": \"track\" }))|raw }}</td>",
+        "    <td>{{ tagTrans('cycleway', 'track') }}</td>",
+        "  </tr>",
+        "  <tr>",
+        "    <td>{{ markerLine(evaluate({ \"cycleway\": \"lane\" }))|raw }}</td>",
+        "    <td>{{ tagTrans('cycleway', 'lane') }}</td>",
+        "  </tr>",
+        "</table>"
+    ]
+}