2020-07-13 17:16:12 +02:00
|
|
|
import {LayerDefinition} from "../LayerDefinition";
|
2020-07-16 14:21:06 +02:00
|
|
|
import {And, Tag, TagsFilter} from "../../Logic/TagsFilter";
|
2020-07-13 17:16:12 +02:00
|
|
|
import * as L from "leaflet";
|
|
|
|
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";
|
2020-07-16 09:54:32 +02:00
|
|
|
import FixedText from "../Questions/FixedText";
|
|
|
|
import {BikePumpManometer} from "../Questions/BikePumpManometer";
|
|
|
|
import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload";
|
2020-07-16 14:21:06 +02:00
|
|
|
import {BikePumpOperationalStatus} from "../Questions/BikePumpOperationalStatus";
|
2020-07-13 17:16:12 +02:00
|
|
|
|
|
|
|
export default class BikeServices extends LayerDefinition {
|
2020-07-16 14:21:06 +02:00
|
|
|
|
|
|
|
|
|
|
|
private readonly pump: TagsFilter = new Tag("service:bicycle:pump", "yes");
|
|
|
|
private readonly tools: TagsFilter = new Tag("service:bicycle:tools", "yes");
|
|
|
|
|
2020-07-13 17:16:12 +02:00
|
|
|
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();
|
2020-07-16 09:54:32 +02:00
|
|
|
this.title = new FixedText("Bike station");
|
|
|
|
|
|
|
|
|
2020-07-13 17:16:12 +02:00
|
|
|
this.elementsToShow = [
|
2020-07-16 09:54:32 +02:00
|
|
|
|
|
|
|
new ImageCarouselWithUploadConstructor(),
|
|
|
|
|
|
|
|
|
2020-07-13 17:16:12 +02:00
|
|
|
new BikeStationPumpTools(),
|
2020-07-16 14:21:06 +02:00
|
|
|
new BikeStationChain().OnlyShowIf(this.tools),
|
|
|
|
new BikeStationStand().OnlyShowIf(this.tools),
|
2020-07-16 09:54:32 +02:00
|
|
|
|
2020-07-16 14:21:06 +02:00
|
|
|
new PumpManual().OnlyShowIf(this.pump),
|
|
|
|
new BikePumpManometer().OnlyShowIf(this.pump),
|
|
|
|
new BikePumpOperationalStatus().OnlyShowIf(this.pump),
|
2020-07-16 09:54:32 +02:00
|
|
|
|
2020-07-13 17:16:12 +02:00
|
|
|
new BikeStationOperator(),
|
|
|
|
new BikeStationBrand()
|
|
|
|
];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private generateStyleFunction() {
|
|
|
|
const self = this;
|
|
|
|
return function (properties: any) {
|
2020-07-16 14:21:06 +02:00
|
|
|
const onlyPump = self.pump.matchesProperties(properties) &&
|
|
|
|
!self.tools.matchesProperties(properties)
|
2020-07-13 17:16:12 +02:00
|
|
|
const iconUrl = onlyPump ? "./assets/pump.svg" : "./assets/wrench.svg"
|
|
|
|
return {
|
|
|
|
color: "#00bb00",
|
|
|
|
icon: new L.icon({
|
|
|
|
iconUrl: iconUrl,
|
|
|
|
iconSize: [40, 40]
|
|
|
|
})
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|