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" },