2020-06-24 00:35:19 +02:00
|
|
|
import {LayerDefinition} from "../LayerDefinition";
|
2020-08-30 01:13:18 +02:00
|
|
|
import {Or, Tag} from "../../Logic/Tags";
|
2020-07-05 18:59:47 +02:00
|
|
|
import {NameQuestion} from "../Questions/NameQuestion";
|
|
|
|
import {NameInline} from "../Questions/NameInline";
|
2020-07-13 12:10:43 +02:00
|
|
|
import {DescriptionQuestion} from "../Questions/DescriptionQuestion";
|
2020-07-14 20:18:44 +02:00
|
|
|
import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload";
|
2020-07-31 17:38:03 +02:00
|
|
|
import {TagRenderingOptions} from "../TagRenderingOptions";
|
2020-06-24 00:35:19 +02:00
|
|
|
|
|
|
|
export class Park extends LayerDefinition {
|
|
|
|
|
2020-07-08 16:11:40 +02:00
|
|
|
|
2020-07-08 11:23:36 +02:00
|
|
|
private accessByDefault = new TagRenderingOptions({
|
|
|
|
question: "Is dit park publiek toegankelijk?",
|
|
|
|
mappings: [
|
2020-07-08 16:11:40 +02:00
|
|
|
{k: new Tag("access", "yes"), txt: "Publiek toegankelijk"},
|
|
|
|
{k: new Tag("access", ""), txt: "Publiek toegankelijk"},
|
|
|
|
{k: new Tag("access", "no"), txt: "Niet publiek toegankelijk"},
|
2020-07-13 13:17:03 +02:00
|
|
|
{k: new Tag("access", "private"), txt: "Niet publiek toegankelijk, want privaat"},
|
|
|
|
{k: new Tag("access", "guided"), txt: "Enkel toegankelijk met een gids of op een activiteit"},
|
|
|
|
],
|
|
|
|
freeform: {
|
|
|
|
key: "access",
|
|
|
|
renderTemplate: "Dit park is niet toegankelijk: {access}",
|
|
|
|
template: "De toegankelijkheid van dit park is: $$$"
|
|
|
|
},
|
|
|
|
priority: 20
|
2020-07-08 11:23:36 +02:00
|
|
|
})
|
2020-07-08 16:11:40 +02:00
|
|
|
|
|
|
|
private operatorByDefault = new
|
|
|
|
|
|
|
|
TagRenderingOptions({
|
|
|
|
question: "Wie beheert dit park?",
|
|
|
|
freeform: {
|
|
|
|
key: "operator",
|
|
|
|
renderTemplate: "Dit park wordt beheerd door {operator}",
|
|
|
|
template: "$$$",
|
|
|
|
},
|
|
|
|
mappings: [{
|
|
|
|
k: null, txt: "De gemeente beheert dit park"
|
2020-07-13 13:17:03 +02:00
|
|
|
}],
|
|
|
|
priority: 15
|
2020-07-08 16:11:40 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
2020-06-24 00:35:19 +02:00
|
|
|
constructor() {
|
2020-07-31 04:58:58 +02:00
|
|
|
super("park");
|
2020-07-24 14:46:25 +02:00
|
|
|
this.name = "Park";
|
|
|
|
this.icon = undefined;
|
2020-07-05 18:59:47 +02:00
|
|
|
this.overpassFilter =
|
|
|
|
new Or([new Tag("leisure", "park"), new Tag("landuse", "village_green")]);
|
2020-07-29 18:35:46 +02:00
|
|
|
this.presets = [{
|
|
|
|
title: "Park",
|
|
|
|
description: "Voeg een ontbrekend park toe. Een park is een groene ruimte die openbaar is." +
|
|
|
|
"Typisch vind je er banken, vuilbakken, standbeelden, ... ",
|
|
|
|
tags: [new Tag("leisure", "park"),
|
|
|
|
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-13 13:17:03 +02:00
|
|
|
this.elementsToShow = [
|
2020-07-14 20:18:44 +02:00
|
|
|
new ImageCarouselWithUploadConstructor(),
|
2020-07-13 13:17:03 +02:00
|
|
|
new NameQuestion(),
|
2020-07-08 16:11:40 +02:00
|
|
|
this.accessByDefault,
|
2020-07-13 12:10:43 +02:00
|
|
|
this.operatorByDefault,
|
|
|
|
new DescriptionQuestion("park"),
|
2020-07-08 16:07:16 +02:00
|
|
|
|
2020-07-08 11:23:36 +02:00
|
|
|
];
|
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) {
|
2020-07-13 13:17:03 +02:00
|
|
|
if (qd instanceof DescriptionQuestion) {
|
|
|
|
continue;
|
|
|
|
}
|
2020-07-05 18:59:47 +02:00
|
|
|
if (qd.IsQuestioning(properties)) {
|
2020-07-13 12:10:43 +02:00
|
|
|
questionSeverity = Math.max(questionSeverity, qd.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
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|