@itwin/core-frontend 4.4.0-dev.8 → 4.5.0-dev.0
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/CHANGELOG.md +8 -1
- package/lib/cjs/DisplayStyleState.d.ts +3 -0
- package/lib/cjs/DisplayStyleState.d.ts.map +1 -1
- package/lib/cjs/DisplayStyleState.js +10 -0
- package/lib/cjs/DisplayStyleState.js.map +1 -1
- package/lib/cjs/Viewport.d.ts +5 -0
- package/lib/cjs/Viewport.d.ts.map +1 -1
- package/lib/cjs/Viewport.js +6 -0
- package/lib/cjs/Viewport.js.map +1 -1
- package/lib/cjs/common/gltf/GltfSchema.d.ts +20 -3
- package/lib/cjs/common/gltf/GltfSchema.d.ts.map +1 -1
- package/lib/cjs/common/gltf/GltfSchema.js.map +1 -1
- package/lib/cjs/common/imdl/ImdlModel.d.ts +15 -1
- package/lib/cjs/common/imdl/ImdlModel.d.ts.map +1 -1
- package/lib/cjs/common/imdl/ImdlModel.js +11 -3
- package/lib/cjs/common/imdl/ImdlModel.js.map +1 -1
- package/lib/cjs/common/imdl/ParseImdlDocument.d.ts +3 -1
- package/lib/cjs/common/imdl/ParseImdlDocument.d.ts.map +1 -1
- package/lib/cjs/common/imdl/ParseImdlDocument.js +66 -11
- package/lib/cjs/common/imdl/ParseImdlDocument.js.map +1 -1
- package/lib/cjs/render/GraphicBranch.d.ts +10 -0
- package/lib/cjs/render/GraphicBranch.d.ts.map +1 -1
- package/lib/cjs/render/GraphicBranch.js.map +1 -1
- package/lib/cjs/render/webgl/BranchState.d.ts +2 -0
- package/lib/cjs/render/webgl/BranchState.d.ts.map +1 -1
- package/lib/cjs/render/webgl/BranchState.js +2 -0
- package/lib/cjs/render/webgl/BranchState.js.map +1 -1
- package/lib/cjs/render/webgl/Graphic.d.ts.map +1 -1
- package/lib/cjs/render/webgl/Graphic.js +3 -0
- package/lib/cjs/render/webgl/Graphic.js.map +1 -1
- package/lib/cjs/render/webgl/InstancedGeometry.d.ts +1 -0
- package/lib/cjs/render/webgl/InstancedGeometry.d.ts.map +1 -1
- package/lib/cjs/render/webgl/InstancedGeometry.js +1 -0
- package/lib/cjs/render/webgl/InstancedGeometry.js.map +1 -1
- package/lib/cjs/request/utils.d.ts +18 -0
- package/lib/cjs/request/utils.d.ts.map +1 -0
- package/lib/cjs/request/utils.js +45 -0
- package/lib/cjs/request/utils.js.map +1 -0
- package/lib/cjs/tile/BatchedTileIdMap.d.ts +1 -2
- package/lib/cjs/tile/BatchedTileIdMap.d.ts.map +1 -1
- package/lib/cjs/tile/BatchedTileIdMap.js +3 -3
- package/lib/cjs/tile/BatchedTileIdMap.js.map +1 -1
- package/lib/cjs/tile/GltfReader.d.ts +4 -1
- package/lib/cjs/tile/GltfReader.d.ts.map +1 -1
- package/lib/cjs/tile/GltfReader.js +125 -26
- package/lib/cjs/tile/GltfReader.js.map +1 -1
- package/lib/cjs/tile/ImdlDecoder.d.ts +7 -1
- package/lib/cjs/tile/ImdlDecoder.d.ts.map +1 -1
- package/lib/cjs/tile/ImdlDecoder.js.map +1 -1
- package/lib/cjs/tile/ImdlGraphicsCreator.d.ts.map +1 -1
- package/lib/cjs/tile/ImdlGraphicsCreator.js +28 -17
- package/lib/cjs/tile/ImdlGraphicsCreator.js.map +1 -1
- package/lib/cjs/tile/ImdlReader.d.ts +2 -1
- package/lib/cjs/tile/ImdlReader.d.ts.map +1 -1
- package/lib/cjs/tile/ImdlReader.js +1 -0
- package/lib/cjs/tile/ImdlReader.js.map +1 -1
- package/lib/cjs/tile/RealityModelTileTree.d.ts.map +1 -1
- package/lib/cjs/tile/RealityModelTileTree.js +2 -3
- package/lib/cjs/tile/RealityModelTileTree.js.map +1 -1
- package/lib/cjs/tile/RealityTileTree.d.ts +31 -0
- package/lib/cjs/tile/RealityTileTree.d.ts.map +1 -1
- package/lib/cjs/tile/RealityTileTree.js +6 -0
- package/lib/cjs/tile/RealityTileTree.js.map +1 -1
- package/lib/cjs/tile/TileDrawArgs.d.ts +6 -0
- package/lib/cjs/tile/TileDrawArgs.d.ts.map +1 -1
- package/lib/cjs/tile/TileDrawArgs.js +7 -0
- package/lib/cjs/tile/TileDrawArgs.js.map +1 -1
- package/lib/cjs/tile/TileTreeReference.d.ts +2 -0
- package/lib/cjs/tile/TileTreeReference.d.ts.map +1 -1
- package/lib/cjs/tile/TileTreeReference.js +5 -0
- package/lib/cjs/tile/TileTreeReference.js.map +1 -1
- package/lib/cjs/tile/map/ArcGISTileMap.d.ts +6 -2
- package/lib/cjs/tile/map/ArcGISTileMap.d.ts.map +1 -1
- package/lib/cjs/tile/map/ArcGISTileMap.js +127 -69
- package/lib/cjs/tile/map/ArcGISTileMap.js.map +1 -1
- package/lib/cjs/tile/map/ArcGisUtilities.d.ts.map +1 -1
- package/lib/cjs/tile/map/ArcGisUtilities.js +5 -0
- package/lib/cjs/tile/map/ArcGisUtilities.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISImageryProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISImageryProvider.js +61 -39
- package/lib/cjs/tile/map/ImageryProviders/ArcGISImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerImageryProvider.d.ts +6 -0
- package/lib/cjs/tile/map/MapLayerImageryProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/MapLayerImageryProvider.js +47 -7
- package/lib/cjs/tile/map/MapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/WmsCapabilities.d.ts.map +1 -1
- package/lib/cjs/tile/map/WmsCapabilities.js +1 -15
- package/lib/cjs/tile/map/WmsCapabilities.js.map +1 -1
- package/lib/cjs/tile/map/WmsUtilities.d.ts +7 -0
- package/lib/cjs/tile/map/WmsUtilities.d.ts.map +1 -1
- package/lib/cjs/tile/map/WmsUtilities.js +22 -0
- package/lib/cjs/tile/map/WmsUtilities.js.map +1 -1
- package/lib/cjs/tile/map/WmtsCapabilities.d.ts.map +1 -1
- package/lib/cjs/tile/map/WmtsCapabilities.js +2 -16
- package/lib/cjs/tile/map/WmtsCapabilities.js.map +1 -1
- package/lib/cjs/tools/SelectTool.d.ts +1 -0
- package/lib/cjs/tools/SelectTool.d.ts.map +1 -1
- package/lib/cjs/tools/SelectTool.js +19 -13
- package/lib/cjs/tools/SelectTool.js.map +1 -1
- package/lib/esm/DisplayStyleState.d.ts +3 -0
- package/lib/esm/DisplayStyleState.d.ts.map +1 -1
- package/lib/esm/DisplayStyleState.js +10 -0
- package/lib/esm/DisplayStyleState.js.map +1 -1
- package/lib/esm/Viewport.d.ts +5 -0
- package/lib/esm/Viewport.d.ts.map +1 -1
- package/lib/esm/Viewport.js +6 -0
- package/lib/esm/Viewport.js.map +1 -1
- package/lib/esm/common/gltf/GltfSchema.d.ts +20 -3
- package/lib/esm/common/gltf/GltfSchema.d.ts.map +1 -1
- package/lib/esm/common/gltf/GltfSchema.js.map +1 -1
- package/lib/esm/common/imdl/ImdlModel.d.ts +15 -1
- package/lib/esm/common/imdl/ImdlModel.d.ts.map +1 -1
- package/lib/esm/common/imdl/ImdlModel.js +11 -3
- package/lib/esm/common/imdl/ImdlModel.js.map +1 -1
- package/lib/esm/common/imdl/ParseImdlDocument.d.ts +3 -1
- package/lib/esm/common/imdl/ParseImdlDocument.d.ts.map +1 -1
- package/lib/esm/common/imdl/ParseImdlDocument.js +67 -12
- package/lib/esm/common/imdl/ParseImdlDocument.js.map +1 -1
- package/lib/esm/render/GraphicBranch.d.ts +10 -0
- package/lib/esm/render/GraphicBranch.d.ts.map +1 -1
- package/lib/esm/render/GraphicBranch.js.map +1 -1
- package/lib/esm/render/webgl/BranchState.d.ts +2 -0
- package/lib/esm/render/webgl/BranchState.d.ts.map +1 -1
- package/lib/esm/render/webgl/BranchState.js +2 -0
- package/lib/esm/render/webgl/BranchState.js.map +1 -1
- package/lib/esm/render/webgl/Graphic.d.ts.map +1 -1
- package/lib/esm/render/webgl/Graphic.js +3 -0
- package/lib/esm/render/webgl/Graphic.js.map +1 -1
- package/lib/esm/render/webgl/InstancedGeometry.d.ts +1 -0
- package/lib/esm/render/webgl/InstancedGeometry.d.ts.map +1 -1
- package/lib/esm/render/webgl/InstancedGeometry.js +1 -0
- package/lib/esm/render/webgl/InstancedGeometry.js.map +1 -1
- package/lib/esm/request/utils.d.ts +18 -0
- package/lib/esm/request/utils.d.ts.map +1 -0
- package/lib/esm/request/utils.js +40 -0
- package/lib/esm/request/utils.js.map +1 -0
- package/lib/esm/tile/BatchedTileIdMap.d.ts +1 -2
- package/lib/esm/tile/BatchedTileIdMap.d.ts.map +1 -1
- package/lib/esm/tile/BatchedTileIdMap.js +3 -3
- package/lib/esm/tile/BatchedTileIdMap.js.map +1 -1
- package/lib/esm/tile/GltfReader.d.ts +4 -1
- package/lib/esm/tile/GltfReader.d.ts.map +1 -1
- package/lib/esm/tile/GltfReader.js +126 -27
- package/lib/esm/tile/GltfReader.js.map +1 -1
- package/lib/esm/tile/ImdlDecoder.d.ts +7 -1
- package/lib/esm/tile/ImdlDecoder.d.ts.map +1 -1
- package/lib/esm/tile/ImdlDecoder.js.map +1 -1
- package/lib/esm/tile/ImdlGraphicsCreator.d.ts.map +1 -1
- package/lib/esm/tile/ImdlGraphicsCreator.js +28 -17
- package/lib/esm/tile/ImdlGraphicsCreator.js.map +1 -1
- package/lib/esm/tile/ImdlReader.d.ts +2 -1
- package/lib/esm/tile/ImdlReader.d.ts.map +1 -1
- package/lib/esm/tile/ImdlReader.js +1 -0
- package/lib/esm/tile/ImdlReader.js.map +1 -1
- package/lib/esm/tile/RealityModelTileTree.d.ts.map +1 -1
- package/lib/esm/tile/RealityModelTileTree.js +2 -3
- package/lib/esm/tile/RealityModelTileTree.js.map +1 -1
- package/lib/esm/tile/RealityTileTree.d.ts +31 -0
- package/lib/esm/tile/RealityTileTree.d.ts.map +1 -1
- package/lib/esm/tile/RealityTileTree.js +6 -0
- package/lib/esm/tile/RealityTileTree.js.map +1 -1
- package/lib/esm/tile/TileDrawArgs.d.ts +6 -0
- package/lib/esm/tile/TileDrawArgs.d.ts.map +1 -1
- package/lib/esm/tile/TileDrawArgs.js +8 -1
- package/lib/esm/tile/TileDrawArgs.js.map +1 -1
- package/lib/esm/tile/TileTreeReference.d.ts +2 -0
- package/lib/esm/tile/TileTreeReference.d.ts.map +1 -1
- package/lib/esm/tile/TileTreeReference.js +5 -0
- package/lib/esm/tile/TileTreeReference.js.map +1 -1
- package/lib/esm/tile/map/ArcGISTileMap.d.ts +6 -2
- package/lib/esm/tile/map/ArcGISTileMap.d.ts.map +1 -1
- package/lib/esm/tile/map/ArcGISTileMap.js +130 -71
- package/lib/esm/tile/map/ArcGISTileMap.js.map +1 -1
- package/lib/esm/tile/map/ArcGisUtilities.d.ts.map +1 -1
- package/lib/esm/tile/map/ArcGisUtilities.js +5 -0
- package/lib/esm/tile/map/ArcGisUtilities.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISImageryProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISImageryProvider.js +61 -39
- package/lib/esm/tile/map/ImageryProviders/ArcGISImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/MapLayerImageryProvider.d.ts +6 -0
- package/lib/esm/tile/map/MapLayerImageryProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/MapLayerImageryProvider.js +48 -8
- package/lib/esm/tile/map/MapLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/WmsCapabilities.d.ts.map +1 -1
- package/lib/esm/tile/map/WmsCapabilities.js +1 -15
- package/lib/esm/tile/map/WmsCapabilities.js.map +1 -1
- package/lib/esm/tile/map/WmsUtilities.d.ts +7 -0
- package/lib/esm/tile/map/WmsUtilities.d.ts.map +1 -1
- package/lib/esm/tile/map/WmsUtilities.js +22 -0
- package/lib/esm/tile/map/WmsUtilities.js.map +1 -1
- package/lib/esm/tile/map/WmtsCapabilities.d.ts.map +1 -1
- package/lib/esm/tile/map/WmtsCapabilities.js +2 -16
- package/lib/esm/tile/map/WmtsCapabilities.js.map +1 -1
- package/lib/esm/tools/SelectTool.d.ts +1 -0
- package/lib/esm/tools/SelectTool.d.ts.map +1 -1
- package/lib/esm/tools/SelectTool.js +19 -13
- package/lib/esm/tools/SelectTool.js.map +1 -1
- package/lib/public/scripts/parse-imdl-worker.js +1 -1
- package/lib/workers/webpack/parse-imdl-worker.js +1 -1
- package/package.json +20 -19
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module Tiles
|
|
3
3
|
*/
|
|
4
|
-
import type { ByteStream, Id64String } from "@itwin/core-bentley";
|
|
4
|
+
import type { ByteStream, Id64Set, Id64String } from "@itwin/core-bentley";
|
|
5
5
|
import { BatchType } from "@itwin/core-common";
|
|
6
6
|
import type { IModelConnection } from "../IModelConnection";
|
|
7
7
|
import { BatchOptions } from "../render/GraphicBuilder";
|
|
@@ -12,12 +12,18 @@ import { ImdlReaderResult } from "./internal";
|
|
|
12
12
|
* @internal
|
|
13
13
|
*/
|
|
14
14
|
export interface ImdlDecodeArgs {
|
|
15
|
+
/** The encoded tile content. */
|
|
15
16
|
stream: ByteStream;
|
|
17
|
+
/** The render system used to create graphics from the tile content. */
|
|
16
18
|
system: RenderSystem;
|
|
17
19
|
isLeaf?: boolean;
|
|
18
20
|
sizeMultiplier?: number;
|
|
19
21
|
options?: BatchOptions | false;
|
|
20
22
|
isCanceled?: () => boolean;
|
|
23
|
+
/** An array of model groups. If supplied, the graphics associated with each group of models will be decoded into a separate GraphciBranch
|
|
24
|
+
* with [[GraphicBranch.groupNodeId]] set to the index of the group to which the model belongs.
|
|
25
|
+
*/
|
|
26
|
+
modelGroups?: Id64Set[];
|
|
21
27
|
}
|
|
22
28
|
/** An object that can decode graphics in iMdl format.
|
|
23
29
|
* @note decoders are reference-counted. When you are finished using one, call [[release]].
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImdlDecoder.d.ts","sourceRoot":"","sources":["../../../src/tile/ImdlDecoder.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"ImdlDecoder.d.ts","sourceRoot":"","sources":["../../../src/tile/ImdlDecoder.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAqB,gBAAgB,EAAmB,MAAM,YAAY,CAAC;AAElF;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,gCAAgC;IAChC,MAAM,EAAE,UAAU,CAAC;IACnB,uEAAuE;IACvE,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,YAAY,GAAG,KAAK,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC;IAC3B;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC;CACzB;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACxD,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,gBAAgB,CAAC;IACzB,YAAY,EAAE,UAAU,CAAC;IACzB,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,sBAAsB,GAAG,WAAW,CAc5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImdlDecoder.js","sourceRoot":"","sources":["../../../src/tile/ImdlDecoder.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAQH,OAAO,EAAE,iBAAiB,EAAoB,eAAe,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"ImdlDecoder.js","sourceRoot":"","sources":["../../../src/tile/ImdlDecoder.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAQH,OAAO,EAAE,iBAAiB,EAAoB,eAAe,EAAE,MAAM,YAAY,CAAC;AA4ClF;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAA4B;IAC7D,MAAM,MAAM,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO;QACL,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE;QAC/B,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE;YAC3B,OAAO,eAAe,CAAC;gBACrB,GAAG,IAAI;gBACP,GAAG,UAAU;gBACb,OAAO,EAAE,IAAI,CAAC,YAAY;gBAC1B,SAAS,EAAE,CAAC,IAAI,CAAC,SAAS;gBAC1B,aAAa,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC;aAC9D,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC","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/** @packageDocumentation\n * @module Tiles\n */\n\nimport type { ByteStream, Id64Set, Id64String } from \"@itwin/core-bentley\";\nimport { BatchType } from \"@itwin/core-common\";\nimport type { IModelConnection } from \"../IModelConnection\";\nimport { BatchOptions } from \"../render/GraphicBuilder\";\nimport { RenderSystem } from \"../render/RenderSystem\";\nimport type { ImdlTimeline } from \"../common/imdl/ParseImdlDocument\";\nimport { acquireImdlParser, ImdlReaderResult, readImdlContent } from \"./internal\";\n\n/** Arguments supplied to [[ImdlDecoder.decode]].\n * @internal\n */\nexport interface ImdlDecodeArgs {\n /** The encoded tile content. */\n stream: ByteStream;\n /** The render system used to create graphics from the tile content. */\n system: RenderSystem;\n isLeaf?: boolean;\n sizeMultiplier?: number;\n options?: BatchOptions | false;\n isCanceled?: () => boolean;\n /** An array of model groups. If supplied, the graphics associated with each group of models will be decoded into a separate GraphciBranch\n * with [[GraphicBranch.groupNodeId]] set to the index of the group to which the model belongs.\n */\n modelGroups?: Id64Set[];\n}\n\n/** An object that can decode graphics in iMdl format.\n * @note decoders are reference-counted. When you are finished using one, call [[release]].\n * @see [[acquireImdlDecoder]] to acquire a decoder.\n * @internal\n */\nexport interface ImdlDecoder {\n decode(args: ImdlDecodeArgs): Promise<ImdlReaderResult>;\n release(): void;\n}\n\n/** Arguments supplied to [[acquireImdlDecoder]].\n * @internal\n */\nexport interface AcquireImdlDecoderArgs {\n iModel: IModelConnection;\n batchModelId: Id64String;\n is3d: boolean;\n type?: BatchType;\n omitEdges?: boolean;\n containsTransformNodes?: boolean;\n timeline?: ImdlTimeline;\n noWorker?: boolean;\n}\n\n/** Acquire shared ownership of an [[ImdlDecoder]].\n * Decoders are reference-counted, because they make use of reference-counted [[ImdlParser]]s internally.\n * The caller of this function increments the reference count of the decoder and is responsible\n * for decrementing it by calling [[ImdlDecoder.release]] when it is no longer needed. Typically, a decoder's lifetime is tied to the\n * lifetime of some [IDisposable]($bentley) object like a [[TileTree]] - acquired in the constructor, and released in the `dispose` method.\n * @internal\n */\nexport function acquireImdlDecoder(args: AcquireImdlDecoderArgs): ImdlDecoder {\n const parser = acquireImdlParser(args);\n return {\n release: () => parser.release(),\n decode: async (decodeArgs) => {\n return readImdlContent({\n ...args,\n ...decodeArgs,\n modelId: args.batchModelId,\n loadEdges: !args.omitEdges,\n parseDocument: async (parserOpts) => parser.parse(parserOpts),\n });\n },\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImdlGraphicsCreator.d.ts","sourceRoot":"","sources":["../../../src/tile/ImdlGraphicsCreator.ts"],"names":[],"mappings":"AAIA;;GAEG;AASH,OAAO,EAAE,SAAS,IAAI,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAI7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC;IACxB,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,gBAAgB,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC;CAC5B;
|
|
1
|
+
{"version":3,"file":"ImdlGraphicsCreator.d.ts","sourceRoot":"","sources":["../../../src/tile/ImdlGraphicsCreator.ts"],"names":[],"mappings":"AAIA;;GAEG;AASH,OAAO,EAAE,SAAS,IAAI,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAI7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC;IACxB,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,gBAAgB,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC;CAC5B;AAoWD,gBAAgB;AAChB,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAsBvG"}
|
|
@@ -277,12 +277,39 @@ function createPatternGraphic(params, options) {
|
|
|
277
277
|
return branch.isEmpty ? undefined : options.system.createGraphicBranch(branch, Transform.createIdentity(), { clipVolume });
|
|
278
278
|
}
|
|
279
279
|
function createNodeGraphics(node, options) {
|
|
280
|
+
if (undefined === node.groupId)
|
|
281
|
+
return createPrimitivesNodeGraphics(node, options);
|
|
280
282
|
const graphics = [];
|
|
283
|
+
for (const child of node.nodes) {
|
|
284
|
+
graphics.push(...createPrimitivesNodeGraphics(child, options));
|
|
285
|
+
}
|
|
286
|
+
if (graphics.length === 0)
|
|
287
|
+
return graphics;
|
|
288
|
+
const branch = new GraphicBranch(true);
|
|
289
|
+
branch.groupNodeId = node.groupId;
|
|
290
|
+
branch.entries.push(...graphics);
|
|
291
|
+
return [options.system.createBranch(branch, Transform.createIdentity())];
|
|
292
|
+
}
|
|
293
|
+
function createPrimitivesNodeGraphics(node, options) {
|
|
294
|
+
let graphics = [];
|
|
281
295
|
for (const primitive of node.primitives) {
|
|
282
296
|
const graphic = primitive.type === "pattern" ? createPatternGraphic(primitive.params, options) : createPrimitiveGraphic(primitive, options);
|
|
283
297
|
if (graphic)
|
|
284
298
|
graphics.push(graphic);
|
|
285
299
|
}
|
|
300
|
+
if (!graphics.length)
|
|
301
|
+
return graphics;
|
|
302
|
+
if (undefined !== node.layerId) {
|
|
303
|
+
const layerGraphic = 1 === graphics.length ? graphics[0] : options.system.createGraphicList(graphics);
|
|
304
|
+
graphics = [options.system.createGraphicLayer(layerGraphic, node.layerId)];
|
|
305
|
+
}
|
|
306
|
+
else if (undefined !== node.animationNodeId) {
|
|
307
|
+
const branch = new GraphicBranch(true);
|
|
308
|
+
branch.animationId = node.animationId;
|
|
309
|
+
branch.animationNodeId = node.animationNodeId;
|
|
310
|
+
branch.entries.push(...graphics);
|
|
311
|
+
graphics = [options.system.createBranch(branch, Transform.createIdentity())];
|
|
312
|
+
}
|
|
286
313
|
return graphics;
|
|
287
314
|
}
|
|
288
315
|
/** @internal */
|
|
@@ -297,23 +324,7 @@ export async function decodeImdlGraphics(options) {
|
|
|
297
324
|
const system = options.system;
|
|
298
325
|
const graphics = [];
|
|
299
326
|
for (const node of options.document.nodes) {
|
|
300
|
-
|
|
301
|
-
if (nodeGraphics.length === 0)
|
|
302
|
-
continue;
|
|
303
|
-
if (undefined !== node.layerId) {
|
|
304
|
-
const layerGraphic = 1 === nodeGraphics.length ? nodeGraphics[0] : system.createGraphicList(nodeGraphics);
|
|
305
|
-
graphics.push(system.createGraphicLayer(layerGraphic, node.layerId));
|
|
306
|
-
}
|
|
307
|
-
else if (undefined !== node.animationNodeId) {
|
|
308
|
-
const branch = new GraphicBranch(true);
|
|
309
|
-
branch.animationId = node.animationId;
|
|
310
|
-
branch.animationNodeId = node.animationNodeId;
|
|
311
|
-
branch.entries.push(...nodeGraphics);
|
|
312
|
-
graphics.push(system.createBranch(branch, Transform.createIdentity()));
|
|
313
|
-
}
|
|
314
|
-
else {
|
|
315
|
-
graphics.push(...nodeGraphics);
|
|
316
|
-
}
|
|
327
|
+
graphics.push(...createNodeGraphics(node, graphicsOptions));
|
|
317
328
|
}
|
|
318
329
|
switch (graphics.length) {
|
|
319
330
|
case 0: return undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImdlGraphicsCreator.js","sourceRoot":"","sources":["../../../src/tile/ImdlGraphicsCreator.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EACL,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,GAC/E,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AAGnF,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACvG,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAE1E,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAexD,KAAK,UAAU,gBAAgB,CAAC,IAAY,EAAE,QAA0B,EAAE,OAA0B;IAClG,4GAA4G;IAC5G,mCAAmC;IACnC,gDAAgD;IAChD,oEAAoE;IACpE,0GAA0G;IAC1G,6GAA6G;IAC7G,oBAAoB;IAEpB,IAAI;QACF,IAAI,WAAW,GAAG,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC;QAC5C,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACnD,MAAM,aAAa,GAAG,CAAC,OAAO,IAAI,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,C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AY,CAAC,CAAC;YACrC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC;SACxE;aAAM;YACL,QAAQ,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,CAAC;SAChC;KACF;IAED,QAAQ,QAAQ,CAAC,MAAM,EAAE;QACvB,KAAK,CAAC,CAAC,CAAC,OAAO,SAAS,CAAC;QACzB,KAAK,CAAC,CAAC,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC3B,OAAO,CAAC,CAAC,OAAO,MAAM,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;KACpD;AACH,CAAC","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/** @packageDocumentation\n * @module Tiles\n */\n\nimport { JsonUtils } from \"@itwin/core-bentley\";\nimport { ClipVector, Point2d, Point3d, Range3d, Transform } from \"@itwin/core-geometry\";\nimport {\n ColorDef, Gradient, ImageSource, RenderMaterial, RenderTexture, TextureMapping,\n} from \"@itwin/core-common\";\nimport { AuxChannelTable } from \"../common/render/primitives/AuxChannelTable\";\nimport { createSurfaceMaterial } from \"../common//render/primitives/SurfaceParams\";\nimport { ImdlModel as Imdl } from \"../common/imdl/ImdlModel\";\nimport { ImdlColorDef, ImdlNamedTexture, ImdlTextureMapping } from \"../common/imdl/ImdlSchema\";\nimport { edgeParamsFromImdl, toMaterialParams, toVertexTable } from \"../common/imdl/ParseImdlDocument\";\nimport { VertexIndices } from \"../common/render/primitives/VertexIndices\";\nimport type { RenderGraphic } from \"../render/RenderGraphic\";\nimport { GraphicBranch } from \"../render/GraphicBranch\";\nimport type { RenderGeometry, RenderSystem } from \"../render/RenderSystem\";\nimport type { InstancedGraphicParams } from \"../render/InstancedGraphicParams\";\nimport type { IModelConnection } from \"../IModelConnection\";\n\n/** Options provided to [[decodeImdlContent]].\n * @internal\n */\nexport interface ImdlDecodeOptions {\n document: Imdl.Document;\n system: RenderSystem;\n iModel: IModelConnection;\n isCanceled?: () => boolean;\n}\n\nasync function loadNamedTexture(name: string, namedTex: ImdlNamedTexture, options: ImdlDecodeOptions): Promise<RenderTexture | undefined> {\n // Reasons a texture could be embedded in the tile content instead of requested separately from the backend:\n // - external textures are disabled\n // - the texture name is not a valid Id64 string\n // - the texture is below a certain backend-hardcoded size threshold\n // The bufferViewJson being defined signifies any of the above conditions. In that case, the image content\n // has been embedded in the tile contents. Otherwise, we will attempt to request the image content separately\n // from the backend.\n\n try {\n let textureType = RenderTexture.Type.Normal;\n const isGlyph = JsonUtils.asBool(namedTex.isGlyph);\n const isTileSection = !isGlyph && JsonUtils.asBool(namedTex.isTileSection);\n if (isGlyph)\n textureType = RenderTexture.Type.Glyph;\n else if (isTileSection)\n textureType = RenderTexture.Type.TileSection;\n\n // We produce unique tile sections for very large (> 8 megapixel) textures, and unique glyph atlases for raster text.\n // Neither should be cached.\n const cacheable = !isGlyph && !isTileSection;\n const ownership = cacheable ? { iModel: options.iModel, key: name } : undefined;\n\n const bufferViewId = JsonUtils.asString(namedTex.bufferView);\n const bufferViewJson = 0 !== bufferViewId.length ? options.document.json.bufferViews[bufferViewId] : undefined;\n\n if (undefined !== bufferViewJson) { // presence of bufferViewJson signifies we should read the texture from the tile content\n const byteOffset = JsonUtils.asInt(bufferViewJson.byteOffset);\n const byteLength = JsonUtils.asInt(bufferViewJson.byteLength);\n if (0 === byteLength)\n return undefined;\n\n const texBytes = options.document.binaryData.subarray(byteOffset, byteOffset + byteLength);\n const format = namedTex.format;\n const source = new ImageSource(texBytes, format);\n return await options.system.createTextureFromSource({ source, ownership, type: textureType, transparency: namedTex.transparency });\n }\n\n // bufferViewJson was undefined, so attempt to request the texture directly from the backend\n // eslint-disable-next-line deprecation/deprecation\n const params = new RenderTexture.Params(cacheable ? name : undefined, textureType);\n return options.system.createTextureFromElement(name, options.iModel, params, namedTex.format);\n } catch (_) {\n return undefined;\n }\n}\n\nasync function loadNamedTextures(options: ImdlDecodeOptions): Promise<Map<string, RenderTexture>> {\n const result = new Map<string, RenderTexture>();\n const namedTextures = options.document.json.namedTextures;\n if (!namedTextures)\n return result;\n\n const promises = new Array<Promise<void>>();\n for (const [name, namedTexture] of Object.entries(namedTextures)) {\n const texture = options.system.findTexture(name, options.iModel);\n if (texture) {\n result.set(name, texture);\n continue;\n } else if (namedTexture) {\n promises.push(loadNamedTexture(name, namedTexture, options).then((tx) => {\n if (tx)\n result.set(name, tx);\n }));\n }\n }\n\n if (promises.length > 0)\n await Promise.all(promises);\n\n return result;\n}\n\ninterface GraphicsOptions extends ImdlDecodeOptions {\n textures: Map<string, RenderTexture>;\n patterns: Map<string, RenderGeometry[]>;\n}\n\nfunction constantLodParamPropsFromJson(propsJson: { repetitions?: number, offset?: number[], minDistClamp?: number, maxDistClamp?: number } | undefined): TextureMapping.ConstantLodParamProps | undefined {\n if (undefined === propsJson)\n return undefined;\n\n const constantLodPops: TextureMapping.ConstantLodParamProps = {\n repetitions: JsonUtils.asDouble(propsJson.repetitions, 1.0),\n offset: { x: propsJson.offset ? JsonUtils.asDouble(propsJson.offset[0]) : 0.0, y: propsJson.offset ? JsonUtils.asDouble(propsJson.offset[1]) : 0.0 },\n minDistClamp: JsonUtils.asDouble(propsJson.minDistClamp, 1.0),\n maxDistClamp: JsonUtils.asDouble(propsJson.maxDistClamp, 4096.0 * 1024.0 * 1024.0),\n };\n return constantLodPops;\n}\n\nfunction textureMappingFromJson(json: ImdlTextureMapping | undefined, options: GraphicsOptions): TextureMapping | undefined {\n if (!json)\n return undefined;\n\n const texture = options.textures.get(JsonUtils.asString(json.name));\n if (!texture)\n return undefined;\n\n const paramsJson = json.params;\n const tf = paramsJson.transform;\n\n const paramProps: TextureMapping.ParamProps = {\n textureMat2x3: new TextureMapping.Trans2x3(tf[0][0], tf[0][1], tf[0][2], tf[1][0], tf[1][1], tf[1][2]),\n textureWeight: JsonUtils.asDouble(paramsJson.weight, 1.0),\n mapMode: JsonUtils.asInt(paramsJson.mode),\n worldMapping: JsonUtils.asBool(paramsJson.worldMapping),\n useConstantLod: JsonUtils.asBool(paramsJson.useConstantLod),\n constantLodProps: constantLodParamPropsFromJson(paramsJson.constantLodParams),\n };\n\n const textureMapping = new TextureMapping(texture, new TextureMapping.Params(paramProps));\n\n const normalMapJson = json.normalMapParams;\n if (normalMapJson) {\n let normalMap;\n const normalTexName = JsonUtils.asString(normalMapJson.textureName);\n if (normalTexName.length === 0 || undefined !== (normalMap = options.textures.get(normalTexName))) {\n textureMapping.normalMapParams = {\n normalMap,\n greenUp: JsonUtils.asBool(normalMapJson.greenUp),\n scale: JsonUtils.asDouble(normalMapJson.scale, 1),\n useConstantLod: JsonUtils.asBool(normalMapJson.useConstantLod),\n };\n }\n }\n\n return textureMapping;\n}\n\nfunction getMaterial(mat: string | Imdl.SurfaceMaterialParams, options: GraphicsOptions): RenderMaterial | undefined {\n if (typeof mat !== \"string\") {\n const args = toMaterialParams(mat);\n return options.system.createRenderMaterial(args);\n }\n\n const material = options.system.findMaterial(mat, options.iModel);\n if (material || !options.document.json.renderMaterials)\n return material;\n\n const json = options.document.json.renderMaterials[mat];\n if (!json)\n return undefined;\n\n function colorDefFromJson(col: ImdlColorDef | undefined): ColorDef | undefined {\n return col ? ColorDef.from(col[0] * 255 + 0.5, col[1] * 255 + 0.5, col[2] * 255 + 0.5) : undefined;\n }\n\n // eslint-disable-next-line deprecation/deprecation\n const params = new RenderMaterial.Params(mat);\n params.diffuseColor = colorDefFromJson(json.diffuseColor);\n if (json.diffuse !== undefined)\n params.diffuse = JsonUtils.asDouble(json.diffuse);\n\n params.specularColor = colorDefFromJson(json.specularColor);\n if (json.specular !== undefined)\n params.specular = JsonUtils.asDouble(json.specular);\n\n params.reflectColor = colorDefFromJson(json.reflectColor);\n if (json.reflect !== undefined)\n params.reflect = JsonUtils.asDouble(json.reflect);\n\n if (json.specularExponent !== undefined)\n params.specularExponent = json.specularExponent;\n\n if (undefined !== json.transparency)\n params.alpha = 1.0 - json.transparency;\n\n params.refract = JsonUtils.asDouble(json.refract);\n params.shadows = JsonUtils.asBool(json.shadows);\n params.ambient = JsonUtils.asDouble(json.ambient);\n\n if (undefined !== json.textureMapping)\n params.textureMapping = textureMappingFromJson(json.textureMapping.texture, options);\n\n // eslint-disable-next-line deprecation/deprecation\n return options.system.createMaterial(params, options.iModel);\n}\n\nfunction getModifiers(primitive: Imdl.Primitive): { viOrigin?: Point3d, instances?: InstancedGraphicParams } {\n const mod = primitive.modifier;\n switch (mod?.type) {\n case \"instances\":\n return {\n instances: {\n ...mod,\n transformCenter: Point3d.fromJSON(mod.transformCenter),\n range: mod.range ? Range3d.fromJSON(mod.range) : undefined,\n },\n };\n case \"viewIndependentOrigin\":\n return {\n viOrigin: Point3d.fromJSON(mod.origin),\n };\n default:\n return { };\n }\n}\n\nfunction createPrimitiveGeometry(primitive: Imdl.Primitive, options: GraphicsOptions, viOrigin: Point3d | undefined): RenderGeometry | undefined {\n switch (primitive.type) {\n case \"point\":\n return options.system.createPointStringGeometry({\n ...primitive.params,\n vertices: toVertexTable(primitive.params.vertices),\n indices: new VertexIndices(primitive.params.indices),\n }, viOrigin);\n case \"polyline\":\n return options.system.createPolylineGeometry({\n ...primitive.params,\n vertices: toVertexTable(primitive.params.vertices),\n polyline: {\n ...primitive.params.polyline,\n indices: new VertexIndices(primitive.params.polyline.indices),\n prevIndices: new VertexIndices(primitive.params.polyline.prevIndices),\n },\n }, viOrigin);\n case \"mesh\": {\n const surf = primitive.params.surface;\n let material;\n if (surf.material) {\n if (!surf.material.isAtlas)\n material = createSurfaceMaterial(getMaterial(surf.material.material, options));\n else\n material = surf.material;\n }\n\n let textureMapping;\n if (surf.textureMapping) {\n let texture;\n if (typeof surf.textureMapping.texture === \"string\") {\n texture = options.textures.get(surf.textureMapping.texture);\n } else {\n const gradient = Gradient.Symb.fromJSON(surf.textureMapping.texture);\n texture = options.system.getGradientTexture(gradient, options.iModel);\n }\n\n if (texture)\n textureMapping = { texture, alwaysDisplayed: surf.textureMapping.alwaysDisplayed };\n }\n\n return options.system.createMeshGeometry({\n ...primitive.params,\n edges: primitive.params.edges ? edgeParamsFromImdl(primitive.params.edges) : undefined,\n vertices: toVertexTable(primitive.params.vertices),\n auxChannels: primitive.params.auxChannels ? AuxChannelTable.fromJSON(primitive.params.auxChannels) : undefined,\n surface: {\n ...primitive.params.surface,\n material,\n textureMapping,\n indices: new VertexIndices(primitive.params.surface.indices),\n },\n }, viOrigin);\n }\n }\n}\n\nfunction createPrimitiveGraphic(primitive: Imdl.Primitive, options: GraphicsOptions): RenderGraphic | undefined {\n const mods = getModifiers(primitive);\n const geometry = createPrimitiveGeometry(primitive, options, mods.viOrigin);\n return geometry ? options.system.createRenderGraphic(geometry, mods.instances) : undefined;\n}\n\nfunction createPatternGeometries(primitives: Imdl.Primitive[], options: GraphicsOptions): RenderGeometry[] {\n const geometries = [];\n for (const primitive of primitives) {\n const geometry = createPrimitiveGeometry(primitive, options, undefined);\n if (geometry)\n geometries.push(geometry);\n }\n\n return geometries;\n}\n\nfunction createPatternGraphic(params: Imdl.AreaPatternParams, options: GraphicsOptions): RenderGraphic | undefined {\n const geometries = options.patterns.get(params.symbolName);\n if (!geometries || geometries.length === 0)\n return undefined;\n\n const clip = ClipVector.fromJSON(params.clip);\n const clipVolume = clip?.isValid ? options.system.createClipVolume(clip) : undefined;\n if (!clipVolume)\n return undefined;\n\n const viewIndependentOrigin = params.viewIndependentOrigin ? Point3d.fromJSON(params.viewIndependentOrigin) : undefined;\n const pattern = options.system.createAreaPattern({\n xyOffsets: params.xyOffsets,\n featureId: params.featureId,\n orgTransform: Transform.fromJSON(params.orgTransform),\n origin: Point2d.fromJSON(params.origin),\n scale: params.scale,\n spacing: Point2d.fromJSON(params.spacing),\n patternToModel: Transform.fromJSON(params.modelTransform),\n range: Range3d.fromJSON(params.range),\n symbolTranslation: Point3d.fromJSON(params.symbolTranslation),\n viewIndependentOrigin,\n });\n\n if (!pattern)\n return undefined;\n\n const branch = new GraphicBranch(true);\n for (const geometry of geometries) {\n const graphic = options.system.createRenderGraphic(geometry, pattern);\n if (graphic)\n branch.add(graphic);\n }\n\n return branch.isEmpty ? undefined : options.system.createGraphicBranch(branch, Transform.createIdentity(), { clipVolume });\n}\n\nfunction createNodeGraphics(node: Imdl.Node, options: GraphicsOptions): RenderGraphic[] {\n const graphics = [];\n for (const primitive of node.primitives) {\n const graphic = primitive.type === \"pattern\" ? createPatternGraphic(primitive.params, options) : createPrimitiveGraphic(primitive, options);\n if (graphic)\n graphics.push(graphic);\n }\n\n return graphics;\n}\n\n/** @internal */\nexport async function decodeImdlGraphics(options: ImdlDecodeOptions): Promise<RenderGraphic | undefined> {\n const textures = await loadNamedTextures(options);\n if (options.isCanceled && options.isCanceled())\n return undefined;\n\n const patterns = new Map<string, RenderGeometry[]>();\n const graphicsOptions = { ...options, textures, patterns };\n\n for (const [name, primitives] of options.document.patterns)\n patterns.set(name, createPatternGeometries(primitives, graphicsOptions));\n\n const system = options.system;\n const graphics: RenderGraphic[] = [];\n for (const node of options.document.nodes) {\n const nodeGraphics = createNodeGraphics(node, graphicsOptions);\n if (nodeGraphics.length === 0)\n continue;\n\n if (undefined !== node.layerId) {\n const layerGraphic = 1 === nodeGraphics.length ? nodeGraphics[0] : system.createGraphicList(nodeGraphics);\n graphics.push(system.createGraphicLayer(layerGraphic, node.layerId));\n } else if (undefined !== node.animationNodeId) {\n const branch = new GraphicBranch(true);\n branch.animationId = node.animationId;\n branch.animationNodeId = node.animationNodeId;\n branch.entries.push(...nodeGraphics);\n graphics.push(system.createBranch(branch, Transform.createIdentity()));\n } else {\n graphics.push(...nodeGraphics);\n }\n }\n\n switch (graphics.length) {\n case 0: return undefined;\n case 1: return graphics[0];\n default: return system.createGraphicList(graphics);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ImdlGraphicsCre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AC,OAA0B;IACjE,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAClD,IAAI,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,UAAU,EAAE;QAC5C,OAAO,SAAS,CAAC;IAEnB,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA4B,CAAC;IACrD,MAAM,eAAe,GAAG,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;IAE3D,KAAK,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,QAAQ;QACxD,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,uBAAuB,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC;IAE3E,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC9B,MAAM,QAAQ,GAAoB,EAAE,CAAC;IACrC,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE;QACzC,QAAQ,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC;KAC7D;IAED,QAAQ,QAAQ,CAAC,MAAM,EAAE;QACvB,KAAK,CAAC,CAAC,CAAC,OAAO,SAAS,CAAC;QACzB,KAAK,CAAC,CAAC,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC3B,OAAO,CAAC,CAAC,OAAO,MAAM,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;KACpD;AACH,CAAC","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/** @packageDocumentation\n * @module Tiles\n */\n\nimport { JsonUtils } from \"@itwin/core-bentley\";\nimport { ClipVector, Point2d, Point3d, Range3d, Transform } from \"@itwin/core-geometry\";\nimport {\n ColorDef, Gradient, ImageSource, RenderMaterial, RenderTexture, TextureMapping,\n} from \"@itwin/core-common\";\nimport { AuxChannelTable } from \"../common/render/primitives/AuxChannelTable\";\nimport { createSurfaceMaterial } from \"../common//render/primitives/SurfaceParams\";\nimport { ImdlModel as Imdl } from \"../common/imdl/ImdlModel\";\nimport { ImdlColorDef, ImdlNamedTexture, ImdlTextureMapping } from \"../common/imdl/ImdlSchema\";\nimport { edgeParamsFromImdl, toMaterialParams, toVertexTable } from \"../common/imdl/ParseImdlDocument\";\nimport { VertexIndices } from \"../common/render/primitives/VertexIndices\";\nimport type { RenderGraphic } from \"../render/RenderGraphic\";\nimport { GraphicBranch } from \"../render/GraphicBranch\";\nimport type { RenderGeometry, RenderSystem } from \"../render/RenderSystem\";\nimport type { InstancedGraphicParams } from \"../render/InstancedGraphicParams\";\nimport type { IModelConnection } from \"../IModelConnection\";\n\n/** Options provided to [[decodeImdlContent]].\n * @internal\n */\nexport interface ImdlDecodeOptions {\n document: Imdl.Document;\n system: RenderSystem;\n iModel: IModelConnection;\n isCanceled?: () => boolean;\n}\n\nasync function loadNamedTexture(name: string, namedTex: ImdlNamedTexture, options: ImdlDecodeOptions): Promise<RenderTexture | undefined> {\n // Reasons a texture could be embedded in the tile content instead of requested separately from the backend:\n // - external textures are disabled\n // - the texture name is not a valid Id64 string\n // - the texture is below a certain backend-hardcoded size threshold\n // The bufferViewJson being defined signifies any of the above conditions. In that case, the image content\n // has been embedded in the tile contents. Otherwise, we will attempt to request the image content separately\n // from the backend.\n\n try {\n let textureType = RenderTexture.Type.Normal;\n const isGlyph = JsonUtils.asBool(namedTex.isGlyph);\n const isTileSection = !isGlyph && JsonUtils.asBool(namedTex.isTileSection);\n if (isGlyph)\n textureType = RenderTexture.Type.Glyph;\n else if (isTileSection)\n textureType = RenderTexture.Type.TileSection;\n\n // We produce unique tile sections for very large (> 8 megapixel) textures, and unique glyph atlases for raster text.\n // Neither should be cached.\n const cacheable = !isGlyph && !isTileSection;\n const ownership = cacheable ? { iModel: options.iModel, key: name } : undefined;\n\n const bufferViewId = JsonUtils.asString(namedTex.bufferView);\n const bufferViewJson = 0 !== bufferViewId.length ? options.document.json.bufferViews[bufferViewId] : undefined;\n\n if (undefined !== bufferViewJson) { // presence of bufferViewJson signifies we should read the texture from the tile content\n const byteOffset = JsonUtils.asInt(bufferViewJson.byteOffset);\n const byteLength = JsonUtils.asInt(bufferViewJson.byteLength);\n if (0 === byteLength)\n return undefined;\n\n const texBytes = options.document.binaryData.subarray(byteOffset, byteOffset + byteLength);\n const format = namedTex.format;\n const source = new ImageSource(texBytes, format);\n return await options.system.createTextureFromSource({ source, ownership, type: textureType, transparency: namedTex.transparency });\n }\n\n // bufferViewJson was undefined, so attempt to request the texture directly from the backend\n // eslint-disable-next-line deprecation/deprecation\n const params = new RenderTexture.Params(cacheable ? name : undefined, textureType);\n return options.system.createTextureFromElement(name, options.iModel, params, namedTex.format);\n } catch (_) {\n return undefined;\n }\n}\n\nasync function loadNamedTextures(options: ImdlDecodeOptions): Promise<Map<string, RenderTexture>> {\n const result = new Map<string, RenderTexture>();\n const namedTextures = options.document.json.namedTextures;\n if (!namedTextures)\n return result;\n\n const promises = new Array<Promise<void>>();\n for (const [name, namedTexture] of Object.entries(namedTextures)) {\n const texture = options.system.findTexture(name, options.iModel);\n if (texture) {\n result.set(name, texture);\n continue;\n } else if (namedTexture) {\n promises.push(loadNamedTexture(name, namedTexture, options).then((tx) => {\n if (tx)\n result.set(name, tx);\n }));\n }\n }\n\n if (promises.length > 0)\n await Promise.all(promises);\n\n return result;\n}\n\ninterface GraphicsOptions extends ImdlDecodeOptions {\n textures: Map<string, RenderTexture>;\n patterns: Map<string, RenderGeometry[]>;\n}\n\nfunction constantLodParamPropsFromJson(propsJson: { repetitions?: number, offset?: number[], minDistClamp?: number, maxDistClamp?: number } | undefined): TextureMapping.ConstantLodParamProps | undefined {\n if (undefined === propsJson)\n return undefined;\n\n const constantLodPops: TextureMapping.ConstantLodParamProps = {\n repetitions: JsonUtils.asDouble(propsJson.repetitions, 1.0),\n offset: { x: propsJson.offset ? JsonUtils.asDouble(propsJson.offset[0]) : 0.0, y: propsJson.offset ? JsonUtils.asDouble(propsJson.offset[1]) : 0.0 },\n minDistClamp: JsonUtils.asDouble(propsJson.minDistClamp, 1.0),\n maxDistClamp: JsonUtils.asDouble(propsJson.maxDistClamp, 4096.0 * 1024.0 * 1024.0),\n };\n return constantLodPops;\n}\n\nfunction textureMappingFromJson(json: ImdlTextureMapping | undefined, options: GraphicsOptions): TextureMapping | undefined {\n if (!json)\n return undefined;\n\n const texture = options.textures.get(JsonUtils.asString(json.name));\n if (!texture)\n return undefined;\n\n const paramsJson = json.params;\n const tf = paramsJson.transform;\n\n const paramProps: TextureMapping.ParamProps = {\n textureMat2x3: new TextureMapping.Trans2x3(tf[0][0], tf[0][1], tf[0][2], tf[1][0], tf[1][1], tf[1][2]),\n textureWeight: JsonUtils.asDouble(paramsJson.weight, 1.0),\n mapMode: JsonUtils.asInt(paramsJson.mode),\n worldMapping: JsonUtils.asBool(paramsJson.worldMapping),\n useConstantLod: JsonUtils.asBool(paramsJson.useConstantLod),\n constantLodProps: constantLodParamPropsFromJson(paramsJson.constantLodParams),\n };\n\n const textureMapping = new TextureMapping(texture, new TextureMapping.Params(paramProps));\n\n const normalMapJson = json.normalMapParams;\n if (normalMapJson) {\n let normalMap;\n const normalTexName = JsonUtils.asString(normalMapJson.textureName);\n if (normalTexName.length === 0 || undefined !== (normalMap = options.textures.get(normalTexName))) {\n textureMapping.normalMapParams = {\n normalMap,\n greenUp: JsonUtils.asBool(normalMapJson.greenUp),\n scale: JsonUtils.asDouble(normalMapJson.scale, 1),\n useConstantLod: JsonUtils.asBool(normalMapJson.useConstantLod),\n };\n }\n }\n\n return textureMapping;\n}\n\nfunction getMaterial(mat: string | Imdl.SurfaceMaterialParams, options: GraphicsOptions): RenderMaterial | undefined {\n if (typeof mat !== \"string\") {\n const args = toMaterialParams(mat);\n return options.system.createRenderMaterial(args);\n }\n\n const material = options.system.findMaterial(mat, options.iModel);\n if (material || !options.document.json.renderMaterials)\n return material;\n\n const json = options.document.json.renderMaterials[mat];\n if (!json)\n return undefined;\n\n function colorDefFromJson(col: ImdlColorDef | undefined): ColorDef | undefined {\n return col ? ColorDef.from(col[0] * 255 + 0.5, col[1] * 255 + 0.5, col[2] * 255 + 0.5) : undefined;\n }\n\n // eslint-disable-next-line deprecation/deprecation\n const params = new RenderMaterial.Params(mat);\n params.diffuseColor = colorDefFromJson(json.diffuseColor);\n if (json.diffuse !== undefined)\n params.diffuse = JsonUtils.asDouble(json.diffuse);\n\n params.specularColor = colorDefFromJson(json.specularColor);\n if (json.specular !== undefined)\n params.specular = JsonUtils.asDouble(json.specular);\n\n params.reflectColor = colorDefFromJson(json.reflectColor);\n if (json.reflect !== undefined)\n params.reflect = JsonUtils.asDouble(json.reflect);\n\n if (json.specularExponent !== undefined)\n params.specularExponent = json.specularExponent;\n\n if (undefined !== json.transparency)\n params.alpha = 1.0 - json.transparency;\n\n params.refract = JsonUtils.asDouble(json.refract);\n params.shadows = JsonUtils.asBool(json.shadows);\n params.ambient = JsonUtils.asDouble(json.ambient);\n\n if (undefined !== json.textureMapping)\n params.textureMapping = textureMappingFromJson(json.textureMapping.texture, options);\n\n // eslint-disable-next-line deprecation/deprecation\n return options.system.createMaterial(params, options.iModel);\n}\n\nfunction getModifiers(primitive: Imdl.Primitive): { viOrigin?: Point3d, instances?: InstancedGraphicParams } {\n const mod = primitive.modifier;\n switch (mod?.type) {\n case \"instances\":\n return {\n instances: {\n ...mod,\n transformCenter: Point3d.fromJSON(mod.transformCenter),\n range: mod.range ? Range3d.fromJSON(mod.range) : undefined,\n },\n };\n case \"viewIndependentOrigin\":\n return {\n viOrigin: Point3d.fromJSON(mod.origin),\n };\n default:\n return { };\n }\n}\n\nfunction createPrimitiveGeometry(primitive: Imdl.Primitive, options: GraphicsOptions, viOrigin: Point3d | undefined): RenderGeometry | undefined {\n switch (primitive.type) {\n case \"point\":\n return options.system.createPointStringGeometry({\n ...primitive.params,\n vertices: toVertexTable(primitive.params.vertices),\n indices: new VertexIndices(primitive.params.indices),\n }, viOrigin);\n case \"polyline\":\n return options.system.createPolylineGeometry({\n ...primitive.params,\n vertices: toVertexTable(primitive.params.vertices),\n polyline: {\n ...primitive.params.polyline,\n indices: new VertexIndices(primitive.params.polyline.indices),\n prevIndices: new VertexIndices(primitive.params.polyline.prevIndices),\n },\n }, viOrigin);\n case \"mesh\": {\n const surf = primitive.params.surface;\n let material;\n if (surf.material) {\n if (!surf.material.isAtlas)\n material = createSurfaceMaterial(getMaterial(surf.material.material, options));\n else\n material = surf.material;\n }\n\n let textureMapping;\n if (surf.textureMapping) {\n let texture;\n if (typeof surf.textureMapping.texture === \"string\") {\n texture = options.textures.get(surf.textureMapping.texture);\n } else {\n const gradient = Gradient.Symb.fromJSON(surf.textureMapping.texture);\n texture = options.system.getGradientTexture(gradient, options.iModel);\n }\n\n if (texture)\n textureMapping = { texture, alwaysDisplayed: surf.textureMapping.alwaysDisplayed };\n }\n\n return options.system.createMeshGeometry({\n ...primitive.params,\n edges: primitive.params.edges ? edgeParamsFromImdl(primitive.params.edges) : undefined,\n vertices: toVertexTable(primitive.params.vertices),\n auxChannels: primitive.params.auxChannels ? AuxChannelTable.fromJSON(primitive.params.auxChannels) : undefined,\n surface: {\n ...primitive.params.surface,\n material,\n textureMapping,\n indices: new VertexIndices(primitive.params.surface.indices),\n },\n }, viOrigin);\n }\n }\n}\n\nfunction createPrimitiveGraphic(primitive: Imdl.Primitive, options: GraphicsOptions): RenderGraphic | undefined {\n const mods = getModifiers(primitive);\n const geometry = createPrimitiveGeometry(primitive, options, mods.viOrigin);\n return geometry ? options.system.createRenderGraphic(geometry, mods.instances) : undefined;\n}\n\nfunction createPatternGeometries(primitives: Imdl.Primitive[], options: GraphicsOptions): RenderGeometry[] {\n const geometries = [];\n for (const primitive of primitives) {\n const geometry = createPrimitiveGeometry(primitive, options, undefined);\n if (geometry)\n geometries.push(geometry);\n }\n\n return geometries;\n}\n\nfunction createPatternGraphic(params: Imdl.AreaPatternParams, options: GraphicsOptions): RenderGraphic | undefined {\n const geometries = options.patterns.get(params.symbolName);\n if (!geometries || geometries.length === 0)\n return undefined;\n\n const clip = ClipVector.fromJSON(params.clip);\n const clipVolume = clip?.isValid ? options.system.createClipVolume(clip) : undefined;\n if (!clipVolume)\n return undefined;\n\n const viewIndependentOrigin = params.viewIndependentOrigin ? Point3d.fromJSON(params.viewIndependentOrigin) : undefined;\n const pattern = options.system.createAreaPattern({\n xyOffsets: params.xyOffsets,\n featureId: params.featureId,\n orgTransform: Transform.fromJSON(params.orgTransform),\n origin: Point2d.fromJSON(params.origin),\n scale: params.scale,\n spacing: Point2d.fromJSON(params.spacing),\n patternToModel: Transform.fromJSON(params.modelTransform),\n range: Range3d.fromJSON(params.range),\n symbolTranslation: Point3d.fromJSON(params.symbolTranslation),\n viewIndependentOrigin,\n });\n\n if (!pattern)\n return undefined;\n\n const branch = new GraphicBranch(true);\n for (const geometry of geometries) {\n const graphic = options.system.createRenderGraphic(geometry, pattern);\n if (graphic)\n branch.add(graphic);\n }\n\n return branch.isEmpty ? undefined : options.system.createGraphicBranch(branch, Transform.createIdentity(), { clipVolume });\n}\n\nfunction createNodeGraphics(node: Imdl.Node, options: GraphicsOptions): RenderGraphic[] {\n if (undefined === node.groupId)\n return createPrimitivesNodeGraphics(node, options);\n\n const graphics: RenderGraphic[] = [];\n for (const child of node.nodes) {\n graphics.push(...createPrimitivesNodeGraphics(child, options));\n }\n\n if (graphics.length === 0)\n return graphics;\n\n const branch = new GraphicBranch(true);\n branch.groupNodeId = node.groupId;\n branch.entries.push(...graphics);\n return [options.system.createBranch(branch, Transform.createIdentity())];\n}\n\nfunction createPrimitivesNodeGraphics(node: Imdl.PrimitivesNode, options: GraphicsOptions): RenderGraphic[] {\n let graphics = [];\n for (const primitive of node.primitives) {\n const graphic = primitive.type === \"pattern\" ? createPatternGraphic(primitive.params, options) : createPrimitiveGraphic(primitive, options);\n if (graphic)\n graphics.push(graphic);\n }\n\n if (!graphics.length)\n return graphics;\n\n if (undefined !== node.layerId) {\n const layerGraphic = 1 === graphics.length ? graphics[0] : options.system.createGraphicList(graphics);\n graphics = [options.system.createGraphicLayer(layerGraphic, node.layerId)];\n } else if (undefined !== node.animationNodeId) {\n const branch = new GraphicBranch(true);\n branch.animationId = node.animationId;\n branch.animationNodeId = node.animationNodeId;\n branch.entries.push(...graphics);\n graphics = [options.system.createBranch(branch, Transform.createIdentity())];\n }\n\n return graphics;\n}\n\n/** @internal */\nexport async function decodeImdlGraphics(options: ImdlDecodeOptions): Promise<RenderGraphic | undefined> {\n const textures = await loadNamedTextures(options);\n if (options.isCanceled && options.isCanceled())\n return undefined;\n\n const patterns = new Map<string, RenderGeometry[]>();\n const graphicsOptions = { ...options, textures, patterns };\n\n for (const [name, primitives] of options.document.patterns)\n patterns.set(name, createPatternGeometries(primitives, graphicsOptions));\n\n const system = options.system;\n const graphics: RenderGraphic[] = [];\n for (const node of options.document.nodes) {\n graphics.push(...createNodeGraphics(node, graphicsOptions));\n }\n\n switch (graphics.length) {\n case 0: return undefined;\n case 1: return graphics[0];\n default: return system.createGraphicList(graphics);\n }\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module Tiles
|
|
3
3
|
*/
|
|
4
|
-
import { ByteStream, Id64String } from "@itwin/core-bentley";
|
|
4
|
+
import { ByteStream, Id64Set, Id64String } from "@itwin/core-bentley";
|
|
5
5
|
import { BatchType, TileReadStatus } from "@itwin/core-common";
|
|
6
6
|
import { IModelConnection } from "../IModelConnection";
|
|
7
7
|
import { RenderGraphic } from "../render/RenderGraphic";
|
|
@@ -43,6 +43,7 @@ export interface ImdlReaderCreateArgs {
|
|
|
43
43
|
containsTransformNodes?: boolean;
|
|
44
44
|
/** Supplied if the graphics in the tile are to be split up based on the nodes in the timeline. */
|
|
45
45
|
timeline?: ImdlTimeline;
|
|
46
|
+
modelGroups?: Id64Set[];
|
|
46
47
|
}
|
|
47
48
|
/** @internal */
|
|
48
49
|
export declare function readImdlContent(args: ImdlReaderCreateArgs & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImdlReader.d.ts","sourceRoot":"","sources":["../../../src/tile/ImdlReader.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"ImdlReader.d.ts","sourceRoot":"","sources":["../../../src/tile/ImdlReader.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtE,OAAO,EACL,SAAS,EAA+C,cAAc,EACvE,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAuB,cAAc,EAAE,iBAAiB,EAAE,YAAY,EAAqB,MAAM,kCAAkC,CAAC;AAC3I,OAAO,EAAsB,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAInE,gBAAgB;AAChB,MAAM,WAAW,gBAAiB,SAAQ,iBAAiB;IACzD,UAAU,EAAE,cAAc,CAAC;CAC5B;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,KAAK,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAS7L;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,gBAAgB,CAAC;IACzB,OAAO,EAAE,UAAU,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,yFAAyF;IACzF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,YAAY,CAAC;IACrB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,YAAY,GAAG,KAAK,CAAC;IAC/B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,kGAAkG;IAClG,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC;CACzB;AAED,gBAAgB;AAChB,wBAAsB,eAAe,CAAC,IAAI,EAAE,oBAAoB,GAAG;IAAE,aAAa,CAAC,EAAE,CAAC,SAAS,EAAE,iBAAiB,KAAK,OAAO,CAAC,SAAS,CAAC,QAAQ,GAAG,cAAc,CAAC,CAAA;CAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAiEhM;AAED,gBAAgB;AAChB,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACvC;AAED,gBAAgB;AAChB,yBAAiB,UAAU,CAAC;IAC1B,SAAgB,MAAM,CAAC,IAAI,EAAE,oBAAoB,GAAG,UAAU,CAI7D;CACF"}
|
|
@@ -58,6 +58,7 @@ export async function readImdlContent(args) {
|
|
|
58
58
|
maxVertexTableSize: IModelApp.renderSystem.maxTextureSize,
|
|
59
59
|
omitEdges: false === args.loadEdges,
|
|
60
60
|
createUntransformedRootNode: args.containsTransformNodes,
|
|
61
|
+
modelGroups: args.modelGroups,
|
|
61
62
|
};
|
|
62
63
|
const document = args.parseDocument ? (await args.parseDocument(parseOpts)) : parseImdlDocument({ ...parseOpts, timeline: args.timeline });
|
|
63
64
|
if (isCanceled())
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImdlReader.js","sourceRoot":"","sources":["../../../src/tile/ImdlReader.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"ImdlReader.js","sourceRoot":"","sources":["../../../src/tile/ImdlReader.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAuB,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EACL,SAAS,EAAE,4BAA4B,EAAE,aAAa,EAAE,cAAc,GACvE,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAKxD,OAAO,EAAE,mBAAmB,EAAmD,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC3I,OAAO,EAAE,kBAAkB,EAAqB,MAAM,YAAY,CAAC;AASnE;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,KAAiB,EAAE,MAAwB,EAAE,OAAmB,EAAE,IAAa,EAAE,OAA8B;IACvJ,MAAM,MAAM,GAAG,UAAU,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QAC/B,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO;QACtC,MAAM,EAAE,SAAS,CAAC,YAAY;KAC/B,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAA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,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;KAClH;IAED,OAAO;QACL,UAAU,EAAE,cAAc,CAAC,OAAO;QAClC,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY;QAC5E,OAAO;QACP,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;KAC7C,CAAC;AACJ,CAAC;AAOD,gBAAgB;AAChB,MAAM,KAAW,UAAU,CAM1B;AAND,WAAiB,UAAU;IACzB,SAAgB,MAAM,CAAC,IAA0B;QAC/C,OAAO;YACL,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC;SACxC,CAAC;IACJ,CAAC;IAJe,iBAAM,SAIrB,CAAA;AACH,CAAC,EANgB,UAAU,KAAV,UAAU,QAM1B","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/** @packageDocumentation\n * @module Tiles\n */\n\nimport { ByteStream, Id64Set, Id64String } from \"@itwin/core-bentley\";\nimport { Point3d, Transform } from \"@itwin/core-geometry\";\nimport {\n BatchType, decodeTileContentDescription, TileReadError, TileReadStatus,\n} from \"@itwin/core-common\";\nimport { IModelApp } from \"../IModelApp\";\nimport { IModelConnection } from \"../IModelConnection\";\nimport { GraphicBranch } from \"../render/GraphicBranch\";\nimport { RenderGraphic } from \"../render/RenderGraphic\";\nimport { BatchOptions } from \"../render/GraphicBuilder\";\nimport { RenderSystem } from \"../render/RenderSystem\";\nimport { ImdlModel } from \"../common/imdl/ImdlModel\";\nimport { convertFeatureTable, ImdlParseError, ImdlParserOptions, ImdlTimeline, parseImdlDocument } from \"../common/imdl/ParseImdlDocument\";\nimport { decodeImdlGraphics, IModelTileContent } from \"./internal\";\n\n/* eslint-disable no-restricted-syntax */\n\n/** @internal */\nexport interface ImdlReaderResult extends IModelTileContent {\n readStatus: TileReadStatus;\n}\n\n/** Convert the byte array returned by [[TileAdmin.requestElementGraphics]] into a [[RenderGraphic]].\n * @param bytes The binary graphics data obtained from `requestElementGraphics`.\n * @param iModel The iModel with which the graphics are associated.\n * @param modelId The Id of the [[GeometricModelState]] with which the graphics are associated. Can be an invalid Id.\n * @param is3d True if the graphics are 3d.\n * @param options Options customizing how [Feature]($common)s within the graphic can be resymbolized; or false if you don't want to produce a batch.\n * @public\n * @extensions\n */\nexport async function readElementGraphics(bytes: Uint8Array, iModel: IModelConnection, modelId: Id64String, is3d: boolean, options?: BatchOptions | false): Promise<RenderGraphic | undefined> {\n const stream = ByteStream.fromUint8Array(bytes);\n const reader = ImdlReader.create({\n stream, iModel, modelId, is3d, options,\n system: IModelApp.renderSystem,\n });\n\n const result = await reader.read();\n return result.graphic;\n}\n\n/** Arguments supplied to [[ImdlReader.create]]\n * @internal\n */\nexport interface ImdlReaderCreateArgs {\n stream: ByteStream;\n iModel: IModelConnection;\n modelId: Id64String;\n is3d: boolean;\n /** If undefined, the tile's leafness will be deduced by decodeTileContentDescription. */\n isLeaf?: boolean;\n system: RenderSystem;\n type?: BatchType; // default Primary\n loadEdges?: boolean; // default true\n isCanceled?: () => boolean;\n sizeMultiplier?: number;\n options?: BatchOptions | false;\n containsTransformNodes?: boolean; // default false\n /** Supplied if the graphics in the tile are to be split up based on the nodes in the timeline. */\n timeline?: ImdlTimeline;\n modelGroups?: Id64Set[];\n}\n\n/** @internal */\nexport async function readImdlContent(args: ImdlReaderCreateArgs & { parseDocument?: (parseOpts: ImdlParserOptions) => Promise<ImdlModel.Document | ImdlParseError> }): Promise<ImdlReaderResult> {\n const isCanceled = args.isCanceled ?? (() => false);\n let content;\n try {\n content = decodeTileContentDescription({\n stream: args.stream,\n sizeMultiplier: args.sizeMultiplier,\n is2d: !args.is3d,\n options: IModelApp.tileAdmin,\n isVolumeClassifier: BatchType.VolumeClassifier === args.type,\n isLeaf: args.isLeaf,\n });\n } catch (e) {\n if (e instanceof TileReadError)\n return { isLeaf: true, readStatus: e.errorNumber };\n else\n throw e;\n }\n\n args.stream.reset();\n const parseOpts: ImdlParserOptions = {\n data: args.stream.readBytes(0, args.stream.length),\n batchModelId: args.modelId,\n is3d: args.is3d,\n maxVertexTableSize: IModelApp.renderSystem.maxTextureSize,\n omitEdges: false === args.loadEdges,\n createUntransformedRootNode: args.containsTransformNodes,\n modelGroups: args.modelGroups,\n };\n\n const document = args.parseDocument ? (await args.parseDocument(parseOpts)) : parseImdlDocument({ ...parseOpts, timeline: args.timeline });\n if (isCanceled())\n return { isLeaf: true, readStatus: TileReadStatus.Canceled };\n else if (typeof document === \"number\")\n return { isLeaf: true, readStatus: document };\n\n let graphic = await decodeImdlGraphics({\n system: args.system,\n iModel: args.iModel,\n document,\n isCanceled: args.isCanceled,\n });\n\n if (isCanceled())\n return { isLeaf: true, readStatus: TileReadStatus.Canceled };\n\n if (graphic && false !== args.options) {\n const featureTable = convertFeatureTable(document.featureTable, args.modelId);\n graphic = args.system.createBatch(graphic, featureTable, content.contentRange, args.options);\n }\n\n if (graphic && document.rtcCenter) {\n const rtcBranch = new GraphicBranch(true);\n rtcBranch.add(graphic);\n graphic = args.system.createBranch(rtcBranch, Transform.createTranslation(Point3d.fromJSON(document.rtcCenter)));\n }\n\n return {\n readStatus: TileReadStatus.Success,\n isLeaf: content.isLeaf,\n sizeMultiplier: content.sizeMultiplier,\n contentRange: content.contentRange.isNull ? undefined : content.contentRange,\n graphic,\n emptySubRangeMask: content.emptySubRangeMask,\n };\n}\n\n/** @internal */\nexport interface ImdlReader {\n read: () => Promise<ImdlReaderResult>;\n}\n\n/** @internal */\nexport namespace ImdlReader {\n export function create(args: ImdlReaderCreateArgs): ImdlReader {\n return {\n read: async () => readImdlContent(args),\n };\n }\n}\n"]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AM5D"}
|
|
@@ -664,10 +664,9 @@ export class RealityTreeReference extends RealityModelTileTree.Reference {
|
|
|
664
664
|
}
|
|
665
665
|
async getToolTip(hit) {
|
|
666
666
|
const tree = this.treeOwner.tileTree;
|
|
667
|
-
if (
|
|
667
|
+
if (!(tree instanceof RealityTileTree) || hit.iModel !== tree.iModel)
|
|
668
668
|
return undefined;
|
|
669
|
-
const
|
|
670
|
-
const batch = undefined !== map ? map.getBatchProperties(hit.sourceId) : undefined;
|
|
669
|
+
const batch = tree.batchTableProperties?.getFeatureProperties(hit.sourceId);
|
|
671
670
|
if (undefined === batch && tree.modelId !== hit.sourceId)
|
|
672
671
|
return undefined;
|
|
673
672
|
const strings = [];
|