@itwin/core-frontend 3.2.0-dev.34 → 3.2.0-dev.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -1
- package/lib/cjs/AccuDraw.d.ts +2 -0
- package/lib/cjs/AccuDraw.d.ts.map +1 -1
- package/lib/cjs/AccuDraw.js +2 -0
- package/lib/cjs/AccuDraw.js.map +1 -1
- package/lib/cjs/AccuSnap.d.ts +1 -0
- package/lib/cjs/AccuSnap.d.ts.map +1 -1
- package/lib/cjs/AccuSnap.js +1 -0
- package/lib/cjs/AccuSnap.js.map +1 -1
- package/lib/cjs/ApproximateTerrainHeights.d.ts.map +1 -1
- package/lib/cjs/ApproximateTerrainHeights.js +4 -2
- package/lib/cjs/ApproximateTerrainHeights.js.map +1 -1
- package/lib/cjs/ApproximateTerrainHeightsProps.d.ts +1 -1
- package/lib/cjs/ApproximateTerrainHeightsProps.d.ts.map +1 -1
- package/lib/cjs/ApproximateTerrainHeightsProps.js +2 -2
- package/lib/cjs/ApproximateTerrainHeightsProps.js.map +1 -1
- package/lib/cjs/AuxCoordSys.d.ts +12 -2
- package/lib/cjs/AuxCoordSys.d.ts.map +1 -1
- package/lib/cjs/AuxCoordSys.js +12 -2
- package/lib/cjs/AuxCoordSys.js.map +1 -1
- package/lib/cjs/BingLocation.d.ts +1 -0
- package/lib/cjs/BingLocation.d.ts.map +1 -1
- package/lib/cjs/BingLocation.js +1 -0
- package/lib/cjs/BingLocation.js.map +1 -1
- package/lib/cjs/CategorySelectorState.d.ts +1 -0
- package/lib/cjs/CategorySelectorState.d.ts.map +1 -1
- package/lib/cjs/CategorySelectorState.js +1 -0
- package/lib/cjs/CategorySelectorState.js.map +1 -1
- package/lib/cjs/ChangeFlags.d.ts +1 -0
- package/lib/cjs/ChangeFlags.d.ts.map +1 -1
- package/lib/cjs/ChangeFlags.js +1 -0
- package/lib/cjs/ChangeFlags.js.map +1 -1
- package/lib/cjs/ContextRealityModelState.d.ts +1 -0
- package/lib/cjs/ContextRealityModelState.d.ts.map +1 -1
- package/lib/cjs/ContextRealityModelState.js +1 -0
- package/lib/cjs/ContextRealityModelState.js.map +1 -1
- package/lib/cjs/CoordSystem.d.ts +1 -0
- package/lib/cjs/CoordSystem.d.ts.map +1 -1
- package/lib/cjs/CoordSystem.js +1 -0
- package/lib/cjs/CoordSystem.js.map +1 -1
- package/lib/cjs/DisplayStyleState.d.ts +4 -0
- package/lib/cjs/DisplayStyleState.d.ts.map +1 -1
- package/lib/cjs/DisplayStyleState.js +3 -0
- package/lib/cjs/DisplayStyleState.js.map +1 -1
- package/lib/cjs/DrawingViewState.d.ts +1 -0
- package/lib/cjs/DrawingViewState.d.ts.map +1 -1
- package/lib/cjs/DrawingViewState.js +1 -0
- package/lib/cjs/DrawingViewState.js.map +1 -1
- package/lib/cjs/ElementLocateManager.d.ts +23 -5
- package/lib/cjs/ElementLocateManager.d.ts.map +1 -1
- package/lib/cjs/ElementLocateManager.js +19 -4
- package/lib/cjs/ElementLocateManager.js.map +1 -1
- package/lib/cjs/EmphasizeElements.d.ts +1 -0
- package/lib/cjs/EmphasizeElements.d.ts.map +1 -1
- package/lib/cjs/EmphasizeElements.js +1 -0
- package/lib/cjs/EmphasizeElements.js.map +1 -1
- package/lib/cjs/EntityState.d.ts +2 -0
- package/lib/cjs/EntityState.d.ts.map +1 -1
- package/lib/cjs/EntityState.js +2 -0
- package/lib/cjs/EntityState.js.map +1 -1
- package/lib/cjs/FeatureOverrideProvider.d.ts +1 -0
- package/lib/cjs/FeatureOverrideProvider.d.ts.map +1 -1
- package/lib/cjs/FeatureOverrideProvider.js.map +1 -1
- package/lib/cjs/FlashSettings.d.ts +3 -0
- package/lib/cjs/FlashSettings.d.ts.map +1 -1
- package/lib/cjs/FlashSettings.js +2 -0
- package/lib/cjs/FlashSettings.js.map +1 -1
- package/lib/cjs/FrontendHubAccess.d.ts +4 -1
- package/lib/cjs/FrontendHubAccess.d.ts.map +1 -1
- package/lib/cjs/FrontendHubAccess.js.map +1 -1
- package/lib/cjs/FrontendLoggerCategory.d.ts +1 -0
- package/lib/cjs/FrontendLoggerCategory.d.ts.map +1 -1
- package/lib/cjs/FrontendLoggerCategory.js +1 -0
- package/lib/cjs/FrontendLoggerCategory.js.map +1 -1
- package/lib/cjs/FrustumAnimator.d.ts +1 -0
- package/lib/cjs/FrustumAnimator.d.ts.map +1 -1
- package/lib/cjs/FrustumAnimator.js +1 -0
- package/lib/cjs/FrustumAnimator.js.map +1 -1
- package/lib/cjs/FuzzySearch.d.ts +1 -0
- package/lib/cjs/FuzzySearch.d.ts.map +1 -1
- package/lib/cjs/FuzzySearch.js.map +1 -1
- package/lib/cjs/GlobeAnimator.d.ts +1 -0
- package/lib/cjs/GlobeAnimator.d.ts.map +1 -1
- package/lib/cjs/GlobeAnimator.js +1 -0
- package/lib/cjs/GlobeAnimator.js.map +1 -1
- package/lib/cjs/HitDetail.d.ts +26 -5
- package/lib/cjs/HitDetail.d.ts.map +1 -1
- package/lib/cjs/HitDetail.js +26 -5
- package/lib/cjs/HitDetail.js.map +1 -1
- package/lib/cjs/IModelApp.d.ts +7 -0
- package/lib/cjs/IModelApp.d.ts.map +1 -1
- package/lib/cjs/IModelApp.js +32 -20
- package/lib/cjs/IModelApp.js.map +1 -1
- package/lib/cjs/IModelConnection.d.ts +1 -0
- package/lib/cjs/IModelConnection.d.ts.map +1 -1
- package/lib/cjs/IModelConnection.js +1 -0
- package/lib/cjs/IModelConnection.js.map +1 -1
- package/lib/cjs/ImageUtil.d.ts +11 -0
- package/lib/cjs/ImageUtil.d.ts.map +1 -1
- package/lib/cjs/ImageUtil.js +11 -0
- package/lib/cjs/ImageUtil.js.map +1 -1
- package/lib/cjs/IpcApp.d.ts +1 -0
- package/lib/cjs/IpcApp.d.ts.map +1 -1
- package/lib/cjs/IpcApp.js +1 -0
- package/lib/cjs/IpcApp.js.map +1 -1
- package/lib/cjs/MarginPercent.d.ts +1 -0
- package/lib/cjs/MarginPercent.d.ts.map +1 -1
- package/lib/cjs/MarginPercent.js +1 -0
- package/lib/cjs/MarginPercent.js.map +1 -1
- package/lib/cjs/Marker.d.ts +16 -3
- package/lib/cjs/Marker.d.ts.map +1 -1
- package/lib/cjs/Marker.js +3 -0
- package/lib/cjs/Marker.js.map +1 -1
- package/lib/cjs/ModelSelectorState.d.ts +1 -0
- package/lib/cjs/ModelSelectorState.d.ts.map +1 -1
- package/lib/cjs/ModelSelectorState.js +1 -0
- package/lib/cjs/ModelSelectorState.js.map +1 -1
- package/lib/cjs/ModelState.d.ts +10 -0
- package/lib/cjs/ModelState.d.ts.map +1 -1
- package/lib/cjs/ModelState.js +10 -0
- package/lib/cjs/ModelState.js.map +1 -1
- package/lib/cjs/NotificationManager.d.ts +11 -0
- package/lib/cjs/NotificationManager.d.ts.map +1 -1
- package/lib/cjs/NotificationManager.js +10 -0
- package/lib/cjs/NotificationManager.js.map +1 -1
- package/lib/cjs/PerModelCategoryVisibility.d.ts +1 -0
- package/lib/cjs/PerModelCategoryVisibility.d.ts.map +1 -1
- package/lib/cjs/PerModelCategoryVisibility.js +1 -0
- package/lib/cjs/PerModelCategoryVisibility.js.map +1 -1
- package/lib/cjs/SelectionSet.d.ts +7 -0
- package/lib/cjs/SelectionSet.d.ts.map +1 -1
- package/lib/cjs/SelectionSet.js +3 -0
- package/lib/cjs/SelectionSet.js.map +1 -1
- package/lib/cjs/SheetViewState.d.ts +1 -0
- package/lib/cjs/SheetViewState.d.ts.map +1 -1
- package/lib/cjs/SheetViewState.js +1 -0
- package/lib/cjs/SheetViewState.js.map +1 -1
- package/lib/cjs/SpatialViewState.d.ts +2 -0
- package/lib/cjs/SpatialViewState.d.ts.map +1 -1
- package/lib/cjs/SpatialViewState.js +2 -0
- package/lib/cjs/SpatialViewState.js.map +1 -1
- package/lib/cjs/Sprites.d.ts +3 -0
- package/lib/cjs/Sprites.d.ts.map +1 -1
- package/lib/cjs/Sprites.js +3 -0
- package/lib/cjs/Sprites.js.map +1 -1
- package/lib/cjs/StandardView.d.ts +1 -0
- package/lib/cjs/StandardView.d.ts.map +1 -1
- package/lib/cjs/StandardView.js +1 -0
- package/lib/cjs/StandardView.js.map +1 -1
- package/lib/cjs/TentativePoint.d.ts +4 -1
- package/lib/cjs/TentativePoint.d.ts.map +1 -1
- package/lib/cjs/TentativePoint.js +4 -1
- package/lib/cjs/TentativePoint.js.map +1 -1
- package/lib/cjs/Tiles.d.ts +1 -0
- package/lib/cjs/Tiles.d.ts.map +1 -1
- package/lib/cjs/Tiles.js +1 -0
- package/lib/cjs/Tiles.js.map +1 -1
- package/lib/cjs/ViewAnimation.d.ts +6 -0
- package/lib/cjs/ViewAnimation.d.ts.map +1 -1
- package/lib/cjs/ViewAnimation.js.map +1 -1
- package/lib/cjs/ViewCreator2d.d.ts +2 -0
- package/lib/cjs/ViewCreator2d.d.ts.map +1 -1
- package/lib/cjs/ViewCreator2d.js +1 -0
- package/lib/cjs/ViewCreator2d.js.map +1 -1
- package/lib/cjs/ViewCreator3d.d.ts +2 -0
- package/lib/cjs/ViewCreator3d.d.ts.map +1 -1
- package/lib/cjs/ViewCreator3d.js +1 -0
- package/lib/cjs/ViewCreator3d.js.map +1 -1
- package/lib/cjs/ViewGlobalLocation.d.ts +3 -0
- package/lib/cjs/ViewGlobalLocation.d.ts.map +1 -1
- package/lib/cjs/ViewGlobalLocation.js +1 -0
- package/lib/cjs/ViewGlobalLocation.js.map +1 -1
- package/lib/cjs/ViewManager.d.ts +3 -0
- package/lib/cjs/ViewManager.d.ts.map +1 -1
- package/lib/cjs/ViewManager.js +1 -0
- package/lib/cjs/ViewManager.js.map +1 -1
- package/lib/cjs/ViewPose.d.ts +1 -0
- package/lib/cjs/ViewPose.d.ts.map +1 -1
- package/lib/cjs/ViewPose.js +1 -0
- package/lib/cjs/ViewPose.js.map +1 -1
- package/lib/cjs/ViewRect.d.ts +1 -0
- package/lib/cjs/ViewRect.d.ts.map +1 -1
- package/lib/cjs/ViewRect.js +1 -0
- package/lib/cjs/ViewRect.js.map +1 -1
- package/lib/cjs/ViewState.d.ts +4 -0
- package/lib/cjs/ViewState.d.ts.map +1 -1
- package/lib/cjs/ViewState.js +3 -0
- package/lib/cjs/ViewState.js.map +1 -1
- package/lib/cjs/ViewStatus.d.ts +1 -0
- package/lib/cjs/ViewStatus.d.ts.map +1 -1
- package/lib/cjs/ViewStatus.js +1 -0
- package/lib/cjs/ViewStatus.js.map +1 -1
- package/lib/cjs/ViewingSpace.d.ts +1 -0
- package/lib/cjs/ViewingSpace.d.ts.map +1 -1
- package/lib/cjs/ViewingSpace.js +1 -0
- package/lib/cjs/ViewingSpace.js.map +1 -1
- package/lib/cjs/core-frontend.d.ts +6 -5
- package/lib/cjs/core-frontend.d.ts.map +1 -1
- package/lib/cjs/core-frontend.js +7 -5
- package/lib/cjs/core-frontend.js.map +1 -1
- package/lib/cjs/extension/Extension.d.ts +22 -3
- package/lib/cjs/extension/Extension.d.ts.map +1 -1
- package/lib/cjs/extension/Extension.js +0 -8
- package/lib/cjs/extension/Extension.js.map +1 -1
- package/lib/cjs/extension/ExtensionAdmin.d.ts +1 -3
- package/lib/cjs/extension/ExtensionAdmin.d.ts.map +1 -1
- package/lib/cjs/extension/ExtensionAdmin.js +1 -4
- package/lib/cjs/extension/ExtensionAdmin.js.map +1 -1
- package/lib/cjs/extension/ExtensionRuntime.js +231 -59
- package/lib/cjs/extension/ExtensionRuntime.js.map +1 -1
- package/lib/cjs/render/CanvasDecoration.d.ts +2 -0
- package/lib/cjs/render/CanvasDecoration.d.ts.map +1 -1
- package/lib/cjs/render/CanvasDecoration.js.map +1 -1
- package/lib/cjs/render/Decorations.d.ts +1 -0
- package/lib/cjs/render/Decorations.d.ts.map +1 -1
- package/lib/cjs/render/Decorations.js +1 -0
- package/lib/cjs/render/Decorations.js.map +1 -1
- package/lib/cjs/render/FeatureSymbology.d.ts +1 -0
- package/lib/cjs/render/FeatureSymbology.d.ts.map +1 -1
- package/lib/cjs/render/FeatureSymbology.js +1 -0
- package/lib/cjs/render/FeatureSymbology.js.map +1 -1
- package/lib/cjs/render/GraphicBranch.d.ts +2 -0
- package/lib/cjs/render/GraphicBranch.d.ts.map +1 -1
- package/lib/cjs/render/GraphicBranch.js +1 -0
- package/lib/cjs/render/GraphicBranch.js.map +1 -1
- package/lib/cjs/render/GraphicBuilder.d.ts +8 -0
- package/lib/cjs/render/GraphicBuilder.d.ts.map +1 -1
- package/lib/cjs/render/GraphicBuilder.js +2 -0
- package/lib/cjs/render/GraphicBuilder.js.map +1 -1
- package/lib/cjs/render/GraphicPrimitive.d.ts +14 -0
- package/lib/cjs/render/GraphicPrimitive.d.ts.map +1 -1
- package/lib/cjs/render/GraphicPrimitive.js.map +1 -1
- package/lib/cjs/render/ParticleCollectionBuilder.d.ts +3 -0
- package/lib/cjs/render/ParticleCollectionBuilder.d.ts.map +1 -1
- package/lib/cjs/render/ParticleCollectionBuilder.js.map +1 -1
- package/lib/cjs/render/Pixel.d.ts +1 -0
- package/lib/cjs/render/Pixel.d.ts.map +1 -1
- package/lib/cjs/render/Pixel.js +1 -0
- package/lib/cjs/render/Pixel.js.map +1 -1
- package/lib/cjs/render/RenderClipVolume.d.ts +1 -0
- package/lib/cjs/render/RenderClipVolume.d.ts.map +1 -1
- package/lib/cjs/render/RenderClipVolume.js +1 -0
- package/lib/cjs/render/RenderClipVolume.js.map +1 -1
- package/lib/cjs/render/RenderGraphic.d.ts +3 -0
- package/lib/cjs/render/RenderGraphic.d.ts.map +1 -1
- package/lib/cjs/render/RenderGraphic.js +2 -0
- package/lib/cjs/render/RenderGraphic.js.map +1 -1
- package/lib/cjs/render/RenderSystem.d.ts +1 -0
- package/lib/cjs/render/RenderSystem.d.ts.map +1 -1
- package/lib/cjs/render/RenderSystem.js +1 -0
- package/lib/cjs/render/RenderSystem.js.map +1 -1
- package/lib/cjs/render/RenderTexture.d.ts +7 -0
- package/lib/cjs/render/RenderTexture.d.ts.map +1 -1
- package/lib/cjs/render/RenderTexture.js.map +1 -1
- package/lib/cjs/render/Scene.d.ts +1 -0
- package/lib/cjs/render/Scene.d.ts.map +1 -1
- package/lib/cjs/render/Scene.js +1 -0
- package/lib/cjs/render/Scene.js.map +1 -1
- package/lib/cjs/render/ScreenSpaceEffectBuilder.d.ts +10 -0
- package/lib/cjs/render/ScreenSpaceEffectBuilder.d.ts.map +1 -1
- package/lib/cjs/render/ScreenSpaceEffectBuilder.js +2 -0
- package/lib/cjs/render/ScreenSpaceEffectBuilder.js.map +1 -1
- package/lib/cjs/render/webgl/System.d.ts +1 -1
- package/lib/cjs/render/webgl/Target.d.ts.map +1 -1
- package/lib/cjs/render/webgl/Target.js +4 -1
- package/lib/cjs/render/webgl/Target.js.map +1 -1
- package/lib/cjs/tile/DisclosedTileTreeSet.d.ts +2 -0
- package/lib/cjs/tile/DisclosedTileTreeSet.d.ts.map +1 -1
- package/lib/cjs/tile/DisclosedTileTreeSet.js +1 -0
- package/lib/cjs/tile/DisclosedTileTreeSet.js.map +1 -1
- package/lib/cjs/tile/ImdlReader.d.ts +1 -0
- package/lib/cjs/tile/ImdlReader.d.ts.map +1 -1
- package/lib/cjs/tile/ImdlReader.js +1 -0
- package/lib/cjs/tile/ImdlReader.js.map +1 -1
- package/lib/cjs/tile/Tile.d.ts +5 -0
- package/lib/cjs/tile/Tile.d.ts.map +1 -1
- package/lib/cjs/tile/Tile.js +5 -0
- package/lib/cjs/tile/Tile.js.map +1 -1
- package/lib/cjs/tile/TileAdmin.d.ts +3 -0
- package/lib/cjs/tile/TileAdmin.d.ts.map +1 -1
- package/lib/cjs/tile/TileAdmin.js +1 -0
- package/lib/cjs/tile/TileAdmin.js.map +1 -1
- package/lib/cjs/tile/TileContent.d.ts +1 -0
- package/lib/cjs/tile/TileContent.d.ts.map +1 -1
- package/lib/cjs/tile/TileContent.js.map +1 -1
- package/lib/cjs/tile/TileDrawArgs.d.ts +2 -0
- package/lib/cjs/tile/TileDrawArgs.d.ts.map +1 -1
- package/lib/cjs/tile/TileDrawArgs.js +1 -0
- package/lib/cjs/tile/TileDrawArgs.js.map +1 -1
- package/lib/cjs/tile/TileParams.d.ts +1 -0
- package/lib/cjs/tile/TileParams.d.ts.map +1 -1
- package/lib/cjs/tile/TileParams.js.map +1 -1
- package/lib/cjs/tile/TileRequest.d.ts +1 -0
- package/lib/cjs/tile/TileRequest.d.ts.map +1 -1
- package/lib/cjs/tile/TileRequest.js +1 -0
- package/lib/cjs/tile/TileRequest.js.map +1 -1
- package/lib/cjs/tile/TileRequestChannel.d.ts +2 -0
- package/lib/cjs/tile/TileRequestChannel.d.ts.map +1 -1
- package/lib/cjs/tile/TileRequestChannel.js +2 -0
- package/lib/cjs/tile/TileRequestChannel.js.map +1 -1
- package/lib/cjs/tile/TileRequestChannels.d.ts +1 -0
- package/lib/cjs/tile/TileRequestChannels.d.ts.map +1 -1
- package/lib/cjs/tile/TileRequestChannels.js +1 -0
- package/lib/cjs/tile/TileRequestChannels.js.map +1 -1
- package/lib/cjs/tile/TileTree.d.ts +2 -0
- package/lib/cjs/tile/TileTree.d.ts.map +1 -1
- package/lib/cjs/tile/TileTree.js +2 -0
- package/lib/cjs/tile/TileTree.js.map +1 -1
- package/lib/cjs/tile/TileTreeOwner.d.ts +1 -0
- package/lib/cjs/tile/TileTreeOwner.d.ts.map +1 -1
- package/lib/cjs/tile/TileTreeOwner.js.map +1 -1
- package/lib/cjs/tile/TileTreeParams.d.ts +1 -0
- package/lib/cjs/tile/TileTreeParams.d.ts.map +1 -1
- package/lib/cjs/tile/TileTreeParams.js.map +1 -1
- package/lib/cjs/tile/TileTreeReference.d.ts +2 -0
- package/lib/cjs/tile/TileTreeReference.d.ts.map +1 -1
- package/lib/cjs/tile/TileTreeReference.js +2 -0
- package/lib/cjs/tile/TileTreeReference.js.map +1 -1
- package/lib/cjs/tile/TileTreeSupplier.d.ts +1 -0
- package/lib/cjs/tile/TileTreeSupplier.d.ts.map +1 -1
- package/lib/cjs/tile/TileTreeSupplier.js.map +1 -1
- package/lib/cjs/tile/TileUsageMarker.d.ts +1 -0
- package/lib/cjs/tile/TileUsageMarker.d.ts.map +1 -1
- package/lib/cjs/tile/TileUsageMarker.js +1 -0
- package/lib/cjs/tile/TileUsageMarker.js.map +1 -1
- package/lib/cjs/tile/TiledGraphicsProvider.d.ts +1 -0
- package/lib/cjs/tile/TiledGraphicsProvider.d.ts.map +1 -1
- package/lib/cjs/tile/TiledGraphicsProvider.js.map +1 -1
- package/lib/cjs/tile/map/BingElevation.d.ts +1 -0
- package/lib/cjs/tile/map/BingElevation.d.ts.map +1 -1
- package/lib/cjs/tile/map/BingElevation.js +1 -0
- package/lib/cjs/tile/map/BingElevation.js.map +1 -1
- package/lib/cjs/tools/ClipViewTool.d.ts +5 -3
- package/lib/cjs/tools/ClipViewTool.d.ts.map +1 -1
- package/lib/cjs/tools/ClipViewTool.js +4 -3
- package/lib/cjs/tools/ClipViewTool.js.map +1 -1
- package/lib/cjs/tools/EditManipulator.d.ts +1 -0
- package/lib/cjs/tools/EditManipulator.d.ts.map +1 -1
- package/lib/cjs/tools/EditManipulator.js +1 -0
- package/lib/cjs/tools/EditManipulator.js.map +1 -1
- package/lib/cjs/tools/EventController.d.ts +1 -0
- package/lib/cjs/tools/EventController.d.ts.map +1 -1
- package/lib/cjs/tools/EventController.js +1 -0
- package/lib/cjs/tools/EventController.js.map +1 -1
- package/lib/cjs/tools/PrimitiveTool.d.ts +1 -0
- package/lib/cjs/tools/PrimitiveTool.d.ts.map +1 -1
- package/lib/cjs/tools/PrimitiveTool.js +1 -0
- package/lib/cjs/tools/PrimitiveTool.js.map +1 -1
- package/lib/cjs/tools/SelectTool.d.ts +3 -0
- package/lib/cjs/tools/SelectTool.d.ts.map +1 -1
- package/lib/cjs/tools/SelectTool.js +3 -0
- package/lib/cjs/tools/SelectTool.js.map +1 -1
- package/lib/cjs/tools/Tool.d.ts +41 -6
- package/lib/cjs/tools/Tool.d.ts.map +1 -1
- package/lib/cjs/tools/Tool.js +27 -4
- package/lib/cjs/tools/Tool.js.map +1 -1
- package/lib/cjs/tools/ToolAdmin.d.ts +9 -2
- package/lib/cjs/tools/ToolAdmin.d.ts.map +1 -1
- package/lib/cjs/tools/ToolAdmin.js +9 -2
- package/lib/cjs/tools/ToolAdmin.js.map +1 -1
- package/lib/cjs/tools/ToolAssistance.d.ts +7 -0
- package/lib/cjs/tools/ToolAssistance.d.ts.map +1 -1
- package/lib/cjs/tools/ToolAssistance.js +3 -0
- package/lib/cjs/tools/ToolAssistance.js.map +1 -1
- package/lib/cjs/tools/ToolSettings.d.ts +1 -0
- package/lib/cjs/tools/ToolSettings.d.ts.map +1 -1
- package/lib/cjs/tools/ToolSettings.js +1 -0
- package/lib/cjs/tools/ToolSettings.js.map +1 -1
- package/lib/cjs/tools/ViewTool.d.ts +2 -0
- package/lib/cjs/tools/ViewTool.d.ts.map +1 -1
- package/lib/cjs/tools/ViewTool.js +2 -0
- package/lib/cjs/tools/ViewTool.js.map +1 -1
- package/lib/esm/AccuDraw.d.ts +2 -0
- package/lib/esm/AccuDraw.d.ts.map +1 -1
- package/lib/esm/AccuDraw.js +2 -0
- package/lib/esm/AccuDraw.js.map +1 -1
- package/lib/esm/AccuSnap.d.ts +1 -0
- package/lib/esm/AccuSnap.d.ts.map +1 -1
- package/lib/esm/AccuSnap.js +1 -0
- package/lib/esm/AccuSnap.js.map +1 -1
- package/lib/esm/ApproximateTerrainHeights.d.ts.map +1 -1
- package/lib/esm/ApproximateTerrainHeights.js +4 -2
- package/lib/esm/ApproximateTerrainHeights.js.map +1 -1
- package/lib/esm/ApproximateTerrainHeightsProps.d.ts +1 -1
- package/lib/esm/ApproximateTerrainHeightsProps.d.ts.map +1 -1
- package/lib/esm/ApproximateTerrainHeightsProps.js +1 -1
- package/lib/esm/ApproximateTerrainHeightsProps.js.map +1 -1
- package/lib/esm/AuxCoordSys.d.ts +12 -2
- package/lib/esm/AuxCoordSys.d.ts.map +1 -1
- package/lib/esm/AuxCoordSys.js +12 -2
- package/lib/esm/AuxCoordSys.js.map +1 -1
- package/lib/esm/BingLocation.d.ts +1 -0
- package/lib/esm/BingLocation.d.ts.map +1 -1
- package/lib/esm/BingLocation.js +1 -0
- package/lib/esm/BingLocation.js.map +1 -1
- package/lib/esm/CategorySelectorState.d.ts +1 -0
- package/lib/esm/CategorySelectorState.d.ts.map +1 -1
- package/lib/esm/CategorySelectorState.js +1 -0
- package/lib/esm/CategorySelectorState.js.map +1 -1
- package/lib/esm/ChangeFlags.d.ts +1 -0
- package/lib/esm/ChangeFlags.d.ts.map +1 -1
- package/lib/esm/ChangeFlags.js +1 -0
- package/lib/esm/ChangeFlags.js.map +1 -1
- package/lib/esm/ContextRealityModelState.d.ts +1 -0
- package/lib/esm/ContextRealityModelState.d.ts.map +1 -1
- package/lib/esm/ContextRealityModelState.js +1 -0
- package/lib/esm/ContextRealityModelState.js.map +1 -1
- package/lib/esm/CoordSystem.d.ts +1 -0
- package/lib/esm/CoordSystem.d.ts.map +1 -1
- package/lib/esm/CoordSystem.js +1 -0
- package/lib/esm/CoordSystem.js.map +1 -1
- package/lib/esm/DisplayStyleState.d.ts +4 -0
- package/lib/esm/DisplayStyleState.d.ts.map +1 -1
- package/lib/esm/DisplayStyleState.js +3 -0
- package/lib/esm/DisplayStyleState.js.map +1 -1
- package/lib/esm/DrawingViewState.d.ts +1 -0
- package/lib/esm/DrawingViewState.d.ts.map +1 -1
- package/lib/esm/DrawingViewState.js +1 -0
- package/lib/esm/DrawingViewState.js.map +1 -1
- package/lib/esm/ElementLocateManager.d.ts +23 -5
- package/lib/esm/ElementLocateManager.d.ts.map +1 -1
- package/lib/esm/ElementLocateManager.js +19 -4
- package/lib/esm/ElementLocateManager.js.map +1 -1
- package/lib/esm/EmphasizeElements.d.ts +1 -0
- package/lib/esm/EmphasizeElements.d.ts.map +1 -1
- package/lib/esm/EmphasizeElements.js +1 -0
- package/lib/esm/EmphasizeElements.js.map +1 -1
- package/lib/esm/EntityState.d.ts +2 -0
- package/lib/esm/EntityState.d.ts.map +1 -1
- package/lib/esm/EntityState.js +2 -0
- package/lib/esm/EntityState.js.map +1 -1
- package/lib/esm/FeatureOverrideProvider.d.ts +1 -0
- package/lib/esm/FeatureOverrideProvider.d.ts.map +1 -1
- package/lib/esm/FeatureOverrideProvider.js.map +1 -1
- package/lib/esm/FlashSettings.d.ts +3 -0
- package/lib/esm/FlashSettings.d.ts.map +1 -1
- package/lib/esm/FlashSettings.js +2 -0
- package/lib/esm/FlashSettings.js.map +1 -1
- package/lib/esm/FrontendHubAccess.d.ts +4 -1
- package/lib/esm/FrontendHubAccess.d.ts.map +1 -1
- package/lib/esm/FrontendHubAccess.js.map +1 -1
- package/lib/esm/FrontendLoggerCategory.d.ts +1 -0
- package/lib/esm/FrontendLoggerCategory.d.ts.map +1 -1
- package/lib/esm/FrontendLoggerCategory.js +1 -0
- package/lib/esm/FrontendLoggerCategory.js.map +1 -1
- package/lib/esm/FrustumAnimator.d.ts +1 -0
- package/lib/esm/FrustumAnimator.d.ts.map +1 -1
- package/lib/esm/FrustumAnimator.js +1 -0
- package/lib/esm/FrustumAnimator.js.map +1 -1
- package/lib/esm/FuzzySearch.d.ts +1 -0
- package/lib/esm/FuzzySearch.d.ts.map +1 -1
- package/lib/esm/FuzzySearch.js.map +1 -1
- package/lib/esm/GlobeAnimator.d.ts +1 -0
- package/lib/esm/GlobeAnimator.d.ts.map +1 -1
- package/lib/esm/GlobeAnimator.js +1 -0
- package/lib/esm/GlobeAnimator.js.map +1 -1
- package/lib/esm/HitDetail.d.ts +26 -5
- package/lib/esm/HitDetail.d.ts.map +1 -1
- package/lib/esm/HitDetail.js +26 -5
- package/lib/esm/HitDetail.js.map +1 -1
- package/lib/esm/IModelApp.d.ts +7 -0
- package/lib/esm/IModelApp.d.ts.map +1 -1
- package/lib/esm/IModelApp.js +32 -20
- package/lib/esm/IModelApp.js.map +1 -1
- package/lib/esm/IModelConnection.d.ts +1 -0
- package/lib/esm/IModelConnection.d.ts.map +1 -1
- package/lib/esm/IModelConnection.js +1 -0
- package/lib/esm/IModelConnection.js.map +1 -1
- package/lib/esm/ImageUtil.d.ts +11 -0
- package/lib/esm/ImageUtil.d.ts.map +1 -1
- package/lib/esm/ImageUtil.js +11 -0
- package/lib/esm/ImageUtil.js.map +1 -1
- package/lib/esm/IpcApp.d.ts +1 -0
- package/lib/esm/IpcApp.d.ts.map +1 -1
- package/lib/esm/IpcApp.js +1 -0
- package/lib/esm/IpcApp.js.map +1 -1
- package/lib/esm/MarginPercent.d.ts +1 -0
- package/lib/esm/MarginPercent.d.ts.map +1 -1
- package/lib/esm/MarginPercent.js +1 -0
- package/lib/esm/MarginPercent.js.map +1 -1
- package/lib/esm/Marker.d.ts +16 -3
- package/lib/esm/Marker.d.ts.map +1 -1
- package/lib/esm/Marker.js +3 -0
- package/lib/esm/Marker.js.map +1 -1
- package/lib/esm/ModelSelectorState.d.ts +1 -0
- package/lib/esm/ModelSelectorState.d.ts.map +1 -1
- package/lib/esm/ModelSelectorState.js +1 -0
- package/lib/esm/ModelSelectorState.js.map +1 -1
- package/lib/esm/ModelState.d.ts +10 -0
- package/lib/esm/ModelState.d.ts.map +1 -1
- package/lib/esm/ModelState.js +10 -0
- package/lib/esm/ModelState.js.map +1 -1
- package/lib/esm/NotificationManager.d.ts +11 -0
- package/lib/esm/NotificationManager.d.ts.map +1 -1
- package/lib/esm/NotificationManager.js +10 -0
- package/lib/esm/NotificationManager.js.map +1 -1
- package/lib/esm/PerModelCategoryVisibility.d.ts +1 -0
- package/lib/esm/PerModelCategoryVisibility.d.ts.map +1 -1
- package/lib/esm/PerModelCategoryVisibility.js +1 -0
- package/lib/esm/PerModelCategoryVisibility.js.map +1 -1
- package/lib/esm/SelectionSet.d.ts +7 -0
- package/lib/esm/SelectionSet.d.ts.map +1 -1
- package/lib/esm/SelectionSet.js +3 -0
- package/lib/esm/SelectionSet.js.map +1 -1
- package/lib/esm/SheetViewState.d.ts +1 -0
- package/lib/esm/SheetViewState.d.ts.map +1 -1
- package/lib/esm/SheetViewState.js +1 -0
- package/lib/esm/SheetViewState.js.map +1 -1
- package/lib/esm/SpatialViewState.d.ts +2 -0
- package/lib/esm/SpatialViewState.d.ts.map +1 -1
- package/lib/esm/SpatialViewState.js +2 -0
- package/lib/esm/SpatialViewState.js.map +1 -1
- package/lib/esm/Sprites.d.ts +3 -0
- package/lib/esm/Sprites.d.ts.map +1 -1
- package/lib/esm/Sprites.js +3 -0
- package/lib/esm/Sprites.js.map +1 -1
- package/lib/esm/StandardView.d.ts +1 -0
- package/lib/esm/StandardView.d.ts.map +1 -1
- package/lib/esm/StandardView.js +1 -0
- package/lib/esm/StandardView.js.map +1 -1
- package/lib/esm/TentativePoint.d.ts +4 -1
- package/lib/esm/TentativePoint.d.ts.map +1 -1
- package/lib/esm/TentativePoint.js +4 -1
- package/lib/esm/TentativePoint.js.map +1 -1
- package/lib/esm/Tiles.d.ts +1 -0
- package/lib/esm/Tiles.d.ts.map +1 -1
- package/lib/esm/Tiles.js +1 -0
- package/lib/esm/Tiles.js.map +1 -1
- package/lib/esm/ViewAnimation.d.ts +6 -0
- package/lib/esm/ViewAnimation.d.ts.map +1 -1
- package/lib/esm/ViewAnimation.js.map +1 -1
- package/lib/esm/ViewCreator2d.d.ts +2 -0
- package/lib/esm/ViewCreator2d.d.ts.map +1 -1
- package/lib/esm/ViewCreator2d.js +1 -0
- package/lib/esm/ViewCreator2d.js.map +1 -1
- package/lib/esm/ViewCreator3d.d.ts +2 -0
- package/lib/esm/ViewCreator3d.d.ts.map +1 -1
- package/lib/esm/ViewCreator3d.js +1 -0
- package/lib/esm/ViewCreator3d.js.map +1 -1
- package/lib/esm/ViewGlobalLocation.d.ts +3 -0
- package/lib/esm/ViewGlobalLocation.d.ts.map +1 -1
- package/lib/esm/ViewGlobalLocation.js +1 -0
- package/lib/esm/ViewGlobalLocation.js.map +1 -1
- package/lib/esm/ViewManager.d.ts +3 -0
- package/lib/esm/ViewManager.d.ts.map +1 -1
- package/lib/esm/ViewManager.js +1 -0
- package/lib/esm/ViewManager.js.map +1 -1
- package/lib/esm/ViewPose.d.ts +1 -0
- package/lib/esm/ViewPose.d.ts.map +1 -1
- package/lib/esm/ViewPose.js +1 -0
- package/lib/esm/ViewPose.js.map +1 -1
- package/lib/esm/ViewRect.d.ts +1 -0
- package/lib/esm/ViewRect.d.ts.map +1 -1
- package/lib/esm/ViewRect.js +1 -0
- package/lib/esm/ViewRect.js.map +1 -1
- package/lib/esm/ViewState.d.ts +4 -0
- package/lib/esm/ViewState.d.ts.map +1 -1
- package/lib/esm/ViewState.js +3 -0
- package/lib/esm/ViewState.js.map +1 -1
- package/lib/esm/ViewStatus.d.ts +1 -0
- package/lib/esm/ViewStatus.d.ts.map +1 -1
- package/lib/esm/ViewStatus.js +1 -0
- package/lib/esm/ViewStatus.js.map +1 -1
- package/lib/esm/ViewingSpace.d.ts +1 -0
- package/lib/esm/ViewingSpace.d.ts.map +1 -1
- package/lib/esm/ViewingSpace.js +1 -0
- package/lib/esm/ViewingSpace.js.map +1 -1
- package/lib/esm/core-frontend.d.ts +6 -5
- package/lib/esm/core-frontend.d.ts.map +1 -1
- package/lib/esm/core-frontend.js +7 -5
- package/lib/esm/core-frontend.js.map +1 -1
- package/lib/esm/extension/Extension.d.ts +22 -3
- package/lib/esm/extension/Extension.d.ts.map +1 -1
- package/lib/esm/extension/Extension.js +1 -7
- package/lib/esm/extension/Extension.js.map +1 -1
- package/lib/esm/extension/ExtensionAdmin.d.ts +1 -3
- package/lib/esm/extension/ExtensionAdmin.d.ts.map +1 -1
- package/lib/esm/extension/ExtensionAdmin.js +1 -4
- package/lib/esm/extension/ExtensionAdmin.js.map +1 -1
- package/lib/esm/extension/ExtensionRuntime.js +239 -59
- package/lib/esm/extension/ExtensionRuntime.js.map +1 -1
- package/lib/esm/render/CanvasDecoration.d.ts +2 -0
- package/lib/esm/render/CanvasDecoration.d.ts.map +1 -1
- package/lib/esm/render/CanvasDecoration.js.map +1 -1
- package/lib/esm/render/Decorations.d.ts +1 -0
- package/lib/esm/render/Decorations.d.ts.map +1 -1
- package/lib/esm/render/Decorations.js +1 -0
- package/lib/esm/render/Decorations.js.map +1 -1
- package/lib/esm/render/FeatureSymbology.d.ts +1 -0
- package/lib/esm/render/FeatureSymbology.d.ts.map +1 -1
- package/lib/esm/render/FeatureSymbology.js +1 -0
- package/lib/esm/render/FeatureSymbology.js.map +1 -1
- package/lib/esm/render/GraphicBranch.d.ts +2 -0
- package/lib/esm/render/GraphicBranch.d.ts.map +1 -1
- package/lib/esm/render/GraphicBranch.js +1 -0
- package/lib/esm/render/GraphicBranch.js.map +1 -1
- package/lib/esm/render/GraphicBuilder.d.ts +8 -0
- package/lib/esm/render/GraphicBuilder.d.ts.map +1 -1
- package/lib/esm/render/GraphicBuilder.js +2 -0
- package/lib/esm/render/GraphicBuilder.js.map +1 -1
- package/lib/esm/render/GraphicPrimitive.d.ts +14 -0
- package/lib/esm/render/GraphicPrimitive.d.ts.map +1 -1
- package/lib/esm/render/GraphicPrimitive.js.map +1 -1
- package/lib/esm/render/ParticleCollectionBuilder.d.ts +3 -0
- package/lib/esm/render/ParticleCollectionBuilder.d.ts.map +1 -1
- package/lib/esm/render/ParticleCollectionBuilder.js.map +1 -1
- package/lib/esm/render/Pixel.d.ts +1 -0
- package/lib/esm/render/Pixel.d.ts.map +1 -1
- package/lib/esm/render/Pixel.js +1 -0
- package/lib/esm/render/Pixel.js.map +1 -1
- package/lib/esm/render/RenderClipVolume.d.ts +1 -0
- package/lib/esm/render/RenderClipVolume.d.ts.map +1 -1
- package/lib/esm/render/RenderClipVolume.js +1 -0
- package/lib/esm/render/RenderClipVolume.js.map +1 -1
- package/lib/esm/render/RenderGraphic.d.ts +3 -0
- package/lib/esm/render/RenderGraphic.d.ts.map +1 -1
- package/lib/esm/render/RenderGraphic.js +2 -0
- package/lib/esm/render/RenderGraphic.js.map +1 -1
- package/lib/esm/render/RenderSystem.d.ts +1 -0
- package/lib/esm/render/RenderSystem.d.ts.map +1 -1
- package/lib/esm/render/RenderSystem.js +1 -0
- package/lib/esm/render/RenderSystem.js.map +1 -1
- package/lib/esm/render/RenderTexture.d.ts +7 -0
- package/lib/esm/render/RenderTexture.d.ts.map +1 -1
- package/lib/esm/render/RenderTexture.js.map +1 -1
- package/lib/esm/render/Scene.d.ts +1 -0
- package/lib/esm/render/Scene.d.ts.map +1 -1
- package/lib/esm/render/Scene.js +1 -0
- package/lib/esm/render/Scene.js.map +1 -1
- package/lib/esm/render/ScreenSpaceEffectBuilder.d.ts +10 -0
- package/lib/esm/render/ScreenSpaceEffectBuilder.d.ts.map +1 -1
- package/lib/esm/render/ScreenSpaceEffectBuilder.js +2 -0
- package/lib/esm/render/ScreenSpaceEffectBuilder.js.map +1 -1
- package/lib/esm/render/webgl/System.d.ts +1 -1
- package/lib/esm/render/webgl/Target.d.ts.map +1 -1
- package/lib/esm/render/webgl/Target.js +4 -1
- package/lib/esm/render/webgl/Target.js.map +1 -1
- package/lib/esm/tile/DisclosedTileTreeSet.d.ts +2 -0
- package/lib/esm/tile/DisclosedTileTreeSet.d.ts.map +1 -1
- package/lib/esm/tile/DisclosedTileTreeSet.js +1 -0
- package/lib/esm/tile/DisclosedTileTreeSet.js.map +1 -1
- package/lib/esm/tile/ImdlReader.d.ts +1 -0
- package/lib/esm/tile/ImdlReader.d.ts.map +1 -1
- package/lib/esm/tile/ImdlReader.js +1 -0
- package/lib/esm/tile/ImdlReader.js.map +1 -1
- package/lib/esm/tile/Tile.d.ts +5 -0
- package/lib/esm/tile/Tile.d.ts.map +1 -1
- package/lib/esm/tile/Tile.js +5 -0
- package/lib/esm/tile/Tile.js.map +1 -1
- package/lib/esm/tile/TileAdmin.d.ts +3 -0
- package/lib/esm/tile/TileAdmin.d.ts.map +1 -1
- package/lib/esm/tile/TileAdmin.js +1 -0
- package/lib/esm/tile/TileAdmin.js.map +1 -1
- package/lib/esm/tile/TileContent.d.ts +1 -0
- package/lib/esm/tile/TileContent.d.ts.map +1 -1
- package/lib/esm/tile/TileContent.js.map +1 -1
- package/lib/esm/tile/TileDrawArgs.d.ts +2 -0
- package/lib/esm/tile/TileDrawArgs.d.ts.map +1 -1
- package/lib/esm/tile/TileDrawArgs.js +1 -0
- package/lib/esm/tile/TileDrawArgs.js.map +1 -1
- package/lib/esm/tile/TileParams.d.ts +1 -0
- package/lib/esm/tile/TileParams.d.ts.map +1 -1
- package/lib/esm/tile/TileParams.js.map +1 -1
- package/lib/esm/tile/TileRequest.d.ts +1 -0
- package/lib/esm/tile/TileRequest.d.ts.map +1 -1
- package/lib/esm/tile/TileRequest.js +1 -0
- package/lib/esm/tile/TileRequest.js.map +1 -1
- package/lib/esm/tile/TileRequestChannel.d.ts +2 -0
- package/lib/esm/tile/TileRequestChannel.d.ts.map +1 -1
- package/lib/esm/tile/TileRequestChannel.js +2 -0
- package/lib/esm/tile/TileRequestChannel.js.map +1 -1
- package/lib/esm/tile/TileRequestChannels.d.ts +1 -0
- package/lib/esm/tile/TileRequestChannels.d.ts.map +1 -1
- package/lib/esm/tile/TileRequestChannels.js +1 -0
- package/lib/esm/tile/TileRequestChannels.js.map +1 -1
- package/lib/esm/tile/TileTree.d.ts +2 -0
- package/lib/esm/tile/TileTree.d.ts.map +1 -1
- package/lib/esm/tile/TileTree.js +2 -0
- package/lib/esm/tile/TileTree.js.map +1 -1
- package/lib/esm/tile/TileTreeOwner.d.ts +1 -0
- package/lib/esm/tile/TileTreeOwner.d.ts.map +1 -1
- package/lib/esm/tile/TileTreeOwner.js.map +1 -1
- package/lib/esm/tile/TileTreeParams.d.ts +1 -0
- package/lib/esm/tile/TileTreeParams.d.ts.map +1 -1
- package/lib/esm/tile/TileTreeParams.js.map +1 -1
- package/lib/esm/tile/TileTreeReference.d.ts +2 -0
- package/lib/esm/tile/TileTreeReference.d.ts.map +1 -1
- package/lib/esm/tile/TileTreeReference.js +2 -0
- package/lib/esm/tile/TileTreeReference.js.map +1 -1
- package/lib/esm/tile/TileTreeSupplier.d.ts +1 -0
- package/lib/esm/tile/TileTreeSupplier.d.ts.map +1 -1
- package/lib/esm/tile/TileTreeSupplier.js.map +1 -1
- package/lib/esm/tile/TileUsageMarker.d.ts +1 -0
- package/lib/esm/tile/TileUsageMarker.d.ts.map +1 -1
- package/lib/esm/tile/TileUsageMarker.js +1 -0
- package/lib/esm/tile/TileUsageMarker.js.map +1 -1
- package/lib/esm/tile/TiledGraphicsProvider.d.ts +1 -0
- package/lib/esm/tile/TiledGraphicsProvider.d.ts.map +1 -1
- package/lib/esm/tile/TiledGraphicsProvider.js.map +1 -1
- package/lib/esm/tile/map/BingElevation.d.ts +1 -0
- package/lib/esm/tile/map/BingElevation.d.ts.map +1 -1
- package/lib/esm/tile/map/BingElevation.js +1 -0
- package/lib/esm/tile/map/BingElevation.js.map +1 -1
- package/lib/esm/tools/ClipViewTool.d.ts +5 -3
- package/lib/esm/tools/ClipViewTool.d.ts.map +1 -1
- package/lib/esm/tools/ClipViewTool.js +4 -3
- package/lib/esm/tools/ClipViewTool.js.map +1 -1
- package/lib/esm/tools/EditManipulator.d.ts +1 -0
- package/lib/esm/tools/EditManipulator.d.ts.map +1 -1
- package/lib/esm/tools/EditManipulator.js +1 -0
- package/lib/esm/tools/EditManipulator.js.map +1 -1
- package/lib/esm/tools/EventController.d.ts +1 -0
- package/lib/esm/tools/EventController.d.ts.map +1 -1
- package/lib/esm/tools/EventController.js +1 -0
- package/lib/esm/tools/EventController.js.map +1 -1
- package/lib/esm/tools/PrimitiveTool.d.ts +1 -0
- package/lib/esm/tools/PrimitiveTool.d.ts.map +1 -1
- package/lib/esm/tools/PrimitiveTool.js +1 -0
- package/lib/esm/tools/PrimitiveTool.js.map +1 -1
- package/lib/esm/tools/SelectTool.d.ts +3 -0
- package/lib/esm/tools/SelectTool.d.ts.map +1 -1
- package/lib/esm/tools/SelectTool.js +3 -0
- package/lib/esm/tools/SelectTool.js.map +1 -1
- package/lib/esm/tools/Tool.d.ts +41 -6
- package/lib/esm/tools/Tool.d.ts.map +1 -1
- package/lib/esm/tools/Tool.js +27 -4
- package/lib/esm/tools/Tool.js.map +1 -1
- package/lib/esm/tools/ToolAdmin.d.ts +9 -2
- package/lib/esm/tools/ToolAdmin.d.ts.map +1 -1
- package/lib/esm/tools/ToolAdmin.js +9 -2
- package/lib/esm/tools/ToolAdmin.js.map +1 -1
- package/lib/esm/tools/ToolAssistance.d.ts +7 -0
- package/lib/esm/tools/ToolAssistance.d.ts.map +1 -1
- package/lib/esm/tools/ToolAssistance.js +3 -0
- package/lib/esm/tools/ToolAssistance.js.map +1 -1
- package/lib/esm/tools/ToolSettings.d.ts +1 -0
- package/lib/esm/tools/ToolSettings.d.ts.map +1 -1
- package/lib/esm/tools/ToolSettings.js +1 -0
- package/lib/esm/tools/ToolSettings.js.map +1 -1
- package/lib/esm/tools/ViewTool.d.ts +2 -0
- package/lib/esm/tools/ViewTool.d.ts.map +1 -1
- package/lib/esm/tools/ViewTool.js +2 -0
- package/lib/esm/tools/ViewTool.js.map +1 -1
- package/package.json +32 -21
- package/lib/cjs/extension/ExtensionLoader.d.ts +0 -26
- package/lib/cjs/extension/ExtensionLoader.d.ts.map +0 -1
- package/lib/cjs/extension/ExtensionLoader.js +0 -10
- package/lib/cjs/extension/ExtensionLoader.js.map +0 -1
- package/lib/cjs/extension/extensions.d.ts +0 -19
- package/lib/cjs/extension/extensions.d.ts.map +0 -1
- package/lib/cjs/extension/extensions.js +0 -36
- package/lib/cjs/extension/extensions.js.map +0 -1
- package/lib/esm/extension/ExtensionLoader.d.ts +0 -26
- package/lib/esm/extension/ExtensionLoader.d.ts.map +0 -1
- package/lib/esm/extension/ExtensionLoader.js +0 -9
- package/lib/esm/extension/ExtensionLoader.js.map +0 -1
- package/lib/esm/extension/extensions.d.ts +0 -19
- package/lib/esm/extension/extensions.d.ts.map +0 -1
- package/lib/esm/extension/extensions.js +0 -24
- package/lib/esm/extension/extensions.js.map +0 -1
package/lib/cjs/ImageUtil.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Image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AAG,KAAK,EAAE,qBAAqB,GAAG,GAAG;IAClH,MAAM,UAAU,GAAG,GAAG,CAAC,CAAC,wBAAwB;IAChD,MAAM,iBAAiB,GAAG,CAAC,CAAC,CAAC,8BAA8B;IAC3D,IAAI,OAAO,GAAG,GAAG,CAAC,CAAC,2BAA2B;IAE9C,OAAO,OAAO,GAAG,qBAAqB,EAAE;QACtC,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACrD,yCAAyC;QACzC,IAAI,IAAI,CAAC,MAAM,GAAG,iBAAiB,GAAG,QAAQ;YAC5C,OAAO,IAAI,CAAC;QAEd,OAAO,IAAI,UAAU,CAAC;KACvB;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAfD,kEAeC","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 Rendering\r\n */\r\n\r\nimport { Point2d } from \"@itwin/core-geometry\";\r\nimport { ImageBuffer, ImageBufferFormat, ImageSource, ImageSourceFormat } from \"@itwin/core-common\";\r\nimport { ViewRect } from \"./ViewRect\";\r\n\r\ninterface Rgba {\r\n r: number;\r\n g: number;\r\n b: number;\r\n a: number;\r\n}\r\n\r\nconst scratchRgba = { r: 0, g: 0, b: 0, a: 0 };\r\n\r\nfunction rgbaFromAlpha(rgba: Rgba, src: Uint8Array, idx: number): number {\r\n rgba.r = rgba.g = rgba.b = rgba.a = src[idx];\r\n return idx + 1;\r\n}\r\n\r\nfunction rgbaFromRgb(rgba: Rgba, src: Uint8Array, idx: number): number {\r\n rgba.r = src[idx + 0];\r\n rgba.g = src[idx + 1];\r\n rgba.b = src[idx + 2];\r\n rgba.a = 255;\r\n return idx + 3;\r\n}\r\n\r\nfunction rgbaFromRgba(rgba: Rgba, src: Uint8Array, idx: number): number {\r\n rgbaFromRgb(rgba, src, idx);\r\n rgba.a = src[idx + 3];\r\n return idx + 4;\r\n}\r\n\r\n/** Resize a canvas to a desired size. The final size will be targetSize plus barSize. The original canvas is left untouched and a new, resized canvas with potential side bars is returned.\r\n * @param canvasIn the source [HTMLCanvasElement](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement) to resize.\r\n * @param targetSize the desired new size for the canvas image.\r\n * @param barSize total size of side bars to add to the image in width and height; defaults to (0, 0). For example, if you specify (2, 0), a 1 pixel side bar will be added to the left and right sides of the resized image. If an odd dimension is specified, the left or upper side of the image will be one pixel larger than the opposite side. For example, if you specify (1, 0), a 1 pixel side bar will be added to the left side of the image and a 0 pixel side bar will be added to the right side of the image.\r\n * @param barStyle CSS style string to apply to any side bars; defaults to \"#C0C0C0\", which is silver.\r\n * @returns an [HTMLCanvasElement](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement) object containing the resized image and any requested side bars.\r\n * @public\r\n */\r\nexport function canvasToResizedCanvasWithBars(canvasIn: HTMLCanvasElement, targetSize: Point2d, barSize = new Point2d(0, 0), barStyle = \"#C0C0C0\"): HTMLCanvasElement {\r\n const canvasOut = document.createElement(\"canvas\");\r\n canvasOut.width = targetSize.x + barSize.x;\r\n canvasOut.height = targetSize.y + barSize.y;\r\n\r\n let adjustImageX = barSize.x / 2;\r\n let adjustImageY = barSize.y / 2;\r\n\r\n if (1 === barSize.x % 2) {\r\n adjustImageX += 0.5;\r\n }\r\n if (1 === barSize.y % 2) {\r\n adjustImageY += 0.5;\r\n }\r\n\r\n const context = canvasOut.getContext(\"2d\")!;\r\n context.fillStyle = barStyle;\r\n context.fillRect(0, 0, canvasOut.width, canvasOut.height);\r\n context.drawImage(canvasIn, adjustImageX, adjustImageY, targetSize.x, targetSize.y);\r\n return canvasOut;\r\n}\r\n\r\n/** Create a canvas element with the same dimensions and contents as an image buffer.\r\n * @param buffer the source [[ImageBuffer]] object from which the [HTMLCanvasElement](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement) object will be constructed.\r\n * @param preserveAlpha If false, the alpha channel will be set to 255 (fully opaque). This is recommended when converting an already-blended image (e.g., one obtained from [[Viewport.readImageBuffer]]).\r\n * @returns an [HTMLCanvasElement](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement) object containing the contents of the source image buffer, or undefined if the conversion fails.\r\n * @public\r\n */\r\nexport function imageBufferToCanvas(buffer: ImageBuffer, preserveAlpha: boolean = true): HTMLCanvasElement | undefined {\r\n const canvas = document.createElement(\"canvas\");\r\n if (null === canvas)\r\n return undefined;\r\n\r\n canvas.width = buffer.width;\r\n canvas.height = buffer.height;\r\n\r\n const context = canvas.getContext(\"2d\");\r\n if (null === context)\r\n return undefined;\r\n\r\n const imageData = context.createImageData(buffer.width, buffer.height);\r\n const extractRgba = ImageBufferFormat.Alpha === buffer.format ? rgbaFromAlpha : (ImageBufferFormat.Rgb === buffer.format ? rgbaFromRgb : rgbaFromRgba);\r\n\r\n const bufferData = buffer.data;\r\n let i = 0;\r\n let j = 0;\r\n const rgba = scratchRgba;\r\n while (i < bufferData.length) {\r\n i = extractRgba(rgba, bufferData, i);\r\n imageData.data[j + 0] = rgba.r;\r\n imageData.data[j + 1] = rgba.g;\r\n imageData.data[j + 2] = rgba.b;\r\n imageData.data[j + 3] = preserveAlpha ? rgba.a : 0xff;\r\n j += 4;\r\n }\r\n\r\n context.putImageData(imageData, 0, 0);\r\n return canvas;\r\n}\r\n\r\n/** Create an ImageBuffer in the specified format with the same dimensions and contents as a canvas.\r\n * @param canvas the source [HTMLCanvasElement](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement) object from which the [[ImageBuffer]] object will be constructed.\r\n * @param format the desired format of the created ImageBuffer; defaults to [[ImageBufferFormat.Rgba]].\r\n * @returns an [[ImageBuffer]] object containing the contents of the source canvas, or undefined if the conversion fails.\r\n * @public\r\n */\r\nexport function canvasToImageBuffer(canvas: HTMLCanvasElement, format = ImageBufferFormat.Rgba): ImageBuffer | undefined {\r\n const context = canvas.getContext(\"2d\");\r\n if (null === context)\r\n return undefined;\r\n\r\n const imageData = context.getImageData(0, 0, canvas.width, canvas.height);\r\n\r\n let imageBufferData: Uint8Array | undefined;\r\n\r\n if (ImageBufferFormat.Rgba === format) {\r\n imageBufferData = new Uint8Array(imageData.data.length);\r\n } else if (ImageBufferFormat.Rgb === format) {\r\n imageBufferData = new Uint8Array((imageData.data.length / 4) * 3);\r\n } else if (ImageBufferFormat.Alpha === format) {\r\n imageBufferData = new Uint8Array(imageData.data.length / 4);\r\n }\r\n\r\n if (undefined === imageBufferData)\r\n return undefined;\r\n\r\n let i = 0;\r\n let j = 0;\r\n while (i < imageData.data.length) {\r\n if (ImageBufferFormat.Rgba === format) {\r\n imageBufferData[j + 0] = imageData.data[i + 0];\r\n imageBufferData[j + 1] = imageData.data[i + 1];\r\n imageBufferData[j + 2] = imageData.data[i + 2];\r\n imageBufferData[j + 3] = imageData.data[i + 3];\r\n j += 4;\r\n } else if (ImageBufferFormat.Rgb === format) {\r\n imageBufferData[j + 0] = imageData.data[i + 0];\r\n imageBufferData[j + 1] = imageData.data[i + 1];\r\n imageBufferData[j + 2] = imageData.data[i + 2];\r\n j += 3;\r\n } else if (ImageBufferFormat.Alpha === format) {\r\n imageBufferData[j] = imageData.data[i + 3];\r\n j++;\r\n }\r\n i += 4;\r\n }\r\n\r\n return ImageBuffer.create(imageBufferData, format, canvas.width);\r\n}\r\n\r\n/** Get a string describing the mime type associated with an ImageSource format.\r\n * @public\r\n */\r\nexport function getImageSourceMimeType(format: ImageSourceFormat): string {\r\n\r\n switch (format) {\r\n case ImageSourceFormat.Jpeg:\r\n return \"image/jpeg\";\r\n case ImageSourceFormat.Png:\r\n return \"image/png\";\r\n case ImageSourceFormat.Svg:\r\n return \"image/svg+xml;charset=utf-8\";\r\n }\r\n return \"\";\r\n}\r\n\r\n/** Get the ImageSourceFormat corresponding to the mime type string, or undefined if the string does not identify a supported ImageSourceFormat.\r\n * @public\r\n */\r\nexport function getImageSourceFormatForMimeType(mimeType: string): ImageSourceFormat | undefined {\r\n switch (mimeType) {\r\n case \"image/jpeg\": return ImageSourceFormat.Jpeg;\r\n case \"image/png\": return ImageSourceFormat.Png;\r\n case \"image/svg+xml;charset=utf-8\": return ImageSourceFormat.Svg;\r\n default: return undefined;\r\n }\r\n}\r\n\r\n/** Extract an html Image element from a binary jpeg or png.\r\n * @param source The ImageSource containing the binary jpeg or png data.\r\n * @returns a Promise which resolves to an HTMLImageElement containing the uncompressed bitmap image in RGBA format.\r\n * @public\r\n */\r\nexport async function imageElementFromImageSource(source: ImageSource): Promise<HTMLImageElement> {\r\n const blob = new Blob([source.data], { type: getImageSourceMimeType(source.format) });\r\n return imageElementFromUrl(URL.createObjectURL(blob));\r\n}\r\n\r\n/** Create an html Image element from a URL.\r\n * @param url The URL pointing to the image data.\r\n * @param skipCrossOriginCheck Set this to true to allow an image from a different origin than the web app to load. Default is false.\r\n * @returns A Promise resolving to an HTMLImageElement when the image data has been loaded from the URL.\r\n * @see tryImageElementFromUrl.\r\n * @public\r\n */\r\nexport async function imageElementFromUrl(url: string, skipCrossOriginCheck = false): Promise<HTMLImageElement> {\r\n // We must set crossorigin property so that images loaded from same origin can be used with texImage2d.\r\n // We must do that outside of the promise constructor or it won't work, for reasons.\r\n const image = new Image();\r\n if (!skipCrossOriginCheck) {\r\n image.crossOrigin = \"anonymous\";\r\n }\r\n return new Promise((resolve: (image: HTMLImageElement) => void, reject) => {\r\n image.onload = () => resolve(image);\r\n\r\n // The \"error\" produced by Image is not an Error. It looks like an Event, but isn't one.\r\n image.onerror = () => reject(new Error(\"Failed to create image from url\"));\r\n image.src = url;\r\n });\r\n}\r\n\r\n/** Try to create an html Image element from a URL.\r\n * @param url The URL pointing to the image data.\r\n * @param skipCrossOriginCheck Set this to true to allow an image from a different origin than the web app to load. Default is false.\r\n * @returns A Promise resolving to an HTMLImageElement when the image data has been loaded from the URL, or to `undefined` if an exception occurred.\r\n * @see imageElementFromUrl\r\n * @public\r\n */\r\nexport async function tryImageElementFromUrl(url: string, skipCrossOriginCheck = false): Promise<HTMLImageElement | undefined> {\r\n try {\r\n return await imageElementFromUrl(url, skipCrossOriginCheck);\r\n } catch {\r\n return undefined;\r\n }\r\n}\r\n/**\r\n * Extract the dimensions of the jpeg or png data encoded in an ImageSource.\r\n * @param source The ImageSource containing the binary jpeg or png data.\r\n * @returns a Promise resolving to a Point2d of which x corresponds to the integer width of the uncompressed bitmap and y to the height.\r\n * @public\r\n */\r\nexport async function extractImageSourceDimensions(source: ImageSource): Promise<Point2d> {\r\n const image = await imageElementFromImageSource(source);\r\n return new Point2d(image.naturalWidth, image.naturalHeight);\r\n}\r\n\r\n/**\r\n * Produces a data url in \"image/png\" format from the contents of an ImageBuffer.\r\n * @param buffer The ImageBuffer, of any format.\r\n * @param preserveAlpha If false, the alpha channel will be set to 255 (fully opaque). This is recommended when converting an already-blended image (e.g., one obtained from [[Viewport.readImageBuffer]]).\r\n * @returns a data url as a string suitable for setting as the `src` property of an HTMLImageElement, or undefined if the url could not be created.\r\n * @public\r\n */\r\nexport function imageBufferToPngDataUrl(buffer: ImageBuffer, preserveAlpha = true): string | undefined {\r\n // The default format (and the only format required to be supported) for toDataUrl() is \"image/png\".\r\n const canvas = imageBufferToCanvas(buffer, preserveAlpha);\r\n return undefined !== canvas ? canvas.toDataURL() : undefined;\r\n}\r\n\r\n/**\r\n * Converts the contents of an ImageBuffer to PNG format.\r\n * @param buffer The ImageBuffer, of any format.\r\n * @param preserveAlpha If false, the alpha channel will be set to 255 (fully opaque). This is recommended when converting an already-blended image (e.g., one obtained from [[Viewport.readImageBuffer]]).\r\n * @returns a base64-encoded string representing the image as a PNG, or undefined if the conversion failed.\r\n * @public\r\n */\r\nexport function imageBufferToBase64EncodedPng(buffer: ImageBuffer, preserveAlpha = true): string | undefined {\r\n const urlPrefix = \"data:image/png;base64,\";\r\n const url = imageBufferToPngDataUrl(buffer, preserveAlpha);\r\n if (undefined === url || !url.startsWith(urlPrefix))\r\n return undefined;\r\n\r\n return url.substring(urlPrefix.length);\r\n}\r\n\r\n/** Open an image specified as a data URL in a new window or tab. Works around differences between browsers and Electron.\r\n * @param url The base64-encoded image URL.\r\n * @param title An optional title to apply to the new window.\r\n * @beta\r\n */\r\nexport function openImageDataUrlInNewWindow(url: string, title?: string): void {\r\n const win = window.open();\r\n if (null === win)\r\n return;\r\n\r\n const div = win.document.createElement(\"div\");\r\n div.innerHTML = `<img src='${url}'/>`;\r\n win.document.body.append(div);\r\n if (undefined !== title)\r\n win.document.title = title;\r\n}\r\n\r\n/** Determine the maximum [[ViewRect]] that can be fitted and centered in specified ViewRect given a required aspect ratio.\r\n * @param viewRect The rectangle in which the returned rectangle is to be centered and fitted.\r\n * @param aspectRatio Ratio of width to height.\r\n * @returns A ViewRect centered in the input rectangle.\r\n * @public\r\n */\r\nexport function getCenteredViewRect(viewRect: ViewRect, aspectRatio = 1.4): ViewRect {\r\n // Determine scale that ensures ability to return an image with the prescribed aspectRatio\r\n const scale = Math.min(viewRect.width / aspectRatio, viewRect.height);\r\n const finalWidth = scale * aspectRatio;\r\n const finalHeight = scale;\r\n const left = (viewRect.width - finalWidth) / 2.0;\r\n const right = left + finalWidth;\r\n const top = (viewRect.height - finalHeight) / 2.0;\r\n const bottom = top + finalHeight;\r\n return new ViewRect(left, top, right, bottom);\r\n}\r\n\r\n/** Produce a jpeg compressed to no more than specified bytes and of no less than specified quality.\r\n * @param canvas Canvas containing the image to be compressed.\r\n * @param maxBytes Maximum size of output jpeg in bytes.\r\n * @param minCompressionQuality The minimum acceptable image quality as a number between 0 (lowest quality) and 1 (highest quality).\r\n * @returns A [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) for the image, or `undefined` if the compression and size constraints could not be met.\r\n * @public\r\n */\r\nexport function getCompressedJpegFromCanvas(canvas: HTMLCanvasElement, maxBytes = 60000, minCompressionQuality = 0.1): string | undefined {\r\n const decrements = 0.1; // Decrements of quality\r\n const bytesPerCharacter = 2; // Assume 16-bit per character\r\n let quality = 1.0; // JPEG Compression quality\r\n\r\n while (quality > minCompressionQuality) {\r\n const data = canvas.toDataURL(\"image/jpeg\", quality);\r\n // If we are less than 60 Kb, we are good\r\n if (data.length * bytesPerCharacter < maxBytes)\r\n return data;\r\n\r\n quality -= decrements;\r\n }\r\n\r\n return undefined;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ImageUtil.js","sourceRoot":"","sources":["../../src/ImageUtil.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,wDAA+C;AAC/C,oDAAoG;AACpG,yCAAsC;AAStC,MAAM,WAAW,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AAE/C,SAAS,aAAa,CAAC,IAAU,EAAE,GAAe,EAAE,GAAW;IAC7D,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7C,OAAO,GAAG,GAAG,CAAC,CAAC;AACjB,CAAC;AAED,SAAS,WAAW,CAAC,IAAU,EAAE,GAAe,EAAE,GAAW;IAC3D,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IACtB,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IACtB,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IACtB,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC;IACb,OAAO,GAAG,GAAG,CAAC,CAAC;AACjB,CAAC;AAED,SAAS,YAAY,CAAC,IAAU,EAAE,GAAe,EAAE,GAAW;IAC5D,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC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,CAAC,MAAM,GAAG,WAAW,CAAC,GAAG,GAAG,CAAC;IAClD,MAAM,MAAM,GAAG,GAAG,GAAG,WAAW,CAAC;IACjC,OAAO,IAAI,mBAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AAChD,CAAC;AAVD,kDAUC;AAED;;;;;;;GAOG;AACH,SAAgB,2BAA2B,CAAC,MAAyB,EAAE,QAAQ,GAAG,KAAK,EAAE,qBAAqB,GAAG,GAAG;IAClH,MAAM,UAAU,GAAG,GAAG,CAAC,CAAC,wBAAwB;IAChD,MAAM,iBAAiB,GAAG,CAAC,CAAC,CAAC,8BAA8B;IAC3D,IAAI,OAAO,GAAG,GAAG,CAAC,CAAC,2BAA2B;IAE9C,OAAO,OAAO,GAAG,qBAAqB,EAAE;QACtC,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACrD,yCAAyC;QACzC,IAAI,IAAI,CAAC,MAAM,GAAG,iBAAiB,GAAG,QAAQ;YAC5C,OAAO,IAAI,CAAC;QAEd,OAAO,IAAI,UAAU,CAAC;KACvB;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAfD,kEAeC","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 Rendering\r\n */\r\n\r\nimport { Point2d } from \"@itwin/core-geometry\";\r\nimport { ImageBuffer, ImageBufferFormat, ImageSource, ImageSourceFormat } from \"@itwin/core-common\";\r\nimport { ViewRect } from \"./ViewRect\";\r\n\r\ninterface Rgba {\r\n r: number;\r\n g: number;\r\n b: number;\r\n a: number;\r\n}\r\n\r\nconst scratchRgba = { r: 0, g: 0, b: 0, a: 0 };\r\n\r\nfunction rgbaFromAlpha(rgba: Rgba, src: Uint8Array, idx: number): number {\r\n rgba.r = rgba.g = rgba.b = rgba.a = src[idx];\r\n return idx + 1;\r\n}\r\n\r\nfunction rgbaFromRgb(rgba: Rgba, src: Uint8Array, idx: number): number {\r\n rgba.r = src[idx + 0];\r\n rgba.g = src[idx + 1];\r\n rgba.b = src[idx + 2];\r\n rgba.a = 255;\r\n return idx + 3;\r\n}\r\n\r\nfunction rgbaFromRgba(rgba: Rgba, src: Uint8Array, idx: number): number {\r\n rgbaFromRgb(rgba, src, idx);\r\n rgba.a = src[idx + 3];\r\n return idx + 4;\r\n}\r\n\r\n/** Resize a canvas to a desired size. The final size will be targetSize plus barSize. The original canvas is left untouched and a new, resized canvas with potential side bars is returned.\r\n * @param canvasIn the source [HTMLCanvasElement](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement) to resize.\r\n * @param targetSize the desired new size for the canvas image.\r\n * @param barSize total size of side bars to add to the image in width and height; defaults to (0, 0). For example, if you specify (2, 0), a 1 pixel side bar will be added to the left and right sides of the resized image. If an odd dimension is specified, the left or upper side of the image will be one pixel larger than the opposite side. For example, if you specify (1, 0), a 1 pixel side bar will be added to the left side of the image and a 0 pixel side bar will be added to the right side of the image.\r\n * @param barStyle CSS style string to apply to any side bars; defaults to \"#C0C0C0\", which is silver.\r\n * @returns an [HTMLCanvasElement](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement) object containing the resized image and any requested side bars.\r\n * @public\r\n * @extensions\r\n */\r\nexport function canvasToResizedCanvasWithBars(canvasIn: HTMLCanvasElement, targetSize: Point2d, barSize = new Point2d(0, 0), barStyle = \"#C0C0C0\"): HTMLCanvasElement {\r\n const canvasOut = document.createElement(\"canvas\");\r\n canvasOut.width = targetSize.x + barSize.x;\r\n canvasOut.height = targetSize.y + barSize.y;\r\n\r\n let adjustImageX = barSize.x / 2;\r\n let adjustImageY = barSize.y / 2;\r\n\r\n if (1 === barSize.x % 2) {\r\n adjustImageX += 0.5;\r\n }\r\n if (1 === barSize.y % 2) {\r\n adjustImageY += 0.5;\r\n }\r\n\r\n const context = canvasOut.getContext(\"2d\")!;\r\n context.fillStyle = barStyle;\r\n context.fillRect(0, 0, canvasOut.width, canvasOut.height);\r\n context.drawImage(canvasIn, adjustImageX, adjustImageY, targetSize.x, targetSize.y);\r\n return canvasOut;\r\n}\r\n\r\n/** Create a canvas element with the same dimensions and contents as an image buffer.\r\n * @param buffer the source [[ImageBuffer]] object from which the [HTMLCanvasElement](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement) object will be constructed.\r\n * @param preserveAlpha If false, the alpha channel will be set to 255 (fully opaque). This is recommended when converting an already-blended image (e.g., one obtained from [[Viewport.readImageBuffer]]).\r\n * @returns an [HTMLCanvasElement](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement) object containing the contents of the source image buffer, or undefined if the conversion fails.\r\n * @public\r\n * @extensions\r\n */\r\nexport function imageBufferToCanvas(buffer: ImageBuffer, preserveAlpha: boolean = true): HTMLCanvasElement | undefined {\r\n const canvas = document.createElement(\"canvas\");\r\n if (null === canvas)\r\n return undefined;\r\n\r\n canvas.width = buffer.width;\r\n canvas.height = buffer.height;\r\n\r\n const context = canvas.getContext(\"2d\");\r\n if (null === context)\r\n return undefined;\r\n\r\n const imageData = context.createImageData(buffer.width, buffer.height);\r\n const extractRgba = ImageBufferFormat.Alpha === buffer.format ? rgbaFromAlpha : (ImageBufferFormat.Rgb === buffer.format ? rgbaFromRgb : rgbaFromRgba);\r\n\r\n const bufferData = buffer.data;\r\n let i = 0;\r\n let j = 0;\r\n const rgba = scratchRgba;\r\n while (i < bufferData.length) {\r\n i = extractRgba(rgba, bufferData, i);\r\n imageData.data[j + 0] = rgba.r;\r\n imageData.data[j + 1] = rgba.g;\r\n imageData.data[j + 2] = rgba.b;\r\n imageData.data[j + 3] = preserveAlpha ? rgba.a : 0xff;\r\n j += 4;\r\n }\r\n\r\n context.putImageData(imageData, 0, 0);\r\n return canvas;\r\n}\r\n\r\n/** Create an ImageBuffer in the specified format with the same dimensions and contents as a canvas.\r\n * @param canvas the source [HTMLCanvasElement](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement) object from which the [[ImageBuffer]] object will be constructed.\r\n * @param format the desired format of the created ImageBuffer; defaults to [[ImageBufferFormat.Rgba]].\r\n * @returns an [[ImageBuffer]] object containing the contents of the source canvas, or undefined if the conversion fails.\r\n * @public\r\n * @extensions\r\n */\r\nexport function canvasToImageBuffer(canvas: HTMLCanvasElement, format = ImageBufferFormat.Rgba): ImageBuffer | undefined {\r\n const context = canvas.getContext(\"2d\");\r\n if (null === context)\r\n return undefined;\r\n\r\n const imageData = context.getImageData(0, 0, canvas.width, canvas.height);\r\n\r\n let imageBufferData: Uint8Array | undefined;\r\n\r\n if (ImageBufferFormat.Rgba === format) {\r\n imageBufferData = new Uint8Array(imageData.data.length);\r\n } else if (ImageBufferFormat.Rgb === format) {\r\n imageBufferData = new Uint8Array((imageData.data.length / 4) * 3);\r\n } else if (ImageBufferFormat.Alpha === format) {\r\n imageBufferData = new Uint8Array(imageData.data.length / 4);\r\n }\r\n\r\n if (undefined === imageBufferData)\r\n return undefined;\r\n\r\n let i = 0;\r\n let j = 0;\r\n while (i < imageData.data.length) {\r\n if (ImageBufferFormat.Rgba === format) {\r\n imageBufferData[j + 0] = imageData.data[i + 0];\r\n imageBufferData[j + 1] = imageData.data[i + 1];\r\n imageBufferData[j + 2] = imageData.data[i + 2];\r\n imageBufferData[j + 3] = imageData.data[i + 3];\r\n j += 4;\r\n } else if (ImageBufferFormat.Rgb === format) {\r\n imageBufferData[j + 0] = imageData.data[i + 0];\r\n imageBufferData[j + 1] = imageData.data[i + 1];\r\n imageBufferData[j + 2] = imageData.data[i + 2];\r\n j += 3;\r\n } else if (ImageBufferFormat.Alpha === format) {\r\n imageBufferData[j] = imageData.data[i + 3];\r\n j++;\r\n }\r\n i += 4;\r\n }\r\n\r\n return ImageBuffer.create(imageBufferData, format, canvas.width);\r\n}\r\n\r\n/** Get a string describing the mime type associated with an ImageSource format.\r\n * @public\r\n * @extensions\r\n */\r\nexport function getImageSourceMimeType(format: ImageSourceFormat): string {\r\n\r\n switch (format) {\r\n case ImageSourceFormat.Jpeg:\r\n return \"image/jpeg\";\r\n case ImageSourceFormat.Png:\r\n return \"image/png\";\r\n case ImageSourceFormat.Svg:\r\n return \"image/svg+xml;charset=utf-8\";\r\n }\r\n return \"\";\r\n}\r\n\r\n/** Get the ImageSourceFormat corresponding to the mime type string, or undefined if the string does not identify a supported ImageSourceFormat.\r\n * @public\r\n * @extensions\r\n */\r\nexport function getImageSourceFormatForMimeType(mimeType: string): ImageSourceFormat | undefined {\r\n switch (mimeType) {\r\n case \"image/jpeg\": return ImageSourceFormat.Jpeg;\r\n case \"image/png\": return ImageSourceFormat.Png;\r\n case \"image/svg+xml;charset=utf-8\": return ImageSourceFormat.Svg;\r\n default: return undefined;\r\n }\r\n}\r\n\r\n/** Extract an html Image element from a binary jpeg or png.\r\n * @param source The ImageSource containing the binary jpeg or png data.\r\n * @returns a Promise which resolves to an HTMLImageElement containing the uncompressed bitmap image in RGBA format.\r\n * @public\r\n * @extensions\r\n */\r\nexport async function imageElementFromImageSource(source: ImageSource): Promise<HTMLImageElement> {\r\n const blob = new Blob([source.data], { type: getImageSourceMimeType(source.format) });\r\n return imageElementFromUrl(URL.createObjectURL(blob));\r\n}\r\n\r\n/** Create an html Image element from a URL.\r\n * @param url The URL pointing to the image data.\r\n * @param skipCrossOriginCheck Set this to true to allow an image from a different origin than the web app to load. Default is false.\r\n * @returns A Promise resolving to an HTMLImageElement when the image data has been loaded from the URL.\r\n * @see tryImageElementFromUrl.\r\n * @public\r\n * @extensions\r\n */\r\nexport async function imageElementFromUrl(url: string, skipCrossOriginCheck = false): Promise<HTMLImageElement> {\r\n // We must set crossorigin property so that images loaded from same origin can be used with texImage2d.\r\n // We must do that outside of the promise constructor or it won't work, for reasons.\r\n const image = new Image();\r\n if (!skipCrossOriginCheck) {\r\n image.crossOrigin = \"anonymous\";\r\n }\r\n return new Promise((resolve: (image: HTMLImageElement) => void, reject) => {\r\n image.onload = () => resolve(image);\r\n\r\n // The \"error\" produced by Image is not an Error. It looks like an Event, but isn't one.\r\n image.onerror = () => reject(new Error(\"Failed to create image from url\"));\r\n image.src = url;\r\n });\r\n}\r\n\r\n/** Try to create an html Image element from a URL.\r\n * @param url The URL pointing to the image data.\r\n * @param skipCrossOriginCheck Set this to true to allow an image from a different origin than the web app to load. Default is false.\r\n * @returns A Promise resolving to an HTMLImageElement when the image data has been loaded from the URL, or to `undefined` if an exception occurred.\r\n * @see imageElementFromUrl\r\n * @public\r\n */\r\nexport async function tryImageElementFromUrl(url: string, skipCrossOriginCheck = false): Promise<HTMLImageElement | undefined> {\r\n try {\r\n return await imageElementFromUrl(url, skipCrossOriginCheck);\r\n } catch {\r\n return undefined;\r\n }\r\n}\r\n/**\r\n * Extract the dimensions of the jpeg or png data encoded in an ImageSource.\r\n * @param source The ImageSource containing the binary jpeg or png data.\r\n * @returns a Promise resolving to a Point2d of which x corresponds to the integer width of the uncompressed bitmap and y to the height.\r\n * @public\r\n * @extensions\r\n */\r\nexport async function extractImageSourceDimensions(source: ImageSource): Promise<Point2d> {\r\n const image = await imageElementFromImageSource(source);\r\n return new Point2d(image.naturalWidth, image.naturalHeight);\r\n}\r\n\r\n/**\r\n * Produces a data url in \"image/png\" format from the contents of an ImageBuffer.\r\n * @param buffer The ImageBuffer, of any format.\r\n * @param preserveAlpha If false, the alpha channel will be set to 255 (fully opaque). This is recommended when converting an already-blended image (e.g., one obtained from [[Viewport.readImageBuffer]]).\r\n * @returns a data url as a string suitable for setting as the `src` property of an HTMLImageElement, or undefined if the url could not be created.\r\n * @public\r\n * @extensions\r\n */\r\nexport function imageBufferToPngDataUrl(buffer: ImageBuffer, preserveAlpha = true): string | undefined {\r\n // The default format (and the only format required to be supported) for toDataUrl() is \"image/png\".\r\n const canvas = imageBufferToCanvas(buffer, preserveAlpha);\r\n return undefined !== canvas ? canvas.toDataURL() : undefined;\r\n}\r\n\r\n/**\r\n * Converts the contents of an ImageBuffer to PNG format.\r\n * @param buffer The ImageBuffer, of any format.\r\n * @param preserveAlpha If false, the alpha channel will be set to 255 (fully opaque). This is recommended when converting an already-blended image (e.g., one obtained from [[Viewport.readImageBuffer]]).\r\n * @returns a base64-encoded string representing the image as a PNG, or undefined if the conversion failed.\r\n * @public\r\n * @extensions\r\n */\r\nexport function imageBufferToBase64EncodedPng(buffer: ImageBuffer, preserveAlpha = true): string | undefined {\r\n const urlPrefix = \"data:image/png;base64,\";\r\n const url = imageBufferToPngDataUrl(buffer, preserveAlpha);\r\n if (undefined === url || !url.startsWith(urlPrefix))\r\n return undefined;\r\n\r\n return url.substring(urlPrefix.length);\r\n}\r\n\r\n/** Open an image specified as a data URL in a new window or tab. Works around differences between browsers and Electron.\r\n * @param url The base64-encoded image URL.\r\n * @param title An optional title to apply to the new window.\r\n * @beta\r\n */\r\nexport function openImageDataUrlInNewWindow(url: string, title?: string): void {\r\n const win = window.open();\r\n if (null === win)\r\n return;\r\n\r\n const div = win.document.createElement(\"div\");\r\n div.innerHTML = `<img src='${url}'/>`;\r\n win.document.body.append(div);\r\n if (undefined !== title)\r\n win.document.title = title;\r\n}\r\n\r\n/** Determine the maximum [[ViewRect]] that can be fitted and centered in specified ViewRect given a required aspect ratio.\r\n * @param viewRect The rectangle in which the returned rectangle is to be centered and fitted.\r\n * @param aspectRatio Ratio of width to height.\r\n * @returns A ViewRect centered in the input rectangle.\r\n * @public\r\n */\r\nexport function getCenteredViewRect(viewRect: ViewRect, aspectRatio = 1.4): ViewRect {\r\n // Determine scale that ensures ability to return an image with the prescribed aspectRatio\r\n const scale = Math.min(viewRect.width / aspectRatio, viewRect.height);\r\n const finalWidth = scale * aspectRatio;\r\n const finalHeight = scale;\r\n const left = (viewRect.width - finalWidth) / 2.0;\r\n const right = left + finalWidth;\r\n const top = (viewRect.height - finalHeight) / 2.0;\r\n const bottom = top + finalHeight;\r\n return new ViewRect(left, top, right, bottom);\r\n}\r\n\r\n/** Produce a jpeg compressed to no more than specified bytes and of no less than specified quality.\r\n * @param canvas Canvas containing the image to be compressed.\r\n * @param maxBytes Maximum size of output jpeg in bytes.\r\n * @param minCompressionQuality The minimum acceptable image quality as a number between 0 (lowest quality) and 1 (highest quality).\r\n * @returns A [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) for the image, or `undefined` if the compression and size constraints could not be met.\r\n * @public\r\n * @extensions\r\n */\r\nexport function getCompressedJpegFromCanvas(canvas: HTMLCanvasElement, maxBytes = 60000, minCompressionQuality = 0.1): string | undefined {\r\n const decrements = 0.1; // Decrements of quality\r\n const bytesPerCharacter = 2; // Assume 16-bit per character\r\n let quality = 1.0; // JPEG Compression quality\r\n\r\n while (quality > minCompressionQuality) {\r\n const data = canvas.toDataURL(\"image/jpeg\", quality);\r\n // If we are less than 60 Kb, we are good\r\n if (data.length * bytesPerCharacter < maxBytes)\r\n return data;\r\n\r\n quality -= decrements;\r\n }\r\n\r\n return undefined;\r\n}\r\n"]}
|
package/lib/cjs/IpcApp.d.ts
CHANGED
|
@@ -86,6 +86,7 @@ export declare class IpcApp {
|
|
|
86
86
|
*
|
|
87
87
|
* Then, call `MyNotificationHandler.register` at startup to connect your class to your channel.
|
|
88
88
|
* @public
|
|
89
|
+
* @extensions
|
|
89
90
|
*/
|
|
90
91
|
export declare abstract class NotificationHandler {
|
|
91
92
|
/** All subclasses must implement this method to specify their response channel name. */
|
package/lib/cjs/IpcApp.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IpcApp.d.ts","sourceRoot":"","sources":["../../src/IpcApp.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EACmD,eAAe,EAAwC,WAAW,EAAE,iBAAiB,EAC/H,cAAc,EAC7B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAa,gBAAgB,EAAE,M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AAC,IAAI,GAAG,SAAS,CAAC;QACtB,MAAM,qBAAS,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC;CACF;AA7FD,wBA6FC;AAED;;;;;;;;;;;;GAYG;AACH,MAAsB,mBAAmB;IAIhC,YAAY;QACjB,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,IAAW,EAAE,QAAgB,EAAE,GAAG,IAAW,EAAE,EAAE;YAC5F,MAAM,IAAI,GAAI,IAAY,CAAC,QAAQ,CAAC,CAAC;YACrC,IAAI,OAAO,IAAI,KAAK,UAAU;gBAC5B,MAAM,IAAI,yBAAW,CAAC,0BAAY,CAAC,gBAAgB,EAAE,WAAW,IAAI,CAAC,WAAW,CAAC,IAAI,IAAI,QAAQ,8DAA8D,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;YAErL,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,QAAQ;QACpB,OAAQ,IAAK,IAAY,EAA0B,CAAC,YAAY,EAAE,CAAC,CAAC,uFAAuF;IAC7J,CAAC;CACF;AAvBD,kDAuBC;AAED,wCAAwC;AACxC,MAAM,mBAAoB,SAAQ,mBAAmB;IACnD,IAAW,WAAW,KAAK,OAAO,2BAAa,CAAC,SAAS,CAAC,CAAC,CAAC;IACrD,SAAS,KAAK,CAAC;CACvB","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module NativeApp\r\n */\r\n\r\nimport { AsyncMethodsOf, PromiseReturnType } from \"@itwin/core-bentley\";\r\nimport {\r\n BackendError, IModelError, IModelStatus, IpcAppChannel, IpcAppFunctions, IpcAppNotifications, IpcInvokeReturn, IpcListener, IpcSocketFrontend,\r\n iTwinChannel, RemoveFunction,\r\n} from \"@itwin/core-common\";\r\nimport { IModelApp, IModelAppOptions } from \"./IModelApp\";\r\n\r\n/**\r\n * Options for [[IpcApp.startup]]\r\n * @public\r\n */\r\nexport interface IpcAppOptions {\r\n iModelApp?: IModelAppOptions;\r\n}\r\n\r\n/**\r\n * The frontend of apps with a dedicated backend that can use [Ipc]($docs/learning/IpcInterface.md).\r\n * @public\r\n */\r\nexport class IpcApp {\r\n private static _ipc: IpcSocketFrontend | undefined;\r\n /** Get the implementation of the [[IpcSocketFrontend]] interface. */\r\n\r\n private static get ipc(): IpcSocketFrontend { return this._ipc!; }\r\n\r\n /** Determine whether Ipc is available for this frontend. This will only be true if [[startup]] has been called on this class. */\r\n public static get isValid(): boolean { return undefined !== this._ipc; }\r\n\r\n /**\r\n * Establish a message handler function for the supplied channel over Ipc. The handler will be called when messages are sent for\r\n * the channel via [[BackendIpc.send]].\r\n * @param channel the name of the channel\r\n * @param handler the message handler\r\n * @returns A function to remove the handler\r\n * @note Ipc is only supported if [[isValid]] is true.\r\n */\r\n public static addListener(channel: string, handler: IpcListener): RemoveFunction {\r\n return this.ipc.addListener(iTwinChannel(channel), handler);\r\n }\r\n\r\n /**\r\n * Remove a previously registered listener\r\n * @param channel The name of the channel for the listener previously registered with [[addListener]]\r\n * @param listener The function passed to [[addListener]]\r\n */\r\n public static removeListener(channel: string, listener: IpcListener) {\r\n this.ipc.removeListener(iTwinChannel(channel), listener);\r\n }\r\n\r\n /**\r\n * Send a message to the backend via `channel` and expect a result asynchronously. The handler must be established on the backend via [[BackendIpc.handle]]\r\n * @param channel The name of the channel for the method.\r\n * @see Electron [ipcRenderer.invoke](https://www.electronjs.org/docs/api/ipc-renderer) documentation for details.\r\n * Note that this interface may be implemented via Electron for desktop apps, or via\r\n * [WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) for mobile or web-based\r\n * Ipc connections. In either case, the Electron documentation provides the specifications for how it works.\r\n * @note `args` are serialized with the [Structured Clone Algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), so only\r\n * primitive types and `ArrayBuffers` are allowed.\r\n */\r\n public static async invoke(channel: string, ...args: any[]): Promise<any> {\r\n return this.ipc.invoke(iTwinChannel(channel), ...args);\r\n }\r\n\r\n /**\r\n * Send a message over the socket.\r\n * @param channel The name of the channel for the message.\r\n * @param data The optional data of the message.\r\n * @note `data` is serialized with the [Structured Clone Algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), so only\r\n * primitive types and `ArrayBuffers` are allowed.\r\n */\r\n public static send(channel: string, ...data: any[]) {\r\n return this.ipc.send(iTwinChannel(channel), ...data);\r\n }\r\n\r\n /**\r\n * Call a method on the backend through an Ipc channel.\r\n * @param channelName the channel registered by the backend handler.\r\n * @param methodName the name of a method implemented by the backend handler.\r\n * @param args arguments to `methodName`\r\n * @return a Promise with the return value from `methodName`\r\n * @note If the backend implementation throws an exception, this method will throw a [[BackendError]] exception\r\n * with the `errorNumber` and `message` from the backend.\r\n * @note Ipc is only supported if [[isValid]] is true.\r\n * @internal\r\n */\r\n public static async callIpcChannel(channelName: string, methodName: string, ...args: any[]): Promise<any> {\r\n const retVal = (await this.invoke(channelName, methodName, ...args)) as IpcInvokeReturn;\r\n if (undefined !== retVal.error) {\r\n const err = new BackendError(retVal.error.errorNumber, retVal.error.name, retVal.error.message);\r\n err.stack = retVal.error.stack;\r\n throw err;\r\n }\r\n return retVal.result;\r\n }\r\n\r\n public static async callIpcHost<T extends AsyncMethodsOf<IpcAppFunctions>>(methodName: T, ...args: Parameters<IpcAppFunctions[T]>) {\r\n return this.callIpcChannel(IpcAppChannel.Functions, methodName, ...args) as PromiseReturnType<IpcAppFunctions[T]>;\r\n }\r\n\r\n /** start an IpcApp.\r\n * @note this should not be called directly. It is called by NativeApp.startup */\r\n public static async startup(ipc: IpcSocketFrontend, opts?: IpcAppOptions) {\r\n this._ipc = ipc;\r\n IpcAppNotifyHandler.register(); // receives notifications from backend\r\n await IModelApp.startup(opts?.iModelApp);\r\n }\r\n\r\n /** @internal */\r\n public static async shutdown() {\r\n this._ipc = undefined;\r\n await IModelApp.shutdown();\r\n }\r\n}\r\n\r\n/**\r\n * Base class for all implementations of an Ipc notification response interface. This class is implemented on your frontend to supply\r\n * methods to receive notifications from your backend.\r\n *\r\n * Create a subclass to implement your Ipc response interface. Your class should be declared like this:\r\n * ```ts\r\n * class MyNotificationHandler extends NotificationHandler implements MyNotifications\r\n * ```\r\n * to ensure all method names and signatures are correct. Your methods cannot have a return value.\r\n *\r\n * Then, call `MyNotificationHandler.register` at startup to connect your class to your channel.\r\n * @public\r\n */\r\nexport abstract class NotificationHandler {\r\n /** All subclasses must implement this method to specify their response channel name. */\r\n public abstract get channelName(): string;\r\n\r\n public registerImpl(): RemoveFunction {\r\n return IpcApp.addListener(this.channelName, (_evt: Event, funcName: string, ...args: any[]) => {\r\n const func = (this as any)[funcName];\r\n if (typeof func !== \"function\")\r\n throw new IModelError(IModelStatus.FunctionNotFound, `Method \"${this.constructor.name}.${funcName}\" not found on NotificationHandler registered for channel: ${this.channelName}`);\r\n\r\n func.call(this, ...args);\r\n });\r\n }\r\n\r\n /**\r\n * Register this class as the handler for notifications on its channel. This static method creates a new instance\r\n * that becomes the notification handler and is `this` when its methods are called.\r\n * @returns A function that can be called to remove the handler.\r\n * @note this method should only be called once per channel. If it is called multiple times, multiple handlers are established.\r\n */\r\n public static register(): RemoveFunction {\r\n return (new (this as any)() as NotificationHandler).registerImpl(); // create an instance of subclass. \"as any\" is necessary because base class is abstract\r\n }\r\n}\r\n\r\n/** IpcApp notifications from backend */\r\nclass IpcAppNotifyHandler extends NotificationHandler implements IpcAppNotifications {\r\n public get channelName() { return IpcAppChannel.AppNotify; }\r\n public notifyApp() { }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"IpcApp.js","sourceRoot":"","sources":["../../src/IpcApp.ts"],"names":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AAQ,CAAC,CAAC;YACrC,IAAI,OAAO,IAAI,KAAK,UAAU;gBAC5B,MAAM,IAAI,yBAAW,CAAC,0BAAY,CAAC,gBAAgB,EAAE,WAAW,IAAI,CAAC,WAAW,CAAC,IAAI,IAAI,QAAQ,8DAA8D,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;YAErL,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,QAAQ;QACpB,OAAQ,IAAK,IAAY,EAA0B,CAAC,YAAY,EAAE,CAAC,CAAC,uFAAuF;IAC7J,CAAC;CACF;AAvBD,kDAuBC;AAED,wCAAwC;AACxC,MAAM,mBAAoB,SAAQ,mBAAmB;IACnD,IAAW,WAAW,KAAK,OAAO,2BAAa,CAAC,SAAS,CAAC,CAAC,CAAC;IACrD,SAAS,KAAK,CAAC;CACvB","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module NativeApp\r\n */\r\n\r\nimport { AsyncMethodsOf, PromiseReturnType } from \"@itwin/core-bentley\";\r\nimport {\r\n BackendError, IModelError, IModelStatus, IpcAppChannel, IpcAppFunctions, IpcAppNotifications, IpcInvokeReturn, IpcListener, IpcSocketFrontend,\r\n iTwinChannel, RemoveFunction,\r\n} from \"@itwin/core-common\";\r\nimport { IModelApp, IModelAppOptions } from \"./IModelApp\";\r\n\r\n/**\r\n * Options for [[IpcApp.startup]]\r\n * @public\r\n */\r\nexport interface IpcAppOptions {\r\n iModelApp?: IModelAppOptions;\r\n}\r\n\r\n/**\r\n * The frontend of apps with a dedicated backend that can use [Ipc]($docs/learning/IpcInterface.md).\r\n * @public\r\n */\r\nexport class IpcApp {\r\n private static _ipc: IpcSocketFrontend | undefined;\r\n /** Get the implementation of the [[IpcSocketFrontend]] interface. */\r\n\r\n private static get ipc(): IpcSocketFrontend { return this._ipc!; }\r\n\r\n /** Determine whether Ipc is available for this frontend. This will only be true if [[startup]] has been called on this class. */\r\n public static get isValid(): boolean { return undefined !== this._ipc; }\r\n\r\n /**\r\n * Establish a message handler function for the supplied channel over Ipc. The handler will be called when messages are sent for\r\n * the channel via [[BackendIpc.send]].\r\n * @param channel the name of the channel\r\n * @param handler the message handler\r\n * @returns A function to remove the handler\r\n * @note Ipc is only supported if [[isValid]] is true.\r\n */\r\n public static addListener(channel: string, handler: IpcListener): RemoveFunction {\r\n return this.ipc.addListener(iTwinChannel(channel), handler);\r\n }\r\n\r\n /**\r\n * Remove a previously registered listener\r\n * @param channel The name of the channel for the listener previously registered with [[addListener]]\r\n * @param listener The function passed to [[addListener]]\r\n */\r\n public static removeListener(channel: string, listener: IpcListener) {\r\n this.ipc.removeListener(iTwinChannel(channel), listener);\r\n }\r\n\r\n /**\r\n * Send a message to the backend via `channel` and expect a result asynchronously. The handler must be established on the backend via [[BackendIpc.handle]]\r\n * @param channel The name of the channel for the method.\r\n * @see Electron [ipcRenderer.invoke](https://www.electronjs.org/docs/api/ipc-renderer) documentation for details.\r\n * Note that this interface may be implemented via Electron for desktop apps, or via\r\n * [WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) for mobile or web-based\r\n * Ipc connections. In either case, the Electron documentation provides the specifications for how it works.\r\n * @note `args` are serialized with the [Structured Clone Algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), so only\r\n * primitive types and `ArrayBuffers` are allowed.\r\n */\r\n public static async invoke(channel: string, ...args: any[]): Promise<any> {\r\n return this.ipc.invoke(iTwinChannel(channel), ...args);\r\n }\r\n\r\n /**\r\n * Send a message over the socket.\r\n * @param channel The name of the channel for the message.\r\n * @param data The optional data of the message.\r\n * @note `data` is serialized with the [Structured Clone Algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), so only\r\n * primitive types and `ArrayBuffers` are allowed.\r\n */\r\n public static send(channel: string, ...data: any[]) {\r\n return this.ipc.send(iTwinChannel(channel), ...data);\r\n }\r\n\r\n /**\r\n * Call a method on the backend through an Ipc channel.\r\n * @param channelName the channel registered by the backend handler.\r\n * @param methodName the name of a method implemented by the backend handler.\r\n * @param args arguments to `methodName`\r\n * @return a Promise with the return value from `methodName`\r\n * @note If the backend implementation throws an exception, this method will throw a [[BackendError]] exception\r\n * with the `errorNumber` and `message` from the backend.\r\n * @note Ipc is only supported if [[isValid]] is true.\r\n * @internal\r\n */\r\n public static async callIpcChannel(channelName: string, methodName: string, ...args: any[]): Promise<any> {\r\n const retVal = (await this.invoke(channelName, methodName, ...args)) as IpcInvokeReturn;\r\n if (undefined !== retVal.error) {\r\n const err = new BackendError(retVal.error.errorNumber, retVal.error.name, retVal.error.message);\r\n err.stack = retVal.error.stack;\r\n throw err;\r\n }\r\n return retVal.result;\r\n }\r\n\r\n public static async callIpcHost<T extends AsyncMethodsOf<IpcAppFunctions>>(methodName: T, ...args: Parameters<IpcAppFunctions[T]>) {\r\n return this.callIpcChannel(IpcAppChannel.Functions, methodName, ...args) as PromiseReturnType<IpcAppFunctions[T]>;\r\n }\r\n\r\n /** start an IpcApp.\r\n * @note this should not be called directly. It is called by NativeApp.startup */\r\n public static async startup(ipc: IpcSocketFrontend, opts?: IpcAppOptions) {\r\n this._ipc = ipc;\r\n IpcAppNotifyHandler.register(); // receives notifications from backend\r\n await IModelApp.startup(opts?.iModelApp);\r\n }\r\n\r\n /** @internal */\r\n public static async shutdown() {\r\n this._ipc = undefined;\r\n await IModelApp.shutdown();\r\n }\r\n}\r\n\r\n/**\r\n * Base class for all implementations of an Ipc notification response interface. This class is implemented on your frontend to supply\r\n * methods to receive notifications from your backend.\r\n *\r\n * Create a subclass to implement your Ipc response interface. Your class should be declared like this:\r\n * ```ts\r\n * class MyNotificationHandler extends NotificationHandler implements MyNotifications\r\n * ```\r\n * to ensure all method names and signatures are correct. Your methods cannot have a return value.\r\n *\r\n * Then, call `MyNotificationHandler.register` at startup to connect your class to your channel.\r\n * @public\r\n * @extensions\r\n */\r\nexport abstract class NotificationHandler {\r\n /** All subclasses must implement this method to specify their response channel name. */\r\n public abstract get channelName(): string;\r\n\r\n public registerImpl(): RemoveFunction {\r\n return IpcApp.addListener(this.channelName, (_evt: Event, funcName: string, ...args: any[]) => {\r\n const func = (this as any)[funcName];\r\n if (typeof func !== \"function\")\r\n throw new IModelError(IModelStatus.FunctionNotFound, `Method \"${this.constructor.name}.${funcName}\" not found on NotificationHandler registered for channel: ${this.channelName}`);\r\n\r\n func.call(this, ...args);\r\n });\r\n }\r\n\r\n /**\r\n * Register this class as the handler for notifications on its channel. This static method creates a new instance\r\n * that becomes the notification handler and is `this` when its methods are called.\r\n * @returns A function that can be called to remove the handler.\r\n * @note this method should only be called once per channel. If it is called multiple times, multiple handlers are established.\r\n */\r\n public static register(): RemoveFunction {\r\n return (new (this as any)() as NotificationHandler).registerImpl(); // create an instance of subclass. \"as any\" is necessary because base class is abstract\r\n }\r\n}\r\n\r\n/** IpcApp notifications from backend */\r\nclass IpcAppNotifyHandler extends NotificationHandler implements IpcAppNotifications {\r\n public get channelName() { return IpcAppChannel.AppNotify; }\r\n public notifyApp() { }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarginPercent.d.ts","sourceRoot":"","sources":["../../src/MarginPercent.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH
|
|
1
|
+
{"version":3,"file":"MarginPercent.d.ts","sourceRoot":"","sources":["../../src/MarginPercent.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH;;;;GAIG;AACH,qBAAa,aAAa;IACL,IAAI,EAAE,MAAM;IAAS,GAAG,EAAE,MAAM;IAAS,KAAK,EAAE,MAAM;IAAS,MAAM,EAAE,MAAM;gBAA7E,IAAI,EAAE,MAAM,EAAS,GAAG,EAAE,MAAM,EAAS,KAAK,EAAE,MAAM,EAAS,MAAM,EAAE,MAAM;CAOjG"}
|
package/lib/cjs/MarginPercent.js
CHANGED
|
@@ -12,6 +12,7 @@ const core_geometry_1 = require("@itwin/core-geometry");
|
|
|
12
12
|
/** Margins for white space to be left around view volumes for [[ViewState.lookAtVolume]].
|
|
13
13
|
* Values mean "fraction of view size" and must be between 0 and .25.
|
|
14
14
|
* @public
|
|
15
|
+
* @extensions
|
|
15
16
|
*/
|
|
16
17
|
class MarginPercent {
|
|
17
18
|
constructor(left, top, right, bottom) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarginPercent.js","sourceRoot":"","sources":["../../src/MarginPercent.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,wDAAgD;AAChD
|
|
1
|
+
{"version":3,"file":"MarginPercent.js","sourceRoot":"","sources":["../../src/MarginPercent.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,wDAAgD;AAChD;;;;GAIG;AACH,MAAa,aAAa;IACxB,YAAmB,IAAY,EAAS,GAAW,EAAS,KAAa,EAAS,MAAc;QAA7E,SAAI,GAAJ,IAAI,CAAQ;QAAS,QAAG,GAAH,GAAG,CAAQ;QAAS,UAAK,GAAL,KAAK,CAAQ;QAAS,WAAM,GAAN,MAAM,CAAQ;QAC9F,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,wBAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;QACpE,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;QAC9B,IAAI,CAAC,GAAG,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;CACF;AARD,sCAQC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Views\r\n */\r\n\r\nimport { Geometry } from \"@itwin/core-geometry\";\r\n/** Margins for white space to be left around view volumes for [[ViewState.lookAtVolume]].\r\n * Values mean \"fraction of view size\" and must be between 0 and .25.\r\n * @public\r\n * @extensions\r\n */\r\nexport class MarginPercent {\r\n constructor(public left: number, public top: number, public right: number, public bottom: number) {\r\n const limitMargin = (val: number) => Geometry.clamp(val, 0.0, 0.25);\r\n this.left = limitMargin(left);\r\n this.top = limitMargin(top);\r\n this.right = limitMargin(right);\r\n this.bottom = limitMargin(bottom);\r\n }\r\n}\r\n"]}
|
package/lib/cjs/Marker.d.ts
CHANGED
|
@@ -11,18 +11,29 @@ import { ScreenViewport, Viewport } from "./Viewport";
|
|
|
11
11
|
import { ViewRect } from "./ViewRect";
|
|
12
12
|
/** The types that may be used for Markers
|
|
13
13
|
* @public
|
|
14
|
+
* @extensions
|
|
14
15
|
*/
|
|
15
16
|
export declare type MarkerImage = HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap;
|
|
16
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* @public
|
|
19
|
+
* @extensions
|
|
20
|
+
*/
|
|
17
21
|
export declare type MarkerFillStyle = string | CanvasGradient | CanvasPattern;
|
|
18
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* @public
|
|
24
|
+
* @extensions
|
|
25
|
+
*/
|
|
19
26
|
export declare type MarkerTextAlign = "left" | "right" | "center" | "start" | "end";
|
|
20
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* @public
|
|
29
|
+
* @extensions
|
|
30
|
+
*/
|
|
21
31
|
export declare type MarkerTextBaseline = "top" | "hanging" | "middle" | "alphabetic" | "ideographic" | "bottom";
|
|
22
32
|
/** A Marker is a [[CanvasDecoration]], whose position follows a fixed location in world space.
|
|
23
33
|
* Markers draw on top of all scene graphics, and show visual cues about locations of interest.
|
|
24
34
|
* @see [Markers]($docs/learning/frontend/Markers)
|
|
25
35
|
* @public
|
|
36
|
+
* @extensions
|
|
26
37
|
*/
|
|
27
38
|
export declare class Marker implements CanvasDecoration {
|
|
28
39
|
protected _scaleFactor?: Point2d;
|
|
@@ -139,6 +150,7 @@ export declare class Marker implements CanvasDecoration {
|
|
|
139
150
|
/** A cluster of one or more Markers that overlap one another in the view. The cluster's screen position is taken from its first entry.
|
|
140
151
|
* Clusters also have a Marker themselves, that represents the whole group. The cluster marker isn't created until all entries have been added.
|
|
141
152
|
* @public
|
|
153
|
+
* @extensions
|
|
142
154
|
*/
|
|
143
155
|
export declare class Cluster<T extends Marker> {
|
|
144
156
|
readonly markers: T[];
|
|
@@ -154,6 +166,7 @@ export declare class Cluster<T extends Marker> {
|
|
|
154
166
|
/** A *set* of Markers that are logically related, such that they *cluster* when they overlap one another in screen space.
|
|
155
167
|
* In that case, a *cluster marker* is drawn instead of the overlapping Markers.
|
|
156
168
|
* @public
|
|
169
|
+
* @extensions
|
|
157
170
|
*/
|
|
158
171
|
export declare abstract class MarkerSet<T extends Marker> {
|
|
159
172
|
private _viewport?;
|
package/lib/cjs/Marker.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Marker.d.ts","sourceRoot":"","sources":["../../src/Marker.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAY,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAY,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC5H,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAI9C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,M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B,IAAW,QAAQ,YAElB;IAED;;;OAGG;IACI,kBAAkB;CAQ1B;AAED;;;;GAIG;AACH,8BAAsB,SAAS,CAAC,CAAC,SAAS,MAAM;IAC9C,OAAO,CAAC,SAAS,CAAC,CAAiB;IAEnC,gBAAgB;IAChB,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAM;IAC/C,gBAAgB;IAChB,SAAS,CAAC,QAAQ,CAAC,eAAe,WAAyB;IAC3D,gBAAgB;IAChB,SAAS,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAClC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA0B;IAEnD,qKAAqK;IAC9J,kBAAkB,SAAK;IAC9B,4EAA4E;IAC5E,IAAW,OAAO,IAAI,GAAG,CAAC,CAAC,CAAC,CAA0B;IACtD,+OAA+O;IAC/O,SAAS,CAAC,aAAa,SAAK;IAE5B;;OAEG;gBACgB,QAAQ,CAAC,EAAE,cAAc;IAQ5C,4CAA4C;IAC5C,IAAW,QAAQ,IAAI,cAAc,GAAG,SAAS,CAA2B;IAE5E;;;OAGG;IACI,cAAc,CAAC,QAAQ,EAAE,cAAc;IAK9C;;;;;;OAMG;IACI,SAAS,IAAI,IAAI;IAIxB;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,MAAM;IAEhE,sGAAsG;IAC/F,gBAAgB,CAAC,EAAE,EAAE,QAAQ,GAAG,MAAM;IAM7C;;;OAGG;IACI,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;CAmErD"}
|
package/lib/cjs/Marker.js
CHANGED
|
@@ -36,6 +36,7 @@ function getMinScaleViewW(vp) {
|
|
|
36
36
|
* Markers draw on top of all scene graphics, and show visual cues about locations of interest.
|
|
37
37
|
* @see [Markers]($docs/learning/frontend/Markers)
|
|
38
38
|
* @public
|
|
39
|
+
* @extensions
|
|
39
40
|
*/
|
|
40
41
|
class Marker {
|
|
41
42
|
/** Constructor for Marker
|
|
@@ -212,6 +213,7 @@ exports.Marker = Marker;
|
|
|
212
213
|
/** A cluster of one or more Markers that overlap one another in the view. The cluster's screen position is taken from its first entry.
|
|
213
214
|
* Clusters also have a Marker themselves, that represents the whole group. The cluster marker isn't created until all entries have been added.
|
|
214
215
|
* @public
|
|
216
|
+
* @extensions
|
|
215
217
|
*/
|
|
216
218
|
class Cluster {
|
|
217
219
|
constructor(markers) {
|
|
@@ -238,6 +240,7 @@ exports.Cluster = Cluster;
|
|
|
238
240
|
/** A *set* of Markers that are logically related, such that they *cluster* when they overlap one another in screen space.
|
|
239
241
|
* In that case, a *cluster marker* is drawn instead of the overlapping Markers.
|
|
240
242
|
* @public
|
|
243
|
+
* @extensions
|
|
241
244
|
*/
|
|
242
245
|
class MarkerSet {
|
|
243
246
|
/** Construct a new MarkerSet for a specific ScreenViewport.
|
package/lib/cjs/Marker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Marker.js","sourceRoot":"","sources":["../../src/Marker.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAoE;AACpE,wDAA4H;AAE5H,qEAAkE;AAClE,2CAAkD;AAClD,2CAAwC;AAMxC,yCAAsC;AAgBtC,SAAS,gBAAgB,CAAC,EAAY;IACpC,IAAI,KAAK,CAAC;IACV,MAAM,MAAM,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;IACnC,MAAM,SAAS,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;IAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IACnE,MAAM,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;IACxD,MAAM,KAAK,GAAG,wBAAQ,CAAC,MAAM,EAAE,CAAC;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,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,mCAAmC;iBAClG;qBAAM;oBACL,gDAAgD;oBAChD,IAAI,SAAS,KAAK,KAAK,CAAC,aAAa,EAAE,EAAE,+CAA+C;wBACtF,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,kBAAkB;wBACtE,gEAAgE;wBAChE,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM;4BAC3B,aAAa,CAAC,WAAW,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;wBACtC,KAAK,CAAC,aAAa,GAAG,aAAa,CAAC;qBACrC;oBACD,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;iBACxC;aACF;iBAAM;gBACL,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,8CAA8C;aACzE;SACF;IACH,CAAC;CACF;AAzID,8BAyIC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Views\r\n */\r\n\r\nimport { assert, Logger, ObservableSet } from \"@itwin/core-bentley\";\r\nimport { Geometry, Matrix4d, Point2d, Point3d, Range1d, Range1dProps, Vector3d, XAndY, XYAndZ } from \"@itwin/core-geometry\";\r\nimport { ColorDef } from \"@itwin/core-common\";\r\nimport { FrontendLoggerCategory } from \"./FrontendLoggerCategory\";\r\nimport { imageElementFromUrl } from \"./ImageUtil\";\r\nimport { IModelApp } from \"./IModelApp\";\r\nimport { ToolTipOptions } from \"./NotificationManager\";\r\nimport { CanvasDecoration } from \"./render/CanvasDecoration\";\r\nimport { BeButtonEvent } from \"./tools/Tool\";\r\nimport { DecorateContext } from \"./ViewContext\";\r\nimport { ScreenViewport, Viewport } from \"./Viewport\";\r\nimport { ViewRect } from \"./ViewRect\";\r\n\r\n/** The types that may be used for Markers\r\n * @public\r\n */\r\nexport type MarkerImage = HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap;\r\n\r\n/** @public */\r\nexport type MarkerFillStyle = string | CanvasGradient | CanvasPattern;\r\n\r\n/** @public */\r\nexport type MarkerTextAlign = \"left\" | \"right\" | \"center\" | \"start\" | \"end\";\r\n\r\n/** @public */\r\nexport type MarkerTextBaseline = \"top\" | \"hanging\" | \"middle\" | \"alphabetic\" | \"ideographic\" | \"bottom\";\r\n\r\nfunction getMinScaleViewW(vp: Viewport): number {\r\n let zHigh;\r\n const origin = vp.view.getCenter();\r\n const direction = vp.view.getZVector(); direction.scaleInPlace(-1);\r\n const corners = vp.view.iModel.projectExtents.corners();\r\n const delta = Vector3d.create();\r\n for (const corner of corners) {\r\n Vector3d.createStartEnd(origin, corner, delta);\r\n const projection = delta.dotProduct(direction);\r\n if (undefined === zHigh || projection > zHigh)\r\n zHigh = projection;\r\n }\r\n if (undefined === zHigh)\r\n return 0.0;\r\n origin.plusScaled(direction, zHigh, origin);\r\n return vp.worldToView4d(origin).w;\r\n}\r\n\r\n/** A Marker is a [[CanvasDecoration]], whose position follows a fixed location in world space.\r\n * Markers draw on top of all scene graphics, and show visual cues about locations of interest.\r\n * @see [Markers]($docs/learning/frontend/Markers)\r\n * @public\r\n */\r\nexport class Marker implements CanvasDecoration {\r\n protected _scaleFactor?: Point2d;\r\n protected _scaleFactorRange?: Range1d;\r\n\r\n /** Whether this marker is currently enabled. If false, this Marker is not displayed. */\r\n public visible = true;\r\n /** Whether this marker is currently hilited or not. */\r\n protected _isHilited = false;\r\n /** The color for the shadowBlur when this Marker is hilited */\r\n protected _hiliteColor?: ColorDef;\r\n /** The location of this Marker in world coordinates. */\r\n public worldLocation: Point3d;\r\n /** The size of this Marker, in pixels. */\r\n public size: Point2d;\r\n /** The current position for the marker, in view coordinates (pixels). This value will be updated by calls to [[setPosition]]. */\r\n public position = new Point3d();\r\n /** The current rectangle for the marker, in view coordinates (pixels). This value will be updated by calls to [[setPosition]]. */\r\n public readonly rect = new ViewRect();\r\n /** An image to draw for this Marker. If undefined, no image is shown. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage. */\r\n public image?: MarkerImage;\r\n /** The offset for [[image]], in pixels, from the *center* of this Marker. If undefined, (0,0). */\r\n public imageOffset?: XAndY;\r\n /** The size of [[image]], in pixels. If undefined, use [[size]]. */\r\n public imageSize?: XAndY;\r\n /** A text Label for this Marker. If undefined, no label is displayed. */\r\n public label?: string;\r\n /** The offset for [[label]], in pixels, from the *center* of this Marker. If undefined, (0,0). */\r\n public labelOffset?: XAndY;\r\n /** The maximum with for [[label]], in pixels. If undefined label will not be condensed or use a smaller font size. */\r\n public labelMaxWidth?: number;\r\n /** The color for [[label]]. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle. If undefined, \"white\". */\r\n public labelColor?: MarkerFillStyle;\r\n /** The text alignment for [[label]]. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/textAlign. If undefined, \"center\" */\r\n public labelAlign?: MarkerTextAlign;\r\n /** The text baseline for [[label]]. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/textBaseline. If undefined, \"middle\" */\r\n public labelBaseline?: MarkerTextBaseline;\r\n /** The font for [[label]]. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/font. */\r\n public labelFont?: string;\r\n /** The title string, or HTMLElement, to show (only) in the ToolTip when the pointer is over this Marker. See [[NotificationManager.openToolTip]] */\r\n public title?: HTMLElement | string;\r\n /** The ToolTipOptions to use for [[title]]. */\r\n public tooltipOptions?: ToolTipOptions;\r\n\r\n /** An Optional (unique) HTMLElement to display with this Marker. Generally, HTMLElements are more expensive than\r\n * images and labels, since they are added/removed from the DOM every frame. But, some types of markers are more convenient to construct\r\n * as HTMLElements, and if there aren't too many of them performance is fine.\r\n * @note HTMLElements may only appear in the DOM one time. Therefore, they *may not be shared* by more than one Marker.\r\n * You must ensure that each marker has its own HTMLElement. For this reason, you should probably only use HTMLElements in Markers if\r\n * each one is meant to be unique. For shared content, use images.\r\n */\r\n public htmlElement?: HTMLElement;\r\n\r\n /** Return true to display [[image]], if present. */\r\n public get wantImage() { return true; }\r\n\r\n /** Implement this function to draw onto the CanvasRenderingContext2D when this Marker is displayed. The [0,0] point will be the center of the Marker. */\r\n public drawFunc?(ctx: CanvasRenderingContext2D): void;\r\n\r\n /** Called when the mouse pointer enters this Marker. */\r\n public onMouseEnter(ev: BeButtonEvent) { this._isHilited = true; this._hiliteColor = ev.viewport!.hilite.color; IModelApp.accuSnap.clear(); }\r\n\r\n /** Called when the mouse pointer leaves this Marker. */\r\n public onMouseLeave() { this._isHilited = false; }\r\n\r\n /** Called when the mouse pointer moves over this Marker */\r\n public onMouseMove(ev: BeButtonEvent): void {\r\n if (this.title)\r\n ev.viewport!.openToolTip(this.title, ev.viewPoint, this.tooltipOptions);\r\n }\r\n /** Called when a mouse button is pressed over this Marker. */\r\n public onMouseButton?(_ev: BeButtonEvent): boolean;\r\n\r\n /** Determine whether the point is within this Marker. */\r\n public pick(pt: XAndY): boolean { return this.rect.containsPoint(pt); }\r\n\r\n /** Establish a range of scale factors to increases and decrease the size of this Marker based on its distance from the camera.\r\n * @param range The minimum and maximum scale factors to be applied to the size of this Marker based on its distance from the camera. `range.Low` is the scale factor\r\n * for Markers at the back of the view frustum and `range.high` is the scale factor at the front of the view frustum.\r\n * @note Marker size scaling is only applied in views with the camera enabled. It has no effect on orthographic views.\r\n */\r\n public setScaleFactor(range: Range1dProps) {\r\n this._scaleFactorRange = Range1d.fromJSON(range);\r\n this._scaleFactor = Point2d.create(1, 1);\r\n }\r\n\r\n /** Constructor for Marker\r\n * @param worldLocation The location of this Marker in world coordinates.\r\n * @param size The size of this Marker in pixels.\r\n */\r\n constructor(worldLocation: XYAndZ, size: XAndY) {\r\n this.worldLocation = Point3d.createFrom(worldLocation);\r\n this.size = Point2d.createFrom(size);\r\n }\r\n\r\n /** Make a new Marker at the same position and size as this Marker.\r\n * The new Marker will share the world location and size, but will be otherwise blank.\r\n */\r\n public static makeFrom<T extends Marker>(other: Marker, ...args: any[]): T {\r\n const out = new (this as any)(other.worldLocation, other.size, ...args) as T;\r\n out.rect.setFrom(other.rect);\r\n out.position.setFrom(other.position);\r\n if (other._scaleFactor)\r\n out._scaleFactor = Point2d.createFrom(other._scaleFactor);\r\n out._scaleFactorRange = other._scaleFactorRange;\r\n return out;\r\n }\r\n\r\n /** When a Marker is displayed in its hilited state, this method is called first. If it returns true, no further action is taken.\r\n * Otherwise the Marker's normal drawing operations are also called. By default, this method adds a shadowBlur effect and increases\r\n * the size of the Marker by 25%.\r\n * @return true to stop drawing this Marker\r\n */\r\n protected drawHilited(ctx: CanvasRenderingContext2D) {\r\n ctx.shadowBlur = 30;\r\n ctx.shadowColor = this._hiliteColor ? this._hiliteColor.toHexString() : \"white\";\r\n ctx.scale(1.25, 1.25);\r\n return false;\r\n }\r\n\r\n /** Called during frame rendering to display this Marker onto the supplied context. */\r\n public drawDecoration(ctx: CanvasRenderingContext2D): void {\r\n if (this._isHilited && this.drawHilited(ctx))\r\n return;\r\n\r\n if (this._scaleFactor !== undefined)\r\n ctx.scale(this._scaleFactor.x, this._scaleFactor.y);\r\n\r\n // first call the \"drawFunc\" if defined. This means it will be below the image and label if they overlap\r\n if (undefined !== this.drawFunc)\r\n this.drawFunc(ctx);\r\n\r\n // next draw the image, if defined and desired\r\n if (this.wantImage && this.image !== undefined) {\r\n const size = this.imageSize ? this.imageSize : this.size;\r\n const offset = new Point2d(size.x / 2, size.y / 2);\r\n if (this.imageOffset)\r\n offset.plus(this.imageOffset, offset);\r\n ctx.drawImage(this.image, -offset.x, -offset.y, size.x, size.y);\r\n }\r\n\r\n // lastly, draw the label, if defined. This puts it on top of all other graphics for this Marker.\r\n if (this.label !== undefined) {\r\n ctx.textAlign = this.labelAlign ? this.labelAlign : \"center\";\r\n ctx.textBaseline = this.labelBaseline ? this.labelBaseline : \"middle\";\r\n ctx.font = this.labelFont ? this.labelFont : \"14px sans-serif\";\r\n ctx.fillStyle = this.labelColor ? this.labelColor : \"white\";\r\n ctx.fillText(this.label, this.labelOffset ? -this.labelOffset.x : 0, this.labelOffset ? -this.labelOffset.y : 0, this.labelMaxWidth);\r\n }\r\n }\r\n\r\n /** Set the [[image]] for this marker.\r\n * @param image Either a [[MarkerImage]] or a Promise for a [[MarkerImage]]. If a Promise is supplied, the [[image]] member is set\r\n * when the Promise resolves.\r\n */\r\n public setImage(image: MarkerImage | Promise<MarkerImage>) {\r\n if (image instanceof Promise) {\r\n image.then((resolvedImage) =>\r\n this.image = resolvedImage,\r\n ).catch((err: Event) => {\r\n const target = err.target as any;\r\n const msg = `Could not load image ${target && target.src ? target.src : \"unknown\"}`;\r\n Logger.logError(`${FrontendLoggerCategory.Package}.markers`, msg);\r\n console.log(msg); // eslint-disable-line no-console\r\n });\r\n } else\r\n this.image = image;\r\n }\r\n\r\n /** Set the image for this Marker from a URL. */\r\n public setImageUrl(url: string) { this.setImage(imageElementFromUrl(url)); }\r\n\r\n /** Set the position (in pixels) for this Marker in the supplied Viewport, based on its worldLocation.\r\n * @param markerSet The MarkerSet if this Marker is included in a set.\r\n * @return true if the Marker is visible and its new position is inside the Viewport.\r\n */\r\n public setPosition(vp: Viewport, markerSet?: MarkerSet<Marker>): boolean {\r\n if (!this.visible) // if we're turned off, skip\r\n return false;\r\n\r\n const pt4 = vp.worldToView4d(this.worldLocation);\r\n if (pt4.w > 1.0 || pt4.w < 1.0e-6) // outside of frustum or too close to eye.\r\n return false;\r\n\r\n pt4.realPoint(this.position);\r\n if (!vp.viewRect.containsPoint(this.position))\r\n return false; // outside this viewport rect\r\n\r\n const origin = this.position;\r\n const sizeX = this.size.x / 2;\r\n const sizeY = this.size.y / 2;\r\n this.rect.init(origin.x - sizeX, origin.y - sizeY, origin.x + sizeX, origin.y + sizeY);\r\n\r\n // if there's a scale factor active, calculate it now.\r\n if (this._scaleFactor && this._scaleFactorRange) {\r\n let scale = 1.0;\r\n if (vp.isCameraOn) {\r\n const range = this._scaleFactorRange;\r\n const minScaleViewW = (undefined !== markerSet ? markerSet.getMinScaleViewW(vp) : getMinScaleViewW(vp));\r\n if (minScaleViewW > 0.0)\r\n scale = Geometry.clamp(range.high - (pt4.w / minScaleViewW) * range.length(), .4, 2.0);\r\n else\r\n scale = Geometry.clamp(range.low + ((1 - pt4.w) * range.length()), .4, 2.0);\r\n this.rect.scaleAboutCenter(scale, scale);\r\n }\r\n this._scaleFactor.set(scale, scale);\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /** Position the HTMLElement for this Marker relative to the Marker's position in the view.\r\n * The default implementation centers the HTMLElement (using its boundingClientRect) on the Marker.\r\n * Override this method to provide an alternative positioning approach.\r\n */\r\n protected positionHtml() {\r\n const html = this.htmlElement!;\r\n const style = html.style;\r\n style.position = \"absolute\";\r\n const size = html.getBoundingClientRect(); // Note: only call this *after* setting position = absolute\r\n const markerPos = this.position;\r\n style.left = `${markerPos.x - (size.width / 2)}px`;\r\n style.top = `${markerPos.y - (size.height / 2)}px`;\r\n }\r\n\r\n /** Add this Marker to the supplied DecorateContext. */\r\n public addMarker(context: DecorateContext) {\r\n context.addCanvasDecoration(this);\r\n if (undefined !== this.htmlElement) {\r\n // add this Marker to the DOM\r\n context.addHtmlDecoration(this.htmlElement);\r\n this.positionHtml(); // always reposition it\r\n }\r\n }\r\n\r\n /** Set the position and add this Marker to the supplied DecorateContext, if it's visible.\r\n * This method should be called from your implementation of [[Decorator.decorate]]. It will set this Marker's position based on the\r\n * Viewport from the context, and add this this Marker to the supplied DecorateContext.\r\n * @param context The DecorateContext for the Marker\r\n */\r\n public addDecoration(context: DecorateContext) {\r\n if (this.setPosition(context.viewport))\r\n this.addMarker(context);\r\n }\r\n}\r\n\r\n/** A cluster of one or more Markers that overlap one another in the view. The cluster's screen position is taken from its first entry.\r\n * Clusters also have a Marker themselves, that represents the whole group. The cluster marker isn't created until all entries have been added.\r\n * @public\r\n */\r\nexport class Cluster<T extends Marker> {\r\n public readonly markers: T[];\r\n public clusterMarker?: Marker;\r\n\r\n public constructor(markers: T[]) {\r\n assert(markers.length > 0);\r\n this.markers = markers;\r\n }\r\n\r\n public get position() {\r\n return this.markers[0].position;\r\n }\r\n\r\n /**\r\n * Gets the location for the cluster\r\n * @returns The average of the cluster markers worldLocation.\r\n */\r\n public getClusterLocation() {\r\n const location = Point3d.createZero();\r\n if (this.markers.length > 0) {\r\n this.markers.forEach((marker) => location.addInPlace(marker.worldLocation));\r\n location.scaleInPlace(1 / this.markers.length);\r\n }\r\n return location;\r\n }\r\n}\r\n\r\n/** A *set* of Markers that are logically related, such that they *cluster* when they overlap one another in screen space.\r\n * In that case, a *cluster marker* is drawn instead of the overlapping Markers.\r\n * @public\r\n */\r\nexport abstract class MarkerSet<T extends Marker> {\r\n private _viewport?: ScreenViewport;\r\n\r\n /** @internal */\r\n protected _entries: Array<T | Cluster<T>> = []; // this is an array that holds either Markers or a cluster of markers.\r\n /** @internal */\r\n protected readonly _worldToViewMap = Matrix4d.createZero();\r\n /** @internal */\r\n protected _minScaleViewW?: number;\r\n private readonly _markers = new ObservableSet<T>();\r\n\r\n /** The minimum number of Markers that must overlap before they are clustered. Otherwise they are each drawn individually. Default is 1 (always create a cluster.) */\r\n public minimumClusterSize = 1;\r\n /** The set of Markers in this MarkerSet. Add your [[Marker]]s into this. */\r\n public get markers(): Set<T> { return this._markers; }\r\n /** The radius (in pixels) representing the distance between the screen X,Y positions of two Markers to be clustered. When less than or equal to 0 (the default), the radius is calculated based on the first visible marker imageSize/size. */\r\n protected clusterRadius = 0;\r\n\r\n /** Construct a new MarkerSet for a specific ScreenViewport.\r\n * @param viewport the ScreenViewport for this MarkerSet. If undefined, use [[IModelApp.viewManager.selectedView]]\r\n */\r\n public constructor(viewport?: ScreenViewport) {\r\n this._viewport = undefined === viewport ? IModelApp.viewManager.selectedView : viewport;\r\n const markDirty = () => this.markDirty();\r\n this._markers.onAdded.addListener(markDirty);\r\n this._markers.onDeleted.addListener(markDirty);\r\n this._markers.onCleared.addListener(markDirty);\r\n }\r\n\r\n /** The ScreenViewport of this MarkerSet. */\r\n public get viewport(): ScreenViewport | undefined { return this._viewport; }\r\n\r\n /** Change the ScreenViewport for this MarkerSet.\r\n * After this call, the markers from this MarkerSet will only appear in the supplied ScreenViewport.\r\n * @beta\r\n */\r\n public changeViewport(viewport: ScreenViewport) {\r\n this._viewport = viewport;\r\n this.markDirty();\r\n }\r\n\r\n /** Indicate that this MarkerSet has been changed and is now *dirty*.\r\n * This is necessary because [[addDecoration]] does not recreate the set of decoration graphics\r\n * if it can detect that the previously-created set remains valid.\r\n * The set becomes invalid when the view frustum changes, or the contents of [[markers]] changes.\r\n * If some other criterion affecting the graphics changes, invoke this method. This should not be necessary for most use cases.\r\n * @public\r\n */\r\n public markDirty(): void {\r\n this._worldToViewMap.setZero();\r\n }\r\n\r\n /** Implement this method to create a new Marker that is shown as a *stand-in* for a Cluster of Markers that overlap one another.\r\n * @param cluster The [[Cluster]] that the new Marker will represent.\r\n * @returns The Marker that will be displayed to represent the Cluster.\r\n * @note You must create a new Marker each time this method is called.\r\n */\r\n protected abstract getClusterMarker(cluster: Cluster<T>): Marker;\r\n\r\n /** Get weight value limit establishing the distance from camera for the back of view scale factor. */\r\n public getMinScaleViewW(vp: Viewport): number {\r\n if (undefined === this._minScaleViewW)\r\n this._minScaleViewW = getMinScaleViewW(vp);\r\n return this._minScaleViewW;\r\n }\r\n\r\n /** This method should be called from [[Decorator.decorate]]. It will add this this MarkerSet to the supplied DecorateContext.\r\n * This method implements the logic that turns overlapping Markers into a Cluster.\r\n * @param context The DecorateContext for the Markers\r\n */\r\n public addDecoration(context: DecorateContext): void {\r\n const vp = context.viewport;\r\n if (vp !== this._viewport)\r\n return; // not viewport of this MarkerSet, ignore it\r\n\r\n const entries = this._entries;\r\n\r\n // Don't recreate the entries array if the view hasn't changed. This is important for performance, but also necessary for hilite of\r\n // clusters (otherwise they're recreated continually and never hilited.) */\r\n if (!this._worldToViewMap.isAlmostEqual(vp.worldToViewMap.transform0)) {\r\n this._worldToViewMap.setFrom(vp.worldToViewMap.transform0);\r\n this._minScaleViewW = undefined; // Invalidate current value.\r\n entries.length = 0; // start over.\r\n\r\n let distSquared = this.clusterRadius * this.clusterRadius;\r\n\r\n // loop through all of the Markers in the MarkerSet.\r\n for (const marker of this.markers) {\r\n // establish the screen position for this marker. If it's not in view, setPosition returns false\r\n if (!marker.setPosition(vp, this))\r\n continue;\r\n\r\n if (distSquared <= 0) {\r\n const size = marker.imageSize ? marker.imageSize : marker.size;\r\n const dist = Math.max(size.x, size.y) * 1.5;\r\n distSquared = dist * dist;\r\n }\r\n\r\n let added = false;\r\n for (let i = 0; i < entries.length; ++i) { // loop through all of the currently visible markers/clusters\r\n const entry = entries[i];\r\n if (marker.position.distanceSquaredXY(entry.position) <= distSquared) {\r\n added = true; // yes, we're going to save it as a Cluster\r\n if (entry instanceof Cluster) { // is the entry already a Cluster?\r\n entry.markers.push(marker); // yes, just add this to the existing cluster\r\n } else {\r\n entries[i] = new Cluster([entry, marker]); // no, make a new Cluster holding both\r\n }\r\n break; // this Marker has been handled, we can stop looking for overlaps\r\n }\r\n }\r\n if (!added)\r\n entries.push(marker); // there was no overlap, save this Marker to be drawn\r\n }\r\n }\r\n\r\n // we now have an array of Markers and Clusters, add them to context\r\n for (const entry of entries) {\r\n if (entry instanceof Cluster) { // is this entry a Cluster?\r\n if (entry.markers.length <= this.minimumClusterSize) { // yes, does it have more than the minimum number of entries?\r\n entry.markers.forEach((marker) => marker.addMarker(context)); // no, just draw all of its Markers\r\n } else {\r\n // yes, get and draw the Marker for this Cluster\r\n if (undefined === entry.clusterMarker) { // have we already created this cluster marker?\r\n const clusterMarker = this.getClusterMarker(entry); // no, get it now.\r\n // set the marker's position as getClusterMarker may not set it.\r\n if (clusterMarker.rect.isNull)\r\n clusterMarker.setPosition(vp, this);\r\n entry.clusterMarker = clusterMarker;\r\n }\r\n entry.clusterMarker.addMarker(context);\r\n }\r\n } else {\r\n entry.addMarker(context); // entry is a non-overlapping Marker, draw it.\r\n }\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"Marker.js","sourceRoot":"","sources":["../../src/Marker.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAoE;AACpE,wDAA4H;AAE5H,qEAAkE;AAClE,2CAAkD;AAClD,2CAAwC;AAMxC,yCAAsC;AA0BtC,SAAS,gBAAgB,CAAC,EAAY;IACpC,IAAI,KAAK,CAAC;IACV,MAAM,MAAM,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;IACnC,MAAM,SAAS,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;IAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IACnE,MAAM,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;IACxD,MAAM,KAAK,GAAG,wBAAQ,CAAC,MAAM,EAAE,CAAC;IAChC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;QAC5B,wBAAQ,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;QAC/C,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAC/C,IAAI,SAAS,KAAK,KAAK,IAAI,UAAU,GAAG,KAAK;YAC3C,KAAK,GAAG,UAAU,CAAC;KACtB;IACD,IAAI,SAAS,KAAK,KAAK;QACrB,OAAO,GAAG,CAAC;IACb,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAC5C,OAAO,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACpC,CAAC;AAED;;;;;GAKG;AACH,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CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,8CAA8C;aACzE;SACF;IACH,CAAC;CACF;AAzID,8BAyIC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Views\r\n */\r\n\r\nimport { assert, Logger, ObservableSet } from \"@itwin/core-bentley\";\r\nimport { Geometry, Matrix4d, Point2d, Point3d, Range1d, Range1dProps, Vector3d, XAndY, XYAndZ } from \"@itwin/core-geometry\";\r\nimport { ColorDef } from \"@itwin/core-common\";\r\nimport { FrontendLoggerCategory } from \"./FrontendLoggerCategory\";\r\nimport { imageElementFromUrl } from \"./ImageUtil\";\r\nimport { IModelApp } from \"./IModelApp\";\r\nimport { ToolTipOptions } from \"./NotificationManager\";\r\nimport { CanvasDecoration } from \"./render/CanvasDecoration\";\r\nimport { BeButtonEvent } from \"./tools/Tool\";\r\nimport { DecorateContext } from \"./ViewContext\";\r\nimport { ScreenViewport, Viewport } from \"./Viewport\";\r\nimport { ViewRect } from \"./ViewRect\";\r\n\r\n/** The types that may be used for Markers\r\n * @public\r\n * @extensions\r\n */\r\nexport type MarkerImage = HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap;\r\n\r\n/**\r\n * @public\r\n * @extensions\r\n */\r\nexport type MarkerFillStyle = string | CanvasGradient | CanvasPattern;\r\n\r\n/**\r\n * @public\r\n * @extensions\r\n */\r\nexport type MarkerTextAlign = \"left\" | \"right\" | \"center\" | \"start\" | \"end\";\r\n\r\n/**\r\n * @public\r\n * @extensions\r\n */\r\nexport type MarkerTextBaseline = \"top\" | \"hanging\" | \"middle\" | \"alphabetic\" | \"ideographic\" | \"bottom\";\r\n\r\nfunction getMinScaleViewW(vp: Viewport): number {\r\n let zHigh;\r\n const origin = vp.view.getCenter();\r\n const direction = vp.view.getZVector(); direction.scaleInPlace(-1);\r\n const corners = vp.view.iModel.projectExtents.corners();\r\n const delta = Vector3d.create();\r\n for (const corner of corners) {\r\n Vector3d.createStartEnd(origin, corner, delta);\r\n const projection = delta.dotProduct(direction);\r\n if (undefined === zHigh || projection > zHigh)\r\n zHigh = projection;\r\n }\r\n if (undefined === zHigh)\r\n return 0.0;\r\n origin.plusScaled(direction, zHigh, origin);\r\n return vp.worldToView4d(origin).w;\r\n}\r\n\r\n/** A Marker is a [[CanvasDecoration]], whose position follows a fixed location in world space.\r\n * Markers draw on top of all scene graphics, and show visual cues about locations of interest.\r\n * @see [Markers]($docs/learning/frontend/Markers)\r\n * @public\r\n * @extensions\r\n */\r\nexport class Marker implements CanvasDecoration {\r\n protected _scaleFactor?: Point2d;\r\n protected _scaleFactorRange?: Range1d;\r\n\r\n /** Whether this marker is currently enabled. If false, this Marker is not displayed. */\r\n public visible = true;\r\n /** Whether this marker is currently hilited or not. */\r\n protected _isHilited = false;\r\n /** The color for the shadowBlur when this Marker is hilited */\r\n protected _hiliteColor?: ColorDef;\r\n /** The location of this Marker in world coordinates. */\r\n public worldLocation: Point3d;\r\n /** The size of this Marker, in pixels. */\r\n public size: Point2d;\r\n /** The current position for the marker, in view coordinates (pixels). This value will be updated by calls to [[setPosition]]. */\r\n public position = new Point3d();\r\n /** The current rectangle for the marker, in view coordinates (pixels). This value will be updated by calls to [[setPosition]]. */\r\n public readonly rect = new ViewRect();\r\n /** An image to draw for this Marker. If undefined, no image is shown. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage. */\r\n public image?: MarkerImage;\r\n /** The offset for [[image]], in pixels, from the *center* of this Marker. If undefined, (0,0). */\r\n public imageOffset?: XAndY;\r\n /** The size of [[image]], in pixels. If undefined, use [[size]]. */\r\n public imageSize?: XAndY;\r\n /** A text Label for this Marker. If undefined, no label is displayed. */\r\n public label?: string;\r\n /** The offset for [[label]], in pixels, from the *center* of this Marker. If undefined, (0,0). */\r\n public labelOffset?: XAndY;\r\n /** The maximum with for [[label]], in pixels. If undefined label will not be condensed or use a smaller font size. */\r\n public labelMaxWidth?: number;\r\n /** The color for [[label]]. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle. If undefined, \"white\". */\r\n public labelColor?: MarkerFillStyle;\r\n /** The text alignment for [[label]]. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/textAlign. If undefined, \"center\" */\r\n public labelAlign?: MarkerTextAlign;\r\n /** The text baseline for [[label]]. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/textBaseline. If undefined, \"middle\" */\r\n public labelBaseline?: MarkerTextBaseline;\r\n /** The font for [[label]]. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/font. */\r\n public labelFont?: string;\r\n /** The title string, or HTMLElement, to show (only) in the ToolTip when the pointer is over this Marker. See [[NotificationManager.openToolTip]] */\r\n public title?: HTMLElement | string;\r\n /** The ToolTipOptions to use for [[title]]. */\r\n public tooltipOptions?: ToolTipOptions;\r\n\r\n /** An Optional (unique) HTMLElement to display with this Marker. Generally, HTMLElements are more expensive than\r\n * images and labels, since they are added/removed from the DOM every frame. But, some types of markers are more convenient to construct\r\n * as HTMLElements, and if there aren't too many of them performance is fine.\r\n * @note HTMLElements may only appear in the DOM one time. Therefore, they *may not be shared* by more than one Marker.\r\n * You must ensure that each marker has its own HTMLElement. For this reason, you should probably only use HTMLElements in Markers if\r\n * each one is meant to be unique. For shared content, use images.\r\n */\r\n public htmlElement?: HTMLElement;\r\n\r\n /** Return true to display [[image]], if present. */\r\n public get wantImage() { return true; }\r\n\r\n /** Implement this function to draw onto the CanvasRenderingContext2D when this Marker is displayed. The [0,0] point will be the center of the Marker. */\r\n public drawFunc?(ctx: CanvasRenderingContext2D): void;\r\n\r\n /** Called when the mouse pointer enters this Marker. */\r\n public onMouseEnter(ev: BeButtonEvent) { this._isHilited = true; this._hiliteColor = ev.viewport!.hilite.color; IModelApp.accuSnap.clear(); }\r\n\r\n /** Called when the mouse pointer leaves this Marker. */\r\n public onMouseLeave() { this._isHilited = false; }\r\n\r\n /** Called when the mouse pointer moves over this Marker */\r\n public onMouseMove(ev: BeButtonEvent): void {\r\n if (this.title)\r\n ev.viewport!.openToolTip(this.title, ev.viewPoint, this.tooltipOptions);\r\n }\r\n /** Called when a mouse button is pressed over this Marker. */\r\n public onMouseButton?(_ev: BeButtonEvent): boolean;\r\n\r\n /** Determine whether the point is within this Marker. */\r\n public pick(pt: XAndY): boolean { return this.rect.containsPoint(pt); }\r\n\r\n /** Establish a range of scale factors to increases and decrease the size of this Marker based on its distance from the camera.\r\n * @param range The minimum and maximum scale factors to be applied to the size of this Marker based on its distance from the camera. `range.Low` is the scale factor\r\n * for Markers at the back of the view frustum and `range.high` is the scale factor at the front of the view frustum.\r\n * @note Marker size scaling is only applied in views with the camera enabled. It has no effect on orthographic views.\r\n */\r\n public setScaleFactor(range: Range1dProps) {\r\n this._scaleFactorRange = Range1d.fromJSON(range);\r\n this._scaleFactor = Point2d.create(1, 1);\r\n }\r\n\r\n /** Constructor for Marker\r\n * @param worldLocation The location of this Marker in world coordinates.\r\n * @param size The size of this Marker in pixels.\r\n */\r\n constructor(worldLocation: XYAndZ, size: XAndY) {\r\n this.worldLocation = Point3d.createFrom(worldLocation);\r\n this.size = Point2d.createFrom(size);\r\n }\r\n\r\n /** Make a new Marker at the same position and size as this Marker.\r\n * The new Marker will share the world location and size, but will be otherwise blank.\r\n */\r\n public static makeFrom<T extends Marker>(other: Marker, ...args: any[]): T {\r\n const out = new (this as any)(other.worldLocation, other.size, ...args) as T;\r\n out.rect.setFrom(other.rect);\r\n out.position.setFrom(other.position);\r\n if (other._scaleFactor)\r\n out._scaleFactor = Point2d.createFrom(other._scaleFactor);\r\n out._scaleFactorRange = other._scaleFactorRange;\r\n return out;\r\n }\r\n\r\n /** When a Marker is displayed in its hilited state, this method is called first. If it returns true, no further action is taken.\r\n * Otherwise the Marker's normal drawing operations are also called. By default, this method adds a shadowBlur effect and increases\r\n * the size of the Marker by 25%.\r\n * @return true to stop drawing this Marker\r\n */\r\n protected drawHilited(ctx: CanvasRenderingContext2D) {\r\n ctx.shadowBlur = 30;\r\n ctx.shadowColor = this._hiliteColor ? this._hiliteColor.toHexString() : \"white\";\r\n ctx.scale(1.25, 1.25);\r\n return false;\r\n }\r\n\r\n /** Called during frame rendering to display this Marker onto the supplied context. */\r\n public drawDecoration(ctx: CanvasRenderingContext2D): void {\r\n if (this._isHilited && this.drawHilited(ctx))\r\n return;\r\n\r\n if (this._scaleFactor !== undefined)\r\n ctx.scale(this._scaleFactor.x, this._scaleFactor.y);\r\n\r\n // first call the \"drawFunc\" if defined. This means it will be below the image and label if they overlap\r\n if (undefined !== this.drawFunc)\r\n this.drawFunc(ctx);\r\n\r\n // next draw the image, if defined and desired\r\n if (this.wantImage && this.image !== undefined) {\r\n const size = this.imageSize ? this.imageSize : this.size;\r\n const offset = new Point2d(size.x / 2, size.y / 2);\r\n if (this.imageOffset)\r\n offset.plus(this.imageOffset, offset);\r\n ctx.drawImage(this.image, -offset.x, -offset.y, size.x, size.y);\r\n }\r\n\r\n // lastly, draw the label, if defined. This puts it on top of all other graphics for this Marker.\r\n if (this.label !== undefined) {\r\n ctx.textAlign = this.labelAlign ? this.labelAlign : \"center\";\r\n ctx.textBaseline = this.labelBaseline ? this.labelBaseline : \"middle\";\r\n ctx.font = this.labelFont ? this.labelFont : \"14px sans-serif\";\r\n ctx.fillStyle = this.labelColor ? this.labelColor : \"white\";\r\n ctx.fillText(this.label, this.labelOffset ? -this.labelOffset.x : 0, this.labelOffset ? -this.labelOffset.y : 0, this.labelMaxWidth);\r\n }\r\n }\r\n\r\n /** Set the [[image]] for this marker.\r\n * @param image Either a [[MarkerImage]] or a Promise for a [[MarkerImage]]. If a Promise is supplied, the [[image]] member is set\r\n * when the Promise resolves.\r\n */\r\n public setImage(image: MarkerImage | Promise<MarkerImage>) {\r\n if (image instanceof Promise) {\r\n image.then((resolvedImage) =>\r\n this.image = resolvedImage,\r\n ).catch((err: Event) => {\r\n const target = err.target as any;\r\n const msg = `Could not load image ${target && target.src ? target.src : \"unknown\"}`;\r\n Logger.logError(`${FrontendLoggerCategory.Package}.markers`, msg);\r\n console.log(msg); // eslint-disable-line no-console\r\n });\r\n } else\r\n this.image = image;\r\n }\r\n\r\n /** Set the image for this Marker from a URL. */\r\n public setImageUrl(url: string) { this.setImage(imageElementFromUrl(url)); }\r\n\r\n /** Set the position (in pixels) for this Marker in the supplied Viewport, based on its worldLocation.\r\n * @param markerSet The MarkerSet if this Marker is included in a set.\r\n * @return true if the Marker is visible and its new position is inside the Viewport.\r\n */\r\n public setPosition(vp: Viewport, markerSet?: MarkerSet<Marker>): boolean {\r\n if (!this.visible) // if we're turned off, skip\r\n return false;\r\n\r\n const pt4 = vp.worldToView4d(this.worldLocation);\r\n if (pt4.w > 1.0 || pt4.w < 1.0e-6) // outside of frustum or too close to eye.\r\n return false;\r\n\r\n pt4.realPoint(this.position);\r\n if (!vp.viewRect.containsPoint(this.position))\r\n return false; // outside this viewport rect\r\n\r\n const origin = this.position;\r\n const sizeX = this.size.x / 2;\r\n const sizeY = this.size.y / 2;\r\n this.rect.init(origin.x - sizeX, origin.y - sizeY, origin.x + sizeX, origin.y + sizeY);\r\n\r\n // if there's a scale factor active, calculate it now.\r\n if (this._scaleFactor && this._scaleFactorRange) {\r\n let scale = 1.0;\r\n if (vp.isCameraOn) {\r\n const range = this._scaleFactorRange;\r\n const minScaleViewW = (undefined !== markerSet ? markerSet.getMinScaleViewW(vp) : getMinScaleViewW(vp));\r\n if (minScaleViewW > 0.0)\r\n scale = Geometry.clamp(range.high - (pt4.w / minScaleViewW) * range.length(), .4, 2.0);\r\n else\r\n scale = Geometry.clamp(range.low + ((1 - pt4.w) * range.length()), .4, 2.0);\r\n this.rect.scaleAboutCenter(scale, scale);\r\n }\r\n this._scaleFactor.set(scale, scale);\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /** Position the HTMLElement for this Marker relative to the Marker's position in the view.\r\n * The default implementation centers the HTMLElement (using its boundingClientRect) on the Marker.\r\n * Override this method to provide an alternative positioning approach.\r\n */\r\n protected positionHtml() {\r\n const html = this.htmlElement!;\r\n const style = html.style;\r\n style.position = \"absolute\";\r\n const size = html.getBoundingClientRect(); // Note: only call this *after* setting position = absolute\r\n const markerPos = this.position;\r\n style.left = `${markerPos.x - (size.width / 2)}px`;\r\n style.top = `${markerPos.y - (size.height / 2)}px`;\r\n }\r\n\r\n /** Add this Marker to the supplied DecorateContext. */\r\n public addMarker(context: DecorateContext) {\r\n context.addCanvasDecoration(this);\r\n if (undefined !== this.htmlElement) {\r\n // add this Marker to the DOM\r\n context.addHtmlDecoration(this.htmlElement);\r\n this.positionHtml(); // always reposition it\r\n }\r\n }\r\n\r\n /** Set the position and add this Marker to the supplied DecorateContext, if it's visible.\r\n * This method should be called from your implementation of [[Decorator.decorate]]. It will set this Marker's position based on the\r\n * Viewport from the context, and add this this Marker to the supplied DecorateContext.\r\n * @param context The DecorateContext for the Marker\r\n */\r\n public addDecoration(context: DecorateContext) {\r\n if (this.setPosition(context.viewport))\r\n this.addMarker(context);\r\n }\r\n}\r\n\r\n/** A cluster of one or more Markers that overlap one another in the view. The cluster's screen position is taken from its first entry.\r\n * Clusters also have a Marker themselves, that represents the whole group. The cluster marker isn't created until all entries have been added.\r\n * @public\r\n * @extensions\r\n */\r\nexport class Cluster<T extends Marker> {\r\n public readonly markers: T[];\r\n public clusterMarker?: Marker;\r\n\r\n public constructor(markers: T[]) {\r\n assert(markers.length > 0);\r\n this.markers = markers;\r\n }\r\n\r\n public get position() {\r\n return this.markers[0].position;\r\n }\r\n\r\n /**\r\n * Gets the location for the cluster\r\n * @returns The average of the cluster markers worldLocation.\r\n */\r\n public getClusterLocation() {\r\n const location = Point3d.createZero();\r\n if (this.markers.length > 0) {\r\n this.markers.forEach((marker) => location.addInPlace(marker.worldLocation));\r\n location.scaleInPlace(1 / this.markers.length);\r\n }\r\n return location;\r\n }\r\n}\r\n\r\n/** A *set* of Markers that are logically related, such that they *cluster* when they overlap one another in screen space.\r\n * In that case, a *cluster marker* is drawn instead of the overlapping Markers.\r\n * @public\r\n * @extensions\r\n */\r\nexport abstract class MarkerSet<T extends Marker> {\r\n private _viewport?: ScreenViewport;\r\n\r\n /** @internal */\r\n protected _entries: Array<T | Cluster<T>> = []; // this is an array that holds either Markers or a cluster of markers.\r\n /** @internal */\r\n protected readonly _worldToViewMap = Matrix4d.createZero();\r\n /** @internal */\r\n protected _minScaleViewW?: number;\r\n private readonly _markers = new ObservableSet<T>();\r\n\r\n /** The minimum number of Markers that must overlap before they are clustered. Otherwise they are each drawn individually. Default is 1 (always create a cluster.) */\r\n public minimumClusterSize = 1;\r\n /** The set of Markers in this MarkerSet. Add your [[Marker]]s into this. */\r\n public get markers(): Set<T> { return this._markers; }\r\n /** The radius (in pixels) representing the distance between the screen X,Y positions of two Markers to be clustered. When less than or equal to 0 (the default), the radius is calculated based on the first visible marker imageSize/size. */\r\n protected clusterRadius = 0;\r\n\r\n /** Construct a new MarkerSet for a specific ScreenViewport.\r\n * @param viewport the ScreenViewport for this MarkerSet. If undefined, use [[IModelApp.viewManager.selectedView]]\r\n */\r\n public constructor(viewport?: ScreenViewport) {\r\n this._viewport = undefined === viewport ? IModelApp.viewManager.selectedView : viewport;\r\n const markDirty = () => this.markDirty();\r\n this._markers.onAdded.addListener(markDirty);\r\n this._markers.onDeleted.addListener(markDirty);\r\n this._markers.onCleared.addListener(markDirty);\r\n }\r\n\r\n /** The ScreenViewport of this MarkerSet. */\r\n public get viewport(): ScreenViewport | undefined { return this._viewport; }\r\n\r\n /** Change the ScreenViewport for this MarkerSet.\r\n * After this call, the markers from this MarkerSet will only appear in the supplied ScreenViewport.\r\n * @beta\r\n */\r\n public changeViewport(viewport: ScreenViewport) {\r\n this._viewport = viewport;\r\n this.markDirty();\r\n }\r\n\r\n /** Indicate that this MarkerSet has been changed and is now *dirty*.\r\n * This is necessary because [[addDecoration]] does not recreate the set of decoration graphics\r\n * if it can detect that the previously-created set remains valid.\r\n * The set becomes invalid when the view frustum changes, or the contents of [[markers]] changes.\r\n * If some other criterion affecting the graphics changes, invoke this method. This should not be necessary for most use cases.\r\n * @public\r\n */\r\n public markDirty(): void {\r\n this._worldToViewMap.setZero();\r\n }\r\n\r\n /** Implement this method to create a new Marker that is shown as a *stand-in* for a Cluster of Markers that overlap one another.\r\n * @param cluster The [[Cluster]] that the new Marker will represent.\r\n * @returns The Marker that will be displayed to represent the Cluster.\r\n * @note You must create a new Marker each time this method is called.\r\n */\r\n protected abstract getClusterMarker(cluster: Cluster<T>): Marker;\r\n\r\n /** Get weight value limit establishing the distance from camera for the back of view scale factor. */\r\n public getMinScaleViewW(vp: Viewport): number {\r\n if (undefined === this._minScaleViewW)\r\n this._minScaleViewW = getMinScaleViewW(vp);\r\n return this._minScaleViewW;\r\n }\r\n\r\n /** This method should be called from [[Decorator.decorate]]. It will add this this MarkerSet to the supplied DecorateContext.\r\n * This method implements the logic that turns overlapping Markers into a Cluster.\r\n * @param context The DecorateContext for the Markers\r\n */\r\n public addDecoration(context: DecorateContext): void {\r\n const vp = context.viewport;\r\n if (vp !== this._viewport)\r\n return; // not viewport of this MarkerSet, ignore it\r\n\r\n const entries = this._entries;\r\n\r\n // Don't recreate the entries array if the view hasn't changed. This is important for performance, but also necessary for hilite of\r\n // clusters (otherwise they're recreated continually and never hilited.) */\r\n if (!this._worldToViewMap.isAlmostEqual(vp.worldToViewMap.transform0)) {\r\n this._worldToViewMap.setFrom(vp.worldToViewMap.transform0);\r\n this._minScaleViewW = undefined; // Invalidate current value.\r\n entries.length = 0; // start over.\r\n\r\n let distSquared = this.clusterRadius * this.clusterRadius;\r\n\r\n // loop through all of the Markers in the MarkerSet.\r\n for (const marker of this.markers) {\r\n // establish the screen position for this marker. If it's not in view, setPosition returns false\r\n if (!marker.setPosition(vp, this))\r\n continue;\r\n\r\n if (distSquared <= 0) {\r\n const size = marker.imageSize ? marker.imageSize : marker.size;\r\n const dist = Math.max(size.x, size.y) * 1.5;\r\n distSquared = dist * dist;\r\n }\r\n\r\n let added = false;\r\n for (let i = 0; i < entries.length; ++i) { // loop through all of the currently visible markers/clusters\r\n const entry = entries[i];\r\n if (marker.position.distanceSquaredXY(entry.position) <= distSquared) {\r\n added = true; // yes, we're going to save it as a Cluster\r\n if (entry instanceof Cluster) { // is the entry already a Cluster?\r\n entry.markers.push(marker); // yes, just add this to the existing cluster\r\n } else {\r\n entries[i] = new Cluster([entry, marker]); // no, make a new Cluster holding both\r\n }\r\n break; // this Marker has been handled, we can stop looking for overlaps\r\n }\r\n }\r\n if (!added)\r\n entries.push(marker); // there was no overlap, save this Marker to be drawn\r\n }\r\n }\r\n\r\n // we now have an array of Markers and Clusters, add them to context\r\n for (const entry of entries) {\r\n if (entry instanceof Cluster) { // is this entry a Cluster?\r\n if (entry.markers.length <= this.minimumClusterSize) { // yes, does it have more than the minimum number of entries?\r\n entry.markers.forEach((marker) => marker.addMarker(context)); // no, just draw all of its Markers\r\n } else {\r\n // yes, get and draw the Marker for this Cluster\r\n if (undefined === entry.clusterMarker) { // have we already created this cluster marker?\r\n const clusterMarker = this.getClusterMarker(entry); // no, get it now.\r\n // set the marker's position as getClusterMarker may not set it.\r\n if (clusterMarker.rect.isNull)\r\n clusterMarker.setPosition(vp, this);\r\n entry.clusterMarker = clusterMarker;\r\n }\r\n entry.clusterMarker.addMarker(context);\r\n }\r\n } else {\r\n entry.addMarker(context); // entry is a non-overlapping Marker, draw it.\r\n }\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -8,6 +8,7 @@ import { IModelConnection } from "./IModelConnection";
|
|
|
8
8
|
/** The state of a [ModelSelector]($backend). It holds a set of ids of GeometricModels for a [[SpatialViewState]].
|
|
9
9
|
* It defines the set of [[ModelState]]s drawn within the view as a set of IDs.
|
|
10
10
|
* @public
|
|
11
|
+
* @extensions
|
|
11
12
|
*/
|
|
12
13
|
export declare class ModelSelectorState extends ElementState {
|
|
13
14
|
/** @internal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelSelectorState.d.ts","sourceRoot":"","sources":["../../src/ModelSelectorState.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAQ,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD
|
|
1
|
+
{"version":3,"file":"ModelSelectorState.d.ts","sourceRoot":"","sources":["../../src/ModelSelectorState.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAQ,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;;GAIG;AACH,qBAAa,kBAAmB,SAAQ,YAAY;IAClD,gBAAgB;IAChB,WAA2B,SAAS,WAA8B;IAElE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA+B;IAEvD,qDAAqD;IACrD,IAAW,MAAM,IAAI,GAAG,CAAC,MAAM,CAAC,CAE/B;IAED,IAAW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,EAIpC;IAED,gBAAgB;IAChB,IAAW,gBAAgB,IAAI,aAAa,CAAC,MAAM,CAAC,CAEnD;gBAEW,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,gBAAgB;IAM/D,qCAAqC;IACrC,IAAW,IAAI,IAAI,MAAM,CAA4B;IAErC,MAAM,IAAI,kBAAkB;IAO5C;;;;;OAKG;IACI,UAAU,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO;IAWrD,wDAAwD;IACjD,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI;IAKpC,2DAA2D;IACpD,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI;IAKrC,qFAAqF;IAC9E,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAE/B,+EAA+E;IACxE,aAAa,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO;IAElD,6EAA6E;IAChE,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAGnC"}
|
|
@@ -13,6 +13,7 @@ const EntityState_1 = require("./EntityState");
|
|
|
13
13
|
/** The state of a [ModelSelector]($backend). It holds a set of ids of GeometricModels for a [[SpatialViewState]].
|
|
14
14
|
* It defines the set of [[ModelState]]s drawn within the view as a set of IDs.
|
|
15
15
|
* @public
|
|
16
|
+
* @extensions
|
|
16
17
|
*/
|
|
17
18
|
class ModelSelectorState extends EntityState_1.ElementState {
|
|
18
19
|
constructor(props, iModel) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelSelectorState.js","sourceRoot":"","sources":["../../src/ModelSelectorState.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA+E;AAE/E,+CAA6C;AAG7C
|
|
1
|
+
{"version":3,"file":"ModelSelectorState.js","sourceRoot":"","sources":["../../src/ModelSelectorState.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA+E;AAE/E,+CAA6C;AAG7C;;;;GAIG;AACH,MAAa,kBAAmB,SAAQ,0BAAY;IAsBlD,YAAY,KAAyB,EAAE,MAAwB;QAC7D,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAnBN,YAAO,GAAG,IAAI,4BAAa,EAAU,CAAC;QAoBrD,IAAI,KAAK,CAAC,MAAM;YACd,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,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G,CAAC,KAAK,CAAC;gBAC1B,OAAO,KAAK,CAAC;QAEjB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,wDAAwD;IACjD,SAAS,CAAC,GAAY;QAC3B,KAAK,MAAM,EAAE,IAAI,mBAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;YACjC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACxB,CAAC;IAED,2DAA2D;IACpD,UAAU,CAAC,GAAY;QAC5B,KAAK,MAAM,EAAE,IAAI,mBAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;YACjC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC3B,CAAC;IAED,qFAAqF;IAC9E,GAAG,CAAC,EAAU,IAAa,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAE/D,+EAA+E;IACxE,aAAa,CAAC,OAAmB,IAAa,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;IAE3F,6EAA6E;IACtE,KAAK,CAAC,IAAI;QACf,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;CACF;AA7ED,gDA6EC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Views\r\n */\r\n\r\nimport { Id64, Id64Arg, Id64String, ObservableSet } from \"@itwin/core-bentley\";\r\nimport { ModelSelectorProps } from \"@itwin/core-common\";\r\nimport { ElementState } from \"./EntityState\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\n\r\n/** The state of a [ModelSelector]($backend). It holds a set of ids of GeometricModels for a [[SpatialViewState]].\r\n * It defines the set of [[ModelState]]s drawn within the view as a set of IDs.\r\n * @public\r\n * @extensions\r\n */\r\nexport class ModelSelectorState extends ElementState {\r\n /** @internal */\r\n public static override get className() { return \"ModelSelector\"; }\r\n\r\n private readonly _models = new ObservableSet<string>();\r\n\r\n /** The set of ModelIds of this ModelSelectorState */\r\n public get models(): Set<string> {\r\n return this._models;\r\n }\r\n\r\n public set models(models: Set<string>) {\r\n this.models.clear();\r\n for (const model of models)\r\n this.models.add(model);\r\n }\r\n\r\n /** @internal */\r\n public get observableModels(): ObservableSet<string> {\r\n return this._models;\r\n }\r\n\r\n constructor(props: ModelSelectorProps, iModel: IModelConnection) {\r\n super(props, iModel);\r\n if (props.models)\r\n props.models.forEach((model) => this.models.add(model));\r\n }\r\n\r\n /** The name of this ModelSelector */\r\n public get name(): string { return this.code.value; }\r\n\r\n public override toJSON(): ModelSelectorProps {\r\n const val: any = super.toJSON();\r\n val.models = [];\r\n this.models.forEach((model) => val.models.push(model));\r\n return val;\r\n }\r\n\r\n /** Determine if this model selector is logically equivalent to the specified model selector. Two model selectors are logically equivalent is\r\n * they have the same name and Id and contain the same set of models.\r\n * @param other The model selector to which to compare.\r\n * @returns true if the model selectors are logically equivalent.\r\n * @public\r\n */\r\n public equalState(other: ModelSelectorState): boolean {\r\n if (this.models.size !== other.models.size || this.id !== other.id || this.name !== other.name)\r\n return false;\r\n\r\n for (const model of this.models)\r\n if (!other.models.has(model))\r\n return false;\r\n\r\n return true;\r\n }\r\n\r\n /** Add one or more models to this ModelSelectorState */\r\n public addModels(arg: Id64Arg): void {\r\n for (const id of Id64.iterable(arg))\r\n this.models.add(id);\r\n }\r\n\r\n /** Drop one or more models from this ModelSelectorState */\r\n public dropModels(arg: Id64Arg): void {\r\n for (const id of Id64.iterable(arg))\r\n this.models.delete(id);\r\n }\r\n\r\n /** Determine whether this ModelSelectorState includes the specified modelId value */\r\n public has(id: string): boolean { return this.models.has(id); }\r\n\r\n /** Determine whether this ModelSelectorState includes the specified modelId */\r\n public containsModel(modelId: Id64String): boolean { return this.has(modelId.toString()); }\r\n\r\n /** Make sure all models referenced by this ModelSelectorState are loaded. */\r\n public async load(): Promise<void> {\r\n return this.iModel.models.load(this.models);\r\n }\r\n}\r\n"]}
|