From 303485df7ec8f21a7b878e3fe318527ad57e10b9 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Sat, 9 Jan 2021 02:11:43 +0100 Subject: [PATCH] Add bicycle tube vending machines --- Customizations/JSON/FromJSON.ts | 12 ++++++- Customizations/SharedLayers.ts | 3 +- InitUiElements.ts | 5 ++- UI/Popup/FeatureInfoBox.ts | 2 +- .../bike_repair_station.json | 3 +- assets/themes/cyclofix/cyclofix.json | 32 ++++++++++++++----- test/Tag.spec.ts | 6 ++++ 7 files changed, 50 insertions(+), 13 deletions(-) diff --git a/Customizations/JSON/FromJSON.ts b/Customizations/JSON/FromJSON.ts index ed662758be..7d2fbd0126 100644 --- a/Customizations/JSON/FromJSON.ts +++ b/Customizations/JSON/FromJSON.ts @@ -11,7 +11,17 @@ export class FromJSON { } public static Tag(json: AndOrTagConfigJson | string, context: string = ""): TagsFilter { - if (json === undefined) { + try{ + return this.TagUnsafe(json, context); + }catch(e){ + console.error("Could not parse tag", json,"in context",context,"due to ", e) + throw e; + } + } + + private static TagUnsafe(json: AndOrTagConfigJson | string, context: string = ""): TagsFilter { + + if (json === undefined) { throw `Error while parsing a tag: 'json' is undefined in ${context}. Make sure all the tags are defined and at least one tag is present in a complex expression` } if (typeof (json) == "string") { diff --git a/Customizations/SharedLayers.ts b/Customizations/SharedLayers.ts index 72427998f2..1bdc62029c 100644 --- a/Customizations/SharedLayers.ts +++ b/Customizations/SharedLayers.ts @@ -11,7 +11,7 @@ import * as cycling_themed_objects from "../assets/layers/cycling_themed_object/ 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 bicycle_tube_vending_machine from "../assets/layers/bicycle_tube_vending_machine/bicycle_tube_vending_machine.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" @@ -39,6 +39,7 @@ export default class SharedLayers { cycling_themed_objects, bike_shops, bike_cleaning, + bicycle_tube_vending_machine, maps, direction, information_boards, diff --git a/InitUiElements.ts b/InitUiElements.ts index 62c6e59c60..e1c8726047 100644 --- a/InitUiElements.ts +++ b/InitUiElements.ts @@ -292,7 +292,10 @@ export class InitUiElements { const fullOptions2 = new FullWelcomePaneWithTabs(); - State.state.fullScreenMessage.setData({content: fullOptions2, hashText: "welcome"}) + if (Hash.hash.data === undefined) { + State.state.fullScreenMessage.setData({content: fullOptions2, hashText: "welcome"}) + + } Svg.help_svg() .SetClass("open-welcome-button") diff --git a/UI/Popup/FeatureInfoBox.ts b/UI/Popup/FeatureInfoBox.ts index 4818e1563d..b0b59d18f4 100644 --- a/UI/Popup/FeatureInfoBox.ts +++ b/UI/Popup/FeatureInfoBox.ts @@ -12,7 +12,7 @@ import ScrollableFullScreen from "../Base/ScrollableFullScreen"; export default class FeatureInfoBox extends UIElement { private _component: UIElement; - public title: UIEventSource ; + public title: UIElement ; constructor( tags: UIEventSource, diff --git a/assets/layers/bike_repair_station/bike_repair_station.json b/assets/layers/bike_repair_station/bike_repair_station.json index d71665f1cb..18a66380f8 100644 --- a/assets/layers/bike_repair_station/bike_repair_station.json +++ b/assets/layers/bike_repair_station/bike_repair_station.json @@ -107,7 +107,8 @@ "titleIcons": [ { "render": "", - "condition": "operator=De Fietsambassade Gent" + "condition": "operator=De Fietsambassade Gent", + "roaming": true }, "defaults" ], diff --git a/assets/themes/cyclofix/cyclofix.json b/assets/themes/cyclofix/cyclofix.json index c90321a7b5..d8e6bf43f4 100644 --- a/assets/themes/cyclofix/cyclofix.json +++ b/assets/themes/cyclofix/cyclofix.json @@ -13,22 +13,38 @@ "fr": "Le but de cette carte est de présenter aux cyclistes une solution facile à utiliser pour trouver l'infrastructure appropriée à leurs besoins.

Vous pouvez suivre votre localisation précise (mobile uniquement) et sélectionner les couches qui vous concernent dans le coin inférieur gauche. Vous pouvez également utiliser cet outil pour ajouter ou modifier des épingles (points d'intérêt) sur la carte et fournir plus de données en répondant aux questions.

Toutes les modifications que vous apportez seront automatiquement enregistrées dans la base de données mondiale d'OpenStreetMap et peuvent être librement réutilisées par d'autres.

Pour plus d'informations sur le projet cyclofix, rendez-vous sur cyclofix.osm.be.", "gl": "O obxectivo deste mapa é amosar ós ciclistas unha solución doada de empregar para atopar a infraestrutura axeitada para as súas necesidades.

Podes obter a túa localización precisa (só para dispositivos móbiles) e escoller as capas que sexan relevantes para ti na esquina inferior esquerda. Tamén podes empregar esta ferramenta para engadir ou editar puntos de interese ó mapa e fornecer máis datos respondendo as cuestións.

Todas as modificacións que fagas serán gardadas de xeito automático na base de datos global do OpenStreetMap e outros poderán reutilizalos libremente.

Para máis información sobre o proxecto cyclofix, vai a cyclofix.osm.be.", "de": "Das Ziel dieser Karte ist es, den Radfahrern eine einfach zu benutzende Lösung zu präsentieren, um die geeignete Infrastruktur für ihre Bedürfnisse zu finden.

Sie können Ihren genauen Standort verfolgen (nur mobil) und in der linken unteren Ecke die für Sie relevanten Ebenen auswählen. Sie können dieses Tool auch verwenden, um Pins (Points of Interest/Interessante Orte) zur Karte hinzuzufügen oder zu bearbeiten und mehr Daten durch Beantwortung der Fragen bereitstellen.

Alle Änderungen, die Sie vornehmen, werden automatisch in der globalen Datenbank von OpenStreetMap gespeichert und können von anderen frei wiederverwendet werden.

Weitere Informationen über das Projekt Cyclofix finden Sie unter cyclofix.osm.be." - }, - "language": ["en", "nl", "fr", "gl","de"], + "language": [ + "en", + "nl", + "fr", + "gl", + "de" + ], "maintainer": "MapComplete", "icon": "./assets/themes/cyclofix/logo.svg", "version": "0", "startLat": 50.8465573, "defaultBackgroundId": "CartoDB.Voyager", - "startLon": 4.3516970, + "startLon": 4.3516970, "startZoom": 16, "widenFactor": 0.05, "socialImage": "./assets/themes/cyclofix/logo.svg", - "layers": ["bike_cafes", "bike_shops", {"builtin": "bicycle_library", - "override": { - "minzoom": 13 - } - },"bike_repair_station", "drinking_water", "bike_themed_object","bike_cleaning","bike_parking"], + "layers": [ + "bike_cafes", + "bike_shops", + { + "builtin": "bicycle_library", + "override": { + "minzoom": 13 + } + }, + "bike_repair_station", + "bicycle_tube_vending_machine", + "drinking_water", + "bike_themed_object", + "bike_cleaning", + "bike_parking" + ], "roamingRenderings": [] } \ No newline at end of file diff --git a/test/Tag.spec.ts b/test/Tag.spec.ts index 5c4f8af554..d3a60f1d2e 100644 --- a/test/Tag.spec.ts +++ b/test/Tag.spec.ts @@ -47,6 +47,12 @@ new T([ equal(noMatch.matches([{k:"key",v:""}]), true) equal(noMatch.matches([{k:"otherKey",v:""}]), true) + + const multiMatch = FromJSON.Tag("vending~.*bicycle_tube.*") as Tag; + equal(multiMatch.matches([{k:"vending",v:"bicycle_tube"}]), true) + equal(multiMatch.matches([{k:"vending",v:"something;bicycle_tube"}]), true) + equal(multiMatch.matches([{k:"vending",v:"bicycle_tube;something"}]), true) + equal(multiMatch.matches([{k:"vending",v:"xyz;bicycle_tube;something"}]), true) })], ["Is equivalent test", (() => {