@itwin/hypermodeling-frontend 4.0.0-dev.6 → 4.0.0-dev.61

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 (61) hide show
  1. package/CHANGELOG.md +13 -1
  2. package/lib/cjs/HyperModeling.d.ts +114 -114
  3. package/lib/cjs/HyperModeling.d.ts.map +1 -1
  4. package/lib/cjs/HyperModeling.js +238 -239
  5. package/lib/cjs/HyperModeling.js.map +1 -1
  6. package/lib/cjs/HyperModelingConfig.d.ts +54 -54
  7. package/lib/cjs/HyperModelingConfig.js +9 -9
  8. package/lib/cjs/HyperModelingDecorator.d.ts +110 -110
  9. package/lib/cjs/HyperModelingDecorator.js +335 -337
  10. package/lib/cjs/HyperModelingDecorator.js.map +1 -1
  11. package/lib/cjs/PopupToolbar.d.ts +24 -24
  12. package/lib/cjs/PopupToolbar.js +57 -57
  13. package/lib/cjs/PopupToolbar.js.map +1 -1
  14. package/lib/cjs/SectionDrawingLocationState.d.ts +90 -90
  15. package/lib/cjs/SectionDrawingLocationState.d.ts.map +1 -1
  16. package/lib/cjs/SectionDrawingLocationState.js +107 -107
  17. package/lib/cjs/SectionDrawingLocationState.js.map +1 -1
  18. package/lib/cjs/SectionGraphicsProvider.d.ts +13 -13
  19. package/lib/cjs/SectionGraphicsProvider.js +272 -273
  20. package/lib/cjs/SectionGraphicsProvider.js.map +1 -1
  21. package/lib/cjs/SectionMarkerHandler.d.ts +52 -52
  22. package/lib/cjs/SectionMarkerHandler.js +111 -112
  23. package/lib/cjs/SectionMarkerHandler.js.map +1 -1
  24. package/lib/cjs/SectionMarkers.d.ts +82 -82
  25. package/lib/cjs/SectionMarkers.js +174 -174
  26. package/lib/cjs/Tools.d.ts +5 -5
  27. package/lib/cjs/Tools.js +170 -170
  28. package/lib/cjs/Tools.js.map +1 -1
  29. package/lib/cjs/hypermodeling-frontend.d.ts +13 -13
  30. package/lib/cjs/hypermodeling-frontend.js +33 -29
  31. package/lib/cjs/hypermodeling-frontend.js.map +1 -1
  32. package/lib/esm/HyperModeling.d.ts +114 -114
  33. package/lib/esm/HyperModeling.d.ts.map +1 -1
  34. package/lib/esm/HyperModeling.js +235 -235
  35. package/lib/esm/HyperModeling.js.map +1 -1
  36. package/lib/esm/HyperModelingConfig.d.ts +54 -54
  37. package/lib/esm/HyperModelingConfig.js +8 -8
  38. package/lib/esm/HyperModelingDecorator.d.ts +110 -110
  39. package/lib/esm/HyperModelingDecorator.js +331 -333
  40. package/lib/esm/HyperModelingDecorator.js.map +1 -1
  41. package/lib/esm/PopupToolbar.d.ts +24 -24
  42. package/lib/esm/PopupToolbar.js +54 -53
  43. package/lib/esm/PopupToolbar.js.map +1 -1
  44. package/lib/esm/SectionDrawingLocationState.d.ts +90 -90
  45. package/lib/esm/SectionDrawingLocationState.d.ts.map +1 -1
  46. package/lib/esm/SectionDrawingLocationState.js +103 -103
  47. package/lib/esm/SectionDrawingLocationState.js.map +1 -1
  48. package/lib/esm/SectionGraphicsProvider.d.ts +13 -13
  49. package/lib/esm/SectionGraphicsProvider.js +268 -269
  50. package/lib/esm/SectionGraphicsProvider.js.map +1 -1
  51. package/lib/esm/SectionMarkerHandler.d.ts +52 -52
  52. package/lib/esm/SectionMarkerHandler.js +107 -108
  53. package/lib/esm/SectionMarkerHandler.js.map +1 -1
  54. package/lib/esm/SectionMarkers.d.ts +82 -82
  55. package/lib/esm/SectionMarkers.js +168 -168
  56. package/lib/esm/Tools.d.ts +5 -5
  57. package/lib/esm/Tools.js +166 -166
  58. package/lib/esm/Tools.js.map +1 -1
  59. package/lib/esm/hypermodeling-frontend.d.ts +13 -13
  60. package/lib/esm/hypermodeling-frontend.js +17 -17
  61. package/package.json +16 -16
