@itwin/core-frontend 3.0.0-dev.167 → 3.0.0-dev.172

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.
Files changed (75) hide show
  1. package/lib/cjs/IModelApp.d.ts +1 -1
  2. package/lib/cjs/IModelApp.d.ts.map +1 -1
  3. package/lib/cjs/IModelApp.js.map +1 -1
  4. package/lib/cjs/ImageUtil.d.ts.map +1 -1
  5. package/lib/cjs/ImageUtil.js +4 -1
  6. package/lib/cjs/ImageUtil.js.map +1 -1
  7. package/lib/cjs/ViewManager.d.ts +6 -6
  8. package/lib/cjs/ViewManager.js +5 -5
  9. package/lib/cjs/ViewManager.js.map +1 -1
  10. package/lib/cjs/Viewport.d.ts +5 -3
  11. package/lib/cjs/Viewport.d.ts.map +1 -1
  12. package/lib/cjs/Viewport.js +5 -3
  13. package/lib/cjs/Viewport.js.map +1 -1
  14. package/lib/cjs/render/RenderSystem.d.ts +1 -0
  15. package/lib/cjs/render/RenderSystem.d.ts.map +1 -1
  16. package/lib/cjs/render/RenderSystem.js +1 -0
  17. package/lib/cjs/render/RenderSystem.js.map +1 -1
  18. package/lib/cjs/tile/B3dmReader.js +2 -2
  19. package/lib/cjs/tile/B3dmReader.js.map +1 -1
  20. package/lib/cjs/tile/DynamicIModelTile.js +1 -1
  21. package/lib/cjs/tile/DynamicIModelTile.js.map +1 -1
  22. package/lib/cjs/tile/GltfReader.d.ts +129 -36
  23. package/lib/cjs/tile/GltfReader.d.ts.map +1 -1
  24. package/lib/cjs/tile/GltfReader.js +261 -122
  25. package/lib/cjs/tile/GltfReader.js.map +1 -1
  26. package/lib/cjs/tile/I3dmReader.js +2 -2
  27. package/lib/cjs/tile/I3dmReader.js.map +1 -1
  28. package/lib/cjs/tile/IModelTile.js +1 -1
  29. package/lib/cjs/tile/IModelTile.js.map +1 -1
  30. package/lib/cjs/tile/ImdlReader.d.ts +12 -1
  31. package/lib/cjs/tile/ImdlReader.d.ts.map +1 -1
  32. package/lib/cjs/tile/ImdlReader.js +47 -3
  33. package/lib/cjs/tile/ImdlReader.js.map +1 -1
  34. package/lib/cjs/tile/RealityTileLoader.js +1 -1
  35. package/lib/cjs/tile/RealityTileLoader.js.map +1 -1
  36. package/lib/cjs/tile/map/CesiumTerrainProvider.js +1 -1
  37. package/lib/cjs/tile/map/CesiumTerrainProvider.js.map +1 -1
  38. package/lib/esm/IModelApp.d.ts +1 -1
  39. package/lib/esm/IModelApp.d.ts.map +1 -1
  40. package/lib/esm/IModelApp.js.map +1 -1
  41. package/lib/esm/ImageUtil.d.ts.map +1 -1
  42. package/lib/esm/ImageUtil.js +4 -1
  43. package/lib/esm/ImageUtil.js.map +1 -1
  44. package/lib/esm/ViewManager.d.ts +6 -6
  45. package/lib/esm/ViewManager.js +5 -5
  46. package/lib/esm/ViewManager.js.map +1 -1
  47. package/lib/esm/Viewport.d.ts +5 -3
  48. package/lib/esm/Viewport.d.ts.map +1 -1
  49. package/lib/esm/Viewport.js +5 -3
  50. package/lib/esm/Viewport.js.map +1 -1
  51. package/lib/esm/render/RenderSystem.d.ts +1 -0
  52. package/lib/esm/render/RenderSystem.d.ts.map +1 -1
  53. package/lib/esm/render/RenderSystem.js +1 -0
  54. package/lib/esm/render/RenderSystem.js.map +1 -1
  55. package/lib/esm/tile/B3dmReader.js +2 -2
  56. package/lib/esm/tile/B3dmReader.js.map +1 -1
  57. package/lib/esm/tile/DynamicIModelTile.js +1 -1
  58. package/lib/esm/tile/DynamicIModelTile.js.map +1 -1
  59. package/lib/esm/tile/GltfReader.d.ts +129 -36
  60. package/lib/esm/tile/GltfReader.d.ts.map +1 -1
  61. package/lib/esm/tile/GltfReader.js +261 -123
  62. package/lib/esm/tile/GltfReader.js.map +1 -1
  63. package/lib/esm/tile/I3dmReader.js +2 -2
  64. package/lib/esm/tile/I3dmReader.js.map +1 -1
  65. package/lib/esm/tile/IModelTile.js +1 -1
  66. package/lib/esm/tile/IModelTile.js.map +1 -1
  67. package/lib/esm/tile/ImdlReader.d.ts +12 -1
  68. package/lib/esm/tile/ImdlReader.d.ts.map +1 -1
  69. package/lib/esm/tile/ImdlReader.js +45 -2
  70. package/lib/esm/tile/ImdlReader.js.map +1 -1
  71. package/lib/esm/tile/RealityTileLoader.js +1 -1
  72. package/lib/esm/tile/RealityTileLoader.js.map +1 -1
  73. package/lib/esm/tile/map/CesiumTerrainProvider.js +1 -1
  74. package/lib/esm/tile/map/CesiumTerrainProvider.js.map +1 -1
  75. package/package.json +22 -22
