diff --git a/externs/olx.js b/externs/olx.js index b8662f75f9..bd21e42790 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -241,189 +241,6 @@ olx.source.TileArcGISRestOptions.prototype.transition; olx.source.TileArcGISRestOptions.prototype.urls; -/** - * @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), diff --git a/src/ol/source/TileWMS.js b/src/ol/source/TileWMS.js index c207d78605..1583a8f03a 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 {ol.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=undefined] + * 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) {