Studio: WIP

This commit is contained in:
Pieter Vander Vennet 2023-09-17 13:45:46 +02:00
parent 9bce817f59
commit 89818019c3
11 changed files with 61 additions and 116 deletions

View file

@ -167,7 +167,7 @@
] ]
}, },
"mapRendering": { "mapRendering": {
"description": "Visualisation of the items on the map\nSet 'null' explicitly if you do not want a maprendering\ngroup: maprendering", "description": "Visualisation of the items on the map\nSet 'null' explicitly if you do not want a maprendering\ngroup: maprendering\ntypes: PointRendering ; LineRendering ;",
"type": "array", "type": "array",
"items": { "items": {
"anyOf": [ "anyOf": [

View file

@ -167,7 +167,7 @@ export default {
] ]
}, },
"mapRendering": { "mapRendering": {
"description": "Visualisation of the items on the map\nSet 'null' explicitly if you do not want a maprendering\ngroup: maprendering", "description": "Visualisation of the items on the map\nSet 'null' explicitly if you do not want a maprendering\ngroup: maprendering\ntypes: PointRendering ; LineRendering ;",
"type": "array", "type": "array",
"items": { "items": {
"anyOf": [ "anyOf": [

View file

@ -1898,7 +1898,7 @@
] ]
}, },
"mapRendering": { "mapRendering": {
"description": "Visualisation of the items on the map\nSet 'null' explicitly if you do not want a maprendering\ngroup: maprendering", "description": "Visualisation of the items on the map\nSet 'null' explicitly if you do not want a maprendering\ngroup: maprendering\ntypes: PointRendering ; LineRendering ;",
"type": "array", "type": "array",
"items": { "items": {
"anyOf": [ "anyOf": [
@ -2300,7 +2300,7 @@
] ]
}, },
"mapRendering": { "mapRendering": {
"description": "Visualisation of the items on the map\nSet 'null' explicitly if you do not want a maprendering\ngroup: maprendering", "description": "Visualisation of the items on the map\nSet 'null' explicitly if you do not want a maprendering\ngroup: maprendering\ntypes: PointRendering ; LineRendering ;",
"type": "array", "type": "array",
"items": { "items": {
"anyOf": [ "anyOf": [

View file

@ -1877,7 +1877,7 @@ export default {
] ]
}, },
"mapRendering": { "mapRendering": {
"description": "Visualisation of the items on the map\nSet 'null' explicitly if you do not want a maprendering\ngroup: maprendering", "description": "Visualisation of the items on the map\nSet 'null' explicitly if you do not want a maprendering\ngroup: maprendering\ntypes: PointRendering ; LineRendering ;",
"type": "array", "type": "array",
"items": { "items": {
"anyOf": [ "anyOf": [
@ -2278,7 +2278,7 @@ export default {
] ]
}, },
"mapRendering": { "mapRendering": {
"description": "Visualisation of the items on the map\nSet 'null' explicitly if you do not want a maprendering\ngroup: maprendering", "description": "Visualisation of the items on the map\nSet 'null' explicitly if you do not want a maprendering\ngroup: maprendering\ntypes: PointRendering ; LineRendering ;",
"type": "array", "type": "array",
"items": { "items": {
"anyOf": [ "anyOf": [

View file

@ -1,21 +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",
"fr": "Changements faits avec MapComplete",
"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",
"fr": "Cette carte montre tous les changements faits avec MapComplete",
"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,
@ -28,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": {
@ -41,57 +31,41 @@
}, },
"title": { "title": {
"render": { "render": {
"en": "Changeset for {theme}", "en": "Changeset for {theme}"
"de": "Änderungssatz für {theme}",
"fr": "Groupe de modifications pour {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>",
"fr": "Groupe de modifications <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?",
"fr": "Quel contributeur a fait cette modification ?",
"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>",
"fr": "Modification faite par <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?",
"fr": "Quel thème a été utilisé pour faire cette modification ?"
}, },
"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.org/{theme}'>{theme}</a>"
"de": "Geändert mit Thema <a href='https://mapcomplete.osm.be/{theme}'>{theme}</a>",
"fr": "Modifié avec le thème <a href='https://mapcomplete.osm.be/{theme}'>{theme}</a>"
} }
}, },
{ {
@ -100,29 +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?",
"fr": "En quelle langue est-ce que ce changement a été fait ?",
"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>",
"fr": "Modification faite avec <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"
@ -143,14 +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?",
"fr": "Quelle version de MapComplete a été utilisée pour faire cette modification ?"
}, },
"render": { "render": {
"en": "Made with {editor}", "en": "Made with {editor}"
"de": "Erstellt mit {editor}",
"fr": "Fait avec {editor}"
}, },
"freeform": { "freeform": {
"key": "editor" "key": "editor"
@ -492,9 +452,7 @@
} }
], ],
"question": { "question": {
"en": "Theme name contains {search}", "en": "Themename contains {search}"
"de": "Themenname enthält {search}",
"nl": "Themenaam bevat {search}"
} }
} }
] ]
@ -510,9 +468,7 @@
} }
], ],
"question": { "question": {
"en": "Made by contributor {search}", "en": "Made by contributor {search}"
"de": "Erstellt von {search}",
"nl": "Gemaakt door bijdrager {search}"
} }
} }
] ]
@ -528,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}"
} }
} }
] ]
@ -547,9 +501,7 @@
} }
], ],
"question": { "question": {
"en": "Made before {search}", "en": "Made before {search}"
"de": "Erstellt vor {search}",
"nl": "Gemaakt voor {search}"
} }
} }
] ]
@ -566,9 +518,7 @@
} }
], ],
"question": { "question": {
"en": "Made after {search}", "en": "Made after {search}"
"de": "Erstellt nach {search}",
"nl": "Gemaakt na {search}"
} }
} }
] ]
@ -584,10 +534,7 @@
} }
], ],
"question": { "question": {
"en": "User language (iso-code) {search}", "en": "User language (iso-code) {search}"
"de": "Benutzersprache (ISO-Code) {search}",
"fr": "Langage utilisateur (code-ISO) {search}",
"nl": "De taal van de bijdrager is {search}"
} }
} }
] ]
@ -603,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}"
} }
} }
] ]
@ -616,10 +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",
"fr": "Le groupe de modifications a ajouté au moins une image",
"nl": "Changeset bevat minstens één afbeelding"
} }
} }
] ]
@ -634,9 +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>",
"fr": "D'autres statistiques sont disponibles <a href='https://github.com/pietervdvn/MapComplete/tree/develop/Docs/Tools/graphs' target='_blank'>ici</a>"
} }
}, },
{ {

View file

@ -1,9 +1,10 @@
import { TagRenderingConfigJson } from "../Json/TagRenderingConfigJson" import { TagRenderingConfigJson } from "../Json/TagRenderingConfigJson"
import { LayerConfigJson } from "../Json/LayerConfigJson" import { LayerConfigJson } from "../Json/LayerConfigJson"
import { Utils } from "../../../Utils" import { Utils } from "../../../Utils"
import { QuestionableTagRenderingConfigJson } from "../Json/QuestionableTagRenderingConfigJson"
export interface DesugaringContext { export interface DesugaringContext {
tagRenderings: Map<string, TagRenderingConfigJson> tagRenderings: Map<string, QuestionableTagRenderingConfigJson>
sharedLayers: Map<string, LayerConfigJson> sharedLayers: Map<string, LayerConfigJson>
publicLayers?: Set<string> publicLayers?: Set<string>
} }

View file

@ -161,9 +161,12 @@ class ExpandTagRendering extends Conversion<
} }
convert( convert(
json: string | TagRenderingConfigJson | { builtin: string | string[]; override: any }, json:
| string
| QuestionableTagRenderingConfigJson
| { builtin: string | string[]; override: any },
context: string context: string
): { result: TagRenderingConfigJson[]; errors: string[]; warnings: string[] } { ): { result: QuestionableTagRenderingConfigJson[]; errors: string[]; warnings: string[] } {
const errors = [] const errors = []
const warnings = [] const warnings = []
@ -303,7 +306,7 @@ class ExpandTagRendering extends Conversion<
} }
return [ return [
{ <any>{
render: tr, render: tr,
id: tr.replace(/[^a-zA-Z0-9]/g, ""), id: tr.replace(/[^a-zA-Z0-9]/g, ""),
}, },
@ -416,7 +419,7 @@ class ExpandTagRendering extends Conversion<
warnings: string[], warnings: string[],
errors: string[], errors: string[],
ctx: string ctx: string
): TagRenderingConfigJson[] { ): QuestionableTagRenderingConfigJson[] {
const trs = this.convertOnce(spec, warnings, errors, ctx) const trs = this.convertOnce(spec, warnings, errors, ctx)
const result = [] const result = []
@ -547,7 +550,11 @@ export class AddQuestionBox extends DesugaringStep<LayerConfigJson> {
// ALl labels that are used in this layer // ALl labels that are used in this layer
const allLabels = new Set( const allLabels = new Set(
[].concat(...json.tagRenderings.map((tr) => (<TagRenderingConfigJson>tr).labels ?? [])) [].concat(
...json.tagRenderings.map(
(tr) => (<QuestionableTagRenderingConfigJson>tr).labels ?? []
)
)
) )
const seen = new Set() const seen = new Set()
for (const questionSpecial of questionSpecials) { for (const questionSpecial of questionSpecials) {
@ -593,7 +600,7 @@ export class AddQuestionBox extends DesugaringStep<LayerConfigJson> {
/* At this point, we know which question labels are not yet handled and which already are handled, and we /* At this point, we know which question labels are not yet handled and which already are handled, and we
* know there is no previous catch-all questions * know there is no previous catch-all questions
*/ */
const question: TagRenderingConfigJson = { const question: QuestionableTagRenderingConfigJson = {
id: "leftover-questions", id: "leftover-questions",
render: { render: {
"*": `{questions( ,${Array.from(seen).join(";")})}`, "*": `{questions( ,${Array.from(seen).join(";")})}`,
@ -670,7 +677,7 @@ export class AddEditingElements extends DesugaringStep<LayerConfigJson> {
} }
if (!ValidationUtils.hasSpecialVisualisation(json, "all_tags")) { if (!ValidationUtils.hasSpecialVisualisation(json, "all_tags")) {
const trc: TagRenderingConfigJson = { const trc: QuestionableTagRenderingConfigJson = {
id: "all-tags", id: "all-tags",
render: { "*": "{all_tags()}" }, render: { "*": "{all_tags()}" },
@ -803,6 +810,8 @@ export class ExpandRewrite<T> extends Conversion<T | RewritableConfigJson<T>, T[
return { result: [<T>json] } return { result: [<T>json] }
} }
console.log("Rewriting at", context)
const rewrite = <RewritableConfigJson<T>>json const rewrite = <RewritableConfigJson<T>>json
const keysToRewrite = rewrite.rewrite const keysToRewrite = rewrite.rewrite
const ts: T[] = [] const ts: T[] = []
@ -1142,7 +1151,7 @@ class ExpandIconBadges extends DesugaringStep<PointRenderingConfigJson | LineRen
const iconBadge: { if: TagConfigJson; then: string | TagRenderingConfigJson } = const iconBadge: { if: TagConfigJson; then: string | TagRenderingConfigJson } =
badgesJson[i] badgesJson[i]
const { errors, result, warnings } = this._expand.convert( const { errors, result, warnings } = this._expand.convert(
iconBadge.then, <QuestionableTagRenderingConfigJson>iconBadge.then,
context + ".iconBadges[" + i + "]" context + ".iconBadges[" + i + "]"
) )
errs.push(...errors) errs.push(...errors)

View file

@ -10,6 +10,8 @@ import { QuestionableTagRenderingConfigJson } from "./QuestionableTagRenderingCo
import RewritableConfigJson from "./RewritableConfigJson" import RewritableConfigJson from "./RewritableConfigJson"
import { Translatable } from "./Translatable" import { Translatable } from "./Translatable"
type MapRendering = {}
/** /**
* Configuration for a single layer * Configuration for a single layer
*/ */
@ -239,17 +241,9 @@ export interface LayerConfigJson {
* Visualisation of the items on the map * Visualisation of the items on the map
* Set 'null' explicitly if you do not want a maprendering * Set 'null' explicitly if you do not want a maprendering
* group: maprendering * group: maprendering
* types: PointRendering ; LineRendering
*/ */
mapRendering?: ( mapRendering?: (PointRenderingConfigJson | LineRenderingConfigJson)[]
| PointRenderingConfigJson
| LineRenderingConfigJson
| RewritableConfigJson<
| LineRenderingConfigJson
| PointRenderingConfigJson
| LineRenderingConfigJson[]
| PointRenderingConfigJson[]
>
)[]
/** /**
* If set, this layer will pass all the features it receives onto the next layer. * If set, this layer will pass all the features it receives onto the next layer.

View file

@ -28,9 +28,6 @@ export let path: (string | number)[] = [];
</div> </div>
</div> </div>
{:else} {:else}
<div class="literal-code">
{JSON.stringify(configs, null, " ")}
</div>
<div class="pl-2 flex flex-col gap-y-1 w-full"> <div class="pl-2 flex flex-col gap-y-1 w-full">
{#each configs as config} {#each configs as config}
<SchemaBasedInput {state} path={path.concat(config.path)} schema={config} /> <SchemaBasedInput {state} path={path.concat(config.path)} schema={config} />

View file

@ -122,7 +122,6 @@
const oldOption = chosenOption; const oldOption = chosenOption;
chosenOption = tags["value"] ? Number(tags["value"]) : defaultOption; chosenOption = tags["value"] ? Number(tags["value"]) : defaultOption;
const type = schema.type[chosenOption]; const type = schema.type[chosenOption];
console.log("Subtype is", type, {chosenOption, oldOption, schema});
if (chosenOption !== oldOption) { if (chosenOption !== oldOption) {
// Reset the values beneath // Reset the values beneath
subSchemas = []; subSchemas = [];

View file

@ -1583,6 +1583,7 @@
], ],
"required": false, "required": false,
"hints": { "hints": {
"types": "PointRendering ; LineRendering ;",
"group": "maprendering" "group": "maprendering"
}, },
"type": [ "type": [
@ -43330,6 +43331,10 @@
"if": "value=elevator", "if": "value=elevator",
"then": "elevator - This layer show elevators and asks for operational status and elevator dimensions. Useful for wheelchair accessibility information" "then": "elevator - This layer show elevators and asks for operational status and elevator dimensions. Useful for wheelchair accessibility information"
}, },
{
"if": "value=elongated_coin",
"then": "elongated_coin - Layer showing penny presses."
},
{ {
"if": "value=entrance", "if": "value=entrance",
"then": "entrance - A layer showing entrances and offering capabilities to survey some advanced data which is important for e.g. wheelchair users (but also bicycle users, people who want to deliver, …)" "then": "entrance - A layer showing entrances and offering capabilities to survey some advanced data which is important for e.g. wheelchair users (but also bicycle users, people who want to deliver, …)"