@itwin/hypermodeling-frontend 5.0.0-dev.40 → 5.0.0-dev.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,16 @@
1
1
  # Change Log - @itwin/hypermodeling-frontend
2
2
 
3
- This log was last generated on Mon, 13 Jan 2025 14:09:29 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 24 Jan 2025 08:05:17 GMT and should not be manually modified.
4
+
5
+ ## 4.10.6
6
+ Fri, 24 Jan 2025 08:02:40 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 4.10.5
11
+ Tue, 21 Jan 2025 21:56:45 GMT
12
+
13
+ _Version update only_
4
14
 
5
15
  ## 4.10.4
6
16
  Mon, 13 Jan 2025 14:06:43 GMT
@@ -177,7 +177,7 @@ class HyperModeling {
177
177
  return this._start(viewport);
178
178
  }
179
179
  else {
180
- decorator?.dispose();
180
+ decorator?.[Symbol.dispose]();
181
181
  return undefined;
182
182
  }
183
183
  }
@@ -212,7 +212,7 @@ class HyperModeling {
212
212
  */
213
213
  static stop(viewport) {
214
214
  const decorator = HyperModelingDecorator_1.HyperModelingDecorator.getForViewport(viewport);
215
- decorator?.dispose();
215
+ decorator?.[Symbol.dispose]();
216
216
  }
217
217
  /** @internal */
218
218
  static get namespace() {
@@ -1 +1 @@
1
- {"version":3,"file":"HyperModeling.js","sourceRoot":"","sources":["../../src/HyperModeling.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAC7C,oDAAiD;AACjD,wDAAsH;AACtH,mCAAwC;AACxC,qEAAkE;AAElE,iEAA8D;AA0B9D,SAAS,iBAAiB,CAAC,KAAuB;IAChD,IAAI,SAAS,KAAK,KAAK,CAAC,SAAS;QAC/B,MAAM,IAAI,KAAK,CAAC,+EAA+E,CAAC,CAAC;AACrG,CAAC;AAED;;;;;GAKG;AACH,MAAa,aAAa;aA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gBACnB,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC;YACrC,KAAK,yBAAW,CAAC,SAAS;gBACxB,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC;YAC1C,KAAK,yBAAW,CAAC,MAAM;gBACrB,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC;YACvC;gBACE,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC;QAC1C,CAAC;IACH,CAAC;;AAhPH,sCAiPC","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 HyperModeling\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { SectionType } from \"@itwin/core-common\";\r\nimport { IModelApp, IModelConnection, ScreenViewport, tryImageElementFromUrl, ViewManip } from \"@itwin/core-frontend\";\r\nimport { registerTools } from \"./Tools\";\r\nimport { HyperModelingDecorator } from \"./HyperModelingDecorator\";\r\nimport { HyperModelingConfig, SectionGraphicsConfig, SectionMarkerConfig } from \"./HyperModelingConfig\";\r\nimport { SectionMarkerHandler } from \"./SectionMarkerHandler\";\r\n\r\n/** @internal */\r\nexport interface MarkerData {\r\n readonly label: string;\r\n readonly image: HTMLImageElement | undefined;\r\n}\r\n\r\ninterface Resources {\r\n readonly namespace?: string;\r\n readonly markers: {\r\n readonly section: MarkerData;\r\n readonly plan: MarkerData;\r\n readonly elevation: MarkerData;\r\n readonly detail: MarkerData;\r\n };\r\n}\r\n\r\ninterface MaybeInitialized {\r\n resources?: Resources;\r\n}\r\n\r\ninterface Initialized {\r\n resources: Resources;\r\n}\r\n\r\nfunction assertInitialized(maybe: MaybeInitialized): asserts maybe is Initialized {\r\n if (undefined === maybe.resources)\r\n throw new Error(\"You must call HyperModeling.initialize before using the hypermodeling package\");\r\n}\r\n\r\n/** The API entry point for the hypermodeling package. Applications must call [[initialize]] and await the result before using the package.\r\n * The behavior of the package can be customized via a [[HyperModelingConfig]] supplied to [[initialize]], [[updateConfiguration]], or [[replaceConfiguration]].\r\n * Hypermodeling mode can be enabled or disabled via [[startOrStop]], which returns a [[HyperModelingDecorator]] when enabling hypermodeling.\r\n * Consult the package's `README.md` for a description of the available functionality.\r\n * @public\r\n */\r\nexport class HyperModeling {\r\n /** @internal */\r\n public static resources?: Resources;\r\n private static _markerHandler?: SectionMarkerHandler;\r\n private static _markerConfig: SectionMarkerConfig = {};\r\n private static _graphicsConfig: SectionGraphicsConfig = {};\r\n\r\n private static shutdown() {\r\n this.resources = undefined;\r\n this._markerHandler = undefined;\r\n this._markerConfig = {};\r\n this._graphicsConfig = {};\r\n }\r\n\r\n /** Returns whether the hypermodeling package is initialized.\r\n * @see [[HyperModeling.initialize]] to initialize the package.\r\n */\r\n public static get isInitialized(): boolean {\r\n return undefined !== this.resources;\r\n }\r\n\r\n /** Invoke this method to initialize the hypermodeling package for use. You *must* await the result before using any of this package's APIs.\r\n * Typically an application would invoke this after [IModelApp.startup]($frontend), e.g.,\r\n * ```ts\r\n * await IModelApp.startup();\r\n * await HyperModeling.initialize();\r\n * ```\r\n * Calling this method again after the first initialization behaves the same as calling [[HyperModeling.replaceConfiguration]].\r\n * @note The hypermodeling package will be reset to uninitialized after [IModelApp.shutdown]($frontend) is invoked.\r\n * @see [[replaceConfiguration]] and [[updateConfiguration]] to modify the configuration after initialization.\r\n */\r\n public static async initialize(config?: HyperModelingConfig): Promise<void> {\r\n if (undefined !== this.resources) {\r\n this.replaceConfiguration(config);\r\n return;\r\n }\r\n\r\n // clean up if we're being shut down\r\n IModelApp.onBeforeShutdown.addListener(() => this.shutdown());\r\n\r\n const namespace = \"HyperModeling\";\r\n await IModelApp.localization.registerNamespace(namespace);\r\n\r\n const loadImages = [\r\n tryImageElementFromUrl(`${IModelApp.publicPath}section-marker.svg`),\r\n tryImageElementFromUrl(`${IModelApp.publicPath}detail-marker.svg`),\r\n tryImageElementFromUrl(`${IModelApp.publicPath}elevation-marker.svg`),\r\n tryImageElementFromUrl(`${IModelApp.publicPath}plan-marker.svg`),\r\n ];\r\n\r\n const images = await Promise.all(loadImages);\r\n this.resources = {\r\n namespace,\r\n markers: {\r\n section: { image: images[0], label: IModelApp.localization.getLocalizedString(\"HyperModeling:Message.SectionCallout\") },\r\n detail: { image: images[1], label: IModelApp.localization.getLocalizedString(\"HyperModeling:Message.DetailCallout\") },\r\n elevation: { image: images[2], label: IModelApp.localization.getLocalizedString(\"HyperModeling:Message.ElevationCallout\") },\r\n plan: { image: images[3], label: IModelApp.localization.getLocalizedString(\"HyperModeling:Message.PlanCallout\") },\r\n },\r\n };\r\n\r\n registerTools(namespace);\r\n this.replaceConfiguration(config);\r\n }\r\n\r\n private static async ensureInitialized(): Promise<void> {\r\n if (undefined === this.resources)\r\n await this.initialize();\r\n\r\n assertInitialized(this);\r\n }\r\n\r\n /** Replaces the current package configuration, overwriting all previous settings. Passing `undefined` resets all settings to defaults.\r\n * @see [[HyperModeling.updateConfiguration]] for overriding specific aspects of the configuration.\r\n */\r\n public static replaceConfiguration(config?: HyperModelingConfig): void {\r\n config = config ?? {};\r\n this._markerHandler = config.markerHandler ?? new SectionMarkerHandler();\r\n this._markerConfig = config.markers ? { ...config.markers } : {};\r\n this._graphicsConfig = config.graphics ? { ...config.graphics } : {};\r\n }\r\n\r\n /** Overrides specific aspects of the current package configuration. Any field that is not `undefined` will be replaced in the current configuration;\r\n * the rest will retain their current values.\r\n * @see [[HyperModeling.replaceConfiguration]].\r\n */\r\n public static updateConfiguration(config: HyperModelingConfig): void {\r\n this._markerHandler = config.markerHandler ?? this._markerHandler;\r\n\r\n if (config.markers) {\r\n this._markerConfig = {\r\n ignoreModelSelector: config.markers.ignoreModelSelector ?? this._markerConfig.ignoreModelSelector,\r\n ignoreCategorySelector: config.markers.ignoreCategorySelector ?? this._markerConfig.ignoreCategorySelector,\r\n hiddenSectionTypes: config.markers.hiddenSectionTypes ?? this._markerConfig.hiddenSectionTypes,\r\n };\r\n }\r\n\r\n if (config.graphics) {\r\n this._graphicsConfig = {\r\n ignoreClip: config.graphics.ignoreClip ?? this._graphicsConfig.ignoreClip,\r\n debugClipVolumes: config.graphics.debugClipVolumes ?? this._graphicsConfig.debugClipVolumes,\r\n hideSectionGraphics: config.graphics.hideSectionGraphics ?? this._graphicsConfig.hideSectionGraphics,\r\n hideSheetAnnotations: config.graphics.hideSheetAnnotations ?? this._graphicsConfig.hideSheetAnnotations,\r\n };\r\n\r\n IModelApp.viewManager.invalidateViewportScenes();\r\n }\r\n }\r\n\r\n /** The handler that defines interactions with [[SectionMarker]]s.\r\n * @see [[initialize]] to override the default handler at package initialization.\r\n * @see [[updateConfiguration]] or [[replaceConfiguration]] to change the current handler.\r\n */\r\n public static get markerHandler(): SectionMarkerHandler {\r\n assertInitialized(this);\r\n assert(undefined !== this._markerHandler);\r\n return this._markerHandler;\r\n }\r\n\r\n /** The current marker display configuration applied to any newly-created [[HyperModelingDecorator]]s.\r\n * @see [[initialize]] to override the default configuration at package initialization.\r\n * @see [[updateConfiguration]] or [[replaceConfiguration]] to change the current configuration.\r\n * @see [[HyperModelingDecorator.replaceConfiguration]] or [[HyperModelingDecorator.updateConfiguration]] to change the configuration for an existing decorator.\r\n */\r\n public static get markerConfig(): SectionMarkerConfig {\r\n return this._markerConfig;\r\n }\r\n\r\n /** This graphics options applied to graphics displayed by all [[HyperModelingDecorator]]s.\r\n * @see [[updateConfiguration]] or [[replaceConfiguration]] to change the current configuration.\r\n */\r\n public static get graphicsConfig(): SectionGraphicsConfig {\r\n return this._graphicsConfig;\r\n }\r\n\r\n /** Returns true if the specified iModel contains any [SectionDrawingLocation]($backend)s. Hypermodeling is based on section drawing locations,\r\n * so if none are present, hypermodeling features are not relevant to the iModel. Attempting to use those features with such an iModel is fine,\r\n * but probably not useful.\r\n */\r\n public static async isSupportedForIModel(imodel: IModelConnection): Promise<boolean> {\r\n try {\r\n const reader = imodel.createQueryReader(\"SELECT ECInstanceId FROM bis.SectionDrawingLocation LIMIT 1\");\r\n return await reader.step(); // i.e., are any results are returned?\r\n } catch {\r\n // An iModel with a version of BisCore older than 1.0.11 will produce an expected \"table not found\" on the SectionDrawingLocation ECClass.\r\n return false;\r\n }\r\n }\r\n\r\n /** Returns whether hypermodeling is currently enabled for the specified viewport.\r\n * @see [[startOrStop]] to enable or disable hypermodeling for a viewport.\r\n */\r\n public static isEnabledForViewport(viewport: ScreenViewport): boolean {\r\n return undefined !== HyperModelingDecorator.getForViewport(viewport);\r\n }\r\n\r\n /** Start or stop hypermodeling mode for the specified viewport.\r\n * Enabling hypermodeling registers and returns a [[HyperModelingDecorator]] to display [[SectionMarker]]s within the viewport.\r\n * Disabling hypermodeling removes that decorator.\r\n * @param viewport The hypermodeling viewport\r\n * @param start `true` to enter hypermodeling mode, `false` to exit, or `undefined` to toggle the current mode.\r\n * @returns The new decorator is hypermodeling was successfully enabled.\r\n * @note Enabling hypermodeling may fail if the viewport is not viewing a spatial model or if the viewport's iModel does not support hypermodeling.\r\n * @see [[start]] and [[stop]].\r\n * @see [[isSupportedForIModel]].\r\n */\r\n public static async startOrStop(viewport: ScreenViewport, start?: boolean): Promise<HyperModelingDecorator | undefined> {\r\n // Help out the caller since we're async anyway...\r\n await this.ensureInitialized();\r\n\r\n const decorator = HyperModelingDecorator.getForViewport(viewport);\r\n if (undefined === start)\r\n start = undefined === decorator;\r\n\r\n if (start) {\r\n return this._start(viewport);\r\n } else {\r\n decorator?.dispose();\r\n return undefined;\r\n }\r\n }\r\n\r\n /** Start hypermodeling mode for the specified viewport if it is not currently enabled.\r\n * If hypermodeling is already enabled for the viewport, the existing decorator is returned; otherwise, a new decorator is created.\r\n * @param viewport The viewport for which to enable hypermodeling\r\n * @returns The decorator that implements hypermodeling features for the viewport, or `undefined` if hypermodeling could not be enabled.\r\n * @note Enabling hypermodeling may fail if the viewport is not viewing a spatial model or if the viewport's iModel does not support hypermodeling.\r\n */\r\n public static async start(viewport: ScreenViewport): Promise<HyperModelingDecorator | undefined> {\r\n await this.ensureInitialized();\r\n return this._start(viewport);\r\n }\r\n\r\n private static async _start(viewport: ScreenViewport): Promise<HyperModelingDecorator | undefined> {\r\n assertInitialized(this);\r\n if (!viewport.view.isSpatialView())\r\n return undefined;\r\n\r\n let decorator = HyperModelingDecorator.getForViewport(viewport);\r\n if (!decorator)\r\n decorator = await HyperModelingDecorator.create(viewport, this._markerConfig);\r\n\r\n if (undefined !== decorator && viewport.view.isCameraOn) {\r\n // We want the 2d graphics to align with the 3d geometry. Perspective ruins that.\r\n viewport.view.turnCameraOff();\r\n ViewManip.fitView(viewport, false, { noSaveInUndo: true });\r\n viewport.clearViewUndo();\r\n }\r\n\r\n return decorator;\r\n }\r\n\r\n /** Stop hypermodeling mode for the specified viewport if it is currently enabled. This disposes of the [[HyperModelingDecorator]] associated with the viewport.\r\n * @see [[start]] to enable hypermodeling for a viewport.\r\n * @see [[startOrStop]] to toggle hypermodeling mode.\r\n */\r\n public static stop(viewport: ScreenViewport): void {\r\n const decorator = HyperModelingDecorator.getForViewport(viewport);\r\n decorator?.dispose();\r\n }\r\n\r\n /** @internal */\r\n public static get namespace(): string | undefined {\r\n assertInitialized(this);\r\n return this.resources.namespace;\r\n }\r\n\r\n /** @internal */\r\n public static getMarkerData(type: SectionType): MarkerData {\r\n assertInitialized(this);\r\n switch (type) {\r\n case SectionType.Plan:\r\n return this.resources.markers.plan;\r\n case SectionType.Elevation:\r\n return this.resources.markers.elevation;\r\n case SectionType.Detail:\r\n return this.resources.markers.detail;\r\n default:\r\n return this.resources.markers.section;\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"HyperModeling.js","sourceRoot":"","sources":["../../src/HyperModeling.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAC7C,oDAAiD;AACjD,wDAAs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IACT,MAAM,KAAK,SAAS;QACzB,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACxB,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;IAClC,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,aAAa,CAAC,IAAiB;QAC3C,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACxB,QAAQ,IAAI,EAAE,CAAC;YACb,KAAK,yBAAW,CAAC,IAAI;gBACnB,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC;YACrC,KAAK,yBAAW,CAAC,SAAS;gBACxB,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC;YAC1C,KAAK,yBAAW,CAAC,MAAM;gBACrB,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC;YACvC;gBACE,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC;QAC1C,CAAC;IACH,CAAC;;AAhPH,sCAiPC","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 HyperModeling\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { SectionType } from \"@itwin/core-common\";\r\nimport { IModelApp, IModelConnection, ScreenViewport, tryImageElementFromUrl, ViewManip } from \"@itwin/core-frontend\";\r\nimport { registerTools } from \"./Tools\";\r\nimport { HyperModelingDecorator } from \"./HyperModelingDecorator\";\r\nimport { HyperModelingConfig, SectionGraphicsConfig, SectionMarkerConfig } from \"./HyperModelingConfig\";\r\nimport { SectionMarkerHandler } from \"./SectionMarkerHandler\";\r\n\r\n/** @internal */\r\nexport interface MarkerData {\r\n readonly label: string;\r\n readonly image: HTMLImageElement | undefined;\r\n}\r\n\r\ninterface Resources {\r\n readonly namespace?: string;\r\n readonly markers: {\r\n readonly section: MarkerData;\r\n readonly plan: MarkerData;\r\n readonly elevation: MarkerData;\r\n readonly detail: MarkerData;\r\n };\r\n}\r\n\r\ninterface MaybeInitialized {\r\n resources?: Resources;\r\n}\r\n\r\ninterface Initialized {\r\n resources: Resources;\r\n}\r\n\r\nfunction assertInitialized(maybe: MaybeInitialized): asserts maybe is Initialized {\r\n if (undefined === maybe.resources)\r\n throw new Error(\"You must call HyperModeling.initialize before using the hypermodeling package\");\r\n}\r\n\r\n/** The API entry point for the hypermodeling package. Applications must call [[initialize]] and await the result before using the package.\r\n * The behavior of the package can be customized via a [[HyperModelingConfig]] supplied to [[initialize]], [[updateConfiguration]], or [[replaceConfiguration]].\r\n * Hypermodeling mode can be enabled or disabled via [[startOrStop]], which returns a [[HyperModelingDecorator]] when enabling hypermodeling.\r\n * Consult the package's `README.md` for a description of the available functionality.\r\n * @public\r\n */\r\nexport class HyperModeling {\r\n /** @internal */\r\n public static resources?: Resources;\r\n private static _markerHandler?: SectionMarkerHandler;\r\n private static _markerConfig: SectionMarkerConfig = {};\r\n private static _graphicsConfig: SectionGraphicsConfig = {};\r\n\r\n private static shutdown() {\r\n this.resources = undefined;\r\n this._markerHandler = undefined;\r\n this._markerConfig = {};\r\n this._graphicsConfig = {};\r\n }\r\n\r\n /** Returns whether the hypermodeling package is initialized.\r\n * @see [[HyperModeling.initialize]] to initialize the package.\r\n */\r\n public static get isInitialized(): boolean {\r\n return undefined !== this.resources;\r\n }\r\n\r\n /** Invoke this method to initialize the hypermodeling package for use. You *must* await the result before using any of this package's APIs.\r\n * Typically an application would invoke this after [IModelApp.startup]($frontend), e.g.,\r\n * ```ts\r\n * await IModelApp.startup();\r\n * await HyperModeling.initialize();\r\n * ```\r\n * Calling this method again after the first initialization behaves the same as calling [[HyperModeling.replaceConfiguration]].\r\n * @note The hypermodeling package will be reset to uninitialized after [IModelApp.shutdown]($frontend) is invoked.\r\n * @see [[replaceConfiguration]] and [[updateConfiguration]] to modify the configuration after initialization.\r\n */\r\n public static async initialize(config?: HyperModelingConfig): Promise<void> {\r\n if (undefined !== this.resources) {\r\n this.replaceConfiguration(config);\r\n return;\r\n }\r\n\r\n // clean up if we're being shut down\r\n IModelApp.onBeforeShutdown.addListener(() => this.shutdown());\r\n\r\n const namespace = \"HyperModeling\";\r\n await IModelApp.localization.registerNamespace(namespace);\r\n\r\n const loadImages = [\r\n tryImageElementFromUrl(`${IModelApp.publicPath}section-marker.svg`),\r\n tryImageElementFromUrl(`${IModelApp.publicPath}detail-marker.svg`),\r\n tryImageElementFromUrl(`${IModelApp.publicPath}elevation-marker.svg`),\r\n tryImageElementFromUrl(`${IModelApp.publicPath}plan-marker.svg`),\r\n ];\r\n\r\n const images = await Promise.all(loadImages);\r\n this.resources = {\r\n namespace,\r\n markers: {\r\n section: { image: images[0], label: IModelApp.localization.getLocalizedString(\"HyperModeling:Message.SectionCallout\") },\r\n detail: { image: images[1], label: IModelApp.localization.getLocalizedString(\"HyperModeling:Message.DetailCallout\") },\r\n elevation: { image: images[2], label: IModelApp.localization.getLocalizedString(\"HyperModeling:Message.ElevationCallout\") },\r\n plan: { image: images[3], label: IModelApp.localization.getLocalizedString(\"HyperModeling:Message.PlanCallout\") },\r\n },\r\n };\r\n\r\n registerTools(namespace);\r\n this.replaceConfiguration(config);\r\n }\r\n\r\n private static async ensureInitialized(): Promise<void> {\r\n if (undefined === this.resources)\r\n await this.initialize();\r\n\r\n assertInitialized(this);\r\n }\r\n\r\n /** Replaces the current package configuration, overwriting all previous settings. Passing `undefined` resets all settings to defaults.\r\n * @see [[HyperModeling.updateConfiguration]] for overriding specific aspects of the configuration.\r\n */\r\n public static replaceConfiguration(config?: HyperModelingConfig): void {\r\n config = config ?? {};\r\n this._markerHandler = config.markerHandler ?? new SectionMarkerHandler();\r\n this._markerConfig = config.markers ? { ...config.markers } : {};\r\n this._graphicsConfig = config.graphics ? { ...config.graphics } : {};\r\n }\r\n\r\n /** Overrides specific aspects of the current package configuration. Any field that is not `undefined` will be replaced in the current configuration;\r\n * the rest will retain their current values.\r\n * @see [[HyperModeling.replaceConfiguration]].\r\n */\r\n public static updateConfiguration(config: HyperModelingConfig): void {\r\n this._markerHandler = config.markerHandler ?? this._markerHandler;\r\n\r\n if (config.markers) {\r\n this._markerConfig = {\r\n ignoreModelSelector: config.markers.ignoreModelSelector ?? this._markerConfig.ignoreModelSelector,\r\n ignoreCategorySelector: config.markers.ignoreCategorySelector ?? this._markerConfig.ignoreCategorySelector,\r\n hiddenSectionTypes: config.markers.hiddenSectionTypes ?? this._markerConfig.hiddenSectionTypes,\r\n };\r\n }\r\n\r\n if (config.graphics) {\r\n this._graphicsConfig = {\r\n ignoreClip: config.graphics.ignoreClip ?? this._graphicsConfig.ignoreClip,\r\n debugClipVolumes: config.graphics.debugClipVolumes ?? this._graphicsConfig.debugClipVolumes,\r\n hideSectionGraphics: config.graphics.hideSectionGraphics ?? this._graphicsConfig.hideSectionGraphics,\r\n hideSheetAnnotations: config.graphics.hideSheetAnnotations ?? this._graphicsConfig.hideSheetAnnotations,\r\n };\r\n\r\n IModelApp.viewManager.invalidateViewportScenes();\r\n }\r\n }\r\n\r\n /** The handler that defines interactions with [[SectionMarker]]s.\r\n * @see [[initialize]] to override the default handler at package initialization.\r\n * @see [[updateConfiguration]] or [[replaceConfiguration]] to change the current handler.\r\n */\r\n public static get markerHandler(): SectionMarkerHandler {\r\n assertInitialized(this);\r\n assert(undefined !== this._markerHandler);\r\n return this._markerHandler;\r\n }\r\n\r\n /** The current marker display configuration applied to any newly-created [[HyperModelingDecorator]]s.\r\n * @see [[initialize]] to override the default configuration at package initialization.\r\n * @see [[updateConfiguration]] or [[replaceConfiguration]] to change the current configuration.\r\n * @see [[HyperModelingDecorator.replaceConfiguration]] or [[HyperModelingDecorator.updateConfiguration]] to change the configuration for an existing decorator.\r\n */\r\n public static get markerConfig(): SectionMarkerConfig {\r\n return this._markerConfig;\r\n }\r\n\r\n /** This graphics options applied to graphics displayed by all [[HyperModelingDecorator]]s.\r\n * @see [[updateConfiguration]] or [[replaceConfiguration]] to change the current configuration.\r\n */\r\n public static get graphicsConfig(): SectionGraphicsConfig {\r\n return this._graphicsConfig;\r\n }\r\n\r\n /** Returns true if the specified iModel contains any [SectionDrawingLocation]($backend)s. Hypermodeling is based on section drawing locations,\r\n * so if none are present, hypermodeling features are not relevant to the iModel. Attempting to use those features with such an iModel is fine,\r\n * but probably not useful.\r\n */\r\n public static async isSupportedForIModel(imodel: IModelConnection): Promise<boolean> {\r\n try {\r\n const reader = imodel.createQueryReader(\"SELECT ECInstanceId FROM bis.SectionDrawingLocation LIMIT 1\");\r\n return await reader.step(); // i.e., are any results are returned?\r\n } catch {\r\n // An iModel with a version of BisCore older than 1.0.11 will produce an expected \"table not found\" on the SectionDrawingLocation ECClass.\r\n return false;\r\n }\r\n }\r\n\r\n /** Returns whether hypermodeling is currently enabled for the specified viewport.\r\n * @see [[startOrStop]] to enable or disable hypermodeling for a viewport.\r\n */\r\n public static isEnabledForViewport(viewport: ScreenViewport): boolean {\r\n return undefined !== HyperModelingDecorator.getForViewport(viewport);\r\n }\r\n\r\n /** Start or stop hypermodeling mode for the specified viewport.\r\n * Enabling hypermodeling registers and returns a [[HyperModelingDecorator]] to display [[SectionMarker]]s within the viewport.\r\n * Disabling hypermodeling removes that decorator.\r\n * @param viewport The hypermodeling viewport\r\n * @param start `true` to enter hypermodeling mode, `false` to exit, or `undefined` to toggle the current mode.\r\n * @returns The new decorator is hypermodeling was successfully enabled.\r\n * @note Enabling hypermodeling may fail if the viewport is not viewing a spatial model or if the viewport's iModel does not support hypermodeling.\r\n * @see [[start]] and [[stop]].\r\n * @see [[isSupportedForIModel]].\r\n */\r\n public static async startOrStop(viewport: ScreenViewport, start?: boolean): Promise<HyperModelingDecorator | undefined> {\r\n // Help out the caller since we're async anyway...\r\n await this.ensureInitialized();\r\n\r\n const decorator = HyperModelingDecorator.getForViewport(viewport);\r\n if (undefined === start)\r\n start = undefined === decorator;\r\n\r\n if (start) {\r\n return this._start(viewport);\r\n } else {\r\n decorator?.[Symbol.dispose]();\r\n return undefined;\r\n }\r\n }\r\n\r\n /** Start hypermodeling mode for the specified viewport if it is not currently enabled.\r\n * If hypermodeling is already enabled for the viewport, the existing decorator is returned; otherwise, a new decorator is created.\r\n * @param viewport The viewport for which to enable hypermodeling\r\n * @returns The decorator that implements hypermodeling features for the viewport, or `undefined` if hypermodeling could not be enabled.\r\n * @note Enabling hypermodeling may fail if the viewport is not viewing a spatial model or if the viewport's iModel does not support hypermodeling.\r\n */\r\n public static async start(viewport: ScreenViewport): Promise<HyperModelingDecorator | undefined> {\r\n await this.ensureInitialized();\r\n return this._start(viewport);\r\n }\r\n\r\n private static async _start(viewport: ScreenViewport): Promise<HyperModelingDecorator | undefined> {\r\n assertInitialized(this);\r\n if (!viewport.view.isSpatialView())\r\n return undefined;\r\n\r\n let decorator = HyperModelingDecorator.getForViewport(viewport);\r\n if (!decorator)\r\n decorator = await HyperModelingDecorator.create(viewport, this._markerConfig);\r\n\r\n if (undefined !== decorator && viewport.view.isCameraOn) {\r\n // We want the 2d graphics to align with the 3d geometry. Perspective ruins that.\r\n viewport.view.turnCameraOff();\r\n ViewManip.fitView(viewport, false, { noSaveInUndo: true });\r\n viewport.clearViewUndo();\r\n }\r\n\r\n return decorator;\r\n }\r\n\r\n /** Stop hypermodeling mode for the specified viewport if it is currently enabled. This disposes of the [[HyperModelingDecorator]] associated with the viewport.\r\n * @see [[start]] to enable hypermodeling for a viewport.\r\n * @see [[startOrStop]] to toggle hypermodeling mode.\r\n */\r\n public static stop(viewport: ScreenViewport): void {\r\n const decorator = HyperModelingDecorator.getForViewport(viewport);\r\n decorator?.[Symbol.dispose]();\r\n }\r\n\r\n /** @internal */\r\n public static get namespace(): string | undefined {\r\n assertInitialized(this);\r\n return this.resources.namespace;\r\n }\r\n\r\n /** @internal */\r\n public static getMarkerData(type: SectionType): MarkerData {\r\n assertInitialized(this);\r\n switch (type) {\r\n case SectionType.Plan:\r\n return this.resources.markers.plan;\r\n case SectionType.Elevation:\r\n return this.resources.markers.elevation;\r\n case SectionType.Detail:\r\n return this.resources.markers.detail;\r\n default:\r\n return this.resources.markers.section;\r\n }\r\n }\r\n}\r\n"]}
@@ -64,7 +64,7 @@ export declare class HyperModelingDecorator implements Decorator {
64
64
  private toggleMarker;
65
65
  private dropTiledGraphicsProvider;
66
66
  /** @internal */
67
- dispose(): void;
67
+ [Symbol.dispose](): void;
68
68
  private showToolbarAfterTimeout;
69
69
  /** Toggles whether the clip volume associated with the specified marker is applied to the view. */
70
70
  toggleClipVolume(marker: SectionMarker, enable: boolean): void;
@@ -1 +1 @@
1
- {"version":3,"file":"HyperModelingDecorator.d.ts","sourceRoot":"","sources":["../../src/HyperModelingDecorator.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EACQ,eAAe,EAAE,SAAS,EAA+B,cAAc,EACrF,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAKnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAwC5D;;;;;;GAMG;AACH,qBAAa,sBAAuB,YAAW,SAAS;IACtD,kEAAkE;IAClE,SAAgB,OAAO,EAAE,gBAAgB,CAAC;IAC1C,OAAO,CAAC,OAAO,CAAsB;IACrC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAA2B;IACjE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAC3C,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,gBAAgB,CAAC,CAAwB;IACjD,OAAO,CAAC,sBAAsB,CAAC,CAAwB;IACvD,OAAO,CAAC,aAAa,CAAC,CAAgB;IACtC,OAAO,CAAC,mBAAmB,CAAC,CAAmB;IAC/C,gBAAgB;IACT,eAAe,UAAS;IAE/B,gJAAgJ;WAC5H,MAAM,CAAC,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,mBAAmB,GAAG,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CAAC;IAQjE;;OAEG;IACU,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC;IAa/D;;;;;OAKG;IACU,kBAAkB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC;IAgBxE;;;;OAIG;IACU,gBAAgB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC;IAUtE;;OAEG;IACI,WAAW,IAAI,IAAI;IAS1B,OAAO,CAAC,IAAI;IAQZ,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,sBAAsB;CAU/B"}
@@ -141,7 +141,7 @@ class HyperModelingDecorator {
141
141
  this.requestSync();
142
142
  });
143
143
  this._removeEventListeners.push(this.viewport.onViewportChanged.addListener((_, changeFlags) => this.onViewportChanged(changeFlags)));
144
- this._removeEventListeners.push(this.viewport.onDisposed.addListener(() => this.dispose()));
144
+ this._removeEventListeners.push(this.viewport.onDisposed.addListener(() => this[Symbol.dispose]()));
145
145
  for (const marker of markers.markers) {
146
146
  marker.onMouseEnterEvent.addListener((mkr) => this.showToolbarAfterTimeout(mkr));
147
147
  marker.onMouseButtonEvent.addListener((mkr) => this.toggleMarker(mkr)); // eslint-disable-line @typescript-eslint/promise-function-async
@@ -151,7 +151,7 @@ class HyperModelingDecorator {
151
151
  }
152
152
  onViewportChanged(changeFlags) {
153
153
  if (this.viewport.iModel !== this._iModel) {
154
- this.dispose();
154
+ this[Symbol.dispose]();
155
155
  return;
156
156
  }
157
157
  if (changeFlags.viewedCategories || changeFlags.viewedModels || changeFlags.viewedCategoriesPerModel)
@@ -174,7 +174,7 @@ class HyperModelingDecorator {
174
174
  this._tiledGraphicsProvider = undefined;
175
175
  }
176
176
  /** @internal */
177
- dispose() {
177
+ [Symbol.dispose]() {
178
178
  if (!core_frontend_1.IModelApp.viewManager.dropDecorator(this))
179
179
  return;
180
180
  for (const remove of this._removeEventListeners)
@@ -1 +1 @@
1
- {"version":3,"file":"HyperModeling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M,KAAK,IAAI,CAAC,YAAY,CAAC;QAEtC,OAAO,6BAAa,CAAC,aAAa,CAAC,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACjF,CAAC;IAEO,sBAAsB;QAC5B,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YAC1C,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC;YAClC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YAC9C,OAAO,GAAG,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC;QACvD,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA7VD,wDA6VC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module HyperModeling\n */\n\nimport { Transform, XAndY } from \"@itwin/core-geometry\";\nimport type { AbstractToolbarProps } from \"@itwin/appui-abstract\";\nimport {\n ChangeFlags, DecorateContext, Decorator, IModelApp, IModelConnection, ScreenViewport, SpatialViewState, TiledGraphicsProvider, ViewClipTool,\n} from \"@itwin/core-frontend\";\nimport { SectionMarker, SectionMarkerSet } from \"./SectionMarkers\";\nimport { SectionDrawingLocationState } from \"./SectionDrawingLocationState\";\nimport { createSectionGraphicsProvider } from \"./SectionGraphicsProvider\";\nimport { PopupToolbarManager, PopupToolbarProvider } from \"./PopupToolbar\";\nimport { HyperModeling } from \"./HyperModeling\";\nimport { SectionMarkerConfig } from \"./HyperModelingConfig\";\n\nasync function createMarkers(vp: ScreenViewport): Promise<SectionMarkerSet | undefined> {\n if (!vp.view.isSpatialView())\n return undefined;\n\n const states = await SectionDrawingLocationState.queryAll(vp.iModel);\n if (0 === states.length)\n return undefined;\n\n const markers = states.map((state) => new SectionMarker(state));\n return new SectionMarkerSet(vp, markers);\n}\n\nclass MarkerToolbarProvider implements PopupToolbarProvider {\n private readonly _viewport: ScreenViewport;\n public readonly marker: SectionMarker;\n public readonly toolbarProps: AbstractToolbarProps;\n public readonly onToolbarItemExecuted: (id: string) => void;\n\n public constructor(marker: SectionMarker, decorator: HyperModelingDecorator) {\n this.marker = marker;\n this._viewport = decorator.viewport;\n this.toolbarProps = HyperModeling.markerHandler.getToolbarProps(marker, decorator);\n this.onToolbarItemExecuted = (id) => HyperModeling.markerHandler.executeCommand(id, marker, decorator); // eslint-disable-line @typescript-eslint/promise-function-async\n }\n\n public get overToolbarHotspot() {\n return this.marker.isHilited;\n }\n\n public get toolbarLocation(): XAndY {\n return { x: this.marker.rect.right, y: this.marker.rect.top };\n }\n\n public get htmlElement() {\n return this._viewport.canvas;\n }\n}\n\n/** A [Decorator]($frontend) that displays a [[SectionMarker]] for each [SectionDrawingLocation]($backend) in the view.\n * Clicking on a marker toggles the section and the display of associated 2d graphics.\n * Hovering over a marker opens a mini toolbar with additional interactions.\n * @see [[SectionMarkerHandler]] to customize the marker interactions.\n * @see [[HyperModeling.startOrStop]] to enable or disable the decorator for a viewport.\n * @public\n */\nexport class HyperModelingDecorator implements Decorator {\n /** The set of [[SectionMarker]]s controlled by this decorator. */\n public readonly markers: SectionMarkerSet;\n private _config: SectionMarkerConfig;\n private readonly _removeEventListeners = new Array<() => void>();\n private readonly _iModel: IModelConnection;\n private _needSync = false;\n private _toolbarProvider?: MarkerToolbarProvider;\n private _tiledGraphicsProvider?: TiledGraphicsProvider;\n private _activeMarker?: SectionMarker;\n private _appliedSpatialView?: SpatialViewState;\n /** @internal */\n public syncImmediately = false;\n\n /** Create a new decorator and register it with the [ViewManager]($frontend). Typically invoked indirectly via [[HyperModeling.startOrStop]]. */\n public static async create(vp: ScreenViewport, config: SectionMarkerConfig): Promise<HyperModelingDecorator | undefined> {\n const markers = await createMarkers(vp);\n return undefined !== markers ? new HyperModelingDecorator(markers, config) : undefined;\n }\n\n /** Obtain the decorator associated with the specified viewport, if any. */\n public static getForViewport(vp: ScreenViewport): HyperModelingDecorator | undefined {\n for (const decorator of IModelApp.viewManager.decorators)\n if (decorator instanceof HyperModelingDecorator && decorator.viewport === vp)\n return decorator;\n\n return undefined;\n }\n\n /** The viewport into which this decorator draws its [[SectionMarker]]s. */\n public get viewport(): ScreenViewport {\n return this.markers.viewport;\n }\n\n /** The currently active marker. A marker typically becomes active when the user clicks on it.\n * @see [[setActiveMarker]] to change the active marker without user interaction.\n */\n public get activeMarker(): SectionMarker | undefined {\n return this._activeMarker;\n }\n\n /** @internal */\n public get config(): SectionMarkerConfig {\n return this._config;\n }\n\n /** Replaces the current marker display configuration, overwriting all previous settings. Passing `undefined` resets all settings to defaults.\n * @see [[updateConfiguration]] to override specific aspects of the configuration\n * @see [[HyperModeling.replaceConfiguration]] to replace the global configuration.\n */\n public replaceConfiguration(config?: SectionMarkerConfig): void {\n this._config = config ? { ...config } : {};\n this.requestSync();\n }\n\n /** Overrides specific aspects of the current marker display configuration.\n * Any field that is not `undefined` will be replaced in the current configuration; the rest will retain their current values.\n * @see [[replaceConfiguration]] to override all settings.\n * @see [[HyperModeling.updateConfiguration]] to update the global configuration.\n */\n public updateConfiguration(config: SectionMarkerConfig): void {\n this._config = {\n ignoreModelSelector: config.ignoreModelSelector ?? this._config.ignoreModelSelector,\n ignoreCategorySelector: config.ignoreCategorySelector ?? this._config.ignoreCategorySelector,\n hiddenSectionTypes: config.hiddenSectionTypes ?? this._config.hiddenSectionTypes,\n };\n\n this.requestSync();\n }\n\n /** Sets the currently active marker. This function is invoked when the user clicks on a marker, but may also be called manually to produce the same result.\n * Changing the active marker first deactivates the currently active marker, if any; then activates the specified marker, if supplied.\n * Returns false if marker activation fails.\n * @see [[activeMarker]] to obtain the currently active section marker.\n * @see [[SectionMarkerHandler.activateMarker]] to control what happens when a marker is activated.\n * @see [[SectionMarkerHandler.deactivateMarker]] to control what happens when a marker is deactivated.\n */\n public async setActiveMarker(marker: SectionMarker | undefined): Promise<boolean> {\n if (marker === this.activeMarker)\n return true;\n\n if (this.activeMarker) {\n this.activeMarker.setActive(false);\n await HyperModeling.markerHandler.deactivateMarker(this.activeMarker, this);\n this._activeMarker = undefined;\n }\n\n if (marker) {\n if (!await HyperModeling.markerHandler.activateMarker(marker, this)) {\n this.requestSync();\n return false;\n }\n\n marker.setActive(true);\n this._activeMarker = marker;\n }\n\n this.requestSync();\n return true;\n }\n\n /** @internal */\n public readonly useCachedDecorations = true;\n\n /** @internal */\n public decorate(context: DecorateContext): void {\n if (this.viewport.view.is3d())\n this.markers.addDecoration(context);\n }\n\n private constructor(markers: SectionMarkerSet, config: SectionMarkerConfig) {\n this.markers = markers;\n this._config = { ...config };\n this._iModel = this.viewport.iModel;\n\n this.viewport.onChangeView.addOnce(() => {\n this.requestSync();\n });\n\n this._removeEventListeners.push(this.viewport.onViewportChanged.addListener((_, changeFlags) => this.onViewportChanged(changeFlags)));\n this._removeEventListeners.push(this.viewport.onDisposed.addListener(() => this.dispose()));\n\n for (const marker of markers.markers) {\n marker.onMouseEnterEvent.addListener((mkr) => this.showToolbarAfterTimeout(mkr));\n marker.onMouseButtonEvent.addListener((mkr) => this.toggleMarker(mkr)); // eslint-disable-line @typescript-eslint/promise-function-async\n }\n\n this.updateMarkerVisibility();\n IModelApp.viewManager.addDecorator(this);\n }\n\n private onViewportChanged(changeFlags: ChangeFlags): void {\n if (this.viewport.iModel !== this._iModel) {\n this.dispose();\n return;\n }\n\n if (changeFlags.viewedCategories || changeFlags.viewedModels || changeFlags.viewedCategoriesPerModel)\n this.requestSync();\n\n if (changeFlags.viewState) {\n // If we're looking at a different view now, and we did not initiate that, turn off the active marker.\n if (this.viewport.view !== this._appliedSpatialView)\n this.setActiveMarker(undefined); // eslint-disable-line @typescript-eslint/no-floating-promises\n else\n this._appliedSpatialView = undefined;\n }\n }\n\n private async toggleMarker(marker: SectionMarker): Promise<void> {\n await this.setActiveMarker(marker === this.activeMarker ? undefined : marker);\n }\n\n private dropTiledGraphicsProvider(): void {\n if (undefined === this._tiledGraphicsProvider)\n return;\n\n this.viewport.dropTiledGraphicsProvider(this._tiledGraphicsProvider);\n this._tiledGraphicsProvider = undefined;\n }\n\n /** @internal */\n public dispose(): void {\n if (!IModelApp.viewManager.dropDecorator(this))\n return;\n\n for (const remove of this._removeEventListeners)\n remove();\n\n this.dropTiledGraphicsProvider();\n }\n\n private showToolbarAfterTimeout(marker: SectionMarker): void {\n if (this._toolbarProvider?.marker !== marker)\n this._toolbarProvider = new MarkerToolbarProvider(marker, this);\n\n PopupToolbarManager.showToolbarAfterTimeout(this._toolbarProvider);\n }\n\n /** Toggles whether the clip volume associated with the specified marker is applied to the view. */\n public toggleClipVolume(marker: SectionMarker, enable: boolean): void {\n ViewClipTool.enableClipVolume(this.viewport);\n ViewClipTool.setViewClip(this.viewport, enable ? marker.state.clip : undefined);\n }\n\n /** Toggles the specified section marker.\n * Enabling the section applies the frustum and clip volume of the marker's spatial view to the viewport, and displays the 2d section graphics and sheet annotations.\n * Disabling the section disables the clip volume and 2d graphics.\n * @see [[toggleClipVolume]] to toggle only the clip volume.\n * @see [[toggleAttachment]] to toggle only the attachment graphics.\n */\n public async toggleSection(marker: SectionMarker, enable: boolean): Promise<boolean> {\n if (enable) {\n if (this.viewport.view.is3d()) {\n // Preserve the view settings; apply only the frustum and clip volume\n const spatialView = await marker.state.tryLoadSpatialView();\n if (!spatialView)\n return false;\n\n const aligned = await this.alignToSpatialView(marker);\n if (!aligned)\n return false;\n\n this.toggleClipVolume(marker, true);\n } else if (!await this.applySpatialView(marker)) {\n return false;\n }\n } else {\n this.toggleClipVolume(marker, false);\n }\n\n this.requestSync();\n return this.toggleAttachment(marker, enable);\n }\n\n /** Toggles display of 2d section graphics and sheet annotations for the specified marker.\n * @see [[toggleSection]] to apply the spatial view and clip volume in addition to the attachment graphics.\n */\n public async toggleAttachment(marker: SectionMarker, enable: boolean): Promise<boolean> {\n this.dropTiledGraphicsProvider();\n if (enable) {\n this._tiledGraphicsProvider = await createSectionGraphicsProvider(marker.state);\n this.viewport.addTiledGraphicsProvider(this._tiledGraphicsProvider);\n }\n\n return true;\n }\n\n /** Aligns the viewport to face the specified marker's section plane. */\n public alignView(marker: SectionMarker): void {\n const placement = marker.state.placement.transform;\n const origin = placement.origin;\n const matrix = placement.matrix;\n\n const vp = this.viewport;\n const targetMatrix = matrix.multiplyMatrixMatrix(vp.rotation);\n const rotateTransform = Transform.createFixedPointAndMatrix(origin, targetMatrix);\n\n const startFrustum = vp.getFrustum();\n const newFrustum = startFrustum.clone();\n newFrustum.multiply(rotateTransform);\n\n if (startFrustum.equals(newFrustum))\n return;\n\n vp.view.setupFromFrustum(newFrustum);\n vp.synchWithView();\n vp.animateFrustumChange();\n }\n\n /** Opens the marker's drawing view in the decorator's viewport. Returns false if the drawing view could not be loaded. */\n public async openSection(marker: SectionMarker): Promise<boolean> {\n const viewState = await marker.state.tryLoadDrawingView();\n if (viewState)\n this.viewport.changeView(viewState);\n\n return undefined !== viewState;\n }\n\n /** Opens marker's sheet view in the decorator's viewport and zooms in on the associated [ViewAttachment]($backend). Returns false if no view\n * attachment exists or the sheet view could not be loaded.\n */\n public async openSheet(marker: SectionMarker): Promise<boolean> {\n if (undefined === marker.state.viewAttachment)\n return false;\n\n const viewState = await marker.state.tryLoadSheetView();\n if (!viewState)\n return false;\n\n this.viewport.changeView(viewState);\n await this.viewport.zoomToElements(marker.state.viewAttachment.id);\n return true;\n }\n\n /** Aligns the view to match the frustum of the spatial view associated with the specified marker.\n * @param marker The marker whose spatial view's frustum should be applied.\n * @returns false if the frustum could not be applied, e.g. because the spatial view could not be loaded or the viewport is viewing a 2d model.\n * @see [[alignView]] to align to the *section plane*, which may differ.\n * @see [[toggleSection]] to also apply the clip volume.\n */\n public async alignToSpatialView(marker: SectionMarker): Promise<boolean> {\n if (!this.viewport.view.is3d())\n return false;\n\n const spatialView = await marker.state.tryLoadSpatialView();\n if (!spatialView)\n return false;\n\n this.viewport.view.setOrigin(spatialView.getOrigin());\n this.viewport.view.setExtents(spatialView.getExtents());\n this.viewport.view.setRotation(spatialView.getRotation());\n this.viewport.synchWithView({ animateFrustumChange: true });\n\n return true;\n }\n\n /** Applies the marker's spatial view - including its clip volume - to the decorator's viewport.\n * Returns false if the spatial view could not be loaded.\n * @see [[toggleSection]].\n * @see [[toggleClipVolume]].\n */\n public async applySpatialView(marker: SectionMarker): Promise<boolean> {\n const viewState = await marker.state.tryLoadSpatialView();\n if (viewState) {\n this._appliedSpatialView = viewState;\n this.viewport.changeView(viewState);\n }\n\n return undefined !== viewState;\n }\n\n /** Request that the visibility of the section markers be recomputed. It is only necessary to call this if you have overridden [[SectionMarkerHandler.isMarkerVisible]]; if so, you should invoke\n * this method when the criteria governing your `isMarkerVisible` method have changed.\n */\n public requestSync(): void {\n if (this.syncImmediately) {\n this.sync();\n } else if (!this._needSync) {\n this._needSync = true;\n requestAnimationFrame(() => this.sync());\n }\n }\n\n private sync(): void {\n this._needSync = false;\n if (HyperModeling.isInitialized && this.viewport.view.is3d() && this.updateMarkerVisibility()) {\n this.markers.markDirty();\n this.viewport.invalidateCachedDecorations(this);\n }\n }\n\n private isMarkerVisible(marker: SectionMarker): boolean {\n if (undefined !== this.activeMarker)\n return marker === this.activeMarker;\n\n return HyperModeling.markerHandler.isMarkerVisible(marker, this, this._config);\n }\n\n private updateMarkerVisibility(): boolean {\n let changed = false;\n for (const marker of this.markers.markers) {\n const wasVisible = marker.visible;\n marker.visible = this.isMarkerVisible(marker);\n changed = changed || (marker.visible !== wasVisible);\n }\n\n return changed;\n }\n}\n"]}
1
+ {"version":3,"file":"HyperModelingDecorator.js","sourceRoot":"","sources":["../../src/HyperModelingDecorator.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,wDAAwD;AAExD,wDAE8B;AAC9B,qDAAmE;AACnE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,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACjF,CAAC;IAEO,sBAAsB;QAC5B,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YAC1C,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC;YAClC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YAC9C,OAAO,GAAG,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC;QACvD,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA7VD,wDA6VC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module HyperModeling\n */\n\nimport { Transform, XAndY } from \"@itwin/core-geometry\";\nimport type { AbstractToolbarProps } from \"@itwin/appui-abstract\";\nimport {\n ChangeFlags, DecorateContext, Decorator, IModelApp, IModelConnection, ScreenViewport, SpatialViewState, TiledGraphicsProvider, ViewClipTool,\n} from \"@itwin/core-frontend\";\nimport { SectionMarker, SectionMarkerSet } from \"./SectionMarkers\";\nimport { SectionDrawingLocationState } from \"./SectionDrawingLocationState\";\nimport { createSectionGraphicsProvider } from \"./SectionGraphicsProvider\";\nimport { PopupToolbarManager, PopupToolbarProvider } from \"./PopupToolbar\";\nimport { HyperModeling } from \"./HyperModeling\";\nimport { SectionMarkerConfig } from \"./HyperModelingConfig\";\n\nasync function createMarkers(vp: ScreenViewport): Promise<SectionMarkerSet | undefined> {\n if (!vp.view.isSpatialView())\n return undefined;\n\n const states = await SectionDrawingLocationState.queryAll(vp.iModel);\n if (0 === states.length)\n return undefined;\n\n const markers = states.map((state) => new SectionMarker(state));\n return new SectionMarkerSet(vp, markers);\n}\n\nclass MarkerToolbarProvider implements PopupToolbarProvider {\n private readonly _viewport: ScreenViewport;\n public readonly marker: SectionMarker;\n public readonly toolbarProps: AbstractToolbarProps;\n public readonly onToolbarItemExecuted: (id: string) => void;\n\n public constructor(marker: SectionMarker, decorator: HyperModelingDecorator) {\n this.marker = marker;\n this._viewport = decorator.viewport;\n this.toolbarProps = HyperModeling.markerHandler.getToolbarProps(marker, decorator);\n this.onToolbarItemExecuted = (id) => HyperModeling.markerHandler.executeCommand(id, marker, decorator); // eslint-disable-line @typescript-eslint/promise-function-async\n }\n\n public get overToolbarHotspot() {\n return this.marker.isHilited;\n }\n\n public get toolbarLocation(): XAndY {\n return { x: this.marker.rect.right, y: this.marker.rect.top };\n }\n\n public get htmlElement() {\n return this._viewport.canvas;\n }\n}\n\n/** A [Decorator]($frontend) that displays a [[SectionMarker]] for each [SectionDrawingLocation]($backend) in the view.\n * Clicking on a marker toggles the section and the display of associated 2d graphics.\n * Hovering over a marker opens a mini toolbar with additional interactions.\n * @see [[SectionMarkerHandler]] to customize the marker interactions.\n * @see [[HyperModeling.startOrStop]] to enable or disable the decorator for a viewport.\n * @public\n */\nexport class HyperModelingDecorator implements Decorator {\n /** The set of [[SectionMarker]]s controlled by this decorator. */\n public readonly markers: SectionMarkerSet;\n private _config: SectionMarkerConfig;\n private readonly _removeEventListeners = new Array<() => void>();\n private readonly _iModel: IModelConnection;\n private _needSync = false;\n private _toolbarProvider?: MarkerToolbarProvider;\n private _tiledGraphicsProvider?: TiledGraphicsProvider;\n private _activeMarker?: SectionMarker;\n private _appliedSpatialView?: SpatialViewState;\n /** @internal */\n public syncImmediately = false;\n\n /** Create a new decorator and register it with the [ViewManager]($frontend). Typically invoked indirectly via [[HyperModeling.startOrStop]]. */\n public static async create(vp: ScreenViewport, config: SectionMarkerConfig): Promise<HyperModelingDecorator | undefined> {\n const markers = await createMarkers(vp);\n return undefined !== markers ? new HyperModelingDecorator(markers, config) : undefined;\n }\n\n /** Obtain the decorator associated with the specified viewport, if any. */\n public static getForViewport(vp: ScreenViewport): HyperModelingDecorator | undefined {\n for (const decorator of IModelApp.viewManager.decorators)\n if (decorator instanceof HyperModelingDecorator && decorator.viewport === vp)\n return decorator;\n\n return undefined;\n }\n\n /** The viewport into which this decorator draws its [[SectionMarker]]s. */\n public get viewport(): ScreenViewport {\n return this.markers.viewport;\n }\n\n /** The currently active marker. A marker typically becomes active when the user clicks on it.\n * @see [[setActiveMarker]] to change the active marker without user interaction.\n */\n public get activeMarker(): SectionMarker | undefined {\n return this._activeMarker;\n }\n\n /** @internal */\n public get config(): SectionMarkerConfig {\n return this._config;\n }\n\n /** Replaces the current marker display configuration, overwriting all previous settings. Passing `undefined` resets all settings to defaults.\n * @see [[updateConfiguration]] to override specific aspects of the configuration\n * @see [[HyperModeling.replaceConfiguration]] to replace the global configuration.\n */\n public replaceConfiguration(config?: SectionMarkerConfig): void {\n this._config = config ? { ...config } : {};\n this.requestSync();\n }\n\n /** Overrides specific aspects of the current marker display configuration.\n * Any field that is not `undefined` will be replaced in the current configuration; the rest will retain their current values.\n * @see [[replaceConfiguration]] to override all settings.\n * @see [[HyperModeling.updateConfiguration]] to update the global configuration.\n */\n public updateConfiguration(config: SectionMarkerConfig): void {\n this._config = {\n ignoreModelSelector: config.ignoreModelSelector ?? this._config.ignoreModelSelector,\n ignoreCategorySelector: config.ignoreCategorySelector ?? this._config.ignoreCategorySelector,\n hiddenSectionTypes: config.hiddenSectionTypes ?? this._config.hiddenSectionTypes,\n };\n\n this.requestSync();\n }\n\n /** Sets the currently active marker. This function is invoked when the user clicks on a marker, but may also be called manually to produce the same result.\n * Changing the active marker first deactivates the currently active marker, if any; then activates the specified marker, if supplied.\n * Returns false if marker activation fails.\n * @see [[activeMarker]] to obtain the currently active section marker.\n * @see [[SectionMarkerHandler.activateMarker]] to control what happens when a marker is activated.\n * @see [[SectionMarkerHandler.deactivateMarker]] to control what happens when a marker is deactivated.\n */\n public async setActiveMarker(marker: SectionMarker | undefined): Promise<boolean> {\n if (marker === this.activeMarker)\n return true;\n\n if (this.activeMarker) {\n this.activeMarker.setActive(false);\n await HyperModeling.markerHandler.deactivateMarker(this.activeMarker, this);\n this._activeMarker = undefined;\n }\n\n if (marker) {\n if (!await HyperModeling.markerHandler.activateMarker(marker, this)) {\n this.requestSync();\n return false;\n }\n\n marker.setActive(true);\n this._activeMarker = marker;\n }\n\n this.requestSync();\n return true;\n }\n\n /** @internal */\n public readonly useCachedDecorations = true;\n\n /** @internal */\n public decorate(context: DecorateContext): void {\n if (this.viewport.view.is3d())\n this.markers.addDecoration(context);\n }\n\n private constructor(markers: SectionMarkerSet, config: SectionMarkerConfig) {\n this.markers = markers;\n this._config = { ...config };\n this._iModel = this.viewport.iModel;\n\n this.viewport.onChangeView.addOnce(() => {\n this.requestSync();\n });\n\n this._removeEventListeners.push(this.viewport.onViewportChanged.addListener((_, changeFlags) => this.onViewportChanged(changeFlags)));\n this._removeEventListeners.push(this.viewport.onDisposed.addListener(() => this[Symbol.dispose]()));\n\n for (const marker of markers.markers) {\n marker.onMouseEnterEvent.addListener((mkr) => this.showToolbarAfterTimeout(mkr));\n marker.onMouseButtonEvent.addListener((mkr) => this.toggleMarker(mkr)); // eslint-disable-line @typescript-eslint/promise-function-async\n }\n\n this.updateMarkerVisibility();\n IModelApp.viewManager.addDecorator(this);\n }\n\n private onViewportChanged(changeFlags: ChangeFlags): void {\n if (this.viewport.iModel !== this._iModel) {\n this[Symbol.dispose]();\n return;\n }\n\n if (changeFlags.viewedCategories || changeFlags.viewedModels || changeFlags.viewedCategoriesPerModel)\n this.requestSync();\n\n if (changeFlags.viewState) {\n // If we're looking at a different view now, and we did not initiate that, turn off the active marker.\n if (this.viewport.view !== this._appliedSpatialView)\n this.setActiveMarker(undefined); // eslint-disable-line @typescript-eslint/no-floating-promises\n else\n this._appliedSpatialView = undefined;\n }\n }\n\n private async toggleMarker(marker: SectionMarker): Promise<void> {\n await this.setActiveMarker(marker === this.activeMarker ? undefined : marker);\n }\n\n private dropTiledGraphicsProvider(): void {\n if (undefined === this._tiledGraphicsProvider)\n return;\n\n this.viewport.dropTiledGraphicsProvider(this._tiledGraphicsProvider);\n this._tiledGraphicsProvider = undefined;\n }\n\n /** @internal */\n public [Symbol.dispose](): void {\n if (!IModelApp.viewManager.dropDecorator(this))\n return;\n\n for (const remove of this._removeEventListeners)\n remove();\n\n this.dropTiledGraphicsProvider();\n }\n\n private showToolbarAfterTimeout(marker: SectionMarker): void {\n if (this._toolbarProvider?.marker !== marker)\n this._toolbarProvider = new MarkerToolbarProvider(marker, this);\n\n PopupToolbarManager.showToolbarAfterTimeout(this._toolbarProvider);\n }\n\n /** Toggles whether the clip volume associated with the specified marker is applied to the view. */\n public toggleClipVolume(marker: SectionMarker, enable: boolean): void {\n ViewClipTool.enableClipVolume(this.viewport);\n ViewClipTool.setViewClip(this.viewport, enable ? marker.state.clip : undefined);\n }\n\n /** Toggles the specified section marker.\n * Enabling the section applies the frustum and clip volume of the marker's spatial view to the viewport, and displays the 2d section graphics and sheet annotations.\n * Disabling the section disables the clip volume and 2d graphics.\n * @see [[toggleClipVolume]] to toggle only the clip volume.\n * @see [[toggleAttachment]] to toggle only the attachment graphics.\n */\n public async toggleSection(marker: SectionMarker, enable: boolean): Promise<boolean> {\n if (enable) {\n if (this.viewport.view.is3d()) {\n // Preserve the view settings; apply only the frustum and clip volume\n const spatialView = await marker.state.tryLoadSpatialView();\n if (!spatialView)\n return false;\n\n const aligned = await this.alignToSpatialView(marker);\n if (!aligned)\n return false;\n\n this.toggleClipVolume(marker, true);\n } else if (!await this.applySpatialView(marker)) {\n return false;\n }\n } else {\n this.toggleClipVolume(marker, false);\n }\n\n this.requestSync();\n return this.toggleAttachment(marker, enable);\n }\n\n /** Toggles display of 2d section graphics and sheet annotations for the specified marker.\n * @see [[toggleSection]] to apply the spatial view and clip volume in addition to the attachment graphics.\n */\n public async toggleAttachment(marker: SectionMarker, enable: boolean): Promise<boolean> {\n this.dropTiledGraphicsProvider();\n if (enable) {\n this._tiledGraphicsProvider = await createSectionGraphicsProvider(marker.state);\n this.viewport.addTiledGraphicsProvider(this._tiledGraphicsProvider);\n }\n\n return true;\n }\n\n /** Aligns the viewport to face the specified marker's section plane. */\n public alignView(marker: SectionMarker): void {\n const placement = marker.state.placement.transform;\n const origin = placement.origin;\n const matrix = placement.matrix;\n\n const vp = this.viewport;\n const targetMatrix = matrix.multiplyMatrixMatrix(vp.rotation);\n const rotateTransform = Transform.createFixedPointAndMatrix(origin, targetMatrix);\n\n const startFrustum = vp.getFrustum();\n const newFrustum = startFrustum.clone();\n newFrustum.multiply(rotateTransform);\n\n if (startFrustum.equals(newFrustum))\n return;\n\n vp.view.setupFromFrustum(newFrustum);\n vp.synchWithView();\n vp.animateFrustumChange();\n }\n\n /** Opens the marker's drawing view in the decorator's viewport. Returns false if the drawing view could not be loaded. */\n public async openSection(marker: SectionMarker): Promise<boolean> {\n const viewState = await marker.state.tryLoadDrawingView();\n if (viewState)\n this.viewport.changeView(viewState);\n\n return undefined !== viewState;\n }\n\n /** Opens marker's sheet view in the decorator's viewport and zooms in on the associated [ViewAttachment]($backend). Returns false if no view\n * attachment exists or the sheet view could not be loaded.\n */\n public async openSheet(marker: SectionMarker): Promise<boolean> {\n if (undefined === marker.state.viewAttachment)\n return false;\n\n const viewState = await marker.state.tryLoadSheetView();\n if (!viewState)\n return false;\n\n this.viewport.changeView(viewState);\n await this.viewport.zoomToElements(marker.state.viewAttachment.id);\n return true;\n }\n\n /** Aligns the view to match the frustum of the spatial view associated with the specified marker.\n * @param marker The marker whose spatial view's frustum should be applied.\n * @returns false if the frustum could not be applied, e.g. because the spatial view could not be loaded or the viewport is viewing a 2d model.\n * @see [[alignView]] to align to the *section plane*, which may differ.\n * @see [[toggleSection]] to also apply the clip volume.\n */\n public async alignToSpatialView(marker: SectionMarker): Promise<boolean> {\n if (!this.viewport.view.is3d())\n return false;\n\n const spatialView = await marker.state.tryLoadSpatialView();\n if (!spatialView)\n return false;\n\n this.viewport.view.setOrigin(spatialView.getOrigin());\n this.viewport.view.setExtents(spatialView.getExtents());\n this.viewport.view.setRotation(spatialView.getRotation());\n this.viewport.synchWithView({ animateFrustumChange: true });\n\n return true;\n }\n\n /** Applies the marker's spatial view - including its clip volume - to the decorator's viewport.\n * Returns false if the spatial view could not be loaded.\n * @see [[toggleSection]].\n * @see [[toggleClipVolume]].\n */\n public async applySpatialView(marker: SectionMarker): Promise<boolean> {\n const viewState = await marker.state.tryLoadSpatialView();\n if (viewState) {\n this._appliedSpatialView = viewState;\n this.viewport.changeView(viewState);\n }\n\n return undefined !== viewState;\n }\n\n /** Request that the visibility of the section markers be recomputed. It is only necessary to call this if you have overridden [[SectionMarkerHandler.isMarkerVisible]]; if so, you should invoke\n * this method when the criteria governing your `isMarkerVisible` method have changed.\n */\n public requestSync(): void {\n if (this.syncImmediately) {\n this.sync();\n } else if (!this._needSync) {\n this._needSync = true;\n requestAnimationFrame(() => this.sync());\n }\n }\n\n private sync(): void {\n this._needSync = false;\n if (HyperModeling.isInitialized && this.viewport.view.is3d() && this.updateMarkerVisibility()) {\n this.markers.markDirty();\n this.viewport.invalidateCachedDecorations(this);\n }\n }\n\n private isMarkerVisible(marker: SectionMarker): boolean {\n if (undefined !== this.activeMarker)\n return marker === this.activeMarker;\n\n return HyperModeling.markerHandler.isMarkerVisible(marker, this, this._config);\n }\n\n private updateMarkerVisibility(): boolean {\n let changed = false;\n for (const marker of this.markers.markers) {\n const wasVisible = marker.visible;\n marker.visible = this.isMarkerVisible(marker);\n changed = changed || (marker.visible !== wasVisible);\n }\n\n return changed;\n }\n}\n"]}
@@ -174,7 +174,7 @@ export class HyperModeling {
174
174
  return this._start(viewport);
175
175
  }
176
176
  else {
177
- decorator?.dispose();
177
+ decorator?.[Symbol.dispose]();
178
178
  return undefined;
179
179
  }
180
180
  }
@@ -209,7 +209,7 @@ export class HyperModeling {
209
209
  */
210
210
  static stop(viewport) {
211
211
  const decorator = HyperModelingDecorator.getForViewport(viewport);
212
- decorator?.dispose();
212
+ decorator?.[Symbol.dispose]();
213
213
  }
214
214
  /** @internal */
215
215
  static get namespace() {
@@ -1 +1 @@
1
- {"version":3,"file":"HyperModeling.js","sourceRoot":"","sources":["../../src/HyperModeling.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAoC,sBAAsB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtH,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AA0B9D,SAAS,iBAAiB,CAAC,KAAuB;IAChD,IAAI,SAAS,KAAK,KAAK,CAAC,SAAS;QAC/B,MAAM,IAAI,KAAK,CAAC,+EAA+E,CAAC,CAAC;AACrG,CAAC;AAED;;;;;GAKG;AACH,MAAM,OAAO,aAAa;aAIT,kBAAa,GAAwB,EAAE,CAAC;aACxC,oBAAe,GAA0B,EAAE,CAAC;IAEnD,MAAM,CAAC,QAAQ;QACrB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;QAChC,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;QACxB,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;IAC5B,CAAC;IAED;;OAEG;IACI,MAAM,KAAK,aAAa;QAC7B,OAAO,SAAS,KAAK,IAAI,CAAC,SAAS,CAAC;IACtC,CAAC;IAED;;;;;;;;;OASG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,MAA4B;QACzD,IAAI,SAAS,KAAK,IAAI,CAAC,SAAS,EAAE,CAAC;YACjC,IAAI,CAAC,o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C,IAAI,CAAC,aAAa,EAAE,CAAC;YAC9B,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;YAC3D,QAAQ,CAAC,aAAa,EAAE,CAAC;QAC3B,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,IAAI,CAAC,QAAwB;QACzC,MAAM,SAAS,GAAG,sBAAsB,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QAClE,SAAS,EAAE,OAAO,EAAE,CAAC;IACvB,CAAC;IAED,gBAAgB;IACT,MAAM,KAAK,SAAS;QACzB,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACxB,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;IAClC,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,aAAa,CAAC,IAAiB;QAC3C,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACxB,QAAQ,IAAI,EAAE,CAAC;YACb,KAAK,WAAW,CAAC,IAAI;gBACnB,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC;YACrC,KAAK,WAAW,CAAC,SAAS;gBACxB,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC;YAC1C,KAAK,WAAW,CAAC,MAAM;gBACrB,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC;YACvC;gBACE,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC;QAC1C,CAAC;IACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module HyperModeling\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { SectionType } from \"@itwin/core-common\";\r\nimport { IModelApp, IModelConnection, ScreenViewport, tryImageElementFromUrl, ViewManip } from \"@itwin/core-frontend\";\r\nimport { registerTools } from \"./Tools\";\r\nimport { HyperModelingDecorator } from \"./HyperModelingDecorator\";\r\nimport { HyperModelingConfig, SectionGraphicsConfig, SectionMarkerConfig } from \"./HyperModelingConfig\";\r\nimport { SectionMarkerHandler } from \"./SectionMarkerHandler\";\r\n\r\n/** @internal */\r\nexport interface MarkerData {\r\n readonly label: string;\r\n readonly image: HTMLImageElement | undefined;\r\n}\r\n\r\ninterface Resources {\r\n readonly namespace?: string;\r\n readonly markers: {\r\n readonly section: MarkerData;\r\n readonly plan: MarkerData;\r\n readonly elevation: MarkerData;\r\n readonly detail: MarkerData;\r\n };\r\n}\r\n\r\ninterface MaybeInitialized {\r\n resources?: Resources;\r\n}\r\n\r\ninterface Initialized {\r\n resources: Resources;\r\n}\r\n\r\nfunction assertInitialized(maybe: MaybeInitialized): asserts maybe is Initialized {\r\n if (undefined === maybe.resources)\r\n throw new Error(\"You must call HyperModeling.initialize before using the hypermodeling package\");\r\n}\r\n\r\n/** The API entry point for the hypermodeling package. Applications must call [[initialize]] and await the result before using the package.\r\n * The behavior of the package can be customized via a [[HyperModelingConfig]] supplied to [[initialize]], [[updateConfiguration]], or [[replaceConfiguration]].\r\n * Hypermodeling mode can be enabled or disabled via [[startOrStop]], which returns a [[HyperModelingDecorator]] when enabling hypermodeling.\r\n * Consult the package's `README.md` for a description of the available functionality.\r\n * @public\r\n */\r\nexport class HyperModeling {\r\n /** @internal */\r\n public static resources?: Resources;\r\n private static _markerHandler?: SectionMarkerHandler;\r\n private static _markerConfig: SectionMarkerConfig = {};\r\n private static _graphicsConfig: SectionGraphicsConfig = {};\r\n\r\n private static shutdown() {\r\n this.resources = undefined;\r\n this._markerHandler = undefined;\r\n this._markerConfig = {};\r\n this._graphicsConfig = {};\r\n }\r\n\r\n /** Returns whether the hypermodeling package is initialized.\r\n * @see [[HyperModeling.initialize]] to initialize the package.\r\n */\r\n public static get isInitialized(): boolean {\r\n return undefined !== this.resources;\r\n }\r\n\r\n /** Invoke this method to initialize the hypermodeling package for use. You *must* await the result before using any of this package's APIs.\r\n * Typically an application would invoke this after [IModelApp.startup]($frontend), e.g.,\r\n * ```ts\r\n * await IModelApp.startup();\r\n * await HyperModeling.initialize();\r\n * ```\r\n * Calling this method again after the first initialization behaves the same as calling [[HyperModeling.replaceConfiguration]].\r\n * @note The hypermodeling package will be reset to uninitialized after [IModelApp.shutdown]($frontend) is invoked.\r\n * @see [[replaceConfiguration]] and [[updateConfiguration]] to modify the configuration after initialization.\r\n */\r\n public static async initialize(config?: HyperModelingConfig): Promise<void> {\r\n if (undefined !== this.resources) {\r\n this.replaceConfiguration(config);\r\n return;\r\n }\r\n\r\n // clean up if we're being shut down\r\n IModelApp.onBeforeShutdown.addListener(() => this.shutdown());\r\n\r\n const namespace = \"HyperModeling\";\r\n await IModelApp.localization.registerNamespace(namespace);\r\n\r\n const loadImages = [\r\n tryImageElementFromUrl(`${IModelApp.publicPath}section-marker.svg`),\r\n tryImageElementFromUrl(`${IModelApp.publicPath}detail-marker.svg`),\r\n tryImageElementFromUrl(`${IModelApp.publicPath}elevation-marker.svg`),\r\n tryImageElementFromUrl(`${IModelApp.publicPath}plan-marker.svg`),\r\n ];\r\n\r\n const images = await Promise.all(loadImages);\r\n this.resources = {\r\n namespace,\r\n markers: {\r\n section: { image: images[0], label: IModelApp.localization.getLocalizedString(\"HyperModeling:Message.SectionCallout\") },\r\n detail: { image: images[1], label: IModelApp.localization.getLocalizedString(\"HyperModeling:Message.DetailCallout\") },\r\n elevation: { image: images[2], label: IModelApp.localization.getLocalizedString(\"HyperModeling:Message.ElevationCallout\") },\r\n plan: { image: images[3], label: IModelApp.localization.getLocalizedString(\"HyperModeling:Message.PlanCallout\") },\r\n },\r\n };\r\n\r\n registerTools(namespace);\r\n this.replaceConfiguration(config);\r\n }\r\n\r\n private static async ensureInitialized(): Promise<void> {\r\n if (undefined === this.resources)\r\n await this.initialize();\r\n\r\n assertInitialized(this);\r\n }\r\n\r\n /** Replaces the current package configuration, overwriting all previous settings. Passing `undefined` resets all settings to defaults.\r\n * @see [[HyperModeling.updateConfiguration]] for overriding specific aspects of the configuration.\r\n */\r\n public static replaceConfiguration(config?: HyperModelingConfig): void {\r\n config = config ?? {};\r\n this._markerHandler = config.markerHandler ?? new SectionMarkerHandler();\r\n this._markerConfig = config.markers ? { ...config.markers } : {};\r\n this._graphicsConfig = config.graphics ? { ...config.graphics } : {};\r\n }\r\n\r\n /** Overrides specific aspects of the current package configuration. Any field that is not `undefined` will be replaced in the current configuration;\r\n * the rest will retain their current values.\r\n * @see [[HyperModeling.replaceConfiguration]].\r\n */\r\n public static updateConfiguration(config: HyperModelingConfig): void {\r\n this._markerHandler = config.markerHandler ?? this._markerHandler;\r\n\r\n if (config.markers) {\r\n this._markerConfig = {\r\n ignoreModelSelector: config.markers.ignoreModelSelector ?? this._markerConfig.ignoreModelSelector,\r\n ignoreCategorySelector: config.markers.ignoreCategorySelector ?? this._markerConfig.ignoreCategorySelector,\r\n hiddenSectionTypes: config.markers.hiddenSectionTypes ?? this._markerConfig.hiddenSectionTypes,\r\n };\r\n }\r\n\r\n if (config.graphics) {\r\n this._graphicsConfig = {\r\n ignoreClip: config.graphics.ignoreClip ?? this._graphicsConfig.ignoreClip,\r\n debugClipVolumes: config.graphics.debugClipVolumes ?? this._graphicsConfig.debugClipVolumes,\r\n hideSectionGraphics: config.graphics.hideSectionGraphics ?? this._graphicsConfig.hideSectionGraphics,\r\n hideSheetAnnotations: config.graphics.hideSheetAnnotations ?? this._graphicsConfig.hideSheetAnnotations,\r\n };\r\n\r\n IModelApp.viewManager.invalidateViewportScenes();\r\n }\r\n }\r\n\r\n /** The handler that defines interactions with [[SectionMarker]]s.\r\n * @see [[initialize]] to override the default handler at package initialization.\r\n * @see [[updateConfiguration]] or [[replaceConfiguration]] to change the current handler.\r\n */\r\n public static get markerHandler(): SectionMarkerHandler {\r\n assertInitialized(this);\r\n assert(undefined !== this._markerHandler);\r\n return this._markerHandler;\r\n }\r\n\r\n /** The current marker display configuration applied to any newly-created [[HyperModelingDecorator]]s.\r\n * @see [[initialize]] to override the default configuration at package initialization.\r\n * @see [[updateConfiguration]] or [[replaceConfiguration]] to change the current configuration.\r\n * @see [[HyperModelingDecorator.replaceConfiguration]] or [[HyperModelingDecorator.updateConfiguration]] to change the configuration for an existing decorator.\r\n */\r\n public static get markerConfig(): SectionMarkerConfig {\r\n return this._markerConfig;\r\n }\r\n\r\n /** This graphics options applied to graphics displayed by all [[HyperModelingDecorator]]s.\r\n * @see [[updateConfiguration]] or [[replaceConfiguration]] to change the current configuration.\r\n */\r\n public static get graphicsConfig(): SectionGraphicsConfig {\r\n return this._graphicsConfig;\r\n }\r\n\r\n /** Returns true if the specified iModel contains any [SectionDrawingLocation]($backend)s. Hypermodeling is based on section drawing locations,\r\n * so if none are present, hypermodeling features are not relevant to the iModel. Attempting to use those features with such an iModel is fine,\r\n * but probably not useful.\r\n */\r\n public static async isSupportedForIModel(imodel: IModelConnection): Promise<boolean> {\r\n try {\r\n const reader = imodel.createQueryReader(\"SELECT ECInstanceId FROM bis.SectionDrawingLocation LIMIT 1\");\r\n return await reader.step(); // i.e., are any results are returned?\r\n } catch {\r\n // An iModel with a version of BisCore older than 1.0.11 will produce an expected \"table not found\" on the SectionDrawingLocation ECClass.\r\n return false;\r\n }\r\n }\r\n\r\n /** Returns whether hypermodeling is currently enabled for the specified viewport.\r\n * @see [[startOrStop]] to enable or disable hypermodeling for a viewport.\r\n */\r\n public static isEnabledForViewport(viewport: ScreenViewport): boolean {\r\n return undefined !== HyperModelingDecorator.getForViewport(viewport);\r\n }\r\n\r\n /** Start or stop hypermodeling mode for the specified viewport.\r\n * Enabling hypermodeling registers and returns a [[HyperModelingDecorator]] to display [[SectionMarker]]s within the viewport.\r\n * Disabling hypermodeling removes that decorator.\r\n * @param viewport The hypermodeling viewport\r\n * @param start `true` to enter hypermodeling mode, `false` to exit, or `undefined` to toggle the current mode.\r\n * @returns The new decorator is hypermodeling was successfully enabled.\r\n * @note Enabling hypermodeling may fail if the viewport is not viewing a spatial model or if the viewport's iModel does not support hypermodeling.\r\n * @see [[start]] and [[stop]].\r\n * @see [[isSupportedForIModel]].\r\n */\r\n public static async startOrStop(viewport: ScreenViewport, start?: boolean): Promise<HyperModelingDecorator | undefined> {\r\n // Help out the caller since we're async anyway...\r\n await this.ensureInitialized();\r\n\r\n const decorator = HyperModelingDecorator.getForViewport(viewport);\r\n if (undefined === start)\r\n start = undefined === decorator;\r\n\r\n if (start) {\r\n return this._start(viewport);\r\n } else {\r\n decorator?.dispose();\r\n return undefined;\r\n }\r\n }\r\n\r\n /** Start hypermodeling mode for the specified viewport if it is not currently enabled.\r\n * If hypermodeling is already enabled for the viewport, the existing decorator is returned; otherwise, a new decorator is created.\r\n * @param viewport The viewport for which to enable hypermodeling\r\n * @returns The decorator that implements hypermodeling features for the viewport, or `undefined` if hypermodeling could not be enabled.\r\n * @note Enabling hypermodeling may fail if the viewport is not viewing a spatial model or if the viewport's iModel does not support hypermodeling.\r\n */\r\n public static async start(viewport: ScreenViewport): Promise<HyperModelingDecorator | undefined> {\r\n await this.ensureInitialized();\r\n return this._start(viewport);\r\n }\r\n\r\n private static async _start(viewport: ScreenViewport): Promise<HyperModelingDecorator | undefined> {\r\n assertInitialized(this);\r\n if (!viewport.view.isSpatialView())\r\n return undefined;\r\n\r\n let decorator = HyperModelingDecorator.getForViewport(viewport);\r\n if (!decorator)\r\n decorator = await HyperModelingDecorator.create(viewport, this._markerConfig);\r\n\r\n if (undefined !== decorator && viewport.view.isCameraOn) {\r\n // We want the 2d graphics to align with the 3d geometry. Perspective ruins that.\r\n viewport.view.turnCameraOff();\r\n ViewManip.fitView(viewport, false, { noSaveInUndo: true });\r\n viewport.clearViewUndo();\r\n }\r\n\r\n return decorator;\r\n }\r\n\r\n /** Stop hypermodeling mode for the specified viewport if it is currently enabled. This disposes of the [[HyperModelingDecorator]] associated with the viewport.\r\n * @see [[start]] to enable hypermodeling for a viewport.\r\n * @see [[startOrStop]] to toggle hypermodeling mode.\r\n */\r\n public static stop(viewport: ScreenViewport): void {\r\n const decorator = HyperModelingDecorator.getForViewport(viewport);\r\n decorator?.dispose();\r\n }\r\n\r\n /** @internal */\r\n public static get namespace(): string | undefined {\r\n assertInitialized(this);\r\n return this.resources.namespace;\r\n }\r\n\r\n /** @internal */\r\n public static getMarkerData(type: SectionType): MarkerData {\r\n assertInitialized(this);\r\n switch (type) {\r\n case SectionType.Plan:\r\n return this.resources.markers.plan;\r\n case SectionType.Elevation:\r\n return this.resources.markers.elevation;\r\n case SectionType.Detail:\r\n return this.resources.markers.detail;\r\n default:\r\n return this.resources.markers.section;\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"HyperModeling.js","sourceRoot":"","sources":["../../src/HyperModeling.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAoC,sBAAsB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtH,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AA0B9D,SAAS,iBAAiB,CAAC,KAAuB;IAChD,IAAI,SAAS,KAAK,KAAK,CAAC,SAAS;QAC/B,MAAM,IAAI,KAAK,CAAC,+EAA+E,CAAC,CAAC;AACrG,CAAC;AAED;;;;;GAKG;AACH,MAAM,OAAO,aAAa;aAIT,kBAAa,GAAwB,EAAE,CAAC;aACxC,oBAAe,GAA0B,EAAE,CAAC;IAEnD,MAAM,CAAC,QAAQ;QACrB,IAAI,CAAC,SA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C,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC;YAC1C,KAAK,WAAW,CAAC,MAAM;gBACrB,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC;YACvC;gBACE,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC;QAC1C,CAAC;IACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module HyperModeling\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { SectionType } from \"@itwin/core-common\";\r\nimport { IModelApp, IModelConnection, ScreenViewport, tryImageElementFromUrl, ViewManip } from \"@itwin/core-frontend\";\r\nimport { registerTools } from \"./Tools\";\r\nimport { HyperModelingDecorator } from \"./HyperModelingDecorator\";\r\nimport { HyperModelingConfig, SectionGraphicsConfig, SectionMarkerConfig } from \"./HyperModelingConfig\";\r\nimport { SectionMarkerHandler } from \"./SectionMarkerHandler\";\r\n\r\n/** @internal */\r\nexport interface MarkerData {\r\n readonly label: string;\r\n readonly image: HTMLImageElement | undefined;\r\n}\r\n\r\ninterface Resources {\r\n readonly namespace?: string;\r\n readonly markers: {\r\n readonly section: MarkerData;\r\n readonly plan: MarkerData;\r\n readonly elevation: MarkerData;\r\n readonly detail: MarkerData;\r\n };\r\n}\r\n\r\ninterface MaybeInitialized {\r\n resources?: Resources;\r\n}\r\n\r\ninterface Initialized {\r\n resources: Resources;\r\n}\r\n\r\nfunction assertInitialized(maybe: MaybeInitialized): asserts maybe is Initialized {\r\n if (undefined === maybe.resources)\r\n throw new Error(\"You must call HyperModeling.initialize before using the hypermodeling package\");\r\n}\r\n\r\n/** The API entry point for the hypermodeling package. Applications must call [[initialize]] and await the result before using the package.\r\n * The behavior of the package can be customized via a [[HyperModelingConfig]] supplied to [[initialize]], [[updateConfiguration]], or [[replaceConfiguration]].\r\n * Hypermodeling mode can be enabled or disabled via [[startOrStop]], which returns a [[HyperModelingDecorator]] when enabling hypermodeling.\r\n * Consult the package's `README.md` for a description of the available functionality.\r\n * @public\r\n */\r\nexport class HyperModeling {\r\n /** @internal */\r\n public static resources?: Resources;\r\n private static _markerHandler?: SectionMarkerHandler;\r\n private static _markerConfig: SectionMarkerConfig = {};\r\n private static _graphicsConfig: SectionGraphicsConfig = {};\r\n\r\n private static shutdown() {\r\n this.resources = undefined;\r\n this._markerHandler = undefined;\r\n this._markerConfig = {};\r\n this._graphicsConfig = {};\r\n }\r\n\r\n /** Returns whether the hypermodeling package is initialized.\r\n * @see [[HyperModeling.initialize]] to initialize the package.\r\n */\r\n public static get isInitialized(): boolean {\r\n return undefined !== this.resources;\r\n }\r\n\r\n /** Invoke this method to initialize the hypermodeling package for use. You *must* await the result before using any of this package's APIs.\r\n * Typically an application would invoke this after [IModelApp.startup]($frontend), e.g.,\r\n * ```ts\r\n * await IModelApp.startup();\r\n * await HyperModeling.initialize();\r\n * ```\r\n * Calling this method again after the first initialization behaves the same as calling [[HyperModeling.replaceConfiguration]].\r\n * @note The hypermodeling package will be reset to uninitialized after [IModelApp.shutdown]($frontend) is invoked.\r\n * @see [[replaceConfiguration]] and [[updateConfiguration]] to modify the configuration after initialization.\r\n */\r\n public static async initialize(config?: HyperModelingConfig): Promise<void> {\r\n if (undefined !== this.resources) {\r\n this.replaceConfiguration(config);\r\n return;\r\n }\r\n\r\n // clean up if we're being shut down\r\n IModelApp.onBeforeShutdown.addListener(() => this.shutdown());\r\n\r\n const namespace = \"HyperModeling\";\r\n await IModelApp.localization.registerNamespace(namespace);\r\n\r\n const loadImages = [\r\n tryImageElementFromUrl(`${IModelApp.publicPath}section-marker.svg`),\r\n tryImageElementFromUrl(`${IModelApp.publicPath}detail-marker.svg`),\r\n tryImageElementFromUrl(`${IModelApp.publicPath}elevation-marker.svg`),\r\n tryImageElementFromUrl(`${IModelApp.publicPath}plan-marker.svg`),\r\n ];\r\n\r\n const images = await Promise.all(loadImages);\r\n this.resources = {\r\n namespace,\r\n markers: {\r\n section: { image: images[0], label: IModelApp.localization.getLocalizedString(\"HyperModeling:Message.SectionCallout\") },\r\n detail: { image: images[1], label: IModelApp.localization.getLocalizedString(\"HyperModeling:Message.DetailCallout\") },\r\n elevation: { image: images[2], label: IModelApp.localization.getLocalizedString(\"HyperModeling:Message.ElevationCallout\") },\r\n plan: { image: images[3], label: IModelApp.localization.getLocalizedString(\"HyperModeling:Message.PlanCallout\") },\r\n },\r\n };\r\n\r\n registerTools(namespace);\r\n this.replaceConfiguration(config);\r\n }\r\n\r\n private static async ensureInitialized(): Promise<void> {\r\n if (undefined === this.resources)\r\n await this.initialize();\r\n\r\n assertInitialized(this);\r\n }\r\n\r\n /** Replaces the current package configuration, overwriting all previous settings. Passing `undefined` resets all settings to defaults.\r\n * @see [[HyperModeling.updateConfiguration]] for overriding specific aspects of the configuration.\r\n */\r\n public static replaceConfiguration(config?: HyperModelingConfig): void {\r\n config = config ?? {};\r\n this._markerHandler = config.markerHandler ?? new SectionMarkerHandler();\r\n this._markerConfig = config.markers ? { ...config.markers } : {};\r\n this._graphicsConfig = config.graphics ? { ...config.graphics } : {};\r\n }\r\n\r\n /** Overrides specific aspects of the current package configuration. Any field that is not `undefined` will be replaced in the current configuration;\r\n * the rest will retain their current values.\r\n * @see [[HyperModeling.replaceConfiguration]].\r\n */\r\n public static updateConfiguration(config: HyperModelingConfig): void {\r\n this._markerHandler = config.markerHandler ?? this._markerHandler;\r\n\r\n if (config.markers) {\r\n this._markerConfig = {\r\n ignoreModelSelector: config.markers.ignoreModelSelector ?? this._markerConfig.ignoreModelSelector,\r\n ignoreCategorySelector: config.markers.ignoreCategorySelector ?? this._markerConfig.ignoreCategorySelector,\r\n hiddenSectionTypes: config.markers.hiddenSectionTypes ?? this._markerConfig.hiddenSectionTypes,\r\n };\r\n }\r\n\r\n if (config.graphics) {\r\n this._graphicsConfig = {\r\n ignoreClip: config.graphics.ignoreClip ?? this._graphicsConfig.ignoreClip,\r\n debugClipVolumes: config.graphics.debugClipVolumes ?? this._graphicsConfig.debugClipVolumes,\r\n hideSectionGraphics: config.graphics.hideSectionGraphics ?? this._graphicsConfig.hideSectionGraphics,\r\n hideSheetAnnotations: config.graphics.hideSheetAnnotations ?? this._graphicsConfig.hideSheetAnnotations,\r\n };\r\n\r\n IModelApp.viewManager.invalidateViewportScenes();\r\n }\r\n }\r\n\r\n /** The handler that defines interactions with [[SectionMarker]]s.\r\n * @see [[initialize]] to override the default handler at package initialization.\r\n * @see [[updateConfiguration]] or [[replaceConfiguration]] to change the current handler.\r\n */\r\n public static get markerHandler(): SectionMarkerHandler {\r\n assertInitialized(this);\r\n assert(undefined !== this._markerHandler);\r\n return this._markerHandler;\r\n }\r\n\r\n /** The current marker display configuration applied to any newly-created [[HyperModelingDecorator]]s.\r\n * @see [[initialize]] to override the default configuration at package initialization.\r\n * @see [[updateConfiguration]] or [[replaceConfiguration]] to change the current configuration.\r\n * @see [[HyperModelingDecorator.replaceConfiguration]] or [[HyperModelingDecorator.updateConfiguration]] to change the configuration for an existing decorator.\r\n */\r\n public static get markerConfig(): SectionMarkerConfig {\r\n return this._markerConfig;\r\n }\r\n\r\n /** This graphics options applied to graphics displayed by all [[HyperModelingDecorator]]s.\r\n * @see [[updateConfiguration]] or [[replaceConfiguration]] to change the current configuration.\r\n */\r\n public static get graphicsConfig(): SectionGraphicsConfig {\r\n return this._graphicsConfig;\r\n }\r\n\r\n /** Returns true if the specified iModel contains any [SectionDrawingLocation]($backend)s. Hypermodeling is based on section drawing locations,\r\n * so if none are present, hypermodeling features are not relevant to the iModel. Attempting to use those features with such an iModel is fine,\r\n * but probably not useful.\r\n */\r\n public static async isSupportedForIModel(imodel: IModelConnection): Promise<boolean> {\r\n try {\r\n const reader = imodel.createQueryReader(\"SELECT ECInstanceId FROM bis.SectionDrawingLocation LIMIT 1\");\r\n return await reader.step(); // i.e., are any results are returned?\r\n } catch {\r\n // An iModel with a version of BisCore older than 1.0.11 will produce an expected \"table not found\" on the SectionDrawingLocation ECClass.\r\n return false;\r\n }\r\n }\r\n\r\n /** Returns whether hypermodeling is currently enabled for the specified viewport.\r\n * @see [[startOrStop]] to enable or disable hypermodeling for a viewport.\r\n */\r\n public static isEnabledForViewport(viewport: ScreenViewport): boolean {\r\n return undefined !== HyperModelingDecorator.getForViewport(viewport);\r\n }\r\n\r\n /** Start or stop hypermodeling mode for the specified viewport.\r\n * Enabling hypermodeling registers and returns a [[HyperModelingDecorator]] to display [[SectionMarker]]s within the viewport.\r\n * Disabling hypermodeling removes that decorator.\r\n * @param viewport The hypermodeling viewport\r\n * @param start `true` to enter hypermodeling mode, `false` to exit, or `undefined` to toggle the current mode.\r\n * @returns The new decorator is hypermodeling was successfully enabled.\r\n * @note Enabling hypermodeling may fail if the viewport is not viewing a spatial model or if the viewport's iModel does not support hypermodeling.\r\n * @see [[start]] and [[stop]].\r\n * @see [[isSupportedForIModel]].\r\n */\r\n public static async startOrStop(viewport: ScreenViewport, start?: boolean): Promise<HyperModelingDecorator | undefined> {\r\n // Help out the caller since we're async anyway...\r\n await this.ensureInitialized();\r\n\r\n const decorator = HyperModelingDecorator.getForViewport(viewport);\r\n if (undefined === start)\r\n start = undefined === decorator;\r\n\r\n if (start) {\r\n return this._start(viewport);\r\n } else {\r\n decorator?.[Symbol.dispose]();\r\n return undefined;\r\n }\r\n }\r\n\r\n /** Start hypermodeling mode for the specified viewport if it is not currently enabled.\r\n * If hypermodeling is already enabled for the viewport, the existing decorator is returned; otherwise, a new decorator is created.\r\n * @param viewport The viewport for which to enable hypermodeling\r\n * @returns The decorator that implements hypermodeling features for the viewport, or `undefined` if hypermodeling could not be enabled.\r\n * @note Enabling hypermodeling may fail if the viewport is not viewing a spatial model or if the viewport's iModel does not support hypermodeling.\r\n */\r\n public static async start(viewport: ScreenViewport): Promise<HyperModelingDecorator | undefined> {\r\n await this.ensureInitialized();\r\n return this._start(viewport);\r\n }\r\n\r\n private static async _start(viewport: ScreenViewport): Promise<HyperModelingDecorator | undefined> {\r\n assertInitialized(this);\r\n if (!viewport.view.isSpatialView())\r\n return undefined;\r\n\r\n let decorator = HyperModelingDecorator.getForViewport(viewport);\r\n if (!decorator)\r\n decorator = await HyperModelingDecorator.create(viewport, this._markerConfig);\r\n\r\n if (undefined !== decorator && viewport.view.isCameraOn) {\r\n // We want the 2d graphics to align with the 3d geometry. Perspective ruins that.\r\n viewport.view.turnCameraOff();\r\n ViewManip.fitView(viewport, false, { noSaveInUndo: true });\r\n viewport.clearViewUndo();\r\n }\r\n\r\n return decorator;\r\n }\r\n\r\n /** Stop hypermodeling mode for the specified viewport if it is currently enabled. This disposes of the [[HyperModelingDecorator]] associated with the viewport.\r\n * @see [[start]] to enable hypermodeling for a viewport.\r\n * @see [[startOrStop]] to toggle hypermodeling mode.\r\n */\r\n public static stop(viewport: ScreenViewport): void {\r\n const decorator = HyperModelingDecorator.getForViewport(viewport);\r\n decorator?.[Symbol.dispose]();\r\n }\r\n\r\n /** @internal */\r\n public static get namespace(): string | undefined {\r\n assertInitialized(this);\r\n return this.resources.namespace;\r\n }\r\n\r\n /** @internal */\r\n public static getMarkerData(type: SectionType): MarkerData {\r\n assertInitialized(this);\r\n switch (type) {\r\n case SectionType.Plan:\r\n return this.resources.markers.plan;\r\n case SectionType.Elevation:\r\n return this.resources.markers.elevation;\r\n case SectionType.Detail:\r\n return this.resources.markers.detail;\r\n default:\r\n return this.resources.markers.section;\r\n }\r\n }\r\n}\r\n"]}
@@ -64,7 +64,7 @@ export declare class HyperModelingDecorator implements Decorator {
64
64
  private toggleMarker;
65
65
  private dropTiledGraphicsProvider;
66
66
  /** @internal */
67
- dispose(): void;
67
+ [Symbol.dispose](): void;
68
68
  private showToolbarAfterTimeout;
69
69
  /** Toggles whether the clip volume associated with the specified marker is applied to the view. */
70
70
  toggleClipVolume(marker: SectionMarker, enable: boolean): void;
@@ -1 +1 @@
1
- {"version":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perModelingDecorator {
138
138
  this.requestSync();
139
139
  });
140
140
  this._removeEventListeners.push(this.viewport.onViewportChanged.addListener((_, changeFlags) => this.onViewportChanged(changeFlags)));
141
- this._removeEventListeners.push(this.viewport.onDisposed.addListener(() => this.dispose()));
141
+ this._removeEventListeners.push(this.viewport.onDisposed.addListener(() => this[Symbol.dispose]()));
142
142
  for (const marker of markers.markers) {
143
143
  marker.onMouseEnterEvent.addListener((mkr) => this.showToolbarAfterTimeout(mkr));
144
144
  marker.onMouseButtonEvent.addListener((mkr) => this.toggleMarker(mkr)); // eslint-disable-line @typescript-eslint/promise-function-async
@@ -148,7 +148,7 @@ export class HyperModelingDecorator {
148
148
  }
149
149
  onViewportChanged(changeFlags) {
150
150
  if (this.viewport.iModel !== this._iModel) {
151
- this.dispose();
151
+ this[Symbol.dispose]();
152
152
  return;
153
153
  }
154
154
  if (changeFlags.viewedCategories || changeFlags.viewedModels || changeFlags.viewedCategoriesPerModel)
@@ -171,7 +171,7 @@ export class HyperModelingDecorator {
171
171
  this._tiledGraphicsProvider = undefined;
172
172
  }
173
173
  /** @internal */
174
- dispose() {
174
+ [Symbol.dispose]() {
175
175
  if (!IModelApp.viewManager.dropDecorator(this))
176
176
  return;
177
177
  for (const remove of this._removeEventListeners)
@@ -1 +1 @@
1
- {"version":3,"file":"HyperModelingDecorator.js","sourceRoot":"","sources":["../../src/HyperModelingDecorator.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAS,MAAM,sBAAsB,CAAC;AAExD,OAAO,EACoC,SAAS,EAA6E,YAAY,GAC5I,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAA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jF,CAAC;IAEO,sBAAsB;QAC5B,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YAC1C,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC;YAClC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YAC9C,OAAO,GAAG,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC;QACvD,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module HyperModeling\n */\n\nimport { Transform, XAndY } from \"@itwin/core-geometry\";\nimport type { AbstractToolbarProps } from \"@itwin/appui-abstract\";\nimport {\n ChangeFlags, DecorateContext, Decorator, IModelApp, IModelConnection, ScreenViewport, SpatialViewState, TiledGraphicsProvider, ViewClipTool,\n} from \"@itwin/core-frontend\";\nimport { SectionMarker, SectionMarkerSet } from \"./SectionMarkers\";\nimport { SectionDrawingLocationState } from \"./SectionDrawingLocationState\";\nimport { createSectionGraphicsProvider } from \"./SectionGraphicsProvider\";\nimport { PopupToolbarManager, PopupToolbarProvider } from \"./PopupToolbar\";\nimport { HyperModeling } from \"./HyperModeling\";\nimport { SectionMarkerConfig } from \"./HyperModelingConfig\";\n\nasync function createMarkers(vp: ScreenViewport): Promise<SectionMarkerSet | undefined> {\n if (!vp.view.isSpatialView())\n return undefined;\n\n const states = await SectionDrawingLocationState.queryAll(vp.iModel);\n if (0 === states.length)\n return undefined;\n\n const markers = states.map((state) => new SectionMarker(state));\n return new SectionMarkerSet(vp, markers);\n}\n\nclass MarkerToolbarProvider implements PopupToolbarProvider {\n private readonly _viewport: ScreenViewport;\n public readonly marker: SectionMarker;\n public readonly toolbarProps: AbstractToolbarProps;\n public readonly onToolbarItemExecuted: (id: string) => void;\n\n public constructor(marker: SectionMarker, decorator: HyperModelingDecorator) {\n this.marker = marker;\n this._viewport = decorator.viewport;\n this.toolbarProps = HyperModeling.markerHandler.getToolbarProps(marker, decorator);\n this.onToolbarItemExecuted = (id) => HyperModeling.markerHandler.executeCommand(id, marker, decorator); // eslint-disable-line @typescript-eslint/promise-function-async\n }\n\n public get overToolbarHotspot() {\n return this.marker.isHilited;\n }\n\n public get toolbarLocation(): XAndY {\n return { x: this.marker.rect.right, y: this.marker.rect.top };\n }\n\n public get htmlElement() {\n return this._viewport.canvas;\n }\n}\n\n/** A [Decorator]($frontend) that displays a [[SectionMarker]] for each [SectionDrawingLocation]($backend) in the view.\n * Clicking on a marker toggles the section and the display of associated 2d graphics.\n * Hovering over a marker opens a mini toolbar with additional interactions.\n * @see [[SectionMarkerHandler]] to customize the marker interactions.\n * @see [[HyperModeling.startOrStop]] to enable or disable the decorator for a viewport.\n * @public\n */\nexport class HyperModelingDecorator implements Decorator {\n /** The set of [[SectionMarker]]s controlled by this decorator. */\n public readonly markers: SectionMarkerSet;\n private _config: SectionMarkerConfig;\n private readonly _removeEventListeners = new Array<() => void>();\n private readonly _iModel: IModelConnection;\n private _needSync = false;\n private _toolbarProvider?: MarkerToolbarProvider;\n private _tiledGraphicsProvider?: TiledGraphicsProvider;\n private _activeMarker?: SectionMarker;\n private _appliedSpatialView?: SpatialViewState;\n /** @internal */\n public syncImmediately = false;\n\n /** Create a new decorator and register it with the [ViewManager]($frontend). Typically invoked indirectly via [[HyperModeling.startOrStop]]. */\n public static async create(vp: ScreenViewport, config: SectionMarkerConfig): Promise<HyperModelingDecorator | undefined> {\n const markers = await createMarkers(vp);\n return undefined !== markers ? new HyperModelingDecorator(markers, config) : undefined;\n }\n\n /** Obtain the decorator associated with the specified viewport, if any. */\n public static getForViewport(vp: ScreenViewport): HyperModelingDecorator | undefined {\n for (const decorator of IModelApp.viewManager.decorators)\n if (decorator instanceof HyperModelingDecorator && decorator.viewport === vp)\n return decorator;\n\n return undefined;\n }\n\n /** The viewport into which this decorator draws its [[SectionMarker]]s. */\n public get viewport(): ScreenViewport {\n return this.markers.viewport;\n }\n\n /** The currently active marker. A marker typically becomes active when the user clicks on it.\n * @see [[setActiveMarker]] to change the active marker without user interaction.\n */\n public get activeMarker(): SectionMarker | undefined {\n return this._activeMarker;\n }\n\n /** @internal */\n public get config(): SectionMarkerConfig {\n return this._config;\n }\n\n /** Replaces the current marker display configuration, overwriting all previous settings. Passing `undefined` resets all settings to defaults.\n * @see [[updateConfiguration]] to override specific aspects of the configuration\n * @see [[HyperModeling.replaceConfiguration]] to replace the global configuration.\n */\n public replaceConfiguration(config?: SectionMarkerConfig): void {\n this._config = config ? { ...config } : {};\n this.requestSync();\n }\n\n /** Overrides specific aspects of the current marker display configuration.\n * Any field that is not `undefined` will be replaced in the current configuration; the rest will retain their current values.\n * @see [[replaceConfiguration]] to override all settings.\n * @see [[HyperModeling.updateConfiguration]] to update the global configuration.\n */\n public updateConfiguration(config: SectionMarkerConfig): void {\n this._config = {\n ignoreModelSelector: config.ignoreModelSelector ?? this._config.ignoreModelSelector,\n ignoreCategorySelector: config.ignoreCategorySelector ?? this._config.ignoreCategorySelector,\n hiddenSectionTypes: config.hiddenSectionTypes ?? this._config.hiddenSectionTypes,\n };\n\n this.requestSync();\n }\n\n /** Sets the currently active marker. This function is invoked when the user clicks on a marker, but may also be called manually to produce the same result.\n * Changing the active marker first deactivates the currently active marker, if any; then activates the specified marker, if supplied.\n * Returns false if marker activation fails.\n * @see [[activeMarker]] to obtain the currently active section marker.\n * @see [[SectionMarkerHandler.activateMarker]] to control what happens when a marker is activated.\n * @see [[SectionMarkerHandler.deactivateMarker]] to control what happens when a marker is deactivated.\n */\n public async setActiveMarker(marker: SectionMarker | undefined): Promise<boolean> {\n if (marker === this.activeMarker)\n return true;\n\n if (this.activeMarker) {\n this.activeMarker.setActive(false);\n await HyperModeling.markerHandler.deactivateMarker(this.activeMarker, this);\n this._activeMarker = undefined;\n }\n\n if (marker) {\n if (!await HyperModeling.markerHandler.activateMarker(marker, this)) {\n this.requestSync();\n return false;\n }\n\n marker.setActive(true);\n this._activeMarker = marker;\n }\n\n this.requestSync();\n return true;\n }\n\n /** @internal */\n public readonly useCachedDecorations = true;\n\n /** @internal */\n public decorate(context: DecorateContext): void {\n if (this.viewport.view.is3d())\n this.markers.addDecoration(context);\n }\n\n private constructor(markers: SectionMarkerSet, config: SectionMarkerConfig) {\n this.markers = markers;\n this._config = { ...config };\n this._iModel = this.viewport.iModel;\n\n this.viewport.onChangeView.addOnce(() => {\n this.requestSync();\n });\n\n this._removeEventListeners.push(this.viewport.onViewportChanged.addListener((_, changeFlags) => this.onViewportChanged(changeFlags)));\n this._removeEventListeners.push(this.viewport.onDisposed.addListener(() => this.dispose()));\n\n for (const marker of markers.markers) {\n marker.onMouseEnterEvent.addListener((mkr) => this.showToolbarAfterTimeout(mkr));\n marker.onMouseButtonEvent.addListener((mkr) => this.toggleMarker(mkr)); // eslint-disable-line @typescript-eslint/promise-function-async\n }\n\n this.updateMarkerVisibility();\n IModelApp.viewManager.addDecorator(this);\n }\n\n private onViewportChanged(changeFlags: ChangeFlags): void {\n if (this.viewport.iModel !== this._iModel) {\n this.dispose();\n return;\n }\n\n if (changeFlags.viewedCategories || changeFlags.viewedModels || changeFlags.viewedCategoriesPerModel)\n this.requestSync();\n\n if (changeFlags.viewState) {\n // If we're looking at a different view now, and we did not initiate that, turn off the active marker.\n if (this.viewport.view !== this._appliedSpatialView)\n this.setActiveMarker(undefined); // eslint-disable-line @typescript-eslint/no-floating-promises\n else\n this._appliedSpatialView = undefined;\n }\n }\n\n private async toggleMarker(marker: SectionMarker): Promise<void> {\n await this.setActiveMarker(marker === this.activeMarker ? undefined : marker);\n }\n\n private dropTiledGraphicsProvider(): void {\n if (undefined === this._tiledGraphicsProvider)\n return;\n\n this.viewport.dropTiledGraphicsProvider(this._tiledGraphicsProvider);\n this._tiledGraphicsProvider = undefined;\n }\n\n /** @internal */\n public dispose(): void {\n if (!IModelApp.viewManager.dropDecorator(this))\n return;\n\n for (const remove of this._removeEventListeners)\n remove();\n\n this.dropTiledGraphicsProvider();\n }\n\n private showToolbarAfterTimeout(marker: SectionMarker): void {\n if (this._toolbarProvider?.marker !== marker)\n this._toolbarProvider = new MarkerToolbarProvider(marker, this);\n\n PopupToolbarManager.showToolbarAfterTimeout(this._toolbarProvider);\n }\n\n /** Toggles whether the clip volume associated with the specified marker is applied to the view. */\n public toggleClipVolume(marker: SectionMarker, enable: boolean): void {\n ViewClipTool.enableClipVolume(this.viewport);\n ViewClipTool.setViewClip(this.viewport, enable ? marker.state.clip : undefined);\n }\n\n /** Toggles the specified section marker.\n * Enabling the section applies the frustum and clip volume of the marker's spatial view to the viewport, and displays the 2d section graphics and sheet annotations.\n * Disabling the section disables the clip volume and 2d graphics.\n * @see [[toggleClipVolume]] to toggle only the clip volume.\n * @see [[toggleAttachment]] to toggle only the attachment graphics.\n */\n public async toggleSection(marker: SectionMarker, enable: boolean): Promise<boolean> {\n if (enable) {\n if (this.viewport.view.is3d()) {\n // Preserve the view settings; apply only the frustum and clip volume\n const spatialView = await marker.state.tryLoadSpatialView();\n if (!spatialView)\n return false;\n\n const aligned = await this.alignToSpatialView(marker);\n if (!aligned)\n return false;\n\n this.toggleClipVolume(marker, true);\n } else if (!await this.applySpatialView(marker)) {\n return false;\n }\n } else {\n this.toggleClipVolume(marker, false);\n }\n\n this.requestSync();\n return this.toggleAttachment(marker, enable);\n }\n\n /** Toggles display of 2d section graphics and sheet annotations for the specified marker.\n * @see [[toggleSection]] to apply the spatial view and clip volume in addition to the attachment graphics.\n */\n public async toggleAttachment(marker: SectionMarker, enable: boolean): Promise<boolean> {\n this.dropTiledGraphicsProvider();\n if (enable) {\n this._tiledGraphicsProvider = await createSectionGraphicsProvider(marker.state);\n this.viewport.addTiledGraphicsProvider(this._tiledGraphicsProvider);\n }\n\n return true;\n }\n\n /** Aligns the viewport to face the specified marker's section plane. */\n public alignView(marker: SectionMarker): void {\n const placement = marker.state.placement.transform;\n const origin = placement.origin;\n const matrix = placement.matrix;\n\n const vp = this.viewport;\n const targetMatrix = matrix.multiplyMatrixMatrix(vp.rotation);\n const rotateTransform = Transform.createFixedPointAndMatrix(origin, targetMatrix);\n\n const startFrustum = vp.getFrustum();\n const newFrustum = startFrustum.clone();\n newFrustum.multiply(rotateTransform);\n\n if (startFrustum.equals(newFrustum))\n return;\n\n vp.view.setupFromFrustum(newFrustum);\n vp.synchWithView();\n vp.animateFrustumChange();\n }\n\n /** Opens the marker's drawing view in the decorator's viewport. Returns false if the drawing view could not be loaded. */\n public async openSection(marker: SectionMarker): Promise<boolean> {\n const viewState = await marker.state.tryLoadDrawingView();\n if (viewState)\n this.viewport.changeView(viewState);\n\n return undefined !== viewState;\n }\n\n /** Opens marker's sheet view in the decorator's viewport and zooms in on the associated [ViewAttachment]($backend). Returns false if no view\n * attachment exists or the sheet view could not be loaded.\n */\n public async openSheet(marker: SectionMarker): Promise<boolean> {\n if (undefined === marker.state.viewAttachment)\n return false;\n\n const viewState = await marker.state.tryLoadSheetView();\n if (!viewState)\n return false;\n\n this.viewport.changeView(viewState);\n await this.viewport.zoomToElements(marker.state.viewAttachment.id);\n return true;\n }\n\n /** Aligns the view to match the frustum of the spatial view associated with the specified marker.\n * @param marker The marker whose spatial view's frustum should be applied.\n * @returns false if the frustum could not be applied, e.g. because the spatial view could not be loaded or the viewport is viewing a 2d model.\n * @see [[alignView]] to align to the *section plane*, which may differ.\n * @see [[toggleSection]] to also apply the clip volume.\n */\n public async alignToSpatialView(marker: SectionMarker): Promise<boolean> {\n if (!this.viewport.view.is3d())\n return false;\n\n const spatialView = await marker.state.tryLoadSpatialView();\n if (!spatialView)\n return false;\n\n this.viewport.view.setOrigin(spatialView.getOrigin());\n this.viewport.view.setExtents(spatialView.getExtents());\n this.viewport.view.setRotation(spatialView.getRotation());\n this.viewport.synchWithView({ animateFrustumChange: true });\n\n return true;\n }\n\n /** Applies the marker's spatial view - including its clip volume - to the decorator's viewport.\n * Returns false if the spatial view could not be loaded.\n * @see [[toggleSection]].\n * @see [[toggleClipVolume]].\n */\n public async applySpatialView(marker: SectionMarker): Promise<boolean> {\n const viewState = await marker.state.tryLoadSpatialView();\n if (viewState) {\n this._appliedSpatialView = viewState;\n this.viewport.changeView(viewState);\n }\n\n return undefined !== viewState;\n }\n\n /** Request that the visibility of the section markers be recomputed. It is only necessary to call this if you have overridden [[SectionMarkerHandler.isMarkerVisible]]; if so, you should invoke\n * this method when the criteria governing your `isMarkerVisible` method have changed.\n */\n public requestSync(): void {\n if (this.syncImmediately) {\n this.sync();\n } else if (!this._needSync) {\n this._needSync = true;\n requestAnimationFrame(() => this.sync());\n }\n }\n\n private sync(): void {\n this._needSync = false;\n if (HyperModeling.isInitialized && this.viewport.view.is3d() && this.updateMarkerVisibility()) {\n this.markers.markDirty();\n this.viewport.invalidateCachedDecorations(this);\n }\n }\n\n private isMarkerVisible(marker: SectionMarker): boolean {\n if (undefined !== this.activeMarker)\n return marker === this.activeMarker;\n\n return HyperModeling.markerHandler.isMarkerVisible(marker, this, this._config);\n }\n\n private updateMarkerVisibility(): boolean {\n let changed = false;\n for (const marker of this.markers.markers) {\n const wasVisible = marker.visible;\n marker.visible = this.isMarkerVisible(marker);\n changed = changed || (marker.visible !== wasVisible);\n }\n\n return changed;\n }\n}\n"]}
1
+ {"version":3,"file":"HyperModelingDecorator.js","sourceRoot":"","sources":["../../src/HyperModelingDecorator.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAS,MAAM,sBAAsB,CAAC;AAExD,OAAO,EACoC,SAAS,EAA6E,YAAY,GAC5I,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,2BAA2B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K,IAAI,CAAC,YAAY;YACjC,OAAO,MAAM,KAAK,IAAI,CAAC,YAAY,CAAC;QAEtC,OAAO,aAAa,CAAC,aAAa,CAAC,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACjF,CAAC;IAEO,sBAAsB;QAC5B,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YAC1C,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC;YAClC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YAC9C,OAAO,GAAG,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC;QACvD,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module HyperModeling\n */\n\nimport { Transform, XAndY } from \"@itwin/core-geometry\";\nimport type { AbstractToolbarProps } from \"@itwin/appui-abstract\";\nimport {\n ChangeFlags, DecorateContext, Decorator, IModelApp, IModelConnection, ScreenViewport, SpatialViewState, TiledGraphicsProvider, ViewClipTool,\n} from \"@itwin/core-frontend\";\nimport { SectionMarker, SectionMarkerSet } from \"./SectionMarkers\";\nimport { SectionDrawingLocationState } from \"./SectionDrawingLocationState\";\nimport { createSectionGraphicsProvider } from \"./SectionGraphicsProvider\";\nimport { PopupToolbarManager, PopupToolbarProvider } from \"./PopupToolbar\";\nimport { HyperModeling } from \"./HyperModeling\";\nimport { SectionMarkerConfig } from \"./HyperModelingConfig\";\n\nasync function createMarkers(vp: ScreenViewport): Promise<SectionMarkerSet | undefined> {\n if (!vp.view.isSpatialView())\n return undefined;\n\n const states = await SectionDrawingLocationState.queryAll(vp.iModel);\n if (0 === states.length)\n return undefined;\n\n const markers = states.map((state) => new SectionMarker(state));\n return new SectionMarkerSet(vp, markers);\n}\n\nclass MarkerToolbarProvider implements PopupToolbarProvider {\n private readonly _viewport: ScreenViewport;\n public readonly marker: SectionMarker;\n public readonly toolbarProps: AbstractToolbarProps;\n public readonly onToolbarItemExecuted: (id: string) => void;\n\n public constructor(marker: SectionMarker, decorator: HyperModelingDecorator) {\n this.marker = marker;\n this._viewport = decorator.viewport;\n this.toolbarProps = HyperModeling.markerHandler.getToolbarProps(marker, decorator);\n this.onToolbarItemExecuted = (id) => HyperModeling.markerHandler.executeCommand(id, marker, decorator); // eslint-disable-line @typescript-eslint/promise-function-async\n }\n\n public get overToolbarHotspot() {\n return this.marker.isHilited;\n }\n\n public get toolbarLocation(): XAndY {\n return { x: this.marker.rect.right, y: this.marker.rect.top };\n }\n\n public get htmlElement() {\n return this._viewport.canvas;\n }\n}\n\n/** A [Decorator]($frontend) that displays a [[SectionMarker]] for each [SectionDrawingLocation]($backend) in the view.\n * Clicking on a marker toggles the section and the display of associated 2d graphics.\n * Hovering over a marker opens a mini toolbar with additional interactions.\n * @see [[SectionMarkerHandler]] to customize the marker interactions.\n * @see [[HyperModeling.startOrStop]] to enable or disable the decorator for a viewport.\n * @public\n */\nexport class HyperModelingDecorator implements Decorator {\n /** The set of [[SectionMarker]]s controlled by this decorator. */\n public readonly markers: SectionMarkerSet;\n private _config: SectionMarkerConfig;\n private readonly _removeEventListeners = new Array<() => void>();\n private readonly _iModel: IModelConnection;\n private _needSync = false;\n private _toolbarProvider?: MarkerToolbarProvider;\n private _tiledGraphicsProvider?: TiledGraphicsProvider;\n private _activeMarker?: SectionMarker;\n private _appliedSpatialView?: SpatialViewState;\n /** @internal */\n public syncImmediately = false;\n\n /** Create a new decorator and register it with the [ViewManager]($frontend). Typically invoked indirectly via [[HyperModeling.startOrStop]]. */\n public static async create(vp: ScreenViewport, config: SectionMarkerConfig): Promise<HyperModelingDecorator | undefined> {\n const markers = await createMarkers(vp);\n return undefined !== markers ? new HyperModelingDecorator(markers, config) : undefined;\n }\n\n /** Obtain the decorator associated with the specified viewport, if any. */\n public static getForViewport(vp: ScreenViewport): HyperModelingDecorator | undefined {\n for (const decorator of IModelApp.viewManager.decorators)\n if (decorator instanceof HyperModelingDecorator && decorator.viewport === vp)\n return decorator;\n\n return undefined;\n }\n\n /** The viewport into which this decorator draws its [[SectionMarker]]s. */\n public get viewport(): ScreenViewport {\n return this.markers.viewport;\n }\n\n /** The currently active marker. A marker typically becomes active when the user clicks on it.\n * @see [[setActiveMarker]] to change the active marker without user interaction.\n */\n public get activeMarker(): SectionMarker | undefined {\n return this._activeMarker;\n }\n\n /** @internal */\n public get config(): SectionMarkerConfig {\n return this._config;\n }\n\n /** Replaces the current marker display configuration, overwriting all previous settings. Passing `undefined` resets all settings to defaults.\n * @see [[updateConfiguration]] to override specific aspects of the configuration\n * @see [[HyperModeling.replaceConfiguration]] to replace the global configuration.\n */\n public replaceConfiguration(config?: SectionMarkerConfig): void {\n this._config = config ? { ...config } : {};\n this.requestSync();\n }\n\n /** Overrides specific aspects of the current marker display configuration.\n * Any field that is not `undefined` will be replaced in the current configuration; the rest will retain their current values.\n * @see [[replaceConfiguration]] to override all settings.\n * @see [[HyperModeling.updateConfiguration]] to update the global configuration.\n */\n public updateConfiguration(config: SectionMarkerConfig): void {\n this._config = {\n ignoreModelSelector: config.ignoreModelSelector ?? this._config.ignoreModelSelector,\n ignoreCategorySelector: config.ignoreCategorySelector ?? this._config.ignoreCategorySelector,\n hiddenSectionTypes: config.hiddenSectionTypes ?? this._config.hiddenSectionTypes,\n };\n\n this.requestSync();\n }\n\n /** Sets the currently active marker. This function is invoked when the user clicks on a marker, but may also be called manually to produce the same result.\n * Changing the active marker first deactivates the currently active marker, if any; then activates the specified marker, if supplied.\n * Returns false if marker activation fails.\n * @see [[activeMarker]] to obtain the currently active section marker.\n * @see [[SectionMarkerHandler.activateMarker]] to control what happens when a marker is activated.\n * @see [[SectionMarkerHandler.deactivateMarker]] to control what happens when a marker is deactivated.\n */\n public async setActiveMarker(marker: SectionMarker | undefined): Promise<boolean> {\n if (marker === this.activeMarker)\n return true;\n\n if (this.activeMarker) {\n this.activeMarker.setActive(false);\n await HyperModeling.markerHandler.deactivateMarker(this.activeMarker, this);\n this._activeMarker = undefined;\n }\n\n if (marker) {\n if (!await HyperModeling.markerHandler.activateMarker(marker, this)) {\n this.requestSync();\n return false;\n }\n\n marker.setActive(true);\n this._activeMarker = marker;\n }\n\n this.requestSync();\n return true;\n }\n\n /** @internal */\n public readonly useCachedDecorations = true;\n\n /** @internal */\n public decorate(context: DecorateContext): void {\n if (this.viewport.view.is3d())\n this.markers.addDecoration(context);\n }\n\n private constructor(markers: SectionMarkerSet, config: SectionMarkerConfig) {\n this.markers = markers;\n this._config = { ...config };\n this._iModel = this.viewport.iModel;\n\n this.viewport.onChangeView.addOnce(() => {\n this.requestSync();\n });\n\n this._removeEventListeners.push(this.viewport.onViewportChanged.addListener((_, changeFlags) => this.onViewportChanged(changeFlags)));\n this._removeEventListeners.push(this.viewport.onDisposed.addListener(() => this[Symbol.dispose]()));\n\n for (const marker of markers.markers) {\n marker.onMouseEnterEvent.addListener((mkr) => this.showToolbarAfterTimeout(mkr));\n marker.onMouseButtonEvent.addListener((mkr) => this.toggleMarker(mkr)); // eslint-disable-line @typescript-eslint/promise-function-async\n }\n\n this.updateMarkerVisibility();\n IModelApp.viewManager.addDecorator(this);\n }\n\n private onViewportChanged(changeFlags: ChangeFlags): void {\n if (this.viewport.iModel !== this._iModel) {\n this[Symbol.dispose]();\n return;\n }\n\n if (changeFlags.viewedCategories || changeFlags.viewedModels || changeFlags.viewedCategoriesPerModel)\n this.requestSync();\n\n if (changeFlags.viewState) {\n // If we're looking at a different view now, and we did not initiate that, turn off the active marker.\n if (this.viewport.view !== this._appliedSpatialView)\n this.setActiveMarker(undefined); // eslint-disable-line @typescript-eslint/no-floating-promises\n else\n this._appliedSpatialView = undefined;\n }\n }\n\n private async toggleMarker(marker: SectionMarker): Promise<void> {\n await this.setActiveMarker(marker === this.activeMarker ? undefined : marker);\n }\n\n private dropTiledGraphicsProvider(): void {\n if (undefined === this._tiledGraphicsProvider)\n return;\n\n this.viewport.dropTiledGraphicsProvider(this._tiledGraphicsProvider);\n this._tiledGraphicsProvider = undefined;\n }\n\n /** @internal */\n public [Symbol.dispose](): void {\n if (!IModelApp.viewManager.dropDecorator(this))\n return;\n\n for (const remove of this._removeEventListeners)\n remove();\n\n this.dropTiledGraphicsProvider();\n }\n\n private showToolbarAfterTimeout(marker: SectionMarker): void {\n if (this._toolbarProvider?.marker !== marker)\n this._toolbarProvider = new MarkerToolbarProvider(marker, this);\n\n PopupToolbarManager.showToolbarAfterTimeout(this._toolbarProvider);\n }\n\n /** Toggles whether the clip volume associated with the specified marker is applied to the view. */\n public toggleClipVolume(marker: SectionMarker, enable: boolean): void {\n ViewClipTool.enableClipVolume(this.viewport);\n ViewClipTool.setViewClip(this.viewport, enable ? marker.state.clip : undefined);\n }\n\n /** Toggles the specified section marker.\n * Enabling the section applies the frustum and clip volume of the marker's spatial view to the viewport, and displays the 2d section graphics and sheet annotations.\n * Disabling the section disables the clip volume and 2d graphics.\n * @see [[toggleClipVolume]] to toggle only the clip volume.\n * @see [[toggleAttachment]] to toggle only the attachment graphics.\n */\n public async toggleSection(marker: SectionMarker, enable: boolean): Promise<boolean> {\n if (enable) {\n if (this.viewport.view.is3d()) {\n // Preserve the view settings; apply only the frustum and clip volume\n const spatialView = await marker.state.tryLoadSpatialView();\n if (!spatialView)\n return false;\n\n const aligned = await this.alignToSpatialView(marker);\n if (!aligned)\n return false;\n\n this.toggleClipVolume(marker, true);\n } else if (!await this.applySpatialView(marker)) {\n return false;\n }\n } else {\n this.toggleClipVolume(marker, false);\n }\n\n this.requestSync();\n return this.toggleAttachment(marker, enable);\n }\n\n /** Toggles display of 2d section graphics and sheet annotations for the specified marker.\n * @see [[toggleSection]] to apply the spatial view and clip volume in addition to the attachment graphics.\n */\n public async toggleAttachment(marker: SectionMarker, enable: boolean): Promise<boolean> {\n this.dropTiledGraphicsProvider();\n if (enable) {\n this._tiledGraphicsProvider = await createSectionGraphicsProvider(marker.state);\n this.viewport.addTiledGraphicsProvider(this._tiledGraphicsProvider);\n }\n\n return true;\n }\n\n /** Aligns the viewport to face the specified marker's section plane. */\n public alignView(marker: SectionMarker): void {\n const placement = marker.state.placement.transform;\n const origin = placement.origin;\n const matrix = placement.matrix;\n\n const vp = this.viewport;\n const targetMatrix = matrix.multiplyMatrixMatrix(vp.rotation);\n const rotateTransform = Transform.createFixedPointAndMatrix(origin, targetMatrix);\n\n const startFrustum = vp.getFrustum();\n const newFrustum = startFrustum.clone();\n newFrustum.multiply(rotateTransform);\n\n if (startFrustum.equals(newFrustum))\n return;\n\n vp.view.setupFromFrustum(newFrustum);\n vp.synchWithView();\n vp.animateFrustumChange();\n }\n\n /** Opens the marker's drawing view in the decorator's viewport. Returns false if the drawing view could not be loaded. */\n public async openSection(marker: SectionMarker): Promise<boolean> {\n const viewState = await marker.state.tryLoadDrawingView();\n if (viewState)\n this.viewport.changeView(viewState);\n\n return undefined !== viewState;\n }\n\n /** Opens marker's sheet view in the decorator's viewport and zooms in on the associated [ViewAttachment]($backend). Returns false if no view\n * attachment exists or the sheet view could not be loaded.\n */\n public async openSheet(marker: SectionMarker): Promise<boolean> {\n if (undefined === marker.state.viewAttachment)\n return false;\n\n const viewState = await marker.state.tryLoadSheetView();\n if (!viewState)\n return false;\n\n this.viewport.changeView(viewState);\n await this.viewport.zoomToElements(marker.state.viewAttachment.id);\n return true;\n }\n\n /** Aligns the view to match the frustum of the spatial view associated with the specified marker.\n * @param marker The marker whose spatial view's frustum should be applied.\n * @returns false if the frustum could not be applied, e.g. because the spatial view could not be loaded or the viewport is viewing a 2d model.\n * @see [[alignView]] to align to the *section plane*, which may differ.\n * @see [[toggleSection]] to also apply the clip volume.\n */\n public async alignToSpatialView(marker: SectionMarker): Promise<boolean> {\n if (!this.viewport.view.is3d())\n return false;\n\n const spatialView = await marker.state.tryLoadSpatialView();\n if (!spatialView)\n return false;\n\n this.viewport.view.setOrigin(spatialView.getOrigin());\n this.viewport.view.setExtents(spatialView.getExtents());\n this.viewport.view.setRotation(spatialView.getRotation());\n this.viewport.synchWithView({ animateFrustumChange: true });\n\n return true;\n }\n\n /** Applies the marker's spatial view - including its clip volume - to the decorator's viewport.\n * Returns false if the spatial view could not be loaded.\n * @see [[toggleSection]].\n * @see [[toggleClipVolume]].\n */\n public async applySpatialView(marker: SectionMarker): Promise<boolean> {\n const viewState = await marker.state.tryLoadSpatialView();\n if (viewState) {\n this._appliedSpatialView = viewState;\n this.viewport.changeView(viewState);\n }\n\n return undefined !== viewState;\n }\n\n /** Request that the visibility of the section markers be recomputed. It is only necessary to call this if you have overridden [[SectionMarkerHandler.isMarkerVisible]]; if so, you should invoke\n * this method when the criteria governing your `isMarkerVisible` method have changed.\n */\n public requestSync(): void {\n if (this.syncImmediately) {\n this.sync();\n } else if (!this._needSync) {\n this._needSync = true;\n requestAnimationFrame(() => this.sync());\n }\n }\n\n private sync(): void {\n this._needSync = false;\n if (HyperModeling.isInitialized && this.viewport.view.is3d() && this.updateMarkerVisibility()) {\n this.markers.markDirty();\n this.viewport.invalidateCachedDecorations(this);\n }\n }\n\n private isMarkerVisible(marker: SectionMarker): boolean {\n if (undefined !== this.activeMarker)\n return marker === this.activeMarker;\n\n return HyperModeling.markerHandler.isMarkerVisible(marker, this, this._config);\n }\n\n private updateMarkerVisibility(): boolean {\n let changed = false;\n for (const marker of this.markers.markers) {\n const wasVisible = marker.visible;\n marker.visible = this.isMarkerVisible(marker);\n changed = changed || (marker.visible !== wasVisible);\n }\n\n return changed;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/hypermodeling-frontend",
3
- "version": "5.0.0-dev.40",
3
+ "version": "5.0.0-dev.49",
4
4
  "description": "iTwin.js hypermodeling package",
5
5
  "main": "lib/cjs/hypermodeling-frontend.js",
6
6
  "module": "lib/esm/hypermodeling-frontend.js",
@@ -22,10 +22,10 @@
22
22
  "url": "http://www.bentley.com"
23
23
  },
24
24
  "peerDependencies": {
25
- "@itwin/core-bentley": "5.0.0-dev.40",
26
- "@itwin/core-common": "5.0.0-dev.40",
27
- "@itwin/core-frontend": "5.0.0-dev.40",
28
- "@itwin/core-geometry": "5.0.0-dev.40"
25
+ "@itwin/core-bentley": "5.0.0-dev.49",
26
+ "@itwin/core-frontend": "5.0.0-dev.49",
27
+ "@itwin/core-common": "5.0.0-dev.49",
28
+ "@itwin/core-geometry": "5.0.0-dev.49"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@itwin/eslint-plugin": "5.0.0-dev.1",
@@ -43,15 +43,15 @@
43
43
  "source-map-loader": "^4.0.0",
44
44
  "typescript": "~5.6.2",
45
45
  "webpack": "^5.97.1",
46
- "@itwin/build-tools": "5.0.0-dev.40",
47
- "@itwin/core-bentley": "5.0.0-dev.40",
48
- "@itwin/core-common": "5.0.0-dev.40",
49
- "@itwin/core-frontend": "5.0.0-dev.40",
50
- "@itwin/core-geometry": "5.0.0-dev.40",
51
- "@itwin/certa": "5.0.0-dev.40"
46
+ "@itwin/core-common": "5.0.0-dev.49",
47
+ "@itwin/build-tools": "5.0.0-dev.49",
48
+ "@itwin/core-bentley": "5.0.0-dev.49",
49
+ "@itwin/core-frontend": "5.0.0-dev.49",
50
+ "@itwin/certa": "5.0.0-dev.49",
51
+ "@itwin/core-geometry": "5.0.0-dev.49"
52
52
  },
53
53
  "dependencies": {
54
- "@itwin/appui-abstract": "5.0.0-dev.40"
54
+ "@itwin/appui-abstract": "5.0.0-dev.49"
55
55
  },
56
56
  "nyc": {
57
57
  "extends": "./node_modules/@itwin/build-tools/.nycrc"