Fix: etymology theme now supports multi-apply again, uses lower zoom level for multiselect

This commit is contained in:
Pieter Vander Vennet 2023-07-18 01:26:31 +02:00
parent 2cc943889d
commit 90869a1c98
7 changed files with 65 additions and 82 deletions

View file

@ -33,7 +33,7 @@
"fr": "Tous les objets dont létymologie est connue" "fr": "Tous les objets dont létymologie est connue"
}, },
"calculatedTags": [ "calculatedTags": [
"_same_name_ids=closestn(feat)('*', 250, undefined, 2500)?.filter(f => f.feat.properties.name === feat.properties.name)?.map(f => f.feat.properties.id)??[]" "_same_name_ids=closestn(feat)('*', 250, undefined, 5000)?.filter(f => f.feat.properties.name === feat.properties.name)?.map(f => f.feat.properties.id)??[]"
], ],
"tagRenderings": [ "tagRenderings": [
{ {

View file

@ -46,6 +46,7 @@
"startLon": 0, "startLon": 0,
"startZoom": 1, "startZoom": 1,
"widenFactor": 2, "widenFactor": 2,
"clustering": { "clustering": {
"maxZoom": 14, "maxZoom": 14,
"minNeededElements": 250 "minNeededElements": 250
@ -70,7 +71,7 @@
"nb_NO": "Gater uten etymologi-info", "nb_NO": "Gater uten etymologi-info",
"cs": "Ulice bez etymologických informací" "cs": "Ulice bez etymologických informací"
}, },
"minzoom": 18, "minzoom": 15,
"source": { "source": {
"=osmTags": { "=osmTags": {
"and": [ "and": [
@ -283,4 +284,4 @@
} }
], ],
"hideFromOverview": false "hideFromOverview": false
} }

View file

@ -1,19 +1,13 @@
{ {
"id": "mapcomplete-changes", "id": "mapcomplete-changes",
"title": { "title": {
"en": "Changes made with MapComplete", "en": "Changes made with MapComplete"
"de": "Mit MapComplete erstellte Änderungen",
"nl": "Wijzigingen gemaakt met MapComplete"
}, },
"shortDescription": { "shortDescription": {
"en": "Show changes made with MapComplete", "en": "Shows changes made by MapComplete"
"de": "Mit MapComplete erstellte Änderungen anzeigen",
"nl": "Toon wijzigingen gemaakt met MapComplete"
}, },
"description": { "description": {
"en": "This maps shows all the changes made with MapComplete", "en": "This maps shows all the changes made with MapComplete"
"de": "Diese Karte zeigt alle mit MapComplete vorgenommenen Änderungen",
"nl": "Deze kaart toont alle wijzigingen die met MapComplete gemaakt werden"
}, },
"icon": "./assets/svg/logo.svg", "icon": "./assets/svg/logo.svg",
"hideFromOverview": true, "hideFromOverview": true,
@ -26,9 +20,7 @@
{ {
"id": "mapcomplete-changes", "id": "mapcomplete-changes",
"name": { "name": {
"en": "Changeset centers", "en": "Changeset centers"
"de": "Zentrum der Änderungssätze",
"nl": "Centerpunt van changeset"
}, },
"minzoom": 0, "minzoom": 0,
"source": { "source": {
@ -39,51 +31,41 @@
}, },
"title": { "title": {
"render": { "render": {
"en": "Changeset for {theme}", "en": "Changeset for {theme}"
"de": "Änderungssatz für {theme}"
} }
}, },
"description": { "description": {
"en": "Show all MapComplete changes", "en": "Shows all MapComplete changes"
"de": "Alle MapComplete-Änderungen anzeigen",
"nl": "Toon alle MapComplete wijzigingen"
}, },
"tagRenderings": [ "tagRenderings": [
{ {
"id": "show_changeset_id", "id": "show_changeset_id",
"render": { "render": {
"en": "Changeset <a href='https://openstreetmap.org/changeset/{id}' target='_blank'>{id}</a>", "en": "Changeset <a href='https://openstreetmap.org/changeset/{id}' target='_blank'>{id}</a>"
"de": "Änderungssatz <a href='https://openstreetmap.org/changeset/{id}' target='_blank'>{id}</a>"
} }
}, },
{ {
"id": "contributor", "id": "contributor",
"question": { "question": {
"en": "Which contributor made this change?", "en": "What contributor did make this change?"
"de": "Welcher Mitwirkende hat diese Änderung vorgenommen?",
"nl": "Welke bijdrager maakte deze wijziging?"
}, },
"freeform": { "freeform": {
"key": "user" "key": "user"
}, },
"render": { "render": {
"en": "Change made by <a href='https://openstreetmap.org/user/{user}' target='_blank'>{user}</a>", "en": "Change made by <a href='https://openstreetmap.org/user/{user}' target='_blank'>{user}</a>"
"de": "Änderung gemacht von <a href='https://openstreetmap.org/user/{user}' target='_blank'>{user}</a>",
"nl": "Wijziging gemaakt door <a href='https://openstreetmap.org/user/{user}' target='_blank'>{user}</a>"
} }
}, },
{ {
"id": "theme-id", "id": "theme-id",
"question": { "question": {
"en": "What theme was used to make this change?", "en": "What theme was used to make this change?"
"de": "Welches Thema wurde für diese Änderung verwendet?\""
}, },
"freeform": { "freeform": {
"key": "theme" "key": "theme"
}, },
"render": { "render": {
"en": "Change with theme <a href='https://mapcomplete.osm.be/{theme}'>{theme}</a>", "en": "Change with theme <a href='https://mapcomplete.osm.be/{theme}'>{theme}</a>"
"de": "Geändert mit Thema <a href='https://mapcomplete.osm.be/{theme}'>{theme}</a>"
} }
}, },
{ {
@ -92,27 +74,19 @@
"key": "locale" "key": "locale"
}, },
"question": { "question": {
"en": "What locale (language) was this change made in?", "en": "What locale (language) was this change made in?"
"de": "In welcher Sprache wurde diese Änderung vorgenommen?",
"nl": "In welke locale (taal) werd deze wijziging gemaakt?"
}, },
"render": { "render": {
"en": "User locale is {locale}", "en": "User locale is {locale}"
"de": "Usersprache ist {locale}",
"nl": "De gebruikerstaal is {locale}"
} }
}, },
{ {
"id": "host", "id": "host",
"render": { "render": {
"en": "Change made with <a href='{host}'>{host}</a>", "en": "Change with with <a href='{host}'>{host}</a>"
"de": "Änderung vorgenommen mit <a href='{host}'>{host}</a>",
"nl": "Wijziging gemaakt met <a href='{host}'>{host}</a>"
}, },
"question": { "question": {
"en": "What host (website) was this change made with?", "en": "What host (website) was this change made with?"
"de": "Mit welchem Host / welcher Website wurde diese Änderung gemacht?",
"nl": "Met welke host (website) werd deze wijziging gemaakt?"
}, },
"freeform": { "freeform": {
"key": "host" "key": "host"
@ -133,12 +107,10 @@
{ {
"id": "version", "id": "version",
"question": { "question": {
"en": "What version of MapComplete was used to make this change?", "en": "What version of MapComplete was used to make this change?"
"de": "Mit welcher Version von MapComplete wurde diese Änderung gemacht?"
}, },
"render": { "render": {
"en": "Made with {editor}", "en": "Made with {editor}"
"de": "Erstellt mit {editor}"
}, },
"freeform": { "freeform": {
"key": "editor" "key": "editor"
@ -480,9 +452,7 @@
} }
], ],
"question": { "question": {
"en": "Theme name contains {search}", "en": "Themename contains {search}"
"de": "Themenname enthält {search}",
"nl": "Themenaam bevat {search}"
} }
} }
] ]
@ -498,9 +468,7 @@
} }
], ],
"question": { "question": {
"en": "Made by contributor {search}", "en": "Made by contributor {search}"
"de": "Erstellt von {search}",
"nl": "Gemaakt door bijdrager {search}"
} }
} }
] ]
@ -516,9 +484,7 @@
} }
], ],
"question": { "question": {
"en": "<b>Not</b> made by contributor {search}", "en": "<b>Not</b> made by contributor {search}"
"de": "<b>Nicht</b> erstellt von {search}",
"nl": "<b>Niet</b> gemaakt door bijdrager {search}"
} }
} }
] ]
@ -535,9 +501,7 @@
} }
], ],
"question": { "question": {
"en": "Made before {search}", "en": "Made before {search}"
"de": "Erstellt vor {search}",
"nl": "Gemaakt voor {search}"
} }
} }
] ]
@ -554,9 +518,7 @@
} }
], ],
"question": { "question": {
"en": "Made after {search}", "en": "Made after {search}"
"de": "Erstellt nach {search}",
"nl": "Gemaakt na {search}"
} }
} }
] ]
@ -572,9 +534,7 @@
} }
], ],
"question": { "question": {
"en": "User language (iso-code) {search}", "en": "User language (iso-code) {search}"
"de": "Benutzersprache (ISO-Code) {search}",
"nl": "De taal van de bijdrager is {search}"
} }
} }
] ]
@ -590,9 +550,7 @@
} }
], ],
"question": { "question": {
"en": "Made with host {search}", "en": "Made with host {search}"
"de": "Erstellt mit Host {search}",
"nl": "Gemaakt met host {search}"
} }
} }
] ]
@ -603,9 +561,7 @@
{ {
"osmTags": "add-image>0", "osmTags": "add-image>0",
"question": { "question": {
"en": "Changeset added at least one image", "en": "Changeset added at least one image"
"de": "Changeset fügte mindestens ein Bild hinzu",
"nl": "Changeset bevat minstens één afbeelding"
} }
} }
] ]
@ -620,8 +576,7 @@
{ {
"id": "link_to_more", "id": "link_to_more",
"render": { "render": {
"en": "More statistics can be found <a href='https://github.com/pietervdvn/MapComplete/tree/develop/Docs/Tools/graphs' target='_blank'>here</a>", "en": "More statistics can be found <a href='https://github.com/pietervdvn/MapComplete/tree/develop/Docs/Tools/graphs' target='_blank'>here</a>"
"de": "Mehr Statistiken gibt es <a href='https://github.com/pietervdvn/MapComplete/tree/develop/Docs/Tools/graphs' target='_blank'>hier</a>"
} }
}, },
{ {

View file

@ -8,7 +8,8 @@ import { GeoIndexedStoreForLayer } from "./FeatureSource/Actors/GeoIndexedStore"
import { IndexedFeatureSource } from "./FeatureSource/FeatureSource" import { IndexedFeatureSource } from "./FeatureSource/FeatureSource"
import OsmObjectDownloader from "./Osm/OsmObjectDownloader" import OsmObjectDownloader from "./Osm/OsmObjectDownloader"
import { Utils } from "../Utils" import { Utils } from "../Utils"
import { UIEventSource } from "./UIEventSource" import { Store, UIEventSource } from "./UIEventSource"
import { SpecialVisualizationState } from "../UI/SpecialVisualization"
/** /**
* Metatagging adds various tags to the elements, e.g. lat, lon, surface area, ... * Metatagging adds various tags to the elements, e.g. lat, lon, surface area, ...
@ -24,11 +25,12 @@ export default class MetaTagging {
>() >()
constructor(state: { constructor(state: {
layout: LayoutConfig readonly selectedElementAndLayer: Store<{ feature: Feature; layer: LayerConfig }>
osmObjectDownloader: OsmObjectDownloader readonly layout: LayoutConfig
perLayer: ReadonlyMap<string, GeoIndexedStoreForLayer> readonly osmObjectDownloader: OsmObjectDownloader
indexedFeatures: IndexedFeatureSource readonly perLayer: ReadonlyMap<string, GeoIndexedStoreForLayer>
featureProperties: FeaturePropertiesStore readonly indexedFeatures: IndexedFeatureSource
readonly featureProperties: FeaturePropertiesStore
}) { }) {
const params = MetaTagging.createExtraFuncParams(state) const params = MetaTagging.createExtraFuncParams(state)
for (const layer of state.layout.layers) { for (const layer of state.layout.layers) {
@ -58,6 +60,21 @@ export default class MetaTagging {
) )
}) })
} }
state.selectedElementAndLayer.addCallbackAndRunD(({ feature, layer }) => {
// Force update the tags of the currently selected element
MetaTagging.addMetatags(
[feature],
params,
layer,
state.layout,
state.osmObjectDownloader,
state.featureProperties,
{
evaluateStrict: true,
}
)
})
} }
/** /**

View file

@ -53,7 +53,13 @@ export class MinimapViz implements SpecialVisualization {
} }
let idList = [value] let idList = [value]
if (key !== "id" && value.startsWith("[")) { if (Array.isArray(value)) {
idList = value
} else if (
key !== "id" &&
typeof value === "string" &&
value?.startsWith("[")
) {
// This is a list of values // This is a list of values
idList = JSON.parse(value) idList = JSON.parse(value)
} }

View file

@ -47,7 +47,10 @@ export class MultiApplyViz implements SpecialVisualization {
if (ids === undefined) { if (ids === undefined) {
return [] return []
} }
return JSON.parse(ids) if (typeof ids === "string" && ids.startsWith("[")) {
return JSON.parse(ids)
}
return ids
} catch (e) { } catch (e) {
console.warn( console.warn(
"Could not parse ", "Could not parse ",

View file

@ -52,6 +52,7 @@ export interface SpecialVisualizationState {
* Works together with 'selectedElement' to indicate what properties should be displayed * Works together with 'selectedElement' to indicate what properties should be displayed
*/ */
readonly selectedLayer: UIEventSource<LayerConfig> readonly selectedLayer: UIEventSource<LayerConfig>
readonly selectedElementAndLayer: Store<{ feature: Feature; layer: LayerConfig }>
/** /**
* If data is currently being fetched from external sources * If data is currently being fetched from external sources