@loaders.gl/tiles 4.0.0-alpha.22 → 4.0.0-alpha.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/dist/bundle.js +0 -5
- package/dist/constants.js +0 -39
- package/dist/index.js +0 -26
- package/dist/tileset/format-3d-tiles/tileset-3d-traverser.js +0 -54
- package/dist/tileset/format-i3s/i3s-pending-tiles-register.js +0 -47
- package/dist/tileset/format-i3s/i3s-tile-manager.js +0 -80
- package/dist/tileset/format-i3s/i3s-tileset-traverser.js +0 -92
- package/dist/tileset/helpers/3d-tiles-options.js +0 -9
- package/dist/tileset/helpers/bounding-volume.js +0 -293
- package/dist/tileset/helpers/frame-state.js +0 -133
- package/dist/tileset/helpers/i3s-lod.js +0 -85
- package/dist/tileset/helpers/tiles-3d-lod.js +0 -117
- package/dist/tileset/helpers/transform-utils.js +0 -53
- package/dist/tileset/helpers/zoom.js +0 -89
- package/dist/tileset/tile-3d.js +0 -610
- package/dist/tileset/tileset-3d.js +0 -716
- package/dist/tileset/tileset-cache.js +0 -72
- package/dist/tileset/tileset-traverser.js +0 -300
- package/dist/types.js +0 -2
- package/dist/utils/doubly-linked-list-node.js +0 -18
- package/dist/utils/doubly-linked-list.js +0 -97
- package/dist/utils/managed-array.js +0 -152
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// loaders.gl, MIT license
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.getZoomFromExtent = exports.getZoomFromFullExtent = exports.getZoomFromBoundingVolume = void 0;
|
|
5
|
-
const core_1 = require("@math.gl/core");
|
|
6
|
-
const culling_1 = require("@math.gl/culling");
|
|
7
|
-
const geospatial_1 = require("@math.gl/geospatial");
|
|
8
|
-
const WGS84_RADIUS_X = 6378137.0;
|
|
9
|
-
const WGS84_RADIUS_Y = 6378137.0;
|
|
10
|
-
const WGS84_RADIUS_Z = 6356752.3142451793;
|
|
11
|
-
const scratchVector = new core_1.Vector3();
|
|
12
|
-
/**
|
|
13
|
-
* Calculate appropriate zoom value for a particular boundingVolume
|
|
14
|
-
* @param boundingVolume - the instance of bounding volume
|
|
15
|
-
* @param cartorgraphicCenter - cartographic center of the bounding volume
|
|
16
|
-
* @returns {number} - zoom value
|
|
17
|
-
*/
|
|
18
|
-
function getZoomFromBoundingVolume(boundingVolume, cartorgraphicCenter) {
|
|
19
|
-
if (boundingVolume instanceof culling_1.OrientedBoundingBox) {
|
|
20
|
-
// OrientedBoundingBox
|
|
21
|
-
const { halfAxes } = boundingVolume;
|
|
22
|
-
const obbSize = getObbSize(halfAxes);
|
|
23
|
-
// Use WGS84_RADIUS_Z to allign with BoundingSphere algorithm
|
|
24
|
-
// Add the tile elevation value for correct zooming to elevated tiles
|
|
25
|
-
return Math.log2(WGS84_RADIUS_Z / (obbSize + cartorgraphicCenter[2]));
|
|
26
|
-
}
|
|
27
|
-
else if (boundingVolume instanceof culling_1.BoundingSphere) {
|
|
28
|
-
// BoundingSphere
|
|
29
|
-
const { radius } = boundingVolume;
|
|
30
|
-
// Add the tile elevation value for correct zooming to elevated tiles
|
|
31
|
-
return Math.log2(WGS84_RADIUS_Z / (radius + cartorgraphicCenter[2]));
|
|
32
|
-
}
|
|
33
|
-
else if (boundingVolume.width && boundingVolume.height) {
|
|
34
|
-
// BoundingRectangle
|
|
35
|
-
const { width, height } = boundingVolume;
|
|
36
|
-
const zoomX = Math.log2(WGS84_RADIUS_X / width);
|
|
37
|
-
const zoomY = Math.log2(WGS84_RADIUS_Y / height);
|
|
38
|
-
return (zoomX + zoomY) / 2;
|
|
39
|
-
}
|
|
40
|
-
return 1;
|
|
41
|
-
}
|
|
42
|
-
exports.getZoomFromBoundingVolume = getZoomFromBoundingVolume;
|
|
43
|
-
/**
|
|
44
|
-
* Calculate initial zoom for the tileset from 3D `fullExtent` defined in
|
|
45
|
-
* the tileset metadata
|
|
46
|
-
* @param fullExtent - 3D extent of the tileset
|
|
47
|
-
* @param fullExtent.xmin - minimal longitude in decimal degrees
|
|
48
|
-
* @param fullExtent.xmax - maximal longitude in decimal degrees
|
|
49
|
-
* @param fullExtent.ymin - minimal latitude in decimal degrees
|
|
50
|
-
* @param fullExtent.ymax - maximal latitude in decimal degrees
|
|
51
|
-
* @param fullExtent.zmin - minimal elevation in meters
|
|
52
|
-
* @param fullExtent.zmax - maximal elevation in meters
|
|
53
|
-
* @param cartorgraphicCenter - tileset center in cartographic coordinate system
|
|
54
|
-
* @param cartesianCenter - tileset center in cartesian coordinate system
|
|
55
|
-
* @returns - initial zoom for the tileset
|
|
56
|
-
*/
|
|
57
|
-
function getZoomFromFullExtent(fullExtent, cartorgraphicCenter, cartesianCenter) {
|
|
58
|
-
const extentVertex = geospatial_1.Ellipsoid.WGS84.cartographicToCartesian([fullExtent.xmax, fullExtent.ymax, fullExtent.zmax], new core_1.Vector3());
|
|
59
|
-
const extentSize = Math.sqrt(Math.pow(extentVertex[0] - cartesianCenter[0], 2) +
|
|
60
|
-
Math.pow(extentVertex[1] - cartesianCenter[1], 2) +
|
|
61
|
-
Math.pow(extentVertex[2] - cartesianCenter[2], 2));
|
|
62
|
-
return Math.log2(WGS84_RADIUS_Z / (extentSize + cartorgraphicCenter[2]));
|
|
63
|
-
}
|
|
64
|
-
exports.getZoomFromFullExtent = getZoomFromFullExtent;
|
|
65
|
-
/**
|
|
66
|
-
* Calculate initial zoom for the tileset from 2D `extent` defined in
|
|
67
|
-
* the tileset metadata
|
|
68
|
-
* @param extent - 2D extent of the tileset. It is array of 4 elements [xmin, ymin, xmax, ymax]
|
|
69
|
-
* @param extent[0] - minimal longitude in decimal degrees
|
|
70
|
-
* @param extent[1] - minimal latitude in decimal degrees
|
|
71
|
-
* @param extent[2] - maximal longitude in decimal degrees
|
|
72
|
-
* @param extent[3] - maximal latitude in decimal degrees
|
|
73
|
-
* @param cartorgraphicCenter - tileset center in cartographic coordinate system
|
|
74
|
-
* @param cartesianCenter - tileset center in cartesian coordinate system
|
|
75
|
-
* @returns - initial zoom for the tileset
|
|
76
|
-
*/
|
|
77
|
-
function getZoomFromExtent(extent, cartorgraphicCenter, cartesianCenter) {
|
|
78
|
-
const [xmin, ymin, xmax, ymax] = extent;
|
|
79
|
-
return getZoomFromFullExtent({ xmin, xmax, ymin, ymax, zmin: 0, zmax: 0 }, cartorgraphicCenter, cartesianCenter);
|
|
80
|
-
}
|
|
81
|
-
exports.getZoomFromExtent = getZoomFromExtent;
|
|
82
|
-
function getObbSize(halfAxes) {
|
|
83
|
-
halfAxes.getColumn(0, scratchVector);
|
|
84
|
-
const axeY = halfAxes.getColumn(1);
|
|
85
|
-
const axeZ = halfAxes.getColumn(2);
|
|
86
|
-
const farthestVertex = scratchVector.add(axeY).add(axeZ);
|
|
87
|
-
const size = farthestVertex.len();
|
|
88
|
-
return size;
|
|
89
|
-
}
|