UNPKG

ol

Version:

OpenLayers mapping library

262 lines • 10.3 kB
export default TileImage; export type Options = { /** * Attributions. */ attributions?: string | string[] | ((arg0: import("../PluggableMap.js").FrameState) => string | string[]); /** * Attributions are collapsible. */ attributionsCollapsible?: boolean; /** * Tile cache size. The default depends on the screen size. Will be ignored if too small. */ cacheSize?: number; /** * The `crossOrigin` attribute for loaded images. Note that * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer. * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail. */ crossOrigin?: string; /** * Whether the layer is opaque. */ opaque?: boolean; /** * Projection. Default is the view projection. */ projection?: string | import("../proj/Projection.js").default; /** * Maximum allowed reprojection error (in pixels). * Higher values can increase reprojection performance, but decrease precision. */ reprojectionErrorThreshold?: number; /** * Source state. */ state?: any; /** * Class used to instantiate image tiles. * Default is {@link module:ol/ImageTile~ImageTile}. */ tileClass?: typeof ImageTile; /** * Tile grid. */ tileGrid?: import("../tilegrid/TileGrid.js").default; /** * Optional function to load a tile given a URL. The default is * ```js * function(imageTile, src) { * imageTile.getImage().src = src; * }; * ``` */ tileLoadFunction?: (arg0: import("../Tile.js").default, arg1: string) => void; /** * The pixel ratio used by the tile service. For example, if the tile * service advertizes 256px by 256px tiles but actually sends 512px * by 512px images (for retina/hidpi devices) then `tilePixelRatio` * should be set to `2`. */ tilePixelRatio?: number; /** * Optional function to get tile URL given a tile coordinate and the projection. */ tileUrlFunction?: (arg0: number[], arg1: number, arg2: import("../proj/Projection.js").default) => string; /** * URL template. Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders. * A `{?-?}` template pattern, for example `subdomain{a-f}.domain.com`, may be * used instead of defining each one separately in the `urls` option. */ url?: string; /** * An array of URL templates. */ urls?: string[]; /** * Whether to wrap the world horizontally. The default, is to * request out-of-bounds tiles from the server. When set to `false`, only one * world will be rendered. When set to `true`, tiles will be requested for one * world only, but they will be wrapped horizontally to render multiple worlds. */ wrapX?: boolean; /** * Duration of the opacity transition for rendering. * To disable the opacity transition, pass `transition: 0`. */ transition?: number; /** * Optional tile key for proper cache fetching */ key?: string; /** * Indicate which resolution should be used * by a renderer if the view resolution does not match any resolution of the tile source. * If 0, the nearest resolution will be used. If 1, the nearest lower resolution * will be used. If -1, the nearest higher resolution will be used. */ zDirection?: number; }; /** * @typedef {Object} Options * @property {import("./Source.js").AttributionLike} [attributions] Attributions. * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible. * @property {number} [cacheSize] Tile cache size. The default depends on the screen size. Will be ignored if too small. * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer. * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail. * @property {boolean} [opaque=true] Whether the layer is opaque. * @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection. * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels). * Higher values can increase reprojection performance, but decrease precision. * @property {import("./State.js").default} [state] Source state. * @property {typeof import("../ImageTile.js").default} [tileClass] Class used to instantiate image tiles. * Default is {@link module:ol/ImageTile~ImageTile}. * @property {import("../tilegrid/TileGrid.js").default} [tileGrid] Tile grid. * @property {import("../Tile.js").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is * ```js * function(imageTile, src) { * imageTile.getImage().src = src; * }; * ``` * @property {number} [tilePixelRatio=1] The pixel ratio used by the tile service. For example, if the tile * service advertizes 256px by 256px tiles but actually sends 512px * by 512px images (for retina/hidpi devices) then `tilePixelRatio` * should be set to `2`. * @property {import("../Tile.js").UrlFunction} [tileUrlFunction] Optional function to get tile URL given a tile coordinate and the projection. * @property {string} [url] URL template. Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders. * A `{?-?}` template pattern, for example `subdomain{a-f}.domain.com`, may be * used instead of defining each one separately in the `urls` option. * @property {Array<string>} [urls] An array of URL templates. * @property {boolean} [wrapX] Whether to wrap the world horizontally. The default, is to * request out-of-bounds tiles from the server. When set to `false`, only one * world will be rendered. When set to `true`, tiles will be requested for one * world only, but they will be wrapped horizontally to render multiple worlds. * @property {number} [transition] Duration of the opacity transition for rendering. * To disable the opacity transition, pass `transition: 0`. * @property {string} [key] Optional tile key for proper cache fetching * @property {number} [zDirection=0] Indicate which resolution should be used * by a renderer if the view resolution does not match any resolution of the tile source. * If 0, the nearest resolution will be used. If 1, the nearest lower resolution * will be used. If -1, the nearest higher resolution will be used. */ /** * @classdesc * Base class for sources providing images divided into a tile grid. * * @fires import("./Tile.js").TileSourceEvent * @api */ declare class TileImage extends UrlTile { /** * @param {!Options} options Image tile options. */ constructor(options: Options); /** * @protected * @type {?string} */ protected crossOrigin: string | null; /** * @protected * @type {typeof ImageTile} */ protected tileClass: typeof ImageTile; /** * @protected * @type {!Object<string, TileCache>} */ protected tileCacheForProjection: { [x: string]: TileCache; }; /** * @protected * @type {!Object<string, import("../tilegrid/TileGrid.js").default>} */ protected tileGridForProjection: { [x: string]: import("../tilegrid/TileGrid.js").default; }; /** * @private * @type {number|undefined} */ private reprojectionErrorThreshold_; /** * @private * @type {boolean} */ private renderReprojectionEdges_; /** * @inheritDoc */ expireCache(projection: any, usedTiles: any): void; /** * @inheritDoc */ getGutterForProjection(projection: any): number; /** * @return {number} Gutter. */ getGutter(): number; /** * @inheritDoc */ getOpaque(projection: any): boolean; /** * @inheritDoc */ getTileGridForProjection(projection: any): import("../tilegrid/TileGrid.js").default; /** * @inheritDoc */ getTileCacheForProjection(projection: any): TileCache; /** * @param {number} z Tile coordinate z. * @param {number} x Tile coordinate x. * @param {number} y Tile coordinate y. * @param {number} pixelRatio Pixel ratio. * @param {import("../proj/Projection.js").default} projection Projection. * @param {string} key The key set on the tile. * @return {!import("../Tile.js").default} Tile. * @private */ private createTile_; /** * @inheritDoc */ getTile(z: any, x: any, y: any, pixelRatio: any, projection: any): any; /** * @param {number} z Tile coordinate z. * @param {number} x Tile coordinate x. * @param {number} y Tile coordinate y. * @param {number} pixelRatio Pixel ratio. * @param {!import("../proj/Projection.js").default} projection Projection. * @return {!import("../Tile.js").default} Tile. * @protected */ protected getTileInternal(z: number, x: number, y: number, pixelRatio: number, projection: import("../proj/Projection.js").default): import("../Tile.js").default; /** * Sets whether to render reprojection edges or not (usually for debugging). * @param {boolean} render Render the edges. * @api */ setRenderReprojectionEdges(render: boolean): void; /** * Sets the tile grid to use when reprojecting the tiles to the given * projection instead of the default tile grid for the projection. * * This can be useful when the default tile grid cannot be created * (e.g. projection has no extent defined) or * for optimization reasons (custom tile size, resolutions, ...). * * @param {import("../proj.js").ProjectionLike} projection Projection. * @param {import("../tilegrid/TileGrid.js").default} tilegrid Tile grid to use for the projection. * @api */ setTileGridForProjection(projection: string | import("../proj/Projection.js").default, tilegrid: import("../tilegrid/TileGrid.js").default): void; } import ImageTile from "../ImageTile.js"; import UrlTile from "./UrlTile.js"; import TileCache from "../TileCache.js"; //# sourceMappingURL=TileImage.d.ts.map