@itwin/core-frontend 4.0.0-dev.4 → 4.0.0-dev.41
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 +67 -37
- package/lib/cjs/AccuDraw.js +1 -1
- package/lib/cjs/AccuDraw.js.map +1 -1
- package/lib/cjs/AccuSnap.js +3 -3
- package/lib/cjs/AccuSnap.js.map +1 -1
- package/lib/cjs/BriefcaseConnection.js +9 -11
- package/lib/cjs/BriefcaseConnection.js.map +1 -1
- package/lib/cjs/DisplayStyleState.js +8 -12
- package/lib/cjs/DisplayStyleState.js.map +1 -1
- package/lib/cjs/DrawingViewState.js +4 -6
- package/lib/cjs/DrawingViewState.js.map +1 -1
- package/lib/cjs/ElementLocateManager.d.ts.map +1 -1
- package/lib/cjs/ElementLocateManager.js +2 -0
- package/lib/cjs/ElementLocateManager.js.map +1 -1
- package/lib/cjs/EnvironmentDecorations.js +2 -3
- package/lib/cjs/EnvironmentDecorations.js.map +1 -1
- package/lib/cjs/FlashSettings.js +3 -4
- package/lib/cjs/FlashSettings.js.map +1 -1
- package/lib/cjs/GeoServices.d.ts +57 -5
- package/lib/cjs/GeoServices.d.ts.map +1 -1
- package/lib/cjs/GeoServices.js +180 -155
- package/lib/cjs/GeoServices.js.map +1 -1
- package/lib/cjs/IModelApp.d.ts +1 -3
- package/lib/cjs/IModelApp.d.ts.map +1 -1
- package/lib/cjs/IModelApp.js +20 -24
- package/lib/cjs/IModelApp.js.map +1 -1
- package/lib/cjs/IModelConnection.d.ts +1 -1
- package/lib/cjs/IModelConnection.js +2 -2
- package/lib/cjs/IModelConnection.js.map +1 -1
- package/lib/cjs/IpcApp.js +1 -1
- package/lib/cjs/IpcApp.js.map +1 -1
- package/lib/cjs/LocalhostIpcApp.js +3 -4
- package/lib/cjs/LocalhostIpcApp.js.map +1 -1
- package/lib/cjs/ModelState.js +2 -3
- package/lib/cjs/ModelState.js.map +1 -1
- package/lib/cjs/NativeApp.d.ts +1 -1
- package/lib/cjs/NativeApp.js +4 -7
- package/lib/cjs/NativeApp.js.map +1 -1
- package/lib/cjs/NoRenderApp.d.ts +11 -4
- package/lib/cjs/NoRenderApp.d.ts.map +1 -1
- package/lib/cjs/NoRenderApp.js +14 -8
- package/lib/cjs/NoRenderApp.js.map +1 -1
- package/lib/cjs/PlanarClipMaskState.js +1 -1
- package/lib/cjs/PlanarClipMaskState.js.map +1 -1
- package/lib/cjs/RealityDataSourceContextShareImpl.js +2 -4
- package/lib/cjs/RealityDataSourceContextShareImpl.js.map +1 -1
- package/lib/cjs/SelectionSet.d.ts +0 -1
- package/lib/cjs/SelectionSet.d.ts.map +1 -1
- package/lib/cjs/SelectionSet.js +0 -1
- package/lib/cjs/SelectionSet.js.map +1 -1
- package/lib/cjs/SheetViewState.js +15 -23
- package/lib/cjs/SheetViewState.js.map +1 -1
- package/lib/cjs/Tiles.js +2 -2
- package/lib/cjs/Tiles.js.map +1 -1
- package/lib/cjs/ViewContext.js +1 -1
- package/lib/cjs/ViewContext.js.map +1 -1
- package/lib/cjs/ViewCreator2d.js +4 -5
- package/lib/cjs/ViewCreator2d.js.map +1 -1
- package/lib/cjs/ViewCreator3d.js +5 -5
- package/lib/cjs/ViewCreator3d.js.map +1 -1
- package/lib/cjs/ViewRect.d.ts +1 -1
- package/lib/cjs/ViewRect.d.ts.map +1 -1
- package/lib/cjs/ViewRect.js +1 -1
- package/lib/cjs/ViewRect.js.map +1 -1
- package/lib/cjs/ViewState.js +17 -24
- package/lib/cjs/ViewState.js.map +1 -1
- package/lib/cjs/Viewport.js +23 -33
- package/lib/cjs/Viewport.js.map +1 -1
- package/lib/cjs/extension/ExtensionImpl.js +1 -1
- package/lib/cjs/extension/ExtensionImpl.js.map +1 -1
- package/lib/cjs/quantity-formatting/BaseUnitFormattingSettingsProvider.js +2 -3
- package/lib/cjs/quantity-formatting/BaseUnitFormattingSettingsProvider.js.map +1 -1
- package/lib/cjs/quantity-formatting/QuantityFormatter.js +7 -9
- package/lib/cjs/quantity-formatting/QuantityFormatter.js.map +1 -1
- package/lib/cjs/render/FeatureSymbology.js +1 -2
- package/lib/cjs/render/FeatureSymbology.js.map +1 -1
- package/lib/cjs/render/GraphicBuilder.js +7 -9
- package/lib/cjs/render/GraphicBuilder.js.map +1 -1
- package/lib/cjs/render/MockRender.js +1 -2
- package/lib/cjs/render/MockRender.js.map +1 -1
- package/lib/cjs/render/ParticleCollectionBuilder.js +2 -3
- package/lib/cjs/render/ParticleCollectionBuilder.js.map +1 -1
- package/lib/cjs/render/RealityMeshParams.d.ts +2 -2
- package/lib/cjs/render/RealityMeshParams.d.ts.map +1 -1
- package/lib/cjs/render/RealityMeshParams.js +8 -11
- package/lib/cjs/render/RealityMeshParams.js.map +1 -1
- package/lib/cjs/render/RenderPlan.js +1 -1
- package/lib/cjs/render/RenderPlan.js.map +1 -1
- package/lib/cjs/render/RenderSystem.js +1 -2
- package/lib/cjs/render/RenderSystem.js.map +1 -1
- package/lib/cjs/render/VisibleFeature.js +2 -4
- package/lib/cjs/render/VisibleFeature.js.map +1 -1
- package/lib/cjs/render/primitives/AuxChannelTable.js +6 -9
- package/lib/cjs/render/primitives/AuxChannelTable.js.map +1 -1
- package/lib/cjs/render/primitives/EdgeParams.js +6 -7
- package/lib/cjs/render/primitives/EdgeParams.js.map +1 -1
- package/lib/cjs/render/primitives/PolylineParams.js +2 -3
- package/lib/cjs/render/primitives/PolylineParams.js.map +1 -1
- package/lib/cjs/render/primitives/VertexKey.js +1 -1
- package/lib/cjs/render/primitives/VertexKey.js.map +1 -1
- package/lib/cjs/render/primitives/VertexTable.js +1 -1
- package/lib/cjs/render/primitives/VertexTable.js.map +1 -1
- package/lib/cjs/render/primitives/VertexTableSplitter.js +6 -8
- package/lib/cjs/render/primitives/VertexTableSplitter.js.map +1 -1
- package/lib/cjs/render/primitives/geometry/GeometryAccumulator.js +9 -11
- package/lib/cjs/render/primitives/geometry/GeometryAccumulator.js.map +1 -1
- package/lib/cjs/render/primitives/geometry/GeometryListBuilder.js +3 -5
- package/lib/cjs/render/primitives/geometry/GeometryListBuilder.js.map +1 -1
- package/lib/cjs/render/primitives/mesh/MeshBuilder.js +1 -1
- package/lib/cjs/render/primitives/mesh/MeshBuilder.js.map +1 -1
- package/lib/cjs/render/primitives/mesh/MeshPrimitives.js +2 -3
- package/lib/cjs/render/primitives/mesh/MeshPrimitives.js.map +1 -1
- package/lib/cjs/render/webgl/BranchState.js +9 -10
- package/lib/cjs/render/webgl/BranchState.js.map +1 -1
- package/lib/cjs/render/webgl/EDL.js +17 -21
- package/lib/cjs/render/webgl/EDL.js.map +1 -1
- package/lib/cjs/render/webgl/FeatureOverrides.js +2 -2
- package/lib/cjs/render/webgl/FeatureOverrides.js.map +1 -1
- package/lib/cjs/render/webgl/Graphic.js +3 -5
- package/lib/cjs/render/webgl/Graphic.js.map +1 -1
- package/lib/cjs/render/webgl/IndexedEdgeGeometry.js +1 -1
- package/lib/cjs/render/webgl/IndexedEdgeGeometry.js.map +1 -1
- package/lib/cjs/render/webgl/InstancedGeometry.js +2 -3
- package/lib/cjs/render/webgl/InstancedGeometry.js.map +1 -1
- package/lib/cjs/render/webgl/Mesh.js +7 -10
- package/lib/cjs/render/webgl/Mesh.js.map +1 -1
- package/lib/cjs/render/webgl/MeshData.js +1 -2
- package/lib/cjs/render/webgl/MeshData.js.map +1 -1
- package/lib/cjs/render/webgl/PlanarClassifier.js +10 -15
- package/lib/cjs/render/webgl/PlanarClassifier.js.map +1 -1
- package/lib/cjs/render/webgl/RealityMesh.js +5 -8
- package/lib/cjs/render/webgl/RealityMesh.js.map +1 -1
- package/lib/cjs/render/webgl/RealityModelUniforms.js +3 -4
- package/lib/cjs/render/webgl/RealityModelUniforms.js.map +1 -1
- package/lib/cjs/render/webgl/RenderCommands.js +7 -8
- package/lib/cjs/render/webgl/RenderCommands.js.map +1 -1
- package/lib/cjs/render/webgl/SceneCompositor.js +7 -9
- package/lib/cjs/render/webgl/SceneCompositor.js.map +1 -1
- package/lib/cjs/render/webgl/ShaderBuilder.js +1 -2
- package/lib/cjs/render/webgl/ShaderBuilder.js.map +1 -1
- package/lib/cjs/render/webgl/SolarShadowMap.d.ts.map +1 -1
- package/lib/cjs/render/webgl/SolarShadowMap.js +1 -11
- package/lib/cjs/render/webgl/SolarShadowMap.js.map +1 -1
- package/lib/cjs/render/webgl/SurfaceGeometry.js +1 -1
- package/lib/cjs/render/webgl/SurfaceGeometry.js.map +1 -1
- package/lib/cjs/render/webgl/System.d.ts +0 -1
- package/lib/cjs/render/webgl/System.d.ts.map +1 -1
- package/lib/cjs/render/webgl/System.js +12 -17
- package/lib/cjs/render/webgl/System.js.map +1 -1
- package/lib/cjs/render/webgl/Target.js +9 -14
- package/lib/cjs/render/webgl/Target.js.map +1 -1
- package/lib/cjs/render/webgl/TargetGraphics.js +1 -2
- package/lib/cjs/render/webgl/TargetGraphics.js.map +1 -1
- package/lib/cjs/render/webgl/Texture.js +1 -2
- package/lib/cjs/render/webgl/Texture.js.map +1 -1
- package/lib/cjs/render/webgl/ThematicSensors.js +2 -4
- package/lib/cjs/render/webgl/ThematicSensors.js.map +1 -1
- package/lib/cjs/render/webgl/VisibleTileFeatures.js +1 -2
- package/lib/cjs/render/webgl/VisibleTileFeatures.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/Animation.js +6 -9
- package/lib/cjs/render/webgl/glsl/Animation.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/FeatureSymbology.js +1 -2
- package/lib/cjs/render/webgl/glsl/FeatureSymbology.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/Instancing.js +4 -5
- package/lib/cjs/render/webgl/glsl/Instancing.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/RealityMesh.js +2 -4
- package/lib/cjs/render/webgl/glsl/RealityMesh.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/Surface.js +1 -2
- package/lib/cjs/render/webgl/glsl/Surface.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/Thematic.js +1 -2
- package/lib/cjs/render/webgl/glsl/Thematic.js.map +1 -1
- package/lib/cjs/request/Request.d.ts.map +1 -1
- package/lib/cjs/request/Request.js.map +1 -1
- package/lib/cjs/tile/ClassifierTileTree.js +3 -3
- package/lib/cjs/tile/ClassifierTileTree.js.map +1 -1
- package/lib/cjs/tile/GltfReader.js +62 -76
- package/lib/cjs/tile/GltfReader.js.map +1 -1
- package/lib/cjs/tile/IModelTile.js +2 -3
- package/lib/cjs/tile/IModelTile.js.map +1 -1
- package/lib/cjs/tile/IModelTileRequestChannels.js +6 -11
- package/lib/cjs/tile/IModelTileRequestChannels.js.map +1 -1
- package/lib/cjs/tile/IModelTileTree.js +5 -9
- package/lib/cjs/tile/IModelTileTree.js.map +1 -1
- package/lib/cjs/tile/ImdlReader.js +13 -17
- package/lib/cjs/tile/ImdlReader.js.map +1 -1
- package/lib/cjs/tile/OrbitGtTileTree.js +2 -2
- package/lib/cjs/tile/OrbitGtTileTree.js.map +1 -1
- package/lib/cjs/tile/PntsReader.js +4 -5
- package/lib/cjs/tile/PntsReader.js.map +1 -1
- package/lib/cjs/tile/PrimaryTileTree.js +22 -32
- package/lib/cjs/tile/PrimaryTileTree.js.map +1 -1
- package/lib/cjs/tile/RealityModelTileTree.js +12 -19
- package/lib/cjs/tile/RealityModelTileTree.js.map +1 -1
- package/lib/cjs/tile/RealityTile.d.ts +1 -1
- package/lib/cjs/tile/RealityTile.js +4 -6
- package/lib/cjs/tile/RealityTile.js.map +1 -1
- package/lib/cjs/tile/RealityTileLoader.js +2 -2
- package/lib/cjs/tile/RealityTileLoader.js.map +1 -1
- package/lib/cjs/tile/RealityTileTree.d.ts +1 -1
- package/lib/cjs/tile/RealityTileTree.d.ts.map +1 -1
- package/lib/cjs/tile/RealityTileTree.js +2 -3
- package/lib/cjs/tile/RealityTileTree.js.map +1 -1
- package/lib/cjs/tile/ThreeDTileFormatInterpreter.js +3 -5
- package/lib/cjs/tile/ThreeDTileFormatInterpreter.js.map +1 -1
- package/lib/cjs/tile/Tile.js +1 -1
- package/lib/cjs/tile/Tile.js.map +1 -1
- package/lib/cjs/tile/TileAdmin.d.ts +5 -1
- package/lib/cjs/tile/TileAdmin.d.ts.map +1 -1
- package/lib/cjs/tile/TileAdmin.js +22 -27
- package/lib/cjs/tile/TileAdmin.js.map +1 -1
- package/lib/cjs/tile/TileDrawArgs.js +3 -6
- package/lib/cjs/tile/TileDrawArgs.js.map +1 -1
- package/lib/cjs/tile/TileRequest.d.ts.map +1 -1
- package/lib/cjs/tile/TileRequest.js +2 -1
- package/lib/cjs/tile/TileRequest.js.map +1 -1
- package/lib/cjs/tile/TileRequestChannel.d.ts +23 -1
- package/lib/cjs/tile/TileRequestChannel.d.ts.map +1 -1
- package/lib/cjs/tile/TileRequestChannel.js +28 -7
- package/lib/cjs/tile/TileRequestChannel.js.map +1 -1
- package/lib/cjs/tile/TileRequestChannels.js +1 -1
- package/lib/cjs/tile/TileRequestChannels.js.map +1 -1
- package/lib/cjs/tile/TileTree.js +2 -3
- package/lib/cjs/tile/TileTree.js.map +1 -1
- package/lib/cjs/tile/TiledGraphicsProvider.js +1 -1
- package/lib/cjs/tile/TiledGraphicsProvider.js.map +1 -1
- package/lib/cjs/tile/map/ArcGISTileMap.js +5 -6
- package/lib/cjs/tile/map/ArcGISTileMap.js.map +1 -1
- package/lib/cjs/tile/map/ArcGisUtilities.d.ts.map +1 -1
- package/lib/cjs/tile/map/ArcGisUtilities.js +6 -8
- package/lib/cjs/tile/map/ArcGisUtilities.js.map +1 -1
- package/lib/cjs/tile/map/EllipsoidTerrainProvider.d.ts +11 -3
- package/lib/cjs/tile/map/EllipsoidTerrainProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/EllipsoidTerrainProvider.js +17 -5
- package/lib/cjs/tile/map/EllipsoidTerrainProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISImageryProvider.js +4 -7
- package/lib/cjs/tile/map/ImageryProviders/ArcGISImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +6 -9
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/BingImageryProvider.js +1 -2
- package/lib/cjs/tile/map/ImageryProviders/BingImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/WmsMapLayerImageryProvider.js +14 -19
- package/lib/cjs/tile/map/ImageryProviders/WmsMapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js +14 -20
- package/lib/cjs/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryTileTree.d.ts +2 -2
- package/lib/cjs/tile/map/ImageryTileTree.d.ts.map +1 -1
- package/lib/cjs/tile/map/ImageryTileTree.js +10 -5
- package/lib/cjs/tile/map/ImageryTileTree.js.map +1 -1
- package/lib/cjs/tile/map/MapCartoRectangle.d.ts +1 -1
- package/lib/cjs/tile/map/MapCartoRectangle.js +2 -2
- package/lib/cjs/tile/map/MapCartoRectangle.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerFormatRegistry.js +5 -6
- package/lib/cjs/tile/map/MapLayerFormatRegistry.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerImageryFormats.js +11 -14
- package/lib/cjs/tile/map/MapLayerImageryFormats.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerImageryProvider.js +2 -3
- package/lib/cjs/tile/map/MapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerSources.js +1 -1
- package/lib/cjs/tile/map/MapLayerSources.js.map +1 -1
- package/lib/cjs/tile/map/MapTile.d.ts +10 -2
- package/lib/cjs/tile/map/MapTile.d.ts.map +1 -1
- package/lib/cjs/tile/map/MapTile.js +34 -12
- package/lib/cjs/tile/map/MapTile.js.map +1 -1
- package/lib/cjs/tile/map/MapTileLoader.js +1 -1
- package/lib/cjs/tile/map/MapTileLoader.js.map +1 -1
- package/lib/cjs/tile/map/MapTileTree.d.ts +3 -2
- package/lib/cjs/tile/map/MapTileTree.d.ts.map +1 -1
- package/lib/cjs/tile/map/MapTileTree.js +24 -26
- package/lib/cjs/tile/map/MapTileTree.js.map +1 -1
- package/lib/cjs/tile/map/MapTiledGraphicsProvider.js +6 -7
- package/lib/cjs/tile/map/MapTiledGraphicsProvider.js.map +1 -1
- package/lib/cjs/tile/map/MapTilingScheme.d.ts +1 -1
- package/lib/cjs/tile/map/MapTilingScheme.js +1 -1
- package/lib/cjs/tile/map/MapTilingScheme.js.map +1 -1
- package/lib/cjs/tile/map/QuadId.d.ts +1 -1
- package/lib/cjs/tile/map/QuadId.js +1 -1
- package/lib/cjs/tile/map/QuadId.js.map +1 -1
- package/lib/cjs/tile/map/TerrainMeshProvider.d.ts +9 -4
- package/lib/cjs/tile/map/TerrainMeshProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/TerrainMeshProvider.js +6 -1
- package/lib/cjs/tile/map/TerrainMeshProvider.js.map +1 -1
- package/lib/cjs/tile/map/TerrainProvider.d.ts +2 -2
- package/lib/cjs/tile/map/TerrainProvider.js +1 -1
- package/lib/cjs/tile/map/TerrainProvider.js.map +1 -1
- package/lib/cjs/tile/map/WmsCapabilities.js +4 -5
- package/lib/cjs/tile/map/WmsCapabilities.js.map +1 -1
- package/lib/cjs/tile/map/WmtsCapabilities.js +17 -25
- package/lib/cjs/tile/map/WmtsCapabilities.js.map +1 -1
- package/lib/cjs/tools/ClipViewTool.js +1 -1
- package/lib/cjs/tools/ClipViewTool.js.map +1 -1
- package/lib/cjs/tools/MeasureTool.js +2 -4
- package/lib/cjs/tools/MeasureTool.js.map +1 -1
- package/lib/cjs/tools/PrimitiveTool.js +2 -3
- package/lib/cjs/tools/PrimitiveTool.js.map +1 -1
- package/lib/cjs/tools/SelectTool.js +1 -2
- package/lib/cjs/tools/SelectTool.js.map +1 -1
- package/lib/cjs/tools/Tool.js +2 -3
- package/lib/cjs/tools/Tool.js.map +1 -1
- package/lib/cjs/tools/ToolAdmin.js +2 -4
- package/lib/cjs/tools/ToolAdmin.js.map +1 -1
- package/lib/cjs/tools/ViewTool.js +3 -3
- package/lib/cjs/tools/ViewTool.js.map +1 -1
- package/lib/esm/AccuDraw.js +1 -1
- package/lib/esm/AccuDraw.js.map +1 -1
- package/lib/esm/AccuSnap.js +3 -3
- package/lib/esm/AccuSnap.js.map +1 -1
- package/lib/esm/BriefcaseConnection.js +9 -11
- package/lib/esm/BriefcaseConnection.js.map +1 -1
- package/lib/esm/DisplayStyleState.js +8 -12
- package/lib/esm/DisplayStyleState.js.map +1 -1
- package/lib/esm/DrawingViewState.js +4 -6
- package/lib/esm/DrawingViewState.js.map +1 -1
- package/lib/esm/ElementLocateManager.d.ts.map +1 -1
- package/lib/esm/ElementLocateManager.js +2 -0
- package/lib/esm/ElementLocateManager.js.map +1 -1
- package/lib/esm/EnvironmentDecorations.js +2 -3
- package/lib/esm/EnvironmentDecorations.js.map +1 -1
- package/lib/esm/FlashSettings.js +3 -4
- package/lib/esm/FlashSettings.js.map +1 -1
- package/lib/esm/GeoServices.d.ts +57 -5
- package/lib/esm/GeoServices.d.ts.map +1 -1
- package/lib/esm/GeoServices.js +178 -154
- package/lib/esm/GeoServices.js.map +1 -1
- package/lib/esm/IModelApp.d.ts +1 -3
- package/lib/esm/IModelApp.d.ts.map +1 -1
- package/lib/esm/IModelApp.js +20 -24
- package/lib/esm/IModelApp.js.map +1 -1
- package/lib/esm/IModelConnection.d.ts +1 -1
- package/lib/esm/IModelConnection.js +2 -2
- package/lib/esm/IModelConnection.js.map +1 -1
- package/lib/esm/IpcApp.js +1 -1
- package/lib/esm/IpcApp.js.map +1 -1
- package/lib/esm/LocalhostIpcApp.js +3 -4
- package/lib/esm/LocalhostIpcApp.js.map +1 -1
- package/lib/esm/ModelState.js +2 -3
- package/lib/esm/ModelState.js.map +1 -1
- package/lib/esm/NativeApp.d.ts +1 -1
- package/lib/esm/NativeApp.js +4 -7
- package/lib/esm/NativeApp.js.map +1 -1
- package/lib/esm/NoRenderApp.d.ts +11 -4
- package/lib/esm/NoRenderApp.d.ts.map +1 -1
- package/lib/esm/NoRenderApp.js +12 -6
- package/lib/esm/NoRenderApp.js.map +1 -1
- package/lib/esm/PlanarClipMaskState.js +1 -1
- package/lib/esm/PlanarClipMaskState.js.map +1 -1
- package/lib/esm/RealityDataSourceContextShareImpl.js +2 -4
- package/lib/esm/RealityDataSourceContextShareImpl.js.map +1 -1
- package/lib/esm/SelectionSet.d.ts +0 -1
- package/lib/esm/SelectionSet.d.ts.map +1 -1
- package/lib/esm/SelectionSet.js +0 -1
- package/lib/esm/SelectionSet.js.map +1 -1
- package/lib/esm/SheetViewState.js +15 -23
- package/lib/esm/SheetViewState.js.map +1 -1
- package/lib/esm/Tiles.js +2 -2
- package/lib/esm/Tiles.js.map +1 -1
- package/lib/esm/ViewContext.js +1 -1
- package/lib/esm/ViewContext.js.map +1 -1
- package/lib/esm/ViewCreator2d.js +4 -5
- package/lib/esm/ViewCreator2d.js.map +1 -1
- package/lib/esm/ViewCreator3d.js +5 -5
- package/lib/esm/ViewCreator3d.js.map +1 -1
- package/lib/esm/ViewRect.d.ts +1 -1
- package/lib/esm/ViewRect.d.ts.map +1 -1
- package/lib/esm/ViewRect.js +1 -1
- package/lib/esm/ViewRect.js.map +1 -1
- package/lib/esm/ViewState.js +17 -24
- package/lib/esm/ViewState.js.map +1 -1
- package/lib/esm/Viewport.js +23 -33
- package/lib/esm/Viewport.js.map +1 -1
- package/lib/esm/extension/ExtensionImpl.js +1 -1
- package/lib/esm/extension/ExtensionImpl.js.map +1 -1
- package/lib/esm/quantity-formatting/BaseUnitFormattingSettingsProvider.js +2 -3
- package/lib/esm/quantity-formatting/BaseUnitFormattingSettingsProvider.js.map +1 -1
- package/lib/esm/quantity-formatting/QuantityFormatter.js +7 -9
- package/lib/esm/quantity-formatting/QuantityFormatter.js.map +1 -1
- package/lib/esm/render/FeatureSymbology.js +1 -2
- package/lib/esm/render/FeatureSymbology.js.map +1 -1
- package/lib/esm/render/GraphicBuilder.js +7 -9
- package/lib/esm/render/GraphicBuilder.js.map +1 -1
- package/lib/esm/render/MockRender.js +1 -2
- package/lib/esm/render/MockRender.js.map +1 -1
- package/lib/esm/render/ParticleCollectionBuilder.js +2 -3
- package/lib/esm/render/ParticleCollectionBuilder.js.map +1 -1
- package/lib/esm/render/RealityMeshParams.d.ts +2 -2
- package/lib/esm/render/RealityMeshParams.d.ts.map +1 -1
- package/lib/esm/render/RealityMeshParams.js +8 -11
- package/lib/esm/render/RealityMeshParams.js.map +1 -1
- package/lib/esm/render/RenderPlan.js +1 -1
- package/lib/esm/render/RenderPlan.js.map +1 -1
- package/lib/esm/render/RenderSystem.js +1 -2
- package/lib/esm/render/RenderSystem.js.map +1 -1
- package/lib/esm/render/VisibleFeature.js +2 -4
- package/lib/esm/render/VisibleFeature.js.map +1 -1
- package/lib/esm/render/primitives/AuxChannelTable.js +6 -9
- package/lib/esm/render/primitives/AuxChannelTable.js.map +1 -1
- package/lib/esm/render/primitives/EdgeParams.js +6 -7
- package/lib/esm/render/primitives/EdgeParams.js.map +1 -1
- package/lib/esm/render/primitives/PolylineParams.js +2 -3
- package/lib/esm/render/primitives/PolylineParams.js.map +1 -1
- package/lib/esm/render/primitives/VertexKey.js +1 -1
- package/lib/esm/render/primitives/VertexKey.js.map +1 -1
- package/lib/esm/render/primitives/VertexTable.js +1 -1
- package/lib/esm/render/primitives/VertexTable.js.map +1 -1
- package/lib/esm/render/primitives/VertexTableSplitter.js +6 -8
- package/lib/esm/render/primitives/VertexTableSplitter.js.map +1 -1
- package/lib/esm/render/primitives/geometry/GeometryAccumulator.js +9 -11
- package/lib/esm/render/primitives/geometry/GeometryAccumulator.js.map +1 -1
- package/lib/esm/render/primitives/geometry/GeometryListBuilder.js +3 -5
- package/lib/esm/render/primitives/geometry/GeometryListBuilder.js.map +1 -1
- package/lib/esm/render/primitives/mesh/MeshBuilder.js +1 -1
- package/lib/esm/render/primitives/mesh/MeshBuilder.js.map +1 -1
- package/lib/esm/render/primitives/mesh/MeshPrimitives.js +2 -3
- package/lib/esm/render/primitives/mesh/MeshPrimitives.js.map +1 -1
- package/lib/esm/render/webgl/BranchState.js +9 -10
- package/lib/esm/render/webgl/BranchState.js.map +1 -1
- package/lib/esm/render/webgl/EDL.js +17 -21
- package/lib/esm/render/webgl/EDL.js.map +1 -1
- package/lib/esm/render/webgl/FeatureOverrides.js +2 -2
- package/lib/esm/render/webgl/FeatureOverrides.js.map +1 -1
- package/lib/esm/render/webgl/Graphic.js +3 -5
- package/lib/esm/render/webgl/Graphic.js.map +1 -1
- package/lib/esm/render/webgl/IndexedEdgeGeometry.js +1 -1
- package/lib/esm/render/webgl/IndexedEdgeGeometry.js.map +1 -1
- package/lib/esm/render/webgl/InstancedGeometry.js +2 -3
- package/lib/esm/render/webgl/InstancedGeometry.js.map +1 -1
- package/lib/esm/render/webgl/Mesh.js +7 -10
- package/lib/esm/render/webgl/Mesh.js.map +1 -1
- package/lib/esm/render/webgl/MeshData.js +1 -2
- package/lib/esm/render/webgl/MeshData.js.map +1 -1
- package/lib/esm/render/webgl/PlanarClassifier.js +10 -15
- package/lib/esm/render/webgl/PlanarClassifier.js.map +1 -1
- package/lib/esm/render/webgl/RealityMesh.js +5 -8
- package/lib/esm/render/webgl/RealityMesh.js.map +1 -1
- package/lib/esm/render/webgl/RealityModelUniforms.js +3 -4
- package/lib/esm/render/webgl/RealityModelUniforms.js.map +1 -1
- package/lib/esm/render/webgl/RenderCommands.js +7 -8
- package/lib/esm/render/webgl/RenderCommands.js.map +1 -1
- package/lib/esm/render/webgl/SceneCompositor.js +7 -9
- package/lib/esm/render/webgl/SceneCompositor.js.map +1 -1
- package/lib/esm/render/webgl/ShaderBuilder.js +1 -2
- package/lib/esm/render/webgl/ShaderBuilder.js.map +1 -1
- package/lib/esm/render/webgl/SolarShadowMap.d.ts.map +1 -1
- package/lib/esm/render/webgl/SolarShadowMap.js +1 -11
- package/lib/esm/render/webgl/SolarShadowMap.js.map +1 -1
- package/lib/esm/render/webgl/SurfaceGeometry.js +1 -1
- package/lib/esm/render/webgl/SurfaceGeometry.js.map +1 -1
- package/lib/esm/render/webgl/System.d.ts +0 -1
- package/lib/esm/render/webgl/System.d.ts.map +1 -1
- package/lib/esm/render/webgl/System.js +12 -17
- package/lib/esm/render/webgl/System.js.map +1 -1
- package/lib/esm/render/webgl/Target.js +9 -14
- package/lib/esm/render/webgl/Target.js.map +1 -1
- package/lib/esm/render/webgl/TargetGraphics.js +1 -2
- package/lib/esm/render/webgl/TargetGraphics.js.map +1 -1
- package/lib/esm/render/webgl/Texture.js +1 -2
- package/lib/esm/render/webgl/Texture.js.map +1 -1
- package/lib/esm/render/webgl/ThematicSensors.js +2 -4
- package/lib/esm/render/webgl/ThematicSensors.js.map +1 -1
- package/lib/esm/render/webgl/VisibleTileFeatures.js +1 -2
- package/lib/esm/render/webgl/VisibleTileFeatures.js.map +1 -1
- package/lib/esm/render/webgl/glsl/Animation.js +6 -9
- package/lib/esm/render/webgl/glsl/Animation.js.map +1 -1
- package/lib/esm/render/webgl/glsl/FeatureSymbology.js +1 -2
- package/lib/esm/render/webgl/glsl/FeatureSymbology.js.map +1 -1
- package/lib/esm/render/webgl/glsl/Instancing.js +4 -5
- package/lib/esm/render/webgl/glsl/Instancing.js.map +1 -1
- package/lib/esm/render/webgl/glsl/RealityMesh.js +2 -4
- package/lib/esm/render/webgl/glsl/RealityMesh.js.map +1 -1
- package/lib/esm/render/webgl/glsl/Surface.js +1 -2
- package/lib/esm/render/webgl/glsl/Surface.js.map +1 -1
- package/lib/esm/render/webgl/glsl/Thematic.js +1 -2
- package/lib/esm/render/webgl/glsl/Thematic.js.map +1 -1
- package/lib/esm/request/Request.d.ts.map +1 -1
- package/lib/esm/request/Request.js.map +1 -1
- package/lib/esm/tile/ClassifierTileTree.js +3 -3
- package/lib/esm/tile/ClassifierTileTree.js.map +1 -1
- package/lib/esm/tile/GltfReader.js +62 -76
- package/lib/esm/tile/GltfReader.js.map +1 -1
- package/lib/esm/tile/IModelTile.js +2 -3
- package/lib/esm/tile/IModelTile.js.map +1 -1
- package/lib/esm/tile/IModelTileRequestChannels.js +6 -11
- package/lib/esm/tile/IModelTileRequestChannels.js.map +1 -1
- package/lib/esm/tile/IModelTileTree.js +5 -9
- package/lib/esm/tile/IModelTileTree.js.map +1 -1
- package/lib/esm/tile/ImdlReader.js +13 -17
- package/lib/esm/tile/ImdlReader.js.map +1 -1
- package/lib/esm/tile/OrbitGtTileTree.js +2 -2
- package/lib/esm/tile/OrbitGtTileTree.js.map +1 -1
- package/lib/esm/tile/PntsReader.js +4 -5
- package/lib/esm/tile/PntsReader.js.map +1 -1
- package/lib/esm/tile/PrimaryTileTree.js +22 -32
- package/lib/esm/tile/PrimaryTileTree.js.map +1 -1
- package/lib/esm/tile/RealityModelTileTree.js +12 -19
- package/lib/esm/tile/RealityModelTileTree.js.map +1 -1
- package/lib/esm/tile/RealityTile.d.ts +1 -1
- package/lib/esm/tile/RealityTile.js +4 -6
- package/lib/esm/tile/RealityTile.js.map +1 -1
- package/lib/esm/tile/RealityTileLoader.js +2 -2
- package/lib/esm/tile/RealityTileLoader.js.map +1 -1
- package/lib/esm/tile/RealityTileTree.d.ts +1 -1
- package/lib/esm/tile/RealityTileTree.d.ts.map +1 -1
- package/lib/esm/tile/RealityTileTree.js +2 -3
- package/lib/esm/tile/RealityTileTree.js.map +1 -1
- package/lib/esm/tile/ThreeDTileFormatInterpreter.js +3 -5
- package/lib/esm/tile/ThreeDTileFormatInterpreter.js.map +1 -1
- package/lib/esm/tile/Tile.js +1 -1
- package/lib/esm/tile/Tile.js.map +1 -1
- package/lib/esm/tile/TileAdmin.d.ts +5 -1
- package/lib/esm/tile/TileAdmin.d.ts.map +1 -1
- package/lib/esm/tile/TileAdmin.js +22 -27
- package/lib/esm/tile/TileAdmin.js.map +1 -1
- package/lib/esm/tile/TileDrawArgs.js +3 -6
- package/lib/esm/tile/TileDrawArgs.js.map +1 -1
- package/lib/esm/tile/TileRequest.d.ts.map +1 -1
- package/lib/esm/tile/TileRequest.js +2 -1
- package/lib/esm/tile/TileRequest.js.map +1 -1
- package/lib/esm/tile/TileRequestChannel.d.ts +23 -1
- package/lib/esm/tile/TileRequestChannel.d.ts.map +1 -1
- package/lib/esm/tile/TileRequestChannel.js +28 -7
- package/lib/esm/tile/TileRequestChannel.js.map +1 -1
- package/lib/esm/tile/TileRequestChannels.js +1 -1
- package/lib/esm/tile/TileRequestChannels.js.map +1 -1
- package/lib/esm/tile/TileTree.js +2 -3
- package/lib/esm/tile/TileTree.js.map +1 -1
- package/lib/esm/tile/TiledGraphicsProvider.js +1 -1
- package/lib/esm/tile/TiledGraphicsProvider.js.map +1 -1
- package/lib/esm/tile/map/ArcGISTileMap.js +5 -6
- package/lib/esm/tile/map/ArcGISTileMap.js.map +1 -1
- package/lib/esm/tile/map/ArcGisUtilities.d.ts.map +1 -1
- package/lib/esm/tile/map/ArcGisUtilities.js +6 -8
- package/lib/esm/tile/map/ArcGisUtilities.js.map +1 -1
- package/lib/esm/tile/map/EllipsoidTerrainProvider.d.ts +11 -3
- package/lib/esm/tile/map/EllipsoidTerrainProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/EllipsoidTerrainProvider.js +17 -5
- package/lib/esm/tile/map/EllipsoidTerrainProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISImageryProvider.js +4 -7
- package/lib/esm/tile/map/ImageryProviders/ArcGISImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +6 -9
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/BingImageryProvider.js +1 -2
- package/lib/esm/tile/map/ImageryProviders/BingImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/WmsMapLayerImageryProvider.js +14 -19
- package/lib/esm/tile/map/ImageryProviders/WmsMapLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js +14 -20
- package/lib/esm/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryTileTree.d.ts +2 -2
- package/lib/esm/tile/map/ImageryTileTree.d.ts.map +1 -1
- package/lib/esm/tile/map/ImageryTileTree.js +10 -5
- package/lib/esm/tile/map/ImageryTileTree.js.map +1 -1
- package/lib/esm/tile/map/MapCartoRectangle.d.ts +1 -1
- package/lib/esm/tile/map/MapCartoRectangle.js +2 -2
- package/lib/esm/tile/map/MapCartoRectangle.js.map +1 -1
- package/lib/esm/tile/map/MapLayerFormatRegistry.js +5 -6
- package/lib/esm/tile/map/MapLayerFormatRegistry.js.map +1 -1
- package/lib/esm/tile/map/MapLayerImageryFormats.js +11 -14
- package/lib/esm/tile/map/MapLayerImageryFormats.js.map +1 -1
- package/lib/esm/tile/map/MapLayerImageryProvider.js +2 -3
- package/lib/esm/tile/map/MapLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/MapLayerSources.js +1 -1
- package/lib/esm/tile/map/MapLayerSources.js.map +1 -1
- package/lib/esm/tile/map/MapTile.d.ts +10 -2
- package/lib/esm/tile/map/MapTile.d.ts.map +1 -1
- package/lib/esm/tile/map/MapTile.js +34 -12
- package/lib/esm/tile/map/MapTile.js.map +1 -1
- package/lib/esm/tile/map/MapTileLoader.js +1 -1
- package/lib/esm/tile/map/MapTileLoader.js.map +1 -1
- package/lib/esm/tile/map/MapTileTree.d.ts +3 -2
- package/lib/esm/tile/map/MapTileTree.d.ts.map +1 -1
- package/lib/esm/tile/map/MapTileTree.js +24 -26
- package/lib/esm/tile/map/MapTileTree.js.map +1 -1
- package/lib/esm/tile/map/MapTiledGraphicsProvider.js +6 -7
- package/lib/esm/tile/map/MapTiledGraphicsProvider.js.map +1 -1
- package/lib/esm/tile/map/MapTilingScheme.d.ts +1 -1
- package/lib/esm/tile/map/MapTilingScheme.js +1 -1
- package/lib/esm/tile/map/MapTilingScheme.js.map +1 -1
- package/lib/esm/tile/map/QuadId.d.ts +1 -1
- package/lib/esm/tile/map/QuadId.js +1 -1
- package/lib/esm/tile/map/QuadId.js.map +1 -1
- package/lib/esm/tile/map/TerrainMeshProvider.d.ts +9 -4
- package/lib/esm/tile/map/TerrainMeshProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/TerrainMeshProvider.js +6 -1
- package/lib/esm/tile/map/TerrainMeshProvider.js.map +1 -1
- package/lib/esm/tile/map/TerrainProvider.d.ts +2 -2
- package/lib/esm/tile/map/TerrainProvider.js +1 -1
- package/lib/esm/tile/map/TerrainProvider.js.map +1 -1
- package/lib/esm/tile/map/WmsCapabilities.js +4 -5
- package/lib/esm/tile/map/WmsCapabilities.js.map +1 -1
- package/lib/esm/tile/map/WmtsCapabilities.js +17 -25
- package/lib/esm/tile/map/WmtsCapabilities.js.map +1 -1
- package/lib/esm/tools/ClipViewTool.js +1 -1
- package/lib/esm/tools/ClipViewTool.js.map +1 -1
- package/lib/esm/tools/MeasureTool.js +2 -4
- package/lib/esm/tools/MeasureTool.js.map +1 -1
- package/lib/esm/tools/PrimitiveTool.js +2 -3
- package/lib/esm/tools/PrimitiveTool.js.map +1 -1
- package/lib/esm/tools/SelectTool.js +1 -2
- package/lib/esm/tools/SelectTool.js.map +1 -1
- package/lib/esm/tools/Tool.js +2 -3
- package/lib/esm/tools/Tool.js.map +1 -1
- package/lib/esm/tools/ToolAdmin.js +2 -4
- package/lib/esm/tools/ToolAdmin.js.map +1 -1
- package/lib/esm/tools/ViewTool.js +3 -3
- package/lib/esm/tools/ViewTool.js.map +1 -1
- package/package.json +24 -26
|
@@ -1 +1 @@
|
|
|
1
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AC;IAC5B,CAAC;IAED;;OAEG;IACI,oBAAoB,CAAC,MAAc,IAAU,CAAC;IAErD,eAAe;IACf,IAAW,4BAA4B,KAAyB,OAAO,SAAS,CAAC,CAAC,CAAC;CACpF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\nimport { BeTimePoint } from \"@itwin/core-bentley\";\r\nimport { ClipVector, Geometry, Map4d, Matrix4d, Point3d, Point4d, Range1d, Range3d, Transform, Vector3d } from \"@itwin/core-geometry\";\r\nimport { FeatureAppearanceProvider, FrustumPlanes, HiddenLine, ViewFlagOverrides } from \"@itwin/core-common\";\r\nimport { FeatureSymbology } from \"../render/FeatureSymbology\";\r\nimport { GraphicBranch } from \"../render/GraphicBranch\";\r\nimport { RenderClipVolume } from \"../render/RenderClipVolume\";\r\nimport { RenderGraphic } from \"../render/RenderGraphic\";\r\nimport { RenderPlanarClassifier } from \"../render/RenderPlanarClassifier\";\r\nimport { RenderTextureDrape } from \"../render/RenderSystem\";\r\nimport { SceneContext } from \"../ViewContext\";\r\nimport { ViewingSpace } from \"../ViewingSpace\";\r\nimport { CoordSystem } from \"../CoordSystem\";\r\nimport { Tile, TileGraphicType, TileTree } from \"./internal\";\r\n\r\nconst scratchRange = new Range3d();\r\nconst scratchPoint = Point3d.create();\r\nconst scratchPoint4d = Point4d.create();\r\nconst scratchXRange = Range1d.createNull();\r\nconst scratchYRange = Range1d.createNull();\r\nconst scratchMatrix4d = Matrix4d.createIdentity();\r\n\r\n/** Parameters used to construct [[TileDrawArgs]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface TileDrawArgParams {\r\n /** Context for the scene into which the tiles are to be rendered. */\r\n context: SceneContext;\r\n /** Transform to be applied when drawing the tiles. */\r\n location: Transform;\r\n /** The tile tree from which to obtain tiles. */\r\n tree: TileTree;\r\n /** The time at which these args were created. */\r\n now: BeTimePoint;\r\n /** Overrides to apply to the view's [ViewFlags]($common) when drawing the tiles. */\r\n viewFlagOverrides: ViewFlagOverrides;\r\n /** Clip volume used to clip the tiles. */\r\n clipVolume?: RenderClipVolume;\r\n /** True if a tile and its child tiles should not be drawn simultaneously. */\r\n parentsAndChildrenExclusive: boolean;\r\n /** Symbology overrides to apply to the tiles. */\r\n symbologyOverrides: FeatureSymbology.Overrides | undefined;\r\n /** Optionally customizes the view's symbology overrides for the tiles. */\r\n appearanceProvider?: FeatureAppearanceProvider;\r\n /** Optionally overrides the view's hidden line settings. */\r\n hiddenLineSettings?: HiddenLine.Settings;\r\n /** If defined, tiles should be culled if they do not intersect this clip. */\r\n intersectionClip?: ClipVector;\r\n /** If defined, the Id of a node in the scene's [RenderSchedule.Script]($common) that applies a transform to the graphics;\r\n * or \"0xffffffff\" for any node that does *not* apply a transform.\r\n * @internal\r\n */\r\n animationTransformNodeId?: number;\r\n /** If defined, a bounding range in tile tree coordinates outside of which tiles should not be selected. */\r\n boundingRange?: Range3d;\r\n /** @alpha */\r\n maximumScreenSpaceError?: number;\r\n}\r\n\r\n/**\r\n * Provides context used when selecting and drawing [[Tile]]s.\r\n * @see [[TileTree.selectTiles]]\r\n * @see [[TileTree.draw]]\r\n * @public\r\n * @extensions\r\n */\r\nexport class TileDrawArgs {\r\n /** Transform to the location in iModel coordinates at which the tiles are to be drawn. */\r\n public readonly location: Transform;\r\n /** The tile tree being drawn. */\r\n public readonly tree: TileTree;\r\n /** Optional clip volume applied to the tiles. */\r\n public clipVolume: RenderClipVolume | undefined;\r\n /** The context in which the tiles will be drawn, exposing, e.g., the [[Viewport]] and accepting [[RenderGraphic]]s to be drawn. */\r\n public readonly context: SceneContext;\r\n /** Describes the viewed volume. */\r\n public viewingSpace: ViewingSpace;\r\n /** Holds the tile graphics to be drawn. */\r\n public readonly graphics: GraphicBranch = new GraphicBranch();\r\n /** @internal */\r\n public readonly now: BeTimePoint;\r\n /** The planes of the viewing frustum, used for frustum culling. */\r\n protected _frustumPlanes?: FrustumPlanes;\r\n /** @internal */\r\n public planarClassifier?: RenderPlanarClassifier;\r\n /** @internal */\r\n public drape?: RenderTextureDrape;\r\n /** Optional clip volume applied to all tiles in the view. */\r\n public readonly viewClip?: ClipVector;\r\n /** True if a tile and its child tiles should not be drawn simultaneously. */\r\n public parentsAndChildrenExclusive: boolean;\r\n /** @internal */\r\n private _appearanceProvider?: FeatureAppearanceProvider;\r\n /** Optional overrides for the view's hidden line settings. */\r\n public hiddenLineSettings?: HiddenLine.Settings;\r\n /** Tiles that we want to draw and that are ready to draw. May not actually be selected, e.g. if sibling tiles are not yet ready. */\r\n public readonly readyTiles = new Set<Tile>();\r\n /** For perspective views, the view-Z of the near plane. */\r\n private readonly _nearFrontCenter?: Point3d;\r\n /** Overrides applied to the view's [ViewFlags]($common) when drawing the tiles. */\r\n public get viewFlagOverrides(): ViewFlagOverrides { return this.graphics.viewFlagOverrides; }\r\n /** If defined, replaces the view's own symbology overrides when drawing the tiles. */\r\n public get symbologyOverrides(): FeatureSymbology.Overrides | undefined { return this.graphics.symbologyOverrides; }\r\n /** If defined, tiles will be culled if they do not intersect this clip. */\r\n public intersectionClip?: ClipVector;\r\n /** If defined, a bounding range in tile tree coordinates outside of which tiles should not be selected. */\r\n public boundingRange?: Range3d;\r\n /** @internal */\r\n public readonly pixelSizeScaleFactor;\r\n /** @internal */\r\n public readonly animationTransformNodeId?: number;\r\n /** @alpha */\r\n public maximumScreenSpaceError;\r\n\r\n /** Compute the size in pixels of the specified tile at the point on its bounding sphere closest to the camera. */\r\n public getPixelSize(tile: Tile): number {\r\n const sizeFromProjection = this.getPixelSizeFromProjection(tile);\r\n if (undefined !== sizeFromProjection)\r\n return sizeFromProjection;\r\n\r\n const radius = this.getTileRadius(tile); // use a sphere to test pixel size. We don't know the orientation of the image within the bounding box.\r\n const center = this.getTileCenter(tile);\r\n\r\n const pixelSizeAtPt = this.computePixelSizeInMetersAtClosestPoint(center, radius);\r\n return 0 !== pixelSizeAtPt ? this.context.adjustPixelSizeForLOD(radius / pixelSizeAtPt) : 1.0e-3;\r\n }\r\n\r\n /** If the tile provides corners (from an OBB) then this produces most accurate representation of the tile size */\r\n private getPixelSizeFromProjection(tile: Tile): number | undefined {\r\n const sizeProjectionCorners = tile.getSizeProjectionCorners();\r\n if (!sizeProjectionCorners)\r\n return undefined;\r\n\r\n /* For maps or global reality models we use the projected screen rectangle rather than sphere to calculate pixel size to avoid excessive tiles at horizon. */\r\n const tileToView = this.worldToViewMap.transform0.multiplyMatrixMatrix(Matrix4d.createTransform(this.location, scratchMatrix4d), scratchMatrix4d);\r\n scratchXRange.setNull();\r\n scratchYRange.setNull();\r\n\r\n let behindEye = false;\r\n for (const corner of sizeProjectionCorners) {\r\n const viewCorner = tileToView.multiplyPoint3d(corner, 1, scratchPoint4d);\r\n if (viewCorner.w < 0.0) {\r\n behindEye = true;\r\n break;\r\n }\r\n\r\n scratchXRange.extendX(viewCorner.x / viewCorner.w);\r\n scratchYRange.extendX(viewCorner.y / viewCorner.w);\r\n }\r\n if (behindEye)\r\n return undefined;\r\n\r\n return scratchXRange.isNull ? 1.0E-3 : this.context.adjustPixelSizeForLOD(Math.sqrt(scratchXRange.length() * scratchYRange.length()));\r\n }\r\n\r\n /** Compute the size in meters of one pixel at the point on the tile's bounding sphere closest to the camera. */\r\n public getPixelSizeInMetersAtClosestPoint(tile: Tile): number {\r\n const radius = this.getTileRadius(tile); // use a sphere to test pixel size. We don't know the orientation of the image within the bounding box.\r\n const center = this.getTileCenter(tile);\r\n\r\n const pixelSizeAtPt = this.computePixelSizeInMetersAtClosestPoint(center, radius);\r\n return 0 !== pixelSizeAtPt ? this.context.adjustPixelSizeForLOD(pixelSizeAtPt) : 1.0e-3;\r\n }\r\n\r\n /** Compute the size in meters of one pixel at the point on a sphere closest to the camera.\r\n * Device scaling is not applied.\r\n */\r\n public computePixelSizeInMetersAtClosestPoint(center: Point3d, radius: number): number {\r\n if (this.context.viewport.view.is3d() && this.context.viewport.isCameraOn && this._nearFrontCenter) {\r\n const toFront = Vector3d.createStartEnd(center, this._nearFrontCenter);\r\n const viewZ = this.context.viewport.rotation.rowZ();\r\n // If the sphere overlaps the near front plane just use near front point. This also handles behind eye conditions.\r\n if (viewZ.dotProduct(toFront) < radius) {\r\n center = this._nearFrontCenter;\r\n } else {\r\n // Find point on sphere closest to eye.\r\n const toEye = center.unitVectorTo(this.context.viewport.view.camera.eye);\r\n\r\n if (toEye) { // Only if tile is not already behind the eye.\r\n toEye.scaleInPlace(radius);\r\n center.addInPlace(toEye);\r\n }\r\n }\r\n }\r\n\r\n const viewPt = this.worldToViewMap.transform0.multiplyPoint3dQuietNormalize(center);\r\n const viewPt2 = new Point3d(viewPt.x + 1.0, viewPt.y, viewPt.z);\r\n return this.worldToViewMap.transform1.multiplyPoint3dQuietNormalize(viewPt).distance(this.worldToViewMap.transform1.multiplyPoint3dQuietNormalize(viewPt2));\r\n }\r\n\r\n /** Compute this size of a sphere on screen in pixels */\r\n public getRangePixelSize(range: Range3d): number {\r\n const transformedRange = this.location.multiplyRange(range, scratchRange);\r\n const center = transformedRange.localXYZToWorld(.5, .5, .5, scratchPoint)!;\r\n const radius = transformedRange.diagonal().magnitude();\r\n\r\n const viewPt = this.worldToViewMap.transform0.multiplyPoint3dQuietNormalize(center);\r\n const viewPt2 = new Point3d(viewPt.x + 1.0, viewPt.y, viewPt.z);\r\n const pixelSizeAtPt = this.worldToViewMap.transform1.multiplyPoint3dQuietNormalize(viewPt).distance(this.worldToViewMap.transform1.multiplyPoint3dQuietNormalize(viewPt2));\r\n return 0 !== pixelSizeAtPt ? radius / pixelSizeAtPt : 1.0e-3;\r\n }\r\n\r\n /** @internal */\r\n public getTileGraphics(tile: Tile) {\r\n return tile.produceGraphics();\r\n }\r\n\r\n /** The planes of the viewing frustum, used for frustum culling. */\r\n public get frustumPlanes(): FrustumPlanes {\r\n return this._frustumPlanes !== undefined ? this._frustumPlanes : this.context.frustumPlanes;\r\n }\r\n\r\n /** Provides conversions between [[CoordSystem.World]] and [[CoordSystem.View]]. */\r\n public get worldToViewMap(): Map4d {\r\n return this.viewingSpace.worldToViewMap;\r\n }\r\n\r\n private computePixelSizeScaleFactor(): number {\r\n // Check to see if a model display transform with non-uniform scaling is being used.\r\n const mat = this.context.viewport.view.modelDisplayTransformProvider?.getModelDisplayTransform(this.tree.modelId)?.matrix;\r\n if (!mat)\r\n return 1;\r\n\r\n const scale = [0, 1, 2].map((x) => mat.getColumn(x).magnitude());\r\n if (Math.abs(scale[0] - scale[1]) <= Geometry.smallMetricDistance && Math.abs(scale[0] - scale[2]) <= Geometry.smallMetricDistance)\r\n return 1;\r\n\r\n // If the component with the largest scale is not the same as the component with the largest tile range use it to adjust the pixel size.\r\n const rangeDiag = this.tree.range.diagonal();\r\n let maxS = 0;\r\n let maxR = 0;\r\n if (scale[0] > scale[1])\r\n maxS = (scale[0] > scale[2] ? 0 : 2);\r\n else\r\n maxS = (scale[1] > scale[2] ? 1 : 2);\r\n\r\n if (rangeDiag.x > rangeDiag.y)\r\n maxR = (rangeDiag.x > rangeDiag.z ? 0 : 2);\r\n else\r\n maxR = (rangeDiag.y > rangeDiag.z ? 1 : 2);\r\n\r\n return maxS !== maxR ? scale[maxS] : 1;\r\n }\r\n\r\n /** Constructor */\r\n public constructor(params: TileDrawArgParams) {\r\n const { location, tree, context, now, viewFlagOverrides, clipVolume, parentsAndChildrenExclusive, symbologyOverrides } = params;\r\n this.location = location;\r\n this.tree = tree;\r\n this.context = context;\r\n this.now = now;\r\n this._appearanceProvider = params.appearanceProvider;\r\n this.hiddenLineSettings = params.hiddenLineSettings;\r\n this.animationTransformNodeId = params.animationTransformNodeId;\r\n this.boundingRange = params.boundingRange;\r\n this.maximumScreenSpaceError = params.maximumScreenSpaceError ?? 16; // 16 is Cesium's default.\r\n\r\n // Do not cull tiles based on clip volume if tiles outside clip are supposed to be drawn but in a different color.\r\n if (undefined !== clipVolume && !context.viewport.view.displayStyle.settings.clipStyle.outsideColor)\r\n this.clipVolume = clipVolume;\r\n\r\n this.graphics.setViewFlagOverrides(viewFlagOverrides);\r\n this.graphics.symbologyOverrides = symbologyOverrides;\r\n this.graphics.animationId = tree.modelId;\r\n\r\n this.viewingSpace = context.viewingSpace;\r\n this._frustumPlanes = FrustumPlanes.fromFrustum(this.viewingSpace.getFrustum());\r\n\r\n this.planarClassifier = context.getPlanarClassifierForModel(tree.modelId);\r\n this.drape = context.getTextureDrapeForModel(tree.modelId);\r\n\r\n // NB: If the tile tree has its own clip, do not also apply the view's clip.\r\n if (context.viewFlags.clipVolume && false !== viewFlagOverrides.clipVolume && undefined === clipVolume) {\r\n const outsideClipColor = context.viewport.displayStyle.settings.clipStyle.outsideColor;\r\n this.viewClip = undefined === outsideClipColor ? context.viewport.view.getViewClip() : undefined;\r\n }\r\n\r\n this.parentsAndChildrenExclusive = parentsAndChildrenExclusive;\r\n if (context.viewport.isCameraOn)\r\n this._nearFrontCenter = context.viewport.getFrustum(CoordSystem.World).frontCenter;\r\n\r\n this.pixelSizeScaleFactor = this.computePixelSizeScaleFactor();\r\n }\r\n\r\n /** A multiplier applied to a [[Tile]]'s `maximumSize` property to adjust level of detail.\r\n * @see [[Viewport.tileSizeModifier]].\r\n * @public\r\n */\r\n public get tileSizeModifier(): number { return this.context.viewport.tileSizeModifier; }\r\n\r\n /** @internal */\r\n public getTileCenter(tile: Tile): Point3d { return this.location.multiplyPoint3d(tile.center); }\r\n\r\n /** @internal */\r\n public getTileRadius(tile: Tile): number {\r\n let range: Range3d = tile.range.clone(scratchRange);\r\n if (tile.tree.is2d) {\r\n // 2d tiles have a fixed Z range of [-1, 1]. Sometimes (e.g., hypermodeling) we draw them within a 3d view. Prevent Z from artificially expanding the radius.\r\n range.low.z = range.high.z = 0;\r\n }\r\n\r\n range = this.location.multiplyRange(range, range);\r\n return 0.5 * range.low.distance(range.high);\r\n }\r\n\r\n /** @internal */\r\n public get clip(): ClipVector | undefined {\r\n return undefined !== this.clipVolume ? this.clipVolume.clipVector : undefined;\r\n }\r\n\r\n /** Add a provider to supplement or override the symbology overrides for the view.\r\n * @note If a provider already exists, the new provider will be chained such that it sees the base overrides\r\n * after they have potentially been modified by the existing provider.\r\n * @public\r\n */\r\n public addAppearanceProvider(provider: FeatureAppearanceProvider): void {\r\n this._appearanceProvider = this._appearanceProvider ? FeatureAppearanceProvider.chain(this._appearanceProvider, provider) : provider;\r\n }\r\n\r\n /** Optionally customizes aspects of the view's [[FeatureSymbology.Overrides]]. */\r\n public get appearanceProvider(): FeatureAppearanceProvider | undefined {\r\n return this._appearanceProvider;\r\n }\r\n\r\n /** @internal */\r\n public produceGraphics(): RenderGraphic | undefined {\r\n return this._produceGraphicBranch(this.graphics);\r\n }\r\n /** @internal */\r\n public get secondaryClassifiers(): Map<number, RenderPlanarClassifier>| undefined {\r\n return undefined;\r\n }\r\n\r\n /** @internal */\r\n private _produceGraphicBranch(graphics: GraphicBranch): RenderGraphic | undefined {\r\n if (graphics.isEmpty)\r\n return undefined;\r\n\r\n const opts = {\r\n iModel: this.tree.iModel,\r\n clipVolume: this.clipVolume,\r\n classifierOrDrape: this.planarClassifier ?? this.drape,\r\n appearanceProvider: this.appearanceProvider,\r\n hline: this.hiddenLineSettings,\r\n secondaryClassifiers: this.secondaryClassifiers,\r\n };\r\n\r\n let graphic = this.context.createGraphicBranch(graphics, this.location, opts);\r\n if (undefined !== this.animationTransformNodeId)\r\n graphic = this.context.renderSystem.createAnimationTransformNode(graphic, this.animationTransformNodeId);\r\n\r\n return graphic;\r\n }\r\n\r\n /** Output graphics for all accumulated tiles. */\r\n public drawGraphics(): void {\r\n const graphics = this.produceGraphics();\r\n if (undefined !== graphics)\r\n this.context.outputGraphic(graphics);\r\n }\r\n\r\n /** Output graphics of the specified type for all accumulated tiles. */\r\n public drawGraphicsWithType(graphicType: TileGraphicType, graphics: GraphicBranch): void {\r\n const branch = this._produceGraphicBranch(graphics);\r\n if (undefined !== branch)\r\n this.context.withGraphicType(graphicType, () => this.context.outputGraphic(branch));\r\n }\r\n\r\n /** Indicate that graphics for the specified tile are desired but not yet available. Subsequently a request will be enqueued to load the tile's graphics. */\r\n public insertMissing(tile: Tile): void {\r\n this.context.insertMissingTile(tile);\r\n }\r\n\r\n /** Indicate that some requested child tiles are not yet loaded. */\r\n public markChildrenLoading(): void {\r\n this.context.markChildrenLoading();\r\n }\r\n\r\n /** Indicate that the specified tile is being used for some purpose by the [[SceneContext]]'s [[Viewport]]. Typically \"used\" means \"displayed\", but the exact meaning is up to the [[TileTree]] - for example, \"used\" might also mean that the tile's children are being used. A tile that is \"in use\" by any [[Viewport]] will not be discarded. */\r\n public markUsed(tile: Tile): void {\r\n tile.usageMarker.mark(this.context.viewport, this.now);\r\n }\r\n\r\n /** Indicate that the specified tile should be displayed and that its graphics are ready to be displayed. The number of \"ready\" tiles is used in conjunction with the number of \"missing\" tiles to convey to the user how complete the current view is.\r\n * @see [[insertMissing]]\r\n */\r\n public markReady(tile: Tile): void {\r\n this.readyTiles.add(tile);\r\n }\r\n\r\n /** Invoked by [[TileTree.selectTiles]]. This exists chiefly for [[SolarShadowMap]].\r\n * @internal\r\n */\r\n public processSelectedTiles(_tiles: Tile[]): void { }\r\n\r\n /* @internal */\r\n public get maxRealityTreeSelectionCount(): number | undefined { return undefined; }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"TileDrawArgs.js","sourceRoot":"","sources":["../../../src/tile/TileDrawArgs.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAc,QAAQ,EAAS,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAa,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACtI,OAAO,EAAE,yBAAyB,EAAE,aAAa,EAAiC,MAAM,oBAAoB,CAAC;AAE7G,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAOxD,OAA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xB,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC;IAED,uEAAuE;IAChE,oBAAoB,CAAC,WAA4B,EAAE,QAAuB;QAC/E,MAAM,MAAM,GAAG,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;QACpD,IAAI,SAAS,KAAK,MAAM;YACtB,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IACxF,CAAC;IAED,4JAA4J;IACrJ,aAAa,CAAC,IAAU;QAC7B,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAED,mEAAmE;IAC5D,mBAAmB;QACxB,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC;IACrC,CAAC;IAED,oVAAoV;IAC7U,QAAQ,CAAC,IAAU;QACxB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACzD,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,IAAU;QACzB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED;;OAEG;IACI,oBAAoB,CAAC,MAAc,IAAU,CAAC;IAErD,eAAe;IACf,IAAW,4BAA4B,KAAyB,OAAO,SAAS,CAAC,CAAC,CAAC;CACpF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\nimport { BeTimePoint } from \"@itwin/core-bentley\";\r\nimport { ClipVector, Geometry, Map4d, Matrix4d, Point3d, Point4d, Range1d, Range3d, Transform, Vector3d } from \"@itwin/core-geometry\";\r\nimport { FeatureAppearanceProvider, FrustumPlanes, HiddenLine, ViewFlagOverrides } from \"@itwin/core-common\";\r\nimport { FeatureSymbology } from \"../render/FeatureSymbology\";\r\nimport { GraphicBranch } from \"../render/GraphicBranch\";\r\nimport { RenderClipVolume } from \"../render/RenderClipVolume\";\r\nimport { RenderGraphic } from \"../render/RenderGraphic\";\r\nimport { RenderPlanarClassifier } from \"../render/RenderPlanarClassifier\";\r\nimport { RenderTextureDrape } from \"../render/RenderSystem\";\r\nimport { SceneContext } from \"../ViewContext\";\r\nimport { ViewingSpace } from \"../ViewingSpace\";\r\nimport { CoordSystem } from \"../CoordSystem\";\r\nimport { Tile, TileGraphicType, TileTree } from \"./internal\";\r\n\r\nconst scratchRange = new Range3d();\r\nconst scratchPoint = Point3d.create();\r\nconst scratchPoint4d = Point4d.create();\r\nconst scratchXRange = Range1d.createNull();\r\nconst scratchYRange = Range1d.createNull();\r\nconst scratchMatrix4d = Matrix4d.createIdentity();\r\n\r\n/** Parameters used to construct [[TileDrawArgs]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface TileDrawArgParams {\r\n /** Context for the scene into which the tiles are to be rendered. */\r\n context: SceneContext;\r\n /** Transform to be applied when drawing the tiles. */\r\n location: Transform;\r\n /** The tile tree from which to obtain tiles. */\r\n tree: TileTree;\r\n /** The time at which these args were created. */\r\n now: BeTimePoint;\r\n /** Overrides to apply to the view's [ViewFlags]($common) when drawing the tiles. */\r\n viewFlagOverrides: ViewFlagOverrides;\r\n /** Clip volume used to clip the tiles. */\r\n clipVolume?: RenderClipVolume;\r\n /** True if a tile and its child tiles should not be drawn simultaneously. */\r\n parentsAndChildrenExclusive: boolean;\r\n /** Symbology overrides to apply to the tiles. */\r\n symbologyOverrides: FeatureSymbology.Overrides | undefined;\r\n /** Optionally customizes the view's symbology overrides for the tiles. */\r\n appearanceProvider?: FeatureAppearanceProvider;\r\n /** Optionally overrides the view's hidden line settings. */\r\n hiddenLineSettings?: HiddenLine.Settings;\r\n /** If defined, tiles should be culled if they do not intersect this clip. */\r\n intersectionClip?: ClipVector;\r\n /** If defined, the Id of a node in the scene's [RenderSchedule.Script]($common) that applies a transform to the graphics;\r\n * or \"0xffffffff\" for any node that does *not* apply a transform.\r\n * @internal\r\n */\r\n animationTransformNodeId?: number;\r\n /** If defined, a bounding range in tile tree coordinates outside of which tiles should not be selected. */\r\n boundingRange?: Range3d;\r\n /** @alpha */\r\n maximumScreenSpaceError?: number;\r\n}\r\n\r\n/**\r\n * Provides context used when selecting and drawing [[Tile]]s.\r\n * @see [[TileTree.selectTiles]]\r\n * @see [[TileTree.draw]]\r\n * @public\r\n * @extensions\r\n */\r\nexport class TileDrawArgs {\r\n /** Transform to the location in iModel coordinates at which the tiles are to be drawn. */\r\n public readonly location: Transform;\r\n /** The tile tree being drawn. */\r\n public readonly tree: TileTree;\r\n /** Optional clip volume applied to the tiles. */\r\n public clipVolume: RenderClipVolume | undefined;\r\n /** The context in which the tiles will be drawn, exposing, e.g., the [[Viewport]] and accepting [[RenderGraphic]]s to be drawn. */\r\n public readonly context: SceneContext;\r\n /** Describes the viewed volume. */\r\n public viewingSpace: ViewingSpace;\r\n /** Holds the tile graphics to be drawn. */\r\n public readonly graphics: GraphicBranch = new GraphicBranch();\r\n /** @internal */\r\n public readonly now: BeTimePoint;\r\n /** The planes of the viewing frustum, used for frustum culling. */\r\n protected _frustumPlanes?: FrustumPlanes;\r\n /** @internal */\r\n public planarClassifier?: RenderPlanarClassifier;\r\n /** @internal */\r\n public drape?: RenderTextureDrape;\r\n /** Optional clip volume applied to all tiles in the view. */\r\n public readonly viewClip?: ClipVector;\r\n /** True if a tile and its child tiles should not be drawn simultaneously. */\r\n public parentsAndChildrenExclusive: boolean;\r\n /** @internal */\r\n private _appearanceProvider?: FeatureAppearanceProvider;\r\n /** Optional overrides for the view's hidden line settings. */\r\n public hiddenLineSettings?: HiddenLine.Settings;\r\n /** Tiles that we want to draw and that are ready to draw. May not actually be selected, e.g. if sibling tiles are not yet ready. */\r\n public readonly readyTiles = new Set<Tile>();\r\n /** For perspective views, the view-Z of the near plane. */\r\n private readonly _nearFrontCenter?: Point3d;\r\n /** Overrides applied to the view's [ViewFlags]($common) when drawing the tiles. */\r\n public get viewFlagOverrides(): ViewFlagOverrides { return this.graphics.viewFlagOverrides; }\r\n /** If defined, replaces the view's own symbology overrides when drawing the tiles. */\r\n public get symbologyOverrides(): FeatureSymbology.Overrides | undefined { return this.graphics.symbologyOverrides; }\r\n /** If defined, tiles will be culled if they do not intersect this clip. */\r\n public intersectionClip?: ClipVector;\r\n /** If defined, a bounding range in tile tree coordinates outside of which tiles should not be selected. */\r\n public boundingRange?: Range3d;\r\n /** @internal */\r\n public readonly pixelSizeScaleFactor;\r\n /** @internal */\r\n public readonly animationTransformNodeId?: number;\r\n /** @alpha */\r\n public maximumScreenSpaceError;\r\n\r\n /** Compute the size in pixels of the specified tile at the point on its bounding sphere closest to the camera. */\r\n public getPixelSize(tile: Tile): number {\r\n const sizeFromProjection = this.getPixelSizeFromProjection(tile);\r\n if (undefined !== sizeFromProjection)\r\n return sizeFromProjection;\r\n\r\n const radius = this.getTileRadius(tile); // use a sphere to test pixel size. We don't know the orientation of the image within the bounding box.\r\n const center = this.getTileCenter(tile);\r\n\r\n const pixelSizeAtPt = this.computePixelSizeInMetersAtClosestPoint(center, radius);\r\n return 0 !== pixelSizeAtPt ? this.context.adjustPixelSizeForLOD(radius / pixelSizeAtPt) : 1.0e-3;\r\n }\r\n\r\n /** If the tile provides corners (from an OBB) then this produces most accurate representation of the tile size */\r\n private getPixelSizeFromProjection(tile: Tile): number | undefined {\r\n const sizeProjectionCorners = tile.getSizeProjectionCorners();\r\n if (!sizeProjectionCorners)\r\n return undefined;\r\n\r\n /* For maps or global reality models we use the projected screen rectangle rather than sphere to calculate pixel size to avoid excessive tiles at horizon. */\r\n const tileToView = this.worldToViewMap.transform0.multiplyMatrixMatrix(Matrix4d.createTransform(this.location, scratchMatrix4d), scratchMatrix4d);\r\n scratchXRange.setNull();\r\n scratchYRange.setNull();\r\n\r\n let behindEye = false;\r\n for (const corner of sizeProjectionCorners) {\r\n const viewCorner = tileToView.multiplyPoint3d(corner, 1, scratchPoint4d);\r\n if (viewCorner.w < 0.0) {\r\n behindEye = true;\r\n break;\r\n }\r\n\r\n scratchXRange.extendX(viewCorner.x / viewCorner.w);\r\n scratchYRange.extendX(viewCorner.y / viewCorner.w);\r\n }\r\n if (behindEye)\r\n return undefined;\r\n\r\n return scratchXRange.isNull ? 1.0E-3 : this.context.adjustPixelSizeForLOD(Math.sqrt(scratchXRange.length() * scratchYRange.length()));\r\n }\r\n\r\n /** Compute the size in meters of one pixel at the point on the tile's bounding sphere closest to the camera. */\r\n public getPixelSizeInMetersAtClosestPoint(tile: Tile): number {\r\n const radius = this.getTileRadius(tile); // use a sphere to test pixel size. We don't know the orientation of the image within the bounding box.\r\n const center = this.getTileCenter(tile);\r\n\r\n const pixelSizeAtPt = this.computePixelSizeInMetersAtClosestPoint(center, radius);\r\n return 0 !== pixelSizeAtPt ? this.context.adjustPixelSizeForLOD(pixelSizeAtPt) : 1.0e-3;\r\n }\r\n\r\n /** Compute the size in meters of one pixel at the point on a sphere closest to the camera.\r\n * Device scaling is not applied.\r\n */\r\n public computePixelSizeInMetersAtClosestPoint(center: Point3d, radius: number): number {\r\n if (this.context.viewport.view.is3d() && this.context.viewport.isCameraOn && this._nearFrontCenter) {\r\n const toFront = Vector3d.createStartEnd(center, this._nearFrontCenter);\r\n const viewZ = this.context.viewport.rotation.rowZ();\r\n // If the sphere overlaps the near front plane just use near front point. This also handles behind eye conditions.\r\n if (viewZ.dotProduct(toFront) < radius) {\r\n center = this._nearFrontCenter;\r\n } else {\r\n // Find point on sphere closest to eye.\r\n const toEye = center.unitVectorTo(this.context.viewport.view.camera.eye);\r\n\r\n if (toEye) { // Only if tile is not already behind the eye.\r\n toEye.scaleInPlace(radius);\r\n center.addInPlace(toEye);\r\n }\r\n }\r\n }\r\n\r\n const viewPt = this.worldToViewMap.transform0.multiplyPoint3dQuietNormalize(center);\r\n const viewPt2 = new Point3d(viewPt.x + 1.0, viewPt.y, viewPt.z);\r\n return this.worldToViewMap.transform1.multiplyPoint3dQuietNormalize(viewPt).distance(this.worldToViewMap.transform1.multiplyPoint3dQuietNormalize(viewPt2));\r\n }\r\n\r\n /** Compute this size of a sphere on screen in pixels */\r\n public getRangePixelSize(range: Range3d): number {\r\n const transformedRange = this.location.multiplyRange(range, scratchRange);\r\n const center = transformedRange.localXYZToWorld(.5, .5, .5, scratchPoint)!;\r\n const radius = transformedRange.diagonal().magnitude();\r\n\r\n const viewPt = this.worldToViewMap.transform0.multiplyPoint3dQuietNormalize(center);\r\n const viewPt2 = new Point3d(viewPt.x + 1.0, viewPt.y, viewPt.z);\r\n const pixelSizeAtPt = this.worldToViewMap.transform1.multiplyPoint3dQuietNormalize(viewPt).distance(this.worldToViewMap.transform1.multiplyPoint3dQuietNormalize(viewPt2));\r\n return 0 !== pixelSizeAtPt ? radius / pixelSizeAtPt : 1.0e-3;\r\n }\r\n\r\n /** @internal */\r\n public getTileGraphics(tile: Tile) {\r\n return tile.produceGraphics();\r\n }\r\n\r\n /** The planes of the viewing frustum, used for frustum culling. */\r\n public get frustumPlanes(): FrustumPlanes {\r\n return this._frustumPlanes !== undefined ? this._frustumPlanes : this.context.frustumPlanes;\r\n }\r\n\r\n /** Provides conversions between [[CoordSystem.World]] and [[CoordSystem.View]]. */\r\n public get worldToViewMap(): Map4d {\r\n return this.viewingSpace.worldToViewMap;\r\n }\r\n\r\n private computePixelSizeScaleFactor(): number {\r\n // Check to see if a model display transform with non-uniform scaling is being used.\r\n const mat = this.context.viewport.view.modelDisplayTransformProvider?.getModelDisplayTransform(this.tree.modelId)?.matrix;\r\n if (!mat)\r\n return 1;\r\n\r\n const scale = [0, 1, 2].map((x) => mat.getColumn(x).magnitude());\r\n if (Math.abs(scale[0] - scale[1]) <= Geometry.smallMetricDistance && Math.abs(scale[0] - scale[2]) <= Geometry.smallMetricDistance)\r\n return 1;\r\n\r\n // If the component with the largest scale is not the same as the component with the largest tile range use it to adjust the pixel size.\r\n const rangeDiag = this.tree.range.diagonal();\r\n let maxS = 0;\r\n let maxR = 0;\r\n if (scale[0] > scale[1])\r\n maxS = (scale[0] > scale[2] ? 0 : 2);\r\n else\r\n maxS = (scale[1] > scale[2] ? 1 : 2);\r\n\r\n if (rangeDiag.x > rangeDiag.y)\r\n maxR = (rangeDiag.x > rangeDiag.z ? 0 : 2);\r\n else\r\n maxR = (rangeDiag.y > rangeDiag.z ? 1 : 2);\r\n\r\n return maxS !== maxR ? scale[maxS] : 1;\r\n }\r\n\r\n /** Constructor */\r\n public constructor(params: TileDrawArgParams) {\r\n const { location, tree, context, now, viewFlagOverrides, clipVolume, parentsAndChildrenExclusive, symbologyOverrides } = params;\r\n this.location = location;\r\n this.tree = tree;\r\n this.context = context;\r\n this.now = now;\r\n this._appearanceProvider = params.appearanceProvider;\r\n this.hiddenLineSettings = params.hiddenLineSettings;\r\n this.animationTransformNodeId = params.animationTransformNodeId;\r\n this.boundingRange = params.boundingRange;\r\n this.maximumScreenSpaceError = params.maximumScreenSpaceError ?? 16; // 16 is Cesium's default.\r\n\r\n // Do not cull tiles based on clip volume if tiles outside clip are supposed to be drawn but in a different color.\r\n if (undefined !== clipVolume && !context.viewport.view.displayStyle.settings.clipStyle.outsideColor)\r\n this.clipVolume = clipVolume;\r\n\r\n this.graphics.setViewFlagOverrides(viewFlagOverrides);\r\n this.graphics.symbologyOverrides = symbologyOverrides;\r\n this.graphics.animationId = tree.modelId;\r\n\r\n this.viewingSpace = context.viewingSpace;\r\n this._frustumPlanes = FrustumPlanes.fromFrustum(this.viewingSpace.getFrustum());\r\n\r\n this.planarClassifier = context.getPlanarClassifierForModel(tree.modelId);\r\n this.drape = context.getTextureDrapeForModel(tree.modelId);\r\n\r\n // NB: If the tile tree has its own clip, do not also apply the view's clip.\r\n if (context.viewFlags.clipVolume && false !== viewFlagOverrides.clipVolume && undefined === clipVolume) {\r\n const outsideClipColor = context.viewport.displayStyle.settings.clipStyle.outsideColor;\r\n this.viewClip = undefined === outsideClipColor ? context.viewport.view.getViewClip() : undefined;\r\n }\r\n\r\n this.parentsAndChildrenExclusive = parentsAndChildrenExclusive;\r\n if (context.viewport.isCameraOn)\r\n this._nearFrontCenter = context.viewport.getFrustum(CoordSystem.World).frontCenter;\r\n\r\n this.pixelSizeScaleFactor = this.computePixelSizeScaleFactor();\r\n }\r\n\r\n /** A multiplier applied to a [[Tile]]'s `maximumSize` property to adjust level of detail.\r\n * @see [[Viewport.tileSizeModifier]].\r\n * @public\r\n */\r\n public get tileSizeModifier(): number { return this.context.viewport.tileSizeModifier; }\r\n\r\n /** @internal */\r\n public getTileCenter(tile: Tile): Point3d { return this.location.multiplyPoint3d(tile.center); }\r\n\r\n /** @internal */\r\n public getTileRadius(tile: Tile): number {\r\n let range: Range3d = tile.range.clone(scratchRange);\r\n if (tile.tree.is2d) {\r\n // 2d tiles have a fixed Z range of [-1, 1]. Sometimes (e.g., hypermodeling) we draw them within a 3d view. Prevent Z from artificially expanding the radius.\r\n range.low.z = range.high.z = 0;\r\n }\r\n\r\n range = this.location.multiplyRange(range, range);\r\n return 0.5 * range.low.distance(range.high);\r\n }\r\n\r\n /** @internal */\r\n public get clip(): ClipVector | undefined {\r\n return undefined !== this.clipVolume ? this.clipVolume.clipVector : undefined;\r\n }\r\n\r\n /** Add a provider to supplement or override the symbology overrides for the view.\r\n * @note If a provider already exists, the new provider will be chained such that it sees the base overrides\r\n * after they have potentially been modified by the existing provider.\r\n * @public\r\n */\r\n public addAppearanceProvider(provider: FeatureAppearanceProvider): void {\r\n this._appearanceProvider = this._appearanceProvider ? FeatureAppearanceProvider.chain(this._appearanceProvider, provider) : provider;\r\n }\r\n\r\n /** Optionally customizes aspects of the view's [[FeatureSymbology.Overrides]]. */\r\n public get appearanceProvider(): FeatureAppearanceProvider | undefined {\r\n return this._appearanceProvider;\r\n }\r\n\r\n /** @internal */\r\n public produceGraphics(): RenderGraphic | undefined {\r\n return this._produceGraphicBranch(this.graphics);\r\n }\r\n /** @internal */\r\n public get secondaryClassifiers(): Map<number, RenderPlanarClassifier>| undefined {\r\n return undefined;\r\n }\r\n\r\n /** @internal */\r\n private _produceGraphicBranch(graphics: GraphicBranch): RenderGraphic | undefined {\r\n if (graphics.isEmpty)\r\n return undefined;\r\n\r\n const opts = {\r\n iModel: this.tree.iModel,\r\n clipVolume: this.clipVolume,\r\n classifierOrDrape: this.planarClassifier ?? this.drape,\r\n appearanceProvider: this.appearanceProvider,\r\n hline: this.hiddenLineSettings,\r\n secondaryClassifiers: this.secondaryClassifiers,\r\n };\r\n\r\n let graphic = this.context.createGraphicBranch(graphics, this.location, opts);\r\n if (undefined !== this.animationTransformNodeId)\r\n graphic = this.context.renderSystem.createAnimationTransformNode(graphic, this.animationTransformNodeId);\r\n\r\n return graphic;\r\n }\r\n\r\n /** Output graphics for all accumulated tiles. */\r\n public drawGraphics(): void {\r\n const graphics = this.produceGraphics();\r\n if (undefined !== graphics)\r\n this.context.outputGraphic(graphics);\r\n }\r\n\r\n /** Output graphics of the specified type for all accumulated tiles. */\r\n public drawGraphicsWithType(graphicType: TileGraphicType, graphics: GraphicBranch): void {\r\n const branch = this._produceGraphicBranch(graphics);\r\n if (undefined !== branch)\r\n this.context.withGraphicType(graphicType, () => this.context.outputGraphic(branch));\r\n }\r\n\r\n /** Indicate that graphics for the specified tile are desired but not yet available. Subsequently a request will be enqueued to load the tile's graphics. */\r\n public insertMissing(tile: Tile): void {\r\n this.context.insertMissingTile(tile);\r\n }\r\n\r\n /** Indicate that some requested child tiles are not yet loaded. */\r\n public markChildrenLoading(): void {\r\n this.context.markChildrenLoading();\r\n }\r\n\r\n /** Indicate that the specified tile is being used for some purpose by the [[SceneContext]]'s [[Viewport]]. Typically \"used\" means \"displayed\", but the exact meaning is up to the [[TileTree]] - for example, \"used\" might also mean that the tile's children are being used. A tile that is \"in use\" by any [[Viewport]] will not be discarded. */\r\n public markUsed(tile: Tile): void {\r\n tile.usageMarker.mark(this.context.viewport, this.now);\r\n }\r\n\r\n /** Indicate that the specified tile should be displayed and that its graphics are ready to be displayed. The number of \"ready\" tiles is used in conjunction with the number of \"missing\" tiles to convey to the user how complete the current view is.\r\n * @see [[insertMissing]]\r\n */\r\n public markReady(tile: Tile): void {\r\n this.readyTiles.add(tile);\r\n }\r\n\r\n /** Invoked by [[TileTree.selectTiles]]. This exists chiefly for [[SolarShadowMap]].\r\n * @internal\r\n */\r\n public processSelectedTiles(_tiles: Tile[]): void { }\r\n\r\n /* @internal */\r\n public get maxRealityTreeSelectionCount(): number | undefined { return undefined; }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TileRequest.d.ts","sourceRoot":"","sources":["../../../src/tile/TileRequest.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,IAAI,EAAE,WAAW,EAAE,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE5G;;;;GAIG;AACH,qBAAa,WAAW;IACtB,kHAAkH;IAClH,SAAgB,IAAI,EAAE,IAAI,CAAC;IAC3B,0DAA0D;IAC1D,SAAgB,OAAO,EAAE,kBAAkB,CAAC;IAC5C;;OAEG;IACI,KAAK,EAAE,mBAAmB,CAAC;IAClC,OAAO,CAAC,MAAM,CAAoB;IAClC,kLAAkL;IAC3K,QAAQ,SAAK;IAEpB,kBAAkB;gBACC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ;IAO7C,8JAA8J;IAC9J,IAAW,SAAS,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAEzC;IAED,mCAAmC;IACnC,IAAW,KAAK,IAAI,WAAW,CAA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IAAI,WAAW,CAAC,KAAK,CAAwB;IAE7D,oEAAoE;IACpE,IAAW,QAAQ,YAAuD;IAE1E,6CAA6C;IAC7C,IAAW,UAAU,IAAI,OAAO,CAW/B;IAED,6DAA6D;IAC7D,IAAW,IAAI,IAAI,QAAQ,CAA2B;IAEtD;;OAEG;IACI,OAAO,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI;IAIpC;;;OAGG;IACU,QAAQ,CAAC,cAAc,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IA0ChE;;OAEG;IACI,MAAM,IAAI,IAAI;IAQrB,gJAAgJ;IAChJ,OAAO,CAAC,MAAM;IAOd,oHAAoH;IACpH,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,SAAS;IAOjB,8FAA8F;YAChF,cAAc;CAwC7B;AAED,cAAc;AACd,yBAAiB,WAAW,CAAC;IAC3B;;;;OAIG;IACH,KAAY,QAAQ,GAAG,UAAU,GAAG,WAAW,GAAG,MAAM,GAAG,WAAW,GAAG;QAAE,OAAO,EAAE,WAAW,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,GAAG,CAAA;KAAE,GAAG,SAAS,CAAC;IAE9H;;OAEG;IACH,KAAY,YAAY,GAAG,UAAU,GAAG,WAAW,GAAG;QAAE,IAAI,EAAE,GAAG,CAAA;KAAE,CAAC;IAEpE;;;OAGG;IACH,KAAY,KAAK;QACf,gEAAgE;QAChE,MAAM,IAAA;QACN,qEAAqE;QACrE,UAAU,IAAA;QACV,mGAAmG;QACnG,OAAO,IAAA;QACP,0EAA0E;QAC1E,SAAS,IAAA;QACT,0GAA0G;QAC1G,MAAM,IAAA;KACP;CACF"}
|
|
@@ -143,6 +143,7 @@ export class TileRequest {
|
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
145
|
try {
|
|
146
|
+
const start = Date.now();
|
|
146
147
|
if (!content) {
|
|
147
148
|
assert(undefined !== data);
|
|
148
149
|
content = await this.tile.readContent(data, IModelApp.renderSystem, () => this.isCanceled);
|
|
@@ -152,7 +153,7 @@ export class TileRequest {
|
|
|
152
153
|
this._state = TileRequest.State.Completed;
|
|
153
154
|
this.tile.setContent(content);
|
|
154
155
|
this.notifyAndClear();
|
|
155
|
-
this.channel.recordCompletion(this.tile, content);
|
|
156
|
+
this.channel.recordCompletion(this.tile, content, Date.now() - start);
|
|
156
157
|
}
|
|
157
158
|
catch (_err) {
|
|
158
159
|
this.setFailed();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TileRequest.js","sourceRoot":"","sources":["../../../src/tile/TileRequest.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAwE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE5G;;;;GAIG;AACH,MAAM,OAAO,WAAW;IAatB,kBAAkB;IAClB,YAAmB,IAAU,EAAE,IAAc;QAJ7C,kLAAkL;QAC3K,aAAQ,GAAG,CAAC,CAAC;QAIlB,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC;QACvC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,SAAS,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;IAClE,CAAC;IAED,8JAA8J;IAC9J,IAAW,SAAS;QAClB,OAAO,QAAQ,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;IAED,mCAAmC;IACnC,IAAW,KAAK,KAAwB,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAA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,IAAI,CAAC,CAAC;gBAC3B,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,SAAS,CAAC,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;gBAC3F,IAAI,IAAI,CAAC,UAAU;oBACjB,OAAO;aACV;YAED,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC;YAC1C,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YAC9B,IAAI,CAAC,cAAc,EAAE,CAAC;YACtB,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;SACnD;QAAC,OAAO,IAAI,EAAE;YACb,IAAI,CAAC,SAAS,EAAE,CAAC;SAClB;IACH,CAAC;CACF;AAED,cAAc;AACd,WAAiB,WAAW;IAa1B;;;OAGG;IACH,IAAY,KAWX;IAXD,WAAY,KAAK;QACf,gEAAgE;QAChE,qCAAM,CAAA;QACN,qEAAqE;QACrE,6CAAU,CAAA;QACV,mGAAmG;QACnG,uCAAO,CAAA;QACP,0EAA0E;QAC1E,2CAAS,CAAA;QACT,0GAA0G;QAC1G,qCAAM,CAAA;IACR,CAAC,EAXW,KAAK,GAAL,iBAAK,KAAL,iBAAK,QAWhB;AACH,CAAC,EA7BgB,WAAW,KAAX,WAAW,QA6B3B","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\nimport { assert, base64StringToUint8Array, IModelStatus } from \"@itwin/core-bentley\";\r\nimport { ImageSource } from \"@itwin/core-common\";\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport { Viewport } from \"../Viewport\";\r\nimport { ReadonlyTileUserSet, Tile, TileContent, TileRequestChannel, TileTree, TileUser } from \"./internal\";\r\n\r\n/** Represents a pending or active request to load the contents of a [[Tile]]. The request coordinates with the [[Tile.requestContent]] to obtain the raw content and\r\n * [[Tile.readContent]] to convert the result into a [[RenderGraphic]]. TileRequests are created internally as needed; it is never necessary or useful for external code to create them.\r\n * @public\r\n * @extensions\r\n */\r\nexport class TileRequest {\r\n /** The requested tile. While the request is pending or active, `tile.request` points back to this TileRequest. */\r\n public readonly tile: Tile;\r\n /** The channel via which the request will be executed. */\r\n public readonly channel: TileRequestChannel;\r\n /** The set of [[TileUser]]s that are awaiting the result of this request. When this becomes empty, the request is canceled because no user cares about it.\r\n * @internal\r\n */\r\n public users: ReadonlyTileUserSet;\r\n private _state: TileRequest.State;\r\n /** Determines the order in which pending requests are pulled off the queue to become active. A tile with a lower priority value takes precedence over one with a higher value. */\r\n public priority = 0;\r\n\r\n /** Constructor */\r\n public constructor(tile: Tile, user: TileUser) {\r\n this._state = TileRequest.State.Queued;\r\n this.tile = tile;\r\n this.channel = tile.channel;\r\n this.users = IModelApp.tileAdmin.getTileUserSetForRequest(user);\r\n }\r\n\r\n /** The set of [[Viewport]]s that are awaiting the result of this request. When this becomes empty, the request is canceled because no user cares about it. */\r\n public get viewports(): Iterable<Viewport> {\r\n return TileUser.viewportsFromUsers(this.users);\r\n }\r\n\r\n /** The request's current state. */\r\n public get state(): TileRequest.State { return this._state; }\r\n\r\n /** True if the request has been enqueued but not yet dispatched. */\r\n public get isQueued() { return TileRequest.State.Queued === this._state; }\r\n\r\n /** True if the request has been canceled. */\r\n public get isCanceled(): boolean {\r\n // If iModel was closed, cancel immediately\r\n if (this.tile.iModel.tiles.isDisposed)\r\n return true;\r\n\r\n // After we've received the raw tile data, always finish processing it - otherwise tile may end up in limbo (and producing tile content should be faster than re-requesting raw data).\r\n if (TileRequest.State.Loading === this._state)\r\n return false;\r\n\r\n // If no user cares about this tile any more, we're canceled.\r\n return this.users.isEmpty;\r\n }\r\n\r\n /** The tile tree to which the requested [[Tile]] belongs. */\r\n public get tree(): TileTree { return this.tile.tree; }\r\n\r\n /** Indicate that the specified user is awaiting the result of this request.\r\n * @internal\r\n */\r\n public addUser(user: TileUser): void {\r\n this.users = IModelApp.tileAdmin.getTileUserSetForRequest(user, this.users);\r\n }\r\n\r\n /** Transition the request from \"queued\" to \"active\", kicking off a series of asynchronous operations usually beginning with an http request, and -\r\n * if the request is not subsequently canceled - resulting in either a successfully-loaded Tile, or a failed (\"not found\") Tile.\r\n * @internal\r\n */\r\n public async dispatch(onHttpResponse: () => void): Promise<void> {\r\n if (this.isCanceled)\r\n return;\r\n\r\n assert(this._state === TileRequest.State.Queued);\r\n this._state = TileRequest.State.Dispatched;\r\n let response;\r\n let gotResponse = false;\r\n try {\r\n response = await this.channel.requestContent(this.tile, () => this.isCanceled);\r\n gotResponse = true;\r\n\r\n // Set this now, so our `isCanceled` check can see it.\r\n this._state = TileRequest.State.Loading;\r\n } catch (err: any) {\r\n if (err.errorNumber && err.errorNumber === IModelStatus.ServerTimeout) {\r\n // Invalidate scene - if tile is re-selected, it will be re-requested.\r\n this.notifyAndClear();\r\n this._state = TileRequest.State.Failed;\r\n this.channel.recordTimeout();\r\n } else {\r\n // Unknown error - not retryable\r\n this.setFailed();\r\n }\r\n }\r\n\r\n // Notify caller that we have finished http activity.\r\n onHttpResponse();\r\n\r\n if (!gotResponse || this.isCanceled)\r\n return;\r\n\r\n if (undefined === response && this.channel.onNoContent(this)) {\r\n // Invalidate scene - if tile is re-selected, it will be re-requested - presumably via a different channel.\r\n this.notifyAndClear();\r\n this._state = TileRequest.State.Failed;\r\n return;\r\n }\r\n\r\n return this.handleResponse(response);\r\n }\r\n\r\n /** Cancels this request. This leaves the associated Tile's state untouched.\r\n * @internal\r\n */\r\n public cancel(): void {\r\n this.notifyAndClear();\r\n if (TileRequest.State.Dispatched === this._state)\r\n this.channel.onActiveRequestCanceled(this);\r\n\r\n this._state = TileRequest.State.Failed;\r\n }\r\n\r\n /** Invalidates the scene of each [[TileUser]] interested in this request - typically because the request succeeded, failed, or was canceled. */\r\n private notify(): void {\r\n this.users.forEach((user) => {\r\n if (user.onRequestStateChanged)\r\n user.onRequestStateChanged(this);\r\n });\r\n }\r\n\r\n /** Invalidates the scene of each [[TileUser]] interested in this request and clears the set of interested users. */\r\n private notifyAndClear(): void {\r\n this.notify();\r\n this.users = IModelApp.tileAdmin.emptyTileUserSet;\r\n this.tile.request = undefined;\r\n }\r\n\r\n private setFailed() {\r\n this.notifyAndClear();\r\n this._state = TileRequest.State.Failed;\r\n this.tile.setNotFound();\r\n this.channel.recordFailure();\r\n }\r\n\r\n /** Invoked when the raw tile content becomes available, to convert it into a tile graphic. */\r\n private async handleResponse(response: TileRequest.Response): Promise<void> {\r\n let content: TileContent | undefined;\r\n let data: TileRequest.ResponseData | undefined;\r\n if (undefined !== response) {\r\n if (typeof response === \"string\")\r\n data = base64StringToUint8Array(response);\r\n else if (response instanceof Uint8Array || response instanceof ImageSource)\r\n data = response;\r\n else if (response instanceof ArrayBuffer)\r\n data = new Uint8Array(response);\r\n else if (typeof response === \"object\") {\r\n if (\"content\" in response)\r\n content = response.content;\r\n else if (\"data\" in response)\r\n data = response;\r\n }\r\n }\r\n\r\n if (!content && !data) {\r\n this.setFailed();\r\n return;\r\n }\r\n\r\n try {\r\n if (!content) {\r\n assert(undefined !== data);\r\n content = await this.tile.readContent(data, IModelApp.renderSystem, () => this.isCanceled);\r\n if (this.isCanceled)\r\n return;\r\n }\r\n\r\n this._state = TileRequest.State.Completed;\r\n this.tile.setContent(content);\r\n this.notifyAndClear();\r\n this.channel.recordCompletion(this.tile, content);\r\n } catch (_err) {\r\n this.setFailed();\r\n }\r\n }\r\n}\r\n\r\n/** @public */\r\nexport namespace TileRequest { // eslint-disable-line no-redeclare\r\n /** The type of a raw response to a request for tile content. Processed upon receipt into a [[TileRequest.Response]] type.\r\n * [[Tile.requestContent]] produces a response of this type; it is then converted to a [[Tile.ResponseData]] from which [[Tile.readContent]]\r\n * can produce a [[RenderGraphic]].\r\n * @public\r\n */\r\n export type Response = Uint8Array | ArrayBuffer | string | ImageSource | { content: TileContent } | { data: any } | undefined;\r\n\r\n /** The input to [[Tile.readContent]], to be converted into a [[RenderGraphic]].\r\n * @public\r\n */\r\n export type ResponseData = Uint8Array | ImageSource | { data: any };\r\n\r\n /** The states through which a [[TileRequest]] proceeds. During the first 3 states, the [[Tile]]'s `request` member is defined,\r\n * and its [[Tile.LoadStatus]] is computed based on the state of its request.\r\n *@ public\r\n */\r\n export enum State {\r\n /** Initial state. Request is pending but not yet dispatched. */\r\n Queued,\r\n /** Follows `Queued` when request begins to be actively processed. */\r\n Dispatched,\r\n /** Follows `Dispatched` when the response to the request is being converted into tile graphics. */\r\n Loading,\r\n /** Follows `Loading` when tile graphic has successfully been produced. */\r\n Completed,\r\n /** Follows any state in which an error prevents progression, or during which the request was canceled. */\r\n Failed,\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"TileRequest.js","sourceRoot":"","sources":["../../../src/tile/TileRequest.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAwE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE5G;;;;GAIG;AACH,MAAM,OAAO,WAAW;IAatB,kBAAkB;IAClB,YAAmB,IAAU,EAAE,IAAc;QAJ7C,kLAAkL;QAC3K,aAAQ,GAAG,CAAC,CAAC;QAIlB,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC;QACvC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC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QAWhB;AACH,CAAC,EA7BgB,WAAW,KAAX,WAAW,QA6B3B","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\nimport { assert, base64StringToUint8Array, IModelStatus } from \"@itwin/core-bentley\";\r\nimport { ImageSource } from \"@itwin/core-common\";\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport { Viewport } from \"../Viewport\";\r\nimport { ReadonlyTileUserSet, Tile, TileContent, TileRequestChannel, TileTree, TileUser } from \"./internal\";\r\n\r\n/** Represents a pending or active request to load the contents of a [[Tile]]. The request coordinates with the [[Tile.requestContent]] to obtain the raw content and\r\n * [[Tile.readContent]] to convert the result into a [[RenderGraphic]]. TileRequests are created internally as needed; it is never necessary or useful for external code to create them.\r\n * @public\r\n * @extensions\r\n */\r\nexport class TileRequest {\r\n /** The requested tile. While the request is pending or active, `tile.request` points back to this TileRequest. */\r\n public readonly tile: Tile;\r\n /** The channel via which the request will be executed. */\r\n public readonly channel: TileRequestChannel;\r\n /** The set of [[TileUser]]s that are awaiting the result of this request. When this becomes empty, the request is canceled because no user cares about it.\r\n * @internal\r\n */\r\n public users: ReadonlyTileUserSet;\r\n private _state: TileRequest.State;\r\n /** Determines the order in which pending requests are pulled off the queue to become active. A tile with a lower priority value takes precedence over one with a higher value. */\r\n public priority = 0;\r\n\r\n /** Constructor */\r\n public constructor(tile: Tile, user: TileUser) {\r\n this._state = TileRequest.State.Queued;\r\n this.tile = tile;\r\n this.channel = tile.channel;\r\n this.users = IModelApp.tileAdmin.getTileUserSetForRequest(user);\r\n }\r\n\r\n /** The set of [[Viewport]]s that are awaiting the result of this request. When this becomes empty, the request is canceled because no user cares about it. */\r\n public get viewports(): Iterable<Viewport> {\r\n return TileUser.viewportsFromUsers(this.users);\r\n }\r\n\r\n /** The request's current state. */\r\n public get state(): TileRequest.State { return this._state; }\r\n\r\n /** True if the request has been enqueued but not yet dispatched. */\r\n public get isQueued() { return TileRequest.State.Queued === this._state; }\r\n\r\n /** True if the request has been canceled. */\r\n public get isCanceled(): boolean {\r\n // If iModel was closed, cancel immediately\r\n if (this.tile.iModel.tiles.isDisposed)\r\n return true;\r\n\r\n // After we've received the raw tile data, always finish processing it - otherwise tile may end up in limbo (and producing tile content should be faster than re-requesting raw data).\r\n if (TileRequest.State.Loading === this._state)\r\n return false;\r\n\r\n // If no user cares about this tile any more, we're canceled.\r\n return this.users.isEmpty;\r\n }\r\n\r\n /** The tile tree to which the requested [[Tile]] belongs. */\r\n public get tree(): TileTree { return this.tile.tree; }\r\n\r\n /** Indicate that the specified user is awaiting the result of this request.\r\n * @internal\r\n */\r\n public addUser(user: TileUser): void {\r\n this.users = IModelApp.tileAdmin.getTileUserSetForRequest(user, this.users);\r\n }\r\n\r\n /** Transition the request from \"queued\" to \"active\", kicking off a series of asynchronous operations usually beginning with an http request, and -\r\n * if the request is not subsequently canceled - resulting in either a successfully-loaded Tile, or a failed (\"not found\") Tile.\r\n * @internal\r\n */\r\n public async dispatch(onHttpResponse: () => void): Promise<void> {\r\n if (this.isCanceled)\r\n return;\r\n\r\n assert(this._state === TileRequest.State.Queued);\r\n this._state = TileRequest.State.Dispatched;\r\n let response;\r\n let gotResponse = false;\r\n try {\r\n response = await this.channel.requestContent(this.tile, () => this.isCanceled);\r\n gotResponse = true;\r\n\r\n // Set this now, so our `isCanceled` check can see it.\r\n this._state = TileRequest.State.Loading;\r\n } catch (err: any) {\r\n if (err.errorNumber && err.errorNumber === IModelStatus.ServerTimeout) {\r\n // Invalidate scene - if tile is re-selected, it will be re-requested.\r\n this.notifyAndClear();\r\n this._state = TileRequest.State.Failed;\r\n this.channel.recordTimeout();\r\n } else {\r\n // Unknown error - not retryable\r\n this.setFailed();\r\n }\r\n }\r\n\r\n // Notify caller that we have finished http activity.\r\n onHttpResponse();\r\n\r\n if (!gotResponse || this.isCanceled)\r\n return;\r\n\r\n if (undefined === response && this.channel.onNoContent(this)) {\r\n // Invalidate scene - if tile is re-selected, it will be re-requested - presumably via a different channel.\r\n this.notifyAndClear();\r\n this._state = TileRequest.State.Failed;\r\n return;\r\n }\r\n\r\n return this.handleResponse(response);\r\n }\r\n\r\n /** Cancels this request. This leaves the associated Tile's state untouched.\r\n * @internal\r\n */\r\n public cancel(): void {\r\n this.notifyAndClear();\r\n if (TileRequest.State.Dispatched === this._state)\r\n this.channel.onActiveRequestCanceled(this);\r\n\r\n this._state = TileRequest.State.Failed;\r\n }\r\n\r\n /** Invalidates the scene of each [[TileUser]] interested in this request - typically because the request succeeded, failed, or was canceled. */\r\n private notify(): void {\r\n this.users.forEach((user) => {\r\n if (user.onRequestStateChanged)\r\n user.onRequestStateChanged(this);\r\n });\r\n }\r\n\r\n /** Invalidates the scene of each [[TileUser]] interested in this request and clears the set of interested users. */\r\n private notifyAndClear(): void {\r\n this.notify();\r\n this.users = IModelApp.tileAdmin.emptyTileUserSet;\r\n this.tile.request = undefined;\r\n }\r\n\r\n private setFailed() {\r\n this.notifyAndClear();\r\n this._state = TileRequest.State.Failed;\r\n this.tile.setNotFound();\r\n this.channel.recordFailure();\r\n }\r\n\r\n /** Invoked when the raw tile content becomes available, to convert it into a tile graphic. */\r\n private async handleResponse(response: TileRequest.Response): Promise<void> {\r\n let content: TileContent | undefined;\r\n let data: TileRequest.ResponseData | undefined;\r\n if (undefined !== response) {\r\n if (typeof response === \"string\")\r\n data = base64StringToUint8Array(response);\r\n else if (response instanceof Uint8Array || response instanceof ImageSource)\r\n data = response;\r\n else if (response instanceof ArrayBuffer)\r\n data = new Uint8Array(response);\r\n else if (typeof response === \"object\") {\r\n if (\"content\" in response)\r\n content = response.content;\r\n else if (\"data\" in response)\r\n data = response;\r\n }\r\n }\r\n\r\n if (!content && !data) {\r\n this.setFailed();\r\n return;\r\n }\r\n\r\n try {\r\n const start = Date.now();\r\n if (!content) {\r\n assert(undefined !== data);\r\n content = await this.tile.readContent(data, IModelApp.renderSystem, () => this.isCanceled);\r\n if (this.isCanceled)\r\n return;\r\n }\r\n\r\n this._state = TileRequest.State.Completed;\r\n this.tile.setContent(content);\r\n this.notifyAndClear();\r\n this.channel.recordCompletion(this.tile, content, Date.now() - start);\r\n } catch (_err) {\r\n this.setFailed();\r\n }\r\n }\r\n}\r\n\r\n/** @public */\r\nexport namespace TileRequest { // eslint-disable-line no-redeclare\r\n /** The type of a raw response to a request for tile content. Processed upon receipt into a [[TileRequest.Response]] type.\r\n * [[Tile.requestContent]] produces a response of this type; it is then converted to a [[Tile.ResponseData]] from which [[Tile.readContent]]\r\n * can produce a [[RenderGraphic]].\r\n * @public\r\n */\r\n export type Response = Uint8Array | ArrayBuffer | string | ImageSource | { content: TileContent } | { data: any } | undefined;\r\n\r\n /** The input to [[Tile.readContent]], to be converted into a [[RenderGraphic]].\r\n * @public\r\n */\r\n export type ResponseData = Uint8Array | ImageSource | { data: any };\r\n\r\n /** The states through which a [[TileRequest]] proceeds. During the first 3 states, the [[Tile]]'s `request` member is defined,\r\n * and its [[Tile.LoadStatus]] is computed based on the state of its request.\r\n *@ public\r\n */\r\n export enum State {\r\n /** Initial state. Request is pending but not yet dispatched. */\r\n Queued,\r\n /** Follows `Queued` when request begins to be actively processed. */\r\n Dispatched,\r\n /** Follows `Dispatched` when the response to the request is being converted into tile graphics. */\r\n Loading,\r\n /** Follows `Loading` when tile graphic has successfully been produced. */\r\n Completed,\r\n /** Follows any state in which an error prevents progression, or during which the request was canceled. */\r\n Failed,\r\n }\r\n}\r\n"]}
|
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { IModelConnection } from "../IModelConnection";
|
|
5
5
|
import { Tile, TileContent, TileRequest } from "./internal";
|
|
6
|
+
/** As part of a [[TileRequestChannelStatistics]], summarizes cumulative time spent decoding tile content.
|
|
7
|
+
* For each Tile, the time elapsed between receiving the raw tile content (e.g., over the network) and converting it to a [[TileContent]] via [[Tile.readContent]]
|
|
8
|
+
* is recorded.
|
|
9
|
+
* All times are reported in milliseconds.
|
|
10
|
+
* @beta
|
|
11
|
+
*/
|
|
12
|
+
export interface TileContentDecodingStatistics {
|
|
13
|
+
/** The total number of milliseconds spent decoding content. */
|
|
14
|
+
total: number;
|
|
15
|
+
/** The mean (average) number of milliseconds spent decoding content. */
|
|
16
|
+
mean: number;
|
|
17
|
+
/** The longest amount of time, in milliseconds, spent decoding any single tile's content. */
|
|
18
|
+
max: number;
|
|
19
|
+
/** The shortest amount of time, in milliseconds, spent decoding any single tile's content. */
|
|
20
|
+
min: number;
|
|
21
|
+
}
|
|
6
22
|
/** Statistics regarding the current and cumulative state of one or more [[TileRequestChannel]]s. Useful for monitoring performance and diagnosing problems.
|
|
7
23
|
* @see [[TileRequestChannel.statistics]] for a specific channel's statistics.
|
|
8
24
|
* @see [[TileRequestChannels.statistics]] for statistics from all channels.
|
|
@@ -37,8 +53,14 @@ export declare class TileRequestChannelStatistics {
|
|
|
37
53
|
totalDispatchedRequests: number;
|
|
38
54
|
/** The total number of tiles for which content requests were dispatched and then canceled on the backend before completion. */
|
|
39
55
|
totalAbortedRequests: number;
|
|
56
|
+
/** Statistics summarizing time spent decoding tile content.
|
|
57
|
+
* @beta
|
|
58
|
+
*/
|
|
59
|
+
decoding: TileContentDecodingStatistics;
|
|
40
60
|
/** @internal */
|
|
41
61
|
addTo(stats: TileRequestChannelStatistics): void;
|
|
62
|
+
/** @internal */
|
|
63
|
+
recordCompletion(tile: Tile, elapsedMilliseconds: number): void;
|
|
42
64
|
}
|
|
43
65
|
/** A channel over which requests for tile content can be made. The channel may request content over HTTP, calls to the backend via IPC or RPC, or any other method like generating the content
|
|
44
66
|
* on the frontend. The channel consists of a queue of pending requests and a set of "active" requests (dispatched and awaiting a response). Incoming requests are placed onto the queue. Requests are popped of the queue in order of priority and dispatched, until the maximum number of simultaneously-active requests is reached.
|
|
@@ -95,7 +117,7 @@ export declare class TileRequestChannel {
|
|
|
95
117
|
/** Invoked by [[TileRequest]] after a request completes.
|
|
96
118
|
* @internal
|
|
97
119
|
*/
|
|
98
|
-
recordCompletion(tile: Tile, content: TileContent): void;
|
|
120
|
+
recordCompletion(tile: Tile, content: TileContent, elapsedMilliseconds: number): void;
|
|
99
121
|
/** Invoked by [[TileRequestChannels.swapPending]] when [[TileAdmin]] is about to start enqueuing new requests.
|
|
100
122
|
* @internal
|
|
101
123
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TileRequestChannel.d.ts","sourceRoot":"","sources":["../../../src/tile/TileRequestChannel.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAW5D;;;;;;GAMG;AACH,qBAAa,4BAA4B;IACvC,uEAAuE;IAChE,kBAAkB,SAAK;IAC9B,8EAA8E;IACvE,iBAAiB,SAAK;IAC7B,qEAAqE;IAC9D,WAAW,SAAK;IACvB,kEAAkE;IAC3D,sBAAsB,SAAK;IAClC,+DAA+D;IACxD,mBAAmB,SAAK;IAC/B,kEAAkE;IAC3D,qBAAqB,SAAK;IACjC;;OAEG;IACI,eAAe,SAAK;IAC3B;;OAEG;IACI,uBAAuB,SAAK;IACnC,+JAA+J;IACxJ,gBAAgB,SAAK;IAC5B,4EAA4E;IACrE,uBAAuB,SAAK;IACnC,+HAA+H;IACxH,oBAAoB,SAAK;
|
|
1
|
+
{"version":3,"file":"TileRequestChannel.d.ts","sourceRoot":"","sources":["../../../src/tile/TileRequestChannel.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAW5D;;;;;GAKG;AACH,MAAM,WAAW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SAAS,CAAC,MAAM,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;IAK5C;;OAEG;IACH,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;CAIxD"}
|
|
@@ -49,6 +49,15 @@ export class TileRequestChannelStatistics {
|
|
|
49
49
|
this.totalDispatchedRequests = 0;
|
|
50
50
|
/** The total number of tiles for which content requests were dispatched and then canceled on the backend before completion. */
|
|
51
51
|
this.totalAbortedRequests = 0;
|
|
52
|
+
/** Statistics summarizing time spent decoding tile content.
|
|
53
|
+
* @beta
|
|
54
|
+
*/
|
|
55
|
+
this.decoding = {
|
|
56
|
+
total: 0,
|
|
57
|
+
mean: 0,
|
|
58
|
+
max: Number.MIN_SAFE_INTEGER,
|
|
59
|
+
min: Number.MAX_SAFE_INTEGER,
|
|
60
|
+
};
|
|
52
61
|
}
|
|
53
62
|
/** @internal */
|
|
54
63
|
addTo(stats) {
|
|
@@ -56,11 +65,27 @@ export class TileRequestChannelStatistics {
|
|
|
56
65
|
const key = propName;
|
|
57
66
|
const val = this[key];
|
|
58
67
|
if (typeof val === "number") {
|
|
59
|
-
// This type guard ought to suffice but doesn't.
|
|
60
68
|
assert(typeof stats[key] === "number");
|
|
61
69
|
stats[key] += val;
|
|
62
70
|
}
|
|
63
71
|
}
|
|
72
|
+
stats.decoding.total += this.decoding.total;
|
|
73
|
+
stats.decoding.max = Math.max(this.decoding.max, stats.decoding.max);
|
|
74
|
+
stats.decoding.min = Math.min(this.decoding.min, stats.decoding.min);
|
|
75
|
+
if (stats.totalCompletedRequests > 0)
|
|
76
|
+
stats.decoding.mean = (stats.decoding.total) / stats.totalCompletedRequests;
|
|
77
|
+
}
|
|
78
|
+
/** @internal */
|
|
79
|
+
recordCompletion(tile, elapsedMilliseconds) {
|
|
80
|
+
++this.totalCompletedRequests;
|
|
81
|
+
if (tile.isEmpty)
|
|
82
|
+
++this.totalEmptyTiles;
|
|
83
|
+
else if (!tile.isDisplayable)
|
|
84
|
+
++this.totalUndisplayableTiles;
|
|
85
|
+
this.decoding.total += elapsedMilliseconds;
|
|
86
|
+
this.decoding.mean = this.decoding.total / this.totalCompletedRequests;
|
|
87
|
+
this.decoding.max = Math.max(this.decoding.max, elapsedMilliseconds);
|
|
88
|
+
this.decoding.min = Math.min(this.decoding.min, elapsedMilliseconds);
|
|
64
89
|
}
|
|
65
90
|
}
|
|
66
91
|
/** A channel over which requests for tile content can be made. The channel may request content over HTTP, calls to the backend via IPC or RPC, or any other method like generating the content
|
|
@@ -134,12 +159,8 @@ export class TileRequestChannel {
|
|
|
134
159
|
/** Invoked by [[TileRequest]] after a request completes.
|
|
135
160
|
* @internal
|
|
136
161
|
*/
|
|
137
|
-
recordCompletion(tile, content) {
|
|
138
|
-
|
|
139
|
-
if (tile.isEmpty)
|
|
140
|
-
++this._statistics.totalEmptyTiles;
|
|
141
|
-
else if (!tile.isDisplayable)
|
|
142
|
-
++this._statistics.totalUndisplayableTiles;
|
|
162
|
+
recordCompletion(tile, content, elapsedMilliseconds) {
|
|
163
|
+
this._statistics.recordCompletion(tile, elapsedMilliseconds);
|
|
143
164
|
if (this.contentCallback)
|
|
144
165
|
this.contentCallback(tile, content);
|
|
145
166
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TileRequestChannel.js","sourceRoot":"","sources":["../../../src/tile/TileRequestChannel.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAI5D,MAAM,gBAAiB,SAAQ,aAA0B;IACvD;QACE,KAAK,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YACjB,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;YACrE,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,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C,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC1B,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE;YACpB,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;YACb,EAAE;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACO,MAAM,CAAC,OAAoB;QACnC,OAAO,CAAC,MAAM,EAAE,CAAC;QACjB,EAAE,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;IACjC,CAAC;IAED;;OAEG;IACO,iBAAiB,CAAC,OAAoB;QAC9C,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;QACxD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\nimport { assert, PriorityQueue } from \"@itwin/core-bentley\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { Tile, TileContent, TileRequest } from \"./internal\";\r\n\r\nclass TileRequestQueue extends PriorityQueue<TileRequest> {\r\n public constructor() {\r\n super((lhs, rhs) => {\r\n const diff = lhs.tile.tree.loadPriority - rhs.tile.tree.loadPriority;\r\n return 0 !== diff ? diff : lhs.priority - rhs.priority;\r\n });\r\n }\r\n}\r\n\r\n/** Statistics regarding the current and cumulative state of one or more [[TileRequestChannel]]s. Useful for monitoring performance and diagnosing problems.\r\n * @see [[TileRequestChannel.statistics]] for a specific channel's statistics.\r\n * @see [[TileRequestChannels.statistics]] for statistics from all channels.\r\n * @see [[TileAdmin.statistics]] for additional statistics.\r\n * @public\r\n * @extensions\r\n */\r\nexport class TileRequestChannelStatistics {\r\n /** The number of queued requests that have not yet been dispatched. */\r\n public numPendingRequests = 0;\r\n /** The number of requests that have been dispatched but not yet completed. */\r\n public numActiveRequests = 0;\r\n /** The number of requests canceled during the most recent update. */\r\n public numCanceled = 0;\r\n /** The total number of completed requests during this session. */\r\n public totalCompletedRequests = 0;\r\n /** The total number of failed requests during this session. */\r\n public totalFailedRequests = 0;\r\n /** The total number of timed-out requests during this session. */\r\n public totalTimedOutRequests = 0;\r\n /** The total number of completed requests during this session which produced an empty tile.\r\n * These tiles also contribute to [[totalCompletedRequests]], but not to [[totalUndisplayableTiles]].\r\n */\r\n public totalEmptyTiles = 0;\r\n /** The total number of completed requests during this session that produced an undisplayable tile.\r\n * These tiles also contribute to [[totalCompletedRequests]], but not to [[totalEmptyTiles]].\r\n */\r\n public totalUndisplayableTiles = 0;\r\n /** The total number of tiles whose contents were not found in cloud storage cache and therefore resulted in a backend request to generate the tile content. */\r\n public totalCacheMisses = 0;\r\n /** The total number of tiles for which content requests were dispatched. */\r\n public totalDispatchedRequests = 0;\r\n /** The total number of tiles for which content requests were dispatched and then canceled on the backend before completion. */\r\n public totalAbortedRequests = 0;\r\n\r\n /** @internal */\r\n public addTo(stats: TileRequestChannelStatistics): void {\r\n for (const propName in this) { // eslint-disable-line guard-for-in\r\n const key = propName as keyof TileRequestChannelStatistics;\r\n const val = this[key];\r\n if (typeof val === \"number\") {\r\n // This type guard ought to suffice but doesn't.\r\n assert(typeof stats[key] === \"number\");\r\n (stats[key] as number) += val;\r\n }\r\n }\r\n }\r\n}\r\n\r\n/** A channel over which requests for tile content can be made. The channel may request content over HTTP, calls to the backend via IPC or RPC, or any other method like generating the content\r\n * on the frontend. The channel consists of a queue of pending requests and a set of \"active\" requests (dispatched and awaiting a response). Incoming requests are placed onto the queue. Requests are popped of the queue in order of priority and dispatched, until the maximum number of simultaneously-active requests is reached.\r\n * The maximum number of active requests depends on the transport mechanism. For HTTP 1.1, browsers impose a limit of 6 simultaneous connections to a given domain, so ideally each unique domain will use its own unique channel with a limit of 6 active requests. Even for requests satisfied entirely by the frontend, imposing a limit is important for throttling the amount of work done at one time, especially because as the user navigates the view, tiles that were previously requested may no longer be of interest and we shouldn't waste resources producing their content.\r\n * A channel must be registered with [[TileRequestChannels]] and must have a unique name among all registered channels.\r\n * @see [[TileRequestChannels.getForHttp]] to obtain (and register if not already registered) an HTTP-based channel.\r\n * @see [[TileAdmin.channels]] for the channels configured for use with the iTwin.js display system.\r\n * @see [[Tile.channel]] to specify the channel to be used to request a given tile's content.\r\n * @public\r\n * @extensions\r\n */\r\nexport class TileRequestChannel {\r\n /** The channel's name. It must be unique among all registered [[TileRequestChannels]]. */\r\n public readonly name: string;\r\n private _concurrency: number;\r\n /** Protected strictly for tests. @internal */\r\n protected readonly _active = new Set<TileRequest>();\r\n private _pending = new TileRequestQueue();\r\n private _previouslyPending = new TileRequestQueue();\r\n protected _statistics = new TileRequestChannelStatistics();\r\n /** Callback invoked by recordCompletion. See IModelTileMetadataCacheChannel.\r\n * @internal\r\n */\r\n public contentCallback?: (tile: Tile, content: TileContent) => void;\r\n\r\n /** Create a new channel.\r\n * @param name The unique name of the channel.\r\n * @param concurrency The maximum number of requests that can be dispatched and awaiting a response at any given time. Requests beyond this maximum are enqueued for deferred dispatch.\r\n * @see [[TileRequestChannels.getForHttp]] to create an HTTP-based channel.\r\n */\r\n public constructor(name: string, concurrency: number) {\r\n this.name = name;\r\n this._concurrency = concurrency;\r\n }\r\n\r\n /** The maximum number of active requests. This is generally only modified for debugging purposes.\r\n * @note When reducing `concurrency`, the number of active requests ([[numActive]]) will only decrease to the new value after a sufficient number of dispatched requests are resolved.\r\n */\r\n public get concurrency(): number {\r\n return this._concurrency;\r\n }\r\n public set concurrency(max: number) {\r\n this._concurrency = max;\r\n }\r\n\r\n /** The number of requests that have been dispatched and are awaiting a response. */\r\n public get numActive(): number {\r\n return this._active.size;\r\n }\r\n\r\n /** The number of requests that have been enqueued for later dispatch. */\r\n public get numPending(): number {\r\n return this._pending.length;\r\n }\r\n\r\n /** The total number of requests in this channel, whether dispatched or enqueued. */\r\n public get size(): number {\r\n return this.numActive + this.numPending;\r\n }\r\n\r\n /** Statistics intended primarily for debugging. */\r\n public get statistics(): Readonly<TileRequestChannelStatistics> {\r\n this._statistics.numPendingRequests = this.numPending;\r\n this._statistics.numActiveRequests = this.numActive;\r\n return this._statistics;\r\n }\r\n\r\n /** Reset all of this channel's [[statistics]] to zero. */\r\n public resetStatistics(): void {\r\n this._statistics = new TileRequestChannelStatistics();\r\n }\r\n\r\n /** Invoked by [[TileRequest]] when a request times out.\r\n * @internal\r\n */\r\n public recordTimeout(): void {\r\n ++this._statistics.totalTimedOutRequests;\r\n }\r\n\r\n /** Invoked by [[TileRequest]] when a request fails to produce a response.\r\n * @internal\r\n */\r\n public recordFailure(): void {\r\n ++this._statistics.totalFailedRequests;\r\n }\r\n\r\n /** Invoked by [[TileRequest]] after a request completes.\r\n * @internal\r\n */\r\n public recordCompletion(tile: Tile, content: TileContent): void {\r\n ++this._statistics.totalCompletedRequests;\r\n if (tile.isEmpty)\r\n ++this._statistics.totalEmptyTiles;\r\n else if (!tile.isDisplayable)\r\n ++this._statistics.totalUndisplayableTiles;\r\n\r\n if (this.contentCallback)\r\n this.contentCallback(tile, content);\r\n }\r\n\r\n /** Invoked by [[TileRequestChannels.swapPending]] when [[TileAdmin]] is about to start enqueuing new requests.\r\n * @internal\r\n */\r\n public swapPending(): void {\r\n const previouslyPending = this._pending;\r\n this._pending = this._previouslyPending;\r\n this._previouslyPending = previouslyPending;\r\n }\r\n\r\n /** Invoked by [[TileAdmin.processRequests]] to enqueue a request. Ordering is ignored - the queue will be re-sorted later.\r\n * @internal\r\n */\r\n public append(request: TileRequest): void {\r\n assert(request.channel === this);\r\n this._pending.append(request);\r\n }\r\n\r\n /** Invoked by [[TileRequestChannels.process]] to process the active and pending requests.\r\n * @internal\r\n */\r\n public process(): void {\r\n this._statistics.numCanceled = 0;\r\n\r\n // Recompute priority of each request.\r\n for (const pending of this._pending)\r\n pending.priority = pending.tile.computeLoadPriority(pending.viewports, pending.users);\r\n\r\n // Sort pending requests by priority.\r\n this._pending.sort();\r\n\r\n // Cancel any previously pending requests that are no longer needed.\r\n for (const queued of this._previouslyPending)\r\n if (queued.users.isEmpty)\r\n this.cancel(queued);\r\n\r\n this._previouslyPending.clear();\r\n\r\n // Cancel any active requests that are no longer needed.\r\n // NB: Do NOT remove them from the active set until their http activity has completed.\r\n for (const active of this._active)\r\n if (active.users.isEmpty)\r\n this.cancel(active);\r\n\r\n // Batch-cancel running requests.\r\n this.processCancellations();\r\n\r\n // Dispatch requests from the queue up to our maximum.\r\n while (this._active.size < this._concurrency) {\r\n const request = this._pending.pop();\r\n if (!request)\r\n break;\r\n\r\n this.dispatch(request);\r\n }\r\n }\r\n\r\n /** Cancel all active and queued requests and clear the active set and queue.\r\n * @internal\r\n */\r\n public cancelAndClearAll(): void {\r\n for (const active of this._active)\r\n active.cancel();\r\n\r\n for (const queued of this._pending)\r\n queued.cancel();\r\n\r\n this._active.clear();\r\n this._pending.clear();\r\n }\r\n\r\n /** Invoked when [[Tile.requestContent]] returns `undefined`. Return true if the request can be retried, e.g., via different channel.\r\n * If so, the tile will remain marked as \"not loaded\" and, if re-selected for display, a new [[TileRequest]] will be enqueued for it.\r\n * Otherwise, the tile will be marked as \"failed to load\" and no further requests will be made for its content.\r\n * The default implementation always returns `false`.\r\n */\r\n public onNoContent(_request: TileRequest): boolean {\r\n return false;\r\n }\r\n\r\n /** Invoked when a request that was previously dispatched is canceled before a response is received.\r\n * Some channels accumulate such requests for later cancellation in [[processCancellations]].\r\n */\r\n public onActiveRequestCanceled(_request: TileRequest): void { }\r\n\r\n /** Invoked to do any additional work to cancel tiles accumulated by [[onActiveRequestCanceled]]. For example, a channel that requests tile content\r\n * over IPC may signal to the tile generation process that it should cease generating content for those tiles.\r\n */\r\n public processCancellations(): void { }\r\n\r\n /** Invoked when an iModel is closed, to clean up any state associated with that iModel. */\r\n public onIModelClosed(_iModel: IModelConnection): void { }\r\n\r\n /** Request content for the specified tile. The default implementation simply forwards to [[Tile.requestContent]]. */\r\n public async requestContent(tile: Tile, isCanceled: () => boolean): Promise<TileRequest.Response> {\r\n return tile.requestContent(isCanceled);\r\n }\r\n\r\n /** Protected only for tests - do not override.\r\n * @internal\r\n */\r\n protected dispatch(request: TileRequest): void {\r\n ++this._statistics.totalDispatchedRequests;\r\n this._active.add(request);\r\n request.dispatch(() => {\r\n this.dropActiveRequest(request);\r\n }).catch((_) => {\r\n //\r\n });\r\n }\r\n\r\n /** Protected only for tests - do not override.\r\n * @internal\r\n */\r\n protected cancel(request: TileRequest): void {\r\n request.cancel();\r\n ++this._statistics.numCanceled;\r\n }\r\n\r\n /** Protected only for tests - do not override.\r\n * @internal\r\n */\r\n protected dropActiveRequest(request: TileRequest): void {\r\n assert(this._active.has(request) || request.isCanceled);\r\n this._active.delete(request);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"TileRequestChannel.js","sourceRoot":"","sources":["../../../src/tile/TileRequestChannel.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAI5D,MAAM,gBAAiB,SAAQ,aAA0B;IACvD;QACE,KAAK,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YACjB,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;YACrE,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;QACzD,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAmBD;;;;;;GAMG;AACH,MAAM,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AAC,CAAC;QAClC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;YACb,EAAE;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACO,MAAM,CAAC,OAAoB;QACnC,OAAO,CAAC,MAAM,EAAE,CAAC;QACjB,EAAE,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;IACjC,CAAC;IAED;;OAEG;IACO,iBAAiB,CAAC,OAAoB;QAC9C,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;QACxD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\nimport { assert, PriorityQueue } from \"@itwin/core-bentley\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { Tile, TileContent, TileRequest } from \"./internal\";\r\n\r\nclass TileRequestQueue extends PriorityQueue<TileRequest> {\r\n public constructor() {\r\n super((lhs, rhs) => {\r\n const diff = lhs.tile.tree.loadPriority - rhs.tile.tree.loadPriority;\r\n return 0 !== diff ? diff : lhs.priority - rhs.priority;\r\n });\r\n }\r\n}\r\n\r\n/** As part of a [[TileRequestChannelStatistics]], summarizes cumulative time spent decoding tile content.\r\n * For each Tile, the time elapsed between receiving the raw tile content (e.g., over the network) and converting it to a [[TileContent]] via [[Tile.readContent]]\r\n * is recorded.\r\n * All times are reported in milliseconds.\r\n * @beta\r\n */\r\nexport interface TileContentDecodingStatistics {\r\n /** The total number of milliseconds spent decoding content. */\r\n total: number;\r\n /** The mean (average) number of milliseconds spent decoding content. */\r\n mean: number;\r\n /** The longest amount of time, in milliseconds, spent decoding any single tile's content. */\r\n max: number;\r\n /** The shortest amount of time, in milliseconds, spent decoding any single tile's content. */\r\n min: number;\r\n}\r\n\r\n/** Statistics regarding the current and cumulative state of one or more [[TileRequestChannel]]s. Useful for monitoring performance and diagnosing problems.\r\n * @see [[TileRequestChannel.statistics]] for a specific channel's statistics.\r\n * @see [[TileRequestChannels.statistics]] for statistics from all channels.\r\n * @see [[TileAdmin.statistics]] for additional statistics.\r\n * @public\r\n * @extensions\r\n */\r\nexport class TileRequestChannelStatistics {\r\n /** The number of queued requests that have not yet been dispatched. */\r\n public numPendingRequests = 0;\r\n /** The number of requests that have been dispatched but not yet completed. */\r\n public numActiveRequests = 0;\r\n /** The number of requests canceled during the most recent update. */\r\n public numCanceled = 0;\r\n /** The total number of completed requests during this session. */\r\n public totalCompletedRequests = 0;\r\n /** The total number of failed requests during this session. */\r\n public totalFailedRequests = 0;\r\n /** The total number of timed-out requests during this session. */\r\n public totalTimedOutRequests = 0;\r\n /** The total number of completed requests during this session which produced an empty tile.\r\n * These tiles also contribute to [[totalCompletedRequests]], but not to [[totalUndisplayableTiles]].\r\n */\r\n public totalEmptyTiles = 0;\r\n /** The total number of completed requests during this session that produced an undisplayable tile.\r\n * These tiles also contribute to [[totalCompletedRequests]], but not to [[totalEmptyTiles]].\r\n */\r\n public totalUndisplayableTiles = 0;\r\n /** The total number of tiles whose contents were not found in cloud storage cache and therefore resulted in a backend request to generate the tile content. */\r\n public totalCacheMisses = 0;\r\n /** The total number of tiles for which content requests were dispatched. */\r\n public totalDispatchedRequests = 0;\r\n /** The total number of tiles for which content requests were dispatched and then canceled on the backend before completion. */\r\n public totalAbortedRequests = 0;\r\n /** Statistics summarizing time spent decoding tile content.\r\n * @beta\r\n */\r\n public decoding: TileContentDecodingStatistics = {\r\n total: 0,\r\n mean: 0,\r\n max: Number.MIN_SAFE_INTEGER,\r\n min: Number.MAX_SAFE_INTEGER,\r\n };\r\n\r\n /** @internal */\r\n public addTo(stats: TileRequestChannelStatistics): void {\r\n for (const propName in this) { // eslint-disable-line guard-for-in\r\n const key = propName as keyof TileRequestChannelStatistics;\r\n const val = this[key];\r\n if (typeof val === \"number\") {\r\n assert(typeof stats[key] === \"number\");\r\n (stats[key] as number) += val;\r\n }\r\n }\r\n\r\n stats.decoding.total += this.decoding.total;\r\n stats.decoding.max = Math.max(this.decoding.max, stats.decoding.max);\r\n stats.decoding.min = Math.min(this.decoding.min, stats.decoding.min);\r\n\r\n if (stats.totalCompletedRequests > 0)\r\n stats.decoding.mean = (stats.decoding.total) / stats.totalCompletedRequests;\r\n }\r\n\r\n /** @internal */\r\n public recordCompletion(tile: Tile, elapsedMilliseconds: number): void {\r\n ++this.totalCompletedRequests;\r\n if (tile.isEmpty)\r\n ++this.totalEmptyTiles;\r\n else if (!tile.isDisplayable)\r\n ++this.totalUndisplayableTiles;\r\n\r\n this.decoding.total += elapsedMilliseconds;\r\n this.decoding.mean = this.decoding.total / this.totalCompletedRequests;\r\n this.decoding.max = Math.max(this.decoding.max, elapsedMilliseconds);\r\n this.decoding.min = Math.min(this.decoding.min, elapsedMilliseconds);\r\n }\r\n}\r\n\r\n/** A channel over which requests for tile content can be made. The channel may request content over HTTP, calls to the backend via IPC or RPC, or any other method like generating the content\r\n * on the frontend. The channel consists of a queue of pending requests and a set of \"active\" requests (dispatched and awaiting a response). Incoming requests are placed onto the queue. Requests are popped of the queue in order of priority and dispatched, until the maximum number of simultaneously-active requests is reached.\r\n * The maximum number of active requests depends on the transport mechanism. For HTTP 1.1, browsers impose a limit of 6 simultaneous connections to a given domain, so ideally each unique domain will use its own unique channel with a limit of 6 active requests. Even for requests satisfied entirely by the frontend, imposing a limit is important for throttling the amount of work done at one time, especially because as the user navigates the view, tiles that were previously requested may no longer be of interest and we shouldn't waste resources producing their content.\r\n * A channel must be registered with [[TileRequestChannels]] and must have a unique name among all registered channels.\r\n * @see [[TileRequestChannels.getForHttp]] to obtain (and register if not already registered) an HTTP-based channel.\r\n * @see [[TileAdmin.channels]] for the channels configured for use with the iTwin.js display system.\r\n * @see [[Tile.channel]] to specify the channel to be used to request a given tile's content.\r\n * @public\r\n * @extensions\r\n */\r\nexport class TileRequestChannel {\r\n /** The channel's name. It must be unique among all registered [[TileRequestChannels]]. */\r\n public readonly name: string;\r\n private _concurrency: number;\r\n /** Protected strictly for tests. @internal */\r\n protected readonly _active = new Set<TileRequest>();\r\n private _pending = new TileRequestQueue();\r\n private _previouslyPending = new TileRequestQueue();\r\n protected _statistics = new TileRequestChannelStatistics();\r\n /** Callback invoked by recordCompletion. See IModelTileMetadataCacheChannel.\r\n * @internal\r\n */\r\n public contentCallback?: (tile: Tile, content: TileContent) => void;\r\n\r\n /** Create a new channel.\r\n * @param name The unique name of the channel.\r\n * @param concurrency The maximum number of requests that can be dispatched and awaiting a response at any given time. Requests beyond this maximum are enqueued for deferred dispatch.\r\n * @see [[TileRequestChannels.getForHttp]] to create an HTTP-based channel.\r\n */\r\n public constructor(name: string, concurrency: number) {\r\n this.name = name;\r\n this._concurrency = concurrency;\r\n }\r\n\r\n /** The maximum number of active requests. This is generally only modified for debugging purposes.\r\n * @note When reducing `concurrency`, the number of active requests ([[numActive]]) will only decrease to the new value after a sufficient number of dispatched requests are resolved.\r\n */\r\n public get concurrency(): number {\r\n return this._concurrency;\r\n }\r\n public set concurrency(max: number) {\r\n this._concurrency = max;\r\n }\r\n\r\n /** The number of requests that have been dispatched and are awaiting a response. */\r\n public get numActive(): number {\r\n return this._active.size;\r\n }\r\n\r\n /** The number of requests that have been enqueued for later dispatch. */\r\n public get numPending(): number {\r\n return this._pending.length;\r\n }\r\n\r\n /** The total number of requests in this channel, whether dispatched or enqueued. */\r\n public get size(): number {\r\n return this.numActive + this.numPending;\r\n }\r\n\r\n /** Statistics intended primarily for debugging. */\r\n public get statistics(): Readonly<TileRequestChannelStatistics> {\r\n this._statistics.numPendingRequests = this.numPending;\r\n this._statistics.numActiveRequests = this.numActive;\r\n return this._statistics;\r\n }\r\n\r\n /** Reset all of this channel's [[statistics]] to zero. */\r\n public resetStatistics(): void {\r\n this._statistics = new TileRequestChannelStatistics();\r\n }\r\n\r\n /** Invoked by [[TileRequest]] when a request times out.\r\n * @internal\r\n */\r\n public recordTimeout(): void {\r\n ++this._statistics.totalTimedOutRequests;\r\n }\r\n\r\n /** Invoked by [[TileRequest]] when a request fails to produce a response.\r\n * @internal\r\n */\r\n public recordFailure(): void {\r\n ++this._statistics.totalFailedRequests;\r\n }\r\n\r\n /** Invoked by [[TileRequest]] after a request completes.\r\n * @internal\r\n */\r\n public recordCompletion(tile: Tile, content: TileContent, elapsedMilliseconds: number): void {\r\n this._statistics.recordCompletion(tile, elapsedMilliseconds);\r\n\r\n if (this.contentCallback)\r\n this.contentCallback(tile, content);\r\n }\r\n\r\n /** Invoked by [[TileRequestChannels.swapPending]] when [[TileAdmin]] is about to start enqueuing new requests.\r\n * @internal\r\n */\r\n public swapPending(): void {\r\n const previouslyPending = this._pending;\r\n this._pending = this._previouslyPending;\r\n this._previouslyPending = previouslyPending;\r\n }\r\n\r\n /** Invoked by [[TileAdmin.processRequests]] to enqueue a request. Ordering is ignored - the queue will be re-sorted later.\r\n * @internal\r\n */\r\n public append(request: TileRequest): void {\r\n assert(request.channel === this);\r\n this._pending.append(request);\r\n }\r\n\r\n /** Invoked by [[TileRequestChannels.process]] to process the active and pending requests.\r\n * @internal\r\n */\r\n public process(): void {\r\n this._statistics.numCanceled = 0;\r\n\r\n // Recompute priority of each request.\r\n for (const pending of this._pending)\r\n pending.priority = pending.tile.computeLoadPriority(pending.viewports, pending.users);\r\n\r\n // Sort pending requests by priority.\r\n this._pending.sort();\r\n\r\n // Cancel any previously pending requests that are no longer needed.\r\n for (const queued of this._previouslyPending)\r\n if (queued.users.isEmpty)\r\n this.cancel(queued);\r\n\r\n this._previouslyPending.clear();\r\n\r\n // Cancel any active requests that are no longer needed.\r\n // NB: Do NOT remove them from the active set until their http activity has completed.\r\n for (const active of this._active)\r\n if (active.users.isEmpty)\r\n this.cancel(active);\r\n\r\n // Batch-cancel running requests.\r\n this.processCancellations();\r\n\r\n // Dispatch requests from the queue up to our maximum.\r\n while (this._active.size < this._concurrency) {\r\n const request = this._pending.pop();\r\n if (!request)\r\n break;\r\n\r\n this.dispatch(request);\r\n }\r\n }\r\n\r\n /** Cancel all active and queued requests and clear the active set and queue.\r\n * @internal\r\n */\r\n public cancelAndClearAll(): void {\r\n for (const active of this._active)\r\n active.cancel();\r\n\r\n for (const queued of this._pending)\r\n queued.cancel();\r\n\r\n this._active.clear();\r\n this._pending.clear();\r\n }\r\n\r\n /** Invoked when [[Tile.requestContent]] returns `undefined`. Return true if the request can be retried, e.g., via different channel.\r\n * If so, the tile will remain marked as \"not loaded\" and, if re-selected for display, a new [[TileRequest]] will be enqueued for it.\r\n * Otherwise, the tile will be marked as \"failed to load\" and no further requests will be made for its content.\r\n * The default implementation always returns `false`.\r\n */\r\n public onNoContent(_request: TileRequest): boolean {\r\n return false;\r\n }\r\n\r\n /** Invoked when a request that was previously dispatched is canceled before a response is received.\r\n * Some channels accumulate such requests for later cancellation in [[processCancellations]].\r\n */\r\n public onActiveRequestCanceled(_request: TileRequest): void { }\r\n\r\n /** Invoked to do any additional work to cancel tiles accumulated by [[onActiveRequestCanceled]]. For example, a channel that requests tile content\r\n * over IPC may signal to the tile generation process that it should cease generating content for those tiles.\r\n */\r\n public processCancellations(): void { }\r\n\r\n /** Invoked when an iModel is closed, to clean up any state associated with that iModel. */\r\n public onIModelClosed(_iModel: IModelConnection): void { }\r\n\r\n /** Request content for the specified tile. The default implementation simply forwards to [[Tile.requestContent]]. */\r\n public async requestContent(tile: Tile, isCanceled: () => boolean): Promise<TileRequest.Response> {\r\n return tile.requestContent(isCanceled);\r\n }\r\n\r\n /** Protected only for tests - do not override.\r\n * @internal\r\n */\r\n protected dispatch(request: TileRequest): void {\r\n ++this._statistics.totalDispatchedRequests;\r\n this._active.add(request);\r\n request.dispatch(() => {\r\n this.dropActiveRequest(request);\r\n }).catch((_) => {\r\n //\r\n });\r\n }\r\n\r\n /** Protected only for tests - do not override.\r\n * @internal\r\n */\r\n protected cancel(request: TileRequest): void {\r\n request.cancel();\r\n ++this._statistics.numCanceled;\r\n }\r\n\r\n /** Protected only for tests - do not override.\r\n * @internal\r\n */\r\n protected dropActiveRequest(request: TileRequest): void {\r\n assert(this._active.has(request) || request.isCanceled);\r\n this._active.delete(request);\r\n }\r\n}\r\n"]}
|
|
@@ -46,7 +46,7 @@ export class TileRequestChannels {
|
|
|
46
46
|
/** The maximum number of active requests for a channel that uses HTTP to request content. */
|
|
47
47
|
this.httpConcurrency = 6;
|
|
48
48
|
this._channels = new Map();
|
|
49
|
-
this._rpcConcurrency = rpcConcurrency
|
|
49
|
+
this._rpcConcurrency = rpcConcurrency ?? this.httpConcurrency;
|
|
50
50
|
const elementGraphicsChannelName = "itwinjs-elem-rpc";
|
|
51
51
|
if (undefined !== rpcConcurrency)
|
|
52
52
|
this.elementGraphicsRpc = new ElementGraphicsChannel(elementGraphicsChannelName, rpcConcurrency);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TileRequestChannels.js","sourceRoot":"","sources":["../../../src/tile/TileRequestChannels.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,EACO,yBAAyB,EAAe,kBAAkB,EAAE,4BAA4B,GACrG,MAAM,YAAY,CAAC;AAEpB,8FAA8F;AAC9F,MAAM,sBAAuB,SAAQ,kBAAkB;IAAvD;;QACmB,cAAS,GAAG,IAAI,GAAG,EAA8B,CAAC;IAwBrE,CAAC;IAtBiB,uBAAuB,CAAC,OAAoB;QAC1D,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;QACxC,IAAI,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACrC,IAAI,CAAC,GAAG;Y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AAO,CAAC,OAAO,EAAE,CAAC;IACtB,CAAC;IAED;;OAEG;IACI,cAAc,CAAC,MAAwB;QAC5C,KAAK,MAAM,OAAO,IAAI,IAAI;YACxB,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAED;;OAEG;IACI,UAAU;QACf,KAAK,MAAM,OAAO,IAAI,IAAI;YACxB,OAAO,CAAC,iBAAiB,EAAE,CAAC;QAE9B,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\nimport { IpcApp } from \"../IpcApp\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport {\r\n IModelTile, IModelTileRequestChannels, TileRequest, TileRequestChannel, TileRequestChannelStatistics,\r\n} from \"./internal\";\r\n\r\n/** For an [[IpcApp]], allows backend element graphics requests in progress to be canceled. */\r\nclass ElementGraphicsChannel extends TileRequestChannel {\r\n private readonly _canceled = new Map<IModelConnection, string[]>();\r\n\r\n public override onActiveRequestCanceled(request: TileRequest): void {\r\n const imodel = request.tile.tree.iModel;\r\n let ids = this._canceled.get(imodel);\r\n if (!ids)\r\n this._canceled.set(imodel, ids = []);\r\n\r\n ids.push(request.tile.contentId);\r\n }\r\n\r\n public override processCancellations(): void {\r\n for (const [imodel, requestIds] of this._canceled) {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n IpcApp.appFunctionIpc.cancelElementGraphicsRequests(imodel.key, requestIds);\r\n this._statistics.totalAbortedRequests += requestIds.length;\r\n }\r\n\r\n this._canceled.clear();\r\n }\r\n\r\n public override onIModelClosed(imodel: IModelConnection): void {\r\n this._canceled.delete(imodel);\r\n }\r\n}\r\n\r\n/** A set of named [[TileRequestChannel]]s via which content for [[Tile]]s can be requested.\r\n * @see [[TileAdmin.channels]] for the channels configured for use with the iTwin.js display system.\r\n * @see [[TileRequestChannels.getForHttp]] for the most typical way of obtaining or registering a channel.\r\n * @public\r\n * @extensions\r\n */\r\nexport class TileRequestChannels {\r\n /** @internal */\r\n public readonly iModelChannels: IModelTileRequestChannels;\r\n /** The channel over which [[TileAdmin.requestElementGraphics]] executes. If you implement a [[TiledGraphicsProvider]] or [[TileTree]] that obtains its\r\n * content from `requestElementGraphics`, use this channel.\r\n */\r\n public readonly elementGraphicsRpc: TileRequestChannel;\r\n /** The maximum number of active requests for a channel that uses HTTP to request content. */\r\n public readonly httpConcurrency = 6;\r\n private _rpcConcurrency: number;\r\n private readonly _channels = new Map<string, TileRequestChannel>();\r\n\r\n /** `rpcConcurrency` is defined if [[IpcApp.isValid]]; otherwise RPC requests are made over HTTP and use the same limits.\r\n * @internal\r\n */\r\n public constructor(rpcConcurrency: number | undefined, cacheMetadata: boolean) {\r\n this._rpcConcurrency = rpcConcurrency ?? this.httpConcurrency;\r\n\r\n const elementGraphicsChannelName = \"itwinjs-elem-rpc\";\r\n if (undefined !== rpcConcurrency)\r\n this.elementGraphicsRpc = new ElementGraphicsChannel(elementGraphicsChannelName, rpcConcurrency);\r\n else\r\n this.elementGraphicsRpc = new TileRequestChannel(elementGraphicsChannelName, this.rpcConcurrency);\r\n\r\n this.add(this.elementGraphicsRpc);\r\n\r\n this.iModelChannels = new IModelTileRequestChannels({\r\n concurrency: this.rpcConcurrency,\r\n usesHttp: undefined === rpcConcurrency,\r\n cacheMetadata,\r\n cacheConcurrency: this.httpConcurrency,\r\n });\r\n\r\n for (const channel of this.iModelChannels)\r\n this.add(channel);\r\n }\r\n\r\n /** The number of registered channels. */\r\n public get size(): number {\r\n return this._channels.size;\r\n }\r\n\r\n /** Look up a registered channel by its name. */\r\n public get(name: string): TileRequestChannel | undefined {\r\n return this._channels.get(name);\r\n }\r\n\r\n /** Return whether the specified channel has been registered. Primarily for debugging. */\r\n public has(channel: TileRequestChannel): boolean {\r\n const existing = this.get(channel.name);\r\n return existing !== undefined && existing === channel;\r\n }\r\n\r\n /** Add a new channel.\r\n * @throws Error if a channel by the same name has already been registered.\r\n */\r\n public add(channel: TileRequestChannel): void {\r\n if (this.get(channel.name))\r\n throw new Error(`Tile request channel ${channel.name} is already registered.`);\r\n\r\n this._channels.set(channel.name, channel);\r\n }\r\n\r\n /** Extract the host name from a URL for use as the name of the corresponding [[TileRequestChannel]].\r\n * @throws TypeError if `url` is a string and does not represent a valid URL.\r\n * @see [[getForHttp]] to obtain or register a channel for the host name.\r\n */\r\n public static getNameFromUrl(url: URL | string): string {\r\n if (typeof url === \"string\")\r\n url = new URL(url);\r\n\r\n return url.hostname;\r\n }\r\n\r\n /** Obtain a channel that requests content over HTTP using HTTP 1.1 limits on simultaneous connections.\r\n * If a channel with the specified name does not already exist, it will be created and registered.\r\n * @see [[getNameFromUrl]] to obtain a channel name corresponding to a hostname.\r\n */\r\n public getForHttp(name: string): TileRequestChannel {\r\n let channel = this.get(name);\r\n if (!channel)\r\n this.add(channel = new TileRequestChannel(name, this.httpConcurrency));\r\n\r\n return channel;\r\n }\r\n\r\n /** Iterator over all of the channels. */\r\n public [Symbol.iterator](): Iterator<TileRequestChannel> {\r\n return this._channels.values()[Symbol.iterator]();\r\n }\r\n\r\n /** The maximum number of active requests for a channel that uses an RpcInterface to satisfy its requests.\r\n * For web-based applications, this is the same as [[httpConcurrency]], but for [[IpcApp]]s it is determined by the number of workers threads allocated by the backend.\r\n */\r\n public get rpcConcurrency(): number {\r\n return this._rpcConcurrency;\r\n }\r\n\r\n /** @internal */\r\n public getIModelTileChannel(tile: IModelTile): TileRequestChannel {\r\n return this.iModelChannels.getChannelForTile(tile);\r\n }\r\n\r\n /** Chiefly for debugging.\r\n * @internal\r\n */\r\n public setRpcConcurrency(concurrency: number): void {\r\n this._rpcConcurrency = concurrency;\r\n this.iModelChannels.setRpcConcurrency(concurrency);\r\n this.elementGraphicsRpc.concurrency = concurrency;\r\n }\r\n\r\n /** Statistics intended primarily for debugging. */\r\n public get statistics(): TileRequestChannelStatistics {\r\n const stats = new TileRequestChannelStatistics();\r\n for (const channel of this)\r\n channel.statistics.addTo(stats);\r\n\r\n return stats;\r\n }\r\n\r\n /** Reset all [[statistics]] to zero. */\r\n public resetStatistics(): void {\r\n for (const channel of this)\r\n channel.resetStatistics();\r\n }\r\n\r\n /** Invoked by [[TileAdmin.processQueue]] when it is about to start enqueuing new requests.\r\n * @internal\r\n */\r\n public swapPending(): void {\r\n for (const channel of this)\r\n channel.swapPending();\r\n }\r\n\r\n /** Invoked by [[TileAdmin.processQueue]] when it is about to start enqueuing new requests.\r\n * @internal\r\n */\r\n public process(): void {\r\n for (const channel of this)\r\n channel.process();\r\n }\r\n\r\n /** Invoked by [[TileAdmin.onIModelClosed]].\r\n * @internal\r\n */\r\n public onIModelClosed(iModel: IModelConnection): void {\r\n for (const channel of this)\r\n channel.onIModelClosed(iModel);\r\n }\r\n\r\n /** Invoked by [[TileAdmin.onShutDown]].\r\n * @internal\r\n */\r\n public onShutDown(): void {\r\n for (const channel of this)\r\n channel.cancelAndClearAll();\r\n\r\n this._channels.clear();\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"TileRequestChannels.js","sourceRoot":"","sources":["../../../src/tile/TileRequestChannels.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,EACO,yBAAyB,EAAe,kBAAkB,EAAE,4BAA4B,GACrG,MAAM,YAAY,CAAC;AAEpB,8FAA8F;AAC9F,MAAM,sBAAuB,SAAQ,kBAAkB;IAAvD;;QACmB,cAAS,GAAG,IAAI,GAAG,EAA8B,CAAC;IAwBrE,CAAC;IAtBiB,uBAAuB,CAAC,OAAoB;QAC1D,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MA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AE,CAAC;IAC1B,CAAC;IAED;;OAEG;IACI,OAAO;QACZ,KAAK,MAAM,OAAO,IAAI,IAAI;YACxB,OAAO,CAAC,OAAO,EAAE,CAAC;IACtB,CAAC;IAED;;OAEG;IACI,cAAc,CAAC,MAAwB;QAC5C,KAAK,MAAM,OAAO,IAAI,IAAI;YACxB,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAED;;OAEG;IACI,UAAU;QACf,KAAK,MAAM,OAAO,IAAI,IAAI;YACxB,OAAO,CAAC,iBAAiB,EAAE,CAAC;QAE9B,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\nimport { IpcApp } from \"../IpcApp\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport {\r\n IModelTile, IModelTileRequestChannels, TileRequest, TileRequestChannel, TileRequestChannelStatistics,\r\n} from \"./internal\";\r\n\r\n/** For an [[IpcApp]], allows backend element graphics requests in progress to be canceled. */\r\nclass ElementGraphicsChannel extends TileRequestChannel {\r\n private readonly _canceled = new Map<IModelConnection, string[]>();\r\n\r\n public override onActiveRequestCanceled(request: TileRequest): void {\r\n const imodel = request.tile.tree.iModel;\r\n let ids = this._canceled.get(imodel);\r\n if (!ids)\r\n this._canceled.set(imodel, ids = []);\r\n\r\n ids.push(request.tile.contentId);\r\n }\r\n\r\n public override processCancellations(): void {\r\n for (const [imodel, requestIds] of this._canceled) {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n IpcApp.appFunctionIpc.cancelElementGraphicsRequests(imodel.key, requestIds);\r\n this._statistics.totalAbortedRequests += requestIds.length;\r\n }\r\n\r\n this._canceled.clear();\r\n }\r\n\r\n public override onIModelClosed(imodel: IModelConnection): void {\r\n this._canceled.delete(imodel);\r\n }\r\n}\r\n\r\n/** A set of named [[TileRequestChannel]]s via which content for [[Tile]]s can be requested.\r\n * @see [[TileAdmin.channels]] for the channels configured for use with the iTwin.js display system.\r\n * @see [[TileRequestChannels.getForHttp]] for the most typical way of obtaining or registering a channel.\r\n * @public\r\n * @extensions\r\n */\r\nexport class TileRequestChannels {\r\n /** @internal */\r\n public readonly iModelChannels: IModelTileRequestChannels;\r\n /** The channel over which [[TileAdmin.requestElementGraphics]] executes. If you implement a [[TiledGraphicsProvider]] or [[TileTree]] that obtains its\r\n * content from `requestElementGraphics`, use this channel.\r\n */\r\n public readonly elementGraphicsRpc: TileRequestChannel;\r\n /** The maximum number of active requests for a channel that uses HTTP to request content. */\r\n public readonly httpConcurrency = 6;\r\n private _rpcConcurrency: number;\r\n private readonly _channels = new Map<string, TileRequestChannel>();\r\n\r\n /** `rpcConcurrency` is defined if [[IpcApp.isValid]]; otherwise RPC requests are made over HTTP and use the same limits.\r\n * @internal\r\n */\r\n public constructor(rpcConcurrency: number | undefined, cacheMetadata: boolean) {\r\n this._rpcConcurrency = rpcConcurrency ?? this.httpConcurrency;\r\n\r\n const elementGraphicsChannelName = \"itwinjs-elem-rpc\";\r\n if (undefined !== rpcConcurrency)\r\n this.elementGraphicsRpc = new ElementGraphicsChannel(elementGraphicsChannelName, rpcConcurrency);\r\n else\r\n this.elementGraphicsRpc = new TileRequestChannel(elementGraphicsChannelName, this.rpcConcurrency);\r\n\r\n this.add(this.elementGraphicsRpc);\r\n\r\n this.iModelChannels = new IModelTileRequestChannels({\r\n concurrency: this.rpcConcurrency,\r\n usesHttp: undefined === rpcConcurrency,\r\n cacheMetadata,\r\n cacheConcurrency: this.httpConcurrency,\r\n });\r\n\r\n for (const channel of this.iModelChannels)\r\n this.add(channel);\r\n }\r\n\r\n /** The number of registered channels. */\r\n public get size(): number {\r\n return this._channels.size;\r\n }\r\n\r\n /** Look up a registered channel by its name. */\r\n public get(name: string): TileRequestChannel | undefined {\r\n return this._channels.get(name);\r\n }\r\n\r\n /** Return whether the specified channel has been registered. Primarily for debugging. */\r\n public has(channel: TileRequestChannel): boolean {\r\n const existing = this.get(channel.name);\r\n return existing !== undefined && existing === channel;\r\n }\r\n\r\n /** Add a new channel.\r\n * @throws Error if a channel by the same name has already been registered.\r\n */\r\n public add(channel: TileRequestChannel): void {\r\n if (this.get(channel.name))\r\n throw new Error(`Tile request channel ${channel.name} is already registered.`);\r\n\r\n this._channels.set(channel.name, channel);\r\n }\r\n\r\n /** Extract the host name from a URL for use as the name of the corresponding [[TileRequestChannel]].\r\n * @throws TypeError if `url` is a string and does not represent a valid URL.\r\n * @see [[getForHttp]] to obtain or register a channel for the host name.\r\n */\r\n public static getNameFromUrl(url: URL | string): string {\r\n if (typeof url === \"string\")\r\n url = new URL(url);\r\n\r\n return url.hostname;\r\n }\r\n\r\n /** Obtain a channel that requests content over HTTP using HTTP 1.1 limits on simultaneous connections.\r\n * If a channel with the specified name does not already exist, it will be created and registered.\r\n * @see [[getNameFromUrl]] to obtain a channel name corresponding to a hostname.\r\n */\r\n public getForHttp(name: string): TileRequestChannel {\r\n let channel = this.get(name);\r\n if (!channel)\r\n this.add(channel = new TileRequestChannel(name, this.httpConcurrency));\r\n\r\n return channel;\r\n }\r\n\r\n /** Iterator over all of the channels. */\r\n public [Symbol.iterator](): Iterator<TileRequestChannel> {\r\n return this._channels.values()[Symbol.iterator]();\r\n }\r\n\r\n /** The maximum number of active requests for a channel that uses an RpcInterface to satisfy its requests.\r\n * For web-based applications, this is the same as [[httpConcurrency]], but for [[IpcApp]]s it is determined by the number of workers threads allocated by the backend.\r\n */\r\n public get rpcConcurrency(): number {\r\n return this._rpcConcurrency;\r\n }\r\n\r\n /** @internal */\r\n public getIModelTileChannel(tile: IModelTile): TileRequestChannel {\r\n return this.iModelChannels.getChannelForTile(tile);\r\n }\r\n\r\n /** Chiefly for debugging.\r\n * @internal\r\n */\r\n public setRpcConcurrency(concurrency: number): void {\r\n this._rpcConcurrency = concurrency;\r\n this.iModelChannels.setRpcConcurrency(concurrency);\r\n this.elementGraphicsRpc.concurrency = concurrency;\r\n }\r\n\r\n /** Statistics intended primarily for debugging. */\r\n public get statistics(): TileRequestChannelStatistics {\r\n const stats = new TileRequestChannelStatistics();\r\n for (const channel of this)\r\n channel.statistics.addTo(stats);\r\n\r\n return stats;\r\n }\r\n\r\n /** Reset all [[statistics]] to zero. */\r\n public resetStatistics(): void {\r\n for (const channel of this)\r\n channel.resetStatistics();\r\n }\r\n\r\n /** Invoked by [[TileAdmin.processQueue]] when it is about to start enqueuing new requests.\r\n * @internal\r\n */\r\n public swapPending(): void {\r\n for (const channel of this)\r\n channel.swapPending();\r\n }\r\n\r\n /** Invoked by [[TileAdmin.processQueue]] when it is about to start enqueuing new requests.\r\n * @internal\r\n */\r\n public process(): void {\r\n for (const channel of this)\r\n channel.process();\r\n }\r\n\r\n /** Invoked by [[TileAdmin.onIModelClosed]].\r\n * @internal\r\n */\r\n public onIModelClosed(iModel: IModelConnection): void {\r\n for (const channel of this)\r\n channel.onIModelClosed(iModel);\r\n }\r\n\r\n /** Invoked by [[TileAdmin.onShutDown]].\r\n * @internal\r\n */\r\n public onShutDown(): void {\r\n for (const channel of this)\r\n channel.cancelAndClearAll();\r\n\r\n this._channels.clear();\r\n }\r\n}\r\n"]}
|
package/lib/esm/tile/TileTree.js
CHANGED
|
@@ -43,7 +43,6 @@ export var TileTreeLoadStatus;
|
|
|
43
43
|
export class TileTree {
|
|
44
44
|
/** Constructor */
|
|
45
45
|
constructor(params) {
|
|
46
|
-
var _a;
|
|
47
46
|
this._isDisposed = false;
|
|
48
47
|
/** @internal */
|
|
49
48
|
this._lastSelected = BeTimePoint.now();
|
|
@@ -56,7 +55,7 @@ export class TileTree {
|
|
|
56
55
|
this.contentRange = params.contentRange;
|
|
57
56
|
const admin = IModelApp.tileAdmin;
|
|
58
57
|
this._loadPriority = params.priority;
|
|
59
|
-
this.expirationTime =
|
|
58
|
+
this.expirationTime = params.expirationTime ?? admin.tileExpirationTime;
|
|
60
59
|
}
|
|
61
60
|
/** @internal */
|
|
62
61
|
get loadPriority() { return this._loadPriority; }
|
|
@@ -123,7 +122,7 @@ export class TileTree {
|
|
|
123
122
|
if (center) {
|
|
124
123
|
this.iModelTransform.multiplyPoint3d(center, center);
|
|
125
124
|
const ecefToDb = await calculateEcefToDbTransformAtLocation(center, this.iModel);
|
|
126
|
-
dbToEcef = ecefToDb
|
|
125
|
+
dbToEcef = ecefToDb?.inverse();
|
|
127
126
|
}
|
|
128
127
|
if (!dbToEcef)
|
|
129
128
|
dbToEcef = this.iModel.ecefLocation.getTransform();
|