forked from MapComplete/MapComplete
refactoring(maplibre): WIP
This commit is contained in:
parent
231d67361e
commit
4d48b1cf2b
89 changed files with 1166 additions and 3973 deletions
28
UI/Map/ShowDataMultiLayer.ts
Normal file
28
UI/Map/ShowDataMultiLayer.ts
Normal file
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
* SHows geojson on the given leaflet map, but attempts to figure out the correct layer first
|
||||
*/
|
||||
import { Store } from "../../Logic/UIEventSource"
|
||||
import ShowDataLayer from "./ShowDataLayer"
|
||||
import PerLayerFeatureSourceSplitter from "../../Logic/FeatureSource/PerLayerFeatureSourceSplitter"
|
||||
import FilteredLayer from "../../Models/FilteredLayer"
|
||||
import { ShowDataLayerOptions } from "./ShowDataLayerOptions"
|
||||
import { Map as MlMap } from "maplibre-gl"
|
||||
export default class ShowDataMultiLayer {
|
||||
constructor(
|
||||
map: Store<MlMap>,
|
||||
options: ShowDataLayerOptions & { layers: Store<FilteredLayer[]> }
|
||||
) {
|
||||
new PerLayerFeatureSourceSplitter(
|
||||
options.layers,
|
||||
(perLayer) => {
|
||||
const newOptions = {
|
||||
...options,
|
||||
layer: perLayer.layer.layerDef,
|
||||
features: perLayer,
|
||||
}
|
||||
new ShowDataLayer(map, newOptions)
|
||||
},
|
||||
options.features
|
||||
)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue