Add getUrl and getImageExtent to ImageStatic API

This commit is contained in:
Samuel Girard
2018-08-01 12:23:38 +02:00
parent c74faaa7ca
commit e48c85a689
+31 -3
View File
@@ -38,8 +38,6 @@ class Static extends ImageSource {
* @param {module:ol/source/ImageStatic~Options=} options ImageStatic options. * @param {module:ol/source/ImageStatic~Options=} options ImageStatic options.
*/ */
constructor(options) { constructor(options) {
const imageExtent = options.imageExtent;
const crossOrigin = options.crossOrigin !== undefined ? const crossOrigin = options.crossOrigin !== undefined ?
options.crossOrigin : null; options.crossOrigin : null;
@@ -52,11 +50,23 @@ class Static extends ImageSource {
projection: getProjection(options.projection) projection: getProjection(options.projection)
}); });
/**
* @private
* @type {string}
*/
this.url_ = options.url;
/**
* @private
* @type {module:ol/extent~Extent}
*/
this.imageExtent_ = options.imageExtent;
/** /**
* @private * @private
* @type {module:ol/Image} * @type {module:ol/Image}
*/ */
this.image_ = new ImageWrapper(imageExtent, undefined, 1, options.url, crossOrigin, imageLoadFunction); this.image_ = new ImageWrapper(this.imageExtent_, undefined, 1, options.url, crossOrigin, imageLoadFunction);
/** /**
* @private * @private
@@ -69,6 +79,15 @@ class Static extends ImageSource {
} }
/**
* Returns the image extent
* @return {module:ol/extent~Extent} image extent.
* @api
*/
getImageExtent() {
return this.imageExtent_;
}
/** /**
* @inheritDoc * @inheritDoc
*/ */
@@ -79,6 +98,15 @@ class Static extends ImageSource {
return null; return null;
} }
/**
* Return the URL used for this image source.
* @return {string} URL.
* @api
*/
getUrl() {
return this.url_;
}
/** /**
* @inheritDoc * @inheritDoc
*/ */