Use existing check for assertion
This commit is contained in:
@@ -252,4 +252,4 @@ A layer can only be added to the map once. Use either `layer.setMap()` or `map.a
|
|||||||
|
|
||||||
### 68
|
### 68
|
||||||
|
|
||||||
A VectorTile source can only be rendered if it has a projection compatible with the view projection.
|
Data from this source can only be rendered if it has a projection compatible with the view projection.
|
||||||
@@ -20,7 +20,6 @@ import {
|
|||||||
scale as scaleTransform,
|
scale as scaleTransform,
|
||||||
translate as translateTransform,
|
translate as translateTransform,
|
||||||
} from '../../transform.js';
|
} from '../../transform.js';
|
||||||
import {assert} from '../../asserts.js';
|
|
||||||
import {
|
import {
|
||||||
buffer,
|
buffer,
|
||||||
containsCoordinate,
|
containsCoordinate,
|
||||||
@@ -35,7 +34,6 @@ import {
|
|||||||
createHitDetectionImageData,
|
createHitDetectionImageData,
|
||||||
hitDetect,
|
hitDetect,
|
||||||
} from '../../render/canvas/hitdetect.js';
|
} from '../../render/canvas/hitdetect.js';
|
||||||
import {equivalent} from '../../proj.js';
|
|
||||||
import {
|
import {
|
||||||
getSquaredTolerance as getSquaredRenderTolerance,
|
getSquaredTolerance as getSquaredRenderTolerance,
|
||||||
renderFeature,
|
renderFeature,
|
||||||
@@ -232,15 +230,7 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
|
|||||||
* @return {boolean} Layer is ready to be rendered.
|
* @return {boolean} Layer is ready to be rendered.
|
||||||
*/
|
*/
|
||||||
prepareFrame(frameState) {
|
prepareFrame(frameState) {
|
||||||
const layer = this.getLayer();
|
const layerRevision = this.getLayer().getRevision();
|
||||||
assert(
|
|
||||||
equivalent(
|
|
||||||
layer.getSource().getProjection(),
|
|
||||||
frameState.viewState.projection
|
|
||||||
),
|
|
||||||
68 // A VectorTile source can only be rendered if it has a projection compatible with the view projection.
|
|
||||||
);
|
|
||||||
const layerRevision = layer.getRevision();
|
|
||||||
if (this.renderedLayerRevision_ != layerRevision) {
|
if (this.renderedLayerRevision_ != layerRevision) {
|
||||||
this.renderedTiles.length = 0;
|
this.renderedTiles.length = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import Source from './Source.js';
|
|||||||
import TileCache from '../TileCache.js';
|
import TileCache from '../TileCache.js';
|
||||||
import TileState from '../TileState.js';
|
import TileState from '../TileState.js';
|
||||||
import {abstract} from '../util.js';
|
import {abstract} from '../util.js';
|
||||||
|
import {assert} from '../asserts.js';
|
||||||
import {equivalent} from '../proj.js';
|
import {equivalent} from '../proj.js';
|
||||||
import {getKeyZXY, withinExtentAndZ} from '../tilecoord.js';
|
import {getKeyZXY, withinExtentAndZ} from '../tilecoord.js';
|
||||||
import {
|
import {
|
||||||
@@ -250,12 +251,11 @@ class TileSource extends Source {
|
|||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
getTileCacheForProjection(projection) {
|
getTileCacheForProjection(projection) {
|
||||||
const thisProj = this.getProjection();
|
assert(
|
||||||
if (thisProj && !equivalent(thisProj, projection)) {
|
equivalent(this.getProjection(), projection),
|
||||||
return null;
|
68 // A VectorTile source can only be rendered if it has a projection compatible with the view projection.
|
||||||
} else {
|
);
|
||||||
return this.tileCache;
|
return this.tileCache;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user