import type { AddLayerObject, LngLatBoundsLike, MapGeoJSONFeature, MapLibreMap, SourceSpecification } from 'maplibre-gl'; import type Resource from '../resources/resource'; import Previewer from './previewer'; import { type LayerState, type Layer, type PreviewStyleLayer } from '../layers'; import type { LegendEntry } from '../legend'; import { type MapLibreStyle } from '../themes/maplibre'; type AddSourceObject = SourceSpecification & { id: string; }; export type MapProjection = 'globe' | 'mercator'; export default abstract class MapPreviewer extends Previewer { readonly renderer: "map"; readonly projection: MapProjection; readonly loadTimeout: number; readonly maxPitch?: number; minZoom?: number; protected resource: Resource; protected style: MapLibreStyle; protected map: MapLibreMap; onError?: (error: unknown) => void; onDrawn?: () => void; onLayersChanged?: () => void; onNotice?: (notice: string | undefined) => void; expandFeatures(features: MapGeoJSONFeature[]): Promise; readonly reportsDrawing: boolean; get legendEntries(): LegendEntry[]; sourceIds: string[]; layerIds: string[]; previewLayers: Layer[]; private layerState; attach(map: MapLibreMap, style: MapLibreStyle): this; protected get attached(): boolean; preview(): Promise; clearPreview(): Promise; applyLayerState(states: ReadonlyMap): void; protected applyStyleLayerState(styleLayer: PreviewStyleLayer, state: LayerState): void; get visibleLayerIds(): string[]; get anyLayerVisible(): boolean; protected applyOpacity(styleLayer: PreviewStyleLayer, opacity: number): void; protected layerDrawn(id: string): boolean; protected findPreviewLayer(id: string): Layer | undefined; /** * What the record said this covers, answered on the spot: the bounding box the resource was built * with, and nothing that would have to be fetched to know. * * For the one caller that can't wait - a map is built before anything is drawn on it, and building * it already pointed at the record is what saves the reader a look at the whole world first; see * openingCamera. getBounds() below is the better answer and is what the camera settles on, but it * can be a round trip or two away, and a map cannot be built later than it is built. * * Undefined for a record that never said where it is, which leaves the map wherever it opens. */ get declaredBounds(): LngLatBoundsLike | undefined; getBounds(): Promise; protected abstract createSources(): Promise; protected abstract createLayers(): Promise; } export {};