Add intersection function

This commit is contained in:
Pieter Vander Vennet 2021-12-19 02:11:22 +01:00
parent be9784e047
commit 99a38f2b10
5 changed files with 75 additions and 8 deletions

View file

@ -156,6 +156,9 @@ export default class LayoutConfig {
private static ExtractLayers(json: LayoutConfigJson, official: boolean, context: string): { layers: LayerConfig[], extractAllNodes: boolean } {
const result: LayerConfig[] = []
let exportAllNodes = false
if(json.layers === undefined){
throw "Got undefined layers for "+json.id+" at "+context
}
json.layers.forEach((layer, i) => {
if (typeof layer === "string") {
@ -193,12 +196,11 @@ export default class LayoutConfig {
if (typeof names === "string") {
names = [names]
}
// This is a very special layer which triggers special behaviour
exportAllNodes = names.some(name => name === "type_node");
names.forEach(name => {
if (name === "type_node") {
// This is a very special layer which triggers special behaviour
exportAllNodes = true;
}
const shared = AllKnownLayers.sharedLayersJson.get(name);
if (shared === undefined) {
throw `Unknown shared/builtin layer ${name} at ${context}.layers[${i}]. Available layers are ${Array.from(AllKnownLayers.sharedLayersJson.keys()).join(", ")}`;