Refactoring: move the units into the layers instead of the themes
This commit is contained in:
parent
3492b5d403
commit
206aff2c9a
16 changed files with 259 additions and 300 deletions
|
@ -1,7 +1,6 @@
|
|||
import ScriptUtils from "./ScriptUtils";
|
||||
import {writeFileSync} from "fs";
|
||||
import * as licenses from "../assets/generated/license_info.json"
|
||||
import AllKnownLayers from "../Customizations/AllKnownLayers";
|
||||
import {LayoutConfigJson} from "../Models/ThemeConfig/Json/LayoutConfigJson";
|
||||
import LayoutConfig from "../Models/ThemeConfig/LayoutConfig";
|
||||
import {LayerConfigJson} from "../Models/ThemeConfig/Json/LayerConfigJson";
|
||||
|
@ -49,7 +48,7 @@ class LayerOverviewUtils {
|
|||
errorCount.push("Layer " + layerJson.id + "still uses the old 'overpassTags'-format. Please use \"source\": {\"osmTags\": <tags>}' instead of \"overpassTags\": <tags> (note: this isn't your fault, the custom theme generator still spits out the old format)")
|
||||
}
|
||||
try {
|
||||
const layer = new LayerConfig(layerJson, AllKnownLayers.sharedUnits, "test", true)
|
||||
const layer = new LayerConfig(layerJson, "test", true)
|
||||
const images = Array.from(layer.ExtractImages())
|
||||
const remoteImages = images.filter(img => img.indexOf("http") == 0)
|
||||
for (const remoteImage of remoteImages) {
|
||||
|
@ -104,7 +103,7 @@ class LayerOverviewUtils {
|
|||
throw "Duplicate identifier: " + layerFile.parsed.id + " in file " + layerFile.path
|
||||
}
|
||||
layerErrorCount.push(...this.validateLayer(layerFile.parsed, layerFile.path, knownPaths))
|
||||
knownLayerIds.set(layerFile.parsed.id, new LayerConfig(layerFile.parsed, AllKnownLayers.sharedUnits))
|
||||
knownLayerIds.set(layerFile.parsed.id, new LayerConfig(layerFile.parsed))
|
||||
}
|
||||
|
||||
let themeErrorCount = []
|
||||
|
@ -114,6 +113,9 @@ class LayerOverviewUtils {
|
|||
if (typeof themeFile.language === "string") {
|
||||
themeErrorCount.push("The theme " + themeFile.id + " has a string as language. Please use a list of strings")
|
||||
}
|
||||
if (themeFile["units"] !== undefined) {
|
||||
themeErrorCount.push("The theme " + themeFile.id + " has units defined - these should be defined on the layer instead. (Hint: use overrideAll: { '+units': ... }) ")
|
||||
}
|
||||
for (const layer of themeFile.layers) {
|
||||
if (typeof layer === "string") {
|
||||
if (!knownLayerIds.has(layer)) {
|
||||
|
@ -153,7 +155,6 @@ class LayerOverviewUtils {
|
|||
themeErrorCount.push("Theme ids should be the same as the name.json, but we got id: " + theme.id + " and filename " + filename + " (" + themePath + ")")
|
||||
}
|
||||
|
||||
|
||||
} catch (e) {
|
||||
themeErrorCount.push("Could not parse theme " + themeFile["id"] + "due to", e)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue