Named exports from ol/tilegrid
This commit is contained in:
@@ -4,7 +4,7 @@ import ImageLayer from '../../../../src/ol/layer/Image.js';
|
||||
import {assign} from '../../../../src/ol/obj.js';
|
||||
import {get as getProjection, transform, transformExtent} from '../../../../src/ol/proj.js';
|
||||
import Static from '../../../../src/ol/source/ImageStatic.js';
|
||||
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
||||
import {createXYZ} from '../../../../src/ol/tilegrid.js';
|
||||
|
||||
|
||||
describe('ol.rendering.layer.Image', function() {
|
||||
@@ -67,7 +67,7 @@ describe('ol.rendering.layer.Image', function() {
|
||||
beforeEach(function() {
|
||||
source = new Static({
|
||||
url: 'rendering/ol/data/tiles/osm/5/5/12.png',
|
||||
imageExtent: _ol_tilegrid_.createXYZ().getTileCoordExtent(
|
||||
imageExtent: createXYZ().getTileCoordExtent(
|
||||
[5, 5, -12 - 1]),
|
||||
projection: getProjection('EPSG:3857')
|
||||
});
|
||||
|
||||
@@ -10,7 +10,7 @@ import XYZ from '../../../../src/ol/source/XYZ.js';
|
||||
import CircleStyle from '../../../../src/ol/style/Circle.js';
|
||||
import Fill from '../../../../src/ol/style/Fill.js';
|
||||
import Stroke from '../../../../src/ol/style/Stroke.js';
|
||||
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
||||
import {createXYZ} from '../../../../src/ol/tilegrid.js';
|
||||
|
||||
|
||||
describe('ol.rendering.layer.Tile', function() {
|
||||
@@ -220,7 +220,7 @@ describe('ol.rendering.layer.Tile', function() {
|
||||
function createSource(tileSize) {
|
||||
return new TileImage({
|
||||
url: 'rendering/ol/data/tiles/' + tileSize + '/{z}/{x}/{y}.png',
|
||||
tileGrid: _ol_tilegrid_.createXYZ({
|
||||
tileGrid: createXYZ({
|
||||
tileSize: tileSize.split('x')
|
||||
}),
|
||||
transition: 0
|
||||
|
||||
@@ -12,7 +12,7 @@ import CircleStyle from '../../../../src/ol/style/Circle.js';
|
||||
import Fill from '../../../../src/ol/style/Fill.js';
|
||||
import Style from '../../../../src/ol/style/Style.js';
|
||||
import Text from '../../../../src/ol/style/Text.js';
|
||||
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
||||
import {createXYZ} from '../../../../src/ol/tilegrid.js';
|
||||
|
||||
|
||||
describe('ol.rendering.layer.VectorTile', function() {
|
||||
@@ -71,7 +71,7 @@ describe('ol.rendering.layer.VectorTile', function() {
|
||||
beforeEach(function() {
|
||||
source = new VectorTileSource({
|
||||
format: new MVT(),
|
||||
tileGrid: _ol_tilegrid_.createXYZ(),
|
||||
tileGrid: createXYZ(),
|
||||
url: 'rendering/ol/data/tiles/mvt/{z}-{x}-{y}.vector.pbf',
|
||||
transition: 0
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ import {get as getProjection} from '../../../../src/ol/proj.js';
|
||||
import {HALF_SIZE} from '../../../../src/ol/proj/epsg3857.js';
|
||||
import ReprojImage from '../../../../src/ol/reproj/Image.js';
|
||||
import Static from '../../../../src/ol/source/ImageStatic.js';
|
||||
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
||||
import {createXYZ, createForProjection} from '../../../../src/ol/tilegrid.js';
|
||||
|
||||
|
||||
describe('ol.rendering.reproj.Image', function() {
|
||||
@@ -37,21 +37,21 @@ describe('ol.rendering.reproj.Image', function() {
|
||||
beforeEach(function() {
|
||||
source = new Static({
|
||||
url: 'rendering/ol/data/tiles/osm/5/5/12.png',
|
||||
imageExtent: _ol_tilegrid_.createXYZ().getTileCoordExtent([5, 5, -13]),
|
||||
imageExtent: createXYZ().getTileCoordExtent([5, 5, -13]),
|
||||
projection: getProjection('EPSG:3857')
|
||||
});
|
||||
});
|
||||
|
||||
it('works for identity reprojection', function(done) {
|
||||
testSingleImage(source, 'EPSG:3857',
|
||||
_ol_tilegrid_.createXYZ().getTileCoordExtent([5, 5, -13]),
|
||||
createXYZ().getTileCoordExtent([5, 5, -13]),
|
||||
2 * HALF_SIZE / (256 * (1 << 5)), 1,
|
||||
'rendering/ol/data/tiles/osm/5/5/12.png', done);
|
||||
});
|
||||
|
||||
it('to EPSG:4326', function(done) {
|
||||
testSingleImage(source, 'EPSG:4326',
|
||||
_ol_tilegrid_.createForProjection('EPSG:4326').
|
||||
createForProjection('EPSG:4326').
|
||||
getTileCoordExtent([6, 10, -10]),
|
||||
360 / (256 * (1 << 4)), 1,
|
||||
'rendering/ol/reproj/expected/image-3857-to-4326.png', done);
|
||||
|
||||
@@ -3,7 +3,7 @@ import {listen} from '../../../../src/ol/events.js';
|
||||
import {get as getProjection} from '../../../../src/ol/proj.js';
|
||||
import ReprojTile from '../../../../src/ol/reproj/Tile.js';
|
||||
import XYZ from '../../../../src/ol/source/XYZ.js';
|
||||
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
||||
import {createForProjection} from '../../../../src/ol/tilegrid.js';
|
||||
import {register} from '../../../../src/ol/proj/proj4.js';
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ describe('ol.rendering.reproj.Tile', function() {
|
||||
});
|
||||
|
||||
it('to EPSG:4326', function(done) {
|
||||
const tileGrid = _ol_tilegrid_.createForProjection('EPSG:4326', 7, [64, 64]);
|
||||
const tileGrid = createForProjection('EPSG:4326', 7, [64, 64]);
|
||||
testSingleTile(source, 'EPSG:4326', tileGrid, 7, 21, -20, 1,
|
||||
'rendering/ol/reproj/expected/osm4326.png', 1, done);
|
||||
});
|
||||
@@ -63,7 +63,7 @@ describe('ol.rendering.reproj.Tile', function() {
|
||||
const proj5070 = getProjection('EPSG:5070');
|
||||
proj5070.setExtent([-6e6, 0, 4e6, 6e6]);
|
||||
|
||||
const tileGrid = _ol_tilegrid_.createForProjection('EPSG:5070', 5, [64, 64]);
|
||||
const tileGrid = createForProjection('EPSG:5070', 5, [64, 64]);
|
||||
testSingleTile(source, 'EPSG:5070', tileGrid, 5, 13, -15, 1,
|
||||
'rendering/ol/reproj/expected/osm5070.png', 1, done);
|
||||
});
|
||||
@@ -75,7 +75,7 @@ describe('ol.rendering.reproj.Tile', function() {
|
||||
const proj54009 = getProjection('ESRI:54009');
|
||||
proj54009.setExtent([-18e6, -9e6, 18e6, 9e6]);
|
||||
|
||||
const tileGrid = _ol_tilegrid_.createForProjection('ESRI:54009', 7, [64, 64]);
|
||||
const tileGrid = createForProjection('ESRI:54009', 7, [64, 64]);
|
||||
testSingleTile(source, 'ESRI:54009', tileGrid, 7, 27, -16, 1,
|
||||
'rendering/ol/reproj/expected/osm54009.png', 1, done);
|
||||
});
|
||||
@@ -90,7 +90,7 @@ describe('ol.rendering.reproj.Tile', function() {
|
||||
});
|
||||
|
||||
it('to EPSG:4326', function(done) {
|
||||
const tileGrid = _ol_tilegrid_.createForProjection('EPSG:4326', 7, [64, 64]);
|
||||
const tileGrid = createForProjection('EPSG:4326', 7, [64, 64]);
|
||||
testSingleTile(source, 'EPSG:4326', tileGrid, 7, 23, -21, 1,
|
||||
'rendering/ol/reproj/expected/stitch-osm4326.png', 2, done);
|
||||
});
|
||||
@@ -103,7 +103,7 @@ describe('ol.rendering.reproj.Tile', function() {
|
||||
const proj3740 = getProjection('EPSG:3740');
|
||||
proj3740.setExtent([318499.05, 2700792.39, 4359164.89, 7149336.98]);
|
||||
|
||||
const tileGrid = _ol_tilegrid_.createForProjection('EPSG:3740', 4, [64, 64]);
|
||||
const tileGrid = createForProjection('EPSG:3740', 4, [64, 64]);
|
||||
testSingleTile(source, 'EPSG:3740', tileGrid, 4, 4, -13, 1,
|
||||
'rendering/ol/reproj/expected/stitch-osm3740.png', 4, done);
|
||||
});
|
||||
@@ -124,7 +124,7 @@ describe('ol.rendering.reproj.Tile', function() {
|
||||
});
|
||||
|
||||
it('to EPSG:3857', function(done) {
|
||||
const tileGrid = _ol_tilegrid_.createForProjection('EPSG:3857', 0, [64, 64]);
|
||||
const tileGrid = createForProjection('EPSG:3857', 0, [64, 64]);
|
||||
testSingleTile(source, 'EPSG:3857', tileGrid, 0, 0, -1, 1,
|
||||
'rendering/ol/reproj/expected/4326-to-3857.png', 1, done);
|
||||
});
|
||||
@@ -145,7 +145,7 @@ describe('ol.rendering.reproj.Tile', function() {
|
||||
});
|
||||
|
||||
it('to 64x128 EPSG:4326', function(done) {
|
||||
const tileGrid = _ol_tilegrid_.createForProjection('EPSG:4326', 7, [64, 128]);
|
||||
const tileGrid = createForProjection('EPSG:4326', 7, [64, 128]);
|
||||
testSingleTile(source, 'EPSG:4326', tileGrid, 7, 27, -10, 1,
|
||||
'rendering/ol/reproj/expected/512x256-to-64x128.png', 1, done);
|
||||
});
|
||||
@@ -166,7 +166,7 @@ describe('ol.rendering.reproj.Tile', function() {
|
||||
const proj_ = getProjection('merc_180');
|
||||
proj_.setExtent([-20026376.39, -20048966.10, 20026376.39, 20048966.10]);
|
||||
|
||||
const tileGrid = _ol_tilegrid_.createForProjection('merc_180', 0, [64, 64]);
|
||||
const tileGrid = createForProjection('merc_180', 0, [64, 64]);
|
||||
testSingleTile(source, 'merc_180', tileGrid, 0, 0, -1, 1,
|
||||
'rendering/ol/reproj/expected/dateline-merc-180.png', 2, done);
|
||||
});
|
||||
@@ -178,7 +178,7 @@ describe('ol.rendering.reproj.Tile', function() {
|
||||
const proj3413 = getProjection('EPSG:3413');
|
||||
proj3413.setExtent([-4194304, -4194304, 4194304, 4194304]);
|
||||
|
||||
const tileGrid = _ol_tilegrid_.createForProjection('EPSG:3413', 0, [64, 64]);
|
||||
const tileGrid = createForProjection('EPSG:3413', 0, [64, 64]);
|
||||
testSingleTile(source, 'EPSG:3413', tileGrid, 0, 0, -1, 1,
|
||||
'rendering/ol/reproj/expected/dateline-pole.png', 2, done);
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@ import View from '../../../../src/ol/View.js';
|
||||
import Attribution from '../../../../src/ol/control/Attribution.js';
|
||||
import TileLayer from '../../../../src/ol/layer/Tile.js';
|
||||
import TileSource from '../../../../src/ol/source/Tile.js';
|
||||
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
||||
import {createXYZ} from '../../../../src/ol/tilegrid.js';
|
||||
|
||||
describe('ol.control.Attribution', function() {
|
||||
|
||||
@@ -23,21 +23,21 @@ describe('ol.control.Attribution', function() {
|
||||
new TileLayer({
|
||||
source: new TileSource({
|
||||
projection: 'EPSG:3857',
|
||||
tileGrid: _ol_tilegrid_.createXYZ(),
|
||||
tileGrid: createXYZ(),
|
||||
attributions: 'foo'
|
||||
})
|
||||
}),
|
||||
new TileLayer({
|
||||
source: new TileSource({
|
||||
projection: 'EPSG:3857',
|
||||
tileGrid: _ol_tilegrid_.createXYZ(),
|
||||
tileGrid: createXYZ(),
|
||||
attributions: 'bar'
|
||||
})
|
||||
}),
|
||||
new TileLayer({
|
||||
source: new TileSource({
|
||||
projection: 'EPSG:3857',
|
||||
tileGrid: _ol_tilegrid_.createXYZ(),
|
||||
tileGrid: createXYZ(),
|
||||
attributions: 'foo'
|
||||
})
|
||||
})
|
||||
|
||||
@@ -18,7 +18,7 @@ import CanvasVectorTileLayerRenderer from '../../../../../src/ol/renderer/canvas
|
||||
import VectorTileSource from '../../../../../src/ol/source/VectorTile.js';
|
||||
import Style from '../../../../../src/ol/style/Style.js';
|
||||
import Text from '../../../../../src/ol/style/Text.js';
|
||||
import _ol_tilegrid_ from '../../../../../src/ol/tilegrid.js';
|
||||
import {createXYZ} from '../../../../../src/ol/tilegrid.js';
|
||||
|
||||
|
||||
describe('ol.renderer.canvas.VectorTileLayer', function() {
|
||||
@@ -70,7 +70,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
|
||||
source = new VectorTileSource({
|
||||
format: new MVT(),
|
||||
tileClass: TileClass,
|
||||
tileGrid: _ol_tilegrid_.createXYZ()
|
||||
tileGrid: createXYZ()
|
||||
});
|
||||
source.getTile = function() {
|
||||
const tile = VectorTileSource.prototype.getTile.apply(source, arguments);
|
||||
@@ -241,7 +241,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
|
||||
it('re-renders when layer changed', function() {
|
||||
const layer = new VectorTileLayer({
|
||||
source: new VectorTileSource({
|
||||
tileGrid: _ol_tilegrid_.createXYZ(),
|
||||
tileGrid: createXYZ(),
|
||||
transition: 0
|
||||
})
|
||||
});
|
||||
@@ -311,7 +311,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
|
||||
layer = new VectorTileLayer({
|
||||
source: new VectorTileSource({
|
||||
tileClass: TileClass,
|
||||
tileGrid: _ol_tilegrid_.createXYZ()
|
||||
tileGrid: createXYZ()
|
||||
})
|
||||
});
|
||||
renderer = new CanvasVectorTileLayerRenderer(layer);
|
||||
|
||||
@@ -3,7 +3,7 @@ import {listen} from '../../../../src/ol/events.js';
|
||||
import {addCommon, clearAllProjections, get as getProjection} from '../../../../src/ol/proj.js';
|
||||
import {register} from '../../../../src/ol/proj/proj4.js';
|
||||
import ReprojTile from '../../../../src/ol/reproj/Tile.js';
|
||||
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
||||
import {createForProjection} from '../../../../src/ol/tilegrid.js';
|
||||
|
||||
|
||||
describe('ol.reproj.Tile', function() {
|
||||
@@ -28,8 +28,8 @@ describe('ol.reproj.Tile', function() {
|
||||
const proj4326 = getProjection('EPSG:4326');
|
||||
const proj3857 = getProjection('EPSG:3857');
|
||||
return new ReprojTile(
|
||||
proj3857, _ol_tilegrid_.createForProjection(proj3857), proj4326,
|
||||
_ol_tilegrid_.createForProjection(proj4326, 3, opt_tileSize),
|
||||
proj3857, createForProjection(proj3857), proj4326,
|
||||
createForProjection(proj4326, 3, opt_tileSize),
|
||||
[3, 2, -2], null, pixelRatio, 0, function(z, x, y, pixelRatio) {
|
||||
return new ImageTile([z, x, y], 0, // IDLE
|
||||
'data:image/gif;base64,' +
|
||||
@@ -55,8 +55,8 @@ describe('ol.reproj.Tile', function() {
|
||||
const proj4326 = getProjection('EPSG:4326');
|
||||
const proj3857 = getProjection('EPSG:3857');
|
||||
const tile = new ReprojTile(
|
||||
proj3857, _ol_tilegrid_.createForProjection(proj3857),
|
||||
proj4326, _ol_tilegrid_.createForProjection(proj4326),
|
||||
proj3857, createForProjection(proj3857),
|
||||
proj4326, createForProjection(proj4326),
|
||||
[0, -1, 0], null, 1, 0, function() {
|
||||
expect().fail('No tiles should be required');
|
||||
});
|
||||
@@ -67,8 +67,8 @@ describe('ol.reproj.Tile', function() {
|
||||
const proj4326 = getProjection('EPSG:4326');
|
||||
const proj27700 = getProjection('EPSG:27700');
|
||||
const tile = new ReprojTile(
|
||||
proj27700, _ol_tilegrid_.createForProjection(proj27700),
|
||||
proj4326, _ol_tilegrid_.createForProjection(proj4326),
|
||||
proj27700, createForProjection(proj27700),
|
||||
proj4326, createForProjection(proj4326),
|
||||
[3, 2, -2], null, 1, 0, function() {
|
||||
expect().fail('No tiles should be required');
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@ import Projection from '../../../../src/ol/proj/Projection.js';
|
||||
import ReprojTile from '../../../../src/ol/reproj/Tile.js';
|
||||
import TileImage from '../../../../src/ol/source/TileImage.js';
|
||||
import _ol_tilecoord_ from '../../../../src/ol/tilecoord.js';
|
||||
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
||||
import {createXYZ, createForProjection} from '../../../../src/ol/tilegrid.js';
|
||||
|
||||
|
||||
describe('ol.source.TileImage', function() {
|
||||
@@ -19,7 +19,7 @@ describe('ol.source.TileImage', function() {
|
||||
cacheSize: opt_cacheSize,
|
||||
projection: proj,
|
||||
tileGrid: opt_tileGrid ||
|
||||
_ol_tilegrid_.createForProjection(proj, undefined, [2, 2]),
|
||||
createForProjection(proj, undefined, [2, 2]),
|
||||
tileUrlFunction: createFromTemplate('data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=')
|
||||
});
|
||||
}
|
||||
@@ -36,7 +36,7 @@ describe('ol.source.TileImage', function() {
|
||||
describe('#setTileGridForProjection', function() {
|
||||
it('uses the tilegrid for given projection', function() {
|
||||
const source = createSource();
|
||||
const tileGrid = _ol_tilegrid_.createForProjection('EPSG:4326', 3, [10, 20]);
|
||||
const tileGrid = createForProjection('EPSG:4326', 3, [10, 20]);
|
||||
source.setTileGridForProjection('EPSG:4326', tileGrid);
|
||||
const retrieved = source.getTileGridForProjection(getProjection('EPSG:4326'));
|
||||
expect(retrieved).to.be(tileGrid);
|
||||
@@ -141,7 +141,7 @@ describe('ol.source.TileImage', function() {
|
||||
});
|
||||
|
||||
it('can handle source projection without extent and units', function(done) {
|
||||
const source = createSource('4326_noextentnounits', _ol_tilegrid_.createXYZ({
|
||||
const source = createSource('4326_noextentnounits', createXYZ({
|
||||
extent: [-180, -90, 180, 90],
|
||||
tileSize: [2, 2]
|
||||
}));
|
||||
@@ -160,7 +160,7 @@ describe('ol.source.TileImage', function() {
|
||||
const proj = getProjection('4326_noextentnounits');
|
||||
const source = createSource();
|
||||
source.setTileGridForProjection(proj,
|
||||
_ol_tilegrid_.createXYZ({
|
||||
createXYZ({
|
||||
extent: WORLD_EXTENT,
|
||||
tileSize: [2, 2]
|
||||
}));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import ImageTile from '../../../../src/ol/ImageTile.js';
|
||||
import {get as getProjection} from '../../../../src/ol/proj.js';
|
||||
import TileWMS from '../../../../src/ol/source/TileWMS.js';
|
||||
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
||||
import {createXYZ} from '../../../../src/ol/tilegrid.js';
|
||||
import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js';
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ describe('ol.source.TileWMS', function() {
|
||||
it('can be constructed without url or urls params', function() {
|
||||
const source = new TileWMS({
|
||||
projection: 'EPSG:3857',
|
||||
tileGrid: _ol_tilegrid_.createXYZ({maxZoom: 6})
|
||||
tileGrid: createXYZ({maxZoom: 6})
|
||||
});
|
||||
expect(source).to.be.an(TileWMS);
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {get as getProjection} from '../../../../src/ol/proj.js';
|
||||
import UrlTile from '../../../../src/ol/source/UrlTile.js';
|
||||
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
||||
import {createXYZ} from '../../../../src/ol/tilegrid.js';
|
||||
|
||||
|
||||
describe('ol.source.UrlTile', function() {
|
||||
@@ -71,7 +71,7 @@ describe('ol.source.UrlTile', function() {
|
||||
beforeEach(function() {
|
||||
tileSource = new UrlTile({
|
||||
projection: 'EPSG:3857',
|
||||
tileGrid: _ol_tilegrid_.createXYZ({maxZoom: 6}),
|
||||
tileGrid: createXYZ({maxZoom: 6}),
|
||||
url: '{z}/{x}/{y}',
|
||||
wrapX: true
|
||||
});
|
||||
@@ -167,7 +167,7 @@ describe('ol.source.UrlTile', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
sourceOptions = {
|
||||
tileGrid: _ol_tilegrid_.createXYZ({
|
||||
tileGrid: createXYZ({
|
||||
extent: getProjection('EPSG:4326').getExtent()
|
||||
})
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ import MVT from '../../../../src/ol/format/MVT.js';
|
||||
import VectorTileLayer from '../../../../src/ol/layer/VectorTile.js';
|
||||
import {get as getProjection} from '../../../../src/ol/proj.js';
|
||||
import VectorTileSource from '../../../../src/ol/source/VectorTile.js';
|
||||
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
||||
import {createXYZ} from '../../../../src/ol/tilegrid.js';
|
||||
import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js';
|
||||
|
||||
describe('ol.source.VectorTile', function() {
|
||||
@@ -29,7 +29,7 @@ describe('ol.source.VectorTile', function() {
|
||||
});
|
||||
|
||||
it('creates a 512 XYZ tilegrid by default', function() {
|
||||
const tileGrid = _ol_tilegrid_.createXYZ({tileSize: 512});
|
||||
const tileGrid = createXYZ({tileSize: 512});
|
||||
expect(source.tileGrid.tileSize_).to.equal(tileGrid.tileSize_);
|
||||
expect(source.tileGrid.extent_).to.equal(tileGrid.extent_);
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@ import TileSource from '../../../../src/ol/source/Tile.js';
|
||||
import TileImage from '../../../../src/ol/source/TileImage.js';
|
||||
import UrlTile from '../../../../src/ol/source/UrlTile.js';
|
||||
import XYZ from '../../../../src/ol/source/XYZ.js';
|
||||
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
||||
import {createXYZ} from '../../../../src/ol/tilegrid.js';
|
||||
|
||||
|
||||
describe('ol.source.XYZ', function() {
|
||||
@@ -18,7 +18,7 @@ describe('ol.source.XYZ', function() {
|
||||
});
|
||||
|
||||
it('can be constructed with a custom tile grid', function() {
|
||||
const tileGrid = _ol_tilegrid_.createXYZ();
|
||||
const tileGrid = createXYZ();
|
||||
const tileSource = new XYZ({
|
||||
tileGrid: tileGrid
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@ import * as _ol_extent_ from '../../../../src/ol/extent.js';
|
||||
import {get as getProjection, METERS_PER_UNIT} from '../../../../src/ol/proj.js';
|
||||
import {HALF_SIZE} from '../../../../src/ol/proj/epsg3857.js';
|
||||
import Projection from '../../../../src/ol/proj/Projection.js';
|
||||
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
||||
import {createForExtent, createForProjection, createXYZ, getForProjection as getTileGridForProjection} from '../../../../src/ol/tilegrid.js';
|
||||
import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js';
|
||||
|
||||
|
||||
@@ -276,7 +276,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
describe('createForExtent', function() {
|
||||
it('allows creation of tile grid from extent', function() {
|
||||
const extent = _ol_extent_.createOrUpdate(-100, -100, 100, 100);
|
||||
const grid = _ol_tilegrid_.createForExtent(extent);
|
||||
const grid = createForExtent(extent);
|
||||
expect(grid).to.be.a(TileGrid);
|
||||
|
||||
const resolutions = grid.getResolutions();
|
||||
@@ -309,7 +309,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
|
||||
it('allows easier creation of a tile grid', function() {
|
||||
const projection = getProjection('EPSG:3857');
|
||||
const grid = _ol_tilegrid_.createForProjection(projection);
|
||||
const grid = createForProjection(projection);
|
||||
expect(grid).to.be.a(TileGrid);
|
||||
|
||||
const resolutions = grid.getResolutions();
|
||||
@@ -318,7 +318,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
|
||||
it('accepts a number of zoom levels', function() {
|
||||
const projection = getProjection('EPSG:3857');
|
||||
const grid = _ol_tilegrid_.createForProjection(projection, 18);
|
||||
const grid = createForProjection(projection, 18);
|
||||
expect(grid).to.be.a(TileGrid);
|
||||
|
||||
const resolutions = grid.getResolutions();
|
||||
@@ -327,7 +327,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
|
||||
it('accepts a big number of zoom levels', function() {
|
||||
const projection = getProjection('EPSG:3857');
|
||||
const grid = _ol_tilegrid_.createForProjection(projection, 23);
|
||||
const grid = createForProjection(projection, 23);
|
||||
expect(grid).to.be.a(TileGrid);
|
||||
|
||||
const resolutions = grid.getResolutions();
|
||||
@@ -337,7 +337,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
it('works for projections unknown to the client', function() {
|
||||
const projection = new Projection(
|
||||
{code: 'EPSG:31287', units: 'm'});
|
||||
const grid = _ol_tilegrid_.createForProjection(projection);
|
||||
const grid = createForProjection(projection);
|
||||
const resolutions = grid.getResolutions();
|
||||
expect(resolutions[5]).to.be(
|
||||
360 * METERS_PER_UNIT['degrees'] /
|
||||
@@ -346,7 +346,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
|
||||
it('assumes origin is top-left', function() {
|
||||
const projection = getProjection('EPSG:3857');
|
||||
const grid = _ol_tilegrid_.createForProjection(projection);
|
||||
const grid = createForProjection(projection);
|
||||
const origin = grid.getOrigin();
|
||||
const half = HALF_SIZE;
|
||||
expect(origin).to.eql([-half, half]);
|
||||
@@ -354,7 +354,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
|
||||
it('accepts bottom-left as corner', function() {
|
||||
const projection = getProjection('EPSG:3857');
|
||||
const grid = _ol_tilegrid_.createForProjection(
|
||||
const grid = createForProjection(
|
||||
projection, undefined, undefined, 'bottom-left');
|
||||
const origin = grid.getOrigin();
|
||||
const half = HALF_SIZE;
|
||||
@@ -363,7 +363,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
|
||||
it('accepts bottom-right as corner', function() {
|
||||
const projection = getProjection('EPSG:3857');
|
||||
const grid = _ol_tilegrid_.createForProjection(
|
||||
const grid = createForProjection(
|
||||
projection, undefined, undefined, 'bottom-right');
|
||||
const origin = grid.getOrigin();
|
||||
const half = HALF_SIZE;
|
||||
@@ -372,7 +372,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
|
||||
it('accepts top-left as corner', function() {
|
||||
const projection = getProjection('EPSG:3857');
|
||||
const grid = _ol_tilegrid_.createForProjection(
|
||||
const grid = createForProjection(
|
||||
projection, undefined, undefined, 'top-left');
|
||||
const origin = grid.getOrigin();
|
||||
const half = HALF_SIZE;
|
||||
@@ -381,7 +381,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
|
||||
it('accepts top-right as corner', function() {
|
||||
const projection = getProjection('EPSG:3857');
|
||||
const grid = _ol_tilegrid_.createForProjection(
|
||||
const grid = createForProjection(
|
||||
projection, undefined, undefined, 'top-right');
|
||||
const origin = grid.getOrigin();
|
||||
const half = HALF_SIZE;
|
||||
@@ -393,7 +393,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
describe('createXYZ()', function() {
|
||||
|
||||
it('uses defaults', function() {
|
||||
const tileGrid = _ol_tilegrid_.createXYZ();
|
||||
const tileGrid = createXYZ();
|
||||
expect(tileGrid.getExtent()).to.eql(
|
||||
getProjection('EPSG:3857').getExtent());
|
||||
expect(tileGrid.getMinZoom()).to.equal(0);
|
||||
@@ -402,7 +402,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
});
|
||||
|
||||
it('respects configuration options', function() {
|
||||
const tileGrid = _ol_tilegrid_.createXYZ({
|
||||
const tileGrid = createXYZ({
|
||||
extent: [10, 20, 30, 40],
|
||||
minZoom: 1,
|
||||
maxZoom: 2,
|
||||
@@ -420,7 +420,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
|
||||
it('gets the default tile grid for a projection', function() {
|
||||
const projection = getProjection('EPSG:3857');
|
||||
const grid = _ol_tilegrid_.getForProjection(projection);
|
||||
const grid = getTileGridForProjection(projection);
|
||||
expect(grid).to.be.a(TileGrid);
|
||||
|
||||
const resolutions = grid.getResolutions();
|
||||
@@ -430,8 +430,8 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
|
||||
it('stores the default tile grid on a projection', function() {
|
||||
const projection = getProjection('EPSG:3857');
|
||||
const grid = _ol_tilegrid_.getForProjection(projection);
|
||||
const gridAgain = _ol_tilegrid_.getForProjection(projection);
|
||||
const grid = getTileGridForProjection(projection);
|
||||
const gridAgain = getTileGridForProjection(projection);
|
||||
|
||||
expect(grid).to.be(gridAgain);
|
||||
});
|
||||
@@ -442,7 +442,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
|
||||
let tileGrid;
|
||||
beforeEach(function() {
|
||||
tileGrid = _ol_tilegrid_.createForExtent(
|
||||
tileGrid = createForExtent(
|
||||
getProjection('EPSG:3857').getExtent(), 22);
|
||||
});
|
||||
|
||||
@@ -492,7 +492,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
|
||||
let tileGrid;
|
||||
beforeEach(function() {
|
||||
tileGrid = _ol_tilegrid_.createForExtent(
|
||||
tileGrid = createForExtent(
|
||||
getProjection('EPSG:3857').getExtent(), 22);
|
||||
});
|
||||
|
||||
@@ -552,7 +552,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
|
||||
let tileGrid;
|
||||
beforeEach(function() {
|
||||
tileGrid = _ol_tilegrid_.createForExtent(
|
||||
tileGrid = createForExtent(
|
||||
getProjection('EPSG:3857').getExtent(), 22);
|
||||
});
|
||||
|
||||
@@ -917,7 +917,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
|
||||
describe('forEachTileCoord', function() {
|
||||
it('calls the provided function with each tile coordinate', function() {
|
||||
const tileGrid = _ol_tilegrid_.createXYZ({extent: [-180, -90, 180, 90]});
|
||||
const tileGrid = createXYZ({extent: [-180, -90, 180, 90]});
|
||||
const tileCoords = [];
|
||||
tileGrid.forEachTileCoord([15, 47, 16, 48], 8, function(tileCoord) {
|
||||
tileCoords.push(tileCoord);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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 {createXYZ} from '../../../src/ol/tilegrid.js';
|
||||
import TileGrid from '../../../src/ol/tilegrid/TileGrid.js';
|
||||
|
||||
describe('ol.TileUrlFunction', function() {
|
||||
@@ -49,7 +49,7 @@ describe('ol.TileUrlFunction', function() {
|
||||
});
|
||||
|
||||
describe('createFromTemplate', function() {
|
||||
const tileGrid = _ol_tilegrid_.createXYZ();
|
||||
const tileGrid = createXYZ();
|
||||
it('creates expected URL', function() {
|
||||
const tileUrl = createFromTemplate('{z}/{x}/{y}', tileGrid);
|
||||
expect(tileUrl([3, 2, -2])).to.eql('3/2/1');
|
||||
@@ -75,7 +75,7 @@ describe('ol.TileUrlFunction', function() {
|
||||
});
|
||||
|
||||
describe('createFromTemplates', function() {
|
||||
const tileGrid = _ol_tilegrid_.createXYZ();
|
||||
const tileGrid = createXYZ();
|
||||
it('creates expected URL', function() {
|
||||
const templates = [
|
||||
'http://tile-1/{z}/{x}/{y}',
|
||||
@@ -108,7 +108,7 @@ describe('ol.TileUrlFunction', function() {
|
||||
});
|
||||
|
||||
describe('createFromTileUrlFunctions', function() {
|
||||
const tileGrid = _ol_tilegrid_.createXYZ();
|
||||
const tileGrid = createXYZ();
|
||||
it('creates expected URL', function() {
|
||||
const tileUrl = createFromTileUrlFunctions([
|
||||
createFromTemplate('a', tileGrid),
|
||||
|
||||
@@ -4,7 +4,7 @@ import VectorTile from '../../../src/ol/VectorTile.js';
|
||||
import {listen, listenOnce} 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 {createXYZ} from '../../../src/ol/tilegrid.js';
|
||||
import TileGrid from '../../../src/ol/tilegrid/TileGrid.js';
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ describe('ol.VectorImageTile', function() {
|
||||
const tile = new VectorImageTile([0, 0, -1], 0, url, format,
|
||||
defaultLoadFunction, [0, 0, -1], function() {
|
||||
return url;
|
||||
}, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ(), {},
|
||||
}, createXYZ(), createXYZ(), {},
|
||||
1, getProjection('EPSG:3857'), VectorTile, function() {});
|
||||
|
||||
tile.load();
|
||||
@@ -40,7 +40,7 @@ describe('ol.VectorImageTile', function() {
|
||||
defaultLoadFunction(tile, url);
|
||||
}, [0, 0, -1], function() {
|
||||
return url;
|
||||
}, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ(), {},
|
||||
}, createXYZ(), createXYZ(), {},
|
||||
1, getProjection('EPSG:3857'), VectorTile, function() {});
|
||||
|
||||
tile.load();
|
||||
@@ -64,7 +64,7 @@ describe('ol.VectorImageTile', function() {
|
||||
const tile = new VectorImageTile([0, 0, -1], 0, url, format,
|
||||
defaultLoadFunction, [0, 0, -1], function() {
|
||||
return url;
|
||||
}, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ(), {},
|
||||
}, createXYZ(), createXYZ(), {},
|
||||
1, getProjection('EPSG:3857'), VectorTile, function() {});
|
||||
|
||||
tile.load();
|
||||
@@ -80,7 +80,7 @@ describe('ol.VectorImageTile', function() {
|
||||
const url = '';
|
||||
const tile = new VectorImageTile([0, 0, -1], 0, url, format,
|
||||
defaultLoadFunction, [0, 0, -1], function() {},
|
||||
_ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ(), {},
|
||||
createXYZ(), createXYZ(), {},
|
||||
1, getProjection('EPSG:3857'), VectorTile, function() {});
|
||||
|
||||
tile.load();
|
||||
@@ -104,7 +104,7 @@ describe('ol.VectorImageTile', function() {
|
||||
defaultLoadFunction, [1, 0, -1], function(zxy) {
|
||||
return url;
|
||||
}, tileGrid,
|
||||
_ol_tilegrid_.createXYZ({extent: [-180, -90, 180, 90], tileSize: 512}),
|
||||
createXYZ({extent: [-180, -90, 180, 90], tileSize: 512}),
|
||||
sourceTiles, 1, getProjection('EPSG:4326'), VectorTile, function() {});
|
||||
tile.load();
|
||||
expect(tile.tileKeys.length).to.be(1);
|
||||
@@ -117,7 +117,7 @@ describe('ol.VectorImageTile', function() {
|
||||
const tile = new VectorImageTile([0, 0, 0] /* one world away */, 0, url, format,
|
||||
defaultLoadFunction, [0, 0, -1], function() {
|
||||
return url;
|
||||
}, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ({tileSize: 512}), {},
|
||||
}, createXYZ(), createXYZ({tileSize: 512}), {},
|
||||
1, getProjection('EPSG:3857'), VectorTile, function() {});
|
||||
|
||||
tile.load();
|
||||
@@ -137,7 +137,7 @@ describe('ol.VectorImageTile', function() {
|
||||
const tile = new VectorImageTile([0, 0, -1], 0, url, format,
|
||||
defaultLoadFunction, [0, 0, -1], function() {
|
||||
return url;
|
||||
}, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ({tileSize: 512}), {},
|
||||
}, createXYZ(), createXYZ({tileSize: 512}), {},
|
||||
1, getProjection('EPSG:3857'), VectorTile, function() {});
|
||||
|
||||
tile.load();
|
||||
|
||||
Reference in New Issue
Block a user