From f924af0edabcf2ceb245b1e8c6905869ab28e4d4 Mon Sep 17 00:00:00 2001 From: Jonathan Bittner Date: Fri, 1 Apr 2022 18:51:44 +0200 Subject: [PATCH] Added support for PTC Added support for rendering North American Positive Train Control in the signal style. --- signals.mml | 15 +++++++++------ sql/functions.sql | 4 ++++ train_protection.mss | 4 ++++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/signals.mml b/signals.mml index 726d417f..4fd2ead3 100644 --- a/signals.mml +++ b/signals.mml @@ -98,8 +98,8 @@ Layer: NULL AS construction_usage, NULL AS construction_service, NULL AS preserved_railway, NULL AS preserved_service, NULL AS preserved_usage, - pzb, lzb, atb, atb_eg, atb_ng, atb_vv, kvb, tvm, scmt, etcs, construction_etcs, - railway_train_protection_rank(pzb, lzb, atb, atb_eg, atb_ng, atb_vv, kvb, tvm, scmt, etcs, construction_etcs) AS rank + pzb, lzb, atb, atb_eg, atb_ng, atb_vv, kvb, tvm, scmt, ptc, etcs, construction_etcs, + railway_train_protection_rank(pzb, lzb, atb, atb_eg, atb_ng, atb_vv, kvb, tvm, scmt, ptc, etcs, construction_etcs) AS rank FROM (SELECT way, railway, usage, @@ -112,6 +112,7 @@ Layer: tags->'railway:kvb' AS kvb, tags->'railway:tvm' AS tvm, tags->'railway:scmt' AS scmt, + railway_etcs_null_no(tags->'railway:ptc') AS ptc, railway_etcs_null_no(tags->'railway:etcs') AS etcs, railway_etcs_null_no(tags->'construction:railway:etcs') AS construction_etcs FROM openrailwaymap_osm_line @@ -138,8 +139,8 @@ Layer: NULL AS construction_usage, NULL AS construction_service, NULL AS preserved_railway, NULL AS preserved_service, NULL AS preserved_usage, - pzb, lzb, atb, atb_eg, atb_ng, atb_vv, kvb, tvm, scmt, etcs, construction_etcs, - railway_train_protection_rank(pzb, lzb, atb, atb_eg, atb_ng, atb_vv, kvb, tvm, scmt, etcs, construction_etcs) AS rank + pzb, lzb, atb, atb_eg, atb_ng, atb_vv, kvb, tvm, scmt, ptc, etcs, construction_etcs, + railway_train_protection_rank(pzb, lzb, atb, atb_eg, atb_ng, atb_vv, kvb, tvm, scmt, ptc, etcs, construction_etcs) AS rank FROM (SELECT way, railway, usage, @@ -152,6 +153,7 @@ Layer: tags->'railway:kvb' AS kvb, tags->'railway:tvm' AS tvm, tags->'railway:scmt' AS scmt, + railway_etcs_null_no(tags->'railway:ptc') AS ptc, railway_etcs_null_no(tags->'railway:etcs') AS etcs, railway_etcs_null_no(tags->'construction:railway:etcs') AS construction_etcs FROM openrailwaymap_osm_line @@ -178,8 +180,8 @@ Layer: construction_usage, construction_service, preserved_railway, preserved_service, preserved_usage, - pzb, lzb, atb, atb_eg, atb_ng, atb_vv, kvb, tvm, scmt, etcs, construction_etcs, - railway_train_protection_rank(pzb, lzb, atb, atb_eg, atb_ng, atb_vv, kvb, tvm, scmt, etcs, construction_etcs) AS rank + pzb, lzb, atb, atb_eg, atb_ng, atb_vv, kvb, tvm, scmt, ptc, etcs, construction_etcs, + railway_train_protection_rank(pzb, lzb, atb, atb_eg, atb_ng, atb_vv, kvb, tvm, scmt, ptc, etcs, construction_etcs) AS rank FROM (SELECT way, railway, usage, service, @@ -199,6 +201,7 @@ Layer: tags->'railway:kvb' AS kvb, tags->'railway:tvm' AS tvm, tags->'railway:scmt' AS scmt, + railway_etcs_null_no(tags->'railway:ptc') AS ptc, railway_etcs_null_no(tags->'railway:etcs') AS etcs, railway_etcs_null_no(tags->'construction:railway:etcs') AS construction_etcs, layer diff --git a/sql/functions.sql b/sql/functions.sql index c3f9c0d3..ac37311d 100644 --- a/sql/functions.sql +++ b/sql/functions.sql @@ -317,12 +317,16 @@ CREATE OR REPLACE FUNCTION railway_train_protection_rank( kvb TEXT, tvm TEXT, scmt TEXT, + ptc TEXT, etcs TEXT, construction_etcs TEXT) RETURNS INTEGER AS $$ BEGIN IF etcs <> 'no' THEN RETURN 10; END IF; + IF ptc <> 'no' THEN + RETURN 10; + END IF; IF construction_etcs <> 'no' THEN RETURN 9; END IF; diff --git a/train_protection.mss b/train_protection.mss index c4dc47c0..9cac1247 100644 --- a/train_protection.mss +++ b/train_protection.mss @@ -10,6 +10,7 @@ @scmt_color: #dd11ff; @kvb_color: #66cc33; @tvm_color: #009966; +@ptc_color: #d877b8; @etcs_color: blue; @etcs_construction_color: #87CEFA; @@ -91,6 +92,9 @@ ["construction_etcs"!="no"] { line-color: @etcs_construction_color; } + ["ptc"!="no"] { + line-color: @ptc_color; + } ["railway"="construction"] { line-dasharray: @construction_dashes;