Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(PlanarLayer): Fix delete new extent from globalExtentTMS const #2279

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
#hasNewExtent;
/**
* 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 hasNewExtent = false;
if (!globalExtentTMS.get(extent.crs)) {
// Add new global extent for this new crs projection.
globalExtentTMS.set(extent.crs, extent);
hasNewExtent = true;
}
config.tileMatrixSets = tileMatrixSets;
super(id, object3d || new THREE.Group(), [extent], new PlanarTileBuilder({ crs: extent.crs }), config);
this.isPlanarLayer = true;
this.#hasNewExtent = hasNewExtent;
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.#hasNewExtent) {
globalExtentTMS.delete(this.extent.crs);
}
}
}

export default PlanarLayer;
Loading