@arcgis/core 4.24.0-next.20220427 → 4.24.0-next.20220430

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 (276) hide show
  1. package/WebMap.js +1 -1
  2. package/analysis/LineOfSightAnalysis.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/{3a43a2918b44781aaf85.js → 055a0ebf22a82f859474.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{3273b6be43eeb49ee842.js → 0b12ff7b2ed2838afbb8.js} +1 -1
  6. package/assets/esri/core/workers/chunks/0e25548573baf855e394.js +1 -0
  7. package/assets/esri/core/workers/chunks/0edd4c3ca6e7d749d0e5.js +1 -0
  8. package/assets/esri/core/workers/chunks/133f971e72a1a6277ac4.js +1 -0
  9. package/assets/esri/core/workers/chunks/{c388ac33496f004d56f3.js → 135a90ae61f3b3cae91b.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{54f9b1ab9d472bf4baca.js → 1facbda248863cf72cbd.js} +1 -1
  11. package/assets/esri/core/workers/chunks/1fb2d7abe6c8efa84695.js +1 -0
  12. package/assets/esri/core/workers/chunks/2133499e642193f6738f.js +1 -0
  13. package/assets/esri/core/workers/chunks/{dee63bfc108b4e5893a3.js → 2cf3934b3ecabdf207c8.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{3c572629f46e5093223c.js → 30333a95dc0a44e23fb5.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{7afe89eafab00afb31f2.js → 30837d93116f0337972f.js} +1 -1
  16. package/assets/esri/core/workers/chunks/31df729c17470245288c.js +2 -0
  17. package/assets/esri/core/workers/chunks/{c0bf663240df7be68131.js.LICENSE.txt → 31df729c17470245288c.js.LICENSE.txt} +1 -1
  18. package/assets/esri/core/workers/chunks/4130ea1f5a9f197168d7.js +1 -0
  19. package/assets/esri/core/workers/chunks/{417ee7a88575cb8f9aaf.js → 492b65fe99641f5740f0.js} +1 -1
  20. package/assets/esri/core/workers/chunks/4cdd29e1f3a1c7a39af7.js +1 -0
  21. package/assets/esri/core/workers/chunks/{9a0073d43b7dbaeba736.js → 541e644fc77dbe527124.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{5a61a12b2492c6eae592.js → 59e341b2db44351bf557.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{73630d52768e3d932f30.js → 5a10b58533b4116115ac.js} +1 -1
  24. package/assets/esri/core/workers/chunks/5fd787f63362defc984f.js +1 -0
  25. package/assets/esri/core/workers/chunks/682a8f15f352de76df69.js +1 -0
  26. package/assets/esri/core/workers/chunks/6a06635089761ee3e6d4.js +972 -0
  27. package/assets/esri/core/workers/chunks/{ab0c0c29d54f2ed954d6.js → 86b31ae136f931d7884a.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{dc193247a1980360ec4f.js → 8e98ff9404a802352037.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{863cfe35ee640bac103f.js → 94e51fe1c539df6257c2.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{cbe7e6283a427a618d4b.js → 9519a02b9b8db88a3150.js} +1 -1
  31. package/assets/esri/core/workers/chunks/9f3a094aa4b47e4eb046.js +1 -0
  32. package/assets/esri/core/workers/chunks/{50d256bc3b213c8a1b09.js → a0ebf25c9c9a7f839b93.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{d8a992dee594a6a64fde.js → a25f0a195f9217665530.js} +1 -1
  34. package/assets/esri/core/workers/chunks/a59ee7d2b98c85f27dd2.js +1 -0
  35. package/assets/esri/core/workers/chunks/{92ef9b0c61640e0ecbb4.js → a5dbab94697757c87c49.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{147d3ee9aa81d7b2b7fa.js → a6406a248b7b2ed65f35.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{ebdf61eb364ac0856f40.js → acbd0f4d72d1f5d8e4e8.js} +1 -1
  38. package/assets/esri/core/workers/chunks/acc97a210f36bff2d1b0.js +1 -0
  39. package/assets/esri/core/workers/chunks/ad68fe924456d6d7d4f0.js +1 -0
  40. package/assets/esri/core/workers/chunks/b06c949fc7d08e376a5f.js +1 -0
  41. package/assets/esri/core/workers/chunks/b4405e9fe6c0cf7250d3.js +1 -0
  42. package/assets/esri/core/workers/chunks/b97a34d2e7cceef1ac41.js +1 -0
  43. package/assets/esri/core/workers/chunks/bc08fe3b03767bd694c5.js +1 -0
  44. package/assets/esri/core/workers/chunks/c9b09099488d0e719dfb.js +1 -0
  45. package/assets/esri/core/workers/chunks/{4a05d0dfa73ff570e1fa.js → d15e6662d90718411d62.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{b74b9dceabbf7b1aec39.js → d16aac3461af9cee0c29.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{bb678bc2e2fc48112e07.js → d60dd3e1028f714f2258.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{31c1ae0532dd991da63d.js → d6c150c243ca1f6108f9.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{cab6decfcb3f596a3837.js → d8c59b1d73650c060dfb.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{d24339b37cc9316e6d99.js → dcb6e1b33402d7fa455b.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{a8da24116180d708cf81.js → df653bca2b14dffc82d1.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{a3db91d04fe1fca0fe4f.js → e06461703e6f1acfcfdc.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{423e199c2f695e913c0e.js → e3e1d87b8532bf84a18d.js} +1 -1
  54. package/assets/esri/core/workers/chunks/e7744b7e0c16bba93151.js +1 -0
  55. package/assets/esri/core/workers/chunks/ea50effc5c39870dc871.js +1 -0
  56. package/assets/esri/core/workers/chunks/fc4fd9db056579e09bfe.js +1 -0
  57. package/assets/esri/core/workers/chunks/fc9b5f40c5179a8c90de.js +1 -0
  58. package/assets/esri/core/workers/chunks/fd35b69872ac9393924f.js +1 -0
  59. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_ar.json +1 -1
  60. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_bg.json +1 -1
  61. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_bs.json +1 -1
  62. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_ca.json +1 -1
  63. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_cs.json +1 -1
  64. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_da.json +1 -1
  65. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_de.json +1 -1
  66. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_el.json +1 -1
  67. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_es.json +1 -1
  68. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_et.json +1 -1
  69. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_fi.json +1 -1
  70. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_fr.json +1 -1
  71. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_he.json +1 -1
  72. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_hr.json +1 -1
  73. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_hu.json +1 -1
  74. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_id.json +1 -1
  75. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_it.json +1 -1
  76. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_ja.json +1 -1
  77. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_ko.json +1 -1
  78. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_lt.json +1 -1
  79. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_lv.json +1 -1
  80. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_nb.json +1 -1
  81. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_nl.json +1 -1
  82. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_pl.json +1 -1
  83. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_pt-BR.json +1 -1
  84. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_pt-PT.json +1 -1
  85. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_ro.json +1 -1
  86. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_ru.json +1 -1
  87. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_sk.json +1 -1
  88. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_sl.json +1 -1
  89. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_sr.json +1 -1
  90. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_sv.json +1 -1
  91. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_th.json +1 -1
  92. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_tr.json +1 -1
  93. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_uk.json +1 -1
  94. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_vi.json +1 -1
  95. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_zh-CN.json +1 -1
  96. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_zh-HK.json +1 -1
  97. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_zh-TW.json +1 -1
  98. package/assets/esri/widgets/Weather/t9n/Weather_ar.json +1 -1
  99. package/assets/esri/widgets/Weather/t9n/Weather_bg.json +1 -1
  100. package/assets/esri/widgets/Weather/t9n/Weather_bs.json +1 -1
  101. package/assets/esri/widgets/Weather/t9n/Weather_ca.json +1 -1
  102. package/assets/esri/widgets/Weather/t9n/Weather_cs.json +1 -1
  103. package/assets/esri/widgets/Weather/t9n/Weather_da.json +1 -1
  104. package/assets/esri/widgets/Weather/t9n/Weather_de.json +1 -1
  105. package/assets/esri/widgets/Weather/t9n/Weather_el.json +1 -1
  106. package/assets/esri/widgets/Weather/t9n/Weather_es.json +1 -1
  107. package/assets/esri/widgets/Weather/t9n/Weather_et.json +1 -1
  108. package/assets/esri/widgets/Weather/t9n/Weather_fi.json +1 -1
  109. package/assets/esri/widgets/Weather/t9n/Weather_fr.json +1 -1
  110. package/assets/esri/widgets/Weather/t9n/Weather_he.json +1 -1
  111. package/assets/esri/widgets/Weather/t9n/Weather_hr.json +1 -1
  112. package/assets/esri/widgets/Weather/t9n/Weather_hu.json +1 -1
  113. package/assets/esri/widgets/Weather/t9n/Weather_id.json +1 -1
  114. package/assets/esri/widgets/Weather/t9n/Weather_it.json +1 -1
  115. package/assets/esri/widgets/Weather/t9n/Weather_ja.json +1 -1
  116. package/assets/esri/widgets/Weather/t9n/Weather_ko.json +1 -1
  117. package/assets/esri/widgets/Weather/t9n/Weather_lt.json +1 -1
  118. package/assets/esri/widgets/Weather/t9n/Weather_lv.json +1 -1
  119. package/assets/esri/widgets/Weather/t9n/Weather_nb.json +1 -1
  120. package/assets/esri/widgets/Weather/t9n/Weather_nl.json +1 -1
  121. package/assets/esri/widgets/Weather/t9n/Weather_pl.json +1 -1
  122. package/assets/esri/widgets/Weather/t9n/Weather_pt-BR.json +1 -1
  123. package/assets/esri/widgets/Weather/t9n/Weather_pt-PT.json +1 -1
  124. package/assets/esri/widgets/Weather/t9n/Weather_ro.json +1 -1
  125. package/assets/esri/widgets/Weather/t9n/Weather_ru.json +1 -1
  126. package/assets/esri/widgets/Weather/t9n/Weather_sk.json +1 -1
  127. package/assets/esri/widgets/Weather/t9n/Weather_sl.json +1 -1
  128. package/assets/esri/widgets/Weather/t9n/Weather_sr.json +1 -1
  129. package/assets/esri/widgets/Weather/t9n/Weather_sv.json +1 -1
  130. package/assets/esri/widgets/Weather/t9n/Weather_th.json +1 -1
  131. package/assets/esri/widgets/Weather/t9n/Weather_tr.json +1 -1
  132. package/assets/esri/widgets/Weather/t9n/Weather_uk.json +1 -1
  133. package/assets/esri/widgets/Weather/t9n/Weather_vi.json +1 -1
  134. package/assets/esri/widgets/Weather/t9n/Weather_zh-CN.json +1 -1
  135. package/assets/esri/widgets/Weather/t9n/Weather_zh-HK.json +1 -1
  136. package/assets/esri/widgets/Weather/t9n/Weather_zh-TW.json +1 -1
  137. package/chunks/ColorMaterial.glsl.js +4 -4
  138. package/chunks/LineMarker.glsl.js +12 -12
  139. package/chunks/Pattern.glsl.js +17 -17
  140. package/chunks/RibbonLine.glsl.js +34 -34
  141. package/chunks/ShadedColorMaterial.glsl.js +11 -11
  142. package/chunks/index.js +1 -1
  143. package/chunks/sphere.js +1 -1
  144. package/config.js +1 -1
  145. package/core/workers/RemoteClient.js +1 -1
  146. package/core/workers/WorkerHandle.js +1 -1
  147. package/geometry/support/sphere.js +1 -1
  148. package/interfaces.d.ts +74 -20
  149. package/layers/mixins/PortalLayer.js +1 -1
  150. package/layers/support/LercDecoder.js +1 -1
  151. package/package.json +2 -2
  152. package/request.js +1 -1
  153. package/support/elevationInfoUtils.js +1 -1
  154. package/support/revision.js +1 -1
  155. package/symbols/support/previewSymbol2D.js +1 -1
  156. package/views/2d/engine/brushes.js +1 -1
  157. package/views/2d/engine/vectorTiles/TileParser.js +1 -1
  158. package/views/2d/engine/webgl/GraphicDisplayList.js +1 -1
  159. package/views/2d/engine/webgl/Painter.js +1 -1
  160. package/views/2d/engine/webgl/WGLRendererInfo.js +1 -1
  161. package/views/2d/engine/webgl/brushes/WGLBrushDotDensity.js +5 -0
  162. package/views/2d/engine/webgl/brushes/WGLBrushHeatmap.js +5 -0
  163. package/views/2d/engine/webgl/brushes/WGLGeometryBrush.js +1 -1
  164. package/views/2d/engine/webgl/brushes/WGLGeometryBrushFill.js +1 -1
  165. package/views/2d/engine/webgl/brushes/WGLGeometryBrushLabel.js +1 -1
  166. package/views/2d/engine/webgl/brushes/WGLGeometryBrushLine.js +1 -1
  167. package/views/2d/engine/webgl/brushes/WGLGeometryBrushMarker.js +1 -1
  168. package/views/2d/engine/webgl/brushes/WGLGeometryBrushText.js +1 -1
  169. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  170. package/views/2d/engine/webgl/techniques/Technique.js +5 -0
  171. package/views/2d/engine/webgl/techniques/dotDensity/TechniqueDotDensity.js +5 -0
  172. package/views/2d/engine/webgl/techniques/heatmap/TechniqueHeatmap.js +5 -0
  173. package/views/2d/engine/webgl/techniques/utils.js +5 -0
  174. package/views/2d/layers/features/schemaUtils.js +1 -1
  175. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  176. package/views/2d/layers/features/support/GraphicsReader.js +1 -1
  177. package/views/2d/layers/features/tileRenderers/support/WGLFeatureView.js +1 -1
  178. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  179. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  180. package/views/3d/camera/constraintUtils/distance.js +1 -1
  181. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  182. package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
  183. package/views/3d/interactive/analysisTools/lineOfSight/LineOfSightTool.js +1 -1
  184. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
  185. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
  186. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
  187. package/views/3d/layers/I3SMeshView3D.js +1 -1
  188. package/views/3d/layers/I3SMeshWorkerHandle.js +1 -1
  189. package/views/3d/layers/I3SPointsWorkerHandle.js +1 -1
  190. package/views/3d/layers/PointCloudWorkerHandle.js +1 -1
  191. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  192. package/views/3d/layers/i3s/I3SElevationProvider.js +1 -1
  193. package/views/3d/layers/i3s/I3SNode.js +1 -1
  194. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  195. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  196. package/views/3d/state/utils/navigationUtils.js +1 -1
  197. package/views/3d/support/PBFDecoder.js +1 -1
  198. package/views/3d/support/geometryUtils/sphere.js +1 -1
  199. package/views/3d/terrain/OverlayManager.js +1 -1
  200. package/views/3d/terrain/OverlayRenderer.js +1 -1
  201. package/views/3d/terrain/PatchRenderData.js +1 -1
  202. package/views/3d/terrain/TerrainSurface.js +1 -1
  203. package/views/3d/terrain/Tile.js +1 -1
  204. package/views/3d/terrain/tileUtils.js +1 -1
  205. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  206. package/views/3d/webgl-engine/collections/Component/IndexRange/ComponentRangeRunLengthEncoded.js +1 -1
  207. package/views/3d/webgl-engine/lib/DrapedHeatmapRenderer.js +1 -1
  208. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  209. package/views/3d/webgl-engine/lib/edgeRendering/EdgeProcessingWorker.js +1 -1
  210. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  211. package/views/3d/webgl-engine/lib/edgeRendering/EdgeWorkerHandle.js +1 -1
  212. package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
  213. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  214. package/views/3d/webgl-engine/shaders/HeatmapTechnique.js +1 -1
  215. package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
  216. package/views/interactive/snapping/LineSnapper.js +1 -1
  217. package/views/interactive/snapping/ParallelLineSnapper.js +1 -1
  218. package/views/interactive/snapping/RightAngleSnapper.js +1 -1
  219. package/views/interactive/snapping/RightAngleTriangleSnapper.js +1 -1
  220. package/views/interactive/snapping/SnappingManager.js +1 -1
  221. package/views/interactive/snapping/candidates/EdgeSnappingCandidate.js +1 -1
  222. package/views/interactive/snapping/candidates/FeatureSnappingCandidate.js +1 -1
  223. package/views/interactive/snapping/candidates/IntersectionSnappingCandidate.js +1 -1
  224. package/views/interactive/snapping/candidates/LineSnappingCandidate.js +1 -1
  225. package/views/interactive/snapping/candidates/ParallelLineSnappingCandidate.js +1 -1
  226. package/views/interactive/snapping/candidates/RightAngleSnappingCandidate.js +1 -1
  227. package/views/interactive/snapping/candidates/RightAngleTriangleSnappingCandidate.js +1 -1
  228. package/views/interactive/snapping/candidates/SnappingCandidate.js +1 -1
  229. package/views/interactive/snapping/candidates/VertexSnappingCandidate.js +1 -1
  230. package/views/interactive/snapping/featureSources/FeatureCollectionSnappingSource.js +1 -1
  231. package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
  232. package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
  233. package/views/interactive/snapping/featureSources/SceneLayerSnappingSource.js +5 -0
  234. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorkerHandle.js +1 -1
  235. package/views/interactive/snapping/featureSources/queryEngineUtils.js +1 -1
  236. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +5 -0
  237. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorkerHandle.js +5 -0
  238. package/views/interactive/snapping/hints/IntersectionSnappingHint.js +1 -1
  239. package/views/interactive/snapping/hints/LineSnappingHint.js +1 -1
  240. package/views/interactive/snapping/hints/ParallelSnappingHint.js +1 -1
  241. package/views/interactive/snapping/hints/PointSnappingHint.js +1 -1
  242. package/views/interactive/snapping/hints/RightAngleSnappingHint.js +1 -1
  243. package/views/interactive/snapping/hints/SnappingHint.js +1 -1
  244. package/views/interactive/snapping/snappingUtils.js +1 -1
  245. package/views/support/colorUtils.js +1 -1
  246. package/webmap/Bookmark.js +1 -1
  247. package/widgets/AreaMeasurement3D/AreaMeasurement3DViewModel.js +1 -1
  248. package/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js +1 -1
  249. package/widgets/FeatureTable/Grid/Grid.js +2 -2
  250. package/widgets/LineOfSight/LineOfSightViewModel.js +1 -1
  251. package/widgets/Sketch/SketchViewModel.js +1 -1
  252. package/widgets/Slice/SliceViewModel.js +1 -1
  253. package/widgets/support/AnalysisViewModel.js +1 -1
  254. package/widgets/support/InteractiveAnalysisViewModel.js +1 -1
  255. package/assets/esri/core/workers/chunks/2266d6388444ac5d50b3.js +0 -1
  256. package/assets/esri/core/workers/chunks/3f6b17c9d2629ed396da.js +0 -1
  257. package/assets/esri/core/workers/chunks/404f1d7bce014c7e6965.js +0 -1
  258. package/assets/esri/core/workers/chunks/4e4994665549435f51ee.js +0 -1
  259. package/assets/esri/core/workers/chunks/503226c5c612feab4115.js +0 -1
  260. package/assets/esri/core/workers/chunks/528033aa0d663b4d41bf.js +0 -1
  261. package/assets/esri/core/workers/chunks/54af957c5330933805a3.js +0 -1
  262. package/assets/esri/core/workers/chunks/6ef8de3aa9a8d9c22161.js +0 -1
  263. package/assets/esri/core/workers/chunks/72d8b2ad36f0d0a40a0d.js +0 -1
  264. package/assets/esri/core/workers/chunks/756befc4aa3354e1db1d.js +0 -972
  265. package/assets/esri/core/workers/chunks/8a4e2831e8fdde530b21.js +0 -1
  266. package/assets/esri/core/workers/chunks/9b9821772b6cbe189fe0.js +0 -1
  267. package/assets/esri/core/workers/chunks/9c4d41f20c1a94147344.js +0 -1
  268. package/assets/esri/core/workers/chunks/9cfd66ee9e6328b3693a.js +0 -1
  269. package/assets/esri/core/workers/chunks/b548bf032c8af34fe155.js +0 -1
  270. package/assets/esri/core/workers/chunks/bbcae04235830debd814.js +0 -1
  271. package/assets/esri/core/workers/chunks/bc6f5927f07c5993b998.js +0 -1
  272. package/assets/esri/core/workers/chunks/c0bf663240df7be68131.js +0 -2
  273. package/assets/esri/core/workers/chunks/cd9668acbe3babd2b188.js +0 -1
  274. package/assets/esri/core/workers/chunks/d53c7a9ede56be749f2b.js +0 -1
  275. package/assets/esri/core/workers/chunks/e07930ab66f89d215666.js +0 -1
  276. package/assets/esri/core/workers/chunks/f72de828ede4d0c5e9d7.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../../core/Error.js";import e from"../../../../../core/has.js";import i from"../../../../../core/Logger.js";import{clamp as s}from"../../../../../core/mathUtils.js";import{isNone as r,isSome as a,mapMany as o,forEachSome as n,applySome as l,unwrap as h}from"../../../../../core/maybe.js";import{createResolver as c,isAbortError as u}from"../../../../../core/promiseUtils.js";import{diff as d}from"../../../../../core/accessorSupport/diffUtils.js";import p from"../../../../../layers/support/FieldsIndex.js";import{MAX_FILTERS as _,HIGHLIGHT_FLAG as g,ATTRIBUTE_DATA_VV as f,NAN_MAGIC_NUMBER as m,ATTRIBUTE_DATA_ANIMATION as y,ATTRIBUTE_DATA_GPGPU as x}from"../../../engine/webgl/definitions.js";import{DISPLAY_ID_TYPE_AGGREGATE as b,DISPLAY_ID_TYPE_FEATURE as T,getDisplayIdTexel as z,getDisplayIdType as S,getDisplayIdFilterMask as E}from"../../../engine/webgl/DisplayId.js";import{getPixelArrayCtor as w}from"../../../engine/webgl/Utils.js";import{createDebugLogger as A,DEBUG_ATTR_UPDATES as D}from"../../../engine/webgl/util/debug.js";import{getVisualVariableSizeValueRepresentationRatio as k}from"../tileRenderers/support/visualVariablesUtils.js";import{PixelType as U}from"../../../../webgl/enums.js";const F=i.getLogger("esri.views.layers.2d.features.support.AttributeStore"),B=A(D,F),C={sharedArrayBuffer:e("esri-shared-array-buffer"),atomics:e("esri-atomics")};function R(t,e){return i=>e(t(i))}class I{constructor(t,e,i,s){this.size=0,this.texelSize=4;const{pixelType:r,layout:a,textureOnly:o}=s;this.textureOnly=o||!1,this.pixelType=r,this._ctype=e,this.layout=a,this._resetRange(),this._shared=t,this.size=i,o||(this.data=this._initData(r,i,t,e))}get buffer(){return l(this.data,(t=>t.buffer))}unsetComponentAllTexels(t,e){const i=h(this.data);for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]&=~e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponentAllTexels(t,e){const i=h(this.data);for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]|=255&e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponent(t,e,i){const s=h(this.data);for(const r of i)s[r*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r)}setComponentTexel(t,e,i){h(this.data)[i*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}unsetComponentTexel(t,e,i){h(this.data)[i*this.texelSize+t]&=~e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}getData(t,e){const i=z(t);return h(this.data)[i*this.texelSize+e]}setData(t,e,i){const s=z(t),r=1<<e;0!=(this.layout&r)?(this.data[s*this.texelSize+e]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)):F.error("mapview-attributes-store","Tried to set a value for a texel's readonly component")}lock(){this.pixelType===U.UNSIGNED_BYTE&&this._shared&&C.atomics&&"local"!==this._ctype&&Atomics.store(this.data,0,1)}unlock(){this.pixelType===U.UNSIGNED_BYTE&&this._shared&&C.atomics&&"local"!==this._ctype&&Atomics.store(this.data,0,0)}expand(t){if(this.size=t,!this.textureOnly){const e=this._initData(this.pixelType,t,this._shared,this._ctype),i=h(this.data);e.set(i),this.data=e}}toMessage(){const t=this.dirtyStart,e=this.dirtyEnd,i=this.texelSize;if(t>e)return null;this._resetRange();const s=!(this._shared||"local"===this._ctype),r=this.pixelType,a=this.layout,o=h(this.data);return{start:t,end:e,data:s&&o.slice(t*i,(e+1)*i)||null,pixelType:r,layout:a}}_initData(t,e,i,s){const r=i&&"local"!==s?SharedArrayBuffer:ArrayBuffer,a=w(t),o=new a(new r(e*e*4*a.BYTES_PER_ELEMENT));for(let n=0;n<o.length;n+=4)o[n+1]=255;return o}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}}class M{constructor(t,e){this._client=t,this.config=e,this._attributeComputeMap=new Map,this._blocks=new Array,this._filters=new Array(_),this._targetType=0,this._abortController=new AbortController,this._hasScaleExpr=!1,this._size=32,this._idsToHighlight=new Set;const i=e.supportsTextureFloat?U.FLOAT:U.UNSIGNED_BYTE;B(`Creating AttributeStore ${C.sharedArrayBuffer?"with":"without"} shared memory`),this._blockDescriptors=[{pixelType:U.UNSIGNED_BYTE,layout:1},{pixelType:U.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:U.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:i,layout:15},{pixelType:i,layout:15}],this._blocks=this._blockDescriptors.map((()=>null))}destroy(){this._abortController.abort()}get hasScaleExpr(){return this._hasScaleExpr}get _signal(){return this._abortController.signal}get hasHighlight(){return this._idsToHighlight.size>0}update(t,i){this.config=i;const s=i.schema.processors[0].storage,o=d(this._schema,s);if((t.targets.feature||t.targets.aggregate)&&(t.storage.data=!0),o&&(e("esri-2d-update-debug")&&console.debug("Applying Update - AttributeStore:",o),t.storage.data=!0,this._schema=s,this._attributeComputeMap.clear(),!r(s))){switch(s.target){case"feature":this._targetType=T;break;case"aggregate":this._targetType=b}if("subtype"===s.type)for(const t in s.mapping){const e=s.mapping[t];if(a(e))for(const t of e.mapping)this._bindAttribute(t)}else for(const t of s.mapping)this._bindAttribute(t)}}onTileData(t,e){if(r(e.addOrUpdate))return;const i=e.addOrUpdate.getCursor();for(;i.next();){const t=i.getDisplayId();this.setAttributeData(t,i)}}invalidateResources(){this._createResourcesPromise=null,this._abortController.abort(),this._abortController=new AbortController}async setHighlight(t,e){const i=1,s=this._getBlock(0),r=e.map((t=>z(t)));s.lock(),s.unsetComponentAllTexels(0,i),s.setComponent(0,i,r),s.unlock(),this._idsToHighlight.clear();for(const a of t)this._idsToHighlight.add(a);await this.sendUpdates()}async updateFilters(t,i){const{config:s,service:r,spatialReference:a}=i,{filters:o}=s,n=o.map(((t,e)=>this._updateFilter(t,e,r,a)));(await Promise.all(n)).some((t=>t))&&(t.storage.filters=!0,e("esri-2d-update-debug")&&console.debug("Applying Update - AttributeStore:","Filters changed"))}setData(t,e,i,s){const r=z(t);this._ensureSizeForTexel(r),this._getBlock(e).setData(t,i,s)}getData(t,e,i){return this._getBlock(e).getData(t,i)}getHighlightFlag(t){return this._idsToHighlight.has(t)?g:0}unsetAttributeData(t){const e=z(t);this._getBlock(0).setData(e,0,0)}setAttributeData(t,e){const i=z(t);if(this._ensureSizeForTexel(i),this._getBlock(0).setData(i,0,this.getFilterFlags(e)),this._targetType!==S(t))return;const r=this._attributeComputeMap,a=this.config.supportsTextureFloat?1:2,o=4;r.size&&r.forEach(((t,r)=>{const n=r*a%o,l=Math.floor(r*a/o),h=this._getBlock(l+f),c=t(e);if(this.config.supportsTextureFloat)h.setData(i,n,c);else if(c===m)h.setData(i,n,255),h.setData(i,n+1,255);else{const t=s(Math.round(c),-32767,32766)+32768,e=255&t,r=(65280&t)>>8;h.setData(i,n,e),h.setData(i,n+1,r)}}))}sendUpdates(){if(this._nextUpdate)return this._nextUpdate.promise;if(this._currUpdate)return this._nextUpdate=c(),this._nextUpdate.promise;const e={blocks:this._blocks.map((t=>a(t)?t.toMessage():null))};return this._currUpdate=this._createResources().then((()=>{const t=()=>{if(this._currUpdate=null,this._nextUpdate){const t=this._nextUpdate;this._nextUpdate=null,this.sendUpdates().then((()=>t.resolve()))}},i=this._client.update(e,this._signal).then(t).catch(t);return this._client.render(this._signal),i})).catch((e=>{if(u(e))return this._createResourcesPromise=null,this._createResources();F.error(new t("mapview-attribute-store","Encountered an error during client update",e))})),this._currUpdate}_ensureSizeForTexel(t){for(;t>=this._size*this._size;)if(this._expand())return}_bindAttribute(t){function e(){return t.normalizationField?e=>{const i=e.readAttribute(t.normalizationField);if(!i)return null;return e.readAttribute(t.field)/i}:e=>e.readAttribute(t.field)}function i(){return t.normalizationField&&F.warn("mapview-arcade","Ignoring normalizationField specified with an arcade expression which is not supported."),e=>e.getComputedNumericAtIndex(t.fieldIndex)}let s;if(null!=t.fieldIndex)s=i();else{if(!t.field)return;s=e()}if(t.valueRepresentation){s=R(s,(e=>k(e,t.valueRepresentation)))}const r=t=>null===t||isNaN(t)||t===1/0?m:t;this._attributeComputeMap.set(t.binding,R(s,r))}_createResources(){if(a(this._createResourcesPromise))return this._createResourcesPromise;this._getBlock(y),this._getBlock(x),B("Initializing AttributeStore");const e={shared:C.sharedArrayBuffer&&!("local"===this._client.type),size:this._size,blocks:o(this._blocks,(t=>({textureOnly:t.textureOnly,buffer:t.buffer,pixelType:t.pixelType})))},i=this._client.initialize(e,this._signal).catch((e=>{u(e)?this._createResourcesPromise=null:F.error(new t("mapview-attribute-store","Encountered an error during client initialization",e))}));return this._createResourcesPromise=i,i.then((()=>r(this._createResourcesPromise)?this._createResources():void 0)),i}_getBlock(t){const e=this._blocks[t];if(a(e))return e;B(`Initializing AttributeBlock at index ${t}`);const i=C.sharedArrayBuffer,s=this._client.type,r=new I(i,s,this._size,this._blockDescriptors[t]);return this._blocks[t]=r,this._createResourcesPromise=null,r}_expand(){if(this._size<this.config.maxTextureSize){const t=this._size<<=1;return B("Expanding block size to",t,this._blocks),n(this._blocks,(e=>e.expand(t))),this._createResourcesPromise=null,this._size=t,0}return F.error(new t("mapview-limitations","Maximum number of onscreen features exceeded.")),-1}async _updateFilter(t,e,i,s){const o=this._filters[e],n=a(o)&&o.hash;if(!o&&!t)return!1;if(n===JSON.stringify(t))return!1;if(r(t)){if(!o)return!1;const t=1<<e+1,i=this._getBlock(0);return this._filters[e]=null,i.setComponentAllTexels(0,t),this.sendUpdates(),!0}const l=await this._getFilter(e,i);return await l.update(t,s),!0}async _getFilter(t,e){const i=this._filters[t];if(a(i))return i;const{default:s}=await import("./FeatureFilter.js"),r=new s({geometryType:e.geometryType,hasM:!1,hasZ:!1,timeInfo:e.timeInfo,fieldsIndex:new p(e.fields)});return this._filters[t]=r,r}isVisible(t){return!!(2&this._getBlock(0).getData(t,0))}getFilterFlags(t){let e=0;const i=E(t.getDisplayId());for(let a=0;a<this._filters.length;a++){const s=!!(i&1<<a),o=this._filters[a];e|=(!s||r(o)||o.check(t)?1:0)<<a}let s=0;if(this._idsToHighlight.size){const e=t.getObjectId();s=this.getHighlightFlag(e)}return e<<1|s}}export{M as default};
5
+ import t from"../../../../../core/Error.js";import e from"../../../../../core/has.js";import i from"../../../../../core/Logger.js";import{clamp as s}from"../../../../../core/mathUtils.js";import{isNone as r,isSome as a,mapMany as o,forEachSome as n,applySome as l,unwrap as h}from"../../../../../core/maybe.js";import{createResolver as c,isAbortError as u}from"../../../../../core/promiseUtils.js";import{diff as d}from"../../../../../core/accessorSupport/diffUtils.js";import p from"../../../../../layers/support/FieldsIndex.js";import{MAX_FILTERS as g,HIGHLIGHT_FLAG as _,ATTRIBUTE_DATA_VV as f,NAN_MAGIC_NUMBER as m,ATTRIBUTE_DATA_ANIMATION as y,ATTRIBUTE_DATA_GPGPU as b}from"../../../engine/webgl/definitions.js";import{DISPLAY_ID_TYPE_AGGREGATE as x,DISPLAY_ID_TYPE_FEATURE as T,getDisplayIdTexel as z,getDisplayIdType as S,getDisplayIdFilterMask as E}from"../../../engine/webgl/DisplayId.js";import{getPixelArrayCtor as w}from"../../../engine/webgl/Utils.js";import{createDebugLogger as A,DEBUG_ATTR_UPDATES as D}from"../../../engine/webgl/util/debug.js";import{getVisualVariableSizeValueRepresentationRatio as k}from"../tileRenderers/support/visualVariablesUtils.js";import{PixelType as U}from"../../../../webgl/enums.js";const F=i.getLogger("esri.views.layers.2d.features.support.AttributeStore"),M=A(D,F),B={sharedArrayBuffer:e("esri-shared-array-buffer"),atomics:e("esri-atomics")};function v(t,e){return i=>e(t(i))}class C{constructor(t,e,i,s){this.size=0,this.texelSize=4;const{pixelType:r,layout:a,textureOnly:o}=s;this.textureOnly=o||!1,this.pixelType=r,this._ctype=e,this.layout=a,this._resetRange(),this._shared=t,this.size=i,o||(this.data=this._initData(r,i,t,e))}get buffer(){return l(this.data,(t=>t.buffer))}unsetComponentAllTexels(t,e){const i=h(this.data);for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]&=~e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponentAllTexels(t,e){const i=h(this.data);for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]|=255&e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponent(t,e,i){const s=h(this.data);for(const r of i)s[r*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r)}setComponentTexel(t,e,i){h(this.data)[i*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}unsetComponentTexel(t,e,i){h(this.data)[i*this.texelSize+t]&=~e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}getData(t,e){const i=z(t);return h(this.data)[i*this.texelSize+e]}setData(t,e,i){const s=z(t),r=1<<e;0!=(this.layout&r)?(this.data[s*this.texelSize+e]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)):F.error("mapview-attributes-store","Tried to set a value for a texel's readonly component")}lock(){this.pixelType===U.UNSIGNED_BYTE&&this._shared&&B.atomics&&"local"!==this._ctype&&Atomics.store(this.data,0,1)}unlock(){this.pixelType===U.UNSIGNED_BYTE&&this._shared&&B.atomics&&"local"!==this._ctype&&Atomics.store(this.data,0,0)}expand(t){if(this.size=t,!this.textureOnly){const e=this._initData(this.pixelType,t,this._shared,this._ctype),i=h(this.data);e.set(i),this.data=e}}toMessage(){const t=this.dirtyStart,e=this.dirtyEnd,i=this.texelSize;if(t>e)return null;this._resetRange();const s=!(this._shared||"local"===this._ctype),r=this.pixelType,a=this.layout,o=h(this.data);return{start:t,end:e,data:s&&o.slice(t*i,(e+1)*i)||null,pixelType:r,layout:a}}_initData(t,e,i,s){const r=i&&"local"!==s?SharedArrayBuffer:ArrayBuffer,a=w(t),o=new a(new r(e*e*4*a.BYTES_PER_ELEMENT));for(let n=0;n<o.length;n+=4)o[n+1]=255;return o}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}}class R{constructor(t,e){this._client=t,this.config=e,this._attributeComputeMap=new Map,this._blocks=new Array,this._filters=new Array(g),this._targetType=0,this._abortController=new AbortController,this._hasScaleExpr=!1,this._size=32,this._idsToHighlight=new Set;const i=e.supportsTextureFloat?U.FLOAT:U.UNSIGNED_BYTE;M(`Creating AttributeStore ${B.sharedArrayBuffer?"with":"without"} shared memory`),this._blockDescriptors=[{pixelType:U.UNSIGNED_BYTE,layout:1},{pixelType:U.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:U.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:i,layout:15},{pixelType:i,layout:15}],this._blocks=this._blockDescriptors.map((()=>null))}destroy(){this._abortController.abort()}get hasScaleExpr(){return this._hasScaleExpr}get _signal(){return this._abortController.signal}get hasHighlight(){return this._idsToHighlight.size>0}update(t,i){this.config=i;const s=i.schema.processors[0].storage,o=d(this._schema,s);if((t.targets.feature||t.targets.aggregate)&&(t.storage.data=!0),o&&(e("esri-2d-update-debug")&&console.debug("Applying Update - AttributeStore:",o),t.storage.data=!0,this._schema=s,this._attributeComputeMap.clear(),!r(s))){switch(s.target){case"feature":this._targetType=T;break;case"aggregate":this._targetType=x}if("subtype"===s.type)for(const t in s.mapping){const e=s.mapping[t];if(a(e)&&a(e.vvMapping))for(const t of e.vvMapping)this._bindAttribute(t)}else{if(a(s.vvMapping))for(const t of s.vvMapping)this._bindAttribute(t);if(a(s.attributeMapping))for(const t of s.attributeMapping)this._bindAttribute(t)}}}onTileData(t,e){if(r(e.addOrUpdate))return;const i=e.addOrUpdate.getCursor();for(;i.next();){const t=i.getDisplayId();this.setAttributeData(t,i)}}invalidateResources(){this._createResourcesPromise=null,this._abortController.abort(),this._abortController=new AbortController}async setHighlight(t,e){const i=1,s=this._getBlock(0),r=e.map((t=>z(t)));s.lock(),s.unsetComponentAllTexels(0,i),s.setComponent(0,i,r),s.unlock(),this._idsToHighlight.clear();for(const a of t)this._idsToHighlight.add(a);await this.sendUpdates()}async updateFilters(t,i){const{config:s,service:r,spatialReference:a}=i,{filters:o}=s,n=o.map(((t,e)=>this._updateFilter(t,e,r,a)));(await Promise.all(n)).some((t=>t))&&(t.storage.filters=!0,e("esri-2d-update-debug")&&console.debug("Applying Update - AttributeStore:","Filters changed"))}setData(t,e,i,s){const r=z(t);this._ensureSizeForTexel(r),this._getBlock(e).setData(t,i,s)}getData(t,e,i){return this._getBlock(e).getData(t,i)}getHighlightFlag(t){return this._idsToHighlight.has(t)?_:0}unsetAttributeData(t){const e=z(t);this._getBlock(0).setData(e,0,0)}setAttributeData(t,e){const i=z(t);if(this._ensureSizeForTexel(i),this._getBlock(0).setData(i,0,this.getFilterFlags(e)),this._targetType!==S(t))return;const r=this._attributeComputeMap,a=this.config.supportsTextureFloat?1:2,o=4;r.size&&r.forEach(((t,r)=>{const n=r*a%o,l=Math.floor(r*a/o),h=this._getBlock(l+f),c=t(e);if(this.config.supportsTextureFloat)h.setData(i,n,c);else if(c===m)h.setData(i,n,255),h.setData(i,n+1,255);else{const t=s(Math.round(c),-32767,32766)+32768,e=255&t,r=(65280&t)>>8;h.setData(i,n,e),h.setData(i,n+1,r)}}))}sendUpdates(){if(this._nextUpdate)return this._nextUpdate.promise;if(this._currUpdate)return this._nextUpdate=c(),this._nextUpdate.promise;const e={blocks:this._blocks.map((t=>a(t)?t.toMessage():null))};return this._currUpdate=this._createResources().then((()=>{const t=()=>{if(this._currUpdate=null,this._nextUpdate){const t=this._nextUpdate;this._nextUpdate=null,this.sendUpdates().then((()=>t.resolve()))}},i=this._client.update(e,this._signal).then(t).catch(t);return this._client.render(this._signal),i})).catch((e=>{if(u(e))return this._createResourcesPromise=null,this._createResources();F.error(new t("mapview-attribute-store","Encountered an error during client update",e))})),this._currUpdate}_ensureSizeForTexel(t){for(;t>=this._size*this._size;)if(this._expand())return}_bindAttribute(t){function e(){return t.normalizationField?e=>{const i=e.readAttribute(t.normalizationField);if(!i)return null;return e.readAttribute(t.field)/i}:e=>e.readAttribute(t.field)}function i(){return t.normalizationField&&F.warn("mapview-arcade","Ignoring normalizationField specified with an arcade expression which is not supported."),e=>e.getComputedNumericAtIndex(t.fieldIndex)}let s;if(null!=t.fieldIndex)s=i();else{if(!t.field)return;s=e()}if(t.valueRepresentation){s=v(s,(e=>k(e,t.valueRepresentation)))}const r=t=>null===t||isNaN(t)||t===1/0?m:t;this._attributeComputeMap.set(t.binding,v(s,r))}_createResources(){if(a(this._createResourcesPromise))return this._createResourcesPromise;this._getBlock(y),this._getBlock(b),M("Initializing AttributeStore");const e={shared:B.sharedArrayBuffer&&!("local"===this._client.type),size:this._size,blocks:o(this._blocks,(t=>({textureOnly:t.textureOnly,buffer:t.buffer,pixelType:t.pixelType})))},i=this._client.initialize(e,this._signal).catch((e=>{u(e)?this._createResourcesPromise=null:F.error(new t("mapview-attribute-store","Encountered an error during client initialization",e))}));return this._createResourcesPromise=i,i.then((()=>r(this._createResourcesPromise)?this._createResources():void 0)),i}_getBlock(t){const e=this._blocks[t];if(a(e))return e;M(`Initializing AttributeBlock at index ${t}`);const i=B.sharedArrayBuffer,s=this._client.type,r=new C(i,s,this._size,this._blockDescriptors[t]);return this._blocks[t]=r,this._createResourcesPromise=null,r}_expand(){if(this._size<this.config.maxTextureSize){const t=this._size<<=1;return M("Expanding block size to",t,this._blocks),n(this._blocks,(e=>e.expand(t))),this._createResourcesPromise=null,this._size=t,0}return F.error(new t("mapview-limitations","Maximum number of onscreen features exceeded.")),-1}async _updateFilter(t,e,i,s){const o=this._filters[e],n=a(o)&&o.hash;if(!o&&!t)return!1;if(n===JSON.stringify(t))return!1;if(r(t)){if(!o)return!1;const t=1<<e+1,i=this._getBlock(0);return this._filters[e]=null,i.setComponentAllTexels(0,t),this.sendUpdates(),!0}const l=await this._getFilter(e,i);return await l.update(t,s),!0}async _getFilter(t,e){const i=this._filters[t];if(a(i))return i;const{default:s}=await import("./FeatureFilter.js"),r=new s({geometryType:e.geometryType,hasM:!1,hasZ:!1,timeInfo:e.timeInfo,fieldsIndex:new p(e.fields)});return this._filters[t]=r,r}isVisible(t){return!!(2&this._getBlock(0).getData(t,0))}getFilterFlags(t){let e=0;const i=E(t.getDisplayId());for(let a=0;a<this._filters.length;a++){const s=!!(i&1<<a),o=this._filters[a];e|=(!s||r(o)||o.check(t)?1:0)<<a}let s=0;if(this._idsToHighlight.size){const e=t.getObjectId();s=this.getHighlightFlag(e)}return e<<1|s}}export{R as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{getJsonType as r}from"../../../../../geometry/support/jsonUtils.js";import{convertFromGraphics as t}from"../../../../../layers/graphics/featureConversionUtils.js";import{FeatureSetReader as e}from"./FeatureSetReader.js";import{FeatureSetReaderJSON as s}from"./FeatureSetReaderJSON.js";class o extends s{constructor(r,t){super(r,t,null)}static from(s){const n=e.createInstance(),i=[],c=s.filter((r=>!!r.geometry));for(const e of c){const s=r(e.geometry);t(i,[e],s,!1,!1,"uid")}return new o(n,i)}get geometryType(){const r=this._current;return r?r.geometryType:null}get insertAfter(){return this._current.insertAfter}readGraphic(){return this._current}getCursor(){return this.copy()}copy(){const r=new o(this.instance,this._features);return this.copyInto(r),r}}export{o as GraphicsReader};
5
+ import{getJsonType as r}from"../../../../../geometry/support/jsonUtils.js";import{convertFromGraphics as t}from"../../../../../layers/graphics/featureConversionUtils.js";import{FeatureSetReader as e}from"./FeatureSetReader.js";import{FeatureSetReaderJSON as s}from"./FeatureSetReaderJSON.js";class o extends s{constructor(r,t){super(r,t,null)}static from(s,n){const i=e.createInstance(),c=[],u=s.filter((r=>!!r.geometry));for(const e of u){const s=r(e.geometry);t(c,[e],s,!1,!1,n)}return new o(i,c)}get geometryType(){const r=this._current;return r?r.geometryType:null}get insertAfter(){return this._current.insertAfter}readGraphic(){return this._current}getCursor(){return this.copy()}copy(){const r=new o(this.instance,this._features);return this.copyInto(r),r}}export{o as GraphicsReader};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../../core/has.js";import{createResolver as t}from"../../../../../../core/promiseUtils.js";import{brushes as s}from"../../../../engine/brushes.js";import{FeatureContainer as i}from"../../../../engine/FeatureContainer.js";import{WGLDrawPhase as r}from"../../../../engine/webgl/enums.js";const a=e("featurelayer-order-by-server-enabled");class l extends i{constructor(e,t,s,i){super(e),this._pointToCallbacks=[],this._layer=s,this._layerView=t,this._onUpdate=i}renderChildren(e){if(this.attributeView.update(),this.hasAnimation){e.painter.effects.integrate.draw(e,e.attributeView)}super.renderChildren(e)}hasEmptyAttributeView(){return this.attributeView.isEmpty()}isUpdating(){return this.attributeView.isUpdating()}hitTest(e){const s=t();return this._pointToCallbacks.push({point:e,resolver:s}),this.requestRender(),s.promise}onTileData(e,t){const s=a&&"orderBy"in this._layer&&this._layer.orderBy,i=(null==s?void 0:s.length)&&!s[0].valueExpression&&s[0].field,r=s&&this._layerView.orderByFields===i;e.patch(t,r),this.contains(e)||this.addChild(e),this.requestRender()}onTileError(e){this.contains(e)||this.addChild(e)}updateTransitionProperties(e,t){super.updateTransitionProperties(e,t),this._layerView.featureEffectView.transitionStep(e,t),this._layerView.featureEffectView.transitioning&&this.requestRender()}doRender(e){const{minScale:t,maxScale:s}=this._layer,i=e.state.scale;i<=(t||1/0)&&i>=s&&super.doRender(e)}onAttributeStoreUpdate(){this.hasLabels&&this._layerView.view.labelManager.requestUpdate(),this._onUpdate()}get hasAnimation(){return this.hasLabels}setStencilReference(e){if(e.rendererInfo.ddDotSize>1){const e=1;for(const t of this.children)t.stencilRef=t.key.level+e}else super.setStencilReference(e)}get hasLabels(){if("sublayers"in this._layer)return this._layer.sublayers.some((e=>e.labelingInfo&&e.labelingInfo.length&&e.labelsVisible));const e=this._layer.featureReduction,t=e&&"cluster"===e.type&&e.labelsVisible&&e.labelingInfo&&e.labelingInfo.length;return this._layer.labelingInfo&&this._layer.labelingInfo.length&&this._layer.labelsVisible||!!t}prepareRenderPasses(e){const t=e.registerRenderPass({name:"label",brushes:[s.label],target:()=>this.hasLabels?this.children:null,drawPhase:r.LABEL|r.LABEL_ALPHA}),i=e.registerRenderPass({name:"geometry",brushes:[s.fill,s.line,s.marker,s.text],target:()=>this.children,enableDefaultDraw:()=>!this._layerView.featureEffectView.hasEffects,effects:[{apply:e.effects.outsideEffect,enable:()=>this._layerView.featureEffectView.hasEffects,args:()=>this._layerView.featureEffectView.excludedEffects},{apply:e.effects.insideEffect,enable:()=>this._layerView.featureEffectView.hasEffects,args:()=>this._layerView.featureEffectView.includedEffects},{apply:e.effects.hittest,enable:()=>!!this._pointToCallbacks.length,args:()=>this._pointToCallbacks}]}),a=e.registerRenderPass({name:"highlight",brushes:[s.fill,s.line,s.marker,s.text],target:()=>this.children,drawPhase:r.HIGHLIGHT,enableDefaultDraw:()=>!1,effects:[{apply:e.effects.highlight,enable:()=>!!this._layerView.hasHighlight()}]});return[...super.prepareRenderPasses(e),i,a,t]}}export{l as WGLFeatureView};
5
+ import e from"../../../../../../core/has.js";import{createResolver as t}from"../../../../../../core/promiseUtils.js";import{brushes as s}from"../../../../engine/brushes.js";import{FeatureContainer as i}from"../../../../engine/FeatureContainer.js";import{WGLDrawPhase as r}from"../../../../engine/webgl/enums.js";const a=e("featurelayer-order-by-server-enabled");class n extends i{constructor(e,t,s,i){super(e),this._pointToCallbacks=[],this._layer=s,this._layerView=t,this._onUpdate=i}renderChildren(e){if(this.attributeView.update(),this.hasAnimation){e.painter.effects.integrate.draw(e,e.attributeView)}super.renderChildren(e)}hasEmptyAttributeView(){return this.attributeView.isEmpty()}isUpdating(){return this.attributeView.isUpdating()}hitTest(e){const s=t();return this._pointToCallbacks.push({point:e,resolver:s}),this.requestRender(),s.promise}onTileData(e,t){const s=a&&"orderBy"in this._layer&&this._layer.orderBy,i=(null==s?void 0:s.length)&&!s[0].valueExpression&&s[0].field,r=s&&this._layerView.orderByFields===i;e.patch(t,r),this.contains(e)||this.addChild(e),this.requestRender()}onTileError(e){this.contains(e)||this.addChild(e)}updateTransitionProperties(e,t){super.updateTransitionProperties(e,t),this._layerView.featureEffectView.transitionStep(e,t),this._layerView.featureEffectView.transitioning&&this.requestRender()}doRender(e){const{minScale:t,maxScale:s}=this._layer,i=e.state.scale;i<=(t||1/0)&&i>=s&&super.doRender(e)}onAttributeStoreUpdate(){this.hasLabels&&this._layerView.view.labelManager.requestUpdate(),this._onUpdate()}get hasAnimation(){return this.hasLabels}setStencilReference(e){const{rendererSchema:t}=e.rendererInfo;if("dot-density"===t.type&&t.dotSize>1){const e=1;for(const t of this.children)t.stencilRef=t.key.level+e}else super.setStencilReference(e)}get hasLabels(){if("sublayers"in this._layer)return this._layer.sublayers.some((e=>e.labelingInfo&&e.labelingInfo.length&&e.labelsVisible));const e=this._layer.featureReduction,t=e&&"cluster"===e.type&&e.labelsVisible&&e.labelingInfo&&e.labelingInfo.length;return this._layer.labelingInfo&&this._layer.labelingInfo.length&&this._layer.labelsVisible||!!t}prepareRenderPasses(e){const t=e.registerRenderPass({name:"label",brushes:[s.label],target:()=>this.hasLabels?this.children:null,drawPhase:r.LABEL|r.LABEL_ALPHA}),i=e.registerRenderPass({name:"geometry",brushes:[s.fill,s.dotDensity,s.line,s.marker,s.heatmap,s.text],target:()=>this.children,enableDefaultDraw:()=>!this._layerView.featureEffectView.hasEffects,effects:[{apply:e.effects.outsideEffect,enable:()=>this._layerView.featureEffectView.hasEffects,args:()=>this._layerView.featureEffectView.excludedEffects},{apply:e.effects.insideEffect,enable:()=>this._layerView.featureEffectView.hasEffects,args:()=>this._layerView.featureEffectView.includedEffects},{apply:e.effects.hittest,enable:()=>!!this._pointToCallbacks.length,args:()=>this._pointToCallbacks}]}),a=e.registerRenderPass({name:"highlight",brushes:[s.fill,s.dotDensity,s.line,s.marker,s.text],target:()=>this.children,drawPhase:r.HIGHLIGHT,enableDefaultDraw:()=>!1,effects:[{apply:e.effects.highlight,enable:()=>!!this._layerView.hasHighlight()}]});return[...super.prepareRenderPasses(e),i,a,t]}}export{n as WGLFeatureView};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{bidiText as s}from"../../../../core/BidiText.js";import{HandleOwnerMixin as i}from"../../../../core/HandleOwner.js";import r from"../../../../core/has.js";import{isSome as o,isNone as a}from"../../../../core/maybe.js";import{throwIfAborted as h,isAbortError as n,throwIfAbortError as l}from"../../../../core/promiseUtils.js";import{property as d}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import c from"../../../../geometry/SpatialReference.js";import{width as g,height as m,create as u}from"../../../../geometry/support/aaBoundingRect.js";import{closeRingsAndFixWinding as _}from"../../../../geometry/support/coordsUtils.js";import{getJsonType as f,isPolygon as y,isPolyline as b,isExtent as S,isPoint as w,isMultipoint as T}from"../../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridianSync as v}from"../../../../geometry/support/normalizeUtilsSync.js";import{getInfo as I}from"../../../../geometry/support/spatialReferenceUtils.js";import{checkProjectionSupport as U,project as G}from"../../../../layers/graphics/data/projectionSupport.js";import{symbolToCIM as M}from"../../../../symbols/cim/CIMSymbolHelper.js";import{errorPolylineSymbol2D as C,errorPolygonSymbol2D as j,errorPointSymbol2D as P}from"../../../../symbols/support/defaults.js";import{FILTER_FLAG_0 as x}from"../../engine/webgl/definitions.js";import{WGLSymbologyType as A}from"../../engine/webgl/enums.js";import{GraphicTile as R}from"../../engine/webgl/GraphicTile.js";import{TileData as q}from"../../engine/webgl/TileData.js";import D from"../../engine/webgl/WGLDisplayObject.js";import{MeshData as F}from"../../engine/webgl/mesh/MeshData.js";import{WGLMeshFactory as O}from"../../engine/webgl/mesh/factories/WGLMeshFactory.js";import{WGLTemplateStore as z}from"../../engine/webgl/mesh/templates/WGLTemplateStore.js";import{createMatcher as H}from"../../engine/webgl/util/Matcher.js";import{createMatcherSchema as k,createSymbolSchemaOptions as E}from"../features/schemaUtils.js";import N from"../features/support/AttributeStore.js";import{ComputedAttributeStorage as V}from"../features/support/ComputedAttributeStorage.js";import{GraphicsReader as B}from"../features/support/GraphicsReader.js";import L from"./GraphicStore.js";import{intersectingInternationalDateline as W,isMarkerSymbol as J,isTextSymbol as Z,polygonFromExtent as K,TILE_SIZE as Q,PIXEL_BUFFER as X}from"./graphicsUtils.js";import{expandSymbol as Y}from"../support/cimSymbolUtils.js";import{GraphicsView as $}from"../../../layers/GraphicsView.js";import{getWebGLCapabilities as ee}from"../../../webgl/capabilities.js";import{createSymbolSchema as te}from"../features/createSymbolSchema.js";const se=r("esri-2d-graphic-debug");function ie(e,t,s){if(s.has(e))return s.get(e);const i={tile:t,addedOrModified:[],removed:[]};return s.set(e,i),i}let re=class extends($(i(t))){constructor(e){super(e),this._storage=new V,this._displayIds=new Map,this._controller=new AbortController,this._tiles=new Map,this._graphicStoreUpdate=!1,this._graphicsSet=new Set,this._matcher=Promise.resolve(null),this._tileUpdateSet=new Set,this._tilesToUpdate=new Map,this._graphicIdToAbortController=new Map,this._attached=!1,this._updatingGraphicsTimer=null,this._hashToExpandedSymbol=new Map,this._hashToExpandedSymbolPromise=new Map,this._hashToCIMSymbolPromise=new Map,this._hashToCIM=new Map,this._processing=!1,this._needsProcessing=!1,this._pendingUpdate={added:new Set,updated:new Set,removed:new Set},this.lastUpdateId=-1,this.updateRequested=!1,this.graphicUpdateHandler=this.graphicUpdateHandler.bind(this)}destroy(){this._updatingGraphicsTimer&&(clearTimeout(this._updatingGraphicsTimer),this._updatingGraphicsTimer=null,this.notifyChange("updating")),this._controller.abort(),this.container.destroy(),this._set("graphics",null),this._graphicStore.clear(),this._attributeStore=null,this._hashToExpandedSymbol.clear(),this.view=null,this.renderer=null,this._hashToCIM.clear(),this._hashToCIMSymbolPromise.clear(),this._hashToExpandedSymbolPromise.clear()}_createMatcher(e,t,s){if(e){const i=k({indexCount:0,fields:{}},"feature",e);this._matcher=H(i,t,null,s)}}_createDisplayId(e){return this._displayIds.has(e)||this._displayIds.set(e,this._storage.createDisplayId()),this._displayIds.get(e)}initialize(){this._attributeStore=new N({type:"local",initialize:e=>Promise.resolve(this.container.attributeView.initialize(e)),update:e=>this.container.attributeView.requestUpdate(e),render:()=>this.container.requestRender()},ee("2d")),this.container.hasHighlight=()=>this._attributeStore.hasHighlight;const e=e=>{this._createDisplayId(e.uid),this._setFilterState(e.uid,e.visible)},t=e=>{const t=this._displayIds.get(e.uid);this._displayIds.delete(e.uid),this._storage.releaseDisplayId(t)},s=new z(this.container.getMaterialItems.bind(this.container),this.view.featuresTilingScheme.tileInfo);this._graphicStore=new L(this.view.featuresTilingScheme,this.view.state.scale,this.uid,this.graphics,e,t,this._hashToCIM),this._meshFactory=new O(null,this.uid,s),this._templateStore=s,this.handles.add([this.watch("renderer",(e=>{this._createMatcher(e,s,this.container.stage.resourceManager);for(const t of this.graphics)this._pendingUpdate.updated.add(t);this.requestUpdate()})),this.view.graphicsTileStore.on("update",(e=>this._onTileUpdate(e))),this.container.on("attach",(()=>{se&&this.container.enableRenderingBounds((()=>this._graphicStore.getAllBounds())),this.graphics.items.length>0&&this._graphicsChangeHandler({target:this.graphics,added:this.graphics.items,removed:[],moved:[]}),this.handles.add(this.graphics.on("change",(e=>this._graphicsChangeHandler(e))),"graphics");const e=this.container.stage.resourceManager;this._createMatcher(this.renderer,s,e),this._graphicStore.setResourceManager(e),this._attached=!0,this.notifyChange("updating")}))]);const i=this.view.graphicsTileStore.tiles;this._onTileUpdate({added:i,removed:[]})}get updating(){return!this._attached||null!==this._updatingGraphicsTimer||this._tileUpdateSet.size>0||this._tilesToUpdate.size>0}hitTest(e){if(!this.view||!this.view.position)return null;const{resolution:t,rotation:s}=this.view.state;return this._graphicStore.hitTest(e.x,e.y,2,t,s)}update(e){h(this._controller.signal);const t=e.state,{resolution:s}=t;if(this._graphicStore.updateLevel(s),this._graphicStoreUpdate=!0,this.updateRequested=!1,this._pendingUpdate.updated.size>0){if(!this._processing)return void this._updateGraphics();this._needsProcessing=!0}}viewChange(){this.requestUpdate()}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.requestUpdateCallback())}processUpdate(e){this.updateRequested&&(this.updateRequested=!1,this.update(e))}graphicUpdateHandler(e){const{graphic:t,property:s,newValue:i}=e;switch(s){case"attributes":case"geometry":case"symbol":this._pendingUpdate.updated.add(t),this.requestUpdate();break;case"visible":this._setFilterState(t.uid,i),this._attributeStore.sendUpdates()}}setHighlight(e){const t=e.map((e=>this._displayIds.get(e)));this._attributeStore.setHighlight(e,t)}_getIntersectingTiles(e){const t=this._graphicStore.getBounds(e);if(!t||0===g(t)||0===m(t))return[];const s=W(t,this.view.spatialReference);return o(s)?[...new Set([...this.view.graphicsTileStore.boundsIntersections(s[0]),...this.view.graphicsTileStore.boundsIntersections(s[1])])]:this.view.graphicsTileStore.boundsIntersections(t)}async _updateTile(e){h(this._controller.signal);const t=e.tile,s=this._getGraphicsData(this._templateStore,t,e.addedOrModified),i=await this._processGraphics(t,s);return h(this._controller.signal),this._patchTile(t.key,{type:"update",addOrUpdate:i,remove:e.removed,end:!0,clear:!1,sort:!1}),i}_patchTile(e,t){if(!this._tiles.has(e))return;const s=this._tiles.get(e);this.container.onTileData(s,t),this.container.requestRender()}_graphicsChangeHandler(e){const t=this._pendingUpdate;for(const s of e.added)t.added.add(s);for(const s of e.moved)t.updated.add(s);for(const s of e.removed)this._pendingUpdate.added.has(s)?t.added.delete(s):t.removed.add(s);this._processing?this._needsProcessing=!0:this._updateGraphics()}_getGraphicsToUpdate(){const e={added:[],removed:[],updated:[]};if(!this.graphics)return e;const t=this._pendingUpdate;for(const s of this.graphics.items)t.added.has(s)?e.added.push(s):t.updated.has(s)&&e.updated.push(s);for(const s of t.removed)this._graphicStore.has(s)&&e.removed.push(s);return t.added.clear(),t.removed.clear(),t.updated.clear(),e}async _updateGraphics(){this._processing=!0;const{added:e,removed:t,updated:s}=this._getGraphicsToUpdate(),i=this._tilesToUpdate;let r;try{if(!this._graphicStoreUpdate){const e=this.view.state,{resolution:t}=e;this._graphicStore.updateLevel(t)}const o=[],a=new Array(e.length+t.length);for(let e=0;e<s.length;e++){const t=s[e],h=this._getIntersectingTiles(t);for(const e of h){r=e.id;ie(r,e,i).removed.push(this._displayIds.get(t.uid))}o.push(this._updateGraphic(t,null)),a[e]=t}const h=s.length;for(let t=0;t<e.length;t++){const s=e[t];a[h+t]=s,this._graphicsSet.add(s),o.push(this._addGraphic(s))}for(const e of t){this._abortProcessingGraphic(e.uid);const t=this._getIntersectingTiles(e);for(const s of t){r=s.id;ie(r,s,i).removed.push(this._displayIds.get(e.uid))}this._graphicsSet.delete(e),this._graphicStore.remove(e)}let n;this._flipUpdatingGraphics(),await Promise.all(o);for(let e=0;e<a.length;e++){n=a[e];const t=this._getIntersectingTiles(n);for(const e of t){r=e.id;ie(r,e,i).addedOrModified.push(n)}}this._graphicStore.updateZ();const l=[];for(const[e,t]of i)l.push(this._updateTile(t));await Promise.all(l)}catch(o){n(o),0}for(const a of t)try{const e=await this._getSymbolForGraphic(a,{});if(e){const t=e.hash();this._hashToExpandedSymbol.delete(t)}}catch(o){n(o),0}i.clear(),this.notifyChange("updating"),this._processing=!1,this._needsProcessing&&(this._needsProcessing=!1,this._updateGraphics())}_getArcadeInfo(e){const t=(e.attributes?Object.keys(e.attributes):[]).map((t=>({name:t,alias:t,type:"string"==typeof e.attributes[t]?"esriFieldTypeString":"esriFieldTypeDouble"})));return a(e.geometry)?null:{geometryType:f(e.geometry),spatialReference:c.fromJSON(e.geometry.spatialReference),fields:t}}_getSymbolForGraphic(e,t){return h(this._controller.signal),o(e.symbol)?Promise.resolve(e.symbol):o(this.renderer)?this.renderer.getSymbolAsync(e,{scale:this.view.scale,abortOptions:t}):Promise.resolve(this._getNullSymbol(e))}_getCIMSymbol(e,t,s){let i=this._hashToCIM.get(t);if(i)return Promise.resolve(i);const r=M(e);if(o(r)){if("CIMSymbolReference"===r.type)return i=r,this._hashToCIM.set(t,i),Promise.resolve(i);let e=this._hashToCIMSymbolPromise.get(t);return e||(e=r.fetchCIMSymbol(s).then((e=>(this._hashToCIM.set(t,e.data),this._hashToCIMSymbolPromise.delete(t),e))).catch((e=>(this._hashToCIMSymbolPromise.delete(t),l(e),null))),this._hashToCIMSymbolPromise.set(t,e),e)}return Promise.resolve(null)}_expandCIMSymbol(e,t,s,i){const r=this._hashToExpandedSymbol.get(s);if(r)return Promise.resolve(r);let o=this._hashToExpandedSymbolPromise.get(s);if(o)return o;const a=this.container.stage,h=this._getArcadeInfo(t),n=E(null),l=te(e,n);return o=Y(l,h,a.resourceManager,i),this._hashToExpandedSymbolPromise.set(s,o),o.then((e=>(this._hashToExpandedSymbol.set(s,e),this._hashToExpandedSymbolPromise.delete(s),e))),o}async _getSymbolResources(e,t){h(this._controller.signal);return this.container.stage?this._getSymbolForGraphic(e,t).then((i=>{const r=i.hash();return this._getCIMSymbol(i,r,t).then((i=>a(i)?null:this._expandCIMSymbol(i,e,r,t).then((e=>{const t=e.layers.filter((e=>"text"===e.type&&"string"==typeof e.text));if(t&&t.length>0){const i=new Array(t.length);for(let e=0;e<t.length;e++){const r=t[e],o=[],[a]=s(r.text);r.text=a;for(let e=0;e<a.length;e++)o.push(a.charCodeAt(e));i[e]={symbol:r,id:e,glyphIds:o}}const o=new Map;return this.container.getMaterialItems(i).then((s=>{for(let e=0;e<t.length;e++){const i=t[e];o.set(i.cim,{text:i.text,mosaicItem:s[e].mosaicItem})}return{symbol:e,textInfo:o,hash:r}}))}return{symbol:e,hash:r}}))))})).catch((e=>(l(e),null))):null}async _projectAndNormalizeGeometry(e,t){if(h(this._controller.signal),a(e.geometry)||"mesh"===e.geometry.type)return null;let s=e.geometry;if(y(s)){const e=s.rings;s.rings=e}else if(b(s)){const e=s.paths;s.paths=e}else if(S(s)){const i=await this._getSymbolForGraphic(e,t);if(h(this._controller.signal),J(i.type)||Z(i.type)){s=s.center}else s=K(s)}await U(s.spatialReference,this.view.spatialReference);const i=v(s),r=G(i,s.spatialReference,this.view.spatialReference);return _(r),r}_onTileUpdate(e){const t=I(this.view.spatialReference);if(e.added&&e.added.length>0)for(const s of e.added)this._addNewTile(s,t);if(e.removed&&e.removed.length>0)for(const s of e.removed)this._removeTile(s.key)}async _addGraphic(e){this._abortProcessingGraphic(e.uid),h(this._controller.signal);const t=new AbortController;this._graphicIdToAbortController.set(e.uid,t);const s={signal:t.signal};try{await this._addOrUpdateGraphic(e,s),h(this._controller.signal),this._graphicIdToAbortController.delete(e.uid)}catch(i){if(this._graphicIdToAbortController.delete(e.uid),!n(i))throw i}}_updateGraphic(e,t){h(this._controller.signal);const s=this._projectAndNormalizeGeometry(e,t),i=this._getSymbolResources(e,t);return Promise.all([s,i]).then((([t,s])=>{h(this._controller.signal),this._graphicStore.addOrModify(e,s,t)}))}_addOrUpdateGraphic(e,t){h(this._controller.signal);const s=this._projectAndNormalizeGeometry(e,t),i=this._getSymbolResources(e,t);return Promise.all([s,i]).then((([t,s])=>{h(this._controller.signal),this._graphicsSet.has(e)&&this._graphicStore.addOrModify(e,s,t)}))}_addTile(e){const t=this.view.featuresTilingScheme.getTileBounds(u(),e),s=new R(e,t[0],t[3]);return this._tiles.set(e,s),this.container.addChild(s),s}async _addNewTile(e,t){const s=this._addTile(e.key),i=this._graphicStore.queryTileData(this._templateStore,e);if(0===i.length)return;if(t){const s=Math.round((t.valid[1]-t.valid[0])/e.resolution);for(const e of i)e.geometry&&(w(e.geometry)||T(e.geometry))&&this._wrapPoints(e,s)}const r=e.key;this._tileUpdateSet.add(e.key),this.notifyChange("updating");try{const t={type:"update",clear:!1,addOrUpdate:await this._processGraphics(e,i),remove:[],end:!0,sort:!1};s.patch(t),this._tileUpdateSet.delete(r),this.notifyChange("updating")}catch(o){if(this._tileUpdateSet.delete(r),this.notifyChange("updating"),!n(o))throw o}}_removeTile(e){if(!this._tiles.has(e))return;const t=this._tiles.get(e);this.container.removeChild(t),t.destroy(),this._tiles.delete(e)}_setFilterState(e,t){const s=this._displayIds.get(e),i=this._attributeStore.getHighlightFlag(e);this._attributeStore.setData(s,0,0,i|(t?x:0))}_getGraphicsData(e,t,s){const i=this.view,r=I(i.spatialReference),o=this._graphicStore.getGraphicsData(e,t,s);if(r){const e=Math.round((r.valid[1]-r.valid[0])/t.resolution);for(const t of o)t.geometry&&(w(t.geometry)||T(t.geometry))&&this._wrapPoints(t,e)}return o}_wrapPoints(e,t){const s=e.geometry;T(s)?this._wrapMultipoint(s,t):this._wrapPoint(e,t)}_wrapMultipoint(e,t){const s=e.points,i=[];let r=0,o=0;for(const[a,h]of s){if(i.push([a+r,h]),r=0,t===Q){const e=5*X;a+o<e?(i.push([t,0]),r=-t):a+o>Q-e&&(i.push([-t,0]),r=t)}else a+o<-X?(i.push([t,0]),r=-t):a+o>Q+X&&(i.push([-t,0]),r=t);o+=a}e.points=i}_wrapPoint(e,t){const s=e.geometry;if(t===Q){const i=5*X;s.x<i?e.geometry={points:[[s.x,s.y],[t,0]]}:s.x>Q-i&&(e.geometry={points:[[s.x,s.y],[-t,0]]})}else s.x<-X?e.geometry={points:[[s.x,s.y],[t,0]]}:s.x>Q+X&&(e.geometry={points:[[s.x,s.y],[-t,0]]})}_processGraphics(e,t,s){if(!(t&&t.length)||!this._meshFactory)return null;const i=B.from(t),r=this._meshFactory;return this._matcher.then((t=>r.analyzeGraphics(i,this.container.stage.resourceManager,t,null,null,s).then((()=>(this._attributeStore.sendUpdates(),this._processAnalyzedGraphics(e,i))))))}_processAnalyzedGraphics(e,t){const s=this._meshFactory,i=t.getSize(),r=t.getCursor(),o={features:i,records:i,metrics:0},a=new F(e.key.id,o,A.DEFAULT,!1,!1),h=[];for(;r.next();){const t=r.readGraphic();t.insertAfter=-1===t.insertAfter?-1:this._displayIds.get(t.insertAfter),t.displayId=this._displayIds.get(t.attributes[this.uid]);const i=new D(t.displayId);i.insertAfter=t.insertAfter,h.push(i),s.writeGraphic(a,r,e.level,this.container.stage.resourceManager)}const n=e.tileInfoView.tileInfo.isWrappable,l=a.serialize(n);if(1!==l.length)return new q;const d=l[0].message;return q.fromVertexData(d,h)}_abortProcessingGraphic(e){if(this._graphicIdToAbortController.has(e)){this._graphicIdToAbortController.get(e).abort()}}_getNullSymbol(e){const t=e.geometry;return b(t)?C:y(t)||S(t)?j:P}_flipUpdatingGraphics(){this._updatingGraphicsTimer&&clearTimeout(this._updatingGraphicsTimer),this._updatingGraphicsTimer=setTimeout((()=>{this._updatingGraphicsTimer=null,this.notifyChange("updating")}),160),this.notifyChange("updating")}};e([d({constructOnly:!0})],re.prototype,"requestUpdateCallback",void 0),e([d()],re.prototype,"container",void 0),e([d({constructOnly:!0})],re.prototype,"graphics",void 0),e([d()],re.prototype,"updating",null),e([d()],re.prototype,"view",void 0),e([d()],re.prototype,"updateRequested",void 0),re=e([p("esri.views.2d.layers.support.GraphicsView2D")],re);const oe=re;export{oe as default};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{bidiText as s}from"../../../../core/BidiText.js";import{HandleOwnerMixin as i}from"../../../../core/HandleOwner.js";import r from"../../../../core/has.js";import{isSome as o,isNone as a}from"../../../../core/maybe.js";import{throwIfAborted as h,isAbortError as n,throwIfAbortError as l}from"../../../../core/promiseUtils.js";import{property as d}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import c from"../../../../geometry/SpatialReference.js";import{width as g,height as m,create as u}from"../../../../geometry/support/aaBoundingRect.js";import{closeRingsAndFixWinding as _}from"../../../../geometry/support/coordsUtils.js";import{getJsonType as f,isPolygon as y,isPolyline as b,isExtent as S,isPoint as w,isMultipoint as T}from"../../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridianSync as v}from"../../../../geometry/support/normalizeUtilsSync.js";import{getInfo as I}from"../../../../geometry/support/spatialReferenceUtils.js";import{checkProjectionSupport as U,project as G}from"../../../../layers/graphics/data/projectionSupport.js";import{symbolToCIM as M}from"../../../../symbols/cim/CIMSymbolHelper.js";import{errorPolylineSymbol2D as C,errorPolygonSymbol2D as j,errorPointSymbol2D as P}from"../../../../symbols/support/defaults.js";import{FILTER_FLAG_0 as x}from"../../engine/webgl/definitions.js";import{WGLSymbologyType as A}from"../../engine/webgl/enums.js";import{GraphicTile as R}from"../../engine/webgl/GraphicTile.js";import{TileData as q}from"../../engine/webgl/TileData.js";import D from"../../engine/webgl/WGLDisplayObject.js";import{MeshData as F}from"../../engine/webgl/mesh/MeshData.js";import{WGLMeshFactory as O}from"../../engine/webgl/mesh/factories/WGLMeshFactory.js";import{WGLTemplateStore as z}from"../../engine/webgl/mesh/templates/WGLTemplateStore.js";import{createMatcher as H}from"../../engine/webgl/util/Matcher.js";import{createMatcherSchema as k,createSymbolSchemaOptions as E}from"../features/schemaUtils.js";import N from"../features/support/AttributeStore.js";import{ComputedAttributeStorage as V}from"../features/support/ComputedAttributeStorage.js";import{GraphicsReader as B}from"../features/support/GraphicsReader.js";import L from"./GraphicStore.js";import{intersectingInternationalDateline as W,isMarkerSymbol as J,isTextSymbol as Z,polygonFromExtent as K,TILE_SIZE as Q,PIXEL_BUFFER as X}from"./graphicsUtils.js";import{expandSymbol as Y}from"../support/cimSymbolUtils.js";import{GraphicsView as $}from"../../../layers/GraphicsView.js";import{getWebGLCapabilities as ee}from"../../../webgl/capabilities.js";import{createSymbolSchema as te}from"../features/createSymbolSchema.js";const se=r("esri-2d-graphic-debug");function ie(e,t,s){if(s.has(e))return s.get(e);const i={tile:t,addedOrModified:[],removed:[]};return s.set(e,i),i}let re=class extends($(i(t))){constructor(e){super(e),this._storage=new V,this._displayIds=new Map,this._controller=new AbortController,this._tiles=new Map,this._graphicStoreUpdate=!1,this._graphicsSet=new Set,this._matcher=Promise.resolve(null),this._tileUpdateSet=new Set,this._tilesToUpdate=new Map,this._graphicIdToAbortController=new Map,this._attached=!1,this._updatingGraphicsTimer=null,this._hashToExpandedSymbol=new Map,this._hashToExpandedSymbolPromise=new Map,this._hashToCIMSymbolPromise=new Map,this._hashToCIM=new Map,this._processing=!1,this._needsProcessing=!1,this._pendingUpdate={added:new Set,updated:new Set,removed:new Set},this.lastUpdateId=-1,this.updateRequested=!1,this.graphicUpdateHandler=this.graphicUpdateHandler.bind(this)}destroy(){this._updatingGraphicsTimer&&(clearTimeout(this._updatingGraphicsTimer),this._updatingGraphicsTimer=null,this.notifyChange("updating")),this._controller.abort(),this.container.destroy(),this._set("graphics",null),this._graphicStore.clear(),this._attributeStore=null,this._hashToExpandedSymbol.clear(),this.view=null,this.renderer=null,this._hashToCIM.clear(),this._hashToCIMSymbolPromise.clear(),this._hashToExpandedSymbolPromise.clear()}_createMatcher(e,t,s){if(e){const i=k({indexCount:0,fields:{}},"feature",e);this._matcher=H(i,t,null,s)}}_createDisplayId(e){return this._displayIds.has(e)||this._displayIds.set(e,this._storage.createDisplayId()),this._displayIds.get(e)}initialize(){this._attributeStore=new N({type:"local",initialize:e=>Promise.resolve(this.container.attributeView.initialize(e)),update:e=>this.container.attributeView.requestUpdate(e),render:()=>this.container.requestRender()},ee("2d")),this.container.hasHighlight=()=>this._attributeStore.hasHighlight;const e=e=>{this._createDisplayId(e.uid),this._setFilterState(e.uid,e.visible)},t=e=>{const t=this._displayIds.get(e.uid);this._displayIds.delete(e.uid),this._storage.releaseDisplayId(t)},s=new z(this.container.getMaterialItems.bind(this.container),this.view.featuresTilingScheme.tileInfo);this._graphicStore=new L(this.view.featuresTilingScheme,this.view.state.scale,this.uid,this.graphics,e,t,this._hashToCIM),this._meshFactory=new O(null,this.uid,s),this._templateStore=s,this.handles.add([this.watch("renderer",(e=>{this._createMatcher(e,s,this.container.stage.resourceManager);for(const t of this.graphics)this._pendingUpdate.updated.add(t);this.requestUpdate()})),this.view.graphicsTileStore.on("update",(e=>this._onTileUpdate(e))),this.container.on("attach",(()=>{se&&this.container.enableRenderingBounds((()=>this._graphicStore.getAllBounds())),this.graphics.items.length>0&&this._graphicsChangeHandler({target:this.graphics,added:this.graphics.items,removed:[],moved:[]}),this.handles.add(this.graphics.on("change",(e=>this._graphicsChangeHandler(e))),"graphics");const e=this.container.stage.resourceManager;this._createMatcher(this.renderer,s,e),this._graphicStore.setResourceManager(e),this._attached=!0,this.notifyChange("updating")}))]);const i=this.view.graphicsTileStore.tiles;this._onTileUpdate({added:i,removed:[]})}get updating(){return!this._attached||null!==this._updatingGraphicsTimer||this._tileUpdateSet.size>0||this._tilesToUpdate.size>0}hitTest(e){if(!this.view||!this.view.position)return null;const{resolution:t,rotation:s}=this.view.state;return this._graphicStore.hitTest(e.x,e.y,2,t,s)}update(e){h(this._controller.signal);const t=e.state,{resolution:s}=t;if(this._graphicStore.updateLevel(s),this._graphicStoreUpdate=!0,this.updateRequested=!1,this._pendingUpdate.updated.size>0){if(!this._processing)return void this._updateGraphics();this._needsProcessing=!0}}viewChange(){this.requestUpdate()}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.requestUpdateCallback())}processUpdate(e){this.updateRequested&&(this.updateRequested=!1,this.update(e))}graphicUpdateHandler(e){const{graphic:t,property:s,newValue:i}=e;switch(s){case"attributes":case"geometry":case"symbol":this._pendingUpdate.updated.add(t),this.requestUpdate();break;case"visible":this._setFilterState(t.uid,i),this._attributeStore.sendUpdates()}}setHighlight(e){const t=e.map((e=>this._displayIds.get(e)));this._attributeStore.setHighlight(e,t)}_getIntersectingTiles(e){const t=this._graphicStore.getBounds(e);if(!t||0===g(t)||0===m(t))return[];const s=W(t,this.view.spatialReference);return o(s)?[...new Set([...this.view.graphicsTileStore.boundsIntersections(s[0]),...this.view.graphicsTileStore.boundsIntersections(s[1])])]:this.view.graphicsTileStore.boundsIntersections(t)}async _updateTile(e){h(this._controller.signal);const t=e.tile,s=this._getGraphicsData(this._templateStore,t,e.addedOrModified),i=await this._processGraphics(t,s);return h(this._controller.signal),this._patchTile(t.key,{type:"update",addOrUpdate:i,remove:e.removed,end:!0,clear:!1,sort:!1}),i}_patchTile(e,t){if(!this._tiles.has(e))return;const s=this._tiles.get(e);this.container.onTileData(s,t),this.container.requestRender()}_graphicsChangeHandler(e){const t=this._pendingUpdate;for(const s of e.added)t.added.add(s);for(const s of e.moved)t.updated.add(s);for(const s of e.removed)this._pendingUpdate.added.has(s)?t.added.delete(s):t.removed.add(s);this._processing?this._needsProcessing=!0:this._updateGraphics()}_getGraphicsToUpdate(){const e={added:[],removed:[],updated:[]};if(!this.graphics)return e;const t=this._pendingUpdate;for(const s of this.graphics.items)t.added.has(s)?e.added.push(s):t.updated.has(s)&&e.updated.push(s);for(const s of t.removed)this._graphicStore.has(s)&&e.removed.push(s);return t.added.clear(),t.removed.clear(),t.updated.clear(),e}async _updateGraphics(){this._processing=!0;const{added:e,removed:t,updated:s}=this._getGraphicsToUpdate(),i=this._tilesToUpdate;let r;try{if(!this._graphicStoreUpdate){const e=this.view.state,{resolution:t}=e;this._graphicStore.updateLevel(t)}const o=[],a=new Array(e.length+t.length);for(let e=0;e<s.length;e++){const t=s[e],h=this._getIntersectingTiles(t);for(const e of h){r=e.id;ie(r,e,i).removed.push(this._displayIds.get(t.uid))}o.push(this._updateGraphic(t,null)),a[e]=t}const h=s.length;for(let t=0;t<e.length;t++){const s=e[t];a[h+t]=s,this._graphicsSet.add(s),o.push(this._addGraphic(s))}for(const e of t){this._abortProcessingGraphic(e.uid);const t=this._getIntersectingTiles(e);for(const s of t){r=s.id;ie(r,s,i).removed.push(this._displayIds.get(e.uid))}this._graphicsSet.delete(e),this._graphicStore.remove(e)}let n;this._flipUpdatingGraphics(),await Promise.all(o);for(let e=0;e<a.length;e++){n=a[e];const t=this._getIntersectingTiles(n);for(const e of t){r=e.id;ie(r,e,i).addedOrModified.push(n)}}this._graphicStore.updateZ();const l=[];for(const[e,t]of i)l.push(this._updateTile(t));await Promise.all(l)}catch(o){n(o),0}for(const a of t)try{const e=await this._getSymbolForGraphic(a,{});if(e){const t=e.hash();this._hashToExpandedSymbol.delete(t)}}catch(o){n(o),0}i.clear(),this.notifyChange("updating"),this._processing=!1,this._needsProcessing&&(this._needsProcessing=!1,this._updateGraphics())}_getArcadeInfo(e){const t=(e.attributes?Object.keys(e.attributes):[]).map((t=>({name:t,alias:t,type:"string"==typeof e.attributes[t]?"esriFieldTypeString":"esriFieldTypeDouble"})));return a(e.geometry)?null:{geometryType:f(e.geometry),spatialReference:c.fromJSON(e.geometry.spatialReference),fields:t}}_getSymbolForGraphic(e,t){return h(this._controller.signal),o(e.symbol)?Promise.resolve(e.symbol):o(this.renderer)?this.renderer.getSymbolAsync(e,{scale:this.view.scale,abortOptions:t}):Promise.resolve(this._getNullSymbol(e))}_getCIMSymbol(e,t,s){let i=this._hashToCIM.get(t);if(i)return Promise.resolve(i);const r=M(e);if(o(r)){if("CIMSymbolReference"===r.type)return i=r,this._hashToCIM.set(t,i),Promise.resolve(i);let e=this._hashToCIMSymbolPromise.get(t);return e||(e=r.fetchCIMSymbol(s).then((e=>(this._hashToCIM.set(t,e.data),this._hashToCIMSymbolPromise.delete(t),e))).catch((e=>(this._hashToCIMSymbolPromise.delete(t),l(e),null))),this._hashToCIMSymbolPromise.set(t,e),e)}return Promise.resolve(null)}_expandCIMSymbol(e,t,s,i){const r=this._hashToExpandedSymbol.get(s);if(r)return Promise.resolve(r);let o=this._hashToExpandedSymbolPromise.get(s);if(o)return o;const a=this.container.stage,h=this._getArcadeInfo(t),n=E(null),l=te(e,n);return o=Y(l,h,a.resourceManager,i),this._hashToExpandedSymbolPromise.set(s,o),o.then((e=>(this._hashToExpandedSymbol.set(s,e),this._hashToExpandedSymbolPromise.delete(s),e))),o}async _getSymbolResources(e,t){h(this._controller.signal);return this.container.stage?this._getSymbolForGraphic(e,t).then((i=>{const r=i.hash();return this._getCIMSymbol(i,r,t).then((i=>a(i)?null:this._expandCIMSymbol(i,e,r,t).then((e=>{const t=e.layers.filter((e=>"text"===e.type&&"string"==typeof e.text));if(t&&t.length>0){const i=new Array(t.length);for(let e=0;e<t.length;e++){const r=t[e],o=[],[a]=s(r.text);r.text=a;for(let e=0;e<a.length;e++)o.push(a.charCodeAt(e));i[e]={symbol:r,id:e,glyphIds:o}}const o=new Map;return this.container.getMaterialItems(i).then((s=>{for(let e=0;e<t.length;e++){const i=t[e];o.set(i.cim,{text:i.text,mosaicItem:s[e].mosaicItem})}return{symbol:e,textInfo:o,hash:r}}))}return{symbol:e,hash:r}}))))})).catch((e=>(l(e),null))):null}async _projectAndNormalizeGeometry(e,t){if(h(this._controller.signal),a(e.geometry)||"mesh"===e.geometry.type)return null;let s=e.geometry;if(y(s)){const e=s.rings;s.rings=e}else if(b(s)){const e=s.paths;s.paths=e}else if(S(s)){const i=await this._getSymbolForGraphic(e,t);if(h(this._controller.signal),J(i.type)||Z(i.type)){s=s.center}else s=K(s)}await U(s.spatialReference,this.view.spatialReference);const i=v(s),r=G(i,s.spatialReference,this.view.spatialReference);return _(r),r}_onTileUpdate(e){const t=I(this.view.spatialReference);if(e.added&&e.added.length>0)for(const s of e.added)this._addNewTile(s,t);if(e.removed&&e.removed.length>0)for(const s of e.removed)this._removeTile(s.key)}async _addGraphic(e){this._abortProcessingGraphic(e.uid),h(this._controller.signal);const t=new AbortController;this._graphicIdToAbortController.set(e.uid,t);const s={signal:t.signal};try{await this._addOrUpdateGraphic(e,s),h(this._controller.signal),this._graphicIdToAbortController.delete(e.uid)}catch(i){if(this._graphicIdToAbortController.delete(e.uid),!n(i))throw i}}_updateGraphic(e,t){h(this._controller.signal);const s=this._projectAndNormalizeGeometry(e,t),i=this._getSymbolResources(e,t);return Promise.all([s,i]).then((([t,s])=>{h(this._controller.signal),this._graphicStore.addOrModify(e,s,t)}))}_addOrUpdateGraphic(e,t){h(this._controller.signal);const s=this._projectAndNormalizeGeometry(e,t),i=this._getSymbolResources(e,t);return Promise.all([s,i]).then((([t,s])=>{h(this._controller.signal),this._graphicsSet.has(e)&&this._graphicStore.addOrModify(e,s,t)}))}_addTile(e){const t=this.view.featuresTilingScheme.getTileBounds(u(),e),s=new R(e,t[0],t[3]);return this._tiles.set(e,s),this.container.addChild(s),s}async _addNewTile(e,t){const s=this._addTile(e.key),i=this._graphicStore.queryTileData(this._templateStore,e);if(0===i.length)return;if(t){const s=Math.round((t.valid[1]-t.valid[0])/e.resolution);for(const e of i)e.geometry&&(w(e.geometry)||T(e.geometry))&&this._wrapPoints(e,s)}const r=e.key;this._tileUpdateSet.add(e.key),this.notifyChange("updating");try{const t={type:"update",clear:!1,addOrUpdate:await this._processGraphics(e,i),remove:[],end:!0,sort:!1};s.patch(t),this._tileUpdateSet.delete(r),this.notifyChange("updating")}catch(o){if(this._tileUpdateSet.delete(r),this.notifyChange("updating"),!n(o))throw o}}_removeTile(e){if(!this._tiles.has(e))return;const t=this._tiles.get(e);this.container.removeChild(t),t.destroy(),this._tiles.delete(e)}_setFilterState(e,t){const s=this._displayIds.get(e),i=this._attributeStore.getHighlightFlag(e);this._attributeStore.setData(s,0,0,i|(t?x:0))}_getGraphicsData(e,t,s){const i=this.view,r=I(i.spatialReference),o=this._graphicStore.getGraphicsData(e,t,s);if(r){const e=Math.round((r.valid[1]-r.valid[0])/t.resolution);for(const t of o)t.geometry&&(w(t.geometry)||T(t.geometry))&&this._wrapPoints(t,e)}return o}_wrapPoints(e,t){const s=e.geometry;T(s)?this._wrapMultipoint(s,t):this._wrapPoint(e,t)}_wrapMultipoint(e,t){const s=e.points,i=[];let r=0,o=0;for(const[a,h]of s){if(i.push([a+r,h]),r=0,t===Q){const e=5*X;a+o<e?(i.push([t,0]),r=-t):a+o>Q-e&&(i.push([-t,0]),r=t)}else a+o<-X?(i.push([t,0]),r=-t):a+o>Q+X&&(i.push([-t,0]),r=t);o+=a}e.points=i}_wrapPoint(e,t){const s=e.geometry;if(t===Q){const i=5*X;s.x<i?e.geometry={points:[[s.x,s.y],[t,0]]}:s.x>Q-i&&(e.geometry={points:[[s.x,s.y],[-t,0]]})}else s.x<-X?e.geometry={points:[[s.x,s.y],[t,0]]}:s.x>Q+X&&(e.geometry={points:[[s.x,s.y],[-t,0]]})}_processGraphics(e,t,s){if(!(t&&t.length)||!this._meshFactory)return null;const i=B.from(t,this.uid),r=this._meshFactory;return this._matcher.then((t=>r.analyzeGraphics(i,this.container.stage.resourceManager,t,null,null,s).then((()=>(this._attributeStore.sendUpdates(),this._processAnalyzedGraphics(e,i))))))}_processAnalyzedGraphics(e,t){const s=this._meshFactory,i=t.getSize(),r=t.getCursor(),o={features:i,records:i,metrics:0},a=new F(e.key.id,o,A.DEFAULT,!1,!1),h=[];for(;r.next();){const t=r.readGraphic();t.insertAfter=-1===t.insertAfter?-1:this._displayIds.get(t.insertAfter),t.displayId=this._displayIds.get(t.attributes[this.uid]);const i=new D(t.displayId);i.insertAfter=t.insertAfter,h.push(i),s.writeGraphic(a,r,e.level,this.container.stage.resourceManager)}const n=e.tileInfoView.tileInfo.isWrappable,l=a.serialize(n);if(1!==l.length)return new q;const d=l[0].message;return q.fromVertexData(d,h)}_abortProcessingGraphic(e){if(this._graphicIdToAbortController.has(e)){this._graphicIdToAbortController.get(e).abort()}}_getNullSymbol(e){const t=e.geometry;return b(t)?C:y(t)||S(t)?j:P}_flipUpdatingGraphics(){this._updatingGraphicsTimer&&clearTimeout(this._updatingGraphicsTimer),this._updatingGraphicsTimer=setTimeout((()=>{this._updatingGraphicsTimer=null,this.notifyChange("updating")}),160),this.notifyChange("updating")}};e([d({constructOnly:!0})],re.prototype,"requestUpdateCallback",void 0),e([d()],re.prototype,"container",void 0),e([d({constructOnly:!0})],re.prototype,"graphics",void 0),e([d()],re.prototype,"updating",null),e([d()],re.prototype,"view",void 0),e([d()],re.prototype,"updateRequested",void 0),re=e([p("esri.views.2d.layers.support.GraphicsView2D")],re);const oe=re;export{oe as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../analysis/SlicePlane.js";import{clock as i}from"../../../../core/clock.js";import a from"../../../../core/Handles.js";import{releaseMaybe as s,destroyMaybe as n,isSome as r,isNone as l,removeMaybe as o}from"../../../../core/maybe.js";import{watch as h,sync as p,syncAndInitial as u}from"../../../../core/reactiveUtils.js";import{addFrameTask as c}from"../../../../core/scheduling.js";import{createScreenPoint as d,screenPointObjectToArray as _,createScreenPointArray as v}from"../../../../core/screenUtils.js";import{property as P}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as y}from"../../../../core/accessorSupport/decorators/subclass.js";import{d as m,u as g,m as w}from"../../../../chunks/mat4.js";import{e as f,l as M,c as D,g as T,a as b,m as V,n as k,s as E}from"../../../../chunks/vec3.js";import{a as S,c as H}from"../../../../chunks/vec3f64.js";import{c as x,a as I,n as R,f as j}from"../../../../chunks/boundedPlane.js";import{signedDistance as O,create as C,intersectRay as z,normal as G}from"../../../../geometry/support/plane.js";import{create as U}from"../../../../geometry/support/ray.js";import{sv3d as L,sm4d as K,sv2d as B}from"../../../../geometry/support/vectorStacks.js";import{POINTER_MOVE_TIMER_MS as A,PLANE_PREVIEW_OUTLINE_WIDTH as F,forceVerticalModifier as N,forceHorizontalModifier as q,PREVIEW_FADE_DURATION_SECONDS as Z,PLANE_OUTLINE_COLOR as J,PLANE_BACKGROUND_COLOR as Q,PREVIEW_FADE_DOT_THRESHOLD as W,INITIAL_DEPTH_OFFSET_FRAC as X}from"./sliceToolConfig.js";import{createShiftManipulator as Y,createRotateManipulator as $,createResizeManipulator as tt,createGridVisualElement as et,createOutlineVisualElement as it,planeToShape as at,createRotatePlane as st,RotationAxis as nt,resizePlane as rt,calculatePlaneHalfSize as lt,SliceOrientation as ot,createPlane as ht,DidPointerMoveRecentlyFlag as pt,calculateBoundedPlaneTranslateRotate as ut,updateShiftRestartHandle as ct,updateRotateHeadingHandle as dt,updateRotateTiltHandle as _t,updateResizeHandle as vt,createShiftPlane as Pt}from"./sliceToolUtils.js";import{getRotateHeadingTexture as yt,getTiltRotateTexture as mt}from"./images/Factory.js";import{calculateInputRotationTransform as gt}from"../../interactive/manipulatorUtils.js";import{screenToRenderPlane as wt}from"../../interactive/editingTools/dragEventPipeline3D.js";import{fromScreen as ft}from"../../support/geometryUtils/ray.js";import{newIntersector as Mt}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as Dt}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{createManipulatorDragEventPipeline as Tt}from"../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as bt}from"../../../interactive/InteractiveToolBase.js";import{createScreenPointFromEvent as Vt}from"../../../support/screenUtils.js";var kt;let Et=kt=class extends bt{constructor(t){super(t),this.clock=i,this._previewPlaneOpacity=1,this.layersMode="none",this.shiftManipulator=null,this.rotateHeadingManipulator=null,this.rotateTiltManipulator=null,this.resizeManipulators=null,this._handles=new a,this._viewHandles=new a,this._frameTask=null,this._pointerMoveTimerMs=A,this._prevPointerMoveTimeout=null,this._previewPlaneGridVisualElement=null,this._previewPlaneOutlineVisualElement=null,this._startPlane=x(),this._previewPlane=null,this._activeKeyModifiers={},this._lastCursorPosition=d(),this._resizeHandles=[{direction:[1,0]},{direction:[1,1]},{direction:[0,1]},{direction:[-1,1]},{direction:[-1,0]},{direction:[-1,-1]},{direction:[0,-1]},{direction:[1,-1]}],this._intersector=Mt(t.view.state.viewingMode),this._intersector.options.store=Dt.MIN}initialize(){if(null==this.analysis)throw new Error("SliceTool requires valid analysis, but null was provided.");this.rotateHeadingImage=yt(this.view.toolViewManager.textures),this.rotateTiltImage=mt(this.view.toolViewManager.textures);const t=t=>{this._updateManipulatorsInteractive(t),t.grabbing||(r(this.analysisViewData.plane)&&I(this.analysisViewData.plane,this._startPlane),this.inputState=null)};this.shiftManipulator=Y(this.view),this.manipulators.add(this.shiftManipulator),this.shiftManipulator.events.on("grab-changed",(e=>{this._onShiftGrab(e),t(this.shiftManipulator)})),this._handles.add(this._createShiftDragPipeline(this.shiftManipulator)),this.rotateHeadingManipulator=$(this.view,this.rotateHeadingImage.texture),this.manipulators.add(this.rotateHeadingManipulator),this.rotateHeadingManipulator.events.on("grab-changed",(e=>{this._onRotateHeadingGrab(e),t(this.rotateHeadingManipulator)})),this._handles.add(this._createRotateHeadingDragPipeline(this.rotateHeadingManipulator)),this.rotateTiltManipulator=$(this.view,this.rotateTiltImage.texture),this.manipulators.add(this.rotateTiltManipulator),this.rotateTiltManipulator.events.on("grab-changed",(e=>{this._onRotateTiltGrab(e),t(this.rotateTiltManipulator)})),this._handles.add(this._createRotateTiltDragPipeline(this.rotateTiltManipulator)),this.resizeManipulators=this._resizeHandles.map(((e,i)=>{const a=tt(this.view,e);return a.events.on("grab-changed",(e=>{this._onResizeGrab(e,i),t(a)})),this._handles.add(this._createResizeDragPipeline(a)),a})),this.manipulators.addMany(this.resizeManipulators),this._previewPlaneGridVisualElement=et(this.view),this._previewPlaneOutlineVisualElement=it(this.view),this._previewPlaneOutlineVisualElement.width=F,this._handles.add(h((()=>this.analysisViewData.plane),(()=>this._updateManipulators()),p));const e=h((()=>this.state),(t=>{"sliced"===t&&this.finishToolCreation()}),u);this._handles.add([e,h((()=>this.view.state.camera),(()=>this._onCameraChange()))])}destroy(){this.rotateHeadingImage=s(this.rotateHeadingImage),this.rotateTiltImage=s(this.rotateTiltImage),this._handles=n(this._handles),this._viewHandles=n(this._viewHandles),this._removeFrameTask(),this._clearPointerMoveTimeout(),this._previewPlaneOutlineVisualElement=n(this._previewPlaneOutlineVisualElement),this._previewPlaneGridVisualElement=n(this._previewPlaneGridVisualElement)}get state(){const t=!!this.analysisViewData.plane,e=!!this.inputState;return t?t&&e?"slicing":t&&!e?"sliced":"ready":"ready"}get cursor(){return this._isPlacingSlicePlane||"exclude"===this.layersMode?"crosshair":r(this._creatingPointerId)?"grabbing":null}set analysis(t){if(null==t)throw new Error("SliceTool requires valid analysis, but null was provided.");this._handles.remove("analysis"),this._set("analysis",t)}get inputState(){return this._get("inputState")}set inputState(t){this._set("inputState",t),this.analysisViewData.showGrid=r(t)&&"resize"===t.type,this._updateMaterials()}get _isPlacingSlicePlane(){return!this.inputState&&!this.analysisViewData.plane&&this.active}get _creatingPointerId(){return r(this.inputState)&&"shift"===this.inputState.type?this.inputState.creatingPointerId:null}enterExcludeLayerMode(){l(this.analysisViewData.plane)||(this._set("layersMode","exclude"),this.active||(this.view.activeTool=this))}exitExcludeLayerMode(){l(this.analysisViewData.plane)||(this._set("layersMode","none"),this.active&&(this.view.activeTool=null))}onDeactivate(){this._set("layersMode","none"),this._updatePreviewPlane(null)}onShow(){this._updateVisibility(!0)}onHide(){this._updateVisibility(!1)}_updateVisibility(t){this.analysis.visible=t,this._updateManipulators(),t||this._clearPointerMoveTimeout()}onInputEvent(t){switch(t.type){case"pointer-drag":if(!Ht(t))return;this._isPlacingSlicePlane?this._onClickPlacePlane(t)&&t.stopPropagation():this._onPointerDrag(t)&&t.stopPropagation();break;case"pointer-move":this._onPointerMove(t);break;case"pointer-up":this._onPointerUp(t)&&t.stopPropagation();break;case"immediate-click":if(!Ht(t))return;this._onClickPlacePlane(t)&&t.stopPropagation();break;case"click":if(!Ht(t))return;this._onClickExcludeLayer(t)&&t.stopPropagation();break;case"drag":this.inputState&&t.stopPropagation();break;case"key-down":this._onKeyDown(t)&&t.stopPropagation();break;case"key-up":this._onKeyUp(t)&&t.stopPropagation()}}onEditableChange(){this.analysisViewData.editable=this.editable}_onPointerDrag(t){const e=this.inputState;if(t.pointerId===this._creatingPointerId&&r(e)&&"shift"===e.type){const i=Vt(t);return this.shiftManipulator.events.emit("drag",{action:e.hasBeenDragged?"update":"start",pointerType:t.pointerType,start:i,screenPoint:i}),e.hasBeenDragged=!0,!0}return!1}_onPointerMove(t){this._lastCursorPosition.x=t.x,this._lastCursorPosition.y=t.y,this._resetPointerMoveTimeout(),"touch"!==t.pointerType&&this._updatePreviewPlane(Vt(t),this._activeKeyModifiers)}_onCameraChange(){this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),this._updateManipulators()}_onPointerUp(t){if(t.pointerId===this._creatingPointerId&&r(this.analysisViewData.plane)){const e=Vt(t);return this.shiftManipulator.events.emit("drag",{action:"end",start:e,screenPoint:e}),I(this.analysisViewData.plane,this._startPlane),this.inputState=null,!0}return!1}_onClickPlacePlane(t){if("exclude"===this.layersMode)return!1;if(this._isPlacingSlicePlane){const i=Vt(t),a=x();if(this._pickPlane(i,!1,this._activeKeyModifiers,a)){if(I(a,this._startPlane),this.analysis.shape=at(a,this.view,this.view.spatialReference,new e),"pointer-drag"===t.type){const e=this._calculatePickRay(i);this.inputState=St(e,t.pointerId,a.origin,a)}return!0}}return!1}_onClickExcludeLayer(t){return!("exclude"!==this.layersMode||!this.created)&&(this.view.hitTest(Vt(t)).then((t=>{if(t.results.length){const e=t.results[0],i=e&&e.graphic;if(i){const t=i.sourceLayer||i.layer;t&&this.analysis.excludedLayers.push(t)}}else t.ground.layer?this.analysis.excludedLayers.push(t.ground.layer):this.analysis.excludeGroundSurface=!0})),this._set("layersMode","none"),this.active&&(this.view.activeTool=null),!0)}_onKeyDown(t){return(t.key===N||t.key===q)&&(this._activeKeyModifiers[t.key]=!0,r(this._previewPlane)&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onKeyUp(t){return!(t.key!==N&&t.key!==q||!this._activeKeyModifiers[t.key])&&(delete this._activeKeyModifiers[t.key],r(this._previewPlane)&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onShiftGrab(t){if("start"!==t.action||l(this.analysisViewData.plane))return;const e=this._calculatePickRay(t.screenPoint);I(this.analysisViewData.plane,this._startPlane),this.inputState=St(e,null,this.shiftManipulator.renderLocation,this.analysisViewData.plane)}_createShiftDragPipeline(t){return Tt(t,((t,e,i)=>{const a=this.inputState;if(l(a)||"shift"!==a.type)return;const s=r(this.analysisViewData.plane)?I(this.analysisViewData.plane,x()):null;e.next(wt(this.view,a.shiftPlane)).next(this._shiftDragAdjustSensitivity(a)).next(this._shiftDragUpdatePlane(a)),i.next((()=>{r(s)&&this._updateBoundedPlane(s)}))}))}_shiftDragAdjustSensitivity(t){return e=>{if(l(this.analysisViewData.plane))return null;const i=.001,a=Math.min((1-Math.abs(f(R(this.analysisViewData.plane),e.ray.direction)/M(e.ray.direction)))/i,1),s=-O(this._startPlane.plane,e.renderEnd),n=-O(this._startPlane.plane,t.startPoint);return t.depth=t.depth*(1-a)+s*a-n,e}}_shiftDragUpdatePlane(t){return()=>{if(l(this.analysisViewData.plane))return;const e=D(L.get(),this._startPlane.origin),i=D(L.get(),R(this._startPlane));T(i,i,-t.depth),b(i,i,e);const a=j(i,this.analysisViewData.plane.basis1,this.analysisViewData.plane.basis2,x());this._updateBoundedPlane(a)}}_onRotateHeadingGrab(t){if("start"!==t.action||l(this.analysisViewData.plane))return;const e=st(this.analysisViewData.plane,this.view.renderCoordsHelper,nt.HEADING,C()),i=this._calculatePickRay(t.screenPoint),a=H();z(e,i,a)&&(I(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateHeadingDragPipeline(t){return Tt(t,((t,e,i)=>{const a=this.inputState;if(l(a)||"rotate"!==a.type)return;const s=r(this.analysisViewData.plane)?I(this.analysisViewData.plane,x()):null;e.next(wt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{r(s)&&this._updateBoundedPlane(s)}))}))}_onRotateTiltGrab(t){if("start"!==t.action||l(this.analysisViewData.plane))return;const e=st(this.analysisViewData.plane,this.view.renderCoordsHelper,nt.TILT,C()),i=this._calculatePickRay(t.screenPoint),a=H();z(e,i,a)&&(I(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateTiltDragPipeline(t){return Tt(t,((t,e,i)=>{const a=this.inputState;if(l(a)||"rotate"!==a.type)return;const s=r(this.analysisViewData.plane)?I(this.analysisViewData.plane,x()):null;e.next(wt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{r(s)&&this._updateBoundedPlane(s)}))}))}_rotateDragRenderPlaneToRotate(t){return e=>{if(l(this.analysisViewData.plane))return null;const i=G(t.rotatePlane),a=gt(t.startPoint,e.renderEnd,this.analysisViewData.plane.origin,i);return{...e,rotateAxis:i,rotateAngle:a}}}_rotateDragUpdatePlaneFromRotate(){return t=>{if(l(this.analysisViewData.plane))return;const e=m(K.get(),t.rotateAngle,t.rotateAxis),i=V(L.get(),this._startPlane.basis1,e),a=V(L.get(),this._startPlane.basis2,e),s=j(this.analysisViewData.plane.origin,i,a,x());this._updateBoundedPlane(s)}}_onResizeGrab(t,e){if("start"!==t.action||l(this.analysisViewData.plane))return;const i=this._calculatePickRay(t.screenPoint),a=L.get();z(this.analysisViewData.plane.plane,i,a)&&(I(this.analysisViewData.plane,this._startPlane),this.inputState={type:"resize",activeHandleIdx:e,startPoint:S(a)})}_createResizeDragPipeline(t){return Tt(t,((t,e,i)=>{const a=this.inputState;if(l(a)||"resize"!==a.type||l(this.analysisViewData.plane))return;const s=I(this.analysisViewData.plane,x());e.next(wt(this.view,this.analysisViewData.plane.plane)).next(this._resizeDragUpdatePlane(a)),i.next((()=>{this._updateBoundedPlane(s)}))}))}_resizeDragUpdatePlane(t){return e=>{if(l(this.analysisViewData.plane))return;const i=this._resizeHandles[t.activeHandleIdx],a=rt(i,t.startPoint,e.renderEnd,this.view.state.camera,this._startPlane,I(this.analysisViewData.plane));this._updateBoundedPlane(a)}}_updateBoundedPlane(t){const e=this.analysisViewData;if(!r(e))throw new Error("valid internal object expected");e.plane=t}_updatePreviewPlane(t,e={}){let i=this._previewPlane;if(this._previewPlane=null,l(t))return this._removeFrameTask(),void this._updateManipulators();if(!this.analysisViewData.plane&&this.active){const a=r(i)?i:x();if(i=r(i)?I(i,xt):null,this._pickPlane(t,!0,e,a)){const t=W;let e=!1;r(i)&&(e=f(i.plane,a.plane)<t||f(k(L.get(),i.basis1),k(L.get(),a.basis1))<t),e&&(this._previewPlaneOpacity=0),this._previewPlane=a}}r(this._previewPlane)&&l(this._frameTask)&&0===this._previewPlaneOpacity?this._frameTask=c({update:({deltaTime:t})=>{this._previewPlaneOpacity=Math.min(this._previewPlaneOpacity+t/(1e3*Z),1),this._updateManipulators(),1===this._previewPlaneOpacity&&this._removeFrameTask()}}):l(this._previewPlane)&&r(this._frameTask)?this._removeFrameTask():r(this._previewPlane)&&this._updateManipulators()}_removeFrameTask(){this._frameTask=o(this._frameTask)}_calculatePickRay(t){const e=U(),i=_(t,It);return ft(this.view.state.camera,i,e),k(e.direction,e.direction),e}_pickMinResult(t){const e=_(t,B.get());return this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(e,this._intersector),this._intersector.results.min}_pickPlane(t,e,i,a){const s=this._pickMinResult(t),n=L.get();if(!s.getIntersectionPoint(n))return!1;const r=s.getTransformedNormal(L.get()),l=this.view.state.camera;f(r,l.viewForward)>0&&T(r,r,-1);const o=lt(n,l),h=(e?1:-1)*o*X,p=T(L.get(),r,h);b(p,p,n);const u=this.analysis.tiltEnabled?ot.TILTED:ot.HORIZONTAL_OR_VERTICAL,c=i[N]?ot.VERTICAL:i[q]?ot.HORIZONTAL:u;return ht(p,r,o,o,l,c,this.view.renderCoordsHelper,a),!0}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=o(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.shiftManipulator.state|=pt,this.rotateHeadingManipulator.state|=pt,this.rotateTiltManipulator.state|=pt,this._prevPointerMoveTimeout=this.clock.setTimeout((()=>{this.shiftManipulator.state&=~pt,this.rotateHeadingManipulator.state&=~pt,this.rotateTiltManipulator.state&=~pt}),this._pointerMoveTimerMs)}_updateManipulators(){if(kt.disableEngineLayers)return;let t=null,e=!1;if(r(this.analysisViewData.plane))t=this.analysisViewData.plane,e=!1;else{if(!r(this._previewPlane))return this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.visible=!1,void(this._previewPlaneGridVisualElement.visible=!1);t=this._previewPlane,e=!0}const i=ut(t,K.get());e?(this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.visible=!0,this._previewPlaneGridVisualElement.visible=!0):(this.shiftManipulator.available=!0,this.rotateHeadingManipulator.available=!0,this.rotateTiltManipulator.available=this.analysis.tiltEnabled,this.resizeManipulators.forEach((t=>t.available=!0)),ct(this.shiftManipulator,i,t,this.view.state.camera),dt(this.rotateHeadingManipulator,i,t,this.view.renderCoordsHelper),_t(this.rotateTiltManipulator,i,t),this.resizeManipulators.forEach(((e,a)=>vt(e,this._resizeHandles[a],i,t))),this._previewPlaneOutlineVisualElement.visible=!1,this._previewPlaneGridVisualElement.visible=!1);const a=E(L.get(),M(t.basis1),M(t.basis2),1),s=g(K.get(),a),n=w(s,i,s);this._previewPlaneOutlineVisualElement.transform=n,this._previewPlaneGridVisualElement.transform=n,this._updateMaterials()}_updateMaterials(){const t=[J[0],J[1],J[2],J[3]*this._previewPlaneOpacity];this._previewPlaneOutlineVisualElement.color=t;const e=[Q[0],Q[1],Q[2],Q[3]*this._previewPlaneOpacity],i=[0,0,0,0];this._previewPlaneGridVisualElement.backgroundColor=e,this._previewPlaneGridVisualElement.gridColor=i}_updateManipulatorsInteractive(t){if(!t.grabbing)return this.shiftManipulator.interactive=!0,this.rotateHeadingManipulator.interactive=!0,this.rotateTiltManipulator.interactive=!0,void this.resizeManipulators.forEach((t=>{t.interactive=!0}));this.shiftManipulator.interactive=this.shiftManipulator===t,this.rotateHeadingManipulator.interactive=this.rotateHeadingManipulator===t,this.rotateTiltManipulator.interactive=this.rotateTiltManipulator===t,this.resizeManipulators.forEach((e=>{e.interactive=e===t}))}testData(){return{plane:this.analysisViewData.plane,setPointerMoveTimerMs:t=>{this._pointerMoveTimerMs=t}}}};function St(t,e,i,a){const s=Pt(i,R(a),t.direction,C()),n=H();return z(s,t,n)?{type:"shift",creatingPointerId:e,hasBeenDragged:!1,shiftPlane:s,depth:0,startPoint:n}:null}function Ht(t){return"mouse"!==t.pointerType||0===t.button}Et.disableEngineLayers=!1,t([P()],Et.prototype,"clock",void 0),t([P({constructOnly:!0})],Et.prototype,"view",void 0),t([P()],Et.prototype,"analysisViewData",void 0),t([P({readOnly:!0})],Et.prototype,"state",null),t([P({readOnly:!0})],Et.prototype,"cursor",null),t([P()],Et.prototype,"analysis",null),t([P({readOnly:!0})],Et.prototype,"layersMode",void 0),t([P({value:null})],Et.prototype,"inputState",null),t([P()],Et.prototype,"_isPlacingSlicePlane",null),t([P()],Et.prototype,"_creatingPointerId",null),Et=kt=t([y("esri.views.3d.interactive.analysisTools.slice.SliceTool")],Et);const xt=x(),It=v(),Rt=Et;export{Rt as default};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../analysis/SlicePlane.js";import{clock as i}from"../../../../core/clock.js";import a from"../../../../core/Handles.js";import{releaseMaybe as s,destroyMaybe as n,isSome as r,isNone as l,removeMaybe as o}from"../../../../core/maybe.js";import{watch as h,sync as p,syncAndInitial as u}from"../../../../core/reactiveUtils.js";import{addFrameTask as c}from"../../../../core/scheduling.js";import{createScreenPoint as d,screenPointObjectToArray as _,createScreenPointArray as v}from"../../../../core/screenUtils.js";import{property as P}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as y}from"../../../../core/accessorSupport/decorators/subclass.js";import{d as m,u as g,m as w}from"../../../../chunks/mat4.js";import{e as f,l as M,c as D,g as T,a as V,m as b,n as k,s as E}from"../../../../chunks/vec3.js";import{a as S,c as H}from"../../../../chunks/vec3f64.js";import{c as x,a as I,n as R,f as j}from"../../../../chunks/boundedPlane.js";import{signedDistance as O,create as C,intersectRay as z,normal as G}from"../../../../geometry/support/plane.js";import{create as U}from"../../../../geometry/support/ray.js";import{sv3d as L,sm4d as K,sv2d as B}from"../../../../geometry/support/vectorStacks.js";import{POINTER_MOVE_TIMER_MS as A,PLANE_PREVIEW_OUTLINE_WIDTH as F,forceVerticalModifier as N,forceHorizontalModifier as q,PREVIEW_FADE_DURATION_SECONDS as Z,PLANE_OUTLINE_COLOR as J,PLANE_BACKGROUND_COLOR as Q,PREVIEW_FADE_DOT_THRESHOLD as W,INITIAL_DEPTH_OFFSET_FRAC as X}from"./sliceToolConfig.js";import{createShiftManipulator as Y,createRotateManipulator as $,createResizeManipulator as tt,createGridVisualElement as et,createOutlineVisualElement as it,planeToShape as at,createRotatePlane as st,RotationAxis as nt,resizePlane as rt,calculatePlaneHalfSize as lt,SliceOrientation as ot,createPlane as ht,DidPointerMoveRecentlyFlag as pt,calculateBoundedPlaneTranslateRotate as ut,updateShiftRestartHandle as ct,updateRotateHeadingHandle as dt,updateRotateTiltHandle as _t,updateResizeHandle as vt,createShiftPlane as Pt}from"./sliceToolUtils.js";import{getRotateHeadingTexture as yt,getTiltRotateTexture as mt}from"./images/Factory.js";import{calculateInputRotationTransform as gt}from"../../interactive/manipulatorUtils.js";import{screenToRenderPlane as wt}from"../../interactive/editingTools/dragEventPipeline3D.js";import{fromScreen as ft}from"../../support/geometryUtils/ray.js";import{newIntersector as Mt}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as Dt}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{createManipulatorDragEventPipeline as Tt}from"../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as Vt}from"../../../interactive/InteractiveToolBase.js";import{createScreenPointFromEvent as bt}from"../../../support/screenUtils.js";var kt;let Et=kt=class extends Vt{constructor(t){super(t),this.clock=i,this._previewPlaneOpacity=1,this.layersMode="none",this.shiftManipulator=null,this.rotateHeadingManipulator=null,this.rotateTiltManipulator=null,this.resizeManipulators=null,this._handles=new a,this._viewHandles=new a,this._frameTask=null,this._pointerMoveTimerMs=A,this._prevPointerMoveTimeout=null,this._previewPlaneGridVisualElement=null,this._previewPlaneOutlineVisualElement=null,this._startPlane=x(),this._previewPlane=null,this._activeKeyModifiers={},this._lastCursorPosition=d(),this._resizeHandles=[{direction:[1,0]},{direction:[1,1]},{direction:[0,1]},{direction:[-1,1]},{direction:[-1,0]},{direction:[-1,-1]},{direction:[0,-1]},{direction:[1,-1]}],this._intersector=Mt(t.view.state.viewingMode),this._intersector.options.store=Dt.MIN}initialize(){if(null==this.analysis)throw new Error("SliceTool requires valid analysis, but null was provided.");this.rotateHeadingImage=yt(this.view.toolViewManager.textures),this.rotateTiltImage=mt(this.view.toolViewManager.textures);const t=t=>{this._updateManipulatorsInteractive(t),t.grabbing||(r(this.analysisViewData.plane)&&I(this.analysisViewData.plane,this._startPlane),this.inputState=null)};this.shiftManipulator=Y(this.view),this.manipulators.add(this.shiftManipulator),this.shiftManipulator.events.on("grab-changed",(e=>{this._onShiftGrab(e),t(this.shiftManipulator)})),this._handles.add(this._createShiftDragPipeline(this.shiftManipulator)),this.rotateHeadingManipulator=$(this.view,this.rotateHeadingImage.texture),this.manipulators.add(this.rotateHeadingManipulator),this.rotateHeadingManipulator.events.on("grab-changed",(e=>{this._onRotateHeadingGrab(e),t(this.rotateHeadingManipulator)})),this._handles.add(this._createRotateHeadingDragPipeline(this.rotateHeadingManipulator)),this.rotateTiltManipulator=$(this.view,this.rotateTiltImage.texture),this.manipulators.add(this.rotateTiltManipulator),this.rotateTiltManipulator.events.on("grab-changed",(e=>{this._onRotateTiltGrab(e),t(this.rotateTiltManipulator)})),this._handles.add(this._createRotateTiltDragPipeline(this.rotateTiltManipulator)),this.resizeManipulators=this._resizeHandles.map(((e,i)=>{const a=tt(this.view,e);return a.events.on("grab-changed",(e=>{this._onResizeGrab(e,i),t(a)})),this._handles.add(this._createResizeDragPipeline(a)),a})),this.manipulators.addMany(this.resizeManipulators),this._previewPlaneGridVisualElement=et(this.view),this._previewPlaneOutlineVisualElement=it(this.view),this._previewPlaneOutlineVisualElement.width=F,this._handles.add(h((()=>this.analysisViewData.plane),(()=>this._updateManipulators()),p));const e=h((()=>this.state),(t=>{"sliced"===t&&this.finishToolCreation()}),u);this._handles.add([e,h((()=>this.view.state.camera),(()=>this._onCameraChange()))])}destroy(){this.rotateHeadingImage=s(this.rotateHeadingImage),this.rotateTiltImage=s(this.rotateTiltImage),this._handles=n(this._handles),this._viewHandles=n(this._viewHandles),this._removeFrameTask(),this._clearPointerMoveTimeout(),this._previewPlaneOutlineVisualElement=n(this._previewPlaneOutlineVisualElement),this._previewPlaneGridVisualElement=n(this._previewPlaneGridVisualElement)}get state(){const t=!!this.analysisViewData.plane,e=!!this.inputState;return t?t&&e?"slicing":t&&!e?"sliced":"ready":"ready"}get cursor(){return this._isPlacingSlicePlane||"exclude"===this.layersMode?"crosshair":r(this._creatingPointerId)?"grabbing":null}set analysis(t){if(null==t)throw new Error("SliceTool requires valid analysis, but null was provided.");this._handles.remove("analysis"),this._set("analysis",t)}get inputState(){return this._get("inputState")}set inputState(t){this._set("inputState",t),this.analysisViewData.showGrid=r(t)&&"resize"===t.type,this._updateMaterials()}get _isPlacingSlicePlane(){return!this.inputState&&!this.analysisViewData.plane&&this.active}get _creatingPointerId(){return r(this.inputState)&&"shift"===this.inputState.type?this.inputState.creatingPointerId:null}enterExcludeLayerMode(){l(this.analysisViewData.plane)||(this._set("layersMode","exclude"),this.active||(this.view.activeTool=this))}exitExcludeLayerMode(){l(this.analysisViewData.plane)||(this._set("layersMode","none"),this.active&&(this.view.activeTool=null))}onDeactivate(){this._set("layersMode","none"),this._updatePreviewPlane(null)}onShow(){this._updateVisibility(!0)}onHide(){this._updateVisibility(!1)}_updateVisibility(t){this._updateManipulators(),t||this._clearPointerMoveTimeout()}onInputEvent(t){switch(t.type){case"pointer-drag":if(!Ht(t))return;this._isPlacingSlicePlane?this._onClickPlacePlane(t)&&t.stopPropagation():this._onPointerDrag(t)&&t.stopPropagation();break;case"pointer-move":this._onPointerMove(t);break;case"pointer-up":this._onPointerUp(t)&&t.stopPropagation();break;case"immediate-click":if(!Ht(t))return;this._onClickPlacePlane(t)&&t.stopPropagation();break;case"click":if(!Ht(t))return;this._onClickExcludeLayer(t)&&t.stopPropagation();break;case"drag":this.inputState&&t.stopPropagation();break;case"key-down":this._onKeyDown(t)&&t.stopPropagation();break;case"key-up":this._onKeyUp(t)&&t.stopPropagation()}}onEditableChange(){this.analysisViewData.editable=this.editable}_onPointerDrag(t){const e=this.inputState;if(t.pointerId===this._creatingPointerId&&r(e)&&"shift"===e.type){const i=bt(t);return this.shiftManipulator.events.emit("drag",{action:e.hasBeenDragged?"update":"start",pointerType:t.pointerType,start:i,screenPoint:i}),e.hasBeenDragged=!0,!0}return!1}_onPointerMove(t){this._lastCursorPosition.x=t.x,this._lastCursorPosition.y=t.y,this._resetPointerMoveTimeout(),"touch"!==t.pointerType&&this._updatePreviewPlane(bt(t),this._activeKeyModifiers)}_onCameraChange(){this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),this._updateManipulators()}_onPointerUp(t){if(t.pointerId===this._creatingPointerId&&r(this.analysisViewData.plane)){const e=bt(t);return this.shiftManipulator.events.emit("drag",{action:"end",start:e,screenPoint:e}),I(this.analysisViewData.plane,this._startPlane),this.inputState=null,!0}return!1}_onClickPlacePlane(t){if("exclude"===this.layersMode)return!1;if(this._isPlacingSlicePlane){const i=bt(t),a=x();if(this._pickPlane(i,!1,this._activeKeyModifiers,a)){if(I(a,this._startPlane),this.analysis.shape=at(a,this.view,this.view.spatialReference,new e),"pointer-drag"===t.type){const e=this._calculatePickRay(i);this.inputState=St(e,t.pointerId,a.origin,a)}return!0}}return!1}_onClickExcludeLayer(t){return!("exclude"!==this.layersMode||!this.created)&&(this.view.hitTest(bt(t)).then((t=>{if(t.results.length){const e=t.results[0],i=e&&e.graphic;if(i){const t=i.sourceLayer||i.layer;t&&this.analysis.excludedLayers.push(t)}}else t.ground.layer?this.analysis.excludedLayers.push(t.ground.layer):this.analysis.excludeGroundSurface=!0})),this._set("layersMode","none"),this.active&&(this.view.activeTool=null),!0)}_onKeyDown(t){return(t.key===N||t.key===q)&&(this._activeKeyModifiers[t.key]=!0,r(this._previewPlane)&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onKeyUp(t){return!(t.key!==N&&t.key!==q||!this._activeKeyModifiers[t.key])&&(delete this._activeKeyModifiers[t.key],r(this._previewPlane)&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onShiftGrab(t){if("start"!==t.action||l(this.analysisViewData.plane))return;const e=this._calculatePickRay(t.screenPoint);I(this.analysisViewData.plane,this._startPlane),this.inputState=St(e,null,this.shiftManipulator.renderLocation,this.analysisViewData.plane)}_createShiftDragPipeline(t){return Tt(t,((t,e,i)=>{const a=this.inputState;if(l(a)||"shift"!==a.type)return;const s=r(this.analysisViewData.plane)?I(this.analysisViewData.plane,x()):null;e.next(wt(this.view,a.shiftPlane)).next(this._shiftDragAdjustSensitivity(a)).next(this._shiftDragUpdatePlane(a)),i.next((()=>{r(s)&&this._updateBoundedPlane(s)}))}))}_shiftDragAdjustSensitivity(t){return e=>{if(l(this.analysisViewData.plane))return null;const i=.001,a=Math.min((1-Math.abs(f(R(this.analysisViewData.plane),e.ray.direction)/M(e.ray.direction)))/i,1),s=-O(this._startPlane.plane,e.renderEnd),n=-O(this._startPlane.plane,t.startPoint);return t.depth=t.depth*(1-a)+s*a-n,e}}_shiftDragUpdatePlane(t){return()=>{if(l(this.analysisViewData.plane))return;const e=D(L.get(),this._startPlane.origin),i=D(L.get(),R(this._startPlane));T(i,i,-t.depth),V(i,i,e);const a=j(i,this.analysisViewData.plane.basis1,this.analysisViewData.plane.basis2,x());this._updateBoundedPlane(a)}}_onRotateHeadingGrab(t){if("start"!==t.action||l(this.analysisViewData.plane))return;const e=st(this.analysisViewData.plane,this.view.renderCoordsHelper,nt.HEADING,C()),i=this._calculatePickRay(t.screenPoint),a=H();z(e,i,a)&&(I(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateHeadingDragPipeline(t){return Tt(t,((t,e,i)=>{const a=this.inputState;if(l(a)||"rotate"!==a.type)return;const s=r(this.analysisViewData.plane)?I(this.analysisViewData.plane,x()):null;e.next(wt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{r(s)&&this._updateBoundedPlane(s)}))}))}_onRotateTiltGrab(t){if("start"!==t.action||l(this.analysisViewData.plane))return;const e=st(this.analysisViewData.plane,this.view.renderCoordsHelper,nt.TILT,C()),i=this._calculatePickRay(t.screenPoint),a=H();z(e,i,a)&&(I(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateTiltDragPipeline(t){return Tt(t,((t,e,i)=>{const a=this.inputState;if(l(a)||"rotate"!==a.type)return;const s=r(this.analysisViewData.plane)?I(this.analysisViewData.plane,x()):null;e.next(wt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{r(s)&&this._updateBoundedPlane(s)}))}))}_rotateDragRenderPlaneToRotate(t){return e=>{if(l(this.analysisViewData.plane))return null;const i=G(t.rotatePlane),a=gt(t.startPoint,e.renderEnd,this.analysisViewData.plane.origin,i);return{...e,rotateAxis:i,rotateAngle:a}}}_rotateDragUpdatePlaneFromRotate(){return t=>{if(l(this.analysisViewData.plane))return;const e=m(K.get(),t.rotateAngle,t.rotateAxis),i=b(L.get(),this._startPlane.basis1,e),a=b(L.get(),this._startPlane.basis2,e),s=j(this.analysisViewData.plane.origin,i,a,x());this._updateBoundedPlane(s)}}_onResizeGrab(t,e){if("start"!==t.action||l(this.analysisViewData.plane))return;const i=this._calculatePickRay(t.screenPoint),a=L.get();z(this.analysisViewData.plane.plane,i,a)&&(I(this.analysisViewData.plane,this._startPlane),this.inputState={type:"resize",activeHandleIdx:e,startPoint:S(a)})}_createResizeDragPipeline(t){return Tt(t,((t,e,i)=>{const a=this.inputState;if(l(a)||"resize"!==a.type||l(this.analysisViewData.plane))return;const s=I(this.analysisViewData.plane,x());e.next(wt(this.view,this.analysisViewData.plane.plane)).next(this._resizeDragUpdatePlane(a)),i.next((()=>{this._updateBoundedPlane(s)}))}))}_resizeDragUpdatePlane(t){return e=>{if(l(this.analysisViewData.plane))return;const i=this._resizeHandles[t.activeHandleIdx],a=rt(i,t.startPoint,e.renderEnd,this.view.state.camera,this._startPlane,I(this.analysisViewData.plane));this._updateBoundedPlane(a)}}_updateBoundedPlane(t){const e=this.analysisViewData;if(!r(e))throw new Error("valid internal object expected");e.plane=t}_updatePreviewPlane(t,e={}){let i=this._previewPlane;if(this._previewPlane=null,l(t))return this._removeFrameTask(),void this._updateManipulators();if(!this.analysisViewData.plane&&this.active){const a=r(i)?i:x();if(i=r(i)?I(i,xt):null,this._pickPlane(t,!0,e,a)){const t=W;let e=!1;r(i)&&(e=f(i.plane,a.plane)<t||f(k(L.get(),i.basis1),k(L.get(),a.basis1))<t),e&&(this._previewPlaneOpacity=0),this._previewPlane=a}}r(this._previewPlane)&&l(this._frameTask)&&0===this._previewPlaneOpacity?this._frameTask=c({update:({deltaTime:t})=>{this._previewPlaneOpacity=Math.min(this._previewPlaneOpacity+t/(1e3*Z),1),this._updateManipulators(),1===this._previewPlaneOpacity&&this._removeFrameTask()}}):l(this._previewPlane)&&r(this._frameTask)?this._removeFrameTask():r(this._previewPlane)&&this._updateManipulators()}_removeFrameTask(){this._frameTask=o(this._frameTask)}_calculatePickRay(t){const e=U(),i=_(t,It);return ft(this.view.state.camera,i,e),k(e.direction,e.direction),e}_pickMinResult(t){const e=_(t,B.get());return this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(e,this._intersector),this._intersector.results.min}_pickPlane(t,e,i,a){const s=this._pickMinResult(t),n=L.get();if(!s.getIntersectionPoint(n))return!1;const r=s.getTransformedNormal(L.get()),l=this.view.state.camera;f(r,l.viewForward)>0&&T(r,r,-1);const o=lt(n,l),h=(e?1:-1)*o*X,p=T(L.get(),r,h);V(p,p,n);const u=this.analysis.tiltEnabled?ot.TILTED:ot.HORIZONTAL_OR_VERTICAL,c=i[N]?ot.VERTICAL:i[q]?ot.HORIZONTAL:u;return ht(p,r,o,o,l,c,this.view.renderCoordsHelper,a),!0}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=o(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.shiftManipulator.state|=pt,this.rotateHeadingManipulator.state|=pt,this.rotateTiltManipulator.state|=pt,this._prevPointerMoveTimeout=this.clock.setTimeout((()=>{this.shiftManipulator.state&=~pt,this.rotateHeadingManipulator.state&=~pt,this.rotateTiltManipulator.state&=~pt}),this._pointerMoveTimerMs)}_updateManipulators(){if(kt.disableEngineLayers)return;let t=null,e=!1;if(r(this.analysisViewData.plane))t=this.analysisViewData.plane,e=!1;else{if(!r(this._previewPlane))return this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.visible=!1,void(this._previewPlaneGridVisualElement.visible=!1);t=this._previewPlane,e=!0}const i=ut(t,K.get());e?(this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.visible=!0,this._previewPlaneGridVisualElement.visible=!0):(this.shiftManipulator.available=!0,this.rotateHeadingManipulator.available=!0,this.rotateTiltManipulator.available=this.analysis.tiltEnabled,this.resizeManipulators.forEach((t=>t.available=!0)),ct(this.shiftManipulator,i,t,this.view.state.camera),dt(this.rotateHeadingManipulator,i,t,this.view.renderCoordsHelper),_t(this.rotateTiltManipulator,i,t),this.resizeManipulators.forEach(((e,a)=>vt(e,this._resizeHandles[a],i,t))),this._previewPlaneOutlineVisualElement.visible=!1,this._previewPlaneGridVisualElement.visible=!1);const a=E(L.get(),M(t.basis1),M(t.basis2),1),s=g(K.get(),a),n=w(s,i,s);this._previewPlaneOutlineVisualElement.transform=n,this._previewPlaneGridVisualElement.transform=n,this._updateMaterials()}_updateMaterials(){const t=[J[0],J[1],J[2],J[3]*this._previewPlaneOpacity];this._previewPlaneOutlineVisualElement.color=t;const e=[Q[0],Q[1],Q[2],Q[3]*this._previewPlaneOpacity],i=[0,0,0,0];this._previewPlaneGridVisualElement.backgroundColor=e,this._previewPlaneGridVisualElement.gridColor=i}_updateManipulatorsInteractive(t){if(!t.grabbing)return this.shiftManipulator.interactive=!0,this.rotateHeadingManipulator.interactive=!0,this.rotateTiltManipulator.interactive=!0,void this.resizeManipulators.forEach((t=>{t.interactive=!0}));this.shiftManipulator.interactive=this.shiftManipulator===t,this.rotateHeadingManipulator.interactive=this.rotateHeadingManipulator===t,this.rotateTiltManipulator.interactive=this.rotateTiltManipulator===t,this.resizeManipulators.forEach((e=>{e.interactive=e===t}))}testData(){return{plane:this.analysisViewData.plane,setPointerMoveTimerMs:t=>{this._pointerMoveTimerMs=t}}}};function St(t,e,i,a){const s=Pt(i,R(a),t.direction,C()),n=H();return z(s,t,n)?{type:"shift",creatingPointerId:e,hasBeenDragged:!1,shiftPlane:s,depth:0,startPoint:n}:null}function Ht(t){return"mouse"!==t.pointerType||0===t.button}Et.disableEngineLayers=!1,t([P()],Et.prototype,"clock",void 0),t([P({constructOnly:!0})],Et.prototype,"view",void 0),t([P()],Et.prototype,"analysisViewData",void 0),t([P({readOnly:!0})],Et.prototype,"state",null),t([P({readOnly:!0})],Et.prototype,"cursor",null),t([P()],Et.prototype,"analysis",null),t([P({readOnly:!0})],Et.prototype,"layersMode",void 0),t([P({value:null})],Et.prototype,"inputState",null),t([P()],Et.prototype,"_isPlacingSlicePlane",null),t([P()],Et.prototype,"_creatingPointerId",null),Et=kt=t([y("esri.views.3d.interactive.analysisTools.slice.SliceTool")],Et);const xt=x(),It=v(),Rt=Et;export{Rt as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as e}from"../../../../core/maybe.js";import{i as n,c as r,r as t,b as o,a as i}from"../../../../chunks/vec3.js";import{c as s}from"../../../../chunks/vec3f64.js";import{wrap as c}from"../../../../geometry/support/ray.js";import{e as a,k as f}from"../../../../chunks/sphere.js";import{defaultApplyOptions as m,interactionDirectionTowardsConstraintMinimization as u,InteractionType as p,adjustRangeForInteraction as d}from"./common.js";function y(e,n,r=m){if(!e.state.isLocal)return 0;const t=e.state.constraints.distance;if(!e.pointsOfInterest.surfaceOrigin.renderLocation||t===1/0)return 0;l.min=0,l.max=t,g(e,r,l);const o=j(e,n),i=l.max-o;return i>=-1e-6?0:i}function O(n,t,s=m){const p=y(n,t,s);if(0===p)return!1;const d=n.pointsOfInterest.surfaceOrigin,O=j(n,t)+p,g=r(I,t.eye),l=u(t,s.interactionDirection,x(n,t,k),h);if(!a(f(d.renderLocation,O),c(t.eye,l),C))return!1;t.eye=C;const N=o(L,t.eye,g);t.center=i(C,t.center,N);const b=n.renderCoordsHelper.getAltitude(t.center),v=n.renderCoordsHelper.intersectInfiniteManifold(t.ray,b,C);return e(v)&&(t.center=v),!0}function g(e,n,r){const t=n.interactionType;if(t===p.NONE)return;const{min:o,max:i}=r,{interactionStartCamera:s,interactionFactor:c}=n,a=t===p.ZOOM||t===p.PAN,f=y(e,s),m=0===f?0:j(e,s);r.min=o,r.max=i;d(f,m,a,c,.05*m,r)}function j(e,r){const t=e.pointsOfInterest.surfaceOrigin;return n(r.eye,t.renderLocation)}function x(e,n,r){const o=e.pointsOfInterest.surfaceOrigin;return t(r,n.eye,o.renderLocation)}const l={min:0,max:0},I=s(),L=s(),h=s(),k=s(),C=s();export{O as applyDistanceConstraint,y as getDistanceConstraintError};
5
+ import{isSome as e}from"../../../../core/maybe.js";import{i as n,c as r,r as t,b as o,a as i}from"../../../../chunks/vec3.js";import{c as s}from"../../../../chunks/vec3f64.js";import{wrap as c}from"../../../../geometry/support/ray.js";import{h as a,l as f}from"../../../../chunks/sphere.js";import{defaultApplyOptions as m,interactionDirectionTowardsConstraintMinimization as u,InteractionType as p,adjustRangeForInteraction as d}from"./common.js";function y(e,n,r=m){if(!e.state.isLocal)return 0;const t=e.state.constraints.distance;if(!e.pointsOfInterest.surfaceOrigin.renderLocation||t===1/0)return 0;x.min=0,x.max=t,g(e,r,x);const o=j(e,n),i=x.max-o;return i>=-1e-6?0:i}function O(n,t,s=m){const p=y(n,t,s);if(0===p)return!1;const d=n.pointsOfInterest.surfaceOrigin,O=j(n,t)+p,g=r(h,t.eye),x=u(t,s.interactionDirection,l(n,t,k),L);if(!a(f(d.renderLocation,O),c(t.eye,x),C))return!1;t.eye=C;const N=o(I,t.eye,g);t.center=i(C,t.center,N);const b=n.renderCoordsHelper.getAltitude(t.center),v=n.renderCoordsHelper.intersectInfiniteManifold(t.ray,b,C);return e(v)&&(t.center=v),!0}function g(e,n,r){const t=n.interactionType;if(t===p.NONE)return;const{min:o,max:i}=r,{interactionStartCamera:s,interactionFactor:c}=n,a=t===p.ZOOM||t===p.PAN,f=y(e,s),m=0===f?0:j(e,s);r.min=o,r.max=i;d(f,m,a,c,.05*m,r)}function j(e,r){const t=e.pointsOfInterest.surfaceOrigin;return n(r.eye,t.renderLocation)}function l(e,n,r){const o=e.pointsOfInterest.surfaceOrigin;return t(r,n.eye,o.renderLocation)}const x={min:0,max:0},h=s(),I=s(),L=s(),k=s(),C=s();export{O as applyDistanceConstraint,y as getDistanceConstraintError};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{neverReached as e}from"../../../../core/compilerUtils.js";import{clamp as t,acosClamped as r,asinClamped as n,deg2rad as i}from"../../../../core/mathUtils.js";import{isSome as s}from"../../../../core/maybe.js";import{d as a}from"../../../../chunks/mat4.js";import{c}from"../../../../chunks/mat4f64.js";import{b as o,m as u,g as l,a as m,i as d,e as f,n as p,l as y,p as h}from"../../../../chunks/vec3.js";import{c as M}from"../../../../chunks/vec3f64.js";import{getReferenceEllipsoid as C}from"../../../../geometry/projectionEllipsoid.js";import{h as I,j as O}from"../../../../chunks/sphere.js";import{defaultApplyOptions as T,TiltMode as A,InteractionType as D,hasConstraintType as S,ConstraintTypes as w,adjustRangeForInteraction as R}from"./common.js";import{viewAngle as j}from"../../state/utils/viewUtils.js";function x(t,r,n=T,i=!0){V.eyeCenterDistance=0,V.requiresTwoSteps=!1;const s=P(t,r,n,void 0,V);if(0===s)return!1;switch(a(_,-s,r.viewRight),n.tiltMode){case A.LOOK_AROUND:u(K,r.viewForward,_),l(K,K,V.eyeCenterDistance),r.center=m(z,r.eye,K);break;case A.TUMBLE:o(K,r.center,r.eye),u(K,K,_),r.eye=o(z,r.center,K);break;default:e(n.tiltMode)}return r.up=u(z,r.up,_),!V.requiresTwoSteps||!i||x(t,r,n,!1)}function P(e,t,r=T,n=T,i){if(!e.state.constraints.tilt)return 0;const s=t.distance,a=e.state.constraints.tilt(s,J);return N(e,r,a),n.interactionType===D.TUMBLE&&S(n.selection,w.ALTITUDE)&&B(e,n.interactionStartCamera,a),r.tiltMode===A.LOOK_AROUND||n.tiltMode===A.LOOK_AROUND?v(e,t,a,i):U(e,t,a)}function U(e,r,n){const i=j(e.renderCoordsHelper,r.center,r.eye),s=i-t(i,n.min,n.max);return g(s)?s:0}function v(t,r,n,i){switch(i&&(i.requiresTwoSteps=!1),t.viewingMode){case"global":return q(t,r,n,i);case"local":return L(t,r,n,i);default:return void e(t.viewingMode)}}function L(e,r,n,i){const s=j(e.renderCoordsHelper,r.center,r.eye),a=t(s,n.min,n.max),c=s-a;if(!g(c))return 0;if(i){const t=e.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,n=e.renderCoordsHelper.getAltitude(r.eye)-t,s=Math.cos(a);Math.abs(s)>1e-4?i.eyeCenterDistance=n/s:i.eyeCenterDistance=r.distance}return c}function q(e,r,n,i){const s=b(e,r,Q),a=t(s.tiltAtCenter,n.min,n.max);if(!g(s.tiltAtCenter-a))return 0;let c,o;return s.centerIsOnSurface?(c=k(s),o=H(s,c)):(c=s.constraints.clampTilt(s.eyeCenterDistance,s.tiltAtCenter),i&&c<Math.PI/2&&(i.requiresTwoSteps=!0,c=Math.PI/2-1e-5),o=F(s,c)),i&&(i.eyeCenterDistance=E(s,c)),o}function b(e,t,n){const i=e.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,a=i+C(e.spatialReference).radius,c=e.renderCoordsHelper.intersectManifold(t.ray,i,z);return n.eyeCenterDistance=t.distance,n.centerIsOnSurface=!1,s(c)?(n.eyeCenterDistance=d(t.eye,c),n.tiltAtCenter=j(e.renderCoordsHelper,c,t.eye),n.centerIsOnSurface=!0):e.state.isLocal?n.tiltAtCenter=j(e.renderCoordsHelper,t.center,t.eye):(I(O(a),t.ray,z),n.eyeCenterDistance=d(t.eye,z),n.tiltAtCenter=r(-f(t.viewForward,p(z,z)))),n.radius=a,n.eyeRadius=y(t.eye),n.constraints=e.state.constraints,n}function g(e){return Math.abs(e)>1e-9}function k(e){const{constraints:t,eyeCenterDistance:r,tiltAtCenter:n}=e;let i=n,s=t.clampTilt(r,n);const a=E(e,s);if(t.clampTilt(a,n)===s)return s;let c=0;for(;c<10&&g(s-i);){const r=(i+s)/2,n=E(e,r);g(t.clampTilt(n,r)-r)?i=r:s=r,c++}return s}function E(e,r){if(!e.centerIsOnSurface)return e.eyeCenterDistance;const i=Math.PI-t(r,0,Math.PI),s=n(e.radius/e.eyeRadius*Math.sin(i)),a=Math.PI-i-s,c=Math.sin(a)/Math.sin(i);if(e.eyeRadius<e.radius&&c>1){const t=Math.PI-s,r=Math.PI-i-t;return Math.sin(r)/Math.sin(i)*e.eyeRadius}return c*e.eyeRadius}function H(e,t){const r=n(e.radius/e.eyeRadius*Math.sin(e.tiltAtCenter)),i=n(e.radius/e.eyeRadius*Math.sin(t));return e.eyeRadius>e.radius?r-i:i-r}function F(e,t){return e.tiltAtCenter-Math.PI/2-(t-Math.PI/2)}function N(e,t,r){if(t.interactionType===D.NONE)return;const{interactionStartCamera:n,interactionFactor:i}=t,{min:s,max:a}=r,c=P(e,n,T,t),o=0===c?0:j(e.renderCoordsHelper,n.center,n.eye);r.min=s,r.max=a,t.interactionType===D.TUMBLE?(S(t.selection,w.ALTITUDE)&&B(e,n,r),R(c,o,!0,i,G,r)):R(c,o,!1,i,G,r)}function B(e,t,n){if(e.state.isLocal)return;const i=e.state.constraints;if(!i.altitude)return;const s=h(t.center),a=Math.sqrt(s),c=t.distance,o=C(e.spatialReference).radius,u=i.altitude.min+o,l=i.altitude.max+o,m=(u*u-c*c-s)/(-2*a*c),d=(l*l-c*c-s)/(-2*a*c);n.min=Math.max(n.min,Math.min(Math.PI-r(d),n.max)),n.max=Math.min(n.max,Math.PI-r(m))}const K=M(),_=c(),z=M(),G=i(5),J={min:0,max:0},Q={constraints:null,radius:0,eyeRadius:0,centerIsOnSurface:!0,eyeCenterDistance:0,tiltAtCenter:0},V={eyeCenterDistance:0,requiresTwoSteps:!1};export{x as applyTiltConstraint,P as getTiltConstraintError};
5
+ import{neverReached as e}from"../../../../core/compilerUtils.js";import{clamp as t,acosClamped as r,asinClamped as n,deg2rad as i}from"../../../../core/mathUtils.js";import{isSome as s}from"../../../../core/maybe.js";import{d as a}from"../../../../chunks/mat4.js";import{c}from"../../../../chunks/mat4f64.js";import{b as o,m as u,g as l,a as m,i as d,e as f,n as p,l as y,p as h}from"../../../../chunks/vec3.js";import{c as M}from"../../../../chunks/vec3f64.js";import{getReferenceEllipsoid as C}from"../../../../geometry/projectionEllipsoid.js";import{j as I,k as O,t as T}from"../../../../chunks/sphere.js";import{defaultApplyOptions as A,TiltMode as D,InteractionType as S,hasConstraintType as w,ConstraintTypes as R,adjustRangeForInteraction as j}from"./common.js";import{viewAngle as x}from"../../state/utils/viewUtils.js";function P(t,r,n=A,i=!0){W.eyeCenterDistance=0,W.requiresTwoSteps=!1;const s=U(t,r,n,void 0,W);if(0===s)return!1;switch(a(z,-s,r.viewRight),n.tiltMode){case D.LOOK_AROUND:u(_,r.viewForward,z),l(_,_,W.eyeCenterDistance),r.center=m(G,r.eye,_);break;case D.TUMBLE:o(_,r.center,r.eye),u(_,_,z),r.eye=o(G,r.center,_);break;default:e(n.tiltMode)}return r.up=u(G,r.up,z),!W.requiresTwoSteps||!i||P(t,r,n,!1)}function U(e,t,r=A,n=A,i){if(!e.state.constraints.tilt)return 0;const s=t.distance,a=e.state.constraints.tilt(s,Q);return B(e,r,a),n.interactionType===S.TUMBLE&&w(n.selection,R.ALTITUDE)&&K(e,n.interactionStartCamera,a),r.tiltMode===D.LOOK_AROUND||n.tiltMode===D.LOOK_AROUND?L(e,t,a,i):v(e,t,a)}function v(e,r,n){const i=x(e.renderCoordsHelper,r.center,r.eye),s=i-t(i,n.min,n.max);return g(s)?s:0}function L(t,r,n,i){switch(i&&(i.requiresTwoSteps=!1),t.viewingMode){case"global":return q(t,r,n,i);case"local":return k(t,r,n,i);default:return void e(t.viewingMode)}}function k(e,r,n,i){const s=x(e.renderCoordsHelper,r.center,r.eye),a=t(s,n.min,n.max),c=s-a;if(!g(c))return 0;if(i){const t=e.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,n=e.renderCoordsHelper.getAltitude(r.eye)-t,s=Math.cos(a);Math.abs(s)>1e-4?i.eyeCenterDistance=n/s:i.eyeCenterDistance=r.distance}return c}function q(e,r,n,i){const s=b(e,r,V),a=t(s.tiltAtCenter,n.min,n.max);if(!g(s.tiltAtCenter-a))return 0;let c,o;return s.centerIsOnSurface?(c=E(s),o=F(s,c)):(c=s.constraints.clampTilt(s.eyeCenterDistance,s.tiltAtCenter),i&&c<Math.PI/2&&(i.requiresTwoSteps=!0,c=Math.PI/2-1e-5),o=N(s,c)),i&&(i.eyeCenterDistance=H(s,c)),o}function b(e,t,n){const i=e.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,a=i+C(e.spatialReference).radius,c=e.renderCoordsHelper.intersectManifold(t.ray,i,G);return n.eyeCenterDistance=t.distance,n.centerIsOnSurface=!1,s(c)?(n.eyeCenterDistance=d(t.eye,c),n.tiltAtCenter=x(e.renderCoordsHelper,c,t.eye),n.centerIsOnSurface=!0):e.state.isLocal?n.tiltAtCenter=x(e.renderCoordsHelper,t.center,t.eye):(I(O(T,a),t.ray,G),n.eyeCenterDistance=d(t.eye,G),n.tiltAtCenter=r(-f(t.viewForward,p(G,G)))),n.radius=a,n.eyeRadius=y(t.eye),n.constraints=e.state.constraints,n}function g(e){return Math.abs(e)>1e-9}function E(e){const{constraints:t,eyeCenterDistance:r,tiltAtCenter:n}=e;let i=n,s=t.clampTilt(r,n);const a=H(e,s);if(t.clampTilt(a,n)===s)return s;let c=0;for(;c<10&&g(s-i);){const r=(i+s)/2,n=H(e,r);g(t.clampTilt(n,r)-r)?i=r:s=r,c++}return s}function H(e,r){if(!e.centerIsOnSurface)return e.eyeCenterDistance;const i=Math.PI-t(r,0,Math.PI),s=n(e.radius/e.eyeRadius*Math.sin(i)),a=Math.PI-i-s,c=Math.sin(a)/Math.sin(i);if(e.eyeRadius<e.radius&&c>1){const t=Math.PI-s,r=Math.PI-i-t;return Math.sin(r)/Math.sin(i)*e.eyeRadius}return c*e.eyeRadius}function F(e,t){const r=n(e.radius/e.eyeRadius*Math.sin(e.tiltAtCenter)),i=n(e.radius/e.eyeRadius*Math.sin(t));return e.eyeRadius>e.radius?r-i:i-r}function N(e,t){return e.tiltAtCenter-Math.PI/2-(t-Math.PI/2)}function B(e,t,r){if(t.interactionType===S.NONE)return;const{interactionStartCamera:n,interactionFactor:i}=t,{min:s,max:a}=r,c=U(e,n,A,t),o=0===c?0:x(e.renderCoordsHelper,n.center,n.eye);r.min=s,r.max=a,t.interactionType===S.TUMBLE?(w(t.selection,R.ALTITUDE)&&K(e,n,r),j(c,o,!0,i,J,r)):j(c,o,!1,i,J,r)}function K(e,t,n){if(e.state.isLocal)return;const i=e.state.constraints;if(!i.altitude)return;const s=h(t.center),a=Math.sqrt(s),c=t.distance,o=C(e.spatialReference).radius,u=i.altitude.min+o,l=i.altitude.max+o,m=(u*u-c*c-s)/(-2*a*c),d=(l*l-c*c-s)/(-2*a*c);n.min=Math.max(n.min,Math.min(Math.PI-r(d),n.max)),n.max=Math.min(n.max,Math.PI-r(m))}const _=M(),z=c(),G=M(),J=i(5),Q={min:0,max:0},V={constraints:null,radius:0,eyeRadius:0,centerIsOnSurface:!0,eyeCenterDistance:0,tiltAtCenter:0},W={eyeCenterDistance:0,requiresTwoSteps:!1};export{P as applyTiltConstraint,U as getTiltConstraintError};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../Color.js";import"../../../core/has.js";import{destroyHandle as n}from"../../../core/handleUtils.js";import{h as t}from"../../../chunks/vec3.js";import{c as i}from"../../../chunks/vec3f64.js";import{ExtendedLineVisualElement as o,ExtensionType as r}from"./visualElements/ExtendedLineVisualElement.js";import{ParallelLineVisualElement as a}from"./visualElements/ParallelLineVisualElement.js";import{PointVisualElement as l}from"./visualElements/PointVisualElement.js";import{RightAngleQuadVisualElement as s}from"./visualElements/RightAngleQuadVisualElement.js";import{RenderOccludedFlag as c}from"../webgl-engine/lib/Material.js";import{defaults as d}from"../../interactive/snapping/Settings.js";import{anyMapPointToRender as p,anyMapPointsToRenderWithEqualZ as m,LineSegmentHintType as u}from"../../interactive/snapping/snappingUtils.js";import{SnappingVisualizer as v}from"../../interactive/snapping/SnappingVisualizer.js";class g extends v{visualizeIntersectionPoint(t,i){const{coordinateHelper:o,elevationInfo:r,view:a}=i;return n(new l({view:a,primitive:"circle",geometry:o.vectorToPoint(t.intersectionPoint),elevationInfo:r,size:20,outlineSize:2,color:[0,0,0,0],outlineColor:e.toUnitRGBA(d.orange),pixelSnappingEnabled:!1}))}visualizePoint(t,i){const{coordinateHelper:o,elevationInfo:r,view:a}=i;return n(new l({view:a,primitive:"circle",geometry:o.vectorToPoint(t.point),elevationInfo:r,size:20,outlineSize:2,color:[0,0,0,0],outlineColor:e.toUnitRGBA(d.orange),pixelSnappingEnabled:!1}))}visualizeLine(e,t){const{coordinateHelper:i,elevationInfo:o,view:r}=t;return n(this._createLineSegmentHintFromMap(e.type,e.lineStart,e.lineEnd,i,o,r,e.fadeLeft,e.fadeRight))}visualizeParallelSign(i,o){const{coordinateHelper:r,elevationInfo:l,view:s}=o,m=p(i.lineStart,r,l,o.view),u=p(i.lineEnd,r,l,o.view),v=t(u,m,u,.5),g=new a({view:s,attached:!1,offset:d.parallelLineHintOffset,length:d.parallelLineHintLength,width:d.parallelLineHintWidth,color:e.toUnitRGBA(d.orange),location:v,renderOccluded:c.Opaque});return g.setDirectionFromPoints(m,v),g.attached=!0,n(g)}visualizeRightAngleQuad(t,i){const{coordinateHelper:o,elevationInfo:r,view:a}=i;return n(new s({view:a,attached:!0,color:e.toUnitRGBA(d.orange),renderOccluded:c.Transparent,outlineRenderOccluded:c.Opaque,outlineColor:e.toUnitRGBA(d.orange),outlineSize:d.rightAngleHintOutlineSize,size:d.rightAngleHintSize,geometry:{previous:p(t.previousVertex,o,r,a),center:p(t.centerVertex,o,r,a),next:p(t.nextVertex,o,r,a)}}))}_createLineSegmentHintFromMap(e,n,t,o,r,a,l=!0,s=!0){const c=i(),d=i();return m(n,t,o,r,a,c,d),this._createLineSegmentHint(e,a,c,d,l,s)}_createLineSegmentHint(n,t,i,a,l=!0,s=!0){const p=new o({view:t,extensionType:r.FADED,start:i,end:a,color:e.toUnitRGBA(d.orange),renderOccluded:c.Opaque});switch(n){case u.TARGET:p.width=d.lineHintWidthTarget,p.fadedExtensions={start:0,end:d.lineHintFadedExtensions};break;case u.REFERENCE_EXTENSION:p.width=d.lineHintWidthReference,p.fadedExtensions={start:0,end:0};break;case u.REFERENCE:p.width=d.lineHintWidthReference,p.fadedExtensions={start:l?d.lineHintFadedExtensions:0,end:s?d.lineHintFadedExtensions:0}}return p.attached=!0,p}}export{g as SnappingVisualizer3D};
5
+ import e from"../../../Color.js";import"../../../core/has.js";import{destroyHandle as n}from"../../../core/handleUtils.js";import{unwrapOr as t}from"../../../core/maybe.js";import{h as i}from"../../../chunks/vec3.js";import{c as o}from"../../../chunks/vec3f64.js";import{ExtendedLineVisualElement as r,ExtensionType as a}from"./visualElements/ExtendedLineVisualElement.js";import{ParallelLineVisualElement as l}from"./visualElements/ParallelLineVisualElement.js";import{PointVisualElement as s}from"./visualElements/PointVisualElement.js";import{RightAngleQuadVisualElement as c}from"./visualElements/RightAngleQuadVisualElement.js";import{RenderOccludedFlag as d}from"../webgl-engine/lib/Material.js";import{defaults as p}from"../../interactive/snapping/Settings.js";import{anyMapPointToRender as m,anyMapPointsToRenderWithEqualRelativeZ as v,LineSegmentHintType as u}from"../../interactive/snapping/snappingUtils.js";import{SnappingVisualizer as f}from"../../interactive/snapping/SnappingVisualizer.js";class g extends f{visualizeIntersectionPoint(i,o){const{coordinateHelper:r,view:a}=o;return n(new s({view:a,primitive:"circle",geometry:r.vectorToPoint(i.intersectionPoint),elevationInfo:t(i.elevationInfo,o.elevationInfo),size:20,outlineSize:2,color:[0,0,0,0],outlineColor:e.toUnitRGBA(p.orange),pixelSnappingEnabled:!1}))}visualizePoint(i,o){const{coordinateHelper:r,view:a}=o;return n(new s({view:a,primitive:"circle",geometry:r.vectorToPoint(i.point),elevationInfo:t(i.elevationInfo,o.elevationInfo),size:20,outlineSize:2,color:[0,0,0,0],outlineColor:e.toUnitRGBA(p.orange),pixelSnappingEnabled:!1}))}visualizeLine(e,i){const{coordinateHelper:o,view:r}=i;return n(this._createLineSegmentHintFromMap(e.type,e.lineStart,e.lineEnd,o,t(e.elevationInfo,i.elevationInfo),r,e.fadeLeft,e.fadeRight))}visualizeParallelSign(o,r){const{coordinateHelper:a,view:s}=r,c=t(o.elevationInfo,r.elevationInfo),v=m(o.lineStart,a,c,r.view),u=m(o.lineEnd,a,c,r.view),f=i(u,v,u,.5),g=new l({view:s,attached:!1,offset:p.parallelLineHintOffset,length:p.parallelLineHintLength,width:p.parallelLineHintWidth,color:e.toUnitRGBA(p.orange),location:f,renderOccluded:d.Opaque});return g.setDirectionFromPoints(v,f),g.attached=!0,n(g)}visualizeRightAngleQuad(i,o){const{coordinateHelper:r,view:a}=o,l=t(i.elevationInfo,o.elevationInfo);return n(new c({view:a,attached:!0,color:e.toUnitRGBA(p.orange),renderOccluded:d.Transparent,outlineRenderOccluded:d.Opaque,outlineColor:e.toUnitRGBA(p.orange),outlineSize:p.rightAngleHintOutlineSize,size:p.rightAngleHintSize,geometry:{previous:m(i.previousVertex,r,l,a),center:m(i.centerVertex,r,l,a),next:m(i.nextVertex,r,l,a)}}))}_createLineSegmentHintFromMap(e,n,t,i,r,a,l=!0,s=!0){const c=o(),d=o();return v(n,t,i,r,a,c,d),this._createLineSegmentHint(e,a,c,d,l,s)}_createLineSegmentHint(n,t,i,o,l=!0,s=!0){const c=new r({view:t,extensionType:a.FADED,start:i,end:o,color:e.toUnitRGBA(p.orange),renderOccluded:d.Opaque});switch(n){case u.TARGET:c.width=p.lineHintWidthTarget,c.fadedExtensions={start:0,end:p.lineHintFadedExtensions};break;case u.REFERENCE_EXTENSION:c.width=p.lineHintWidthReference,c.fadedExtensions={start:0,end:0};break;case u.REFERENCE:c.width=p.lineHintWidthReference,c.fadedExtensions={start:l?p.lineHintFadedExtensions:0,end:s?p.lineHintFadedExtensions:0}}return c.attached=!0,c}}export{g as SnappingVisualizer3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../Color.js";import i from"../../../../../analysis/LineOfSightAnalysisObserver.js";import r from"../../../../../analysis/LineOfSightAnalysisTarget.js";import a from"../../../../../core/Collection.js";import s from"../../../../../core/Handles.js";import{handlesGroup as n,makeHandle as o}from"../../../../../core/handleUtils.js";import l from"../../../../../core/Logger.js";import{destroyMaybe as c,isSome as u,removeMaybe as h,isNone as p,applySome as d}from"../../../../../core/maybe.js";import{watch as g,syncAndInitial as _,sync as m}from"../../../../../core/reactiveUtils.js";import{property as v}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as y}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as b,fromPoints as f}from"../../../../../geometry/support/lineSegment.js";import{getGraphicEffectiveElevationInfo as T,getConvertedElevation as M}from"../../../../../support/elevationInfoUtils.js";import w from"../../../../../symbols/support/ElevationInfo.js";import{LineOfSightRayIntersector as C}from"../../../analysis/LineOfSight/LineOfSightRayIntersector.js";import{LineOfSightToolConfiguration as L}from"./LineOfSightToolConfiguration.js";import{createSphereManipulator as k,createSphereManipulatorRenderObjects as S}from"./lineOfSightToolUtils.js";import{LaserlineVisualElement as V}from"../../visualElements/LaserlineVisualElement.js";import{IntersectorType as O}from"../../../webgl-engine/lib/IntersectorInterfaces.js";import{createManipulatorDragEventPipeline as E}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as I}from"../../../../interactive/InteractiveToolBase.js";import{ManipulatorStateCustomFlags as j}from"../../../../interactive/interfaces.js";var F;!function(e){e.Ready="ready",e.Creating="creating",e.Created="created"}(F||(F={}));const P=a.ofType(r),x=l.getLogger("esri.views.3d.interactive.analysisTools.lineOfSight.LineOfSightTool");let R=class extends I{constructor(e){super(e),this.configuration=new L,this.analysisView=null,this._someManipulatorsFocused=!1,this._laserlineVisualElement=null,this._grabbedManipulator=null,this._analysisHandles=new s,this._handles=new s,this._manipulatorHandles=new s,this._targetTrackerManipulator=null}initialize(){this._intersector=new C({view:this.view}),this._handles.add(g((()=>this.state),(e=>{e===F.Created&&this.finishToolCreation()}),_)),this._observerManipulator=this._createObserverManipulator(),this._handles.add([g((()=>({...this.configuration.observer})),(()=>this._updateObserverManipulatorStyle()),m),g((()=>this.analysisView.elevationAlignedObserver),(e=>this._onObserverLocationChange(e)),_),g((()=>({...this.configuration.laserLine})),(()=>this._createVisualElements()),_),this._connectComputations()])}destroy(){this._handles=c(this._handles),this._manipulatorHandles=c(this._manipulatorHandles),this._analysisHandles=c(this._analysisHandles),this._observerManipulator=null,this._clearTargetTracker(),this._removeVisualElements(),this._intersector=null,this._set("analysis",null)}get state(){return this.active?u(this._grabbedManipulator)?F.Created:F.Creating:u(this.analysis.observer)&&u(this.analysis.observer.position)?F.Created:F.Ready}get cursor(){return!this._someManipulatorsFocused&&this.active&&this._showTracker?"crosshair":null}get updating(){return!!u(this.analysisView)&&this.analysisView.updating}get _showTracker(){return this.active&&"mouse"===this._latestPointerMovePointerType}get _shouldRenderTracker(){return this._showTracker&&u(this.analysis.observer)&&u(this.analysis.observer.position)&&!this._someManipulatorsFocused}continue(){this.view.activeTool=this}stop(){this.view.activeTool=null}onInputEvent(e){switch(e.type){case"immediate-double-click":this._doubleClickHandler(e);break;case"key-down":this._keyDownHandler(e);break;case"pointer-move":this._pointerMoveHandler(e)}}onInputEventAfter(e){if("immediate-click"===e.type)this._clickHandler(e)}onShow(){this.analysis.visible=!0}onHide(){this.analysis.visible=!1}onActivate(){this._manipulatorFocusChanged()}onDeactivate(){this._clearTargetTracker(),this._manipulatorFocusChanged()}_connectComputations(){let e=null;return n([g((()=>this.analysisView.computations),(t=>{e=h(e),e=t.on("change",(e=>this._onComputationsCollectionChange(e))),t.forEach((e=>this._connectComputation(e)))}),_),o((()=>e=h(e)))])}_onComputationsCollectionChange(e){e.added.forEach((e=>this._connectComputation(e))),e.removed.forEach((e=>this._disconnectComputation(e)))}_connectComputation(e){if(this.destroyed)return void x.warn("Attempting to connect an analysis to a destroyed LineOfSight tool. Ignoring.");const t=this._analysisHandles;if(t.has(e))return;const i=this._createTargetManipulator(e.target);p(this._targetTrackerManipulator)&&i.metadata.target===this.analysisView.cursorTarget&&(this._targetTrackerManipulator=i,this._targetTrackerManipulator.available=!1,this._targetTrackerManipulator.interactive=!1,this._updateLaserLineRenderer()),t.add([g((()=>this._getLineOfSightManipulatorStateDependencies(e)),(()=>this._updateManipulatorState(i,e)),_),g((()=>e.elevationAlignedTargetLocation),(e=>this._onTargetLocationChange(e,i)),_)],e)}_disconnectComputation(e){if(this.destroyed)return void x.warn("Attempting to disconnect an analysis from a destroyed LineOfSight tool. Ignoring.");this._analysisHandles.remove(e);const t=this._getTargetManipulator(e.target);u(t)&&(this.manipulators.remove(t),this._manipulatorHandles.remove(t),u(this._targetTrackerManipulator)&&this._targetTrackerManipulator===t&&(this._targetTrackerManipulator=null))}_clearTargetTracker(){u(this.analysisView.cursorTarget)&&(this.analysisView.cursorTarget=c(this.analysisView.cursorTarget))}_createManipulator(e,t,i){const r=k(this.view,e);return r.metadata=i,this._manipulatorHandles.add([t(r),r.events.on("focus-changed",(()=>this._manipulatorFocusChanged())),r.events.on("grab-changed",(e=>this._manipulatorGrabChanged(r,e))),r.events.on("immediate-click",(e=>e.stopPropagation()))],r),this.manipulators.add(r),r}_createTargetManipulator(e){const t=this.configuration,i={size:t.target.size,customColor1:t.target.visibleColor,customColor2:t.target.occludedColor,customColor3:t.target.undefinedColor,visible:!0},r={target:e,type:"target"},a=this._createManipulator(i,(e=>this._createTargetManipulatorDragPipeline(e)),r);return u(e.position)?a.elevationAlignedLocation=e.position:a.available=!1,a}_getTargetManipulator(e){let t=null;return this.manipulators.forEach((i=>{const r=i.manipulator;p(t)&&"target"===r.metadata.type&&r.metadata.target===e&&(t=r)})),t}_createObserverManipulator(){const e=this.configuration,t={size:e.observer.size,color:e.observer.color,visible:!0};return this._createManipulator(t,(e=>this._createObserverManipulatorDragPipeline(e)),{type:"observer",intersection:null})}_updateObserverManipulatorStyle(){const e=this._observerManipulator,t=this.configuration.observer,i={size:t.size,color:t.color,visible:e.available};e.renderObjects=S(i)}_manipulatorFocusChanged(){this._someManipulatorsFocused=this.manipulators.some((e=>e.manipulator.focused)),this._updateLaserLineRenderer()}_screenToIntersection(){return e=>{const t=this._intersector.getScreenPointIntersection(e.screenEnd);return p(t)?null:{...e,intersection:t}}}_createTargetManipulatorDragPipeline(e){return E(e,((t,i,r)=>{i.next(this._screenToIntersection()).next(this._updateTargetDragStep(e)).next((()=>this._updateLaserLineRenderer())),r.next(this._cancelTargetDragStep(e.metadata.target)).next((()=>this._updateLaserLineRenderer()))}))}_createObserverManipulatorDragPipeline(e){return E(e,((e,t,i)=>{t.next(this._screenToIntersection()).next(this._updateObserverDragStep()).next((()=>this._updateLaserLineRenderer())),i.next(this._cancelObserverDragStep()).next((()=>this._updateLaserLineRenderer()))}))}_updateObserverDragStep(){return e=>(u(e.intersection.point)?(p(this.analysis.observer)&&(this.analysis.observer=new i),this._updateFromIntersection(this.analysis.observer,e.intersection)):this.analysis.observer=null,e)}_cancelObserverDragStep(){const e=u(this.analysis.observer)&&u(this.analysis.observer.position)?this.analysis.observer.clone():null;return t=>(this.analysis.observer=e,t)}_updateTargetDragStep(e){return t=>{this._updateFromIntersection(e.metadata.target,t.intersection);const i=t.intersection.point;return u(i)&&(e.elevationAlignedLocation=i),t}}_cancelTargetDragStep(e){const t=d(e.position,(e=>e.clone()));return i=>(e.position=t,i)}_manipulatorGrabChanged(e,t){switch(t.action){case"start":this._grabbedManipulator=e;break;case"end":this._grabbedManipulator===e&&(this._grabbedManipulator=null)}this._manipulatorFocusChanged()}_updateManipulatorState(e,t){const{isValid:i,isTargetVisible:r}=t.computationResult;e.state=i?r?j.Custom1:j.Custom2:j.Custom3}_getLineOfSightManipulatorStateDependencies(e){const{isValid:t,isTargetVisible:i}=e.computationResult;return{isValid:t,isTargetVisible:i}}_updateLaserLineRenderer(){if(p(this._laserlineVisualElement))return;const e=this._laserlineVisualElement,t=u(this._grabbedManipulator)?this._grabbedManipulator:this._shouldRenderTracker&&u(this.analysis.observer)&&u(this.analysis.observer.position)?this._targetTrackerManipulator:null;this.configuration.laserLine.enabled&&u(t)?(e.visible=!0,e.heightManifoldTarget=t.renderLocation,t!==this._observerManipulator?e.lineVerticalPlaneSegment=f(this._observerManipulator.renderLocation,t.renderLocation,H):e.lineVerticalPlaneSegment=null):(e.visible=!1,e.heightManifoldTarget=null,e.lineVerticalPlaneSegment=null)}_createVisualElements(){const e=this.configuration.laserLine;this._removeVisualElements(),this._laserlineVisualElement=new V({view:this.view,attached:!0,style:{glowColor:t.toUnitRGB(e.glowColor),glowWidth:e.glowWidth,innerColor:t.toUnitRGB(e.innerColor),innerWidth:e.innerWidth,globalAlpha:e.globalAlpha}})}_removeVisualElements(){u(this._laserlineVisualElement)&&(this._laserlineVisualElement.destroy(),this._laserlineVisualElement=null)}_onObserverLocationChange(e){p(e)?this._observerManipulator.available=!1:(this._observerManipulator.metadata.intersection=null,this._observerManipulator.available=!0,this._observerManipulator.elevationAlignedLocation=e)}_onTargetLocationChange(e,t){u(e)?(t.elevationAlignedLocation=e,t!==this._targetTrackerManipulator&&(t.available=!0)):t.available=!1}_addPointFromClickEvent(e){const t=this._intersector.getScreenPointIntersection(e);if(!p(t)&&!p(t.point))if(u(this.analysis.observer)&&u(this.analysis.observer.position)){this._clearTargetTracker();const e=new r;this._updateFromIntersection(e,t),this.analysis.targets.add(e)}else{const e=new i;this._updateFromIntersection(e,t),this.analysis.observer=e}}_clickHandler(e){this.active&&(this._addPointFromClickEvent({x:e.x,y:e.y}),e.stopPropagation())}_doubleClickHandler(e){this.active&&(this.stop(),e.stopPropagation())}_keyDownHandler(e){this.active&&"Escape"===e.key&&(this.stop(),e.stopPropagation())}_pointerMoveHandler(e){if(this._latestPointerMovePointerType=e.pointerType,this._updateLaserLineRenderer(),!this._showTracker||p(this.analysis.observer)||p(this.analysis.observer.position))return;const t={x:e.x,y:e.y},i=this._intersector.getScreenPointIntersection(t);u(i)&&u(i.point)&&(p(this.analysisView.cursorTarget)&&(this.analysisView.cursorTarget=new r),this._updateFromIntersection(this.analysisView.cursorTarget,i),this._updateLaserLineRenderer())}_updateFromIntersection(e,t){if(p(t.point))return e.position=null,e.elevationInfo=null,void(e.excludedFeature=null);switch(t.type){case O.OBJECT:if(u(t.graphic)){const i=t.graphic,r=T(i);"on-the-ground"===r.mode&&(r.mode="relative-to-ground",r.offset=0),e.elevationInfo=new w(r),e.excludedFeature=i}else e.elevationInfo=null,e.excludedFeature=null;break;case O.TERRAIN:case O.I3S:e.elevationInfo=new w({mode:"on-the-ground"}),e.excludedFeature=null;break;default:e.elevationInfo=null,e.excludedFeature=null}const i=t.point.clone();i.z=M(this.view,i,{mode:"absolute-height",offset:0},e.elevationInfo),e.position=i}get testInfo(){return{laserLineVisualElement:this._laserlineVisualElement}}};e([v({constructOnly:!0})],R.prototype,"view",void 0),e([v({constructOnly:!0})],R.prototype,"analysis",void 0),e([v({readOnly:!0})],R.prototype,"state",null),e([v({readOnly:!0})],R.prototype,"cursor",null),e([v({readOnly:!0})],R.prototype,"updating",null),e([v({type:L})],R.prototype,"configuration",void 0),e([v({constructOnly:!0})],R.prototype,"analysisView",void 0),e([v({readOnly:!0})],R.prototype,"_showTracker",null),e([v()],R.prototype,"_latestPointerMovePointerType",void 0),e([v()],R.prototype,"_shouldRenderTracker",null),e([v()],R.prototype,"_someManipulatorsFocused",void 0),e([v()],R.prototype,"_laserlineVisualElement",void 0),e([v()],R.prototype,"_grabbedManipulator",void 0),R=e([y("esri.views.3d.interactive.analysisTools.lineOfSight.LineOfSightTool")],R);const H=b();export{P as LineOfSightTargetCollection,R as LineOfSightTool};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../Color.js";import i from"../../../../../analysis/LineOfSightAnalysisObserver.js";import r from"../../../../../analysis/LineOfSightAnalysisTarget.js";import a from"../../../../../core/Collection.js";import s from"../../../../../core/Handles.js";import{handlesGroup as n,makeHandle as o}from"../../../../../core/handleUtils.js";import l from"../../../../../core/Logger.js";import{destroyMaybe as c,isSome as u,removeMaybe as h,isNone as p,applySome as d}from"../../../../../core/maybe.js";import{watch as g,syncAndInitial as _,sync as m}from"../../../../../core/reactiveUtils.js";import{property as v}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as y}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as b,fromPoints as f}from"../../../../../geometry/support/lineSegment.js";import{getGraphicEffectiveElevationInfo as T,getConvertedElevation as M}from"../../../../../support/elevationInfoUtils.js";import w from"../../../../../symbols/support/ElevationInfo.js";import{LineOfSightRayIntersector as C}from"../../../analysis/LineOfSight/LineOfSightRayIntersector.js";import{LineOfSightToolConfiguration as L}from"./LineOfSightToolConfiguration.js";import{createSphereManipulator as k,createSphereManipulatorRenderObjects as S}from"./lineOfSightToolUtils.js";import{LaserlineVisualElement as V}from"../../visualElements/LaserlineVisualElement.js";import{IntersectorType as O}from"../../../webgl-engine/lib/IntersectorInterfaces.js";import{createManipulatorDragEventPipeline as E}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as I}from"../../../../interactive/InteractiveToolBase.js";import{ManipulatorStateCustomFlags as j}from"../../../../interactive/interfaces.js";var F;!function(e){e.Ready="ready",e.Creating="creating",e.Created="created"}(F||(F={}));const P=a.ofType(r),x=l.getLogger("esri.views.3d.interactive.analysisTools.lineOfSight.LineOfSightTool");let R=class extends I{constructor(e){super(e),this.configuration=new L,this.analysisView=null,this._someManipulatorsFocused=!1,this._laserlineVisualElement=null,this._grabbedManipulator=null,this._analysisHandles=new s,this._handles=new s,this._manipulatorHandles=new s,this._targetTrackerManipulator=null}initialize(){this._intersector=new C({view:this.view}),this._handles.add(g((()=>this.state),(e=>{e===F.Created&&this.finishToolCreation()}),_)),this._observerManipulator=this._createObserverManipulator(),this._handles.add([g((()=>({...this.configuration.observer})),(()=>this._updateObserverManipulatorStyle()),m),g((()=>this.analysisView.elevationAlignedObserver),(e=>this._onObserverLocationChange(e)),_),g((()=>({...this.configuration.laserLine})),(()=>this._createVisualElements()),_),this._connectComputations()])}destroy(){this._handles=c(this._handles),this._manipulatorHandles=c(this._manipulatorHandles),this._analysisHandles=c(this._analysisHandles),this._observerManipulator=null,this._clearTargetTracker(),this._removeVisualElements(),this._intersector=null,this._set("analysis",null)}get state(){return this.active?u(this._grabbedManipulator)?F.Created:F.Creating:u(this.analysis.observer)&&u(this.analysis.observer.position)?F.Created:F.Ready}get cursor(){return!this._someManipulatorsFocused&&this.active&&this._showTracker?"crosshair":null}get updating(){return!!u(this.analysisView)&&this.analysisView.updating}get _showTracker(){return this.active&&"mouse"===this._latestPointerMovePointerType}get _shouldRenderTracker(){return this._showTracker&&u(this.analysis.observer)&&u(this.analysis.observer.position)&&!this._someManipulatorsFocused}continue(){this.view.activeTool=this}stop(){this.view.activeTool=null}onInputEvent(e){switch(e.type){case"immediate-double-click":this._doubleClickHandler(e);break;case"key-down":this._keyDownHandler(e);break;case"pointer-move":this._pointerMoveHandler(e)}}onInputEventAfter(e){if("immediate-click"===e.type)this._clickHandler(e)}onShow(){}onHide(){}onActivate(){this._manipulatorFocusChanged()}onDeactivate(){this._clearTargetTracker(),this._manipulatorFocusChanged()}_connectComputations(){let e=null;return n([g((()=>this.analysisView.computations),(t=>{e=h(e),e=t.on("change",(e=>this._onComputationsCollectionChange(e))),t.forEach((e=>this._connectComputation(e)))}),_),o((()=>e=h(e)))])}_onComputationsCollectionChange(e){e.added.forEach((e=>this._connectComputation(e))),e.removed.forEach((e=>this._disconnectComputation(e)))}_connectComputation(e){if(this.destroyed)return void x.warn("Attempting to connect an analysis to a destroyed LineOfSight tool. Ignoring.");const t=this._analysisHandles;if(t.has(e))return;const i=this._createTargetManipulator(e.target);p(this._targetTrackerManipulator)&&i.metadata.target===this.analysisView.cursorTarget&&(this._targetTrackerManipulator=i,this._targetTrackerManipulator.available=!1,this._targetTrackerManipulator.interactive=!1,this._updateLaserLineRenderer()),t.add([g((()=>this._getLineOfSightManipulatorStateDependencies(e)),(()=>this._updateManipulatorState(i,e)),_),g((()=>e.elevationAlignedTargetLocation),(e=>this._onTargetLocationChange(e,i)),_)],e)}_disconnectComputation(e){if(this.destroyed)return void x.warn("Attempting to disconnect an analysis from a destroyed LineOfSight tool. Ignoring.");this._analysisHandles.remove(e);const t=this._getTargetManipulator(e.target);u(t)&&(this.manipulators.remove(t),this._manipulatorHandles.remove(t),u(this._targetTrackerManipulator)&&this._targetTrackerManipulator===t&&(this._targetTrackerManipulator=null))}_clearTargetTracker(){u(this.analysisView.cursorTarget)&&(this.analysisView.cursorTarget=c(this.analysisView.cursorTarget))}_createManipulator(e,t,i){const r=k(this.view,e);return r.metadata=i,this._manipulatorHandles.add([t(r),r.events.on("focus-changed",(()=>this._manipulatorFocusChanged())),r.events.on("grab-changed",(e=>this._manipulatorGrabChanged(r,e))),r.events.on("immediate-click",(e=>e.stopPropagation()))],r),this.manipulators.add(r),r}_createTargetManipulator(e){const t=this.configuration,i={size:t.target.size,customColor1:t.target.visibleColor,customColor2:t.target.occludedColor,customColor3:t.target.undefinedColor,visible:!0},r={target:e,type:"target"},a=this._createManipulator(i,(e=>this._createTargetManipulatorDragPipeline(e)),r);return u(e.position)?a.elevationAlignedLocation=e.position:a.available=!1,a}_getTargetManipulator(e){let t=null;return this.manipulators.forEach((i=>{const r=i.manipulator;p(t)&&"target"===r.metadata.type&&r.metadata.target===e&&(t=r)})),t}_createObserverManipulator(){const e=this.configuration,t={size:e.observer.size,color:e.observer.color,visible:!0};return this._createManipulator(t,(e=>this._createObserverManipulatorDragPipeline(e)),{type:"observer",intersection:null})}_updateObserverManipulatorStyle(){const e=this._observerManipulator,t=this.configuration.observer,i={size:t.size,color:t.color,visible:e.available};e.renderObjects=S(i)}_manipulatorFocusChanged(){this._someManipulatorsFocused=this.manipulators.some((e=>e.manipulator.focused)),this._updateLaserLineRenderer()}_screenToIntersection(){return e=>{const t=this._intersector.getScreenPointIntersection(e.screenEnd);return p(t)?null:{...e,intersection:t}}}_createTargetManipulatorDragPipeline(e){return E(e,((t,i,r)=>{i.next(this._screenToIntersection()).next(this._updateTargetDragStep(e)).next((()=>this._updateLaserLineRenderer())),r.next(this._cancelTargetDragStep(e.metadata.target)).next((()=>this._updateLaserLineRenderer()))}))}_createObserverManipulatorDragPipeline(e){return E(e,((e,t,i)=>{t.next(this._screenToIntersection()).next(this._updateObserverDragStep()).next((()=>this._updateLaserLineRenderer())),i.next(this._cancelObserverDragStep()).next((()=>this._updateLaserLineRenderer()))}))}_updateObserverDragStep(){return e=>(u(e.intersection.point)?(p(this.analysis.observer)&&(this.analysis.observer=new i),this._updateFromIntersection(this.analysis.observer,e.intersection)):this.analysis.observer=null,e)}_cancelObserverDragStep(){const e=u(this.analysis.observer)&&u(this.analysis.observer.position)?this.analysis.observer.clone():null;return t=>(this.analysis.observer=e,t)}_updateTargetDragStep(e){return t=>{this._updateFromIntersection(e.metadata.target,t.intersection);const i=t.intersection.point;return u(i)&&(e.elevationAlignedLocation=i),t}}_cancelTargetDragStep(e){const t=d(e.position,(e=>e.clone()));return i=>(e.position=t,i)}_manipulatorGrabChanged(e,t){switch(t.action){case"start":this._grabbedManipulator=e;break;case"end":this._grabbedManipulator===e&&(this._grabbedManipulator=null)}this._manipulatorFocusChanged()}_updateManipulatorState(e,t){const{isValid:i,isTargetVisible:r}=t.computationResult;e.state=i?r?j.Custom1:j.Custom2:j.Custom3}_getLineOfSightManipulatorStateDependencies(e){const{isValid:t,isTargetVisible:i}=e.computationResult;return{isValid:t,isTargetVisible:i}}_updateLaserLineRenderer(){if(p(this._laserlineVisualElement))return;const e=this._laserlineVisualElement,t=u(this._grabbedManipulator)?this._grabbedManipulator:this._shouldRenderTracker&&u(this.analysis.observer)&&u(this.analysis.observer.position)?this._targetTrackerManipulator:null;this.configuration.laserLine.enabled&&u(t)?(e.visible=!0,e.heightManifoldTarget=t.renderLocation,t!==this._observerManipulator?e.lineVerticalPlaneSegment=f(this._observerManipulator.renderLocation,t.renderLocation,H):e.lineVerticalPlaneSegment=null):(e.visible=!1,e.heightManifoldTarget=null,e.lineVerticalPlaneSegment=null)}_createVisualElements(){const e=this.configuration.laserLine;this._removeVisualElements(),this._laserlineVisualElement=new V({view:this.view,attached:!0,style:{glowColor:t.toUnitRGB(e.glowColor),glowWidth:e.glowWidth,innerColor:t.toUnitRGB(e.innerColor),innerWidth:e.innerWidth,globalAlpha:e.globalAlpha}})}_removeVisualElements(){u(this._laserlineVisualElement)&&(this._laserlineVisualElement.destroy(),this._laserlineVisualElement=null)}_onObserverLocationChange(e){p(e)?this._observerManipulator.available=!1:(this._observerManipulator.metadata.intersection=null,this._observerManipulator.available=!0,this._observerManipulator.elevationAlignedLocation=e)}_onTargetLocationChange(e,t){u(e)?(t.elevationAlignedLocation=e,t!==this._targetTrackerManipulator&&(t.available=!0)):t.available=!1}_addPointFromClickEvent(e){const t=this._intersector.getScreenPointIntersection(e);if(!p(t)&&!p(t.point))if(u(this.analysis.observer)&&u(this.analysis.observer.position)){this._clearTargetTracker();const e=new r;this._updateFromIntersection(e,t),this.analysis.targets.add(e)}else{const e=new i;this._updateFromIntersection(e,t),this.analysis.observer=e}}_clickHandler(e){this.active&&(this._addPointFromClickEvent({x:e.x,y:e.y}),e.stopPropagation())}_doubleClickHandler(e){this.active&&(this.stop(),e.stopPropagation())}_keyDownHandler(e){this.active&&"Escape"===e.key&&(this.stop(),e.stopPropagation())}_pointerMoveHandler(e){if(this._latestPointerMovePointerType=e.pointerType,this._updateLaserLineRenderer(),!this._showTracker||p(this.analysis.observer)||p(this.analysis.observer.position))return;const t={x:e.x,y:e.y},i=this._intersector.getScreenPointIntersection(t);u(i)&&u(i.point)&&(p(this.analysisView.cursorTarget)&&(this.analysisView.cursorTarget=new r),this._updateFromIntersection(this.analysisView.cursorTarget,i),this._updateLaserLineRenderer())}_updateFromIntersection(e,t){if(p(t.point))return e.position=null,e.elevationInfo=null,void(e.excludedFeature=null);switch(t.type){case O.OBJECT:if(u(t.graphic)){const i=t.graphic,r=T(i);"on-the-ground"===r.mode&&(r.mode="relative-to-ground",r.offset=0),e.elevationInfo=new w(r),e.excludedFeature=i}else e.elevationInfo=null,e.excludedFeature=null;break;case O.TERRAIN:case O.I3S:e.elevationInfo=new w({mode:"on-the-ground"}),e.excludedFeature=null;break;default:e.elevationInfo=null,e.excludedFeature=null}const i=t.point.clone();i.z=M(this.view,i,{mode:"absolute-height",offset:0},e.elevationInfo),e.position=i}get testInfo(){return{laserLineVisualElement:this._laserlineVisualElement}}};e([v({constructOnly:!0})],R.prototype,"view",void 0),e([v({constructOnly:!0})],R.prototype,"analysis",void 0),e([v({readOnly:!0})],R.prototype,"state",null),e([v({readOnly:!0})],R.prototype,"cursor",null),e([v({readOnly:!0})],R.prototype,"updating",null),e([v({type:L})],R.prototype,"configuration",void 0),e([v({constructOnly:!0})],R.prototype,"analysisView",void 0),e([v({readOnly:!0})],R.prototype,"_showTracker",null),e([v()],R.prototype,"_latestPointerMovePointerType",void 0),e([v()],R.prototype,"_shouldRenderTracker",null),e([v()],R.prototype,"_someManipulatorsFocused",void 0),e([v()],R.prototype,"_laserlineVisualElement",void 0),e([v()],R.prototype,"_grabbedManipulator",void 0),R=e([y("esri.views.3d.interactive.analysisTools.lineOfSight.LineOfSightTool")],R);const H=b();export{P as LineOfSightTargetCollection,R as LineOfSightTool};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Handles.js";import{destroyMaybe as i,isNone as s,isSome as a,unwrap as o}from"../../../../../core/maybe.js";import{watch as n,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{clonePoint as p}from"../../../../../layers/graphics/hydratedFeatures.js";import{isPrimaryPointerAction as m}from"../../../analysis/support/measurementUtils.js";import{screenToMap3D as d,hideManipulatorWhileDragging as u}from"../../editingTools/dragEventPipeline3D.js";import c from"./AreaMeasurement3DView.js";import{PickRequest as y}from"../support/PickRequest.js";import{createManipulatorDragEventPipeline as w}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as g}from"../../../../interactive/InteractiveToolBase.js";import{createScreenPointFromEvent as v}from"../../../../support/screenUtils.js";let V=class extends g{constructor(t){super(t),this._handles=new e,this.polygonState="initial",this.analysisView=null}initialize(){this.measurementView=new c({view:this.view,analysis:this.analysis,analysisView:this.analysisView,toolState:this,manipulators:this.manipulators,visible:this.visible}),this._setupManipulators(),this._handles.add(n((()=>this.state),(t=>{"measured"===t&&this.finishToolCreation()}),r))}destroy(){this.measurementView.destroy(),this._set("measurementView",null),this._handles=i(this._handles)}get state(){return 0===this.analysisView.path.numVertices?"ready":this.analysisView.validMeasurement&&"editing"!==this.polygonState?"measured":"measuring"}get cursor(){return"ready"===this.state||"drawing"===this.polygonState?"crosshair":null}finishMeasurement(){const t=this.analysisView.path;t.numVertices<3?(t.clear(),this.polygonState="initial"):(t.close(),this.polygonState="measured"),this.analysisView.cursorPoint=null}onShow(){this.measurementView.show()}onHide(){this.measurementView.hide()}onInputEvent(t){switch(t.type){case"immediate-double-click":this._handleImmediateDoubleClick(t);break;case"immediate-click":this._handleImmediateClick(t);break;case"pointer-move":this._handlePointerMove(t);break;case"drag":this._handleDrag(t);break;case"key-down":this._handleKeyDown(t)}}_setupManipulators(){const t=t=>`manipulator-${t}`,e=t=>t.events.on("grab-changed",(()=>{if(this.analysisView.validMeasurement){const t=this.manipulators.some((t=>t.manipulator.grabbing));this.polygonState=t?"editing":"measured"}})),i=(i,s)=>{this._handles.add([w(s,((t,e,i)=>{const s=u(t),a=o(t.metadata);e.next(s).next(d(this.view)).next((e=>{t.location=e.mapEnd,this.analysisView.path.setVertexPosition(a,p(e.mapEnd))}));const n=p(this.analysisView.path.getVertexPositionAsPoint(a));i.next(s).next((()=>{this.analysisView.path.setVertexPosition(a,n),t.location=n}))})),e(s)],t(i))},s=e=>{this._handles.remove(t(e))};this.manipulators.forEach((({id:t,manipulator:e})=>{i(t,e)})),this._handles.add([this.manipulators.on("after-add",(({item:{id:t,manipulator:e}})=>{i(t,e)})),this.manipulators.on("after-remove",(({item:{id:t}})=>{s(t)}))])}_handleImmediateDoubleClick(t){m(t)&&("drawing"===this.polygonState&&this.finishMeasurement(),t.stopPropagation())}_handleDrag(t){"editing"===this.polygonState&&t.stopPropagation()}_handleImmediateClick(t){if(!m(t))return;const e=v(t);if(this.active)switch(this.polygonState){case"initial":if(this._addVertexAt(e))return this.analysisView.cursorPoint=null,this.polygonState="drawing",void t.stopPropagation();break;case"drawing":{const i=this.measurementView.vertexHandleAt(e,t.pointerType);if(s(i)){if(this._addVertexAt(e))return this.analysisView.cursorPoint=null,void t.stopPropagation()}else 0===i.index&&(this.finishMeasurement(),t.stopPropagation());break}}"mouse"===t.pointerType&&this._hoverAt(e)}_handlePointerMove(t){if("mouse"===t.pointerType){const e=v(t);this._hoverAt(e)}}_handleKeyDown(t){"Enter"===t.key&&"drawing"===this.polygonState&&(this.finishMeasurement(),t.stopPropagation())}_hoverAt(t){if(this.active&&("initial"===this.polygonState||"drawing"===this.polygonState)){const e=this._pick(t);a(e)&&(this.analysisView.cursorPoint=e.mapPoint)}else this.analysisView.cursorPoint=null}_addVertexAt(t){const e=this._pick(t);return!(!a(e)||!a(e.mapPoint))&&(this.analysisView.path.add(e.mapPoint),!0)}_pick(t){const e=new y(t);return this.measurementView.pick(e)}};t([l({readOnly:!0})],V.prototype,"state",null),t([l()],V.prototype,"polygonState",void 0),t([l({readOnly:!0})],V.prototype,"cursor",null),t([l()],V.prototype,"measurementView",void 0),t([l({constructOnly:!0})],V.prototype,"view",void 0),t([l()],V.prototype,"analysis",void 0),t([l({constructOnly:!0})],V.prototype,"analysisView",void 0),V=t([h("esri.views.3d.interactive.measurementTools.areaMeasurement3D.AreaMeasurement3DTool")],V);const f=V;export{f as default};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Handles.js";import{destroyMaybe as i,isNone as s,isSome as a,unwrap as o}from"../../../../../core/maybe.js";import{watch as r,syncAndInitial as n}from"../../../../../core/reactiveUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../../../../core/accessorSupport/decorators/subclass.js";import{clonePoint as h}from"../../../../../layers/graphics/hydratedFeatures.js";import{isPrimaryPointerAction as m}from"../../../analysis/support/measurementUtils.js";import{screenToMap3D as d,hideManipulatorWhileDragging as u}from"../../editingTools/dragEventPipeline3D.js";import c from"./AreaMeasurement3DView.js";import{PickRequest as y}from"../support/PickRequest.js";import{createManipulatorDragEventPipeline as w}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as g}from"../../../../interactive/InteractiveToolBase.js";import{createScreenPointFromEvent as v}from"../../../../support/screenUtils.js";let V=class extends g{constructor(t){super(t),this._handles=new e,this.polygonState="initial",this.analysisView=null}initialize(){this.measurementView=new c({view:this.view,analysisView:this.analysisView,toolState:this,manipulators:this.manipulators,visible:this.visible}),this._setupManipulators(),this._handles.add(r((()=>this.state),(t=>{"measured"===t&&this.finishToolCreation()}),n))}destroy(){this.measurementView.destroy(),this._set("measurementView",null),this._handles=i(this._handles)}get state(){return 0===this.analysisView.path.numVertices?"ready":this.analysisView.validMeasurement&&"editing"!==this.polygonState?"measured":"measuring"}get cursor(){return"ready"===this.state||"drawing"===this.polygonState?"crosshair":null}finishMeasurement(){const t=this.analysisView.path;t.numVertices<3?(t.clear(),this.polygonState="initial"):(t.close(),this.polygonState="measured"),this.analysisView.cursorPoint=null}onShow(){this.measurementView.show()}onHide(){this.measurementView.hide()}onInputEvent(t){switch(t.type){case"immediate-double-click":this._handleImmediateDoubleClick(t);break;case"immediate-click":this._handleImmediateClick(t);break;case"pointer-move":this._handlePointerMove(t);break;case"drag":this._handleDrag(t);break;case"key-down":this._handleKeyDown(t)}}_setupManipulators(){const t=t=>`manipulator-${t}`,e=t=>t.events.on("grab-changed",(()=>{if(this.analysisView.validMeasurement){const t=this.manipulators.some((t=>t.manipulator.grabbing));this.polygonState=t?"editing":"measured"}})),i=(i,s)=>{this._handles.add([w(s,((t,e,i)=>{const s=u(t),a=o(t.metadata);e.next(s).next(d(this.view)).next((e=>{t.location=e.mapEnd,this.analysisView.path.setVertexPosition(a,h(e.mapEnd))}));const r=h(this.analysisView.path.getVertexPositionAsPoint(a));i.next(s).next((()=>{this.analysisView.path.setVertexPosition(a,r),t.location=r}))})),e(s)],t(i))},s=e=>{this._handles.remove(t(e))};this.manipulators.forEach((({id:t,manipulator:e})=>{i(t,e)})),this._handles.add([this.manipulators.on("after-add",(({item:{id:t,manipulator:e}})=>{i(t,e)})),this.manipulators.on("after-remove",(({item:{id:t}})=>{s(t)}))])}_handleImmediateDoubleClick(t){m(t)&&("drawing"===this.polygonState&&this.finishMeasurement(),t.stopPropagation())}_handleDrag(t){"editing"===this.polygonState&&t.stopPropagation()}_handleImmediateClick(t){if(!m(t))return;const e=v(t);if(this.active)switch(this.polygonState){case"initial":if(this._addVertexAt(e))return this.analysisView.cursorPoint=null,this.polygonState="drawing",void t.stopPropagation();break;case"drawing":{const i=this.measurementView.vertexHandleAt(e,t.pointerType);if(s(i)){if(this._addVertexAt(e))return this.analysisView.cursorPoint=null,void t.stopPropagation()}else 0===i.index&&(this.finishMeasurement(),t.stopPropagation());break}}"mouse"===t.pointerType&&this._hoverAt(e)}_handlePointerMove(t){if("mouse"===t.pointerType){const e=v(t);this._hoverAt(e)}}_handleKeyDown(t){"Enter"===t.key&&"drawing"===this.polygonState&&(this.finishMeasurement(),t.stopPropagation())}_hoverAt(t){if(this.active&&("initial"===this.polygonState||"drawing"===this.polygonState)){const e=this._pick(t);a(e)&&(this.analysisView.cursorPoint=e.mapPoint)}else this.analysisView.cursorPoint=null}_addVertexAt(t){const e=this._pick(t);return!(!a(e)||!a(e.mapPoint))&&(this.analysisView.path.add(e.mapPoint),!0)}_pick(t){const e=new y(t);return this.measurementView.pick(e)}};t([l({readOnly:!0})],V.prototype,"state",null),t([l()],V.prototype,"polygonState",void 0),t([l({readOnly:!0})],V.prototype,"cursor",null),t([l()],V.prototype,"measurementView",void 0),t([l({constructOnly:!0})],V.prototype,"view",void 0),t([l()],V.prototype,"analysis",void 0),t([l({constructOnly:!0})],V.prototype,"analysisView",void 0),V=t([p("esri.views.3d.interactive.measurementTools.areaMeasurement3D.AreaMeasurement3DTool")],V);const f=V;export{f as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import i from"../../../../../core/Handles.js";import{destroyMaybe as e,isSome as t,isNone as s,unwrap as a}from"../../../../../core/maybe.js";import{watch as l,sync as n}from"../../../../../core/reactiveUtils.js";import{screenPointObjectToArray as r}from"../../../../../core/screenUtils.js";import{c as o}from"../../../../../chunks/vec3f64.js";import{createSphereManipulator as h}from"../../manipulatorUtils.js";import{PickResult as _}from"../support/PickRequest.js";import{copyParameter as d,resizeArray as u}from"../support/viewUtils.js";import{LaserlineVisualElement as p}from"../../visualElements/LaserlineVisualElement.js";import c from"../../../webgl-engine/lib/GeometryUtil.js";import{newIntersector as y}from"../../../webgl-engine/lib/Intersector.js";import{StoreResults as m}from"../../../webgl-engine/lib/IntersectorInterfaces.js";import{ManipulatorCollection as w}from"../../../../interactive/ManipulatorCollection.js";const g={laserLineGlowColor:[1,.5,0],laserLineGlowWidth:8,laserLineGlowFalloff:8,laserLineInnerColor:[1,1,1],laserLineInnerWidth:1,laserLineGlobalAlpha:.75,laserLineEnabled:!0,handleColor:[1,.5,0],handleOpacity:.5,handleRadius:5,handleRadiusHovered:10,handleRadiusMouse:10,handleRadiusTouch:25,pathLineColor:[1,.5,0,1],pathLineWidth:3,intersectingLineColor:[1,.2,0,1],perimeterLineColor:[1,.5,0,1],perimeterLineWidth:2,projectionLineColor:[1,.5,0,1],projectionLineWidth:2,projectionLineStippleSize:5,areaColor1:[1,.5,0,.5],areaColor2:[1,1,1,.5],fillColor:[1,.5,0,.5],lineSubdivisions:64,labelDistance:25};class v{constructor(i){this.vertexManipulators=[],this._analysisView=null,this._destroyed=!1,this._isManipulatorsOwner=!0,this._laserLine=null,this._cursorManipulator=null,this._listenerHandles=null,this._tempHandlePosition=o(),this._analysis=i.analysis,this._analysisView=i.analysisView,this._toolState=i.toolState,null!=i.manipulators?(this._manipulators=i.manipulators,this._isManipulatorsOwner=!1):this._manipulators=new w,this._view=i.view,this._style=d(g,i.style),this._intersector=y(this._view.state.viewingMode),this._intersector.options.store=m.MIN;const e=h(this._view,this._style.handleColor,this._style.handleOpacity);e.available=!1,e.radius=this._style.handleRadius,e.interactive=!1,this._manipulators.add(e),this._cursorManipulator=e,this._laserLine=new p({view:this._view,attached:!0,style:{glowColor:this._style.laserLineGlowColor,glowWidth:this._style.laserLineGlowWidth,glowFalloff:this._style.laserLineGlowFalloff,innerColor:this._style.laserLineInnerColor,innerWidth:this._style.laserLineInnerWidth,globalAlpha:this._style.laserLineGlobalAlpha}}),this._updateVisibility(i.visible||!0)}destroy(){this._listenerHandles=e(this._listenerHandles),this._isManipulatorsOwner?this._manipulators=e(this._manipulators):this._manipulators=null,this._laserLine=e(this._laserLine),this._destroyed=!0}get destroyed(){return this._destroyed}get visible(){return this._analysis.visible}set visible(i){i?this.show():this.hide()}get testData(){const i=this._laserLine.testData;return{labels:this._analysisView.analysisVisualization.testData.labels,laserLineRenderer:t(i)?{heightManifoldEnabled:i.heightManifoldEnabled,heightManifoldTarget:i.heightManifoldTarget,pointDistanceEnabled:i.pointDistanceEnabled,pointDistanceOrigin:i.pointDistanceOrigin,pointDistanceTarget:i.pointDistanceTarget,lineVerticalPlaneEnabled:i.lineVerticalPlaneEnabled}:{heightManifoldEnabled:!1,heightManifoldTarget:null,pointDistanceEnabled:!1,pointDistanceOrigin:null,pointDistanceTarget:null,lineVerticalPlaneEnabled:!1}}}show(){this._setVisibility(!0)}hide(){this._setVisibility(!1)}_setVisibility(i){this._destroyed||this._analysis.visible===i||this._updateVisibility(i)}_updateVisibility(i){this._analysis.visible=i,this._laserLine.visible=i,i?(this._initializeListeners(),this._updateAll()):(this._destroyListeners(),this.vertexManipulators.forEach((i=>{this._removeVertexManipulator(i.manipulator)})),this.vertexManipulators=[],this._view.cursor=null)}vertexHandleAt(i,e){const s=this._manipulators.intersect(i,e);return t(s)?s.manipulator.metadata:null}pick(i){const e=this._view.spatialReference,t=r(i.screenPoint);this._view.sceneIntersectionHelper.intersectToolIntersectorScreen(t,this._intersector);const a=this._intersector.results.min,l=o();if(!a.getIntersectionPoint(l))return null;const n=this._view.renderCoordsHelper.fromRenderCoords(l,e);return s(n)?null:new _(l,n)}_updateAll(){this._analysis.visible&&this._analysisView.analysisVisualization&&(this._updateVertexManipulators(),this._updateLaserLine())}_createVertexManipulator(){const i=h(this._view,this._style.handleColor,this._style.handleOpacity);i.radius=this._style.handleRadius;return{id:this._manipulators.add(i),manipulator:i}}_removeVertexManipulator(i){this._manipulators.remove(i)}_updateVertexManipulators(){const i=this._analysisView.analysisVisualization.viewData,e=this._analysisView.path?this._analysisView.path.vertices:[],s=this.vertexManipulators;u(s,e.length,(()=>this._createVertexManipulator()),(i=>this._removeVertexManipulator(i.manipulator))),s.forEach(((t,s)=>{t.manipulator.metadata=e[s],t.manipulator.renderLocation=i.positionsRenderCoords[s]})),"drawing"===this._toolState.polygonState&&t(this._analysisView.cursorPoint)?(this._cursorManipulator.available=!0,this._cursorManipulator.location=this._analysisView.cursorPoint):this._cursorManipulator.available=!1}_getFocusPoint(){const i=this._analysisView.lastDraggedVertex;switch(this._toolState.polygonState){case"drawing":return t(this._analysisView.cursorPoint)?this._analysisView.cursorPoint:t(i)?this._analysisView.path.getVertexPositionAsPoint(i):a(this._analysisView.path.lastPoint);case"editing":return t(i)?this._analysisView.path.getVertexPositionAsPoint(i):null;default:return this._analysisView.cursorPoint}}_updateLaserLine(){const i=this._style.laserLineEnabled&&"measured"!==this._toolState.polygonState&&this._toolState.active,e=this._getFocusPoint();if(i&&t(e)){const i=this._tempHandlePosition;this._view.renderCoordsHelper.toRenderCoords(e,i),this._laserLine.heightManifoldTarget=i}else this._laserLine.heightManifoldTarget=null}_initializeListeners(){this._listenerHandles=new i,this._listenerHandles.add([l((()=>this._toolState.polygonState),(()=>this._updateLaserLine())),l((()=>{var i;return null==(i=this._analysisView.analysisVisualization)?void 0:i.viewData}),(()=>this._updateAll()),n),l((()=>({lastDraggedVertex:this._analysisView.lastDraggedVertex,cursorPoint:this._analysisView.cursorPoint})),(()=>this._updateLaserLine())),l((()=>this._toolState.active),(()=>this._updateAll()))])}_destroyListeners(){this._listenerHandles=e(this._listenerHandles)}}v._handleGeometry=c.createSphereGeometry(1,32,32);export{v as default};
5
+ import i from"../../../../../core/Handles.js";import{destroyMaybe as e,isSome as t,isNone as s,unwrap as a}from"../../../../../core/maybe.js";import{watch as l,sync as n}from"../../../../../core/reactiveUtils.js";import{screenPointObjectToArray as r}from"../../../../../core/screenUtils.js";import{c as o}from"../../../../../chunks/vec3f64.js";import{createSphereManipulator as h}from"../../manipulatorUtils.js";import{PickResult as _}from"../support/PickRequest.js";import{copyParameter as d,resizeArray as u}from"../support/viewUtils.js";import{LaserlineVisualElement as p}from"../../visualElements/LaserlineVisualElement.js";import c from"../../../webgl-engine/lib/GeometryUtil.js";import{newIntersector as y}from"../../../webgl-engine/lib/Intersector.js";import{StoreResults as m}from"../../../webgl-engine/lib/IntersectorInterfaces.js";import{ManipulatorCollection as w}from"../../../../interactive/ManipulatorCollection.js";const g={laserLineGlowColor:[1,.5,0],laserLineGlowWidth:8,laserLineGlowFalloff:8,laserLineInnerColor:[1,1,1],laserLineInnerWidth:1,laserLineGlobalAlpha:.75,laserLineEnabled:!0,handleColor:[1,.5,0],handleOpacity:.5,handleRadius:5,handleRadiusHovered:10,handleRadiusMouse:10,handleRadiusTouch:25,pathLineColor:[1,.5,0,1],pathLineWidth:3,intersectingLineColor:[1,.2,0,1],perimeterLineColor:[1,.5,0,1],perimeterLineWidth:2,projectionLineColor:[1,.5,0,1],projectionLineWidth:2,projectionLineStippleSize:5,areaColor1:[1,.5,0,.5],areaColor2:[1,1,1,.5],fillColor:[1,.5,0,.5],lineSubdivisions:64,labelDistance:25};class v{constructor(i){this.vertexManipulators=[],this._analysisView=null,this._destroyed=!1,this._isManipulatorsOwner=!0,this._visible=!0,this._laserLine=null,this._cursorManipulator=null,this._listenerHandles=null,this._tempHandlePosition=o(),this._analysisView=i.analysisView,this._toolState=i.toolState,null!=i.manipulators?(this._manipulators=i.manipulators,this._isManipulatorsOwner=!1):this._manipulators=new w,this._view=i.view,this._style=d(g,i.style),this._intersector=y(this._view.state.viewingMode),this._intersector.options.store=m.MIN;const e=h(this._view,this._style.handleColor,this._style.handleOpacity);e.available=!1,e.radius=this._style.handleRadius,e.interactive=!1,this._manipulators.add(e),this._cursorManipulator=e,this._laserLine=new p({view:this._view,attached:!0,style:{glowColor:this._style.laserLineGlowColor,glowWidth:this._style.laserLineGlowWidth,glowFalloff:this._style.laserLineGlowFalloff,innerColor:this._style.laserLineInnerColor,innerWidth:this._style.laserLineInnerWidth,globalAlpha:this._style.laserLineGlobalAlpha}}),this._updateVisibility(i.visible||!0)}destroy(){this._listenerHandles=e(this._listenerHandles),this._isManipulatorsOwner?this._manipulators=e(this._manipulators):this._manipulators=null,this._laserLine=e(this._laserLine),this._destroyed=!0}get destroyed(){return this._destroyed}get visible(){return this._visible}set visible(i){i?this.show():this.hide()}get testData(){const i=this._laserLine.testData;return{labels:this._analysisView.analysisVisualization.testData.labels,laserLineRenderer:t(i)?{heightManifoldEnabled:i.heightManifoldEnabled,heightManifoldTarget:i.heightManifoldTarget,pointDistanceEnabled:i.pointDistanceEnabled,pointDistanceOrigin:i.pointDistanceOrigin,pointDistanceTarget:i.pointDistanceTarget,lineVerticalPlaneEnabled:i.lineVerticalPlaneEnabled}:{heightManifoldEnabled:!1,heightManifoldTarget:null,pointDistanceEnabled:!1,pointDistanceOrigin:null,pointDistanceTarget:null,lineVerticalPlaneEnabled:!1}}}show(){this._setVisibility(!0)}hide(){this._setVisibility(!1)}_setVisibility(i){this._destroyed||this._visible===i||this._updateVisibility(i)}_updateVisibility(i){this._visible=i,this._laserLine.visible=i,i?(this._initializeListeners(),this._updateAll()):(this._destroyListeners(),this.vertexManipulators.forEach((i=>{this._removeVertexManipulator(i.manipulator)})),this.vertexManipulators=[],this._view.cursor=null)}vertexHandleAt(i,e){const s=this._manipulators.intersect(i,e);return t(s)?s.manipulator.metadata:null}pick(i){const e=this._view.spatialReference,t=r(i.screenPoint);this._view.sceneIntersectionHelper.intersectToolIntersectorScreen(t,this._intersector);const a=this._intersector.results.min,l=o();if(!a.getIntersectionPoint(l))return null;const n=this._view.renderCoordsHelper.fromRenderCoords(l,e);return s(n)?null:new _(l,n)}_updateAll(){this._visible&&this._analysisView.analysisVisualization&&(this._updateVertexManipulators(),this._updateLaserLine())}_createVertexManipulator(){const i=h(this._view,this._style.handleColor,this._style.handleOpacity);i.radius=this._style.handleRadius;return{id:this._manipulators.add(i),manipulator:i}}_removeVertexManipulator(i){this._manipulators.remove(i)}_updateVertexManipulators(){const i=this._analysisView.analysisVisualization.viewData,e=this._analysisView.path?this._analysisView.path.vertices:[],s=this.vertexManipulators;u(s,e.length,(()=>this._createVertexManipulator()),(i=>this._removeVertexManipulator(i.manipulator))),s.forEach(((t,s)=>{t.manipulator.metadata=e[s],t.manipulator.renderLocation=i.positionsRenderCoords[s]})),"drawing"===this._toolState.polygonState&&t(this._analysisView.cursorPoint)?(this._cursorManipulator.available=!0,this._cursorManipulator.location=this._analysisView.cursorPoint):this._cursorManipulator.available=!1}_getFocusPoint(){const i=this._analysisView.lastDraggedVertex;switch(this._toolState.polygonState){case"drawing":return t(this._analysisView.cursorPoint)?this._analysisView.cursorPoint:t(i)?this._analysisView.path.getVertexPositionAsPoint(i):a(this._analysisView.path.lastPoint);case"editing":return t(i)?this._analysisView.path.getVertexPositionAsPoint(i):null;default:return this._analysisView.cursorPoint}}_updateLaserLine(){const i=this._style.laserLineEnabled&&"measured"!==this._toolState.polygonState&&this._toolState.active,e=this._getFocusPoint();if(i&&t(e)){const i=this._tempHandlePosition;this._view.renderCoordsHelper.toRenderCoords(e,i),this._laserLine.heightManifoldTarget=i}else this._laserLine.heightManifoldTarget=null}_initializeListeners(){this._listenerHandles=new i,this._listenerHandles.add([l((()=>this._toolState.polygonState),(()=>this._updateLaserLine())),l((()=>{var i;return null==(i=this._analysisView.analysisVisualization)?void 0:i.viewData}),(()=>this._updateAll()),n),l((()=>({lastDraggedVertex:this._analysisView.lastDraggedVertex,cursorPoint:this._analysisView.cursorPoint})),(()=>this._updateLaserLine())),l((()=>this._toolState.active),(()=>this._updateAll()))])}_destroyListeners(){this._listenerHandles=e(this._listenerHandles)}}v._handleGeometry=c.createSphereGeometry(1,32,32);export{v as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as i}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import t from"../../../../../core/Handles.js";import{destroyMaybe as s,isSome as n,applySome as a,isNone as o}from"../../../../../core/maybe.js";import{watch as r,initial as l}from"../../../../../core/reactiveUtils.js";import{property as h}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as d}from"../../../../../core/accessorSupport/decorators/subclass.js";import{c as p}from"../../../../../chunks/vec3f64.js";import{fromPoints as c}from"../../../../../geometry/support/lineSegment.js";import{MeasurementMode as u}from"../../../analysis/interfaces.js";import{ViewMode as g}from"../../../analysis/DirectLineMeasurement/interfaces.js";import{createSphereManipulator as y}from"../../manipulatorUtils.js";import{LaserlineVisualElement as m}from"../../visualElements/LaserlineVisualElement.js";const _={laserLineGlowColor:[1,.5,0],laserLineGlowWidth:8,laserLineGlowFalloff:8,laserLineInnerColor:[1,1,1],laserLineInnerWidth:.75,laserLineGlobalAlpha:.75,handleColor:[1,.5,0],handleOpacity:.5,handleRadius:5};var v;!function(i){i.Manipulators="manipulators",i.AnalysisViewDestroyed="analysis-view-destroyed",i.AnalysisView="analysis-view"}(v||(v={}));let b=class extends e{constructor(i){super(i),this.params=_,this.analysisView=null,this.cursorPoint=null,this._visible=!1,this._laserLine=null,this.laserLineEnabled=!0,this._handles=new t,this._lastDraggedHandle=null}initialize(){this._laserLine=new m({view:this.view,attached:!0}),this._updateVisibility(this._visible),this._connectToAnalysisView()}destroy(){this._handles=s(this._handles),this._laserLine=s(this._laserLine)}get visible(){return this._visible}set visible(i){i?this.show():this.hide()}get testData(){const i=this._laserLine.testData,e=this.analysisView.testData;return{labels:null==e?void 0:e.labels,stripeLength:null==e?void 0:e.stripeLength,laserLineRenderer:{heightManifoldEnabled:!!n(i)&&i.heightManifoldEnabled,heightManifoldTarget:n(i)?i.heightManifoldTarget:null,pointDistanceEnabled:!!n(i)&&i.pointDistanceEnabled,pointDistanceOrigin:n(i)?i.pointDistanceOrigin:null,pointDistanceTarget:n(i)?i.pointDistanceTarget:null,lineVerticalPlaneEnabled:!!n(i)&&i.lineVerticalPlaneEnabled}}}get _cursorPosition(){const i=p();return a(this.cursorPoint,(e=>this.view.renderCoordsHelper.toRenderCoords(e,i))),i}get _startPosition(){const i=p();return a(this.analysis.startPoint,(e=>this.view.renderCoordsHelper.toRenderCoords(e,i))),i}get _endPosition(){const i=p();return a(this.analysis.endPoint,(e=>this.view.renderCoordsHelper.toRenderCoords(e,i))),i}get _laserLineParams(){const i=this._focusPosition,{active:e,lineState:t}=this.toolState,s=this.analysisView,n=this.laserLineEnabled&&!!i&&"measured"!==t&&e;if(!n||!this.visible||o(s)||s.destroyed)return{heightManifoldTarget:null,pointDistanceLine:null,lineVerticalPlaneSegment:null};const a=s.actualVisualizedMeasurement,r="local"!==this.view.viewingMode&&n&&!!this.analysis.startPoint&&"geodesic"===a,l=n&&s.viewMode===g.Triangle;return{heightManifoldTarget:"euclidean"===a?i:null,pointDistanceLine:r?this._pointDistanceLine:null,lineVerticalPlaneSegment:l?c(this._startPosition,this._endPosition):null}}get _focusPosition(){const{lineState:i}=this.toolState,e=this.analysisView,t=n(e)&&!e.destroyed&&e.measurementMode===u.Euclidean&&e.viewMode===g.Direct;switch(i){case"drawing":return t?this._startPosition:this.analysis.endPoint?this._endPosition:this._startPosition;case"editing":return t?"start"===this._lastDraggedHandle?this._endPosition:this._startPosition:"start"===this._lastDraggedHandle?this._startPosition:this._endPosition;default:return n(this.cursorPoint)?this._cursorPosition:null}}get _pointDistanceLine(){return{origin:"drawing"===this.toolState.lineState||"end"===this._lastDraggedHandle?this._startPosition:this._endPosition,target:this._focusPosition}}createManipulators(){const i=()=>{const i=y(this.view,this.params.handleColor,this.params.handleOpacity);return i.available=!1,i.radius=this.params.handleRadius,i},e=i(),t=i();n(this.analysis.startPoint)&&(e.location=this.analysis.startPoint,e.available=!0),n(this.analysis.endPoint)&&(t.location=this.analysis.endPoint,t.available=!0);const s=()=>{let i=this._lastDraggedHandle;e.grabbing&&!t.grabbing&&(i="start"),t.grabbing&&!e.grabbing&&(i="end"),e.grabbing||t.grabbing||(i=null),this._lastDraggedHandle=i},a=e.events.on("grab-changed",s),o=t.events.on("grab-changed",s);return this._handles.add([a,o],v.Manipulators),{start:e,end:t}}show(){this.destroyed||this._visible||this._updateVisibility(!0)}hide(){!this.destroyed&&this._visible&&this._updateVisibility(!1)}_connectToAnalysisView(){this._handles.remove(v.AnalysisView),this._handles.add([r((()=>a(this.analysisView,(i=>i.destroyed))),(i=>{i&&this._handles.remove(v.AnalysisView)}),l),r((()=>["measured"===this.toolState.lineState,this.analysisView]),(([i,e])=>{n(e)&&!e.destroyed&&(e.allowVisualElementsOrientationChange=!i)}),l),r((()=>this._laserLineParams),(i=>{const e=this._laserLine;e.heightManifoldTarget=i.heightManifoldTarget,e.pointDistanceLine=i.pointDistanceLine,e.lineVerticalPlaneSegment=i.lineVerticalPlaneSegment}),l)],v.AnalysisView)}_updateVisibility(i){this.constructed&&(this._visible=i,this.analysis.visible=i,i?this._laserLine.style={innerColor:this.params.laserLineInnerColor,innerWidth:this.params.laserLineInnerWidth,glowColor:this.params.laserLineGlowColor,glowWidth:this.params.laserLineGlowWidth,glowFalloff:this.params.laserLineGlowFalloff,globalAlpha:this.params.laserLineGlobalAlpha}:this.view.cursor=null,this._laserLine.visible=i)}};i([h()],b.prototype,"view",void 0),i([h()],b.prototype,"params",void 0),i([h()],b.prototype,"analysis",void 0),i([h({constructOnly:!0})],b.prototype,"analysisView",void 0),i([h()],b.prototype,"cursorPoint",void 0),i([h()],b.prototype,"toolState",void 0),i([h()],b.prototype,"visible",null),i([h()],b.prototype,"testData",null),i([h()],b.prototype,"_visible",void 0),i([h()],b.prototype,"_laserLine",void 0),i([h()],b.prototype,"laserLineEnabled",void 0),i([h()],b.prototype,"_cursorPosition",null),i([h()],b.prototype,"_startPosition",null),i([h()],b.prototype,"_endPosition",null),i([h()],b.prototype,"_lastDraggedHandle",void 0),i([h()],b.prototype,"_laserLineParams",null),i([h()],b.prototype,"_focusPosition",null),i([h()],b.prototype,"_pointDistanceLine",null),b=i([d("esri.views.3d.interactive.measurementTools.directLineMeasurement3D.DirectLineMeasurement3DView")],b);export{b as DirectLineMeasurement3DView};
5
+ import{_ as i}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import t from"../../../../../core/Handles.js";import{destroyMaybe as s,isSome as n,applySome as a,isNone as o}from"../../../../../core/maybe.js";import{watch as r,initial as l}from"../../../../../core/reactiveUtils.js";import{property as h}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as d}from"../../../../../core/accessorSupport/decorators/subclass.js";import{c as p}from"../../../../../chunks/vec3f64.js";import{fromPoints as c}from"../../../../../geometry/support/lineSegment.js";import{MeasurementMode as u}from"../../../analysis/interfaces.js";import{ViewMode as g}from"../../../analysis/DirectLineMeasurement/interfaces.js";import{createSphereManipulator as m}from"../../manipulatorUtils.js";import{LaserlineVisualElement as y}from"../../visualElements/LaserlineVisualElement.js";const _={laserLineGlowColor:[1,.5,0],laserLineGlowWidth:8,laserLineGlowFalloff:8,laserLineInnerColor:[1,1,1],laserLineInnerWidth:.75,laserLineGlobalAlpha:.75,handleColor:[1,.5,0],handleOpacity:.5,handleRadius:5};var v;!function(i){i.Manipulators="manipulators",i.AnalysisViewDestroyed="analysis-view-destroyed",i.AnalysisView="analysis-view"}(v||(v={}));let b=class extends e{constructor(i){super(i),this.params=_,this.analysisView=null,this.cursorPoint=null,this._visible=!1,this._laserLine=null,this.laserLineEnabled=!0,this._handles=new t,this._lastDraggedHandle=null}initialize(){this._laserLine=new y({view:this.view,attached:!0}),this._updateVisibility(this._visible),this._connectToAnalysisView()}destroy(){this._handles=s(this._handles),this._laserLine=s(this._laserLine)}get visible(){return this._visible}set visible(i){i?this.show():this.hide()}get testData(){const i=this._laserLine.testData,e=this.analysisView.testData;return{labels:null==e?void 0:e.labels,stripeLength:null==e?void 0:e.stripeLength,laserLineRenderer:{heightManifoldEnabled:!!n(i)&&i.heightManifoldEnabled,heightManifoldTarget:n(i)?i.heightManifoldTarget:null,pointDistanceEnabled:!!n(i)&&i.pointDistanceEnabled,pointDistanceOrigin:n(i)?i.pointDistanceOrigin:null,pointDistanceTarget:n(i)?i.pointDistanceTarget:null,lineVerticalPlaneEnabled:!!n(i)&&i.lineVerticalPlaneEnabled}}}get _cursorPosition(){const i=p();return a(this.cursorPoint,(e=>this.view.renderCoordsHelper.toRenderCoords(e,i))),i}get _startPosition(){const i=p();return a(this.analysis.startPoint,(e=>this.view.renderCoordsHelper.toRenderCoords(e,i))),i}get _endPosition(){const i=p();return a(this.analysis.endPoint,(e=>this.view.renderCoordsHelper.toRenderCoords(e,i))),i}get _laserLineParams(){const i=this._focusPosition,{active:e,lineState:t}=this.toolState,s=this.analysisView,n=this.laserLineEnabled&&!!i&&"measured"!==t&&e;if(!n||!this.visible||o(s)||s.destroyed)return{heightManifoldTarget:null,pointDistanceLine:null,lineVerticalPlaneSegment:null};const a=s.actualVisualizedMeasurement,r="local"!==this.view.viewingMode&&n&&!!this.analysis.startPoint&&"geodesic"===a,l=n&&s.viewMode===g.Triangle;return{heightManifoldTarget:"euclidean"===a?i:null,pointDistanceLine:r?this._pointDistanceLine:null,lineVerticalPlaneSegment:l?c(this._startPosition,this._endPosition):null}}get _focusPosition(){const{lineState:i}=this.toolState,e=this.analysisView,t=n(e)&&!e.destroyed&&e.measurementMode===u.Euclidean&&e.viewMode===g.Direct;switch(i){case"drawing":return t?this._startPosition:this.analysis.endPoint?this._endPosition:this._startPosition;case"editing":return t?"start"===this._lastDraggedHandle?this._endPosition:this._startPosition:"start"===this._lastDraggedHandle?this._startPosition:this._endPosition;default:return n(this.cursorPoint)?this._cursorPosition:null}}get _pointDistanceLine(){return{origin:"drawing"===this.toolState.lineState||"end"===this._lastDraggedHandle?this._startPosition:this._endPosition,target:this._focusPosition}}createManipulators(){const i=()=>{const i=m(this.view,this.params.handleColor,this.params.handleOpacity);return i.available=!1,i.radius=this.params.handleRadius,i},e=i(),t=i();n(this.analysis.startPoint)&&(e.location=this.analysis.startPoint,e.available=!0),n(this.analysis.endPoint)&&(t.location=this.analysis.endPoint,t.available=!0);const s=()=>{let i=this._lastDraggedHandle;e.grabbing&&!t.grabbing&&(i="start"),t.grabbing&&!e.grabbing&&(i="end"),e.grabbing||t.grabbing||(i=null),this._lastDraggedHandle=i},a=e.events.on("grab-changed",s),o=t.events.on("grab-changed",s);return this._handles.add([a,o],v.Manipulators),{start:e,end:t}}show(){this.destroyed||this._visible||this._updateVisibility(!0)}hide(){!this.destroyed&&this._visible&&this._updateVisibility(!1)}_connectToAnalysisView(){this._handles.remove(v.AnalysisView),this._handles.add([r((()=>a(this.analysisView,(i=>i.destroyed))),(i=>{i&&this._handles.remove(v.AnalysisView)}),l),r((()=>["measured"===this.toolState.lineState,this.analysisView]),(([i,e])=>{n(e)&&!e.destroyed&&(e.allowVisualElementsOrientationChange=!i)}),l),r((()=>this._laserLineParams),(i=>{const e=this._laserLine;e.heightManifoldTarget=i.heightManifoldTarget,e.pointDistanceLine=i.pointDistanceLine,e.lineVerticalPlaneSegment=i.lineVerticalPlaneSegment}),l)],v.AnalysisView)}_updateVisibility(i){this.constructed&&(this._visible=i,i?this._laserLine.style={innerColor:this.params.laserLineInnerColor,innerWidth:this.params.laserLineInnerWidth,glowColor:this.params.laserLineGlowColor,glowWidth:this.params.laserLineGlowWidth,glowFalloff:this.params.laserLineGlowFalloff,globalAlpha:this.params.laserLineGlobalAlpha}:this.view.cursor=null,this._laserLine.visible=i)}};i([h()],b.prototype,"view",void 0),i([h()],b.prototype,"params",void 0),i([h()],b.prototype,"analysis",void 0),i([h({constructOnly:!0})],b.prototype,"analysisView",void 0),i([h()],b.prototype,"cursorPoint",void 0),i([h()],b.prototype,"toolState",void 0),i([h()],b.prototype,"visible",null),i([h()],b.prototype,"testData",null),i([h()],b.prototype,"_visible",void 0),i([h()],b.prototype,"_laserLine",void 0),i([h()],b.prototype,"laserLineEnabled",void 0),i([h()],b.prototype,"_cursorPosition",null),i([h()],b.prototype,"_startPosition",null),i([h()],b.prototype,"_endPosition",null),i([h()],b.prototype,"_lastDraggedHandle",void 0),i([h()],b.prototype,"_laserLineParams",null),i([h()],b.prototype,"_focusPosition",null),i([h()],b.prototype,"_pointDistanceLine",null),b=i([d("esri.views.3d.interactive.measurementTools.directLineMeasurement3D.DirectLineMeasurement3DView")],b);export{b as DirectLineMeasurement3DView};