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 { export class AllKnownLayouts {
public static allLayers: Map<string, LayerConfig> = undefined; 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[] = [ public static layoutsList: LayoutConfig[] = [
new LayoutConfig(personal), new LayoutConfig(personal),
AllKnownLayouts.GenerateCycloFix(), AllKnownLayouts.GenerateCycloFix(),
@ -74,15 +56,31 @@ export class AllKnownLayouts {
new LayoutConfig(climbing), new LayoutConfig(climbing),
new LayoutConfig(playgrounds), new LayoutConfig(playgrounds),
new LayoutConfig(trees), new LayoutConfig(trees),
new LayoutConfig(campersites), new LayoutConfig(campersites),
new LayoutConfig(play_forests) , new LayoutConfig(play_forests),
new LayoutConfig(speelplekken), new LayoutConfig(speelplekken),
new LayoutConfig(sport_pitches) new LayoutConfig(sport_pitches)
]; ];
public static allSets: Map<string, LayoutConfig> = AllKnownLayouts.AllLayouts(); 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> { private static AllLayouts(): Map<string, LayoutConfig> {
this.allLayers = new Map<string, LayerConfig>(); this.allLayers = new Map<string, LayerConfig>();
for (const layout of this.layoutsList) { for (const layout of this.layoutsList) {
@ -90,7 +88,7 @@ export class AllKnownLayouts {
let layer = layout.layers[i]; let layer = layout.layers[i];
if (typeof (layer) === "string") { if (typeof (layer) === "string") {
layer = layout.layers[i] = AllKnownLayers.sharedLayers.get(layer); layer = layout.layers[i] = AllKnownLayers.sharedLayers.get(layer);
if(layer === undefined){ if (layer === undefined) {
console.log("Defined layers are ", AllKnownLayers.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

@ -12,8 +12,8 @@
"icon": "./assets/themes/aed/logo.svg", "icon": "./assets/themes/aed/logo.svg",
"description": { "description": {
"en": "On this map, one can find and mark nearby defibrillators", "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", "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", "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", "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", "nl": "Op deze kaart kan je informatie over AEDs vinden en verbeteren",
"de": "Auf dieser Karte kann man nahe gelegene Defibrillatoren finden und markieren" "de": "Auf dieser Karte kann man nahe gelegene Defibrillatoren finden und markieren"
@ -41,7 +41,9 @@
"nl": "Defibrillatoren", "nl": "Defibrillatoren",
"de": "Defibrillatoren" "de": "Defibrillatoren"
}, },
"overpassTags": "emergency=defibrillator", "source": {
"osmTags": "emergency=defibrillator"
},
"minzoom": 12, "minzoom": 12,
"title": { "title": {
"render": { "render": {
@ -75,8 +77,8 @@
{ {
"question": { "question": {
"en": "Is this defibrillator located indoors?", "en": "Is this defibrillator located indoors?",
"ca": "Està el desfibril·lador a l'interior?", "ca": "Està el desfibril·lador a l'interior?",
"es": "¿Esté el desfibrilador en interior?", "es": "¿Esté el desfibrilador en interior?",
"fr": "Ce défibrillateur est-il disposé en intérieur ?", "fr": "Ce défibrillateur est-il disposé en intérieur ?",
"nl": "Hangt deze defibrillator binnen of buiten?", "nl": "Hangt deze defibrillator binnen of buiten?",
"de": "Befindet sich dieser Defibrillator im Gebäude?" "de": "Befindet sich dieser Defibrillator im Gebäude?"

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -23,28 +23,13 @@
"widenFactor": 0.05, "widenFactor": 0.05,
"socialImage": "", "socialImage": "",
"defaultBackgroundId": "CartoDB.Positron", "defaultBackgroundId": "CartoDB.Positron",
"layersX": [ "layers": [
"play_forest", "play_forest",
"playground", "playground",
"sport_pitch", "sport_pitch",
"slow_roads", "slow_roads",
"grass_in_parks", "grass_in_parks",
"village_green" "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": [] "roamingRenderings": []

View file

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