diff --git a/examples/arcgis-image.js b/examples/arcgis-image.js index 3ca16e92d8..60fcec4cfc 100644 --- a/examples/arcgis-image.js +++ b/examples/arcgis-image.js @@ -3,7 +3,7 @@ import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; import ImageLayer from '../src/ol/layer/Image.js'; import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -import _ol_source_ImageArcGISRest_ from '../src/ol/source/ImageArcGISRest.js'; +import ImageArcGISRest from '../src/ol/source/ImageArcGISRest.js'; var url = 'https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/' + 'Specialty/ESRI_StateCityHighway_USA/MapServer'; @@ -13,7 +13,7 @@ var layers = [ source: new _ol_source_OSM_() }), new ImageLayer({ - source: new _ol_source_ImageArcGISRest_({ + source: new ImageArcGISRest({ ratio: 1, params: {}, url: url diff --git a/src/ol/source/ImageArcGISRest.js b/src/ol/source/ImageArcGISRest.js index ed4ca3d26e..8ae61c4790 100644 --- a/src/ol/source/ImageArcGISRest.js +++ b/src/ol/source/ImageArcGISRest.js @@ -26,7 +26,7 @@ import _ol_uri_ from '../uri.js'; * @param {olx.source.ImageArcGISRestOptions=} opt_options Image ArcGIS Rest Options. * @api */ -var _ol_source_ImageArcGISRest_ = function(opt_options) { +var ImageArcGISRest = function(opt_options) { var options = opt_options || {}; @@ -96,7 +96,7 @@ var _ol_source_ImageArcGISRest_ = function(opt_options) { }; -inherits(_ol_source_ImageArcGISRest_, ImageSource); +inherits(ImageArcGISRest, ImageSource); /** @@ -105,7 +105,7 @@ inherits(_ol_source_ImageArcGISRest_, ImageSource); * @return {Object} Params. * @api */ -_ol_source_ImageArcGISRest_.prototype.getParams = function() { +ImageArcGISRest.prototype.getParams = function() { return this.params_; }; @@ -113,7 +113,7 @@ _ol_source_ImageArcGISRest_.prototype.getParams = function() { /** * @inheritDoc */ -_ol_source_ImageArcGISRest_.prototype.getImageInternal = function(extent, resolution, pixelRatio, projection) { +ImageArcGISRest.prototype.getImageInternal = function(extent, resolution, pixelRatio, projection) { if (this.url_ === undefined) { return null; @@ -186,7 +186,7 @@ _ol_source_ImageArcGISRest_.prototype.getImageInternal = function(extent, resolu * @return {ol.ImageLoadFunctionType} The image load function. * @api */ -_ol_source_ImageArcGISRest_.prototype.getImageLoadFunction = function() { +ImageArcGISRest.prototype.getImageLoadFunction = function() { return this.imageLoadFunction_; }; @@ -200,7 +200,7 @@ _ol_source_ImageArcGISRest_.prototype.getImageLoadFunction = function() { * @return {string} Request URL. * @private */ -_ol_source_ImageArcGISRest_.prototype.getRequestUrl_ = function(extent, size, pixelRatio, projection, params) { +ImageArcGISRest.prototype.getRequestUrl_ = function(extent, size, pixelRatio, projection, params) { // ArcGIS Server only wants the numeric portion of the projection ID. var srid = projection.getCode().split(':').pop(); @@ -227,7 +227,7 @@ _ol_source_ImageArcGISRest_.prototype.getRequestUrl_ = function(extent, size, pi * @return {string|undefined} URL. * @api */ -_ol_source_ImageArcGISRest_.prototype.getUrl = function() { +ImageArcGISRest.prototype.getUrl = function() { return this.url_; }; @@ -237,7 +237,7 @@ _ol_source_ImageArcGISRest_.prototype.getUrl = function() { * @param {ol.ImageLoadFunctionType} imageLoadFunction Image load function. * @api */ -_ol_source_ImageArcGISRest_.prototype.setImageLoadFunction = function(imageLoadFunction) { +ImageArcGISRest.prototype.setImageLoadFunction = function(imageLoadFunction) { this.image_ = null; this.imageLoadFunction_ = imageLoadFunction; this.changed(); @@ -249,7 +249,7 @@ _ol_source_ImageArcGISRest_.prototype.setImageLoadFunction = function(imageLoadF * @param {string|undefined} url URL. * @api */ -_ol_source_ImageArcGISRest_.prototype.setUrl = function(url) { +ImageArcGISRest.prototype.setUrl = function(url) { if (url != this.url_) { this.url_ = url; this.image_ = null; @@ -263,9 +263,9 @@ _ol_source_ImageArcGISRest_.prototype.setUrl = function(url) { * @param {Object} params Params. * @api */ -_ol_source_ImageArcGISRest_.prototype.updateParams = function(params) { +ImageArcGISRest.prototype.updateParams = function(params) { _ol_obj_.assign(this.params_, params); this.image_ = null; this.changed(); }; -export default _ol_source_ImageArcGISRest_; +export default ImageArcGISRest; diff --git a/test/spec/ol/source/imagearcgisrest.test.js b/test/spec/ol/source/imagearcgisrest.test.js index fc32f6201e..a1994049f9 100644 --- a/test/spec/ol/source/imagearcgisrest.test.js +++ b/test/spec/ol/source/imagearcgisrest.test.js @@ -1,4 +1,4 @@ -import _ol_source_ImageArcGISRest_ from '../../../../src/ol/source/ImageArcGISRest.js'; +import ImageArcGISRest from '../../../../src/ol/source/ImageArcGISRest.js'; import {get as getProjection} from '../../../../src/ol/proj.js'; @@ -19,7 +19,7 @@ describe('ol.source.ImageArcGISRest', function() { describe('#getImage', function() { it('returns a image with the expected URL', function() { - var source = new _ol_source_ImageArcGISRest_(options); + var source = new ImageArcGISRest(options); var image = source.getImage([3, 2, -7, 1], resolution, pixelRatio, proj3857); var uri = new URL(image.src_); expect(uri.protocol).to.be('http:'); @@ -35,7 +35,7 @@ describe('ol.source.ImageArcGISRest', function() { }); it('returns a non floating point DPI value', function() { - var source = new _ol_source_ImageArcGISRest_(options); + var source = new ImageArcGISRest(options); var image = source.getImage([3, 2, -7, 1.12], resolution, 1.01, proj3857); var uri = new URL(image.src_); var queryData = uri.searchParams; @@ -44,7 +44,7 @@ describe('ol.source.ImageArcGISRest', function() { it('returns a image with the expected URL for ImageServer', function() { options.url = 'http://example.com/ImageServer'; - var source = new _ol_source_ImageArcGISRest_(options); + var source = new ImageArcGISRest(options); var image = source.getImage([3, 2, -7, 1], resolution, pixelRatio, proj3857); var uri = new URL(image.src_); expect(uri.protocol).to.be('http:'); @@ -61,7 +61,7 @@ describe('ol.source.ImageArcGISRest', function() { it('allows various parameters to be overridden', function() { options.params.FORMAT = 'png'; options.params.TRANSPARENT = false; - var source = new _ol_source_ImageArcGISRest_(options); + var source = new ImageArcGISRest(options); var image = source.getImage([3, 2, -3, 1], resolution, pixelRatio, projection); var uri = new URL(image.src_); var queryData = uri.searchParams; @@ -71,7 +71,7 @@ describe('ol.source.ImageArcGISRest', function() { it('allows adding rest option', function() { options.params.LAYERS = 'show:1,3,4'; - var source = new _ol_source_ImageArcGISRest_(options); + var source = new ImageArcGISRest(options); var image = source.getImage([3, 2, -3, 1], resolution, pixelRatio, proj3857); var uri = new URL(image.src_); var queryData = uri.searchParams; @@ -82,7 +82,7 @@ describe('ol.source.ImageArcGISRest', function() { describe('#updateParams', function() { it('add a new param', function() { - var source = new _ol_source_ImageArcGISRest_(options); + var source = new ImageArcGISRest(options); source.updateParams({'TEST': 'value'}); var image = source.getImage([3, 2, -7, 1], resolution, pixelRatio, proj3857); @@ -94,7 +94,7 @@ describe('ol.source.ImageArcGISRest', function() { it('updates an existing param', function() { options.params.TEST = 'value'; - var source = new _ol_source_ImageArcGISRest_(options); + var source = new ImageArcGISRest(options); source.updateParams({'TEST': 'newValue'}); var image = source.getImage([3, 2, -7, 1], resolution, pixelRatio, proj3857); @@ -109,7 +109,7 @@ describe('ol.source.ImageArcGISRest', function() { it('verify getting a param', function() { options.params.TEST = 'value'; - var source = new _ol_source_ImageArcGISRest_(options); + var source = new ImageArcGISRest(options); var setParams = source.getParams(); @@ -119,7 +119,7 @@ describe('ol.source.ImageArcGISRest', function() { it('verify on adding a param', function() { options.params.TEST = 'value'; - var source = new _ol_source_ImageArcGISRest_(options); + var source = new ImageArcGISRest(options); source.updateParams({'TEST2': 'newValue'}); var setParams = source.getParams(); @@ -130,7 +130,7 @@ describe('ol.source.ImageArcGISRest', function() { it('verify on update a param', function() { options.params.TEST = 'value'; - var source = new _ol_source_ImageArcGISRest_(options); + var source = new ImageArcGISRest(options); source.updateParams({'TEST': 'newValue'}); var setParams = source.getParams(); @@ -145,7 +145,7 @@ describe('ol.source.ImageArcGISRest', function() { it('verify getting url', function() { options.url = 'http://test.com/MapServer'; - var source = new _ol_source_ImageArcGISRest_(options); + var source = new ImageArcGISRest(options); var url = source.getUrl(); @@ -159,7 +159,7 @@ describe('ol.source.ImageArcGISRest', function() { it('verify setting url when not set yet', function() { - var source = new _ol_source_ImageArcGISRest_(options); + var source = new ImageArcGISRest(options); source.setUrl('http://test.com/MapServer'); var url = source.getUrl(); @@ -170,7 +170,7 @@ describe('ol.source.ImageArcGISRest', function() { it('verify setting url with existing url', function() { options.url = 'http://test.com/MapServer'; - var source = new _ol_source_ImageArcGISRest_(options); + var source = new ImageArcGISRest(options); source.setUrl('http://test2.com/MapServer'); var url = source.getUrl();