import OlBaseLayer from "ol/layer/Base"; import OlSource from "ol/source/Source"; import { MapModel } from "../model/MapModel"; import { InternalConstructorTag } from "../utils/InternalConstructorTag"; import { AbstractLayerBase } from "./AbstractLayerBase"; import { ATTACH_TO_MAP, DECLARED_AS_BASE_LAYER, GET_DEPS, LayerDependencies, SET_METADATA_LOAD_INFO, SET_VISIBLE } from "./shared/internals"; import { SimpleLayerConfig } from "./SimpleLayer"; import { LayerTypes } from "./unions"; /** * The load state of a layer. * * @group Layer Utilities **/ export type LayerLoadState = "not-loaded" | "loading" | "loaded" | "error"; /** * Load state of a single layer, bundling the state with its error. * * @internal */ export type LayerLoadInfo = "not-loaded" | "loading" | "loaded" | { kind: "error"; error: Error; }; /** * Represents an operational layer in the map. * * These layers always have an associated OpenLayers layer. * * Instances of this interface cannot be constructed directly; use a real layer * class such as {@link SimpleLayer} instead. * * @group Layers */ export declare abstract class AbstractLayer extends AbstractLayerBase { #private; constructor(config: SimpleLayerConfig & { /** The initial load state (default: not-loaded). */ initialLoadInfo?: LayerLoadInfo; }, deps?: LayerDependencies, internalTag?: InternalConstructorTag); destroy(): void; /** * Identifies the type of this layer. */ abstract readonly type: LayerTypes; get visible(): boolean; /** * The raw OpenLayers layer. */ get olLayer(): OlBaseLayer; /** * The current source of the {@link olLayer}. */ get olSource(): OlSource | undefined; /** * True if this layer is a base layer. * * Only one base layer can be visible at a time. */ get isBaseLayer(): boolean; /** * The combined load state of a layer. * * Aggregates the OpenLayers source state, health check and metadata state. * Priority for the state: `error` > `loading` > `not-loaded` > `loaded`. */ get loadState(): LayerLoadState; /** * The error (if any) that prevented this layer from loading. * * Combines errors from the OpenLayers source, the health check and the * metadata request (health > metadata > source). */ get loadError(): Error | undefined; /** * The minimum resolution (inclusive) at which this layer will be visible. */ get minResolution(): number; /** * The maximum resolution (exclusive) below which this layer will be visible. */ get maxResolution(): number; /** * The minimum view zoom level (exclusive) above which this layer will be visible. */ get minZoom(): number; /** * The maximum view zoom level (inclusive) at which this layer will be visible. */ get maxZoom(): number; /** * Whether the layer is visible in the current map scale or not. */ get visibleInScale(): boolean; /** * The minimum resolution (inclusive) at which this layer will be visible. */ setMinResolution(value: number): void; /** * The maximum resolution (exclusive) below which this layer will be visible. */ setMaxResolution(value: number): void; /** * The minimum view zoom level (exclusive) above which this layer will be visible. */ setMinZoom(value: number): void; /** * The maximum view zoom level (inclusive) at which this layer will be visible. */ setMaxZoom(value: number): void; /** * Called by the map model when the layer is added to the map. * * @internal */ [ATTACH_TO_MAP](map: MapModel): void; /** * Updates the load state of the layer's metadata request. * * @internal */ [SET_METADATA_LOAD_INFO](loadInfo: LayerLoadInfo): void; setVisible(newVisibility: boolean): void; /** @internal */ [SET_VISIBLE](newVisibility: boolean): void; /** @internal */ [GET_DEPS](): LayerDependencies; /** * Always returns original, configured `isBaseLayer` value from LayerConfig instead of computed value from `get isBaseLayer()` * * @internal */ get [DECLARED_AS_BASE_LAYER](): boolean | undefined; }