From 96c11badaf01460c0dc3ee94aa3fc54e75f08b42 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Mon, 6 Sep 2021 01:35:08 +0200 Subject: [PATCH] Add a big update to the charging station theme --- Docs/SpecialInputElements.md | 1 + Models/ThemeConfig/LayerConfig.ts | 2 +- UI/Popup/TagRenderingQuestion.ts | 8 +- Utils.ts | 3 +- assets/layers/charging_station/CEE7_4F.svg | 64 +++ .../layers/charging_station/Chademo_type4.svg | 175 ++++++ .../charging_station/Tesla-hpwc-model-s.svg | 168 ++++++ assets/layers/charging_station/Type1-ccs.svg | 227 ++++++++ .../layers/charging_station/Type1_J1772.svg | 205 +++++++ assets/layers/charging_station/TypeE.svg | 93 +++ .../charging_station/charging_station.json | 534 ++++++++++++++++++ .../charging_station.proto.json | 403 +++++++++++++ assets/layers/charging_station/csvToJson.ts | 70 +++ assets/layers/charging_station/genJson.sh | 5 + .../layers/charging_station/license_info.json | 61 ++ assets/layers/charging_station/types.csv | 8 + .../charging_stations/charging_stations.json | 351 +----------- 17 files changed, 2035 insertions(+), 343 deletions(-) create mode 100644 assets/layers/charging_station/CEE7_4F.svg create mode 100644 assets/layers/charging_station/Chademo_type4.svg create mode 100644 assets/layers/charging_station/Tesla-hpwc-model-s.svg create mode 100644 assets/layers/charging_station/Type1-ccs.svg create mode 100644 assets/layers/charging_station/Type1_J1772.svg create mode 100644 assets/layers/charging_station/TypeE.svg create mode 100644 assets/layers/charging_station/charging_station.json create mode 100644 assets/layers/charging_station/charging_station.proto.json create mode 100644 assets/layers/charging_station/csvToJson.ts create mode 100755 assets/layers/charging_station/genJson.sh create mode 100644 assets/layers/charging_station/license_info.json create mode 100644 assets/layers/charging_station/types.csv diff --git a/Docs/SpecialInputElements.md b/Docs/SpecialInputElements.md index 957a74db4..f46ec1bb2 100644 --- a/Docs/SpecialInputElements.md +++ b/Docs/SpecialInputElements.md @@ -1,3 +1,4 @@ + # Available types for text fields The listed types here trigger a special input element. Use them in `tagrendering.freeform.type` of your tagrendering to activate them diff --git a/Models/ThemeConfig/LayerConfig.ts b/Models/ThemeConfig/LayerConfig.ts index c99f01be4..84ae9e472 100644 --- a/Models/ThemeConfig/LayerConfig.ts +++ b/Models/ThemeConfig/LayerConfig.ts @@ -9,7 +9,6 @@ import {TagUtils} from "../../Logic/Tags/TagUtils"; import SharedTagRenderings from "../../Customizations/SharedTagRenderings"; import {TagRenderingConfigJson} from "./Json/TagRenderingConfigJson"; import {Utils} from "../../Utils"; -import Svg from "../../Svg"; import {UIEventSource} from "../../Logic/UIEventSource"; import BaseUIElement from "../../UI/BaseUIElement"; import {FixedUiElement} from "../../UI/Base/FixedUiElement"; @@ -18,6 +17,7 @@ import {VariableUiElement} from "../../UI/Base/VariableUIElement"; import FilterConfig from "./FilterConfig"; import {Unit} from "../Unit"; import DeleteConfig from "./DeleteConfig"; +import Svg from "../../Svg"; export default class LayerConfig { static WAYHANDLING_DEFAULT = 0; diff --git a/UI/Popup/TagRenderingQuestion.ts b/UI/Popup/TagRenderingQuestion.ts index bdeb11fda..9b534f351 100644 --- a/UI/Popup/TagRenderingQuestion.ts +++ b/UI/Popup/TagRenderingQuestion.ts @@ -53,6 +53,12 @@ export default class TagRenderingQuestion extends Combine { const inputElement: InputElement = TagRenderingQuestion.GenerateInputElement(configuration, applicableUnit, tags) + + if(inputElement === undefined){ + console.trace("MultiAnswer failed", configuration) + const inputElement0: InputElement = TagRenderingQuestion.GenerateInputElement(configuration, applicableUnit, tags) + + } const save = () => { const selection = inputElement.GetValue().data; if (selection) { @@ -176,6 +182,7 @@ export default class TagRenderingQuestion extends Combine { configuration: TagRenderingConfig, elements: InputElement[], freeformField: InputElement, ifNotSelected: TagsFilter[]): InputElement { const checkBoxes = new CheckBoxes(elements); + const inputEl = new InputElementMap( checkBoxes, (t0, t1) => { @@ -248,7 +255,6 @@ export default class TagRenderingQuestion extends Combine { elements.map(el => el.GetValue()) ); - freeformField?.GetValue()?.addCallbackAndRun(value => { // The list of indices of the selected elements const es = checkBoxes.GetValue(); diff --git a/Utils.ts b/Utils.ts index 8414f8882..9b0d04b7f 100644 --- a/Utils.ts +++ b/Utils.ts @@ -173,8 +173,9 @@ export class Utils { if (!tags.hasOwnProperty(key)) { continue } - txt = txt.replace(new RegExp("{" + key + "}", "g"), tags[key]) + txt = txt.replace(new RegExp("{" + key + "}", "g"), tags[key] ?? "") } + txt = txt.replace(new RegExp('{.*}', "g"), "") return txt; } diff --git a/assets/layers/charging_station/CEE7_4F.svg b/assets/layers/charging_station/CEE7_4F.svg new file mode 100644 index 000000000..e542f96b9 --- /dev/null +++ b/assets/layers/charging_station/CEE7_4F.svg @@ -0,0 +1,64 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/assets/layers/charging_station/Chademo_type4.svg b/assets/layers/charging_station/Chademo_type4.svg new file mode 100644 index 000000000..85676a516 --- /dev/null +++ b/assets/layers/charging_station/Chademo_type4.svg @@ -0,0 +1,175 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/layers/charging_station/Tesla-hpwc-model-s.svg b/assets/layers/charging_station/Tesla-hpwc-model-s.svg new file mode 100644 index 000000000..5bbf56fcb --- /dev/null +++ b/assets/layers/charging_station/Tesla-hpwc-model-s.svg @@ -0,0 +1,168 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/layers/charging_station/Type1-ccs.svg b/assets/layers/charging_station/Type1-ccs.svg new file mode 100644 index 000000000..ad773f6b9 --- /dev/null +++ b/assets/layers/charging_station/Type1-ccs.svg @@ -0,0 +1,227 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/layers/charging_station/Type1_J1772.svg b/assets/layers/charging_station/Type1_J1772.svg new file mode 100644 index 000000000..d2a68953b --- /dev/null +++ b/assets/layers/charging_station/Type1_J1772.svg @@ -0,0 +1,205 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/layers/charging_station/TypeE.svg b/assets/layers/charging_station/TypeE.svg new file mode 100644 index 000000000..c7daca9ab --- /dev/null +++ b/assets/layers/charging_station/TypeE.svg @@ -0,0 +1,93 @@ + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/assets/layers/charging_station/charging_station.json b/assets/layers/charging_station/charging_station.json new file mode 100644 index 000000000..528f431ac --- /dev/null +++ b/assets/layers/charging_station/charging_station.json @@ -0,0 +1,534 @@ +{ + "id": "charging_station", + "name": { + "en": "Charging stations", + "it": "Stazioni di ricarica", + "ja": "充電ステーション", + "nb_NO": "Ladestasjoner", + "ru": "Зарядные станции", + "zh_Hant": "充電站" + }, + "minzoom": 10, + "source": { + "osmTags": { + "and": [ + "amenity=charging_station" + ] + } + }, + "title": { + "render": { + "en": "Charging station", + "it": "Stazione di ricarica", + "ja": "充電ステーション", + "nb_NO": "Ladestasjon", + "ru": "Зарядная станция", + "zh_Hant": "充電站" + } + }, + "description": { + "en": "A charging station", + "it": "Una stazione di ricarica", + "ja": "充電ステーション", + "nb_NO": "En ladestasjon", + "ru": "Зарядная станция", + "zh_Hant": "充電站" + }, + "calculatedTags": [ + "motorcar=feat.properties.motorcar ?? feat.properties.car" + ], + "tagRenderings": [ + "images", + { + "#": "Type", + "question": { + "en": "Which vehicles are allowed to charge here?" + }, + "multiAnswer": true, + "mappings": [ + { + "if": "bicycle=yes", + "ifnot": "bicycle=no", + "then": { + "en": "bicycles can be charged here" + } + }, + { + "if": "motorcar=yes", + "extraTags": "car=", + "ifnot": { + "and": [ + "car=", + "motorcar=no" + ] + }, + "then": { + "en": "Cars can be charged here" + } + }, + { + "if": "scooter=yes", + "ifnot": "scooter=no", + "then": { + "en": "Scooters can be charged here" + } + }, + { + "if": "hgv=yes", + "ifnot": "hgv=no", + "then": { + "en": "Heavy good vehicles (such as trucks) can be charged here" + } + }, + { + "if": "bus=yes", + "ifnot": "bus=no", + "then": { + "en": "Buses can be charged here" + } + } + ] + }, + { + "question": "Who is allowed to use this charging station?", + "render": "Access is {access}", + "freeform": { + "key": "access", + "addExtraTags": [ + "fixme=Freeform field used for access - doublecheck the value" + ] + }, + "mappings": [ + { + "if": "access=yes", + "then": "Anyone can use this charging station (payment might be needed)" + }, + { + "if": { + "or": [ + "access=permissive", + "access=public" + ] + }, + "then": "Anyone can use this charging station (payment might be needed)", + "hideInAnswer": true + }, + { + "if": "access=customers", + "then": "Only customers of the place this station belongs to can use this charging station
E.g. a charging station operated by hotel which is only usable by their guests " + }, + { + "if": "access=private", + "then": "Not accessible to the general public (e.g. only accessible to the owners, employees, ...)" + } + ] + }, + { + "#": "capacity", + "render": { + "en": "{capacity} vehicles can be charged here at the same time" + }, + "question": { + "en": "How much vehicles can be charged here at the same time?" + }, + "freeform": { + "key": "capacity", + "type": "pnat" + } + }, + { + "question": { + "en": "Which charging stations are available here?" + }, + "multiAnswer": true, + "mappings": [ + { + "if": "socket:schuko=1", + "ifnot": "socket:schuko=", + "then": " Schuko wall plug without ground pin (CEE7/4 type F)", + "hideInAnswer": { + "or": [ + "_country!=be", + "_country!=fr", + "_country!=ma", + "_country!=tn", + "_country!=pl", + "_country!=cs", + "_country!=sk", + "_country!=mo" + ] + } + }, + { + "if": "socket:typee=1", + "ifnot": "socket:typee=", + "then": " European wall plug with ground pin (CEE7/4 type E)" + }, + { + "if": "socket:chademo=1", + "ifnot": "socket:chademo=", + "then": " Chademo (type 4)" + }, + { + "if": "socket:type1_cable=1", + "ifnot": "socket:type1_cable=", + "then": " Type 1 with cable (J1772)" + }, + { + "if": "socket:type1=1", + "ifnot": "socket:type1=", + "then": " Type 1 without cable (J1772)" + }, + { + "if": "socket:type1_combo=1", + "ifnot": "socket:type1_combo=", + "then": " Type 1 CCS (aka Type 1 Combo)" + }, + { + "if": "socket:tesla_supercharger=1", + "ifnot": "socket:tesla_supercharger=", + "then": " Tesla Supercharger" + } + ] +}, +{ + "question": { + "en": "How much plugs of type Schuko wall plug without ground pin (CEE7/4 type F) are available here?" + }, + "render": "There are {socket:schuko} plugs of type Schuko wall plug without ground pin (CEE7/4 type F) available here", + "freeform": { + "key": "socket:schuko", + "type": "pnat" + }, + "condition": "socket:schuko~*" +}, +{ + "question": { + "en": "How much plugs of type European wall plug with ground pin (CEE7/4 type E) are available here?" + }, + "render": "There are {socket:typee} plugs of type European wall plug with ground pin (CEE7/4 type E) available here", + "freeform": { + "key": "socket:typee", + "type": "pnat" + }, + "condition": "socket:typee~*" +}, +{ + "question": { + "en": "How much plugs of type Chademo (type 4) are available here?" + }, + "render": "There are {socket:chademo} plugs of type Chademo (type 4) available here", + "freeform": { + "key": "socket:chademo", + "type": "pnat" + }, + "condition": "socket:chademo~*" +}, +{ + "question": { + "en": "How much plugs of type Type 1 with cable (J1772) are available here?" + }, + "render": "There are {socket:type1_cable} plugs of type Type 1 with cable (J1772) available here", + "freeform": { + "key": "socket:type1_cable", + "type": "pnat" + }, + "condition": "socket:type1_cable~*" +}, +{ + "question": { + "en": "How much plugs of type Type 1 without cable (J1772) are available here?" + }, + "render": "There are {socket:type1} plugs of type Type 1 without cable (J1772) available here", + "freeform": { + "key": "socket:type1", + "type": "pnat" + }, + "condition": "socket:type1~*" +}, +{ + "question": { + "en": "How much plugs of type Type 1 CCS (aka Type 1 Combo) are available here?" + }, + "render": "There are {socket:type1_combo} plugs of type Type 1 CCS (aka Type 1 Combo) available here", + "freeform": { + "key": "socket:type1_combo", + "type": "pnat" + }, + "condition": "socket:type1_combo~*" +}, +{ + "question": { + "en": "How much plugs of type Tesla Supercharger are available here?" + }, + "render": "There are {socket:tesla_supercharger} plugs of type Tesla Supercharger available here", + "freeform": { + "key": "socket:tesla_supercharger", + "type": "pnat" + }, + "condition": "socket:tesla_supercharger~*" +}, + { + "#": "Authentication", + "question": { + "en": "What kind of authentication is available at the charging station?", + "it": "Quali sono gli orari di apertura di questa stazione di ricarica?", + "ja": "この充電ステーションはいつオープンしますか?", + "nb_NO": "Når åpnet denne ladestasjonen?", + "ru": "В какое время работает эта зарядная станция?", + "zh_Hant": "何時是充電站開放使用的時間?" + }, + "multiAnswer": true, + "mappings": [ + { + "if": "authentication:membership_card=yes", + "ifnot": "authentication:membership_card=no", + "then": { + "en": "Authentication by a membership card" + } + }, + { + "if": "authentication:app=yes", + "ifnot": "authentication:app=no", + "then": { + "en": "Authentication by an app" + } + }, + { + "if": "authentication:phone_call=yes", + "ifnot": "authentication:phone_call=no", + "then": { + "en": "Authentication via phone call is available" + } + }, + { + "if": "authentication:short_message=yes", + "ifnot": "authentication:short_message=no", + "then": { + "en": "Authentication via phone call is available" + } + }, + { + "if": "authentication:nfc=yes", + "ifnot": "authentication:nfc=no", + "then": { + "en": "Authentication via NFC is available" + } + }, + { + "if": "authentication:money_card=yes", + "ifnot": "authentication:money_card=no", + "then": { + "en": "Authentication via Money Card is available" + } + }, + { + "if": "authentication:debit_card=yes", + "ifnot": "authentication:debit_card=no", + "then": { + "en": "Authentication via debit card is available" + } + }, + { + "if": "authentication:none=yes", + "ifnot": "authentication:none=no", + "then": { + "en": "No authentication is needed" + } + } + ] + }, + { + "#": "Auth phone", + "render": { + "en": "Authenticate by calling or SMS'ing to {authentication:phone_call:number}", + "it": "{network}", + "ja": "{network}", + "nb_NO": "{network}", + "ru": "{network}", + "zh_Hant": "{network}" + }, + "question": { + "en": "What's the phone number for authentication call or SMS?", + "it": "A quale rete appartiene questa stazione di ricarica?", + "ja": "この充電ステーションの運営チェーンはどこですか?", + "ru": "К какой сети относится эта станция?", + "zh_Hant": "充電站所屬的網路是?" + }, + "freeform": { + "key": "authentication:phone_call:number", + "type": "phone" + }, + "condition": { + "or": [ + "authentication:phone_call=yes", + "authentication:short_message=yes" + ] + }, + "it": { + "0": { + "then": "Non appartiene a una rete" + } + }, + "ja": { + "0": { + "then": "大規模な運営チェーンの一部ではない" + } + }, + "ru": { + "0": { + "then": "Не является частью более крупной сети" + } + }, + "zh_Hant": { + "0": { + "then": "不屬於大型網路" + } + } + }, + { + "#": "OH", + "render": "{opening_hours_table(opening_hours)}", + "freeform": { + "key": "opening_hours", + "type": "opening_hours" + }, + "question": { + "en": "When is this charging station opened?" + }, + "mappings": [ + { + "if": "opening_hours=24/7", + "then": { + "en": "24/7 opened (including holidays)" + } + } + ] + }, + { + "#": "Network", + "render": { + "en": "Part of the network {network}" + }, + "question": { + "en": "Is this charging station part of a network?" + }, + "freeform": { + "key": "network" + }, + "mappings": [ + { + "if": { + "and": [ + "no:network=yes" + ] + }, + "then": { + "en": "Not part of a bigger network" + } + }, + { + "if": { + "and": [ + "network=AeroVironment" + ] + }, + "then": "AeroVironment" + }, + { + "if": { + "and": [ + "network=Blink" + ] + }, + "then": "Blink" + }, + { + "if": { + "and": [ + "network=eVgo" + ] + }, + "then": "eVgo" + } + ] + }, + { + "#": "Operator", + "question": "Who is the operator of this charging station?", + "render": "This charging station is operated by {operator}", + "freeform": { + "key": "operator" + }, + "mappings": [ + { + "if": { + "and": [ + "network:={operator}" + ] + }, + "then": "Actually, {operator} is the network", + "addExtraTags": [ + "operator=" + ], + "hideInAnswer": "operator=" + } + ] + } + ], + "icon": { + "render": "pin:#fff;./assets/themes/charging_stations/plug.svg", + "mappings": [ + { + "if": "bicycle=yes", + "then": "pin:#fff;./assets/themes/charging_stations/bicycle.svg" + }, + { + "if": { + "or": [ + "car=yes", + "motorcar=yes" + ] + }, + "then": "pin:#fff;./assets/themes/charging_stations/car.svg" + } + ] + }, + "iconOverlays": [ + { + "if": { + "and": [ + "bicycle=yes", + { + "or": [ + "motorcar=yes", + "car=yes" + ] + } + ] + }, + "then": "circle:#fff;./assets/themes/charging_stations/car.svg", + "badge": true + } + ], + "width": { + "render": "8" + }, + "iconSize": { + "render": "50,50,bottom" + }, + "color": { + "render": "#00f" + }, + "presets": [ + { + "tags": [ + "amenity=charging_station" + ], + "title": { + "en": "Charging station" + } + } + ], + "wayHandling": 1 +} diff --git a/assets/layers/charging_station/charging_station.proto.json b/assets/layers/charging_station/charging_station.proto.json new file mode 100644 index 000000000..67bf0d884 --- /dev/null +++ b/assets/layers/charging_station/charging_station.proto.json @@ -0,0 +1,403 @@ +{ + "id": "charging_station", + "name": { + "en": "Charging stations", + "it": "Stazioni di ricarica", + "ja": "充電ステーション", + "nb_NO": "Ladestasjoner", + "ru": "Зарядные станции", + "zh_Hant": "充電站" + }, + "minzoom": 10, + "source": { + "osmTags": { + "and": [ + "amenity=charging_station" + ] + } + }, + "title": { + "render": { + "en": "Charging station", + "it": "Stazione di ricarica", + "ja": "充電ステーション", + "nb_NO": "Ladestasjon", + "ru": "Зарядная станция", + "zh_Hant": "充電站" + } + }, + "description": { + "en": "A charging station", + "it": "Una stazione di ricarica", + "ja": "充電ステーション", + "nb_NO": "En ladestasjon", + "ru": "Зарядная станция", + "zh_Hant": "充電站" + }, + "calculatedTags": [ + "motorcar=feat.properties.motorcar ?? feat.properties.car" + ], + "tagRenderings": [ + "images", + { + "#": "Type", + "question": { + "en": "Which vehicles are allowed to charge here?" + }, + "multiAnswer": true, + "mappings": [ + { + "if": "bicycle=yes", + "ifnot": "bicycle=no", + "then": { + "en": "bicycles can be charged here" + } + }, + { + "if": "motorcar=yes", + "extraTags": "car=", + "ifnot": { + "and": [ + "car=", + "motorcar=no" + ] + }, + "then": { + "en": "Cars can be charged here" + } + }, + { + "if": "scooter=yes", + "ifnot": "scooter=no", + "then": { + "en": "Scooters can be charged here" + } + }, + { + "if": "hgv=yes", + "ifnot": "hgv=no", + "then": { + "en": "Heavy good vehicles (such as trucks) can be charged here" + } + }, + { + "if": "bus=yes", + "ifnot": "bus=no", + "then": { + "en": "Buses can be charged here" + } + } + ] + }, + { + "question": "Who is allowed to use this charging station?", + "render": "Access is {access}", + "freeform": { + "key": "access", + "addExtraTags": [ + "fixme=Freeform field used for access - doublecheck the value" + ] + }, + "mappings": [ + { + "if": "access=yes", + "then": "Anyone can use this charging station (payment might be needed)" + }, + { + "if": { + "or": [ + "access=permissive", + "access=public" + ] + }, + "then": "Anyone can use this charging station (payment might be needed)", + "hideInAnswer": true + }, + { + "if": "access=customers", + "then": "Only customers of the place this station belongs to can use this charging station
E.g. a charging station operated by hotel which is only usable by their guests " + }, + { + "if": "access=private", + "then": "Not accessible to the general public (e.g. only accessible to the owners, employees, ...)" + } + ] + }, + { + "#": "capacity", + "render": { + "en": "{capacity} vehicles can be charged here at the same time" + }, + "question": { + "en": "How much vehicles can be charged here at the same time?" + }, + "freeform": { + "key": "capacity", + "type": "pnat" + } + }, + $$$ + { + "#": "Authentication", + "question": { + "en": "What kind of authentication is available at the charging station?", + "it": "Quali sono gli orari di apertura di questa stazione di ricarica?", + "ja": "この充電ステーションはいつオープンしますか?", + "nb_NO": "Når åpnet denne ladestasjonen?", + "ru": "В какое время работает эта зарядная станция?", + "zh_Hant": "何時是充電站開放使用的時間?" + }, + "multiAnswer": true, + "mappings": [ + { + "if": "authentication:membership_card=yes", + "ifnot": "authentication:membership_card=no", + "then": { + "en": "Authentication by a membership card" + } + }, + { + "if": "authentication:app=yes", + "ifnot": "authentication:app=no", + "then": { + "en": "Authentication by an app" + } + }, + { + "if": "authentication:phone_call=yes", + "ifnot": "authentication:phone_call=no", + "then": { + "en": "Authentication via phone call is available" + } + }, + { + "if": "authentication:short_message=yes", + "ifnot": "authentication:short_message=no", + "then": { + "en": "Authentication via phone call is available" + } + }, + { + "if": "authentication:nfc=yes", + "ifnot": "authentication:nfc=no", + "then": { + "en": "Authentication via NFC is available" + } + }, + { + "if": "authentication:money_card=yes", + "ifnot": "authentication:money_card=no", + "then": { + "en": "Authentication via Money Card is available" + } + }, + { + "if": "authentication:debit_card=yes", + "ifnot": "authentication:debit_card=no", + "then": { + "en": "Authentication via debit card is available" + } + }, + { + "if": "authentication:none=yes", + "ifnot": "authentication:none=no", + "then": { + "en": "No authentication is needed" + } + } + ] + }, + { + "#": "Auth phone", + "render": { + "en": "Authenticate by calling or SMS'ing to {authentication:phone_call:number}", + "it": "{network}", + "ja": "{network}", + "nb_NO": "{network}", + "ru": "{network}", + "zh_Hant": "{network}" + }, + "question": { + "en": "What's the phone number for authentication call or SMS?", + "it": "A quale rete appartiene questa stazione di ricarica?", + "ja": "この充電ステーションの運営チェーンはどこですか?", + "ru": "К какой сети относится эта станция?", + "zh_Hant": "充電站所屬的網路是?" + }, + "freeform": { + "key": "authentication:phone_call:number", + "type": "phone" + }, + "condition": { + "or": [ + "authentication:phone_call=yes", + "authentication:short_message=yes" + ] + }, + "it": { + "0": { + "then": "Non appartiene a una rete" + } + }, + "ja": { + "0": { + "then": "大規模な運営チェーンの一部ではない" + } + }, + "ru": { + "0": { + "then": "Не является частью более крупной сети" + } + }, + "zh_Hant": { + "0": { + "then": "不屬於大型網路" + } + } + }, + { + "#": "OH", + "render": "{opening_hours_table(opening_hours)}", + "freeform": { + "key": "opening_hours", + "type": "opening_hours" + }, + "question": { + "en": "When is this charging station opened?" + }, + "mappings": [ + { + "if": "opening_hours=24/7", + "then": { + "en": "24/7 opened (including holidays)" + } + } + ] + }, + { + "#": "Network", + "render": { + "en": "Part of the network {network}" + }, + "question": { + "en": "Is this charging station part of a network?" + }, + "freeform": { + "key": "network" + }, + "mappings": [ + { + "if": { + "and": [ + "no:network=yes" + ] + }, + "then": { + "en": "Not part of a bigger network" + } + }, + { + "if": { + "and": [ + "network=AeroVironment" + ] + }, + "then": "AeroVironment" + }, + { + "if": { + "and": [ + "network=Blink" + ] + }, + "then": "Blink" + }, + { + "if": { + "and": [ + "network=eVgo" + ] + }, + "then": "eVgo" + } + ] + }, + { + "#": "Operator", + "question": "Who is the operator of this charging station?", + "render": "This charging station is operated by {operator}", + "freeform": { + "key": "operator" + }, + "mappings": [ + { + "if": { + "and": [ + "network:={operator}" + ] + }, + "then": "Actually, {operator} is the network", + "addExtraTags": [ + "operator=" + ], + "hideInAnswer": "operator=" + } + ] + } + ], + "icon": { + "render": "pin:#fff;./assets/themes/charging_stations/plug.svg", + "mappings": [ + { + "if": "bicycle=yes", + "then": "pin:#fff;./assets/themes/charging_stations/bicycle.svg" + }, + { + "if": { + "or": [ + "car=yes", + "motorcar=yes" + ] + }, + "then": "pin:#fff;./assets/themes/charging_stations/car.svg" + } + ] + }, + "iconOverlays": [ + { + "if": { + "and": [ + "bicycle=yes", + { + "or": [ + "motorcar=yes", + "car=yes" + ] + } + ] + }, + "then": "circle:#fff;./assets/themes/charging_stations/car.svg", + "badge": true + } + ], + "width": { + "render": "8" + }, + "iconSize": { + "render": "50,50,bottom" + }, + "color": { + "render": "#00f" + }, + "presets": [ + { + "tags": [ + "amenity=charging_station" + ], + "title": { + "en": "Charging station" + } + } + ], + "wayHandling": 1 +} diff --git a/assets/layers/charging_station/csvToJson.ts b/assets/layers/charging_station/csvToJson.ts new file mode 100644 index 000000000..2c925407b --- /dev/null +++ b/assets/layers/charging_station/csvToJson.ts @@ -0,0 +1,70 @@ +import {readFileSync, writeFileSync} from "fs"; +import {Utils} from "../../../Utils"; + +// SMall script to output the properties of the types.csv as json to add in the tagRenderingGroup. Should be copied manually +function run() { + const entries: string[] = Utils.NoNull(readFileSync("types.csv", "utf8").split("\n").map(str => str.trim())) + entries.shift() + + const result = [] + const questions = [] + + for (const entry of entries) { + const [key, image, description, whitelist] = entry.split(",").map(str => str.trim()) + if (key === "") { + continue; + } + + const json = { + if: `${key}=1`, + ifnot: `${key}=`, + then: ` ${description}`, + + } + + if (whitelist) { + const countries = whitelist.split(";").map(country => "_country!=" + country) //HideInAnswer if it is in the wrong country + json["hideInAnswer"] = {or:countries} + } + + result.push(json) + + + const indivQ = { + + question: { + en: `How much plugs of type ${description} are available here?` + }, + render: `There are {${key}} plugs of type ${description} available here`, + freeform: { + key: key, + type: "pnat" + }, + condition: `${key}~*` + + } + + questions.push(indivQ) + } + + const toggles = { + "question": { + "en": "Which charging stations are available here?" + }, + "multiAnswer": true, + "mappings": result + } + questions.unshift(toggles) + + const stringified = questions.map(q => JSON.stringify(q, null, " ")) + console.log(stringified) + let proto = readFileSync("charging_station.proto.json", "utf8") + proto = proto.replace("$$$", stringified.join(",\n") + ",") + writeFileSync("charging_station.json", proto) +} + +try { + run() +} catch (e) { + console.error(e) +} diff --git a/assets/layers/charging_station/genJson.sh b/assets/layers/charging_station/genJson.sh new file mode 100755 index 000000000..fc227572b --- /dev/null +++ b/assets/layers/charging_station/genJson.sh @@ -0,0 +1,5 @@ +#! /bin/bash +cp csvToJson.tsd csvToJson.ts +ts-node csvToJson.ts +# rm csvToJson.ts +npm run generate:layeroverview diff --git a/assets/layers/charging_station/license_info.json b/assets/layers/charging_station/license_info.json new file mode 100644 index 000000000..53a88ad1c --- /dev/null +++ b/assets/layers/charging_station/license_info.json @@ -0,0 +1,61 @@ +[ + { + "path": "CEE7_4F.svg", + "license": "MIT", + "authors": [ + "Gabor111a" + ], + "sources": [ + "https://commons.wikimedia.org/wiki/File:CEE7_Type4.svg", + "https://github.com/openchargemap/ocm-app/issues/22" + ] + }, + { + "path": "TypeE.svg", + "license": "MIT", + "authors": [ + "pietervdvn" + ], + "sources": [] + }, + { + "path": "Type1_J1772.svg", + "license": "CC-BY-SA 4.0", + "authors": [ + "GreatDrok" + ], + "sources": [ + "https://upload.wikimedia.org/wikipedia/commons/d/d0/Type1_J1772.svg" + ] + }, + { + "path": "Type1-ccs.svg", + "license": "CC-BY-SA 4.0", + "authors": [ + "GreatDrok" + ], + "sources": [ + "https://upload.wikimedia.org/wikipedia/commons/0/05/Type1-ccs.svg" + ] + }, + { + "path": "Tesla-hpwc-model-s.svg", + "license": "CC-BY-SA 4.0", + "authors": [ + "GreatDrok" + ], + "sources": [ + "https://upload.wikimedia.org/wikipedia/commons/2/26/Tesla-hpwc-model-s.svg" + ] + }, + { + "path": "Chademo_type4.svg", + "license": "CC-BY-SA 4.0", + "authors": [ + "GreatDrok" + ], + "sources": [ + "https://upload.wikimedia.org/wikipedia/commons/e/ec/Chademo_type4.svg" + ] + } +] \ No newline at end of file diff --git a/assets/layers/charging_station/types.csv b/assets/layers/charging_station/types.csv new file mode 100644 index 000000000..fe1410652 --- /dev/null +++ b/assets/layers/charging_station/types.csv @@ -0,0 +1,8 @@ +Key in OSM,image,Description,Country-whitelist +socket:schuko,CEE7_4F.svg,Schuko wall plug without ground pin (CEE7/4 type F),be;fr;ma;tn;pl;cs;sk;mo +socket:typee,TypeE.svg,European wall plug with ground pin (CEE7/4 type E), +socket:chademo,Chademo_type4.svg,Chademo (type 4), +socket:type1_cable,Type1_J1772.svg,Type 1 with cable (J1772), +socket:type1,Type1_J1772.svg,Type 1 without cable (J1772), +socket:type1_combo,Type1-ccs.svg,Type 1 CCS (aka Type 1 Combo), +socket:tesla_supercharger,Tesla-hpwc-model-s.svg,Tesla Supercharger, diff --git a/assets/themes/charging_stations/charging_stations.json b/assets/themes/charging_stations/charging_stations.json index 110daeb27..1f77c25cd 100644 --- a/assets/themes/charging_stations/charging_stations.json +++ b/assets/themes/charging_stations/charging_stations.json @@ -3,39 +3,36 @@ "title": { "en": "Charging stations", "id": "Stasiun pengisian daya", - "ru": "Зарядные станции", + "it": "Stazioni di ricarica", "ja": "充電ステーション", "zh_Hant": "充電站", "it": "Stazioni di ricarica", - "nl": "Oplaadpunten", - "fr": "Station de recharge" + "nl": "Oplaadpunten" }, "shortDescription": { "en": "A worldwide map of charging stations", - "ru": "Карта зарядных станций по всему миру", + "it": "Una mappa mondiale delle stazioni di ricarica", "ja": "充電ステーションの世界地図", "zh_Hant": "全世界的充電站地圖", "it": "Una mappa mondiale delle stazioni di ricarica", - "nl": "Een wereldwijde kaart van oplaadpunten", - "fr": "Carte mondiale de stations de recharge" + "nl": "Een wereldwijde kaart van oplaadpunten" }, "description": { "en": "On this open map, one can find and mark information about charging stations", - "ru": "На этой карте вы можно найти и отметить информацию о зарядных станциях", - "ja": "このオープンマップでは充電ステーションに関する情報を見つけてマークすることができます", - "zh_Hant": "在這份開放地圖上,你可以尋找與標示充電站的資訊", "it": "Su questa mappa aperta, puoi individuare le stazioni di ricarica o aggiungere informazioni", - "fr": "Cette carte indique et permet d’indiquer des informations sur les stations de recharge" + "ja": "このオープンマップでは充電ステーションに関する情報を見つけてマークすることができます", + "ru": "На этой карте вы можно найти и отметить информацию о зарядных станциях", + "zh_Hant": "在這份開放地圖上,你可以尋找與標示充電站的資訊" }, "language": [ "en", "id", - "ru", + "it", "ja", + "ru", "zh_Hant", "it", "nl", - "fr", "nb_NO" ], "maintainer": "", @@ -46,335 +43,9 @@ "startZoom": 1, "widenFactor": 0.05, "socialImage": "", + "defaultBackgroundId": "CartoDB.Voyager", "layers": [ - { - "id": "charging_stations", - "name": { - "en": "Charging stations", - "ru": "Зарядные станции", - "ja": "充電ステーション", - "zh_Hant": "充電站", - "nb_NO": "Ladestasjoner", - "it": "Stazioni di ricarica", - "nl": "Oplaadpunten", - "fr": "Station de recharge" - }, - "minzoom": 10, - "source": { - "osmTags": { - "and": [ - "amenity=charging_station" - ] - } - }, - "title": { - "render": { - "en": "Charging station", - "ru": "Зарядная станция", - "ja": "充電ステーション", - "zh_Hant": "充電站", - "nb_NO": "Ladestasjon", - "it": "Stazione di ricarica", - "nl": "Oplaadpunt", - "fr": "Station de recharge" - } - }, - "description": { - "en": "A charging station", - "ru": "Зарядная станция", - "ja": "充電ステーション", - "zh_Hant": "充電站", - "nb_NO": "En ladestasjon", - "it": "Una stazione di ricarica", - "nl": "Een oplaadpunt", - "fr": "Une station de recharge" - }, - "tagRenderings": [ - "images", - { - "#": "Type", - "question": "Is this charging station meant for cars or bicycles?", - "mappings": [ - { - "if": { - "and": [ - "motorcar=yes", - "bicycle=yes" - ] - }, - "then": "This is a charging station for both bicycles and cars" - }, - { - "if": { - "and": [ - "motorcar=", - "car=", - "bicycle=yes" - ] - }, - "then": "This is a charging station exclusively for bicycles" - }, - { - "if": { - "and": [ - "motorcar=yes", - "car=", - "bicycle=" - ] - }, - "then": "This is a charging station exclusively for electric cars and similar vehicles" - }, - { - "if": { - "and": [ - "car=yes", - "bicycle=" - ] - }, - "then": "This is a charging station exclusively for electric cars", - "hideInAnswer": true - }, - { - "if": { - "and": [ - "car=yes", - "bicycle=yes" - ] - }, - "then": "This is a charging station for both electric cars and bicycles", - "hideInAnswer": true - } - ] - }, - { - "#": "capacity", - "render": "{capacity} vehicles can be charged here at the same time", - "question": "How much vehicles can be charged here at the same time?", - "freeform": { - "key": "capacity", - "type": "pnat" - } - }, - { - "#": "Authentication", - "multiAnswer": true, - "mappings": [ - { - "if": "authentication:membership_card=yes", - "then": "Authentication by a membership card" - }, - { - "if": "authentication:app=yes", - "then": "Authentication by an app" - }, - { - "if": "authentication:phone_call=yes", - "then": "Authentication via phone call is available" - }, - { - "if": "authentication:short_message=yes", - "then": "Authentication via phone call is available" - }, - { - "if": "authentication:nfc=yes", - "then": "Authentication via NFC is available" - }, - { - "if": "authentication:money_card=yes", - "then": "Authentication via Money Card is available" - }, - { - "if": "authentication:debig=yes", - "then": "Authentication via debit card is available" - }, - { - "if": "authentication:none=yes", - "then": "No authentication is needed" - } - ] - }, - { - "#": "Auth phone", - "render": "Authenticate by calling or SMS'ing to {authentication:phone_call:number}", - "freeform": { - "key": "authentication:phone_call:number", - "type": "phone" - }, - "condition": { - "or": [ - "authentication:phone_call=yes", - "authentication:short_message=yes" - ] - } - }, - { - "#": "OH", - "render": "{opening_hours_table(opening_hours)}", - "freeform": { - "key": "opening_hours", - "type": "opening_hours" - }, - "question": { - "en": "When is this charging station opened?", - "ru": "В какое время работает эта зарядная станция?", - "ja": "この充電ステーションはいつオープンしますか?", - "zh_Hant": "何時是充電站開放使用的時間?", - "nb_NO": "Når åpnet denne ladestasjonen?", - "it": "Quali sono gli orari di apertura di questa stazione di ricarica?", - "fr": "Quand cette station a-t’elle été ouverte ?" - }, - "mappings": [ - { - "if": "opening_hours=24/7", - "then": "24/7 opened (including holidays)" - } - ] - }, - { - "#": "Network", - "render": { - "en": "{network}", - "ru": "{network}", - "ja": "{network}", - "zh_Hant": "{network}", - "nb_NO": "{network}", - "it": "{network}", - "nl": "{network}", - "fr": "{network}" - }, - "question": { - "en": "What network of this charging station under?", - "ru": "К какой сети относится эта зарядная станция?", - "ja": "この充電ステーションの運営チェーンはどこですか?", - "zh_Hant": "充電站所屬的網路是?", - "it": "A quale rete appartiene questa stazione di ricarica?", - "fr": "De quel réseau fait-elle partie ?" - }, - "freeform": { - "key": "network" - }, - "mappings": [ - { - "if": { - "and": [ - "no:network=yes" - ] - }, - "then": { - "en": "Not part of a bigger network", - "ru": "Не является частью более крупной сети", - "ja": "大規模な運営チェーンの一部ではない", - "zh_Hant": "不屬於大型網路", - "it": "Non appartiene a una rete", - "nl": "Maakt geen deel uit van een netwerk", - "fr": "Pas de réseau" - } - }, - { - "if": { - "and": [ - "network=AeroVironment" - ] - }, - "then": { - "en": "AeroVironment", - "ru": "AeroVironment", - "ja": "AeroVironment", - "zh_Hant": "AeroVironment", - "it": "AeroVironment", - "nl": "AeroVironment", - "fr": "AeroVironment" - } - }, - { - "if": { - "and": [ - "network=Blink" - ] - }, - "then": { - "en": "Blink", - "ru": "Blink", - "ja": "Blink", - "zh_Hant": "Blink", - "it": "Blink", - "nl": "Blink", - "fr": "Blink" - } - }, - { - "if": { - "and": [ - "network=eVgo" - ] - }, - "then": { - "en": "eVgo", - "ru": "eVgo", - "ja": "eVgo", - "zh_Hant": "eVgo", - "it": "eVgo", - "nl": "eVgo", - "fr": "eVgo" - } - } - ] - } - ], - "icon": { - "render": "pin:#fff;./assets/themes/charging_stations/plug.svg", - "mappings": [ - { - "if": "bicycle=yes", - "then": "pin:#fff;./assets/themes/charging_stations/bicycle.svg" - }, - { - "if": { - "or": [ - "car=yes", - "motorcar=yes" - ] - }, - "then": "pin:#fff;./assets/themes/charging_stations/car.svg" - } - ] - }, - "iconOverlays": [ - { - "if": { - "and": [ - "bicycle=yes", - { - "or": [ - "motorcar=yes", - "car=yes" - ] - } - ] - }, - "then": "circle:#fff;./assets/themes/charging_stations/car.svg", - "badge": true - } - ], - "width": { - "render": "8" - }, - "iconSize": { - "render": "50,50,bottom" - }, - "color": { - "render": "#00f" - }, - "presets": [ - { - "tags": [ - "amenity=charging_station" - ], - "title": "Charging station" - } - ], - "wayHandling": 1 - } + "charging_station" ], "roamingRenderings": [] } \ No newline at end of file