forked from MapComplete/MapComplete
Fix: improve detection of needed layers
This commit is contained in:
parent
6c730f5581
commit
f94914297f
1 changed files with 23 additions and 21 deletions
|
|
@ -108,29 +108,31 @@ export default class DependencyCalculator {
|
||||||
}
|
}
|
||||||
let currentKey = undefined
|
let currentKey = undefined
|
||||||
let currentLine = undefined
|
let currentLine = undefined
|
||||||
|
const detectNearyFeatures = (layerId) => {
|
||||||
|
if (layerId === "*") {
|
||||||
|
// This is a wildcard
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
|
// The important line: steal the dependencies!
|
||||||
|
deps.push({
|
||||||
|
neededLayer: layerId,
|
||||||
|
reason: "a calculated tag loads features from this layer",
|
||||||
|
context:
|
||||||
|
"calculatedTag[" +
|
||||||
|
currentLine +
|
||||||
|
"] which calculates the value for " +
|
||||||
|
currentKey,
|
||||||
|
neededBy: layer.id,
|
||||||
|
checkHasSnapName: false
|
||||||
|
})
|
||||||
|
|
||||||
|
return []
|
||||||
|
}
|
||||||
const params: ExtraFuncParams = {
|
const params: ExtraFuncParams = {
|
||||||
getFeatureById: () => undefined,
|
getFeatureById: () => undefined,
|
||||||
getFeaturesWithin: (layerId) => {
|
getFeaturesWithin: detectNearyFeatures,
|
||||||
if (layerId === "*") {
|
getProbablyOverlapsWith: detectNearyFeatures
|
||||||
// This is a wildcard
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
|
|
||||||
// The important line: steal the dependencies!
|
|
||||||
deps.push({
|
|
||||||
neededLayer: layerId,
|
|
||||||
reason: "a calculated tag loads features from this layer",
|
|
||||||
context:
|
|
||||||
"calculatedTag[" +
|
|
||||||
currentLine +
|
|
||||||
"] which calculates the value for " +
|
|
||||||
currentKey,
|
|
||||||
neededBy: layer.id,
|
|
||||||
checkHasSnapName: false,
|
|
||||||
})
|
|
||||||
|
|
||||||
return []
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
const helpers = ExtraFunctions.constructHelpers(params)
|
const helpers = ExtraFunctions.constructHelpers(params)
|
||||||
// ... Run the calculated tag code, which will trigger the getFeaturesWithin above...
|
// ... Run the calculated tag code, which will trigger the getFeaturesWithin above...
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue