forked from MapComplete/MapComplete
Studo: WIP
This commit is contained in:
parent
7ebb3d721c
commit
338599454c
30 changed files with 42794 additions and 749 deletions
|
@ -149,7 +149,7 @@ class ExpandTagRendering extends Conversion<
|
|||
this._options = options
|
||||
this._tagRenderingsByLabel = new Map<string, TagRenderingConfigJson[]>()
|
||||
for (const trconfig of state.tagRenderings?.values() ?? []) {
|
||||
for (const label of trconfig.labels ?? []) {
|
||||
for (const label of trconfig["labels"] ?? []) {
|
||||
let withLabel = this._tagRenderingsByLabel.get(label)
|
||||
if (withLabel === undefined) {
|
||||
withLabel = []
|
||||
|
@ -193,7 +193,7 @@ class ExpandTagRendering extends Conversion<
|
|||
for (let foundTr of indirect) {
|
||||
foundTr = Utils.Clone<any>(foundTr)
|
||||
Utils.Merge(tagRenderingConfigJson["override"] ?? {}, foundTr)
|
||||
foundTr.id = tagRenderingConfigJson.id ?? foundTr.id
|
||||
foundTr["id"] = tagRenderingConfigJson["id"] ?? foundTr["id"]
|
||||
result.push(foundTr)
|
||||
}
|
||||
} else {
|
||||
|
@ -239,9 +239,9 @@ class ExpandTagRendering extends Conversion<
|
|||
matchingTrs = layerTrs
|
||||
} else if (id.startsWith("*")) {
|
||||
const id_ = id.substring(1)
|
||||
matchingTrs = layerTrs.filter((tr) => tr.labels?.indexOf(id_) >= 0)
|
||||
matchingTrs = layerTrs.filter((tr) => tr["labels"]?.indexOf(id_) >= 0)
|
||||
} else {
|
||||
matchingTrs = layerTrs.filter((tr) => tr.id === id || tr.labels?.indexOf(id) >= 0)
|
||||
matchingTrs = layerTrs.filter((tr) => tr["id"] === id || tr["labels"]?.indexOf(id) >= 0)
|
||||
}
|
||||
|
||||
const contextWriter = new AddContextToTranslations<TagRenderingConfigJson>("layers:")
|
||||
|
@ -489,7 +489,15 @@ class DetectInline extends DesugaringStep<QuestionableTagRenderingConfigJson> {
|
|||
}
|
||||
}
|
||||
json = JSON.parse(JSON.stringify(json))
|
||||
json.freeform.inline ??= true
|
||||
if (typeof json.freeform === "string") {
|
||||
errors.push("At " + context + ": 'freeform' is a string, but should be an object")
|
||||
return { result: json, errors }
|
||||
}
|
||||
try {
|
||||
json.freeform.inline ??= true
|
||||
} catch (e) {
|
||||
errors.push("At " + context + ": " + e.message)
|
||||
}
|
||||
return { result: json, errors }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,8 +64,7 @@ export interface LayerConfigJson {
|
|||
| {
|
||||
/**
|
||||
* question: Which tags must be present on the feature to show it in this layer?
|
||||
*
|
||||
* Every source must set which tags have to be present in order to load the given layer.
|
||||
* Every source must set which tags have to be present in order to load the given layer.
|
||||
*/
|
||||
osmTags: TagConfigJson
|
||||
/**
|
||||
|
@ -238,21 +237,19 @@ export interface LayerConfigJson {
|
|||
|
||||
/**
|
||||
* Visualisation of the items on the map
|
||||
*
|
||||
* Set 'null' explicitly if you do not want a maprendering
|
||||
* group: maprendering
|
||||
*/
|
||||
mapRendering:
|
||||
| null
|
||||
| (
|
||||
| PointRenderingConfigJson
|
||||
mapRendering?: (
|
||||
| PointRenderingConfigJson
|
||||
| LineRenderingConfigJson
|
||||
| RewritableConfigJson<
|
||||
| LineRenderingConfigJson
|
||||
| RewritableConfigJson<
|
||||
| LineRenderingConfigJson
|
||||
| PointRenderingConfigJson
|
||||
| LineRenderingConfigJson[]
|
||||
| PointRenderingConfigJson[]
|
||||
>
|
||||
)[]
|
||||
| PointRenderingConfigJson
|
||||
| LineRenderingConfigJson[]
|
||||
| PointRenderingConfigJson[]
|
||||
>
|
||||
)[]
|
||||
|
||||
/**
|
||||
* If set, this layer will pass all the features it receives onto the next layer.
|
||||
|
@ -467,7 +464,7 @@ export interface LayerConfigJson {
|
|||
* A no-delete option is offered as 'reason to delete it', but secretly retags.
|
||||
*
|
||||
* group: editing
|
||||
* types: use an advanced delete configuration ; boolean
|
||||
* types: Use an advanced delete configuration ; boolean
|
||||
* iftrue: Allow deletion
|
||||
* iffalse: Do not allow deletion
|
||||
*
|
||||
|
|
|
@ -260,7 +260,7 @@ export interface QuestionableTagRenderingConfigJson extends TagRenderingConfigJs
|
|||
questionHint?: string | Translatable
|
||||
|
||||
/**
|
||||
* A list of labels. These are strings that are used for various purposes, e.g. to filter them away
|
||||
* A list of labels. These are strings that are used for various purposes, e.g. to only include a subset of the tagRenderings when reusing a layer
|
||||
*/
|
||||
labels?: string[]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue