Browse Source

car_maxspeed: support maxspeed=none (also forward and backward)

pedestrian
parent
commit
fead6969d4
  1. 36
      car_maxspeed.json

36
car_maxspeed.json

@ -21,7 +21,9 @@
"{% set unit = null %}", "{% set unit = null %}",
"", "",
"{% if tags.maxspeed is defined %}", "{% if tags.maxspeed is defined %}",
" {% if tags.maxspeed|matches(\"^[0-9]+$\") %}",
" {% if tags.maxspeed == 'none' %}",
" {% set maxspeed = 'none' %}",
" {% elseif tags.maxspeed|matches(\"^[0-9]+$\") %}",
" {% set maxspeedKmh = tags.maxspeed %}", " {% set maxspeedKmh = tags.maxspeed %}",
" {% set maxspeed = tags.maxspeed %}", " {% set maxspeed = tags.maxspeed %}",
" {% set unit = \"km/h\" %}", " {% set unit = \"km/h\" %}",
@ -34,7 +36,9 @@
"{% endif %}", "{% endif %}",
"", "",
"{% if attribute(tags, 'maxspeed:forward') is defined %}", "{% if attribute(tags, 'maxspeed:forward') is defined %}",
" {% if attribute(tags, 'maxspeed:forward')|matches(\"^[0-9]+$\") %}",
" {% if attribute(tags, 'maxspeed:forward') == 'none' %}",
" {% set maxspeedF = 'none' %}",
" {% elseif attribute(tags, 'maxspeed:forward')|matches(\"^[0-9]+$\") %}",
" {% set maxspeedFKmh = attribute(tags, 'maxspeed:forward') %}", " {% set maxspeedFKmh = attribute(tags, 'maxspeed:forward') %}",
" {% set maxspeedF = attribute(tags, 'maxspeed:forward') %}", " {% set maxspeedF = attribute(tags, 'maxspeed:forward') %}",
" {% set unit = \"km/h\" %}", " {% set unit = \"km/h\" %}",
@ -47,7 +51,9 @@
"{% endif %}", "{% endif %}",
"", "",
"{% if attribute(tags, 'maxspeed:backward') is defined %}", "{% if attribute(tags, 'maxspeed:backward') is defined %}",
" {% if attribute(tags, 'maxspeed:backward')|matches(\"^[0-9]+$\") %}",
" {% if attribute(tags, 'maxspeed:backward') == 'none' %}",
" {% set maxspeedB = 'none' %}",
" {% elseif attribute(tags, 'maxspeed:backward')|matches(\"^[0-9]+$\") %}",
" {% set maxspeedBKmh = attribute(tags, 'maxspeed:backward') %}", " {% set maxspeedBKmh = attribute(tags, 'maxspeed:backward') %}",
" {% set maxspeedB = attribute(tags, 'maxspeed:backward') %}", " {% set maxspeedB = attribute(tags, 'maxspeed:backward') %}",
" {% set unit = \"km/h\" %}", " {% set unit = \"km/h\" %}",
@ -59,25 +65,31 @@
" {% endif %}", " {% endif %}",
"{% endif %}", "{% endif %}",
"", "",
"{% if not maxspeedKmh %}",
"{% if maxspeed == 'none' %}",
"{% set color = \"#0000ff\" %}",
"{% elseif not maxspeedKmh %}",
"{% set color = \"#404040\" %}", "{% set color = \"#404040\" %}",
"{% else %}", "{% else %}",
"{% set color = colorInterpolate(const.colorMap, (maxspeedKmh - const.offsetColorSpeed) / const.highestColorSpeed) %}", "{% set color = colorInterpolate(const.colorMap, (maxspeedKmh - const.offsetColorSpeed) / const.highestColorSpeed) %}",
"{% endif %}", "{% endif %}",
"", "",
"{% if maxspeedFKmh %}",
"{% if maxspeedF == 'none' %}",
"{% set colorF = \"#0000ff\" %}",
"{% elseif maxspeedFKmh %}",
"{% set colorF = colorInterpolate(const.colorMap, (maxspeedFKmh - const.offsetColorSpeed) / const.highestColorSpeed) %}", "{% set colorF = colorInterpolate(const.colorMap, (maxspeedFKmh - const.offsetColorSpeed) / const.highestColorSpeed) %}",
"{% endif %}", "{% endif %}",
"", "",
"{% if maxspeedBKmh %}",
"{% if maxspeedB == 'none' %}",
"{% set colorB = \"#0000ff\" %}",
"{% elseif maxspeedBKmh %}",
"{% set colorB = colorInterpolate(const.colorMap, (maxspeedBKmh - const.offsetColorSpeed) / const.highestColorSpeed) %}", "{% set colorB = colorInterpolate(const.colorMap, (maxspeedBKmh - const.offsetColorSpeed) / const.highestColorSpeed) %}",
"{% endif %}" "{% endif %}"
], ],
"description": [ "description": [
"{% if maxspeedF or maxspeedB %}", "{% if maxspeedF or maxspeedB %}",
"<span style='color: {{ colorB }}'>{{ maxspeedB|default(trans('unknown')) }}</span> / <span style='color: {{ colorF }}'>{{ maxspeedF|default(trans('unknown')) }}</span> {{ unit }}",
"<span style='color: {{ colorB }}'>{{ maxspeedB == 'none' ? tagTrans('maxspeed', 'none') : maxspeedB|default(trans('unknown')) }}</span> / <span style='color: {{ colorF }}'>{{ maxspeedF == 'none' ? tagTrans('maxspeed', 'none') : maxspeedF|default(trans('unknown')) }}</span> {{ unit }}",
"{% elseif maxspeed %}", "{% elseif maxspeed %}",
"<span style='color: {{ color }}'>{{ maxspeed }} {{ unit }}</span>",
"<span style='color: {{ color }}'>{{ maxspeed == 'none' ? tagTrans('maxspeed', 'none') : maxspeed }} {{ unit }}</span>",
"{% elseif tags.maxspeed %}", "{% elseif tags.maxspeed %}",
"{{ tags.maxspeed }}", "{{ tags.maxspeed }}",
"{% else %}", "{% else %}",
@ -139,6 +151,10 @@
" <td>{{ markerLine(evaluate({ \"maxspeed\": 150 }))|raw }}</td>", " <td>{{ markerLine(evaluate({ \"maxspeed\": 150 }))|raw }}</td>",
" <td>≥150km/h</td>", " <td>≥150km/h</td>",
" </tr>", " </tr>",
" <tr>",
" <td>{{ markerLine(evaluate({ \"maxspeed\": \"none\" }))|raw }}</td>",
" <td>{{ tagTrans('maxspeed', 'none') }}</td>",
" </tr>",
"</table>", "</table>",
"</div>", "</div>",
"", "",
@ -162,6 +178,10 @@
" <td>{{ markerLine(evaluate({ \"maxspeed\": (95 * 1.60934)|round }))|raw }}</td>", " <td>{{ markerLine(evaluate({ \"maxspeed\": (95 * 1.60934)|round }))|raw }}</td>",
" <td>≥95mph</td>", " <td>≥95mph</td>",
" </tr>", " </tr>",
" <tr>",
" <td>{{ markerLine(evaluate({ \"maxspeed\": \"none\" }))|raw }}</td>",
" <td>{{ tagTrans('maxspeed', 'none') }}</td>",
" </tr>",
"</table>", "</table>",
"</div>" "</div>"
] ]

Loading…
Cancel
Save