mapcomplete/Customizations/Layers/BikePumps.ts

80 lines
2.4 KiB
TypeScript
Raw Normal View History

2020-07-07 16:00:27 +02:00
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";
2020-07-07 16:39:11 +02:00
import { PumpManual } from "../Questions/PumpManual";
import FixedName from "../Questions/FixedName";
2020-07-07 16:00:27 +02:00
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();
2020-07-07 16:39:11 +02:00
this.title = new FixedName("pomp");
2020-07-07 16:00:27 +02:00
this.elementsToShow = [
// new NameQuestion(),
// new AccessTag(),
2020-07-07 16:39:11 +02:00
new OperatorTag(),
new PumpManual()
2020-07-07 16:00:27 +02:00
];
}
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]
})
};
};
}
}