Skip to content

Commit

Permalink
refactor(EntwinePointTile): move this.spacing from EntwinePointItleSo…
Browse files Browse the repository at this point in the history
…urce to EntwinePointTileLayer
  • Loading branch information
ftoromanoff committed Oct 11, 2024
1 parent b196453 commit bd12987
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
13 changes: 9 additions & 4 deletions src/Layer/EntwinePointTileLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,24 @@ class EntwinePointTileLayer extends PointCloudLayer {
const resolve = this.addInitializationStep();
this.whenReady = this.source.whenReady.then(() => {
this.root = new EntwinePointTileNode(0, 0, 0, 0, this, -1);

this.root.bbox.min.fromArray(this.source.boundsConforming, 0);
this.root.bbox.max.fromArray(this.source.boundsConforming, 3);

this.minElevationRange = this.source.boundsConforming[2];
this.maxElevationRange = this.source.boundsConforming[5];

this.extent = Extent.fromBox3(config.crs || 'EPSG:4326', this.root.bbox);

// NOTE: this spacing is kinda arbitrary here, we take the width and
// length (height can be ignored), and we divide by the specified
// span in ept.json. This needs improvements.
this.spacing = (Math.abs(this.source.boundsConforming[3] - this.source.boundsConforming[0])
+ Math.abs(this.source.boundsConforming[4] - this.source.boundsConforming[1])) / (2 * this.source.span);

return this.root.loadOctree().then(resolve);
});
}

get spacing() {
return this.source.spacing;
}
}

export default EntwinePointTileLayer;
6 changes: 0 additions & 6 deletions src/Source/EntwinePointTileSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,6 @@ class EntwinePointTileSource extends Source {
}
}

// NOTE: this spacing is kinda arbitrary here, we take the width and
// length (height can be ignored), and we divide by the specified
// span in ept.json. This needs improvements.
this.spacing = (Math.abs(metadata.boundsConforming[3] - metadata.boundsConforming[0])
+ Math.abs(metadata.boundsConforming[4] - metadata.boundsConforming[1])) / (2 * metadata.span);

this.boundsConforming = metadata.boundsConforming;
this.bounds = metadata.bounds;
this.span = metadata.span;
Expand Down

0 comments on commit bd12987

Please sign in to comment.