From d75623084e462997b5c97a64c5216963364c12fe Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Mon, 8 Jan 2018 10:10:20 -0700 Subject: [PATCH] Rename _ol_source_Image_ to ImageSource --- src/ol/source/Image.js | 30 +++++++++---------- src/ol/source/ImageArcGISRest.js | 8 ++--- src/ol/source/ImageCanvas.js | 6 ++-- src/ol/source/ImageMapGuide.js | 8 ++--- src/ol/source/ImageStatic.js | 10 +++---- src/ol/source/ImageWMS.js | 8 ++--- src/ol/source/Raster.js | 8 ++--- test/spec/ol/imagetile.test.js | 10 +++---- .../spec/ol/renderer/webgl/imagelayer.test.js | 4 +-- test/spec/ol/tilequeue.test.js | 4 +-- 10 files changed, 48 insertions(+), 48 deletions(-) diff --git a/src/ol/source/Image.js b/src/ol/source/Image.js index fa484c8d62..cf7e354042 100644 --- a/src/ol/source/Image.js +++ b/src/ol/source/Image.js @@ -23,7 +23,7 @@ import Source from '../source/Source.js'; * @param {ol.SourceImageOptions} options Single image source options. * @api */ -var _ol_source_Image_ = function(options) { +var ImageSource = function(options) { Source.call(this, { attributions: options.attributions, extent: options.extent, @@ -53,14 +53,14 @@ var _ol_source_Image_ = function(options) { this.reprojectedRevision_ = 0; }; -inherits(_ol_source_Image_, Source); +inherits(ImageSource, Source); /** * @return {Array.} Resolutions. * @override */ -_ol_source_Image_.prototype.getResolutions = function() { +ImageSource.prototype.getResolutions = function() { return this.resolutions_; }; @@ -70,7 +70,7 @@ _ol_source_Image_.prototype.getResolutions = function() { * @param {number} resolution Resolution. * @return {number} Resolution. */ -_ol_source_Image_.prototype.findNearestResolution = function(resolution) { +ImageSource.prototype.findNearestResolution = function(resolution) { if (this.resolutions_) { var idx = linearFindNearest(this.resolutions_, resolution, 0); resolution = this.resolutions_[idx]; @@ -86,7 +86,7 @@ _ol_source_Image_.prototype.findNearestResolution = function(resolution) { * @param {ol.proj.Projection} projection Projection. * @return {ol.ImageBase} Single image. */ -_ol_source_Image_.prototype.getImage = function(extent, resolution, pixelRatio, projection) { +ImageSource.prototype.getImage = function(extent, resolution, pixelRatio, projection) { var sourceProjection = this.getProjection(); if (!ENABLE_RASTER_REPROJECTION || !sourceProjection || @@ -131,7 +131,7 @@ _ol_source_Image_.prototype.getImage = function(extent, resolution, pixelRatio, * @return {ol.ImageBase} Single image. * @protected */ -_ol_source_Image_.prototype.getImageInternal = function(extent, resolution, pixelRatio, projection) {}; +ImageSource.prototype.getImageInternal = function(extent, resolution, pixelRatio, projection) {}; /** @@ -139,22 +139,22 @@ _ol_source_Image_.prototype.getImageInternal = function(extent, resolution, pixe * @param {ol.events.Event} event Event. * @protected */ -_ol_source_Image_.prototype.handleImageChange = function(event) { +ImageSource.prototype.handleImageChange = function(event) { var image = /** @type {ol.Image} */ (event.target); switch (image.getState()) { case ImageState.LOADING: this.dispatchEvent( - new _ol_source_Image_.Event(_ol_source_Image_.EventType_.IMAGELOADSTART, + new ImageSource.Event(ImageSource.EventType_.IMAGELOADSTART, image)); break; case ImageState.LOADED: this.dispatchEvent( - new _ol_source_Image_.Event(_ol_source_Image_.EventType_.IMAGELOADEND, + new ImageSource.Event(ImageSource.EventType_.IMAGELOADEND, image)); break; case ImageState.ERROR: this.dispatchEvent( - new _ol_source_Image_.Event(_ol_source_Image_.EventType_.IMAGELOADERROR, + new ImageSource.Event(ImageSource.EventType_.IMAGELOADERROR, image)); break; default: @@ -169,7 +169,7 @@ _ol_source_Image_.prototype.handleImageChange = function(event) { * @param {ol.Image} image Image. * @param {string} src Source. */ -_ol_source_Image_.defaultImageLoadFunction = function(image, src) { +ImageSource.defaultImageLoadFunction = function(image, src) { image.getImage().src = src; }; @@ -185,7 +185,7 @@ _ol_source_Image_.defaultImageLoadFunction = function(image, src) { * @param {string} type Type. * @param {ol.Image} image The image. */ -_ol_source_Image_.Event = function(type, image) { +ImageSource.Event = function(type, image) { Event.call(this, type); @@ -197,14 +197,14 @@ _ol_source_Image_.Event = function(type, image) { this.image = image; }; -inherits(_ol_source_Image_.Event, Event); +inherits(ImageSource.Event, Event); /** * @enum {string} * @private */ -_ol_source_Image_.EventType_ = { +ImageSource.EventType_ = { /** * Triggered when an image starts loading. @@ -228,4 +228,4 @@ _ol_source_Image_.EventType_ = { IMAGELOADERROR: 'imageloaderror' }; -export default _ol_source_Image_; +export default ImageSource; diff --git a/src/ol/source/ImageArcGISRest.js b/src/ol/source/ImageArcGISRest.js index ca9092dbf0..ed4ca3d26e 100644 --- a/src/ol/source/ImageArcGISRest.js +++ b/src/ol/source/ImageArcGISRest.js @@ -8,7 +8,7 @@ import _ol_events_ from '../events.js'; import EventType from '../events/EventType.js'; import {containsExtent, getHeight, getWidth} from '../extent.js'; import _ol_obj_ from '../obj.js'; -import _ol_source_Image_ from '../source/Image.js'; +import ImageSource from '../source/Image.js'; import _ol_uri_ from '../uri.js'; /** @@ -30,7 +30,7 @@ var _ol_source_ImageArcGISRest_ = function(opt_options) { var options = opt_options || {}; - _ol_source_Image_.call(this, { + ImageSource.call(this, { attributions: options.attributions, projection: options.projection, resolutions: options.resolutions @@ -60,7 +60,7 @@ var _ol_source_ImageArcGISRest_ = function(opt_options) { * @type {ol.ImageLoadFunctionType} */ this.imageLoadFunction_ = options.imageLoadFunction !== undefined ? - options.imageLoadFunction : _ol_source_Image_.defaultImageLoadFunction; + options.imageLoadFunction : ImageSource.defaultImageLoadFunction; /** @@ -96,7 +96,7 @@ var _ol_source_ImageArcGISRest_ = function(opt_options) { }; -inherits(_ol_source_ImageArcGISRest_, _ol_source_Image_); +inherits(_ol_source_ImageArcGISRest_, ImageSource); /** diff --git a/src/ol/source/ImageCanvas.js b/src/ol/source/ImageCanvas.js index 26a98e7f44..eb47c6a388 100644 --- a/src/ol/source/ImageCanvas.js +++ b/src/ol/source/ImageCanvas.js @@ -4,7 +4,7 @@ import {inherits} from '../index.js'; import _ol_ImageCanvas_ from '../ImageCanvas.js'; import {containsExtent, getHeight, getWidth, scaleFromCenter} from '../extent.js'; -import _ol_source_Image_ from '../source/Image.js'; +import ImageSource from '../source/Image.js'; /** * @classdesc @@ -17,7 +17,7 @@ import _ol_source_Image_ from '../source/Image.js'; */ var _ol_source_ImageCanvas_ = function(options) { - _ol_source_Image_.call(this, { + ImageSource.call(this, { attributions: options.attributions, projection: options.projection, resolutions: options.resolutions, @@ -51,7 +51,7 @@ var _ol_source_ImageCanvas_ = function(options) { }; -inherits(_ol_source_ImageCanvas_, _ol_source_Image_); +inherits(_ol_source_ImageCanvas_, ImageSource); /** diff --git a/src/ol/source/ImageMapGuide.js b/src/ol/source/ImageMapGuide.js index dcd10d84b4..ee437adba5 100644 --- a/src/ol/source/ImageMapGuide.js +++ b/src/ol/source/ImageMapGuide.js @@ -7,7 +7,7 @@ import _ol_events_ from '../events.js'; import EventType from '../events/EventType.js'; import {containsExtent, getCenter, getHeight, getWidth, scaleFromCenter} from '../extent.js'; import _ol_obj_ from '../obj.js'; -import _ol_source_Image_ from '../source/Image.js'; +import ImageSource from '../source/Image.js'; import _ol_uri_ from '../uri.js'; /** @@ -22,7 +22,7 @@ import _ol_uri_ from '../uri.js'; */ var _ol_source_ImageMapGuide_ = function(options) { - _ol_source_Image_.call(this, { + ImageSource.call(this, { projection: options.projection, resolutions: options.resolutions }); @@ -58,7 +58,7 @@ var _ol_source_ImageMapGuide_ = function(options) { * @type {ol.ImageLoadFunctionType} */ this.imageLoadFunction_ = options.imageLoadFunction !== undefined ? - options.imageLoadFunction : _ol_source_Image_.defaultImageLoadFunction; + options.imageLoadFunction : ImageSource.defaultImageLoadFunction; /** * @private @@ -100,7 +100,7 @@ var _ol_source_ImageMapGuide_ = function(options) { }; -inherits(_ol_source_ImageMapGuide_, _ol_source_Image_); +inherits(_ol_source_ImageMapGuide_, ImageSource); /** diff --git a/src/ol/source/ImageStatic.js b/src/ol/source/ImageStatic.js index 4c269736d2..e843e0f45f 100644 --- a/src/ol/source/ImageStatic.js +++ b/src/ol/source/ImageStatic.js @@ -9,7 +9,7 @@ import _ol_events_ from '../events.js'; import EventType from '../events/EventType.js'; import {intersects, getHeight, getWidth} from '../extent.js'; import {get as getProjection} from '../proj.js'; -import _ol_source_Image_ from '../source/Image.js'; +import ImageSource from '../source/Image.js'; /** * @classdesc @@ -28,9 +28,9 @@ var _ol_source_ImageStatic_ = function(options) { var /** @type {ol.ImageLoadFunctionType} */ imageLoadFunction = options.imageLoadFunction !== undefined ? - options.imageLoadFunction : _ol_source_Image_.defaultImageLoadFunction; + options.imageLoadFunction : ImageSource.defaultImageLoadFunction; - _ol_source_Image_.call(this, { + ImageSource.call(this, { attributions: options.attributions, projection: getProjection(options.projection) }); @@ -52,7 +52,7 @@ var _ol_source_ImageStatic_ = function(options) { }; -inherits(_ol_source_ImageStatic_, _ol_source_Image_); +inherits(_ol_source_ImageStatic_, ImageSource); /** @@ -91,6 +91,6 @@ _ol_source_ImageStatic_.prototype.handleImageChange = function(evt) { this.image_.setImage(canvas); } } - _ol_source_Image_.prototype.handleImageChange.call(this, evt); + ImageSource.prototype.handleImageChange.call(this, evt); }; export default _ol_source_ImageStatic_; diff --git a/src/ol/source/ImageWMS.js b/src/ol/source/ImageWMS.js index f510358031..9d973d2661 100644 --- a/src/ol/source/ImageWMS.js +++ b/src/ol/source/ImageWMS.js @@ -12,7 +12,7 @@ import {containsExtent, getCenter, getForViewAndSize, getHeight, getWidth} from import _ol_obj_ from '../obj.js'; import {get as getProjection, transform} from '../proj.js'; import _ol_reproj_ from '../reproj.js'; -import _ol_source_Image_ from '../source/Image.js'; +import ImageSource from '../source/Image.js'; import WMSServerType from '../source/WMSServerType.js'; import _ol_string_ from '../string.js'; import _ol_uri_ from '../uri.js'; @@ -31,7 +31,7 @@ var _ol_source_ImageWMS_ = function(opt_options) { var options = opt_options || {}; - _ol_source_Image_.call(this, { + ImageSource.call(this, { attributions: options.attributions, projection: options.projection, resolutions: options.resolutions @@ -55,7 +55,7 @@ var _ol_source_ImageWMS_ = function(opt_options) { * @type {ol.ImageLoadFunctionType} */ this.imageLoadFunction_ = options.imageLoadFunction !== undefined ? - options.imageLoadFunction : _ol_source_Image_.defaultImageLoadFunction; + options.imageLoadFunction : ImageSource.defaultImageLoadFunction; /** * @private @@ -108,7 +108,7 @@ var _ol_source_ImageWMS_ = function(opt_options) { }; -inherits(_ol_source_ImageWMS_, _ol_source_Image_); +inherits(_ol_source_ImageWMS_, ImageSource); /** diff --git a/src/ol/source/Raster.js b/src/ol/source/Raster.js index 2b72acb403..94f283e61c 100644 --- a/src/ol/source/Raster.js +++ b/src/ol/source/Raster.js @@ -15,7 +15,7 @@ import TileLayer from '../layer/Tile.js'; import _ol_obj_ from '../obj.js'; import CanvasImageLayerRenderer from '../renderer/canvas/ImageLayer.js'; import CanvasTileLayerRenderer from '../renderer/canvas/TileLayer.js'; -import _ol_source_Image_ from '../source/Image.js'; +import ImageSource from '../source/Image.js'; import RasterOperationType from '../source/RasterOperationType.js'; import SourceState from '../source/State.js'; import _ol_source_Tile_ from '../source/Tile.js'; @@ -149,7 +149,7 @@ var RasterSource = function(options) { wantedTiles: {} }; - _ol_source_Image_.call(this, {}); + ImageSource.call(this, {}); if (options.operation !== undefined) { this.setOperation(options.operation, options.lib); @@ -157,7 +157,7 @@ var RasterSource = function(options) { }; -inherits(RasterSource, _ol_source_Image_); +inherits(RasterSource, ImageSource); /** @@ -400,7 +400,7 @@ function createRenderer(source) { var renderer = null; if (source instanceof _ol_source_Tile_) { renderer = createTileRenderer(source); - } else if (source instanceof _ol_source_Image_) { + } else if (source instanceof ImageSource) { renderer = createImageRenderer(source); } return renderer; diff --git a/test/spec/ol/imagetile.test.js b/test/spec/ol/imagetile.test.js index 4fed6479ae..85ca753fce 100644 --- a/test/spec/ol/imagetile.test.js +++ b/test/spec/ol/imagetile.test.js @@ -2,7 +2,7 @@ import ImageTile from '../../../src/ol/ImageTile.js'; import TileState from '../../../src/ol/TileState.js'; import _ol_events_ from '../../../src/ol/events.js'; import EventType from '../../../src/ol/events/EventType.js'; -import _ol_source_Image_ from '../../../src/ol/source/Image.js'; +import ImageSource from '../../../src/ol/source/Image.js'; describe('ol.ImageTile', function() { @@ -13,7 +13,7 @@ describe('ol.ImageTile', function() { var tileCoord = [0, 0, 0]; var state = TileState.IDLE; var src = 'spec/ol/data/osm-0-0-0.png'; - var tileLoadFunction = _ol_source_Image_.defaultImageLoadFunction; + var tileLoadFunction = ImageSource.defaultImageLoadFunction; var tile = new ImageTile(tileCoord, state, src, null, tileLoadFunction); var previousState = tile.getState(); @@ -38,7 +38,7 @@ describe('ol.ImageTile', function() { var tileCoord = [0, 0, 0]; var state = TileState.ERROR; var src = 'spec/ol/data/osm-0-0-0.png'; - var tileLoadFunction = _ol_source_Image_.defaultImageLoadFunction; + var tileLoadFunction = ImageSource.defaultImageLoadFunction; var tile = new ImageTile(tileCoord, state, src, null, tileLoadFunction); var previousState = tile.getState(); @@ -63,7 +63,7 @@ describe('ol.ImageTile', function() { var tileCoord = [0, 0, 0]; var state = TileState.IDLE; var src = 'spec/ol/data/osm-0-0-99.png'; - var tileLoadFunction = _ol_source_Image_.defaultImageLoadFunction; + var tileLoadFunction = ImageSource.defaultImageLoadFunction; var tile = new ImageTile(tileCoord, state, src, null, tileLoadFunction); var key = _ol_events_.listen(tile, EventType.CHANGE, function(event) { @@ -89,7 +89,7 @@ describe('ol.ImageTile', function() { var tileCoord = [0, 0, 0]; var state = TileState.IDLE; var src = 'spec/ol/data/osm-0-0-0.png'; - var tileLoadFunction = _ol_source_Image_.defaultImageLoadFunction; + var tileLoadFunction = ImageSource.defaultImageLoadFunction; var tile = new ImageTile(tileCoord, state, src, null, tileLoadFunction); tile.load(); expect(tile.getState()).to.be(TileState.LOADING); diff --git a/test/spec/ol/renderer/webgl/imagelayer.test.js b/test/spec/ol/renderer/webgl/imagelayer.test.js index 0553f04ada..3ce5d6f0f1 100644 --- a/test/spec/ol/renderer/webgl/imagelayer.test.js +++ b/test/spec/ol/renderer/webgl/imagelayer.test.js @@ -1,7 +1,7 @@ import _ol_transform_ from '../../../../../src/ol/transform.js'; import Map from '../../../../../src/ol/Map.js'; import ImageLayer from '../../../../../src/ol/layer/Image.js'; -import _ol_source_Image_ from '../../../../../src/ol/source/Image.js'; +import ImageSource from '../../../../../src/ol/source/Image.js'; import WebGLImageLayerRenderer from '../../../../../src/ol/renderer/webgl/ImageLayer.js'; @@ -22,7 +22,7 @@ describe('ol.renderer.webgl.ImageLayer', function() { target: document.createElement('div') }); var layer = new ImageLayer({ - source: new _ol_source_Image_({ + source: new ImageSource({ extent: [0, 0, 1, 1] }) }); diff --git a/test/spec/ol/tilequeue.test.js b/test/spec/ol/tilequeue.test.js index 2b62283534..9de2401f78 100644 --- a/test/spec/ol/tilequeue.test.js +++ b/test/spec/ol/tilequeue.test.js @@ -2,7 +2,7 @@ import ImageTile from '../../../src/ol/ImageTile.js'; import _ol_Tile_ from '../../../src/ol/Tile.js'; import TileQueue from '../../../src/ol/TileQueue.js'; import TileState from '../../../src/ol/TileState.js'; -import _ol_source_Image_ from '../../../src/ol/source/Image.js'; +import ImageSource from '../../../src/ol/source/Image.js'; import PriorityQueue from '../../../src/ol/structs/PriorityQueue.js'; @@ -32,7 +32,7 @@ describe('ol.TileQueue', function() { 'yH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=='; var tileLoadFunction = opt_tileLoadFunction ? - opt_tileLoadFunction : _ol_source_Image_.defaultImageLoadFunction; + opt_tileLoadFunction : ImageSource.defaultImageLoadFunction; return new ImageTile(tileCoord, state, src, null, tileLoadFunction); }