import BaseLayer from "../../Models/BaseLayer"; import {UIEventSource} from "../UIEventSource"; import Loc from "../../Models/Loc"; export interface AvailableBaseLayersObj { readonly osmCarto: BaseLayer; layerOverview: BaseLayer[]; AvailableLayersAt(location: UIEventSource): UIEventSource SelectBestLayerAccordingTo(location: UIEventSource, preferedCategory: UIEventSource): UIEventSource; } /** * Calculates which layers are available at the current location * Changes the basemap */ export default class AvailableBaseLayers { public static layerOverview: BaseLayer[]; public static osmCarto: BaseLayer; private static implementation: AvailableBaseLayersObj static AvailableLayersAt(location: UIEventSource): UIEventSource { return AvailableBaseLayers.implementation?.AvailableLayersAt(location) ?? new UIEventSource([]); } static SelectBestLayerAccordingTo(location: UIEventSource, preferedCategory: UIEventSource): UIEventSource { return AvailableBaseLayers.implementation?.SelectBestLayerAccordingTo(location, preferedCategory) ?? new UIEventSource(undefined); } public static implement(backend: AvailableBaseLayersObj) { AvailableBaseLayers.layerOverview = backend.layerOverview AvailableBaseLayers.osmCarto = backend.osmCarto AvailableBaseLayers.implementation = backend } }