diff --git a/src/ol/Image.js b/src/ol/Image.js index 0a5d7c2e52..1f97188232 100644 --- a/src/ol/Image.js +++ b/src/ol/Image.js @@ -18,7 +18,7 @@ import {getHeight} from './extent.js'; * @param {?string} crossOrigin Cross origin. * @param {ol.ImageLoadFunctionType} imageLoadFunction Image load function. */ -const _ol_Image_ = function(extent, resolution, pixelRatio, src, crossOrigin, imageLoadFunction) { +const ImageWrapper = function(extent, resolution, pixelRatio, src, crossOrigin, imageLoadFunction) { ImageBase.call(this, extent, resolution, pixelRatio, ImageState.IDLE); @@ -57,14 +57,14 @@ const _ol_Image_ = function(extent, resolution, pixelRatio, src, crossOrigin, im }; -inherits(_ol_Image_, ImageBase); +inherits(ImageWrapper, ImageBase); /** * @inheritDoc * @api */ -_ol_Image_.prototype.getImage = function() { +ImageWrapper.prototype.getImage = function() { return this.image_; }; @@ -74,7 +74,7 @@ _ol_Image_.prototype.getImage = function() { * * @private */ -_ol_Image_.prototype.handleImageError_ = function() { +ImageWrapper.prototype.handleImageError_ = function() { this.state = ImageState.ERROR; this.unlistenImage_(); this.changed(); @@ -86,7 +86,7 @@ _ol_Image_.prototype.handleImageError_ = function() { * * @private */ -_ol_Image_.prototype.handleImageLoad_ = function() { +ImageWrapper.prototype.handleImageLoad_ = function() { if (this.resolution === undefined) { this.resolution = getHeight(this.extent) / this.image_.height; } @@ -103,7 +103,7 @@ _ol_Image_.prototype.handleImageLoad_ = function() { * @override * @api */ -_ol_Image_.prototype.load = function() { +ImageWrapper.prototype.load = function() { if (this.state == ImageState.IDLE || this.state == ImageState.ERROR) { this.state = ImageState.LOADING; this.changed(); @@ -121,7 +121,7 @@ _ol_Image_.prototype.load = function() { /** * @param {HTMLCanvasElement|Image|HTMLVideoElement} image Image. */ -_ol_Image_.prototype.setImage = function(image) { +ImageWrapper.prototype.setImage = function(image) { this.image_ = image; }; @@ -131,8 +131,9 @@ _ol_Image_.prototype.setImage = function(image) { * * @private */ -_ol_Image_.prototype.unlistenImage_ = function() { +ImageWrapper.prototype.unlistenImage_ = function() { this.imageListenerKeys_.forEach(unlistenByKey); this.imageListenerKeys_ = null; }; -export default _ol_Image_; + +export default ImageWrapper; diff --git a/src/ol/source/ImageArcGISRest.js b/src/ol/source/ImageArcGISRest.js index b4ac699b67..6a4b5e600d 100644 --- a/src/ol/source/ImageArcGISRest.js +++ b/src/ol/source/ImageArcGISRest.js @@ -2,7 +2,7 @@ * @module ol/source/ImageArcGISRest */ import {inherits} from '../index.js'; -import _ol_Image_ from '../Image.js'; +import ImageWrapper from '../Image.js'; import {assert} from '../asserts.js'; import {listen} from '../events.js'; import EventType from '../events/EventType.js'; @@ -168,7 +168,7 @@ ImageArcGISRest.prototype.getImageInternal = function(extent, resolution, pixelR const url = this.getRequestUrl_(extent, this.imageSize_, pixelRatio, projection, params); - this.image_ = new _ol_Image_(extent, resolution, pixelRatio, + this.image_ = new ImageWrapper(extent, resolution, pixelRatio, url, this.crossOrigin_, this.imageLoadFunction_); this.renderedRevision_ = this.getRevision(); diff --git a/src/ol/source/ImageMapGuide.js b/src/ol/source/ImageMapGuide.js index 51ff3227b5..59eb0b5249 100644 --- a/src/ol/source/ImageMapGuide.js +++ b/src/ol/source/ImageMapGuide.js @@ -2,7 +2,7 @@ * @module ol/source/ImageMapGuide */ import {inherits} from '../index.js'; -import _ol_Image_ from '../Image.js'; +import ImageWrapper from '../Image.js'; import {listen} from '../events.js'; import EventType from '../events/EventType.js'; import {containsExtent, getCenter, getHeight, getWidth, scaleFromCenter} from '../extent.js'; @@ -141,7 +141,7 @@ ImageMapGuide.prototype.getImageInternal = function(extent, resolution, pixelRat if (this.url_ !== undefined) { const imageUrl = this.getUrl(this.url_, this.params_, extent, size, projection); - image = new _ol_Image_(extent, resolution, pixelRatio, + image = new ImageWrapper(extent, resolution, pixelRatio, imageUrl, this.crossOrigin_, this.imageLoadFunction_); listen(image, EventType.CHANGE, diff --git a/src/ol/source/ImageStatic.js b/src/ol/source/ImageStatic.js index d3905980f0..0481f3109b 100644 --- a/src/ol/source/ImageStatic.js +++ b/src/ol/source/ImageStatic.js @@ -2,7 +2,7 @@ * @module ol/source/ImageStatic */ import {inherits} from '../index.js'; -import _ol_Image_ from '../Image.js'; +import ImageWrapper from '../Image.js'; import ImageState from '../ImageState.js'; import {createCanvasContext2D} from '../dom.js'; import {listen} from '../events.js'; @@ -39,7 +39,7 @@ const Static = function(options) { * @private * @type {ol.Image} */ - this.image_ = new _ol_Image_(imageExtent, undefined, 1, options.url, crossOrigin, imageLoadFunction); + this.image_ = new ImageWrapper(imageExtent, undefined, 1, options.url, crossOrigin, imageLoadFunction); /** * @private diff --git a/src/ol/source/ImageWMS.js b/src/ol/source/ImageWMS.js index c69da38e08..f2474ea120 100644 --- a/src/ol/source/ImageWMS.js +++ b/src/ol/source/ImageWMS.js @@ -4,7 +4,7 @@ import {DEFAULT_WMS_VERSION} from './common.js'; import {inherits} from '../index.js'; -import _ol_Image_ from '../Image.js'; +import ImageWrapper from '../Image.js'; import {assert} from '../asserts.js'; import {listen} from '../events.js'; import EventType from '../events/EventType.js'; @@ -231,7 +231,7 @@ ImageWMS.prototype.getImageInternal = function(extent, resolution, pixelRatio, p const url = this.getRequestUrl_(requestExtent, this.imageSize_, pixelRatio, projection, params); - this.image_ = new _ol_Image_(requestExtent, resolution, pixelRatio, + this.image_ = new ImageWrapper(requestExtent, resolution, pixelRatio, url, this.crossOrigin_, this.imageLoadFunction_); this.renderedRevision_ = this.getRevision(); diff --git a/test/spec/ol/renderer/layer.test.js b/test/spec/ol/renderer/layer.test.js index b08609d630..78a3fd0e48 100644 --- a/test/spec/ol/renderer/layer.test.js +++ b/test/spec/ol/renderer/layer.test.js @@ -1,4 +1,4 @@ -import _ol_Image_ from '../../../../src/ol/Image.js'; +import ImageWrapper from '../../../../src/ol/Image.js'; import Map from '../../../../src/ol/Map.js'; import View from '../../../../src/ol/View.js'; import Layer from '../../../../src/ol/layer/Layer.js'; @@ -28,7 +28,7 @@ describe('ol.renderer.Layer', function() { const src = ''; const crossOrigin = ''; imageLoadFunction = sinon.spy(); - image = new _ol_Image_(extent, resolution, pixelRatio, src, crossOrigin, imageLoadFunction); + image = new ImageWrapper(extent, resolution, pixelRatio, src, crossOrigin, imageLoadFunction); }); describe('load IDLE image', function() { diff --git a/test/spec/ol/reproj/image.test.js b/test/spec/ol/reproj/image.test.js index 5bb30fb09b..cc5d05d12b 100644 --- a/test/spec/ol/reproj/image.test.js +++ b/test/spec/ol/reproj/image.test.js @@ -1,4 +1,4 @@ -import _ol_Image_ from '../../../../src/ol/Image.js'; +import ImageWrapper from '../../../../src/ol/Image.js'; import {listen} from '../../../../src/ol/events.js'; import {get as getProjection} from '../../../../src/ol/proj.js'; import ReprojImage from '../../../../src/ol/reproj/Image.js'; @@ -10,7 +10,7 @@ describe('ol.reproj.Image', function() { getProjection('EPSG:3857'), getProjection('EPSG:4326'), [-180, -85, 180, 85], 10, pixelRatio, function(extent, resolution, pixelRatio) { - return new _ol_Image_(extent, resolution, pixelRatio, + return new ImageWrapper(extent, resolution, pixelRatio, 'data:image/gif;base64,' + 'R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=', null, function(image, src) {