Move olx.source.OSMOptions to ol/source/OSMOptions

This commit is contained in:
Florent gravin
2018-03-28 16:16:38 +02:00
parent 125a54ff1e
commit 4e32fd8975
2 changed files with 25 additions and 92 deletions

View File

@@ -515,97 +515,6 @@ olx.source.TileDebugOptions.prototype.tileGrid;
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;
/**
* @typedef {{sources: Array.<ol.source.Source>,
* operation: (ol.RasterOperation|undefined),

View File

@@ -17,13 +17,37 @@ export const ATTRIBUTION = '&copy; ' +
'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) {