package/lib/esm/Tools.js CHANGED
@@ -1,167 +1,167 @@
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 { SectionType } from "@itwin/core-common";
9
- import { IModelApp, Tool } from "@itwin/core-frontend";
10
- import { HyperModeling } from "./HyperModeling";
11
- import { HyperModelingDecorator } from "./HyperModelingDecorator";
12
- /** Parses a string case-insensitively returning true for "ON", false for "OFF", undefined for "TOGGLE" or undefined, and the input string for anything else. */
13
- function parseToggle(arg) {
14
- if (undefined === arg)
15
- return undefined;
16
- switch (arg.toLowerCase()) {
17
- case "on": return true;
18
- case "off": return false;
19
- case "toggle": return undefined;
20
- default: return arg;
21
- }
22
- }
23
- class HyperModelingTool extends Tool {
24
- static get minArgs() { return 0; }
25
- static get maxArgs() { return 1; }
26
- async run(enable, vp) {
27
- vp = vp !== null && vp !== void 0 ? vp : IModelApp.viewManager.selectedView;
28
- if (vp)
29
- await HyperModeling.startOrStop(vp, enable);
30
- return true;
31
- }
32
- async parseAndRun(...args) {
33
- const enable = parseToggle(args[0]);
34
- return typeof enable !== "string" && this.run(enable);
35
- }
36
- }
37
- HyperModelingTool.toolId = "HyperModeling";
38
- /** Configures how section graphics are displayed. These are global settings. If no arguments are supplied, the defaults are restored.
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
- * - drawings: Whether to display the section drawing graphics. Default: 1.
41
- * - sheets: Whether to display the sheet annotation graphics. Default: 1.
42
- * - clip: Whether to apply clip volumes to the 2d graphics. Default: 1.
43
- * - boundaries: Whether to display clip volumes as boundary shapes for debugging purposes. Default: 0.
44
- */
45
- class SectionGraphicsConfigTool extends Tool {
46
- static get minArgs() { return 0; }
47
- static get maxArgs() { return 4; }
48
- async run(config) {
49
- if (!config) {
50
- config = {
51
- ignoreClip: false,
52
- debugClipVolumes: false,
53
- hideSectionGraphics: false,
54
- hideSheetAnnotations: false,
55
- };
56
- }
57
- HyperModeling.updateConfiguration({ graphics: config });
58
- return true;
59
- }
60
- async parseAndRun(...args) {
61
- if (0 === args.length)
62
- return this.run(); // restore defaults...
63
- const config = {};
64
- for (const arg of args) {
65
- const parts = arg.toLowerCase().split("=");
66
- if (2 !== parts.length)
67
- continue;
68
- const value = Number.parseInt(parts[1], 10);
69
- if (Number.isNaN(value) || (0 !== value && 1 !== value))
70
- continue;
71
- const enable = 1 === value;
72
- switch (parts[0][0]) {
73
- case "d":
74
- config.hideSectionGraphics = !enable;
75
- break;
76
- case "s":
77
- config.hideSheetAnnotations = !enable;
78
- break;
79
- case "c":
80
- config.ignoreClip = !enable;
81
- break;
82
- case "b":
83
- config.debugClipVolumes = enable;
84
- break;
85
- }
86
- }
87
- return this.run(config);
88
- }
89
- }
90
- SectionGraphicsConfigTool.toolId = "HyperModeling.Graphics.Config";
91
- class SectionMarkerConfigTool extends Tool {
92
- static get minArgs() { return 0; }
93
- static get maxArgs() { return 3; }
94
- async run(config) {
95
- config = config !== null && config !== void 0 ? config : { ignoreModelSelector: false, ignoreCategorySelector: false, hiddenSectionTypes: [] };
96
- this.update(config);
97
- return true;
98
- }
99
- async parseAndRun(...args) {
100
- if (0 === args.length)
101
- return this.run(); // restore defaults...
102
- const config = {};
103
- for (const arg of args) {
104
- const parts = arg.toLowerCase().split("=");
105
- if (2 !== parts.length)
106
- continue;
107
- const setting = parts[0][0];
108
- switch (setting) {
109
- case "h": {
110
- config.hiddenSectionTypes = [];
111
- for (const c of parts[1]) {
112
- switch (c) {
113
- case "s":
114
- config.hiddenSectionTypes.push(SectionType.Section);
115
- break;
116
- case "d":
117
- config.hiddenSectionTypes.push(SectionType.Detail);
118
- break;
119
- case "e":
120
- config.hiddenSectionTypes.push(SectionType.Elevation);
121
- break;
122
- case "p":
123
- config.hiddenSectionTypes.push(SectionType.Plan);
124
- break;
125
- }
126
- }
127
- break;
128
- }
129
- default: {
130
- const intVal = Number.parseInt(parts[1], 10);
131
- if (!Number.isNaN(intVal) && (0 === intVal || 1 === intVal)) {
132
- if ("c" === setting)
133
- config.ignoreCategorySelector = 0 === intVal;
134
- else if ("m" === setting)
135
- config.ignoreModelSelector = 0 === intVal;
136
- }
137
- break;
138
- }
139
- }
140
- }
141
- return this.run(config);
142
- }
143
- }
144
- class SectionMarkerDefaultConfigTool extends SectionMarkerConfigTool {
145
- update(config) {
146
- HyperModeling.updateConfiguration({ markers: config });
147
- }
148
- }
149
- SectionMarkerDefaultConfigTool.toolId = "HyperModeling.Marker.Default.Config";
150
- class SectionMarkerDecoratorConfigTool extends SectionMarkerConfigTool {
151
- update(config) {
152
- const vp = IModelApp.viewManager.selectedView;
153
- const decorator = vp ? HyperModelingDecorator.getForViewport(vp) : undefined;
154
- if (decorator)
155
- decorator.updateConfiguration(config);
156
- }
157
- }
158
- SectionMarkerDecoratorConfigTool.toolId = "HyperModeling.Marker.Config";
159
- /** @internal */
160
- export function registerTools(namespace) {
161
- const register = (tool) => IModelApp.tools.register(tool, namespace);
162
- register(HyperModelingTool);
163
- register(SectionGraphicsConfigTool);
164
- register(SectionMarkerDecoratorConfigTool);
165
- register(SectionMarkerDefaultConfigTool);
166
- }
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 { SectionType } from "@itwin/core-common";
9
+ import { IModelApp, Tool } from "@itwin/core-frontend";
10
+ import { HyperModeling } from "./HyperModeling";
11
+ import { HyperModelingDecorator } from "./HyperModelingDecorator";
12
+ /** Parses a string case-insensitively returning true for "ON", false for "OFF", undefined for "TOGGLE" or undefined, and the input string for anything else. */
13
+ function parseToggle(arg) {
14
+ if (undefined === arg)
15
+ return undefined;
16
+ switch (arg.toLowerCase()) {
17
+ case "on": return true;
18
+ case "off": return false;
19
+ case "toggle": return undefined;
20
+ default: return arg;
21
+ }
22
+ }
23
+ class HyperModelingTool extends Tool {
24
+ static get minArgs() { return 0; }
25
+ static get maxArgs() { return 1; }
26
+ async run(enable, vp) {
27
+ vp = vp ?? IModelApp.viewManager.selectedView;
28
+ if (vp)
29
+ await HyperModeling.startOrStop(vp, enable);
30
+ return true;
31
+ }
32
+ async parseAndRun(...args) {
33
+ const enable = parseToggle(args[0]);
34
+ return typeof enable !== "string" && this.run(enable);
35
+ }
36
+ }
37
+ HyperModelingTool.toolId = "HyperModeling";
38
+ /** Configures how section graphics are displayed. These are global settings. If no arguments are supplied, the defaults are restored.
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
+ * - drawings: Whether to display the section drawing graphics. Default: 1.
41
+ * - sheets: Whether to display the sheet annotation graphics. Default: 1.
42
+ * - clip: Whether to apply clip volumes to the 2d graphics. Default: 1.
43
+ * - boundaries: Whether to display clip volumes as boundary shapes for debugging purposes. Default: 0.
44
+ */
45
+ class SectionGraphicsConfigTool extends Tool {
46
+ static get minArgs() { return 0; }
47
+ static get maxArgs() { return 4; }
48
+ async run(config) {
49
+ if (!config) {
50
+ config = {
51
+ ignoreClip: false,
52
+ debugClipVolumes: false,
53
+ hideSectionGraphics: false,
54
+ hideSheetAnnotations: false,
55
+ };
56
+ }
57
+ HyperModeling.updateConfiguration({ graphics: config });
58
+ return true;
59
+ }
60
+ async parseAndRun(...args) {
61
+ if (0 === args.length)
62
+ return this.run(); // restore defaults...
63
+ const config = {};
64
+ for (const arg of args) {
65
+ const parts = arg.toLowerCase().split("=");
66
+ if (2 !== parts.length)
67
+ continue;
68
+ const value = Number.parseInt(parts[1], 10);
69
+ if (Number.isNaN(value) || (0 !== value && 1 !== value))
70
+ continue;
71
+ const enable = 1 === value;
72
+ switch (parts[0][0]) {
73
+ case "d":
74
+ config.hideSectionGraphics = !enable;
75
+ break;
76
+ case "s":
77
+ config.hideSheetAnnotations = !enable;
78
+ break;
79
+ case "c":
80
+ config.ignoreClip = !enable;
81
+ break;
82
+ case "b":
83
+ config.debugClipVolumes = enable;
84
+ break;
85
+ }
86
+ }
87
+ return this.run(config);
88
+ }
89
+ }
90
+ SectionGraphicsConfigTool.toolId = "HyperModeling.Graphics.Config";
91
+ class SectionMarkerConfigTool extends Tool {
92
+ static get minArgs() { return 0; }
93
+ static get maxArgs() { return 3; }
94
+ async run(config) {
95
+ config = config ?? { ignoreModelSelector: false, ignoreCategorySelector: false, hiddenSectionTypes: [] };
96
+ this.update(config);
97
+ return true;
98
+ }
99
+ async parseAndRun(...args) {
100
+ if (0 === args.length)
101
+ return this.run(); // restore defaults...
102
+ const config = {};
103
+ for (const arg of args) {
104
+ const parts = arg.toLowerCase().split("=");
105
+ if (2 !== parts.length)
106
+ continue;
107
+ const setting = parts[0][0];
108
+ switch (setting) {
109
+ case "h": {
110
+ config.hiddenSectionTypes = [];
111
+ for (const c of parts[1]) {
112
+ switch (c) {
113
+ case "s":
114
+ config.hiddenSectionTypes.push(SectionType.Section);
115
+ break;
116
+ case "d":
117
+ config.hiddenSectionTypes.push(SectionType.Detail);
118
+ break;
119
+ case "e":
120
+ config.hiddenSectionTypes.push(SectionType.Elevation);
121
+ break;
122
+ case "p":
123
+ config.hiddenSectionTypes.push(SectionType.Plan);
124
+ break;
125
+ }
126
+ }
127
+ break;
128
+ }
129
+ default: {
130
+ const intVal = Number.parseInt(parts[1], 10);
131
+ if (!Number.isNaN(intVal) && (0 === intVal || 1 === intVal)) {
132
+ if ("c" === setting)
133
+ config.ignoreCategorySelector = 0 === intVal;
134
+ else if ("m" === setting)
135
+ config.ignoreModelSelector = 0 === intVal;
136
+ }
137
+ break;
138
+ }
139
+ }
140
+ }
141
+ return this.run(config);
142
+ }
143
+ }
144
+ class SectionMarkerDefaultConfigTool extends SectionMarkerConfigTool {
145
+ update(config) {
146
+ HyperModeling.updateConfiguration({ markers: config });
147
+ }
148
+ }
149
+ SectionMarkerDefaultConfigTool.toolId = "HyperModeling.Marker.Default.Config";
150
+ class SectionMarkerDecoratorConfigTool extends SectionMarkerConfigTool {
151
+ update(config) {
152
+ const vp = IModelApp.viewManager.selectedView;
153
+ const decorator = vp ? HyperModelingDecorator.getForViewport(vp) : undefined;
154
+ if (decorator)
155
+ decorator.updateConfiguration(config);
156
+ }
157
+ }
158
+ SectionMarkerDecoratorConfigTool.toolId = "HyperModeling.Marker.Config";
159
+ /** @internal */
160
+ export function registerTools(namespace) {
161
+ const register = (tool) => IModelApp.tools.register(tool, namespace);
162
+ register(HyperModelingTool);
163
+ register(SectionGraphicsConfigTool);
164
+ register(SectionMarkerDecoratorConfigTool);
165
+ register(SectionMarkerDefaultConfigTool);
166
+ }
167
167
  //# sourceMappingURL=Tools.js.map
