From 685fd5b26cb56f365025d842fb9173461b27fd88 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Wed, 8 May 2024 21:46:33 +0200 Subject: [PATCH] Improvements to velopark --- assets/themes/velopark/velopark.json | 43 ++++++++++++++++++++- langs/en.json | 4 ++ src/Models/ThemeViewState.ts | 12 ++++++ src/UI/BigComponents/ThemeIntroPanel.svelte | 2 + src/UI/Comparison/ComparisonTable.svelte | 20 +++++++--- src/UI/SpecialVisualization.ts | 6 ++- src/UI/ThemeViewGUI.svelte | 2 +- 7 files changed, 78 insertions(+), 11 deletions(-) diff --git a/assets/themes/velopark/velopark.json b/assets/themes/velopark/velopark.json index 63e59c515..35d27cccd 100644 --- a/assets/themes/velopark/velopark.json +++ b/assets/themes/velopark/velopark.json @@ -9,8 +9,8 @@ "en" ], "description": { - "en": "

Velopark.be is a website collecting data about bicycle parkings in a semi-crowdsourced way. However, only 'authorized' instances are allowed to make changes there, in practice the operator of the bicycle parking such as SNCB, de Lijn or the municipality. They have now decided to synchronize their dataset with OpenStreetMap, and this MapComplete-instance is set up to help link and import their data into OpenStreetMap.

How to use: That's it! Thanks for helping to import this!", - "nl": "

Velopark.be is een website die data verzamelt over fietsenstallingen in een semi-crowdsource manier. Hierbij kunnen enkel geautorizeerde gebruikers data bijdragen, in de praktijk de uitbaters van de fietsenstallingen zoals de bevoegde gemeentebesturen, de NMBS of de Lijn. Velopark.be heeft nu beslist om hun data met OpenStreetMap te synchronizeren. Deze website is de tool om van Velopark.be naar OpenStreetMap te gaan en hun data te importeren.

Hoe te gebruiken? Dat is het! Bedankt om mee te helpen!" + "en": "

Velopark.be is a website collecting data about bicycle parkings in a semi-crowdsourced way. However, only 'authorized' instances are allowed to make changes there, in practice the operator of the bicycle parking such as SNCB, de Lijn or the municipality. They have now decided to synchronize their dataset with OpenStreetMap, and this MapComplete-instance is set up to help link and import their data into OpenStreetMap.

", + "nl": "

Velopark.be is een website die data verzamelt over fietsenstallingen in een semi-crowdsource manier. Hierbij kunnen enkel geautorizeerde gebruikers data bijdragen, in de praktijk de uitbaters van de fietsenstallingen zoals de bevoegde gemeentebesturen, de NMBS of de Lijn. Velopark.be heeft nu beslist om hun data met OpenStreetMap te synchronizeren. Deze website is de tool om van Velopark.be naar OpenStreetMap te gaan en hun data te importeren.

" }, "shortDescription": { "en": "A tool to import data from velopark.be into OpenStreetMap", @@ -414,6 +414,38 @@ "doCount": false, "minzoom": 18 } + }, + { + "builtin": "current_view", + "override": { + "=title": { + "en": "How to use?", + "nl": "Hoe te gebruiken" + }, + "+pointRendering": [ + { + "location": [ + "point", + "centroid" + ], + "marker": [ + { + "icon": "./assets/svg/help.svg" + } + ] + } + ], + + "tagRenderings": [ + { + "id": "tutorial", + "render": { + "en": "How to use: That's it! Thanks for helping to import this!", + "nl": "Hoe te gebruiken? Dat is het! Bedankt om mee te helpen!" + } + } + ] + } } ], "overrideAll": { @@ -473,6 +505,13 @@ "tagRenderings+": [ { "id": "no_save_needed", + "condition": { + "or": [ + "id~node/*", + "id~way/*", + "id~relation/*" + ] + }, "render": { "en": "Changes are automatically saved. You can simply close this popup with the cross at the upper-right", "nl": "Wijzigingen worden automatisch opgeslaan. Je kan deze popup gewoon sluiten met het kruisje rechtsbovenaan" diff --git a/langs/en.json b/langs/en.json index 1e686cf39..f806d1bae 100644 --- a/langs/en.json +++ b/langs/en.json @@ -60,6 +60,10 @@ "done": "Done", "error": "Error", "loadedFrom": "The following data is loaded from {source} using the embedded JSON-LD", + "missing": { + "intro": "OpenStreetMap has no information about the following attributes", + "title": "Missing items" + }, "noDataLoaded": "The external website has no linked data that could be loaded", "overwrite": "Overwrite in OpenStreetMap" }, diff --git a/src/Models/ThemeViewState.ts b/src/Models/ThemeViewState.ts index 635157026..0ce24eafc 100644 --- a/src/Models/ThemeViewState.ts +++ b/src/Models/ThemeViewState.ts @@ -69,6 +69,7 @@ import { import summaryLayer from "../assets/generated/layers/summary.json" import { LayerConfigJson } from "./ThemeConfig/Json/LayerConfigJson" import Locale from "../UI/i18n/Locale" +import Hash from "../Logic/Web/Hash" /** * @@ -496,6 +497,12 @@ export default class ThemeViewState implements SpecialVisualizationState { if (this.layout.customCss !== undefined && window.location.pathname.indexOf("theme") >= 0) { Utils.LoadCustomCss(this.layout.customCss) } + + Hash.hash.addCallbackAndRunD(hash => { + if(hash === "current_view" || hash.match(/current_view_[0-9]+/)){ + this.selectCurrentView() + } + }) } /** @@ -821,4 +828,9 @@ export default class ThemeViewState implements SpecialVisualizationState { this.userRelatedState.preferredBackgroundLayer ) } + + public selectCurrentView(){ + this.guistate.closeAll() + this.selectedElement.setData(this.currentView.features?.data?.[0]) + } } diff --git a/src/UI/BigComponents/ThemeIntroPanel.svelte b/src/UI/BigComponents/ThemeIntroPanel.svelte index 922153eb7..d25ff5947 100644 --- a/src/UI/BigComponents/ThemeIntroPanel.svelte +++ b/src/UI/BigComponents/ThemeIntroPanel.svelte @@ -15,6 +15,7 @@ import Add from "../../assets/svg/Add.svelte" import Location_refused from "../../assets/svg/Location_refused.svelte" import Location from "../../assets/svg/Location.svelte" + import SpecialTranslation from "../Popup/TagRendering/SpecialTranslation.svelte" /** * The theme introduction panel @@ -48,6 +49,7 @@
+ {#if layout.layers.some((l) => l.presets?.length > 0)} diff --git a/src/UI/Comparison/ComparisonTable.svelte b/src/UI/Comparison/ComparisonTable.svelte index 4fd513a0b..0424811f0 100644 --- a/src/UI/Comparison/ComparisonTable.svelte +++ b/src/UI/Comparison/ComparisonTable.svelte @@ -109,16 +109,17 @@
{#if !readonly} -

- -

{/if}
- {#if !readonly} - - {/if} + {#if $different.length > 0} + {#if !readonly} +

+ +

+ + {/if} {#each $different as key (key)}
0} + {#if !readonly} +

+ +

+ + + {/if} {#if currentStep === "init"} {#each $missing as key (key)}
diff --git a/src/UI/SpecialVisualization.ts b/src/UI/SpecialVisualization.ts index ff0547eb5..23253a2f8 100644 --- a/src/UI/SpecialVisualization.ts +++ b/src/UI/SpecialVisualization.ts @@ -1,12 +1,12 @@ import { Store, UIEventSource } from "../Logic/UIEventSource" import BaseUIElement from "./BaseUIElement" import LayoutConfig from "../Models/ThemeConfig/LayoutConfig" -import { IndexedFeatureSource, WritableFeatureSource } from "../Logic/FeatureSource/FeatureSource" +import { FeatureSource, IndexedFeatureSource, WritableFeatureSource } from "../Logic/FeatureSource/FeatureSource" import { OsmConnection } from "../Logic/Osm/OsmConnection" import { Changes } from "../Logic/Osm/Changes" import { ExportableMap, MapProperties } from "../Models/MapProperties" import LayerState from "../Logic/State/LayerState" -import { Feature, Geometry, Point } from "geojson" +import { Feature, Geometry, Point, Polygon } from "geojson" import FullNodeDatabaseSource from "../Logic/FeatureSource/TiledFeatureSource/FullNodeDatabaseSource" import { MangroveIdentity } from "../Logic/Web/MangroveReviews" import { GeoIndexedStoreForLayer } from "../Logic/FeatureSource/Actors/GeoIndexedStore" @@ -61,8 +61,10 @@ export interface SpecialVisualizationState { readonly selectedElement: UIEventSource + readonly currentView: FeatureSource> readonly favourites: FavouritesFeatureSource + /** * If data is currently being fetched from external sources */ diff --git a/src/UI/ThemeViewGUI.svelte b/src/UI/ThemeViewGUI.svelte index 9b4ed5834..d54cf8565 100644 --- a/src/UI/ThemeViewGUI.svelte +++ b/src/UI/ThemeViewGUI.svelte @@ -271,7 +271,7 @@ {#if currentViewLayer?.tagRenderings && currentViewLayer.defaultIcon()} { - state.selectedElement.setData(state.currentView.features?.data?.[0]) + state.selectCurrentView() }} on:keydown={forwardEventToMap} htmlElem={openCurrentViewLayerButton}