@loaders.gl/tiles 3.2.0-alpha.1 → 3.2.0-alpha.4
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/dist/dist.min.js +121 -19
- package/dist/es5/tileset/helpers/zoom.js +32 -0
- package/dist/es5/tileset/helpers/zoom.js.map +1 -1
- package/dist/es5/tileset/tileset-3d.js +131 -43
- package/dist/es5/tileset/tileset-3d.js.map +1 -1
- package/dist/es5/tileset/traversers/i3s-frame-counter.js +45 -0
- package/dist/es5/tileset/traversers/i3s-frame-counter.js.map +1 -0
- package/dist/es5/tileset/traversers/i3s-tile-manager.js +17 -0
- package/dist/es5/tileset/traversers/i3s-tile-manager.js.map +1 -1
- package/dist/es5/tileset/traversers/i3s-tileset-traverser.js +6 -1
- package/dist/es5/tileset/traversers/i3s-tileset-traverser.js.map +1 -1
- package/dist/es5/tileset/traversers/tileset-traverser.js +13 -1
- package/dist/es5/tileset/traversers/tileset-traverser.js.map +1 -1
- package/dist/esm/tileset/helpers/zoom.js +17 -0
- package/dist/esm/tileset/helpers/zoom.js.map +1 -1
- package/dist/esm/tileset/tileset-3d.js +72 -16
- package/dist/esm/tileset/tileset-3d.js.map +1 -1
- package/dist/esm/tileset/traversers/i3s-frame-counter.js +23 -0
- package/dist/esm/tileset/traversers/i3s-frame-counter.js.map +1 -0
- package/dist/esm/tileset/traversers/i3s-tile-manager.js +15 -0
- package/dist/esm/tileset/traversers/i3s-tile-manager.js.map +1 -1
- package/dist/esm/tileset/traversers/i3s-tileset-traverser.js +5 -1
- package/dist/esm/tileset/traversers/i3s-tileset-traverser.js.map +1 -1
- package/dist/esm/tileset/traversers/tileset-traverser.js +14 -1
- package/dist/esm/tileset/traversers/tileset-traverser.js.map +1 -1
- package/dist/tileset/helpers/zoom.d.ts +35 -0
- package/dist/tileset/helpers/zoom.d.ts.map +1 -1
- package/dist/tileset/helpers/zoom.js +41 -1
- package/dist/tileset/tileset-3d.d.ts +17 -3
- package/dist/tileset/tileset-3d.d.ts.map +1 -1
- package/dist/tileset/tileset-3d.js +72 -21
- package/dist/tileset/traversers/i3s-frame-counter.d.ts +24 -0
- package/dist/tileset/traversers/i3s-frame-counter.d.ts.map +1 -0
- package/dist/tileset/traversers/i3s-frame-counter.js +37 -0
- package/dist/tileset/traversers/i3s-tile-manager.d.ts +10 -2
- package/dist/tileset/traversers/i3s-tile-manager.d.ts.map +1 -1
- package/dist/tileset/traversers/i3s-tile-manager.js +24 -0
- package/dist/tileset/traversers/i3s-tileset-traverser.d.ts +9 -2
- package/dist/tileset/traversers/i3s-tileset-traverser.d.ts.map +1 -1
- package/dist/tileset/traversers/i3s-tileset-traverser.js +10 -1
- package/dist/tileset/traversers/tileset-traverser.d.ts +5 -1
- package/dist/tileset/traversers/tileset-traverser.d.ts.map +1 -1
- package/dist/tileset/traversers/tileset-traverser.js +10 -1
- package/package.json +5 -5
- package/src/tileset/helpers/zoom.ts +64 -0
- package/src/tileset/tileset-3d.ts +84 -21
- package/src/tileset/traversers/i3s-frame-counter.ts +35 -0
- package/src/tileset/traversers/i3s-tile-manager.ts +26 -2
- package/src/tileset/traversers/i3s-tileset-traverser.ts +16 -3
- package/src/tileset/traversers/tileset-traverser.ts +13 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zoom.d.ts","sourceRoot":"","sources":["../../../src/tileset/helpers/zoom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,EAAC,cAAc,EAAE,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"zoom.d.ts","sourceRoot":"","sources":["../../../src/tileset/helpers/zoom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,EAAC,cAAc,EAAE,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AAErE,OAAO,EAAC,iBAAiB,EAAC,MAAM,aAAa,CAAC;AAQ9C;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,cAAc,EAAE,cAAc,GAAG,mBAAmB,GAAG,iBAAiB,EACxE,mBAAmB,EAAE,OAAO,UAwB7B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE;IACV,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,EACD,mBAAmB,EAAE,OAAO,EAC5B,eAAe,EAAE,OAAO,UAYzB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EACxC,mBAAmB,EAAE,OAAO,EAC5B,eAAe,EAAE,OAAO,UAQzB"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getZoomFromBoundingVolume = void 0;
|
|
3
|
+
exports.getZoomFromExtent = exports.getZoomFromFullExtent = exports.getZoomFromBoundingVolume = void 0;
|
|
4
4
|
const core_1 = require("@math.gl/core");
|
|
5
5
|
const culling_1 = require("@math.gl/culling");
|
|
6
|
+
const geospatial_1 = require("@math.gl/geospatial");
|
|
6
7
|
const WGS84_RADIUS_X = 6378137.0;
|
|
7
8
|
const WGS84_RADIUS_Y = 6378137.0;
|
|
8
9
|
const WGS84_RADIUS_Z = 6356752.3142451793;
|
|
@@ -38,6 +39,45 @@ function getZoomFromBoundingVolume(boundingVolume, cartorgraphicCenter) {
|
|
|
38
39
|
return 1;
|
|
39
40
|
}
|
|
40
41
|
exports.getZoomFromBoundingVolume = getZoomFromBoundingVolume;
|
|
42
|
+
/**
|
|
43
|
+
* Calculate initial zoom for the tileset from 3D `fullExtent` defined in
|
|
44
|
+
* the tileset metadata
|
|
45
|
+
* @param fullExtent - 3D extent of the tileset
|
|
46
|
+
* @param fullExtent.xmin - minimal longitude in decimal degrees
|
|
47
|
+
* @param fullExtent.xmax - maximal longitude in decimal degrees
|
|
48
|
+
* @param fullExtent.ymin - minimal latitude in decimal degrees
|
|
49
|
+
* @param fullExtent.ymax - maximal latitude in decimal degrees
|
|
50
|
+
* @param fullExtent.zmin - minimal elevation in meters
|
|
51
|
+
* @param fullExtent.zmax - maximal elevation in meters
|
|
52
|
+
* @param cartorgraphicCenter - tileset center in cartographic coordinate system
|
|
53
|
+
* @param cartesianCenter - tileset center in cartesian coordinate system
|
|
54
|
+
* @returns - initial zoom for the tileset
|
|
55
|
+
*/
|
|
56
|
+
function getZoomFromFullExtent(fullExtent, cartorgraphicCenter, cartesianCenter) {
|
|
57
|
+
const extentVertex = geospatial_1.Ellipsoid.WGS84.cartographicToCartesian([fullExtent.xmax, fullExtent.ymax, fullExtent.zmax], new core_1.Vector3());
|
|
58
|
+
const extentSize = Math.sqrt(Math.pow(extentVertex[0] - cartesianCenter[0], 2) +
|
|
59
|
+
Math.pow(extentVertex[1] - cartesianCenter[1], 2) +
|
|
60
|
+
Math.pow(extentVertex[2] - cartesianCenter[2], 2));
|
|
61
|
+
return Math.log2(WGS84_RADIUS_Z / (extentSize + cartorgraphicCenter[2]));
|
|
62
|
+
}
|
|
63
|
+
exports.getZoomFromFullExtent = getZoomFromFullExtent;
|
|
64
|
+
/**
|
|
65
|
+
* Calculate initial zoom for the tileset from 2D `extent` defined in
|
|
66
|
+
* the tileset metadata
|
|
67
|
+
* @param extent - 2D extent of the tileset. It is array of 4 elements [xmin, ymin, xmax, ymax]
|
|
68
|
+
* @param extent[0] - minimal longitude in decimal degrees
|
|
69
|
+
* @param extent[1] - minimal latitude in decimal degrees
|
|
70
|
+
* @param extent[2] - maximal longitude in decimal degrees
|
|
71
|
+
* @param extent[3] - maximal latitude in decimal degrees
|
|
72
|
+
* @param cartorgraphicCenter - tileset center in cartographic coordinate system
|
|
73
|
+
* @param cartesianCenter - tileset center in cartesian coordinate system
|
|
74
|
+
* @returns - initial zoom for the tileset
|
|
75
|
+
*/
|
|
76
|
+
function getZoomFromExtent(extent, cartorgraphicCenter, cartesianCenter) {
|
|
77
|
+
const [xmin, ymin, xmax, ymax] = extent;
|
|
78
|
+
return getZoomFromFullExtent({ xmin, xmax, ymin, ymax, zmin: 0, zmax: 0 }, cartorgraphicCenter, cartesianCenter);
|
|
79
|
+
}
|
|
80
|
+
exports.getZoomFromExtent = getZoomFromExtent;
|
|
41
81
|
function getObbSize(halfAxes) {
|
|
42
82
|
halfAxes.getColumn(0, scratchVector);
|
|
43
83
|
const axeY = halfAxes.getColumn(1);
|
|
@@ -87,6 +87,7 @@ export default class Tileset3D {
|
|
|
87
87
|
geometricError: number;
|
|
88
88
|
selectedTiles: Tile3D[];
|
|
89
89
|
private updatePromise;
|
|
90
|
+
tilesetInitializationPromise: Promise<void>;
|
|
90
91
|
cartographicCenter: Vector3 | null;
|
|
91
92
|
cartesianCenter: Vector3 | null;
|
|
92
93
|
zoom: number;
|
|
@@ -166,8 +167,21 @@ export default class Tileset3D {
|
|
|
166
167
|
_loadTiles(): void;
|
|
167
168
|
_unloadTiles(): void;
|
|
168
169
|
_updateStats(): void;
|
|
169
|
-
_initializeTileSet(tilesetJson: any): void
|
|
170
|
-
|
|
170
|
+
_initializeTileSet(tilesetJson: any): Promise<void>;
|
|
171
|
+
/**
|
|
172
|
+
* Called during initialize Tileset to initialize the tileset's cartographic center (longitude, latitude) and zoom.
|
|
173
|
+
* These metrics help apps center view on tileset
|
|
174
|
+
* For I3S there is extent (<1.8 version) or fullExtent (>=1.8 version) to calculate view props
|
|
175
|
+
* @returns
|
|
176
|
+
*/
|
|
177
|
+
private calculateViewPropsI3S;
|
|
178
|
+
/**
|
|
179
|
+
* Called during initialize Tileset to initialize the tileset's cartographic center (longitude, latitude) and zoom.
|
|
180
|
+
* These metrics help apps center view on tileset.
|
|
181
|
+
* For 3DTiles the root tile data is used to calculate view props.
|
|
182
|
+
* @returns
|
|
183
|
+
*/
|
|
184
|
+
private calculateViewPropsTiles3D;
|
|
171
185
|
_initializeStats(): void;
|
|
172
186
|
_initializeTileHeaders(tilesetJson: any, parentTileHeader: any): Tile3D;
|
|
173
187
|
_initializeTraverser(): any;
|
|
@@ -183,7 +197,7 @@ export default class Tileset3D {
|
|
|
183
197
|
_destroy(): void;
|
|
184
198
|
_destroySubtree(tile: any): void;
|
|
185
199
|
_destroyTile(tile: any): void;
|
|
186
|
-
|
|
200
|
+
_initializeTiles3DTileset(tilesetJson: any): void;
|
|
187
201
|
_initializeI3STileset(): void;
|
|
188
202
|
}
|
|
189
203
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tileset-3d.d.ts","sourceRoot":"","sources":["../../src/tileset/tileset-3d.ts"],"names":[],"mappings":"AAsCA,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AACtC,OAAO,EACL,gBAAgB,EAGhB,gBAAgB,EAChB,aAAa,EACd,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAC,UAAU,EAAoC,MAAM,uBAAuB,CAAC;AAEpF,OAAO,MAAM,MAAM,WAAW,CAAC;AAE/B,OAAO,gBAAgB,MAAM,gCAAgC,CAAC;AAI9D,oBAAY,cAAc,GAAG;IAE3B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,YAAY,CAAC,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pB,iBAAiB,CAAC,IAAI,KAAA;IAStB,WAAW,CAAC,IAAI,KAAA;IAYhB,QAAQ;IAoBR,eAAe,CAAC,IAAI,KAAA;IAgBpB,YAAY,CAAC,IAAI,KAAA;IAMjB,yBAAyB,CAAC,WAAW,KAAA;IA6BrC,qBAAqB;CAKtB"}
|
|
@@ -87,7 +87,6 @@ const DEFAULT_PROPS = {
|
|
|
87
87
|
contentLoader: undefined,
|
|
88
88
|
// View distance scale modifier
|
|
89
89
|
viewDistanceScale: 1.0,
|
|
90
|
-
// TODO CESIUM
|
|
91
90
|
// The maximum screen space error used to drive level of detail refinement.
|
|
92
91
|
maximumScreenSpaceError: 8,
|
|
93
92
|
loadTiles: true,
|
|
@@ -107,7 +106,7 @@ const TILES_LOADED = 'Tiles Loaded';
|
|
|
107
106
|
const TILES_LOADING = 'Tiles Loading';
|
|
108
107
|
const TILES_UNLOADED = 'Tiles Unloaded';
|
|
109
108
|
const TILES_LOAD_FAILED = 'Failed Tile Loads';
|
|
110
|
-
const POINTS_COUNT = 'Points';
|
|
109
|
+
const POINTS_COUNT = 'Points/Vertices';
|
|
111
110
|
const TILES_GPU_MEMORY = 'Tile Memory Use';
|
|
112
111
|
class Tileset3D {
|
|
113
112
|
/**
|
|
@@ -182,7 +181,7 @@ class Tileset3D {
|
|
|
182
181
|
this.asset = {};
|
|
183
182
|
this.credits = {};
|
|
184
183
|
this.description = this.options.description || '';
|
|
185
|
-
this._initializeTileSet(json);
|
|
184
|
+
this.tilesetInitializationPromise = this._initializeTileSet(json);
|
|
186
185
|
}
|
|
187
186
|
/** Release resources */
|
|
188
187
|
destroy() {
|
|
@@ -191,7 +190,7 @@ class Tileset3D {
|
|
|
191
190
|
/** Is the tileset loaded (update needs to have been called at least once) */
|
|
192
191
|
isLoaded() {
|
|
193
192
|
// Check that `_frameNumber !== 0` which means that update was called at least once
|
|
194
|
-
return this._pendingCount === 0 && this._frameNumber !== 0;
|
|
193
|
+
return this._pendingCount === 0 && this._frameNumber !== 0 && this._requestedTiles.length === 0;
|
|
195
194
|
}
|
|
196
195
|
get tiles() {
|
|
197
196
|
return Object.values(this._tiles);
|
|
@@ -233,13 +232,16 @@ class Tileset3D {
|
|
|
233
232
|
* @deprecated
|
|
234
233
|
*/
|
|
235
234
|
update(viewports = null) {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
235
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
236
|
+
this.tilesetInitializationPromise.then(() => {
|
|
237
|
+
if (!viewports && this.lastUpdatedVieports) {
|
|
238
|
+
viewports = this.lastUpdatedVieports;
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
this.lastUpdatedVieports = viewports;
|
|
242
|
+
}
|
|
243
|
+
this.doUpdate(viewports);
|
|
244
|
+
});
|
|
243
245
|
}
|
|
244
246
|
/**
|
|
245
247
|
* Update visible tiles relying on a list of viewports.
|
|
@@ -248,6 +250,7 @@ class Tileset3D {
|
|
|
248
250
|
* @returns Promise of new frameNumber
|
|
249
251
|
*/
|
|
250
252
|
async selectTiles(viewports = null) {
|
|
253
|
+
await this.tilesetInitializationPromise;
|
|
251
254
|
if (viewports) {
|
|
252
255
|
this.lastUpdatedVieports = viewports;
|
|
253
256
|
}
|
|
@@ -398,32 +401,74 @@ class Tileset3D {
|
|
|
398
401
|
if (tile.content.pointCount) {
|
|
399
402
|
pointsRenderable += tile.content.pointCount;
|
|
400
403
|
}
|
|
404
|
+
else {
|
|
405
|
+
// Calculate vertices for non point cloud tiles.
|
|
406
|
+
pointsRenderable += tile.content.vertexCount;
|
|
407
|
+
}
|
|
401
408
|
}
|
|
402
409
|
}
|
|
403
410
|
this.stats.get(TILES_IN_VIEW).count = this.selectedTiles.length;
|
|
404
411
|
this.stats.get(TILES_RENDERABLE).count = tilesRenderable;
|
|
405
412
|
this.stats.get(POINTS_COUNT).count = pointsRenderable;
|
|
406
413
|
}
|
|
407
|
-
_initializeTileSet(tilesetJson) {
|
|
414
|
+
async _initializeTileSet(tilesetJson) {
|
|
415
|
+
if (this.type === constants_1.TILESET_TYPE.I3S) {
|
|
416
|
+
this.calculateViewPropsI3S();
|
|
417
|
+
tilesetJson.root = await tilesetJson.root;
|
|
418
|
+
}
|
|
408
419
|
this.root = this._initializeTileHeaders(tilesetJson, null);
|
|
409
|
-
// TODO CESIUM Specific
|
|
410
420
|
if (this.type === constants_1.TILESET_TYPE.TILES3D) {
|
|
411
|
-
this.
|
|
421
|
+
this._initializeTiles3DTileset(tilesetJson);
|
|
422
|
+
this.calculateViewPropsTiles3D();
|
|
412
423
|
}
|
|
413
424
|
if (this.type === constants_1.TILESET_TYPE.I3S) {
|
|
414
425
|
this._initializeI3STileset();
|
|
415
426
|
}
|
|
416
|
-
// Calculate cartographicCenter & zoom props to help apps center view on tileset
|
|
417
|
-
this._calculateViewProps();
|
|
418
427
|
}
|
|
419
|
-
|
|
420
|
-
|
|
428
|
+
/**
|
|
429
|
+
* Called during initialize Tileset to initialize the tileset's cartographic center (longitude, latitude) and zoom.
|
|
430
|
+
* These metrics help apps center view on tileset
|
|
431
|
+
* For I3S there is extent (<1.8 version) or fullExtent (>=1.8 version) to calculate view props
|
|
432
|
+
* @returns
|
|
433
|
+
*/
|
|
434
|
+
calculateViewPropsI3S() {
|
|
435
|
+
// for I3S 1.8 try to calculate with fullExtent
|
|
436
|
+
const fullExtent = this.tileset.fullExtent;
|
|
437
|
+
if (fullExtent) {
|
|
438
|
+
const { xmin, xmax, ymin, ymax, zmin, zmax } = fullExtent;
|
|
439
|
+
this.cartographicCenter = new core_1.Vector3(xmin + (xmax - xmin) / 2, ymin + (ymax - ymin) / 2, zmin + (zmax - zmin) / 2);
|
|
440
|
+
this.cartesianCenter = geospatial_1.Ellipsoid.WGS84.cartographicToCartesian(this.cartographicCenter, new core_1.Vector3());
|
|
441
|
+
this.zoom = (0, zoom_1.getZoomFromFullExtent)(fullExtent, this.cartographicCenter, this.cartesianCenter);
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
// for I3S 1.6-1.7 try to calculate with extent
|
|
445
|
+
const extent = this.tileset.store?.extent;
|
|
446
|
+
if (extent) {
|
|
447
|
+
const [xmin, ymin, xmax, ymax] = extent;
|
|
448
|
+
this.cartographicCenter = new core_1.Vector3(xmin + (xmax - xmin) / 2, ymin + (ymax - ymin) / 2, 0);
|
|
449
|
+
this.cartesianCenter = geospatial_1.Ellipsoid.WGS84.cartographicToCartesian(this.cartographicCenter, new core_1.Vector3());
|
|
450
|
+
this.zoom = (0, zoom_1.getZoomFromExtent)(extent, this.cartographicCenter, this.cartesianCenter);
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
// eslint-disable-next-line no-console
|
|
454
|
+
console.warn('Extent is not defined in the tileset header');
|
|
455
|
+
this.cartographicCenter = new core_1.Vector3();
|
|
456
|
+
this.zoom = 1;
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Called during initialize Tileset to initialize the tileset's cartographic center (longitude, latitude) and zoom.
|
|
461
|
+
* These metrics help apps center view on tileset.
|
|
462
|
+
* For 3DTiles the root tile data is used to calculate view props.
|
|
463
|
+
* @returns
|
|
464
|
+
*/
|
|
465
|
+
calculateViewPropsTiles3D() {
|
|
421
466
|
const root = this.root;
|
|
422
467
|
(0, loader_utils_1.assert)(root);
|
|
423
468
|
const { center } = root.boundingVolume;
|
|
424
469
|
// TODO - handle all cases
|
|
425
470
|
if (!center) {
|
|
426
|
-
// eslint-disable-next-line
|
|
471
|
+
// eslint-disable-next-line no-console
|
|
427
472
|
console.warn('center was not pre-calculated for the root tile');
|
|
428
473
|
this.cartographicCenter = new core_1.Vector3();
|
|
429
474
|
this.zoom = 1;
|
|
@@ -457,7 +502,7 @@ class Tileset3D {
|
|
|
457
502
|
parentTileHeader.children.push(rootTile);
|
|
458
503
|
rootTile.depth = parentTileHeader.depth + 1;
|
|
459
504
|
}
|
|
460
|
-
//
|
|
505
|
+
// 3DTiles knows the hierarchy beforehand
|
|
461
506
|
if (this.type === constants_1.TILESET_TYPE.TILES3D) {
|
|
462
507
|
const stack = [];
|
|
463
508
|
stack.push(rootTile);
|
|
@@ -522,6 +567,12 @@ class Tileset3D {
|
|
|
522
567
|
if (!loaded) {
|
|
523
568
|
return;
|
|
524
569
|
}
|
|
570
|
+
if (this.type === constants_1.TILESET_TYPE.I3S) {
|
|
571
|
+
// We can't calculate tiles total in I3S in advance so we calculate it dynamically.
|
|
572
|
+
const nodesInNodePages = this.tileset?.nodePagesTile?.nodesInNodePages || 0;
|
|
573
|
+
this.stats.get(TILES_TOTAL).reset();
|
|
574
|
+
this.stats.get(TILES_TOTAL).addCount(nodesInNodePages);
|
|
575
|
+
}
|
|
525
576
|
// add coordinateOrigin and modelMatrix to tile
|
|
526
577
|
if (tile && tile.content) {
|
|
527
578
|
(0, transform_utils_1.calculateTransformProps)(tile, tile.content);
|
|
@@ -591,7 +642,7 @@ class Tileset3D {
|
|
|
591
642
|
this._unloadTile(tile);
|
|
592
643
|
tile.destroy();
|
|
593
644
|
}
|
|
594
|
-
|
|
645
|
+
_initializeTiles3DTileset(tilesetJson) {
|
|
595
646
|
this.asset = tilesetJson.asset;
|
|
596
647
|
if (!this.asset) {
|
|
597
648
|
throw new Error('Tileset must have an asset property.');
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Counter to register pending tile headers for the particular frameNumber
|
|
3
|
+
* Until all tiles are loaded we won't call `onTraversalEnd` callback
|
|
4
|
+
*/
|
|
5
|
+
export default class I3SPendingTilesRegister {
|
|
6
|
+
private frameNumberMap;
|
|
7
|
+
/**
|
|
8
|
+
* Register a new pending tile header for the particular frameNumber
|
|
9
|
+
* @param frameNumber
|
|
10
|
+
*/
|
|
11
|
+
register(frameNumber: number): void;
|
|
12
|
+
/**
|
|
13
|
+
* Deregister a pending tile header for the particular frameNumber
|
|
14
|
+
* @param frameNumber
|
|
15
|
+
*/
|
|
16
|
+
deregister(frameNumber: number): void;
|
|
17
|
+
/**
|
|
18
|
+
* Check is there are no pending tile headers registered for the particular frameNumber
|
|
19
|
+
* @param frameNumber
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
isZero(frameNumber: number): boolean;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=i3s-frame-counter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i3s-frame-counter.d.ts","sourceRoot":"","sources":["../../../src/tileset/traversers/i3s-frame-counter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,uBAAuB;IAC1C,OAAO,CAAC,cAAc,CAAkC;IAExD;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM;IAK5B;;;OAGG;IACH,UAAU,CAAC,WAAW,EAAE,MAAM;IAK9B;;;;OAIG;IACH,MAAM,CAAC,WAAW,EAAE,MAAM;CAI3B"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* Counter to register pending tile headers for the particular frameNumber
|
|
5
|
+
* Until all tiles are loaded we won't call `onTraversalEnd` callback
|
|
6
|
+
*/
|
|
7
|
+
class I3SPendingTilesRegister {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.frameNumberMap = new Map();
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Register a new pending tile header for the particular frameNumber
|
|
13
|
+
* @param frameNumber
|
|
14
|
+
*/
|
|
15
|
+
register(frameNumber) {
|
|
16
|
+
const oldCount = this.frameNumberMap.get(frameNumber) || 0;
|
|
17
|
+
this.frameNumberMap.set(frameNumber, (oldCount || 0) + 1);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Deregister a pending tile header for the particular frameNumber
|
|
21
|
+
* @param frameNumber
|
|
22
|
+
*/
|
|
23
|
+
deregister(frameNumber) {
|
|
24
|
+
const oldCount = this.frameNumberMap.get(frameNumber) || 1;
|
|
25
|
+
this.frameNumberMap.set(frameNumber, (oldCount || 0) - 1);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Check is there are no pending tile headers registered for the particular frameNumber
|
|
29
|
+
* @param frameNumber
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
32
|
+
isZero(frameNumber) {
|
|
33
|
+
const count = this.frameNumberMap.get(frameNumber) || 0;
|
|
34
|
+
return count === 0;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.default = I3SPendingTilesRegister;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
import { FrameState } from '../helpers/frame-state';
|
|
1
2
|
export default class I3STileManager {
|
|
2
3
|
private _statusMap;
|
|
4
|
+
private pendingTilesRegister;
|
|
3
5
|
constructor();
|
|
4
|
-
add(request: any, key: any, callback: any, frameState:
|
|
5
|
-
update(key: any, frameState:
|
|
6
|
+
add(request: any, key: any, callback: any, frameState: FrameState): void;
|
|
7
|
+
update(key: any, frameState: FrameState): void;
|
|
6
8
|
find(key: any): any;
|
|
9
|
+
/**
|
|
10
|
+
* Check it there are pending tile headers for the particular frameNumber
|
|
11
|
+
* @param frameNumber
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
hasPendingTiles(frameNumber: number): boolean;
|
|
7
15
|
}
|
|
8
16
|
//# sourceMappingURL=i3s-tile-manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-tile-manager.d.ts","sourceRoot":"","sources":["../../../src/tileset/traversers/i3s-tile-manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"i3s-tile-manager.d.ts","sourceRoot":"","sources":["../../../src/tileset/traversers/i3s-tile-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,wBAAwB,CAAC;AAUlD,MAAM,CAAC,OAAO,OAAO,cAAc;IACjC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,oBAAoB,CAAiC;;IAM7D,GAAG,CAAC,OAAO,KAAA,EAAE,GAAG,KAAA,EAAE,QAAQ,KAAA,EAAE,UAAU,EAAE,UAAU;IAsBlD,MAAM,CAAC,GAAG,KAAA,EAAE,UAAU,EAAE,UAAU;IAUlC,IAAI,CAAC,GAAG,KAAA;IAIR;;;;OAIG;IACH,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO;CAG9C"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const i3s_frame_counter_1 = __importDefault(require("./i3s-frame-counter"));
|
|
3
7
|
const STATUS = {
|
|
4
8
|
REQUESTED: 'REQUESTED',
|
|
5
9
|
COMPLETED: 'COMPLETED',
|
|
@@ -8,29 +12,49 @@ const STATUS = {
|
|
|
8
12
|
// A helper class to manage tile metadata fetching
|
|
9
13
|
class I3STileManager {
|
|
10
14
|
constructor() {
|
|
15
|
+
this.pendingTilesRegister = new i3s_frame_counter_1.default();
|
|
11
16
|
this._statusMap = {};
|
|
12
17
|
}
|
|
13
18
|
add(request, key, callback, frameState) {
|
|
14
19
|
if (!this._statusMap[key]) {
|
|
20
|
+
const { frameNumber } = frameState;
|
|
15
21
|
this._statusMap[key] = { request, callback, key, frameState, status: STATUS.REQUESTED };
|
|
22
|
+
// Register pending request for the frameNumber
|
|
23
|
+
this.pendingTilesRegister.register(frameNumber);
|
|
16
24
|
request()
|
|
17
25
|
.then((data) => {
|
|
18
26
|
this._statusMap[key].status = STATUS.COMPLETED;
|
|
27
|
+
// Deregister pending request for the frameNumber
|
|
28
|
+
this.pendingTilesRegister.deregister(frameNumber);
|
|
19
29
|
this._statusMap[key].callback(data, frameState);
|
|
20
30
|
})
|
|
21
31
|
.catch((error) => {
|
|
22
32
|
this._statusMap[key].status = STATUS.ERROR;
|
|
33
|
+
// Deregister pending request for the frameNumber
|
|
34
|
+
this.pendingTilesRegister.deregister(frameNumber);
|
|
23
35
|
callback(error);
|
|
24
36
|
});
|
|
25
37
|
}
|
|
26
38
|
}
|
|
27
39
|
update(key, frameState) {
|
|
28
40
|
if (this._statusMap[key]) {
|
|
41
|
+
// Deregister pending request for the old frameNumber
|
|
42
|
+
this.pendingTilesRegister.deregister(this._statusMap[key].frameState.frameNumber);
|
|
43
|
+
// Register pending request for the new frameNumber
|
|
44
|
+
this.pendingTilesRegister.register(frameState.frameNumber);
|
|
29
45
|
this._statusMap[key].frameState = frameState;
|
|
30
46
|
}
|
|
31
47
|
}
|
|
32
48
|
find(key) {
|
|
33
49
|
return this._statusMap[key];
|
|
34
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Check it there are pending tile headers for the particular frameNumber
|
|
53
|
+
* @param frameNumber
|
|
54
|
+
* @returns
|
|
55
|
+
*/
|
|
56
|
+
hasPendingTiles(frameNumber) {
|
|
57
|
+
return !this.pendingTilesRegister.isZero(frameNumber);
|
|
58
|
+
}
|
|
35
59
|
}
|
|
36
60
|
exports.default = I3STileManager;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import TilesetTraverser from './tileset-traverser';
|
|
2
|
+
import { FrameState } from '../helpers/frame-state';
|
|
2
3
|
export default class I3STilesetTraverser extends TilesetTraverser {
|
|
3
4
|
private _tileManager;
|
|
5
|
+
/**
|
|
6
|
+
* Check if there are no penging tile header requests,
|
|
7
|
+
* that means the traversal is finished and we can call
|
|
8
|
+
* following-up callbacks.
|
|
9
|
+
*/
|
|
10
|
+
protected get traversalFinished(): boolean;
|
|
4
11
|
constructor(options: any);
|
|
5
|
-
shouldRefine(tile: any, frameState:
|
|
6
|
-
updateChildTiles(tile: any, frameState:
|
|
12
|
+
shouldRefine(tile: any, frameState: FrameState): boolean;
|
|
13
|
+
updateChildTiles(tile: any, frameState: FrameState): boolean;
|
|
7
14
|
_loadTile(nodeId: any, tileset: any): Promise<any>;
|
|
8
15
|
/**
|
|
9
16
|
* The callback to init TileHeader instance after loading the tile JSON
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-tileset-traverser.d.ts","sourceRoot":"","sources":["../../../src/tileset/traversers/i3s-tileset-traverser.ts"],"names":[],"mappings":"AACA,OAAO,gBAAgB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"i3s-tileset-traverser.d.ts","sourceRoot":"","sources":["../../../src/tileset/traversers/i3s-tileset-traverser.ts"],"names":[],"mappings":"AACA,OAAO,gBAAgB,MAAM,qBAAqB,CAAC;AAKnD,OAAO,EAAC,UAAU,EAAC,MAAM,wBAAwB,CAAC;AAElD,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,gBAAgB;IAC/D,OAAO,CAAC,YAAY,CAAiB;IAErC;;;;OAIG;IACH,SAAS,KAAK,iBAAiB,IAAI,OAAO,CAEzC;gBAEW,OAAO,KAAA;IAKnB,YAAY,CAAC,IAAI,KAAA,EAAE,UAAU,EAAE,UAAU;IAKzC,gBAAgB,CAAC,IAAI,KAAA,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO;IAoCjD,SAAS,CAAC,MAAM,KAAA,EAAE,OAAO,KAAA;IAgB/B;;;;;;;OAOG;IACH,WAAW,CAAC,MAAM,KAAA,EAAE,IAAI,KAAA,EAAE,UAAU,KAAA;CAerC"}
|
|
@@ -13,6 +13,14 @@ class I3STilesetTraverser extends tileset_traverser_1.default {
|
|
|
13
13
|
super(options);
|
|
14
14
|
this._tileManager = new i3s_tile_manager_1.default();
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Check if there are no penging tile header requests,
|
|
18
|
+
* that means the traversal is finished and we can call
|
|
19
|
+
* following-up callbacks.
|
|
20
|
+
*/
|
|
21
|
+
get traversalFinished() {
|
|
22
|
+
return !this._tileManager.hasPendingTiles(this._frameNumber || 0);
|
|
23
|
+
}
|
|
16
24
|
shouldRefine(tile, frameState) {
|
|
17
25
|
tile._lodJudge = (0, i3s_lod_1.getLodStatus)(tile, frameState);
|
|
18
26
|
return tile._lodJudge === 'DIG';
|
|
@@ -77,7 +85,8 @@ class I3STilesetTraverser extends tileset_traverser_1.default {
|
|
|
77
85
|
const frameState = this._tileManager.find(childTile.id).frameState;
|
|
78
86
|
this.updateTile(childTile, frameState);
|
|
79
87
|
// after tile fetched, resume traversal if still in current update/traversal frame
|
|
80
|
-
if (this._frameNumber === frameState.frameNumber
|
|
88
|
+
if (this._frameNumber === frameState.frameNumber &&
|
|
89
|
+
(this.traversalFinished || new Date().getTime() - this.lastUpdate > this.updateDebounceTime)) {
|
|
81
90
|
this.executeTraversal(childTile, frameState);
|
|
82
91
|
}
|
|
83
92
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import ManagedArray from '../../utils/managed-array';
|
|
2
|
+
import { FrameState } from '../helpers/frame-state';
|
|
2
3
|
export declare type TilesetTraverserProps = {
|
|
3
4
|
loadSiblings?: boolean;
|
|
4
5
|
skipLevelOfDetail?: boolean;
|
|
@@ -27,13 +28,16 @@ export default class TilesetTraverser {
|
|
|
27
28
|
requestedTiles: object;
|
|
28
29
|
selectedTiles: object;
|
|
29
30
|
emptyTiles: object;
|
|
31
|
+
protected lastUpdate: number;
|
|
32
|
+
protected readonly updateDebounceTime = 1000;
|
|
30
33
|
protected _traversalStack: ManagedArray;
|
|
31
34
|
protected _emptyTraversalStack: ManagedArray;
|
|
32
35
|
protected _frameNumber: number | null;
|
|
36
|
+
protected get traversalFinished(): boolean;
|
|
33
37
|
constructor(options: TilesetTraverserProps);
|
|
34
38
|
traverse(root: any, frameState: any, options: any): void;
|
|
35
39
|
reset(): void;
|
|
36
|
-
executeTraversal(root: any, frameState:
|
|
40
|
+
executeTraversal(root: any, frameState: FrameState): void;
|
|
37
41
|
updateChildTiles(tile: any, frameState: any): boolean;
|
|
38
42
|
updateAndPushChildren(tile: any, frameState: any, stack: any, depth: any): boolean;
|
|
39
43
|
updateTile(tile: any, frameState: any): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tileset-traverser.d.ts","sourceRoot":"","sources":["../../../src/tileset/traversers/tileset-traverser.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"tileset-traverser.d.ts","sourceRoot":"","sources":["../../../src/tileset/traversers/tileset-traverser.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,2BAA2B,CAAC;AAErD,OAAO,EAAC,UAAU,EAAC,MAAM,wBAAwB,CAAC;AAElD,oBAAY,qBAAqB,GAAG;IAClC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,cAAc,CAAC,EAAE,CAAC,UAAU,KAAA,KAAK,GAAG,CAAC;IACrC,qBAAqB,CAAC,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,CAAC;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,oBAAY,KAAK,GAAG;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,uBAAuB,EAAE,MAAM,CAAC;IAChC,cAAc,EAAE,CAAC,UAAU,KAAA,KAAK,GAAG,CAAC;IACpC,qBAAqB,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,CAAC;IAC5C,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAQ3B,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,gBAAgB;IAC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,CAAC,KAAA,EAAE,CAAC,KAAA;IAI5B,kBAAkB,CAAC,IAAI,KAAA,EAAE,UAAU,KAAA;IAWnC,qBAAqB,CAAC,IAAI,KAAA,EAAE,UAAU,KAAA;CAqCvC"}
|
|
@@ -18,6 +18,8 @@ exports.DEFAULT_PROPS = {
|
|
|
18
18
|
class TilesetTraverser {
|
|
19
19
|
// TODO nested props
|
|
20
20
|
constructor(options) {
|
|
21
|
+
this.lastUpdate = new Date().getTime();
|
|
22
|
+
this.updateDebounceTime = 1000;
|
|
21
23
|
this.options = { ...exports.DEFAULT_PROPS, ...options };
|
|
22
24
|
// TRAVERSAL
|
|
23
25
|
// temporary storage to hold the traversed tiles during a traversal
|
|
@@ -35,6 +37,9 @@ class TilesetTraverser {
|
|
|
35
37
|
// tiles does not have render content
|
|
36
38
|
this.emptyTiles = {};
|
|
37
39
|
}
|
|
40
|
+
get traversalFinished() {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
38
43
|
// tiles should be visible
|
|
39
44
|
traverse(root, frameState, options) {
|
|
40
45
|
this.root = root; // for root screen space error
|
|
@@ -110,7 +115,11 @@ class TilesetTraverser {
|
|
|
110
115
|
// 4. update tile refine prop and parent refinement status to trickle down to the descendants
|
|
111
116
|
tile._shouldRefine = shouldRefine && parentRefines;
|
|
112
117
|
}
|
|
113
|
-
|
|
118
|
+
const newTime = new Date().getTime();
|
|
119
|
+
if (this.traversalFinished || newTime - this.lastUpdate > this.updateDebounceTime) {
|
|
120
|
+
this.lastUpdate = newTime;
|
|
121
|
+
this.options.onTraversalEnd(frameState);
|
|
122
|
+
}
|
|
114
123
|
}
|
|
115
124
|
updateChildTiles(tile, frameState) {
|
|
116
125
|
const children = tile.children;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/tiles",
|
|
3
|
-
"version": "3.2.0-alpha.
|
|
3
|
+
"version": "3.2.0-alpha.4",
|
|
4
4
|
"description": "Common components for different tiles loaders.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/dist.min.js"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@loaders.gl/loader-utils": "3.2.0-alpha.
|
|
37
|
-
"@loaders.gl/math": "3.2.0-alpha.
|
|
36
|
+
"@loaders.gl/loader-utils": "3.2.0-alpha.4",
|
|
37
|
+
"@loaders.gl/math": "3.2.0-alpha.4",
|
|
38
38
|
"@math.gl/core": "^3.5.1",
|
|
39
39
|
"@math.gl/culling": "^3.5.1",
|
|
40
40
|
"@math.gl/geospatial": "^3.5.1",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@probe.gl/stats": "^3.5.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@loaders.gl/core": "
|
|
45
|
+
"@loaders.gl/core": "3.2.0-alpha.3"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "f030d39d5cdedb137e43e757a9da10dd637857fd"
|
|
48
48
|
}
|