@itwin/frontend-devtools 4.5.0-dev.8 → 4.6.0-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,59 @@
1
1
  # Change Log - @itwin/frontend-devtools
2
2
 
3
- This log was last generated on Wed, 03 Jan 2024 19:29:41 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 25 Mar 2024 16:58:09 GMT and should not be manually modified.
4
+
5
+ ## 4.4.7
6
+ Fri, 15 Mar 2024 19:15:14 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 4.4.6
11
+ Fri, 08 Mar 2024 15:57:12 GMT
12
+
13
+ _Version update only_
14
+
15
+ ## 4.4.5
16
+ Tue, 05 Mar 2024 20:37:18 GMT
17
+
18
+ _Version update only_
19
+
20
+ ## 4.4.4
21
+ Fri, 01 Mar 2024 18:21:01 GMT
22
+
23
+ _Version update only_
24
+
25
+ ## 4.4.3
26
+ Fri, 23 Feb 2024 21:26:07 GMT
27
+
28
+ _Version update only_
29
+
30
+ ## 4.4.2
31
+ Fri, 16 Feb 2024 14:22:01 GMT
32
+
33
+ _Version update only_
34
+
35
+ ## 4.4.1
36
+ Fri, 16 Feb 2024 14:17:48 GMT
37
+
38
+ _Version update only_
39
+
40
+ ## 4.4.0
41
+ Mon, 12 Feb 2024 18:15:58 GMT
42
+
43
+ ### Updates
44
+
45
+ - Added 'fdt clip intersection' keyin
46
+ - Fixed typo is information messages.
47
+
48
+ ## 4.3.5
49
+ Mon, 25 Mar 2024 16:54:37 GMT
50
+
51
+ _Version update only_
52
+
53
+ ## 4.3.4
54
+ Fri, 22 Mar 2024 13:30:31 GMT
55
+
56
+ _Version update only_
4
57
 
5
58
  ## 4.3.3
6
59
  Wed, 03 Jan 2024 19:28:38 GMT
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MIT License
2
2
 
3
- Copyright © 2017-2023 Bentley Systems, Incorporated. All rights reserved.
3
+ Copyright © 2017-2024 Bentley Systems, Incorporated. All rights reserved.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6
 
package/README.md CHANGED
@@ -287,7 +287,10 @@ These keysins control the planar masking of reality models.
287
287
  * `fdt clear emphasized` - Undo the effects of `fdt emphasize selection` or `fdt emphasize visible`.
288
288
  * `fdt isolate selection` - Causes all elements except those currently in the selection set to stop drawing.
289
289
  * `fdt clear isolate` - Reverse the effects of `fdt isolate selection`.
290
- * `fdt test clip style ON|OFF` - Toggles a ClipStyle for the active viewport with hard-coded symbology overrides.
290
+ * `fdt test clip style ON|OFF` - Toggles a ClipStyle for the active viewport with hard-coded symbology overrides
291
+ * if using ON, can also optionally specify a CutStyleProps to use instead of the hard-coded default
292
+ * for example, to produce cut plane geometry which is unlit solid orange you can specify the following command:
293
+ * `fdt test clip style ON {"viewflags":{"renderMode":6,"lighting":false},"appearance":{"rgb":{"r":255,"g":128,"b":0}}}`
291
294
  * `fdt tile bounds` - Sets the type of bounding volume decorations that will be displayed for each tile displayed in the view. Accepts at most one argument; if none is specified, it defaults to "volume", unless tile bounds are already displayed, in which it toggles them back off.
292
295
  * "none": Don't display bounding volumes.
293
296
  * "volume": Bounding box representing the full range of each tile.
@@ -101,6 +101,7 @@ export declare class TestClipStyleTool extends DisplayStyleTool {
101
101
  static get maxArgs(): number;
102
102
  static get minArgs(): number;
103
103
  private _useStyle;
104
+ private _style?;
104
105
  protected get require3d(): boolean;
105
106
  protected parse(args: string[]): Promise<boolean>;
106
107
  protected execute(vp: Viewport): Promise<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"ClipTools.d.ts","sourceRoot":"","sources":["../../../src/tools/ClipTools.ts"],"names":[],"mappings":"AAYA,OAAO,EAAa,IAAI,EAAE,Q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AG,OAAO,CAAC,OAAO,CAAC;CAOvE;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,gBAAgB;IACrD,OAAuB,MAAM,SAAmB;IAChD,WAA2B,OAAO,WAAgB;IAClD,WAA2B,OAAO,WAAgB;IAElD,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,MAAM,CAAC,CAAgB;IAE/B,cAAuB,SAAS,YAAmB;cAEnC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;cAOvC,OAAO,CAAC,EAAE,EAAE,QAAQ;CAkCrC"}
@@ -208,36 +208,41 @@ class TestClipStyleTool extends DisplayStyleTools_1.DisplayStyleTool {
208
208
  super(...arguments);
209
209
  this._useStyle = false;
210
210
  }
211
- static get maxArgs() { return 1; }
211
+ static get maxArgs() { return 2; }
212
212
  static get minArgs() { return 1; }
213
213
  get require3d() { return true; }
214
214
  async parse(args) {
215
215
  this._useStyle = (0, parseBoolean_1.parseBoolean)(args[0]) ?? false;
216
+ if (this._useStyle && args.length > 1)
217
+ this._style = JSON.parse(args[1]);
216
218
  return true;
217
219
  }
