Add function to iterate over tile coordinates in extent and z

This commit is contained in:
Andreas Hocevar
2016-06-22 18:01:29 +02:00
parent 29c8af7559
commit 14cecb7163
2 changed files with 34 additions and 0 deletions

View File

@@ -949,6 +949,22 @@ describe('ol.tilegrid.TileGrid', function() {
});
describe('forEachTileCoordInExtentAndZ', function() {
it('calls the provided function with each tile coordinate', function() {
var tileGrid = ol.tilegrid.createXYZ({extent: [-180, -90, 180, 90]});
var tileCoords = [];
tileGrid.forEachTileCoordInExtentAndZ([15, 47, 16, 48], 8, function(tileCoord) {
tileCoords.push(tileCoord);
});
expect(tileCoords).to.eql([
[8, 138, -31],
[8, 138, -30],
[8, 139, -31],
[8, 139, -30]
]);
});
});
describe('forEachTileCoordParentTileRange', function() {
it('iterates as expected', function() {
var tileGrid = new ol.tilegrid.TileGrid({