@itwin/frontend-tiles 4.0.0-dev.46 → 4.0.0-dev.50
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 +6 -6
- package/.rush/temp/shrinkwrap-deps.json +11 -9
- package/lib/cjs/BatchedSpatialTileTreeRefs.d.ts +2 -2
- package/lib/cjs/BatchedSpatialTileTreeRefs.d.ts.map +1 -1
- package/lib/cjs/BatchedSpatialTileTreeRefs.js +9 -2
- package/lib/cjs/BatchedSpatialTileTreeRefs.js.map +1 -1
- package/lib/cjs/BatchedTileTreeReference.d.ts +16 -2
- package/lib/cjs/BatchedTileTreeReference.d.ts.map +1 -1
- package/lib/cjs/BatchedTileTreeReference.js +33 -8
- package/lib/cjs/BatchedTileTreeReference.js.map +1 -1
- package/lib/cjs/BatchedTilesetReader.d.ts.map +1 -1
- package/lib/cjs/BatchedTilesetReader.js +0 -2
- package/lib/cjs/BatchedTilesetReader.js.map +1 -1
- package/lib/cjs/FrontendTiles.js +1 -1
- package/lib/cjs/FrontendTiles.js.map +1 -1
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/BatchedSpatialTileTreeRefs.d.ts +2 -2
- package/lib/esm/BatchedSpatialTileTreeRefs.d.ts.map +1 -1
- package/lib/esm/BatchedSpatialTileTreeRefs.js +10 -3
- package/lib/esm/BatchedSpatialTileTreeRefs.js.map +1 -1
- package/lib/esm/BatchedTileTreeReference.d.ts +16 -2
- package/lib/esm/BatchedTileTreeReference.d.ts.map +1 -1
- package/lib/esm/BatchedTileTreeReference.js +32 -7
- package/lib/esm/BatchedTileTreeReference.js.map +1 -1
- package/lib/esm/BatchedTilesetReader.d.ts.map +1 -1
- package/lib/esm/BatchedTilesetReader.js +1 -3
- package/lib/esm/BatchedTilesetReader.js.map +1 -1
- package/lib/esm/FrontendTiles.js +1 -1
- package/lib/esm/FrontendTiles.js.map +1 -1
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -10
- package/src/BatchedSpatialTileTreeRefs.ts +15 -6
- package/src/BatchedTileTreeReference.ts +50 -8
- package/src/BatchedTilesetReader.ts +1 -3
- package/src/FrontendTiles.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/frontend-tiles",
|
|
3
|
-
"version": "4.0.0-dev.
|
|
3
|
+
"version": "4.0.0-dev.50",
|
|
4
4
|
"description": "Experimental alternative technique for visualizing the contents of iModels",
|
|
5
5
|
"main": "lib/cjs/frontend-tiles.js",
|
|
6
6
|
"module": "lib/esm/frontend-tiles.js",
|
|
@@ -22,17 +22,17 @@
|
|
|
22
22
|
"url": "http://www.bentley.com"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@itwin/core-bentley": "4.0.0-dev.
|
|
26
|
-
"@itwin/core-common": "4.0.0-dev.
|
|
27
|
-
"@itwin/core-frontend": "4.0.0-dev.
|
|
28
|
-
"@itwin/core-geometry": "4.0.0-dev.
|
|
25
|
+
"@itwin/core-bentley": "4.0.0-dev.50",
|
|
26
|
+
"@itwin/core-common": "4.0.0-dev.50",
|
|
27
|
+
"@itwin/core-frontend": "4.0.0-dev.50",
|
|
28
|
+
"@itwin/core-geometry": "4.0.0-dev.50"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@itwin/build-tools": "4.0.0-dev.
|
|
32
|
-
"@itwin/core-bentley": "4.0.0-dev.
|
|
33
|
-
"@itwin/core-common": "4.0.0-dev.
|
|
34
|
-
"@itwin/core-frontend": "4.0.0-dev.
|
|
35
|
-
"@itwin/core-geometry": "4.0.0-dev.
|
|
31
|
+
"@itwin/build-tools": "4.0.0-dev.50",
|
|
32
|
+
"@itwin/core-bentley": "4.0.0-dev.50",
|
|
33
|
+
"@itwin/core-common": "4.0.0-dev.50",
|
|
34
|
+
"@itwin/core-frontend": "4.0.0-dev.50",
|
|
35
|
+
"@itwin/core-geometry": "4.0.0-dev.50",
|
|
36
36
|
"@itwin/eslint-plugin": "nightly",
|
|
37
37
|
"@types/node": "^18.11.5",
|
|
38
38
|
"eslint": "^7.11.0",
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
|
-
IModelConnection, SpatialTileTreeReferences, TileTreeReference,
|
|
7
|
+
AttachToViewportArgs, IModelConnection, SpatialTileTreeReferences, SpatialViewState, TileTreeReference,
|
|
8
8
|
} from "@itwin/core-frontend";
|
|
9
|
-
import {
|
|
9
|
+
import { BatchedTileTreeReference } from "./BatchedTileTreeReference";
|
|
10
10
|
|
|
11
11
|
class TreeRefs implements SpatialTileTreeReferences {
|
|
12
|
-
private readonly _treeRef:
|
|
12
|
+
private readonly _treeRef: BatchedTileTreeReference;
|
|
13
13
|
|
|
14
|
-
public constructor(treeRef:
|
|
14
|
+
public constructor(treeRef: BatchedTileTreeReference) {
|
|
15
15
|
this._treeRef = treeRef;
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -20,6 +20,15 @@ class TreeRefs implements SpatialTileTreeReferences {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
public update(): void {
|
|
23
|
+
this._treeRef.updateViewedModels();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public attachToViewport(args: AttachToViewportArgs): void {
|
|
27
|
+
this._treeRef.attachToViewport(args);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public detachFromViewport(): void {
|
|
31
|
+
this._treeRef.detachFromViewport();
|
|
23
32
|
}
|
|
24
33
|
|
|
25
34
|
public setDeactivated(): void {
|
|
@@ -28,7 +37,7 @@ class TreeRefs implements SpatialTileTreeReferences {
|
|
|
28
37
|
}
|
|
29
38
|
|
|
30
39
|
/** @internal */
|
|
31
|
-
export function createBatchedSpatialTileTreeReferences(
|
|
32
|
-
const treeRef =
|
|
40
|
+
export function createBatchedSpatialTileTreeReferences(view: SpatialViewState, computeBaseUrl: (iModel: IModelConnection) => URL): SpatialTileTreeReferences {
|
|
41
|
+
const treeRef = BatchedTileTreeReference.create(view, computeBaseUrl(view.iModel));
|
|
33
42
|
return new TreeRefs(treeRef);
|
|
34
43
|
}
|
|
@@ -3,26 +3,68 @@
|
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
|
|
6
|
+
import { Id64 } from "@itwin/core-bentley";
|
|
7
|
+
import { BatchType, FeatureAppearance, FeatureAppearanceProvider, FeatureAppearanceSource, GeometryClass } from "@itwin/core-common";
|
|
6
8
|
import {
|
|
7
|
-
|
|
9
|
+
AttachToViewportArgs, SpatialViewState, TileTreeOwner, TileTreeReference,
|
|
8
10
|
} from "@itwin/core-frontend";
|
|
9
11
|
import { getBatchedTileTreeOwner } from "./BatchedTileTreeSupplier";
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
/** @internal */
|
|
14
|
+
export class BatchedTileTreeReference extends TileTreeReference implements FeatureAppearanceProvider {
|
|
12
15
|
private readonly _treeOwner: TileTreeOwner;
|
|
16
|
+
private readonly _view: SpatialViewState;
|
|
17
|
+
private readonly _viewedModels = new Id64.Uint32Set();
|
|
18
|
+
private _onModelSelectorChanged?: () => void;
|
|
13
19
|
|
|
14
|
-
|
|
20
|
+
private constructor(treeOwner: TileTreeOwner, view: SpatialViewState) {
|
|
15
21
|
super();
|
|
16
22
|
this._treeOwner = treeOwner;
|
|
23
|
+
this._view = view;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public static create(view: SpatialViewState, baseUrl: URL): BatchedTileTreeReference {
|
|
27
|
+
const owner = getBatchedTileTreeOwner(view.iModel, baseUrl);
|
|
28
|
+
return new BatchedTileTreeReference(owner, view);
|
|
17
29
|
}
|
|
18
30
|
|
|
19
31
|
public override get treeOwner(): TileTreeOwner {
|
|
20
32
|
return this._treeOwner;
|
|
21
33
|
}
|
|
22
|
-
}
|
|
23
34
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
35
|
+
public attachToViewport(args: AttachToViewportArgs): void {
|
|
36
|
+
this._onModelSelectorChanged = () => args.invalidateSymbologyOverrides();
|
|
37
|
+
this.updateViewedModels();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public detachFromViewport(): void {
|
|
41
|
+
this._onModelSelectorChanged = undefined;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public updateViewedModels(): void {
|
|
45
|
+
this._viewedModels.clear();
|
|
46
|
+
this._viewedModels.addIds(this._view.modelSelector.models);
|
|
47
|
+
if (this._onModelSelectorChanged)
|
|
48
|
+
this._onModelSelectorChanged();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public override getAppearanceProvider(): FeatureAppearanceProvider | undefined {
|
|
52
|
+
return this._onModelSelectorChanged ? this : undefined;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public getFeatureAppearance(
|
|
56
|
+
source: FeatureAppearanceSource,
|
|
57
|
+
elemLo: number, elemHi: number,
|
|
58
|
+
subcatLo: number, subcatHi: number,
|
|
59
|
+
geomClass: GeometryClass,
|
|
60
|
+
modelLo: number, modelHi: number,
|
|
61
|
+
type: BatchType,
|
|
62
|
+
animationNodeId: number
|
|
63
|
+
): FeatureAppearance | undefined {
|
|
64
|
+
// ###TODO: Until MultiModelPackedFeatureTable is hooked up we'll always get the transient model Id - remove check after that.
|
|
65
|
+
if (modelHi !== 0xffffff00 && !this._viewedModels.has(modelLo, modelHi))
|
|
66
|
+
return undefined;
|
|
67
|
+
|
|
68
|
+
return source.getAppearance(elemLo, elemHi, subcatLo, subcatHi, geomClass, modelLo, modelHi, type, animationNodeId);
|
|
69
|
+
}
|
|
28
70
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
|
-
|
|
7
|
+
Matrix3d, Point3d, Range3d, Transform, Vector3d,
|
|
8
8
|
} from "@itwin/core-geometry";
|
|
9
9
|
import { Tileset3dSchema as schema } from "@itwin/core-common";
|
|
10
10
|
import { IModelConnection, RealityModelTileUtils, TileLoadPriority } from "@itwin/core-frontend";
|
|
@@ -99,8 +99,6 @@ export class BatchedTilesetReader {
|
|
|
99
99
|
public async readTileTreeParams(): Promise<BatchedTileTreeParams> {
|
|
100
100
|
const root = this._tileset.root;
|
|
101
101
|
const location = root.transform ? transformFromJSON(root.transform) : Transform.createIdentity();
|
|
102
|
-
// y axis is up in glTF. we want z up.
|
|
103
|
-
location.multiplyTransformMatrix3d(Matrix3d.createRotationAroundVector(Vector3d.create(1, 0, 0), Angle.createRadians(Angle.piOver2Radians))!, location);
|
|
104
102
|
|
|
105
103
|
return {
|
|
106
104
|
id: "spatial-models",
|
package/src/FrontendTiles.ts
CHANGED
|
@@ -20,5 +20,5 @@ export interface FrontendTilesOptions {
|
|
|
20
20
|
* @alpha
|
|
21
21
|
*/
|
|
22
22
|
export function initializeFrontendTiles(options: FrontendTilesOptions): void {
|
|
23
|
-
SpatialTileTreeReferences.create = (view: SpatialViewState) => createBatchedSpatialTileTreeReferences(view
|
|
23
|
+
SpatialTileTreeReferences.create = (view: SpatialViewState) => createBatchedSpatialTileTreeReferences(view, options.computeSpatialTilesetBaseUrl);
|
|
24
24
|
}
|