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"
},
"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": [
{

View file

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

View file

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

View file

@ -8,7 +8,8 @@ import { GeoIndexedStoreForLayer } from "./FeatureSource/Actors/GeoIndexedStore"
import { IndexedFeatureSource } from "./FeatureSource/FeatureSource"
import OsmObjectDownloader from "./Osm/OsmObjectDownloader"
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, ...
@ -24,11 +25,12 @@ export default class MetaTagging {
>()
constructor(state: {
layout: LayoutConfig
osmObjectDownloader: OsmObjectDownloader
perLayer: ReadonlyMap<string, GeoIndexedStoreForLayer>
indexedFeatures: IndexedFeatureSource
featureProperties: FeaturePropertiesStore
readonly selectedElementAndLayer: Store<{ feature: Feature; layer: LayerConfig }>
readonly layout: LayoutConfig
readonly osmObjectDownloader: OsmObjectDownloader
readonly perLayer: ReadonlyMap<string, GeoIndexedStoreForLayer>
readonly indexedFeatures: IndexedFeatureSource
readonly featureProperties: FeaturePropertiesStore
}) {
const params = MetaTagging.createExtraFuncParams(state)
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]
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
idList = JSON.parse(value)
}

View file

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

View file

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