Finish of the cleanup of themes as json

This commit is contained in:
Pieter Vander Vennet 2020-09-20 23:01:08 +02:00
parent c5b7d66345
commit 165084d4d5
15 changed files with 352 additions and 333 deletions

View file

@ -1,6 +1,5 @@
import {LayerDefinition} from "./LayerDefinition";
import {Layout} from "./Layout";
import {StreetWidth} from "./Layouts/StreetWidth";
import {FromJSON} from "./JSON/FromJSON";
import * as bookcases from "../assets/themes/bookcases/Bookcases.json";
import * as aed from "../assets/themes/aed/aed.json";
@ -13,6 +12,7 @@ import * as buurtnatuur from "../assets/themes/buurtnatuur/buurtnatuur.json"
import * as nature from "../assets/themes/nature/nature.json"
import * as maps from "../assets/themes/maps/maps.json"
import {PersonalLayout} from "../Logic/PersonalLayout";
import {StreetWidth} from "./StreetWidth/StreetWidth";
export class AllKnownLayouts {
@ -39,24 +39,25 @@ export class AllKnownLayouts {
const layout = FromJSON.LayoutFromJSON(buurtnatuur);
layout.enableMoreQuests = false;
layout.enableShareScreen = false;
layout.hideFromOverview = true;
return layout;
}
public static layoutsList: Layout[] = [
new PersonalLayout(),
// new Natuurpunt(),
AllKnownLayouts.GenerateCycloFix(),
FromJSON.LayoutFromJSON(bookcases),
FromJSON.LayoutFromJSON(aed),
FromJSON.LayoutFromJSON(toilets),
FromJSON.LayoutFromJSON(artworks),
FromJSON.LayoutFromJSON(cyclestreets),
AllKnownLayouts.GenerateCycloFix(),
FromJSON.LayoutFromJSON(ghostbikes),
AllKnownLayouts.GenerateBuurtNatuur(),
FromJSON.LayoutFromJSON(nature),
FromJSON.LayoutFromJSON(cyclestreets),
FromJSON.LayoutFromJSON(maps),
AllKnownLayouts.GenerateBuurtNatuur(),
new StreetWidth(),
new StreetWidth(), // The ugly duckling
];

View file

@ -20,6 +20,7 @@ import * as bike_cafes from "../../assets/layers/bike_cafe/bike_cafes.json"
import * as cycling_themed_objects from "../../assets/layers/cycling_themed_object/cycling_themed_objects.json"
import * as bike_shops from "../../assets/layers/bike_shop/bike_shop.json"
import * as maps from "../../assets/layers/maps/maps.json"
import * as information_boards from "../../assets/layers/information_board/information_board.json"
import {Utils} from "../../Utils";
import ImageCarouselWithUploadConstructor from "../../UI/Image/ImageCarouselWithUpload";
import {ImageCarouselConstructor} from "../../UI/Image/ImageCarousel";
@ -47,7 +48,8 @@ export class FromJSON {
FromJSON.Layer(bike_cafes),
FromJSON.Layer(cycling_themed_objects),
FromJSON.Layer(bike_shops),
FromJSON.Layer(maps)
FromJSON.Layer(maps),
FromJSON.Layer(information_boards)
];
for (const layer of sharedLayersList) {

View file

@ -1,121 +0,0 @@
import {LayerDefinition} from "../LayerDefinition";
import {And, Tag} from "../../Logic/Tags";
import {TagRenderingOptions} from "../TagRenderingOptions";
import ImageCarouselWithUploadConstructor from "../../UI/Image/ImageCarouselWithUpload";
export class InformationBoard extends LayerDefinition {
constructor() {
super("informationBoard",{
name: "Informatiebord",
description: "Een informatiebord of kaart",
minzoom: 12,
overpassFilter: new Tag("tourism", "information"),
presets: [{
title: "Informatiebord",
tags: [new Tag("tourism", "information")]
},
{
title: "Kaart",
tags: [new Tag("tourism", "information"), new Tag("information", "map")]
}],
maxAllowedOverlapPercentage: 0,
icon: "assets/nature/info.png",
});
const isMap = new Tag("information", "map");
const isOsmSource = new Tag("map_source", "OpenStreetMap");
this.title = new TagRenderingOptions({
mappings: [
{k: isMap, txt: "Kaart"},
{k:null, txt: "Informatiebord"}
]
});
this.style = (properties) => {
let icon = "assets/nature/info.png";
if (isMap.matchesProperties(properties)) {
icon = "assets/map.svg";
if (isOsmSource.matchesProperties(properties)) {
icon = "assets/osm-logo-white-bg.svg";
const attr = properties["map_source:attribution"];
if (attr == "sticker") {
icon = "assets/map-stickered.svg"
} else if (attr == "no") {
icon = "assets/osm-logo-buggy-attr.svg"
}
}
}
return {
color: "#000000",
icon: {
iconUrl: icon,
iconSize: [50, 50]
}
};
}
this.elementsToShow = [
new ImageCarouselWithUploadConstructor(),
new TagRenderingOptions({
question: "Heeft dit informatiebord een kaart?",
mappings: [
{k: new Tag("information","board"), txt: "Dit is een informatiebord"},
{k: isMap, txt: "Dit is een kaart"}
]
}),
new TagRenderingOptions({
question: "Is this map based on OpenStreetMap?",
mappings: [
{
k: isOsmSource,
txt: "This map is based on OpenStreetMap"
},
{
k: new And([new Tag("map_source:attribution", ""), new Tag("map_source","")]),
txt: "Unknown"
},
],
freeform: {
key: "map_source",
extraTags: new Tag("map_source:attribution", ""),
renderTemplate: "The map data is based on {map_source}",
template: "The map data is based on $$$"
}
}).OnlyShowIf(isMap),
new TagRenderingOptions({
question: "Is the attribution present?",
mappings: [
{
k: new Tag("map_source:attribution", "yes"),
txt: "OpenStreetMap is clearly attributed, including the ODBL-license"
},
{
k: new Tag("map_source:attribution", "incomplete"),
txt: "OpenStreetMap is clearly attributed, but the license is not mentioned"
},
{
k: new Tag("map_source:attribution", "sticker"),
txt: "OpenStreetMap wasn't mentioned, but someone put an OpenStreetMap-sticker on it"
},
{
k: new Tag("map_source:attribution", "no"),
txt: "There is no attribution at all"
},
{
k: new Tag("map_source:attribution", "none"),
txt: "There is no attribution at all"
}
]
}).OnlyShowIf(new Tag("map_source", "OpenStreetMap"))
]
}
}

View file

@ -1,95 +0,0 @@
import {LayerDefinition} from "../LayerDefinition";
import {Or, Tag} from "../../Logic/Tags";
import {NameInline} from "../Questions/NameInline";
import {TagRenderingOptions} from "../TagRenderingOptions";
export class NatureReserves extends LayerDefinition {
constructor(moreQuests: boolean = false) {
super("natureReserve");
this.name = "Natuurgebied";
this.icon = "";
this.overpassFilter =
new Or([new Tag("leisure", "nature_reserve"), new Tag("boundary", "protected_area")]);
this.maxAllowedOverlapPercentage = 10;
this.presets = [{
title: "Natuurreservaat",
description: "Voeg een ontbrekend, erkend natuurreservaat toe, bv. een gebied dat beheerd wordt door het ANB of natuurpunt",
tags: [new Tag("leisure", "nature_reserve"),
new Tag("fixme", "Toegevoegd met MapComplete, geometry nog uit te tekenen")]
}
];
this.minzoom = 13;
this.title = new NameInline("Natuurreservaat");
this.style = function () {
return {
color: "#00bb00",
icon: undefined
};
};
this.elementsToShow = [
];
const extraRenderings = [
new TagRenderingOptions({
question: "Mogen honden in dit natuurgebied?",
mappings: [
{k: new Tag("dog", "leashed"), txt: "Honden moeten aan de leiband"},
{k: new Tag("dog", "no"), txt: "Honden zijn niet toegestaan"},
{k: new Tag("dog", "yes"), txt: "Honden zijn welkom"},
]
}).OnlyShowIf(new Tag("access", "yes")),
new TagRenderingOptions({
question: "Op welke website kunnen we meer informatie vinden over dit natuurgebied?",
freeform: {
key:"website",
renderTemplate: "<a href='{website}' target='_blank'>Meer informatie</a>",
template: "$$$"
}
}),
new TagRenderingOptions({
question: "Wie is de conservator van dit gebied?<br>" +
"<span class='question-subtext'>Geef de naam van de conservator énkel als die duidelijk online staat gepubliceerd.</span>",
freeform: {
renderTemplate: "De conservator van dit gebied is {curator}",
template: "$$$",
key: "curator"
}
}),
new TagRenderingOptions(
{
question: "Wat is het email-adres van de beheerder?<br>" +
"<span class='question-subtext'>Geef bij voorkeur het emailadres van de Natuurpunt-afdeling; geef enkel een email-adres van de conservator als dit duidelijk is gepubliceerd</span>",
freeform: {
renderTemplate: "Bij problemen of vragen, de conservator kan bereikt worden via " +
"<a href='mailto:{email}'>{email}</a>",
template: "$email$",
key: "email"
}
}),
new TagRenderingOptions(
{
question: "Wat is het telefoonnummer van de beheerder?<br>" +
"<span class='question-subtext'>Geef bij voorkeur het telefoonnummer van de Natuurpunt-afdeling; geef enkel een email-adres van de conservator als dit duidelijk is gepubliceerd</span>",
freeform: {
renderTemplate: "Bij problemen of vragen, de {conservator} kan bereikt worden via " +
"<a href='tel:{phone}'>{phone}</a>",
template: "$phone$",
key: "phone"
}
}),
];
if (moreQuests) {
this.elementsToShow =
this.elementsToShow.concat(extraRenderings);
}
}
}

View file

@ -1,21 +0,0 @@
import {Layout} from "../Layout";
import {InformationBoard} from "../Layers/InformationBoard";
import {NatureReserves} from "../Layers/NatureReserves";
export class Natuurpunt extends Layout{
constructor() {
super(
"natuurpunt",
["nl"],
"De natuur in",
["birdhides", new InformationBoard(), new NatureReserves(true), "drinking_water"],
12,
51.20875,
3.22435,
"<h3>Natuurstuff</h3>Geef meer gegevens over natuurgebieden en hun infoborden",
"",
""
);
this.icon = "./assets/layers/bird_hide/birdhide.svg"
}
}

View file

@ -1,5 +1,5 @@
import {Layout} from "../Layout";
import {Widths} from "../Layers/Widths";
import {Widths} from "./Widths";
export class StreetWidth extends Layout{

View file

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View file

@ -0,0 +1,46 @@
{
"id": "information_boards",
"name": {
"nl": "Informatieborden",
"en": "Information boards"
},
"minzoom": 12,
"overpassTags": {
"and": [
"information=board"
]
},
"title": {
"render": {
"nl": "Informatiebord",
"en": "Information board"
}
},
"description": {},
"tagRenderings": [],
"hideUnderlayingFeaturesMinPercentage": 0,
"icon": {
"render": "./assets/layers/information_board/board.svg"
},
"width": {
"render": "8"
},
"iconSize": {
"render": "40,40,center"
},
"color": {
"render": "#00f"
},
"presets": [
{
"tags": [
"tourism=information",
"information=board"
],
"title": {
"nl": "Informatiebord",
"en": "Information board"
}
}
]
}

View file

@ -40,7 +40,295 @@
"description": {
"nl": "Een natuurgebied is een gebied waar actief ruimte gemaakt word voor de natuur. Typisch zijn deze in beheer van Natuurpunt of het Agentschap Natuur en Bos of zijn deze erkend door de overheid."
},
"tagRenderings": [],
"tagRenderings": [
{
"#": "Access tag",
"render": {
"nl": "De toegankelijkheid van dit gebied is: {access:description}"
},
"question": {
"nl": "Is dit gebied toegankelijk?"
},
"freeform": {
"key": "access:description"
},
"mappings": [
{
"if": {
"and": [
"access=yes",
"fee="
]
},
"then": {
"nl": "Vrij toegankelijk"
}
},
{
"if": {
"and": [
"access=no",
"fee="
]
},
"then": {
"nl": "Niet toegankelijk"
}
},
{
"if": {
"and": [
"access=private",
"fee="
]
},
"then": {
"nl": "Niet toegankelijk, want privégebied"
}
},
{
"if": {
"and": [
"access=permissive",
"fee="
]
},
"then": {
"nl": "Toegankelijk, ondanks dat het privegebied is"
}
},
{
"if": {
"and": [
"access=guided",
"fee="
]
},
"then": {
"nl": "Enkel toegankelijk met een gids of tijdens een activiteit"
}
},
{
"if": {
"and": [
"access=yes",
"fee=yes"
]
},
"then": {
"nl": "Toegankelijk mits betaling"
}
}
]
},
{
"#": "Operator tag",
"render": {
"nl": "Beheer door {operator}"
},
"question": {
"nl": "Wie beheert dit gebied?"
},
"freeform": {
"key": "operator"
},
"mappings": [
{
"if": {
"and": [
"operator=Natuurpunt"
]
},
"then": {
"nl": "<img src=\"./assets/themes/buurtnatuur/Natuurpunt.jpg\" style=\"width:1.5em\">Dit gebied wordt beheerd door Natuurpunt"
}
},
{
"if": {
"and": [
"operator~(n|N)atuurpunt.*"
]
},
"then": {
"nl": "<img src=\"./assets/themes/buurtnatuur/Natuurpunt.jpg\" style=\"width:1.5em\">Dit gebied wordt beheerd door {operator}"
},
"hideInAnswer": true
},
{
"if": {
"and": [
"operator=Agentschap Natuur en Bos"
]
},
"then": {
"nl": "<img src=\"./assets/themes/buurtnatuur/ANB.jpg\" style=\"width:1.5em\">Dit gebied wordt beheerd door het Agentschap Natuur en Bos"
}
}
]
},
{
"#": "Name:nl-tag",
"render": {
"nl": "Dit gebied heet {name:nl}"
},
"question": {
"nl": "Wat is de Nederlandstalige naam van dit gebied?"
},
"freeform": {
"key": "name:nl"
},
"condition": {
"and": [
"name:nl~*"
]
}
},
{
"#": "Name tag",
"render": {
"nl": "Dit gebied heet {name}"
},
"question": {
"nl": "Wat is de naam van dit gebied?"
},
"freeform": {
"key": "name",
"addExtraTags": [
"noname="
]
},
"condition": {
"and": [
"name:nl="
]
},
"mappings": [
{
"if": {
"and": [
"noname=yes",
"name="
]
},
"then": {
"nl": "Dit gebied heeft geen naam"
}
}
]
},
{
"#": "Dogs?",
"question": {
"nl": "Zijn honden toegelaten in dit gebied?",
"en": "Are dogs allowed in this nature reserve?"
},
"condition": {
"or": [
"access=yes",
"access=permissive",
"access=guided"
]
},
"mappings": [
{
"if": "dog=leashed",
"then": {
"nl": "Honden moeten aan de leiband",
"en": "Dogs have to be leashed"
}
},
{
"if": "dog=no",
"then": {
"nl": "Honden zijn niet toegestaan",
"en": "No dogs allowed"
}
},
{
"if": "dog=yes",
"then": {
"nl": "Honden zijn welkom en mogen vrij rondlopen",
"en": "Dogs are allowed to roam freely"
}
}
]
},
{
"#": "Website",
"question": {
"en": "On which webpage can one find more information about this nature reserve?",
"nl": "Op welke webpagina kan men meer informatie vinden over dit natuurgebied?"
},
"render": "<a href='{website}'target='_blank'>{website}</a>",
"freeform": {
"key": "website",
"type": "url"
}
},
{
"#": "Curator",
"question": {
"nl": "Wie is de conservator van dit gebied?<br/><span class='subtle'>Respecteer privacy - geef deze naam enkel als die duidelijk is gepubliceerd",
"en": "Whom is the curator of this nature reserve?<br/><span class='subtle'>Respect privacy - only fill out a name if this is widely published"
},
"render": {
"nl": "{curator} is de beheerder van dit gebied",
"en": "{curator} is the curator of this nature reserve"
},
"freeform": {
"key": "curator"
}
},
{
"#": "Email",
"question": {
"nl": "Waar kan men naartoe emailen voor vragen en meldingen van dit natuurgebied?<br/><span class='subtle'>Respecteer privacy - geef enkel persoonlijke emailadressen als deze elders zijn gepubliceerd",
"en": "What email adress can one send to with questions and problems with this nature reserve?<br/><span class='subtle'>Respect privacy - only fill out a personal email address if this is widely published"
},
"render": {
"nl": "<a href='mailto:{email}' target='_blank'>{email}</a>",
"en": "<a href='mailto:{email}' target='_blank'>{email}</a>"
},
"freeform": {
"key": "email",
"type": "email"
}
},
{
"#": "phone",
"question": {
"nl": "Waar kan men naartoe bellen voor vragen en meldingen van dit natuurgebied?<br/><span class='subtle'>Respecteer privacy - geef enkel persoonlijke telefoonnummers als deze elders zijn gepubliceerd",
"en": "What phone number can one call to with questions and problems with this nature reserve?<br/><span class='subtle'>Respect privacy - only fill out a personal phone number address if this is widely published"
},
"render": {
"nl": "<a href='tel:{email}' target='_blank'>{phone}</a>",
"en": "<a href='tel:{email}' target='_blank'>{phone}</a>"
},
"freeform": {
"key": "phone",
"type": "phone"
}
},
{
"#": "Non-editable description {description}",
"render": {
"nl": "Extra info: <i>{description}</i>"
},
"freeform": {
"key": "description"
}
},
{
"#": "Editable description {description:0}",
"question": "Is er extra info die je kwijt wil?",
"render": {
"nl": "Extra info: <i>{description:0}</i>"
},
"freeform": {
"key": "description:0"
}
}
],
"hideUnderlayingFeaturesMinPercentage": 10,
"icon": {
"render": "./assets/themes/buurtnatuur/nature_reserve.svg"

View file

@ -1,83 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
width="14"
height="14"
viewBox="0 0 14 14"
id="svg2"
sodipodi:docname="guidepost.svg"
inkscape:version="0.92.4 (5da689c313, 2019-01-14)">
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1001"
id="namedview7"
showgrid="false"
inkscape:zoom="33.714286"
inkscape:cx="11.006743"
inkscape:cy="3.62286"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" />
<metadata
id="metadata8">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs6" />
<rect
width="14"
height="14"
x="0"
y="0"
id="canvas"
style="fill:none;stroke:none;visibility:hidden" />
<g
inkscape:groupmode="layer"
id="layer1"
inkscape:label="bg"
style="display:inline">
<circle
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:32.77777863;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path820"
cx="7"
cy="7"
r="7" />
</g>
<g
inkscape:groupmode="layer"
id="layer2"
inkscape:label="fg"
sodipodi:insensitive="true">
<path
d="m 7.2669492,1.9396186 c -0.282839,0 -0.565678,0.1885594 -0.565678,0.565678 v 9.8050844 h 1.131356 V 2.5052966 c 0,-0.3771186 -0.282839,-0.565678 -0.565678,-0.565678 z M 3.4957628,2.5052966 1.9872882,3.6366525 3.4957628,4.7680085 H 6.5127119 V 2.5052966 Z M 8.0211865,4.7680085 V 7.0307203 H 11.038135 L 12.54661,5.8993644 11.038135,4.7680085 Z"
id="guidepost"
style="fill:#555555;fill-opacity:1;stroke:none;stroke-width:0.75423729"
inkscape:connector-curvature="0" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

View file

@ -1,6 +1,7 @@
{
"id": "buurtnatuur",
"title": {
"#": "DO NOT TRANSLATE THIS THEME - this one is only meant to be in dutch!",
"nl": "Breng jouw buurtnatuur in kaart"
},
"shortDescription": {

View file

@ -1,12 +1,12 @@
{
"id": "maps",
"title": {
"en": "Information boards",
"nl": "Informatieborden en kaarten"
"en": "A map of maps",
"nl": "Een kaart met Kaarten"
},
"shortDescription": {
"en": "A map of maps and information boards",
"nl": "Een kaart met kaarten en informatieborden"
"en": "On this map, all the maps known by OpenStreetMap are shown",
"nl": "Een kaart met alle kaarten die OpenStreetMap kent"
},
"description": {
"en": "On this map you can find all maps OpenStreetMap knows.<br/><br/>If a map is missing, you can easily map this map on OpenStreetMap.",

View file

@ -24,6 +24,7 @@
"drinking_water",
"birdhides",
"maps",
"information_boards",
"nature_reserves"
],
"roamingRenderings": []