From 1ea285d303a2c22f5f63785a0bdaa58d95c08d9d Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Wed, 16 Sep 2020 02:40:44 +0200 Subject: [PATCH] Add bike-other-shop into bikeshop layers, add sport shops to show up too (even if they don't sell bicycles) --- Customizations/Layers/BikeOtherShops.ts | 83 ------------------------- Customizations/Layouts/Cyclofix.ts | 3 +- Logic/LayerUpdater.ts | 1 - Logic/Osm/OsmPreferences.ts | 2 - assets/layers/bike_shop/bike_shop.json | 75 ++++++++++++++++++++-- 5 files changed, 72 insertions(+), 92 deletions(-) delete mode 100644 Customizations/Layers/BikeOtherShops.ts diff --git a/Customizations/Layers/BikeOtherShops.ts b/Customizations/Layers/BikeOtherShops.ts deleted file mode 100644 index e014dbe80..000000000 --- a/Customizations/Layers/BikeOtherShops.ts +++ /dev/null @@ -1,83 +0,0 @@ -import {LayerDefinition} from "../LayerDefinition"; -import Translations from "../../UI/i18n/Translations"; -import {And, RegexTag, Tag} from "../../Logic/Tags"; -import {TagRenderingOptions} from "../TagRenderingOptions"; - - -export default class BikeOtherShops extends LayerDefinition { - private readonly sellsBikes = new Tag("service:bicycle:retail", "yes") - - private readonly to = Translations.t.cyclofix.nonBikeShop - - constructor() { - super("bikeOtherShop"); - this.name = this.to.name - this.icon = "./assets/bike/non_bike_repair_shop.svg" - this.overpassFilter = new And([ - new RegexTag("shop", /^bicycle$/, true), - new RegexTag(/^service:bicycle:/, /.*/), - ]) - this.presets = [] - this.maxAllowedOverlapPercentage = 10 - this.wayHandling = LayerDefinition.WAYHANDLING_CENTER_AND_WAY - - this.minzoom = 13; - this.style = this.generateStyleFunction(); - this.title = new TagRenderingOptions({ - mappings: [ - { - k: new And([new Tag("name", "*"), this.sellsBikes]), - txt: this.to.titleShopNamed - }, - { - k: new And([new Tag("name", "*"), new Tag("service:bicycle:retail", "")]), - txt: this.to.titleShop - }, - { - k: new And([new Tag("name", "*"), new Tag("service:bicycle:retail", "no")]), - txt: this.to.titleRepairNamed - }, - {k: this.sellsBikes, txt: this.to.titleShop}, - {k: new Tag("service:bicycle:retail", " "), txt: this.to.title}, - {k: new Tag("service:bicycle:retail", "no"), txt: this.to.titleRepair}, - { - k: new And([new Tag("name", "*")]), - txt: this.to.titleNamed - }, - {k: null, txt: this.to.title}, - ] - }) - - this.elementsToShow = [ - // new ImageCarouselWithUploadConstructor(), - // new PhoneNumberQuestion("{name}"), - // new Website("{name}"), - // ShopRetail - // new ShopRental(), - // new ShopRepair(), - // new ShopPump(), - // new ShopDiy(), - // new ShopSecondHand() - ] - } - - private generateStyleFunction() { - const self = this; - return function (tags: any) { - let icon = "assets/bike/non_bike_repair_shop.svg"; - - if (self.sellsBikes.matchesProperties(tags)) { - icon = "assets/bike/non_bike_shop.svg"; - } - - return { - color: "#00bb00", - icon: { - iconUrl: icon, - iconSize: [50, 50], - iconAnchor: [25, 50] - } - } - } - } -} diff --git a/Customizations/Layouts/Cyclofix.ts b/Customizations/Layouts/Cyclofix.ts index 83c7a9a67..e56674f40 100644 --- a/Customizations/Layouts/Cyclofix.ts +++ b/Customizations/Layouts/Cyclofix.ts @@ -1,7 +1,6 @@ import {Layout} from "../Layout"; import Translations from "../../UI/i18n/Translations"; import Combine from "../../UI/Base/Combine"; -import BikeOtherShops from "../Layers/BikeOtherShops"; export default class Cyclofix extends Layout { @@ -19,7 +18,7 @@ export default class Cyclofix extends Layout { "cyclofix", ["en", "nl", "fr", "gl","de"], Translations.t.cyclofix.title, - ["bike_repair_station", "bike_cafes", "bike_shops", "drinking_water", "bike_parking", new BikeOtherShops(),"bike_themed_object", + ["bike_repair_station", "bike_cafes", "bike_shops", "drinking_water", "bike_parking","bike_themed_object", // The first of november, halloween and the second of november, we remember our dead ...(Cyclofix.RememberTheDead() ? ["ghost_bike"] : [])], 16, diff --git a/Logic/LayerUpdater.ts b/Logic/LayerUpdater.ts index 6473e7eff..178a96c9d 100644 --- a/Logic/LayerUpdater.ts +++ b/Logic/LayerUpdater.ts @@ -56,7 +56,6 @@ export class LayerUpdater { continue; } if (state.locationControl.data.zoom < layer.minzoom) { - console.log("Not loading layer ", layer.id, " as it needs at least ", layer.minzoom, "zoom") continue; } // Check if data for this layer has already been loaded diff --git a/Logic/Osm/OsmPreferences.ts b/Logic/Osm/OsmPreferences.ts index d57b93ddf..8ff413aae 100644 --- a/Logic/Osm/OsmPreferences.ts +++ b/Logic/Osm/OsmPreferences.ts @@ -140,7 +140,6 @@ export class OsmPreferences { } if (this.preferences.data[k] === v) { - console.log("Not updating preference", k, " to ", v, "not changed"); return; } console.log("Updating preference", k, " to ", Utils.EllipsesAfter(v, 15)); @@ -155,7 +154,6 @@ export class OsmPreferences { console.log("Could not remove preference", error); return; } - console.log("Preference ",k,"removed!"); }); diff --git a/assets/layers/bike_shop/bike_shop.json b/assets/layers/bike_shop/bike_shop.json index 90fa61824..e7f752fee 100644 --- a/assets/layers/bike_shop/bike_shop.json +++ b/assets/layers/bike_shop/bike_shop.json @@ -9,8 +9,32 @@ }, "minzoom": 13, "overpassTags": { - "and": [ - "shop=bicycle" + "#": "We select all bicycle shops, sport shops (but we try to weed out non-bicycle related shops), and any shop with a bicycle related tag", + "or": [ + "shop=bicycle", + { + "#": "if sport is defined and is not bicycle, it is retrackted; if bicycle retail/repair is marked as 'no', it is retracted too.", + "##": "There will be a few false-positives with this. They will get filtered out by people marking both 'not selling bikes' and 'not repairing bikes'. Furthermore, the OSMers will add a sports-subcategory on it", + "and": [ + "shop=sports", + "service:bicycle:retail!=no", + "service:bicycle:repair!=no", + { + "or": [ + "sport=bicycle", + "sport=cycling", + "sport=" + ] + } + ] + }, + { + "#": "Any shop with any bicycle service", + "and": [ + "shop~*", + "service:bicycle:.*~~.*" + ] + } ] }, "title": { @@ -22,11 +46,37 @@ "de": "Fahrradwerkstatt/geschäft" }, "mappings": [ + { + "if": { + "and": [ + "shop=sports", + "name~*" + ] + }, + "then": { + "en": "Sport gear shop {name}", + "nl": "Sportwinkel {name}", + "fr": "Magasin de sport {name}" + } + }, + { + "if": "shop=sports", + "then": { + "en": "Sport gear shop", + "nl": "Sportwinkel", + "fr": "Magasin de sport" + } + }, + { + "if": "shop!~bicycle", + "then": "Other shop" + }, { "if": { "and": [ "name~*", - "service:bicycle:retail!~yes" + "service:bicycle:retail!~yes", + "service:bicycle:repair!~no" ] }, "then": { @@ -38,7 +88,12 @@ } }, { - "if": "service:bicycle:retail!~yes", + "if": { + "and": [ + "service:bicycle:retail!~yes", + "service:bicycle:repair!~no" + ] + }, "then": { "en": "Bike repair", "nl": "Fietsenmaker", @@ -90,6 +145,18 @@ }, "tagRenderings": [ "images", + { + "condition": { + "and": [ + "shop!~bicycle", + "shop!~sports" + ] + }, + "render": { + "en": "This shop is specialized in selling {shop} and does bicycle related activities", + "nl": "Deze winkel verkoopt {shop} en heeft fiets-gerelateerde activiteiten." + } + }, { "question": { "en": "What is the name of this bicycle shop?",