From a782266a2f2f47d17486e95c0a2dd56857c1e703 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Tue, 5 Jan 2021 02:59:29 +0100 Subject: [PATCH] Add bicycle libraries --- Customizations/SharedLayers.ts | 3 + UI/ShowDataLayer.ts | 3 + .../bicycle_library/bicycle_library.json | 163 ++++++++++++++++ .../bicycle_library/bicycle_library.svg | 176 ++++++++++++++++++ assets/layers/bike_library/bike_library.json | 105 ----------- assets/tagRenderings/questions.json | 16 +- assets/themes/cyclofix/cyclofix.json | 2 +- 7 files changed, 361 insertions(+), 107 deletions(-) create mode 100644 assets/layers/bicycle_library/bicycle_library.json create mode 100644 assets/layers/bicycle_library/bicycle_library.svg delete mode 100644 assets/layers/bike_library/bike_library.json diff --git a/Customizations/SharedLayers.ts b/Customizations/SharedLayers.ts index cb2acca..379ee94 100644 --- a/Customizations/SharedLayers.ts +++ b/Customizations/SharedLayers.ts @@ -11,6 +11,8 @@ import * as bike_monitoring_station from "../assets/layers/bike_monitoring_stati import * as cycling_themed_objects from "../assets/layers/cycling_themed_object/cycling_themed_objects.json" import * as bike_shops from "../assets/layers/bike_shop/bike_shop.json" import * as bike_cleaning from "../assets/layers/bike_cleaning/bike_cleaning.json" +import * as bicycle_library from "../assets/layers/bicycle_library/bicycle_library.json" + import * as maps from "../assets/layers/maps/maps.json" import * as information_boards from "../assets/layers/information_board/information_board.json" import * as direction from "../assets/layers/direction/direction.json" @@ -38,6 +40,7 @@ export default class SharedLayers { new LayerConfig(birdhides,[], "shared_layers"), new LayerConfig(nature_reserve,[], "shared_layers"), new LayerConfig(bike_cafes,[], "shared_layers"), + new LayerConfig(bicycle_library, [], "bike_library"), new LayerConfig(cycling_themed_objects,[], "shared_layers"), new LayerConfig(bike_shops,[], "shared_layers"), new LayerConfig(bike_cleaning,[], "shared_layers"), diff --git a/UI/ShowDataLayer.ts b/UI/ShowDataLayer.ts index b377966..6a8317a 100644 --- a/UI/ShowDataLayer.ts +++ b/UI/ShowDataLayer.ts @@ -116,6 +116,9 @@ export default class ShowDataLayer { const tags = State.state.allElements.getEventSourceFor(feature); const uiElement: LazyElement = new LazyElement(() => new FeatureInfoBox(tags, layer)); popup.setContent(uiElement.Render()); + popup.on('popupclose', () => { + State.state.selectedElement.setData(undefined); + }); leafletLayer.bindPopup(popup); // We first render the UIelement (which'll still need an update later on...) // But at least it'll be visible already diff --git a/assets/layers/bicycle_library/bicycle_library.json b/assets/layers/bicycle_library/bicycle_library.json new file mode 100644 index 0000000..65ec7ac --- /dev/null +++ b/assets/layers/bicycle_library/bicycle_library.json @@ -0,0 +1,163 @@ +{ + "id": "bicycle_library", + "name": { + "en": "Bicycle library", + "nl": "Fietsbibliotheek" + }, + "minzoom": 8 , + "overpassTags": "amenity=bicycle_library", + "title": { + "render": { + "en": "Bicycle library", + "nl": "Fietsbibliotheek" + }, + "mappings": [ + { + "if": "name~*", + "then": "{name}" + } + ] + }, + "titleIcons": [ + { + "condition": { + "or": [ + "service:bicycle:pump=yes", + "service:bicycle:pump=separate" + ] + }, + "render": "" + }, + "defaults" + ], + "description": { + "en": "A facility where bicycles can be lent for longer period of times", + "nl": "Een plaats waar men voor langere tijd een fiets kan lenen" + }, + "tagRenderings": [ + "images", + { + "question": { + "en": "What is the name of this bicycle library?", + "nl": "Wat is de naam van deze fietsbieb?" + }, + "render": { + "en": "This bicycle library shop is called {name}", + "nl": "Deze fietsbieb heet {name}" + }, + "freeform": { + "key": "name" + } + }, + "website", + "phone", + "email", + "opening_hours", + { + "question": { + "en": "How much does lending a bicycle cost?", + "nl": "Hoeveel kost het huren van een fiets?" + }, + "render":{ + "en": "Lending a bicycle costs {charge}", + "nl": "Een fiets huren kost {charge{" + }, + "freeform": { + "key": "charge", + "extraTags": ["fee=yes"] + }, + "mappings": [ + { + "if": { + "and": ["fee=no","charge="] + }, + "then": { + "en": "Lending a bicycle is free", + "nl": "Een fiets huren is gratis" + } + }, + { + "if": { + "and": ["fee=yes","charge=€20warranty + €20/year"] + }, + "then": { + "en": "Lending a bicycle costs €20/year and €20 warranty", + "nl": "Een fiets huren kost €20/jaar en €20 waarborg" + } + } + ] + }, + { + "question": { + "en": "Who can lend bicycles here?", + "nl": "Voor wie worden hier fietsen aangeboden?" + }, + "multiAnswer": true, + "mappings": [ + { + "if": "bicycle_library:for=child", + "then": { + "nl": "Aanbod voor kinderen", + "en": "Bikes for children available" + } + }, + { + "if": "bicycle_library:for=adult", + "then": { + "nl": "Aanbod voor volwassenen", + "en": "Bikes for adult available" + } + }, + { + "if": "bicycle_library:for=disabled", + "then": { + "nl": "Aanbod voor personen met een handicap", + "en": "Bikes for disabled persons available" + } + } + ] + }, + "description" + ], + "hideUnderlayingFeaturesMinPercentage": 1, + "presets": [ + { + "title": { + "en": "Fietsbibliotheek", + "nl": "Bicycle library" + }, + "tags": [ + "amenity=bicycle_library" + ], + "description": { + "nl": "Een fietsbieb heeft een collectie fietsen die leden mogen lenen", + "en": "A bicycle library has a collection of bikes which can be lent" + } + } + ], + "icon": { + "render": "pin:#22ff55;./assets/layers/bicycle_library/bicycle_library.svg" + }, + "iconOverlays": [ + { + "if": "opening_hours~*", + "then": "isOpen", + "badge": true + }, + { + "if": "service:bicycle:pump=yes", + "then": "circle:#e2783d;./assets/layers/bike_repair_station/pump.svg", + "badge": true + } + ], + "width": { + "render": "1" + }, + "iconSize": { + "render": "50,50,bottom" + }, + "color": { + "render": "#c00" + }, + "wayHandling": 2 +} \ No newline at end of file diff --git a/assets/layers/bicycle_library/bicycle_library.svg b/assets/layers/bicycle_library/bicycle_library.svg new file mode 100644 index 0000000..3692a1b --- /dev/null +++ b/assets/layers/bicycle_library/bicycle_library.svg @@ -0,0 +1,176 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/layers/bike_library/bike_library.json b/assets/layers/bike_library/bike_library.json deleted file mode 100644 index 6102821..0000000 --- a/assets/layers/bike_library/bike_library.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "id": "bike_libraries", - "name": { - "en": "Bicycle library", - "nl": "Fietsbibliotheek", - }, - "minzoom": 13, - "overpassTags": "amenity=bicycle_library", - "title": { - "render": { - "en": "Bicycle library", - "nl": "Fietsbibliotheek" - }, - "mappings": [ - { - "if": "name~*", - "then": "{name}" - } - ] - }, - "titleIcons": [ - { - "condition": { - "or": [ - "service:bicycle:pump=yes", - "service:bicycle:pump=separate" - ] - }, - "render": "" - }, - "defaults" - ], - "description": { - "en": "A facility where bicycles can be lent for longer period of times", - "nl": "Een plaats waar men voor langere tijd een fiets kan lenen" - }, - "tagRenderings": [ - "images", - { - "question": { - "en": "What is the name of this bicycle library?", - "nl": "Wat is de naam van deze fietsbieb?", - }, - "render": { - "en": "This bicycle library shop is called {name}", - "nl": "Deze fietsbieb heet {name}", - }, - "freeform": { - "key": "name" - } - }, - "website", - "phone", - "email", - "opening_hours", - "description", - ], - "hideUnderlayingFeaturesMinPercentage": 1, - "presets": [ - { - "title": { - "en": "Fietsbibliotheek", - "nl": "Bicycle library", - }, - "tags": [ - "shop=bicycle" - ] - } - ], - "icon": { - "render": "./assets/layers/bike_shop/repair_shop.svg", - "mappings": [ - { - "if": "operator=De Fietsambassade Gent", - "then": "./assets/themes/cyclofix/fietsambassade_gent_logo_small.svg" - }, - { - "if": "service:bicycle:retail=yes", - "then": "./assets/layers/bike_shop/shop.svg" - } - ] - }, - "iconOverlays": [ - { - "if": "opening_hours~*", - "then": "isOpen", - "badge": true - }, - { - "if": "service:bicycle:pump=yes", - "then": "circle:#e2783d;./assets/layers/bike_repair_station/pump.svg", - "badge": true - } - ], - "width": { - "render": "1" - }, - "iconSize": { - "render": "50,50,bottom" - }, - "color": { - "render": "#c00" - }, - "wayHandling": 2 -} \ No newline at end of file diff --git a/assets/tagRenderings/questions.json b/assets/tagRenderings/questions.json index 16265f6..589c5fa 100644 --- a/assets/tagRenderings/questions.json +++ b/assets/tagRenderings/questions.json @@ -71,6 +71,20 @@ "freeform": { "key": "opening_hours", "type": "opening_hours" - } + }, + "mappings": [ + { + "if": { + "or": ["opening_hours=by appointment", + "opening_hours=by_appointment", + "opening_hours=\"by appointment\""] + }, + "then": { + "en": "Only by appointment", + "nl": "Enkel op afspraak" + }, + "hideInAnswers": true + } + ] } } \ No newline at end of file diff --git a/assets/themes/cyclofix/cyclofix.json b/assets/themes/cyclofix/cyclofix.json index 51f31fb..1da6ad4 100644 --- a/assets/themes/cyclofix/cyclofix.json +++ b/assets/themes/cyclofix/cyclofix.json @@ -25,6 +25,6 @@ "startZoom": 16, "widenFactor": 0.05, "socialImage": "./assets/themes/cyclofix/logo.svg", - "layers": ["bike_cafes", "bike_shops", "bike_repair_station", "drinking_water", "bike_themed_object","bike_cleaning","bike_parking"], + "layers": ["bike_cafes", "bike_shops", "bicycle_library","bike_repair_station", "drinking_water", "bike_themed_object","bike_cleaning","bike_parking"], "roamingRenderings": [] } \ No newline at end of file