diff --git a/Models/ThemeConfig/Conversion/PrepareLayer.ts b/Models/ThemeConfig/Conversion/PrepareLayer.ts index 649bb672c5..74d7174b80 100644 --- a/Models/ThemeConfig/Conversion/PrepareLayer.ts +++ b/Models/ThemeConfig/Conversion/PrepareLayer.ts @@ -13,11 +13,16 @@ import {AddContextToTranslations} from "./AddContextToTranslations"; class ExpandTagRendering extends Conversion { private readonly _state: DesugaringContext; private readonly _self: LayerConfigJson; + private readonly _options: { + /* If true, will copy the 'osmSource'-tags into the condition */ + applyCondition?: true | boolean; + }; - constructor(state: DesugaringContext, self: LayerConfigJson) { + constructor(state: DesugaringContext, self: LayerConfigJson, options?: { applyCondition?: true | boolean;}) { super("Converts a tagRenderingSpec into the full tagRendering, e.g. by substituting the tagRendering by the shared-question", [], "ExpandTagRendering"); this._state = state; this._self = self; + this._options = options; } convert(json: string | TagRenderingConfigJson | { builtin: string | string[]; override: any }, context: string): { result: TagRenderingConfigJson[]; errors: string[]; warnings: string[] } { @@ -65,12 +70,14 @@ class ExpandTagRendering extends Conversion("layers:") for (let i = 0; i < matchingTrs.length; i++) { - // The matched tagRenderings are 'stolen' from another layer. This means that they must match the layer condition before being shown let found: TagRenderingConfigJson = Utils.Clone(matchingTrs[i]); - if (found.condition === undefined) { - found.condition = layer.source.osmTags - } else { - found.condition = {and: [found.condition, layer.source.osmTags]} + if(this._options?.applyCondition){ + // The matched tagRenderings are 'stolen' from another layer. This means that they must match the layer condition before being shown + if (found.condition === undefined) { + found.condition = layer.source.osmTags + } else { + found.condition = {and: [found.condition, layer.source.osmTags]} + } } found = contextWriter.convertStrict(found, layer.id + ".tagRenderings." + found["id"]) @@ -561,7 +568,7 @@ export class PrepareLayer extends Fuse { new On("tagRenderings", new Concat(new ExpandRewrite()).andThenF(Utils.Flatten)), new On("tagRenderings", layer => new Concat(new ExpandTagRendering(state, layer))), new On("mapRendering", new Concat(new ExpandRewrite()).andThenF(Utils.Flatten)), - new On("mapRendering", layer => new Each(new On("icon", new FirstOf(new ExpandTagRendering(state, layer))))), + new On("mapRendering", layer => new Each(new On("icon", new FirstOf(new ExpandTagRendering(state, layer, {applyCondition: false}))))), new SetDefault("titleIcons", ["defaults"]), new On("titleIcons", layer => new Concat(new ExpandTagRendering(state, layer))) ); diff --git a/Models/ThemeConfig/Conversion/Validation.ts b/Models/ThemeConfig/Conversion/Validation.ts index 1347da5fab..f6a877df8a 100644 --- a/Models/ThemeConfig/Conversion/Validation.ts +++ b/Models/ThemeConfig/Conversion/Validation.ts @@ -613,6 +613,13 @@ export class ValidateLayer extends DesugaringStep { information.push(...(r.information ?? [])) } + { + const hasCondition = json.mapRendering?.filter(mr => mr["icon"] !== undefined && mr["icon"]["condition"] !== undefined) + if(hasCondition?.length > 0){ + errors.push("At "+context+":\n One or more icons in the mapRenderings have a condition set. Don't do this, as this will result in an invisible but clickable element. Use extra filters in the source instead. The offending mapRenderings are:\n"+JSON.stringify(hasCondition, null, " ")) + } + } + if (json.presets !== undefined) { // Check that a preset will be picked up by the layer itself diff --git a/assets/layers/indoors/indoors.json b/assets/layers/indoors/indoors.json index 9b00ee2269..101fbaf4da 100644 --- a/assets/layers/indoors/indoors.json +++ b/assets/layers/indoors/indoors.json @@ -178,8 +178,6 @@ "centroid" ], "icon": { - "render": null, - "condition": "indoor=room", "mappings": [ { "if": { diff --git a/assets/layers/shops/shops.json b/assets/layers/shops/shops.json index a5bb57dd5a..324ee0634b 100644 --- a/assets/layers/shops/shops.json +++ b/assets/layers/shops/shops.json @@ -368,4 +368,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/assets/themes/mapcomplete-changes/mapcomplete-changes.json b/assets/themes/mapcomplete-changes/mapcomplete-changes.json index 41ef55fb2c..618f04b430 100644 --- a/assets/themes/mapcomplete-changes/mapcomplete-changes.json +++ b/assets/themes/mapcomplete-changes/mapcomplete-changes.json @@ -1,19 +1,13 @@ { "id": "mapcomplete-changes", "title": { - "en": "Changes made with MapComplete", - "de": "Mit MapComplete vorgenommene Änderungen", - "fr": "Changements faits avec MapComplete" + "en": "Changes made with MapComplete" }, "shortDescription": { - "en": "Shows changes made by MapComplete", - "de": "Zeigt die mit MapComplete vorgenommenen Änderungen", - "fr": "Montrer les changements faits avec MapComplete" + "en": "Shows changes made by MapComplete" }, "description": { - "en": "This maps shows all the changes made with MapComplete", - "de": "Diese Karte zeigt alle mit MapComplete vorgenommenen Änderungen", - "fr": "Cette carte affiche toutes les modifications réalisées avec MapComplete" + "en": "This maps shows all the changes made with MapComplete" }, "maintainer": "", "icon": "./assets/svg/logo.svg", @@ -28,9 +22,7 @@ { "id": "mapcomplete-changes", "name": { - "en": "Changeset centers", - "de": "Zentrum der Änderungssätze", - "fr": "Centre du groupe de modifications" + "en": "Changeset centers" }, "minzoom": 0, "source": { @@ -44,47 +36,35 @@ ], "title": { "render": { - "en": "Changeset for {theme}", - "de": "Änderungssatz für {theme}", - "fr": "Groupe de modifications pour {theme}" + "en": "Changeset for {theme}" } }, "description": { - "en": "Shows all MapComplete changes", - "de": "Zeigt alle MapComplete Änderungen", - "fr": "Afficher toutes les modifications MapComplete" + "en": "Shows all MapComplete changes" }, "tagRenderings": [ { "id": "render_id", "render": { - "en": "Changeset {id}", - "de": "Änderungssatz {id}", - "fr": "Groupe de modifications {id}" + "en": "Changeset {id}" } }, { "id": "contributor", "render": { - "en": "Change made by {_last_edit:contributor}", - "de": "Geändert von {_last_edit:contributor}", - "fr": "Modification faite par {_last_edit:contributor}" + "en": "Change made by {_last_edit:contributor}" } }, { "id": "theme", "render": { - "en": "Change with theme {theme}", - "de": "Änderung mit Thema {theme}", - "fr": "Modification avec le thème {theme}" + "en": "Change with theme {theme}" }, "mappings": [ { "if": "theme~http.*", "then": { - "en": "Change with unofficial theme {theme}", - "de": "Änderung mit inoffiziellem Thema {theme}", - "fr": "Modification avec le thème non-officiel {theme}" + "en": "Change with unofficial theme {theme}" } } ] @@ -227,10 +207,18 @@ "if": "theme=healthcare", "then": "./assets/layers/doctors/doctors.svg" }, + { + "if": "theme=hotels", + "then": "./assets/layers/hotel/hotel.svg" + }, { "if": "theme=indoors", "then": "./assets/layers/entrance/entrance.svg" }, + { + "if": "theme=kakampink", + "then": "bug" + }, { "if": "theme=kerbs_and_crossings", "then": "./assets/layers/kerbs/KerbIcon.svg" @@ -388,9 +376,7 @@ } ], "question": { - "en": "Themename contains {search}", - "de": "Themenname enthält {search}", - "fr": "Nom de thème contenant {search}" + "en": "Themename contains {search}" } } ] @@ -406,9 +392,7 @@ } ], "question": { - "en": "Made by contributor {search}", - "de": "Erstellt von {search}", - "fr": "Réalisé par {search}" + "en": "Made by contributor {search}" } } ] @@ -424,9 +408,7 @@ } ], "question": { - "en": "Not made by contributor {search}", - "de": "Nicht erstellt von {search}", - "fr": "Non réalisé par {search}" + "en": "Not made by contributor {search}" } } ] @@ -441,9 +423,7 @@ { "id": "link_to_more", "render": { - "en": "More statistics can be found here", - "de": "Weitere Statistiken finden Sie hier", - "fr": "D’autres statistiques sont disponibles ici" + "en": "More statistics can be found here" } }, {