Customizations/AllKnownLayers.ts

This commit is contained in:
pietervdvn 2021-03-10 20:18:05 +01:00
parent 5b39ba9a32
commit 8c5d4ed78f
3 changed files with 31 additions and 105 deletions

View file

@ -66,9 +66,18 @@ export default class TagRenderingConfig {
addExtraTags: json.freeform.addExtraTags?.map((tg, i) => addExtraTags: json.freeform.addExtraTags?.map((tg, i) =>
FromJSON.Tag(tg, `${context}.extratag[${i}]`)) ?? [] FromJSON.Tag(tg, `${context}.extratag[${i}]`)) ?? []
} }
if(this.freeform.key === undefined || this.freeform.key === ""){
throw `Freeform.key is undefined or the empty string - this is not allowed; either fill out something or remove the freeform block alltogether. Error in ${context}`
}
if (ValidatedTextField.AllTypes[this.freeform.type] === undefined) { if (ValidatedTextField.AllTypes[this.freeform.type] === undefined) {
throw `Freeform.key ${this.freeform.key} is an invalid type` throw `Freeform.key ${this.freeform.key} is an invalid type`
} }
if(this.freeform.addExtraTags){
const usedKeys = new And(this.freeform.addExtraTags).usedKeys();
if(usedKeys.indexOf(this.freeform.key)){
throw `The freeform key ${this.freeform.key} will be overwritten by one of the extra tags, as they use the same key too. This is in ${context}`;
}
}
} }
this.multiAnswer = json.multiAnswer ?? false this.multiAnswer = json.multiAnswer ?? false

View file