218
220
  async execute(vp) {
219
221
  const props = { produceCutGeometry: true };
220
222
  if (this._useStyle) {
221
- props.cutStyle = {
222
- viewflags: {
223
- renderMode: core_common_1.RenderMode.SmoothShade,
224
- visibleEdges: true,
225
- hiddenEdges: false,
226
- },
227
- appearance: {
228
- rgb: { r: 0xff, g: 0x7f, b: 0 },
229
- transparency: 0.5,
230
- nonLocatable: true,
231
- },
232
- hiddenLine: {
233
- visible: {
234
- ovrColor: true,
235
- color: core_common_1.ColorByName.blue,
236
- pattern: core_common_1.LinePixels.Solid,
237
- width: 3,
223
+ if (this._style)
224
+ props.cutStyle = this._style;
225
+ else
226
+ props.cutStyle = {
227
+ viewflags: {
228
+ renderMode: core_common_1.RenderMode.SmoothShade,
229
+ visibleEdges: true,
230
+ hiddenEdges: false,
231
+ },
232
+ appearance: {
233
+ rgb: { r: 0xff, g: 0x7f, b: 0 },
234
+ transparency: 0.5,
235
+ nonLocatable: true,
238
236
  },
239
- },
240
- };
237
+ hiddenLine: {
238
+ visible: {
239
+ ovrColor: true,
240
+ color: core_common_1.ColorByName.blue,
241
+ pattern: core_common_1.LinePixels.Solid,
242
+ width: 3,
243
+ },
244
+ },
245
+ };
241
246
  }
242
247
  vp.displayStyle.settings.clipStyle = core_common_1.ClipStyle.fromJSON(props);
243
248
  vp.invalidateRenderPlan();
@@ -1 +1 @@
1
- {"version":3,"file":"ClipTools.js","sourceRoot":"","sources":["../../../src/tools/ClipTools.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,oDAE4B;AAC5B,wDAAiE;AACjE,+CAA4C;AAC5C,iDAA8C;AAC9C,2DAAuD;AAEvD;;;;;;;;;;;;;;GAcG;AACH,MAAa,aAAc,SAAQ,oBAAI;IAE9B,MAAM,KAAc,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3C,MAAM,KAAc,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAE1C,gBAAgB;QACtB,MAAM,EAAE,GAAG,yBAAS,CAAC,WAAW,CAAC,YAAY,CAAC;QAC9C,IAAI,SAAS,KAAK,EAAE,EAAE;YACpB,MAAM,KAAK,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC;YAChE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,YAAY,GAAG,SAAS,CAAC;YACnD,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,GAAG,uBAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SAChE;IACH,CAAC;IAEO,YAAY,CAAC,MAAc,EAAE,KAAqC;QACxE,MAAM,EAAE,GAAG,yBAAS,CAAC,WAAW,CAAC,YAAY,CAAC;QAC9C,IAAI,EAAE,EAAE;YACN,MAAM,KAAK,GAAG,EAAE,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AC,CAAC;IAIlD,IAAuB,SAAS,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC;IAEzC,KAAK,CAAC,KAAK,CAAC,IAAc;QAClC,IAAI,CAAC,SAAS,GAAG,IAAA,2BAAY,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC;QAChD,OAAO,IAAI,CAAC;IACd,CAAC;IAES,KAAK,CAAC,OAAO,CAAC,EAAY;QAClC,MAAM,KAAK,GAAmB,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC;QAC3D,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,KAAK,CAAC,QAAQ,GAAG;gBACf,SAAS,EAAE;oBACT,UAAU,EAAE,wBAAU,CAAC,WAAW;oBAClC,YAAY,EAAE,IAAI;oBAClB,WAAW,EAAE,KAAK;iBACnB;gBACD,UAAU,EAAE;oBACV,GAAG,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE;oBAC/B,YAAY,EAAE,GAAG;oBACjB,YAAY,EAAE,IAAI;iBACnB;gBACD,UAAU,EAAE;oBACV,OAAO,EAAE;wBACP,QAAQ,EAAE,IAAI;wBACd,KAAK,EAAE,yBAAW,CAAC,IAAI;wBACvB,OAAO,EAAE,wBAAU,CAAC,KAAK;wBACzB,KAAK,EAAE,CAAC;qBACT;iBACF;aACF,CAAC;SACH;QAED,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,GAAG,uBAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC/D,EAAE,CAAC,oBAAoB,EAAE,CAAC;QAC1B,EAAE,CAAC,iCAAiC,EAAE,CAAC;QAEvC,OAAO,IAAI,CAAC;IACd,CAAC;;AA3CsB,wBAAM,GAAG,eAAe,AAAlB,CAAmB;AADrC,8CAAiB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Tools\n */\n\nimport {\n ClipIntersectionStyle, ClipStyle, ClipStyleProps, ColorByName, ColorDef, LinePixels, RenderMode, RgbColor,\n} from \"@itwin/core-common\";\nimport { IModelApp, Tool, Viewport } from \"@itwin/core-frontend\";\nimport { parseToggle } from \"./parseToggle\";\nimport { parseBoolean } from \"./parseBoolean\";\nimport { DisplayStyleTool } from \"./DisplayStyleTools\";\n\n/** This tool specifies or un-specifies a clip color to use for pixels inside or outside the clip region.\n * Arguments can be:\n * - clear\n * - inside <color string> | clear\n * - outside <color string> | clear\n * <color string> must be in one of the following forms:\n * \"rgb(255,0,0)\"\n * \"rgba(255,0,0,255)\"\n * \"rgb(100%,0%,0%)\"\n * \"hsl(120,50%,50%)\"\n * \"#rrbbgg\"\n * \"blanchedAlmond\" (see possible values from [[ColorByName]]). Case insensitive.\n * @see [ColorDef]\n * @beta\n */\nexport class ClipColorTool extends Tool {\n public static override toolId = \"ClipColorTool\";\n public static override get minArgs() { return 1; }\n public static override get maxArgs() { return 2; }\n\n private _clearClipColors() {\n const vp = IModelApp.viewManager.selectedView;\n if (undefined !== vp) {\n const props = vp.displayStyle.settings.clipStyle.toJSON() ?? {};\n props.insideColor = props.outsideColor = undefined;\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n }\n }\n\n private setClipColor(colStr: string, which: \"insideColor\" | \"outsideColor\") {\n const vp = IModelApp.viewManager.selectedView;\n if (vp) {\n const props = vp.displayStyle.settings.clipStyle.toJSON() ?? {};\n props[which] = colStr === \"clear\" ? undefined : RgbColor.fromColorDef(ColorDef.fromString(colStr));\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n }\n }\n\n /** This runs the tool using the given arguments, specifying or unspecifying a clip color to use for pixels inside or outside the clip region.\n * Arguments can be:\n * - clear\n * - inside <color string> | clear\n * - outside <color string> | clear\n * <color string> must be in one of the following forms:\n * \"rgb(255,0,0)\"\n * \"rgba(255,0,0,255)\"\n * \"rgb(100%,0%,0%)\"\n * \"hsl(120,50%,50%)\"\n * \"#rrbbgg\"\n * \"blanchedAlmond\" (see possible values from [[ColorByName]]). Case insensitive.\n * @beta\n */\n public override async parseAndRun(...args: string[]): Promise<boolean> {\n if (1 === args.length) {\n if (args[0] === \"clear\")\n this._clearClipColors();\n\n return true;\n }\n\n const which = args[0];\n if (which === \"inside\" || which === \"outside\")\n this.setClipColor(args[1], \"inside\" === which ? \"insideColor\" : \"outsideColor\");\n\n return true;\n }\n}\n\n/** This tool specifies or un-specifies a color and width to use for pixels within the specified width of a clip plane.\n * Arguments can be:\n * - off\n * - default\n * - color <color string>\n * - width <number>\n * <color string> must be in one of the following forms:\n * \"rgb(255,0,0)\"\n * \"rgba(255,0,0,255)\"\n * \"rgb(100%,0%,0%)\"\n * \"hsl(120,50%,50%)\"\n * \"#rrbbgg\"\n * \"blanchedAlmond\" (see possible values from [[ColorByName]]). Case insensitive.\n * @see [ColorDef]\n * @beta\n */\nexport class ClipIntersectionTool extends Tool {\n public static override toolId = \"ClipIntersectionTool\";\n public static override get minArgs() { return 0; }\n public static override get maxArgs() { return 4; }\n\n private _toggleIntersectionStyle(toggle: boolean) {\n const vp = IModelApp.viewManager.selectedView;\n if (undefined !== vp) {\n const props = vp.displayStyle.settings.clipStyle.toJSON() ?? {};\n props.colorizeIntersection = toggle;\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n }\n }\n\n private _defaultClipIntersection() {\n const vp = IModelApp.viewManager.selectedView;\n if (undefined !== vp) {\n const props = vp.displayStyle.settings.clipStyle.toJSON() ?? {};\n if (!props.intersectionStyle) {\n props.intersectionStyle = ClipIntersectionStyle.defaults;\n } else {\n props.intersectionStyle.color = RgbColor.fromColorDef(ColorDef.white);\n props.intersectionStyle.width = 1;\n }\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n }\n }\n\n private setClipIntersection(colStr: string, width: number) {\n const vp = IModelApp.viewManager.selectedView;\n if (vp) {\n const props = vp.displayStyle.settings.clipStyle.toJSON() ?? {};\n\n if (!props.intersectionStyle) {\n props.intersectionStyle = ClipIntersectionStyle.defaults;\n }\n if (colStr) {\n props.intersectionStyle.color = RgbColor.fromColorDef(ColorDef.fromString(colStr));\n }\n if (width) {\n props.intersectionStyle.width = width;\n }\n\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n }\n }\n\n /** This runs the tool using the given arguments, specifying or unspecifying a color and width to use for pixels within the specified width of a clip plane.\n * Arguments can be:\n * - off\n * - default\n * - color <color string>\n * - width <number>\n * <color string> must be in one of the following forms:\n * \"rgb(255,0,0)\"\n * \"rgba(255,0,0,255)\"\n * \"rgb(100%,0%,0%)\"\n * \"hsl(120,50%,50%)\"\n * \"#rrbbgg\"\n * \"blanchedAlmond\" (see possible values from [[ColorByName]]). Case insensitive.\n * @beta\n */\n public override async parseAndRun(...args: string[]): Promise<boolean> {\n if (args[0] === \"off\") {\n this._toggleIntersectionStyle(false);\n return true;\n }\n\n this._toggleIntersectionStyle(true);\n if (args[0] === \"default\") {\n this._defaultClipIntersection();\n return true;\n }\n\n args[0] === \"color\" ? this.setClipIntersection(args[1], +args[3]) : this.setClipIntersection(args[3], +args[1]);\n return true;\n }\n}\n\n/** Controls a view state's view details' flag for producing cut geometry for a clip style.\n * @beta\n */\nexport class ToggleSectionCutTool extends Tool {\n public static override toolId = \"ToggleSectionCut\";\n public static override get minArgs() { return 0; }\n public static override get maxArgs() { return 1; }\n\n /** This method runs the tool, controlling a view state's view details' flag for producing cut geometry for a clip style.\n * @param produceCutGeometry whether to produce cut geometry\n */\n public override async run(produceCutGeometry?: boolean): Promise<boolean> {\n const vp = IModelApp.viewManager.selectedView;\n if (vp) {\n const style = vp.view.displayStyle.settings.clipStyle;\n produceCutGeometry = produceCutGeometry ?? !style.produceCutGeometry;\n if (produceCutGeometry !== style.produceCutGeometry) {\n const json = {\n ...vp.view.displayStyle.settings.clipStyle.toJSON(),\n produceCutGeometry,\n };\n\n vp.view.displayStyle.settings.clipStyle = ClipStyle.fromJSON(json);\n vp.invalidateScene();\n }\n }\n\n return true;\n }\n\n /** Executes this tool's run method with args[0] containing `produceCutGeometry`.\n * @see [[run]]\n */\n public override async parseAndRun(...args: string[]): Promise<boolean> {\n const enable = parseToggle(args[0]);\n if (typeof enable !== \"string\")\n await this.run(enable);\n\n return true;\n }\n}\n\n/** Simple tool that toggles a hard-coded clip style overriding various aspects of the cut geometry appearance.\n * @beta\n */\nexport class TestClipStyleTool extends DisplayStyleTool {\n public static override toolId = \"TestClipStyle\";\n public static override get maxArgs() { return 1; }\n public static override get minArgs() { return 1; }\n\n private _useStyle = false;\n\n protected override get require3d() { return true; }\n\n protected async parse(args: string[]): Promise<boolean> {\n this._useStyle = parseBoolean(args[0]) ?? false;\n return true;\n }\n\n protected async execute(vp: Viewport) {\n const props: ClipStyleProps = { produceCutGeometry: true };\n if (this._useStyle) {\n props.cutStyle = {\n viewflags: {\n renderMode: RenderMode.SmoothShade,\n visibleEdges: true,\n hiddenEdges: false,\n },\n appearance: {\n rgb: { r: 0xff, g: 0x7f, b: 0 },\n transparency: 0.5,\n nonLocatable: true,\n },\n hiddenLine: {\n visible: {\n ovrColor: true,\n color: ColorByName.blue,\n pattern: LinePixels.Solid,\n width: 3,\n },\n },\n };\n }\n\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n vp.invalidateRenderPlan();\n vp.setFeatureOverrideProviderChanged();\n\n return true;\n }\n}\n"]}
1
+ {"version":3,"file":"ClipTools.js","sourceRoot":"","sources":["../../../src/tools/ClipTools.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,oDAE4B;AAC5B,wDAAiE;AACjE,+CAA4C;AAC5C,iDAA8C;AAC9C,2DAAuD;AAEvD;;;;;;;;;;;;;;GAcG;AACH,MAAa,aAAc,SAAQ,oBAAI;IAE9B,MAAM,KAAc,OAAO,KAAK,OAAO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AI,CAAC,MAAM,CAAC;;gBAE7B,KAAK,CAAC,QAAQ,GAAG;oBACf,SAAS,EAAE;wBACT,UAAU,EAAE,wBAAU,CAAC,WAAW;wBAClC,YAAY,EAAE,IAAI;wBAClB,WAAW,EAAE,KAAK;qBACnB;oBACD,UAAU,EAAE;wBACV,GAAG,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE;wBAC/B,YAAY,EAAE,GAAG;wBACjB,YAAY,EAAE,IAAI;qBACnB;oBACD,UAAU,EAAE;wBACV,OAAO,EAAE;4BACP,QAAQ,EAAE,IAAI;4BACd,KAAK,EAAE,yBAAW,CAAC,IAAI;4BACvB,OAAO,EAAE,wBAAU,CAAC,KAAK;4BACzB,KAAK,EAAE,CAAC;yBACT;qBACF;iBACF,CAAC;SACL;QAED,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,GAAG,uBAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC/D,EAAE,CAAC,oBAAoB,EAAE,CAAC;QAC1B,EAAE,CAAC,iCAAiC,EAAE,CAAC;QAEvC,OAAO,IAAI,CAAC;IACd,CAAC;;AAjDsB,wBAAM,GAAG,eAAe,AAAlB,CAAmB;AADrC,8CAAiB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Tools\n */\n\nimport {\n ClipIntersectionStyle, ClipStyle, ClipStyleProps, ColorByName, ColorDef, CutStyleProps, LinePixels, RenderMode, RgbColor,\n} from \"@itwin/core-common\";\nimport { IModelApp, Tool, Viewport } from \"@itwin/core-frontend\";\nimport { parseToggle } from \"./parseToggle\";\nimport { parseBoolean } from \"./parseBoolean\";\nimport { DisplayStyleTool } from \"./DisplayStyleTools\";\n\n/** This tool specifies or un-specifies a clip color to use for pixels inside or outside the clip region.\n * Arguments can be:\n * - clear\n * - inside <color string> | clear\n * - outside <color string> | clear\n * <color string> must be in one of the following forms:\n * \"rgb(255,0,0)\"\n * \"rgba(255,0,0,255)\"\n * \"rgb(100%,0%,0%)\"\n * \"hsl(120,50%,50%)\"\n * \"#rrbbgg\"\n * \"blanchedAlmond\" (see possible values from [[ColorByName]]). Case insensitive.\n * @see [ColorDef]\n * @beta\n */\nexport class ClipColorTool extends Tool {\n public static override toolId = \"ClipColorTool\";\n public static override get minArgs() { return 1; }\n public static override get maxArgs() { return 2; }\n\n private _clearClipColors() {\n const vp = IModelApp.viewManager.selectedView;\n if (undefined !== vp) {\n const props = vp.displayStyle.settings.clipStyle.toJSON() ?? {};\n props.insideColor = props.outsideColor = undefined;\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n }\n }\n\n private setClipColor(colStr: string, which: \"insideColor\" | \"outsideColor\") {\n const vp = IModelApp.viewManager.selectedView;\n if (vp) {\n const props = vp.displayStyle.settings.clipStyle.toJSON() ?? {};\n props[which] = colStr === \"clear\" ? undefined : RgbColor.fromColorDef(ColorDef.fromString(colStr));\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n }\n }\n\n /** This runs the tool using the given arguments, specifying or unspecifying a clip color to use for pixels inside or outside the clip region.\n * Arguments can be:\n * - clear\n * - inside <color string> | clear\n * - outside <color string> | clear\n * <color string> must be in one of the following forms:\n * \"rgb(255,0,0)\"\n * \"rgba(255,0,0,255)\"\n * \"rgb(100%,0%,0%)\"\n * \"hsl(120,50%,50%)\"\n * \"#rrbbgg\"\n * \"blanchedAlmond\" (see possible values from [[ColorByName]]). Case insensitive.\n * @beta\n */\n public override async parseAndRun(...args: string[]): Promise<boolean> {\n if (1 === args.length) {\n if (args[0] === \"clear\")\n this._clearClipColors();\n\n return true;\n }\n\n const which = args[0];\n if (which === \"inside\" || which === \"outside\")\n this.setClipColor(args[1], \"inside\" === which ? \"insideColor\" : \"outsideColor\");\n\n return true;\n }\n}\n\n/** This tool specifies or un-specifies a color and width to use for pixels within the specified width of a clip plane.\n * Arguments can be:\n * - off\n * - default\n * - color <color string>\n * - width <number>\n * <color string> must be in one of the following forms:\n * \"rgb(255,0,0)\"\n * \"rgba(255,0,0,255)\"\n * \"rgb(100%,0%,0%)\"\n * \"hsl(120,50%,50%)\"\n * \"#rrbbgg\"\n * \"blanchedAlmond\" (see possible values from [[ColorByName]]). Case insensitive.\n * @see [ColorDef]\n * @beta\n */\nexport class ClipIntersectionTool extends Tool {\n public static override toolId = \"ClipIntersectionTool\";\n public static override get minArgs() { return 0; }\n public static override get maxArgs() { return 4; }\n\n private _toggleIntersectionStyle(toggle: boolean) {\n const vp = IModelApp.viewManager.selectedView;\n if (undefined !== vp) {\n const props = vp.displayStyle.settings.clipStyle.toJSON() ?? {};\n props.colorizeIntersection = toggle;\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n }\n }\n\n private _defaultClipIntersection() {\n const vp = IModelApp.viewManager.selectedView;\n if (undefined !== vp) {\n const props = vp.displayStyle.settings.clipStyle.toJSON() ?? {};\n if (!props.intersectionStyle) {\n props.intersectionStyle = ClipIntersectionStyle.defaults;\n } else {\n props.intersectionStyle.color = RgbColor.fromColorDef(ColorDef.white);\n props.intersectionStyle.width = 1;\n }\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n }\n }\n\n private setClipIntersection(colStr: string, width: number) {\n const vp = IModelApp.viewManager.selectedView;\n if (vp) {\n const props = vp.displayStyle.settings.clipStyle.toJSON() ?? {};\n\n if (!props.intersectionStyle) {\n props.intersectionStyle = ClipIntersectionStyle.defaults;\n }\n if (colStr) {\n props.intersectionStyle.color = RgbColor.fromColorDef(ColorDef.fromString(colStr));\n }\n if (width) {\n props.intersectionStyle.width = width;\n }\n\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n }\n }\n\n /** This runs the tool using the given arguments, specifying or unspecifying a color and width to use for pixels within the specified width of a clip plane.\n * Arguments can be:\n * - off\n * - default\n * - color <color string>\n * - width <number>\n * <color string> must be in one of the following forms:\n * \"rgb(255,0,0)\"\n * \"rgba(255,0,0,255)\"\n * \"rgb(100%,0%,0%)\"\n * \"hsl(120,50%,50%)\"\n * \"#rrbbgg\"\n * \"blanchedAlmond\" (see possible values from [[ColorByName]]). Case insensitive.\n * @beta\n */\n public override async parseAndRun(...args: string[]): Promise<boolean> {\n if (args[0] === \"off\") {\n this._toggleIntersectionStyle(false);\n return true;\n }\n\n this._toggleIntersectionStyle(true);\n if (args[0] === \"default\") {\n this._defaultClipIntersection();\n return true;\n }\n\n args[0] === \"color\" ? this.setClipIntersection(args[1], +args[3]) : this.setClipIntersection(args[3], +args[1]);\n return true;\n }\n}\n\n/** Controls a view state's view details' flag for producing cut geometry for a clip style.\n * @beta\n */\nexport class ToggleSectionCutTool extends Tool {\n public static override toolId = \"ToggleSectionCut\";\n public static override get minArgs() { return 0; }\n public static override get maxArgs() { return 1; }\n\n /** This method runs the tool, controlling a view state's view details' flag for producing cut geometry for a clip style.\n * @param produceCutGeometry whether to produce cut geometry\n */\n public override async run(produceCutGeometry?: boolean): Promise<boolean> {\n const vp = IModelApp.viewManager.selectedView;\n if (vp) {\n const style = vp.view.displayStyle.settings.clipStyle;\n produceCutGeometry = produceCutGeometry ?? !style.produceCutGeometry;\n if (produceCutGeometry !== style.produceCutGeometry) {\n const json = {\n ...vp.view.displayStyle.settings.clipStyle.toJSON(),\n produceCutGeometry,\n };\n\n vp.view.displayStyle.settings.clipStyle = ClipStyle.fromJSON(json);\n vp.invalidateScene();\n }\n }\n\n return true;\n }\n\n /** Executes this tool's run method with args[0] containing `produceCutGeometry`.\n * @see [[run]]\n */\n public override async parseAndRun(...args: string[]): Promise<boolean> {\n const enable = parseToggle(args[0]);\n if (typeof enable !== \"string\")\n await this.run(enable);\n\n return true;\n }\n}\n\n/** Simple tool that toggles a hard-coded clip style overriding various aspects of the cut geometry appearance.\n * @beta\n */\nexport class TestClipStyleTool extends DisplayStyleTool {\n public static override toolId = \"TestClipStyle\";\n public static override get maxArgs() { return 2; }\n public static override get minArgs() { return 1; }\n\n private _useStyle = false;\n private _style?: CutStyleProps;\n\n protected override get require3d() { return true; }\n\n protected async parse(args: string[]): Promise<boolean> {\n this._useStyle = parseBoolean(args[0]) ?? false;\n if (this._useStyle && args.length > 1)\n this._style = JSON.parse(args[1]);\n return true;\n }\n\n protected async execute(vp: Viewport) {\n const props: ClipStyleProps = { produceCutGeometry: true };\n if (this._useStyle) {\n if (this._style)\n props.cutStyle = this._style;\n else\n props.cutStyle = {\n viewflags: {\n renderMode: RenderMode.SmoothShade,\n visibleEdges: true,\n hiddenEdges: false,\n },\n appearance: {\n rgb: { r: 0xff, g: 0x7f, b: 0 },\n transparency: 0.5,\n nonLocatable: true,\n },\n hiddenLine: {\n visible: {\n ovrColor: true,\n color: ColorByName.blue,\n pattern: LinePixels.Solid,\n width: 3,\n },\n },\n };\n }\n\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n vp.invalidateRenderPlan();\n vp.setFeatureOverrideProviderChanged();\n\n return true;\n }\n}\n"]}
@@ -101,6 +101,7 @@ export declare class TestClipStyleTool extends DisplayStyleTool {
101
101
  static get maxArgs(): number;
102
102
  static get minArgs(): number;
103
103
  private _useStyle;
104
+ private _style?;
104
105
  protected get require3d(): boolean;
105
106
  protected parse(args: string[]): Promise<boolean>;
106
107
  protected execute(vp: Viewport): Promise<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"ClipTools.d.ts","sourceRoot":"","sources":["../../../src/tools/ClipTools.ts"],"names":[],"mappings":"AAYA,OAAO,EAAa,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;;;;;;;;;;GAcG;AACH,qBAAa,aAAc,SAAQ,IAAI;IACrC,OAAuB,MAAM,SAAmB;IAChD,WAA2B,OAAO,WAAg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B,OAAO,CAAC,MAAM,CAAC,CAAgB;IAE/B,cAAuB,SAAS,YAAmB;cAEnC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;cAOvC,OAAO,CAAC,EAAE,EAAE,QAAQ;CAkCrC"}
@@ -205,36 +205,41 @@ class TestClipStyleTool extends DisplayStyleTool {
205
205
  super(...arguments);
206
206
  this._useStyle = false;
207
207
  }
208
- static get maxArgs() { return 1; }
208
+ static get maxArgs() { return 2; }
209
209
  static get minArgs() { return 1; }
210
210
  get require3d() { return true; }
211
211
  async parse(args) {
212
212
  this._useStyle = parseBoolean(args[0]) ?? false;
213
+ if (this._useStyle && args.length > 1)
214
+ this._style = JSON.parse(args[1]);
213
215
  return true;
214
216
  }
215
217
  async execute(vp) {
216
218
  const props = { produceCutGeometry: true };
217
219
  if (this._useStyle) {
218
- props.cutStyle = {
219
- viewflags: {
220
- renderMode: RenderMode.SmoothShade,
221
- visibleEdges: true,
222
- hiddenEdges: false,
223
- },
224
- appearance: {
225
- rgb: { r: 0xff, g: 0x7f, b: 0 },
226
- transparency: 0.5,
227
- nonLocatable: true,
228
- },
229
- hiddenLine: {
230
- visible: {
231
- ovrColor: true,
232
- color: ColorByName.blue,
233
- pattern: LinePixels.Solid,
234
- width: 3,
220
+ if (this._style)
221
+ props.cutStyle = this._style;
222
+ else
223
+ props.cutStyle = {
224
+ viewflags: {
225
+ renderMode: RenderMode.SmoothShade,
226
+ visibleEdges: true,
227
+ hiddenEdges: false,
228
+ },
229
+ appearance: {
230
+ rgb: { r: 0xff, g: 0x7f, b: 0 },
231
+ transparency: 0.5,
232
+ nonLocatable: true,
235
233
  },
236
- },
237
- };
234
+ hiddenLine: {
235
+ visible: {
236
+ ovrColor: true,
237
+ color: ColorByName.blue,
238
+ pattern: LinePixels.Solid,
239
+ width: 3,
240
+ },
241
+ },
242
+ };
238
243
  }
239
244
  vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);
240
245
  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AAI,CAAC,CAAC,CAAC;IAEzC,KAAK,CAAC,KAAK,CAAC,IAAc;QAClC,IAAI,CAAC,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC;QAChD,OAAO,IAAI,CAAC;IACd,CAAC;IAES,KAAK,CAAC,OAAO,CAAC,EAAY;QAClC,MAAM,KAAK,GAAmB,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC;QAC3D,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,KAAK,CAAC,QAAQ,GAAG;gBACf,SAAS,EAAE;oBACT,UAAU,EAAE,UAAU,CAAC,WAAW;oBAClC,YAAY,EAAE,IAAI;oBAClB,WAAW,EAAE,KAAK;iBACnB;gBACD,UAAU,EAAE;oBACV,GAAG,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE;oBAC/B,YAAY,EAAE,GAAG;oBACjB,YAAY,EAAE,IAAI;iBACnB;gBACD,UAAU,EAAE;oBACV,OAAO,EAAE;wBACP,QAAQ,EAAE,IAAI;wBACd,KAAK,EAAE,WAAW,CAAC,IAAI;wBACvB,OAAO,EAAE,UAAU,CAAC,KAAK;wBACzB,KAAK,EAAE,CAAC;qBACT;iBACF;aACF,CAAC;SACH;QAED,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC/D,EAAE,CAAC,oBAAoB,EAAE,CAAC;QAC1B,EAAE,CAAC,iCAAiC,EAAE,CAAC;QAEvC,OAAO,IAAI,CAAC;IACd,CAAC;;AA3CsB,wBAAM,GAAG,eAAe,AAAlB,CAAmB;SADrC,iBAAiB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Tools\n */\n\nimport {\n ClipIntersectionStyle, ClipStyle, ClipStyleProps, ColorByName, ColorDef, LinePixels, RenderMode, RgbColor,\n} from \"@itwin/core-common\";\nimport { IModelApp, Tool, Viewport } from \"@itwin/core-frontend\";\nimport { parseToggle } from \"./parseToggle\";\nimport { parseBoolean } from \"./parseBoolean\";\nimport { DisplayStyleTool } from \"./DisplayStyleTools\";\n\n/** This tool specifies or un-specifies a clip color to use for pixels inside or outside the clip region.\n * Arguments can be:\n * - clear\n * - inside <color string> | clear\n * - outside <color string> | clear\n * <color string> must be in one of the following forms:\n * \"rgb(255,0,0)\"\n * \"rgba(255,0,0,255)\"\n * \"rgb(100%,0%,0%)\"\n * \"hsl(120,50%,50%)\"\n * \"#rrbbgg\"\n * \"blanchedAlmond\" (see possible values from [[ColorByName]]). Case insensitive.\n * @see [ColorDef]\n * @beta\n */\nexport class ClipColorTool extends Tool {\n public static override toolId = \"ClipColorTool\";\n public static override get minArgs() { return 1; }\n public static override get maxArgs() { return 2; }\n\n private _clearClipColors() {\n const vp = IModelApp.viewManager.selectedView;\n if (undefined !== vp) {\n const props = vp.displayStyle.settings.clipStyle.toJSON() ?? {};\n props.insideColor = props.outsideColor = undefined;\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n }\n }\n\n private setClipColor(colStr: string, which: \"insideColor\" | \"outsideColor\") {\n const vp = IModelApp.viewManager.selectedView;\n if (vp) {\n const props = vp.displayStyle.settings.clipStyle.toJSON() ?? {};\n props[which] = colStr === \"clear\" ? undefined : RgbColor.fromColorDef(ColorDef.fromString(colStr));\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n }\n }\n\n /** This runs the tool using the given arguments, specifying or unspecifying a clip color to use for pixels inside or outside the clip region.\n * Arguments can be:\n * - clear\n * - inside <color string> | clear\n * - outside <color string> | clear\n * <color string> must be in one of the following forms:\n * \"rgb(255,0,0)\"\n * \"rgba(255,0,0,255)\"\n * \"rgb(100%,0%,0%)\"\n * \"hsl(120,50%,50%)\"\n * \"#rrbbgg\"\n * \"blanchedAlmond\" (see possible values from [[ColorByName]]). Case insensitive.\n * @beta\n */\n public override async parseAndRun(...args: string[]): Promise<boolean> {\n if (1 === args.length) {\n if (args[0] === \"clear\")\n this._clearClipColors();\n\n return true;\n }\n\n const which = args[0];\n if (which === \"inside\" || which === \"outside\")\n this.setClipColor(args[1], \"inside\" === which ? \"insideColor\" : \"outsideColor\");\n\n return true;\n }\n}\n\n/** This tool specifies or un-specifies a color and width to use for pixels within the specified width of a clip plane.\n * Arguments can be:\n * - off\n * - default\n * - color <color string>\n * - width <number>\n * <color string> must be in one of the following forms:\n * \"rgb(255,0,0)\"\n * \"rgba(255,0,0,255)\"\n * \"rgb(100%,0%,0%)\"\n * \"hsl(120,50%,50%)\"\n * \"#rrbbgg\"\n * \"blanchedAlmond\" (see possible values from [[ColorByName]]). Case insensitive.\n * @see [ColorDef]\n * @beta\n */\nexport class ClipIntersectionTool extends Tool {\n public static override toolId = \"ClipIntersectionTool\";\n public static override get minArgs() { return 0; }\n public static override get maxArgs() { return 4; }\n\n private _toggleIntersectionStyle(toggle: boolean) {\n const vp = IModelApp.viewManager.selectedView;\n if (undefined !== vp) {\n const props = vp.displayStyle.settings.clipStyle.toJSON() ?? {};\n props.colorizeIntersection = toggle;\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n }\n }\n\n private _defaultClipIntersection() {\n const vp = IModelApp.viewManager.selectedView;\n if (undefined !== vp) {\n const props = vp.displayStyle.settings.clipStyle.toJSON() ?? {};\n if (!props.intersectionStyle) {\n props.intersectionStyle = ClipIntersectionStyle.defaults;\n } else {\n props.intersectionStyle.color = RgbColor.fromColorDef(ColorDef.white);\n props.intersectionStyle.width = 1;\n }\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n }\n }\n\n private setClipIntersection(colStr: string, width: number) {\n const vp = IModelApp.viewManager.selectedView;\n if (vp) {\n const props = vp.displayStyle.settings.clipStyle.toJSON() ?? {};\n\n if (!props.intersectionStyle) {\n props.intersectionStyle = ClipIntersectionStyle.defaults;\n }\n if (colStr) {\n props.intersectionStyle.color = RgbColor.fromColorDef(ColorDef.fromString(colStr));\n }\n if (width) {\n props.intersectionStyle.width = width;\n }\n\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n }\n }\n\n /** This runs the tool using the given arguments, specifying or unspecifying a color and width to use for pixels within the specified width of a clip plane.\n * Arguments can be:\n * - off\n * - default\n * - color <color string>\n * - width <number>\n * <color string> must be in one of the following forms:\n * \"rgb(255,0,0)\"\n * \"rgba(255,0,0,255)\"\n * \"rgb(100%,0%,0%)\"\n * \"hsl(120,50%,50%)\"\n * \"#rrbbgg\"\n * \"blanchedAlmond\" (see possible values from [[ColorByName]]). Case insensitive.\n * @beta\n */\n public override async parseAndRun(...args: string[]): Promise<boolean> {\n if (args[0] === \"off\") {\n this._toggleIntersectionStyle(false);\n return true;\n }\n\n this._toggleIntersectionStyle(true);\n if (args[0] === \"default\") {\n this._defaultClipIntersection();\n return true;\n }\n\n args[0] === \"color\" ? this.setClipIntersection(args[1], +args[3]) : this.setClipIntersection(args[3], +args[1]);\n return true;\n }\n}\n\n/** Controls a view state's view details' flag for producing cut geometry for a clip style.\n * @beta\n */\nexport class ToggleSectionCutTool extends Tool {\n public static override toolId = \"ToggleSectionCut\";\n public static override get minArgs() { return 0; }\n public static override get maxArgs() { return 1; }\n\n /** This method runs the tool, controlling a view state's view details' flag for producing cut geometry for a clip style.\n * @param produceCutGeometry whether to produce cut geometry\n */\n public override async run(produceCutGeometry?: boolean): Promise<boolean> {\n const vp = IModelApp.viewManager.selectedView;\n if (vp) {\n const style = vp.view.displayStyle.settings.clipStyle;\n produceCutGeometry = produceCutGeometry ?? !style.produceCutGeometry;\n if (produceCutGeometry !== style.produceCutGeometry) {\n const json = {\n ...vp.view.displayStyle.settings.clipStyle.toJSON(),\n produceCutGeometry,\n };\n\n vp.view.displayStyle.settings.clipStyle = ClipStyle.fromJSON(json);\n vp.invalidateScene();\n }\n }\n\n return true;\n }\n\n /** Executes this tool's run method with args[0] containing `produceCutGeometry`.\n * @see [[run]]\n */\n public override async parseAndRun(...args: string[]): Promise<boolean> {\n const enable = parseToggle(args[0]);\n if (typeof enable !== \"string\")\n await this.run(enable);\n\n return true;\n }\n}\n\n/** Simple tool that toggles a hard-coded clip style overriding various aspects of the cut geometry appearance.\n * @beta\n */\nexport class TestClipStyleTool extends DisplayStyleTool {\n public static override toolId = \"TestClipStyle\";\n public static override get maxArgs() { return 1; }\n public static override get minArgs() { return 1; }\n\n private _useStyle = false;\n\n protected override get require3d() { return true; }\n\n protected async parse(args: string[]): Promise<boolean> {\n this._useStyle = parseBoolean(args[0]) ?? false;\n return true;\n }\n\n protected async execute(vp: Viewport) {\n const props: ClipStyleProps = { produceCutGeometry: true };\n if (this._useStyle) {\n props.cutStyle = {\n viewflags: {\n renderMode: RenderMode.SmoothShade,\n visibleEdges: true,\n hiddenEdges: false,\n },\n appearance: {\n rgb: { r: 0xff, g: 0x7f, b: 0 },\n transparency: 0.5,\n nonLocatable: true,\n },\n hiddenLine: {\n visible: {\n ovrColor: true,\n color: ColorByName.blue,\n pattern: LinePixels.Solid,\n width: 3,\n },\n },\n };\n }\n\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n vp.invalidateRenderPlan();\n vp.setFeatureOverrideProviderChanged();\n\n return true;\n }\n}\n"]}
1
+ {"version":3,"file":"ClipTools.js","sourceRoot":"","sources":["../../../src/tools/ClipTools.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EACL,qBAAqB,EAAE,SAAS,EAAkB,WAAW,EAAE,QAAQ,EAAiB,UAAU,EAAE,UAAU,EAAE,QAAQ,GACzH,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,IAAI,EAAY,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,e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,EAAY;QAClC,MAAM,KAAK,GAAmB,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC;QAC3D,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,IAAI,IAAI,CAAC,MAAM;gBACb,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC;;gBAE7B,KAAK,CAAC,QAAQ,GAAG;oBACf,SAAS,EAAE;wBACT,UAAU,EAAE,UAAU,CAAC,WAAW;wBAClC,YAAY,EAAE,IAAI;wBAClB,WAAW,EAAE,KAAK;qBACnB;oBACD,UAAU,EAAE;wBACV,GAAG,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE;wBAC/B,YAAY,EAAE,GAAG;wBACjB,YAAY,EAAE,IAAI;qBACnB;oBACD,UAAU,EAAE;wBACV,OAAO,EAAE;4BACP,QAAQ,EAAE,IAAI;4BACd,KAAK,EAAE,WAAW,CAAC,IAAI;4BACvB,OAAO,EAAE,UAAU,CAAC,KAAK;4BACzB,KAAK,EAAE,CAAC;yBACT;qBACF;iBACF,CAAC;SACL;QAED,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC/D,EAAE,CAAC,oBAAoB,EAAE,CAAC;QAC1B,EAAE,CAAC,iCAAiC,EAAE,CAAC;QAEvC,OAAO,IAAI,CAAC;IACd,CAAC;;AAjDsB,wBAAM,GAAG,eAAe,AAAlB,CAAmB;SADrC,iBAAiB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Tools\n */\n\nimport {\n ClipIntersectionStyle, ClipStyle, ClipStyleProps, ColorByName, ColorDef, CutStyleProps, LinePixels, RenderMode, RgbColor,\n} from \"@itwin/core-common\";\nimport { IModelApp, Tool, Viewport } from \"@itwin/core-frontend\";\nimport { parseToggle } from \"./parseToggle\";\nimport { parseBoolean } from \"./parseBoolean\";\nimport { DisplayStyleTool } from \"./DisplayStyleTools\";\n\n/** This tool specifies or un-specifies a clip color to use for pixels inside or outside the clip region.\n * Arguments can be:\n * - clear\n * - inside <color string> | clear\n * - outside <color string> | clear\n * <color string> must be in one of the following forms:\n * \"rgb(255,0,0)\"\n * \"rgba(255,0,0,255)\"\n * \"rgb(100%,0%,0%)\"\n * \"hsl(120,50%,50%)\"\n * \"#rrbbgg\"\n * \"blanchedAlmond\" (see possible values from [[ColorByName]]). Case insensitive.\n * @see [ColorDef]\n * @beta\n */\nexport class ClipColorTool extends Tool {\n public static override toolId = \"ClipColorTool\";\n public static override get minArgs() { return 1; }\n public static override get maxArgs() { return 2; }\n\n private _clearClipColors() {\n const vp = IModelApp.viewManager.selectedView;\n if (undefined !== vp) {\n const props = vp.displayStyle.settings.clipStyle.toJSON() ?? {};\n props.insideColor = props.outsideColor = undefined;\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n }\n }\n\n private setClipColor(colStr: string, which: \"insideColor\" | \"outsideColor\") {\n const vp = IModelApp.viewManager.selectedView;\n if (vp) {\n const props = vp.displayStyle.settings.clipStyle.toJSON() ?? {};\n props[which] = colStr === \"clear\" ? undefined : RgbColor.fromColorDef(ColorDef.fromString(colStr));\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n }\n }\n\n /** This runs the tool using the given arguments, specifying or unspecifying a clip color to use for pixels inside or outside the clip region.\n * Arguments can be:\n * - clear\n * - inside <color string> | clear\n * - outside <color string> | clear\n * <color string> must be in one of the following forms:\n * \"rgb(255,0,0)\"\n * \"rgba(255,0,0,255)\"\n * \"rgb(100%,0%,0%)\"\n * \"hsl(120,50%,50%)\"\n * \"#rrbbgg\"\n * \"blanchedAlmond\" (see possible values from [[ColorByName]]). Case insensitive.\n * @beta\n */\n public override async parseAndRun(...args: string[]): Promise<boolean> {\n if (1 === args.length) {\n if (args[0] === \"clear\")\n this._clearClipColors();\n\n return true;\n }\n\n const which = args[0];\n if (which === \"inside\" || which === \"outside\")\n this.setClipColor(args[1], \"inside\" === which ? \"insideColor\" : \"outsideColor\");\n\n return true;\n }\n}\n\n/** This tool specifies or un-specifies a color and width to use for pixels within the specified width of a clip plane.\n * Arguments can be:\n * - off\n * - default\n * - color <color string>\n * - width <number>\n * <color string> must be in one of the following forms:\n * \"rgb(255,0,0)\"\n * \"rgba(255,0,0,255)\"\n * \"rgb(100%,0%,0%)\"\n * \"hsl(120,50%,50%)\"\n * \"#rrbbgg\"\n * \"blanchedAlmond\" (see possible values from [[ColorByName]]). Case insensitive.\n * @see [ColorDef]\n * @beta\n */\nexport class ClipIntersectionTool extends Tool {\n public static override toolId = \"ClipIntersectionTool\";\n public static override get minArgs() { return 0; }\n public static override get maxArgs() { return 4; }\n\n private _toggleIntersectionStyle(toggle: boolean) {\n const vp = IModelApp.viewManager.selectedView;\n if (undefined !== vp) {\n const props = vp.displayStyle.settings.clipStyle.toJSON() ?? {};\n props.colorizeIntersection = toggle;\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n }\n }\n\n private _defaultClipIntersection() {\n const vp = IModelApp.viewManager.selectedView;\n if (undefined !== vp) {\n const props = vp.displayStyle.settings.clipStyle.toJSON() ?? {};\n if (!props.intersectionStyle) {\n props.intersectionStyle = ClipIntersectionStyle.defaults;\n } else {\n props.intersectionStyle.color = RgbColor.fromColorDef(ColorDef.white);\n props.intersectionStyle.width = 1;\n }\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n }\n }\n\n private setClipIntersection(colStr: string, width: number) {\n const vp = IModelApp.viewManager.selectedView;\n if (vp) {\n const props = vp.displayStyle.settings.clipStyle.toJSON() ?? {};\n\n if (!props.intersectionStyle) {\n props.intersectionStyle = ClipIntersectionStyle.defaults;\n }\n if (colStr) {\n props.intersectionStyle.color = RgbColor.fromColorDef(ColorDef.fromString(colStr));\n }\n if (width) {\n props.intersectionStyle.width = width;\n }\n\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n }\n }\n\n /** This runs the tool using the given arguments, specifying or unspecifying a color and width to use for pixels within the specified width of a clip plane.\n * Arguments can be:\n * - off\n * - default\n * - color <color string>\n * - width <number>\n * <color string> must be in one of the following forms:\n * \"rgb(255,0,0)\"\n * \"rgba(255,0,0,255)\"\n * \"rgb(100%,0%,0%)\"\n * \"hsl(120,50%,50%)\"\n * \"#rrbbgg\"\n * \"blanchedAlmond\" (see possible values from [[ColorByName]]). Case insensitive.\n * @beta\n */\n public override async parseAndRun(...args: string[]): Promise<boolean> {\n if (args[0] === \"off\") {\n this._toggleIntersectionStyle(false);\n return true;\n }\n\n this._toggleIntersectionStyle(true);\n if (args[0] === \"default\") {\n this._defaultClipIntersection();\n return true;\n }\n\n args[0] === \"color\" ? this.setClipIntersection(args[1], +args[3]) : this.setClipIntersection(args[3], +args[1]);\n return true;\n }\n}\n\n/** Controls a view state's view details' flag for producing cut geometry for a clip style.\n * @beta\n */\nexport class ToggleSectionCutTool extends Tool {\n public static override toolId = \"ToggleSectionCut\";\n public static override get minArgs() { return 0; }\n public static override get maxArgs() { return 1; }\n\n /** This method runs the tool, controlling a view state's view details' flag for producing cut geometry for a clip style.\n * @param produceCutGeometry whether to produce cut geometry\n */\n public override async run(produceCutGeometry?: boolean): Promise<boolean> {\n const vp = IModelApp.viewManager.selectedView;\n if (vp) {\n const style = vp.view.displayStyle.settings.clipStyle;\n produceCutGeometry = produceCutGeometry ?? !style.produceCutGeometry;\n if (produceCutGeometry !== style.produceCutGeometry) {\n const json = {\n ...vp.view.displayStyle.settings.clipStyle.toJSON(),\n produceCutGeometry,\n };\n\n vp.view.displayStyle.settings.clipStyle = ClipStyle.fromJSON(json);\n vp.invalidateScene();\n }\n }\n\n return true;\n }\n\n /** Executes this tool's run method with args[0] containing `produceCutGeometry`.\n * @see [[run]]\n */\n public override async parseAndRun(...args: string[]): Promise<boolean> {\n const enable = parseToggle(args[0]);\n if (typeof enable !== \"string\")\n await this.run(enable);\n\n return true;\n }\n}\n\n/** Simple tool that toggles a hard-coded clip style overriding various aspects of the cut geometry appearance.\n * @beta\n */\nexport class TestClipStyleTool extends DisplayStyleTool {\n public static override toolId = \"TestClipStyle\";\n public static override get maxArgs() { return 2; }\n public static override get minArgs() { return 1; }\n\n private _useStyle = false;\n private _style?: CutStyleProps;\n\n protected override get require3d() { return true; }\n\n protected async parse(args: string[]): Promise<boolean> {\n this._useStyle = parseBoolean(args[0]) ?? false;\n if (this._useStyle && args.length > 1)\n this._style = JSON.parse(args[1]);\n return true;\n }\n\n protected async execute(vp: Viewport) {\n const props: ClipStyleProps = { produceCutGeometry: true };\n if (this._useStyle) {\n if (this._style)\n props.cutStyle = this._style;\n else\n props.cutStyle = {\n viewflags: {\n renderMode: RenderMode.SmoothShade,\n visibleEdges: true,\n hiddenEdges: false,\n },\n appearance: {\n rgb: { r: 0xff, g: 0x7f, b: 0 },\n transparency: 0.5,\n nonLocatable: true,\n },\n hiddenLine: {\n visible: {\n ovrColor: true,\n color: ColorByName.blue,\n pattern: LinePixels.Solid,\n width: 3,\n },\n },\n };\n }\n\n vp.displayStyle.settings.clipStyle = ClipStyle.fromJSON(props);\n vp.invalidateRenderPlan();\n vp.setFeatureOverrideProviderChanged();\n\n return true;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/frontend-devtools",
3
- "version": "4.5.0-dev.8",
3
+ "version": "4.6.0-dev.0",
4
4
  "description": "Debug menu and supporting UI widgets",
5
5
  "main": "lib/cjs/frontend-devtools.js",
6
6
  "module": "lib/esm/frontend-devtools.js",
@@ -24,10 +24,10 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "file-saver": "^2.0.2",
27
- "@itwin/core-geometry": "4.5.0-dev.8",
28
- "@itwin/core-bentley": "4.5.0-dev.8",
29
- "@itwin/core-frontend": "4.5.0-dev.8",
30
- "@itwin/core-common": "4.5.0-dev.8"
27
+ "@itwin/core-bentley": "4.6.0-dev.0",
28
+ "@itwin/core-frontend": "4.6.0-dev.0",
29
+ "@itwin/core-common": "4.6.0-dev.0",
30
+ "@itwin/core-geometry": "4.6.0-dev.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@itwin/eslint-plugin": "4.0.0-dev.44",
@@ -36,7 +36,7 @@
36
36
  "eslint": "^8.44.0",
37
37
  "rimraf": "^3.0.2",
38
38
  "typescript": "~5.0.2",
39
- "@itwin/build-tools": "4.5.0-dev.8"
39
+ "@itwin/build-tools": "4.6.0-dev.0"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "npm run -s copy:public && npm run -s build:cjs && npm run -s build:esm",