More refactoring of the featuresources, cleanup, small changes

This commit is contained in:
Pieter Vander Vennet 2021-09-21 01:47:58 +02:00
parent d144f70ffb
commit c11ff652b8
7 changed files with 121 additions and 79 deletions

View file

@ -0,0 +1,22 @@
import {UIEventSource} from "../Logic/UIEventSource";
import FilteredLayer from "../Models/FilteredLayer";
import ShowDataLayer, {ShowDataLayerOptions} from "./ShowDataLayer/ShowDataLayer";
import PerLayerFeatureSourceSplitter from "../Logic/FeatureSource/PerLayerFeatureSourceSplitter";
/**
* SHows geojson on the given leaflet map, but attempts to figure out the correct layer first
*/
export default class ShowDataMultiLayer {
constructor(options: ShowDataLayerOptions & { layers: UIEventSource<FilteredLayer[]> }) {
new PerLayerFeatureSourceSplitter(options.layers, (perLayer => {
const newOptions = {
layerToShow: perLayer.layer.layerDef,
...options
}
new ShowDataLayer(newOptions)
}),
options.features)
}
}