@itwin/hypermodeling-frontend 5.0.0-dev.4 → 5.0.0-dev.40
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 +26 -1
- package/lib/cjs/HyperModeling.js +2 -2
- package/lib/cjs/HyperModeling.js.map +1 -1
- package/lib/cjs/PopupToolbar.js +11 -11
- package/lib/cjs/PopupToolbar.js.map +1 -1
- package/lib/cjs/Tools.js +4 -4
- package/lib/cjs/Tools.js.map +1 -1
- package/lib/esm/HyperModeling.js +2 -2
- package/lib/esm/HyperModeling.js.map +1 -1
- package/lib/esm/PopupToolbar.js +11 -11
- package/lib/esm/PopupToolbar.js.map +1 -1
- package/lib/esm/Tools.js +4 -4
- package/lib/esm/Tools.js.map +1 -1
- package/package.json +15 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
# Change Log - @itwin/hypermodeling-frontend
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 13 Jan 2025 14:09:29 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 4.10.4
|
|
6
|
+
Mon, 13 Jan 2025 14:06:43 GMT
|
|
7
|
+
|
|
8
|
+
_Version update only_
|
|
9
|
+
|
|
10
|
+
## 4.10.3
|
|
11
|
+
Mon, 06 Jan 2025 14:00:13 GMT
|
|
12
|
+
|
|
13
|
+
_Version update only_
|
|
14
|
+
|
|
15
|
+
## 4.10.2
|
|
16
|
+
Thu, 21 Nov 2024 15:22:20 GMT
|
|
17
|
+
|
|
18
|
+
_Version update only_
|
|
19
|
+
|
|
20
|
+
## 4.10.1
|
|
21
|
+
Thu, 14 Nov 2024 18:11:00 GMT
|
|
22
|
+
|
|
23
|
+
_Version update only_
|
|
24
|
+
|
|
25
|
+
## 4.10.0
|
|
26
|
+
Wed, 13 Nov 2024 15:23:39 GMT
|
|
27
|
+
|
|
28
|
+
_Version update only_
|
|
4
29
|
|
|
5
30
|
## 4.9.7
|
|
6
31
|
Wed, 06 Nov 2024 19:23:04 GMT
|
package/lib/cjs/HyperModeling.js
CHANGED
|
@@ -25,6 +25,8 @@ function assertInitialized(maybe) {
|
|
|
25
25
|
* @public
|
|
26
26
|
*/
|
|
27
27
|
class HyperModeling {
|
|
28
|
+
static { this._markerConfig = {}; }
|
|
29
|
+
static { this._graphicsConfig = {}; }
|
|
28
30
|
static shutdown() {
|
|
29
31
|
this.resources = undefined;
|
|
30
32
|
this._markerHandler = undefined;
|
|
@@ -233,6 +235,4 @@ class HyperModeling {
|
|
|
233
235
|
}
|
|
234
236
|
}
|
|
235
237
|
exports.HyperModeling = HyperModeling;
|
|
236
|
-
HyperModeling._markerConfig = {};
|
|
237
|
-
HyperModeling._graphicsConfig = {};
|
|
238
238
|
//# sourceMappingURL=HyperModeling.js.map
|
|
@@ -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;IAOhB,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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B,2BAAa,GAAwB,EAAE,CAAC;AACxC,6BAAe,GAA0B,EAAE,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,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;aAIT,kBAAa,GAAwB,EAAE,CAAC;aACxC,oBAAe,GAA0B,EAAE,CAAC;I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rC,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"]}
|
package/lib/cjs/PopupToolbar.js
CHANGED
|
@@ -23,6 +23,17 @@ class PopupToolbarManager {
|
|
|
23
23
|
this.closeAfterTimeout();
|
|
24
24
|
return true;
|
|
25
25
|
}
|
|
26
|
+
static { this._itemExecuted = (item) => {
|
|
27
|
+
const mgr = PopupToolbarManager;
|
|
28
|
+
if (mgr._current)
|
|
29
|
+
mgr._current.onToolbarItemExecuted(item.id);
|
|
30
|
+
mgr.close();
|
|
31
|
+
}; }
|
|
32
|
+
static { this._cancel = () => {
|
|
33
|
+
const mgr = PopupToolbarManager;
|
|
34
|
+
if (!mgr._current || !mgr._current.overToolbarHotspot)
|
|
35
|
+
mgr.close(); // Don't hide when click is over hotspot
|
|
36
|
+
}; }
|
|
26
37
|
static close() {
|
|
27
38
|
this._current = undefined;
|
|
28
39
|
return core_frontend_1.IModelApp.uiAdmin.hideToolbar();
|
|
@@ -44,15 +55,4 @@ class PopupToolbarManager {
|
|
|
44
55
|
}
|
|
45
56
|
}
|
|
46
57
|
exports.PopupToolbarManager = PopupToolbarManager;
|
|
47
|
-
PopupToolbarManager._itemExecuted = (item) => {
|
|
48
|
-
const mgr = PopupToolbarManager;
|
|
49
|
-
if (mgr._current)
|
|
50
|
-
mgr._current.onToolbarItemExecuted(item.id);
|
|
51
|
-
mgr.close();
|
|
52
|
-
};
|
|
53
|
-
PopupToolbarManager._cancel = () => {
|
|
54
|
-
const mgr = PopupToolbarManager;
|
|
55
|
-
if (!mgr._current || !mgr._current.overToolbarHotspot)
|
|
56
|
-
mgr.close(); // Don't hide when click is over hotspot
|
|
57
|
-
};
|
|
58
58
|
//# sourceMappingURL=PopupToolbar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupToolbar.js","sourceRoot":"","sources":["../../src/PopupToolbar.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAIH,wDAAiD;AAWjD,gBAAgB;AAChB,MAAa,mBAAmB;IAItB,MAAM,CAAC,IAAI;QACjB,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC;QAC5B,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,kBAAkB;YACnC,OAAO,KAAK,CAAC;QAEf,MAAM,KAAK,GAAG,yBAAS,CAAC,OAAO,CAAC;QAChC,IAAI,CAAC,KAAK,CAAC,W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,IAAS,EAAE,EAAE;QAC3C,MAAM,GAAG,GAAG,mBAAmB,CAAC;QAChC,IAAI,GAAG,CAAC,QAAQ;YACd,GAAG,CAAC,QAAQ,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAE9C,GAAG,CAAC,KAAK,EAAE,CAAC;IACd,CAAC,CAAC;aAEa,YAAO,GAAG,GAAG,EAAE;QAC5B,MAAM,GAAG,GAAG,mBAAmB,CAAC;QAChC,IAAI,CAAC,GAAG,CAAC,QAAQ,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,kBAAkB;YACnD,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,wCAAwC;IACzD,CAAC,CAAC;IAEM,MAAM,CAAC,KAAK;QAClB,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC1B,OAAO,yBAAS,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;IACzC,CAAC;IAEO,MAAM,CAAC,iBAAiB;QAC9B,IAAI,CAAC,IAAI,CAAC,QAAQ;YAChB,OAAO;QAET,MAAM,KAAK,GAAG,IAAI,CAAC;QACnB,IAAI,IAAI,CAAC,QAAQ,CAAC,kBAAkB,IAAI,CAAC,yBAAS,CAAC,SAAS,CAAC,UAAU;YACrE,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,kDAAkD;;YAErG,IAAI,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;IAEM,MAAM,CAAC,uBAAuB,CAAC,QAA8B;QAClE,IAAI,IAAI,CAAC,QAAQ,KAAK,QAAQ;YAC5B,OAAO;QAET,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC;IACrC,CAAC;;AAvDH,kDAwDC","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 { XAndY } from \"@itwin/core-geometry\";\nimport type { AbstractToolbarProps } from \"@itwin/appui-abstract\";\nimport { IModelApp } from \"@itwin/core-frontend\";\n\n/** @internal */\nexport interface PopupToolbarProvider {\n toolbarProps: AbstractToolbarProps;\n overToolbarHotspot: boolean;\n toolbarLocation: XAndY;\n htmlElement: HTMLElement | undefined;\n onToolbarItemExecuted(id: string): void;\n}\n\n/** @internal */\nexport class PopupToolbarManager {\n private static _provider?: PopupToolbarProvider;\n private static _current?: PopupToolbarProvider;\n\n private static show(): boolean {\n const prov = this._provider;\n if (!prov || !prov.overToolbarHotspot)\n return false;\n\n const admin = IModelApp.uiAdmin;\n if (!admin.showToolbar(prov.toolbarProps, prov.toolbarLocation, { x: 0, y: 0 }, this._itemExecuted, this._cancel, undefined, prov.htmlElement))\n return false;\n\n this._current = this._provider;\n this._provider = undefined;\n this.closeAfterTimeout();\n return true;\n }\n\n private static _itemExecuted = (item: any) => {\n const mgr = PopupToolbarManager;\n if (mgr._current)\n mgr._current.onToolbarItemExecuted(item.id);\n\n mgr.close();\n };\n\n private static _cancel = () => {\n const mgr = PopupToolbarManager;\n if (!mgr._current || !mgr._current.overToolbarHotspot)\n mgr.close(); // Don't hide when click is over hotspot\n };\n\n private static close(): boolean {\n this._current = undefined;\n return IModelApp.uiAdmin.hideToolbar();\n }\n\n private static closeAfterTimeout(): void {\n if (!this._current)\n return;\n\n const delay = 1000;\n if (this._current.overToolbarHotspot || !IModelApp.toolAdmin.cursorView)\n setTimeout(() => this.closeAfterTimeout(), delay); // Cursor not in view or over hotspot, check again\n else\n this.close();\n }\n\n public static showToolbarAfterTimeout(provider: PopupToolbarProvider): void {\n if (this._current === provider)\n return;\n\n this._provider = provider;\n setTimeout(() => this.show(), 500);\n }\n}\n"]}
|
package/lib/cjs/Tools.js
CHANGED
|
@@ -24,6 +24,7 @@ function parseToggle(arg) {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
class HyperModelingTool extends core_frontend_1.Tool {
|
|
27
|
+
static { this.toolId = "HyperModeling"; }
|
|
27
28
|
static get minArgs() { return 0; }
|
|
28
29
|
static get maxArgs() { return 1; }
|
|
29
30
|
async run(enable, vp) {
|
|
@@ -37,7 +38,6 @@ class HyperModelingTool extends core_frontend_1.Tool {
|
|
|
37
38
|
return typeof enable !== "string" && this.run(enable);
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
|
-
HyperModelingTool.toolId = "HyperModeling";
|
|
41
41
|
/** Configures how section graphics are displayed. These are global settings. If no arguments are supplied, the defaults are restored.
|
|
42
42
|
* Otherwise, each argument is of the form "name=value" where value is 0 (disable) or 1 (enable). Only the first letter of each argument matters.
|
|
43
43
|
* - drawings: Whether to display the section drawing graphics. Default: 1.
|
|
@@ -46,6 +46,7 @@ HyperModelingTool.toolId = "HyperModeling";
|
|
|
46
46
|
* - boundaries: Whether to display clip volumes as boundary shapes for debugging purposes. Default: 0.
|
|
47
47
|
*/
|
|
48
48
|
class SectionGraphicsConfigTool extends core_frontend_1.Tool {
|
|
49
|
+
static { this.toolId = "HyperModeling.Graphics.Config"; }
|
|
49
50
|
static get minArgs() { return 0; }
|
|
50
51
|
static get maxArgs() { return 4; }
|
|
51
52
|
async run(config) {
|
|
@@ -90,7 +91,6 @@ class SectionGraphicsConfigTool extends core_frontend_1.Tool {
|
|
|
90
91
|
return this.run(config);
|
|
91
92
|
}
|
|
92
93
|
}
|
|
93
|
-
SectionGraphicsConfigTool.toolId = "HyperModeling.Graphics.Config";
|
|
94
94
|
class SectionMarkerConfigTool extends core_frontend_1.Tool {
|
|
95
95
|
static get minArgs() { return 0; }
|
|
96
96
|
static get maxArgs() { return 3; }
|
|
@@ -145,12 +145,13 @@ class SectionMarkerConfigTool extends core_frontend_1.Tool {
|
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
class SectionMarkerDefaultConfigTool extends SectionMarkerConfigTool {
|
|
148
|
+
static { this.toolId = "HyperModeling.Marker.Default.Config"; }
|
|
148
149
|
update(config) {
|
|
149
150
|
HyperModeling_1.HyperModeling.updateConfiguration({ markers: config });
|
|
150
151
|
}
|
|
151
152
|
}
|
|
152
|
-
SectionMarkerDefaultConfigTool.toolId = "HyperModeling.Marker.Default.Config";
|
|
153
153
|
class SectionMarkerDecoratorConfigTool extends SectionMarkerConfigTool {
|
|
154
|
+
static { this.toolId = "HyperModeling.Marker.Config"; }
|
|
154
155
|
update(config) {
|
|
155
156
|
const vp = core_frontend_1.IModelApp.viewManager.selectedView;
|
|
156
157
|
const decorator = vp ? HyperModelingDecorator_1.HyperModelingDecorator.getForViewport(vp) : undefined;
|
|
@@ -158,7 +159,6 @@ class SectionMarkerDecoratorConfigTool extends SectionMarkerConfigTool {
|
|
|
158
159
|
decorator.updateConfiguration(config);
|
|
159
160
|
}
|
|
160
161
|
}
|
|
161
|
-
SectionMarkerDecoratorConfigTool.toolId = "HyperModeling.Marker.Config";
|
|
162
162
|
/** @internal */
|
|
163
163
|
function registerTools(namespace) {
|
|
164
164
|
const register = (tool) => core_frontend_1.IModelApp.tools.register(tool, namespace);
|
package/lib/cjs/Tools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tools.js","sourceRoot":"","sources":["../../src/Tools.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AA0LH,sCAMC;AA9LD,oDAAiD;AACjD,wDAAuE;AACvE,mDAAgD;AAEhD,qEAAkE;AAElE,gKAAgK;AAChK,SAAS,WAAW,CAAC,GAAuB;IAC1C,IAAI,SAAS,KAAK,GAAG;QACnB,OAAO,SAAS,CAAC;IAEnB,QAAQ,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC;QAC1B,KAAK,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC;QACvB,KAAK,KAAK,CAAC,CAAC,O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C,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC7E,IAAI,SAAS;YACX,SAAS,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;;AAPsB,uCAAM,GAAG,6BAA6B,CAAC;AAUhE,gBAAgB;AAChB,SAAgB,aAAa,CAAC,SAAiB;IAC7C,MAAM,QAAQ,GAAG,CAAC,IAAiB,EAAE,EAAE,CAAC,yBAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAClF,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IAC5B,QAAQ,CAAC,yBAAyB,CAAC,CAAC;IACpC,QAAQ,CAAC,gCAAgC,CAAC,CAAC;IAC3C,QAAQ,CAAC,8BAA8B,CAAC,CAAC;AAC3C,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 { SectionType } from \"@itwin/core-common\";\r\nimport { IModelApp, ScreenViewport, Tool } from \"@itwin/core-frontend\";\r\nimport { HyperModeling } from \"./HyperModeling\";\r\nimport { SectionGraphicsConfig, SectionMarkerConfig } from \"./HyperModelingConfig\";\r\nimport { HyperModelingDecorator } from \"./HyperModelingDecorator\";\r\n\r\n/** Parses a string case-insensitively returning true for \"ON\", false for \"OFF\", undefined for \"TOGGLE\" or undefined, and the input string for anything else. */\r\nfunction parseToggle(arg: string | undefined): string | boolean | undefined {\r\n if (undefined === arg)\r\n return undefined;\r\n\r\n switch (arg.toLowerCase()) {\r\n case \"on\": return true;\r\n case \"off\": return false;\r\n case \"toggle\": return undefined;\r\n default: return arg;\r\n }\r\n}\r\n\r\nclass HyperModelingTool extends Tool {\r\n public static override toolId = \"HyperModeling\";\r\n public static override get minArgs() { return 0; }\r\n public static override get maxArgs() { return 1; }\r\n\r\n public override async run(enable?: boolean, vp?: ScreenViewport): Promise<boolean> {\r\n vp = vp ?? IModelApp.viewManager.selectedView;\r\n if (vp)\r\n await HyperModeling.startOrStop(vp, enable);\r\n\r\n return true;\r\n }\r\n\r\n public override async parseAndRun(...args: string[]): Promise<boolean> {\r\n const enable = parseToggle(args[0]);\r\n return typeof enable !== \"string\" && this.run(enable);\r\n }\r\n}\r\n\r\ntype Writeable<T> = { -readonly [P in keyof T]: T[P] };\r\n\r\n/** Configures how section graphics are displayed. These are global settings. If no arguments are supplied, the defaults are restored.\r\n * Otherwise, each argument is of the form \"name=value\" where value is 0 (disable) or 1 (enable). Only the first letter of each argument matters.\r\n * - drawings: Whether to display the section drawing graphics. Default: 1.\r\n * - sheets: Whether to display the sheet annotation graphics. Default: 1.\r\n * - clip: Whether to apply clip volumes to the 2d graphics. Default: 1.\r\n * - boundaries: Whether to display clip volumes as boundary shapes for debugging purposes. Default: 0.\r\n */\r\nclass SectionGraphicsConfigTool extends Tool {\r\n public static override toolId = \"HyperModeling.Graphics.Config\";\r\n public static override get minArgs() { return 0; }\r\n public static override get maxArgs() { return 4; }\r\n\r\n public override async run(config?: SectionGraphicsConfig): Promise<boolean> {\r\n if (!config) {\r\n config = {\r\n ignoreClip: false,\r\n debugClipVolumes: false,\r\n hideSectionGraphics: false,\r\n hideSheetAnnotations: false,\r\n };\r\n }\r\n\r\n HyperModeling.updateConfiguration({ graphics: config });\r\n return true;\r\n }\r\n\r\n public override async parseAndRun(...args: string[]): Promise<boolean> {\r\n if (0 === args.length)\r\n return this.run(); // restore defaults...\r\n\r\n const config: Writeable<SectionGraphicsConfig> = {};\r\n for (const arg of args) {\r\n const parts = arg.toLowerCase().split(\"=\");\r\n if (2 !== parts.length)\r\n continue;\r\n\r\n const value = Number.parseInt(parts[1], 10);\r\n if (Number.isNaN(value) || (0 !== value && 1 !== value))\r\n continue;\r\n\r\n const enable = 1 === value;\r\n switch (parts[0][0]) {\r\n case \"d\":\r\n config.hideSectionGraphics = !enable;\r\n break;\r\n case \"s\":\r\n config.hideSheetAnnotations = !enable;\r\n break;\r\n case \"c\":\r\n config.ignoreClip = !enable;\r\n break;\r\n case \"b\":\r\n config.debugClipVolumes = enable;\r\n break;\r\n }\r\n }\r\n\r\n return this.run(config);\r\n }\r\n}\r\n\r\nabstract class SectionMarkerConfigTool extends Tool {\r\n public static override get minArgs() { return 0; }\r\n public static override get maxArgs() { return 3; }\r\n\r\n protected abstract update(config: SectionMarkerConfig): void;\r\n\r\n public override async run(config?: SectionMarkerConfig): Promise<boolean> {\r\n config = config ?? { ignoreModelSelector: false, ignoreCategorySelector: false, hiddenSectionTypes: [] };\r\n this.update(config);\r\n return true;\r\n }\r\n\r\n public override async parseAndRun(...args: string[]): Promise<boolean> {\r\n if (0 === args.length)\r\n return this.run(); // restore defaults...\r\n\r\n const config: Writeable<SectionMarkerConfig> = {};\r\n for (const arg of args) {\r\n const parts = arg.toLowerCase().split(\"=\");\r\n if (2 !== parts.length)\r\n continue;\r\n\r\n const setting = parts[0][0];\r\n switch (setting) {\r\n case \"h\": {\r\n config.hiddenSectionTypes = [];\r\n for (const c of parts[1]) {\r\n switch (c) {\r\n case \"s\":\r\n config.hiddenSectionTypes.push(SectionType.Section);\r\n break;\r\n case \"d\":\r\n config.hiddenSectionTypes.push(SectionType.Detail);\r\n break;\r\n case \"e\":\r\n config.hiddenSectionTypes.push(SectionType.Elevation);\r\n break;\r\n case \"p\":\r\n config.hiddenSectionTypes.push(SectionType.Plan);\r\n break;\r\n }\r\n }\r\n\r\n break;\r\n }\r\n default: {\r\n const intVal = Number.parseInt(parts[1], 10);\r\n if (!Number.isNaN(intVal) && (0 === intVal || 1 === intVal)) {\r\n if (\"c\" === setting)\r\n config.ignoreCategorySelector = 0 === intVal;\r\n else if (\"m\" === setting)\r\n config.ignoreModelSelector = 0 === intVal;\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return this.run(config);\r\n }\r\n}\r\n\r\nclass SectionMarkerDefaultConfigTool extends SectionMarkerConfigTool {\r\n public static override toolId = \"HyperModeling.Marker.Default.Config\";\r\n\r\n protected update(config: SectionMarkerConfig): void {\r\n HyperModeling.updateConfiguration({ markers: config });\r\n }\r\n}\r\n\r\nclass SectionMarkerDecoratorConfigTool extends SectionMarkerConfigTool {\r\n public static override toolId = \"HyperModeling.Marker.Config\";\r\n\r\n protected update(config: SectionMarkerConfig): void {\r\n const vp = IModelApp.viewManager.selectedView;\r\n const decorator = vp ? HyperModelingDecorator.getForViewport(vp) : undefined;\r\n if (decorator)\r\n decorator.updateConfiguration(config);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function registerTools(namespace: string): void {\r\n const register = (tool: typeof Tool) => IModelApp.tools.register(tool, namespace);\r\n register(HyperModelingTool);\r\n register(SectionGraphicsConfigTool);\r\n register(SectionMarkerDecoratorConfigTool);\r\n register(SectionMarkerDefaultConfigTool);\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"Tools.js","sourceRoot":"","sources":["../../src/Tools.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AA0LH,sCAMC;AA9LD,oDAAiD;AACjD,wDAAuE;AACvE,mDAAgD;AAEhD,qEAAkE;AAElE,gKAAgK;AAChK,SAAS,WAAW,CAAC,GAAuB;IAC1C,IAAI,SAAS,KAAK,GAAG;QACnB,OAAO,SAAS,CAAC;IAEnB,QAAQ,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC;QAC1B,KAAK,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC;QACvB,KAAK,KAAK,CAAC,CAAC,OAAO,KAAK,CAAC;QACzB,KAAK,QAAQ,CAAC,CAAC,OAAO,SAAS,CAAC;QAChC,OAAO,CAAC,CAAC,OAAO,GAAG,CAAC;IACtB,CAAC;AACH,CAAC;AAED,MAAM,iBAAkB,SAAQ,oBAAI;aACX,WAAM,GAAG,eAAe,CAAC;IACzC,MAAM,KAAc,OAAO,KAAK,O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AAiB,EAAE,EAAE,CAAC,yBAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAClF,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IAC5B,QAAQ,CAAC,yBAAyB,CAAC,CAAC;IACpC,QAAQ,CAAC,gCAAgC,CAAC,CAAC;IAC3C,QAAQ,CAAC,8BAA8B,CAAC,CAAC;AAC3C,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 { SectionType } from \"@itwin/core-common\";\r\nimport { IModelApp, ScreenViewport, Tool } from \"@itwin/core-frontend\";\r\nimport { HyperModeling } from \"./HyperModeling\";\r\nimport { SectionGraphicsConfig, SectionMarkerConfig } from \"./HyperModelingConfig\";\r\nimport { HyperModelingDecorator } from \"./HyperModelingDecorator\";\r\n\r\n/** Parses a string case-insensitively returning true for \"ON\", false for \"OFF\", undefined for \"TOGGLE\" or undefined, and the input string for anything else. */\r\nfunction parseToggle(arg: string | undefined): string | boolean | undefined {\r\n if (undefined === arg)\r\n return undefined;\r\n\r\n switch (arg.toLowerCase()) {\r\n case \"on\": return true;\r\n case \"off\": return false;\r\n case \"toggle\": return undefined;\r\n default: return arg;\r\n }\r\n}\r\n\r\nclass HyperModelingTool extends Tool {\r\n public static override toolId = \"HyperModeling\";\r\n public static override get minArgs() { return 0; }\r\n public static override get maxArgs() { return 1; }\r\n\r\n public override async run(enable?: boolean, vp?: ScreenViewport): Promise<boolean> {\r\n vp = vp ?? IModelApp.viewManager.selectedView;\r\n if (vp)\r\n await HyperModeling.startOrStop(vp, enable);\r\n\r\n return true;\r\n }\r\n\r\n public override async parseAndRun(...args: string[]): Promise<boolean> {\r\n const enable = parseToggle(args[0]);\r\n return typeof enable !== \"string\" && this.run(enable);\r\n }\r\n}\r\n\r\ntype Writeable<T> = { -readonly [P in keyof T]: T[P] };\r\n\r\n/** Configures how section graphics are displayed. These are global settings. If no arguments are supplied, the defaults are restored.\r\n * Otherwise, each argument is of the form \"name=value\" where value is 0 (disable) or 1 (enable). Only the first letter of each argument matters.\r\n * - drawings: Whether to display the section drawing graphics. Default: 1.\r\n * - sheets: Whether to display the sheet annotation graphics. Default: 1.\r\n * - clip: Whether to apply clip volumes to the 2d graphics. Default: 1.\r\n * - boundaries: Whether to display clip volumes as boundary shapes for debugging purposes. Default: 0.\r\n */\r\nclass SectionGraphicsConfigTool extends Tool {\r\n public static override toolId = \"HyperModeling.Graphics.Config\";\r\n public static override get minArgs() { return 0; }\r\n public static override get maxArgs() { return 4; }\r\n\r\n public override async run(config?: SectionGraphicsConfig): Promise<boolean> {\r\n if (!config) {\r\n config = {\r\n ignoreClip: false,\r\n debugClipVolumes: false,\r\n hideSectionGraphics: false,\r\n hideSheetAnnotations: false,\r\n };\r\n }\r\n\r\n HyperModeling.updateConfiguration({ graphics: config });\r\n return true;\r\n }\r\n\r\n public override async parseAndRun(...args: string[]): Promise<boolean> {\r\n if (0 === args.length)\r\n return this.run(); // restore defaults...\r\n\r\n const config: Writeable<SectionGraphicsConfig> = {};\r\n for (const arg of args) {\r\n const parts = arg.toLowerCase().split(\"=\");\r\n if (2 !== parts.length)\r\n continue;\r\n\r\n const value = Number.parseInt(parts[1], 10);\r\n if (Number.isNaN(value) || (0 !== value && 1 !== value))\r\n continue;\r\n\r\n const enable = 1 === value;\r\n switch (parts[0][0]) {\r\n case \"d\":\r\n config.hideSectionGraphics = !enable;\r\n break;\r\n case \"s\":\r\n config.hideSheetAnnotations = !enable;\r\n break;\r\n case \"c\":\r\n config.ignoreClip = !enable;\r\n break;\r\n case \"b\":\r\n config.debugClipVolumes = enable;\r\n break;\r\n }\r\n }\r\n\r\n return this.run(config);\r\n }\r\n}\r\n\r\nabstract class SectionMarkerConfigTool extends Tool {\r\n public static override get minArgs() { return 0; }\r\n public static override get maxArgs() { return 3; }\r\n\r\n protected abstract update(config: SectionMarkerConfig): void;\r\n\r\n public override async run(config?: SectionMarkerConfig): Promise<boolean> {\r\n config = config ?? { ignoreModelSelector: false, ignoreCategorySelector: false, hiddenSectionTypes: [] };\r\n this.update(config);\r\n return true;\r\n }\r\n\r\n public override async parseAndRun(...args: string[]): Promise<boolean> {\r\n if (0 === args.length)\r\n return this.run(); // restore defaults...\r\n\r\n const config: Writeable<SectionMarkerConfig> = {};\r\n for (const arg of args) {\r\n const parts = arg.toLowerCase().split(\"=\");\r\n if (2 !== parts.length)\r\n continue;\r\n\r\n const setting = parts[0][0];\r\n switch (setting) {\r\n case \"h\": {\r\n config.hiddenSectionTypes = [];\r\n for (const c of parts[1]) {\r\n switch (c) {\r\n case \"s\":\r\n config.hiddenSectionTypes.push(SectionType.Section);\r\n break;\r\n case \"d\":\r\n config.hiddenSectionTypes.push(SectionType.Detail);\r\n break;\r\n case \"e\":\r\n config.hiddenSectionTypes.push(SectionType.Elevation);\r\n break;\r\n case \"p\":\r\n config.hiddenSectionTypes.push(SectionType.Plan);\r\n break;\r\n }\r\n }\r\n\r\n break;\r\n }\r\n default: {\r\n const intVal = Number.parseInt(parts[1], 10);\r\n if (!Number.isNaN(intVal) && (0 === intVal || 1 === intVal)) {\r\n if (\"c\" === setting)\r\n config.ignoreCategorySelector = 0 === intVal;\r\n else if (\"m\" === setting)\r\n config.ignoreModelSelector = 0 === intVal;\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return this.run(config);\r\n }\r\n}\r\n\r\nclass SectionMarkerDefaultConfigTool extends SectionMarkerConfigTool {\r\n public static override toolId = \"HyperModeling.Marker.Default.Config\";\r\n\r\n protected update(config: SectionMarkerConfig): void {\r\n HyperModeling.updateConfiguration({ markers: config });\r\n }\r\n}\r\n\r\nclass SectionMarkerDecoratorConfigTool extends SectionMarkerConfigTool {\r\n public static override toolId = \"HyperModeling.Marker.Config\";\r\n\r\n protected update(config: SectionMarkerConfig): void {\r\n const vp = IModelApp.viewManager.selectedView;\r\n const decorator = vp ? HyperModelingDecorator.getForViewport(vp) : undefined;\r\n if (decorator)\r\n decorator.updateConfiguration(config);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function registerTools(namespace: string): void {\r\n const register = (tool: typeof Tool) => IModelApp.tools.register(tool, namespace);\r\n register(HyperModelingTool);\r\n register(SectionGraphicsConfigTool);\r\n register(SectionMarkerDecoratorConfigTool);\r\n register(SectionMarkerDefaultConfigTool);\r\n}\r\n"]}
|
package/lib/esm/HyperModeling.js
CHANGED
|
@@ -22,6 +22,8 @@ function assertInitialized(maybe) {
|
|
|
22
22
|
* @public
|
|
23
23
|
*/
|
|
24
24
|
export class HyperModeling {
|
|
25
|
+
static { this._markerConfig = {}; }
|
|
26
|
+
static { this._graphicsConfig = {}; }
|
|
25
27
|
static shutdown() {
|
|
26
28
|
this.resources = undefined;
|
|
27
29
|
this._markerHandler = undefined;
|
|
@@ -229,6 +231,4 @@ export class HyperModeling {
|
|
|
229
231
|
}
|
|
230
232
|
}
|
|
231
233
|
}
|
|
232
|
-
HyperModeling._markerConfig = {};
|
|
233
|
-
HyperModeling._graphicsConfig = {};
|
|
234
234
|
//# sourceMappingURL=HyperModeling.js.map
|
|
@@ -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,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AC3C,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;;AA5Oc,2BAAa,GAAwB,EAAE,CAAC;AACxC,6BAAe,GAA0B,EAAE,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"]}
|
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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"]}
|
package/lib/esm/PopupToolbar.js
CHANGED
|
@@ -20,6 +20,17 @@ export class PopupToolbarManager {
|
|
|
20
20
|
this.closeAfterTimeout();
|
|
21
21
|
return true;
|
|
22
22
|
}
|
|
23
|
+
static { this._itemExecuted = (item) => {
|
|
24
|
+
const mgr = PopupToolbarManager;
|
|
25
|
+
if (mgr._current)
|
|
26
|
+
mgr._current.onToolbarItemExecuted(item.id);
|
|
27
|
+
mgr.close();
|
|
28
|
+
}; }
|
|
29
|
+
static { this._cancel = () => {
|
|
30
|
+
const mgr = PopupToolbarManager;
|
|
31
|
+
if (!mgr._current || !mgr._current.overToolbarHotspot)
|
|
32
|
+
mgr.close(); // Don't hide when click is over hotspot
|
|
33
|
+
}; }
|
|
23
34
|
static close() {
|
|
24
35
|
this._current = undefined;
|
|
25
36
|
return IModelApp.uiAdmin.hideToolbar();
|
|
@@ -40,15 +51,4 @@ export class PopupToolbarManager {
|
|
|
40
51
|
setTimeout(() => this.show(), 500);
|
|
41
52
|
}
|
|
42
53
|
}
|
|
43
|
-
PopupToolbarManager._itemExecuted = (item) => {
|
|
44
|
-
const mgr = PopupToolbarManager;
|
|
45
|
-
if (mgr._current)
|
|
46
|
-
mgr._current.onToolbarItemExecuted(item.id);
|
|
47
|
-
mgr.close();
|
|
48
|
-
};
|
|
49
|
-
PopupToolbarManager._cancel = () => {
|
|
50
|
-
const mgr = PopupToolbarManager;
|
|
51
|
-
if (!mgr._current || !mgr._current.overToolbarHotspot)
|
|
52
|
-
mgr.close(); // Don't hide when click is over hotspot
|
|
53
|
-
};
|
|
54
54
|
//# sourceMappingURL=PopupToolbar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupToolbar.js","sourceRoot":"","sources":["../../src/PopupToolbar.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAIH,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAWjD,gBAAgB;AAChB,MAAM,OAAO,mBAAmB;IAItB,MAAM,CAAC,IAAI;QACjB,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC;QAC5B,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,kBAAkB;YACnC,OAAO,KAAK,CAAC;QAEf,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC;QAChC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,eAAe,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC;YAC5I,OAAO,KAAK,CAAC;QAEf,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;QAC/B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;
|
|
1
|
+
{"version":3,"file":"PopupToolbar.js","sourceRoot":"","sources":["../../src/PopupToolbar.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAIH,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAWjD,gBAAgB;AAChB,M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AE,CAAC;IACzC,CAAC;IAEO,MAAM,CAAC,iBAAiB;QAC9B,IAAI,CAAC,IAAI,CAAC,QAAQ;YAChB,OAAO;QAET,MAAM,KAAK,GAAG,IAAI,CAAC;QACnB,IAAI,IAAI,CAAC,QAAQ,CAAC,kBAAkB,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,UAAU;YACrE,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,kDAAkD;;YAErG,IAAI,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;IAEM,MAAM,CAAC,uBAAuB,CAAC,QAA8B;QAClE,IAAI,IAAI,CAAC,QAAQ,KAAK,QAAQ;YAC5B,OAAO;QAET,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC;IACrC,CAAC","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 { XAndY } from \"@itwin/core-geometry\";\nimport type { AbstractToolbarProps } from \"@itwin/appui-abstract\";\nimport { IModelApp } from \"@itwin/core-frontend\";\n\n/** @internal */\nexport interface PopupToolbarProvider {\n toolbarProps: AbstractToolbarProps;\n overToolbarHotspot: boolean;\n toolbarLocation: XAndY;\n htmlElement: HTMLElement | undefined;\n onToolbarItemExecuted(id: string): void;\n}\n\n/** @internal */\nexport class PopupToolbarManager {\n private static _provider?: PopupToolbarProvider;\n private static _current?: PopupToolbarProvider;\n\n private static show(): boolean {\n const prov = this._provider;\n if (!prov || !prov.overToolbarHotspot)\n return false;\n\n const admin = IModelApp.uiAdmin;\n if (!admin.showToolbar(prov.toolbarProps, prov.toolbarLocation, { x: 0, y: 0 }, this._itemExecuted, this._cancel, undefined, prov.htmlElement))\n return false;\n\n this._current = this._provider;\n this._provider = undefined;\n this.closeAfterTimeout();\n return true;\n }\n\n private static _itemExecuted = (item: any) => {\n const mgr = PopupToolbarManager;\n if (mgr._current)\n mgr._current.onToolbarItemExecuted(item.id);\n\n mgr.close();\n };\n\n private static _cancel = () => {\n const mgr = PopupToolbarManager;\n if (!mgr._current || !mgr._current.overToolbarHotspot)\n mgr.close(); // Don't hide when click is over hotspot\n };\n\n private static close(): boolean {\n this._current = undefined;\n return IModelApp.uiAdmin.hideToolbar();\n }\n\n private static closeAfterTimeout(): void {\n if (!this._current)\n return;\n\n const delay = 1000;\n if (this._current.overToolbarHotspot || !IModelApp.toolAdmin.cursorView)\n setTimeout(() => this.closeAfterTimeout(), delay); // Cursor not in view or over hotspot, check again\n else\n this.close();\n }\n\n public static showToolbarAfterTimeout(provider: PopupToolbarProvider): void {\n if (this._current === provider)\n return;\n\n this._provider = provider;\n setTimeout(() => this.show(), 500);\n }\n}\n"]}
|
package/lib/esm/Tools.js
CHANGED
|
@@ -21,6 +21,7 @@ function parseToggle(arg) {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
class HyperModelingTool extends Tool {
|
|
24
|
+
static { this.toolId = "HyperModeling"; }
|
|
24
25
|
static get minArgs() { return 0; }
|
|
25
26
|
static get maxArgs() { return 1; }
|
|
26
27
|
async run(enable, vp) {
|
|
@@ -34,7 +35,6 @@ class HyperModelingTool extends Tool {
|
|
|
34
35
|
return typeof enable !== "string" && this.run(enable);
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
|
-
HyperModelingTool.toolId = "HyperModeling";
|
|
38
38
|
/** Configures how section graphics are displayed. These are global settings. If no arguments are supplied, the defaults are restored.
|
|
39
39
|
* Otherwise, each argument is of the form "name=value" where value is 0 (disable) or 1 (enable). Only the first letter of each argument matters.
|
|
40
40
|
* - drawings: Whether to display the section drawing graphics. Default: 1.
|
|
@@ -43,6 +43,7 @@ HyperModelingTool.toolId = "HyperModeling";
|
|
|
43
43
|
* - boundaries: Whether to display clip volumes as boundary shapes for debugging purposes. Default: 0.
|
|
44
44
|
*/
|
|
45
45
|
class SectionGraphicsConfigTool extends Tool {
|
|
46
|
+
static { this.toolId = "HyperModeling.Graphics.Config"; }
|
|
46
47
|
static get minArgs() { return 0; }
|
|
47
48
|
static get maxArgs() { return 4; }
|
|
48
49
|
async run(config) {
|
|
@@ -87,7 +88,6 @@ class SectionGraphicsConfigTool extends Tool {
|
|
|
87
88
|
return this.run(config);
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
|
-
SectionGraphicsConfigTool.toolId = "HyperModeling.Graphics.Config";
|
|
91
91
|
class SectionMarkerConfigTool extends Tool {
|
|
92
92
|
static get minArgs() { return 0; }
|
|
93
93
|
static get maxArgs() { return 3; }
|
|
@@ -142,12 +142,13 @@ class SectionMarkerConfigTool extends Tool {
|
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
class SectionMarkerDefaultConfigTool extends SectionMarkerConfigTool {
|
|
145
|
+
static { this.toolId = "HyperModeling.Marker.Default.Config"; }
|
|
145
146
|
update(config) {
|
|
146
147
|
HyperModeling.updateConfiguration({ markers: config });
|
|
147
148
|
}
|
|
148
149
|
}
|
|
149
|
-
SectionMarkerDefaultConfigTool.toolId = "HyperModeling.Marker.Default.Config";
|
|
150
150
|
class SectionMarkerDecoratorConfigTool extends SectionMarkerConfigTool {
|
|
151
|
+
static { this.toolId = "HyperModeling.Marker.Config"; }
|
|
151
152
|
update(config) {
|
|
152
153
|
const vp = IModelApp.viewManager.selectedView;
|
|
153
154
|
const decorator = vp ? HyperModelingDecorator.getForViewport(vp) : undefined;
|
|
@@ -155,7 +156,6 @@ class SectionMarkerDecoratorConfigTool extends SectionMarkerConfigTool {
|
|
|
155
156
|
decorator.updateConfiguration(config);
|
|
156
157
|
}
|
|
157
158
|
}
|
|
158
|
-
SectionMarkerDecoratorConfigTool.toolId = "HyperModeling.Marker.Config";
|
|
159
159
|
/** @internal */
|
|
160
160
|
export function registerTools(namespace) {
|
|
161
161
|
const register = (tool) => IModelApp.tools.register(tool, namespace);
|
package/lib/esm/Tools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tools.js","sourceRoot":"","sources":["../../src/Tools.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAkB,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,gKAAgK;AAChK,SAAS,WAAW,CAAC,GAAuB;IAC1C,IAAI,SAAS,KAAK,GAAG;QACnB,OAAO,SAAS,CAAC;IAEnB,QAAQ,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC;QAC1B,KAAK,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC;QACvB,KAAK,KAAK,CAAC,CAAC,OAAO,KAAK,CAAC;QACzB,KAAK,QAAQ,CAAC,CAAC,OAAO,SAAS,CAAC;QAChC,OAAO,CAAC,CAAC,OAAO,GAAG,CAAC;IACtB,CAAC;AACH,CAAC;AAED,MAAM,iBAAkB,SAAQ,IAAI;IAE3B,MAAM,KAAc,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3C,MAAM,KAAc,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAElC,KAAK,CAAC,GAAG,CAAC,MAAgB,EAAE,EAAmB;QAC7D,EAAE,GAAG,EAAE,IAAI,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC;QAC9C,IAAI,EAAE;YACJ,MAAM,aAAa,CAAC,WAAW,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;QAE9C,OAAO,IAAI,CAAC;IACd,CAAC;IAEe,KA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\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 { SectionType } from \"@itwin/core-common\";\r\nimport { IModelApp, ScreenViewport, Tool } from \"@itwin/core-frontend\";\r\nimport { HyperModeling } from \"./HyperModeling\";\r\nimport { SectionGraphicsConfig, SectionMarkerConfig } from \"./HyperModelingConfig\";\r\nimport { HyperModelingDecorator } from \"./HyperModelingDecorator\";\r\n\r\n/** Parses a string case-insensitively returning true for \"ON\", false for \"OFF\", undefined for \"TOGGLE\" or undefined, and the input string for anything else. */\r\nfunction parseToggle(arg: string | undefined): string | boolean | undefined {\r\n if (undefined === arg)\r\n return undefined;\r\n\r\n switch (arg.toLowerCase()) {\r\n case \"on\": return true;\r\n case \"off\": return false;\r\n case \"toggle\": return undefined;\r\n default: return arg;\r\n }\r\n}\r\n\r\nclass HyperModelingTool extends Tool {\r\n public static override toolId = \"HyperModeling\";\r\n public static override get minArgs() { return 0; }\r\n public static override get maxArgs() { return 1; }\r\n\r\n public override async run(enable?: boolean, vp?: ScreenViewport): Promise<boolean> {\r\n vp = vp ?? IModelApp.viewManager.selectedView;\r\n if (vp)\r\n await HyperModeling.startOrStop(vp, enable);\r\n\r\n return true;\r\n }\r\n\r\n public override async parseAndRun(...args: string[]): Promise<boolean> {\r\n const enable = parseToggle(args[0]);\r\n return typeof enable !== \"string\" && this.run(enable);\r\n }\r\n}\r\n\r\ntype Writeable<T> = { -readonly [P in keyof T]: T[P] };\r\n\r\n/** Configures how section graphics are displayed. These are global settings. If no arguments are supplied, the defaults are restored.\r\n * Otherwise, each argument is of the form \"name=value\" where value is 0 (disable) or 1 (enable). Only the first letter of each argument matters.\r\n * - drawings: Whether to display the section drawing graphics. Default: 1.\r\n * - sheets: Whether to display the sheet annotation graphics. Default: 1.\r\n * - clip: Whether to apply clip volumes to the 2d graphics. Default: 1.\r\n * - boundaries: Whether to display clip volumes as boundary shapes for debugging purposes. Default: 0.\r\n */\r\nclass SectionGraphicsConfigTool extends Tool {\r\n public static override toolId = \"HyperModeling.Graphics.Config\";\r\n public static override get minArgs() { return 0; }\r\n public static override get maxArgs() { return 4; }\r\n\r\n public override async run(config?: SectionGraphicsConfig): Promise<boolean> {\r\n if (!config) {\r\n config = {\r\n ignoreClip: false,\r\n debugClipVolumes: false,\r\n hideSectionGraphics: false,\r\n hideSheetAnnotations: false,\r\n };\r\n }\r\n\r\n HyperModeling.updateConfiguration({ graphics: config });\r\n return true;\r\n }\r\n\r\n public override async parseAndRun(...args: string[]): Promise<boolean> {\r\n if (0 === args.length)\r\n return this.run(); // restore defaults...\r\n\r\n const config: Writeable<SectionGraphicsConfig> = {};\r\n for (const arg of args) {\r\n const parts = arg.toLowerCase().split(\"=\");\r\n if (2 !== parts.length)\r\n continue;\r\n\r\n const value = Number.parseInt(parts[1], 10);\r\n if (Number.isNaN(value) || (0 !== value && 1 !== value))\r\n continue;\r\n\r\n const enable = 1 === value;\r\n switch (parts[0][0]) {\r\n case \"d\":\r\n config.hideSectionGraphics = !enable;\r\n break;\r\n case \"s\":\r\n config.hideSheetAnnotations = !enable;\r\n break;\r\n case \"c\":\r\n config.ignoreClip = !enable;\r\n break;\r\n case \"b\":\r\n config.debugClipVolumes = enable;\r\n break;\r\n }\r\n }\r\n\r\n return this.run(config);\r\n }\r\n}\r\n\r\nabstract class SectionMarkerConfigTool extends Tool {\r\n public static override get minArgs() { return 0; }\r\n public static override get maxArgs() { return 3; }\r\n\r\n protected abstract update(config: SectionMarkerConfig): void;\r\n\r\n public override async run(config?: SectionMarkerConfig): Promise<boolean> {\r\n config = config ?? { ignoreModelSelector: false, ignoreCategorySelector: false, hiddenSectionTypes: [] };\r\n this.update(config);\r\n return true;\r\n }\r\n\r\n public override async parseAndRun(...args: string[]): Promise<boolean> {\r\n if (0 === args.length)\r\n return this.run(); // restore defaults...\r\n\r\n const config: Writeable<SectionMarkerConfig> = {};\r\n for (const arg of args) {\r\n const parts = arg.toLowerCase().split(\"=\");\r\n if (2 !== parts.length)\r\n continue;\r\n\r\n const setting = parts[0][0];\r\n switch (setting) {\r\n case \"h\": {\r\n config.hiddenSectionTypes = [];\r\n for (const c of parts[1]) {\r\n switch (c) {\r\n case \"s\":\r\n config.hiddenSectionTypes.push(SectionType.Section);\r\n break;\r\n case \"d\":\r\n config.hiddenSectionTypes.push(SectionType.Detail);\r\n break;\r\n case \"e\":\r\n config.hiddenSectionTypes.push(SectionType.Elevation);\r\n break;\r\n case \"p\":\r\n config.hiddenSectionTypes.push(SectionType.Plan);\r\n break;\r\n }\r\n }\r\n\r\n break;\r\n }\r\n default: {\r\n const intVal = Number.parseInt(parts[1], 10);\r\n if (!Number.isNaN(intVal) && (0 === intVal || 1 === intVal)) {\r\n if (\"c\" === setting)\r\n config.ignoreCategorySelector = 0 === intVal;\r\n else if (\"m\" === setting)\r\n config.ignoreModelSelector = 0 === intVal;\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return this.run(config);\r\n }\r\n}\r\n\r\nclass SectionMarkerDefaultConfigTool extends SectionMarkerConfigTool {\r\n public static override toolId = \"HyperModeling.Marker.Default.Config\";\r\n\r\n protected update(config: SectionMarkerConfig): void {\r\n HyperModeling.updateConfiguration({ markers: config });\r\n }\r\n}\r\n\r\nclass SectionMarkerDecoratorConfigTool extends SectionMarkerConfigTool {\r\n public static override toolId = \"HyperModeling.Marker.Config\";\r\n\r\n protected update(config: SectionMarkerConfig): void {\r\n const vp = IModelApp.viewManager.selectedView;\r\n const decorator = vp ? HyperModelingDecorator.getForViewport(vp) : undefined;\r\n if (decorator)\r\n decorator.updateConfiguration(config);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function registerTools(namespace: string): void {\r\n const register = (tool: typeof Tool) => IModelApp.tools.register(tool, namespace);\r\n register(HyperModelingTool);\r\n register(SectionGraphicsConfigTool);\r\n register(SectionMarkerDecoratorConf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AO;4BACtB,MAAM,CAAC,mBAAmB,GAAG,CAAC,KAAK,MAAM,CAAC;oBAC9C,CAAC;oBAED,MAAM;gBACR,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;CACF;AAED,MAAM,8BAA+B,SAAQ,uBAAuB;aAC3C,WAAM,GAAG,qCAAqC,CAAC;IAE5D,MAAM,CAAC,MAA2B;QAC1C,aAAa,CAAC,mBAAmB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IACzD,CAAC;;AAGH,MAAM,gCAAiC,SAAQ,uBAAuB;aAC7C,WAAM,GAAG,6BAA6B,CAAC;IAEpD,MAAM,CAAC,MAA2B;QAC1C,MAAM,EAAE,GAAG,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC;QAC9C,MAAM,SAAS,GAAG,EAAE,CAAC,CAAC,CAAC,sBAAsB,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC7E,IAAI,SAAS;YACX,SAAS,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;;AAGH,gBAAgB;AAChB,MAAM,UAAU,aAAa,CAAC,SAAiB;IAC7C,MAAM,QAAQ,GAAG,CAAC,IAAiB,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAClF,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IAC5B,QAAQ,CAAC,yBAAyB,CAAC,CAAC;IACpC,QAAQ,CAAC,gCAAgC,CAAC,CAAC;IAC3C,QAAQ,CAAC,8BAA8B,CAAC,CAAC;AAC3C,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 { SectionType } from \"@itwin/core-common\";\r\nimport { IModelApp, ScreenViewport, Tool } from \"@itwin/core-frontend\";\r\nimport { HyperModeling } from \"./HyperModeling\";\r\nimport { SectionGraphicsConfig, SectionMarkerConfig } from \"./HyperModelingConfig\";\r\nimport { HyperModelingDecorator } from \"./HyperModelingDecorator\";\r\n\r\n/** Parses a string case-insensitively returning true for \"ON\", false for \"OFF\", undefined for \"TOGGLE\" or undefined, and the input string for anything else. */\r\nfunction parseToggle(arg: string | undefined): string | boolean | undefined {\r\n if (undefined === arg)\r\n return undefined;\r\n\r\n switch (arg.toLowerCase()) {\r\n case \"on\": return true;\r\n case \"off\": return false;\r\n case \"toggle\": return undefined;\r\n default: return arg;\r\n }\r\n}\r\n\r\nclass HyperModelingTool extends Tool {\r\n public static override toolId = \"HyperModeling\";\r\n public static override get minArgs() { return 0; }\r\n public static override get maxArgs() { return 1; }\r\n\r\n public override async run(enable?: boolean, vp?: ScreenViewport): Promise<boolean> {\r\n vp = vp ?? IModelApp.viewManager.selectedView;\r\n if (vp)\r\n await HyperModeling.startOrStop(vp, enable);\r\n\r\n return true;\r\n }\r\n\r\n public override async parseAndRun(...args: string[]): Promise<boolean> {\r\n const enable = parseToggle(args[0]);\r\n return typeof enable !== \"string\" && this.run(enable);\r\n }\r\n}\r\n\r\ntype Writeable<T> = { -readonly [P in keyof T]: T[P] };\r\n\r\n/** Configures how section graphics are displayed. These are global settings. If no arguments are supplied, the defaults are restored.\r\n * Otherwise, each argument is of the form \"name=value\" where value is 0 (disable) or 1 (enable). Only the first letter of each argument matters.\r\n * - drawings: Whether to display the section drawing graphics. Default: 1.\r\n * - sheets: Whether to display the sheet annotation graphics. Default: 1.\r\n * - clip: Whether to apply clip volumes to the 2d graphics. Default: 1.\r\n * - boundaries: Whether to display clip volumes as boundary shapes for debugging purposes. Default: 0.\r\n */\r\nclass SectionGraphicsConfigTool extends Tool {\r\n public static override toolId = \"HyperModeling.Graphics.Config\";\r\n public static override get minArgs() { return 0; }\r\n public static override get maxArgs() { return 4; }\r\n\r\n public override async run(config?: SectionGraphicsConfig): Promise<boolean> {\r\n if (!config) {\r\n config = {\r\n ignoreClip: false,\r\n debugClipVolumes: false,\r\n hideSectionGraphics: false,\r\n hideSheetAnnotations: false,\r\n };\r\n }\r\n\r\n HyperModeling.updateConfiguration({ graphics: config });\r\n return true;\r\n }\r\n\r\n public override async parseAndRun(...args: string[]): Promise<boolean> {\r\n if (0 === args.length)\r\n return this.run(); // restore defaults...\r\n\r\n const config: Writeable<SectionGraphicsConfig> = {};\r\n for (const arg of args) {\r\n const parts = arg.toLowerCase().split(\"=\");\r\n if (2 !== parts.length)\r\n continue;\r\n\r\n const value = Number.parseInt(parts[1], 10);\r\n if (Number.isNaN(value) || (0 !== value && 1 !== value))\r\n continue;\r\n\r\n const enable = 1 === value;\r\n switch (parts[0][0]) {\r\n case \"d\":\r\n config.hideSectionGraphics = !enable;\r\n break;\r\n case \"s\":\r\n config.hideSheetAnnotations = !enable;\r\n break;\r\n case \"c\":\r\n config.ignoreClip = !enable;\r\n break;\r\n case \"b\":\r\n config.debugClipVolumes = enable;\r\n break;\r\n }\r\n }\r\n\r\n return this.run(config);\r\n }\r\n}\r\n\r\nabstract class SectionMarkerConfigTool extends Tool {\r\n public static override get minArgs() { return 0; }\r\n public static override get maxArgs() { return 3; }\r\n\r\n protected abstract update(config: SectionMarkerConfig): void;\r\n\r\n public override async run(config?: SectionMarkerConfig): Promise<boolean> {\r\n config = config ?? { ignoreModelSelector: false, ignoreCategorySelector: false, hiddenSectionTypes: [] };\r\n this.update(config);\r\n return true;\r\n }\r\n\r\n public override async parseAndRun(...args: string[]): Promise<boolean> {\r\n if (0 === args.length)\r\n return this.run(); // restore defaults...\r\n\r\n const config: Writeable<SectionMarkerConfig> = {};\r\n for (const arg of args) {\r\n const parts = arg.toLowerCase().split(\"=\");\r\n if (2 !== parts.length)\r\n continue;\r\n\r\n const setting = parts[0][0];\r\n switch (setting) {\r\n case \"h\": {\r\n config.hiddenSectionTypes = [];\r\n for (const c of parts[1]) {\r\n switch (c) {\r\n case \"s\":\r\n config.hiddenSectionTypes.push(SectionType.Section);\r\n break;\r\n case \"d\":\r\n config.hiddenSectionTypes.push(SectionType.Detail);\r\n break;\r\n case \"e\":\r\n config.hiddenSectionTypes.push(SectionType.Elevation);\r\n break;\r\n case \"p\":\r\n config.hiddenSectionTypes.push(SectionType.Plan);\r\n break;\r\n }\r\n }\r\n\r\n break;\r\n }\r\n default: {\r\n const intVal = Number.parseInt(parts[1], 10);\r\n if (!Number.isNaN(intVal) && (0 === intVal || 1 === intVal)) {\r\n if (\"c\" === setting)\r\n config.ignoreCategorySelector = 0 === intVal;\r\n else if (\"m\" === setting)\r\n config.ignoreModelSelector = 0 === intVal;\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return this.run(config);\r\n }\r\n}\r\n\r\nclass SectionMarkerDefaultConfigTool extends SectionMarkerConfigTool {\r\n public static override toolId = \"HyperModeling.Marker.Default.Config\";\r\n\r\n protected update(config: SectionMarkerConfig): void {\r\n HyperModeling.updateConfiguration({ markers: config });\r\n }\r\n}\r\n\r\nclass SectionMarkerDecoratorConfigTool extends SectionMarkerConfigTool {\r\n public static override toolId = \"HyperModeling.Marker.Config\";\r\n\r\n protected update(config: SectionMarkerConfig): void {\r\n const vp = IModelApp.viewManager.selectedView;\r\n const decorator = vp ? HyperModelingDecorator.getForViewport(vp) : undefined;\r\n if (decorator)\r\n decorator.updateConfiguration(config);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function registerTools(namespace: string): void {\r\n const register = (tool: typeof Tool) => IModelApp.tools.register(tool, namespace);\r\n register(HyperModelingTool);\r\n register(SectionGraphicsConfigTool);\r\n register(SectionMarkerDecoratorConfigTool);\r\n register(SectionMarkerDefaultConfigTool);\r\n}\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/hypermodeling-frontend",
|
|
3
|
-
"version": "5.0.0-dev.
|
|
3
|
+
"version": "5.0.0-dev.40",
|
|
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": "
|
|
26
|
-
"@itwin/core-common": "
|
|
27
|
-
"@itwin/core-frontend": "
|
|
28
|
-
"@itwin/core-geometry": "
|
|
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"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@itwin/eslint-plugin": "5.0.0-dev.1",
|
|
@@ -42,16 +42,16 @@
|
|
|
42
42
|
"rimraf": "^3.0.2",
|
|
43
43
|
"source-map-loader": "^4.0.0",
|
|
44
44
|
"typescript": "~5.6.2",
|
|
45
|
-
"webpack": "^5.
|
|
46
|
-
"@itwin/build-tools": "5.0.0-dev.
|
|
47
|
-
"@itwin/core-
|
|
48
|
-
"@itwin/core-
|
|
49
|
-
"@itwin/core-
|
|
50
|
-
"@itwin/
|
|
51
|
-
"@itwin/
|
|
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"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@itwin/appui-abstract": "5.0.0-dev.
|
|
54
|
+
"@itwin/appui-abstract": "5.0.0-dev.40"
|
|
55
55
|
},
|
|
56
56
|
"nyc": {
|
|
57
57
|
"extends": "./node_modules/@itwin/build-tools/.nycrc"
|
|
@@ -59,11 +59,11 @@
|
|
|
59
59
|
"scripts": {
|
|
60
60
|
"build": "npm run -s copy:public && npm run -s build:cjs && npm run -s build:esm",
|
|
61
61
|
"build:cjs": "tsc 1>&2 --outDir lib/cjs",
|
|
62
|
-
"build:esm": "tsc 1>&2 --module
|
|
62
|
+
"build:esm": "tsc 1>&2 --module ES2022 --outDir lib/esm",
|
|
63
63
|
"clean": "rimraf lib .rush/temp/package-deps*.json",
|
|
64
64
|
"copy:public": "cpx \"./src/public/**/*\" ./lib/public",
|
|
65
65
|
"cover": "npm -s test",
|
|
66
|
-
"docs": "betools docs --
|
|
66
|
+
"docs": "betools docs --json=../../generated-docs/core/hypermodeling-frontend/file.json --tsIndexFile=./hypermodeling-frontend.ts --onlyJson",
|
|
67
67
|
"extract-api": "betools extract-api --entry=hypermodeling-frontend",
|
|
68
68
|
"lint": "eslint \"./src/**/*.ts\" 1>&2",
|
|
69
69
|
"pseudolocalize": "betools pseudolocalize --englishDir ./src/public/locales/en --out ./public/locales/en-PSEUDO",
|