diff --git a/externs/olx.js b/externs/olx.js index 32e9141d0f..29caa4202a 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -49,2455 +49,6 @@ olx.render.State.prototype.resolution; olx.render.State.prototype.rotation; -/** - * @typedef {{cacheSize: (number|undefined), - * culture: (string|undefined), - * hidpi: (boolean|undefined), - * key: string, - * imagerySet: string, - * maxZoom: (number|undefined), - * reprojectionErrorThreshold: (number|undefined), - * tileLoadFunction: (ol.TileLoadFunctionType|undefined), - * wrapX: (boolean|undefined), - * transition: (number|undefined)}} - */ -olx.source.BingMapsOptions; - - -/** - * Cache size. Default is `2048`. - * @type {number|undefined} - * @api - */ -olx.source.BingMapsOptions.prototype.cacheSize; - - -/** - * If `true` hidpi tiles will be requested. Default is `false`. - * @type {boolean|undefined} - * @api - */ -olx.source.BingMapsOptions.prototype.hidpi; - - -/** - * Culture code. Default is `en-us`. - * @type {string|undefined} - * @api - */ -olx.source.BingMapsOptions.prototype.culture; - - -/** - * Bing Maps API key. Get yours at http://www.bingmapsportal.com/. - * @type {string} - * @api - */ -olx.source.BingMapsOptions.prototype.key; - - -/** - * Type of imagery. - * @type {string} - * @api - */ -olx.source.BingMapsOptions.prototype.imagerySet; - - -/** - * Max zoom. Default is what's advertized by the BingMaps service (`21` - * currently). - * @type {number|undefined} - * @api - */ -olx.source.BingMapsOptions.prototype.maxZoom; - - -/** - * Maximum allowed reprojection error (in pixels). Default is `0.5`. - * Higher values can increase reprojection performance, but decrease precision. - * @type {number|undefined} - * @api - */ -olx.source.BingMapsOptions.prototype.reprojectionErrorThreshold; - - -/** - * Optional function to load a tile given a URL. The default is - * ```js - * function(imageTile, src) { - * imageTile.getImage().src = src; - * }; - * ``` - * @type {ol.TileLoadFunctionType|undefined} - * @api - */ -olx.source.BingMapsOptions.prototype.tileLoadFunction; - - -/** - * Whether to wrap the world horizontally. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.source.BingMapsOptions.prototype.wrapX; - - -/** - * Duration of the opacity transition for rendering. To disable the opacity - * transition, pass `transition: 0`. - * @type {number|undefined} - * @api - */ -olx.source.BingMapsOptions.prototype.transition; - - -/** - * @typedef {{attributions: (ol.AttributionLike|undefined), - * distance: (number|undefined), - * extent: (ol.Extent|undefined), - * format: (ol.format.Feature|undefined), - * geometryFunction: (undefined|function(module:ol/Feature~Feature):module:ol/geom/Point~Point), - * projection: ol.ProjectionLike, - * source: ol.source.Vector, - * wrapX: (boolean|undefined)}} - */ -olx.source.ClusterOptions; - - -/** - * Attributions. - * @type {ol.AttributionLike|undefined} - * @api - */ -olx.source.ClusterOptions.prototype.attributions; - - -/** - * Minimum distance in pixels between clusters. Default is `20`. - * @type {number|undefined} - * @api - */ -olx.source.ClusterOptions.prototype.distance; - - -/** - * Extent. - * @type {ol.Extent|undefined} - * @api - */ -olx.source.ClusterOptions.prototype.extent; - - -/** - * Function that takes an {@link module:ol/Feature~Feature} as argument and returns an - * {@link module:ol/geom/Point~Point} as cluster calculation point for the feature. When a - * feature should not be considered for clustering, the function should return - * `null`. The default, which works when the underyling source contains point - * features only, is - * ```js - * function(feature) { - * return feature.getGeometry(); - * } - * ``` - * See {@link module:ol/geom/Polygon~Polygon#getInteriorPoint} for a way to get a cluster - * calculation point for polygons. - * @type {undefined|function(module:ol/Feature~Feature):module:ol/geom/Point~Point} - * @api - */ -olx.source.ClusterOptions.prototype.geometryFunction; - - -/** - * Format. - * @type {ol.format.Feature|undefined} - * @api - */ -olx.source.ClusterOptions.prototype.format; - - -/** - * Projection. - * @type {ol.ProjectionLike} - * @api - */ -olx.source.ClusterOptions.prototype.projection; - - -/** - * Source. - * @type {ol.source.Vector} - * @api - */ -olx.source.ClusterOptions.prototype.source; - - -/** - * WrapX. Default is true - * @type {boolean|undefined} - * @api - */ -olx.source.ClusterOptions.prototype.wrapX; - - -/** - * @typedef {{preemptive: (boolean|undefined), - * jsonp: (boolean|undefined), - * tileJSON: (TileJSON|undefined), - * url: (string|undefined)}} - */ -olx.source.TileUTFGridOptions; - - -/** - * Use JSONP with callback to load the TileJSON. Useful when the server - * does not support CORS. Default is `false`. - * @type {boolean|undefined} - * @api - */ -olx.source.TileUTFGridOptions.prototype.jsonp; - - -/** - * If `true` the TileUTFGrid source loads the tiles based on their "visibility". - * This improves the speed of response, but increases traffic. - * Note that if set to `false`, you need to pass `true` as `opt_request` - * to the `forDataAtCoordinateAndResolution` method otherwise no data - * will ever be loaded. - * Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.source.TileUTFGridOptions.prototype.preemptive; - - -/** - * TileJSON configuration for this source. If not provided, `url` must be - * configured. - * @type {TileJSON|undefined} - * @api - */ -olx.source.TileUTFGridOptions.prototype.tileJSON; - - -/** - * TileJSON endpoint that provides the configuration for this source. Request - * will be made through JSONP. If not provided, `tileJSON` must be configured. - * @type {string|undefined} - * @api - */ -olx.source.TileUTFGridOptions.prototype.url; - - -/** - * @typedef {{attributions: (ol.AttributionLike|undefined), - * cacheSize: (number|undefined), - * crossOrigin: (null|string|undefined), - * opaque: (boolean|undefined), - * projection: ol.ProjectionLike, - * reprojectionErrorThreshold: (number|undefined), - * state: (ol.source.State|undefined), - * tileClass: (function(new: ol.ImageTile, ol.TileCoord, - * ol.TileState, string, ?string, - * ol.TileLoadFunctionType)|undefined), - * tileGrid: (ol.tilegrid.TileGrid|undefined), - * tileLoadFunction: (ol.TileLoadFunctionType|undefined), - * tilePixelRatio: (number|undefined), - * tileUrlFunction: (ol.TileUrlFunctionType|undefined), - * url: (string|undefined), - * urls: (Array.|undefined), - * wrapX: (boolean|undefined), - * transition: (number|undefined)}} - */ -olx.source.TileImageOptions; - - -/** - * Attributions. - * @type {ol.AttributionLike|undefined} - * @api - */ -olx.source.TileImageOptions.prototype.attributions; - - -/** - * Cache size. Default is `2048`. - * @type {number|undefined} - * @api - */ -olx.source.TileImageOptions.prototype.cacheSize; - - -/** - * 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 - * {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} - * for more detail. - * @type {null|string|undefined} - * @api - */ -olx.source.TileImageOptions.prototype.crossOrigin; - - -/** - * Whether the layer is opaque. - * @type {boolean|undefined} - * @api - */ -olx.source.TileImageOptions.prototype.opaque; - - -/** - * Projection. - * @type {ol.ProjectionLike} - * @api - */ -olx.source.TileImageOptions.prototype.projection; - - -/** - * Maximum allowed reprojection error (in pixels). Default is `0.5`. - * Higher values can increase reprojection performance, but decrease precision. - * @type {number|undefined} - * @api - */ -olx.source.TileImageOptions.prototype.reprojectionErrorThreshold; - - -/** - * Source state. - * @type {ol.source.State|undefined} - * @api - */ -olx.source.TileImageOptions.prototype.state; - - -/** - * Class used to instantiate image tiles. Default is {@link ol.ImageTile}. - * @type {function(new: ol.ImageTile, ol.TileCoord, - * ol.TileState, string, ?string, - * ol.TileLoadFunctionType)|undefined} - * @api - */ -olx.source.TileImageOptions.prototype.tileClass; - - -/** - * Tile grid. - * @type {ol.tilegrid.TileGrid|undefined} - * @api - */ -olx.source.TileImageOptions.prototype.tileGrid; - - -/** - * Optional function to load a tile given a URL. The default is - * ```js - * function(imageTile, src) { - * imageTile.getImage().src = src; - * }; - * ``` - * @type {ol.TileLoadFunctionType|undefined} - * @api - */ -olx.source.TileImageOptions.prototype.tileLoadFunction; - - -/** - * The pixel ratio used by the tile service. For example, if the tile - * service advertizes 256px by 256px tiles but actually sends 512px - * by 512px images (for retina/hidpi devices) then `tilePixelRatio` - * should be set to `2`. Default is `1`. - * @type {number|undefined} - * @api - */ -olx.source.TileImageOptions.prototype.tilePixelRatio; - - -/** - * Optional function to get tile URL given a tile coordinate and the projection. - * @type {ol.TileUrlFunctionType|undefined} - * @api - */ -olx.source.TileImageOptions.prototype.tileUrlFunction; - - -/** - * 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. - * @type {string|undefined} - * @api - */ -olx.source.TileImageOptions.prototype.url; - - -/** - * An array of URL templates. - * @type {Array.|undefined} - * @api - */ -olx.source.TileImageOptions.prototype.urls; - - -/** - * Whether to wrap the world horizontally. The default, `undefined`, is to - * request out-of-bounds tiles from the server. When set to `false`, only one - * world will be rendered. When set to `true`, tiles will be requested for one - * world only, but they will be wrapped horizontally to render multiple worlds. - * @type {boolean|undefined} - * @api - */ -olx.source.TileImageOptions.prototype.wrapX; - - -/** - * Duration of the opacity transition for rendering. To disable the opacity - * transition, pass `transition: 0`. - * @type {number|undefined} - * @api - */ -olx.source.TileImageOptions.prototype.transition; - - -/** - * @typedef {{attributions: (ol.AttributionLike|undefined), - * cacheSize: (number|undefined), - * format: (ol.format.Feature|undefined), - * overlaps: (boolean|undefined), - * projection: ol.ProjectionLike, - * state: (ol.source.State|undefined), - * tileClass: (function(new: ol.VectorTile, ol.TileCoord, - * ol.TileState, string, ol.format.Feature, - * ol.TileLoadFunctionType)|undefined), - * tileGrid: (ol.tilegrid.TileGrid|undefined), - * tileLoadFunction: (ol.TileLoadFunctionType|undefined), - * tileUrlFunction: (ol.TileUrlFunctionType|undefined), - * url: (string|undefined), - * urls: (Array.|undefined), - * wrapX: (boolean|undefined), - * transition: (number|undefined)}} - */ -olx.source.VectorTileOptions; - - -/** - * Attributions. - * @type {ol.AttributionLike|undefined} - * @api - */ -olx.source.VectorTileOptions.prototype.attributions; - - -/** - * Cache size. Default is `128`. - * @type {number|undefined} - * @api - */ -olx.source.VectorTileOptions.prototype.cacheSize; - - -/** - * Feature format for tiles. Used and required by the default - * `tileLoadFunction`. - * @type {ol.format.Feature|undefined} - * @api - */ -olx.source.VectorTileOptions.prototype.format; - - -/** - * This source may have overlapping geometries. Default is `true`. 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. - * @type {boolean|undefined} - * @api - */ -olx.source.VectorTileOptions.prototype.overlaps; - - -/** - * Projection. - * @type {ol.ProjectionLike} - * @api - */ -olx.source.VectorTileOptions.prototype.projection; - - -/** - * Source state. - * @type {ol.source.State|undefined} - * @api - */ -olx.source.VectorTileOptions.prototype.state; - - -/** - * Class used to instantiate vector tiles. Default is {@link ol.VectorTile}. - * @type {function(new: ol.VectorTile, ol.TileCoord, - * ol.TileState, string, ol.format.Feature, - * ol.TileLoadFunctionType)|undefined} - * @api - */ -olx.source.VectorTileOptions.prototype.tileClass; - - -/** - * Tile grid. - * @type {ol.tilegrid.TileGrid|undefined} - * @api - */ -olx.source.VectorTileOptions.prototype.tileGrid; - - -/** - * Optional function to load a tile given a URL. Could look like this: - * ```js - * function(tile, url) { - * tile.setLoader(function() { - * var data = // ... fetch data - * var format = tile.getFormat(); - * tile.setFeatures(format.readFeatures(data, { - * // uncomment the line below for ol.format.MVT only - * extent: tile.getExtent(), - * featureProjection: map.getView().getProjection() - * })); - * }; - * }); - * ``` - * @type {ol.TileLoadFunctionType|undefined} - * @api - */ -olx.source.VectorTileOptions.prototype.tileLoadFunction; - - -/** - * Optional function to get tile URL given a tile coordinate and the projection. - * @type {ol.TileUrlFunctionType|undefined} - * @api - */ -olx.source.VectorTileOptions.prototype.tileUrlFunction; - - -/** - * 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. - * @type {string|undefined} - * @api - */ -olx.source.VectorTileOptions.prototype.url; - - -/** - * An array of URL templates. - * @type {Array.|undefined} - * @api - */ -olx.source.VectorTileOptions.prototype.urls; - - -/** - * Whether to wrap the world horizontally. When set to `false`, only one world - * will be rendered. When set to `true`, tiles will be wrapped horizontally to - * render multiple worlds. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.source.VectorTileOptions.prototype.wrapX; - - -/** - * Duration of the opacity transition for rendering. To disable the opacity - * transition, pass `transition: 0`. - * @type {number|undefined} - * @api - */ -olx.source.VectorTileOptions.prototype.transition; - - -/** - * @typedef {{url: (string|undefined), - * displayDpi: (number|undefined), - * metersPerUnit: (number|undefined), - * hidpi: (boolean|undefined), - * useOverlay: (boolean|undefined), - * projection: ol.ProjectionLike, - * ratio: (number|undefined), - * resolutions: (Array.|undefined), - * imageLoadFunction: (ol.ImageLoadFunctionType|undefined), - * params: (Object|undefined)}} - */ -olx.source.ImageMapGuideOptions; - - -/** - * The mapagent url. - * @type {string|undefined} - * @api - */ -olx.source.ImageMapGuideOptions.prototype.url; - - -/** - * The display resolution. Default is `96`. - * @type {number|undefined} - * @api - */ -olx.source.ImageMapGuideOptions.prototype.displayDpi; - - -/** - * The meters-per-unit value. Default is `1`. - * @type {number|undefined} - * @api - */ -olx.source.ImageMapGuideOptions.prototype.metersPerUnit; - - -/** - * Use the `ol.Map#pixelRatio` value when requesting the image from the remote - * server. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.source.ImageMapGuideOptions.prototype.hidpi; - - -/** - * If `true`, will use `GETDYNAMICMAPOVERLAYIMAGE`. - * @type {boolean|undefined} - * @api - */ -olx.source.ImageMapGuideOptions.prototype.useOverlay; - - -/** - * Projection. - * @type {ol.ProjectionLike} - * @api - */ -olx.source.ImageMapGuideOptions.prototype.projection; - - -/** - * 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. Default is `1`. - * @type {number|undefined} - * @api - */ -olx.source.ImageMapGuideOptions.prototype.ratio; - - -/** - * Resolutions. If specified, requests will be made for these resolutions only. - * @type {Array.|undefined} - * @api - */ -olx.source.ImageMapGuideOptions.prototype.resolutions; - - -/** - * Optional function to load an image given a URL. - * @type {ol.ImageLoadFunctionType|undefined} - * @api - */ -olx.source.ImageMapGuideOptions.prototype.imageLoadFunction; - - -/** - * Additional parameters. - * @type {Object|undefined} - * @api - */ -olx.source.ImageMapGuideOptions.prototype.params; - - -/** - * @typedef {{cacheSize: (number|undefined), - * layer: string, - * reprojectionErrorThreshold: (number|undefined), - * tileLoadFunction: (ol.TileLoadFunctionType|undefined), - * url: (string|undefined)}} - */ -olx.source.MapQuestOptions; - - -/** - * Cache size. Default is `2048`. - * @type {number|undefined} - * @api - */ -olx.source.MapQuestOptions.prototype.cacheSize; - - -/** - * Layer. Possible values are `osm`, `sat`, and `hyb`. - * @type {string} - * @api - */ -olx.source.MapQuestOptions.prototype.layer; - - -/** - * Maximum allowed reprojection error (in pixels). Default is `0.5`. - * Higher values can increase reprojection performance, but decrease precision. - * @type {number|undefined} - * @api - */ -olx.source.MapQuestOptions.prototype.reprojectionErrorThreshold; - - -/** - * Optional function to load a tile given a URL. The default is - * ```js - * function(imageTile, src) { - * imageTile.getImage().src = src; - * }; - * ``` - * @type {ol.TileLoadFunctionType|undefined} - * @api - */ -olx.source.MapQuestOptions.prototype.tileLoadFunction; - - -/** - * URL template. Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders. - * @type {string|undefined} - * @api - */ -olx.source.MapQuestOptions.prototype.url; - - -/** - * @typedef {{projection: ol.ProjectionLike, - * tileGrid: (ol.tilegrid.TileGrid|undefined), - * wrapX: (boolean|undefined)}} - */ -olx.source.TileDebugOptions; - - -/** - * Projection. - * @type {ol.ProjectionLike} - * @api - */ -olx.source.TileDebugOptions.prototype.projection; - - -/** - * Tile grid. - * @type {ol.tilegrid.TileGrid|undefined} - * @api - */ -olx.source.TileDebugOptions.prototype.tileGrid; - - -/** - * Whether to wrap the world horizontally. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.source.TileDebugOptions.prototype.wrapX; - - -/** - * @typedef {{attributions: (ol.AttributionLike|undefined), - * cacheSize: (number|undefined), - * crossOrigin: (null|string|undefined), - * maxZoom: (number|undefined), - * opaque: (boolean|undefined), - * reprojectionErrorThreshold: (number|undefined), - * tileLoadFunction: (ol.TileLoadFunctionType|undefined), - * url: (string|undefined), - * wrapX: (boolean|undefined)}} - */ -olx.source.OSMOptions; - - -/** - * Attributions. - * @type {ol.AttributionLike|undefined} - * @api - */ -olx.source.OSMOptions.prototype.attributions; - - -/** - * Cache size. Default is `2048`. - * @type {number|undefined} - * @api - */ -olx.source.OSMOptions.prototype.cacheSize; - - -/** - * 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 - * {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} - * for more detail. - * - * Default is `anonymous`. - * @type {null|string|undefined} - * @api - */ -olx.source.OSMOptions.prototype.crossOrigin; - - -/** - * Max zoom. Default is `19`. - * @type {number|undefined} - * @api - */ -olx.source.OSMOptions.prototype.maxZoom; - - -/** - * Whether the layer is opaque. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.source.OSMOptions.prototype.opaque; - - -/** - * Maximum allowed reprojection error (in pixels). Default is `0.5`. - * Higher values can increase reprojection performance, but decrease precision. - * @type {number|undefined} - * @api - */ -olx.source.OSMOptions.prototype.reprojectionErrorThreshold; - - -/** - * Optional function to load a tile given a URL. The default is - * ```js - * function(imageTile, src) { - * imageTile.getImage().src = src; - * }; - * ``` - * @type {ol.TileLoadFunctionType|undefined} - * @api - */ -olx.source.OSMOptions.prototype.tileLoadFunction; - - -/** - * URL template. Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders. - * Default is `https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png`. - * @type {string|undefined} - * @api - */ -olx.source.OSMOptions.prototype.url; - - -/** - * Whether to wrap the world horizontally. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.source.OSMOptions.prototype.wrapX; - - -/** - * @typedef {{attributions: (ol.AttributionLike|undefined), - * canvasFunction: ol.CanvasFunctionType, - * projection: ol.ProjectionLike, - * ratio: (number|undefined), - * resolutions: (Array.|undefined), - * state: (ol.source.State|undefined)}} - */ -olx.source.ImageCanvasOptions; - - -/** - * Attributions. - * @type {ol.AttributionLike|undefined} - * @api - */ -olx.source.ImageCanvasOptions.prototype.attributions; - - -/** - * Canvas function. The function returning the canvas element used by the source - * as an image. The arguments passed to the function are: `{ol.Extent}` the - * image extent, `{number}` the image resolution, `{number}` the device pixel - * ratio, `{ol.Size}` the image size, and `{module:ol/proj/Projection~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} - * @type {ol.CanvasFunctionType} - * @api - */ -olx.source.ImageCanvasOptions.prototype.canvasFunction; - - -/** - * Projection. - * @type {ol.ProjectionLike} - * @api - */ -olx.source.ImageCanvasOptions.prototype.projection; - - -/** - * 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. - * Default is `1.5`. - * @type {number|undefined} - * @api - */ -olx.source.ImageCanvasOptions.prototype.ratio; - - -/** - * Resolutions. If specified, new canvases will be created for these resolutions - * only. - * @type {Array.|undefined} - * @api - */ -olx.source.ImageCanvasOptions.prototype.resolutions; - - -/** - * Source state. - * @type {ol.source.State|undefined} - * @api - */ -olx.source.ImageCanvasOptions.prototype.state; - - -/** - * @typedef {{sources: Array., - * operation: (ol.RasterOperation|undefined), - * lib: (Object|undefined), - * threads: (number|undefined), - * operationType: (ol.source.RasterOperationType|undefined)}} - * @api - */ -olx.source.RasterOptions; - - -/** - * Input sources. - * @type {Array.} - * @api - */ -olx.source.RasterOptions.prototype.sources; - - -/** - * Raster operation. The operation will be called with data from input sources - * and the output will be assigned to the raster source. - * @type {ol.RasterOperation|undefined} - * @api - */ -olx.source.RasterOptions.prototype.operation; - - -/** - * Functions that will be made available to operations run in a worker. - * @type {Object|undefined} - * @api - */ -olx.source.RasterOptions.prototype.lib; - - -/** - * By default, operations will be run in a single worker thread. To avoid using - * workers altogether, set `threads: 0`. For pixel operations, operations can - * 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. - * @type {number|undefined} - * @api - */ -olx.source.RasterOptions.prototype.threads; - - -/** - * 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 - * be called with an array of ImageData objects from input sources. - * @type {ol.source.RasterOperationType|undefined} - * @api - */ -olx.source.RasterOptions.prototype.operationType; - - -/** - * @typedef {{attributions: (ol.AttributionLike|undefined), - * crossOrigin: (null|string|undefined), - * hidpi: (boolean|undefined), - * serverType: (ol.source.WMSServerType|string|undefined), - * imageLoadFunction: (ol.ImageLoadFunctionType|undefined), - * params: Object., - * projection: ol.ProjectionLike, - * ratio: (number|undefined), - * resolutions: (Array.|undefined), - * url: (string|undefined)}} - */ -olx.source.ImageWMSOptions; - - -/** - * Attributions. - * @type {ol.AttributionLike|undefined} - * @api - */ -olx.source.ImageWMSOptions.prototype.attributions; - - -/** - * 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 - * {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} - * for more detail. - * @type {null|string|undefined} - * @api - */ -olx.source.ImageWMSOptions.prototype.crossOrigin; - - -/** - * Use the `ol.Map#pixelRatio` value when requesting the image from the remote - * server. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.source.ImageWMSOptions.prototype.hidpi; - - -/** - * The type of the remote WMS server: `mapserver`, `geoserver` or `qgis`. Only - * needed if `hidpi` is `true`. Default is `undefined`. - * @type {ol.source.WMSServerType|string|undefined} - * @api - */ -olx.source.ImageWMSOptions.prototype.serverType; - - -/** - * Optional function to load an image given a URL. - * @type {ol.ImageLoadFunctionType|undefined} - * @api - */ -olx.source.ImageWMSOptions.prototype.imageLoadFunction; - - -/** - * 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. - * @type {Object.} - * @api - */ -olx.source.ImageWMSOptions.prototype.params; - - -/** - * Projection. - * @type {ol.ProjectionLike} - * @api - */ -olx.source.ImageWMSOptions.prototype.projection; - - -/** - * 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. Default is `1.5`. - * @type {number|undefined} - * @api - */ -olx.source.ImageWMSOptions.prototype.ratio; - - -/** - * Resolutions. If specified, requests will be made for these resolutions only. - * @type {Array.|undefined} - * @api - */ -olx.source.ImageWMSOptions.prototype.resolutions; - - -/** - * WMS service URL. - * @type {string|undefined} - * @api - */ -olx.source.ImageWMSOptions.prototype.url; - - -/** - * @typedef {{ - * cacheSize: (number|undefined), - * layer: string, - * minZoom: (number|undefined), - * maxZoom: (number|undefined), - * opaque: (boolean|undefined), - * reprojectionErrorThreshold: (number|undefined), - * tileLoadFunction: (ol.TileLoadFunctionType|undefined), - * url: (string|undefined), - * wrapX: (boolean|undefined) - * }} - */ -olx.source.StamenOptions; - - -/** - * Cache size. Default is `2048`. - * @type {number|undefined} - * @api - */ -olx.source.StamenOptions.prototype.cacheSize; - -/** - * Layer. - * @type {string} - * @api - */ -olx.source.StamenOptions.prototype.layer; - - -/** - * Minimum zoom. - * @type {number|undefined} - * @api - */ -olx.source.StamenOptions.prototype.minZoom; - - -/** - * Maximum zoom. - * @type {number|undefined} - * @api - */ -olx.source.StamenOptions.prototype.maxZoom; - - -/** - * Whether the layer is opaque. - * @type {boolean|undefined} - * @api - */ -olx.source.StamenOptions.prototype.opaque; - - -/** - * Maximum allowed reprojection error (in pixels). Default is `0.5`. - * Higher values can increase reprojection performance, but decrease precision. - * @type {number|undefined} - * @api - */ -olx.source.StamenOptions.prototype.reprojectionErrorThreshold; - - -/** - * Optional function to load a tile given a URL. The default is - * ```js - * function(imageTile, src) { - * imageTile.getImage().src = src; - * }; - * ``` - * @type {ol.TileLoadFunctionType|undefined} - * @api - */ -olx.source.StamenOptions.prototype.tileLoadFunction; - - -/** - * URL template. Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders. - * @type {string|undefined} - * @api - */ -olx.source.StamenOptions.prototype.url; - - -/** - * Whether to wrap the world horizontally. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.source.StamenOptions.prototype.wrapX; - - -/** - * @typedef {{attributions: (ol.AttributionLike|undefined), - * crossOrigin: (null|string|undefined), - * imageExtent: (ol.Extent), - * imageLoadFunction: (ol.ImageLoadFunctionType|undefined), - * imageSize: (ol.Size|undefined), - * projection: ol.ProjectionLike, - * url: string}} - */ -olx.source.ImageStaticOptions; - - -/** - * Attributions. - * @type {ol.AttributionLike|undefined} - * @api - */ -olx.source.ImageStaticOptions.prototype.attributions; - - -/** - * 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 - * {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} - * for more detail. - * @type {null|string|undefined} - * @api - */ -olx.source.ImageStaticOptions.prototype.crossOrigin; - - -/** - * Extent of the image in map coordinates. This is the [left, bottom, right, - * top] map coordinates of your image. - * @type {ol.Extent} - * @api - */ -olx.source.ImageStaticOptions.prototype.imageExtent; - - -/** - * Optional function to load an image given a URL. - * @type {ol.ImageLoadFunctionType|undefined} - * @api - */ -olx.source.ImageStaticOptions.prototype.imageLoadFunction; - - -/** - * Projection. - * @type {ol.ProjectionLike} - * @api - */ -olx.source.ImageStaticOptions.prototype.projection; - - -/** - * 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. - * @type {ol.Size|undefined} - * @api - */ -olx.source.ImageStaticOptions.prototype.imageSize; - - -/** - * Image URL. - * @type {string} - * @api - */ -olx.source.ImageStaticOptions.prototype.url; - - -/** - * @typedef {{attributions: (ol.AttributionLike|undefined), - * cacheSize: (number|undefined), - * crossOrigin: (null|string|undefined), - * params: (Object.|undefined), - * tileGrid: (ol.tilegrid.TileGrid|undefined), - * projection: ol.ProjectionLike, - * reprojectionErrorThreshold: (number|undefined), - * tileLoadFunction: (ol.TileLoadFunctionType|undefined), - * url: (string|undefined), - * urls: (Array.|undefined), - * wrapX: (boolean|undefined), - * transition: (number|undefined)}} - */ -olx.source.TileArcGISRestOptions; - - -/** - * Attributions. - * @type {ol.AttributionLike|undefined} - * @api - */ -olx.source.TileArcGISRestOptions.prototype.attributions; - - -/** - * Cache size. Default is `2048`. - * @type {number|undefined} - * @api - */ -olx.source.TileArcGISRestOptions.prototype.cacheSize; - - -/** - * 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 - * {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} - * for more detail. - * @type {null|string|undefined} - * @api - */ -olx.source.TileArcGISRestOptions.prototype.crossOrigin; - - -/** - * ArcGIS Rest parameters. This field is optional. Service defaults will be - * used for any fields not specified. `FORMAT` is `PNG32` by default. `F` is `IMAGE` by - * default. `TRANSPARENT` is `true` by default. `BBOX, `SIZE`, `BBOXSR`, - * and `IMAGESR` will be set dynamically. Set `LAYERS` to - * override the default service layer visibility. See - * {@link http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Export_Map/02r3000000v7000000/} - * for further reference. - * @type {Object.|undefined} - * @api - */ -olx.source.TileArcGISRestOptions.prototype.params; - - -/** - * 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. - * @type {ol.tilegrid.TileGrid|undefined} - * @api - */ -olx.source.TileArcGISRestOptions.prototype.tileGrid; - - -/** - * Projection. - * @type {ol.ProjectionLike} - * @api - */ -olx.source.TileArcGISRestOptions.prototype.projection; - - -/** - * Maximum allowed reprojection error (in pixels). Default is `0.5`. - * Higher values can increase reprojection performance, but decrease precision. - * @type {number|undefined} - * @api - */ -olx.source.TileArcGISRestOptions.prototype.reprojectionErrorThreshold; - - -/** - * Optional function to load a tile given a URL. The default is - * ```js - * function(imageTile, src) { - * imageTile.getImage().src = src; - * }; - * ``` - * @type {ol.TileLoadFunctionType|undefined} - * @api - */ -olx.source.TileArcGISRestOptions.prototype.tileLoadFunction; - - -/** - * ArcGIS Rest service URL for a Map Service or Image Service. The - * url should include /MapServer or /ImageServer. - * @type {string|undefined} - * @api - */ -olx.source.TileArcGISRestOptions.prototype.url; - - -/** - * Whether to wrap the world horizontally. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.source.TileArcGISRestOptions.prototype.wrapX; - - -/** - * Duration of the opacity transition for rendering. To disable the opacity - * transition, pass `transition: 0`. - * @type {number|undefined} - * @api - */ -olx.source.TileArcGISRestOptions.prototype.transition; - - -/** - * ArcGIS Rest service urls. Use this instead of `url` when the ArcGIS Service supports multiple - * urls for export requests. - * @type {Array.|undefined} - * @api - */ -olx.source.TileArcGISRestOptions.prototype.urls; - - -/** - * @typedef {{attributions: (ol.AttributionLike|undefined), - * cacheSize: (number|undefined), - * crossOrigin: (null|string|undefined), - * jsonp: (boolean|undefined), - * reprojectionErrorThreshold: (number|undefined), - * tileJSON: (TileJSON|undefined), - * tileLoadFunction: (ol.TileLoadFunctionType|undefined), - * url: (string|undefined), - * wrapX: (boolean|undefined), - * transition: (number|undefined)}} - */ -olx.source.TileJSONOptions; - - -/** - * Optional attributions for the source. If provided, these will be used - * instead of any attribution data advertised by the server. If not provided, - * any attributions advertised by the server will be used. - * @type {ol.AttributionLike|undefined} - * @api - */ -olx.source.TileJSONOptions.prototype.attributions; - - -/** - * Cache size. Default is `2048`. - * @type {number|undefined} - * @api - */ -olx.source.TileJSONOptions.prototype.cacheSize; - - -/** - * 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 - * {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} - * for more detail. - * @type {null|string|undefined} - * @api - */ -olx.source.TileJSONOptions.prototype.crossOrigin; - - -/** - * Use JSONP with callback to load the TileJSON. Useful when the server - * does not support CORS. Default is `false`. - * @type {boolean|undefined} - * @api - */ -olx.source.TileJSONOptions.prototype.jsonp; - - -/** - * Maximum allowed reprojection error (in pixels). Default is `0.5`. - * Higher values can increase reprojection performance, but decrease precision. - * @type {number|undefined} - * @api - */ -olx.source.TileJSONOptions.prototype.reprojectionErrorThreshold; - - -/** - * TileJSON configuration for this source. If not provided, `url` must be - * configured. - * @type {TileJSON|undefined} - * @api - */ -olx.source.TileJSONOptions.prototype.tileJSON; - - -/** - * Optional function to load a tile given a URL. The default is - * ```js - * function(imageTile, src) { - * imageTile.getImage().src = src; - * }; - * ``` - * @type {ol.TileLoadFunctionType|undefined} - * @api - */ -olx.source.TileJSONOptions.prototype.tileLoadFunction; - - -/** - * URL to the TileJSON file. If not provided, `tileJSON` must be configured. - * @type {string|undefined} - * @api - */ -olx.source.TileJSONOptions.prototype.url; - - -/** - * Whether to wrap the world horizontally. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.source.TileJSONOptions.prototype.wrapX; - - -/** - * Duration of the opacity transition for rendering. To disable the opacity - * transition, pass `transition: 0`. - * @type {number|undefined} - * @api - */ -olx.source.TileJSONOptions.prototype.transition; - - -/** - * @typedef {{attributions: (ol.AttributionLike|undefined), - * cacheSize: (number|undefined), - * params: Object., - * crossOrigin: (null|string|undefined), - * gutter: (number|undefined), - * hidpi: (boolean|undefined), - * tileClass: (function(new: ol.ImageTile, ol.TileCoord, - * ol.TileState, string, ?string, - * ol.TileLoadFunctionType)|undefined), - * tileGrid: (ol.tilegrid.TileGrid|undefined), - * projection: ol.ProjectionLike, - * reprojectionErrorThreshold: (number|undefined), - * serverType: (ol.source.WMSServerType|string|undefined), - * tileLoadFunction: (ol.TileLoadFunctionType|undefined), - * url: (string|undefined), - * urls: (Array.|undefined), - * wrapX: (boolean|undefined), - * transition: (number|undefined)}} - */ -olx.source.TileWMSOptions; - - -/** - * Attributions. - * @type {ol.AttributionLike|undefined} - * @api - */ -olx.source.TileWMSOptions.prototype.attributions; - - -/** - * Cache size. Default is `2048`. - * @type {number|undefined} - * @api - */ -olx.source.TileWMSOptions.prototype.cacheSize; - - -/** - * 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. - * @type {Object.} - * @api - */ -olx.source.TileWMSOptions.prototype.params; - - -/** - * 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 - * {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} - * for more detail. - * @type {null|string|undefined} - * @api - */ -olx.source.TileWMSOptions.prototype.crossOrigin; - - -/** - * The size in pixels of the gutter around image tiles to ignore. By setting - * this property to a non-zero value, images will be requested that are wider - * and taller than the tile size by a value of `2 x gutter`. Defaults to zero. - * Using a non-zero value allows artifacts of rendering at tile edges to be - * ignored. If you control the WMS service it is recommended to address - * "artifacts at tile edges" issues by properly configuring the WMS service. For - * example, MapServer has a `tile_map_edge_buffer` configuration parameter for - * this. See http://mapserver.org/output/tile_mode.html. - * @type {number|undefined} - * @api - */ -olx.source.TileWMSOptions.prototype.gutter; - - -/** - * Use the `ol.Map#pixelRatio` value when requesting the image from the remote - * server. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.source.TileWMSOptions.prototype.hidpi; - - -/** - * Class used to instantiate image tiles. Default is {@link ol.ImageTile}. - * @type {function(new: ol.ImageTile, ol.TileCoord, - * ol.TileState, string, ?string, - * ol.TileLoadFunctionType)|undefined} - * @api - */ -olx.source.TileWMSOptions.prototype.tileClass; - - -/** - * 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. - * @type {ol.tilegrid.TileGrid|undefined} - * @api - */ -olx.source.TileWMSOptions.prototype.tileGrid; - - -/** - * Projection. - * @type {ol.ProjectionLike} - * @api - */ -olx.source.TileWMSOptions.prototype.projection; - - -/** - * Maximum allowed reprojection error (in pixels). Default is `0.5`. - * Higher values can increase reprojection performance, but decrease precision. - * @type {number|undefined} - * @api - */ -olx.source.TileWMSOptions.prototype.reprojectionErrorThreshold; - - -/** - * The type of the remote WMS server. Currently only used when `hidpi` is - * `true`. Default is `undefined`. - * @type {ol.source.WMSServerType|string|undefined} - * @api - */ -olx.source.TileWMSOptions.prototype.serverType; - - -/** - * Optional function to load a tile given a URL. The default is - * ```js - * function(imageTile, src) { - * imageTile.getImage().src = src; - * }; - * ``` - * @type {ol.TileLoadFunctionType|undefined} - * @api - */ -olx.source.TileWMSOptions.prototype.tileLoadFunction; - - -/** - * WMS service URL. - * @type {string|undefined} - * @api - */ -olx.source.TileWMSOptions.prototype.url; - - -/** - * WMS service urls. Use this instead of `url` when the WMS supports multiple - * urls for GetMap requests. - * @type {Array.|undefined} - * @api - */ -olx.source.TileWMSOptions.prototype.urls; - - -/** - * Whether to wrap the world horizontally. When set to `false`, only one world - * will be rendered. When `true`, tiles will be requested for one world only, - * but they will be wrapped horizontally to render multiple worlds. The default - * is `true`. - * @type {boolean|undefined} - * @api - */ -olx.source.TileWMSOptions.prototype.wrapX; - - -/** - * Duration of the opacity transition for rendering. To disable the opacity - * transition, pass `transition: 0`. - * @type {number|undefined} - * @api - */ -olx.source.TileWMSOptions.prototype.transition; - - -/** - * @typedef {{attributions: (ol.AttributionLike|undefined), - * features: (Array.|ol.Collection.|undefined), - * format: (ol.format.Feature|undefined), - * loader: (module:ol/Feature~FeatureLoader|undefined), - * overlaps: (boolean|undefined), - * strategy: (ol.LoadingStrategy|undefined), - * url: (string|module:ol/Feature~FeatureUrlFunction|undefined), - * useSpatialIndex: (boolean|undefined), - * wrapX: (boolean|undefined)}} - */ -olx.source.VectorOptions; - - -/** - * Attributions. - * @type {ol.AttributionLike|undefined} - * @api - */ -olx.source.VectorOptions.prototype.attributions; - - -/** - * Features. If provided as {@link ol.Collection}, the features in the source - * and the collection will stay in sync. - * @type {Array.|ol.Collection.|undefined} - * @api - */ -olx.source.VectorOptions.prototype.features; - - -/** - * The feature format used by the XHR feature loader when `url` is set. - * Required if `url` is set, otherwise ignored. Default is `undefined`. - * @type {ol.format.Feature|undefined} - * @api - */ -olx.source.VectorOptions.prototype.format; - - -/** - * 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. - * - * Example: - * - * ```js - * var vectorSource = new ol.source.Vector({ - * format: new ol.format.GeoJSON(), - * loader: function(extent, resolution, projection) { - * var proj = projection.getCode(); - * var url = 'https://ahocevar.com/geoserver/wfs?service=WFS&' + - * 'version=1.1.0&request=GetFeature&typename=osm:water_areas&' + - * 'outputFormat=application/json&srsname=' + proj + '&' + - * 'bbox=' + extent.join(',') + ',' + proj; - * var xhr = new XMLHttpRequest(); - * xhr.open('GET', url); - * var onError = function() { - * vectorSource.removeLoadedExtent(extent); - * } - * xhr.onerror = onError; - * xhr.onload = function() { - * if (xhr.status == 200) { - * vectorSource.addFeatures( - * vectorSource.getFormat().readFeatures(xhr.responseText)); - * } else { - * onError(); - * } - * } - * xhr.send(); - * }, - * strategy: ol.loadingstrategy.bbox - * }); - * ``` - * @type {module:ol/Feature~FeatureLoader|undefined} - * @api - */ -olx.source.VectorOptions.prototype.loader; - - -/** - * This source may have overlapping geometries. Default is `true`. 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. - * @type {boolean|undefined} - * @api - */ -olx.source.VectorOptions.prototype.overlaps; - - -/** - * The loading strategy to use. By default an {@link ol.loadingstrategy.all} - * strategy is used, a one-off strategy which loads all features at once. - * @type {ol.LoadingStrategy|undefined} - * @api - */ -olx.source.VectorOptions.prototype.strategy; - - -/** - * Setting this option instructs the source to load features using an XHR loader - * (see {@link ol.featureloader.xhr}). Use a `string` and an - * {@link ol.loadingstrategy.all} for a one-off download of all features from - * the given URL. Use a {@link module:ol/Feature~FeatureUrlFunction} to generate the url with - * other loading strategies. - * Requires `format` to be set as well. - * When default XHR feature loader is provided, the features will - * be transformed from the data projection to the view projection - * during parsing. If your remote data source does not advertise its projection - * properly, this transformation will be incorrect. For some formats, the - * default projection (usually EPSG:4326) can be overridden by setting the - * defaultDataProjection constructor option on the format. - * Note that if a source contains non-feature data, such as a GeoJSON geometry - * or a KML NetworkLink, these will be ignored. Use a custom loader to load these. - * @type {string|module:ol/Feature~FeatureUrlFunction|undefined} - * @api - */ -olx.source.VectorOptions.prototype.url; - - -/** - * By default, an RTree is used as spatial index. When features are removed and - * added frequently, and the total number of features is low, setting this to - * `false` may improve performance. - * - * Note that - * {@link ol.source.Vector#getFeaturesInExtent}, - * {@link ol.source.Vector#getClosestFeatureToCoordinate} and - * {@link ol.source.Vector#getExtent} cannot be used when `useSpatialIndex` is - * set to `false`, and {@link ol.source.Vector#forEachFeatureInExtent} will loop - * through all features. - * - * When set to `false`, the features will be maintained in an - * {@link ol.Collection}, which can be retrieved through - * {@link ol.source.Vector#getFeaturesCollection}. - * - * The default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.source.VectorOptions.prototype.useSpatialIndex; - - -/** - * Wrap the world horizontally. Default is `true`. For vector editing across the - * -180° and 180° meridians to work properly, this should be set to `false`. The - * resulting geometry coordinates will then exceed the world bounds. - * @type {boolean|undefined} - * @api - */ -olx.source.VectorOptions.prototype.wrapX; - - -/** - * @typedef {{attributions: (ol.AttributionLike|undefined), - * cacheSize: (number|undefined), - * crossOrigin: (string|null|undefined), - * tileGrid: ol.tilegrid.WMTS, - * projection: ol.ProjectionLike, - * reprojectionErrorThreshold: (number|undefined), - * requestEncoding: (ol.source.WMTSRequestEncoding|string|undefined), - * layer: string, - * style: string, - * tilePixelRatio: (number|undefined), - * version: (string|undefined), - * format: (string|undefined), - * matrixSet: string, - * dimensions: (!Object|undefined), - * url: (string|undefined), - * tileLoadFunction: (ol.TileLoadFunctionType|undefined), - * urls: (Array.|undefined), - * tileClass: (function(new: ol.ImageTile, ol.TileCoord, - * ol.TileState, string, ?string, - * ol.TileLoadFunctionType)|undefined), - * wrapX: (boolean|undefined), - * transition: (number|undefined)}} - */ -olx.source.WMTSOptions; - - -/** - * Attributions. - * @type {ol.AttributionLike|undefined} - * @api - */ -olx.source.WMTSOptions.prototype.attributions; - - -/** - * Cache size. Default is `2048`. - * @type {number|undefined} - * @api - */ -olx.source.WMTSOptions.prototype.cacheSize; - - -/** - * 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 - * {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} - * for more detail. - * @type {string|null|undefined} - * @api - */ -olx.source.WMTSOptions.prototype.crossOrigin; - - -/** - * Tile grid. - * @type {ol.tilegrid.WMTS} - * @api - */ -olx.source.WMTSOptions.prototype.tileGrid; - - -/** - * Projection. - * @type {ol.ProjectionLike} - * @api - */ -olx.source.WMTSOptions.prototype.projection; - - -/** - * Maximum allowed reprojection error (in pixels). Default is `0.5`. - * Higher values can increase reprojection performance, but decrease precision. - * @type {number|undefined} - * @api - */ -olx.source.WMTSOptions.prototype.reprojectionErrorThreshold; - - -/** - * Request encoding. Default is `KVP`. - * @type {ol.source.WMTSRequestEncoding|string|undefined} - * @api - */ -olx.source.WMTSOptions.prototype.requestEncoding; - - -/** - * Layer name as advertised in the WMTS capabilities. - * @type {string} - * @api - */ -olx.source.WMTSOptions.prototype.layer; - - -/** - * Style name as advertised in the WMTS capabilities. - * @type {string} - * @api - */ -olx.source.WMTSOptions.prototype.style; - - -/** - * Class used to instantiate image tiles. Default is {@link ol.ImageTile}. - * @type {function(new: ol.ImageTile, ol.TileCoord, - * ol.TileState, string, ?string, - * ol.TileLoadFunctionType)|undefined} - * @api - */ -olx.source.WMTSOptions.prototype.tileClass; - - -/** - * The pixel ratio used by the tile service. For example, if the tile - * service advertizes 256px by 256px tiles but actually sends 512px - * by 512px images (for retina/hidpi devices) then `tilePixelRatio` - * should be set to `2`. Default is `1`. - * @type {number|undefined} - * @api - */ -olx.source.WMTSOptions.prototype.tilePixelRatio; - - -/** - * WMTS version. Default is `1.0.0`. - * @type {string|undefined} - * @api - */ -olx.source.WMTSOptions.prototype.version; - - -/** - * Image format. Default is `image/jpeg`. - * @type {string|undefined} - * @api - */ -olx.source.WMTSOptions.prototype.format; - - -/** - * Matrix set. - * @type {string} - * @api - */ -olx.source.WMTSOptions.prototype.matrixSet; - - -/** - * Additional "dimensions" for tile requests. This is an object with properties - * named like the advertised WMTS dimensions. - * @type {!Object|undefined} - * @api - */ -olx.source.WMTSOptions.prototype.dimensions; - - -/** - * A URL for the service. For the RESTful request encoding, this is a URL - * 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. - * @type {string|undefined} - * @api - */ -olx.source.WMTSOptions.prototype.url; - - -/** - * Optional function to load a tile given a URL. The default is - * ```js - * function(imageTile, src) { - * imageTile.getImage().src = src; - * }; - * ``` - * @type {ol.TileLoadFunctionType|undefined} - * @api - */ -olx.source.WMTSOptions.prototype.tileLoadFunction; - - -/** - * An array of URLs. Requests will be distributed among the URLs in this array. - * @type {Array.|undefined} - * @api - */ -olx.source.WMTSOptions.prototype.urls; - - -/** - * Whether to wrap the world horizontally. Default is `false`. - * @type {boolean|undefined} - * @api - */ -olx.source.WMTSOptions.prototype.wrapX; - - -/** - * Duration of the opacity transition for rendering. To disable the opacity - * transition, pass `transition: 0`. - * @type {number|undefined} - * @api - */ -olx.source.WMTSOptions.prototype.transition; - - -/** - * @typedef {{attributions: (ol.AttributionLike|undefined), - * cacheSize: (number|undefined), - * crossOrigin: (null|string|undefined), - * opaque: (boolean|undefined), - * projection: ol.ProjectionLike, - * reprojectionErrorThreshold: (number|undefined), - * maxZoom: (number|undefined), - * minZoom: (number|undefined), - * tileGrid: (ol.tilegrid.TileGrid|undefined), - * tileLoadFunction: (ol.TileLoadFunctionType|undefined), - * tilePixelRatio: (number|undefined), - * tileSize: (number|ol.Size|undefined), - * tileUrlFunction: (ol.TileUrlFunctionType|undefined), - * url: (string|undefined), - * urls: (Array.|undefined), - * wrapX: (boolean|undefined), - * transition: (number|undefined)}} - */ -olx.source.XYZOptions; - - -/** - * Attributions. - * @type {ol.AttributionLike|undefined} - * @api - */ -olx.source.XYZOptions.prototype.attributions; - - -/** - * Cache size. Default is `2048`. - * @type {number|undefined} - * @api - */ -olx.source.XYZOptions.prototype.cacheSize; - - -/** - * 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 - * {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} - * for more detail. - * @type {null|string|undefined} - * @api - */ -olx.source.XYZOptions.prototype.crossOrigin; - - -/** - * Whether the layer is opaque. - * @type {boolean|undefined} - * @api - */ -olx.source.XYZOptions.prototype.opaque; - - -/** - * Projection. Default is `EPSG:3857`. - * @type {ol.ProjectionLike} - * @api - */ -olx.source.XYZOptions.prototype.projection; - - -/** - * Maximum allowed reprojection error (in pixels). Default is `0.5`. - * Higher values can increase reprojection performance, but decrease precision. - * @type {number|undefined} - * @api - */ -olx.source.XYZOptions.prototype.reprojectionErrorThreshold; - - -/** - * Optional max zoom level. Default is `18`. - * @type {number|undefined} - * @api - */ -olx.source.XYZOptions.prototype.maxZoom; - - -/** - * Optional min zoom level. Default is `0`. - * @type {number|undefined} - * @api - */ -olx.source.XYZOptions.prototype.minZoom; - - -/** - * Tile grid. - * @type {ol.tilegrid.TileGrid|undefined} - * @api - */ -olx.source.XYZOptions.prototype.tileGrid; - - -/** - * Optional function to load a tile given a URL. The default is - * ```js - * function(imageTile, src) { - * imageTile.getImage().src = src; - * }; - * ``` - * @type {ol.TileLoadFunctionType|undefined} - * @api - */ -olx.source.XYZOptions.prototype.tileLoadFunction; - - -/** - * The pixel ratio used by the tile service. For example, if the tile - * service advertizes 256px by 256px tiles but actually sends 512px - * by 512px images (for retina/hidpi devices) then `tilePixelRatio` - * should be set to `2`. Default is `1`. - * @type {number|undefined} - * @api - */ -olx.source.XYZOptions.prototype.tilePixelRatio; - - -/** - * The tile size used by the tile service. Default is `[256, 256]` pixels. - * @type {number|ol.Size|undefined} - * @api - */ -olx.source.XYZOptions.prototype.tileSize; - - -/** - * Optional function to get tile URL given a tile coordinate and the projection. - * Required if url or urls are not provided. - * @type {ol.TileUrlFunctionType|undefined} - * @api - */ -olx.source.XYZOptions.prototype.tileUrlFunction; - - -/** - * 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. - * @type {string|undefined} - * @api - */ -olx.source.XYZOptions.prototype.url; - - -/** - * An array of URL templates. - * @type {Array.|undefined} - * @api - */ -olx.source.XYZOptions.prototype.urls; - - -/** - * Whether to wrap the world horizontally. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.source.XYZOptions.prototype.wrapX; - - -/** - * Duration of the opacity transition for rendering. To disable the opacity - * transition, pass `transition: 0`. - * @type {number|undefined} - * @api - */ -olx.source.XYZOptions.prototype.transition; - - -/** - * @typedef {{attributions: (ol.AttributionLike|undefined), - * cacheSize: (number|undefined), - * crossOrigin: (null|string|undefined), - * projection: ol.ProjectionLike, - * maxZoom: (number|undefined), - * minZoom: (number|undefined), - * wrapX: (boolean|undefined), - * config: (Object|undefined), - * map: (string|undefined), - * account: string}} - */ -olx.source.CartoDBOptions; - - -/** - * Attributions. - * @type {ol.AttributionLike|undefined} - * @api - */ -olx.source.CartoDBOptions.prototype.attributions; - - -/** - * Cache size. Default is `2048`. - * @type {number|undefined} - * @api - */ -olx.source.CartoDBOptions.prototype.cacheSize; - - -/** - * 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 - * {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} - * for more detail. - * @type {null|string|undefined} - * @api - */ -olx.source.CartoDBOptions.prototype.crossOrigin; - - -/** - * Projection. Default is `EPSG:3857`. - * @type {ol.ProjectionLike} - * @api - */ -olx.source.CartoDBOptions.prototype.projection; - - -/** - * Optional max zoom level. Default is `18`. - * @type {number|undefined} - * @api - */ -olx.source.CartoDBOptions.prototype.maxZoom; - - -/** - * Minimum zoom. - * @type {number|undefined} - * @api - */ -olx.source.CartoDBOptions.prototype.minZoom; - - -/** - * Whether to wrap the world horizontally. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.source.CartoDBOptions.prototype.wrapX; - - -/** - * If using anonymous maps, the CartoDB config to use. See - * {@link http://docs.cartodb.com/cartodb-platform/maps-api/anonymous-maps/} - * for more detail. - * If using named maps, a key-value lookup with the template parameters. - * See {@link http://docs.cartodb.com/cartodb-platform/maps-api/named-maps/} - * for more detail. - * @type {Object|undefined} - * @api - */ -olx.source.CartoDBOptions.prototype.config; - - -/** - * If using named maps, this will be the name of the template to load. - * See {@link http://docs.cartodb.com/cartodb-platform/maps-api/named-maps/} - * for more detail. - * @type {string|undefined} - * @api - */ -olx.source.CartoDBOptions.prototype.map; - - -/** - * CartoDB account name - * @type {string} - * @api - */ -olx.source.CartoDBOptions.prototype.account; - - -/** - * @typedef {{attributions: (ol.AttributionLike|undefined), - * cacheSize: (number|undefined), - * crossOrigin: (null|string|undefined), - * projection: (ol.ProjectionLike|undefined), - * reprojectionErrorThreshold: (number|undefined), - * url: !string, - * tierSizeCalculation: (string|undefined), - * size: ol.Size, - * extent: (ol.Extent|undefined), - * transition: (number|undefined), - * tileSize: (number|undefined)}} - */ -olx.source.ZoomifyOptions; - - -/** - * Attributions. - * @type {ol.AttributionLike|undefined} - * @api - */ -olx.source.ZoomifyOptions.prototype.attributions; - - -/** - * Cache size. Default is `2048`. - * @type {number|undefined} - * @api - */ -olx.source.ZoomifyOptions.prototype.cacheSize; - - -/** - * 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 - * {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} - * for more detail. - * @type {null|string|undefined} - * @api - */ -olx.source.ZoomifyOptions.prototype.crossOrigin; - - -/** - * Projection. - * @type {ol.ProjectionLike|undefined} - * @api - */ -olx.source.ZoomifyOptions.prototype.projection; - - -/** - * Maximum allowed reprojection error (in pixels). Default is `0.5`. - * Higher values can increase reprojection performance, but decrease precision. - * @type {number|undefined} - * @api - */ -olx.source.ZoomifyOptions.prototype.reprojectionErrorThreshold; - - -/** - * URL template or base URL of the Zoomify service. A base URL is the fixed part - * of the URL, excluding the tile group, z, x, and y folder structure, e.g. - * `http://my.zoomify.info/IMAGE.TIF/`. A URL template must include - * `{TileGroup}`, `{x}`, `{y}`, and `{z}` placeholders, e.g. - * `http://my.zoomify.info/IMAGE.TIF/{TileGroup}/{z}-{x}-{y}.jpg`. - * Internet Imaging Protocol (IIP) with JTL extension can be also used with - * `{tileIndex}` and `{z}` placeholders, e.g. - * `http://my.zoomify.info?FIF=IMAGE.TIF&JTL={z},{tileIndex}`. - * A `{?-?}` template pattern, for example `subdomain{a-f}.domain.com`, may be - * used instead of defining each one separately in the `urls` option. - * @type {!string} - * @api - */ -olx.source.ZoomifyOptions.prototype.url; - - -/** - * Tier size calculation method: `default` or `truncated`. - * @type {string|undefined} - * @api - */ -olx.source.ZoomifyOptions.prototype.tierSizeCalculation; - - -/** - * Size of the image. - * @type {ol.Size} - * @api - */ -olx.source.ZoomifyOptions.prototype.size; - - -/** - * 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 - * as `[0, 0, width, height]`. - * @type {ol.Extent|undefined} - * @api - */ -olx.source.ZoomifyOptions.prototype.extent; - - -/** - * Duration of the opacity transition for rendering. To disable the opacity - * transition, pass `transition: 0`. - * @type {number|undefined} - * @api - */ -olx.source.ZoomifyOptions.prototype.transition; - - -/** - * Tile size. Same tile size is used for all zoom levels. Default value is - * `256`. - * @type {number|undefined} - * @api - */ -olx.source.ZoomifyOptions.prototype.tileSize; - - /** * @typedef {{fill: (module:ol/style/Fill~Fill|undefined), * radius: number, diff --git a/src/ol/source/BingMaps.js b/src/ol/source/BingMaps.js index baff2adf0c..0b044421bd 100644 --- a/src/ol/source/BingMaps.js +++ b/src/ol/source/BingMaps.js @@ -11,13 +11,34 @@ import TileImage from '../source/TileImage.js'; import {createOrUpdate, quadKey} from '../tilecoord.js'; import {createXYZ, extentFromProjection} from '../tilegrid.js'; +/** + * @typedef {Object} Options + * @property {number} [cacheSize=2048] Cache size. + * @property {boolean} [hidpi=false] If `true` hidpi tiles will be requested. + * @property {string} [culture='en-us'] Culture code. + * @property {string} key Bing Maps API key. Get yours at http://www.bingmapsportal.com/. + * @property {string} imagerySet Type of imagery. + * @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 {ol.TileLoadFunctionType} [tileLoadFunction] Optional function to load a tile given a URL. The default is + * ```js + * function(imageTile, src) { + * imageTile.getImage().src = src; + * }; + * ``` + * @property {boolean} [wrapX=true] Whether to wrap the world horizontally. + * @property {number} [transition] Duration of the opacity transition for rendering. + * To disable the opacity transition, pass `transition: 0`. + */ + /** * @classdesc * Layer source for Bing Maps tile data. * * @constructor * @extends {ol.source.TileImage} - * @param {olx.source.BingMapsOptions} options Bing Maps options. + * @param {module:ol/source/BingMaps~Options=} options Bing Maps options. * @api */ const BingMaps = function(options) { diff --git a/src/ol/source/CartoDB.js b/src/ol/source/CartoDB.js index a262b79539..5f06d806c8 100644 --- a/src/ol/source/CartoDB.js +++ b/src/ol/source/CartoDB.js @@ -6,13 +6,38 @@ import {assign} from '../obj.js'; import SourceState from '../source/State.js'; import XYZ from '../source/XYZ.js'; +/** + * @typedef {Object} Options + * @property {ol.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 + * {@link 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 {number} [maxZoom=18] Max zoom. + * @property {number} [minZoom] Minimum zoom. + * @property {boolean} [wrapX=true] Whether to wrap the world horizontally. + * @property {Object} [config] If using anonymous maps, the CartoDB config to use. See + * {@link http://docs.cartodb.com/cartodb-platform/maps-api/anonymous-maps/} + * for more detail. + * If using named maps, a key-value lookup with the template parameters. + * See {@link http://docs.cartodb.com/cartodb-platform/maps-api/named-maps/} + * for more detail. + * @property {string} [map] If using named maps, this will be the name of the template to load. + * See {@link http://docs.cartodb.com/cartodb-platform/maps-api/named-maps/} + * for more detail. + * @property {string} account If using named maps, this will be the name of the template to load. + */ + + /** * @classdesc * Layer source for the CartoDB Maps API. * * @constructor * @extends {ol.source.XYZ} - * @param {olx.source.CartoDBOptions} options CartoDB options. + * @param {module:ol/source/CartoDB~Options=} options CartoDB options. * @api */ const CartoDB = function(options) { diff --git a/src/ol/source/Cluster.js b/src/ol/source/Cluster.js index d337275a83..c346155a2e 100644 --- a/src/ol/source/Cluster.js +++ b/src/ol/source/Cluster.js @@ -12,6 +12,31 @@ import {buffer, createEmpty, createOrUpdateFromCoordinate} from '../extent.js'; import Point from '../geom/Point.js'; import VectorSource from '../source/Vector.js'; +/** + * @typedef {Object} Options + * @property {ol.AttributionLike} [attributions] Attributions. + * @property {number} [distance=20] Minimum distance in pixels between clusters. + * @property {ol.Extent} [extent] Extent. + * @property {ol.format.Feature} [format] Format. + * @property {function(module:ol/Feature~Feature):module:ol/geom/Point~Point} [geometryFunction] + * Function that takes an {@link module:ol/Feature~Feature} as argument and returns an + * {@link module:ol/geom/Point~Point} as cluster calculation point for the feature. When a + * feature should not be considered for clustering, the function should return + * `null`. The default, which works when the underyling source contains point + * features only, is + * ```js + * function(feature) { + * return feature.getGeometry(); + * } + * ``` + * 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 {ol.source.Vector} source Source. + * @property {boolean} [wrapX=true] Whether to wrap the world horizontally. + */ + + /** * @classdesc * Layer source to cluster vector data. Works out of the box with point @@ -19,7 +44,7 @@ import VectorSource from '../source/Vector.js'; * considered for clustering, a custom `geometryFunction` can be defined. * * @constructor - * @param {olx.source.ClusterOptions} options Constructor options. + * @param {module:ol/source/Cluster~Options=} options Cluster options. * @extends {ol.source.Vector} * @api */ diff --git a/src/ol/source/ImageCanvas.js b/src/ol/source/ImageCanvas.js index 7ef9dd4960..801080a163 100644 --- a/src/ol/source/ImageCanvas.js +++ b/src/ol/source/ImageCanvas.js @@ -6,13 +6,34 @@ import ImageCanvas from '../ImageCanvas.js'; import {containsExtent, getHeight, getWidth, scaleFromCenter} from '../extent.js'; import ImageSource from '../source/Image.js'; +/** + * @typedef {Object} Options + * @property {ol.AttributionLike} [attributions] Attributions. + * @property {ol.CanvasFunctionType} [canvasFunction] Canvas function. + * The function returning the canvas element used by the source + * as an image. The arguments passed to the function are: `{ol.Extent}` the + * image extent, `{number}` the image resolution, `{number}` the device pixel + * ratio, `{ol.Size}` the image size, and `{module:ol/proj/Projection~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 {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.} [resolutions] Resolutions. + * If specified, new canvases will be created for these resolutions + * @property {ol.source.State} [state] Source state. + */ + + /** * @classdesc * Base class for image sources where a canvas element is the image. * * @constructor * @extends {ol.source.Image} - * @param {olx.source.ImageCanvasOptions} options Constructor options. + * @param {module:ol/source/ImageCanvas~Options=} options ImageCanvas options. * @api */ const ImageCanvasSource = function(options) { diff --git a/src/ol/source/ImageMapGuide.js b/src/ol/source/ImageMapGuide.js index fb59f00210..07aedeb7dd 100644 --- a/src/ol/source/ImageMapGuide.js +++ b/src/ol/source/ImageMapGuide.js @@ -10,6 +10,24 @@ import {assign} from '../obj.js'; import ImageSource, {defaultImageLoadFunction} from '../source/Image.js'; import {appendParams} from '../uri.js'; +/** + * @typedef {Object} Options + * @property {string} [url] The mapagent url. + * @property {number} [displayDpi=96] The display resolution. + * @property {number} [metersPerUnit=1] The meters-per-unit value. + * @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 {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.} [resolutions] Resolutions. + * If specified, requests will be made for these resolutions only. + * @property {ol.ImageLoadFunctionType} [imageLoadFunction] Optional function to load an image given a URL. + * @property {Object} [params] Additional parameters. + */ + + /** * @classdesc * Source for images from Mapguide servers @@ -17,7 +35,7 @@ import {appendParams} from '../uri.js'; * @constructor * @fires ol.source.Image.Event * @extends {ol.source.Image} - * @param {olx.source.ImageMapGuideOptions} options Options. + * @param {module:ol/source/ImageMapGuide~Options=} options ImageMapGuide options. * @api */ const ImageMapGuide = function(options) { diff --git a/src/ol/source/ImageStatic.js b/src/ol/source/ImageStatic.js index 088acdbab6..4ab5d3a575 100644 --- a/src/ol/source/ImageStatic.js +++ b/src/ol/source/ImageStatic.js @@ -11,13 +11,30 @@ import {intersects, getHeight, getWidth} from '../extent.js'; import {get as getProjection} from '../proj.js'; import ImageSource, {defaultImageLoadFunction} from '../source/Image.js'; +/** + * @typedef {Object} Options + * @property {ol.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 + * {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} for more detail. + * @property {ol.Extent} [imageExtent] Extent of the image in map coordinates. + * This is the [left, bottom, right, top] map coordinates of your image. + * @property {ol.ImageLoadFunctionType} [imageLoadFunction] Optional function to load an image given a URL. + * @property {module:ol/proj~ProjectionLike} projection Projection. + * @property {ol.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. + */ + + /** * @classdesc * A layer source for displaying a single, static image. * * @constructor * @extends {ol.source.Image} - * @param {olx.source.ImageStaticOptions} options Options. + * @param {module:ol/source/ImageStatic~Options=} options ImageStatic options. * @api */ const Static = function(options) { diff --git a/src/ol/source/ImageWMS.js b/src/ol/source/ImageWMS.js index 431ef1f71e..250d460d37 100644 --- a/src/ol/source/ImageWMS.js +++ b/src/ol/source/ImageWMS.js @@ -17,6 +17,32 @@ import WMSServerType from '../source/WMSServerType.js'; import {compareVersions} from '../string.js'; import {appendParams} from '../uri.js'; +/** + * @typedef {Object} Options + * @property {ol.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 + * {@link 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 {ol.source.WMSServerType|string} [serverType] The type of + * the remote WMS server: `mapserver`, `geoserver` or `qgis`. Only needed if `hidpi` is `true`. + * @property {ol.ImageLoadFunctionType} [imageLoadFunction] Optional function to load an image given a URL. + * @property {Object.} 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 {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. + * @property {Array.} [resolutions] Resolutions. + * If specified, requests will be made for these resolutions only. + * @property {string} url WMS service URL. + */ + + /** * @classdesc * Source for WMS servers providing single, untiled images. @@ -24,7 +50,7 @@ import {appendParams} from '../uri.js'; * @constructor * @fires ol.source.Image.Event * @extends {ol.source.Image} - * @param {olx.source.ImageWMSOptions=} opt_options Options. + * @param {module:ol/source/ImageWMS~Options=} [opt_options] ImageWMS options. * @api */ const ImageWMS = function(opt_options) { diff --git a/src/ol/source/OSM.js b/src/ol/source/OSM.js index a583bc5ffc..1aae16eb9e 100644 --- a/src/ol/source/OSM.js +++ b/src/ol/source/OSM.js @@ -17,13 +17,37 @@ export const ATTRIBUTION = '© ' + 'contributors.'; +/** + * @typedef {Object} Options + * @property {ol.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 + * {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} for more detail. + * @property {number} [maxZoom=19] Max zoom. + * @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 {ol.TileLoadFunctionType} [tileLoadFunction] Optional function to load a tile given a URL. The default is + * ```js + * function(imageTile, src) { + * imageTile.getImage().src = src; + * }; + * ``` + * @property {string} [url='https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png'] URL template. + * Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders. + * @property {boolean} [wrapX=true] Whether to wrap the world horizontally. + */ + + /** * @classdesc * Layer source for the OpenStreetMap tile server. * * @constructor * @extends {ol.source.XYZ} - * @param {olx.source.OSMOptions=} opt_options Open Street Map options. + * @param {module:ol/source/OSM~Options=} [opt_options] Open Street Map options. * @api */ const OSM = function(opt_options) { diff --git a/src/ol/source/Raster.js b/src/ol/source/Raster.js index 2076d68fd4..90ec15371c 100644 --- a/src/ol/source/Raster.js +++ b/src/ol/source/Raster.js @@ -82,6 +82,25 @@ const RasterSourceEvent = function(type, frameState, data) { }; inherits(RasterSourceEvent, Event); +/** + * @typedef {Object} Options + * @property {Array.} sources Input sources. + * @property {ol.RasterOperation} [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. + * @property {number} [threads] By default, operations will be run in a single worker thread. + * To avoid using workers altogether, set `threads: 0`. For pixel operations, operations can + * 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 {ol.source.RasterOperationType} [operationType] 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 + * be called with an array of ImageData objects from input sources. + */ + /** * @classdesc @@ -92,7 +111,7 @@ inherits(RasterSourceEvent, Event); * @constructor * @extends {ol.source.Image} * @fires ol.source.Raster.Event - * @param {olx.source.RasterOptions} options Options. + * @param {module:ol/source/Raster~Options=} options Options. * @api */ const RasterSource = function(options) { diff --git a/src/ol/source/Stamen.js b/src/ol/source/Stamen.js index a691162587..62a6fc6275 100644 --- a/src/ol/source/Stamen.js +++ b/src/ol/source/Stamen.js @@ -88,13 +88,34 @@ const ProviderConfig = { }; +/** + * @typedef {Object} Options + * @property {number} [cacheSize=2048] Cache size. + * @property {string} [layer] Layer. + * @property {number} [minZoom] Minimum zoom. + * @property {number} [maxZoom] Maximum zoom. + * @property {boolean} [opaque] Whether the layer is opaque. + * @property {boolean} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels). + * Higher values can increase reprojection performance, but decrease precision. + * @property {ol.TileLoadFunctionType} [tileLoadFunction] + * Optional function to load a tile given a URL. The default is + * ```js + * function(imageTile, src) { + * imageTile.getImage().src = src; + * }; + * ``` + * @property {string} [url] URL template. Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders. + * @property {boolean} [wrapX=true] Whether to wrap the world horizontally. + */ + + /** * @classdesc * Layer source for the Stamen tile server. * * @constructor * @extends {ol.source.XYZ} - * @param {olx.source.StamenOptions} options Stamen options. + * @param {module:ol/source/Stamen~Options=} options Stamen options. * @api */ const Stamen = function(options) { diff --git a/src/ol/source/Tile.js b/src/ol/source/Tile.js index b075939e99..0b54b5ad29 100644 --- a/src/ol/source/Tile.js +++ b/src/ol/source/Tile.js @@ -12,6 +12,21 @@ import Source from '../source/Source.js'; import {getKeyZXY, withinExtentAndZ} from '../tilecoord.js'; import {wrapX, getForProjection as getTileGridForProjection} from '../tilegrid.js'; +/** + * @typedef {Object} Options + * @property {ol.AttributionLike} [attributions] + * @property {number} [cacheSize] + * @property {module:ol/extent~Extent} [extent] + * @property {boolean} [opaque] + * @property {number} [tilePixelRatio] + * @property {module:ol/proj~ProjectionLike} [projection] + * @property {ol.source.State} [state] + * @property {ol.tilegrid.TileGrid} [tileGrid] + * @property {boolean} [wrapX=true] + * @property {number} [transition] + */ + + /** * @classdesc * Abstract base class; normally only used for creating subclasses and not @@ -21,7 +36,7 @@ import {wrapX, getForProjection as getTileGridForProjection} from '../tilegrid.j * @constructor * @abstract * @extends {ol.source.Source} - * @param {ol.SourceTileOptions} options Tile source options. + * @param {module:ol/source/Tile~Options=} options SourceTile source options. * @api */ const TileSource = function(options) { diff --git a/src/ol/source/TileDebug.js b/src/ol/source/TileDebug.js index 5860b67ed3..ac5ac6bc18 100644 --- a/src/ol/source/TileDebug.js +++ b/src/ol/source/TileDebug.js @@ -75,6 +75,14 @@ LabeledTile.prototype.getImage = function() { LabeledTile.prototype.load = function() {}; +/** + * @typedef {Object} Options + * @property {module:ol/proj~ProjectionLike} projection Projection. + * @property {ol.tilegrid.TileGrid} [tileGrid] Tile grid. + * @property {boolean} [wrapX=true] Whether to wrap the world horizontally. + */ + + /** * @classdesc * A pseudo tile source, which does not fetch tiles from a server, but renders @@ -85,7 +93,7 @@ LabeledTile.prototype.load = function() {}; * * @constructor * @extends {ol.source.Tile} - * @param {olx.source.TileDebugOptions} options Debug tile options. + * @param {module:ol/source/TileDebug~Options=} options Debug tile options. * @api */ const TileDebug = function(options) { diff --git a/src/ol/source/TileImage.js b/src/ol/source/TileImage.js index 73a9d1cce8..a7da58e6e6 100644 --- a/src/ol/source/TileImage.js +++ b/src/ol/source/TileImage.js @@ -14,6 +14,48 @@ import UrlTile from '../source/UrlTile.js'; import {getKey, getKeyZXY} from '../tilecoord.js'; import {getForProjection as getTileGridForProjection} from '../tilegrid.js'; +/** + * @typedef {Object} Options + * @property {ol.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 + * {@link 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 {boolean} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels). + * Higher values can increase reprojection performance, but decrease precision. + * @property {ol.source.State} [state] Source state. + * @property {function(new: ol.ImageTile, ol.TileCoord, + * ol.TileState, string, ?string, + * ol.TileLoadFunctionType)} [tileClass] Class used to instantiate image tiles. + * Default is {@link ol.ImageTile}. + * @property {ol.tilegrid.TileGrid} [tileGrid] Tile grid. + * @property {ol.TileLoadFunctionType} [tileLoadFunction] Optional function to load a tile given a URL. The default is + * ```js + * function(imageTile, src) { + * imageTile.getImage().src = src; + * }; + * ``` + * @property {number} [tilePixelRatio=1] The pixel ratio used by the tile service. For example, if the tile + * service advertizes 256px by 256px tiles but actually sends 512px + * by 512px images (for retina/hidpi devices) then `tilePixelRatio` + * should be set to `2`. + * @property {ol.TileUrlFunctionType} [tileUrlFunction] Optional function to get tile URL given a tile coordinate and the projection. + * @property {string} [url] URL template. Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders. + * A `{?-?}` template pattern, for example `subdomain{a-f}.domain.com`, may be + * used instead of defining each one separately in the `urls` option. + * @property {Array.} [urls] An array of URL templates. + * @property {boolean} [wrapX] Whether to wrap the world horizontally. The default, is to + * request out-of-bounds tiles from the server. When set to `false`, only one + * world will be rendered. When set to `true`, tiles will be requested for one + * world only, but they will be wrapped horizontally to render multiple worlds. + * @property {number} [transition] Duration of the opacity transition for rendering. + * To disable the opacity transition, pass `transition: 0`. + */ + + /** * @classdesc * Base class for sources providing images divided into a tile grid. @@ -21,7 +63,7 @@ import {getForProjection as getTileGridForProjection} from '../tilegrid.js'; * @constructor * @fires ol.source.Tile.Event * @extends {ol.source.UrlTile} - * @param {olx.source.TileImageOptions} options Image tile options. + * @param {module:ol/source/TileImage~Options=} options Image tile options. * @api */ const TileImage = function(options) { diff --git a/src/ol/source/TileJSON.js b/src/ol/source/TileJSON.js index 43e405ea7f..53be58de91 100644 --- a/src/ol/source/TileJSON.js +++ b/src/ol/source/TileJSON.js @@ -17,13 +17,40 @@ import SourceState from '../source/State.js'; import TileImage from '../source/TileImage.js'; import {createXYZ, extentFromProjection} from '../tilegrid.js'; +/** + * @typedef {Object} Options + * @property {ol.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 + * {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} for more detail. + * @property {boolean} [jsonp=false] Use JSONP with callback to load the TileJSON. + * Useful when the server does not support CORS.. + * @property {boolean} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels). + * 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 {ol.TileLoadFunctionType} [tileLoadFunction] Optional function to load a tile given a URL. The default is + * ```js + * function(imageTile, src) { + * imageTile.getImage().src = src; + * }; + * ``` + * @property {string} [url] URL to the TileJSON file. If not provided, `tileJSON` must be configured. + * @property {boolean} [wrapX=true] Whether to wrap the world horizontally. + * @property {number} [transition] Duration of the opacity transition for rendering. + * To disable the opacity transition, pass `transition: 0`. + */ + + /** * @classdesc * Layer source for tile data in TileJSON format. * * @constructor * @extends {ol.source.TileImage} - * @param {olx.source.TileJSONOptions} options TileJSON options. + * @param {module:ol/source/TileJSON~Options=} options TileJSON options. * @api */ const TileJSON = function(options) { diff --git a/src/ol/source/TileUTFGrid.js b/src/ol/source/TileUTFGrid.js index b13c6d4300..e0c07a17da 100644 --- a/src/ol/source/TileUTFGrid.js +++ b/src/ol/source/TileUTFGrid.js @@ -249,13 +249,30 @@ CustomTile.prototype.load = function() { }; +/** + * @typedef {Object} Options + * @property {boolean} [preemptive=true] + * If `true` the TileUTFGrid source loads the tiles based on their "visibility". + * This improves the speed of response, but increases traffic. + * Note that if set to `false`, you need to pass `true` as `opt_request` + * to the `forDataAtCoordinateAndResolution` method otherwise no data + * will ever be loaded. + * @property {boolean} [jsonp=false] Use JSONP with callback to load the TileJSON. + * Useful when the server does not support CORS.. + * @property {tileJSON} [tileJSON] TileJSON configuration for this source. + * If not provided, `url` must be configured. + * @property {string} [url] TileJSON endpoint that provides the configuration for this source. + * Request will be made through JSONP. If not provided, `tileJSON` must be configured. + */ + + /** * @classdesc * Layer source for UTFGrid interaction data loaded from TileJSON format. * * @constructor * @extends {ol.source.Tile} - * @param {olx.source.TileUTFGridOptions} options Source options. + * @param {module:ol/source/TileUTFGrid~Options=} options Source options. * @api */ const UTFGrid = function(options) { diff --git a/src/ol/source/TileWMS.js b/src/ol/source/TileWMS.js index c207d78605..a31833a63b 100644 --- a/src/ol/source/TileWMS.js +++ b/src/ol/source/TileWMS.js @@ -17,13 +17,69 @@ import {hash as tileCoordHash} from '../tilecoord.js'; import {compareVersions} from '../string.js'; import {appendParams} from '../uri.js'; +/** + * @typedef {Object} Options + * @property {ol.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 + * {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} for more detail. + * @property {Object.} 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 {number} [gutter=0] + * The size in pixels of the gutter around image tiles to ignore. By setting + * this property to a non-zero value, images will be requested that are wider + * and taller than the tile size by a value of `2 x gutter`. + * Using a non-zero value allows artifacts of rendering at tile edges to be + * ignored. If you control the WMS service it is recommended to address + * "artifacts at tile edges" issues by properly configuring the WMS service. For + * example, MapServer has a `tile_map_edge_buffer` configuration parameter for + * 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 {boolean} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels). + * Higher values can increase reprojection performance, but decrease precision. + * @property {function(new: ol.ImageTile, ol.TileCoord, + * ol.TileState, string, ?string, + * ol.TileLoadFunctionType)} [tileClass] Class used to instantiate image tiles. + * Default is {@link ol.ImageTile}. + * @property {ol.tilegrid.TileGrid} [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 {ol.source.WMSServerType|string} [serverType] + * The type of the remote WMS server. Currently only used when `hidpi` is + * `true`. + * @property {ol.TileLoadFunctionType} [tileLoadFunction] Optional function to load a tile given a URL. The default is + * ```js + * function(imageTile, src) { + * imageTile.getImage().src = src; + * }; + * ``` + * @property {string} [url] WMS service URL. + * @property {Array.} [urls] WMS service urls. + * Use this instead of `url` when the WMS supports multiple urls for GetMap requests. + * @property {boolean} [wrapX=true] Whether to wrap the world horizontally. + * When set to `false`, only one world + * will be rendered. When `true`, tiles will be requested for one world only, + * but they will be wrapped horizontally to render multiple worlds. + * @property {number} [transition] Duration of the opacity transition for rendering. + * To disable the opacity transition, pass `transition: 0`. + */ + + /** * @classdesc * Layer source for tile data from WMS servers. * * @constructor * @extends {ol.source.TileImage} - * @param {olx.source.TileWMSOptions=} opt_options Tile WMS options. + * @param {module:ol/source/TileWMS~Options=} [opt_options] Tile WMS options. * @api */ const TileWMS = function(opt_options) { diff --git a/src/ol/source/UrlTile.js b/src/ol/source/UrlTile.js index 7c43c8bc91..bac594efaa 100644 --- a/src/ol/source/UrlTile.js +++ b/src/ol/source/UrlTile.js @@ -8,6 +8,25 @@ import TileSource, {TileSourceEvent} from '../source/Tile.js'; import TileEventType from '../source/TileEventType.js'; import {getKeyZXY} from '../tilecoord.js'; +/** + * @typedef {Object} Options + * @property {ol.AttributionLike} [attributions] + * @property {number} [cacheSize] + * @property {module:ol/extent~Extent} [extent] + * @property {boolean} [opaque] + * @property {module:ol/proj~ProjectionLike} [projection] + * @property {ol.source.State} [state] + * @property {ol.tilegrid.TileGrid} [tileGrid] + * @property {module:ol/Tile~LoadFunction} tileLoadFunction + * @property {number} [tilePixelRatio] + * @property {module:ol/Tile~UrlFunction} [tileUrlFunction] + * @property {string} [url] + * @property {Array.} [urls] + * @property {boolean} [wrapX=true] + * @property {number} [transition] + */ + + /** * @classdesc * Base class for sources providing tiles divided into a tile grid over http. @@ -16,7 +35,7 @@ import {getKeyZXY} from '../tilecoord.js'; * @abstract * @fires ol.source.Tile.Event * @extends {ol.source.Tile} - * @param {ol.SourceUrlTileOptions} options Image tile options. + * @param {module:ol/source/UrlTile~Options=} options Image tile options. */ const UrlTile = function(options) { diff --git a/src/ol/source/Vector.js b/src/ol/source/Vector.js index 41eed5fee8..217d2e9a80 100644 --- a/src/ol/source/Vector.js +++ b/src/ol/source/Vector.js @@ -48,6 +48,92 @@ export const VectorSourceEvent = function(type, opt_feature) { inherits(VectorSourceEvent, Event); +/** + * @typedef {Object} Options + * @property {ol.AttributionLike} [attributions] Attributions. + * @property {Array.|ol.Collection.} [features] + * Features. If provided as {@link ol.Collection}, the features in the source + * and the collection will stay in sync. + * @property {ol.format.Feature} [format] The feature format used by the XHR + * feature loader when `url` is set. Required if `url` is set, otherwise ignored. + * @property {module:ol/Feature~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. + * + * Example: + * + * ```js + * var vectorSource = new ol.source.Vector({ + * format: new ol.format.GeoJSON(), + * loader: function(extent, resolution, projection) { + * var proj = projection.getCode(); + * var url = 'https://ahocevar.com/geoserver/wfs?service=WFS&' + + * 'version=1.1.0&request=GetFeature&typename=osm:water_areas&' + + * 'outputFormat=application/json&srsname=' + proj + '&' + + * 'bbox=' + extent.join(',') + ',' + proj; + * var xhr = new XMLHttpRequest(); + * xhr.open('GET', url); + * var onError = function() { + * vectorSource.removeLoadedExtent(extent); + * } + * xhr.onerror = onError; + * xhr.onload = function() { + * if (xhr.status == 200) { + * vectorSource.addFeatures( + * vectorSource.getFormat().readFeatures(xhr.responseText)); + * } else { + * onError(); + * } + * } + * xhr.send(); + * }, + * strategy: ol.loadingstrategy.bbox + * }); + * ``` + * @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 {ol.LoadingStrategy} [strategy] The loading strategy to use. + * By default an {@link ol.loadingstrategy.all} + * strategy is used, a one-off strategy which loads all features at once. + * @property {string|module:ol/Feature~FeatureUrlFunction} [url] + * Setting this option instructs the source to load features using an XHR loader + * (see {@link ol.featureloader.xhr}). Use a `string` and an + * {@link ol.loadingstrategy.all} for a one-off download of all features from + * the given URL. Use a {@link module:ol/Feature~FeatureUrlFunction} to generate the url with + * other loading strategies. + * Requires `format` to be set as well. + * When default XHR feature loader is provided, the features will + * be transformed from the data projection to the view projection + * during parsing. If your remote data source does not advertise its projection + * properly, this transformation will be incorrect. For some formats, the + * default projection (usually EPSG:4326) can be overridden by setting the + * defaultDataProjection constructor option on the format. + * Note that if a source contains non-feature data, such as a GeoJSON geometry + * or a KML NetworkLink, these will be ignored. Use a custom loader to load these. + * @property {boolean} [useSpatialIndex=true] + * By default, an RTree is used as spatial index. When features are removed and + * added frequently, and the total number of features is low, setting this to + * `false` may improve performance. + * + * Note that + * {@link ol.source.Vector#getFeaturesInExtent}, + * {@link ol.source.Vector#getClosestFeatureToCoordinate} and + * {@link ol.source.Vector#getExtent} cannot be used when `useSpatialIndex` is + * set to `false`, and {@link ol.source.Vector#forEachFeatureInExtent} will loop + * through all features. + * + * When set to `false`, the features will be maintained in an + * {@link ol.Collection}, which can be retrieved through + * {@link ol.source.Vector#getFeaturesCollection}. + * @property {boolean} [wrapX=true] Wrap the world horizontally. For vector editing across the + * -180° and 180° meridians to work properly, this should be set to `false`. The + * resulting geometry coordinates will then exceed the world bounds. + */ + + /** * @classdesc * Provides a source of features for vector layers. Vector features provided @@ -57,7 +143,7 @@ inherits(VectorSourceEvent, Event); * @constructor * @extends {ol.source.Source} * @fires ol.source.Vector.Event - * @param {olx.source.VectorOptions=} opt_options Vector source options. + * @param {module:ol/source/Vector~Options=} opt_options Vector source options. * @api */ const VectorSource = function(opt_options) { diff --git a/src/ol/source/VectorTile.js b/src/ol/source/VectorTile.js index d62c8d3f09..4bdea0dcea 100644 --- a/src/ol/source/VectorTile.js +++ b/src/ol/source/VectorTile.js @@ -10,6 +10,50 @@ import UrlTile from '../source/UrlTile.js'; import {getKeyZXY} from '../tilecoord.js'; import {createXYZ, extentFromProjection, createForProjection} from '../tilegrid.js'; +/** + * @typedef {Object} Options + * @property {ol.AttributionLike} [attributions] Attributions. + * @property {number} [cacheSize=128] Cache size. + * @property {ol.format.Feature} [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 {ol.source.State} [state] Source state. + * @property {function(new: ol.VectorTile, ol.TileCoord, + * ol.TileState, string, ?string, + * ol.TileLoadFunctionType)} [tileClass] Class used to instantiate image tiles. + * Default is {@link ol.VectorTile}. + * @property {ol.tilegrid.TileGrid} [tileGrid] Tile grid. + * @property {ol.TileLoadFunctionType} [tileLoadFunction] + * Optional function to load a tile given a URL. Could look like this: + * ```js + * function(tile, url) { + * tile.setLoader(function() { + * var data = // ... fetch data + * var format = tile.getFormat(); + * tile.setFeatures(format.readFeatures(data, { + * // uncomment the line below for ol.format.MVT only + * extent: tile.getExtent(), + * featureProjection: map.getView().getProjection() + * })); + * }; + * }); + * @property {ol.TileUrlFunctionType} [tileUrlFunction] Optional function to get tile URL given a tile coordinate and the projection. + * @property {string} [url] URL template. Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders. + * A `{?-?}` template pattern, for example `subdomain{a-f}.domain.com`, may be + * used instead of defining each one separately in the `urls` option. + * @property {Array.} [urls] An array of URL templates. + * @property {boolean} [wrapX=true] Whether to wrap the world horizontally. + * When set to `false`, only one world + * will be rendered. When set to `true`, tiles will be wrapped horizontally to + * render multiple worlds. + * @property {number} [transition] Duration of the opacity transition for rendering. + * To disable the opacity transition, pass `transition: 0`. + */ + + /** * @classdesc * Class for layer sources providing vector data divided into a tile grid, to be @@ -23,7 +67,7 @@ import {createXYZ, extentFromProjection, createForProjection} from '../tilegrid. * @constructor * @fires ol.source.Tile.Event * @extends {ol.source.UrlTile} - * @param {olx.source.VectorTileOptions} options Vector tile options. + * @param {module:ol/source/VectorTile~Options=} options Vector tile options. * @api */ const VectorTileSource = function(options) { diff --git a/src/ol/source/WMTS.js b/src/ol/source/WMTS.js index ba4cd19bba..e1d43cdea5 100644 --- a/src/ol/source/WMTS.js +++ b/src/ol/source/WMTS.js @@ -12,13 +12,96 @@ import WMTSRequestEncoding from '../source/WMTSRequestEncoding.js'; import {createFromCapabilitiesMatrixSet} from '../tilegrid/WMTS.js'; import {appendParams} from '../uri.js'; +/** + * @typedef {Object} Options + * @property {ol.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 + * {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} for more detail. + * @property {ol.tilegrid.WMTS} tileGrid Tile grid. + * @property {module:ol/proj~ProjectionLike} projection Projection. + * @property {boolean} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels). + * Higher values can increase reprojection performance, but decrease precision. + * @property {ol.source.WMTSRequestEncoding|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 {function(new: ol.ImageTile, ol.TileCoord, + * ol.TileState, string, ?string, + * ol.TileLoadFunctionType)} [tileClass] Class used to instantiate image tiles. Default is {@link ol.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` + * should be set to `2`. + * @property {string} [version='image/jpeg'] Image format. + * @property {string} [format='1.0.0'] WMTS version. + * @property {string} matrixSet Matrix set. + * @property {!Object} [dimensions] Additional "dimensions" for tile requests. + * This is an object with properties named like the advertised WMTS dimensions. + * @property {string} [url] A URL for the service. + * For the RESTful request encoding, this is a URL + * 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 {ol.TileLoadFunctionType} [tileLoadFunction] Optional function to load a tile given a URL. The default is + * ```js + * function(imageTile, src) { + * imageTile.getImage().src = src; + * }; + * ``` + * @property {Array.} [urls] An array of URLs. + * Requests will be distributed among the URLs in this array. + * @property {boolean} [wrapX=false] Whether to wrap the world horizontally. + * @property {number} [transition] Duration of the opacity transition for rendering. + * To disable the opacity transition, pass `transition: 0`. + + + * 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 {number} [gutter=0] + * The size in pixels of the gutter around image tiles to ignore. By setting + * this property to a non-zero value, images will be requested that are wider + * and taller than the tile size by a value of `2 x gutter`. + * Using a non-zero value allows artifacts of rendering at tile edges to be + * ignored. If you control the WMS service it is recommended to address + * "artifacts at tile edges" issues by properly configuring the WMS service. For + * example, MapServer has a `tile_map_edge_buffer` configuration parameter for + * 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 {function(new: ol.ImageTile, ol.TileCoord, + * ol.TileState, string, ?string, + * ol.TileLoadFunctionType)} [tileClass] Class used to instantiate image tiles. + * Default is {@link ol.ImageTile}. + * @property {ol.tilegrid.TileGrid} [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 {ol.source.WMSServerType|string} [serverType] + * The type of the remote WMS server. Currently only used when `hidpi` is + * `true`. + * @property {string} [url] WMS service URL. + * @property {Array.} [urls] WMS service urls. + * Use this instead of `url` when the WMS supports multiple urls for GetMap requests. + * @property {boolean} [wrapX=true] Whether to wrap the world horizontally. + * When set to `false`, only one world + * will be rendered. When `true`, tiles will be requested for one world only, + * but they will be wrapped horizontally to render multiple worlds. + * @property {number} [transition] Duration of the opacity transition for rendering. + * To disable the opacity transition, pass `transition: 0`. + */ + + /** * @classdesc * Layer source for tile data from WMTS servers. * * @constructor * @extends {ol.source.TileImage} - * @param {olx.source.WMTSOptions} options WMTS options. + * @param {module:ol/source/WMTS~Options=} options WMTS options. * @api */ const WMTS = function(options) { diff --git a/src/ol/source/XYZ.js b/src/ol/source/XYZ.js index 151793a641..fe4c8846d2 100644 --- a/src/ol/source/XYZ.js +++ b/src/ol/source/XYZ.js @@ -5,6 +5,45 @@ import {inherits} from '../index.js'; import TileImage from '../source/TileImage.js'; import {createXYZ, extentFromProjection} from '../tilegrid.js'; +/** + * @typedef {Object} Options + * @property {ol.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 + * {@link 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 {boolean} [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} [maxZoom=0] Optional min zoom level. + * @property {ol.tilegrid.WMTS} tileGrid Tile grid. + * @property {ol.TileLoadFunctionType} [tileLoadFunction] Optional function to load a tile given a URL. The default is + * ```js + * function(imageTile, src) { + * imageTile.getImage().src = src; + * }; + * ``` + * @property {number} [tilePixelRatio=1] The pixel ratio used by the tile service. + * For example, if the tile service advertizes 256px by 256px tiles but actually sends 512px + * by 512px images (for retina/hidpi devices) then `tilePixelRatio` + * should be set to `2`. + * @property {number|ol.Size} [tileSize=[256, 256]] The tile size used by the tile service. + * @property {ol.TileUrlFunctionType} [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}`, + * and `{z}` placeholders. A `{?-?}` template pattern, for example `subdomain{a-f}.domain.com`, + * may be used instead of defining each one separately in the `urls` option. + * @property {Array.} [urls] An array of URL templates. + * @property {boolean} [wrapX=true] Whether to wrap the world horizontally. + * @property {number} [transition] Duration of the opacity transition for rendering. + * To disable the opacity transition, pass `transition: 0`. + */ + + /** * @classdesc * Layer source for tile data with URLs in a set XYZ format that are @@ -24,7 +63,7 @@ import {createXYZ, extentFromProjection} from '../tilegrid.js'; * * @constructor * @extends {ol.source.TileImage} - * @param {olx.source.XYZOptions=} opt_options XYZ options. + * @param {module:ol/source/XYZ~Options=} opt_options XYZ options. * @api */ const XYZ = function(opt_options) { diff --git a/src/ol/source/Zoomify.js b/src/ol/source/Zoomify.js index 0f4cb01845..59cc753fed 100644 --- a/src/ol/source/Zoomify.js +++ b/src/ol/source/Zoomify.js @@ -79,6 +79,41 @@ CustomTile.prototype.getImage = function() { }; +/** + * @typedef {Object} Options + * @property {ol.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 + * {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} for more detail. + * @property {module:ol/proj~ProjectionLike} [projection] Projection. + * @property {boolean} [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. + * A base URL is the fixed part + * of the URL, excluding the tile group, z, x, and y folder structure, e.g. + * `http://my.zoomify.info/IMAGE.TIF/`. A URL template must include + * `{TileGroup}`, `{x}`, `{y}`, and `{z}` placeholders, e.g. + * `http://my.zoomify.info/IMAGE.TIF/{TileGroup}/{z}-{x}-{y}.jpg`. + * Internet Imaging Protocol (IIP) with JTL extension can be also used with + * `{tileIndex}` and `{z}` placeholders, e.g. + * `http://my.zoomify.info?FIF=IMAGE.TIF&JTL={z},{tileIndex}`. + * 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 {ol.Size} [size] Size of the image. + * @property {ol.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 + * as `[0, 0, width, height]`. + * @property {number} [transition] Duration of the opacity transition for rendering. + * To disable the opacity transition, pass `transition: 0`. + * @property {number} [tileSize=256] Tile size. Same tile size is used for all zoom levels. + */ + + /** * @classdesc * Layer source for tile data in Zoomify format (both Zoomify and Internet @@ -86,7 +121,7 @@ CustomTile.prototype.getImage = function() { * * @constructor * @extends {ol.source.TileImage} - * @param {olx.source.ZoomifyOptions=} opt_options Options. + * @param {module:ol/source/Zoomify~Options=} opt_options Options. * @api */ const Zoomify = function(opt_options) { diff --git a/src/ol/typedefs.js b/src/ol/typedefs.js index f4c40033cd..9ae0b8405e 100644 --- a/src/ol/typedefs.js +++ b/src/ol/typedefs.js @@ -217,40 +217,6 @@ ol.ReprojTriangle; ol.SourceRasterRenderedState; -/** - * @typedef {{attributions: (ol.AttributionLike|undefined), - * cacheSize: (number|undefined), - * extent: (module:ol/extent~Extent|undefined), - * opaque: (boolean|undefined), - * tilePixelRatio: (number|undefined), - * projection: module:ol/proj~ProjectionLike, - * state: (ol.source.State|undefined), - * tileGrid: (ol.tilegrid.TileGrid|undefined), - * wrapX: (boolean|undefined), - * transition: (number|undefined)}} - */ -ol.SourceTileOptions; - - -/** - * @typedef {{attributions: (ol.AttributionLike|undefined), - * cacheSize: (number|undefined), - * extent: (module:ol/extent~Extent|undefined), - * opaque: (boolean|undefined), - * projection: module:ol/proj~ProjectionLike, - * state: (ol.source.State|undefined), - * tileGrid: (ol.tilegrid.TileGrid|undefined), - * tileLoadFunction: module:ol/Tile~LoadFunction, - * tilePixelRatio: (number|undefined), - * tileUrlFunction: (module:ol/Tile~UrlFunction|undefined), - * url: (string|undefined), - * urls: (Array.|undefined), - * wrapX: (boolean|undefined), - * transition: (number|undefined)}} - */ -ol.SourceUrlTileOptions; - - /** * A function that takes an {@link module:ol/Feature~Feature} as argument and returns an * {@link module:ol/geom/Geometry~Geometry} that will be rendered and styled for the feature.