[ol.layer.TileLayer] add a getTileForXYZ func

This commit is contained in:
Éric Lemoine
2012-06-22 15:16:46 +02:00
parent 976239816e
commit 71a804c5e0
3 changed files with 51 additions and 10 deletions

View File

@@ -329,4 +329,26 @@ describe('ol.layer.TileLayer', function() {
});
});
describe('get a tile', function() {
var layer;
beforeEach(function() {
layer = new ol.layer.TileLayer();
layer.setUrl('/{z}/{x}/{y}');
layer.setResolutions([1, 0.5, 0.25]);
layer.setTileOrigin(-128, 128);
});
it('returns the expected tile', function() {
var tile = layer.getTileForXYZ(1, 2, 2);
expect(tile.getUrl()).toEqual('/2/1/2');
//var bounds = tile.getBounds();
//expect(bounds.getMinX()).toEqual(-64);
//expect(bounds.getMinY()).toEqual(0);
//expect(bounds.getMaxX()).toEqual(0);
//expect(bounds.getMaxY()).toEqual(64);
});
});
});