2020-06-24 00:35:19 +02:00
|
|
|
import {LayerDefinition} from "../LayerDefinition";
|
2020-07-05 18:59:47 +02:00
|
|
|
import {Quests} from "../../Quests";
|
|
|
|
import {And, Or, Tag} from "../../Logic/TagsFilter";
|
|
|
|
import {AccessTag} from "../Questions/AccessTag";
|
|
|
|
import {OperatorTag} from "../Questions/OperatorTag";
|
|
|
|
import {TagRenderingOptions} from "../TagRendering";
|
|
|
|
import {NameQuestion} from "../Questions/NameQuestion";
|
|
|
|
import {NameInline} from "../Questions/NameInline";
|
2020-06-24 00:35:19 +02:00
|
|
|
|
|
|
|
export class Park extends LayerDefinition {
|
|
|
|
|
2020-07-08 11:23:36 +02:00
|
|
|
|
|
|
|
private accessByDefault = new TagRenderingOptions({
|
|
|
|
question: "Is dit park publiek toegankelijk?",
|
|
|
|
mappings: [
|
|
|
|
{k: new Tag("access","yes"), txt: "Publiek toegankelijk"},
|
|
|
|
{k: new Tag("access",""), txt: "Publiek toegankelijk"},
|
|
|
|
{k: new Tag("access","no"), txt: "Niet-publiek toegankelijk park"},
|
|
|
|
{k: new Tag("access","guided"), txt: "Enkel toegankelijk met een gids of op een activiteit"}
|
|
|
|
]
|
|
|
|
})
|
|
|
|
|
|
|
|
|
2020-06-24 00:35:19 +02:00
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
this.name = "park";
|
|
|
|
this.icon = "./assets/tree_white_background.svg";
|
2020-07-05 18:59:47 +02:00
|
|
|
this.overpassFilter =
|
|
|
|
new Or([new Tag("leisure", "park"), new Tag("landuse", "village_green")]);
|
|
|
|
this.newElementTags = [new Tag("leisure", "park"),
|
2020-06-24 00:35:19 +02:00
|
|
|
new Tag("fixme", "Toegevoegd met MapComplete, geometry nog uit te tekenen")];
|
2020-06-28 23:33:48 +02:00
|
|
|
this.maxAllowedOverlapPercentage = 25;
|
2020-06-24 00:35:19 +02:00
|
|
|
|
|
|
|
this.minzoom = 13;
|
|
|
|
this.style = this.generateStyleFunction();
|
2020-07-05 18:59:47 +02:00
|
|
|
this.title = new NameInline("park");
|
2020-07-08 11:23:36 +02:00
|
|
|
this.elementsToShow = [new NameQuestion(),
|
|
|
|
this.accessByDefault
|
|
|
|
|
|
|
|
];
|
2020-06-24 00:35:19 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-07-01 17:38:48 +02:00
|
|
|
|
2020-06-24 00:35:19 +02:00
|
|
|
|
|
|
|
private generateStyleFunction() {
|
|
|
|
const self = this;
|
|
|
|
return function (properties: any) {
|
|
|
|
let questionSeverity = 0;
|
2020-07-05 18:59:47 +02:00
|
|
|
for (const qd of self.elementsToShow) {
|
|
|
|
if (qd.IsQuestioning(properties)) {
|
|
|
|
questionSeverity = Math.max(questionSeverity, qd.options.priority ?? 0);
|
2020-06-24 00:35:19 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
let colormapping = {
|
|
|
|
0: "#00bb00",
|
|
|
|
1: "#00ff00",
|
|
|
|
10: "#dddd00",
|
|
|
|
20: "#ff0000"
|
|
|
|
};
|
|
|
|
|
|
|
|
let colour = colormapping[questionSeverity];
|
|
|
|
while (colour == undefined) {
|
|
|
|
questionSeverity--;
|
2020-07-05 18:59:47 +02:00
|
|
|
colour = colormapping[questionSeverity];
|
2020-06-24 00:35:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
color: colour,
|
2020-07-01 17:38:48 +02:00
|
|
|
icon: undefined
|
2020-06-24 00:35:19 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|