From 858fa233c088d3c4f794bdd6bc05b98f3e5665ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Sat, 13 Jul 2024 08:09:53 +0200 Subject: [PATCH] cycleway_width: configure values via const, map info --- cycleway_width.yaml | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/cycleway_width.yaml b/cycleway_width.yaml index 1283330..b2107ba 100644 --- a/cycleway_width.yaml +++ b/cycleway_width.yaml @@ -12,10 +12,11 @@ feature: {% set width = (width|slice(0, -1)) * 0.3048 %} {% endif %} - {% set optWidth = tags.oneway in ['yes', 1, -1] ? 3 : 5 %} + {% set minWidth = tags.oneway in ['yes', 1, -1] ? const.minWidthOneway : const.minWidthBoth %} + {% set optWidth = tags.oneway in ['yes', 1, -1] ? const.optWidthOneway : const.optWidthBoth %} {% if width %} - {{ colorInterpolate(['#ff0000', '#7f7f7ff'], width / optWidth) }} + {{ colorInterpolate(const.colorScheme, (width - minWidth) / (optWidth - minWidth)) }} {% else %}black {% endif %} markerSymbol: false @@ -40,3 +41,32 @@ feature: {{ attribute(tags, 'cycleway:width') }}m {% endif %} +info: | + + + + + + + {% for v in range(0, 1, 0.25) %} + + + + + + {% endfor %} +
Symbol{{ keyTrans('oneway') }}={{ tagTrans('oneway', 'yes') }}{{ keyTrans('oneway') }}={{ tagTrans('oneway', 'no') }}
+ {{ markerLine({ width: 4, color: colorInterpolate(const.colorScheme, v) }) }} + + {% if v == 0 %}<={% elseif v == 1 %}>={% endif %} + {{ (const.minWidthOneway + (v * (const.optWidthOneway - const.minWidthOneway)))|number_format(2) }}m + + {% if v == 0 %}<={% elseif v == 1 %}>={% endif %} + {{ (const.minWidthBoth + (v * (const.optWidthBoth - const.minWidthBoth)))|number_format(2) }}m +
+const: + minWidthBoth: 1.5 + optWidthBoth: 5 + minWidthOneway: 0.75 + optWidthOneway: 3 + colorScheme: ['#ff0000', '#7f7fff', '#0000ff']