@itwin/frontend-tiles 4.0.0-dev.52 → 4.0.0-dev.55
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/.rush/temp/operation/build_ci/state.json +1 -1
- package/.rush/temp/package-deps_build_ci.json +4 -4
- package/.rush/temp/shrinkwrap-deps.json +45 -52
- package/lib/cjs/BatchedSpatialTileTreeRefs.d.ts +3 -3
- package/lib/cjs/BatchedSpatialTileTreeRefs.js +34 -34
- package/lib/cjs/BatchedTile.d.ts +23 -23
- package/lib/cjs/BatchedTile.d.ts.map +1 -1
- package/lib/cjs/BatchedTile.js +249 -155
- package/lib/cjs/BatchedTile.js.map +1 -1
- package/lib/cjs/BatchedTileContentReader.d.ts +22 -22
- package/lib/cjs/BatchedTileContentReader.js +74 -74
- package/lib/cjs/BatchedTileTree.d.ts +22 -22
- package/lib/cjs/BatchedTileTree.js +52 -52
- package/lib/cjs/BatchedTileTree.js.map +1 -1
- package/lib/cjs/BatchedTileTreeReference.d.ts +17 -17
- package/lib/cjs/BatchedTileTreeReference.js +49 -49
- package/lib/cjs/BatchedTileTreeSupplier.d.ts +5 -5
- package/lib/cjs/BatchedTileTreeSupplier.d.ts.map +1 -1
- package/lib/cjs/BatchedTileTreeSupplier.js +38 -38
- package/lib/cjs/BatchedTilesetReader.d.ts +13 -13
- package/lib/cjs/BatchedTilesetReader.js +87 -87
- package/lib/cjs/FrontendTiles.d.ts +14 -14
- package/lib/cjs/FrontendTiles.js +16 -16
- package/lib/cjs/LoggerCategory.d.ts +2 -2
- package/lib/cjs/LoggerCategory.js +9 -9
- package/lib/cjs/frontend-tiles.d.ts +1 -1
- package/lib/cjs/frontend-tiles.js +21 -17
- package/lib/cjs/frontend-tiles.js.map +1 -1
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/BatchedSpatialTileTreeRefs.d.ts +3 -3
- package/lib/esm/BatchedSpatialTileTreeRefs.js +30 -30
- package/lib/esm/BatchedTile.d.ts +23 -23
- package/lib/esm/BatchedTile.d.ts.map +1 -1
- package/lib/esm/BatchedTile.js +245 -151
- package/lib/esm/BatchedTile.js.map +1 -1
- package/lib/esm/BatchedTileContentReader.d.ts +22 -22
- package/lib/esm/BatchedTileContentReader.js +70 -70
- package/lib/esm/BatchedTileTree.d.ts +22 -22
- package/lib/esm/BatchedTileTree.js +48 -48
- package/lib/esm/BatchedTileTree.js.map +1 -1
- package/lib/esm/BatchedTileTreeReference.d.ts +17 -17
- package/lib/esm/BatchedTileTreeReference.js +45 -45
- package/lib/esm/BatchedTileTreeSupplier.d.ts +5 -5
- package/lib/esm/BatchedTileTreeSupplier.d.ts.map +1 -1
- package/lib/esm/BatchedTileTreeSupplier.js +34 -34
- package/lib/esm/BatchedTilesetReader.d.ts +13 -13
- package/lib/esm/BatchedTilesetReader.js +83 -83
- package/lib/esm/FrontendTiles.d.ts +14 -14
- package/lib/esm/FrontendTiles.js +12 -12
- package/lib/esm/LoggerCategory.d.ts +2 -2
- package/lib/esm/LoggerCategory.js +6 -6
- package/lib/esm/frontend-tiles.d.ts +1 -1
- package/lib/esm/frontend-tiles.js +5 -5
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -12
- package/src/BatchedTile.ts +131 -27
- package/src/BatchedTileTree.ts +1 -1
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { Matrix3d, Point3d, Range3d, Transform, Vector3d, } from "@itwin/core-geometry";
|
|
6
|
-
import { RealityModelTileUtils, TileLoadPriority } from "@itwin/core-frontend";
|
|
7
|
-
function isTileset3d(json) {
|
|
8
|
-
if (typeof json !== "object")
|
|
9
|
-
return false;
|
|
10
|
-
const props = json;
|
|
11
|
-
if (!props.root || !props.asset)
|
|
12
|
-
return false;
|
|
13
|
-
// ###TODO spec requires geometricError to be present on tileset and all tiles; exporter is omitting from tileset.
|
|
14
|
-
if (undefined === props.geometricError)
|
|
15
|
-
props.geometricError = props.root.geometricError;
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
function rangeFromBoundingVolume(vol) {
|
|
19
|
-
if (vol.box) {
|
|
20
|
-
const center = new Point3d(vol.box[0], vol.box[1], vol.box[2]);
|
|
21
|
-
const ux = new Vector3d(vol.box[3], vol.box[4], vol.box[5]);
|
|
22
|
-
const uy = new Vector3d(vol.box[6], vol.box[7], vol.box[8]);
|
|
23
|
-
const uz = new Vector3d(vol.box[9], vol.box[10], vol.box[11]);
|
|
24
|
-
const range = Range3d.createNull();
|
|
25
|
-
for (let i = -1; i <= 1; i += 2)
|
|
26
|
-
for (let j = -1; j <= 1; j += 2)
|
|
27
|
-
for (let k = -1; k <= 1; k += 2)
|
|
28
|
-
range.extendPoint(center.plus3Scaled(ux, i, uy, j, uz, k));
|
|
29
|
-
return range;
|
|
30
|
-
}
|
|
31
|
-
else if (vol.sphere) {
|
|
32
|
-
const center = new Point3d(vol.sphere[0], vol.sphere[1], vol.sphere[2]);
|
|
33
|
-
const radius = vol.sphere[3];
|
|
34
|
-
return Range3d.createXYZXYZ(center.x - radius, center.y - radius, center.z - radius, center.x + radius, center.y + radius, center.z + radius);
|
|
35
|
-
}
|
|
36
|
-
// We won't get region bounding volumes in our tiles.
|
|
37
|
-
throw new Error("region bounding volume unimplemented");
|
|
38
|
-
}
|
|
39
|
-
function transformFromJSON(json) {
|
|
40
|
-
const translation = new Point3d(json[12], json[13], json[14]);
|
|
41
|
-
const matrix = Matrix3d.createRowValues(json[0], json[4], json[8], json[1], json[5], json[9], json[2], json[6], json[10]);
|
|
42
|
-
return Transform.createOriginAndMatrix(translation, matrix);
|
|
43
|
-
}
|
|
44
|
-
/** @internal */
|
|
45
|
-
export class BatchedTilesetReader {
|
|
46
|
-
constructor(json, iModel, baseUrl) {
|
|
47
|
-
if (!isTileset3d(json))
|
|
48
|
-
throw new Error("Invalid tileset JSON");
|
|
49
|
-
this._iModel = iModel;
|
|
50
|
-
this._tileset = json;
|
|
51
|
-
this.baseUrl = baseUrl;
|
|
52
|
-
}
|
|
53
|
-
readTileParams(json, parent) {
|
|
54
|
-
const content = json.content;
|
|
55
|
-
const geometricError = json.geometricError;
|
|
56
|
-
const range = rangeFromBoundingVolume(json.boundingVolume);
|
|
57
|
-
const isLeaf = undefined === json.children || json.children.length === 0;
|
|
58
|
-
// ###TODO evaluate this. The geometric errors in the tiles seem far too small.
|
|
59
|
-
const maximumSizeScale = 8;
|
|
60
|
-
return {
|
|
61
|
-
parent,
|
|
62
|
-
contentId: content?.uri ?? "",
|
|
63
|
-
range,
|
|
64
|
-
contentRange: content?.boundingVolume ? rangeFromBoundingVolume(content.boundingVolume) : undefined,
|
|
65
|
-
isLeaf,
|
|
66
|
-
maximumSize: maximumSizeScale * RealityModelTileUtils.maximumSizeFromGeometricTolerance(range, geometricError),
|
|
67
|
-
childrenProps: isLeaf ? undefined : json.children,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
async readTileTreeParams() {
|
|
71
|
-
const root = this._tileset.root;
|
|
72
|
-
const location = root.transform ? transformFromJSON(root.transform) : Transform.createIdentity();
|
|
73
|
-
return {
|
|
74
|
-
id: "spatial-models",
|
|
75
|
-
modelId: this._iModel.transientIds.getNext(),
|
|
76
|
-
iModel: this._iModel,
|
|
77
|
-
location,
|
|
78
|
-
priority: TileLoadPriority.Primary,
|
|
79
|
-
rootTile: this.readTileParams(root),
|
|
80
|
-
reader: this,
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
}
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { Matrix3d, Point3d, Range3d, Transform, Vector3d, } from "@itwin/core-geometry";
|
|
6
|
+
import { RealityModelTileUtils, TileLoadPriority } from "@itwin/core-frontend";
|
|
7
|
+
function isTileset3d(json) {
|
|
8
|
+
if (typeof json !== "object")
|
|
9
|
+
return false;
|
|
10
|
+
const props = json;
|
|
11
|
+
if (!props.root || !props.asset)
|
|
12
|
+
return false;
|
|
13
|
+
// ###TODO spec requires geometricError to be present on tileset and all tiles; exporter is omitting from tileset.
|
|
14
|
+
if (undefined === props.geometricError)
|
|
15
|
+
props.geometricError = props.root.geometricError;
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
function rangeFromBoundingVolume(vol) {
|
|
19
|
+
if (vol.box) {
|
|
20
|
+
const center = new Point3d(vol.box[0], vol.box[1], vol.box[2]);
|
|
21
|
+
const ux = new Vector3d(vol.box[3], vol.box[4], vol.box[5]);
|
|
22
|
+
const uy = new Vector3d(vol.box[6], vol.box[7], vol.box[8]);
|
|
23
|
+
const uz = new Vector3d(vol.box[9], vol.box[10], vol.box[11]);
|
|
24
|
+
const range = Range3d.createNull();
|
|
25
|
+
for (let i = -1; i <= 1; i += 2)
|
|
26
|
+
for (let j = -1; j <= 1; j += 2)
|
|
27
|
+
for (let k = -1; k <= 1; k += 2)
|
|
28
|
+
range.extendPoint(center.plus3Scaled(ux, i, uy, j, uz, k));
|
|
29
|
+
return range;
|
|
30
|
+
}
|
|
31
|
+
else if (vol.sphere) {
|
|
32
|
+
const center = new Point3d(vol.sphere[0], vol.sphere[1], vol.sphere[2]);
|
|
33
|
+
const radius = vol.sphere[3];
|
|
34
|
+
return Range3d.createXYZXYZ(center.x - radius, center.y - radius, center.z - radius, center.x + radius, center.y + radius, center.z + radius);
|
|
35
|
+
}
|
|
36
|
+
// We won't get region bounding volumes in our tiles.
|
|
37
|
+
throw new Error("region bounding volume unimplemented");
|
|
38
|
+
}
|
|
39
|
+
function transformFromJSON(json) {
|
|
40
|
+
const translation = new Point3d(json[12], json[13], json[14]);
|
|
41
|
+
const matrix = Matrix3d.createRowValues(json[0], json[4], json[8], json[1], json[5], json[9], json[2], json[6], json[10]);
|
|
42
|
+
return Transform.createOriginAndMatrix(translation, matrix);
|
|
43
|
+
}
|
|
44
|
+
/** @internal */
|
|
45
|
+
export class BatchedTilesetReader {
|
|
46
|
+
constructor(json, iModel, baseUrl) {
|
|
47
|
+
if (!isTileset3d(json))
|
|
48
|
+
throw new Error("Invalid tileset JSON");
|
|
49
|
+
this._iModel = iModel;
|
|
50
|
+
this._tileset = json;
|
|
51
|
+
this.baseUrl = baseUrl;
|
|
52
|
+
}
|
|
53
|
+
readTileParams(json, parent) {
|
|
54
|
+
const content = json.content;
|
|
55
|
+
const geometricError = json.geometricError;
|
|
56
|
+
const range = rangeFromBoundingVolume(json.boundingVolume);
|
|
57
|
+
const isLeaf = undefined === json.children || json.children.length === 0;
|
|
58
|
+
// ###TODO evaluate this. The geometric errors in the tiles seem far too small.
|
|
59
|
+
const maximumSizeScale = 8;
|
|
60
|
+
return {
|
|
61
|
+
parent,
|
|
62
|
+
contentId: content?.uri ?? "",
|
|
63
|
+
range,
|
|
64
|
+
contentRange: content?.boundingVolume ? rangeFromBoundingVolume(content.boundingVolume) : undefined,
|
|
65
|
+
isLeaf,
|
|
66
|
+
maximumSize: maximumSizeScale * RealityModelTileUtils.maximumSizeFromGeometricTolerance(range, geometricError),
|
|
67
|
+
childrenProps: isLeaf ? undefined : json.children,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
async readTileTreeParams() {
|
|
71
|
+
const root = this._tileset.root;
|
|
72
|
+
const location = root.transform ? transformFromJSON(root.transform) : Transform.createIdentity();
|
|
73
|
+
return {
|
|
74
|
+
id: "spatial-models",
|
|
75
|
+
modelId: this._iModel.transientIds.getNext(),
|
|
76
|
+
iModel: this._iModel,
|
|
77
|
+
location,
|
|
78
|
+
priority: TileLoadPriority.Primary,
|
|
79
|
+
rootTile: this.readTileParams(root),
|
|
80
|
+
reader: this,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
84
|
//# sourceMappingURL=BatchedTilesetReader.js.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { IModelConnection } from "@itwin/core-frontend";
|
|
2
|
-
/** Options supplied to [[initializeFrontendTiles]].
|
|
3
|
-
* @alpha
|
|
4
|
-
*/
|
|
5
|
-
export interface FrontendTilesOptions {
|
|
6
|
-
/** Given an iModel, provide the base URL where the tiles are stored representing all of the spatial models in the iModel.
|
|
7
|
-
* It is expected that baseUrl/tileset.json exists and contains a 3d tileset in which all relative URLs are relative to baseUrl.
|
|
8
|
-
*/
|
|
9
|
-
computeSpatialTilesetBaseUrl: (iModel: IModelConnection) => URL;
|
|
10
|
-
}
|
|
11
|
-
/** Initialize the frontend-tiles package to obtain tiles for spatial views.
|
|
12
|
-
* @alpha
|
|
13
|
-
*/
|
|
14
|
-
export declare function initializeFrontendTiles(options: FrontendTilesOptions): void;
|
|
1
|
+
import { IModelConnection } from "@itwin/core-frontend";
|
|
2
|
+
/** Options supplied to [[initializeFrontendTiles]].
|
|
3
|
+
* @alpha
|
|
4
|
+
*/
|
|
5
|
+
export interface FrontendTilesOptions {
|
|
6
|
+
/** Given an iModel, provide the base URL where the tiles are stored representing all of the spatial models in the iModel.
|
|
7
|
+
* It is expected that baseUrl/tileset.json exists and contains a 3d tileset in which all relative URLs are relative to baseUrl.
|
|
8
|
+
*/
|
|
9
|
+
computeSpatialTilesetBaseUrl: (iModel: IModelConnection) => URL;
|
|
10
|
+
}
|
|
11
|
+
/** Initialize the frontend-tiles package to obtain tiles for spatial views.
|
|
12
|
+
* @alpha
|
|
13
|
+
*/
|
|
14
|
+
export declare function initializeFrontendTiles(options: FrontendTilesOptions): void;
|
|
15
15
|
//# sourceMappingURL=FrontendTiles.d.ts.map
|
package/lib/esm/FrontendTiles.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { SpatialTileTreeReferences } from "@itwin/core-frontend";
|
|
6
|
-
import { createBatchedSpatialTileTreeReferences } from "./BatchedSpatialTileTreeRefs";
|
|
7
|
-
/** Initialize the frontend-tiles package to obtain tiles for spatial views.
|
|
8
|
-
* @alpha
|
|
9
|
-
*/
|
|
10
|
-
export function initializeFrontendTiles(options) {
|
|
11
|
-
SpatialTileTreeReferences.create = (view) => createBatchedSpatialTileTreeReferences(view, options.computeSpatialTilesetBaseUrl);
|
|
12
|
-
}
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { SpatialTileTreeReferences } from "@itwin/core-frontend";
|
|
6
|
+
import { createBatchedSpatialTileTreeReferences } from "./BatchedSpatialTileTreeRefs";
|
|
7
|
+
/** Initialize the frontend-tiles package to obtain tiles for spatial views.
|
|
8
|
+
* @alpha
|
|
9
|
+
*/
|
|
10
|
+
export function initializeFrontendTiles(options) {
|
|
11
|
+
SpatialTileTreeReferences.create = (view) => createBatchedSpatialTileTreeReferences(view, options.computeSpatialTilesetBaseUrl);
|
|
12
|
+
}
|
|
13
13
|
//# sourceMappingURL=FrontendTiles.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/** @internal */
|
|
2
|
-
export declare const loggerCategory = "frontend-tiles";
|
|
1
|
+
/** @internal */
|
|
2
|
+
export declare const loggerCategory = "frontend-tiles";
|
|
3
3
|
//# sourceMappingURL=LoggerCategory.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
/** @internal */
|
|
6
|
-
export const loggerCategory = "frontend-tiles";
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @internal */
|
|
6
|
+
export const loggerCategory = "frontend-tiles";
|
|
7
7
|
//# sourceMappingURL=LoggerCategory.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./FrontendTiles";
|
|
1
|
+
export * from "./FrontendTiles";
|
|
2
2
|
//# sourceMappingURL=frontend-tiles.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
export * from "./FrontendTiles";
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
export * from "./FrontendTiles";
|
|
6
6
|
//# sourceMappingURL=frontend-tiles.js.map
|