Add picnic tables

This commit is contained in:
pietervdvn 2021-02-26 17:22:24 +01:00
parent a91c3fde69
commit 3a944889b5
7 changed files with 523 additions and 410 deletions

View file

@ -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 toilets from "../assets/layers/toilets/toilets.json"
import * as bookcases from "../assets/layers/public_bookcases/public_bookcases.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 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 LayerConfig from "./JSON/LayerConfig";
import {LayerConfigJson} from "./JSON/LayerConfigJson"; import {LayerConfigJson} from "./JSON/LayerConfigJson";
export default class SharedLayers { export default class AllKnownLayers {
private static sharedLayersListRaw : LayerConfigJson[] = [ private static sharedLayersListRaw : LayerConfigJson[] = [
@ -46,17 +49,20 @@ export default class SharedLayers {
toilets, toilets,
bookcases, bookcases,
surveillance_camera, surveillance_camera,
tree_nodes tree_nodes,
benches,
benches_at_pt,
picnic_tables
]; ];
// Must be below the list... // Must be below the list...
public static sharedLayers: Map<string, LayerConfig> = SharedLayers.getSharedLayers(); public static sharedLayers: Map<string, LayerConfig> = AllKnownLayers.getSharedLayers();
public static sharedLayersJson: Map<string, any> = SharedLayers.getSharedLayersJson(); public static sharedLayersJson: Map<string, any> = AllKnownLayers.getSharedLayersJson();
private static getSharedLayers(): Map<string, LayerConfig> { private static getSharedLayers(): Map<string, LayerConfig> {
const sharedLayers = new Map<string, LayerConfig>(); const sharedLayers = new Map<string, LayerConfig>();
for (const layer of SharedLayers.sharedLayersListRaw) { for (const layer of AllKnownLayers.sharedLayersListRaw) {
const parsed = new LayerConfig(layer, "shared_layers") const parsed = new LayerConfig(layer, "shared_layers")
sharedLayers.set(layer.id, parsed); sharedLayers.set(layer.id, parsed);
sharedLayers[layer.id] = parsed; sharedLayers[layer.id] = parsed;
@ -66,7 +72,7 @@ export default class SharedLayers {
private static getSharedLayersJson(): Map<string, any> { private static getSharedLayersJson(): Map<string, any> {
const sharedLayers = new Map<string, any>(); const sharedLayers = new Map<string, any>();
for (const layer of SharedLayers.sharedLayersListRaw) { for (const layer of AllKnownLayers.sharedLayersListRaw) {
sharedLayers.set(layer.id, layer); sharedLayers.set(layer.id, layer);
sharedLayers[layer.id] = layer; sharedLayers[layer.id] = layer;
} }

View file

@ -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 * as bicycle_lib from "../assets/themes/bicycle_library/bicycle_library.json"
import LayerConfig from "./JSON/LayerConfig"; import LayerConfig from "./JSON/LayerConfig";
import LayoutConfig from "./JSON/LayoutConfig"; import LayoutConfig from "./JSON/LayoutConfig";
import SharedLayers from "./SharedLayers"; import AllKnownLayers from "./AllKnownLayers";
export class AllKnownLayouts { export class AllKnownLayouts {
@ -39,7 +39,7 @@ export class AllKnownLayouts {
console.log("The current date is ",date,", which means we remember our dead") console.log("The current date is ",date,", which means we remember our dead")
// Around Halloween/Fiesta de muerte/Allerzielen, we remember the dead // Around Halloween/Fiesta de muerte/Allerzielen, we remember the dead
layout.layers.push( 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++) { for (let i = 0; i < layout.layers.length; i++) {
let layer = layout.layers[i]; let layer = layout.layers[i];
if (typeof (layer) === "string") { if (typeof (layer) === "string") {
layer = layout.layers[i] = SharedLayers.sharedLayers.get(layer); layer = layout.layers[i] = AllKnownLayers.sharedLayers.get(layer);
if(layer === undefined){ 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` throw `Layer ${layer} was not found or defined - probably a type was made`
} }
} }

View file

@ -2,7 +2,7 @@ import {Translation} from "../../UI/i18n/Translation";
import TagRenderingConfig from "./TagRenderingConfig"; import TagRenderingConfig from "./TagRenderingConfig";
import LayerConfig from "./LayerConfig"; import LayerConfig from "./LayerConfig";
import {LayoutConfigJson} from "./LayoutConfigJson"; import {LayoutConfigJson} from "./LayoutConfigJson";
import SharedLayers from "../SharedLayers"; import AllKnownLayers from "../AllKnownLayers";
import SharedTagRenderings from "../SharedTagRenderings"; import SharedTagRenderings from "../SharedTagRenderings";
import {Utils} from "../../Utils"; import {Utils} from "../../Utils";
@ -81,8 +81,8 @@ export default class LayoutConfig {
this.defaultBackgroundId = json.defaultBackgroundId; this.defaultBackgroundId = json.defaultBackgroundId;
this.layers = json.layers.map((layer, i) => { this.layers = json.layers.map((layer, i) => {
if (typeof layer === "string") { if (typeof layer === "string") {
if (SharedLayers.sharedLayers[layer] !== undefined) { if (AllKnownLayers.sharedLayers[layer] !== undefined) {
return SharedLayers.sharedLayers[layer]; return AllKnownLayers.sharedLayers[layer];
} else { } else {
throw "Unkown fixed layer " + layer; throw "Unkown fixed layer " + layer;
} }
@ -91,7 +91,7 @@ export default class LayoutConfig {
if (layer.builtin !== undefined) { if (layer.builtin !== undefined) {
// @ts-ignore // @ts-ignore
const name = layer.builtin; const name = layer.builtin;
const shared = SharedLayers.sharedLayersJson[name]; const shared = AllKnownLayers.sharedLayersJson[name];
if (shared === undefined) { if (shared === undefined) {
throw "Unkown fixed layer " + name; throw "Unkown fixed layer " + name;
} }

View file

@ -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"
}
}
]
}

View file

@ -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"
}
}

View file

@ -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
}

View file

@ -29,402 +29,7 @@
"widenFactor": 0.05, "widenFactor": 0.05,
"socialImage": "", "socialImage": "",
"layers": [ "layers": [
{ "bench","bench_at_pt","picnic_tables"
"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"
}
}
], ],
"roamingRenderings": [] "roamingRenderings": []
} }