@@ -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;QACzB,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;KACrB;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,C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BAAyB,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;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;QACzB,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;KACrB;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,OAA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MAAM,CAAC;6BAC1C,IAAI,GAAG,KAAK,OAAO;4BACtB,MAAM,CAAC,mBAAmB,GAAG,CAAC,KAAK,MAAM,CAAC;qBAC7C;oBAED,MAAM;iBACP;aACF;SACF;QAED,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;CACF;AAED,MAAM,8BAA+B,SAAQ,uBAAuB;IAGxD,MAAM,CAAC,MAA2B;QAC1C,aAAa,CAAC,mBAAmB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IACzD,CAAC;;AAJsB,qCAAM,GAAG,qCAAqC,CAAC;AAOxE,MAAM,gCAAiC,SAAQ,uBAAuB;IAG1D,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;;AAPsB,uCAAM,GAAG,6BAA6B,CAAC;AAUhE,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"]}
@@ -1,14 +1,14 @@
1
- export * from "./HyperModeling";
2
- export * from "./HyperModelingConfig";
3
- export * from "./HyperModelingDecorator";
4
- export * from "./SectionMarkerHandler";
5
- export * from "./SectionDrawingLocationState";
6
- export * from "./SectionGraphicsProvider";
7
- export * from "./SectionMarkers";
8
- /** @docs-package-description
9
- * The hypermodeling package enables visualization of section drawings in a spatial context.
10
- */
11
- /** @docs-group-description HyperModeling
12
- * APIs for controlling visualization of section drawings in a spatial context.
13
- */
1
+ export * from "./HyperModeling";
2
+ export * from "./HyperModelingConfig";
3
+ export * from "./HyperModelingDecorator";
4
+ export * from "./SectionMarkerHandler";
5
+ export * from "./SectionDrawingLocationState";
6
+ export * from "./SectionGraphicsProvider";
7
+ export * from "./SectionMarkers";
8
+ /** @docs-package-description
9
+ * The hypermodeling package enables visualization of section drawings in a spatial context.
10
+ */
11
+ /** @docs-group-description HyperModeling
12
+ * APIs for controlling visualization of section drawings in a spatial context.
13
+ */
14
14
  //# sourceMappingURL=hypermodeling-frontend.d.ts.map
