From 40717af8591ee66b3610a14372ec38cc3f3ca1ad Mon Sep 17 00:00:00 2001 From: Ward Date: Wed, 28 Jul 2021 14:50:22 +0200 Subject: [PATCH] deletions natuurpunt thema --- InitUiElements.ts | 106 ++++--- assets/layers/parking/parking.json | 350 +++++++++++------------ assets/themes/natuurpunt/natuurpunt.json | 109 +++++-- 3 files changed, 307 insertions(+), 258 deletions(-) diff --git a/InitUiElements.ts b/InitUiElements.ts index b27cd5318..af7aee43e 100644 --- a/InitUiElements.ts +++ b/InitUiElements.ts @@ -1,21 +1,21 @@ -import {FixedUiElement} from "./UI/Base/FixedUiElement"; +import { FixedUiElement } from "./UI/Base/FixedUiElement"; import Toggle from "./UI/Input/Toggle"; -import {Basemap} from "./UI/BigComponents/Basemap"; +import { Basemap } from "./UI/BigComponents/Basemap"; import State from "./State"; import LoadFromOverpass from "./Logic/Actors/OverpassFeatureSource"; -import {UIEventSource} from "./Logic/UIEventSource"; -import {QueryParameters} from "./Logic/Web/QueryParameters"; +import { UIEventSource } from "./Logic/UIEventSource"; +import { QueryParameters } from "./Logic/Web/QueryParameters"; import StrayClickHandler from "./Logic/Actors/StrayClickHandler"; import SimpleAddUI from "./UI/BigComponents/SimpleAddUI"; import CenterMessageBox from "./UI/CenterMessageBox"; import UserBadge from "./UI/BigComponents/UserBadge"; import SearchAndGo from "./UI/BigComponents/SearchAndGo"; import GeoLocationHandler from "./Logic/Actors/GeoLocationHandler"; -import {LocalStorageSource} from "./Logic/Web/LocalStorageSource"; -import {Utils} from "./Utils"; +import { LocalStorageSource } from "./Logic/Web/LocalStorageSource"; +import { Utils } from "./Utils"; import Svg from "./Svg"; import Link from "./UI/Base/Link"; -import * as personal from "./assets/themes/personal/personal.json" +import * as personal from "./assets/themes/personal/personal.json"; import LayoutConfig from "./Customizations/JSON/LayoutConfig"; import * as L from "leaflet"; import Img from "./UI/Base/Img"; @@ -33,14 +33,14 @@ import MapControlButton from "./UI/MapControlButton"; import Combine from "./UI/Base/Combine"; import SelectedFeatureHandler from "./Logic/Actors/SelectedFeatureHandler"; import LZString from "lz-string"; -import {LayoutConfigJson} from "./Customizations/JSON/LayoutConfigJson"; +import { LayoutConfigJson } from "./Customizations/JSON/LayoutConfigJson"; import AttributionPanel from "./UI/BigComponents/AttributionPanel"; import ContributorCount from "./Logic/ContributorCount"; import FeatureSource from "./Logic/FeatureSource/FeatureSource"; import AllKnownLayers from "./Customizations/AllKnownLayers"; import LayerConfig from "./Customizations/JSON/LayerConfig"; import AvailableBaseLayers from "./Logic/Actors/AvailableBaseLayers"; -import {TagsFilter} from "./Logic/Tags/TagsFilter"; +import { TagsFilter } from "./Logic/Tags/TagsFilter"; import FilterView from "./UI/BigComponents/FilterView"; export class InitUiElements { @@ -57,8 +57,7 @@ export class InitUiElements { `Error: incorrect layout ${layoutName}
Go back` ) .AttachTo("centermessage") - .onClick(() => { - }); + .onClick(() => {}); throw "Incorrect layout"; } @@ -158,16 +157,13 @@ export class InitUiElements { InitUiElements.InitWelcomeMessage(); }); - if ( - (window != window.top && !State.state.featureSwitchWelcomeMessage.data) || - State.state.featureSwitchIframe.data - ) { + if (State.state.featureSwitchIframe.data) { const currentLocation = State.state.locationControl; - const url = `${window.location.origin}${window.location.pathname}?z=${ - currentLocation.data.zoom ?? 0 - }&lat=${currentLocation.data.lat ?? 0}&lon=${ - currentLocation.data.lon ?? 0 - }`; + const url = `${window.location.origin}${ + window.location.pathname + }?z=${currentLocation.data.zoom ?? 0}&lat=${ + currentLocation.data.lat ?? 0 + }&lon=${currentLocation.data.lon ?? 0}`; new MapControlButton( new Link(Svg.pop_out_img, url, true).SetClass( "block w-full h-full p-1.5" @@ -182,11 +178,13 @@ export class InitUiElements { "--subtle-detail-color" ); const icon = L.icon({ - iconUrl: Img.AsData(Svg.home_white_bg.replace(/#ffffff/g, color)), + iconUrl: Img.AsData( + Svg.home_white_bg.replace(/#ffffff/g, color) + ), iconSize: [30, 30], iconAnchor: [15, 15], }); - const marker = L.marker([home.lat, home.lon], {icon: icon}); + const marker = L.marker([home.lat, home.lon], { icon: icon }); marker.addTo(State.state.leafletMap.data); }); @@ -196,31 +194,26 @@ export class InitUiElements { State.state.currentGPSLocation, State.state.leafletMap, State.state.layoutToUse - ), { - dontStyle : true + ), + { + dontStyle: true, } ), undefined, State.state.featureSwitchGeolocation ); - const plus = new MapControlButton( - Svg.plus_zoom_svg() - ).onClick(() => { + const plus = new MapControlButton(Svg.plus_zoom_svg()).onClick(() => { State.state.locationControl.data.zoom++; State.state.locationControl.ping(); }); - const min = new MapControlButton( - Svg.min_zoom_svg() - ).onClick(() => { + const min = new MapControlButton(Svg.min_zoom_svg()).onClick(() => { State.state.locationControl.data.zoom--; State.state.locationControl.ping(); }); - new Combine( - [plus, min, geolocationButton] - ) + new Combine([plus, min, geolocationButton]) .SetClass("flex flex-col") .AttachTo("bottom-right"); @@ -262,7 +255,9 @@ export class InitUiElements { "last-loaded-user-layout" ); if (hash.length < 10) { - hash = dedicatedHashFromLocalStorage.data ?? hashFromLocalStorage.data; + hash = + dedicatedHashFromLocalStorage.data ?? + hashFromLocalStorage.data; } else { console.log("Saving hash to local storage"); hashFromLocalStorage.setData(hash); @@ -309,9 +304,11 @@ export class InitUiElements { // ?-Button on Desktop, opens panel with close-X. const help = new MapControlButton(Svg.help_svg()); help.onClick(() => isOpened.setData(true)); - new Toggle(fullOptions.SetClass("welcomeMessage"), help, isOpened).AttachTo( - "messagesbox" - ); + new Toggle( + fullOptions.SetClass("welcomeMessage"), + help, + isOpened + ).AttachTo("messagesbox"); const openedTime = new Date().getTime(); State.state.locationControl.addCallback(() => { if (new Date().getTime() - openedTime < 15 * 1000) { @@ -326,8 +323,8 @@ export class InitUiElements { }); isOpened.setData( Hash.hash.data === undefined || - Hash.hash.data === "" || - Hash.hash.data == "welcome" + Hash.hash.data === "" || + Hash.hash.data == "welcome" ); } @@ -366,23 +363,18 @@ export class InitUiElements { State.state.featureSwitchLayers ); - - const filterView = - new ScrollableFullScreen( - () => Translations.t.general.layerSelection.title.Clone(), - () => - new FilterView(State.state.filteredLayers).SetClass( - "block p-1 rounded-full" - ), - undefined, - State.state.filterIsOpened - ); - - - const filterMapControlButton = new MapControlButton( - Svg.filter_svg() + const filterView = new ScrollableFullScreen( + () => Translations.t.general.layerSelection.title.Clone(), + () => + new FilterView(State.state.filteredLayers).SetClass( + "block p-1 rounded-full" + ), + undefined, + State.state.filterIsOpened ); + const filterMapControlButton = new MapControlButton(Svg.filter_svg()); + const filterButton = new Toggle( filterView, filterMapControlButton, @@ -497,7 +489,7 @@ export class InitUiElements { const flayer = { isDisplayed: isDisplayed, layerDef: layer, - appliedFilters: new UIEventSource(undefined) + appliedFilters: new UIEventSource(undefined), }; flayers.push(flayer); } @@ -534,7 +526,9 @@ export class InitUiElements { source, State.state.osmApiFeatureSource ); - selectedFeatureHandler.zoomToSelectedFeature(State.state.locationControl); + selectedFeatureHandler.zoomToSelectedFeature( + State.state.locationControl + ); return source; } diff --git a/assets/layers/parking/parking.json b/assets/layers/parking/parking.json index d4d1cab73..7d8028e1f 100644 --- a/assets/layers/parking/parking.json +++ b/assets/layers/parking/parking.json @@ -1,192 +1,170 @@ { - "id": "parking", - "name": { - "nl": "parking" - }, - "minzoom": 12, - "source": { - "osmTags": { - "and": [ - { - "or": [ - "amenity=parking", - "amenity=motorcycle_parking", - "amenity=bicycle_parking" - ] - } - ] - } - }, - "title": { - "render": { - "nl": "Parking" + "id": "parking", + "name": { + "nl": "Parking" }, - "mappings": [ - { - "if": "amenity=parking", - "then": { - "nl": "{name:nl}" + "minzoom": 12, + "source": { + "osmTags": { + "and": [ + { + "or": [ + "amenity=parking", + "amenity=motorcycle_parking", + "amenity=bicycle_parking" + ] + } + ] } - }, - { - "if": "amenity=motorcycle_parking", - "then": { - "nl": "{name}" + }, + "title": { + "render": { + "nl": "Parking" + }, + "mappings": [ + { + "if": "amenity=parking", + "then": { + "nl": "{name:nl}" + } + }, + { + "if": "amenity=motorcycle_parking", + "then": { + "nl": "{name}" + } + }, + { + "if": "amenity=bicycle_parking", + "then": { + "nl": "Fietsenstalling" + } + } + ] + }, + "icon": { + "render": "./assets/layers/parking/parking.svg" + }, + "description": { + "nl": "Parking" + }, + "tagRenderings": [ + "images", + { + "#": "Access tag", + "render": { + "nl": "De toegankelijkheid van dit gebied is: {access:description}" + }, + "question": { + "nl": "Is dit gebied toegankelijk?" + }, + "freeform": { + "key": "access:description" + }, + "mappings": [ + { + "if": { + "and": ["access=yes", "fee="] + }, + "then": { + "nl": "Vrij toegankelijk" + } + }, + { + "if": { + "and": ["access=no", "fee="] + }, + "then": { + "nl": "Niet toegankelijk" + } + }, + { + "if": { + "and": ["access=private", "fee="] + }, + "then": { + "nl": "Niet toegankelijk, want privégebied" + } + }, + { + "if": { + "and": ["access=permissive", "fee="] + }, + "then": { + "nl": "Toegankelijk, ondanks dat het privegebied is" + } + }, + { + "if": { + "and": ["access=guided", "fee="] + }, + "then": { + "nl": "Enkel toegankelijk met een gids of tijdens een activiteit" + } + }, + { + "if": { + "and": ["access=yes", "fee=yes"] + }, + "then": { + "nl": "Toegankelijk mits betaling" + } + } + ] + }, + { + "#": "Operator tag", + "render": { + "nl": "Beheer door {operator}" + }, + "question": { + "nl": "Wie beheert dit pad?" + }, + "freeform": { + "key": "operator" + }, + "mappings": [ + { + "if": { + "and": ["operator=Natuurpunt"] + }, + "then": { + "nl": "Dit gebied wordt beheerd door Natuurpunt" + } + }, + { + "if": { + "and": ["operator~(n|N)atuurpunt.*"] + }, + "then": { + "nl": "Dit gebied wordt beheerd door {operator}" + }, + "hideInAnswer": true + } + ] } - }, - { - "if": "amenity=bicycle_parking", - "then": { - "nl": "Fietsenstalling" + ], + "wayHandling": 1, + "iconSize": { + "render": "36,36,center" + }, + "color": { + "render": "#E1AD01" + }, + "presets": [ + { + "tags": [ + "amenity=parking", + "amenity=motorcycle_parking", + "amenity=bicycle_parking", + "fixme=Toegevoegd met MapComplete, geometry nog uit te tekenen" + ], + "title": { + "nl": "Paden" + }, + "description": { + "nl": "Voeg een ontbrekend, erkend pad toe." + } } - } ] - }, - "icon": { - "render": "./assets/layers/parking/parking.svg" - }, - "description": { - "nl": "Parking" - }, - "tagRenderings": [ - "images", - { - "#": "Access tag", - "render": { - "nl": "De toegankelijkheid van dit gebied is: {access:description}" - }, - "question": { - "nl": "Is dit gebied toegankelijk?" - }, - "freeform": { - "key": "access:description" - }, - "mappings": [ - { - "if": { - "and": [ - "access=yes", - "fee=" - ] - }, - "then": { - "nl": "Vrij toegankelijk" - } - }, - { - "if": { - "and": [ - "access=no", - "fee=" - ] - }, - "then": { - "nl": "Niet toegankelijk" - } - }, - { - "if": { - "and": [ - "access=private", - "fee=" - ] - }, - "then": { - "nl": "Niet toegankelijk, want privégebied" - } - }, - { - "if": { - "and": [ - "access=permissive", - "fee=" - ] - }, - "then": { - "nl": "Toegankelijk, ondanks dat het privegebied is" - } - }, - { - "if": { - "and": [ - "access=guided", - "fee=" - ] - }, - "then": { - "nl": "Enkel toegankelijk met een gids of tijdens een activiteit" - } - }, - { - "if": { - "and": [ - "access=yes", - "fee=yes" - ] - }, - "then": { - "nl": "Toegankelijk mits betaling" - } - } - ] - }, - { - "#": "Operator tag", - "render": { - "nl": "Beheer door {operator}" - }, - "question": { - "nl": "Wie beheert dit pad?" - }, - "freeform": { - "key": "operator" - }, - "mappings": [ - { - "if": { - "and": [ - "operator=Natuurpunt" - ] - }, - "then": { - "nl": "Dit gebied wordt beheerd door Natuurpunt" - } - }, - { - "if": { - "and": [ - "operator~(n|N)atuurpunt.*" - ] - }, - "then": { - "nl": "Dit gebied wordt beheerd door {operator}" - }, - "hideInAnswer": true - } - ] - } - ], - "wayHandling": 1, - "iconSize": { - "render": "36,36,center" - }, - "color": { - "render": "#E1AD01" - }, - "presets": [ - { - "tags": [ - "amenity=parking", - "amenity=motorcycle_parking", - "amenity=bicycle_parking", - "fixme=Toegevoegd met MapComplete, geometry nog uit te tekenen" - ], - "title": { - "nl": "Paden" - }, - "description": { - "nl": "Voeg een ontbrekend, erkend pad toe." - } - } - ] -} \ No newline at end of file +} diff --git a/assets/themes/natuurpunt/natuurpunt.json b/assets/themes/natuurpunt/natuurpunt.json index 4d66fada5..2170969e8 100644 --- a/assets/themes/natuurpunt/natuurpunt.json +++ b/assets/themes/natuurpunt/natuurpunt.json @@ -26,8 +26,7 @@ "widenFactor": 0.05, "socialImage": "", "defaultBackgroundId": "CartoDB.Positron", - "layers": [ - { + "layers": [{ "#": "Nature reserve with geometry, z>=13", "builtin": "nature_reserve", "override": { @@ -46,6 +45,14 @@ "minzoomVisible": 0, "icon": { "render": "circle:#FE6F32;./assets/themes/natuurpunt/nature_reserve.svg" + }, + "deletion": { + "hardDeletionTags": { + "and": [ + "leisure=nature_reserve", + "boundary=protected_area" + ] + } } } }, @@ -65,6 +72,14 @@ "minzoom": 1, "icon": { "render": "circle:#FE6F32;./assets/themes/natuurpunt/nature_reserve.svg" + }, + "deletion": { + "hardDeletionTags": { + "and": [ + "leisure=nature_reserve", + "boundary=protected_area" + ] + } } } }, @@ -84,6 +99,14 @@ "minzoom": "10", "icon": { "render": "circle:#FE6F32;./assets/themes/natuurpunt/information.svg" + }, + "deletion": { + "hardDeletionTags": { + "and": [ + "information=visitor_centre", + "information=office" + ] + } } } }, @@ -103,8 +126,7 @@ "minzoom": "13", "icon": { "render": "circle:#FE6F32;./assets/themes/natuurpunt/trail.svg", - "mappings": [ - { + "mappings": [{ "if": "wheelchair=yes", "then": "circle:#FE6F32;./assets/themes/natuurpunt/walk_wheelchair.svg" }, @@ -113,6 +135,15 @@ "then": "circle:#FE6F32;./assets/themes/natuurpunt/pushchair.svg" } ] + }, + "deletion": { + "hardDeletionTags": { + "and": [ + "route=hiking", + "route=bycicle", + "route=horse" + ] + } } } }, @@ -127,8 +158,7 @@ }, "icon": { "render": "circle:#FE6F32;./assets/themes/natuurpunt/toilets.svg", - "mappings": [ - { + "mappings": [{ "if": "wheelchair=yes", "then": "circle:#FE6F32;./assets/themes/natuurpunt/wheelchair.svg" }, @@ -137,6 +167,9 @@ "then": "circle:#FE6F32;./assets/themes/natuurpunt/urinal.svg" } ] + }, + "deletion": { + "hardDeletionTags": "amenity=toilets" } } }, @@ -152,7 +185,30 @@ "icon": { "render": "circle:#FE6F32;./assets/themes/natuurpunt/birdhide.svg", "mappings": null - } + }, + "deletion": [{ + "if": "leisure=bird_hide", + "then": { + "hardDeletionTags": "leisure=bird_hide" + } + }, { + "if": { + "or": [ + "building=yes", + "shelter=yes", + "amenity=shelter" + ] + }, + "then": { + "hardDeletionTags": { + "and": [ + "building=yes", + "shelter=yes", + "amenity=shelter" + ] + } + } + }] } }, { @@ -166,6 +222,9 @@ }, "icon": { "render": "circle:#FE6F32;./assets/themes/natuurpunt/picnic_table.svg" + }, + "deletion": { + "hardDeletionTags": "leisure=picnic_table" } } }, @@ -180,6 +239,9 @@ }, "icon": { "render": "circle:#FE6F32;./assets/themes/natuurpunt/drips.svg" + }, + "deletion": { + "hardDeletionTags": "amenity=drinking_water" } } }, @@ -189,15 +251,12 @@ "minzoom": "16", "icon": { "render": "circle:#FE6F32;./assets/themes/natuurpunt/parking.svg", - "mappings": [ - { - "if": "amenity=bicycle_parking", - "then": "circle:#FE6F32;./assets/themes/natuurpunt/parkingbike.svg" - } - ] + "mappings": [{ + "if": "amenity=bicycle_parking", + "then": "circle:#FE6F32;./assets/themes/natuurpunt/parkingbike.svg" + }] }, - "iconOverlays": [ - { + "iconOverlays": [{ "if": "amenity=motorcycle_parking", "then": "circle:#335D9F;./assets/themes/natuurpunt/parkingmotor.svg", "badge": true @@ -207,7 +266,16 @@ "then": "circle:#335D9F;./assets/themes/natuurpunt/parkingwheels.svg", "badge": true } - ] + ], + "deletion": { + "hardDeletionTags": { + "and": [ + "amenity=parking", + "amenity=motorcycle_parking", + "amenity=bicycle_parking" + ] + } + } } }, { @@ -221,6 +289,9 @@ }, "icon": { "render": "circle:#FE6F32;./assets/themes/natuurpunt/information_board.svg" + }, + "deletion": { + "hardDeletionTags": "information=board" } } }, @@ -235,6 +306,9 @@ }, "icon": { "render": "circle:#FE6F32;./assets/themes/natuurpunt/bench.svg" + }, + "deletion": { + "hardDeletionTags": "amenity=bench" } } }, @@ -249,6 +323,9 @@ }, "icon": { "render": "circle:#FE6F32;./assets/themes/natuurpunt/watermill.svg" + }, + "deletion": { + "hardDeletionTags": "man_made=watermill" } } }