forked from MapComplete/MapComplete
Feature: layer validation system now builds a dependency graph and only updates what is needed, makes "refresh:layeroverview" redundant
This commit is contained in:
parent
1bd060df82
commit
fda0bc6b2e
19 changed files with 301 additions and 186 deletions
|
|
@ -239,11 +239,11 @@ export class ExpandFilter extends DesugaringStep<LayerConfigJson> {
|
|||
)
|
||||
}
|
||||
const layer = this._state.sharedLayers.get(split[0])
|
||||
if (layer === undefined) {
|
||||
if (!layer) {
|
||||
context.err("Layer '" + split[0] + "' not found")
|
||||
}
|
||||
const expectedId = split[1]
|
||||
const expandedFilter = (<(FilterConfigJson | string)[]>layer.filter).find(
|
||||
const expandedFilter = (<(FilterConfigJson | string)[]>layer?.filter)?.find(
|
||||
(f) => typeof f !== "string" && f.id === expectedId
|
||||
)
|
||||
if (expandedFilter === undefined) {
|
||||
|
|
|
|||
|
|
@ -380,15 +380,10 @@ export class ExpandTagRendering extends Conversion<
|
|||
Utils.NoNull(Array.from(state.sharedLayers.keys())),
|
||||
(s) => s
|
||||
)
|
||||
if (state.sharedLayers.size === 0) {
|
||||
ctx.warn(
|
||||
"BOOTSTRAPPING. Rerun generate layeroverview. While reusing tagrendering: " +
|
||||
name +
|
||||
": layer " +
|
||||
layerName +
|
||||
" not found for now, but ignoring as this is a bootstrapping run. "
|
||||
)
|
||||
if (candidates.length === 0) {
|
||||
ctx.err("While reusing a tagRendering: " + name + "; no candidates in layer " + layerName)
|
||||
} else {
|
||||
console.error("Bench was not found...")
|
||||
ctx.err(
|
||||
": While reusing tagrendering: " +
|
||||
name +
|
||||
|
|
@ -400,10 +395,15 @@ export class ExpandTagRendering extends Conversion<
|
|||
}
|
||||
continue
|
||||
}
|
||||
if (layer.source === "special:stub") {
|
||||
// We are dealing with a looping import, no error is necessary
|
||||
continue
|
||||
}
|
||||
candidates = Utils.NoNull(layer.tagRenderings.map((tr) => tr["id"])).map(
|
||||
(id) => layerName + "." + id
|
||||
)
|
||||
}
|
||||
|
||||
candidates = Utils.sortedByLevenshteinDistance(name, candidates, (i) => i)
|
||||
ctx.err(
|
||||
"The tagRendering with identifier " +
|
||||
|
|
|
|||
|
|
@ -1048,6 +1048,11 @@ export class PrepareLayer extends Fuse<LayerConfigJson> {
|
|||
if (json === undefined || json === null) {
|
||||
throw "Error: prepareLayer got null"
|
||||
}
|
||||
if (json.source?.["osmTags"] !== undefined && json.source?.["osmTags"]?.["and"] === undefined) {
|
||||
json = { ...json }
|
||||
json.source = <any>{ ...(<object>json.source) }
|
||||
json.source["osmTags"] = { "and": [json.source["osmTags"]] }
|
||||
}
|
||||
return super.convert(json, context)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue