@itwin/frontend-devtools 5.0.0-dev.9 → 5.0.0-dev.90

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 (259) hide show
  1. package/CHANGELOG.md +51 -1
  2. package/lib/cjs/ClipboardUtilities.js.map +1 -1
  3. package/lib/cjs/FrontEndDevTools.js +1 -1
  4. package/lib/cjs/FrontEndDevTools.js.map +1 -1
  5. package/lib/cjs/effects/Convolution.js +23 -23
  6. package/lib/cjs/effects/Convolution.js.map +1 -1
  7. package/lib/cjs/effects/EffectTools.js +2 -2
  8. package/lib/cjs/effects/EffectTools.js.map +1 -1
  9. package/lib/cjs/effects/Explosion.js +37 -25
  10. package/lib/cjs/effects/Explosion.js.map +1 -1
  11. package/lib/cjs/effects/FlipImage.js +22 -22
  12. package/lib/cjs/effects/FlipImage.js.map +1 -1
  13. package/lib/cjs/effects/LensDistortion.js +25 -25
  14. package/lib/cjs/effects/LensDistortion.js.map +1 -1
  15. package/lib/cjs/effects/Random.js.map +1 -1
  16. package/lib/cjs/effects/Saturation.js +30 -30
  17. package/lib/cjs/effects/Saturation.js.map +1 -1
  18. package/lib/cjs/effects/Snow.d.ts +1 -1
  19. package/lib/cjs/effects/Snow.d.ts.map +1 -1
  20. package/lib/cjs/effects/Snow.js +19 -8
  21. package/lib/cjs/effects/Snow.js.map +1 -1
  22. package/lib/cjs/effects/Vignette.js +41 -41
  23. package/lib/cjs/effects/Vignette.js.map +1 -1
  24. package/lib/cjs/frontend-devtools.js.map +1 -1
  25. package/lib/cjs/tools/AnimationIntervalTool.js +1 -1
  26. package/lib/cjs/tools/AnimationIntervalTool.js.map +1 -1
  27. package/lib/cjs/tools/ChangeUnitsTool.js +1 -1
  28. package/lib/cjs/tools/ChangeUnitsTool.js.map +1 -1
  29. package/lib/cjs/tools/ClipTools.js +6 -8
  30. package/lib/cjs/tools/ClipTools.js.map +1 -1
  31. package/lib/cjs/tools/DisplayStyleTools.js +21 -25
  32. package/lib/cjs/tools/DisplayStyleTools.js.map +1 -1
  33. package/lib/cjs/tools/EmphasizeElementsTool.js +7 -13
  34. package/lib/cjs/tools/EmphasizeElementsTool.js.map +1 -1
  35. package/lib/cjs/tools/FrustumDecoration.js +28 -9
  36. package/lib/cjs/tools/FrustumDecoration.js.map +1 -1
  37. package/lib/cjs/tools/InspectElementTool.js +7 -6
  38. package/lib/cjs/tools/InspectElementTool.js.map +1 -1
  39. package/lib/cjs/tools/MapLayerTool.js +24 -20
  40. package/lib/cjs/tools/MapLayerTool.js.map +1 -1
  41. package/lib/cjs/tools/MeasureTileLoadTime.js +4 -1
  42. package/lib/cjs/tools/MeasureTileLoadTime.js.map +1 -1
  43. package/lib/cjs/tools/ModelAppearanceTools.js +9 -9
  44. package/lib/cjs/tools/ModelAppearanceTools.js.map +1 -1
  45. package/lib/cjs/tools/PlanProjectionTools.js +8 -15
  46. package/lib/cjs/tools/PlanProjectionTools.js.map +1 -1
  47. package/lib/cjs/tools/PlanarMaskTools.js +21 -26
  48. package/lib/cjs/tools/PlanarMaskTools.js.map +1 -1
  49. package/lib/cjs/tools/ProjectExtents.js +6 -3
  50. package/lib/cjs/tools/ProjectExtents.js.map +1 -1
  51. package/lib/cjs/tools/RealityModelTools.js +10 -10
  52. package/lib/cjs/tools/RealityModelTools.js.map +1 -1
  53. package/lib/cjs/tools/RealityTransitionTool.js +1 -1
  54. package/lib/cjs/tools/RealityTransitionTool.js.map +1 -1
  55. package/lib/cjs/tools/RenderSystemTools.js +4 -3
  56. package/lib/cjs/tools/RenderSystemTools.js.map +1 -1
  57. package/lib/cjs/tools/RenderTargetTools.d.ts +1 -1
  58. package/lib/cjs/tools/RenderTargetTools.d.ts.map +1 -1
  59. package/lib/cjs/tools/RenderTargetTools.js +15 -20
  60. package/lib/cjs/tools/RenderTargetTools.js.map +1 -1
  61. package/lib/cjs/tools/ReportWebGLCompatibilityTool.js +1 -1
  62. package/lib/cjs/tools/ReportWebGLCompatibilityTool.js.map +1 -1
  63. package/lib/cjs/tools/SavedViews.js +4 -7
  64. package/lib/cjs/tools/SavedViews.js.map +1 -1
  65. package/lib/cjs/tools/ScheduleScriptTools.d.ts.map +1 -1
  66. package/lib/cjs/tools/ScheduleScriptTools.js +11 -12
  67. package/lib/cjs/tools/ScheduleScriptTools.js.map +1 -1
  68. package/lib/cjs/tools/SelectionTools.js +4 -6
  69. package/lib/cjs/tools/SelectionTools.js.map +1 -1
  70. package/lib/cjs/tools/SetGpuMemoryLimitTool.js +1 -1
  71. package/lib/cjs/tools/SetGpuMemoryLimitTool.js.map +1 -1
  72. package/lib/cjs/tools/SourceAspectIdTools.js +2 -2
  73. package/lib/cjs/tools/SourceAspectIdTools.js.map +1 -1
  74. package/lib/cjs/tools/TileRequestDecoration.js +6 -3
  75. package/lib/cjs/tools/TileRequestDecoration.js.map +1 -1
  76. package/lib/cjs/tools/TileTreeBoundsDecoration.d.ts.map +1 -1
  77. package/lib/cjs/tools/TileTreeBoundsDecoration.js +8 -4
  78. package/lib/cjs/tools/TileTreeBoundsDecoration.js.map +1 -1
  79. package/lib/cjs/tools/ToolTipProvider.js +2 -1
  80. package/lib/cjs/tools/ToolTipProvider.js.map +1 -1
  81. package/lib/cjs/tools/ViewportTools.js +22 -19
  82. package/lib/cjs/tools/ViewportTools.js.map +1 -1
  83. package/lib/cjs/tools/parseArgs.js.map +1 -1
  84. package/lib/cjs/tools/parseBoolean.js.map +1 -1
  85. package/lib/cjs/tools/parseToggle.js.map +1 -1
  86. package/lib/cjs/ui/Button.js.map +1 -1
  87. package/lib/cjs/ui/CheckBox.js.map +1 -1
  88. package/lib/cjs/ui/ColorInput.js.map +1 -1
  89. package/lib/cjs/ui/ComboBox.js.map +1 -1
  90. package/lib/cjs/ui/DataList.js.map +1 -1
  91. package/lib/cjs/ui/NestedMenu.js.map +1 -1
  92. package/lib/cjs/ui/NumericInput.js.map +1 -1
  93. package/lib/cjs/ui/RadioBox.js.map +1 -1
  94. package/lib/cjs/ui/Slider.js.map +1 -1
  95. package/lib/cjs/ui/TextBox.js.map +1 -1
  96. package/lib/cjs/widgets/DiagnosticsPanel.d.ts +1 -1
  97. package/lib/cjs/widgets/DiagnosticsPanel.d.ts.map +1 -1
  98. package/lib/cjs/widgets/DiagnosticsPanel.js +11 -1
  99. package/lib/cjs/widgets/DiagnosticsPanel.js.map +1 -1
  100. package/lib/cjs/widgets/FpsTracker.d.ts +1 -1
  101. package/lib/cjs/widgets/FpsTracker.d.ts.map +1 -1
  102. package/lib/cjs/widgets/FpsTracker.js +5 -1
  103. package/lib/cjs/widgets/FpsTracker.js.map +1 -1
  104. package/lib/cjs/widgets/GpuProfiler.d.ts +1 -1
  105. package/lib/cjs/widgets/GpuProfiler.d.ts.map +1 -1
  106. package/lib/cjs/widgets/GpuProfiler.js +89 -82
  107. package/lib/cjs/widgets/GpuProfiler.js.map +1 -1
  108. package/lib/cjs/widgets/KeyinField.js +8 -1
  109. package/lib/cjs/widgets/KeyinField.js.map +1 -1
  110. package/lib/cjs/widgets/MemoryTracker.d.ts +1 -1
  111. package/lib/cjs/widgets/MemoryTracker.d.ts.map +1 -1
  112. package/lib/cjs/widgets/MemoryTracker.js +16 -4
  113. package/lib/cjs/widgets/MemoryTracker.js.map +1 -1
  114. package/lib/cjs/widgets/RenderCommandBreakdown.d.ts +1 -1
  115. package/lib/cjs/widgets/RenderCommandBreakdown.d.ts.map +1 -1
  116. package/lib/cjs/widgets/RenderCommandBreakdown.js +6 -2
  117. package/lib/cjs/widgets/RenderCommandBreakdown.js.map +1 -1
  118. package/lib/cjs/widgets/TileMemoryBreakdown.d.ts +1 -1
  119. package/lib/cjs/widgets/TileMemoryBreakdown.d.ts.map +1 -1
  120. package/lib/cjs/widgets/TileMemoryBreakdown.js +10 -8
  121. package/lib/cjs/widgets/TileMemoryBreakdown.js.map +1 -1
  122. package/lib/cjs/widgets/TileStatisticsTracker.d.ts +1 -1
  123. package/lib/cjs/widgets/TileStatisticsTracker.d.ts.map +1 -1
  124. package/lib/cjs/widgets/TileStatisticsTracker.js +5 -2
  125. package/lib/cjs/widgets/TileStatisticsTracker.js.map +1 -1
  126. package/lib/cjs/widgets/ToolSettingsTracker.d.ts +1 -1
  127. package/lib/cjs/widgets/ToolSettingsTracker.d.ts.map +1 -1
  128. package/lib/cjs/widgets/ToolSettingsTracker.js +2 -2
  129. package/lib/cjs/widgets/ToolSettingsTracker.js.map +1 -1
  130. package/lib/esm/ClipboardUtilities.js.map +1 -1
  131. package/lib/esm/FrontEndDevTools.js +1 -1
  132. package/lib/esm/FrontEndDevTools.js.map +1 -1
  133. package/lib/esm/effects/Convolution.js +23 -23
  134. package/lib/esm/effects/Convolution.js.map +1 -1
  135. package/lib/esm/effects/EffectTools.js +2 -2
  136. package/lib/esm/effects/EffectTools.js.map +1 -1
  137. package/lib/esm/effects/Explosion.js +37 -25
  138. package/lib/esm/effects/Explosion.js.map +1 -1
  139. package/lib/esm/effects/FlipImage.js +22 -22
  140. package/lib/esm/effects/FlipImage.js.map +1 -1
  141. package/lib/esm/effects/LensDistortion.js +25 -25
  142. package/lib/esm/effects/LensDistortion.js.map +1 -1
  143. package/lib/esm/effects/Random.js.map +1 -1
  144. package/lib/esm/effects/Saturation.js +30 -30
  145. package/lib/esm/effects/Saturation.js.map +1 -1
  146. package/lib/esm/effects/Snow.d.ts +1 -1
  147. package/lib/esm/effects/Snow.d.ts.map +1 -1
  148. package/lib/esm/effects/Snow.js +19 -8
  149. package/lib/esm/effects/Snow.js.map +1 -1
  150. package/lib/esm/effects/Vignette.js +41 -41
  151. package/lib/esm/effects/Vignette.js.map +1 -1
  152. package/lib/esm/frontend-devtools.js.map +1 -1
  153. package/lib/esm/tools/AnimationIntervalTool.js +1 -1
  154. package/lib/esm/tools/AnimationIntervalTool.js.map +1 -1
  155. package/lib/esm/tools/ChangeUnitsTool.js +1 -1
  156. package/lib/esm/tools/ChangeUnitsTool.js.map +1 -1
  157. package/lib/esm/tools/ClipTools.js +6 -8
  158. package/lib/esm/tools/ClipTools.js.map +1 -1
  159. package/lib/esm/tools/DisplayStyleTools.js +21 -25
  160. package/lib/esm/tools/DisplayStyleTools.js.map +1 -1
  161. package/lib/esm/tools/EmphasizeElementsTool.js +7 -13
  162. package/lib/esm/tools/EmphasizeElementsTool.js.map +1 -1
  163. package/lib/esm/tools/FrustumDecoration.js +28 -9
  164. package/lib/esm/tools/FrustumDecoration.js.map +1 -1
  165. package/lib/esm/tools/InspectElementTool.js +7 -6
  166. package/lib/esm/tools/InspectElementTool.js.map +1 -1
  167. package/lib/esm/tools/MapLayerTool.js +24 -20
  168. package/lib/esm/tools/MapLayerTool.js.map +1 -1
  169. package/lib/esm/tools/MeasureTileLoadTime.js +4 -1
  170. package/lib/esm/tools/MeasureTileLoadTime.js.map +1 -1
  171. package/lib/esm/tools/ModelAppearanceTools.js +9 -9
  172. package/lib/esm/tools/ModelAppearanceTools.js.map +1 -1
  173. package/lib/esm/tools/PlanProjectionTools.js +8 -15
  174. package/lib/esm/tools/PlanProjectionTools.js.map +1 -1
  175. package/lib/esm/tools/PlanarMaskTools.js +21 -26
  176. package/lib/esm/tools/PlanarMaskTools.js.map +1 -1
  177. package/lib/esm/tools/ProjectExtents.js +6 -3
  178. package/lib/esm/tools/ProjectExtents.js.map +1 -1
  179. package/lib/esm/tools/RealityModelTools.js +10 -10
  180. package/lib/esm/tools/RealityModelTools.js.map +1 -1
  181. package/lib/esm/tools/RealityTransitionTool.js +1 -1
  182. package/lib/esm/tools/RealityTransitionTool.js.map +1 -1
  183. package/lib/esm/tools/RenderSystemTools.js +4 -3
  184. package/lib/esm/tools/RenderSystemTools.js.map +1 -1
  185. package/lib/esm/tools/RenderTargetTools.d.ts +1 -1
  186. package/lib/esm/tools/RenderTargetTools.d.ts.map +1 -1
  187. package/lib/esm/tools/RenderTargetTools.js +15 -20
  188. package/lib/esm/tools/RenderTargetTools.js.map +1 -1
  189. package/lib/esm/tools/ReportWebGLCompatibilityTool.js +1 -1
  190. package/lib/esm/tools/ReportWebGLCompatibilityTool.js.map +1 -1
  191. package/lib/esm/tools/SavedViews.js +4 -7
  192. package/lib/esm/tools/SavedViews.js.map +1 -1
  193. package/lib/esm/tools/ScheduleScriptTools.d.ts.map +1 -1
  194. package/lib/esm/tools/ScheduleScriptTools.js +11 -12
  195. package/lib/esm/tools/ScheduleScriptTools.js.map +1 -1
  196. package/lib/esm/tools/SelectionTools.js +4 -6
  197. package/lib/esm/tools/SelectionTools.js.map +1 -1
  198. package/lib/esm/tools/SetGpuMemoryLimitTool.js +1 -1
  199. package/lib/esm/tools/SetGpuMemoryLimitTool.js.map +1 -1
  200. package/lib/esm/tools/SourceAspectIdTools.js +2 -2
  201. package/lib/esm/tools/SourceAspectIdTools.js.map +1 -1
  202. package/lib/esm/tools/TileRequestDecoration.js +6 -3
  203. package/lib/esm/tools/TileRequestDecoration.js.map +1 -1
  204. package/lib/esm/tools/TileTreeBoundsDecoration.d.ts.map +1 -1
  205. package/lib/esm/tools/TileTreeBoundsDecoration.js +8 -4
  206. package/lib/esm/tools/TileTreeBoundsDecoration.js.map +1 -1
  207. package/lib/esm/tools/ToolTipProvider.js +2 -1
  208. package/lib/esm/tools/ToolTipProvider.js.map +1 -1
  209. package/lib/esm/tools/ViewportTools.js +22 -19
  210. package/lib/esm/tools/ViewportTools.js.map +1 -1
  211. package/lib/esm/tools/parseArgs.js.map +1 -1
  212. package/lib/esm/tools/parseBoolean.js.map +1 -1
  213. package/lib/esm/tools/parseToggle.js.map +1 -1
  214. package/lib/esm/ui/Button.js.map +1 -1
  215. package/lib/esm/ui/CheckBox.js.map +1 -1
  216. package/lib/esm/ui/ColorInput.js.map +1 -1
  217. package/lib/esm/ui/ComboBox.js.map +1 -1
  218. package/lib/esm/ui/DataList.js.map +1 -1
  219. package/lib/esm/ui/NestedMenu.js.map +1 -1
  220. package/lib/esm/ui/NumericInput.js.map +1 -1
  221. package/lib/esm/ui/RadioBox.js.map +1 -1
  222. package/lib/esm/ui/Slider.js.map +1 -1
  223. package/lib/esm/ui/TextBox.js.map +1 -1
  224. package/lib/esm/widgets/DiagnosticsPanel.d.ts +1 -1
  225. package/lib/esm/widgets/DiagnosticsPanel.d.ts.map +1 -1
  226. package/lib/esm/widgets/DiagnosticsPanel.js +11 -1
  227. package/lib/esm/widgets/DiagnosticsPanel.js.map +1 -1
  228. package/lib/esm/widgets/FpsTracker.d.ts +1 -1
  229. package/lib/esm/widgets/FpsTracker.d.ts.map +1 -1
  230. package/lib/esm/widgets/FpsTracker.js +5 -1
  231. package/lib/esm/widgets/FpsTracker.js.map +1 -1
  232. package/lib/esm/widgets/GpuProfiler.d.ts +1 -1
  233. package/lib/esm/widgets/GpuProfiler.d.ts.map +1 -1
  234. package/lib/esm/widgets/GpuProfiler.js +89 -82
  235. package/lib/esm/widgets/GpuProfiler.js.map +1 -1
  236. package/lib/esm/widgets/KeyinField.js +8 -1
  237. package/lib/esm/widgets/KeyinField.js.map +1 -1
  238. package/lib/esm/widgets/MemoryTracker.d.ts +1 -1
  239. package/lib/esm/widgets/MemoryTracker.d.ts.map +1 -1
  240. package/lib/esm/widgets/MemoryTracker.js +16 -4
  241. package/lib/esm/widgets/MemoryTracker.js.map +1 -1
  242. package/lib/esm/widgets/RenderCommandBreakdown.d.ts +1 -1
  243. package/lib/esm/widgets/RenderCommandBreakdown.d.ts.map +1 -1
  244. package/lib/esm/widgets/RenderCommandBreakdown.js +6 -2
  245. package/lib/esm/widgets/RenderCommandBreakdown.js.map +1 -1
  246. package/lib/esm/widgets/TileMemoryBreakdown.d.ts +1 -1
  247. package/lib/esm/widgets/TileMemoryBreakdown.d.ts.map +1 -1
  248. package/lib/esm/widgets/TileMemoryBreakdown.js +10 -8
  249. package/lib/esm/widgets/TileMemoryBreakdown.js.map +1 -1
  250. package/lib/esm/widgets/TileStatisticsTracker.d.ts +1 -1
  251. package/lib/esm/widgets/TileStatisticsTracker.d.ts.map +1 -1
  252. package/lib/esm/widgets/TileStatisticsTracker.js +5 -2
  253. package/lib/esm/widgets/TileStatisticsTracker.js.map +1 -1
  254. package/lib/esm/widgets/ToolSettingsTracker.d.ts +1 -1
  255. package/lib/esm/widgets/ToolSettingsTracker.d.ts.map +1 -1
  256. package/lib/esm/widgets/ToolSettingsTracker.js +2 -2
  257. package/lib/esm/widgets/ToolSettingsTracker.js.map +1 -1
  258. package/lib/public/locales/en/FrontendDevTools.json +494 -494
  259. package/package.json +10 -10
