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);
}
}
}

7
assets/parking.svg Normal file
View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Svg Vector Icons : http://www.onlinewebfonts.com/icon -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve">
<metadata> Svg Vector Icons : http://www.onlinewebfonts.com/icon </metadata>
<g><path d="M500,10C229.4,10,10,229.4,10,500s219.4,490,490,490s490-219.4,490-490S770.6,10,500,10z M500,941C256.4,941,59,743.6,59,500S256.4,59,500,59s441,197.4,441,441S743.6,941,500,941z"/><path d="M296.4,831.8V215.3h196.5c73.9,0,113.9,3.8,136.3,9.8c34.5,9,64.4,30.6,87.6,60.8c23.3,30.2,33.9,72.4,33.9,120.2c0,36.9-6.7,74.7-20.1,99.9c-13.4,25.2-30.4,47.2-51.1,61.6c-20.7,14.4-41.7,23.9-63,28.5c-29,5.7-62.9,8.6-117.9,8.6h-87.1v227H296.4z M411.6,311.9v194.2H493c50.8,1.1,79.9-3.1,96-9.4c16.1-6.3,28.8-21.8,38-35.3c9.2-13.4,13.8-35.7,13.8-53.5c0-21.9-6.4-51-19.3-65.2c-12.9-14.2-29.1-23.1-48.8-26.7c-14.5-2.7-43.6-4.1-87.4-4.1L411.6,311.9L411.6,311.9L411.6,311.9z"/></g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

7
assets/wrench.svg Normal file
View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 -256 1792 1792"><script xmlns="" id="__gaOptOutExtension"/>
<g transform="matrix(1,0,0,-1,53.152542,1217.0847)">
<path d="m 384,64 q 0,26 -19,45 -19,19 -45,19 -26,0 -45,-19 -19,-19 -19,-45 0,-26 19,-45 19,-19 45,-19 26,0 45,19 19,19 19,45 z m 644,420 -682,-682 q -37,-37 -90,-37 -52,0 -91,37 L 59,-90 Q 21,-54 21,0 21,53 59,91 L 740,772 Q 779,674 854.5,598.5 930,523 1028,484 z m 634,435 q 0,-39 -23,-106 Q 1592,679 1474.5,595.5 1357,512 1216,512 1031,512 899.5,643.5 768,775 768,960 q 0,185 131.5,316.5 131.5,131.5 316.5,131.5 58,0 121.5,-16.5 63.5,-16.5 107.5,-46.5 16,-11 16,-28 0,-17 -16,-28 L 1152,1120 V 896 l 193,-107 q 5,3 79,48.5 74,45.5 135.5,81 61.5,35.5 70.5,35.5 15,0 23.5,-10 8.5,-10 8.5,-25 z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 972 B