forked from MapComplete/MapComplete
More refactoring of the featuresources, cleanup, small changes
This commit is contained in:
parent
d144f70ffb
commit
c11ff652b8
7 changed files with 121 additions and 79 deletions
22
UI/ShowDataLayer/ShowDataMultiLayer.ts
Normal file
22
UI/ShowDataLayer/ShowDataMultiLayer.ts
Normal 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)
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue