import type { DemManager, DemTile, GlobalContourTileOptions, Timing } from "./types"; import type WorkerDispatch from "./worker-dispatch"; import Actor from "./actor"; type RequestParameters = { url: string; headers?: any; method?: "GET" | "POST" | "PUT"; body?: string; type?: "string" | "json" | "arrayBuffer" | "image"; credentials?: "same-origin" | "include"; collectResourceTiming?: boolean; }; type ExpiryData = { cacheControl?: string | null; expires?: Date | string | null; }; type GetResourceResponse = ExpiryData & { data: T; }; type AddProtocolAction = (requestParameters: RequestParameters, abortController: AbortController) => Promise>; type ResponseCallbackV3 = (error?: Error | undefined, data?: any | undefined, cacheControl?: string | undefined, expires?: string | undefined) => void; type V3OrV4Protocol = > : { cancel: () => void; }>(requestParameters: RequestParameters, arg2: T) => R; /** * A remote source of DEM tiles that can be connected to maplibre. */ export declare class DemSource { sharedDemProtocolId: string; contourProtocolId: string; contourProtocolUrlBase: string; manager: DemManager; sharedDemProtocolUrl: string; timingCallbacks: Array<(timing: Timing) => void>; constructor({ url, cacheSize, id, encoding, maxzoom, worker, timeoutMs, actor, }: { /** Remote DEM tile url using `{z}` `{x}` and `{y}` placeholders */ url: string; /** Number of most-recently-used tiles to cache */ cacheSize?: number; /** Prefix for the maplibre protocol */ id?: string; encoding?: "terrarium" | "mapbox"; /** Maximum zoom of tiles contained in the source */ maxzoom: number; timeoutMs?: number; /** Handle requests in a shared web worker to reduce UI-thread jank */ worker?: boolean; actor?: Actor; }); /** Registers a callback to be invoked with a performance report after each tile is requested. */ onTiming: (callback: (timing: Timing) => void) => void; getDemTile(z: number, x: number, y: number, abortController?: AbortController): Promise; /** * Adds contour and shared DEM protocol handlers to maplibre. * * @param maplibre maplibre global object */ setupMaplibre: (maplibre: { addProtocol: (id: string, protcol: V3OrV4Protocol) => void; }) => void; parseUrl(url: string): [number, number, number]; /** * Callback to be used with maplibre addProtocol to re-use cached DEM tiles across sources. */ sharedDemProtocolV4: AddProtocolAction; /** * Callback to be used with maplibre addProtocol to generate contour vector tiles according * to options encoded in the tile URL pattern generated by `contourProtocolUrl`. */ contourProtocolV4: AddProtocolAction; contourProtocol: V3OrV4Protocol; sharedDemProtocol: V3OrV4Protocol; /** * Returns a URL with the correct maplibre protocol prefix and all `option` encoded in request parameters. */ contourProtocolUrl: (options: GlobalContourTileOptions) => string; } export {};