Remove ENABLE_RASTER_REPROJECTION flag

This commit is contained in:
Andreas Hocevar
2022-08-18 22:03:15 +02:00
parent dfacb39c1a
commit 422db1b144
4 changed files with 7 additions and 45 deletions

View File

@@ -4,7 +4,6 @@
import CanvasLayerRenderer from './Layer.js'; import CanvasLayerRenderer from './Layer.js';
import ImageState from '../../ImageState.js'; import ImageState from '../../ImageState.js';
import ViewHint from '../../ViewHint.js'; import ViewHint from '../../ViewHint.js';
import {ENABLE_RASTER_REPROJECTION} from '../../reproj/common.js';
import { import {
apply as applyTransform, apply as applyTransform,
compose as composeTransform, compose as composeTransform,
@@ -77,13 +76,7 @@ class CanvasImageLayerRenderer extends CanvasLayerRenderer {
!isEmpty(renderedExtent) !isEmpty(renderedExtent)
) { ) {
if (imageSource) { if (imageSource) {
let projection = viewState.projection; const projection = viewState.projection;
if (!ENABLE_RASTER_REPROJECTION) {
const sourceProjection = imageSource.getProjection();
if (sourceProjection) {
projection = sourceProjection;
}
}
const image = imageSource.getImage( const image = imageSource.getImage(
renderedExtent, renderedExtent,
viewResolution, viewResolution,

View File

@@ -8,10 +8,3 @@
* @type {number} * @type {number}
*/ */
export const ERROR_THRESHOLD = 0.5; export const ERROR_THRESHOLD = 0.5;
/**
* Enable automatic reprojection of raster sources. Default is `true`.
* TODO: decide if we want to expose this as a build flag or remove it
* @type {boolean}
*/
export const ENABLE_RASTER_REPROJECTION = true;

View File

@@ -5,7 +5,6 @@ import Event from '../events/Event.js';
import ImageState from '../ImageState.js'; import ImageState from '../ImageState.js';
import ReprojImage from '../reproj/Image.js'; import ReprojImage from '../reproj/Image.js';
import Source from './Source.js'; import Source from './Source.js';
import {ENABLE_RASTER_REPROJECTION} from '../reproj/common.js';
import {abstract} from '../util.js'; import {abstract} from '../util.js';
import {equals} from '../extent.js'; import {equals} from '../extent.js';
import {equivalent} from '../proj.js'; import {equivalent} from '../proj.js';
@@ -169,7 +168,6 @@ class ImageSource extends Source {
getImage(extent, resolution, pixelRatio, projection) { getImage(extent, resolution, pixelRatio, projection) {
const sourceProjection = this.getProjection(); const sourceProjection = this.getProjection();
if ( if (
!ENABLE_RASTER_REPROJECTION ||
!sourceProjection || !sourceProjection ||
!projection || !projection ||
equivalent(sourceProjection, projection) equivalent(sourceProjection, projection)

View File

@@ -7,7 +7,6 @@ import ReprojTile from '../reproj/Tile.js';
import TileCache from '../TileCache.js'; import TileCache from '../TileCache.js';
import TileState from '../TileState.js'; import TileState from '../TileState.js';
import UrlTile from './UrlTile.js'; import UrlTile from './UrlTile.js';
import {ENABLE_RASTER_REPROJECTION} from '../reproj/common.js';
import {equivalent, get as getProjection} from '../proj.js'; import {equivalent, get as getProjection} from '../proj.js';
import {getKey, getKeyZXY} from '../tilecoord.js'; import {getKey, getKeyZXY} from '../tilecoord.js';
import {getForProjection as getTileGridForProjection} from '../tilegrid.js'; import {getForProjection as getTileGridForProjection} from '../tilegrid.js';
@@ -136,9 +135,6 @@ class TileImage extends UrlTile {
* @return {boolean} Can expire cache. * @return {boolean} Can expire cache.
*/ */
canExpireCache() { canExpireCache() {
if (!ENABLE_RASTER_REPROJECTION) {
return super.canExpireCache();
}
if (this.tileCache.canExpireCache()) { if (this.tileCache.canExpireCache()) {
return true; return true;
} else { } else {
@@ -156,10 +152,6 @@ class TileImage extends UrlTile {
* @param {!Object<string, boolean>} usedTiles Used tiles. * @param {!Object<string, boolean>} usedTiles Used tiles.
*/ */
expireCache(projection, usedTiles) { expireCache(projection, usedTiles) {
if (!ENABLE_RASTER_REPROJECTION) {
super.expireCache(projection, usedTiles);
return;
}
const usedTileCache = this.getTileCacheForProjection(projection); const usedTileCache = this.getTileCacheForProjection(projection);
this.tileCache.expireCache( this.tileCache.expireCache(
@@ -177,7 +169,6 @@ class TileImage extends UrlTile {
*/ */
getGutterForProjection(projection) { getGutterForProjection(projection) {
if ( if (
ENABLE_RASTER_REPROJECTION &&
this.getProjection() && this.getProjection() &&
projection && projection &&
!equivalent(this.getProjection(), projection) !equivalent(this.getProjection(), projection)
@@ -213,7 +204,6 @@ class TileImage extends UrlTile {
*/ */
getOpaque(projection) { getOpaque(projection) {
if ( if (
ENABLE_RASTER_REPROJECTION &&
this.getProjection() && this.getProjection() &&
projection && projection &&
!equivalent(this.getProjection(), projection) !equivalent(this.getProjection(), projection)
@@ -229,9 +219,6 @@ class TileImage extends UrlTile {
* @return {!import("../tilegrid/TileGrid.js").default} Tile grid. * @return {!import("../tilegrid/TileGrid.js").default} Tile grid.
*/ */
getTileGridForProjection(projection) { getTileGridForProjection(projection) {
if (!ENABLE_RASTER_REPROJECTION) {
return super.getTileGridForProjection(projection);
}
const thisProj = this.getProjection(); const thisProj = this.getProjection();
if (this.tileGrid && (!thisProj || equivalent(thisProj, projection))) { if (this.tileGrid && (!thisProj || equivalent(thisProj, projection))) {
return this.tileGrid; return this.tileGrid;
@@ -250,9 +237,6 @@ class TileImage extends UrlTile {
* @return {import("../TileCache.js").default} Tile cache. * @return {import("../TileCache.js").default} Tile cache.
*/ */
getTileCacheForProjection(projection) { getTileCacheForProjection(projection) {
if (!ENABLE_RASTER_REPROJECTION) {
return super.getTileCacheForProjection(projection);
}
const thisProj = this.getProjection(); const thisProj = this.getProjection();
if (!thisProj || equivalent(thisProj, projection)) { if (!thisProj || equivalent(thisProj, projection)) {
return this.tileCache; return this.tileCache;
@@ -310,7 +294,6 @@ class TileImage extends UrlTile {
getTile(z, x, y, pixelRatio, projection) { getTile(z, x, y, pixelRatio, projection) {
const sourceProjection = this.getProjection(); const sourceProjection = this.getProjection();
if ( if (
!ENABLE_RASTER_REPROJECTION ||
!sourceProjection || !sourceProjection ||
!projection || !projection ||
equivalent(sourceProjection, projection) equivalent(sourceProjection, projection)
@@ -415,10 +398,7 @@ class TileImage extends UrlTile {
* @api * @api
*/ */
setRenderReprojectionEdges(render) { setRenderReprojectionEdges(render) {
if ( if (this.renderReprojectionEdges_ == render) {
!ENABLE_RASTER_REPROJECTION ||
this.renderReprojectionEdges_ == render
) {
return; return;
} }
this.renderReprojectionEdges_ = render; this.renderReprojectionEdges_ = render;
@@ -441,13 +421,11 @@ class TileImage extends UrlTile {
* @api * @api
*/ */
setTileGridForProjection(projection, tilegrid) { setTileGridForProjection(projection, tilegrid) {
if (ENABLE_RASTER_REPROJECTION) { const proj = getProjection(projection);
const proj = getProjection(projection); if (proj) {
if (proj) { const projKey = getUid(proj);
const projKey = getUid(proj); if (!(projKey in this.tileGridForProjection)) {
if (!(projKey in this.tileGridForProjection)) { this.tileGridForProjection[projKey] = tilegrid;
this.tileGridForProjection[projKey] = tilegrid;
}
} }
} }
} }