@@ -1,18 +1,18 @@
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
- export * from "./HyperModeling";
6
- export * from "./HyperModelingConfig";
7
- export * from "./HyperModelingDecorator";
8
- export * from "./SectionMarkerHandler";
9
- export * from "./SectionDrawingLocationState";
10
- export * from "./SectionGraphicsProvider";
11
- export * from "./SectionMarkers";
12
- /** @docs-package-description
13
- * The hypermodeling package enables visualization of section drawings in a spatial context.
14
- */
15
- /** @docs-group-description HyperModeling
16
- * APIs for controlling visualization of section drawings in a spatial context.
17
- */
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
+ export * from "./HyperModeling";
6
+ export * from "./HyperModelingConfig";
7
+ export * from "./HyperModelingDecorator";
8
+ export * from "./SectionMarkerHandler";
9
+ export * from "./SectionDrawingLocationState";
10
+ export * from "./SectionGraphicsProvider";
11
+ export * from "./SectionMarkers";
12
+ /** @docs-package-description
13
+ * The hypermodeling package enables visualization of section drawings in a spatial context.
14
+ */
15
+ /** @docs-group-description HyperModeling
16
+ * APIs for controlling visualization of section drawings in a spatial context.
17
+ */
18
18
  //# sourceMappingURL=hypermodeling-frontend.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/hypermodeling-frontend",
