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

View file

@ -167,7 +167,7 @@ export default {
]
},
"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",
"items": {
"anyOf": [

View file

@ -1898,7 +1898,7 @@
]
},
"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",
"items": {
"anyOf": [
@ -2300,7 +2300,7 @@
]
},
"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",
"items": {
"anyOf": [

View file

@ -1877,7 +1877,7 @@ export default {
]
},
"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",
"items": {
"anyOf": [
@ -2278,7 +2278,7 @@ export default {
]
},
"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",
"items": {
"anyOf": [

View file

@ -1,21 +1,13 @@
{
"id": "mapcomplete-changes",
"title": {
"en": "Changes made with MapComplete",
"de": "Mit MapComplete erstellte Änderungen",
"fr": "Changements faits avec MapComplete",
"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",
"fr": "Cette carte montre tous les changements faits avec MapComplete",
"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,
@ -28,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": {
@ -41,57 +31,41 @@
},
"title": {
"render": {
"en": "Changeset for {theme}",
"de": "Änderungssatz für {theme}",
"fr": "Groupe de modifications pour {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>",
"fr": "Groupe de modifications <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?",
"fr": "Quel contributeur a fait cette modification ?",
"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>",
"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>"
"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?",
"fr": "Quel thème a été utilisé pour faire cette modification ?"
"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>",
"fr": "Modifié avec le thème <a href='https://mapcomplete.osm.be/{theme}'>{theme}</a>"
"en": "Change with theme <a href='https://mapcomplete.org/{theme}'>{theme}</a>"
}
},
{
@ -100,29 +74,19 @@
"key": "locale"
},
"question": {
"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?"
"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>",
"fr": "Modification faite avec <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"
@ -143,14 +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?",
"fr": "Quelle version de MapComplete a été utilisée pour faire cette modification ?"
"en": "What version of MapComplete was used to make this change?"
},
"render": {
"en": "Made with {editor}",
"de": "Erstellt mit {editor}",
"fr": "Fait avec {editor}"
"en": "Made with {editor}"
},
"freeform": {
"key": "editor"
@ -492,9 +452,7 @@
}
],
"question": {
"en": "Theme name contains {search}",
"de": "Themenname enthält {search}",
"nl": "Themenaam bevat {search}"
"en": "Themename contains {search}"
}
}
]
@ -510,9 +468,7 @@
}
],
"question": {
"en": "Made by contributor {search}",
"de": "Erstellt von {search}",
"nl": "Gemaakt door bijdrager {search}"
"en": "Made by contributor {search}"
}
}
]
@ -528,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}"
}
}
]
@ -547,9 +501,7 @@
}
],
"question": {
"en": "Made before {search}",
"de": "Erstellt vor {search}",
"nl": "Gemaakt voor {search}"
"en": "Made before {search}"
}
}
]
@ -566,9 +518,7 @@
}
],
"question": {
"en": "Made after {search}",
"de": "Erstellt nach {search}",
"nl": "Gemaakt na {search}"
"en": "Made after {search}"
}
}
]
@ -584,10 +534,7 @@
}
],
"question": {
"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}"
"en": "User language (iso-code) {search}"
}
}
]
@ -603,9 +550,7 @@
}
],
"question": {
"en": "Made with host {search}",
"de": "Erstellt mit Host {search}",
"nl": "Gemaakt met host {search}"
"en": "Made with host {search}"
}
}
]
@ -616,10 +561,7 @@
{
"osmTags": "add-image>0",
"question": {
"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"
"en": "Changeset added at least one image"
}
}
]
@ -634,9 +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>",
"fr": "D'autres statistiques sont disponibles <a href='https://github.com/pietervdvn/MapComplete/tree/develop/Docs/Tools/graphs' target='_blank'>ici</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

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

View file

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

View file

@ -10,6 +10,8 @@ import { QuestionableTagRenderingConfigJson } from "./QuestionableTagRenderingCo
import RewritableConfigJson from "./RewritableConfigJson"
import { Translatable } from "./Translatable"
type MapRendering = {}
/**
* Configuration for a single layer
*/
@ -239,17 +241,9 @@ export interface LayerConfigJson {
* Visualisation of the items on the map
* Set 'null' explicitly if you do not want a maprendering
* group: maprendering
* types: PointRendering ; LineRendering
*/
mapRendering?: (
| PointRenderingConfigJson
| LineRenderingConfigJson
| RewritableConfigJson<
| LineRenderingConfigJson
| PointRenderingConfigJson
| LineRenderingConfigJson[]
| PointRenderingConfigJson[]
>
)[]
mapRendering?: (PointRenderingConfigJson | LineRenderingConfigJson)[]
/**
* 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>
{:else}
<div class="literal-code">
{JSON.stringify(configs, null, " ")}
</div>
<div class="pl-2 flex flex-col gap-y-1 w-full">
{#each configs as config}
<SchemaBasedInput {state} path={path.concat(config.path)} schema={config} />

View file

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

View file

@ -1583,6 +1583,7 @@
],
"required": false,
"hints": {
"types": "PointRendering ; LineRendering ;",
"group": "maprendering"
},
"type": [
@ -43330,6 +43331,10 @@
"if": "value=elevator",
"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",
"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, …)"