@@ -80,7 +80,7 @@ export interface IModelAppOptions {
80
80
  tentativePoint?: TentativePoint;
81
81
  /** @internal */
82
82
  quantityFormatter?: QuantityFormatter;
83
- /** @internal */
83
+ /** If present, supplies an implementation of the render system, or options for initializing the default render system. */
84
84
  renderSys?: RenderSystem | RenderSystem.Options;
85
85
  /** If present, supplies the [[UiAdmin]] for this session. */
86
86
  uiAdmin?: UiAdmin;
@@ -1 +1 @@
1
- {"version":3,"file":"IModelApp.d.ts","sourceRoot":"","sources":["../../src/IModelApp.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAA0C,UAAU,EAAU,MAAM,qBAAqB,CAAC;AACnI,OAAO,EACL,mBAAmB,EAAgB,YAAY,EAAE,iBAAiB,EAAoB,sBAAsB,EAC7G,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAA4B,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AACpG,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAKtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,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AkB,CAAC,GAAG,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC;IAC9E,CAAC;;AA/hBH,8BAgiBC;AA/hBgB,sBAAY,GAAG,KAAK,CAAC;AAgBrB,wBAAc,GAAG,KAAK,CAAC;AACvB,6BAAmB,GAAG,KAAK,CAAC;AAC5B,4BAAkB,GAA2B,yBAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;AAWtF,yEAAyE;AAClD,0BAAgB,GAAG,IAAI,sBAAO,EAAc,CAAC;AAIpE,6CAA6C;AACtB,eAAK,GAAG,IAAI,mBAAY,EAAE,CAAC;AAgElD;;GAEG;AACoB,mBAAS,GAAqB,IAAI,iCAAgB,EAAE,CAAC;AAE5E,gDAAgD;AACjC,wBAAc,GAAG,IAAI,GAAG,EAA8B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module IModelApp\r\n */\r\n\r\nconst copyrightNotice = 'Copyright © 2017-2021 <a href=\"https://www.bentley.com\" target=\"_blank\" rel=\"noopener noreferrer\">Bentley Systems, Inc.</a>';\r\n\r\nimport { TelemetryManager } from \"@itwin/core-telemetry\";\r\nimport { UiAdmin } from \"@itwin/appui-abstract\";\r\nimport { AccessToken, BeDuration, BeEvent, BentleyStatus, DbResult, dispose, Guid, GuidString, Logger } from \"@itwin/core-bentley\";\r\nimport {\r\n AuthorizationClient, IModelStatus, Localization, RealityDataAccess, RpcConfiguration, RpcInterfaceDefinition, RpcRequest, SerializedRpcActivity,\r\n} from \"@itwin/core-common\";\r\nimport { ITwinLocalization } from \"@itwin/core-i18n\";\r\nimport { queryRenderCompatibility, WebGLRenderCompatibilityInfo } from \"@itwin/webgl-compatibility\";\r\nimport { AccuDraw } from \"./AccuDraw\";\r\nimport { AccuSnap } from \"./AccuSnap\";\r\nimport * as auxCoordState from \"./AuxCoordSys\";\r\nimport * as categorySelectorState from \"./CategorySelectorState\";\r\nimport * as displayStyleState from \"./DisplayStyleState\";\r\nimport * as drawingViewState from \"./DrawingViewState\";\r\nimport { ElementLocateManager } from \"./ElementLocateManager\";\r\nimport { EntityState } from \"./EntityState\";\r\nimport { FrontendHubAccess } from \"./FrontendHubAccess\";\r\nimport { FrontendLoggerCategory } from \"./FrontendLoggerCategory\";\r\nimport * as modelselector from \"./ModelSelectorState\";\r\nimport * as modelState from \"./ModelState\";\r\nimport { NotificationManager } from \"./NotificationManager\";\r\nimport { QuantityFormatter } from \"./quantity-formatting/QuantityFormatter\";\r\nimport { RenderSystem } from \"./render/RenderSystem\";\r\nimport { System } from \"./render/webgl/System\";\r\nimport * as sheetState from \"./SheetViewState\";\r\nimport * as spatialViewState from \"./SpatialViewState\";\r\nimport { TentativePoint } from \"./TentativePoint\";\r\nimport { MapLayerFormatRegistry, MapLayerOptions, TileAdmin } from \"./tile/internal\";\r\nimport * as accudrawTool from \"./tools/AccuDrawTool\";\r\nimport * as clipViewTool from \"./tools/ClipViewTool\";\r\nimport * as idleTool from \"./tools/IdleTool\";\r\nimport * as measureTool from \"./tools/MeasureTool\";\r\nimport * as selectTool from \"./tools/SelectTool\";\r\nimport { ToolRegistry } from \"./tools/Tool\";\r\nimport { ToolAdmin } from \"./tools/ToolAdmin\";\r\nimport * as viewTool from \"./tools/ViewTool\";\r\nimport { UserPreferencesAccess } from \"./UserPreferences\";\r\nimport { ViewManager } from \"./ViewManager\";\r\nimport * as viewState from \"./ViewState\";\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-var-requires\r\nrequire(\"./IModeljs-css\");\r\n\r\n// cSpell:ignore noopener noreferrer gprid forin nbsp csrf xsrf\r\n\r\n/** Options that can be supplied with [[IModelAppOptions]] to customize frontend security.\r\n * @public\r\n */\r\nexport interface FrontendSecurityOptions {\r\n /** Configures protection from Cross Site Request Forgery attacks. */\r\n readonly csrfProtection?: {\r\n /** If enabled, IModelApp will extract the CSRF token for the current session from the document's cookies and send it with each request as a header value. */\r\n readonly enabled: boolean;\r\n /** Defaults to XSRF-TOKEN. */\r\n readonly cookieName?: string;\r\n /** Defaults to X-XSRF-TOKEN. */\r\n readonly headerName?: string;\r\n };\r\n}\r\n\r\n/** Options that can be supplied to [[IModelApp.startup]] to customize frontend behavior.\r\n * @public\r\n */\r\nexport interface IModelAppOptions {\r\n /** If present, supplies the [[IModelClient]] for this session. */\r\n hubAccess?: FrontendHubAccess;\r\n /** If present, supplies the Id of this application. Applications must set this to the Bentley Global Product Registry Id (GPRID) for usage logging. */\r\n applicationId?: string;\r\n /** If present, supplies the version of this application. Must be set for usage logging. */\r\n applicationVersion?: string;\r\n /** If present, supplies the [[UserPreferencesAccess]] for this session.\r\n * @beta\r\n */\r\n userPreferences?: UserPreferencesAccess;\r\n /** If present, supplies the [[ViewManager]] for this session. */\r\n viewManager?: ViewManager;\r\n /** If present, supplies Map Layer Options for this session such as Azure Access Keys\r\n * @beta\r\n */\r\n mapLayerOptions?: MapLayerOptions;\r\n /** If present, supplies the properties with which to initialize the [[TileAdmin]] for this session. */\r\n tileAdmin?: TileAdmin.Props;\r\n /** If present, supplies the [[NotificationManager]] for this session. */\r\n notifications?: NotificationManager;\r\n /** If present, supplies the [[ToolAdmin]] for this session. */\r\n toolAdmin?: ToolAdmin;\r\n /** If present, supplies the [[AccuDraw]] for this session.\r\n * @internal\r\n */\r\n accuDraw?: AccuDraw;\r\n /** If present, supplies the [[AccuSnap]] for this session. */\r\n accuSnap?: AccuSnap;\r\n /** If present, supplies the [[Localization]] for this session. Defaults to [ITwinLocalization]($i18n). */\r\n localization?: Localization;\r\n /** If present, supplies the authorization information for various frontend APIs */\r\n authorizationClient?: AuthorizationClient;\r\n /** If present, supplies security options for the frontend. */\r\n security?: FrontendSecurityOptions;\r\n /** @internal */\r\n sessionId?: GuidString;\r\n /** @internal */\r\n locateManager?: ElementLocateManager;\r\n /** @internal */\r\n tentativePoint?: TentativePoint;\r\n /** @internal */\r\n quantityFormatter?: QuantityFormatter;\r\n /** @internal */\r\n renderSys?: RenderSystem | RenderSystem.Options;\r\n /** If present, supplies the [[UiAdmin]] for this session. */\r\n uiAdmin?: UiAdmin;\r\n rpcInterfaces?: RpcInterfaceDefinition[];\r\n /** @beta */\r\n realityDataAccess?: RealityDataAccess;\r\n /** If present, overrides where public assets are fetched. The default is to fetch assets relative to the current URL.\r\n * The path should always end with a trailing `/`.\r\n * @beta\r\n */\r\n publicPath?: string;\r\n}\r\n\r\n/** Options for [[IModelApp.makeModalDiv]]\r\n * @internal\r\n */\r\nexport interface ModalOptions {\r\n /** Width for the Modal dialog box. */\r\n width?: number;\r\n /** The dialog should be dismissed if the user clicks anywhere or hits Enter or Escape on the keyboard. */\r\n autoClose?: boolean;\r\n /** Show an 'x' in the upper right corner to close the dialog */\r\n closeBox?: boolean;\r\n /** The parent for the semi transparent *darkening* div. If not present, use `document.body` */\r\n rootDiv?: HTMLElement;\r\n}\r\n\r\n/** Return type for [[IModelApp.makeModalDiv]]\r\n * @internal\r\n */\r\nexport interface ModalReturn {\r\n /** The modal HTMLDivElement created. */\r\n modal: HTMLDivElement;\r\n /** A function that can be set as an event handler to stop the modal dialog. This can be used if `autoClose` or `closeBox` are not enabled. */\r\n stop: (_ev: Event) => void;\r\n}\r\n\r\n/** We hang the IModelApp object off the global `window` object in IModelApp.startup for debugging purposes.\r\n * It's removed in IModelApp.shutdown.\r\n */\r\ninterface IModelAppForDebugger {\r\n iModelAppForDebugger?: typeof IModelApp;\r\n}\r\n\r\n/**\r\n * Global singleton that connects the user interface with the iTwin.js services. There can be only one IModelApp active in a session. All\r\n * members of IModelApp are static, and it serves as a singleton object for gaining access to session information.\r\n *\r\n * Before any interactive operations may be performed by the `@itwin/core-frontend package`, [[IModelApp.startup]] must be called and awaited.\r\n * Applications may customize the frontend behavior of iTwin.js by supplying options to [[IModelApp.startup]].\r\n *\r\n * @public\r\n */\r\nexport class IModelApp {\r\n private static _initialized = false;\r\n private static _accuDraw: AccuDraw;\r\n private static _accuSnap: AccuSnap;\r\n private static _applicationId: string;\r\n private static _applicationVersion: string;\r\n private static _localization: Localization;\r\n private static _locateManager: ElementLocateManager;\r\n private static _notifications: NotificationManager;\r\n private static _quantityFormatter: QuantityFormatter;\r\n private static _renderSystem?: RenderSystem;\r\n private static _userPreferences?: UserPreferencesAccess;\r\n private static _tentativePoint: TentativePoint;\r\n private static _tileAdmin: TileAdmin;\r\n private static _toolAdmin: ToolAdmin;\r\n private static _viewManager: ViewManager;\r\n private static _uiAdmin: UiAdmin;\r\n private static _wantEventLoop = false;\r\n private static _animationRequested = false;\r\n private static _animationInterval: BeDuration | undefined = BeDuration.fromSeconds(1);\r\n private static _animationIntervalId?: number;\r\n private static _securityOptions: FrontendSecurityOptions;\r\n private static _mapLayerFormatRegistry: MapLayerFormatRegistry;\r\n private static _hubAccess?: FrontendHubAccess;\r\n private static _realityDataAccess?: RealityDataAccess;\r\n private static _publicPath: string;\r\n\r\n // No instances of IModelApp may be created. All members are static and must be on the singleton object IModelApp.\r\n protected constructor() { }\r\n\r\n /** Event raised just before the frontend IModelApp is to be shut down */\r\n public static readonly onBeforeShutdown = new BeEvent<() => void>();\r\n\r\n /** Provides authorization information for various frontend APIs */\r\n public static authorizationClient?: AuthorizationClient;\r\n /** The [[ToolRegistry]] for this session. */\r\n public static readonly tools = new ToolRegistry();\r\n /** A uniqueId for this session */\r\n public static sessionId: GuidString;\r\n /** The [[MapLayerProviderRegistry]] for this session.\r\n * @internal\r\n */\r\n public static get mapLayerFormatRegistry(): MapLayerFormatRegistry { return this._mapLayerFormatRegistry; }\r\n /** The [[RenderSystem]] for this session. */\r\n public static get renderSystem(): RenderSystem { return this._renderSystem!; }\r\n /** The [[ViewManager]] for this session. */\r\n public static get viewManager(): ViewManager { return this._viewManager; }\r\n\r\n /** The [[NotificationManager]] for this session. */\r\n public static get notifications(): NotificationManager { return this._notifications; }\r\n /** The [[TileAdmin]] for this session. */\r\n public static get tileAdmin(): TileAdmin { return this._tileAdmin; }\r\n /** The [[QuantityFormatter]] for this session.\r\n * @alpha\r\n */\r\n public static get quantityFormatter(): QuantityFormatter { return this._quantityFormatter; }\r\n /** The [[ToolAdmin]] for this session. */\r\n public static get toolAdmin(): ToolAdmin { return this._toolAdmin; }\r\n /** The [[AccuDraw]] for this session.\r\n * @internal\r\n */\r\n public static get accuDraw(): AccuDraw { return this._accuDraw; }\r\n /** The [[AccuSnap]] for this session. */\r\n public static get accuSnap(): AccuSnap { return this._accuSnap; }\r\n /** @internal */\r\n public static get locateManager(): ElementLocateManager { return this._locateManager; }\r\n /** @internal */\r\n public static get tentativePoint(): TentativePoint { return this._tentativePoint; }\r\n /** The [[Localization]] for this session. */\r\n public static get localization(): Localization { return this._localization; }\r\n /** The [[UserPreferencesAccess]] for this session.\r\n * @beta\r\n */\r\n public static get userPreferences(): UserPreferencesAccess | undefined { return this._userPreferences; }\r\n /** The Id of this application. Applications must set this to the Global Product Registry ID (GPRID) for usage logging. */\r\n public static get applicationId(): string { return this._applicationId; }\r\n /** The version of this application. Must be set for usage logging. */\r\n public static get applicationVersion(): string { return this._applicationVersion; }\r\n /** @internal */\r\n public static get initialized() { return this._initialized; }\r\n\r\n /** Provides access to the IModelHub implementation for this IModelApp.\r\n * @internal\r\n */\r\n public static get hubAccess(): FrontendHubAccess | undefined { return this._hubAccess; }\r\n /** Provides access to the RealityData service implementation for this IModelApp\r\n * @beta\r\n */\r\n public static get realityDataAccess(): RealityDataAccess | undefined { return this._realityDataAccess; }\r\n\r\n /** @internal */\r\n public static get hasRenderSystem() { return this._renderSystem !== undefined && this._renderSystem.isValid; }\r\n /** The [[UiAdmin]] for this session. */\r\n public static get uiAdmin() { return this._uiAdmin; }\r\n /** The requested security options for the frontend. */\r\n public static get securityOptions() { return this._securityOptions; }\r\n /** The root URL for the assets 'public' folder.\r\n * @beta\r\n */\r\n public static get publicPath() { return this._publicPath; }\r\n /** The [[TelemetryManager]] for this session\r\n * @internal\r\n */\r\n public static readonly telemetry: TelemetryManager = new TelemetryManager();\r\n\r\n /** Map of classFullName to EntityState class */\r\n private static _entityClasses = new Map<string, typeof EntityState>();\r\n\r\n /** Register all of the subclasses of EntityState from a module.\r\n * @internal\r\n */\r\n public static registerModuleEntities(moduleObj: any) {\r\n for (const thisMember in moduleObj) { // eslint-disable-line guard-for-in\r\n const thisEntityState = moduleObj[thisMember];\r\n if (thisEntityState.prototype instanceof EntityState) {\r\n this.registerEntityState(thisEntityState.classFullName, thisEntityState);\r\n }\r\n }\r\n }\r\n\r\n /** Register an EntityState class by its classFullName\r\n * @internal\r\n */\r\n public static registerEntityState(classFullName: string, classType: typeof EntityState) {\r\n const lowerName = classFullName.toLowerCase();\r\n if (this._entityClasses.has(lowerName)) {\r\n const errMsg = `Class ${classFullName} is already registered. Make sure static schemaName and className members are correct on class ${classType.name}`;\r\n Logger.logError(FrontendLoggerCategory.IModelConnection, errMsg);\r\n throw new Error(errMsg);\r\n }\r\n\r\n this._entityClasses.set(lowerName, classType);\r\n }\r\n\r\n /** @internal */\r\n public static lookupEntityClass(classFullName: string) { return this._entityClasses.get(classFullName.toLowerCase()); }\r\n\r\n /**\r\n * Obtain WebGL rendering compatibility information for the client system. This information describes whether the client meets the\r\n * minimum rendering capabilities. It also describes whether the system lacks any optional capabilities that could improve quality\r\n * and/or performance.\r\n */\r\n public static queryRenderCompatibility(): WebGLRenderCompatibilityInfo {\r\n if (undefined === System.instance || undefined === System.instance.options.useWebGL2)\r\n return queryRenderCompatibility(true, System.createContext);\r\n else\r\n return queryRenderCompatibility(System.instance.options.useWebGL2, System.createContext);\r\n }\r\n\r\n /**\r\n * This method must be called before any other `@itwin/core-frontend` methods are used.\r\n * Somewhere in your startup code, call [[IModelApp.startup]]. E.g.:\r\n * ``` ts\r\n * await IModelApp.startup( {applicationId: myAppId} );\r\n * ```\r\n * @param opts The options for configuring IModelApp\r\n */\r\n public static async startup(opts?: IModelAppOptions): Promise<void> {\r\n if (this._initialized)\r\n return; // we're already initialized, do nothing.\r\n this._initialized = true;\r\n\r\n opts = opts ?? {};\r\n this._securityOptions = opts.security ?? {};\r\n\r\n // Make IModelApp globally accessible for debugging purposes. We'll remove it on shutdown.\r\n (window as IModelAppForDebugger).iModelAppForDebugger = this;\r\n\r\n this.sessionId = opts.sessionId ?? Guid.createValue();\r\n this._applicationId = opts.applicationId ?? \"2686\"; // Default to product id of iTwin.js\r\n this._applicationVersion = opts.applicationVersion ?? \"1.0.0\";\r\n this.authorizationClient = opts.authorizationClient;\r\n this._hubAccess = opts.hubAccess;\r\n\r\n this._setupRpcRequestContext();\r\n\r\n this._localization = opts.localization ?? new ITwinLocalization();\r\n const toolsNs = \"CoreTools\";\r\n await this.localization.initialize([\"iModelJs\", toolsNs]);\r\n [\r\n selectTool,\r\n idleTool,\r\n viewTool,\r\n clipViewTool,\r\n measureTool,\r\n accudrawTool,\r\n ].forEach((tool) => this.tools.registerModule(tool, toolsNs));\r\n\r\n this.registerEntityState(EntityState.classFullName, EntityState);\r\n [\r\n modelState,\r\n sheetState,\r\n viewState,\r\n drawingViewState,\r\n spatialViewState,\r\n displayStyleState,\r\n modelselector,\r\n categorySelectorState,\r\n auxCoordState,\r\n ].forEach((module) => this.registerModuleEntities(module));\r\n\r\n this._renderSystem = (opts.renderSys instanceof RenderSystem) ? opts.renderSys : this.createRenderSys(opts.renderSys);\r\n if (opts.userPreferences)\r\n this._userPreferences = opts.userPreferences;\r\n this._viewManager = opts.viewManager ?? new ViewManager();\r\n this._tileAdmin = await TileAdmin.create(opts.tileAdmin);\r\n this._notifications = opts.notifications ?? new NotificationManager();\r\n this._toolAdmin = opts.toolAdmin ?? new ToolAdmin();\r\n this._accuDraw = opts.accuDraw ?? new AccuDraw();\r\n this._accuSnap = opts.accuSnap ?? new AccuSnap();\r\n this._locateManager = opts.locateManager ?? new ElementLocateManager();\r\n this._tentativePoint = opts.tentativePoint ?? new TentativePoint();\r\n this._quantityFormatter = opts.quantityFormatter ?? new QuantityFormatter();\r\n this._uiAdmin = opts.uiAdmin ?? new UiAdmin();\r\n this._mapLayerFormatRegistry = new MapLayerFormatRegistry(opts.mapLayerOptions);\r\n this._realityDataAccess = opts.realityDataAccess;\r\n this._publicPath = opts.publicPath ?? \"\";\r\n\r\n [\r\n this.renderSystem,\r\n this.viewManager,\r\n this.toolAdmin,\r\n this.accuDraw,\r\n this.accuSnap,\r\n this.locateManager,\r\n this.tentativePoint,\r\n this.uiAdmin,\r\n ].forEach((sys) => sys.onInitialized());\r\n\r\n return this.quantityFormatter.onInitialized();\r\n }\r\n\r\n /** Must be called before the application exits to release any held resources. */\r\n public static async shutdown() {\r\n if (!this._initialized)\r\n return;\r\n\r\n // notify listeners that this IModelApp is about to be shut down.\r\n this.onBeforeShutdown.raiseEvent();\r\n this.onBeforeShutdown.clear();\r\n\r\n (window as IModelAppForDebugger).iModelAppForDebugger = undefined;\r\n\r\n this._wantEventLoop = false;\r\n window.removeEventListener(\"resize\", IModelApp.requestNextAnimation);\r\n this.clearIntervalAnimation();\r\n [this.toolAdmin, this.viewManager, this.tileAdmin].forEach((sys) => sys.onShutDown());\r\n this.tools.shutdown();\r\n this._renderSystem = dispose(this._renderSystem);\r\n this._entityClasses.clear();\r\n this.authorizationClient = undefined;\r\n this._initialized = false;\r\n }\r\n\r\n /** Controls how frequently the application polls for changes that may require a new animation frame to be requested.\r\n * Such changes include resizing a Viewport or changing the device pixel ratio by zooming in or out in the browser.\r\n * The default interval is 1 second. It may be desirable to override the default for specific apps and/or devices.\r\n * - Increasing the interval can conserve battery life on battery-powered devices at the expense of slower response to resize events.\r\n * - An application that only displays a single Viewport whose dimensions only change when the dimensions of the application window change, and which does not support changing application zoom level, could disable the interval altogether.\r\n * @param interval The interval at which to poll for changes. If undefined (or negative), the application will never poll. If zero, the application will poll as frequently as possible.\r\n * @beta\r\n */\r\n public static get animationInterval(): BeDuration | undefined { return IModelApp._animationInterval; }\r\n public static set animationInterval(interval: BeDuration | undefined) {\r\n if (undefined !== interval && interval.isTowardsPast)\r\n interval = undefined;\r\n\r\n if (interval !== IModelApp._animationInterval) {\r\n IModelApp._animationInterval = interval;\r\n if (IModelApp._wantEventLoop)\r\n IModelApp.requestIntervalAnimation();\r\n }\r\n }\r\n\r\n /** @internal */\r\n public static requestNextAnimation() {\r\n if (!IModelApp._animationRequested) {\r\n IModelApp._animationRequested = true;\r\n requestAnimationFrame(IModelApp.eventLoop);\r\n }\r\n }\r\n\r\n /** @internal */\r\n private static clearIntervalAnimation(): void {\r\n if (undefined !== IModelApp._animationIntervalId) {\r\n window.clearInterval(IModelApp._animationIntervalId);\r\n IModelApp._animationIntervalId = undefined;\r\n }\r\n }\r\n\r\n /** @internal */\r\n private static requestIntervalAnimation(): void {\r\n IModelApp.clearIntervalAnimation();\r\n\r\n if (undefined !== IModelApp.animationInterval)\r\n IModelApp._animationIntervalId = window.setInterval(() => {\r\n IModelApp.requestNextAnimation();\r\n }, IModelApp.animationInterval.milliseconds);\r\n }\r\n\r\n /** @internal */\r\n public static startEventLoop() {\r\n if (!IModelApp._wantEventLoop) {\r\n IModelApp._wantEventLoop = true;\r\n window.addEventListener(\"resize\", IModelApp.requestNextAnimation);\r\n IModelApp.requestIntervalAnimation();\r\n IModelApp.requestNextAnimation();\r\n }\r\n }\r\n\r\n /** Strictly for tests. @internal */\r\n public static stopEventLoop() {\r\n this._wantEventLoop = false;\r\n }\r\n\r\n /** The main event processing loop for Tools and rendering. */\r\n private static eventLoop() {\r\n IModelApp._animationRequested = false;\r\n if (!IModelApp._wantEventLoop) // flag turned on at startup\r\n return;\r\n\r\n try {\r\n IModelApp.toolAdmin.processEvent(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n IModelApp.viewManager.renderLoop();\r\n IModelApp.tileAdmin.process();\r\n } catch (exception) {\r\n ToolAdmin.exceptionHandler(exception); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n\r\n IModelApp._wantEventLoop = false;\r\n IModelApp._animationRequested = true; // unrecoverable after exception, don't request any further frames.\r\n window.removeEventListener(\"resize\", IModelApp.requestNextAnimation);\r\n }\r\n }\r\n\r\n /** Get the user's access token for this IModelApp, or a blank string if none is available.\r\n * @note accessTokens expire periodically and are automatically refreshed, if possible. Therefore tokens should not be saved, and the value\r\n * returned by this method may change over time throughout the course of a session.\r\n */\r\n public static async getAccessToken(): Promise<AccessToken> {\r\n try {\r\n return (await this.authorizationClient?.getAccessToken()) ?? \"\";\r\n } catch (e) {\r\n return \"\";\r\n }\r\n }\r\n\r\n /** @internal */\r\n public static createRenderSys(opts?: RenderSystem.Options): RenderSystem { return System.create(opts); }\r\n\r\n private static _setupRpcRequestContext() {\r\n RpcConfiguration.requestContext.getId = (_request: RpcRequest): string => {\r\n return Guid.createValue();\r\n };\r\n\r\n RpcConfiguration.requestContext.serialize = async (_request: RpcRequest): Promise<SerializedRpcActivity> => {\r\n const id = _request.id;\r\n const serialized: SerializedRpcActivity = {\r\n id,\r\n applicationId: this.applicationId,\r\n applicationVersion: this.applicationVersion,\r\n sessionId: this.sessionId,\r\n authorization: await this.getAccessToken(),\r\n };\r\n\r\n const csrf = IModelApp.securityOptions.csrfProtection;\r\n if (csrf && csrf.enabled) {\r\n const cookieName = csrf.cookieName || \"XSRF-TOKEN\";\r\n const cookieValue = document.cookie.split(\"; \").find((r) => r.startsWith(`${cookieName}=`));\r\n\r\n if (cookieValue) {\r\n const headerName = csrf.headerName || \"X-XSRF-TOKEN\";\r\n const headerValue = cookieValue.split(\"=\")[1];\r\n serialized.csrfToken = { headerName, headerValue };\r\n }\r\n }\r\n\r\n return serialized;\r\n };\r\n }\r\n\r\n /** Shortcut for creating an HTMLElement with optional parent, className, id, innerHTML, innerText\r\n * @internal\r\n */\r\n public static makeHTMLElement<K extends keyof HTMLElementTagNameMap>(type: K, opt?: {\r\n /** The parent for the new HTMLElement */\r\n parent?: HTMLElement;\r\n /** The className for the new HTMLElement */\r\n className?: string;\r\n /** The Id for the new HTMLElement */\r\n id?: string;\r\n /** innerHTML for the new HTMLElement */\r\n innerHTML?: string;\r\n /** innerText for the new HTMLElement */\r\n innerText?: string;\r\n }) {\r\n const el = document.createElement(type);\r\n if (undefined !== opt) {\r\n if (undefined !== opt.className)\r\n el.className = opt.className;\r\n if (undefined !== opt.id)\r\n el.id = opt.id;\r\n if (undefined !== opt.innerHTML)\r\n el.innerHTML = opt.innerHTML;\r\n if (undefined !== opt.innerText)\r\n el.innerText = opt.innerText;\r\n if (undefined !== opt.parent)\r\n opt.parent.appendChild(el);\r\n }\r\n return el;\r\n }\r\n\r\n /** Make a modal dialog on top of the root of the application. The returned HTMLDivElement will be placed topmost, all other application\r\n * windows will be covered with a semi-transparent background that intercepts all key/mouse/touch events until the modal is dismissed.\r\n * @param options The options that describe how the modal should work.\r\n * @internal\r\n */\r\n public static makeModalDiv(options: ModalOptions): ModalReturn {\r\n const root = options.rootDiv ? options.rootDiv : document.body;\r\n // create the overlay div to \"black out\" the application to indicate everything is inactive until the modal has been dismissed.\r\n const overlay = IModelApp.makeHTMLElement(\"div\", { parent: root, className: \"imodeljs-modal-overlay\" });\r\n overlay.tabIndex = -1; // so we can catch keystroke events\r\n\r\n // function to remove modal dialog\r\n const stop = (ev: Event) => { root.removeChild(overlay); ev.stopPropagation(); };\r\n\r\n if (options.autoClose) {\r\n overlay.onclick = overlay.oncontextmenu = stop;\r\n overlay.onkeydown = overlay.onkeyup = (ev: KeyboardEvent) => { // ignore all keystrokes other than enter and escape\r\n switch (ev.key) {\r\n case \"Enter\":\r\n case \"Escape\":\r\n stop(ev);\r\n return;\r\n }\r\n ev.stopPropagation();\r\n };\r\n overlay.focus();\r\n }\r\n\r\n const modal = IModelApp.makeHTMLElement(\"div\", { parent: overlay, className: \"imodeljs-modal\" });\r\n if (undefined !== options.width) {\r\n modal.style.width = `${options.width}px`;\r\n // allow the dialog to be smaller than the width\r\n modal.style.maxWidth = `min(100% - (2 * var(--width-border)), ${options.width}px)`;\r\n }\r\n if (options.closeBox) {\r\n const close = IModelApp.makeHTMLElement(\"p\", { parent: modal, className: \"imodeljs-modal-close\" });\r\n close.innerText = \"\\u00d7\"; // unicode \"times\" symbol\r\n close.onclick = stop;\r\n }\r\n\r\n return { modal, stop };\r\n }\r\n\r\n /** Applications may implement this method to supply a Logo Card.\r\n * @beta\r\n */\r\n public static applicationLogoCard?: () => HTMLTableRowElement;\r\n\r\n /** Make a new Logo Card. Call this method from your implementation of [[IModelApp.applicationLogoCard]]\r\n * @param opts Options for Logo Card\r\n * @beta\r\n */\r\n public static makeLogoCard(\r\n opts: {\r\n /** The heading to be put at the top of this logo card inside an <h2>. May include HTML. */\r\n heading: string | HTMLElement;\r\n /** The URL or HTMLImageElement for the icon on this logo card. */\r\n iconSrc?: string | HTMLImageElement;\r\n /** The width of the icon, if `iconSrc` is a string. Default is 64. */\r\n iconWidth?: number;\r\n /** A *notice* string to be shown on the logo card. May include HTML. */\r\n notice?: string | HTMLElement;\r\n }): HTMLTableRowElement {\r\n const card = IModelApp.makeHTMLElement(\"tr\");\r\n const iconCell = IModelApp.makeHTMLElement(\"td\", { parent: card, className: \"logo-card-logo\" });\r\n if (undefined !== opts.iconSrc) {\r\n if (typeof opts.iconSrc === \"string\") {\r\n const logo = IModelApp.makeHTMLElement(\"img\");\r\n logo.src = opts.iconSrc;\r\n logo.width = opts.iconWidth ? opts.iconWidth : 64;\r\n opts.iconSrc = logo;\r\n }\r\n iconCell.appendChild(opts.iconSrc);\r\n }\r\n const noticeCell = IModelApp.makeHTMLElement(\"td\", { parent: card, className: \"logo-card-message\" });\r\n if (undefined !== opts.heading) {\r\n if (typeof opts.heading === \"string\")\r\n IModelApp.makeHTMLElement(\"h2\", { parent: noticeCell, innerHTML: opts.heading, className: \"logo-card-header\" });\r\n else\r\n noticeCell.appendChild(opts.heading);\r\n }\r\n if (undefined !== opts.notice) {\r\n if (typeof opts.notice === \"string\")\r\n IModelApp.makeHTMLElement(\"p\", { parent: noticeCell, innerHTML: opts.notice, className: \"logo-cards\" });\r\n else\r\n noticeCell.appendChild(opts.notice);\r\n }\r\n return card;\r\n }\r\n\r\n /** Make the logo card for the library itself. This card gets placed at the top of the stack.\r\n * @internal\r\n */\r\n public static makeIModelJsLogoCard() {\r\n return this.makeLogoCard({\r\n iconSrc: `${this.publicPath}images/about-imodeljs.svg`,\r\n heading: `<span style=\"font-weight:normal\">${this.localization.getLocalizedString(\"Notices.PoweredBy\")}</span>&nbsp;iTwin.js`,\r\n notice: `${require(\"../../package.json\").version}<br>${copyrightNotice}`, // eslint-disable-line @typescript-eslint/no-var-requires\r\n });\r\n }\r\n\r\n /** Format the tooltip strings returned by [[IModelConnection.getToolTipMessage]].\r\n * @alpha\r\n */\r\n public static formatElementToolTip(msg: string[]): HTMLElement {\r\n let out = \"\";\r\n msg.forEach((line) => out += `${IModelApp.localization?.getLocalizedKeys(line)}<br>`);\r\n const div = document.createElement(\"div\");\r\n div.innerHTML = out;\r\n return div;\r\n }\r\n\r\n /** Localize an error status\r\n * @param status one of the status values from [BentleyStatus]($core-bentley), [IModelStatus]($core-bentley) or [DbResult]($core-bentley)\r\n * @returns a localized error message\r\n * @beta\r\n */\r\n public static translateStatus(status: number) {\r\n let key: { scope: string, val: string, status?: string };\r\n if (typeof status !== \"number\") {\r\n key = { scope: \"Errors\", val: \"IllegalValue\" };\r\n } else {\r\n key = { scope: \"BentleyStatus\", val: BentleyStatus[status] };\r\n if (!key.val)\r\n key = { scope: \"IModelStatus\", val: IModelStatus[status] };\r\n if (!key.val)\r\n key = { scope: \"DbResult\", val: DbResult[status] };\r\n if (!key.val)\r\n key = { scope: \"Errors\", val: \"Status\", status: status.toString() };\r\n }\r\n\r\n return this.localization.getLocalizedString(`${key.scope}.${key.val}`, key);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"IModelApp.js","sourceRoot":"","sources":["../../src/IModelApp.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;AAEH,MAAM,eA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Ac,GAAG,KAAK,CAAC;AACvB,6BAAmB,GAAG,KAAK,CAAC;AAC5B,4BAAkB,GAA2B,yBAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;AAWtF,yEAAyE;AAClD,0BAAgB,GAAG,IAAI,sBAAO,EAAc,CAAC;AAIpE,6CAA6C;AACtB,eAAK,GAAG,IAAI,mBAAY,EAAE,CAAC;AAgElD;;GAEG;AACoB,mBAAS,GAAqB,IAAI,iCAAgB,EAAE,CAAC;AAE5E,gDAAgD;AACjC,wBAAc,GAAG,IAAI,GAAG,EAA8B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module IModelApp\r\n */\r\n\r\nconst copyrightNotice = 'Copyright © 2017-2021 <a href=\"https://www.bentley.com\" target=\"_blank\" rel=\"noopener noreferrer\">Bentley Systems, Inc.</a>';\r\n\r\nimport { TelemetryManager } from \"@itwin/core-telemetry\";\r\nimport { UiAdmin } from \"@itwin/appui-abstract\";\r\nimport { AccessToken, BeDuration, BeEvent, BentleyStatus, DbResult, dispose, Guid, GuidString, Logger } from \"@itwin/core-bentley\";\r\nimport {\r\n AuthorizationClient, IModelStatus, Localization, RealityDataAccess, RpcConfiguration, RpcInterfaceDefinition, RpcRequest, SerializedRpcActivity,\r\n} from \"@itwin/core-common\";\r\nimport { ITwinLocalization } from \"@itwin/core-i18n\";\r\nimport { queryRenderCompatibility, WebGLRenderCompatibilityInfo } from \"@itwin/webgl-compatibility\";\r\nimport { AccuDraw } from \"./AccuDraw\";\r\nimport { AccuSnap } from \"./AccuSnap\";\r\nimport * as auxCoordState from \"./AuxCoordSys\";\r\nimport * as categorySelectorState from \"./CategorySelectorState\";\r\nimport * as displayStyleState from \"./DisplayStyleState\";\r\nimport * as drawingViewState from \"./DrawingViewState\";\r\nimport { ElementLocateManager } from \"./ElementLocateManager\";\r\nimport { EntityState } from \"./EntityState\";\r\nimport { FrontendHubAccess } from \"./FrontendHubAccess\";\r\nimport { FrontendLoggerCategory } from \"./FrontendLoggerCategory\";\r\nimport * as modelselector from \"./ModelSelectorState\";\r\nimport * as modelState from \"./ModelState\";\r\nimport { NotificationManager } from \"./NotificationManager\";\r\nimport { QuantityFormatter } from \"./quantity-formatting/QuantityFormatter\";\r\nimport { RenderSystem } from \"./render/RenderSystem\";\r\nimport { System } from \"./render/webgl/System\";\r\nimport * as sheetState from \"./SheetViewState\";\r\nimport * as spatialViewState from \"./SpatialViewState\";\r\nimport { TentativePoint } from \"./TentativePoint\";\r\nimport { MapLayerFormatRegistry, MapLayerOptions, TileAdmin } from \"./tile/internal\";\r\nimport * as accudrawTool from \"./tools/AccuDrawTool\";\r\nimport * as clipViewTool from \"./tools/ClipViewTool\";\r\nimport * as idleTool from \"./tools/IdleTool\";\r\nimport * as measureTool from \"./tools/MeasureTool\";\r\nimport * as selectTool from \"./tools/SelectTool\";\r\nimport { ToolRegistry } from \"./tools/Tool\";\r\nimport { ToolAdmin } from \"./tools/ToolAdmin\";\r\nimport * as viewTool from \"./tools/ViewTool\";\r\nimport { UserPreferencesAccess } from \"./UserPreferences\";\r\nimport { ViewManager } from \"./ViewManager\";\r\nimport * as viewState from \"./ViewState\";\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-var-requires\r\nrequire(\"./IModeljs-css\");\r\n\r\n// cSpell:ignore noopener noreferrer gprid forin nbsp csrf xsrf\r\n\r\n/** Options that can be supplied with [[IModelAppOptions]] to customize frontend security.\r\n * @public\r\n */\r\nexport interface FrontendSecurityOptions {\r\n /** Configures protection from Cross Site Request Forgery attacks. */\r\n readonly csrfProtection?: {\r\n /** If enabled, IModelApp will extract the CSRF token for the current session from the document's cookies and send it with each request as a header value. */\r\n readonly enabled: boolean;\r\n /** Defaults to XSRF-TOKEN. */\r\n readonly cookieName?: string;\r\n /** Defaults to X-XSRF-TOKEN. */\r\n readonly headerName?: string;\r\n };\r\n}\r\n\r\n/** Options that can be supplied to [[IModelApp.startup]] to customize frontend behavior.\r\n * @public\r\n */\r\nexport interface IModelAppOptions {\r\n /** If present, supplies the [[IModelClient]] for this session. */\r\n hubAccess?: FrontendHubAccess;\r\n /** If present, supplies the Id of this application. Applications must set this to the Bentley Global Product Registry Id (GPRID) for usage logging. */\r\n applicationId?: string;\r\n /** If present, supplies the version of this application. Must be set for usage logging. */\r\n applicationVersion?: string;\r\n /** If present, supplies the [[UserPreferencesAccess]] for this session.\r\n * @beta\r\n */\r\n userPreferences?: UserPreferencesAccess;\r\n /** If present, supplies the [[ViewManager]] for this session. */\r\n viewManager?: ViewManager;\r\n /** If present, supplies Map Layer Options for this session such as Azure Access Keys\r\n * @beta\r\n */\r\n mapLayerOptions?: MapLayerOptions;\r\n /** If present, supplies the properties with which to initialize the [[TileAdmin]] for this session. */\r\n tileAdmin?: TileAdmin.Props;\r\n /** If present, supplies the [[NotificationManager]] for this session. */\r\n notifications?: NotificationManager;\r\n /** If present, supplies the [[ToolAdmin]] for this session. */\r\n toolAdmin?: ToolAdmin;\r\n /** If present, supplies the [[AccuDraw]] for this session.\r\n * @internal\r\n */\r\n accuDraw?: AccuDraw;\r\n /** If present, supplies the [[AccuSnap]] for this session. */\r\n accuSnap?: AccuSnap;\r\n /** If present, supplies the [[Localization]] for this session. Defaults to [ITwinLocalization]($i18n). */\r\n localization?: Localization;\r\n /** If present, supplies the authorization information for various frontend APIs */\r\n authorizationClient?: AuthorizationClient;\r\n /** If present, supplies security options for the frontend. */\r\n security?: FrontendSecurityOptions;\r\n /** @internal */\r\n sessionId?: GuidString;\r\n /** @internal */\r\n locateManager?: ElementLocateManager;\r\n /** @internal */\r\n tentativePoint?: TentativePoint;\r\n /** @internal */\r\n quantityFormatter?: QuantityFormatter;\r\n /** If present, supplies an implementation of the render system, or options for initializing the default render system. */\r\n renderSys?: RenderSystem | RenderSystem.Options;\r\n /** If present, supplies the [[UiAdmin]] for this session. */\r\n uiAdmin?: UiAdmin;\r\n rpcInterfaces?: RpcInterfaceDefinition[];\r\n /** @beta */\r\n realityDataAccess?: RealityDataAccess;\r\n /** If present, overrides where public assets are fetched. The default is to fetch assets relative to the current URL.\r\n * The path should always end with a trailing `/`.\r\n * @beta\r\n */\r\n publicPath?: string;\r\n}\r\n\r\n/** Options for [[IModelApp.makeModalDiv]]\r\n * @internal\r\n */\r\nexport interface ModalOptions {\r\n /** Width for the Modal dialog box. */\r\n width?: number;\r\n /** The dialog should be dismissed if the user clicks anywhere or hits Enter or Escape on the keyboard. */\r\n autoClose?: boolean;\r\n /** Show an 'x' in the upper right corner to close the dialog */\r\n closeBox?: boolean;\r\n /** The parent for the semi transparent *darkening* div. If not present, use `document.body` */\r\n rootDiv?: HTMLElement;\r\n}\r\n\r\n/** Return type for [[IModelApp.makeModalDiv]]\r\n * @internal\r\n */\r\nexport interface ModalReturn {\r\n /** The modal HTMLDivElement created. */\r\n modal: HTMLDivElement;\r\n /** A function that can be set as an event handler to stop the modal dialog. This can be used if `autoClose` or `closeBox` are not enabled. */\r\n stop: (_ev: Event) => void;\r\n}\r\n\r\n/** We hang the IModelApp object off the global `window` object in IModelApp.startup for debugging purposes.\r\n * It's removed in IModelApp.shutdown.\r\n */\r\ninterface IModelAppForDebugger {\r\n iModelAppForDebugger?: typeof IModelApp;\r\n}\r\n\r\n/**\r\n * Global singleton that connects the user interface with the iTwin.js services. There can be only one IModelApp active in a session. All\r\n * members of IModelApp are static, and it serves as a singleton object for gaining access to session information.\r\n *\r\n * Before any interactive operations may be performed by the `@itwin/core-frontend package`, [[IModelApp.startup]] must be called and awaited.\r\n * Applications may customize the frontend behavior of iTwin.js by supplying options to [[IModelApp.startup]].\r\n *\r\n * @public\r\n */\r\nexport class IModelApp {\r\n private static _initialized = false;\r\n private static _accuDraw: AccuDraw;\r\n private static _accuSnap: AccuSnap;\r\n private static _applicationId: string;\r\n private static _applicationVersion: string;\r\n private static _localization: Localization;\r\n private static _locateManager: ElementLocateManager;\r\n private static _notifications: NotificationManager;\r\n private static _quantityFormatter: QuantityFormatter;\r\n private static _renderSystem?: RenderSystem;\r\n private static _userPreferences?: UserPreferencesAccess;\r\n private static _tentativePoint: TentativePoint;\r\n private static _tileAdmin: TileAdmin;\r\n private static _toolAdmin: ToolAdmin;\r\n private static _viewManager: ViewManager;\r\n private static _uiAdmin: UiAdmin;\r\n private static _wantEventLoop = false;\r\n private static _animationRequested = false;\r\n private static _animationInterval: BeDuration | undefined = BeDuration.fromSeconds(1);\r\n private static _animationIntervalId?: number;\r\n private static _securityOptions: FrontendSecurityOptions;\r\n private static _mapLayerFormatRegistry: MapLayerFormatRegistry;\r\n private static _hubAccess?: FrontendHubAccess;\r\n private static _realityDataAccess?: RealityDataAccess;\r\n private static _publicPath: string;\r\n\r\n // No instances of IModelApp may be created. All members are static and must be on the singleton object IModelApp.\r\n protected constructor() { }\r\n\r\n /** Event raised just before the frontend IModelApp is to be shut down */\r\n public static readonly onBeforeShutdown = new BeEvent<() => void>();\r\n\r\n /** Provides authorization information for various frontend APIs */\r\n public static authorizationClient?: AuthorizationClient;\r\n /** The [[ToolRegistry]] for this session. */\r\n public static readonly tools = new ToolRegistry();\r\n /** A uniqueId for this session */\r\n public static sessionId: GuidString;\r\n /** The [[MapLayerProviderRegistry]] for this session.\r\n * @internal\r\n */\r\n public static get mapLayerFormatRegistry(): MapLayerFormatRegistry { return this._mapLayerFormatRegistry; }\r\n /** The [[RenderSystem]] for this session. */\r\n public static get renderSystem(): RenderSystem { return this._renderSystem!; }\r\n /** The [[ViewManager]] for this session. */\r\n public static get viewManager(): ViewManager { return this._viewManager; }\r\n\r\n /** The [[NotificationManager]] for this session. */\r\n public static get notifications(): NotificationManager { return this._notifications; }\r\n /** The [[TileAdmin]] for this session. */\r\n public static get tileAdmin(): TileAdmin { return this._tileAdmin; }\r\n /** The [[QuantityFormatter]] for this session.\r\n * @alpha\r\n */\r\n public static get quantityFormatter(): QuantityFormatter { return this._quantityFormatter; }\r\n /** The [[ToolAdmin]] for this session. */\r\n public static get toolAdmin(): ToolAdmin { return this._toolAdmin; }\r\n /** The [[AccuDraw]] for this session.\r\n * @internal\r\n */\r\n public static get accuDraw(): AccuDraw { return this._accuDraw; }\r\n /** The [[AccuSnap]] for this session. */\r\n public static get accuSnap(): AccuSnap { return this._accuSnap; }\r\n /** @internal */\r\n public static get locateManager(): ElementLocateManager { return this._locateManager; }\r\n /** @internal */\r\n public static get tentativePoint(): TentativePoint { return this._tentativePoint; }\r\n /** The [[Localization]] for this session. */\r\n public static get localization(): Localization { return this._localization; }\r\n /** The [[UserPreferencesAccess]] for this session.\r\n * @beta\r\n */\r\n public static get userPreferences(): UserPreferencesAccess | undefined { return this._userPreferences; }\r\n /** The Id of this application. Applications must set this to the Global Product Registry ID (GPRID) for usage logging. */\r\n public static get applicationId(): string { return this._applicationId; }\r\n /** The version of this application. Must be set for usage logging. */\r\n public static get applicationVersion(): string { return this._applicationVersion; }\r\n /** @internal */\r\n public static get initialized() { return this._initialized; }\r\n\r\n /** Provides access to the IModelHub implementation for this IModelApp.\r\n * @internal\r\n */\r\n public static get hubAccess(): FrontendHubAccess | undefined { return this._hubAccess; }\r\n /** Provides access to the RealityData service implementation for this IModelApp\r\n * @beta\r\n */\r\n public static get realityDataAccess(): RealityDataAccess | undefined { return this._realityDataAccess; }\r\n\r\n /** @internal */\r\n public static get hasRenderSystem() { return this._renderSystem !== undefined && this._renderSystem.isValid; }\r\n /** The [[UiAdmin]] for this session. */\r\n public static get uiAdmin() { return this._uiAdmin; }\r\n /** The requested security options for the frontend. */\r\n public static get securityOptions() { return this._securityOptions; }\r\n /** The root URL for the assets 'public' folder.\r\n * @beta\r\n */\r\n public static get publicPath() { return this._publicPath; }\r\n /** The [[TelemetryManager]] for this session\r\n * @internal\r\n */\r\n public static readonly telemetry: TelemetryManager = new TelemetryManager();\r\n\r\n /** Map of classFullName to EntityState class */\r\n private static _entityClasses = new Map<string, typeof EntityState>();\r\n\r\n /** Register all of the subclasses of EntityState from a module.\r\n * @internal\r\n */\r\n public static registerModuleEntities(moduleObj: any) {\r\n for (const thisMember in moduleObj) { // eslint-disable-line guard-for-in\r\n const thisEntityState = moduleObj[thisMember];\r\n if (thisEntityState.prototype instanceof EntityState) {\r\n this.registerEntityState(thisEntityState.classFullName, thisEntityState);\r\n }\r\n }\r\n }\r\n\r\n /** Register an EntityState class by its classFullName\r\n * @internal\r\n */\r\n public static registerEntityState(classFullName: string, classType: typeof EntityState) {\r\n const lowerName = classFullName.toLowerCase();\r\n if (this._entityClasses.has(lowerName)) {\r\n const errMsg = `Class ${classFullName} is already registered. Make sure static schemaName and className members are correct on class ${classType.name}`;\r\n Logger.logError(FrontendLoggerCategory.IModelConnection, errMsg);\r\n throw new Error(errMsg);\r\n }\r\n\r\n this._entityClasses.set(lowerName, classType);\r\n }\r\n\r\n /** @internal */\r\n public static lookupEntityClass(classFullName: string) { return this._entityClasses.get(classFullName.toLowerCase()); }\r\n\r\n /**\r\n * Obtain WebGL rendering compatibility information for the client system. This information describes whether the client meets the\r\n * minimum rendering capabilities. It also describes whether the system lacks any optional capabilities that could improve quality\r\n * and/or performance.\r\n */\r\n public static queryRenderCompatibility(): WebGLRenderCompatibilityInfo {\r\n if (undefined === System.instance || undefined === System.instance.options.useWebGL2)\r\n return queryRenderCompatibility(true, System.createContext);\r\n else\r\n return queryRenderCompatibility(System.instance.options.useWebGL2, System.createContext);\r\n }\r\n\r\n /**\r\n * This method must be called before any other `@itwin/core-frontend` methods are used.\r\n * Somewhere in your startup code, call [[IModelApp.startup]]. E.g.:\r\n * ``` ts\r\n * await IModelApp.startup( {applicationId: myAppId} );\r\n * ```\r\n * @param opts The options for configuring IModelApp\r\n */\r\n public static async startup(opts?: IModelAppOptions): Promise<void> {\r\n if (this._initialized)\r\n return; // we're already initialized, do nothing.\r\n this._initialized = true;\r\n\r\n opts = opts ?? {};\r\n this._securityOptions = opts.security ?? {};\r\n\r\n // Make IModelApp globally accessible for debugging purposes. We'll remove it on shutdown.\r\n (window as IModelAppForDebugger).iModelAppForDebugger = this;\r\n\r\n this.sessionId = opts.sessionId ?? Guid.createValue();\r\n this._applicationId = opts.applicationId ?? \"2686\"; // Default to product id of iTwin.js\r\n this._applicationVersion = opts.applicationVersion ?? \"1.0.0\";\r\n this.authorizationClient = opts.authorizationClient;\r\n this._hubAccess = opts.hubAccess;\r\n\r\n this._setupRpcRequestContext();\r\n\r\n this._localization = opts.localization ?? new ITwinLocalization();\r\n const toolsNs = \"CoreTools\";\r\n await this.localization.initialize([\"iModelJs\", toolsNs]);\r\n [\r\n selectTool,\r\n idleTool,\r\n viewTool,\r\n clipViewTool,\r\n measureTool,\r\n accudrawTool,\r\n ].forEach((tool) => this.tools.registerModule(tool, toolsNs));\r\n\r\n this.registerEntityState(EntityState.classFullName, EntityState);\r\n [\r\n modelState,\r\n sheetState,\r\n viewState,\r\n drawingViewState,\r\n spatialViewState,\r\n displayStyleState,\r\n modelselector,\r\n categorySelectorState,\r\n auxCoordState,\r\n ].forEach((module) => this.registerModuleEntities(module));\r\n\r\n this._renderSystem = (opts.renderSys instanceof RenderSystem) ? opts.renderSys : this.createRenderSys(opts.renderSys);\r\n if (opts.userPreferences)\r\n this._userPreferences = opts.userPreferences;\r\n this._viewManager = opts.viewManager ?? new ViewManager();\r\n this._tileAdmin = await TileAdmin.create(opts.tileAdmin);\r\n this._notifications = opts.notifications ?? new NotificationManager();\r\n this._toolAdmin = opts.toolAdmin ?? new ToolAdmin();\r\n this._accuDraw = opts.accuDraw ?? new AccuDraw();\r\n this._accuSnap = opts.accuSnap ?? new AccuSnap();\r\n this._locateManager = opts.locateManager ?? new ElementLocateManager();\r\n this._tentativePoint = opts.tentativePoint ?? new TentativePoint();\r\n this._quantityFormatter = opts.quantityFormatter ?? new QuantityFormatter();\r\n this._uiAdmin = opts.uiAdmin ?? new UiAdmin();\r\n this._mapLayerFormatRegistry = new MapLayerFormatRegistry(opts.mapLayerOptions);\r\n this._realityDataAccess = opts.realityDataAccess;\r\n this._publicPath = opts.publicPath ?? \"\";\r\n\r\n [\r\n this.renderSystem,\r\n this.viewManager,\r\n this.toolAdmin,\r\n this.accuDraw,\r\n this.accuSnap,\r\n this.locateManager,\r\n this.tentativePoint,\r\n this.uiAdmin,\r\n ].forEach((sys) => sys.onInitialized());\r\n\r\n return this.quantityFormatter.onInitialized();\r\n }\r\n\r\n /** Must be called before the application exits to release any held resources. */\r\n public static async shutdown() {\r\n if (!this._initialized)\r\n return;\r\n\r\n // notify listeners that this IModelApp is about to be shut down.\r\n this.onBeforeShutdown.raiseEvent();\r\n this.onBeforeShutdown.clear();\r\n\r\n (window as IModelAppForDebugger).iModelAppForDebugger = undefined;\r\n\r\n this._wantEventLoop = false;\r\n window.removeEventListener(\"resize\", IModelApp.requestNextAnimation);\r\n this.clearIntervalAnimation();\r\n [this.toolAdmin, this.viewManager, this.tileAdmin].forEach((sys) => sys.onShutDown());\r\n this.tools.shutdown();\r\n this._renderSystem = dispose(this._renderSystem);\r\n this._entityClasses.clear();\r\n this.authorizationClient = undefined;\r\n this._initialized = false;\r\n }\r\n\r\n /** Controls how frequently the application polls for changes that may require a new animation frame to be requested.\r\n * Such changes include resizing a Viewport or changing the device pixel ratio by zooming in or out in the browser.\r\n * The default interval is 1 second. It may be desirable to override the default for specific apps and/or devices.\r\n * - Increasing the interval can conserve battery life on battery-powered devices at the expense of slower response to resize events.\r\n * - An application that only displays a single Viewport whose dimensions only change when the dimensions of the application window change, and which does not support changing application zoom level, could disable the interval altogether.\r\n * @param interval The interval at which to poll for changes. If undefined (or negative), the application will never poll. If zero, the application will poll as frequently as possible.\r\n * @beta\r\n */\r\n public static get animationInterval(): BeDuration | undefined { return IModelApp._animationInterval; }\r\n public static set animationInterval(interval: BeDuration | undefined) {\r\n if (undefined !== interval && interval.isTowardsPast)\r\n interval = undefined;\r\n\r\n if (interval !== IModelApp._animationInterval) {\r\n IModelApp._animationInterval = interval;\r\n if (IModelApp._wantEventLoop)\r\n IModelApp.requestIntervalAnimation();\r\n }\r\n }\r\n\r\n /** @internal */\r\n public static requestNextAnimation() {\r\n if (!IModelApp._animationRequested) {\r\n IModelApp._animationRequested = true;\r\n requestAnimationFrame(IModelApp.eventLoop);\r\n }\r\n }\r\n\r\n /** @internal */\r\n private static clearIntervalAnimation(): void {\r\n if (undefined !== IModelApp._animationIntervalId) {\r\n window.clearInterval(IModelApp._animationIntervalId);\r\n IModelApp._animationIntervalId = undefined;\r\n }\r\n }\r\n\r\n /** @internal */\r\n private static requestIntervalAnimation(): void {\r\n IModelApp.clearIntervalAnimation();\r\n\r\n if (undefined !== IModelApp.animationInterval)\r\n IModelApp._animationIntervalId = window.setInterval(() => {\r\n IModelApp.requestNextAnimation();\r\n }, IModelApp.animationInterval.milliseconds);\r\n }\r\n\r\n /** @internal */\r\n public static startEventLoop() {\r\n if (!IModelApp._wantEventLoop) {\r\n IModelApp._wantEventLoop = true;\r\n window.addEventListener(\"resize\", IModelApp.requestNextAnimation);\r\n IModelApp.requestIntervalAnimation();\r\n IModelApp.requestNextAnimation();\r\n }\r\n }\r\n\r\n /** Strictly for tests. @internal */\r\n public static stopEventLoop() {\r\n this._wantEventLoop = false;\r\n }\r\n\r\n /** The main event processing loop for Tools and rendering. */\r\n private static eventLoop() {\r\n IModelApp._animationRequested = false;\r\n if (!IModelApp._wantEventLoop) // flag turned on at startup\r\n return;\r\n\r\n try {\r\n IModelApp.toolAdmin.processEvent(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n IModelApp.viewManager.renderLoop();\r\n IModelApp.tileAdmin.process();\r\n } catch (exception) {\r\n ToolAdmin.exceptionHandler(exception); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n\r\n IModelApp._wantEventLoop = false;\r\n IModelApp._animationRequested = true; // unrecoverable after exception, don't request any further frames.\r\n window.removeEventListener(\"resize\", IModelApp.requestNextAnimation);\r\n }\r\n }\r\n\r\n /** Get the user's access token for this IModelApp, or a blank string if none is available.\r\n * @note accessTokens expire periodically and are automatically refreshed, if possible. Therefore tokens should not be saved, and the value\r\n * returned by this method may change over time throughout the course of a session.\r\n */\r\n public static async getAccessToken(): Promise<AccessToken> {\r\n try {\r\n return (await this.authorizationClient?.getAccessToken()) ?? \"\";\r\n } catch (e) {\r\n return \"\";\r\n }\r\n }\r\n\r\n /** @internal */\r\n public static createRenderSys(opts?: RenderSystem.Options): RenderSystem { return System.create(opts); }\r\n\r\n private static _setupRpcRequestContext() {\r\n RpcConfiguration.requestContext.getId = (_request: RpcRequest): string => {\r\n return Guid.createValue();\r\n };\r\n\r\n RpcConfiguration.requestContext.serialize = async (_request: RpcRequest): Promise<SerializedRpcActivity> => {\r\n const id = _request.id;\r\n const serialized: SerializedRpcActivity = {\r\n id,\r\n applicationId: this.applicationId,\r\n applicationVersion: this.applicationVersion,\r\n sessionId: this.sessionId,\r\n authorization: await this.getAccessToken(),\r\n };\r\n\r\n const csrf = IModelApp.securityOptions.csrfProtection;\r\n if (csrf && csrf.enabled) {\r\n const cookieName = csrf.cookieName || \"XSRF-TOKEN\";\r\n const cookieValue = document.cookie.split(\"; \").find((r) => r.startsWith(`${cookieName}=`));\r\n\r\n if (cookieValue) {\r\n const headerName = csrf.headerName || \"X-XSRF-TOKEN\";\r\n const headerValue = cookieValue.split(\"=\")[1];\r\n serialized.csrfToken = { headerName, headerValue };\r\n }\r\n }\r\n\r\n return serialized;\r\n };\r\n }\r\n\r\n /** Shortcut for creating an HTMLElement with optional parent, className, id, innerHTML, innerText\r\n * @internal\r\n */\r\n public static makeHTMLElement<K extends keyof HTMLElementTagNameMap>(type: K, opt?: {\r\n /** The parent for the new HTMLElement */\r\n parent?: HTMLElement;\r\n /** The className for the new HTMLElement */\r\n className?: string;\r\n /** The Id for the new HTMLElement */\r\n id?: string;\r\n /** innerHTML for the new HTMLElement */\r\n innerHTML?: string;\r\n /** innerText for the new HTMLElement */\r\n innerText?: string;\r\n }) {\r\n const el = document.createElement(type);\r\n if (undefined !== opt) {\r\n if (undefined !== opt.className)\r\n el.className = opt.className;\r\n if (undefined !== opt.id)\r\n el.id = opt.id;\r\n if (undefined !== opt.innerHTML)\r\n el.innerHTML = opt.innerHTML;\r\n if (undefined !== opt.innerText)\r\n el.innerText = opt.innerText;\r\n if (undefined !== opt.parent)\r\n opt.parent.appendChild(el);\r\n }\r\n return el;\r\n }\r\n\r\n /** Make a modal dialog on top of the root of the application. The returned HTMLDivElement will be placed topmost, all other application\r\n * windows will be covered with a semi-transparent background that intercepts all key/mouse/touch events until the modal is dismissed.\r\n * @param options The options that describe how the modal should work.\r\n * @internal\r\n */\r\n public static makeModalDiv(options: ModalOptions): ModalReturn {\r\n const root = options.rootDiv ? options.rootDiv : document.body;\r\n // create the overlay div to \"black out\" the application to indicate everything is inactive until the modal has been dismissed.\r\n const overlay = IModelApp.makeHTMLElement(\"div\", { parent: root, className: \"imodeljs-modal-overlay\" });\r\n overlay.tabIndex = -1; // so we can catch keystroke events\r\n\r\n // function to remove modal dialog\r\n const stop = (ev: Event) => { root.removeChild(overlay); ev.stopPropagation(); };\r\n\r\n if (options.autoClose) {\r\n overlay.onclick = overlay.oncontextmenu = stop;\r\n overlay.onkeydown = overlay.onkeyup = (ev: KeyboardEvent) => { // ignore all keystrokes other than enter and escape\r\n switch (ev.key) {\r\n case \"Enter\":\r\n case \"Escape\":\r\n stop(ev);\r\n return;\r\n }\r\n ev.stopPropagation();\r\n };\r\n overlay.focus();\r\n }\r\n\r\n const modal = IModelApp.makeHTMLElement(\"div\", { parent: overlay, className: \"imodeljs-modal\" });\r\n if (undefined !== options.width) {\r\n modal.style.width = `${options.width}px`;\r\n // allow the dialog to be smaller than the width\r\n modal.style.maxWidth = `min(100% - (2 * var(--width-border)), ${options.width}px)`;\r\n }\r\n if (options.closeBox) {\r\n const close = IModelApp.makeHTMLElement(\"p\", { parent: modal, className: \"imodeljs-modal-close\" });\r\n close.innerText = \"\\u00d7\"; // unicode \"times\" symbol\r\n close.onclick = stop;\r\n }\r\n\r\n return { modal, stop };\r\n }\r\n\r\n /** Applications may implement this method to supply a Logo Card.\r\n * @beta\r\n */\r\n public static applicationLogoCard?: () => HTMLTableRowElement;\r\n\r\n /** Make a new Logo Card. Call this method from your implementation of [[IModelApp.applicationLogoCard]]\r\n * @param opts Options for Logo Card\r\n * @beta\r\n */\r\n public static makeLogoCard(\r\n opts: {\r\n /** The heading to be put at the top of this logo card inside an <h2>. May include HTML. */\r\n heading: string | HTMLElement;\r\n /** The URL or HTMLImageElement for the icon on this logo card. */\r\n iconSrc?: string | HTMLImageElement;\r\n /** The width of the icon, if `iconSrc` is a string. Default is 64. */\r\n iconWidth?: number;\r\n /** A *notice* string to be shown on the logo card. May include HTML. */\r\n notice?: string | HTMLElement;\r\n }): HTMLTableRowElement {\r\n const card = IModelApp.makeHTMLElement(\"tr\");\r\n const iconCell = IModelApp.makeHTMLElement(\"td\", { parent: card, className: \"logo-card-logo\" });\r\n if (undefined !== opts.iconSrc) {\r\n if (typeof opts.iconSrc === \"string\") {\r\n const logo = IModelApp.makeHTMLElement(\"img\");\r\n logo.src = opts.iconSrc;\r\n logo.width = opts.iconWidth ? opts.iconWidth : 64;\r\n opts.iconSrc = logo;\r\n }\r\n iconCell.appendChild(opts.iconSrc);\r\n }\r\n const noticeCell = IModelApp.makeHTMLElement(\"td\", { parent: card, className: \"logo-card-message\" });\r\n if (undefined !== opts.heading) {\r\n if (typeof opts.heading === \"string\")\r\n IModelApp.makeHTMLElement(\"h2\", { parent: noticeCell, innerHTML: opts.heading, className: \"logo-card-header\" });\r\n else\r\n noticeCell.appendChild(opts.heading);\r\n }\r\n if (undefined !== opts.notice) {\r\n if (typeof opts.notice === \"string\")\r\n IModelApp.makeHTMLElement(\"p\", { parent: noticeCell, innerHTML: opts.notice, className: \"logo-cards\" });\r\n else\r\n noticeCell.appendChild(opts.notice);\r\n }\r\n return card;\r\n }\r\n\r\n /** Make the logo card for the library itself. This card gets placed at the top of the stack.\r\n * @internal\r\n */\r\n public static makeIModelJsLogoCard() {\r\n return this.makeLogoCard({\r\n iconSrc: `${this.publicPath}images/about-imodeljs.svg`,\r\n heading: `<span style=\"font-weight:normal\">${this.localization.getLocalizedString(\"Notices.PoweredBy\")}</span>&nbsp;iTwin.js`,\r\n notice: `${require(\"../../package.json\").version}<br>${copyrightNotice}`, // eslint-disable-line @typescript-eslint/no-var-requires\r\n });\r\n }\r\n\r\n /** Format the tooltip strings returned by [[IModelConnection.getToolTipMessage]].\r\n * @alpha\r\n */\r\n public static formatElementToolTip(msg: string[]): HTMLElement {\r\n let out = \"\";\r\n msg.forEach((line) => out += `${IModelApp.localization?.getLocalizedKeys(line)}<br>`);\r\n const div = document.createElement(\"div\");\r\n div.innerHTML = out;\r\n return div;\r\n }\r\n\r\n /** Localize an error status\r\n * @param status one of the status values from [BentleyStatus]($core-bentley), [IModelStatus]($core-bentley) or [DbResult]($core-bentley)\r\n * @returns a localized error message\r\n * @beta\r\n */\r\n public static translateStatus(status: number) {\r\n let key: { scope: string, val: string, status?: string };\r\n if (typeof status !== \"number\") {\r\n key = { scope: \"Errors\", val: \"IllegalValue\" };\r\n } else {\r\n key = { scope: \"BentleyStatus\", val: BentleyStatus[status] };\r\n if (!key.val)\r\n key = { scope: \"IModelStatus\", val: IModelStatus[status] };\r\n if (!key.val)\r\n key = { scope: \"DbResult\", val: DbResult[status] };\r\n if (!key.val)\r\n key = { scope: \"Errors\", val: \"Status\", status: status.toString() };\r\n }\r\n\r\n return this.localization.getLocalizedString(`${key.scope}.${key.val}`, key);\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ImageUtil.d.ts","sourceRoot":"","sources":["../../src/ImageUtil.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACpG,OAAO,EAAE,QAAQ,EAAE,MAAM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AE,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAGhG;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAYhF;AAED;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAM/F;AACD;;;;;GAKG;AACH,wBAAsB,4BAA4B,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAGxF;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,WAAW,EAAE,aAAa,UAAO,GAAG,MAAM,GAAG,SAAS,CAIrG;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,WAAW,EAAE,aAAa,UAAO,GAAG,MAAM,GAAG,SAAS,CAO3G;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAc7E;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,SAAM,GAAG,QAAQ,CAUnF;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,iBAAiB,EAAE,QAAQ,SAAQ,EAAE,qBAAqB,SAAM,GAAG,MAAM,GAAG,SAAS,CAexI"}
@@ -181,8 +181,11 @@ exports.imageElementFromImageSource = imageElementFromImageSource;
181
181
  * @public
182
182
  */
183
183
  async function imageElementFromUrl(url) {
184
+ // We must set crossorigin property so that images loaded from same origin can be used with texImage2d.
185
+ // We must do that outside of the promise constructor or it won't work, for reasons.
186
+ const image = new Image();
187
+ image.crossOrigin = "anonymous";
184
188
  return new Promise((resolve, reject) => {
185
- const image = new Image();
186
189
  image.onload = () => resolve(image);
187
190
  // The "error" produced by Image is not an Error. It looks like an Event, but isn't one.
188
191
  image.onerror = () => reject(new Error("Failed to create image from url"));
@@ -1 +1 @@
1
- {"version":3,"file":"ImageUtil.js","sourceRoot":"","sources":["../../src/ImageUtil.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAsD;AACtD,wDAA+C;AAC/C,oDAAoG;AACpG,yCAAsC;AAStC,MAAM,WAAW,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AAE/C,SAAS,aAAa,CAAC,IAAU,EAAE,GAAe,EAAE,GAAW;IAC7D,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7C,OAAO,GAAG,GAAG,CAAC,CAAC;AACjB,CAAC;AAED,SAAS,WAAW,CAAC,IAAU,EAAE,GAAe,EAAE,GAAW;IAC3D,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IACtB,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IACtB,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IACtB,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC;IACb,OAAO,GAAG,GAAG,CAAC,CAAC;AACjB,CAAC;AAED,SAAS,YAAY,CAAC,IAAU,EAAE,GAAe,EAAE,GAAW;IAC5D,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IAC5B,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IACtB,OAAO,GAAG,GAAG,CAAC,CAAC;AACjB,CAAC;AAED;;;;;;;GAOG;AACH,SAAg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gB,2BAA2B,CAAC,MAAyB,EAAE,QAAQ,GAAG,KAAK,EAAE,qBAAqB,GAAG,GAAG;IAClH,MAAM,UAAU,GAAG,GAAG,CAAC,CAAC,wBAAwB;IAChD,MAAM,iBAAiB,GAAG,CAAC,CAAC,CAAC,8BAA8B;IAC3D,IAAI,OAAO,GAAG,GAAG,CAAC,CAAC,2BAA2B;IAE9C,OAAO,OAAO,GAAG,qBAAqB,EAAE;QACtC,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACrD,yCAAyC;QACzC,IAAI,IAAI,CAAC,MAAM,GAAG,iBAAiB,GAAG,QAAQ;YAC5C,OAAO,IAAI,CAAC;QAEd,OAAO,IAAI,UAAU,CAAC;KACvB;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAfD,kEAeC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Rendering\r\n */\r\n\r\nimport { ProcessDetector } from \"@itwin/core-bentley\";\r\nimport { Point2d } from \"@itwin/core-geometry\";\r\nimport { ImageBuffer, ImageBufferFormat, ImageSource, ImageSourceFormat } from \"@itwin/core-common\";\r\nimport { ViewRect } from \"./ViewRect\";\r\n\r\ninterface Rgba {\r\n r: number;\r\n g: number;\r\n b: number;\r\n a: number;\r\n}\r\n\r\nconst scratchRgba = { r: 0, g: 0, b: 0, a: 0 };\r\n\r\nfunction rgbaFromAlpha(rgba: Rgba, src: Uint8Array, idx: number): number {\r\n rgba.r = rgba.g = rgba.b = rgba.a = src[idx];\r\n return idx + 1;\r\n}\r\n\r\nfunction rgbaFromRgb(rgba: Rgba, src: Uint8Array, idx: number): number {\r\n rgba.r = src[idx + 0];\r\n rgba.g = src[idx + 1];\r\n rgba.b = src[idx + 2];\r\n rgba.a = 255;\r\n return idx + 3;\r\n}\r\n\r\nfunction rgbaFromRgba(rgba: Rgba, src: Uint8Array, idx: number): number {\r\n rgbaFromRgb(rgba, src, idx);\r\n rgba.a = src[idx + 3];\r\n return idx + 4;\r\n}\r\n\r\n/** Resize a canvas to a desired size. The final size will be targetSize plus barSize. The original canvas is left untouched and a new, resized canvas with potential side bars is returned.\r\n * @param canvasIn the source [HTMLCanvasElement](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement) to resize.\r\n * @param targetSize the desired new size for the canvas image.\r\n * @param barSize total size of side bars to add to the image in width and height; defaults to (0, 0). For example, if you specify (2, 0), a 1 pixel side bar will be added to the left and right sides of the resized image. If an odd dimension is specified, the left or upper side of the image will be one pixel larger than the opposite side. For example, if you specify (1, 0), a 1 pixel side bar will be added to the left side of the image and a 0 pixel side bar will be added to the right side of the image.\r\n * @param barStyle CSS style string to apply to any side bars; defaults to \"#C0C0C0\", which is silver.\r\n * @returns an [HTMLCanvasElement](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement) object containing the resized image and any requested side bars.\r\n * @public\r\n */\r\nexport function canvasToResizedCanvasWithBars(canvasIn: HTMLCanvasElement, targetSize: Point2d, barSize = new Point2d(0, 0), barStyle = \"#C0C0C0\"): HTMLCanvasElement {\r\n const canvasOut = document.createElement(\"canvas\");\r\n canvasOut.width = targetSize.x + barSize.x;\r\n canvasOut.height = targetSize.y + barSize.y;\r\n\r\n let adjustImageX = barSize.x / 2;\r\n let adjustImageY = barSize.y / 2;\r\n\r\n if (1 === barSize.x % 2) {\r\n adjustImageX += 0.5;\r\n }\r\n if (1 === barSize.y % 2) {\r\n adjustImageY += 0.5;\r\n }\r\n\r\n const context = canvasOut.getContext(\"2d\")!;\r\n context.fillStyle = barStyle;\r\n context.fillRect(0, 0, canvasOut.width, canvasOut.height);\r\n context.drawImage(canvasIn, adjustImageX, adjustImageY, targetSize.x, targetSize.y);\r\n return canvasOut;\r\n}\r\n\r\n/** Create a canvas element with the same dimensions and contents as an image buffer.\r\n * @param buffer the source [[ImageBuffer]] object from which the [HTMLCanvasElement](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement) object will be constructed.\r\n * @param preserveAlpha If false, the alpha channel will be set to 255 (fully opaque). This is recommended when converting an already-blended image (e.g., one obtained from [[Viewport.readImage]]).\r\n * @returns an [HTMLCanvasElement](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement) object containing the contents of the source image buffer, or undefined if the conversion fails.\r\n * @public\r\n */\r\nexport function imageBufferToCanvas(buffer: ImageBuffer, preserveAlpha: boolean = true): HTMLCanvasElement | undefined {\r\n const canvas = document.createElement(\"canvas\");\r\n if (null === canvas)\r\n return undefined;\r\n\r\n canvas.width = buffer.width;\r\n canvas.height = buffer.height;\r\n\r\n const context = canvas.getContext(\"2d\");\r\n if (null === context)\r\n return undefined;\r\n\r\n const imageData = context.createImageData(buffer.width, buffer.height);\r\n const extractRgba = ImageBufferFormat.Alpha === buffer.format ? rgbaFromAlpha : (ImageBufferFormat.Rgb === buffer.format ? rgbaFromRgb : rgbaFromRgba);\r\n\r\n const bufferData = buffer.data;\r\n let i = 0;\r\n let j = 0;\r\n const rgba = scratchRgba;\r\n while (i < bufferData.length) {\r\n i = extractRgba(rgba, bufferData, i);\r\n imageData.data[j + 0] = rgba.r;\r\n imageData.data[j + 1] = rgba.g;\r\n imageData.data[j + 2] = rgba.b;\r\n imageData.data[j + 3] = preserveAlpha ? rgba.a : 0xff;\r\n j += 4;\r\n }\r\n\r\n context.putImageData(imageData, 0, 0);\r\n return canvas;\r\n}\r\n\r\n/** Create an ImageBuffer in the specified format with the same dimensions and contents as a canvas.\r\n * @param canvas the source [HTMLCanvasElement](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement) object from which the [[ImageBuffer]] object will be constructed.\r\n * @param format the desired format of the created ImageBuffer; defaults to [[ImageBufferFormat.Rgba]].\r\n * @returns an [[ImageBuffer]] object containing the contents of the source canvas, or undefined if the conversion fails.\r\n * @public\r\n */\r\nexport function canvasToImageBuffer(canvas: HTMLCanvasElement, format = ImageBufferFormat.Rgba): ImageBuffer | undefined {\r\n const context = canvas.getContext(\"2d\");\r\n if (null === context)\r\n return undefined;\r\n\r\n const imageData = context.getImageData(0, 0, canvas.width, canvas.height);\r\n\r\n let imageBufferData: Uint8Array | undefined;\r\n\r\n if (ImageBufferFormat.Rgba === format) {\r\n imageBufferData = new Uint8Array(imageData.data.length);\r\n } else if (ImageBufferFormat.Rgb === format) {\r\n imageBufferData = new Uint8Array((imageData.data.length / 4) * 3);\r\n } else if (ImageBufferFormat.Alpha === format) {\r\n imageBufferData = new Uint8Array(imageData.data.length / 4);\r\n }\r\n\r\n if (undefined === imageBufferData)\r\n return undefined;\r\n\r\n let i = 0;\r\n let j = 0;\r\n while (i < imageData.data.length) {\r\n if (ImageBufferFormat.Rgba === format) {\r\n imageBufferData[j + 0] = imageData.data[i + 0];\r\n imageBufferData[j + 1] = imageData.data[i + 1];\r\n imageBufferData[j + 2] = imageData.data[i + 2];\r\n imageBufferData[j + 3] = imageData.data[i + 3];\r\n j += 4;\r\n } else if (ImageBufferFormat.Rgb === format) {\r\n imageBufferData[j + 0] = imageData.data[i + 0];\r\n imageBufferData[j + 1] = imageData.data[i + 1];\r\n imageBufferData[j + 2] = imageData.data[i + 2];\r\n j += 3;\r\n } else if (ImageBufferFormat.Alpha === format) {\r\n imageBufferData[j] = imageData.data[i + 3];\r\n j++;\r\n }\r\n i += 4;\r\n }\r\n\r\n return ImageBuffer.create(imageBufferData, format, canvas.width);\r\n}\r\n\r\n/** Get a string describing the mime type associated with an ImageSource format.\r\n * @public\r\n */\r\nexport function getImageSourceMimeType(format: ImageSourceFormat): string {\r\n\r\n switch (format) {\r\n case ImageSourceFormat.Jpeg:\r\n return \"image/jpeg\";\r\n case ImageSourceFormat.Png:\r\n return \"image/png\";\r\n case ImageSourceFormat.Svg:\r\n return \"image/svg+xml;charset=utf-8\";\r\n }\r\n return \"\";\r\n}\r\n\r\n/** Get the ImageSourceFormat corresponding to the mime type string, or undefined if the string does not identify a supported ImageSourceFormat.\r\n * @public\r\n */\r\nexport function getImageSourceFormatForMimeType(mimeType: string): ImageSourceFormat | undefined {\r\n switch (mimeType) {\r\n case \"image/jpeg\": return ImageSourceFormat.Jpeg;\r\n case \"image/png\": return ImageSourceFormat.Png;\r\n case \"image/svg+xml;charset=utf-8\": return ImageSourceFormat.Svg;\r\n default: return undefined;\r\n }\r\n}\r\n\r\n/** Extract an html Image element from a binary jpeg or png.\r\n * @param source The ImageSource containing the binary jpeg or png data.\r\n * @returns a Promise which resolves to an HTMLImageElement containing the uncompressed bitmap image in RGBA format.\r\n * @public\r\n */\r\nexport async function imageElementFromImageSource(source: ImageSource): Promise<HTMLImageElement> {\r\n const blob = new Blob([source.data], { type: getImageSourceMimeType(source.format) });\r\n return imageElementFromUrl(URL.createObjectURL(blob));\r\n}\r\n\r\n/** Create an html Image element from a URL.\r\n * @param url The URL pointing to the image data.\r\n * @returns A Promise resolving to an HTMLImageElement when the image data has been loaded from the URL.\r\n * @see tryImageElementFromUrl.\r\n * @public\r\n */\r\nexport async function imageElementFromUrl(url: string): Promise<HTMLImageElement> {\r\n return new Promise((resolve: (image: HTMLImageElement) => void, reject) => {\r\n const image = new Image();\r\n image.onload = () => resolve(image);\r\n\r\n // The \"error\" produced by Image is not an Error. It looks like an Event, but isn't one.\r\n image.onerror = () => reject(new Error(\"Failed to create image from url\"));\r\n image.src = url;\r\n });\r\n}\r\n\r\n/** Try to create an html Image element from a URL.\r\n * @param url The URL pointing to the image data.\r\n * @returns A Promise resolving to an HTMLImageElement when the image data has been loaded from the URL, or to `undefined` if an exception occurred.\r\n * @see imageElementFromUrl\r\n * @public\r\n */\r\nexport async function tryImageElementFromUrl(url: string): Promise<HTMLImageElement | undefined> {\r\n try {\r\n return await imageElementFromUrl(url);\r\n } catch {\r\n return undefined;\r\n }\r\n}\r\n/**\r\n * Extract the dimensions of the jpeg or png data encoded in an ImageSource.\r\n * @param source The ImageSource containing the binary jpeg or png data.\r\n * @returns a Promise resolving to a Point2d of which x corresponds to the integer width of the uncompressed bitmap and y to the height.\r\n * @public\r\n */\r\nexport async function extractImageSourceDimensions(source: ImageSource): Promise<Point2d> {\r\n const image = await imageElementFromImageSource(source);\r\n return new Point2d(image.naturalWidth, image.naturalHeight);\r\n}\r\n\r\n/**\r\n * Produces a data url in \"image/png\" format from the contents of an ImageBuffer.\r\n * @param buffer The ImageBuffer, of any format.\r\n * @param preserveAlpha If false, the alpha channel will be set to 255 (fully opaque). This is recommended when converting an already-blended image (e.g., one obtained from [[Viewport.readImage]]).\r\n * @returns a data url as a string suitable for setting as the `src` property of an HTMLImageElement, or undefined if the url could not be created.\r\n * @public\r\n */\r\nexport function imageBufferToPngDataUrl(buffer: ImageBuffer, preserveAlpha = true): string | undefined {\r\n // The default format (and the only format required to be supported) for toDataUrl() is \"image/png\".\r\n const canvas = imageBufferToCanvas(buffer, preserveAlpha);\r\n return undefined !== canvas ? canvas.toDataURL() : undefined;\r\n}\r\n\r\n/**\r\n * Converts the contents of an ImageBuffer to PNG format.\r\n * @param buffer The ImageBuffer, of any format.\r\n * @param preserveAlpha If false, the alpha channel will be set to 255 (fully opaque). This is recommended when converting an already-blended image (e.g., one obtained from [[Viewport.readImage]]).\r\n * @returns a base64-encoded string representing the image as a PNG, or undefined if the conversion failed.\r\n * @public\r\n */\r\nexport function imageBufferToBase64EncodedPng(buffer: ImageBuffer, preserveAlpha = true): string | undefined {\r\n const urlPrefix = \"data:image/png;base64,\";\r\n const url = imageBufferToPngDataUrl(buffer, preserveAlpha);\r\n if (undefined === url || !url.startsWith(urlPrefix))\r\n return undefined;\r\n\r\n return url.substring(urlPrefix.length);\r\n}\r\n\r\n/** Open an image specified as a data URL in a new window or tab. Works around differences between browsers and Electron.\r\n * @param url The base64-encoded image URL.\r\n * @param title An optional title to apply to the new window.\r\n * @beta\r\n */\r\nexport function openImageDataUrlInNewWindow(url: string, title?: string): void {\r\n if (ProcessDetector.isElectronAppFrontend) {\r\n window.open(url, title);\r\n } else {\r\n const win = window.open();\r\n if (null === win)\r\n return;\r\n\r\n const div = win.document.createElement(\"div\");\r\n div.innerHTML = `<img src='${url}'/>`;\r\n win.document.body.append(div);\r\n if (undefined !== title)\r\n win.document.title = title;\r\n }\r\n}\r\n\r\n/** Determine the maximum [[ViewRect]] that can be fitted and centered in specified ViewRect given a required aspect ratio.\r\n * @param viewRect The rectangle in which the returned rectangle is to be centered and fitted.\r\n * @param aspectRatio Ratio of width to height.\r\n * @returns A ViewRect centered in the input rectangle.\r\n * @public\r\n */\r\nexport function getCenteredViewRect(viewRect: ViewRect, aspectRatio = 1.4): ViewRect {\r\n // Determine scale that ensures ability to return an image with the prescribed aspectRatio\r\n const scale = Math.min(viewRect.width / aspectRatio, viewRect.height);\r\n const finalWidth = scale * aspectRatio;\r\n const finalHeight = scale;\r\n const left = (viewRect.width - finalWidth) / 2.0;\r\n const right = left + finalWidth;\r\n const top = (viewRect.height - finalHeight) / 2.0;\r\n const bottom = top + finalHeight;\r\n return new ViewRect(left, top, right, bottom);\r\n}\r\n\r\n/** Produce a jpeg compressed to no more than specified bytes and of no less than specified quality.\r\n * @param canvas Canvas containing the image to be compressed.\r\n * @param maxBytes Maximum size of output jpeg in bytes.\r\n * @param minCompressionQuality The minimum acceptable image quality as a number between 0 (lowest quality) and 1 (highest quality).\r\n * @returns A [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) for the image, or `undefined` if the compression and size constraints could not be met.\r\n * @public\r\n */\r\nexport function getCompressedJpegFromCanvas(canvas: HTMLCanvasElement, maxBytes = 60000, minCompressionQuality = 0.1): string | undefined {\r\n const decrements = 0.1; // Decrements of quality\r\n const bytesPerCharacter = 2; // Assume 16-bit per character\r\n let quality = 1.0; // JPEG Compression quality\r\n\r\n while (quality > minCompressionQuality) {\r\n const data = canvas.toDataURL(\"image/jpeg\", quality);\r\n // If we are less than 60 Kb, we are good\r\n if (data.length * bytesPerCharacter < maxBytes)\r\n return data;\r\n\r\n quality -= decrements;\r\n }\r\n\r\n return undefined;\r\n}\r\n"]}
1
+ {"version":3,"file":"ImageUtil.js","sourceRoot":"","sources":["../../src/ImageUtil.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAsD;AACtD,wDAA+C;AAC/C,oDAAoG;AACpG,yCAAsC;AAStC,MAAM,WAAW,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AAE/C,SAAS,aAAa,CAAC,IAAU,EAAE,GAAe,EAAE,GAAW;IAC7D,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7C,OAAO,GAAG,GAAG,CAAC,CAAC;AACjB,CAAC;AAED,SAAS,WAAW,CAAC,IAAU,EAAE,GAAe,EAAE,GAAW;IAC3D,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IACtB,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IACtB,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IACtB,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC;IACb,OAAO,GAAG,GAAG,CAAC,CAAC;AACjB,CAAC;AAED,SAAS,YAAY,CAAC,IAAU,EAAE,GAAe,EAAE,GAAW;IAC5D,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IAC5B,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IACtB,OAAO,GAAG,GAAG,CAAC,CAAC;AACjB,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,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E,MAAM,CAAC,CAAC;AAChD,CAAC;AAVD,kDAUC;AAED;;;;;;GAMG;AACH,SAAgB,2BAA2B,CAAC,MAAyB,EAAE,QAAQ,GAAG,KAAK,EAAE,qBAAqB,GAAG,GAAG;IAClH,MAAM,UAAU,GAAG,GAAG,CAAC,CAAC,wBAAwB;IAChD,MAAM,iBAAiB,GAAG,CAAC,CAAC,CAAC,8BAA8B;IAC3D,IAAI,OAAO,GAAG,GAAG,CAAC,CAAC,2BAA2B;IAE9C,OAAO,OAAO,GAAG,qBAAqB,EAAE;QACtC,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACrD,yCAAyC;QACzC,IAAI,IAAI,CAAC,MAAM,GAAG,iBAAiB,GAAG,QAAQ;YAC5C,OAAO,IAAI,CAAC;QAEd,OAAO,IAAI,UAAU,CAAC;KACvB;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAfD,kEAeC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Rendering\r\n */\r\n\r\nimport { ProcessDetector } from \"@itwin/core-bentley\";\r\nimport { Point2d } from \"@itwin/core-geometry\";\r\nimport { ImageBuffer, ImageBufferFormat, ImageSource, ImageSourceFormat } from \"@itwin/core-common\";\r\nimport { ViewRect } from \"./ViewRect\";\r\n\r\ninterface Rgba {\r\n r: number;\r\n g: number;\r\n b: number;\r\n a: number;\r\n}\r\n\r\nconst scratchRgba = { r: 0, g: 0, b: 0, a: 0 };\r\n\r\nfunction rgbaFromAlpha(rgba: Rgba, src: Uint8Array, idx: number): number {\r\n rgba.r = rgba.g = rgba.b = rgba.a = src[idx];\r\n return idx + 1;\r\n}\r\n\r\nfunction rgbaFromRgb(rgba: Rgba, src: Uint8Array, idx: number): number {\r\n rgba.r = src[idx + 0];\r\n rgba.g = src[idx + 1];\r\n rgba.b = src[idx + 2];\r\n rgba.a = 255;\r\n return idx + 3;\r\n}\r\n\r\nfunction rgbaFromRgba(rgba: Rgba, src: Uint8Array, idx: number): number {\r\n rgbaFromRgb(rgba, src, idx);\r\n rgba.a = src[idx + 3];\r\n return idx + 4;\r\n}\r\n\r\n/** Resize a canvas to a desired size. The final size will be targetSize plus barSize. The original canvas is left untouched and a new, resized canvas with potential side bars is returned.\r\n * @param canvasIn the source [HTMLCanvasElement](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement) to resize.\r\n * @param targetSize the desired new size for the canvas image.\r\n * @param barSize total size of side bars to add to the image in width and height; defaults to (0, 0). For example, if you specify (2, 0), a 1 pixel side bar will be added to the left and right sides of the resized image. If an odd dimension is specified, the left or upper side of the image will be one pixel larger than the opposite side. For example, if you specify (1, 0), a 1 pixel side bar will be added to the left side of the image and a 0 pixel side bar will be added to the right side of the image.\r\n * @param barStyle CSS style string to apply to any side bars; defaults to \"#C0C0C0\", which is silver.\r\n * @returns an [HTMLCanvasElement](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement) object containing the resized image and any requested side bars.\r\n * @public\r\n */\r\nexport function canvasToResizedCanvasWithBars(canvasIn: HTMLCanvasElement, targetSize: Point2d, barSize = new Point2d(0, 0), barStyle = \"#C0C0C0\"): HTMLCanvasElement {\r\n const canvasOut = document.createElement(\"canvas\");\r\n canvasOut.width = targetSize.x + barSize.x;\r\n canvasOut.height = targetSize.y + barSize.y;\r\n\r\n let adjustImageX = barSize.x / 2;\r\n let adjustImageY = barSize.y / 2;\r\n\r\n if (1 === barSize.x % 2) {\r\n adjustImageX += 0.5;\r\n }\r\n if (1 === barSize.y % 2) {\r\n adjustImageY += 0.5;\r\n }\r\n\r\n const context = canvasOut.getContext(\"2d\")!;\r\n context.fillStyle = barStyle;\r\n context.fillRect(0, 0, canvasOut.width, canvasOut.height);\r\n context.drawImage(canvasIn, adjustImageX, adjustImageY, targetSize.x, targetSize.y);\r\n return canvasOut;\r\n}\r\n\r\n/** Create a canvas element with the same dimensions and contents as an image buffer.\r\n * @param buffer the source [[ImageBuffer]] object from which the [HTMLCanvasElement](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement) object will be constructed.\r\n * @param preserveAlpha If false, the alpha channel will be set to 255 (fully opaque). This is recommended when converting an already-blended image (e.g., one obtained from [[Viewport.readImage]]).\r\n * @returns an [HTMLCanvasElement](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement) object containing the contents of the source image buffer, or undefined if the conversion fails.\r\n * @public\r\n */\r\nexport function imageBufferToCanvas(buffer: ImageBuffer, preserveAlpha: boolean = true): HTMLCanvasElement | undefined {\r\n const canvas = document.createElement(\"canvas\");\r\n if (null === canvas)\r\n return undefined;\r\n\r\n canvas.width = buffer.width;\r\n canvas.height = buffer.height;\r\n\r\n const context = canvas.getContext(\"2d\");\r\n if (null === context)\r\n return undefined;\r\n\r\n const imageData = context.createImageData(buffer.width, buffer.height);\r\n const extractRgba = ImageBufferFormat.Alpha === buffer.format ? rgbaFromAlpha : (ImageBufferFormat.Rgb === buffer.format ? rgbaFromRgb : rgbaFromRgba);\r\n\r\n const bufferData = buffer.data;\r\n let i = 0;\r\n let j = 0;\r\n const rgba = scratchRgba;\r\n while (i < bufferData.length) {\r\n i = extractRgba(rgba, bufferData, i);\r\n imageData.data[j + 0] = rgba.r;\r\n imageData.data[j + 1] = rgba.g;\r\n imageData.data[j + 2] = rgba.b;\r\n imageData.data[j + 3] = preserveAlpha ? rgba.a : 0xff;\r\n j += 4;\r\n }\r\n\r\n context.putImageData(imageData, 0, 0);\r\n return canvas;\r\n}\r\n\r\n/** Create an ImageBuffer in the specified format with the same dimensions and contents as a canvas.\r\n * @param canvas the source [HTMLCanvasElement](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement) object from which the [[ImageBuffer]] object will be constructed.\r\n * @param format the desired format of the created ImageBuffer; defaults to [[ImageBufferFormat.Rgba]].\r\n * @returns an [[ImageBuffer]] object containing the contents of the source canvas, or undefined if the conversion fails.\r\n * @public\r\n */\r\nexport function canvasToImageBuffer(canvas: HTMLCanvasElement, format = ImageBufferFormat.Rgba): ImageBuffer | undefined {\r\n const context = canvas.getContext(\"2d\");\r\n if (null === context)\r\n return undefined;\r\n\r\n const imageData = context.getImageData(0, 0, canvas.width, canvas.height);\r\n\r\n let imageBufferData: Uint8Array | undefined;\r\n\r\n if (ImageBufferFormat.Rgba === format) {\r\n imageBufferData = new Uint8Array(imageData.data.length);\r\n } else if (ImageBufferFormat.Rgb === format) {\r\n imageBufferData = new Uint8Array((imageData.data.length / 4) * 3);\r\n } else if (ImageBufferFormat.Alpha === format) {\r\n imageBufferData = new Uint8Array(imageData.data.length / 4);\r\n }\r\n\r\n if (undefined === imageBufferData)\r\n return undefined;\r\n\r\n let i = 0;\r\n let j = 0;\r\n while (i < imageData.data.length) {\r\n if (ImageBufferFormat.Rgba === format) {\r\n imageBufferData[j + 0] = imageData.data[i + 0];\r\n imageBufferData[j + 1] = imageData.data[i + 1];\r\n imageBufferData[j + 2] = imageData.data[i + 2];\r\n imageBufferData[j + 3] = imageData.data[i + 3];\r\n j += 4;\r\n } else if (ImageBufferFormat.Rgb === format) {\r\n imageBufferData[j + 0] = imageData.data[i + 0];\r\n imageBufferData[j + 1] = imageData.data[i + 1];\r\n imageBufferData[j + 2] = imageData.data[i + 2];\r\n j += 3;\r\n } else if (ImageBufferFormat.Alpha === format) {\r\n imageBufferData[j] = imageData.data[i + 3];\r\n j++;\r\n }\r\n i += 4;\r\n }\r\n\r\n return ImageBuffer.create(imageBufferData, format, canvas.width);\r\n}\r\n\r\n/** Get a string describing the mime type associated with an ImageSource format.\r\n * @public\r\n */\r\nexport function getImageSourceMimeType(format: ImageSourceFormat): string {\r\n\r\n switch (format) {\r\n case ImageSourceFormat.Jpeg:\r\n return \"image/jpeg\";\r\n case ImageSourceFormat.Png:\r\n return \"image/png\";\r\n case ImageSourceFormat.Svg:\r\n return \"image/svg+xml;charset=utf-8\";\r\n }\r\n return \"\";\r\n}\r\n\r\n/** Get the ImageSourceFormat corresponding to the mime type string, or undefined if the string does not identify a supported ImageSourceFormat.\r\n * @public\r\n */\r\nexport function getImageSourceFormatForMimeType(mimeType: string): ImageSourceFormat | undefined {\r\n switch (mimeType) {\r\n case \"image/jpeg\": return ImageSourceFormat.Jpeg;\r\n case \"image/png\": return ImageSourceFormat.Png;\r\n case \"image/svg+xml;charset=utf-8\": return ImageSourceFormat.Svg;\r\n default: return undefined;\r\n }\r\n}\r\n\r\n/** Extract an html Image element from a binary jpeg or png.\r\n * @param source The ImageSource containing the binary jpeg or png data.\r\n * @returns a Promise which resolves to an HTMLImageElement containing the uncompressed bitmap image in RGBA format.\r\n * @public\r\n */\r\nexport async function imageElementFromImageSource(source: ImageSource): Promise<HTMLImageElement> {\r\n const blob = new Blob([source.data], { type: getImageSourceMimeType(source.format) });\r\n return imageElementFromUrl(URL.createObjectURL(blob));\r\n}\r\n\r\n/** Create an html Image element from a URL.\r\n * @param url The URL pointing to the image data.\r\n * @returns A Promise resolving to an HTMLImageElement when the image data has been loaded from the URL.\r\n * @see tryImageElementFromUrl.\r\n * @public\r\n */\r\nexport async function imageElementFromUrl(url: string): Promise<HTMLImageElement> {\r\n // We must set crossorigin property so that images loaded from same origin can be used with texImage2d.\r\n // We must do that outside of the promise constructor or it won't work, for reasons.\r\n const image = new Image();\r\n image.crossOrigin = \"anonymous\";\r\n return new Promise((resolve: (image: HTMLImageElement) => void, reject) => {\r\n image.onload = () => resolve(image);\r\n\r\n // The \"error\" produced by Image is not an Error. It looks like an Event, but isn't one.\r\n image.onerror = () => reject(new Error(\"Failed to create image from url\"));\r\n image.src = url;\r\n });\r\n}\r\n\r\n/** Try to create an html Image element from a URL.\r\n * @param url The URL pointing to the image data.\r\n * @returns A Promise resolving to an HTMLImageElement when the image data has been loaded from the URL, or to `undefined` if an exception occurred.\r\n * @see imageElementFromUrl\r\n * @public\r\n */\r\nexport async function tryImageElementFromUrl(url: string): Promise<HTMLImageElement | undefined> {\r\n try {\r\n return await imageElementFromUrl(url);\r\n } catch {\r\n return undefined;\r\n }\r\n}\r\n/**\r\n * Extract the dimensions of the jpeg or png data encoded in an ImageSource.\r\n * @param source The ImageSource containing the binary jpeg or png data.\r\n * @returns a Promise resolving to a Point2d of which x corresponds to the integer width of the uncompressed bitmap and y to the height.\r\n * @public\r\n */\r\nexport async function extractImageSourceDimensions(source: ImageSource): Promise<Point2d> {\r\n const image = await imageElementFromImageSource(source);\r\n return new Point2d(image.naturalWidth, image.naturalHeight);\r\n}\r\n\r\n/**\r\n * Produces a data url in \"image/png\" format from the contents of an ImageBuffer.\r\n * @param buffer The ImageBuffer, of any format.\r\n * @param preserveAlpha If false, the alpha channel will be set to 255 (fully opaque). This is recommended when converting an already-blended image (e.g., one obtained from [[Viewport.readImage]]).\r\n * @returns a data url as a string suitable for setting as the `src` property of an HTMLImageElement, or undefined if the url could not be created.\r\n * @public\r\n */\r\nexport function imageBufferToPngDataUrl(buffer: ImageBuffer, preserveAlpha = true): string | undefined {\r\n // The default format (and the only format required to be supported) for toDataUrl() is \"image/png\".\r\n const canvas = imageBufferToCanvas(buffer, preserveAlpha);\r\n return undefined !== canvas ? canvas.toDataURL() : undefined;\r\n}\r\n\r\n/**\r\n * Converts the contents of an ImageBuffer to PNG format.\r\n * @param buffer The ImageBuffer, of any format.\r\n * @param preserveAlpha If false, the alpha channel will be set to 255 (fully opaque). This is recommended when converting an already-blended image (e.g., one obtained from [[Viewport.readImage]]).\r\n * @returns a base64-encoded string representing the image as a PNG, or undefined if the conversion failed.\r\n * @public\r\n */\r\nexport function imageBufferToBase64EncodedPng(buffer: ImageBuffer, preserveAlpha = true): string | undefined {\r\n const urlPrefix = \"data:image/png;base64,\";\r\n const url = imageBufferToPngDataUrl(buffer, preserveAlpha);\r\n if (undefined === url || !url.startsWith(urlPrefix))\r\n return undefined;\r\n\r\n return url.substring(urlPrefix.length);\r\n}\r\n\r\n/** Open an image specified as a data URL in a new window or tab. Works around differences between browsers and Electron.\r\n * @param url The base64-encoded image URL.\r\n * @param title An optional title to apply to the new window.\r\n * @beta\r\n */\r\nexport function openImageDataUrlInNewWindow(url: string, title?: string): void {\r\n if (ProcessDetector.isElectronAppFrontend) {\r\n window.open(url, title);\r\n } else {\r\n const win = window.open();\r\n if (null === win)\r\n return;\r\n\r\n const div = win.document.createElement(\"div\");\r\n div.innerHTML = `<img src='${url}'/>`;\r\n win.document.body.append(div);\r\n if (undefined !== title)\r\n win.document.title = title;\r\n }\r\n}\r\n\r\n/** Determine the maximum [[ViewRect]] that can be fitted and centered in specified ViewRect given a required aspect ratio.\r\n * @param viewRect The rectangle in which the returned rectangle is to be centered and fitted.\r\n * @param aspectRatio Ratio of width to height.\r\n * @returns A ViewRect centered in the input rectangle.\r\n * @public\r\n */\r\nexport function getCenteredViewRect(viewRect: ViewRect, aspectRatio = 1.4): ViewRect {\r\n // Determine scale that ensures ability to return an image with the prescribed aspectRatio\r\n const scale = Math.min(viewRect.width / aspectRatio, viewRect.height);\r\n const finalWidth = scale * aspectRatio;\r\n const finalHeight = scale;\r\n const left = (viewRect.width - finalWidth) / 2.0;\r\n const right = left + finalWidth;\r\n const top = (viewRect.height - finalHeight) / 2.0;\r\n const bottom = top + finalHeight;\r\n return new ViewRect(left, top, right, bottom);\r\n}\r\n\r\n/** Produce a jpeg compressed to no more than specified bytes and of no less than specified quality.\r\n * @param canvas Canvas containing the image to be compressed.\r\n * @param maxBytes Maximum size of output jpeg in bytes.\r\n * @param minCompressionQuality The minimum acceptable image quality as a number between 0 (lowest quality) and 1 (highest quality).\r\n * @returns A [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) for the image, or `undefined` if the compression and size constraints could not be met.\r\n * @public\r\n */\r\nexport function getCompressedJpegFromCanvas(canvas: HTMLCanvasElement, maxBytes = 60000, minCompressionQuality = 0.1): string | undefined {\r\n const decrements = 0.1; // Decrements of quality\r\n const bytesPerCharacter = 2; // Assume 16-bit per character\r\n let quality = 1.0; // JPEG Compression quality\r\n\r\n while (quality > minCompressionQuality) {\r\n const data = canvas.toDataURL(\"image/jpeg\", quality);\r\n // If we are less than 60 Kb, we are good\r\n if (data.length * bytesPerCharacter < maxBytes)\r\n return data;\r\n\r\n quality -= decrements;\r\n }\r\n\r\n return undefined;\r\n}\r\n"]}
@@ -7,7 +7,7 @@ import { HitDetail } from "./HitDetail";
7
7
  import { IModelConnection } from "./IModelConnection";
8
8
  import { BeButtonEvent, EventHandled } from "./tools/Tool";
9
9
  import { ScreenViewport, ViewportDecorator } from "./Viewport";
10
- /** Interface for drawing [[Decorations]] into, or on top of, the active [[ScreenViewport]]s managed by [[ViewManager]].
10
+ /** Interface for drawing [decoration graphics]($docs/learning/frontend/ViewDecorations.md) into, or on top of, the active [[ScreenViewport]]s managed by [[ViewManager]].
11
11
  * Decorators generate [[Decorations]].
12
12
  * @public
13
13
  */
@@ -259,11 +259,11 @@ export declare class ViewManager implements Iterable<ScreenViewport> {
259
259
  * @internal
260
260
  */
261
261
  refreshForModifiedModels(modelIds: Id64Arg | undefined): void;
262
- /** The number of [antialiasing](https://en.wikipedia.org/wiki/Multisample_anti-aliasing) samples to be used when rendering the contents of all viewports
263
- * registered with the ViewManager.
264
- * Must be an integer greater than zero. A value of 1 means antialiasing is disabled. A higher number of samples correlates generally to a higher quality image but
265
- * is also more demanding on the graphics hardware.
266
- * This setting will also be applied to subsequently-registered viewports.
262
+ /** Sets the number of [MSAA]($docs/learning/display/MSAA.md) samples for all currently- and subsequently-opened [[ScreenViewport]]s.
263
+ * @param numSamples The number of samples as a power of two. Values of 1 or less indicates anti-aliasing should be disabled. Non-power-of-two values are rounded
264
+ * down to the nearest power of two. The maximum number of samples supported depends upon the client's graphics hardware capabilities. Higher values produce
265
+ * a higher-quality image but also may also reduce framerate.
266
+ * @see [[Viewport.antialiasSamples]] to adjust the number of samples for a specific viewport.
267
267
  */
268
268
  setAntialiasingAllViews(numSamples: number): void;
269
269
  }
@@ -442,11 +442,11 @@ class ViewManager {
442
442
  for (const vp of this._viewports)
443
443
  vp.refreshForModifiedModels(modelIds);
444
444
  }
445
- /** The number of [antialiasing](https://en.wikipedia.org/wiki/Multisample_anti-aliasing) samples to be used when rendering the contents of all viewports
446
- * registered with the ViewManager.
447
- * Must be an integer greater than zero. A value of 1 means antialiasing is disabled. A higher number of samples correlates generally to a higher quality image but
448
- * is also more demanding on the graphics hardware.
449
- * This setting will also be applied to subsequently-registered viewports.
445
+ /** Sets the number of [MSAA]($docs/learning/display/MSAA.md) samples for all currently- and subsequently-opened [[ScreenViewport]]s.
446
+ * @param numSamples The number of samples as a power of two. Values of 1 or less indicates anti-aliasing should be disabled. Non-power-of-two values are rounded
447
+ * down to the nearest power of two. The maximum number of samples supported depends upon the client's graphics hardware capabilities. Higher values produce
448
+ * a higher-quality image but also may also reduce framerate.
449
+ * @see [[Viewport.antialiasSamples]] to adjust the number of samples for a specific viewport.
450
450
  */
451
451
  setAntialiasingAllViews(numSamples) {
452
452
  for (const vp of this)