From 204b431df0902069db9537c2a6a6c2f3fa6ec224 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Wed, 22 Sep 2021 20:12:53 +0200 Subject: [PATCH] Add more types to the charging stations theme, better merge if translations already exist --- InitUiElements.ts | 2 +- Models/Constants.ts | 2 +- .../charging_station/charging_station.json | 750 +++++++++++++++++- .../charging_station.protojson | 28 +- assets/layers/charging_station/csvToJson.ts | 83 +- assets/layers/charging_station/types.csv | 24 +- 6 files changed, 851 insertions(+), 38 deletions(-) diff --git a/InitUiElements.ts b/InitUiElements.ts index f6a6ce803..1835c4e07 100644 --- a/InitUiElements.ts +++ b/InitUiElements.ts @@ -258,7 +258,7 @@ export class InitUiElements { new Combine([ "Error: could not parse the custom layout:", - e, + new FixedUiElement(""+e).SetClass("alert"), new SubtleButton("./assets/svg/mapcomplete_logo.svg", "Go back to the theme overview", {url: window.location.protocol+"//"+ window.location.hostname+"/index.html", newTab: false}) diff --git a/Models/Constants.ts b/Models/Constants.ts index 539ab8c6f..ec3fd96e6 100644 --- a/Models/Constants.ts +++ b/Models/Constants.ts @@ -2,7 +2,7 @@ import {Utils} from "../Utils"; export default class Constants { - public static vNumber = "0.9.12"; + public static vNumber = "0.9.13"; // The user journey states thresholds when a new feature gets unlocked public static userJourney = { diff --git a/assets/layers/charging_station/charging_station.json b/assets/layers/charging_station/charging_station.json index 4446049ab..c726b52dd 100644 --- a/assets/layers/charging_station/charging_station.json +++ b/assets/layers/charging_station/charging_station.json @@ -93,8 +93,13 @@ ] }, { - "question": "Who is allowed to use this charging station?", - "render": "Access is {access}", + "#": "access", + "question": { + "en": "Who is allowed to use this charging station?" + }, + "render": { + "en": "Access is {access}" + }, "freeform": { "key": "access", "addExtraTags": [ @@ -142,6 +147,7 @@ } }, { + "#": "Available_charging_stations (generated)", "question": { "en": "Which charging stations are available here?" }, @@ -153,6 +159,18 @@ "then": { "en": " Schuko wall plug without ground pin (CEE7/4 type F)", "nl": " Schuko stekker zonder aardingspin (CEE7/4 type F)" + }, + "hideInAnswer": { + "or": [ + "_country!=be", + "_country!=fr", + "_country!=ma", + "_country!=tn", + "_country!=pl", + "_country!=cs", + "_country!=sk", + "_country!=mo" + ] } }, { @@ -335,10 +353,105 @@ "nl": " " }, "hideInAnswer": true + }, + { + "if": "socket:type2_cable=1", + "ifnot": "socket:type2_cable=", + "then": { + "en": " Type 2 with cable (mennekes)", + "nl": " Type 2 met kabel (J1772)" + } + }, + { + "if": { + "and": [ + "socket:type2_cable~*", + "socket:type2_cable!=1" + ] + }, + "then": { + "en": " Type 2 with cable (mennekes)", + "nl": " Type 2 met kabel (J1772)" + }, + "hideInAnswer": true + }, + { + "if": "socket:tesla_supercharger_ccs=1", + "ifnot": "socket:tesla_supercharger_ccs=", + "then": { + "en": " Tesla Supercharger CCS (a branded type2_css)", + "nl": " " + } + }, + { + "if": { + "and": [ + "socket:tesla_supercharger_ccs~*", + "socket:tesla_supercharger_ccs!=1" + ] + }, + "then": { + "en": " Tesla Supercharger CCS (a branded type2_css)", + "nl": " " + }, + "hideInAnswer": true + }, + { + "if": "socket:tesla_destination=1", + "ifnot": "socket:tesla_destination=", + "then": { + "en": " Tesla Supercharger (destination)", + "nl": " " + }, + "hideInAnswer": { + "or": [ + "_country!=us" + ] + } + }, + { + "if": { + "and": [ + "socket:tesla_destination~*", + "socket:tesla_destination!=1" + ] + }, + "then": { + "en": " Tesla Supercharger (destination)", + "nl": " " + }, + "hideInAnswer": true + }, + { + "if": "socket:tesla_destination=1", + "ifnot": "socket:tesla_destination=", + "then": { + "en": " Tesla supercharger (destination (A Type 2 with cable branded as tesla)", + "nl": " " + }, + "hideInAnswer": { + "or": [ + "_country=us" + ] + } + }, + { + "if": { + "and": [ + "socket:tesla_destination~*", + "socket:tesla_destination!=1" + ] + }, + "then": { + "en": " Tesla supercharger (destination (A Type 2 with cable branded as tesla)", + "nl": " " + }, + "hideInAnswer": true } ] }, { + "#": "plugs-0", "question": { "en": "How much plugs of type Schuko wall plug without ground pin (CEE7/4 type F) are available here?", "nl": "Hoeveel stekkers van type Schuko stekker zonder aardingspin (CEE7/4 type F) heeft dit oplaadpunt?" @@ -359,6 +472,7 @@ } }, { + "#": "voltage-0", "question": { "en": "What voltage do the plugs with Schuko wall plug without ground pin (CEE7/4 type F) offer?", "nl": "Welke spanning levert de stekker van type Schuko stekker zonder aardingspin (CEE7/4 type F) " @@ -388,6 +502,7 @@ } }, { + "#": "current-0", "question": { "en": "What current do the plugs with Schuko wall plug without ground pin (CEE7/4 type F) offer?", "nl": "Welke stroom levert de stekker van type Schuko stekker zonder aardingspin (CEE7/4 type F) ?" @@ -417,6 +532,7 @@ } }, { + "#": "power-output-0", "question": { "en": "What power output does a single plug of type Schuko wall plug without ground pin (CEE7/4 type F) offer?", "nl": "Welk vermogen levert een enkele stekker van type Schuko stekker zonder aardingspin (CEE7/4 type F) ?" @@ -446,6 +562,7 @@ } }, { + "#": "plugs-1", "question": { "en": "How much plugs of type European wall plug with ground pin (CEE7/4 type E) are available here?", "nl": "Hoeveel stekkers van type Europese stekker met aardingspin (CEE7/4 type E) heeft dit oplaadpunt?" @@ -466,6 +583,7 @@ } }, { + "#": "voltage-1", "question": { "en": "What voltage do the plugs with European wall plug with ground pin (CEE7/4 type E) offer?", "nl": "Welke spanning levert de stekker van type Europese stekker met aardingspin (CEE7/4 type E) " @@ -495,6 +613,7 @@ } }, { + "#": "current-1", "question": { "en": "What current do the plugs with European wall plug with ground pin (CEE7/4 type E) offer?", "nl": "Welke stroom levert de stekker van type Europese stekker met aardingspin (CEE7/4 type E) ?" @@ -524,6 +643,7 @@ } }, { + "#": "power-output-1", "question": { "en": "What power output does a single plug of type European wall plug with ground pin (CEE7/4 type E) offer?", "nl": "Welk vermogen levert een enkele stekker van type Europese stekker met aardingspin (CEE7/4 type E) ?" @@ -560,6 +680,7 @@ } }, { + "#": "plugs-2", "question": { "en": "How much plugs of type Chademo are available here?", "nl": "Hoeveel stekkers van type heeft dit oplaadpunt?" @@ -580,6 +701,7 @@ } }, { + "#": "voltage-2", "question": { "en": "What voltage do the plugs with Chademo offer?", "nl": "Welke spanning levert de stekker van type " @@ -609,6 +731,7 @@ } }, { + "#": "current-2", "question": { "en": "What current do the plugs with Chademo offer?", "nl": "Welke stroom levert de stekker van type ?" @@ -638,6 +761,7 @@ } }, { + "#": "power-output-2", "question": { "en": "What power output does a single plug of type Chademo offer?", "nl": "Welk vermogen levert een enkele stekker van type ?" @@ -667,6 +791,7 @@ } }, { + "#": "plugs-3", "question": { "en": "How much plugs of type Type 1 with cable (J1772) are available here?", "nl": "Hoeveel stekkers van type Type 1 met kabel (J1772) heeft dit oplaadpunt?" @@ -687,6 +812,7 @@ } }, { + "#": "voltage-3", "question": { "en": "What voltage do the plugs with Type 1 with cable (J1772) offer?", "nl": "Welke spanning levert de stekker van type Type 1 met kabel (J1772) " @@ -723,6 +849,7 @@ } }, { + "#": "current-3", "question": { "en": "What current do the plugs with Type 1 with cable (J1772) offer?", "nl": "Welke stroom levert de stekker van type Type 1 met kabel (J1772) ?" @@ -752,6 +879,7 @@ } }, { + "#": "power-output-3", "question": { "en": "What power output does a single plug of type Type 1 with cable (J1772) offer?", "nl": "Welk vermogen levert een enkele stekker van type Type 1 met kabel (J1772) ?" @@ -788,6 +916,7 @@ } }, { + "#": "plugs-4", "question": { "en": "How much plugs of type Type 1 without cable (J1772) are available here?", "nl": "Hoeveel stekkers van type Type 1 zonder kabel (J1772) heeft dit oplaadpunt?" @@ -808,6 +937,7 @@ } }, { + "#": "voltage-4", "question": { "en": "What voltage do the plugs with Type 1 without cable (J1772) offer?", "nl": "Welke spanning levert de stekker van type Type 1 zonder kabel (J1772) " @@ -844,6 +974,7 @@ } }, { + "#": "current-4", "question": { "en": "What current do the plugs with Type 1 without cable (J1772) offer?", "nl": "Welke stroom levert de stekker van type Type 1 zonder kabel (J1772) ?" @@ -873,6 +1004,7 @@ } }, { + "#": "power-output-4", "question": { "en": "What power output does a single plug of type Type 1 without cable (J1772) offer?", "nl": "Welk vermogen levert een enkele stekker van type Type 1 zonder kabel (J1772) ?" @@ -923,6 +1055,7 @@ } }, { + "#": "plugs-5", "question": { "en": "How much plugs of type Type 1 CCS (aka Type 1 Combo) are available here?", "nl": "Hoeveel stekkers van type heeft dit oplaadpunt?" @@ -943,6 +1076,7 @@ } }, { + "#": "voltage-5", "question": { "en": "What voltage do the plugs with Type 1 CCS (aka Type 1 Combo) offer?", "nl": "Welke spanning levert de stekker van type " @@ -979,6 +1113,7 @@ } }, { + "#": "current-5", "question": { "en": "What current do the plugs with Type 1 CCS (aka Type 1 Combo) offer?", "nl": "Welke stroom levert de stekker van type ?" @@ -1015,6 +1150,7 @@ } }, { + "#": "power-output-5", "question": { "en": "What power output does a single plug of type Type 1 CCS (aka Type 1 Combo) offer?", "nl": "Welk vermogen levert een enkele stekker van type ?" @@ -1065,6 +1201,7 @@ } }, { + "#": "plugs-6", "question": { "en": "How much plugs of type Tesla Supercharger are available here?", "nl": "Hoeveel stekkers van type heeft dit oplaadpunt?" @@ -1085,6 +1222,7 @@ } }, { + "#": "voltage-6", "question": { "en": "What voltage do the plugs with Tesla Supercharger offer?", "nl": "Welke spanning levert de stekker van type " @@ -1114,6 +1252,7 @@ } }, { + "#": "current-6", "question": { "en": "What current do the plugs with Tesla Supercharger offer?", "nl": "Welke stroom levert de stekker van type ?" @@ -1150,6 +1289,7 @@ } }, { + "#": "power-output-6", "question": { "en": "What power output does a single plug of type Tesla Supercharger offer?", "nl": "Welk vermogen levert een enkele stekker van type ?" @@ -1193,6 +1333,7 @@ } }, { + "#": "plugs-7", "question": { "en": "How much plugs of type Type 2 (mennekes) are available here?", "nl": "Hoeveel stekkers van type heeft dit oplaadpunt?" @@ -1213,6 +1354,7 @@ } }, { + "#": "voltage-7", "question": { "en": "What voltage do the plugs with Type 2 (mennekes) offer?", "nl": "Welke spanning levert de stekker van type " @@ -1249,6 +1391,7 @@ } }, { + "#": "current-7", "question": { "en": "What current do the plugs with Type 2 (mennekes) offer?", "nl": "Welke stroom levert de stekker van type ?" @@ -1285,6 +1428,7 @@ } }, { + "#": "power-output-7", "question": { "en": "What power output does a single plug of type Type 2 (mennekes) offer?", "nl": "Welk vermogen levert een enkele stekker van type ?" @@ -1321,6 +1465,7 @@ } }, { + "#": "plugs-8", "question": { "en": "How much plugs of type Type 2 CCS (mennekes) are available here?", "nl": "Hoeveel stekkers van type heeft dit oplaadpunt?" @@ -1341,6 +1486,7 @@ } }, { + "#": "voltage-8", "question": { "en": "What voltage do the plugs with Type 2 CCS (mennekes) offer?", "nl": "Welke spanning levert de stekker van type " @@ -1377,6 +1523,7 @@ } }, { + "#": "current-8", "question": { "en": "What current do the plugs with Type 2 CCS (mennekes) offer?", "nl": "Welke stroom levert de stekker van type ?" @@ -1413,6 +1560,7 @@ } }, { + "#": "power-output-8", "question": { "en": "What power output does a single plug of type Type 2 CCS (mennekes) offer?", "nl": "Welk vermogen levert een enkele stekker van type ?" @@ -1441,6 +1589,527 @@ ] } }, + { + "#": "plugs-9", + "question": { + "en": "How much plugs of type Type 2 with cable (mennekes) are available here?", + "nl": "Hoeveel stekkers van type Type 2 met kabel (J1772) heeft dit oplaadpunt?" + }, + "render": { + "en": "There are Type 2 with cable (mennekes) plugs of type Type 2 with cable (mennekes) available here", + "nl": "Hier zijn Type 2 met kabel (J1772) stekkers van het type Type 2 met kabel (J1772)" + }, + "freeform": { + "key": "socket:type2_cable", + "type": "pnat" + }, + "condition": { + "and": [ + "socket:type2_cable~*", + "socket:type2_cable!=0" + ] + } + }, + { + "#": "voltage-9", + "question": { + "en": "What voltage do the plugs with Type 2 with cable (mennekes) offer?", + "nl": "Welke spanning levert de stekker van type Type 2 met kabel (J1772) " + }, + "render": { + "en": "Type 2 with cable (mennekes) outputs {socket:type2_cable:voltage} volt", + "nl": "Type 2 met kabel (J1772) heeft een spanning van {socket:type2_cable:voltage} volt" + }, + "freeform": { + "key": "socket:type2_cable:voltage", + "type": "pfloat" + }, + "mappings": [ + { + "if": "socket:socket:type2_cable:voltage=230 V", + "then": { + "en": "Type 2 with cable (mennekes) outputs 230 volt", + "nl": "Type 2 met kabel (J1772) heeft een spanning van 230 volt" + } + }, + { + "if": "socket:socket:type2_cable:voltage=400 V", + "then": { + "en": "Type 2 with cable (mennekes) outputs 400 volt", + "nl": "Type 2 met kabel (J1772) heeft een spanning van 400 volt" + } + } + ], + "condition": { + "and": [ + "socket:type2_cable~*", + "socket:type2_cable!=0" + ] + } + }, + { + "#": "current-9", + "question": { + "en": "What current do the plugs with Type 2 with cable (mennekes) offer?", + "nl": "Welke stroom levert de stekker van type Type 2 met kabel (J1772) ?" + }, + "render": { + "en": "Type 2 with cable (mennekes) outputs at most {socket:type2_cable:current}A", + "nl": "Type 2 met kabel (J1772) levert een stroom van maximaal {socket:type2_cable:current}A" + }, + "freeform": { + "key": "socket:type2_cable:current", + "type": "pfloat" + }, + "mappings": [ + { + "if": "socket:socket:type2_cable:current=16 A", + "then": { + "en": "Type 2 with cable (mennekes) outputs at most 16 A", + "nl": "Type 2 met kabel (J1772) levert een stroom van maximaal 16 A" + } + }, + { + "if": "socket:socket:type2_cable:current=32 A", + "then": { + "en": "Type 2 with cable (mennekes) outputs at most 32 A", + "nl": "Type 2 met kabel (J1772) levert een stroom van maximaal 32 A" + } + } + ], + "condition": { + "and": [ + "socket:type2_cable~*", + "socket:type2_cable!=0" + ] + } + }, + { + "#": "power-output-9", + "question": { + "en": "What power output does a single plug of type Type 2 with cable (mennekes) offer?", + "nl": "Welk vermogen levert een enkele stekker van type Type 2 met kabel (J1772) ?" + }, + "render": { + "en": "Type 2 with cable (mennekes) outputs at most {socket:type2_cable:output}", + "nl": "Type 2 met kabel (J1772) levert een vermogen van maximaal {socket:type2_cable:output}" + }, + "freeform": { + "key": "socket:type2_cable:output", + "type": "pfloat" + }, + "mappings": [ + { + "if": "socket:socket:type2_cable:output=11 kw", + "then": { + "en": "Type 2 with cable (mennekes) outputs at most 11 kw", + "nl": "Type 2 met kabel (J1772) levert een vermogen van maximaal 11 kw" + } + }, + { + "if": "socket:socket:type2_cable:output=22 kw", + "then": { + "en": "Type 2 with cable (mennekes) outputs at most 22 kw", + "nl": "Type 2 met kabel (J1772) levert een vermogen van maximaal 22 kw" + } + } + ], + "condition": { + "and": [ + "socket:type2_cable~*", + "socket:type2_cable!=0" + ] + } + }, + { + "#": "plugs-10", + "question": { + "en": "How much plugs of type Tesla Supercharger CCS (a branded type2_css) are available here?", + "nl": "Hoeveel stekkers van type heeft dit oplaadpunt?" + }, + "render": { + "en": "There are Tesla Supercharger CCS (a branded type2_css) plugs of type Tesla Supercharger CCS (a branded type2_css) available here", + "nl": "Hier zijn stekkers van het type " + }, + "freeform": { + "key": "socket:tesla_supercharger_ccs", + "type": "pnat" + }, + "condition": { + "and": [ + "socket:tesla_supercharger_ccs~*", + "socket:tesla_supercharger_ccs!=0" + ] + } + }, + { + "#": "voltage-10", + "question": { + "en": "What voltage do the plugs with Tesla Supercharger CCS (a branded type2_css) offer?", + "nl": "Welke spanning levert de stekker van type " + }, + "render": { + "en": "Tesla Supercharger CCS (a branded type2_css) outputs {socket:tesla_supercharger_ccs:voltage} volt", + "nl": " heeft een spanning van {socket:tesla_supercharger_ccs:voltage} volt" + }, + "freeform": { + "key": "socket:tesla_supercharger_ccs:voltage", + "type": "pfloat" + }, + "mappings": [ + { + "if": "socket:socket:tesla_supercharger_ccs:voltage=500 V", + "then": { + "en": "Tesla Supercharger CCS (a branded type2_css) outputs 500 volt", + "nl": " heeft een spanning van 500 volt" + } + }, + { + "if": "socket:socket:tesla_supercharger_ccs:voltage=920 V", + "then": { + "en": "Tesla Supercharger CCS (a branded type2_css) outputs 920 volt", + "nl": " heeft een spanning van 920 volt" + } + } + ], + "condition": { + "and": [ + "socket:tesla_supercharger_ccs~*", + "socket:tesla_supercharger_ccs!=0" + ] + } + }, + { + "#": "current-10", + "question": { + "en": "What current do the plugs with Tesla Supercharger CCS (a branded type2_css) offer?", + "nl": "Welke stroom levert de stekker van type ?" + }, + "render": { + "en": "Tesla Supercharger CCS (a branded type2_css) outputs at most {socket:tesla_supercharger_ccs:current}A", + "nl": " levert een stroom van maximaal {socket:tesla_supercharger_ccs:current}A" + }, + "freeform": { + "key": "socket:tesla_supercharger_ccs:current", + "type": "pfloat" + }, + "mappings": [ + { + "if": "socket:socket:tesla_supercharger_ccs:current=125 A", + "then": { + "en": "Tesla Supercharger CCS (a branded type2_css) outputs at most 125 A", + "nl": " levert een stroom van maximaal 125 A" + } + }, + { + "if": "socket:socket:tesla_supercharger_ccs:current=350 A", + "then": { + "en": "Tesla Supercharger CCS (a branded type2_css) outputs at most 350 A", + "nl": " levert een stroom van maximaal 350 A" + } + } + ], + "condition": { + "and": [ + "socket:tesla_supercharger_ccs~*", + "socket:tesla_supercharger_ccs!=0" + ] + } + }, + { + "#": "power-output-10", + "question": { + "en": "What power output does a single plug of type Tesla Supercharger CCS (a branded type2_css) offer?", + "nl": "Welk vermogen levert een enkele stekker van type ?" + }, + "render": { + "en": "Tesla Supercharger CCS (a branded type2_css) outputs at most {socket:tesla_supercharger_ccs:output}", + "nl": " levert een vermogen van maximaal {socket:tesla_supercharger_ccs:output}" + }, + "freeform": { + "key": "socket:tesla_supercharger_ccs:output", + "type": "pfloat" + }, + "mappings": [ + { + "if": "socket:socket:tesla_supercharger_ccs:output=50 kw", + "then": { + "en": "Tesla Supercharger CCS (a branded type2_css) outputs at most 50 kw", + "nl": " levert een vermogen van maximaal 50 kw" + } + } + ], + "condition": { + "and": [ + "socket:tesla_supercharger_ccs~*", + "socket:tesla_supercharger_ccs!=0" + ] + } + }, + { + "#": "plugs-11", + "question": { + "en": "How much plugs of type Tesla Supercharger (destination) are available here?", + "nl": "Hoeveel stekkers van type heeft dit oplaadpunt?" + }, + "render": { + "en": "There are Tesla Supercharger (destination) plugs of type Tesla Supercharger (destination) available here", + "nl": "Hier zijn stekkers van het type " + }, + "freeform": { + "key": "socket:tesla_destination", + "type": "pnat" + }, + "condition": { + "and": [ + "socket:tesla_destination~*", + "socket:tesla_destination!=0" + ] + } + }, + { + "#": "voltage-11", + "question": { + "en": "What voltage do the plugs with Tesla Supercharger (destination) offer?", + "nl": "Welke spanning levert de stekker van type " + }, + "render": { + "en": "Tesla Supercharger (destination) outputs {socket:tesla_destination:voltage} volt", + "nl": " heeft een spanning van {socket:tesla_destination:voltage} volt" + }, + "freeform": { + "key": "socket:tesla_destination:voltage", + "type": "pfloat" + }, + "mappings": [ + { + "if": "socket:socket:tesla_destination:voltage=480 V", + "then": { + "en": "Tesla Supercharger (destination) outputs 480 volt", + "nl": " heeft een spanning van 480 volt" + } + } + ], + "condition": { + "and": [ + "socket:tesla_destination~*", + "socket:tesla_destination!=0" + ] + } + }, + { + "#": "current-11", + "question": { + "en": "What current do the plugs with Tesla Supercharger (destination) offer?", + "nl": "Welke stroom levert de stekker van type ?" + }, + "render": { + "en": "Tesla Supercharger (destination) outputs at most {socket:tesla_destination:current}A", + "nl": " levert een stroom van maximaal {socket:tesla_destination:current}A" + }, + "freeform": { + "key": "socket:tesla_destination:current", + "type": "pfloat" + }, + "mappings": [ + { + "if": "socket:socket:tesla_destination:current=125 A", + "then": { + "en": "Tesla Supercharger (destination) outputs at most 125 A", + "nl": " levert een stroom van maximaal 125 A" + } + }, + { + "if": "socket:socket:tesla_destination:current=350 A", + "then": { + "en": "Tesla Supercharger (destination) outputs at most 350 A", + "nl": " levert een stroom van maximaal 350 A" + } + } + ], + "condition": { + "and": [ + "socket:tesla_destination~*", + "socket:tesla_destination!=0" + ] + } + }, + { + "#": "power-output-11", + "question": { + "en": "What power output does a single plug of type Tesla Supercharger (destination) offer?", + "nl": "Welk vermogen levert een enkele stekker van type ?" + }, + "render": { + "en": "Tesla Supercharger (destination) outputs at most {socket:tesla_destination:output}", + "nl": " levert een vermogen van maximaal {socket:tesla_destination:output}" + }, + "freeform": { + "key": "socket:tesla_destination:output", + "type": "pfloat" + }, + "mappings": [ + { + "if": "socket:socket:tesla_destination:output=120 kw", + "then": { + "en": "Tesla Supercharger (destination) outputs at most 120 kw", + "nl": " levert een vermogen van maximaal 120 kw" + } + }, + { + "if": "socket:socket:tesla_destination:output=150 kw", + "then": { + "en": "Tesla Supercharger (destination) outputs at most 150 kw", + "nl": " levert een vermogen van maximaal 150 kw" + } + }, + { + "if": "socket:socket:tesla_destination:output=250 kw", + "then": { + "en": "Tesla Supercharger (destination) outputs at most 250 kw", + "nl": " levert een vermogen van maximaal 250 kw" + } + } + ], + "condition": { + "and": [ + "socket:tesla_destination~*", + "socket:tesla_destination!=0" + ] + } + }, + { + "#": "plugs-12", + "question": { + "en": "How much plugs of type Tesla supercharger (destination (A Type 2 with cable branded as tesla) are available here?", + "nl": "Hoeveel stekkers van type heeft dit oplaadpunt?" + }, + "render": { + "en": "There are Tesla supercharger (destination (A Type 2 with cable branded as tesla) plugs of type Tesla supercharger (destination (A Type 2 with cable branded as tesla) available here", + "nl": "Hier zijn stekkers van het type " + }, + "freeform": { + "key": "socket:tesla_destination", + "type": "pnat" + }, + "condition": { + "and": [ + "socket:tesla_destination~*", + "socket:tesla_destination!=0" + ] + } + }, + { + "#": "voltage-12", + "question": { + "en": "What voltage do the plugs with Tesla supercharger (destination (A Type 2 with cable branded as tesla) offer?", + "nl": "Welke spanning levert de stekker van type " + }, + "render": { + "en": "Tesla supercharger (destination (A Type 2 with cable branded as tesla) outputs {socket:tesla_destination:voltage} volt", + "nl": " heeft een spanning van {socket:tesla_destination:voltage} volt" + }, + "freeform": { + "key": "socket:tesla_destination:voltage", + "type": "pfloat" + }, + "mappings": [ + { + "if": "socket:socket:tesla_destination:voltage=230 V", + "then": { + "en": "Tesla supercharger (destination (A Type 2 with cable branded as tesla) outputs 230 volt", + "nl": " heeft een spanning van 230 volt" + } + }, + { + "if": "socket:socket:tesla_destination:voltage=400 V", + "then": { + "en": "Tesla supercharger (destination (A Type 2 with cable branded as tesla) outputs 400 volt", + "nl": " heeft een spanning van 400 volt" + } + } + ], + "condition": { + "and": [ + "socket:tesla_destination~*", + "socket:tesla_destination!=0" + ] + } + }, + { + "#": "current-12", + "question": { + "en": "What current do the plugs with Tesla supercharger (destination (A Type 2 with cable branded as tesla) offer?", + "nl": "Welke stroom levert de stekker van type ?" + }, + "render": { + "en": "Tesla supercharger (destination (A Type 2 with cable branded as tesla) outputs at most {socket:tesla_destination:current}A", + "nl": " levert een stroom van maximaal {socket:tesla_destination:current}A" + }, + "freeform": { + "key": "socket:tesla_destination:current", + "type": "pfloat" + }, + "mappings": [ + { + "if": "socket:socket:tesla_destination:current=16 A", + "then": { + "en": "Tesla supercharger (destination (A Type 2 with cable branded as tesla) outputs at most 16 A", + "nl": " levert een stroom van maximaal 16 A" + } + }, + { + "if": "socket:socket:tesla_destination:current=32 A", + "then": { + "en": "Tesla supercharger (destination (A Type 2 with cable branded as tesla) outputs at most 32 A", + "nl": " levert een stroom van maximaal 32 A" + } + } + ], + "condition": { + "and": [ + "socket:tesla_destination~*", + "socket:tesla_destination!=0" + ] + } + }, + { + "#": "power-output-12", + "question": { + "en": "What power output does a single plug of type Tesla supercharger (destination (A Type 2 with cable branded as tesla) offer?", + "nl": "Welk vermogen levert een enkele stekker van type ?" + }, + "render": { + "en": "Tesla supercharger (destination (A Type 2 with cable branded as tesla) outputs at most {socket:tesla_destination:output}", + "nl": " levert een vermogen van maximaal {socket:tesla_destination:output}" + }, + "freeform": { + "key": "socket:tesla_destination:output", + "type": "pfloat" + }, + "mappings": [ + { + "if": "socket:socket:tesla_destination:output=11 kw", + "then": { + "en": "Tesla supercharger (destination (A Type 2 with cable branded as tesla) outputs at most 11 kw", + "nl": " levert een vermogen van maximaal 11 kw" + } + }, + { + "if": "socket:socket:tesla_destination:output=22 kw", + "then": { + "en": "Tesla supercharger (destination (A Type 2 with cable branded as tesla) outputs at most 22 kw", + "nl": " levert een vermogen van maximaal 22 kw" + } + } + ], + "condition": { + "and": [ + "socket:tesla_destination~*", + "socket:tesla_destination!=0" + ] + } + }, { "#": "Authentication", "question": { @@ -1610,6 +2279,7 @@ ] }, { + "#": "payment-options", "builtin": "payment-options", "override": { "condition": { @@ -1627,6 +2297,16 @@ "nl": "Betalen via een app van het netwerk" } } + ], + "mappings": [ + { + "if": "payment:app=yes", + "ifnot": "payment:app=no", + "then": { + "en": "Payment is done using a dedicated app", + "nl": "Betalen via een app van het netwerk" + } + } ] } }, @@ -1822,6 +2502,26 @@ } } ] + }, + { + "#": "Parking:fee", + "question": { + "en": "Does one have to pay a parking fee while charging?" + }, + "mappings": [ + { + "if": "parking:fee=no", + "then": { + "en": "No additional parking cost while charging" + } + }, + { + "if": "parking:fee=yes", + "then": { + "en": "An additional parking fee should be paid while charging" + } + } + ] } ], "icon": { @@ -2016,6 +2716,34 @@ "nl": "Heeft een " }, "osmTags": "socket:type2_combo~*" + }, + { + "question": { + "en": "Has a Type 2 with cable (mennekes) connector", + "nl": "Heeft een Type 2 met kabel (J1772) " + }, + "osmTags": "socket:type2_cable~*" + }, + { + "question": { + "en": "Has a Tesla Supercharger CCS (a branded type2_css) connector", + "nl": "Heeft een " + }, + "osmTags": "socket:tesla_supercharger_ccs~*" + }, + { + "question": { + "en": "Has a Tesla Supercharger (destination) connector", + "nl": "Heeft een " + }, + "osmTags": "socket:tesla_destination~*" + }, + { + "question": { + "en": "Has a Tesla supercharger (destination (A Type 2 with cable branded as tesla) connector", + "nl": "Heeft een " + }, + "osmTags": "socket:tesla_destination~*" } ] } @@ -2094,7 +2822,11 @@ "socket:type1_combo:voltage", "socket:tesla_supercharger:voltage", "socket:type2:voltage", - "socket:type2_combo:voltage" + "socket:type2_combo:voltage", + "socket:type2_cable:voltage", + "socket:tesla_supercharger_ccs:voltage", + "socket:tesla_destination:voltage", + "socket:tesla_destination:voltage" ], "applicableUnits": [ { @@ -2124,7 +2856,11 @@ "socket:type1_combo:current", "socket:tesla_supercharger:current", "socket:type2:current", - "socket:type2_combo:current" + "socket:type2_combo:current", + "socket:type2_cable:current", + "socket:tesla_supercharger_ccs:current", + "socket:tesla_destination:current", + "socket:tesla_destination:current" ], "applicableUnits": [ { @@ -2153,7 +2889,11 @@ "socket:type1_combo:output", "socket:tesla_supercharger:output", "socket:type2:output", - "socket:type2_combo:output" + "socket:type2_combo:output", + "socket:type2_cable:output", + "socket:tesla_supercharger_ccs:output", + "socket:tesla_destination:output", + "socket:tesla_destination:output" ], "applicableUnits": [ { diff --git a/assets/layers/charging_station/charging_station.protojson b/assets/layers/charging_station/charging_station.protojson index 7689ae905..536c876f1 100644 --- a/assets/layers/charging_station/charging_station.protojson +++ b/assets/layers/charging_station/charging_station.protojson @@ -93,8 +93,13 @@ ] }, { - "question": "Who is allowed to use this charging station?", - "render": "Access is {access}", + "#": "access", + "question": { + "en": "Who is allowed to use this charging station?" + }, + "render": { + "en": "Access is {access}" + }, "freeform": { "key": "access", "addExtraTags": [ @@ -141,7 +146,7 @@ "type": "pnat" } }, - $$$ + {"#": "$$$"}, { "#": "Authentication", "question": { @@ -311,6 +316,7 @@ ] }, { + "#": "payment-options", "builtin": "payment-options", "override": { "condition": { @@ -395,8 +401,12 @@ }, { "#": "Operator", - "question": "Who is the operator of this charging station?", - "render": "This charging station is operated by {operator}", + "question": { + "en": "Who is the operator of this charging station?" + }, + "render": { + "en": "This charging station is operated by {operator}" + }, "freeform": { "key": "operator" }, @@ -407,7 +417,9 @@ "network:={operator}" ] }, - "then": "Actually, {operator} is the network", + "then": { + "en": "Actually, {operator} is the network" + }, "addExtraTags": [ "operator=" ], @@ -460,7 +472,9 @@ "question": { "en": "What is the reference number of this charging station?" }, - "render": "Reference number is {ref}", + "render": { + "en": "Reference number is {ref}" + }, "freeform": { "key": "ref" } diff --git a/assets/layers/charging_station/csvToJson.ts b/assets/layers/charging_station/csvToJson.ts index 7ea31a10f..f02033f59 100644 --- a/assets/layers/charging_station/csvToJson.ts +++ b/assets/layers/charging_station/csvToJson.ts @@ -2,6 +2,7 @@ import {readFileSync, writeFileSync} from "fs"; import {Utils} from "../../../Utils"; import {TagRenderingConfigJson} from "../../../Models/ThemeConfig/Json/TagRenderingConfigJson"; import ScriptUtils from "../../../scripts/ScriptUtils"; +import {LayerConfigJson} from "../../../Models/ThemeConfig/Json/LayerConfigJson"; function colonSplit(value: string): string[] { @@ -13,6 +14,7 @@ function loadCsv(file): { image: string, description: Map, countryWhiteList?: string[], + countryBlackList?: string[], commonVoltages?: number[], commonCurrents?: number[], commonOutputs?: string[] @@ -27,7 +29,7 @@ function loadCsv(file): { } const v = {} - const colonSeperated = ["commonVoltages", "commonOutputs", "commonCurrents", "countryWhiteList"] + const colonSeperated = ["commonVoltages", "commonOutputs", "commonCurrents", "countryWhiteList","countryBlackList"] const descriptionTranslations = new Map() for (let j = 0; j < header.length; j++) { const key = header[j]; @@ -51,7 +53,7 @@ function loadCsv(file): { function run(file, protojson) { const overview_question_answers = [] - const questions: TagRenderingConfigJson[] = [] + const questions: (TagRenderingConfigJson & {"#": string})[] = [] const filterOptions: { question: any, osmTags?: string } [] = [ { question: { @@ -62,7 +64,8 @@ function run(file, protojson) { ] const entries = loadCsv(file) - for (const e of entries) { + for (let i = 0; i < entries.length; i++){ + const e = entries[i]; const txt = { en: ` ${e.description.get("en")}`, nl: ` ${e.description.get("nl")}` @@ -73,9 +76,15 @@ function run(file, protojson) { then: txt, } - if (e.countryWhiteList !== undefined && e.countryWhiteList.length > 0) { + if(e.countryWhiteList.length > 0 && e.countryBlackList.length > 0){ + throw "Error for type "+e.key+": don't defined both a whitelist and a blacklist" + } + if (e.countryWhiteList.length > 0) { const countries = e.countryWhiteList.map(country => "_country!=" + country) //HideInAnswer if it is in the wrong country json["hideInAnswer"] = {or: countries} + }else if (e.countryBlackList .length > 0) { + const countries = e.countryBlackList.map(country => "_country=" + country) //HideInAnswer if it is in the wrong country + json["hideInAnswer"] = {or: countries} } overview_question_answers.push(json) @@ -94,6 +103,7 @@ function run(file, protojson) { const descrWithImage_nl = `${e.description.get("nl")} ` questions.push({ + "#":"plugs-"+i, question: { en: `How much plugs of type ${descrWithImage_en} are available here?`, nl: `Hoeveel stekkers van type ${descrWithImage_nl} heeft dit oplaadpunt?`, @@ -112,6 +122,7 @@ function run(file, protojson) { }) questions.push({ + "#":"voltage-"+i, question: { en: `What voltage do the plugs with ${descrWithImage_en} offer?`, nl: `Welke spanning levert de stekker van type ${descrWithImage_nl}` @@ -140,6 +151,7 @@ function run(file, protojson) { questions.push({ + "#":"current-"+i, question: { en: `What current do the plugs with ${descrWithImage_en} offer?`, nl: `Welke stroom levert de stekker van type ${descrWithImage_nl}?`, @@ -168,6 +180,7 @@ function run(file, protojson) { questions.push({ + "#":"power-output-"+i, question: { en: `What power output does a single plug of type ${descrWithImage_en} offer?`, nl: `Welk vermogen levert een enkele stekker van type ${descrWithImage_nl}?`, @@ -204,6 +217,7 @@ function run(file, protojson) { } const toggles = { + "#":"Available_charging_stations (generated)", "question": { "en": "Which charging stations are available here?" }, @@ -213,9 +227,20 @@ function run(file, protojson) { questions.unshift(toggles) const stringified = questions.map(q => JSON.stringify(q, null, " ")) - let proto = readFileSync(protojson, "utf8") - proto = proto.replace("$$$", stringified.join(",\n") + ",") - proto = JSON.parse(proto) + let protoString = readFileSync(protojson, "utf8") + + protoString = protoString.replace("{\"#\": \"$$$\"}", stringified.join(",\n")) + const proto = JSON.parse(protoString) + proto.tagRenderings.forEach(tr => { + if(typeof tr === "string"){ + return; + } + if(tr["#"] === undefined || typeof tr["#"] !== "string"){ + console.error(tr) + throw "Every tagrendering should have an id, acting as comment" + } + }) + proto["filter"].push({ options: filterOptions }) @@ -274,7 +299,8 @@ function run(file, protojson) { } proto["units"].push(...extraUnits) - writeFileSync("charging_station.json", JSON.stringify(proto, undefined, " ")) + mergeTranslations("charging_station.json",proto) + writeFileSync("charging_station.json", JSON.stringify(proto, undefined, " ")) } @@ -302,22 +328,51 @@ async function queryTagInfo(file, type, clean: ((s: string) => string)) { } const countsArray = Array.from(counts.keys()) countsArray.sort() - // console.log(`${e.key}:${type} = ${countsArray.join(";")}`) - console.log(`${countsArray.join(";")}`) + console.log(`${e.key}:${type} = ${countsArray.join(";")}`) + // console.log(`${countsArray.join(";")}`) + } +} + +/** + * Adds the translations into the 'newConfig' object + * @param origPath + * @param newConfig + */ +function mergeTranslations(origPath, newConfig: LayerConfigJson){ + const oldFile = JSON.parse(readFileSync(origPath, "utf-8")) + const newFile = newConfig + const renderingsOld = oldFile.tagRenderings + delete oldFile.tagRenderings + const newRenderings = newFile.tagRenderings + Utils.Merge(oldFile, newFile) + + for (const oldRendering of renderingsOld) { + + const oldRenderingName = oldRendering["#"] + if(oldRenderingName === undefined){ + continue + } + const applicable = newRenderings.filter(r => r["#"] === oldRenderingName)[0] + if(applicable === undefined){ + continue; + } + Utils.Merge(oldRendering, applicable) } } try { run("types.csv", "charging_station.protojson") - // queryTagInfo("types.csv","voltage", true) - // queryTagInfo("types.csv", "current", true) - /* queryTagInfo("types.csv", "output", s => { + /*/ + queryTagInfo("types.csv","voltage", s => s.trim()) + queryTagInfo("types.csv", "current", s => s.trim()) + queryTagInfo("types.csv", "output", s => { if(s.endsWith("kW")){ s = s.substring(0, s.length - 2) } s = s.trim() return s + " kW" - })*/ + }) + //*/ } catch (e) { console.error(e) diff --git a/assets/layers/charging_station/types.csv b/assets/layers/charging_station/types.csv index 5cf989085..4b76be6a7 100644 --- a/assets/layers/charging_station/types.csv +++ b/assets/layers/charging_station/types.csv @@ -1,10 +1,14 @@ -key,image,description:en,countryWhitelist,commonVoltages,commonCurrents,commonOutputs,description:nl -socket:schuko,CEE7_4F.svg,Schuko wall plug without ground pin (CEE7/4 type F),be;fr;ma;tn;pl;cs;sk;mo,230,16,3.6 kW,Schuko stekker zonder aardingspin (CEE7/4 type F) -socket:typee,TypeE.svg,European wall plug with ground pin (CEE7/4 type E),,230,16,3 kW;22 kW;,Europese stekker met aardingspin (CEE7/4 type E) -socket:chademo,Chademo_type4.svg,Chademo,,500,120,50 kW, -socket:type1_cable,Type1_J1772.svg,Type 1 with cable (J1772),,200;240,32,3.7 kW;7 kW,Type 1 met kabel (J1772) -socket:type1,Type1_J1772.svg,Type 1 without cable (J1772),,200;240,32,3.7 kW;6.6 kW;7 kW;7.2 kW,Type 1 zonder kabel (J1772) -socket:type1_combo,Type1-ccs.svg,Type 1 CCS (aka Type 1 Combo),,400;1000,50;125,50 kW;62.5 kW;150 kW;350 kW;, -socket:tesla_supercharger,Tesla-hpwc-model-s.svg,Tesla Supercharger,,480,125;350,120 kW;150 kW;250 kW, -socket:type2,Type2_socket.svg,Type 2 (mennekes),,230;400,16;32,11 kW;22 kW, -socket:type2_combo,Type2_CCS.svg,Type 2 CCS (mennekes),,500;920,125;350,50 kW, +key,image,description:en,countryWhiteList,countryBlackList,commonVoltages,commonCurrents,commonOutputs,description:nl +socket:schuko,CEE7_4F.svg,Schuko wall plug without ground pin (CEE7/4 type F),be;fr;ma;tn;pl;cs;sk;mo,,230,16,3.6 kW,Schuko stekker zonder aardingspin (CEE7/4 type F) +socket:typee,TypeE.svg,European wall plug with ground pin (CEE7/4 type E),,,230,16,3 kW;22 kW;,Europese stekker met aardingspin (CEE7/4 type E) +socket:chademo,Chademo_type4.svg,Chademo,,,500,120,50 kW, +socket:type1_cable,Type1_J1772.svg,Type 1 with cable (J1772),,,200;240,32,3.7 kW;7 kW,Type 1 met kabel (J1772) +socket:type1,Type1_J1772.svg,Type 1 without cable (J1772),,,200;240,32,3.7 kW;6.6 kW;7 kW;7.2 kW,Type 1 zonder kabel (J1772) +socket:type1_combo,Type1-ccs.svg,Type 1 CCS (aka Type 1 Combo),,,400;1000,50;125,50 kW;62.5 kW;150 kW;350 kW;, +socket:tesla_supercharger,Tesla-hpwc-model-s.svg,Tesla Supercharger,,,480,125;350,120 kW;150 kW;250 kW, +socket:type2,Type2_socket.svg,Type 2 (mennekes),,,230;400,16;32,11 kW;22 kW, +socket:type2_combo,Type2_CCS.svg,Type 2 CCS (mennekes),,,500;920,125;350,50 kW, +socket:type2_cable,Type2_tethered.svg,Type 2 with cable (mennekes),,,230;400,16;32,11 kW;22 kW,Type 2 met kabel (J1772) +socket:tesla_supercharger_ccs,Type2_CCS.svg,Tesla Supercharger CCS (a branded type2_css),,,500;920,125;350,50 kW, +socket:tesla_destination,Tesla-hpwc-model-s.svg,Tesla Supercharger (destination),us,,480,125;350,120 kW;150 kW;250 kW, +socket:tesla_destination,Type2_tethered.svg,Tesla supercharger (destination (A Type 2 with cable branded as tesla),,us,230;400,16;32,11 kW;22 kW,