Improve raster reprojection behavior when tiles fail to load

This commit is contained in:
Petr Sloup
2016-01-26 13:58:35 +01:00
parent 398a292053
commit a05c932973
+17 -13
View File
@@ -254,21 +254,25 @@ ol.reproj.Tile.prototype.reproject_ = function() {
}, this); }, this);
this.sourceTiles_.length = 0; this.sourceTiles_.length = 0;
var z = this.wrappedTileCoord_[0]; if (sources.length === 0) {
var size = this.targetTileGrid_.getTileSize(z); this.state = ol.TileState.ERROR;
var width = goog.isNumber(size) ? size : size[0]; } else {
var height = goog.isNumber(size) ? size : size[1]; var z = this.wrappedTileCoord_[0];
var targetResolution = this.targetTileGrid_.getResolution(z); var size = this.targetTileGrid_.getTileSize(z);
var sourceResolution = this.sourceTileGrid_.getResolution(this.sourceZ_); var width = goog.isNumber(size) ? size : size[0];
var height = goog.isNumber(size) ? size : size[1];
var targetResolution = this.targetTileGrid_.getResolution(z);
var sourceResolution = this.sourceTileGrid_.getResolution(this.sourceZ_);
var targetExtent = this.targetTileGrid_.getTileCoordExtent( var targetExtent = this.targetTileGrid_.getTileCoordExtent(
this.wrappedTileCoord_); this.wrappedTileCoord_);
this.canvas_ = ol.reproj.render(width, height, this.pixelRatio_, this.canvas_ = ol.reproj.render(width, height, this.pixelRatio_,
sourceResolution, this.sourceTileGrid_.getExtent(), sourceResolution, this.sourceTileGrid_.getExtent(),
targetResolution, targetExtent, this.triangulation_, sources, targetResolution, targetExtent, this.triangulation_, sources,
this.renderEdges_); this.renderEdges_);
this.state = ol.TileState.LOADED; this.state = ol.TileState.LOADED;
}
this.changed(); this.changed();
}; };