Remove olx.source.WMTSOptions

This commit is contained in:
Florent gravin
2018-03-29 10:00:28 +02:00
parent 798119c9c8
commit 5de33d066b
2 changed files with 84 additions and 208 deletions

View File

@@ -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 {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 {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.<string>} [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=undefined]
* The type of the remote WMS server. Currently only used when `hidpi` is
* `true`.
* @property {string} [url] WMS service URL.
* @property {Array.<string>} [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) {