@@ -17,6 +17,15 @@ import { parseToggle } from "./parseToggle";
17
17
  * - Allowing the user to take a snapshot of the current frustum, then navigate the view to inspect it within the same viewport.
18
18
  */
19
19
  class FrustumDecoration {
20
+ _options;
21
+ _worldFrustum;
22
+ _adjustedWorldFrustum;
23
+ _preloadFrustum;
24
+ _npcFrustum;
25
+ _worldToNpcMap;
26
+ _eyePoint;
27
+ _focalPlane;
28
+ _isCameraOn;
20
29
  constructor(vp, view, _options) {
21
30
  this._options = _options;
22
31
  this._worldFrustum = vp.getFrustum(CoordSystem.World, false);
@@ -125,15 +134,17 @@ class FrustumDecoration {
125
134
  * @beta
126
135
  */
127
136
  export class FrustumDecorator {
137
+ _decoration;
128
138
  constructor(vp, options) {
129
- /** This will allow the render system to cache and reuse the decorations created by this decorator's decorate() method. */
130
- this.useCachedDecorations = true;
131
139
  this._decoration = FrustumDecoration.create(vp, options);
132
140
  }
141
+ /** This will allow the render system to cache and reuse the decorations created by this decorator's decorate() method. */
142
+ useCachedDecorations = true;
133
143
  decorate(context) {
134
144
  if (undefined !== this._decoration)
135
145
  this._decoration.decorate(context);
136
146
  }
147
+ static _instance;
137
148
  /** Add the decoration to the specified viewport. */
138
149
  static enable(vp, options) {
139
150
  FrustumDecorator.disable();
@@ -154,6 +165,7 @@ export class FrustumDecorator {
154
165
  * @beta
155
166
  */
156
167
  export class ToggleFrustumSnapshotTool extends Tool {
168
+ static toolId = "ToggleFrustumSnapshot";
157
169
  static get minArgs() { return 0; }
158
170
  static get maxArgs() { return 2; }
159
171
  async run(enable, showPreloadFrustum, showBackgroundIntersections) {
@@ -188,16 +200,20 @@ export class ToggleFrustumSnapshotTool extends Tool {
188
200
  return true;
189
201
  }
190
202
  }
191
- ToggleFrustumSnapshotTool.toolId = "ToggleFrustumSnapshot";
192
203
  /**
193
204
  * Decorates the viewport with a graphical depiction of a Frustum from the currently selected viewport.
194
205
  * Only useful when more than one spatial viewport is open.
195
206
  */
196
207
  class SelectedViewFrustumDecoration {
208
+ _options;
209
+ static _decorator;
210
+ _targetVp;
211
+ _removeDecorationListener;
212
+ _removeViewChangedListener;
213
+ /** This will allow the render system to cache and reuse the decorations created by this decorator's decorate() method. */
214
+ useCachedDecorations = true;
197
215
  constructor(vp, _options) {
198
216
  this._options = _options;
199
- /** This will allow the render system to cache and reuse the decorations created by this decorator's decorate() method. */
200
- this.useCachedDecorations = true;
201
217
  this._targetVp = vp;
202
218
  this._removeDecorationListener = IModelApp.viewManager.addDecorator(this);
203
219
  this._removeViewChangedListener = vp.onViewChanged.addListener(this.onViewChanged, this); // eslint-disable-line @typescript-eslint/unbound-method
@@ -265,6 +281,7 @@ class SelectedViewFrustumDecoration {
265
281
  * @beta
266
282
  */
267
283
  export class ToggleSelectedViewFrustumTool extends Tool {
284
+ static toolId = "ToggleSelectedViewFrustum";
268
285
  static get minArgs() { return 0; }
269
286
  static get maxArgs() { return 1; }
270
287
  async run(enable) {
@@ -288,11 +305,13 @@ export class ToggleSelectedViewFrustumTool extends Tool {
288
305
  return true;
289
306
  }
290
307
  }
291
- ToggleSelectedViewFrustumTool.toolId = "ToggleSelectedViewFrustum";
292
308
  class ShadowFrustumDecoration {
309
+ static _instance;
310
+ _targetVp;
311
+ _cleanup;
312
+ /** This will allow the render system to cache and reuse the decorations created by this decorator's decorate() method. */
313
+ useCachedDecorations = true;
293
314
  constructor(vp) {
294
- /** This will allow the render system to cache and reuse the decorations created by this decorator's decorate() method. */
295
- this.useCachedDecorations = true;
296
315
  this._targetVp = vp;
297
316
  const removeDecorator = IModelApp.viewManager.addDecorator(this);
298
317
  const removeOnRender = vp.onRender.addListener((_) => this.onRender());
@@ -349,6 +368,7 @@ class ShadowFrustumDecoration {
349
368
  * @beta
350
369
  */
351
370
  export class ToggleShadowFrustumTool extends Tool {
371
+ static toolId = "ToggleShadowFrustum";
352
372
  static get minArgs() { return 0; }
353
373
  static get maxArgs() { return 1; }
354
374
  async run(enable) {
@@ -364,5 +384,4 @@ export class ToggleShadowFrustumTool extends Tool {
364
384
  return true;
365
385
  }
366
386
  }
367
- ToggleShadowFrustumTool.toolId = "ToggleShadowFrustum";
368
387
  //# sourceMappingURL=FrustumDecoration.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FrustumDecoration.js","sourceRoot":"","sources":["../../../src/tools/FrustumDecoration.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAS,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAW,UAAU,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,EACL,WAAW,EAA8C,WAAW,EAAE,SAAS,EAAE,IAAI,GACtF,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAO5C;;;;;;GAMG;AACH,MAAM,iBAAiB;IAUrB,YAAoB,EAAY,EAAE,IAAiB,EAAmB,QAAmC;QAAnC,aAAQ,GAAR,QAAQ,CAA2B;QACvG,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAC7D,IAAI,CAAC,qBAAqB,GAAG,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACpE,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC,YAAY,CAAC,iBAAiB,EAAE,CAAC;QAC3D,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,CAA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S,CAAC,WAAW,CAAC,YAAY,CAAC;QAC9C,IAAI,SAAS,KAAK,EAAE,IAAI,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;YAC7C,uBAAuB,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;QAE7C,OAAO,IAAI,CAAC;IACd,CAAC;IAEe,KAAK,CAAC,WAAW,CAAC,GAAG,IAAc;QACjD,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACpC,IAAI,OAAO,MAAM,KAAK,QAAQ;YAC5B,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAEzB,OAAO,IAAI,CAAC;IACd,CAAC;;AAlBsB,8BAAM,GAAG,qBAAqB,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\r\n/** @packageDocumentation\r\n * @module Tools\r\n */\r\n\r\nimport { Map4d, Point3d } from \"@itwin/core-geometry\";\r\nimport { ColorByName, ColorDef, Frustum, LinePixels, Npc } from \"@itwin/core-common\";\r\nimport {\r\n CoordSystem, DecorateContext, Decorator, GraphicBuilder, GraphicType, IModelApp, Tool, Viewport, ViewState, ViewState3d,\r\n} from \"@itwin/core-frontend\";\r\nimport { parseToggle } from \"./parseToggle\";\r\n\r\ninterface FrustumDecorationOptions {\r\n showPreloadFrustum?: boolean;\r\n showBackgroundIntersections?: boolean;\r\n}\r\n\r\n/**\r\n * Decorates the viewport with a graphical depiction of a Frustum.\r\n * This is obviously only useful when drawn inside a viewport using a *different* Frustum.\r\n * Options for doing so include:\r\n * - Having more than one viewport, and drawing the frustum of one viewport inside the other viewports; and\r\n * - Allowing the user to take a snapshot of the current frustum, then navigate the view to inspect it within the same viewport.\r\n */\r\nclass FrustumDecoration {\r\n private readonly _worldFrustum: Frustum;\r\n private readonly _adjustedWorldFrustum: Frustum;\r\n private readonly _preloadFrustum: Frustum;\r\n private readonly _npcFrustum: Frustum;\r\n private readonly _worldToNpcMap: Map4d;\r\n private readonly _eyePoint: Point3d;\r\n private readonly _focalPlane: number;\r\n private readonly _isCameraOn: boolean;\r\n\r\n private constructor(vp: Viewport, view: ViewState3d, private readonly _options?: FrustumDecorationOptions) {\r\n this._worldFrustum = vp.getFrustum(CoordSystem.World, false);\r\n this._adjustedWorldFrustum = vp.getFrustum(CoordSystem.World, true);\r\n this._preloadFrustum = vp.viewingSpace.getPreloadFrustum();\r\n this._npcFrustum = vp.getFrustum(CoordSystem.Npc, true);\r\n this._worldToNpcMap = vp.viewingSpace.worldToNpcMap.clone();\r\n this._eyePoint = view.camera.getEyePoint().clone();\r\n this._focalPlane = vp.worldToNpc(view.getTargetPoint()).z;\r\n this._isCameraOn = vp.isCameraOn;\r\n }\r\n\r\n public static create(vp: Viewport, options?: FrustumDecorationOptions): FrustumDecoration | undefined {\r\n const view = vp.view.isSpatialView() ? vp.view : undefined;\r\n return undefined !== view ? new FrustumDecoration(vp, view, options) : undefined;\r\n }\r\n\r\n public decorate(context: DecorateContext): void {\r\n const builder = context.createGraphicBuilder(GraphicType.WorldDecoration);\r\n\r\n if (this._isCameraOn)\r\n FrustumDecoration.drawEyePositionAndFocalPlane(builder, this._npcFrustum, this._worldToNpcMap, this._eyePoint, this._focalPlane, context.viewport);\r\n\r\n FrustumDecoration.drawFrustumBox(builder, this._worldFrustum, false, context.viewport); // show original frustum...\r\n FrustumDecoration.drawFrustumBox(builder, this._adjustedWorldFrustum, true, context.viewport); // show adjusted frustum...\r\n const options = this._options;\r\n if (options !== undefined) {\r\n if (options.showPreloadFrustum)\r\n FrustumDecoration.drawPreloadFrustum(builder, this._preloadFrustum);\r\n\r\n if (options?.showBackgroundIntersections) {\r\n const backgroundMapGeometry = context.viewport.view.displayStyle.getBackgroundMapGeometry();\r\n if (backgroundMapGeometry)\r\n backgroundMapGeometry.addFrustumDecorations(builder, this._adjustedWorldFrustum);\r\n }\r\n }\r\n context.addDecorationFromBuilder(builder);\r\n }\r\n\r\n public static drawPreloadFrustum(builder: GraphicBuilder, frustum: Frustum) {\r\n const preloadColor = ColorDef.create(ColorByName.coral);\r\n builder.setSymbology(preloadColor, preloadColor, 1, LinePixels.Code2);\r\n builder.addFrustum(frustum);\r\n }\r\n\r\n public static drawFrustumBox(builder: GraphicBuilder, frustum: Frustum, adjustedBox: boolean, vp: Viewport): void {\r\n const backPts = this.getPlanePts(frustum.points, false); // back plane\r\n const frontPts = this.getPlanePts(frustum.points, true); // front plane\r\n\r\n const bgColor = vp.view.backgroundColor;\r\n const backAndBottomColor = ColorDef.red.adjustedForContrast(bgColor);\r\n const frontAndTopLeftColor = ColorDef.blue.adjustedForContrast(bgColor);\r\n const frontAndTopRightColor = ColorDef.green.adjustedForContrast(bgColor);\r\n const edgeWeight = adjustedBox ? 2 : 1;\r\n const edgeStyle = adjustedBox ? LinePixels.Solid : LinePixels.Code2;\r\n\r\n // Back plane\r\n builder.setSymbology(backAndBottomColor, ColorDef.black, edgeWeight, edgeStyle);\r\n builder.addLineString(backPts);\r\n\r\n // Front plane\r\n builder.setSymbology(frontAndTopLeftColor, ColorDef.black, edgeWeight, edgeStyle);\r\n builder.addLineString(frontPts);\r\n\r\n // Bottom edge\r\n builder.setSymbology(backAndBottomColor, ColorDef.black, edgeWeight, edgeStyle);\r\n builder.addLineString(this.getEdgePts(backPts, frontPts, 0));\r\n builder.addLineString(this.getEdgePts(backPts, frontPts, 1));\r\n\r\n // Top edge\r\n builder.setSymbology(frontAndTopRightColor, ColorDef.black, edgeWeight, edgeStyle);\r\n builder.addLineString(this.getEdgePts(backPts, frontPts, 2));\r\n builder.setSymbology(frontAndTopLeftColor, ColorDef.black, edgeWeight, edgeStyle);\r\n builder.addLineString(this.getEdgePts(backPts, frontPts, 3));\r\n }\r\n\r\n private static getEdgePts(startPts: Point3d[], endPts: Point3d[], index: number): Point3d[] {\r\n return [\r\n startPts[index],\r\n endPts[index],\r\n ];\r\n }\r\n\r\n private static getPlanePts(frustPts: Point3d[], front: boolean): Point3d[] {\r\n const baseIndex = front ? Npc._001 : Npc._000;\r\n const planePts = [\r\n frustPts[baseIndex + Npc._000],\r\n frustPts[baseIndex + Npc._100],\r\n frustPts[baseIndex + Npc._110],\r\n frustPts[baseIndex + Npc._010],\r\n ];\r\n\r\n planePts.push(planePts[0]);\r\n return planePts;\r\n }\r\n\r\n public static drawEyePositionAndFocalPlane(builder: GraphicBuilder, npcFrustum: Frustum, worldToNpcMap: Map4d, eyePoint: Point3d, focusPlaneNpc: number, vp: Viewport): void {\r\n // Eye position...\r\n const contrastColor = vp.getContrastToBackgroundColor();\r\n builder.setSymbology(contrastColor, ColorDef.black, 8);\r\n builder.addPointString([eyePoint]);\r\n\r\n // Focal plane...\r\n const focalPtsNpc = FrustumDecoration.getPlanePts(npcFrustum.points, false);\r\n const focalPtsWorld: Point3d[] = [];\r\n for (const npcPt of focalPtsNpc)\r\n focalPtsWorld.push(Point3d.create(npcPt.x, npcPt.y, focusPlaneNpc));\r\n worldToNpcMap.transform1.multiplyPoint3dArrayQuietNormalize(focalPtsWorld);\r\n\r\n const bgColor = vp.view.backgroundColor;\r\n const focalPlaneColor = ColorDef.green.adjustedForContrast(bgColor);\r\n const focalTransColor = focalPlaneColor.withTransparency(100);\r\n builder.setSymbology(focalPlaneColor, focalTransColor, 2);\r\n builder.addLineString(focalPtsWorld);\r\n builder.addShape(focalPtsWorld);\r\n }\r\n}\r\n\r\n/**\r\n * Decorates the viewport with a graphical depiction of a Frustum.\r\n * This is obviously only useful when drawn inside a viewport using a *different* Frustum.\r\n * Options for doing so include:\r\n * - Having more than one viewport, and drawing the frustum of one viewport inside the other viewports; and\r\n * - Allowing the user to take a snapshot of the current frustum, then navigate the view to inspect it within the same viewport.\r\n * @beta\r\n */\r\nexport class FrustumDecorator implements Decorator {\r\n private readonly _decoration?: FrustumDecoration;\r\n\r\n private constructor(vp: Viewport, options?: FrustumDecorationOptions) {\r\n this._decoration = FrustumDecoration.create(vp, options);\r\n }\r\n\r\n /** This will allow the render system to cache and reuse the decorations created by this decorator's decorate() method. */\r\n public readonly useCachedDecorations = true;\r\n\r\n public decorate(context: DecorateContext): void {\r\n if (undefined !== this._decoration)\r\n this._decoration.decorate(context);\r\n }\r\n\r\n private static _instance?: FrustumDecorator;\r\n\r\n /** Add the decoration to the specified viewport. */\r\n public static enable(vp: Viewport, options?: FrustumDecorationOptions): void {\r\n FrustumDecorator.disable();\r\n FrustumDecorator._instance = new FrustumDecorator(vp, options);\r\n IModelApp.viewManager.addDecorator(FrustumDecorator._instance);\r\n }\r\n\r\n /** Remove the decoration from the specified viewport. */\r\n public static disable(): void {\r\n const instance = FrustumDecorator._instance;\r\n if (undefined !== instance) {\r\n IModelApp.viewManager.dropDecorator(instance);\r\n FrustumDecorator._instance = undefined;\r\n }\r\n }\r\n\r\n public static get isEnabled() { return undefined !== FrustumDecorator._instance; }\r\n}\r\n\r\n/** Enable (\"ON\"), disable (\"OFF\"), or toggle (\"TOGGLE\" or omitted) the [[FrustumDecorator]].\r\n * @beta\r\n */\r\nexport class ToggleFrustumSnapshotTool extends Tool {\r\n public static override toolId = \"ToggleFrustumSnapshot\";\r\n public static override get minArgs() { return 0; }\r\n public static override get maxArgs() { return 2; }\r\n\r\n public override async run(enable?: boolean, showPreloadFrustum?: boolean, showBackgroundIntersections?: boolean): Promise<boolean> {\r\n const vp = IModelApp.viewManager.selectedView;\r\n if (undefined === vp)\r\n return true;\r\n\r\n if (undefined === enable)\r\n enable = !FrustumDecorator.isEnabled;\r\n\r\n if (enable !== FrustumDecorator.isEnabled) {\r\n if (enable) {\r\n FrustumDecorator.enable(vp, { showPreloadFrustum, showBackgroundIntersections });\r\n vp.onChangeView.addOnce(() => FrustumDecorator.disable());\r\n } else {\r\n FrustumDecorator.disable();\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n public override async parseAndRun(...args: string[]): Promise<boolean> {\r\n let showPreload, showBackgroundIntersections, enable;\r\n for (const arg of args) {\r\n if (arg === \"preload\")\r\n showPreload = true;\r\n else if (arg === \"background\")\r\n showBackgroundIntersections = true;\r\n else\r\n enable = parseToggle(arg);\r\n }\r\n\r\n if (typeof enable !== \"string\")\r\n await this.run(enable, showPreload, showBackgroundIntersections);\r\n\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * Decorates the viewport with a graphical depiction of a Frustum from the currently selected viewport.\r\n * Only useful when more than one spatial viewport is open.\r\n */\r\nclass SelectedViewFrustumDecoration {\r\n private static _decorator?: SelectedViewFrustumDecoration;\r\n protected _targetVp: Viewport;\r\n protected _removeDecorationListener?: () => void;\r\n protected _removeViewChangedListener?: () => void;\r\n\r\n /** This will allow the render system to cache and reuse the decorations created by this decorator's decorate() method. */\r\n public readonly useCachedDecorations = true;\r\n\r\n public constructor(vp: Viewport, private _options?: FrustumDecorationOptions) {\r\n this._targetVp = vp;\r\n this._removeDecorationListener = IModelApp.viewManager.addDecorator(this);\r\n this._removeViewChangedListener = vp.onViewChanged.addListener(this.onViewChanged, this); // eslint-disable-line @typescript-eslint/unbound-method\r\n IModelApp.viewManager.invalidateCachedDecorationsAllViews(this);\r\n }\r\n\r\n protected stop(): void {\r\n if (this._removeDecorationListener) {\r\n this._removeDecorationListener();\r\n this._removeDecorationListener = undefined;\r\n }\r\n if (this._removeViewChangedListener) {\r\n this._removeViewChangedListener();\r\n this._removeViewChangedListener = undefined;\r\n }\r\n\r\n IModelApp.viewManager.invalidateCachedDecorationsAllViews(this);\r\n }\r\n\r\n public onViewChanged(targetVp: Viewport): void {\r\n if (targetVp !== this._targetVp)\r\n return;\r\n const decorator = SelectedViewFrustumDecoration._decorator;\r\n if (undefined !== decorator) {\r\n for (const vp of IModelApp.viewManager) {\r\n if (vp !== this._targetVp)\r\n vp.invalidateCachedDecorations(decorator);\r\n }\r\n }\r\n }\r\n\r\n public decorate(context: DecorateContext): void {\r\n const vp = context.viewport;\r\n if (!this._targetVp.view.isSpatialView() || vp === this._targetVp || !vp.view.isSpatialView())\r\n return;\r\n\r\n const builder = context.createGraphicBuilder(GraphicType.WorldDecoration);\r\n\r\n if (this._targetVp.isCameraOn) {\r\n const npcFrustum = this._targetVp.getFrustum(CoordSystem.Npc, true);\r\n const focalPlane = this._targetVp.worldToNpc(this._targetVp.view.getTargetPoint()).z;\r\n FrustumDecoration.drawEyePositionAndFocalPlane(builder, npcFrustum, this._targetVp.viewingSpace.worldToNpcMap, this._targetVp.view.camera.getEyePoint(), focalPlane, context.viewport);\r\n }\r\n\r\n const worldFrustum = this._targetVp.getFrustum(CoordSystem.World, false);\r\n const adjustedWorldFrustum = this._targetVp.getFrustum(CoordSystem.World, true);\r\n\r\n FrustumDecoration.drawFrustumBox(builder, worldFrustum, false, context.viewport); // show original frustum...\r\n FrustumDecoration.drawFrustumBox(builder, adjustedWorldFrustum, true, context.viewport); // show adjusted frustum...\r\n if (this._options && this._options.showPreloadFrustum)\r\n FrustumDecoration.drawPreloadFrustum(builder, context.viewport.viewingSpace.getPreloadFrustum());\r\n\r\n context.addDecorationFromBuilder(builder);\r\n }\r\n\r\n // Returns true if decoration becomes enabled.\r\n public static toggle(vp: Viewport, enabled?: boolean): boolean {\r\n if (undefined !== enabled) {\r\n const alreadyEnabled = undefined !== SelectedViewFrustumDecoration._decorator;\r\n if (enabled === alreadyEnabled)\r\n return alreadyEnabled;\r\n }\r\n\r\n if (undefined === SelectedViewFrustumDecoration._decorator) {\r\n SelectedViewFrustumDecoration._decorator = new SelectedViewFrustumDecoration(vp);\r\n return true;\r\n } else {\r\n SelectedViewFrustumDecoration._decorator.stop();\r\n SelectedViewFrustumDecoration._decorator = undefined;\r\n return false;\r\n }\r\n }\r\n}\r\n\r\n/** Enable (\"ON\"), disable (\"OFF\"), or toggle (\"TOGGLE\" or omitted) the selected view frustum decoration.\r\n * @beta\r\n */\r\nexport class ToggleSelectedViewFrustumTool extends Tool {\r\n public static override toolId = \"ToggleSelectedViewFrustum\";\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): Promise<boolean> {\r\n const vp = IModelApp.viewManager.selectedView;\r\n if (undefined === vp || !vp.view.isSpatialView())\r\n return false;\r\n if (SelectedViewFrustumDecoration.toggle(vp, enable)) {\r\n const remove = vp.onChangeView.addListener((_vp: Viewport, prev: ViewState) => {\r\n if (!prev.hasSameCoordinates(vp.view)) {\r\n SelectedViewFrustumDecoration.toggle(vp, false);\r\n remove();\r\n }\r\n });\r\n }\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 if (typeof enable !== \"string\")\r\n await this.run(enable);\r\n\r\n return true;\r\n }\r\n}\r\n\r\nclass ShadowFrustumDecoration {\r\n private static _instance?: ShadowFrustumDecoration;\r\n private _targetVp: Viewport;\r\n private _cleanup?: () => void;\r\n\r\n /** This will allow the render system to cache and reuse the decorations created by this decorator's decorate() method. */\r\n public readonly useCachedDecorations = true;\r\n\r\n public constructor(vp: Viewport) {\r\n this._targetVp = vp;\r\n const removeDecorator = IModelApp.viewManager.addDecorator(this);\r\n const removeOnRender = vp.onRender.addListener((_) => this.onRender());\r\n this._cleanup = () => {\r\n removeDecorator();\r\n removeOnRender();\r\n };\r\n\r\n IModelApp.viewManager.invalidateCachedDecorationsAllViews(this);\r\n }\r\n\r\n private stop(): void {\r\n if (undefined !== this._cleanup) {\r\n this._cleanup();\r\n this._cleanup = undefined;\r\n }\r\n\r\n IModelApp.viewManager.invalidateCachedDecorationsAllViews(this);\r\n }\r\n\r\n public onRender(): void {\r\n const decorator = ShadowFrustumDecoration._instance;\r\n if (undefined !== decorator) {\r\n for (const vp of IModelApp.viewManager) {\r\n if (vp !== this._targetVp)\r\n vp.invalidateCachedDecorations(decorator);\r\n }\r\n }\r\n }\r\n\r\n public decorate(context: DecorateContext): void {\r\n const frustum = this._targetVp.target.debugControl!.shadowFrustum;\r\n if (undefined === frustum)\r\n return;\r\n\r\n const thisVp = context.viewport;\r\n if (thisVp === this._targetVp || !thisVp.view.isSpatialView())\r\n return;\r\n\r\n const builder = context.createGraphicBuilder(GraphicType.WorldDecoration);\r\n FrustumDecoration.drawFrustumBox(builder, frustum, false, thisVp);\r\n context.addDecorationFromBuilder(builder);\r\n }\r\n\r\n public static toggle(vp: Viewport, enabled?: boolean): void {\r\n const instance = ShadowFrustumDecoration._instance;\r\n if (undefined !== enabled) {\r\n const alreadyEnabled = undefined !== instance;\r\n if (enabled === alreadyEnabled)\r\n return;\r\n }\r\n\r\n if (undefined === instance) {\r\n ShadowFrustumDecoration._instance = new ShadowFrustumDecoration(vp);\r\n } else {\r\n instance.stop();\r\n ShadowFrustumDecoration._instance = undefined;\r\n }\r\n }\r\n}\r\n\r\n/** Toggle visualization of the selected viewport's shadow frustum in all other viewports.\r\n * @beta\r\n */\r\nexport class ToggleShadowFrustumTool extends Tool {\r\n public static override toolId = \"ToggleShadowFrustum\";\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): Promise<boolean> {\r\n const vp = IModelApp.viewManager.selectedView;\r\n if (undefined !== vp && vp.view.isSpatialView())\r\n ShadowFrustumDecoration.toggle(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 if (typeof enable !== \"string\")\r\n await this.run(enable);\r\n\r\n return true;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"FrustumDecoration.js","sourceRoot":"","sources":["../../../src/tools/FrustumDecoration.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAS,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAW,UAAU,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,EACL,WAAW,EAA8C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KAAK,CAAC,WAAW,CAAC,GAAG,IAAc;QACjD,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACpC,IAAI,OAAO,MAAM,KAAK,QAAQ;YAC5B,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAEzB,OAAO,IAAI,CAAC;IACd,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Tools\n */\n\nimport { Map4d, Point3d } from \"@itwin/core-geometry\";\nimport { ColorByName, ColorDef, Frustum, LinePixels, Npc } from \"@itwin/core-common\";\nimport {\n CoordSystem, DecorateContext, Decorator, GraphicBuilder, GraphicType, IModelApp, Tool, Viewport, ViewState, ViewState3d,\n} from \"@itwin/core-frontend\";\nimport { parseToggle } from \"./parseToggle\";\n\ninterface FrustumDecorationOptions {\n showPreloadFrustum?: boolean;\n showBackgroundIntersections?: boolean;\n}\n\n/**\n * Decorates the viewport with a graphical depiction of a Frustum.\n * This is obviously only useful when drawn inside a viewport using a *different* Frustum.\n * Options for doing so include:\n * - Having more than one viewport, and drawing the frustum of one viewport inside the other viewports; and\n * - Allowing the user to take a snapshot of the current frustum, then navigate the view to inspect it within the same viewport.\n */\nclass FrustumDecoration {\n private readonly _worldFrustum: Frustum;\n private readonly _adjustedWorldFrustum: Frustum;\n private readonly _preloadFrustum: Frustum;\n private readonly _npcFrustum: Frustum;\n private readonly _worldToNpcMap: Map4d;\n private readonly _eyePoint: Point3d;\n private readonly _focalPlane: number;\n private readonly _isCameraOn: boolean;\n\n private constructor(vp: Viewport, view: ViewState3d, private readonly _options?: FrustumDecorationOptions) {\n this._worldFrustum = vp.getFrustum(CoordSystem.World, false);\n this._adjustedWorldFrustum = vp.getFrustum(CoordSystem.World, true);\n this._preloadFrustum = vp.viewingSpace.getPreloadFrustum();\n this._npcFrustum = vp.getFrustum(CoordSystem.Npc, true);\n this._worldToNpcMap = vp.viewingSpace.worldToNpcMap.clone();\n this._eyePoint = view.camera.getEyePoint().clone();\n this._focalPlane = vp.worldToNpc(view.getTargetPoint()).z;\n this._isCameraOn = vp.isCameraOn;\n }\n\n public static create(vp: Viewport, options?: FrustumDecorationOptions): FrustumDecoration | undefined {\n const view = vp.view.isSpatialView() ? vp.view : undefined;\n return undefined !== view ? new FrustumDecoration(vp, view, options) : undefined;\n }\n\n public decorate(context: DecorateContext): void {\n const builder = context.createGraphicBuilder(GraphicType.WorldDecoration);\n\n if (this._isCameraOn)\n FrustumDecoration.drawEyePositionAndFocalPlane(builder, this._npcFrustum, this._worldToNpcMap, this._eyePoint, this._focalPlane, context.viewport);\n\n FrustumDecoration.drawFrustumBox(builder, this._worldFrustum, false, context.viewport); // show original frustum...\n FrustumDecoration.drawFrustumBox(builder, this._adjustedWorldFrustum, true, context.viewport); // show adjusted frustum...\n const options = this._options;\n if (options !== undefined) {\n if (options.showPreloadFrustum)\n FrustumDecoration.drawPreloadFrustum(builder, this._preloadFrustum);\n\n if (options?.showBackgroundIntersections) {\n const backgroundMapGeometry = context.viewport.view.displayStyle.getBackgroundMapGeometry();\n if (backgroundMapGeometry)\n backgroundMapGeometry.addFrustumDecorations(builder, this._adjustedWorldFrustum);\n }\n }\n context.addDecorationFromBuilder(builder);\n }\n\n public static drawPreloadFrustum(builder: GraphicBuilder, frustum: Frustum) {\n const preloadColor = ColorDef.create(ColorByName.coral);\n builder.setSymbology(preloadColor, preloadColor, 1, LinePixels.Code2);\n builder.addFrustum(frustum);\n }\n\n public static drawFrustumBox(builder: GraphicBuilder, frustum: Frustum, adjustedBox: boolean, vp: Viewport): void {\n const backPts = this.getPlanePts(frustum.points, false); // back plane\n const frontPts = this.getPlanePts(frustum.points, true); // front plane\n\n const bgColor = vp.view.backgroundColor;\n const backAndBottomColor = ColorDef.red.adjustedForContrast(bgColor);\n const frontAndTopLeftColor = ColorDef.blue.adjustedForContrast(bgColor);\n const frontAndTopRightColor = ColorDef.green.adjustedForContrast(bgColor);\n const edgeWeight = adjustedBox ? 2 : 1;\n const edgeStyle = adjustedBox ? LinePixels.Solid : LinePixels.Code2;\n\n // Back plane\n builder.setSymbology(backAndBottomColor, ColorDef.black, edgeWeight, edgeStyle);\n builder.addLineString(backPts);\n\n // Front plane\n builder.setSymbology(frontAndTopLeftColor, ColorDef.black, edgeWeight, edgeStyle);\n builder.addLineString(frontPts);\n\n // Bottom edge\n builder.setSymbology(backAndBottomColor, ColorDef.black, edgeWeight, edgeStyle);\n builder.addLineString(this.getEdgePts(backPts, frontPts, 0));\n builder.addLineString(this.getEdgePts(backPts, frontPts, 1));\n\n // Top edge\n builder.setSymbology(frontAndTopRightColor, ColorDef.black, edgeWeight, edgeStyle);\n builder.addLineString(this.getEdgePts(backPts, frontPts, 2));\n builder.setSymbology(frontAndTopLeftColor, ColorDef.black, edgeWeight, edgeStyle);\n builder.addLineString(this.getEdgePts(backPts, frontPts, 3));\n }\n\n private static getEdgePts(startPts: Point3d[], endPts: Point3d[], index: number): Point3d[] {\n return [\n startPts[index],\n endPts[index],\n ];\n }\n\n private static getPlanePts(frustPts: Point3d[], front: boolean): Point3d[] {\n const baseIndex = front ? Npc._001 : Npc._000;\n const planePts = [\n frustPts[baseIndex + Npc._000],\n frustPts[baseIndex + Npc._100],\n frustPts[baseIndex + Npc._110],\n frustPts[baseIndex + Npc._010],\n ];\n\n planePts.push(planePts[0]);\n return planePts;\n }\n\n public static drawEyePositionAndFocalPlane(builder: GraphicBuilder, npcFrustum: Frustum, worldToNpcMap: Map4d, eyePoint: Point3d, focusPlaneNpc: number, vp: Viewport): void {\n // Eye position...\n const contrastColor = vp.getContrastToBackgroundColor();\n builder.setSymbology(contrastColor, ColorDef.black, 8);\n builder.addPointString([eyePoint]);\n\n // Focal plane...\n const focalPtsNpc = FrustumDecoration.getPlanePts(npcFrustum.points, false);\n const focalPtsWorld: Point3d[] = [];\n for (const npcPt of focalPtsNpc)\n focalPtsWorld.push(Point3d.create(npcPt.x, npcPt.y, focusPlaneNpc));\n worldToNpcMap.transform1.multiplyPoint3dArrayQuietNormalize(focalPtsWorld);\n\n const bgColor = vp.view.backgroundColor;\n const focalPlaneColor = ColorDef.green.adjustedForContrast(bgColor);\n const focalTransColor = focalPlaneColor.withTransparency(100);\n builder.setSymbology(focalPlaneColor, focalTransColor, 2);\n builder.addLineString(focalPtsWorld);\n builder.addShape(focalPtsWorld);\n }\n}\n\n/**\n * Decorates the viewport with a graphical depiction of a Frustum.\n * This is obviously only useful when drawn inside a viewport using a *different* Frustum.\n * Options for doing so include:\n * - Having more than one viewport, and drawing the frustum of one viewport inside the other viewports; and\n * - Allowing the user to take a snapshot of the current frustum, then navigate the view to inspect it within the same viewport.\n * @beta\n */\nexport class FrustumDecorator implements Decorator {\n private readonly _decoration?: FrustumDecoration;\n\n private constructor(vp: Viewport, options?: FrustumDecorationOptions) {\n this._decoration = FrustumDecoration.create(vp, options);\n }\n\n /** This will allow the render system to cache and reuse the decorations created by this decorator's decorate() method. */\n public readonly useCachedDecorations = true;\n\n public decorate(context: DecorateContext): void {\n if (undefined !== this._decoration)\n this._decoration.decorate(context);\n }\n\n private static _instance?: FrustumDecorator;\n\n /** Add the decoration to the specified viewport. */\n public static enable(vp: Viewport, options?: FrustumDecorationOptions): void {\n FrustumDecorator.disable();\n FrustumDecorator._instance = new FrustumDecorator(vp, options);\n IModelApp.viewManager.addDecorator(FrustumDecorator._instance);\n }\n\n /** Remove the decoration from the specified viewport. */\n public static disable(): void {\n const instance = FrustumDecorator._instance;\n if (undefined !== instance) {\n IModelApp.viewManager.dropDecorator(instance);\n FrustumDecorator._instance = undefined;\n }\n }\n\n public static get isEnabled() { return undefined !== FrustumDecorator._instance; }\n}\n\n/** Enable (\"ON\"), disable (\"OFF\"), or toggle (\"TOGGLE\" or omitted) the [[FrustumDecorator]].\n * @beta\n */\nexport class ToggleFrustumSnapshotTool extends Tool {\n public static override toolId = \"ToggleFrustumSnapshot\";\n public static override get minArgs() { return 0; }\n public static override get maxArgs() { return 2; }\n\n public override async run(enable?: boolean, showPreloadFrustum?: boolean, showBackgroundIntersections?: boolean): Promise<boolean> {\n const vp = IModelApp.viewManager.selectedView;\n if (undefined === vp)\n return true;\n\n if (undefined === enable)\n enable = !FrustumDecorator.isEnabled;\n\n if (enable !== FrustumDecorator.isEnabled) {\n if (enable) {\n FrustumDecorator.enable(vp, { showPreloadFrustum, showBackgroundIntersections });\n vp.onChangeView.addOnce(() => FrustumDecorator.disable());\n } else {\n FrustumDecorator.disable();\n }\n }\n\n return true;\n }\n\n public override async parseAndRun(...args: string[]): Promise<boolean> {\n let showPreload, showBackgroundIntersections, enable;\n for (const arg of args) {\n if (arg === \"preload\")\n showPreload = true;\n else if (arg === \"background\")\n showBackgroundIntersections = true;\n else\n enable = parseToggle(arg);\n }\n\n if (typeof enable !== \"string\")\n await this.run(enable, showPreload, showBackgroundIntersections);\n\n return true;\n }\n}\n\n/**\n * Decorates the viewport with a graphical depiction of a Frustum from the currently selected viewport.\n * Only useful when more than one spatial viewport is open.\n */\nclass SelectedViewFrustumDecoration {\n private static _decorator?: SelectedViewFrustumDecoration;\n protected _targetVp: Viewport;\n protected _removeDecorationListener?: () => void;\n protected _removeViewChangedListener?: () => void;\n\n /** This will allow the render system to cache and reuse the decorations created by this decorator's decorate() method. */\n public readonly useCachedDecorations = true;\n\n public constructor(vp: Viewport, private _options?: FrustumDecorationOptions) {\n this._targetVp = vp;\n this._removeDecorationListener = IModelApp.viewManager.addDecorator(this);\n this._removeViewChangedListener = vp.onViewChanged.addListener(this.onViewChanged, this); // eslint-disable-line @typescript-eslint/unbound-method\n IModelApp.viewManager.invalidateCachedDecorationsAllViews(this);\n }\n\n protected stop(): void {\n if (this._removeDecorationListener) {\n this._removeDecorationListener();\n this._removeDecorationListener = undefined;\n }\n if (this._removeViewChangedListener) {\n this._removeViewChangedListener();\n this._removeViewChangedListener = undefined;\n }\n\n IModelApp.viewManager.invalidateCachedDecorationsAllViews(this);\n }\n\n public onViewChanged(targetVp: Viewport): void {\n if (targetVp !== this._targetVp)\n return;\n const decorator = SelectedViewFrustumDecoration._decorator;\n if (undefined !== decorator) {\n for (const vp of IModelApp.viewManager) {\n if (vp !== this._targetVp)\n vp.invalidateCachedDecorations(decorator);\n }\n }\n }\n\n public decorate(context: DecorateContext): void {\n const vp = context.viewport;\n if (!this._targetVp.view.isSpatialView() || vp === this._targetVp || !vp.view.isSpatialView())\n return;\n\n const builder = context.createGraphicBuilder(GraphicType.WorldDecoration);\n\n if (this._targetVp.isCameraOn) {\n const npcFrustum = this._targetVp.getFrustum(CoordSystem.Npc, true);\n const focalPlane = this._targetVp.worldToNpc(this._targetVp.view.getTargetPoint()).z;\n FrustumDecoration.drawEyePositionAndFocalPlane(builder, npcFrustum, this._targetVp.viewingSpace.worldToNpcMap, this._targetVp.view.camera.getEyePoint(), focalPlane, context.viewport);\n }\n\n const worldFrustum = this._targetVp.getFrustum(CoordSystem.World, false);\n const adjustedWorldFrustum = this._targetVp.getFrustum(CoordSystem.World, true);\n\n FrustumDecoration.drawFrustumBox(builder, worldFrustum, false, context.viewport); // show original frustum...\n FrustumDecoration.drawFrustumBox(builder, adjustedWorldFrustum, true, context.viewport); // show adjusted frustum...\n if (this._options && this._options.showPreloadFrustum)\n FrustumDecoration.drawPreloadFrustum(builder, context.viewport.viewingSpace.getPreloadFrustum());\n\n context.addDecorationFromBuilder(builder);\n }\n\n // Returns true if decoration becomes enabled.\n public static toggle(vp: Viewport, enabled?: boolean): boolean {\n if (undefined !== enabled) {\n const alreadyEnabled = undefined !== SelectedViewFrustumDecoration._decorator;\n if (enabled === alreadyEnabled)\n return alreadyEnabled;\n }\n\n if (undefined === SelectedViewFrustumDecoration._decorator) {\n SelectedViewFrustumDecoration._decorator = new SelectedViewFrustumDecoration(vp);\n return true;\n } else {\n SelectedViewFrustumDecoration._decorator.stop();\n SelectedViewFrustumDecoration._decorator = undefined;\n return false;\n }\n }\n}\n\n/** Enable (\"ON\"), disable (\"OFF\"), or toggle (\"TOGGLE\" or omitted) the selected view frustum decoration.\n * @beta\n */\nexport class ToggleSelectedViewFrustumTool extends Tool {\n public static override toolId = \"ToggleSelectedViewFrustum\";\n public static override get minArgs() { return 0; }\n public static override get maxArgs() { return 1; }\n\n public override async run(enable?: boolean): Promise<boolean> {\n const vp = IModelApp.viewManager.selectedView;\n if (undefined === vp || !vp.view.isSpatialView())\n return false;\n if (SelectedViewFrustumDecoration.toggle(vp, enable)) {\n const remove = vp.onChangeView.addListener((_vp: Viewport, prev: ViewState) => {\n if (!prev.hasSameCoordinates(vp.view)) {\n SelectedViewFrustumDecoration.toggle(vp, false);\n remove();\n }\n });\n }\n\n return true;\n }\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\nclass ShadowFrustumDecoration {\n private static _instance?: ShadowFrustumDecoration;\n private _targetVp: Viewport;\n private _cleanup?: () => void;\n\n /** This will allow the render system to cache and reuse the decorations created by this decorator's decorate() method. */\n public readonly useCachedDecorations = true;\n\n public constructor(vp: Viewport) {\n this._targetVp = vp;\n const removeDecorator = IModelApp.viewManager.addDecorator(this);\n const removeOnRender = vp.onRender.addListener((_) => this.onRender());\n this._cleanup = () => {\n removeDecorator();\n removeOnRender();\n };\n\n IModelApp.viewManager.invalidateCachedDecorationsAllViews(this);\n }\n\n private stop(): void {\n if (undefined !== this._cleanup) {\n this._cleanup();\n this._cleanup = undefined;\n }\n\n IModelApp.viewManager.invalidateCachedDecorationsAllViews(this);\n }\n\n public onRender(): void {\n const decorator = ShadowFrustumDecoration._instance;\n if (undefined !== decorator) {\n for (const vp of IModelApp.viewManager) {\n if (vp !== this._targetVp)\n vp.invalidateCachedDecorations(decorator);\n }\n }\n }\n\n public decorate(context: DecorateContext): void {\n const frustum = this._targetVp.target.debugControl!.shadowFrustum;\n if (undefined === frustum)\n return;\n\n const thisVp = context.viewport;\n if (thisVp === this._targetVp || !thisVp.view.isSpatialView())\n return;\n\n const builder = context.createGraphicBuilder(GraphicType.WorldDecoration);\n FrustumDecoration.drawFrustumBox(builder, frustum, false, thisVp);\n context.addDecorationFromBuilder(builder);\n }\n\n public static toggle(vp: Viewport, enabled?: boolean): void {\n const instance = ShadowFrustumDecoration._instance;\n if (undefined !== enabled) {\n const alreadyEnabled = undefined !== instance;\n if (enabled === alreadyEnabled)\n return;\n }\n\n if (undefined === instance) {\n ShadowFrustumDecoration._instance = new ShadowFrustumDecoration(vp);\n } else {\n instance.stop();\n ShadowFrustumDecoration._instance = undefined;\n }\n }\n}\n\n/** Toggle visualization of the selected viewport's shadow frustum in all other viewports.\n * @beta\n */\nexport class ToggleShadowFrustumTool extends Tool {\n public static override toolId = \"ToggleShadowFrustum\";\n public static override get minArgs() { return 0; }\n public static override get maxArgs() { return 1; }\n\n public override async run(enable?: boolean): Promise<boolean> {\n const vp = IModelApp.viewManager.selectedView;\n if (undefined !== vp && vp.view.isSpatialView())\n ShadowFrustumDecoration.toggle(vp, enable);\n\n return true;\n }\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"]}
@@ -22,15 +22,17 @@ import { parseArgs } from "./parseArgs";
22
22
  * @beta
23
23
  */
24
24
  export class InspectElementTool extends PrimitiveTool {
25
+ static toolId = "InspectElement";
25
26
  static get minArgs() { return 0; }
26
27
  static get maxArgs() { return 6; }
28
+ _options = {};
29
+ _elementIds;
30
+ _modal = false;
31
+ _useSelection = false;
32
+ _doCopy = false;
33
+ _explodeParts = false;
27
34
  constructor(options, elementIds) {
28
35
  super();
29
- this._options = {};
30
- this._modal = false;
31
- this._useSelection = false;
32
- this._doCopy = false;
33
- this._explodeParts = false;
34
36
  if (undefined !== options)
35
37
  this._options = { ...options };
36
38
  this._elementIds = elementIds;
@@ -191,5 +193,4 @@ export class InspectElementTool extends PrimitiveTool {
191
193
  return this.run();
192
194
  }
193
195
  }
194
- InspectElementTool.toolId = "InspectElement";
195
196
  //# sourceMappingURL=InspectElementTool.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InspectElementTool.js","sourceRoot":"","sources":["../../../src/tools/InspectElementTool.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,IAAI,EAAyB,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAA0B,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC9G,OAAO,EACU,SAAS,EAAE,YAAY,EAAa,SAAS,EAAE,kBAAkB,EAAE,cAAc,EAAE,kBAAkB,EAAE,cAAc,EACpI,oBAAoB,EAAE,qBAAqB,EAAE,aAAa,GAC3D,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;;;;;;;;GAUG;AACH,MAAM,OAAO,kBAAmB,SAAQ,aAAa;IAE5C,MAAM,KAAc,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3C,MAAM,KAAc,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IASlD,YAAY,OAAgC,EAAE,UAAyB;QACrE,KAAK,EAAE,CAAC;QARF,aAAQ,GAA2B,EAAE,CAAC;QAEtC,WAAM,GAAG,KAAK,CAAC;QACf,kBAAa,GAAG,KAAK,CAAC;QACtB,YAAO,GAAG,KAAK,CAAC;QAChB,kBAAa,GAAG,KAAK,CAAC;QAI5B,IAAI,SAAS,KAAK,OAAO;YACvB,IAAI,CAAC,QAAQ,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC;QAEjC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IAEO,2BAA2B;QACjC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AAC;oBACJ,IAAI,CAAC,QAAQ,CAAC,iBAAiB,GAAG,wBAAwB,CAAC,IAAI,CAAC;oBAChE,MAAM;YACV,CAAC;QACH,CAAC;QAED,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACvC,IAAI,SAAS,KAAK,SAAS;YACzB,IAAI,CAAC,QAAQ,CAAC,gBAAgB,GAAG,SAAS,CAAC;QAE7C,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACvC,IAAI,SAAS,KAAK,SAAS;YACzB,IAAI,CAAC,QAAQ,CAAC,gBAAgB,GAAG,SAAS,CAAC;QAE7C,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACnC,IAAI,IAAI,KAAK,KAAK,IAAI,SAAS,KAAK,SAAS,CAAC,WAAW,CAAC,YAAY;YACpE,IAAI,CAAC,QAAQ,CAAC,qBAAqB,GAAG,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;QAErG,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACnC,IAAI,SAAS,KAAK,KAAK;YACrB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QAEtB,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACpC,IAAI,SAAS,KAAK,MAAM;YACtB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QAExB,IAAI,CAAC,aAAa,GAAG,IAAI,KAAK,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QAEnD,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC;IACpB,CAAC;;AA5MsB,yBAAM,GAAG,gBAAgB,AAAnB,CAAoB","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\r\n/** @packageDocumentation\r\n * @module Tools\r\n */\r\n\r\nimport { BentleyError, Id64, Id64Array, Id64String } from \"@itwin/core-bentley\";\r\nimport { GeometrySummaryOptions, GeometrySummaryVerbosity, IModelReadRpcInterface } from \"@itwin/core-common\";\r\nimport {\r\n BeButtonEvent, CoreTools, EventHandled, HitDetail, IModelApp, LocateFilterStatus, LocateResponse, MessageBoxIconType, MessageBoxType,\r\n NotifyMessageDetails, OutputMessagePriority, PrimitiveTool,\r\n} from \"@itwin/core-frontend\";\r\nimport { copyStringToClipboard } from \"../ClipboardUtilities\";\r\nimport { parseArgs } from \"./parseArgs\";\r\n\r\n/** Creates a readable text summary of a geometric element or geometry part. The keyin takes the following arguments, all of which are optional:\r\n * - `id=elementId,elementId,elementId` comma-separated list of element Ids where each `elementId` is a hexadecimal element Id such as \"0x12cb\";\r\n * - `symbology=0|1` where 1 indicates detailed symbology information should be included in the output;\r\n * - `placement=0|1` where 1 indicates detailed geometric element placement should be included; and\r\n * - `verbosity=0|1|2` controlling the verbosity of the output for each geometric primitive in the geometry stream. Higher values = more detailed information. Note verbosity=2 can produce megabytes of data for certain types of geometric primitives like large meshes.\r\n * - `modal=0|1` where 1 indicates the output should appear in a modal dialog.\r\n * - `copy=0|1` where 1 indicates the output should be copied to the clipboard. Defaults to true.\r\n * - `refs=0|1` where 1 indicates that for geometry parts a list of all elements referencing that part should be included in the output. This is extremely computationally expensive.\r\n * If no id is specified, the tool runs in interactive mode: first operating upon the selection set (if any), then allowing the user to select additional elements.\r\n * @beta\r\n */\r\nexport class InspectElementTool extends PrimitiveTool {\r\n public static override toolId = \"InspectElement\";\r\n public static override get minArgs() { return 0; }\r\n public static override get maxArgs() { return 6; }\r\n\r\n private _options: GeometrySummaryOptions = {};\r\n private _elementIds?: Id64String[];\r\n private _modal = false;\r\n private _useSelection = false;\r\n private _doCopy = false;\r\n private _explodeParts = false;\r\n\r\n constructor(options?: GeometrySummaryOptions, elementIds?: Id64String[]) {\r\n super();\r\n if (undefined !== options)\r\n this._options = { ...options };\r\n\r\n this._elementIds = elementIds;\r\n }\r\n\r\n private setupAndPromptForNextAction(): void {\r\n this._useSelection = (undefined !== this.targetView && this.targetView.iModel.selectionSet.isActive);\r\n if (!this._useSelection)\r\n IModelApp.accuSnap.enableLocate(true);\r\n\r\n this.showPrompt();\r\n }\r\n\r\n private showPrompt(): void {\r\n CoreTools.outputPromptByKey(this._useSelection ? \"ElementSet.Prompts.ConfirmSelection\" : \"ElementSet.Prompts.IdentifyElement\");\r\n }\r\n\r\n public override autoLockTarget(): void { }\r\n\r\n public override requireWriteableTarget(): boolean { return false; }\r\n\r\n public override async onUnsuspend() {\r\n this.showPrompt();\r\n }\r\n\r\n public override async onPostInstall() {\r\n await super.onPostInstall();\r\n\r\n if (undefined !== this._elementIds)\r\n this.process(this._elementIds).then(async () => {\r\n await this.onReinitialize();\r\n }).catch((err) => {\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, err.toString()));\r\n });\r\n else {\r\n this.setupAndPromptForNextAction();\r\n }\r\n }\r\n\r\n public override async onDataButtonDown(ev: BeButtonEvent): Promise<EventHandled> {\r\n if (this._useSelection) {\r\n if (undefined !== ev.viewport) {\r\n const ids: Id64Array = [];\r\n ev.viewport.iModel.selectionSet.elements.forEach((id) => {\r\n if (!Id64.isInvalid(id) && !Id64.isTransient(id))\r\n ids.push(id);\r\n });\r\n\r\n if (0 === ids.length)\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, CoreTools.translate(\"ElementSet.Error.NotSupportedElmType\")));\r\n else\r\n await this.process(ids);\r\n\r\n await this.onReinitialize();\r\n return EventHandled.Yes;\r\n }\r\n }\r\n\r\n const hit = await IModelApp.locateManager.doLocate(new LocateResponse(), true, ev.point, ev.viewport, ev.inputSource);\r\n if (undefined === hit || !hit.isElementHit)\r\n return EventHandled.No;\r\n\r\n await this.process([hit.sourceId]);\r\n this.setupAndPromptForNextAction();\r\n return EventHandled.No;\r\n }\r\n\r\n public override async onResetButtonUp(_ev: BeButtonEvent): Promise<EventHandled> {\r\n await this.onReinitialize();\r\n return EventHandled.No;\r\n }\r\n\r\n public override async onReinitialize() {\r\n if (this._useSelection || undefined !== this._elementIds) {\r\n await this.exitTool();\r\n } else {\r\n await this.onRestartTool();\r\n }\r\n }\r\n\r\n public async onRestartTool() {\r\n const tool = new InspectElementTool();\r\n if (!await tool.run())\r\n return this.exitTool();\r\n }\r\n\r\n public override async filterHit(hit: HitDetail, _out: LocateResponse): Promise<LocateFilterStatus> {\r\n return hit.isElementHit ? LocateFilterStatus.Accept : LocateFilterStatus.Reject;\r\n }\r\n\r\n private async process(elementIds: Id64String[]) {\r\n const request = {\r\n elementIds,\r\n options: this._options,\r\n };\r\n let messageDetails: NotifyMessageDetails;\r\n try {\r\n let str = await IModelReadRpcInterface.getClientForRouting(this.iModel.routingContext.token).getGeometrySummary(this.iModel.getRpcProps(), request);\r\n if (this._explodeParts) {\r\n const regex = /^part id: (0x[a-f0-9]+)/gm;\r\n const partIds = new Set<string>();\r\n let match;\r\n while (null !== (match = regex.exec(str)))\r\n partIds.add(match[1]);\r\n\r\n if (partIds.size > 0) {\r\n request.elementIds = Array.from(partIds);\r\n str += `\\npart ids: ${JSON.stringify(request.elementIds)}\\n`;\r\n str += await IModelReadRpcInterface.getClientForRouting(this.iModel.routingContext.token).getGeometrySummary(this.iModel.getRpcProps(), request);\r\n }\r\n }\r\n\r\n if (this._doCopy)\r\n copyStringToClipboard(str);\r\n\r\n const brief = `Summary ${this._doCopy ? \"copied to clipboard.\" : \"complete.\"}`;\r\n messageDetails = new NotifyMessageDetails(OutputMessagePriority.Info, brief, str);\r\n\r\n if (this._modal) {\r\n const div = document.createElement(\"div\");\r\n const appendText = (toAppend: string) => {\r\n const txt = document.createElement(\"div\");\r\n txt.innerText = toAppend;\r\n div.append(txt);\r\n };\r\n\r\n const lines = str.split(\"\\n\");\r\n const maxLines = 30;\r\n let curLine = 0;\r\n for (const line of lines) {\r\n appendText(line);\r\n if (++curLine > maxLines) {\r\n appendText(\"...\");\r\n break;\r\n }\r\n }\r\n\r\n await IModelApp.notifications.openMessageBox(MessageBoxType.Ok, div, MessageBoxIconType.Information);\r\n }\r\n } catch (err) {\r\n messageDetails = new NotifyMessageDetails(OutputMessagePriority.Error, \"Error occurred while generating summary\", BentleyError.getErrorMessage(err));\r\n }\r\n\r\n IModelApp.notifications.outputMessage(messageDetails);\r\n }\r\n\r\n public override async parseAndRun(...inputArgs: string[]): Promise<boolean> {\r\n const args = parseArgs(inputArgs);\r\n const ids = args.get(\"i\");\r\n if (undefined !== ids)\r\n this._elementIds = ids.split(\",\");\r\n\r\n const verbosity = args.getInteger(\"v\");\r\n if (undefined !== verbosity) {\r\n switch (verbosity) {\r\n case 0:\r\n this._options.geometryVerbosity = GeometrySummaryVerbosity.Basic;\r\n break;\r\n case 1:\r\n this._options.geometryVerbosity = GeometrySummaryVerbosity.Detailed;\r\n break;\r\n case 2:\r\n this._options.geometryVerbosity = GeometrySummaryVerbosity.Full;\r\n break;\r\n }\r\n }\r\n\r\n const symbology = args.getBoolean(\"s\");\r\n if (undefined !== symbology)\r\n this._options.verboseSymbology = symbology;\r\n\r\n const placement = args.getBoolean(\"p\");\r\n if (undefined !== placement)\r\n this._options.includePlacement = placement;\r\n\r\n const parts = args.getBoolean(\"r\");\r\n if (true === parts && undefined !== IModelApp.viewManager.selectedView)\r\n this._options.includePartReferences = IModelApp.viewManager.selectedView.view.is3d() ? \"3d\" : \"2d\";\r\n\r\n const modal = args.getBoolean(\"m\");\r\n if (undefined !== modal)\r\n this._modal = modal;\r\n\r\n const doCopy = args.getBoolean(\"c\");\r\n if (undefined !== doCopy)\r\n this._doCopy = doCopy;\r\n\r\n this._explodeParts = true === args.getBoolean(\"e\");\r\n\r\n return this.run();\r\n }\r\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C;oBAChE,MAAM;YACV,CAAC;QACH,CAAC;QAED,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACvC,IAAI,SAAS,KAAK,SAAS;YACzB,IAAI,CAAC,QAAQ,CAAC,gBAAgB,GAAG,SAAS,CAAC;QAE7C,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACvC,IAAI,SAAS,KAAK,SAAS;YACzB,IAAI,CAAC,QAAQ,CAAC,gBAAgB,GAAG,SAAS,CAAC;QAE7C,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACnC,IAAI,IAAI,KAAK,KAAK,IAAI,SAAS,KAAK,SAAS,CAAC,WAAW,CAAC,YAAY;YACpE,IAAI,CAAC,QAAQ,CAAC,qBAAqB,GAAG,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;QAErG,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACnC,IAAI,SAAS,KAAK,KAAK;YACrB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QAEtB,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACpC,IAAI,SAAS,KAAK,MAAM;YACtB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QAExB,IAAI,CAAC,aAAa,GAAG,IAAI,KAAK,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QAEnD,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC;IACpB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Tools\n */\n\nimport { BentleyError, Id64, Id64Array, Id64String } from \"@itwin/core-bentley\";\nimport { GeometrySummaryOptions, GeometrySummaryVerbosity, IModelReadRpcInterface } from \"@itwin/core-common\";\nimport {\n BeButtonEvent, CoreTools, EventHandled, HitDetail, IModelApp, LocateFilterStatus, LocateResponse, MessageBoxIconType, MessageBoxType,\n NotifyMessageDetails, OutputMessagePriority, PrimitiveTool,\n} from \"@itwin/core-frontend\";\nimport { copyStringToClipboard } from \"../ClipboardUtilities\";\nimport { parseArgs } from \"./parseArgs\";\n\n/** Creates a readable text summary of a geometric element or geometry part. The keyin takes the following arguments, all of which are optional:\n * - `id=elementId,elementId,elementId` comma-separated list of element Ids where each `elementId` is a hexadecimal element Id such as \"0x12cb\";\n * - `symbology=0|1` where 1 indicates detailed symbology information should be included in the output;\n * - `placement=0|1` where 1 indicates detailed geometric element placement should be included; and\n * - `verbosity=0|1|2` controlling the verbosity of the output for each geometric primitive in the geometry stream. Higher values = more detailed information. Note verbosity=2 can produce megabytes of data for certain types of geometric primitives like large meshes.\n * - `modal=0|1` where 1 indicates the output should appear in a modal dialog.\n * - `copy=0|1` where 1 indicates the output should be copied to the clipboard. Defaults to true.\n * - `refs=0|1` where 1 indicates that for geometry parts a list of all elements referencing that part should be included in the output. This is extremely computationally expensive.\n * If no id is specified, the tool runs in interactive mode: first operating upon the selection set (if any), then allowing the user to select additional elements.\n * @beta\n */\nexport class InspectElementTool extends PrimitiveTool {\n public static override toolId = \"InspectElement\";\n public static override get minArgs() { return 0; }\n public static override get maxArgs() { return 6; }\n\n private _options: GeometrySummaryOptions = {};\n private _elementIds?: Id64String[];\n private _modal = false;\n private _useSelection = false;\n private _doCopy = false;\n private _explodeParts = false;\n\n constructor(options?: GeometrySummaryOptions, elementIds?: Id64String[]) {\n super();\n if (undefined !== options)\n this._options = { ...options };\n\n this._elementIds = elementIds;\n }\n\n private setupAndPromptForNextAction(): void {\n this._useSelection = (undefined !== this.targetView && this.targetView.iModel.selectionSet.isActive);\n if (!this._useSelection)\n IModelApp.accuSnap.enableLocate(true);\n\n this.showPrompt();\n }\n\n private showPrompt(): void {\n CoreTools.outputPromptByKey(this._useSelection ? \"ElementSet.Prompts.ConfirmSelection\" : \"ElementSet.Prompts.IdentifyElement\");\n }\n\n public override autoLockTarget(): void { }\n\n public override requireWriteableTarget(): boolean { return false; }\n\n public override async onUnsuspend() {\n this.showPrompt();\n }\n\n public override async onPostInstall() {\n await super.onPostInstall();\n\n if (undefined !== this._elementIds)\n this.process(this._elementIds).then(async () => {\n await this.onReinitialize();\n }).catch((err) => {\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, err.toString()));\n });\n else {\n this.setupAndPromptForNextAction();\n }\n }\n\n public override async onDataButtonDown(ev: BeButtonEvent): Promise<EventHandled> {\n if (this._useSelection) {\n if (undefined !== ev.viewport) {\n const ids: Id64Array = [];\n ev.viewport.iModel.selectionSet.elements.forEach((id) => {\n if (!Id64.isInvalid(id) && !Id64.isTransient(id))\n ids.push(id);\n });\n\n if (0 === ids.length)\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, CoreTools.translate(\"ElementSet.Error.NotSupportedElmType\")));\n else\n await this.process(ids);\n\n await this.onReinitialize();\n return EventHandled.Yes;\n }\n }\n\n const hit = await IModelApp.locateManager.doLocate(new LocateResponse(), true, ev.point, ev.viewport, ev.inputSource);\n if (undefined === hit || !hit.isElementHit)\n return EventHandled.No;\n\n await this.process([hit.sourceId]);\n this.setupAndPromptForNextAction();\n return EventHandled.No;\n }\n\n public override async onResetButtonUp(_ev: BeButtonEvent): Promise<EventHandled> {\n await this.onReinitialize();\n return EventHandled.No;\n }\n\n public override async onReinitialize() {\n if (this._useSelection || undefined !== this._elementIds) {\n await this.exitTool();\n } else {\n await this.onRestartTool();\n }\n }\n\n public async onRestartTool() {\n const tool = new InspectElementTool();\n if (!await tool.run())\n return this.exitTool();\n }\n\n public override async filterHit(hit: HitDetail, _out: LocateResponse): Promise<LocateFilterStatus> {\n return hit.isElementHit ? LocateFilterStatus.Accept : LocateFilterStatus.Reject;\n }\n\n private async process(elementIds: Id64String[]) {\n const request = {\n elementIds,\n options: this._options,\n };\n let messageDetails: NotifyMessageDetails;\n try {\n let str = await IModelReadRpcInterface.getClientForRouting(this.iModel.routingContext.token).getGeometrySummary(this.iModel.getRpcProps(), request);\n if (this._explodeParts) {\n const regex = /^part id: (0x[a-f0-9]+)/gm;\n const partIds = new Set<string>();\n let match;\n while (null !== (match = regex.exec(str)))\n partIds.add(match[1]);\n\n if (partIds.size > 0) {\n request.elementIds = Array.from(partIds);\n str += `\\npart ids: ${JSON.stringify(request.elementIds)}\\n`;\n str += await IModelReadRpcInterface.getClientForRouting(this.iModel.routingContext.token).getGeometrySummary(this.iModel.getRpcProps(), request);\n }\n }\n\n if (this._doCopy)\n copyStringToClipboard(str);\n\n const brief = `Summary ${this._doCopy ? \"copied to clipboard.\" : \"complete.\"}`;\n messageDetails = new NotifyMessageDetails(OutputMessagePriority.Info, brief, str);\n\n if (this._modal) {\n const div = document.createElement(\"div\");\n const appendText = (toAppend: string) => {\n const txt = document.createElement(\"div\");\n txt.innerText = toAppend;\n div.append(txt);\n };\n\n const lines = str.split(\"\\n\");\n const maxLines = 30;\n let curLine = 0;\n for (const line of lines) {\n appendText(line);\n if (++curLine > maxLines) {\n appendText(\"...\");\n break;\n }\n }\n\n await IModelApp.notifications.openMessageBox(MessageBoxType.Ok, div, MessageBoxIconType.Information);\n }\n } catch (err) {\n messageDetails = new NotifyMessageDetails(OutputMessagePriority.Error, \"Error occurred while generating summary\", BentleyError.getErrorMessage(err));\n }\n\n IModelApp.notifications.outputMessage(messageDetails);\n }\n\n public override async parseAndRun(...inputArgs: string[]): Promise<boolean> {\n const args = parseArgs(inputArgs);\n const ids = args.get(\"i\");\n if (undefined !== ids)\n this._elementIds = ids.split(\",\");\n\n const verbosity = args.getInteger(\"v\");\n if (undefined !== verbosity) {\n switch (verbosity) {\n case 0:\n this._options.geometryVerbosity = GeometrySummaryVerbosity.Basic;\n break;\n case 1:\n this._options.geometryVerbosity = GeometrySummaryVerbosity.Detailed;\n break;\n case 2:\n this._options.geometryVerbosity = GeometrySummaryVerbosity.Full;\n break;\n }\n }\n\n const symbology = args.getBoolean(\"s\");\n if (undefined !== symbology)\n this._options.verboseSymbology = symbology;\n\n const placement = args.getBoolean(\"p\");\n if (undefined !== placement)\n this._options.includePlacement = placement;\n\n const parts = args.getBoolean(\"r\");\n if (true === parts && undefined !== IModelApp.viewManager.selectedView)\n this._options.includePartReferences = IModelApp.viewManager.selectedView.view.is3d() ? \"3d\" : \"2d\";\n\n const modal = args.getBoolean(\"m\");\n if (undefined !== modal)\n this._modal = modal;\n\n const doCopy = args.getBoolean(\"c\");\n if (undefined !== doCopy)\n this._doCopy = doCopy;\n\n this._explodeParts = true === args.getBoolean(\"e\");\n\n return this.run();\n }\n}\n"]}
@@ -8,6 +8,8 @@ import { parseBoolean } from "./parseBoolean";
8
8
  import { parseToggle } from "./parseToggle";
9
9
  /** Base class for attaching map layer tool. */
10
10
  class AttachMapLayerBaseTool extends Tool {
11
+ _isBackground;
12
+ _isBase;
11
13
  constructor(_isBackground = true, _isBase = false) {
12
14
  super();
13
15
  this._isBackground = _isBackground;
@@ -59,8 +61,10 @@ class AttachMapLayerBaseTool extends Tool {
59
61
  * @beta
60
62
  */
61
63
  export class AttachModelMapLayerTool extends Tool {
64
+ _formatId;
62
65
  static get minArgs() { return 0; }
63
66
  static get maxArgs() { return 1; }
67
+ static toolId = "AttachModelMapLayerTool";
64
68
  constructor(_formatId) {
65
69
  super();
66
70
  this._formatId = _formatId;
@@ -89,9 +93,9 @@ export class AttachModelMapLayerTool extends Tool {
89
93
  async onRestartTool() {
90
94
  }
91
95
  }
92
- AttachModelMapLayerTool.toolId = "AttachModelMapLayerTool";
93
96
  /** Attach a map layer from URL base class. */
94
97
  class AttachMapLayerByURLBaseTool extends AttachMapLayerBaseTool {
98
+ _formatId;
95
99
  static get minArgs() { return 1; }
96
100
  static get maxArgs() { return 4; }
97
101
  constructor(_formatId) {
@@ -115,6 +119,7 @@ class AttachMapLayerByURLBaseTool extends AttachMapLayerBaseTool {
115
119
  * @beta
116
120
  */
117
121
  export class AttachWmsMapLayerByUrlTool extends AttachMapLayerByURLBaseTool {
122
+ static toolId = "AttachWmsMapLayerTool";
118
123
  constructor() { super("WMS"); }
119
124
  /** This method runs the tool, attaching a WMS map layer from a given URL.
120
125
  * @param args contains url, name, userName, password in array order
@@ -123,11 +128,11 @@ export class AttachWmsMapLayerByUrlTool extends AttachMapLayerByURLBaseTool {
123
128
  return this.run(WmsUtilities.getBaseUrl(args[0]), args[1], args[2], args[3]);
124
129
  }
125
130
  }
126
- AttachWmsMapLayerByUrlTool.toolId = "AttachWmsMapLayerTool";
127
131
  /** This tool attaches a WMTS map layer from a given URL.
128
132
  * @beta
129
133
  */
130
134
  export class AttachWmtsMapLayerByUrlTool extends AttachMapLayerByURLBaseTool {
135
+ static toolId = "AttachWmtsMapLayerTool";
131
136
  constructor() { super("WMTS"); }
132
137
  /** This method runs the tool, attaching a WMTS map layer from a given URL.
133
138
  * @param args contains url, name, userName, password in array order
@@ -136,39 +141,39 @@ export class AttachWmtsMapLayerByUrlTool extends AttachMapLayerByURLBaseTool {
136
141
  return this.run(WmsUtilities.getBaseUrl(args[0]), args[1], args[2], args[3]);
137
142
  }
138
143
  }
139
- AttachWmtsMapLayerByUrlTool.toolId = "AttachWmtsMapLayerTool";
140
144
  /** This tool attaches an ArcGIS map layer from a given URL.
141
145
  * @beta
142
146
  */
143
147
  export class AttachArcGISMapLayerByUrlTool extends AttachMapLayerByURLBaseTool {
148
+ static toolId = "AttachArcGISMapLayerTool";
144
149
  constructor() { super("ArcGIS"); }
145
150
  }
146
- AttachArcGISMapLayerByUrlTool.toolId = "AttachArcGISMapLayerTool";
147
151
  /** This tool attaches an ArcGIS map layer from a given URL.
148
152
  * @beta
149
153
  */
150
154
  export class AttachArcGISFeatureMapLayerByUrlTool extends AttachMapLayerByURLBaseTool {
155
+ static toolId = "AttachArcGISFeatureMapLayerTool";
151
156
  constructor() { super("ArcGISFeature"); }
152
157
  }
153
- AttachArcGISFeatureMapLayerByUrlTool.toolId = "AttachArcGISFeatureMapLayerTool";
154
158
  /** This tool attaches an ArcGIS map layer from a given URL.
155
159
  * @beta
156
160
  */
157
161
  export class AttachOgcApiFeaturesMapLayerTool extends AttachMapLayerByURLBaseTool {
162
+ static toolId = "AttachOgcApiFeaturesMapLayerTool";
158
163
  constructor() { super("OgcApiFeatures"); }
159
164
  }
160
- AttachOgcApiFeaturesMapLayerTool.toolId = "AttachOgcApiFeaturesMapLayerTool";
161
165
  /** This tool attaches a map layer from a given tile URL.
162
166
  * @beta
163
167
  */
164
168
  export class AttachTileURLMapLayerByUrlTool extends AttachMapLayerByURLBaseTool {
169
+ static toolId = "AttachTileURLMapLayerTool";
165
170
  constructor() { super("TileURL"); }
166
171
  }
167
- AttachTileURLMapLayerByUrlTool.toolId = "AttachTileURLMapLayerTool";
168
172
  /** This tool add a Map Layer from a specified name (look up in MapLayerSources.json).
169
173
  * @beta
170
174
  */
171
175
  export class AttachMapLayerTool extends AttachMapLayerBaseTool {
176
+ static toolId = "AttachMapLayerTool";
172
177
  static get minArgs() { return 1; }
173
178
  static get maxArgs() { return 1; }
174
179
  /** This method runs the tool, adding a map layer from a specified name in MayLayerSources.json.
@@ -194,31 +199,31 @@ export class AttachMapLayerTool extends AttachMapLayerBaseTool {
194
199
  return this.run(args[0]);
195
200
  }
196
201
  }
197
- AttachMapLayerTool.toolId = "AttachMapLayerTool";
198
202
  /** This tool attaches a Overlay map layer.
199
203
  * @beta
200
204
  */
201
205
  export class AttachMapOverlayTool extends AttachMapLayerTool {
206
+ static toolId = "AttachMapOverlayTool";
202
207
  constructor() {
203
208
  super();
204
209
  this._isBackground = false;
205
210
  }
206
211
  }
207
- AttachMapOverlayTool.toolId = "AttachMapOverlayTool";
208
212
  /** Sets map layer base tool.
209
213
  * @beta
210
214
  */
211
215
  export class SetMapBaseTool extends AttachMapLayerTool {
216
+ static toolId = "SetMapBaseTool";
212
217
  constructor() {
213
218
  super();
214
219
  this._isBase = true;
215
220
  }
216
221
  }
217
- SetMapBaseTool.toolId = "SetMapBaseTool";
218
222
  /** Detach Map Layers Tool.
219
223
  * @beta
220
224
  */
221
225
  export class DetachMapLayersTool extends Tool {
226
+ static toolId = "DetachMapLayersTool";
222
227
  static get minArgs() { return 0; }
223
228
  static get maxArgs() { return 0; }
224
229
  async parseAndRun(..._args) {
@@ -234,7 +239,6 @@ export class DetachMapLayersTool extends Tool {
234
239
  return true;
235
240
  }
236
241
  }
237
- DetachMapLayersTool.toolId = "DetachMapLayersTool";
238
242
  function parseLayerIndex(args) {
239
243
  const layerIndex = args.length > 1 ? parseInt(args[1], 10) : 0;
240
244
  return isNaN(layerIndex) ? 0 : layerIndex;
@@ -243,6 +247,7 @@ function parseLayerIndex(args) {
243
247
  * @beta
244
248
  */
245
249
  export class MapLayerVisibilityTool extends Tool {
250
+ static toolId = "SetMapLayerVisibility";
246
251
  static get minArgs() { return 1; }
247
252
  static get maxArgs() { return 2; }
248
253
  /** This method runs the tool, setting the visibility of a map layer.
@@ -272,11 +277,11 @@ export class MapLayerVisibilityTool extends Tool {
272
277
  return true;
273
278
  }
274
279
  }
275
- MapLayerVisibilityTool.toolId = "SetMapLayerVisibility";
276
280
  /** This tool reorders map layers.
277
281
  * @beta
278
282
  */
279
283
  export class ReorderMapLayers extends Tool {
284
+ static toolId = "ReorderMapLayers";
280
285
  static get minArgs() { return 0; }
281
286
  static get maxArgs() { return 2; }
282
287
  /** This method runs the tool, reordering the map layers.
@@ -301,11 +306,11 @@ export class ReorderMapLayers extends Tool {
301
306
  return true;
302
307
  }
303
308
  }
304
- ReorderMapLayers.toolId = "ReorderMapLayers";
305
309
  /** This tool sets the transparency of a map layer.
306
310
  * @beta
307
311
  */
308
312
  export class MapLayerTransparencyTool extends Tool {
313
+ static toolId = "SetMapLayerTransparency";
309
314
  static get minArgs() { return 1; }
310
315
  static get maxArgs() { return 2; }
311
316
  /** This method runs the tool, setting the transparency of a map layer.
@@ -331,11 +336,11 @@ export class MapLayerTransparencyTool extends Tool {
331
336
  return true;
332
337
  }
333
338
  }
334
- MapLayerTransparencyTool.toolId = "SetMapLayerTransparency";
335
339
  /** This tool sets the visibility of the map sublayer.
336
340
  * @beta
337
341
  */
338
342
  export class MapLayerSubLayerVisibilityTool extends Tool {
343
+ static toolId = "SetMapSubLayerVisibility";
339
344
  static get minArgs() { return 1; }
340
345
  static get maxArgs() { return 2; }
341
346
  /** This method runs the tool, setting the visibility of a map sublayer.
@@ -360,11 +365,11 @@ export class MapLayerSubLayerVisibilityTool extends Tool {
360
365
  return true;
361
366
  }
362
367
  }
363
- MapLayerSubLayerVisibilityTool.toolId = "SetMapSubLayerVisibility";
364
368
  /** This tool changes the viewport so it is zoomed to the range of a map layer.
365
369
  * @beta
366
370
  */
367
371
  export class MapLayerZoomTool extends Tool {
372
+ static toolId = "MapLayerZoom";
368
373
  static get minArgs() { return 0; }
369
374
  static get maxArgs() { return 1; }
370
375
  /** This method runs the tool, changing the viewport so it is zoomed to the range of a map layer.
@@ -386,11 +391,11 @@ export class MapLayerZoomTool extends Tool {
386
391
  return true;
387
392
  }
388
393
  }
389
- MapLayerZoomTool.toolId = "MapLayerZoom";
390
394
  /** This tool toggles whether to apply terrain heights to the map.
391
395
  * @beta
392
396
  */
393
397
  export class ToggleTerrainTool extends Tool {
398
+ static toolId = "ToggleTerrain";
394
399
  static get minArgs() { return 0; }
395
400
  static get maxArgs() { return 1; }
396
401
  /** This method runs the tool, changing whether to apply terrain heights to the map.
@@ -415,11 +420,11 @@ export class ToggleTerrainTool extends Tool {
415
420
  return true;
416
421
  }
417
422
  }
418
- ToggleTerrainTool.toolId = "ToggleTerrain";
419
423
  /** This tool changes the color of the base map.
420
424
  * @beta
421
425
  */
422
426
  export class MapBaseColorTool extends Tool {
427
+ static toolId = "SetMapBaseColorTool";
423
428
  static get minArgs() { return 3; }
424
429
  static get maxArgs() { return 3; }
425
430
  /** This method runs the tool, changing the color of the base map.
@@ -443,11 +448,11 @@ export class MapBaseColorTool extends Tool {
443
448
  return (isNaN(red) || red < 0 || red > 255 || isNaN(green) || green < 0 || green > 255 || isNaN(blue) || blue < 0 || blue > 255) ? false : this.run(ColorDef.from(red, green, blue));
444
449
  }
445
450
  }
446
- MapBaseColorTool.toolId = "SetMapBaseColorTool";
447
451
  /** This tool changes the transparency of the base map.
448
452
  * @beta
449
453
  */
450
454
  export class MapBaseTransparencyTool extends Tool {
455
+ static toolId = "SetMapBaseTransparencyTool";
451
456
  static get minArgs() { return 1; }
452
457
  static get maxArgs() { return 1; }
453
458
  /** This method runs the tool, changing the transparency of the base map.
@@ -469,11 +474,11 @@ export class MapBaseTransparencyTool extends Tool {
469
474
  return (isNaN(transparency) || transparency < 0 || transparency > 1) ? false : this.run(transparency);
470
475
  }
471
476
  }
472
- MapBaseTransparencyTool.toolId = "SetMapBaseTransparencyTool";
473
477
  /** This tool changes the visibility of the base map.
474
478
  * @beta
475
479
  */
476
480
  export class MapBaseVisibilityTool extends Tool {
481
+ static toolId = "SetMapBaseVisibilityTool";
477
482
  static get minArgs() { return 1; }
478
483
  static get maxArgs() { return 1; }
479
484
  /** This method runs the tool, changing the visibility of the base map.
@@ -495,5 +500,4 @@ export class MapBaseVisibilityTool extends Tool {
495
500
  return (visible !== undefined ? this.run(visible) : false);
496
501
  }
497
502
  }
498
- MapBaseVisibilityTool.toolId = "SetMapBaseVisibilityTool";
499
503
  //# sourceMappingURL=MapLayerTool.js.map