import { ReadonlyReactive } from "@conterra/reactivity-core"; import { EventSource } from "@conterra/reactivity-events"; import { HttpService } from "@open-pioneer/http"; import { PackageIntl } from "@open-pioneer/runtime"; import { Coordinate } from "ol/coordinate"; import { Geometry } from "ol/geom"; import OlMap from "ol/Map"; import { Projection } from "ol/proj"; import OlView from "ol/View"; import { LAYER_DEPS, LayerDependencies } from "../layers/shared/internals"; import { BaseFeature } from "../utils/BaseFeature"; import { InternalConstructorTag } from "../utils/InternalConstructorTag"; import { Highlight, HighlightOptions, Highlights, HighlightZoomOptions } from "./Highlights"; import { LayerCollection } from "./LayerCollection"; import { ExtentConfig, InitialPositionConfig } from "./MapConfig"; import { Overlays } from "./Overlays"; export declare const DISPLAY_STATUS: unique symbol; /** * Options supported when calling {@link MapModel.zoom}. * * @group Map Model **/ export interface ZoomOptions { /** * The zoom-level used if there is no valid extend (such as for single points). */ pointZoom?: number; /** * The maximum zoom-level for multiple points, line or polygon results. */ maxZoom?: number; /** * The view padding to make all features visible. */ viewPadding?: MapPadding; /** * The buffer factor around the extent of the zoomed features. E.g. a value of 1.1 will add * 10% to specify the size increase of the extent's width and height. */ buffer?: number; } /** * Represents an object in the map. * * @group Map Model */ export type DisplayTarget = BaseFeature | Geometry; /** * Map padding, all values are pixels. * * See https://openlayers.org/en/latest/apidoc/module-ol_View-View.html#padding * * @group Map Model */ export interface MapPadding { left?: number; right?: number; top?: number; bottom?: number; } /** * An item that should be displayed as part of the attributions for the map. * * @group MapModel */ export interface AttributionItem { /** * The attribution's text. * * Note that this property contains raw HTML tags. * The HTML content has been sanitized, so it is safe to display in the user interface. */ text: string; } type DisplayStatus = "waiting" | "ready" | "error"; /** * Represents a map. * * @group Map Model */ export declare class MapModel { #private; /** * @internal */ constructor(options: { id: string; olMap: OlMap; initialPosition: InitialPositionConfig | undefined; initialExtent: ExtentConfig | undefined; showDefaultAttributions: boolean; currentIntl: ReadonlyReactive; httpService: HttpService; }, tag: InternalConstructorTag); /** * Destroys this objects, including all layers, highlights and the OL map itself. */ destroy(): void; /** * Emitted when the map model is destroyed. */ get destroyed(): EventSource; /** * Returns the map's current display status. * This is `waiting` during initialization and `error` or `ready` when done. * * @internal */ get [DISPLAY_STATUS](): DisplayStatus; /** * The unique id of the map. */ get id(): string; /** * The initial map extent. * * May be undefined before the map is shown. * This is guaranteed to be initialized if the promise returned by {@link whenDisplayed} has resolved. */ get initialExtent(): ExtentConfig | undefined; /** * Returns the current projection of the map (reactive). */ get projection(): Projection; /** * Returns the current center of the map. * Same as `olView.getCenter()`, but reactive. */ get center(): Coordinate | undefined; /** * Returns the current resolution of the map. * Same as `olView.getResolution()`, but reactive. */ get resolution(): number | undefined; /** * Returns the current zoom level of the map. * Same as `olView.getZoom()`, but reactive. */ get zoomLevel(): number | undefined; /** * Returns the current rotation of the map. * Same as `olView.getRotation()`, but reactive. */ get rotation(): number | undefined; /** * Returns the current scale of the map. * * The scale is a value derived from the current `center`, `resolution` and `projection` of the map. * The scale will change when the map is zoomed in our out, but depending on the projection, it may also * change when the map is _panned_. * * > NOTE: Technically, this is the _denominator_ of the current scale. * > In order to display it, use a format like `1:${scale}`. */ get scale(): number | undefined; /** * Returns true if the map is currently loading. * * This is based on the OpenLayers events `loadstart` and `loadend`, * see [Documentation](https://openlayers.org/en/latest/apidoc/module-ol_MapEvent-MapEvent.html#event:loadstart). */ get loading(): boolean; /** * Contains all known layers of this map. * * Note that not all layers in this collection may be active in the OpenLayers map. * Also note that not all layers in the OpenLayers map may be contained in this collection. */ get layers(): LayerCollection; /** * The container in which the map is currently being rendered. * This is the same as the target element of the underlying OpenLayers map. * * May be undefined if the map is not being rendered at the moment. * May change at runtime. */ get container(): HTMLElement | undefined; /** * Returns attributions for the current content of the map. */ get attributionItems(): AttributionItem[]; /** * The raw OpenLayers map. */ get olMap(): OlMap; /** * Returns the current view of the OpenLayers map. */ get olView(): OlView; /** * TODO: Can be removed once the LayerFactory is the only supported way of constructing a layer. * * @internal */ get [LAYER_DEPS](): LayerDependencies; /** * Create and receive map overlays */ get overlays(): Overlays; /** * Create, receive and zoom to map highlights */ get highlights(): Highlights; /** * Changes the current scale of the map to the given value. * * Internally, this computes a new zoom level / resolution based on the scale * and the current center. * The new resolution is then applied to the current `olView`. * * See also {@link scale}. */ setScale(newScale: number): void; /** * Zooms to the given targets. */ zoom(displayTargets: DisplayTarget[], options?: ZoomOptions | undefined): void; /** * Creates a highlight at the given targets. * * A highlight is a temporary graphic on the map that calls attention to a point or an area. * * Call `destroy()` on the returned highlight object to remove the highlight. * * @deprecated Highlight functions will be removed in a future major release; call {@link Highlights.add} instead. */ highlight(geometries: DisplayTarget[], options?: HighlightOptions | undefined): Highlight; /** * Creates a highlight and zooms to the given targets. * * See also {@link highlight} and {@link zoom}. * * @deprecated Highlight functions will be removed in a future major release; call {@link Highlights.addAndZoom} instead. */ highlightAndZoom(geometries: DisplayTarget[], options?: HighlightZoomOptions): Highlight; /** * Removes any existing highlights from the map. * * @deprecated Highlight functions wil be removed in a future major release; call {@link Highlights.clear} instead. */ removeHighlights(): void; /** * Returns a promise that resolves when the map has mounted in the DOM. */ whenDisplayed(): Promise; } export {};