@itwin/core-frontend 3.1.0-dev.27 → 3.1.0-dev.28

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 (80) hide show
  1. package/CHANGELOG.md +156 -35
  2. package/lib/cjs/DrawingViewState.d.ts.map +1 -1
  3. package/lib/cjs/DrawingViewState.js +6 -5
  4. package/lib/cjs/DrawingViewState.js.map +1 -1
  5. package/lib/cjs/IModelApp.d.ts +1 -3
  6. package/lib/cjs/IModelApp.d.ts.map +1 -1
  7. package/lib/cjs/IModelApp.js +8 -6
  8. package/lib/cjs/IModelApp.js.map +1 -1
  9. package/lib/cjs/SheetViewState.js +4 -0
  10. package/lib/cjs/SheetViewState.js.map +1 -1
  11. package/lib/cjs/ViewState.d.ts +8 -0
  12. package/lib/cjs/ViewState.d.ts.map +1 -1
  13. package/lib/cjs/ViewState.js.map +1 -1
  14. package/lib/cjs/Viewport.d.ts +19 -3
  15. package/lib/cjs/Viewport.d.ts.map +1 -1
  16. package/lib/cjs/Viewport.js +20 -0
  17. package/lib/cjs/Viewport.js.map +1 -1
  18. package/lib/cjs/core-frontend.d.ts +1 -0
  19. package/lib/cjs/core-frontend.d.ts.map +1 -1
  20. package/lib/cjs/core-frontend.js +1 -0
  21. package/lib/cjs/core-frontend.js.map +1 -1
  22. package/lib/cjs/quantity-formatting/BasicUnitsProvider.d.ts +2 -2
  23. package/lib/cjs/quantity-formatting/BasicUnitsProvider.d.ts.map +1 -1
  24. package/lib/cjs/quantity-formatting/BasicUnitsProvider.js +48 -44
  25. package/lib/cjs/quantity-formatting/BasicUnitsProvider.js.map +1 -1
  26. package/lib/cjs/quantity-formatting/QuantityFormatter.d.ts +90 -80
  27. package/lib/cjs/quantity-formatting/QuantityFormatter.d.ts.map +1 -1
  28. package/lib/cjs/quantity-formatting/QuantityFormatter.js +76 -45
  29. package/lib/cjs/quantity-formatting/QuantityFormatter.js.map +1 -1
  30. package/lib/cjs/quantity-formatting/QuantityTypesEditorSpecs.d.ts +54 -0
  31. package/lib/cjs/quantity-formatting/QuantityTypesEditorSpecs.d.ts.map +1 -0
  32. package/lib/cjs/quantity-formatting/QuantityTypesEditorSpecs.js +32 -0
  33. package/lib/cjs/quantity-formatting/QuantityTypesEditorSpecs.js.map +1 -0
  34. package/lib/cjs/quantity-formatting/UnitsData.d.ts +11 -0
  35. package/lib/cjs/quantity-formatting/UnitsData.d.ts.map +1 -0
  36. package/lib/cjs/quantity-formatting/UnitsData.js +59 -0
  37. package/lib/cjs/quantity-formatting/UnitsData.js.map +1 -0
  38. package/lib/cjs/tile/PntsReader.d.ts.map +1 -1
  39. package/lib/cjs/tile/PntsReader.js +79 -17
  40. package/lib/cjs/tile/PntsReader.js.map +1 -1
  41. package/lib/esm/DrawingViewState.d.ts.map +1 -1
  42. package/lib/esm/DrawingViewState.js +6 -5
  43. package/lib/esm/DrawingViewState.js.map +1 -1
  44. package/lib/esm/IModelApp.d.ts +1 -3
  45. package/lib/esm/IModelApp.d.ts.map +1 -1
  46. package/lib/esm/IModelApp.js +8 -6
  47. package/lib/esm/IModelApp.js.map +1 -1
  48. package/lib/esm/SheetViewState.js +4 -0
  49. package/lib/esm/SheetViewState.js.map +1 -1
  50. package/lib/esm/ViewState.d.ts +8 -0
  51. package/lib/esm/ViewState.d.ts.map +1 -1
  52. package/lib/esm/ViewState.js.map +1 -1
  53. package/lib/esm/Viewport.d.ts +19 -3
  54. package/lib/esm/Viewport.d.ts.map +1 -1
  55. package/lib/esm/Viewport.js +20 -0
  56. package/lib/esm/Viewport.js.map +1 -1
  57. package/lib/esm/core-frontend.d.ts +1 -0
  58. package/lib/esm/core-frontend.d.ts.map +1 -1
  59. package/lib/esm/core-frontend.js +1 -0
  60. package/lib/esm/core-frontend.js.map +1 -1
  61. package/lib/esm/quantity-formatting/BasicUnitsProvider.d.ts +2 -2
  62. package/lib/esm/quantity-formatting/BasicUnitsProvider.d.ts.map +1 -1
  63. package/lib/esm/quantity-formatting/BasicUnitsProvider.js +48 -44
  64. package/lib/esm/quantity-formatting/BasicUnitsProvider.js.map +1 -1
  65. package/lib/esm/quantity-formatting/QuantityFormatter.d.ts +90 -80
  66. package/lib/esm/quantity-formatting/QuantityFormatter.d.ts.map +1 -1
  67. package/lib/esm/quantity-formatting/QuantityFormatter.js +75 -41
  68. package/lib/esm/quantity-formatting/QuantityFormatter.js.map +1 -1
  69. package/lib/esm/quantity-formatting/QuantityTypesEditorSpecs.d.ts +54 -0
  70. package/lib/esm/quantity-formatting/QuantityTypesEditorSpecs.d.ts.map +1 -0
  71. package/lib/esm/quantity-formatting/QuantityTypesEditorSpecs.js +26 -0
  72. package/lib/esm/quantity-formatting/QuantityTypesEditorSpecs.js.map +1 -0
  73. package/lib/esm/quantity-formatting/UnitsData.d.ts +11 -0
  74. package/lib/esm/quantity-formatting/UnitsData.d.ts.map +1 -0
  75. package/lib/esm/quantity-formatting/UnitsData.js +56 -0
  76. package/lib/esm/quantity-formatting/UnitsData.js.map +1 -0
  77. package/lib/esm/tile/PntsReader.d.ts.map +1 -1
  78. package/lib/esm/tile/PntsReader.js +79 -17
  79. package/lib/esm/tile/PntsReader.js.map +1 -1
  80. package/package.json +20 -20
