@itwin/core-frontend 3.5.0-dev.8 → 3.6.0-dev.3
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 +75 -1
- package/lib/cjs/AccuSnap.d.ts +7 -1
- package/lib/cjs/AccuSnap.d.ts.map +1 -1
- package/lib/cjs/AccuSnap.js +26 -3
- package/lib/cjs/AccuSnap.js.map +1 -1
- package/lib/cjs/BriefcaseConnection.d.ts +28 -1
- package/lib/cjs/BriefcaseConnection.d.ts.map +1 -1
- package/lib/cjs/BriefcaseConnection.js +29 -8
- package/lib/cjs/BriefcaseConnection.js.map +1 -1
- package/lib/cjs/BriefcaseTxns.js +9 -9
- package/lib/cjs/BriefcaseTxns.js.map +1 -1
- package/lib/cjs/GraphicalEditingScope.d.ts.map +1 -1
- package/lib/cjs/GraphicalEditingScope.js +10 -4
- package/lib/cjs/GraphicalEditingScope.js.map +1 -1
- package/lib/cjs/IModelApp.d.ts +6 -0
- package/lib/cjs/IModelApp.d.ts.map +1 -1
- package/lib/cjs/IModelApp.js +6 -0
- package/lib/cjs/IModelApp.js.map +1 -1
- package/lib/cjs/IModelConnection.d.ts +32 -2
- package/lib/cjs/IModelConnection.d.ts.map +1 -1
- package/lib/cjs/IModelConnection.js +44 -6
- package/lib/cjs/IModelConnection.js.map +1 -1
- package/lib/cjs/IpcApp.d.ts +14 -1
- package/lib/cjs/IpcApp.d.ts.map +1 -1
- package/lib/cjs/IpcApp.js +25 -0
- package/lib/cjs/IpcApp.js.map +1 -1
- package/lib/cjs/MarginPercent.d.ts +27 -2
- package/lib/cjs/MarginPercent.d.ts.map +1 -1
- package/lib/cjs/MarginPercent.js +8 -2
- package/lib/cjs/MarginPercent.js.map +1 -1
- package/lib/cjs/ModelState.d.ts +2 -1
- package/lib/cjs/ModelState.d.ts.map +1 -1
- package/lib/cjs/ModelState.js +5 -3
- package/lib/cjs/ModelState.js.map +1 -1
- package/lib/cjs/NativeApp.d.ts +5 -1
- package/lib/cjs/NativeApp.d.ts.map +1 -1
- package/lib/cjs/NativeApp.js +25 -20
- package/lib/cjs/NativeApp.js.map +1 -1
- package/lib/cjs/NativeAppLogger.js +1 -1
- package/lib/cjs/NativeAppLogger.js.map +1 -1
- package/lib/cjs/RealityDataSource.d.ts +44 -1
- package/lib/cjs/RealityDataSource.d.ts.map +1 -1
- package/lib/cjs/RealityDataSource.js +41 -14
- package/lib/cjs/RealityDataSource.js.map +1 -1
- package/lib/cjs/RealityDataSourceCesiumIonAssetImpl.d.ts +1 -0
- package/lib/cjs/RealityDataSourceCesiumIonAssetImpl.d.ts.map +1 -1
- package/lib/cjs/RealityDataSourceCesiumIonAssetImpl.js +3 -0
- package/lib/cjs/RealityDataSourceCesiumIonAssetImpl.js.map +1 -1
- package/lib/cjs/RealityDataSourceContextShareImpl.d.ts +1 -0
- package/lib/cjs/RealityDataSourceContextShareImpl.d.ts.map +1 -1
- package/lib/cjs/RealityDataSourceContextShareImpl.js +3 -0
- package/lib/cjs/RealityDataSourceContextShareImpl.js.map +1 -1
- package/lib/cjs/RealityDataSourceTilesetUrlImpl.d.ts +1 -0
- package/lib/cjs/RealityDataSourceTilesetUrlImpl.d.ts.map +1 -1
- package/lib/cjs/RealityDataSourceTilesetUrlImpl.js +3 -0
- package/lib/cjs/RealityDataSourceTilesetUrlImpl.js.map +1 -1
- package/lib/cjs/SelectionSet.d.ts.map +1 -1
- package/lib/cjs/SelectionSet.js +3 -1
- package/lib/cjs/SelectionSet.js.map +1 -1
- package/lib/cjs/ViewAnimation.d.ts +10 -2
- package/lib/cjs/ViewAnimation.d.ts.map +1 -1
- package/lib/cjs/ViewAnimation.js.map +1 -1
- package/lib/cjs/ViewCreator2d.js +3 -2
- package/lib/cjs/ViewCreator2d.js.map +1 -1
- package/lib/cjs/ViewPose.d.ts +62 -10
- package/lib/cjs/ViewPose.d.ts.map +1 -1
- package/lib/cjs/ViewPose.js +37 -8
- package/lib/cjs/ViewPose.js.map +1 -1
- package/lib/cjs/ViewState.d.ts +18 -10
- package/lib/cjs/ViewState.d.ts.map +1 -1
- package/lib/cjs/ViewState.js +39 -15
- package/lib/cjs/ViewState.js.map +1 -1
- package/lib/cjs/Viewport.d.ts.map +1 -1
- package/lib/cjs/Viewport.js +7 -2
- package/lib/cjs/Viewport.js.map +1 -1
- package/lib/cjs/extension/ExtensionRuntime.js +11 -0
- package/lib/cjs/extension/ExtensionRuntime.js.map +1 -1
- package/lib/cjs/render/RenderMaterial.d.ts +3 -1
- package/lib/cjs/render/RenderMaterial.d.ts.map +1 -1
- package/lib/cjs/render/RenderMaterial.js.map +1 -1
- package/lib/cjs/render/RenderTarget.d.ts +1 -0
- package/lib/cjs/render/RenderTarget.d.ts.map +1 -1
- package/lib/cjs/render/RenderTarget.js.map +1 -1
- package/lib/cjs/render/primitives/SurfaceParams.d.ts +0 -1
- package/lib/cjs/render/primitives/SurfaceParams.d.ts.map +1 -1
- package/lib/cjs/render/primitives/SurfaceParams.js.map +1 -1
- package/lib/cjs/render/primitives/VertexTable.d.ts.map +1 -1
- package/lib/cjs/render/primitives/VertexTable.js +0 -1
- package/lib/cjs/render/primitives/VertexTable.js.map +1 -1
- package/lib/cjs/render/primitives/VertexTableSplitter.d.ts.map +1 -1
- package/lib/cjs/render/primitives/VertexTableSplitter.js +0 -1
- package/lib/cjs/render/primitives/VertexTableSplitter.js.map +1 -1
- package/lib/cjs/render/primitives/mesh/MeshPrimitives.d.ts +0 -1
- package/lib/cjs/render/primitives/mesh/MeshPrimitives.d.ts.map +1 -1
- package/lib/cjs/render/primitives/mesh/MeshPrimitives.js +0 -1
- package/lib/cjs/render/primitives/mesh/MeshPrimitives.js.map +1 -1
- package/lib/cjs/render/webgl/FeatureOverrides.d.ts +0 -1
- package/lib/cjs/render/webgl/FeatureOverrides.d.ts.map +1 -1
- package/lib/cjs/render/webgl/FeatureOverrides.js +16 -11
- package/lib/cjs/render/webgl/FeatureOverrides.js.map +1 -1
- package/lib/cjs/render/webgl/MeshData.d.ts +1 -1
- package/lib/cjs/render/webgl/MeshData.d.ts.map +1 -1
- package/lib/cjs/render/webgl/MeshData.js +13 -1
- package/lib/cjs/render/webgl/MeshData.js.map +1 -1
- package/lib/cjs/render/webgl/MeshGeometry.d.ts +1 -1
- package/lib/cjs/render/webgl/MeshGeometry.d.ts.map +1 -1
- package/lib/cjs/render/webgl/MeshGeometry.js +1 -1
- package/lib/cjs/render/webgl/MeshGeometry.js.map +1 -1
- package/lib/cjs/render/webgl/RenderFlags.d.ts +14 -4
- package/lib/cjs/render/webgl/RenderFlags.d.ts.map +1 -1
- package/lib/cjs/render/webgl/RenderFlags.js +2 -0
- package/lib/cjs/render/webgl/RenderFlags.js.map +1 -1
- package/lib/cjs/render/webgl/ShaderBuilder.d.ts +2 -1
- package/lib/cjs/render/webgl/ShaderBuilder.d.ts.map +1 -1
- package/lib/cjs/render/webgl/ShaderBuilder.js +6 -1
- package/lib/cjs/render/webgl/ShaderBuilder.js.map +1 -1
- package/lib/cjs/render/webgl/SurfaceGeometry.d.ts +3 -1
- package/lib/cjs/render/webgl/SurfaceGeometry.d.ts.map +1 -1
- package/lib/cjs/render/webgl/SurfaceGeometry.js +17 -6
- package/lib/cjs/render/webgl/SurfaceGeometry.js.map +1 -1
- package/lib/cjs/render/webgl/System.d.ts +1 -1
- package/lib/cjs/render/webgl/System.d.ts.map +1 -1
- package/lib/cjs/render/webgl/System.js +1 -0
- package/lib/cjs/render/webgl/System.js.map +1 -1
- package/lib/cjs/render/webgl/Target.d.ts +1 -0
- package/lib/cjs/render/webgl/Target.d.ts.map +1 -1
- package/lib/cjs/render/webgl/Target.js +1 -0
- package/lib/cjs/render/webgl/Target.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/Animation.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/Animation.js +2 -1
- package/lib/cjs/render/webgl/glsl/Animation.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/Common.d.ts +3 -1
- package/lib/cjs/render/webgl/glsl/Common.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/Common.js +28 -33
- package/lib/cjs/render/webgl/glsl/Common.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/FeatureSymbology.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/FeatureSymbology.js +9 -1
- package/lib/cjs/render/webgl/glsl/FeatureSymbology.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/Lighting.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/Lighting.js +6 -8
- package/lib/cjs/render/webgl/glsl/Lighting.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/PointCloud.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/PointCloud.js +8 -3
- package/lib/cjs/render/webgl/glsl/PointCloud.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/RealityMesh.d.ts +1 -0
- package/lib/cjs/render/webgl/glsl/RealityMesh.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/RealityMesh.js +6 -1
- package/lib/cjs/render/webgl/glsl/RealityMesh.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/SolarShadowMapping.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/SolarShadowMapping.js +1 -4
- package/lib/cjs/render/webgl/glsl/SolarShadowMapping.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/Surface.d.ts +1 -1
- package/lib/cjs/render/webgl/glsl/Surface.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/Surface.js +87 -15
- package/lib/cjs/render/webgl/glsl/Surface.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/Thematic.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/Thematic.js +2 -6
- package/lib/cjs/render/webgl/glsl/Thematic.js.map +1 -1
- package/lib/cjs/tile/GltfReader.d.ts +13 -2
- package/lib/cjs/tile/GltfReader.d.ts.map +1 -1
- package/lib/cjs/tile/GltfReader.js +66 -22
- package/lib/cjs/tile/GltfReader.js.map +1 -1
- package/lib/cjs/tile/IModelTileRequestChannels.js +1 -1
- package/lib/cjs/tile/IModelTileRequestChannels.js.map +1 -1
- package/lib/cjs/tile/ImdlReader.d.ts +5 -0
- package/lib/cjs/tile/ImdlReader.d.ts.map +1 -1
- package/lib/cjs/tile/ImdlReader.js +9 -2
- package/lib/cjs/tile/ImdlReader.js.map +1 -1
- package/lib/cjs/tile/PrimaryTileTree.js +2 -2
- package/lib/cjs/tile/PrimaryTileTree.js.map +1 -1
- package/lib/cjs/tile/RealityModelTileTree.d.ts.map +1 -1
- package/lib/cjs/tile/RealityModelTileTree.js +51 -20
- package/lib/cjs/tile/RealityModelTileTree.js.map +1 -1
- package/lib/cjs/tile/RealityTile.d.ts +2 -2
- package/lib/cjs/tile/RealityTile.d.ts.map +1 -1
- package/lib/cjs/tile/RealityTile.js +11 -4
- package/lib/cjs/tile/RealityTile.js.map +1 -1
- package/lib/cjs/tile/RealityTileLoader.d.ts +1 -0
- package/lib/cjs/tile/RealityTileLoader.d.ts.map +1 -1
- package/lib/cjs/tile/RealityTileLoader.js +13 -0
- package/lib/cjs/tile/RealityTileLoader.js.map +1 -1
- package/lib/cjs/tile/RealityTileTree.js +1 -1
- package/lib/cjs/tile/RealityTileTree.js.map +1 -1
- package/lib/cjs/tile/Tile.d.ts +5 -0
- package/lib/cjs/tile/Tile.d.ts.map +1 -1
- package/lib/cjs/tile/Tile.js +5 -0
- package/lib/cjs/tile/Tile.js.map +1 -1
- package/lib/cjs/tile/TileAdmin.d.ts.map +1 -1
- package/lib/cjs/tile/TileAdmin.js +13 -6
- package/lib/cjs/tile/TileAdmin.js.map +1 -1
- package/lib/cjs/tile/TileDrawArgs.d.ts +5 -1
- package/lib/cjs/tile/TileDrawArgs.d.ts.map +1 -1
- package/lib/cjs/tile/TileDrawArgs.js +2 -0
- 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/TileStorage.d.ts.map +1 -1
- package/lib/cjs/tile/TileStorage.js +12 -6
- package/lib/cjs/tile/TileStorage.js.map +1 -1
- package/lib/cjs/tile/internal.d.ts +1 -0
- package/lib/cjs/tile/internal.d.ts.map +1 -1
- package/lib/cjs/tile/internal.js +1 -0
- package/lib/cjs/tile/internal.js.map +1 -1
- package/lib/cjs/tile/map/ArcGISTileMap.d.ts +5 -2
- package/lib/cjs/tile/map/ArcGISTileMap.d.ts.map +1 -1
- package/lib/cjs/tile/map/ArcGISTileMap.js +17 -2
- package/lib/cjs/tile/map/ArcGISTileMap.js.map +1 -1
- package/lib/cjs/tile/map/ArcGisUtilities.d.ts +51 -5
- package/lib/cjs/tile/map/ArcGisUtilities.d.ts.map +1 -1
- package/lib/cjs/tile/map/ArcGisUtilities.js +120 -48
- package/lib/cjs/tile/map/ArcGisUtilities.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISImageryProvider.d.ts +26 -0
- package/lib/cjs/tile/map/ImageryProviders/ArcGISImageryProvider.d.ts.map +1 -0
- package/lib/cjs/tile/map/ImageryProviders/ArcGISImageryProvider.js +97 -0
- package/lib/cjs/tile/map/ImageryProviders/ArcGISImageryProvider.js.map +1 -0
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts +2 -4
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +11 -96
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/WmsMapLayerImageryProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/WmsMapLayerImageryProvider.js +2 -1
- package/lib/cjs/tile/map/ImageryProviders/WmsMapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryTileTree.d.ts +2 -0
- package/lib/cjs/tile/map/ImageryTileTree.d.ts.map +1 -1
- package/lib/cjs/tile/map/ImageryTileTree.js +6 -4
- package/lib/cjs/tile/map/ImageryTileTree.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerFormatRegistry.d.ts +18 -4
- package/lib/cjs/tile/map/MapLayerFormatRegistry.d.ts.map +1 -1
- package/lib/cjs/tile/map/MapLayerFormatRegistry.js +25 -5
- package/lib/cjs/tile/map/MapLayerFormatRegistry.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerImageryFormats.d.ts +6 -4
- package/lib/cjs/tile/map/MapLayerImageryFormats.d.ts.map +1 -1
- package/lib/cjs/tile/map/MapLayerImageryFormats.js +12 -16
- package/lib/cjs/tile/map/MapLayerImageryFormats.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerImageryProvider.d.ts +26 -5
- package/lib/cjs/tile/map/MapLayerImageryProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/MapLayerImageryProvider.js +69 -48
- 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/WmsCapabilities.d.ts.map +1 -1
- package/lib/cjs/tile/map/WmsCapabilities.js +4 -1
- package/lib/cjs/tile/map/WmsCapabilities.js.map +1 -1
- package/lib/cjs/tools/EditManipulator.d.ts.map +1 -1
- package/lib/cjs/tools/EditManipulator.js +2 -1
- package/lib/cjs/tools/EditManipulator.js.map +1 -1
- package/lib/cjs/tools/Tool.js +1 -1
- package/lib/cjs/tools/Tool.js.map +1 -1
- package/lib/cjs/tools/ToolAdmin.d.ts.map +1 -1
- package/lib/cjs/tools/ToolAdmin.js +6 -4
- package/lib/cjs/tools/ToolAdmin.js.map +1 -1
- package/lib/esm/AccuSnap.d.ts +7 -1
- package/lib/esm/AccuSnap.d.ts.map +1 -1
- package/lib/esm/AccuSnap.js +27 -4
- package/lib/esm/AccuSnap.js.map +1 -1
- package/lib/esm/BriefcaseConnection.d.ts +28 -1
- package/lib/esm/BriefcaseConnection.d.ts.map +1 -1
- package/lib/esm/BriefcaseConnection.js +30 -9
- package/lib/esm/BriefcaseConnection.js.map +1 -1
- package/lib/esm/BriefcaseTxns.js +9 -9
- package/lib/esm/BriefcaseTxns.js.map +1 -1
- package/lib/esm/GraphicalEditingScope.d.ts.map +1 -1
- package/lib/esm/GraphicalEditingScope.js +10 -4
- package/lib/esm/GraphicalEditingScope.js.map +1 -1
- package/lib/esm/IModelApp.d.ts +6 -0
- package/lib/esm/IModelApp.d.ts.map +1 -1
- package/lib/esm/IModelApp.js +6 -0
- package/lib/esm/IModelApp.js.map +1 -1
- package/lib/esm/IModelConnection.d.ts +32 -2
- package/lib/esm/IModelConnection.d.ts.map +1 -1
- package/lib/esm/IModelConnection.js +44 -6
- package/lib/esm/IModelConnection.js.map +1 -1
- package/lib/esm/IpcApp.d.ts +14 -1
- package/lib/esm/IpcApp.d.ts.map +1 -1
- package/lib/esm/IpcApp.js +25 -0
- package/lib/esm/IpcApp.js.map +1 -1
- package/lib/esm/MarginPercent.d.ts +27 -2
- package/lib/esm/MarginPercent.d.ts.map +1 -1
- package/lib/esm/MarginPercent.js +8 -2
- package/lib/esm/MarginPercent.js.map +1 -1
- package/lib/esm/ModelState.d.ts +2 -1
- package/lib/esm/ModelState.d.ts.map +1 -1
- package/lib/esm/ModelState.js +5 -3
- package/lib/esm/ModelState.js.map +1 -1
- package/lib/esm/NativeApp.d.ts +5 -1
- package/lib/esm/NativeApp.d.ts.map +1 -1
- package/lib/esm/NativeApp.js +25 -20
- package/lib/esm/NativeApp.js.map +1 -1
- package/lib/esm/NativeAppLogger.js +1 -1
- package/lib/esm/NativeAppLogger.js.map +1 -1
- package/lib/esm/RealityDataSource.d.ts +44 -1
- package/lib/esm/RealityDataSource.d.ts.map +1 -1
- package/lib/esm/RealityDataSource.js +39 -13
- package/lib/esm/RealityDataSource.js.map +1 -1
- package/lib/esm/RealityDataSourceCesiumIonAssetImpl.d.ts +1 -0
- package/lib/esm/RealityDataSourceCesiumIonAssetImpl.d.ts.map +1 -1
- package/lib/esm/RealityDataSourceCesiumIonAssetImpl.js +3 -0
- package/lib/esm/RealityDataSourceCesiumIonAssetImpl.js.map +1 -1
- package/lib/esm/RealityDataSourceContextShareImpl.d.ts +1 -0
- package/lib/esm/RealityDataSourceContextShareImpl.d.ts.map +1 -1
- package/lib/esm/RealityDataSourceContextShareImpl.js +3 -0
- package/lib/esm/RealityDataSourceContextShareImpl.js.map +1 -1
- package/lib/esm/RealityDataSourceTilesetUrlImpl.d.ts +1 -0
- package/lib/esm/RealityDataSourceTilesetUrlImpl.d.ts.map +1 -1
- package/lib/esm/RealityDataSourceTilesetUrlImpl.js +3 -0
- package/lib/esm/RealityDataSourceTilesetUrlImpl.js.map +1 -1
- package/lib/esm/SelectionSet.d.ts.map +1 -1
- package/lib/esm/SelectionSet.js +3 -1
- package/lib/esm/SelectionSet.js.map +1 -1
- package/lib/esm/ViewAnimation.d.ts +10 -2
- package/lib/esm/ViewAnimation.d.ts.map +1 -1
- package/lib/esm/ViewAnimation.js.map +1 -1
- package/lib/esm/ViewCreator2d.js +3 -2
- package/lib/esm/ViewCreator2d.js.map +1 -1
- package/lib/esm/ViewPose.d.ts +62 -10
- package/lib/esm/ViewPose.d.ts.map +1 -1
- package/lib/esm/ViewPose.js +37 -8
- package/lib/esm/ViewPose.js.map +1 -1
- package/lib/esm/ViewState.d.ts +18 -10
- package/lib/esm/ViewState.d.ts.map +1 -1
- package/lib/esm/ViewState.js +39 -15
- package/lib/esm/ViewState.js.map +1 -1
- package/lib/esm/Viewport.d.ts.map +1 -1
- package/lib/esm/Viewport.js +7 -2
- package/lib/esm/Viewport.js.map +1 -1
- package/lib/esm/extension/ExtensionRuntime.js +12 -1
- package/lib/esm/extension/ExtensionRuntime.js.map +1 -1
- package/lib/esm/render/RenderMaterial.d.ts +3 -1
- package/lib/esm/render/RenderMaterial.d.ts.map +1 -1
- package/lib/esm/render/RenderMaterial.js.map +1 -1
- package/lib/esm/render/RenderTarget.d.ts +1 -0
- package/lib/esm/render/RenderTarget.d.ts.map +1 -1
- package/lib/esm/render/RenderTarget.js.map +1 -1
- package/lib/esm/render/primitives/SurfaceParams.d.ts +0 -1
- package/lib/esm/render/primitives/SurfaceParams.d.ts.map +1 -1
- package/lib/esm/render/primitives/SurfaceParams.js.map +1 -1
- package/lib/esm/render/primitives/VertexTable.d.ts.map +1 -1
- package/lib/esm/render/primitives/VertexTable.js +0 -1
- package/lib/esm/render/primitives/VertexTable.js.map +1 -1
- package/lib/esm/render/primitives/VertexTableSplitter.d.ts.map +1 -1
- package/lib/esm/render/primitives/VertexTableSplitter.js +0 -1
- package/lib/esm/render/primitives/VertexTableSplitter.js.map +1 -1
- package/lib/esm/render/primitives/mesh/MeshPrimitives.d.ts +0 -1
- package/lib/esm/render/primitives/mesh/MeshPrimitives.d.ts.map +1 -1
- package/lib/esm/render/primitives/mesh/MeshPrimitives.js +0 -1
- package/lib/esm/render/primitives/mesh/MeshPrimitives.js.map +1 -1
- package/lib/esm/render/webgl/FeatureOverrides.d.ts +0 -1
- package/lib/esm/render/webgl/FeatureOverrides.d.ts.map +1 -1
- package/lib/esm/render/webgl/FeatureOverrides.js +16 -11
- package/lib/esm/render/webgl/FeatureOverrides.js.map +1 -1
- package/lib/esm/render/webgl/MeshData.d.ts +1 -1
- package/lib/esm/render/webgl/MeshData.d.ts.map +1 -1
- package/lib/esm/render/webgl/MeshData.js +13 -1
- package/lib/esm/render/webgl/MeshData.js.map +1 -1
- package/lib/esm/render/webgl/MeshGeometry.d.ts +1 -1
- package/lib/esm/render/webgl/MeshGeometry.d.ts.map +1 -1
- package/lib/esm/render/webgl/MeshGeometry.js +1 -1
- package/lib/esm/render/webgl/MeshGeometry.js.map +1 -1
- package/lib/esm/render/webgl/RenderFlags.d.ts +14 -4
- package/lib/esm/render/webgl/RenderFlags.d.ts.map +1 -1
- package/lib/esm/render/webgl/RenderFlags.js +2 -0
- package/lib/esm/render/webgl/RenderFlags.js.map +1 -1
- package/lib/esm/render/webgl/ShaderBuilder.d.ts +2 -1
- package/lib/esm/render/webgl/ShaderBuilder.d.ts.map +1 -1
- package/lib/esm/render/webgl/ShaderBuilder.js +6 -1
- package/lib/esm/render/webgl/ShaderBuilder.js.map +1 -1
- package/lib/esm/render/webgl/SurfaceGeometry.d.ts +3 -1
- package/lib/esm/render/webgl/SurfaceGeometry.d.ts.map +1 -1
- package/lib/esm/render/webgl/SurfaceGeometry.js +17 -6
- package/lib/esm/render/webgl/SurfaceGeometry.js.map +1 -1
- package/lib/esm/render/webgl/System.d.ts +1 -1
- package/lib/esm/render/webgl/System.d.ts.map +1 -1
- package/lib/esm/render/webgl/System.js +1 -0
- package/lib/esm/render/webgl/System.js.map +1 -1
- package/lib/esm/render/webgl/Target.d.ts +1 -0
- package/lib/esm/render/webgl/Target.d.ts.map +1 -1
- package/lib/esm/render/webgl/Target.js +1 -0
- package/lib/esm/render/webgl/Target.js.map +1 -1
- package/lib/esm/render/webgl/glsl/Animation.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/Animation.js +2 -1
- package/lib/esm/render/webgl/glsl/Animation.js.map +1 -1
- package/lib/esm/render/webgl/glsl/Common.d.ts +3 -1
- package/lib/esm/render/webgl/glsl/Common.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/Common.js +25 -31
- package/lib/esm/render/webgl/glsl/Common.js.map +1 -1
- package/lib/esm/render/webgl/glsl/FeatureSymbology.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/FeatureSymbology.js +9 -1
- package/lib/esm/render/webgl/glsl/FeatureSymbology.js.map +1 -1
- package/lib/esm/render/webgl/glsl/Lighting.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/Lighting.js +6 -8
- package/lib/esm/render/webgl/glsl/Lighting.js.map +1 -1
- package/lib/esm/render/webgl/glsl/PointCloud.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/PointCloud.js +8 -3
- package/lib/esm/render/webgl/glsl/PointCloud.js.map +1 -1
- package/lib/esm/render/webgl/glsl/RealityMesh.d.ts +1 -0
- package/lib/esm/render/webgl/glsl/RealityMesh.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/RealityMesh.js +5 -0
- package/lib/esm/render/webgl/glsl/RealityMesh.js.map +1 -1
- package/lib/esm/render/webgl/glsl/SolarShadowMapping.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/SolarShadowMapping.js +1 -4
- package/lib/esm/render/webgl/glsl/SolarShadowMapping.js.map +1 -1
- package/lib/esm/render/webgl/glsl/Surface.d.ts +1 -1
- package/lib/esm/render/webgl/glsl/Surface.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/Surface.js +88 -16
- package/lib/esm/render/webgl/glsl/Surface.js.map +1 -1
- package/lib/esm/render/webgl/glsl/Thematic.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/Thematic.js +2 -6
- package/lib/esm/render/webgl/glsl/Thematic.js.map +1 -1
- package/lib/esm/tile/GltfReader.d.ts +13 -2
- package/lib/esm/tile/GltfReader.d.ts.map +1 -1
- package/lib/esm/tile/GltfReader.js +66 -22
- package/lib/esm/tile/GltfReader.js.map +1 -1
- package/lib/esm/tile/IModelTileRequestChannels.js +1 -1
- package/lib/esm/tile/IModelTileRequestChannels.js.map +1 -1
- package/lib/esm/tile/ImdlReader.d.ts +5 -0
- package/lib/esm/tile/ImdlReader.d.ts.map +1 -1
- package/lib/esm/tile/ImdlReader.js +9 -2
- package/lib/esm/tile/ImdlReader.js.map +1 -1
- package/lib/esm/tile/PrimaryTileTree.js +2 -2
- package/lib/esm/tile/PrimaryTileTree.js.map +1 -1
- package/lib/esm/tile/RealityModelTileTree.d.ts.map +1 -1
- package/lib/esm/tile/RealityModelTileTree.js +51 -20
- package/lib/esm/tile/RealityModelTileTree.js.map +1 -1
- package/lib/esm/tile/RealityTile.d.ts +2 -2
- package/lib/esm/tile/RealityTile.d.ts.map +1 -1
- package/lib/esm/tile/RealityTile.js +11 -4
- package/lib/esm/tile/RealityTile.js.map +1 -1
- package/lib/esm/tile/RealityTileLoader.d.ts +1 -0
- package/lib/esm/tile/RealityTileLoader.d.ts.map +1 -1
- package/lib/esm/tile/RealityTileLoader.js +14 -1
- package/lib/esm/tile/RealityTileLoader.js.map +1 -1
- package/lib/esm/tile/RealityTileTree.js +1 -1
- package/lib/esm/tile/RealityTileTree.js.map +1 -1
- package/lib/esm/tile/Tile.d.ts +5 -0
- package/lib/esm/tile/Tile.d.ts.map +1 -1
- package/lib/esm/tile/Tile.js +5 -0
- package/lib/esm/tile/Tile.js.map +1 -1
- package/lib/esm/tile/TileAdmin.d.ts.map +1 -1
- package/lib/esm/tile/TileAdmin.js +13 -6
- package/lib/esm/tile/TileAdmin.js.map +1 -1
- package/lib/esm/tile/TileDrawArgs.d.ts +5 -1
- package/lib/esm/tile/TileDrawArgs.d.ts.map +1 -1
- package/lib/esm/tile/TileDrawArgs.js +2 -0
- 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/TileStorage.d.ts.map +1 -1
- package/lib/esm/tile/TileStorage.js +12 -6
- package/lib/esm/tile/TileStorage.js.map +1 -1
- package/lib/esm/tile/internal.d.ts +1 -0
- package/lib/esm/tile/internal.d.ts.map +1 -1
- package/lib/esm/tile/internal.js +1 -0
- package/lib/esm/tile/internal.js.map +1 -1
- package/lib/esm/tile/map/ArcGISTileMap.d.ts +5 -2
- package/lib/esm/tile/map/ArcGISTileMap.d.ts.map +1 -1
- package/lib/esm/tile/map/ArcGISTileMap.js +18 -3
- package/lib/esm/tile/map/ArcGISTileMap.js.map +1 -1
- package/lib/esm/tile/map/ArcGisUtilities.d.ts +51 -5
- package/lib/esm/tile/map/ArcGisUtilities.d.ts.map +1 -1
- package/lib/esm/tile/map/ArcGisUtilities.js +121 -49
- package/lib/esm/tile/map/ArcGisUtilities.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISImageryProvider.d.ts +26 -0
- package/lib/esm/tile/map/ImageryProviders/ArcGISImageryProvider.d.ts.map +1 -0
- package/lib/esm/tile/map/ImageryProviders/ArcGISImageryProvider.js +93 -0
- package/lib/esm/tile/map/ImageryProviders/ArcGISImageryProvider.js.map +1 -0
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts +2 -4
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +10 -95
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/WmsMapLayerImageryProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/WmsMapLayerImageryProvider.js +2 -1
- package/lib/esm/tile/map/ImageryProviders/WmsMapLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryTileTree.d.ts +2 -0
- package/lib/esm/tile/map/ImageryTileTree.d.ts.map +1 -1
- package/lib/esm/tile/map/ImageryTileTree.js +6 -4
- package/lib/esm/tile/map/ImageryTileTree.js.map +1 -1
- package/lib/esm/tile/map/MapLayerFormatRegistry.d.ts +18 -4
- package/lib/esm/tile/map/MapLayerFormatRegistry.d.ts.map +1 -1
- package/lib/esm/tile/map/MapLayerFormatRegistry.js +26 -6
- package/lib/esm/tile/map/MapLayerFormatRegistry.js.map +1 -1
- package/lib/esm/tile/map/MapLayerImageryFormats.d.ts +6 -4
- package/lib/esm/tile/map/MapLayerImageryFormats.d.ts.map +1 -1
- package/lib/esm/tile/map/MapLayerImageryFormats.js +12 -16
- package/lib/esm/tile/map/MapLayerImageryFormats.js.map +1 -1
- package/lib/esm/tile/map/MapLayerImageryProvider.d.ts +26 -5
- package/lib/esm/tile/map/MapLayerImageryProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/MapLayerImageryProvider.js +70 -49
- 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/WmsCapabilities.d.ts.map +1 -1
- package/lib/esm/tile/map/WmsCapabilities.js +4 -1
- package/lib/esm/tile/map/WmsCapabilities.js.map +1 -1
- package/lib/esm/tools/EditManipulator.d.ts.map +1 -1
- package/lib/esm/tools/EditManipulator.js +2 -1
- package/lib/esm/tools/EditManipulator.js.map +1 -1
- package/lib/esm/tools/Tool.js +1 -1
- package/lib/esm/tools/Tool.js.map +1 -1
- package/lib/esm/tools/ToolAdmin.d.ts.map +1 -1
- package/lib/esm/tools/ToolAdmin.js +6 -4
- package/lib/esm/tools/ToolAdmin.js.map +1 -1
- package/package.json +23 -21
- package/lib/cjs/tile/object-storage-azure.js +0 -5
- package/lib/esm/tile/object-storage-azure.js +0 -5
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module Views
|
|
3
3
|
*/
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
4
|
+
/** Specifies margins to apply around a view volume for methods like [[ViewState.lookAtVolume]] and [[Viewport.zoomToElements]], expanding the
|
|
5
|
+
* viewed volume by a percentage of its original size to add extra space around one or more edges.
|
|
6
|
+
* The margin values represent a fraction of the view volume's width (for [[left]] and [[right]]) or height (for [[top]] and [[bottom]]).
|
|
7
|
+
* The values are clamped to the range 0 through 0.25.
|
|
8
|
+
* @note Margins are only applied in 2d views, or 3d views in which the camera has been turned off.
|
|
9
|
+
* @note The way in which the extra space is computed is somewhat unintuitive and may lead to surprising results.
|
|
10
|
+
* @see [[MarginOptions.marginPercent]].
|
|
11
|
+
* @see [[PaddingPercent]] for a more predictable way of adjusting the viewed volume.
|
|
6
12
|
* @public
|
|
7
13
|
* @extensions
|
|
8
14
|
*/
|
|
@@ -13,4 +19,23 @@ export declare class MarginPercent {
|
|
|
13
19
|
bottom: number;
|
|
14
20
|
constructor(left: number, top: number, right: number, bottom: number);
|
|
15
21
|
}
|
|
22
|
+
/** Specifies padding to apply around a view volume for methods like [[ViewState.lookAtVolume]] and [[Viewport.zoomToElements]], expanding or
|
|
23
|
+
* contracting the viewed volume by a fraction of its original size.
|
|
24
|
+
* The margin values represent a fraction of the view volume's width (for [[left]] and [[right]]) or height (for [[top]] and [[bottom]]).
|
|
25
|
+
* Positive values add additional volume along the specified edge, negative values subtract it, and zero values have no effect.
|
|
26
|
+
* All properties default to zero if `undefined`.
|
|
27
|
+
* For example, if the original volume has a width of 100 and the padding is specified as `{ left: 1 }`, the width will be doubled to 200, with 100 padding on the left side of the view.
|
|
28
|
+
* If a padding of 0.25 is specified for each of [[left]], [[right]], [[top]], and [[bottom]], then the final volume will be inset such that 25% of the original volume falls outside
|
|
29
|
+
* of the view on each side.
|
|
30
|
+
* @note Margins are only applied in 2d views, or 3d views in which the camera has been turned off.
|
|
31
|
+
* @see [[MarginOptions.paddingPercent]].
|
|
32
|
+
* @public
|
|
33
|
+
* @extensions
|
|
34
|
+
*/
|
|
35
|
+
export interface PaddingPercent {
|
|
36
|
+
left?: number;
|
|
37
|
+
right?: number;
|
|
38
|
+
top?: number;
|
|
39
|
+
bottom?: number;
|
|
40
|
+
}
|
|
16
41
|
//# sourceMappingURL=MarginPercent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarginPercent.d.ts","sourceRoot":"","sources":["../../src/MarginPercent.ts"],"names":[],"mappings":"AAIA;;GAEG;
|
|
1
|
+
{"version":3,"file":"MarginPercent.d.ts","sourceRoot":"","sources":["../../src/MarginPercent.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH;;;;;;;;;;GAUG;AACH,qBAAa,aAAa;IACL,IAAI,EAAE,MAAM;IAAS,GAAG,EAAE,MAAM;IAAS,KAAK,EAAE,MAAM;IAAS,MAAM,EAAE,MAAM;gBAA7E,IAAI,EAAE,MAAM,EAAS,GAAG,EAAE,MAAM,EAAS,KAAK,EAAE,MAAM,EAAS,MAAM,EAAE,MAAM;CAOjG;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
package/lib/cjs/MarginPercent.js
CHANGED
|
@@ -9,8 +9,14 @@
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.MarginPercent = void 0;
|
|
11
11
|
const core_geometry_1 = require("@itwin/core-geometry");
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
12
|
+
/** Specifies margins to apply around a view volume for methods like [[ViewState.lookAtVolume]] and [[Viewport.zoomToElements]], expanding the
|
|
13
|
+
* viewed volume by a percentage of its original size to add extra space around one or more edges.
|
|
14
|
+
* The margin values represent a fraction of the view volume's width (for [[left]] and [[right]]) or height (for [[top]] and [[bottom]]).
|
|
15
|
+
* The values are clamped to the range 0 through 0.25.
|
|
16
|
+
* @note Margins are only applied in 2d views, or 3d views in which the camera has been turned off.
|
|
17
|
+
* @note The way in which the extra space is computed is somewhat unintuitive and may lead to surprising results.
|
|
18
|
+
* @see [[MarginOptions.marginPercent]].
|
|
19
|
+
* @see [[PaddingPercent]] for a more predictable way of adjusting the viewed volume.
|
|
14
20
|
* @public
|
|
15
21
|
* @extensions
|
|
16
22
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarginPercent.js","sourceRoot":"","sources":["../../src/MarginPercent.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,wDAAgD;
|
|
1
|
+
{"version":3,"file":"MarginPercent.js","sourceRoot":"","sources":["../../src/MarginPercent.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,wDAAgD;AAEhD;;;;;;;;;;GAUG;AACH,MAAa,aAAa;IACxB,YAAmB,IAAY,EAAS,GAAW,EAAS,KAAa,EAAS,MAAc;QAA7E,SAAI,GAAJ,IAAI,CAAQ;QAAS,QAAG,GAAH,GAAG,CAAQ;QAAS,UAAK,GAAL,KAAK,CAAQ;QAAS,WAAM,GAAN,MAAM,CAAQ;QAC9F,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,wBAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;QACpE,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;QAC9B,IAAI,CAAC,GAAG,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;CACF;AARD,sCAQC","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 { Geometry } from \"@itwin/core-geometry\";\r\n\r\n/** Specifies margins to apply around a view volume for methods like [[ViewState.lookAtVolume]] and [[Viewport.zoomToElements]], expanding the\r\n * viewed volume by a percentage of its original size to add extra space around one or more edges.\r\n * The margin values represent a fraction of the view volume's width (for [[left]] and [[right]]) or height (for [[top]] and [[bottom]]).\r\n * The values are clamped to the range 0 through 0.25.\r\n * @note Margins are only applied in 2d views, or 3d views in which the camera has been turned off.\r\n * @note The way in which the extra space is computed is somewhat unintuitive and may lead to surprising results.\r\n * @see [[MarginOptions.marginPercent]].\r\n * @see [[PaddingPercent]] for a more predictable way of adjusting the viewed volume.\r\n * @public\r\n * @extensions\r\n */\r\nexport class MarginPercent {\r\n constructor(public left: number, public top: number, public right: number, public bottom: number) {\r\n const limitMargin = (val: number) => Geometry.clamp(val, 0.0, 0.25);\r\n this.left = limitMargin(left);\r\n this.top = limitMargin(top);\r\n this.right = limitMargin(right);\r\n this.bottom = limitMargin(bottom);\r\n }\r\n}\r\n\r\n/** Specifies padding to apply around a view volume for methods like [[ViewState.lookAtVolume]] and [[Viewport.zoomToElements]], expanding or\r\n * contracting the viewed volume by a fraction of its original size.\r\n * The margin values represent a fraction of the view volume's width (for [[left]] and [[right]]) or height (for [[top]] and [[bottom]]).\r\n * Positive values add additional volume along the specified edge, negative values subtract it, and zero values have no effect.\r\n * All properties default to zero if `undefined`.\r\n * For example, if the original volume has a width of 100 and the padding is specified as `{ left: 1 }`, the width will be doubled to 200, with 100 padding on the left side of the view.\r\n * If a padding of 0.25 is specified for each of [[left]], [[right]], [[top]], and [[bottom]], then the final volume will be inset such that 25% of the original volume falls outside\r\n * of the view on each side.\r\n * @note Margins are only applied in 2d views, or 3d views in which the camera has been turned off.\r\n * @see [[MarginOptions.paddingPercent]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface PaddingPercent {\r\n left?: number;\r\n right?: number;\r\n top?: number;\r\n bottom?: number;\r\n}\r\n"]}
|
package/lib/cjs/ModelState.d.ts
CHANGED
|
@@ -63,7 +63,8 @@ export declare abstract class GeometricModelState extends ModelState implements
|
|
|
63
63
|
/** @internal */
|
|
64
64
|
get treeModelId(): Id64String;
|
|
65
65
|
/** Query for the union of the ranges of all the elements in this GeometricModel.
|
|
66
|
-
* @
|
|
66
|
+
* @note This value is cached after the first time it is called.
|
|
67
|
+
* @public
|
|
67
68
|
*/
|
|
68
69
|
queryModelRange(): Promise<Range3d>;
|
|
69
70
|
/** @internal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelState.d.ts","sourceRoot":"","sources":["../../src/ModelState.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OA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S,WAA2B;CAChE;AAED;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,qBAAqB;IAC1D,wHAAwH;IACxH,SAAgB,WAAW,CAAC,EAAE,kBAAkB,CAAC;IAEjD,gBAAgB;IAChB,WAA2B,SAAS,WAA6B;IACjE,gBAAgB;IAChB,IAAoB,cAAc,IAAI,iBAAiB,CAAiB;gBAErD,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,gBAAgB,EAAE,KAAK,CAAC,EAAE,iBAAiB;IAKzF,6EAA6E;IAC7E,IAAW,cAAc,IAAI,OAAO,CAEnC;CACF;AAED;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,iBAAiB;IACvD,gBAAgB;IAChB,WAA2B,SAAS,WAA8B;CACnE;AAED;;;GAGG;AACH,qBAAa,yBAA0B,SAAQ,iBAAiB;IAC9D,gBAAgB;IAChB,WAA2B,SAAS,WAAqC;CAC1E;AAED;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,qBAAqB;IAC1D,gBAAgB;IAChB,WAA2B,SAAS,WAA6B;CAClE;AAED;;;GAGG;AACH,qBAAa,wBAAyB,SAAQ,iBAAiB;IAC7D,gBAAgB;IAChB,WAA2B,SAAS,WAAoC;CACzE"}
|
package/lib/cjs/ModelState.js
CHANGED
|
@@ -79,12 +79,14 @@ class GeometricModelState extends ModelState {
|
|
|
79
79
|
/** @internal */
|
|
80
80
|
get treeModelId() { return this.id; }
|
|
81
81
|
/** Query for the union of the ranges of all the elements in this GeometricModel.
|
|
82
|
-
* @
|
|
82
|
+
* @note This value is cached after the first time it is called.
|
|
83
|
+
* @public
|
|
83
84
|
*/
|
|
84
85
|
async queryModelRange() {
|
|
86
|
+
var _a;
|
|
85
87
|
if (undefined === this._modelRange) {
|
|
86
|
-
const ranges = await this.iModel.models.
|
|
87
|
-
this._modelRange = core_geometry_1.Range3d.fromJSON(ranges[0]);
|
|
88
|
+
const ranges = await this.iModel.models.queryExtents(this.id);
|
|
89
|
+
this._modelRange = core_geometry_1.Range3d.fromJSON((_a = ranges[0]) === null || _a === void 0 ? void 0 : _a.extents);
|
|
88
90
|
}
|
|
89
91
|
return this._modelRange;
|
|
90
92
|
}
|
|
@@ -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,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,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,CAAC,cAAc;YACrB,IAAI,CAAC,WAAW,GAAG,IAAI,gCAAkB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACnE,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 * @internal\r\n */\r\n public async queryModelRange(): Promise<Range3d> {\r\n if (undefined === this._modelRange) {\r\n const ranges = await this.iModel.models.queryModelRanges(this.id);\r\n this._modelRange = Range3d.fromJSON(ranges[0]);\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,CA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BAAgB;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.d.ts
CHANGED
|
@@ -39,7 +39,11 @@ export interface NativeAppOpts extends IpcAppOptions {
|
|
|
39
39
|
* @public
|
|
40
40
|
*/
|
|
41
41
|
export declare class NativeApp {
|
|
42
|
+
private static _removeAppNotify?;
|
|
43
|
+
/** @deprecated use nativeAppIpc */
|
|
42
44
|
static callNativeHost<T extends AsyncMethodsOf<NativeAppFunctions>>(methodName: T, ...args: Parameters<NativeAppFunctions[T]>): Promise<PromiseReturnType<NativeAppFunctions[T]>>;
|
|
45
|
+
/** A Proxy to call one of the [NativeAppFunctions]($common) functions via IPC. */
|
|
46
|
+
static nativeAppIpc: import("@itwin/core-bentley").PickAsyncMethods<NativeAppFunctions>;
|
|
43
47
|
private static _storages;
|
|
44
48
|
private static _onOnline;
|
|
45
49
|
private static _onOffline;
|
|
@@ -68,7 +72,7 @@ export declare class NativeApp {
|
|
|
68
72
|
* @param fileName the briefcase fileName
|
|
69
73
|
*/
|
|
70
74
|
static deleteBriefcase(fileName: string): Promise<void>;
|
|
71
|
-
/**
|
|
75
|
+
/** Get a list of all briefcase files held in the local briefcase cache directory */
|
|
72
76
|
static getCachedBriefcases(iModelId?: GuidString): Promise<LocalBriefcaseProps[]>;
|
|
73
77
|
/**
|
|
74
78
|
* Open a [[Storage]]. Creates a new Storage with that name if it does not already exist.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeApp.d.ts","sourceRoot":"","sources":["../../src/NativeApp.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,UAAU,EAAU,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACrG,OAAO,EACL,mBAAmB,EAAE,cAAc,EAAE,aAAa,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,mBAAmB,EACpG,kBAAkB,
|
|
1
|
+
{"version":3,"file":"NativeApp.d.ts","sourceRoot":"","sources":["../../src/NativeApp.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,UAAU,EAAU,iBAA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AAM;gBAAV,EAAE,EAAE,MAAM;IAEtC,sEAAsE;IACzD,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,YAAY,GAAG,MAAM,GAAG,SAAS,CAAC;IAIpH,8BAA8B;IACjB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAIxD,0BAA0B;IACb,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrE;;;OAGG;IACU,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAIzC,iCAAiC;IACpB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAInD,sCAAsC;IACzB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;CAGxC"}
|
package/lib/cjs/NativeApp.js
CHANGED
|
@@ -29,12 +29,13 @@ class NativeAppNotifyHandler extends IpcApp_1.NotificationHandler {
|
|
|
29
29
|
* @public
|
|
30
30
|
*/
|
|
31
31
|
class NativeApp {
|
|
32
|
+
/** @deprecated use nativeAppIpc */
|
|
32
33
|
static async callNativeHost(methodName, ...args) {
|
|
33
34
|
return IpcApp_1.IpcApp.callIpcChannel(core_common_1.nativeAppChannel, methodName, ...args);
|
|
34
35
|
}
|
|
35
36
|
static async setConnectivity(by, status) {
|
|
36
37
|
Request_1.RequestGlobalOptions.online = (status === core_common_1.InternetConnectivityStatus.Online);
|
|
37
|
-
await this.
|
|
38
|
+
await this.nativeAppIpc.overrideInternetConnectivity(by, status);
|
|
38
39
|
}
|
|
39
40
|
static hookBrowserConnectivityEvents() {
|
|
40
41
|
if (typeof window === "object" && window.ononline && window.onoffline) {
|
|
@@ -50,11 +51,11 @@ class NativeApp {
|
|
|
50
51
|
}
|
|
51
52
|
/** determine whether the app currently has internet connectivity, if known */
|
|
52
53
|
static async checkInternetConnectivity() {
|
|
53
|
-
return this.
|
|
54
|
+
return this.nativeAppIpc.checkInternetConnectivity();
|
|
54
55
|
}
|
|
55
56
|
/** @internal */
|
|
56
57
|
static async overrideInternetConnectivity(status) {
|
|
57
|
-
return this.
|
|
58
|
+
return this.nativeAppIpc.overrideInternetConnectivity(core_common_1.OverriddenBy.User, status);
|
|
58
59
|
}
|
|
59
60
|
static get isValid() { return this._isValid; }
|
|
60
61
|
/**
|
|
@@ -66,7 +67,7 @@ class NativeApp {
|
|
|
66
67
|
if (this._isValid)
|
|
67
68
|
return;
|
|
68
69
|
this._isValid = true;
|
|
69
|
-
NativeAppNotifyHandler.register(); // receives notifications from backend
|
|
70
|
+
this._removeAppNotify = NativeAppNotifyHandler.register(); // receives notifications from backend
|
|
70
71
|
NativeApp.hookBrowserConnectivityEvents();
|
|
71
72
|
// initialize current online state.
|
|
72
73
|
if (window.navigator.onLine) {
|
|
@@ -76,6 +77,8 @@ class NativeApp {
|
|
|
76
77
|
}
|
|
77
78
|
/** @internal */
|
|
78
79
|
static async shutdown() {
|
|
80
|
+
var _b;
|
|
81
|
+
(_b = this._removeAppNotify) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
79
82
|
NativeApp.unhookBrowserConnectivityEvents();
|
|
80
83
|
await NativeAppLogger_1.NativeAppLogger.flush();
|
|
81
84
|
await IpcApp_1.IpcApp.shutdown();
|
|
@@ -90,19 +93,19 @@ class NativeApp {
|
|
|
90
93
|
});
|
|
91
94
|
}
|
|
92
95
|
const briefcaseId = (undefined !== downloadOptions.briefcaseId) ? downloadOptions.briefcaseId :
|
|
93
|
-
(downloadOptions.syncMode === core_common_1.SyncMode.PullOnly ? 0 : await this.
|
|
96
|
+
(downloadOptions.syncMode === core_common_1.SyncMode.PullOnly ? 0 : await this.nativeAppIpc.acquireNewBriefcaseId(iModelId));
|
|
94
97
|
const fileName = (_b = downloadOptions.fileName) !== null && _b !== void 0 ? _b : await this.getBriefcaseFileName({ briefcaseId, iModelId });
|
|
95
98
|
const requestProps = { iModelId, briefcaseId, iTwinId, asOf: asOf.toJSON(), fileName };
|
|
96
99
|
const doDownload = async () => {
|
|
97
100
|
try {
|
|
98
|
-
await this.
|
|
101
|
+
await this.nativeAppIpc.downloadBriefcase(requestProps, progress !== undefined, downloadOptions.progressInterval);
|
|
99
102
|
}
|
|
100
103
|
finally {
|
|
101
104
|
stopProgressEvents();
|
|
102
105
|
}
|
|
103
106
|
};
|
|
104
107
|
const requestCancel = async () => {
|
|
105
|
-
const status = await this.
|
|
108
|
+
const status = await this.nativeAppIpc.requestCancelDownloadBriefcase(fileName);
|
|
106
109
|
if (status)
|
|
107
110
|
stopProgressEvents();
|
|
108
111
|
return status;
|
|
@@ -111,17 +114,17 @@ class NativeApp {
|
|
|
111
114
|
}
|
|
112
115
|
/** Get the full path filename for a briefcase within the briefcase cache */
|
|
113
116
|
static async getBriefcaseFileName(props) {
|
|
114
|
-
return this.
|
|
117
|
+
return this.nativeAppIpc.getBriefcaseFileName(props);
|
|
115
118
|
}
|
|
116
119
|
/** Delete an existing briefcase
|
|
117
120
|
* @param fileName the briefcase fileName
|
|
118
121
|
*/
|
|
119
122
|
static async deleteBriefcase(fileName) {
|
|
120
|
-
await this.
|
|
123
|
+
await this.nativeAppIpc.deleteBriefcaseFiles(fileName);
|
|
121
124
|
}
|
|
122
|
-
/**
|
|
125
|
+
/** Get a list of all briefcase files held in the local briefcase cache directory */
|
|
123
126
|
static async getCachedBriefcases(iModelId) {
|
|
124
|
-
return this.
|
|
127
|
+
return this.nativeAppIpc.getCachedBriefcases(iModelId);
|
|
125
128
|
}
|
|
126
129
|
/**
|
|
127
130
|
* Open a [[Storage]]. Creates a new Storage with that name if it does not already exist.
|
|
@@ -131,7 +134,7 @@ class NativeApp {
|
|
|
131
134
|
static async openStorage(name) {
|
|
132
135
|
if (this._storages.has(name))
|
|
133
136
|
return this._storages.get(name);
|
|
134
|
-
const storage = new Storage(await this.
|
|
137
|
+
const storage = new Storage(await this.nativeAppIpc.storageMgrOpen(name));
|
|
135
138
|
this._storages.set(storage.id, storage);
|
|
136
139
|
return storage;
|
|
137
140
|
}
|
|
@@ -143,16 +146,18 @@ class NativeApp {
|
|
|
143
146
|
static async closeStorage(storage, deleteStorage = false) {
|
|
144
147
|
if (!this._storages.has(storage.id))
|
|
145
148
|
throw new Error(`Storage [Id=${storage.id}] not open`);
|
|
146
|
-
await this.
|
|
149
|
+
await this.nativeAppIpc.storageMgrClose(storage.id, deleteStorage);
|
|
147
150
|
this._storages.delete(storage.id);
|
|
148
151
|
}
|
|
149
152
|
/** Get the list of existing Storages on the local disk. */
|
|
150
153
|
static async getStorageNames() {
|
|
151
|
-
return NativeApp.
|
|
154
|
+
return NativeApp.nativeAppIpc.storageMgrNames();
|
|
152
155
|
}
|
|
153
156
|
}
|
|
154
157
|
exports.NativeApp = NativeApp;
|
|
155
158
|
_a = NativeApp;
|
|
159
|
+
/** A Proxy to call one of the [NativeAppFunctions]($common) functions via IPC. */
|
|
160
|
+
NativeApp.nativeAppIpc = IpcApp_1.IpcApp.makeIpcProxy(core_common_1.nativeAppChannel);
|
|
156
161
|
NativeApp._storages = new Map();
|
|
157
162
|
NativeApp._onOnline = async () => {
|
|
158
163
|
await NativeApp.setConnectivity(core_common_1.OverriddenBy.Browser, core_common_1.InternetConnectivityStatus.Online);
|
|
@@ -174,30 +179,30 @@ class Storage {
|
|
|
174
179
|
}
|
|
175
180
|
/** get the type of a value for a key, or undefined if not present. */
|
|
176
181
|
async getValueType(key) {
|
|
177
|
-
return NativeApp.
|
|
182
|
+
return NativeApp.nativeAppIpc.storageGetValueType(this.id, key);
|
|
178
183
|
}
|
|
179
184
|
/** Get the value for a key */
|
|
180
185
|
async getData(key) {
|
|
181
|
-
return NativeApp.
|
|
186
|
+
return NativeApp.nativeAppIpc.storageGet(this.id, key);
|
|
182
187
|
}
|
|
183
188
|
/** Set value for a key */
|
|
184
189
|
async setData(key, value) {
|
|
185
|
-
return NativeApp.
|
|
190
|
+
return NativeApp.nativeAppIpc.storageSet(this.id, key, value);
|
|
186
191
|
}
|
|
187
192
|
/**
|
|
188
193
|
* Return an array of all keys in this Storage.
|
|
189
194
|
* @note This can be expensive, depending on the number of keys present.
|
|
190
195
|
*/
|
|
191
196
|
async getKeys() {
|
|
192
|
-
return NativeApp.
|
|
197
|
+
return NativeApp.nativeAppIpc.storageKeys(this.id);
|
|
193
198
|
}
|
|
194
199
|
/** Remove a key and its data. */
|
|
195
200
|
async removeData(key) {
|
|
196
|
-
return NativeApp.
|
|
201
|
+
return NativeApp.nativeAppIpc.storageRemove(this.id, key);
|
|
197
202
|
}
|
|
198
203
|
/** Remove all keys and their data. */
|
|
199
204
|
async removeAll() {
|
|
200
|
-
return NativeApp.
|
|
205
|
+
return NativeApp.nativeAppIpc.storageRemoveAll(this.id);
|
|
201
206
|
}
|
|
202
207
|
}
|
|
203
208
|
exports.Storage = Storage;
|
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;AAqBpD,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;IACb,MAAM,CAAC,KAAK,CAAC,cAAc,CAA+C,UAAa,EAAE,GAAG,IAAuC;QACxI,OAAO,eAAM,CAAC,cAA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AAC,aAAa,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED,iCAAiC;IAC1B,KAAK,CAAC,UAAU,CAAC,GAAW;QACjC,OAAO,SAAS,CAAC,cAAc,CAAC,eAAe,EAAE,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;IACjE,CAAC;IAED,sCAAsC;IAC/B,KAAK,CAAC,SAAS;QACpB,OAAO,SAAS,CAAC,cAAc,CAAC,kBAAkB,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAC/D,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 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\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 /** 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 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\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.callNativeHost(\"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.callNativeHost(\"checkInternetConnectivity\");\r\n }\r\n /** @internal */\r\n public static async overrideInternetConnectivity(status: InternetConnectivityStatus): Promise<void> {\r\n return this.callNativeHost(\"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 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 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 = IModelVersion.latest(), progress?: ProgressCallback): Promise<BriefcaseDownloader> {\r\n\r\n let stopProgressEvents = () => { };\r\n if (progress !== undefined) {\r\n stopProgressEvents = IpcApp.addListener(`nativeApp.progress-${iModelId}`, (_evt: Event, data: { loaded: number, total: number }) => {\r\n progress(data);\r\n });\r\n }\r\n\r\n const briefcaseId = (undefined !== downloadOptions.briefcaseId) ? downloadOptions.briefcaseId :\r\n (downloadOptions.syncMode === SyncMode.PullOnly ? 0 : await this.callNativeHost(\"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.callNativeHost(\"downloadBriefcase\", requestProps, progress !== undefined, 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.callNativeHost(\"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.callNativeHost(\"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.callNativeHost(\"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.callNativeHost(\"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.callNativeHost(\"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.callNativeHost(\"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.callNativeHost(\"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.callNativeHost(\"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.callNativeHost(\"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.callNativeHost(\"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.callNativeHost(\"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.callNativeHost(\"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.callNativeHost(\"storageRemoveAll\", this.id);\r\n }\r\n}\r\n"]}
|
|
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;AAqBpD,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,mCAAmC;IAC5B,MAAM,CAAC,KAAK,CAAC,cAAc,CAA+C,UAAa,EAAE,GAAG,IAAuC;QACxI,OAAO,eAAM,CAAC,cAAc,CAAC,8BAAgB,EAAE,UAAU,EAAE,GAAG,IAAI,CAA6C,CAAC;IAClH,CAAC;IAWO,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,EAAgB,EAAE,MAAkC;QACvF,8BAAoB,CAAC,MAAM,GAAG,CAAC,MAAM,KAAK,wCAA0B,CAAC,MAAM,CAAC,CAAC;QAC7E,MAAM,IAAI,CAAC,YAAY,CAAC,4BAA4B,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IACnE,CAAC;IACO,MAAM,CAAC,6BAA6B;QAC1C,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,SAAS,EAAE;YACrE,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,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ACF;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\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 /** 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 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 = IModelVersion.latest(), progress?: ProgressCallback): Promise<BriefcaseDownloader> {\r\n\r\n let stopProgressEvents = () => { };\r\n if (progress !== undefined) {\r\n stopProgressEvents = IpcApp.addListener(`nativeApp.progress-${iModelId}`, (_evt: Event, data: { loaded: number, total: number }) => {\r\n progress(data);\r\n });\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, progress !== undefined, 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"]}
|
|
@@ -27,7 +27,7 @@ class NativeAppLogger {
|
|
|
27
27
|
try {
|
|
28
28
|
while (messages.length > 0) {
|
|
29
29
|
const msg = messages.shift();
|
|
30
|
-
await IpcApp_1.IpcApp.
|
|
30
|
+
await IpcApp_1.IpcApp.appFunctionIpc.log(msg.timestamp, msg.level, msg.category, msg.message, { ...msg.metaData });
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
finally {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeAppLogger.js","sourceRoot":"","sources":["../../src/NativeAppLogger.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAsF;AACtF,qCAAkC;AAalC;;;GAGG;AACH,MAAa,eAAe;IAGlB,MAAM,CAAC,cAAc;QAC3B,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;YACjD,IAAI,CAAC,UAAU,GAAG,IAAI,OAAO,CAAO,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;YACvE,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;YAChC,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;YACpB,UAAU,CAAC,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;SACpD;IACH,CAAC;IAEO,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,QAAsB;QACrD,IAAI;YACF,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC1B,MAAM,GAAG,GAAe,QAAQ,CAAC,KAAK,EAAG,CAAC;gBAC1C,MAAM,eAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"NativeAppLogger.js","sourceRoot":"","sources":["../../src/NativeAppLogger.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAsF;AACtF,qCAAkC;AAalC;;;GAGG;AACH,MAAa,eAAe;IAGlB,MAAM,CAAC,cAAc;QAC3B,IAAI,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AAE,OAAe,EAAE,QAAyB,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC9H,MAAM,MAAM,GAAG,CAAC,QAAgB,EAAE,OAAe,EAAE,QAAyB,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC3H,MAAM,OAAO,GAAG,CAAC,QAAgB,EAAE,OAAe,EAAE,QAAyB,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QAE7H,qBAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;;AAjEH,0CAkEC;AAjEgB,yBAAS,GAAiB,EAAE,CAAC","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 { BentleyError, Logger, LoggingMetaData, LogLevel } from \"@itwin/core-bentley\";\r\nimport { IpcApp } from \"./IpcApp\";\r\n\r\n/**\r\n * Describe log message\r\n * @internal\r\n */\r\ninterface LogMessage {\r\n timestamp: number;\r\n level: LogLevel;\r\n category: string;\r\n message: string;\r\n metaData: any;\r\n}\r\n/**\r\n * NativeAppLogger send log message from frontend to backend. It works on native app only.\r\n * @internal\r\n */\r\nexport class NativeAppLogger {\r\n private static _messages: LogMessage[] = [];\r\n private static _onFlushed: Promise<void> | undefined;\r\n private static flushToBackend() {\r\n if (!this._onFlushed && this._messages.length > 0) {\r\n this._onFlushed = new Promise<void>(() => this._onFlushed = undefined);\r\n const messages = this._messages;\r\n this._messages = [];\r\n setTimeout(async () => this.flushBucket(messages));\r\n }\r\n }\r\n\r\n private static async flushBucket(messages: LogMessage[]): Promise<void> {\r\n try {\r\n while (messages.length > 0) {\r\n const msg: LogMessage = messages.shift()!;\r\n await IpcApp.appFunctionIpc.log(msg.timestamp, msg.level, msg.category, msg.message, { ...msg.metaData });\r\n }\r\n } finally {\r\n // Put back unsent messages.\r\n this._messages.unshift(...messages);\r\n if (this._messages.length > 0) {\r\n this.flushToBackend();\r\n } else {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n Promise.resolve(this._onFlushed);\r\n }\r\n }\r\n }\r\n\r\n private static log(level: LogLevel, category: string, message: string, metaData: LoggingMetaData) {\r\n this._messages.push({ timestamp: Date.now(), level, category, message, metaData: BentleyError.getMetaData(metaData) });\r\n this.flushToBackend();\r\n }\r\n\r\n public static logError(category: string, message: string, metaData: LoggingMetaData) {\r\n this.log(LogLevel.Error, category, message, metaData);\r\n }\r\n\r\n public static logInfo(category: string, message: string, metaData: LoggingMetaData) {\r\n this.log(LogLevel.Info, category, message, metaData);\r\n }\r\n\r\n public static logTrace(category: string, message: string, metaData: LoggingMetaData) {\r\n this.log(LogLevel.Trace, category, message, metaData);\r\n }\r\n\r\n public static logWarning(category: string, message: string, metaData: LoggingMetaData) {\r\n this.log(LogLevel.Warning, category, message, metaData);\r\n }\r\n\r\n public static async flush(): Promise<void> {\r\n this.flushToBackend();\r\n if (this._onFlushed) {\r\n return this._onFlushed;\r\n }\r\n }\r\n\r\n public static initialize() {\r\n const errCb = (category: string, message: string, metaData: LoggingMetaData) => this.logError(category, message, metaData);\r\n const warnCb = (category: string, message: string, metaData: LoggingMetaData) => this.logWarning(category, message, metaData);\r\n const infoCb = (category: string, message: string, metaData: LoggingMetaData) => this.logInfo(category, message, metaData);\r\n const traceCb = (category: string, message: string, metaData: LoggingMetaData) => this.logTrace(category, message, metaData);\r\n\r\n Logger.initialize(errCb, warnCb, infoCb, traceCb);\r\n }\r\n}\r\n"]}
|