Move olx.source.ImageCanvasOptions to ol/source/ImageCanvasOptions

This commit is contained in:
Florent gravin
2018-03-28 15:21:05 +02:00
parent 749f96d967
commit 3d90a4587c
2 changed files with 22 additions and 78 deletions

View File

@@ -704,83 +704,6 @@ olx.source.OSMOptions.prototype.tileLoadFunction;
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.<number>|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.<number>|undefined}
* @api
*/
olx.source.ImageCanvasOptions.prototype.resolutions;
/**
* Source state.
* @type {ol.source.State|undefined}
* @api
*/
olx.source.ImageCanvasOptions.prototype.state;
/**
* @typedef {{sources: Array.<ol.source.Source>,
* operation: (ol.RasterOperation|undefined),

View File

@@ -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
* `dispatchChangeEvent` should be called on the source for the source to
* invalidate the current cached image.
* @property {ol.ProjectionLike} projection Projection.
* @property {number} [ratio=1.5] Ratio. 1 means canvases are the size of the map viewport, 2 means twice the
* width and height of the map viewport, and so on. Must be `1` or higher.
* @property {Array.<number>} [resolutions] Resolutions.
* If specified, new canvases will be created for these resolutions
* @property {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) {