From 6261cb6997832955895b7ec99f77398da63d72f5 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Mon, 8 Jan 2018 15:48:40 -0700 Subject: [PATCH] Rename _ol_source_TileArcGISRest_ to TileArcGISRest --- examples/arcgis-tiled.js | 4 +-- src/ol/source/TileArcGISRest.js | 18 +++++------ test/spec/ol/source/tilearcgisrest.test.js | 36 +++++++++++----------- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/examples/arcgis-tiled.js b/examples/arcgis-tiled.js index 17f2e4531b..cb3ea87bc2 100644 --- a/examples/arcgis-tiled.js +++ b/examples/arcgis-tiled.js @@ -2,7 +2,7 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; import TileLayer from '../src/ol/layer/Tile.js'; import OSM from '../src/ol/source/OSM.js'; -import _ol_source_TileArcGISRest_ from '../src/ol/source/TileArcGISRest.js'; +import TileArcGISRest from '../src/ol/source/TileArcGISRest.js'; var url = 'https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/' + 'Specialty/ESRI_StateCityHighway_USA/MapServer'; @@ -13,7 +13,7 @@ var layers = [ }), new TileLayer({ extent: [-13884991, 2870341, -7455066, 6338219], - source: new _ol_source_TileArcGISRest_({ + source: new TileArcGISRest({ url: url }) }) diff --git a/src/ol/source/TileArcGISRest.js b/src/ol/source/TileArcGISRest.js index f6e4b99ac8..5a3f9a486f 100644 --- a/src/ol/source/TileArcGISRest.js +++ b/src/ol/source/TileArcGISRest.js @@ -24,7 +24,7 @@ import _ol_uri_ from '../uri.js'; * options. * @api */ -var _ol_source_TileArcGISRest_ = function(opt_options) { +var TileArcGISRest = function(opt_options) { var options = opt_options || {}; @@ -57,14 +57,14 @@ var _ol_source_TileArcGISRest_ = function(opt_options) { this.setKey(this.getKeyForParams_()); }; -inherits(_ol_source_TileArcGISRest_, TileImage); +inherits(TileArcGISRest, TileImage); /** * @private * @return {string} The key for the current params. */ -_ol_source_TileArcGISRest_.prototype.getKeyForParams_ = function() { +TileArcGISRest.prototype.getKeyForParams_ = function() { var i = 0; var res = []; for (var key in this.params_) { @@ -80,7 +80,7 @@ _ol_source_TileArcGISRest_.prototype.getKeyForParams_ = function() { * @return {Object} Params. * @api */ -_ol_source_TileArcGISRest_.prototype.getParams = function() { +TileArcGISRest.prototype.getParams = function() { return this.params_; }; @@ -95,7 +95,7 @@ _ol_source_TileArcGISRest_.prototype.getParams = function() { * @return {string|undefined} Request URL. * @private */ -_ol_source_TileArcGISRest_.prototype.getRequestUrl_ = function(tileCoord, tileSize, tileExtent, +TileArcGISRest.prototype.getRequestUrl_ = function(tileCoord, tileSize, tileExtent, pixelRatio, projection, params) { var urls = this.urls; @@ -132,7 +132,7 @@ _ol_source_TileArcGISRest_.prototype.getRequestUrl_ = function(tileCoord, tileSi /** * @inheritDoc */ -_ol_source_TileArcGISRest_.prototype.getTilePixelRatio = function(pixelRatio) { +TileArcGISRest.prototype.getTilePixelRatio = function(pixelRatio) { return /** @type {number} */ (pixelRatio); }; @@ -140,7 +140,7 @@ _ol_source_TileArcGISRest_.prototype.getTilePixelRatio = function(pixelRatio) { /** * @inheritDoc */ -_ol_source_TileArcGISRest_.prototype.fixedTileUrlFunction = function(tileCoord, pixelRatio, projection) { +TileArcGISRest.prototype.fixedTileUrlFunction = function(tileCoord, pixelRatio, projection) { var tileGrid = this.getTileGrid(); if (!tileGrid) { @@ -178,8 +178,8 @@ _ol_source_TileArcGISRest_.prototype.fixedTileUrlFunction = function(tileCoord, * @param {Object} params Params. * @api */ -_ol_source_TileArcGISRest_.prototype.updateParams = function(params) { +TileArcGISRest.prototype.updateParams = function(params) { _ol_obj_.assign(this.params_, params); this.setKey(this.getKeyForParams_()); }; -export default _ol_source_TileArcGISRest_; +export default TileArcGISRest; diff --git a/test/spec/ol/source/tilearcgisrest.test.js b/test/spec/ol/source/tilearcgisrest.test.js index 10771c5572..ca07df81e8 100644 --- a/test/spec/ol/source/tilearcgisrest.test.js +++ b/test/spec/ol/source/tilearcgisrest.test.js @@ -1,5 +1,5 @@ import ImageTile from '../../../../src/ol/ImageTile.js'; -import _ol_source_TileArcGISRest_ from '../../../../src/ol/source/TileArcGISRest.js'; +import TileArcGISRest from '../../../../src/ol/source/TileArcGISRest.js'; import {get as getProjection} from '../../../../src/ol/proj.js'; @@ -16,7 +16,7 @@ describe('ol.source.TileArcGISRest', function() { describe('#getTile', function() { it('returns a tile with the expected URL', function() { - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); var tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857')); expect(tile).to.be.an(ImageTile); var uri = new URL(tile.src_); @@ -38,7 +38,7 @@ describe('ol.source.TileArcGISRest', function() { }); it('returns a non floating point DPI value', function() { - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); var tile = source.getTile(3, 2, -7, 1.12, getProjection('EPSG:3857')); var uri = new URL(tile.src_); var queryData = uri.searchParams; @@ -47,7 +47,7 @@ describe('ol.source.TileArcGISRest', function() { it('takes DPI from params if specified', function() { options.params.DPI = 96; - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); var tile = source.getTile(3, 2, -7, 1.12, getProjection('EPSG:3857')); var uri = new URL(tile.src_); var queryData = uri.searchParams; @@ -58,7 +58,7 @@ describe('ol.source.TileArcGISRest', function() { it('returns a tile with the expected URL with url list', function() { options.urls = ['http://test1.com/MapServer', 'http://test2.com/MapServer']; - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); var tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857')); expect(tile).to.be.an(ImageTile); @@ -82,7 +82,7 @@ describe('ol.source.TileArcGISRest', function() { it('returns a tile with the expected URL for ImageServer', function() { options.url = 'http://example.com/ImageServer'; - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); var tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857')); expect(tile).to.be.an(ImageTile); var uri = new URL(tile.src_); @@ -105,7 +105,7 @@ describe('ol.source.TileArcGISRest', function() { it('allows various parameters to be overridden', function() { options.params.FORMAT = 'png'; options.params.TRANSPARENT = false; - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); var tile = source.getTile(3, 2, -3, 1, getProjection('EPSG:4326')); var uri = new URL(tile.src_); var queryData = uri.searchParams; @@ -115,7 +115,7 @@ describe('ol.source.TileArcGISRest', function() { it('allows adding rest option', function() { options.params.LAYERS = 'show:1,3,4'; - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); var tile = source.getTile(3, 2, -3, 1, getProjection('EPSG:4326')); var uri = new URL(tile.src_); var queryData = uri.searchParams; @@ -126,7 +126,7 @@ describe('ol.source.TileArcGISRest', function() { describe('#updateParams', function() { it('add a new param', function() { - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); source.updateParams({'TEST': 'value'}); var tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857')); @@ -138,7 +138,7 @@ describe('ol.source.TileArcGISRest', function() { it('updates an existing param', function() { options.params.TEST = 'value'; - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); source.updateParams({'TEST': 'newValue'}); var tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857')); @@ -153,7 +153,7 @@ describe('ol.source.TileArcGISRest', function() { it('verify getting a param', function() { options.params.TEST = 'value'; - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); var setParams = source.getParams(); @@ -163,7 +163,7 @@ describe('ol.source.TileArcGISRest', function() { it('verify on adding a param', function() { options.params.TEST = 'value'; - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); source.updateParams({'TEST2': 'newValue'}); var setParams = source.getParams(); @@ -174,7 +174,7 @@ describe('ol.source.TileArcGISRest', function() { it('verify on update a param', function() { options.params.TEST = 'value'; - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); source.updateParams({'TEST': 'newValue'}); var setParams = source.getParams(); @@ -189,7 +189,7 @@ describe('ol.source.TileArcGISRest', function() { it('verify getting array of urls', function() { options.urls = ['http://test.com/MapServer', 'http://test2.com/MapServer']; - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); var urls = source.getUrls(); @@ -203,7 +203,7 @@ describe('ol.source.TileArcGISRest', function() { it('verify setting urls when not set yet', function() { - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); source.setUrls(['http://test.com/MapServer', 'http://test2.com/MapServer']); var urls = source.getUrls(); @@ -214,7 +214,7 @@ describe('ol.source.TileArcGISRest', function() { it('verify setting urls with existing list', function() { options.urls = ['http://test.com/MapServer', 'http://test2.com/MapServer']; - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); source.setUrls(['http://test3.com/MapServer', 'http://test4.com/MapServer']); var urls = source.getUrls(); @@ -227,7 +227,7 @@ describe('ol.source.TileArcGISRest', function() { it('verify setting url with no urls', function() { - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); source.setUrl('http://test.com/MapServer'); var urls = source.getUrls(); @@ -238,7 +238,7 @@ describe('ol.source.TileArcGISRest', function() { it('verify setting url with list of urls', function() { options.urls = ['http://test.com/MapServer', 'http://test2.com/MapServer']; - var source = new _ol_source_TileArcGISRest_(options); + var source = new TileArcGISRest(options); source.setUrl('http://test3.com/MapServer'); var urls = source.getUrls();