From db770f2c358856b4c41061d500bb8b2deec31ee8 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Thu, 10 Feb 2022 23:10:39 +0100 Subject: [PATCH] Fix the last fake images, fix non-square theme icons, throw an error on fake svgs and non-square icons (if public theme) --- assets/layers/bike_cafe/bike_cafe.json | 2 +- assets/layers/bike_cafe/bike_cafe.svg | 53 ++-- .../layers/bike_cleaning/bike_cleaning.json | 5 - assets/layers/bike_shop/bike_shop.json | 4 +- assets/layers/bike_shop/pump.svg | 82 +++--- assets/layers/bike_shop/repair_shop.svg | 57 +++-- assets/layers/bike_shop/shop.svg | 233 ++++-------------- assets/svg/robot.svg | 42 +++- assets/themes/buurtnatuur/buurtnatuur.json | 4 +- assets/themes/buurtnatuur/license_info.json | 10 + assets/themes/buurtnatuur/logo.svg | 38 +++ assets/themes/cyclestreets/cyclestreets.json | 4 +- assets/themes/cyclestreets/license_info.json | 10 + assets/themes/cyclestreets/logo.svg | 131 ++++++++++ assets/themes/grb_import/license_info.json | 8 + assets/themes/grb_import/logo.svg | 79 ++++++ assets/themes/hailhydrant/logo.svg | 180 +++++++++++--- .../mapcomplete-changes.json | 8 +- .../themes/openwindpowermap/license_info.json | 10 + assets/themes/openwindpowermap/logo.svg | 61 +++++ .../openwindpowermap/openwindpowermap.json | 2 +- scripts/ScriptUtils.ts | 16 +- scripts/generateLayerOverview.ts | 10 +- scripts/generateLayouts.ts | 6 +- 24 files changed, 719 insertions(+), 336 deletions(-) create mode 100644 assets/themes/buurtnatuur/logo.svg create mode 100644 assets/themes/cyclestreets/logo.svg create mode 100644 assets/themes/grb_import/logo.svg create mode 100644 assets/themes/openwindpowermap/logo.svg diff --git a/assets/layers/bike_cafe/bike_cafe.json b/assets/layers/bike_cafe/bike_cafe.json index 235ed421c2..334f5dd9bc 100644 --- a/assets/layers/bike_cafe/bike_cafe.json +++ b/assets/layers/bike_cafe/bike_cafe.json @@ -356,7 +356,7 @@ "mapRendering": [ { "icon": { - "render": "./assets/layers/bike_cafe/bike_cafe.svg" + "render": "pin:#684c2b;./assets/layers/bike_cafe/bike_cafe.svg" }, "iconSize": { "render": "50,50,bottom" diff --git a/assets/layers/bike_cafe/bike_cafe.svg b/assets/layers/bike_cafe/bike_cafe.svg index ce47ecc031..c00702f70b 100644 --- a/assets/layers/bike_cafe/bike_cafe.svg +++ b/assets/layers/bike_cafe/bike_cafe.svg @@ -1,34 +1,19 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + diff --git a/assets/layers/bike_cleaning/bike_cleaning.json b/assets/layers/bike_cleaning/bike_cleaning.json index 13c41b495f..f3f21746ba 100644 --- a/assets/layers/bike_cleaning/bike_cleaning.json +++ b/assets/layers/bike_cleaning/bike_cleaning.json @@ -65,11 +65,6 @@ ] } ], - "titleIcons": [ - { - "render": "" - } - ], "tagRenderings": [ "images", { diff --git a/assets/layers/bike_shop/bike_shop.json b/assets/layers/bike_shop/bike_shop.json index 9a2680d809..81befb61bc 100644 --- a/assets/layers/bike_shop/bike_shop.json +++ b/assets/layers/bike_shop/bike_shop.json @@ -686,7 +686,7 @@ "mapRendering": [ { "icon": { - "render": "./assets/layers/bike_shop/repair_shop.svg", + "render": "pin:#f04c4c;./assets/layers/bike_shop/repair_shop.svg", "mappings": [ { "if": "operator=De Fietsambassade Gent", @@ -694,7 +694,7 @@ }, { "if": "service:bicycle:retail=yes", - "then": "./assets/layers/bike_shop/shop.svg" + "then": "pin:#353d57;./assets/layers/bike_shop/shop.svg" } ] }, diff --git a/assets/layers/bike_shop/pump.svg b/assets/layers/bike_shop/pump.svg index bfee19d272..c6d074c49d 100644 --- a/assets/layers/bike_shop/pump.svg +++ b/assets/layers/bike_shop/pump.svg @@ -1,32 +1,52 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - \ No newline at end of file + diff --git a/assets/layers/bike_shop/repair_shop.svg b/assets/layers/bike_shop/repair_shop.svg index fd278be058..bede10e0f2 100644 --- a/assets/layers/bike_shop/repair_shop.svg +++ b/assets/layers/bike_shop/repair_shop.svg @@ -1,23 +1,34 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + diff --git a/assets/layers/bike_shop/shop.svg b/assets/layers/bike_shop/shop.svg index f4e054d28d..6fc0a9c9b2 100644 --- a/assets/layers/bike_shop/shop.svg +++ b/assets/layers/bike_shop/shop.svg @@ -1,185 +1,48 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + diff --git a/assets/svg/robot.svg b/assets/svg/robot.svg index eb4c176c0e..a9f1d4dcbf 100644 --- a/assets/svg/robot.svg +++ b/assets/svg/robot.svg @@ -1,6 +1,38 @@ - - - - + + + + + + - \ No newline at end of file + diff --git a/assets/themes/buurtnatuur/buurtnatuur.json b/assets/themes/buurtnatuur/buurtnatuur.json index b8657f7a56..de3cbc32bd 100644 --- a/assets/themes/buurtnatuur/buurtnatuur.json +++ b/assets/themes/buurtnatuur/buurtnatuur.json @@ -16,7 +16,7 @@ "nl": "

Tips

De oorspronkelijke data komt van OpenStreetMap en je antwoorden worden daar bewaard.
Omdat iedereen vrij kan meewerken aan dit project, kunnen we niet garanderen dat er geen fouten opduiken.Kan je hier niet aanpassen wat je wilt, dan kan je dat zelf via OpenStreetMap.org doen. Groen kan geen enkele verantwoordelijkheid nemen over de kaart.

Je privacy is belangrijk. We tellen wel hoeveel gebruikers deze website bezoeken. We plaatsen een cookie waar geen persoonlijke informatie in bewaard wordt. Als je inlogt, komt er een tweede cookie bij met je inloggegevens.
" }, "maintainer": "Pieter Vander Vennet", - "icon": "./assets/themes/buurtnatuur/groen_logo.svg", + "icon": "./assets/themes/buurtnatuur/logo.svg", "version": "0", "startLat": 50.8435, "startLon": 4.3688, @@ -627,4 +627,4 @@ } ] } -} \ No newline at end of file +} diff --git a/assets/themes/buurtnatuur/license_info.json b/assets/themes/buurtnatuur/license_info.json index b9a8bbb339..0b35721f93 100644 --- a/assets/themes/buurtnatuur/license_info.json +++ b/assets/themes/buurtnatuur/license_info.json @@ -39,6 +39,16 @@ "https://www.groen.be/" ] }, + { + "path": "logo.svg", + "license": "Logo; All rights reserved", + "authors": [ + "Groen" + ], + "sources": [ + "https://www.groen.be/" + ] + }, { "path": "nature_reserve.svg", "license": "CC-BY 3.0", diff --git a/assets/themes/buurtnatuur/logo.svg b/assets/themes/buurtnatuur/logo.svg new file mode 100644 index 0000000000..d4dfad14b5 --- /dev/null +++ b/assets/themes/buurtnatuur/logo.svg @@ -0,0 +1,38 @@ + + + + + + + + diff --git a/assets/themes/cyclestreets/cyclestreets.json b/assets/themes/cyclestreets/cyclestreets.json index 846eff12a6..625ba19f38 100644 --- a/assets/themes/cyclestreets/cyclestreets.json +++ b/assets/themes/cyclestreets/cyclestreets.json @@ -30,7 +30,7 @@ "it": "Una strada ciclabile è una strada dove il traffico motorizzato non può superare i velocipedi. La sua presenza è segnalata da un cartello stradale specifico. Le strade ciclabili sono diffuse in Olanda e Belgio, ma si possono trovare anche in Germania e in Francia. ", "hu": "A kerékpárosutca (cyclestreet, Fahrradstraße) olyan utca, ahol gépjármű nem előzhet meg kerékpárost. Az ilyen utcákat külön közlekedési tábla jelzi. Kerékpárosutcák találhatók Hollandiában és Belgiumban, valamint Németországban és Franciaországban is. " }, - "icon": "./assets/themes/cyclestreets/F111.svg", + "icon": "./assets/themes/cyclestreets/logo.svg", "startLat": 51.2095, "startZoom": 14, "startLon": 3.2228, @@ -358,4 +358,4 @@ } ] } -} \ No newline at end of file +} diff --git a/assets/themes/cyclestreets/license_info.json b/assets/themes/cyclestreets/license_info.json index b45d201681..31e3198f5d 100644 --- a/assets/themes/cyclestreets/license_info.json +++ b/assets/themes/cyclestreets/license_info.json @@ -18,5 +18,15 @@ "sources": [ "https://commons.wikimedia.org/wiki/File:Belgian_road_sign_F113_nl.svg" ] + }, + { + "path": "logo.svg", + "license": "CC0", + "authors": [ + "The RedBurn" + ], + "sources": [ + "https://commons.wikimedia.org/wiki/File:Belgian_road_sign_F111_nl.svg" + ] } ] \ No newline at end of file diff --git a/assets/themes/cyclestreets/logo.svg b/assets/themes/cyclestreets/logo.svg new file mode 100644 index 0000000000..0d6aa74907 --- /dev/null +++ b/assets/themes/cyclestreets/logo.svg @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/themes/grb_import/license_info.json b/assets/themes/grb_import/license_info.json index a6cdd3da52..0a00dc73ab 100644 --- a/assets/themes/grb_import/license_info.json +++ b/assets/themes/grb_import/license_info.json @@ -7,6 +7,14 @@ ], "sources": [] }, + { + "path": "logo.svg", + "license": "CC0", + "authors": [ + "Pieter Vander Vennet" + ], + "sources": [] + }, { "path": "warning.svg", "license": "CC0", diff --git a/assets/themes/grb_import/logo.svg b/assets/themes/grb_import/logo.svg new file mode 100644 index 0000000000..293fb295f4 --- /dev/null +++ b/assets/themes/grb_import/logo.svg @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + diff --git a/assets/themes/hailhydrant/logo.svg b/assets/themes/hailhydrant/logo.svg index 087d13d4b6..d48c517da3 100644 --- a/assets/themes/hailhydrant/logo.svg +++ b/assets/themes/hailhydrant/logo.svg @@ -1,32 +1,150 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + diff --git a/assets/themes/mapcomplete-changes/mapcomplete-changes.json b/assets/themes/mapcomplete-changes/mapcomplete-changes.json index e1454adb39..c75bb9d466 100644 --- a/assets/themes/mapcomplete-changes/mapcomplete-changes.json +++ b/assets/themes/mapcomplete-changes/mapcomplete-changes.json @@ -113,7 +113,7 @@ }, { "if": "theme=buurtnatuur", - "then": "./assets/themes/buurtnatuur/groen_logo.svg" + "then": "./assets/themes/buurtnatuur/logo.svg" }, { "if": "theme=cafes_and_pubs", @@ -145,7 +145,7 @@ }, { "if": "theme=cyclestreets", - "then": "./assets/themes/cyclestreets/F111.svg" + "then": "./assets/themes/cyclestreets/logo.svg" }, { "if": "theme=cyclofix", @@ -185,7 +185,7 @@ }, { "if": "theme=grb", - "then": "./assets/themes/grb_import/housenumber_blank.svg" + "then": "./assets/themes/grb_import/logo.svg" }, { "if": "theme=grb_fixme", @@ -229,7 +229,7 @@ }, { "if": "theme=openwindpowermap", - "then": "./assets/themes/openwindpowermap/wind_turbine.svg" + "then": "./assets/themes/openwindpowermap/logo.svg" }, { "if": "theme=parkings", diff --git a/assets/themes/openwindpowermap/license_info.json b/assets/themes/openwindpowermap/license_info.json index d331532473..d7986e80bd 100644 --- a/assets/themes/openwindpowermap/license_info.json +++ b/assets/themes/openwindpowermap/license_info.json @@ -1,4 +1,14 @@ [ + { + "path": "logo.svg", + "license": "CC0", + "authors": [ + "Iconathon" + ], + "sources": [ + "https://commons.wikimedia.org/wiki/File:Wind_Turbine_(2076)_-_The_Noun_Project.svg" + ] + }, { "path": "wind_turbine.svg", "license": "CC0", diff --git a/assets/themes/openwindpowermap/logo.svg b/assets/themes/openwindpowermap/logo.svg new file mode 100644 index 0000000000..5ed9f39b85 --- /dev/null +++ b/assets/themes/openwindpowermap/logo.svg @@ -0,0 +1,61 @@ + + + + + + + + + + + + + diff --git a/assets/themes/openwindpowermap/openwindpowermap.json b/assets/themes/openwindpowermap/openwindpowermap.json index a77beaa353..7c1d079784 100644 --- a/assets/themes/openwindpowermap/openwindpowermap.json +++ b/assets/themes/openwindpowermap/openwindpowermap.json @@ -11,7 +11,7 @@ "hu": "OpenWindPowerMap" }, "maintainer": "Seppe Santens", - "icon": "./assets/themes/openwindpowermap/wind_turbine.svg", + "icon": "./assets/themes/openwindpowermap/logo.svg", "description": { "en": "A map for showing and editing wind turbines.", "fr": "Une carte indiquant les éoliennes et permettant leur édition.", diff --git a/scripts/ScriptUtils.ts b/scripts/ScriptUtils.ts index 817e32d6c2..f7c916305c 100644 --- a/scripts/ScriptUtils.ts +++ b/scripts/ScriptUtils.ts @@ -4,7 +4,7 @@ import {Utils} from "../Utils"; import * as https from "https"; import {LayoutConfigJson} from "../Models/ThemeConfig/Json/LayoutConfigJson"; import {LayerConfigJson} from "../Models/ThemeConfig/Json/LayerConfigJson"; - +import xml2js from 'xml2js'; export default class ScriptUtils { @@ -146,4 +146,18 @@ export default class ScriptUtils { return ScriptUtils.DownloadJSON(url) } + public static async ReadSvg(path: string): Promise{ + const root = await xml2js.parseStringPromise(readFileSync(path, "UTF8")) + return root.svg + } + + public static async ReadSvgSync(path: string, callback: ((svg: any) => void)): Promise{ + xml2js.parseString(readFileSync(path, "UTF8"),{async: false} , (err, root) => { + if(err){ + throw err + } + callback(root["svg"]); + }) + } + } diff --git a/scripts/generateLayerOverview.ts b/scripts/generateLayerOverview.ts index 7756d9bdd3..4ee9aa1299 100644 --- a/scripts/generateLayerOverview.ts +++ b/scripts/generateLayerOverview.ts @@ -96,7 +96,7 @@ class LayerOverviewUtils { return dict; } - checkAllSvgs(){ + checkAllSvgs() { const allSvgs = ScriptUtils.readDirRecSync("./assets") .filter(path => path.endsWith(".svg")) .filter(path => !path.startsWith("./assets/generated")) @@ -108,11 +108,13 @@ class LayerOverviewUtils { } console.warn("The SVG at " + path + " is a fake SVG: it contains PNG data!") errCount++; - if(path.startsWith("./assets/svg")){ + if (path.startsWith("./assets/svg")) { throw "A core SVG is actually a PNG. Don't do this!" } } - console.log("There are "+errCount+" fake svgs") + if (errCount > 0) { + throw `There are ${errCount} fake svgs` + } } @@ -147,7 +149,7 @@ class LayerOverviewUtils { rendering.icon["mappings"] = iconsPerTheme writeFileSync('./assets/themes/mapcomplete-changes/mapcomplete-changes.json', JSON.stringify(proto, null, " ")) } - + this.checkAllSvgs() } diff --git a/scripts/generateLayouts.ts b/scripts/generateLayouts.ts index 0f654759e9..f315653265 100644 --- a/scripts/generateLayouts.ts +++ b/scripts/generateLayouts.ts @@ -64,13 +64,9 @@ async function createManifest(layout: LayoutConfig, alreadyWritten: string[]) { const whiteBackgroundPath = "./assets/generated/theme_"+layout.id+"_white_background.svg" { - const svgResult = await xml2js.parseStringPromise(readFileSync(icon, "UTF8")) - const svg = svgResult.svg + const svg = await ScriptUtils.ReadSvg(icon) const width: string = svg.$.width; const height: string = svg.$.height; - if(width !== height){ - console.warn("WARNING: the icon for theme "+layout.id+" is not square. Please square the icon at "+icon+"\n Width = "+width, "height =", height) - } const builder = new xml2js.Builder(); const withRect = {rect: {"$":{width, height, style: "fill:#ffffff;"}}, ...svg}