Only load source tiles that intersect the source tile grid's extent

This commit is contained in:
Andreas Hocevar
2017-09-01 11:27:53 +02:00
parent 5f2b729c74
commit 040e67d166
2 changed files with 25 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ goog.require('ol.events');
goog.require('ol.format.GeoJSON');
goog.require('ol.proj');
goog.require('ol.tilegrid');
goog.require('ol.tilegrid.TileGrid');
describe('ol.VectorImageTile', function() {
@@ -109,6 +110,26 @@ describe('ol.VectorImageTile', function() {
});
});
it('only loads tiles within the source tileGrid\'s extent', function() {
var format = new ol.format.GeoJSON();
var url = 'spec/ol/data/point.json';
var tileGrid = new ol.tilegrid.TileGrid({
resolutions: [0.02197265625, 0.010986328125, 0.0054931640625],
origin: [-180, 90],
extent: [-88, 35, -87, 36]
});
var sourceTiles = {};
var tile = new ol.VectorImageTile([1, 0, -1], 0, url, format,
ol.VectorImageTile.defaultLoadFunction, [1, 0, -1], function(zxy) {
return url;
}, tileGrid,
ol.tilegrid.createXYZ({extent: [-180, -90, 180, 90], tileSize: 512}),
sourceTiles, 1, ol.proj.get('EPSG:4326'), ol.VectorTile, function() {});
tile.load();
expect(tile.tileKeys.length).to.be(1);
expect(tile.getTile(tile.tileKeys[0]).tileCoord).to.eql([0, 16, -10]);
});
it('#dispose() while loading', function() {
var format = new ol.format.GeoJSON();
var url = 'spec/ol/data/point.json';