Skip to content

Commit

Permalink
Added support for PTC
Browse files Browse the repository at this point in the history
Added support for rendering North American Positive Train Control in the
signal style.
  • Loading branch information
JonathanBittner authored and davide84 committed Oct 25, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent ffcbb4d commit f924af0
Showing 3 changed files with 17 additions and 6 deletions.
15 changes: 9 additions & 6 deletions signals.mml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions sql/functions.sql
Original file line number Diff line number Diff line change
@@ -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;
4 changes: 4 additions & 0 deletions train_protection.mss
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit f924af0

Please sign in to comment.