diff --git a/Logic/FeatureSource/FilteringFeatureSource.ts b/Logic/FeatureSource/FilteringFeatureSource.ts index 4023465..0f05c29 100644 --- a/Logic/FeatureSource/FilteringFeatureSource.ts +++ b/Logic/FeatureSource/FilteringFeatureSource.ts @@ -15,16 +15,21 @@ public readonly name = "FilteringFeatureSource" const self = this; + console.log("INITING pipeline: ",layers) function update() { const layerDict = {}; + if(layers.data.length == 0){ + throw "No layers defined!" + } for (const layer of layers.data) { layerDict[layer.layerDef.id] = layer; } const features: { feature: any, freshness: Date }[] = upstream.features.data; + const missingLayers = new Set(); const newFeatures = features.filter(f => { const layerId = f.feature._matching_layer_id; @@ -35,7 +40,7 @@ public readonly name = "FilteringFeatureSource" layerDef: LayerConfig } = layerDict[layerId]; if (layer === undefined) { - console.error("No layer found with id ", layerId); + missingLayers.add(layerId) return true; } @@ -65,6 +70,9 @@ public readonly name = "FilteringFeatureSource" }); self.features.setData(newFeatures); + if(missingLayers.size > 0){ + console.error("Some layers were not found: ", Array.from(missingLayers)) + } } diff --git a/Logic/FeatureSource/WayHandlingApplyingFeatureSource.ts b/Logic/FeatureSource/WayHandlingApplyingFeatureSource.ts index fcce1a4..25be78c 100644 --- a/Logic/FeatureSource/WayHandlingApplyingFeatureSource.ts +++ b/Logic/FeatureSource/WayHandlingApplyingFeatureSource.ts @@ -7,16 +7,17 @@ import {GeoOperations} from "../GeoOperations"; * This is the part of the pipeline which introduces extra points at the center of an area (but only if this is demanded by the wayhandling) */ export default class WayHandlingApplyingFeatureSource implements FeatureSource { - features: UIEventSource<{ feature: any; freshness: Date }[]>; + public readonly features: UIEventSource<{ feature: any; freshness: Date }[]>; + public readonly name; constructor(layers: UIEventSource<{ layerDef: LayerConfig }[]>, upstream: FeatureSource) { - + this.name = "Wayhandling of " + upstream.name; this.features = upstream.features.map( features => { - if(features === undefined){ + if (features === undefined) { return; } @@ -28,7 +29,7 @@ export default class WayHandlingApplyingFeatureSource implements FeatureSource { allDefaultWayHandling = false; } } - + const newFeatures: { feature: any, freshness: Date }[] = []; for (const f of features) { const feat = f.feature; @@ -37,8 +38,8 @@ export default class WayHandlingApplyingFeatureSource implements FeatureSource { if (layer === undefined) { throw "No layer found with id " + layerId; } - - if(layer.wayHandling === LayerConfig.WAYHANDLING_DEFAULT){ + + if (layer.wayHandling === LayerConfig.WAYHANDLING_DEFAULT) { newFeatures.push(f); continue; } @@ -52,12 +53,12 @@ export default class WayHandlingApplyingFeatureSource implements FeatureSource { // Create the copy const centerPoint = GeoOperations.centerpoint(feat); centerPoint["_matching_layer_id"] = feat._matching_layer_id; + newFeatures.push({feature: centerPoint, freshness: f.freshness}); - - if(layer.wayHandling === LayerConfig.WAYHANDLING_CENTER_AND_WAY){ + if (layer.wayHandling === LayerConfig.WAYHANDLING_CENTER_AND_WAY) { newFeatures.push(f); } - + } return newFeatures; }