From 3a944889b517e6d652b1bb20fbd9f851fe7e08bf Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Fri, 26 Feb 2021 17:22:24 +0100 Subject: [PATCH] Add picnic tables --- .../{SharedLayers.ts => AllKnownLayers.ts} | 18 +- Customizations/AllKnownLayouts.ts | 8 +- Customizations/JSON/LayoutConfig.ts | 8 +- assets/layers/benches/benches.json | 332 +++++++++++++++ assets/layers/benches/benches_at_pt.json | 92 ++++ assets/layers/benches/picnic_tables.json | 78 ++++ assets/themes/benches/benches.json | 397 +----------------- 7 files changed, 523 insertions(+), 410 deletions(-) rename Customizations/{SharedLayers.ts => AllKnownLayers.ts} (82%) create mode 100644 assets/layers/benches/benches.json create mode 100644 assets/layers/benches/benches_at_pt.json create mode 100644 assets/layers/benches/picnic_tables.json diff --git a/Customizations/SharedLayers.ts b/Customizations/AllKnownLayers.ts similarity index 82% rename from Customizations/SharedLayers.ts rename to Customizations/AllKnownLayers.ts index 1bdc620..0925714 100644 --- a/Customizations/SharedLayers.ts +++ b/Customizations/AllKnownLayers.ts @@ -19,10 +19,13 @@ import * as surveillance_camera from "../assets/layers/surveillance_cameras/surv import * as toilets from "../assets/layers/toilets/toilets.json" import * as bookcases from "../assets/layers/public_bookcases/public_bookcases.json" import * as tree_nodes from "../assets/layers/trees/tree_nodes.json" +import * as benches from "../assets/layers/benches/benches.json" +import * as benches_at_pt from "../assets/layers/benches/benches_at_pt.json" +import * as picnic_tables from "../assets/layers/benches/picnic_tables.json" import LayerConfig from "./JSON/LayerConfig"; import {LayerConfigJson} from "./JSON/LayerConfigJson"; -export default class SharedLayers { +export default class AllKnownLayers { private static sharedLayersListRaw : LayerConfigJson[] = [ @@ -46,17 +49,20 @@ export default class SharedLayers { toilets, bookcases, surveillance_camera, - tree_nodes + tree_nodes, + benches, + benches_at_pt, + picnic_tables ]; // Must be below the list... - public static sharedLayers: Map = SharedLayers.getSharedLayers(); - public static sharedLayersJson: Map = SharedLayers.getSharedLayersJson(); + public static sharedLayers: Map = AllKnownLayers.getSharedLayers(); + public static sharedLayersJson: Map = AllKnownLayers.getSharedLayersJson(); private static getSharedLayers(): Map { const sharedLayers = new Map(); - for (const layer of SharedLayers.sharedLayersListRaw) { + for (const layer of AllKnownLayers.sharedLayersListRaw) { const parsed = new LayerConfig(layer, "shared_layers") sharedLayers.set(layer.id, parsed); sharedLayers[layer.id] = parsed; @@ -66,7 +72,7 @@ export default class SharedLayers { private static getSharedLayersJson(): Map { const sharedLayers = new Map(); - for (const layer of SharedLayers.sharedLayersListRaw) { + for (const layer of AllKnownLayers.sharedLayersListRaw) { sharedLayers.set(layer.id, layer); sharedLayers[layer.id] = layer; } diff --git a/Customizations/AllKnownLayouts.ts b/Customizations/AllKnownLayouts.ts index 2a3467e..29a2694 100644 --- a/Customizations/AllKnownLayouts.ts +++ b/Customizations/AllKnownLayouts.ts @@ -23,7 +23,7 @@ import * as playgrounds from "../assets/themes/playgrounds/playgrounds.json" import * as bicycle_lib from "../assets/themes/bicycle_library/bicycle_library.json" import LayerConfig from "./JSON/LayerConfig"; import LayoutConfig from "./JSON/LayoutConfig"; -import SharedLayers from "./SharedLayers"; +import AllKnownLayers from "./AllKnownLayers"; export class AllKnownLayouts { @@ -39,7 +39,7 @@ export class AllKnownLayouts { console.log("The current date is ",date,", which means we remember our dead") // Around Halloween/Fiesta de muerte/Allerzielen, we remember the dead layout.layers.push( - SharedLayers.sharedLayers.get("ghost_bike") + AllKnownLayers.sharedLayers.get("ghost_bike") ); } @@ -81,9 +81,9 @@ export class AllKnownLayouts { for (let i = 0; i < layout.layers.length; i++) { let layer = layout.layers[i]; if (typeof (layer) === "string") { - layer = layout.layers[i] = SharedLayers.sharedLayers.get(layer); + layer = layout.layers[i] = AllKnownLayers.sharedLayers.get(layer); if(layer === undefined){ - console.log("Defined layers are ", SharedLayers.sharedLayers.keys()) + console.log("Defined layers are ", AllKnownLayers.sharedLayers.keys()) throw `Layer ${layer} was not found or defined - probably a type was made` } } diff --git a/Customizations/JSON/LayoutConfig.ts b/Customizations/JSON/LayoutConfig.ts index fb22a66..621a819 100644 --- a/Customizations/JSON/LayoutConfig.ts +++ b/Customizations/JSON/LayoutConfig.ts @@ -2,7 +2,7 @@ import {Translation} from "../../UI/i18n/Translation"; import TagRenderingConfig from "./TagRenderingConfig"; import LayerConfig from "./LayerConfig"; import {LayoutConfigJson} from "./LayoutConfigJson"; -import SharedLayers from "../SharedLayers"; +import AllKnownLayers from "../AllKnownLayers"; import SharedTagRenderings from "../SharedTagRenderings"; import {Utils} from "../../Utils"; @@ -81,8 +81,8 @@ export default class LayoutConfig { this.defaultBackgroundId = json.defaultBackgroundId; this.layers = json.layers.map((layer, i) => { if (typeof layer === "string") { - if (SharedLayers.sharedLayers[layer] !== undefined) { - return SharedLayers.sharedLayers[layer]; + if (AllKnownLayers.sharedLayers[layer] !== undefined) { + return AllKnownLayers.sharedLayers[layer]; } else { throw "Unkown fixed layer " + layer; } @@ -91,7 +91,7 @@ export default class LayoutConfig { if (layer.builtin !== undefined) { // @ts-ignore const name = layer.builtin; - const shared = SharedLayers.sharedLayersJson[name]; + const shared = AllKnownLayers.sharedLayersJson[name]; if (shared === undefined) { throw "Unkown fixed layer " + name; } diff --git a/assets/layers/benches/benches.json b/assets/layers/benches/benches.json new file mode 100644 index 0000000..ae80375 --- /dev/null +++ b/assets/layers/benches/benches.json @@ -0,0 +1,332 @@ +{ + "id": "bench", + "name": { + "en": "Benches", + "de": "Sitzbänke", + "fr": "Bancs" + }, + "minzoom": 14, + "overpassTags": { + "and": [ + "amenity=bench" + ] + }, + "title": { + "render": { + "en": "Bench", + "de": "Sitzbank", + "fr": "Banc" + }, + "mappings": [] + }, + "tagRenderings": [ + "images", + { + "render": { + "en": "Backrest", + "de": "Rückenlehne", + "fr": "Dossier" + }, + "freeform": { + "key": "backrest", + "addExtraTags": [] + }, + "mappings": [ + { + "if": { + "and": [ + "backrest=yes" + ] + }, + "then": { + "en": "Backrest: Yes", + "de": "Rückenlehne: Ja", + "fr": "Dossier: Oui" + } + }, + { + "if": { + "and": [ + "backrest=no" + ] + }, + "then": { + "en": "Backrest: No", + "de": "Rückenlehne: Nein", + "fr": "Dossier: Non" + } + } + ], + "question": { + "en": "Does this bench have a backrest?", + "de": "Hat diese Bank eine Rückenlehne?", + "fr": "Ce banc dispose-t-il d'un dossier ?" + } + }, + { + "render": { + "en": "{seats} seats", + "de": "{seats} Sitzplätze", + "fr": "{seats} places" + }, + "freeform": { + "key": "seats", + "type": "nat" + }, + "mappings": [], + "question": { + "en": "How many seats does this bench have?", + "de": "Wie viele Sitzplätze hat diese Bank?", + "fr": "De combien de places dispose ce banc ?" + } + }, + { + "render": { + "en": "Material: {material}", + "de": "Material: {material}", + "fr": "Matériau : {material}" + }, + "freeform": { + "key": "material", + "addExtraTags": [] + }, + "mappings": [ + { + "if": { + "and": [ + "material=wood" + ] + }, + "then": { + "en": "Material: wood", + "de": "Material: Holz", + "fr": "Matériau : bois" + } + }, + { + "if": { + "and": [ + "material=metal" + ] + }, + "then": { + "en": "Material: metal", + "de": "Material: Metall", + "fr": "Matériau : métal" + } + }, + { + "if": { + "and": [ + "material=stone" + ] + }, + "then": { + "en": "Material: stone", + "de": "Material: Stein", + "fr": "Matériau: pierre" + } + }, + { + "if": { + "and": [ + "material=concrete" + ] + }, + "then": { + "en": "Material: concrete", + "de": "Material: Beton", + "fr": "Matériau : béton" + } + }, + { + "if": { + "and": [ + "material=plastic" + ] + }, + "then": { + "en": "Material: plastic", + "de": "Material: Kunststoff", + "fr": "Matériau : plastique" + } + }, + { + "if": { + "and": [ + "material=steel" + ] + }, + "then": { + "en": "Material: steel", + "de": "Material: Stahl", + "fr": "Matériau : acier" + } + } + ], + "question": { + "en": "What is the bench (seating) made from?", + "de": "Aus welchem Material besteht die Sitzbank (Sitzfläche)?", + "fr": "De quel matériau ce banc est-il fait ?" + } + }, + { + "question": { + "en": "In which direction are you looking when sitting on the bench?", + "de": "In welche Richtung schaut man, wenn man auf der Bank sitzt?" + }, + "render": { + "en": "When sitting on the bench, one looks towards {direction}°.", + "de": "Wenn man auf der Bank sitzt, schaut man in Richtung {direction}°." + }, + "freeform": { + "key": "direction", + "type": "direction" + } + }, + { + "render": { + "en": "Colour: {colour}", + "de": "Farbe: {colour}", + "fr": "Couleur : {colour}" + }, + "question": { + "en": "Which colour does this bench have?", + "de": "Welche Farbe hat diese Sitzbank?", + "fr": "Quelle est la couleur de ce banc ?" + }, + "freeform": { + "key": "colour" + }, + "mappings": [ + { + "if": { + "and": [ + "colour=brown" + ] + }, + "then": { + "en": "Colour: brown", + "de": "Farbe: braun", + "fr": "Couleur : marron" + } + }, + { + "if": { + "and": [ + "colour=green" + ] + }, + "then": { + "en": "Colour: green", + "de": "Farbe: grün", + "fr": "Couleur : verte" + } + }, + { + "if": { + "and": [ + "colour=gray" + ] + }, + "then": { + "en": "Colour: gray", + "de": "Farbe: grau", + "fr": "Couleur : gris" + } + }, + { + "if": { + "and": [ + "colour=white" + ] + }, + "then": { + "en": "Colour: white", + "de": "Farbe: weiß", + "fr": "Couleur : blanc" + } + }, + { + "if": { + "and": [ + "colour=red" + ] + }, + "then": { + "en": "Colour: red", + "de": "Farbe: rot", + "fr": "Couleur : rouge" + } + }, + { + "if": { + "and": [ + "colour=black" + ] + }, + "then": { + "en": "Colour: black", + "de": "Farbe: schwarz", + "fr": "Couleur : noire" + } + }, + { + "if": { + "and": [ + "colour=blue" + ] + }, + "then": { + "en": "Colour: blue", + "de": "Farbe: blau", + "fr": "Couleur : bleu" + } + }, + { + "if": { + "and": [ + "colour=yellow" + ] + }, + "then": { + "en": "Colour: yellow", + "de": "Farbe: gelb", + "fr": "Couleur : jaune" + } + } + ] + } + ], + "hideUnderlayingFeaturesMinPercentage": 0, + "icon": { + "render": "./assets/themes/benches/bench_poi.svg", + "mappings": [] + }, + "width": { + "render": "8" + }, + "iconSize": { + "render": "35,35,center" + }, + "color": { + "render": "#00f" + }, + "presets": [ + { + "tags": [ + "amenity=bench" + ], + "title": { + "en": "Bench", + "de": "Sitzbank", + "fr": "Banc" + }, + "description": { + "en": "Add a new bench", + "de": "Neue Sitzbank eintragen", + "fr": "Ajouter un nouveau banc" + } + } + ] +} \ No newline at end of file diff --git a/assets/layers/benches/benches_at_pt.json b/assets/layers/benches/benches_at_pt.json new file mode 100644 index 0000000..de2e537 --- /dev/null +++ b/assets/layers/benches/benches_at_pt.json @@ -0,0 +1,92 @@ +{ + "id": "bench_at_pt", + "name": { + "en": "Benches at public transport stops", + "de": "Sitzbänke bei Haltestellen", + "fr": "Bancs des arrêts de transport en commun" + }, + "minzoom": 14, + "overpassTags": { + "or": [ + "bench=yes", + "bench=stand_up_bench" + ] + }, + "title": { + "render": { + "en": "Bench", + "de": "Sitzbank", + "fr": "Banc" + }, + "mappings": [ + { + "if": { + "or": [ + "public_transport=platform", + "railway=platform", + "highway=bus_stop" + ] + }, + "then": { + "en": "Bench at public transport stop", + "de": "Sitzbank bei Haltestelle", + "fr": "Banc d'un arrêt de transport en commun" + } + }, + { + "if": { + "and": [ + "amenity=shelter" + ] + }, + "then": { + "en": "Bench in shelter", + "de": "Sitzbank in Unterstand", + "fr": "Banc dans un abri" + } + } + ] + }, + "tagRenderings": [ + "images", + { + "render": { + "en": "{name}", + "de": "{name}", + "fr": "{name}" + }, + "freeform": { + "key": "name" + } + }, + { + "render": { + "en": "Stand up bench", + "de": "Stehbank", + "fr": "Banc assis debout" + }, + "freeform": { + "key": "bench", + "addExtraTags": [] + }, + "condition": { + "and": [ + "bench=stand_up_bench" + ] + } + } + ], + "hideUnderlayingFeaturesMinPercentage": 0, + "icon": { + "render": "./assets/themes/benches/bench_public_transport.svg" + }, + "width": { + "render": "8" + }, + "iconSize": { + "render": "35,35,center" + }, + "color": { + "render": "#00f" + } +} \ No newline at end of file diff --git a/assets/layers/benches/picnic_tables.json b/assets/layers/benches/picnic_tables.json new file mode 100644 index 0000000..02531a4 --- /dev/null +++ b/assets/layers/benches/picnic_tables.json @@ -0,0 +1,78 @@ +{ + "id": "picnic_tables", + "name": { + "en": "Picnic tables" + }, + "minzoom": 12, + "overpassTags": { + "and": [ + "leisure=picnic_table" + ] + }, + "title": { + "render": { + "en": "Picnic table" + } + }, + "description": { + "en": "The layer showing picnic tables" + }, + "tagRenderings": [ + { + "question": { + "en": "What material is this picnic table made of?" + }, + "render": { + "en": "This picnic table is made of {material}" + }, + "freeform": { + "key": "material" + }, + "mappings": [ + { + "if": { + "and": [ + "material=wood" + ] + }, + "then": { + "en": "This is a wooden picnic table" + } + } + ] + } + ], + "hideUnderlayingFeaturesMinPercentage": 0, + "icon": { + "render": "circle:#e6cf39;./assets/layers/benches/picnic_table.svg" + }, + "width": { + "render": "8" + }, + "iconSize": { + "render": "35,35,center" + }, + "color": { + "render": "#00f" + }, + "presets": [ + { + "tags": [ + "leisure=picnic_table" + ], + "title": { + "en": "Picnic table" + } + }, + { + "tags": [ + "leisure=picnic_table", + "material=wood" + ], + "title": { + "en": "Wooden picnic table" + } + } + ], + "wayHandling": 1 +} \ No newline at end of file diff --git a/assets/themes/benches/benches.json b/assets/themes/benches/benches.json index 4e0be4f..e40939f 100644 --- a/assets/themes/benches/benches.json +++ b/assets/themes/benches/benches.json @@ -29,402 +29,7 @@ "widenFactor": 0.05, "socialImage": "", "layers": [ - { - "id": "amenity=bench", - "name": { - "en": "Benches", - "de": "Sitzbänke", - "fr": "Bancs" - }, - "minzoom": 14, - "overpassTags": { - "and": [ - "amenity=bench" - ] - }, - "title": { - "render": { - "en": "Bench", - "de": "Sitzbank", - "fr": "Banc" - }, - "mappings": [] - }, - "tagRenderings": [ - "images", - { - "render": { - "en": "Backrest", - "de": "Rückenlehne", - "fr": "Dossier" - }, - "freeform": { - "key": "backrest", - "addExtraTags": [] - }, - "mappings": [ - { - "if": { - "and": [ - "backrest=yes" - ] - }, - "then": { - "en": "Backrest: Yes", - "de": "Rückenlehne: Ja", - "fr": "Dossier: Oui" - } - }, - { - "if": { - "and": [ - "backrest=no" - ] - }, - "then": { - "en": "Backrest: No", - "de": "Rückenlehne: Nein", - "fr": "Dossier: Non" - } - } - ], - "question": { - "en": "Does this bench have a backrest?", - "de": "Hat diese Bank eine Rückenlehne?", - "fr": "Ce banc dispose-t-il d'un dossier ?" - } - }, - { - "render": { - "en": "{seats} seats", - "de": "{seats} Sitzplätze", - "fr": "{seats} places" - }, - "freeform": { - "key": "seats", - "type": "nat" - }, - "mappings": [], - "question": { - "en": "How many seats does this bench have?", - "de": "Wie viele Sitzplätze hat diese Bank?", - "fr": "De combien de places dispose ce banc ?" - } - }, - { - "render": { - "en": "Material: {material}", - "de": "Material: {material}", - "fr": "Matériau : {material}" - }, - "freeform": { - "key": "material", - "addExtraTags": [] - }, - "mappings": [ - { - "if": { - "and": ["material=wood"] - }, - "then": { - "en": "Material: wood", - "de": "Material: Holz", - "fr": "Matériau : bois" - } - }, - { - "if": { - "and": ["material=metal"] - }, - "then": { - "en": "Material: metal", - "de": "Material: Metall", - "fr": "Matériau : métal" - } - }, - { - "if": { - "and": ["material=stone"] - }, - "then": { - "en": "Material: stone", - "de": "Material: Stein", - "fr": "Matériau: pierre" - } - }, - { - "if": { - "and": ["material=concrete"] - }, - "then": { - "en": "Material: concrete", - "de": "Material: Beton", - "fr": "Matériau : béton" - } - }, - { - "if": { - "and": ["material=plastic"] - }, - "then": { - "en": "Material: plastic", - "de": "Material: Kunststoff", - "fr": "Matériau : plastique" - } - }, - { - "if": { - "and": ["material=steel"] - }, - "then": { - "en": "Material: steel", - "de": "Material: Stahl", - "fr": "Matériau : acier" - } - } - ], - "question": { - "en": "What is the bench (seating) made from?", - "de": "Aus welchem Material besteht die Sitzbank (Sitzfläche)?", - "fr": "De quel matériau ce banc est-il fait ?" - } - }, - { - "question": { - "en": "In which direction are you looking when sitting on the bench?", - "de": "In welche Richtung schaut man, wenn man auf der Bank sitzt?" - }, - "render": { - "en": "When sitting on the bench, one looks towards {direction}°.", - "de": "Wenn man auf der Bank sitzt, schaut man in Richtung {direction}°." - }, - "freeform": { - "key": "direction", - "type": "direction" - } - }, - { - "render": { - "en": "Colour: {colour}", - "de": "Farbe: {colour}", - "fr": "Couleur : {colour}" - }, - "question": { - "en": "Which colour does this bench have?", - "de": "Welche Farbe hat diese Sitzbank?", - "fr": "Quelle est la couleur de ce banc ?" - }, - "freeform": { - "key": "colour" - }, - "mappings": [ - { - "if": { - "and": ["colour=brown"] - }, - "then": { - "en": "Colour: brown", - "de": "Farbe: braun", - "fr": "Couleur : marron" - } - }, - { - "if": { - "and": ["colour=green"] - }, - "then": { - "en": "Colour: green", - "de": "Farbe: grün", - "fr": "Couleur : verte" - } - }, - { - "if": { - "and": ["colour=gray"] - }, - "then": { - "en": "Colour: gray", - "de": "Farbe: grau", - "fr": "Couleur : gris" - } - }, - { - "if": { - "and": ["colour=white"] - }, - "then": { - "en": "Colour: white", - "de": "Farbe: weiß", - "fr": "Couleur : blanc" - } - }, - { - "if": { - "and": ["colour=red"] - }, - "then": { - "en": "Colour: red", - "de": "Farbe: rot", - "fr": "Couleur : rouge" - } - }, - { - "if": { - "and": ["colour=black"] - }, - "then": { - "en": "Colour: black", - "de": "Farbe: schwarz", - "fr": "Couleur : noire" - } - }, - { - "if": { - "and": ["colour=blue"] - }, - "then": { - "en": "Colour: blue", - "de": "Farbe: blau", - "fr": "Couleur : bleu" - } - }, - { - "if": { - "and": ["colour=yellow"] - }, - "then": { - "en": "Colour: yellow", - "de": "Farbe: gelb", - "fr": "Couleur : jaune" - } - } - ] - } - ], - "hideUnderlayingFeaturesMinPercentage": 0, - "icon": { - "render": "./assets/themes/benches/bench_poi.svg", - "mappings": [] - }, - "width": { - "render": "8" - }, - "iconSize": { - "render": "30,30,center" - }, - "color": { - "render": "#00f" - }, - "presets": [ - { - "tags": [ - "amenity=bench" - ], - "title": { - "en": "Bench", - "de": "Sitzbank", - "fr": "Banc" - }, - "description": { - "en": "Add a new bench", - "de": "Neue Sitzbank eintragen", - "fr": "Ajouter un nouveau banc" - } - } - ] - }, - { - "id": "bench=yes", - "name": { - "en": "Benches at public transport stops", - "de": "Sitzbänke bei Haltestellen", - "fr": "Bancs des arrêts de transport en commun" - }, - "minzoom": 14, - "overpassTags": { - "or": [ - "bench=yes", - "bench=stand_up_bench" - ] - }, - "title": { - "render": { - "en": "Bench", - "de": "Sitzbank", - "fr": "Banc" - }, - "mappings": [ - { - "if": { - "or": [ - "public_transport=platform", - "railway=platform", - "highway=bus_stop" - ] - }, - "then": { - "en": "Bench at public transport stop", - "de": "Sitzbank bei Haltestelle", - "fr": "Banc d'un arrêt de transport en commun" - } - }, - { - "if": { - "and": [ - "amenity=shelter" - ] - }, - "then": { - "en": "Bench in shelter", - "de": "Sitzbank in Unterstand", - "fr": "Banc dans un abri" - } - } - ] - }, - "tagRenderings": [ - "images", - { - "render": { - "en": "{name}", - "de": "{name}", - "fr": "{name}" - }, - "freeform": { - "key": "name" - } - }, - { - "render": { - "en": "Stand up bench", - "de": "Stehbank", - "fr": "Banc assis debout" - }, - "freeform": { - "key": "bench", - "addExtraTags": [] - }, - "condition": { - "and": [ - "bench=stand_up_bench" - ] - } - } - ], - "hideUnderlayingFeaturesMinPercentage": 0, - "icon": { - "render": "./assets/themes/benches/bench_public_transport.svg" - }, - "width": { - "render": "8" - }, - "iconSize": { - "render": "30,30,center" - }, - "color": { - "render": "#00f" - } - } + "bench","bench_at_pt","picnic_tables" ], "roamingRenderings": [] }