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(),
@ -75,14 +57,30 @@ export class AllKnownLayouts {
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

@ -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": {

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": {
"osmTags": {
"or": [ "or": [
"leisure=nature_reserve", "leisure=nature_reserve",
"boundary=protected_area" "boundary=protected_area"
] ]
}
}, },
"title": { "title": {
"render": { "render": {
@ -131,11 +133,13 @@
"nl": "Park" "nl": "Park"
}, },
"minzoom": 12, "minzoom": 12,
"overpassTags": { "source": {
"osmTags": {
"or": [ "or": [
"leisure=park", "leisure=park",
"landuse=village_green" "landuse=village_green"
] ]
}
}, },
"title": { "title": {
"render": { "render": {
@ -215,12 +219,14 @@
"nl": "Bos" "nl": "Bos"
}, },
"minzoom": 12, "minzoom": 12,
"overpassTags": { "source": {
"osmTags": {
"or": [ "or": [
"landuse=forest", "landuse=forest",
"natural=wood", "natural=wood",
"natural=scrub" "natural=scrub"
] ]
}
}, },
"title": { "title": {
"render": { "render": {
@ -330,7 +336,9 @@
}, },
"freeform": { "freeform": {
"key": "access:description", "key": "access:description",
"addExtraTags": ["access="] "addExtraTags": [
"access="
]
}, },
"mappings": [ "mappings": [
{ {

View file

@ -1,4 +1,3 @@
{ {
"id": "campersite", "id": "campersite",
"title": { "title": {
@ -28,11 +27,13 @@
"en": "Camper sites" "en": "Camper sites"
}, },
"minzoom": 10, "minzoom": 10,
"overpassTags": { "source": {
"osmTags": {
"and": [ "and": [
"tourism=caravan_site", "tourism=caravan_site",
"permanent_camping!~only" "permanent_camping!~only"
] ]
}
}, },
"title": { "title": {
"render": { "render": {
@ -85,7 +86,8 @@
{ {
"if": { "if": {
"and": [ "and": [
"fee=no","charge=" "fee=no",
"charge="
] ]
}, },
"then": { "then": {
@ -95,7 +97,7 @@
{ {
"if": "fee=no", "if": "fee=no",
"then": "Can be used for free", "then": "Can be used for free",
"hideInAnswer":true "hideInAnswer": true
} }
] ]
}, },
@ -360,11 +362,13 @@
"en": "Sanitary dump stations" "en": "Sanitary dump stations"
}, },
"minzoom": 10, "minzoom": 10,
"overpassTags": { "source": {
"osmTags": {
"and": [ "and": [
"amenity=sanitary_dump_station", "amenity=sanitary_dump_station",
"vehicle!~no" "vehicle!~no"
] ]
}
}, },
"title": { "title": {
"render": { "render": {

View file

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

View file

@ -37,7 +37,8 @@
"en": "Climbing club" "en": "Climbing club"
}, },
"minzoom": 10, "minzoom": 10,
"overpassTags": { "source": {
"osmTags": {
"or": [ "or": [
"club=climbing", "club=climbing",
{ {
@ -52,6 +53,7 @@
] ]
} }
] ]
}
}, },
"title": { "title": {
"render": { "render": {
@ -160,11 +162,13 @@
"nl": "Klimzalen" "nl": "Klimzalen"
}, },
"minzoom": 10, "minzoom": 10,
"overpassTags": { "source": {
"osmTags": {
"and": [ "and": [
"sport=climbing", "sport=climbing",
"leisure=sports_centre" "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": {
"osmTags": {
"and": [ "and": [
"climbing=route" "climbing=route"
] ]
}
}, },
"title": { "title": {
"render": { "render": {
@ -339,7 +346,8 @@
"en": "Climbing opportunities" "en": "Climbing opportunities"
}, },
"minzoom": 10, "minzoom": 10,
"overpassTags": { "source": {
"osmTags": {
"and": [ "and": [
"sport=climbing", "sport=climbing",
"climbing!~route", "climbing!~route",
@ -347,6 +355,7 @@
"climbing!=route_top", "climbing!=route_top",
"climbing!=route_bottom" "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,7 +445,8 @@
"en": "Climbing opportunities?" "en": "Climbing opportunities?"
}, },
"minzoom": 19, "minzoom": 19,
"overpassTags": { "source": {
"osmTags": {
"or": [ "or": [
"leisure=sports_centre", "leisure=sports_centre",
"barrier=wall", "barrier=wall",
@ -444,6 +455,7 @@
"natural=rock", "natural=rock",
"natural=stone" "natural=stone"
] ]
}
}, },
"title": { "title": {
"render": { "render": {

View file

@ -96,11 +96,13 @@
"nl": "Fietsstraten" "nl": "Fietsstraten"
}, },
"minzoom": 9, "minzoom": 9,
"overpassTags": { "source": {
"osmTags": {
"and": [ "and": [
"cyclestreet=yes", "cyclestreet=yes",
"traffic_sign=" "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": {
"osmTags": {
"and": [ "and": [
"cuisine~.*friture.*" "cuisine~.*friture.*"
] ]
}
}, },
"title": { "title": {
"render": { "render": {

View file

@ -32,10 +32,12 @@
"fr": "Magasin" "fr": "Magasin"
}, },
"minzoom": 16, "minzoom": 16,
"overpassTags": { "source": {
"osmTags": {
"and": [ "and": [
"shop~*" "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": {
"osmTags": {
"and": [ "and": [
"width:carriageway~*" "width:carriageway~*"
] ]
}
}, },
"titleIcons": [], "titleIcons": [],
"title": { "title": {