@itwin/core-common 4.10.0-dev.8 → 5.0.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 +23 -1
- package/lib/cjs/BackendTypes.d.ts +0 -2
- package/lib/cjs/BackendTypes.d.ts.map +1 -1
- package/lib/cjs/BackgroundMapProvider.js +1 -1
- package/lib/cjs/BackgroundMapProvider.js.map +1 -1
- package/lib/cjs/BackgroundMapSettings.js +2 -2
- package/lib/cjs/BackgroundMapSettings.js.map +1 -1
- package/lib/cjs/BriefcaseTypes.js.map +1 -1
- package/lib/cjs/Code.d.ts +8 -0
- package/lib/cjs/Code.d.ts.map +1 -1
- package/lib/cjs/Code.js +8 -0
- package/lib/cjs/Code.js.map +1 -1
- package/lib/cjs/ColorDef.d.ts.map +1 -1
- package/lib/cjs/ColorDef.js +0 -3
- package/lib/cjs/ColorDef.js.map +1 -1
- package/lib/cjs/ConcurrentQuery.d.ts.map +1 -1
- package/lib/cjs/ContourDisplay.d.ts +216 -0
- package/lib/cjs/ContourDisplay.d.ts.map +1 -0
- package/lib/cjs/ContourDisplay.js +300 -0
- package/lib/cjs/ContourDisplay.js.map +1 -0
- package/lib/cjs/DisplayStyleSettings.d.ts +9 -0
- package/lib/cjs/DisplayStyleSettings.d.ts.map +1 -1
- package/lib/cjs/DisplayStyleSettings.js +16 -0
- package/lib/cjs/DisplayStyleSettings.js.map +1 -1
- package/lib/cjs/ECSqlReader.d.ts.map +1 -1
- package/lib/cjs/ECSqlReader.js +1 -10
- package/lib/cjs/ECSqlReader.js.map +1 -1
- package/lib/cjs/ElementMesh.js +2 -3
- package/lib/cjs/ElementMesh.js.map +1 -1
- package/lib/cjs/ElementProps.d.ts +25 -0
- package/lib/cjs/ElementProps.d.ts.map +1 -1
- package/lib/cjs/ElementProps.js +3 -3
- package/lib/cjs/ElementProps.js.map +1 -1
- package/lib/cjs/FeatureSymbology.d.ts +36 -5
- package/lib/cjs/FeatureSymbology.d.ts.map +1 -1
- package/lib/cjs/FeatureSymbology.js +127 -40
- package/lib/cjs/FeatureSymbology.js.map +1 -1
- package/lib/cjs/GeoCoordinateServices.js +2 -2
- package/lib/cjs/GeoCoordinateServices.js.map +1 -1
- package/lib/cjs/IModel.js.map +1 -1
- package/lib/cjs/IModelError.d.ts +5 -3
- package/lib/cjs/IModelError.d.ts.map +1 -1
- package/lib/cjs/IModelError.js +5 -2
- package/lib/cjs/IModelError.js.map +1 -1
- package/lib/cjs/ITwinError.d.ts +72 -0
- package/lib/cjs/ITwinError.d.ts.map +1 -0
- package/lib/cjs/ITwinError.js +55 -0
- package/lib/cjs/ITwinError.js.map +1 -0
- package/lib/cjs/Image.js +4 -4
- package/lib/cjs/Image.js.map +1 -1
- package/lib/cjs/MapLayerSettings.d.ts.map +1 -1
- package/lib/cjs/MapLayerSettings.js +0 -1
- package/lib/cjs/MapLayerSettings.js.map +1 -1
- package/lib/cjs/QPoint.d.ts +1 -1
- package/lib/cjs/RenderMaterial.js +4 -4
- package/lib/cjs/RenderMaterial.js.map +1 -1
- package/lib/cjs/RenderTexture.js.map +1 -1
- package/lib/cjs/RpcInterface.js +1 -1
- package/lib/cjs/RpcInterface.js.map +1 -1
- package/lib/cjs/RpcManager.d.ts.map +1 -1
- package/lib/cjs/RpcManager.js.map +1 -1
- package/lib/cjs/SolarCalculate.js +4 -5
- package/lib/cjs/SolarCalculate.js.map +1 -1
- package/lib/cjs/SpatialClassification.js.map +1 -1
- package/lib/cjs/SubCategoryAppearance.js.map +1 -1
- package/lib/cjs/TextureMapping.js.map +1 -1
- package/lib/cjs/TileProps.js +2 -2
- package/lib/cjs/TileProps.js.map +1 -1
- package/lib/cjs/Tween.d.ts.map +1 -1
- package/lib/cjs/Tween.js +0 -1
- package/lib/cjs/Tween.js.map +1 -1
- package/lib/cjs/ViewProps.d.ts +1 -1
- package/lib/cjs/ViewProps.d.ts.map +1 -1
- package/lib/cjs/ViewProps.js.map +1 -1
- package/lib/cjs/core-common.d.ts +2 -0
- package/lib/cjs/core-common.d.ts.map +1 -1
- package/lib/cjs/core-common.js +2 -0
- package/lib/cjs/core-common.js.map +1 -1
- package/lib/cjs/geometry/ElementGeometry.js +3 -3
- package/lib/cjs/geometry/ElementGeometry.js.map +1 -1
- package/lib/cjs/geometry/FrustumPlanes.js.map +1 -1
- package/lib/cjs/geometry/GeometryStream.js +2 -2
- package/lib/cjs/geometry/GeometryStream.js.map +1 -1
- package/lib/cjs/geometry/Placement.d.ts +3 -0
- package/lib/cjs/geometry/Placement.d.ts.map +1 -1
- package/lib/cjs/geometry/Placement.js +3 -0
- package/lib/cjs/geometry/Placement.js.map +1 -1
- package/lib/cjs/internal/Snapping.d.ts +7 -1
- package/lib/cjs/internal/Snapping.d.ts.map +1 -1
- package/lib/cjs/internal/Snapping.js.map +1 -1
- package/lib/cjs/ipc/IpcSocket.d.ts +15 -2
- package/lib/cjs/ipc/IpcSocket.d.ts.map +1 -1
- package/lib/cjs/ipc/IpcSocket.js.map +1 -1
- package/lib/cjs/ipc/IpcWebSocket.js.map +1 -1
- package/lib/cjs/rpc/DevToolsRpcInterface.js.map +1 -1
- package/lib/cjs/rpc/IModelReadRpcInterface.js +12 -12
- package/lib/cjs/rpc/IModelReadRpcInterface.js.map +1 -1
- package/lib/cjs/rpc/IModelTileRpcInterface.js +1 -1
- package/lib/cjs/rpc/IModelTileRpcInterface.js.map +1 -1
- package/lib/cjs/rpc/SnapshotIModelRpcInterface.d.ts +3 -0
- package/lib/cjs/rpc/SnapshotIModelRpcInterface.d.ts.map +1 -1
- package/lib/cjs/rpc/SnapshotIModelRpcInterface.js +3 -0
- package/lib/cjs/rpc/SnapshotIModelRpcInterface.js.map +1 -1
- package/lib/cjs/rpc/TestRpcManager.d.ts.map +1 -1
- package/lib/cjs/rpc/TestRpcManager.js +0 -1
- package/lib/cjs/rpc/TestRpcManager.js.map +1 -1
- package/lib/cjs/rpc/WipRpcInterface.d.ts +1 -0
- package/lib/cjs/rpc/WipRpcInterface.d.ts.map +1 -1
- package/lib/cjs/rpc/WipRpcInterface.js +2 -1
- package/lib/cjs/rpc/WipRpcInterface.js.map +1 -1
- package/lib/cjs/rpc/core/RpcConfiguration.d.ts.map +1 -1
- package/lib/cjs/rpc/core/RpcConfiguration.js +1 -1
- package/lib/cjs/rpc/core/RpcConfiguration.js.map +1 -1
- package/lib/cjs/rpc/core/RpcConstants.d.ts +1 -1
- package/lib/cjs/rpc/core/RpcConstants.d.ts.map +1 -1
- package/lib/cjs/rpc/core/RpcConstants.js +1 -1
- package/lib/cjs/rpc/core/RpcConstants.js.map +1 -1
- package/lib/cjs/rpc/core/RpcControl.d.ts.map +1 -1
- package/lib/cjs/rpc/core/RpcControl.js +0 -1
- package/lib/cjs/rpc/core/RpcControl.js.map +1 -1
- package/lib/cjs/rpc/core/RpcInvocation.js +1 -1
- package/lib/cjs/rpc/core/RpcInvocation.js.map +1 -1
- package/lib/cjs/rpc/core/RpcMarshaling.js +1 -1
- package/lib/cjs/rpc/core/RpcMarshaling.js.map +1 -1
- package/lib/cjs/rpc/core/RpcOperation.d.ts.map +1 -1
- package/lib/cjs/rpc/core/RpcOperation.js +0 -1
- package/lib/cjs/rpc/core/RpcOperation.js.map +1 -1
- package/lib/cjs/rpc/core/RpcPendingQueue.js +1 -1
- package/lib/cjs/rpc/core/RpcPendingQueue.js.map +1 -1
- package/lib/cjs/rpc/core/RpcProtocol.js.map +1 -1
- package/lib/cjs/rpc/core/RpcPush.d.ts.map +1 -1
- package/lib/cjs/rpc/core/RpcPush.js.map +1 -1
- package/lib/cjs/rpc/core/RpcRegistry.d.ts.map +1 -1
- package/lib/cjs/rpc/core/RpcRegistry.js +0 -2
- package/lib/cjs/rpc/core/RpcRegistry.js.map +1 -1
- package/lib/cjs/rpc/core/RpcRequest.d.ts.map +1 -1
- package/lib/cjs/rpc/core/RpcRequest.js +1 -2
- package/lib/cjs/rpc/core/RpcRequest.js.map +1 -1
- package/lib/cjs/rpc/core/RpcRequestContext.d.ts.map +1 -1
- package/lib/cjs/rpc/core/RpcRequestContext.js.map +1 -1
- package/lib/cjs/rpc/core/RpcRoutingToken.d.ts.map +1 -1
- package/lib/cjs/rpc/core/RpcRoutingToken.js +0 -1
- package/lib/cjs/rpc/core/RpcRoutingToken.js.map +1 -1
- package/lib/cjs/rpc/core/RpcSessionInvocation.js +1 -1
- package/lib/cjs/rpc/core/RpcSessionInvocation.js.map +1 -1
- package/lib/cjs/rpc/web/BentleyCloudRpcManager.js.map +1 -1
- package/lib/cjs/rpc/web/BentleyCloudRpcProtocol.d.ts.map +1 -1
- package/lib/cjs/rpc/web/BentleyCloudRpcProtocol.js +0 -1
- package/lib/cjs/rpc/web/BentleyCloudRpcProtocol.js.map +1 -1
- package/lib/cjs/rpc/web/OpenAPI.js.map +1 -1
- package/lib/cjs/rpc/web/RpcMultipart.d.ts.map +1 -1
- package/lib/cjs/rpc/web/RpcMultipart.js.map +1 -1
- package/lib/cjs/rpc/web/WebAppRpcLogging.js +1 -1
- package/lib/cjs/rpc/web/WebAppRpcLogging.js.map +1 -1
- package/lib/cjs/rpc/web/WebAppRpcProtocol.d.ts +0 -2
- package/lib/cjs/rpc/web/WebAppRpcProtocol.d.ts.map +1 -1
- package/lib/cjs/rpc/web/WebAppRpcProtocol.js.map +1 -1
- package/lib/cjs/rpc/web/WebAppRpcRequest.d.ts.map +1 -1
- package/lib/cjs/rpc/web/WebAppRpcRequest.js +1 -1
- package/lib/cjs/rpc/web/WebAppRpcRequest.js.map +1 -1
- package/lib/cjs/rpc/web/multipart/RpcMultipartParser.d.ts.map +1 -1
- package/lib/cjs/rpc/web/multipart/RpcMultipartParser.js +0 -1
- package/lib/cjs/rpc/web/multipart/RpcMultipartParser.js.map +1 -1
- package/lib/cjs/tile/TileIO.js +4 -4
- package/lib/cjs/tile/TileIO.js.map +1 -1
- package/lib/cjs/tile/TileMetadata.js +13 -13
- package/lib/cjs/tile/TileMetadata.js.map +1 -1
- package/lib/esm/BackendTypes.d.ts +0 -2
- package/lib/esm/BackendTypes.d.ts.map +1 -1
- package/lib/esm/BackgroundMapProvider.js +1 -1
- package/lib/esm/BackgroundMapProvider.js.map +1 -1
- package/lib/esm/BackgroundMapSettings.js +2 -2
- package/lib/esm/BackgroundMapSettings.js.map +1 -1
- package/lib/esm/BriefcaseTypes.js.map +1 -1
- package/lib/esm/Code.d.ts +8 -0
- package/lib/esm/Code.d.ts.map +1 -1
- package/lib/esm/Code.js +8 -0
- package/lib/esm/Code.js.map +1 -1
- package/lib/esm/ColorDef.d.ts.map +1 -1
- package/lib/esm/ColorDef.js +0 -3
- package/lib/esm/ColorDef.js.map +1 -1
- package/lib/esm/ConcurrentQuery.d.ts.map +1 -1
- package/lib/esm/ContourDisplay.d.ts +216 -0
- package/lib/esm/ContourDisplay.d.ts.map +1 -0
- package/lib/esm/ContourDisplay.js +293 -0
- package/lib/esm/ContourDisplay.js.map +1 -0
- package/lib/esm/DisplayStyleSettings.d.ts +9 -0
- package/lib/esm/DisplayStyleSettings.d.ts.map +1 -1
- package/lib/esm/DisplayStyleSettings.js +16 -0
- package/lib/esm/DisplayStyleSettings.js.map +1 -1
- package/lib/esm/ECSqlReader.d.ts.map +1 -1
- package/lib/esm/ECSqlReader.js +1 -10
- package/lib/esm/ECSqlReader.js.map +1 -1
- package/lib/esm/ElementMesh.js +1 -1
- package/lib/esm/ElementMesh.js.map +1 -1
- package/lib/esm/ElementProps.d.ts +25 -0
- package/lib/esm/ElementProps.d.ts.map +1 -1
- package/lib/esm/ElementProps.js.map +1 -1
- package/lib/esm/FeatureSymbology.d.ts +36 -5
- package/lib/esm/FeatureSymbology.d.ts.map +1 -1
- package/lib/esm/FeatureSymbology.js +127 -40
- package/lib/esm/FeatureSymbology.js.map +1 -1
- package/lib/esm/IModel.js.map +1 -1
- package/lib/esm/IModelError.d.ts +5 -3
- package/lib/esm/IModelError.d.ts.map +1 -1
- package/lib/esm/IModelError.js +5 -2
- package/lib/esm/IModelError.js.map +1 -1
- package/lib/esm/ITwinError.d.ts +72 -0
- package/lib/esm/ITwinError.d.ts.map +1 -0
- package/lib/esm/ITwinError.js +52 -0
- package/lib/esm/ITwinError.js.map +1 -0
- package/lib/esm/MapLayerSettings.d.ts.map +1 -1
- package/lib/esm/MapLayerSettings.js +0 -1
- package/lib/esm/MapLayerSettings.js.map +1 -1
- package/lib/esm/QPoint.d.ts +1 -1
- package/lib/esm/RenderMaterial.js +4 -4
- package/lib/esm/RenderMaterial.js.map +1 -1
- package/lib/esm/RenderTexture.js.map +1 -1
- package/lib/esm/RpcInterface.js +1 -1
- package/lib/esm/RpcInterface.js.map +1 -1
- package/lib/esm/RpcManager.d.ts.map +1 -1
- package/lib/esm/RpcManager.js.map +1 -1
- package/lib/esm/SpatialClassification.js.map +1 -1
- package/lib/esm/SubCategoryAppearance.js.map +1 -1
- package/lib/esm/TextureMapping.js.map +1 -1
- package/lib/esm/Tween.d.ts.map +1 -1
- package/lib/esm/Tween.js +0 -1
- package/lib/esm/Tween.js.map +1 -1
- package/lib/esm/ViewProps.d.ts +1 -1
- package/lib/esm/ViewProps.d.ts.map +1 -1
- package/lib/esm/ViewProps.js.map +1 -1
- package/lib/esm/core-common.d.ts +2 -0
- package/lib/esm/core-common.d.ts.map +1 -1
- package/lib/esm/core-common.js +2 -0
- package/lib/esm/core-common.js.map +1 -1
- package/lib/esm/geometry/ElementGeometry.js +3 -3
- package/lib/esm/geometry/ElementGeometry.js.map +1 -1
- package/lib/esm/geometry/FrustumPlanes.js.map +1 -1
- package/lib/esm/geometry/GeometryStream.js +2 -2
- package/lib/esm/geometry/GeometryStream.js.map +1 -1
- package/lib/esm/geometry/Placement.d.ts +3 -0
- package/lib/esm/geometry/Placement.d.ts.map +1 -1
- package/lib/esm/geometry/Placement.js +3 -0
- package/lib/esm/geometry/Placement.js.map +1 -1
- package/lib/esm/internal/Snapping.d.ts +7 -1
- package/lib/esm/internal/Snapping.d.ts.map +1 -1
- package/lib/esm/internal/Snapping.js.map +1 -1
- package/lib/esm/ipc/IpcSocket.d.ts +15 -2
- package/lib/esm/ipc/IpcSocket.d.ts.map +1 -1
- package/lib/esm/ipc/IpcSocket.js.map +1 -1
- package/lib/esm/ipc/IpcWebSocket.js.map +1 -1
- package/lib/esm/rpc/DevToolsRpcInterface.js.map +1 -1
- package/lib/esm/rpc/IModelReadRpcInterface.js +12 -12
- package/lib/esm/rpc/IModelReadRpcInterface.js.map +1 -1
- package/lib/esm/rpc/IModelTileRpcInterface.js +1 -1
- package/lib/esm/rpc/IModelTileRpcInterface.js.map +1 -1
- package/lib/esm/rpc/SnapshotIModelRpcInterface.d.ts +3 -0
- package/lib/esm/rpc/SnapshotIModelRpcInterface.d.ts.map +1 -1
- package/lib/esm/rpc/SnapshotIModelRpcInterface.js +3 -0
- package/lib/esm/rpc/SnapshotIModelRpcInterface.js.map +1 -1
- package/lib/esm/rpc/TestRpcManager.d.ts.map +1 -1
- package/lib/esm/rpc/TestRpcManager.js +0 -1
- package/lib/esm/rpc/TestRpcManager.js.map +1 -1
- package/lib/esm/rpc/WipRpcInterface.d.ts +1 -0
- package/lib/esm/rpc/WipRpcInterface.d.ts.map +1 -1
- package/lib/esm/rpc/WipRpcInterface.js +2 -1
- package/lib/esm/rpc/WipRpcInterface.js.map +1 -1
- package/lib/esm/rpc/core/RpcConfiguration.d.ts.map +1 -1
- package/lib/esm/rpc/core/RpcConfiguration.js +1 -1
- package/lib/esm/rpc/core/RpcConfiguration.js.map +1 -1
- package/lib/esm/rpc/core/RpcConstants.d.ts +1 -1
- package/lib/esm/rpc/core/RpcConstants.d.ts.map +1 -1
- package/lib/esm/rpc/core/RpcConstants.js +1 -1
- package/lib/esm/rpc/core/RpcConstants.js.map +1 -1
- package/lib/esm/rpc/core/RpcControl.d.ts.map +1 -1
- package/lib/esm/rpc/core/RpcControl.js +0 -1
- package/lib/esm/rpc/core/RpcControl.js.map +1 -1
- package/lib/esm/rpc/core/RpcInvocation.js +1 -1
- package/lib/esm/rpc/core/RpcInvocation.js.map +1 -1
- package/lib/esm/rpc/core/RpcMarshaling.js +1 -1
- package/lib/esm/rpc/core/RpcMarshaling.js.map +1 -1
- package/lib/esm/rpc/core/RpcOperation.d.ts.map +1 -1
- package/lib/esm/rpc/core/RpcOperation.js +0 -1
- package/lib/esm/rpc/core/RpcOperation.js.map +1 -1
- package/lib/esm/rpc/core/RpcPendingQueue.js +1 -1
- package/lib/esm/rpc/core/RpcPendingQueue.js.map +1 -1
- package/lib/esm/rpc/core/RpcProtocol.js.map +1 -1
- package/lib/esm/rpc/core/RpcPush.d.ts.map +1 -1
- package/lib/esm/rpc/core/RpcPush.js.map +1 -1
- package/lib/esm/rpc/core/RpcRegistry.d.ts.map +1 -1
- package/lib/esm/rpc/core/RpcRegistry.js +0 -2
- package/lib/esm/rpc/core/RpcRegistry.js.map +1 -1
- package/lib/esm/rpc/core/RpcRequest.d.ts.map +1 -1
- package/lib/esm/rpc/core/RpcRequest.js +1 -2
- package/lib/esm/rpc/core/RpcRequest.js.map +1 -1
- package/lib/esm/rpc/core/RpcRequestContext.d.ts.map +1 -1
- package/lib/esm/rpc/core/RpcRequestContext.js.map +1 -1
- package/lib/esm/rpc/core/RpcRoutingToken.d.ts.map +1 -1
- package/lib/esm/rpc/core/RpcRoutingToken.js +0 -1
- package/lib/esm/rpc/core/RpcRoutingToken.js.map +1 -1
- package/lib/esm/rpc/core/RpcSessionInvocation.js +1 -1
- package/lib/esm/rpc/core/RpcSessionInvocation.js.map +1 -1
- package/lib/esm/rpc/web/BentleyCloudRpcManager.js.map +1 -1
- package/lib/esm/rpc/web/BentleyCloudRpcProtocol.d.ts.map +1 -1
- package/lib/esm/rpc/web/BentleyCloudRpcProtocol.js +0 -1
- package/lib/esm/rpc/web/BentleyCloudRpcProtocol.js.map +1 -1
- package/lib/esm/rpc/web/OpenAPI.js.map +1 -1
- package/lib/esm/rpc/web/RpcMultipart.d.ts.map +1 -1
- package/lib/esm/rpc/web/RpcMultipart.js.map +1 -1
- package/lib/esm/rpc/web/WebAppRpcLogging.js +1 -1
- package/lib/esm/rpc/web/WebAppRpcLogging.js.map +1 -1
- package/lib/esm/rpc/web/WebAppRpcProtocol.d.ts +0 -2
- package/lib/esm/rpc/web/WebAppRpcProtocol.d.ts.map +1 -1
- package/lib/esm/rpc/web/WebAppRpcProtocol.js.map +1 -1
- package/lib/esm/rpc/web/WebAppRpcRequest.d.ts.map +1 -1
- package/lib/esm/rpc/web/WebAppRpcRequest.js +1 -1
- package/lib/esm/rpc/web/WebAppRpcRequest.js.map +1 -1
- package/lib/esm/rpc/web/multipart/RpcMultipartParser.d.ts.map +1 -1
- package/lib/esm/rpc/web/multipart/RpcMultipartParser.js +0 -1
- package/lib/esm/rpc/web/multipart/RpcMultipartParser.js.map +1 -1
- package/lib/esm/tile/TileMetadata.js +1 -1
- package/lib/esm/tile/TileMetadata.js.map +1 -1
- package/package.json +14 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FrustumPlanes.js","sourceRoot":"","sources":["../../../src/geometry/FrustumPlanes.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,wDAAoE;AAIpE;;;;;;;;;;;;;;;;;;;;EAoBE;AAEF,4CAA4C;AAC5C,MAAM,iBAAiB,GAAG;IACxB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ;IACnB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO;IAClB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM;IACjB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS;IACpB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO;IAClB,mFAAmF;IACnF,oCAAoC;CACrC,CAAC;AAEF,SAAS,oBAAoB,CAAC,OAAgB;IAC5C,MAAM,MAAM,GAAG,EAAE,CAAC;IAClB,MAAM,MAAM,GAAG,OAAO,CAAC,M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AC;IACvB,CAAC;CACF;AAxJD,sCAwJC;AAED,0BAA0B;AAC1B,WAAiB,aAAa;IAC5B;;OAEG;IACH,IAAY,WAOX;IAPD,WAAY,WAAW;QACrB,sFAAsF;QACtF,mDAAW,CAAA;QACX,4GAA4G;QAC5G,mDAAW,CAAA;QACX,qFAAqF;QACrF,iDAAU,CAAA;IACZ,CAAC,EAPW,WAAW,GAAX,yBAAW,KAAX,yBAAW,QAOtB;AACH,CAAC,EAZgB,aAAa,6BAAb,aAAa,QAY7B","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Geometry\r\n */\r\n\r\nimport { ClipPlane, Point3d, Vector3d } from \"@itwin/core-geometry\";\r\nimport { Frustum } from \"../Frustum\";\r\nimport { BoundingSphere } from \"./BoundingSphere\";\r\n\r\n/*\r\nThe following visualizes the contents of frustum.points, which is sent to computeFrustumPlanes().\r\nThe below numbers are the indices into that array.\r\n\r\n 2----------3\r\n /| /|\r\n / 0--------/-1\r\n6----------7 /\r\n| / | /\r\n|/ |/\r\n4__________5\r\n\r\n0 = left bottom rear\r\n1 = right bottom rear\r\n2 = left top right\r\n3 = right top rear\r\n4 = left bottom front\r\n5 = right bottom front\r\n6 = left top front\r\n7 = right top front\r\n*/\r\n\r\n// Ordering of sub-arrays is: [origin, a, b]\r\nconst planePointIndices = [\r\n [1, 5, 3], // right\r\n [0, 2, 4], // left\r\n [2, 3, 6], // top\r\n [0, 4, 1], // bottom\r\n [0, 1, 2], // back\r\n // Skip front plane because it can be too small. Instead derive it from back plane.\r\n // Otherwise, it would be: [4, 6, 5]\r\n];\r\n\r\nfunction computeFrustumPlanes(frustum: Frustum): ClipPlane[] {\r\n const planes = [];\r\n const points = frustum.points;\r\n const expandPlaneDistance = 1e-6;\r\n\r\n let normal: Vector3d | undefined;\r\n for (const indices of planePointIndices) {\r\n const i0 = indices[0], i1 = indices[1], i2 = indices[2];\r\n normal = Vector3d.createCrossProductToPoints(points[i0], points[i1], points[i2]);\r\n normal.normalizeInPlace();\r\n\r\n const plane = ClipPlane.createNormalAndDistance(normal, normal.dotProduct(points[i0]) - expandPlaneDistance);\r\n if (!plane)\r\n return [];\r\n\r\n planes.push(plane);\r\n }\r\n\r\n // Derive front plane from back plane due to fact that front plane can become very tiny and cause precision issues, resulting in zero frustum planes. Deriving the front plane from the rear rect resolves this problem.\r\n // The back plane was the last plane processed above, so we can just consult the current value of `normal`.\r\n if (undefined !== normal) {\r\n normal.negate(normal); // negate the back plane\r\n // NB: Below, we make sure we calculate the distance based on a point on the front rect, not the rear rect!\r\n const plane = ClipPlane.createNormalAndDistance(normal, normal.dotProduct(points[4]) - expandPlaneDistance);\r\n if (!plane)\r\n return [];\r\n\r\n planes.push(plane);\r\n } else\r\n return [];\r\n\r\n return planes;\r\n}\r\n\r\n// Scratch variable used by FrustumPlanes.computeContainment.\r\nconst planesContainingSphere = [false, false, false, false, false, false];\r\n\r\n/** Represents a the planes of a [[Frustum]] for testing containment and intersection.\r\n * A valid frustum produces six planes. A degenerate frustum produces zero planes.\r\n * @public\r\n * @extensions\r\n */\r\nexport class FrustumPlanes {\r\n private _planes: ClipPlane[];\r\n\r\n private constructor(planes: ClipPlane[]) {\r\n this._planes = planes;\r\n }\r\n\r\n /** Compute the six planes of the specified frustum.\r\n * If the frustum is degenerate - that is, its points do not represent a truncated pyramid - then the returned `FrustumPlanes` will contain zero planes.\r\n * @note This method assumes that the front plane is parallel to the back plane.\r\n * @see [[isValid]] to test this condition.\r\n */\r\n public static fromFrustum(frustum: Frustum): FrustumPlanes {\r\n const planes = computeFrustumPlanes(frustum);\r\n return new FrustumPlanes(planes);\r\n }\r\n\r\n /** Create an empty set of frustum planes. [[isValid]] will be `true`. This can be useful when you want to create a `FrustumPlanes` object and initialize it later via [[init]] -\r\n * for example, if you intend to use the same object repeatedly with different [[Frustum]]s.\r\n */\r\n public static createEmpty(): FrustumPlanes {\r\n return new FrustumPlanes([]);\r\n }\r\n\r\n /** Returns true if [[planes]] consists of six planes. This may return `false` if a degenerate [[Frustum]] was supplied to [[fromFrustum]], or if this object was created\r\n * via [[createEmpty]] - in either case, [[planes]] will be an empty array.\r\n */\r\n public get isValid(): boolean {\r\n return this._planes.length === 6;\r\n }\r\n\r\n /** Obtain the list of planes defining the frustum. If [[isValid]] is `true`, it will have a length of six, with the planes ordered as\r\n * right, left, top, bottom, back, front. Otherwise, it will be empty.\r\n */\r\n public get planes(): ClipPlane[] {\r\n return this._planes;\r\n }\r\n\r\n /** Recompute the planes from the specified frustum.\r\n * @returns true upon success, or false if the input frustum was degenerate, in which case [[isValid]] will be `false`.\r\n * @note This method assumes that the front plane is parallel to the back plane.\r\n */\r\n public init(frustum: Frustum): boolean {\r\n this._planes = computeFrustumPlanes(frustum);\r\n return this.isValid;\r\n }\r\n\r\n /** Compute to what degree a [[Frustum]] is contained with these frustum planes.\r\n * @param box The frustum to test for containment.\r\n * @param sphere An optional spherical bounding volume fully containing `box`. If supplied, this can reduce the amount of computation required.\r\n * @returns the degree to which `box` is contained within the clipping planes.\r\n */\r\n public computeFrustumContainment(box: Frustum, sphere?: BoundingSphere): FrustumPlanes.Containment {\r\n return this.computeContainment(box.points, sphere);\r\n }\r\n\r\n /** Determines whether a [[Frustum]] intersects with or is fully contained within these frustum planes.\r\n * @param box The frustum to test for containment.\r\n * @param sphere An optional spherical bounding volume fully containing `box`. If supplied, this can reduce the amount of computation required.\r\n * @returns true if `box` is not entirely outside of the clipping planes.\r\n */\r\n public intersectsFrustum(box: Frustum, sphere?: BoundingSphere): boolean {\r\n return FrustumPlanes.Containment.Outside !== this.computeFrustumContainment(box, sphere);\r\n }\r\n\r\n /** Determines whether a point is contained within these frustum planes.\r\n * @param point The point to test for containment.\r\n * @param tolerance The maximum distance from the interior of the frustum planes that will still be considered \"contained\".\r\n * @returns true if `point` is no further than `tolerance` meters outside of the clipping planes.\r\n */\r\n public containsPoint(point: Point3d, tolerance: number = 1.0e-8): boolean {\r\n return FrustumPlanes.Containment.Outside !== this.computeContainment([point], undefined, tolerance);\r\n }\r\n\r\n /** Compute the degree to which a set of points is contained within these frustum planes.\r\n * @param points The points to test for containment.\r\n * @param sphere An optional spherical bounding volume fully containing all of the points. If supplied, this can reduce the amount of computation required.\r\n * @param tolerance The maximum distance from the interior of the frustum planes a point must be to be considered \"contained\".\r\n * @returns the degree to which all of the points are contained within the clipping planes.\r\n */\r\n public computeContainment(points: Point3d[], sphere?: BoundingSphere, tolerance: number = 1.0e-8): FrustumPlanes.Containment {\r\n if (undefined === this._planes)\r\n return FrustumPlanes.Containment.Outside;\r\n\r\n // Do the cheap test against bounding sphere first.\r\n if (sphere) {\r\n for (let i = 0; i < this._planes.length; i++) {\r\n const plane = this._planes[i];\r\n const centerDistance = plane.altitude(sphere.center);\r\n const tolerancePlusRadius = tolerance + sphere.radius;\r\n if (centerDistance < -tolerancePlusRadius)\r\n return FrustumPlanes.Containment.Outside;\r\n\r\n planesContainingSphere[i] = centerDistance > tolerancePlusRadius;\r\n }\r\n }\r\n\r\n // Test against points.\r\n let allInside = true;\r\n for (let i = 0; i < this._planes.length; i++) {\r\n if (sphere && planesContainingSphere[i])\r\n continue;\r\n\r\n const plane = this._planes[i];\r\n let nOutside = 0;\r\n for (const point of points) {\r\n if (plane.altitude(point) + tolerance < 0) {\r\n ++nOutside;\r\n allInside = false;\r\n }\r\n }\r\n\r\n if (nOutside === points.length)\r\n return FrustumPlanes.Containment.Outside;\r\n }\r\n\r\n return allInside ? FrustumPlanes.Containment.Inside : FrustumPlanes.Containment.Partial;\r\n }\r\n\r\n /** Computes whether a ray intersects these clipping planes.\r\n * @param origin The origin of the ray.\r\n * @param direction The direction of the ray.\r\n * @returns true if the ray extending from `origin` in the specified `direction` intersects at least one of the clipping planes.\r\n */\r\n public intersectsRay(origin: Point3d, direction: Vector3d): boolean {\r\n if (undefined === this._planes) {\r\n return false;\r\n }\r\n\r\n let tFar = 1e37;\r\n let tNear = -tFar;\r\n\r\n for (const plane of this._planes) {\r\n const vD = plane.velocity(direction);\r\n const vN = plane.altitude(origin);\r\n if (0.0 === vD) {\r\n // ray is parallel... no need to continue testing if outside halfspace.\r\n if (vN < 0.0) {\r\n return false;\r\n }\r\n } else {\r\n const rayDistance = -vN / vD;\r\n if (vD < 0.0) {\r\n tFar = Math.min(rayDistance, tFar);\r\n } else {\r\n tNear = Math.max(rayDistance, tNear);\r\n }\r\n }\r\n }\r\n\r\n return tNear <= tFar;\r\n }\r\n}\r\n\r\n/** @public @extensions */\r\nexport namespace FrustumPlanes { // eslint-disable-line no-redeclare\r\n /** Describes the degree to which an object is contained within the planes of a [[Frustum]].\r\n * @see [[FrustumPlanes.computeContainment]], for example.\r\n */\r\n export enum Containment {\r\n /** The object is entirely outside of the frustum, intersecting none of its planes. */\r\n Outside = 0,\r\n /** The object intersects at least one of the frustum planes. placing it partially inside of the frustum. */\r\n Partial = 1,\r\n /** The object is entirely inside of the frustum, intersecting none of its planes. */\r\n Inside = 2,\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"FrustumPlanes.js","sourceRoot":"","sources":["../../../src/geometry/FrustumPlanes.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,wDAAoE;AAIpE;;;;;;;;;;;;;;;;;;;;EAoBE;AAEF,4CAA4C;AAC5C,MAAM,iBAAiB,GAAG;IACxB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ;IACnB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO;IAClB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM;IACjB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS;IACpB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO;IACl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,CAAC;oBACN,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;gBACvC,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,KAAK,IAAI,IAAI,CAAC;IACvB,CAAC;CACF;AAxJD,sCAwJC;AAED,0BAA0B;AAC1B,WAAiB,aAAa;IAC5B;;OAEG;IACH,IAAY,WAOX;IAPD,WAAY,WAAW;QACrB,sFAAsF;QACtF,mDAAW,CAAA;QACX,4GAA4G;QAC5G,mDAAW,CAAA;QACX,qFAAqF;QACrF,iDAAU,CAAA;IACZ,CAAC,EAPW,WAAW,GAAX,yBAAW,KAAX,yBAAW,QAOtB;AACH,CAAC,EAZgB,aAAa,6BAAb,aAAa,QAY7B","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Geometry\r\n */\r\n\r\nimport { ClipPlane, Point3d, Vector3d } from \"@itwin/core-geometry\";\r\nimport { Frustum } from \"../Frustum\";\r\nimport { BoundingSphere } from \"./BoundingSphere\";\r\n\r\n/*\r\nThe following visualizes the contents of frustum.points, which is sent to computeFrustumPlanes().\r\nThe below numbers are the indices into that array.\r\n\r\n 2----------3\r\n /| /|\r\n / 0--------/-1\r\n6----------7 /\r\n| / | /\r\n|/ |/\r\n4__________5\r\n\r\n0 = left bottom rear\r\n1 = right bottom rear\r\n2 = left top right\r\n3 = right top rear\r\n4 = left bottom front\r\n5 = right bottom front\r\n6 = left top front\r\n7 = right top front\r\n*/\r\n\r\n// Ordering of sub-arrays is: [origin, a, b]\r\nconst planePointIndices = [\r\n [1, 5, 3], // right\r\n [0, 2, 4], // left\r\n [2, 3, 6], // top\r\n [0, 4, 1], // bottom\r\n [0, 1, 2], // back\r\n // Skip front plane because it can be too small. Instead derive it from back plane.\r\n // Otherwise, it would be: [4, 6, 5]\r\n];\r\n\r\nfunction computeFrustumPlanes(frustum: Frustum): ClipPlane[] {\r\n const planes = [];\r\n const points = frustum.points;\r\n const expandPlaneDistance = 1e-6;\r\n\r\n let normal: Vector3d | undefined;\r\n for (const indices of planePointIndices) {\r\n const i0 = indices[0], i1 = indices[1], i2 = indices[2];\r\n normal = Vector3d.createCrossProductToPoints(points[i0], points[i1], points[i2]);\r\n normal.normalizeInPlace();\r\n\r\n const plane = ClipPlane.createNormalAndDistance(normal, normal.dotProduct(points[i0]) - expandPlaneDistance);\r\n if (!plane)\r\n return [];\r\n\r\n planes.push(plane);\r\n }\r\n\r\n // Derive front plane from back plane due to fact that front plane can become very tiny and cause precision issues, resulting in zero frustum planes. Deriving the front plane from the rear rect resolves this problem.\r\n // The back plane was the last plane processed above, so we can just consult the current value of `normal`.\r\n if (undefined !== normal) {\r\n normal.negate(normal); // negate the back plane\r\n // NB: Below, we make sure we calculate the distance based on a point on the front rect, not the rear rect!\r\n const plane = ClipPlane.createNormalAndDistance(normal, normal.dotProduct(points[4]) - expandPlaneDistance);\r\n if (!plane)\r\n return [];\r\n\r\n planes.push(plane);\r\n } else\r\n return [];\r\n\r\n return planes;\r\n}\r\n\r\n// Scratch variable used by FrustumPlanes.computeContainment.\r\nconst planesContainingSphere = [false, false, false, false, false, false];\r\n\r\n/** Represents a the planes of a [[Frustum]] for testing containment and intersection.\r\n * A valid frustum produces six planes. A degenerate frustum produces zero planes.\r\n * @public\r\n * @extensions\r\n */\r\nexport class FrustumPlanes {\r\n private _planes: ClipPlane[];\r\n\r\n private constructor(planes: ClipPlane[]) {\r\n this._planes = planes;\r\n }\r\n\r\n /** Compute the six planes of the specified frustum.\r\n * If the frustum is degenerate - that is, its points do not represent a truncated pyramid - then the returned `FrustumPlanes` will contain zero planes.\r\n * @note This method assumes that the front plane is parallel to the back plane.\r\n * @see [[isValid]] to test this condition.\r\n */\r\n public static fromFrustum(frustum: Frustum): FrustumPlanes {\r\n const planes = computeFrustumPlanes(frustum);\r\n return new FrustumPlanes(planes);\r\n }\r\n\r\n /** Create an empty set of frustum planes. [[isValid]] will be `true`. This can be useful when you want to create a `FrustumPlanes` object and initialize it later via [[init]] -\r\n * for example, if you intend to use the same object repeatedly with different [[Frustum]]s.\r\n */\r\n public static createEmpty(): FrustumPlanes {\r\n return new FrustumPlanes([]);\r\n }\r\n\r\n /** Returns true if [[planes]] consists of six planes. This may return `false` if a degenerate [[Frustum]] was supplied to [[fromFrustum]], or if this object was created\r\n * via [[createEmpty]] - in either case, [[planes]] will be an empty array.\r\n */\r\n public get isValid(): boolean {\r\n return this._planes.length === 6;\r\n }\r\n\r\n /** Obtain the list of planes defining the frustum. If [[isValid]] is `true`, it will have a length of six, with the planes ordered as\r\n * right, left, top, bottom, back, front. Otherwise, it will be empty.\r\n */\r\n public get planes(): ClipPlane[] {\r\n return this._planes;\r\n }\r\n\r\n /** Recompute the planes from the specified frustum.\r\n * @returns true upon success, or false if the input frustum was degenerate, in which case [[isValid]] will be `false`.\r\n * @note This method assumes that the front plane is parallel to the back plane.\r\n */\r\n public init(frustum: Frustum): boolean {\r\n this._planes = computeFrustumPlanes(frustum);\r\n return this.isValid;\r\n }\r\n\r\n /** Compute to what degree a [[Frustum]] is contained with these frustum planes.\r\n * @param box The frustum to test for containment.\r\n * @param sphere An optional spherical bounding volume fully containing `box`. If supplied, this can reduce the amount of computation required.\r\n * @returns the degree to which `box` is contained within the clipping planes.\r\n */\r\n public computeFrustumContainment(box: Frustum, sphere?: BoundingSphere): FrustumPlanes.Containment {\r\n return this.computeContainment(box.points, sphere);\r\n }\r\n\r\n /** Determines whether a [[Frustum]] intersects with or is fully contained within these frustum planes.\r\n * @param box The frustum to test for containment.\r\n * @param sphere An optional spherical bounding volume fully containing `box`. If supplied, this can reduce the amount of computation required.\r\n * @returns true if `box` is not entirely outside of the clipping planes.\r\n */\r\n public intersectsFrustum(box: Frustum, sphere?: BoundingSphere): boolean {\r\n return FrustumPlanes.Containment.Outside !== this.computeFrustumContainment(box, sphere);\r\n }\r\n\r\n /** Determines whether a point is contained within these frustum planes.\r\n * @param point The point to test for containment.\r\n * @param tolerance The maximum distance from the interior of the frustum planes that will still be considered \"contained\".\r\n * @returns true if `point` is no further than `tolerance` meters outside of the clipping planes.\r\n */\r\n public containsPoint(point: Point3d, tolerance: number = 1.0e-8): boolean {\r\n return FrustumPlanes.Containment.Outside !== this.computeContainment([point], undefined, tolerance);\r\n }\r\n\r\n /** Compute the degree to which a set of points is contained within these frustum planes.\r\n * @param points The points to test for containment.\r\n * @param sphere An optional spherical bounding volume fully containing all of the points. If supplied, this can reduce the amount of computation required.\r\n * @param tolerance The maximum distance from the interior of the frustum planes a point must be to be considered \"contained\".\r\n * @returns the degree to which all of the points are contained within the clipping planes.\r\n */\r\n public computeContainment(points: Point3d[], sphere?: BoundingSphere, tolerance: number = 1.0e-8): FrustumPlanes.Containment {\r\n if (undefined === this._planes)\r\n return FrustumPlanes.Containment.Outside;\r\n\r\n // Do the cheap test against bounding sphere first.\r\n if (sphere) {\r\n for (let i = 0; i < this._planes.length; i++) {\r\n const plane = this._planes[i];\r\n const centerDistance = plane.altitude(sphere.center);\r\n const tolerancePlusRadius = tolerance + sphere.radius;\r\n if (centerDistance < -tolerancePlusRadius)\r\n return FrustumPlanes.Containment.Outside;\r\n\r\n planesContainingSphere[i] = centerDistance > tolerancePlusRadius;\r\n }\r\n }\r\n\r\n // Test against points.\r\n let allInside = true;\r\n for (let i = 0; i < this._planes.length; i++) {\r\n if (sphere && planesContainingSphere[i])\r\n continue;\r\n\r\n const plane = this._planes[i];\r\n let nOutside = 0;\r\n for (const point of points) {\r\n if (plane.altitude(point) + tolerance < 0) {\r\n ++nOutside;\r\n allInside = false;\r\n }\r\n }\r\n\r\n if (nOutside === points.length)\r\n return FrustumPlanes.Containment.Outside;\r\n }\r\n\r\n return allInside ? FrustumPlanes.Containment.Inside : FrustumPlanes.Containment.Partial;\r\n }\r\n\r\n /** Computes whether a ray intersects these clipping planes.\r\n * @param origin The origin of the ray.\r\n * @param direction The direction of the ray.\r\n * @returns true if the ray extending from `origin` in the specified `direction` intersects at least one of the clipping planes.\r\n */\r\n public intersectsRay(origin: Point3d, direction: Vector3d): boolean {\r\n if (undefined === this._planes) {\r\n return false;\r\n }\r\n\r\n let tFar = 1e37;\r\n let tNear = -tFar;\r\n\r\n for (const plane of this._planes) {\r\n const vD = plane.velocity(direction);\r\n const vN = plane.altitude(origin);\r\n if (0.0 === vD) {\r\n // ray is parallel... no need to continue testing if outside halfspace.\r\n if (vN < 0.0) {\r\n return false;\r\n }\r\n } else {\r\n const rayDistance = -vN / vD;\r\n if (vD < 0.0) {\r\n tFar = Math.min(rayDistance, tFar);\r\n } else {\r\n tNear = Math.max(rayDistance, tNear);\r\n }\r\n }\r\n }\r\n\r\n return tNear <= tFar;\r\n }\r\n}\r\n\r\n/** @public @extensions */\r\nexport namespace FrustumPlanes {\r\n /** Describes the degree to which an object is contained within the planes of a [[Frustum]].\r\n * @see [[FrustumPlanes.computeContainment]], for example.\r\n */\r\n export enum Containment {\r\n /** The object is entirely outside of the frustum, intersecting none of its planes. */\r\n Outside = 0,\r\n /** The object intersects at least one of the frustum planes. placing it partially inside of the frustum. */\r\n Partial = 1,\r\n /** The object is entirely inside of the frustum, intersecting none of its planes. */\r\n Inside = 2,\r\n }\r\n}\r\n"]}
|
|
@@ -241,7 +241,7 @@ class GeometryStreamBuilder {
|
|
|
241
241
|
return true;
|
|
242
242
|
}
|
|
243
243
|
const entityTrans = core_geometry_1.Transform.fromJSON(brep.transform);
|
|
244
|
-
const localTrans =
|
|
244
|
+
const localTrans = this._worldToLocal.multiplyTransformTransform(entityTrans);
|
|
245
245
|
const localBrep = {
|
|
246
246
|
data: brep.data,
|
|
247
247
|
type: brep.type,
|
|
@@ -468,7 +468,7 @@ class GeometryStreamIterator {
|
|
|
468
468
|
else if (entry.brep) {
|
|
469
469
|
if (this.entry.localToWorld !== undefined) {
|
|
470
470
|
const entityTrans = core_geometry_1.Transform.fromJSON(entry.brep.transform);
|
|
471
|
-
entry.brep.transform =
|
|
471
|
+
entry.brep.transform = this.entry.localToWorld.multiplyTransformTransform(entityTrans).toJSON();
|
|
472
472
|
}
|
|
473
473
|
this.entry.setBRep(entry.brep);
|
|
474
474
|
return { value: this.entry, done: false };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeometryStream.js","sourceRoot":"","sources":["../../../src/geometry/GeometryStream.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAqE;AACrE,wDAG8B;AAC9B,0CAAsD;AACtD,kDAA0I;AAC1I,sDAA+F;AAC/F,0CAAuC;AACvC,gDAA6C;AAC7C,+CAA4C;AAC5C,iDAAiE;AACjE,2CAAwC;AACxC,6CAA2D;AAE3D,2CAAuD;AA6DvD;;GAEG;AACH,IAAiB,UAAU,CAkC1B;AAlCD,WAAiB,UAAU;IACzB,2DAA2D;IAC3D,IAAY,IAOX;IAPD,WAAY,IAAI;QACd,mDAAmD;QACnD,iCAAS,CAAA;QACT,wGAAwG;QACxG,iCAAS,CAAA;QACT,2GAA2G;QAC3G,+BAAQ,CAAA;IACV,CAAC,EAPW,IAAI,GAAJ,eAAI,KAAJ,eAAI,QAOf;AAyBH,CAAC,EAlCgB,UAAU,0BAAV,UAAU,QAkC1B;AAkBD;;;;GAIG;AACH,IAAY,mBAOX;AAPD,WAAY,mBAAmB;IAC7B,gBAAgB;IAChB,6DAAQ,CAAA;IACR;;OAEG;IACH,mFAAwB,CAAA;AAC1B,CAAC,EAPW,mBAAmB,mCAAnB,mBAAmB,QAO9B;AAqCD;;GAEG;AACH,MAAa,qBAAqB;IAAlC;QAGE,6BAA6B;QACb,mBAAc,GAAwB,EAAE,CAAC;IA2P3D,CAAC;IAzPC;;;OAGG;IACI,eAAe,CAAC,YAAwB;QAC7C,IAAI,CAAC,aAAa,GAAG,CAAC,SAAS,KAAK,YAAY,IAAI,YAAY,CAAC,UAAU,CAAC,CAA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AK,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;gBAC3C,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;YAC5C,CAAC;QACH,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC3C,CAAC;IAEM,CAAC,MAAM,CAAC,QAAQ,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,gBAAgB;IAChB,IAAW,iBAAiB,KAAc,OAAO,mBAAmB,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,mBAAmB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;CACpI;AAhND,wDAgNC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Geometry\r\n */\r\n\r\nimport { Id64, Id64String, IModelStatus } from \"@itwin/core-bentley\";\r\nimport {\r\n Angle, AnyGeometryQuery, GeometryQuery, IModelJson as GeomJson, LineSegment3d, LowAndHighXYZ, Matrix3d, Point2d, Point3d, Range3d, Transform, TransformProps,\r\n Vector3d, XYZProps, YawPitchRollAngles, YawPitchRollProps,\r\n} from \"@itwin/core-geometry\";\r\nimport { ColorDef, ColorDefProps } from \"../ColorDef\";\r\nimport { GeometricElement2dProps, GeometricElement3dProps, GeometryPartProps, isPlacement2dProps, PlacementProps } from \"../ElementProps\";\r\nimport { BackgroundFill, FillDisplay, GeometryClass, GeometryParams } from \"../GeometryParams\";\r\nimport { Gradient } from \"../Gradient\";\r\nimport { IModelError } from \"../IModelError\";\r\nimport { AreaPattern } from \"./AreaPattern\";\r\nimport { ImageGraphic, ImageGraphicProps } from \"./ImageGraphic\";\r\nimport { LineStyle } from \"./LineStyle\";\r\nimport { TextString, TextStringProps } from \"./TextString\";\r\nimport { Base64EncodedString } from \"../Base64EncodedString\";\r\nimport { Placement2d, Placement3d } from \"./Placement\";\r\nimport { TextBlockGeometryProps } from \"../annotation/TextBlockGeometryProps\";\r\n\r\n/** Establish a non-default [[SubCategory]] or to override [[SubCategoryAppearance]] for the geometry that follows.\r\n * A GeometryAppearanceProps always signifies a reset to the [[SubCategoryAppearance]] for subsequent [[GeometryStreamProps]] entries for undefined values.\r\n * @see [[GeometryStreamEntryProps]]\r\n * @public\r\n * @extensions\r\n */\r\nexport interface GeometryAppearanceProps {\r\n /** Optional [[SubCategory]] id for subsequent geometry. Use to create a GeometryStream with geometry that is not on the default [[SubCategory]] for the element's [[Category]] or is has geometry on multiple subCategories. */\r\n subCategory?: Id64String;\r\n /** Optional color to override [[SubCategoryAppearance.color]] for subsequent geometry. */\r\n color?: ColorDefProps;\r\n /** Optional weight to override [[SubCategoryAppearance.weight]] for subsequent geometry. */\r\n weight?: number;\r\n /** Optional style to override [[SubCategoryAppearance.styleId]] for subsequent geometry. */\r\n style?: Id64String;\r\n /** Optional transparency, 0.0 if undefined. Effective transparency is a combination of this value and [[SubCategoryAppearance.color]]. */\r\n transparency?: number;\r\n /** Optional display priority (2d only), 0 if undefined. Effective display priority is a combination of this value and [[SubCategoryAppearance.priority]]. */\r\n displayPriority?: number;\r\n /** Optional GeometryClass (for DGN compatibility, subCategories preferred), [[GeometryClass.Primary]] if undefined. */\r\n geometryClass?: GeometryClass;\r\n}\r\n\r\n/** Add a [[gradient]], [[backgroundFill]], or solid [[color]] fill to subsequent planar regions (or meshes).\r\n * Only one value among [[gradient]], [[backgroundFill]], and [[color]] should be set.\r\n * @see [[GeometryStreamEntryProps]]\r\n * @public\r\n * @extensions\r\n */\r\nexport interface AreaFillProps {\r\n /** Fill display type, must be set to something other than [[FillDisplay.Never]] to display fill */\r\n display: FillDisplay;\r\n /** Optional fill transparency, will be the same as outline transparency if undefined. Allows for different fill and outline transparencies */\r\n transparency?: number;\r\n /** Set fill color to view background color. Use [[BackgroundFill.Solid]] for an opaque fill and [[BackgroundFill.Outline]] to display an outline using the line color */\r\n backgroundFill?: BackgroundFill;\r\n /** Set fill color to a specific color. If the fill color the same as the line color, it is an opaque fill, otherwise it is an outline fill */\r\n color?: ColorDefProps;\r\n /** Set fill using gradient properties. */\r\n gradient?: Gradient.SymbProps;\r\n}\r\n\r\n/** Override [[SubCategoryAppearance.materialId]] for subsequent surface and solid geometry.\r\n * @see [[GeometryStreamEntryProps]]\r\n * @public\r\n * @extensions\r\n */\r\nexport interface MaterialProps {\r\n /** Material id to use, specify an invalid [[Id64]] to override [[SubCategoryAppearance.materialId]] with no material. */\r\n materialId?: Id64String;\r\n /** @internal */\r\n origin?: XYZProps;\r\n /** @internal */\r\n size?: XYZProps;\r\n /** @internal */\r\n rotation?: YawPitchRollProps;\r\n}\r\n\r\n/** JSON representation of a brep GeometryStream entry.\r\n * @public\r\n */\r\nexport namespace BRepEntity {\r\n /** Enum for type of solid kernel entity this represents */\r\n export enum Type {\r\n /** Body consisting of at least one solid region */\r\n Solid = 0,\r\n /** Body consisting of connected sets of faces having edges that are shared by a maximum of two faces */\r\n Sheet = 1,\r\n /** Body consisting of connected sets of edges having vertices that are shared by a maximum of two edges */\r\n Wire = 2,\r\n }\r\n\r\n /** Optional symbology that can be assigned to individual faces of a solid or sheet body */\r\n export interface FaceSymbologyProps {\r\n /** Optional color override for face */\r\n color?: ColorDefProps;\r\n /** Optional transparency override for face */\r\n transparency?: number;\r\n /** Optional material override for face */\r\n materialId?: Id64String;\r\n }\r\n\r\n /** Geometry entry representing raw brep data.\r\n * @see [[GeometryStreamEntryProps]]\r\n */\r\n export interface DataProps {\r\n /** data as Base64 encoded string. Must be specifically requested using [[ElementLoadProps.wantBRepData]]. */\r\n data?: Base64EncodedString;\r\n /** body type, default is Solid */\r\n type?: Type;\r\n /** body transform, default is identity */\r\n transform?: TransformProps;\r\n /** body face attachments */\r\n faceSymbology?: FaceSymbologyProps[];\r\n }\r\n}\r\n\r\n/** Add a reference to a [[GeometryPart]] from the GeometryStream of a [[GeometricElement]].\r\n * @see [[GeometryStreamEntryProps]]\r\n * @public\r\n * @extensions\r\n */\r\nexport interface GeometryPartInstanceProps {\r\n /** GeometryPart id */\r\n part: Id64String;\r\n /** Optional translation relative to element's placement, 0.0,0.0,0.0 if undefined. For a 2d element/translation, supply non-zero x and y only */\r\n origin?: XYZProps;\r\n /** Optional rotation relative to element's placement, 0.0,0.0,0.0 if undefined. For a 2d element/rotation, supply a non-zero yaw angle only */\r\n rotation?: YawPitchRollProps;\r\n /** Optional scale to apply to part, 1.0 if undefined */\r\n scale?: number;\r\n}\r\n\r\n/** Flags applied to the entire contents of a [[GeometryStreamProps]].\r\n * @see GeometryStreamHeaderProps\r\n * @public\r\n * @extensions\r\n */\r\nexport enum GeometryStreamFlags {\r\n /** No flags. */\r\n None = 0,\r\n /** When the geometry is displayed, it is always oriented to face the viewer. The placement origin of the element associated with the geometry is used as the rotation point.\r\n * If the placement origin is outside of the view, the geometry will not necessarily be displayed, even if rotating it to face the viewer would cause its range to intersect the viewed volume.\r\n */\r\n ViewIndependent = 1 << 0,\r\n}\r\n\r\n/** An entry in a [[GeometryStreamProps]] containing [[GeometryStreamFlags]] that apply to the geometry stream as a whole.\r\n * If this entry exists in the [[GeometryStreamProps]] array, it will always be the *first* entry.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface GeometryStreamHeaderProps {\r\n /** The flags applied to the geometry stream. */\r\n flags: GeometryStreamFlags;\r\n}\r\n\r\n/** Allowed GeometryStream entries - should only set one value.\r\n * @see [GeometryStream]($docs/learning/common/geometrystream.md)\r\n * @public\r\n * @extensions\r\n */\r\nexport interface GeometryStreamEntryProps extends GeomJson.GeometryProps {\r\n header?: GeometryStreamHeaderProps;\r\n appearance?: GeometryAppearanceProps;\r\n styleMod?: LineStyle.ModifierProps;\r\n fill?: AreaFillProps;\r\n pattern?: AreaPattern.ParamsProps;\r\n material?: MaterialProps;\r\n geomPart?: GeometryPartInstanceProps;\r\n textString?: TextStringProps;\r\n brep?: BRepEntity.DataProps;\r\n image?: ImageGraphicProps;\r\n subRange?: LowAndHighXYZ;\r\n}\r\n\r\n/** A [[GeometricElement]]'s GeometryStream is represented by an array of [[GeometryStreamEntryProps]].\r\n * @public\r\n * @extensions\r\n */\r\nexport type GeometryStreamProps = GeometryStreamEntryProps[];\r\n\r\n/** GeometryStreamBuilder is a helper class for populating the [[GeometryStreamProps]] array needed to create a [[GeometricElement]] or [[GeometryPart]].\r\n * @public\r\n */\r\nexport class GeometryStreamBuilder {\r\n /** Current inverse placement transform, used for converting world coordinate input to be placement relative */\r\n private _worldToLocal?: Transform;\r\n /** GeometryStream entries */\r\n public readonly geometryStream: GeometryStreamProps = [];\r\n\r\n /** Supply optional local to world transform. Used to transform world coordinate input relative to element placement.\r\n * For a [[GeometricElement]]'s placement to be meaningful, world coordinate geometry should never be appended to an element with an identity placement.\r\n * Can be called with undefined or identity transform to start appending geometry supplied in local coordinates again.\r\n */\r\n public setLocalToWorld(localToWorld?: Transform) {\r\n this._worldToLocal = (undefined === localToWorld || localToWorld.isIdentity ? undefined : localToWorld.inverse());\r\n }\r\n\r\n /** Supply local to world transform from a Point3d and optional YawPitchRollAngles.\r\n * @see [[Placement3d]]\r\n */\r\n public setLocalToWorld3d(origin: Point3d, angles: YawPitchRollAngles = YawPitchRollAngles.createDegrees(0.0, 0.0, 0.0)) {\r\n this.setLocalToWorld(Transform.createOriginAndMatrix(origin, angles.toMatrix3d()));\r\n }\r\n\r\n /** Supply local to world transform from a Point2d and optional Angle.\r\n * @see [[Placement2d]]\r\n */\r\n public setLocalToWorld2d(origin: Point2d, angle: Angle = Angle.createDegrees(0.0)) {\r\n this.setLocalToWorld(Transform.createOriginAndMatrix(Point3d.createFrom(origin), Matrix3d.createRotationAroundVector(Vector3d.unitZ(), angle)));\r\n }\r\n\r\n /** Supply local to world transform from a PlacementProps2d or PlacementProps3d.\r\n * @see [[PlacementProps]]\r\n */\r\n public setLocalToWorldFromPlacement(props: PlacementProps) {\r\n const placement = isPlacement2dProps(props) ? Placement2d.fromJSON(props) : Placement3d.fromJSON(props);\r\n this.setLocalToWorld(placement.transform);\r\n }\r\n\r\n /** Store local ranges in GeometryStream for all subsequent geometry appended. Can improve performance of range testing for elements with a GeometryStream\r\n * containing more than one [[GeometryQuery]] differentiable by range. Not useful for a single [[GeometryQuery]] as its range and that of the [[GeometricElement]] are the same.\r\n * Ignored when defining a [[GeometryPart]] and not needed when only appending [[GeometryPart]] instances to a [[GeometricElement]] as these store their own range.\r\n */\r\n public appendGeometryRanges() {\r\n this.geometryStream.push({ subRange: Range3d.createNull() });\r\n }\r\n\r\n /** Change [[SubCategory]] or reset to [[SubCategoryAppearance]] for subsequent geometry.\r\n * An invalid sub-category id can be supplied to force a reset to the current [[SubCategoryAppearance]].\r\n * It is not valid to change the sub-category when defining a [[GeometryPart]]. A [[GeometryPart]] inherit the symbology of their instance for anything not explicitly overridden.\r\n */\r\n public appendSubCategoryChange(subCategoryId: Id64String): boolean {\r\n this.geometryStream.push({ appearance: { subCategory: subCategoryId } });\r\n return true;\r\n }\r\n\r\n /** Change [[GeometryParams]] for subsequent geometry.\r\n * It is not valid to change the sub-category when defining a [[GeometryPart]]. A [[GeometryPart]] inherits the symbology of their instance for anything not explicitly overridden.\r\n */\r\n public appendGeometryParamsChange(geomParams: GeometryParams): boolean {\r\n const appearance: GeometryAppearanceProps = {\r\n subCategory: geomParams.subCategoryId,\r\n color: geomParams.lineColor?.toJSON(),\r\n weight: geomParams.weight,\r\n style: geomParams.styleInfo?.styleId,\r\n transparency: geomParams.elmTransparency,\r\n displayPriority: geomParams.elmPriority,\r\n geometryClass: geomParams.geometryClass,\r\n };\r\n this.geometryStream.push({ appearance });\r\n\r\n if (undefined !== geomParams.materialId)\r\n this.geometryStream.push({ material: { materialId: geomParams.materialId } });\r\n\r\n if (undefined !== geomParams.fillDisplay && FillDisplay.Never !== geomParams.fillDisplay) {\r\n const fill: AreaFillProps = {\r\n display: geomParams.fillDisplay,\r\n transparency: geomParams.fillTransparency,\r\n };\r\n if (undefined !== geomParams.gradient && Gradient.Mode.None !== geomParams.gradient.mode)\r\n fill.gradient = geomParams.gradient?.toJSON();\r\n else if (undefined !== geomParams.backgroundFill && BackgroundFill.None !== geomParams.backgroundFill)\r\n fill.backgroundFill = geomParams.backgroundFill;\r\n else if (undefined !== geomParams.fillColor)\r\n fill.color = geomParams.fillColor.toJSON();\r\n this.geometryStream.push({ fill });\r\n }\r\n\r\n if (undefined !== geomParams.pattern) {\r\n const localPattern = this._worldToLocal ? geomParams.pattern.clone() : geomParams.pattern;\r\n if (undefined !== this._worldToLocal && !localPattern.applyTransform(this._worldToLocal))\r\n return false;\r\n\r\n this.geometryStream.push({ pattern: localPattern.toJSON() });\r\n }\r\n\r\n if (undefined !== geomParams.styleInfo && undefined !== geomParams.styleInfo.styleMod) {\r\n const localStyleMod = new LineStyle.Modifier(geomParams.styleInfo.styleMod);\r\n if (undefined !== this._worldToLocal && !localStyleMod.applyTransform(this._worldToLocal))\r\n return false;\r\n this.geometryStream.push({ styleMod: localStyleMod });\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /** Append a [[GeometryPart]] instance with relative position, orientation, and scale to a [[GeometryStreamProps]] array for creating a [[GeometricElement3d]].\r\n * Not valid when defining a [[GeometryPart]] as nesting of parts is not supported.\r\n */\r\n public appendGeometryPart3d(partId: Id64String, instanceOrigin?: Point3d, instanceRotation?: YawPitchRollAngles, instanceScale?: number): boolean {\r\n if (undefined === this._worldToLocal) {\r\n this.geometryStream.push({ geomPart: { part: partId, origin: instanceOrigin, rotation: instanceRotation, scale: instanceScale } });\r\n return true;\r\n }\r\n const partTrans = Transform.createOriginAndMatrix(instanceOrigin, instanceRotation ? instanceRotation.toMatrix3d() : Matrix3d.createIdentity());\r\n if (undefined !== instanceScale)\r\n partTrans.matrix.scaleColumnsInPlace(instanceScale, instanceScale, instanceScale);\r\n const resultTrans = this._worldToLocal.multiplyTransformTransform(partTrans);\r\n const scales = new Vector3d();\r\n if (!resultTrans.matrix.normalizeColumnsInPlace(scales))\r\n return false;\r\n const newRotation = YawPitchRollAngles.createFromMatrix3d(resultTrans.matrix);\r\n if (undefined === newRotation)\r\n return false;\r\n this.geometryStream.push({ geomPart: { part: partId, origin: resultTrans.getOrigin(), rotation: newRotation, scale: scales.x } });\r\n return true;\r\n }\r\n\r\n /** Append a [[GeometryPart]] instance with relative position, orientation, and scale to a [[GeometryStreamProps]] array for creating a [[GeometricElement2d]].\r\n * Not valid when defining a [[GeometryPart]] as nesting of parts is not supported.\r\n */\r\n public appendGeometryPart2d(partId: Id64String, instanceOrigin?: Point2d, instanceRotation?: Angle, instanceScale?: number): boolean {\r\n return this.appendGeometryPart3d(partId, instanceOrigin ? Point3d.createFrom(instanceOrigin) : undefined, instanceRotation ? new YawPitchRollAngles(instanceRotation) : undefined, instanceScale);\r\n }\r\n\r\n /** Append a [[TextString]] supplied in either local or world coordinates to the [[GeometryStreamProps]] array */\r\n public appendTextString(textString: TextString): boolean {\r\n if (this._worldToLocal) {\r\n textString = new TextString(textString);\r\n if (!textString.transformInPlace(this._worldToLocal)) {\r\n return false;\r\n }\r\n }\r\n\r\n this.geometryStream.push({ textString: textString.toJSON() });\r\n return true;\r\n }\r\n\r\n /** Append a series of entries representing a [[TextBlock]] to the [[GeometryStreamProps]] array.\r\n * @beta\r\n */\r\n public appendTextBlock(block: TextBlockGeometryProps): boolean {\r\n for (const entry of block.entries) {\r\n let result: boolean;\r\n if (undefined !== entry.text) {\r\n result = this.appendTextString(new TextString(entry.text));\r\n } else if (undefined !== entry.color) {\r\n if (entry.color === \"subcategory\") {\r\n result = this.appendSubCategoryChange(Id64.invalid);\r\n } else {\r\n this.geometryStream.push({ appearance: { color: entry.color } });\r\n result = true;\r\n }\r\n } else {\r\n result = this.appendGeometry(LineSegment3d.fromJSON(entry.separator));\r\n }\r\n\r\n if (!result) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /** Append an [[ImageGraphic]] supplied in either local or world coordinates. */\r\n public appendImage(image: ImageGraphic): boolean {\r\n if (undefined !== this._worldToLocal)\r\n image = image.cloneTransformed(this._worldToLocal);\r\n\r\n this.geometryStream.push({ image: image.toJSON() });\r\n return true;\r\n }\r\n\r\n /** Append a [[GeometryQuery]] supplied in either local or world coordinates to the [[GeometryStreamProps]] array */\r\n public appendGeometry(geometry: GeometryQuery): boolean {\r\n if (undefined === this._worldToLocal) {\r\n const geomData = GeomJson.Writer.toIModelJson(geometry);\r\n if (undefined === geomData)\r\n return false;\r\n this.geometryStream.push(geomData);\r\n return true;\r\n }\r\n const localGeometry = geometry.cloneTransformed(this._worldToLocal);\r\n if (undefined === localGeometry)\r\n return false;\r\n const localGeomData = GeomJson.Writer.toIModelJson(localGeometry);\r\n if (undefined === localGeomData)\r\n return false;\r\n this.geometryStream.push(localGeomData);\r\n return true;\r\n }\r\n\r\n /** Append [[BRepEntity.DataProps]] supplied in either local or world coordinates to the [[GeometryStreamProps]] array\r\n * @beta\r\n */\r\n public appendBRepData(brep: BRepEntity.DataProps): boolean {\r\n if (undefined === this._worldToLocal) {\r\n this.geometryStream.push({ brep });\r\n return true;\r\n }\r\n const entityTrans = Transform.fromJSON(brep.transform);\r\n const localTrans = entityTrans.multiplyTransformTransform(this._worldToLocal);\r\n const localBrep: BRepEntity.DataProps = {\r\n data: brep.data,\r\n type: brep.type,\r\n transform: localTrans.isIdentity ? undefined : localTrans.toJSON(),\r\n faceSymbology: brep.faceSymbology,\r\n };\r\n this.geometryStream.push({ brep: localBrep });\r\n return true;\r\n }\r\n\r\n /** @internal */\r\n public getHeader(): GeometryStreamHeaderProps | undefined {\r\n return 0 < this.geometryStream.length ? this.geometryStream[0].header : undefined;\r\n }\r\n\r\n /** @internal */\r\n public obtainHeader(): GeometryStreamHeaderProps {\r\n const hdr = this.getHeader();\r\n if (undefined !== hdr)\r\n return hdr;\r\n\r\n const entry = { header: { flags: GeometryStreamFlags.None } };\r\n this.geometryStream.unshift(entry);\r\n return entry.header;\r\n }\r\n\r\n /** Controls whether or not the geometry in the stream should be displayed as view-independent.\r\n * When view-independent geometry is displayed, it is always oriented to face the viewer, using the placement origin of the element as the rotation point.\r\n * If the placement origin is outside of the view, the geometry will not necessarily be displayed, even if rotating it to face the viewer would cause its range to intersect the viewed volume\r\n * @public\r\n */\r\n public get isViewIndependent(): boolean {\r\n const hdr = this.getHeader();\r\n return undefined !== hdr && GeometryStreamFlags.None !== (hdr.flags & GeometryStreamFlags.ViewIndependent);\r\n }\r\n public set isViewIndependent(viewIndependent: boolean) {\r\n if (viewIndependent === this.isViewIndependent)\r\n return;\r\n\r\n const hdr = this.obtainHeader();\r\n if (viewIndependent)\r\n hdr.flags |= GeometryStreamFlags.ViewIndependent;\r\n else\r\n hdr.flags &= ~GeometryStreamFlags.ViewIndependent;\r\n }\r\n}\r\n\r\n/** Represents a text string within a GeometryStream.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface TextStringPrimitive {\r\n type: \"textString\";\r\n readonly textString: TextString;\r\n}\r\n\r\n/** Represents an image within a GeometryStream.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface ImagePrimitive {\r\n type: \"image\";\r\n readonly image: ImageGraphic;\r\n}\r\n\r\n/** Represents a reference to a GeometryPart within a GeometryStream.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface PartReference {\r\n type: \"partReference\";\r\n part: {\r\n id: Id64String;\r\n readonly toLocal?: Transform;\r\n };\r\n}\r\n\r\n/** Represents a BRep within a GeometryStream.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface BRepPrimitive {\r\n type: \"brep\";\r\n /** @beta */\r\n readonly brep: BRepEntity.DataProps;\r\n}\r\n\r\n/** Represents one of a variety of GeometryQuery objects within a GeometryStream.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface GeometryPrimitive {\r\n type: \"geometryQuery\";\r\n readonly geometry: AnyGeometryQuery;\r\n}\r\n\r\n/** Union of all possible geometric primitive types that may appear within a GeometryStream.\r\n * @public\r\n * @extensions\r\n */\r\nexport type GeometryStreamPrimitive = TextStringPrimitive | PartReference | BRepPrimitive | GeometryPrimitive | ImagePrimitive;\r\n\r\n/** Holds current state information for [[GeometryStreamIterator]]. Each entry represents exactly one geometry primitive in the stream.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface GeometryStreamIteratorEntry {\r\n /** A [[GeometryParams]] representing the appearance of the current geometric entry */\r\n readonly geomParams: GeometryParams;\r\n /** Placement transform, used for converting placement relative, local coordinate entries to world */\r\n readonly localToWorld?: Transform;\r\n /** Optional stored local range for the current geometric entry */\r\n readonly localRange?: Range3d;\r\n /** Returns the geometric primitive represented by this entry. */\r\n readonly primitive: GeometryStreamPrimitive;\r\n}\r\n\r\nclass IteratorEntry implements GeometryStreamIteratorEntry {\r\n private _primitive?: GeometryStreamPrimitive;\r\n public readonly geomParams: GeometryParams;\r\n public readonly localToWorld?: Transform;\r\n public localRange?: Range3d;\r\n\r\n public constructor(appearance: Id64String | GeometryParams, localToWorld?: Transform) {\r\n this.geomParams = typeof appearance === \"string\" ? new GeometryParams(appearance) : appearance;\r\n this.localToWorld = localToWorld;\r\n }\r\n\r\n public get primitive() { return this._primitive!; }\r\n public set primitive(primitive: GeometryStreamPrimitive) { this._primitive = primitive; }\r\n\r\n public setGeometryQuery(geometry: AnyGeometryQuery) { this._primitive = { type: \"geometryQuery\", geometry }; }\r\n public setTextString(textString: TextString) { this._primitive = { type: \"textString\", textString }; }\r\n public setBRep(brep: BRepEntity.DataProps) { this._primitive = { type: \"brep\", brep }; }\r\n public setImage(image: ImageGraphic) { this._primitive = { type: \"image\", image }; }\r\n public setPartReference(id: Id64String, toLocal?: Transform) {\r\n this._primitive = {\r\n type: \"partReference\",\r\n part: { id, toLocal },\r\n };\r\n }\r\n}\r\n\r\n/** GeometryStreamIterator is a helper class for iterating a [[GeometryStreamProps]].\r\n * A [[GeometricElement]]'s GeometryStream must be specifically requested using [[ElementLoadProps.wantGeometry]].\r\n * Each [[GeometryStreamIteratorEntry]] returned by the iterator represents exactly one geometric primitive in the stream.\r\n * @public\r\n */\r\nexport class GeometryStreamIterator implements IterableIterator<GeometryStreamIteratorEntry> {\r\n /** GeometryStream entries */\r\n public geometryStream: GeometryStreamProps;\r\n /** Flags applied to the entire geometry stream. */\r\n public readonly flags: GeometryStreamFlags;\r\n /** Current entry position */\r\n private _index = 0;\r\n /** Allocated on first call to next() and reused thereafter. */\r\n private _entry?: IteratorEntry;\r\n /** Used to initialize this._entry. */\r\n private readonly _appearance: Id64String | GeometryParams;\r\n private readonly _localToWorld?: Transform;\r\n\r\n /** Construct a new GeometryStreamIterator given a [[GeometryStreamProps]] from either a [[GeometricElement3d]], [[GeometricElement2d]], or [[GeometryPart]].\r\n * Supply the [[GeometricElement]]'s category to initialize the appearance information for each geometric entry.\r\n */\r\n public constructor(geometryStream: GeometryStreamProps, categoryOrGeometryParams?: Id64String | GeometryParams, localToWorld?: Transform) {\r\n this.geometryStream = geometryStream;\r\n this._appearance = categoryOrGeometryParams ?? Id64.invalid;\r\n this._localToWorld = localToWorld;\r\n if (0 < geometryStream.length && undefined !== geometryStream[0].header) {\r\n this.flags = geometryStream[0].header.flags;\r\n ++this._index;\r\n } else {\r\n this.flags = GeometryStreamFlags.None;\r\n }\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private get entry() {\r\n if (undefined === this._entry)\r\n this._entry = new IteratorEntry(this._appearance, this._localToWorld);\r\n\r\n return this._entry;\r\n }\r\n\r\n /** Create a new GeometryStream iterator for a [[GeometricElement3d]].\r\n * If [[GeometricElement3dProps.placement]] is not undefined, placement relative entries will be returned transformed to world coordinates.\r\n * @throws [[IModelError]] if element.geom is undefined.\r\n */\r\n public static fromGeometricElement3d(element: Pick<GeometricElement3dProps, \"geom\" | \"placement\" | \"category\">) {\r\n if (element.geom === undefined)\r\n throw new IModelError(IModelStatus.NoGeometry, \"GeometricElement has no geometry or geometry wasn't requested\");\r\n\r\n let transform;\r\n if (element.placement !== undefined)\r\n transform = Transform.createOriginAndMatrix(Point3d.fromJSON(element.placement.origin), YawPitchRollAngles.fromJSON(element.placement.angles).toMatrix3d());\r\n\r\n return new GeometryStreamIterator(element.geom, element.category, transform);\r\n }\r\n\r\n /** Create a new GeometryStream iterator for a [[GeometricElement2d]].\r\n * If [[GeometricElement2dProps.placement]] is not undefined, placement relative entries will be returned transformed to world coordinates.\r\n * @throws [[IModelError]] if element.geom is undefined.\r\n */\r\n public static fromGeometricElement2d(element: Pick<GeometricElement2dProps, \"geom\" | \"placement\" | \"category\">) {\r\n if (element.geom === undefined)\r\n throw new IModelError(IModelStatus.NoGeometry, \"GeometricElement has no geometry or geometry wasn't requested\");\r\n\r\n let transform;\r\n if (element.placement !== undefined) {\r\n const origin = Point3d.createFrom(Point2d.fromJSON(element.placement.origin));\r\n const matrix = Matrix3d.createRotationAroundVector(Vector3d.unitZ(), Angle.fromJSON(element.placement.angle))!;\r\n transform = Transform.createOriginAndMatrix(origin, matrix);\r\n }\r\n\r\n return new GeometryStreamIterator(element.geom, element.category, transform);\r\n }\r\n\r\n /** Create a new GeometryStream iterator for a [[GeometryPart]].\r\n * To iterate a part's GeometryStream in the context of a part instance found for a [[GeometricElement]], provide the optional [[GeometryParams]] and Transform from the [[GeometricElement]]'s [[GeometryStreamIterator]].\r\n * Supply the [[GeometryParams]] to return appearance information as inherited from the [[GeometricElement]].\r\n * Supply the partToWorld transform to return the part geometry in world coordinates.\r\n * Supply the partToLocal transform to return the part geometry relative to the [[GeometricElement]]'s placement.\r\n * @throws [[IModelError]] if geomPart.geom is undefined.\r\n */\r\n public static fromGeometryPart(geomPart: Pick<GeometryPartProps, \"geom\">, geomParams?: GeometryParams, partTransform?: Transform) {\r\n if (geomPart.geom === undefined)\r\n throw new IModelError(IModelStatus.NoGeometry, \"GeometryPart has no geometry or geometry wasn't requested\");\r\n\r\n return new GeometryStreamIterator(geomPart.geom, geomParams?.clone(), partTransform);\r\n }\r\n\r\n /** Get the transform that if applied to a [[GeometryPart]]'s GeometryStream entries would return them in world coordinates. */\r\n public partToWorld(): Transform | undefined {\r\n if (undefined === this._entry)\r\n return this._localToWorld;\r\n\r\n const partToLocal = \"partReference\" === this._entry.primitive.type ? this._entry.primitive.part.toLocal : undefined;\r\n if (this._entry.localToWorld === undefined || partToLocal === undefined)\r\n return this._entry.localToWorld;\r\n\r\n return this._entry.localToWorld.multiplyTransformTransform(partToLocal);\r\n }\r\n\r\n /** Advance to next displayable geometric entry while updating the current [[GeometryParams]] from appearance related entries.\r\n * Geometric entries are [[TextString]], [[GeometryQuery]], [[GeometryPart]], [[ImageGraphic]], and [[BRepEntity.DataProps]].\r\n */\r\n public next(): IteratorResult<GeometryStreamIteratorEntry> {\r\n // NOTE: localRange remains valid until we encounter either a new subRange entry or a geometry part reference.\r\n while (this._index < this.geometryStream.length) {\r\n const entry = this.geometryStream[this._index++];\r\n if (entry.appearance) {\r\n this.entry.geomParams.resetAppearance();\r\n if (entry.appearance.subCategory)\r\n this.entry.geomParams.subCategoryId = Id64.fromJSON(entry.appearance.subCategory);\r\n if (undefined !== entry.appearance.color)\r\n this.entry.geomParams.lineColor = ColorDef.fromJSON(entry.appearance.color);\r\n if (undefined !== entry.appearance.weight)\r\n this.entry.geomParams.weight = entry.appearance.weight;\r\n if (undefined !== entry.appearance.style)\r\n this.entry.geomParams.styleInfo = new LineStyle.Info(Id64.fromJSON(entry.appearance.style));\r\n if (undefined !== entry.appearance.transparency)\r\n this.entry.geomParams.elmTransparency = entry.appearance.transparency;\r\n if (undefined !== entry.appearance.displayPriority)\r\n this.entry.geomParams.elmPriority = entry.appearance.displayPriority;\r\n if (undefined !== entry.appearance.geometryClass)\r\n this.entry.geomParams.geometryClass = entry.appearance.geometryClass;\r\n } else if (entry.styleMod) {\r\n if (this.entry.geomParams.styleInfo === undefined)\r\n continue;\r\n\r\n const styleMod = new LineStyle.Modifier(entry.styleMod);\r\n if (this.entry.localToWorld !== undefined)\r\n styleMod.applyTransform(this.entry.localToWorld);\r\n\r\n this.entry.geomParams.styleInfo = new LineStyle.Info(this.entry.geomParams.styleInfo.styleId, styleMod);\r\n } else if (entry.fill) {\r\n if (entry.fill.display)\r\n this.entry.geomParams.fillDisplay = entry.fill.display;\r\n if (entry.fill.transparency)\r\n this.entry.geomParams.fillTransparency = entry.fill.transparency;\r\n if (entry.fill.gradient)\r\n this.entry.geomParams.gradient = Gradient.Symb.fromJSON(entry.fill.gradient);\r\n else if (entry.fill.backgroundFill)\r\n this.entry.geomParams.backgroundFill = entry.fill.backgroundFill;\r\n else if (entry.fill.color)\r\n this.entry.geomParams.fillColor = ColorDef.fromJSON(entry.fill.color);\r\n } else if (entry.pattern) {\r\n const params = AreaPattern.Params.fromJSON(entry.pattern);\r\n if (this.entry.localToWorld !== undefined)\r\n params.applyTransform(this.entry.localToWorld);\r\n\r\n this.entry.geomParams.pattern = params;\r\n } else if (entry.material) {\r\n if (entry.material.materialId)\r\n this.entry.geomParams.materialId = Id64.fromJSON(entry.material.materialId);\r\n } else if (entry.subRange) {\r\n this.entry.localRange = Range3d.fromJSON(entry.subRange);\r\n } else if (entry.geomPart) {\r\n let transform;\r\n if (entry.geomPart.origin !== undefined || entry.geomPart.rotation !== undefined || entry.geomPart.scale !== undefined) {\r\n const origin = entry.geomPart.origin ? Point3d.fromJSON(entry.geomPart.origin) : Point3d.createZero();\r\n const rotation = entry.geomPart.rotation ? YawPitchRollAngles.fromJSON(entry.geomPart.rotation).toMatrix3d() : Matrix3d.createIdentity();\r\n transform = Transform.createRefs(origin, rotation);\r\n if (entry.geomPart.scale)\r\n transform.multiplyTransformTransform(Transform.createRefs(Point3d.createZero(), Matrix3d.createUniformScale(entry.geomPart.scale)), transform);\r\n }\r\n\r\n // Subgraphic range doesn't apply to parts. A sane geometry stream (i.e., any that has been through the native layers or GeometryStreamBuilder)\r\n // will have a new subgraphic range for any geometric primitive following the part.\r\n this.entry.localRange = undefined;\r\n this.entry.setPartReference(Id64.fromJSON(entry.geomPart.part), transform);\r\n return { value: this.entry, done: false };\r\n } else if (entry.textString) {\r\n const textString = new TextString(entry.textString);\r\n if (this.entry.localToWorld !== undefined)\r\n textString.transformInPlace(this.entry.localToWorld);\r\n\r\n this.entry.setTextString(textString);\r\n return { value: this.entry, done: false };\r\n } else if (entry.image) {\r\n const image = ImageGraphic.fromJSON(entry.image);\r\n if (undefined !== this.entry.localToWorld)\r\n image.transformInPlace(this.entry.localToWorld);\r\n\r\n this.entry.setImage(image);\r\n return { value: this.entry, done: false };\r\n } else if (entry.brep) {\r\n if (this.entry.localToWorld !== undefined) {\r\n const entityTrans = Transform.fromJSON(entry.brep.transform);\r\n entry.brep.transform = entityTrans.multiplyTransformTransform(this.entry.localToWorld).toJSON();\r\n }\r\n\r\n this.entry.setBRep(entry.brep);\r\n return { value: this.entry, done: false };\r\n } else {\r\n const geometryQuery = GeomJson.Reader.parse(entry);\r\n if (!(geometryQuery instanceof GeometryQuery))\r\n continue;\r\n\r\n if (this.entry.localToWorld !== undefined)\r\n geometryQuery.tryTransformInPlace(this.entry.localToWorld);\r\n\r\n this.entry.setGeometryQuery(geometryQuery);\r\n return { value: this.entry, done: false };\r\n }\r\n }\r\n\r\n return { value: this.entry, done: true };\r\n }\r\n\r\n public [Symbol.iterator](): IterableIterator<GeometryStreamIteratorEntry> {\r\n return this;\r\n }\r\n\r\n /** @internal */\r\n public get isViewIndependent(): boolean { return GeometryStreamFlags.None !== (this.flags & GeometryStreamFlags.ViewIndependent); }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"GeometryStream.js","sourceRoot":"","sources":["../../../src/geometry/GeometryStream.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAqE;AACrE,wDAG8B;AAC9B,0CAAsD;AACtD,kDAA0I;AAC1I,sDAA+F;AAC/F,0CAAuC;AACvC,gDAA6C;AAC7C,+CAA4C;AAC5C,iDAAiE;AACjE,2CAAwC;AACxC,6CAA2D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esContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Geometry\r\n */\r\n\r\nimport { Id64, Id64String, IModelStatus } from \"@itwin/core-bentley\";\r\nimport {\r\n Angle, AnyGeometryQuery, GeometryQuery, IModelJson as GeomJson, LineSegment3d, LowAndHighXYZ, Matrix3d, Point2d, Point3d, Range3d, Transform, TransformProps,\r\n Vector3d, XYZProps, YawPitchRollAngles, YawPitchRollProps,\r\n} from \"@itwin/core-geometry\";\r\nimport { ColorDef, ColorDefProps } from \"../ColorDef\";\r\nimport { GeometricElement2dProps, GeometricElement3dProps, GeometryPartProps, isPlacement2dProps, PlacementProps } from \"../ElementProps\";\r\nimport { BackgroundFill, FillDisplay, GeometryClass, GeometryParams } from \"../GeometryParams\";\r\nimport { Gradient } from \"../Gradient\";\r\nimport { IModelError } from \"../IModelError\";\r\nimport { AreaPattern } from \"./AreaPattern\";\r\nimport { ImageGraphic, ImageGraphicProps } from \"./ImageGraphic\";\r\nimport { LineStyle } from \"./LineStyle\";\r\nimport { TextString, TextStringProps } from \"./TextString\";\r\nimport { Base64EncodedString } from \"../Base64EncodedString\";\r\nimport { Placement2d, Placement3d } from \"./Placement\";\r\nimport { TextBlockGeometryProps } from \"../annotation/TextBlockGeometryProps\";\r\n\r\n/** Establish a non-default [[SubCategory]] or to override [[SubCategoryAppearance]] for the geometry that follows.\r\n * A GeometryAppearanceProps always signifies a reset to the [[SubCategoryAppearance]] for subsequent [[GeometryStreamProps]] entries for undefined values.\r\n * @see [[GeometryStreamEntryProps]]\r\n * @public\r\n * @extensions\r\n */\r\nexport interface GeometryAppearanceProps {\r\n /** Optional [[SubCategory]] id for subsequent geometry. Use to create a GeometryStream with geometry that is not on the default [[SubCategory]] for the element's [[Category]] or is has geometry on multiple subCategories. */\r\n subCategory?: Id64String;\r\n /** Optional color to override [[SubCategoryAppearance.color]] for subsequent geometry. */\r\n color?: ColorDefProps;\r\n /** Optional weight to override [[SubCategoryAppearance.weight]] for subsequent geometry. */\r\n weight?: number;\r\n /** Optional style to override [[SubCategoryAppearance.styleId]] for subsequent geometry. */\r\n style?: Id64String;\r\n /** Optional transparency, 0.0 if undefined. Effective transparency is a combination of this value and [[SubCategoryAppearance.color]]. */\r\n transparency?: number;\r\n /** Optional display priority (2d only), 0 if undefined. Effective display priority is a combination of this value and [[SubCategoryAppearance.priority]]. */\r\n displayPriority?: number;\r\n /** Optional GeometryClass (for DGN compatibility, subCategories preferred), [[GeometryClass.Primary]] if undefined. */\r\n geometryClass?: GeometryClass;\r\n}\r\n\r\n/** Add a [[gradient]], [[backgroundFill]], or solid [[color]] fill to subsequent planar regions (or meshes).\r\n * Only one value among [[gradient]], [[backgroundFill]], and [[color]] should be set.\r\n * @see [[GeometryStreamEntryProps]]\r\n * @public\r\n * @extensions\r\n */\r\nexport interface AreaFillProps {\r\n /** Fill display type, must be set to something other than [[FillDisplay.Never]] to display fill */\r\n display: FillDisplay;\r\n /** Optional fill transparency, will be the same as outline transparency if undefined. Allows for different fill and outline transparencies */\r\n transparency?: number;\r\n /** Set fill color to view background color. Use [[BackgroundFill.Solid]] for an opaque fill and [[BackgroundFill.Outline]] to display an outline using the line color */\r\n backgroundFill?: BackgroundFill;\r\n /** Set fill color to a specific color. If the fill color the same as the line color, it is an opaque fill, otherwise it is an outline fill */\r\n color?: ColorDefProps;\r\n /** Set fill using gradient properties. */\r\n gradient?: Gradient.SymbProps;\r\n}\r\n\r\n/** Override [[SubCategoryAppearance.materialId]] for subsequent surface and solid geometry.\r\n * @see [[GeometryStreamEntryProps]]\r\n * @public\r\n * @extensions\r\n */\r\nexport interface MaterialProps {\r\n /** Material id to use, specify an invalid [[Id64]] to override [[SubCategoryAppearance.materialId]] with no material. */\r\n materialId?: Id64String;\r\n /** @internal */\r\n origin?: XYZProps;\r\n /** @internal */\r\n size?: XYZProps;\r\n /** @internal */\r\n rotation?: YawPitchRollProps;\r\n}\r\n\r\n/** JSON representation of a brep GeometryStream entry.\r\n * @public\r\n */\r\nexport namespace BRepEntity {\r\n /** Enum for type of solid kernel entity this represents */\r\n export enum Type {\r\n /** Body consisting of at least one solid region */\r\n Solid = 0,\r\n /** Body consisting of connected sets of faces having edges that are shared by a maximum of two faces */\r\n Sheet = 1,\r\n /** Body consisting of connected sets of edges having vertices that are shared by a maximum of two edges */\r\n Wire = 2,\r\n }\r\n\r\n /** Optional symbology that can be assigned to individual faces of a solid or sheet body */\r\n export interface FaceSymbologyProps {\r\n /** Optional color override for face */\r\n color?: ColorDefProps;\r\n /** Optional transparency override for face */\r\n transparency?: number;\r\n /** Optional material override for face */\r\n materialId?: Id64String;\r\n }\r\n\r\n /** Geometry entry representing raw brep data.\r\n * @see [[GeometryStreamEntryProps]]\r\n */\r\n export interface DataProps {\r\n /** data as Base64 encoded string. Must be specifically requested using [[ElementLoadProps.wantBRepData]]. */\r\n data?: Base64EncodedString;\r\n /** body type, default is Solid */\r\n type?: Type;\r\n /** body transform, default is identity */\r\n transform?: TransformProps;\r\n /** body face attachments */\r\n faceSymbology?: FaceSymbologyProps[];\r\n }\r\n}\r\n\r\n/** Add a reference to a [[GeometryPart]] from the GeometryStream of a [[GeometricElement]].\r\n * @see [[GeometryStreamEntryProps]]\r\n * @public\r\n * @extensions\r\n */\r\nexport interface GeometryPartInstanceProps {\r\n /** GeometryPart id */\r\n part: Id64String;\r\n /** Optional translation relative to element's placement, 0.0,0.0,0.0 if undefined. For a 2d element/translation, supply non-zero x and y only */\r\n origin?: XYZProps;\r\n /** Optional rotation relative to element's placement, 0.0,0.0,0.0 if undefined. For a 2d element/rotation, supply a non-zero yaw angle only */\r\n rotation?: YawPitchRollProps;\r\n /** Optional scale to apply to part, 1.0 if undefined */\r\n scale?: number;\r\n}\r\n\r\n/** Flags applied to the entire contents of a [[GeometryStreamProps]].\r\n * @see GeometryStreamHeaderProps\r\n * @public\r\n * @extensions\r\n */\r\nexport enum GeometryStreamFlags {\r\n /** No flags. */\r\n None = 0,\r\n /** When the geometry is displayed, it is always oriented to face the viewer. The placement origin of the element associated with the geometry is used as the rotation point.\r\n * If the placement origin is outside of the view, the geometry will not necessarily be displayed, even if rotating it to face the viewer would cause its range to intersect the viewed volume.\r\n */\r\n ViewIndependent = 1 << 0,\r\n}\r\n\r\n/** An entry in a [[GeometryStreamProps]] containing [[GeometryStreamFlags]] that apply to the geometry stream as a whole.\r\n * If this entry exists in the [[GeometryStreamProps]] array, it will always be the *first* entry.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface GeometryStreamHeaderProps {\r\n /** The flags applied to the geometry stream. */\r\n flags: GeometryStreamFlags;\r\n}\r\n\r\n/** Allowed GeometryStream entries - should only set one value.\r\n * @see [GeometryStream]($docs/learning/common/geometrystream.md)\r\n * @public\r\n * @extensions\r\n */\r\nexport interface GeometryStreamEntryProps extends GeomJson.GeometryProps {\r\n header?: GeometryStreamHeaderProps;\r\n appearance?: GeometryAppearanceProps;\r\n styleMod?: LineStyle.ModifierProps;\r\n fill?: AreaFillProps;\r\n pattern?: AreaPattern.ParamsProps;\r\n material?: MaterialProps;\r\n geomPart?: GeometryPartInstanceProps;\r\n textString?: TextStringProps;\r\n brep?: BRepEntity.DataProps;\r\n image?: ImageGraphicProps;\r\n subRange?: LowAndHighXYZ;\r\n}\r\n\r\n/** A [[GeometricElement]]'s GeometryStream is represented by an array of [[GeometryStreamEntryProps]].\r\n * @public\r\n * @extensions\r\n */\r\nexport type GeometryStreamProps = GeometryStreamEntryProps[];\r\n\r\n/** GeometryStreamBuilder is a helper class for populating the [[GeometryStreamProps]] array needed to create a [[GeometricElement]] or [[GeometryPart]].\r\n * @public\r\n */\r\nexport class GeometryStreamBuilder {\r\n /** Current inverse placement transform, used for converting world coordinate input to be placement relative */\r\n private _worldToLocal?: Transform;\r\n /** GeometryStream entries */\r\n public readonly geometryStream: GeometryStreamProps = [];\r\n\r\n /** Supply optional local to world transform. Used to transform world coordinate input relative to element placement.\r\n * For a [[GeometricElement]]'s placement to be meaningful, world coordinate geometry should never be appended to an element with an identity placement.\r\n * Can be called with undefined or identity transform to start appending geometry supplied in local coordinates again.\r\n */\r\n public setLocalToWorld(localToWorld?: Transform) {\r\n this._worldToLocal = (undefined === localToWorld || localToWorld.isIdentity ? undefined : localToWorld.inverse());\r\n }\r\n\r\n /** Supply local to world transform from a Point3d and optional YawPitchRollAngles.\r\n * @see [[Placement3d]]\r\n */\r\n public setLocalToWorld3d(origin: Point3d, angles: YawPitchRollAngles = YawPitchRollAngles.createDegrees(0.0, 0.0, 0.0)) {\r\n this.setLocalToWorld(Transform.createOriginAndMatrix(origin, angles.toMatrix3d()));\r\n }\r\n\r\n /** Supply local to world transform from a Point2d and optional Angle.\r\n * @see [[Placement2d]]\r\n */\r\n public setLocalToWorld2d(origin: Point2d, angle: Angle = Angle.createDegrees(0.0)) {\r\n this.setLocalToWorld(Transform.createOriginAndMatrix(Point3d.createFrom(origin), Matrix3d.createRotationAroundVector(Vector3d.unitZ(), angle)));\r\n }\r\n\r\n /** Supply local to world transform from a PlacementProps2d or PlacementProps3d.\r\n * @see [[PlacementProps]]\r\n */\r\n public setLocalToWorldFromPlacement(props: PlacementProps) {\r\n const placement = isPlacement2dProps(props) ? Placement2d.fromJSON(props) : Placement3d.fromJSON(props);\r\n this.setLocalToWorld(placement.transform);\r\n }\r\n\r\n /** Store local ranges in GeometryStream for all subsequent geometry appended. Can improve performance of range testing for elements with a GeometryStream\r\n * containing more than one [[GeometryQuery]] differentiable by range. Not useful for a single [[GeometryQuery]] as its range and that of the [[GeometricElement]] are the same.\r\n * Ignored when defining a [[GeometryPart]] and not needed when only appending [[GeometryPart]] instances to a [[GeometricElement]] as these store their own range.\r\n */\r\n public appendGeometryRanges() {\r\n this.geometryStream.push({ subRange: Range3d.createNull() });\r\n }\r\n\r\n /** Change [[SubCategory]] or reset to [[SubCategoryAppearance]] for subsequent geometry.\r\n * An invalid sub-category id can be supplied to force a reset to the current [[SubCategoryAppearance]].\r\n * It is not valid to change the sub-category when defining a [[GeometryPart]]. A [[GeometryPart]] inherit the symbology of their instance for anything not explicitly overridden.\r\n */\r\n public appendSubCategoryChange(subCategoryId: Id64String): boolean {\r\n this.geometryStream.push({ appearance: { subCategory: subCategoryId } });\r\n return true;\r\n }\r\n\r\n /** Change [[GeometryParams]] for subsequent geometry.\r\n * It is not valid to change the sub-category when defining a [[GeometryPart]]. A [[GeometryPart]] inherits the symbology of their instance for anything not explicitly overridden.\r\n */\r\n public appendGeometryParamsChange(geomParams: GeometryParams): boolean {\r\n const appearance: GeometryAppearanceProps = {\r\n subCategory: geomParams.subCategoryId,\r\n color: geomParams.lineColor?.toJSON(),\r\n weight: geomParams.weight,\r\n style: geomParams.styleInfo?.styleId,\r\n transparency: geomParams.elmTransparency,\r\n displayPriority: geomParams.elmPriority,\r\n geometryClass: geomParams.geometryClass,\r\n };\r\n this.geometryStream.push({ appearance });\r\n\r\n if (undefined !== geomParams.materialId)\r\n this.geometryStream.push({ material: { materialId: geomParams.materialId } });\r\n\r\n if (undefined !== geomParams.fillDisplay && FillDisplay.Never !== geomParams.fillDisplay) {\r\n const fill: AreaFillProps = {\r\n display: geomParams.fillDisplay,\r\n transparency: geomParams.fillTransparency,\r\n };\r\n if (undefined !== geomParams.gradient && Gradient.Mode.None !== geomParams.gradient.mode)\r\n fill.gradient = geomParams.gradient?.toJSON();\r\n else if (undefined !== geomParams.backgroundFill && BackgroundFill.None !== geomParams.backgroundFill)\r\n fill.backgroundFill = geomParams.backgroundFill;\r\n else if (undefined !== geomParams.fillColor)\r\n fill.color = geomParams.fillColor.toJSON();\r\n this.geometryStream.push({ fill });\r\n }\r\n\r\n if (undefined !== geomParams.pattern) {\r\n const localPattern = this._worldToLocal ? geomParams.pattern.clone() : geomParams.pattern;\r\n if (undefined !== this._worldToLocal && !localPattern.applyTransform(this._worldToLocal))\r\n return false;\r\n\r\n this.geometryStream.push({ pattern: localPattern.toJSON() });\r\n }\r\n\r\n if (undefined !== geomParams.styleInfo && undefined !== geomParams.styleInfo.styleMod) {\r\n const localStyleMod = new LineStyle.Modifier(geomParams.styleInfo.styleMod);\r\n if (undefined !== this._worldToLocal && !localStyleMod.applyTransform(this._worldToLocal))\r\n return false;\r\n this.geometryStream.push({ styleMod: localStyleMod });\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /** Append a [[GeometryPart]] instance with relative position, orientation, and scale to a [[GeometryStreamProps]] array for creating a [[GeometricElement3d]].\r\n * Not valid when defining a [[GeometryPart]] as nesting of parts is not supported.\r\n */\r\n public appendGeometryPart3d(partId: Id64String, instanceOrigin?: Point3d, instanceRotation?: YawPitchRollAngles, instanceScale?: number): boolean {\r\n if (undefined === this._worldToLocal) {\r\n this.geometryStream.push({ geomPart: { part: partId, origin: instanceOrigin, rotation: instanceRotation, scale: instanceScale } });\r\n return true;\r\n }\r\n const partTrans = Transform.createOriginAndMatrix(instanceOrigin, instanceRotation ? instanceRotation.toMatrix3d() : Matrix3d.createIdentity());\r\n if (undefined !== instanceScale)\r\n partTrans.matrix.scaleColumnsInPlace(instanceScale, instanceScale, instanceScale);\r\n const resultTrans = this._worldToLocal.multiplyTransformTransform(partTrans);\r\n const scales = new Vector3d();\r\n if (!resultTrans.matrix.normalizeColumnsInPlace(scales))\r\n return false;\r\n const newRotation = YawPitchRollAngles.createFromMatrix3d(resultTrans.matrix);\r\n if (undefined === newRotation)\r\n return false;\r\n this.geometryStream.push({ geomPart: { part: partId, origin: resultTrans.getOrigin(), rotation: newRotation, scale: scales.x } });\r\n return true;\r\n }\r\n\r\n /** Append a [[GeometryPart]] instance with relative position, orientation, and scale to a [[GeometryStreamProps]] array for creating a [[GeometricElement2d]].\r\n * Not valid when defining a [[GeometryPart]] as nesting of parts is not supported.\r\n */\r\n public appendGeometryPart2d(partId: Id64String, instanceOrigin?: Point2d, instanceRotation?: Angle, instanceScale?: number): boolean {\r\n return this.appendGeometryPart3d(partId, instanceOrigin ? Point3d.createFrom(instanceOrigin) : undefined, instanceRotation ? new YawPitchRollAngles(instanceRotation) : undefined, instanceScale);\r\n }\r\n\r\n /** Append a [[TextString]] supplied in either local or world coordinates to the [[GeometryStreamProps]] array */\r\n public appendTextString(textString: TextString): boolean {\r\n if (this._worldToLocal) {\r\n textString = new TextString(textString);\r\n if (!textString.transformInPlace(this._worldToLocal)) {\r\n return false;\r\n }\r\n }\r\n\r\n this.geometryStream.push({ textString: textString.toJSON() });\r\n return true;\r\n }\r\n\r\n /** Append a series of entries representing a [[TextBlock]] to the [[GeometryStreamProps]] array.\r\n * @beta\r\n */\r\n public appendTextBlock(block: TextBlockGeometryProps): boolean {\r\n for (const entry of block.entries) {\r\n let result: boolean;\r\n if (undefined !== entry.text) {\r\n result = this.appendTextString(new TextString(entry.text));\r\n } else if (undefined !== entry.color) {\r\n if (entry.color === \"subcategory\") {\r\n result = this.appendSubCategoryChange(Id64.invalid);\r\n } else {\r\n this.geometryStream.push({ appearance: { color: entry.color } });\r\n result = true;\r\n }\r\n } else {\r\n result = this.appendGeometry(LineSegment3d.fromJSON(entry.separator));\r\n }\r\n\r\n if (!result) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /** Append an [[ImageGraphic]] supplied in either local or world coordinates. */\r\n public appendImage(image: ImageGraphic): boolean {\r\n if (undefined !== this._worldToLocal)\r\n image = image.cloneTransformed(this._worldToLocal);\r\n\r\n this.geometryStream.push({ image: image.toJSON() });\r\n return true;\r\n }\r\n\r\n /** Append a [[GeometryQuery]] supplied in either local or world coordinates to the [[GeometryStreamProps]] array */\r\n public appendGeometry(geometry: GeometryQuery): boolean {\r\n if (undefined === this._worldToLocal) {\r\n const geomData = GeomJson.Writer.toIModelJson(geometry);\r\n if (undefined === geomData)\r\n return false;\r\n this.geometryStream.push(geomData);\r\n return true;\r\n }\r\n const localGeometry = geometry.cloneTransformed(this._worldToLocal);\r\n if (undefined === localGeometry)\r\n return false;\r\n const localGeomData = GeomJson.Writer.toIModelJson(localGeometry);\r\n if (undefined === localGeomData)\r\n return false;\r\n this.geometryStream.push(localGeomData);\r\n return true;\r\n }\r\n\r\n /** Append [[BRepEntity.DataProps]] supplied in either local or world coordinates to the [[GeometryStreamProps]] array\r\n * @beta\r\n */\r\n public appendBRepData(brep: BRepEntity.DataProps): boolean {\r\n if (undefined === this._worldToLocal) {\r\n this.geometryStream.push({ brep });\r\n return true;\r\n }\r\n const entityTrans = Transform.fromJSON(brep.transform);\r\n const localTrans = this._worldToLocal.multiplyTransformTransform(entityTrans);\r\n const localBrep: BRepEntity.DataProps = {\r\n data: brep.data,\r\n type: brep.type,\r\n transform: localTrans.isIdentity ? undefined : localTrans.toJSON(),\r\n faceSymbology: brep.faceSymbology,\r\n };\r\n this.geometryStream.push({ brep: localBrep });\r\n return true;\r\n }\r\n\r\n /** @internal */\r\n public getHeader(): GeometryStreamHeaderProps | undefined {\r\n return 0 < this.geometryStream.length ? this.geometryStream[0].header : undefined;\r\n }\r\n\r\n /** @internal */\r\n public obtainHeader(): GeometryStreamHeaderProps {\r\n const hdr = this.getHeader();\r\n if (undefined !== hdr)\r\n return hdr;\r\n\r\n const entry = { header: { flags: GeometryStreamFlags.None } };\r\n this.geometryStream.unshift(entry);\r\n return entry.header;\r\n }\r\n\r\n /** Controls whether or not the geometry in the stream should be displayed as view-independent.\r\n * When view-independent geometry is displayed, it is always oriented to face the viewer, using the placement origin of the element as the rotation point.\r\n * If the placement origin is outside of the view, the geometry will not necessarily be displayed, even if rotating it to face the viewer would cause its range to intersect the viewed volume\r\n * @public\r\n */\r\n public get isViewIndependent(): boolean {\r\n const hdr = this.getHeader();\r\n return undefined !== hdr && GeometryStreamFlags.None !== (hdr.flags & GeometryStreamFlags.ViewIndependent);\r\n }\r\n public set isViewIndependent(viewIndependent: boolean) {\r\n if (viewIndependent === this.isViewIndependent)\r\n return;\r\n\r\n const hdr = this.obtainHeader();\r\n if (viewIndependent)\r\n hdr.flags |= GeometryStreamFlags.ViewIndependent;\r\n else\r\n hdr.flags &= ~GeometryStreamFlags.ViewIndependent;\r\n }\r\n}\r\n\r\n/** Represents a text string within a GeometryStream.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface TextStringPrimitive {\r\n type: \"textString\";\r\n readonly textString: TextString;\r\n}\r\n\r\n/** Represents an image within a GeometryStream.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface ImagePrimitive {\r\n type: \"image\";\r\n readonly image: ImageGraphic;\r\n}\r\n\r\n/** Represents a reference to a GeometryPart within a GeometryStream.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface PartReference {\r\n type: \"partReference\";\r\n part: {\r\n id: Id64String;\r\n readonly toLocal?: Transform;\r\n };\r\n}\r\n\r\n/** Represents a BRep within a GeometryStream.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface BRepPrimitive {\r\n type: \"brep\";\r\n /** @beta */\r\n readonly brep: BRepEntity.DataProps;\r\n}\r\n\r\n/** Represents one of a variety of GeometryQuery objects within a GeometryStream.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface GeometryPrimitive {\r\n type: \"geometryQuery\";\r\n readonly geometry: AnyGeometryQuery;\r\n}\r\n\r\n/** Union of all possible geometric primitive types that may appear within a GeometryStream.\r\n * @public\r\n * @extensions\r\n */\r\nexport type GeometryStreamPrimitive = TextStringPrimitive | PartReference | BRepPrimitive | GeometryPrimitive | ImagePrimitive;\r\n\r\n/** Holds current state information for [[GeometryStreamIterator]]. Each entry represents exactly one geometry primitive in the stream.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface GeometryStreamIteratorEntry {\r\n /** A [[GeometryParams]] representing the appearance of the current geometric entry */\r\n readonly geomParams: GeometryParams;\r\n /** Placement transform, used for converting placement relative, local coordinate entries to world */\r\n readonly localToWorld?: Transform;\r\n /** Optional stored local range for the current geometric entry */\r\n readonly localRange?: Range3d;\r\n /** Returns the geometric primitive represented by this entry. */\r\n readonly primitive: GeometryStreamPrimitive;\r\n}\r\n\r\nclass IteratorEntry implements GeometryStreamIteratorEntry {\r\n private _primitive?: GeometryStreamPrimitive;\r\n public readonly geomParams: GeometryParams;\r\n public readonly localToWorld?: Transform;\r\n public localRange?: Range3d;\r\n\r\n public constructor(appearance: Id64String | GeometryParams, localToWorld?: Transform) {\r\n this.geomParams = typeof appearance === \"string\" ? new GeometryParams(appearance) : appearance;\r\n this.localToWorld = localToWorld;\r\n }\r\n\r\n public get primitive() { return this._primitive!; }\r\n public set primitive(primitive: GeometryStreamPrimitive) { this._primitive = primitive; }\r\n\r\n public setGeometryQuery(geometry: AnyGeometryQuery) { this._primitive = { type: \"geometryQuery\", geometry }; }\r\n public setTextString(textString: TextString) { this._primitive = { type: \"textString\", textString }; }\r\n public setBRep(brep: BRepEntity.DataProps) { this._primitive = { type: \"brep\", brep }; }\r\n public setImage(image: ImageGraphic) { this._primitive = { type: \"image\", image }; }\r\n public setPartReference(id: Id64String, toLocal?: Transform) {\r\n this._primitive = {\r\n type: \"partReference\",\r\n part: { id, toLocal },\r\n };\r\n }\r\n}\r\n\r\n/** GeometryStreamIterator is a helper class for iterating a [[GeometryStreamProps]].\r\n * A [[GeometricElement]]'s GeometryStream must be specifically requested using [[ElementLoadProps.wantGeometry]].\r\n * Each [[GeometryStreamIteratorEntry]] returned by the iterator represents exactly one geometric primitive in the stream.\r\n * @public\r\n */\r\nexport class GeometryStreamIterator implements IterableIterator<GeometryStreamIteratorEntry> {\r\n /** GeometryStream entries */\r\n public geometryStream: GeometryStreamProps;\r\n /** Flags applied to the entire geometry stream. */\r\n public readonly flags: GeometryStreamFlags;\r\n /** Current entry position */\r\n private _index = 0;\r\n /** Allocated on first call to next() and reused thereafter. */\r\n private _entry?: IteratorEntry;\r\n /** Used to initialize this._entry. */\r\n private readonly _appearance: Id64String | GeometryParams;\r\n private readonly _localToWorld?: Transform;\r\n\r\n /** Construct a new GeometryStreamIterator given a [[GeometryStreamProps]] from either a [[GeometricElement3d]], [[GeometricElement2d]], or [[GeometryPart]].\r\n * Supply the [[GeometricElement]]'s category to initialize the appearance information for each geometric entry.\r\n */\r\n public constructor(geometryStream: GeometryStreamProps, categoryOrGeometryParams?: Id64String | GeometryParams, localToWorld?: Transform) {\r\n this.geometryStream = geometryStream;\r\n this._appearance = categoryOrGeometryParams ?? Id64.invalid;\r\n this._localToWorld = localToWorld;\r\n if (0 < geometryStream.length && undefined !== geometryStream[0].header) {\r\n this.flags = geometryStream[0].header.flags;\r\n ++this._index;\r\n } else {\r\n this.flags = GeometryStreamFlags.None;\r\n }\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private get entry() {\r\n if (undefined === this._entry)\r\n this._entry = new IteratorEntry(this._appearance, this._localToWorld);\r\n\r\n return this._entry;\r\n }\r\n\r\n /** Create a new GeometryStream iterator for a [[GeometricElement3d]].\r\n * If [[GeometricElement3dProps.placement]] is not undefined, placement relative entries will be returned transformed to world coordinates.\r\n * @throws [[IModelError]] if element.geom is undefined.\r\n */\r\n public static fromGeometricElement3d(element: Pick<GeometricElement3dProps, \"geom\" | \"placement\" | \"category\">) {\r\n if (element.geom === undefined)\r\n throw new IModelError(IModelStatus.NoGeometry, \"GeometricElement has no geometry or geometry wasn't requested\");\r\n\r\n let transform;\r\n if (element.placement !== undefined)\r\n transform = Transform.createOriginAndMatrix(Point3d.fromJSON(element.placement.origin), YawPitchRollAngles.fromJSON(element.placement.angles).toMatrix3d());\r\n\r\n return new GeometryStreamIterator(element.geom, element.category, transform);\r\n }\r\n\r\n /** Create a new GeometryStream iterator for a [[GeometricElement2d]].\r\n * If [[GeometricElement2dProps.placement]] is not undefined, placement relative entries will be returned transformed to world coordinates.\r\n * @throws [[IModelError]] if element.geom is undefined.\r\n */\r\n public static fromGeometricElement2d(element: Pick<GeometricElement2dProps, \"geom\" | \"placement\" | \"category\">) {\r\n if (element.geom === undefined)\r\n throw new IModelError(IModelStatus.NoGeometry, \"GeometricElement has no geometry or geometry wasn't requested\");\r\n\r\n let transform;\r\n if (element.placement !== undefined) {\r\n const origin = Point3d.createFrom(Point2d.fromJSON(element.placement.origin));\r\n const matrix = Matrix3d.createRotationAroundVector(Vector3d.unitZ(), Angle.fromJSON(element.placement.angle))!;\r\n transform = Transform.createOriginAndMatrix(origin, matrix);\r\n }\r\n\r\n return new GeometryStreamIterator(element.geom, element.category, transform);\r\n }\r\n\r\n /** Create a new GeometryStream iterator for a [[GeometryPart]].\r\n * To iterate a part's GeometryStream in the context of a part instance found for a [[GeometricElement]], provide the optional [[GeometryParams]] and Transform from the [[GeometricElement]]'s [[GeometryStreamIterator]].\r\n * Supply the [[GeometryParams]] to return appearance information as inherited from the [[GeometricElement]].\r\n * Supply the partToWorld transform to return the part geometry in world coordinates.\r\n * Supply the partToLocal transform to return the part geometry relative to the [[GeometricElement]]'s placement.\r\n * @throws [[IModelError]] if geomPart.geom is undefined.\r\n */\r\n public static fromGeometryPart(geomPart: Pick<GeometryPartProps, \"geom\">, geomParams?: GeometryParams, partTransform?: Transform) {\r\n if (geomPart.geom === undefined)\r\n throw new IModelError(IModelStatus.NoGeometry, \"GeometryPart has no geometry or geometry wasn't requested\");\r\n\r\n return new GeometryStreamIterator(geomPart.geom, geomParams?.clone(), partTransform);\r\n }\r\n\r\n /** Get the transform that if applied to a [[GeometryPart]]'s GeometryStream entries would return them in world coordinates. */\r\n public partToWorld(): Transform | undefined {\r\n if (undefined === this._entry)\r\n return this._localToWorld;\r\n\r\n const partToLocal = \"partReference\" === this._entry.primitive.type ? this._entry.primitive.part.toLocal : undefined;\r\n if (this._entry.localToWorld === undefined || partToLocal === undefined)\r\n return this._entry.localToWorld;\r\n\r\n return this._entry.localToWorld.multiplyTransformTransform(partToLocal);\r\n }\r\n\r\n /** Advance to next displayable geometric entry while updating the current [[GeometryParams]] from appearance related entries.\r\n * Geometric entries are [[TextString]], [[GeometryQuery]], [[GeometryPart]], [[ImageGraphic]], and [[BRepEntity.DataProps]].\r\n */\r\n public next(): IteratorResult<GeometryStreamIteratorEntry> {\r\n // NOTE: localRange remains valid until we encounter either a new subRange entry or a geometry part reference.\r\n while (this._index < this.geometryStream.length) {\r\n const entry = this.geometryStream[this._index++];\r\n if (entry.appearance) {\r\n this.entry.geomParams.resetAppearance();\r\n if (entry.appearance.subCategory)\r\n this.entry.geomParams.subCategoryId = Id64.fromJSON(entry.appearance.subCategory);\r\n if (undefined !== entry.appearance.color)\r\n this.entry.geomParams.lineColor = ColorDef.fromJSON(entry.appearance.color);\r\n if (undefined !== entry.appearance.weight)\r\n this.entry.geomParams.weight = entry.appearance.weight;\r\n if (undefined !== entry.appearance.style)\r\n this.entry.geomParams.styleInfo = new LineStyle.Info(Id64.fromJSON(entry.appearance.style));\r\n if (undefined !== entry.appearance.transparency)\r\n this.entry.geomParams.elmTransparency = entry.appearance.transparency;\r\n if (undefined !== entry.appearance.displayPriority)\r\n this.entry.geomParams.elmPriority = entry.appearance.displayPriority;\r\n if (undefined !== entry.appearance.geometryClass)\r\n this.entry.geomParams.geometryClass = entry.appearance.geometryClass;\r\n } else if (entry.styleMod) {\r\n if (this.entry.geomParams.styleInfo === undefined)\r\n continue;\r\n\r\n const styleMod = new LineStyle.Modifier(entry.styleMod);\r\n if (this.entry.localToWorld !== undefined)\r\n styleMod.applyTransform(this.entry.localToWorld);\r\n\r\n this.entry.geomParams.styleInfo = new LineStyle.Info(this.entry.geomParams.styleInfo.styleId, styleMod);\r\n } else if (entry.fill) {\r\n if (entry.fill.display)\r\n this.entry.geomParams.fillDisplay = entry.fill.display;\r\n if (entry.fill.transparency)\r\n this.entry.geomParams.fillTransparency = entry.fill.transparency;\r\n if (entry.fill.gradient)\r\n this.entry.geomParams.gradient = Gradient.Symb.fromJSON(entry.fill.gradient);\r\n else if (entry.fill.backgroundFill)\r\n this.entry.geomParams.backgroundFill = entry.fill.backgroundFill;\r\n else if (entry.fill.color)\r\n this.entry.geomParams.fillColor = ColorDef.fromJSON(entry.fill.color);\r\n } else if (entry.pattern) {\r\n const params = AreaPattern.Params.fromJSON(entry.pattern);\r\n if (this.entry.localToWorld !== undefined)\r\n params.applyTransform(this.entry.localToWorld);\r\n\r\n this.entry.geomParams.pattern = params;\r\n } else if (entry.material) {\r\n if (entry.material.materialId)\r\n this.entry.geomParams.materialId = Id64.fromJSON(entry.material.materialId);\r\n } else if (entry.subRange) {\r\n this.entry.localRange = Range3d.fromJSON(entry.subRange);\r\n } else if (entry.geomPart) {\r\n let transform;\r\n if (entry.geomPart.origin !== undefined || entry.geomPart.rotation !== undefined || entry.geomPart.scale !== undefined) {\r\n const origin = entry.geomPart.origin ? Point3d.fromJSON(entry.geomPart.origin) : Point3d.createZero();\r\n const rotation = entry.geomPart.rotation ? YawPitchRollAngles.fromJSON(entry.geomPart.rotation).toMatrix3d() : Matrix3d.createIdentity();\r\n transform = Transform.createRefs(origin, rotation);\r\n if (entry.geomPart.scale)\r\n transform.multiplyTransformTransform(Transform.createRefs(Point3d.createZero(), Matrix3d.createUniformScale(entry.geomPart.scale)), transform);\r\n }\r\n\r\n // Subgraphic range doesn't apply to parts. A sane geometry stream (i.e., any that has been through the native layers or GeometryStreamBuilder)\r\n // will have a new subgraphic range for any geometric primitive following the part.\r\n this.entry.localRange = undefined;\r\n this.entry.setPartReference(Id64.fromJSON(entry.geomPart.part), transform);\r\n return { value: this.entry, done: false };\r\n } else if (entry.textString) {\r\n const textString = new TextString(entry.textString);\r\n if (this.entry.localToWorld !== undefined)\r\n textString.transformInPlace(this.entry.localToWorld);\r\n\r\n this.entry.setTextString(textString);\r\n return { value: this.entry, done: false };\r\n } else if (entry.image) {\r\n const image = ImageGraphic.fromJSON(entry.image);\r\n if (undefined !== this.entry.localToWorld)\r\n image.transformInPlace(this.entry.localToWorld);\r\n\r\n this.entry.setImage(image);\r\n return { value: this.entry, done: false };\r\n } else if (entry.brep) {\r\n if (this.entry.localToWorld !== undefined) {\r\n const entityTrans = Transform.fromJSON(entry.brep.transform);\r\n entry.brep.transform = this.entry.localToWorld.multiplyTransformTransform(entityTrans).toJSON();\r\n }\r\n\r\n this.entry.setBRep(entry.brep);\r\n return { value: this.entry, done: false };\r\n } else {\r\n const geometryQuery = GeomJson.Reader.parse(entry);\r\n if (!(geometryQuery instanceof GeometryQuery))\r\n continue;\r\n\r\n if (this.entry.localToWorld !== undefined)\r\n geometryQuery.tryTransformInPlace(this.entry.localToWorld);\r\n\r\n this.entry.setGeometryQuery(geometryQuery);\r\n return { value: this.entry, done: false };\r\n }\r\n }\r\n\r\n return { value: this.entry, done: true };\r\n }\r\n\r\n public [Symbol.iterator](): IterableIterator<GeometryStreamIteratorEntry> {\r\n return this;\r\n }\r\n\r\n /** @internal */\r\n public get isViewIndependent(): boolean { return GeometryStreamFlags.None !== (this.flags & GeometryStreamFlags.ViewIndependent); }\r\n}\r\n"]}
|
|
@@ -60,6 +60,9 @@ export declare class Placement3d implements Placement3dProps {
|
|
|
60
60
|
/** Calculate the axis-aligned bounding box for this placement. */
|
|
61
61
|
calculateRange(): AxisAlignedBox3d;
|
|
62
62
|
/** Multiply the Transform of this Placement3d by the specified *other* Transform.
|
|
63
|
+
* * Specifically `this.angles` is set to the rotation specified by `other.matrix * this.transform.matrix`
|
|
64
|
+
* and `this.origin` is set to the origin of `other * this.transform`.
|
|
65
|
+
* * Since the placement transform is local-to-world, this means `other` is a world-to-world transform.
|
|
63
66
|
* @throws [[IModelError]] if the Transform is invalid for a GeometricElement3d.
|
|
64
67
|
*/
|
|
65
68
|
multiplyTransform(other: Transform): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Placement.d.ts","sourceRoot":"","sources":["../../../src/geometry/Placement.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EACL,KAAK,EAAY,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAY,kBAAkB,EACrH,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EA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,iBAAiB,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;CASjD;AAED;;GAEG;AACH,qBAAa,WAAY,YAAW,gBAAgB;IACxB,MAAM,EAAE,OAAO;IAAS,KAAK,EAAE,KAAK;IAAS,IAAI,EAAE,mBAAmB;gBAAtE,MAAM,EAAE,OAAO,EAAS,KAAK,EAAE,KAAK,EAAS,IAAI,EAAE,mBAAmB;IAChG,sFAAsF;IACtF,IAAW,QAAQ,IAAI,QAAQ,CAA+E;IAC9G,uFAAuF;IACvF,IAAW,SAAS,IAAI,SAAS,CAA4F;IAC7H,wDAAwD;WAC1C,QAAQ,CAAC,IAAI,CAAC,EAAE,gBAAgB,GAAG,WAAW;IAI5D,wCAAwC;IACxC,IAAW,IAAI,IAAI,OAAO,CAAkB;IAE5C,kEAAkE;IAC3D,eAAe,CAAC,GAAG,CAAC,EAAE,OAAO,GAAG,OAAO;IAM9C,mDAAmD;IACnD,IAAW,OAAO,IAAI,OAAO,CAAoH;IAEjJ,oEAAoE;IAC7D,OAAO,CAAC,KAAK,EAAE,WAAW;IAMjC,kEAAkE;IAC3D,cAAc,IAAI,gBAAgB;IAczC;;OAEG;IACI,iBAAiB,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;CASjD"}
|
|
@@ -58,6 +58,9 @@ class Placement3d {
|
|
|
58
58
|
return range;
|
|
59
59
|
}
|
|
60
60
|
/** Multiply the Transform of this Placement3d by the specified *other* Transform.
|
|
61
|
+
* * Specifically `this.angles` is set to the rotation specified by `other.matrix * this.transform.matrix`
|
|
62
|
+
* and `this.origin` is set to the origin of `other * this.transform`.
|
|
63
|
+
* * Since the placement transform is local-to-world, this means `other` is a world-to-world transform.
|
|
61
64
|
* @throws [[IModelError]] if the Transform is invalid for a GeometricElement3d.
|
|
62
65
|
*/
|
|
63
66
|
multiplyTransform(other) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Placement.js","sourceRoot":"","sources":["../../../src/geometry/Placement.ts"],"names":[],"m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AAI,CAAC,YAAY;YACnF,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,UAAU,EAAE,mBAAmB,CAAC,CAAC;QAEtE,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC;QACxB,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;CACF;AA1DD,kCA0DC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Geometry\r\n */\r\n\r\nimport { IModelStatus } from \"@itwin/core-bentley\";\r\nimport {\r\n Angle, Constant, Matrix3d, Point2d, Point3d, Range2d, Range3d, Range3dProps, Transform, Vector3d, YawPitchRollAngles,\r\n} from \"@itwin/core-geometry\";\r\nimport { Placement2dProps, Placement3dProps } from \"../ElementProps\";\r\nimport { Frustum } from \"../Frustum\";\r\nimport { IModelError } from \"../IModelError\";\r\n\r\n/** A Range3d that is aligned with the axes of spatial coordinates.\r\n * @public\r\n * @extensions\r\n */\r\nexport type AxisAlignedBox3d = Range3d;\r\n\r\n/** The properties of a Range3d.\r\n * @public\r\n * @extensions\r\n */\r\nexport type AxisAlignedBox3dProps = Range3dProps;\r\n\r\n/** A bounding box aligned to the orientation of a 3d Element\r\n * @public\r\n * @extensions\r\n */\r\nexport type ElementAlignedBox3d = Range3d;\r\n\r\n/** A bounding box aligned to the orientation of a 2d Element\r\n * @public\r\n * @extensions\r\n */\r\nexport type ElementAlignedBox2d = Range2d;\r\n\r\n/** A bounding box aligned to a local coordinate system\r\n * @public\r\n * @extensions\r\n */\r\nexport type LocalAlignedBox3d = Range3d;\r\n\r\n/** Either a Placement2d or Placement3d\r\n * @public\r\n * @extensions\r\n */\r\nexport type Placement = Placement2d | Placement3d;\r\n\r\n/** The placement of a GeometricElement3d. This includes the origin, orientation, and size (bounding box) of the element.\r\n * All geometry of a GeometricElement are relative to its placement.\r\n * @public\r\n */\r\nexport class Placement3d implements Placement3dProps {\r\n public constructor(public origin: Point3d, public angles: YawPitchRollAngles, public bbox: ElementAlignedBox3d) { }\r\n /** Get the rotation from local coordinates of this placement to world coordinates. */\r\n public get rotation(): Matrix3d { return this.angles.toMatrix3d(); }\r\n /** Get the transform from local coordinates of this placement to world coordinates. */\r\n public get transform(): Transform { return Transform.createOriginAndMatrix(this.origin, this.rotation); }\r\n /** determine if this is 3d placement */\r\n public get is3d(): boolean { return true; }\r\n\r\n /** Create a new Placement3d from a Placement3dProps. */\r\n public static fromJSON(json?: Placement3dProps): Placement3d {\r\n const props: any = json ? json : {};\r\n return new Placement3d(Point3d.fromJSON(props.origin), YawPitchRollAngles.fromJSON(props.angles), Range3d.fromJSON<ElementAlignedBox3d>(props.bbox));\r\n }\r\n\r\n /** Get the 8 corners, in world coordinates, of this placement. */\r\n public getWorldCorners(out?: Frustum): Frustum {\r\n const frust = Frustum.fromRange(this.bbox, out);\r\n frust.multiply(this.transform);\r\n return frust;\r\n }\r\n\r\n /** Set the contents of this Placement3d from another Placement3d */\r\n public setFrom(other: Placement3d) {\r\n this.origin.setFrom(other.origin);\r\n this.angles.setFrom(other.angles);\r\n this.bbox.setFrom(other.bbox);\r\n }\r\n\r\n /** Determine whether this Placement3d is valid. */\r\n public get isValid(): boolean { return !this.bbox.isNull && Math.max(this.origin.maxAbs(), this.bbox.maxAbs()) < Constant.circumferenceOfEarth; }\r\n\r\n /** Calculate the axis-aligned bounding box for this placement. */\r\n public calculateRange(): AxisAlignedBox3d {\r\n const range = new Range3d();\r\n if (!this.isValid)\r\n return range;\r\n\r\n this.transform.multiplyRange(this.bbox, range);\r\n\r\n // low and high are not allowed to be equal\r\n range.ensureMinLengths();\r\n return range;\r\n }\r\n\r\n /** Multiply the Transform of this Placement3d by the specified *other* Transform.\r\n * @throws [[IModelError]] if the Transform is invalid for a GeometricElement3d.\r\n */\r\n public multiplyTransform(other: Transform): void {\r\n const transform = other.multiplyTransformTransform(this.transform);\r\n const angles = YawPitchRollAngles.createFromMatrix3d(transform.matrix);\r\n if (undefined === angles)\r\n throw new IModelError(IModelStatus.BadRequest, \"Invalid Transform\");\r\n\r\n this.angles = angles;\r\n this.origin.setFrom(transform.origin);\r\n }\r\n}\r\n\r\n/** The placement of a GeometricElement2d. This includes the origin, rotation, and size (bounding box) of the element.\r\n * @public\r\n */\r\nexport class Placement2d implements Placement2dProps {\r\n public constructor(public origin: Point2d, public angle: Angle, public bbox: ElementAlignedBox2d) { }\r\n /** Get the rotation from local coordinates of this placement to world coordinates. */\r\n public get rotation(): Matrix3d { return Matrix3d.createRotationAroundVector(Vector3d.unitZ(), this.angle)!; }\r\n /** Get the transform from local coordinates of this placement to world coordinates. */\r\n public get transform(): Transform { return Transform.createOriginAndMatrix(Point3d.createFrom(this.origin), this.rotation); }\r\n /** Create a new Placement2d from a Placement2dProps. */\r\n public static fromJSON(json?: Placement2dProps): Placement2d {\r\n const props: any = json ? json : {};\r\n return new Placement2d(Point2d.fromJSON(props.origin), Angle.fromJSON(props.angle), Range2d.fromJSON(props.bbox));\r\n }\r\n /** determine if this is 3d placement */\r\n public get is3d(): boolean { return false; }\r\n\r\n /** Get the 8 corners, in world coordinates, of this placement. */\r\n public getWorldCorners(out?: Frustum): Frustum {\r\n const frust = Frustum.fromRange(this.bbox, out);\r\n frust.multiply(this.transform);\r\n return frust;\r\n }\r\n\r\n /** Determine whether this Placement2d is valid. */\r\n public get isValid(): boolean { return !this.bbox.isNull && Math.max(this.origin.maxAbs(), this.bbox.maxAbs()) < Constant.circumferenceOfEarth; }\r\n\r\n /** Set the contents of this Placement2d from another Placement2d */\r\n public setFrom(other: Placement2d) {\r\n this.origin.setFrom(other.origin);\r\n this.angle.setFrom(other.angle);\r\n this.bbox.setFrom(other.bbox);\r\n }\r\n\r\n /** Calculate the axis-aligned bounding box for this placement. */\r\n public calculateRange(): AxisAlignedBox3d {\r\n const range = new Range3d();\r\n if (!this.isValid)\r\n return range;\r\n\r\n this.transform.multiplyRange(Range3d.createRange2d(this.bbox, 0), range);\r\n\r\n // low and high are not allowed to be equal\r\n range.ensureMinLengths();\r\n range.low.z = - 1.0; // is the 2dFrustumDepth, which === 1 meter\r\n range.high.z = 1.0;\r\n return range;\r\n }\r\n\r\n /** Multiply the Transform of this Placement2d by the specified *other* Transform.\r\n * @throws [[IModelError]] if the Transform is invalid for a GeometricElement2d.\r\n */\r\n public multiplyTransform(other: Transform): void {\r\n const transform = other.multiplyTransformTransform(this.transform);\r\n const angles = YawPitchRollAngles.createFromMatrix3d(transform.matrix);\r\n if ((undefined === angles) || !angles.pitch.isAlmostZero || !angles.roll.isAlmostZero)\r\n throw new IModelError(IModelStatus.BadRequest, \"Invalid Transform\");\r\n\r\n this.angle = angles.yaw;\r\n this.origin.setFrom(transform.origin);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"Placement.js","sourceRoot":"","sources":["../../../src/geometry/Placement.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAmD;AACnD,wDAE8B;AAE9B,wCAAqC;AACrC,gDAA6C;AAsC7C;;;GAGG;AACH,MAAa,WAAW;IACtB,YAA0B,MAAe,EAAS,MAA0B,EAAS,IAAyB;QAApF,WAAM,GAAN,MAAM,CAAS;QAAS,WAAM,GAAN,MAAM,CAAoB;QAAS,SAAI,GAAJ,IAAI,CAAqB;IAAI,CAAC;IACnH,sFAAsF;IACtF,IAAW,QAAQ,KAAe,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IACpE,uFAAuF;IACvF,IAAW,SAAS,KAAgB,OAAO,yBAAS,CAAC,qBAAqB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IACzG,wCAAwC;IACxC,IAAW,IAAI,KAAc,OAAO,IAAI,CAAC,CAA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IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,uBAAO,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QAEzE,2CAA2C;QAC3C,KAAK,CAAC,gBAAgB,EAAE,CAAC;QACzB,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAE,GAAG,CAAC,CAAE,2CAA2C;QACjE,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC;QACnB,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACI,iBAAiB,CAAC,KAAgB;QACvC,MAAM,SAAS,GAAG,KAAK,CAAC,0BAA0B,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACnE,MAAM,MAAM,GAAG,kCAAkB,CAAC,kBAAkB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACvE,IAAI,CAAC,SAAS,KAAK,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY;YACnF,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,UAAU,EAAE,mBAAmB,CAAC,CAAC;QAEtE,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC;QACxB,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;CACF;AA1DD,kCA0DC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Geometry\r\n */\r\n\r\nimport { IModelStatus } from \"@itwin/core-bentley\";\r\nimport {\r\n Angle, Constant, Matrix3d, Point2d, Point3d, Range2d, Range3d, Range3dProps, Transform, Vector3d, YawPitchRollAngles,\r\n} from \"@itwin/core-geometry\";\r\nimport { Placement2dProps, Placement3dProps } from \"../ElementProps\";\r\nimport { Frustum } from \"../Frustum\";\r\nimport { IModelError } from \"../IModelError\";\r\n\r\n/** A Range3d that is aligned with the axes of spatial coordinates.\r\n * @public\r\n * @extensions\r\n */\r\nexport type AxisAlignedBox3d = Range3d;\r\n\r\n/** The properties of a Range3d.\r\n * @public\r\n * @extensions\r\n */\r\nexport type AxisAlignedBox3dProps = Range3dProps;\r\n\r\n/** A bounding box aligned to the orientation of a 3d Element\r\n * @public\r\n * @extensions\r\n */\r\nexport type ElementAlignedBox3d = Range3d;\r\n\r\n/** A bounding box aligned to the orientation of a 2d Element\r\n * @public\r\n * @extensions\r\n */\r\nexport type ElementAlignedBox2d = Range2d;\r\n\r\n/** A bounding box aligned to a local coordinate system\r\n * @public\r\n * @extensions\r\n */\r\nexport type LocalAlignedBox3d = Range3d;\r\n\r\n/** Either a Placement2d or Placement3d\r\n * @public\r\n * @extensions\r\n */\r\nexport type Placement = Placement2d | Placement3d;\r\n\r\n/** The placement of a GeometricElement3d. This includes the origin, orientation, and size (bounding box) of the element.\r\n * All geometry of a GeometricElement are relative to its placement.\r\n * @public\r\n */\r\nexport class Placement3d implements Placement3dProps {\r\n public constructor(public origin: Point3d, public angles: YawPitchRollAngles, public bbox: ElementAlignedBox3d) { }\r\n /** Get the rotation from local coordinates of this placement to world coordinates. */\r\n public get rotation(): Matrix3d { return this.angles.toMatrix3d(); }\r\n /** Get the transform from local coordinates of this placement to world coordinates. */\r\n public get transform(): Transform { return Transform.createOriginAndMatrix(this.origin, this.rotation); }\r\n /** determine if this is 3d placement */\r\n public get is3d(): boolean { return true; }\r\n\r\n /** Create a new Placement3d from a Placement3dProps. */\r\n public static fromJSON(json?: Placement3dProps): Placement3d {\r\n const props: any = json ? json : {};\r\n return new Placement3d(Point3d.fromJSON(props.origin), YawPitchRollAngles.fromJSON(props.angles), Range3d.fromJSON<ElementAlignedBox3d>(props.bbox));\r\n }\r\n\r\n /** Get the 8 corners, in world coordinates, of this placement. */\r\n public getWorldCorners(out?: Frustum): Frustum {\r\n const frust = Frustum.fromRange(this.bbox, out);\r\n frust.multiply(this.transform);\r\n return frust;\r\n }\r\n\r\n /** Set the contents of this Placement3d from another Placement3d */\r\n public setFrom(other: Placement3d) {\r\n this.origin.setFrom(other.origin);\r\n this.angles.setFrom(other.angles);\r\n this.bbox.setFrom(other.bbox);\r\n }\r\n\r\n /** Determine whether this Placement3d is valid. */\r\n public get isValid(): boolean { return !this.bbox.isNull && Math.max(this.origin.maxAbs(), this.bbox.maxAbs()) < Constant.circumferenceOfEarth; }\r\n\r\n /** Calculate the axis-aligned bounding box for this placement. */\r\n public calculateRange(): AxisAlignedBox3d {\r\n const range = new Range3d();\r\n if (!this.isValid)\r\n return range;\r\n\r\n this.transform.multiplyRange(this.bbox, range);\r\n\r\n // low and high are not allowed to be equal\r\n range.ensureMinLengths();\r\n return range;\r\n }\r\n\r\n /** Multiply the Transform of this Placement3d by the specified *other* Transform.\r\n * * Specifically `this.angles` is set to the rotation specified by `other.matrix * this.transform.matrix`\r\n * and `this.origin` is set to the origin of `other * this.transform`.\r\n * * Since the placement transform is local-to-world, this means `other` is a world-to-world transform.\r\n * @throws [[IModelError]] if the Transform is invalid for a GeometricElement3d.\r\n */\r\n public multiplyTransform(other: Transform): void {\r\n const transform = other.multiplyTransformTransform(this.transform);\r\n const angles = YawPitchRollAngles.createFromMatrix3d(transform.matrix);\r\n if (undefined === angles)\r\n throw new IModelError(IModelStatus.BadRequest, \"Invalid Transform\");\r\n\r\n this.angles = angles;\r\n this.origin.setFrom(transform.origin);\r\n }\r\n}\r\n\r\n/** The placement of a GeometricElement2d. This includes the origin, rotation, and size (bounding box) of the element.\r\n * @public\r\n */\r\nexport class Placement2d implements Placement2dProps {\r\n public constructor(public origin: Point2d, public angle: Angle, public bbox: ElementAlignedBox2d) { }\r\n /** Get the rotation from local coordinates of this placement to world coordinates. */\r\n public get rotation(): Matrix3d { return Matrix3d.createRotationAroundVector(Vector3d.unitZ(), this.angle)!; }\r\n /** Get the transform from local coordinates of this placement to world coordinates. */\r\n public get transform(): Transform { return Transform.createOriginAndMatrix(Point3d.createFrom(this.origin), this.rotation); }\r\n /** Create a new Placement2d from a Placement2dProps. */\r\n public static fromJSON(json?: Placement2dProps): Placement2d {\r\n const props: any = json ? json : {};\r\n return new Placement2d(Point2d.fromJSON(props.origin), Angle.fromJSON(props.angle), Range2d.fromJSON(props.bbox));\r\n }\r\n /** determine if this is 3d placement */\r\n public get is3d(): boolean { return false; }\r\n\r\n /** Get the 8 corners, in world coordinates, of this placement. */\r\n public getWorldCorners(out?: Frustum): Frustum {\r\n const frust = Frustum.fromRange(this.bbox, out);\r\n frust.multiply(this.transform);\r\n return frust;\r\n }\r\n\r\n /** Determine whether this Placement2d is valid. */\r\n public get isValid(): boolean { return !this.bbox.isNull && Math.max(this.origin.maxAbs(), this.bbox.maxAbs()) < Constant.circumferenceOfEarth; }\r\n\r\n /** Set the contents of this Placement2d from another Placement2d */\r\n public setFrom(other: Placement2d) {\r\n this.origin.setFrom(other.origin);\r\n this.angle.setFrom(other.angle);\r\n this.bbox.setFrom(other.bbox);\r\n }\r\n\r\n /** Calculate the axis-aligned bounding box for this placement. */\r\n public calculateRange(): AxisAlignedBox3d {\r\n const range = new Range3d();\r\n if (!this.isValid)\r\n return range;\r\n\r\n this.transform.multiplyRange(Range3d.createRange2d(this.bbox, 0), range);\r\n\r\n // low and high are not allowed to be equal\r\n range.ensureMinLengths();\r\n range.low.z = - 1.0; // is the 2dFrustumDepth, which === 1 meter\r\n range.high.z = 1.0;\r\n return range;\r\n }\r\n\r\n /** Multiply the Transform of this Placement2d by the specified *other* Transform.\r\n * @throws [[IModelError]] if the Transform is invalid for a GeometricElement2d.\r\n */\r\n public multiplyTransform(other: Transform): void {\r\n const transform = other.multiplyTransformTransform(this.transform);\r\n const angles = YawPitchRollAngles.createFromMatrix3d(transform.matrix);\r\n if ((undefined === angles) || !angles.pitch.isAlmostZero || !angles.roll.isAlmostZero)\r\n throw new IModelError(IModelStatus.BadRequest, \"Invalid Transform\");\r\n\r\n this.angle = angles.yaw;\r\n this.origin.setFrom(transform.origin);\r\n }\r\n}\r\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @module Geometry
|
|
3
3
|
*/
|
|
4
4
|
import { Id64Array, Id64String } from "@itwin/core-bentley";
|
|
5
|
-
import { Matrix4dProps, XYZProps } from "@itwin/core-geometry";
|
|
5
|
+
import { Matrix4dProps, TransformProps, XYZProps } from "@itwin/core-geometry";
|
|
6
6
|
import { GeometryStreamProps } from "../geometry/GeometryStream";
|
|
7
7
|
import { GeometryClass } from "../GeometryParams";
|
|
8
8
|
import { ViewFlagProps } from "../ViewFlags";
|
|
@@ -30,6 +30,12 @@ export interface SnapRequestProps {
|
|
|
30
30
|
geometryClass?: GeometryClass;
|
|
31
31
|
intersectCandidates?: Id64Array;
|
|
32
32
|
decorationGeometry?: DecorationGeometryProps[];
|
|
33
|
+
/** A transform to be applied to the snap geometry.
|
|
34
|
+
* testPoint, closePoint, and worldToView are in "world" coordinates (the coordinates of the viewport's iModel).
|
|
35
|
+
* The snap geometry is in "model" coordinates (the coordinates of the iModel to which we're snapping).
|
|
36
|
+
* In normal cases these are the same iModel. They may differ when people draw multiple iModels into the same viewport.
|
|
37
|
+
*/
|
|
38
|
+
modelToWorld?: TransformProps;
|
|
33
39
|
}
|
|
34
40
|
/** Information returned from the back end to the front end holding the result of a *snap* operation.
|
|
35
41
|
* @internal RPC glue.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Snapping.d.ts","sourceRoot":"","sources":["../../../src/internal/Snapping.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC/
|
|
1
|
+
{"version":3,"file":"Snapping.d.ts","sourceRoot":"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QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,SAAS,CAAC,EAAE,QAAQ,CAAC;IACrB,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,cAAc,CAAC,EAAE,GAAG,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Snapping.js","sourceRoot":"","sources":["../../../src/internal/Snapping.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Geometry\r\n */\r\n\r\nimport { Id64Array, Id64String } from \"@itwin/core-bentley\";\r\nimport { Matrix4dProps, XYZProps } from \"@itwin/core-geometry\";\r\nimport { GeometryStreamProps } from \"../geometry/GeometryStream\";\r\nimport { GeometryClass } from \"../GeometryParams\";\r\nimport { ViewFlagProps } from \"../ViewFlags\";\r\n\r\n/** Information required to request a *snap* to a pickable decoration from the front end to the back end.\r\n * @internal RPC glue.\r\n */\r\nexport interface DecorationGeometryProps {\r\n readonly id: Id64String;\r\n readonly geometryStream: GeometryStreamProps;\r\n}\r\n\r\n/** Information required to request a *snap* to an element from the front end to the back end.\r\n * Includes the viewing parameters so that snap can be relative to the view direction, viewing mode, etc.\r\n * @internal RPC glue.\r\n */\r\nexport interface SnapRequestProps {\r\n id: Id64String;\r\n testPoint: XYZProps;\r\n closePoint: XYZProps;\r\n worldToView: Matrix4dProps;\r\n viewFlags?: ViewFlagProps;\r\n snapModes?: number[];\r\n snapAperture?: number;\r\n snapDivisor?: number;\r\n subCategoryId?: Id64String;\r\n geometryClass?: GeometryClass;\r\n intersectCandidates?: Id64Array;\r\n decorationGeometry?: DecorationGeometryProps[];\r\n}\r\n\r\n/** Information returned from the back end to the front end holding the result of a *snap* operation.\r\n * @internal RPC glue.\r\n */\r\nexport interface SnapResponseProps {\r\n status: number;\r\n snapMode?: number;\r\n heat?: number;\r\n geomType?: number;\r\n parentGeomType?: number;\r\n hitPoint?: XYZProps;\r\n snapPoint?: XYZProps;\r\n normal?: XYZProps;\r\n curve?: any;\r\n intersectCurve?: any;\r\n intersectId?: string;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"Snapping.js","sourceRoot":"","sources":["../../../src/internal/Snapping.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Geometry\r\n */\r\n\r\nimport { Id64Array, Id64String } from \"@itwin/core-bentley\";\r\nimport { Matrix4dProps, TransformProps, XYZProps } from \"@itwin/core-geometry\";\r\nimport { GeometryStreamProps } from \"../geometry/GeometryStream\";\r\nimport { GeometryClass } from \"../GeometryParams\";\r\nimport { ViewFlagProps } from \"../ViewFlags\";\r\n\r\n/** Information required to request a *snap* to a pickable decoration from the front end to the back end.\r\n * @internal RPC glue.\r\n */\r\nexport interface DecorationGeometryProps {\r\n readonly id: Id64String;\r\n readonly geometryStream: GeometryStreamProps;\r\n}\r\n\r\n/** Information required to request a *snap* to an element from the front end to the back end.\r\n * Includes the viewing parameters so that snap can be relative to the view direction, viewing mode, etc.\r\n * @internal RPC glue.\r\n */\r\nexport interface SnapRequestProps {\r\n id: Id64String;\r\n testPoint: XYZProps;\r\n closePoint: XYZProps;\r\n worldToView: Matrix4dProps;\r\n viewFlags?: ViewFlagProps;\r\n snapModes?: number[];\r\n snapAperture?: number;\r\n snapDivisor?: number;\r\n subCategoryId?: Id64String;\r\n geometryClass?: GeometryClass;\r\n intersectCandidates?: Id64Array;\r\n decorationGeometry?: DecorationGeometryProps[];\r\n /** A transform to be applied to the snap geometry.\r\n * testPoint, closePoint, and worldToView are in \"world\" coordinates (the coordinates of the viewport's iModel).\r\n * The snap geometry is in \"model\" coordinates (the coordinates of the iModel to which we're snapping).\r\n * In normal cases these are the same iModel. They may differ when people draw multiple iModels into the same viewport.\r\n */\r\n modelToWorld?: TransformProps;\r\n}\r\n\r\n/** Information returned from the back end to the front end holding the result of a *snap* operation.\r\n * @internal RPC glue.\r\n */\r\nexport interface SnapResponseProps {\r\n status: number;\r\n snapMode?: number;\r\n heat?: number;\r\n geomType?: number;\r\n parentGeomType?: number;\r\n hitPoint?: XYZProps;\r\n snapPoint?: XYZProps;\r\n normal?: XYZProps;\r\n curve?: any;\r\n intersectCurve?: any;\r\n intersectId?: string;\r\n}\r\n"]}
|
|
@@ -19,20 +19,33 @@ export type IpcListener = (evt: Event, ...args: any[]) => void;
|
|
|
19
19
|
export type RemoveFunction = () => void;
|
|
20
20
|
/**
|
|
21
21
|
* Payload of an IpcInvoke response. The presence of `error` indicates that the backend threw an exception and the
|
|
22
|
-
* frontend will re-throw a [BackendError]$(frontend) with the `errorNumber` and `message` values.
|
|
23
|
-
*
|
|
22
|
+
* frontend will re-throw a [BackendError]$(frontend) with the `errorNumber` and `message` values.
|
|
23
|
+
* The presence of iTwinError indicates that the backend threw an exception of type [[ITwinError]] and the frontend will re-throw that same error.
|
|
24
|
+
* Otherwise the `result` member holds the response.
|
|
24
25
|
* @internal */
|
|
25
26
|
export type IpcInvokeReturn = {
|
|
26
27
|
result: any;
|
|
27
28
|
error?: never;
|
|
29
|
+
iTwinError?: never;
|
|
28
30
|
} | {
|
|
29
31
|
result?: never;
|
|
32
|
+
iTwinError?: never;
|
|
30
33
|
error: {
|
|
31
34
|
name: string;
|
|
32
35
|
message: string;
|
|
33
36
|
errorNumber: number;
|
|
34
37
|
stack?: string;
|
|
35
38
|
};
|
|
39
|
+
} | {
|
|
40
|
+
result?: never;
|
|
41
|
+
error?: never;
|
|
42
|
+
iTwinError: {
|
|
43
|
+
namespace: string;
|
|
44
|
+
errorKey: string;
|
|
45
|
+
message: string;
|
|
46
|
+
stack?: string;
|
|
47
|
+
[key: string]: any;
|
|
48
|
+
};
|
|
36
49
|
};
|
|
37
50
|
/**
|
|
38
51
|
* An inter-process socket connection between a single [IModelHost]($backend) on the backend (the node process), and an [IModelApp]($frontend) on
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IpcSocket.d.ts","sourceRoot":"","sources":["../../../src/ipc/IpcSocket.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;KAGK;AACL,eAAO,MAAM,YAAY,YAAa,MAAM,WAAuB,CAAC;AAEpE;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;AAE/D;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC;AAExC
|
|
1
|
+
{"version":3,"file":"IpcSocket.d.ts","sourceRoot":"","sources":["../../../src/ipc/IpcSocket.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;KAGK;AACL,eAAO,MAAM,YAAY,YAAa,MAAM,WAAuB,CAAC;AAEpE;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;AAE/D;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC;AAExC;;;;;eAKe;AACf,MAAM,MAAM,eAAe,GAAG;IAAE,MAAM,EAAE,GAAG,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAC;IAAC,UAAU,CAAC,EAAE,KAAK,CAAA;CAAE,GAAG;IAAE,MAAM,CAAC,EAAE,KAAK,CAAC;IAAC,UAAU,CAAC,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE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@@
|
|
|
1
|
-
{"version":3,"file":"IpcSocket.js","sourceRoot":"","sources":["../../../src/ipc/IpcSocket.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;;KAGK;AACE,MAAM,YAAY,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,SAAS,OAAO,EAAE,CAAC;AAAvD,QAAA,YAAY,gBAA2C","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module IpcSocket\r\n */\r\n\r\n/**\r\n * The prefix for all IpcSocket channels to disambiguate from system channels.\r\n * @internal\r\n * */\r\nexport const iTwinChannel = (channel: string) => `itwin.${channel}`;\r\n\r\n/**\r\n * A function to handle an Ipc message.\r\n * @public\r\n */\r\nexport type IpcListener = (evt: Event, ...args: any[]) => void;\r\n\r\n/**\r\n * Function returned when establishing an Ipc `receive` listener or `invoke` handler. Call this method to remove the listener/handler.\r\n * @public\r\n * @extensions\r\n */\r\nexport type RemoveFunction = () => void;\r\n\r\n/**\r\n * Payload of an IpcInvoke response. The presence of `error` indicates that the backend threw an exception and the\r\n * frontend will re-throw a [BackendError]$(frontend) with the `errorNumber` and `message` values
|
|
1
|
+
{"version":3,"file":"IpcSocket.js","sourceRoot":"","sources":["../../../src/ipc/IpcSocket.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;;KAGK;AACE,MAAM,YAAY,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,SAAS,OAAO,EAAE,CAAC;AAAvD,QAAA,YAAY,gBAA2C","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module IpcSocket\r\n */\r\n\r\n/**\r\n * The prefix for all IpcSocket channels to disambiguate from system channels.\r\n * @internal\r\n * */\r\nexport const iTwinChannel = (channel: string) => `itwin.${channel}`;\r\n\r\n/**\r\n * A function to handle an Ipc message.\r\n * @public\r\n */\r\nexport type IpcListener = (evt: Event, ...args: any[]) => void;\r\n\r\n/**\r\n * Function returned when establishing an Ipc `receive` listener or `invoke` handler. Call this method to remove the listener/handler.\r\n * @public\r\n * @extensions\r\n */\r\nexport type RemoveFunction = () => void;\r\n\r\n/**\r\n * Payload of an IpcInvoke response. The presence of `error` indicates that the backend threw an exception and the\r\n * frontend will re-throw a [BackendError]$(frontend) with the `errorNumber` and `message` values.\r\n * The presence of iTwinError indicates that the backend threw an exception of type [[ITwinError]] and the frontend will re-throw that same error.\r\n * Otherwise the `result` member holds the response.\r\n * @internal */\r\nexport type IpcInvokeReturn = { result: any, error?: never, iTwinError?: never } | { result?: never, iTwinError?: never, error: { name: string, message: string, errorNumber: number, stack?: string } } |\r\n{ result?: never, error?: never, iTwinError: {namespace: string, errorKey: string, message: string, stack?: string, [key: string]: any} };\r\n/**\r\n * An inter-process socket connection between a single [IModelHost]($backend) on the backend (the node process), and an [IModelApp]($frontend) on\r\n * the frontend (the browser process.) Each side will implement this interface to form a two way connection. The frontend and backend\r\n * processes connected through an IpcSocket don't necessarily have to be on the same computer, but often are.\r\n * @public\r\n*/\r\nexport interface IpcSocket {\r\n /**\r\n * Send a message over the socket.\r\n * @param channel The name of the channel for the message. Must begin with the [[iTwinChannel]] prefix.\r\n * @param data The optional data of the message.\r\n * @note `data` is serialized with the [Structured Clone Algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), so only\r\n * primitive types and `ArrayBuffers` are allowed.\r\n */\r\n send: (channel: string, ...data: any[]) => void;\r\n /**\r\n * Establish a handler to receive messages for a channel through a socket.\r\n * @param channel The name of the channel for the messages. Must begin with the [[iTwinChannel]] prefix.\r\n * @param listener A function called when messages are sent over `channel`\r\n * @note returns A function to call to remove the listener.\r\n */\r\n addListener: (channel: string, listener: IpcListener) => RemoveFunction;\r\n /**\r\n * Remove a previously registered listener\r\n * @param channel The name of the channel for the listener previously registered with [[addListener]]\r\n * @param listener The function passed to [[addListener]]\r\n */\r\n removeListener: (channel: string, listener: IpcListener) => void;\r\n}\r\n\r\n/**\r\n * Interface for the frontend (browser) side of a socket connection. Frontends may invoke methods implemented on the backend.\r\n * @public\r\n */\r\nexport interface IpcSocketFrontend extends IpcSocket {\r\n /**\r\n * Send a message to the backend via `channel` and expect a result asynchronously.\r\n * @param channel The name of the channel for the method. Must begin with the [[iTwinChannel]] prefix.\r\n * @see Electron [ipcRenderer.invoke](https://www.electronjs.org/docs/api/ipc-renderer) documentation for details.\r\n * Note that this interface *may* be implemented via Electron for desktop apps, or via\r\n * [WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) for mobile or web-based\r\n * Ipc connections. In either case, the Electron documentation provides the specifications for how it works.\r\n * @note `args` are serialized with the [Structured Clone Algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), so only\r\n * primitive types and `ArrayBuffers` are allowed.\r\n */\r\n invoke: (channel: string, ...args: any[]) => Promise<any>;\r\n}\r\n\r\n/**\r\n * Interface for the backend (Node.js) side of a socket connection. Backends provide the implementation\r\n * of methods that are invoked from the frontend.\r\n * @public\r\n */\r\nexport interface IpcSocketBackend extends IpcSocket {\r\n /**\r\n * Establish a backend implementation of an Ipc interface for a channel.\r\n * @param channel The name of the channel for this handler. Must begin with the [[iTwinChannel]] prefix.\r\n * @param handler A function that supplies the implementation for methods invoked over `channel` via [[IpcSocketFrontend.invoke]]\r\n * @note returns A function to call to remove the handler.\r\n */\r\n handle: (channel: string, handler: (...args: any[]) => Promise<any>) => RemoveFunction;\r\n}\r\n\r\n"]}
|