forked from MapComplete/MapComplete
Housekeeping: formatting
This commit is contained in:
parent
9d53a45f9a
commit
1528dfaae1
168 changed files with 3332 additions and 4560 deletions
|
@ -565,25 +565,39 @@ class PostvalidateTheme extends DesugaringStep<LayoutConfigJson> {
|
|||
|
||||
convert(json: LayoutConfigJson, context: ConversionContext): LayoutConfigJson {
|
||||
for (const l of json.layers) {
|
||||
const layer = <LayerConfigJson> l
|
||||
const basedOn = <string> layer["_basedOn"]
|
||||
const layer = <LayerConfigJson>l
|
||||
const basedOn = <string>layer["_basedOn"]
|
||||
const basedOnDef = this._state.sharedLayers.get(basedOn)
|
||||
if(!basedOn){
|
||||
if (!basedOn) {
|
||||
continue
|
||||
}
|
||||
if(layer["name"] === null){
|
||||
if (layer["name"] === null) {
|
||||
continue
|
||||
}
|
||||
const sameBasedOn = <LayerConfigJson[]> json.layers.filter(l => l["_basedOn"] === layer["_basedOn"] && l["id"] !== layer.id)
|
||||
const minZoomAll = Math.min(...sameBasedOn.map(sbo => sbo.minzoom))
|
||||
const sameBasedOn = <LayerConfigJson[]>(
|
||||
json.layers.filter(
|
||||
(l) => l["_basedOn"] === layer["_basedOn"] && l["id"] !== layer.id
|
||||
)
|
||||
)
|
||||
const minZoomAll = Math.min(...sameBasedOn.map((sbo) => sbo.minzoom))
|
||||
|
||||
const sameNameDetected = sameBasedOn.some( same => JSON.stringify(layer["name"]) === JSON.stringify(same["name"]))
|
||||
if(!sameNameDetected){
|
||||
const sameNameDetected = sameBasedOn.some(
|
||||
(same) => JSON.stringify(layer["name"]) === JSON.stringify(same["name"])
|
||||
)
|
||||
if (!sameNameDetected) {
|
||||
// The name is unique, so it'll won't be confusing
|
||||
continue
|
||||
}
|
||||
if(minZoomAll < layer.minzoom){
|
||||
context.err("There are multiple layers based on "+basedOn+". The layer with id "+layer.id+" has a minzoom of "+layer.minzoom+", and has a name set. Another similar layer has a lower minzoom. As such, the layer selection might show 'zoom in to see features' even though some of the features are already visible. Set `\"name\": null` for this layer and eventually remove the 'name':null for the other layer.")
|
||||
if (minZoomAll < layer.minzoom) {
|
||||
context.err(
|
||||
"There are multiple layers based on " +
|
||||
basedOn +
|
||||
". The layer with id " +
|
||||
layer.id +
|
||||
" has a minzoom of " +
|
||||
layer.minzoom +
|
||||
", and has a name set. Another similar layer has a lower minzoom. As such, the layer selection might show 'zoom in to see features' even though some of the features are already visible. Set `\"name\": null` for this layer and eventually remove the 'name':null for the other layer."
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue