Skip to content

Commit

Permalink
fix(PlanarLayer): Fix delete new extent from globalExtentTMS const
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin ETOURNEAU committed Feb 23, 2024
1 parent 7d05a0f commit 5850b46
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Core/Prefab/Planar/PlanarLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import PlanarTileBuilder from './PlanarTileBuilder';
* internally for optimisation.
*/
class PlanarLayer extends TiledGeometryLayer {
#isNewExtent;
/**
* A {@link TiledGeometryLayer} to use with a {@link PlanarView}. It has
* specific method for updating and subdivising its grid.
Expand Down Expand Up @@ -40,18 +41,28 @@ class PlanarLayer extends TiledGeometryLayer {
constructor(id, extent, object3d, config = {}) {
const tms = CRS.formatToTms(extent.crs);
const tileMatrixSets = [tms];
let isNewExtent = false;
if (!globalExtentTMS.get(extent.crs)) {
// Add new global extent for this new crs projection.
globalExtentTMS.set(extent.crs, extent);
isNewExtent = true;
}
config.tileMatrixSets = tileMatrixSets;
super(id, object3d || new THREE.Group(), [extent], new PlanarTileBuilder({ crs: extent.crs }), config);
this.isPlanarLayer = true;
this.#isNewExtent = isNewExtent;
this.extent = extent;
this.minSubdivisionLevel = this.minSubdivisionLevel == undefined ? 0 : this.minSubdivisionLevel;
this.maxSubdivisionLevel = this.maxSubdivisionLevel == undefined ? 5 : this.maxSubdivisionLevel;
this.maxDeltaElevationLevel = this.maxDeltaElevationLevel || 4.0;
}

delete(clearCache) {
super.delete(clearCache);
if (this.#isNewExtent) {
globalExtentTMS.delete(this.extent.crs);
}
}
}

export default PlanarLayer;

0 comments on commit 5850b46

Please sign in to comment.