Browse Source

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

heritage
parent
commit
6648aac6b7
  1. 36
      car_maxspeed.json

36
car_maxspeed.json

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

Loading…
Cancel
Save