Add ol.ENABLE_RASTER_REPROJECTION define
This commit is contained in:
@@ -94,6 +94,13 @@ ol.ENABLE_NAMED_COLORS = false;
|
|||||||
ol.ENABLE_PROJ4JS = true;
|
ol.ENABLE_PROJ4JS = true;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @define {boolean} Enable automatic reprojection of raster sources. Default is
|
||||||
|
* `true`.
|
||||||
|
*/
|
||||||
|
ol.ENABLE_RASTER_REPROJECTION = true;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @define {boolean} Enable rendering of ol.layer.Tile based layers. Default is
|
* @define {boolean} Enable rendering of ol.layer.Tile based layers. Default is
|
||||||
* `true`. Setting this to false at compile time in advanced mode removes
|
* `true`. Setting this to false at compile time in advanced mode removes
|
||||||
|
|||||||
@@ -101,6 +101,9 @@ ol.source.TileImage.defaultTileLoadFunction = function(imageTile, src) {
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.source.TileImage.prototype.canExpireCache = function() {
|
ol.source.TileImage.prototype.canExpireCache = function() {
|
||||||
|
if (!ol.ENABLE_RASTER_REPROJECTION) {
|
||||||
|
return goog.base(this, 'canExpireCache');
|
||||||
|
}
|
||||||
var canExpire = this.tileCache.canExpireCache();
|
var canExpire = this.tileCache.canExpireCache();
|
||||||
if (canExpire) {
|
if (canExpire) {
|
||||||
return true;
|
return true;
|
||||||
@@ -116,11 +119,15 @@ ol.source.TileImage.prototype.canExpireCache = function() {
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.source.TileImage.prototype.expireCache = function(projection, usedTiles) {
|
ol.source.TileImage.prototype.expireCache = function(projection, usedTiles) {
|
||||||
|
if (!ol.ENABLE_RASTER_REPROJECTION) {
|
||||||
|
goog.base(this, 'expireCache', projection, usedTiles);
|
||||||
|
return;
|
||||||
|
}
|
||||||
var usedTileCache = this.getTileCacheForProjection(projection);
|
var usedTileCache = this.getTileCacheForProjection(projection);
|
||||||
|
|
||||||
this.tileCache.expireCache(this.tileCache == usedTileCache ? usedTiles : {});
|
this.tileCache.expireCache(this.tileCache == usedTileCache ? usedTiles : {});
|
||||||
goog.object.forEach(this.tileCacheForProjection, function(tileCache) {
|
goog.object.forEach(this.tileCacheForProjection, function(tileCache) {
|
||||||
return tileCache.expireCache(tileCache == usedTileCache ? usedTiles : {});
|
tileCache.expireCache(tileCache == usedTileCache ? usedTiles : {});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -129,6 +136,9 @@ ol.source.TileImage.prototype.expireCache = function(projection, usedTiles) {
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.source.TileImage.prototype.getTileGridForProjection = function(projection) {
|
ol.source.TileImage.prototype.getTileGridForProjection = function(projection) {
|
||||||
|
if (!ol.ENABLE_RASTER_REPROJECTION) {
|
||||||
|
return goog.base(this, 'getTileGridForProjection', projection);
|
||||||
|
}
|
||||||
var thisProj = this.getProjection();
|
var thisProj = this.getProjection();
|
||||||
if (!goog.isNull(this.tileGrid) &&
|
if (!goog.isNull(this.tileGrid) &&
|
||||||
(goog.isNull(thisProj) || ol.proj.equivalent(thisProj, projection))) {
|
(goog.isNull(thisProj) || ol.proj.equivalent(thisProj, projection))) {
|
||||||
@@ -148,6 +158,9 @@ ol.source.TileImage.prototype.getTileGridForProjection = function(projection) {
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.source.TileImage.prototype.getTileCacheForProjection = function(projection) {
|
ol.source.TileImage.prototype.getTileCacheForProjection = function(projection) {
|
||||||
|
if (!ol.ENABLE_RASTER_REPROJECTION) {
|
||||||
|
return goog.base(this, 'getTileCacheForProjection', projection);
|
||||||
|
}
|
||||||
var thisProj = this.getProjection();
|
var thisProj = this.getProjection();
|
||||||
if (goog.isNull(thisProj) || ol.proj.equivalent(thisProj, projection)) {
|
if (goog.isNull(thisProj) || ol.proj.equivalent(thisProj, projection)) {
|
||||||
return this.tileCache;
|
return this.tileCache;
|
||||||
@@ -166,7 +179,8 @@ ol.source.TileImage.prototype.getTileCacheForProjection = function(projection) {
|
|||||||
*/
|
*/
|
||||||
ol.source.TileImage.prototype.getTile =
|
ol.source.TileImage.prototype.getTile =
|
||||||
function(z, x, y, pixelRatio, projection) {
|
function(z, x, y, pixelRatio, projection) {
|
||||||
if (!goog.isDefAndNotNull(this.getProjection()) ||
|
if (!ol.ENABLE_RASTER_REPROJECTION ||
|
||||||
|
!goog.isDefAndNotNull(this.getProjection()) ||
|
||||||
!goog.isDefAndNotNull(projection) ||
|
!goog.isDefAndNotNull(projection) ||
|
||||||
ol.proj.equivalent(this.getProjection(), projection)) {
|
ol.proj.equivalent(this.getProjection(), projection)) {
|
||||||
return this.getTileInternal(z, x, y, pixelRatio, projection);
|
return this.getTileInternal(z, x, y, pixelRatio, projection);
|
||||||
|
|||||||
Reference in New Issue
Block a user