Use new layerConfig in themes

This commit is contained in:
pietervdvn 2021-03-21 01:49:08 +01:00
parent 878cb6d47d
commit 75deed8097
12 changed files with 221 additions and 198 deletions

View file

@ -32,24 +32,6 @@ import AllKnownLayers from "./AllKnownLayers";
export class AllKnownLayouts {
public static allLayers: Map<string, LayerConfig> = undefined;
private static GenerateCycloFix(): LayoutConfig {
const layout = new LayoutConfig(cyclofix)
const now = new Date();
const m = now.getMonth() + 1;
const day = new Date().getDate() + 1;
const date = day + "/" + m;
if (date === "31/10" || date === "1/11" || date === "2/11") {
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(
AllKnownLayers.sharedLayers.get("ghost_bike")
);
}
return layout;
}
public static layoutsList: LayoutConfig[] = [
new LayoutConfig(personal),
AllKnownLayouts.GenerateCycloFix(),
@ -74,15 +56,31 @@ export class AllKnownLayouts {
new LayoutConfig(climbing),
new LayoutConfig(playgrounds),
new LayoutConfig(trees),
new LayoutConfig(campersites),
new LayoutConfig(play_forests) ,
new LayoutConfig(campersites),
new LayoutConfig(play_forests),
new LayoutConfig(speelplekken),
new LayoutConfig(sport_pitches)
];
public static allSets: Map<string, LayoutConfig> = AllKnownLayouts.AllLayouts();
private static GenerateCycloFix(): LayoutConfig {
const layout = new LayoutConfig(cyclofix)
const now = new Date();
const m = now.getMonth() + 1;
const day = new Date().getDate() + 1;
const date = day + "/" + m;
if (date === "31/10" || date === "1/11" || date === "2/11") {
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(
AllKnownLayers.sharedLayers.get("ghost_bike")
);
}
return layout;
}
private static AllLayouts(): Map<string, LayoutConfig> {
this.allLayers = new Map<string, LayerConfig>();
for (const layout of this.layoutsList) {
@ -90,7 +88,7 @@ export class AllKnownLayouts {
let layer = layout.layers[i];
if (typeof (layer) === "string") {
layer = layout.layers[i] = AllKnownLayers.sharedLayers.get(layer);
if(layer === undefined){
if (layer === undefined) {
console.log("Defined layers are ", AllKnownLayers.sharedLayers.keys())
throw `Layer ${layer} was not found or defined - probably a type was made`
}

View file

@ -12,8 +12,8 @@
"icon": "./assets/themes/aed/logo.svg",
"description": {
"en": "On this map, one can find and mark nearby defibrillators",
"ca": "En aquest mapa , qualsevol pot trobar i marcar els desfibril·ladors externs automàtics més propers",
"es": "En este mapa , cualquiera puede encontrar y marcar los desfibriladores externos automáticos más cercanos",
"ca": "En aquest mapa , qualsevol pot trobar i marcar els desfibril·ladors externs automàtics més propers",
"es": "En este mapa , cualquiera puede encontrar y marcar los desfibriladores externos automáticos más cercanos",
"fr": "Sur cette carte, vous pouvez trouver et améliorer les informations sur les défibrillateurs",
"nl": "Op deze kaart kan je informatie over AEDs vinden en verbeteren",
"de": "Auf dieser Karte kann man nahe gelegene Defibrillatoren finden und markieren"
@ -41,7 +41,9 @@
"nl": "Defibrillatoren",
"de": "Defibrillatoren"
},
"overpassTags": "emergency=defibrillator",
"source": {
"osmTags": "emergency=defibrillator"
},
"minzoom": 12,
"title": {
"render": {
@ -75,8 +77,8 @@
{
"question": {
"en": "Is this defibrillator located indoors?",
"ca": "Està el desfibril·lador a l'interior?",
"es": "¿Esté el desfibrilador en interior?",
"ca": "Està el desfibril·lador a l'interior?",
"es": "¿Esté el desfibrilador en interior?",
"fr": "Ce défibrillateur est-il disposé en intérieur ?",
"nl": "Hangt deze defibrillator binnen of buiten?",
"de": "Befindet sich dieser Defibrillator im Gebäude?"

View file

@ -33,7 +33,9 @@
"fr": "Œuvres d'art",
"de": "Kunstwerke"
},
"overpassTags": "tourism=artwork",
"source": {
"osmTags": "tourism=artwork"
},
"title": {
"render": {
"en": "Artwork",

View file

@ -34,11 +34,13 @@
"nl": "Natuurgebied"
},
"minzoom": 12,
"overpassTags": {
"or": [
"leisure=nature_reserve",
"boundary=protected_area"
]
"source": {
"osmTags": {
"or": [
"leisure=nature_reserve",
"boundary=protected_area"
]
}
},
"title": {
"render": {
@ -131,11 +133,13 @@
"nl": "Park"
},
"minzoom": 12,
"overpassTags": {
"or": [
"leisure=park",
"landuse=village_green"
]
"source": {
"osmTags": {
"or": [
"leisure=park",
"landuse=village_green"
]
}
},
"title": {
"render": {
@ -215,12 +219,14 @@
"nl": "Bos"
},
"minzoom": 12,
"overpassTags": {
"or": [
"landuse=forest",
"natural=wood",
"natural=scrub"
]
"source": {
"osmTags": {
"or": [
"landuse=forest",
"natural=wood",
"natural=scrub"
]
}
},
"title": {
"render": {
@ -330,7 +336,9 @@
},
"freeform": {
"key": "access:description",
"addExtraTags": ["access="]
"addExtraTags": [
"access="
]
},
"mappings": [
{
@ -499,7 +507,7 @@
]
}
},
{
{
"#": "Non-editable description {description}",
"render": {
"nl": "Extra info: <i>{description}</i>"

View file

@ -1,4 +1,3 @@
{
"id": "campersite",
"title": {
@ -28,13 +27,15 @@
"en": "Camper sites"
},
"minzoom": 10,
"overpassTags": {
"and": [
"tourism=caravan_site",
"permanent_camping!~only"
]
"source": {
"osmTags": {
"and": [
"tourism=caravan_site",
"permanent_camping!~only"
]
}
},
"title": {
"title": {
"render": {
"en": "Camper site {name}"
},
@ -56,7 +57,7 @@
},
"tagRenderings": [
"images",
{
{
"render": {
"en": "This place is called {name}"
},
@ -67,7 +68,7 @@
"key": "name"
}
},
{
{
"question": {
"en": "Does this place charge a fee?"
},
@ -85,17 +86,18 @@
{
"if": {
"and": [
"fee=no","charge="
"fee=no",
"charge="
]
},
"then": {
"en": "Can be used for free"
}
},
{
"if": "fee=no",
"then": "Can be used for free",
"hideInAnswer":true
},
{
"if": "fee=no",
"then": "Can be used for free",
"hideInAnswer": true
}
]
},
@ -169,17 +171,17 @@
"en": "There is internet access"
}
},
{
{
"if": {
"or": [
"internet_access=wifi",
"internet_access=wlan"
"internet_access=wlan"
]
},
"then": {
"en": "There is internet access"
},
"hideInAnswer": true
"hideInAnswer": true
},
{
"if": {
@ -252,7 +254,7 @@
}
]
},
{
{
"render": {
"en": "Official website: <a href='{website}'>{website}</a>"
},
@ -264,7 +266,7 @@
"en": "Does this place have a website?"
}
},
{
{
"question": {
"en": "Does this place offer spots for long term rental?"
},
@ -301,7 +303,7 @@
}
]
},
{
{
"render": {
"en": "More details about this place: {description}"
},
@ -314,7 +316,7 @@
}
},
"questions",
"reviews"
"reviews"
],
"hideUnderlayingFeaturesMinPercentage": 0,
"icon": {
@ -360,11 +362,13 @@
"en": "Sanitary dump stations"
},
"minzoom": 10,
"overpassTags": {
"and": [
"amenity=sanitary_dump_station",
"vehicle!~no"
]
"source": {
"osmTags": {
"and": [
"amenity=sanitary_dump_station",
"vehicle!~no"
]
}
},
"title": {
"render": {
@ -601,43 +605,43 @@
}
],
"roamingRenderings": [
{
"render": {
"en": "This place is operated by {operator}"
{
"render": {
"en": "This place is operated by {operator}"
},
"question": {
"en": "Who operates this place?"
},
"freeform": {
"key": "operator"
}
},
{
"question": {
"en": "Does this place have a power supply?"
},
"mappings": [
{
"if": {
"and": [
"power_supply=yes"
]
},
"question": {
"en": "Who operates this place?"
},
"freeform": {
"key": "operator"
"then": {
"en": "This place has a power supply"
}
},
{
"question": {
"en": "Does this place have a power supply?"
{
"if": {
"and": [
"power_supply=no"
]
},
"mappings": [
{
"if": {
"and": [
"power_supply=yes"
]
},
"then": {
"en": "This place has a power supply"
}
},
{
"if": {
"and": [
"power_supply=no"
]
},
"then": {
"en": "This place does not have power supply"
}
}
]
"then": {
"en": "This place does not have power supply"
}
}
]
]
}
]
}

View file

@ -27,10 +27,12 @@
"en": "Charging stations"
},
"minzoom": 10,
"overpassTags": {
"and": [
"amenity=charging_station"
]
"source": {
"osmTags": {
"and": [
"amenity=charging_station"
]
}
},
"title": {
"render": {

View file

@ -37,21 +37,23 @@
"en": "Climbing club"
},
"minzoom": 10,
"overpassTags": {
"or": [
"club=climbing",
{
"and": [
"sport=climbing",
{
"or": [
"office~*",
"club~*"
]
}
]
}
]
"source": {
"osmTags": {
"or": [
"club=climbing",
{
"and": [
"sport=climbing",
{
"or": [
"office~*",
"club~*"
]
}
]
}
]
}
},
"title": {
"render": {
@ -160,11 +162,13 @@
"nl": "Klimzalen"
},
"minzoom": 10,
"overpassTags": {
"and": [
"sport=climbing",
"leisure=sports_centre"
]
"source": {
"osmTags": {
"and": [
"sport=climbing",
"leisure=sports_centre"
]
}
},
"title": {
"render": {
@ -190,7 +194,8 @@
"tagRenderings": [
"images",
"questions",
{"#": "name",
{
"#": "name",
"render": {
"en": "<strong>{name}</strong>",
"nl": "<strong>{name}</strong>",
@ -236,10 +241,12 @@
"nl": "Klimroute"
},
"minzoom": 18,
"overpassTags": {
"and": [
"climbing=route"
]
"source": {
"osmTags": {
"and": [
"climbing=route"
]
}
},
"title": {
"render": {
@ -339,14 +346,16 @@
"en": "Climbing opportunities"
},
"minzoom": 10,
"overpassTags": {
"and": [
"sport=climbing",
"climbing!~route",
"leisure!~sports_centre",
"climbing!=route_top",
"climbing!=route_bottom"
]
"source": {
"osmTags": {
"and": [
"sport=climbing",
"climbing!~route",
"leisure!~sports_centre",
"climbing!=route_top",
"climbing!=route_bottom"
]
}
},
"title": {
"render": {
@ -363,7 +372,8 @@
"tagRenderings": [
"images",
"questions",
{"#": "name",
{
"#": "name",
"render": {
"en": "<strong>{name}</strong>",
"nl": "<strong>{name}</strong>",
@ -435,15 +445,17 @@
"en": "Climbing opportunities?"
},
"minzoom": 19,
"overpassTags": {
"or": [
"leisure=sports_centre",
"barrier=wall",
"barrier=retaining_wall",
"natural=cliff",
"natural=rock",
"natural=stone"
]
"source": {
"osmTags": {
"or": [
"leisure=sports_centre",
"barrier=wall",
"barrier=retaining_wall",
"natural=cliff",
"natural=rock",
"natural=stone"
]
}
},
"title": {
"render": {

View file

@ -96,11 +96,13 @@
"nl": "Fietsstraten"
},
"minzoom": 9,
"overpassTags": {
"and": [
"cyclestreet=yes",
"traffic_sign="
]
"source": {
"osmTags": {
"and": [
"cyclestreet=yes",
"traffic_sign="
]
}
},
"description": {
"nl": "Een fietsstraat is een straat waar gemotoriseerd verkeer een fietser niet mag inhalen."
@ -123,7 +125,9 @@
},
"minzoom": 9,
"wayHandling": 0,
"overpassTags": "proposed:cyclestreet=yes",
"source": {
"osmTags": "proposed:cyclestreet=yes"
},
"title": {
"render": {
"nl": "Toekomstige fietsstraat"
@ -152,7 +156,9 @@
"description": {
"nl": "Laag waar je een straat als fietsstraat kan markeren"
},
"overpassTags": "highway~residential|tertiary|unclassified",
"source": {
"osmTags": "highway~residential|tertiary|unclassified"
},
"minzoom": 18,
"wayHandling": 0,
"title": {

View file

@ -27,10 +27,12 @@
"fr": "Friteries"
},
"minzoom": 8,
"overpassTags": {
"and": [
"cuisine~.*friture.*"
]
"source": {
"osmTags": {
"and": [
"cuisine~.*friture.*"
]
}
},
"title": {
"render": {

View file

@ -32,10 +32,12 @@
"fr": "Magasin"
},
"minzoom": 16,
"overpassTags": {
"and": [
"shop~*"
]
"source": {
"osmTags": {
"and": [
"shop~*"
]
}
},
"title": {
"render": {

View file

@ -23,28 +23,13 @@
"widenFactor": 0.05,
"socialImage": "",
"defaultBackgroundId": "CartoDB.Positron",
"layersX": [
"layers": [
"play_forest",
"playground",
"sport_pitch",
"slow_roads",
"grass_in_parks",
"village_green"
],
"layers": [
{
"id": "test",
"source": {
"osmTags": "country~*",
"geoJsonSource": "https://pietervdvn.github.io/latlon2country/15.10774.14922.json"
},
"maxOverlapPercentage": 0,
"name": "test",
"title": "Test",
"minzoom": 0,
"maxzoom": 14
}
],
"roamingRenderings": []

View file

@ -13,14 +13,12 @@
"nl"
],
"hideFromOverview": true,
"enableUserBadge": false,
"enableShareScreen":false,
"enableShareScreen": false,
"enableMoreQuests": false,
"enableLayers":false,
"enableLayers": false,
"enableSearch": false,
"enableGeolocation":false,
"enableGeolocation": false,
"maintainer": "",
"icon": "./assets/themes/widths/icon.svg",
"version": "0",
@ -36,10 +34,12 @@
"nl": "Straten met een breedte"
},
"minzoom": 14,
"overpassTags": {
"and": [
"width:carriageway~*"
]
"source": {
"osmTags": {
"and": [
"width:carriageway~*"
]
}
},
"titleIcons": [],
"title": {