@arcgis/core 5.2.0-next.73 → 5.2.0-next.75

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 (339) hide show
  1. package/analysis/ViewshedAnalysis.js +1 -1
  2. package/arcgisGlobal.d.ts +1 -0
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/0502641d9a214b37ff29.js +1 -0
  5. package/assets/esri/core/workers/chunks/{d3be4d914fc99a1d686c.js → 075e65cc4275ac886f08.js} +1 -1
  6. package/assets/esri/core/workers/chunks/087bd698b80ca0cea71e.js +1 -0
  7. package/assets/esri/core/workers/chunks/{b6c7b7b7f87dce5de811.js → 0bf644f93c180a2bc2f8.js} +1 -1
  8. package/assets/esri/core/workers/chunks/0d3b2d9a19383bb63f0a.js +1 -0
  9. package/assets/esri/core/workers/chunks/0d9fe49812554e7d7ba7.js +1 -0
  10. package/assets/esri/core/workers/chunks/0daaa89de339e8ea4b81.js +1 -0
  11. package/assets/esri/core/workers/chunks/{1ca04ecf010e68863014.js → 0eb35e09765fd74eb698.js} +1 -1
  12. package/assets/esri/core/workers/chunks/12234a63d3fa4bc25e7e.js +1 -0
  13. package/assets/esri/core/workers/chunks/18e0e993c0c39c962e61.js +1 -0
  14. package/assets/esri/core/workers/chunks/1c49c9472167a2e0c923.js +1 -0
  15. package/assets/esri/core/workers/chunks/{cf360767310fb45660a8.js → 1cf8fb704c48ac3d3b15.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{2e44978ee677aa23163d.js → 2435ef7d11f8dbb920b7.js} +1 -1
  17. package/assets/esri/core/workers/chunks/2501d9459f6d14c797e5.js +1 -0
  18. package/assets/esri/core/workers/chunks/2740f755c3a322cbd477.js +1 -0
  19. package/assets/esri/core/workers/chunks/27f574acf52f2c8bc2c9.js +1 -0
  20. package/assets/esri/core/workers/chunks/28f87daaba1ae3441364.js +1 -0
  21. package/assets/esri/core/workers/chunks/2b93888e61ca638490cf.js +1 -0
  22. package/assets/esri/core/workers/chunks/2c31648a4b95275516ee.js +1 -0
  23. package/assets/esri/core/workers/chunks/2f4ed8a63d57636a4ebe.js +1 -0
  24. package/assets/esri/core/workers/chunks/2f81047790c4890ae625.js +1 -0
  25. package/assets/esri/core/workers/chunks/305eea9c1fc4aee3309e.js +1 -0
  26. package/assets/esri/core/workers/chunks/30818b5ff0ce51b25d6f.js +1 -0
  27. package/assets/esri/core/workers/chunks/3235e14fedb19dd94807.js +1 -0
  28. package/assets/esri/core/workers/chunks/36ec5b84e551ab08b24a.js +1 -0
  29. package/assets/esri/core/workers/chunks/3c28e2040cb4fb716eaa.js +1 -0
  30. package/assets/esri/core/workers/chunks/3c32471785bc8570e41c.js +1 -0
  31. package/assets/esri/core/workers/chunks/4046bd65d7d0677f4600.js +1 -0
  32. package/assets/esri/core/workers/chunks/4295822fa6ef743c76f1.js +1 -0
  33. package/assets/esri/core/workers/chunks/{35fd2f765d2cb3f59a22.js → 42d5ed44111bea77ec71.js} +115 -115
  34. package/assets/esri/core/workers/chunks/43713bc6f7eea07259d0.js +1 -0
  35. package/assets/esri/core/workers/chunks/{36171c72a3c04b0d13ef.js → 43a65cab888d43954564.js} +1 -1
  36. package/assets/esri/core/workers/chunks/44a786aba84918f2b247.js +1 -0
  37. package/assets/esri/core/workers/chunks/46873badbd6ce8ff4e1e.js +1 -0
  38. package/assets/esri/core/workers/chunks/495f90fe3d0ad32bb82d.js +1 -0
  39. package/assets/esri/core/workers/chunks/4b5bd0c9a55ea2998601.js +1 -0
  40. package/assets/esri/core/workers/chunks/4d7a3b3aaf876da0891b.js +1 -0
  41. package/assets/esri/core/workers/chunks/4fe2cca405180af23364.js +1 -0
  42. package/assets/esri/core/workers/chunks/50b08415e072a49bc572.js +1 -0
  43. package/assets/esri/core/workers/chunks/519af918050b47f93516.js +1 -0
  44. package/assets/esri/core/workers/chunks/{bd311c85437743cf7d2f.js → 53d165b4f30fd64e5d8a.js} +1 -1
  45. package/assets/esri/core/workers/chunks/552d6aecc7d88d16227b.js +1 -0
  46. package/assets/esri/core/workers/chunks/5627f562dea8bae2f346.js +1 -0
  47. package/assets/esri/core/workers/chunks/5ba3a30b7cbfa9e3aa62.js +1 -0
  48. package/assets/esri/core/workers/chunks/5e1d84e97de0e662aaa9.js +1 -0
  49. package/assets/esri/core/workers/chunks/64a1ffc221e5b63b43fb.js +1 -0
  50. package/assets/esri/core/workers/chunks/{31669511cfddf116d991.js → 66e60351aacbd162775f.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{c203df41f9d2e4b80889.js → 6743d726e45e7b660505.js} +1 -1
  52. package/assets/esri/core/workers/chunks/69b0dcd7bcd8ec42e2c3.js +1 -0
  53. package/assets/esri/core/workers/chunks/6b783f440c4a5d36e879.js +1 -0
  54. package/assets/esri/core/workers/chunks/6dddd3df31961b9fda12.js +1 -0
  55. package/assets/esri/core/workers/chunks/6fc3553c52af6ace926d.js +1 -0
  56. package/assets/esri/core/workers/chunks/702b2381acf4d1f90094.js +1 -0
  57. package/assets/esri/core/workers/chunks/762be5d3e6aeaea33f74.js +29 -0
  58. package/assets/esri/core/workers/chunks/792303e4090c0c70c4ff.js +1 -0
  59. package/assets/esri/core/workers/chunks/7a24cc0f3b4eff2bdb8e.js +1 -0
  60. package/assets/esri/core/workers/chunks/7aaa051b51a8e34bbfb0.js +1 -0
  61. package/assets/esri/core/workers/chunks/7dc5aedc964eacd1be5a.js +1 -0
  62. package/assets/esri/core/workers/chunks/81130dbcb738d40f723b.js +1 -0
  63. package/assets/esri/core/workers/chunks/835af7b4fd92cb4e7af0.js +1 -0
  64. package/assets/esri/core/workers/chunks/841c81c280114412c95b.js +1 -0
  65. package/assets/esri/core/workers/chunks/{96d861265566854760cd.js → 88fd698b940dadcc6dc5.js} +1 -1
  66. package/assets/esri/core/workers/chunks/8a36b999cbd65dd2f16c.js +1 -0
  67. package/assets/esri/core/workers/chunks/8ae3a6ddc87bf8315583.js +1 -0
  68. package/assets/esri/core/workers/chunks/8f0d4aec8bd3cbfefc40.js +1 -0
  69. package/assets/esri/core/workers/chunks/{7f208ef75ef2ce0d7cf9.js → 910c93bbbf8113a4a51f.js} +1 -1
  70. package/assets/esri/core/workers/chunks/92c4464b67fce6cea134.js +1 -0
  71. package/assets/esri/core/workers/chunks/{509cfac9e5d86a8ee449.js → 936d44c7bc3a181e64a3.js} +1 -1
  72. package/assets/esri/core/workers/chunks/947f1ea4dbc3e3419ecc.js +1 -0
  73. package/assets/esri/core/workers/chunks/9b76c8974424a1908e86.js +1 -0
  74. package/assets/esri/core/workers/chunks/9cff18e6f751d1b3085e.js +1 -0
  75. package/assets/esri/core/workers/chunks/a101152066dd56259619.js +1 -0
  76. package/assets/esri/core/workers/chunks/a2a2c7e274fb32fecffa.js +1 -0
  77. package/assets/esri/core/workers/chunks/a50421fe79f264ae3619.js +1 -0
  78. package/assets/esri/core/workers/chunks/a6a2a4a2bae0d327d7ed.js +1 -0
  79. package/assets/esri/core/workers/chunks/a7a7d3289d4ca95f545f.js +1 -0
  80. package/assets/esri/core/workers/chunks/abb6c76d5dba3559a68e.js +1 -0
  81. package/assets/esri/core/workers/chunks/aca5c524bd3c955e9243.js +1 -0
  82. package/assets/esri/core/workers/chunks/b14961a9f1f40028f141.js +1 -0
  83. package/assets/esri/core/workers/chunks/b1a175b3b2d1a7ddde8e.js +1 -0
  84. package/assets/esri/core/workers/chunks/b6cd165d0e58598f28a5.js +1 -0
  85. package/assets/esri/core/workers/chunks/b78f509fd8e95f728178.js +1 -0
  86. package/assets/esri/core/workers/chunks/b9c61b20bbc91cb63036.js +1 -0
  87. package/assets/esri/core/workers/chunks/b9d1bb106737a05290e1.js +1 -0
  88. package/assets/esri/core/workers/chunks/{faa55265020591fd2224.js → bc0395777c5c1adb1ddb.js} +1 -1
  89. package/assets/esri/core/workers/chunks/bf3dc3ad8df8488da3f0.js +1 -0
  90. package/assets/esri/core/workers/chunks/c1568bcd3f04014152e1.js +1 -0
  91. package/assets/esri/core/workers/chunks/c374e5d5980db74c4aca.js +1 -0
  92. package/assets/esri/core/workers/chunks/{b9953277d0cd4a01bdc6.js → c37b28f200b704ae6002.js} +1 -1
  93. package/assets/esri/core/workers/chunks/c67e4a848d41038367b8.js +1 -0
  94. package/assets/esri/core/workers/chunks/cff6390b863361eaeeed.js +1 -0
  95. package/assets/esri/core/workers/chunks/d1c7c877edc6948f3801.js +1 -0
  96. package/assets/esri/core/workers/chunks/d2172583ee6e481a66aa.js +1 -0
  97. package/assets/esri/core/workers/chunks/d633e98b0dfa0490e4de.js +1 -0
  98. package/assets/esri/core/workers/chunks/d8eca13c127b443141b7.js +1 -0
  99. package/assets/esri/core/workers/chunks/ddd8f6154e265dbb6f9f.js +1 -0
  100. package/assets/esri/core/workers/chunks/de5013f89f0eae93978f.js +1 -0
  101. package/assets/esri/core/workers/chunks/de601f0d5a2a282d2efd.js +1 -0
  102. package/assets/esri/core/workers/chunks/e557043f90c051e93925.js +1 -0
  103. package/assets/esri/core/workers/chunks/e59101f1d060d0a30a65.js +1 -0
  104. package/assets/esri/core/workers/chunks/{bee5e738ecf8680909c4.js → eaf26c1cc938789d5336.js} +1 -1
  105. package/assets/esri/core/workers/chunks/eb1a86159dbc098f06fe.js +1 -0
  106. package/assets/esri/core/workers/chunks/ee9eb381e675d2d01260.js +1 -0
  107. package/assets/esri/core/workers/chunks/{014f9fd2818e2c9d9a3b.js → f43a0edf58941e2ac78e.js} +1 -1
  108. package/assets/esri/core/workers/chunks/f4bc563c71c478d3912f.js +1 -0
  109. package/assets/esri/core/workers/chunks/{4abd54518e35050feb90.js → f78acff510ca615d42e4.js} +1 -1
  110. package/assets/esri/core/workers/chunks/{01c92e68fb17cf2d0e08.js → f7a5c4d22a24e1ac433c.js} +1 -1
  111. package/assets/esri/core/workers/chunks/fb0b89bbb4f8607d5f20.js +1 -0
  112. package/assets/esri/core/workers/chunks/ff890167ff2baabfc4ce.js +1 -0
  113. package/chunks/GaussianSplat.glsl.js +8 -8
  114. package/chunks/GaussianSplatShadow.glsl.js +4 -5
  115. package/chunks/OccludedGeometryDepth.glsl.js +5 -0
  116. package/chunks/ShadowCastVisualize.glsl.js +2 -2
  117. package/config.js +1 -1
  118. package/core/importUtils.js +2 -0
  119. package/geometry/operators/importUtils.js +2 -0
  120. package/geometry/support/curves/densifyCurvedGeometry.js +1 -1
  121. package/geometry/support/normalizeUtils.d.ts +17 -15
  122. package/geometry/support/normalizeUtils.js +1 -1
  123. package/kernel.js +1 -1
  124. package/layers/DimensionFeatureLayer.d.ts +22 -0
  125. package/layers/DimensionFeatureLayer.js +1 -1
  126. package/layers/FeatureLayer.d.ts +1 -1
  127. package/layers/graphics/data/QueryEngine.js +1 -1
  128. package/layers/graphics/data/queryUtils.js +1 -1
  129. package/layers/graphics/hydratedFeatures.js +1 -1
  130. package/layers/save/featureLayerUtils.js +1 -1
  131. package/layers/support/layerUtils.js +1 -1
  132. package/layers/support/layersMapping.js +1 -1
  133. package/package.json +1 -1
  134. package/portal/schemas/definitions.js +1 -1
  135. package/rest/geoprocessor/utils.js +1 -1
  136. package/rest/identify.js +1 -1
  137. package/rest/imageService.js +1 -1
  138. package/rest/query/operations/query.js +1 -1
  139. package/rest/query/operations/queryAttributeBins.js +1 -1
  140. package/rest/query/operations/queryPivot.js +1 -1
  141. package/rest/query/operations/queryTopFeatures.js +1 -1
  142. package/support/revision.js +1 -1
  143. package/symbols/cim/CIMEffects.js +1 -1
  144. package/symbols/cim/utils.js +1 -1
  145. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  146. package/views/2d/interactive/editingTools/draw/DrawGraphicTool2D.js +1 -1
  147. package/views/2d/layers/support/RouteLayerInteraction.js +1 -1
  148. package/views/2d/viewpointUtils.js +1 -1
  149. package/views/3d/analysis/LineOfSight/LineOfSightReshapeTool3D.js +1 -1
  150. package/views/3d/analysis/LineOfSight/lineOfSightPlacementUtils.js +1 -1
  151. package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
  152. package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
  153. package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
  154. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  155. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementShiftTool.js +1 -1
  156. package/views/3d/environment/EnvironmentManager.js +1 -1
  157. package/views/3d/interactive/Manipulator3D.js +1 -1
  158. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  159. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  160. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  161. package/views/3d/interactive/editingTools/reshape/ReshapeTool3D.js +1 -1
  162. package/views/3d/interactive/editingTools/reshape/reshapeTooltipUtils3D.js +1 -1
  163. package/views/3d/interactive/editingTools/tooltipUtils3D.js +1 -1
  164. package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
  165. package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
  166. package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
  167. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentMove.js +1 -1
  168. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentRotate.js +1 -1
  169. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
  170. package/views/3d/interactive/manipulatorUtils.js +1 -1
  171. package/views/3d/interactive/visualElements/VerticesVisualElement.js +1 -1
  172. package/views/3d/layers/graphics/tessellationUtils.js +1 -1
  173. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  174. package/views/3d/layers/support/MediaLayerInteraction.js +1 -1
  175. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  176. package/views/3d/support/hitTest.js +1 -1
  177. package/views/3d/support/renderInfoUtils/polygon.js +1 -1
  178. package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatCovariance.glsl.js +8 -3
  179. package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatEvaluation.glsl.js +8 -2
  180. package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowAccumulator.js +2 -0
  181. package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastAccumulate.glsl.js +2 -0
  182. package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastAccumulateTechnique.js +2 -0
  183. package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastAccumulateTechniqueConfiguration.js +2 -0
  184. package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastClear.glsl.js +2 -0
  185. package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastClearTechnique.js +2 -0
  186. package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastMaskTechnique.js +2 -0
  187. package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastRenderer.js +2 -0
  188. package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastVisualize.glsl.js +2 -0
  189. package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastVisualizeTechnique.js +2 -0
  190. package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastVisualizeTechniqueConfiguration.js +2 -0
  191. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  192. package/views/3d/webgl-engine/lib/CutFillVisualization.js +1 -1
  193. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  194. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  195. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  196. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  197. package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
  198. package/views/3d/webgl-engine/shaders/GaussianSplatPass.glsl.js +28 -21
  199. package/views/3d/webgl-engine/shaders/OccludedGeometryDepth.glsl.js +2 -0
  200. package/views/3d/webgl-engine/shaders/OccludedGeometryDepthTechnique.js +2 -0
  201. package/views/draw/DrawGraphicTool.js +1 -1
  202. package/views/draw/DrawTool.js +1 -1
  203. package/views/draw/plugins/PolylinePlugin.js +1 -1
  204. package/views/draw/support/Box.js +1 -1
  205. package/views/draw/support/InteractiveHandle.js +1 -1
  206. package/views/draw/support/Reshape.js +1 -1
  207. package/views/draw/support/drawToolUtils.js +1 -1
  208. package/views/draw/support/managers/InteractiveHandleManager.js +1 -1
  209. package/views/draw/support/managers/TooltipManager.js +1 -1
  210. package/views/draw/support/reshapeTooltipUtils.js +1 -1
  211. package/views/draw/support/tooltipUtils.js +1 -1
  212. package/views/interactive/options/InteractiveToolOptions.d.ts +36 -0
  213. package/views/interactive/options/InteractiveToolOptions.js +2 -0
  214. package/views/interactive/sketch/SketchOptions.d.ts +4 -3
  215. package/views/interactive/sketch/SketchOptions.js +1 -1
  216. package/views/interactive/tooltip/components/DrawHeaderActions.js +1 -1
  217. package/views/interactive/tooltip/content/TooltipContent.js +1 -1
  218. package/views/interactive/tooltip/content/TooltipContentDrawPolygon.js +1 -1
  219. package/views/interactive/tooltip/content/TooltipContentDrawPolyline.js +1 -1
  220. package/views/interactive/tooltip/content/TooltipContentDynamic.js +1 -1
  221. package/views/interactive/tooltip/fields/fields.js +1 -1
  222. package/views/interactive/tooltip/infos/DynamicTooltipInfo.js +1 -1
  223. package/views/interactive/tooltip/infos/SketchTooltipInfo.js +1 -1
  224. package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
  225. package/views/selection/SelectionOperation.js +1 -1
  226. package/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel.js +1 -1
  227. package/widgets/Sketch/SketchViewModel.js +1 -1
  228. package/widgets/support/GridControls/GridControlsViewModel.js +1 -1
  229. package/widgets/support/SelectionList/GroupLayerItem.d.ts +8 -1
  230. package/widgets/support/SelectionList/GroupLayerItem.js +1 -1
  231. package/widgets/support/SelectionList/LayerItem.d.ts +8 -1
  232. package/widgets/support/SelectionList/LayerItem.js +1 -1
  233. package/widgets/support/SelectionList/SelectionListViewModel.d.ts +29 -1
  234. package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
  235. package/widgets/support/SelectionList.js +1 -1
  236. package/widgets/support/SelectionToolbar.js +1 -1
  237. package/assets/esri/core/workers/chunks/00cbff0b785e24e87d97.js +0 -1
  238. package/assets/esri/core/workers/chunks/0623acb2bd14a61b65c9.js +0 -29
  239. package/assets/esri/core/workers/chunks/06c9aac75a01d3af6d54.js +0 -1
  240. package/assets/esri/core/workers/chunks/089f8c60e96d920a2cb2.js +0 -1
  241. package/assets/esri/core/workers/chunks/0c3c311400ee352187ea.js +0 -1
  242. package/assets/esri/core/workers/chunks/0dbf31a663b5220a3136.js +0 -1
  243. package/assets/esri/core/workers/chunks/0df660dfd941cff3ea1d.js +0 -1
  244. package/assets/esri/core/workers/chunks/1418c03c4ab87f7ab5f4.js +0 -1
  245. package/assets/esri/core/workers/chunks/158d2ac0333d53556e33.js +0 -1
  246. package/assets/esri/core/workers/chunks/160b204cbf5bda2a29e9.js +0 -1
  247. package/assets/esri/core/workers/chunks/16cade1c2ddf44e336ee.js +0 -1
  248. package/assets/esri/core/workers/chunks/1b130af7d14eaae69d96.js +0 -1
  249. package/assets/esri/core/workers/chunks/1cc063aa2ddf44bbd515.js +0 -1
  250. package/assets/esri/core/workers/chunks/1e0140556c2e3fa72545.js +0 -1
  251. package/assets/esri/core/workers/chunks/1e5cb72830c7f32f2961.js +0 -1
  252. package/assets/esri/core/workers/chunks/259bdacfb7b0f866a8d0.js +0 -1
  253. package/assets/esri/core/workers/chunks/2a2ed7bd44010f24c2dd.js +0 -1
  254. package/assets/esri/core/workers/chunks/2bdb9b5365869081c936.js +0 -1
  255. package/assets/esri/core/workers/chunks/2f58e1f64df2da8259a2.js +0 -1
  256. package/assets/esri/core/workers/chunks/383304d33b496c5d8baa.js +0 -1
  257. package/assets/esri/core/workers/chunks/3aacb935d632834d4154.js +0 -1
  258. package/assets/esri/core/workers/chunks/3c8e98cf23ad8ef12fcb.js +0 -1
  259. package/assets/esri/core/workers/chunks/3d6b2d5ae647e140abaf.js +0 -1
  260. package/assets/esri/core/workers/chunks/3dc71e03a630dd50b28e.js +0 -1
  261. package/assets/esri/core/workers/chunks/3fd022df127af32782ce.js +0 -1
  262. package/assets/esri/core/workers/chunks/4344ab1250a1c550bf8b.js +0 -1
  263. package/assets/esri/core/workers/chunks/43de723f765ec8f268ac.js +0 -1
  264. package/assets/esri/core/workers/chunks/44b50d4716a2567ab6f1.js +0 -1
  265. package/assets/esri/core/workers/chunks/44e8cd4b3dad777ab0c9.js +0 -1
  266. package/assets/esri/core/workers/chunks/4695cd6120f60b234d5c.js +0 -1
  267. package/assets/esri/core/workers/chunks/4cf2b0558a4acc141429.js +0 -1
  268. package/assets/esri/core/workers/chunks/4e129b9f5772a06e580c.js +0 -1
  269. package/assets/esri/core/workers/chunks/5441f96cdd0660229efe.js +0 -1
  270. package/assets/esri/core/workers/chunks/56bbde1dff96b423fbb9.js +0 -1
  271. package/assets/esri/core/workers/chunks/582a1d468089b9986416.js +0 -1
  272. package/assets/esri/core/workers/chunks/5f201c77a09ae0df29d6.js +0 -1
  273. package/assets/esri/core/workers/chunks/6080e46fc79127500283.js +0 -1
  274. package/assets/esri/core/workers/chunks/613e799377bdb767c955.js +0 -1
  275. package/assets/esri/core/workers/chunks/623d5518bca227f643bd.js +0 -1
  276. package/assets/esri/core/workers/chunks/62811bca7ad2100c023c.js +0 -1
  277. package/assets/esri/core/workers/chunks/64176f7ae719289a2f79.js +0 -1
  278. package/assets/esri/core/workers/chunks/67d3ff7fcefaa7d5d27f.js +0 -1
  279. package/assets/esri/core/workers/chunks/6a9002fcba11e2cf3f2e.js +0 -1
  280. package/assets/esri/core/workers/chunks/72dcd4bd1a28bf8605c5.js +0 -1
  281. package/assets/esri/core/workers/chunks/73f228d966b89c73c9e9.js +0 -1
  282. package/assets/esri/core/workers/chunks/73f77f5a6907cb8d9a35.js +0 -1
  283. package/assets/esri/core/workers/chunks/77df0bb35d2688729479.js +0 -1
  284. package/assets/esri/core/workers/chunks/7a143ca61c0a70306185.js +0 -1
  285. package/assets/esri/core/workers/chunks/7e373d9c98ce910db9d2.js +0 -1
  286. package/assets/esri/core/workers/chunks/869d292a60747c93dc84.js +0 -1
  287. package/assets/esri/core/workers/chunks/86a4057572755b403548.js +0 -1
  288. package/assets/esri/core/workers/chunks/8c76f31a363dd0c3354d.js +0 -1
  289. package/assets/esri/core/workers/chunks/98e6c1d035755a074d24.js +0 -1
  290. package/assets/esri/core/workers/chunks/9c57161ad48d8d546dc7.js +0 -1
  291. package/assets/esri/core/workers/chunks/a27cdf4c29dd50a6dab1.js +0 -1
  292. package/assets/esri/core/workers/chunks/a294dd12b5c708ce04af.js +0 -1
  293. package/assets/esri/core/workers/chunks/a7f42ada0aa69873a938.js +0 -1
  294. package/assets/esri/core/workers/chunks/a988fd54912969b812ce.js +0 -1
  295. package/assets/esri/core/workers/chunks/aff0e7761276036e029d.js +0 -1
  296. package/assets/esri/core/workers/chunks/b33d870cbfa238762c5e.js +0 -1
  297. package/assets/esri/core/workers/chunks/b599b7dadce8b8bc88f6.js +0 -1
  298. package/assets/esri/core/workers/chunks/b7d8817018b3d277c454.js +0 -1
  299. package/assets/esri/core/workers/chunks/b984b808d383974ca3d8.js +0 -1
  300. package/assets/esri/core/workers/chunks/ba4f419f46be09a9a55c.js +0 -1
  301. package/assets/esri/core/workers/chunks/bfb6566c27c09deb0929.js +0 -1
  302. package/assets/esri/core/workers/chunks/c25dc9073e73d6b44d88.js +0 -1
  303. package/assets/esri/core/workers/chunks/c45a5bcf26659daf02a1.js +0 -1
  304. package/assets/esri/core/workers/chunks/c715c585c42d8c2b86f5.js +0 -1
  305. package/assets/esri/core/workers/chunks/c7e9513f75b8ec205562.js +0 -1
  306. package/assets/esri/core/workers/chunks/c838cc1c786368b78598.js +0 -1
  307. package/assets/esri/core/workers/chunks/c866b66ba72d96453899.js +0 -1
  308. package/assets/esri/core/workers/chunks/c873383e7dae35dc1a61.js +0 -1
  309. package/assets/esri/core/workers/chunks/cd4e5c948d1bfa9b9a2d.js +0 -1
  310. package/assets/esri/core/workers/chunks/cfe31b7d1c6c05fbd268.js +0 -1
  311. package/assets/esri/core/workers/chunks/d08f81d545930a79fb2e.js +0 -1
  312. package/assets/esri/core/workers/chunks/d0c1bc90e474f706211c.js +0 -1
  313. package/assets/esri/core/workers/chunks/d607cf154218d20e4114.js +0 -1
  314. package/assets/esri/core/workers/chunks/d901f8503a73277cfa58.js +0 -1
  315. package/assets/esri/core/workers/chunks/da484787bd9fd3b13d15.js +0 -1
  316. package/assets/esri/core/workers/chunks/da6134c7883531f21afe.js +0 -1
  317. package/assets/esri/core/workers/chunks/e21b3490bfce75405e55.js +0 -1
  318. package/assets/esri/core/workers/chunks/e4353f0792f45aa6a62f.js +0 -1
  319. package/assets/esri/core/workers/chunks/e4a2eefffe16cd5bb20f.js +0 -1
  320. package/assets/esri/core/workers/chunks/e602b91d8fdc36a92530.js +0 -1
  321. package/assets/esri/core/workers/chunks/e702abaeccef20b64a81.js +0 -1
  322. package/assets/esri/core/workers/chunks/ebd619533be077059494.js +0 -1
  323. package/assets/esri/core/workers/chunks/f475672ff4c2ec9367c2.js +0 -1
  324. package/assets/esri/core/workers/chunks/f69329b85b362b349a8c.js +0 -1
  325. package/assets/esri/core/workers/chunks/f721756a6c1593f96409.js +0 -1
  326. package/assets/esri/core/workers/chunks/fb51f823b25c827c6b29.js +0 -1
  327. package/assets/esri/core/workers/chunks/fba8065a3a6fbd877e23.js +0 -1
  328. package/assets/esri/core/workers/chunks/fec07a16b72cdcafc641.js +0 -1
  329. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +0 -2
  330. package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +0 -2
  331. package/views/3d/webgl-engine/shaders/ShadowCastAccumulate.glsl.js +0 -2
  332. package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechnique.js +0 -2
  333. package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechniqueConfiguration.js +0 -2
  334. package/views/3d/webgl-engine/shaders/ShadowCastClear.glsl.js +0 -2
  335. package/views/3d/webgl-engine/shaders/ShadowCastClearTechnique.js +0 -2
  336. package/views/3d/webgl-engine/shaders/ShadowCastMaskTechnique.js +0 -2
  337. package/views/3d/webgl-engine/shaders/ShadowCastVisualize.glsl.js +0 -2
  338. package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechnique.js +0 -2
  339. package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechniqueConfiguration.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../analysis/Viewshed.js";import o from"../../../../core/Accessor.js";import"../../../../core/has.js";import{createAbortError as i,throwIfAborted as n,onAbort as a}from"../../../../core/promiseUtils.js";import{watch as s,sync as r}from"../../../../core/reactiveUtils.js";import{property as l,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{absoluteHeightElevationInfo as p}from"../../../../support/elevationInfoUtils.js";import{createDrawTool as d,getFeatureReference as _}from"./placementUtils.js";import{detachToolFromView as v}from"./toolLifecycleUtils.js";import m from"./ViewshedPlacementOperation.js";import{createViewshedPlacementRootPluginConfiguration as u}from"./ViewshedPlacementRootPlugin.js";import{computeParametersFromTargetPoint as w}from"./viewshedToolUtils.js";import{vectorToRender as g}from"../../interactive/support/viewUtils.js";import{DrawManipulator3D as P}from"../../../draw/DrawManipulator3D.js";import{ViewEventPriorities as b}from"../../../input/InputManager.js";import{sketchKeys as f}from"../../../interactive/keybindings.js";import S from"../../../interactive/sketch/SketchOptions.js";const y="multiple",O=Symbol("hiddenManipulatorHandle");let T=class extends o{constructor(e){super(e),this.placementMode=y,this.observerPlacementElevationInfo=null,this.stagedViewshed=null,this._placeOperation=null,this._drawTool=null,this._renderer=null,this._sketchOptions=new S({tooltips:{enabled:!1}}),this._observerScenePoint=h(),this._targetScenePoint=h(),this._mapPointVector=h()}initialize(){this.addHandles([this.view.on("key-down",e=>this._handleKeyDown(e),b.DEFAULT),s(()=>{const{stagedViewshed:e}=this;return{stagedViewshed:e,stagedViewshedInAnalysis:null!=e&&this.analysis.viewsheds.includes(e)}},({stagedViewshed:e,stagedViewshedInAnalysis:t})=>{null==e||t||this.analysis.viewsheds.add(e)},r)])}destroy(){this._cancelPlacementOperation()}get updating(){return!!this._drawTool?.updating}get active(){return!!this._drawTool?.active}get creationState(){return this._get("creationState")}set creationState(e){this._set("creationState",e),this._sketchOptions.tooltips.enabled="placing-observer"===e}startPlaceOperation(e,t){this._removeStaged(),this.creationState=null,this._rejectPlaceOperation(i()),n(t);const{resolve:o,reject:s,promise:r}=Promise.withResolvers(),l=a(t,()=>this._cancelPlacementOperation());return this._placeOperation=new m({abortHandle:l,reject:s,resolve:o}),this.placementMode=e,this.observerPlacementElevationInfo=t?.elevationInfo,this.callbacks.setSelectedViewshed(null),this._startObserverPlacement(),r}cancelPlaceOperation(){null==this.creationState&&null==this._placeOperation||(this._cancelPlacementOperation(),this.callbacks.cancelTool())}_handleDeleteDuringCreation(){return null!=this.creationState&&(this._destroyDrawTool(),this._removeStaged(),this.callbacks.setSelectedViewshed(null),this._startObserverPlacement(),!0)}_handleKeyDown(e){null!=this.creationState&&(f.cancel===e.key?(this._handleCancelDuringCreation(),e.stopPropagation(),e.preventDefault()):f.delete.includes(e.key)&&(this._handleDeleteDuringCreation(),e.stopPropagation(),e.preventDefault()))}_handleCancelDuringCreation(){if(this._removeStaged()&&"multiple"===this.placementMode)return this.callbacks.setSelectedViewshed(null),void this._startObserverPlacement();this._destroyDrawTool(),this._abortCreation()}_removeStaged(){const{stagedViewshed:e}=this;return this.stagedViewshed=null,!!e&&(this.analysis.viewsheds.remove(e),!0)}_cancelPlacementOperation(){this._destroyDrawTool(),this._removeStaged(),this.creationState=null,this._finishPlaceOperation()}_abortCreation(){this.callbacks.cancelTool(),this.creationState=null,this._finishPlaceOperation()}_handleObserverPlacementComplete(e,o,i){const n=new t({observer:e,elevationInfo:this.observerPlacementElevationInfo,feature:i});this.analysis.viewsheds.add(n),this.stagedViewshed=n,this.creationState="placing-target",this._updateStagedViewshed(o),this.callbacks.setSelectedViewshed(null)}_onCancel(e){const t=this._removeStaged();return"placing-observer"===this.creationState?t&&"multiple"===this.placementMode?(this.callbacks.setSelectedViewshed(null),void this._startObserverPlacement()):(this._destroyDrawTool(e),void this._abortCreation()):t?(this.creationState="placing-observer",this.callbacks.setSelectedViewshed(null),void("multiple"!==this.placementMode?(this._destroyDrawTool(e),this._abortCreation()):this._startPointPlacement())):(this._destroyDrawTool(e),void this._abortCreation())}_handleTargetPlacementComplete(e){this._updateStagedViewshed(e);const t=this.stagedViewshed;this._placeOperation?.markPlacedViewshed(),this.stagedViewshed=null,this.callbacks.setSelectedViewshed(t)}_resolvePlaceOperation(){this._clearPlaceOperationAndRun(e=>e?.resolve())}_finishPlaceOperation(){this._clearPlaceOperationAndRun(e=>e?.finish())}_rejectPlaceOperation(e){this._clearPlaceOperationAndRun(t=>t?.reject(e))}_clearPlaceOperationAndRun(e){const t=this._placeOperation;this._placeOperation=null,this.observerPlacementElevationInfo=null,e(t)}_startObserverPlacement(){this.creationState="placing-observer",this._startPointPlacement()}_startPointPlacement(){this._drawTool&&this._destroyDrawTool(this._drawTool);const{drawTool:e,intersector:t,renderer:o,snappingManager:i}=d({analysisViewData:this.analysisViewData,snappingManager:this.snappingManager,view:this.view,sketchOptions:this._sketchOptions,elevationInfo:this._observerDrawToolElevationInfo,getSnapToSceneEnabled:()=>this._snapToSceneEnabled,onCancel:e=>this._onCancel(e),onComplete:e=>this._onComplete(e),onManipulatorCountChange:e=>this._onManipulatorCountChange(e),isPlacingObserver:()=>"placing-observer"===this.creationState});this._drawTool=e,this._renderer=o;try{this.view.addAndActivateTool(e),e.begin([u({mode:this.placementMode,onObserverComplete:(e,o)=>this._onObserverMapPointComplete(t,i,e,o),onTargetComplete:e=>this._onTargetMapPointComplete(e),onObserverPreview:e=>this._onObserverMapPointPreview(e),onTargetPreview:e=>this._onTargetMapPointPreview(e)})])}catch(n){this._destroyDrawTool(e),this._rejectPlaceOperation(n instanceof Error?n:new Error(String(n)))}}_onComplete(e){this._removeStaged(),this._resolvePlaceOperation(),this._destroyDrawTool(e),this.creationState=null}_onObserverMapPointComplete(e,t,o,i){const n=o.clone(),a=this._toScenePoint(o,this._targetScenePoint,this._observerDrawToolElevationInfo),s=_({intersector:e,snappingManager:t,screenPoint:i,view:this.view});this._renderer?.updatePlacementLocation(a),this._handleObserverPlacementComplete(n,a,s),this._setDrawToolElevationInfo(p)}_onTargetMapPointComplete(e){const t=this._toScenePoint(e,this._targetScenePoint);this._renderer?.updatePlacementLocation(t),this._handleTargetPlacementComplete(t),"multiple"===this.placementMode&&(this.creationState="placing-observer",this._setDrawToolElevationInfo(this._observerDrawToolElevationInfo),this._onObserverMapPointPreview(e))}_onObserverMapPointPreview(e){const t=e.clone(),o=this._toScenePoint(t,this._observerScenePoint,this._observerDrawToolElevationInfo);this._renderer?.updatePlacementLocation(o)}_onTargetMapPointPreview(e){const t=this._toScenePoint(e,this._targetScenePoint);this._renderer?.updatePlacementLocation(t),this._updateStagedViewshed(t)}_setDrawToolElevationInfo(e){const t=this._drawTool;t&&(t.elevationInfo=e)}get _observerDrawToolElevationInfo(){return this.observerPlacementElevationInfo??p}get _snapToSceneEnabled(){const e=this.observerPlacementElevationInfo?.mode;return("placing-observer"!==this.creationState||null==e||"absolute-height"===e)&&null}_onManipulatorCountChange(e){e.removeHandles(O);const t=[];e.manipulators.forEach(({manipulator:e})=>{e instanceof P&&t.push(e.disableDisplay())}),e.addHandles(t,O)}_destroyDrawTool(e=this._drawTool){this._drawTool=null,this._renderer=null,e&&v(this.view,e)}_toScenePoint(e,t,o=p){const{x:i,y:n,z:a,spatialReference:s}=e,r=this._mapPointVector;return r[0]=i,r[1]=n,r[2]=a??0,g(r,s,o,this.view,t)}_updateStagedViewshed(e){const t=this.stagedViewshed;if(!t)return;const o=this.callbacks.findViewshedComputedData(t);if(!o)return;const{heading:i,tilt:n,farDistance:a}=w(this.view,o,e);t.farDistance=a,t.tilt=n,t.heading=i}get test(){}};e([l({constructOnly:!0})],T.prototype,"analysis",void 0),e([l({constructOnly:!0})],T.prototype,"analysisViewData",void 0),e([l({constructOnly:!0})],T.prototype,"snappingManager",void 0),e([l({constructOnly:!0})],T.prototype,"view",void 0),e([l({constructOnly:!0})],T.prototype,"callbacks",void 0),e([l()],T.prototype,"placementMode",void 0),e([l()],T.prototype,"observerPlacementElevationInfo",void 0),e([l()],T.prototype,"stagedViewshed",void 0),e([l()],T.prototype,"_placeOperation",void 0),e([l()],T.prototype,"_drawTool",void 0),e([l()],T.prototype,"_renderer",void 0),e([l()],T.prototype,"_sketchOptions",void 0),e([l()],T.prototype,"updating",null),e([l()],T.prototype,"active",null),e([l({value:null})],T.prototype,"creationState",null),T=e([c("esri.views.3d.analysis.Viewshed.ViewshedPlacementController")],T);export{T as ViewshedPlacementController};
2
+ import{__decorate as e}from"tslib";import t from"../../../../analysis/Viewshed.js";import o from"../../../../core/Accessor.js";import"../../../../core/has.js";import{createAbortError as i,throwIfAborted as n,onAbort as a}from"../../../../core/promiseUtils.js";import{watch as s,sync as r}from"../../../../core/reactiveUtils.js";import{property as l,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{absoluteHeightElevationInfo as p}from"../../../../support/elevationInfoUtils.js";import{createDrawTool as d,getFeatureReference as _}from"./placementUtils.js";import{detachToolFromView as v}from"./toolLifecycleUtils.js";import m from"./ViewshedPlacementOperation.js";import{createViewshedPlacementRootPluginConfiguration as u}from"./ViewshedPlacementRootPlugin.js";import{computeParametersFromTargetPoint as w}from"./viewshedToolUtils.js";import{vectorToRender as g}from"../../interactive/support/viewUtils.js";import{DrawManipulator3D as P}from"../../../draw/DrawManipulator3D.js";import{ViewEventPriorities as b}from"../../../input/InputManager.js";import{sketchKeys as f}from"../../../interactive/keybindings.js";import S from"../../../interactive/options/InteractiveToolOptions.js";const y="multiple",O=Symbol("hiddenManipulatorHandle");let T=class extends o{constructor(e){super(e),this.placementMode=y,this.observerPlacementElevationInfo=null,this.stagedViewshed=null,this._placeOperation=null,this._drawTool=null,this._renderer=null,this._toolOptions=new S({tooltips:{enabled:!1}}),this._observerScenePoint=h(),this._targetScenePoint=h(),this._mapPointVector=h()}initialize(){this.addHandles([this.view.on("key-down",e=>this._handleKeyDown(e),b.DEFAULT),s(()=>{const{stagedViewshed:e}=this;return{stagedViewshed:e,stagedViewshedInAnalysis:null!=e&&this.analysis.viewsheds.includes(e)}},({stagedViewshed:e,stagedViewshedInAnalysis:t})=>{null==e||t||this.analysis.viewsheds.add(e)},r)])}destroy(){this._cancelPlacementOperation()}get updating(){return!!this._drawTool?.updating}get active(){return!!this._drawTool?.active}get creationState(){return this._get("creationState")}set creationState(e){this._set("creationState",e),this._toolOptions.tooltips.enabled="placing-observer"===e}startPlaceOperation(e,t){this._removeStaged(),this.creationState=null,this._rejectPlaceOperation(i()),n(t);const{resolve:o,reject:s,promise:r}=Promise.withResolvers(),l=a(t,()=>this._cancelPlacementOperation());return this._placeOperation=new m({abortHandle:l,reject:s,resolve:o}),this.placementMode=e,this.observerPlacementElevationInfo=t?.elevationInfo,this.callbacks.setSelectedViewshed(null),this._startObserverPlacement(),r}cancelPlaceOperation(){null==this.creationState&&null==this._placeOperation||(this._cancelPlacementOperation(),this.callbacks.cancelTool())}_handleDeleteDuringCreation(){return null!=this.creationState&&(this._destroyDrawTool(),this._removeStaged(),this.callbacks.setSelectedViewshed(null),this._startObserverPlacement(),!0)}_handleKeyDown(e){null!=this.creationState&&(f.cancel===e.key?(this._handleCancelDuringCreation(),e.stopPropagation(),e.preventDefault()):f.delete.includes(e.key)&&(this._handleDeleteDuringCreation(),e.stopPropagation(),e.preventDefault()))}_handleCancelDuringCreation(){if(this._removeStaged()&&"multiple"===this.placementMode)return this.callbacks.setSelectedViewshed(null),void this._startObserverPlacement();this._destroyDrawTool(),this._abortCreation()}_removeStaged(){const{stagedViewshed:e}=this;return this.stagedViewshed=null,!!e&&(this.analysis.viewsheds.remove(e),!0)}_cancelPlacementOperation(){this._destroyDrawTool(),this._removeStaged(),this.creationState=null,this._finishPlaceOperation()}_abortCreation(){this.callbacks.cancelTool(),this.creationState=null,this._finishPlaceOperation()}_handleObserverPlacementComplete(e,o,i){const n=new t({observer:e,elevationInfo:this.observerPlacementElevationInfo,feature:i});this.analysis.viewsheds.add(n),this.stagedViewshed=n,this.creationState="placing-target",this._updateStagedViewshed(o),this.callbacks.setSelectedViewshed(null)}_onCancel(e){const t=this._removeStaged();return"placing-observer"===this.creationState?t&&"multiple"===this.placementMode?(this.callbacks.setSelectedViewshed(null),void this._startObserverPlacement()):(this._destroyDrawTool(e),void this._abortCreation()):t?(this.creationState="placing-observer",this.callbacks.setSelectedViewshed(null),void("multiple"!==this.placementMode?(this._destroyDrawTool(e),this._abortCreation()):this._startPointPlacement())):(this._destroyDrawTool(e),void this._abortCreation())}_handleTargetPlacementComplete(e){this._updateStagedViewshed(e);const t=this.stagedViewshed;this._placeOperation?.markPlacedViewshed(),this.stagedViewshed=null,this.callbacks.setSelectedViewshed(t)}_resolvePlaceOperation(){this._clearPlaceOperationAndRun(e=>e?.resolve())}_finishPlaceOperation(){this._clearPlaceOperationAndRun(e=>e?.finish())}_rejectPlaceOperation(e){this._clearPlaceOperationAndRun(t=>t?.reject(e))}_clearPlaceOperationAndRun(e){const t=this._placeOperation;this._placeOperation=null,this.observerPlacementElevationInfo=null,e(t)}_startObserverPlacement(){this.creationState="placing-observer",this._startPointPlacement()}_startPointPlacement(){this._drawTool&&this._destroyDrawTool(this._drawTool);const{drawTool:e,intersector:t,renderer:o,snappingManager:i}=d({analysisViewData:this.analysisViewData,snappingManager:this.snappingManager,view:this.view,toolOptions:this._toolOptions,elevationInfo:this._observerDrawToolElevationInfo,getSnapToSceneEnabled:()=>this._snapToSceneEnabled,onCancel:e=>this._onCancel(e),onComplete:e=>this._onComplete(e),onManipulatorCountChange:e=>this._onManipulatorCountChange(e),isPlacingObserver:()=>"placing-observer"===this.creationState});this._drawTool=e,this._renderer=o;try{this.view.addAndActivateTool(e),e.begin([u({mode:this.placementMode,onObserverComplete:(e,o)=>this._onObserverMapPointComplete(t,i,e,o),onTargetComplete:e=>this._onTargetMapPointComplete(e),onObserverPreview:e=>this._onObserverMapPointPreview(e),onTargetPreview:e=>this._onTargetMapPointPreview(e)})])}catch(n){this._destroyDrawTool(e),this._rejectPlaceOperation(n instanceof Error?n:new Error(String(n)))}}_onComplete(e){this._removeStaged(),this._resolvePlaceOperation(),this._destroyDrawTool(e),this.creationState=null}_onObserverMapPointComplete(e,t,o,i){const n=o.clone(),a=this._toScenePoint(o,this._targetScenePoint,this._observerDrawToolElevationInfo),s=_({intersector:e,snappingManager:t,screenPoint:i,view:this.view});this._renderer?.updatePlacementLocation(a),this._handleObserverPlacementComplete(n,a,s),this._setDrawToolElevationInfo(p)}_onTargetMapPointComplete(e){const t=this._toScenePoint(e,this._targetScenePoint);this._renderer?.updatePlacementLocation(t),this._handleTargetPlacementComplete(t),"multiple"===this.placementMode&&(this.creationState="placing-observer",this._setDrawToolElevationInfo(this._observerDrawToolElevationInfo),this._onObserverMapPointPreview(e))}_onObserverMapPointPreview(e){const t=e.clone(),o=this._toScenePoint(t,this._observerScenePoint,this._observerDrawToolElevationInfo);this._renderer?.updatePlacementLocation(o)}_onTargetMapPointPreview(e){const t=this._toScenePoint(e,this._targetScenePoint);this._renderer?.updatePlacementLocation(t),this._updateStagedViewshed(t)}_setDrawToolElevationInfo(e){const t=this._drawTool;t&&(t.elevationInfo=e)}get _observerDrawToolElevationInfo(){return this.observerPlacementElevationInfo??p}get _snapToSceneEnabled(){const e=this.observerPlacementElevationInfo?.mode;return("placing-observer"!==this.creationState||null==e||"absolute-height"===e)&&null}_onManipulatorCountChange(e){e.removeHandles(O);const t=[];e.manipulators.forEach(({manipulator:e})=>{e instanceof P&&t.push(e.disableDisplay())}),e.addHandles(t,O)}_destroyDrawTool(e=this._drawTool){this._drawTool=null,this._renderer=null,e&&v(this.view,e)}_toScenePoint(e,t,o=p){const{x:i,y:n,z:a,spatialReference:s}=e,r=this._mapPointVector;return r[0]=i,r[1]=n,r[2]=a??0,g(r,s,o,this.view,t)}_updateStagedViewshed(e){const t=this.stagedViewshed;if(!t)return;const o=this.callbacks.findViewshedComputedData(t);if(!o)return;const{heading:i,tilt:n,farDistance:a}=w(this.view,o,e);t.farDistance=a,t.tilt=n,t.heading=i}get test(){}};e([l({constructOnly:!0})],T.prototype,"analysis",void 0),e([l({constructOnly:!0})],T.prototype,"analysisViewData",void 0),e([l({constructOnly:!0})],T.prototype,"snappingManager",void 0),e([l({constructOnly:!0})],T.prototype,"view",void 0),e([l({constructOnly:!0})],T.prototype,"callbacks",void 0),e([l()],T.prototype,"placementMode",void 0),e([l()],T.prototype,"observerPlacementElevationInfo",void 0),e([l()],T.prototype,"stagedViewshed",void 0),e([l()],T.prototype,"_placeOperation",void 0),e([l()],T.prototype,"_drawTool",void 0),e([l()],T.prototype,"_renderer",void 0),e([l()],T.prototype,"_toolOptions",void 0),e([l()],T.prototype,"updating",null),e([l()],T.prototype,"active",null),e([l({value:null})],T.prototype,"creationState",null),T=e([c("esri.views.3d.analysis.Viewshed.ViewshedPlacementController")],T);export{T as ViewshedPlacementController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{destroyHandle as e}from"../../../../core/handleUtils.js";import{watch as n,syncAndInitial as r,sync as t,initial as o}from"../../../../core/reactiveUtils.js";import{createScreenPointArray as i}from"../../../../core/screenUtils.js";import{ViewshedDrawToolRenderer as s}from"./ViewshedDrawToolRenderer.js";import{isValidIntersectorResult as a}from"../../webgl-engine/lib/IntersectorResult.js";import{toGraphic as l}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{DrawTool as c}from"../../../draw/DrawTool.js";import{newToolIntersector as d}from"../../../interactive/ToolIntersector.js";function p(i){const{analysisViewData:a,snappingManager:l,view:p,sketchOptions:u,elevationInfo:b,getSnapToSceneEnabled:g,onCancel:m,onComplete:j,onManipulatorCountChange:f,isPlacingObserver:w}=i,v=new s({view:p,isPlacingObserver:w}),I=d(p.state.viewingMode),M=new c({elevationInfo:b,enableVertexVisuals:!1,hasZ:!0,renderer:v,sketchOptions:u,snappingManager:l,view:p});return M.addHandles([e(v),M.on("cancel",()=>m(M)),M.on("complete",()=>j(M)),n(()=>[M.surfaceManager,g()],([e,n])=>{e&&(e.snapToSceneEnabled=n)},r),n(()=>M.manipulators.length,()=>f(M),t),n(()=>a.visible,e=>v.analysisVisible=e,o)]),{drawTool:M,intersector:I,renderer:v,snappingManager:l}}function u({intersector:e,snappingManager:n,screenPoint:r,view:t}){const o=n.getMainFeatureCandidate();return o?g(o):r?b(r,t,e):null}function b(e,n,r){n.sceneIntersectionHelper.intersectToolIntersectorScreen(i(e.x,e.y),r);const t=r.results.min;return a(t)?l(t,n):null}function g(e){const n={id:e.layer.id,objectIdField:"objectIdField"in e.layer?e.layer.objectIdField:void 0};return{attributes:{[n.objectIdField??"ObjectId"]:e.objectId},layer:n,objectId:e.objectId,uid:null}}export{p as createDrawTool,u as getFeatureReference};
2
+ import{destroyHandle as e}from"../../../../core/handleUtils.js";import{watch as n,syncAndInitial as r,sync as o,initial as t}from"../../../../core/reactiveUtils.js";import{createScreenPointArray as i}from"../../../../core/screenUtils.js";import{ViewshedDrawToolRenderer as a}from"./ViewshedDrawToolRenderer.js";import{isValidIntersectorResult as s}from"../../webgl-engine/lib/IntersectorResult.js";import{toGraphic as l}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{DrawTool as c}from"../../../draw/DrawTool.js";import{newToolIntersector as d}from"../../../interactive/ToolIntersector.js";function p(i){const{analysisViewData:s,snappingManager:l,view:p,toolOptions:u,elevationInfo:b,getSnapToSceneEnabled:g,onCancel:m,onComplete:j,onManipulatorCountChange:f,isPlacingObserver:w}=i,v=new a({view:p,isPlacingObserver:w}),I=d(p.state.viewingMode),M=new c({elevationInfo:b,enableVertexVisuals:!1,hasZ:!0,renderer:v,toolOptions:u,snappingManager:l,view:p});return M.addHandles([e(v),M.on("cancel",()=>m(M)),M.on("complete",()=>j(M)),n(()=>[M.surfaceManager,g()],([e,n])=>{e&&(e.snapToSceneEnabled=n)},r),n(()=>M.manipulators.length,()=>f(M),o),n(()=>s.visible,e=>v.analysisVisible=e,t)]),{drawTool:M,intersector:I,renderer:v,snappingManager:l}}function u({intersector:e,snappingManager:n,screenPoint:r,view:o}){const t=n.getMainFeatureCandidate();return t?g(t):r?b(r,o,e):null}function b(e,n,r){n.sceneIntersectionHelper.intersectToolIntersectorScreen(i(e.x,e.y),r);const o=r.results.min;return s(o)?l(o,n):null}function g(e){const n={id:e.layer.id,objectIdField:"objectIdField"in e.layer?e.layer.objectIdField:void 0};return{attributes:{[n.objectIdField??"ObjectId"]:e.objectId},layer:n,objectId:e.objectId,uid:null}}export{p as createDrawTool,u as getFeatureReference};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{getFeatureId as t,updatePointsFromFeatureReference as s}from"../../../analysis/featureReferenceUtils.js";import"../../../core/has.js";import i from"../../../core/Logger.js";import{mapCollection as r}from"../../../core/mapCollectionUtils.js";import{abortMaybe as o,destroyMaybe as a}from"../../../core/maybe.js";import{watch as d,initial as l,when as n,syncAndInitial as h}from"../../../core/reactiveUtils.js";import{property as p,subclass as c}from"../../../core/accessorSupport/decorators.js";import{copy as u,exactEquals as v}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as w}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as m,isLoaded as V}from"../../../geometry/projectionUtils.js";import g from"./AnalysisView3D.js";import{logFailedGeometryProjectionError as _}from"./support/projectionUtils.js";import{registerAnalysisView as y,unselectViewshedInOtherAnalysisViews as f}from"./Viewshed/analysisViewRegister.js";import{ViewshedComputedData as b}from"./Viewshed/ViewshedComputedData.js";import j from"./Viewshed/ViewshedTool.js";import{ViewshedVisualization as R}from"./Viewshed/ViewshedVisualization.js";import{createElevationUpdateHandle as D}from"../support/elevationUpdateUtils.js";import{Intersector as C}from"../webgl-engine/lib/Intersector.js";import{Viewshed as O}from"../webgl-engine/lib/Viewshed.js";let F=class extends g{constructor(e){super(e),this.type="viewshed-view-3d",this.analysis=null,this._tool=null,this._selectedViewshed=null,this.viewshedComputedDataHandles=null,this.userOperation=null,this._viewshedRenderNode=null,this._intersector=null}get visible(){return super.visible}set visible(e){super.visible=e}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get toolActive(){return this._tool?.active??!1}get toolCreating(){return this._tool?.creating??!1}get stagedViewshed(){return this._tool?.stagedViewshed}get selectedViewshed(){return this._selectedViewshed}set selectedViewshed(e){const t=null!=e&&this.analysis.viewsheds.includes(e)?e:null;this._unselectOtherViewsheds(t),this._selectedViewshed=t}get selectedViewshedComputedData(){return this._tool?.selectedViewshedComputedData}get updating(){return!!this._tool?.updating}get _isDecoration(){return!this.parent}initialize(){const e=this.view;this.addHandles(y(e,this)),this._viewshedRenderNode=new O({view:e,selectedViewshed:()=>this.selectedViewshed??this.stagedViewshed,isDecoration:this._isDecoration}),this._intersector=new C(this.view.state.viewingMode),this._intersector.options.hud=!1,this._intersector.options.store=0,this.viewshedComputedDataHandles=r(()=>this.analysis.viewsheds,t=>{const s=new b({view:e,viewshed:t}),r=Symbol();return this.addHandles([d(()=>({valid:s.valid,canProject:m(s.observer?.spatialReference,this.view.spatialReference)||V()}),({valid:e,canProject:t},r)=>{this.visible&&(e&&t?this._addViewshedsToRenderer(s):r?.valid&&r?.canProject&&this._removeViewshedsFromRenderer(s),t||_(this.analysis,s.observer.spatialReference,i.getLogger(this)))},l),D({view:e,geometry:s.observer,onElevationChanges:()=>s.onElevationChange()}),d(()=>[e.state.camera,e.slice.plane,s.elevationAlignedObserverRenderSpace,s.elevationAlignedTargetRenderSpace,s.verticalFieldOfView,s.horizontalFieldOfView,s.feature],()=>{this._updateObserverFromFeature(e,s)},l)],r),{viewshedComputedData:s,remove:()=>{this.selectedViewshed===s.viewshed&&(this.selectedViewshed=null),this.removeHandles(r),this._removeViewshedsFromRenderer(s),s.destroy()}}}),this._visualization=new R({view:e,analysisViewData:this,isDecoration:this._isDecoration}),this._tool=new j({analysis:this.analysis,analysisViewData:this,view:e}),this.addHandles([d(()=>this.visible,e=>{const t=this.viewshedComputedDataHandles;if(null==t)return;e||(this.selectedViewshed=null);const s=t.map(e=>e.viewshedComputedData).filter(e=>e.valid).toArray();e?this._addViewshedsToRenderer(s):this._removeViewshedsFromRenderer(s)}),n(()=>this.interactive,()=>this._unselectOtherViewsheds(this.selectedViewshed),h)])}destroy(){this.userOperation=o(this.userOperation),this._tool=a(this._tool),this._visualization=a(this._visualization);const e=this.viewshedComputedDataHandles;null!=e&&this._removeViewshedsFromRenderer(e.map(e=>e.viewshedComputedData).toArray())}async createViewsheds(e){return this._tool.place("multiple",e)}place(e){return this._tool.place("single",e)}_addViewshedsToRenderer(e){this._viewshedRenderNode.updateViewsheds({adds:e})}_removeViewshedsFromRenderer(e){this._viewshedRenderNode.updateViewsheds({removes:e})}_updateObserverFromFeature(e,i){const r=i.elevationAlignedObserverRenderSpace,o=i.elevationAlignedTargetRenderSpace,a=u(w(),r),d={observer:r,observerSurfaceNormal:null,observerAdjusted:a,observerFeatureId:t(i.feature),target:o,targetSurfaceNormal:null,targetAdjusted:u(w(),o),targetFeatureId:null};s(e,this._intersector,d,e=>Math.min(e,.05*i.farDistanceRenderSpace)),i.observerRenderSpaceOverride=v(a,r)?null:a}_unselectOtherViewsheds(e){null!=e&&f(this.view,this)}get test(){}};e([p({readOnly:!0})],F.prototype,"type",void 0),e([p({constructOnly:!0,nonNullable:!0})],F.prototype,"analysis",void 0),e([p()],F.prototype,"_tool",void 0),e([p()],F.prototype,"toolActive",null),e([p()],F.prototype,"toolCreating",null),e([p()],F.prototype,"stagedViewshed",null),e([p()],F.prototype,"_selectedViewshed",void 0),e([p()],F.prototype,"selectedViewshed",null),e([p()],F.prototype,"selectedViewshedComputedData",null),e([p()],F.prototype,"viewshedComputedDataHandles",void 0),e([p()],F.prototype,"userOperation",void 0),e([p()],F.prototype,"updating",null),e([p()],F.prototype,"_visualization",void 0),e([p()],F.prototype,"_viewshedRenderNode",void 0),F=e([c("esri.views.3d.analysis.ViewshedAnalysisView3D")],F);const A=F;export{A as default};
2
+ import{__decorate as e}from"tslib";import{getFeatureId as t,updatePointsFromFeatureReference as s}from"../../../analysis/featureReferenceUtils.js";import"../../../core/has.js";import i from"../../../core/Logger.js";import{mapCollection as r}from"../../../core/mapCollectionUtils.js";import{abortMaybe as o,destroyMaybe as a}from"../../../core/maybe.js";import{watch as d,initial as l,when as n,syncAndInitial as h}from"../../../core/reactiveUtils.js";import{property as p,subclass as c}from"../../../core/accessorSupport/decorators.js";import{copy as u,exactEquals as v}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as w}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as m,isLoaded as V}from"../../../geometry/projectionUtils.js";import g from"./AnalysisView3D.js";import{logFailedGeometryProjectionError as _}from"./support/projectionUtils.js";import{registerAnalysisView as y,unselectViewshedInOtherAnalysisViews as f}from"./Viewshed/analysisViewRegister.js";import{ViewshedComputedData as b}from"./Viewshed/ViewshedComputedData.js";import j from"./Viewshed/ViewshedTool.js";import{ViewshedVisualization as R}from"./Viewshed/ViewshedVisualization.js";import{createElevationUpdateHandle as D}from"../support/elevationUpdateUtils.js";import{Intersector as C}from"../webgl-engine/lib/Intersector.js";import{Viewshed as O}from"../webgl-engine/lib/Viewshed.js";let F=class extends g{constructor(e){super(e),this.type="viewshed-view-3d",this.analysis=null,this._tool=null,this._selectedViewshed=null,this.viewshedComputedDataHandles=null,this.userOperation=null,this._viewshedRenderNode=null,this._intersector=null}get visible(){return super.visible}set visible(e){super.visible=e}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get toolActive(){return this._tool?.active??!1}get toolCreating(){return this._tool?.creating??!1}get stagedViewshed(){return this._tool?.stagedViewshed}get selectedViewshed(){return this._selectedViewshed}set selectedViewshed(e){const t=null!=e&&this.analysis.viewsheds.includes(e)?e:null;this._unselectOtherViewsheds(t),this._selectedViewshed=t}get selectedViewshedComputedData(){return this._tool?.selectedViewshedComputedData}get updating(){return!!this._tool?.updating}get _isDecoration(){return!this.parent}initialize(){const e=this.view;this.addHandles(y(e,this)),this._viewshedRenderNode=new O({view:e,selectedViewshed:()=>this.selectedViewshed??this.stagedViewshed,isDecoration:this._isDecoration}),this._intersector=new C(this.view.state.viewingMode),this._intersector.options.hud=!1,this._intersector.options.store=0,this.viewshedComputedDataHandles=r(()=>this.analysis.viewsheds,t=>{const s=new b({view:e,viewshed:t}),r=Symbol();return this.addHandles([d(()=>({valid:s.valid,canProject:m(s.observer?.spatialReference,this.view.spatialReference)||V()}),({valid:e,canProject:t},r)=>{this.visible&&(e&&t?this._addViewshedsToRenderer(s):r?.valid&&r?.canProject&&this._removeViewshedsFromRenderer(s),t||_(this.analysis,s.observer.spatialReference,i.getLogger(this)))},l),D({view:e,geometry:s.observer,onElevationChanges:()=>s.onElevationChange()}),d(()=>[e.state.camera,e.slice.plane,s.elevationAlignedObserverRenderSpace,s.elevationAlignedTargetRenderSpace,s.verticalFieldOfView,s.horizontalFieldOfView,s.feature],()=>{this._updateObserverFromFeature(e,s)},l)],r),{viewshedComputedData:s,remove:()=>{this.selectedViewshed===s.viewshed&&(this.selectedViewshed=null),this.removeHandles(r),this._removeViewshedsFromRenderer(s),s.destroy()}}}),this._visualization=new R({view:e,analysisViewData:this,isDecoration:this._isDecoration}),this._tool=new j({analysis:this.analysis,analysisViewData:this,view:e}),this.addHandles([d(()=>this.visible,e=>{const t=this.viewshedComputedDataHandles;if(null==t)return;e||(this.selectedViewshed=null);const s=t.items.values().map(e=>e.viewshedComputedData).filter(e=>e.valid).toArray();e?this._addViewshedsToRenderer(s):this._removeViewshedsFromRenderer(s)}),n(()=>this.interactive,()=>this._unselectOtherViewsheds(this.selectedViewshed),h)])}destroy(){this.userOperation=o(this.userOperation),this._tool=a(this._tool),this._visualization=a(this._visualization);const e=this.viewshedComputedDataHandles;null!=e&&this._removeViewshedsFromRenderer(e.items.map(e=>e.viewshedComputedData))}async createViewsheds(e){return this._tool.place("multiple",e)}place(e){return this._tool.place("single",e)}_addViewshedsToRenderer(e){this._viewshedRenderNode.updateViewsheds({adds:e})}_removeViewshedsFromRenderer(e){this._viewshedRenderNode.updateViewsheds({removes:e})}_updateObserverFromFeature(e,i){const r=i.elevationAlignedObserverRenderSpace,o=i.elevationAlignedTargetRenderSpace,a=u(w(),r),d={observer:r,observerSurfaceNormal:null,observerAdjusted:a,observerFeatureId:t(i.feature),target:o,targetSurfaceNormal:null,targetAdjusted:u(w(),o),targetFeatureId:null};s(e,this._intersector,d,e=>Math.min(e,.05*i.farDistanceRenderSpace)),i.observerRenderSpaceOverride=v(a,r)?null:a}_unselectOtherViewsheds(e){null!=e&&f(this.view,this)}get test(){}};e([p({readOnly:!0})],F.prototype,"type",void 0),e([p({constructOnly:!0,nonNullable:!0})],F.prototype,"analysis",void 0),e([p()],F.prototype,"_tool",void 0),e([p()],F.prototype,"toolActive",null),e([p()],F.prototype,"toolCreating",null),e([p()],F.prototype,"stagedViewshed",null),e([p()],F.prototype,"_selectedViewshed",void 0),e([p()],F.prototype,"selectedViewshed",null),e([p()],F.prototype,"selectedViewshedComputedData",null),e([p()],F.prototype,"viewshedComputedDataHandles",void 0),e([p()],F.prototype,"userOperation",void 0),e([p()],F.prototype,"updating",null),e([p()],F.prototype,"_visualization",void 0),e([p()],F.prototype,"_viewshedRenderNode",void 0),F=e([c("esri.views.3d.analysis.ViewshedAnalysisView3D")],F);const A=F;export{A as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{deg2rad as i}from"../../../../core/mathUtils.js";import{valueInUnit as o}from"../../../../core/quantity.js";import{watch as e,sync as s,syncAndInitial as n}from"../../../../core/reactiveUtils.js";import{verticalLengthUnitFromSpatialReference as a,convertUnit as r}from"../../../../core/units.js";import{property as l,subclass as p}from"../../../../core/accessorSupport/decorators.js";import{rotateZ as h}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{subtract as u,lerp as c}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as d,fromArray as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as f}from"../../../../core/support/UpdatingHandles.js";import{sv3d as v,sm4d as _}from"../../../../geometry/support/vectorStacks.js";import{IsShiftEdgeOnScreenFlag as y}from"../Slice/sliceToolUtils.js";import{calculateTranslateRotateFromBases as g}from"../../interactive/manipulatorUtils.js";import{screenToZConstrained as w}from"../../interactive/editingTools/dragEventPipeline3D.js";import{ShiftManipulator as T}from"../../interactive/manipulators/ShiftManipulator.js";import{createManipulatorDragEventPipeline as M,addMapTranslation as U}from"../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as j}from"../../../interactive/InteractiveToolBase.js";import O from"../../../interactive/sketch/SketchOptions.js";import k from"../../../interactive/support/Units.js";import{makeTooltip as E,enterInputModeIfAvailable as V}from"../../../interactive/tooltip/tooltipCommonUtils.js";import{ElevationTooltipInfo as I}from"../../../interactive/tooltip/infos/ElevationTooltipInfo.js";import{elevationFromZ as S}from"../../../support/euclideanLengthMeasurementUtils.js";let b=class extends j{constructor(t){super(t),this.multiTouchEnabled=!1,this._updatingHandles=new f,this.sketchOptions=new O}initialize(){const{view:t}=this;this._shiftManipulator=new T(t,0,8),this._shiftManipulator.state|=y,this.manipulators.add(this._shiftManipulator),this.addHandles([this._createDragPipeline(),e(()=>this.analysisViewData.targetGeometry,()=>this._updateManipulatorPosition(),s),e(()=>this._showManipulator,t=>this._updateManipulatorVisibility(t),n)]),this._initializeTooltip(),this.finishToolCreation()}_initializeTooltip(){const{view:t}=this;this.tooltip=E(()=>({view:t,options:this.sketchOptions.tooltips})),this._tooltipInfo=new I({sketchOptions:this.sketchOptions}),this.sketchOptions.tooltips.placement="trailing",this._updateSketchOptions(),this.addHandles([this._updatingHandles.add(()=>this.analysisViewData.effectiveTargetElevation,()=>this._updateTooltip()),this._updatingHandles.add(()=>this._shouldShowTooltip,t=>{t?this._showTooltip():this._hideTooltip()}),this.tooltip.on("commit",()=>{const t=this._tooltipInfo.elevation.actual,i=a(this.view.spatialReference);if(null==t||null==i)return;const e=o(t,i);this._updateValue(e,{recordUndo:this.analysis.cutFillOptions.targetElevation})}),e(()=>[this.analysis.displayUnits.elevation,this.analysis.inputUnits.elevation],()=>this._updateSketchOptions(),n)])}destroy(){this._shiftManipulator.destroy(),this.tooltip.destroy(),this._updatingHandles.destroy()}get updating(){return this._updatingHandles.updating}onInputEvent(t){if(!this.destroyed&&!V(t,this.tooltip))return super.onInputEvent(t)}onHide(){this._hideTooltip()}onEditableChange(){this.internallyEditable||this._hideTooltip()}get _shouldShowTooltip(){return this._showManipulator&&(this.hasFocusedManipulators||"input"===this.tooltip.mode)}get _showManipulator(){const{interactive:t,targetGeometry:i,visible:o}=this.analysisViewData,{measureType:e}=this.analysis;return o&&t&&null!=i&&"cut-fill"===e}_createDragPipeline(){return M(this._shiftManipulator,(t,i,o)=>{const e=d(t.renderLocation),s=this.analysis.inputUnits.elevation??"meters",n=a(this.view.spatialReference);let l;i.next(w(this.view,e,this.view.spatialReference)).next(U()).next(t=>{if("start"===t.action){const{targetElevation:t}=this.analysis.cutFillOptions;l=t&&n?r(t,s,n):void 0}return this._updateValue(null!=l?l+t.translationZ:t.mapEnd.z,"end"===t.action?{recordUndo:l}:void 0),t}),o.next(()=>{this._updateValue(l)})})}_updateManipulatorPosition(){const{targetGeometry:t}=this.analysisViewData,{renderCoordsHelper:o}=this.view;if(!t)return;const e=.5,s=t.rings[0],n=m(s[0]),a=m(s[1]);o.toRenderCoords(n,t.spatialReference,n),o.toRenderCoords(a,t.spatialReference,a);const r=v.get();u(r,a,n);const l=v.get();c(l,n,a,e);const p=o.worldBasisAtPosition(l,1,v.get()),f=o.worldBasisAtPosition(l,0,v.get()),y=g(p,f,l,_.get()),w=o.headingAtPosition(l,r),T=t.isClockwise(t.rings[0])?-Math.PI/2:Math.PI/2;h(y,y,i(w)+T),y[12]=0,y[13]=0,y[14]=0,this._shiftManipulator.renderLocation=d(l),this._shiftManipulator.modelTransform=y}_updateManipulatorVisibility(t){this._shiftManipulator.available=t}_updateValue(t,i){const o=S(t,this.view.spatialReference);if(null==o)return;const e=this.analysis.inputUnits.elevation??"meters",s=r(o.value,o.unit,e),n=t=>{this.analysis.cutFillOptions.targetElevation=t};if(n(s),i&&"recordUndo"in i){const t=i.recordUndo;this.emit("record-undo",{apply:()=>n(s),undo:()=>n(t)})}}_getUpdatedTooltipInfo(){const{effectiveTargetElevation:t}=this.analysisViewData;return t?(this._tooltipInfo.elevation.actual=S(t,this.view.spatialReference),this._tooltipInfo):this._tooltipInfo}_updateTooltip(){this._shouldShowTooltip&&(this.tooltip.info=this._getUpdatedTooltipInfo())}_showTooltip(){this._updateTooltip()}_hideTooltip(){this.tooltip?.clear(),this.tooltip?.exitInputMode({focusOnView:!1})}_updateSketchOptions(){const{analysis:t}=this,{displayUnits:i,inputUnits:o}=t;this.sketchOptions.values.inputUnits=new k({verticalLength:o.elevation}),this.sketchOptions.values.displayUnits=new k({verticalLength:i.elevation})}};t([l()],b.prototype,"multiTouchEnabled",void 0),t([l()],b.prototype,"updating",null),t([l({constructOnly:!0})],b.prototype,"analysis",void 0),t([l({constructOnly:!0})],b.prototype,"view",void 0),t([l({constructOnly:!0})],b.prototype,"analysisViewData",void 0),t([l({constructOnly:!0,type:O})],b.prototype,"sketchOptions",void 0),t([l()],b.prototype,"_shouldShowTooltip",null),t([l()],b.prototype,"_showManipulator",null),b=t([p("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementShiftTool")],b);export{b as VolumeMeasurementShiftTool};
2
+ import{__decorate as t}from"tslib";import{deg2rad as i}from"../../../../core/mathUtils.js";import{valueInUnit as o}from"../../../../core/quantity.js";import{watch as e,sync as s,syncAndInitial as n}from"../../../../core/reactiveUtils.js";import{verticalLengthUnitFromSpatialReference as a,convertUnit as l}from"../../../../core/units.js";import{property as r,subclass as p}from"../../../../core/accessorSupport/decorators.js";import{rotateZ as h}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{subtract as u,lerp as d}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as c,fromArray as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as f}from"../../../../core/support/UpdatingHandles.js";import{sv3d as v,sm4d as _}from"../../../../geometry/support/vectorStacks.js";import{IsShiftEdgeOnScreenFlag as y}from"../Slice/sliceToolUtils.js";import{calculateTranslateRotateFromBases as g}from"../../interactive/manipulatorUtils.js";import{screenToZConstrained as w}from"../../interactive/editingTools/dragEventPipeline3D.js";import{ShiftManipulator as T}from"../../interactive/manipulators/ShiftManipulator.js";import{createManipulatorDragEventPipeline as M,addMapTranslation as U}from"../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as j}from"../../../interactive/InteractiveToolBase.js";import O from"../../../interactive/options/InteractiveToolOptions.js";import E from"../../../interactive/support/Units.js";import{makeTooltip as I,enterInputModeIfAvailable as V}from"../../../interactive/tooltip/tooltipCommonUtils.js";import{ElevationTooltipInfo as b}from"../../../interactive/tooltip/infos/ElevationTooltipInfo.js";import{elevationFromZ as P}from"../../../support/euclideanLengthMeasurementUtils.js";let x=class extends j{constructor(t){super(t),this.multiTouchEnabled=!1,this._updatingHandles=new f,this.toolOptions=new O}initialize(){const{view:t}=this;this._shiftManipulator=new T(t,0,8),this._shiftManipulator.state|=y,this.manipulators.add(this._shiftManipulator),this.addHandles([this._createDragPipeline(),e(()=>this.analysisViewData.targetGeometry,()=>this._updateManipulatorPosition(),s),e(()=>this._showManipulator,t=>this._updateManipulatorVisibility(t),n)]),this._initializeTooltip(),this.finishToolCreation()}_initializeTooltip(){const{view:t}=this;this.tooltip=I(()=>({view:t,options:this.toolOptions.tooltips})),this._tooltipInfo=new b({toolOptions:this.toolOptions}),this.toolOptions.tooltips.placement="trailing",this._updateToolOptions(),this.addHandles([this._updatingHandles.add(()=>this.analysisViewData.effectiveTargetElevation,()=>this._updateTooltip()),this._updatingHandles.add(()=>this._shouldShowTooltip,t=>{t?this._showTooltip():this._hideTooltip()}),this.tooltip.on("commit",()=>{const t=this._tooltipInfo.elevation.actual,i=a(this.view.spatialReference);if(null==t||null==i)return;const e=o(t,i);this._updateValue(e,{recordUndo:this.analysis.cutFillOptions.targetElevation})}),e(()=>[this.analysis.displayUnits.elevation,this.analysis.inputUnits.elevation],()=>this._updateToolOptions(),n)])}destroy(){this._shiftManipulator.destroy(),this.tooltip.destroy(),this._updatingHandles.destroy()}get updating(){return this._updatingHandles.updating}onInputEvent(t){if(!this.destroyed&&!V(t,this.tooltip))return super.onInputEvent(t)}onHide(){this._hideTooltip()}onEditableChange(){this.internallyEditable||this._hideTooltip()}get _shouldShowTooltip(){return this._showManipulator&&(this.hasFocusedManipulators||"input"===this.tooltip.mode)}get _showManipulator(){const{interactive:t,targetGeometry:i,visible:o}=this.analysisViewData,{measureType:e}=this.analysis;return o&&t&&null!=i&&"cut-fill"===e}_createDragPipeline(){return M(this._shiftManipulator,(t,i,o)=>{const e=c(t.renderLocation),s=this.analysis.inputUnits.elevation??"meters",n=a(this.view.spatialReference);let r;i.next(w(this.view,e,this.view.spatialReference)).next(U()).next(t=>{if("start"===t.action){const{targetElevation:t}=this.analysis.cutFillOptions;r=t&&n?l(t,s,n):void 0}return this._updateValue(null!=r?r+t.translationZ:t.mapEnd.z,"end"===t.action?{recordUndo:r}:void 0),t}),o.next(()=>{this._updateValue(r)})})}_updateManipulatorPosition(){const{targetGeometry:t}=this.analysisViewData,{renderCoordsHelper:o}=this.view;if(!t)return;const e=.5,s=t.rings[0],n=m(s[0]),a=m(s[1]);o.toRenderCoords(n,t.spatialReference,n),o.toRenderCoords(a,t.spatialReference,a);const l=v.get();u(l,a,n);const r=v.get();d(r,n,a,e);const p=o.worldBasisAtPosition(r,1,v.get()),f=o.worldBasisAtPosition(r,0,v.get()),y=g(p,f,r,_.get()),w=o.headingAtPosition(r,l),T=t.isClockwise(t.rings[0])?-Math.PI/2:Math.PI/2;h(y,y,i(w)+T),y[12]=0,y[13]=0,y[14]=0,this._shiftManipulator.renderLocation=c(r),this._shiftManipulator.modelTransform=y}_updateManipulatorVisibility(t){this._shiftManipulator.available=t}_updateValue(t,i){const o=P(t,this.view.spatialReference);if(null==o)return;const e=this.analysis.inputUnits.elevation??"meters",s=l(o.value,o.unit,e),n=t=>{this.analysis.cutFillOptions.targetElevation=t};if(n(s),i&&"recordUndo"in i){const t=i.recordUndo;this.emit("record-undo",{apply:()=>n(s),undo:()=>n(t)})}}_getUpdatedTooltipInfo(){const{effectiveTargetElevation:t}=this.analysisViewData;return t?(this._tooltipInfo.elevation.actual=P(t,this.view.spatialReference),this._tooltipInfo):this._tooltipInfo}_updateTooltip(){this._shouldShowTooltip&&(this.tooltip.info=this._getUpdatedTooltipInfo())}_showTooltip(){this._updateTooltip()}_hideTooltip(){this.tooltip?.clear(),this.tooltip?.exitInputMode({focusOnView:!1})}_updateToolOptions(){const{analysis:t}=this,{displayUnits:i,inputUnits:o}=t;this.toolOptions.values.inputUnits=new E({verticalLength:o.elevation}),this.toolOptions.values.displayUnits=new E({verticalLength:i.elevation})}};t([r()],x.prototype,"multiTouchEnabled",void 0),t([r()],x.prototype,"updating",null),t([r({constructOnly:!0})],x.prototype,"analysis",void 0),t([r({constructOnly:!0})],x.prototype,"view",void 0),t([r({constructOnly:!0})],x.prototype,"analysisViewData",void 0),t([r({constructOnly:!0,type:O})],x.prototype,"toolOptions",void 0),t([r()],x.prototype,"_shouldShowTooltip",null),t([r()],x.prototype,"_showManipulator",null),x=t([p("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementShiftTool")],x);export{x as VolumeMeasurementShiftTool};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../core/Evented.js";import"../../../core/has.js";import{watch as i,sync as n,syncAndInitial as r,when as o}from"../../../core/reactiveUtils.js";import{property as s,subclass as a}from"../../../core/accessorSupport/decorators.js";import{length as h,equals as l,copy as c,scale as g,lerp as d}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as p,create as m,fromValues as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isEarth as v,getReferenceEllipsoid as _}from"../../../geometry/ellipsoidUtils.js";import{isLoadedOrLoadFor as f}from"../../../geometry/projectionUtils.js";import w from"../../../geometry/SpatialReference.js";import{projectPointToVector as y}from"../../../geometry/projection/projectPointToVector.js";import{getGCSForPlanet as b}from"../../../geometry/support/planetGCSUtils.js";import{heightLimit as P}from"./weather.js";import{positionToTimezoneInfo as T}from"../support/earthUtils.js";import{ColorAndIntensity as L,computeColorAndIntensity as j,computeVirtualLightDirection as E}from"../support/sunUtils.js";import{MainLight as U,AmbientLight as G,FillLight as H}from"../webgl-engine/lighting/Lightsources.js";let S=class extends t{constructor(e){super(e),this.view=null,this._tmpLightParameters=new L,this._defaultLightParameters=new L,this._tmpDate=new Date,this._tmpTz={hours:0,minutes:0,seconds:0},this._viewHandlesKey="viewHandles",this._trackingEnabled=!1,this._mainLight=new U,this._ambientLight=new G,this._moonLight=new H,this._disableWeather=!1,this._resetReferencePosition()}destroy(){this.disconnectView()}get updating(){return!this._canProjectCameraPosition}get weatherEnabled(){return null!=this.view&&null!=this.view.stage&&null!=this.view.stage.renderer&&null!=this.view.stage.renderer.weatherFader&&this.view.environment.atmosphereEnabled&&!this._disableWeather&&1===this.view.state?.viewingMode&&v(this.view.spatialReference)}get _weatherAvailable(){return null!=this.view&&this.weatherEnabled&&h(this.view.state.camera.eye)-_(this.view.spatialReference).radius<=P}get referencePositionGeographic(){return this._referencePositionGeographic}get _canProjectCameraPosition(){const e=this.view?.stateManager?.camera?.position?.spatialReference??w.WGS84,t=b(e);return f(e,t)}connectView(e){this.view=e;const t=()=>e.stage.renderer.modifyShadowsEnabled(),s=()=>this._cameraHandler();this.addHandles([i(()=>e.environment.lighting,e=>this._updateLightingHandler(e),n),i(()=>"virtual"!==e.environment.lighting.type?e.environment.lighting.date:null,e=>this._lightingDateHandler(e),n),i(()=>e.environment.lighting.directShadowsEnabled,t,n),i(()=>e.spatialReference,()=>this._resetReferencePosition(!0),n),i(()=>[e.environment.weather.type,this.weatherEnabled],()=>this._updateLighting(null,1),n),i(()=>e.environment,e=>e.setComputeWeatherAvailable(()=>this._weatherAvailable),r),i(()=>e.viewingMode,()=>this._resetReferencePosition(!0),r),i(()=>"virtual"!==e.environment.lighting.type&&e.environment.lighting.cameraTrackingEnabled,e=>this._updateCameraTracking(e),r),i(()=>e.state.camera,s,r),o(()=>this._canProjectCameraPosition,()=>this._resetReferencePosition(!0),n)],this._viewHandlesKey),this.view.stage.renderer.modifyShadowsEnabled(),this._updateLighting(),this._cameraHandler(),this.notifyChange("updating")}disconnectView(){this.removeHandles(this._viewHandlesKey),this._resetReferencePosition()}_updateLightingHandler(e){this._updateCameraTracking("virtual"!==e.type&&e.cameraTrackingEnabled),this._lightingDateHandler("virtual"!==e.type?e.date:null),this.view?.stage.renderer.modifyShadowsEnabled()}_updateCameraTracking(e){if(this._trackingEnabled=e,e)this._cameraHandler();else{if(!this.view)return;const e=this.view.environment.lighting;"virtual"!==e?.type&&(e.positionTimezoneInfo.autoUpdated=!1)}}_lightingDateHandler(e){if(!this.view)return;const t=this.view.environment.lighting;if("virtual"!==t?.type){if(e){if(!t.positionTimezoneInfo.autoUpdated&&(this._preupdateTracking(e),null!=this._referencePositionGeographic)){const e=T(this._referencePositionGeographic,this._tmpTz);null!=e&&(t.autoUpdate(null,e),this._trackingEnabled&&(t.positionTimezoneInfo.autoUpdated=!0))}this._updateLighting(e)}}else this._updateLighting()}_preupdateTracking(e){this.view&&!this._trackingEnabled&&"virtual"!==this.view.environment.lighting.type&&this.view.environment.lighting.cameraTrackingEnabled&&this._cameraHandler(e)}_cameraHandler(e=null){const t=this.view;if(!t||!t.ready)return;const i=t.stateManager.camera;if(!i)return;const n=i.position,r=n.spatialReference??w.WGS84,o=b(r);if(!y(n,R,o,z)){if(null==this._referencePositionGeographic)return;return this._referencePositionGeographic=null,void this._updateLighting()}this._referencePositionGeographic?l(this._referencePositionGeographic,R)||(c(this._referencePositionGeographic,R),this.notifyChange("referencePositionGeographic")):this._referencePositionGeographic=p(R),this._autoUpdateTimezone(this._referencePositionGeographic,e)||this._updateLighting(e)}_updateLighting(e,t=0){const i=this.view;if(!i)return;const{lighting:n}=i.environment,r="virtual"===n.type,o=this._referencePositionGeographic,s=null!=o?this._tmpLightParameters:this._defaultLightParameters;if(o){e??=r?null:n.date;const t=this._weatherAvailable?i.environment.weather.type:"disabled";j(e,o,i.state.viewingMode,t,i.state.camera,s)}else r&&E(i.state.camera,i.state.viewingMode,s.direct.directionToLightSource);const a=this._mainLight,h=s.direct;g(a.intensity,h.color,h.intensity*Math.PI),c(a.direction,h.directionToLightSource),a.specularStrength=s.specularStrength,a.environmentStrength=s.environmentStrength;const l=this._ambientLight;g(l.intensity,s.ambient.color,s.ambient.intensity);const p=this._moonLight;d(p.intensity,C,k,s.globalFactor);const m=(1-.5*s.globalFactor)*(1-.4*s.noonFactor*(1-s.globalFactor));g(p.intensity,p.intensity,m),c(p.direction,h.directionToLightSource),i.stage.renderer.updateLighting([a,l,p],s.noonFactor,s.globalFactor,this._weatherAvailable?t:0),i.stage.renderer.modifyShadowsEnabled()}_autoUpdateTimezone(e,t=null){if(!this.view||"virtual"===this.view.environment.lighting.type||!this.view.environment.lighting.cameraTrackingEnabled||null==e)return!1;const i=this._tmpDate;i.setTime((t||this.view.environment.lighting.date).getTime());const n=T(e,this._tmpTz);if(null==n)return!1;let r=this.view.environment.lighting.positionTimezoneInfo;if(r.autoUpdated){if(r.hours===n.hours&&r.minutes===n.minutes&&r.seconds===n.seconds)return!1}else r=n;const o=i.getUTCHours()-(n.hours-r.hours),s=i.getUTCMinutes()-(n.minutes-r.minutes),a=i.getUTCSeconds()-(n.seconds-r.seconds);return i.setUTCHours(o),i.setUTCMinutes(s),i.setUTCSeconds(a),!t&&this.view.environment.lighting.autoUpdate(i,n)}_resetReferencePosition(e=!1){this._referencePositionGeographic=null,e&&this._cameraHandler()}get test(){}};e([s()],S.prototype,"view",void 0),e([s({type:Boolean,readOnly:!0})],S.prototype,"updating",null),e([s()],S.prototype,"_disableWeather",void 0),e([s()],S.prototype,"weatherEnabled",null),e([s()],S.prototype,"_weatherAvailable",null),e([s()],S.prototype,"referencePositionGeographic",null),e([s()],S.prototype,"_referencePositionGeographic",void 0),e([s()],S.prototype,"_canProjectCameraPosition",null),S=e([a("esri.views.3d.environment.EnvironmentManager")],S);const C=u(.22,.22,.33),k=u(.22,.22,.22),R=m(),z={zConversionDisabled:!0};export{S as EnvironmentManager};
2
+ import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../core/Evented.js";import"../../../core/has.js";import{watch as i,sync as n,syncAndInitial as r,when as o}from"../../../core/reactiveUtils.js";import{property as s,subclass as a}from"../../../core/accessorSupport/decorators.js";import{length as h,equals as l,copy as c,scale as g,lerp as d}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as p,create as m,fromValues as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isEarth as v,getReferenceEllipsoid as _}from"../../../geometry/ellipsoidUtils.js";import{isLoadedOrLoadFor as f}from"../../../geometry/projectionUtils.js";import w from"../../../geometry/SpatialReference.js";import{projectPointToVector as y}from"../../../geometry/projection/projectPointToVector.js";import{getGCSForPlanet as b}from"../../../geometry/support/planetGCSUtils.js";import{heightLimit as P}from"./weather.js";import{positionToTimezoneInfo as T}from"../support/earthUtils.js";import{ColorAndIntensity as L,computeShadowsEnabled as j,computeColorAndIntensity as S,computeVirtualLightDirection as G}from"../support/sunUtils.js";import{MainLight as U,AmbientLight as H,FillLight as C}from"../webgl-engine/lighting/Lightsources.js";let E=class extends t{constructor(e){super(e),this.view=null,this._tmpLightParameters=new L,this._defaultLightParameters=new L,this._tmpDate=new Date,this._tmpTz={hours:0,minutes:0,seconds:0},this._viewHandlesKey="viewHandles",this._trackingEnabled=!1,this._mainLight=new U,this._ambientLight=new H,this._moonLight=new C,this._disableWeather=!1,this.shadowsAvailable=!1,this._resetReferencePosition()}destroy(){this.disconnectView()}get updating(){return!this._canProjectCameraPosition}get weatherEnabled(){return null!=this.view&&null!=this.view.stage&&null!=this.view.stage.renderer&&null!=this.view.stage.renderer.weatherFader&&this.view.environment.atmosphereEnabled&&!this._disableWeather&&1===this.view.state.viewingMode&&v(this.view.spatialReference)}get _weatherAvailable(){return null!=this.view&&this.weatherEnabled&&h(this.view.state.camera.eye)-_(this.view.spatialReference).radius<=P}_modifyShadowsAvailable(){if(null==this.view)return;const e=this.referencePositionGeographic,t=null==e||j(e[2],this.view.state.viewingMode);this.shadowsAvailable=this.view.environment.lighting.directShadowsEnabled&&t}get referencePositionGeographic(){return this._referencePositionGeographic}get _canProjectCameraPosition(){const e=this.view?.stateManager?.camera?.position?.spatialReference??w.WGS84,t=b(e);return f(e,t)}connectView(e){this.view=e;const t=()=>this._modifyShadowsAvailable(),s=()=>this._cameraHandler();this.addHandles([i(()=>e.environment.lighting,e=>this._updateLightingHandler(e),n),i(()=>"virtual"!==e.environment.lighting.type?e.environment.lighting.date:null,e=>this._lightingDateHandler(e),n),i(()=>e.environment.lighting.directShadowsEnabled,t,n),i(()=>e.spatialReference,()=>this._resetReferencePosition(!0),n),i(()=>[e.environment.weather.type,this.weatherEnabled],()=>this._updateLighting(null,1),n),i(()=>e.environment,e=>e.setComputeWeatherAvailable(()=>this._weatherAvailable),r),i(()=>e.viewingMode,()=>this._resetReferencePosition(!0),r),i(()=>"virtual"!==e.environment.lighting.type&&e.environment.lighting.cameraTrackingEnabled,e=>this._updateCameraTracking(e),r),i(()=>e.state.camera,s,r),o(()=>this._canProjectCameraPosition,()=>this._resetReferencePosition(!0),n)],this._viewHandlesKey),this._modifyShadowsAvailable(),this._updateLighting(),this._cameraHandler(),this.notifyChange("updating")}disconnectView(){this.removeHandles(this._viewHandlesKey),this._resetReferencePosition()}_updateLightingHandler(e){this._updateCameraTracking("virtual"!==e.type&&e.cameraTrackingEnabled),this._lightingDateHandler("virtual"!==e.type?e.date:null),this._modifyShadowsAvailable()}_updateCameraTracking(e){if(this._trackingEnabled=e,e)this._cameraHandler();else{if(!this.view)return;const e=this.view.environment.lighting;"virtual"!==e?.type&&(e.positionTimezoneInfo.autoUpdated=!1)}}_lightingDateHandler(e){if(!this.view)return;const t=this.view.environment.lighting;if("virtual"!==t?.type){if(e){if(!t.positionTimezoneInfo.autoUpdated&&(this._preupdateTracking(e),null!=this._referencePositionGeographic)){const e=T(this._referencePositionGeographic,this._tmpTz);null!=e&&(t.autoUpdate(null,e),this._trackingEnabled&&(t.positionTimezoneInfo.autoUpdated=!0))}this._updateLighting(e)}}else this._updateLighting()}_preupdateTracking(e){this.view&&!this._trackingEnabled&&"virtual"!==this.view.environment.lighting.type&&this.view.environment.lighting.cameraTrackingEnabled&&this._cameraHandler(e)}_cameraHandler(e=null){const t=this.view;if(!t||!t.ready)return;const i=t.stateManager.camera;if(!i)return;const n=i.position,r=n.spatialReference??w.WGS84,o=b(r);if(!y(n,R,o,M)){if(null==this._referencePositionGeographic)return;return this._referencePositionGeographic=null,void this._updateLighting()}this._referencePositionGeographic?l(this._referencePositionGeographic,R)||(c(this._referencePositionGeographic,R),this.notifyChange("referencePositionGeographic")):this._referencePositionGeographic=p(R),this._autoUpdateTimezone(this._referencePositionGeographic,e)||this._updateLighting(e)}_updateLighting(e,t=0){const i=this.view;if(!i)return;const{lighting:n}=i.environment,r="virtual"===n.type,o=this._referencePositionGeographic,s=null!=o?this._tmpLightParameters:this._defaultLightParameters;if(o){e??=r?null:n.date;const t=this._weatherAvailable?i.environment.weather.type:"disabled";S(e,o,i.state.viewingMode,t,i.state.camera,s)}else r&&G(i.state.camera,i.state.viewingMode,s.direct.directionToLightSource);const a=this._mainLight,h=s.direct;g(a.intensity,h.color,h.intensity*Math.PI),c(a.direction,h.directionToLightSource),a.specularStrength=s.specularStrength,a.environmentStrength=s.environmentStrength;const l=this._ambientLight;g(l.intensity,s.ambient.color,s.ambient.intensity);const p=this._moonLight;d(p.intensity,A,k,s.globalFactor);const m=(1-.5*s.globalFactor)*(1-.4*s.noonFactor*(1-s.globalFactor));g(p.intensity,p.intensity,m),c(p.direction,h.directionToLightSource),i.stage.renderer.updateLighting([a,l,p],s.noonFactor,s.globalFactor,this._weatherAvailable?t:0),this._modifyShadowsAvailable()}_autoUpdateTimezone(e,t=null){if(!this.view||"virtual"===this.view.environment.lighting.type||!this.view.environment.lighting.cameraTrackingEnabled||null==e)return!1;const i=this._tmpDate;i.setTime((t||this.view.environment.lighting.date).getTime());const n=T(e,this._tmpTz);if(null==n)return!1;let r=this.view.environment.lighting.positionTimezoneInfo;if(r.autoUpdated){if(r.hours===n.hours&&r.minutes===n.minutes&&r.seconds===n.seconds)return!1}else r=n;const o=i.getUTCHours()-(n.hours-r.hours),s=i.getUTCMinutes()-(n.minutes-r.minutes),a=i.getUTCSeconds()-(n.seconds-r.seconds);return i.setUTCHours(o),i.setUTCMinutes(s),i.setUTCSeconds(a),!t&&this.view.environment.lighting.autoUpdate(i,n)}_resetReferencePosition(e=!1){this._referencePositionGeographic=null,e&&this._cameraHandler()}get test(){}};e([s()],E.prototype,"view",void 0),e([s({type:Boolean,readOnly:!0})],E.prototype,"updating",null),e([s()],E.prototype,"_disableWeather",void 0),e([s()],E.prototype,"weatherEnabled",null),e([s()],E.prototype,"_weatherAvailable",null),e([s()],E.prototype,"shadowsAvailable",void 0),e([s()],E.prototype,"referencePositionGeographic",null),e([s()],E.prototype,"_referencePositionGeographic",void 0),e([s()],E.prototype,"_canProjectCameraPosition",null),E=e([a("esri.views.3d.environment.EnvironmentManager")],E);const A=u(.22,.22,.33),k=u(.22,.22,.22),R=m(),M={zConversionDisabled:!0};export{E as EnvironmentManager};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{EventEmitter as e}from"../../../core/Evented.js";import{makeHandle as t}from"../../../core/handleUtils.js";import"../../../core/has.js";import{deg2rad as i}from"../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{createRenderScreenPointArray3 as o,createScreenPointArray as r,screenPointObjectToArray as n,castRenderScreenPointArray as a}from"../../../core/screenUtils.js";import{generateUID as c}from"../../../core/uid.js";import{fromMat4 as l}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as h}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{copy as d,getTranslation as _,set as u,multiply as g,identity as m}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as f}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{squaredDistance as p}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{add as b,transformMat3 as v,transformMat4 as y,scale as j,copy as L,squaredDistance as S,set as O,subtract as w}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as R,ZEROS as T}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as A}from"../../../geometry/ellipsoidUtils.js";import E from"../../../geometry/Point.js";import{canProjectWithoutEngine as D,projectPoint as F}from"../../../geometry/projectionUtils.js";import{computeENUToPCPFLocalRotation as P}from"../../../geometry/projection/localRotationUtils.js";import{sphericalPCPFtoLonLatElevation as z}from"../../../geometry/projection/projectors.js";import{containsPointObject as x}from"../../../geometry/support/aaBoundingRect.js";import{distance2 as C,fromPoints as M,closestRayDistance2 as k,create as I}from"../../../geometry/support/lineSegment.js";import{fromPositionAndNormal as U,intersectRay as W,create as B}from"../../../geometry/support/plane.js";import{create as H}from"../../../geometry/support/ray.js";import{sv3d as q}from"../../../geometry/support/vectorStacks.js";import{clonePoint as G,hydratedSpatialReference as V}from"../../../layers/graphics/hydratedFeatures.js";import{getElevationOffset as $}from"../../../support/elevationInfoUtils.js";import{getElevationAtPoint as J}from"../support/ElevationProvider.js";import{fromScreen as K}from"../support/geometryUtils/ray.js";import N from"../webgl/RenderCamera.js";import{fromValues as Q}from"../webgl-engine/lib/LocalOriginFactory.js";import{Object3D as X}from"../webgl-engine/lib/Object3D.js";import{WebGLLayer as Y}from"../webgl-engine/lib/WebGLLayer.js";class Z{constructor(t){this.metadata=void 0,this._camera=new N,this._elevation={offset:0,override:null},this.collisionType={type:"point"},this.collisionPriority=0,this._renderObjects=new Array,this.autoScaleRenderObjects=!0,this.usePreciseLocalOrigin=!0,this._available=!0,this._noDisplayCount=0,this._radius=10,this._worldSized=!1,this.focusMultiplier=2,this.touchMultiplier=2.5,this.worldOriented=!1,this._modelTransform=f(),this._worldFrame=null,this._renderLocation=R(),this._renderLocationDirty=!0,this._location=new E({x:0,y:0,z:0}),this._elevationAlignedLocation=new E,this._elevationAlignedLocationDirty=!0,this.interactive=!0,this.selectable=!1,this.grabbable=!0,this.consumesClicks=!0,this.cursor=null,this.grabCursor=null,this._grabbing=!1,this.dragging=!1,this._hovering=!1,this._selected=!1,this._state=0,this._focused=!1,this.events=new e,this._screenLocation={screenPointArray:r(),renderScreenPointArray:o(),pixelSize:0},this._screenLocationDirty=!0,this._engineResourcesAddedToStage=!1,this._attached=!1,this._location.spatialReference=t.view.spatialReference,Object.assign(this,t);const i=this.view.state?.camera;i&&this._camera.copyFrom(i)}destroy(){this._applyObjectTransform=fe,this._removeResourcesFromStage(),this._engineResources=null,this.view=null,this._camera=null}get _stage(){return this.view?.stage}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this._elevationAlignedLocationDirty=!0,this._renderLocationDirty=!0,this._updateEngineObject()}get renderObjects(){return this._renderObjects}set renderObjects(e){this._removeResourcesFromStage(),this._engineResources=null,this._renderObjects=e.slice(),this._updateEngineObject()}set available(e){e!==this._available&&(this._available=e,this._updateEngineObject())}get available(){return this._available}disableDisplay(){return this._noDisplayCount++,1===this._noDisplayCount&&this._updateEngineObject(),t(()=>{this._noDisplayCount--,0===this._noDisplayCount&&this._updateEngineObject()})}set radius(e){e!==this._radius&&(this._radius=e,this._updateEngineObject())}get radius(){return this._radius}set worldSized(e){e!==this._worldSized&&(this._worldSized=e,this._updateEngineObject())}get worldSized(){return this._worldSized}get modelTransform(){return this._modelTransform}set modelTransform(e){ee(e)&&(this._screenLocationDirty=!0),d(this._modelTransform,e),this._updateEngineObject()}get renderLocation(){return this._renderLocationDirty&&(this._renderLocationDirty=!1,this.view.renderCoordsHelper.toRenderCoords(this.elevationAlignedLocation,this._renderLocation),this.worldOriented?(this._worldFrame||(this._worldFrame=f()),te(this.view,this._renderLocation,this._worldFrame)):this._worldFrame&&(this._worldFrame=null)),this._renderLocation}set renderLocation(e){this.view.renderCoordsHelper.fromRenderCoords(e,this._location),this.elevationAlignedLocation=this._location}get location(){return this._location}set location(e){G(e,this._location),this._notifyLocationChanged()}_notifyLocationChanged(){this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!0,this._updateEngineObject(),this.events.emit("location-update",{location:this._location})}get elevationAlignedLocation(){return this._elevationAlignedLocationDirty?(this._evaluateElevationAlignment(),this._updateElevationAlignedLocation(),this._elevationAlignedLocation):this._elevationAlignedLocation}set elevationAlignedLocation(e){G(e,this._location),this._evaluateElevationAlignment(),this._location.z-=this._elevation.offset,this._updateElevationAlignedLocation(),this._updateEngineObject(),this.events.emit("location-update",{location:this._location})}_updateElevationAlignedLocation(){const e=null!=this._elevation.override?this._elevation.override:this.location.z||0;this._elevationAlignedLocation.x=this.location.x,this._elevationAlignedLocation.y=this.location.y,this._elevationAlignedLocation.z=e+this._elevation.offset,this._elevationAlignedLocation.spatialReference=V(this.location.spatialReference),this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!1}grabbableForEvent(){return!0}get grabbing(){return this._grabbing}set grabbing(e){e!==this._grabbing&&(this._grabbing=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get hovering(){return this._hovering}set hovering(e){e!==this._hovering&&(this._hovering=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get selected(){return this._selected}set selected(e){e!==this._selected&&(this._selected=e,this._updateEngineObject(),this.events.emit("select-changed",{action:e?"select":"deselect"}))}get state(){return this._state}set state(e){e!==this._state&&(this._state=e,this._updateEngineObject())}updateStateEnabled(e,t){t?this.state|=e:this.state&=~e}_setFocused(e){e!==this._focused&&(this._focused=e,this.events.emit("focus-changed",{action:!0===e?"focus":"unfocus"}))}get focused(){return this._focused}get screenLocation(){return this._ensureScreenLocation(),this._screenLocation}_ensureScreenLocation(){if(!this._screenLocationDirty)return;this._screenLocation.pixelSize=this._camera.computeScreenPixelSizeAt(this.renderLocation),this._screenLocationDirty=!1;let e;if(ee(this._modelTransform)){const t=this._calculateModelTransformOffset(ge);e=b(t,t,this.renderLocation)}else e=this.renderLocation;this._camera.projectToRenderScreen(e,this._screenLocation.renderScreenPointArray),this._camera.renderToScreen(this._screenLocation.renderScreenPointArray,this._screenLocation.screenPointArray)}get applyObjectTransform(){return this._applyObjectTransform}set applyObjectTransform(e){this._applyObjectTransform=e,this._screenLocationDirty=!0,this._updateEngineObject()}get attached(){return this._attached}intersectionDistance(e,t){if(!this.available)return null;const i=n(e,ie),s=this._getCollisionRadius(t),o=-1*this.collisionPriority;switch(this.collisionType.type){case"point":if(p(this.screenLocation.screenPointArray,i)<s*s)return this.screenLocation.renderScreenPointArray[2]+o;break;case"line":{const e=this.collisionType.paths,t=this._getWorldToScreenObjectScale(),r=this._calculateObjectTransform(t,ae),n=s*this.screenLocation.pixelSize,c=K(this._camera,i,oe);if(null==c)return null;for(const i of e){if(0===i.length)continue;const e=y(le,i[0],r);for(let t=1;t<i.length;t++){const s=y(he,i[t],r),l=k(M(e,s,se),c);if(null!=l&&l<n*n){const t=b(q.get(),e,s);j(t,t,.5);const i=a(q.get());if(this._camera.projectToRenderScreen(t,i))return i[2]+o}L(e,s)}}break}case"disc":{const e=this.collisionType.direction,t=this.collisionType.offset??T,r=this._getWorldToScreenObjectScale(),n=this._calculateObjectTransform(r,ae),a=s*this.screenLocation.pixelSize,c=K(this._camera,i,oe);if(null==c)return null;const h=l(re,n),d=v(_e,e,h),_=y(ue,t,n);U(_,d,ce);const u=de;if(W(ce,c,u)&&S(u,_)<a*a)return this.screenLocation.renderScreenPointArray[2]+o;break}case"ribbon":{const{paths:e,direction:t}=this.collisionType,r=this._getWorldToScreenObjectScale(),n=this._calculateObjectTransform(r,ae),c=s*this._camera.computeScreenPixelSizeAt(this.renderLocation),h=K(this._camera,i,oe);if(null==h)return null;const d=l(re,n),_=v(_e,t,d),u=this._calculateModelTransformPosition(ue);U(u,_,ce);const g=de;if(!W(ce,h,g))break;for(const i of e){if(0===i.length)continue;const e=y(le,i[0],n);for(let t=1;t<i.length;t++){const s=y(he,i[t],n),r=C(M(e,s,se),g);if(null!=r&&r<c*c){const t=b(q.get(),e,s);j(t,t,.5);const i=a(q.get());if(this._camera.projectToRenderScreen(t,i))return i[2]+o}L(e,s)}}break}default:this.collisionType}return null}attach(e={manipulator3D:{}}){const t=this._stage;if(!t)return;const i=e.manipulator3D;null==i.engineLayerId?(this._engineLayer=new Y(t,{pickable:!1,updatePolicy:1}),i.engineLayerId=this._engineLayer.id):t?.getLayer&&(this._engineLayer=t.getLayer(i.engineLayerId)),i.engineLayerReferences=(i.engineLayerReferences||0)+1,this._camera.copyFrom(this.view.state.camera),this._attached=!0,this._updateEngineObject(),D(this._location.spatialReference,this.view.spatialReference)||(this.location=new E({x:0,y:0,z:0,spatialReference:this.view.spatialReference}))}detach(e={manipulator3D:{}}){const t=e.manipulator3D;t.engineLayerReferences--;const i=0===t.engineLayerReferences;this._removeResourcesFromStage(),i&&(t.engineLayerId=null,s(this._engineLayer)),this._engineResources=null,this._engineLayer=null,this._attached=!1}onViewChange(){this._camera.copyFrom(this.view.state.camera),this._screenLocationDirty=!0,this._updateEngineObject()}onElevationChange(e){F(this.location,me,e.spatialReference)&&x(e.extent,me)&&this._notifyLocationChanged()}_evaluateElevationAlignment(){if(null==this.elevationInfo)return;let e=null,t=0;const i=$(this.elevationInfo,this.location.spatialReference??this.view.elevationProvider.spatialReference);switch(this.elevationInfo.mode){case"on-the-ground":e=J(this.view.elevationProvider,this.location,"ground")??0;break;case"relative-to-ground":t=(J(this.view.elevationProvider,this.location,"ground")??0)+i;break;case"relative-to-scene":t=(J(this.view.elevationProvider,this.location,"scene")??0)+i;break;case"absolute-height":t=i}return t!==this._elevation.offset||e!==this._elevation.override?(this._elevation.offset=t,void(this._elevation.override=e)):void 0}_updateEngineObject(){if(!this._attached)return;if(!this.available)return void this._removeResourcesFromStage();const e=this._getWorldToScreenObjectScale(),t=ae;if(!0===this.autoScaleRenderObjects){const i=this._getFocusedSize(this._radius,this.focused)*e;this._calculateObjectTransform(i,t)}else this._calculateObjectTransform(e,t);const{objectsByState:i}=this._ensureEngineResources(),s=(this.focused?2:1)|(this.selected?8:4),o=this._noDisplayCount>0;for(const{stateMask:r,objects:n}of i){if(o){for(const e of n)e.visible=!1;continue}const e=!!!(15&r)||(s&r)===(15&r),i=!!!(65520&r)||(this.state&r)===(65520&r);if(e&&i)for(const s of n)s.visible=!0,this.usePreciseLocalOrigin?this._updateObjectTransformAndLocalOrigin(s,t):s.transformation=t;else for(const t of n)t.visible=!1}}_updateObjectTransformAndLocalOrigin(e,t){const i=_(ue,t),s=Q(i[0],i[1],i[2],`manipulator-${c()}`);for(const o of e.geometries)o.localOrigin=s;e.transformation=t}_ensureEngineResources(){if(null==this._engineResources){const e=this._engineLayer,t=[],i=new Set;this.renderObjects.forEach(({geometry:{material:e}})=>{i.has(e)||(t.push(e),i.add(e))});const s=new Map;this._renderObjects.forEach(e=>{const t=new X({castShadow:!1,geometries:[e.geometry]}),i=s.get(e.stateMask)||[];i.push(t),s.set(e.stateMask,i)});const o=[];s.forEach((e,t)=>o.push({stateMask:t,objects:e})),this._engineResources={objectsByState:o,layer:e,materials:t}}return this._addResourcesToStage(),this._engineResources}_addResourcesToStage(){const e=this._stage;if(this._engineResourcesAddedToStage||null==this._engineResources||!e)return;const{objectsByState:t,layer:i}=this._engineResources;t.forEach(({objects:e})=>i.addMany(e)),this._engineResourcesAddedToStage=!0}_removeResourcesFromStage(){const e=this._stage;if(!this._engineResourcesAddedToStage||null==this._engineResources||!e)return;const{objectsByState:t,layer:i}=this._engineResources;t.forEach(({objects:e})=>i.removeMany(e)),this._engineResourcesAddedToStage=!1}_getCollisionRadius(e){return this._getFocusedSize(this.radius,!0)*("touch"===e?this.touchMultiplier:1)}_getFocusedSize(e,t){return e*(t?this.focusMultiplier:1)}_getWorldToScreenObjectScale(){return this._worldSized?1:this.screenLocation.pixelSize}_calculateModelTransformPosition(e){const t=this._getWorldToScreenObjectScale(),i=this._calculateObjectTransform(t,ne);return O(e,i[12],i[13],i[14])}_calculateModelTransformOffset(e){const t=this._calculateModelTransformPosition(e);return w(e,t,this.renderLocation)}_calculateObjectTransform(e,t){return u(t,e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1),this._worldFrame&&g(t,t,this._worldFrame),g(t,t,this._modelTransform),t[12]+=this.renderLocation[0],t[13]+=this.renderLocation[1],t[14]+=this.renderLocation[2],t[15]=1,null!=this._applyObjectTransform&&this._applyObjectTransform(t),t}get test(){}}function ee(e){return 0!==e[12]||0!==e[13]||0!==e[14]}function te(e,t,s){switch(e.viewingMode){case"local":return m(s),!0;case"global":{const o=A(e.renderCoordsHelper.spatialReference);return z(t,0,le,0,o.radius),P(i(le[0]),i(le[1]),s),!0}}}const ie=r(),se=I(),oe=H(),re=h(),ne=f(),ae=f(),ce=B(),le=R(),he=R(),de=R(),_e=R(),ue=R(),ge=R(),me=new E({x:0,y:0,z:0,spatialReference:null}),fe=()=>{};export{Z as Manipulator3D};
2
+ import{EventEmitter as e}from"../../../core/Evented.js";import{makeHandle as t}from"../../../core/handleUtils.js";import"../../../core/has.js";import{deg2rad as i}from"../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{createRenderScreenPointArray3 as o,createScreenPointArray as n,screenPointObjectToArray as r,castRenderScreenPointArray as a}from"../../../core/screenUtils.js";import{generateUID as c}from"../../../core/uid.js";import{fromMat4 as l}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as h}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{copy as d,exactEquals as u,getTranslation as _,set as g,multiply as f,identity as m}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as p}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{squaredDistance as b}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{add as v,transformMat3 as y,transformMat4 as j,scale as L,copy as S,squaredDistance as O,exactEquals as R,set as T,subtract as w}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as A,ZEROS as E}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as D}from"../../../geometry/ellipsoidUtils.js";import P from"../../../geometry/Point.js";import{canProjectWithoutEngine as z,projectPoint as x}from"../../../geometry/projectionUtils.js";import{computeENUToPCPFLocalRotation as F}from"../../../geometry/projection/localRotationUtils.js";import{sphericalPCPFtoLonLatElevation as C}from"../../../geometry/projection/projectors.js";import{containsPointObject as M}from"../../../geometry/support/aaBoundingRect.js";import{distance2 as k,fromPoints as I,closestRayDistance2 as U,create as W}from"../../../geometry/support/lineSegment.js";import{fromPositionAndNormal as B,intersectRay as H,create as q}from"../../../geometry/support/plane.js";import{create as G}from"../../../geometry/support/ray.js";import{sv3d as V}from"../../../geometry/support/vectorStacks.js";import{clonePoint as $,hydratedSpatialReference as J}from"../../../layers/graphics/hydratedFeatures.js";import{getElevationOffset as K}from"../../../support/elevationInfoUtils.js";import{getElevationAtPoint as N}from"../support/ElevationProvider.js";import{fromScreen as Q}from"../support/geometryUtils/ray.js";import{fromValues as X}from"../webgl-engine/lib/LocalOriginFactory.js";import{Object3D as Y}from"../webgl-engine/lib/Object3D.js";import{WebGLLayer as Z}from"../webgl-engine/lib/WebGLLayer.js";class ee{constructor(t){this.metadata=void 0,this._elevation={offset:0,override:null},this.collisionType={type:"point"},this.collisionPriority=0,this._renderObjects=new Array,this.autoScaleRenderObjects=!0,this.usePreciseLocalOrigin=!0,this._available=!0,this._noDisplayCount=0,this._radius=10,this._worldSized=!1,this.focusMultiplier=2,this.touchMultiplier=2.5,this.worldOriented=!1,this._modelTransform=p(),this._worldFrame=null,this._renderLocation=A(),this._renderLocationDirty=!0,this._location=new P({x:0,y:0,z:0}),this._elevationAlignedLocation=new P,this._elevationAlignedLocationDirty=!0,this.interactive=!0,this.selectable=!1,this.grabbable=!0,this.consumesClicks=!0,this.cursor=null,this.grabCursor=null,this._grabbing=!1,this.dragging=!1,this._hovering=!1,this._selected=!1,this._state=0,this._focused=!1,this.events=new e,this._screenLocation={screenPointArray:n(),renderScreenPointArray:o(),pixelSize:0},this._screenLocationDirty=!0,this._engineResourcesAddedToStage=!1,this._attached=!1,this._location.spatialReference=t.view.spatialReference,Object.assign(this,t)}destroy(){this._applyObjectTransform=pe,this._removeResourcesFromStage(),this._engineResources=null,this.view=null}get _stage(){return this.view?.stage}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this._elevationAlignedLocationDirty=!0,this._renderLocationDirty=!0,this._updateEngineObject()}get renderObjects(){return this._renderObjects}set renderObjects(e){this._removeResourcesFromStage(),this._engineResources=null,this._renderObjects=e.slice(),this._updateEngineObject()}set available(e){e!==this._available&&(this._available=e,this._updateEngineObject())}get available(){return this._available}disableDisplay(){return this._noDisplayCount++,1===this._noDisplayCount&&this._updateEngineObject(),t(()=>{this._noDisplayCount--,0===this._noDisplayCount&&this._updateEngineObject()})}set radius(e){e!==this._radius&&(this._radius=e,this._updateEngineObject())}get radius(){return this._radius}set worldSized(e){e!==this._worldSized&&(this._worldSized=e,this._updateEngineObject())}get worldSized(){return this._worldSized}get modelTransform(){return this._modelTransform}set modelTransform(e){te(e)&&(this._screenLocationDirty=!0),d(this._modelTransform,e),this._updateEngineObject()}get renderLocation(){return this._renderLocationDirty&&(this._renderLocationDirty=!1,this.view.renderCoordsHelper.toRenderCoords(this.elevationAlignedLocation,this._renderLocation),this.worldOriented?(this._worldFrame||(this._worldFrame=p()),ie(this.view,this._renderLocation,this._worldFrame)):this._worldFrame&&(this._worldFrame=null)),this._renderLocation}set renderLocation(e){this.view.renderCoordsHelper.fromRenderCoords(e,this._location),this.elevationAlignedLocation=this._location}get location(){return this._location}set location(e){$(e,this._location),this._notifyLocationChanged()}_notifyLocationChanged(){this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!0,this._updateEngineObject(),this.events.emit("location-update",{location:this._location})}get elevationAlignedLocation(){return this._elevationAlignedLocationDirty?(this._evaluateElevationAlignment(),this._updateElevationAlignedLocation(),this._elevationAlignedLocation):this._elevationAlignedLocation}set elevationAlignedLocation(e){$(e,this._location),this._evaluateElevationAlignment(),this._location.z-=this._elevation.offset,this._updateElevationAlignedLocation(),this._updateEngineObject(),this.events.emit("location-update",{location:this._location})}_updateElevationAlignedLocation(){const e=null!=this._elevation.override?this._elevation.override:this.location.z||0;this._elevationAlignedLocation.x=this.location.x,this._elevationAlignedLocation.y=this.location.y,this._elevationAlignedLocation.z=e+this._elevation.offset,this._elevationAlignedLocation.spatialReference=J(this.location.spatialReference),this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!1}grabbableForEvent(){return!0}get grabbing(){return this._grabbing}set grabbing(e){e!==this._grabbing&&(this._grabbing=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get hovering(){return this._hovering}set hovering(e){e!==this._hovering&&(this._hovering=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get selected(){return this._selected}set selected(e){e!==this._selected&&(this._selected=e,this._updateEngineObject(),this.events.emit("select-changed",{action:e?"select":"deselect"}))}get state(){return this._state}set state(e){e!==this._state&&(this._state=e,this._updateEngineObject())}updateStateEnabled(e,t){t?this.state|=e:this.state&=~e}_setFocused(e){e!==this._focused&&(this._focused=e,this.events.emit("focus-changed",{action:!0===e?"focus":"unfocus"}))}get focused(){return this._focused}get screenLocation(){return this._ensureScreenLocation(),this._screenLocation}_ensureScreenLocation(){if(!this._screenLocationDirty)return;const e=this.view.state.camera;this._screenLocation.pixelSize=e.computeScreenPixelSizeAt(this.renderLocation),this._screenLocationDirty=!1;let t;if(te(this._modelTransform)){const e=this._calculateModelTransformOffset(fe);t=v(e,e,this.renderLocation)}else t=this.renderLocation;e.projectToRenderScreen(t,this._screenLocation.renderScreenPointArray),e.renderToScreen(this._screenLocation.renderScreenPointArray,this._screenLocation.screenPointArray)}get applyObjectTransform(){return this._applyObjectTransform}set applyObjectTransform(e){this._applyObjectTransform=e,this._screenLocationDirty=!0,this._updateEngineObject()}get attached(){return this._attached}intersectionDistance(e,t){if(!this.available)return null;const i=this.view.state.camera,s=r(e,se),o=this._getCollisionRadius(t),n=-1*this.collisionPriority;switch(this.collisionType.type){case"point":if(b(this.screenLocation.screenPointArray,s)<o*o)return this.screenLocation.renderScreenPointArray[2]+n;break;case"line":{const e=this.collisionType.paths,t=this._getWorldToScreenObjectScale(),r=this._calculateObjectTransform(t,ce),c=o*this.screenLocation.pixelSize,l=Q(i,s,ne);if(null==l)return null;for(const s of e){if(0===s.length)continue;const e=j(he,s[0],r);for(let t=1;t<s.length;t++){const o=j(de,s[t],r),h=U(I(e,o,oe),l);if(null!=h&&h<c*c){const t=v(V.get(),e,o);L(t,t,.5);const s=a(V.get());if(i.projectToRenderScreen(t,s))return s[2]+n}S(e,o)}}break}case"disc":{const e=this.collisionType.direction,t=this.collisionType.offset??E,r=this._getWorldToScreenObjectScale(),a=this._calculateObjectTransform(r,ce),c=o*this.screenLocation.pixelSize,h=Q(i,s,ne);if(null==h)return null;const d=l(re,a),u=y(_e,e,d),_=j(ge,t,a);B(_,u,le);const g=ue;if(H(le,h,g)&&O(g,_)<c*c)return this.screenLocation.renderScreenPointArray[2]+n;break}case"ribbon":{const{paths:e,direction:t}=this.collisionType,r=this._getWorldToScreenObjectScale(),c=this._calculateObjectTransform(r,ce),h=o*i.computeScreenPixelSizeAt(this.renderLocation),d=Q(i,s,ne);if(null==d)return null;const u=l(re,c),_=y(_e,t,u),g=this._calculateModelTransformPosition(ge);B(g,_,le);const f=ue;if(!H(le,d,f))break;for(const s of e){if(0===s.length)continue;const e=j(he,s[0],c);for(let t=1;t<s.length;t++){const o=j(de,s[t],c),r=k(I(e,o,oe),f);if(null!=r&&r<h*h){const t=v(V.get(),e,o);L(t,t,.5);const s=a(V.get());if(i.projectToRenderScreen(t,s))return s[2]+n}S(e,o)}}break}default:this.collisionType}return null}attach(e={manipulator3D:{}}){const t=this._stage;if(!t)return;const i=e.manipulator3D;null==i.engineLayerId?(this._engineLayer=new Z(t,{pickable:!1,updatePolicy:1}),i.engineLayerId=this._engineLayer.id):t?.getLayer&&(this._engineLayer=t.getLayer(i.engineLayerId)),i.engineLayerReferences=(i.engineLayerReferences||0)+1,this._attached=!0,this._updateEngineObject(),z(this._location.spatialReference,this.view.spatialReference)||(this.location=new P({x:0,y:0,z:0,spatialReference:this.view.spatialReference}))}detach(e={manipulator3D:{}}){const t=e.manipulator3D;t.engineLayerReferences--;const i=0===t.engineLayerReferences;this._removeResourcesFromStage(),i&&(t.engineLayerId=null,s(this._engineLayer)),this._engineResources=null,this._engineLayer=null,this._attached=!1}onViewChange(){this._screenLocationDirty=!0,this._updateEngineObject()}onElevationChange(e){x(this.location,me,e.spatialReference)&&M(e.extent,me)&&this._notifyLocationChanged()}_evaluateElevationAlignment(){if(null==this.elevationInfo)return;let e=null,t=0;const i=K(this.elevationInfo,this.location.spatialReference??this.view.elevationProvider.spatialReference);switch(this.elevationInfo.mode){case"on-the-ground":e=N(this.view.elevationProvider,this.location,"ground")??0;break;case"relative-to-ground":t=(N(this.view.elevationProvider,this.location,"ground")??0)+i;break;case"relative-to-scene":t=(N(this.view.elevationProvider,this.location,"scene")??0)+i;break;case"absolute-height":t=i}return t!==this._elevation.offset||e!==this._elevation.override?(this._elevation.offset=t,void(this._elevation.override=e)):void 0}_updateEngineObject(){if(!this._attached)return;if(!this.available)return void this._removeResourcesFromStage();const e=this._getWorldToScreenObjectScale(),t=ce;if(!0===this.autoScaleRenderObjects){const i=this._getFocusedSize(this._radius,this.focused)*e;this._calculateObjectTransform(i,t)}else this._calculateObjectTransform(e,t);const{objectsByState:i}=this._ensureEngineResources(),s=(this.focused?2:1)|(this.selected?8:4),o=this._noDisplayCount>0;for(const{stateMask:n,objects:r}of i){if(o){for(const e of r)e.visible=!1;continue}const e=!!!(15&n)||(s&n)===(15&n),i=!!!(65520&n)||(this.state&n)===(65520&n);if(e&&i)for(const s of r)s.visible=!0,this.usePreciseLocalOrigin?this._updateObjectTransformAndLocalOrigin(s,t):u(s.transformation,t)||(s.transformation=t);else for(const t of r)t.visible=!1}}_updateObjectTransformAndLocalOrigin(e,t){const i=_(ge,t),s=e.geometries.every(({localOrigin:e})=>null!=e&&R(e.vec3,i));if(s&&u(e.transformation,t))return;const o=X(i[0],i[1],i[2],`manipulator-${c()}`);for(const n of e.geometries)n.localOrigin=o;e.transformation=t}_ensureEngineResources(){if(null==this._engineResources){const e=this._engineLayer,t=[],i=new Set;this.renderObjects.forEach(({geometry:{material:e}})=>{i.has(e)||(t.push(e),i.add(e))});const s=new Map;this._renderObjects.forEach(e=>{const t=new Y({castShadow:!1,geometries:[e.geometry]}),i=s.get(e.stateMask)||[];i.push(t),s.set(e.stateMask,i)});const o=[];s.forEach((e,t)=>o.push({stateMask:t,objects:e})),this._engineResources={objectsByState:o,layer:e,materials:t}}return this._addResourcesToStage(),this._engineResources}_addResourcesToStage(){const e=this._stage;if(this._engineResourcesAddedToStage||null==this._engineResources||!e)return;const{objectsByState:t,layer:i}=this._engineResources;t.forEach(({objects:e})=>i.addMany(e)),this._engineResourcesAddedToStage=!0}_removeResourcesFromStage(){const e=this._stage;if(!this._engineResourcesAddedToStage||null==this._engineResources||!e)return;const{objectsByState:t,layer:i}=this._engineResources;t.forEach(({objects:e})=>i.removeMany(e)),this._engineResourcesAddedToStage=!1}_getCollisionRadius(e){return this._getFocusedSize(this.radius,!0)*("touch"===e?this.touchMultiplier:1)}_getFocusedSize(e,t){return e*(t?this.focusMultiplier:1)}_getWorldToScreenObjectScale(){return this._worldSized?1:this.screenLocation.pixelSize}_calculateModelTransformPosition(e){const t=this._getWorldToScreenObjectScale(),i=this._calculateObjectTransform(t,ae);return T(e,i[12],i[13],i[14])}_calculateModelTransformOffset(e){const t=this._calculateModelTransformPosition(e);return w(e,t,this.renderLocation)}_calculateObjectTransform(e,t){return g(t,e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1),this._worldFrame&&f(t,t,this._worldFrame),f(t,t,this._modelTransform),t[12]+=this.renderLocation[0],t[13]+=this.renderLocation[1],t[14]+=this.renderLocation[2],t[15]=1,null!=this._applyObjectTransform&&this._applyObjectTransform(t),t}get test(){}}function te(e){return 0!==e[12]||0!==e[13]||0!==e[14]}function ie(e,t,s){switch(e.viewingMode){case"local":return m(s),!0;case"global":{const o=D(e.renderCoordsHelper.spatialReference);return C(t,0,he,0,o.radius),F(i(he[0]),i(he[1]),s),!0}}}const se=n(),oe=W(),ne=G(),re=h(),ae=p(),ce=p(),le=q(),he=A(),de=A(),ue=A(),_e=A(),ge=A(),fe=A(),me=new P({x:0,y:0,z:0,spatialReference:null}),pe=()=>{};export{ee as Manipulator3D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{handlesGroup as t,makeHandle as i}from"../../../../../core/handleUtils.js";import{destroyMaybe as s,removeMaybe as n}from"../../../../../core/maybe.js";import{watch as r,syncAndInitial as a,initial as o,when as l}from"../../../../../core/reactiveUtils.js";import{property as c,subclass as h}from"../../../../../core/accessorSupport/decorators.js";import{set as p}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as m}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getEffectiveElevationInfo as u,getEffectiveElevationMode as d}from"../../../../../support/elevationInfoUtils.js";import v from"../../../../../symbols/support/ElevationInfo.js";import{SegmentLabels3D as f}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as g}from"../../SnappingVisualizer3D.js";import{meshTransformFastUpdateHandles as E}from"../meshFastUpdateUtils.js";import{Settings as y}from"../settings.js";import{ExtendedLineVisualElement as V}from"../../visualElements/ExtendedLineVisualElement.js";import{OutlineVisualElement as w}from"../../visualElements/OutlineVisualElement.js";import{VerticesVisualElement as _}from"../../visualElements/VerticesVisualElement.js";import{evaluateElevationAlignmentAtPoint as I}from"../../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as j}from"../../../layers/graphics/ElevationContext.js";import{GraphicState as G}from"../../../layers/graphics/GraphicState.js";import{DrawGraphicTool as x,geometryTypeToDrawOperationGeometryType as S}from"../../../../draw/DrawGraphicTool.js";import{DrawOperation as D}from"../../../../draw/DrawOperation.js";import{ElevationDrawSurface as L,SceneDrawSurface as C}from"../../../../draw/drawSurfaces.js";import{updateMeshTransformFromTooltipInfo as O}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{autorun as T}from"../../../../../core/accessorSupport/trackingUtils.js";let b=class extends x{constructor(e){super(e),this._activeVertexVisualElement=null,this._createGraphicState=null,this._outlineVisualElement=null,this._verticesVisualElement=null,this._verticalLineVisualElement=null,this._settings=new y({getTheme:()=>this.view.effectiveTheme}),this.geometryType=null,this.type="draw-3d"}initialize(){const{mode:e,offset:t,unit:i,featureExpressionInfo:s}=this.elevationInfo;this.internalGraphicsLayer.elevationInfo=new v({mode:e,offset:t,unit:i,featureExpressionInfo:s})}normalizeCtorArgs(e){if(!e.elevationInfo){const t=e.hasZ??!0;return{...e,elevationInfo:u(t)}}return e}initializeGraphic(e){const{view:i}=this,s=this._createGraphicState=new G({graphic:e});return t([i.maskOccludee(e),i.trackGraphicState(s),r(()=>({element:this._outlineVisualElement,isDraped:s.isDraped}),({element:e,isDraped:t})=>{e&&(e.isDraped=t)},a),T(()=>{O(this.tooltipInfos.mesh,this.geometryToPlace)}),this._setupLoadingIndicator(s),...E(s)])}makeDrawOperation(){const{geometryType:e}=this,t="circle"!==e&&"rectangle"!==e;return new D({view:this.view,manipulators:this.manipulators,geometryType:S(e),drawingMode:this.mode,hasZ:this.hasZ,defaultZ:this.defaultZ,snapToSceneEnabled:this.snapToScene,drawSurface:new C(this.view,this.elevationInfo,[this.internalGraphicsLayer]),elevationDrawSurface:new L(this.elevationInfo,this.defaultZ,this.view,this.internalGraphicsLayer),hasM:!1,elevationInfo:this.elevationInfo,snappingManager:this.snappingManager,snappingVisualizer:new g,segmentLabels:t?new f:null,labelOptions:this.sketchOptions.labels,isDraped:this._createGraphicState?this._createGraphicState.isDraped:"on-the-ground"===d(this.hasZ,this.elevationInfo),cursor:this.cursor,constraintsEnabled:!0})}onActiveVertexChanged(e){const{view:n}=this;if(this._activeVertexVisualElement)return this._activeVertexVisualElement.vertices=[e],this._activeVertexVisualElement.recreate(),this._updateVerticalLineVisualElement(e),i();const r=this._settings,a=r.manipulators.vertex,l=new _({view:n,spatialReference:n.spatialReference,vertices:[e],elevationInfo:this.internalGraphicsLayer.elevationInfo,size:a.size,outlineSize:a.outlineSize,renderOccluded:a.renderOccluded,attached:!1,isDecoration:!0});this._activeVertexVisualElement=l;const c=r.visualElements.zVerticalLine,h=new V({view:n,extensionType:c.extensionType,innerWidth:1,attached:!1,writeDepthEnabled:!1,renderOccluded:4,isDecoration:!0});this._verticalLineVisualElement=h;const p=t([this._updatingHandles.add(()=>r.visualElements.zVerticalLine,e=>e.apply(h),o),this._updatingHandles.add(()=>({selectedColor:r.colors.selected.toUnitRGBA(),outlineColor:r.manipulators.vertex.outlineColor.toUnitRGBA()}),({selectedColor:e,outlineColor:t})=>{l.color=e,l.outlineColor=t},o),i(()=>{this._activeVertexVisualElement=s(this._activeVertexVisualElement),this._verticalLineVisualElement=s(this._verticalLineVisualElement)})]);return l.attached=!0,this._updateVerticalLineVisualElement(e),p}_updateVerticalLineVisualElement(e){const t=this._verticalLineVisualElement;if(!t)return;const{renderCoordsHelper:i,elevationProvider:s}=this.view;p(U,e[0],e[1],e[2]),z.setFromElevationInfo(this.elevationInfo),U[2]=I(U,s,z,i);i.toRenderCoords(U,this.view.spatialReference,U)?(t.setStartEndFromWorldDownAtLocation(U),t.attached=!0):t.attached=!1}onOutlineChanged(e){if(this._outlineVisualElement)return this._outlineVisualElement.geometry=e,i();const n=this.internalGraphicsLayer.elevationInfo,{view:r}=this,a=this._settings,l=new w({view:r,geometry:e,elevationInfo:n,isDraped:this._createGraphicState?this._createGraphicState.isDraped:"on-the-ground"===d(this.hasZ,n),attached:!1,isDecoration:!0});this._outlineVisualElement=l;const c=t([this._updatingHandles.add(()=>a.visualElements.lineObjects.outline,e=>e.apply(l),o),this._updatingHandles.add(()=>a.visualElements.lineObjects.shadowStyle,e=>e.apply(l),o),i(()=>{this._outlineVisualElement=s(this._outlineVisualElement)})]);return l.attached=!0,l.laserlineEnabled=!0,c}onRegularVerticesChanged(e){if(this._verticesVisualElement)return this._verticesVisualElement.vertices=e,i();const{view:n}=this,r=this._settings,a=r.manipulators.vertex,l=new _({view:n,spatialReference:n.spatialReference,vertices:e,elevationInfo:this.internalGraphicsLayer.elevationInfo,size:a.size,outlineSize:a.outlineSize,renderOccluded:a.renderOccluded,attached:!1,isDecoration:!0}),c=t([this._updatingHandles.add(()=>({color:r.manipulators.vertex.color.toUnitRGBA(),outlineColor:r.manipulators.vertex.outlineColor.toUnitRGBA()}),({color:e,outlineColor:t})=>{l.color=e,l.outlineColor=t},o),i(()=>{this._verticesVisualElement=s(this._verticesVisualElement)})]);return l.attached=!0,this._verticesVisualElement=l,c}updateGraphicGeometry(e){if("mesh"===this.geometryType&&"point"===e?.type){const t=this.geometryToPlace;t?.centerAt(e),O(this.tooltipInfos.mesh,t);const i=this._graphic;return void(t&&i.geometry===t||(i.geometry=t))}super.updateGraphicGeometry(e)}_setupLoadingIndicator(e){const{drawOperation:s}=this;if(!this.geometryToPlace||e.displaying)return s.loading=!1,null;s.loading=!0;const r=i(()=>{s.loading=!1});let o;const c=()=>{o&&cancelAnimationFrame(o)},h=()=>{c(),o=requestAnimationFrame(()=>r.remove())};let p=null;return p=e.on("changed",()=>{p=n(p),h()}),t([p,l(()=>e.displaying,h,{...a,once:!0}),i(c),r])}};e([c({constructOnly:!0})],b.prototype,"elevationInfo",void 0),e([c({constructOnly:!0})],b.prototype,"geometryType",void 0),e([c()],b.prototype,"type",void 0),e([c({constructOnly:!0})],b.prototype,"view",void 0),b=e([h("esri.views.3d.interactive.editingTools.draw.DrawGraphicTool3D")],b);const z=new j,U=m();export{b as DrawGraphicTool3D};
2
+ import{__decorate as e}from"tslib";import{handlesGroup as t,makeHandle as i}from"../../../../../core/handleUtils.js";import{destroyMaybe as s,removeMaybe as n}from"../../../../../core/maybe.js";import{watch as r,syncAndInitial as o,initial as a,when as l}from"../../../../../core/reactiveUtils.js";import{property as c,subclass as h}from"../../../../../core/accessorSupport/decorators.js";import{set as p}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as m}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getEffectiveElevationInfo as u,getEffectiveElevationMode as d}from"../../../../../support/elevationInfoUtils.js";import v from"../../../../../symbols/support/ElevationInfo.js";import{SegmentLabels3D as f}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as g}from"../../SnappingVisualizer3D.js";import{meshTransformFastUpdateHandles as E}from"../meshFastUpdateUtils.js";import{Settings as y}from"../settings.js";import{ExtendedLineVisualElement as V}from"../../visualElements/ExtendedLineVisualElement.js";import{OutlineVisualElement as w}from"../../visualElements/OutlineVisualElement.js";import{VerticesVisualElement as _}from"../../visualElements/VerticesVisualElement.js";import{evaluateElevationAlignmentAtPoint as I}from"../../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as j}from"../../../layers/graphics/ElevationContext.js";import{GraphicState as G}from"../../../layers/graphics/GraphicState.js";import{DrawGraphicTool as x,geometryTypeToDrawOperationGeometryType as S}from"../../../../draw/DrawGraphicTool.js";import{DrawOperation as D}from"../../../../draw/DrawOperation.js";import{ElevationDrawSurface as L,SceneDrawSurface as C}from"../../../../draw/drawSurfaces.js";import{updateMeshTransformFromTooltipInfo as O}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{autorun as T}from"../../../../../core/accessorSupport/trackingUtils.js";let b=class extends x{constructor(e){super(e),this._activeVertexVisualElement=null,this._createGraphicState=null,this._outlineVisualElement=null,this._verticesVisualElement=null,this._verticalLineVisualElement=null,this._settings=new y({getTheme:()=>this.view.effectiveTheme}),this.geometryType=null,this.type="draw-3d"}initialize(){const{mode:e,offset:t,unit:i,featureExpressionInfo:s}=this.elevationInfo;this.internalGraphicsLayer.elevationInfo=new v({mode:e,offset:t,unit:i,featureExpressionInfo:s})}normalizeCtorArgs(e){if(!e.elevationInfo){const t=e.hasZ??!0;return{...e,elevationInfo:u(t)}}return e}initializeGraphic(e){const{view:i}=this,s=this._createGraphicState=new G({graphic:e});return t([i.maskOccludee(e),i.trackGraphicState(s),r(()=>({element:this._outlineVisualElement,isDraped:s.isDraped}),({element:e,isDraped:t})=>{e&&(e.isDraped=t)},o),T(()=>{O(this.tooltipInfos.mesh,this.geometryToPlace)}),this._setupLoadingIndicator(s),...E(s)])}makeDrawOperation(){const{geometryType:e}=this,t="circle"!==e&&"rectangle"!==e;return new D({view:this.view,manipulators:this.manipulators,geometryType:S(e),drawingMode:this.mode,hasZ:this.hasZ,defaultZ:this.defaultZ,snapToSceneEnabled:this.snapToScene,drawSurface:new C(this.view,this.elevationInfo,[this.internalGraphicsLayer]),elevationDrawSurface:new L(this.elevationInfo,this.defaultZ,this.view,this.internalGraphicsLayer),hasM:!1,elevationInfo:this.elevationInfo,snappingManager:this.snappingManager,snappingVisualizer:new g,segmentLabels:t?new f:null,labelOptions:this.toolOptions.labels,isDraped:this._createGraphicState?this._createGraphicState.isDraped:"on-the-ground"===d(this.hasZ,this.elevationInfo),cursor:this.cursor,constraintsEnabled:!0})}onActiveVertexChanged(e){const{view:n}=this;if(this._activeVertexVisualElement)return this._activeVertexVisualElement.vertices=[e],this._activeVertexVisualElement.recreate(),this._updateVerticalLineVisualElement(e),i();const r=this._settings,o=r.manipulators.vertex,l=new _({view:n,spatialReference:n.spatialReference,vertices:[e],elevationInfo:this.internalGraphicsLayer.elevationInfo,size:o.size,outlineSize:o.outlineSize,renderOccluded:o.renderOccluded,attached:!1,isDecoration:!0});this._activeVertexVisualElement=l;const c=r.visualElements.zVerticalLine,h=new V({view:n,extensionType:c.extensionType,innerWidth:1,attached:!1,writeDepthEnabled:!1,renderOccluded:4,isDecoration:!0});this._verticalLineVisualElement=h;const p=t([this._updatingHandles.add(()=>r.visualElements.zVerticalLine,e=>e.apply(h),a),this._updatingHandles.add(()=>({selectedColor:r.colors.selected.toUnitRGBA(),outlineColor:r.manipulators.vertex.outlineColor.toUnitRGBA()}),({selectedColor:e,outlineColor:t})=>{l.color=e,l.outlineColor=t},a),i(()=>{this._activeVertexVisualElement=s(this._activeVertexVisualElement),this._verticalLineVisualElement=s(this._verticalLineVisualElement)})]);return l.attached=!0,this._updateVerticalLineVisualElement(e),p}_updateVerticalLineVisualElement(e){const t=this._verticalLineVisualElement;if(!t)return;const{renderCoordsHelper:i,elevationProvider:s}=this.view;p(U,e[0],e[1],e[2]),z.setFromElevationInfo(this.elevationInfo),U[2]=I(U,s,z,i);i.toRenderCoords(U,this.view.spatialReference,U)?(t.setStartEndFromWorldDownAtLocation(U),t.attached=!0):t.attached=!1}onOutlineChanged(e){if(this._outlineVisualElement)return this._outlineVisualElement.geometry=e,i();const n=this.internalGraphicsLayer.elevationInfo,{view:r}=this,o=this._settings,l=new w({view:r,geometry:e,elevationInfo:n,isDraped:this._createGraphicState?this._createGraphicState.isDraped:"on-the-ground"===d(this.hasZ,n),attached:!1,isDecoration:!0});this._outlineVisualElement=l;const c=t([this._updatingHandles.add(()=>o.visualElements.lineObjects.outline,e=>e.apply(l),a),this._updatingHandles.add(()=>o.visualElements.lineObjects.shadowStyle,e=>e.apply(l),a),i(()=>{this._outlineVisualElement=s(this._outlineVisualElement)})]);return l.attached=!0,l.laserlineEnabled=!0,c}onRegularVerticesChanged(e){if(this._verticesVisualElement)return this._verticesVisualElement.vertices=e,i();const{view:n}=this,r=this._settings,o=r.manipulators.vertex,l=new _({view:n,spatialReference:n.spatialReference,vertices:e,elevationInfo:this.internalGraphicsLayer.elevationInfo,size:o.size,outlineSize:o.outlineSize,renderOccluded:o.renderOccluded,attached:!1,isDecoration:!0}),c=t([this._updatingHandles.add(()=>({color:r.manipulators.vertex.color.toUnitRGBA(),outlineColor:r.manipulators.vertex.outlineColor.toUnitRGBA()}),({color:e,outlineColor:t})=>{l.color=e,l.outlineColor=t},a),i(()=>{this._verticesVisualElement=s(this._verticesVisualElement)})]);return l.attached=!0,this._verticesVisualElement=l,c}updateGraphicGeometry(e){if("mesh"===this.geometryType&&"point"===e?.type){const t=this.geometryToPlace;t?.centerAt(e),O(this.tooltipInfos.mesh,t);const i=this._graphic;return void(t&&i.geometry===t||(i.geometry=t))}super.updateGraphicGeometry(e)}_setupLoadingIndicator(e){const{drawOperation:s}=this;if(!this.geometryToPlace||e.displaying)return s.loading=!1,null;s.loading=!0;const r=i(()=>{s.loading=!1});let a;const c=()=>{a&&cancelAnimationFrame(a)},h=()=>{c(),a=requestAnimationFrame(()=>r.remove())};let p=null;return p=e.on("changed",()=>{p=n(p),h()}),t([p,l(()=>e.displaying,h,{...o,once:!0}),i(c),r])}};e([c({constructOnly:!0})],b.prototype,"elevationInfo",void 0),e([c({constructOnly:!0})],b.prototype,"geometryType",void 0),e([c()],b.prototype,"type",void 0),e([c({constructOnly:!0})],b.prototype,"view",void 0),b=e([h("esri.views.3d.interactive.editingTools.draw.DrawGraphicTool3D")],b);const z=new j,U=m();export{b as DrawGraphicTool3D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{isSome as o}from"../../../../../core/arrayUtils.js";import e from"../../../../../core/Collection.js";import{EventEmitter as i}from"../../../../../core/Evented.js";import{makeHandle as n}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as s}from"../../../../../core/maybe.js";import{debounce as a}from"../../../../../core/promiseUtils.js";import{scale as l,zeroMeters as p}from"../../../../../core/quantity.js";import{initial as r,syncAndInitial as h}from"../../../../../core/reactiveUtils.js";import{property as c,subclass as d}from"../../../../../core/accessorSupport/decorators.js";import{ensureType as u}from"../../../../../core/accessorSupport/ensureType.js";import{UpdatingHandles as m}from"../../../../../core/support/UpdatingHandles.js";import v from"../../../../../geometry/Point.js";import{makeDehydratedPoint as f}from"../../../../../layers/graphics/dehydratedPoint.js";import{getConvertedElevation as _}from"../../../../../support/elevationInfoUtils.js";import{SnappingVisualizer3D as g}from"../../SnappingVisualizer3D.js";import{orientation as M}from"../geometryUtils.js";import{manipulatedObjectGeometry as y}from"../manipulatedObjectUtils.js";import{canMoveZOperations as b}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as j}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as T}from"../tooltipUtils3D.js";import{createVisualElements as w}from"../visualElementUtils.js";import{discRadius as I}from"../manipulations/config.js";import{MoveManipulation as S}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as H}from"../manipulations/moveUtils.js";import{MoveXYObjectManipulation as D}from"../manipulations/MoveXYObjectManipulation.js";import{isSupportedObject as O}from"./isSupportedObject.js";import{OutlineVisualElement as x}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as P}from"../../../support/elevationUpdateUtils.js";import{dragManipulatedObjectMany as k,resetManipulatedObjectMany as E}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as U}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as A}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import R from"../../../../interactive/sketch/SketchOptions.js";import{SnappingContext as z}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as X}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as Y,enterInputModeIfAvailable as B}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as C}from"../../../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{TranslateTooltipInfo as Z}from"../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateXYTooltipInfo as F}from"../../../../interactive/tooltip/infos/TranslateXYTooltipInfo.js";import{TranslateZTooltipInfo as G}from"../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{verticalSignedDistanceBetweenPoints as V}from"../../../../support/euclideanLengthMeasurementUtils.js";import{GeometryWorkerHandle as W}from"../../../../support/GeometryWorkerHandle.js";class N{constructor(t){this.objects=t,this.type="move-start"}}class q{constructor(t,o,e){this.dx=t,this.dy=o,this.objects=e,this.type="move"}}class L{constructor(t){this.objects=t,this.type="move-stop"}}const J=Symbol("manipulators"),K=Symbol("tooltips"),Q=Symbol("move-manipulator-display");let $=class extends U{get _infos(){return Array.from(this._infosByType.values())}constructor(t){super(t),this._infosByType=new Map,this.events=new i,this.objects=new e,this.enableZ=!0,this.sketchOptions=new R,this.type="move-3d",this._measurementWorker=new W({preloadGeodetic:!0}),this._latestTooltipInfo=null,this._translateTooltipInfo=null,this._translateXYTooltipInfo=null,this._translateZTooltipInfo=null,this._updatingHandles=new m,this._moveManipulation=null,this._updateMoveTooltipDistanceDebounced=a(this._updateMoveTooltipDistanceAsync.bind(this))}initialize(){const{view:t}=this;this.tooltip=Y(()=>({view:t,options:this.sketchOptions.tooltips})),this.addHandles(this._updatingHandles.addOnCollectionChange(()=>this.objects,t=>{t.removed.forEach(t=>this.removeHandles(t)),this._updateObjectInfos(t),this._setupFastTransformUpdates(t.added),this._refreshManipulators(),this._connectTooltips()}));const o=this.objects.toArray();this._updateObjectInfos({added:o,removed:[]}),this._setupFastTransformUpdates(o),this._refreshManipulators(),this._connectTooltips(),this.finishToolCreation()}destroy(){this.tooltip=s(this.tooltip),this._moveManipulation=s(this._moveManipulation),this._set("view",null),this._updatingHandles.destroy(),this._measurementWorker.destroy()}onInputEvent(t){if(!this.destroyed&&!B(t,this.tooltip))return super.onInputEvent(t)}get updating(){return this._updatingHandles.updating||!!this.snappingManager?.updating}get _shouldShowMovePointTooltip(){const{objects:t}=this;if(1!==t.length)return!1;const o=y(t.at(0))?.type;return"point"===o||"mesh"===o}get activeTooltipInfo(){return this._shouldShowMovePointTooltip?this._movePointTooltipInfo:this._latestTooltipInfo}reset(){}_updateObjectInfos({added:t,removed:o}){for(const e of t){if(0!==O(e))continue;const t=new ot(e);this._infosByType.set(e,t)}for(const e of o)this._infosByType.delete(e)}_setupFastTransformUpdates(t){for(const o of t){const t=this._infosByType.get(o);this.addHandles(j(t.object),o)}}_refreshManipulators(){if(this.removeHandles(J),this.removeHandles(Q),this._moveManipulation=s(this._moveManipulation),this.manipulators.removeAll(),0===this._infosByType.size)return;const t=this._infos;this._createManipulators(t),this._createVisualElements(t),this._updateMoveManipulation(t)}_createManipulators(t){for(const o of t){const e=o.object;o.manipulationXY=new D({tool:this,view:this.view,object:e}),o.manipulationXY.forEachManipulator(t=>{this.addHandles([t.events.on("immediate-click",t=>{this.events.emit("immediate-click",{...t,object:e}),t.stopPropagation()}),t.events.on("grab-changed",({action:t})=>{"start"===t?this._showTooltip(0):this._hideTooltip(),this._updateMoveManipulatorDisplay()})],J)}),this.addHandles(o.manipulationXY.createDragPipeline((o,e,i,n)=>this._buildDragEventPipeline(t,0,o,e,i,n)),J)}this._createMoveManipulation(t)}_updateMoveManipulatorDisplay(){const t=this._infos.some(t=>t.manipulationXY?.grabbing);this._moveManipulation&&(this._moveManipulation.interactive=!t),this.removeHandles(Q),t&&this._moveManipulation&&this.addHandles(this._moveManipulation.hideManipulators(),Q)}_createMoveManipulation(t){const o=new S({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:1===t.length?S.radiusForSymbol(t[0].object.graphic?.symbol):I});this._moveManipulation=o,o.elevationInfo={mode:"absolute-height",offset:0},o.forEachManipulator(t=>{this.addHandles(t.events.on("immediate-click",e=>{const i=this.objects.at(0);!o.zManipulation.hasManipulator(t)&&1===this.objects.length&&i&&this.events.emit("immediate-click",{...e,object:i}),e.stopPropagation()}),J)});const e=t=>o=>{this.addHandles([o.events.on("focus-changed",({action:o})=>{"focus"===o?this._showTooltip(t):this._hideTooltip()}),o.events.on("grab-changed",()=>{this._latestTooltipInfo&&(this._latestTooltipInfo.distance=p)})],J)};this._moveManipulation.xyManipulation.forEachManipulator(e(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(e(1)),this._moveManipulation.zManipulation.forEachManipulator(e(2));const i=()=>this._updateMoveManipulation(t);for(const p of t){this.addHandles([p.object.on("committed",i),this._updatingHandles.add(()=>p.object.visible,i)],J);const o=Symbol();this.addHandles(this._updatingHandles.add(()=>p.object.isDraped,e=>{this._updateMoveManipulation(t),this.removeHandles(o),e&&this.addHandles(P({view:this.view,geometry:p.object.graphic?.geometry,elevationInfo:p.object.elevationInfo,onElevationChanges:()=>this._updateMoveManipulation(t)}),o)},r),J),this.addHandles(n(()=>this.removeHandles(o)),J)}const s=t[t.length-1];this.addHandles(s.object.on("committed",()=>this._updateMoveManipulationAngle(s)),J);const{object:a}=s,{operations:l}=a;if(l){const e=a.graphic;this.addHandles(o.createDragPipeline((o,e,i,n,s)=>this._buildDragEventPipeline(t,o,e,i,n,s),a.elevationInfo,l.data.spatialReference,e),J)}this._updateMoveManipulationAngle(s)}_createVisualElements(t){for(const o of t){const e=o.object,i=w({view:this.view,object:e,forEachManipulator:t=>{o.manipulationXY?.forEachManipulator(t),this._moveManipulation?.forEachManipulator(t)},onManipulatorsChanged:()=>n()});null!=i&&(o.geometryRepresentation=i.visualElement,o.geometryRepresentation instanceof x&&this.addHandles([o.geometryRepresentation.events.on("attachment-origin-changed",()=>{o.object.isDraped||this._updateMoveManipulation(t)}),this._updatingHandles.add(()=>o.object.isDraped,()=>this._updateMoveManipulation(t))],J),this.addHandles(i,J))}}_updateMoveManipulationAngle(t){this._moveManipulation&&(this._moveManipulation.angle=M(y(t.object)))}_updateMoveManipulation(t){const o=f(0,0,0,this.view.spatialReference);let e=0,i=!1;const n=this._moveManipulation;if(n){for(const n of t){if(!n.object.visible)continue;this.enableZ&&b(n.object.operations,n.object.elevationInfo)&&(i=!0);const t=n.geometryRepresentation instanceof x&&!n.object.isDraped?n.geometryRepresentation.attachmentOrigin:n.object.origin;if(null!=t){const{x:i,y:n,z:s}=t;o.x+=i,o.y+=n,s&&(o.z??=0,o.z+=s),e++}}e>0?(o.x/=e,o.y/=e,o.z??=0,o.z/=e,n.location=o,n.xyManipulation.available=!0,n.xyAxisManipulation.available=!0,n.zManipulation.available=i):n.available=!1}}_buildDragEventPipeline(t,o,e,i,n,s){const a=[],l=[];let p=null,r=null;const h=()=>{for(const t of a)t.dragging=!1;a.length=0,l.length=0,p=null,r=null,this._updateMoveManipulatorDisplay()};if(1===t.length&&0===o){const o=t[0].object;({steps:i,cancel:n}=this._buildSnappingPipelineSteps(o,o.elevationInfo,i,n,s))}return n=n.next(t=>r?.(t)).next(()=>(l.length&&this.events.emit("move-stop",new L(l)),this.destroyed||h(),null)),{steps:i=i.next(o=>{if("start"===o.action){a.length=0,l.length=0;for(const o of t)o.dragging||!o.manipulationXY?.hasManipulator(e)&&o.manipulationXY?.grabbing||(a.push(o),l.push(o.object),o.dragging=!0);if(0!==l.length&&(this._moveManipulation&&(this._moveManipulation.interactive=!1),p=k(l),r=E(l),this._emitRecordUndo(),this.events.emit("move-start",new N(l)),this.destroyed))return null}return 0!==l.length?o:null}).next(t=>p?.(t)).next(t=>(this._updateMoveTooltip(o,t),t)).next(t=>{switch(t.action){case"start":case"update":if(t.translationX||t.translationY||t.translationZ){const o=this.view.toScreen(t.mapStart),e=this.view.toScreen(t.mapEnd);if(!o||!e)return null;const i=e.x-o.x,n=e.y-o.y;if(this.events.emit("move",new q(i,n,l)),this.destroyed)return null}break;case"end":if(this.events.emit("move-stop",new L(l)),this.destroyed)return null;h()}return null}),cancel:n}}_connectTooltips(){let t;if(this.removeHandles(K),this._shouldShowMovePointTooltip){const o=this.objects.at(0),{events:e}=this;this._movePointTooltipInfo??=new C({viewType:this.view.type,sketchOptions:this.sketchOptions});const i={onBeforeUpdate:()=>this.endDrag(),onMoveStart:()=>{this._emitRecordUndo(),e.emit("move-start",new N([o]))},onMove:()=>e.emit("move",new q(0,0,[o])),onMoveStop:()=>e.emit("move-stop",new L([o])),onRotateStart:()=>{},onRotate:()=>{},onRotateStop:()=>{},onScaleStart:()=>{},onScale:()=>{},onScaleStop:()=>{}};t=T(this.tooltip,o,()=>({sketchOptions:this.sketchOptions,activeTooltipInfo:this._movePointTooltipInfo,callbacks:i}))}else t=this._updatingHandles.add(()=>this.sketchOptions.tooltips.effectiveEnabled?this._latestTooltipInfo:null,t=>{this.tooltip.info=t},h);this.addHandles(t,K)}_showTooltip(t){this._shouldShowMovePointTooltip||this._updateMoveTooltip(t)}_hideTooltip(){this._shouldShowMovePointTooltip||(this.tooltip?.clear(),this._latestTooltipInfo=null)}_updateMoveTooltip(t,o){if(this._shouldShowMovePointTooltip)return;const{sketchOptions:e}=this;switch(t){case 0:this._latestTooltipInfo=this._translateTooltipInfo??=new Z({sketchOptions:e}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,o,(t,o)=>this._measurementWorker.autoDistance2DBetweenPoints(tt(t),tt(o))));break;case 1:this._latestTooltipInfo=this._translateXYTooltipInfo??=new F({sketchOptions:e}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,o,async(t,e)=>l(await this._measurementWorker.autoDistance2DBetweenPoints(tt(t),tt(e)),H(o))));break;case 2:this._latestTooltipInfo=this._translateZTooltipInfo??=new G({sketchOptions:e}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,o,V))}this._latestTooltipInfo.sketchOptions=e}async _updateMoveTooltipDistanceAsync(t,o,e){if(null!=o&&"end"!==o.action){const{mapStart:i,mapEnd:n}=o,s=await e(i,n);t.distance=s??p}else t.distance=p}_emitRecordUndo(){const t=this.objects.toArray().map(t=>t.createUndoRecord?.()).filter(o);t.length>0&&this.events.emit("record-undo",{updates:t})}_buildSnappingPipelineSteps(t,o,e,i,n){const s=y(t);if(null==s||"point"!==s.type&&"mesh"!==s.type)return{steps:e,cancel:i};const a=("point"===s.type?s:s.origin).clone(),l=new z({elevationInfo:o,pointer:n,editGeometryOperations:A.fromGeometry(a,this.view.state.viewingMode),visualizer:new g,excludeFeature:t.graphic}),p=this.snappingManager,{snappingStep:r,cancelSnapping:h}=X({snappingContext:l,snappingManager:p,updatingHandles:this._updatingHandles});return i=i.next(h),{steps:e=e.next(o=>{a.z=_(this.view,a,t.elevationInfo,{mode:"absolute-height",offset:0});return{...o,snapOrigin:l.coordinateHelper.pointToVector(a)}}).next(...r),cancel:i}}get test(){}};t([c({constructOnly:!0,nonNullable:!0})],$.prototype,"view",void 0),t([c()],$.prototype,"objects",void 0),t([c({constructOnly:!0,nonNullable:!0})],$.prototype,"enableZ",void 0),t([c({constructOnly:!0,type:R})],$.prototype,"sketchOptions",void 0),t([c({constructOnly:!0})],$.prototype,"snappingManager",void 0),t([c()],$.prototype,"type",void 0),t([c()],$.prototype,"updating",null),t([c()],$.prototype,"_latestTooltipInfo",void 0),t([c()],$.prototype,"_shouldShowMovePointTooltip",null),t([c()],$.prototype,"activeTooltipInfo",null),$=t([d("esri.views.3d.interactive.editingTools.move.MoveTool3D")],$);const tt=u(v);class ot{constructor(t){this.object=t,this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1}}export{q as MoveEvent,N as MoveStartEvent,L as MoveStopEvent,$ as MoveTool3D};
2
+ import{__decorate as t}from"tslib";import{isSome as o}from"../../../../../core/arrayUtils.js";import e from"../../../../../core/Collection.js";import{EventEmitter as i}from"../../../../../core/Evented.js";import{makeHandle as n}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as s}from"../../../../../core/maybe.js";import{debounce as a}from"../../../../../core/promiseUtils.js";import{scale as l,zeroMeters as p}from"../../../../../core/quantity.js";import{initial as r,syncAndInitial as h}from"../../../../../core/reactiveUtils.js";import{property as c,subclass as d}from"../../../../../core/accessorSupport/decorators.js";import{ensureType as u}from"../../../../../core/accessorSupport/ensureType.js";import{UpdatingHandles as m}from"../../../../../core/support/UpdatingHandles.js";import v from"../../../../../geometry/Point.js";import{makeDehydratedPoint as f}from"../../../../../layers/graphics/dehydratedPoint.js";import{getConvertedElevation as _}from"../../../../../support/elevationInfoUtils.js";import{SnappingVisualizer3D as g}from"../../SnappingVisualizer3D.js";import{orientation as M}from"../geometryUtils.js";import{manipulatedObjectGeometry as y}from"../manipulatedObjectUtils.js";import{canMoveZOperations as b}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as j}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as T}from"../tooltipUtils3D.js";import{createVisualElements as w}from"../visualElementUtils.js";import{discRadius as I}from"../manipulations/config.js";import{MoveManipulation as H}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as S}from"../manipulations/moveUtils.js";import{MoveXYObjectManipulation as D}from"../manipulations/MoveXYObjectManipulation.js";import{isSupportedObject as O}from"./isSupportedObject.js";import{OutlineVisualElement as x}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as P}from"../../../support/elevationUpdateUtils.js";import{dragManipulatedObjectMany as E,resetManipulatedObjectMany as U}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as A}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as R}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import z from"../../../../interactive/options/InteractiveToolOptions.js";import{SnappingContext as k}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as X}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as Y,enterInputModeIfAvailable as B}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as C}from"../../../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{TranslateTooltipInfo as Z}from"../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateXYTooltipInfo as F}from"../../../../interactive/tooltip/infos/TranslateXYTooltipInfo.js";import{TranslateZTooltipInfo as G}from"../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{verticalSignedDistanceBetweenPoints as V}from"../../../../support/euclideanLengthMeasurementUtils.js";import{GeometryWorkerHandle as W}from"../../../../support/GeometryWorkerHandle.js";class N{constructor(t){this.objects=t,this.type="move-start"}}class q{constructor(t,o,e){this.dx=t,this.dy=o,this.objects=e,this.type="move"}}class L{constructor(t){this.objects=t,this.type="move-stop"}}const J=Symbol("manipulators"),K=Symbol("tooltips"),Q=Symbol("move-manipulator-display");let $=class extends A{get _infos(){return Array.from(this._infosByType.values())}constructor(t){super(t),this._infosByType=new Map,this.events=new i,this.objects=new e,this.enableZ=!0,this.toolOptions=new z,this.type="move-3d",this._measurementWorker=new W({preloadGeodetic:!0}),this._latestTooltipInfo=null,this._translateTooltipInfo=null,this._translateXYTooltipInfo=null,this._translateZTooltipInfo=null,this._updatingHandles=new m,this._moveManipulation=null,this._updateMoveTooltipDistanceDebounced=a(this._updateMoveTooltipDistanceAsync.bind(this))}initialize(){const{view:t}=this;this.tooltip=Y(()=>({view:t,options:this.toolOptions.tooltips})),this.addHandles(this._updatingHandles.addOnCollectionChange(()=>this.objects,t=>{t.removed.forEach(t=>this.removeHandles(t)),this._updateObjectInfos(t),this._setupFastTransformUpdates(t.added),this._refreshManipulators(),this._connectTooltips()}));const o=this.objects.toArray();this._updateObjectInfos({added:o,removed:[]}),this._setupFastTransformUpdates(o),this._refreshManipulators(),this._connectTooltips(),this.finishToolCreation()}destroy(){this.tooltip=s(this.tooltip),this._moveManipulation=s(this._moveManipulation),this._set("view",null),this._updatingHandles.destroy(),this._measurementWorker.destroy()}onInputEvent(t){if(!this.destroyed&&!B(t,this.tooltip))return super.onInputEvent(t)}get updating(){return this._updatingHandles.updating||!!this.snappingManager?.updating}get _shouldShowMovePointTooltip(){const{objects:t}=this;if(1!==t.length)return!1;const o=y(t.at(0))?.type;return"point"===o||"mesh"===o}get activeTooltipInfo(){return this._shouldShowMovePointTooltip?this._movePointTooltipInfo:this._latestTooltipInfo}reset(){}_updateObjectInfos({added:t,removed:o}){for(const e of t){if(0!==O(e))continue;const t=new ot(e);this._infosByType.set(e,t)}for(const e of o)this._infosByType.delete(e)}_setupFastTransformUpdates(t){for(const o of t){const t=this._infosByType.get(o);this.addHandles(j(t.object),o)}}_refreshManipulators(){if(this.removeHandles(J),this.removeHandles(Q),this._moveManipulation=s(this._moveManipulation),this.manipulators.removeAll(),0===this._infosByType.size)return;const t=this._infos;this._createManipulators(t),this._createVisualElements(t),this._updateMoveManipulation(t)}_createManipulators(t){for(const o of t){const e=o.object;o.manipulationXY=new D({tool:this,view:this.view,object:e}),o.manipulationXY.forEachManipulator(t=>{this.addHandles([t.events.on("immediate-click",t=>{this.events.emit("immediate-click",{...t,object:e}),t.stopPropagation()}),t.events.on("grab-changed",({action:t})=>{"start"===t?this._showTooltip(0):this._hideTooltip(),this._updateMoveManipulatorDisplay()})],J)}),this.addHandles(o.manipulationXY.createDragPipeline((o,e,i,n)=>this._buildDragEventPipeline(t,0,o,e,i,n)),J)}this._createMoveManipulation(t)}_updateMoveManipulatorDisplay(){const t=this._infos.some(t=>t.manipulationXY?.grabbing);this._moveManipulation&&(this._moveManipulation.interactive=!t),this.removeHandles(Q),t&&this._moveManipulation&&this.addHandles(this._moveManipulation.hideManipulators(),Q)}_createMoveManipulation(t){const o=new H({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:1===t.length?H.radiusForSymbol(t[0].object.graphic?.symbol):I});this._moveManipulation=o,o.elevationInfo={mode:"absolute-height",offset:0},o.forEachManipulator(t=>{this.addHandles(t.events.on("immediate-click",e=>{const i=this.objects.at(0);!o.zManipulation.hasManipulator(t)&&1===this.objects.length&&i&&this.events.emit("immediate-click",{...e,object:i}),e.stopPropagation()}),J)});const e=t=>o=>{this.addHandles([o.events.on("focus-changed",({action:o})=>{"focus"===o?this._showTooltip(t):this._hideTooltip()}),o.events.on("grab-changed",()=>{this._latestTooltipInfo&&(this._latestTooltipInfo.distance=p)})],J)};this._moveManipulation.xyManipulation.forEachManipulator(e(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(e(1)),this._moveManipulation.zManipulation.forEachManipulator(e(2));const i=()=>this._updateMoveManipulation(t);for(const p of t){this.addHandles([p.object.on("committed",i),this._updatingHandles.add(()=>p.object.visible,i)],J);const o=Symbol();this.addHandles(this._updatingHandles.add(()=>p.object.isDraped,e=>{this._updateMoveManipulation(t),this.removeHandles(o),e&&this.addHandles(P({view:this.view,geometry:p.object.graphic?.geometry,elevationInfo:p.object.elevationInfo,onElevationChanges:()=>this._updateMoveManipulation(t)}),o)},r),J),this.addHandles(n(()=>this.removeHandles(o)),J)}const s=t[t.length-1];this.addHandles(s.object.on("committed",()=>this._updateMoveManipulationAngle(s)),J);const{object:a}=s,{operations:l}=a;if(l){const e=a.graphic;this.addHandles(o.createDragPipeline((o,e,i,n,s)=>this._buildDragEventPipeline(t,o,e,i,n,s),a.elevationInfo,l.data.spatialReference,e),J)}this._updateMoveManipulationAngle(s)}_createVisualElements(t){for(const o of t){const e=o.object,i=w({view:this.view,object:e,forEachManipulator:t=>{o.manipulationXY?.forEachManipulator(t),this._moveManipulation?.forEachManipulator(t)},onManipulatorsChanged:()=>n()});null!=i&&(o.geometryRepresentation=i.visualElement,o.geometryRepresentation instanceof x&&this.addHandles([o.geometryRepresentation.events.on("attachment-origin-changed",()=>{o.object.isDraped||this._updateMoveManipulation(t)}),this._updatingHandles.add(()=>o.object.isDraped,()=>this._updateMoveManipulation(t))],J),this.addHandles(i,J))}}_updateMoveManipulationAngle(t){this._moveManipulation&&(this._moveManipulation.angle=M(y(t.object)))}_updateMoveManipulation(t){const o=f(0,0,0,this.view.spatialReference);let e=0,i=!1;const n=this._moveManipulation;if(n){for(const n of t){if(!n.object.visible)continue;this.enableZ&&b(n.object.operations,n.object.elevationInfo)&&(i=!0);const t=n.geometryRepresentation instanceof x&&!n.object.isDraped?n.geometryRepresentation.attachmentOrigin:n.object.origin;if(null!=t){const{x:i,y:n,z:s}=t;o.x+=i,o.y+=n,s&&(o.z??=0,o.z+=s),e++}}e>0?(o.x/=e,o.y/=e,o.z??=0,o.z/=e,n.location=o,n.xyManipulation.available=!0,n.xyAxisManipulation.available=!0,n.zManipulation.available=i):n.available=!1}}_buildDragEventPipeline(t,o,e,i,n,s){const a=[],l=[];let p=null,r=null;const h=()=>{for(const t of a)t.dragging=!1;a.length=0,l.length=0,p=null,r=null,this._updateMoveManipulatorDisplay()};if(1===t.length&&0===o){const o=t[0].object;({steps:i,cancel:n}=this._buildSnappingPipelineSteps(o,o.elevationInfo,i,n,s))}return n=n.next(t=>r?.(t)).next(()=>(l.length&&this.events.emit("move-stop",new L(l)),this.destroyed||h(),null)),{steps:i=i.next(o=>{if("start"===o.action){a.length=0,l.length=0;for(const o of t)o.dragging||!o.manipulationXY?.hasManipulator(e)&&o.manipulationXY?.grabbing||(a.push(o),l.push(o.object),o.dragging=!0);if(0!==l.length&&(this._moveManipulation&&(this._moveManipulation.interactive=!1),p=E(l),r=U(l),this._emitRecordUndo(),this.events.emit("move-start",new N(l)),this.destroyed))return null}return 0!==l.length?o:null}).next(t=>p?.(t)).next(t=>(this._updateMoveTooltip(o,t),t)).next(t=>{switch(t.action){case"start":case"update":if(t.translationX||t.translationY||t.translationZ){const o=this.view.toScreen(t.mapStart),e=this.view.toScreen(t.mapEnd);if(!o||!e)return null;const i=e.x-o.x,n=e.y-o.y;if(this.events.emit("move",new q(i,n,l)),this.destroyed)return null}break;case"end":if(this.events.emit("move-stop",new L(l)),this.destroyed)return null;h()}return null}),cancel:n}}_connectTooltips(){let t;if(this.removeHandles(K),this._shouldShowMovePointTooltip){const o=this.objects.at(0),{events:e}=this;this._movePointTooltipInfo??=new C({viewType:this.view.type,toolOptions:this.toolOptions});const i={onBeforeUpdate:()=>this.endDrag(),onMoveStart:()=>{this._emitRecordUndo(),e.emit("move-start",new N([o]))},onMove:()=>e.emit("move",new q(0,0,[o])),onMoveStop:()=>e.emit("move-stop",new L([o])),onRotateStart:()=>{},onRotate:()=>{},onRotateStop:()=>{},onScaleStart:()=>{},onScale:()=>{},onScaleStop:()=>{}};t=T(this.tooltip,o,()=>({toolOptions:this.toolOptions,activeTooltipInfo:this._movePointTooltipInfo,callbacks:i}))}else t=this._updatingHandles.add(()=>this.toolOptions.tooltips.effectiveEnabled?this._latestTooltipInfo:null,t=>{this.tooltip.info=t},h);this.addHandles(t,K)}_showTooltip(t){this._shouldShowMovePointTooltip||this._updateMoveTooltip(t)}_hideTooltip(){this._shouldShowMovePointTooltip||(this.tooltip?.clear(),this._latestTooltipInfo=null)}_updateMoveTooltip(t,o){if(this._shouldShowMovePointTooltip)return;const{toolOptions:e}=this;switch(t){case 0:this._latestTooltipInfo=this._translateTooltipInfo??=new Z({toolOptions:e}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,o,(t,o)=>this._measurementWorker.autoDistance2DBetweenPoints(tt(t),tt(o))));break;case 1:this._latestTooltipInfo=this._translateXYTooltipInfo??=new F({toolOptions:e}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,o,async(t,e)=>l(await this._measurementWorker.autoDistance2DBetweenPoints(tt(t),tt(e)),S(o))));break;case 2:this._latestTooltipInfo=this._translateZTooltipInfo??=new G({toolOptions:e}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,o,V))}this._latestTooltipInfo.toolOptions=e}async _updateMoveTooltipDistanceAsync(t,o,e){if(null!=o&&"end"!==o.action){const{mapStart:i,mapEnd:n}=o,s=await e(i,n);t.distance=s??p}else t.distance=p}_emitRecordUndo(){const t=this.objects.toArray().map(t=>t.createUndoRecord?.()).filter(o);t.length>0&&this.events.emit("record-undo",{updates:t})}_buildSnappingPipelineSteps(t,o,e,i,n){const s=y(t);if(null==s||"point"!==s.type&&"mesh"!==s.type)return{steps:e,cancel:i};const a=("point"===s.type?s:s.origin).clone(),l=new k({elevationInfo:o,pointer:n,editGeometryOperations:R.fromGeometry(a,this.view.state.viewingMode),visualizer:new g,excludeFeature:t.graphic}),p=this.snappingManager,{snappingStep:r,cancelSnapping:h}=X({snappingContext:l,snappingManager:p,updatingHandles:this._updatingHandles});return i=i.next(h),{steps:e=e.next(o=>{a.z=_(this.view,a,t.elevationInfo,{mode:"absolute-height",offset:0});return{...o,snapOrigin:l.coordinateHelper.pointToVector(a)}}).next(...r),cancel:i}}get test(){}};t([c({constructOnly:!0,nonNullable:!0})],$.prototype,"view",void 0),t([c()],$.prototype,"objects",void 0),t([c({constructOnly:!0,nonNullable:!0})],$.prototype,"enableZ",void 0),t([c({constructOnly:!0,type:z})],$.prototype,"toolOptions",void 0),t([c({constructOnly:!0})],$.prototype,"snappingManager",void 0),t([c()],$.prototype,"type",void 0),t([c()],$.prototype,"updating",null),t([c()],$.prototype,"_latestTooltipInfo",void 0),t([c()],$.prototype,"_shouldShowMovePointTooltip",null),t([c()],$.prototype,"activeTooltipInfo",null),$=t([d("esri.views.3d.interactive.editingTools.move.MoveTool3D")],$);const tt=u(v);class ot{constructor(t){this.object=t,this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1}}export{q as MoveEvent,N as MoveStartEvent,L as MoveStopEvent,$ as MoveTool3D};