@itwin/core-frontend 4.0.0-dev.24 → 4.0.0-dev.30
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 +43 -36
- package/lib/cjs/AccuDraw.js +1 -1
- package/lib/cjs/AccuDraw.js.map +1 -1
- package/lib/cjs/AccuSnap.js +3 -3
- package/lib/cjs/AccuSnap.js.map +1 -1
- package/lib/cjs/BriefcaseConnection.js +9 -11
- package/lib/cjs/BriefcaseConnection.js.map +1 -1
- package/lib/cjs/DisplayStyleState.js +8 -12
- package/lib/cjs/DisplayStyleState.js.map +1 -1
- package/lib/cjs/DrawingViewState.js +4 -6
- package/lib/cjs/DrawingViewState.js.map +1 -1
- package/lib/cjs/EnvironmentDecorations.js +2 -3
- package/lib/cjs/EnvironmentDecorations.js.map +1 -1
- package/lib/cjs/FlashSettings.js +3 -4
- package/lib/cjs/FlashSettings.js.map +1 -1
- package/lib/cjs/GeoServices.js +7 -9
- package/lib/cjs/GeoServices.js.map +1 -1
- package/lib/cjs/IModelApp.js +19 -21
- package/lib/cjs/IModelApp.js.map +1 -1
- package/lib/cjs/IModelConnection.js +1 -1
- package/lib/cjs/IModelConnection.js.map +1 -1
- package/lib/cjs/IpcApp.js +1 -1
- package/lib/cjs/IpcApp.js.map +1 -1
- package/lib/cjs/LocalhostIpcApp.js +3 -4
- package/lib/cjs/LocalhostIpcApp.js.map +1 -1
- package/lib/cjs/ModelState.js +2 -3
- package/lib/cjs/ModelState.js.map +1 -1
- package/lib/cjs/NativeApp.js +4 -7
- package/lib/cjs/NativeApp.js.map +1 -1
- package/lib/cjs/NoRenderApp.js +1 -2
- package/lib/cjs/NoRenderApp.js.map +1 -1
- package/lib/cjs/PlanarClipMaskState.js +1 -1
- package/lib/cjs/PlanarClipMaskState.js.map +1 -1
- package/lib/cjs/RealityDataSourceContextShareImpl.js +2 -4
- package/lib/cjs/RealityDataSourceContextShareImpl.js.map +1 -1
- package/lib/cjs/SheetViewState.js +15 -23
- package/lib/cjs/SheetViewState.js.map +1 -1
- package/lib/cjs/Tiles.js +2 -2
- package/lib/cjs/Tiles.js.map +1 -1
- package/lib/cjs/ViewContext.js +1 -1
- package/lib/cjs/ViewContext.js.map +1 -1
- package/lib/cjs/ViewCreator2d.js +4 -5
- package/lib/cjs/ViewCreator2d.js.map +1 -1
- package/lib/cjs/ViewCreator3d.js +5 -5
- package/lib/cjs/ViewCreator3d.js.map +1 -1
- package/lib/cjs/ViewState.js +17 -24
- package/lib/cjs/ViewState.js.map +1 -1
- package/lib/cjs/Viewport.js +22 -32
- package/lib/cjs/Viewport.js.map +1 -1
- package/lib/cjs/extension/ExtensionImpl.js +1 -1
- package/lib/cjs/extension/ExtensionImpl.js.map +1 -1
- package/lib/cjs/quantity-formatting/BaseUnitFormattingSettingsProvider.js +2 -3
- package/lib/cjs/quantity-formatting/BaseUnitFormattingSettingsProvider.js.map +1 -1
- package/lib/cjs/quantity-formatting/QuantityFormatter.js +7 -9
- package/lib/cjs/quantity-formatting/QuantityFormatter.js.map +1 -1
- package/lib/cjs/render/FeatureSymbology.js +1 -2
- package/lib/cjs/render/FeatureSymbology.js.map +1 -1
- package/lib/cjs/render/GraphicBuilder.js +7 -9
- package/lib/cjs/render/GraphicBuilder.js.map +1 -1
- package/lib/cjs/render/MockRender.js +1 -2
- package/lib/cjs/render/MockRender.js.map +1 -1
- package/lib/cjs/render/ParticleCollectionBuilder.js +2 -3
- package/lib/cjs/render/ParticleCollectionBuilder.js.map +1 -1
- package/lib/cjs/render/RealityMeshParams.js +7 -10
- package/lib/cjs/render/RealityMeshParams.js.map +1 -1
- package/lib/cjs/render/RenderPlan.js +1 -1
- package/lib/cjs/render/RenderPlan.js.map +1 -1
- package/lib/cjs/render/RenderSystem.js +1 -2
- package/lib/cjs/render/RenderSystem.js.map +1 -1
- package/lib/cjs/render/VisibleFeature.js +2 -4
- package/lib/cjs/render/VisibleFeature.js.map +1 -1
- package/lib/cjs/render/primitives/AuxChannelTable.js +6 -9
- package/lib/cjs/render/primitives/AuxChannelTable.js.map +1 -1
- package/lib/cjs/render/primitives/EdgeParams.js +6 -7
- package/lib/cjs/render/primitives/EdgeParams.js.map +1 -1
- package/lib/cjs/render/primitives/PolylineParams.js +2 -3
- package/lib/cjs/render/primitives/PolylineParams.js.map +1 -1
- package/lib/cjs/render/primitives/VertexKey.js +1 -1
- package/lib/cjs/render/primitives/VertexKey.js.map +1 -1
- package/lib/cjs/render/primitives/VertexTable.js +1 -1
- package/lib/cjs/render/primitives/VertexTable.js.map +1 -1
- package/lib/cjs/render/primitives/VertexTableSplitter.js +6 -8
- package/lib/cjs/render/primitives/VertexTableSplitter.js.map +1 -1
- package/lib/cjs/render/primitives/geometry/GeometryAccumulator.js +9 -11
- package/lib/cjs/render/primitives/geometry/GeometryAccumulator.js.map +1 -1
- package/lib/cjs/render/primitives/geometry/GeometryListBuilder.js +3 -5
- package/lib/cjs/render/primitives/geometry/GeometryListBuilder.js.map +1 -1
- package/lib/cjs/render/primitives/mesh/MeshBuilder.js +1 -1
- package/lib/cjs/render/primitives/mesh/MeshBuilder.js.map +1 -1
- package/lib/cjs/render/primitives/mesh/MeshPrimitives.js +2 -3
- package/lib/cjs/render/primitives/mesh/MeshPrimitives.js.map +1 -1
- package/lib/cjs/render/webgl/BranchState.js +9 -10
- package/lib/cjs/render/webgl/BranchState.js.map +1 -1
- package/lib/cjs/render/webgl/EDL.js +17 -21
- package/lib/cjs/render/webgl/EDL.js.map +1 -1
- package/lib/cjs/render/webgl/FeatureOverrides.js +2 -2
- package/lib/cjs/render/webgl/FeatureOverrides.js.map +1 -1
- package/lib/cjs/render/webgl/Graphic.js +3 -5
- package/lib/cjs/render/webgl/Graphic.js.map +1 -1
- package/lib/cjs/render/webgl/IndexedEdgeGeometry.js +1 -1
- package/lib/cjs/render/webgl/IndexedEdgeGeometry.js.map +1 -1
- package/lib/cjs/render/webgl/InstancedGeometry.js +2 -3
- package/lib/cjs/render/webgl/InstancedGeometry.js.map +1 -1
- package/lib/cjs/render/webgl/Mesh.js +7 -10
- package/lib/cjs/render/webgl/Mesh.js.map +1 -1
- package/lib/cjs/render/webgl/MeshData.js +1 -2
- package/lib/cjs/render/webgl/MeshData.js.map +1 -1
- package/lib/cjs/render/webgl/PlanarClassifier.js +10 -15
- package/lib/cjs/render/webgl/PlanarClassifier.js.map +1 -1
- package/lib/cjs/render/webgl/RealityMesh.js +5 -8
- package/lib/cjs/render/webgl/RealityMesh.js.map +1 -1
- package/lib/cjs/render/webgl/RealityModelUniforms.js +3 -4
- package/lib/cjs/render/webgl/RealityModelUniforms.js.map +1 -1
- package/lib/cjs/render/webgl/RenderCommands.js +7 -8
- package/lib/cjs/render/webgl/RenderCommands.js.map +1 -1
- package/lib/cjs/render/webgl/SceneCompositor.js +7 -9
- package/lib/cjs/render/webgl/SceneCompositor.js.map +1 -1
- package/lib/cjs/render/webgl/ShaderBuilder.js +1 -2
- package/lib/cjs/render/webgl/ShaderBuilder.js.map +1 -1
- package/lib/cjs/render/webgl/SolarShadowMap.js +1 -2
- package/lib/cjs/render/webgl/SolarShadowMap.js.map +1 -1
- package/lib/cjs/render/webgl/SurfaceGeometry.js +1 -1
- package/lib/cjs/render/webgl/SurfaceGeometry.js.map +1 -1
- package/lib/cjs/render/webgl/System.js +12 -16
- package/lib/cjs/render/webgl/System.js.map +1 -1
- package/lib/cjs/render/webgl/Target.js +9 -14
- package/lib/cjs/render/webgl/Target.js.map +1 -1
- package/lib/cjs/render/webgl/TargetGraphics.js +1 -2
- package/lib/cjs/render/webgl/TargetGraphics.js.map +1 -1
- package/lib/cjs/render/webgl/Texture.js +1 -2
- package/lib/cjs/render/webgl/Texture.js.map +1 -1
- package/lib/cjs/render/webgl/ThematicSensors.js +2 -4
- package/lib/cjs/render/webgl/ThematicSensors.js.map +1 -1
- package/lib/cjs/render/webgl/VisibleTileFeatures.js +1 -2
- package/lib/cjs/render/webgl/VisibleTileFeatures.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/Animation.js +6 -9
- package/lib/cjs/render/webgl/glsl/Animation.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/FeatureSymbology.js +1 -2
- package/lib/cjs/render/webgl/glsl/FeatureSymbology.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/Instancing.js +4 -5
- package/lib/cjs/render/webgl/glsl/Instancing.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/RealityMesh.js +2 -4
- package/lib/cjs/render/webgl/glsl/RealityMesh.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/Surface.js +1 -2
- package/lib/cjs/render/webgl/glsl/Surface.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/Thematic.js +1 -2
- package/lib/cjs/render/webgl/glsl/Thematic.js.map +1 -1
- package/lib/cjs/tile/ClassifierTileTree.js +3 -3
- package/lib/cjs/tile/ClassifierTileTree.js.map +1 -1
- package/lib/cjs/tile/GltfReader.js +61 -75
- package/lib/cjs/tile/GltfReader.js.map +1 -1
- package/lib/cjs/tile/IModelTile.js +2 -3
- package/lib/cjs/tile/IModelTile.js.map +1 -1
- package/lib/cjs/tile/IModelTileRequestChannels.js +6 -11
- package/lib/cjs/tile/IModelTileRequestChannels.js.map +1 -1
- package/lib/cjs/tile/IModelTileTree.js +5 -9
- package/lib/cjs/tile/IModelTileTree.js.map +1 -1
- package/lib/cjs/tile/ImdlReader.js +13 -17
- package/lib/cjs/tile/ImdlReader.js.map +1 -1
- package/lib/cjs/tile/OrbitGtTileTree.js +2 -2
- package/lib/cjs/tile/OrbitGtTileTree.js.map +1 -1
- package/lib/cjs/tile/PntsReader.js +4 -5
- package/lib/cjs/tile/PntsReader.js.map +1 -1
- package/lib/cjs/tile/PrimaryTileTree.js +22 -32
- package/lib/cjs/tile/PrimaryTileTree.js.map +1 -1
- package/lib/cjs/tile/RealityModelTileTree.js +12 -19
- package/lib/cjs/tile/RealityModelTileTree.js.map +1 -1
- package/lib/cjs/tile/RealityTile.js +3 -5
- package/lib/cjs/tile/RealityTile.js.map +1 -1
- package/lib/cjs/tile/RealityTileLoader.js +2 -2
- package/lib/cjs/tile/RealityTileLoader.js.map +1 -1
- package/lib/cjs/tile/ThreeDTileFormatInterpreter.js +3 -5
- package/lib/cjs/tile/ThreeDTileFormatInterpreter.js.map +1 -1
- package/lib/cjs/tile/Tile.js +1 -1
- package/lib/cjs/tile/Tile.js.map +1 -1
- package/lib/cjs/tile/TileAdmin.js +22 -27
- package/lib/cjs/tile/TileAdmin.js.map +1 -1
- package/lib/cjs/tile/TileDrawArgs.js +3 -6
- package/lib/cjs/tile/TileDrawArgs.js.map +1 -1
- package/lib/cjs/tile/TileRequestChannels.js +1 -1
- package/lib/cjs/tile/TileRequestChannels.js.map +1 -1
- package/lib/cjs/tile/TileTree.js +2 -3
- package/lib/cjs/tile/TileTree.js.map +1 -1
- package/lib/cjs/tile/TiledGraphicsProvider.js +1 -1
- package/lib/cjs/tile/TiledGraphicsProvider.js.map +1 -1
- package/lib/cjs/tile/map/ArcGISTileMap.js +5 -6
- package/lib/cjs/tile/map/ArcGISTileMap.js.map +1 -1
- package/lib/cjs/tile/map/ArcGisUtilities.js +6 -8
- package/lib/cjs/tile/map/ArcGisUtilities.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISImageryProvider.js +4 -7
- package/lib/cjs/tile/map/ImageryProviders/ArcGISImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +6 -8
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/BingImageryProvider.js +1 -2
- package/lib/cjs/tile/map/ImageryProviders/BingImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/WmsMapLayerImageryProvider.js +14 -19
- package/lib/cjs/tile/map/ImageryProviders/WmsMapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js +14 -20
- package/lib/cjs/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/MapCartoRectangle.js +1 -1
- package/lib/cjs/tile/map/MapCartoRectangle.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerFormatRegistry.js +5 -6
- package/lib/cjs/tile/map/MapLayerFormatRegistry.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerImageryFormats.js +11 -14
- package/lib/cjs/tile/map/MapLayerImageryFormats.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerImageryProvider.js +2 -3
- package/lib/cjs/tile/map/MapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerSources.js +1 -1
- package/lib/cjs/tile/map/MapLayerSources.js.map +1 -1
- package/lib/cjs/tile/map/MapTile.js +6 -8
- package/lib/cjs/tile/map/MapTile.js.map +1 -1
- package/lib/cjs/tile/map/MapTileLoader.js +1 -1
- package/lib/cjs/tile/map/MapTileLoader.js.map +1 -1
- package/lib/cjs/tile/map/MapTileTree.js +13 -18
- package/lib/cjs/tile/map/MapTileTree.js.map +1 -1
- package/lib/cjs/tile/map/MapTiledGraphicsProvider.js +6 -7
- package/lib/cjs/tile/map/MapTiledGraphicsProvider.js.map +1 -1
- package/lib/cjs/tile/map/WmsCapabilities.js +4 -5
- package/lib/cjs/tile/map/WmsCapabilities.js.map +1 -1
- package/lib/cjs/tile/map/WmtsCapabilities.js +17 -25
- package/lib/cjs/tile/map/WmtsCapabilities.js.map +1 -1
- package/lib/cjs/tools/ClipViewTool.js +1 -1
- package/lib/cjs/tools/ClipViewTool.js.map +1 -1
- package/lib/cjs/tools/MeasureTool.js +2 -4
- package/lib/cjs/tools/MeasureTool.js.map +1 -1
- package/lib/cjs/tools/PrimitiveTool.js +2 -3
- package/lib/cjs/tools/PrimitiveTool.js.map +1 -1
- package/lib/cjs/tools/SelectTool.js +1 -2
- package/lib/cjs/tools/SelectTool.js.map +1 -1
- package/lib/cjs/tools/Tool.js +2 -3
- package/lib/cjs/tools/Tool.js.map +1 -1
- package/lib/cjs/tools/ToolAdmin.js +2 -4
- package/lib/cjs/tools/ToolAdmin.js.map +1 -1
- package/lib/cjs/tools/ViewTool.js +3 -3
- package/lib/cjs/tools/ViewTool.js.map +1 -1
- package/lib/esm/AccuDraw.js +1 -1
- package/lib/esm/AccuDraw.js.map +1 -1
- package/lib/esm/AccuSnap.js +3 -3
- package/lib/esm/AccuSnap.js.map +1 -1
- package/lib/esm/BriefcaseConnection.js +9 -11
- package/lib/esm/BriefcaseConnection.js.map +1 -1
- package/lib/esm/DisplayStyleState.js +8 -12
- package/lib/esm/DisplayStyleState.js.map +1 -1
- package/lib/esm/DrawingViewState.js +4 -6
- package/lib/esm/DrawingViewState.js.map +1 -1
- package/lib/esm/EnvironmentDecorations.js +2 -3
- package/lib/esm/EnvironmentDecorations.js.map +1 -1
- package/lib/esm/FlashSettings.js +3 -4
- package/lib/esm/FlashSettings.js.map +1 -1
- package/lib/esm/GeoServices.js +7 -9
- package/lib/esm/GeoServices.js.map +1 -1
- package/lib/esm/IModelApp.js +19 -21
- package/lib/esm/IModelApp.js.map +1 -1
- package/lib/esm/IModelConnection.js +1 -1
- package/lib/esm/IModelConnection.js.map +1 -1
- package/lib/esm/IpcApp.js +1 -1
- package/lib/esm/IpcApp.js.map +1 -1
- package/lib/esm/LocalhostIpcApp.js +3 -4
- package/lib/esm/LocalhostIpcApp.js.map +1 -1
- package/lib/esm/ModelState.js +2 -3
- package/lib/esm/ModelState.js.map +1 -1
- package/lib/esm/NativeApp.js +4 -7
- package/lib/esm/NativeApp.js.map +1 -1
- package/lib/esm/NoRenderApp.js +1 -2
- package/lib/esm/NoRenderApp.js.map +1 -1
- package/lib/esm/PlanarClipMaskState.js +1 -1
- package/lib/esm/PlanarClipMaskState.js.map +1 -1
- package/lib/esm/RealityDataSourceContextShareImpl.js +2 -4
- package/lib/esm/RealityDataSourceContextShareImpl.js.map +1 -1
- package/lib/esm/SheetViewState.js +15 -23
- package/lib/esm/SheetViewState.js.map +1 -1
- package/lib/esm/Tiles.js +2 -2
- package/lib/esm/Tiles.js.map +1 -1
- package/lib/esm/ViewContext.js +1 -1
- package/lib/esm/ViewContext.js.map +1 -1
- package/lib/esm/ViewCreator2d.js +4 -5
- package/lib/esm/ViewCreator2d.js.map +1 -1
- package/lib/esm/ViewCreator3d.js +5 -5
- package/lib/esm/ViewCreator3d.js.map +1 -1
- package/lib/esm/ViewState.js +17 -24
- package/lib/esm/ViewState.js.map +1 -1
- package/lib/esm/Viewport.js +22 -32
- package/lib/esm/Viewport.js.map +1 -1
- package/lib/esm/extension/ExtensionImpl.js +1 -1
- package/lib/esm/extension/ExtensionImpl.js.map +1 -1
- package/lib/esm/quantity-formatting/BaseUnitFormattingSettingsProvider.js +2 -3
- package/lib/esm/quantity-formatting/BaseUnitFormattingSettingsProvider.js.map +1 -1
- package/lib/esm/quantity-formatting/QuantityFormatter.js +7 -9
- package/lib/esm/quantity-formatting/QuantityFormatter.js.map +1 -1
- package/lib/esm/render/FeatureSymbology.js +1 -2
- package/lib/esm/render/FeatureSymbology.js.map +1 -1
- package/lib/esm/render/GraphicBuilder.js +7 -9
- package/lib/esm/render/GraphicBuilder.js.map +1 -1
- package/lib/esm/render/MockRender.js +1 -2
- package/lib/esm/render/MockRender.js.map +1 -1
- package/lib/esm/render/ParticleCollectionBuilder.js +2 -3
- package/lib/esm/render/ParticleCollectionBuilder.js.map +1 -1
- package/lib/esm/render/RealityMeshParams.js +7 -10
- package/lib/esm/render/RealityMeshParams.js.map +1 -1
- package/lib/esm/render/RenderPlan.js +1 -1
- package/lib/esm/render/RenderPlan.js.map +1 -1
- package/lib/esm/render/RenderSystem.js +1 -2
- package/lib/esm/render/RenderSystem.js.map +1 -1
- package/lib/esm/render/VisibleFeature.js +2 -4
- package/lib/esm/render/VisibleFeature.js.map +1 -1
- package/lib/esm/render/primitives/AuxChannelTable.js +6 -9
- package/lib/esm/render/primitives/AuxChannelTable.js.map +1 -1
- package/lib/esm/render/primitives/EdgeParams.js +6 -7
- package/lib/esm/render/primitives/EdgeParams.js.map +1 -1
- package/lib/esm/render/primitives/PolylineParams.js +2 -3
- package/lib/esm/render/primitives/PolylineParams.js.map +1 -1
- package/lib/esm/render/primitives/VertexKey.js +1 -1
- package/lib/esm/render/primitives/VertexKey.js.map +1 -1
- package/lib/esm/render/primitives/VertexTable.js +1 -1
- package/lib/esm/render/primitives/VertexTable.js.map +1 -1
- package/lib/esm/render/primitives/VertexTableSplitter.js +6 -8
- package/lib/esm/render/primitives/VertexTableSplitter.js.map +1 -1
- package/lib/esm/render/primitives/geometry/GeometryAccumulator.js +9 -11
- package/lib/esm/render/primitives/geometry/GeometryAccumulator.js.map +1 -1
- package/lib/esm/render/primitives/geometry/GeometryListBuilder.js +3 -5
- package/lib/esm/render/primitives/geometry/GeometryListBuilder.js.map +1 -1
- package/lib/esm/render/primitives/mesh/MeshBuilder.js +1 -1
- package/lib/esm/render/primitives/mesh/MeshBuilder.js.map +1 -1
- package/lib/esm/render/primitives/mesh/MeshPrimitives.js +2 -3
- package/lib/esm/render/primitives/mesh/MeshPrimitives.js.map +1 -1
- package/lib/esm/render/webgl/BranchState.js +9 -10
- package/lib/esm/render/webgl/BranchState.js.map +1 -1
- package/lib/esm/render/webgl/EDL.js +17 -21
- package/lib/esm/render/webgl/EDL.js.map +1 -1
- package/lib/esm/render/webgl/FeatureOverrides.js +2 -2
- package/lib/esm/render/webgl/FeatureOverrides.js.map +1 -1
- package/lib/esm/render/webgl/Graphic.js +3 -5
- package/lib/esm/render/webgl/Graphic.js.map +1 -1
- package/lib/esm/render/webgl/IndexedEdgeGeometry.js +1 -1
- package/lib/esm/render/webgl/IndexedEdgeGeometry.js.map +1 -1
- package/lib/esm/render/webgl/InstancedGeometry.js +2 -3
- package/lib/esm/render/webgl/InstancedGeometry.js.map +1 -1
- package/lib/esm/render/webgl/Mesh.js +7 -10
- package/lib/esm/render/webgl/Mesh.js.map +1 -1
- package/lib/esm/render/webgl/MeshData.js +1 -2
- package/lib/esm/render/webgl/MeshData.js.map +1 -1
- package/lib/esm/render/webgl/PlanarClassifier.js +10 -15
- package/lib/esm/render/webgl/PlanarClassifier.js.map +1 -1
- package/lib/esm/render/webgl/RealityMesh.js +5 -8
- package/lib/esm/render/webgl/RealityMesh.js.map +1 -1
- package/lib/esm/render/webgl/RealityModelUniforms.js +3 -4
- package/lib/esm/render/webgl/RealityModelUniforms.js.map +1 -1
- package/lib/esm/render/webgl/RenderCommands.js +7 -8
- package/lib/esm/render/webgl/RenderCommands.js.map +1 -1
- package/lib/esm/render/webgl/SceneCompositor.js +7 -9
- package/lib/esm/render/webgl/SceneCompositor.js.map +1 -1
- package/lib/esm/render/webgl/ShaderBuilder.js +1 -2
- package/lib/esm/render/webgl/ShaderBuilder.js.map +1 -1
- package/lib/esm/render/webgl/SolarShadowMap.js +1 -2
- package/lib/esm/render/webgl/SolarShadowMap.js.map +1 -1
- package/lib/esm/render/webgl/SurfaceGeometry.js +1 -1
- package/lib/esm/render/webgl/SurfaceGeometry.js.map +1 -1
- package/lib/esm/render/webgl/System.js +12 -16
- package/lib/esm/render/webgl/System.js.map +1 -1
- package/lib/esm/render/webgl/Target.js +9 -14
- package/lib/esm/render/webgl/Target.js.map +1 -1
- package/lib/esm/render/webgl/TargetGraphics.js +1 -2
- package/lib/esm/render/webgl/TargetGraphics.js.map +1 -1
- package/lib/esm/render/webgl/Texture.js +1 -2
- package/lib/esm/render/webgl/Texture.js.map +1 -1
- package/lib/esm/render/webgl/ThematicSensors.js +2 -4
- package/lib/esm/render/webgl/ThematicSensors.js.map +1 -1
- package/lib/esm/render/webgl/VisibleTileFeatures.js +1 -2
- package/lib/esm/render/webgl/VisibleTileFeatures.js.map +1 -1
- package/lib/esm/render/webgl/glsl/Animation.js +6 -9
- package/lib/esm/render/webgl/glsl/Animation.js.map +1 -1
- package/lib/esm/render/webgl/glsl/FeatureSymbology.js +1 -2
- package/lib/esm/render/webgl/glsl/FeatureSymbology.js.map +1 -1
- package/lib/esm/render/webgl/glsl/Instancing.js +4 -5
- package/lib/esm/render/webgl/glsl/Instancing.js.map +1 -1
- package/lib/esm/render/webgl/glsl/RealityMesh.js +2 -4
- package/lib/esm/render/webgl/glsl/RealityMesh.js.map +1 -1
- package/lib/esm/render/webgl/glsl/Surface.js +1 -2
- package/lib/esm/render/webgl/glsl/Surface.js.map +1 -1
- package/lib/esm/render/webgl/glsl/Thematic.js +1 -2
- package/lib/esm/render/webgl/glsl/Thematic.js.map +1 -1
- package/lib/esm/tile/ClassifierTileTree.js +3 -3
- package/lib/esm/tile/ClassifierTileTree.js.map +1 -1
- package/lib/esm/tile/GltfReader.js +61 -75
- package/lib/esm/tile/GltfReader.js.map +1 -1
- package/lib/esm/tile/IModelTile.js +2 -3
- package/lib/esm/tile/IModelTile.js.map +1 -1
- package/lib/esm/tile/IModelTileRequestChannels.js +6 -11
- package/lib/esm/tile/IModelTileRequestChannels.js.map +1 -1
- package/lib/esm/tile/IModelTileTree.js +5 -9
- package/lib/esm/tile/IModelTileTree.js.map +1 -1
- package/lib/esm/tile/ImdlReader.js +13 -17
- package/lib/esm/tile/ImdlReader.js.map +1 -1
- package/lib/esm/tile/OrbitGtTileTree.js +2 -2
- package/lib/esm/tile/OrbitGtTileTree.js.map +1 -1
- package/lib/esm/tile/PntsReader.js +4 -5
- package/lib/esm/tile/PntsReader.js.map +1 -1
- package/lib/esm/tile/PrimaryTileTree.js +22 -32
- package/lib/esm/tile/PrimaryTileTree.js.map +1 -1
- package/lib/esm/tile/RealityModelTileTree.js +12 -19
- package/lib/esm/tile/RealityModelTileTree.js.map +1 -1
- package/lib/esm/tile/RealityTile.js +3 -5
- package/lib/esm/tile/RealityTile.js.map +1 -1
- package/lib/esm/tile/RealityTileLoader.js +2 -2
- package/lib/esm/tile/RealityTileLoader.js.map +1 -1
- package/lib/esm/tile/ThreeDTileFormatInterpreter.js +3 -5
- package/lib/esm/tile/ThreeDTileFormatInterpreter.js.map +1 -1
- package/lib/esm/tile/Tile.js +1 -1
- package/lib/esm/tile/Tile.js.map +1 -1
- package/lib/esm/tile/TileAdmin.js +22 -27
- package/lib/esm/tile/TileAdmin.js.map +1 -1
- package/lib/esm/tile/TileDrawArgs.js +3 -6
- package/lib/esm/tile/TileDrawArgs.js.map +1 -1
- package/lib/esm/tile/TileRequestChannels.js +1 -1
- package/lib/esm/tile/TileRequestChannels.js.map +1 -1
- package/lib/esm/tile/TileTree.js +2 -3
- package/lib/esm/tile/TileTree.js.map +1 -1
- package/lib/esm/tile/TiledGraphicsProvider.js +1 -1
- package/lib/esm/tile/TiledGraphicsProvider.js.map +1 -1
- package/lib/esm/tile/map/ArcGISTileMap.js +5 -6
- package/lib/esm/tile/map/ArcGISTileMap.js.map +1 -1
- package/lib/esm/tile/map/ArcGisUtilities.js +6 -8
- package/lib/esm/tile/map/ArcGisUtilities.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISImageryProvider.js +4 -7
- package/lib/esm/tile/map/ImageryProviders/ArcGISImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +6 -8
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/BingImageryProvider.js +1 -2
- package/lib/esm/tile/map/ImageryProviders/BingImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/WmsMapLayerImageryProvider.js +14 -19
- package/lib/esm/tile/map/ImageryProviders/WmsMapLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js +14 -20
- package/lib/esm/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/MapCartoRectangle.js +1 -1
- package/lib/esm/tile/map/MapCartoRectangle.js.map +1 -1
- package/lib/esm/tile/map/MapLayerFormatRegistry.js +5 -6
- package/lib/esm/tile/map/MapLayerFormatRegistry.js.map +1 -1
- package/lib/esm/tile/map/MapLayerImageryFormats.js +11 -14
- package/lib/esm/tile/map/MapLayerImageryFormats.js.map +1 -1
- package/lib/esm/tile/map/MapLayerImageryProvider.js +2 -3
- package/lib/esm/tile/map/MapLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/MapLayerSources.js +1 -1
- package/lib/esm/tile/map/MapLayerSources.js.map +1 -1
- package/lib/esm/tile/map/MapTile.js +6 -8
- package/lib/esm/tile/map/MapTile.js.map +1 -1
- package/lib/esm/tile/map/MapTileLoader.js +1 -1
- package/lib/esm/tile/map/MapTileLoader.js.map +1 -1
- package/lib/esm/tile/map/MapTileTree.js +13 -18
- package/lib/esm/tile/map/MapTileTree.js.map +1 -1
- package/lib/esm/tile/map/MapTiledGraphicsProvider.js +6 -7
- package/lib/esm/tile/map/MapTiledGraphicsProvider.js.map +1 -1
- package/lib/esm/tile/map/WmsCapabilities.js +4 -5
- package/lib/esm/tile/map/WmsCapabilities.js.map +1 -1
- package/lib/esm/tile/map/WmtsCapabilities.js +17 -25
- package/lib/esm/tile/map/WmtsCapabilities.js.map +1 -1
- package/lib/esm/tools/ClipViewTool.js +1 -1
- package/lib/esm/tools/ClipViewTool.js.map +1 -1
- package/lib/esm/tools/MeasureTool.js +2 -4
- package/lib/esm/tools/MeasureTool.js.map +1 -1
- package/lib/esm/tools/PrimitiveTool.js +2 -3
- package/lib/esm/tools/PrimitiveTool.js.map +1 -1
- package/lib/esm/tools/SelectTool.js +1 -2
- package/lib/esm/tools/SelectTool.js.map +1 -1
- package/lib/esm/tools/Tool.js +2 -3
- package/lib/esm/tools/Tool.js.map +1 -1
- package/lib/esm/tools/ToolAdmin.js +2 -4
- package/lib/esm/tools/ToolAdmin.js.map +1 -1
- package/lib/esm/tools/ViewTool.js +3 -3
- package/lib/esm/tools/ViewTool.js.map +1 -1
- package/package.json +18 -18
package/lib/cjs/ModelState.js
CHANGED
|
@@ -83,10 +83,9 @@ class GeometricModelState extends ModelState {
|
|
|
83
83
|
* @public
|
|
84
84
|
*/
|
|
85
85
|
async queryModelRange() {
|
|
86
|
-
var _a;
|
|
87
86
|
if (undefined === this._modelRange) {
|
|
88
87
|
const ranges = await this.iModel.models.queryExtents(this.id);
|
|
89
|
-
this._modelRange = core_geometry_1.Range3d.fromJSON(
|
|
88
|
+
this._modelRange = core_geometry_1.Range3d.fromJSON(ranges[0]?.extents);
|
|
90
89
|
}
|
|
91
90
|
return this._modelRange;
|
|
92
91
|
}
|
|
@@ -95,7 +94,7 @@ class GeometricModelState extends ModelState {
|
|
|
95
94
|
// If this is a reality model, its tile tree is obtained from reality data service URL.
|
|
96
95
|
const spatialModel = this.asSpatialModel;
|
|
97
96
|
const rdSourceKey = this.jsonProperties.rdSourceKey;
|
|
98
|
-
const getDisplaySettings = () =>
|
|
97
|
+
const getDisplaySettings = () => view.displayStyle.settings.getRealityModelDisplaySettings(this.id) ?? core_common_1.RealityModelDisplaySettings.defaults;
|
|
99
98
|
if (rdSourceKey) {
|
|
100
99
|
const useOrbitGtTileTreeReference = rdSourceKey.format === core_common_1.RealityDataFormat.OPC;
|
|
101
100
|
const treeRef = (!useOrbitGtTileTreeReference) ?
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelState.js","sourceRoot":"","sources":["../../src/ModelState.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAkE;AAClE,oDAE4B;AAC5B,wDAAwD;AACxD,+CAA4C;AAG5C,2DAAwD;AACxD,8CAAoJ;AAGpJ;;;GAGG;AACH,MAAa,UAAW,SAAQ,yBAAW;IASzC,YAAY,KAAiB,EAAE,MAAwB,EAAE,KAAkB;QACzE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;QAC5B,IAAI,CAAC,cAAc,GAAG,4BAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAE,CAAC;QACrE,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,C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K,OAAO,sBAAsB,CAAC,CAAC,CAAC;CAC1E;AAHD,8DAGC;AAED;;;GAGG;AACH,MAAa,iBAAkB,SAAQ,qBAAqB;IAC1D,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAK,OAAO,cAAc,CAAC,CAAC,CAAC;CAClE;AAHD,8CAGC;AAED;;;GAGG;AACH,MAAa,wBAAyB,SAAQ,iBAAiB;IAC7D,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAK,OAAO,qBAAqB,CAAC,CAAC,CAAC;CACzE;AAHD,4DAGC","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 ModelState\r\n */\r\n\r\nimport { Id64, Id64String, JsonUtils } from \"@itwin/core-bentley\";\r\nimport {\r\n GeometricModel2dProps, GeometricModel3dProps, GeometricModelProps, ModelProps, RealityDataFormat, RealityDataSourceKey, RealityModelDisplaySettings, RelatedElement, SpatialClassifiers,\r\n} from \"@itwin/core-common\";\r\nimport { Point2d, Range3d } from \"@itwin/core-geometry\";\r\nimport { EntityState } from \"./EntityState\";\r\nimport { HitDetail } from \"./HitDetail\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\nimport { RealityDataSource } from \"./RealityDataSource\";\r\nimport { createOrbitGtTileTreeReference, createPrimaryTileTreeReference, createRealityTileTreeReference, TileTreeReference } from \"./tile/internal\";\r\nimport { ViewState } from \"./ViewState\";\r\n\r\n/** Represents the front-end state of a [Model]($backend).\r\n * @public\r\n * @extensions\r\n */\r\nexport class ModelState extends EntityState implements ModelProps {\r\n /** @internal */\r\n public static override get className() { return \"Model\"; }\r\n public readonly modeledElement: RelatedElement;\r\n public readonly name: string;\r\n public parentModel: Id64String;\r\n public readonly isPrivate: boolean;\r\n public readonly isTemplate: boolean;\r\n\r\n constructor(props: ModelProps, iModel: IModelConnection, state?: ModelState) {\r\n super(props, iModel, state);\r\n this.modeledElement = RelatedElement.fromJSON(props.modeledElement)!;\r\n this.name = props.name ? props.name : \"\";\r\n this.parentModel = Id64.fromJSON(props.parentModel)!; // NB! Must always match the model of the modeledElement!\r\n this.isPrivate = JsonUtils.asBool(props.isPrivate);\r\n this.isTemplate = JsonUtils.asBool(props.isTemplate);\r\n }\r\n\r\n /** Add all custom-handled properties of a Model to a json object. */\r\n public override toJSON(): ModelProps {\r\n const val = super.toJSON() as ModelProps;\r\n val.modeledElement = this.modeledElement;\r\n val.parentModel = this.parentModel;\r\n val.name = this.name;\r\n if (this.isPrivate)\r\n val.isPrivate = this.isPrivate;\r\n if (this.isTemplate)\r\n val.isTemplate = this.isTemplate;\r\n return val;\r\n }\r\n\r\n /** Determine whether this is a GeometricModel */\r\n public get isGeometricModel(): boolean { return false; }\r\n\r\n /** Attempts to cast this model to a geometric model. */\r\n public get asGeometricModel(): GeometricModelState | undefined { return undefined; }\r\n /** Attempts to cast this model to a 3d geometric model. */\r\n public get asGeometricModel3d(): GeometricModel3dState | undefined { return undefined; }\r\n /** Attempts to cast this model to a 2d geometric model. */\r\n public get asGeometricModel2d(): GeometricModel2dState | undefined { return undefined; }\r\n /** Attempts to cast this model to a spatial model. */\r\n public get asSpatialModel(): SpatialModelState | undefined { return undefined; }\r\n\r\n /**\r\n * Return the tool tip for this model. This is called only if the hit does not return a tooltip.\r\n * @internal\r\n */\r\n public getToolTip(_hit: HitDetail): HTMLElement | string | undefined { return undefined; }\r\n}\r\n\r\n/** Represents the front-end state of a [GeometricModel]($backend).\r\n * The contents of a GeometricModelState can be rendered inside a [[Viewport]].\r\n * @public\r\n * @extensions\r\n */\r\nexport abstract class GeometricModelState extends ModelState implements GeometricModelProps {\r\n /** @internal */\r\n public static override get className() { return \"GeometricModel\"; }\r\n /** @internal */\r\n public geometryGuid?: string;\r\n\r\n private _modelRange?: Range3d;\r\n\r\n constructor(props: GeometricModelProps, iModel: IModelConnection, state?: GeometricModelState) {\r\n super(props, iModel, state);\r\n this.geometryGuid = props.geometryGuid;\r\n }\r\n\r\n /** Returns true if this is a 3d model (a [[GeometricModel3dState]]). */\r\n public abstract get is3d(): boolean;\r\n /** @internal */\r\n public override get asGeometricModel(): GeometricModelState { return this; }\r\n /** Returns true if this is a 2d model (a [[GeometricModel2dState]]). */\r\n public get is2d(): boolean { return !this.is3d; }\r\n\r\n /** @internal */\r\n public override get isGeometricModel(): boolean { return true; }\r\n /** @internal */\r\n public get treeModelId(): Id64String { return this.id; }\r\n\r\n /** Query for the union of the ranges of all the elements in this GeometricModel.\r\n * @note This value is cached after the first time it is called.\r\n * @public\r\n */\r\n public async queryModelRange(): Promise<Range3d> {\r\n if (undefined === this._modelRange) {\r\n const ranges = await this.iModel.models.queryExtents(this.id);\r\n this._modelRange = Range3d.fromJSON(ranges[0]?.extents);\r\n }\r\n\r\n return this._modelRange;\r\n }\r\n\r\n /** @internal */\r\n public createTileTreeReference(view: ViewState): TileTreeReference {\r\n // If this is a reality model, its tile tree is obtained from reality data service URL.\r\n\r\n const spatialModel = this.asSpatialModel;\r\n const rdSourceKey = this.jsonProperties.rdSourceKey;\r\n const getDisplaySettings = () => view.displayStyle.settings.getRealityModelDisplaySettings(this.id) ?? RealityModelDisplaySettings.defaults;\r\n\r\n if (rdSourceKey) {\r\n const useOrbitGtTileTreeReference = rdSourceKey.format === RealityDataFormat.OPC;\r\n const treeRef = (!useOrbitGtTileTreeReference) ?\r\n createRealityTileTreeReference({\r\n rdSourceKey,\r\n iModel: this.iModel,\r\n source: view,\r\n modelId: this.id,\r\n // url: tilesetUrl, // If rdSourceKey is defined, url is not used\r\n classifiers: undefined !== spatialModel ? spatialModel.classifiers : undefined,\r\n getDisplaySettings,\r\n }) :\r\n createOrbitGtTileTreeReference({\r\n rdSourceKey,\r\n iModel: this.iModel,\r\n source: view,\r\n modelId: this.id,\r\n // orbitGtBlob: props.orbitGtBlob!, // If rdSourceKey is defined, orbitGtBlob is not used\r\n classifiers: undefined !== spatialModel ? spatialModel.classifiers : undefined,\r\n getDisplaySettings,\r\n });\r\n return treeRef;\r\n }\r\n\r\n const orbitGtBlob = this.jsonProperties.orbitGtBlob;\r\n\r\n // If this is an OrbitGt reality model, create it's reference\r\n if(orbitGtBlob) {\r\n let orbitGtName = \"\";\r\n if (orbitGtBlob.blobFileName !== \"\") {\r\n if (orbitGtBlob.blobFileName[0] === \"/\")\r\n orbitGtName = orbitGtBlob.blobFileName.substring(1);\r\n else\r\n orbitGtName = orbitGtBlob.blobFileName;\r\n }\r\n // Create rdSourceKey if not provided\r\n const rdSourceKeyOGT: RealityDataSourceKey = RealityDataSource.createKeyFromOrbitGtBlobProps(orbitGtBlob);\r\n\r\n return createOrbitGtTileTreeReference({\r\n rdSourceKey: rdSourceKeyOGT,\r\n iModel: this.iModel,\r\n source: view,\r\n modelId: this.id,\r\n orbitGtBlob,\r\n name: orbitGtName,\r\n classifiers: undefined !== spatialModel ? spatialModel.classifiers : undefined,\r\n getDisplaySettings,\r\n });\r\n }\r\n\r\n // If this is a TileTree reality model, create it's reference\r\n const tilesetUrl = this.jsonProperties.tilesetUrl;\r\n\r\n if(tilesetUrl) {\r\n const rdSourceKeyCS = RealityDataSource.createKeyFromUrl(tilesetUrl);\r\n return createRealityTileTreeReference({\r\n rdSourceKey: rdSourceKeyCS,\r\n url : tilesetUrl,\r\n iModel: this.iModel,\r\n source: view,\r\n modelId: this.id,\r\n tilesetToDbTransform: this.jsonProperties.tilesetToDbTransform,\r\n classifiers: undefined !== spatialModel ? spatialModel.classifiers : undefined,\r\n getDisplaySettings,\r\n });\r\n }\r\n\r\n return createPrimaryTileTreeReference(view, this);\r\n }\r\n}\r\n/** Represents the front-end state of a [GeometricModel2d]($backend).\r\n * @public\r\n * @extensions\r\n */\r\nexport class GeometricModel2dState extends GeometricModelState implements GeometricModel2dProps {\r\n /** @internal */\r\n public static override get className() { return \"GeometricModel2d\"; }\r\n /** @internal */\r\n public readonly globalOrigin: Point2d;\r\n\r\n constructor(props: GeometricModel2dProps, iModel: IModelConnection, state?: GeometricModel2dState) {\r\n super(props, iModel, state);\r\n this.globalOrigin = Point2d.fromJSON(props.globalOrigin);\r\n }\r\n\r\n /** @internal */\r\n public get is3d(): boolean { return false; }\r\n /** @internal */\r\n public override get asGeometricModel2d(): GeometricModel2dState { return this; }\r\n\r\n public override toJSON(): GeometricModel2dProps {\r\n const val = super.toJSON() as GeometricModel2dProps;\r\n val.globalOrigin = this.globalOrigin;\r\n return val;\r\n }\r\n}\r\n\r\n/** Represents the front-end state of a [GeometricModel3d]($backend).\r\n * @public\r\n * @extensions\r\n */\r\nexport class GeometricModel3dState extends GeometricModelState {\r\n /** @internal */\r\n public static override get className() { return \"GeometricModel3d\"; }\r\n\r\n constructor(props: GeometricModel3dProps, iModel: IModelConnection, state?: GeometricModel3dState) {\r\n super(props, iModel, state);\r\n this.isNotSpatiallyLocated = JsonUtils.asBool(props.isNotSpatiallyLocated);\r\n this.isPlanProjection = JsonUtils.asBool(props.isPlanProjection);\r\n }\r\n\r\n /** @internal */\r\n public override toJSON(): GeometricModel3dProps {\r\n const val = super.toJSON() as GeometricModel3dProps;\r\n if (this.isNotSpatiallyLocated)\r\n val.isNotSpatiallyLocated = true;\r\n\r\n if (this.isPlanProjection)\r\n val.isPlanProjection = true;\r\n\r\n return val;\r\n }\r\n\r\n /** @internal */\r\n public get is3d(): boolean { return true; }\r\n /** @internal */\r\n public override get asGeometricModel3d(): GeometricModel3dState { return this; }\r\n\r\n /** If true, then the elements in this GeometricModel3dState are expected to be in an XY plane.\r\n * @note The associated ECProperty was added to the BisCore schema in version 1.0.8\r\n */\r\n public readonly isPlanProjection: boolean;\r\n\r\n /** If true, then the elements in this GeometricModel3dState are not in real-world coordinates and will not be in the spatial index.\r\n * @note The associated ECProperty was added to the BisCore schema in version 1.0.8\r\n */\r\n public readonly isNotSpatiallyLocated: boolean;\r\n\r\n /** If true, then the elements in this GeometricModel3dState are in real-world coordinates and will be in the spatial index. */\r\n public get isSpatiallyLocated(): boolean { return !this.isNotSpatiallyLocated; }\r\n}\r\n\r\n/** Represents the front-end state of a [SheetModel]($backend).\r\n * @public\r\n * @extensions\r\n */\r\nexport class SheetModelState extends GeometricModel2dState {\r\n /** @internal */\r\n public static override get className() { return \"SheetModel\"; }\r\n}\r\n\r\n/** Represents the front-end state of a [SpatialModel]($backend).\r\n * @public\r\n * @extensions\r\n */\r\nexport class SpatialModelState extends GeometricModel3dState {\r\n /** If this is a reality model, provides access to a list of available spatial classifiers that can be applied to it. */\r\n public readonly classifiers?: SpatialClassifiers;\r\n\r\n /** @internal */\r\n public static override get className() { return \"SpatialModel\"; }\r\n /** @internal */\r\n public override get asSpatialModel(): SpatialModelState { return this; }\r\n\r\n public constructor(props: ModelProps, iModel: IModelConnection, state?: SpatialModelState) {\r\n super(props, iModel, state);\r\n if (this.isRealityModel)\r\n this.classifiers = new SpatialClassifiers(this.jsonProperties);\r\n }\r\n /** Return true if this is a reality model (represented by a 3d tile set). */\r\n public get isRealityModel(): boolean {\r\n return undefined !== this.jsonProperties.tilesetUrl;\r\n }\r\n}\r\n\r\n/** Represents the front-end state of a [PhysicalModel]($backend).\r\n * @public\r\n * @extensions\r\n */\r\nexport class PhysicalModelState extends SpatialModelState {\r\n /** @internal */\r\n public static override get className() { return \"PhysicalModel\"; }\r\n}\r\n\r\n/** Represents the front-end state of a [SpatialLocationModel]($backend).\r\n * @public\r\n * @extensions\r\n */\r\nexport class SpatialLocationModelState extends SpatialModelState {\r\n /** @internal */\r\n public static override get className() { return \"SpatialLocationModel\"; }\r\n}\r\n\r\n/** Represents the front-end state of a [DrawingModel]($backend).\r\n * @public\r\n * @extensions\r\n */\r\nexport class DrawingModelState extends GeometricModel2dState {\r\n /** @internal */\r\n public static override get className() { return \"DrawingModel\"; }\r\n}\r\n\r\n/** Represents the front-end state of a [SectionDrawingModel]($backend).\r\n * @public\r\n * @extensions\r\n */\r\nexport class SectionDrawingModelState extends DrawingModelState {\r\n /** @internal */\r\n public static override get className() { return \"SectionDrawingModel\"; }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ModelState.js","sourceRoot":"","sources":["../../src/ModelState.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAkE;AAClE,oDAE4B;AAC5B,wDAAwD;AACxD,+CAA4C;AAG5C,2DAAwD;AACxD,8CAAoJ;AAGpJ;;;GAGG;AACH,MAAa,UAAW,SAAQ,yBAAW;IASzC,YAAY,KAAiB,EAAE,MAAwB,EAAE,KAAkB;QACzE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;QAC5B,IAAI,CAAC,cAAc,GAAG,4BAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAE,CAAC;QACrE,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QACzC,IAAI,CAAC,WAAW,GAAG,mBAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAE,CAAC,CAAC,yDAAyD;QAC/G,IAAI,CAAC,SAAS,GAAG,wBAAS,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACnD,IAAI,CAAC,UAAU,GAAG,wBAAS,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACvD,CAAC;IAfD,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAK,OAAO,OAAO,CAAC,CAAC,CAAC;IAgB1D,qEAAqE;IACrD,MAAM;QACpB,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAAgB,CAAC;QACzC,GAAG,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QACzC,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QACnC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACrB,IAAI,IAAI,CAAC,S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,CAAC;IATD,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAK,OAAO,cAAc,CAAC,CAAC,CAAC;IACjE,gBAAgB;IAChB,IAAoB,cAAc,KAAwB,OAAO,IAAI,CAAC,CAAC,CAAC;IAOxE,6EAA6E;IAC7E,IAAW,cAAc;QACvB,OAAO,SAAS,KAAK,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC;IACtD,CAAC;CACF;AAlBD,8CAkBC;AAED;;;GAGG;AACH,MAAa,kBAAmB,SAAQ,iBAAiB;IACvD,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAK,OAAO,eAAe,CAAC,CAAC,CAAC;CACnE;AAHD,gDAGC;AAED;;;GAGG;AACH,MAAa,yBAA0B,SAAQ,iBAAiB;IAC9D,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAK,OAAO,sBAAsB,CAAC,CAAC,CAAC;CAC1E;AAHD,8DAGC;AAED;;;GAGG;AACH,MAAa,iBAAkB,SAAQ,qBAAqB;IAC1D,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAK,OAAO,cAAc,CAAC,CAAC,CAAC;CAClE;AAHD,8CAGC;AAED;;;GAGG;AACH,MAAa,wBAAyB,SAAQ,iBAAiB;IAC7D,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAK,OAAO,qBAAqB,CAAC,CAAC,CAAC;CACzE;AAHD,4DAGC","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 ModelState\r\n */\r\n\r\nimport { Id64, Id64String, JsonUtils } from \"@itwin/core-bentley\";\r\nimport {\r\n GeometricModel2dProps, GeometricModel3dProps, GeometricModelProps, ModelProps, RealityDataFormat, RealityDataSourceKey, RealityModelDisplaySettings, RelatedElement, SpatialClassifiers,\r\n} from \"@itwin/core-common\";\r\nimport { Point2d, Range3d } from \"@itwin/core-geometry\";\r\nimport { EntityState } from \"./EntityState\";\r\nimport { HitDetail } from \"./HitDetail\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\nimport { RealityDataSource } from \"./RealityDataSource\";\r\nimport { createOrbitGtTileTreeReference, createPrimaryTileTreeReference, createRealityTileTreeReference, TileTreeReference } from \"./tile/internal\";\r\nimport { ViewState } from \"./ViewState\";\r\n\r\n/** Represents the front-end state of a [Model]($backend).\r\n * @public\r\n * @extensions\r\n */\r\nexport class ModelState extends EntityState implements ModelProps {\r\n /** @internal */\r\n public static override get className() { return \"Model\"; }\r\n public readonly modeledElement: RelatedElement;\r\n public readonly name: string;\r\n public parentModel: Id64String;\r\n public readonly isPrivate: boolean;\r\n public readonly isTemplate: boolean;\r\n\r\n constructor(props: ModelProps, iModel: IModelConnection, state?: ModelState) {\r\n super(props, iModel, state);\r\n this.modeledElement = RelatedElement.fromJSON(props.modeledElement)!;\r\n this.name = props.name ? props.name : \"\";\r\n this.parentModel = Id64.fromJSON(props.parentModel)!; // NB! Must always match the model of the modeledElement!\r\n this.isPrivate = JsonUtils.asBool(props.isPrivate);\r\n this.isTemplate = JsonUtils.asBool(props.isTemplate);\r\n }\r\n\r\n /** Add all custom-handled properties of a Model to a json object. */\r\n public override toJSON(): ModelProps {\r\n const val = super.toJSON() as ModelProps;\r\n val.modeledElement = this.modeledElement;\r\n val.parentModel = this.parentModel;\r\n val.name = this.name;\r\n if (this.isPrivate)\r\n val.isPrivate = this.isPrivate;\r\n if (this.isTemplate)\r\n val.isTemplate = this.isTemplate;\r\n return val;\r\n }\r\n\r\n /** Determine whether this is a GeometricModel */\r\n public get isGeometricModel(): boolean { return false; }\r\n\r\n /** Attempts to cast this model to a geometric model. */\r\n public get asGeometricModel(): GeometricModelState | undefined { return undefined; }\r\n /** Attempts to cast this model to a 3d geometric model. */\r\n public get asGeometricModel3d(): GeometricModel3dState | undefined { return undefined; }\r\n /** Attempts to cast this model to a 2d geometric model. */\r\n public get asGeometricModel2d(): GeometricModel2dState | undefined { return undefined; }\r\n /** Attempts to cast this model to a spatial model. */\r\n public get asSpatialModel(): SpatialModelState | undefined { return undefined; }\r\n\r\n /**\r\n * Return the tool tip for this model. This is called only if the hit does not return a tooltip.\r\n * @internal\r\n */\r\n public getToolTip(_hit: HitDetail): HTMLElement | string | undefined { return undefined; }\r\n}\r\n\r\n/** Represents the front-end state of a [GeometricModel]($backend).\r\n * The contents of a GeometricModelState can be rendered inside a [[Viewport]].\r\n * @public\r\n * @extensions\r\n */\r\nexport abstract class GeometricModelState extends ModelState implements GeometricModelProps {\r\n /** @internal */\r\n public static override get className() { return \"GeometricModel\"; }\r\n /** @internal */\r\n public geometryGuid?: string;\r\n\r\n private _modelRange?: Range3d;\r\n\r\n constructor(props: GeometricModelProps, iModel: IModelConnection, state?: GeometricModelState) {\r\n super(props, iModel, state);\r\n this.geometryGuid = props.geometryGuid;\r\n }\r\n\r\n /** Returns true if this is a 3d model (a [[GeometricModel3dState]]). */\r\n public abstract get is3d(): boolean;\r\n /** @internal */\r\n public override get asGeometricModel(): GeometricModelState { return this; }\r\n /** Returns true if this is a 2d model (a [[GeometricModel2dState]]). */\r\n public get is2d(): boolean { return !this.is3d; }\r\n\r\n /** @internal */\r\n public override get isGeometricModel(): boolean { return true; }\r\n /** @internal */\r\n public get treeModelId(): Id64String { return this.id; }\r\n\r\n /** Query for the union of the ranges of all the elements in this GeometricModel.\r\n * @note This value is cached after the first time it is called.\r\n * @public\r\n */\r\n public async queryModelRange(): Promise<Range3d> {\r\n if (undefined === this._modelRange) {\r\n const ranges = await this.iModel.models.queryExtents(this.id);\r\n this._modelRange = Range3d.fromJSON(ranges[0]?.extents);\r\n }\r\n\r\n return this._modelRange;\r\n }\r\n\r\n /** @internal */\r\n public createTileTreeReference(view: ViewState): TileTreeReference {\r\n // If this is a reality model, its tile tree is obtained from reality data service URL.\r\n\r\n const spatialModel = this.asSpatialModel;\r\n const rdSourceKey = this.jsonProperties.rdSourceKey;\r\n const getDisplaySettings = () => view.displayStyle.settings.getRealityModelDisplaySettings(this.id) ?? RealityModelDisplaySettings.defaults;\r\n\r\n if (rdSourceKey) {\r\n const useOrbitGtTileTreeReference = rdSourceKey.format === RealityDataFormat.OPC;\r\n const treeRef = (!useOrbitGtTileTreeReference) ?\r\n createRealityTileTreeReference({\r\n rdSourceKey,\r\n iModel: this.iModel,\r\n source: view,\r\n modelId: this.id,\r\n // url: tilesetUrl, // If rdSourceKey is defined, url is not used\r\n classifiers: undefined !== spatialModel ? spatialModel.classifiers : undefined,\r\n getDisplaySettings,\r\n }) :\r\n createOrbitGtTileTreeReference({\r\n rdSourceKey,\r\n iModel: this.iModel,\r\n source: view,\r\n modelId: this.id,\r\n // orbitGtBlob: props.orbitGtBlob!, // If rdSourceKey is defined, orbitGtBlob is not used\r\n classifiers: undefined !== spatialModel ? spatialModel.classifiers : undefined,\r\n getDisplaySettings,\r\n });\r\n return treeRef;\r\n }\r\n\r\n const orbitGtBlob = this.jsonProperties.orbitGtBlob;\r\n\r\n // If this is an OrbitGt reality model, create it's reference\r\n if(orbitGtBlob) {\r\n let orbitGtName = \"\";\r\n if (orbitGtBlob.blobFileName !== \"\") {\r\n if (orbitGtBlob.blobFileName[0] === \"/\")\r\n orbitGtName = orbitGtBlob.blobFileName.substring(1);\r\n else\r\n orbitGtName = orbitGtBlob.blobFileName;\r\n }\r\n // Create rdSourceKey if not provided\r\n const rdSourceKeyOGT: RealityDataSourceKey = RealityDataSource.createKeyFromOrbitGtBlobProps(orbitGtBlob);\r\n\r\n return createOrbitGtTileTreeReference({\r\n rdSourceKey: rdSourceKeyOGT,\r\n iModel: this.iModel,\r\n source: view,\r\n modelId: this.id,\r\n orbitGtBlob,\r\n name: orbitGtName,\r\n classifiers: undefined !== spatialModel ? spatialModel.classifiers : undefined,\r\n getDisplaySettings,\r\n });\r\n }\r\n\r\n // If this is a TileTree reality model, create it's reference\r\n const tilesetUrl = this.jsonProperties.tilesetUrl;\r\n\r\n if(tilesetUrl) {\r\n const rdSourceKeyCS = RealityDataSource.createKeyFromUrl(tilesetUrl);\r\n return createRealityTileTreeReference({\r\n rdSourceKey: rdSourceKeyCS,\r\n url : tilesetUrl,\r\n iModel: this.iModel,\r\n source: view,\r\n modelId: this.id,\r\n tilesetToDbTransform: this.jsonProperties.tilesetToDbTransform,\r\n classifiers: undefined !== spatialModel ? spatialModel.classifiers : undefined,\r\n getDisplaySettings,\r\n });\r\n }\r\n\r\n return createPrimaryTileTreeReference(view, this);\r\n }\r\n}\r\n/** Represents the front-end state of a [GeometricModel2d]($backend).\r\n * @public\r\n * @extensions\r\n */\r\nexport class GeometricModel2dState extends GeometricModelState implements GeometricModel2dProps {\r\n /** @internal */\r\n public static override get className() { return \"GeometricModel2d\"; }\r\n /** @internal */\r\n public readonly globalOrigin: Point2d;\r\n\r\n constructor(props: GeometricModel2dProps, iModel: IModelConnection, state?: GeometricModel2dState) {\r\n super(props, iModel, state);\r\n this.globalOrigin = Point2d.fromJSON(props.globalOrigin);\r\n }\r\n\r\n /** @internal */\r\n public get is3d(): boolean { return false; }\r\n /** @internal */\r\n public override get asGeometricModel2d(): GeometricModel2dState { return this; }\r\n\r\n public override toJSON(): GeometricModel2dProps {\r\n const val = super.toJSON() as GeometricModel2dProps;\r\n val.globalOrigin = this.globalOrigin;\r\n return val;\r\n }\r\n}\r\n\r\n/** Represents the front-end state of a [GeometricModel3d]($backend).\r\n * @public\r\n * @extensions\r\n */\r\nexport class GeometricModel3dState extends GeometricModelState {\r\n /** @internal */\r\n public static override get className() { return \"GeometricModel3d\"; }\r\n\r\n constructor(props: GeometricModel3dProps, iModel: IModelConnection, state?: GeometricModel3dState) {\r\n super(props, iModel, state);\r\n this.isNotSpatiallyLocated = JsonUtils.asBool(props.isNotSpatiallyLocated);\r\n this.isPlanProjection = JsonUtils.asBool(props.isPlanProjection);\r\n }\r\n\r\n /** @internal */\r\n public override toJSON(): GeometricModel3dProps {\r\n const val = super.toJSON() as GeometricModel3dProps;\r\n if (this.isNotSpatiallyLocated)\r\n val.isNotSpatiallyLocated = true;\r\n\r\n if (this.isPlanProjection)\r\n val.isPlanProjection = true;\r\n\r\n return val;\r\n }\r\n\r\n /** @internal */\r\n public get is3d(): boolean { return true; }\r\n /** @internal */\r\n public override get asGeometricModel3d(): GeometricModel3dState { return this; }\r\n\r\n /** If true, then the elements in this GeometricModel3dState are expected to be in an XY plane.\r\n * @note The associated ECProperty was added to the BisCore schema in version 1.0.8\r\n */\r\n public readonly isPlanProjection: boolean;\r\n\r\n /** If true, then the elements in this GeometricModel3dState are not in real-world coordinates and will not be in the spatial index.\r\n * @note The associated ECProperty was added to the BisCore schema in version 1.0.8\r\n */\r\n public readonly isNotSpatiallyLocated: boolean;\r\n\r\n /** If true, then the elements in this GeometricModel3dState are in real-world coordinates and will be in the spatial index. */\r\n public get isSpatiallyLocated(): boolean { return !this.isNotSpatiallyLocated; }\r\n}\r\n\r\n/** Represents the front-end state of a [SheetModel]($backend).\r\n * @public\r\n * @extensions\r\n */\r\nexport class SheetModelState extends GeometricModel2dState {\r\n /** @internal */\r\n public static override get className() { return \"SheetModel\"; }\r\n}\r\n\r\n/** Represents the front-end state of a [SpatialModel]($backend).\r\n * @public\r\n * @extensions\r\n */\r\nexport class SpatialModelState extends GeometricModel3dState {\r\n /** If this is a reality model, provides access to a list of available spatial classifiers that can be applied to it. */\r\n public readonly classifiers?: SpatialClassifiers;\r\n\r\n /** @internal */\r\n public static override get className() { return \"SpatialModel\"; }\r\n /** @internal */\r\n public override get asSpatialModel(): SpatialModelState { return this; }\r\n\r\n public constructor(props: ModelProps, iModel: IModelConnection, state?: SpatialModelState) {\r\n super(props, iModel, state);\r\n if (this.isRealityModel)\r\n this.classifiers = new SpatialClassifiers(this.jsonProperties);\r\n }\r\n /** Return true if this is a reality model (represented by a 3d tile set). */\r\n public get isRealityModel(): boolean {\r\n return undefined !== this.jsonProperties.tilesetUrl;\r\n }\r\n}\r\n\r\n/** Represents the front-end state of a [PhysicalModel]($backend).\r\n * @public\r\n * @extensions\r\n */\r\nexport class PhysicalModelState extends SpatialModelState {\r\n /** @internal */\r\n public static override get className() { return \"PhysicalModel\"; }\r\n}\r\n\r\n/** Represents the front-end state of a [SpatialLocationModel]($backend).\r\n * @public\r\n * @extensions\r\n */\r\nexport class SpatialLocationModelState extends SpatialModelState {\r\n /** @internal */\r\n public static override get className() { return \"SpatialLocationModel\"; }\r\n}\r\n\r\n/** Represents the front-end state of a [DrawingModel]($backend).\r\n * @public\r\n * @extensions\r\n */\r\nexport class DrawingModelState extends GeometricModel2dState {\r\n /** @internal */\r\n public static override get className() { return \"DrawingModel\"; }\r\n}\r\n\r\n/** Represents the front-end state of a [SectionDrawingModel]($backend).\r\n * @public\r\n * @extensions\r\n */\r\nexport class SectionDrawingModelState extends DrawingModelState {\r\n /** @internal */\r\n public static override get className() { return \"SectionDrawingModel\"; }\r\n}\r\n"]}
|
package/lib/cjs/NativeApp.js
CHANGED
|
@@ -77,28 +77,25 @@ class NativeApp {
|
|
|
77
77
|
}
|
|
78
78
|
/** @internal */
|
|
79
79
|
static async shutdown() {
|
|
80
|
-
|
|
81
|
-
(_b = this._removeAppNotify) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
80
|
+
this._removeAppNotify?.();
|
|
82
81
|
NativeApp.unhookBrowserConnectivityEvents();
|
|
83
82
|
await NativeAppLogger_1.NativeAppLogger.flush();
|
|
84
83
|
await IpcApp_1.IpcApp.shutdown();
|
|
85
84
|
this._isValid = false;
|
|
86
85
|
}
|
|
87
86
|
static async requestDownloadBriefcase(iTwinId, iModelId, downloadOptions, asOf = core_common_1.IModelVersion.latest(), progress) {
|
|
88
|
-
var _b;
|
|
89
87
|
const shouldReportProgress = !!progress || !!downloadOptions.progressCallback;
|
|
90
88
|
let stopProgressEvents = () => { };
|
|
91
89
|
if (shouldReportProgress) {
|
|
92
90
|
const handleProgress = (_evt, data) => {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
(_b = downloadOptions.progressCallback) === null || _b === void 0 ? void 0 : _b.call(downloadOptions, data);
|
|
91
|
+
progress?.(data);
|
|
92
|
+
downloadOptions.progressCallback?.(data);
|
|
96
93
|
};
|
|
97
94
|
stopProgressEvents = IpcApp_1.IpcApp.addListener(`nativeApp.progress-${iModelId}`, handleProgress);
|
|
98
95
|
}
|
|
99
96
|
const briefcaseId = (undefined !== downloadOptions.briefcaseId) ? downloadOptions.briefcaseId :
|
|
100
97
|
(downloadOptions.syncMode === core_common_1.SyncMode.PullOnly ? 0 : await this.nativeAppIpc.acquireNewBriefcaseId(iModelId));
|
|
101
|
-
const fileName =
|
|
98
|
+
const fileName = downloadOptions.fileName ?? await this.getBriefcaseFileName({ briefcaseId, iModelId });
|
|
102
99
|
const requestProps = { iModelId, briefcaseId, iTwinId, asOf: asOf.toJSON(), fileName };
|
|
103
100
|
const doDownload = async () => {
|
|
104
101
|
try {
|
package/lib/cjs/NativeApp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeApp.js","sourceRoot":"","sources":["../../src/NativeApp.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;AAEH,sDAAqG;AACrG,oDAI4B;AAC5B,+CAA2E;AAC3E,qEAAkE;AAClE,qCAAsE;AACtE,uDAAoD;AAwBpD,2CAA2C;AAC3C,MAAM,sBAAuB,SAAQ,4BAAmB;IACtD,IAAW,WAAW,KAAK,OAAO,6BAAe,CAAC,CAAC,CAAC;IAC7C,iCAAiC,CAAC,MAAkC;QACzE,qBAAM,CAAC,OAAO,CAAC,+CAAsB,CAAC,SAAS,EAAE,+BAA+B,CAAC,CAAC;QAClF,SAAS,CAAC,6BAA6B,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAC7D,CAAC;CACF;AAUD;;;;GAIG;AACH,MAAa,SAAS;IAGpB,2CAA2C;IACpC,MAAM,CAAC,KAAK,CAAC,cAAc,CAA+C,UAAa,EAAE,GAAG,IAAuC;QACxI,OAAO,eAAM,CA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,CAAC,OAAO,CAAC,GAAW;QAC9B,OAAO,SAAS,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;IACzD,CAAC;IAED,0BAA0B;IACnB,KAAK,CAAC,OAAO,CAAC,GAAW,EAAE,KAAmB;QACnD,OAAO,SAAS,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAChE,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,OAAO;QAClB,OAAO,SAAS,CAAC,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACrD,CAAC;IAED,iCAAiC;IAC1B,KAAK,CAAC,UAAU,CAAC,GAAW;QACjC,OAAO,SAAS,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;IAC5D,CAAC;IAED,sCAAsC;IAC/B,KAAK,CAAC,SAAS;QACpB,OAAO,SAAS,CAAC,YAAY,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1D,CAAC;CACF;AAnCD,0BAmCC","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 NativeApp\r\n */\r\n\r\nimport { AsyncMethodsOf, BeEvent, GuidString, Logger, PromiseReturnType } from \"@itwin/core-bentley\";\r\nimport {\r\n BriefcaseDownloader, BriefcaseProps, IModelVersion, InternetConnectivityStatus, IpcSocketFrontend, LocalBriefcaseProps,\r\n nativeAppChannel, NativeAppFunctions, NativeAppNotifications, nativeAppNotify, OverriddenBy,\r\n RemoveFunction, RequestNewBriefcaseProps, StorageValue, SyncMode,\r\n} from \"@itwin/core-common\";\r\nimport { ProgressCallback, RequestGlobalOptions } from \"./request/Request\";\r\nimport { FrontendLoggerCategory } from \"./FrontendLoggerCategory\";\r\nimport { IpcApp, IpcAppOptions, NotificationHandler } from \"./IpcApp\";\r\nimport { NativeAppLogger } from \"./NativeAppLogger\";\r\nimport { OnDownloadProgress } from \"./BriefcaseConnection\";\r\n\r\n/** Properties for specifying the BriefcaseId for downloading. May either specify a BriefcaseId directly (preferable) or, for\r\n * backwards compatibility, a [SyncMode]($common). If [SyncMode.PullAndPush]($common) is supplied, a new briefcaseId will be acquired.\r\n * @public\r\n */\r\nexport type DownloadBriefcaseId =\r\n { syncMode?: SyncMode, briefcaseId?: never } |\r\n { briefcaseId: number, syncMode?: never };\r\n\r\n/**\r\n* Options to download a briefcase\r\n* @public\r\n*/\r\nexport type DownloadBriefcaseOptions = DownloadBriefcaseId & {\r\n /** the full path for the briefcase file */\r\n fileName?: string;\r\n /** Function called regularly to report progress of download. */\r\n progressCallback?: OnDownloadProgress;\r\n /** interval for calling progress function, in milliseconds */\r\n progressInterval?: number;\r\n};\r\n\r\n/** NativeApp notifications from backend */\r\nclass NativeAppNotifyHandler extends NotificationHandler implements NativeAppNotifications {\r\n public get channelName() { return nativeAppNotify; }\r\n public notifyInternetConnectivityChanged(status: InternetConnectivityStatus) {\r\n Logger.logInfo(FrontendLoggerCategory.NativeApp, \"Internet connectivity changed\");\r\n NativeApp.onInternetConnectivityChanged.raiseEvent(status);\r\n }\r\n}\r\n\r\n/**\r\n * Options for [[NativeApp.startup]]\r\n * @public\r\n */\r\nexport interface NativeAppOpts extends IpcAppOptions {\r\n nativeApp?: {};\r\n}\r\n\r\n/**\r\n * The frontend of a native application\r\n * @see [Native Applications]($docs/learning/NativeApps.md)\r\n * @public\r\n */\r\nexport class NativeApp {\r\n private static _removeAppNotify?: RemoveFunction;\r\n\r\n /** @deprecated in 3.x. use nativeAppIpc */\r\n public static async callNativeHost<T extends AsyncMethodsOf<NativeAppFunctions>>(methodName: T, ...args: Parameters<NativeAppFunctions[T]>) {\r\n return IpcApp.callIpcChannel(nativeAppChannel, methodName, ...args) as PromiseReturnType<NativeAppFunctions[T]>;\r\n }\r\n /** A Proxy to call one of the [NativeAppFunctions]($common) functions via IPC. */\r\n public static nativeAppIpc = IpcApp.makeIpcProxy<NativeAppFunctions>(nativeAppChannel);\r\n\r\n private static _storages = new Map<string, Storage>();\r\n private static _onOnline = async () => {\r\n await NativeApp.setConnectivity(OverriddenBy.Browser, InternetConnectivityStatus.Online);\r\n };\r\n private static _onOffline = async () => {\r\n await NativeApp.setConnectivity(OverriddenBy.Browser, InternetConnectivityStatus.Offline);\r\n };\r\n private static async setConnectivity(by: OverriddenBy, status: InternetConnectivityStatus) {\r\n RequestGlobalOptions.online = (status === InternetConnectivityStatus.Online);\r\n await this.nativeAppIpc.overrideInternetConnectivity(by, status);\r\n }\r\n private static hookBrowserConnectivityEvents() {\r\n if (typeof window === \"object\" && window.ononline && window.onoffline) {\r\n window.addEventListener(\"online\", this._onOnline);\r\n window.addEventListener(\"offline\", this._onOffline);\r\n }\r\n }\r\n private static unhookBrowserConnectivityEvents() {\r\n if (typeof window === \"object\" && window.ononline && window.onoffline) {\r\n window.removeEventListener(\"online\", this._onOnline);\r\n window.removeEventListener(\"offline\", this._onOffline);\r\n }\r\n }\r\n /** event called when internet connectivity changes, if known */\r\n public static onInternetConnectivityChanged = new BeEvent<(status: InternetConnectivityStatus) => void>();\r\n\r\n /** determine whether the app currently has internet connectivity, if known */\r\n public static async checkInternetConnectivity(): Promise<InternetConnectivityStatus> {\r\n return this.nativeAppIpc.checkInternetConnectivity();\r\n }\r\n /** @internal */\r\n public static async overrideInternetConnectivity(status: InternetConnectivityStatus): Promise<void> {\r\n return this.nativeAppIpc.overrideInternetConnectivity(OverriddenBy.User, status);\r\n }\r\n private static _isValid = false;\r\n public static get isValid(): boolean { return this._isValid; }\r\n\r\n /**\r\n * This is called by either ElectronApp.startup or MobileApp.startup - it should not be called directly\r\n * @internal\r\n */\r\n public static async startup(ipc: IpcSocketFrontend, opts?: NativeAppOpts) {\r\n await IpcApp.startup(ipc, opts);\r\n if (this._isValid)\r\n return;\r\n this._isValid = true;\r\n\r\n this._removeAppNotify = NativeAppNotifyHandler.register(); // receives notifications from backend\r\n NativeApp.hookBrowserConnectivityEvents();\r\n\r\n // initialize current online state.\r\n if (window.navigator.onLine) {\r\n RequestGlobalOptions.online = window.navigator.onLine;\r\n await this.setConnectivity(OverriddenBy.Browser, window.navigator.onLine ? InternetConnectivityStatus.Online : InternetConnectivityStatus.Offline);\r\n }\r\n }\r\n\r\n /** @internal */\r\n public static async shutdown() {\r\n this._removeAppNotify?.();\r\n NativeApp.unhookBrowserConnectivityEvents();\r\n await NativeAppLogger.flush();\r\n await IpcApp.shutdown();\r\n this._isValid = false;\r\n }\r\n\r\n public static async requestDownloadBriefcase(iTwinId: string, iModelId: string, downloadOptions: DownloadBriefcaseOptions,\r\n asOf?: IModelVersion): Promise<BriefcaseDownloader>;\r\n\r\n /**\r\n * @deprecated in 3.6. [[progress]] argument is now deprecated, use [[DownloadBriefcaseOptions.progressCallback]] instead.\r\n */\r\n public static async requestDownloadBriefcase(iTwinId: string, iModelId: string, downloadOptions: DownloadBriefcaseOptions,\r\n // eslint-disable-next-line @typescript-eslint/unified-signatures\r\n asOf?: IModelVersion, progress?: ProgressCallback): Promise<BriefcaseDownloader>;\r\n\r\n public static async requestDownloadBriefcase(\r\n iTwinId: string,\r\n iModelId: string,\r\n downloadOptions: DownloadBriefcaseOptions,\r\n asOf: IModelVersion = IModelVersion.latest(),\r\n progress?: ProgressCallback\r\n ): Promise<BriefcaseDownloader> {\r\n const shouldReportProgress = !!progress || !!downloadOptions.progressCallback;\r\n\r\n let stopProgressEvents = () => { };\r\n if (shouldReportProgress) {\r\n const handleProgress = (_evt: Event, data: { loaded: number, total: number }) => {\r\n progress?.(data);\r\n downloadOptions.progressCallback?.(data);\r\n };\r\n\r\n stopProgressEvents = IpcApp.addListener(`nativeApp.progress-${iModelId}`, handleProgress);\r\n }\r\n\r\n const briefcaseId = (undefined !== downloadOptions.briefcaseId) ? downloadOptions.briefcaseId :\r\n (downloadOptions.syncMode === SyncMode.PullOnly ? 0 : await this.nativeAppIpc.acquireNewBriefcaseId(iModelId));\r\n\r\n const fileName = downloadOptions.fileName ?? await this.getBriefcaseFileName({ briefcaseId, iModelId });\r\n const requestProps: RequestNewBriefcaseProps = { iModelId, briefcaseId, iTwinId, asOf: asOf.toJSON(), fileName };\r\n\r\n const doDownload = async (): Promise<void> => {\r\n try {\r\n await this.nativeAppIpc.downloadBriefcase(requestProps, shouldReportProgress, downloadOptions.progressInterval);\r\n } finally {\r\n stopProgressEvents();\r\n }\r\n };\r\n\r\n const requestCancel = async (): Promise<boolean> => {\r\n const status = await this.nativeAppIpc.requestCancelDownloadBriefcase(fileName);\r\n if (status)\r\n stopProgressEvents();\r\n return status;\r\n };\r\n\r\n return { briefcaseId, fileName, downloadPromise: doDownload(), requestCancel };\r\n }\r\n\r\n /** Get the full path filename for a briefcase within the briefcase cache */\r\n public static async getBriefcaseFileName(props: BriefcaseProps): Promise<string> {\r\n return this.nativeAppIpc.getBriefcaseFileName(props);\r\n }\r\n\r\n /** Delete an existing briefcase\r\n * @param fileName the briefcase fileName\r\n */\r\n public static async deleteBriefcase(fileName: string): Promise<void> {\r\n await this.nativeAppIpc.deleteBriefcaseFiles(fileName);\r\n }\r\n\r\n /** Get a list of all briefcase files held in the local briefcase cache directory */\r\n public static async getCachedBriefcases(iModelId?: GuidString): Promise<LocalBriefcaseProps[]> {\r\n return this.nativeAppIpc.getCachedBriefcases(iModelId);\r\n }\r\n\r\n /**\r\n * Open a [[Storage]]. Creates a new Storage with that name if it does not already exist.\r\n * @param name Should be a local filename without an extension.\r\n * @returns a Promise for the [[Storage]].\r\n */\r\n public static async openStorage(name: string): Promise<Storage> {\r\n if (this._storages.has(name))\r\n return this._storages.get(name)!;\r\n\r\n const storage = new Storage(await this.nativeAppIpc.storageMgrOpen(name));\r\n this._storages.set(storage.id, storage);\r\n return storage;\r\n }\r\n\r\n /**\r\n * Close a Storage and optionally delete it.\r\n * @param storage normally not call directly instead use Storage.close()\r\n * @param deleteStorage if true, delete the storage from disk after closing it.\r\n */\r\n public static async closeStorage(storage: Storage, deleteStorage: boolean = false): Promise<void> {\r\n if (!this._storages.has(storage.id))\r\n throw new Error(`Storage [Id=${storage.id}] not open`);\r\n\r\n await this.nativeAppIpc.storageMgrClose(storage.id, deleteStorage);\r\n this._storages.delete(storage.id);\r\n }\r\n\r\n /** Get the list of existing Storages on the local disk. */\r\n public static async getStorageNames(): Promise<string[]> {\r\n return NativeApp.nativeAppIpc.storageMgrNames();\r\n }\r\n}\r\n\r\n/**\r\n * A local disk-based cache for key value pairs for NativeApps.\r\n * @note This should be used only for local caching, since its not guaranteed to exist permanently.\r\n * @public\r\n */\r\nexport class Storage {\r\n constructor(public readonly id: string) { }\r\n\r\n /** get the type of a value for a key, or undefined if not present. */\r\n public async getValueType(key: string): Promise<\"number\" | \"string\" | \"boolean\" | \"Uint8Array\" | \"null\" | undefined> {\r\n return NativeApp.nativeAppIpc.storageGetValueType(this.id, key);\r\n }\r\n\r\n /** Get the value for a key */\r\n public async getData(key: string): Promise<StorageValue> {\r\n return NativeApp.nativeAppIpc.storageGet(this.id, key);\r\n }\r\n\r\n /** Set value for a key */\r\n public async setData(key: string, value: StorageValue): Promise<void> {\r\n return NativeApp.nativeAppIpc.storageSet(this.id, key, value);\r\n }\r\n\r\n /**\r\n * Return an array of all keys in this Storage.\r\n * @note This can be expensive, depending on the number of keys present.\r\n */\r\n public async getKeys(): Promise<string[]> {\r\n return NativeApp.nativeAppIpc.storageKeys(this.id);\r\n }\r\n\r\n /** Remove a key and its data. */\r\n public async removeData(key: string): Promise<void> {\r\n return NativeApp.nativeAppIpc.storageRemove(this.id, key);\r\n }\r\n\r\n /** Remove all keys and their data. */\r\n public async removeAll(): Promise<void> {\r\n return NativeApp.nativeAppIpc.storageRemoveAll(this.id);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"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AI,CAAC,EAAE,CAAC,CAAC;IAC1D,CAAC;CACF;AAnCD,0BAmCC","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 NativeApp\r\n */\r\n\r\nimport { AsyncMethodsOf, BeEvent, GuidString, Logger, PromiseReturnType } from \"@itwin/core-bentley\";\r\nimport {\r\n BriefcaseDownloader, BriefcaseProps, IModelVersion, InternetConnectivityStatus, IpcSocketFrontend, LocalBriefcaseProps,\r\n nativeAppChannel, NativeAppFunctions, NativeAppNotifications, nativeAppNotify, OverriddenBy,\r\n RemoveFunction, RequestNewBriefcaseProps, StorageValue, SyncMode,\r\n} from \"@itwin/core-common\";\r\nimport { ProgressCallback, RequestGlobalOptions } from \"./request/Request\";\r\nimport { FrontendLoggerCategory } from \"./FrontendLoggerCategory\";\r\nimport { IpcApp, IpcAppOptions, NotificationHandler } from \"./IpcApp\";\r\nimport { NativeAppLogger } from \"./NativeAppLogger\";\r\nimport { OnDownloadProgress } from \"./BriefcaseConnection\";\r\n\r\n/** Properties for specifying the BriefcaseId for downloading. May either specify a BriefcaseId directly (preferable) or, for\r\n * backwards compatibility, a [SyncMode]($common). If [SyncMode.PullAndPush]($common) is supplied, a new briefcaseId will be acquired.\r\n * @public\r\n */\r\nexport type DownloadBriefcaseId =\r\n { syncMode?: SyncMode, briefcaseId?: never } |\r\n { briefcaseId: number, syncMode?: never };\r\n\r\n/**\r\n* Options to download a briefcase\r\n* @public\r\n*/\r\nexport type DownloadBriefcaseOptions = DownloadBriefcaseId & {\r\n /** the full path for the briefcase file */\r\n fileName?: string;\r\n /** Function called regularly to report progress of download. */\r\n progressCallback?: OnDownloadProgress;\r\n /** interval for calling progress function, in milliseconds */\r\n progressInterval?: number;\r\n};\r\n\r\n/** NativeApp notifications from backend */\r\nclass NativeAppNotifyHandler extends NotificationHandler implements NativeAppNotifications {\r\n public get channelName() { return nativeAppNotify; }\r\n public notifyInternetConnectivityChanged(status: InternetConnectivityStatus) {\r\n Logger.logInfo(FrontendLoggerCategory.NativeApp, \"Internet connectivity changed\");\r\n NativeApp.onInternetConnectivityChanged.raiseEvent(status);\r\n }\r\n}\r\n\r\n/**\r\n * Options for [[NativeApp.startup]]\r\n * @public\r\n */\r\nexport interface NativeAppOpts extends IpcAppOptions {\r\n nativeApp?: {};\r\n}\r\n\r\n/**\r\n * The frontend of a native application\r\n * @see [Native Applications]($docs/learning/NativeApps.md)\r\n * @public\r\n */\r\nexport class NativeApp {\r\n private static _removeAppNotify?: RemoveFunction;\r\n\r\n /** @deprecated in 3.x. use nativeAppIpc */\r\n public static async callNativeHost<T extends AsyncMethodsOf<NativeAppFunctions>>(methodName: T, ...args: Parameters<NativeAppFunctions[T]>) {\r\n return IpcApp.callIpcChannel(nativeAppChannel, methodName, ...args) as PromiseReturnType<NativeAppFunctions[T]>;\r\n }\r\n /** A Proxy to call one of the [NativeAppFunctions]($common) functions via IPC. */\r\n public static nativeAppIpc = IpcApp.makeIpcProxy<NativeAppFunctions>(nativeAppChannel);\r\n\r\n private static _storages = new Map<string, Storage>();\r\n private static _onOnline = async () => {\r\n await NativeApp.setConnectivity(OverriddenBy.Browser, InternetConnectivityStatus.Online);\r\n };\r\n private static _onOffline = async () => {\r\n await NativeApp.setConnectivity(OverriddenBy.Browser, InternetConnectivityStatus.Offline);\r\n };\r\n private static async setConnectivity(by: OverriddenBy, status: InternetConnectivityStatus) {\r\n RequestGlobalOptions.online = (status === InternetConnectivityStatus.Online);\r\n await this.nativeAppIpc.overrideInternetConnectivity(by, status);\r\n }\r\n private static hookBrowserConnectivityEvents() {\r\n if (typeof window === \"object\" && window.ononline && window.onoffline) {\r\n window.addEventListener(\"online\", this._onOnline);\r\n window.addEventListener(\"offline\", this._onOffline);\r\n }\r\n }\r\n private static unhookBrowserConnectivityEvents() {\r\n if (typeof window === \"object\" && window.ononline && window.onoffline) {\r\n window.removeEventListener(\"online\", this._onOnline);\r\n window.removeEventListener(\"offline\", this._onOffline);\r\n }\r\n }\r\n /** event called when internet connectivity changes, if known */\r\n public static onInternetConnectivityChanged = new BeEvent<(status: InternetConnectivityStatus) => void>();\r\n\r\n /** determine whether the app currently has internet connectivity, if known */\r\n public static async checkInternetConnectivity(): Promise<InternetConnectivityStatus> {\r\n return this.nativeAppIpc.checkInternetConnectivity();\r\n }\r\n /** @internal */\r\n public static async overrideInternetConnectivity(status: InternetConnectivityStatus): Promise<void> {\r\n return this.nativeAppIpc.overrideInternetConnectivity(OverriddenBy.User, status);\r\n }\r\n private static _isValid = false;\r\n public static get isValid(): boolean { return this._isValid; }\r\n\r\n /**\r\n * This is called by either ElectronApp.startup or MobileApp.startup - it should not be called directly\r\n * @internal\r\n */\r\n public static async startup(ipc: IpcSocketFrontend, opts?: NativeAppOpts) {\r\n await IpcApp.startup(ipc, opts);\r\n if (this._isValid)\r\n return;\r\n this._isValid = true;\r\n\r\n this._removeAppNotify = NativeAppNotifyHandler.register(); // receives notifications from backend\r\n NativeApp.hookBrowserConnectivityEvents();\r\n\r\n // initialize current online state.\r\n if (window.navigator.onLine) {\r\n RequestGlobalOptions.online = window.navigator.onLine;\r\n await this.setConnectivity(OverriddenBy.Browser, window.navigator.onLine ? InternetConnectivityStatus.Online : InternetConnectivityStatus.Offline);\r\n }\r\n }\r\n\r\n /** @internal */\r\n public static async shutdown() {\r\n this._removeAppNotify?.();\r\n NativeApp.unhookBrowserConnectivityEvents();\r\n await NativeAppLogger.flush();\r\n await IpcApp.shutdown();\r\n this._isValid = false;\r\n }\r\n\r\n public static async requestDownloadBriefcase(iTwinId: string, iModelId: string, downloadOptions: DownloadBriefcaseOptions,\r\n asOf?: IModelVersion): Promise<BriefcaseDownloader>;\r\n\r\n /**\r\n * @deprecated in 3.6. [[progress]] argument is now deprecated, use [[DownloadBriefcaseOptions.progressCallback]] instead.\r\n */\r\n public static async requestDownloadBriefcase(iTwinId: string, iModelId: string, downloadOptions: DownloadBriefcaseOptions,\r\n // eslint-disable-next-line @typescript-eslint/unified-signatures\r\n asOf?: IModelVersion, progress?: ProgressCallback): Promise<BriefcaseDownloader>;\r\n\r\n public static async requestDownloadBriefcase(\r\n iTwinId: string,\r\n iModelId: string,\r\n downloadOptions: DownloadBriefcaseOptions,\r\n asOf: IModelVersion = IModelVersion.latest(),\r\n progress?: ProgressCallback\r\n ): Promise<BriefcaseDownloader> {\r\n const shouldReportProgress = !!progress || !!downloadOptions.progressCallback;\r\n\r\n let stopProgressEvents = () => { };\r\n if (shouldReportProgress) {\r\n const handleProgress = (_evt: Event, data: { loaded: number, total: number }) => {\r\n progress?.(data);\r\n downloadOptions.progressCallback?.(data);\r\n };\r\n\r\n stopProgressEvents = IpcApp.addListener(`nativeApp.progress-${iModelId}`, handleProgress);\r\n }\r\n\r\n const briefcaseId = (undefined !== downloadOptions.briefcaseId) ? downloadOptions.briefcaseId :\r\n (downloadOptions.syncMode === SyncMode.PullOnly ? 0 : await this.nativeAppIpc.acquireNewBriefcaseId(iModelId));\r\n\r\n const fileName = downloadOptions.fileName ?? await this.getBriefcaseFileName({ briefcaseId, iModelId });\r\n const requestProps: RequestNewBriefcaseProps = { iModelId, briefcaseId, iTwinId, asOf: asOf.toJSON(), fileName };\r\n\r\n const doDownload = async (): Promise<void> => {\r\n try {\r\n await this.nativeAppIpc.downloadBriefcase(requestProps, shouldReportProgress, downloadOptions.progressInterval);\r\n } finally {\r\n stopProgressEvents();\r\n }\r\n };\r\n\r\n const requestCancel = async (): Promise<boolean> => {\r\n const status = await this.nativeAppIpc.requestCancelDownloadBriefcase(fileName);\r\n if (status)\r\n stopProgressEvents();\r\n return status;\r\n };\r\n\r\n return { briefcaseId, fileName, downloadPromise: doDownload(), requestCancel };\r\n }\r\n\r\n /** Get the full path filename for a briefcase within the briefcase cache */\r\n public static async getBriefcaseFileName(props: BriefcaseProps): Promise<string> {\r\n return this.nativeAppIpc.getBriefcaseFileName(props);\r\n }\r\n\r\n /** Delete an existing briefcase\r\n * @param fileName the briefcase fileName\r\n */\r\n public static async deleteBriefcase(fileName: string): Promise<void> {\r\n await this.nativeAppIpc.deleteBriefcaseFiles(fileName);\r\n }\r\n\r\n /** Get a list of all briefcase files held in the local briefcase cache directory */\r\n public static async getCachedBriefcases(iModelId?: GuidString): Promise<LocalBriefcaseProps[]> {\r\n return this.nativeAppIpc.getCachedBriefcases(iModelId);\r\n }\r\n\r\n /**\r\n * Open a [[Storage]]. Creates a new Storage with that name if it does not already exist.\r\n * @param name Should be a local filename without an extension.\r\n * @returns a Promise for the [[Storage]].\r\n */\r\n public static async openStorage(name: string): Promise<Storage> {\r\n if (this._storages.has(name))\r\n return this._storages.get(name)!;\r\n\r\n const storage = new Storage(await this.nativeAppIpc.storageMgrOpen(name));\r\n this._storages.set(storage.id, storage);\r\n return storage;\r\n }\r\n\r\n /**\r\n * Close a Storage and optionally delete it.\r\n * @param storage normally not call directly instead use Storage.close()\r\n * @param deleteStorage if true, delete the storage from disk after closing it.\r\n */\r\n public static async closeStorage(storage: Storage, deleteStorage: boolean = false): Promise<void> {\r\n if (!this._storages.has(storage.id))\r\n throw new Error(`Storage [Id=${storage.id}] not open`);\r\n\r\n await this.nativeAppIpc.storageMgrClose(storage.id, deleteStorage);\r\n this._storages.delete(storage.id);\r\n }\r\n\r\n /** Get the list of existing Storages on the local disk. */\r\n public static async getStorageNames(): Promise<string[]> {\r\n return NativeApp.nativeAppIpc.storageMgrNames();\r\n }\r\n}\r\n\r\n/**\r\n * A local disk-based cache for key value pairs for NativeApps.\r\n * @note This should be used only for local caching, since its not guaranteed to exist permanently.\r\n * @public\r\n */\r\nexport class Storage {\r\n constructor(public readonly id: string) { }\r\n\r\n /** get the type of a value for a key, or undefined if not present. */\r\n public async getValueType(key: string): Promise<\"number\" | \"string\" | \"boolean\" | \"Uint8Array\" | \"null\" | undefined> {\r\n return NativeApp.nativeAppIpc.storageGetValueType(this.id, key);\r\n }\r\n\r\n /** Get the value for a key */\r\n public async getData(key: string): Promise<StorageValue> {\r\n return NativeApp.nativeAppIpc.storageGet(this.id, key);\r\n }\r\n\r\n /** Set value for a key */\r\n public async setData(key: string, value: StorageValue): Promise<void> {\r\n return NativeApp.nativeAppIpc.storageSet(this.id, key, value);\r\n }\r\n\r\n /**\r\n * Return an array of all keys in this Storage.\r\n * @note This can be expensive, depending on the number of keys present.\r\n */\r\n public async getKeys(): Promise<string[]> {\r\n return NativeApp.nativeAppIpc.storageKeys(this.id);\r\n }\r\n\r\n /** Remove a key and its data. */\r\n public async removeData(key: string): Promise<void> {\r\n return NativeApp.nativeAppIpc.storageRemove(this.id, key);\r\n }\r\n\r\n /** Remove all keys and their data. */\r\n public async removeAll(): Promise<void> {\r\n return NativeApp.nativeAppIpc.storageRemoveAll(this.id);\r\n }\r\n}\r\n"]}
|
package/lib/cjs/NoRenderApp.js
CHANGED
|
@@ -75,11 +75,10 @@ class NoRenderApp {
|
|
|
75
75
|
* Use this in place of [[IModelApp.startup]], then proceed to use [[IModelApp]]'s API as normal.
|
|
76
76
|
*/
|
|
77
77
|
static async startup(opts) {
|
|
78
|
-
var _a;
|
|
79
78
|
opts = opts ? opts : {};
|
|
80
79
|
opts.renderSys = new NullRenderSystem();
|
|
81
80
|
opts.noRender = true;
|
|
82
|
-
opts.localization =
|
|
81
|
+
opts.localization = opts.localization ?? new core_common_1.EmptyLocalization();
|
|
83
82
|
await IModelApp_1.IModelApp.startup(opts);
|
|
84
83
|
}
|
|
85
84
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoRenderApp.js","sourceRoot":"","sources":["../../src/NoRenderApp.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAAuD;AACvD,2CAA0D;AAE1D,wDAAqD;AACrD,wDAAqD;AACrD,yCAAsC;AAEtC;;;;GAIG;AACH,MAAa,UAAW,SAAQ,2BAAY;IAC1C,IAAW,gBAAgB,KA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,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,IAAI,IAAI,+BAAiB,EAAE,CAAC;QACjE,MAAM,qBAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;CACF;AAXD,kCAWC","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 IModelApp\r\n */\r\n\r\nimport { EmptyLocalization } from \"@itwin/core-common\";\r\nimport { IModelApp, IModelAppOptions } from \"./IModelApp\";\r\nimport { AnimationBranchStates } from \"./render/GraphicBranch\";\r\nimport { RenderSystem } from \"./render/RenderSystem\";\r\nimport { RenderTarget } from \"./render/RenderTarget\";\r\nimport { ViewRect } from \"./ViewRect\";\r\n\r\n/**\r\n * A RenderTarget for applications that must run in environments where WebGL is not present.\r\n * This is typically used in tests.\r\n * @internal\r\n */\r\nexport class NullTarget extends RenderTarget {\r\n public get analysisFraction(): number { return 0; }\r\n public set analysisFraction(_fraction: number) { }\r\n public get renderSystem() { return undefined as any; }\r\n public get viewRect(): ViewRect { return new ViewRect(); }\r\n public get wantInvertBlackBackground(): boolean { return false; }\r\n public override get animationBranches(): AnimationBranchStates | undefined { return undefined; }\r\n public override set animationBranches(_branches: AnimationBranchStates | undefined) { }\r\n public onDestroy(): void { }\r\n public override reset(): void { }\r\n public changeScene(): void { }\r\n public changeDynamics(): void { }\r\n public changeDecorations(): void { }\r\n public changeRenderPlan(): void { }\r\n public drawFrame(_sceneMilSecElapsed?: number): void { }\r\n public override overrideFeatureSymbology(): void { }\r\n public override setHiliteSet(): void { }\r\n public override setFlashed(): void { }\r\n public setViewRect(): void { }\r\n public override onResized(): void { }\r\n public override dispose(): void { }\r\n public updateViewRect(): boolean { return false; }\r\n public readPixels(): void { }\r\n public get screenSpaceEffects(): Iterable<string> { return []; }\r\n public set screenSpaceEffects(_effects: Iterable<string>) { }\r\n}\r\n\r\n/**\r\n * A RenderSystem for applications that must run in environments where WebGL is not present.\r\n * This is typically used in tests.\r\n * @internal\r\n */\r\nexport class NullRenderSystem extends RenderSystem {\r\n public get isValid(): boolean { return false; }\r\n public doIdleWork(): boolean { return false; }\r\n public createTarget() { return new NullTarget(); }\r\n public createOffscreenTarget() { return new NullTarget(); }\r\n public createGraphic() { return undefined as any; }\r\n public createGraphicList() { return undefined as any; }\r\n public createGraphicBranch() { return undefined as any; }\r\n public createBatch() { return undefined as any; }\r\n public dispose() { }\r\n public constructor() { super(); }\r\n public override createRenderGraphic() { return undefined; }\r\n}\r\n\r\n/** A utility class intended for applications (primarily test-runners) that run in environments that lack support for WebGL.\r\n * It installs a [[RenderSystem]] that produces no graphics.\r\n * Use [[NoRenderApp.startup]] instead of [[IModelApp.startup]] to initialize your application frontend.\r\n * You may then use the [[IModelApp]] API as normal.\r\n * @public\r\n */\r\nexport class NoRenderApp {\r\n /** Initializes [[IModelApp]] with a [[RenderSystem]] that produces no graphics.\r\n * Use this in place of [[IModelApp.startup]], then proceed to use [[IModelApp]]'s API as normal.\r\n */\r\n public static async startup(opts?: IModelAppOptions): Promise<void> {\r\n opts = opts ? opts : {};\r\n opts.renderSys = new NullRenderSystem();\r\n opts.noRender = true;\r\n opts.localization = opts.localization ?? new EmptyLocalization();\r\n await IModelApp.startup(opts);\r\n }\r\n}\r\n"]}
|
|
@@ -48,7 +48,7 @@ class PlanarClipMaskState {
|
|
|
48
48
|
for (const modelId of this.settings.modelIds) {
|
|
49
49
|
const model = view.iModel.models.getLoaded(modelId);
|
|
50
50
|
(0, core_bentley_1.assert)(model !== undefined); // Models should be loaded by RealityModelTileTree
|
|
51
|
-
if (model
|
|
51
|
+
if (model?.asGeometricModel)
|
|
52
52
|
this._tileTreeRefs.push((0, internal_1.createMaskTreeReference)(view, model.asGeometricModel));
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{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AC,aAAa,CAAC,CAAC;gBAEjD,OAAO,SAAS,CAAC;aAClB;SACF;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAlFD,kDAkFC","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 Views\r\n */\r\n\r\nimport { assert, Id64String } from \"@itwin/core-bentley\";\r\nimport { PlanarClipMaskMode, PlanarClipMaskPriority, PlanarClipMaskProps, PlanarClipMaskSettings } from \"@itwin/core-common\";\r\nimport { FeatureSymbology } from \"./render/FeatureSymbology\";\r\nimport { createMaskTreeReference, DisclosedTileTreeSet, TileTreeReference } from \"./tile/internal\";\r\nimport { ViewState3d } from \"./ViewState\";\r\n\r\n/** The State of Planar Clip Mask applied to a reality model or background map.\r\n * Handles loading models and their associated tiles for models that are used by masks but may not be otherwise loaded or displayed.\r\n * @beta\r\n */\r\nexport class PlanarClipMaskState {\r\n public readonly settings: PlanarClipMaskSettings;\r\n private _tileTreeRefs?: TileTreeReference[];\r\n private _allLoaded = false;\r\n\r\n private constructor(settings: PlanarClipMaskSettings) {\r\n this.settings = settings;\r\n }\r\n\r\n public static create(settings: PlanarClipMaskSettings): PlanarClipMaskState {\r\n return new PlanarClipMaskState(settings);\r\n }\r\n\r\n public static fromJSON(props: PlanarClipMaskProps): PlanarClipMaskState {\r\n return this.create(PlanarClipMaskSettings.fromJSON(props));\r\n }\r\n\r\n public discloseTileTrees(trees: DisclosedTileTreeSet): void {\r\n if (this._tileTreeRefs)\r\n this._tileTreeRefs.forEach((treeRef) => treeRef.discloseTileTrees(trees));\r\n }\r\n\r\n public getTileTrees(view: ViewState3d, classifiedModelId: Id64String): TileTreeReference[] | undefined {\r\n if (this.settings.mode === PlanarClipMaskMode.Priority) {\r\n const viewTrees = new Array<TileTreeReference>();\r\n const thisPriority = this.settings.priority === undefined ? PlanarClipMaskPriority.RealityModel : this.settings.priority;\r\n view.forEachTileTreeRef((ref) => {\r\n const tree = ref.treeOwner.load();\r\n if (tree && tree.modelId !== classifiedModelId && ref.planarclipMaskPriority > thisPriority)\r\n viewTrees.push(ref);\r\n });\r\n\r\n return viewTrees;\r\n }\r\n\r\n if (!this._tileTreeRefs) {\r\n this._tileTreeRefs = new Array<TileTreeReference>();\r\n if (this.settings.modelIds) {\r\n for (const modelId of this.settings.modelIds) {\r\n const model = view.iModel.models.getLoaded(modelId);\r\n assert(model !== undefined); // Models should be loaded by RealityModelTileTree\r\n if (model?.asGeometricModel)\r\n this._tileTreeRefs.push(createMaskTreeReference(view, model.asGeometricModel));\r\n }\r\n }\r\n }\r\n\r\n if (!this._allLoaded)\r\n this._allLoaded = this._tileTreeRefs.every((treeRef) => treeRef.treeOwner.load() !== undefined);\r\n\r\n return this._allLoaded ? this._tileTreeRefs : undefined;\r\n }\r\n\r\n public getPlanarClipMaskSymbologyOverrides(): FeatureSymbology.Overrides | undefined {\r\n if (!this.settings.subCategoryOrElementIds)\r\n return undefined;\r\n\r\n switch (this.settings.mode) {\r\n case PlanarClipMaskMode.IncludeElements: {\r\n const overrides = new FeatureSymbology.Overrides();\r\n overrides.setAlwaysDrawnSet(this.settings.subCategoryOrElementIds, true);\r\n return overrides;\r\n }\r\n case PlanarClipMaskMode.ExcludeElements: {\r\n const overrides = new FeatureSymbology.Overrides();\r\n\r\n overrides.ignoreSubCategory = true;\r\n overrides.setNeverDrawnSet(this.settings.subCategoryOrElementIds);\r\n\r\n return overrides;\r\n }\r\n case PlanarClipMaskMode.IncludeSubCategories: {\r\n const overrides = new FeatureSymbology.Overrides();\r\n for (const subCategoryId of this.settings.subCategoryOrElementIds)\r\n overrides.setVisibleSubCategory(subCategoryId);\r\n\r\n return overrides;\r\n }\r\n }\r\n\r\n return undefined;\r\n }\r\n}\r\n"]}
|
|
@@ -67,14 +67,12 @@ class RealityDataSourceContextShareImpl {
|
|
|
67
67
|
* Returns Reality Data type if available
|
|
68
68
|
*/
|
|
69
69
|
get realityDataType() {
|
|
70
|
-
|
|
71
|
-
return (_a = this._rd) === null || _a === void 0 ? void 0 : _a.type;
|
|
70
|
+
return this._rd?.type;
|
|
72
71
|
}
|
|
73
72
|
/**
|
|
74
73
|
* Query Reality Data from provider
|
|
75
74
|
*/
|
|
76
75
|
async queryRealityData(iTwinId) {
|
|
77
|
-
var _a;
|
|
78
76
|
if (!this._rd) {
|
|
79
77
|
const token = await IModelApp_1.IModelApp.getAccessToken();
|
|
80
78
|
if (token && this.realityDataId) {
|
|
@@ -82,7 +80,7 @@ class RealityDataSourceContextShareImpl {
|
|
|
82
80
|
throw new Error("Missing an implementation of RealityDataAccess on IModelApp, it is required to access reality data. Please provide an implementation to the IModelApp.startup using IModelAppOptions.realityDataAccess.");
|
|
83
81
|
this._rd = await IModelApp_1.IModelApp.realityDataAccess.getRealityData(token, iTwinId, this.realityDataId);
|
|
84
82
|
// A reality data that has not root document set should not be considered.
|
|
85
|
-
const rootDocument =
|
|
83
|
+
const rootDocument = this._rd.rootDocument ?? "";
|
|
86
84
|
this.setBaseUrl(rootDocument);
|
|
87
85
|
}
|
|
88
86
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RealityDataSourceContextShareImpl.js","sourceRoot":"","sources":["../../src/RealityDataSourceContextShareImpl.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,+CAA4D;AAC5D,sDAA8E;AAC9E,oDAAuI;AACvI,qEAAkE;AAClE,2CAAwC;AAGxC,8CAAoF;AAEpF;;;;;;EAME;AACF,MAAa,iCAAiC;IAS5C;;OAEG;IACH,YAAsB,KAA6B;QAR3C,mBAAc,GAAY,KAAK,CAAC;QAExC,sIAAsI;QAC9H,aAAQ,GAAW,EAAE,CAAC;QAM5B,2DAA2D;QAC3D,IAAA,qBAAM,EAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,KAAK,iCAAmB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EAAE;YACpD,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;YAC3D,aAAa,GAAG,sCAA2B,CAAC,uBAAuB,CAAC,YAAY,CAAC,CAAC;SACnF;QACD,OAAO,aAAa,CAAC;IACvB,CAAC;CACF;AAzOD,8EAyOC","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 Tiles\r\n */\r\nimport { request, RequestOptions } from \"./request/Request\";\r\nimport { AccessToken, assert, GuidString, Logger } from \"@itwin/core-bentley\";\r\nimport { RealityData, RealityDataFormat, RealityDataProvider, RealityDataSourceKey, RealityDataSourceProps } from \"@itwin/core-common\";\r\nimport { FrontendLoggerCategory } from \"./FrontendLoggerCategory\";\r\nimport { IModelApp } from \"./IModelApp\";\r\n\r\nimport { PublisherProductInfo, RealityDataSource, SpatialLocationAndExtents } from \"./RealityDataSource\";\r\nimport { OPCFormatInterpreter, ThreeDTileFormatInterpreter } from \"./tile/internal\";\r\n\r\n/** This class provides access to the reality data provider services.\r\n * It encapsulates access to a reality data weiter it be from local access, http or ProjectWise Context Share.\r\n * The key provided at the creation determines if this is ProjectWise Context Share reference.\r\n * If not then it is considered local (ex: C:\\temp\\TileRoot.json) or plain http access (http://someserver.com/data/TileRoot.json)\r\n * There is a one to one relationship between a reality data and the instances of present class.\r\n* @internal\r\n*/\r\nexport class RealityDataSourceContextShareImpl implements RealityDataSource {\r\n public readonly key: RealityDataSourceKey;\r\n /** The URL that supplies the 3d tiles for displaying the reality model. */\r\n private _tilesetUrl: string | undefined;\r\n private _isUrlResolved: boolean = false;\r\n private _rd: RealityData | undefined;\r\n /** For use by all Reality Data. For RD stored on PW Context Share, represents the portion from the root of the Azure Blob Container*/\r\n private _baseUrl: string = \"\";\r\n\r\n /** Construct a new reality data source.\r\n * @param props JSON representation of the reality data source\r\n */\r\n protected constructor(props: RealityDataSourceProps) {\r\n // this implementaiton is specific to ContextShare provider\r\n assert(props.sourceKey.provider === RealityDataProvider.ContextShare);\r\n this.key = props.sourceKey;\r\n this._isUrlResolved = false;\r\n }\r\n\r\n /**\r\n * Create an instance of this class from a source key and iTwin context/\r\n */\r\n public static async createFromKey(sourceKey: RealityDataSourceKey, iTwinId: GuidString | undefined): Promise<RealityDataSource | undefined> {\r\n if (sourceKey.provider !== RealityDataProvider.ContextShare)\r\n return undefined;\r\n const rdSource = new RealityDataSourceContextShareImpl({ sourceKey });\r\n let tilesetUrl: string | undefined;\r\n try {\r\n await rdSource.queryRealityData(iTwinId);\r\n tilesetUrl = await rdSource.getServiceUrl(iTwinId);\r\n } catch (e) {\r\n }\r\n\r\n return (tilesetUrl !== undefined) ? rdSource : undefined;\r\n }\r\n\r\n public get isContextShare(): boolean {\r\n return (this.key.provider === RealityDataProvider.ContextShare);\r\n }\r\n /**\r\n * Returns Reality Data if available\r\n */\r\n public get realityData(): RealityData | undefined {\r\n return this._rd;\r\n }\r\n public get realityDataId(): string | undefined {\r\n const realityDataId = this.key.id;\r\n return realityDataId;\r\n }\r\n /**\r\n * Returns Reality Data type if available\r\n */\r\n public get realityDataType(): string | undefined {\r\n return this._rd?.type;\r\n }\r\n\r\n /**\r\n * Query Reality Data from provider\r\n */\r\n private async queryRealityData(iTwinId: GuidString | undefined) {\r\n if (!this._rd) {\r\n const token = await IModelApp.getAccessToken();\r\n if (token && this.realityDataId) {\r\n if (undefined === IModelApp.realityDataAccess)\r\n throw new Error(\"Missing an implementation of RealityDataAccess on IModelApp, it is required to access reality data. Please provide an implementation to the IModelApp.startup using IModelAppOptions.realityDataAccess.\");\r\n this._rd = await IModelApp.realityDataAccess.getRealityData(token, iTwinId, this.realityDataId);\r\n // A reality data that has not root document set should not be considered.\r\n const rootDocument: string = this._rd.rootDocument ?? \"\";\r\n this.setBaseUrl(rootDocument);\r\n }\r\n }\r\n }\r\n // This is to set the root url from the provided root document path.\r\n // If the root document is stored on PW Context Share then the root document property of the Reality Data is provided,\r\n // otherwise the full path to root document is given.\r\n // The base URL contains the base URL from which tile relative path are constructed.\r\n // The tile's path root will need to be reinserted for child tiles to return a 200\r\n private setBaseUrl(url: string): void {\r\n const urlParts = url.split(\"/\");\r\n urlParts.pop();\r\n if (urlParts.length === 0)\r\n this._baseUrl = \"\";\r\n else\r\n this._baseUrl = `${urlParts.join(\"/\")}/`;\r\n }\r\n\r\n /**\r\n * Gets a tileset's app data json\r\n * @param name name or path of tile\r\n * @returns app data json object\r\n * @internal\r\n */\r\n public async getRealityDataTileJson(accessToken: AccessToken, name: string, realityData: RealityData): Promise<any> {\r\n const url = await realityData.getBlobUrl(accessToken, name);\r\n\r\n const data = await request(url.toString(), {\r\n method: \"GET\",\r\n responseType: \"json\",\r\n });\r\n return data.body;\r\n }\r\n\r\n /**\r\n * This method returns the URL to access the actual 3d tiles from the service provider.\r\n * @returns string containing the URL to reality data.\r\n */\r\n public async getServiceUrl(iTwinId: GuidString | undefined): Promise<string | undefined> {\r\n // If url was not resolved - resolve it\r\n if (!this._isUrlResolved) {\r\n const rdSourceKey = this.key;\r\n // we need to resolve tilesetURl from realityDataId and iTwinId\r\n if (undefined === IModelApp.realityDataAccess)\r\n throw new Error(\"Missing an implementation of RealityDataAccess on IModelApp, it is required to access reality data. Please provide an implementation to the IModelApp.startup using IModelAppOptions.realityDataAccess.\");\r\n try {\r\n const resolvedITwinId = iTwinId ? iTwinId : rdSourceKey.iTwinId;\r\n\r\n this._tilesetUrl = await IModelApp.realityDataAccess.getRealityDataUrl(resolvedITwinId, rdSourceKey.id);\r\n this._isUrlResolved = true;\r\n } catch (e) {\r\n const errMsg = `Error getting URL from ContextShare using realityDataId=${rdSourceKey.id} and iTwinId=${iTwinId}`;\r\n Logger.logError(FrontendLoggerCategory.RealityData, errMsg);\r\n }\r\n }\r\n return this._tilesetUrl;\r\n }\r\n\r\n public async getRootDocument(_iTwinId: GuidString | undefined): Promise<any> {\r\n const token = await IModelApp.getAccessToken();\r\n if (token) {\r\n const realityData = this.realityData;\r\n\r\n if (!realityData)\r\n throw new Error(`Reality Data not defined`);\r\n\r\n if (!realityData.rootDocument)\r\n throw new Error(`Root document not defined for reality data: ${realityData.id}`);\r\n\r\n return this.getRealityDataTileJson(token, realityData.rootDocument, realityData);\r\n }\r\n }\r\n\r\n /**\r\n * Gets tile content\r\n * @param name name or path of tile\r\n * @returns array buffer of tile content\r\n */\r\n public async getRealityDataTileContent(accessToken: AccessToken, name: string, realityData: RealityData): Promise<any> {\r\n const url = await realityData.getBlobUrl(accessToken, name);\r\n const options: RequestOptions = {\r\n method: \"GET\",\r\n responseType: \"arraybuffer\",\r\n };\r\n const data = await request(url.toString(), options);\r\n return data.body;\r\n }\r\n\r\n /**\r\n * Returns the tile content. The path to the tile is relative to the base url of present reality data whatever the type.\r\n */\r\n public async getTileContent(name: string): Promise<any> {\r\n const token = await IModelApp.getAccessToken();\r\n const tileUrl = this._baseUrl + name;\r\n\r\n if (this.realityData) {\r\n return this.getRealityDataTileContent(token, tileUrl, this.realityData);\r\n }\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Returns the tile content in json format. The path to the tile is relative to the base url of present reality data whatever the type.\r\n */\r\n public async getTileJson(name: string): Promise<any> {\r\n const token = await IModelApp.getAccessToken();\r\n const tileUrl = this._baseUrl + name;\r\n\r\n if (this.realityData) {\r\n return this.getRealityDataTileJson(token, tileUrl, this.realityData);\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n public getTileContentType(url: string): \"tile\" | \"tileset\" {\r\n return url.endsWith(\"json\") ? \"tileset\" : \"tile\";\r\n }\r\n\r\n /**\r\n * Gets spatial location and extents of this reality data source\r\n * @returns spatial location and extents\r\n * @internal\r\n */\r\n public async getSpatialLocationAndExtents(): Promise<SpatialLocationAndExtents | undefined> {\r\n let spatialLocation: SpatialLocationAndExtents | undefined;\r\n const fileType = this.realityDataType;\r\n\r\n // Mapping Resource are not currenlty supported\r\n if (fileType === \"OMR\")\r\n return undefined;\r\n\r\n if (this.key.format === RealityDataFormat.ThreeDTile) {\r\n const rootDocument = await this.getRootDocument(undefined);\r\n spatialLocation = ThreeDTileFormatInterpreter.getSpatialLocationAndExtents(rootDocument);\r\n } else if (this.key.format === RealityDataFormat.OPC) {\r\n if (this.realityData === undefined)\r\n return undefined;\r\n const token = await IModelApp.getAccessToken();\r\n const docRootName = this.realityData.rootDocument;\r\n if (!docRootName)\r\n return undefined;\r\n const blobUrl = await this.realityData.getBlobUrl(token, docRootName);\r\n if (!blobUrl)\r\n return undefined;\r\n const blobStringUrl = blobUrl.toString();\r\n const filereader = await OPCFormatInterpreter.getFileReaderFromBlobFileURL(blobStringUrl);\r\n spatialLocation = await OPCFormatInterpreter.getSpatialLocationAndExtents(filereader);\r\n }\r\n return spatialLocation;\r\n }\r\n /**\r\n * Gets information to identify the product and engine that create this reality data\r\n * Will return undefined if cannot be resolved\r\n * @returns information to identify the product and engine that create this reality data\r\n * @alpha\r\n */\r\n public async getPublisherProductInfo(): Promise<PublisherProductInfo | undefined> {\r\n let publisherInfo: PublisherProductInfo | undefined;\r\n if (this.key.format === RealityDataFormat.ThreeDTile) {\r\n const rootDocument = await this.getRootDocument(undefined);\r\n publisherInfo = ThreeDTileFormatInterpreter.getPublisherProductInfo(rootDocument);\r\n }\r\n return publisherInfo;\r\n }\r\n}\r\n\r\n"]}
|
|
1
|
+
{"version":3,"file":"RealityDataSourceContextShareImpl.js","sourceRoot":"","sources":["../../src/RealityDataSourceContextShareImpl.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,+CAA4D;AAC5D,sDAA8E;AAC9E,oDAAuI;AACvI,qEAAkE;AAClE,2CAAwC;AAGxC,8CAAoF;AAEpF;;;;;;EAME;AACF,MAAa,iCAAiC;IAS5C;;OAEG;IACH,YAAsB,KAA6B;QAR3C,mBAAc,GAAY,KAAK,CAAC;QAExC,sIAAsI;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uBAAuB;QAClC,IAAI,aAA+C,CAAC;QACpD,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,KAAK,+BAAiB,CAAC,UAAU,EAAE;YACpD,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;YAC3D,aAAa,GAAG,sCAA2B,CAAC,uBAAuB,CAAC,YAAY,CAAC,CAAC;SACnF;QACD,OAAO,aAAa,CAAC;IACvB,CAAC;CACF;AAzOD,8EAyOC","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 Tiles\r\n */\r\nimport { request, RequestOptions } from \"./request/Request\";\r\nimport { AccessToken, assert, GuidString, Logger } from \"@itwin/core-bentley\";\r\nimport { RealityData, RealityDataFormat, RealityDataProvider, RealityDataSourceKey, RealityDataSourceProps } from \"@itwin/core-common\";\r\nimport { FrontendLoggerCategory } from \"./FrontendLoggerCategory\";\r\nimport { IModelApp } from \"./IModelApp\";\r\n\r\nimport { PublisherProductInfo, RealityDataSource, SpatialLocationAndExtents } from \"./RealityDataSource\";\r\nimport { OPCFormatInterpreter, ThreeDTileFormatInterpreter } from \"./tile/internal\";\r\n\r\n/** This class provides access to the reality data provider services.\r\n * It encapsulates access to a reality data weiter it be from local access, http or ProjectWise Context Share.\r\n * The key provided at the creation determines if this is ProjectWise Context Share reference.\r\n * If not then it is considered local (ex: C:\\temp\\TileRoot.json) or plain http access (http://someserver.com/data/TileRoot.json)\r\n * There is a one to one relationship between a reality data and the instances of present class.\r\n* @internal\r\n*/\r\nexport class RealityDataSourceContextShareImpl implements RealityDataSource {\r\n public readonly key: RealityDataSourceKey;\r\n /** The URL that supplies the 3d tiles for displaying the reality model. */\r\n private _tilesetUrl: string | undefined;\r\n private _isUrlResolved: boolean = false;\r\n private _rd: RealityData | undefined;\r\n /** For use by all Reality Data. For RD stored on PW Context Share, represents the portion from the root of the Azure Blob Container*/\r\n private _baseUrl: string = \"\";\r\n\r\n /** Construct a new reality data source.\r\n * @param props JSON representation of the reality data source\r\n */\r\n protected constructor(props: RealityDataSourceProps) {\r\n // this implementaiton is specific to ContextShare provider\r\n assert(props.sourceKey.provider === RealityDataProvider.ContextShare);\r\n this.key = props.sourceKey;\r\n this._isUrlResolved = false;\r\n }\r\n\r\n /**\r\n * Create an instance of this class from a source key and iTwin context/\r\n */\r\n public static async createFromKey(sourceKey: RealityDataSourceKey, iTwinId: GuidString | undefined): Promise<RealityDataSource | undefined> {\r\n if (sourceKey.provider !== RealityDataProvider.ContextShare)\r\n return undefined;\r\n const rdSource = new RealityDataSourceContextShareImpl({ sourceKey });\r\n let tilesetUrl: string | undefined;\r\n try {\r\n await rdSource.queryRealityData(iTwinId);\r\n tilesetUrl = await rdSource.getServiceUrl(iTwinId);\r\n } catch (e) {\r\n }\r\n\r\n return (tilesetUrl !== undefined) ? rdSource : undefined;\r\n }\r\n\r\n public get isContextShare(): boolean {\r\n return (this.key.provider === RealityDataProvider.ContextShare);\r\n }\r\n /**\r\n * Returns Reality Data if available\r\n */\r\n public get realityData(): RealityData | undefined {\r\n return this._rd;\r\n }\r\n public get realityDataId(): string | undefined {\r\n const realityDataId = this.key.id;\r\n return realityDataId;\r\n }\r\n /**\r\n * Returns Reality Data type if available\r\n */\r\n public get realityDataType(): string | undefined {\r\n return this._rd?.type;\r\n }\r\n\r\n /**\r\n * Query Reality Data from provider\r\n */\r\n private async queryRealityData(iTwinId: GuidString | undefined) {\r\n if (!this._rd) {\r\n const token = await IModelApp.getAccessToken();\r\n if (token && this.realityDataId) {\r\n if (undefined === IModelApp.realityDataAccess)\r\n throw new Error(\"Missing an implementation of RealityDataAccess on IModelApp, it is required to access reality data. Please provide an implementation to the IModelApp.startup using IModelAppOptions.realityDataAccess.\");\r\n this._rd = await IModelApp.realityDataAccess.getRealityData(token, iTwinId, this.realityDataId);\r\n // A reality data that has not root document set should not be considered.\r\n const rootDocument: string = this._rd.rootDocument ?? \"\";\r\n this.setBaseUrl(rootDocument);\r\n }\r\n }\r\n }\r\n // This is to set the root url from the provided root document path.\r\n // If the root document is stored on PW Context Share then the root document property of the Reality Data is provided,\r\n // otherwise the full path to root document is given.\r\n // The base URL contains the base URL from which tile relative path are constructed.\r\n // The tile's path root will need to be reinserted for child tiles to return a 200\r\n private setBaseUrl(url: string): void {\r\n const urlParts = url.split(\"/\");\r\n urlParts.pop();\r\n if (urlParts.length === 0)\r\n this._baseUrl = \"\";\r\n else\r\n this._baseUrl = `${urlParts.join(\"/\")}/`;\r\n }\r\n\r\n /**\r\n * Gets a tileset's app data json\r\n * @param name name or path of tile\r\n * @returns app data json object\r\n * @internal\r\n */\r\n public async getRealityDataTileJson(accessToken: AccessToken, name: string, realityData: RealityData): Promise<any> {\r\n const url = await realityData.getBlobUrl(accessToken, name);\r\n\r\n const data = await request(url.toString(), {\r\n method: \"GET\",\r\n responseType: \"json\",\r\n });\r\n return data.body;\r\n }\r\n\r\n /**\r\n * This method returns the URL to access the actual 3d tiles from the service provider.\r\n * @returns string containing the URL to reality data.\r\n */\r\n public async getServiceUrl(iTwinId: GuidString | undefined): Promise<string | undefined> {\r\n // If url was not resolved - resolve it\r\n if (!this._isUrlResolved) {\r\n const rdSourceKey = this.key;\r\n // we need to resolve tilesetURl from realityDataId and iTwinId\r\n if (undefined === IModelApp.realityDataAccess)\r\n throw new Error(\"Missing an implementation of RealityDataAccess on IModelApp, it is required to access reality data. Please provide an implementation to the IModelApp.startup using IModelAppOptions.realityDataAccess.\");\r\n try {\r\n const resolvedITwinId = iTwinId ? iTwinId : rdSourceKey.iTwinId;\r\n\r\n this._tilesetUrl = await IModelApp.realityDataAccess.getRealityDataUrl(resolvedITwinId, rdSourceKey.id);\r\n this._isUrlResolved = true;\r\n } catch (e) {\r\n const errMsg = `Error getting URL from ContextShare using realityDataId=${rdSourceKey.id} and iTwinId=${iTwinId}`;\r\n Logger.logError(FrontendLoggerCategory.RealityData, errMsg);\r\n }\r\n }\r\n return this._tilesetUrl;\r\n }\r\n\r\n public async getRootDocument(_iTwinId: GuidString | undefined): Promise<any> {\r\n const token = await IModelApp.getAccessToken();\r\n if (token) {\r\n const realityData = this.realityData;\r\n\r\n if (!realityData)\r\n throw new Error(`Reality Data not defined`);\r\n\r\n if (!realityData.rootDocument)\r\n throw new Error(`Root document not defined for reality data: ${realityData.id}`);\r\n\r\n return this.getRealityDataTileJson(token, realityData.rootDocument, realityData);\r\n }\r\n }\r\n\r\n /**\r\n * Gets tile content\r\n * @param name name or path of tile\r\n * @returns array buffer of tile content\r\n */\r\n public async getRealityDataTileContent(accessToken: AccessToken, name: string, realityData: RealityData): Promise<any> {\r\n const url = await realityData.getBlobUrl(accessToken, name);\r\n const options: RequestOptions = {\r\n method: \"GET\",\r\n responseType: \"arraybuffer\",\r\n };\r\n const data = await request(url.toString(), options);\r\n return data.body;\r\n }\r\n\r\n /**\r\n * Returns the tile content. The path to the tile is relative to the base url of present reality data whatever the type.\r\n */\r\n public async getTileContent(name: string): Promise<any> {\r\n const token = await IModelApp.getAccessToken();\r\n const tileUrl = this._baseUrl + name;\r\n\r\n if (this.realityData) {\r\n return this.getRealityDataTileContent(token, tileUrl, this.realityData);\r\n }\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Returns the tile content in json format. The path to the tile is relative to the base url of present reality data whatever the type.\r\n */\r\n public async getTileJson(name: string): Promise<any> {\r\n const token = await IModelApp.getAccessToken();\r\n const tileUrl = this._baseUrl + name;\r\n\r\n if (this.realityData) {\r\n return this.getRealityDataTileJson(token, tileUrl, this.realityData);\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n public getTileContentType(url: string): \"tile\" | \"tileset\" {\r\n return url.endsWith(\"json\") ? \"tileset\" : \"tile\";\r\n }\r\n\r\n /**\r\n * Gets spatial location and extents of this reality data source\r\n * @returns spatial location and extents\r\n * @internal\r\n */\r\n public async getSpatialLocationAndExtents(): Promise<SpatialLocationAndExtents | undefined> {\r\n let spatialLocation: SpatialLocationAndExtents | undefined;\r\n const fileType = this.realityDataType;\r\n\r\n // Mapping Resource are not currenlty supported\r\n if (fileType === \"OMR\")\r\n return undefined;\r\n\r\n if (this.key.format === RealityDataFormat.ThreeDTile) {\r\n const rootDocument = await this.getRootDocument(undefined);\r\n spatialLocation = ThreeDTileFormatInterpreter.getSpatialLocationAndExtents(rootDocument);\r\n } else if (this.key.format === RealityDataFormat.OPC) {\r\n if (this.realityData === undefined)\r\n return undefined;\r\n const token = await IModelApp.getAccessToken();\r\n const docRootName = this.realityData.rootDocument;\r\n if (!docRootName)\r\n return undefined;\r\n const blobUrl = await this.realityData.getBlobUrl(token, docRootName);\r\n if (!blobUrl)\r\n return undefined;\r\n const blobStringUrl = blobUrl.toString();\r\n const filereader = await OPCFormatInterpreter.getFileReaderFromBlobFileURL(blobStringUrl);\r\n spatialLocation = await OPCFormatInterpreter.getSpatialLocationAndExtents(filereader);\r\n }\r\n return spatialLocation;\r\n }\r\n /**\r\n * Gets information to identify the product and engine that create this reality data\r\n * Will return undefined if cannot be resolved\r\n * @returns information to identify the product and engine that create this reality data\r\n * @alpha\r\n */\r\n public async getPublisherProductInfo(): Promise<PublisherProductInfo | undefined> {\r\n let publisherInfo: PublisherProductInfo | undefined;\r\n if (this.key.format === RealityDataFormat.ThreeDTile) {\r\n const rootDocument = await this.getRootDocument(undefined);\r\n publisherInfo = ThreeDTileFormatInterpreter.getPublisherProductInfo(rootDocument);\r\n }\r\n return publisherInfo;\r\n }\r\n}\r\n\r\n"]}
|
|
@@ -212,11 +212,10 @@ class ViewAttachmentsInfo {
|
|
|
212
212
|
*/
|
|
213
213
|
class ViewAttachments {
|
|
214
214
|
constructor(infos, sheetView) {
|
|
215
|
-
var _a, _b;
|
|
216
215
|
this._attachments = [];
|
|
217
216
|
this.maxDepth = Frustum2d_1.Frustum2d.minimumZDistance;
|
|
218
217
|
for (const info of infos) {
|
|
219
|
-
const drawAsRaster =
|
|
218
|
+
const drawAsRaster = info.jsonProperties?.displayOptions?.drawAsRaster || (info.attachedView.is3d() && info.attachedView.isCameraOn);
|
|
220
219
|
const ctor = drawAsRaster ? RasterAttachment : OrthographicAttachment;
|
|
221
220
|
const attachment = new ctor(info.attachedView, info, sheetView);
|
|
222
221
|
this._attachments.push(attachment);
|
|
@@ -308,8 +307,7 @@ class SheetViewState extends ViewState_1.ViewState2d {
|
|
|
308
307
|
}
|
|
309
308
|
/** Strictly for testing. @internal */
|
|
310
309
|
get attachments() {
|
|
311
|
-
|
|
312
|
-
return (_a = this._attachments) === null || _a === void 0 ? void 0 : _a.attachments;
|
|
310
|
+
return this._attachments?.attachments;
|
|
313
311
|
}
|
|
314
312
|
/** @internal */
|
|
315
313
|
isDrawingView() { return false; }
|
|
@@ -460,7 +458,6 @@ class AttachmentTarget extends MockRender_1.MockRender.OffScreenTarget {
|
|
|
460
458
|
*/
|
|
461
459
|
class OrthographicAttachment {
|
|
462
460
|
constructor(view, props, sheetView) {
|
|
463
|
-
var _a, _b, _c, _d, _e;
|
|
464
461
|
this._viewRect = new ViewRect_1.ViewRect(0, 0, 1, 1);
|
|
465
462
|
this._originalFrustum = new core_common_1.Frustum();
|
|
466
463
|
this.symbologyOverrides = new FeatureSymbology_1.FeatureSymbology.Overrides(view);
|
|
@@ -488,7 +485,7 @@ class OrthographicAttachment {
|
|
|
488
485
|
const scaleX = this._sizeInMeters.x / Math.abs(extents.x);
|
|
489
486
|
const scaleY = skew * this._sizeInMeters.y / Math.abs(extents.y);
|
|
490
487
|
this._scale = { x: 1 / scaleX, y: 1 / scaleY };
|
|
491
|
-
const zBias = Frustum2d_1.Frustum2d.depthFromDisplayPriority(
|
|
488
|
+
const zBias = Frustum2d_1.Frustum2d.depthFromDisplayPriority(props.jsonProperties?.displayPriority ?? 0);
|
|
492
489
|
this.zDepth = 1.01 * (zDepth - zBias); // give a little padding so that geometry right up against far plane doesn't get clipped.
|
|
493
490
|
// View origin is at the *back* of the view. Align *front* of view based on display priority.
|
|
494
491
|
const viewRot = view.getRotation();
|
|
@@ -512,14 +509,14 @@ class OrthographicAttachment {
|
|
|
512
509
|
// However the attached view's frustum is already clipped by intersection with sheet view's frustum, and additional clipping planes
|
|
513
510
|
// introduce additional computation, so possibly not worth it.
|
|
514
511
|
// Transform the view's clip (if any) to sheet space
|
|
515
|
-
let viewClip = view.viewFlags.clipVolume ?
|
|
512
|
+
let viewClip = view.viewFlags.clipVolume ? view.getViewClip()?.clone() : undefined;
|
|
516
513
|
if (viewClip)
|
|
517
514
|
viewClip.transformInPlace(this._toSheet);
|
|
518
515
|
else
|
|
519
516
|
viewClip = core_geometry_1.ClipVector.createEmpty();
|
|
520
517
|
let sheetClip;
|
|
521
|
-
if (undefined !==
|
|
522
|
-
sheetClip = core_geometry_1.ClipVector.fromJSON(
|
|
518
|
+
if (undefined !== props.jsonProperties?.clip)
|
|
519
|
+
sheetClip = core_geometry_1.ClipVector.fromJSON(props.jsonProperties?.clip);
|
|
523
520
|
if (sheetClip && sheetClip.isValid) {
|
|
524
521
|
// Clip to view attachment's clip. NB: clip is in sheet coordinate space.
|
|
525
522
|
for (const clip of sheetClip.clips)
|
|
@@ -559,7 +556,6 @@ class OrthographicAttachment {
|
|
|
559
556
|
trees.disclose(this._viewport);
|
|
560
557
|
}
|
|
561
558
|
addToScene(context) {
|
|
562
|
-
var _a, _b, _c;
|
|
563
559
|
if (context.viewport.freezeScene)
|
|
564
560
|
return;
|
|
565
561
|
if (!context.viewport.view.viewsCategory(this._props.category))
|
|
@@ -649,9 +645,9 @@ class OrthographicAttachment {
|
|
|
649
645
|
const selectedAndReady = tileAdmin.getTilesForUser(this._viewport);
|
|
650
646
|
const requested = tileAdmin.getRequestsForUser(this._viewport);
|
|
651
647
|
tileAdmin.addExternalTilesForUser(context.viewport, {
|
|
652
|
-
requested:
|
|
653
|
-
selected:
|
|
654
|
-
ready:
|
|
648
|
+
requested: requested?.size ?? 0,
|
|
649
|
+
selected: selectedAndReady?.selected.size ?? 0,
|
|
650
|
+
ready: selectedAndReady?.ready.size ?? 0,
|
|
655
651
|
});
|
|
656
652
|
}
|
|
657
653
|
getDebugFeatureTable() {
|
|
@@ -706,14 +702,13 @@ function createRasterAttachmentViewport(_view, _rect, _attachment) {
|
|
|
706
702
|
/** Draws a 3d view with camera enabled into a sheet view by producing an image of the view's contents offscreen. */
|
|
707
703
|
class RasterAttachment {
|
|
708
704
|
constructor(view, props, sheetView) {
|
|
709
|
-
var _a, _b, _c, _d;
|
|
710
705
|
// Render to a 2048x2048 view rect. Scale in Y to preserve aspect ratio.
|
|
711
706
|
const maxSize = 2048;
|
|
712
707
|
const rect = new ViewRect_1.ViewRect(0, 0, maxSize, maxSize);
|
|
713
708
|
const height = maxSize * view.getAspectRatio() * view.getAspectRatioSkew();
|
|
714
709
|
const skew = maxSize / height;
|
|
715
710
|
view.setAspectRatioSkew(skew);
|
|
716
|
-
if (true !==
|
|
711
|
+
if (true !== props.jsonProperties?.displayOptions?.preserveBackground) {
|
|
717
712
|
// Make background color 100% transparent so that Viewport.readImageBuffer() will discard transparent pixels.
|
|
718
713
|
const bgColor = sheetView.displayStyle.backgroundColor.withAlpha(0);
|
|
719
714
|
view.displayStyle.backgroundColor = bgColor;
|
|
@@ -722,11 +717,10 @@ class RasterAttachment {
|
|
|
722
717
|
this._props = props;
|
|
723
718
|
this._placement = core_common_1.Placement2d.fromJSON(props.placement);
|
|
724
719
|
this._transform = this._placement.transform;
|
|
725
|
-
this.zDepth = Frustum2d_1.Frustum2d.depthFromDisplayPriority(
|
|
720
|
+
this.zDepth = Frustum2d_1.Frustum2d.depthFromDisplayPriority(props.jsonProperties?.displayPriority ?? 0);
|
|
726
721
|
}
|
|
727
722
|
dispose() {
|
|
728
|
-
|
|
729
|
-
(_a = this._viewport) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
723
|
+
this._viewport?.dispose();
|
|
730
724
|
}
|
|
731
725
|
get viewAttachmentProps() {
|
|
732
726
|
return this._props;
|
|
@@ -735,8 +729,7 @@ class RasterAttachment {
|
|
|
735
729
|
return this._viewport;
|
|
736
730
|
}
|
|
737
731
|
get areAllTileTreesLoaded() {
|
|
738
|
-
|
|
739
|
-
return (_b = (_a = this._viewport) === null || _a === void 0 ? void 0 : _a.areAllTileTreesLoaded) !== null && _b !== void 0 ? _b : true;
|
|
732
|
+
return this._viewport?.areAllTileTreesLoaded ?? true;
|
|
740
733
|
}
|
|
741
734
|
addToScene(context) {
|
|
742
735
|
// ###TODO: check viewport.wantViewAttachmentClipShapes
|
|
@@ -774,7 +767,6 @@ class RasterAttachment {
|
|
|
774
767
|
context.outputGraphic(this._graphics);
|
|
775
768
|
}
|
|
776
769
|
createGraphics(vp) {
|
|
777
|
-
var _a, _b;
|
|
778
770
|
// Create a texture from the contents of the view.
|
|
779
771
|
const image = vp.readImageBuffer({ upsideDown: true });
|
|
780
772
|
if (undefined === image)
|
|
@@ -830,8 +822,8 @@ class RasterAttachment {
|
|
|
830
822
|
branch.entries.push(graphic);
|
|
831
823
|
// Apply the attachment's clip, if any.
|
|
832
824
|
let clipVolume;
|
|
833
|
-
if (
|
|
834
|
-
const clipVector = core_geometry_1.ClipVector.fromJSON(
|
|
825
|
+
if (this._props.jsonProperties?.clip) {
|
|
826
|
+
const clipVector = core_geometry_1.ClipVector.fromJSON(this._props.jsonProperties?.clip);
|
|
835
827
|
if (clipVector.isValid)
|
|
836
828
|
clipVolume = IModelApp_1.IModelApp.renderSystem.createClipVolume(clipVector);
|
|
837
829
|
}
|