@itwin/hypermodeling-frontend 4.0.0-dev.10 → 4.0.0-dev.101
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +53 -1
- package/lib/cjs/HyperModeling.d.ts +114 -114
- package/lib/cjs/HyperModeling.js +237 -239
- package/lib/cjs/HyperModeling.js.map +1 -1
- package/lib/cjs/HyperModelingConfig.d.ts +54 -54
- package/lib/cjs/HyperModelingConfig.js +9 -9
- package/lib/cjs/HyperModelingConfig.js.map +1 -1
- package/lib/cjs/HyperModelingDecorator.d.ts +110 -110
- package/lib/cjs/HyperModelingDecorator.js +335 -337
- package/lib/cjs/HyperModelingDecorator.js.map +1 -1
- package/lib/cjs/PopupToolbar.d.ts +24 -24
- package/lib/cjs/PopupToolbar.js +57 -57
- package/lib/cjs/PopupToolbar.js.map +1 -1
- package/lib/cjs/SectionDrawingLocationState.d.ts +90 -90
- package/lib/cjs/SectionDrawingLocationState.js +135 -136
- package/lib/cjs/SectionDrawingLocationState.js.map +1 -1
- package/lib/cjs/SectionGraphicsProvider.d.ts +13 -13
- package/lib/cjs/SectionGraphicsProvider.js +272 -273
- package/lib/cjs/SectionGraphicsProvider.js.map +1 -1
- package/lib/cjs/SectionMarkerHandler.d.ts +52 -52
- package/lib/cjs/SectionMarkerHandler.js +111 -112
- package/lib/cjs/SectionMarkerHandler.js.map +1 -1
- package/lib/cjs/SectionMarkers.d.ts +82 -82
- package/lib/cjs/SectionMarkers.js +174 -174
- package/lib/cjs/SectionMarkers.js.map +1 -1
- package/lib/cjs/Tools.d.ts +5 -5
- package/lib/cjs/Tools.js +170 -170
- package/lib/cjs/Tools.js.map +1 -1
- package/lib/cjs/hypermodeling-frontend.d.ts +13 -13
- package/lib/cjs/hypermodeling-frontend.js +33 -29
- package/lib/cjs/hypermodeling-frontend.js.map +1 -1
- package/lib/esm/HyperModeling.d.ts +114 -114
- package/lib/esm/HyperModeling.js +234 -235
- package/lib/esm/HyperModeling.js.map +1 -1
- package/lib/esm/HyperModelingConfig.d.ts +54 -54
- package/lib/esm/HyperModelingConfig.js +8 -8
- package/lib/esm/HyperModelingConfig.js.map +1 -1
- package/lib/esm/HyperModelingDecorator.d.ts +110 -110
- package/lib/esm/HyperModelingDecorator.js +331 -333
- package/lib/esm/HyperModelingDecorator.js.map +1 -1
- package/lib/esm/PopupToolbar.d.ts +24 -24
- package/lib/esm/PopupToolbar.js +54 -53
- package/lib/esm/PopupToolbar.js.map +1 -1
- package/lib/esm/SectionDrawingLocationState.d.ts +90 -90
- package/lib/esm/SectionDrawingLocationState.js +131 -132
- package/lib/esm/SectionDrawingLocationState.js.map +1 -1
- package/lib/esm/SectionGraphicsProvider.d.ts +13 -13
- package/lib/esm/SectionGraphicsProvider.js +268 -269
- package/lib/esm/SectionGraphicsProvider.js.map +1 -1
- package/lib/esm/SectionMarkerHandler.d.ts +52 -52
- package/lib/esm/SectionMarkerHandler.js +107 -108
- package/lib/esm/SectionMarkerHandler.js.map +1 -1
- package/lib/esm/SectionMarkers.d.ts +82 -82
- package/lib/esm/SectionMarkers.js +168 -168
- package/lib/esm/SectionMarkers.js.map +1 -1
- package/lib/esm/Tools.d.ts +5 -5
- package/lib/esm/Tools.js +166 -166
- package/lib/esm/Tools.js.map +1 -1
- package/lib/esm/hypermodeling-frontend.d.ts +13 -13
- package/lib/esm/hypermodeling-frontend.js +17 -17
- package/lib/esm/hypermodeling-frontend.js.map +1 -1
- package/lib/public/locales/en/HyperModeling.json +32 -32
- package/package.json +21 -22
package/lib/cjs/Tools.js
CHANGED
|
@@ -1,171 +1,171 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
/** @packageDocumentation
|
|
7
|
-
* @module HyperModeling
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.registerTools = void 0;
|
|
11
|
-
const core_common_1 = require("@itwin/core-common");
|
|
12
|
-
const core_frontend_1 = require("@itwin/core-frontend");
|
|
13
|
-
const HyperModeling_1 = require("./HyperModeling");
|
|
14
|
-
const HyperModelingDecorator_1 = require("./HyperModelingDecorator");
|
|
15
|
-
/** Parses a string case-insensitively returning true for "ON", false for "OFF", undefined for "TOGGLE" or undefined, and the input string for anything else. */
|
|
16
|
-
function parseToggle(arg) {
|
|
17
|
-
if (undefined === arg)
|
|
18
|
-
return undefined;
|
|
19
|
-
switch (arg.toLowerCase()) {
|
|
20
|
-
case "on": return true;
|
|
21
|
-
case "off": return false;
|
|
22
|
-
case "toggle": return undefined;
|
|
23
|
-
default: return arg;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
class HyperModelingTool extends core_frontend_1.Tool {
|
|
27
|
-
static get minArgs() { return 0; }
|
|
28
|
-
static get maxArgs() { return 1; }
|
|
29
|
-
async run(enable, vp) {
|
|
30
|
-
vp = vp
|
|
31
|
-
if (vp)
|
|
32
|
-
await HyperModeling_1.HyperModeling.startOrStop(vp, enable);
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
async parseAndRun(...args) {
|
|
36
|
-
const enable = parseToggle(args[0]);
|
|
37
|
-
return typeof enable !== "string" && this.run(enable);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
HyperModelingTool.toolId = "HyperModeling";
|
|
41
|
-
/** Configures how section graphics are displayed. These are global settings. If no arguments are supplied, the defaults are restored.
|
|
42
|
-
* Otherwise, each argument is of the form "name=value" where value is 0 (disable) or 1 (enable). Only the first letter of each argument matters.
|
|
43
|
-
* - drawings: Whether to display the section drawing graphics. Default: 1.
|
|
44
|
-
* - sheets: Whether to display the sheet annotation graphics. Default: 1.
|
|
45
|
-
* - clip: Whether to apply clip volumes to the 2d graphics. Default: 1.
|
|
46
|
-
* - boundaries: Whether to display clip volumes as boundary shapes for debugging purposes. Default: 0.
|
|
47
|
-
*/
|
|
48
|
-
class SectionGraphicsConfigTool extends core_frontend_1.Tool {
|
|
49
|
-
static get minArgs() { return 0; }
|
|
50
|
-
static get maxArgs() { return 4; }
|
|
51
|
-
async run(config) {
|
|
52
|
-
if (!config) {
|
|
53
|
-
config = {
|
|
54
|
-
ignoreClip: false,
|
|
55
|
-
debugClipVolumes: false,
|
|
56
|
-
hideSectionGraphics: false,
|
|
57
|
-
hideSheetAnnotations: false,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
HyperModeling_1.HyperModeling.updateConfiguration({ graphics: config });
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
63
|
-
async parseAndRun(...args) {
|
|
64
|
-
if (0 === args.length)
|
|
65
|
-
return this.run(); // restore defaults...
|
|
66
|
-
const config = {};
|
|
67
|
-
for (const arg of args) {
|
|
68
|
-
const parts = arg.toLowerCase().split("=");
|
|
69
|
-
if (2 !== parts.length)
|
|
70
|
-
continue;
|
|
71
|
-
const value = Number.parseInt(parts[1], 10);
|
|
72
|
-
if (Number.isNaN(value) || (0 !== value && 1 !== value))
|
|
73
|
-
continue;
|
|
74
|
-
const enable = 1 === value;
|
|
75
|
-
switch (parts[0][0]) {
|
|
76
|
-
case "d":
|
|
77
|
-
config.hideSectionGraphics = !enable;
|
|
78
|
-
break;
|
|
79
|
-
case "s":
|
|
80
|
-
config.hideSheetAnnotations = !enable;
|
|
81
|
-
break;
|
|
82
|
-
case "c":
|
|
83
|
-
config.ignoreClip = !enable;
|
|
84
|
-
break;
|
|
85
|
-
case "b":
|
|
86
|
-
config.debugClipVolumes = enable;
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return this.run(config);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
SectionGraphicsConfigTool.toolId = "HyperModeling.Graphics.Config";
|
|
94
|
-
class SectionMarkerConfigTool extends core_frontend_1.Tool {
|
|
95
|
-
static get minArgs() { return 0; }
|
|
96
|
-
static get maxArgs() { return 3; }
|
|
97
|
-
async run(config) {
|
|
98
|
-
config = config
|
|
99
|
-
this.update(config);
|
|
100
|
-
return true;
|
|
101
|
-
}
|
|
102
|
-
async parseAndRun(...args) {
|
|
103
|
-
if (0 === args.length)
|
|
104
|
-
return this.run(); // restore defaults...
|
|
105
|
-
const config = {};
|
|
106
|
-
for (const arg of args) {
|
|
107
|
-
const parts = arg.toLowerCase().split("=");
|
|
108
|
-
if (2 !== parts.length)
|
|
109
|
-
continue;
|
|
110
|
-
const setting = parts[0][0];
|
|
111
|
-
switch (setting) {
|
|
112
|
-
case "h": {
|
|
113
|
-
config.hiddenSectionTypes = [];
|
|
114
|
-
for (const c of parts[1]) {
|
|
115
|
-
switch (c) {
|
|
116
|
-
case "s":
|
|
117
|
-
config.hiddenSectionTypes.push(core_common_1.SectionType.Section);
|
|
118
|
-
break;
|
|
119
|
-
case "d":
|
|
120
|
-
config.hiddenSectionTypes.push(core_common_1.SectionType.Detail);
|
|
121
|
-
break;
|
|
122
|
-
case "e":
|
|
123
|
-
config.hiddenSectionTypes.push(core_common_1.SectionType.Elevation);
|
|
124
|
-
break;
|
|
125
|
-
case "p":
|
|
126
|
-
config.hiddenSectionTypes.push(core_common_1.SectionType.Plan);
|
|
127
|
-
break;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
break;
|
|
131
|
-
}
|
|
132
|
-
default: {
|
|
133
|
-
const intVal = Number.parseInt(parts[1], 10);
|
|
134
|
-
if (!Number.isNaN(intVal) && (0 === intVal || 1 === intVal)) {
|
|
135
|
-
if ("c" === setting)
|
|
136
|
-
config.ignoreCategorySelector = 0 === intVal;
|
|
137
|
-
else if ("m" === setting)
|
|
138
|
-
config.ignoreModelSelector = 0 === intVal;
|
|
139
|
-
}
|
|
140
|
-
break;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
return this.run(config);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
class SectionMarkerDefaultConfigTool extends SectionMarkerConfigTool {
|
|
148
|
-
update(config) {
|
|
149
|
-
HyperModeling_1.HyperModeling.updateConfiguration({ markers: config });
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
SectionMarkerDefaultConfigTool.toolId = "HyperModeling.Marker.Default.Config";
|
|
153
|
-
class SectionMarkerDecoratorConfigTool extends SectionMarkerConfigTool {
|
|
154
|
-
update(config) {
|
|
155
|
-
const vp = core_frontend_1.IModelApp.viewManager.selectedView;
|
|
156
|
-
const decorator = vp ? HyperModelingDecorator_1.HyperModelingDecorator.getForViewport(vp) : undefined;
|
|
157
|
-
if (decorator)
|
|
158
|
-
decorator.updateConfiguration(config);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
SectionMarkerDecoratorConfigTool.toolId = "HyperModeling.Marker.Config";
|
|
162
|
-
/** @internal */
|
|
163
|
-
function registerTools(namespace) {
|
|
164
|
-
const register = (tool) => core_frontend_1.IModelApp.tools.register(tool, namespace);
|
|
165
|
-
register(HyperModelingTool);
|
|
166
|
-
register(SectionGraphicsConfigTool);
|
|
167
|
-
register(SectionMarkerDecoratorConfigTool);
|
|
168
|
-
register(SectionMarkerDefaultConfigTool);
|
|
169
|
-
}
|
|
170
|
-
exports.registerTools = registerTools;
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module HyperModeling
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.registerTools = void 0;
|
|
11
|
+
const core_common_1 = require("@itwin/core-common");
|
|
12
|
+
const core_frontend_1 = require("@itwin/core-frontend");
|
|
13
|
+
const HyperModeling_1 = require("./HyperModeling");
|
|
14
|
+
const HyperModelingDecorator_1 = require("./HyperModelingDecorator");
|
|
15
|
+
/** Parses a string case-insensitively returning true for "ON", false for "OFF", undefined for "TOGGLE" or undefined, and the input string for anything else. */
|
|
16
|
+
function parseToggle(arg) {
|
|
17
|
+
if (undefined === arg)
|
|
18
|
+
return undefined;
|
|
19
|
+
switch (arg.toLowerCase()) {
|
|
20
|
+
case "on": return true;
|
|
21
|
+
case "off": return false;
|
|
22
|
+
case "toggle": return undefined;
|
|
23
|
+
default: return arg;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
class HyperModelingTool extends core_frontend_1.Tool {
|
|
27
|
+
static get minArgs() { return 0; }
|
|
28
|
+
static get maxArgs() { return 1; }
|
|
29
|
+
async run(enable, vp) {
|
|
30
|
+
vp = vp ?? core_frontend_1.IModelApp.viewManager.selectedView;
|
|
31
|
+
if (vp)
|
|
32
|
+
await HyperModeling_1.HyperModeling.startOrStop(vp, enable);
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
async parseAndRun(...args) {
|
|
36
|
+
const enable = parseToggle(args[0]);
|
|
37
|
+
return typeof enable !== "string" && this.run(enable);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
HyperModelingTool.toolId = "HyperModeling";
|
|
41
|
+
/** Configures how section graphics are displayed. These are global settings. If no arguments are supplied, the defaults are restored.
|
|
42
|
+
* Otherwise, each argument is of the form "name=value" where value is 0 (disable) or 1 (enable). Only the first letter of each argument matters.
|
|
43
|
+
* - drawings: Whether to display the section drawing graphics. Default: 1.
|
|
44
|
+
* - sheets: Whether to display the sheet annotation graphics. Default: 1.
|
|
45
|
+
* - clip: Whether to apply clip volumes to the 2d graphics. Default: 1.
|
|
46
|
+
* - boundaries: Whether to display clip volumes as boundary shapes for debugging purposes. Default: 0.
|
|
47
|
+
*/
|
|
48
|
+
class SectionGraphicsConfigTool extends core_frontend_1.Tool {
|
|
49
|
+
static get minArgs() { return 0; }
|
|
50
|
+
static get maxArgs() { return 4; }
|
|
51
|
+
async run(config) {
|
|
52
|
+
if (!config) {
|
|
53
|
+
config = {
|
|
54
|
+
ignoreClip: false,
|
|
55
|
+
debugClipVolumes: false,
|
|
56
|
+
hideSectionGraphics: false,
|
|
57
|
+
hideSheetAnnotations: false,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
HyperModeling_1.HyperModeling.updateConfiguration({ graphics: config });
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
async parseAndRun(...args) {
|
|
64
|
+
if (0 === args.length)
|
|
65
|
+
return this.run(); // restore defaults...
|
|
66
|
+
const config = {};
|
|
67
|
+
for (const arg of args) {
|
|
68
|
+
const parts = arg.toLowerCase().split("=");
|
|
69
|
+
if (2 !== parts.length)
|
|
70
|
+
continue;
|
|
71
|
+
const value = Number.parseInt(parts[1], 10);
|
|
72
|
+
if (Number.isNaN(value) || (0 !== value && 1 !== value))
|
|
73
|
+
continue;
|
|
74
|
+
const enable = 1 === value;
|
|
75
|
+
switch (parts[0][0]) {
|
|
76
|
+
case "d":
|
|
77
|
+
config.hideSectionGraphics = !enable;
|
|
78
|
+
break;
|
|
79
|
+
case "s":
|
|
80
|
+
config.hideSheetAnnotations = !enable;
|
|
81
|
+
break;
|
|
82
|
+
case "c":
|
|
83
|
+
config.ignoreClip = !enable;
|
|
84
|
+
break;
|
|
85
|
+
case "b":
|
|
86
|
+
config.debugClipVolumes = enable;
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return this.run(config);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
SectionGraphicsConfigTool.toolId = "HyperModeling.Graphics.Config";
|
|
94
|
+
class SectionMarkerConfigTool extends core_frontend_1.Tool {
|
|
95
|
+
static get minArgs() { return 0; }
|
|
96
|
+
static get maxArgs() { return 3; }
|
|
97
|
+
async run(config) {
|
|
98
|
+
config = config ?? { ignoreModelSelector: false, ignoreCategorySelector: false, hiddenSectionTypes: [] };
|
|
99
|
+
this.update(config);
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
async parseAndRun(...args) {
|
|
103
|
+
if (0 === args.length)
|
|
104
|
+
return this.run(); // restore defaults...
|
|
105
|
+
const config = {};
|
|
106
|
+
for (const arg of args) {
|
|
107
|
+
const parts = arg.toLowerCase().split("=");
|
|
108
|
+
if (2 !== parts.length)
|
|
109
|
+
continue;
|
|
110
|
+
const setting = parts[0][0];
|
|
111
|
+
switch (setting) {
|
|
112
|
+
case "h": {
|
|
113
|
+
config.hiddenSectionTypes = [];
|
|
114
|
+
for (const c of parts[1]) {
|
|
115
|
+
switch (c) {
|
|
116
|
+
case "s":
|
|
117
|
+
config.hiddenSectionTypes.push(core_common_1.SectionType.Section);
|
|
118
|
+
break;
|
|
119
|
+
case "d":
|
|
120
|
+
config.hiddenSectionTypes.push(core_common_1.SectionType.Detail);
|
|
121
|
+
break;
|
|
122
|
+
case "e":
|
|
123
|
+
config.hiddenSectionTypes.push(core_common_1.SectionType.Elevation);
|
|
124
|
+
break;
|
|
125
|
+
case "p":
|
|
126
|
+
config.hiddenSectionTypes.push(core_common_1.SectionType.Plan);
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
default: {
|
|
133
|
+
const intVal = Number.parseInt(parts[1], 10);
|
|
134
|
+
if (!Number.isNaN(intVal) && (0 === intVal || 1 === intVal)) {
|
|
135
|
+
if ("c" === setting)
|
|
136
|
+
config.ignoreCategorySelector = 0 === intVal;
|
|
137
|
+
else if ("m" === setting)
|
|
138
|
+
config.ignoreModelSelector = 0 === intVal;
|
|
139
|
+
}
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return this.run(config);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
class SectionMarkerDefaultConfigTool extends SectionMarkerConfigTool {
|
|
148
|
+
update(config) {
|
|
149
|
+
HyperModeling_1.HyperModeling.updateConfiguration({ markers: config });
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
SectionMarkerDefaultConfigTool.toolId = "HyperModeling.Marker.Default.Config";
|
|
153
|
+
class SectionMarkerDecoratorConfigTool extends SectionMarkerConfigTool {
|
|
154
|
+
update(config) {
|
|
155
|
+
const vp = core_frontend_1.IModelApp.viewManager.selectedView;
|
|
156
|
+
const decorator = vp ? HyperModelingDecorator_1.HyperModelingDecorator.getForViewport(vp) : undefined;
|
|
157
|
+
if (decorator)
|
|
158
|
+
decorator.updateConfiguration(config);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
SectionMarkerDecoratorConfigTool.toolId = "HyperModeling.Marker.Config";
|
|
162
|
+
/** @internal */
|
|
163
|
+
function registerTools(namespace) {
|
|
164
|
+
const register = (tool) => core_frontend_1.IModelApp.tools.register(tool, namespace);
|
|
165
|
+
register(HyperModelingTool);
|
|
166
|
+
register(SectionGraphicsConfigTool);
|
|
167
|
+
register(SectionMarkerDecoratorConfigTool);
|
|
168
|
+
register(SectionMarkerDefaultConfigTool);
|
|
169
|
+
}
|
|
170
|
+
exports.registerTools = registerTools;
|
|
171
171
|
//# sourceMappingURL=Tools.js.map
|
package/lib/cjs/Tools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tools.js","sourceRoot":"","sources":["../../src/Tools.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAAiD;AACjD,wDAAuE;AACvE,mDAAgD;AAEhD,qEAAkE;AAElE,gKAAgK;AAChK,SAAS,WAAW,CAAC,GAAuB;IAC1C,IAAI,SAAS,KAAK,GAAG;QACnB,OAAO,SAAS,CAAC;IAEnB,QAAQ,GAAG,CAAC,WAAW,EAAE,EAAE;QACzB,KAAK,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC;QACvB,KAAK,KAAK,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SAAS,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;;AAPsB,uCAAM,GAAG,6BAA6B,CAAC;AAUhE,gBAAgB;AAChB,SAAgB,aAAa,CAAC,SAAiB;IAC7C,MAAM,QAAQ,GAAG,CAAC,IAAiB,EAAE,EAAE,CAAC,yBAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAClF,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IAC5B,QAAQ,CAAC,yBAAyB,CAAC,CAAC;IACpC,QAAQ,CAAC,gCAAgC,CAAC,CAAC;IAC3C,QAAQ,CAAC,8BAA8B,CAAC,CAAC;AAC3C,CAAC;AAND,sCAMC","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,oDAAiD;AACjD,wDAAuE;AACvE,mDAAgD;AAEhD,qEAAkE;AAElE,gKAAgK;AAChK,SAAS,WAAW,CAAC,GAAuB;IAC1C,IAAI,SAAS,KAAK,GAAG;QACnB,OAAO,SAAS,CAAC;IAEnB,QAAQ,GAAG,CAAC,WAAW,EAAE,EAAE;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,oBAAI;IAE3B,MAAM,KAAc,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3C,MAAM,KAAc,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAElC,KAAK,CAAC,GAA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AC,gCAAgC,CAAC,CAAC;IAC3C,QAAQ,CAAC,8BAA8B,CAAC,CAAC;AAC3C,CAAC;AAND,sCAMC","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,30 +1,34 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
__exportStar(require("./
|
|
22
|
-
__exportStar(require("./
|
|
23
|
-
__exportStar(require("./
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/*---------------------------------------------------------------------------------------------
|
|
18
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
19
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
20
|
+
*--------------------------------------------------------------------------------------------*/
|
|
21
|
+
__exportStar(require("./HyperModeling"), exports);
|
|
22
|
+
__exportStar(require("./HyperModelingConfig"), exports);
|
|
23
|
+
__exportStar(require("./HyperModelingDecorator"), exports);
|
|
24
|
+
__exportStar(require("./SectionMarkerHandler"), exports);
|
|
25
|
+
__exportStar(require("./SectionDrawingLocationState"), exports);
|
|
26
|
+
__exportStar(require("./SectionGraphicsProvider"), exports);
|
|
27
|
+
__exportStar(require("./SectionMarkers"), exports);
|
|
28
|
+
/** @docs-package-description
|
|
29
|
+
* The hypermodeling package enables visualization of section drawings in a spatial context.
|
|
30
|
+
*/
|
|
31
|
+
/** @docs-group-description HyperModeling
|
|
32
|
+
* APIs for controlling visualization of section drawings in a spatial context.
|
|
33
|
+
*/
|
|
30
34
|
//# sourceMappingURL=hypermodeling-frontend.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hypermodeling-frontend.js","sourceRoot":"","sources":["../../src/hypermodeling-frontend.ts"],"names":[],"mappings":"
|
|
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":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nexport * from \"./HyperModeling\";\nexport * from \"./HyperModelingConfig\";\nexport * from \"./HyperModelingDecorator\";\nexport * from \"./SectionMarkerHandler\";\nexport * from \"./SectionDrawingLocationState\";\nexport * from \"./SectionGraphicsProvider\";\nexport * from \"./SectionMarkers\";\n\n/** @docs-package-description\n * The hypermodeling package enables visualization of section drawings in a spatial context.\n */\n\n/** @docs-group-description HyperModeling\n * APIs for controlling visualization of section drawings in a spatial context.\n */\n"]}
|