diff --git a/examples/geojson-vt.js b/examples/geojson-vt.js index 21c0547169..c284a12282 100644 --- a/examples/geojson-vt.js +++ b/examples/geojson-vt.js @@ -3,7 +3,7 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import OSM from '../src/ol/source/OSM.js'; -import _ol_source_VectorTile_ from '../src/ol/source/VectorTile.js'; +import VectorTileSource from '../src/ol/source/VectorTile.js'; import TileLayer from '../src/ol/layer/Tile.js'; import _ol_layer_VectorTile_ from '../src/ol/layer/VectorTile.js'; import _ol_proj_Projection_ from '../src/ol/proj/Projection.js'; @@ -74,7 +74,7 @@ fetch(url).then(function(response) { extent: 4096, debug: 1 }); - var vectorSource = new _ol_source_VectorTile_({ + var vectorSource = new VectorTileSource({ format: new GeoJSON(), tileLoadFunction: function(tile) { var format = tile.getFormat(); diff --git a/examples/mapbox-vector-tiles-advanced.js b/examples/mapbox-vector-tiles-advanced.js index b24f69a8bc..8b6b0d3d6f 100644 --- a/examples/mapbox-vector-tiles-advanced.js +++ b/examples/mapbox-vector-tiles-advanced.js @@ -3,7 +3,7 @@ import View from '../src/ol/View.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'; -import _ol_source_VectorTile_ from '../src/ol/source/VectorTile.js'; +import VectorTileSource from '../src/ol/source/VectorTile.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Icon_ from '../src/ol/style/Icon.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; @@ -33,7 +33,7 @@ function tileUrlFunction(tileCoord) { var map = new Map({ layers: [ new _ol_layer_VectorTile_({ - source: new _ol_source_VectorTile_({ + source: new VectorTileSource({ attributions: '© Mapbox ' + '© ' + 'OpenStreetMap contributors', diff --git a/examples/mapbox-vector-tiles.js b/examples/mapbox-vector-tiles.js index ea1df8acb1..cec13bfa6e 100644 --- a/examples/mapbox-vector-tiles.js +++ b/examples/mapbox-vector-tiles.js @@ -2,7 +2,7 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; import MVT from '../src/ol/format/MVT.js'; import _ol_layer_VectorTile_ from '../src/ol/layer/VectorTile.js'; -import _ol_source_VectorTile_ from '../src/ol/source/VectorTile.js'; +import VectorTileSource from '../src/ol/source/VectorTile.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Icon_ from '../src/ol/style/Icon.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; @@ -16,7 +16,7 @@ var map = new Map({ layers: [ new _ol_layer_VectorTile_({ declutter: true, - source: new _ol_source_VectorTile_({ + source: new VectorTileSource({ attributions: '© Mapbox ' + '© ' + 'OpenStreetMap contributors', diff --git a/examples/osm-vector-tiles.js b/examples/osm-vector-tiles.js index 1d34df6df3..05ac9d689d 100644 --- a/examples/osm-vector-tiles.js +++ b/examples/osm-vector-tiles.js @@ -3,7 +3,7 @@ import View from '../src/ol/View.js'; import TopoJSON from '../src/ol/format/TopoJSON.js'; import _ol_layer_VectorTile_ from '../src/ol/layer/VectorTile.js'; import {fromLonLat} from '../src/ol/proj.js'; -import _ol_source_VectorTile_ from '../src/ol/source/VectorTile.js'; +import VectorTileSource from '../src/ol/source/VectorTile.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Stroke_ from '../src/ol/style/Stroke.js'; import _ol_style_Style_ from '../src/ol/style/Style.js'; @@ -61,7 +61,7 @@ var roadStyle = function(feature) { var map = new Map({ layers: [ new _ol_layer_VectorTile_({ - source: new _ol_source_VectorTile_({ + source: new VectorTileSource({ attributions: '© OpenStreetMap contributors, Who’s On First, ' + 'Natural Earth, and openstreetmapdata.com', format: new TopoJSON({ diff --git a/examples/vector-tile-info.js b/examples/vector-tile-info.js index 987e9363a0..a159eb02ec 100644 --- a/examples/vector-tile-info.js +++ b/examples/vector-tile-info.js @@ -2,7 +2,7 @@ import Map from '../src/ol/Map.js'; import View from '../src/ol/View.js'; import MVT from '../src/ol/format/MVT.js'; import _ol_layer_VectorTile_ from '../src/ol/layer/VectorTile.js'; -import _ol_source_VectorTile_ from '../src/ol/source/VectorTile.js'; +import VectorTileSource from '../src/ol/source/VectorTile.js'; var map = new Map({ target: 'map', @@ -11,7 +11,7 @@ var map = new Map({ zoom: 2 }), layers: [new _ol_layer_VectorTile_({ - source: new _ol_source_VectorTile_({ + source: new VectorTileSource({ format: new MVT(), url: 'https://basemaps.arcgis.com/v1/arcgis/rest/services/World_Basemap/VectorTileServer/tile/{z}/{y}/{x}.pbf' }) diff --git a/src/ol/source/VectorTile.js b/src/ol/source/VectorTile.js index 9018f7e845..6287477ad3 100644 --- a/src/ol/source/VectorTile.js +++ b/src/ol/source/VectorTile.js @@ -26,7 +26,7 @@ import _ol_tilegrid_ from '../tilegrid.js'; * @param {olx.source.VectorTileOptions} options Vector tile options. * @api */ -var _ol_source_VectorTile_ = function(options) { +var VectorTileSource = function(options) { var projection = options.projection || 'EPSG:3857'; var extent = options.extent || _ol_tilegrid_.extentFromProjection(projection); @@ -87,13 +87,13 @@ var _ol_source_VectorTile_ = function(options) { }; -inherits(_ol_source_VectorTile_, UrlTile); +inherits(VectorTileSource, UrlTile); /** * @return {boolean} The source can have overlapping geometries. */ -_ol_source_VectorTile_.prototype.getOverlaps = function() { +VectorTileSource.prototype.getOverlaps = function() { return this.overlaps_; }; @@ -101,7 +101,7 @@ _ol_source_VectorTile_.prototype.getOverlaps = function() { * clear {@link ol.TileCache} and delete all source tiles * @api */ -_ol_source_VectorTile_.prototype.clear = function() { +VectorTileSource.prototype.clear = function() { this.tileCache.clear(); this.sourceTiles_ = {}; }; @@ -109,7 +109,7 @@ _ol_source_VectorTile_.prototype.clear = function() { /** * @inheritDoc */ -_ol_source_VectorTile_.prototype.getTile = function(z, x, y, pixelRatio, projection) { +VectorTileSource.prototype.getTile = function(z, x, y, pixelRatio, projection) { var tileCoordKey = _ol_tilecoord_.getKeyZXY(z, x, y); if (this.tileCache.containsKey(tileCoordKey)) { return /** @type {!ol.Tile} */ (this.tileCache.get(tileCoordKey)); @@ -136,7 +136,7 @@ _ol_source_VectorTile_.prototype.getTile = function(z, x, y, pixelRatio, project /** * @inheritDoc */ -_ol_source_VectorTile_.prototype.getTileGridForProjection = function(projection) { +VectorTileSource.prototype.getTileGridForProjection = function(projection) { var code = projection.getCode(); var tileGrid = this.tileGrids_[code]; if (!tileGrid) { @@ -153,7 +153,7 @@ _ol_source_VectorTile_.prototype.getTileGridForProjection = function(projection) /** * @inheritDoc */ -_ol_source_VectorTile_.prototype.getTilePixelRatio = function(pixelRatio) { +VectorTileSource.prototype.getTilePixelRatio = function(pixelRatio) { return pixelRatio; }; @@ -161,8 +161,8 @@ _ol_source_VectorTile_.prototype.getTilePixelRatio = function(pixelRatio) { /** * @inheritDoc */ -_ol_source_VectorTile_.prototype.getTilePixelSize = function(z, pixelRatio, projection) { +VectorTileSource.prototype.getTilePixelSize = function(z, pixelRatio, projection) { var tileSize = _ol_size_.toSize(this.getTileGridForProjection(projection).getTileSize(z)); return [Math.round(tileSize[0] * pixelRatio), Math.round(tileSize[1] * pixelRatio)]; }; -export default _ol_source_VectorTile_; +export default VectorTileSource; diff --git a/test/rendering/ol/layer/vectortile.test.js b/test/rendering/ol/layer/vectortile.test.js index 357384b358..ecffba7886 100644 --- a/test/rendering/ol/layer/vectortile.test.js +++ b/test/rendering/ol/layer/vectortile.test.js @@ -7,7 +7,7 @@ import VectorLayer from '../../../../src/ol/layer/Vector.js'; import _ol_layer_VectorTile_ from '../../../../src/ol/layer/VectorTile.js'; import _ol_obj_ from '../../../../src/ol/obj.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; -import _ol_source_VectorTile_ from '../../../../src/ol/source/VectorTile.js'; +import VectorTileSource from '../../../../src/ol/source/VectorTile.js'; import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js'; import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js'; import _ol_style_Style_ from '../../../../src/ol/style/Style.js'; @@ -69,7 +69,7 @@ describe('ol.rendering.layer.VectorTile', function() { var source; beforeEach(function() { - source = new _ol_source_VectorTile_({ + source = new VectorTileSource({ format: new MVT(), tileGrid: _ol_tilegrid_.createXYZ(), url: 'rendering/ol/data/tiles/mvt/{z}-{x}-{y}.vector.pbf', diff --git a/test/spec/ol/layer/vectortile.test.js b/test/spec/ol/layer/vectortile.test.js index 060d5a3b2a..860d8237b3 100644 --- a/test/spec/ol/layer/vectortile.test.js +++ b/test/spec/ol/layer/vectortile.test.js @@ -1,5 +1,5 @@ import _ol_layer_VectorTile_ from '../../../../src/ol/layer/VectorTile.js'; -import _ol_source_VectorTile_ from '../../../../src/ol/source/VectorTile.js'; +import VectorTileSource from '../../../../src/ol/source/VectorTile.js'; describe('ol.layer.VectorTile', function() { @@ -10,7 +10,7 @@ describe('ol.layer.VectorTile', function() { beforeEach(function() { layer = new _ol_layer_VectorTile_({ - source: new _ol_source_VectorTile_({}) + source: new VectorTileSource({}) }); }); @@ -40,18 +40,18 @@ describe('ol.layer.VectorTile', function() { it('works with options', function() { var layer = new _ol_layer_VectorTile_({ renderMode: 'vector', - source: new _ol_source_VectorTile_({}) + source: new VectorTileSource({}) }); expect(layer.getRenderMode()).to.be('vector'); layer = new _ol_layer_VectorTile_({ renderMode: 'image', - source: new _ol_source_VectorTile_({}) + source: new VectorTileSource({}) }); expect(layer.getRenderMode()).to.be('image'); expect(function() { layer = new _ol_layer_VectorTile_({ renderMode: 'foo', - source: new _ol_source_VectorTile_({}) + source: new VectorTileSource({}) }); }).to.throwException(); }); diff --git a/test/spec/ol/renderer/canvas/vectortilelayer.test.js b/test/spec/ol/renderer/canvas/vectortilelayer.test.js index d9ccd4a973..666c809aef 100644 --- a/test/spec/ol/renderer/canvas/vectortilelayer.test.js +++ b/test/spec/ol/renderer/canvas/vectortilelayer.test.js @@ -15,7 +15,7 @@ import _ol_proj_Projection_ from '../../../../../src/ol/proj/Projection.js'; import _ol_render_canvas_ from '../../../../../src/ol/render/canvas.js'; import _ol_render_Feature_ from '../../../../../src/ol/render/Feature.js'; import CanvasVectorTileLayerRenderer from '../../../../../src/ol/renderer/canvas/VectorTileLayer.js'; -import _ol_source_VectorTile_ from '../../../../../src/ol/source/VectorTile.js'; +import VectorTileSource from '../../../../../src/ol/source/VectorTile.js'; import _ol_style_Style_ from '../../../../../src/ol/style/Style.js'; import _ol_style_Text_ from '../../../../../src/ol/style/Text.js'; import _ol_tilegrid_ from '../../../../../src/ol/tilegrid.js'; @@ -67,13 +67,13 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { tileCallback(this); }; inherits(TileClass, VectorTile); - source = new _ol_source_VectorTile_({ + source = new VectorTileSource({ format: new MVT(), tileClass: TileClass, tileGrid: _ol_tilegrid_.createXYZ() }); source.getTile = function() { - var tile = _ol_source_VectorTile_.prototype.getTile.apply(source, arguments); + var tile = VectorTileSource.prototype.getTile.apply(source, arguments); tile.setState(TileState.LOADED); return tile; }; @@ -240,7 +240,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { describe('#prepareFrame', function() { it('re-renders when layer changed', function() { var layer = new _ol_layer_VectorTile_({ - source: new _ol_source_VectorTile_({ + source: new VectorTileSource({ tileGrid: _ol_tilegrid_.createXYZ(), transition: 0 }) @@ -309,7 +309,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { beforeEach(function() { replayGroup = {}; layer = new _ol_layer_VectorTile_({ - source: new _ol_source_VectorTile_({ + source: new VectorTileSource({ tileClass: TileClass, tileGrid: _ol_tilegrid_.createXYZ() }) @@ -349,7 +349,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { target.style.height = '100px'; document.body.appendChild(target); var extent = [1824704.739223726, 6141868.096770482, 1827150.7241288517, 6144314.081675608]; - var source = new _ol_source_VectorTile_({ + var source = new VectorTileSource({ format: new MVT(), url: 'spec/ol/data/14-8938-5680.vector.pbf', minZoom: 14, diff --git a/test/spec/ol/source/vectortile.test.js b/test/spec/ol/source/vectortile.test.js index 9ab209658b..4838982c06 100644 --- a/test/spec/ol/source/vectortile.test.js +++ b/test/spec/ol/source/vectortile.test.js @@ -5,14 +5,14 @@ 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'; -import _ol_source_VectorTile_ from '../../../../src/ol/source/VectorTile.js'; +import VectorTileSource from '../../../../src/ol/source/VectorTile.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js'; describe('ol.source.VectorTile', function() { var format = new MVT(); - var source = new _ol_source_VectorTile_({ + var source = new VectorTileSource({ format: format, tilePixelRatio: 8, url: 'spec/ol/data/{z}-{x}-{y}.vector.pbf' @@ -96,7 +96,7 @@ describe('ol.source.VectorTile', function() { var extent = [665584.2026596286, 7033250.839875697, 667162.0221431496, 7035280.378636755]; - source = new _ol_source_VectorTile_({ + source = new VectorTileSource({ tileGrid: new TileGrid({ origin: [218128, 6126002], resolutions: [4096, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1, 0.5]