From 38d6616b4a83a4d62569fa3fd7a71af0143e4015 Mon Sep 17 00:00:00 2001 From: Pieter Fiers Date: Thu, 16 Jul 2020 15:29:50 +0200 Subject: [PATCH 1/6] Added bike assests + naming consistency --- Customizations/Layers/BikeParkings.ts | 2 +- .../{BikeServices.ts => BikeStations.ts} | 31 ++-- Customizations/Layouts/Cyclofix.ts | 6 +- Customizations/Questions/BikeParkingType.ts | 28 --- Customizations/Questions/BikeStationChain.ts | 18 -- .../Questions/BikeStationOperator.ts | 26 --- .../Questions/BikeStationPumpTools.ts | 19 -- Customizations/Questions/BikeStationStand.ts | 18 -- Customizations/Questions/PumpManual.ts | 18 -- Customizations/Questions/bike/ParkingType.ts | 38 ++++ .../PumpManometer.ts} | 14 +- Customizations/Questions/bike/PumpManual.ts | 16 ++ .../PumpOperationalStatus.ts} | 10 +- .../{BikePumpValves.ts => bike/PumpValves.ts} | 9 +- .../StationBrand.ts} | 9 +- Customizations/Questions/bike/StationChain.ts | 16 ++ .../Questions/bike/StationOperator.ts | 25 +++ .../Questions/bike/StationPumpTools.ts | 17 ++ Customizations/Questions/bike/StationStand.ts | 16 ++ assets/bike/cafe.svg | 23 +++ assets/bike/ghost.svg | 44 +++++ assets/bike/other_services.svg | 5 + assets/bike/parking.svg | 93 ++++++++++ assets/bike/place_with_pump.svg | 28 +++ assets/bike/pump.svg | 27 +++ assets/bike/pump_broken.svg | 29 ++++ assets/bike/repair_shop.svg | 21 +++ assets/bike/repair_station.svg | 61 +++++++ assets/bike/repair_station_pump.svg | 82 +++++++++ assets/bike/shop.svg | 164 ++++++++++++++++++ 30 files changed, 744 insertions(+), 169 deletions(-) rename Customizations/Layers/{BikeServices.ts => BikeStations.ts} (73%) delete mode 100644 Customizations/Questions/BikeParkingType.ts delete mode 100644 Customizations/Questions/BikeStationChain.ts delete mode 100644 Customizations/Questions/BikeStationOperator.ts delete mode 100644 Customizations/Questions/BikeStationPumpTools.ts delete mode 100644 Customizations/Questions/BikeStationStand.ts delete mode 100644 Customizations/Questions/PumpManual.ts create mode 100644 Customizations/Questions/bike/ParkingType.ts rename Customizations/Questions/{BikePumpManometer.ts => bike/PumpManometer.ts} (67%) create mode 100644 Customizations/Questions/bike/PumpManual.ts rename Customizations/Questions/{BikePumpOperationalStatus.ts => bike/PumpOperationalStatus.ts} (62%) rename Customizations/Questions/{BikePumpValves.ts => bike/PumpValves.ts} (82%) rename Customizations/Questions/{BikeStationBrand.ts => bike/StationBrand.ts} (73%) create mode 100644 Customizations/Questions/bike/StationChain.ts create mode 100644 Customizations/Questions/bike/StationOperator.ts create mode 100644 Customizations/Questions/bike/StationPumpTools.ts create mode 100644 Customizations/Questions/bike/StationStand.ts create mode 100644 assets/bike/cafe.svg create mode 100644 assets/bike/ghost.svg create mode 100644 assets/bike/other_services.svg create mode 100644 assets/bike/parking.svg create mode 100644 assets/bike/place_with_pump.svg create mode 100644 assets/bike/pump.svg create mode 100644 assets/bike/pump_broken.svg create mode 100644 assets/bike/repair_shop.svg create mode 100644 assets/bike/repair_station.svg create mode 100644 assets/bike/repair_station_pump.svg create mode 100644 assets/bike/shop.svg diff --git a/Customizations/Layers/BikeParkings.ts b/Customizations/Layers/BikeParkings.ts index edc6a26..c026c16 100644 --- a/Customizations/Layers/BikeParkings.ts +++ b/Customizations/Layers/BikeParkings.ts @@ -3,7 +3,7 @@ import {And, Or, Tag} from "../../Logic/TagsFilter"; import {OperatorTag} from "../Questions/OperatorTag"; import * as L from "leaflet"; import FixedText from "../Questions/FixedText"; -import { BikeParkingType } from "../Questions/BikeParkingType"; +import { BikeParkingType } from "../Questions/bike/ParkingType"; import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload"; export class BikeParkings extends LayerDefinition { diff --git a/Customizations/Layers/BikeServices.ts b/Customizations/Layers/BikeStations.ts similarity index 73% rename from Customizations/Layers/BikeServices.ts rename to Customizations/Layers/BikeStations.ts index e79ff33..b02eb30 100644 --- a/Customizations/Layers/BikeServices.ts +++ b/Customizations/Layers/BikeStations.ts @@ -1,20 +1,19 @@ import {LayerDefinition} from "../LayerDefinition"; import {And, Tag, TagsFilter} from "../../Logic/TagsFilter"; import * as L from "leaflet"; -import BikeStationChain from "../Questions/BikeStationChain"; -import BikeStationPumpTools from "../Questions/BikeStationPumpTools"; -import BikeStationStand from "../Questions/BikeStationStand"; -import PumpManual from "../Questions/PumpManual"; -import BikeStationOperator from "../Questions/BikeStationOperator"; -import BikeStationBrand from "../Questions/BikeStationBrand"; +import BikeStationChain from "../Questions/bike/StationChain"; +import BikeStationPumpTools from "../Questions/bike/StationPumpTools"; +import BikeStationStand from "../Questions/bike/StationStand"; +import PumpManual from "../Questions/bike/PumpManual"; +import BikeStationOperator from "../Questions/bike/StationOperator"; +import BikeStationBrand from "../Questions/bike/StationBrand"; import FixedText from "../Questions/FixedText"; -import {BikePumpManometer} from "../Questions/BikePumpManometer"; +import PumpManometer from "../Questions/bike/PumpManometer"; import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload"; -import {BikePumpOperationalStatus} from "../Questions/BikePumpOperationalStatus"; - -export default class BikeServices extends LayerDefinition { +import BikePumpOperationalStatus from "../Questions/bike/PumpOperationalStatus"; +export default class BikeStations extends LayerDefinition { private readonly pump: TagsFilter = new Tag("service:bicycle:pump", "yes"); private readonly tools: TagsFilter = new Tag("service:bicycle:tools", "yes"); @@ -37,24 +36,20 @@ export default class BikeServices extends LayerDefinition { this.style = this.generateStyleFunction(); this.title = new FixedText("Bike station"); - this.elementsToShow = [ - new ImageCarouselWithUploadConstructor(), - new BikeStationPumpTools(), new BikeStationChain().OnlyShowIf(this.tools), new BikeStationStand().OnlyShowIf(this.tools), new PumpManual().OnlyShowIf(this.pump), - new BikePumpManometer().OnlyShowIf(this.pump), + new PumpManometer().OnlyShowIf(this.pump), new BikePumpOperationalStatus().OnlyShowIf(this.pump), new BikeStationOperator(), - new BikeStationBrand() + // new BikeStationBrand() DISABLED ]; - } private generateStyleFunction() { @@ -65,11 +60,11 @@ export default class BikeServices extends LayerDefinition { const iconUrl = onlyPump ? "./assets/pump.svg" : "./assets/wrench.svg" return { color: "#00bb00", - icon: new L.icon({ + icon: L.icon({ iconUrl: iconUrl, iconSize: [40, 40] }) }; }; } -} \ No newline at end of file +} diff --git a/Customizations/Layouts/Cyclofix.ts b/Customizations/Layouts/Cyclofix.ts index 26b4588..62bd466 100644 --- a/Customizations/Layouts/Cyclofix.ts +++ b/Customizations/Layouts/Cyclofix.ts @@ -1,16 +1,16 @@ import {Layout} from "../Layout"; -import {GrbToFix} from "../Layers/GrbToFix"; import { BikeParkings } from "../Layers/BikeParkings"; import BikeServices from "../Layers/BikeServices"; import {GhostBike} from "../Layers/GhostBike"; + export default class Cyclofix extends Layout { constructor() { super( "pomp", "Cyclofix bicycle infrastructure", // [new BikePumps()], - [new GhostBike(), new BikeParkings(), new BikeServices()], + [new BikeParkings(), new BikeServices()], 16, 50.8465573, 4.3516970, @@ -27,4 +27,4 @@ export default class Cyclofix extends Layout { , "", ""); } -} \ No newline at end of file +} diff --git a/Customizations/Questions/BikeParkingType.ts b/Customizations/Questions/BikeParkingType.ts deleted file mode 100644 index ebd7d57..0000000 --- a/Customizations/Questions/BikeParkingType.ts +++ /dev/null @@ -1,28 +0,0 @@ -import {TagRenderingOptions} from "../TagRendering"; -import {Tag} from "../../Logic/TagsFilter"; - - -export class BikeParkingType extends TagRenderingOptions { - private static options = { - priority: 5, - question: "Van welk type is deze fietsenparking?", - freeform: { - key: "bicycle_parking", - extraTags: new Tag("fixme", "Freeform bicycle_parking= tag used: possibly a wrong value"), - template: "Iets anders: $$$", - renderTemplate: "Dit is een fietsenparking van het type: {bicycle_parking}", - placeholder: "Specifieer" - }, - mappings: [ - {k: new Tag("bicycle_parking", "stands"), txt: ""}, - {k: new Tag("bicycle_parking", "wall_loops"), txt: ""}, - {k: new Tag("bicycle_parking", "handlebar_holder"), txt: ""}, - {k: new Tag("bicycle_parking", "shed"), txt: ""}, - {k: new Tag("bicycle_parking", "two-tier"), txt: ""} - ] - } - - constructor() { - super(BikeParkingType.options); - } -} diff --git a/Customizations/Questions/BikeStationChain.ts b/Customizations/Questions/BikeStationChain.ts deleted file mode 100644 index 280c18b..0000000 --- a/Customizations/Questions/BikeStationChain.ts +++ /dev/null @@ -1,18 +0,0 @@ -import {TagRenderingOptions} from "../TagRendering"; -import {Tag} from "../../Logic/TagsFilter"; - - -export default class BikeStationChain extends TagRenderingOptions { - private static options = { - priority: 5, - question: "Does this bike station have a special tool to repair your bike chain?", - mappings: [ - {k: new Tag("service:bicycle:chain_tool", "yes"), txt: "There is a chain tool."}, - {k: new Tag("service:bicycle:chain_tool", "no"), txt: "There is no chain tool."}, - ] - } - - constructor() { - super(BikeStationChain.options); - } -} diff --git a/Customizations/Questions/BikeStationOperator.ts b/Customizations/Questions/BikeStationOperator.ts deleted file mode 100644 index ab205f8..0000000 --- a/Customizations/Questions/BikeStationOperator.ts +++ /dev/null @@ -1,26 +0,0 @@ -import {TagRenderingOptions} from "../TagRendering"; -import {Tag} from "../../Logic/TagsFilter"; - -export default class BikeStationOperator extends TagRenderingOptions { - private static options = { - priority: 15, - question: "Who operates this bike station (name of university, shop, city...)?", - freeform: { - key: "operator", - template: "This bike station is operated by $$$", - renderTemplate: "This bike station is operated by {operator}", - placeholder: "organisatie" - }, - mappings: [ - {k: new Tag("operator", "KU Leuven"), txt: "KU Leuven"}, - {k: new Tag("operator", "Stad Halle"), txt: "Stad Halle"}, - {k: new Tag("operator", "Saint Gilles - Sint Gillis"), txt: "Saint Gilles - Sint Gillis"}, - {k: new Tag("operator", "Jette"), txt: "Jette"}, - {k: new Tag("operator", "private"), txt: "Beheer door een privépersoon"} - ] - } - - constructor() { - super(BikeStationOperator.options); - } -} diff --git a/Customizations/Questions/BikeStationPumpTools.ts b/Customizations/Questions/BikeStationPumpTools.ts deleted file mode 100644 index b0a40cb..0000000 --- a/Customizations/Questions/BikeStationPumpTools.ts +++ /dev/null @@ -1,19 +0,0 @@ -import {TagRenderingOptions} from "../TagRendering"; -import {Tag, And} from "../../Logic/TagsFilter"; - - -export default class BikeStationPumpTools extends TagRenderingOptions { - private static options = { - priority: 15, - question: "Which services are available at this bike station?", - mappings: [ - {k: new And([new Tag("service:bicycle:tools", "no"), new Tag("service:bicycle:pump", "yes")]), txt: "There is only a pump available."}, - {k: new And([new Tag("service:bicycle:tools", "yes"), new Tag("service:bicycle:pump", "no")]), txt: "There are only tools (screwdrivers, pliers...) available."}, - {k: new And([new Tag("service:bicycle:tools", "yes"), new Tag("service:bicycle:pump", "yes")]), txt: "There are both tools and a pump available."} - ] - } - - constructor() { - super(BikeStationPumpTools.options); - } -} diff --git a/Customizations/Questions/BikeStationStand.ts b/Customizations/Questions/BikeStationStand.ts deleted file mode 100644 index 5a6ef35..0000000 --- a/Customizations/Questions/BikeStationStand.ts +++ /dev/null @@ -1,18 +0,0 @@ -import {TagRenderingOptions} from "../TagRendering"; -import {Tag} from "../../Logic/TagsFilter"; - - -export default class BikeStationStand extends TagRenderingOptions { - private static options = { - priority: 10, - question: "Does this bike station have a hook to suspend your bike with or a stand to elevate it?", - mappings: [ - {k: new Tag("service:bicycle:stand", "yes"), txt: "There is a hook or stand."}, - {k: new Tag("service:bicycle:stand", "no"), txt: "There is no hook or stand"}, - ] - } - - constructor() { - super(BikeStationStand.options); - } -} diff --git a/Customizations/Questions/PumpManual.ts b/Customizations/Questions/PumpManual.ts deleted file mode 100644 index 26bd36e..0000000 --- a/Customizations/Questions/PumpManual.ts +++ /dev/null @@ -1,18 +0,0 @@ -import {TagRenderingOptions} from "../TagRendering"; -import {Tag} from "../../Logic/TagsFilter"; - - -export default class PumpManual extends TagRenderingOptions { - private static options = { - priority: 5, - question: "Is the pump at this bike station manual or automatic (compressed air)?", - mappings: [ - {k: new Tag("manual", "yes"), txt: "Manual"}, - {k: new Tag("manual", "no"), txt: "Automatic (with compressed air)"} - ] - } - - constructor() { - super(PumpManual.options); - } -} diff --git a/Customizations/Questions/bike/ParkingType.ts b/Customizations/Questions/bike/ParkingType.ts new file mode 100644 index 0000000..4b5074f --- /dev/null +++ b/Customizations/Questions/bike/ParkingType.ts @@ -0,0 +1,38 @@ +import {TagRenderingOptions} from "../../TagRendering"; +import {Tag} from "../../../Logic/TagsFilter"; + + +export default class ParkingType extends TagRenderingOptions { + private static images = { + stands: "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dc/Bike_racks_at_north-west_of_Westfield_-_geograph.org.uk_-_1041057.jpg/100px-Bike_racks_at_north-west_of_Westfield_-_geograph.org.uk_-_1041057.jpg", + wall_loops: "https://wiki.openstreetmap.org/w/images/thumb/c/c2/Bike-parking-wheelbender.jpg/100px-Bike-parking-wheelbender.jpg", + handlebar_holder: "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2c/Bicycle_parking_handlebar_holder.jpg/100px-Bicycle_parking_handlebar_holder.jpg", + shed: "https://wiki.openstreetmap.org/w/images/thumb/b/b2/Bike-shelter.jpg/100px-Bike-shelter.jpg", + "two-tier": "https://upload.wikimedia.org/wikipedia/commons/thumb/3/3f/Bicis_a_l%27estaci%C3%B3_de_Leiden.JPG/100px-Bicis_a_l%27estaci%C3%B3_de_Leiden.JPG" + } + + private static toImgTxt(url: string) { + return `` + } + + constructor() { + super({ + priority: 5, + question: "Van welk type is deze fietsenparking?", + freeform: { + key: "bicycle_parking", + extraTags: new Tag("fixme", "Freeform bicycle_parking= tag used: possibly a wrong value"), + template: "Iets anders: $$$", + renderTemplate: "Dit is een fietsenparking van het type: {bicycle_parking}", + placeholder: "Specifieer" + }, + mappings: [ + {k: new Tag("bicycle_parking", "stands"), txt: ParkingType.toImgTxt(ParkingType.images.stands)}, + {k: new Tag("bicycle_parking", "wall_loops"), txt: ParkingType.toImgTxt(ParkingType.images.wall_loops)}, + {k: new Tag("bicycle_parking", "handlebar_holder"), txt: ParkingType.toImgTxt(ParkingType.images.handlebar_holder)}, + {k: new Tag("bicycle_parking", "shed"), txt: ParkingType.toImgTxt(ParkingType.images.shed)}, + {k: new Tag("bicycle_parking", "two-tier"), txt: ParkingType.toImgTxt(ParkingType.images["two-tier"])} + ] + }); + } +} diff --git a/Customizations/Questions/BikePumpManometer.ts b/Customizations/Questions/bike/PumpManometer.ts similarity index 67% rename from Customizations/Questions/BikePumpManometer.ts rename to Customizations/Questions/bike/PumpManometer.ts index 919bd5a..bc97a03 100644 --- a/Customizations/Questions/BikePumpManometer.ts +++ b/Customizations/Questions/bike/PumpManometer.ts @@ -1,8 +1,8 @@ -import {TagRenderingOptions} from "../TagRendering"; -import {Tag} from "../../Logic/TagsFilter"; +import {TagRenderingOptions} from "../../TagRendering"; +import {Tag} from "../../../Logic/TagsFilter"; -export class BikePumpManometer extends TagRenderingOptions{ +export default class PumpManometer extends TagRenderingOptions { constructor() { super({ question: "Does the pump have a pressure indicator or manometer?", @@ -11,10 +11,6 @@ export class BikePumpManometer extends TagRenderingOptions{ {k: new Tag("manometer","broken"), txt: "Yes, but it is broken"}, {k: new Tag("manometer", "yes"), txt: "No"} ] - - }); - + }); } - - -} \ No newline at end of file +} diff --git a/Customizations/Questions/bike/PumpManual.ts b/Customizations/Questions/bike/PumpManual.ts new file mode 100644 index 0000000..18b79e6 --- /dev/null +++ b/Customizations/Questions/bike/PumpManual.ts @@ -0,0 +1,16 @@ +import {TagRenderingOptions} from "../../TagRendering"; +import {Tag} from "../../../Logic/TagsFilter"; + + +export default class PumpManual extends TagRenderingOptions { + constructor() { + super({ + priority: 5, + question: "Is this an electric bike pump?", + mappings: [ + {k: new Tag("manual", "yes"), txt: "Manual pump"}, + {k: new Tag("manual", "no"), txt: "Electric pump"} + ] + }); + } +} diff --git a/Customizations/Questions/BikePumpOperationalStatus.ts b/Customizations/Questions/bike/PumpOperationalStatus.ts similarity index 62% rename from Customizations/Questions/BikePumpOperationalStatus.ts rename to Customizations/Questions/bike/PumpOperationalStatus.ts index 37933af..0ebe3c2 100644 --- a/Customizations/Questions/BikePumpOperationalStatus.ts +++ b/Customizations/Questions/bike/PumpOperationalStatus.ts @@ -1,8 +1,8 @@ -import {TagDependantUIElement} from "../UIElementConstructor"; -import {TagRenderingOptions} from "../TagRendering"; -import {Tag} from "../../Logic/TagsFilter"; +import {TagRenderingOptions} from "../../TagRendering"; +import {Tag} from "../../../Logic/TagsFilter"; -export class BikePumpOperationalStatus extends TagRenderingOptions{ + +export default class PumpOperationalStatus extends TagRenderingOptions{ constructor() { super({ question: "Is the bicycle pump still operational?", @@ -12,4 +12,4 @@ export class BikePumpOperationalStatus extends TagRenderingOptions{ ] }); } -} \ No newline at end of file +} diff --git a/Customizations/Questions/BikePumpValves.ts b/Customizations/Questions/bike/PumpValves.ts similarity index 82% rename from Customizations/Questions/BikePumpValves.ts rename to Customizations/Questions/bike/PumpValves.ts index 662978a..50f6acb 100644 --- a/Customizations/Questions/BikePumpValves.ts +++ b/Customizations/Questions/bike/PumpValves.ts @@ -1,7 +1,8 @@ -import {TagRenderingOptions} from "../TagRendering"; -import {Tag} from "../../Logic/TagsFilter"; +import {TagRenderingOptions} from "../../TagRendering"; +import {Tag} from "../../../Logic/TagsFilter"; -export class BikePumpValves extends TagRenderingOptions{ + +export class PumpValves extends TagRenderingOptions{ constructor() { super({ question: "What valves are supported?", @@ -21,4 +22,4 @@ export class BikePumpValves extends TagRenderingOptions{ } }); } -} \ No newline at end of file +} diff --git a/Customizations/Questions/BikeStationBrand.ts b/Customizations/Questions/bike/StationBrand.ts similarity index 73% rename from Customizations/Questions/BikeStationBrand.ts rename to Customizations/Questions/bike/StationBrand.ts index ba3c4d2..61dbc44 100644 --- a/Customizations/Questions/BikeStationBrand.ts +++ b/Customizations/Questions/bike/StationBrand.ts @@ -1,6 +1,10 @@ -import {TagRenderingOptions} from "../TagRendering"; -import {Tag} from "../../Logic/TagsFilter"; +import {TagRenderingOptions} from "../../TagRendering"; +import {Tag} from "../../../Logic/TagsFilter"; + +/** + * Currently not used in Cyclofix because it's a little vague + */ export default class BikeStationBrand extends TagRenderingOptions { private static options = { priority: 15, @@ -17,6 +21,7 @@ export default class BikeStationBrand extends TagRenderingOptions { } constructor() { + throw Error('BikeStationBrand disabled') super(BikeStationBrand.options); } } diff --git a/Customizations/Questions/bike/StationChain.ts b/Customizations/Questions/bike/StationChain.ts new file mode 100644 index 0000000..eb5c36a --- /dev/null +++ b/Customizations/Questions/bike/StationChain.ts @@ -0,0 +1,16 @@ +import {TagRenderingOptions} from "../../TagRendering"; +import {Tag} from "../../../Logic/TagsFilter"; + + +export default class StationChain extends TagRenderingOptions { + constructor() { + super({ + priority: 5, + question: "Does this bike station have a special tool to repair your bike chain?", + mappings: [ + {k: new Tag("service:bicycle:chain_tool", "yes"), txt: "There is a chain tool."}, + {k: new Tag("service:bicycle:chain_tool", "no"), txt: "There is no chain tool."}, + ] + }); + } +} diff --git a/Customizations/Questions/bike/StationOperator.ts b/Customizations/Questions/bike/StationOperator.ts new file mode 100644 index 0000000..001f920 --- /dev/null +++ b/Customizations/Questions/bike/StationOperator.ts @@ -0,0 +1,25 @@ +import {TagRenderingOptions} from "../../TagRendering"; +import {Tag} from "../../../Logic/TagsFilter"; + + +export default class BikeStationOperator extends TagRenderingOptions { + constructor() { + super({ + priority: 15, + question: "Who operates this bike station (name of university, shop, city...)?", + freeform: { + key: "operator", + template: "This bike station is operated by $$$", + renderTemplate: "This bike station is operated by {operator}", + placeholder: "organisatie" + }, + mappings: [ + {k: new Tag("operator", "KU Leuven"), txt: "KU Leuven"}, + {k: new Tag("operator", "Stad Halle"), txt: "Stad Halle"}, + {k: new Tag("operator", "Saint Gilles - Sint Gillis"), txt: "Saint Gilles - Sint Gillis"}, + {k: new Tag("operator", "Jette"), txt: "Jette"}, + {k: new Tag("operator", "private"), txt: "Beheer door een privépersoon"} + ] + }); + } +} diff --git a/Customizations/Questions/bike/StationPumpTools.ts b/Customizations/Questions/bike/StationPumpTools.ts new file mode 100644 index 0000000..be81c8b --- /dev/null +++ b/Customizations/Questions/bike/StationPumpTools.ts @@ -0,0 +1,17 @@ +import {TagRenderingOptions} from "../../TagRendering"; +import {Tag, And} from "../../../Logic/TagsFilter"; + + +export default class BikeStationPumpTools extends TagRenderingOptions { + constructor() { + super({ + priority: 15, + question: "Which services are available at this bike station?", + mappings: [ + {k: new And([new Tag("service:bicycle:tools", "no"), new Tag("service:bicycle:pump", "yes")]), txt: "There is only a pump available."}, + {k: new And([new Tag("service:bicycle:tools", "yes"), new Tag("service:bicycle:pump", "no")]), txt: "There are only tools (screwdrivers, pliers...) available."}, + {k: new And([new Tag("service:bicycle:tools", "yes"), new Tag("service:bicycle:pump", "yes")]), txt: "There are both tools and a pump available."} + ] + }); + } +} diff --git a/Customizations/Questions/bike/StationStand.ts b/Customizations/Questions/bike/StationStand.ts new file mode 100644 index 0000000..0b6fce1 --- /dev/null +++ b/Customizations/Questions/bike/StationStand.ts @@ -0,0 +1,16 @@ +import {TagRenderingOptions} from "../../TagRendering"; +import {Tag} from "../../../Logic/TagsFilter"; + + +export default class BikeStationStand extends TagRenderingOptions { + constructor() { + super({ + priority: 10, + question: "Does this bike station have a hook to suspend your bike with or a stand to elevate it?", + mappings: [ + {k: new Tag("service:bicycle:stand", "yes"), txt: "There is a hook or stand."}, + {k: new Tag("service:bicycle:stand", "no"), txt: "There is no hook or stand"}, + ] + }); + } +} diff --git a/assets/bike/cafe.svg b/assets/bike/cafe.svg new file mode 100644 index 0000000..daeabdc --- /dev/null +++ b/assets/bike/cafe.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/bike/ghost.svg b/assets/bike/ghost.svg new file mode 100644 index 0000000..93a4b2a --- /dev/null +++ b/assets/bike/ghost.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/bike/other_services.svg b/assets/bike/other_services.svg new file mode 100644 index 0000000..2cec6d1 --- /dev/null +++ b/assets/bike/other_services.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/bike/parking.svg b/assets/bike/parking.svg new file mode 100644 index 0000000..b095bc1 --- /dev/null +++ b/assets/bike/parking.svg @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/bike/place_with_pump.svg b/assets/bike/place_with_pump.svg new file mode 100644 index 0000000..28ed9a8 --- /dev/null +++ b/assets/bike/place_with_pump.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/bike/pump.svg b/assets/bike/pump.svg new file mode 100644 index 0000000..79274d2 --- /dev/null +++ b/assets/bike/pump.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/bike/pump_broken.svg b/assets/bike/pump_broken.svg new file mode 100644 index 0000000..2dcc14c --- /dev/null +++ b/assets/bike/pump_broken.svg @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/bike/repair_shop.svg b/assets/bike/repair_shop.svg new file mode 100644 index 0000000..8b80e99 --- /dev/null +++ b/assets/bike/repair_shop.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/bike/repair_station.svg b/assets/bike/repair_station.svg new file mode 100644 index 0000000..1166e8d --- /dev/null +++ b/assets/bike/repair_station.svg @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/bike/repair_station_pump.svg b/assets/bike/repair_station_pump.svg new file mode 100644 index 0000000..b8e3895 --- /dev/null +++ b/assets/bike/repair_station_pump.svg @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/bike/shop.svg b/assets/bike/shop.svg new file mode 100644 index 0000000..6311d37 --- /dev/null +++ b/assets/bike/shop.svg @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 67ceb0414856587f805f0baa5a6377691b9a23ee Mon Sep 17 00:00:00 2001 From: Pieter Fiers Date: Thu, 16 Jul 2020 15:56:10 +0200 Subject: [PATCH 2/6] Add new icons for parking/pumps --- Customizations/Layers/BikeParkings.ts | 36 ++++--------------- Customizations/Layers/BikeStations.ts | 26 +++++++++++--- Customizations/Layouts/Cyclofix.ts | 5 ++- ...perationalStatus.ts => PumpOperational.ts} | 2 +- package.json | 2 +- 5 files changed, 32 insertions(+), 39 deletions(-) rename Customizations/Questions/bike/{PumpOperationalStatus.ts => PumpOperational.ts} (86%) diff --git a/Customizations/Layers/BikeParkings.ts b/Customizations/Layers/BikeParkings.ts index c026c16..a940a84 100644 --- a/Customizations/Layers/BikeParkings.ts +++ b/Customizations/Layers/BikeParkings.ts @@ -3,15 +3,15 @@ import {And, Or, Tag} from "../../Logic/TagsFilter"; import {OperatorTag} from "../Questions/OperatorTag"; import * as L from "leaflet"; import FixedText from "../Questions/FixedText"; -import { BikeParkingType } from "../Questions/bike/ParkingType"; +import ParkingType from "../Questions/bike/ParkingType"; import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload"; -export class BikeParkings extends LayerDefinition { +export default class BikeParkings extends LayerDefinition { constructor() { super(); this.name = "bike_parking"; - this.icon = "./assets/parking.svg"; + this.icon = "./assets/bike/parking.svg"; this.overpassFilter = new Tag("amenity", "bicycle_parking"); this.newElementTags = [ new Tag("amenity", "bicycle_parking"), @@ -24,43 +24,21 @@ export class BikeParkings extends LayerDefinition { this.elementsToShow = [ new ImageCarouselWithUploadConstructor(), new OperatorTag(), - new BikeParkingType() + new ParkingType() ]; } - private generateStyleFunction() { const self = this; return function (properties: any) { - // let questionSeverity = 0; - // for (const qd of self.elementsToShow) { - // if (qd.IsQuestioning(properties)) { - // questionSeverity = Math.max(questionSeverity, qd.options.priority ?? 0); - // } - // } - - // let colormapping = { - // 0: "#00bb00", - // 1: "#00ff00", - // 10: "#dddd00", - // 20: "#ff0000" - // }; - - // let colour = colormapping[questionSeverity]; - // while (colour == undefined) { - // questionSeverity--; - // colour = colormapping[questionSeverity]; - // } - return { color: "#00bb00", - icon: new L.icon({ + icon: L.icon({ iconUrl: self.icon, - iconSize: [30, 30] + iconSize: [40, 40] }) }; }; } - -} \ No newline at end of file +} diff --git a/Customizations/Layers/BikeStations.ts b/Customizations/Layers/BikeStations.ts index 006aaca..280052a 100644 --- a/Customizations/Layers/BikeStations.ts +++ b/Customizations/Layers/BikeStations.ts @@ -10,12 +10,13 @@ import BikeStationBrand from "../Questions/bike/StationBrand"; import FixedText from "../Questions/FixedText"; import PumpManometer from "../Questions/bike/PumpManometer"; import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload"; -import PumpOperationalStatus from "../Questions/bike/PumpOperationalStatus"; +import PumpOperational from "../Questions/bike/PumpOperational"; import PumpValves from "../Questions/bike/PumpValves"; export default class BikeStations extends LayerDefinition { private readonly pump: TagsFilter = new Tag("service:bicycle:pump", "yes"); + private readonly pumpOperational: TagsFilter = new Tag("service:bicycle:pump:operational_status", "yes"); private readonly tools: TagsFilter = new Tag("service:bicycle:tools", "yes"); constructor() { @@ -47,7 +48,7 @@ export default class BikeStations extends LayerDefinition { new PumpManual().OnlyShowIf(this.pump), new PumpManometer().OnlyShowIf(this.pump), new PumpValves().OnlyShowIf(this.pump), - new PumpOperationalStatus().OnlyShowIf(this.pump), + new PumpOperational().OnlyShowIf(this.pump), new BikeStationOperator(), // new BikeStationBrand() DISABLED @@ -57,9 +58,24 @@ export default class BikeStations extends LayerDefinition { private generateStyleFunction() { const self = this; return function (properties: any) { - const onlyPump = self.pump.matchesProperties(properties) && - !self.tools.matchesProperties(properties) - const iconUrl = onlyPump ? "./assets/pump.svg" : "./assets/wrench.svg" + const hasPump = self.pump.matchesProperties(properties) + const isOperational = self.pumpOperational.matchesProperties(properties) + const hasTools = self.tools.matchesProperties(properties) + let iconName = "" + if (hasPump) { + if (hasTools) { + iconName = "repair_station_pump.svg" + } else { + if (isOperational) { + iconName = "pump.svg" + } else { + iconName = "pump_broken.svg" + } + } + } else { + iconName = "repair_station.svg" + } + const iconUrl = `./assets/bike/${iconName}` return { color: "#00bb00", icon: L.icon({ diff --git a/Customizations/Layouts/Cyclofix.ts b/Customizations/Layouts/Cyclofix.ts index 62bd466..a9688bc 100644 --- a/Customizations/Layouts/Cyclofix.ts +++ b/Customizations/Layouts/Cyclofix.ts @@ -1,6 +1,6 @@ import {Layout} from "../Layout"; -import { BikeParkings } from "../Layers/BikeParkings"; -import BikeServices from "../Layers/BikeServices"; +import BikeParkings from "../Layers/BikeParkings"; +import BikeServices from "../Layers/BikeStations"; import {GhostBike} from "../Layers/GhostBike"; @@ -9,7 +9,6 @@ export default class Cyclofix extends Layout { super( "pomp", "Cyclofix bicycle infrastructure", - // [new BikePumps()], [new BikeParkings(), new BikeServices()], 16, 50.8465573, diff --git a/Customizations/Questions/bike/PumpOperationalStatus.ts b/Customizations/Questions/bike/PumpOperational.ts similarity index 86% rename from Customizations/Questions/bike/PumpOperationalStatus.ts rename to Customizations/Questions/bike/PumpOperational.ts index 0ebe3c2..d7abe0f 100644 --- a/Customizations/Questions/bike/PumpOperationalStatus.ts +++ b/Customizations/Questions/bike/PumpOperational.ts @@ -2,7 +2,7 @@ import {TagRenderingOptions} from "../../TagRendering"; import {Tag} from "../../../Logic/TagsFilter"; -export default class PumpOperationalStatus extends TagRenderingOptions{ +export default class PumpOperational extends TagRenderingOptions { constructor() { super({ question: "Is the bicycle pump still operational?", diff --git a/package.json b/package.json index 1688e2d..b308f0f 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "A small website to edit OSM easily", "main": "index.js", "scripts": { - "start": "parcel index.html land.html test.html assets/test.json assets/* UI/* Logic/* vendor/*", + "start": "parcel index.html land.html test.html assets/test.json assets/**/* UI/* Logic/* vendor/*", "build": "rm -rf dist/ && parcel build --public-url ./ index.html land.html assets/*", "test": "echo \"Error: no test specified\" && exit 1" }, From 27411692b42889fde055f5f6658bd1707874aac6 Mon Sep 17 00:00:00 2001 From: Pieter Fiers Date: Thu, 16 Jul 2020 16:08:51 +0200 Subject: [PATCH 3/6] Fix pump operational icon --- Customizations/Layers/BikeStations.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Customizations/Layers/BikeStations.ts b/Customizations/Layers/BikeStations.ts index 280052a..fd3a9fb 100644 --- a/Customizations/Layers/BikeStations.ts +++ b/Customizations/Layers/BikeStations.ts @@ -1,5 +1,5 @@ import {LayerDefinition} from "../LayerDefinition"; -import {And, Tag, TagsFilter} from "../../Logic/TagsFilter"; +import {And, Tag, TagsFilter, Or} from "../../Logic/TagsFilter"; import * as L from "leaflet"; import BikeStationChain from "../Questions/bike/StationChain"; import BikeStationPumpTools from "../Questions/bike/StationPumpTools"; @@ -15,9 +15,10 @@ import PumpValves from "../Questions/bike/PumpValves"; export default class BikeStations extends LayerDefinition { - private readonly pump: TagsFilter = new Tag("service:bicycle:pump", "yes"); - private readonly pumpOperational: TagsFilter = new Tag("service:bicycle:pump:operational_status", "yes"); - private readonly tools: TagsFilter = new Tag("service:bicycle:tools", "yes"); + private readonly pump = new Tag("service:bicycle:pump", "yes"); + private readonly pumpOperationalAny = new Tag("service:bicycle:pump:operational_status", "yes"); + private readonly pumpOperationalOk = new Or([new Tag("service:bicycle:pump:operational_status", "yes"), new Tag("service:bicycle:pump:operational_status", "operational"), new Tag("service:bicycle:pump:operational_status", "ok")]); + private readonly tools = new Tag("service:bicycle:tools", "yes"); constructor() { super(); @@ -59,7 +60,7 @@ export default class BikeStations extends LayerDefinition { const self = this; return function (properties: any) { const hasPump = self.pump.matchesProperties(properties) - const isOperational = self.pumpOperational.matchesProperties(properties) + const isOperational = !self.pumpOperationalAny.matchesProperties(properties) || self.pumpOperationalOk.matchesProperties(properties) const hasTools = self.tools.matchesProperties(properties) let iconName = "" if (hasPump) { From 98e299eb07e4a01d4ef16169598a0daa08e2fa9f Mon Sep 17 00:00:00 2001 From: Pieter Fiers Date: Thu, 16 Jul 2020 16:25:27 +0200 Subject: [PATCH 4/6] Make bike icons 50*50 --- Customizations/Layers/BikeParkings.ts | 2 +- Customizations/Layers/BikeStations.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Customizations/Layers/BikeParkings.ts b/Customizations/Layers/BikeParkings.ts index a940a84..ccd737e 100644 --- a/Customizations/Layers/BikeParkings.ts +++ b/Customizations/Layers/BikeParkings.ts @@ -36,7 +36,7 @@ export default class BikeParkings extends LayerDefinition { color: "#00bb00", icon: L.icon({ iconUrl: self.icon, - iconSize: [40, 40] + iconSize: [50, 50] }) }; }; diff --git a/Customizations/Layers/BikeStations.ts b/Customizations/Layers/BikeStations.ts index fd3a9fb..ca25fac 100644 --- a/Customizations/Layers/BikeStations.ts +++ b/Customizations/Layers/BikeStations.ts @@ -81,7 +81,7 @@ export default class BikeStations extends LayerDefinition { color: "#00bb00", icon: L.icon({ iconUrl: iconUrl, - iconSize: [40, 40] + iconSize: [50, 50] }) }; }; From ce4775a77d85c185e82451ceaf7c92192050c0ba Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Thu, 16 Jul 2020 16:48:43 +0200 Subject: [PATCH 5/6] Enable ghost bikes, fix assets --- Customizations/Layers/GhostBike.ts | 2 +- Customizations/Layouts/Cyclofix.ts | 4 ++-- assets/Buurtnatuur-Welkom.txt | 17 +++++++++-------- package.json | 2 +- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Customizations/Layers/GhostBike.ts b/Customizations/Layers/GhostBike.ts index 83a4455..50e2752 100644 --- a/Customizations/Layers/GhostBike.ts +++ b/Customizations/Layers/GhostBike.ts @@ -58,7 +58,7 @@ export class GhostBike extends LayerDefinition { return { color: "#000000", icon: L.icon({ - iconUrl: 'assets/ghost_bike.svg', + iconUrl: 'assets/bike/ghost.svg', iconSize: [40, 40], iconAnchor: [20, 20], }) diff --git a/Customizations/Layouts/Cyclofix.ts b/Customizations/Layouts/Cyclofix.ts index a9688bc..9ed6a3b 100644 --- a/Customizations/Layouts/Cyclofix.ts +++ b/Customizations/Layouts/Cyclofix.ts @@ -9,7 +9,7 @@ export default class Cyclofix extends Layout { super( "pomp", "Cyclofix bicycle infrastructure", - [new BikeParkings(), new BikeServices()], + [new GhostBike(), new BikeServices(), new BikeParkings()], 16, 50.8465573, 4.3516970, @@ -17,7 +17,7 @@ export default class Cyclofix extends Layout { "

Cyclofix bicycle infrastructure

\n" + "\n" + - "

EN> On this map we want to collect data about the whereabouts of bicycle pumps and public racks in Brussels." + + "

EN> On this map we want to collect data about the whereabouts of bicycle pumps and public racks in Brussels." + "As a result, cyclists will be able to quickly find the nearest infrastructure for their needs.

" + "

NL> Op deze kaart willen we gegevens verzamelen over de locatie van fietspompen en openbare stelplaatsen in Brussel." + "Hierdoor kunnen fietsers snel de dichtstbijzijnde infrastructuur vinden die voldoet aan hun behoeften.

" + diff --git a/assets/Buurtnatuur-Welkom.txt b/assets/Buurtnatuur-Welkom.txt index febd369..bf60e40 100644 --- a/assets/Buurtnatuur-Welkom.txt +++ b/assets/Buurtnatuur-Welkom.txt @@ -2,19 +2,20 @@ Hallo, Je maakte een bijdrage aan OpenStreetMap met BuurtNatuur! Proficiat en welkom bij de community. -Je antwoorden en toevoegingen gaan rechtsstreeks naar OpenStreetMap. OpenStreetMap is een kaart die werkt zoals Wikipedia: -het is vrij en gratis om er zelf data aan toe te voegen; in het geval van buurtnatuur.be informatie over natuur en bossen. -De data van OpenStreetMap is ook vrij en gratis te gebruiken door iedereen die dit wilt - applicaties zoals Maps.me, OsmAnd, Pokemon Go, Facebook, SnapChat, RouteYou, de Natuurpunt-app,... gebruiken OpenStreetMap. Maar ook toeristische diensten (zoals Westtoer) gebruiken steeds vaker OpenStreetMap. +Je antwoorden en toevoegingen gaan rechtstreeks naar OpenStreetMap. OpenStreetMap is een kaart die werkt zoals Wikipedia: +het staat mensen vrij om zelf data toe te voegen; in het geval van buurtnatuur.be informatie over natuur en bossen. +De data van OpenStreetMap zijn ook vrij en gratis te gebruiken door iedereen die dat wil – applicaties zoals Maps.me, OsmAnd, Pokémon Go, Facebook, Snapchat, RouteYou en de Natuurpunt-app gebruiken OpnStreetMap. Maar ook toeristische diensten (zoals Westtoer) doen dat steeds vaker. Kortom, omdat je via buurtnatuur.be info gaf over natuur en bos, wordt dit zichtbaar op ál deze kaarten. -Heb je verdere vragen over OpenStreetMap? Wil je weten welke data we allemaal hebben en verzamelen? +Heb je verder nog vragen over OpenStreetMap? Wil je weten welke data we allemaal hebben en verzamelen? - Je kan meer lezen op [onze wiki-website](https://wiki.openstreetmap.org/wiki/NL:Hoofdpagina). -- Je kan mij een berichtje terug sturen (dit kan door een email terug te sturen) -- Je kan terecht op [online chat](https://riot.im/app/#/room/#osmbe:matrix.org) -- Je kan naar onze [bijeenkomsten komen](https://www.meetup.com/OpenStreetMap-Belgium/) +- Je kan dit berichtje beantwoorden (zie onderaan). +- Je kan terecht op [online chat](https://app.element.io/#/room/#osmbe:matrix.org). +- Je kan naar onze [bijeenkomsten komen](https://www.meetup.com/OpenStreetMap-Belgium/). +- Je kan de kaart ook bekijken op [openstreetmap.org](https://www.openstreetmap.org/). Daar kun je ook meer geavanceerde bewerkingen uitvoeren dan mogelijk is met BuurtNatuur. Happy Mapping! Pieter Vander Vennet -OpenStreetMap België +OpenStreetMap België \ No newline at end of file diff --git a/package.json b/package.json index b308f0f..6140d8b 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "scripts": { "start": "parcel index.html land.html test.html assets/test.json assets/**/* UI/* Logic/* vendor/*", - "build": "rm -rf dist/ && parcel build --public-url ./ index.html land.html assets/*", + "build": "rm -rf dist/ && parcel build --public-url ./ index.html land.html assets/* assets/*/*", "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [ From 7c1c9bc80a568f86a8f984aecc29c9a4bf457f8c Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Thu, 16 Jul 2020 17:24:18 +0200 Subject: [PATCH 6/6] Add deploy script, fix realtime updating of the icons --- Logic/FilteredLayer.ts | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/Logic/FilteredLayer.ts b/Logic/FilteredLayer.ts index 87ba7c6..6ee431b 100644 --- a/Logic/FilteredLayer.ts +++ b/Logic/FilteredLayer.ts @@ -110,16 +110,6 @@ export class FilteredLayer { } - public updateStyle() { - if (this._geolayer === undefined) { - return; - } - const self = this; - this._geolayer.setStyle(function (feature) { - return self._style(feature.properties); - }); - } - public AddNewElement(element) { this._newElements.push(element); console.log("Element added"); @@ -186,7 +176,15 @@ export class FilteredLayer { onEachFeature: function (feature, layer) { let eventSource = self._storage.addOrGetElement(feature); eventSource.addCallback(function () { - self.updateStyle(); + if (layer.setIcon) { + layer.setIcon(self._style(feature.properties).icon) + } else { + console.log("UPdating", layer); + + self._geolayer.setStyle(function (feature) { + return self._style(feature.properties); + }); + } });