@itwin/frontend-tiles 3.7.0-dev.6 → 3.7.0-dev.8
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/66eda89ae927be7163ab4886bb1a316597deda28.log +10 -0
- package/.rush/temp/operation/build_ci/state.json +1 -1
- package/lib/cjs/BatchedSpatialTileTreeRefs.d.ts +4 -3
- package/lib/cjs/BatchedSpatialTileTreeRefs.d.ts.map +1 -1
- package/lib/cjs/BatchedSpatialTileTreeRefs.js +133 -34
- package/lib/cjs/BatchedSpatialTileTreeRefs.js.map +1 -1
- package/lib/cjs/BatchedTile.d.ts +23 -23
- package/lib/cjs/BatchedTile.d.ts.map +1 -1
- package/lib/cjs/BatchedTile.js +251 -250
- package/lib/cjs/BatchedTile.js.map +1 -1
- package/lib/cjs/BatchedTileContentReader.d.ts +22 -22
- package/lib/cjs/BatchedTileContentReader.js +76 -76
- package/lib/cjs/BatchedTileContentReader.js.map +1 -1
- 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 +21 -17
- package/lib/cjs/BatchedTileTreeReference.d.ts.map +1 -1
- package/lib/cjs/BatchedTileTreeReference.js +73 -49
- package/lib/cjs/BatchedTileTreeReference.js.map +1 -1
- package/lib/cjs/BatchedTileTreeSupplier.d.ts +5 -5
- package/lib/cjs/BatchedTileTreeSupplier.js +38 -38
- package/lib/cjs/BatchedTileTreeSupplier.js.map +1 -1
- package/lib/cjs/BatchedTilesetReader.d.ts +13 -13
- package/lib/cjs/BatchedTilesetReader.js +88 -88
- package/lib/cjs/BatchedTilesetReader.js.map +1 -1
- package/lib/cjs/FrontendTiles.d.ts +32 -14
- package/lib/cjs/FrontendTiles.d.ts.map +1 -1
- package/lib/cjs/FrontendTiles.js +26 -16
- package/lib/cjs/FrontendTiles.js.map +1 -1
- package/lib/cjs/LoggerCategory.d.ts +2 -2
- package/lib/cjs/LoggerCategory.js +9 -9
- package/lib/cjs/LoggerCategory.js.map +1 -1
- package/lib/cjs/frontend-tiles.d.ts +1 -1
- package/lib/cjs/frontend-tiles.js +17 -17
- package/lib/cjs/frontend-tiles.js.map +1 -1
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/BatchedSpatialTileTreeRefs.d.ts +4 -3
- package/lib/esm/BatchedSpatialTileTreeRefs.d.ts.map +1 -1
- package/lib/esm/BatchedSpatialTileTreeRefs.js +129 -30
- package/lib/esm/BatchedSpatialTileTreeRefs.js.map +1 -1
- package/lib/esm/BatchedTile.d.ts +23 -23
- package/lib/esm/BatchedTile.d.ts.map +1 -1
- package/lib/esm/BatchedTile.js +247 -246
- package/lib/esm/BatchedTile.js.map +1 -1
- package/lib/esm/BatchedTileContentReader.d.ts +22 -22
- package/lib/esm/BatchedTileContentReader.js +72 -72
- package/lib/esm/BatchedTileContentReader.js.map +1 -1
- 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 +21 -17
- package/lib/esm/BatchedTileTreeReference.d.ts.map +1 -1
- package/lib/esm/BatchedTileTreeReference.js +69 -45
- package/lib/esm/BatchedTileTreeReference.js.map +1 -1
- package/lib/esm/BatchedTileTreeSupplier.d.ts +5 -5
- package/lib/esm/BatchedTileTreeSupplier.js +34 -34
- package/lib/esm/BatchedTileTreeSupplier.js.map +1 -1
- package/lib/esm/BatchedTilesetReader.d.ts +13 -13
- package/lib/esm/BatchedTilesetReader.js +84 -84
- package/lib/esm/BatchedTilesetReader.js.map +1 -1
- package/lib/esm/FrontendTiles.d.ts +32 -14
- package/lib/esm/FrontendTiles.d.ts.map +1 -1
- package/lib/esm/FrontendTiles.js +21 -12
- package/lib/esm/FrontendTiles.js.map +1 -1
- package/lib/esm/LoggerCategory.d.ts +2 -2
- package/lib/esm/LoggerCategory.js +6 -6
- package/lib/esm/LoggerCategory.js.map +1 -1
- package/lib/esm/frontend-tiles.d.ts +1 -1
- package/lib/esm/frontend-tiles.js +5 -5
- package/lib/esm/frontend-tiles.js.map +1 -1
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -11
- package/src/BatchedSpatialTileTreeRefs.ts +122 -5
- package/src/BatchedTile.ts +2 -1
- package/src/BatchedTileTreeReference.ts +36 -4
- package/src/FrontendTiles.ts +31 -3
- package/.rush/temp/package-deps_build_ci.json +0 -21
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { Id64String } from "@itwin/core-bentley";
|
|
2
|
-
import { Range3d } from "@itwin/core-geometry";
|
|
3
|
-
import { Feature } from "@itwin/core-common";
|
|
4
|
-
import { GltfMeshPrimitive, GltfReader, GltfReaderArgs, GltfReaderResult } from "@itwin/core-frontend";
|
|
5
|
-
interface BatchedTileReaderArgs extends GltfReaderArgs {
|
|
6
|
-
modelId: Id64String;
|
|
7
|
-
isLeaf: boolean;
|
|
8
|
-
range: Range3d;
|
|
9
|
-
}
|
|
10
|
-
/** Read batched tiles in 3d Tiles 1.1 format. Currently, we prefer to produce tiles in iMdl format, so this goes unused for now.
|
|
11
|
-
* @internal
|
|
12
|
-
*/
|
|
13
|
-
export declare class BatchedTileContentReader extends GltfReader {
|
|
14
|
-
private readonly _modelId;
|
|
15
|
-
private readonly _isLeaf;
|
|
16
|
-
private readonly _range;
|
|
17
|
-
constructor(args: BatchedTileReaderArgs);
|
|
18
|
-
read(): Promise<GltfReaderResult>;
|
|
19
|
-
private readFeatureTable;
|
|
20
|
-
protected readPrimitiveFeatures(primitive: GltfMeshPrimitive): Feature | number[] | undefined;
|
|
21
|
-
}
|
|
22
|
-
export {};
|
|
1
|
+
import { Id64String } from "@itwin/core-bentley";
|
|
2
|
+
import { Range3d } from "@itwin/core-geometry";
|
|
3
|
+
import { Feature } from "@itwin/core-common";
|
|
4
|
+
import { GltfMeshPrimitive, GltfReader, GltfReaderArgs, GltfReaderResult } from "@itwin/core-frontend";
|
|
5
|
+
interface BatchedTileReaderArgs extends GltfReaderArgs {
|
|
6
|
+
modelId: Id64String;
|
|
7
|
+
isLeaf: boolean;
|
|
8
|
+
range: Range3d;
|
|
9
|
+
}
|
|
10
|
+
/** Read batched tiles in 3d Tiles 1.1 format. Currently, we prefer to produce tiles in iMdl format, so this goes unused for now.
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare class BatchedTileContentReader extends GltfReader {
|
|
14
|
+
private readonly _modelId;
|
|
15
|
+
private readonly _isLeaf;
|
|
16
|
+
private readonly _range;
|
|
17
|
+
constructor(args: BatchedTileReaderArgs);
|
|
18
|
+
read(): Promise<GltfReaderResult>;
|
|
19
|
+
private readFeatureTable;
|
|
20
|
+
protected readPrimitiveFeatures(primitive: GltfMeshPrimitive): Feature | number[] | undefined;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
23
23
|
//# sourceMappingURL=BatchedTileContentReader.d.ts.map
|
|
@@ -1,73 +1,73 @@
|
|
|
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 { assert, Id64 } from "@itwin/core-bentley";
|
|
6
|
-
import { Feature, FeatureTable, TileReadStatus } from "@itwin/core-common";
|
|
7
|
-
import { GltfDataType, GltfReader, } from "@itwin/core-frontend";
|
|
8
|
-
/** Read batched tiles in 3d Tiles 1.1 format. Currently, we prefer to produce tiles in iMdl format, so this goes unused for now.
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
export class BatchedTileContentReader extends GltfReader {
|
|
12
|
-
constructor(args) {
|
|
13
|
-
super(args);
|
|
14
|
-
this._modelId = args.modelId;
|
|
15
|
-
this._isLeaf = args.isLeaf;
|
|
16
|
-
this._range = args.range;
|
|
17
|
-
}
|
|
18
|
-
async read() {
|
|
19
|
-
const featureTable = this.readFeatureTable();
|
|
20
|
-
await this.resolveResources();
|
|
21
|
-
if (this._isCanceled)
|
|
22
|
-
return { readStatus: TileReadStatus.Canceled, isLeaf: this._isLeaf };
|
|
23
|
-
return this.readGltfAndCreateGraphics(this._isLeaf, featureTable, this._range);
|
|
24
|
-
}
|
|
25
|
-
readFeatureTable() {
|
|
26
|
-
var _a, _b, _c, _d;
|
|
27
|
-
// ###TODO we're just assuming there's one property table with one u64 property containing element Ids.
|
|
28
|
-
const tables = (_b = (_a = this._glTF.extensions) === null || _a === void 0 ? void 0 : _a.EXT_structural_metadata) === null || _b === void 0 ? void 0 : _b.propertyTables;
|
|
29
|
-
const table = tables ? tables[0] : undefined;
|
|
30
|
-
const elementIdProperty = (table === null || table === void 0 ? void 0 : table.properties) ? table.properties.ElementId : undefined;
|
|
31
|
-
if (!elementIdProperty)
|
|
32
|
-
return undefined;
|
|
33
|
-
const bufferView = this._bufferViews[elementIdProperty.values];
|
|
34
|
-
if (!bufferView || undefined === bufferView.buffer)
|
|
35
|
-
return undefined;
|
|
36
|
-
const bufferData = (_c = this._buffers[bufferView.buffer]) === null || _c === void 0 ? void 0 : _c.resolvedBuffer;
|
|
37
|
-
if (!bufferData)
|
|
38
|
-
return undefined;
|
|
39
|
-
assert(undefined !== bufferView.byteLength); // required by spec; TypeScript interface is wrong.
|
|
40
|
-
const byteOffset = (_d = bufferView.byteOffset) !== null && _d !== void 0 ? _d : 0;
|
|
41
|
-
const bytes = bufferData.subarray(byteOffset, byteOffset + bufferView.byteLength);
|
|
42
|
-
// 2 u32s per element Id.
|
|
43
|
-
const elementIds = new Uint32Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 4);
|
|
44
|
-
const numFeatures = elementIds.length / 2;
|
|
45
|
-
const featureTable = new FeatureTable(numFeatures, this._modelId);
|
|
46
|
-
for (let i = 0; i < numFeatures; i++) {
|
|
47
|
-
const elementId = Id64.fromUint32Pair(elementIds[i * 2], elementIds[i * 2 + 1]);
|
|
48
|
-
featureTable.insertWithIndex(new Feature(elementId), i);
|
|
49
|
-
}
|
|
50
|
-
return featureTable;
|
|
51
|
-
}
|
|
52
|
-
readPrimitiveFeatures(primitive) {
|
|
53
|
-
var _a, _b;
|
|
54
|
-
const ext = (_a = primitive.extensions) === null || _a === void 0 ? void 0 : _a.EXT_mesh_features;
|
|
55
|
-
if (ext) {
|
|
56
|
-
// ###TODO making assumptions here.
|
|
57
|
-
const view = this.getBufferView(primitive.attributes, `_FEATURE_ID_${ext.featureIds[0].attribute}`);
|
|
58
|
-
// NB: 32-bit integers are not supported, but 8- and 16-bit integers will be converted to them.
|
|
59
|
-
// With more than 64k features in the tile we represent the Ids as floats instead.
|
|
60
|
-
const featureIds = (_b = view === null || view === void 0 ? void 0 : view.toBufferData(GltfDataType.Float)) !== null && _b !== void 0 ? _b : view === null || view === void 0 ? void 0 : view.toBufferData(GltfDataType.UInt32);
|
|
61
|
-
if (view && featureIds) {
|
|
62
|
-
const indices = [];
|
|
63
|
-
for (let i = 0; i < featureIds.count; i++) {
|
|
64
|
-
const featureId = featureIds.buffer[i * view.stride];
|
|
65
|
-
indices.push(featureId);
|
|
66
|
-
}
|
|
67
|
-
return indices;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return new Feature(this._modelId);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
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 { assert, Id64 } from "@itwin/core-bentley";
|
|
6
|
+
import { Feature, FeatureTable, TileReadStatus } from "@itwin/core-common";
|
|
7
|
+
import { GltfDataType, GltfReader, } from "@itwin/core-frontend";
|
|
8
|
+
/** Read batched tiles in 3d Tiles 1.1 format. Currently, we prefer to produce tiles in iMdl format, so this goes unused for now.
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export class BatchedTileContentReader extends GltfReader {
|
|
12
|
+
constructor(args) {
|
|
13
|
+
super(args);
|
|
14
|
+
this._modelId = args.modelId;
|
|
15
|
+
this._isLeaf = args.isLeaf;
|
|
16
|
+
this._range = args.range;
|
|
17
|
+
}
|
|
18
|
+
async read() {
|
|
19
|
+
const featureTable = this.readFeatureTable();
|
|
20
|
+
await this.resolveResources();
|
|
21
|
+
if (this._isCanceled)
|
|
22
|
+
return { readStatus: TileReadStatus.Canceled, isLeaf: this._isLeaf };
|
|
23
|
+
return this.readGltfAndCreateGraphics(this._isLeaf, featureTable, this._range);
|
|
24
|
+
}
|
|
25
|
+
readFeatureTable() {
|
|
26
|
+
var _a, _b, _c, _d;
|
|
27
|
+
// ###TODO we're just assuming there's one property table with one u64 property containing element Ids.
|
|
28
|
+
const tables = (_b = (_a = this._glTF.extensions) === null || _a === void 0 ? void 0 : _a.EXT_structural_metadata) === null || _b === void 0 ? void 0 : _b.propertyTables;
|
|
29
|
+
const table = tables ? tables[0] : undefined;
|
|
30
|
+
const elementIdProperty = (table === null || table === void 0 ? void 0 : table.properties) ? table.properties.ElementId : undefined;
|
|
31
|
+
if (!elementIdProperty)
|
|
32
|
+
return undefined;
|
|
33
|
+
const bufferView = this._bufferViews[elementIdProperty.values];
|
|
34
|
+
if (!bufferView || undefined === bufferView.buffer)
|
|
35
|
+
return undefined;
|
|
36
|
+
const bufferData = (_c = this._buffers[bufferView.buffer]) === null || _c === void 0 ? void 0 : _c.resolvedBuffer;
|
|
37
|
+
if (!bufferData)
|
|
38
|
+
return undefined;
|
|
39
|
+
assert(undefined !== bufferView.byteLength); // required by spec; TypeScript interface is wrong.
|
|
40
|
+
const byteOffset = (_d = bufferView.byteOffset) !== null && _d !== void 0 ? _d : 0;
|
|
41
|
+
const bytes = bufferData.subarray(byteOffset, byteOffset + bufferView.byteLength);
|
|
42
|
+
// 2 u32s per element Id.
|
|
43
|
+
const elementIds = new Uint32Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 4);
|
|
44
|
+
const numFeatures = elementIds.length / 2;
|
|
45
|
+
const featureTable = new FeatureTable(numFeatures, this._modelId);
|
|
46
|
+
for (let i = 0; i < numFeatures; i++) {
|
|
47
|
+
const elementId = Id64.fromUint32Pair(elementIds[i * 2], elementIds[i * 2 + 1]);
|
|
48
|
+
featureTable.insertWithIndex(new Feature(elementId), i);
|
|
49
|
+
}
|
|
50
|
+
return featureTable;
|
|
51
|
+
}
|
|
52
|
+
readPrimitiveFeatures(primitive) {
|
|
53
|
+
var _a, _b;
|
|
54
|
+
const ext = (_a = primitive.extensions) === null || _a === void 0 ? void 0 : _a.EXT_mesh_features;
|
|
55
|
+
if (ext) {
|
|
56
|
+
// ###TODO making assumptions here.
|
|
57
|
+
const view = this.getBufferView(primitive.attributes, `_FEATURE_ID_${ext.featureIds[0].attribute}`);
|
|
58
|
+
// NB: 32-bit integers are not supported, but 8- and 16-bit integers will be converted to them.
|
|
59
|
+
// With more than 64k features in the tile we represent the Ids as floats instead.
|
|
60
|
+
const featureIds = (_b = view === null || view === void 0 ? void 0 : view.toBufferData(GltfDataType.Float)) !== null && _b !== void 0 ? _b : view === null || view === void 0 ? void 0 : view.toBufferData(GltfDataType.UInt32);
|
|
61
|
+
if (view && featureIds) {
|
|
62
|
+
const indices = [];
|
|
63
|
+
for (let i = 0; i < featureIds.count; i++) {
|
|
64
|
+
const featureId = featureIds.buffer[i * view.stride];
|
|
65
|
+
indices.push(featureId);
|
|
66
|
+
}
|
|
67
|
+
return indices;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return new Feature(this._modelId);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
73
|
//# sourceMappingURL=BatchedTileContentReader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BatchedTileContentReader.js","sourceRoot":"","sources":["../../src/B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,eAAe,CAAC,IAAI,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;SACzD;QAED,OAAO,YAAY,CAAC;IACtB,CAAC;IAEkB,qBAAqB,CAAC,SAA4B;;QACnE,MAAM,GAAG,GAAG,MAAA,SAAS,CAAC,UAAU,0CAAE,iBAAiB,CAAC;QACpD,IAAI,GAAG,EAAE;YACP,mCAAmC;YACnC,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,UAAU,EAAE,eAAe,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;YACpG,+FAA+F;YAC/F,kFAAkF;YAClF,MAAM,UAAU,GAAG,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,YAAY,CAAC,YAAY,CAAC,KAAK,CAAC,mCAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,YAAY,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;YACrG,IAAI,IAAI,IAAI,UAAU,EAAE;gBACtB,MAAM,OAAO,GAAG,EAAE,CAAC;gBACnB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;oBACzC,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;oBACrD,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;iBACzB;gBAED,OAAO,OAAO,CAAC;aAChB;SACF;QAED,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"BatchedTileContentReader.js","sourceRoot":"","sources":["../../src/BatchedTileContentReader.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,MAAM,EAAE,IAAI,EAAc,M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AAC;IACtB,CAAC;IAEkB,qBAAqB,CAAC,SAA4B;;QACnE,MAAM,GAAG,GAAG,MAAA,SAAS,CAAC,UAAU,0CAAE,iBAAiB,CAAC;QACpD,IAAI,GAAG,EAAE;YACP,mCAAmC;YACnC,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,UAAU,EAAE,eAAe,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;YACpG,+FAA+F;YAC/F,kFAAkF;YAClF,MAAM,UAAU,GAAG,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,YAAY,CAAC,YAAY,CAAC,KAAK,CAAC,mCAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,YAAY,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;YACrG,IAAI,IAAI,IAAI,UAAU,EAAE;gBACtB,MAAM,OAAO,GAAG,EAAE,CAAC;gBACnB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;oBACzC,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;oBACrD,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;iBACzB;gBAED,OAAO,OAAO,CAAC;aAChB;SACF;QAED,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { assert, Id64, Id64String } from \"@itwin/core-bentley\";\nimport { Range3d } from \"@itwin/core-geometry\";\nimport { Feature, FeatureTable, TileReadStatus } from \"@itwin/core-common\";\nimport {\n GltfDataType, GltfMeshPrimitive, GltfReader, GltfReaderArgs, GltfReaderResult,\n} from \"@itwin/core-frontend\";\n\ninterface BatchedTileReaderArgs extends GltfReaderArgs {\n modelId: Id64String;\n isLeaf: boolean;\n range: Range3d;\n}\n\n/** Read batched tiles in 3d Tiles 1.1 format. Currently, we prefer to produce tiles in iMdl format, so this goes unused for now.\n * @internal\n */\nexport class BatchedTileContentReader extends GltfReader {\n private readonly _modelId: Id64String;\n private readonly _isLeaf: boolean;\n private readonly _range: Range3d;\n\n public constructor(args: BatchedTileReaderArgs) {\n super(args);\n this._modelId = args.modelId;\n this._isLeaf = args.isLeaf;\n this._range = args.range;\n }\n\n public override async read(): Promise<GltfReaderResult> {\n const featureTable = this.readFeatureTable();\n await this.resolveResources();\n if (this._isCanceled)\n return { readStatus: TileReadStatus.Canceled, isLeaf: this._isLeaf };\n\n return this.readGltfAndCreateGraphics(this._isLeaf, featureTable, this._range);\n }\n\n private readFeatureTable(): FeatureTable | undefined {\n // ###TODO we're just assuming there's one property table with one u64 property containing element Ids.\n const tables = this._glTF.extensions?.EXT_structural_metadata?.propertyTables;\n const table = tables ? tables[0] : undefined;\n const elementIdProperty = table?.properties ? table.properties.ElementId : undefined;\n if (!elementIdProperty)\n return undefined;\n\n const bufferView = this._bufferViews[elementIdProperty.values];\n if (!bufferView || undefined === bufferView.buffer)\n return undefined;\n\n const bufferData = this._buffers[bufferView.buffer]?.resolvedBuffer;\n if (!bufferData)\n return undefined;\n\n assert(undefined !== bufferView.byteLength); // required by spec; TypeScript interface is wrong.\n const byteOffset = bufferView.byteOffset ?? 0;\n const bytes = bufferData.subarray(byteOffset, byteOffset + bufferView.byteLength);\n\n // 2 u32s per element Id.\n const elementIds = new Uint32Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 4);\n const numFeatures = elementIds.length / 2;\n const featureTable = new FeatureTable(numFeatures, this._modelId);\n for (let i = 0; i < numFeatures; i++) {\n const elementId = Id64.fromUint32Pair(elementIds[i * 2], elementIds[i * 2 + 1]);\n featureTable.insertWithIndex(new Feature(elementId), i);\n }\n\n return featureTable;\n }\n\n protected override readPrimitiveFeatures(primitive: GltfMeshPrimitive): Feature | number[] | undefined {\n const ext = primitive.extensions?.EXT_mesh_features;\n if (ext) {\n // ###TODO making assumptions here.\n const view = this.getBufferView(primitive.attributes, `_FEATURE_ID_${ext.featureIds[0].attribute}`);\n // NB: 32-bit integers are not supported, but 8- and 16-bit integers will be converted to them.\n // With more than 64k features in the tile we represent the Ids as floats instead.\n const featureIds = view?.toBufferData(GltfDataType.Float) ?? view?.toBufferData(GltfDataType.UInt32);\n if (view && featureIds) {\n const indices = [];\n for (let i = 0; i < featureIds.count; i++) {\n const featureId = featureIds.buffer[i * view.stride];\n indices.push(featureId);\n }\n\n return indices;\n }\n }\n\n return new Feature(this._modelId);\n }\n}\n"]}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { ViewFlagOverrides } from "@itwin/core-common";
|
|
2
|
-
import { Tile, TileDrawArgs, TileTree, TileTreeParams } from "@itwin/core-frontend";
|
|
3
|
-
import { BatchedTile, BatchedTileParams } from "./BatchedTile";
|
|
4
|
-
import { BatchedTilesetReader } from "./BatchedTilesetReader";
|
|
5
|
-
/** @internal */
|
|
6
|
-
export interface BatchedTileTreeParams extends TileTreeParams {
|
|
7
|
-
rootTile: BatchedTileParams;
|
|
8
|
-
reader: BatchedTilesetReader;
|
|
9
|
-
}
|
|
10
|
-
/** @internal */
|
|
11
|
-
export declare class BatchedTileTree extends TileTree {
|
|
12
|
-
private readonly _rootTile;
|
|
13
|
-
readonly reader: BatchedTilesetReader;
|
|
14
|
-
constructor(params: BatchedTileTreeParams);
|
|
15
|
-
get rootTile(): BatchedTile;
|
|
16
|
-
get is3d(): boolean;
|
|
17
|
-
get maxDepth(): number | undefined;
|
|
18
|
-
get viewFlagOverrides(): ViewFlagOverrides;
|
|
19
|
-
_selectTiles(args: TileDrawArgs): Tile[];
|
|
20
|
-
draw(args: TileDrawArgs): void;
|
|
21
|
-
prune(): void;
|
|
22
|
-
}
|
|
1
|
+
import { ViewFlagOverrides } from "@itwin/core-common";
|
|
2
|
+
import { Tile, TileDrawArgs, TileTree, TileTreeParams } from "@itwin/core-frontend";
|
|
3
|
+
import { BatchedTile, BatchedTileParams } from "./BatchedTile";
|
|
4
|
+
import { BatchedTilesetReader } from "./BatchedTilesetReader";
|
|
5
|
+
/** @internal */
|
|
6
|
+
export interface BatchedTileTreeParams extends TileTreeParams {
|
|
7
|
+
rootTile: BatchedTileParams;
|
|
8
|
+
reader: BatchedTilesetReader;
|
|
9
|
+
}
|
|
10
|
+
/** @internal */
|
|
11
|
+
export declare class BatchedTileTree extends TileTree {
|
|
12
|
+
private readonly _rootTile;
|
|
13
|
+
readonly reader: BatchedTilesetReader;
|
|
14
|
+
constructor(params: BatchedTileTreeParams);
|
|
15
|
+
get rootTile(): BatchedTile;
|
|
16
|
+
get is3d(): boolean;
|
|
17
|
+
get maxDepth(): number | undefined;
|
|
18
|
+
get viewFlagOverrides(): ViewFlagOverrides;
|
|
19
|
+
_selectTiles(args: TileDrawArgs): Tile[];
|
|
20
|
+
draw(args: TileDrawArgs): void;
|
|
21
|
+
prune(): void;
|
|
22
|
+
}
|
|
23
23
|
//# sourceMappingURL=BatchedTileTree.d.ts.map
|
|
@@ -1,49 +1,49 @@
|
|
|
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 { BeTimePoint } from "@itwin/core-bentley";
|
|
6
|
-
import { RenderMode } from "@itwin/core-common";
|
|
7
|
-
import { TileTree, } from "@itwin/core-frontend";
|
|
8
|
-
import { BatchedTile } from "./BatchedTile";
|
|
9
|
-
const viewFlagOverrides = {
|
|
10
|
-
renderMode: RenderMode.SmoothShade,
|
|
11
|
-
visibleEdges: false,
|
|
12
|
-
};
|
|
13
|
-
/** @internal */
|
|
14
|
-
export class BatchedTileTree extends TileTree {
|
|
15
|
-
constructor(params) {
|
|
16
|
-
super(params);
|
|
17
|
-
this._rootTile = new BatchedTile(params.rootTile, this);
|
|
18
|
-
this.reader = params.reader;
|
|
19
|
-
}
|
|
20
|
-
get rootTile() {
|
|
21
|
-
return this._rootTile;
|
|
22
|
-
}
|
|
23
|
-
get is3d() {
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
get maxDepth() {
|
|
27
|
-
return undefined;
|
|
28
|
-
}
|
|
29
|
-
get viewFlagOverrides() {
|
|
30
|
-
return viewFlagOverrides;
|
|
31
|
-
}
|
|
32
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
33
|
-
_selectTiles(args) {
|
|
34
|
-
const selected = [];
|
|
35
|
-
this.rootTile.selectTiles(selected, args, 0);
|
|
36
|
-
return selected;
|
|
37
|
-
}
|
|
38
|
-
draw(args) {
|
|
39
|
-
const tiles = this.selectTiles(args);
|
|
40
|
-
for (const tile of tiles)
|
|
41
|
-
tile.drawGraphics(args);
|
|
42
|
-
args.drawGraphics();
|
|
43
|
-
}
|
|
44
|
-
prune() {
|
|
45
|
-
const olderThan = BeTimePoint.now().minus(this.expirationTime);
|
|
46
|
-
this.rootTile.prune(olderThan);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
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 { BeTimePoint } from "@itwin/core-bentley";
|
|
6
|
+
import { RenderMode } from "@itwin/core-common";
|
|
7
|
+
import { TileTree, } from "@itwin/core-frontend";
|
|
8
|
+
import { BatchedTile } from "./BatchedTile";
|
|
9
|
+
const viewFlagOverrides = {
|
|
10
|
+
renderMode: RenderMode.SmoothShade,
|
|
11
|
+
visibleEdges: false,
|
|
12
|
+
};
|
|
13
|
+
/** @internal */
|
|
14
|
+
export class BatchedTileTree extends TileTree {
|
|
15
|
+
constructor(params) {
|
|
16
|
+
super(params);
|
|
17
|
+
this._rootTile = new BatchedTile(params.rootTile, this);
|
|
18
|
+
this.reader = params.reader;
|
|
19
|
+
}
|
|
20
|
+
get rootTile() {
|
|
21
|
+
return this._rootTile;
|
|
22
|
+
}
|
|
23
|
+
get is3d() {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
get maxDepth() {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
get viewFlagOverrides() {
|
|
30
|
+
return viewFlagOverrides;
|
|
31
|
+
}
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
33
|
+
_selectTiles(args) {
|
|
34
|
+
const selected = [];
|
|
35
|
+
this.rootTile.selectTiles(selected, args, 0);
|
|
36
|
+
return selected;
|
|
37
|
+
}
|
|
38
|
+
draw(args) {
|
|
39
|
+
const tiles = this.selectTiles(args);
|
|
40
|
+
for (const tile of tiles)
|
|
41
|
+
tile.drawGraphics(args);
|
|
42
|
+
args.drawGraphics();
|
|
43
|
+
}
|
|
44
|
+
prune() {
|
|
45
|
+
const olderThan = BeTimePoint.now().minus(this.expirationTime);
|
|
46
|
+
this.rootTile.prune(olderThan);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
49
|
//# sourceMappingURL=BatchedTileTree.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BatchedTileTree.js","sourceRoot":"","sources":["../../src/BatchedTileTree.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAqB,MAAM,oBAAoB,CAAC;AACnE,OAAO,EACe,QAAQ,GAC7B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAqB,MAAM,eAAe,CAAC;AAS/D,MAAM,iBA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------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"BatchedTileTree.js","sourceRoot":"","sources":["../../src/BatchedTileTree.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAqB,MAAM,oBAAoB,CAAC;AACnE,OAAO,EACe,QAAQ,GAC7B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAqB,MAAM,eAAe,CAAC;AAS/D,MAAM,iBAAiB,GAAsB;IAC3C,UAAU,EAAE,UAAU,CAAC,WAAW;IAClC,YAAY,EAAE,KAAK;CACpB,CAAC;AAEF,gBAAgB;AAChB,MAAM,OAAO,eAAgB,SAAQ,QAAQ;IAI3C,YAAmB,MAA6B;QAC9C,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,SAAS,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACxD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9B,CAAC;IAED,IAAoB,QAAQ;QAC1B,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,IAAoB,IAAI;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAoB,QAAQ;QAC1B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAoB,iBAAiB;QACnC,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAED,gEAAgE;IAChD,YAAY,CAAC,IAAkB;QAC7C,MAAM,QAAQ,GAAkB,EAAE,CAAC;QACnC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAC7C,OAAO,QAAQ,CAAC;IAClB,CAAC;IAEe,IAAI,CAAC,IAAkB;QACrC,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACrC,KAAK,MAAM,IAAI,IAAI,KAAK;YACtB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QAE1B,IAAI,CAAC,YAAY,EAAE,CAAC;IACtB,CAAC;IAEe,KAAK;QACnB,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC/D,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { BeTimePoint } from \"@itwin/core-bentley\";\nimport { RenderMode, ViewFlagOverrides } from \"@itwin/core-common\";\nimport {\n Tile, TileDrawArgs, TileTree, TileTreeParams,\n} from \"@itwin/core-frontend\";\nimport { BatchedTile, BatchedTileParams } from \"./BatchedTile\";\nimport { BatchedTilesetReader } from \"./BatchedTilesetReader\";\n\n/** @internal */\nexport interface BatchedTileTreeParams extends TileTreeParams {\n rootTile: BatchedTileParams;\n reader: BatchedTilesetReader;\n}\n\nconst viewFlagOverrides: ViewFlagOverrides = {\n renderMode: RenderMode.SmoothShade,\n visibleEdges: false,\n};\n\n/** @internal */\nexport class BatchedTileTree extends TileTree {\n private readonly _rootTile: BatchedTile;\n public readonly reader: BatchedTilesetReader;\n\n public constructor(params: BatchedTileTreeParams) {\n super(params);\n this._rootTile = new BatchedTile(params.rootTile, this);\n this.reader = params.reader;\n }\n\n public override get rootTile(): BatchedTile {\n return this._rootTile;\n }\n\n public override get is3d(): boolean {\n return true;\n }\n\n public override get maxDepth(): number | undefined {\n return undefined;\n }\n\n public override get viewFlagOverrides(): ViewFlagOverrides {\n return viewFlagOverrides;\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n public override _selectTiles(args: TileDrawArgs): Tile[] {\n const selected: BatchedTile[] = [];\n this.rootTile.selectTiles(selected, args, 0);\n return selected;\n }\n\n public override draw(args: TileDrawArgs): void {\n const tiles = this.selectTiles(args);\n for (const tile of tiles)\n tile.drawGraphics(args);\n\n args.drawGraphics();\n }\n\n public override prune(): void {\n const olderThan = BeTimePoint.now().minus(this.expirationTime);\n this.rootTile.prune(olderThan);\n }\n}\n"]}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
private readonly
|
|
7
|
-
private readonly
|
|
8
|
-
private
|
|
9
|
-
private
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { Range3d } from "@itwin/core-geometry";
|
|
2
|
+
import { BatchType, FeatureAppearance, FeatureAppearanceProvider, FeatureAppearanceSource, GeometryClass } from "@itwin/core-common";
|
|
3
|
+
import { AttachToViewportArgs, SpatialViewState, TileTreeOwner, TileTreeReference } from "@itwin/core-frontend";
|
|
4
|
+
/** @internal */
|
|
5
|
+
export declare class BatchedTileTreeReference extends TileTreeReference implements FeatureAppearanceProvider {
|
|
6
|
+
private readonly _treeOwner;
|
|
7
|
+
private readonly _view;
|
|
8
|
+
private readonly _viewedModels;
|
|
9
|
+
private readonly _modelRanges;
|
|
10
|
+
private _modelRangePromise?;
|
|
11
|
+
private _onModelSelectorChanged?;
|
|
12
|
+
private constructor();
|
|
13
|
+
static create(view: SpatialViewState, baseUrl: URL): BatchedTileTreeReference;
|
|
14
|
+
get treeOwner(): TileTreeOwner;
|
|
15
|
+
attachToViewport(args: AttachToViewportArgs): void;
|
|
16
|
+
detachFromViewport(): void;
|
|
17
|
+
updateViewedModels(): void;
|
|
18
|
+
unionFitRange(union: Range3d): void;
|
|
19
|
+
getAppearanceProvider(): FeatureAppearanceProvider | undefined;
|
|
20
|
+
getFeatureAppearance(source: FeatureAppearanceSource, elemLo: number, elemHi: number, subcatLo: number, subcatHi: number, geomClass: GeometryClass, modelLo: number, modelHi: number, type: BatchType, animationNodeId: number): FeatureAppearance | undefined;
|
|
21
|
+
}
|
|
18
22
|
//# sourceMappingURL=BatchedTileTreeReference.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BatchedTileTreeReference.d.ts","sourceRoot":"","sources":["../../src/BatchedTileTreeReference.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"BatchedTileTreeReference.d.ts","sourceRoot":"","sources":["../../src/BatchedTileTreeReference.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EACL,SAAS,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,aAAa,EAChG,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,oBAAoB,EAAE,gBAAgB,EAAE,aAAa,EAAE,iBAAiB,EACzE,MAAM,sBAAsB,CAAC;AAG9B,gBAAgB;AAChB,qBAAa,wBAAyB,SAAQ,iBAAkB,YAAW,yBAAyB;IAClG,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAgB;IAC3C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmB;IACzC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAwB;IACtD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAkC;IAC/D,OAAO,CAAC,kBAAkB,CAAC,CAAgB;IAC3C,OAAO,CAAC,uBAAuB,CAAC,CAAa;IAE7C,OAAO;WAMO,MAAM,CAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,GAAG,GAAG,wBAAwB;IAKpF,IAAoB,SAAS,IAAI,aAAa,CAE7C;IAEM,gBAAgB,CAAC,IAAI,EAAE,oBAAoB,GAAG,IAAI;IAKlD,kBAAkB,IAAI,IAAI;IAI1B,kBAAkB,IAAI,IAAI;IAyBjB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IASnC,qBAAqB,IAAI,yBAAyB,GAAG,SAAS;IAIvE,oBAAoB,CACzB,MAAM,EAAE,uBAAuB,EAC/B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAC9B,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAClC,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAChC,IAAI,EAAE,SAAS,EACf,eAAe,EAAE,MAAM,GACtB,iBAAiB,GAAG,SAAS;CAOjC"}
|
|
@@ -1,46 +1,70 @@
|
|
|
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 { Id64 } from "@itwin/core-bentley";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
this.
|
|
14
|
-
this.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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 { Id64 } from "@itwin/core-bentley";
|
|
6
|
+
import { Range3d } from "@itwin/core-geometry";
|
|
7
|
+
import { TileTreeReference, } from "@itwin/core-frontend";
|
|
8
|
+
import { getBatchedTileTreeOwner } from "./BatchedTileTreeSupplier";
|
|
9
|
+
/** @internal */
|
|
10
|
+
export class BatchedTileTreeReference extends TileTreeReference {
|
|
11
|
+
constructor(treeOwner, view) {
|
|
12
|
+
super();
|
|
13
|
+
this._viewedModels = new Id64.Uint32Set();
|
|
14
|
+
this._modelRanges = new Map();
|
|
15
|
+
this._treeOwner = treeOwner;
|
|
16
|
+
this._view = view;
|
|
17
|
+
}
|
|
18
|
+
static create(view, baseUrl) {
|
|
19
|
+
const owner = getBatchedTileTreeOwner(view.iModel, baseUrl);
|
|
20
|
+
return new BatchedTileTreeReference(owner, view);
|
|
21
|
+
}
|
|
22
|
+
get treeOwner() {
|
|
23
|
+
return this._treeOwner;
|
|
24
|
+
}
|
|
25
|
+
attachToViewport(args) {
|
|
26
|
+
this._onModelSelectorChanged = () => args.invalidateSymbologyOverrides();
|
|
27
|
+
this.updateViewedModels();
|
|
28
|
+
}
|
|
29
|
+
detachFromViewport() {
|
|
30
|
+
this._onModelSelectorChanged = undefined;
|
|
31
|
+
}
|
|
32
|
+
updateViewedModels() {
|
|
33
|
+
this._viewedModels.clear();
|
|
34
|
+
this._viewedModels.addIds(this._view.modelSelector.models);
|
|
35
|
+
if (!this._onModelSelectorChanged) {
|
|
36
|
+
// Don't bother updating model ranges if we're not attached to a viewport.
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
this._onModelSelectorChanged();
|
|
40
|
+
this._modelRangePromise = undefined;
|
|
41
|
+
const modelIds = Array.from(this._view.modelSelector.models).filter((modelId) => !this._modelRanges.has(modelId));
|
|
42
|
+
if (modelIds.length === 0)
|
|
43
|
+
return;
|
|
44
|
+
const modelRangePromise = this._modelRangePromise = this._treeOwner.iModel.models.queryExtents(modelIds).then((extents) => {
|
|
45
|
+
if (modelRangePromise !== this._modelRangePromise)
|
|
46
|
+
return;
|
|
47
|
+
this._modelRangePromise = undefined;
|
|
48
|
+
for (const extent of extents)
|
|
49
|
+
this._modelRanges.set(extent.id, Range3d.fromJSON(extent.extents));
|
|
50
|
+
}).catch(() => { });
|
|
51
|
+
}
|
|
52
|
+
unionFitRange(union) {
|
|
53
|
+
this._viewedModels.forEach((low, high) => {
|
|
54
|
+
const id = Id64.fromUint32Pair(low, high);
|
|
55
|
+
const extent = this._modelRanges.get(id);
|
|
56
|
+
if (extent)
|
|
57
|
+
union.extendRange(extent);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
getAppearanceProvider() {
|
|
61
|
+
return this._onModelSelectorChanged ? this : undefined;
|
|
62
|
+
}
|
|
63
|
+
getFeatureAppearance(source, elemLo, elemHi, subcatLo, subcatHi, geomClass, modelLo, modelHi, type, animationNodeId) {
|
|
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
|
+
return source.getAppearance(elemLo, elemHi, subcatLo, subcatHi, geomClass, modelLo, modelHi, type, animationNodeId);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
46
70
|
//# sourceMappingURL=BatchedTileTreeReference.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BatchedTileTreeReference.js","sourceRoot":"","sources":["../../src/BatchedTileTreeReference.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"BatchedTileTreeReference.js","sourceRoot":"","sources":["../../src/BatchedTileTreeReference.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAA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AC9B,CAAC,CAAC,CAAC;IACL,CAAC;IAEe,qBAAqB;QACnC,OAAO,IAAI,CAAC,uBAAuB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IACzD,CAAC;IAEM,oBAAoB,CACzB,MAA+B,EAC/B,MAAc,EAAE,MAAc,EAC9B,QAAgB,EAAE,QAAgB,EAClC,SAAwB,EACxB,OAAe,EAAE,OAAe,EAChC,IAAe,EACf,eAAuB;QAEvB,8HAA8H;QAC9H,IAAI,OAAO,KAAK,UAAU,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC;YACrE,OAAO,SAAS,CAAC;QAEnB,OAAO,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC;IACtH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { Id64, Id64String } from \"@itwin/core-bentley\";\nimport { Range3d } from \"@itwin/core-geometry\";\nimport {\n BatchType, FeatureAppearance, FeatureAppearanceProvider, FeatureAppearanceSource, GeometryClass, ModelExtentsProps,\n} from \"@itwin/core-common\";\nimport {\n AttachToViewportArgs, SpatialViewState, TileTreeOwner, TileTreeReference,\n} from \"@itwin/core-frontend\";\nimport { getBatchedTileTreeOwner } from \"./BatchedTileTreeSupplier\";\n\n/** @internal */\nexport class BatchedTileTreeReference extends TileTreeReference implements FeatureAppearanceProvider {\n private readonly _treeOwner: TileTreeOwner;\n private readonly _view: SpatialViewState;\n private readonly _viewedModels = new Id64.Uint32Set();\n private readonly _modelRanges = new Map<Id64String, Range3d>();\n private _modelRangePromise?: Promise<void>;\n private _onModelSelectorChanged?: () => void;\n\n private constructor(treeOwner: TileTreeOwner, view: SpatialViewState) {\n super();\n this._treeOwner = treeOwner;\n this._view = view;\n }\n\n public static create(view: SpatialViewState, baseUrl: URL): BatchedTileTreeReference {\n const owner = getBatchedTileTreeOwner(view.iModel, baseUrl);\n return new BatchedTileTreeReference(owner, view);\n }\n\n public override get treeOwner(): TileTreeOwner {\n return this._treeOwner;\n }\n\n public attachToViewport(args: AttachToViewportArgs): void {\n this._onModelSelectorChanged = () => args.invalidateSymbologyOverrides();\n this.updateViewedModels();\n }\n\n public detachFromViewport(): void {\n this._onModelSelectorChanged = undefined;\n }\n\n public updateViewedModels(): void {\n this._viewedModels.clear();\n this._viewedModels.addIds(this._view.modelSelector.models);\n if (!this._onModelSelectorChanged) {\n // Don't bother updating model ranges if we're not attached to a viewport.\n return;\n }\n\n this._onModelSelectorChanged();\n\n this._modelRangePromise = undefined;\n const modelIds = Array.from(this._view.modelSelector.models).filter((modelId) => !this._modelRanges.has(modelId));\n if (modelIds.length === 0)\n return;\n\n const modelRangePromise = this._modelRangePromise = this._treeOwner.iModel.models.queryExtents(modelIds).then((extents: ModelExtentsProps[]) => {\n if (modelRangePromise !== this._modelRangePromise)\n return;\n\n this._modelRangePromise = undefined;\n for (const extent of extents)\n this._modelRanges.set(extent.id, Range3d.fromJSON(extent.extents));\n }).catch(() => { });\n }\n\n public override unionFitRange(union: Range3d): void {\n this._viewedModels.forEach((low: number, high: number) => {\n const id = Id64.fromUint32Pair(low, high);\n const extent = this._modelRanges.get(id);\n if (extent)\n union.extendRange(extent);\n });\n }\n\n public override getAppearanceProvider(): FeatureAppearanceProvider | undefined {\n return this._onModelSelectorChanged ? this : undefined;\n }\n\n public getFeatureAppearance(\n source: FeatureAppearanceSource,\n elemLo: number, elemHi: number,\n subcatLo: number, subcatHi: number,\n geomClass: GeometryClass,\n modelLo: number, modelHi: number,\n type: BatchType,\n animationNodeId: number\n ): FeatureAppearance | undefined {\n // ###TODO: Until MultiModelPackedFeatureTable is hooked up we'll always get the transient model Id - remove check after that.\n if (modelHi !== 0xffffff00 && !this._viewedModels.has(modelLo, modelHi))\n return undefined;\n\n return source.getAppearance(elemLo, elemHi, subcatLo, subcatHi, geomClass, modelLo, modelHi, type, animationNodeId);\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IModelConnection, TileTreeOwner } from "@itwin/core-frontend";
|
|
2
|
-
/** @internal */
|
|
3
|
-
export declare type TreeId = URL;
|
|
4
|
-
/** @internal */
|
|
5
|
-
export declare function getBatchedTileTreeOwner(iModel: IModelConnection, baseUrl: URL): TileTreeOwner;
|
|
1
|
+
import { IModelConnection, TileTreeOwner } from "@itwin/core-frontend";
|
|
2
|
+
/** @internal */
|
|
3
|
+
export declare type TreeId = URL;
|
|
4
|
+
/** @internal */
|
|
5
|
+
export declare function getBatchedTileTreeOwner(iModel: IModelConnection, baseUrl: URL): TileTreeOwner;
|
|
6
6
|
//# sourceMappingURL=BatchedTileTreeSupplier.d.ts.map
|