Remove obsolete method

This commit is contained in:
Pieter Vander Vennet 2024-02-21 17:18:09 +01:00
parent 437f1abd4e
commit 1f9cab7134
2 changed files with 1 additions and 17 deletions

View file

@ -90,7 +90,7 @@ export class MapLibreAdaptor implements MapProperties, ExportableMap {
this.lastClickLocation = lastClickLocation this.lastClickLocation = lastClickLocation
const self = this const self = this
const rasterLayerHandler = new RasterLayerHandler(this._maplibreMap, this.rasterLayer) new RasterLayerHandler(this._maplibreMap, this.rasterLayer)
function handleClick(e) { function handleClick(e) {
if (e.originalEvent["consumed"]) { if (e.originalEvent["consumed"]) {
@ -114,7 +114,6 @@ export class MapLibreAdaptor implements MapProperties, ExportableMap {
self.setMaxzoom(self.maxzoom.data) self.setMaxzoom(self.maxzoom.data)
self.setBounds(self.bounds.data) self.setBounds(self.bounds.data)
self.setTerrain(self.useTerrain.data) self.setTerrain(self.useTerrain.data)
rasterLayerHandler.setBackground()
this.updateStores(true) this.updateStores(true)
}) })
self.MoveMapToCurrentLoc(self.location.data) self.MoveMapToCurrentLoc(self.location.data)
@ -128,7 +127,6 @@ export class MapLibreAdaptor implements MapProperties, ExportableMap {
self.setBounds(self.bounds.data) self.setBounds(self.bounds.data)
self.SetRotation(self.rotation.data) self.SetRotation(self.rotation.data)
self.setTerrain(self.useTerrain.data) self.setTerrain(self.useTerrain.data)
rasterLayerHandler.setBackground()
this.updateStores(true) this.updateStores(true)
map.on("moveend", () => this.updateStores()) map.on("moveend", () => this.updateStores())
map.on("click", (e) => { map.on("click", (e) => {
@ -177,7 +175,6 @@ export class MapLibreAdaptor implements MapProperties, ExportableMap {
}) })
}) })
this.rasterLayer.addCallbackAndRun((_) => rasterLayerHandler.setBackground())
this.location.addCallbackAndRunD((loc) => { this.location.addCallbackAndRunD((loc) => {
self.MoveMapToCurrentLoc(loc) self.MoveMapToCurrentLoc(loc)
}) })

View file

@ -144,23 +144,15 @@ class SingleBackgroundHandler {
} }
export default class RasterLayerHandler { export default class RasterLayerHandler {
private _map: Store<MLMap>
private _background: UIEventSource<RasterLayerPolygon | undefined>
private _singleLayerHandlers: Record<string, SingleBackgroundHandler> = {} private _singleLayerHandlers: Record<string, SingleBackgroundHandler> = {}
constructor(map: Store<MLMap>, background: UIEventSource<RasterLayerPolygon | undefined>) { constructor(map: Store<MLMap>, background: UIEventSource<RasterLayerPolygon | undefined>) {
this._map = map
this._background = background
background.addCallbackAndRunD((l) => { background.addCallbackAndRunD((l) => {
const key = l.properties.id const key = l.properties.id
if (!this._singleLayerHandlers[key]) { if (!this._singleLayerHandlers[key]) {
this._singleLayerHandlers[key] = new SingleBackgroundHandler(map, l, background) this._singleLayerHandlers[key] = new SingleBackgroundHandler(map, l, background)
} }
}) })
map.addCallback((map) => {
map.on("load", () => this.setBackground())
this.setBackground()
})
} }
public static prepareWmsSource(layer: RasterLayerProperties): SourceSpecification { public static prepareWmsSource(layer: RasterLayerProperties): SourceSpecification {
@ -203,9 +195,4 @@ export default class RasterLayerHandler {
return url return url
} }
/**
* Performs all necessary updates
*/
public setBackground() {}
} }