Added bike services layer and questions

This commit is contained in:
Pieter Fiers 2020-07-13 17:16:12 +02:00
parent 19614369ba
commit 7e2904d3c0
13 changed files with 188 additions and 108 deletions

View file

@ -10,15 +10,8 @@ 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.icon = "./assets/parking.svg";
this.overpassFilter = new Tag("amenity", "bicycle_parking");
this.newElementTags = [
new Tag("amenity", "bicycle_parking"),
];
@ -26,7 +19,7 @@ export class BikeParkings extends LayerDefinition {
this.minzoom = 13;
this.style = this.generateStyleFunction();
this.title = new FixedName("fietsparking");
this.title = new FixedName("Fietsparking");
this.elementsToShow = [
new OperatorTag(),
new BikeParkingType()
@ -62,7 +55,7 @@ export class BikeParkings extends LayerDefinition {
color: "#00bb00",
icon: new L.icon({
iconUrl: self.icon,
iconSize: [40, 40]
iconSize: [30, 30]
})
};
};

View file

@ -1,77 +0,0 @@
import {LayerDefinition} from "../LayerDefinition";
import {And, Or, Tag} from "../../Logic/TagsFilter";
import {OperatorTag} from "../Questions/OperatorTag";
import * as L from "leaflet";
import { PumpManual } from "../Questions/PumpManual";
import FixedName from "../Questions/FixedName";
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 FixedName("pomp");
this.elementsToShow = [
// new NameQuestion(),
// new AccessTag(),
new OperatorTag(),
new PumpManual()
];
}
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]
})
};
};
}
}

View file

@ -0,0 +1,56 @@
import {LayerDefinition} from "../LayerDefinition";
import {And, Tag} from "../../Logic/TagsFilter";
import * as L from "leaflet";
import FixedName from "../Questions/FixedName";
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";
export default class BikeServices extends LayerDefinition {
constructor() {
super();
this.name = "bike station or pump";
this.icon = "./assets/wrench.svg";
this.overpassFilter = new And([
new Tag("amenity", "bicycle_repair_station")
]);
this.newElementTags = [
new Tag("amenity", "bicycle_repair_station")
// new Tag("fixme", "Toegevoegd met MapComplete, geometry nog uit te tekenen")
];
this.maxAllowedOverlapPercentage = 10;
this.minzoom = 13;
this.style = this.generateStyleFunction();
this.title = new FixedName("Bike station");
this.elementsToShow = [
new BikeStationPumpTools(),
new BikeStationChain().OnlyShowIf(new Tag("service:bicycle:tools", "yes")),
new BikeStationStand().OnlyShowIf(new Tag("service:bicycle:tools", "yes")),
new PumpManual().OnlyShowIf(new Tag("service:bicycle:pump", "yes")),
new BikeStationOperator(),
new BikeStationBrand()
];
}
private generateStyleFunction() {
const self = this;
return function (properties: any) {
const onlyPump = properties["service:bicycle:tools"] == "no" && properties["service:bicycle:pump"] == "yes";
const iconUrl = onlyPump ? "./assets/pump.svg" : "./assets/wrench.svg"
return {
color: "#00bb00",
icon: new L.icon({
iconUrl: iconUrl,
iconSize: [40, 40]
})
};
};
}
}

View file

@ -1,17 +1,17 @@
import {Layout} from "../Layout";
import {GrbToFix} from "../Layers/GrbToFix";
import { BikePumps } from "../Layers/BikePumps";
import { BikeParkings } from "../Layers/BikeParkings";
import BikeServices from "../Layers/BikeServices";
export default class Cyclofix extends Layout {
constructor() {
super(
"pomp",
"Grb import fix tool",
[new BikePumps(), new BikeParkings()],
15,
51.2083,
3.2279,
"Cyclofix bicycle infrastructure",
[new BikeParkings(), new BikeServices()],
16,
50.8465573,
4.3516970,
"<h3>Cyclofix bicycle infrastructure</h3>\n" +

View file

@ -3,8 +3,6 @@ import {Tag} from "../../Logic/TagsFilter";
export class BikeParkingType extends TagRenderingOptions {
private static options = {
priority: 5,
question: "Van welk type is deze fietsenparking?",
@ -27,5 +25,4 @@ export class BikeParkingType extends TagRenderingOptions {
constructor() {
super(BikeParkingType.options);
}
}
}

View file

@ -0,0 +1,22 @@
import {TagRenderingOptions} from "../TagRendering";
import {Tag} from "../../Logic/TagsFilter";
export default class BikeStationBrand extends TagRenderingOptions {
private static options = {
priority: 15,
question: "What is the brand of this bike station (name of university, shop, city...)?",
freeform: {
key: "brand",
template: "The brand of this bike station is $$$",
renderTemplate: "The brand of this bike station is {operator}",
placeholder: "brand"
},
mappings: [
{k: new Tag("brand", "Velo Fix Station"), txt: "Velo Fix Station"}
]
}
constructor() {
super(BikeStationBrand.options);
}
}

View file

@ -0,0 +1,18 @@
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);
}
}

View file

@ -0,0 +1,25 @@
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", "private"), txt: "Beheer door een privépersoon"}
]
}
constructor() {
super(BikeStationOperator.options);
}
}

View file

@ -0,0 +1,19 @@
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);
}
}

View file

@ -0,0 +1,18 @@
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);
}
}

View file

@ -1,23 +1,18 @@
import {TagRenderingOptions} from "../TagRendering";
import {UIEventSource} from "../../UI/UIEventSource";
import {Changes} from "../../Logic/Changes";
import {Tag} from "../../Logic/TagsFilter";
export class PumpManual extends TagRenderingOptions {
export default class PumpManual extends TagRenderingOptions {
private static options = {
priority: 5,
question: "Is dit een manuele pomp?",
question: "Is the pump at this bike station manual or automatic (compressed air)?",
mappings: [
{k: new Tag("manual", "yes"), txt: "Manuele pomp"},
{k: new Tag("manual", "no"), txt: "Automatische pomp"}
{k: new Tag("manual", "yes"), txt: "Manual"},
{k: new Tag("manual", "no"), txt: "Automatic (with compressed air)"}
]
}
constructor() {
super(PumpManual.options);
}
}
}