Skip to content

Commit

Permalink
Merge pull request #115 from davide84/master
Browse files Browse the repository at this point in the history
Rendering of Chinese CTCS signalling
  • Loading branch information
Nakaner authored Feb 24, 2024
2 parents 2639d75 + c0cc032 commit c19a215
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
15 changes: 9 additions & 6 deletions signals.mml
Original file line number Diff line number Diff line change
Expand Up @@ -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, zsi127, atb, atb_eg, atb_ng, atb_vv, atc, kvb, tvm, scmt, asfa, ptc, etcs, construction_etcs,
railway_train_protection_rank(pzb, lzb, atb, atb_eg, atb_ng, atb_vv, atc, kvb, tvm, scmt, asfa, ptc, zsi127, etcs, construction_etcs) AS rank
pzb, lzb, zsi127, atb, atb_eg, atb_ng, atb_vv, atc, kvb, tvm, scmt, asfa, ptc, ctcs, etcs, construction_etcs,
railway_train_protection_rank(pzb, lzb, atb, atb_eg, atb_ng, atb_vv, atc, kvb, tvm, scmt, asfa, ptc, zsi127, ctcs, etcs, construction_etcs) AS rank
FROM
(SELECT
way, railway, usage,
Expand All @@ -115,6 +115,7 @@ Layer:
tags->'railway:tvm' AS tvm,
tags->'railway:scmt' AS scmt,
tags->'railway:asfa' AS asfa,
railway_null_or_zero_to_no(tags->'railway:ctcs') AS ctcs,
railway_null_or_zero_to_no(tags->'railway:ptc') AS ptc,
railway_null_or_zero_to_no(tags->'railway:etcs') AS etcs,
railway_null_or_zero_to_no(tags->'construction:railway:etcs') AS construction_etcs
Expand Down Expand Up @@ -142,8 +143,8 @@ Layer:
NULL AS construction_usage, NULL AS construction_service,
NULL AS preserved_railway, NULL AS preserved_service,
NULL AS preserved_usage,
pzb, lzb, zsi127, atb, atb_eg, atb_ng, atb_vv, atc, kvb, tvm, scmt, asfa, ptc, etcs, construction_etcs,
railway_train_protection_rank(pzb, lzb, atb, atb_eg, atb_ng, atb_vv, atc, kvb, tvm, scmt, asfa, ptc, zsi127, etcs, construction_etcs) AS rank
pzb, lzb, zsi127, atb, atb_eg, atb_ng, atb_vv, atc, kvb, tvm, scmt, asfa, ptc, ctcs, etcs, construction_etcs,
railway_train_protection_rank(pzb, lzb, atb, atb_eg, atb_ng, atb_vv, atc, kvb, tvm, scmt, asfa, ptc, zsi127, ctcs, etcs, construction_etcs) AS rank
FROM
(SELECT
way, railway, usage,
Expand All @@ -159,6 +160,7 @@ Layer:
tags->'railway:tvm' AS tvm,
tags->'railway:scmt' AS scmt,
tags->'railway:asfa' AS asfa,
railway_null_or_zero_to_no(tags->'railway:ctcs') AS ctcs,
railway_null_or_zero_to_no(tags->'railway:ptc') AS ptc,
railway_null_or_zero_to_no(tags->'railway:etcs') AS etcs,
railway_null_or_zero_to_no(tags->'construction:railway:etcs') AS construction_etcs
Expand Down Expand Up @@ -186,8 +188,8 @@ Layer:
construction_usage, construction_service,
preserved_railway, preserved_service,
preserved_usage,
pzb, lzb, zsi127, atb, atb_eg, atb_ng, atb_vv, atc, kvb, tvm, scmt, asfa, ptc, etcs, construction_etcs,
railway_train_protection_rank(pzb, lzb, atb, atb_eg, atb_ng, atb_vv, atc, kvb, tvm, scmt, asfa, ptc, zsi127, etcs, construction_etcs) AS rank
pzb, lzb, zsi127, atb, atb_eg, atb_ng, atb_vv, atc, kvb, tvm, scmt, asfa, ptc, ctcs, etcs, construction_etcs,
railway_train_protection_rank(pzb, lzb, atb, atb_eg, atb_ng, atb_vv, atc, kvb, tvm, scmt, asfa, ptc, zsi127, ctcs, etcs, construction_etcs) AS rank
FROM
(SELECT
way, railway, usage, service,
Expand All @@ -210,6 +212,7 @@ Layer:
tags->'railway:tvm' AS tvm,
tags->'railway:scmt' AS scmt,
tags->'railway:asfa' AS asfa,
railway_null_or_zero_to_no(tags->'railway:ctcs') AS ctcs,
railway_null_or_zero_to_no(tags->'railway:ptc') AS ptc,
railway_null_or_zero_to_no(tags->'railway:etcs') AS etcs,
railway_null_or_zero_to_no(tags->'construction:railway:etcs') AS construction_etcs,
Expand Down
6 changes: 5 additions & 1 deletion sql/functions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ CREATE OR REPLACE FUNCTION railway_train_protection_rank(
asfa TEXT,
ptc TEXT,
zsi127 TEXT,
ctcs TEXT,
etcs TEXT,
construction_etcs TEXT) RETURNS INTEGER AS $$
BEGIN
Expand All @@ -330,6 +331,9 @@ BEGIN
END IF;
IF ptc <> 'no' THEN
RETURN 10;
END IF;
IF ctcs <> 'no' THEN
RETURN 10;
END IF;
IF construction_etcs <> 'no' THEN
RETURN 9;
Expand Down Expand Up @@ -361,7 +365,7 @@ BEGIN
IF pzb = 'yes' THEN
RETURN 2;
END IF;
IF (pzb = 'no' AND lzb = 'no' AND etcs = 'no') OR (atb = 'no' AND etcs = 'no') OR (atc = 'no' AND etcs = 'no') OR (scmt = 'no' AND etcs = 'no') OR (asfa = 'no' AND etcs = 'no') OR (kvb = 'no' AND tvm = 'no' AND etcs = 'no') OR (zsi127 = 'no') THEN
IF (pzb = 'no' AND lzb = 'no' AND etcs = 'no') OR (atb = 'no' AND etcs = 'no') OR (atc = 'no' AND etcs = 'no') OR (scmt = 'no' AND etcs = 'no') OR (asfa = 'no' AND etcs = 'no') OR (kvb = 'no' AND tvm = 'no' AND etcs = 'no') OR (zsi127 = 'no') OR (ctcs = 'no') THEN
RETURN 1;
END IF;
RETURN 0;
Expand Down
4 changes: 4 additions & 0 deletions train_protection.mss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
@kvb_color: #66cc33;
@tvm_color: #009966;
@ptc_color: #cc0033;
@ctcs_color: orange;
@etcs_color: blue;
@etcs_construction_color: #87CEFA;

Expand Down Expand Up @@ -101,6 +102,9 @@
["ptc"!="no"] {
line-color: @ptc_color;
}
["ctcs"!="no"] {
line-color: @ctcs_color;
}
["zsi127"="yes"] {
line-color: @zsi127_color;
}
Expand Down

0 comments on commit c19a215

Please sign in to comment.