@@ -1 +1 @@
1
- {"version":3,"file":"IModelApp.js","sourceRoot":"","sources":["../../src/IModelApp.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,MAAM,eAAe,GAAG,6HAA6H,CAAC;AAEtJ,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAe,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAc,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACnI,OAAO,EACgB,YAAY,EAAmC,gBAAgB,GACrF,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,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AC","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-2022 <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 [[FrontendHubAccess]] 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
+ {"version":3,"file":"IModelApp.js","sourceRoot":"","sources":["../../src/IModelApp.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,MAAM,eAAe,GAAG,6HAA6H,CAAC;AAEtJ,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAe,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAc,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACnI,OAAO,EACgB,YAAY,EAAmC,gBAAgB,GACrF,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAgC,MAAM,4BAA4B,CAAC;AACpG,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY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------------------------------------------------------------------\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-2022 <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 [[FrontendHubAccess]] 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 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 if (process.env.NODE_ENV === \"development\") {\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\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 if (process.env.NODE_ENV === \"development\") {\r\n (window as IModelAppForDebugger).iModelAppForDebugger = undefined;\r\n }\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"]}
@@ -448,6 +448,10 @@ class OrthographicAttachment {
448
448
  origin.addInPlace(viewOrgToAttachment);
449
449
  this._toSheet = Transform.createRefs(origin, matrix);
450
450
  this._fromSheet = this._toSheet.inverse();
451
+ // If the attached view is a section drawing, it may itself have an attached spatial view with a clip.
452
+ // The clip needs to be transformed into sheet space.
453
+ if (view.isDrawingView())
454
+ this._viewport.drawingToSheetTransform = this._toSheet;
451
455
  // ###TODO? If we also apply the attachment's clip to the attached view, we may get additional culling during tile selection.
452
456
  // However the attached view's frustum is already clipped by intersection with sheet view's frustum, and additional clipping planes
453
457
  // introduce additional computation, so possibly not worth it.
@@ -1 +1 @@
1
- {"version":3,"file":"SheetViewState.js","sourceRoot":"","sources":["../../src/SheetViewState.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAyB,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAE,KAAK,EAAE,SAAS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,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAE7B,uCAAuC;QACvC,IAAI,UAAU,CAAC;QACf,IAAI,MAAA,IAAI,CAAC,MAAM,CAAC,cAAc,0CAAE,IAAI,EAAE;YACpC,MAAM,UAAU,GAAG,UAAU,CAAC,QAAQ,CAAC,MAAA,IAAI,CAAC,MAAM,CAAC,cAAc,0CAAE,IAAI,CAAC,CAAC;YACzE,IAAI,UAAU,CAAC,OAAO;gBACpB,UAAU,GAAG,SAAS,CAAC,YAAY,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;SACpE;QAED,OAAO,SAAS,CAAC,YAAY,CAAC,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;IAC7F,CAAC;IAEM,iBAAiB,CAAC,KAA8B;QACrD,IAAI,IAAI,CAAC,SAAS;YAChB,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Views\r\n */\r\n\r\nimport { assert, dispose, Id64Array, Id64String } from \"@itwin/core-bentley\";\r\nimport { Angle, ClipShape, ClipVector, Constant, Matrix3d, Point2d, Point3d, PolyfaceBuilder, Range2d, Range3d, StrokeOptions, Transform } from \"@itwin/core-geometry\";\r\nimport {\r\n AxisAlignedBox3d, ColorDef, Feature, FeatureTable, Frustum, Gradient, GraphicParams, HiddenLine, PackedFeatureTable, Placement2d, SheetProps,\r\n TextureTransparency, ViewAttachmentProps, ViewDefinition2dProps, ViewFlagOverrides, ViewStateProps,\r\n} from \"@itwin/core-common\";\r\nimport { CategorySelectorState } from \"./CategorySelectorState\";\r\nimport { DisplayStyle2dState } from \"./DisplayStyleState\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\nimport { GraphicBuilder, GraphicType } from \"./render/GraphicBuilder\";\r\nimport { RenderGraphic } from \"./render/RenderGraphic\";\r\nimport { GraphicBranch } from \"./render/GraphicBranch\";\r\nimport { Frustum2d } from \"./Frustum2d\";\r\nimport { Scene } from \"./render/Scene\";\r\nimport { Decorations } from \"./render/Decorations\";\r\nimport { MockRender } from \"./render/MockRender\";\r\nimport { RenderClipVolume } from \"./render/RenderClipVolume\";\r\nimport { RenderMemory } from \"./render/RenderMemory\";\r\nimport { FeatureSymbology } from \"./render/FeatureSymbology\";\r\nimport { DecorateContext, SceneContext } from \"./ViewContext\";\r\nimport { ViewRect } from \"./ViewRect\";\r\nimport { IModelApp } from \"./IModelApp\";\r\nimport { CoordSystem } from \"./CoordSystem\";\r\nimport { OffScreenViewport, Viewport } from \"./Viewport\";\r\nimport { AttachToViewportArgs, ViewState, ViewState2d } from \"./ViewState\";\r\nimport { DrawingViewState } from \"./DrawingViewState\";\r\nimport { createDefaultViewFlagOverrides, DisclosedTileTreeSet, TileGraphicType } from \"./tile/internal\";\r\nimport { imageBufferToPngDataUrl, openImageDataUrlInNewWindow } from \"./ImageUtil\";\r\n\r\n// cSpell:ignore ovrs\r\n\r\n/** Describes the geometry and styling of a sheet border decoration.\r\n * The sheet border decoration mimics a sheet of paper with a drop shadow.\r\n */\r\nclass SheetBorder {\r\n private _rect: Point2d[];\r\n private _shadow: Point2d[];\r\n private _gradient: Gradient.Symb;\r\n\r\n private constructor(rect: Point2d[], shadow: Point2d[], gradient: Gradient.Symb) {\r\n this._rect = rect;\r\n this._shadow = shadow;\r\n this._gradient = gradient;\r\n }\r\n\r\n /** Create a new sheet border. If a context is supplied, points are transformed to view coordinates. */\r\n public static create(width: number, height: number, context?: DecorateContext) {\r\n // Rect\r\n const rect: Point3d[] = [\r\n Point3d.create(0, height),\r\n Point3d.create(0, 0),\r\n Point3d.create(width, 0),\r\n Point3d.create(width, height),\r\n Point3d.create(0, height)];\r\n if (context) {\r\n context.viewport.worldToViewArray(rect);\r\n }\r\n\r\n // Shadow\r\n const shadowWidth = .01 * Math.sqrt(width * width + height * height);\r\n const shadow: Point3d[] = [\r\n Point3d.create(shadowWidth, 0),\r\n Point3d.create(shadowWidth, -shadowWidth),\r\n Point3d.create(width + shadowWidth, -shadowWidth),\r\n Point3d.create(width + shadowWidth, height - shadowWidth),\r\n Point3d.create(width, height - shadowWidth),\r\n Point3d.create(width, 0),\r\n Point3d.create(shadowWidth, 0),\r\n ];\r\n if (context) {\r\n context.viewport.worldToViewArray(shadow);\r\n }\r\n\r\n // Gradient\r\n const gradient = new Gradient.Symb();\r\n gradient.mode = Gradient.Mode.Linear;\r\n gradient.angle = Angle.createDegrees(-45);\r\n gradient.keys = [{ value: 0, color: ColorDef.from(25, 25, 25) }, { value: 0.5, color: ColorDef.from(150, 150, 150) }];\r\n\r\n // Copy over points\r\n const rect2d: Point2d[] = [];\r\n for (const point of rect)\r\n rect2d.push(Point2d.createFrom(point));\r\n const shadow2d: Point2d[] = [];\r\n for (const point of shadow)\r\n shadow2d.push(Point2d.createFrom(point));\r\n\r\n return new SheetBorder(rect2d, shadow2d, gradient);\r\n }\r\n\r\n public getRange(): Range2d {\r\n const range = Range2d.createArray(this._rect);\r\n const shadowRange = Range2d.createArray(this._shadow);\r\n range.extendRange(shadowRange);\r\n return range;\r\n }\r\n\r\n /** Add this border to the given GraphicBuilder. */\r\n public addToBuilder(builder: GraphicBuilder) {\r\n const lineColor = ColorDef.black;\r\n const fillColor = ColorDef.black;\r\n\r\n const params = new GraphicParams();\r\n params.fillColor = fillColor;\r\n params.gradient = this._gradient;\r\n\r\n builder.activateGraphicParams(params);\r\n builder.addShape2d(this._shadow, Frustum2d.minimumZDistance);\r\n\r\n builder.setSymbology(lineColor, fillColor, 2);\r\n builder.addLineString2d(this._rect, 0);\r\n }\r\n}\r\n\r\n/** The information required to instantiate an Attachment object. See ViewAttachmentsInfo */\r\ninterface ViewAttachmentInfo extends ViewAttachmentProps {\r\n attachedView: ViewState;\r\n}\r\n\r\n/** The information required to instantiate an ViewAttachments object to draw ViewAttachments into a sheet. The list of view attachment Ids is\r\n * supplied to SheetViewState via the constructor. The corresponding ViewAttachmentProps for each attachment are obtained asynchronously in\r\n * SheetViewState.load(). The Attachments object is created in SheetViewState.attachToViewport and disposed of in SheetViewState.detachFromViewport.\r\n */\r\nclass ViewAttachmentsInfo {\r\n private _attachments: Id64Array | ViewAttachmentInfo[];\r\n\r\n private constructor(attachments: Id64Array | ViewAttachmentInfo[]) {\r\n this._attachments = attachments;\r\n }\r\n\r\n public get isLoaded(): boolean {\r\n return 0 === this._attachments.length || \"string\" !== typeof this._attachments[0];\r\n }\r\n\r\n public get viewAttachmentProps(): Array<Readonly<ViewAttachmentProps>> {\r\n return this.isLoaded ? this._props : [];\r\n }\r\n\r\n private get _props(): ViewAttachmentInfo[] {\r\n assert(this.isLoaded);\r\n return this._attachments as ViewAttachmentInfo[];\r\n }\r\n\r\n private get _ids(): Id64Array {\r\n assert(!this.isLoaded);\r\n return this._attachments as Id64Array;\r\n }\r\n\r\n public static fromJSON(ids: Id64Array = []): ViewAttachmentsInfo {\r\n return new ViewAttachmentsInfo(ids);\r\n }\r\n\r\n public toJSON(): Id64Array {\r\n return this.isLoaded ? this._props.map((x) => x.id!) : [...this._ids];\r\n }\r\n\r\n public clone(): ViewAttachmentsInfo {\r\n // No reason to clone the array.\r\n return new ViewAttachmentsInfo(this._attachments);\r\n }\r\n\r\n public async load(iModel: IModelConnection): Promise<void> {\r\n if (this.isLoaded)\r\n return;\r\n\r\n const attachmentProps = await iModel.elements.getProps(this._ids) as ViewAttachmentInfo[];\r\n const promises = [];\r\n for (const attachment of attachmentProps) {\r\n const loadView = async () => {\r\n try {\r\n const view = await iModel.views.load(attachment.view.id);\r\n return view;\r\n } catch {\r\n return undefined;\r\n }\r\n };\r\n\r\n promises.push(loadView());\r\n }\r\n\r\n const views = await Promise.all(promises);\r\n assert(views.length === attachmentProps.length);\r\n\r\n const attachments = [];\r\n for (let i = 0; i < views.length; i++) {\r\n const view = views[i];\r\n if (view && !(view instanceof SheetViewState)) {\r\n const props = attachmentProps[i];\r\n props.attachedView = view;\r\n attachments.push(props);\r\n }\r\n }\r\n\r\n this._attachments = attachments;\r\n }\r\n\r\n public createAttachments(sheetView: SheetViewState): ViewAttachments | undefined {\r\n return this.isLoaded ? new ViewAttachments(this._props, sheetView) : undefined;\r\n }\r\n}\r\n\r\n/** The set of view attachments to be displayed in a Viewport via a SheetViewState. Allocated when the view becomes attached to a Viewport;\r\n * disposed of when it becomes detached from the viewport.\r\n */\r\nclass ViewAttachments {\r\n private readonly _attachments: Attachment[] = [];\r\n public maxDepth = Frustum2d.minimumZDistance;\r\n\r\n public constructor(infos: ViewAttachmentInfo[], sheetView: SheetViewState) {\r\n for (const info of infos) {\r\n const drawAsRaster = info.jsonProperties?.displayOptions?.drawAsRaster || (info.attachedView.is3d() && info.attachedView.isCameraOn);\r\n const ctor = drawAsRaster ? RasterAttachment : OrthographicAttachment;\r\n const attachment = new ctor(info.attachedView, info, sheetView);\r\n this._attachments.push(attachment);\r\n this.maxDepth = Math.max(this.maxDepth, attachment.zDepth);\r\n }\r\n }\r\n\r\n public dispose(): void {\r\n for (const attachment of this._attachments)\r\n attachment.dispose();\r\n\r\n this._attachments.length = 0;\r\n }\r\n\r\n public [Symbol.iterator](): Iterator<Attachment> {\r\n return this._attachments[Symbol.iterator]();\r\n }\r\n\r\n /** For tests. */\r\n public get attachments(): Object[] {\r\n return this._attachments;\r\n }\r\n\r\n public get isEmpty(): boolean {\r\n return 0 === this._attachments.length;\r\n }\r\n\r\n public get areAllTileTreesLoaded(): boolean {\r\n return this._attachments.every((x) => x.areAllTileTreesLoaded);\r\n }\r\n\r\n public discloseTileTrees(trees: DisclosedTileTreeSet): void {\r\n for (const attachment of this._attachments)\r\n trees.disclose(attachment);\r\n }\r\n\r\n public collectStatistics(stats: RenderMemory.Statistics): void {\r\n for (const attachment of this._attachments)\r\n attachment.collectStatistics(stats);\r\n }\r\n\r\n public addToScene(context: SceneContext): void {\r\n for (const attachment of this._attachments)\r\n attachment.addToScene(context);\r\n }\r\n}\r\n\r\n/** A view of a [SheetModel]($backend).\r\n * @public\r\n */\r\nexport class SheetViewState extends ViewState2d {\r\n /** The width and height of the sheet in world coordinates. */\r\n public readonly sheetSize: Point2d;\r\n private _attachmentsInfo: ViewAttachmentsInfo;\r\n private _attachments?: ViewAttachments;\r\n private readonly _viewedExtents: AxisAlignedBox3d;\r\n\r\n public get attachmentIds(): Id64Array {\r\n return this._attachmentsInfo.toJSON();\r\n }\r\n\r\n /** @internal */\r\n public static override get className() { return \"SheetViewDefinition\"; }\r\n\r\n public static override createFromProps(viewStateData: ViewStateProps, iModel: IModelConnection): SheetViewState {\r\n const cat = new CategorySelectorState(viewStateData.categorySelectorProps, iModel);\r\n const displayStyleState = new DisplayStyle2dState(viewStateData.displayStyleProps, iModel);\r\n\r\n // use \"new this\" so subclasses are correct\r\n return new this(viewStateData.viewDefinitionProps as ViewDefinition2dProps, iModel, cat, displayStyleState, viewStateData.sheetProps!, viewStateData.sheetAttachments!);\r\n }\r\n\r\n public override toProps(): ViewStateProps {\r\n const props = super.toProps();\r\n\r\n props.sheetAttachments = this._attachmentsInfo.toJSON();\r\n\r\n // For sheetProps all that is actually used is the size, so just null out everything else.\r\n const codeProps = { spec: \"\", scope: \"\", value: \"\" };\r\n props.sheetProps = {\r\n model: \"\",\r\n code: codeProps,\r\n classFullName: \"\",\r\n width: this.sheetSize.x,\r\n height: this.sheetSize.y,\r\n scale: 1,\r\n };\r\n\r\n return props;\r\n }\r\n\r\n /** Strictly for testing. @internal */\r\n public get viewAttachmentProps(): Array<Readonly<ViewAttachmentProps>> {\r\n return this._attachmentsInfo.viewAttachmentProps;\r\n }\r\n\r\n /** Strictly for testing. @internal */\r\n public get attachments(): Object[] | undefined {\r\n return this._attachments?.attachments;\r\n }\r\n\r\n /** @internal */\r\n public override isDrawingView(): this is DrawingViewState { return false; }\r\n /** @internal */\r\n public override isSheetView(): this is SheetViewState { return true; }\r\n\r\n public constructor(props: ViewDefinition2dProps, iModel: IModelConnection, categories: CategorySelectorState, displayStyle: DisplayStyle2dState, sheetProps: SheetProps, attachments: Id64Array) {\r\n super(props, iModel, categories, displayStyle);\r\n if (categories instanceof SheetViewState) {\r\n // we are coming from clone...\r\n this.sheetSize = categories.sheetSize.clone();\r\n this._attachmentsInfo = categories._attachmentsInfo.clone();\r\n this._viewedExtents = categories._viewedExtents.clone();\r\n } else {\r\n this.sheetSize = Point2d.create(sheetProps.width, sheetProps.height);\r\n this._attachmentsInfo = ViewAttachmentsInfo.fromJSON(attachments);\r\n\r\n const extents = new Range3d(0, 0, 0, this.sheetSize.x, this.sheetSize.y, 0);\r\n const margin = 1.1;\r\n extents.scaleAboutCenterInPlace(margin);\r\n this._viewedExtents = extents;\r\n }\r\n }\r\n\r\n public override getOrigin() {\r\n const origin = super.getOrigin();\r\n if (this._attachments)\r\n origin.z = -this._attachments.maxDepth;\r\n\r\n return origin;\r\n }\r\n\r\n public override getExtents() {\r\n const extents = super.getExtents();\r\n if (this._attachments)\r\n extents.z = this._attachments.maxDepth + Frustum2d.minimumZDistance;\r\n\r\n return extents;\r\n }\r\n\r\n /** Disclose *all* TileTrees currently in use by this view. This set may include trees not reported by [[forEachTileTreeRef]] - e.g., those used by view attachments, map-draped terrain, etc.\r\n * @internal override\r\n */\r\n public override discloseTileTrees(trees: DisclosedTileTreeSet): void {\r\n super.discloseTileTrees(trees);\r\n if (this._attachments)\r\n trees.disclose(this._attachments);\r\n }\r\n\r\n /** @internal */\r\n public override collectNonTileTreeStatistics(stats: RenderMemory.Statistics): void {\r\n super.collectNonTileTreeStatistics(stats);\r\n if (this._attachments)\r\n this._attachments.collectStatistics(stats);\r\n }\r\n\r\n /** @internal */\r\n public override get defaultExtentLimits() {\r\n return { min: Constant.oneMillimeter, max: this.sheetSize.magnitude() * 10 };\r\n }\r\n\r\n /** @internal */\r\n public override getViewedExtents(): AxisAlignedBox3d {\r\n return this._viewedExtents;\r\n }\r\n\r\n /** Load the size and attachment for this sheet, as well as any other 2d view state characteristics.\r\n * @internal override\r\n */\r\n public override async load(): Promise<void> {\r\n await super.load();\r\n await this._attachmentsInfo.load(this.iModel);\r\n }\r\n\r\n /** @internal */\r\n public override createScene(context: SceneContext): void {\r\n super.createScene(context);\r\n if (this._attachments)\r\n this._attachments.addToScene(context);\r\n }\r\n\r\n /** @internal */\r\n public override get secondaryViewports(): Iterable<Viewport> {\r\n const attachments = this._attachments;\r\n if (!attachments)\r\n return super.secondaryViewports;\r\n\r\n function* iterator() {\r\n for (const attachment of attachments!) {\r\n const vp = attachment.viewport;\r\n if (vp)\r\n yield vp;\r\n }\r\n }\r\n\r\n return {\r\n [Symbol.iterator]: () => iterator(),\r\n };\r\n }\r\n\r\n /** @internal */\r\n private async queryAttachmentIds(): Promise<Id64Array> {\r\n const ecsql = `SELECT ECInstanceId as attachmentId FROM bis.ViewAttachment WHERE model.Id=${this.baseModelId}`;\r\n const ids: string[] = [];\r\n for await (const row of this.iModel.query(ecsql))\r\n ids.push(row[0]);\r\n\r\n return ids;\r\n }\r\n\r\n /** @internal */\r\n public override async changeViewedModel(modelId: Id64String): Promise<void> {\r\n await super.changeViewedModel(modelId);\r\n const attachmentIds = await this.queryAttachmentIds();\r\n this._attachmentsInfo = ViewAttachmentsInfo.fromJSON(attachmentIds);\r\n\r\n assert(undefined === this._attachments);\r\n }\r\n\r\n /** @internal */\r\n public override attachToViewport(args: AttachToViewportArgs): void {\r\n super.attachToViewport(args);\r\n assert(undefined === this._attachments);\r\n this._attachments = this._attachmentsInfo.createAttachments(this);\r\n }\r\n\r\n /** @internal */\r\n public override detachFromViewport(): void {\r\n super.detachFromViewport();\r\n this._attachments = dispose(this._attachments);\r\n }\r\n\r\n /** @internal */\r\n public override get areAllTileTreesLoaded(): boolean {\r\n return super.areAllTileTreesLoaded && (!this._attachments || this._attachments.areAllTileTreesLoaded);\r\n }\r\n\r\n /** Create a sheet border decoration graphic. */\r\n private createBorder(width: number, height: number, context: DecorateContext): RenderGraphic {\r\n const border = SheetBorder.create(width, height, context);\r\n const builder = context.createGraphicBuilder(GraphicType.ViewBackground);\r\n border.addToBuilder(builder);\r\n return builder.finish();\r\n }\r\n\r\n /** @internal */\r\n public override decorate(context: DecorateContext): void {\r\n super.decorate(context);\r\n if (this.sheetSize !== undefined) {\r\n const border = this.createBorder(this.sheetSize.x, this.sheetSize.y, context);\r\n context.setViewBackground(border);\r\n }\r\n }\r\n\r\n /** @internal */\r\n public override computeFitRange(): Range3d {\r\n const size = this.sheetSize;\r\n if (0 >= size.x || 0 >= size.y)\r\n return super.computeFitRange();\r\n return new Range3d(0, 0, -1, size.x, size.y, 1);\r\n }\r\n}\r\n\r\n/** A mostly no-op RenderTarget for an Attachment.\r\n * its Scene and symbology overrides.\r\n */\r\nclass AttachmentTarget extends MockRender.OffScreenTarget {\r\n private readonly _attachment: OrthographicAttachment;\r\n\r\n public constructor(attachment: OrthographicAttachment) {\r\n // The dimensions don't matter - we're not drawing anything.\r\n const rect = new ViewRect(1, 1);\r\n super(IModelApp.renderSystem, rect);\r\n this._attachment = attachment;\r\n }\r\n\r\n public override changeScene(scene: Scene): void {\r\n this._attachment.scene = scene;\r\n }\r\n\r\n public override overrideFeatureSymbology(ovrs: FeatureSymbology.Overrides): void {\r\n this._attachment.symbologyOverrides = ovrs;\r\n }\r\n}\r\n\r\n/** Draws the contents of a view attachment into a sheet view. */\r\ninterface Attachment {\r\n readonly areAllTileTreesLoaded: boolean;\r\n addToScene: (context: SceneContext) => void;\r\n discloseTileTrees: (trees: DisclosedTileTreeSet) => void;\r\n readonly zDepth: number;\r\n collectStatistics: (stats: RenderMemory.Statistics) => void;\r\n viewAttachmentProps: ViewAttachmentProps;\r\n dispose(): void;\r\n readonly viewport?: Viewport;\r\n}\r\n\r\n/** Draws the contents a 2d or orthographic 3d view directly into a sheet view.\r\n * We select tiles for the view in the context of a light-weight offscreen viewport with a no-op RenderTarget, then\r\n * collect the resultant graphics and add them to the sheet view's scene.\r\n */\r\nclass OrthographicAttachment {\r\n private readonly _viewport: OffScreenViewport;\r\n private readonly _props: ViewAttachmentProps;\r\n private readonly _sheetModelId: Id64String;\r\n private readonly _viewFlagOverrides: ViewFlagOverrides;\r\n private readonly _toSheet: Transform;\r\n private readonly _fromSheet: Transform;\r\n private readonly _sizeInMeters: Point2d;\r\n private readonly _range: Range3d;\r\n private readonly _viewRect = new ViewRect(0, 0, 1, 1);\r\n private readonly _originalFrustum = new Frustum();\r\n private readonly _clipVolume?: RenderClipVolume;\r\n private readonly _hiddenLineSettings?: HiddenLine.Settings;\r\n private readonly _scale: { x: number, y: number };\r\n private _debugFeatureTable?: PackedFeatureTable;\r\n public scene?: Scene;\r\n public symbologyOverrides: FeatureSymbology.Overrides;\r\n public readonly zDepth: number;\r\n\r\n public get view(): ViewState {\r\n return this._viewport.view;\r\n }\r\n\r\n public get viewAttachmentProps() {\r\n return this._props;\r\n }\r\n\r\n public get viewport(): Viewport {\r\n return this._viewport;\r\n }\r\n\r\n public constructor(view: ViewState, props: ViewAttachmentProps, sheetView: SheetViewState) {\r\n this.symbologyOverrides = new FeatureSymbology.Overrides(view);\r\n const target = new AttachmentTarget(this);\r\n this._viewport = OffScreenViewport.createViewport(view, target, true);\r\n\r\n this._props = props;\r\n this._sheetModelId = sheetView.baseModelId;\r\n\r\n const applyClip = true; // set to false for debugging\r\n this._viewFlagOverrides = {\r\n ...view.viewFlags,\r\n clipVolume: applyClip,\r\n lighting: false,\r\n shadows: false,\r\n };\r\n\r\n const placement = Placement2d.fromJSON(props.placement);\r\n const range = placement.calculateRange();\r\n this._range = range;\r\n this._sizeInMeters = new Point2d(range.xLength(), range.yLength());\r\n\r\n // Compute transform from attached view's world coordinates to sheet's world coordinates.\r\n // NB: We obtain the extents and origin from the *viewport* not the *view* - they may have been adjusted by the viewport.\r\n const applySkew = true; // set to false for debugging\r\n const skew = applySkew ? view.getAspectRatioSkew() : 1;\r\n const extents = this._viewport.viewingSpace.viewDelta.clone();\r\n const zDepth = Math.abs(extents.z);\r\n const scaleX = this._sizeInMeters.x / Math.abs(extents.x);\r\n const scaleY = skew * this._sizeInMeters.y / Math.abs(extents.y);\r\n this._scale = { x: 1 / scaleX, y: 1 / scaleY };\r\n\r\n const zBias = Frustum2d.depthFromDisplayPriority(props.jsonProperties?.displayPriority ?? 0);\r\n this.zDepth = 1.01 * (zDepth - zBias); // give a little padding so that geometry right up against far plane doesn't get clipped.\r\n\r\n // View origin is at the *back* of the view. Align *front* of view based on display priority.\r\n const viewRot = view.getRotation();\r\n const viewOrg = viewRot.multiplyVector(this._viewport.viewingSpace.viewOrigin);\r\n viewOrg.z += zDepth;\r\n viewRot.multiplyTransposeVectorInPlace(viewOrg);\r\n\r\n const matrix = Matrix3d.createScale(scaleX, scaleY, 1);\r\n matrix.multiplyMatrixMatrix(viewRot, matrix);\r\n const origin = Matrix3d.xyzMinusMatrixTimesXYZ(viewOrg, matrix, viewOrg);\r\n const attachmentOrigin = Point3d.createFrom(placement.origin);\r\n attachmentOrigin.z = zBias;\r\n const viewOrgToAttachment = attachmentOrigin.minus(viewOrg);\r\n origin.addInPlace(viewOrgToAttachment);\r\n this._toSheet = Transform.createRefs(origin, matrix);\r\n this._fromSheet = this._toSheet.inverse()!;\r\n\r\n // ###TODO? If we also apply the attachment's clip to the attached view, we may get additional culling during tile selection.\r\n // However the attached view's frustum is already clipped by intersection with sheet view's frustum, and additional clipping planes\r\n // introduce additional computation, so possibly not worth it.\r\n\r\n // Transform the view's clip (if any) to sheet space\r\n let viewClip = view.viewFlags.clipVolume ? view.getViewClip()?.clone() : undefined;\r\n if (viewClip)\r\n viewClip.transformInPlace(this._toSheet);\r\n else\r\n viewClip = ClipVector.createEmpty();\r\n\r\n let sheetClip;\r\n if (undefined !== props.jsonProperties?.clip)\r\n sheetClip = ClipVector.fromJSON(props.jsonProperties?.clip);\r\n\r\n if (sheetClip && sheetClip.isValid) {\r\n // Clip to view attachment's clip. NB: clip is in sheet coordinate space.\r\n for (const clip of sheetClip.clips)\r\n viewClip.clips.push(clip);\r\n } else {\r\n // Clip to view attachment's bounding box\r\n viewClip.appendShape([\r\n Point3d.create(this._range.low.x, this._range.low.y),\r\n Point3d.create(this._range.high.x, this._range.low.y),\r\n Point3d.create(this._range.high.x, this._range.high.y),\r\n Point3d.create(this._range.low.x, this._range.high.y),\r\n ]);\r\n }\r\n\r\n this._clipVolume = IModelApp.renderSystem.createClipVolume(viewClip);\r\n\r\n // Save off the original frustum (potentially adjusted by viewport).\r\n this._viewport.setupFromView();\r\n this._viewport.viewingSpace.getFrustum(CoordSystem.World, true, this._originalFrustum);\r\n\r\n const applyHiddenLineSettings = true; // for debugging edge display, set to false...\r\n const style = view.displayStyle;\r\n if (style.is3d() && applyHiddenLineSettings)\r\n this._hiddenLineSettings = style.settings.hiddenLineSettings;\r\n }\r\n\r\n public dispose(): void {\r\n this._viewport.dispose();\r\n }\r\n\r\n public discloseTileTrees(trees: DisclosedTileTreeSet): void {\r\n trees.disclose(this._viewport);\r\n }\r\n\r\n public addToScene(context: SceneContext): void {\r\n if (context.viewport.freezeScene)\r\n return;\r\n\r\n if (!context.viewport.view.viewsCategory(this._props.category))\r\n return;\r\n\r\n const wantBounds = context.viewport.wantViewAttachmentBoundaries;\r\n const wantClipShapes = context.viewport.wantViewAttachmentClipShapes;\r\n if (wantBounds || wantClipShapes) {\r\n const builder = context.createSceneGraphicBuilder();\r\n if (wantBounds) {\r\n builder.setSymbology(ColorDef.red, ColorDef.red, 2);\r\n builder.addRangeBox(this._range);\r\n }\r\n\r\n if (wantClipShapes && this._clipVolume) {\r\n builder.setSymbology(ColorDef.blue, ColorDef.blue, 2);\r\n for (const prim of this._clipVolume.clipVector.clips) {\r\n if (!(prim instanceof ClipShape))\r\n continue; // ###TODO handle non-shape primitives, if any such ever encountered\r\n\r\n const pts = [];\r\n const tf = prim.transformFromClip;\r\n for (const pt of prim.polygon) {\r\n const tfPt = tf ? tf.multiplyPoint3d(pt) : pt;\r\n pts.push(new Point2d(tfPt.x, tfPt.y));\r\n }\r\n\r\n builder.addLineString2d(pts, 0);\r\n }\r\n }\r\n\r\n // Put into a Batch so that we can see tooltip with attachment Id on mouseover.\r\n const batch = context.target.renderSystem.createBatch(builder.finish(), this.getDebugFeatureTable(), this._range);\r\n context.outputGraphic(batch);\r\n }\r\n\r\n if (!context.viewport.wantViewAttachments)\r\n return;\r\n\r\n // Pixel size used to compute size of ViewRect so that tiles of appropriate LOD are selected.\r\n const pixelSize = context.viewport.getPixelSizeAtPoint();\r\n if (0 === pixelSize)\r\n return;\r\n\r\n // Adjust attached view frustum based on intersection with sheet view frustum.\r\n const attachFrustum = this._originalFrustum.transformBy(this._toSheet);\r\n const attachFrustumRange = attachFrustum.toRange();\r\n const sheetFrustum = context.viewport.getWorldFrustum();\r\n const sheetFrustumRange = sheetFrustum.toRange();\r\n const intersect = attachFrustumRange.intersect(sheetFrustumRange);\r\n if (intersect.isNull)\r\n return;\r\n\r\n attachFrustum.initFromRange(intersect);\r\n attachFrustum.transformBy(this._fromSheet, attachFrustum);\r\n this._viewport.setupViewFromFrustum(attachFrustum);\r\n\r\n // Adjust view rect based on size of attachment on screen so that tiles of appropriate LOD are selected.\r\n const width = this._sizeInMeters.x * intersect.xLength() / attachFrustumRange.xLength();\r\n const height = this._sizeInMeters.y * intersect.yLength() / attachFrustumRange.yLength();\r\n this._viewRect.width = Math.max(1, Math.round(width / pixelSize));\r\n this._viewRect.height = Math.max(1, Math.round(height / pixelSize));\r\n this._viewport.setRect(this._viewRect);\r\n\r\n // Propagate settings from on-screen viewport.\r\n this._viewport.debugBoundingBoxes = context.viewport.debugBoundingBoxes;\r\n this._viewport.setTileSizeModifier(context.viewport.tileSizeModifier);\r\n\r\n // Create the scene.\r\n this._viewport.renderFrame();\r\n\r\n const scene = this.scene;\r\n if (!scene)\r\n return;\r\n\r\n // Extract scene graphics and insert into on-screen scene context.\r\n const options = {\r\n clipVolume: this._clipVolume,\r\n hline: this._hiddenLineSettings,\r\n frustum: {\r\n is3d: this.view.is3d(),\r\n scale: this._scale,\r\n },\r\n };\r\n\r\n const outputGraphics = (source: RenderGraphic[]) => {\r\n if (0 === source.length)\r\n return;\r\n\r\n const graphics = new GraphicBranch();\r\n graphics.setViewFlagOverrides(this._viewFlagOverrides);\r\n graphics.symbologyOverrides = this.symbologyOverrides;\r\n\r\n for (const graphic of source)\r\n graphics.entries.push(graphic);\r\n\r\n const branch = context.createGraphicBranch(graphics, this._toSheet, options);\r\n context.outputGraphic(branch);\r\n };\r\n\r\n outputGraphics(scene.foreground);\r\n context.withGraphicType(TileGraphicType.BackgroundMap, () => outputGraphics(scene.background));\r\n context.withGraphicType(TileGraphicType.Overlay, () => outputGraphics(scene.overlay));\r\n\r\n // Report tile statistics to sheet view's viewport.\r\n const tileAdmin = IModelApp.tileAdmin;\r\n const selectedAndReady = tileAdmin.getTilesForUser(this._viewport);\r\n const requested = tileAdmin.getRequestsForUser(this._viewport);\r\n tileAdmin.addExternalTilesForUser(context.viewport, {\r\n requested: requested?.size ?? 0,\r\n selected: selectedAndReady?.selected.size ?? 0,\r\n ready: selectedAndReady?.ready.size ?? 0,\r\n });\r\n }\r\n\r\n private getDebugFeatureTable(): PackedFeatureTable {\r\n if (this._debugFeatureTable)\r\n return this._debugFeatureTable;\r\n\r\n const featureTable = new FeatureTable(1, this._sheetModelId);\r\n featureTable.insert(new Feature(this._props.id));\r\n this._debugFeatureTable = PackedFeatureTable.pack(featureTable);\r\n return this._debugFeatureTable;\r\n }\r\n\r\n public get areAllTileTreesLoaded(): boolean {\r\n return this.view.areAllTileTreesLoaded;\r\n }\r\n\r\n public collectStatistics(_stats: RenderMemory.Statistics): void {\r\n // Handled by discloseTileTrees()\r\n }\r\n}\r\n\r\nfunction createRasterAttachmentViewport(_view: ViewState, _rect: ViewRect, _attachment: RasterAttachment): OffScreenViewport {\r\n class RasterAttachmentViewport extends OffScreenViewport {\r\n private _sceneContext?: SceneContext;\r\n private _isSceneReady = false;\r\n private readonly _attachment: RasterAttachment;\r\n\r\n public constructor(view: ViewState, rect: ViewRect, attachment: RasterAttachment) {\r\n super(IModelApp.renderSystem.createOffscreenTarget(rect));\r\n this._attachment = attachment;\r\n this._isAspectRatioLocked = true;\r\n this.changeView(view);\r\n }\r\n\r\n public override createSceneContext(): SceneContext {\r\n assert(!this._isSceneReady);\r\n\r\n this._sceneContext = super.createSceneContext();\r\n return this._sceneContext;\r\n }\r\n\r\n public override renderFrame(): void {\r\n assert(!this._isSceneReady);\r\n\r\n this.clearSceneContext();\r\n super.renderFrame();\r\n\r\n if (undefined !== this._sceneContext) {\r\n this._isSceneReady = !this._sceneContext.hasMissingTiles && this.view.areAllTileTreesLoaded;\r\n if (this._isSceneReady)\r\n this._attachment.produceGraphics(this._sceneContext);\r\n\r\n this._sceneContext = undefined;\r\n }\r\n }\r\n\r\n private clearSceneContext(): void {\r\n this._sceneContext = undefined;\r\n }\r\n\r\n public override addDecorations(_decorations: Decorations): void {\r\n // ###TODO: skybox, ground plane, possibly grid. DecorateContext requires a ScreenViewport...\r\n }\r\n }\r\n\r\n return new RasterAttachmentViewport(_view, _rect, _attachment);\r\n}\r\n\r\n/** Draws a 3d view with camera enabled into a sheet view by producing an image of the view's contents offscreen. */\r\nclass RasterAttachment {\r\n private readonly _props: ViewAttachmentProps;\r\n private readonly _placement: Placement2d;\r\n private readonly _transform: Transform;\r\n public readonly zDepth: number;\r\n private _viewport?: OffScreenViewport;\r\n private _graphics?: RenderGraphic;\r\n\r\n public constructor(view: ViewState, props: ViewAttachmentProps, sheetView: SheetViewState) {\r\n // Render to a 2048x2048 view rect. Scale in Y to preserve aspect ratio.\r\n const maxSize = 2048;\r\n const rect = new ViewRect(0, 0, maxSize, maxSize);\r\n const height = maxSize * view.getAspectRatio() * view.getAspectRatioSkew();\r\n const skew = maxSize / height;\r\n view.setAspectRatioSkew(skew);\r\n\r\n if (true !== props.jsonProperties?.displayOptions?.preserveBackground) {\r\n // Make background color 100% transparent so that Viewport.readImageBuffer() will discard transparent pixels.\r\n const bgColor = sheetView.displayStyle.backgroundColor.withAlpha(0);\r\n view.displayStyle.backgroundColor = bgColor;\r\n }\r\n\r\n this._viewport = createRasterAttachmentViewport(view, rect, this);\r\n this._props = props;\r\n this._placement = Placement2d.fromJSON(props.placement);\r\n this._transform = this._placement.transform;\r\n this.zDepth = Frustum2d.depthFromDisplayPriority(props.jsonProperties?.displayPriority ?? 0);\r\n }\r\n\r\n public dispose(): void {\r\n this._viewport?.dispose();\r\n }\r\n\r\n public get viewAttachmentProps() {\r\n return this._props;\r\n }\r\n\r\n public get viewport(): Viewport | undefined {\r\n return this._viewport;\r\n }\r\n\r\n public get areAllTileTreesLoaded() {\r\n return this._viewport?.areAllTileTreesLoaded ?? true;\r\n }\r\n\r\n public addToScene(context: SceneContext): void {\r\n // ###TODO: check viewport.wantViewAttachmentClipShapes\r\n if (!context.viewport.view.viewsCategory(this._props.category))\r\n return;\r\n\r\n if (context.viewport.wantViewAttachmentBoundaries) {\r\n const builder = context.createSceneGraphicBuilder(this._transform);\r\n builder.setSymbology(ColorDef.red, ColorDef.red, 2);\r\n builder.addRangeBox(Range3d.createRange2d(this._placement.bbox));\r\n context.outputGraphic(builder.finish());\r\n }\r\n\r\n if (!context.viewport.wantViewAttachments)\r\n return;\r\n\r\n if (this._graphics) {\r\n context.outputGraphic(this._graphics);\r\n return;\r\n }\r\n\r\n if (undefined === this._viewport)\r\n return;\r\n\r\n this._viewport.debugBoundingBoxes = context.viewport.debugBoundingBoxes;\r\n this._viewport.setTileSizeModifier(context.viewport.tileSizeModifier);\r\n\r\n this._viewport.renderFrame();\r\n if (this._graphics)\r\n context.outputGraphic(this._graphics);\r\n }\r\n\r\n public discloseTileTrees(trees: DisclosedTileTreeSet) {\r\n if (this._viewport)\r\n trees.disclose(this._viewport);\r\n }\r\n\r\n public produceGraphics(context: SceneContext): void {\r\n assert(context.viewport === this._viewport);\r\n this._graphics = this.createGraphics(this._viewport);\r\n this._viewport = dispose(this._viewport);\r\n\r\n if (undefined !== this._graphics)\r\n context.outputGraphic(this._graphics);\r\n }\r\n\r\n private createGraphics(vp: Viewport): RenderGraphic | undefined {\r\n // Create a texture from the contents of the view.\r\n const image = vp.readImageBuffer({ upsideDown: true });\r\n if (undefined === image)\r\n return undefined;\r\n\r\n const debugImage = false; // set to true to open a window displaying the captured image.\r\n if (debugImage) {\r\n const url = imageBufferToPngDataUrl(image, false);\r\n if (url)\r\n openImageDataUrlInNewWindow(url, \"Attachment\");\r\n }\r\n\r\n const texture = IModelApp.renderSystem.createTexture({\r\n image: { source: image, transparency: TextureTransparency.Opaque },\r\n });\r\n if (!texture)\r\n return undefined;\r\n\r\n // Create a material for the texture\r\n const graphicParams = new GraphicParams();\r\n graphicParams.material = IModelApp.renderSystem.createRenderMaterial({ textureMapping: { texture } });\r\n\r\n // Apply the texture to a rectangular polyface.\r\n const depth = this.zDepth;\r\n const east = this._placement.bbox.low.x;\r\n const west = this._placement.bbox.high.x;\r\n const north = this._placement.bbox.low.y;\r\n const south = this._placement.bbox.high.y;\r\n const corners = [\r\n Point3d.create(east, north, depth),\r\n Point3d.create(west, north, depth),\r\n Point3d.create(west, south, depth),\r\n Point3d.create(east, south, depth),\r\n ];\r\n const params = [\r\n Point2d.create(0, 0),\r\n Point2d.create(1, 0),\r\n Point2d.create(1, 1),\r\n Point2d.create(0, 1),\r\n ];\r\n\r\n const strokeOptions = new StrokeOptions();\r\n strokeOptions.needParams = strokeOptions.shouldTriangulate = true;\r\n const polyfaceBuilder = PolyfaceBuilder.create(strokeOptions);\r\n polyfaceBuilder.addQuadFacet(corners, params);\r\n const polyface = polyfaceBuilder.claimPolyface();\r\n\r\n const graphicBuilder = IModelApp.renderSystem.createGraphicBuilder(Transform.createIdentity(), GraphicType.Scene, vp, this._props.id);\r\n graphicBuilder.activateGraphicParams(graphicParams);\r\n graphicBuilder.addPolyface(polyface, false);\r\n const graphic = graphicBuilder.finish();\r\n\r\n // Wrap the polyface in a GraphicBranch.\r\n const branch = new GraphicBranch(true);\r\n const vfOvrs = createDefaultViewFlagOverrides({ clipVolume: true, shadows: false, lighting: false, thematic: false });\r\n\r\n // Disable transparency - background pixels are 100% transparent so they will be discarded anyway. Other pixels are 100% opaque.\r\n vfOvrs.transparency = false;\r\n branch.setViewFlagOverrides(vfOvrs);\r\n branch.symbologyOverrides = new FeatureSymbology.Overrides();\r\n branch.entries.push(graphic);\r\n\r\n // Apply the attachment's clip, if any.\r\n let clipVolume;\r\n if (this._props.jsonProperties?.clip) {\r\n const clipVector = ClipVector.fromJSON(this._props.jsonProperties?.clip);\r\n if (clipVector.isValid)\r\n clipVolume = IModelApp.renderSystem.createClipVolume(clipVector);\r\n }\r\n\r\n return IModelApp.renderSystem.createGraphicBranch(branch, this._transform, { clipVolume });\r\n }\r\n\r\n public collectStatistics(stats: RenderMemory.Statistics): void {\r\n if (this._graphics)\r\n this._graphics.collectStatistics(stats);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"SheetViewState.js","sourceRoot":"","sources":["../../src/SheetViewState.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAyB,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACvK,OAAO,EACa,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAc,kBAAkB,EAAE,WAAW,EAChI,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,mBAAmB,E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IAAI,CAAC,CAAC;YACzE,IAAI,UAAU,CAAC,OAAO;gBACpB,UAAU,GAAG,SAAS,CAAC,YAAY,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;SACpE;QAED,OAAO,SAAS,CAAC,YAAY,CAAC,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;IAC7F,CAAC;IAEM,iBAAiB,CAAC,KAA8B;QACrD,IAAI,IAAI,CAAC,SAAS;YAChB,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Views\r\n */\r\n\r\nimport { assert, dispose, Id64Array, Id64String } from \"@itwin/core-bentley\";\r\nimport { Angle, ClipShape, ClipVector, Constant, Matrix3d, Point2d, Point3d, PolyfaceBuilder, Range2d, Range3d, StrokeOptions, Transform } from \"@itwin/core-geometry\";\r\nimport {\r\n AxisAlignedBox3d, ColorDef, Feature, FeatureTable, Frustum, Gradient, GraphicParams, HiddenLine, PackedFeatureTable, Placement2d, SheetProps,\r\n TextureTransparency, ViewAttachmentProps, ViewDefinition2dProps, ViewFlagOverrides, ViewStateProps,\r\n} from \"@itwin/core-common\";\r\nimport { CategorySelectorState } from \"./CategorySelectorState\";\r\nimport { DisplayStyle2dState } from \"./DisplayStyleState\";\r\nimport { IModelConnection } from \"./IModelConnection\";\r\nimport { GraphicBuilder, GraphicType } from \"./render/GraphicBuilder\";\r\nimport { RenderGraphic } from \"./render/RenderGraphic\";\r\nimport { GraphicBranch } from \"./render/GraphicBranch\";\r\nimport { Frustum2d } from \"./Frustum2d\";\r\nimport { Scene } from \"./render/Scene\";\r\nimport { Decorations } from \"./render/Decorations\";\r\nimport { MockRender } from \"./render/MockRender\";\r\nimport { RenderClipVolume } from \"./render/RenderClipVolume\";\r\nimport { RenderMemory } from \"./render/RenderMemory\";\r\nimport { FeatureSymbology } from \"./render/FeatureSymbology\";\r\nimport { DecorateContext, SceneContext } from \"./ViewContext\";\r\nimport { ViewRect } from \"./ViewRect\";\r\nimport { IModelApp } from \"./IModelApp\";\r\nimport { CoordSystem } from \"./CoordSystem\";\r\nimport { OffScreenViewport, Viewport } from \"./Viewport\";\r\nimport { AttachToViewportArgs, ViewState, ViewState2d } from \"./ViewState\";\r\nimport { DrawingViewState } from \"./DrawingViewState\";\r\nimport { createDefaultViewFlagOverrides, DisclosedTileTreeSet, TileGraphicType } from \"./tile/internal\";\r\nimport { imageBufferToPngDataUrl, openImageDataUrlInNewWindow } from \"./ImageUtil\";\r\n\r\n// cSpell:ignore ovrs\r\n\r\n/** Describes the geometry and styling of a sheet border decoration.\r\n * The sheet border decoration mimics a sheet of paper with a drop shadow.\r\n */\r\nclass SheetBorder {\r\n private _rect: Point2d[];\r\n private _shadow: Point2d[];\r\n private _gradient: Gradient.Symb;\r\n\r\n private constructor(rect: Point2d[], shadow: Point2d[], gradient: Gradient.Symb) {\r\n this._rect = rect;\r\n this._shadow = shadow;\r\n this._gradient = gradient;\r\n }\r\n\r\n /** Create a new sheet border. If a context is supplied, points are transformed to view coordinates. */\r\n public static create(width: number, height: number, context?: DecorateContext) {\r\n // Rect\r\n const rect: Point3d[] = [\r\n Point3d.create(0, height),\r\n Point3d.create(0, 0),\r\n Point3d.create(width, 0),\r\n Point3d.create(width, height),\r\n Point3d.create(0, height)];\r\n if (context) {\r\n context.viewport.worldToViewArray(rect);\r\n }\r\n\r\n // Shadow\r\n const shadowWidth = .01 * Math.sqrt(width * width + height * height);\r\n const shadow: Point3d[] = [\r\n Point3d.create(shadowWidth, 0),\r\n Point3d.create(shadowWidth, -shadowWidth),\r\n Point3d.create(width + shadowWidth, -shadowWidth),\r\n Point3d.create(width + shadowWidth, height - shadowWidth),\r\n Point3d.create(width, height - shadowWidth),\r\n Point3d.create(width, 0),\r\n Point3d.create(shadowWidth, 0),\r\n ];\r\n if (context) {\r\n context.viewport.worldToViewArray(shadow);\r\n }\r\n\r\n // Gradient\r\n const gradient = new Gradient.Symb();\r\n gradient.mode = Gradient.Mode.Linear;\r\n gradient.angle = Angle.createDegrees(-45);\r\n gradient.keys = [{ value: 0, color: ColorDef.from(25, 25, 25) }, { value: 0.5, color: ColorDef.from(150, 150, 150) }];\r\n\r\n // Copy over points\r\n const rect2d: Point2d[] = [];\r\n for (const point of rect)\r\n rect2d.push(Point2d.createFrom(point));\r\n const shadow2d: Point2d[] = [];\r\n for (const point of shadow)\r\n shadow2d.push(Point2d.createFrom(point));\r\n\r\n return new SheetBorder(rect2d, shadow2d, gradient);\r\n }\r\n\r\n public getRange(): Range2d {\r\n const range = Range2d.createArray(this._rect);\r\n const shadowRange = Range2d.createArray(this._shadow);\r\n range.extendRange(shadowRange);\r\n return range;\r\n }\r\n\r\n /** Add this border to the given GraphicBuilder. */\r\n public addToBuilder(builder: GraphicBuilder) {\r\n const lineColor = ColorDef.black;\r\n const fillColor = ColorDef.black;\r\n\r\n const params = new GraphicParams();\r\n params.fillColor = fillColor;\r\n params.gradient = this._gradient;\r\n\r\n builder.activateGraphicParams(params);\r\n builder.addShape2d(this._shadow, Frustum2d.minimumZDistance);\r\n\r\n builder.setSymbology(lineColor, fillColor, 2);\r\n builder.addLineString2d(this._rect, 0);\r\n }\r\n}\r\n\r\n/** The information required to instantiate an Attachment object. See ViewAttachmentsInfo */\r\ninterface ViewAttachmentInfo extends ViewAttachmentProps {\r\n attachedView: ViewState;\r\n}\r\n\r\n/** The information required to instantiate an ViewAttachments object to draw ViewAttachments into a sheet. The list of view attachment Ids is\r\n * supplied to SheetViewState via the constructor. The corresponding ViewAttachmentProps for each attachment are obtained asynchronously in\r\n * SheetViewState.load(). The Attachments object is created in SheetViewState.attachToViewport and disposed of in SheetViewState.detachFromViewport.\r\n */\r\nclass ViewAttachmentsInfo {\r\n private _attachments: Id64Array | ViewAttachmentInfo[];\r\n\r\n private constructor(attachments: Id64Array | ViewAttachmentInfo[]) {\r\n this._attachments = attachments;\r\n }\r\n\r\n public get isLoaded(): boolean {\r\n return 0 === this._attachments.length || \"string\" !== typeof this._attachments[0];\r\n }\r\n\r\n public get viewAttachmentProps(): Array<Readonly<ViewAttachmentProps>> {\r\n return this.isLoaded ? this._props : [];\r\n }\r\n\r\n private get _props(): ViewAttachmentInfo[] {\r\n assert(this.isLoaded);\r\n return this._attachments as ViewAttachmentInfo[];\r\n }\r\n\r\n private get _ids(): Id64Array {\r\n assert(!this.isLoaded);\r\n return this._attachments as Id64Array;\r\n }\r\n\r\n public static fromJSON(ids: Id64Array = []): ViewAttachmentsInfo {\r\n return new ViewAttachmentsInfo(ids);\r\n }\r\n\r\n public toJSON(): Id64Array {\r\n return this.isLoaded ? this._props.map((x) => x.id!) : [...this._ids];\r\n }\r\n\r\n public clone(): ViewAttachmentsInfo {\r\n // No reason to clone the array.\r\n return new ViewAttachmentsInfo(this._attachments);\r\n }\r\n\r\n public async load(iModel: IModelConnection): Promise<void> {\r\n if (this.isLoaded)\r\n return;\r\n\r\n const attachmentProps = await iModel.elements.getProps(this._ids) as ViewAttachmentInfo[];\r\n const promises = [];\r\n for (const attachment of attachmentProps) {\r\n const loadView = async () => {\r\n try {\r\n const view = await iModel.views.load(attachment.view.id);\r\n return view;\r\n } catch {\r\n return undefined;\r\n }\r\n };\r\n\r\n promises.push(loadView());\r\n }\r\n\r\n const views = await Promise.all(promises);\r\n assert(views.length === attachmentProps.length);\r\n\r\n const attachments = [];\r\n for (let i = 0; i < views.length; i++) {\r\n const view = views[i];\r\n if (view && !(view instanceof SheetViewState)) {\r\n const props = attachmentProps[i];\r\n props.attachedView = view;\r\n attachments.push(props);\r\n }\r\n }\r\n\r\n this._attachments = attachments;\r\n }\r\n\r\n public createAttachments(sheetView: SheetViewState): ViewAttachments | undefined {\r\n return this.isLoaded ? new ViewAttachments(this._props, sheetView) : undefined;\r\n }\r\n}\r\n\r\n/** The set of view attachments to be displayed in a Viewport via a SheetViewState. Allocated when the view becomes attached to a Viewport;\r\n * disposed of when it becomes detached from the viewport.\r\n */\r\nclass ViewAttachments {\r\n private readonly _attachments: Attachment[] = [];\r\n public maxDepth = Frustum2d.minimumZDistance;\r\n\r\n public constructor(infos: ViewAttachmentInfo[], sheetView: SheetViewState) {\r\n for (const info of infos) {\r\n const drawAsRaster = info.jsonProperties?.displayOptions?.drawAsRaster || (info.attachedView.is3d() && info.attachedView.isCameraOn);\r\n const ctor = drawAsRaster ? RasterAttachment : OrthographicAttachment;\r\n const attachment = new ctor(info.attachedView, info, sheetView);\r\n this._attachments.push(attachment);\r\n this.maxDepth = Math.max(this.maxDepth, attachment.zDepth);\r\n }\r\n }\r\n\r\n public dispose(): void {\r\n for (const attachment of this._attachments)\r\n attachment.dispose();\r\n\r\n this._attachments.length = 0;\r\n }\r\n\r\n public [Symbol.iterator](): Iterator<Attachment> {\r\n return this._attachments[Symbol.iterator]();\r\n }\r\n\r\n /** For tests. */\r\n public get attachments(): Object[] {\r\n return this._attachments;\r\n }\r\n\r\n public get isEmpty(): boolean {\r\n return 0 === this._attachments.length;\r\n }\r\n\r\n public get areAllTileTreesLoaded(): boolean {\r\n return this._attachments.every((x) => x.areAllTileTreesLoaded);\r\n }\r\n\r\n public discloseTileTrees(trees: DisclosedTileTreeSet): void {\r\n for (const attachment of this._attachments)\r\n trees.disclose(attachment);\r\n }\r\n\r\n public collectStatistics(stats: RenderMemory.Statistics): void {\r\n for (const attachment of this._attachments)\r\n attachment.collectStatistics(stats);\r\n }\r\n\r\n public addToScene(context: SceneContext): void {\r\n for (const attachment of this._attachments)\r\n attachment.addToScene(context);\r\n }\r\n}\r\n\r\n/** A view of a [SheetModel]($backend).\r\n * @public\r\n */\r\nexport class SheetViewState extends ViewState2d {\r\n /** The width and height of the sheet in world coordinates. */\r\n public readonly sheetSize: Point2d;\r\n private _attachmentsInfo: ViewAttachmentsInfo;\r\n private _attachments?: ViewAttachments;\r\n private readonly _viewedExtents: AxisAlignedBox3d;\r\n\r\n public get attachmentIds(): Id64Array {\r\n return this._attachmentsInfo.toJSON();\r\n }\r\n\r\n /** @internal */\r\n public static override get className() { return \"SheetViewDefinition\"; }\r\n\r\n public static override createFromProps(viewStateData: ViewStateProps, iModel: IModelConnection): SheetViewState {\r\n const cat = new CategorySelectorState(viewStateData.categorySelectorProps, iModel);\r\n const displayStyleState = new DisplayStyle2dState(viewStateData.displayStyleProps, iModel);\r\n\r\n // use \"new this\" so subclasses are correct\r\n return new this(viewStateData.viewDefinitionProps as ViewDefinition2dProps, iModel, cat, displayStyleState, viewStateData.sheetProps!, viewStateData.sheetAttachments!);\r\n }\r\n\r\n public override toProps(): ViewStateProps {\r\n const props = super.toProps();\r\n\r\n props.sheetAttachments = this._attachmentsInfo.toJSON();\r\n\r\n // For sheetProps all that is actually used is the size, so just null out everything else.\r\n const codeProps = { spec: \"\", scope: \"\", value: \"\" };\r\n props.sheetProps = {\r\n model: \"\",\r\n code: codeProps,\r\n classFullName: \"\",\r\n width: this.sheetSize.x,\r\n height: this.sheetSize.y,\r\n scale: 1,\r\n };\r\n\r\n return props;\r\n }\r\n\r\n /** Strictly for testing. @internal */\r\n public get viewAttachmentProps(): Array<Readonly<ViewAttachmentProps>> {\r\n return this._attachmentsInfo.viewAttachmentProps;\r\n }\r\n\r\n /** Strictly for testing. @internal */\r\n public get attachments(): Object[] | undefined {\r\n return this._attachments?.attachments;\r\n }\r\n\r\n /** @internal */\r\n public override isDrawingView(): this is DrawingViewState { return false; }\r\n /** @internal */\r\n public override isSheetView(): this is SheetViewState { return true; }\r\n\r\n public constructor(props: ViewDefinition2dProps, iModel: IModelConnection, categories: CategorySelectorState, displayStyle: DisplayStyle2dState, sheetProps: SheetProps, attachments: Id64Array) {\r\n super(props, iModel, categories, displayStyle);\r\n if (categories instanceof SheetViewState) {\r\n // we are coming from clone...\r\n this.sheetSize = categories.sheetSize.clone();\r\n this._attachmentsInfo = categories._attachmentsInfo.clone();\r\n this._viewedExtents = categories._viewedExtents.clone();\r\n } else {\r\n this.sheetSize = Point2d.create(sheetProps.width, sheetProps.height);\r\n this._attachmentsInfo = ViewAttachmentsInfo.fromJSON(attachments);\r\n\r\n const extents = new Range3d(0, 0, 0, this.sheetSize.x, this.sheetSize.y, 0);\r\n const margin = 1.1;\r\n extents.scaleAboutCenterInPlace(margin);\r\n this._viewedExtents = extents;\r\n }\r\n }\r\n\r\n public override getOrigin() {\r\n const origin = super.getOrigin();\r\n if (this._attachments)\r\n origin.z = -this._attachments.maxDepth;\r\n\r\n return origin;\r\n }\r\n\r\n public override getExtents() {\r\n const extents = super.getExtents();\r\n if (this._attachments)\r\n extents.z = this._attachments.maxDepth + Frustum2d.minimumZDistance;\r\n\r\n return extents;\r\n }\r\n\r\n /** Disclose *all* TileTrees currently in use by this view. This set may include trees not reported by [[forEachTileTreeRef]] - e.g., those used by view attachments, map-draped terrain, etc.\r\n * @internal override\r\n */\r\n public override discloseTileTrees(trees: DisclosedTileTreeSet): void {\r\n super.discloseTileTrees(trees);\r\n if (this._attachments)\r\n trees.disclose(this._attachments);\r\n }\r\n\r\n /** @internal */\r\n public override collectNonTileTreeStatistics(stats: RenderMemory.Statistics): void {\r\n super.collectNonTileTreeStatistics(stats);\r\n if (this._attachments)\r\n this._attachments.collectStatistics(stats);\r\n }\r\n\r\n /** @internal */\r\n public override get defaultExtentLimits() {\r\n return { min: Constant.oneMillimeter, max: this.sheetSize.magnitude() * 10 };\r\n }\r\n\r\n /** @internal */\r\n public override getViewedExtents(): AxisAlignedBox3d {\r\n return this._viewedExtents;\r\n }\r\n\r\n /** Load the size and attachment for this sheet, as well as any other 2d view state characteristics.\r\n * @internal override\r\n */\r\n public override async load(): Promise<void> {\r\n await super.load();\r\n await this._attachmentsInfo.load(this.iModel);\r\n }\r\n\r\n /** @internal */\r\n public override createScene(context: SceneContext): void {\r\n super.createScene(context);\r\n if (this._attachments)\r\n this._attachments.addToScene(context);\r\n }\r\n\r\n /** @internal */\r\n public override get secondaryViewports(): Iterable<Viewport> {\r\n const attachments = this._attachments;\r\n if (!attachments)\r\n return super.secondaryViewports;\r\n\r\n function* iterator() {\r\n for (const attachment of attachments!) {\r\n const vp = attachment.viewport;\r\n if (vp)\r\n yield vp;\r\n }\r\n }\r\n\r\n return {\r\n [Symbol.iterator]: () => iterator(),\r\n };\r\n }\r\n\r\n /** @internal */\r\n private async queryAttachmentIds(): Promise<Id64Array> {\r\n const ecsql = `SELECT ECInstanceId as attachmentId FROM bis.ViewAttachment WHERE model.Id=${this.baseModelId}`;\r\n const ids: string[] = [];\r\n for await (const row of this.iModel.query(ecsql))\r\n ids.push(row[0]);\r\n\r\n return ids;\r\n }\r\n\r\n /** @internal */\r\n public override async changeViewedModel(modelId: Id64String): Promise<void> {\r\n await super.changeViewedModel(modelId);\r\n const attachmentIds = await this.queryAttachmentIds();\r\n this._attachmentsInfo = ViewAttachmentsInfo.fromJSON(attachmentIds);\r\n\r\n assert(undefined === this._attachments);\r\n }\r\n\r\n /** @internal */\r\n public override attachToViewport(args: AttachToViewportArgs): void {\r\n super.attachToViewport(args);\r\n assert(undefined === this._attachments);\r\n this._attachments = this._attachmentsInfo.createAttachments(this);\r\n }\r\n\r\n /** @internal */\r\n public override detachFromViewport(): void {\r\n super.detachFromViewport();\r\n this._attachments = dispose(this._attachments);\r\n }\r\n\r\n /** @internal */\r\n public override get areAllTileTreesLoaded(): boolean {\r\n return super.areAllTileTreesLoaded && (!this._attachments || this._attachments.areAllTileTreesLoaded);\r\n }\r\n\r\n /** Create a sheet border decoration graphic. */\r\n private createBorder(width: number, height: number, context: DecorateContext): RenderGraphic {\r\n const border = SheetBorder.create(width, height, context);\r\n const builder = context.createGraphicBuilder(GraphicType.ViewBackground);\r\n border.addToBuilder(builder);\r\n return builder.finish();\r\n }\r\n\r\n /** @internal */\r\n public override decorate(context: DecorateContext): void {\r\n super.decorate(context);\r\n if (this.sheetSize !== undefined) {\r\n const border = this.createBorder(this.sheetSize.x, this.sheetSize.y, context);\r\n context.setViewBackground(border);\r\n }\r\n }\r\n\r\n /** @internal */\r\n public override computeFitRange(): Range3d {\r\n const size = this.sheetSize;\r\n if (0 >= size.x || 0 >= size.y)\r\n return super.computeFitRange();\r\n return new Range3d(0, 0, -1, size.x, size.y, 1);\r\n }\r\n}\r\n\r\n/** A mostly no-op RenderTarget for an Attachment.\r\n * its Scene and symbology overrides.\r\n */\r\nclass AttachmentTarget extends MockRender.OffScreenTarget {\r\n private readonly _attachment: OrthographicAttachment;\r\n\r\n public constructor(attachment: OrthographicAttachment) {\r\n // The dimensions don't matter - we're not drawing anything.\r\n const rect = new ViewRect(1, 1);\r\n super(IModelApp.renderSystem, rect);\r\n this._attachment = attachment;\r\n }\r\n\r\n public override changeScene(scene: Scene): void {\r\n this._attachment.scene = scene;\r\n }\r\n\r\n public override overrideFeatureSymbology(ovrs: FeatureSymbology.Overrides): void {\r\n this._attachment.symbologyOverrides = ovrs;\r\n }\r\n}\r\n\r\n/** Draws the contents of a view attachment into a sheet view. */\r\ninterface Attachment {\r\n readonly areAllTileTreesLoaded: boolean;\r\n addToScene: (context: SceneContext) => void;\r\n discloseTileTrees: (trees: DisclosedTileTreeSet) => void;\r\n readonly zDepth: number;\r\n collectStatistics: (stats: RenderMemory.Statistics) => void;\r\n viewAttachmentProps: ViewAttachmentProps;\r\n dispose(): void;\r\n readonly viewport?: Viewport;\r\n}\r\n\r\n/** Draws the contents a 2d or orthographic 3d view directly into a sheet view.\r\n * We select tiles for the view in the context of a light-weight offscreen viewport with a no-op RenderTarget, then\r\n * collect the resultant graphics and add them to the sheet view's scene.\r\n */\r\nclass OrthographicAttachment {\r\n private readonly _viewport: OffScreenViewport;\r\n private readonly _props: ViewAttachmentProps;\r\n private readonly _sheetModelId: Id64String;\r\n private readonly _viewFlagOverrides: ViewFlagOverrides;\r\n private readonly _toSheet: Transform;\r\n private readonly _fromSheet: Transform;\r\n private readonly _sizeInMeters: Point2d;\r\n private readonly _range: Range3d;\r\n private readonly _viewRect = new ViewRect(0, 0, 1, 1);\r\n private readonly _originalFrustum = new Frustum();\r\n private readonly _clipVolume?: RenderClipVolume;\r\n private readonly _hiddenLineSettings?: HiddenLine.Settings;\r\n private readonly _scale: { x: number, y: number };\r\n private _debugFeatureTable?: PackedFeatureTable;\r\n public scene?: Scene;\r\n public symbologyOverrides: FeatureSymbology.Overrides;\r\n public readonly zDepth: number;\r\n\r\n public get view(): ViewState {\r\n return this._viewport.view;\r\n }\r\n\r\n public get viewAttachmentProps() {\r\n return this._props;\r\n }\r\n\r\n public get viewport(): Viewport {\r\n return this._viewport;\r\n }\r\n\r\n public constructor(view: ViewState, props: ViewAttachmentProps, sheetView: SheetViewState) {\r\n this.symbologyOverrides = new FeatureSymbology.Overrides(view);\r\n const target = new AttachmentTarget(this);\r\n this._viewport = OffScreenViewport.createViewport(view, target, true);\r\n\r\n this._props = props;\r\n this._sheetModelId = sheetView.baseModelId;\r\n\r\n const applyClip = true; // set to false for debugging\r\n this._viewFlagOverrides = {\r\n ...view.viewFlags,\r\n clipVolume: applyClip,\r\n lighting: false,\r\n shadows: false,\r\n };\r\n\r\n const placement = Placement2d.fromJSON(props.placement);\r\n const range = placement.calculateRange();\r\n this._range = range;\r\n this._sizeInMeters = new Point2d(range.xLength(), range.yLength());\r\n\r\n // Compute transform from attached view's world coordinates to sheet's world coordinates.\r\n // NB: We obtain the extents and origin from the *viewport* not the *view* - they may have been adjusted by the viewport.\r\n const applySkew = true; // set to false for debugging\r\n const skew = applySkew ? view.getAspectRatioSkew() : 1;\r\n const extents = this._viewport.viewingSpace.viewDelta.clone();\r\n const zDepth = Math.abs(extents.z);\r\n const scaleX = this._sizeInMeters.x / Math.abs(extents.x);\r\n const scaleY = skew * this._sizeInMeters.y / Math.abs(extents.y);\r\n this._scale = { x: 1 / scaleX, y: 1 / scaleY };\r\n\r\n const zBias = Frustum2d.depthFromDisplayPriority(props.jsonProperties?.displayPriority ?? 0);\r\n this.zDepth = 1.01 * (zDepth - zBias); // give a little padding so that geometry right up against far plane doesn't get clipped.\r\n\r\n // View origin is at the *back* of the view. Align *front* of view based on display priority.\r\n const viewRot = view.getRotation();\r\n const viewOrg = viewRot.multiplyVector(this._viewport.viewingSpace.viewOrigin);\r\n viewOrg.z += zDepth;\r\n viewRot.multiplyTransposeVectorInPlace(viewOrg);\r\n\r\n const matrix = Matrix3d.createScale(scaleX, scaleY, 1);\r\n matrix.multiplyMatrixMatrix(viewRot, matrix);\r\n const origin = Matrix3d.xyzMinusMatrixTimesXYZ(viewOrg, matrix, viewOrg);\r\n const attachmentOrigin = Point3d.createFrom(placement.origin);\r\n attachmentOrigin.z = zBias;\r\n const viewOrgToAttachment = attachmentOrigin.minus(viewOrg);\r\n origin.addInPlace(viewOrgToAttachment);\r\n this._toSheet = Transform.createRefs(origin, matrix);\r\n this._fromSheet = this._toSheet.inverse()!;\r\n\r\n // If the attached view is a section drawing, it may itself have an attached spatial view with a clip.\r\n // The clip needs to be transformed into sheet space.\r\n if (view.isDrawingView())\r\n this._viewport.drawingToSheetTransform = this._toSheet;\r\n\r\n // ###TODO? If we also apply the attachment's clip to the attached view, we may get additional culling during tile selection.\r\n // However the attached view's frustum is already clipped by intersection with sheet view's frustum, and additional clipping planes\r\n // introduce additional computation, so possibly not worth it.\r\n\r\n // Transform the view's clip (if any) to sheet space\r\n let viewClip = view.viewFlags.clipVolume ? view.getViewClip()?.clone() : undefined;\r\n if (viewClip)\r\n viewClip.transformInPlace(this._toSheet);\r\n else\r\n viewClip = ClipVector.createEmpty();\r\n\r\n let sheetClip;\r\n if (undefined !== props.jsonProperties?.clip)\r\n sheetClip = ClipVector.fromJSON(props.jsonProperties?.clip);\r\n\r\n if (sheetClip && sheetClip.isValid) {\r\n // Clip to view attachment's clip. NB: clip is in sheet coordinate space.\r\n for (const clip of sheetClip.clips)\r\n viewClip.clips.push(clip);\r\n } else {\r\n // Clip to view attachment's bounding box\r\n viewClip.appendShape([\r\n Point3d.create(this._range.low.x, this._range.low.y),\r\n Point3d.create(this._range.high.x, this._range.low.y),\r\n Point3d.create(this._range.high.x, this._range.high.y),\r\n Point3d.create(this._range.low.x, this._range.high.y),\r\n ]);\r\n }\r\n\r\n this._clipVolume = IModelApp.renderSystem.createClipVolume(viewClip);\r\n\r\n // Save off the original frustum (potentially adjusted by viewport).\r\n this._viewport.setupFromView();\r\n this._viewport.viewingSpace.getFrustum(CoordSystem.World, true, this._originalFrustum);\r\n\r\n const applyHiddenLineSettings = true; // for debugging edge display, set to false...\r\n const style = view.displayStyle;\r\n if (style.is3d() && applyHiddenLineSettings)\r\n this._hiddenLineSettings = style.settings.hiddenLineSettings;\r\n }\r\n\r\n public dispose(): void {\r\n this._viewport.dispose();\r\n }\r\n\r\n public discloseTileTrees(trees: DisclosedTileTreeSet): void {\r\n trees.disclose(this._viewport);\r\n }\r\n\r\n public addToScene(context: SceneContext): void {\r\n if (context.viewport.freezeScene)\r\n return;\r\n\r\n if (!context.viewport.view.viewsCategory(this._props.category))\r\n return;\r\n\r\n const wantBounds = context.viewport.wantViewAttachmentBoundaries;\r\n const wantClipShapes = context.viewport.wantViewAttachmentClipShapes;\r\n if (wantBounds || wantClipShapes) {\r\n const builder = context.createSceneGraphicBuilder();\r\n if (wantBounds) {\r\n builder.setSymbology(ColorDef.red, ColorDef.red, 2);\r\n builder.addRangeBox(this._range);\r\n }\r\n\r\n if (wantClipShapes && this._clipVolume) {\r\n builder.setSymbology(ColorDef.blue, ColorDef.blue, 2);\r\n for (const prim of this._clipVolume.clipVector.clips) {\r\n if (!(prim instanceof ClipShape))\r\n continue; // ###TODO handle non-shape primitives, if any such ever encountered\r\n\r\n const pts = [];\r\n const tf = prim.transformFromClip;\r\n for (const pt of prim.polygon) {\r\n const tfPt = tf ? tf.multiplyPoint3d(pt) : pt;\r\n pts.push(new Point2d(tfPt.x, tfPt.y));\r\n }\r\n\r\n builder.addLineString2d(pts, 0);\r\n }\r\n }\r\n\r\n // Put into a Batch so that we can see tooltip with attachment Id on mouseover.\r\n const batch = context.target.renderSystem.createBatch(builder.finish(), this.getDebugFeatureTable(), this._range);\r\n context.outputGraphic(batch);\r\n }\r\n\r\n if (!context.viewport.wantViewAttachments)\r\n return;\r\n\r\n // Pixel size used to compute size of ViewRect so that tiles of appropriate LOD are selected.\r\n const pixelSize = context.viewport.getPixelSizeAtPoint();\r\n if (0 === pixelSize)\r\n return;\r\n\r\n // Adjust attached view frustum based on intersection with sheet view frustum.\r\n const attachFrustum = this._originalFrustum.transformBy(this._toSheet);\r\n const attachFrustumRange = attachFrustum.toRange();\r\n const sheetFrustum = context.viewport.getWorldFrustum();\r\n const sheetFrustumRange = sheetFrustum.toRange();\r\n const intersect = attachFrustumRange.intersect(sheetFrustumRange);\r\n if (intersect.isNull)\r\n return;\r\n\r\n attachFrustum.initFromRange(intersect);\r\n attachFrustum.transformBy(this._fromSheet, attachFrustum);\r\n this._viewport.setupViewFromFrustum(attachFrustum);\r\n\r\n // Adjust view rect based on size of attachment on screen so that tiles of appropriate LOD are selected.\r\n const width = this._sizeInMeters.x * intersect.xLength() / attachFrustumRange.xLength();\r\n const height = this._sizeInMeters.y * intersect.yLength() / attachFrustumRange.yLength();\r\n this._viewRect.width = Math.max(1, Math.round(width / pixelSize));\r\n this._viewRect.height = Math.max(1, Math.round(height / pixelSize));\r\n this._viewport.setRect(this._viewRect);\r\n\r\n // Propagate settings from on-screen viewport.\r\n this._viewport.debugBoundingBoxes = context.viewport.debugBoundingBoxes;\r\n this._viewport.setTileSizeModifier(context.viewport.tileSizeModifier);\r\n\r\n // Create the scene.\r\n this._viewport.renderFrame();\r\n\r\n const scene = this.scene;\r\n if (!scene)\r\n return;\r\n\r\n // Extract scene graphics and insert into on-screen scene context.\r\n const options = {\r\n clipVolume: this._clipVolume,\r\n hline: this._hiddenLineSettings,\r\n frustum: {\r\n is3d: this.view.is3d(),\r\n scale: this._scale,\r\n },\r\n };\r\n\r\n const outputGraphics = (source: RenderGraphic[]) => {\r\n if (0 === source.length)\r\n return;\r\n\r\n const graphics = new GraphicBranch();\r\n graphics.setViewFlagOverrides(this._viewFlagOverrides);\r\n graphics.symbologyOverrides = this.symbologyOverrides;\r\n\r\n for (const graphic of source)\r\n graphics.entries.push(graphic);\r\n\r\n const branch = context.createGraphicBranch(graphics, this._toSheet, options);\r\n context.outputGraphic(branch);\r\n };\r\n\r\n outputGraphics(scene.foreground);\r\n context.withGraphicType(TileGraphicType.BackgroundMap, () => outputGraphics(scene.background));\r\n context.withGraphicType(TileGraphicType.Overlay, () => outputGraphics(scene.overlay));\r\n\r\n // Report tile statistics to sheet view's viewport.\r\n const tileAdmin = IModelApp.tileAdmin;\r\n const selectedAndReady = tileAdmin.getTilesForUser(this._viewport);\r\n const requested = tileAdmin.getRequestsForUser(this._viewport);\r\n tileAdmin.addExternalTilesForUser(context.viewport, {\r\n requested: requested?.size ?? 0,\r\n selected: selectedAndReady?.selected.size ?? 0,\r\n ready: selectedAndReady?.ready.size ?? 0,\r\n });\r\n }\r\n\r\n private getDebugFeatureTable(): PackedFeatureTable {\r\n if (this._debugFeatureTable)\r\n return this._debugFeatureTable;\r\n\r\n const featureTable = new FeatureTable(1, this._sheetModelId);\r\n featureTable.insert(new Feature(this._props.id));\r\n this._debugFeatureTable = PackedFeatureTable.pack(featureTable);\r\n return this._debugFeatureTable;\r\n }\r\n\r\n public get areAllTileTreesLoaded(): boolean {\r\n return this.view.areAllTileTreesLoaded;\r\n }\r\n\r\n public collectStatistics(_stats: RenderMemory.Statistics): void {\r\n // Handled by discloseTileTrees()\r\n }\r\n}\r\n\r\nfunction createRasterAttachmentViewport(_view: ViewState, _rect: ViewRect, _attachment: RasterAttachment): OffScreenViewport {\r\n class RasterAttachmentViewport extends OffScreenViewport {\r\n private _sceneContext?: SceneContext;\r\n private _isSceneReady = false;\r\n private readonly _attachment: RasterAttachment;\r\n\r\n public constructor(view: ViewState, rect: ViewRect, attachment: RasterAttachment) {\r\n super(IModelApp.renderSystem.createOffscreenTarget(rect));\r\n this._attachment = attachment;\r\n this._isAspectRatioLocked = true;\r\n this.changeView(view);\r\n }\r\n\r\n public override createSceneContext(): SceneContext {\r\n assert(!this._isSceneReady);\r\n\r\n this._sceneContext = super.createSceneContext();\r\n return this._sceneContext;\r\n }\r\n\r\n public override renderFrame(): void {\r\n assert(!this._isSceneReady);\r\n\r\n this.clearSceneContext();\r\n super.renderFrame();\r\n\r\n if (undefined !== this._sceneContext) {\r\n this._isSceneReady = !this._sceneContext.hasMissingTiles && this.view.areAllTileTreesLoaded;\r\n if (this._isSceneReady)\r\n this._attachment.produceGraphics(this._sceneContext);\r\n\r\n this._sceneContext = undefined;\r\n }\r\n }\r\n\r\n private clearSceneContext(): void {\r\n this._sceneContext = undefined;\r\n }\r\n\r\n public override addDecorations(_decorations: Decorations): void {\r\n // ###TODO: skybox, ground plane, possibly grid. DecorateContext requires a ScreenViewport...\r\n }\r\n }\r\n\r\n return new RasterAttachmentViewport(_view, _rect, _attachment);\r\n}\r\n\r\n/** Draws a 3d view with camera enabled into a sheet view by producing an image of the view's contents offscreen. */\r\nclass RasterAttachment {\r\n private readonly _props: ViewAttachmentProps;\r\n private readonly _placement: Placement2d;\r\n private readonly _transform: Transform;\r\n public readonly zDepth: number;\r\n private _viewport?: OffScreenViewport;\r\n private _graphics?: RenderGraphic;\r\n\r\n public constructor(view: ViewState, props: ViewAttachmentProps, sheetView: SheetViewState) {\r\n // Render to a 2048x2048 view rect. Scale in Y to preserve aspect ratio.\r\n const maxSize = 2048;\r\n const rect = new ViewRect(0, 0, maxSize, maxSize);\r\n const height = maxSize * view.getAspectRatio() * view.getAspectRatioSkew();\r\n const skew = maxSize / height;\r\n view.setAspectRatioSkew(skew);\r\n\r\n if (true !== props.jsonProperties?.displayOptions?.preserveBackground) {\r\n // Make background color 100% transparent so that Viewport.readImageBuffer() will discard transparent pixels.\r\n const bgColor = sheetView.displayStyle.backgroundColor.withAlpha(0);\r\n view.displayStyle.backgroundColor = bgColor;\r\n }\r\n\r\n this._viewport = createRasterAttachmentViewport(view, rect, this);\r\n this._props = props;\r\n this._placement = Placement2d.fromJSON(props.placement);\r\n this._transform = this._placement.transform;\r\n this.zDepth = Frustum2d.depthFromDisplayPriority(props.jsonProperties?.displayPriority ?? 0);\r\n }\r\n\r\n public dispose(): void {\r\n this._viewport?.dispose();\r\n }\r\n\r\n public get viewAttachmentProps() {\r\n return this._props;\r\n }\r\n\r\n public get viewport(): Viewport | undefined {\r\n return this._viewport;\r\n }\r\n\r\n public get areAllTileTreesLoaded() {\r\n return this._viewport?.areAllTileTreesLoaded ?? true;\r\n }\r\n\r\n public addToScene(context: SceneContext): void {\r\n // ###TODO: check viewport.wantViewAttachmentClipShapes\r\n if (!context.viewport.view.viewsCategory(this._props.category))\r\n return;\r\n\r\n if (context.viewport.wantViewAttachmentBoundaries) {\r\n const builder = context.createSceneGraphicBuilder(this._transform);\r\n builder.setSymbology(ColorDef.red, ColorDef.red, 2);\r\n builder.addRangeBox(Range3d.createRange2d(this._placement.bbox));\r\n context.outputGraphic(builder.finish());\r\n }\r\n\r\n if (!context.viewport.wantViewAttachments)\r\n return;\r\n\r\n if (this._graphics) {\r\n context.outputGraphic(this._graphics);\r\n return;\r\n }\r\n\r\n if (undefined === this._viewport)\r\n return;\r\n\r\n this._viewport.debugBoundingBoxes = context.viewport.debugBoundingBoxes;\r\n this._viewport.setTileSizeModifier(context.viewport.tileSizeModifier);\r\n\r\n this._viewport.renderFrame();\r\n if (this._graphics)\r\n context.outputGraphic(this._graphics);\r\n }\r\n\r\n public discloseTileTrees(trees: DisclosedTileTreeSet) {\r\n if (this._viewport)\r\n trees.disclose(this._viewport);\r\n }\r\n\r\n public produceGraphics(context: SceneContext): void {\r\n assert(context.viewport === this._viewport);\r\n this._graphics = this.createGraphics(this._viewport);\r\n this._viewport = dispose(this._viewport);\r\n\r\n if (undefined !== this._graphics)\r\n context.outputGraphic(this._graphics);\r\n }\r\n\r\n private createGraphics(vp: Viewport): RenderGraphic | undefined {\r\n // Create a texture from the contents of the view.\r\n const image = vp.readImageBuffer({ upsideDown: true });\r\n if (undefined === image)\r\n return undefined;\r\n\r\n const debugImage = false; // set to true to open a window displaying the captured image.\r\n if (debugImage) {\r\n const url = imageBufferToPngDataUrl(image, false);\r\n if (url)\r\n openImageDataUrlInNewWindow(url, \"Attachment\");\r\n }\r\n\r\n const texture = IModelApp.renderSystem.createTexture({\r\n image: { source: image, transparency: TextureTransparency.Opaque },\r\n });\r\n if (!texture)\r\n return undefined;\r\n\r\n // Create a material for the texture\r\n const graphicParams = new GraphicParams();\r\n graphicParams.material = IModelApp.renderSystem.createRenderMaterial({ textureMapping: { texture } });\r\n\r\n // Apply the texture to a rectangular polyface.\r\n const depth = this.zDepth;\r\n const east = this._placement.bbox.low.x;\r\n const west = this._placement.bbox.high.x;\r\n const north = this._placement.bbox.low.y;\r\n const south = this._placement.bbox.high.y;\r\n const corners = [\r\n Point3d.create(east, north, depth),\r\n Point3d.create(west, north, depth),\r\n Point3d.create(west, south, depth),\r\n Point3d.create(east, south, depth),\r\n ];\r\n const params = [\r\n Point2d.create(0, 0),\r\n Point2d.create(1, 0),\r\n Point2d.create(1, 1),\r\n Point2d.create(0, 1),\r\n ];\r\n\r\n const strokeOptions = new StrokeOptions();\r\n strokeOptions.needParams = strokeOptions.shouldTriangulate = true;\r\n const polyfaceBuilder = PolyfaceBuilder.create(strokeOptions);\r\n polyfaceBuilder.addQuadFacet(corners, params);\r\n const polyface = polyfaceBuilder.claimPolyface();\r\n\r\n const graphicBuilder = IModelApp.renderSystem.createGraphicBuilder(Transform.createIdentity(), GraphicType.Scene, vp, this._props.id);\r\n graphicBuilder.activateGraphicParams(graphicParams);\r\n graphicBuilder.addPolyface(polyface, false);\r\n const graphic = graphicBuilder.finish();\r\n\r\n // Wrap the polyface in a GraphicBranch.\r\n const branch = new GraphicBranch(true);\r\n const vfOvrs = createDefaultViewFlagOverrides({ clipVolume: true, shadows: false, lighting: false, thematic: false });\r\n\r\n // Disable transparency - background pixels are 100% transparent so they will be discarded anyway. Other pixels are 100% opaque.\r\n vfOvrs.transparency = false;\r\n branch.setViewFlagOverrides(vfOvrs);\r\n branch.symbologyOverrides = new FeatureSymbology.Overrides();\r\n branch.entries.push(graphic);\r\n\r\n // Apply the attachment's clip, if any.\r\n let clipVolume;\r\n if (this._props.jsonProperties?.clip) {\r\n const clipVector = ClipVector.fromJSON(this._props.jsonProperties?.clip);\r\n if (clipVector.isValid)\r\n clipVolume = IModelApp.renderSystem.createClipVolume(clipVector);\r\n }\r\n\r\n return IModelApp.renderSystem.createGraphicBranch(branch, this._transform, { clipVolume });\r\n }\r\n\r\n public collectStatistics(stats: RenderMemory.Statistics): void {\r\n if (this._graphics)\r\n this._graphics.collectStatistics(stats);\r\n }\r\n}\r\n"]}
@@ -91,7 +91,15 @@ export interface LookAtUsingLensAngle extends LookAtArgs {
91
91
  * @internal
92
92
  */
93
93
  export interface AttachToViewportArgs {
94
+ /** A function that can be invoked to notify the viewport that its decorations should be recreated. */
94
95
  invalidateDecorations: () => void;
96
+ /** A bit of a hack to work around our ill-advised decision to always expect a RenderClipVolume to be defined in world coordinates.
97
+ * When we attach a section drawing to a sheet view, and the section drawing has a spatial view attached to *it*, the spatial view's clip
98
+ * is transformed into drawing space - but when we display it we need to transform it into world (sheet) coordinates.
99
+ * Fixing the actual problem (clips should always be defined in the coordinate space of the graphic branch containing them) would be quite error-prone
100
+ * and likely to break existing code -- so instead the SheetViewState specifies this transform to be consumed by DrawingViewState.attachToViewport.
101
+ */
102
+ drawingToSheetTransform?: Transform;
95
103
  }
96
104
  /** The front-end state of a [[ViewDefinition]] element.
97
105
  * A ViewState is typically associated with a [[Viewport]] to display the contents of the view on the screen. A ViewState being displayed by a Viewport is considered to be