Merge pull request #8471 from samuel-girard/imagestatic_properties

Add getUrl and getImageExtent to ImageStatic API
This commit is contained in:
Frédéric Junod
2018-08-03 09:22:53 +02:00
committed by GitHub

View File

@@ -38,8 +38,6 @@ class Static extends ImageSource {
* @param {module:ol/source/ImageStatic~Options=} options ImageStatic options.
*/
constructor(options) {
const imageExtent = options.imageExtent;
const crossOrigin = options.crossOrigin !== undefined ?
options.crossOrigin : null;
@@ -52,11 +50,23 @@ class Static extends ImageSource {
projection: getProjection(options.projection)
});
/**
* @private
* @type {string}
*/
this.url_ = options.url;
/**
* @private
* @type {module:ol/extent~Extent}
*/
this.imageExtent_ = options.imageExtent;
/**
* @private
* @type {module:ol/Image}
*/
this.image_ = new ImageWrapper(imageExtent, undefined, 1, options.url, crossOrigin, imageLoadFunction);
this.image_ = new ImageWrapper(this.imageExtent_, undefined, 1, this.url_, crossOrigin, imageLoadFunction);
/**
* @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
*/
@@ -79,6 +98,15 @@ class Static extends ImageSource {
return null;
}
/**
* Return the URL used for this image source.
* @return {string} URL.
* @api
*/
getUrl() {
return this.url_;
}
/**
* @inheritDoc
*/