Transformed types
Using the [ts.js codemod](https://gist.github.com/tschaub/1ea498c9d1e5268cf36d212b3949be4e): jscodeshift --transform ts.js src
This commit is contained in:
@@ -33,7 +33,7 @@ const TOS_ATTRIBUTION = '<a class="ol-attribution-bing-tos" ' +
|
||||
* @property {number} [maxZoom=21] Max zoom. Default is what's advertized by the BingMaps service.
|
||||
* @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
|
||||
* Higher values can increase reprojection performance, but decrease precision.
|
||||
* @property {module:ol/Tile~LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is
|
||||
* @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;
|
||||
@@ -52,7 +52,7 @@ const TOS_ATTRIBUTION = '<a class="ol-attribution-bing-tos" ' +
|
||||
*/
|
||||
class BingMaps extends TileImage {
|
||||
/**
|
||||
* @param {module:ol/source/BingMaps~Options=} options Bing Maps options.
|
||||
* @param {Options=} options Bing Maps options.
|
||||
*/
|
||||
constructor(options) {
|
||||
|
||||
@@ -170,9 +170,9 @@ class BingMaps extends TileImage {
|
||||
.replace('{culture}', culture);
|
||||
return (
|
||||
/**
|
||||
* @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate.
|
||||
* @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {module:ol/proj/Projection} projection Projection.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
* @return {string|undefined} Tile URL.
|
||||
*/
|
||||
function(tileCoord, pixelRatio, projection) {
|
||||
|
||||
@@ -8,13 +8,13 @@ import XYZ from '../source/XYZ.js';
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {module:ol/source/Source~AttributionLike} [attributions] Attributions.
|
||||
* @property {import("./Source.js").AttributionLike} [attributions] Attributions.
|
||||
* @property {number} [cacheSize=2048] Cache size.
|
||||
* @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
|
||||
* you must provide a `crossOrigin` value if you are using the WebGL renderer or 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 {module:ol/proj~ProjectionLike} [projection='EPSG:3857'] Projection.
|
||||
* @property {import("../proj.js").ProjectionLike} [projection='EPSG:3857'] Projection.
|
||||
* @property {number} [maxZoom=18] Max zoom.
|
||||
* @property {number} [minZoom] Minimum zoom.
|
||||
* @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
|
||||
@@ -38,7 +38,7 @@ import XYZ from '../source/XYZ.js';
|
||||
*/
|
||||
class CartoDB extends XYZ {
|
||||
/**
|
||||
* @param {module:ol/source/CartoDB~Options=} options CartoDB options.
|
||||
* @param {Options=} options CartoDB options.
|
||||
*/
|
||||
constructor(options) {
|
||||
super({
|
||||
|
||||
@@ -14,10 +14,10 @@ import VectorSource from '../source/Vector.js';
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {module:ol/source/Source~AttributionLike} [attributions] Attributions.
|
||||
* @property {import("./Source.js").AttributionLike} [attributions] Attributions.
|
||||
* @property {number} [distance=20] Minimum distance in pixels between clusters.
|
||||
* @property {module:ol/extent~Extent} [extent] Extent.
|
||||
* @property {function(module:ol/Feature):module:ol/geom/Point} [geometryFunction]
|
||||
* @property {import("../extent.js").Extent} [extent] Extent.
|
||||
* @property {function(import("../Feature.js").default):import("../geom/Point.js").default} [geometryFunction]
|
||||
* Function that takes an {@link module:ol/Feature} as argument and returns an
|
||||
* {@link module:ol/geom/Point} as cluster calculation point for the feature. When a
|
||||
* feature should not be considered for clustering, the function should return
|
||||
@@ -30,8 +30,8 @@ import VectorSource from '../source/Vector.js';
|
||||
* ```
|
||||
* See {@link module:ol/geom/Polygon~Polygon#getInteriorPoint} for a way to get a cluster
|
||||
* calculation point for polygons.
|
||||
* @property {module:ol/proj~ProjectionLike} projection Projection.
|
||||
* @property {module:ol/source/Vector} source Source.
|
||||
* @property {import("../proj.js").ProjectionLike} projection Projection.
|
||||
* @property {import("./Vector.js").default} source Source.
|
||||
* @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
|
||||
*/
|
||||
|
||||
@@ -45,7 +45,7 @@ import VectorSource from '../source/Vector.js';
|
||||
*/
|
||||
class Cluster extends VectorSource {
|
||||
/**
|
||||
* @param {module:ol/source/Cluster~Options=} options Cluster options.
|
||||
* @param {Options=} options Cluster options.
|
||||
*/
|
||||
constructor(options) {
|
||||
super({
|
||||
@@ -68,25 +68,25 @@ class Cluster extends VectorSource {
|
||||
this.distance = options.distance !== undefined ? options.distance : 20;
|
||||
|
||||
/**
|
||||
* @type {Array<module:ol/Feature>}
|
||||
* @type {Array<import("../Feature.js").default>}
|
||||
* @protected
|
||||
*/
|
||||
this.features = [];
|
||||
|
||||
/**
|
||||
* @param {module:ol/Feature} feature Feature.
|
||||
* @return {module:ol/geom/Point} Cluster calculation point.
|
||||
* @param {import("../Feature.js").default} feature Feature.
|
||||
* @return {import("../geom/Point.js").default} Cluster calculation point.
|
||||
* @protected
|
||||
*/
|
||||
this.geometryFunction = options.geometryFunction || function(feature) {
|
||||
const geometry = /** @type {module:ol/geom/Point} */ (feature.getGeometry());
|
||||
const geometry = /** @type {import("../geom/Point.js").default} */ (feature.getGeometry());
|
||||
assert(geometry instanceof Point,
|
||||
10); // The default `geometryFunction` can only handle `module:ol/geom/Point~Point` geometries
|
||||
10); // The default `geometryFunction` can only handle `import("../geom/Point.js").Point` geometries
|
||||
return geometry;
|
||||
};
|
||||
|
||||
/**
|
||||
* @type {module:ol/source/Vector}
|
||||
* @type {import("./Vector.js").default}
|
||||
* @protected
|
||||
*/
|
||||
this.source = options.source;
|
||||
@@ -105,7 +105,7 @@ class Cluster extends VectorSource {
|
||||
|
||||
/**
|
||||
* Get a reference to the wrapped source.
|
||||
* @return {module:ol/source/Vector} Source.
|
||||
* @return {import("./Vector.js").default} Source.
|
||||
* @api
|
||||
*/
|
||||
getSource() {
|
||||
@@ -189,8 +189,8 @@ class Cluster extends VectorSource {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array<module:ol/Feature>} features Features
|
||||
* @return {module:ol/Feature} The cluster feature.
|
||||
* @param {Array<import("../Feature.js").default>} features Features
|
||||
* @return {import("../Feature.js").default} The cluster feature.
|
||||
* @protected
|
||||
*/
|
||||
createCluster(features) {
|
||||
|
||||
@@ -49,7 +49,7 @@ const ImageSourceEventType = {
|
||||
class ImageSourceEvent extends Event {
|
||||
/**
|
||||
* @param {string} type Type.
|
||||
* @param {module:ol/Image} image The image.
|
||||
* @param {import("../Image.js").default} image The image.
|
||||
*/
|
||||
constructor(type, image) {
|
||||
|
||||
@@ -57,7 +57,7 @@ class ImageSourceEvent extends Event {
|
||||
|
||||
/**
|
||||
* The image related to the event.
|
||||
* @type {module:ol/Image}
|
||||
* @type {import("../Image.js").default}
|
||||
* @api
|
||||
*/
|
||||
this.image = image;
|
||||
@@ -69,11 +69,11 @@ class ImageSourceEvent extends Event {
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {module:ol/source/Source~AttributionLike} [attributions]
|
||||
* @property {module:ol/extent~Extent} [extent]
|
||||
* @property {module:ol/proj~ProjectionLike} projection
|
||||
* @property {import("./Source.js").AttributionLike} [attributions]
|
||||
* @property {import("../extent.js").Extent} [extent]
|
||||
* @property {import("../proj.js").ProjectionLike} projection
|
||||
* @property {Array<number>} [resolutions]
|
||||
* @property {module:ol/source/State} [state]
|
||||
* @property {import("./State.js").default} [state]
|
||||
*/
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ class ImageSourceEvent extends Event {
|
||||
*/
|
||||
class ImageSource extends Source {
|
||||
/**
|
||||
* @param {module:ol/source/Image~Options} options Single image source options.
|
||||
* @param {Options} options Single image source options.
|
||||
*/
|
||||
constructor(options) {
|
||||
super({
|
||||
@@ -106,7 +106,7 @@ class ImageSource extends Source {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/reproj/Image}
|
||||
* @type {import("../reproj/Image.js").default}
|
||||
*/
|
||||
this.reprojectedImage_ = null;
|
||||
|
||||
@@ -140,11 +140,11 @@ class ImageSource extends Source {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {module:ol/extent~Extent} extent Extent.
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @param {number} resolution Resolution.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {module:ol/proj/Projection} projection Projection.
|
||||
* @return {module:ol/ImageBase} Single image.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
* @return {import("../ImageBase.js").default} Single image.
|
||||
*/
|
||||
getImage(extent, resolution, pixelRatio, projection) {
|
||||
const sourceProjection = this.getProjection();
|
||||
@@ -183,22 +183,22 @@ class ImageSource extends Source {
|
||||
|
||||
/**
|
||||
* @abstract
|
||||
* @param {module:ol/extent~Extent} extent Extent.
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @param {number} resolution Resolution.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {module:ol/proj/Projection} projection Projection.
|
||||
* @return {module:ol/ImageBase} Single image.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
* @return {import("../ImageBase.js").default} Single image.
|
||||
* @protected
|
||||
*/
|
||||
getImageInternal(extent, resolution, pixelRatio, projection) {}
|
||||
|
||||
/**
|
||||
* Handle image change events.
|
||||
* @param {module:ol/events/Event} event Event.
|
||||
* @param {import("../events/Event.js").default} event Event.
|
||||
* @protected
|
||||
*/
|
||||
handleImageChange(event) {
|
||||
const image = /** @type {module:ol/Image} */ (event.target);
|
||||
const image = /** @type {import("../Image.js").default} */ (event.target);
|
||||
switch (image.getState()) {
|
||||
case ImageState.LOADING:
|
||||
this.loading = true;
|
||||
@@ -226,9 +226,9 @@ class ImageSource extends Source {
|
||||
|
||||
|
||||
/**
|
||||
* Default image load function for image sources that use module:ol/Image~Image image
|
||||
* Default image load function for image sources that use import("../Image.js").Image image
|
||||
* instances.
|
||||
* @param {module:ol/Image} image Image.
|
||||
* @param {import("../Image.js").default} image Image.
|
||||
* @param {string} src Source.
|
||||
*/
|
||||
export function defaultImageLoadFunction(image, src) {
|
||||
|
||||
@@ -14,14 +14,14 @@ import {appendParams} from '../uri.js';
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {module:ol/source/Source~AttributionLike} [attributions] Attributions.
|
||||
* @property {import("./Source.js").AttributionLike} [attributions] Attributions.
|
||||
* @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
|
||||
* you must provide a `crossOrigin` value if you are using the WebGL renderer or 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} [hidpi=true] Use the `ol/Map#pixelRatio` value when requesting the image from
|
||||
* the remote server.
|
||||
* @property {module:ol/Image~LoadFunction} [imageLoadFunction] Optional function to load an image given
|
||||
* @property {import("../Image.js").LoadFunction} [imageLoadFunction] Optional function to load an image given
|
||||
* a URL.
|
||||
* @property {Object<string,*>} params ArcGIS Rest parameters. This field is optional. Service
|
||||
* defaults will be used for any fields not specified. `FORMAT` is `PNG32` by default. `F` is
|
||||
@@ -29,7 +29,7 @@ import {appendParams} from '../uri.js';
|
||||
* will be set dynamically. Set `LAYERS` to override the default service layer visibility. See
|
||||
* http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Export_Map/02r3000000v7000000/
|
||||
* for further reference.
|
||||
* @property {module:ol/proj~ProjectionLike} projection Projection.
|
||||
* @property {import("../proj.js").ProjectionLike} projection Projection.
|
||||
* @property {number} [ratio=1.5] Ratio. `1` means image requests are the size of the map viewport,
|
||||
* `2` means twice the size of the map viewport, and so on.
|
||||
* @property {Array<number>} [resolutions] Resolutions. If specified, requests will be made for
|
||||
@@ -53,11 +53,11 @@ import {appendParams} from '../uri.js';
|
||||
*/
|
||||
class ImageArcGISRest extends ImageSource {
|
||||
/**
|
||||
* @param {module:ol/source/ImageArcGISRest~Options=} opt_options Image ArcGIS Rest Options.
|
||||
* @param {Options=} opt_options Image ArcGIS Rest Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
|
||||
const options = opt_options || /** @type {module:ol/source/ImageArcGISRest~Options} */ ({});
|
||||
const options = opt_options || /** @type {Options} */ ({});
|
||||
|
||||
super({
|
||||
attributions: options.attributions,
|
||||
@@ -86,7 +86,7 @@ class ImageArcGISRest extends ImageSource {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/Image~LoadFunction}
|
||||
* @type {import("../Image.js").LoadFunction}
|
||||
*/
|
||||
this.imageLoadFunction_ = options.imageLoadFunction !== undefined ?
|
||||
options.imageLoadFunction : defaultImageLoadFunction;
|
||||
@@ -100,13 +100,13 @@ class ImageArcGISRest extends ImageSource {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/Image}
|
||||
* @type {import("../Image.js").default}
|
||||
*/
|
||||
this.image_ = null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/size~Size}
|
||||
* @type {import("../size.js").Size}
|
||||
*/
|
||||
this.imageSize_ = [0, 0];
|
||||
|
||||
@@ -207,7 +207,7 @@ class ImageArcGISRest extends ImageSource {
|
||||
|
||||
/**
|
||||
* Return the image load function of the source.
|
||||
* @return {module:ol/Image~LoadFunction} The image load function.
|
||||
* @return {import("../Image.js").LoadFunction} The image load function.
|
||||
* @api
|
||||
*/
|
||||
getImageLoadFunction() {
|
||||
@@ -215,10 +215,10 @@ class ImageArcGISRest extends ImageSource {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {module:ol/extent~Extent} extent Extent.
|
||||
* @param {module:ol/size~Size} size Size.
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @param {import("../size.js").Size} size Size.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {module:ol/proj/Projection} projection Projection.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
* @param {Object} params Params.
|
||||
* @return {string} Request URL.
|
||||
* @private
|
||||
@@ -255,7 +255,7 @@ class ImageArcGISRest extends ImageSource {
|
||||
|
||||
/**
|
||||
* Set the image load function of the source.
|
||||
* @param {module:ol/Image~LoadFunction} imageLoadFunction Image load function.
|
||||
* @param {import("../Image.js").LoadFunction} imageLoadFunction Image load function.
|
||||
* @api
|
||||
*/
|
||||
setImageLoadFunction(imageLoadFunction) {
|
||||
|
||||
@@ -16,29 +16,29 @@ import ImageSource from '../source/Image.js';
|
||||
* this function is cached by the source. The this keyword inside the function
|
||||
* references the {@link module:ol/source/ImageCanvas}.
|
||||
*
|
||||
* @typedef {function(this:module:ol/ImageCanvas, module:ol/extent~Extent, number,
|
||||
* number, module:ol/size~Size, module:ol/proj/Projection): HTMLCanvasElement} FunctionType
|
||||
* @typedef {function(this:import("../ImageCanvas.js").default, import("../extent.js").Extent, number,
|
||||
* number, import("../size.js").Size, import("../proj/Projection.js").default): HTMLCanvasElement} FunctionType
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {module:ol/source/Source~AttributionLike} [attributions] Attributions.
|
||||
* @property {module:ol/source/ImageCanvas~FunctionType} [canvasFunction] Canvas function.
|
||||
* @property {import("./Source.js").AttributionLike} [attributions] Attributions.
|
||||
* @property {FunctionType} [canvasFunction] Canvas function.
|
||||
* The function returning the canvas element used by the source
|
||||
* as an image. The arguments passed to the function are: `{module:ol/extent~Extent}` the
|
||||
* as an image. The arguments passed to the function are: `{import("../extent.js").Extent}` the
|
||||
* image extent, `{number}` the image resolution, `{number}` the device pixel
|
||||
* ratio, `{module:ol/size~Size}` the image size, and `{module:ol/proj/Projection~Projection}` the image
|
||||
* ratio, `{import("../size.js").Size}` the image size, and `{import("../proj/Projection.js").Projection}` the image
|
||||
* projection. The canvas returned by this function is cached by the source. If
|
||||
* the value returned by the function is later changed then
|
||||
* `changed` should be called on the source for the source to
|
||||
* invalidate the current cached image. See @link: {@link module:ol/Observable~Observable#changed}
|
||||
* @property {module:ol/proj~ProjectionLike} projection Projection.
|
||||
* @property {import("../proj.js").ProjectionLike} projection Projection.
|
||||
* @property {number} [ratio=1.5] Ratio. 1 means canvases are the size of the map viewport, 2 means twice the
|
||||
* width and height of the map viewport, and so on. Must be `1` or higher.
|
||||
* @property {Array<number>} [resolutions] Resolutions.
|
||||
* If specified, new canvases will be created for these resolutions
|
||||
* @property {module:ol/source/State} [state] Source state.
|
||||
* @property {import("./State.js").default} [state] Source state.
|
||||
*/
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ import ImageSource from '../source/Image.js';
|
||||
*/
|
||||
class ImageCanvasSource extends ImageSource {
|
||||
/**
|
||||
* @param {module:ol/source/ImageCanvas~Options=} options ImageCanvas options.
|
||||
* @param {Options=} options ImageCanvas options.
|
||||
*/
|
||||
constructor(options) {
|
||||
|
||||
@@ -62,13 +62,13 @@ class ImageCanvasSource extends ImageSource {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/source/ImageCanvas~FunctionType}
|
||||
* @type {FunctionType}
|
||||
*/
|
||||
this.canvasFunction_ = options.canvasFunction;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/ImageCanvas}
|
||||
* @type {import("../ImageCanvas.js").default}
|
||||
*/
|
||||
this.canvas_ = null;
|
||||
|
||||
|
||||
@@ -22,12 +22,12 @@ import {appendParams} from '../uri.js';
|
||||
* @property {boolean} [hidpi=true] Use the `ol/Map#pixelRatio` value when requesting
|
||||
* the image from the remote server.
|
||||
* @property {boolean} [useOverlay] If `true`, will use `GETDYNAMICMAPOVERLAYIMAGE`.
|
||||
* @property {module:ol/proj~ProjectionLike} projection Projection.
|
||||
* @property {import("../proj.js").ProjectionLike} projection Projection.
|
||||
* @property {number} [ratio=1] Ratio. `1` means image requests are the size of the map viewport, `2` means
|
||||
* twice the width and height of the map viewport, and so on. Must be `1` or higher.
|
||||
* @property {Array<number>} [resolutions] Resolutions.
|
||||
* If specified, requests will be made for these resolutions only.
|
||||
* @property {module:ol/Image~LoadFunction} [imageLoadFunction] Optional function to load an image given a URL.
|
||||
* @property {import("../Image.js").LoadFunction} [imageLoadFunction] Optional function to load an image given a URL.
|
||||
* @property {Object} [params] Additional parameters.
|
||||
*/
|
||||
|
||||
@@ -41,7 +41,7 @@ import {appendParams} from '../uri.js';
|
||||
*/
|
||||
class ImageMapGuide extends ImageSource {
|
||||
/**
|
||||
* @param {module:ol/source/ImageMapGuide~Options=} options ImageMapGuide options.
|
||||
* @param {Options=} options ImageMapGuide options.
|
||||
*/
|
||||
constructor(options) {
|
||||
|
||||
@@ -78,7 +78,7 @@ class ImageMapGuide extends ImageSource {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/Image~LoadFunction}
|
||||
* @type {import("../Image.js").LoadFunction}
|
||||
*/
|
||||
this.imageLoadFunction_ = options.imageLoadFunction !== undefined ?
|
||||
options.imageLoadFunction : defaultImageLoadFunction;
|
||||
@@ -111,7 +111,7 @@ class ImageMapGuide extends ImageSource {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/Image}
|
||||
* @type {import("../Image.js").default}
|
||||
*/
|
||||
this.image_ = null;
|
||||
|
||||
@@ -176,7 +176,7 @@ class ImageMapGuide extends ImageSource {
|
||||
|
||||
/**
|
||||
* Return the image load function of the source.
|
||||
* @return {module:ol/Image~LoadFunction} The image load function.
|
||||
* @return {import("../Image.js").LoadFunction} The image load function.
|
||||
* @api
|
||||
*/
|
||||
getImageLoadFunction() {
|
||||
@@ -196,9 +196,9 @@ class ImageMapGuide extends ImageSource {
|
||||
/**
|
||||
* @param {string} baseUrl The mapagent url.
|
||||
* @param {Object<string, string|number>} params Request parameters.
|
||||
* @param {module:ol/extent~Extent} extent Extent.
|
||||
* @param {module:ol/size~Size} size Size.
|
||||
* @param {module:ol/proj/Projection} projection Projection.
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @param {import("../size.js").Size} size Size.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
* @return {string} The mapagent map image request URL.
|
||||
*/
|
||||
getUrl(baseUrl, params, extent, size, projection) {
|
||||
@@ -224,7 +224,7 @@ class ImageMapGuide extends ImageSource {
|
||||
|
||||
/**
|
||||
* Set the image load function of the MapGuide source.
|
||||
* @param {module:ol/Image~LoadFunction} imageLoadFunction Image load function.
|
||||
* @param {import("../Image.js").LoadFunction} imageLoadFunction Image load function.
|
||||
* @api
|
||||
*/
|
||||
setImageLoadFunction(imageLoadFunction) {
|
||||
@@ -236,8 +236,8 @@ class ImageMapGuide extends ImageSource {
|
||||
|
||||
|
||||
/**
|
||||
* @param {module:ol/extent~Extent} extent The map extents.
|
||||
* @param {module:ol/size~Size} size The viewport size.
|
||||
* @param {import("../extent.js").Extent} extent The map extents.
|
||||
* @param {import("../size.js").Size} size The viewport size.
|
||||
* @param {number} metersPerUnit The meters-per-unit value.
|
||||
* @param {number} dpi The display resolution.
|
||||
* @return {number} The computed map scale.
|
||||
|
||||
@@ -13,16 +13,16 @@ import ImageSource, {defaultImageLoadFunction} from '../source/Image.js';
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {module:ol/source/Source~AttributionLike} [attributions] Attributions.
|
||||
* @property {import("./Source.js").AttributionLike} [attributions] Attributions.
|
||||
* @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
|
||||
* you must provide a `crossOrigin` value if you are using the WebGL renderer or 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 {module:ol/extent~Extent} [imageExtent] Extent of the image in map coordinates.
|
||||
* @property {import("../extent.js").Extent} [imageExtent] Extent of the image in map coordinates.
|
||||
* This is the [left, bottom, right, top] map coordinates of your image.
|
||||
* @property {module:ol/Image~LoadFunction} [imageLoadFunction] Optional function to load an image given a URL.
|
||||
* @property {module:ol/proj~ProjectionLike} projection Projection.
|
||||
* @property {module:ol/size~Size} [imageSize] Size of the image in pixels. Usually the image size is auto-detected, so this
|
||||
* @property {import("../Image.js").LoadFunction} [imageLoadFunction] Optional function to load an image given a URL.
|
||||
* @property {import("../proj.js").ProjectionLike} projection Projection.
|
||||
* @property {import("../size.js").Size} [imageSize] Size of the image in pixels. Usually the image size is auto-detected, so this
|
||||
* only needs to be set if auto-detection fails for some reason.
|
||||
* @property {string} url Image URL.
|
||||
*/
|
||||
@@ -35,13 +35,13 @@ import ImageSource, {defaultImageLoadFunction} from '../source/Image.js';
|
||||
*/
|
||||
class Static extends ImageSource {
|
||||
/**
|
||||
* @param {module:ol/source/ImageStatic~Options=} options ImageStatic options.
|
||||
* @param {Options=} options ImageStatic options.
|
||||
*/
|
||||
constructor(options) {
|
||||
const crossOrigin = options.crossOrigin !== undefined ?
|
||||
options.crossOrigin : null;
|
||||
|
||||
const /** @type {module:ol/Image~LoadFunction} */ imageLoadFunction =
|
||||
const /** @type {import("../Image.js").LoadFunction} */ imageLoadFunction =
|
||||
options.imageLoadFunction !== undefined ?
|
||||
options.imageLoadFunction : defaultImageLoadFunction;
|
||||
|
||||
@@ -58,19 +58,19 @@ class Static extends ImageSource {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/extent~Extent}
|
||||
* @type {import("../extent.js").Extent}
|
||||
*/
|
||||
this.imageExtent_ = options.imageExtent;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/Image}
|
||||
* @type {import("../Image.js").default}
|
||||
*/
|
||||
this.image_ = new ImageWrapper(this.imageExtent_, undefined, 1, this.url_, crossOrigin, imageLoadFunction);
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/size~Size}
|
||||
* @type {import("../size.js").Size}
|
||||
*/
|
||||
this.imageSize_ = options.imageSize ? options.imageSize : null;
|
||||
|
||||
@@ -81,7 +81,7 @@ class Static extends ImageSource {
|
||||
|
||||
/**
|
||||
* Returns the image extent
|
||||
* @return {module:ol/extent~Extent} image extent.
|
||||
* @return {import("../extent.js").Extent} image extent.
|
||||
* @api
|
||||
*/
|
||||
getImageExtent() {
|
||||
|
||||
@@ -20,28 +20,28 @@ import {appendParams} from '../uri.js';
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {module:ol/size~Size}
|
||||
* @type {import("../size.js").Size}
|
||||
*/
|
||||
const GETFEATUREINFO_IMAGE_SIZE = [101, 101];
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {module:ol/source/Source~AttributionLike} [attributions] Attributions.
|
||||
* @property {import("./Source.js").AttributionLike} [attributions] Attributions.
|
||||
* @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
|
||||
* you must provide a `crossOrigin` value if you are using the WebGL renderer or 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} [hidpi=true] Use the `ol/Map#pixelRatio` value when requesting
|
||||
* the image from the remote server.
|
||||
* @property {module:ol/source/WMSServerType|string} [serverType] The type of
|
||||
* @property {import("./WMSServerType.js").default|string} [serverType] The type of
|
||||
* the remote WMS server: `mapserver`, `geoserver` or `qgis`. Only needed if `hidpi` is `true`.
|
||||
* @property {module:ol/Image~LoadFunction} [imageLoadFunction] Optional function to load an image given a URL.
|
||||
* @property {import("../Image.js").LoadFunction} [imageLoadFunction] Optional function to load an image given a URL.
|
||||
* @property {Object<string,*>} params WMS request parameters.
|
||||
* At least a `LAYERS` param is required. `STYLES` is
|
||||
* `''` by default. `VERSION` is `1.3.0` by default. `WIDTH`, `HEIGHT`, `BBOX`
|
||||
* and `CRS` (`SRS` for WMS version < 1.3.0) will be set dynamically.
|
||||
* @property {module:ol/proj~ProjectionLike} projection Projection.
|
||||
* @property {import("../proj.js").ProjectionLike} projection Projection.
|
||||
* @property {number} [ratio=1.5] Ratio. `1` means image requests are the size of the map viewport, `2` means
|
||||
* twice the width and height of the map viewport, and so on. Must be `1` or
|
||||
* higher.
|
||||
@@ -60,11 +60,11 @@ const GETFEATUREINFO_IMAGE_SIZE = [101, 101];
|
||||
*/
|
||||
class ImageWMS extends ImageSource {
|
||||
/**
|
||||
* @param {module:ol/source/ImageWMS~Options=} [opt_options] ImageWMS options.
|
||||
* @param {Options=} [opt_options] ImageWMS options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
|
||||
const options = opt_options || /** @type {module:ol/source/ImageWMS~Options} */ ({});
|
||||
const options = opt_options || /** @type {Options} */ ({});
|
||||
|
||||
super({
|
||||
attributions: options.attributions,
|
||||
@@ -87,7 +87,7 @@ class ImageWMS extends ImageSource {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/Image~LoadFunction}
|
||||
* @type {import("../Image.js").LoadFunction}
|
||||
*/
|
||||
this.imageLoadFunction_ = options.imageLoadFunction !== undefined ?
|
||||
options.imageLoadFunction : defaultImageLoadFunction;
|
||||
@@ -107,9 +107,9 @@ class ImageWMS extends ImageSource {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/source/WMSServerType|undefined}
|
||||
* @type {import("./WMSServerType.js").default|undefined}
|
||||
*/
|
||||
this.serverType_ = /** @type {module:ol/source/WMSServerType|undefined} */ (options.serverType);
|
||||
this.serverType_ = /** @type {import("./WMSServerType.js").default|undefined} */ (options.serverType);
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -119,13 +119,13 @@ class ImageWMS extends ImageSource {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/Image}
|
||||
* @type {import("../Image.js").default}
|
||||
*/
|
||||
this.image_ = null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/size~Size}
|
||||
* @type {import("../size.js").Size}
|
||||
*/
|
||||
this.imageSize_ = [0, 0];
|
||||
|
||||
@@ -147,9 +147,9 @@ class ImageWMS extends ImageSource {
|
||||
* Return the GetFeatureInfo URL for the passed coordinate, resolution, and
|
||||
* projection. Return `undefined` if the GetFeatureInfo URL cannot be
|
||||
* constructed.
|
||||
* @param {module:ol/coordinate~Coordinate} coordinate Coordinate.
|
||||
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
|
||||
* @param {number} resolution Resolution.
|
||||
* @param {module:ol/proj~ProjectionLike} projection Projection.
|
||||
* @param {import("../proj.js").ProjectionLike} projection Projection.
|
||||
* @param {!Object} params GetFeatureInfo params. `INFO_FORMAT` at least should
|
||||
* be provided. If `QUERY_LAYERS` is not provided then the layers specified
|
||||
* in the `LAYERS` parameter will be used. `VERSION` should not be
|
||||
@@ -267,7 +267,7 @@ class ImageWMS extends ImageSource {
|
||||
|
||||
/**
|
||||
* Return the image load function of the source.
|
||||
* @return {module:ol/Image~LoadFunction} The image load function.
|
||||
* @return {import("../Image.js").LoadFunction} The image load function.
|
||||
* @api
|
||||
*/
|
||||
getImageLoadFunction() {
|
||||
@@ -275,10 +275,10 @@ class ImageWMS extends ImageSource {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {module:ol/extent~Extent} extent Extent.
|
||||
* @param {module:ol/size~Size} size Size.
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @param {import("../size.js").Size} size Size.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {module:ol/proj/Projection} projection Projection.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
* @param {Object} params Params.
|
||||
* @return {string} Request URL.
|
||||
* @private
|
||||
@@ -342,7 +342,7 @@ class ImageWMS extends ImageSource {
|
||||
|
||||
/**
|
||||
* Set the image load function of the source.
|
||||
* @param {module:ol/Image~LoadFunction} imageLoadFunction Image load function.
|
||||
* @param {import("../Image.js").LoadFunction} imageLoadFunction Image load function.
|
||||
* @api
|
||||
*/
|
||||
setImageLoadFunction(imageLoadFunction) {
|
||||
|
||||
@@ -19,7 +19,7 @@ export const ATTRIBUTION = '© ' +
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {module:ol/source/Source~AttributionLike} [attributions] Attributions.
|
||||
* @property {import("./Source.js").AttributionLike} [attributions] Attributions.
|
||||
* @property {number} [cacheSize=2048] Cache size.
|
||||
* @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
|
||||
* you must provide a `crossOrigin` value if you are using the WebGL renderer or if you want to
|
||||
@@ -29,7 +29,7 @@ export const ATTRIBUTION = '© ' +
|
||||
* @property {boolean} [opaque=true] Whether the layer is opaque.
|
||||
* @property {number} [reprojectionErrorThreshold=1.5] Maximum allowed reprojection error (in pixels).
|
||||
* Higher values can increase reprojection performance, but decrease precision.
|
||||
* @property {module:ol/Tile~LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is
|
||||
* @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;
|
||||
@@ -48,7 +48,7 @@ export const ATTRIBUTION = '© ' +
|
||||
*/
|
||||
class OSM extends XYZ {
|
||||
/**
|
||||
* @param {module:ol/source/OSM~Options=} [opt_options] Open Street Map options.
|
||||
* @param {Options=} [opt_options] Open Street Map options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ const RasterOperationType = {
|
||||
class RasterSourceEvent extends Event {
|
||||
/**
|
||||
* @param {string} type Type.
|
||||
* @param {module:ol/PluggableMap~FrameState} frameState The frame state.
|
||||
* @param {import("../PluggableMap.js").FrameState} frameState The frame state.
|
||||
* @param {Object} data An object made available to operations.
|
||||
*/
|
||||
constructor(type, frameState, data) {
|
||||
@@ -88,7 +88,7 @@ class RasterSourceEvent extends Event {
|
||||
|
||||
/**
|
||||
* The raster extent.
|
||||
* @type {module:ol/extent~Extent}
|
||||
* @type {import("../extent.js").Extent}
|
||||
* @api
|
||||
*/
|
||||
this.extent = frameState.extent;
|
||||
@@ -114,9 +114,9 @@ class RasterSourceEvent extends Event {
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {Array<module:ol/source/Source|module:ol/layer/Layer>} sources Input
|
||||
* @property {Array<import("./Source.js").default|import("../layer/Layer.js").default>} sources Input
|
||||
* sources or layers. Vector layers must be configured with `renderMode: 'image'`.
|
||||
* @property {module:ol/source/Raster~Operation} [operation] Raster operation.
|
||||
* @property {Operation} [operation] Raster operation.
|
||||
* The operation will be called with data from input sources
|
||||
* and the output will be assigned to the raster source.
|
||||
* @property {Object} [lib] Functions that will be made available to operations run in a worker.
|
||||
@@ -125,7 +125,7 @@ class RasterSourceEvent extends Event {
|
||||
* be run in multiple worker threads. Note that there is additional overhead in
|
||||
* transferring data to multiple workers, and that depending on the user's
|
||||
* system, it may not be possible to parallelize the work.
|
||||
* @property {module:ol/source/Raster~RasterOperationType} [operationType='pixel'] Operation type.
|
||||
* @property {RasterOperationType} [operationType='pixel'] Operation type.
|
||||
* Supported values are `'pixel'` and `'image'`. By default,
|
||||
* `'pixel'` operations are assumed, and operations will be called with an
|
||||
* array of pixels from input sources. If set to `'image'`, operations will
|
||||
@@ -144,7 +144,7 @@ class RasterSourceEvent extends Event {
|
||||
*/
|
||||
class RasterSource extends ImageSource {
|
||||
/**
|
||||
* @param {module:ol/source/Raster~Options=} options Options.
|
||||
* @param {Options=} options Options.
|
||||
*/
|
||||
constructor(options) {
|
||||
super({});
|
||||
@@ -157,7 +157,7 @@ class RasterSource extends ImageSource {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/source/Raster~RasterOperationType}
|
||||
* @type {RasterOperationType}
|
||||
*/
|
||||
this.operationType_ = options.operationType !== undefined ?
|
||||
options.operationType : RasterOperationType.PIXEL;
|
||||
@@ -170,7 +170,7 @@ class RasterSource extends ImageSource {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Array<module:ol/renderer/canvas/Layer>}
|
||||
* @type {Array<import("../renderer/canvas/Layer.js").default>}
|
||||
*/
|
||||
this.renderers_ = createRenderers(options.sources);
|
||||
|
||||
@@ -181,7 +181,7 @@ class RasterSource extends ImageSource {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/TileQueue}
|
||||
* @type {import("../TileQueue.js").default}
|
||||
*/
|
||||
this.tileQueue_ = new TileQueue(
|
||||
function() {
|
||||
@@ -197,14 +197,14 @@ class RasterSource extends ImageSource {
|
||||
|
||||
/**
|
||||
* The most recently requested frame state.
|
||||
* @type {module:ol/PluggableMap~FrameState}
|
||||
* @type {import("../PluggableMap.js").FrameState}
|
||||
* @private
|
||||
*/
|
||||
this.requestedFrameState_;
|
||||
|
||||
/**
|
||||
* The most recently rendered image canvas.
|
||||
* @type {module:ol/ImageCanvas}
|
||||
* @type {import("../ImageCanvas.js").default}
|
||||
* @private
|
||||
*/
|
||||
this.renderedImageCanvas_ = null;
|
||||
@@ -217,7 +217,7 @@ class RasterSource extends ImageSource {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/PluggableMap~FrameState}
|
||||
* @type {import("../PluggableMap.js").FrameState}
|
||||
*/
|
||||
this.frameState_ = {
|
||||
animate: false,
|
||||
@@ -235,7 +235,7 @@ class RasterSource extends ImageSource {
|
||||
tileQueue: this.tileQueue_,
|
||||
time: Date.now(),
|
||||
usedTiles: {},
|
||||
viewState: /** @type {module:ol/View~State} */ ({
|
||||
viewState: /** @type {import("../View.js").State} */ ({
|
||||
rotation: 0
|
||||
}),
|
||||
viewHints: [],
|
||||
@@ -250,7 +250,7 @@ class RasterSource extends ImageSource {
|
||||
|
||||
/**
|
||||
* Set the operation.
|
||||
* @param {module:ol/source/Raster~Operation} operation New operation.
|
||||
* @param {Operation} operation New operation.
|
||||
* @param {Object=} opt_lib Functions that will be available to operations run
|
||||
* in a worker.
|
||||
* @api
|
||||
@@ -268,17 +268,17 @@ class RasterSource extends ImageSource {
|
||||
|
||||
/**
|
||||
* Update the stored frame state.
|
||||
* @param {module:ol/extent~Extent} extent The view extent (in map units).
|
||||
* @param {import("../extent.js").Extent} extent The view extent (in map units).
|
||||
* @param {number} resolution The view resolution.
|
||||
* @param {module:ol/proj/Projection} projection The view projection.
|
||||
* @return {module:ol/PluggableMap~FrameState} The updated frame state.
|
||||
* @param {import("../proj/Projection.js").default} projection The view projection.
|
||||
* @return {import("../PluggableMap.js").FrameState} The updated frame state.
|
||||
* @private
|
||||
*/
|
||||
updateFrameState_(extent, resolution, projection) {
|
||||
|
||||
const frameState = /** @type {module:ol/PluggableMap~FrameState} */ (assign({}, this.frameState_));
|
||||
const frameState = /** @type {import("../PluggableMap.js").FrameState} */ (assign({}, this.frameState_));
|
||||
|
||||
frameState.viewState = /** @type {module:ol/View~State} */ (assign({}, frameState.viewState));
|
||||
frameState.viewState = /** @type {import("../View.js").State} */ (assign({}, frameState.viewState));
|
||||
|
||||
const center = getCenter(extent);
|
||||
|
||||
@@ -372,7 +372,7 @@ class RasterSource extends ImageSource {
|
||||
|
||||
/**
|
||||
* Called when pixel processing is complete.
|
||||
* @param {module:ol/PluggableMap~FrameState} frameState The frame state.
|
||||
* @param {import("../PluggableMap.js").FrameState} frameState The frame state.
|
||||
* @param {Error} err Any error during processing.
|
||||
* @param {ImageData} output The output image data.
|
||||
* @param {Object} data The user data.
|
||||
@@ -427,9 +427,9 @@ let sharedContext = null;
|
||||
|
||||
/**
|
||||
* Get image data from a renderer.
|
||||
* @param {module:ol/renderer/canvas/Layer} renderer Layer renderer.
|
||||
* @param {module:ol/PluggableMap~FrameState} frameState The frame state.
|
||||
* @param {module:ol/layer/Layer~State} layerState The layer state.
|
||||
* @param {import("../renderer/canvas/Layer.js").default} renderer Layer renderer.
|
||||
* @param {import("../PluggableMap.js").FrameState} frameState The frame state.
|
||||
* @param {import("../layer/Layer.js").State} layerState The layer state.
|
||||
* @return {ImageData} The image data.
|
||||
*/
|
||||
function getImageData(renderer, frameState, layerState) {
|
||||
@@ -455,8 +455,8 @@ function getImageData(renderer, frameState, layerState) {
|
||||
|
||||
/**
|
||||
* Get a list of layer states from a list of renderers.
|
||||
* @param {Array<module:ol/renderer/canvas/Layer>} renderers Layer renderers.
|
||||
* @return {Array<module:ol/layer/Layer~State>} The layer states.
|
||||
* @param {Array<import("../renderer/canvas/Layer.js").default>} renderers Layer renderers.
|
||||
* @return {Array<import("../layer/Layer.js").State>} The layer states.
|
||||
*/
|
||||
function getLayerStatesArray(renderers) {
|
||||
return renderers.map(function(renderer) {
|
||||
@@ -467,8 +467,8 @@ function getLayerStatesArray(renderers) {
|
||||
|
||||
/**
|
||||
* Create renderers for all sources.
|
||||
* @param {Array<module:ol/source/Source>} sources The sources.
|
||||
* @return {Array<module:ol/renderer/canvas/Layer>} Array of layer renderers.
|
||||
* @param {Array<import("./Source.js").default>} sources The sources.
|
||||
* @return {Array<import("../renderer/canvas/Layer.js").default>} Array of layer renderers.
|
||||
*/
|
||||
function createRenderers(sources) {
|
||||
const len = sources.length;
|
||||
@@ -482,8 +482,8 @@ function createRenderers(sources) {
|
||||
|
||||
/**
|
||||
* Create a renderer for the provided source.
|
||||
* @param {module:ol/source/Source} source The source.
|
||||
* @return {module:ol/renderer/canvas/Layer} The renderer.
|
||||
* @param {import("./Source.js").default} source The source.
|
||||
* @return {import("../renderer/canvas/Layer.js").default} The renderer.
|
||||
*/
|
||||
function createRenderer(source) {
|
||||
let renderer = null;
|
||||
@@ -503,8 +503,8 @@ function createRenderer(source) {
|
||||
|
||||
/**
|
||||
* Create an image renderer for the provided source.
|
||||
* @param {module:ol/source/Image} source The source.
|
||||
* @return {module:ol/renderer/canvas/Layer} The renderer.
|
||||
* @param {import("./Image.js").default} source The source.
|
||||
* @return {import("../renderer/canvas/Layer.js").default} The renderer.
|
||||
*/
|
||||
function createImageRenderer(source) {
|
||||
const layer = new ImageLayer({source: source});
|
||||
@@ -514,8 +514,8 @@ function createImageRenderer(source) {
|
||||
|
||||
/**
|
||||
* Create a tile renderer for the provided source.
|
||||
* @param {module:ol/source/Tile} source The source.
|
||||
* @return {module:ol/renderer/canvas/Layer} The renderer.
|
||||
* @param {import("./Tile.js").default} source The source.
|
||||
* @return {import("../renderer/canvas/Layer.js").default} The renderer.
|
||||
*/
|
||||
function createTileRenderer(source) {
|
||||
const layer = new TileLayer({source: source});
|
||||
|
||||
@@ -12,7 +12,7 @@ import SourceState from '../source/State.js';
|
||||
* A function that returns a string or an array of strings representing source
|
||||
* attributions.
|
||||
*
|
||||
* @typedef {function(module:ol/PluggableMap~FrameState): (string|Array<string>)} Attribution
|
||||
* @typedef {function(import("../PluggableMap.js").FrameState): (string|Array<string>)} Attribution
|
||||
*/
|
||||
|
||||
|
||||
@@ -24,15 +24,15 @@ import SourceState from '../source/State.js';
|
||||
* * an array of simple strings (e.g. `['© Acme Inc.', '© Bacme Inc.']`)
|
||||
* * a function that returns a string or array of strings (`{@link module:ol/source/Source~Attribution}`)
|
||||
*
|
||||
* @typedef {string|Array<string>|module:ol/source/Source~Attribution} AttributionLike
|
||||
* @typedef {string|Array<string>|Attribution} AttributionLike
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {module:ol/source/Source~AttributionLike} [attributions]
|
||||
* @property {module:ol/proj~ProjectionLike} projection
|
||||
* @property {module:ol/source/State} [state]
|
||||
* @property {AttributionLike} [attributions]
|
||||
* @property {import("../proj.js").ProjectionLike} projection
|
||||
* @property {import("./State.js").default} [state]
|
||||
* @property {boolean} [wrapX]
|
||||
*/
|
||||
|
||||
@@ -48,7 +48,7 @@ import SourceState from '../source/State.js';
|
||||
*/
|
||||
class Source extends BaseObject {
|
||||
/**
|
||||
* @param {module:ol/source/Source~Options} options Source options.
|
||||
* @param {Options} options Source options.
|
||||
*/
|
||||
constructor(options) {
|
||||
|
||||
@@ -56,13 +56,13 @@ class Source extends BaseObject {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/proj/Projection}
|
||||
* @type {import("../proj/Projection.js").default}
|
||||
*/
|
||||
this.projection_ = getProjection(options.projection);
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {?module:ol/source/Source~Attribution}
|
||||
* @type {?Attribution}
|
||||
*/
|
||||
this.attributions_ = this.adaptAttributions_(options.attributions);
|
||||
|
||||
@@ -75,7 +75,7 @@ class Source extends BaseObject {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/source/State}
|
||||
* @type {import("./State.js").default}
|
||||
*/
|
||||
this.state_ = options.state !== undefined ?
|
||||
options.state : SourceState.READY;
|
||||
@@ -90,8 +90,8 @@ class Source extends BaseObject {
|
||||
|
||||
/**
|
||||
* Turns the attributions option into an attributions function.
|
||||
* @param {module:ol/source/Source~AttributionLike|undefined} attributionLike The attribution option.
|
||||
* @return {?module:ol/source/Source~Attribution} An attribution function (or null).
|
||||
* @param {AttributionLike|undefined} attributionLike The attribution option.
|
||||
* @return {?Attribution} An attribution function (or null).
|
||||
*/
|
||||
adaptAttributions_(attributionLike) {
|
||||
if (!attributionLike) {
|
||||
@@ -114,7 +114,7 @@ class Source extends BaseObject {
|
||||
|
||||
/**
|
||||
* Get the attribution function for the source.
|
||||
* @return {?module:ol/source/Source~Attribution} Attribution function.
|
||||
* @return {?Attribution} Attribution function.
|
||||
*/
|
||||
getAttributions() {
|
||||
return this.attributions_;
|
||||
@@ -122,7 +122,7 @@ class Source extends BaseObject {
|
||||
|
||||
/**
|
||||
* Get the projection of the source.
|
||||
* @return {module:ol/proj/Projection} Projection.
|
||||
* @return {import("../proj/Projection.js").default} Projection.
|
||||
* @api
|
||||
*/
|
||||
getProjection() {
|
||||
@@ -137,7 +137,7 @@ class Source extends BaseObject {
|
||||
|
||||
/**
|
||||
* Get the state of the source, see {@link module:ol/source/State~State} for possible states.
|
||||
* @return {module:ol/source/State} State.
|
||||
* @return {import("./State.js").default} State.
|
||||
* @api
|
||||
*/
|
||||
getState() {
|
||||
@@ -161,7 +161,7 @@ class Source extends BaseObject {
|
||||
|
||||
/**
|
||||
* Set the attributions of the source.
|
||||
* @param {module:ol/source/Source~AttributionLike|undefined} attributions Attributions.
|
||||
* @param {AttributionLike|undefined} attributions Attributions.
|
||||
* Can be passed as `string`, `Array<string>`, `{@link module:ol/source/Source~Attribution}`,
|
||||
* or `undefined`.
|
||||
* @api
|
||||
@@ -173,7 +173,7 @@ class Source extends BaseObject {
|
||||
|
||||
/**
|
||||
* Set the state of the source.
|
||||
* @param {module:ol/source/State} state State.
|
||||
* @param {import("./State.js").default} state State.
|
||||
* @protected
|
||||
*/
|
||||
setState(state) {
|
||||
@@ -183,12 +183,12 @@ class Source extends BaseObject {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {module:ol/coordinate~Coordinate} coordinate Coordinate.
|
||||
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
|
||||
* @param {number} resolution Resolution.
|
||||
* @param {number} rotation Rotation.
|
||||
* @param {number} hitTolerance Hit tolerance in pixels.
|
||||
* @param {Object<string, boolean>} skippedFeatureUids Skipped feature uids.
|
||||
* @param {function((module:ol/Feature|module:ol/render/Feature)): T} callback Feature callback.
|
||||
* @param {function((import("../Feature.js").default|import("../render/Feature.js").default)): T} callback Feature callback.
|
||||
* @return {T|void} Callback result.
|
||||
* @template T
|
||||
*/
|
||||
|
||||
@@ -97,7 +97,7 @@ const ProviderConfig = {
|
||||
* @property {boolean} [opaque] Whether the layer is opaque.
|
||||
* @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
|
||||
* Higher values can increase reprojection performance, but decrease precision.
|
||||
* @property {module:ol/Tile~LoadFunction} [tileLoadFunction]
|
||||
* @property {import("../Tile.js").LoadFunction} [tileLoadFunction]
|
||||
* Optional function to load a tile given a URL. The default is
|
||||
* ```js
|
||||
* function(imageTile, src) {
|
||||
@@ -116,7 +116,7 @@ const ProviderConfig = {
|
||||
*/
|
||||
class Stamen extends XYZ {
|
||||
/**
|
||||
* @param {module:ol/source/Stamen~Options=} options Stamen options.
|
||||
* @param {Options=} options Stamen options.
|
||||
*/
|
||||
constructor(options) {
|
||||
const i = options.layer.indexOf('-');
|
||||
|
||||
@@ -14,14 +14,14 @@ import {wrapX, getForProjection as getTileGridForProjection} from '../tilegrid.j
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {module:ol/source/Source~AttributionLike} [attributions]
|
||||
* @property {import("./Source.js").AttributionLike} [attributions]
|
||||
* @property {number} [cacheSize]
|
||||
* @property {module:ol/extent~Extent} [extent]
|
||||
* @property {import("../extent.js").Extent} [extent]
|
||||
* @property {boolean} [opaque]
|
||||
* @property {number} [tilePixelRatio]
|
||||
* @property {module:ol/proj~ProjectionLike} [projection]
|
||||
* @property {module:ol/source/State} [state]
|
||||
* @property {module:ol/tilegrid/TileGrid} [tileGrid]
|
||||
* @property {import("../proj.js").ProjectionLike} [projection]
|
||||
* @property {import("./State.js").default} [state]
|
||||
* @property {import("../tilegrid/TileGrid.js").default} [tileGrid]
|
||||
* @property {boolean} [wrapX=true]
|
||||
* @property {number} [transition]
|
||||
*/
|
||||
@@ -36,7 +36,7 @@ import {wrapX, getForProjection as getTileGridForProjection} from '../tilegrid.j
|
||||
*/
|
||||
class TileSource extends Source {
|
||||
/**
|
||||
* @param {module:ol/source/Tile~Options=} options SourceTile source options.
|
||||
* @param {Options=} options SourceTile source options.
|
||||
*/
|
||||
constructor(options) {
|
||||
|
||||
@@ -63,19 +63,19 @@ class TileSource extends Source {
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {module:ol/tilegrid/TileGrid}
|
||||
* @type {import("../tilegrid/TileGrid.js").default}
|
||||
*/
|
||||
this.tileGrid = options.tileGrid !== undefined ? options.tileGrid : null;
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {module:ol/TileCache}
|
||||
* @type {import("../TileCache.js").default}
|
||||
*/
|
||||
this.tileCache = new TileCache(options.cacheSize);
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {module:ol/size~Size}
|
||||
* @type {import("../size.js").Size}
|
||||
*/
|
||||
this.tmpSize = [0, 0];
|
||||
|
||||
@@ -87,7 +87,7 @@ class TileSource extends Source {
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {module:ol/Tile~Options}
|
||||
* @type {import("../Tile.js").Options}
|
||||
*/
|
||||
this.tileOptions = {transition: options.transition};
|
||||
|
||||
@@ -101,8 +101,8 @@ class TileSource extends Source {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {module:ol/proj/Projection} projection Projection.
|
||||
* @param {!Object<string, module:ol/TileRange>} usedTiles Used tiles.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
* @param {!Object<string, import("../TileRange.js").default>} usedTiles Used tiles.
|
||||
*/
|
||||
expireCache(projection, usedTiles) {
|
||||
const tileCache = this.getTileCacheForProjection(projection);
|
||||
@@ -112,10 +112,10 @@ class TileSource extends Source {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {module:ol/proj/Projection} projection Projection.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
* @param {number} z Zoom level.
|
||||
* @param {module:ol/TileRange} tileRange Tile range.
|
||||
* @param {function(module:ol/Tile):(boolean|undefined)} callback Called with each
|
||||
* @param {import("../TileRange.js").default} tileRange Tile range.
|
||||
* @param {function(import("../Tile.js").default):(boolean|undefined)} callback Called with each
|
||||
* loaded tile. If the callback returns `false`, the tile will not be
|
||||
* considered loaded.
|
||||
* @return {boolean} The tile range is fully covered with loaded tiles.
|
||||
@@ -133,7 +133,7 @@ class TileSource extends Source {
|
||||
tileCoordKey = getKeyZXY(z, x, y);
|
||||
loaded = false;
|
||||
if (tileCache.containsKey(tileCoordKey)) {
|
||||
tile = /** @type {!module:ol/Tile} */ (tileCache.get(tileCoordKey));
|
||||
tile = /** @type {!import("../Tile.js").default} */ (tileCache.get(tileCoordKey));
|
||||
loaded = tile.getState() === TileState.LOADED;
|
||||
if (loaded) {
|
||||
loaded = (callback(tile) !== false);
|
||||
@@ -148,7 +148,7 @@ class TileSource extends Source {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {module:ol/proj/Projection} projection Projection.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
* @return {number} Gutter.
|
||||
*/
|
||||
getGutterForProjection(projection) {
|
||||
@@ -177,7 +177,7 @@ class TileSource extends Source {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {module:ol/proj/Projection} projection Projection.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
* @return {boolean} Opaque.
|
||||
*/
|
||||
getOpaque(projection) {
|
||||
@@ -197,14 +197,14 @@ class TileSource extends Source {
|
||||
* @param {number} x Tile coordinate x.
|
||||
* @param {number} y Tile coordinate y.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {module:ol/proj/Projection} projection Projection.
|
||||
* @return {!module:ol/Tile} Tile.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
* @return {!import("../Tile.js").default} Tile.
|
||||
*/
|
||||
getTile(z, x, y, pixelRatio, projection) {}
|
||||
|
||||
/**
|
||||
* Return the tile grid of the tile source.
|
||||
* @return {module:ol/tilegrid/TileGrid} Tile grid.
|
||||
* @return {import("../tilegrid/TileGrid.js").default} Tile grid.
|
||||
* @api
|
||||
*/
|
||||
getTileGrid() {
|
||||
@@ -212,8 +212,8 @@ class TileSource extends Source {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {module:ol/proj/Projection} projection Projection.
|
||||
* @return {!module:ol/tilegrid/TileGrid} Tile grid.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
* @return {!import("../tilegrid/TileGrid.js").default} Tile grid.
|
||||
*/
|
||||
getTileGridForProjection(projection) {
|
||||
if (!this.tileGrid) {
|
||||
@@ -224,8 +224,8 @@ class TileSource extends Source {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {module:ol/proj/Projection} projection Projection.
|
||||
* @return {module:ol/TileCache} Tile cache.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
* @return {import("../TileCache.js").default} Tile cache.
|
||||
* @protected
|
||||
*/
|
||||
getTileCacheForProjection(projection) {
|
||||
@@ -251,8 +251,8 @@ class TileSource extends Source {
|
||||
/**
|
||||
* @param {number} z Z.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {module:ol/proj/Projection} projection Projection.
|
||||
* @return {module:ol/size~Size} Tile size.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
* @return {import("../size.js").Size} Tile size.
|
||||
*/
|
||||
getTilePixelSize(z, pixelRatio, projection) {
|
||||
const tileGrid = this.getTileGridForProjection(projection);
|
||||
@@ -269,9 +269,9 @@ class TileSource extends Source {
|
||||
* Returns a tile coordinate wrapped around the x-axis. When the tile coordinate
|
||||
* is outside the resolution and extent range of the tile grid, `null` will be
|
||||
* returned.
|
||||
* @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate.
|
||||
* @param {module:ol/proj/Projection=} opt_projection Projection.
|
||||
* @return {module:ol/tilecoord~TileCoord} Tile coordinate to be passed to the tileUrlFunction or
|
||||
* @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
||||
* @param {import("../proj/Projection.js").default=} opt_projection Projection.
|
||||
* @return {import("../tilecoord.js").TileCoord} Tile coordinate to be passed to the tileUrlFunction or
|
||||
* null if no tile URL should be created for the passed `tileCoord`.
|
||||
*/
|
||||
getTileCoordForTileUrlFunction(tileCoord, opt_projection) {
|
||||
@@ -299,7 +299,7 @@ class TileSource extends Source {
|
||||
* @param {number} z Tile coordinate z.
|
||||
* @param {number} x Tile coordinate x.
|
||||
* @param {number} y Tile coordinate y.
|
||||
* @param {module:ol/proj/Projection} projection Projection.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
*/
|
||||
TileSource.prototype.useTile = VOID;
|
||||
|
||||
@@ -312,7 +312,7 @@ TileSource.prototype.useTile = VOID;
|
||||
export class TileSourceEvent extends Event {
|
||||
/**
|
||||
* @param {string} type Type.
|
||||
* @param {module:ol/Tile} tile The tile.
|
||||
* @param {import("../Tile.js").default} tile The tile.
|
||||
*/
|
||||
constructor(type, tile) {
|
||||
|
||||
@@ -320,7 +320,7 @@ export class TileSourceEvent extends Event {
|
||||
|
||||
/**
|
||||
* The tile related to the event.
|
||||
* @type {module:ol/Tile}
|
||||
* @type {import("../Tile.js").default}
|
||||
* @api
|
||||
*/
|
||||
this.tile = tile;
|
||||
|
||||
@@ -12,7 +12,7 @@ import {appendParams} from '../uri.js';
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {module:ol/source/Source~AttributionLike} [attributions] Attributions.
|
||||
* @property {import("./Source.js").AttributionLike} [attributions] Attributions.
|
||||
* @property {number} [cacheSize=2048] Cache size.
|
||||
* @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images.
|
||||
* Note that you must provide a `crossOrigin` value if you are using the WebGL renderer
|
||||
@@ -26,15 +26,15 @@ import {appendParams} from '../uri.js';
|
||||
* override the default service layer visibility. See
|
||||
* http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Export_Map/02r3000000v7000000/
|
||||
* for further reference.
|
||||
* @property {module:ol/tilegrid/TileGrid} [tileGrid] Tile grid. Base this on the resolutions,
|
||||
* @property {import("../tilegrid/TileGrid.js").default} [tileGrid] Tile grid. Base this on the resolutions,
|
||||
* tilesize and extent supported by the server.
|
||||
* If this is not defined, a default grid will be used: if there is a projection
|
||||
* extent, the grid will be based on that; if not, a grid based on a global
|
||||
* extent with origin at 0,0 will be used.
|
||||
* @property {module:ol/proj~ProjectionLike} projection Projection.
|
||||
* @property {import("../proj.js").ProjectionLike} projection Projection.
|
||||
* @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
|
||||
* Higher values can increase reprojection performance, but decrease precision.
|
||||
* @property {module:ol/Tile~LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL.
|
||||
* @property {import("../Tile.js").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL.
|
||||
* The default is
|
||||
* ```js
|
||||
* function(imageTile, src) {
|
||||
@@ -62,7 +62,7 @@ import {appendParams} from '../uri.js';
|
||||
*/
|
||||
class TileArcGISRest extends TileImage {
|
||||
/**
|
||||
* @param {module:ol/source/TileArcGISRest~Options=} opt_options Tile ArcGIS Rest options.
|
||||
* @param {Options=} opt_options Tile ArcGIS Rest options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
|
||||
@@ -90,7 +90,7 @@ class TileArcGISRest extends TileImage {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/extent~Extent}
|
||||
* @type {import("../extent.js").Extent}
|
||||
*/
|
||||
this.tmpExtent_ = createEmpty();
|
||||
|
||||
@@ -121,11 +121,11 @@ class TileArcGISRest extends TileImage {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate.
|
||||
* @param {module:ol/size~Size} tileSize Tile size.
|
||||
* @param {module:ol/extent~Extent} tileExtent Tile extent.
|
||||
* @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
||||
* @param {import("../size.js").Size} tileSize Tile size.
|
||||
* @param {import("../extent.js").Extent} tileExtent Tile extent.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {module:ol/proj/Projection} projection Projection.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
* @param {Object} params Params.
|
||||
* @return {string|undefined} Request URL.
|
||||
* @private
|
||||
|
||||
@@ -12,8 +12,8 @@ import {getKeyZXY} from '../tilecoord.js';
|
||||
|
||||
class LabeledTile extends Tile {
|
||||
/**
|
||||
* @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate.
|
||||
* @param {module:ol/size~Size} tileSize Tile size.
|
||||
* @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
||||
* @param {import("../size.js").Size} tileSize Tile size.
|
||||
* @param {string} text Text.
|
||||
*/
|
||||
constructor(tileCoord, tileSize, text) {
|
||||
@@ -22,7 +22,7 @@ class LabeledTile extends Tile {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/size~Size}
|
||||
* @type {import("../size.js").Size}
|
||||
*/
|
||||
this.tileSize_ = tileSize;
|
||||
|
||||
@@ -74,8 +74,8 @@ class LabeledTile extends Tile {
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {module:ol/proj~ProjectionLike} projection Projection.
|
||||
* @property {module:ol/tilegrid/TileGrid} [tileGrid] Tile grid.
|
||||
* @property {import("../proj.js").ProjectionLike} projection Projection.
|
||||
* @property {import("../tilegrid/TileGrid.js").default} [tileGrid] Tile grid.
|
||||
* @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
|
||||
*/
|
||||
|
||||
@@ -91,7 +91,7 @@ class LabeledTile extends Tile {
|
||||
*/
|
||||
class TileDebug extends TileSource {
|
||||
/**
|
||||
* @param {module:ol/source/TileDebug~Options=} options Debug tile options.
|
||||
* @param {Options=} options Debug tile options.
|
||||
*/
|
||||
constructor(options) {
|
||||
|
||||
@@ -110,7 +110,7 @@ class TileDebug extends TileSource {
|
||||
getTile(z, x, y) {
|
||||
const tileCoordKey = getKeyZXY(z, x, y);
|
||||
if (this.tileCache.containsKey(tileCoordKey)) {
|
||||
return /** @type {!module:ol/source/TileDebug~LabeledTile} */ (this.tileCache.get(tileCoordKey));
|
||||
return /** @type {!LabeledTile} */ (this.tileCache.get(tileCoordKey));
|
||||
} else {
|
||||
const tileSize = toSize(this.tileGrid.getTileSize(z));
|
||||
const tileCoord = [z, x, y];
|
||||
|
||||
@@ -16,22 +16,22 @@ import {getForProjection as getTileGridForProjection} from '../tilegrid.js';
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {module:ol/source/Source~AttributionLike} [attributions] Attributions.
|
||||
* @property {import("./Source.js").AttributionLike} [attributions] Attributions.
|
||||
* @property {number} [cacheSize=2048] Cache size.
|
||||
* @property {module:ol/extent~Extent} [extent]
|
||||
* @property {import("../extent.js").Extent} [extent]
|
||||
* @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
|
||||
* you must provide a `crossOrigin` value if you are using the WebGL renderer or 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 {module:ol/proj~ProjectionLike} projection Projection.
|
||||
* @property {import("../proj.js").ProjectionLike} projection Projection.
|
||||
* @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
|
||||
* Higher values can increase reprojection performance, but decrease precision.
|
||||
* @property {module:ol/source/State} [state] Source state.
|
||||
* @property {module:ol/ImageTile~TileClass} [tileClass] Class used to instantiate image tiles.
|
||||
* @property {import("./State.js").default} [state] Source state.
|
||||
* @property {import("../ImageTile.js").TileClass} [tileClass] Class used to instantiate image tiles.
|
||||
* Default is {@link module:ol/ImageTile~ImageTile}.
|
||||
* @property {module:ol/tilegrid/TileGrid} [tileGrid] Tile grid.
|
||||
* @property {module:ol/Tile~LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is
|
||||
* @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;
|
||||
@@ -41,7 +41,7 @@ import {getForProjection as getTileGridForProjection} from '../tilegrid.js';
|
||||
* 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 {module:ol/Tile~UrlFunction} [tileUrlFunction] Optional function to get tile URL given a tile coordinate and the projection.
|
||||
* @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.
|
||||
@@ -59,12 +59,12 @@ import {getForProjection as getTileGridForProjection} from '../tilegrid.js';
|
||||
* @classdesc
|
||||
* Base class for sources providing images divided into a tile grid.
|
||||
*
|
||||
* @fires module:ol/source/Tile~TileSourceEvent
|
||||
* @fires import("./Tile.js").TileSourceEvent
|
||||
* @api
|
||||
*/
|
||||
class TileImage extends UrlTile {
|
||||
/**
|
||||
* @param {!module:ol/source/TileImage~Options} options Image tile options.
|
||||
* @param {!Options} options Image tile options.
|
||||
*/
|
||||
constructor(options) {
|
||||
|
||||
@@ -95,21 +95,21 @@ class TileImage extends UrlTile {
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {function(new: module:ol/ImageTile, module:ol/tilecoord~TileCoord, module:ol/TileState, string,
|
||||
* ?string, module:ol/Tile~LoadFunction, module:ol/Tile~Options=)}
|
||||
* @type {function(new: import("../ImageTile.js").default, import("../tilecoord.js").TileCoord, import("../TileState.js").default, string,
|
||||
* ?string, import("../Tile.js").LoadFunction, import("../Tile.js").Options=)}
|
||||
*/
|
||||
this.tileClass = options.tileClass !== undefined ?
|
||||
options.tileClass : ImageTile;
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {!Object<string, module:ol/TileCache>}
|
||||
* @type {!Object<string, import("../TileCache.js").default>}
|
||||
*/
|
||||
this.tileCacheForProjection = {};
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {!Object<string, module:ol/tilegrid/TileGrid>}
|
||||
* @type {!Object<string, import("../tilegrid/TileGrid.js").default>}
|
||||
*/
|
||||
this.tileGridForProjection = {};
|
||||
|
||||
@@ -209,7 +209,7 @@ class TileImage extends UrlTile {
|
||||
this.tileGridForProjection[projKey] = getTileGridForProjection(projection);
|
||||
}
|
||||
return (
|
||||
/** @type {!module:ol/tilegrid/TileGrid} */ (this.tileGridForProjection[projKey])
|
||||
/** @type {!import("../tilegrid/TileGrid.js").default} */ (this.tileGridForProjection[projKey])
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -237,9 +237,9 @@ class TileImage extends UrlTile {
|
||||
* @param {number} x Tile coordinate x.
|
||||
* @param {number} y Tile coordinate y.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {module:ol/proj/Projection} projection Projection.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
* @param {string} key The key set on the tile.
|
||||
* @return {!module:ol/Tile} Tile.
|
||||
* @return {!import("../Tile.js").default} Tile.
|
||||
* @private
|
||||
*/
|
||||
createTile_(z, x, y, pixelRatio, projection, key) {
|
||||
@@ -265,7 +265,7 @@ class TileImage extends UrlTile {
|
||||
* @inheritDoc
|
||||
*/
|
||||
getTile(z, x, y, pixelRatio, projection) {
|
||||
const sourceProjection = /** @type {!module:ol/proj/Projection} */ (this.getProjection());
|
||||
const sourceProjection = /** @type {!import("../proj/Projection.js").default} */ (this.getProjection());
|
||||
if (!ENABLE_RASTER_REPROJECTION ||
|
||||
!sourceProjection || !projection || equivalent(sourceProjection, projection)) {
|
||||
return this.getTileInternal(z, x, y, pixelRatio, sourceProjection || projection);
|
||||
@@ -275,7 +275,7 @@ class TileImage extends UrlTile {
|
||||
let tile;
|
||||
const tileCoordKey = getKey(tileCoord);
|
||||
if (cache.containsKey(tileCoordKey)) {
|
||||
tile = /** @type {!module:ol/Tile} */ (cache.get(tileCoordKey));
|
||||
tile = /** @type {!import("../Tile.js").default} */ (cache.get(tileCoordKey));
|
||||
}
|
||||
const key = this.getKey();
|
||||
if (tile && tile.key == key) {
|
||||
@@ -313,8 +313,8 @@ class TileImage extends UrlTile {
|
||||
* @param {number} x Tile coordinate x.
|
||||
* @param {number} y Tile coordinate y.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {!module:ol/proj/Projection} projection Projection.
|
||||
* @return {!module:ol/Tile} Tile.
|
||||
* @param {!import("../proj/Projection.js").default} projection Projection.
|
||||
* @return {!import("../Tile.js").default} Tile.
|
||||
* @protected
|
||||
*/
|
||||
getTileInternal(z, x, y, pixelRatio, projection) {
|
||||
@@ -372,8 +372,8 @@ class TileImage extends UrlTile {
|
||||
* (e.g. projection has no extent defined) or
|
||||
* for optimization reasons (custom tile size, resolutions, ...).
|
||||
*
|
||||
* @param {module:ol/proj~ProjectionLike} projection Projection.
|
||||
* @param {module:ol/tilegrid/TileGrid} tilegrid Tile grid to use for the projection.
|
||||
* @param {import("../proj.js").ProjectionLike} projection Projection.
|
||||
* @param {import("../tilegrid/TileGrid.js").default} tilegrid Tile grid to use for the projection.
|
||||
* @api
|
||||
*/
|
||||
setTileGridForProjection(projection, tilegrid) {
|
||||
@@ -391,7 +391,7 @@ class TileImage extends UrlTile {
|
||||
|
||||
|
||||
/**
|
||||
* @param {module:ol/ImageTile} imageTile Image tile.
|
||||
* @param {import("../ImageTile.js").default} imageTile Image tile.
|
||||
* @param {string} src Source.
|
||||
*/
|
||||
function defaultTileLoadFunction(imageTile, src) {
|
||||
|
||||
@@ -19,7 +19,7 @@ import {createXYZ, extentFromProjection} from '../tilegrid.js';
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {module:ol/source/Source~AttributionLike} [attributions] Attributions.
|
||||
* @property {import("./Source.js").AttributionLike} [attributions] Attributions.
|
||||
* @property {number} [cacheSize=2048] Cache size.
|
||||
* @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
|
||||
* you must provide a `crossOrigin` value if you are using the WebGL renderer or if you want to
|
||||
@@ -31,7 +31,7 @@ import {createXYZ, extentFromProjection} from '../tilegrid.js';
|
||||
* Higher values can increase reprojection performance, but decrease precision.
|
||||
* @property {tileJSON} [tileJSON] TileJSON configuration for this source.
|
||||
* If not provided, `url` must be configured.
|
||||
* @property {module:ol/Tile~LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is
|
||||
* @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;
|
||||
@@ -51,7 +51,7 @@ import {createXYZ, extentFromProjection} from '../tilegrid.js';
|
||||
*/
|
||||
class TileJSON extends TileImage {
|
||||
/**
|
||||
* @param {module:ol/source/TileJSON~Options=} options TileJSON options.
|
||||
* @param {Options=} options TileJSON options.
|
||||
*/
|
||||
constructor(options) {
|
||||
super({
|
||||
|
||||
@@ -19,7 +19,7 @@ import {appendParams} from '../uri.js';
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {module:ol/source/Source~AttributionLike} [attributions] Attributions.
|
||||
* @property {import("./Source.js").AttributionLike} [attributions] Attributions.
|
||||
* @property {number} [cacheSize=2048] Cache size.
|
||||
* @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
|
||||
* you must provide a `crossOrigin` value if you are using the WebGL renderer or if you want to
|
||||
@@ -40,20 +40,20 @@ import {appendParams} from '../uri.js';
|
||||
* this. See http://mapserver.org/output/tile_mode.html.
|
||||
* @property {boolean} [hidpi=true] Use the `ol/Map#pixelRatio` value when requesting
|
||||
* the image from the remote server.
|
||||
* @property {module:ol/proj~ProjectionLike} projection Projection.
|
||||
* @property {import("../proj.js").ProjectionLike} projection Projection.
|
||||
* @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
|
||||
* Higher values can increase reprojection performance, but decrease precision.
|
||||
* @property {module:ol/ImageTile~TileClass} [tileClass] Class used to instantiate image tiles.
|
||||
* @property {import("../ImageTile.js").TileClass} [tileClass] Class used to instantiate image tiles.
|
||||
* Default is {@link module:ol/ImageTile~TileClass}.
|
||||
* @property {module:ol/tilegrid/TileGrid} [tileGrid] Tile grid. Base this on the resolutions,
|
||||
* @property {import("../tilegrid/TileGrid.js").default} [tileGrid] Tile grid. Base this on the resolutions,
|
||||
* tilesize and extent supported by the server.
|
||||
* If this is not defined, a default grid will be used: if there is a projection
|
||||
* extent, the grid will be based on that; if not, a grid based on a global
|
||||
* extent with origin at 0,0 will be used..
|
||||
* @property {module:ol/source/WMSServerType|string} [serverType]
|
||||
* @property {import("./WMSServerType.js").default|string} [serverType]
|
||||
* The type of the remote WMS server. Currently only used when `hidpi` is
|
||||
* `true`.
|
||||
* @property {module:ol/Tile~LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is
|
||||
* @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;
|
||||
@@ -78,11 +78,11 @@ import {appendParams} from '../uri.js';
|
||||
*/
|
||||
class TileWMS extends TileImage {
|
||||
/**
|
||||
* @param {module:ol/source/TileWMS~Options=} [opt_options] Tile WMS options.
|
||||
* @param {Options=} [opt_options] Tile WMS options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
|
||||
const options = opt_options || /** @type {module:ol/source/TileWMS~Options} */ ({});
|
||||
const options = opt_options || /** @type {Options} */ ({});
|
||||
|
||||
const params = options.params || {};
|
||||
|
||||
@@ -124,9 +124,9 @@ class TileWMS extends TileImage {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/source/WMSServerType|undefined}
|
||||
* @type {import("./WMSServerType.js").default|undefined}
|
||||
*/
|
||||
this.serverType_ = /** @type {module:ol/source/WMSServerType|undefined} */ (options.serverType);
|
||||
this.serverType_ = /** @type {import("./WMSServerType.js").default|undefined} */ (options.serverType);
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -136,7 +136,7 @@ class TileWMS extends TileImage {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/extent~Extent}
|
||||
* @type {import("../extent.js").Extent}
|
||||
*/
|
||||
this.tmpExtent_ = createEmpty();
|
||||
|
||||
@@ -149,9 +149,9 @@ class TileWMS extends TileImage {
|
||||
* Return the GetFeatureInfo URL for the passed coordinate, resolution, and
|
||||
* projection. Return `undefined` if the GetFeatureInfo URL cannot be
|
||||
* constructed.
|
||||
* @param {module:ol/coordinate~Coordinate} coordinate Coordinate.
|
||||
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
|
||||
* @param {number} resolution Resolution.
|
||||
* @param {module:ol/proj~ProjectionLike} projection Projection.
|
||||
* @param {import("../proj.js").ProjectionLike} projection Projection.
|
||||
* @param {!Object} params GetFeatureInfo params. `INFO_FORMAT` at least should
|
||||
* be provided. If `QUERY_LAYERS` is not provided then the layers specified
|
||||
* in the `LAYERS` parameter will be used. `VERSION` should not be
|
||||
@@ -229,11 +229,11 @@ class TileWMS extends TileImage {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate.
|
||||
* @param {module:ol/size~Size} tileSize Tile size.
|
||||
* @param {module:ol/extent~Extent} tileExtent Tile extent.
|
||||
* @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
||||
* @param {import("../size.js").Size} tileSize Tile size.
|
||||
* @param {import("../extent.js").Extent} tileExtent Tile extent.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {module:ol/proj/Projection} projection Projection.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
* @param {Object} params Params.
|
||||
* @return {string|undefined} Request URL.
|
||||
* @private
|
||||
|
||||
@@ -20,10 +20,10 @@ import {createXYZ, extentFromProjection} from '../tilegrid.js';
|
||||
export class CustomTile extends Tile {
|
||||
|
||||
/**
|
||||
* @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate.
|
||||
* @param {module:ol/TileState} state State.
|
||||
* @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
||||
* @param {import("../TileState.js").default} state State.
|
||||
* @param {string} src Image source URI.
|
||||
* @param {module:ol/extent~Extent} extent Extent of the tile.
|
||||
* @param {import("../extent.js").Extent} extent Extent of the tile.
|
||||
* @param {boolean} preemptive Load the tile when visible (before it's needed).
|
||||
* @param {boolean} jsonp Load the tile as a script.
|
||||
*/
|
||||
@@ -39,7 +39,7 @@ export class CustomTile extends Tile {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/extent~Extent}
|
||||
* @type {import("../extent.js").Extent}
|
||||
*/
|
||||
this.extent_ = extent;
|
||||
|
||||
@@ -87,7 +87,7 @@ export class CustomTile extends Tile {
|
||||
|
||||
/**
|
||||
* Synchronously returns data at given coordinate (if available).
|
||||
* @param {module:ol/coordinate~Coordinate} coordinate Coordinate.
|
||||
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
|
||||
* @return {*} The data.
|
||||
*/
|
||||
getData(coordinate) {
|
||||
@@ -130,7 +130,7 @@ export class CustomTile extends Tile {
|
||||
/**
|
||||
* Calls the callback (synchronously by default) with the available data
|
||||
* for given coordinate (or `null` if not yet loaded).
|
||||
* @param {module:ol/coordinate~Coordinate} coordinate Coordinate.
|
||||
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
|
||||
* @param {function(this: T, *)} callback Callback.
|
||||
* @param {T=} opt_this The object to use as `this` in the callback.
|
||||
* @param {boolean=} opt_request If `true` the callback is always async.
|
||||
@@ -272,7 +272,7 @@ export class CustomTile extends Tile {
|
||||
*/
|
||||
class UTFGrid extends TileSource {
|
||||
/**
|
||||
* @param {module:ol/source/UTFGrid~Options=} options Source options.
|
||||
* @param {Options=} options Source options.
|
||||
*/
|
||||
constructor(options) {
|
||||
super({
|
||||
@@ -289,7 +289,7 @@ class UTFGrid extends TileSource {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {!module:ol/Tile~UrlFunction}
|
||||
* @type {!import("../Tile.js").UrlFunction}
|
||||
*/
|
||||
this.tileUrlFunction_ = nullTileUrlFunction;
|
||||
|
||||
@@ -370,7 +370,7 @@ class UTFGrid extends TileSource {
|
||||
* Calls the callback (synchronously by default) with the available data
|
||||
* for given coordinate and resolution (or `null` if not yet loaded or
|
||||
* in case of an error).
|
||||
* @param {module:ol/coordinate~Coordinate} coordinate Coordinate.
|
||||
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
|
||||
* @param {number} resolution Resolution.
|
||||
* @param {function(*)} callback Callback.
|
||||
* @param {boolean=} opt_request If `true` the callback is always async.
|
||||
@@ -382,7 +382,7 @@ class UTFGrid extends TileSource {
|
||||
if (this.tileGrid) {
|
||||
const tileCoord = this.tileGrid.getTileCoordForCoordAndResolution(
|
||||
coordinate, resolution);
|
||||
const tile = /** @type {!module:ol/source/UTFGrid~CustomTile} */(this.getTile(
|
||||
const tile = /** @type {!CustomTile} */(this.getTile(
|
||||
tileCoord[0], tileCoord[1], tileCoord[2], 1, this.getProjection()));
|
||||
tile.forDataAtCoordinate(coordinate, callback, null, opt_request);
|
||||
} else {
|
||||
@@ -465,7 +465,7 @@ class UTFGrid extends TileSource {
|
||||
const tileCoordKey = getKeyZXY(z, x, y);
|
||||
if (this.tileCache.containsKey(tileCoordKey)) {
|
||||
return (
|
||||
/** @type {!module:ol/Tile} */ (this.tileCache.get(tileCoordKey))
|
||||
/** @type {!import("../Tile.js").default} */ (this.tileCache.get(tileCoordKey))
|
||||
);
|
||||
} else {
|
||||
const tileCoord = [z, x, y];
|
||||
|
||||
@@ -10,16 +10,16 @@ import {getKeyZXY} from '../tilecoord.js';
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {module:ol/source/Source~AttributionLike} [attributions]
|
||||
* @property {import("./Source.js").AttributionLike} [attributions]
|
||||
* @property {number} [cacheSize]
|
||||
* @property {module:ol/extent~Extent} [extent]
|
||||
* @property {import("../extent.js").Extent} [extent]
|
||||
* @property {boolean} [opaque]
|
||||
* @property {module:ol/proj~ProjectionLike} [projection]
|
||||
* @property {module:ol/source/State} [state]
|
||||
* @property {module:ol/tilegrid/TileGrid} [tileGrid]
|
||||
* @property {module:ol/Tile~LoadFunction} tileLoadFunction
|
||||
* @property {import("../proj.js").ProjectionLike} [projection]
|
||||
* @property {import("./State.js").default} [state]
|
||||
* @property {import("../tilegrid/TileGrid.js").default} [tileGrid]
|
||||
* @property {import("../Tile.js").LoadFunction} tileLoadFunction
|
||||
* @property {number} [tilePixelRatio]
|
||||
* @property {module:ol/Tile~UrlFunction} [tileUrlFunction]
|
||||
* @property {import("../Tile.js").UrlFunction} [tileUrlFunction]
|
||||
* @property {string} [url]
|
||||
* @property {Array<string>} [urls]
|
||||
* @property {boolean} [wrapX=true]
|
||||
@@ -31,11 +31,11 @@ import {getKeyZXY} from '../tilecoord.js';
|
||||
* @classdesc
|
||||
* Base class for sources providing tiles divided into a tile grid over http.
|
||||
*
|
||||
* @fires module:ol/source/TileEvent
|
||||
* @fires import("./TileEvent.js").default
|
||||
*/
|
||||
class UrlTile extends TileSource {
|
||||
/**
|
||||
* @param {module:ol/source/UrlTile~Options=} options Image tile options.
|
||||
* @param {Options=} options Image tile options.
|
||||
*/
|
||||
constructor(options) {
|
||||
|
||||
@@ -54,13 +54,13 @@ class UrlTile extends TileSource {
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {module:ol/Tile~LoadFunction}
|
||||
* @type {import("../Tile.js").LoadFunction}
|
||||
*/
|
||||
this.tileLoadFunction = options.tileLoadFunction;
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {module:ol/Tile~UrlFunction}
|
||||
* @type {import("../Tile.js").UrlFunction}
|
||||
*/
|
||||
this.tileUrlFunction = this.fixedTileUrlFunction ?
|
||||
this.fixedTileUrlFunction.bind(this) : nullTileUrlFunction;
|
||||
@@ -90,7 +90,7 @@ class UrlTile extends TileSource {
|
||||
|
||||
/**
|
||||
* Return the tile load function of the source.
|
||||
* @return {module:ol/Tile~LoadFunction} TileLoadFunction
|
||||
* @return {import("../Tile.js").LoadFunction} TileLoadFunction
|
||||
* @api
|
||||
*/
|
||||
getTileLoadFunction() {
|
||||
@@ -99,7 +99,7 @@ class UrlTile extends TileSource {
|
||||
|
||||
/**
|
||||
* Return the tile URL function of the source.
|
||||
* @return {module:ol/Tile~UrlFunction} TileUrlFunction
|
||||
* @return {import("../Tile.js").UrlFunction} TileUrlFunction
|
||||
* @api
|
||||
*/
|
||||
getTileUrlFunction() {
|
||||
@@ -119,11 +119,11 @@ class UrlTile extends TileSource {
|
||||
|
||||
/**
|
||||
* Handle tile change events.
|
||||
* @param {module:ol/events/Event} event Event.
|
||||
* @param {import("../events/Event.js").default} event Event.
|
||||
* @protected
|
||||
*/
|
||||
handleTileChange(event) {
|
||||
const tile = /** @type {module:ol/Tile} */ (event.target);
|
||||
const tile = /** @type {import("../Tile.js").default} */ (event.target);
|
||||
const uid = getUid(tile);
|
||||
const tileState = tile.getState();
|
||||
let type;
|
||||
@@ -143,7 +143,7 @@ class UrlTile extends TileSource {
|
||||
|
||||
/**
|
||||
* Set the tile load function of the source.
|
||||
* @param {module:ol/Tile~LoadFunction} tileLoadFunction Tile load function.
|
||||
* @param {import("../Tile.js").LoadFunction} tileLoadFunction Tile load function.
|
||||
* @api
|
||||
*/
|
||||
setTileLoadFunction(tileLoadFunction) {
|
||||
@@ -154,7 +154,7 @@ class UrlTile extends TileSource {
|
||||
|
||||
/**
|
||||
* Set the tile URL function of the source.
|
||||
* @param {module:ol/Tile~UrlFunction} tileUrlFunction Tile URL function.
|
||||
* @param {import("../Tile.js").UrlFunction} tileUrlFunction Tile URL function.
|
||||
* @param {string=} opt_key Optional new tile key for the source.
|
||||
* @api
|
||||
*/
|
||||
@@ -206,7 +206,7 @@ class UrlTile extends TileSource {
|
||||
|
||||
|
||||
/**
|
||||
* @type {module:ol/Tile~UrlFunction|undefined}
|
||||
* @type {import("../Tile.js").UrlFunction|undefined}
|
||||
* @protected
|
||||
*/
|
||||
UrlTile.prototype.fixedTileUrlFunction;
|
||||
|
||||
@@ -26,7 +26,7 @@ import RBush from '../structs/RBush.js';
|
||||
* returns an array of {@link module:ol/extent~Extent} with the extents to load. Usually this
|
||||
* is one of the standard {@link module:ol/loadingstrategy} strategies.
|
||||
*
|
||||
* @typedef {function(module:ol/extent~Extent, number): Array<module:ol/extent~Extent>} LoadingStrategy
|
||||
* @typedef {function(import("../extent.js").Extent, number): Array<import("../extent.js").Extent>} LoadingStrategy
|
||||
* @api
|
||||
*/
|
||||
|
||||
@@ -40,7 +40,7 @@ export class VectorSourceEvent extends Event {
|
||||
|
||||
/**
|
||||
* @param {string} type Type.
|
||||
* @param {module:ol/Feature=} opt_feature Feature.
|
||||
* @param {import("../Feature.js").default=} opt_feature Feature.
|
||||
*/
|
||||
constructor(type, opt_feature) {
|
||||
|
||||
@@ -48,7 +48,7 @@ export class VectorSourceEvent extends Event {
|
||||
|
||||
/**
|
||||
* The feature being added or removed.
|
||||
* @type {module:ol/Feature|undefined}
|
||||
* @type {import("../Feature.js").default|undefined}
|
||||
* @api
|
||||
*/
|
||||
this.feature = opt_feature;
|
||||
@@ -60,13 +60,13 @@ export class VectorSourceEvent extends Event {
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {module:ol/source/Source~AttributionLike} [attributions] Attributions.
|
||||
* @property {Array<module:ol/Feature>|module:ol/Collection<module:ol/Feature>} [features]
|
||||
* @property {import("./Source.js").AttributionLike} [attributions] Attributions.
|
||||
* @property {Array<import("../Feature.js").default>|import("../Collection.js").default<import("../Feature.js").default>} [features]
|
||||
* Features. If provided as {@link module:ol/Collection}, the features in the source
|
||||
* and the collection will stay in sync.
|
||||
* @property {module:ol/format/Feature} [format] The feature format used by the XHR
|
||||
* @property {import("../format/Feature.js").default} [format] The feature format used by the XHR
|
||||
* feature loader when `url` is set. Required if `url` is set, otherwise ignored.
|
||||
* @property {module:ol/featureloader~FeatureLoader} [loader]
|
||||
* @property {import("../featureloader.js").FeatureLoader} [loader]
|
||||
* The loader function used to load features, from a remote source for example.
|
||||
* If this is not set and `url` is set, the source will create and use an XHR
|
||||
* feature loader.
|
||||
@@ -109,10 +109,10 @@ export class VectorSourceEvent extends Event {
|
||||
* Setting this to `false` (e.g. for sources with polygons that represent administrative
|
||||
* boundaries or TopoJSON sources) allows the renderer to optimise fill and
|
||||
* stroke operations.
|
||||
* @property {module:ol/source/Vector~LoadingStrategy} [strategy] The loading strategy to use.
|
||||
* @property {LoadingStrategy} [strategy] The loading strategy to use.
|
||||
* By default an {@link module:ol/loadingstrategy~all}
|
||||
* strategy is used, a one-off strategy which loads all features at once.
|
||||
* @property {string|module:ol/featureloader~FeatureUrlFunction} [url]
|
||||
* @property {string|import("../featureloader.js").FeatureUrlFunction} [url]
|
||||
* Setting this option instructs the source to load features using an XHR loader
|
||||
* (see {@link module:ol/featureloader~xhr}). Use a `string` and an
|
||||
* {@link module:ol/loadingstrategy~all} for a one-off download of all features from
|
||||
@@ -159,7 +159,7 @@ export class VectorSourceEvent extends Event {
|
||||
*/
|
||||
class VectorSource extends Source {
|
||||
/**
|
||||
* @param {module:ol/source/Vector~Options=} opt_options Vector source options.
|
||||
* @param {Options=} opt_options Vector source options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
|
||||
@@ -174,13 +174,13 @@ class VectorSource extends Source {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/featureloader~FeatureLoader}
|
||||
* @type {import("../featureloader.js").FeatureLoader}
|
||||
*/
|
||||
this.loader_ = VOID;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/format/Feature|undefined}
|
||||
* @type {import("../format/Feature.js").default|undefined}
|
||||
*/
|
||||
this.format_ = options.format;
|
||||
|
||||
@@ -192,7 +192,7 @@ class VectorSource extends Source {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {string|module:ol/featureloader~FeatureUrlFunction|undefined}
|
||||
* @type {string|import("../featureloader.js").FeatureUrlFunction|undefined}
|
||||
*/
|
||||
this.url_ = options.url;
|
||||
|
||||
@@ -201,12 +201,12 @@ class VectorSource extends Source {
|
||||
} else if (this.url_ !== undefined) {
|
||||
assert(this.format_, 7); // `format` must be set when `url` is set
|
||||
// create a XHR feature loader for "url" and "format"
|
||||
this.loader_ = xhr(this.url_, /** @type {module:ol/format/Feature} */ (this.format_));
|
||||
this.loader_ = xhr(this.url_, /** @type {import("../format/Feature.js").default} */ (this.format_));
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/source/Vector~LoadingStrategy}
|
||||
* @type {LoadingStrategy}
|
||||
*/
|
||||
this.strategy_ = options.strategy !== undefined ? options.strategy : allStrategy;
|
||||
|
||||
@@ -215,45 +215,45 @@ class VectorSource extends Source {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/structs/RBush<module:ol/Feature>}
|
||||
* @type {import("../structs/RBush.js").default<import("../Feature.js").default>}
|
||||
*/
|
||||
this.featuresRtree_ = useSpatialIndex ? new RBush() : null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/structs/RBush<{extent: module:ol/extent~Extent}>}
|
||||
* @type {import("../structs/RBush.js").default<{extent: import("../extent.js").Extent}>}
|
||||
*/
|
||||
this.loadedExtentsRtree_ = new RBush();
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {!Object<string, module:ol/Feature>}
|
||||
* @type {!Object<string, import("../Feature.js").default>}
|
||||
*/
|
||||
this.nullGeometryFeatures_ = {};
|
||||
|
||||
/**
|
||||
* A lookup of features by id (the return from feature.getId()).
|
||||
* @private
|
||||
* @type {!Object<string, module:ol/Feature>}
|
||||
* @type {!Object<string, import("../Feature.js").default>}
|
||||
*/
|
||||
this.idIndex_ = {};
|
||||
|
||||
/**
|
||||
* A lookup of features without id (keyed by getUid(feature)).
|
||||
* @private
|
||||
* @type {!Object<string, module:ol/Feature>}
|
||||
* @type {!Object<string, import("../Feature.js").default>}
|
||||
*/
|
||||
this.undefIdIndex_ = {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Object<string, Array<module:ol/events~EventsKey>>}
|
||||
* @type {Object<string, Array<import("../events.js").EventsKey>>}
|
||||
*/
|
||||
this.featureChangeKeys_ = {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/Collection<module:ol/Feature>}
|
||||
* @type {import("../Collection.js").default<import("../Feature.js").default>}
|
||||
*/
|
||||
this.featuresCollection_ = null;
|
||||
|
||||
@@ -282,7 +282,7 @@ class VectorSource extends Source {
|
||||
* instead. A feature will not be added to the source if feature with
|
||||
* the same id is already there. The reason for this behavior is to avoid
|
||||
* feature duplication when using bbox or tile loading strategies.
|
||||
* @param {module:ol/Feature} feature Feature to add.
|
||||
* @param {import("../Feature.js").default} feature Feature to add.
|
||||
* @api
|
||||
*/
|
||||
addFeature(feature) {
|
||||
@@ -293,7 +293,7 @@ class VectorSource extends Source {
|
||||
|
||||
/**
|
||||
* Add a feature without firing a `change` event.
|
||||
* @param {module:ol/Feature} feature Feature.
|
||||
* @param {import("../Feature.js").default} feature Feature.
|
||||
* @protected
|
||||
*/
|
||||
addFeatureInternal(feature) {
|
||||
@@ -322,7 +322,7 @@ class VectorSource extends Source {
|
||||
|
||||
/**
|
||||
* @param {string} featureKey Unique identifier for the feature.
|
||||
* @param {module:ol/Feature} feature The feature.
|
||||
* @param {import("../Feature.js").default} feature The feature.
|
||||
* @private
|
||||
*/
|
||||
setupChangeEvents_(featureKey, feature) {
|
||||
@@ -337,7 +337,7 @@ class VectorSource extends Source {
|
||||
|
||||
/**
|
||||
* @param {string} featureKey Unique identifier for the feature.
|
||||
* @param {module:ol/Feature} feature The feature.
|
||||
* @param {import("../Feature.js").default} feature The feature.
|
||||
* @return {boolean} The feature is "valid", in the sense that it is also a
|
||||
* candidate for insertion into the Rtree.
|
||||
* @private
|
||||
@@ -362,7 +362,7 @@ class VectorSource extends Source {
|
||||
|
||||
/**
|
||||
* Add a batch of features to the source.
|
||||
* @param {Array<module:ol/Feature>} features Features to add.
|
||||
* @param {Array<import("../Feature.js").default>} features Features to add.
|
||||
* @api
|
||||
*/
|
||||
addFeatures(features) {
|
||||
@@ -373,7 +373,7 @@ class VectorSource extends Source {
|
||||
|
||||
/**
|
||||
* Add features without firing a `change` event.
|
||||
* @param {Array<module:ol/Feature>} features Features.
|
||||
* @param {Array<import("../Feature.js").default>} features Features.
|
||||
* @protected
|
||||
*/
|
||||
addFeaturesInternal(features) {
|
||||
@@ -414,7 +414,7 @@ class VectorSource extends Source {
|
||||
|
||||
|
||||
/**
|
||||
* @param {!module:ol/Collection<module:ol/Feature>} collection Collection.
|
||||
* @param {!import("../Collection.js").default<import("../Feature.js").default>} collection Collection.
|
||||
* @private
|
||||
*/
|
||||
bindFeaturesCollection_(collection) {
|
||||
@@ -439,7 +439,7 @@ class VectorSource extends Source {
|
||||
function(evt) {
|
||||
if (!modifyingCollection) {
|
||||
modifyingCollection = true;
|
||||
this.addFeature(/** @type {module:ol/Feature} */ (evt.element));
|
||||
this.addFeature(/** @type {import("../Feature.js").default} */ (evt.element));
|
||||
modifyingCollection = false;
|
||||
}
|
||||
}, this);
|
||||
@@ -447,7 +447,7 @@ class VectorSource extends Source {
|
||||
function(evt) {
|
||||
if (!modifyingCollection) {
|
||||
modifyingCollection = true;
|
||||
this.removeFeature(/** @type {module:ol/Feature} */ (evt.element));
|
||||
this.removeFeature(/** @type {import("../Feature.js").default} */ (evt.element));
|
||||
modifyingCollection = false;
|
||||
}
|
||||
}, this);
|
||||
@@ -501,7 +501,7 @@ class VectorSource extends Source {
|
||||
* stop and the function will return the same value.
|
||||
* Note: this function only iterate through the feature that have a defined geometry.
|
||||
*
|
||||
* @param {function(module:ol/Feature): T} callback Called with each feature
|
||||
* @param {function(import("../Feature.js").default): T} callback Called with each feature
|
||||
* on the source. Return a truthy value to stop iteration.
|
||||
* @return {T|undefined} The return value from the last call to the callback.
|
||||
* @template T
|
||||
@@ -522,8 +522,8 @@ class VectorSource extends Source {
|
||||
* a "truthy" value, iteration will stop and the function will return the same
|
||||
* value.
|
||||
*
|
||||
* @param {module:ol/coordinate~Coordinate} coordinate Coordinate.
|
||||
* @param {function(module:ol/Feature): T} callback Called with each feature
|
||||
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
|
||||
* @param {function(import("../Feature.js").default): T} callback Called with each feature
|
||||
* whose goemetry contains the provided coordinate.
|
||||
* @return {T|undefined} The return value from the last call to the callback.
|
||||
* @template T
|
||||
@@ -553,8 +553,8 @@ class VectorSource extends Source {
|
||||
* When `useSpatialIndex` is set to false, this method will loop through all
|
||||
* features, equivalent to {@link module:ol/source/Vector~VectorSource#forEachFeature #forEachFeature()}.
|
||||
*
|
||||
* @param {module:ol/extent~Extent} extent Extent.
|
||||
* @param {function(module:ol/Feature): T} callback Called with each feature
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @param {function(import("../Feature.js").default): T} callback Called with each feature
|
||||
* whose bounding box intersects the provided extent.
|
||||
* @return {T|undefined} The return value from the last call to the callback.
|
||||
* @template T
|
||||
@@ -577,8 +577,8 @@ class VectorSource extends Source {
|
||||
* If you only want to test for bounding box intersection, call the
|
||||
* {@link module:ol/source/Vector~VectorSource#forEachFeatureInExtent #forEachFeatureInExtent()} method instead.
|
||||
*
|
||||
* @param {module:ol/extent~Extent} extent Extent.
|
||||
* @param {function(module:ol/Feature): T} callback Called with each feature
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @param {function(import("../Feature.js").default): T} callback Called with each feature
|
||||
* whose geometry intersects the provided extent.
|
||||
* @return {T|undefined} The return value from the last call to the callback.
|
||||
* @template T
|
||||
@@ -587,7 +587,7 @@ class VectorSource extends Source {
|
||||
forEachFeatureIntersectingExtent(extent, callback) {
|
||||
return this.forEachFeatureInExtent(extent,
|
||||
/**
|
||||
* @param {module:ol/Feature} feature Feature.
|
||||
* @param {import("../Feature.js").default} feature Feature.
|
||||
* @return {T|undefined} The return value from the last call to the callback.
|
||||
* @template T
|
||||
*/
|
||||
@@ -607,7 +607,7 @@ class VectorSource extends Source {
|
||||
* Get the features collection associated with this source. Will be `null`
|
||||
* unless the source was configured with `useSpatialIndex` set to `false`, or
|
||||
* with an {@link module:ol/Collection} as `features`.
|
||||
* @return {module:ol/Collection<module:ol/Feature>} The collection of features.
|
||||
* @return {import("../Collection.js").default<import("../Feature.js").default>} The collection of features.
|
||||
* @api
|
||||
*/
|
||||
getFeaturesCollection() {
|
||||
@@ -617,7 +617,7 @@ class VectorSource extends Source {
|
||||
|
||||
/**
|
||||
* Get all features on the source in random order.
|
||||
* @return {Array<module:ol/Feature>} Features.
|
||||
* @return {Array<import("../Feature.js").default>} Features.
|
||||
* @api
|
||||
*/
|
||||
getFeatures() {
|
||||
@@ -631,15 +631,15 @@ class VectorSource extends Source {
|
||||
}
|
||||
}
|
||||
return (
|
||||
/** @type {Array<module:ol/Feature>} */ (features)
|
||||
/** @type {Array<import("../Feature.js").default>} */ (features)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all features whose geometry intersects the provided coordinate.
|
||||
* @param {module:ol/coordinate~Coordinate} coordinate Coordinate.
|
||||
* @return {Array<module:ol/Feature>} Features.
|
||||
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
|
||||
* @return {Array<import("../Feature.js").default>} Features.
|
||||
* @api
|
||||
*/
|
||||
getFeaturesAtCoordinate(coordinate) {
|
||||
@@ -658,8 +658,8 @@ class VectorSource extends Source {
|
||||
*
|
||||
* This method is not available when the source is configured with
|
||||
* `useSpatialIndex` set to `false`.
|
||||
* @param {module:ol/extent~Extent} extent Extent.
|
||||
* @return {Array<module:ol/Feature>} Features.
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @return {Array<import("../Feature.js").default>} Features.
|
||||
* @api
|
||||
*/
|
||||
getFeaturesInExtent(extent) {
|
||||
@@ -672,11 +672,11 @@ class VectorSource extends Source {
|
||||
*
|
||||
* This method is not available when the source is configured with
|
||||
* `useSpatialIndex` set to `false`.
|
||||
* @param {module:ol/coordinate~Coordinate} coordinate Coordinate.
|
||||
* @param {function(module:ol/Feature):boolean=} opt_filter Feature filter function.
|
||||
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
|
||||
* @param {function(import("../Feature.js").default):boolean=} opt_filter Feature filter function.
|
||||
* The filter function will receive one argument, the {@link module:ol/Feature feature}
|
||||
* and it should return a boolean value. By default, no filtering is made.
|
||||
* @return {module:ol/Feature} Closest feature.
|
||||
* @return {import("../Feature.js").default} Closest feature.
|
||||
* @api
|
||||
*/
|
||||
getClosestFeatureToCoordinate(coordinate, opt_filter) {
|
||||
@@ -696,7 +696,7 @@ class VectorSource extends Source {
|
||||
const filter = opt_filter ? opt_filter : TRUE;
|
||||
this.featuresRtree_.forEachInExtent(extent,
|
||||
/**
|
||||
* @param {module:ol/Feature} feature Feature.
|
||||
* @param {import("../Feature.js").default} feature Feature.
|
||||
*/
|
||||
function(feature) {
|
||||
if (filter(feature)) {
|
||||
@@ -727,9 +727,9 @@ class VectorSource extends Source {
|
||||
*
|
||||
* This method is not available when the source is configured with
|
||||
* `useSpatialIndex` set to `false`.
|
||||
* @param {module:ol/extent~Extent=} opt_extent Destination extent. If provided, no new extent
|
||||
* @param {import("../extent.js").Extent=} opt_extent Destination extent. If provided, no new extent
|
||||
* will be created. Instead, that extent's coordinates will be overwritten.
|
||||
* @return {module:ol/extent~Extent} Extent.
|
||||
* @return {import("../extent.js").Extent} Extent.
|
||||
* @api
|
||||
*/
|
||||
getExtent(opt_extent) {
|
||||
@@ -743,7 +743,7 @@ class VectorSource extends Source {
|
||||
* `source.getFeatureById(2)` will return a feature with id `'2'` or `2`.
|
||||
*
|
||||
* @param {string|number} id Feature identifier.
|
||||
* @return {module:ol/Feature} The feature (or `null` if not found).
|
||||
* @return {import("../Feature.js").default} The feature (or `null` if not found).
|
||||
* @api
|
||||
*/
|
||||
getFeatureById(id) {
|
||||
@@ -755,7 +755,7 @@ class VectorSource extends Source {
|
||||
/**
|
||||
* Get the format associated with this source.
|
||||
*
|
||||
* @return {module:ol/format/Feature|undefined} The feature format.
|
||||
* @return {import("../format/Feature.js").default|undefined} The feature format.
|
||||
* @api
|
||||
*/
|
||||
getFormat() {
|
||||
@@ -780,7 +780,7 @@ class VectorSource extends Source {
|
||||
/**
|
||||
* Get the url associated with this source.
|
||||
*
|
||||
* @return {string|module:ol/featureloader~FeatureUrlFunction|undefined} The url.
|
||||
* @return {string|import("../featureloader.js").FeatureUrlFunction|undefined} The url.
|
||||
* @api
|
||||
*/
|
||||
getUrl() {
|
||||
@@ -789,11 +789,11 @@ class VectorSource extends Source {
|
||||
|
||||
|
||||
/**
|
||||
* @param {module:ol/events/Event} event Event.
|
||||
* @param {import("../events/Event.js").default} event Event.
|
||||
* @private
|
||||
*/
|
||||
handleFeatureChange_(event) {
|
||||
const feature = /** @type {module:ol/Feature} */ (event.target);
|
||||
const feature = /** @type {import("../Feature.js").default} */ (event.target);
|
||||
const featureKey = getUid(feature).toString();
|
||||
const geometry = feature.getGeometry();
|
||||
if (!geometry) {
|
||||
@@ -841,7 +841,7 @@ class VectorSource extends Source {
|
||||
|
||||
/**
|
||||
* Returns true if the feature is contained within the source.
|
||||
* @param {module:ol/Feature} feature Feature.
|
||||
* @param {import("../Feature.js").default} feature Feature.
|
||||
* @return {boolean} Has feature.
|
||||
* @api
|
||||
*/
|
||||
@@ -864,9 +864,9 @@ class VectorSource extends Source {
|
||||
|
||||
|
||||
/**
|
||||
* @param {module:ol/extent~Extent} extent Extent.
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @param {number} resolution Resolution.
|
||||
* @param {module:ol/proj/Projection} projection Projection.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
*/
|
||||
loadFeatures(extent, resolution, projection) {
|
||||
const loadedExtentsRtree = this.loadedExtentsRtree_;
|
||||
@@ -876,7 +876,7 @@ class VectorSource extends Source {
|
||||
const extentToLoad = extentsToLoad[i];
|
||||
const alreadyLoaded = loadedExtentsRtree.forEachInExtent(extentToLoad,
|
||||
/**
|
||||
* @param {{extent: module:ol/extent~Extent}} object Object.
|
||||
* @param {{extent: import("../extent.js").Extent}} object Object.
|
||||
* @return {boolean} Contains.
|
||||
*/
|
||||
function(object) {
|
||||
@@ -893,7 +893,7 @@ class VectorSource extends Source {
|
||||
|
||||
/**
|
||||
* Remove an extent from the list of loaded extents.
|
||||
* @param {module:ol/extent~Extent} extent Extent.
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @api
|
||||
*/
|
||||
removeLoadedExtent(extent) {
|
||||
@@ -915,7 +915,7 @@ class VectorSource extends Source {
|
||||
* Remove a single feature from the source. If you want to remove all features
|
||||
* at once, use the {@link module:ol/source/Vector~VectorSource#clear #clear()} method
|
||||
* instead.
|
||||
* @param {module:ol/Feature} feature Feature to remove.
|
||||
* @param {import("../Feature.js").default} feature Feature to remove.
|
||||
* @api
|
||||
*/
|
||||
removeFeature(feature) {
|
||||
@@ -934,7 +934,7 @@ class VectorSource extends Source {
|
||||
|
||||
/**
|
||||
* Remove feature without firing a `change` event.
|
||||
* @param {module:ol/Feature} feature Feature.
|
||||
* @param {import("../Feature.js").default} feature Feature.
|
||||
* @protected
|
||||
*/
|
||||
removeFeatureInternal(feature) {
|
||||
@@ -955,7 +955,7 @@ class VectorSource extends Source {
|
||||
/**
|
||||
* Remove a feature from the id index. Called internally when the feature id
|
||||
* may have changed.
|
||||
* @param {module:ol/Feature} feature The feature.
|
||||
* @param {import("../Feature.js").default} feature The feature.
|
||||
* @return {boolean} Removed the feature from the index.
|
||||
* @private
|
||||
*/
|
||||
@@ -975,7 +975,7 @@ class VectorSource extends Source {
|
||||
/**
|
||||
* Set the new loader of the source. The next loadFeatures call will use the
|
||||
* new loader.
|
||||
* @param {module:ol/featureloader~FeatureLoader} loader The loader to set.
|
||||
* @param {import("../featureloader.js").FeatureLoader} loader The loader to set.
|
||||
* @api
|
||||
*/
|
||||
setLoader(loader) {
|
||||
|
||||
@@ -12,23 +12,23 @@ import {createXYZ, extentFromProjection, createForProjection} from '../tilegrid.
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {module:ol/source/Source~AttributionLike} [attributions] Attributions.
|
||||
* @property {import("./Source.js").AttributionLike} [attributions] Attributions.
|
||||
* @property {number} [cacheSize=128] Cache size.
|
||||
* @property {module:ol/extent~Extent} [extent]
|
||||
* @property {module:ol/format/Feature} [format] Feature format for tiles. Used and required by the default.
|
||||
* @property {import("../extent.js").Extent} [extent]
|
||||
* @property {import("../format/Feature.js").default} [format] Feature format for tiles. Used and required by the default.
|
||||
* @property {boolean} [overlaps=true] This source may have overlapping geometries. Setting this
|
||||
* to `false` (e.g. for sources with polygons that represent administrative
|
||||
* boundaries or TopoJSON sources) allows the renderer to optimise fill and
|
||||
* stroke operations.
|
||||
* @property {module:ol/proj~ProjectionLike} projection Projection.
|
||||
* @property {module:ol/source/State} [state] Source state.
|
||||
* @property {module:ol/VectorTile~TileClass} [tileClass] Class used to instantiate image tiles.
|
||||
* @property {import("../proj.js").ProjectionLike} projection Projection.
|
||||
* @property {import("./State.js").default} [state] Source state.
|
||||
* @property {import("../VectorTile.js").TileClass} [tileClass] Class used to instantiate image tiles.
|
||||
* Default is {@link module:ol/VectorTile}.
|
||||
* @property {number} [maxZoom=22] Optional max zoom level.
|
||||
* @property {number} [minZoom] Optional min zoom level.
|
||||
* @property {number|module:ol/size~Size} [tileSize=512] Optional tile size.
|
||||
* @property {module:ol/tilegrid/TileGrid} [tileGrid] Tile grid.
|
||||
* @property {module:ol/Tile~LoadFunction} [tileLoadFunction]
|
||||
* @property {number|import("../size.js").Size} [tileSize=512] Optional tile size.
|
||||
* @property {import("../tilegrid/TileGrid.js").default} [tileGrid] Tile grid.
|
||||
* @property {import("../Tile.js").LoadFunction} [tileLoadFunction]
|
||||
* Optional function to load a tile given a URL. Could look like this:
|
||||
* ```js
|
||||
* function(tile, url) {
|
||||
@@ -45,7 +45,7 @@ import {createXYZ, extentFromProjection, createForProjection} from '../tilegrid.
|
||||
* }
|
||||
* });
|
||||
* ```
|
||||
* @property {module:ol/Tile~UrlFunction} [tileUrlFunction] Optional function to get tile URL given a tile coordinate and the projection.
|
||||
* @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.
|
||||
@@ -69,12 +69,12 @@ import {createXYZ, extentFromProjection, createForProjection} from '../tilegrid.
|
||||
* {@link module:ol/source/Vector} for vector sources that are suitable for feature
|
||||
* editing.
|
||||
*
|
||||
* @fires module:ol/source/Tile~TileSourceEvent
|
||||
* @fires import("./Tile.js").TileSourceEvent
|
||||
* @api
|
||||
*/
|
||||
class VectorTile extends UrlTile {
|
||||
/**
|
||||
* @param {!module:ol/source/VectorTile~Options} options Vector tile options.
|
||||
* @param {!Options} options Vector tile options.
|
||||
*/
|
||||
constructor(options) {
|
||||
const projection = options.projection || 'EPSG:3857';
|
||||
@@ -106,13 +106,13 @@ class VectorTile extends UrlTile {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/format/Feature}
|
||||
* @type {import("../format/Feature.js").default}
|
||||
*/
|
||||
this.format_ = options.format ? options.format : null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Object<string, module:ol/VectorTile>}
|
||||
* @type {Object<string, import("../VectorTile.js").default>}
|
||||
*/
|
||||
this.sourceTiles_ = {};
|
||||
|
||||
@@ -124,14 +124,14 @@ class VectorTile extends UrlTile {
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {function(new: module:ol/VectorTile, module:ol/tilecoord~TileCoord, module:ol/TileState, string,
|
||||
* module:ol/format/Feature, module:ol/Tile~LoadFunction)}
|
||||
* @type {function(new: import("../VectorTile.js").default, import("../tilecoord.js").TileCoord, import("../TileState.js").default, string,
|
||||
* import("../format/Feature.js").default, import("../Tile.js").LoadFunction)}
|
||||
*/
|
||||
this.tileClass = options.tileClass ? options.tileClass : Tile;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Object<string, module:ol/tilegrid/TileGrid>}
|
||||
* @type {Object<string, import("../tilegrid/TileGrid.js").default>}
|
||||
*/
|
||||
this.tileGrids_ = {};
|
||||
|
||||
@@ -160,7 +160,7 @@ class VectorTile extends UrlTile {
|
||||
const tileCoordKey = getKeyZXY(z, x, y);
|
||||
if (this.tileCache.containsKey(tileCoordKey)) {
|
||||
return (
|
||||
/** @type {!module:ol/Tile} */ (this.tileCache.get(tileCoordKey))
|
||||
/** @type {!import("../Tile.js").default} */ (this.tileCache.get(tileCoordKey))
|
||||
);
|
||||
} else {
|
||||
const tileCoord = [z, x, y];
|
||||
|
||||
@@ -14,20 +14,20 @@ import {appendParams} from '../uri.js';
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {module:ol/source/Source~AttributionLike} [attributions] Attributions.
|
||||
* @property {import("./Source.js").AttributionLike} [attributions] Attributions.
|
||||
* @property {number} [cacheSize=2048] Cache size.
|
||||
* @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
|
||||
* you must provide a `crossOrigin` value if you are using the WebGL renderer or 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 {module:ol/tilegrid/WMTS} tileGrid Tile grid.
|
||||
* @property {module:ol/proj~ProjectionLike} projection Projection.
|
||||
* @property {import("../tilegrid/WMTS.js").default} tileGrid Tile grid.
|
||||
* @property {import("../proj.js").ProjectionLike} projection Projection.
|
||||
* @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
|
||||
* Higher values can increase reprojection performance, but decrease precision.
|
||||
* @property {module:ol/source/WMTSRequestEncoding|string} [requestEncoding='KVP'] Request encoding.
|
||||
* @property {import("./WMTSRequestEncoding.js").default|string} [requestEncoding='KVP'] Request encoding.
|
||||
* @property {string} layer Layer name as advertised in the WMTS capabilities.
|
||||
* @property {string} style Style name as advertised in the WMTS capabilities.
|
||||
* @property {module:ol/ImageTile~TileClass} [tileClass] Class used to instantiate image tiles. Default is {@link module:ol/ImageTile~ImageTile}.
|
||||
* @property {import("../ImageTile.js").TileClass} [tileClass] Class used to instantiate image tiles. Default is {@link module:ol/ImageTile~ImageTile}.
|
||||
* @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`
|
||||
@@ -42,7 +42,7 @@ import {appendParams} from '../uri.js';
|
||||
* template. For KVP encoding, it is normal URL. A `{?-?}` template pattern,
|
||||
* for example `subdomain{a-f}.domain.com`, may be used instead of defining
|
||||
* each one separately in the `urls` option.
|
||||
* @property {module:ol/Tile~LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is
|
||||
* @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;
|
||||
@@ -63,14 +63,14 @@ import {appendParams} from '../uri.js';
|
||||
*/
|
||||
class WMTS extends TileImage {
|
||||
/**
|
||||
* @param {module:ol/source/WMTS~Options=} options WMTS options.
|
||||
* @param {Options=} options WMTS options.
|
||||
*/
|
||||
constructor(options) {
|
||||
|
||||
// TODO: add support for TileMatrixLimits
|
||||
|
||||
const requestEncoding = options.requestEncoding !== undefined ?
|
||||
/** @type {module:ol/source/WMTSRequestEncoding} */ (options.requestEncoding) :
|
||||
/** @type {import("./WMTSRequestEncoding.js").default} */ (options.requestEncoding) :
|
||||
WMTSRequestEncoding.KVP;
|
||||
|
||||
// FIXME: should we create a default tileGrid?
|
||||
@@ -139,7 +139,7 @@ class WMTS extends TileImage {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/source/WMTSRequestEncoding}
|
||||
* @type {import("./WMTSRequestEncoding.js").default}
|
||||
*/
|
||||
this.requestEncoding_ = requestEncoding;
|
||||
|
||||
@@ -208,7 +208,7 @@ class WMTS extends TileImage {
|
||||
|
||||
/**
|
||||
* Return the request encoding, either "KVP" or "REST".
|
||||
* @return {module:ol/source/WMTSRequestEncoding} Request encoding.
|
||||
* @return {import("./WMTSRequestEncoding.js").default} Request encoding.
|
||||
* @api
|
||||
*/
|
||||
getRequestEncoding() {
|
||||
@@ -285,7 +285,7 @@ export default WMTS;
|
||||
* - format - {string} Image format for the layer. Default is the first
|
||||
* format returned in the GetCapabilities response.
|
||||
* - crossOrigin - {string|null|undefined} Cross origin. Default is `undefined`.
|
||||
* @return {?module:ol/source/WMTS~Options} WMTS source options object or `null` if the layer was not found.
|
||||
* @return {?Options} WMTS source options object or `null` if the layer was not found.
|
||||
* @api
|
||||
*/
|
||||
export function optionsFromCapabilities(wmtsCap, config) {
|
||||
@@ -459,8 +459,8 @@ export function optionsFromCapabilities(wmtsCap, config) {
|
||||
|
||||
/**
|
||||
* @param {string} template Template.
|
||||
* @return {module:ol/Tile~UrlFunction} Tile URL function.
|
||||
* @this {module:ol/source/WMTS}
|
||||
* @return {import("../Tile.js").UrlFunction} Tile URL function.
|
||||
* @this {import("./WMTS.js").default}
|
||||
*/
|
||||
function createFromWMTSTemplate(template) {
|
||||
const requestEncoding = this.requestEncoding_;
|
||||
@@ -497,9 +497,9 @@ function createFromWMTSTemplate(template) {
|
||||
|
||||
return (
|
||||
/**
|
||||
* @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate.
|
||||
* @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {module:ol/proj/Projection} projection Projection.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
* @return {string|undefined} Tile URL.
|
||||
*/
|
||||
function(tileCoord, pixelRatio, projection) {
|
||||
|
||||
@@ -7,20 +7,20 @@ import {createXYZ, extentFromProjection} from '../tilegrid.js';
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {module:ol/source/Source~AttributionLike} [attributions] Attributions.
|
||||
* @property {import("./Source.js").AttributionLike} [attributions] Attributions.
|
||||
* @property {number} [cacheSize=2048] Cache size.
|
||||
* @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
|
||||
* you must provide a `crossOrigin` value if you are using the WebGL renderer or 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 {module:ol/proj~ProjectionLike} [projection='EPSG:3857'] Projection.
|
||||
* @property {import("../proj.js").ProjectionLike} [projection='EPSG:3857'] Projection.
|
||||
* @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
|
||||
* Higher values can increase reprojection performance, but decrease precision.
|
||||
* @property {number} [maxZoom=18] Optional max zoom level.
|
||||
* @property {number} [minZoom=0] Optional min zoom level.
|
||||
* @property {module:ol/tilegrid/TileGrid} [tileGrid] Tile grid.
|
||||
* @property {module:ol/Tile~LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is
|
||||
* @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;
|
||||
@@ -30,8 +30,8 @@ import {createXYZ, extentFromProjection} from '../tilegrid.js';
|
||||
* 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 {number|module:ol/size~Size} [tileSize=[256, 256]] The tile size used by the tile service.
|
||||
* @property {module:ol/Tile~UrlFunction} [tileUrlFunction] Optional function to get
|
||||
* @property {number|import("../size.js").Size} [tileSize=[256, 256]] The tile size used by the tile service.
|
||||
* @property {import("../Tile.js").UrlFunction} [tileUrlFunction] Optional function to get
|
||||
* tile URL given a tile coordinate and the projection.
|
||||
* Required if url or urls are not provided.
|
||||
* @property {string} [url] URL template. Must include `{x}`, `{y}` or `{-y}`,
|
||||
@@ -64,7 +64,7 @@ import {createXYZ, extentFromProjection} from '../tilegrid.js';
|
||||
*/
|
||||
class XYZ extends TileImage {
|
||||
/**
|
||||
* @param {module:ol/source/XYZ~Options=} opt_options XYZ options.
|
||||
* @param {Options=} opt_options XYZ options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
const options = opt_options || {};
|
||||
|
||||
@@ -26,13 +26,13 @@ const TierSizeCalculation = {
|
||||
export class CustomTile extends ImageTile {
|
||||
|
||||
/**
|
||||
* @param {module:ol/tilegrid/TileGrid} tileGrid TileGrid that the tile belongs to.
|
||||
* @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate.
|
||||
* @param {module:ol/TileState} state State.
|
||||
* @param {import("../tilegrid/TileGrid.js").default} tileGrid TileGrid that the tile belongs to.
|
||||
* @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
||||
* @param {import("../TileState.js").default} state State.
|
||||
* @param {string} src Image source URI.
|
||||
* @param {?string} crossOrigin Cross origin.
|
||||
* @param {module:ol/Tile~LoadFunction} tileLoadFunction Tile load function.
|
||||
* @param {module:ol/Tile~Options=} opt_options Tile options.
|
||||
* @param {import("../Tile.js").LoadFunction} tileLoadFunction Tile load function.
|
||||
* @param {import("../Tile.js").Options=} opt_options Tile options.
|
||||
*/
|
||||
constructor(tileGrid, tileCoord, state, src, crossOrigin, tileLoadFunction, opt_options) {
|
||||
|
||||
@@ -46,7 +46,7 @@ export class CustomTile extends ImageTile {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/size~Size}
|
||||
* @type {import("../size.js").Size}
|
||||
*/
|
||||
this.tileSize_ = toSize(tileGrid.getTileSize(tileCoord[0]));
|
||||
|
||||
@@ -81,13 +81,13 @@ export class CustomTile extends ImageTile {
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {module:ol/source/Source~AttributionLike} [attributions] Attributions.
|
||||
* @property {import("./Source.js").AttributionLike} [attributions] Attributions.
|
||||
* @property {number} [cacheSize=2048] Cache size.
|
||||
* @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
|
||||
* you must provide a `crossOrigin` value if you are using the WebGL renderer or 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 {module:ol/proj~ProjectionLike} [projection] Projection.
|
||||
* @property {import("../proj.js").ProjectionLike} [projection] Projection.
|
||||
* @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
|
||||
* Higher values can increase reprojection performance, but decrease precision.
|
||||
* @property {string} [url] URL template or base URL of the Zoomify service.
|
||||
@@ -102,8 +102,8 @@ export class CustomTile extends ImageTile {
|
||||
* A `{?-?}` template pattern, for example `subdomain{a-f}.domain.com`, may be
|
||||
* used instead of defining each one separately in the `urls` option.
|
||||
* @property {string} [tierSizeCalculation] Tier size calculation method: `default` or `truncated`.
|
||||
* @property {module:ol/size~Size} [size] Size of the image.
|
||||
* @property {module:ol/extent~Extent} [extent] Extent for the TileGrid that is created.
|
||||
* @property {import("../size.js").Size} [size] Size of the image.
|
||||
* @property {import("../extent.js").Extent} [extent] Extent for the TileGrid that is created.
|
||||
* Default sets the TileGrid in the
|
||||
* fourth quadrant, meaning extent is `[0, -height, width, 0]`. To change the
|
||||
* extent to the first quadrant (the default for OpenLayers 2) set the extent
|
||||
@@ -123,7 +123,7 @@ export class CustomTile extends ImageTile {
|
||||
class Zoomify extends TileImage {
|
||||
|
||||
/**
|
||||
* @param {module:ol/source/Zoomify~Options=} opt_options Options.
|
||||
* @param {Options=} opt_options Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
|
||||
@@ -197,15 +197,15 @@ class Zoomify extends TileImage {
|
||||
|
||||
/**
|
||||
* @param {string} template Template.
|
||||
* @return {module:ol/Tile~UrlFunction} Tile URL function.
|
||||
* @return {import("../Tile.js").UrlFunction} Tile URL function.
|
||||
*/
|
||||
function createFromTemplate(template) {
|
||||
|
||||
return (
|
||||
/**
|
||||
* @param {module:ol/tilecoord~TileCoord} tileCoord Tile Coordinate.
|
||||
* @param {import("../tilecoord.js").TileCoord} tileCoord Tile Coordinate.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {module:ol/proj/Projection} projection Projection.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
* @return {string|undefined} Tile URL.
|
||||
*/
|
||||
function(tileCoord, pixelRatio, projection) {
|
||||
|
||||
Reference in New Issue
Block a user