diff --git a/src/ol/VectorTile.js b/src/ol/VectorTile.js index ff2ac75e98..ed01af2d64 100644 --- a/src/ol/VectorTile.js +++ b/src/ol/VectorTile.js @@ -15,7 +15,7 @@ import TileState from './TileState.js'; * @param {ol.TileLoadFunctionType} tileLoadFunction Tile load function. * @param {olx.TileOptions=} opt_options Tile options. */ -var _ol_VectorTile_ = function(tileCoord, state, src, format, tileLoadFunction, opt_options) { +var VectorTile = function(tileCoord, state, src, format, tileLoadFunction, opt_options) { _ol_Tile_.call(this, tileCoord, state, opt_options); @@ -75,13 +75,13 @@ var _ol_VectorTile_ = function(tileCoord, state, src, format, tileLoadFunction, }; -inherits(_ol_VectorTile_, _ol_Tile_); +inherits(VectorTile, _ol_Tile_); /** * @inheritDoc */ -_ol_VectorTile_.prototype.disposeInternal = function() { +VectorTile.prototype.disposeInternal = function() { this.features_ = null; this.replayGroups_ = {}; this.state = TileState.ABORT; @@ -95,8 +95,8 @@ _ol_VectorTile_.prototype.disposeInternal = function() { * @return {ol.Extent} The extent. * @api */ -_ol_VectorTile_.prototype.getExtent = function() { - return this.extent_ || _ol_VectorTile_.DEFAULT_EXTENT; +VectorTile.prototype.getExtent = function() { + return this.extent_ || VectorTile.DEFAULT_EXTENT; }; @@ -105,7 +105,7 @@ _ol_VectorTile_.prototype.getExtent = function() { * @return {ol.format.Feature} Feature format. * @api */ -_ol_VectorTile_.prototype.getFormat = function() { +VectorTile.prototype.getFormat = function() { return this.format_; }; @@ -116,7 +116,7 @@ _ol_VectorTile_.prototype.getFormat = function() { * @return {Array.} Features. * @api */ -_ol_VectorTile_.prototype.getFeatures = function() { +VectorTile.prototype.getFeatures = function() { return this.features_; }; @@ -124,7 +124,7 @@ _ol_VectorTile_.prototype.getFeatures = function() { /** * @inheritDoc */ -_ol_VectorTile_.prototype.getKey = function() { +VectorTile.prototype.getKey = function() { return this.url_; }; @@ -135,7 +135,7 @@ _ol_VectorTile_.prototype.getKey = function() { * @return {ol.proj.Projection} Feature projection. * @api */ -_ol_VectorTile_.prototype.getProjection = function() { +VectorTile.prototype.getProjection = function() { return this.projection_; }; @@ -145,7 +145,7 @@ _ol_VectorTile_.prototype.getProjection = function() { * @param {string} key Key. * @return {ol.render.ReplayGroup} Replay group. */ -_ol_VectorTile_.prototype.getReplayGroup = function(layer, key) { +VectorTile.prototype.getReplayGroup = function(layer, key) { return this.replayGroups_[getUid(layer) + ',' + key]; }; @@ -153,7 +153,7 @@ _ol_VectorTile_.prototype.getReplayGroup = function(layer, key) { /** * @inheritDoc */ -_ol_VectorTile_.prototype.load = function() { +VectorTile.prototype.load = function() { if (this.state == TileState.IDLE) { this.setState(TileState.LOADING); this.tileLoadFunction_(this, this.url_); @@ -168,7 +168,7 @@ _ol_VectorTile_.prototype.load = function() { * @param {ol.proj.Projection} dataProjection Data projection. * @param {ol.Extent} extent Extent. */ -_ol_VectorTile_.prototype.onLoad = function(features, dataProjection, extent) { +VectorTile.prototype.onLoad = function(features, dataProjection, extent) { this.setProjection(dataProjection); this.setFeatures(features); this.setExtent(extent); @@ -178,7 +178,7 @@ _ol_VectorTile_.prototype.onLoad = function(features, dataProjection, extent) { /** * Handler for tile load errors. */ -_ol_VectorTile_.prototype.onError = function() { +VectorTile.prototype.onError = function() { this.setState(TileState.ERROR); }; @@ -195,7 +195,7 @@ _ol_VectorTile_.prototype.onError = function() { * @param {ol.Extent} extent The extent. * @api */ -_ol_VectorTile_.prototype.setExtent = function(extent) { +VectorTile.prototype.setExtent = function(extent) { this.extent_ = extent; }; @@ -206,7 +206,7 @@ _ol_VectorTile_.prototype.setExtent = function(extent) { * @param {Array.} features Features. * @api */ -_ol_VectorTile_.prototype.setFeatures = function(features) { +VectorTile.prototype.setFeatures = function(features) { this.features_ = features; this.setState(TileState.LOADED); }; @@ -219,7 +219,7 @@ _ol_VectorTile_.prototype.setFeatures = function(features) { * @param {ol.proj.Projection} projection Feature projection. * @api */ -_ol_VectorTile_.prototype.setProjection = function(projection) { +VectorTile.prototype.setProjection = function(projection) { this.projection_ = projection; }; @@ -229,7 +229,7 @@ _ol_VectorTile_.prototype.setProjection = function(projection) { * @param {string} key Key. * @param {ol.render.ReplayGroup} replayGroup Replay group. */ -_ol_VectorTile_.prototype.setReplayGroup = function(layer, key, replayGroup) { +VectorTile.prototype.setReplayGroup = function(layer, key, replayGroup) { this.replayGroups_[getUid(layer) + ',' + key] = replayGroup; }; @@ -239,7 +239,7 @@ _ol_VectorTile_.prototype.setReplayGroup = function(layer, key, replayGroup) { * @param {ol.FeatureLoader} loader Feature loader. * @api */ -_ol_VectorTile_.prototype.setLoader = function(loader) { +VectorTile.prototype.setLoader = function(loader) { this.loader_ = loader; }; @@ -248,5 +248,5 @@ _ol_VectorTile_.prototype.setLoader = function(loader) { * @const * @type {ol.Extent} */ -_ol_VectorTile_.DEFAULT_EXTENT = [0, 0, 4096, 4096]; -export default _ol_VectorTile_; +VectorTile.DEFAULT_EXTENT = [0, 0, 4096, 4096]; +export default VectorTile; diff --git a/src/ol/source/VectorTile.js b/src/ol/source/VectorTile.js index 2a63c681e7..0fe5ace3f7 100644 --- a/src/ol/source/VectorTile.js +++ b/src/ol/source/VectorTile.js @@ -4,7 +4,7 @@ import {inherits} from '../index.js'; import TileState from '../TileState.js'; import VectorImageTile from '../VectorImageTile.js'; -import _ol_VectorTile_ from '../VectorTile.js'; +import VectorTile from '../VectorTile.js'; import _ol_size_ from '../size.js'; import _ol_source_UrlTile_ from '../source/UrlTile.js'; import _ol_tilecoord_ from '../tilecoord.js'; @@ -78,7 +78,7 @@ var _ol_source_VectorTile_ = function(options) { * @type {function(new: ol.VectorTile, ol.TileCoord, ol.TileState, string, * ol.format.Feature, ol.TileLoadFunctionType)} */ - this.tileClass = options.tileClass ? options.tileClass : _ol_VectorTile_; + this.tileClass = options.tileClass ? options.tileClass : VectorTile; /** * @private diff --git a/test/spec/ol/renderer/canvas/vectortilelayer.test.js b/test/spec/ol/renderer/canvas/vectortilelayer.test.js index af735c2d26..2969902dba 100644 --- a/test/spec/ol/renderer/canvas/vectortilelayer.test.js +++ b/test/spec/ol/renderer/canvas/vectortilelayer.test.js @@ -4,7 +4,7 @@ import _ol_Feature_ from '../../../../../src/ol/Feature.js'; import Map from '../../../../../src/ol/Map.js'; import TileState from '../../../../../src/ol/TileState.js'; import VectorImageTile from '../../../../../src/ol/VectorImageTile.js'; -import _ol_VectorTile_ from '../../../../../src/ol/VectorTile.js'; +import VectorTile from '../../../../../src/ol/VectorTile.js'; import _ol_View_ from '../../../../../src/ol/View.js'; import * as _ol_extent_ from '../../../../../src/ol/extent.js'; import MVT from '../../../../../src/ol/format/MVT.js'; @@ -60,13 +60,13 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { feature3 = new _ol_render_Feature_('Point', [1, -1], []); feature2.setStyle(featureStyle); var TileClass = function() { - _ol_VectorTile_.apply(this, arguments); + VectorTile.apply(this, arguments); this.setState('loaded'); this.setFeatures([feature1, feature2, feature3]); this.setProjection(getProjection('EPSG:4326')); tileCallback(this); }; - inherits(TileClass, _ol_VectorTile_); + inherits(TileClass, VectorTile); source = new _ol_source_VectorTile_({ format: new MVT(), tileClass: TileClass, @@ -224,9 +224,9 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { }); map.addLayer(layer2); - var spy1 = sinon.spy(_ol_VectorTile_.prototype, + var spy1 = sinon.spy(VectorTile.prototype, 'getReplayGroup'); - var spy2 = sinon.spy(_ol_VectorTile_.prototype, + var spy2 = sinon.spy(VectorTile.prototype, 'setReplayGroup'); map.renderSync(); expect(spy1.callCount).to.be(4); @@ -245,7 +245,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { transition: 0 }) }); - var sourceTile = new _ol_VectorTile_([0, 0, 0], 2); + var sourceTile = new VectorTile([0, 0, 0], 2); sourceTile.setProjection(getProjection('EPSG:3857')); sourceTile.features_ = []; sourceTile.getImage = function() { @@ -293,7 +293,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { var TileClass = function() { VectorImageTile.apply(this, arguments); this.setState('loaded'); - var sourceTile = new _ol_VectorTile_([0, 0, 0]); + var sourceTile = new VectorTile([0, 0, 0]); sourceTile.setProjection(getProjection('EPSG:3857')); sourceTile.getReplayGroup = function() { return replayGroup; diff --git a/test/spec/ol/source/vectortile.test.js b/test/spec/ol/source/vectortile.test.js index d48583defe..8745f27937 100644 --- a/test/spec/ol/source/vectortile.test.js +++ b/test/spec/ol/source/vectortile.test.js @@ -1,7 +1,7 @@ import Map from '../../../../src/ol/Map.js'; import _ol_View_ from '../../../../src/ol/View.js'; import VectorImageTile from '../../../../src/ol/VectorImageTile.js'; -import _ol_VectorTile_ from '../../../../src/ol/VectorTile.js'; +import VectorTile from '../../../../src/ol/VectorTile.js'; import MVT from '../../../../src/ol/format/MVT.js'; import _ol_layer_VectorTile_ from '../../../../src/ol/layer/VectorTile.js'; import {get as getProjection} from '../../../../src/ol/proj.js'; @@ -25,7 +25,7 @@ describe('ol.source.VectorTile', function() { }); it('uses ol.VectorTile as default tileClass', function() { - expect(source.tileClass).to.equal(_ol_VectorTile_); + expect(source.tileClass).to.equal(VectorTile); }); it('creates a 512 XYZ tilegrid by default', function() { @@ -65,7 +65,7 @@ describe('ol.source.VectorTile', function() { }); source.on('tileloadend', function(e) { expect(started).to.be(true); - expect(e.tile).to.be.a(_ol_VectorTile_); + expect(e.tile).to.be.a(VectorTile); expect(e.tile.getFeatures().length).to.be(1327); done(); }); diff --git a/test/spec/ol/vectorimagetile.test.js b/test/spec/ol/vectorimagetile.test.js index 296f3edb0c..da9aaba369 100644 --- a/test/spec/ol/vectorimagetile.test.js +++ b/test/spec/ol/vectorimagetile.test.js @@ -1,6 +1,6 @@ import TileState from '../../../src/ol/TileState.js'; import VectorImageTile from '../../../src/ol/VectorImageTile.js'; -import _ol_VectorTile_ from '../../../src/ol/VectorTile.js'; +import VectorTile from '../../../src/ol/VectorTile.js'; import _ol_events_ from '../../../src/ol/events.js'; import GeoJSON from '../../../src/ol/format/GeoJSON.js'; import {get as getProjection} from '../../../src/ol/proj.js'; @@ -17,7 +17,7 @@ describe('ol.VectorImageTile', function() { VectorImageTile.defaultLoadFunction, [0, 0, -1], function() { return url; }, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ(), {}, - 1, getProjection('EPSG:3857'), _ol_VectorTile_, function() {}); + 1, getProjection('EPSG:3857'), VectorTile, function() {}); tile.load(); var sourceTile = tile.getTile(tile.tileKeys[0]); @@ -41,7 +41,7 @@ describe('ol.VectorImageTile', function() { }, [0, 0, -1], function() { return url; }, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ(), {}, - 1, getProjection('EPSG:3857'), _ol_VectorTile_, function() {}); + 1, getProjection('EPSG:3857'), VectorTile, function() {}); tile.load(); var calls = 0; @@ -65,7 +65,7 @@ describe('ol.VectorImageTile', function() { VectorImageTile.defaultLoadFunction, [0, 0, -1], function() { return url; }, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ(), {}, - 1, getProjection('EPSG:3857'), _ol_VectorTile_, function() {}); + 1, getProjection('EPSG:3857'), VectorTile, function() {}); tile.load(); @@ -81,7 +81,7 @@ describe('ol.VectorImageTile', function() { var tile = new VectorImageTile([0, 0, -1], 0, url, format, VectorImageTile.defaultLoadFunction, [0, 0, -1], function() {}, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ(), {}, - 1, getProjection('EPSG:3857'), _ol_VectorTile_, function() {}); + 1, getProjection('EPSG:3857'), VectorTile, function() {}); tile.load(); @@ -105,7 +105,7 @@ describe('ol.VectorImageTile', function() { return url; }, tileGrid, _ol_tilegrid_.createXYZ({extent: [-180, -90, 180, 90], tileSize: 512}), - sourceTiles, 1, getProjection('EPSG:4326'), _ol_VectorTile_, function() {}); + sourceTiles, 1, getProjection('EPSG:4326'), VectorTile, function() {}); tile.load(); expect(tile.tileKeys.length).to.be(1); expect(tile.getTile(tile.tileKeys[0]).tileCoord).to.eql([0, 16, -10]); @@ -118,7 +118,7 @@ describe('ol.VectorImageTile', function() { VectorImageTile.defaultLoadFunction, [0, 0, -1], function() { return url; }, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ({tileSize: 512}), {}, - 1, getProjection('EPSG:3857'), _ol_VectorTile_, function() {}); + 1, getProjection('EPSG:3857'), VectorTile, function() {}); tile.load(); expect(tile.loadListenerKeys_.length).to.be(4); @@ -138,7 +138,7 @@ describe('ol.VectorImageTile', function() { VectorImageTile.defaultLoadFunction, [0, 0, -1], function() { return url; }, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ({tileSize: 512}), {}, - 1, getProjection('EPSG:3857'), _ol_VectorTile_, function() {}); + 1, getProjection('EPSG:3857'), VectorTile, function() {}); tile.load(); _ol_events_.listenOnce(tile, 'change', function() { diff --git a/test/spec/ol/vectortile.test.js b/test/spec/ol/vectortile.test.js index af7adb760e..4783d72019 100644 --- a/test/spec/ol/vectortile.test.js +++ b/test/spec/ol/vectortile.test.js @@ -1,6 +1,6 @@ import _ol_Feature_ from '../../../src/ol/Feature.js'; import VectorImageTile from '../../../src/ol/VectorImageTile.js'; -import _ol_VectorTile_ from '../../../src/ol/VectorTile.js'; +import VectorTile from '../../../src/ol/VectorTile.js'; import _ol_events_ from '../../../src/ol/events.js'; import TextFeature from '../../../src/ol/format/TextFeature.js'; import {get as getProjection} from '../../../src/ol/proj.js'; @@ -22,7 +22,7 @@ describe('ol.VectorTile', function() { return [new _ol_Feature_()]; }; - var tile = new _ol_VectorTile_([0, 0, 0], null, null, format); + var tile = new VectorTile([0, 0, 0], null, null, format); var url = 'spec/ol/data/point.json'; VectorImageTile.defaultLoadFunction(tile, url);