mapcomplete/Customizations/Layers/Artwork.ts

88 lines
3 KiB
TypeScript
Raw Normal View History

2020-06-24 00:35:19 +02:00
import {LayerDefinition} from "../LayerDefinition";
2020-07-05 18:59:47 +02:00
import {Tag} from "../../Logic/TagsFilter";
2020-06-24 00:35:19 +02:00
import L from "leaflet";
2020-07-30 09:59:30 +02:00
import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload";
import Translations from "../../UI/i18n/Translations";
import Website from "../Questions/Website";
import FixedText from "../Questions/FixedText";
2020-07-31 17:38:03 +02:00
import {TagRenderingOptions} from "../TagRenderingOptions";
2020-06-24 00:35:19 +02:00
export class Artwork extends LayerDefinition {
constructor() {
2020-07-31 04:58:58 +02:00
super("artwork");
2020-06-24 00:35:19 +02:00
this.name = "artwork";
2020-07-30 09:59:30 +02:00
const t = Translations.t.artwork;
this.title = t.title;
const tag = new Tag("tourism", "artwork");
this.presets = [
{
title: this.title,
tags: [tag]
}
];
2020-06-24 00:35:19 +02:00
this.icon = "./assets/statue.svg";
2020-07-30 09:59:30 +02:00
this.overpassFilter = tag;
2020-06-24 00:35:19 +02:00
this.minzoom = 13;
2020-07-30 09:59:30 +02:00
const to = Translations.t.artwork.type;
const artworkType = new TagRenderingOptions({
priority: 5,
question: to.question,
freeform: {
key: "artwork_type",
extraTags: new Tag("fixme", "Freeform artwork_type= tag used: possibly a wrong value"),
template: to.template.txt,
renderTemplate: to.render.txt,
placeholder: Translations.t.cyclofix.freeFormPlaceholder,
},
mappings: [
{k: new Tag("artwork_type", "architecture"), txt: to.architecture},
{k: new Tag("artwork_type", "mural"), txt: to.mural},
{k: new Tag("artwork_type", "painting"), txt: to.painting},
{k: new Tag("artwork_type", "sculpture"), txt: to.sculpture},
{k: new Tag("artwork_type", "statue"), txt: to.statue},
{k: new Tag("artwork_type", "bust"), txt: to.bust},
{k: new Tag("artwork_type", "stone"), txt: to.stone},
{k: new Tag("artwork_type", "installation"), txt: to.installation},
{k: new Tag("artwork_type", "graffiti"), txt: to.graffiti},
{k: new Tag("artwork_type", "relief"), txt: to.relief},
{k: new Tag("artwork_type", "azulejo"), txt: to.azulejo},
{k: new Tag("artwork_type", "tilework"), txt: to.tilework}
]
});
const artistQuestion = new TagRenderingOptions({
question: t.artist.question,
freeform: {
key: "artist_name",
2020-07-30 09:59:30 +02:00
template: "$$$",
renderTemplate: "{artist_name}"
2020-07-30 09:59:30 +02:00
}
});
this.elementsToShow = [
new ImageCarouselWithUploadConstructor(),
artworkType,
artistQuestion,
new Website(t.title)
2020-06-24 00:35:19 +02:00
];
2020-07-30 09:59:30 +02:00
2020-06-24 00:35:19 +02:00
this.style = function (tags) {
return {
2020-07-30 09:59:30 +02:00
icon: {
iconUrl: "./assets/statue.svg",
2020-06-24 00:35:19 +02:00
iconSize: [40, 40],
2020-07-30 09:59:30 +02:00
},
2020-07-05 18:59:47 +02:00
color: "#0000ff"
2020-06-24 00:35:19 +02:00
};
}
}
}