Rename _ol_tilegrid_TileGrid_ to TileGrid

This commit is contained in:
Frederic Junod
2017-12-22 10:56:20 +01:00
parent 7617e4e377
commit 297c9e45ab
16 changed files with 103 additions and 104 deletions

View File

@@ -9,7 +9,7 @@ import _ol_style_Icon_ from '../src/ol/style/Icon.js';
import _ol_style_Stroke_ from '../src/ol/style/Stroke.js';
import _ol_style_Style_ from '../src/ol/style/Style.js';
import _ol_style_Text_ from '../src/ol/style/Text.js';
import _ol_tilegrid_TileGrid_ from '../src/ol/tilegrid/TileGrid.js';
import TileGrid from '../src/ol/tilegrid/TileGrid.js';
var key = 'pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg';
@@ -38,7 +38,7 @@ var map = new Map({
'© <a href="https://www.openstreetmap.org/copyright">' +
'OpenStreetMap contributors</a>',
format: new MVT(),
tileGrid: new _ol_tilegrid_TileGrid_({
tileGrid: new TileGrid({
extent: getProjection('EPSG:3857').getExtent(),
resolutions: resolutions,
tileSize: 512

View File

@@ -10,7 +10,7 @@ import _ol_source_TileImage_ from '../src/ol/source/TileImage.js';
import _ol_source_TileWMS_ from '../src/ol/source/TileWMS.js';
import _ol_source_WMTS_ from '../src/ol/source/WMTS.js';
import _ol_source_XYZ_ from '../src/ol/source/XYZ.js';
import _ol_tilegrid_TileGrid_ from '../src/ol/tilegrid/TileGrid.js';
import TileGrid from '../src/ol/tilegrid/TileGrid.js';
import proj4 from 'proj4';
@@ -140,7 +140,7 @@ layers['states'] = new TileLayer({
crossOrigin: '',
params: {'LAYERS': 'topp:states'},
serverType: 'geoserver',
tileGrid: new _ol_tilegrid_TileGrid_({
tileGrid: new TileGrid({
extent: [-13884991, 2870341, -7455066, 6338219],
resolutions: resolutions,
tileSize: [512, 256]

View File

@@ -5,7 +5,7 @@ import TileLayer from '../src/ol/layer/Tile.js';
import {get as getProjection} from '../src/ol/proj.js';
import _ol_source_OSM_ from '../src/ol/source/OSM.js';
import _ol_source_TileWMS_ from '../src/ol/source/TileWMS.js';
import _ol_tilegrid_TileGrid_ from '../src/ol/tilegrid/TileGrid.js';
import TileGrid from '../src/ol/tilegrid/TileGrid.js';
var projExtent = getProjection('EPSG:3857').getExtent();
@@ -14,7 +14,7 @@ var resolutions = new Array(22);
for (var i = 0, ii = resolutions.length; i < ii; ++i) {
resolutions[i] = startResolution / Math.pow(2, i);
}
var tileGrid = new _ol_tilegrid_TileGrid_({
var tileGrid = new TileGrid({
extent: [-13884991, 2870341, -7455066, 6338219],
resolutions: resolutions,
tileSize: [512, 256]

View File

@@ -11,7 +11,7 @@ import {createCanvasContext2D} from '../dom.js';
import {getTopLeft} from '../extent.js';
import _ol_size_ from '../size.js';
import _ol_source_TileImage_ from '../source/TileImage.js';
import _ol_tilegrid_TileGrid_ from '../tilegrid/TileGrid.js';
import TileGrid from '../tilegrid/TileGrid.js';
/**
* @classdesc
@@ -81,7 +81,7 @@ var _ol_source_Zoomify_ = function(opt_options) {
}
resolutions.reverse();
var tileGrid = new _ol_tilegrid_TileGrid_({
var tileGrid = new TileGrid({
tileSize: tileSize,
extent: extent,
origin: getTopLeft(extent),

View File

@@ -8,7 +8,7 @@ import Corner from './extent/Corner.js';
import _ol_obj_ from './obj.js';
import {get as getProjection, METERS_PER_UNIT} from './proj.js';
import _ol_proj_Units_ from './proj/Units.js';
import _ol_tilegrid_TileGrid_ from './tilegrid/TileGrid.js';
import TileGrid from './tilegrid/TileGrid.js';
var _ol_tilegrid_ = {};
@@ -63,7 +63,7 @@ _ol_tilegrid_.createForExtent = function(extent, opt_maxZoom, opt_tileSize, opt_
var resolutions = _ol_tilegrid_.resolutionsFromExtent(
extent, opt_maxZoom, opt_tileSize);
return new _ol_tilegrid_TileGrid_({
return new TileGrid({
extent: extent,
origin: getCorner(extent, corner),
resolutions: resolutions,
@@ -89,7 +89,7 @@ _ol_tilegrid_.createXYZ = function(opt_options) {
options.extent, options.maxZoom, options.tileSize);
delete options.maxZoom;
return new _ol_tilegrid_TileGrid_(options);
return new TileGrid(options);
};

View File

@@ -20,7 +20,7 @@ import _ol_tilecoord_ from '../tilecoord.js';
* @struct
* @api
*/
var _ol_tilegrid_TileGrid_ = function(options) {
var TileGrid = function(options) {
/**
* @protected
@@ -155,7 +155,7 @@ var _ol_tilegrid_TileGrid_ = function(options) {
* @private
* @type {ol.TileCoord}
*/
_ol_tilegrid_TileGrid_.tmpTileCoord_ = [0, 0, 0];
TileGrid.tmpTileCoord_ = [0, 0, 0];
/**
@@ -166,7 +166,7 @@ _ol_tilegrid_TileGrid_.tmpTileCoord_ = [0, 0, 0];
* @param {function(ol.TileCoord)} callback Function called with each tile coordinate.
* @api
*/
_ol_tilegrid_TileGrid_.prototype.forEachTileCoord = function(extent, zoom, callback) {
TileGrid.prototype.forEachTileCoord = function(extent, zoom, callback) {
var tileRange = this.getTileRangeForExtentAndZ(extent, zoom);
for (var i = tileRange.minX, ii = tileRange.maxX; i <= ii; ++i) {
for (var j = tileRange.minY, jj = tileRange.maxY; j <= jj; ++j) {
@@ -185,7 +185,7 @@ _ol_tilegrid_TileGrid_.prototype.forEachTileCoord = function(extent, zoom, callb
* @return {boolean} Callback succeeded.
* @template T
*/
_ol_tilegrid_TileGrid_.prototype.forEachTileCoordParentTileRange = function(tileCoord, callback, opt_this, opt_tileRange, opt_extent) {
TileGrid.prototype.forEachTileCoordParentTileRange = function(tileCoord, callback, opt_this, opt_tileRange, opt_extent) {
var tileRange, x, y;
var tileCoordExtent = null;
var z = tileCoord[0] - 1;
@@ -216,7 +216,7 @@ _ol_tilegrid_TileGrid_.prototype.forEachTileCoordParentTileRange = function(tile
* Get the extent for this tile grid, if it was configured.
* @return {ol.Extent} Extent.
*/
_ol_tilegrid_TileGrid_.prototype.getExtent = function() {
TileGrid.prototype.getExtent = function() {
return this.extent_;
};
@@ -226,7 +226,7 @@ _ol_tilegrid_TileGrid_.prototype.getExtent = function() {
* @return {number} Max zoom.
* @api
*/
_ol_tilegrid_TileGrid_.prototype.getMaxZoom = function() {
TileGrid.prototype.getMaxZoom = function() {
return this.maxZoom;
};
@@ -236,7 +236,7 @@ _ol_tilegrid_TileGrid_.prototype.getMaxZoom = function() {
* @return {number} Min zoom.
* @api
*/
_ol_tilegrid_TileGrid_.prototype.getMinZoom = function() {
TileGrid.prototype.getMinZoom = function() {
return this.minZoom;
};
@@ -247,7 +247,7 @@ _ol_tilegrid_TileGrid_.prototype.getMinZoom = function() {
* @return {ol.Coordinate} Origin.
* @api
*/
_ol_tilegrid_TileGrid_.prototype.getOrigin = function(z) {
TileGrid.prototype.getOrigin = function(z) {
if (this.origin_) {
return this.origin_;
} else {
@@ -262,7 +262,7 @@ _ol_tilegrid_TileGrid_.prototype.getOrigin = function(z) {
* @return {number} Resolution.
* @api
*/
_ol_tilegrid_TileGrid_.prototype.getResolution = function(z) {
TileGrid.prototype.getResolution = function(z) {
return this.resolutions_[z];
};
@@ -272,7 +272,7 @@ _ol_tilegrid_TileGrid_.prototype.getResolution = function(z) {
* @return {Array.<number>} Resolutions.
* @api
*/
_ol_tilegrid_TileGrid_.prototype.getResolutions = function() {
TileGrid.prototype.getResolutions = function() {
return this.resolutions_;
};
@@ -283,7 +283,7 @@ _ol_tilegrid_TileGrid_.prototype.getResolutions = function() {
* @param {ol.Extent=} opt_extent Temporary ol.Extent object.
* @return {ol.TileRange} Tile range.
*/
_ol_tilegrid_TileGrid_.prototype.getTileCoordChildTileRange = function(tileCoord, opt_tileRange, opt_extent) {
TileGrid.prototype.getTileCoordChildTileRange = function(tileCoord, opt_tileRange, opt_extent) {
if (tileCoord[0] < this.maxZoom) {
if (this.zoomFactor_ === 2) {
var minX = tileCoord[1] * 2;
@@ -305,7 +305,7 @@ _ol_tilegrid_TileGrid_.prototype.getTileCoordChildTileRange = function(tileCoord
* @param {ol.Extent=} opt_extent Temporary ol.Extent object.
* @return {ol.Extent} Extent.
*/
_ol_tilegrid_TileGrid_.prototype.getTileRangeExtent = function(z, tileRange, opt_extent) {
TileGrid.prototype.getTileRangeExtent = function(z, tileRange, opt_extent) {
var origin = this.getOrigin(z);
var resolution = this.getResolution(z);
var tileSize = _ol_size_.toSize(this.getTileSize(z), this.tmpSize_);
@@ -324,8 +324,8 @@ _ol_tilegrid_TileGrid_.prototype.getTileRangeExtent = function(z, tileRange, opt
* @param {ol.TileRange=} opt_tileRange Temporary tile range object.
* @return {ol.TileRange} Tile range.
*/
_ol_tilegrid_TileGrid_.prototype.getTileRangeForExtentAndZ = function(extent, z, opt_tileRange) {
var tileCoord = _ol_tilegrid_TileGrid_.tmpTileCoord_;
TileGrid.prototype.getTileRangeForExtentAndZ = function(extent, z, opt_tileRange) {
var tileCoord = TileGrid.tmpTileCoord_;
this.getTileCoordForXYAndZ_(extent[0], extent[1], z, false, tileCoord);
var minX = tileCoord[1];
var minY = tileCoord[2];
@@ -339,7 +339,7 @@ _ol_tilegrid_TileGrid_.prototype.getTileRangeForExtentAndZ = function(extent, z,
* @param {ol.TileCoord} tileCoord Tile coordinate.
* @return {ol.Coordinate} Tile center.
*/
_ol_tilegrid_TileGrid_.prototype.getTileCoordCenter = function(tileCoord) {
TileGrid.prototype.getTileCoordCenter = function(tileCoord) {
var origin = this.getOrigin(tileCoord[0]);
var resolution = this.getResolution(tileCoord[0]);
var tileSize = _ol_size_.toSize(this.getTileSize(tileCoord[0]), this.tmpSize_);
@@ -358,7 +358,7 @@ _ol_tilegrid_TileGrid_.prototype.getTileCoordCenter = function(tileCoord) {
* @return {ol.Extent} Extent.
* @api
*/
_ol_tilegrid_TileGrid_.prototype.getTileCoordExtent = function(tileCoord, opt_extent) {
TileGrid.prototype.getTileCoordExtent = function(tileCoord, opt_extent) {
var origin = this.getOrigin(tileCoord[0]);
var resolution = this.getResolution(tileCoord[0]);
var tileSize = _ol_size_.toSize(this.getTileSize(tileCoord[0]), this.tmpSize_);
@@ -381,7 +381,7 @@ _ol_tilegrid_TileGrid_.prototype.getTileCoordExtent = function(tileCoord, opt_ex
* @return {ol.TileCoord} Tile coordinate.
* @api
*/
_ol_tilegrid_TileGrid_.prototype.getTileCoordForCoordAndResolution = function(coordinate, resolution, opt_tileCoord) {
TileGrid.prototype.getTileCoordForCoordAndResolution = function(coordinate, resolution, opt_tileCoord) {
return this.getTileCoordForXYAndResolution_(
coordinate[0], coordinate[1], resolution, false, opt_tileCoord);
};
@@ -400,7 +400,7 @@ _ol_tilegrid_TileGrid_.prototype.getTileCoordForCoordAndResolution = function(co
* @return {ol.TileCoord} Tile coordinate.
* @private
*/
_ol_tilegrid_TileGrid_.prototype.getTileCoordForXYAndResolution_ = function(
TileGrid.prototype.getTileCoordForXYAndResolution_ = function(
x, y, resolution, reverseIntersectionPolicy, opt_tileCoord) {
var z = this.getZForResolution(resolution);
var scale = resolution / this.getResolution(z);
@@ -441,7 +441,7 @@ _ol_tilegrid_TileGrid_.prototype.getTileCoordForXYAndResolution_ = function(
* @return {ol.TileCoord} Tile coordinate.
* @private
*/
_ol_tilegrid_TileGrid_.prototype.getTileCoordForXYAndZ_ = function(x, y, z, reverseIntersectionPolicy, opt_tileCoord) {
TileGrid.prototype.getTileCoordForXYAndZ_ = function(x, y, z, reverseIntersectionPolicy, opt_tileCoord) {
var origin = this.getOrigin(z);
var resolution = this.getResolution(z);
var tileSize = _ol_size_.toSize(this.getTileSize(z), this.tmpSize_);
@@ -473,7 +473,7 @@ _ol_tilegrid_TileGrid_.prototype.getTileCoordForXYAndZ_ = function(x, y, z, reve
* @return {ol.TileCoord} Tile coordinate.
* @api
*/
_ol_tilegrid_TileGrid_.prototype.getTileCoordForCoordAndZ = function(coordinate, z, opt_tileCoord) {
TileGrid.prototype.getTileCoordForCoordAndZ = function(coordinate, z, opt_tileCoord) {
return this.getTileCoordForXYAndZ_(
coordinate[0], coordinate[1], z, false, opt_tileCoord);
};
@@ -483,7 +483,7 @@ _ol_tilegrid_TileGrid_.prototype.getTileCoordForCoordAndZ = function(coordinate,
* @param {ol.TileCoord} tileCoord Tile coordinate.
* @return {number} Tile resolution.
*/
_ol_tilegrid_TileGrid_.prototype.getTileCoordResolution = function(tileCoord) {
TileGrid.prototype.getTileCoordResolution = function(tileCoord) {
return this.resolutions_[tileCoord[0]];
};
@@ -496,7 +496,7 @@ _ol_tilegrid_TileGrid_.prototype.getTileCoordResolution = function(tileCoord) {
* @return {number|ol.Size} Tile size.
* @api
*/
_ol_tilegrid_TileGrid_.prototype.getTileSize = function(z) {
TileGrid.prototype.getTileSize = function(z) {
if (this.tileSize_) {
return this.tileSize_;
} else {
@@ -509,7 +509,7 @@ _ol_tilegrid_TileGrid_.prototype.getTileSize = function(z) {
* @param {number} z Zoom level.
* @return {ol.TileRange} Extent tile range for the specified zoom level.
*/
_ol_tilegrid_TileGrid_.prototype.getFullTileRange = function(z) {
TileGrid.prototype.getFullTileRange = function(z) {
if (!this.fullTileRanges_) {
return null;
} else {
@@ -526,8 +526,7 @@ _ol_tilegrid_TileGrid_.prototype.getFullTileRange = function(z) {
* @return {number} Z.
* @api
*/
_ol_tilegrid_TileGrid_.prototype.getZForResolution = function(
resolution, opt_direction) {
TileGrid.prototype.getZForResolution = function(resolution, opt_direction) {
var z = linearFindNearest(this.resolutions_, resolution, opt_direction || 0);
return clamp(z, this.minZoom, this.maxZoom);
};
@@ -537,7 +536,7 @@ _ol_tilegrid_TileGrid_.prototype.getZForResolution = function(
* @param {!ol.Extent} extent Extent for this tile grid.
* @private
*/
_ol_tilegrid_TileGrid_.prototype.calculateTileRanges_ = function(extent) {
TileGrid.prototype.calculateTileRanges_ = function(extent) {
var length = this.resolutions_.length;
var fullTileRanges = new Array(length);
for (var z = this.minZoom; z < length; ++z) {
@@ -545,4 +544,4 @@ _ol_tilegrid_TileGrid_.prototype.calculateTileRanges_ = function(extent) {
}
this.fullTileRanges_ = fullTileRanges;
};
export default _ol_tilegrid_TileGrid_;
export default TileGrid;

View File

@@ -4,7 +4,7 @@
import {inherits} from '../index.js';
import {find} from '../array.js';
import {get as getProjection} from '../proj.js';
import _ol_tilegrid_TileGrid_ from '../tilegrid/TileGrid.js';
import TileGrid from '../tilegrid/TileGrid.js';
/**
* @classdesc
@@ -24,7 +24,7 @@ var WMTSTileGrid = function(options) {
this.matrixIds_ = options.matrixIds;
// FIXME: should the matrixIds become optional?
_ol_tilegrid_TileGrid_.call(this, {
TileGrid.call(this, {
extent: options.extent,
origin: options.origin,
origins: options.origins,
@@ -35,7 +35,7 @@ var WMTSTileGrid = function(options) {
});
};
inherits(WMTSTileGrid, _ol_tilegrid_TileGrid_);
inherits(WMTSTileGrid, TileGrid);
/**

View File

@@ -6,7 +6,7 @@ import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js';
import Source from '../../../../src/ol/source/Source.js';
import _ol_source_Tile_ from '../../../../src/ol/source/Tile.js';
import _ol_tilecoord_ from '../../../../src/ol/tilecoord.js';
import _ol_tilegrid_TileGrid_ from '../../../../src/ol/tilegrid/TileGrid.js';
import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js';
/**
@@ -19,7 +19,7 @@ import _ol_tilegrid_TileGrid_ from '../../../../src/ol/tilegrid/TileGrid.js';
* tile state.
*/
var MockTile = function(tileStates) {
var tileGrid = new _ol_tilegrid_TileGrid_({
var tileGrid = new TileGrid({
resolutions: [360 / 256, 180 / 256, 90 / 256, 45 / 256],
origin: [-180, -180],
tileSize: 256

View File

@@ -1,7 +1,7 @@
import {get as getProjection, transformExtent, fromLonLat} from '../../../../src/ol/proj.js';
import _ol_source_Tile_ from '../../../../src/ol/source/Tile.js';
import _ol_source_TileUTFGrid_ from '../../../../src/ol/source/TileUTFGrid.js';
import _ol_tilegrid_TileGrid_ from '../../../../src/ol/tilegrid/TileGrid.js';
import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js';
describe('ol.source.TileUTFGrid', function() {
@@ -66,7 +66,7 @@ describe('ol.source.TileUTFGrid', function() {
source.on('change', function(event) {
if (source.getState() === 'ready') {
expect(source.tileGrid).to.be.an(_ol_tilegrid_TileGrid_);
expect(source.tileGrid).to.be.an(TileGrid);
done();
}
});
@@ -101,7 +101,7 @@ describe('ol.source.TileUTFGrid', function() {
var tileGrid = source.getTileGrid();
expect(tileGrid).to.not.be(null);
expect(tileGrid).to.be.an(_ol_tilegrid_TileGrid_);
expect(tileGrid).to.be.an(TileGrid);
});
it('sets up a tilegrid with expected extent', function() {

View File

@@ -2,7 +2,7 @@ import ImageTile from '../../../../src/ol/ImageTile.js';
import {get as getProjection} from '../../../../src/ol/proj.js';
import _ol_source_TileWMS_ from '../../../../src/ol/source/TileWMS.js';
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
import _ol_tilegrid_TileGrid_ from '../../../../src/ol/tilegrid/TileGrid.js';
import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js';
describe('ol.source.TileWMS', function() {
@@ -182,7 +182,7 @@ describe('ol.source.TileWMS', function() {
});
it('works with non-square tiles', function() {
options.tileGrid = new _ol_tilegrid_TileGrid_({
options.tileGrid = new TileGrid({
tileSize: [640, 320],
resolutions: [1.40625, 0.703125, 0.3515625, 0.17578125],
origin: [-180, -90]

View File

@@ -7,7 +7,7 @@ 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 _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
import _ol_tilegrid_TileGrid_ from '../../../../src/ol/tilegrid/TileGrid.js';
import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js';
describe('ol.source.VectorTile', function() {
@@ -97,7 +97,7 @@ describe('ol.source.VectorTile', function() {
var extent = [665584.2026596286, 7033250.839875697, 667162.0221431496, 7035280.378636755];
source = new _ol_source_VectorTile_({
tileGrid: new _ol_tilegrid_TileGrid_({
tileGrid: new TileGrid({
origin: [218128, 6126002],
resolutions: [4096, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1, 0.5]
}),

View File

@@ -2,7 +2,7 @@ import {DEFAULT_TILE_SIZE} from '../../../../src/ol/tilegrid/common.js';
import _ol_events_ from '../../../../src/ol/events.js';
import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js';
import _ol_source_Zoomify_ from '../../../../src/ol/source/Zoomify.js';
import _ol_tilegrid_TileGrid_ from '../../../../src/ol/tilegrid/TileGrid.js';
import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js';
describe('ol.source.Zoomify', function() {
@@ -125,7 +125,7 @@ describe('ol.source.Zoomify', function() {
var sources = [getZoomifySource(), getIIPSource()];
for (var i = 0; i < sources.length; i++) {
var tileGrid = sources[i].getTileGrid();
expect(tileGrid).to.be.a(_ol_tilegrid_TileGrid_);
expect(tileGrid).to.be.a(TileGrid);
}
});

View File

@@ -1,5 +1,5 @@
import _ol_tilecoord_ from '../../../src/ol/tilecoord.js';
import _ol_tilegrid_TileGrid_ from '../../../src/ol/tilegrid/TileGrid.js';
import TileGrid from '../../../src/ol/tilegrid/TileGrid.js';
describe('ol.TileCoord', function() {
@@ -50,7 +50,7 @@ describe('ol.TileCoord', function() {
describe('withinExtentAndZ', function() {
it('restricts by z', function() {
var tileGrid = new _ol_tilegrid_TileGrid_({
var tileGrid = new TileGrid({
extent: [10, 20, 30, 40],
tileSize: 10,
resolutions: [2, 1],
@@ -62,7 +62,7 @@ describe('ol.TileCoord', function() {
});
it('restricts by extent when extent defines tile ranges', function() {
var tileGrid = new _ol_tilegrid_TileGrid_({
var tileGrid = new TileGrid({
extent: [10, 20, 30, 40],
sizes: [[3, -3]],
tileSize: 10,
@@ -74,7 +74,7 @@ describe('ol.TileCoord', function() {
});
it('restricts by extent when sizes define tile ranges', function() {
var tileGrid = new _ol_tilegrid_TileGrid_({
var tileGrid = new TileGrid({
origin: [10, 20],
sizes: [[3, 3]],
tileSize: 10,
@@ -89,7 +89,7 @@ describe('ol.TileCoord', function() {
});
it('restricts by extent when sizes (neg y) define tile ranges', function() {
var tileGrid = new _ol_tilegrid_TileGrid_({
var tileGrid = new TileGrid({
origin: [10, 40],
sizes: [[3, -3]],
tileSize: 10,
@@ -104,7 +104,7 @@ describe('ol.TileCoord', function() {
});
it('does not restrict by extent with no extent or sizes', function() {
var tileGrid = new _ol_tilegrid_TileGrid_({
var tileGrid = new TileGrid({
origin: [10, 20],
tileSize: 10,
resolutions: [1]

View File

@@ -5,7 +5,7 @@ import {get as getProjection, METERS_PER_UNIT} from '../../../../src/ol/proj.js'
import _ol_proj_EPSG3857_ from '../../../../src/ol/proj/EPSG3857.js';
import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js';
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
import _ol_tilegrid_TileGrid_ from '../../../../src/ol/tilegrid/TileGrid.js';
import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js';
describe('ol.tilegrid.TileGrid', function() {
@@ -22,7 +22,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create valid', function() {
it('does not throw an exception', function() {
expect(function() {
return new _ol_tilegrid_TileGrid_({
return new TileGrid({
resolutions: resolutions,
origin: origin,
tileSize: tileSize
@@ -34,7 +34,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create with duplicate resolutions', function() {
it('throws an exception', function() {
expect(function() {
return new _ol_tilegrid_TileGrid_({
return new TileGrid({
resolutions: [100, 50, 50, 25, 10],
origin: origin,
tileSize: tileSize
@@ -47,7 +47,7 @@ describe('ol.tilegrid.TileGrid', function() {
it('throws an exception', function() {
var resolutions = [100, 25, 50, 10];
expect(function() {
return new _ol_tilegrid_TileGrid_({
return new TileGrid({
resolutions: resolutions,
origin: origin,
tileSize: tileSize
@@ -59,7 +59,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create with multiple origins', function() {
it('does not throw an exception', function() {
expect(function() {
return new _ol_tilegrid_TileGrid_({
return new TileGrid({
resolutions: [100, 50, 25, 10],
origins: [origin, origin, origin, origin],
tileSize: tileSize
@@ -71,7 +71,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create with both origin and multiple origins', function() {
it('throws an exception', function() {
expect(function() {
return new _ol_tilegrid_TileGrid_({
return new TileGrid({
resolutions: [100, 50, 25, 10],
origins: [origin, origin, origin, origin],
origin: origin,
@@ -84,7 +84,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create with too few origins', function() {
it('throws an exception', function() {
expect(function() {
return new _ol_tilegrid_TileGrid_({
return new TileGrid({
resolutions: [100, 50, 25, 10],
origins: [origin, origin, origin],
tileSize: tileSize
@@ -96,7 +96,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create with too many origins', function() {
it('throws an exception', function() {
expect(function() {
return new _ol_tilegrid_TileGrid_({
return new TileGrid({
resolutions: [100, 50, 25, 10],
origins: [origin, origin, origin, origin, origin],
tileSize: tileSize
@@ -108,7 +108,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create with multiple tileSizes', function() {
it('does not throw an exception', function() {
expect(function() {
return new _ol_tilegrid_TileGrid_({
return new TileGrid({
resolutions: [100, 50, 25, 10],
tileSizes: [tileSize, tileSize, tileSize, tileSize],
origin: origin
@@ -120,7 +120,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create with both tileSize and multiple tileSizes', function() {
it('throws an exception', function() {
expect(function() {
return new _ol_tilegrid_TileGrid_({
return new TileGrid({
resolutions: [100, 50, 25, 10],
tileSizes: [tileSize, tileSize, tileSize, tileSize],
tileSize: tileSize,
@@ -133,7 +133,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create with too few tileSizes', function() {
it('throws an exception', function() {
expect(function() {
return new _ol_tilegrid_TileGrid_({
return new TileGrid({
resolutions: [100, 50, 25, 10],
tileSizes: [tileSize, tileSize, tileSize],
origin: origin
@@ -145,7 +145,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create with too many tileSizes', function() {
it('throws an exception', function() {
expect(function() {
return new _ol_tilegrid_TileGrid_({
return new TileGrid({
resolutions: [100, 50, 25, 10],
tileSizes: [tileSize, tileSize, tileSize, tileSize, tileSize],
origin: origin
@@ -157,7 +157,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create with origin', function() {
var tileGrid;
beforeEach(function() {
tileGrid = new _ol_tilegrid_TileGrid_({
tileGrid = new TileGrid({
origin: [10, 20],
tileSize: 10,
resolutions: [1]
@@ -180,7 +180,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create with extent', function() {
var tileGrid;
beforeEach(function() {
tileGrid = new _ol_tilegrid_TileGrid_({
tileGrid = new TileGrid({
extent: [10, 20, 30, 40],
tileSize: 10,
resolutions: [1]
@@ -203,7 +203,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create with extent and sizes', function() {
var tileGrid;
beforeEach(function() {
tileGrid = new _ol_tilegrid_TileGrid_({
tileGrid = new TileGrid({
extent: [10, 20, 30, 40],
sizes: [[3, -3]],
tileSize: 10,
@@ -227,7 +227,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create with top-left origin and sizes', function() {
var tileGrid;
beforeEach(function() {
tileGrid = new _ol_tilegrid_TileGrid_({
tileGrid = new TileGrid({
origin: [10, 40],
sizes: [[3, -3]],
tileSize: 10,
@@ -245,7 +245,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create with bottom-left origin and sizes', function() {
var tileGrid;
beforeEach(function() {
tileGrid = new _ol_tilegrid_TileGrid_({
tileGrid = new TileGrid({
origin: [10, 10],
sizes: [[3, 3]],
tileSize: 10,
@@ -262,7 +262,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('create with extent and origin', function() {
it('uses both origin and extent', function() {
var tileGrid = new _ol_tilegrid_TileGrid_({
var tileGrid = new TileGrid({
origin: [0, 0],
extent: [10, 20, 30, 40],
tileSize: 10,
@@ -277,7 +277,7 @@ describe('ol.tilegrid.TileGrid', function() {
it('allows creation of tile grid from extent', function() {
var extent = _ol_extent_.createOrUpdate(-100, -100, 100, 100);
var grid = _ol_tilegrid_.createForExtent(extent);
expect(grid).to.be.a(_ol_tilegrid_TileGrid_);
expect(grid).to.be.a(TileGrid);
var resolutions = grid.getResolutions();
expect(resolutions.length).to.be(DEFAULT_MAX_ZOOM + 1);
@@ -287,7 +287,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('#zoomFactor_', function() {
it('is set for a consistent zoom factor', function() {
var grid = new _ol_tilegrid_TileGrid_({
var grid = new TileGrid({
resolutions: [10, 5, 2.5, 1.25],
origin: origin,
tileSize: tileSize
@@ -296,7 +296,7 @@ describe('ol.tilegrid.TileGrid', function() {
});
it('is not set for an inconsistent zoom factor', function() {
var grid = new _ol_tilegrid_TileGrid_({
var grid = new TileGrid({
resolutions: [10, 5, 3, 1.25],
origin: origin,
tileSize: tileSize
@@ -310,7 +310,7 @@ describe('ol.tilegrid.TileGrid', function() {
it('allows easier creation of a tile grid', function() {
var projection = getProjection('EPSG:3857');
var grid = _ol_tilegrid_.createForProjection(projection);
expect(grid).to.be.a(_ol_tilegrid_TileGrid_);
expect(grid).to.be.a(TileGrid);
var resolutions = grid.getResolutions();
expect(resolutions.length).to.be(DEFAULT_MAX_ZOOM + 1);
@@ -319,7 +319,7 @@ describe('ol.tilegrid.TileGrid', function() {
it('accepts a number of zoom levels', function() {
var projection = getProjection('EPSG:3857');
var grid = _ol_tilegrid_.createForProjection(projection, 18);
expect(grid).to.be.a(_ol_tilegrid_TileGrid_);
expect(grid).to.be.a(TileGrid);
var resolutions = grid.getResolutions();
expect(resolutions.length).to.be(19);
@@ -328,7 +328,7 @@ describe('ol.tilegrid.TileGrid', function() {
it('accepts a big number of zoom levels', function() {
var projection = getProjection('EPSG:3857');
var grid = _ol_tilegrid_.createForProjection(projection, 23);
expect(grid).to.be.a(_ol_tilegrid_TileGrid_);
expect(grid).to.be.a(TileGrid);
var resolutions = grid.getResolutions();
expect(resolutions.length).to.be(24);
@@ -421,7 +421,7 @@ describe('ol.tilegrid.TileGrid', function() {
it('gets the default tile grid for a projection', function() {
var projection = getProjection('EPSG:3857');
var grid = _ol_tilegrid_.getForProjection(projection);
expect(grid).to.be.a(_ol_tilegrid_TileGrid_);
expect(grid).to.be.a(TileGrid);
var resolutions = grid.getResolutions();
expect(resolutions.length).to.be(DEFAULT_MAX_ZOOM + 1);
@@ -586,7 +586,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('Y North, X East', function() {
it('returns the expected TileCoord', function() {
origin = [0, 0];
var tileGrid = new _ol_tilegrid_TileGrid_({
var tileGrid = new TileGrid({
resolutions: resolutions,
origin: origin,
tileSize: tileSize
@@ -618,7 +618,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('Y South, X East', function() {
it('returns the expected TileCoord', function() {
origin = [0, 100000];
var tileGrid = new _ol_tilegrid_TileGrid_({
var tileGrid = new TileGrid({
resolutions: resolutions,
origin: origin,
tileSize: tileSize
@@ -651,7 +651,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('getTileCoordForCoordAndResolution', function() {
it('returns the expected TileCoord', function() {
var tileSize = 256;
var tileGrid = new _ol_tilegrid_TileGrid_({
var tileGrid = new TileGrid({
resolutions: [10],
origin: origin,
tileSize: tileSize
@@ -728,7 +728,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('getTileCoordForXYAndResolution_', function() {
it('returns higher tile coord for intersections by default', function() {
var tileGrid = new _ol_tilegrid_TileGrid_({
var tileGrid = new TileGrid({
resolutions: resolutions,
origin: origin,
tileSize: tileSize
@@ -753,7 +753,7 @@ describe('ol.tilegrid.TileGrid', function() {
});
it('handles alt intersection policy', function() {
var tileGrid = new _ol_tilegrid_TileGrid_({
var tileGrid = new TileGrid({
resolutions: resolutions,
origin: origin,
tileSize: tileSize
@@ -781,7 +781,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('getTileCoordCenter', function() {
it('returns the expected center', function() {
var tileGrid = new _ol_tilegrid_TileGrid_({
var tileGrid = new TileGrid({
resolutions: resolutions,
origin: origin,
tileSize: tileSize
@@ -804,7 +804,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('getTileCoordExtent', function() {
it('returns the expected extend', function() {
var tileGrid = new _ol_tilegrid_TileGrid_({
var tileGrid = new TileGrid({
resolutions: resolutions,
origin: origin,
tileSize: tileSize
@@ -833,7 +833,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('getTileRangeForExtentAndZ', function() {
it('returns the expected TileRange', function() {
var tileGrid = new _ol_tilegrid_TileGrid_({
var tileGrid = new TileGrid({
resolutions: resolutions,
origin: origin,
tileSize: tileSize
@@ -873,7 +873,7 @@ describe('ol.tilegrid.TileGrid', function() {
var origin = [0, 0];
it('works with one tile size as number', function() {
var tileGrid = new _ol_tilegrid_TileGrid_({
var tileGrid = new TileGrid({
tileSize: 256,
resolutions: resolutions,
origin: origin
@@ -883,7 +883,7 @@ describe('ol.tilegrid.TileGrid', function() {
});
it('works with one tile size as array', function() {
var tileGrid = new _ol_tilegrid_TileGrid_({
var tileGrid = new TileGrid({
tileSize: [512, 256],
resolutions: resolutions,
origin: origin
@@ -893,7 +893,7 @@ describe('ol.tilegrid.TileGrid', function() {
});
it('works with multiple tile sizes as number', function() {
var tileGrid = new _ol_tilegrid_TileGrid_({
var tileGrid = new TileGrid({
tileSizes: [256, 256, 256, 512],
resolutions: resolutions,
origin: origin
@@ -903,7 +903,7 @@ describe('ol.tilegrid.TileGrid', function() {
});
it('works with multiple tile sizes as array', function() {
var tileGrid = new _ol_tilegrid_TileGrid_({
var tileGrid = new TileGrid({
tileSizes: [[512, 256], [512, 256], [512, 256], [640, 320]],
resolutions: resolutions,
origin: origin
@@ -932,7 +932,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('forEachTileCoordParentTileRange', function() {
it('iterates as expected', function() {
var tileGrid = new _ol_tilegrid_TileGrid_({
var tileGrid = new TileGrid({
resolutions: resolutions,
origin: origin,
tileSize: tileSize
@@ -972,7 +972,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('getZForResolution (exact)', function() {
it('returns the expected z value', function() {
var tileGrid = new _ol_tilegrid_TileGrid_({
var tileGrid = new TileGrid({
resolutions: resolutions,
origin: origin,
tileSize: tileSize
@@ -987,7 +987,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('getZForResolution (approximate)', function() {
it('returns the expected z value', function() {
var tileGrid = new _ol_tilegrid_TileGrid_({
var tileGrid = new TileGrid({
resolutions: resolutions,
origin: origin,
tileSize: tileSize
@@ -1011,7 +1011,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('getZForResolution (lower)', function() {
it('returns the expected z value', function() {
var tileGrid = new _ol_tilegrid_TileGrid_({
var tileGrid = new TileGrid({
resolutions: resolutions,
origin: origin,
tileSize: tileSize
@@ -1035,7 +1035,7 @@ describe('ol.tilegrid.TileGrid', function() {
describe('getZForResolution (higher)', function() {
it('returns the expected z value', function() {
var tileGrid = new _ol_tilegrid_TileGrid_({
var tileGrid = new TileGrid({
resolutions: resolutions,
origin: origin,
tileSize: tileSize

View File

@@ -1,7 +1,7 @@
import {expandUrl, createFromTemplate, createFromTemplates, createFromTileUrlFunctions} from '../../../src/ol/tileurlfunction.js';
import _ol_tilecoord_ from '../../../src/ol/tilecoord.js';
import _ol_tilegrid_ from '../../../src/ol/tilegrid.js';
import _ol_tilegrid_TileGrid_ from '../../../src/ol/tilegrid/TileGrid.js';
import TileGrid from '../../../src/ol/tilegrid/TileGrid.js';
describe('ol.TileUrlFunction', function() {
@@ -60,7 +60,7 @@ describe('ol.TileUrlFunction', function() {
expect(tileUrl([3, 2, -3])).to.eql('3/2/5');
});
it('returns correct value for {-y} with custom tile grids', function() {
var customTileGrid = new _ol_tilegrid_TileGrid_({
var customTileGrid = new TileGrid({
extent: [-180, -90, 180, 90],
origin: [-180, -90],
resolutions: [360 / 256, 360 / 512, 360 / 1024, 360 / 2048]

View File

@@ -5,7 +5,7 @@ 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';
import _ol_tilegrid_ from '../../../src/ol/tilegrid.js';
import _ol_tilegrid_TileGrid_ from '../../../src/ol/tilegrid/TileGrid.js';
import TileGrid from '../../../src/ol/tilegrid/TileGrid.js';
describe('ol.VectorImageTile', function() {
@@ -94,7 +94,7 @@ describe('ol.VectorImageTile', function() {
it('only loads tiles within the source tileGrid\'s extent', function() {
var format = new GeoJSON();
var url = 'spec/ol/data/point.json';
var tileGrid = new _ol_tilegrid_TileGrid_({
var tileGrid = new TileGrid({
resolutions: [0.02197265625, 0.010986328125, 0.0054931640625],
origin: [-180, 90],
extent: [-88, 35, -87, 36]