Rename _ol_layer_VectorTile_ to VectorTileLayer

This commit is contained in:
Tim Schaub
2018-01-11 10:25:51 -07:00
parent f94d69c7a8
commit 5337dc31d9
10 changed files with 34 additions and 34 deletions
+2 -2
View File
@@ -5,7 +5,7 @@ import GeoJSON from '../src/ol/format/GeoJSON.js';
import OSM from '../src/ol/source/OSM.js'; import OSM from '../src/ol/source/OSM.js';
import VectorTileSource from '../src/ol/source/VectorTile.js'; import VectorTileSource from '../src/ol/source/VectorTile.js';
import TileLayer from '../src/ol/layer/Tile.js'; import TileLayer from '../src/ol/layer/Tile.js';
import _ol_layer_VectorTile_ from '../src/ol/layer/VectorTile.js'; import VectorTileLayer from '../src/ol/layer/VectorTile.js';
import _ol_proj_Projection_ from '../src/ol/proj/Projection.js'; import _ol_proj_Projection_ from '../src/ol/proj/Projection.js';
@@ -93,7 +93,7 @@ fetch(url).then(function(response) {
}, },
url: 'data:' // arbitrary url, we don't use it in the tileLoadFunction url: 'data:' // arbitrary url, we don't use it in the tileLoadFunction
}); });
var vectorLayer = new _ol_layer_VectorTile_({ var vectorLayer = new VectorTileLayer({
source: vectorSource source: vectorSource
}); });
map.addLayer(vectorLayer); map.addLayer(vectorLayer);
+2 -2
View File
@@ -1,7 +1,7 @@
import Map from '../src/ol/Map.js'; import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js'; import View from '../src/ol/View.js';
import MVT from '../src/ol/format/MVT.js'; import MVT from '../src/ol/format/MVT.js';
import _ol_layer_VectorTile_ from '../src/ol/layer/VectorTile.js'; import VectorTileLayer from '../src/ol/layer/VectorTile.js';
import {get as getProjection} from '../src/ol/proj.js'; import {get as getProjection} from '../src/ol/proj.js';
import VectorTileSource 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_Fill_ from '../src/ol/style/Fill.js';
@@ -32,7 +32,7 @@ function tileUrlFunction(tileCoord) {
var map = new Map({ var map = new Map({
layers: [ layers: [
new _ol_layer_VectorTile_({ new VectorTileLayer({
source: new VectorTileSource({ source: new VectorTileSource({
attributions: '© <a href="https://www.mapbox.com/map-feedback/">Mapbox</a> ' + attributions: '© <a href="https://www.mapbox.com/map-feedback/">Mapbox</a> ' +
'© <a href="https://www.openstreetmap.org/copyright">' + '© <a href="https://www.openstreetmap.org/copyright">' +
+2 -2
View File
@@ -1,7 +1,7 @@
import Map from '../src/ol/Map.js'; import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js'; import View from '../src/ol/View.js';
import MVT from '../src/ol/format/MVT.js'; import MVT from '../src/ol/format/MVT.js';
import _ol_layer_VectorTile_ from '../src/ol/layer/VectorTile.js'; import VectorTileLayer from '../src/ol/layer/VectorTile.js';
import VectorTileSource 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_Fill_ from '../src/ol/style/Fill.js';
import _ol_style_Icon_ from '../src/ol/style/Icon.js'; import _ol_style_Icon_ from '../src/ol/style/Icon.js';
@@ -14,7 +14,7 @@ var key = 'pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg';
var map = new Map({ var map = new Map({
layers: [ layers: [
new _ol_layer_VectorTile_({ new VectorTileLayer({
declutter: true, declutter: true,
source: new VectorTileSource({ source: new VectorTileSource({
attributions: '© <a href="https://www.mapbox.com/map-feedback/">Mapbox</a> ' + attributions: '© <a href="https://www.mapbox.com/map-feedback/">Mapbox</a> ' +
+2 -2
View File
@@ -1,7 +1,7 @@
import Map from '../src/ol/Map.js'; import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js'; import View from '../src/ol/View.js';
import TopoJSON from '../src/ol/format/TopoJSON.js'; import TopoJSON from '../src/ol/format/TopoJSON.js';
import _ol_layer_VectorTile_ from '../src/ol/layer/VectorTile.js'; import VectorTileLayer from '../src/ol/layer/VectorTile.js';
import {fromLonLat} from '../src/ol/proj.js'; import {fromLonLat} from '../src/ol/proj.js';
import VectorTileSource 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_Fill_ from '../src/ol/style/Fill.js';
@@ -60,7 +60,7 @@ var roadStyle = function(feature) {
var map = new Map({ var map = new Map({
layers: [ layers: [
new _ol_layer_VectorTile_({ new VectorTileLayer({
source: new VectorTileSource({ source: new VectorTileSource({
attributions: '&copy; OpenStreetMap contributors, Whos On First, ' + attributions: '&copy; OpenStreetMap contributors, Whos On First, ' +
'Natural Earth, and openstreetmapdata.com', 'Natural Earth, and openstreetmapdata.com',
+2 -2
View File
@@ -1,7 +1,7 @@
import Map from '../src/ol/Map.js'; import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js'; import View from '../src/ol/View.js';
import MVT from '../src/ol/format/MVT.js'; import MVT from '../src/ol/format/MVT.js';
import _ol_layer_VectorTile_ from '../src/ol/layer/VectorTile.js'; import VectorTileLayer from '../src/ol/layer/VectorTile.js';
import VectorTileSource from '../src/ol/source/VectorTile.js'; import VectorTileSource from '../src/ol/source/VectorTile.js';
var map = new Map({ var map = new Map({
@@ -10,7 +10,7 @@ var map = new Map({
center: [0, 0], center: [0, 0],
zoom: 2 zoom: 2
}), }),
layers: [new _ol_layer_VectorTile_({ layers: [new VectorTileLayer({
source: new VectorTileSource({ source: new VectorTileSource({
format: new MVT(), format: new MVT(),
url: 'https://basemaps.arcgis.com/v1/arcgis/rest/services/World_Basemap/VectorTileServer/tile/{z}/{y}/{x}.pbf' url: 'https://basemaps.arcgis.com/v1/arcgis/rest/services/World_Basemap/VectorTileServer/tile/{z}/{y}/{x}.pbf'
+8 -8
View File
@@ -21,7 +21,7 @@ import _ol_obj_ from '../obj.js';
* @param {olx.layer.VectorTileOptions=} opt_options Options. * @param {olx.layer.VectorTileOptions=} opt_options Options.
* @api * @api
*/ */
var _ol_layer_VectorTile_ = function(opt_options) { var VectorTileLayer = function(opt_options) {
var options = opt_options ? opt_options : {}; var options = opt_options ? opt_options : {};
var renderMode = options.renderMode || _ol_layer_VectorTileRenderType_.HYBRID; var renderMode = options.renderMode || _ol_layer_VectorTileRenderType_.HYBRID;
@@ -54,7 +54,7 @@ var _ol_layer_VectorTile_ = function(opt_options) {
}; };
inherits(_ol_layer_VectorTile_, VectorLayer); inherits(VectorTileLayer, VectorLayer);
/** /**
@@ -63,7 +63,7 @@ inherits(_ol_layer_VectorTile_, VectorLayer);
* @observable * @observable
* @api * @api
*/ */
_ol_layer_VectorTile_.prototype.getPreload = function() { VectorTileLayer.prototype.getPreload = function() {
return ( return (
/** @type {number} */ this.get(_ol_layer_TileProperty_.PRELOAD) /** @type {number} */ this.get(_ol_layer_TileProperty_.PRELOAD)
); );
@@ -76,7 +76,7 @@ _ol_layer_VectorTile_.prototype.getPreload = function() {
* @observable * @observable
* @api * @api
*/ */
_ol_layer_VectorTile_.prototype.getUseInterimTilesOnError = function() { VectorTileLayer.prototype.getUseInterimTilesOnError = function() {
return ( return (
/** @type {boolean} */ this.get(_ol_layer_TileProperty_.USE_INTERIM_TILES_ON_ERROR) /** @type {boolean} */ this.get(_ol_layer_TileProperty_.USE_INTERIM_TILES_ON_ERROR)
); );
@@ -89,7 +89,7 @@ _ol_layer_VectorTile_.prototype.getUseInterimTilesOnError = function() {
* @observable * @observable
* @api * @api
*/ */
_ol_layer_VectorTile_.prototype.setPreload = function(preload) { VectorTileLayer.prototype.setPreload = function(preload) {
this.set(_ol_layer_TileProperty_.PRELOAD, preload); this.set(_ol_layer_TileProperty_.PRELOAD, preload);
}; };
@@ -100,7 +100,7 @@ _ol_layer_VectorTile_.prototype.setPreload = function(preload) {
* @observable * @observable
* @api * @api
*/ */
_ol_layer_VectorTile_.prototype.setUseInterimTilesOnError = function(useInterimTilesOnError) { VectorTileLayer.prototype.setUseInterimTilesOnError = function(useInterimTilesOnError) {
this.set( this.set(
_ol_layer_TileProperty_.USE_INTERIM_TILES_ON_ERROR, useInterimTilesOnError); _ol_layer_TileProperty_.USE_INTERIM_TILES_ON_ERROR, useInterimTilesOnError);
}; };
@@ -112,5 +112,5 @@ _ol_layer_VectorTile_.prototype.setUseInterimTilesOnError = function(useInterimT
* @return {ol.source.VectorTile} Source. * @return {ol.source.VectorTile} Source.
* @api * @api
*/ */
_ol_layer_VectorTile_.prototype.getSource; VectorTileLayer.prototype.getSource;
export default _ol_layer_VectorTile_; export default VectorTileLayer;
+2 -2
View File
@@ -4,7 +4,7 @@ import View from '../../../../src/ol/View.js';
import MVT from '../../../../src/ol/format/MVT.js'; import MVT from '../../../../src/ol/format/MVT.js';
import Point from '../../../../src/ol/geom/Point.js'; import Point from '../../../../src/ol/geom/Point.js';
import VectorLayer from '../../../../src/ol/layer/Vector.js'; import VectorLayer from '../../../../src/ol/layer/Vector.js';
import _ol_layer_VectorTile_ from '../../../../src/ol/layer/VectorTile.js'; import VectorTileLayer from '../../../../src/ol/layer/VectorTile.js';
import _ol_obj_ from '../../../../src/ol/obj.js'; import _ol_obj_ from '../../../../src/ol/obj.js';
import VectorSource from '../../../../src/ol/source/Vector.js'; import VectorSource from '../../../../src/ol/source/Vector.js';
import VectorTileSource from '../../../../src/ol/source/VectorTile.js'; import VectorTileSource from '../../../../src/ol/source/VectorTile.js';
@@ -62,7 +62,7 @@ describe('ol.rendering.layer.VectorTile', function() {
source: source source: source
}; };
_ol_obj_.assign(options, layerOptions); _ol_obj_.assign(options, layerOptions);
map.addLayer(new _ol_layer_VectorTile_(options)); map.addLayer(new VectorTileLayer(options));
} }
describe('vector tile layer', function() { describe('vector tile layer', function() {
+6 -6
View File
@@ -1,4 +1,4 @@
import _ol_layer_VectorTile_ from '../../../../src/ol/layer/VectorTile.js'; import VectorTileLayer from '../../../../src/ol/layer/VectorTile.js';
import VectorTileSource from '../../../../src/ol/source/VectorTile.js'; import VectorTileSource from '../../../../src/ol/source/VectorTile.js';
@@ -9,7 +9,7 @@ describe('ol.layer.VectorTile', function() {
var layer; var layer;
beforeEach(function() { beforeEach(function() {
layer = new _ol_layer_VectorTile_({ layer = new VectorTileLayer({
source: new VectorTileSource({}) source: new VectorTileSource({})
}); });
}); });
@@ -19,7 +19,7 @@ describe('ol.layer.VectorTile', function() {
}); });
it('creates an instance', function() { it('creates an instance', function() {
expect(layer).to.be.a(_ol_layer_VectorTile_); expect(layer).to.be.a(VectorTileLayer);
}); });
it('provides default preload', function() { it('provides default preload', function() {
@@ -38,18 +38,18 @@ describe('ol.layer.VectorTile', function() {
describe('constructor (options)', function() { describe('constructor (options)', function() {
it('works with options', function() { it('works with options', function() {
var layer = new _ol_layer_VectorTile_({ var layer = new VectorTileLayer({
renderMode: 'vector', renderMode: 'vector',
source: new VectorTileSource({}) source: new VectorTileSource({})
}); });
expect(layer.getRenderMode()).to.be('vector'); expect(layer.getRenderMode()).to.be('vector');
layer = new _ol_layer_VectorTile_({ layer = new VectorTileLayer({
renderMode: 'image', renderMode: 'image',
source: new VectorTileSource({}) source: new VectorTileSource({})
}); });
expect(layer.getRenderMode()).to.be('image'); expect(layer.getRenderMode()).to.be('image');
expect(function() { expect(function() {
layer = new _ol_layer_VectorTile_({ layer = new VectorTileLayer({
renderMode: 'foo', renderMode: 'foo',
source: new VectorTileSource({}) source: new VectorTileSource({})
}); });
@@ -9,7 +9,7 @@ import View from '../../../../../src/ol/View.js';
import * as _ol_extent_ from '../../../../../src/ol/extent.js'; import * as _ol_extent_ from '../../../../../src/ol/extent.js';
import MVT from '../../../../../src/ol/format/MVT.js'; import MVT from '../../../../../src/ol/format/MVT.js';
import Point from '../../../../../src/ol/geom/Point.js'; import Point from '../../../../../src/ol/geom/Point.js';
import _ol_layer_VectorTile_ from '../../../../../src/ol/layer/VectorTile.js'; import VectorTileLayer from '../../../../../src/ol/layer/VectorTile.js';
import {get as getProjection, fromLonLat} from '../../../../../src/ol/proj.js'; import {get as getProjection, fromLonLat} from '../../../../../src/ol/proj.js';
import _ol_proj_Projection_ from '../../../../../src/ol/proj/Projection.js'; import _ol_proj_Projection_ from '../../../../../src/ol/proj/Projection.js';
import _ol_render_canvas_ from '../../../../../src/ol/render/canvas.js'; import _ol_render_canvas_ from '../../../../../src/ol/render/canvas.js';
@@ -77,7 +77,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
tile.setState(TileState.LOADED); tile.setState(TileState.LOADED);
return tile; return tile;
}; };
layer = new _ol_layer_VectorTile_({ layer = new VectorTileLayer({
source: source, source: source,
style: layerStyle style: layerStyle
}); });
@@ -214,7 +214,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
}); });
it('works for multiple layers that use the same source', function() { it('works for multiple layers that use the same source', function() {
var layer2 = new _ol_layer_VectorTile_({ var layer2 = new VectorTileLayer({
source: source, source: source,
style: new _ol_style_Style_({ style: new _ol_style_Style_({
text: new _ol_style_Text_({ text: new _ol_style_Text_({
@@ -239,7 +239,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
describe('#prepareFrame', function() { describe('#prepareFrame', function() {
it('re-renders when layer changed', function() { it('re-renders when layer changed', function() {
var layer = new _ol_layer_VectorTile_({ var layer = new VectorTileLayer({
source: new VectorTileSource({ source: new VectorTileSource({
tileGrid: _ol_tilegrid_.createXYZ(), tileGrid: _ol_tilegrid_.createXYZ(),
transition: 0 transition: 0
@@ -308,7 +308,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
beforeEach(function() { beforeEach(function() {
replayGroup = {}; replayGroup = {};
layer = new _ol_layer_VectorTile_({ layer = new VectorTileLayer({
source: new VectorTileSource({ source: new VectorTileSource({
tileClass: TileClass, tileClass: TileClass,
tileGrid: _ol_tilegrid_.createXYZ() tileGrid: _ol_tilegrid_.createXYZ()
@@ -358,7 +358,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
var map = new Map({ var map = new Map({
target: target, target: target,
layers: [ layers: [
new _ol_layer_VectorTile_({ new VectorTileLayer({
extent: extent, extent: extent,
source: source source: source
}) })
+2 -2
View File
@@ -3,7 +3,7 @@ import View from '../../../../src/ol/View.js';
import VectorImageTile from '../../../../src/ol/VectorImageTile.js'; import VectorImageTile from '../../../../src/ol/VectorImageTile.js';
import VectorTile from '../../../../src/ol/VectorTile.js'; import VectorTile from '../../../../src/ol/VectorTile.js';
import MVT from '../../../../src/ol/format/MVT.js'; import MVT from '../../../../src/ol/format/MVT.js';
import _ol_layer_VectorTile_ from '../../../../src/ol/layer/VectorTile.js'; import VectorTileLayer from '../../../../src/ol/layer/VectorTile.js';
import {get as getProjection} from '../../../../src/ol/proj.js'; import {get as getProjection} from '../../../../src/ol/proj.js';
import VectorTileSource from '../../../../src/ol/source/VectorTile.js'; import VectorTileSource from '../../../../src/ol/source/VectorTile.js';
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
@@ -111,7 +111,7 @@ describe('ol.source.VectorTile', function() {
map = new Map({ map = new Map({
layers: [ layers: [
new _ol_layer_VectorTile_({ new VectorTileLayer({
extent: extent, extent: extent,
source: source source: source
}) })