@itwin/hypermodeling-frontend 3.0.0-dev.76 → 3.0.0-dev.80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/lib/{HyperModeling.d.ts → cjs/HyperModeling.d.ts} +0 -0
  2. package/lib/cjs/HyperModeling.d.ts.map +1 -0
  3. package/lib/{HyperModeling.js → cjs/HyperModeling.js} +3 -3
  4. package/lib/cjs/HyperModeling.js.map +1 -0
  5. package/lib/{HyperModelingConfig.d.ts → cjs/HyperModelingConfig.d.ts} +0 -0
  6. package/lib/cjs/HyperModelingConfig.d.ts.map +1 -0
  7. package/lib/{HyperModelingConfig.js → cjs/HyperModelingConfig.js} +0 -0
  8. package/lib/cjs/HyperModelingConfig.js.map +1 -0
  9. package/lib/{HyperModelingDecorator.d.ts → cjs/HyperModelingDecorator.d.ts} +0 -0
  10. package/lib/cjs/HyperModelingDecorator.d.ts.map +1 -0
  11. package/lib/{HyperModelingDecorator.js → cjs/HyperModelingDecorator.js} +2 -2
  12. package/lib/cjs/HyperModelingDecorator.js.map +1 -0
  13. package/lib/{PopupToolbar.d.ts → cjs/PopupToolbar.d.ts} +0 -0
  14. package/lib/cjs/PopupToolbar.d.ts.map +1 -0
  15. package/lib/{PopupToolbar.js → cjs/PopupToolbar.js} +0 -0
  16. package/lib/cjs/PopupToolbar.js.map +1 -0
  17. package/lib/{SectionDrawingLocationState.d.ts → cjs/SectionDrawingLocationState.d.ts} +0 -0
  18. package/lib/cjs/SectionDrawingLocationState.d.ts.map +1 -0
  19. package/lib/{SectionDrawingLocationState.js → cjs/SectionDrawingLocationState.js} +7 -28
  20. package/lib/cjs/SectionDrawingLocationState.js.map +1 -0
  21. package/lib/{SectionGraphicsProvider.d.ts → cjs/SectionGraphicsProvider.d.ts} +0 -0
  22. package/lib/cjs/SectionGraphicsProvider.d.ts.map +1 -0
  23. package/lib/{SectionGraphicsProvider.js → cjs/SectionGraphicsProvider.js} +10 -7
  24. package/lib/cjs/SectionGraphicsProvider.js.map +1 -0
  25. package/lib/{SectionMarkerHandler.d.ts → cjs/SectionMarkerHandler.d.ts} +0 -0
  26. package/lib/cjs/SectionMarkerHandler.d.ts.map +1 -0
  27. package/lib/{SectionMarkerHandler.js → cjs/SectionMarkerHandler.js} +0 -0
  28. package/lib/cjs/SectionMarkerHandler.js.map +1 -0
  29. package/lib/{SectionMarkers.d.ts → cjs/SectionMarkers.d.ts} +0 -0
  30. package/lib/cjs/SectionMarkers.d.ts.map +1 -0
  31. package/lib/{SectionMarkers.js → cjs/SectionMarkers.js} +0 -0
  32. package/lib/cjs/SectionMarkers.js.map +1 -0
  33. package/lib/{Tools.d.ts → cjs/Tools.d.ts} +0 -0
  34. package/lib/cjs/Tools.d.ts.map +1 -0
  35. package/lib/{Tools.js → cjs/Tools.js} +0 -0
  36. package/lib/cjs/Tools.js.map +1 -0
  37. package/lib/{hypermodeling-frontend.d.ts → cjs/hypermodeling-frontend.d.ts} +0 -0
  38. package/lib/cjs/hypermodeling-frontend.d.ts.map +1 -0
  39. package/lib/{hypermodeling-frontend.js → cjs/hypermodeling-frontend.js} +0 -0
  40. package/lib/cjs/hypermodeling-frontend.js.map +1 -0
  41. package/lib/esm/HyperModeling.d.ts +109 -0
  42. package/lib/esm/HyperModeling.d.ts.map +1 -0
  43. package/lib/esm/HyperModeling.js +221 -0
  44. package/lib/esm/HyperModeling.js.map +1 -0
  45. package/lib/esm/HyperModelingConfig.d.ts +55 -0
  46. package/lib/esm/HyperModelingConfig.d.ts.map +1 -0
  47. package/lib/esm/HyperModelingConfig.js +9 -0
  48. package/lib/esm/HyperModelingConfig.js.map +1 -0
  49. package/lib/esm/HyperModelingDecorator.d.ts +111 -0
  50. package/lib/esm/HyperModelingDecorator.d.ts.map +1 -0
  51. package/lib/esm/HyperModelingDecorator.js +334 -0
  52. package/lib/esm/HyperModelingDecorator.js.map +1 -0
  53. package/lib/esm/PopupToolbar.d.ts +25 -0
  54. package/lib/esm/PopupToolbar.d.ts.map +1 -0
  55. package/lib/esm/PopupToolbar.js +53 -0
  56. package/lib/esm/PopupToolbar.js.map +1 -0
  57. package/lib/esm/SectionDrawingLocationState.d.ts +91 -0
  58. package/lib/esm/SectionDrawingLocationState.d.ts.map +1 -0
  59. package/lib/esm/SectionDrawingLocationState.js +133 -0
  60. package/lib/esm/SectionDrawingLocationState.js.map +1 -0
  61. package/lib/esm/SectionGraphicsProvider.d.ts +14 -0
  62. package/lib/esm/SectionGraphicsProvider.d.ts.map +1 -0
  63. package/lib/esm/SectionGraphicsProvider.js +270 -0
  64. package/lib/esm/SectionGraphicsProvider.js.map +1 -0
  65. package/lib/esm/SectionMarkerHandler.d.ts +53 -0
  66. package/lib/esm/SectionMarkerHandler.d.ts.map +1 -0
  67. package/lib/esm/SectionMarkerHandler.js +109 -0
  68. package/lib/esm/SectionMarkerHandler.js.map +1 -0
  69. package/lib/esm/SectionMarkers.d.ts +83 -0
  70. package/lib/esm/SectionMarkers.d.ts.map +1 -0
  71. package/lib/esm/SectionMarkers.js +168 -0
  72. package/lib/esm/SectionMarkers.js.map +1 -0
  73. package/lib/esm/Tools.d.ts +7 -0
  74. package/lib/esm/Tools.d.ts.map +1 -0
  75. package/lib/esm/Tools.js +167 -0
  76. package/lib/esm/Tools.js.map +1 -0
  77. package/lib/esm/hypermodeling-frontend.d.ts +14 -0
  78. package/lib/esm/hypermodeling-frontend.d.ts.map +1 -0
  79. package/lib/esm/hypermodeling-frontend.js +18 -0
  80. package/lib/esm/hypermodeling-frontend.js.map +1 -0
  81. package/package.json +25 -22
  82. package/lib/HyperModeling.d.ts.map +0 -1
  83. package/lib/HyperModeling.js.map +0 -1
  84. package/lib/HyperModelingConfig.d.ts.map +0 -1
  85. package/lib/HyperModelingConfig.js.map +0 -1
  86. package/lib/HyperModelingDecorator.d.ts.map +0 -1
  87. package/lib/HyperModelingDecorator.js.map +0 -1
  88. package/lib/PopupToolbar.d.ts.map +0 -1
  89. package/lib/PopupToolbar.js.map +0 -1
  90. package/lib/SectionDrawingLocationState.d.ts.map +0 -1
  91. package/lib/SectionDrawingLocationState.js.map +0 -1
  92. package/lib/SectionGraphicsProvider.d.ts.map +0 -1
  93. package/lib/SectionGraphicsProvider.js.map +0 -1
  94. package/lib/SectionMarkerHandler.d.ts.map +0 -1
  95. package/lib/SectionMarkerHandler.js.map +0 -1
  96. package/lib/SectionMarkers.d.ts.map +0 -1
  97. package/lib/SectionMarkers.js.map +0 -1
  98. package/lib/Tools.d.ts.map +0 -1
  99. package/lib/Tools.js.map +0 -1
  100. package/lib/hypermodeling-frontend.d.ts.map +0 -1
  101. package/lib/hypermodeling-frontend.js.map +0 -1
  102. package/lib/public/locales/en-PSEUDO/HyperModeling.json +0 -32
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hypermodeling-frontend.js","sourceRoot":"","sources":["../../src/hypermodeling-frontend.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,kDAAgC;AAChC,wDAAsC;AACtC,2DAAyC;AACzC,yDAAuC;AACvC,gEAA8C;AAC9C,4DAA0C;AAC1C,mDAAiC;AAEjC;;GAEG;AAEH;;GAEG","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\nexport * from \"./HyperModeling\";\r\nexport * from \"./HyperModelingConfig\";\r\nexport * from \"./HyperModelingDecorator\";\r\nexport * from \"./SectionMarkerHandler\";\r\nexport * from \"./SectionDrawingLocationState\";\r\nexport * from \"./SectionGraphicsProvider\";\r\nexport * from \"./SectionMarkers\";\r\n\r\n/** @docs-package-description\r\n * The hypermodeling package enables visualization of section drawings in a spatial context.\r\n */\r\n\r\n/** @docs-group-description HyperModeling\r\n * APIs for controlling visualization of section drawings in a spatial context.\r\n */\r\n"]}
@@ -0,0 +1,109 @@
1
+ /** @packageDocumentation
2
+ * @module HyperModeling
3
+ */
4
+ import { SectionType } from "@itwin/core-common";
5
+ import { IModelConnection, ScreenViewport } from "@itwin/core-frontend";
6
+ import { HyperModelingDecorator } from "./HyperModelingDecorator";
7
+ import { HyperModelingConfig, SectionGraphicsConfig, SectionMarkerConfig } from "./HyperModelingConfig";
8
+ import { SectionMarkerHandler } from "./SectionMarkerHandler";
9
+ /** @internal */
10
+ export interface MarkerData {
11
+ readonly label: string;
12
+ readonly image: HTMLImageElement | undefined;
13
+ }
14
+ interface Resources {
15
+ readonly namespace?: string;
16
+ readonly markers: {
17
+ readonly section: MarkerData;
18
+ readonly plan: MarkerData;
19
+ readonly elevation: MarkerData;
20
+ readonly detail: MarkerData;
21
+ };
22
+ }
23
+ /** The API entry point for the hypermodeling package. Applications must call [[initialize]] and await the result before using the package.
24
+ * The behavior of the package can be customized via a [[HyperModelingConfig]] supplied to [[initialize]], [[updateConfiguration]], or [[replaceConfiguration]].
25
+ * Hypermodeling mode can be enabled or disabled via [[startOrStop]], which returns a [[HyperModelingDecorator]] when enabling hypermodeling.
26
+ * Consult the package's `README.md` for a description of the available functionality.
27
+ * @public
28
+ */
29
+ export declare class HyperModeling {
30
+ /** @internal */
31
+ static resources?: Resources;
32
+ private static _markerHandler?;
33
+ private static _markerConfig;
34
+ private static _graphicsConfig;
35
+ /** Invoke this method to initialize the hypermodeling package for use. You *must* await the result before using any of this package's APIs.
36
+ * Typically an application would invoke this after [IModelApp.startup]($frontend), e.g.,
37
+ * ```ts
38
+ * await IModelApp.startup();
39
+ * await HyperModeling.initialize();
40
+ * ```
41
+ * Calling this method again after the first initialization behaves the same as calling [[HyperModeling.replaceConfiguration]].
42
+ * @see [[replaceConfiguration]] and [[updateConfiguration]] to modify the configuration after initialization.
43
+ */
44
+ static initialize(config?: HyperModelingConfig): Promise<void>;
45
+ private static ensureInitialized;
46
+ /** Replaces the current package configuration, overwriting all previous settings. Passing `undefined` resets all settings to defaults.
47
+ * @see [[HyperModeling.updateConfiguration]] for overriding specific aspects of the configuration.
48
+ */
49
+ static replaceConfiguration(config?: HyperModelingConfig): void;
50
+ /** Overrides specific aspects of the current package configuration. Any field that is not `undefined` will be replaced in the current configuration;
51
+ * the rest will retain their current values.
52
+ * @see [[HyperModeling.replaceConfiguration]].
53
+ */
54
+ static updateConfiguration(config: HyperModelingConfig): void;
55
+ /** The handler that defines interactions with [[SectionMarker]]s.
56
+ * @see [[initialize]] to override the default handler at package initialization.
57
+ * @see [[updateConfiguration]] or [[replaceConfiguration]] to change the current handler.
58
+ */
59
+ static get markerHandler(): SectionMarkerHandler;
60
+ /** The current marker display configuration applied to any newly-created [[HyperModelingDecorator]]s.
61
+ * @see [[initialize]] to override the default configuration at package initialization.
62
+ * @see [[updateConfiguration]] or [[replaceConfiguration]] to change the current configuration.
63
+ * @see [[HyperModelingDecorator.replaceConfiguration]] or [[HyperModelingDecorator.updateConfiguration]] to change the configuration for an existing decorator.
64
+ */
65
+ static get markerConfig(): SectionMarkerConfig;
66
+ /** This graphics options applied to graphics displayed by all [[HyperModelingDecorator]]s.
67
+ * @see [[updateConfiguration]] or [[replaceConfiguration]] to change the current configuration.
68
+ */
69
+ static get graphicsConfig(): SectionGraphicsConfig;
70
+ /** Returns true if the specified iModel contains any [SectionDrawingLocation]($backend)s. Hypermodeling is based on section drawing locations,
71
+ * so if none are present, hypermodeling features are not relevant to the iModel. Attempting to use those features with such an iModel is fine,
72
+ * but probably not useful.
73
+ */
74
+ static isSupportedForIModel(imodel: IModelConnection): Promise<boolean>;
75
+ /** Returns whether hypermodeling is currently enabled for the specified viewport.
76
+ * @see [[startOrStop]] to enable or disable hypermodeling for a viewport.
77
+ */
78
+ static isEnabledForViewport(viewport: ScreenViewport): boolean;
79
+ /** Start or stop hypermodeling mode for the specified viewport.
80
+ * Enabling hypermodeling registers and returns a [[HyperModelingDecorator]] to display [[SectionMarker]]s within the viewport.
81
+ * Disabling hypermodeling removes that decorator.
82
+ * @param viewport The hypermodeling viewport
83
+ * @param start `true` to enter hypermodeling mode, `false` to exit, or `undefined` to toggle the current mode.
84
+ * @returns The new decorator is hypermodeling was successfully enabled.
85
+ * @note Enabling hypermodeling may fail if the viewport is not viewing a spatial model or if the viewport's iModel does not support hypermodeling.
86
+ * @see [[start]] and [[stop]].
87
+ * @see [[isSupportedForIModel]].
88
+ */
89
+ static startOrStop(viewport: ScreenViewport, start?: boolean): Promise<HyperModelingDecorator | undefined>;
90
+ /** Start hypermodeling mode for the specified viewport if it is not currently enabled.
91
+ * If hypermodeling is already enabled for the viewport, the existing decorator is returned; otherwise, a new decorator is created.
92
+ * @param viewport The viewport for which to enable hypermodeling
93
+ * @returns The decorator that implements hypermodeling features for the viewport, or `undefined` if hypermodeling could not be enabled.
94
+ * @note Enabling hypermodeling may fail if the viewport is not viewing a spatial model or if the viewport's iModel does not support hypermodeling.
95
+ */
96
+ static start(viewport: ScreenViewport): Promise<HyperModelingDecorator | undefined>;
97
+ private static _start;
98
+ /** Stop hypermodeling mode for the specified viewport if it is currently enabled. This disposes of the [[HyperModelingDecorator]] associated with the viewport.
99
+ * @see [[start]] to enable hypermodeling for a viewport.
100
+ * @see [[startOrStop]] to toggle hypermodeling mode.
101
+ */
102
+ static stop(viewport: ScreenViewport): void;
103
+ /** @internal */
104
+ static get namespace(): string | undefined;
105
+ /** @internal */
106
+ static getMarkerData(type: SectionType): MarkerData;
107
+ }
108
+ export {};
109
+ //# sourceMappingURL=HyperModeling.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HyperModeling.d.ts","sourceRoot":"","sources":["../../src/HyperModeling.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAa,gBAAgB,EAAE,cAAc,EAAqC,MAAM,sBAAsB,CAAC;AAEtH,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM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AC;IAUpF;;OAEG;WACW,oBAAoB,CAAC,QAAQ,EAAE,cAAc,GAAG,OAAO;IAIrE;;;;;;;;;OASG;WACiB,WAAW,CAAC,QAAQ,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,sBAAsB,GAAG,SAAS,CAAC;IAgBvH;;;;;OAKG;WACiB,KAAK,CAAC,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,sBAAsB,GAAG,SAAS,CAAC;mBAK3E,MAAM;IAmB3B;;;OAGG;WACW,IAAI,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAKlD,gBAAgB;IAChB,WAAkB,SAAS,IAAI,MAAM,GAAG,SAAS,CAGhD;IAED,gBAAgB;WACF,aAAa,CAAC,IAAI,EAAE,WAAW,GAAG,UAAU;CAa3D"}
@@ -0,0 +1,221 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /** @packageDocumentation
6
+ * @module HyperModeling
7
+ */
8
+ import { assert } from "@itwin/core-bentley";
9
+ import { SectionType } from "@itwin/core-common";
10
+ import { IModelApp, tryImageElementFromUrl, ViewManip } from "@itwin/core-frontend";
11
+ import { registerTools } from "./Tools";
12
+ import { HyperModelingDecorator } from "./HyperModelingDecorator";
13
+ import { SectionMarkerHandler } from "./SectionMarkerHandler";
14
+ function assertInitialized(maybe) {
15
+ if (undefined === maybe.resources)
16
+ throw new Error("You must call HyperModeling.initialize before using the hypermodeling package");
17
+ }
18
+ /** The API entry point for the hypermodeling package. Applications must call [[initialize]] and await the result before using the package.
19
+ * The behavior of the package can be customized via a [[HyperModelingConfig]] supplied to [[initialize]], [[updateConfiguration]], or [[replaceConfiguration]].
20
+ * Hypermodeling mode can be enabled or disabled via [[startOrStop]], which returns a [[HyperModelingDecorator]] when enabling hypermodeling.
21
+ * Consult the package's `README.md` for a description of the available functionality.
22
+ * @public
23
+ */
24
+ export class HyperModeling {
25
+ /** Invoke this method to initialize the hypermodeling package for use. You *must* await the result before using any of this package's APIs.
26
+ * Typically an application would invoke this after [IModelApp.startup]($frontend), e.g.,
27
+ * ```ts
28
+ * await IModelApp.startup();
29
+ * await HyperModeling.initialize();
30
+ * ```
31
+ * Calling this method again after the first initialization behaves the same as calling [[HyperModeling.replaceConfiguration]].
32
+ * @see [[replaceConfiguration]] and [[updateConfiguration]] to modify the configuration after initialization.
33
+ */
34
+ static async initialize(config) {
35
+ if (undefined !== this.resources) {
36
+ this.replaceConfiguration(config);
37
+ return;
38
+ }
39
+ const namespace = "HyperModeling";
40
+ await IModelApp.localization.registerNamespace(namespace);
41
+ const loadImages = [
42
+ tryImageElementFromUrl("section-marker.svg"),
43
+ tryImageElementFromUrl("detail-marker.svg"),
44
+ tryImageElementFromUrl("elevation-marker.svg"),
45
+ tryImageElementFromUrl("plan-marker.svg"),
46
+ ];
47
+ const images = await Promise.all(loadImages);
48
+ this.resources = {
49
+ namespace,
50
+ markers: {
51
+ section: { image: images[0], label: IModelApp.localization.getLocalizedString("HyperModeling:Message.SectionCallout") },
52
+ detail: { image: images[1], label: IModelApp.localization.getLocalizedString("HyperModeling:Message.DetailCallout") },
53
+ elevation: { image: images[2], label: IModelApp.localization.getLocalizedString("HyperModeling:Message.ElevationCallout") },
54
+ plan: { image: images[3], label: IModelApp.localization.getLocalizedString("HyperModeling:Message.PlanCallout") },
55
+ },
56
+ };
57
+ registerTools(namespace, IModelApp.localization);
58
+ this.replaceConfiguration(config);
59
+ }
60
+ static async ensureInitialized() {
61
+ if (undefined === this.resources)
62
+ await this.initialize();
63
+ assertInitialized(this);
64
+ }
65
+ /** Replaces the current package configuration, overwriting all previous settings. Passing `undefined` resets all settings to defaults.
66
+ * @see [[HyperModeling.updateConfiguration]] for overriding specific aspects of the configuration.
67
+ */
68
+ static replaceConfiguration(config) {
69
+ var _a;
70
+ config = config !== null && config !== void 0 ? config : {};
71
+ this._markerHandler = (_a = config.markerHandler) !== null && _a !== void 0 ? _a : new SectionMarkerHandler();
72
+ this._markerConfig = config.markers ? { ...config.markers } : {};
73
+ this._graphicsConfig = config.graphics ? { ...config.graphics } : {};
74
+ }
75
+ /** Overrides specific aspects of the current package configuration. Any field that is not `undefined` will be replaced in the current configuration;
76
+ * the rest will retain their current values.
77
+ * @see [[HyperModeling.replaceConfiguration]].
78
+ */
79
+ static updateConfiguration(config) {
80
+ var _a, _b, _c, _d, _e, _f, _g, _h;
81
+ this._markerHandler = (_a = config.markerHandler) !== null && _a !== void 0 ? _a : this._markerHandler;
82
+ if (config.markers) {
83
+ this._markerConfig = {
84
+ ignoreModelSelector: (_b = config.markers.ignoreModelSelector) !== null && _b !== void 0 ? _b : this._markerConfig.ignoreModelSelector,
85
+ ignoreCategorySelector: (_c = config.markers.ignoreCategorySelector) !== null && _c !== void 0 ? _c : this._markerConfig.ignoreCategorySelector,
86
+ hiddenSectionTypes: (_d = config.markers.hiddenSectionTypes) !== null && _d !== void 0 ? _d : this._markerConfig.hiddenSectionTypes,
87
+ };
88
+ }
89
+ if (config.graphics) {
90
+ this._graphicsConfig = {
91
+ ignoreClip: (_e = config.graphics.ignoreClip) !== null && _e !== void 0 ? _e : this._graphicsConfig.ignoreClip,
92
+ debugClipVolumes: (_f = config.graphics.debugClipVolumes) !== null && _f !== void 0 ? _f : this._graphicsConfig.debugClipVolumes,
93
+ hideSectionGraphics: (_g = config.graphics.hideSectionGraphics) !== null && _g !== void 0 ? _g : this._graphicsConfig.hideSectionGraphics,
94
+ hideSheetAnnotations: (_h = config.graphics.hideSheetAnnotations) !== null && _h !== void 0 ? _h : this._graphicsConfig.hideSheetAnnotations,
95
+ };
96
+ IModelApp.viewManager.invalidateViewportScenes();
97
+ }
98
+ }
99
+ /** The handler that defines interactions with [[SectionMarker]]s.
100
+ * @see [[initialize]] to override the default handler at package initialization.
101
+ * @see [[updateConfiguration]] or [[replaceConfiguration]] to change the current handler.
102
+ */
103
+ static get markerHandler() {
104
+ assertInitialized(this);
105
+ assert(undefined !== this._markerHandler);
106
+ return this._markerHandler;
107
+ }
108
+ /** The current marker display configuration applied to any newly-created [[HyperModelingDecorator]]s.
109
+ * @see [[initialize]] to override the default configuration at package initialization.
110
+ * @see [[updateConfiguration]] or [[replaceConfiguration]] to change the current configuration.
111
+ * @see [[HyperModelingDecorator.replaceConfiguration]] or [[HyperModelingDecorator.updateConfiguration]] to change the configuration for an existing decorator.
112
+ */
113
+ static get markerConfig() {
114
+ return this._markerConfig;
115
+ }
116
+ /** This graphics options applied to graphics displayed by all [[HyperModelingDecorator]]s.
117
+ * @see [[updateConfiguration]] or [[replaceConfiguration]] to change the current configuration.
118
+ */
119
+ static get graphicsConfig() {
120
+ return this._graphicsConfig;
121
+ }
122
+ /** Returns true if the specified iModel contains any [SectionDrawingLocation]($backend)s. Hypermodeling is based on section drawing locations,
123
+ * so if none are present, hypermodeling features are not relevant to the iModel. Attempting to use those features with such an iModel is fine,
124
+ * but probably not useful.
125
+ */
126
+ static async isSupportedForIModel(imodel) {
127
+ try {
128
+ const nRows = await imodel.queryRowCount("SELECT ECInstanceId FROM bis.SectionDrawingLocation LIMIT 1");
129
+ return nRows > 0;
130
+ }
131
+ catch {
132
+ // An iModel with a version of BisCore older than 1.0.11 will produce an expected "table not found" on the SectionDrawingLocation ECClass.
133
+ return false;
134
+ }
135
+ }
136
+ /** Returns whether hypermodeling is currently enabled for the specified viewport.
137
+ * @see [[startOrStop]] to enable or disable hypermodeling for a viewport.
138
+ */
139
+ static isEnabledForViewport(viewport) {
140
+ return undefined !== HyperModelingDecorator.getForViewport(viewport);
141
+ }
142
+ /** Start or stop hypermodeling mode for the specified viewport.
143
+ * Enabling hypermodeling registers and returns a [[HyperModelingDecorator]] to display [[SectionMarker]]s within the viewport.
144
+ * Disabling hypermodeling removes that decorator.
145
+ * @param viewport The hypermodeling viewport
146
+ * @param start `true` to enter hypermodeling mode, `false` to exit, or `undefined` to toggle the current mode.
147
+ * @returns The new decorator is hypermodeling was successfully enabled.
148
+ * @note Enabling hypermodeling may fail if the viewport is not viewing a spatial model or if the viewport's iModel does not support hypermodeling.
149
+ * @see [[start]] and [[stop]].
150
+ * @see [[isSupportedForIModel]].
151
+ */
152
+ static async startOrStop(viewport, start) {
153
+ // Help out the caller since we're async anyway...
154
+ await this.ensureInitialized();
155
+ const decorator = HyperModelingDecorator.getForViewport(viewport);
156
+ if (undefined === start)
157
+ start = undefined === decorator;
158
+ if (start) {
159
+ return this._start(viewport);
160
+ }
161
+ else {
162
+ decorator === null || decorator === void 0 ? void 0 : decorator.dispose();
163
+ return undefined;
164
+ }
165
+ }
166
+ /** Start hypermodeling mode for the specified viewport if it is not currently enabled.
167
+ * If hypermodeling is already enabled for the viewport, the existing decorator is returned; otherwise, a new decorator is created.
168
+ * @param viewport The viewport for which to enable hypermodeling
169
+ * @returns The decorator that implements hypermodeling features for the viewport, or `undefined` if hypermodeling could not be enabled.
170
+ * @note Enabling hypermodeling may fail if the viewport is not viewing a spatial model or if the viewport's iModel does not support hypermodeling.
171
+ */
172
+ static async start(viewport) {
173
+ await this.ensureInitialized();
174
+ return this._start(viewport);
175
+ }
176
+ static async _start(viewport) {
177
+ assertInitialized(this);
178
+ if (!viewport.view.isSpatialView())
179
+ return undefined;
180
+ let decorator = HyperModelingDecorator.getForViewport(viewport);
181
+ if (!decorator)
182
+ decorator = await HyperModelingDecorator.create(viewport, this._markerConfig);
183
+ if (undefined !== decorator && viewport.view.isCameraOn) {
184
+ // We want the 2d graphics to align with the 3d geometry. Perspective ruins that.
185
+ viewport.view.turnCameraOff();
186
+ ViewManip.fitView(viewport, false, { noSaveInUndo: true });
187
+ viewport.clearViewUndo();
188
+ }
189
+ return decorator;
190
+ }
191
+ /** Stop hypermodeling mode for the specified viewport if it is currently enabled. This disposes of the [[HyperModelingDecorator]] associated with the viewport.
192
+ * @see [[start]] to enable hypermodeling for a viewport.
193
+ * @see [[startOrStop]] to toggle hypermodeling mode.
194
+ */
195
+ static stop(viewport) {
196
+ const decorator = HyperModelingDecorator.getForViewport(viewport);
197
+ decorator === null || decorator === void 0 ? void 0 : decorator.dispose();
198
+ }
199
+ /** @internal */
200
+ static get namespace() {
201
+ assertInitialized(this);
202
+ return this.resources.namespace;
203
+ }
204
+ /** @internal */
205
+ static getMarkerData(type) {
206
+ assertInitialized(this);
207
+ switch (type) {
208
+ case SectionType.Plan:
209
+ return this.resources.markers.plan;
210
+ case SectionType.Elevation:
211
+ return this.resources.markers.elevation;
212
+ case SectionType.Detail:
213
+ return this.resources.markers.detail;
214
+ default:
215
+ return this.resources.markers.section;
216
+ }
217
+ }
218
+ }
219
+ HyperModeling._markerConfig = {};
220
+ HyperModeling._graphicsConfig = {};
221
+ //# sourceMappingURL=HyperModeling.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HyperModeling.js","sourceRoot":"","sources":["../../src/HyperModeling.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAoC,sBAAsB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtH,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AA0B9D,SAAS,iBAAiB,CAAC,KAAuB;IAChD,IAAI,SAAS,KAAK,KAAK,CAAC,SAAS;QAC/B,MAAM,IAAI,KAAK,CAAC,+EAA+E,CAAC,CAAC;AACrG,CAAC;AAED;;;;;GAKG;AACH,MAAM,OAAO,aAAa;IAOxB;;;;;;;;OAQG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,MAA4B;QACzD,IAAI,SAAS,KAA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C;YAC3D,QAAQ,CAAC,aAAa,EAAE,CAAC;SAC1B;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,aAAT,SAAS,uBAAT,SAAS,CAAE,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;YACZ,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;SACzC;IACH,CAAC;;AA1Nc,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 /** 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 * @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 const namespace = \"HyperModeling\";\r\n await IModelApp.localization.registerNamespace(namespace);\r\n\r\n const loadImages = [\r\n tryImageElementFromUrl(\"section-marker.svg\"),\r\n tryImageElementFromUrl(\"detail-marker.svg\"),\r\n tryImageElementFromUrl(\"elevation-marker.svg\"),\r\n tryImageElementFromUrl(\"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, IModelApp.localization);\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 nRows = await imodel.queryRowCount(\"SELECT ECInstanceId FROM bis.SectionDrawingLocation LIMIT 1\");\r\n return nRows > 0;\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"]}
@@ -0,0 +1,55 @@
1
+ /** @packageDocumentation
2
+ * @module HyperModeling
3
+ */
4
+ import { SectionType } from "@itwin/core-common";
5
+ import { SectionMarkerHandler } from "./SectionMarkerHandler";
6
+ /** Configures display of [[SectionMarker]]s for [[HyperModelingDecorator]]s.
7
+ * @see [[HyperModelingDecorator.updateConfiguration]] or [[HyperModelingDecorator.replaceConfiguration]] to change the configuration for a specific decorator.
8
+ * @see [[HyperModeling.initialize]] to set the default configuration for all decorators at package initialization.
9
+ * @see [[HyperModeling.updateConfiguration]] or [[HyperModeling.replaceConfiguration]] to change the default configuration for all subsequently created decorators.
10
+ * @see [[HyperModelingConfig]].
11
+ * @public
12
+ */
13
+ export interface SectionMarkerConfig {
14
+ /** Whether to hide markers belonging to models that are not present in the view's [ModelSelector]($backend). If true, markers are displayed regardless of their models. */
15
+ readonly ignoreModelSelector?: boolean;
16
+ /** Whether to hide markers belonging to categories that are not present in the view's [CategorySelector]($backend). If true, markers are displayed regardless of their categories. */
17
+ readonly ignoreCategorySelector?: boolean;
18
+ /** A list of types of section markers that shouold not be displayed. By default, markers for all section types are displayed. */
19
+ readonly hiddenSectionTypes?: SectionType[];
20
+ }
21
+ /** Configures how 2d graphics are displayed by a [[HyperModelingDecorator]] when hypermodeling is active.
22
+ * This configuration is used primarily for debugging, and applies globally to section graphics associated with all [[HyperModelingDecorator]]s.
23
+ * @see [[HyperModeling.initialize]] to set this configuration at package initialization.
24
+ * @see [[HyperModeling.updateConfiguration]] or [[HyperModeling.replaceConfiguration]] to change this configuration after package initialization.
25
+ * @see [[HyperModelingConfig]].
26
+ * @public
27
+ */
28
+ export interface SectionGraphicsConfig {
29
+ /** If true, 2d graphics will not be clipped. */
30
+ readonly ignoreClip?: boolean;
31
+ /** If true, clip volumes for 2d graphics are displayed as shapes. */
32
+ readonly debugClipVolumes?: boolean;
33
+ /** If true, [SectionDrawing]($backend) graphics will not be displayed.
34
+ * @see [[hideSheetAnnotations]]
35
+ */
36
+ readonly hideSectionGraphics?: boolean;
37
+ /** If true, [Sheet]($backend) annotation graphics will not be displayed.
38
+ * @see [[hideSectionGraphics]]
39
+ */
40
+ readonly hideSheetAnnotations?: boolean;
41
+ }
42
+ /** Configuration options for the hyper-modeling package.
43
+ * @see [[HyperModeling.initialize]] to set the configuration at package initialization.
44
+ * @see [[HyperModeling.updateConfiguration]] or [[HyperModeling.replaceConfiguration]] to modify the configuration after package initialization.
45
+ * @public
46
+ */
47
+ export interface HyperModelingConfig {
48
+ /** Specifies how the user interacts with [[SectionMarker]]s. If omitted, the default interactions will be used. */
49
+ readonly markerHandler?: SectionMarkerHandler;
50
+ /** Default [[SectionMarker]] display configuration used when creating a new [[HyperModelingDecorator]]. */
51
+ readonly markers?: SectionMarkerConfig;
52
+ /** Global section graphics configuration used by all [[HyperModelingDecorator]]s when displaying drawings and sheets in a spatial view. Primarily for debugging. */
53
+ readonly graphics?: SectionGraphicsConfig;
54
+ }
55
+ //# sourceMappingURL=HyperModelingConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HyperModelingConfig.d.ts","sourceRoot":"","sources":["../../src/HyperModelingConfig.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC,2KAA2K;IAC3K,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IACvC,sLAAsL;IACtL,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAC1C,iIAAiI;IACjI,QAAQ,CAAC,kBAAkB,CAAC,EAAE,WAAW,EAAE,CAAC;CAC7C;AAED;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB;IACpC,gDAAgD;IAChD,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,qEAAqE;IACrE,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IACpC;;OAEG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IACvC;;OAEG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC;CACzC;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,mHAAmH;IACnH,QAAQ,CAAC,aAAa,CAAC,EAAE,oBAAoB,CAAC;IAC9C,2GAA2G;IAC3G,QAAQ,CAAC,OAAO,CAAC,EAAE,mBAAmB,CAAC;IACvC,oKAAoK;IACpK,QAAQ,CAAC,QAAQ,CAAC,EAAE,qBAAqB,CAAC;CAC3C"}
@@ -0,0 +1,9 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /** @packageDocumentation
6
+ * @module HyperModeling
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=HyperModelingConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HyperModelingConfig.js","sourceRoot":"","sources":["../../src/HyperModelingConfig.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG","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 { SectionMarkerHandler } from \"./SectionMarkerHandler\";\r\n\r\n/** Configures display of [[SectionMarker]]s for [[HyperModelingDecorator]]s.\r\n * @see [[HyperModelingDecorator.updateConfiguration]] or [[HyperModelingDecorator.replaceConfiguration]] to change the configuration for a specific decorator.\r\n * @see [[HyperModeling.initialize]] to set the default configuration for all decorators at package initialization.\r\n * @see [[HyperModeling.updateConfiguration]] or [[HyperModeling.replaceConfiguration]] to change the default configuration for all subsequently created decorators.\r\n * @see [[HyperModelingConfig]].\r\n * @public\r\n */\r\nexport interface SectionMarkerConfig {\r\n /** Whether to hide markers belonging to models that are not present in the view's [ModelSelector]($backend). If true, markers are displayed regardless of their models. */\r\n readonly ignoreModelSelector?: boolean;\r\n /** Whether to hide markers belonging to categories that are not present in the view's [CategorySelector]($backend). If true, markers are displayed regardless of their categories. */\r\n readonly ignoreCategorySelector?: boolean;\r\n /** A list of types of section markers that shouold not be displayed. By default, markers for all section types are displayed. */\r\n readonly hiddenSectionTypes?: SectionType[];\r\n}\r\n\r\n/** Configures how 2d graphics are displayed by a [[HyperModelingDecorator]] when hypermodeling is active.\r\n * This configuration is used primarily for debugging, and applies globally to section graphics associated with all [[HyperModelingDecorator]]s.\r\n * @see [[HyperModeling.initialize]] to set this configuration at package initialization.\r\n * @see [[HyperModeling.updateConfiguration]] or [[HyperModeling.replaceConfiguration]] to change this configuration after package initialization.\r\n * @see [[HyperModelingConfig]].\r\n * @public\r\n */\r\nexport interface SectionGraphicsConfig {\r\n /** If true, 2d graphics will not be clipped. */\r\n readonly ignoreClip?: boolean;\r\n /** If true, clip volumes for 2d graphics are displayed as shapes. */\r\n readonly debugClipVolumes?: boolean;\r\n /** If true, [SectionDrawing]($backend) graphics will not be displayed.\r\n * @see [[hideSheetAnnotations]]\r\n */\r\n readonly hideSectionGraphics?: boolean;\r\n /** If true, [Sheet]($backend) annotation graphics will not be displayed.\r\n * @see [[hideSectionGraphics]]\r\n */\r\n readonly hideSheetAnnotations?: boolean;\r\n}\r\n\r\n/** Configuration options for the hyper-modeling package.\r\n * @see [[HyperModeling.initialize]] to set the configuration at package initialization.\r\n * @see [[HyperModeling.updateConfiguration]] or [[HyperModeling.replaceConfiguration]] to modify the configuration after package initialization.\r\n * @public\r\n */\r\nexport interface HyperModelingConfig {\r\n /** Specifies how the user interacts with [[SectionMarker]]s. If omitted, the default interactions will be used. */\r\n readonly markerHandler?: SectionMarkerHandler;\r\n /** Default [[SectionMarker]] display configuration used when creating a new [[HyperModelingDecorator]]. */\r\n readonly markers?: SectionMarkerConfig;\r\n /** Global section graphics configuration used by all [[HyperModelingDecorator]]s when displaying drawings and sheets in a spatial view. Primarily for debugging. */\r\n readonly graphics?: SectionGraphicsConfig;\r\n}\r\n"]}
@@ -0,0 +1,111 @@
1
+ /** @packageDocumentation
2
+ * @module HyperModeling
3
+ */
4
+ import { DecorateContext, Decorator, ScreenViewport } from "@itwin/core-frontend";
5
+ import { SectionMarker, SectionMarkerSet } from "./SectionMarkers";
6
+ import { SectionMarkerConfig } from "./HyperModelingConfig";
7
+ /** A [Decorator]($frontend) that displays a [[SectionMarker]] for each [SectionDrawingLocation]($backend) in the view.
8
+ * Clicking on a marker toggles the section and the display of associated 2d graphics.
9
+ * Hovering over a marker opens a mini toolbar with additional interactions.
10
+ * @see [[SectionMarkerHandler]] to customize the marker interactions.
11
+ * @see [[HyperModeling.startOrStop]] to enable or disable the decorator for a viewport.
12
+ * @public
13
+ */
14
+ export declare class HyperModelingDecorator implements Decorator {
15
+ /** The set of [[SectionMarker]]s controlled by this decorator. */
16
+ readonly markers: SectionMarkerSet;
17
+ private _config;
18
+ private readonly _removeEventListeners;
19
+ private readonly _iModel;
20
+ private _needSync;
21
+ private _toolbarProvider?;
22
+ private _tiledGraphicsProvider?;
23
+ private _activeMarker?;
24
+ private _appliedSpatialView?;
25
+ /** @internal */
26
+ syncImmediately: boolean;
27
+ /** Create a new decorator and register it with the [ViewManager]($frontend). Typically invoked indirectly via [[HyperModeling.startOrStop]]. */
28
+ static create(vp: ScreenViewport, config: SectionMarkerConfig): Promise<HyperModelingDecorator | undefined>;
29
+ /** Obtain the decorator associated with the specified viewport, if any. */
30
+ static getForViewport(vp: ScreenViewport): HyperModelingDecorator | undefined;
31
+ /** The viewport into which this decorator draws its [[SectionMarker]]s. */
32
+ get viewport(): ScreenViewport;
33
+ /** The currently active marker. A marker typically becomes active when the user clicks on it.
34
+ * @see [[setActiveMarker]] to change the active marker without user interaction.
35
+ */
36
+ get activeMarker(): SectionMarker | undefined;
37
+ /** @internal */
38
+ get config(): SectionMarkerConfig;
39
+ /** Replaces the current marker display configuration, overwriting all previous settings. Passing `undefined` resets all settings to defaults.
40
+ * @see [[updateConfiguration]] to override specific aspects of the configuration
41
+ * @see [[HyperModeling.replaceConfiguration]] to replace the global configuration.
42
+ */
43
+ replaceConfiguration(config?: SectionMarkerConfig): void;
44
+ /** Overrides specific aspects of the current marker display configuration.
45
+ * Any field that is not `undefined` will be replaced in the current configuration; the rest will retain their current values.
46
+ * @see [[replaceConfiguration]] to override all settings.
47
+ * @see [[HyperModeling.updateConfiguration]] to update the global configuration.
48
+ */
49
+ updateConfiguration(config: SectionMarkerConfig): void;
50
+ /** Sets the currently active marker. This function is invoked when the user clicks on a marker, but may also be called manually to produce the same result.
51
+ * Changing the active marker first deactivates the currently active marker, if any; then activates the specified marker, if supplied.
52
+ * Returns false if marker activation fails.
53
+ * @see [[activeMarker]] to obtain the currently active section marker.
54
+ * @see [[SectionMarkerHandler.activateMarker]] to control what happens when a marker is activated.
55
+ * @see [[SectionMarkerHandler.deactivateMarker]] to control what happens when a marker is deactivated.
56
+ */
57
+ setActiveMarker(marker: SectionMarker | undefined): Promise<boolean>;
58
+ /** @internal */
59
+ readonly useCachedDecorations = true;
60
+ /** @internal */
61
+ decorate(context: DecorateContext): void;
62
+ private constructor();
63
+ private onViewportChanged;
64
+ private toggleMarker;
65
+ private dropTiledGraphicsProvider;
66
+ /** @internal */
67
+ dispose(): void;
68
+ private showToolbarAfterTimeout;
69
+ /** Toggles whether the clip volume associated with the specified marker is applied to the view. */
70
+ toggleClipVolume(marker: SectionMarker, enable: boolean): void;
71
+ /** Toggles the specified section marker.
72
+ * Enabling the section applies the frustum and clip volume of the marker's spatial view to the viewport, and displays the 2d section graphics and sheet annotations.
73
+ * Disabling the section disables the clip volume and 2d graphics.
74
+ * @see [[toggleClipVolume]] to toggle only the clip volume.
75
+ * @see [[toggleAttachment]] to toggle only the attachment graphics.
76
+ */
77
+ toggleSection(marker: SectionMarker, enable: boolean): Promise<boolean>;
78
+ /** Toggles display of 2d section graphics and sheet annotations for the specified marker.
79
+ * @see [[toggleSection]] to apply the spatial view and clip volume in addition to the attachment graphics.
80
+ */
81
+ toggleAttachment(marker: SectionMarker, enable: boolean): Promise<boolean>;
82
+ /** Aligns the viewport to face the specified marker's section plane. */
83
+ alignView(marker: SectionMarker): void;
84
+ /** Opens the marker's drawing view in the decorator's viewport. Returns false if the drawing view could not be loaded. */
85
+ openSection(marker: SectionMarker): Promise<boolean>;
86
+ /** Opens marker's sheet view in the decorator's viewport and zooms in on the associated [ViewAttachment]($backend). Returns false if no view
87
+ * attachment exists or the sheet view could not be loaded.
88
+ */
89
+ openSheet(marker: SectionMarker): Promise<boolean>;
90
+ /** Aligns the view to match the frustum of the spatial view associated with the specified marker.
91
+ * @param marker The marker whose spatial view's frustum should be applied.
92
+ * @returns false if the frustum could not be applied, e.g. because the spatial view could not be loaded or the viewport is viewing a 2d model.
93
+ * @see [[alignView]] to align to the *section plane*, which may differ.
94
+ * @see [[toggleSection]] to also apply the clip volume.
95
+ */
96
+ alignToSpatialView(marker: SectionMarker): Promise<boolean>;
97
+ /** Applies the marker's spatial view - including its clip volume - to the decorator's viewport.
98
+ * Returns false if the spatial view could not be loaded.
99
+ * @see [[toggleSection]].
100
+ * @see [[toggleClipVolume]].
101
+ */
102
+ applySpatialView(marker: SectionMarker): Promise<boolean>;
103
+ /** Request that the visibility of the section markers be recomputed. It is only necessary to call this if you have overridden [[SectionMarkerHandler.isMarkerVisible]]; if so, you should invoke
104
+ * this method when the criteria governing your `isMarkerVisible` method have changed.
105
+ */
106
+ requestSync(): void;
107
+ private sync;
108
+ private isMarkerVisible;
109
+ private updateMarkerVisibility;
110
+ }
111
+ //# sourceMappingURL=Hyper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