diff --git a/Customizations/AllKnownLayouts.ts b/Customizations/AllKnownLayouts.ts index 9a8728e..7f1c558 100644 --- a/Customizations/AllKnownLayouts.ts +++ b/Customizations/AllKnownLayouts.ts @@ -1,22 +1,24 @@ -import {Groen} from "./Layouts/Groen"; -import {Toilets} from "./Layouts/Toilets"; -import {GRB} from "./Layouts/GRB"; -import {Statues} from "./Layouts/Statues"; -import {Bookcases} from "./Layouts/Bookcases"; +import { Groen } from "./Layouts/Groen"; +import { Toilets } from "./Layouts/Toilets"; +import { GRB } from "./Layouts/GRB"; +import { Statues } from "./Layouts/Statues"; +import { Bookcases } from "./Layouts/Bookcases"; import Cyclofix from "./Layouts/Cyclofix"; -import {All} from "./Layouts/All"; -import {Layout} from "./Layout"; +import { WalkByBrussels } from "./Layouts/WalkByBrussels"; +import { All } from "./Layouts/All"; +import { Layout } from "./Layout"; export class AllKnownLayouts { public static allSets: any = AllKnownLayouts.AllLayouts(); - private static AllLayouts() : any{ + private static AllLayouts(): any { const all = new All(); - const layouts : Layout[] = [ + const layouts: Layout[] = [ new Groen(), new GRB(), new Cyclofix(), new Bookcases(), + new WalkByBrussels(), all /*new Toilets(), new Statues(), @@ -29,4 +31,13 @@ export class AllKnownLayouts { } return allSets; } + + public static GetSets(layoutNames): any { + const all = new All(); + for (const name of layoutNames) { + all.layers = all.layers.concat(AllKnownLayouts.allSets[name].layers); + } + + return all; + } } diff --git a/Customizations/Layers/DrinkingWater.ts b/Customizations/Layers/DrinkingWater.ts new file mode 100644 index 0000000..56984a3 --- /dev/null +++ b/Customizations/Layers/DrinkingWater.ts @@ -0,0 +1,61 @@ +import { LayerDefinition } from "../LayerDefinition"; +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 { TagRenderingOptions } from "../TagRendering"; +import { ImageCarouselWithUploadConstructor } from "../../UI/Image/ImageCarouselWithUpload"; + +export class DrinkingWaterLayer extends LayerDefinition { + + constructor() { + super(); + this.name = "drinking_water"; + this.icon = "./assets/bug.svg"; + + this.overpassFilter = new Or([ + new And([ + new Tag("amenity", "drinking_water") + ]) + ]); + + + this.newElementTags = [ + new Tag("amenity", "drinking_water"), + ]; + this.maxAllowedOverlapPercentage = 10; + + this.minzoom = 13; + this.style = this.generateStyleFunction(); + this.title = new FixedText("Drinking water"); + this.elementsToShow = [ + new OperatorTag(), + new BikeParkingType() + ]; + this.elementsToShow = [new ImageCarouselWithUploadConstructor(), new TagRenderingOptions({ + question: "How easy is it to fill water bottles?", + mappings: [ + { k: new Tag("bottle", "yes"), txt: "It is easy to refill water bottles" }, + { k: new Tag("bottle", "no"), txt: "Water bottles may not fit" } + ], + })]; + + } + + + private generateStyleFunction() { + const self = this; + return function (properties: any) { + + return { + color: "#00bb00", + icon: new L.icon({ + iconUrl: self.icon, + iconSize: [40, 40] + }) + }; + }; + } + +} \ No newline at end of file diff --git a/Customizations/Layouts/WalkByBrussels.ts b/Customizations/Layouts/WalkByBrussels.ts new file mode 100644 index 0000000..88126a1 --- /dev/null +++ b/Customizations/Layouts/WalkByBrussels.ts @@ -0,0 +1,29 @@ +import { Layout } from "../Layout"; +import { DrinkingWaterLayer } from "../Layers/DrinkingWater"; +import { NatureReserves } from "../Layers/NatureReserves"; +import { Park } from "../Layers/Park"; +import { BikeParkings } from "../Layers/BikeParkings"; + +export class WalkByBrussels extends Layout { + constructor() { + super("walkbybrussels", + "Drinking Water Spots", + [new DrinkingWaterLayer(), new BikeParkings(), new Park(), new NatureReserves()], + 10, + 50.8435, + 4.3688, + + + "
" + + "Help with creating a map of drinking water points!" + + , + "
Start by creating an account\n" + + " or by " + + " logging in.
", + "Start by clicking a pin and answering the questions"); + } + +} \ No newline at end of file diff --git a/Logic/FilteredLayer.ts b/Logic/FilteredLayer.ts index 87ba7c6..ee936f7 100644 --- a/Logic/FilteredLayer.ts +++ b/Logic/FilteredLayer.ts @@ -1,11 +1,11 @@ -import {Basemap} from "./Basemap"; -import {TagsFilter, TagUtils} from "./TagsFilter"; -import {UIEventSource} from "../UI/UIEventSource"; -import {ElementStorage} from "./ElementStorage"; -import {Changes} from "./Changes"; +import { Basemap } from "./Basemap"; +import { TagsFilter, TagUtils } from "./TagsFilter"; +import { UIEventSource } from "../UI/UIEventSource"; +import { ElementStorage } from "./ElementStorage"; +import { Changes } from "./Changes"; import L from "leaflet" -import {GeoOperations} from "./GeoOperations"; -import {UIElement} from "../UI/UIElement"; +import { GeoOperations } from "./GeoOperations"; +import { UIElement } from "../UI/UIElement"; /*** * A filtered layer is a layer which offers a 'set-data' function @@ -20,6 +20,7 @@ export class FilteredLayer { public readonly name: string; public readonly filters: TagsFilter; + public readonly isDisplayed: UIEventSource