@ -6,18 +6,13 @@
"fr": "Bancs" "fr": "Bancs"
}, },
"minzoom": 14, "minzoom": 14,
"overpassTags": { "overpassTags": "amenity=bench",
"and": [
"amenity=bench"
]
},
"title": { "title": {
"render": { "render": {
"en": "Bench", "en": "Bench",
"de": "Sitzbank", "de": "Sitzbank",
"fr": "Banc" "fr": "Banc"
}, }
"mappings": []
}, },
"tagRenderings": [ "tagRenderings": [
"images", "images",
@ -28,16 +23,11 @@
"fr": "Dossier" "fr": "Dossier"
}, },
"freeform": { "freeform": {
"key": "backrest", "key": "backrest"
"addExtraTags": []
}, },
"mappings": [ "mappings": [
{ {
"if": { "if": "backrest=yes",
"and": [
"backrest=yes"
]
},
"then": { "then": {
"en": "Backrest: Yes", "en": "Backrest: Yes",
"de": "Rückenlehne: Ja", "de": "Rückenlehne: Ja",
@ -45,11 +35,7 @@
} }
}, },
{ {
"if": { "if": "backrest=no",
"and": [
"backrest=no"
]
},
"then": { "then": {
"en": "Backrest: No", "en": "Backrest: No",
"de": "Rückenlehne: Nein", "de": "Rückenlehne: Nein",
@ -73,7 +59,6 @@
"key": "seats", "key": "seats",
"type": "nat" "type": "nat"
}, },
"mappings": [],
"question": { "question": {
"en": "How many seats does this bench have?", "en": "How many seats does this bench have?",
"de": "Wie viele Sitzplätze hat diese Bank?", "de": "Wie viele Sitzplätze hat diese Bank?",
@ -92,11 +77,7 @@
}, },
"mappings": [ "mappings": [
{ {
"if": { "if": "material=wood",
"and": [
"material=wood"
]
},
"then": { "then": {
"en": "Material: wood", "en": "Material: wood",
"de": "Material: Holz", "de": "Material: Holz",
@ -104,11 +85,7 @@
} }
}, },
{ {
"if": { "if": "material=metal",
"and": [
"material=metal"
]
},
"then": { "then": {
"en": "Material: metal", "en": "Material: metal",
"de": "Material: Metall", "de": "Material: Metall",
@ -116,11 +93,7 @@
} }
}, },
{ {
"if": { "if": "material=stone",
"and": [
"material=stone"
]
},
"then": { "then": {
"en": "Material: stone", "en": "Material: stone",
"de": "Material: Stein", "de": "Material: Stein",
@ -128,11 +101,7 @@
} }
}, },
{ {
"if": { "if": "material=concrete",
"and": [
"material=concrete"
]
},
"then": { "then": {
"en": "Material: concrete", "en": "Material: concrete",
"de": "Material: Beton", "de": "Material: Beton",
@ -140,11 +109,7 @@
} }
}, },
{ {
"if": { "if": "material=plastic",
"and": [
"material=plastic"
]
},
"then": { "then": {
"en": "Material: plastic", "en": "Material: plastic",
"de": "Material: Kunststoff", "de": "Material: Kunststoff",
@ -152,11 +117,7 @@
} }
}, },
{ {
"if": { "if": "material=steel",
"and": [
"material=steel"
]
},
"then": { "then": {
"en": "Material: steel", "en": "Material: steel",
"de": "Material: Stahl", "de": "Material: Stahl",
@ -200,11 +161,7 @@
}, },
"mappings": [ "mappings": [
{ {
"if": { "if": "colour=brown",
"and": [
"colour=brown"
]
},
"then": { "then": {
"en": "Colour: brown", "en": "Colour: brown",
"de": "Farbe: braun", "de": "Farbe: braun",
@ -212,11 +169,7 @@
} }
}, },
{ {
"if": { "if": "colour=green",
"and": [
"colour=green"
]
},
"then": { "then": {
"en": "Colour: green", "en": "Colour: green",
"de": "Farbe: grün", "de": "Farbe: grün",
@ -224,11 +177,7 @@
} }
}, },
{ {
"if": { "if": "colour=gray",
"and": [
"colour=gray"
]
},
"then": { "then": {
"en": "Colour: gray", "en": "Colour: gray",
"de": "Farbe: grau", "de": "Farbe: grau",
@ -236,11 +185,7 @@
} }
}, },
{ {
"if": { "if": "colour=white",
"and": [
"colour=white"
]
},
"then": { "then": {
"en": "Colour: white", "en": "Colour: white",
"de": "Farbe: weiß", "de": "Farbe: weiß",
@ -248,11 +193,7 @@
} }
}, },
{ {
"if": { "if": "colour=red",
"and": [
"colour=red"
]
},
"then": { "then": {
"en": "Colour: red", "en": "Colour: red",
"de": "Farbe: rot", "de": "Farbe: rot",
@ -260,11 +201,7 @@
} }
}, },
{ {
"if": { "if": "colour=black",
"and": [
"colour=black"
]
},
"then": { "then": {
"en": "Colour: black", "en": "Colour: black",
"de": "Farbe: schwarz", "de": "Farbe: schwarz",
@ -272,11 +209,7 @@
} }
}, },
{ {
"if": { "if": "colour=blue",
"and": [
"colour=blue"
]
},
"then": { "then": {
"en": "Colour: blue", "en": "Colour: blue",
"de": "Farbe: blau", "de": "Farbe: blau",
@ -284,11 +217,7 @@
} }
}, },
{ {
"if": { "if": "colour=yellow",
"and": [
"colour=yellow"
]
},
"then": { "then": {
"en": "Colour: yellow", "en": "Colour: yellow",
"de": "Farbe: gelb", "de": "Farbe: gelb",

View file

@ -5,11 +5,7 @@
"nl": "Picnictafels" "nl": "Picnictafels"
}, },
"minzoom": 12, "minzoom": 12,
"overpassTags": { "overpassTags": "leisure=picnic_table",
"and": [
"leisure=picnic_table"
]
},
"title": { "title": {
"render": { "render": {
"en": "Picnic table", "en": "Picnic table",
@ -35,22 +31,14 @@
}, },
"mappings": [ "mappings": [
{ {
"if": { "if": "material=wood",
"and": [
"material=wood"
]
},
"then": { "then": {
"en": "This is a wooden picnic table", "en": "This is a wooden picnic table",
"nl": "Deze picnictafel is gemaakt uit hout" "nl": "Deze picnictafel is gemaakt uit hout"
} }
}, },
{ {
"if": { "if": "material=concrete",
"and": [
"material=concrete"
]
},
"then": { "then": {
"en": "This is a concrete picnic table", "en": "This is a concrete picnic table",
"nl": "Deze picnictafel is gemaakt uit beton" "nl": "Deze picnictafel is gemaakt uit beton"