Make rendering of reprojection edges configurable

This commit is contained in:
Petr Sloup
2015-07-09 19:33:05 +02:00
parent 30cd0aa584
commit 8b38928aad
3 changed files with 42 additions and 15 deletions

View File

@@ -84,6 +84,12 @@ ol.source.TileImage = function(options) {
* @type {Object.<string, ol.tilegrid.TileGrid>}
*/
this.tileGridForProjection = {};
/**
* @private
* @type {boolean}
*/
this.renderReprojectionEdges_ = false;
};
goog.inherits(ol.source.TileImage, ol.source.Tile);
@@ -198,7 +204,7 @@ ol.source.TileImage.prototype.getTile =
projection, targetTileGrid,
z, x, y, pixelRatio, goog.bind(function(z, x, y, pixelRatio) {
return this.getTileInternal(z, x, y, pixelRatio, sourceProjection);
}, this));
}, this), this.renderReprojectionEdges_);
cache.set(tileCoordKey, tile);
return tile;
@@ -287,6 +293,21 @@ ol.source.TileImage.prototype.handleTileChange_ = function(event) {
};
/**
* Sets whether to render reprojection edges or not (usually for debugging).
* @param {boolean} render
* @api
*/
ol.source.TileImage.prototype.setRenderReprojectionEdges = function(render) {
if (this.renderReprojectionEdges_ == render) return;
this.renderReprojectionEdges_ = render;
goog.object.forEach(this.tileCacheForProjection, function(tileCache) {
tileCache.clear();
});
this.changed();
};
/**
* Set the tile load function of the source.
* @param {ol.TileLoadFunctionType} tileLoadFunction Tile load function.