From 9b7f8bfa47ccce94716d33d61fe87bbca3e8cc93 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Sun, 21 Nov 2021 03:48:05 +0100 Subject: [PATCH] Fixes to cyclenode theme --- Models/ThemeConfig/LegacyJsonConvert.ts | 2 +- assets/themes/cyclenodes/cyclenodes.json | 72 +++++++++++++++--------- scripts/lint.ts | 16 ++++-- 3 files changed, 57 insertions(+), 33 deletions(-) diff --git a/Models/ThemeConfig/LegacyJsonConvert.ts b/Models/ThemeConfig/LegacyJsonConvert.ts index 4128e6d919..a3496d0fdf 100644 --- a/Models/ThemeConfig/LegacyJsonConvert.ts +++ b/Models/ThemeConfig/LegacyJsonConvert.ts @@ -29,7 +29,7 @@ export default class LegacyJsonConvert { } } - if (config.mapRendering === undefined && config.id !== "sidewalks") { + if (config.mapRendering === undefined) { config.mapRendering = [] // This is a legacy format, lets create a pointRendering let location: ("point" | "centroid")[] = ["point"] diff --git a/assets/themes/cyclenodes/cyclenodes.json b/assets/themes/cyclenodes/cyclenodes.json index 7dedd64611..e5cc511bf4 100644 --- a/assets/themes/cyclenodes/cyclenodes.json +++ b/assets/themes/cyclenodes/cyclenodes.json @@ -15,12 +15,12 @@ "maintainer": "Sebastian Kürten", "icon": "./assets/themes/cyclenodes/logo.svg", "version": "0", + "hideFromOverview": true, "startLat": 51.755515, "startLon": 14.327545, "startZoom": 11, "widenFactor": 0.05, - "roamingRenderings": [], - "clustering":{ + "clustering": { "maxZoom": 11, "minNeededElements": 1000000 }, @@ -34,7 +34,8 @@ "osmTags": { "and": [ "network=rcn", - "network:type=node_network" + "network:type=node_network", + "route=bicycle" ] } }, @@ -52,12 +53,16 @@ } ] }, - "width": { - "render": "4" - }, - "color": { - "render": "#00a703" - }, + "mapRendering": [ + { + "width": { + "render": "4" + }, + "color": { + "render": "#00a703" + } + } + ], "tagRenderings": [ { "question": { @@ -75,8 +80,10 @@ "if": "survey:date:={_now:date}", "then": "Surveyed today!" } - ] - } + ], + "id": "node2node-survey:date" + }, + "export_as_gpx" ] }, { @@ -86,12 +93,31 @@ }, "source": { "osmTags": { - "or": [ - "network:type=node_network", + "and": [ "rcn_ref~*" ] } }, + "mapRendering": [ + { + "location": [ + "point", + "centroid" + ], + "label": { + "mappings": [ + { + "if": "rcn_ref~*", + "then": "
{rcn_ref}
" + }, + { + "if": "rcn_ref=", + "then": "
?
" + } + ] + } + } + ], "minzoom": 12, "title": { "render": { @@ -99,18 +125,6 @@ "de": "Knotenpunkt" } }, - "label": { - "mappings": [ - { - "if": "rcn_ref~*", - "then": "
{rcn_ref}
" - }, - { - "if": "rcn_ref=", - "then": "
?
" - } - ] - }, "presets": [ { "title": { @@ -147,7 +161,8 @@ "if": "survey:date:={_now:date}", "then": "Surveyed today!" } - ] + ], + "id": "node-survey:date" }, { "question": { @@ -159,10 +174,11 @@ "freeform": { "key": "expected_rcn_route_relations", "type": "int" - } + }, + "id": "node-expected_rcn_route_relations" }, "images" ] } ] -} +} \ No newline at end of file diff --git a/scripts/lint.ts b/scripts/lint.ts index 2d0498971d..587c201a26 100644 --- a/scripts/lint.ts +++ b/scripts/lint.ts @@ -9,12 +9,20 @@ import LegacyJsonConvert from "../Models/ThemeConfig/LegacyJsonConvert"; const layerFiles = ScriptUtils.getLayerFiles(); for (const layerFile of layerFiles) { - LegacyJsonConvert.fixLayerConfig(layerFile.parsed) - writeFileSync(layerFile.path, JSON.stringify(layerFile.parsed, null, " ")) + try { + LegacyJsonConvert.fixLayerConfig(layerFile.parsed) + writeFileSync(layerFile.path, JSON.stringify(layerFile.parsed, null, " ")) + } catch (e) { + console.error("COULD NOT LINT LAYER" + layerFile.path + ":\n\t" + e) + } } const themeFiles = ScriptUtils.getThemeFiles() for (const themeFile of themeFiles) { - LegacyJsonConvert.fixThemeConfig(themeFile.parsed) - writeFileSync(themeFile.path, JSON.stringify(themeFile.parsed, null, " ")) + try { + LegacyJsonConvert.fixThemeConfig(themeFile.parsed) + writeFileSync(themeFile.path, JSON.stringify(themeFile.parsed, null, " ")) + } catch (e) { + console.error("COULD NOT LINT THEME" + themeFile.path + ":\n\t" + e) + } }