Browse Source

railway-electrification: improve colors; set preferences via const

pedestrian
parent
commit
628bd5afba
  1. 45
      railway-electrification.json

45
railway-electrification.json

@ -16,18 +16,18 @@
"pre": [ "pre": [
"{% if tags.electrified and tags.electrified != 'no' %}", "{% if tags.electrified and tags.electrified != 'no' %}",
" {% if not tags.voltage is defined %}", " {% if not tags.voltage is defined %}",
" {% set color = '#7f7f7f' %}",
" {% set color = const.colorUnknown %}",
" {% elseif not tags.voltage|matches('^[0-9]+$') %}", " {% elseif not tags.voltage|matches('^[0-9]+$') %}",
" {% set color = '#ff0000' %}",
" {% elseif tags.voltage < 1000 %}",
" {% set color = colorInterpolate([ '#00ff00', 'blue' ], tags.voltage / 1000) %}",
" {% set color = const.colorIllegal %}",
" {% elseif tags.voltage < const.range[1] %}",
" {% set color = colorInterpolate(const.scheme|slice(0, 2), tags.voltage / const.range[1]) %}",
" {% else %}", " {% else %}",
" {% set color = colorInterpolate([ 'blue', '#af0000' ], (tags.voltage - 1000) / 24000) %}",
" {% set color = colorInterpolate(const.scheme|slice(1, 2), (tags.voltage - const.range[1]) / (const.range[2] - const.range[1])) %}",
" {% endif %}", " {% endif %}",
"{% elseif tags.electrified and tags.electrified == 'no' %}", "{% elseif tags.electrified and tags.electrified == 'no' %}",
" {% set color = '#000000' %}",
" {% set color = const.colorNone %}",
"{% else %}", "{% else %}",
" {% set color = '#7f7f7f' %}",
" {% set color = const.colorUnknown %}",
"{% endif %}", "{% endif %}",
"", "",
"{% if tags.service == 'yard' or tags.service == 'siding' or tags.service == 'spur' or tags.service == 'crossover' %}", "{% if tags.service == 'yard' or tags.service == 'siding' or tags.service == 'spur' or tags.service == 'crossover' %}",
@ -35,9 +35,9 @@
" {% else %}", " {% else %}",
" {% if tags.railway == 'rail' %}", " {% if tags.railway == 'rail' %}",
" {% if tags.usage == 'main' or tags.usage == 'branch' %}", " {% if tags.usage == 'main' or tags.usage == 'branch' %}",
" {% set width=3 %}",
" {% set width=4 %}",
" {% else %}", " {% else %}",
" {% set width=2.5 %}",
" {% set width=3 %}",
" {% endif %}", " {% endif %}",
" {% else %}", " {% else %}",
" {% set width=2 %}", " {% set width=2 %}",
@ -84,32 +84,33 @@
"width": "{{ width }}", "width": "{{ width }}",
"color": "white", "color": "white",
"opacity": "1", "opacity": "1",
"lineCap": "butt",
"fill": null "fill": null
} }
}, },
"info": [ "info": [
"<table>", "<table>",
" {% set color = '#000000' %}",
" <tr>", " <tr>",
" <td>{{ markerLine({ 'width': 3, 'color': color })|raw }}</td>",
" <td>{{ markerLine({ 'width': 3, 'color': const.colorNone })|raw }}</td>",
" <td>{{ trans('not electrified') }}</td>", " <td>{{ trans('not electrified') }}</td>",
" </tr>", " </tr>",
"{% for i in range(0, 1000, 200) %}",
" {% set color = colorInterpolate([ '#00ff00', 'blue' ], i / 1000) %}",
"{% for i in range(0, const.range[1], const.infoSteps[0]) %}",
" {% set color = colorInterpolate(const.scheme|slice(0, 2), i / const.range[1]) %}",
" <tr>", " <tr>",
" <td>{{ markerLine({ 'width': 3, 'color': color })|raw }}</td>", " <td>{{ markerLine({ 'width': 3, 'color': color })|raw }}</td>",
" <td>{{ i }}V</td>", " <td>{{ i }}V</td>",
" </tr>", " </tr>",
"{% endfor %}", "{% endfor %}",
"", "",
"{% for i in range(3000, 25000, 2000) %}",
" {% set color = colorInterpolate([ 'blue', '#af0000' ], (i - 1000) / 24000) %}",
"{% for i in range(const.range[1] + const.infoSteps[1], const.range[2], const.infoSteps[1]) %}",
" {% set color = colorInterpolate(const.scheme|slice(1, 2), (i - const.range[1]) / (const.range[2] - const.range[1])) %}",
" <tr>", " <tr>",
" <td>{{ markerLine({ 'width': 3, 'color': color })|raw }}</td>", " <td>{{ markerLine({ 'width': 3, 'color': color })|raw }}</td>",
" <td>{{ i }}V</td>", " <td>{{ i }}V</td>",
" </tr>", " </tr>",
"{% endfor %}", "{% endfor %}",
"", "",
"{% set color = const.scheme[1] %}",
" <tr>", " <tr>",
" <td>{{ markerLine({ 'width': 3, 'color': color })|raw }}</td>", " <td>{{ markerLine({ 'width': 3, 'color': color })|raw }}</td>",
" <td>{{ trans('tag:frequency=0') }}</td>", " <td>{{ trans('tag:frequency=0') }}</td>",
@ -121,14 +122,22 @@
" </tr>", " </tr>",
"", "",
" <tr>", " <tr>",
" <td>{{ markerLine({ 'width': 3, 'color': '#7f7f7f' })|raw }}</td>",
" <td>{{ markerLine({ 'width': 3, 'color': const.colorUnknown })|raw }}</td>",
" <td>{{ trans('unknown') }}</td>", " <td>{{ trans('unknown') }}</td>",
" </tr>", " </tr>",
"", "",
" <tr>", " <tr>",
" <td>{{ markerLine({ 'width': 3, 'color': '#ff0000' })|raw }}</td>",
" <td>{{ markerLine({ 'width': 3, 'color': const.colorIllegal })|raw }}</td>",
" <td>{{ trans('illegal value') }}</td>", " <td>{{ trans('illegal value') }}</td>",
" </tr>", " </tr>",
"</table>" "</table>"
]
],
"const": {
"range": [ 0, 1000, 25000 ],
"infoSteps": [ 200, 2000 ],
"scheme": [ "#00ff00", "#003fff", "#af0000" ],
"colorNone": "orange",
"colorUnknown": "#404040",
"colorIllegal": "#ff0000"
}
} }
Loading…
Cancel
Save