Constructing tiles with bounds.
This commit is contained in:
+7
-8
@@ -144,20 +144,19 @@ ol.layer.XYZ.prototype.getData = function(bounds, resolution) {
|
|||||||
var tiles = [],
|
var tiles = [],
|
||||||
tile,
|
tile,
|
||||||
url,
|
url,
|
||||||
x = 0,
|
tileBottom, tileRight, tileBounds;
|
||||||
y = 0;
|
for (var y=0, tileTop=gridTop; tileTop > boundsMinY; ++y, tileTop-=tileHeightGeo) {
|
||||||
while (gridTop - (y * tileHeightGeo) > boundsMinY) {
|
|
||||||
tiles[y] = [];
|
tiles[y] = [];
|
||||||
while (gridLeft + (x * tileWidthGeo) < boundsMaxX) {
|
tileBottom = tileTop - tileHeightGeo;
|
||||||
|
for (var x=0, tileLeft=gridLeft; tileLeft < boundsMaxX; ++x, tileLeft+=tileWidthGeo) {
|
||||||
|
tileRight = tileLeft + tileWidthGeo;
|
||||||
|
tileBounds = new ol.Bounds(tileLeft, tileBottom, tileRight, tileTop, this.projection_);
|
||||||
url = me.url_.replace('{x}', offsetX + x + '')
|
url = me.url_.replace('{x}', offsetX + x + '')
|
||||||
.replace('{y}', offsetY + y + '')
|
.replace('{y}', offsetY + y + '')
|
||||||
.replace('{z}', zoom);
|
.replace('{z}', zoom);
|
||||||
tile = new ol.Tile(url);
|
tile = new ol.Tile(url, tileBounds);
|
||||||
tiles[y][x] = tile;
|
tiles[y][x] = tile;
|
||||||
x++;
|
|
||||||
}
|
}
|
||||||
y++;
|
|
||||||
x = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ol.TileSet(tiles, tileWidth, tileHeight, resolution);
|
return new ol.TileSet(tiles, tileWidth, tileHeight, resolution);
|
||||||
|
|||||||
Reference in New Issue
Block a user