diff --git a/Customizations/Layers/BikeParkings.ts b/Customizations/Layers/BikeParkings.ts new file mode 100644 index 0000000..2f032c2 --- /dev/null +++ b/Customizations/Layers/BikeParkings.ts @@ -0,0 +1,71 @@ +import {LayerDefinition} from "../LayerDefinition"; +import {And, Or, Tag} from "../../Logic/TagsFilter"; +import {OperatorTag} from "../Questions/OperatorTag"; +import * as L from "leaflet"; +import FixedName from "../Questions/FixedName"; +import { BikeParkingType } from "../Questions/BikeParkingType"; + +export class BikeParkings extends LayerDefinition { + + constructor() { + super(); + this.name = "bike_parking"; + this.icon = "./assets/bike_pump.svg"; + + this.overpassFilter = new Or([ + new And([ + new Tag("amenity", "bicycle_parking") + ]) + ]); + + + this.newElementTags = [ + new Tag("amenity", "bicycle_parking"), + ]; + this.maxAllowedOverlapPercentage = 10; + + this.minzoom = 13; + this.style = this.generateStyleFunction(); + this.title = new FixedName("fietsparking"); + this.elementsToShow = [ + new OperatorTag(), + new BikeParkingType() + ]; + + } + + + 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({ + iconUrl: self.icon, + iconSize: [40, 40] + }) + }; + }; + } + +} \ No newline at end of file diff --git a/Customizations/Layers/BikePumps.ts b/Customizations/Layers/BikePumps.ts index babab00..4da60d6 100644 --- a/Customizations/Layers/BikePumps.ts +++ b/Customizations/Layers/BikePumps.ts @@ -1,9 +1,6 @@ import {LayerDefinition} from "../LayerDefinition"; import {And, Or, Tag} from "../../Logic/TagsFilter"; -import {AccessTag} from "../Questions/AccessTag"; import {OperatorTag} from "../Questions/OperatorTag"; -import {NameQuestion} from "../Questions/NameQuestion"; -import {NameInline} from "../Questions/NameInline"; import * as L from "leaflet"; import { PumpManual } from "../Questions/PumpManual"; import FixedName from "../Questions/FixedName"; diff --git a/Customizations/Layouts/BikePumps.ts b/Customizations/Layouts/Cyclofix.ts similarity index 81% rename from Customizations/Layouts/BikePumps.ts rename to Customizations/Layouts/Cyclofix.ts index a797305..26adde7 100644 --- a/Customizations/Layouts/BikePumps.ts +++ b/Customizations/Layouts/Cyclofix.ts @@ -1,13 +1,14 @@ import {Layout} from "../Layout"; import {GrbToFix} from "../Layers/GrbToFix"; import { BikePumps } from "../Layers/BikePumps"; +import { BikeParkings } from "../Layers/BikeParkings"; export class BikePumpsLayout extends Layout { constructor() { super( "pomp", "Grb import fix tool", - [new BikePumps()], + [new BikePumps(), new BikeParkings()], 15, 51.2083, 3.2279, diff --git a/Customizations/Questions/BikeParkingType.ts b/Customizations/Questions/BikeParkingType.ts new file mode 100644 index 0000000..b9d0754 --- /dev/null +++ b/Customizations/Questions/BikeParkingType.ts @@ -0,0 +1,31 @@ +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); + } + +} \ No newline at end of file