@itwin/core-frontend
Version:
iTwin.js frontend components
118 lines • 5.62 kB
TypeScript
/** @packageDocumentation
* @module MapLayers
*/
import { ImageMapLayerSettings, MapLayerKey, MapLayerSettings, MapSubLayerProps } from "@itwin/core-common";
import { IModelConnection } from "../../IModelConnection";
import { ImageryMapLayerTreeReference, MapLayerAccessClient, MapLayerAuthenticationInfo, MapLayerImageryProvider, MapLayerSource, MapLayerSourceStatus, MapLayerTileTreeReference } from "../internal";
/**
* Class representing a map-layer format.
* Each format has it's unique 'formatId' string, used to uniquely identify a format in the [[MapLayerFormatRegistry]].
* When creating an [[ImageMapLayerSettings]] object, a format needs to be specified this 'formatId'.
* The MapLayerFormat object can later be used to validate a source, or create a provider.
*
* Subclasses should override formatId, [[MapLayerFormat.createImageryProvider]], and [[MapLayerFormat.createMapLayerTree]].
* @public
*/
export declare class MapLayerFormat {
static formatId: string;
/** Register the current format in the [[MapLayerFormatRegistry]]. */
static register(): void;
/**
* Allow a source of a specific format to be validated before being attached as a map-layer.
* @param _url The URL of the source.
* @param _userName The username to access the source if needed.
* @param _password The password to access the source if needed.
* @param _ignoreCache Flag to skip cache lookup (i.e. force a new server request).
* @returns Validation Status. If successful, a list of available sub-layers may also be returned.
*/
static validateSource(_url: string, _userName?: string, _password?: string, _ignoreCache?: boolean, _accesKey?: MapLayerKey): Promise<MapLayerSourceValidation>;
/** Allow a source object to be validated before being attached as a map-layer.
* @beta
*/
static validate(args: ValidateSourceArgs): Promise<MapLayerSourceValidation>;
/**
* Create a [[MapLayerImageryProvider]] that will be used to feed data in a map-layer tile tree.
* @param _settings The map layer settings to be applied to the imagery provider.
* @returns Returns the new imagery provider.
* @beta
*/
static createImageryProvider(_settings: MapLayerSettings): MapLayerImageryProvider | undefined;
/**
* Creates a MapLayerTileTreeReference for this map layer format.
* @param _layerSettings Map layer settings that are applied to the MapLayerTileTreeReference.
* @param _layerIndex The index of the associated map layer.
* @param _iModel The iModel containing the MapLayerTileTreeReference.
* @returns Returns the new tile tree reference.
* @beta
*/
static createMapLayerTree(_layerSettings: MapLayerSettings, _layerIndex: number, _iModel: IModelConnection): MapLayerTileTreeReference | undefined;
}
/** Options for validating sources
* @beta
*/
export interface ValidateSourceArgs {
source: MapLayerSource;
/** Disable cache lookup during validate process */
ignoreCache?: boolean;
}
/**
* The type of a map layer format.
* @public
*/
export type MapLayerFormatType = typeof MapLayerFormat;
/** @public */
export interface MapLayerSourceValidation {
status: MapLayerSourceStatus;
subLayers?: MapSubLayerProps[];
/** @beta */
authInfo?: MapLayerAuthenticationInfo;
}
/**
* Options supplied at startup via [[IModelAppOptions.mapLayerOptions]] to specify access keys for various map layer formats.
* 'BingMaps' must have it's key value set to 'key'
* 'MapboxImagery' must have it's key value set to 'access_token'
*
* @public
*/
export interface MapLayerOptions {
/** Access key for Azure Maps in the format `{ key: "subscription-key", value: "your-azure-maps-key" }`. */
AzureMaps?: MapLayerKey;
/** Access key for Mapbox in the format `{ key: "access_token", value: "your-mapbox-key" }`. */
MapboxImagery?: MapLayerKey;
/** Access key for Bing Maps in the format `{ key: "key", value: "your-bing-maps-key" }`. */
BingMaps?: MapLayerKey;
/** Access keys for additional map layer formats. */
[format: string]: MapLayerKey | undefined;
}
/** @internal */
export interface MapLayerFormatEntry {
type: MapLayerFormatType;
accessClient?: MapLayerAccessClient;
}
/**
* A registry of MapLayerFormats identified by their unique format IDs. The registry can be accessed via [[IModelApp.mapLayerFormatRegistry]].
* @public
*/
export declare class MapLayerFormatRegistry {
private _configOptions;
constructor(opts?: MapLayerOptions);
private _formats;
isRegistered(formatId: string): boolean;
register(formatClass: MapLayerFormatType): void;
/** @beta */
setAccessClient(formatId: string, accessClient: MapLayerAccessClient): boolean;
/** @beta */
getAccessClient(formatId: string): MapLayerAccessClient | undefined;
get configOptions(): MapLayerOptions;
/** @internal */
createImageryMapLayerTree(layerSettings: ImageMapLayerSettings, layerIndex: number, iModel: IModelConnection): ImageryMapLayerTreeReference | undefined;
/**
* Returns a [[MapLayerImageryProvider]] based on the provided [[ImageMapLayerSettings]] object.
* @internal
*/
createImageryProvider(layerSettings: ImageMapLayerSettings): MapLayerImageryProvider | undefined;
/** @beta*/
validateSource(opts: ValidateSourceArgs): Promise<MapLayerSourceValidation>;
validateSource(formatId: string, url: string, userName?: string, password?: string, ignoreCache?: boolean): Promise<MapLayerSourceValidation>;
}
//# sourceMappingURL=MapLayerFormatRegistry.d.ts.map