From 75a3a70afa157876dd48667631e18acf0cf0e859 Mon Sep 17 00:00:00 2001 From: Pieter Fiers Date: Tue, 7 Jul 2020 16:00:27 +0200 Subject: [PATCH] Bike pumps added layer & layout --- Customizations/AllKnownLayouts.ts | 2 + Customizations/Layers/BikePumps.ts | 77 +++++++++++++++++++++++++++++ Customizations/Layouts/BikePumps.ts | 23 +++++++++ assets/bike_pump.svg | 1 + index.html | 1 - package.json | 2 +- 6 files changed, 104 insertions(+), 2 deletions(-) create mode 100644 Customizations/Layers/BikePumps.ts create mode 100644 Customizations/Layouts/BikePumps.ts create mode 100644 assets/bike_pump.svg diff --git a/Customizations/AllKnownLayouts.ts b/Customizations/AllKnownLayouts.ts index 9697fd1..6e93bfd 100644 --- a/Customizations/AllKnownLayouts.ts +++ b/Customizations/AllKnownLayouts.ts @@ -3,6 +3,7 @@ import {Toilets} from "./Layouts/Toilets"; import {GRB} from "./Layouts/GRB"; import {Statues} from "./Layouts/Statues"; import {Bookcases} from "./Layouts/Bookcases"; +import { BikePumps } from "./Layers/BikePumps"; export class AllKnownLayouts { public static allSets: any = AllKnownLayouts.AllLayouts(); @@ -11,6 +12,7 @@ export class AllKnownLayouts { const layouts = [ new Groen(), new GRB(), + new BikePumps(), /*new Toilets(), new Statues(), new Bookcases()*/ diff --git a/Customizations/Layers/BikePumps.ts b/Customizations/Layers/BikePumps.ts new file mode 100644 index 0000000..03e0ba8 --- /dev/null +++ b/Customizations/Layers/BikePumps.ts @@ -0,0 +1,77 @@ +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"; + +export class BikePumps extends LayerDefinition { + + constructor() { + super(); + this.name = "pomp"; + this.icon = "./assets/bike_pump.svg"; + + this.overpassFilter = new Or([ + new And([ + new Tag("amenity", "compressed_air"), + new Tag("bicycle", "yes"), + ]) + ] + ); + + + this.newElementTags = [ + new Tag("amenity", "compressed_air"), + new Tag("bicycle", "yes"), + // new Tag("fixme", "Toegevoegd met MapComplete, geometry nog uit te tekenen") + ]; + this.maxAllowedOverlapPercentage = 10; + + this.minzoom = 13; + this.style = this.generateStyleFunction(); + this.title = new NameInline("pomp"); + this.elementsToShow = [ + // new NameQuestion(), + // new AccessTag(), + new OperatorTag() + ]; + + } + + + 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/Layouts/BikePumps.ts b/Customizations/Layouts/BikePumps.ts new file mode 100644 index 0000000..e9d6566 --- /dev/null +++ b/Customizations/Layouts/BikePumps.ts @@ -0,0 +1,23 @@ +import {Layout} from "../Layout"; +import {GrbToFix} from "../Layers/GrbToFix"; +import { BikePumps } from "../Layers/BikePumps"; + +export class GRB extends Layout { + constructor() { + super( + "pomp", + "Grb import fix tool", + [new BikePumps()], + 15, + 51.2083, + 3.2279, + + + "

GRB Fix tool

\n" + + "\n" + + "Expert use only" + + , + "", ""); + } +} \ No newline at end of file diff --git a/assets/bike_pump.svg b/assets/bike_pump.svg new file mode 100644 index 0000000..b4c7c96 --- /dev/null +++ b/assets/bike_pump.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/index.html b/index.html index 8e1ed55..52e1f10 100644 --- a/index.html +++ b/index.html @@ -9,7 +9,6 @@ integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ==" crossorigin=""/> - diff --git a/package.json b/package.json index e02f7d4..1688e2d 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": "parcel build --public-url ./ index.html land.html assets/*", + "build": "rm -rf dist/ && parcel build --public-url ./ index.html land.html assets/*", "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [