diff --git a/assets/layers/indoors/indoors.json b/assets/layers/indoors/indoors.json index 61b168bfe4..46cd229a92 100644 --- a/assets/layers/indoors/indoors.json +++ b/assets/layers/indoors/indoors.json @@ -218,6 +218,14 @@ } ], "tagRenderings": [ + {"id":"sotm-events", + "render": { + "special": { + "type": "giggity", + "giggityUrl":"https://sotm.osmz.ru/sotmeu2023.xml" + } + } + }, "images", "level", { diff --git a/assets/layers/usersettings/usersettings.json b/assets/layers/usersettings/usersettings.json index 082cc5ab01..a356a9c42e 100644 --- a/assets/layers/usersettings/usersettings.json +++ b/assets/layers/usersettings/usersettings.json @@ -688,6 +688,7 @@ "mappings": [ { "if": "mapcomplete-show_debug=yes", + "icon": "./assets/svg/debug.svg", "then": { "en": "Show debug info", "de": "Debug-Informationen anzeigen", @@ -720,6 +721,11 @@ } ] }, + { + "id":"debug-gps", + "condition": "mapcomplete-show_debug=yes", + "render": "{gps_all_tags()}" + }, { "id": "debug", "condition": "mapcomplete-show_debug=yes", diff --git a/assets/themes/facadegardens/facadegardens.json b/assets/themes/facadegardens/facadegardens.json index 1786d61eea..c8aa40ba31 100644 --- a/assets/themes/facadegardens/facadegardens.json +++ b/assets/themes/facadegardens/facadegardens.json @@ -579,11 +579,81 @@ "enableImproveAccuracy": true, "enableRelocation": false }, - "pointRendering": [], - "lineRendering": [ - {} - ] + "pointRendering": [ + { + "marker": [ + { + "icon": "circle", + "color": "white" + }, + { + "icon": { + "render": "./assets/themes/facadegardens/geveltuin.svg", + "mappings": [ + { + "if": { + "and": [ + "direct_sunlight=yes" + ] + }, + "then": "./assets/themes/facadegardens/zon.svg" + }, + { + "if": { + "and": [ + "direct_sunlight=partial" + ] + }, + "then": "./assets/themes/facadegardens/halfzon.svg" + }, + { + "if": { + "and": [ + "direct_sunlight=no" + ] + }, + "then": "./assets/themes/facadegardens/schaduw.svg" + } + ] + } + } + ], + "iconBadges": [ + { + "if": "plant~.*vine.*", + "then": "circle:white;./assets/themes/facadegardens/klimplant.svg" + }, + { + "if": "plant~.*groundcover.*", + "then": "circle:white;./assets/themes/facadegardens/bodembedekker.svg" + }, + { + "if": "edible=true", + "then": "circle:white;./assets/themes/facadegardens/eetbaar.svg" + }, + { + "if": "rain_barel=yes", + "then": "circle:white;./assets/themes/facadegardens/gevelton.svg" + }, + { + "if": "plant~.*shrub.*", + "then": "circle:white;./assets/themes/facadegardens/struik.svg" + }, + { + "if": "plant~.*flower.*", + "then": "circle:white;./assets/themes/facadegardens/bloei.svg" + } + ], + "iconSize": "50,50", + "location": [ + "point", + "centroid" + ], + "anchor": "center" + } + ], + "lineRendering": [] } ], "widenFactor": 1.5 -} \ No newline at end of file +} diff --git a/package-lock.json b/package-lock.json index a840141c78..e8378f4019 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4684,9 +4684,9 @@ "integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==" }, "node_modules/axios": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.2.3.tgz", - "integrity": "sha512-pdDkMYJeuXLZ6Xj/Q5J3Phpe+jbGdsSzlQaFVkMQzRUL05+6+tetX8TV3p4HrU4kzuO9bt+io/yGQxuyxA/xcw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.1.tgz", + "integrity": "sha512-vfBmhDpKafglh0EldBEbVuoe7DyAavGSLWhuSm5ZSEKQnHhBf0xAAwybbNH1IkrJNGnS/VG4I5yxig1pCEXE4g==", "dependencies": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", @@ -16846,9 +16846,9 @@ "integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==" }, "axios": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.2.3.tgz", - "integrity": "sha512-pdDkMYJeuXLZ6Xj/Q5J3Phpe+jbGdsSzlQaFVkMQzRUL05+6+tetX8TV3p4HrU4kzuO9bt+io/yGQxuyxA/xcw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.1.tgz", + "integrity": "sha512-vfBmhDpKafglh0EldBEbVuoe7DyAavGSLWhuSm5ZSEKQnHhBf0xAAwybbNH1IkrJNGnS/VG4I5yxig1pCEXE4g==", "requires": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", diff --git a/src/Logic/Actors/GeoLocationHandler.ts b/src/Logic/Actors/GeoLocationHandler.ts index c8f47d76cf..137345b4bf 100644 --- a/src/Logic/Actors/GeoLocationHandler.ts +++ b/src/Logic/Actors/GeoLocationHandler.ts @@ -173,6 +173,8 @@ export default class GeoLocationHandler { properties[k] = location[k] } } + console.log(location) + properties["_all"] = JSON.stringify(location) const feature = { type: "Feature", diff --git a/src/Logic/FeatureSource/Sources/LastClickFeatureSource.ts b/src/Logic/FeatureSource/Sources/LastClickFeatureSource.ts index ece8d156de..c95857d70e 100644 --- a/src/Logic/FeatureSource/Sources/LastClickFeatureSource.ts +++ b/src/Logic/FeatureSource/Sources/LastClickFeatureSource.ts @@ -26,7 +26,12 @@ export class LastClickFeatureSource implements WritableFeatureSource { for (let i = 0; i < (layer.presets ?? []).length; i++) { const preset = layer.presets[i] const tags = new ImmutableStore(TagUtils.KVtoProperties(preset.tags)) - const { html } = layer.mapRendering[0].RenderIcon(tags, { + const rendering = layer.mapRendering[0] + if (!rendering) { + console.error("NO rendering for preset", layer.id) + continue + } + const { html } = rendering.RenderIcon(tags, { noSize: true, includeBadges: false, }) diff --git a/src/Logic/State/UserSettingsMetaTagging.ts b/src/Logic/State/UserSettingsMetaTagging.ts index 6e568c5c32..33a5ae85b5 100644 --- a/src/Logic/State/UserSettingsMetaTagging.ts +++ b/src/Logic/State/UserSettingsMetaTagging.ts @@ -1,42 +1,14 @@ import { Utils } from "../../Utils" /** This code is autogenerated - do not edit. Edit ./assets/layers/usersettings/usersettings.json instead */ export class ThemeMetaTagging { - public static readonly themeName = "usersettings" + public static readonly themeName = "usersettings" - public metaTaggging_for_usersettings(feat: { properties: Record }) { - Utils.AddLazyProperty(feat.properties, "_mastodon_candidate_md", () => - feat.properties._description - .match(/\[[^\]]*\]\((.*(mastodon|en.osm.town).*)\).*/) - ?.at(1) - ) - Utils.AddLazyProperty( - feat.properties, - "_d", - () => feat.properties._description?.replace(/</g, "<")?.replace(/>/g, ">") ?? "" - ) - Utils.AddLazyProperty(feat.properties, "_mastodon_candidate_a", () => - ((feat) => { - const e = document.createElement("div") - e.innerHTML = feat.properties._d - return Array.from(e.getElementsByTagName("a")).filter( - (a) => a.href.match(/mastodon|en.osm.town/) !== null - )[0]?.href - })(feat) - ) - Utils.AddLazyProperty(feat.properties, "_mastodon_link", () => - ((feat) => { - const e = document.createElement("div") - e.innerHTML = feat.properties._d - return Array.from(e.getElementsByTagName("a")).filter( - (a) => a.getAttribute("rel")?.indexOf("me") >= 0 - )[0]?.href - })(feat) - ) - Utils.AddLazyProperty( - feat.properties, - "_mastodon_candidate", - () => feat.properties._mastodon_candidate_md ?? feat.properties._mastodon_candidate_a - ) - feat.properties["__current_backgroun"] = "initial_value" - } -} + public metaTaggging_for_usersettings(feat: {properties: Record}) { + Utils.AddLazyProperty(feat.properties, '_mastodon_candidate_md', () => feat.properties._description.match(/\[[^\]]*\]\((.*(mastodon|en.osm.town).*)\).*/)?.at(1) ) + Utils.AddLazyProperty(feat.properties, '_d', () => feat.properties._description?.replace(/</g,'<')?.replace(/>/g,'>') ?? '' ) + Utils.AddLazyProperty(feat.properties, '_mastodon_candidate_a', () => (feat => {const e = document.createElement('div');e.innerHTML = feat.properties._d;return Array.from(e.getElementsByTagName("a")).filter(a => a.href.match(/mastodon|en.osm.town/) !== null)[0]?.href }) (feat) ) + Utils.AddLazyProperty(feat.properties, '_mastodon_link', () => (feat => {const e = document.createElement('div');e.innerHTML = feat.properties._d;return Array.from(e.getElementsByTagName("a")).filter(a => a.getAttribute("rel")?.indexOf('me') >= 0)[0]?.href})(feat) ) + Utils.AddLazyProperty(feat.properties, '_mastodon_candidate', () => feat.properties._mastodon_candidate_md ?? feat.properties._mastodon_candidate_a ) + feat.properties['__current_backgroun'] = 'initial_value' + } +} \ No newline at end of file diff --git a/src/Models/ThemeConfig/Conversion/Validation.ts b/src/Models/ThemeConfig/Conversion/Validation.ts index b6b47c1a8a..fcfd2a971a 100644 --- a/src/Models/ThemeConfig/Conversion/Validation.ts +++ b/src/Models/ThemeConfig/Conversion/Validation.ts @@ -1062,6 +1062,15 @@ export class PrevalidateLayer extends DesugaringStep { ) } + if (!(json.pointRendering?.length > 0)) { + context.enter("pointRendering").err("There are no pointRenderings at all") + } + if (json.presets?.length > 0) { + if (!(json.pointRendering?.length > 0)) { + context.enter("presets").warn("A preset is defined, but there is no pointRendering") + } + } + if (json.source === "special") { if (!Constants.priviliged_layers.find((x) => x == json.id)) { context.err( @@ -1377,6 +1386,7 @@ export class ValidateLayer extends Conversion< context.err("Could not parse layer due to:" + e) return undefined } + for (let i = 0; i < (layerConfig.calculatedTags ?? []).length; i++) { const [_, code, __] = layerConfig.calculatedTags[i] try { diff --git a/src/UI/BigComponents/Giggity.svelte b/src/UI/BigComponents/Giggity.svelte new file mode 100644 index 0000000000..ec808c7263 --- /dev/null +++ b/src/UI/BigComponents/Giggity.svelte @@ -0,0 +1,91 @@ + + +{#if $events === undefined} + Loading giggity events from {giggityUrl} + {:else if $events.length === 0} + No upcoming events in this room +{:else} +
+

Upcoming events

+ {#each $events as event} +
+ {#if event.url} +

{event.title}

+ + {:else } +

{event.title}

+ {/if} +
{event.start}
+ By {event.persons} +
+ {event.abstract} +
+ {event.url} +
+ {/each} +
+{/if} diff --git a/src/UI/BigComponents/SelectedElementView.svelte b/src/UI/BigComponents/SelectedElementView.svelte index c780ea931f..afa7b7d871 100644 --- a/src/UI/BigComponents/SelectedElementView.svelte +++ b/src/UI/BigComponents/SelectedElementView.svelte @@ -20,6 +20,11 @@ _metatags = tags }) ) + + + let knownTagRenderings = layer.tagRenderings + .filter(config => (config.condition?.matchesProperties($tags) ?? true) && (config.metacondition?.matchesProperties({ ...$tags, ..._metatags } ?? true) + && config.IsKnown($tags))) {#if $tags._deleted === "yes"} @@ -29,9 +34,7 @@ {:else}
- {#each layer.tagRenderings as config (config.id)} - {#if (config.condition?.matchesProperties($tags) ?? true) && config.metacondition?.matchesProperties({ ...$tags, ..._metatags } ?? true)} - {#if config.IsKnown($tags)} + {#each knownTagRenderings as config (config.id)} - {/if} - {/if} {/each}
{/if} diff --git a/src/UI/Popup/TagRendering/TagRenderingEditable.svelte b/src/UI/Popup/TagRendering/TagRenderingEditable.svelte index 050295e9e4..27d6f09c45 100644 --- a/src/UI/Popup/TagRendering/TagRenderingEditable.svelte +++ b/src/UI/Popup/TagRendering/TagRenderingEditable.svelte @@ -21,7 +21,7 @@ export let editingEnabled: Store | undefined = state?.featureSwitchUserbadge export let highlightedRendering: UIEventSource = undefined - export let showQuestionIfUnknown: boolean = false + export let clss /** * Indicates if this tagRendering currently shows the attribute or asks the question to _change_ the property */ @@ -71,7 +71,7 @@ } -
+
{#if config.question && (!editingEnabled || $editingEnabled)} {#if editMode} @@ -106,7 +106,7 @@
{/if} {:else} -
+
{/if} diff --git a/src/UI/SpecialVisualizations.ts b/src/UI/SpecialVisualizations.ts index f6980cacff..967448318e 100644 --- a/src/UI/SpecialVisualizations.ts +++ b/src/UI/SpecialVisualizations.ts @@ -76,6 +76,8 @@ import StarsBarIcon from "./Reviews/StarsBarIcon.svelte" import ReviewForm from "./Reviews/ReviewForm.svelte" import Questionbox from "./Popup/TagRendering/Questionbox.svelte" import { TagUtils } from "../Logic/Tags/TagUtils" +import Giggity from "./BigComponents/Giggity.svelte" +import ThemeViewState from "../Models/ThemeViewState" class NearbyImageVis implements SpecialVisualization { // Class must be in SpecialVisualisations due to weird cyclical import that breaks the tests @@ -90,6 +92,7 @@ class NearbyImageVis implements SpecialVisualization { "A component showing nearby images loaded from various online services such as Mapillary. In edit mode and when used on a feature, the user can select an image to add to the feature" funcName = "nearby_images" needsUrls = NearbyImagesSearch.apiUrls + constr( state: SpecialVisualizationState, tags: UIEventSource>, @@ -1447,6 +1450,51 @@ export default class SpecialVisualizations { ) }, }, + { + funcName: "giggity", + args: [ + { + name: "giggityUrl", + required: true, + doc: "The URL of the giggity-XML", + }, + ], + docs: "Shows events that are happening based on a Giggity URL", + needsUrls: ["*"], + constr( + state: SpecialVisualizationState, + tagSource: UIEventSource>, + argument: string[], + feature: Feature, + layer: LayerConfig + ): BaseUIElement { + const giggityUrl = argument[0] + return new SvelteUIElement(Giggity, { tags: tagSource, state, giggityUrl }) + }, + }, + { + funcName: "gps_all_tags", + needsUrls: [], + docs: "Shows the current tags of the GPS-representing object, used for debugging", + args: [], + constr( + state: SpecialVisualizationState, + _: UIEventSource>, + argument: string[], + feature: Feature, + layer: LayerConfig + ): BaseUIElement { + const tags = (( + state + )).geolocation.currentUserLocation.features.map( + (features) => features[0].properties + ) + return new SvelteUIElement(AllTagsPanel, { + state, + tags, + }) + }, + }, ] specialVisualizations.push(new AutoApplyButton(specialVisualizations)) diff --git a/src/UI/Studio/SchemaBasedArray.svelte b/src/UI/Studio/SchemaBasedArray.svelte index 187fea7597..4176892a42 100644 --- a/src/UI/Studio/SchemaBasedArray.svelte +++ b/src/UI/Studio/SchemaBasedArray.svelte @@ -64,7 +64,7 @@ } } newPath.push(...toAdd) - console.log({ newPath }) + console.log("Fused path ", path.join("."), "+", i,"+", subpartPath.join("."),"into",newPath.join(".")) return newPath } @@ -115,7 +115,7 @@ {#each $currentValue as value, i}
- +