@itwin/core-frontend 3.0.0-dev.180 → 3.0.0-dev.184
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 +89 -1
- package/lib/cjs/ApproximateTerrainHeights.d.ts.map +1 -1
- package/lib/cjs/ApproximateTerrainHeights.js +6 -2
- package/lib/cjs/ApproximateTerrainHeights.js.map +1 -1
- package/lib/cjs/BackgroundMapGeometry.d.ts +1 -1
- package/lib/cjs/BackgroundMapGeometry.d.ts.map +1 -1
- package/lib/cjs/BackgroundMapGeometry.js +2 -2
- package/lib/cjs/BackgroundMapGeometry.js.map +1 -1
- package/lib/cjs/BingLocation.js +2 -2
- package/lib/cjs/BingLocation.js.map +1 -1
- package/lib/cjs/DisplayStyleState.d.ts +9 -3
- package/lib/cjs/DisplayStyleState.d.ts.map +1 -1
- package/lib/cjs/DisplayStyleState.js +66 -41
- package/lib/cjs/DisplayStyleState.js.map +1 -1
- package/lib/cjs/FrontendLoggerCategory.d.ts +2 -8
- package/lib/cjs/FrontendLoggerCategory.d.ts.map +1 -1
- package/lib/cjs/FrontendLoggerCategory.js +2 -8
- package/lib/cjs/FrontendLoggerCategory.js.map +1 -1
- package/lib/cjs/NativeApp.d.ts +1 -1
- package/lib/cjs/NativeApp.d.ts.map +1 -1
- package/lib/cjs/NativeApp.js +3 -3
- package/lib/cjs/NativeApp.js.map +1 -1
- package/lib/cjs/NotificationManager.d.ts +3 -1
- package/lib/cjs/NotificationManager.d.ts.map +1 -1
- package/lib/cjs/NotificationManager.js +2 -0
- package/lib/cjs/NotificationManager.js.map +1 -1
- package/lib/cjs/RealityDataSource.js +11 -6
- package/lib/cjs/RealityDataSource.js.map +1 -1
- package/lib/cjs/ViewContext.js.map +1 -1
- package/lib/cjs/ViewCreator2d.js +1 -1
- package/lib/cjs/ViewCreator2d.js.map +1 -1
- package/lib/cjs/ViewCreator3d.d.ts +1 -1
- package/lib/cjs/ViewCreator3d.d.ts.map +1 -1
- package/lib/cjs/ViewCreator3d.js +2 -2
- package/lib/cjs/ViewCreator3d.js.map +1 -1
- package/lib/cjs/ViewingSpace.js +1 -1
- package/lib/cjs/ViewingSpace.js.map +1 -1
- package/lib/cjs/core-frontend.d.ts +4 -0
- package/lib/cjs/core-frontend.d.ts.map +1 -1
- package/lib/cjs/core-frontend.js +4 -0
- package/lib/cjs/core-frontend.js.map +1 -1
- package/lib/cjs/render/GraphicBuilder.d.ts +6 -0
- package/lib/cjs/render/GraphicBuilder.d.ts.map +1 -1
- package/lib/cjs/render/GraphicBuilder.js.map +1 -1
- package/lib/cjs/render/primitives/geometry/GeometryAccumulator.d.ts +2 -0
- package/lib/cjs/render/primitives/geometry/GeometryAccumulator.d.ts.map +1 -1
- package/lib/cjs/render/primitives/geometry/GeometryAccumulator.js +2 -1
- package/lib/cjs/render/primitives/geometry/GeometryAccumulator.js.map +1 -1
- package/lib/cjs/render/primitives/geometry/GeometryListBuilder.d.ts.map +1 -1
- package/lib/cjs/render/primitives/geometry/GeometryListBuilder.js +1 -0
- package/lib/cjs/render/primitives/geometry/GeometryListBuilder.js.map +1 -1
- package/lib/cjs/render/primitives/mesh/MeshPrimitives.d.ts +2 -2
- package/lib/cjs/render/primitives/mesh/MeshPrimitives.d.ts.map +1 -1
- package/lib/cjs/render/primitives/mesh/MeshPrimitives.js +3 -3
- package/lib/cjs/render/primitives/mesh/MeshPrimitives.js.map +1 -1
- package/lib/cjs/render/webgl/BranchUniforms.d.ts.map +1 -1
- package/lib/cjs/render/webgl/BranchUniforms.js +8 -5
- package/lib/cjs/render/webgl/BranchUniforms.js.map +1 -1
- package/lib/cjs/render/webgl/SolarShadowMap.js +1 -1
- package/lib/cjs/render/webgl/SolarShadowMap.js.map +1 -1
- package/lib/cjs/render/webgl/System.d.ts +1 -1
- package/lib/cjs/request/Request.d.ts +167 -0
- package/lib/cjs/request/Request.d.ts.map +1 -0
- package/lib/cjs/request/Request.js +315 -0
- package/lib/cjs/request/Request.js.map +1 -0
- package/lib/cjs/tile/internal.d.ts +1 -0
- package/lib/cjs/tile/internal.d.ts.map +1 -1
- package/lib/cjs/tile/internal.js +1 -0
- package/lib/cjs/tile/internal.js.map +1 -1
- package/lib/cjs/tile/map/ArcGISTileMap.d.ts.map +1 -1
- package/lib/cjs/tile/map/ArcGISTileMap.js +6 -2
- package/lib/cjs/tile/map/ArcGISTileMap.js.map +1 -1
- package/lib/cjs/tile/map/ArcGisTokenGenerator.js +3 -3
- package/lib/cjs/tile/map/ArcGisTokenGenerator.js.map +1 -1
- package/lib/cjs/tile/map/ArcGisUtilities.d.ts +1 -1
- package/lib/cjs/tile/map/ArcGisUtilities.d.ts.map +1 -1
- package/lib/cjs/tile/map/ArcGisUtilities.js +18 -10
- package/lib/cjs/tile/map/ArcGisUtilities.js.map +1 -1
- package/lib/cjs/tile/map/BingElevation.js +4 -4
- package/lib/cjs/tile/map/BingElevation.js.map +1 -1
- package/lib/cjs/tile/map/CesiumTerrainProvider.js +3 -3
- package/lib/cjs/tile/map/CesiumTerrainProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +4 -4
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/BingImageryProvider.js +2 -2
- package/lib/cjs/tile/map/ImageryProviders/BingImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerAuthentication.d.ts +20 -0
- package/lib/cjs/tile/map/MapLayerAuthentication.d.ts.map +1 -0
- package/lib/cjs/tile/map/MapLayerAuthentication.js +18 -0
- package/lib/cjs/tile/map/MapLayerAuthentication.js.map +1 -0
- package/lib/cjs/tile/map/MapLayerFormatRegistry.d.ts +6 -3
- package/lib/cjs/tile/map/MapLayerFormatRegistry.d.ts.map +1 -1
- package/lib/cjs/tile/map/MapLayerFormatRegistry.js +3 -1
- package/lib/cjs/tile/map/MapLayerFormatRegistry.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerImageryFormats.d.ts +2 -2
- package/lib/cjs/tile/map/MapLayerImageryFormats.d.ts.map +1 -1
- package/lib/cjs/tile/map/MapLayerImageryFormats.js +4 -2
- package/lib/cjs/tile/map/MapLayerImageryFormats.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerImageryProvider.d.ts +2 -2
- package/lib/cjs/tile/map/MapLayerImageryProvider.js +5 -5
- package/lib/cjs/tile/map/MapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerSources.d.ts +3 -1
- package/lib/cjs/tile/map/MapLayerSources.d.ts.map +1 -1
- package/lib/cjs/tile/map/MapLayerSources.js +5 -3
- package/lib/cjs/tile/map/MapLayerSources.js.map +1 -1
- package/lib/cjs/tile/map/MapTileLoader.js +2 -2
- package/lib/cjs/tile/map/MapTileLoader.js.map +1 -1
- package/lib/cjs/tile/map/TerrainMeshProvider.d.ts +1 -1
- package/lib/cjs/tile/map/TerrainMeshProvider.js.map +1 -1
- package/lib/cjs/tile/map/WmsCapabilities.d.ts +1 -1
- package/lib/cjs/tile/map/WmsCapabilities.js +2 -2
- package/lib/cjs/tile/map/WmsCapabilities.js.map +1 -1
- package/lib/cjs/tile/map/WmtsCapabilities.d.ts +1 -1
- package/lib/cjs/tile/map/WmtsCapabilities.js +2 -2
- package/lib/cjs/tile/map/WmtsCapabilities.js.map +1 -1
- package/lib/esm/ApproximateTerrainHeights.d.ts.map +1 -1
- package/lib/esm/ApproximateTerrainHeights.js +6 -2
- package/lib/esm/ApproximateTerrainHeights.js.map +1 -1
- package/lib/esm/BackgroundMapGeometry.d.ts +1 -1
- package/lib/esm/BackgroundMapGeometry.d.ts.map +1 -1
- package/lib/esm/BackgroundMapGeometry.js +2 -2
- package/lib/esm/BackgroundMapGeometry.js.map +1 -1
- package/lib/esm/BingLocation.js +1 -1
- package/lib/esm/BingLocation.js.map +1 -1
- package/lib/esm/DisplayStyleState.d.ts +9 -3
- package/lib/esm/DisplayStyleState.d.ts.map +1 -1
- package/lib/esm/DisplayStyleState.js +66 -41
- package/lib/esm/DisplayStyleState.js.map +1 -1
- package/lib/esm/FrontendLoggerCategory.d.ts +2 -8
- package/lib/esm/FrontendLoggerCategory.d.ts.map +1 -1
- package/lib/esm/FrontendLoggerCategory.js +2 -8
- package/lib/esm/FrontendLoggerCategory.js.map +1 -1
- package/lib/esm/NativeApp.d.ts +1 -1
- package/lib/esm/NativeApp.d.ts.map +1 -1
- package/lib/esm/NativeApp.js +1 -1
- package/lib/esm/NativeApp.js.map +1 -1
- package/lib/esm/NotificationManager.d.ts +3 -1
- package/lib/esm/NotificationManager.d.ts.map +1 -1
- package/lib/esm/NotificationManager.js +2 -0
- package/lib/esm/NotificationManager.js.map +1 -1
- package/lib/esm/RealityDataSource.js +9 -4
- package/lib/esm/RealityDataSource.js.map +1 -1
- package/lib/esm/ViewContext.js.map +1 -1
- package/lib/esm/ViewCreator2d.js +1 -1
- package/lib/esm/ViewCreator2d.js.map +1 -1
- package/lib/esm/ViewCreator3d.d.ts +1 -1
- package/lib/esm/ViewCreator3d.d.ts.map +1 -1
- package/lib/esm/ViewCreator3d.js +2 -2
- package/lib/esm/ViewCreator3d.js.map +1 -1
- package/lib/esm/ViewingSpace.js +1 -1
- package/lib/esm/ViewingSpace.js.map +1 -1
- package/lib/esm/core-frontend.d.ts +4 -0
- package/lib/esm/core-frontend.d.ts.map +1 -1
- package/lib/esm/core-frontend.js +4 -0
- package/lib/esm/core-frontend.js.map +1 -1
- package/lib/esm/render/GraphicBuilder.d.ts +6 -0
- package/lib/esm/render/GraphicBuilder.d.ts.map +1 -1
- package/lib/esm/render/GraphicBuilder.js.map +1 -1
- package/lib/esm/render/primitives/geometry/GeometryAccumulator.d.ts +2 -0
- package/lib/esm/render/primitives/geometry/GeometryAccumulator.d.ts.map +1 -1
- package/lib/esm/render/primitives/geometry/GeometryAccumulator.js +2 -1
- package/lib/esm/render/primitives/geometry/GeometryAccumulator.js.map +1 -1
- package/lib/esm/render/primitives/geometry/GeometryListBuilder.d.ts.map +1 -1
- package/lib/esm/render/primitives/geometry/GeometryListBuilder.js +1 -0
- package/lib/esm/render/primitives/geometry/GeometryListBuilder.js.map +1 -1
- package/lib/esm/render/primitives/mesh/MeshPrimitives.d.ts +2 -2
- package/lib/esm/render/primitives/mesh/MeshPrimitives.d.ts.map +1 -1
- package/lib/esm/render/primitives/mesh/MeshPrimitives.js +3 -3
- package/lib/esm/render/primitives/mesh/MeshPrimitives.js.map +1 -1
- package/lib/esm/render/webgl/BranchUniforms.d.ts.map +1 -1
- package/lib/esm/render/webgl/BranchUniforms.js +8 -5
- package/lib/esm/render/webgl/BranchUniforms.js.map +1 -1
- package/lib/esm/render/webgl/SolarShadowMap.js +1 -1
- package/lib/esm/render/webgl/SolarShadowMap.js.map +1 -1
- package/lib/esm/render/webgl/System.d.ts +1 -1
- package/lib/esm/request/Request.d.ts +167 -0
- package/lib/esm/request/Request.d.ts.map +1 -0
- package/lib/esm/request/Request.js +289 -0
- package/lib/esm/request/Request.js.map +1 -0
- package/lib/esm/tile/internal.d.ts +1 -0
- package/lib/esm/tile/internal.d.ts.map +1 -1
- package/lib/esm/tile/internal.js +1 -0
- package/lib/esm/tile/internal.js.map +1 -1
- package/lib/esm/tile/map/ArcGISTileMap.d.ts.map +1 -1
- package/lib/esm/tile/map/ArcGISTileMap.js +6 -2
- package/lib/esm/tile/map/ArcGISTileMap.js.map +1 -1
- package/lib/esm/tile/map/ArcGisTokenGenerator.js +1 -1
- package/lib/esm/tile/map/ArcGisTokenGenerator.js.map +1 -1
- package/lib/esm/tile/map/ArcGisUtilities.d.ts +1 -1
- package/lib/esm/tile/map/ArcGisUtilities.d.ts.map +1 -1
- package/lib/esm/tile/map/ArcGisUtilities.js +14 -6
- package/lib/esm/tile/map/ArcGisUtilities.js.map +1 -1
- package/lib/esm/tile/map/BingElevation.js +1 -1
- package/lib/esm/tile/map/BingElevation.js.map +1 -1
- package/lib/esm/tile/map/CesiumTerrainProvider.js +1 -1
- package/lib/esm/tile/map/CesiumTerrainProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/BingImageryProvider.js +1 -1
- package/lib/esm/tile/map/ImageryProviders/BingImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/MapLayerAuthentication.d.ts +20 -0
- package/lib/esm/tile/map/MapLayerAuthentication.d.ts.map +1 -0
- package/lib/esm/tile/map/MapLayerAuthentication.js +15 -0
- package/lib/esm/tile/map/MapLayerAuthentication.js.map +1 -0
- package/lib/esm/tile/map/MapLayerFormatRegistry.d.ts +6 -3
- package/lib/esm/tile/map/MapLayerFormatRegistry.d.ts.map +1 -1
- package/lib/esm/tile/map/MapLayerFormatRegistry.js +3 -1
- package/lib/esm/tile/map/MapLayerFormatRegistry.js.map +1 -1
- package/lib/esm/tile/map/MapLayerImageryFormats.d.ts +2 -2
- package/lib/esm/tile/map/MapLayerImageryFormats.d.ts.map +1 -1
- package/lib/esm/tile/map/MapLayerImageryFormats.js +5 -3
- package/lib/esm/tile/map/MapLayerImageryFormats.js.map +1 -1
- package/lib/esm/tile/map/MapLayerImageryProvider.d.ts +2 -2
- package/lib/esm/tile/map/MapLayerImageryProvider.js +2 -2
- package/lib/esm/tile/map/MapLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/MapLayerSources.d.ts +3 -1
- package/lib/esm/tile/map/MapLayerSources.d.ts.map +1 -1
- package/lib/esm/tile/map/MapLayerSources.js +4 -2
- package/lib/esm/tile/map/MapLayerSources.js.map +1 -1
- package/lib/esm/tile/map/MapTileLoader.js +1 -1
- package/lib/esm/tile/map/MapTileLoader.js.map +1 -1
- package/lib/esm/tile/map/TerrainMeshProvider.d.ts +1 -1
- package/lib/esm/tile/map/TerrainMeshProvider.js.map +1 -1
- package/lib/esm/tile/map/WmsCapabilities.d.ts +1 -1
- package/lib/esm/tile/map/WmsCapabilities.js +1 -1
- package/lib/esm/tile/map/WmsCapabilities.js.map +1 -1
- package/lib/esm/tile/map/WmtsCapabilities.d.ts +1 -1
- package/lib/esm/tile/map/WmtsCapabilities.js +1 -1
- package/lib/esm/tile/map/WmtsCapabilities.js.map +1 -1
- package/package.json +28 -22
package/lib/cjs/NativeApp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeApp.js","sourceRoot":"","sources":["../../src/NativeApp.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;AAEH,sDAAqG;AACrG,oDAI4B;AAC5B,wDAA+E;AAC/E,qEAAkE;AAClE,qCAAsE;AACtE,uDAAoD;AAqBpD,2CAA2C;AAC3C,MAAM,sBAAuB,SAAQ,4BAAmB;IACtD,IAAW,WAAW,KAAK,OAAO,6BAAe,CAAC,CAAC,CAAC;IAC7C,iCAAiC,CAAC,MAAkC;QACzE,qBAAM,CAAC,OAAO,CAAC,+CAAsB,CAAC,SAAS,EAAE,+BAA+B,CAAC,CAAC;QAClF,SAAS,CAAC,6BAA6B,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAC7D,CAAC;CACF;AAUD;;;;GAIG;AACH,MAAa,SAAS;IACb,MAAM,CAAC,KAAK,CAAC,cAAc,CAA+C,UAAa,EAAE,GAAG,IAAuC;QACxI,OAAO,eAAM,CAAC,cAAc,CAAC,8BAAgB,EAAE,UAAU,EAAE,GAAG,IAAI,CAA6C,CAAC;IAClH,CAAC;IASO,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,EAAgB,EAAE,MAAkC;QACvF,mCAAoB,CAAC,MAAM,GAAG,CAAC,MAAM,KAAK,wCAA0B,CAAC,MAAM,CAAC,CAAC;QAC7E,MAAM,IAAI,CAAC,cAAc,CAAC,8BAA8B,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;IACxE,CAAC;IACO,MAAM,CAAC,6BAA6B;QAC1C,IAAI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F;AAnCD,0BAmCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module NativeApp\r\n */\r\n\r\nimport { AsyncMethodsOf, BeEvent, GuidString, Logger, PromiseReturnType } from \"@itwin/core-bentley\";\r\nimport {\r\n BriefcaseDownloader, BriefcaseProps, IModelVersion, InternetConnectivityStatus, IpcSocketFrontend, LocalBriefcaseProps,\r\n nativeAppChannel, NativeAppFunctions, NativeAppNotifications, nativeAppNotify, OverriddenBy,\r\n RequestNewBriefcaseProps, StorageValue, SyncMode,\r\n} from \"@itwin/core-common\";\r\nimport { ProgressCallback, RequestGlobalOptions } from \"@bentley/itwin-client\";\r\nimport { FrontendLoggerCategory } from \"./FrontendLoggerCategory\";\r\nimport { IpcApp, IpcAppOptions, NotificationHandler } from \"./IpcApp\";\r\nimport { NativeAppLogger } from \"./NativeAppLogger\";\r\n\r\n/** Properties for specifying the BriefcaseId for downloading. May either specify a BriefcaseId directly (preferable) or, for\r\n * backwards compatibility, a [SyncMode]($common). If [SyncMode.PullAndPush]($common) is supplied, a new briefcaseId will be acquired.\r\n * @public\r\n */\r\nexport type DownloadBriefcaseId =\r\n { syncMode?: SyncMode, briefcaseId?: never } |\r\n { briefcaseId: number, syncMode?: never };\r\n\r\n/**\r\n* Options to download a briefcase\r\n* @public\r\n*/\r\nexport type DownloadBriefcaseOptions = DownloadBriefcaseId & {\r\n /** the full path for the briefcase file */\r\n fileName?: string;\r\n /** interval for calling progress function, in milliseconds */\r\n progressInterval?: number;\r\n};\r\n\r\n/** NativeApp notifications from backend */\r\nclass NativeAppNotifyHandler extends NotificationHandler implements NativeAppNotifications {\r\n public get channelName() { return nativeAppNotify; }\r\n public notifyInternetConnectivityChanged(status: InternetConnectivityStatus) {\r\n Logger.logInfo(FrontendLoggerCategory.NativeApp, \"Internet connectivity changed\");\r\n NativeApp.onInternetConnectivityChanged.raiseEvent(status);\r\n }\r\n}\r\n\r\n/**\r\n * Options for [[NativeApp.startup]]\r\n * @public\r\n */\r\nexport interface NativeAppOpts extends IpcAppOptions {\r\n nativeApp?: {};\r\n}\r\n\r\n/**\r\n * The frontend of a native application\r\n * @see [Native Applications]($docs/learning/NativeApps.md)\r\n * @public\r\n */\r\nexport class NativeApp {\r\n public static async callNativeHost<T extends AsyncMethodsOf<NativeAppFunctions>>(methodName: T, ...args: Parameters<NativeAppFunctions[T]>) {\r\n return IpcApp.callIpcChannel(nativeAppChannel, methodName, ...args) as PromiseReturnType<NativeAppFunctions[T]>;\r\n }\r\n\r\n private static _storages = new Map<string, Storage>();\r\n private static _onOnline = async () => {\r\n await NativeApp.setConnectivity(OverriddenBy.Browser, InternetConnectivityStatus.Online);\r\n };\r\n private static _onOffline = async () => {\r\n await NativeApp.setConnectivity(OverriddenBy.Browser, InternetConnectivityStatus.Offline);\r\n };\r\n private static async setConnectivity(by: OverriddenBy, status: InternetConnectivityStatus) {\r\n RequestGlobalOptions.online = (status === InternetConnectivityStatus.Online);\r\n await this.callNativeHost(\"overrideInternetConnectivity\", by, status);\r\n }\r\n private static hookBrowserConnectivityEvents() {\r\n if (typeof window === \"object\" && window.ononline && window.onoffline) {\r\n window.addEventListener(\"online\", this._onOnline);\r\n window.addEventListener(\"offline\", this._onOffline);\r\n }\r\n }\r\n private static unhookBrowserConnectivityEvents() {\r\n if (typeof window === \"object\" && window.ononline && window.onoffline) {\r\n window.removeEventListener(\"online\", this._onOnline);\r\n window.removeEventListener(\"offline\", this._onOffline);\r\n }\r\n }\r\n /** event called when internet connectivity changes, if known */\r\n public static onInternetConnectivityChanged = new BeEvent<(status: InternetConnectivityStatus) => void>();\r\n\r\n /** determine whether the app currently has internet connectivity, if known */\r\n public static async checkInternetConnectivity(): Promise<InternetConnectivityStatus> {\r\n return this.callNativeHost(\"checkInternetConnectivity\");\r\n }\r\n /** @internal */\r\n public static async overrideInternetConnectivity(status: InternetConnectivityStatus): Promise<void> {\r\n return this.callNativeHost(\"overrideInternetConnectivity\", OverriddenBy.User, status);\r\n }\r\n private static _isValid = false;\r\n public static get isValid(): boolean { return this._isValid; }\r\n\r\n /**\r\n * This is called by either ElectronApp.startup or MobileApp.startup - it should not be called directly\r\n * @internal\r\n */\r\n public static async startup(ipc: IpcSocketFrontend, opts?: NativeAppOpts) {\r\n await IpcApp.startup(ipc, opts);\r\n if (this._isValid)\r\n return;\r\n this._isValid = true;\r\n\r\n NativeAppNotifyHandler.register(); // receives notifications from backend\r\n NativeApp.hookBrowserConnectivityEvents();\r\n\r\n // initialize current online state.\r\n if (window.navigator.onLine) {\r\n RequestGlobalOptions.online = window.navigator.onLine;\r\n await this.setConnectivity(OverriddenBy.Browser, window.navigator.onLine ? InternetConnectivityStatus.Online : InternetConnectivityStatus.Offline);\r\n }\r\n }\r\n\r\n /** @internal */\r\n public static async shutdown() {\r\n NativeApp.unhookBrowserConnectivityEvents();\r\n await NativeAppLogger.flush();\r\n await IpcApp.shutdown();\r\n this._isValid = false;\r\n }\r\n\r\n public static async requestDownloadBriefcase(iTwinId: string, iModelId: string, downloadOptions: DownloadBriefcaseOptions,\r\n asOf: IModelVersion = IModelVersion.latest(), progress?: ProgressCallback): Promise<BriefcaseDownloader> {\r\n\r\n let stopProgressEvents = () => { };\r\n if (progress !== undefined) {\r\n stopProgressEvents = IpcApp.addListener(`nativeApp.progress-${iModelId}`, (_evt: Event, data: { loaded: number, total: number }) => {\r\n progress(data);\r\n });\r\n }\r\n\r\n const briefcaseId = (undefined !== downloadOptions.briefcaseId) ? downloadOptions.briefcaseId :\r\n (downloadOptions.syncMode === SyncMode.PullOnly ? 0 : await this.callNativeHost(\"acquireNewBriefcaseId\", iModelId));\r\n\r\n const fileName = downloadOptions.fileName ?? await this.getBriefcaseFileName({ briefcaseId, iModelId });\r\n const requestProps: RequestNewBriefcaseProps = { iModelId, briefcaseId, iTwinId, asOf: asOf.toJSON(), fileName };\r\n\r\n const doDownload = async (): Promise<void> => {\r\n try {\r\n await this.callNativeHost(\"downloadBriefcase\", requestProps, progress !== undefined, downloadOptions.progressInterval);\r\n } finally {\r\n stopProgressEvents();\r\n }\r\n };\r\n\r\n const requestCancel = async (): Promise<boolean> => {\r\n const status = await this.callNativeHost(\"requestCancelDownloadBriefcase\", fileName);\r\n if (status)\r\n stopProgressEvents();\r\n return status;\r\n };\r\n\r\n return { briefcaseId, fileName, downloadPromise: doDownload(), requestCancel };\r\n }\r\n\r\n /** Get the full path filename for a briefcase within the briefcase cache */\r\n public static async getBriefcaseFileName(props: BriefcaseProps): Promise<string> {\r\n return this.callNativeHost(\"getBriefcaseFileName\", props);\r\n }\r\n\r\n /** Delete an existing briefcase\r\n * @param fileName the briefcase fileName\r\n */\r\n public static async deleteBriefcase(fileName: string): Promise<void> {\r\n await this.callNativeHost(\"deleteBriefcaseFiles\", fileName);\r\n }\r\n\r\n /** Get a list of all briefcase files held in the local briefcase cache directory */\r\n public static async getCachedBriefcases(iModelId?: GuidString): Promise<LocalBriefcaseProps[]> {\r\n return this.callNativeHost(\"getCachedBriefcases\", iModelId);\r\n }\r\n\r\n /**\r\n * Open a [[Storage]]. Creates a new Storage with that name if it does not already exist.\r\n * @param name Should be a local filename without an extension.\r\n * @returns a Promise for the [[Storage]].\r\n */\r\n public static async openStorage(name: string): Promise<Storage> {\r\n if (this._storages.has(name))\r\n return this._storages.get(name)!;\r\n\r\n const storage = new Storage(await this.callNativeHost(\"storageMgrOpen\", name));\r\n this._storages.set(storage.id, storage);\r\n return storage;\r\n }\r\n\r\n /**\r\n * Close a Storage and optionally delete it.\r\n * @param storage normally not call directly instead use Storage.close()\r\n * @param deleteStorage if true, delete the storage from disk after closing it.\r\n */\r\n public static async closeStorage(storage: Storage, deleteStorage: boolean = false): Promise<void> {\r\n if (!this._storages.has(storage.id))\r\n throw new Error(`Storage [Id=${storage.id}] not open`);\r\n\r\n await this.callNativeHost(\"storageMgrClose\", storage.id, deleteStorage);\r\n this._storages.delete(storage.id);\r\n }\r\n\r\n /** Get the list of existing Storages on the local disk. */\r\n public static async getStorageNames(): Promise<string[]> {\r\n return NativeApp.callNativeHost(\"storageMgrNames\");\r\n }\r\n}\r\n\r\n/**\r\n * A local disk-based cache for key value pairs for NativeApps.\r\n * @note This should be used only for local caching, since its not guaranteed to exist permanently.\r\n * @public\r\n */\r\nexport class Storage {\r\n constructor(public readonly id: string) { }\r\n\r\n /** get the type of a value for a key, or undefined if not present. */\r\n public async getValueType(key: string): Promise<\"number\" | \"string\" | \"boolean\" | \"Uint8Array\" | \"null\" | undefined> {\r\n return NativeApp.callNativeHost(\"storageGetValueType\", this.id, key);\r\n }\r\n\r\n /** Get the value for a key */\r\n public async getData(key: string): Promise<StorageValue> {\r\n return NativeApp.callNativeHost(\"storageGet\", this.id, key);\r\n }\r\n\r\n /** Set value for a key */\r\n public async setData(key: string, value: StorageValue): Promise<void> {\r\n return NativeApp.callNativeHost(\"storageSet\", this.id, key, value);\r\n }\r\n\r\n /**\r\n * Return an array of all keys in this Storage.\r\n * @note This can be expensive, depending on the number of keys present.\r\n */\r\n public async getKeys(): Promise<string[]> {\r\n return NativeApp.callNativeHost(\"storageKeys\", this.id);\r\n }\r\n\r\n /** Remove a key and its data. */\r\n public async removeData(key: string): Promise<void> {\r\n return NativeApp.callNativeHost(\"storageRemove\", this.id, key);\r\n }\r\n\r\n /** Remove all keys and their data. */\r\n public async removeAll(): Promise<void> {\r\n return NativeApp.callNativeHost(\"storageRemoveAll\", this.id);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"NativeApp.js","sourceRoot":"","sources":["../../src/NativeApp.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;AAEH,sDAAqG;AACrG,oDAI4B;AAC5B,+CAA2E;AAC3E,qEAAkE;AAClE,qCAAsE;AACtE,uDAAoD;AAqBpD,2CAA2C;AAC3C,MAAM,sBAAuB,SAAQ,4BAAmB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AAC,OAAO,CAAC,GAAW;QAC9B,OAAO,SAAS,CAAC,cAAc,CAAC,YAAY,EAAE,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;IAC9D,CAAC;IAED,0BAA0B;IACnB,KAAK,CAAC,OAAO,CAAC,GAAW,EAAE,KAAmB;QACnD,OAAO,SAAS,CAAC,cAAc,CAAC,YAAY,EAAE,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACrE,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,OAAO;QAClB,OAAO,SAAS,CAAC,cAAc,CAAC,aAAa,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED,iCAAiC;IAC1B,KAAK,CAAC,UAAU,CAAC,GAAW;QACjC,OAAO,SAAS,CAAC,cAAc,CAAC,eAAe,EAAE,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;IACjE,CAAC;IAED,sCAAsC;IAC/B,KAAK,CAAC,SAAS;QACpB,OAAO,SAAS,CAAC,cAAc,CAAC,kBAAkB,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAC/D,CAAC;CACF;AAnCD,0BAmCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module NativeApp\r\n */\r\n\r\nimport { AsyncMethodsOf, BeEvent, GuidString, Logger, PromiseReturnType } from \"@itwin/core-bentley\";\r\nimport {\r\n BriefcaseDownloader, BriefcaseProps, IModelVersion, InternetConnectivityStatus, IpcSocketFrontend, LocalBriefcaseProps,\r\n nativeAppChannel, NativeAppFunctions, NativeAppNotifications, nativeAppNotify, OverriddenBy,\r\n RequestNewBriefcaseProps, StorageValue, SyncMode,\r\n} from \"@itwin/core-common\";\r\nimport { ProgressCallback, RequestGlobalOptions } from \"./request/Request\";\r\nimport { FrontendLoggerCategory } from \"./FrontendLoggerCategory\";\r\nimport { IpcApp, IpcAppOptions, NotificationHandler } from \"./IpcApp\";\r\nimport { NativeAppLogger } from \"./NativeAppLogger\";\r\n\r\n/** Properties for specifying the BriefcaseId for downloading. May either specify a BriefcaseId directly (preferable) or, for\r\n * backwards compatibility, a [SyncMode]($common). If [SyncMode.PullAndPush]($common) is supplied, a new briefcaseId will be acquired.\r\n * @public\r\n */\r\nexport type DownloadBriefcaseId =\r\n { syncMode?: SyncMode, briefcaseId?: never } |\r\n { briefcaseId: number, syncMode?: never };\r\n\r\n/**\r\n* Options to download a briefcase\r\n* @public\r\n*/\r\nexport type DownloadBriefcaseOptions = DownloadBriefcaseId & {\r\n /** the full path for the briefcase file */\r\n fileName?: string;\r\n /** interval for calling progress function, in milliseconds */\r\n progressInterval?: number;\r\n};\r\n\r\n/** NativeApp notifications from backend */\r\nclass NativeAppNotifyHandler extends NotificationHandler implements NativeAppNotifications {\r\n public get channelName() { return nativeAppNotify; }\r\n public notifyInternetConnectivityChanged(status: InternetConnectivityStatus) {\r\n Logger.logInfo(FrontendLoggerCategory.NativeApp, \"Internet connectivity changed\");\r\n NativeApp.onInternetConnectivityChanged.raiseEvent(status);\r\n }\r\n}\r\n\r\n/**\r\n * Options for [[NativeApp.startup]]\r\n * @public\r\n */\r\nexport interface NativeAppOpts extends IpcAppOptions {\r\n nativeApp?: {};\r\n}\r\n\r\n/**\r\n * The frontend of a native application\r\n * @see [Native Applications]($docs/learning/NativeApps.md)\r\n * @public\r\n */\r\nexport class NativeApp {\r\n public static async callNativeHost<T extends AsyncMethodsOf<NativeAppFunctions>>(methodName: T, ...args: Parameters<NativeAppFunctions[T]>) {\r\n return IpcApp.callIpcChannel(nativeAppChannel, methodName, ...args) as PromiseReturnType<NativeAppFunctions[T]>;\r\n }\r\n\r\n private static _storages = new Map<string, Storage>();\r\n private static _onOnline = async () => {\r\n await NativeApp.setConnectivity(OverriddenBy.Browser, InternetConnectivityStatus.Online);\r\n };\r\n private static _onOffline = async () => {\r\n await NativeApp.setConnectivity(OverriddenBy.Browser, InternetConnectivityStatus.Offline);\r\n };\r\n private static async setConnectivity(by: OverriddenBy, status: InternetConnectivityStatus) {\r\n RequestGlobalOptions.online = (status === InternetConnectivityStatus.Online);\r\n await this.callNativeHost(\"overrideInternetConnectivity\", by, status);\r\n }\r\n private static hookBrowserConnectivityEvents() {\r\n if (typeof window === \"object\" && window.ononline && window.onoffline) {\r\n window.addEventListener(\"online\", this._onOnline);\r\n window.addEventListener(\"offline\", this._onOffline);\r\n }\r\n }\r\n private static unhookBrowserConnectivityEvents() {\r\n if (typeof window === \"object\" && window.ononline && window.onoffline) {\r\n window.removeEventListener(\"online\", this._onOnline);\r\n window.removeEventListener(\"offline\", this._onOffline);\r\n }\r\n }\r\n /** event called when internet connectivity changes, if known */\r\n public static onInternetConnectivityChanged = new BeEvent<(status: InternetConnectivityStatus) => void>();\r\n\r\n /** determine whether the app currently has internet connectivity, if known */\r\n public static async checkInternetConnectivity(): Promise<InternetConnectivityStatus> {\r\n return this.callNativeHost(\"checkInternetConnectivity\");\r\n }\r\n /** @internal */\r\n public static async overrideInternetConnectivity(status: InternetConnectivityStatus): Promise<void> {\r\n return this.callNativeHost(\"overrideInternetConnectivity\", OverriddenBy.User, status);\r\n }\r\n private static _isValid = false;\r\n public static get isValid(): boolean { return this._isValid; }\r\n\r\n /**\r\n * This is called by either ElectronApp.startup or MobileApp.startup - it should not be called directly\r\n * @internal\r\n */\r\n public static async startup(ipc: IpcSocketFrontend, opts?: NativeAppOpts) {\r\n await IpcApp.startup(ipc, opts);\r\n if (this._isValid)\r\n return;\r\n this._isValid = true;\r\n\r\n NativeAppNotifyHandler.register(); // receives notifications from backend\r\n NativeApp.hookBrowserConnectivityEvents();\r\n\r\n // initialize current online state.\r\n if (window.navigator.onLine) {\r\n RequestGlobalOptions.online = window.navigator.onLine;\r\n await this.setConnectivity(OverriddenBy.Browser, window.navigator.onLine ? InternetConnectivityStatus.Online : InternetConnectivityStatus.Offline);\r\n }\r\n }\r\n\r\n /** @internal */\r\n public static async shutdown() {\r\n NativeApp.unhookBrowserConnectivityEvents();\r\n await NativeAppLogger.flush();\r\n await IpcApp.shutdown();\r\n this._isValid = false;\r\n }\r\n\r\n public static async requestDownloadBriefcase(iTwinId: string, iModelId: string, downloadOptions: DownloadBriefcaseOptions,\r\n asOf: IModelVersion = IModelVersion.latest(), progress?: ProgressCallback): Promise<BriefcaseDownloader> {\r\n\r\n let stopProgressEvents = () => { };\r\n if (progress !== undefined) {\r\n stopProgressEvents = IpcApp.addListener(`nativeApp.progress-${iModelId}`, (_evt: Event, data: { loaded: number, total: number }) => {\r\n progress(data);\r\n });\r\n }\r\n\r\n const briefcaseId = (undefined !== downloadOptions.briefcaseId) ? downloadOptions.briefcaseId :\r\n (downloadOptions.syncMode === SyncMode.PullOnly ? 0 : await this.callNativeHost(\"acquireNewBriefcaseId\", iModelId));\r\n\r\n const fileName = downloadOptions.fileName ?? await this.getBriefcaseFileName({ briefcaseId, iModelId });\r\n const requestProps: RequestNewBriefcaseProps = { iModelId, briefcaseId, iTwinId, asOf: asOf.toJSON(), fileName };\r\n\r\n const doDownload = async (): Promise<void> => {\r\n try {\r\n await this.callNativeHost(\"downloadBriefcase\", requestProps, progress !== undefined, downloadOptions.progressInterval);\r\n } finally {\r\n stopProgressEvents();\r\n }\r\n };\r\n\r\n const requestCancel = async (): Promise<boolean> => {\r\n const status = await this.callNativeHost(\"requestCancelDownloadBriefcase\", fileName);\r\n if (status)\r\n stopProgressEvents();\r\n return status;\r\n };\r\n\r\n return { briefcaseId, fileName, downloadPromise: doDownload(), requestCancel };\r\n }\r\n\r\n /** Get the full path filename for a briefcase within the briefcase cache */\r\n public static async getBriefcaseFileName(props: BriefcaseProps): Promise<string> {\r\n return this.callNativeHost(\"getBriefcaseFileName\", props);\r\n }\r\n\r\n /** Delete an existing briefcase\r\n * @param fileName the briefcase fileName\r\n */\r\n public static async deleteBriefcase(fileName: string): Promise<void> {\r\n await this.callNativeHost(\"deleteBriefcaseFiles\", fileName);\r\n }\r\n\r\n /** Get a list of all briefcase files held in the local briefcase cache directory */\r\n public static async getCachedBriefcases(iModelId?: GuidString): Promise<LocalBriefcaseProps[]> {\r\n return this.callNativeHost(\"getCachedBriefcases\", iModelId);\r\n }\r\n\r\n /**\r\n * Open a [[Storage]]. Creates a new Storage with that name if it does not already exist.\r\n * @param name Should be a local filename without an extension.\r\n * @returns a Promise for the [[Storage]].\r\n */\r\n public static async openStorage(name: string): Promise<Storage> {\r\n if (this._storages.has(name))\r\n return this._storages.get(name)!;\r\n\r\n const storage = new Storage(await this.callNativeHost(\"storageMgrOpen\", name));\r\n this._storages.set(storage.id, storage);\r\n return storage;\r\n }\r\n\r\n /**\r\n * Close a Storage and optionally delete it.\r\n * @param storage normally not call directly instead use Storage.close()\r\n * @param deleteStorage if true, delete the storage from disk after closing it.\r\n */\r\n public static async closeStorage(storage: Storage, deleteStorage: boolean = false): Promise<void> {\r\n if (!this._storages.has(storage.id))\r\n throw new Error(`Storage [Id=${storage.id}] not open`);\r\n\r\n await this.callNativeHost(\"storageMgrClose\", storage.id, deleteStorage);\r\n this._storages.delete(storage.id);\r\n }\r\n\r\n /** Get the list of existing Storages on the local disk. */\r\n public static async getStorageNames(): Promise<string[]> {\r\n return NativeApp.callNativeHost(\"storageMgrNames\");\r\n }\r\n}\r\n\r\n/**\r\n * A local disk-based cache for key value pairs for NativeApps.\r\n * @note This should be used only for local caching, since its not guaranteed to exist permanently.\r\n * @public\r\n */\r\nexport class Storage {\r\n constructor(public readonly id: string) { }\r\n\r\n /** get the type of a value for a key, or undefined if not present. */\r\n public async getValueType(key: string): Promise<\"number\" | \"string\" | \"boolean\" | \"Uint8Array\" | \"null\" | undefined> {\r\n return NativeApp.callNativeHost(\"storageGetValueType\", this.id, key);\r\n }\r\n\r\n /** Get the value for a key */\r\n public async getData(key: string): Promise<StorageValue> {\r\n return NativeApp.callNativeHost(\"storageGet\", this.id, key);\r\n }\r\n\r\n /** Set value for a key */\r\n public async setData(key: string, value: StorageValue): Promise<void> {\r\n return NativeApp.callNativeHost(\"storageSet\", this.id, key, value);\r\n }\r\n\r\n /**\r\n * Return an array of all keys in this Storage.\r\n * @note This can be expensive, depending on the number of keys present.\r\n */\r\n public async getKeys(): Promise<string[]> {\r\n return NativeApp.callNativeHost(\"storageKeys\", this.id);\r\n }\r\n\r\n /** Remove a key and its data. */\r\n public async removeData(key: string): Promise<void> {\r\n return NativeApp.callNativeHost(\"storageRemove\", this.id, key);\r\n }\r\n\r\n /** Remove all keys and their data. */\r\n public async removeAll(): Promise<void> {\r\n return NativeApp.callNativeHost(\"storageRemoveAll\", this.id);\r\n }\r\n}\r\n"]}
|
|
@@ -25,6 +25,7 @@ export declare enum OutputMessageType {
|
|
|
25
25
|
*/
|
|
26
26
|
export declare enum OutputMessagePriority {
|
|
27
27
|
None = 0,
|
|
28
|
+
Success = 1,
|
|
28
29
|
Error = 10,
|
|
29
30
|
Warning = 11,
|
|
30
31
|
Info = 12,
|
|
@@ -65,7 +66,8 @@ export declare enum MessageBoxIconType {
|
|
|
65
66
|
Information = 1,
|
|
66
67
|
Question = 2,
|
|
67
68
|
Warning = 3,
|
|
68
|
-
Critical = 4
|
|
69
|
+
Critical = 4,
|
|
70
|
+
Success = 5
|
|
69
71
|
}
|
|
70
72
|
/** Describes the possible return values produced when the user clicks a button in a messagebox opened using [[NotificationManager.openMessageBox]].
|
|
71
73
|
* @public
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationManager.d.ts","sourceRoot":"","sources":["../../src/NotificationManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEhH,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAIpE;;GAEG;AACH,oBAAY,iBAAiB;IAC3B,uGAAuG;IACvG,KAAK,IAAI;IACT,2GAA2G;IAC3G,OAAO,IAAI;IACX,2FAA2F;IAC3F,MAAM,IAAI;IACV,4EAA4E;IAC5E,UAAU,IAAI;IACd,yBAAyB;IACzB,KAAK,IAAI;CACV;AAED;;GAEG;AACH,oBAAY,qBAAqB;IAC/B,IAAI,IAAI;IACR,KAAK,KAAK;IACV,OAAO,KAAK;IACZ,IAAI,KAAK;IACT,KAAK,KAAK;IACV,KAAK,KAAK;CACX;AAED;;GAEG;AACH,oBAAY,kBAAkB;IAC5B,IAAI,IAAI;IACR,MAAM,IAAI;IACV,OAAO,IAAI;CACZ;AAED;;GAEG;AACH,oBAAY,wBAAwB;IAClC,SAAS,IAAI;IACb,SAAS,IAAI;CACd;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,QAAQ,IAAA;IACR,EAAE,IAAA;IACF,OAAO,IAAA;IACP,WAAW,IAAA;IACX,WAAW,IAAA;IACX,KAAK,IAAA;CACN;AAED;;GAEG;AACH,oBAAY,kBAAkB;IAC5B,QAAQ,IAAI;IACZ,WAAW,IAAI;IACf,QAAQ,IAAI;IACZ,OAAO,IAAI;IACX,QAAQ,IAAI;
|
|
1
|
+
{"version":3,"file":"NotificationManager.d.ts","sourceRoot":"","sources":["../../src/NotificationManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEhH,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAIpE;;GAEG;AACH,oBAAY,iBAAiB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AAE,eAAe,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI;IAMrK,OAAO,CAAC,yBAAyB;IAgBjC,OAAO,CAAC,kBAAkB;CAe3B"}
|
|
@@ -35,6 +35,7 @@ var OutputMessageType;
|
|
|
35
35
|
var OutputMessagePriority;
|
|
36
36
|
(function (OutputMessagePriority) {
|
|
37
37
|
OutputMessagePriority[OutputMessagePriority["None"] = 0] = "None";
|
|
38
|
+
OutputMessagePriority[OutputMessagePriority["Success"] = 1] = "Success";
|
|
38
39
|
OutputMessagePriority[OutputMessagePriority["Error"] = 10] = "Error";
|
|
39
40
|
OutputMessagePriority[OutputMessagePriority["Warning"] = 11] = "Warning";
|
|
40
41
|
OutputMessagePriority[OutputMessagePriority["Info"] = 12] = "Info";
|
|
@@ -80,6 +81,7 @@ var MessageBoxIconType;
|
|
|
80
81
|
MessageBoxIconType[MessageBoxIconType["Question"] = 2] = "Question";
|
|
81
82
|
MessageBoxIconType[MessageBoxIconType["Warning"] = 3] = "Warning";
|
|
82
83
|
MessageBoxIconType[MessageBoxIconType["Critical"] = 4] = "Critical";
|
|
84
|
+
MessageBoxIconType[MessageBoxIconType["Success"] = 5] = "Success";
|
|
83
85
|
})(MessageBoxIconType = exports.MessageBoxIconType || (exports.MessageBoxIconType = {}));
|
|
84
86
|
/** Describes the possible return values produced when the user clicks a button in a messagebox opened using [[NotificationManager.openMessageBox]].
|
|
85
87
|
* @public
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationManager.js","sourceRoot":"","sources":["../../src/NotificationManager.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAiD;AACjD,wDAAsD;AACtD,0DAAgH;AAChH,2CAAwC;AAGxC,0BAA0B;AAE1B;;GAEG;AACH,IAAY,iBAWX;AAXD,WAAY,iBAAiB;IAC3B,uGAAuG;IACvG,2DAAS,CAAA;IACT,2GAA2G;IAC3G,+DAAW,CAAA;IACX,2FAA2F;IA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AAoB,CAAC,IAAI,CAAC,yBAAyB,CAAC,QAAQ,CAAC,EAAE,YAAY,EAAE,eAAe,CAAC,CAAC;QAClH,OAAO,CAAC,wBAAwB,CAAC,UAAU,CAAC,CAAC;QAC7C,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAEO,yBAAyB,CAAC,QAAyB;QACzD,QAAQ,QAAQ,EAAE;YAChB,KAAK,gCAAe,CAAC,WAAW;gBAC9B,OAAO,qBAAqB,CAAC,IAAI,CAAC;YACpC,KAAK,gCAAe,CAAC,OAAO;gBAC1B,OAAO,qBAAqB,CAAC,OAAO,CAAC;YACvC,KAAK,gCAAe,CAAC,KAAK;gBACxB,OAAO,qBAAqB,CAAC,KAAK,CAAC;YACrC,KAAK,gCAAe,CAAC,KAAK;gBACxB,OAAO,qBAAqB,CAAC,KAAK,CAAC;YACrC,KAAK,gCAAe,CAAC,IAAI,CAAC;YAC1B;gBACE,OAAO,qBAAqB,CAAC,IAAI,CAAC;SACrC;IACH,CAAC;IAEO,kBAAkB,CAAC,aAAkC;QAC3D,QAAQ,aAAa,EAAE;YACrB,KAAK,mCAAkB,CAAC,KAAK;gBAC3B,OAAO,iBAAiB,CAAC,KAAK,CAAC;YACjC,KAAK,mCAAkB,CAAC,UAAU;gBAChC,OAAO,iBAAiB,CAAC,UAAU,CAAC;YACtC,KAAK,mCAAkB,CAAC,MAAM;gBAC5B,OAAO,iBAAiB,CAAC,MAAM,CAAC;YAClC,KAAK,mCAAkB,CAAC,KAAK;gBAC3B,OAAO,iBAAiB,CAAC,KAAK,CAAC;YACjC;gBACE,OAAO,SAAS,CAAC;SACpB;IACH,CAAC;CAEF;AAnJD,kDAmJC","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 Notifications\r\n */\r\nimport { BeDuration } from \"@itwin/core-bentley\";\r\nimport { Point2d, XAndY } from \"@itwin/core-geometry\";\r\nimport { DisplayMessageType, MessagePresenter, MessageSeverity, RelativePosition } from \"@itwin/appui-abstract\";\r\nimport { IModelApp } from \"./IModelApp\";\r\nimport { ToolAssistanceInstructions } from \"./tools/ToolAssistance\";\r\n\r\n// cSpell:words messagebox\r\n\r\n/** Describes the type and behavior of a [[NotifyMessageDetails]].\r\n * @public\r\n */\r\nexport enum OutputMessageType {\r\n /** Temporary message box displays at the top or bottom of the screen then disappears automatically. */\r\n Toast = 0,\r\n /** Message box displays near the cursor over a Viewport and is closed by calling `closePointerMessage`. */\r\n Pointer = 1,\r\n /** Message box displays at the top or bottom of the screen and contains a Close button. */\r\n Sticky = 2,\r\n /** Message box displays near an input field and contains a Close button. */\r\n InputField = 3,\r\n /** Modal message box. */\r\n Alert = 4,\r\n}\r\n\r\n/** Classifies a [[NotifyMessageDetails]] by its level of importance.\r\n * @public\r\n */\r\nexport enum OutputMessagePriority {\r\n None = 0,\r\n Error = 10,\r\n Warning = 11,\r\n Info = 12,\r\n Debug = 13,\r\n Fatal = 17,\r\n}\r\n\r\n/** Describes the alert behavior of a [[NotifyMessageDetails]].\r\n * @public\r\n */\r\nexport enum OutputMessageAlert {\r\n None = 0,\r\n Dialog = 1,\r\n Balloon = 2,\r\n}\r\n\r\n/** Reason for ending the activity message via endActivityMessage\r\n * @public\r\n */\r\nexport enum ActivityMessageEndReason {\r\n Completed = 0,\r\n Cancelled = 1,\r\n}\r\n\r\n/** Describes the set of buttons displayed in a message box opened using [[NotificationManager.openMessageBox]].\r\n * @public\r\n */\r\nexport enum MessageBoxType {\r\n OkCancel,\r\n Ok,\r\n LargeOk,\r\n MediumAlert,\r\n YesNoCancel,\r\n YesNo,\r\n}\r\n\r\n/** Describes the icon displayed in a messagebox opened using [[NotificationManager.openMessageBox]].\r\n * @public\r\n */\r\nexport enum MessageBoxIconType {\r\n NoSymbol = 0, // Means Don't draw Symbol\r\n Information = 1, // Lower Case i\r\n Question = 2, // Question Mark\r\n Warning = 3, // Exclamation Point\r\n Critical = 4, // Stop Sign\r\n}\r\n\r\n/** Describes the possible return values produced when the user clicks a button in a messagebox opened using [[NotificationManager.openMessageBox]].\r\n * @public\r\n */\r\nexport enum MessageBoxValue {\r\n Apply = 1,\r\n Reset = 2,\r\n Ok = 3,\r\n Cancel = 4,\r\n Default = 5,\r\n Yes = 6,\r\n No = 7,\r\n Retry = 8,\r\n Stop = 9,\r\n Help = 10,\r\n YesToAll = 11,\r\n NoToAll = 12,\r\n}\r\n\r\n/** Describes the behavior of a tooltip created using [[NotificationManager.openToolTip]].\r\n * @public\r\n */\r\nexport interface ToolTipOptions {\r\n duration?: BeDuration;\r\n placement?: string;\r\n}\r\n\r\n/** Describes a message to be displayed to the user.\r\n * @public\r\n */\r\nexport class NotifyMessageDetails {\r\n public displayTime = BeDuration.fromSeconds(5);\r\n public viewport?: HTMLElement;\r\n public inputField?: HTMLElement;\r\n public displayPoint?: Point2d;\r\n public relativePosition = RelativePosition.TopRight;\r\n\r\n /** Constructor\r\n * @param priority The priority this message should be accorded by the NotificationManager.\r\n * @param briefMessage A short message that conveys the simplest explanation of the issue.\r\n * @param detailedMessage An optional comprehensive message that explains the issue in detail and potentially offers a solution.\r\n * @param msgType The type of message. Defaults to Toast.\r\n * @param openAlert Whether an alert box should be displayed or not, and if so what kind.\r\n */\r\n public constructor(public priority: OutputMessagePriority, public briefMessage: HTMLElement | string,\r\n public detailedMessage?: HTMLElement | string, public msgType = OutputMessageType.Toast, public openAlert = OutputMessageAlert.None) { }\r\n\r\n /** Set OutputMessageType.Pointer message details.\r\n * @param viewport Viewport over which to display the Pointer type message.\r\n * @param displayPoint Point at which to display the Pointer type message.\r\n * @param relativePosition Position relative to displayPoint at which to display the Pointer type message.\r\n */\r\n public setPointerTypeDetails(viewport: HTMLElement, displayPoint: XAndY, relativePosition = RelativePosition.TopRight) {\r\n this.viewport = viewport;\r\n this.displayPoint = Point2d.fromJSON(displayPoint);\r\n this.relativePosition = relativePosition;\r\n this.msgType = OutputMessageType.Pointer;\r\n }\r\n\r\n /** Set OutputMessageType.InputField message details.\r\n * @param inputField Input field to which the message pertains. The message will be shown just below this input field element.\r\n */\r\n public setInputFieldTypeDetails(inputField: HTMLElement) {\r\n this.inputField = inputField;\r\n this.msgType = OutputMessageType.InputField;\r\n }\r\n}\r\n\r\n/** Specifies the details of an activity message to be displayed to the user.\r\n * @public\r\n */\r\nexport class ActivityMessageDetails {\r\n public wasCancelled = false;\r\n\r\n /**\r\n * @param showProgressBar Indicates whether to show the progress bar in the activity message dialog.\r\n * @param showPercentInMessage Indicates whether to show the percentage complete in the activity message text.\r\n * @param supportsCancellation Indicates whether to show the Cancel button, giving the user the ability to cancel the operation.\r\n * @param showDialogInitially Indicates whether to show the activity message dialog initially. User can click status bar to open it.\r\n */\r\n public constructor(public showProgressBar: boolean, public showPercentInMessage: boolean, public supportsCancellation: boolean, public showDialogInitially: boolean = true) { }\r\n\r\n /** Called from NotificationAdmin when the user cancels the activity. */\r\n public onActivityCancelled() { this.wasCancelled = true; }\r\n\r\n /** Called from NotificationAdmin when the activity completes successfully. */\r\n public onActivityCompleted() { this.wasCancelled = false; }\r\n}\r\n\r\n/** The NotificationManager controls the interaction with the user for prompts, error messages, and alert dialogs.\r\n * Implementations of the NotificationManager may present the information in different ways. For example, in\r\n * non-interactive sessions, these messages may be saved to a log file or simply discarded.\r\n * @public\r\n */\r\nexport class NotificationManager implements MessagePresenter {\r\n public readonly toolTipLocation = new Point2d();\r\n\r\n /** Output a prompt, given a localization key.\r\n * @param key The key of the localized string with the prompt message.\r\n */\r\n public outputPromptByKey(key: string) { this.outputPrompt(IModelApp.localization.getLocalizedString(key)); }\r\n\r\n /** Output a localized prompt to the user. A 'prompt' indicates an action the user should take to proceed.\r\n * @param _prompt The localized string with the prompt message.\r\n */\r\n public outputPrompt(_prompt: string) { }\r\n\r\n /** Output a message and/or alert to the user. */\r\n public outputMessage(_message: NotifyMessageDetails) { }\r\n\r\n /** Output a MessageBox and wait for response from the user.\r\n * @param _mbType The MessageBox type.\r\n * @param _message The message to display.\r\n * @param _icon The MessageBox icon type.\r\n * @return the response from the user.\r\n */\r\n public async openMessageBox(_mbType: MessageBoxType, _message: HTMLElement | string, _icon: MessageBoxIconType): Promise<MessageBoxValue> { return MessageBoxValue.Ok; }\r\n\r\n /**\r\n * Set up for activity messages.\r\n * @param _details The activity message details.\r\n * @return true if the message was displayed, false if an invalid priority is specified.\r\n */\r\n public setupActivityMessage(_details: ActivityMessageDetails) { return true; }\r\n\r\n /**\r\n * Output an activity message to the user.\r\n * @param _messageText The message text.\r\n * @param _percentComplete The percentage of completion.\r\n * @return true if the message was displayed, false if the message could not be displayed.\r\n */\r\n public outputActivityMessage(_messageText: HTMLElement | string, _percentComplete: number) { return true; }\r\n\r\n /**\r\n * End an activity message.\r\n * @param _reason The reason for the end of the Activity Message.\r\n * @return true if the message was ended successfully, false if the activityMessage could not be ended.\r\n */\r\n public endActivityMessage(_reason: ActivityMessageEndReason) { return true; }\r\n\r\n /** Return true if _showTooltip has an implementation and will display a tooltip. */\r\n public get isToolTipSupported(): boolean { return false; }\r\n\r\n /** Return true if the tooltip is currently open. */\r\n public get isToolTipOpen(): boolean { return false; }\r\n\r\n /** Implement to display a tooltip message at the specified location. */\r\n protected _showToolTip(_htmlElement: HTMLElement, _message: HTMLElement | string, _location?: XAndY, _options?: ToolTipOptions): void { }\r\n\r\n /** Show a tooltip window. Saves tooltip location for AccuSnap to test if cursor has moved far enough away to close tooltip.\r\n * @param htmlElement The HTMLElement that anchors the toolTip.\r\n * @param message What to display inside the ToolTip. May be a string or an HTMLElement.\r\n * @param location An optional location, relative to the origin of _htmlElement, for the ToolTip. If undefined, center of `htmlElement`\r\n * @param options Options that supply additional information about how the ToolTip should function.\r\n * @note If message is an HTMLElement, the notification manager will display the HTMLElement verbatim. This can represent a security\r\n * risk if any part the element is created from user input. Applications should be careful to *sanitize* any such input before\r\n * creating an HTMLElement to pass to this method.\r\n */\r\n public openToolTip(htmlElement: HTMLElement, message: HTMLElement | string, location?: XAndY, options?: ToolTipOptions): void {\r\n this.toolTipLocation.setFrom(location);\r\n this._showToolTip(htmlElement, message, location, options);\r\n }\r\n\r\n /** Clear the tooltip if it is currently open. */\r\n public clearToolTip(): void { }\r\n\r\n /** Update message position created with [[OutputMessageType.Pointer]].\r\n * @param displayPoint Point at which to display the Pointer type message.\r\n * @param relativePosition Position relative to displayPoint at which to display the Pointer type message.\r\n */\r\n public updatePointerMessage(_displayPoint: XAndY, _relativePosition = RelativePosition.TopRight): void { }\r\n\r\n /** Close message created with [[OutputMessageType.Pointer]]. */\r\n public closePointerMessage(): void { }\r\n\r\n /** Close message created with [[OutputMessageType.InputField]]. */\r\n public closeInputFieldMessage(): void { }\r\n\r\n /** Setup tool assistance instructions for a tool. The instructions include the main instruction, which includes the current prompt.\r\n * @param instructions The tool assistance instructions.\r\n */\r\n public setToolAssistance(instructions: ToolAssistanceInstructions | undefined) {\r\n this.outputPrompt(instructions ? instructions.mainInstruction.text : \"\");\r\n }\r\n\r\n /**\r\n * Displays a notification message.\r\n * @param severity The severity of the message.\r\n * @param briefMessage A short message that conveys the simplest explanation of the issue.\r\n * @param detailedMessage An optional comprehensive message that explains the issue in detail and potentially offers a solution.\r\n * @param messageType The type of message. Defaults to Toast.\r\n */\r\n public displayMessage(severity: MessageSeverity, briefMessage: HTMLElement | string, detailedMessage?: HTMLElement | string, messageType?: DisplayMessageType): void {\r\n const details = new NotifyMessageDetails(this.convertSeverityToPriority(severity), briefMessage, detailedMessage, this.convertMessageType(messageType));\r\n this.outputMessage(details);\r\n }\r\n\r\n /**\r\n * Displays an input field notification message.\r\n * @param inputField Input field to which the message pertains. The message will be shown just below this input field element.\r\n * @param severity The severity of the message.\r\n * @param briefMessage A short message that conveys the simplest explanation of the issue.\r\n * @param detailedMessage An optional comprehensive message that explains the issue in detail and potentially offers a solution.\r\n */\r\n public displayInputFieldMessage(inputField: HTMLElement, severity: MessageSeverity, briefMessage: HTMLElement | string, detailedMessage?: HTMLElement | string): void {\r\n const details = new NotifyMessageDetails(this.convertSeverityToPriority(severity), briefMessage, detailedMessage);\r\n details.setInputFieldTypeDetails(inputField);\r\n this.outputMessage(details);\r\n }\r\n\r\n private convertSeverityToPriority(severity: MessageSeverity): OutputMessagePriority {\r\n switch (severity) {\r\n case MessageSeverity.Information:\r\n return OutputMessagePriority.Info;\r\n case MessageSeverity.Warning:\r\n return OutputMessagePriority.Warning;\r\n case MessageSeverity.Error:\r\n return OutputMessagePriority.Error;\r\n case MessageSeverity.Fatal:\r\n return OutputMessagePriority.Fatal;\r\n case MessageSeverity.None:\r\n default:\r\n return OutputMessagePriority.None;\r\n }\r\n }\r\n\r\n private convertMessageType(inMessageType?: DisplayMessageType): OutputMessageType | undefined {\r\n switch (inMessageType) {\r\n case DisplayMessageType.Alert:\r\n return OutputMessageType.Alert;\r\n case DisplayMessageType.InputField:\r\n return OutputMessageType.InputField;\r\n case DisplayMessageType.Sticky:\r\n return OutputMessageType.Sticky;\r\n case DisplayMessageType.Toast:\r\n return OutputMessageType.Toast;\r\n default:\r\n return undefined;\r\n }\r\n }\r\n\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"NotificationManager.js","sourceRoot":"","sources":["../../src/NotificationManager.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAiD;AACjD,wDAAsD;AACtD,0DAAgH;AAChH,2CAAwC;AAGxC,0BAA0B;AAE1B;;GAEG;AACH,IAAY,iBAWX;AAXD,WAAY,iBAAiB;IAC3B,uGAAuG;IACvG,2DAAS,CAAA;IACT,2GAA2G;IAC3G,+DAAW,CAAA;IACX,2FAA2F;IAC3F,6DAAU,CAAA;IACV,4EAA4E;IAC5E,qEAAc,CAAA;IACd,yBAAyB;IACzB,2DAAS,CAAA;AACX,CAAC,EAXW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAW5B;AAED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CAAC,UAAU,CAAC,CAAC;QAC7C,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAEO,yBAAyB,CAAC,QAAyB;QACzD,QAAQ,QAAQ,EAAE;YAChB,KAAK,gCAAe,CAAC,WAAW;gBAC9B,OAAO,qBAAqB,CAAC,IAAI,CAAC;YACpC,KAAK,gCAAe,CAAC,OAAO;gBAC1B,OAAO,qBAAqB,CAAC,OAAO,CAAC;YACvC,KAAK,gCAAe,CAAC,KAAK;gBACxB,OAAO,qBAAqB,CAAC,KAAK,CAAC;YACrC,KAAK,gCAAe,CAAC,KAAK;gBACxB,OAAO,qBAAqB,CAAC,KAAK,CAAC;YACrC,KAAK,gCAAe,CAAC,IAAI,CAAC;YAC1B;gBACE,OAAO,qBAAqB,CAAC,IAAI,CAAC;SACrC;IACH,CAAC;IAEO,kBAAkB,CAAC,aAAkC;QAC3D,QAAQ,aAAa,EAAE;YACrB,KAAK,mCAAkB,CAAC,KAAK;gBAC3B,OAAO,iBAAiB,CAAC,KAAK,CAAC;YACjC,KAAK,mCAAkB,CAAC,UAAU;gBAChC,OAAO,iBAAiB,CAAC,UAAU,CAAC;YACtC,KAAK,mCAAkB,CAAC,MAAM;gBAC5B,OAAO,iBAAiB,CAAC,MAAM,CAAC;YAClC,KAAK,mCAAkB,CAAC,KAAK;gBAC3B,OAAO,iBAAiB,CAAC,KAAK,CAAC;YACjC;gBACE,OAAO,SAAS,CAAC;SACpB;IACH,CAAC;CAEF;AAnJD,kDAmJC","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 Notifications\r\n */\r\nimport { BeDuration } from \"@itwin/core-bentley\";\r\nimport { Point2d, XAndY } from \"@itwin/core-geometry\";\r\nimport { DisplayMessageType, MessagePresenter, MessageSeverity, RelativePosition } from \"@itwin/appui-abstract\";\r\nimport { IModelApp } from \"./IModelApp\";\r\nimport { ToolAssistanceInstructions } from \"./tools/ToolAssistance\";\r\n\r\n// cSpell:words messagebox\r\n\r\n/** Describes the type and behavior of a [[NotifyMessageDetails]].\r\n * @public\r\n */\r\nexport enum OutputMessageType {\r\n /** Temporary message box displays at the top or bottom of the screen then disappears automatically. */\r\n Toast = 0,\r\n /** Message box displays near the cursor over a Viewport and is closed by calling `closePointerMessage`. */\r\n Pointer = 1,\r\n /** Message box displays at the top or bottom of the screen and contains a Close button. */\r\n Sticky = 2,\r\n /** Message box displays near an input field and contains a Close button. */\r\n InputField = 3,\r\n /** Modal message box. */\r\n Alert = 4,\r\n}\r\n\r\n/** Classifies a [[NotifyMessageDetails]] by its level of importance.\r\n * @public\r\n */\r\nexport enum OutputMessagePriority {\r\n None = 0,\r\n Success = 1,\r\n Error = 10,\r\n Warning = 11,\r\n Info = 12,\r\n Debug = 13,\r\n Fatal = 17,\r\n}\r\n\r\n/** Describes the alert behavior of a [[NotifyMessageDetails]].\r\n * @public\r\n */\r\nexport enum OutputMessageAlert {\r\n None = 0,\r\n Dialog = 1,\r\n Balloon = 2,\r\n}\r\n\r\n/** Reason for ending the activity message via endActivityMessage\r\n * @public\r\n */\r\nexport enum ActivityMessageEndReason {\r\n Completed = 0,\r\n Cancelled = 1,\r\n}\r\n\r\n/** Describes the set of buttons displayed in a message box opened using [[NotificationManager.openMessageBox]].\r\n * @public\r\n */\r\nexport enum MessageBoxType {\r\n OkCancel,\r\n Ok,\r\n LargeOk,\r\n MediumAlert,\r\n YesNoCancel,\r\n YesNo,\r\n}\r\n\r\n/** Describes the icon displayed in a messagebox opened using [[NotificationManager.openMessageBox]].\r\n * @public\r\n */\r\nexport enum MessageBoxIconType {\r\n NoSymbol = 0, // Means Don't draw Symbol\r\n Information = 1, // Lower Case i\r\n Question = 2, // Question Mark\r\n Warning = 3, // Exclamation Point\r\n Critical = 4, // Stop Sign\r\n Success = 5, // check mark\r\n}\r\n\r\n/** Describes the possible return values produced when the user clicks a button in a messagebox opened using [[NotificationManager.openMessageBox]].\r\n * @public\r\n */\r\nexport enum MessageBoxValue {\r\n Apply = 1,\r\n Reset = 2,\r\n Ok = 3,\r\n Cancel = 4,\r\n Default = 5,\r\n Yes = 6,\r\n No = 7,\r\n Retry = 8,\r\n Stop = 9,\r\n Help = 10,\r\n YesToAll = 11,\r\n NoToAll = 12,\r\n}\r\n\r\n/** Describes the behavior of a tooltip created using [[NotificationManager.openToolTip]].\r\n * @public\r\n */\r\nexport interface ToolTipOptions {\r\n duration?: BeDuration;\r\n placement?: string;\r\n}\r\n\r\n/** Describes a message to be displayed to the user.\r\n * @public\r\n */\r\nexport class NotifyMessageDetails {\r\n public displayTime = BeDuration.fromSeconds(5);\r\n public viewport?: HTMLElement;\r\n public inputField?: HTMLElement;\r\n public displayPoint?: Point2d;\r\n public relativePosition = RelativePosition.TopRight;\r\n\r\n /** Constructor\r\n * @param priority The priority this message should be accorded by the NotificationManager.\r\n * @param briefMessage A short message that conveys the simplest explanation of the issue.\r\n * @param detailedMessage An optional comprehensive message that explains the issue in detail and potentially offers a solution.\r\n * @param msgType The type of message. Defaults to Toast.\r\n * @param openAlert Whether an alert box should be displayed or not, and if so what kind.\r\n */\r\n public constructor(public priority: OutputMessagePriority, public briefMessage: HTMLElement | string,\r\n public detailedMessage?: HTMLElement | string, public msgType = OutputMessageType.Toast, public openAlert = OutputMessageAlert.None) { }\r\n\r\n /** Set OutputMessageType.Pointer message details.\r\n * @param viewport Viewport over which to display the Pointer type message.\r\n * @param displayPoint Point at which to display the Pointer type message.\r\n * @param relativePosition Position relative to displayPoint at which to display the Pointer type message.\r\n */\r\n public setPointerTypeDetails(viewport: HTMLElement, displayPoint: XAndY, relativePosition = RelativePosition.TopRight) {\r\n this.viewport = viewport;\r\n this.displayPoint = Point2d.fromJSON(displayPoint);\r\n this.relativePosition = relativePosition;\r\n this.msgType = OutputMessageType.Pointer;\r\n }\r\n\r\n /** Set OutputMessageType.InputField message details.\r\n * @param inputField Input field to which the message pertains. The message will be shown just below this input field element.\r\n */\r\n public setInputFieldTypeDetails(inputField: HTMLElement) {\r\n this.inputField = inputField;\r\n this.msgType = OutputMessageType.InputField;\r\n }\r\n}\r\n\r\n/** Specifies the details of an activity message to be displayed to the user.\r\n * @public\r\n */\r\nexport class ActivityMessageDetails {\r\n public wasCancelled = false;\r\n\r\n /**\r\n * @param showProgressBar Indicates whether to show the progress bar in the activity message dialog.\r\n * @param showPercentInMessage Indicates whether to show the percentage complete in the activity message text.\r\n * @param supportsCancellation Indicates whether to show the Cancel button, giving the user the ability to cancel the operation.\r\n * @param showDialogInitially Indicates whether to show the activity message dialog initially. User can click status bar to open it.\r\n */\r\n public constructor(public showProgressBar: boolean, public showPercentInMessage: boolean, public supportsCancellation: boolean, public showDialogInitially: boolean = true) { }\r\n\r\n /** Called from NotificationAdmin when the user cancels the activity. */\r\n public onActivityCancelled() { this.wasCancelled = true; }\r\n\r\n /** Called from NotificationAdmin when the activity completes successfully. */\r\n public onActivityCompleted() { this.wasCancelled = false; }\r\n}\r\n\r\n/** The NotificationManager controls the interaction with the user for prompts, error messages, and alert dialogs.\r\n * Implementations of the NotificationManager may present the information in different ways. For example, in\r\n * non-interactive sessions, these messages may be saved to a log file or simply discarded.\r\n * @public\r\n */\r\nexport class NotificationManager implements MessagePresenter {\r\n public readonly toolTipLocation = new Point2d();\r\n\r\n /** Output a prompt, given a localization key.\r\n * @param key The key of the localized string with the prompt message.\r\n */\r\n public outputPromptByKey(key: string) { this.outputPrompt(IModelApp.localization.getLocalizedString(key)); }\r\n\r\n /** Output a localized prompt to the user. A 'prompt' indicates an action the user should take to proceed.\r\n * @param _prompt The localized string with the prompt message.\r\n */\r\n public outputPrompt(_prompt: string) { }\r\n\r\n /** Output a message and/or alert to the user. */\r\n public outputMessage(_message: NotifyMessageDetails) { }\r\n\r\n /** Output a MessageBox and wait for response from the user.\r\n * @param _mbType The MessageBox type.\r\n * @param _message The message to display.\r\n * @param _icon The MessageBox icon type.\r\n * @return the response from the user.\r\n */\r\n public async openMessageBox(_mbType: MessageBoxType, _message: HTMLElement | string, _icon: MessageBoxIconType): Promise<MessageBoxValue> { return MessageBoxValue.Ok; }\r\n\r\n /**\r\n * Set up for activity messages.\r\n * @param _details The activity message details.\r\n * @return true if the message was displayed, false if an invalid priority is specified.\r\n */\r\n public setupActivityMessage(_details: ActivityMessageDetails) { return true; }\r\n\r\n /**\r\n * Output an activity message to the user.\r\n * @param _messageText The message text.\r\n * @param _percentComplete The percentage of completion.\r\n * @return true if the message was displayed, false if the message could not be displayed.\r\n */\r\n public outputActivityMessage(_messageText: HTMLElement | string, _percentComplete: number) { return true; }\r\n\r\n /**\r\n * End an activity message.\r\n * @param _reason The reason for the end of the Activity Message.\r\n * @return true if the message was ended successfully, false if the activityMessage could not be ended.\r\n */\r\n public endActivityMessage(_reason: ActivityMessageEndReason) { return true; }\r\n\r\n /** Return true if _showTooltip has an implementation and will display a tooltip. */\r\n public get isToolTipSupported(): boolean { return false; }\r\n\r\n /** Return true if the tooltip is currently open. */\r\n public get isToolTipOpen(): boolean { return false; }\r\n\r\n /** Implement to display a tooltip message at the specified location. */\r\n protected _showToolTip(_htmlElement: HTMLElement, _message: HTMLElement | string, _location?: XAndY, _options?: ToolTipOptions): void { }\r\n\r\n /** Show a tooltip window. Saves tooltip location for AccuSnap to test if cursor has moved far enough away to close tooltip.\r\n * @param htmlElement The HTMLElement that anchors the toolTip.\r\n * @param message What to display inside the ToolTip. May be a string or an HTMLElement.\r\n * @param location An optional location, relative to the origin of _htmlElement, for the ToolTip. If undefined, center of `htmlElement`\r\n * @param options Options that supply additional information about how the ToolTip should function.\r\n * @note If message is an HTMLElement, the notification manager will display the HTMLElement verbatim. This can represent a security\r\n * risk if any part the element is created from user input. Applications should be careful to *sanitize* any such input before\r\n * creating an HTMLElement to pass to this method.\r\n */\r\n public openToolTip(htmlElement: HTMLElement, message: HTMLElement | string, location?: XAndY, options?: ToolTipOptions): void {\r\n this.toolTipLocation.setFrom(location);\r\n this._showToolTip(htmlElement, message, location, options);\r\n }\r\n\r\n /** Clear the tooltip if it is currently open. */\r\n public clearToolTip(): void { }\r\n\r\n /** Update message position created with [[OutputMessageType.Pointer]].\r\n * @param displayPoint Point at which to display the Pointer type message.\r\n * @param relativePosition Position relative to displayPoint at which to display the Pointer type message.\r\n */\r\n public updatePointerMessage(_displayPoint: XAndY, _relativePosition = RelativePosition.TopRight): void { }\r\n\r\n /** Close message created with [[OutputMessageType.Pointer]]. */\r\n public closePointerMessage(): void { }\r\n\r\n /** Close message created with [[OutputMessageType.InputField]]. */\r\n public closeInputFieldMessage(): void { }\r\n\r\n /** Setup tool assistance instructions for a tool. The instructions include the main instruction, which includes the current prompt.\r\n * @param instructions The tool assistance instructions.\r\n */\r\n public setToolAssistance(instructions: ToolAssistanceInstructions | undefined) {\r\n this.outputPrompt(instructions ? instructions.mainInstruction.text : \"\");\r\n }\r\n\r\n /**\r\n * Displays a notification message.\r\n * @param severity The severity of the message.\r\n * @param briefMessage A short message that conveys the simplest explanation of the issue.\r\n * @param detailedMessage An optional comprehensive message that explains the issue in detail and potentially offers a solution.\r\n * @param messageType The type of message. Defaults to Toast.\r\n */\r\n public displayMessage(severity: MessageSeverity, briefMessage: HTMLElement | string, detailedMessage?: HTMLElement | string, messageType?: DisplayMessageType): void {\r\n const details = new NotifyMessageDetails(this.convertSeverityToPriority(severity), briefMessage, detailedMessage, this.convertMessageType(messageType));\r\n this.outputMessage(details);\r\n }\r\n\r\n /**\r\n * Displays an input field notification message.\r\n * @param inputField Input field to which the message pertains. The message will be shown just below this input field element.\r\n * @param severity The severity of the message.\r\n * @param briefMessage A short message that conveys the simplest explanation of the issue.\r\n * @param detailedMessage An optional comprehensive message that explains the issue in detail and potentially offers a solution.\r\n */\r\n public displayInputFieldMessage(inputField: HTMLElement, severity: MessageSeverity, briefMessage: HTMLElement | string, detailedMessage?: HTMLElement | string): void {\r\n const details = new NotifyMessageDetails(this.convertSeverityToPriority(severity), briefMessage, detailedMessage);\r\n details.setInputFieldTypeDetails(inputField);\r\n this.outputMessage(details);\r\n }\r\n\r\n private convertSeverityToPriority(severity: MessageSeverity): OutputMessagePriority {\r\n switch (severity) {\r\n case MessageSeverity.Information:\r\n return OutputMessagePriority.Info;\r\n case MessageSeverity.Warning:\r\n return OutputMessagePriority.Warning;\r\n case MessageSeverity.Error:\r\n return OutputMessagePriority.Error;\r\n case MessageSeverity.Fatal:\r\n return OutputMessagePriority.Fatal;\r\n case MessageSeverity.None:\r\n default:\r\n return OutputMessagePriority.None;\r\n }\r\n }\r\n\r\n private convertMessageType(inMessageType?: DisplayMessageType): OutputMessageType | undefined {\r\n switch (inMessageType) {\r\n case DisplayMessageType.Alert:\r\n return OutputMessageType.Alert;\r\n case DisplayMessageType.InputField:\r\n return OutputMessageType.InputField;\r\n case DisplayMessageType.Sticky:\r\n return OutputMessageType.Sticky;\r\n case DisplayMessageType.Toast:\r\n return OutputMessageType.Toast;\r\n default:\r\n return undefined;\r\n }\r\n }\r\n\r\n}\r\n"]}
|
|
@@ -8,7 +8,7 @@ exports.RealityDataSource = void 0;
|
|
|
8
8
|
/** @packageDocumentation
|
|
9
9
|
* @module Tiles
|
|
10
10
|
*/
|
|
11
|
-
const
|
|
11
|
+
const Request_1 = require("./request/Request");
|
|
12
12
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
13
13
|
const core_common_1 = require("@itwin/core-common");
|
|
14
14
|
const FrontendLoggerCategory_1 = require("./FrontendLoggerCategory");
|
|
@@ -206,7 +206,7 @@ class RealityDataSourceImpl {
|
|
|
206
206
|
},
|
|
207
207
|
};
|
|
208
208
|
}
|
|
209
|
-
const data = await (0,
|
|
209
|
+
const data = await (0, Request_1.request)(url, options);
|
|
210
210
|
return data.body;
|
|
211
211
|
}
|
|
212
212
|
/**
|
|
@@ -217,8 +217,11 @@ class RealityDataSourceImpl {
|
|
|
217
217
|
*/
|
|
218
218
|
async getRealityDataTileJson(accessToken, name, realityData) {
|
|
219
219
|
const url = await realityData.getBlobUrl(accessToken, name);
|
|
220
|
-
const data = await (0,
|
|
221
|
-
|
|
220
|
+
const data = await (0, Request_1.request)(url.toString(), {
|
|
221
|
+
method: "GET",
|
|
222
|
+
responseType: "json",
|
|
223
|
+
});
|
|
224
|
+
return data.body;
|
|
222
225
|
}
|
|
223
226
|
/**
|
|
224
227
|
* This method returns the URL to access the actual 3d tiles from the service provider.
|
|
@@ -246,8 +249,10 @@ class RealityDataSourceImpl {
|
|
|
246
249
|
}
|
|
247
250
|
else if (this.key.provider === core_common_1.RealityDataProvider.CesiumIonAsset) {
|
|
248
251
|
this._tilesetUrl = this.key.id;
|
|
249
|
-
if (this.key.id === internal_1.CesiumIonAssetProvider.osmBuildingId)
|
|
252
|
+
if (this.key.id === internal_1.CesiumIonAssetProvider.osmBuildingId) {
|
|
250
253
|
this._tilesetUrl = (0, internal_1.getCesiumOSMBuildingsUrl)();
|
|
254
|
+
this._isUrlResolved = true;
|
|
255
|
+
}
|
|
251
256
|
}
|
|
252
257
|
return this._tilesetUrl;
|
|
253
258
|
}
|
|
@@ -289,7 +294,7 @@ class RealityDataSourceImpl {
|
|
|
289
294
|
method: "GET",
|
|
290
295
|
responseType: "arraybuffer",
|
|
291
296
|
};
|
|
292
|
-
const data = await (0,
|
|
297
|
+
const data = await (0, Request_1.request)(url.toString(), options);
|
|
293
298
|
return data.body;
|
|
294
299
|
}
|
|
295
300
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RealityDataSource.js","sourceRoot":"","sources":["../../src/RealityDataSource.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,wDAAyE;AACzE,sDAAqF;AACrF,oDAAsK;AACtK,qEAAkE;AAClE,2CAAwC;AACxC,8CAA6I;AA0C7I;;GAEG;AACH,IAAiB,iBAAiB,CAyEjC;AAzED,WAAiB,iBAAiB;IAChC;;;;;;OAMG;IACH,SAAgB,gBAA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AyB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;SACzE;QAED,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IACjD,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,WAAW,CAAC,IAAY;QACnC,MAAM,KAAK,GAAG,MAAM,qBAAS,CAAC,cAAc,EAAE,CAAC;QAC/C,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,IAAI,KAAK,KAAK,SAAS,CAAC;QAC1D,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErC,IAAI,MAAM,IAAI,IAAI,CAAC,WAAW,EAAE;YAC9B,OAAO,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;SACtE;QAED,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\nimport { getJson, request, RequestOptions } from \"@bentley/itwin-client\";\r\nimport { AccessToken, BentleyStatus, GuidString, Logger } from \"@itwin/core-bentley\";\r\nimport { IModelError, OrbitGtBlobProps, RealityData, RealityDataFormat, RealityDataProvider, RealityDataSourceKey, RealityDataSourceProps } from \"@itwin/core-common\";\r\nimport { FrontendLoggerCategory } from \"./FrontendLoggerCategory\";\r\nimport { IModelApp } from \"./IModelApp\";\r\nimport { CesiumIonAssetProvider, ContextShareProvider, getCesiumAccessTokenAndEndpointUrl, getCesiumOSMBuildingsUrl } from \"./tile/internal\";\r\n\r\n/**\r\n * This interface provide methods used to access a reality data from a reality data provider\r\n * @beta\r\n */\r\nexport interface RealityDataSource {\r\n readonly key: RealityDataSourceKey;\r\n readonly isContextShare: boolean;\r\n readonly realityDataId: string | undefined;\r\n /** Metatdata on the reality data source */\r\n readonly realityData: RealityData | undefined;\r\n /** The reality data type (e.g.: \"RealityMesh3DTiles\", OPC, Terrain3DTiles, Cesium3DTiles, ... )*/\r\n readonly realityDataType: string | undefined;\r\n /**\r\n * This method returns the URL to obtain the Reality Data properties.\r\n * @param iTwinId id of associated iTwin project\r\n * @returns string containing the URL to reality data.\r\n */\r\n getServiceUrl(iTwinId: GuidString | undefined): Promise<string | undefined>;\r\n\r\n /**\r\n * Gets a reality data root document json\r\n * @returns tile data json\r\n * @internal\r\n */\r\n getRootDocument(iTwinId: GuidString | undefined): Promise<any>;\r\n /**\r\n * Gets tile content\r\n * @param name name or path of tile\r\n * @returns array buffer of tile content\r\n * @internal\r\n */\r\n getTileContent(name: string): Promise<any>;\r\n /**\r\n * Gets a tileset's app data json\r\n * @param name name or path of tile\r\n * @returns app data json object\r\n * @internal\r\n */\r\n getTileJson(name: string): Promise<any>;\r\n}\r\n/** Utility functions for RealityDataSource\r\n * @beta\r\n */\r\nexport namespace RealityDataSource {\r\n /**\r\n * Create a RealityDataSourceKey from a tilesetUrl.\r\n * @param tilesetUrl the reality data attachment url\r\n * @param inputProvider identify the RealityDataProvider if known, otherwise function will try to extract it from the tilesetUrl\r\n * @param inputFormat identify the RealityDataFormat if known, otherwise function will try to extract it from the tilesetUrl\r\n * @returns the RealityDataSourceKey that uniquely identify a reality data for a provider\r\n */\r\n export function createKeyFromUrl(tilesetUrl: string, inputProvider?: RealityDataProvider, inputFormat?: RealityDataFormat): RealityDataSourceKey {\r\n let format = inputFormat ? inputFormat : RealityDataFormat.fromUrl(tilesetUrl);\r\n if (CesiumIonAssetProvider.isProviderUrl(tilesetUrl)) {\r\n const provider = RealityDataProvider.CesiumIonAsset;\r\n // Keep url hidden and use a dummy id\r\n const cesiumIonAssetKey: RealityDataSourceKey = { provider, format, id: CesiumIonAssetProvider.osmBuildingId };\r\n return cesiumIonAssetKey;\r\n }\r\n\r\n // Try to extract realityDataId from URL and if not possible, use the url as the key\r\n if (ContextShareProvider.isProviderUrl(tilesetUrl)) {\r\n const info = ContextShareProvider.getInfoFromUrl(tilesetUrl);\r\n const provider = inputProvider ? inputProvider : info.provider;\r\n format = inputFormat ? inputFormat : info.format;\r\n const contextShareKey: RealityDataSourceKey = { provider, format, id: info.id, iTwinId: info.iTwinId };\r\n return contextShareKey;\r\n }\r\n\r\n // default to tileSetUrl\r\n const provider2 = inputProvider ? inputProvider : RealityDataProvider.TilesetUrl;\r\n const urlKey: RealityDataSourceKey = { provider: provider2, format, id: tilesetUrl };\r\n return urlKey;\r\n }\r\n /** @alpha - was used for a very specific case of point cloud (opc) attachment that should not be made public */\r\n export function createKeyFromBlobUrl(blobUrl: string, inputProvider?: RealityDataProvider, inputFormat?: RealityDataFormat): RealityDataSourceKey {\r\n const info = ContextShareProvider.getInfoFromBlobUrl(blobUrl);\r\n const format = inputFormat ? inputFormat : info.format;\r\n const provider = inputProvider ? inputProvider : info.provider;\r\n const contextShareKey: RealityDataSourceKey = { provider, format, id: info.id };\r\n return contextShareKey;\r\n }\r\n /** @alpha - OrbitGtBlobProps is alpha */\r\n export function createKeyFromOrbitGtBlobProps(orbitGtBlob: OrbitGtBlobProps, inputProvider?: RealityDataProvider, inputFormat?: RealityDataFormat): RealityDataSourceKey {\r\n const format = inputFormat ? inputFormat : RealityDataFormat.OPC;\r\n if(orbitGtBlob.blobFileName && orbitGtBlob.blobFileName.toLowerCase().startsWith(\"http\")) {\r\n return RealityDataSource.createKeyFromBlobUrl(orbitGtBlob.blobFileName,inputProvider,format);\r\n } else if (orbitGtBlob.rdsUrl) {\r\n return RealityDataSource.createKeyFromUrl(orbitGtBlob.rdsUrl,inputProvider,format);\r\n }\r\n const provider = inputProvider ? inputProvider : RealityDataProvider.OrbitGtBlob;\r\n const id = `${orbitGtBlob.accountName}:${orbitGtBlob.containerName}:${orbitGtBlob.blobFileName}:?${orbitGtBlob.sasToken}`;\r\n return { provider, format, id };\r\n }\r\n /** @alpha - OrbitGtBlobProps is alpha */\r\n export function createOrbitGtBlobPropsFromKey(rdSourceKey: RealityDataSourceKey): OrbitGtBlobProps | undefined {\r\n if (rdSourceKey.provider !== RealityDataProvider.OrbitGtBlob)\r\n return undefined;\r\n const splitIds = rdSourceKey.id.split(\":\");\r\n const sasTokenIndex = rdSourceKey.id.indexOf(\":?\");\r\n const sasToken = rdSourceKey.id.substr(sasTokenIndex+2);\r\n const orbitGtBlob: OrbitGtBlobProps = {\r\n accountName: splitIds[0],\r\n containerName: splitIds[1],\r\n blobFileName: splitIds[2],\r\n sasToken,\r\n };\r\n return orbitGtBlob;\r\n }\r\n /** Return an instance of a RealityDataSource from a source key.\r\n * There will aways be only one reality data RealityDataSource for a corresponding reality data source key.\r\n * @internal\r\n */\r\n export async function fromKey(rdSourceKey: RealityDataSourceKey, iTwinId: GuidString | undefined): Promise<RealityDataSource | undefined> {\r\n return RealityDataSourceImpl.fromKey(rdSourceKey, iTwinId);\r\n }\r\n}\r\n\r\n/** This class provides access to the reality data provider services.\r\n * It encapsulates access to a reality data weiter it be from local access, http or ProjectWise Context Share.\r\n * The key provided at the creation determines if this is ProjectWise Context Share reference.\r\n * If not then it is considered local (ex: C:\\temp\\TileRoot.json) or plain http access (http://someserver.com/data/TileRoot.json)\r\n * There is a one to one relationship between a reality data and the instances of present class.\r\n* @beta\r\n*/\r\nclass RealityDataSourceImpl implements RealityDataSource {\r\n public readonly key: RealityDataSourceKey;\r\n /** The URL that supplies the 3d tiles for displaying the reality model. */\r\n private _tilesetUrl: string | undefined;\r\n private _isUrlResolved: boolean = false;\r\n private _rd: RealityData | undefined;\r\n /** For use by all Reality Data. For RD stored on PW Context Share, represents the portion from the root of the Azure Blob Container*/\r\n private _baseUrl: string = \"\";\r\n /** Request authorization for non PW ContextShare requests.*/\r\n private _requestAuthorization?: string;\r\n\r\n /** Construct a new reality data source.\r\n * @param props JSON representation of the reality data source\r\n */\r\n protected constructor(props: RealityDataSourceProps) {\r\n this.key = props.sourceKey;\r\n this._isUrlResolved=false;\r\n }\r\n\r\n /** Construct a new reality data source.\r\n * @param props JSON representation of the reality data source\r\n */\r\n public static fromProps(props: RealityDataSourceProps): RealityDataSource {\r\n return new RealityDataSourceImpl(props);\r\n }\r\n /**\r\n * Create an instance of this class from a source key and iTwin context/\r\n */\r\n public static async createFromKey(sourceKey: RealityDataSourceKey, iTwinId: GuidString | undefined): Promise<RealityDataSource | undefined> {\r\n const rdSource = new RealityDataSourceImpl({sourceKey});\r\n let tilesetUrl: string | undefined;\r\n try {\r\n await rdSource.queryRealityData(iTwinId);\r\n tilesetUrl = await rdSource.getServiceUrl(iTwinId);\r\n } catch (e) {\r\n }\r\n\r\n return (tilesetUrl !== undefined) ? rdSource: undefined;\r\n }\r\n /** Return an instance of a RealityDataSource from a source key.\r\n */\r\n public static async fromKey(rdSourceKey: RealityDataSourceKey, iTwinId: GuidString | undefined): Promise<RealityDataSource | undefined> {\r\n return RealityDataSourceImpl.createFromKey(rdSourceKey, iTwinId);\r\n }\r\n public get isContextShare(): boolean {\r\n return (this.key.provider === RealityDataProvider.ContextShare);\r\n }\r\n /**\r\n * Returns Reality Data if available\r\n */\r\n public get realityData(): RealityData | undefined {\r\n return this._rd;\r\n }\r\n public get realityDataId(): string | undefined {\r\n const realityDataId = this.isContextShare ? this.key.id : undefined;\r\n return realityDataId;\r\n }\r\n /**\r\n * Returns Reality Data type if available\r\n */\r\n public get realityDataType(): string | undefined {\r\n return this._rd?.type;\r\n }\r\n public get iTwinId(): string | undefined {\r\n return this.key.iTwinId;\r\n }\r\n /**\r\n * Query Reality Data from provider\r\n */\r\n private async queryRealityData(iTwinId: GuidString | undefined) {\r\n if (this.isContextShare && !this._rd) {\r\n const token = await IModelApp.getAccessToken();\r\n if (token && this.realityDataId) {\r\n if (undefined === IModelApp.realityDataAccess)\r\n throw new Error(\"Missing an implementation of RealityDataAccess on IModelApp, it is required to access reality data. Please provide an implementation to the IModelApp.startup using IModelAppOptions.realityDataAccess.\");\r\n this._rd = await IModelApp.realityDataAccess.getRealityData(token, iTwinId, this.realityDataId);\r\n // A reality data that has not root document set should not be considered.\r\n const rootDocument: string = this._rd.rootDocument ?? \"\";\r\n this.setBaseUrl(rootDocument);\r\n }\r\n }\r\n }\r\n // This is to set the root url from the provided root document path.\r\n // If the root document is stored on PW Context Share then the root document property of the Reality Data is provided,\r\n // otherwise the full path to root document is given.\r\n // The base URL contains the base URL from which tile relative path are constructed.\r\n // The tile's path root will need to be reinserted for child tiles to return a 200\r\n private setBaseUrl(url: string): void {\r\n const urlParts = url.split(\"/\");\r\n urlParts.pop();\r\n if (urlParts.length === 0)\r\n this._baseUrl = \"\";\r\n else\r\n this._baseUrl = `${urlParts.join(\"/\")}/`;\r\n }\r\n private async _doRequest(url: string, responseType: string): Promise<any> {\r\n let options: RequestOptions = {\r\n method: \"GET\",\r\n responseType,\r\n };\r\n\r\n const authToken = this._requestAuthorization;\r\n if (authToken) {\r\n options = {\r\n ...options,\r\n headers: {\r\n authorization: authToken,\r\n },\r\n };\r\n }\r\n\r\n const data = await request(url, options);\r\n return data.body;\r\n }\r\n /**\r\n * Gets a tileset's app data json\r\n * @param name name or path of tile\r\n * @returns app data json object\r\n * @internal\r\n */\r\n public async getRealityDataTileJson(accessToken: AccessToken, name: string, realityData: RealityData): Promise<any> {\r\n const url = await realityData.getBlobUrl(accessToken, name);\r\n\r\n const data = await getJson(url.toString());\r\n return data;\r\n }\r\n /**\r\n * This method returns the URL to access the actual 3d tiles from the service provider.\r\n * @returns string containing the URL to reality data.\r\n */\r\n public async getServiceUrl(iTwinId: GuidString | undefined): Promise<string | undefined> {\r\n // If url was not resolved - resolve it\r\n if (this.isContextShare && !this._isUrlResolved) {\r\n const rdSourceKey = this.key;\r\n // we need to resolve tilesetURl from realityDataId and iTwinId\r\n if (undefined === IModelApp.realityDataAccess)\r\n throw new Error(\"Missing an implementation of RealityDataAccess on IModelApp, it is required to access reality data. Please provide an implementation to the IModelApp.startup using IModelAppOptions.realityDataAccess.\");\r\n try {\r\n const resolvedITwinId = iTwinId ? iTwinId : rdSourceKey.iTwinId;\r\n\r\n this._tilesetUrl = await IModelApp.realityDataAccess.getRealityDataUrl(resolvedITwinId, rdSourceKey.id);\r\n this._isUrlResolved=true;\r\n } catch (e) {\r\n const errMsg = `Error getting URL from ContextShare using realityDataId=${rdSourceKey.id} and iTwinId=${iTwinId}`;\r\n Logger.logError(FrontendLoggerCategory.RealityData, errMsg);\r\n }\r\n } else if (this.key.provider === RealityDataProvider.TilesetUrl) {\r\n this._tilesetUrl = this.key.id;\r\n } else if (this.key.provider === RealityDataProvider.CesiumIonAsset ) {\r\n this._tilesetUrl = this.key.id;\r\n if (this.key.id === CesiumIonAssetProvider.osmBuildingId)\r\n this._tilesetUrl = getCesiumOSMBuildingsUrl();\r\n }\r\n return this._tilesetUrl;\r\n }\r\n /** TODO: This probably required three different realitydataSource implementations based on different provider -> locally hosted, RDS and cesium */\r\n public async getRootDocument(iTwinId: GuidString | undefined): Promise<any> {\r\n const token = await IModelApp.getAccessToken();\r\n if (this.isContextShare && token) {\r\n const realityData = this.realityData;\r\n\r\n if (!realityData)\r\n throw new Error(`Reality Data not defined`);\r\n\r\n if (!realityData.rootDocument)\r\n throw new Error(`Root document not defined for reality data: ${realityData.id}`);\r\n\r\n return this.getRealityDataTileJson(token, realityData.rootDocument, realityData);\r\n }\r\n\r\n let url = await this.getServiceUrl(iTwinId);\r\n if (!url)\r\n throw new IModelError(BentleyStatus.ERROR, \"Unable to get service url\");\r\n\r\n // The following is only if the reality data is not stored on PW Context Share.\r\n const cesiumAsset = CesiumIonAssetProvider.parseCesiumUrl(url);\r\n if (cesiumAsset) {\r\n const tokenAndUrl = await getCesiumAccessTokenAndEndpointUrl(cesiumAsset.id, cesiumAsset.key);\r\n if (tokenAndUrl.url && tokenAndUrl.token) {\r\n url = tokenAndUrl.url;\r\n this._requestAuthorization = `Bearer ${tokenAndUrl.token}`;\r\n }\r\n }\r\n\r\n // The following is only if the reality data is not stored on PW Context Share.\r\n this.setBaseUrl(url);\r\n return this._doRequest(url, \"json\");\r\n }\r\n\r\n /**\r\n * Gets tile content\r\n * @param name name or path of tile\r\n * @returns array buffer of tile content\r\n */\r\n public async getRealityDataTileContent(accessToken: AccessToken, name: string, realityData: RealityData): Promise<any> {\r\n const url = await realityData.getBlobUrl(accessToken, name);\r\n const options: RequestOptions = {\r\n method: \"GET\",\r\n responseType: \"arraybuffer\",\r\n };\r\n const data = await request(url.toString(), options);\r\n return data.body;\r\n }\r\n\r\n /**\r\n * TODO: This probably required different realitydataSource implementations based on different provider -> locally hosted, RDS and cesium\r\n * Returns the tile content. The path to the tile is relative to the base url of present reality data whatever the type.\r\n */\r\n public async getTileContent(name: string): Promise<any> {\r\n const token = await IModelApp.getAccessToken();\r\n const useRds = this.isContextShare && token !== undefined;\r\n const tileUrl = this._baseUrl + name;\r\n\r\n if (useRds && this.realityData) {\r\n return this.getRealityDataTileContent(token, tileUrl, this.realityData);\r\n }\r\n\r\n return this._doRequest(tileUrl, \"arraybuffer\");\r\n }\r\n\r\n /**\r\n * TODO: This probably required different realitydataSource implementations based on different provider -> locally hosted, RDS and cesium\r\n * Returns the tile content in json format. The path to the tile is relative to the base url of present reality data whatever the type.\r\n */\r\n public async getTileJson(name: string): Promise<any> {\r\n const token = await IModelApp.getAccessToken();\r\n const useRds = this.isContextShare && token !== undefined;\r\n const tileUrl = this._baseUrl + name;\r\n\r\n if (useRds && this.realityData) {\r\n return this.getRealityDataTileJson(token, tileUrl, this.realityData);\r\n }\r\n\r\n return this._doRequest(tileUrl, \"json\");\r\n }\r\n}\r\n\r\n"]}
|
|
1
|
+
{"version":3,"file":"RealityDataSource.js","sourceRoot":"","sources":["../../src/RealityDataSource.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,+CAA4D;AAC5D,sDAAqF;AACrF,oDAAsK;AACtK,qEAAkE;A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GAAG,MAAM,qBAAS,CAAC,cAAc,EAAE,CAAC;QAC/C,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,IAAI,KAAK,KAAK,SAAS,CAAC;QAC1D,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErC,IAAI,MAAM,IAAI,IAAI,CAAC,WAAW,EAAE;YAC9B,OAAO,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;SACzE;QAED,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IACjD,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,WAAW,CAAC,IAAY;QACnC,MAAM,KAAK,GAAG,MAAM,qBAAS,CAAC,cAAc,EAAE,CAAC;QAC/C,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,IAAI,KAAK,KAAK,SAAS,CAAC;QAC1D,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErC,IAAI,MAAM,IAAI,IAAI,CAAC,WAAW,EAAE;YAC9B,OAAO,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;SACtE;QAED,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\nimport { request, RequestOptions } from \"./request/Request\";\r\nimport { AccessToken, BentleyStatus, GuidString, Logger } from \"@itwin/core-bentley\";\r\nimport { IModelError, OrbitGtBlobProps, RealityData, RealityDataFormat, RealityDataProvider, RealityDataSourceKey, RealityDataSourceProps } from \"@itwin/core-common\";\r\nimport { FrontendLoggerCategory } from \"./FrontendLoggerCategory\";\r\nimport { IModelApp } from \"./IModelApp\";\r\nimport { CesiumIonAssetProvider, ContextShareProvider, getCesiumAccessTokenAndEndpointUrl, getCesiumOSMBuildingsUrl } from \"./tile/internal\";\r\n\r\n/**\r\n * This interface provide methods used to access a reality data from a reality data provider\r\n * @beta\r\n */\r\nexport interface RealityDataSource {\r\n readonly key: RealityDataSourceKey;\r\n readonly isContextShare: boolean;\r\n readonly realityDataId: string | undefined;\r\n /** Metatdata on the reality data source */\r\n readonly realityData: RealityData | undefined;\r\n /** The reality data type (e.g.: \"RealityMesh3DTiles\", OPC, Terrain3DTiles, Cesium3DTiles, ... )*/\r\n readonly realityDataType: string | undefined;\r\n /**\r\n * This method returns the URL to obtain the Reality Data properties.\r\n * @param iTwinId id of associated iTwin project\r\n * @returns string containing the URL to reality data.\r\n */\r\n getServiceUrl(iTwinId: GuidString | undefined): Promise<string | undefined>;\r\n\r\n /**\r\n * Gets a reality data root document json\r\n * @returns tile data json\r\n * @internal\r\n */\r\n getRootDocument(iTwinId: GuidString | undefined): Promise<any>;\r\n /**\r\n * Gets tile content\r\n * @param name name or path of tile\r\n * @returns array buffer of tile content\r\n * @internal\r\n */\r\n getTileContent(name: string): Promise<any>;\r\n /**\r\n * Gets a tileset's app data json\r\n * @param name name or path of tile\r\n * @returns app data json object\r\n * @internal\r\n */\r\n getTileJson(name: string): Promise<any>;\r\n}\r\n/** Utility functions for RealityDataSource\r\n * @beta\r\n */\r\nexport namespace RealityDataSource {\r\n /**\r\n * Create a RealityDataSourceKey from a tilesetUrl.\r\n * @param tilesetUrl the reality data attachment url\r\n * @param inputProvider identify the RealityDataProvider if known, otherwise function will try to extract it from the tilesetUrl\r\n * @param inputFormat identify the RealityDataFormat if known, otherwise function will try to extract it from the tilesetUrl\r\n * @returns the RealityDataSourceKey that uniquely identify a reality data for a provider\r\n */\r\n export function createKeyFromUrl(tilesetUrl: string, inputProvider?: RealityDataProvider, inputFormat?: RealityDataFormat): RealityDataSourceKey {\r\n let format = inputFormat ? inputFormat : RealityDataFormat.fromUrl(tilesetUrl);\r\n if (CesiumIonAssetProvider.isProviderUrl(tilesetUrl)) {\r\n const provider = RealityDataProvider.CesiumIonAsset;\r\n // Keep url hidden and use a dummy id\r\n const cesiumIonAssetKey: RealityDataSourceKey = { provider, format, id: CesiumIonAssetProvider.osmBuildingId };\r\n return cesiumIonAssetKey;\r\n }\r\n\r\n // Try to extract realityDataId from URL and if not possible, use the url as the key\r\n if (ContextShareProvider.isProviderUrl(tilesetUrl)) {\r\n const info = ContextShareProvider.getInfoFromUrl(tilesetUrl);\r\n const provider = inputProvider ? inputProvider : info.provider;\r\n format = inputFormat ? inputFormat : info.format;\r\n const contextShareKey: RealityDataSourceKey = { provider, format, id: info.id, iTwinId: info.iTwinId };\r\n return contextShareKey;\r\n }\r\n\r\n // default to tileSetUrl\r\n const provider2 = inputProvider ? inputProvider : RealityDataProvider.TilesetUrl;\r\n const urlKey: RealityDataSourceKey = { provider: provider2, format, id: tilesetUrl };\r\n return urlKey;\r\n }\r\n /** @alpha - was used for a very specific case of point cloud (opc) attachment that should not be made public */\r\n export function createKeyFromBlobUrl(blobUrl: string, inputProvider?: RealityDataProvider, inputFormat?: RealityDataFormat): RealityDataSourceKey {\r\n const info = ContextShareProvider.getInfoFromBlobUrl(blobUrl);\r\n const format = inputFormat ? inputFormat : info.format;\r\n const provider = inputProvider ? inputProvider : info.provider;\r\n const contextShareKey: RealityDataSourceKey = { provider, format, id: info.id };\r\n return contextShareKey;\r\n }\r\n /** @alpha - OrbitGtBlobProps is alpha */\r\n export function createKeyFromOrbitGtBlobProps(orbitGtBlob: OrbitGtBlobProps, inputProvider?: RealityDataProvider, inputFormat?: RealityDataFormat): RealityDataSourceKey {\r\n const format = inputFormat ? inputFormat : RealityDataFormat.OPC;\r\n if (orbitGtBlob.blobFileName && orbitGtBlob.blobFileName.toLowerCase().startsWith(\"http\")) {\r\n return RealityDataSource.createKeyFromBlobUrl(orbitGtBlob.blobFileName, inputProvider, format);\r\n } else if (orbitGtBlob.rdsUrl) {\r\n return RealityDataSource.createKeyFromUrl(orbitGtBlob.rdsUrl, inputProvider, format);\r\n }\r\n const provider = inputProvider ? inputProvider : RealityDataProvider.OrbitGtBlob;\r\n const id = `${orbitGtBlob.accountName}:${orbitGtBlob.containerName}:${orbitGtBlob.blobFileName}:?${orbitGtBlob.sasToken}`;\r\n return { provider, format, id };\r\n }\r\n /** @alpha - OrbitGtBlobProps is alpha */\r\n export function createOrbitGtBlobPropsFromKey(rdSourceKey: RealityDataSourceKey): OrbitGtBlobProps | undefined {\r\n if (rdSourceKey.provider !== RealityDataProvider.OrbitGtBlob)\r\n return undefined;\r\n const splitIds = rdSourceKey.id.split(\":\");\r\n const sasTokenIndex = rdSourceKey.id.indexOf(\":?\");\r\n const sasToken = rdSourceKey.id.substr(sasTokenIndex + 2);\r\n const orbitGtBlob: OrbitGtBlobProps = {\r\n accountName: splitIds[0],\r\n containerName: splitIds[1],\r\n blobFileName: splitIds[2],\r\n sasToken,\r\n };\r\n return orbitGtBlob;\r\n }\r\n /** Return an instance of a RealityDataSource from a source key.\r\n * There will aways be only one reality data RealityDataSource for a corresponding reality data source key.\r\n * @internal\r\n */\r\n export async function fromKey(rdSourceKey: RealityDataSourceKey, iTwinId: GuidString | undefined): Promise<RealityDataSource | undefined> {\r\n return RealityDataSourceImpl.fromKey(rdSourceKey, iTwinId);\r\n }\r\n}\r\n\r\n/** This class provides access to the reality data provider services.\r\n * It encapsulates access to a reality data weiter it be from local access, http or ProjectWise Context Share.\r\n * The key provided at the creation determines if this is ProjectWise Context Share reference.\r\n * If not then it is considered local (ex: C:\\temp\\TileRoot.json) or plain http access (http://someserver.com/data/TileRoot.json)\r\n * There is a one to one relationship between a reality data and the instances of present class.\r\n* @beta\r\n*/\r\nclass RealityDataSourceImpl implements RealityDataSource {\r\n public readonly key: RealityDataSourceKey;\r\n /** The URL that supplies the 3d tiles for displaying the reality model. */\r\n private _tilesetUrl: string | undefined;\r\n private _isUrlResolved: boolean = false;\r\n private _rd: RealityData | undefined;\r\n /** For use by all Reality Data. For RD stored on PW Context Share, represents the portion from the root of the Azure Blob Container*/\r\n private _baseUrl: string = \"\";\r\n /** Request authorization for non PW ContextShare requests.*/\r\n private _requestAuthorization?: string;\r\n\r\n /** Construct a new reality data source.\r\n * @param props JSON representation of the reality data source\r\n */\r\n protected constructor(props: RealityDataSourceProps) {\r\n this.key = props.sourceKey;\r\n this._isUrlResolved = false;\r\n }\r\n\r\n /** Construct a new reality data source.\r\n * @param props JSON representation of the reality data source\r\n */\r\n public static fromProps(props: RealityDataSourceProps): RealityDataSource {\r\n return new RealityDataSourceImpl(props);\r\n }\r\n /**\r\n * Create an instance of this class from a source key and iTwin context/\r\n */\r\n public static async createFromKey(sourceKey: RealityDataSourceKey, iTwinId: GuidString | undefined): Promise<RealityDataSource | undefined> {\r\n const rdSource = new RealityDataSourceImpl({ sourceKey });\r\n let tilesetUrl: string | undefined;\r\n try {\r\n await rdSource.queryRealityData(iTwinId);\r\n tilesetUrl = await rdSource.getServiceUrl(iTwinId);\r\n } catch (e) {\r\n }\r\n\r\n return (tilesetUrl !== undefined) ? rdSource : undefined;\r\n }\r\n /** Return an instance of a RealityDataSource from a source key.\r\n */\r\n public static async fromKey(rdSourceKey: RealityDataSourceKey, iTwinId: GuidString | undefined): Promise<RealityDataSource | undefined> {\r\n return RealityDataSourceImpl.createFromKey(rdSourceKey, iTwinId);\r\n }\r\n public get isContextShare(): boolean {\r\n return (this.key.provider === RealityDataProvider.ContextShare);\r\n }\r\n /**\r\n * Returns Reality Data if available\r\n */\r\n public get realityData(): RealityData | undefined {\r\n return this._rd;\r\n }\r\n public get realityDataId(): string | undefined {\r\n const realityDataId = this.isContextShare ? this.key.id : undefined;\r\n return realityDataId;\r\n }\r\n /**\r\n * Returns Reality Data type if available\r\n */\r\n public get realityDataType(): string | undefined {\r\n return this._rd?.type;\r\n }\r\n public get iTwinId(): string | undefined {\r\n return this.key.iTwinId;\r\n }\r\n /**\r\n * Query Reality Data from provider\r\n */\r\n private async queryRealityData(iTwinId: GuidString | undefined) {\r\n if (this.isContextShare && !this._rd) {\r\n const token = await IModelApp.getAccessToken();\r\n if (token && this.realityDataId) {\r\n if (undefined === IModelApp.realityDataAccess)\r\n throw new Error(\"Missing an implementation of RealityDataAccess on IModelApp, it is required to access reality data. Please provide an implementation to the IModelApp.startup using IModelAppOptions.realityDataAccess.\");\r\n this._rd = await IModelApp.realityDataAccess.getRealityData(token, iTwinId, this.realityDataId);\r\n // A reality data that has not root document set should not be considered.\r\n const rootDocument: string = this._rd.rootDocument ?? \"\";\r\n this.setBaseUrl(rootDocument);\r\n }\r\n }\r\n }\r\n // This is to set the root url from the provided root document path.\r\n // If the root document is stored on PW Context Share then the root document property of the Reality Data is provided,\r\n // otherwise the full path to root document is given.\r\n // The base URL contains the base URL from which tile relative path are constructed.\r\n // The tile's path root will need to be reinserted for child tiles to return a 200\r\n private setBaseUrl(url: string): void {\r\n const urlParts = url.split(\"/\");\r\n urlParts.pop();\r\n if (urlParts.length === 0)\r\n this._baseUrl = \"\";\r\n else\r\n this._baseUrl = `${urlParts.join(\"/\")}/`;\r\n }\r\n private async _doRequest(url: string, responseType: string): Promise<any> {\r\n let options: RequestOptions = {\r\n method: \"GET\",\r\n responseType,\r\n };\r\n\r\n const authToken = this._requestAuthorization;\r\n if (authToken) {\r\n options = {\r\n ...options,\r\n headers: {\r\n authorization: authToken,\r\n },\r\n };\r\n }\r\n\r\n const data = await request(url, options);\r\n return data.body;\r\n }\r\n /**\r\n * Gets a tileset's app data json\r\n * @param name name or path of tile\r\n * @returns app data json object\r\n * @internal\r\n */\r\n public async getRealityDataTileJson(accessToken: AccessToken, name: string, realityData: RealityData): Promise<any> {\r\n const url = await realityData.getBlobUrl(accessToken, name);\r\n\r\n const data = await request(url.toString(), {\r\n method: \"GET\",\r\n responseType: \"json\",\r\n });\r\n return data.body;\r\n }\r\n\r\n /**\r\n * This method returns the URL to access the actual 3d tiles from the service provider.\r\n * @returns string containing the URL to reality data.\r\n */\r\n public async getServiceUrl(iTwinId: GuidString | undefined): Promise<string | undefined> {\r\n // If url was not resolved - resolve it\r\n if (this.isContextShare && !this._isUrlResolved) {\r\n const rdSourceKey = this.key;\r\n // we need to resolve tilesetURl from realityDataId and iTwinId\r\n if (undefined === IModelApp.realityDataAccess)\r\n throw new Error(\"Missing an implementation of RealityDataAccess on IModelApp, it is required to access reality data. Please provide an implementation to the IModelApp.startup using IModelAppOptions.realityDataAccess.\");\r\n try {\r\n const resolvedITwinId = iTwinId ? iTwinId : rdSourceKey.iTwinId;\r\n\r\n this._tilesetUrl = await IModelApp.realityDataAccess.getRealityDataUrl(resolvedITwinId, rdSourceKey.id);\r\n this._isUrlResolved = true;\r\n } catch (e) {\r\n const errMsg = `Error getting URL from ContextShare using realityDataId=${rdSourceKey.id} and iTwinId=${iTwinId}`;\r\n Logger.logError(FrontendLoggerCategory.RealityData, errMsg);\r\n }\r\n } else if (this.key.provider === RealityDataProvider.TilesetUrl) {\r\n this._tilesetUrl = this.key.id;\r\n } else if (this.key.provider === RealityDataProvider.CesiumIonAsset) {\r\n this._tilesetUrl = this.key.id;\r\n if (this.key.id === CesiumIonAssetProvider.osmBuildingId) {\r\n this._tilesetUrl = getCesiumOSMBuildingsUrl();\r\n this._isUrlResolved = true;\r\n }\r\n }\r\n return this._tilesetUrl;\r\n }\r\n /** TODO: This probably required three different realitydataSource implementations based on different provider -> locally hosted, RDS and cesium */\r\n public async getRootDocument(iTwinId: GuidString | undefined): Promise<any> {\r\n const token = await IModelApp.getAccessToken();\r\n if (this.isContextShare && token) {\r\n const realityData = this.realityData;\r\n\r\n if (!realityData)\r\n throw new Error(`Reality Data not defined`);\r\n\r\n if (!realityData.rootDocument)\r\n throw new Error(`Root document not defined for reality data: ${realityData.id}`);\r\n\r\n return this.getRealityDataTileJson(token, realityData.rootDocument, realityData);\r\n }\r\n\r\n let url = await this.getServiceUrl(iTwinId);\r\n if (!url)\r\n throw new IModelError(BentleyStatus.ERROR, \"Unable to get service url\");\r\n\r\n // The following is only if the reality data is not stored on PW Context Share.\r\n const cesiumAsset = CesiumIonAssetProvider.parseCesiumUrl(url);\r\n if (cesiumAsset) {\r\n const tokenAndUrl = await getCesiumAccessTokenAndEndpointUrl(cesiumAsset.id, cesiumAsset.key);\r\n if (tokenAndUrl.url && tokenAndUrl.token) {\r\n url = tokenAndUrl.url;\r\n this._requestAuthorization = `Bearer ${tokenAndUrl.token}`;\r\n }\r\n }\r\n\r\n // The following is only if the reality data is not stored on PW Context Share.\r\n this.setBaseUrl(url);\r\n return this._doRequest(url, \"json\");\r\n }\r\n\r\n /**\r\n * Gets tile content\r\n * @param name name or path of tile\r\n * @returns array buffer of tile content\r\n */\r\n public async getRealityDataTileContent(accessToken: AccessToken, name: string, realityData: RealityData): Promise<any> {\r\n const url = await realityData.getBlobUrl(accessToken, name);\r\n const options: RequestOptions = {\r\n method: \"GET\",\r\n responseType: \"arraybuffer\",\r\n };\r\n const data = await request(url.toString(), options);\r\n return data.body;\r\n }\r\n\r\n /**\r\n * TODO: This probably required different realitydataSource implementations based on different provider -> locally hosted, RDS and cesium\r\n * Returns the tile content. The path to the tile is relative to the base url of present reality data whatever the type.\r\n */\r\n public async getTileContent(name: string): Promise<any> {\r\n const token = await IModelApp.getAccessToken();\r\n const useRds = this.isContextShare && token !== undefined;\r\n const tileUrl = this._baseUrl + name;\r\n\r\n if (useRds && this.realityData) {\r\n return this.getRealityDataTileContent(token, tileUrl, this.realityData);\r\n }\r\n\r\n return this._doRequest(tileUrl, \"arraybuffer\");\r\n }\r\n\r\n /**\r\n * TODO: This probably required different realitydataSource implementations based on different provider -> locally hosted, RDS and cesium\r\n * Returns the tile content in json format. The path to the tile is relative to the base url of present reality data whatever the type.\r\n */\r\n public async getTileJson(name: string): Promise<any> {\r\n const token = await IModelApp.getAccessToken();\r\n const useRds = this.isContextShare && token !== undefined;\r\n const tileUrl = this._baseUrl + name;\r\n\r\n if (useRds && this.realityData) {\r\n return this.getRealityDataTileJson(token, tileUrl, this.realityData);\r\n }\r\n\r\n return this._doRequest(tileUrl, \"json\");\r\n }\r\n}\r\n\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewContext.js","sourceRoot":"","sources":["../../src/ViewContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAyD;AAKzD,oDAA0F;AAE1F,2CAAwC;AAKxC,4DAAqG;AAKrG,0CAAuC;AACvC,8CAA+H;AAE/H,yCAAqG;AAErG;;GAEG;AACH,MAAa,aAAa;IASxB,YAAY,EAAY,EAAE,OAAiB;QACzC,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC,SAAS,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC;QACnD,IAAI,CAAC,aAAa,GAAG,IAAI,2BAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvD,CAAC;IAED,yIAAyI;IAClI,mBAAmB,CAAC,OAAiB;QAC1C,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACjE,CAAC;IAED,qDAAqD;IACrD,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,4EAA4E;IAC5E,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;IAClC,CAAC;IAED,gBAAgB;IAChB,IAAW,MAAM,KAAmB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IAElE,gBAAgB;IACN,qBAAqB,CAAC,OAAwD;QACtF,OAAO,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAA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AI,EAAE,CAAC;QAEP,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC;IAC/B,CAAC;IAED,+DAA+D;IAC/D,IAAW,QAAQ,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;IACvD,2EAA2E;IAC3E,IAAW,kBAAkB,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;IACjE,gFAAgF;IAChF,IAAW,eAAe,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3D,gBAAgB;IAChB,IAAW,iBAAiB,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC;IACvE,gBAAgB;IAChB,IAAW,aAAa,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;IAE/D,gBAAgB;IACT,mBAAmB,CAAC,UAA6B,EAAE,OAAmB;QAC3E,IAAI,CAAC,KAAK,CAAC,gBAAgB,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;IACxD,CAAC;CACF;AAxID,oCAwIC","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 { assert, Id64String } from \"@itwin/core-bentley\";\nimport {\r\n Matrix3d, Point2d,\r\n Point3d, Range1d, Transform, XAndY,\r\n} from \"@itwin/core-geometry\";\nimport { Frustum, FrustumPlanes, SpatialClassifier, ViewFlags } from \"@itwin/core-common\";\nimport { CachedDecoration, DecorationsCache } from \"./DecorationsCache\";\r\nimport { IModelApp } from \"./IModelApp\";\r\nimport { PlanarClipMaskState } from \"./PlanarClipMaskState\";\r\nimport { CanvasDecoration } from \"./render/CanvasDecoration\";\r\nimport { Decorations } from \"./render/Decorations\";\r\nimport { GraphicBranch, GraphicBranchOptions } from \"./render/GraphicBranch\";\r\nimport { GraphicBuilder, GraphicType, ViewportGraphicBuilderOptions } from \"./render/GraphicBuilder\";\nimport { GraphicList, RenderGraphic } from \"./render/RenderGraphic\";\r\nimport { RenderPlanarClassifier } from \"./render/RenderPlanarClassifier\";\r\nimport { RenderSystem, RenderTextureDrape } from \"./render/RenderSystem\";\r\nimport { RenderTarget } from \"./render/RenderTarget\";\r\nimport { Scene } from \"./render/Scene\";\r\nimport { SpatialClassifierTileTreeReference, Tile, TileGraphicType, TileLoadStatus, TileTreeReference } from \"./tile/internal\";\r\nimport { ViewingSpace } from \"./ViewingSpace\";\r\nimport { ELEMENT_MARKED_FOR_REMOVAL, ScreenViewport, Viewport, ViewportDecorator } from \"./Viewport\";\r\n\r\n/** Provides context for producing [[RenderGraphic]]s for drawing within a [[Viewport]].\r\n * @public\r\n */\r\nexport class RenderContext {\r\n /** ViewFlags extracted from the context's [[Viewport]]. */\r\n public readonly viewFlags: ViewFlags;\r\n private readonly _viewport: Viewport;\r\n /** Frustum extracted from the context's [[Viewport]]. */\r\n public readonly frustum: Frustum;\r\n /** Frustum planes extracted from the context's [[Viewport]]. */\r\n public readonly frustumPlanes: FrustumPlanes;\r\n\r\n constructor(vp: Viewport, frustum?: Frustum) {\r\n this._viewport = vp;\r\n this.viewFlags = vp.viewFlags;\n this.frustum = frustum ? frustum : vp.getFrustum();\r\n this.frustumPlanes = new FrustumPlanes(this.frustum);\r\n }\r\n\r\n /** Given a point in world coordinates, determine approximately how many pixels it occupies on screen based on this context's frustum. */\r\n public getPixelSizeAtPoint(inPoint?: Point3d): number {\r\n return this.viewport.viewingSpace.getPixelSizeAtPoint(inPoint);\r\n }\r\n\r\n /** The [[Viewport]] associated with this context. */\r\n public get viewport(): Viewport {\r\n return this._viewport;\r\n }\r\n\r\n /** The [[RenderSystem]] being used to produce graphics for this context. */\r\n public get renderSystem(): RenderSystem {\r\n return this.target.renderSystem;\r\n }\r\n\r\n /** @internal */\r\n public get target(): RenderTarget { return this.viewport.target; }\r\n\r\n /** @internal */\r\n protected _createGraphicBuilder(options: Omit<ViewportGraphicBuilderOptions, \"viewport\">): GraphicBuilder {\n return this.target.createGraphicBuilder({ ...options, viewport: this.viewport });\r\n }\r\n\r\n /** Create a builder for creating a [[GraphicType.Scene]] [[RenderGraphic]] for rendering within this context's [[Viewport]].\r\n * @param transform the local-to-world transform in which the builder's geometry is to be defined.\r\n * @returns A builder for creating a [[GraphicType.Scene]] [[RenderGraphic]] for rendering within this context's [[Viewport]].\r\n */\r\n public createSceneGraphicBuilder(transform?: Transform): GraphicBuilder {\r\n return this._createGraphicBuilder({ type: GraphicType.Scene, placement: transform });\r\n }\r\n\r\n /** Create a graphic from a [[GraphicBranch]]. */\r\n public createGraphicBranch(branch: GraphicBranch, location: Transform, opts?: GraphicBranchOptions): RenderGraphic {\r\n return this.target.renderSystem.createGraphicBranch(branch, location, opts);\r\n }\r\n\r\n /** Create a [[RenderGraphic]] which groups a set of graphics into a node in a scene graph, applying to each a transform and optional clip volume and symbology overrides.\r\n * @param branch Contains the group of graphics and the symbology overrides.\r\n * @param location the local-to-world transform applied to the grouped graphics.\r\n * @returns A RenderGraphic suitable for drawing the scene graph node within this context's [[Viewport]].\r\n * @see [[RenderSystem.createBranch]]\r\n */\r\n public createBranch(branch: GraphicBranch, location: Transform): RenderGraphic { return this.createGraphicBranch(branch, location); }\r\n\r\n /** Given the size of a logical pixel in meters, convert it to the size of a physical pixel in meters, if [[RenderSystem.dpiAwareLOD]] is `true`.\r\n * Used when computing LOD for graphics.\r\n * @internal\r\n */\r\n public adjustPixelSizeForLOD(cssPixelSize: number): number {\r\n return this.viewport.target.adjustPixelSizeForLOD(cssPixelSize);\r\n }\r\n}\r\n\r\n/** Provides context for an [[InteractiveTool]] to display decorations representing its current state.\r\n * @see [[InteractiveTool.onDynamicFrame]]\r\n * @public\r\n */\r\nexport class DynamicsContext extends RenderContext {\r\n private _dynamics?: GraphicList;\r\n\r\n /** Add a graphic to the list of dynamic graphics to be drawn in this context's [[Viewport]]. */\r\n public addGraphic(graphic: RenderGraphic) {\r\n if (undefined === this._dynamics)\r\n this._dynamics = [];\r\n this._dynamics.push(graphic);\r\n }\r\n\r\n /** @internal */\r\n public changeDynamics(): void {\r\n this.viewport.changeDynamics(this._dynamics);\r\n }\r\n\r\n /** Create a builder for producing a [[RenderGraphic]] appropriate for rendering within this context's [[Viewport]].\r\n * @param options Options describing how to create the builder.\r\n * @returns A builder that produces a [[RenderGraphic]].\r\n */\r\n public createGraphic(options: Omit<ViewportGraphicBuilderOptions, \"viewport\">): GraphicBuilder {\n return this._createGraphicBuilder(options);\r\n }\r\n}\r\n\r\n/** Provides context for a [[ViewportDecorator]] to add [[Decorations]] to be rendered within a [[Viewport]].\r\n * @public\r\n */\r\nexport class DecorateContext extends RenderContext {\r\n private readonly _decorations: Decorations;\r\n private readonly _cache: DecorationsCache;\r\n private _curCacheableDecorator?: ViewportDecorator;\r\n\r\n /** The [[ScreenViewport]] in which this context's [[Decorations]] will be drawn. */\r\n public override get viewport(): ScreenViewport {\r\n return super.viewport as ScreenViewport;\r\n }\r\n\r\n /** @internal */\r\n constructor(vp: ScreenViewport, decorations: Decorations, cache: DecorationsCache) {\r\n super(vp);\r\n this._decorations = decorations;\r\n this._cache = cache;\r\n }\r\n\r\n /** Create a builder for creating a [[RenderGraphic]] of the specified type appropriate for rendering within this context's [[Viewport]].\r\n * @param type The type of builder to create.\r\n * @param transform the local-to-world transform in which the builder's geometry is to be defined.\r\n * @param id If the decoration is to be pickable, a unique identifier to associate with the resultant [[RenderGraphic]].\r\n * @returns A builder for creating a [[RenderGraphic]] of the specified type appropriate for rendering within this context's [[Viewport]].\r\n * @see [[IModelConnection.transientIds]] for obtaining an ID for a pickable decoration.\r\n * @see [[createGraphic]] for more options.\r\n */\r\n public createGraphicBuilder(type: GraphicType, transform?: Transform, id?: Id64String): GraphicBuilder {\r\n return this.createGraphic({ type, placement: transform, pickable: undefined !== id ? { id } : undefined });\r\n }\r\n\r\n /** Create a builder for producing a [[RenderGraphic]] appropriate for rendering within this context's [[Viewport]].\r\n * @param options Options describing how to create the builder.\r\n * @returns A builder that produces a [[RenderGraphic]].\r\n */\r\n public createGraphic(options: Omit<ViewportGraphicBuilderOptions, \"viewport\">): GraphicBuilder {\n return this._createGraphicBuilder(options);\r\n }\r\n\r\n /** @internal */\r\n public addFromDecorator(decorator: ViewportDecorator): void {\r\n assert(undefined === this._curCacheableDecorator);\r\n try {\r\n if (decorator.useCachedDecorations) {\r\n const cached = this._cache.get(decorator);\r\n if (cached) {\r\n this.restoreCache(cached);\r\n return;\r\n }\r\n\r\n this._curCacheableDecorator = decorator;\r\n }\r\n\r\n decorator.decorate(this);\r\n } finally {\r\n this._curCacheableDecorator = undefined;\r\n }\r\n }\r\n\r\n /** Restores decorations onto this context from the specified array of cached decorations. */\r\n private restoreCache(cachedDecorations: CachedDecoration[]) {\r\n cachedDecorations.forEach((cachedDecoration) => {\r\n switch (cachedDecoration.type) {\r\n case \"graphic\":\r\n this.addDecoration(cachedDecoration.graphicType, cachedDecoration.graphicOwner);\r\n break;\r\n case \"canvas\":\r\n this.addCanvasDecoration(cachedDecoration.canvasDecoration, cachedDecoration.atFront);\r\n break;\r\n case \"html\":\r\n this.addHtmlDecoration(cachedDecoration.htmlElement);\r\n break;\r\n }\r\n });\r\n }\r\n\r\n private _appendToCache(decoration: CachedDecoration) {\r\n assert(undefined !== this._curCacheableDecorator);\r\n this._cache.add(this._curCacheableDecorator, decoration);\r\n }\r\n\r\n /** Calls [[GraphicBuilder.finish]] on the supplied builder to obtain a [[RenderGraphic]], then adds the graphic to the appropriate list of\r\n * [[Decorations]].\r\n * @param builder The builder from which to extract the graphic.\r\n * @note The builder should not be used after calling this method.\r\n */\r\n public addDecorationFromBuilder(builder: GraphicBuilder) {\r\n this.addDecoration(builder.type, builder.finish());\r\n }\r\n\r\n /** Adds a graphic to the set of [[Decorations]] to be drawn in this context's [[ScreenViewport]].\r\n * @param The type of the graphic, which determines to which list of decorations it is added.\r\n * @param decoration The decoration graphic to add.\r\n * @note The type must match the type with which the [[RenderGraphic]]'s [[GraphicBuilder]] was constructed.\r\n * @see [[DecorateContext.addDecorationFromBuilder]] for a more convenient API.\r\n */\r\n public addDecoration(type: GraphicType, decoration: RenderGraphic) {\r\n if (this._curCacheableDecorator) {\r\n const graphicOwner = this.target.renderSystem.createGraphicOwner(decoration);\r\n this._appendToCache({ type: \"graphic\", graphicOwner, graphicType: type });\r\n decoration = graphicOwner;\r\n }\r\n\r\n switch (type) {\r\n case GraphicType.Scene:\r\n if (undefined === this._decorations.normal)\r\n this._decorations.normal = [];\r\n this._decorations.normal.push(decoration);\r\n break;\r\n\r\n case GraphicType.WorldDecoration:\r\n if (!this._decorations.world)\r\n this._decorations.world = [];\r\n this._decorations.world.push(decoration);\r\n break;\r\n\r\n case GraphicType.WorldOverlay:\r\n if (!this._decorations.worldOverlay)\r\n this._decorations.worldOverlay = [];\r\n this._decorations.worldOverlay.push(decoration);\r\n break;\r\n\r\n case GraphicType.ViewOverlay:\r\n if (!this._decorations.viewOverlay)\r\n this._decorations.viewOverlay = [];\r\n this._decorations.viewOverlay.push(decoration);\r\n break;\r\n\r\n case GraphicType.ViewBackground:\r\n this.setViewBackground(decoration);\r\n break;\r\n }\r\n }\r\n\r\n /** Add a [[CanvasDecoration]] to be drawn in this context's [[ScreenViewport]]. */\r\n public addCanvasDecoration(decoration: CanvasDecoration, atFront = false) {\r\n if (this._curCacheableDecorator)\r\n this._appendToCache({ type: \"canvas\", canvasDecoration: decoration, atFront });\r\n\r\n if (undefined === this._decorations.canvasDecorations)\r\n this._decorations.canvasDecorations = [];\r\n\r\n const list = this._decorations.canvasDecorations;\r\n if (0 === list.length || true === atFront)\r\n list.push(decoration);\r\n else\r\n list.unshift(decoration);\r\n }\r\n\r\n /** Add an HTMLElement to be drawn as a decoration in this context's [[ScreenViewport]]. */\r\n public addHtmlDecoration(decoration: HTMLElement) {\r\n if (this._curCacheableDecorator)\r\n this._appendToCache({ type: \"html\", htmlElement: decoration });\r\n\r\n // an element decoration being added might already be on the decorationDiv, just marked for removal\r\n if (decoration[ELEMENT_MARKED_FOR_REMOVAL]) {\r\n decoration[ELEMENT_MARKED_FOR_REMOVAL] = false;\r\n } else if (decoration.parentElement !== this.viewport.decorationDiv) {\n this.viewport.decorationDiv.appendChild(decoration);\n }\r\n }\r\n\r\n /** @internal */\r\n public drawStandardGrid(gridOrigin: Point3d, rMatrix: Matrix3d, spacing: XAndY, gridsPerRef: number, _isoGrid: boolean = false, _fixedRepetitions?: Point2d): void {\r\n const vp = this.viewport;\r\n\r\n if (vp.viewingGlobe)\r\n return;\r\n\r\n const color = vp.getContrastToBackgroundColor();\r\n const planarGrid = this.viewport.target.renderSystem.createPlanarGrid(vp.getFrustum(), { origin: gridOrigin, rMatrix, spacing, gridsPerRef, color });\r\n if (planarGrid) {\r\n this.addDecoration(GraphicType.WorldDecoration, planarGrid);\r\n }\r\n }\r\n\r\n /** Display skyBox graphic that encompasses entire scene and rotates with camera.\r\n * @see [[RenderSystem.createSkyBox]].\r\n */\r\n public setSkyBox(graphic: RenderGraphic) {\r\n this._decorations.skyBox = graphic;\r\n }\r\n\r\n /** Set the graphic to be displayed behind all other geometry as the background of this context's [[ScreenViewport]]. */\r\n public setViewBackground(graphic: RenderGraphic) {\r\n this._decorations.viewBackground = graphic;\r\n }\r\n}\r\n\r\n/** Context used to create the scene to be drawn in a [[Viewport]]. The scene consists of a set of [[RenderGraphic]]s produced by the\r\n * [[TileTree]]s visible within the viewport. Creating the scene may result in the enqueueing of requests for [[Tile]] content which\r\n * should be displayed in the viewport but are not yet loaded.\r\n * @public\r\n */\r\nexport class SceneContext extends RenderContext {\r\n private _missingChildTiles = false;\r\n /** The graphics comprising the scene. */\r\n public readonly scene = new Scene();\r\n\r\n /** @internal */\r\n public readonly missingTiles = new Set<Tile>();\r\n\r\n /** @internal */\r\n public markChildrenLoading(): void {\r\n this._missingChildTiles = true;\r\n }\r\n\r\n /** @internal */\r\n public get hasMissingTiles(): boolean {\r\n return this._missingChildTiles || this.missingTiles.size > 0;\r\n }\r\n\r\n private _viewingSpace?: ViewingSpace;\r\n private _graphicType: TileGraphicType = TileGraphicType.Scene;\r\n\r\n public constructor(vp: Viewport, frustum?: Frustum) {\r\n super(vp, frustum);\r\n }\r\n\r\n /** The viewed volume containing the scene. */\r\n public get viewingSpace(): ViewingSpace {\r\n return undefined !== this._viewingSpace ? this._viewingSpace : this.viewport.viewingSpace;\r\n }\r\n\r\n /** @internal */\r\n public get graphicType() { return this._graphicType; }\r\n\r\n /** Add the specified graphic to the scene. */\r\n public outputGraphic(graphic: RenderGraphic): void {\r\n switch (this._graphicType) {\r\n case TileGraphicType.BackgroundMap:\r\n this.backgroundGraphics.push(graphic);\r\n break;\r\n case TileGraphicType.Overlay:\r\n this.overlayGraphics.push(graphic);\r\n break;\r\n default:\r\n this.graphics.push(graphic);\r\n break;\r\n }\r\n }\r\n\r\n /** Indicate that the specified tile is desired for the scene but is not yet ready. A request to load its contents will later be enqueued. */\r\n public insertMissingTile(tile: Tile): void {\r\n switch (tile.loadStatus) {\r\n case TileLoadStatus.NotLoaded:\r\n case TileLoadStatus.Queued:\r\n case TileLoadStatus.Loading:\r\n this.missingTiles.add(tile);\r\n break;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public requestMissingTiles(): void {\r\n IModelApp.tileAdmin.requestTiles(this.viewport, this.missingTiles);\r\n }\r\n\r\n /** @internal */\r\n public addPlanarClassifier(classifiedModelId: Id64String, classifierTree?: SpatialClassifierTileTreeReference, planarClipMask?: PlanarClipMaskState): RenderPlanarClassifier | undefined {\r\n // Target may have the classifier from a previous frame; if not we must create one.\r\n let classifier = this.viewport.target.getPlanarClassifier(classifiedModelId);\r\n if (undefined === classifier)\r\n classifier = this.viewport.target.createPlanarClassifier(classifierTree?.activeClassifier);\r\n\r\n // Either way, we need to collect the graphics to draw for this frame, and record that we did so.\r\n if (undefined !== classifier) {\r\n this.planarClassifiers.set(classifiedModelId, classifier);\r\n classifier.setSource(classifierTree, planarClipMask);\r\n }\r\n\r\n return classifier;\r\n }\r\n\r\n /** @internal */\r\n public getPlanarClassifierForModel(modelId: Id64String) {\r\n return this.planarClassifiers.get(modelId);\r\n }\r\n\r\n /** @internal */\r\n public addBackgroundDrapedModel(drapedTreeRef: TileTreeReference, _heightRange: Range1d | undefined): RenderTextureDrape | undefined {\r\n const drapedTree = drapedTreeRef.treeOwner.tileTree;\r\n if (undefined === drapedTree)\r\n return undefined;\r\n\r\n const id = drapedTree.modelId;\r\n let drape = this.getTextureDrapeForModel(id);\r\n if (undefined !== drape)\r\n return drape;\r\n\r\n drape = this.viewport.target.getTextureDrape(id);\r\n if (undefined === drape && this.viewport.backgroundDrapeMap)\r\n drape = this.viewport.target.renderSystem.createBackgroundMapDrape(drapedTreeRef, this.viewport.backgroundDrapeMap);\r\n\r\n if (undefined !== drape)\r\n this.textureDrapes.set(id, drape);\r\n\r\n return drape;\r\n }\r\n\r\n /** @internal */\r\n public getTextureDrapeForModel(modelId: Id64String) {\r\n return this.textureDrapes.get(modelId);\r\n }\r\n\r\n /** @internal */\r\n public withGraphicType(type: TileGraphicType, func: () => void): void {\r\n const prevType = this._graphicType;\r\n this._graphicType = type;\r\n\r\n func();\r\n\r\n this._graphicType = prevType;\r\n }\r\n\r\n /** The graphics in the scene that will be drawn with depth. */\r\n public get graphics() { return this.scene.foreground; }\r\n /** The graphics that will be drawn behind everything else in the scene. */\r\n public get backgroundGraphics() { return this.scene.background; }\r\n /** The graphics that will be drawn in front of everything else in the scene. */\r\n public get overlayGraphics() { return this.scene.overlay; }\r\n /** @internal */\r\n public get planarClassifiers() { return this.scene.planarClassifiers; }\r\n /** @internal */\r\n public get textureDrapes() { return this.scene.textureDrapes; }\r\n\r\n /** @internal */\r\n public setVolumeClassifier(classifier: SpatialClassifier, modelId: Id64String): void {\r\n this.scene.volumeClassifier = { classifier, modelId };\r\n }\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,CAAC,CAAC,CAAC;IACvD,2EAA2E;IAC3E,IAAW,kBAAkB,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;IACjE,gFAAgF;IAChF,IAAW,eAAe,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3D,gBAAgB;IAChB,IAAW,iBAAiB,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC;IACvE,gBAAgB;IAChB,IAAW,aAAa,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;IAE/D,gBAAgB;IACT,mBAAmB,CAAC,UAA6B,EAAE,OAAmB;QAC3E,IAAI,CAAC,KAAK,CAAC,gBAAgB,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;IACxD,CAAC;CACF;AAxID,oCAwIC","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 { assert, Id64String } from \"@itwin/core-bentley\";\r\nimport {\r\n Matrix3d, Point2d,\r\n Point3d, Range1d, Transform, XAndY,\r\n} from \"@itwin/core-geometry\";\r\nimport { Frustum, FrustumPlanes, SpatialClassifier, ViewFlags } from \"@itwin/core-common\";\r\nimport { CachedDecoration, DecorationsCache } from \"./DecorationsCache\";\r\nimport { IModelApp } from \"./IModelApp\";\r\nimport { PlanarClipMaskState } from \"./PlanarClipMaskState\";\r\nimport { CanvasDecoration } from \"./render/CanvasDecoration\";\r\nimport { Decorations } from \"./render/Decorations\";\r\nimport { GraphicBranch, GraphicBranchOptions } from \"./render/GraphicBranch\";\r\nimport { GraphicBuilder, GraphicType, ViewportGraphicBuilderOptions } from \"./render/GraphicBuilder\";\r\nimport { GraphicList, RenderGraphic } from \"./render/RenderGraphic\";\r\nimport { RenderPlanarClassifier } from \"./render/RenderPlanarClassifier\";\r\nimport { RenderSystem, RenderTextureDrape } from \"./render/RenderSystem\";\r\nimport { RenderTarget } from \"./render/RenderTarget\";\r\nimport { Scene } from \"./render/Scene\";\r\nimport { SpatialClassifierTileTreeReference, Tile, TileGraphicType, TileLoadStatus, TileTreeReference } from \"./tile/internal\";\r\nimport { ViewingSpace } from \"./ViewingSpace\";\r\nimport { ELEMENT_MARKED_FOR_REMOVAL, ScreenViewport, Viewport, ViewportDecorator } from \"./Viewport\";\r\n\r\n/** Provides context for producing [[RenderGraphic]]s for drawing within a [[Viewport]].\r\n * @public\r\n */\r\nexport class RenderContext {\r\n /** ViewFlags extracted from the context's [[Viewport]]. */\r\n public readonly viewFlags: ViewFlags;\r\n private readonly _viewport: Viewport;\r\n /** Frustum extracted from the context's [[Viewport]]. */\r\n public readonly frustum: Frustum;\r\n /** Frustum planes extracted from the context's [[Viewport]]. */\r\n public readonly frustumPlanes: FrustumPlanes;\r\n\r\n constructor(vp: Viewport, frustum?: Frustum) {\r\n this._viewport = vp;\r\n this.viewFlags = vp.viewFlags;\r\n this.frustum = frustum ? frustum : vp.getFrustum();\r\n this.frustumPlanes = new FrustumPlanes(this.frustum);\r\n }\r\n\r\n /** Given a point in world coordinates, determine approximately how many pixels it occupies on screen based on this context's frustum. */\r\n public getPixelSizeAtPoint(inPoint?: Point3d): number {\r\n return this.viewport.viewingSpace.getPixelSizeAtPoint(inPoint);\r\n }\r\n\r\n /** The [[Viewport]] associated with this context. */\r\n public get viewport(): Viewport {\r\n return this._viewport;\r\n }\r\n\r\n /** The [[RenderSystem]] being used to produce graphics for this context. */\r\n public get renderSystem(): RenderSystem {\r\n return this.target.renderSystem;\r\n }\r\n\r\n /** @internal */\r\n public get target(): RenderTarget { return this.viewport.target; }\r\n\r\n /** @internal */\r\n protected _createGraphicBuilder(options: Omit<ViewportGraphicBuilderOptions, \"viewport\">): GraphicBuilder {\r\n return this.target.createGraphicBuilder({ ...options, viewport: this.viewport });\r\n }\r\n\r\n /** Create a builder for creating a [[GraphicType.Scene]] [[RenderGraphic]] for rendering within this context's [[Viewport]].\r\n * @param transform the local-to-world transform in which the builder's geometry is to be defined.\r\n * @returns A builder for creating a [[GraphicType.Scene]] [[RenderGraphic]] for rendering within this context's [[Viewport]].\r\n */\r\n public createSceneGraphicBuilder(transform?: Transform): GraphicBuilder {\r\n return this._createGraphicBuilder({ type: GraphicType.Scene, placement: transform });\r\n }\r\n\r\n /** Create a graphic from a [[GraphicBranch]]. */\r\n public createGraphicBranch(branch: GraphicBranch, location: Transform, opts?: GraphicBranchOptions): RenderGraphic {\r\n return this.target.renderSystem.createGraphicBranch(branch, location, opts);\r\n }\r\n\r\n /** Create a [[RenderGraphic]] which groups a set of graphics into a node in a scene graph, applying to each a transform and optional clip volume and symbology overrides.\r\n * @param branch Contains the group of graphics and the symbology overrides.\r\n * @param location the local-to-world transform applied to the grouped graphics.\r\n * @returns A RenderGraphic suitable for drawing the scene graph node within this context's [[Viewport]].\r\n * @see [[RenderSystem.createBranch]]\r\n */\r\n public createBranch(branch: GraphicBranch, location: Transform): RenderGraphic { return this.createGraphicBranch(branch, location); }\r\n\r\n /** Given the size of a logical pixel in meters, convert it to the size of a physical pixel in meters, if [[RenderSystem.dpiAwareLOD]] is `true`.\r\n * Used when computing LOD for graphics.\r\n * @internal\r\n */\r\n public adjustPixelSizeForLOD(cssPixelSize: number): number {\r\n return this.viewport.target.adjustPixelSizeForLOD(cssPixelSize);\r\n }\r\n}\r\n\r\n/** Provides context for an [[InteractiveTool]] to display decorations representing its current state.\r\n * @see [[InteractiveTool.onDynamicFrame]]\r\n * @public\r\n */\r\nexport class DynamicsContext extends RenderContext {\r\n private _dynamics?: GraphicList;\r\n\r\n /** Add a graphic to the list of dynamic graphics to be drawn in this context's [[Viewport]]. */\r\n public addGraphic(graphic: RenderGraphic) {\r\n if (undefined === this._dynamics)\r\n this._dynamics = [];\r\n this._dynamics.push(graphic);\r\n }\r\n\r\n /** @internal */\r\n public changeDynamics(): void {\r\n this.viewport.changeDynamics(this._dynamics);\r\n }\r\n\r\n /** Create a builder for producing a [[RenderGraphic]] appropriate for rendering within this context's [[Viewport]].\r\n * @param options Options describing how to create the builder.\r\n * @returns A builder that produces a [[RenderGraphic]].\r\n */\r\n public createGraphic(options: Omit<ViewportGraphicBuilderOptions, \"viewport\">): GraphicBuilder {\r\n return this._createGraphicBuilder(options);\r\n }\r\n}\r\n\r\n/** Provides context for a [[ViewportDecorator]] to add [[Decorations]] to be rendered within a [[Viewport]].\r\n * @public\r\n */\r\nexport class DecorateContext extends RenderContext {\r\n private readonly _decorations: Decorations;\r\n private readonly _cache: DecorationsCache;\r\n private _curCacheableDecorator?: ViewportDecorator;\r\n\r\n /** The [[ScreenViewport]] in which this context's [[Decorations]] will be drawn. */\r\n public override get viewport(): ScreenViewport {\r\n return super.viewport as ScreenViewport;\r\n }\r\n\r\n /** @internal */\r\n constructor(vp: ScreenViewport, decorations: Decorations, cache: DecorationsCache) {\r\n super(vp);\r\n this._decorations = decorations;\r\n this._cache = cache;\r\n }\r\n\r\n /** Create a builder for creating a [[RenderGraphic]] of the specified type appropriate for rendering within this context's [[Viewport]].\r\n * @param type The type of builder to create.\r\n * @param transform the local-to-world transform in which the builder's geometry is to be defined.\r\n * @param id If the decoration is to be pickable, a unique identifier to associate with the resultant [[RenderGraphic]].\r\n * @returns A builder for creating a [[RenderGraphic]] of the specified type appropriate for rendering within this context's [[Viewport]].\r\n * @see [[IModelConnection.transientIds]] for obtaining an ID for a pickable decoration.\r\n * @see [[createGraphic]] for more options.\r\n */\r\n public createGraphicBuilder(type: GraphicType, transform?: Transform, id?: Id64String): GraphicBuilder {\r\n return this.createGraphic({ type, placement: transform, pickable: undefined !== id ? { id } : undefined });\r\n }\r\n\r\n /** Create a builder for producing a [[RenderGraphic]] appropriate for rendering within this context's [[Viewport]].\r\n * @param options Options describing how to create the builder.\r\n * @returns A builder that produces a [[RenderGraphic]].\r\n */\r\n public createGraphic(options: Omit<ViewportGraphicBuilderOptions, \"viewport\">): GraphicBuilder {\r\n return this._createGraphicBuilder(options);\r\n }\r\n\r\n /** @internal */\r\n public addFromDecorator(decorator: ViewportDecorator): void {\r\n assert(undefined === this._curCacheableDecorator);\r\n try {\r\n if (decorator.useCachedDecorations) {\r\n const cached = this._cache.get(decorator);\r\n if (cached) {\r\n this.restoreCache(cached);\r\n return;\r\n }\r\n\r\n this._curCacheableDecorator = decorator;\r\n }\r\n\r\n decorator.decorate(this);\r\n } finally {\r\n this._curCacheableDecorator = undefined;\r\n }\r\n }\r\n\r\n /** Restores decorations onto this context from the specified array of cached decorations. */\r\n private restoreCache(cachedDecorations: CachedDecoration[]) {\r\n cachedDecorations.forEach((cachedDecoration) => {\r\n switch (cachedDecoration.type) {\r\n case \"graphic\":\r\n this.addDecoration(cachedDecoration.graphicType, cachedDecoration.graphicOwner);\r\n break;\r\n case \"canvas\":\r\n this.addCanvasDecoration(cachedDecoration.canvasDecoration, cachedDecoration.atFront);\r\n break;\r\n case \"html\":\r\n this.addHtmlDecoration(cachedDecoration.htmlElement);\r\n break;\r\n }\r\n });\r\n }\r\n\r\n private _appendToCache(decoration: CachedDecoration) {\r\n assert(undefined !== this._curCacheableDecorator);\r\n this._cache.add(this._curCacheableDecorator, decoration);\r\n }\r\n\r\n /** Calls [[GraphicBuilder.finish]] on the supplied builder to obtain a [[RenderGraphic]], then adds the graphic to the appropriate list of\r\n * [[Decorations]].\r\n * @param builder The builder from which to extract the graphic.\r\n * @note The builder should not be used after calling this method.\r\n */\r\n public addDecorationFromBuilder(builder: GraphicBuilder) {\r\n this.addDecoration(builder.type, builder.finish());\r\n }\r\n\r\n /** Adds a graphic to the set of [[Decorations]] to be drawn in this context's [[ScreenViewport]].\r\n * @param The type of the graphic, which determines to which list of decorations it is added.\r\n * @param decoration The decoration graphic to add.\r\n * @note The type must match the type with which the [[RenderGraphic]]'s [[GraphicBuilder]] was constructed.\r\n * @see [[DecorateContext.addDecorationFromBuilder]] for a more convenient API.\r\n */\r\n public addDecoration(type: GraphicType, decoration: RenderGraphic) {\r\n if (this._curCacheableDecorator) {\r\n const graphicOwner = this.target.renderSystem.createGraphicOwner(decoration);\r\n this._appendToCache({ type: \"graphic\", graphicOwner, graphicType: type });\r\n decoration = graphicOwner;\r\n }\r\n\r\n switch (type) {\r\n case GraphicType.Scene:\r\n if (undefined === this._decorations.normal)\r\n this._decorations.normal = [];\r\n this._decorations.normal.push(decoration);\r\n break;\r\n\r\n case GraphicType.WorldDecoration:\r\n if (!this._decorations.world)\r\n this._decorations.world = [];\r\n this._decorations.world.push(decoration);\r\n break;\r\n\r\n case GraphicType.WorldOverlay:\r\n if (!this._decorations.worldOverlay)\r\n this._decorations.worldOverlay = [];\r\n this._decorations.worldOverlay.push(decoration);\r\n break;\r\n\r\n case GraphicType.ViewOverlay:\r\n if (!this._decorations.viewOverlay)\r\n this._decorations.viewOverlay = [];\r\n this._decorations.viewOverlay.push(decoration);\r\n break;\r\n\r\n case GraphicType.ViewBackground:\r\n this.setViewBackground(decoration);\r\n break;\r\n }\r\n }\r\n\r\n /** Add a [[CanvasDecoration]] to be drawn in this context's [[ScreenViewport]]. */\r\n public addCanvasDecoration(decoration: CanvasDecoration, atFront = false) {\r\n if (this._curCacheableDecorator)\r\n this._appendToCache({ type: \"canvas\", canvasDecoration: decoration, atFront });\r\n\r\n if (undefined === this._decorations.canvasDecorations)\r\n this._decorations.canvasDecorations = [];\r\n\r\n const list = this._decorations.canvasDecorations;\r\n if (0 === list.length || true === atFront)\r\n list.push(decoration);\r\n else\r\n list.unshift(decoration);\r\n }\r\n\r\n /** Add an HTMLElement to be drawn as a decoration in this context's [[ScreenViewport]]. */\r\n public addHtmlDecoration(decoration: HTMLElement) {\r\n if (this._curCacheableDecorator)\r\n this._appendToCache({ type: \"html\", htmlElement: decoration });\r\n\r\n // an element decoration being added might already be on the decorationDiv, just marked for removal\r\n if (decoration[ELEMENT_MARKED_FOR_REMOVAL]) {\r\n decoration[ELEMENT_MARKED_FOR_REMOVAL] = false;\r\n } else if (decoration.parentElement !== this.viewport.decorationDiv) {\r\n this.viewport.decorationDiv.appendChild(decoration);\r\n }\r\n }\r\n\r\n /** @internal */\r\n public drawStandardGrid(gridOrigin: Point3d, rMatrix: Matrix3d, spacing: XAndY, gridsPerRef: number, _isoGrid: boolean = false, _fixedRepetitions?: Point2d): void {\r\n const vp = this.viewport;\r\n\r\n if (vp.viewingGlobe)\r\n return;\r\n\r\n const color = vp.getContrastToBackgroundColor();\r\n const planarGrid = this.viewport.target.renderSystem.createPlanarGrid(vp.getFrustum(), { origin: gridOrigin, rMatrix, spacing, gridsPerRef, color });\r\n if (planarGrid) {\r\n this.addDecoration(GraphicType.WorldDecoration, planarGrid);\r\n }\r\n }\r\n\r\n /** Display skyBox graphic that encompasses entire scene and rotates with camera.\r\n * @see [[RenderSystem.createSkyBox]].\r\n */\r\n public setSkyBox(graphic: RenderGraphic) {\r\n this._decorations.skyBox = graphic;\r\n }\r\n\r\n /** Set the graphic to be displayed behind all other geometry as the background of this context's [[ScreenViewport]]. */\r\n public setViewBackground(graphic: RenderGraphic) {\r\n this._decorations.viewBackground = graphic;\r\n }\r\n}\r\n\r\n/** Context used to create the scene to be drawn in a [[Viewport]]. The scene consists of a set of [[RenderGraphic]]s produced by the\r\n * [[TileTree]]s visible within the viewport. Creating the scene may result in the enqueueing of requests for [[Tile]] content which\r\n * should be displayed in the viewport but are not yet loaded.\r\n * @public\r\n */\r\nexport class SceneContext extends RenderContext {\r\n private _missingChildTiles = false;\r\n /** The graphics comprising the scene. */\r\n public readonly scene = new Scene();\r\n\r\n /** @internal */\r\n public readonly missingTiles = new Set<Tile>();\r\n\r\n /** @internal */\r\n public markChildrenLoading(): void {\r\n this._missingChildTiles = true;\r\n }\r\n\r\n /** @internal */\r\n public get hasMissingTiles(): boolean {\r\n return this._missingChildTiles || this.missingTiles.size > 0;\r\n }\r\n\r\n private _viewingSpace?: ViewingSpace;\r\n private _graphicType: TileGraphicType = TileGraphicType.Scene;\r\n\r\n public constructor(vp: Viewport, frustum?: Frustum) {\r\n super(vp, frustum);\r\n }\r\n\r\n /** The viewed volume containing the scene. */\r\n public get viewingSpace(): ViewingSpace {\r\n return undefined !== this._viewingSpace ? this._viewingSpace : this.viewport.viewingSpace;\r\n }\r\n\r\n /** @internal */\r\n public get graphicType() { return this._graphicType; }\r\n\r\n /** Add the specified graphic to the scene. */\r\n public outputGraphic(graphic: RenderGraphic): void {\r\n switch (this._graphicType) {\r\n case TileGraphicType.BackgroundMap:\r\n this.backgroundGraphics.push(graphic);\r\n break;\r\n case TileGraphicType.Overlay:\r\n this.overlayGraphics.push(graphic);\r\n break;\r\n default:\r\n this.graphics.push(graphic);\r\n break;\r\n }\r\n }\r\n\r\n /** Indicate that the specified tile is desired for the scene but is not yet ready. A request to load its contents will later be enqueued. */\r\n public insertMissingTile(tile: Tile): void {\r\n switch (tile.loadStatus) {\r\n case TileLoadStatus.NotLoaded:\r\n case TileLoadStatus.Queued:\r\n case TileLoadStatus.Loading:\r\n this.missingTiles.add(tile);\r\n break;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public requestMissingTiles(): void {\r\n IModelApp.tileAdmin.requestTiles(this.viewport, this.missingTiles);\r\n }\r\n\r\n /** @internal */\r\n public addPlanarClassifier(classifiedModelId: Id64String, classifierTree?: SpatialClassifierTileTreeReference, planarClipMask?: PlanarClipMaskState): RenderPlanarClassifier | undefined {\r\n // Target may have the classifier from a previous frame; if not we must create one.\r\n let classifier = this.viewport.target.getPlanarClassifier(classifiedModelId);\r\n if (undefined === classifier)\r\n classifier = this.viewport.target.createPlanarClassifier(classifierTree?.activeClassifier);\r\n\r\n // Either way, we need to collect the graphics to draw for this frame, and record that we did so.\r\n if (undefined !== classifier) {\r\n this.planarClassifiers.set(classifiedModelId, classifier);\r\n classifier.setSource(classifierTree, planarClipMask);\r\n }\r\n\r\n return classifier;\r\n }\r\n\r\n /** @internal */\r\n public getPlanarClassifierForModel(modelId: Id64String) {\r\n return this.planarClassifiers.get(modelId);\r\n }\r\n\r\n /** @internal */\r\n public addBackgroundDrapedModel(drapedTreeRef: TileTreeReference, _heightRange: Range1d | undefined): RenderTextureDrape | undefined {\r\n const drapedTree = drapedTreeRef.treeOwner.tileTree;\r\n if (undefined === drapedTree)\r\n return undefined;\r\n\r\n const id = drapedTree.modelId;\r\n let drape = this.getTextureDrapeForModel(id);\r\n if (undefined !== drape)\r\n return drape;\r\n\r\n drape = this.viewport.target.getTextureDrape(id);\r\n if (undefined === drape && this.viewport.backgroundDrapeMap)\r\n drape = this.viewport.target.renderSystem.createBackgroundMapDrape(drapedTreeRef, this.viewport.backgroundDrapeMap);\r\n\r\n if (undefined !== drape)\r\n this.textureDrapes.set(id, drape);\r\n\r\n return drape;\r\n }\r\n\r\n /** @internal */\r\n public getTextureDrapeForModel(modelId: Id64String) {\r\n return this.textureDrapes.get(modelId);\r\n }\r\n\r\n /** @internal */\r\n public withGraphicType(type: TileGraphicType, func: () => void): void {\r\n const prevType = this._graphicType;\r\n this._graphicType = type;\r\n\r\n func();\r\n\r\n this._graphicType = prevType;\r\n }\r\n\r\n /** The graphics in the scene that will be drawn with depth. */\r\n public get graphics() { return this.scene.foreground; }\r\n /** The graphics that will be drawn behind everything else in the scene. */\r\n public get backgroundGraphics() { return this.scene.background; }\r\n /** The graphics that will be drawn in front of everything else in the scene. */\r\n public get overlayGraphics() { return this.scene.overlay; }\r\n /** @internal */\r\n public get planarClassifiers() { return this.scene.planarClassifiers; }\r\n /** @internal */\r\n public get textureDrapes() { return this.scene.textureDrapes; }\r\n\r\n /** @internal */\r\n public setVolumeClassifier(classifier: SpatialClassifier, modelId: Id64String): void {\r\n this.scene.volumeClassifier = { classifier, modelId };\r\n }\r\n}\r\n"]}
|
package/lib/cjs/ViewCreator2d.js
CHANGED
|
@@ -94,7 +94,7 @@ class ViewCreator2d {
|
|
|
94
94
|
const displayStyleProps = {
|
|
95
95
|
code: core_common_1.Code.createEmpty(),
|
|
96
96
|
model: dictionaryId,
|
|
97
|
-
classFullName: "BisCore:
|
|
97
|
+
classFullName: "BisCore:DisplayStyle2d",
|
|
98
98
|
jsonProperties: {
|
|
99
99
|
styles: {
|
|
100
100
|
backgroundColor: bgColor.tbgr,
|