s/TileBounds/TileRange/
This commit is contained in:
@@ -63,19 +63,19 @@ ol.renderer.dom.TileLayer.prototype.getTileOffset_ = function(z, resolution) {
|
||||
/**
|
||||
* Get rid of tiles outside the rendered extent.
|
||||
* @private
|
||||
* @param {ol.TileBounds} tileBounds Tile bounds.
|
||||
* @param {ol.TileRange} tileRange Tile range.
|
||||
* @param {number} z Z.
|
||||
*/
|
||||
ol.renderer.dom.TileLayer.prototype.removeInvisibleTiles_ = function(
|
||||
tileBounds, z) {
|
||||
tileRange, z) {
|
||||
var key, tileCoord, prune, tile;
|
||||
for (key in this.renderedTiles_) {
|
||||
tileCoord = ol.TileCoord.createFromString(key);
|
||||
prune = z !== tileCoord.z ||
|
||||
tileCoord.x < tileBounds.minX ||
|
||||
tileCoord.x > tileBounds.maxX ||
|
||||
tileCoord.y < tileBounds.minY ||
|
||||
tileCoord.y > tileBounds.maxY;
|
||||
tileCoord.x < tileRange.minX ||
|
||||
tileCoord.x > tileRange.maxX ||
|
||||
tileCoord.y < tileRange.minY ||
|
||||
tileCoord.y > tileRange.maxY;
|
||||
if (prune) {
|
||||
tile = this.renderedTiles_[key];
|
||||
delete this.renderedTiles_[key];
|
||||
@@ -109,14 +109,14 @@ ol.renderer.dom.TileLayer.prototype.render = function() {
|
||||
// z represents the "best" resolution
|
||||
var z = tileGrid.getZForResolution(mapResolution);
|
||||
|
||||
var tileBounds =
|
||||
tileGrid.getTileBoundsForExtentAndResolution(mapExtent, mapResolution);
|
||||
var tileRange =
|
||||
tileGrid.getTileRangeForExtentAndResolution(mapExtent, mapResolution);
|
||||
var tileOffset = this.getTileOffset_(z, mapResolution);
|
||||
|
||||
var fragment = document.createDocumentFragment();
|
||||
|
||||
var key, tile, pixelBounds, img, newTiles = false;
|
||||
tileBounds.forEachTileCoord(z, function(tileCoord) {
|
||||
tileRange.forEachTileCoord(z, function(tileCoord) {
|
||||
key = tileCoord.toString();
|
||||
tile = this.renderedTiles_[key];
|
||||
if (!goog.isDef(tile)) {
|
||||
@@ -143,6 +143,6 @@ ol.renderer.dom.TileLayer.prototype.render = function() {
|
||||
goog.dom.appendChild(this.target, fragment);
|
||||
}
|
||||
|
||||
this.removeInvisibleTiles_(tileBounds, z);
|
||||
this.removeInvisibleTiles_(tileRange, z);
|
||||
this.renderedMapResolution_ = mapResolution;
|
||||
};
|
||||
|
||||
@@ -308,22 +308,22 @@ ol.renderer.webgl.TileLayer.prototype.render = function() {
|
||||
var tileGrid = tileStore.getTileGrid();
|
||||
var z = tileGrid.getZForResolution(mapResolution);
|
||||
var tileResolution = tileGrid.getResolution(z);
|
||||
var tileBounds = tileGrid.getTileBoundsForExtentAndResolution(
|
||||
var tileRange = tileGrid.getTileRangeForExtentAndResolution(
|
||||
mapRotatedExtent, tileResolution);
|
||||
var tileBoundsSize = tileBounds.getSize();
|
||||
var tileRangeSize = tileRange.getSize();
|
||||
var tileSize = tileGrid.getTileSize();
|
||||
|
||||
var maxDimension = Math.max(
|
||||
tileBoundsSize.width * tileSize.width,
|
||||
tileBoundsSize.height * tileSize.height);
|
||||
tileRangeSize.width * tileSize.width,
|
||||
tileRangeSize.height * tileSize.height);
|
||||
var framebufferDimension =
|
||||
Math.pow(2, Math.ceil(Math.log(maxDimension) / Math.log(2)));
|
||||
var framebufferExtentSize = new ol.Size(
|
||||
tileResolution * framebufferDimension,
|
||||
tileResolution * framebufferDimension);
|
||||
var origin = tileGrid.getOrigin(z);
|
||||
var minX = origin.x + tileBounds.minX * tileSize.width * tileResolution;
|
||||
var minY = origin.y + tileBounds.minY * tileSize.height * tileResolution;
|
||||
var minX = origin.x + tileRange.minX * tileSize.width * tileResolution;
|
||||
var minY = origin.y + tileRange.minY * tileSize.height * tileResolution;
|
||||
var framebufferExtent = new ol.Extent(
|
||||
minX,
|
||||
minY,
|
||||
@@ -382,7 +382,7 @@ ol.renderer.webgl.TileLayer.prototype.render = function() {
|
||||
var imagesToLoad = [];
|
||||
|
||||
tilesToDrawByZ[z] = {};
|
||||
tileBounds.forEachTileCoord(z, function(tileCoord) {
|
||||
tileRange.forEachTileCoord(z, function(tileCoord) {
|
||||
|
||||
var tile = tileStore.getTile(tileCoord);
|
||||
|
||||
@@ -405,11 +405,11 @@ ol.renderer.webgl.TileLayer.prototype.render = function() {
|
||||
}
|
||||
|
||||
// FIXME this could be more efficient about filling partial holes
|
||||
tileGrid.forEachTileCoordParentTileBounds(
|
||||
tileGrid.forEachTileCoordParentTileRange(
|
||||
tileCoord,
|
||||
function(z, tileBounds) {
|
||||
function(z, tileRange) {
|
||||
var fullyCovered = true;
|
||||
tileBounds.forEachTileCoord(z, function(tileCoord) {
|
||||
tileRange.forEachTileCoord(z, function(tileCoord) {
|
||||
var tileCoordKey = tileCoord.toString();
|
||||
if (tilesToDrawByZ[z] && tilesToDrawByZ[z][tileCoordKey]) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user