From 982ba2f6d6d8a5ad7a58f8ffe1663e2544a4c0c7 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Thu, 31 Dec 2020 21:09:22 +0100 Subject: [PATCH] Add playgrounds --- Customizations/AllKnownLayouts.ts | 4 +- Logic/MetaTagging.ts | 8 +- State.ts | 1 - UI/SpecialVisualizations.ts | 7 +- assets/themes/playgrounds/playgrounds.json | 172 +++++++++++++++++++++ 5 files changed, 183 insertions(+), 9 deletions(-) create mode 100644 assets/themes/playgrounds/playgrounds.json diff --git a/Customizations/AllKnownLayouts.ts b/Customizations/AllKnownLayouts.ts index 0b5837b..e1d0889 100644 --- a/Customizations/AllKnownLayouts.ts +++ b/Customizations/AllKnownLayouts.ts @@ -18,6 +18,7 @@ import * as drinking_water from "../assets/themes/drinking_water/drinking_water. import * as climbing from "../assets/themes/climbing/climbing.json" import * as surveillance_cameras from "../assets/themes/surveillance_cameras/surveillance_cameras.json" import * as personal from "../assets/themes/personalLayout/personalLayout.json" +import * as playgrounds from "../assets/themes/playgrounds/playgrounds.json" import LayerConfig from "./JSON/LayerConfig"; import LayoutConfig from "./JSON/LayoutConfig"; import SharedLayers from "./SharedLayers"; @@ -63,7 +64,8 @@ export class AllKnownLayouts { new LayoutConfig(buurtnatuur), new LayoutConfig(bike_monitoring_stations), new LayoutConfig(surveillance_cameras), - new LayoutConfig(climbing) + new LayoutConfig(climbing), + new LayoutConfig(playgrounds) ]; diff --git a/Logic/MetaTagging.ts b/Logic/MetaTagging.ts index 785fe43..f737709 100644 --- a/Logic/MetaTagging.ts +++ b/Logic/MetaTagging.ts @@ -99,7 +99,7 @@ export default class MetaTagging { } }, {tag_key: "opening_hours"}); // AUtomatically triggered on the next change - const updateTags = () => { + const updateTags = () => { const oldValueIsOpen = tags["_isOpen"]; tags["_isOpen"] = oh.getState() ? "yes" : "no"; const comment = oh.getComment(); @@ -112,14 +112,14 @@ export default class MetaTagging { } const nextChange = oh.getNextChange(); - if (nextChange !== undefined) { + if (nextChange !== undefined) { window.setTimeout( updateTags, (nextChange.getTime() - (new Date()).getTime()) ) } } - updateTags(); + updateTags(); }catch(e){ console.error(e); tags["_isOpen"] = "parse_error"; @@ -280,7 +280,7 @@ export default class MetaTagging { try { metatag.addMetaTags(features); } catch (e) { - console.error("Could not calculate metatag ", metatag.keys.join(","), ":", e) + console.error("Could not calculate metatag for ", metatag.keys.join(","), ":", e) } } diff --git a/State.ts b/State.ts index 89e9f53..19fec59 100644 --- a/State.ts +++ b/State.ts @@ -25,7 +25,6 @@ export default class State { // The singleton of the global state public static state: State; - public static vNumber = "0.2.5g"; // The user journey states thresholds when a new feature gets unlocked public static userJourney = { diff --git a/UI/SpecialVisualizations.ts b/UI/SpecialVisualizations.ts index b40b024..6cbe3fd 100644 --- a/UI/SpecialVisualizations.ts +++ b/UI/SpecialVisualizations.ts @@ -163,13 +163,14 @@ export default class SpecialVisualizations { { funcName: "reviews", docs: "Adds an overview of the mangrove-reviews of this object. IMPORTANT: the _name_ of the object should be defined for this to work!", - args: [], + args: [{name:"subject", doc:"The identifier used for this value; by default the name of the reviewed object"}], constr: (tags, args) => { const tgs = tags.data; - if (tgs.name === undefined || tgs.name === "") { + const subject = args[0] ?? tgs.name ?? ""; + if (subject === "") { return Translations.t.reviews.name_required; } - const mangrove = MangroveReviews.Get(Number(tgs._lon), Number(tgs._lat), tgs.name, + const mangrove = MangroveReviews.Get(Number(tgs._lon), Number(tgs._lat),subject, State.state.mangroveIdentity, State.state.osmConnection._dryRun ); diff --git a/assets/themes/playgrounds/playgrounds.json b/assets/themes/playgrounds/playgrounds.json new file mode 100644 index 0000000..45ba784 --- /dev/null +++ b/assets/themes/playgrounds/playgrounds.json @@ -0,0 +1,172 @@ +{ + "id": "playgrounds", + "title": { + "nl": "Speelzones" + }, + "shortDescription": { + "nl": "Speelzones en speeltuinen" + }, + "description": { + "nl": "Deze kaart toont speelzones in het groen" + }, + "language": [ + "nl" + ], + "maintainer": "", + "icon": "https://upload.wikimedia.org/wikipedia/commons/0/00/Map_icons_by_Scott_de_Jonge_-_playground.svg", + "version": "0", + "startLat": 50.535, + "startLon": 4.399, + "startZoom": 10, + "widenFactor": 0.05, + "socialImage": "", + "hideInoverview": true, + "layers": [ + { + "id": "playgrounds", + "name": { + "nl": "Speeltuinen" + }, + "minzoom": 14, + "overpassTags": { + "and": [ + "leisure=playground" + ] + }, + "title": { + "render": { + "nl": "Speeltuin" + }, + "mappings": [ + { + "if": { + "and": [ + "name~*" + ] + }, + "then": { + "nl": "Speeltuin {name}" + } + } + ] + }, + "description": { + "nl": "Alle speeltuinen" + }, + "tagRenderings": [ + "images", + { + "question": { + "nl": "Is deze speeltuin toegankelijk voor rolstoelgebruikers?" + }, + "mappings": [ + { + "if": { + "and": [ + "wheelchair=yes" + ] + }, + "then": { + "nl": "Geheel toegankelijk voor rolstoelgebruikers" + } + }, + { + "if": { + "and": [ + "wheelchair=limited" + ] + }, + "then": { + "nl": "Beperkt toegankelijk voor rolstoelgebruikers" + } + }, + { + "if": { + "and": [ + "wheelchair=no" + ] + }, + "then": { + "nl": "Niet toegankelijk voor rolstoelgebruikers" + } + } + ] + }, + { + "freeform": { + "key": "opening_hours", + "type": "opening_hours" + }, + "question": { + "nl": "Op welke uren is deze speeltuin toegankelijk?" + }, + "mappings": [ + { + "if": { + "and": [ + "opening_hours=sunrise-sunset" + ] + }, + "then": { + "nl": "Van zonsopgang tot zonsondergang" + } + } + ] + }, + { + "render": { + "nl": "Toegankelijk vanaf {min_age} jaar oud" + }, + "question": { + "nl": "Wat is de minimale leeftijd om op deze speeltuin te mogen?" + }, + "freeform": { + "key": "min_age", + "type": "pnat" + } + }, + { + "render": { + "nl": "Toegankelijk tot {max_age}" + }, + "question": { + "nl": "Wat is de maximaal toegestane leeftijd voor deze speeltuin?" + }, + "freeform": { + "key": "max_age", + "type": "pnat" + } + }, + "questions", + { + "render": "{reviews(leisure=playground)}" + } + ], + "hideUnderlayingFeaturesMinPercentage": 0, + "icon": { + "render": "https://upload.wikimedia.org/wikipedia/commons/0/00/Map_icons_by_Scott_de_Jonge_-_playground.svg" + }, + "width": { + "render": "3" + }, + "iconSize": { + "render": "40,40,center" + }, + "color": { + "render": "#0c3" + }, + "presets": [ + { + "tags": [ + "leisure=playground" + ], + "title": { + "nl": "Speeltuin" + } + } + ], + "wayHandling": 2 + } + ], + "roamingRenderings": [] +} \ No newline at end of file