forked from MapComplete/MapComplete
Fix themes + fix tests
This commit is contained in:
parent
0fbde7ec24
commit
70da6685e1
8 changed files with 20 additions and 20 deletions
|
@ -95,7 +95,7 @@ export default class LayoutConfig {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
this.defaultBackgroundId = json.defaultBackgroundId;
|
this.defaultBackgroundId = json.defaultBackgroundId;
|
||||||
this.layers = LayoutConfig.ExtractLayers(json, this.units, official);
|
this.layers = LayoutConfig.ExtractLayers(json, this.units, official, context);
|
||||||
|
|
||||||
// ALl the layers are constructed, let them share tags in now!
|
// ALl the layers are constructed, let them share tags in now!
|
||||||
const roaming: { r, source: LayerConfig }[] = []
|
const roaming: { r, source: LayerConfig }[] = []
|
||||||
|
@ -160,12 +160,12 @@ export default class LayoutConfig {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ExtractLayers(json: LayoutConfigJson, units: Unit[], official: boolean): LayerConfig[] {
|
private static ExtractLayers(json: LayoutConfigJson, units: Unit[], official: boolean, context: string): LayerConfig[] {
|
||||||
const result: LayerConfig[] = []
|
const result: LayerConfig[] = []
|
||||||
|
|
||||||
json.layers.forEach((layer, i) => {
|
json.layers.forEach((layer, i) => {
|
||||||
if (typeof layer === "string") {
|
if (typeof layer === "string") {
|
||||||
if (AllKnownLayers.sharedLayersJson[layer] !== undefined) {
|
if (AllKnownLayers.sharedLayersJson.get(layer) !== undefined) {
|
||||||
if (json.overrideAll !== undefined) {
|
if (json.overrideAll !== undefined) {
|
||||||
let lyr = JSON.parse(JSON.stringify(AllKnownLayers.sharedLayersJson[layer]));
|
let lyr = JSON.parse(JSON.stringify(AllKnownLayers.sharedLayersJson[layer]));
|
||||||
const newLayer = new LayerConfig(Utils.Merge(json.overrideAll, lyr), units, `${json.id}+overrideAll.layers[${i}]`, official)
|
const newLayer = new LayerConfig(Utils.Merge(json.overrideAll, lyr), units, `${json.id}+overrideAll.layers[${i}]`, official)
|
||||||
|
@ -176,7 +176,8 @@ export default class LayoutConfig {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw "Unknown fixed layer " + layer;
|
console.log("Layer ", layer," not kown, try one of", Array.from(AllKnownLayers.sharedLayers.keys()).join(", "))
|
||||||
|
throw `Unknown builtin layer ${layer} at ${context}.layers[${i}]`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,9 +196,9 @@ export default class LayoutConfig {
|
||||||
names = [names]
|
names = [names]
|
||||||
}
|
}
|
||||||
names.forEach(name => {
|
names.forEach(name => {
|
||||||
const shared = AllKnownLayers.sharedLayersJson[name];
|
const shared = AllKnownLayers.sharedLayersJson.get(name);
|
||||||
if (shared === undefined) {
|
if (shared === undefined) {
|
||||||
throw "Unknown fixed layer " + name;
|
throw `Unknown shared/builtin layer ${name} at ${context}.layers[${i}]. Available layers are ${Array.from(AllKnownLayers.sharedLayersJson.keys()).join(", ")}`;
|
||||||
}
|
}
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
let newLayer: LayerConfigJson = Utils.Merge(layer.override, JSON.parse(JSON.stringify(shared))); // We make a deep copy of the shared layer, in order to protect it from changes
|
let newLayer: LayerConfigJson = Utils.Merge(layer.override, JSON.parse(JSON.stringify(shared))); // We make a deep copy of the shared layer, in order to protect it from changes
|
||||||
|
|
|
@ -422,19 +422,19 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": {
|
"icon": {
|
||||||
"render": "./assets/themes/surveillance_cameras/logo.svg",
|
"render": "./assets/themes/surveillance/logo.svg",
|
||||||
"mappings": [
|
"mappings": [
|
||||||
{
|
{
|
||||||
"if": "camera:type=dome",
|
"if": "camera:type=dome",
|
||||||
"then": "./assets/themes/surveillance_cameras/dome.svg"
|
"then": "./assets/themes/surveillance/dome.svg"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"if": "_direction:leftright=right",
|
"if": "_direction:leftright=right",
|
||||||
"then": "./assets/themes/surveillance_cameras/cam_right.svg"
|
"then": "./assets/themes/surveillance/cam_right.svg"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"if": "_direction:leftright=left",
|
"if": "_direction:leftright=left",
|
||||||
"then": "./assets/themes/surveillance_cameras/cam_left.svg"
|
"then": "./assets/themes/surveillance/cam_left.svg"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -38,13 +38,13 @@
|
||||||
"nb_NO"
|
"nb_NO"
|
||||||
],
|
],
|
||||||
"maintainer": "joost schouppe",
|
"maintainer": "joost schouppe",
|
||||||
"icon": "./assets/themes/campersites/caravan.svg",
|
"icon": "./assets/themes/campersite/caravan.svg",
|
||||||
"version": "0",
|
"version": "0",
|
||||||
"startLat": 43.14,
|
"startLat": 43.14,
|
||||||
"startLon": 3.14,
|
"startLon": 3.14,
|
||||||
"startZoom": 14,
|
"startZoom": 14,
|
||||||
"widenFactor": 0.05,
|
"widenFactor": 0.05,
|
||||||
"socialImage": "./assets/themes/campersites/Bar%C3%9Fel_Wohnmobilstellplatz.jpg",
|
"socialImage": "./assets/themes/campersite/Bar%C3%9Fel_Wohnmobilstellplatz.jpg",
|
||||||
"layers": [
|
"layers": [
|
||||||
{
|
{
|
||||||
"id": "caravansites",
|
"id": "caravansites",
|
||||||
|
@ -522,7 +522,7 @@
|
||||||
"reviews"
|
"reviews"
|
||||||
],
|
],
|
||||||
"icon": {
|
"icon": {
|
||||||
"render": "circle:white;./assets/themes/campersites/caravan.svg",
|
"render": "circle:white;./assets/themes/campersite/caravan.svg",
|
||||||
"mappings": [
|
"mappings": [
|
||||||
{
|
{
|
||||||
"if": {
|
"if": {
|
||||||
|
@ -530,7 +530,7 @@
|
||||||
"fee=no"
|
"fee=no"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"then": "circle:white;./assets/themes/campersites/caravan_green.svg"
|
"then": "circle:white;./assets/themes/campersite/caravan_green.svg"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -862,7 +862,7 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": {
|
"icon": {
|
||||||
"render": "circle:white;./assets/themes/campersites/sanitary_dump_station.svg"
|
"render": "circle:white;./assets/themes/campersite/sanitary_dump_station.svg"
|
||||||
},
|
},
|
||||||
"width": {
|
"width": {
|
||||||
"render": "8"
|
"render": "8"
|
||||||
|
|
|
@ -976,7 +976,6 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"hideUnderlayingFeaturesMinPercentage": 0,
|
|
||||||
"icon": {
|
"icon": {
|
||||||
"render": "./assets/themes/cycle_infra/bicycleway.svg"
|
"render": "./assets/themes/cycle_infra/bicycleway.svg"
|
||||||
},
|
},
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
"zh_Hant"
|
"zh_Hant"
|
||||||
],
|
],
|
||||||
"maintainer": "",
|
"maintainer": "",
|
||||||
"icon": "./assets/themes/surveillance_cameras/logo.svg",
|
"icon": "./assets/themes/surveillance/logo.svg",
|
||||||
"version": "0",
|
"version": "0",
|
||||||
"startLat": 0,
|
"startLat": 0,
|
||||||
"startLon": 0,
|
"startLon": 0,
|
||||||
|
|
Loading…
Reference in a new issue