3
- "version": "4.0.0-dev.6",
3
+ "version": "4.0.0-dev.61",
4
4
  "description": "iTwin.js hypermodeling package",
5
5
  "main": "lib/cjs/hypermodeling-frontend.js",
6
6
  "module": "lib/esm/hypermodeling-frontend.js",
@@ -21,22 +21,22 @@
21
21
  "url": "http://www.bentley.com"
22
22
  },
23
23
  "peerDependencies": {
24
- "@itwin/core-bentley": "^4.0.0-dev.6",
25
- "@itwin/core-common": "^4.0.0-dev.6",
26
- "@itwin/core-frontend": "^4.0.0-dev.6",
27
- "@itwin/core-geometry": "^4.0.0-dev.6"
24
+ "@itwin/core-bentley": "^4.0.0-dev.61",
25
+ "@itwin/core-common": "^4.0.0-dev.61",
26
+ "@itwin/core-frontend": "^4.0.0-dev.61",
27
+ "@itwin/core-geometry": "^4.0.0-dev.61"
28
28
  },
29
29
  "devDependencies": {
30
- "@itwin/build-tools": "4.0.0-dev.6",
31
- "@itwin/core-bentley": "4.0.0-dev.6",
32
- "@itwin/core-common": "4.0.0-dev.6",
33
- "@itwin/core-frontend": "4.0.0-dev.6",
34
- "@itwin/core-geometry": "4.0.0-dev.6",
35
- "@itwin/certa": "4.0.0-dev.6",
36
- "@itwin/eslint-plugin": "4.0.0-dev.6",
30
+ "@itwin/build-tools": "4.0.0-dev.61",
31
+ "@itwin/core-bentley": "4.0.0-dev.61",
32
+ "@itwin/core-common": "4.0.0-dev.61",
33
+ "@itwin/core-frontend": "4.0.0-dev.61",
34
+ "@itwin/core-geometry": "4.0.0-dev.61",
35
+ "@itwin/certa": "4.0.0-dev.61",
36
+ "@itwin/eslint-plugin": "^4.0.0-dev.32",
37
37
  "@types/chai": "4.3.1",
38
38
  "@types/mocha": "^8.2.2",
39
- "@types/node": "18.11.5",
39
+ "@types/node": "^18.11.5",
40
40
  "babel-loader": "~8.2.5",
41
41
  "babel-plugin-istanbul": "~6.1.1",
42
42
  "chai": "^4.1.2",
@@ -47,11 +47,11 @@
47
47
  "nyc": "^15.1.0",
48
48
  "rimraf": "^3.0.2",
49
49
  "source-map-loader": "^4.0.0",
50
- "typescript": "~4.4.0",
51
- "webpack": "^5.64.4"
50
+ "typescript": "~5.0.2",
51
+ "webpack": "^5.76.0"
52
52
  },
53
53
  "dependencies": {
54
- "@itwin/appui-abstract": "4.0.0-dev.6"
54
+ "@itwin/appui-abstract": "4.0.0-dev.61"
55
55
  },
56
56
  "nyc": {
57
57
  "extends": "./node_modules/@itwin/build-tools/.nycrc"