@arcgis/core 4.34.0-next.85 → 4.34.0-next.87

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 (286) hide show
  1. package/Basemap.js +1 -1
  2. package/Ground.js +1 -1
  3. package/Map.js +1 -1
  4. package/analysis/ElevationProfile/ElevationProfileLineGround.d.ts +4 -0
  5. package/analysis/ElevationProfile/{ElevationProfileGroundLine.js → ElevationProfileLineGround.js} +1 -1
  6. package/analysis/ElevationProfile/ElevationProfileLineInput.d.ts +4 -0
  7. package/analysis/ElevationProfile/{ElevationProfileInputLine.js → ElevationProfileLineInput.js} +1 -1
  8. package/analysis/ElevationProfile/ElevationProfileLineQuery.d.ts +4 -0
  9. package/analysis/ElevationProfile/{ElevationProfileQueryLine.js → ElevationProfileLineQuery.js} +1 -1
  10. package/analysis/ElevationProfile/ElevationProfileLineScene.d.ts +4 -0
  11. package/analysis/ElevationProfile/{ElevationProfileSceneLine.js → ElevationProfileLineScene.js} +1 -1
  12. package/analysis/ElevationProfile/elevationProfileLineTypes.js +1 -1
  13. package/analysis/ElevationProfileAnalysis.js +1 -1
  14. package/arcade/functions/measures.js +1 -1
  15. package/assets/esri/core/workers/RemoteClient.js +1 -1
  16. package/assets/esri/core/workers/chunks/0074f1836d7ff69ff6ec.js +1 -0
  17. package/assets/esri/core/workers/chunks/03ef19f0753d68770444.js +1 -0
  18. package/assets/esri/core/workers/chunks/06c389283ee5b60573f2.js +1 -0
  19. package/assets/esri/core/workers/chunks/09c2004126f4a5242b85.js +1 -0
  20. package/assets/esri/core/workers/chunks/0b679d5a1bfdbd006d6e.js +1 -0
  21. package/assets/esri/core/workers/chunks/0f05425954578ac796ec.js +1 -0
  22. package/assets/esri/core/workers/chunks/109149c378aa4c5f8526.js +1 -0
  23. package/assets/esri/core/workers/chunks/143503f6eb270c4683f8.js +1 -0
  24. package/assets/esri/core/workers/chunks/177840d5f0076c0de46b.js +316 -0
  25. package/assets/esri/core/workers/chunks/1c1b0cc91fe9cb3fec61.js +1 -0
  26. package/assets/esri/core/workers/chunks/{9eb1bfcb9b05f2a36748.js → 1f2d13466c60a6b57717.js} +1 -1
  27. package/assets/esri/core/workers/chunks/1fc6311d4f0d27e88737.js +1 -0
  28. package/assets/esri/core/workers/chunks/257fd65786feb5951b90.js +1 -0
  29. package/assets/esri/core/workers/chunks/{7a23b127f551bf13ef54.js → 268f5b233640a9dbbf89.js} +2 -2
  30. package/assets/esri/core/workers/chunks/2896ada406074f754b00.js +1 -0
  31. package/assets/esri/core/workers/chunks/28d30be414e59eabd963.js +1 -0
  32. package/assets/esri/core/workers/chunks/29471e0b3f7296dee096.js +1 -0
  33. package/assets/esri/core/workers/chunks/{3192b68675ff2afcb1d6.js → 2d3ae187f8aa3495d4ae.js} +1 -1
  34. package/assets/esri/core/workers/chunks/2dc88379ee94fabdaf52.js +1 -0
  35. package/assets/esri/core/workers/chunks/336b54144afec0c7d396.js +2 -0
  36. package/assets/esri/core/workers/chunks/366db86914a63e6d0c68.js +1 -0
  37. package/assets/esri/core/workers/chunks/{d66cdb9bb494da19696b.js → 47e4f66c33bb697fbe6b.js} +2 -2
  38. package/assets/esri/core/workers/chunks/481c2b01e2fe92249698.js +1 -0
  39. package/assets/esri/core/workers/chunks/4840bd93d8fe15c7aefd.js +1 -0
  40. package/assets/esri/core/workers/chunks/4d4db6854aff7656f6e1.js +1 -0
  41. package/assets/esri/core/workers/chunks/5c585b338a9e9aa0e205.js +1 -0
  42. package/assets/esri/core/workers/chunks/639d856cd217914dfe1f.js +1 -0
  43. package/assets/esri/core/workers/chunks/68f5a2d2666636c3f807.js +1 -0
  44. package/assets/esri/core/workers/chunks/7540b34e743a23e67729.js +1 -0
  45. package/assets/esri/core/workers/chunks/7be11a3ef1f49245089f.js +1 -0
  46. package/assets/esri/core/workers/chunks/819a8bc1f0a694017ee6.js +1 -0
  47. package/assets/esri/core/workers/chunks/{afb76f9d6abedef771df.js → 8380a092ffc8e92ede7a.js} +1 -1
  48. package/assets/esri/core/workers/chunks/8d63b42aea32ce2e5d09.js +1 -0
  49. package/assets/esri/core/workers/chunks/8de11aab65d91e7f1a4d.js +1 -0
  50. package/assets/esri/core/workers/chunks/9386a0ebff78b6303ed2.js +1 -0
  51. package/assets/esri/core/workers/chunks/{4d47187bc0821413492d.js → 95bae3c275f1483eb7ed.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{f8f85207b382c1ea038c.js → 97489bf16a1d327992b2.js} +3 -3
  53. package/assets/esri/core/workers/chunks/a2652d10bb0bc41c9a8d.js +1 -0
  54. package/assets/esri/core/workers/chunks/a845c68e76382a73da5e.js +1 -0
  55. package/assets/esri/core/workers/chunks/{9c64b78c5c9b35b31d98.js → aa78b69219d9a0ef1c54.js} +2 -2
  56. package/assets/esri/core/workers/chunks/b09b34f64a6bc2b49e0a.js +1 -0
  57. package/assets/esri/core/workers/chunks/b0a03b6edbcf6e933431.js +1 -0
  58. package/assets/esri/core/workers/chunks/{1859a11df9f579b993d7.js → b2fbb44e219232e61cbd.js} +1 -1
  59. package/assets/esri/core/workers/chunks/b4349db7155673329432.js +1 -0
  60. package/assets/esri/core/workers/chunks/b8997ae5893afa0298d1.js +1 -0
  61. package/assets/esri/core/workers/chunks/c0ae186620b68d43b338.js +1 -0
  62. package/assets/esri/core/workers/chunks/{d153b29c542c37ae1636.js → c50e8d5f554cf151865c.js} +2 -2
  63. package/assets/esri/core/workers/chunks/c5cc0fc652432a9264cc.js +1 -0
  64. package/assets/esri/core/workers/chunks/c6cae8471c5d4ae40c65.js +1 -0
  65. package/assets/esri/core/workers/chunks/cab2a1382bdd32bb34d8.js +1 -0
  66. package/assets/esri/core/workers/chunks/ce937ff0dd1147ea297e.js +1 -0
  67. package/assets/esri/core/workers/chunks/d142a42755a78bb157ed.js +1 -0
  68. package/assets/esri/core/workers/chunks/{280af3640f8e93c1024e.js → d6e0528eacee7ea4c1ce.js} +2 -2
  69. package/assets/esri/core/workers/chunks/d9d86cf0500fa29d1d43.js +1 -0
  70. package/assets/esri/core/workers/chunks/db5a985ccc6b7d0ad855.js +1 -0
  71. package/assets/esri/core/workers/chunks/f3ee035fa7bf638c8e60.js +1 -0
  72. package/assets/esri/core/workers/chunks/{b15ff6c9ef2de8a49853.js → f651c05604eab83aef5f.js} +2 -2
  73. package/assets/esri/core/workers/chunks/{ed773dab5965e42a2879.js → f6e18668f728dfd8ba5e.js} +2 -2
  74. package/assets/esri/core/workers/chunks/fc5ac54aab66562c8463.js +1 -0
  75. package/assets/esri/core/workers/chunks/ff8e2f998169ca3a7a68.js +1 -0
  76. package/assets/esri/libs/dracoMeshDecoder/draco_mesh_decoder.wasm +0 -0
  77. package/assets/esri/libs/i3s/i3s.wasm +0 -0
  78. package/assets/esri/themes/dark/main.css +1 -1
  79. package/assets/esri/themes/light/main.css +1 -1
  80. package/assets/esri/themes/light/view.css +1 -1
  81. package/assets/esri/views/3d/analysis/VolumeMeasurement/t9n/VolumeMeasurementAnalysis.json +1 -0
  82. package/assets/esri/widgets/Editor/t9n/Editor.json +1 -1
  83. package/assets/esri/widgets/Editor/t9n/Editor_en.json +1 -1
  84. package/chunks/CloudsComposition.glsl.js +2 -2
  85. package/chunks/HUDMaterial.glsl.js +49 -50
  86. package/chunks/LineMarker.glsl.js +34 -34
  87. package/chunks/PointRenderer.glsl.js +4 -4
  88. package/chunks/ShadowHighlight.glsl.js +3 -3
  89. package/chunks/draco_mesh_decoder.js +1 -1
  90. package/config.js +1 -1
  91. package/core/NestedMap.js +1 -1
  92. package/core/iteratorUtils.js +1 -1
  93. package/editing/geometry/lineUtils.js +1 -1
  94. package/identity/IdentityManagerBase.js +1 -1
  95. package/interfaces.d.ts +188 -134
  96. package/kernel.js +1 -1
  97. package/layers/GaussianSplatLayer.js +1 -1
  98. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  99. package/layers/IntegratedMeshLayer.js +1 -1
  100. package/layers/ParquetLayer.js +1 -1
  101. package/layers/SceneLayer.js +1 -1
  102. package/layers/VectorTileLayer.js +1 -1
  103. package/layers/graphics/sources/ParquetSource.js +1 -1
  104. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  105. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  106. package/layers/knowledgeGraph/cypherUtils.js +1 -1
  107. package/layers/support/FieldConfiguration.js +1 -1
  108. package/layers/support/fieldConfigUtils.js +1 -1
  109. package/layers/support/layerUtils.js +1 -1
  110. package/layers/support/vectorTileLayerLoader.js +1 -1
  111. package/package.json +5 -5
  112. package/portal/schemas/definitions.js +1 -1
  113. package/support/basemapEnsureType.js +1 -1
  114. package/support/revision.js +1 -1
  115. package/support/userTypeGuards/isBasemap.js +5 -0
  116. package/symbols/support/previewSymbol2D.js +1 -1
  117. package/views/2d/analysis/ElevationProfileAnalysisView2D.js +1 -1
  118. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  119. package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
  120. package/views/2d/layers/features/Processor.js +1 -1
  121. package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
  122. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  123. package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
  124. package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
  125. package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
  126. package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
  127. package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
  128. package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
  129. package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
  130. package/views/2d/layers/features/layerAdapters/featureServiceUtils.js +1 -1
  131. package/views/2d/layers/features/schema/SourceSchema.js +1 -1
  132. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  133. package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
  134. package/views/2d/layers/features/sources/strategies/AFeatureLoadStrategy.js +5 -0
  135. package/views/2d/layers/features/sources/strategies/AFeatureTileLoadStrategy.js +5 -0
  136. package/views/2d/layers/features/sources/strategies/ALoadStrategy.js +1 -1
  137. package/views/2d/layers/features/sources/strategies/FeatureDrillDownTileLoadStrategy.js +5 -0
  138. package/views/2d/layers/features/sources/strategies/FeaturePagedTileLoadStrategy.js +5 -0
  139. package/views/2d/layers/features/sources/strategies/FeatureSnapshotLoadStrategy.js +5 -0
  140. package/views/2d/layers/features/sources/strategies/ParquetSnapshotLoadStrategy.js +1 -1
  141. package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
  142. package/views/2d/layers/features/sources/strategies/StreamLoadStrategy.js +1 -1
  143. package/views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js +1 -1
  144. package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
  145. package/views/2d/layers/features/sources/strategies/support/queryAdapters.js +1 -1
  146. package/views/2d/layers/features/support/FeatureSetReaderParquet.js +1 -1
  147. package/views/3d/FocusAreasView.js +1 -1
  148. package/views/3d/GroundView3D.js +5 -0
  149. package/views/3d/analysis/ElevationProfile/{ElevationProfileSceneLineComputation.js → ElevationProfileLineSceneComputation.js} +1 -1
  150. package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
  151. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementConfiguration.js +1 -1
  152. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  153. package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
  154. package/views/3d/environment/CloudsComposition.glsl.js +1 -1
  155. package/views/3d/glTF/internal/Resource.js +1 -1
  156. package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
  157. package/views/3d/interactive/visualElements/DrapedVisualElementResources.js +1 -1
  158. package/views/3d/interactive/visualElements/LabelVisualElement.js +1 -1
  159. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  160. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  161. package/views/3d/layers/DrapedSubView3D.js +1 -1
  162. package/views/3d/layers/FlowSubView3D.js +1 -1
  163. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  164. package/views/3d/layers/I3SMeshView3D.js +1 -1
  165. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  166. package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
  167. package/views/3d/layers/MediaLayerView3D.js +1 -1
  168. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  169. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  170. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  171. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  172. package/views/3d/support/MemoryController.js +1 -1
  173. package/views/3d/support/engineContent/marker.js +1 -1
  174. package/views/3d/support/engineContent/sdfPrimitives.js +1 -1
  175. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  176. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  177. package/views/3d/support/popupHitTest.js +1 -1
  178. package/views/3d/terrain/OverlayManager.js +1 -1
  179. package/views/3d/terrain/OverlayRenderer.js +1 -1
  180. package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +11 -11
  181. package/views/3d/webgl-engine/lib/BasisUtil.js +1 -1
  182. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  183. package/views/3d/webgl-engine/materials/renderers/InstancedCommandVAO.js +5 -0
  184. package/views/3d/webgl-engine/materials/renderers/InstancedCommandVAOs.js +5 -0
  185. package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
  186. package/views/3d/webgl-engine/materials/renderers/PerOriginData.js +1 -1
  187. package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
  188. package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
  189. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  190. package/views/3d/webgl-engine/shaders/AnimatedLine.glsl.js +14 -9
  191. package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
  192. package/views/3d/webgl-engine/shaders/LineMarker.glsl.js +1 -1
  193. package/views/3d/webgl-engine/shaders/PointRenderer.glsl.js +1 -1
  194. package/views/3d/webgl-engine/shaders/ShadowHighlight.glsl.js +1 -1
  195. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/LineOffset.glsl.js +8 -8
  196. package/views/BasemapView.js +1 -1
  197. package/views/GroundView.js +1 -1
  198. package/views/SceneView.js +1 -1
  199. package/views/View.js +1 -1
  200. package/views/View2D.js +1 -1
  201. package/views/analysis/ElevationProfile/ElevationProfileChart.js +1 -1
  202. package/views/analysis/ElevationProfile/{ElevationProfileGroundLineComputation.js → ElevationProfileLineGroundComputation.js} +1 -1
  203. package/views/analysis/ElevationProfile/{ElevationProfileInputLineComputation.js → ElevationProfileLineInputComputation.js} +1 -1
  204. package/views/analysis/ElevationProfile/{ElevationProfileQueryLineComputation.js → ElevationProfileLineQueryComputation.js} +1 -1
  205. package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
  206. package/views/support/LayerViewManager.js +1 -1
  207. package/views/webgl/RenderbufferDescriptor.js +1 -1
  208. package/views/webgl/TextureDescriptor.js +1 -1
  209. package/views/webgl/Util.js +1 -1
  210. package/views/webgl/VertexArrayObject.js +1 -1
  211. package/webscene/Slide.js +1 -1
  212. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  213. package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
  214. package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
  215. package/widgets/Editor/Upload.js +1 -1
  216. package/widgets/Editor/components/Notices.js +1 -1
  217. package/widgets/Editor/modelUploadUtils.js +1 -1
  218. package/widgets/Editor/support/SketchController.js +1 -1
  219. package/widgets/Editor/support/splitFeatureUtils.js +1 -1
  220. package/widgets/Editor/workflowUtils.js +1 -1
  221. package/widgets/ElevationProfile/ElevationProfileLineGround.d.ts +2 -2
  222. package/widgets/ElevationProfile/ElevationProfileLineInput.d.ts +2 -2
  223. package/widgets/ElevationProfile/ElevationProfileLineQuery.d.ts +2 -2
  224. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  225. package/widgets/Sketch/SketchViewModel.js +1 -1
  226. package/widgets/Sketch/adapters/layer/GraphicsLayerAdapter.js +5 -0
  227. package/widgets/Sketch/adapters/layer/MapNotesLayerAdapter.js +5 -0
  228. package/analysis/ElevationProfile/ElevationProfileGroundLine.d.ts +0 -4
  229. package/analysis/ElevationProfile/ElevationProfileInputLine.d.ts +0 -4
  230. package/analysis/ElevationProfile/ElevationProfileQueryLine.d.ts +0 -4
  231. package/analysis/ElevationProfile/ElevationProfileSceneLine.d.ts +0 -4
  232. package/assets/esri/core/workers/chunks/03e5d1a00d85e4d16bff.js +0 -1
  233. package/assets/esri/core/workers/chunks/0914a52fb33af5d77fab.js +0 -1
  234. package/assets/esri/core/workers/chunks/1d491447b13f2f2b4399.js +0 -1
  235. package/assets/esri/core/workers/chunks/20850b0fdb55fb17bc90.js +0 -1
  236. package/assets/esri/core/workers/chunks/25ea02dd7d45a90cbb3b.js +0 -1
  237. package/assets/esri/core/workers/chunks/264a9a916e1e972b69d7.js +0 -1
  238. package/assets/esri/core/workers/chunks/30c85a1a4f118cc45a25.js +0 -1
  239. package/assets/esri/core/workers/chunks/3ef8a7468d7e3b2f0b69.js +0 -351
  240. package/assets/esri/core/workers/chunks/486ea51306c619238e41.js +0 -1
  241. package/assets/esri/core/workers/chunks/49cb78c85de0102e5f02.js +0 -1
  242. package/assets/esri/core/workers/chunks/5610dfde4e636e2333a9.js +0 -1
  243. package/assets/esri/core/workers/chunks/5c1cdc2ec06c4c6bd0b3.js +0 -1
  244. package/assets/esri/core/workers/chunks/609abf071c4ea24955c2.js +0 -1
  245. package/assets/esri/core/workers/chunks/71c2a8e5a17803d3e949.js +0 -1
  246. package/assets/esri/core/workers/chunks/7402c2853f6aed8d1bc7.js +0 -1
  247. package/assets/esri/core/workers/chunks/7889a909394c61a9d3e0.js +0 -1
  248. package/assets/esri/core/workers/chunks/79a9f47dfa9ebabb5dbd.js +0 -1
  249. package/assets/esri/core/workers/chunks/86378d4f4d7f9a370c22.js +0 -1
  250. package/assets/esri/core/workers/chunks/99ac292a858bbedc6a89.js +0 -1
  251. package/assets/esri/core/workers/chunks/9a6fa91dd204f64d2590.js +0 -1
  252. package/assets/esri/core/workers/chunks/9cdeead9d444e8d95477.js +0 -1
  253. package/assets/esri/core/workers/chunks/aa1eb7b4d9ccda725da5.js +0 -1
  254. package/assets/esri/core/workers/chunks/b19d723d09f5bea9ca27.js +0 -1
  255. package/assets/esri/core/workers/chunks/b4a053063e6022080d31.js +0 -1
  256. package/assets/esri/core/workers/chunks/b4b26cc2ba3ff30e1d03.js +0 -1
  257. package/assets/esri/core/workers/chunks/b78ea9cc4d5f2fd3d871.js +0 -1
  258. package/assets/esri/core/workers/chunks/bbb585f0b484ab5eabb3.js +0 -1
  259. package/assets/esri/core/workers/chunks/bd4125d163f372a7e978.js +0 -1
  260. package/assets/esri/core/workers/chunks/c2bc70b65f5c2a2c9671.js +0 -1
  261. package/assets/esri/core/workers/chunks/cd1869e183001266c4c1.js +0 -2
  262. package/assets/esri/core/workers/chunks/d0a149050f7f1c1ada09.js +0 -1
  263. package/assets/esri/core/workers/chunks/d2fe403d6ab237bc89c2.js +0 -1
  264. package/assets/esri/core/workers/chunks/d51e8eeb1e1eb0605cc9.js +0 -1
  265. package/assets/esri/core/workers/chunks/da42cc4f6142846cb745.js +0 -1
  266. package/assets/esri/core/workers/chunks/dd84f630466a26722d57.js +0 -1
  267. package/assets/esri/core/workers/chunks/e080628ac6e1cf25dc72.js +0 -1
  268. package/assets/esri/core/workers/chunks/e17df11c98dbd869302b.js +0 -1
  269. package/assets/esri/core/workers/chunks/e1b3ae6426886e2fab07.js +0 -1
  270. package/assets/esri/core/workers/chunks/e8e0f73fb94e63e2abc3.js +0 -1
  271. package/assets/esri/core/workers/chunks/f45c343527709f6f91c2.js +0 -1
  272. package/assets/esri/core/workers/chunks/f6513ec888a7d927d948.js +0 -1
  273. package/assets/esri/core/workers/chunks/fcac475e4e82911b3126.js +0 -1
  274. package/views/2d/layers/features/sources/strategies/AFetchLoadStrategy.js +0 -5
  275. package/views/2d/layers/features/sources/strategies/ATileLoadStrategy.js +0 -5
  276. package/views/2d/layers/features/sources/strategies/DrillDownTileLoadStrategy.js +0 -5
  277. package/views/2d/layers/features/sources/strategies/PagedTileLoadStrategy.js +0 -5
  278. package/views/2d/layers/features/sources/strategies/SnapshotLoadStrategy.js +0 -5
  279. /package/assets/esri/core/workers/chunks/{7a23b127f551bf13ef54.js.LICENSE.txt → 268f5b233640a9dbbf89.js.LICENSE.txt} +0 -0
  280. /package/assets/esri/core/workers/chunks/{cd1869e183001266c4c1.js.LICENSE.txt → 336b54144afec0c7d396.js.LICENSE.txt} +0 -0
  281. /package/assets/esri/core/workers/chunks/{280af3640f8e93c1024e.js.LICENSE.txt → 47e4f66c33bb697fbe6b.js.LICENSE.txt} +0 -0
  282. /package/assets/esri/core/workers/chunks/{9c64b78c5c9b35b31d98.js.LICENSE.txt → aa78b69219d9a0ef1c54.js.LICENSE.txt} +0 -0
  283. /package/assets/esri/core/workers/chunks/{d153b29c542c37ae1636.js.LICENSE.txt → c50e8d5f554cf151865c.js.LICENSE.txt} +0 -0
  284. /package/assets/esri/core/workers/chunks/{b15ff6c9ef2de8a49853.js.LICENSE.txt → d6e0528eacee7ea4c1ce.js.LICENSE.txt} +0 -0
  285. /package/assets/esri/core/workers/chunks/{d66cdb9bb494da19696b.js.LICENSE.txt → f651c05604eab83aef5f.js.LICENSE.txt} +0 -0
  286. /package/assets/esri/core/workers/chunks/{ed773dab5965e42a2879.js.LICENSE.txt → f6e18668f728dfd8ba5e.js.LICENSE.txt} +0 -0
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../Color.js";import i from"../../../../core/Accessor.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{watch as s,initial as r}from"../../../../core/reactiveUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{e as a}from"../../../../chunks/earcut.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as c}from"../../../../chunks/vec32.js";import{create as p,fromValues as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{computeTranslationToOriginAndRotation as h}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{newDoubleArray as d}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as y}from"../../../../geometry/support/Indices.js";import{t as g}from"../../../../chunks/vec3.js";import f from"../../../../symbols/support/ElevationInfo.js";import{cutFillConfiguration as v}from"./VolumeMeasurementConfiguration.js";import{LineVisualElement as j}from"../../interactive/visualElements/LineVisualElement.js";import{OutlineVisualElement as _}from"../../interactive/visualElements/OutlineVisualElement.js";import{GeodesicSegment as G}from"../../interactive/visualElements/support/Segment.js";import{ElevationContext as w}from"../../layers/graphics/ElevationContext.js";import{extrudePolygon as b}from"../../layers/graphics/Graphics3DExtrudeSymbolLayer.js";import{geometryToRenderInfo as C}from"../../support/renderInfoUtils/polygon.js";import{CutFillColor as V,VolumeGeometry as L}from"../../webgl-engine/lib/CutFillColor.js";import{createStipplePatternSimple as R}from"../../webgl-engine/materials/lineStippleUtils.js";let A=class extends i{get visible(){return this.analysisViewData.visible&&null!=this.analysisViewData.elevationAlignedGeometry&&null!=this.analysisViewData.targetGeometry}constructor(e){super(e),this._elevationContext=w.fromElevationInfo(new f({mode:"absolute-height"})),this._extrusionHeight=1e4}initialize(){const{view:e}=this,{accentColor:i}=e.effectiveTheme,o={view:e,isDecoration:!0},n=v,l={...o,width:n.geometryOutlineWidth},a=t.toUnitRGBA(i),m=t.toUnitRGBA(n.targetGeometryOutlineColor);this._elevationAlignedGeometry=new _({...l,isDraped:!0,color:a}),this._targetGeometry=new _({...l,color:m});const c={...o,attached:!0,width:n.projectionLineWidth,stipplePattern:R(n.projectionLineStippleSize),renderOccluded:4},p=t.toUnitRGBA(n.cutProjectionLineColor),u=t.toUnitRGBA(n.fillProjectionLineColor);this._cutProjectionLines=new j({...c,color:p}),this._fillProjectionLines=new j({...c,color:u}),this._cutFillRenderNode=new V({view:e,cutColor:n.cutColor,fillColor:n.fillColor}),this.addHandles([s(()=>[this.analysisViewData.elevationAlignedGeometry,this.analysisViewData.targetGeometry,this.visible],()=>this._updateVisualElements()),s(()=>this.view.effectiveTheme.accentColor,e=>{this._elevationAlignedGeometry.color=t.toUnitRGBA(e)}),s(()=>this.analysisViewData.targetGeometry,()=>this._updateCutFillGeometry(),r),s(()=>this.visible,()=>this._updateCutFillVisibility())])}destroy(){this._elevationAlignedGeometry=o(this._elevationAlignedGeometry),this._targetGeometry=o(this._targetGeometry),this._cutProjectionLines=o(this._cutProjectionLines),this._fillProjectionLines=o(this._fillProjectionLines),this._cutFillRenderNode.destroy()}_updateVisualElements(){this._updateGeometries(),this._updateProjectionLines()}_updateGeometries(){const e=this.visible,{elevationAlignedGeometry:t,targetGeometry:i}=this.analysisViewData;this._elevationAlignedGeometry.geometry=t,this._elevationAlignedGeometry.visible=e,this._targetGeometry.geometry=i,this._targetGeometry.visible=e}_updateProjectionLines(){const e=this.visible,{elevationAlignedGeometry:t,targetGeometry:i}=this.analysisViewData;if(this._cutProjectionLines.visible=e,this._fillProjectionLines.visible=e,!t||!i)return;const{renderCoordsHelper:o}=this.view,s=o.spatialReference,r=[],n=[],l=t.spatialReference;for(let a=0;a<t.rings[0].length;++a){const e=t.rings[0][a],m=c(P,e[0],e[1],e[2]);o.toRenderCoords(m,l,m);const p=i.rings[0][a],u=c(x,p[0],p[1],p[2]);o.toRenderCoords(u,l,u);const h=new G(m,u,s);m[2]>u[2]?r.push(h):n.push(h)}this._cutProjectionLines.setGeometryFromSegments(r),this._fillProjectionLines.setGeometryFromSegments(n)}_updateCutFillVisibility(){this.visible?this._cutFillRenderNode.enable():this._cutFillRenderNode.disable()}_updateCutFillGeometry(){const{renderCoordsHelper:e}=this.view,{targetGeometry:t}=this.analysisViewData;if(!t?.extent)return;const{center:i}=t.extent,o=u(i.x,i.y,0),s=p();e.toRenderCoords(o,t.spatialReference,s);const r=this._getExtrudedVolumes(t,this._extrusionHeight,o),n=this._getExtrudedVolumes(t,-this._extrusionHeight,o);this._cutFillRenderNode.updateGeometries(r,n,s)}_getExtrudedVolumes(e,t,i){const{renderCoordsHelper:o,spatialReference:s,elevationProvider:r}=this.view,n=p(),l=1===o.viewingMode;l||o.worldUpAtPosition([0,0,0],n);const c=C(e,r,o,this._elevationContext),{polygons:u,mapPositions:f,position:v}=c,j=u[0],_=j.count,G=a(j.mapPositions,j.holeIndices,3),w=G.length,V=6*_,R=y(V+w),A=y(w),P=d(3*V),x=d(3*V);b(v,f,G,j,P,null,x,null,R,A,t,n,l);const D=m(),E=m();return h(s,i,D,o.spatialReference),E[12]=-D[12],E[13]=-D[13],E[14]=-D[14],g(P,P,E),new L(P,A,R,x)}};e([n({constructOnly:!0})],A.prototype,"view",void 0),e([n({constructOnly:!0})],A.prototype,"analysisViewData",void 0),e([n({readOnly:!0})],A.prototype,"visible",null),A=e([l("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillVisualization")],A);const P=p(),x=p();export{A as VolumeMeasurementCutFillVisualization};
5
+ import{__decorate as e}from"tslib";import t from"../../../../Color.js";import"../../../../intl.js";import i from"../../../../core/Accessor.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{formatDecimal as o}from"../../../../core/quantityFormatUtils.js";import{watch as l,initial as r}from"../../../../core/reactiveUtils.js";import{adaptiveVolumeUnit as n}from"../../../../core/unitUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as m}from"../../../../core/accessorSupport/decorators/subclass.js";import{e as u}from"../../../../chunks/earcut.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as p}from"../../../../chunks/vec32.js";import{create as h,fromValues as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{computeTranslationToOriginAndRotation as g}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{newDoubleArray as f}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as y}from"../../../../geometry/support/Indices.js";import{t as v}from"../../../../chunks/vec3.js";import _ from"../../../../symbols/support/ElevationInfo.js";import{cutFillConfiguration as b}from"./VolumeMeasurementConfiguration.js";import{LabelVisualElement as j}from"../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as V}from"../../interactive/visualElements/LineVisualElement.js";import{OutlineVisualElement as w}from"../../interactive/visualElements/OutlineVisualElement.js";import{GeodesicSegment as L}from"../../interactive/visualElements/support/Segment.js";import{ElevationContext as G}from"../../layers/graphics/ElevationContext.js";import{extrudePolygon as C}from"../../layers/graphics/Graphics3DExtrudeSymbolLayer.js";import{geometryToRenderInfo as A}from"../../support/renderInfoUtils/polygon.js";import{CutFillColor as x,VolumeGeometry as M}from"../../webgl-engine/lib/CutFillColor.js";import{createStipplePatternSimple as R}from"../../webgl-engine/materials/lineStippleUtils.js";import{onLocaleChange as D}from"../../../../intl/locale.js";import{fetchMessageBundle as P}from"../../../../intl/messages.js";import{substitute as E}from"../../../../intl/substitute.js";let U=class extends i{get visible(){return this.analysisViewData.visible&&null!=this.analysisViewData.elevationAlignedGeometry&&null!=this.analysisViewData.targetGeometry}get updating(){return this.loadingMessages}constructor(e){super(e),this.unitsMessages=null,this.messages=null,this.loadingMessages=!0,this._elevationContext=G.fromElevationInfo(new _({mode:"absolute-height"})),this._extrusionHeight=1e4}initialize(){const{view:e}=this,{accentColor:i}=e.effectiveTheme,s={view:e,isDecoration:!0},o=b,n={...s,width:o.geometryOutlineWidth},a=t.toUnitRGBA(i),m=t.toUnitRGBA(o.targetGeometryOutlineColor);this._elevationAlignedGeometry=new w({...n,isDraped:!0,color:a}),this._targetGeometry=new w({...n,color:m});const u={...s,attached:!0,width:o.projectionLineWidth,stipplePattern:R(o.projectionLineStippleSize),renderOccluded:4},c=t.toUnitRGBA(o.cutProjectionLineColor),p=t.toUnitRGBA(o.fillProjectionLineColor);this._cutProjectionLines=new V({...u,color:c}),this._fillProjectionLines=new V({...u,color:p});const h={...s,attached:!0};this._cutVolumeLabel=new j(h),this._fillVolumeLabel=new j(h),this._cutFillRenderNode=new x({view:e,cutColor:o.cutColor,fillColor:o.fillColor}),this.addHandles([l(()=>[this.analysisViewData.elevationAlignedGeometry,this.analysisViewData.targetGeometry,this.visible],()=>this._updateVisualElements()),l(()=>this.view.effectiveTheme.accentColor,e=>{this._elevationAlignedGeometry.color=t.toUnitRGBA(e)}),l(()=>this.analysisViewData.targetGeometry,()=>this._updateCutFillGeometry(),r),l(()=>this.visible,()=>this._updateCutFillVisibility()),l(()=>{const{messages:e,unitsMessages:t,visible:i,analysisViewData:s}=this;return{labelAnchors:s.labelAnchors,effectiveDisplayUnits:s.effectiveDisplayUnits,messages:e,unitsMessages:t,result:s.result,visible:i}},e=>this._updateLabels(e)),D(()=>this._updateMessageBundle())]),this._updateMessageBundle()}destroy(){this._elevationAlignedGeometry=s(this._elevationAlignedGeometry),this._targetGeometry=s(this._targetGeometry),this._cutProjectionLines=s(this._cutProjectionLines),this._fillProjectionLines=s(this._fillProjectionLines),this._cutVolumeLabel=s(this._cutVolumeLabel),this._fillVolumeLabel=s(this._fillVolumeLabel),this._cutFillRenderNode.destroy()}get _config(){return b}_updateVisualElements(){this._updateGeometries(),this._updateProjectionLines()}_updateGeometries(){const e=this.visible,{elevationAlignedGeometry:t,targetGeometry:i}=this.analysisViewData;this._elevationAlignedGeometry.geometry=t,this._elevationAlignedGeometry.visible=e,this._targetGeometry.geometry=i,this._targetGeometry.visible=e}_updateProjectionLines(){const e=this.visible,{elevationAlignedGeometry:t,targetGeometry:i}=this.analysisViewData;if(this._cutProjectionLines.visible=e,this._fillProjectionLines.visible=e,!t||!i)return;const{renderCoordsHelper:s}=this.view,o=s.spatialReference,l=[],r=[],n=t.spatialReference;for(let a=0;a<t.rings[0].length;++a){const e=t.rings[0][a],m=p(S,e[0],e[1],e[2]);s.toRenderCoords(m,n,m);const u=i.rings[0][a],c=p(B,u[0],u[1],u[2]);s.toRenderCoords(c,n,c);const h=new L(m,c,o);m[2]>c[2]?l.push(h):r.push(h)}this._cutProjectionLines.setGeometryFromSegments(l),this._fillProjectionLines.setGeometryFromSegments(r)}_updateLabels(e){const{labelDistance:t}=this._config,{effectiveDisplayUnits:i,labelAnchors:s,messages:o,unitsMessages:l,result:r,visible:n}=e;if(this._cutVolumeLabel.visible=n,this._fillVolumeLabel.visible=n,this._cutVolumeLabel.geometry=s.cut?{type:"point",point:s.cut,callout:{distance:t,offset:0}}:null,this._fillVolumeLabel.geometry=s.fill?{type:"point",point:s.fill,callout:{distance:-t,offset:0}}:null,null==r||null==o||null==l)return this._cutVolumeLabel.text="-",void(this._fillVolumeLabel.text="-");const a=i.volume,m=E(o.labels.cut,{volume:F(l,r.cutVolume,a)}),u=E(o.labels.fill,{volume:F(l,r.fillVolume,a)});this._cutVolumeLabel.text=m,this._fillVolumeLabel.text=u}_updateCutFillVisibility(){this.visible?this._cutFillRenderNode.enable():this._cutFillRenderNode.disable()}_updateCutFillGeometry(){const{renderCoordsHelper:e}=this.view,{targetGeometry:t}=this.analysisViewData;if(!t?.extent)return;const{center:i}=t.extent,s=d(i.x,i.y,0),o=h();e.toRenderCoords(s,t.spatialReference,o);const l=this._getExtrudedVolumes(t,this._extrusionHeight,s),r=this._getExtrudedVolumes(t,-this._extrusionHeight,s);this._cutFillRenderNode.updateGeometries(l,r,o)}_getExtrudedVolumes(e,t,i){const{renderCoordsHelper:s,spatialReference:o,elevationProvider:l}=this.view,r=h(),n=1===s.viewingMode;n||s.worldUpAtPosition([0,0,0],r);const a=A(e,l,s,this._elevationContext),{polygons:m,mapPositions:p,position:d}=a,_=m[0],b=_.count,j=u(_.mapPositions,_.holeIndices,3),V=j.length,w=6*b,L=y(w+V),G=y(V),x=f(3*w),R=f(3*w);C(d,p,j,_,x,null,R,null,L,G,t,r,n);const D=c(),P=c();return g(o,i,D,s.spatialReference),P[12]=-D[12],P[13]=-D[13],P[14]=-D[14],v(x,x,P),new M(x,G,L,R)}async _updateMessageBundle(){this.loadingMessages=!0;try{this.unitsMessages=await P("esri/core/t9n/Units"),this.messages=await P("esri/views/3d/analysis/VolumeMeasurement/t9n/VolumeMeasurementAnalysis")}finally{this.loadingMessages=!1}}};function F(e,t,i){return e&&t&&o(e,t,n(t.value,t.unit,i))}e([a({constructOnly:!0})],U.prototype,"view",void 0),e([a({constructOnly:!0})],U.prototype,"analysisViewData",void 0),e([a()],U.prototype,"unitsMessages",void 0),e([a()],U.prototype,"messages",void 0),e([a()],U.prototype,"loadingMessages",void 0),e([a({readOnly:!0})],U.prototype,"visible",null),e([a()],U.prototype,"updating",null),U=e([m("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillVisualization")],U);const S=h(),B=h();export{U as VolumeMeasurementCutFillVisualization};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import"../../../core/has.js";import{destroyMaybe as t}from"../../../core/maybe.js";import{verticalLengthUnitFromSpatialReference as i,convertUnit as s}from"../../../core/unitUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{getDefaultUnitForView as r}from"../../../support/getDefaultUnitForView.js";import{AnalysisView3D as a}from"./AnalysisView3D.js";import{VolumeMeasurementCutFillController as n}from"./VolumeMeasurement/VolumeMeasurementCutFillController.js";import{VolumeMeasurementCutFillVisualization as u}from"./VolumeMeasurement/VolumeMeasurementCutFillVisualization.js";import p from"./VolumeMeasurement/VolumeMeasurementTool.js";let m=class extends a{constructor(e){super(e),this.type="volume-measurement-view-3d",this.analysis=null,this.elevationAlignedGeometry=null,this.targetGeometry=null}initialize(){const{analysis:e,view:t}=this;this._analysisController=new n({view:t,analysis:e,analysisViewData:this}),this._analysisTool=new p({analysis:e,view:t,analysisViewData:this}),this._analysisVisualization=new u({view:t,analysisViewData:this})}destroy(){this._analysisController=t(this._analysisController),this._analysisVisualization=t(this._analysisVisualization),this._analysisTool.destroy()}get result(){return this._analysisController?.result}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get visible(){return super.visible}set visible(e){super.visible=e}get effectiveTargetElevation(){const{cutFillOptions:e,inputUnits:t}=this.analysis,{targetElevation:l}=e,o=t?.elevation??"meters",r=i(this.view.spatialReference);if(null!=l&&null!=r)return s(l,o,r);const a=this.elevationAlignedGeometry?.extent;return null==a?.zmin||null==a?.zmax?null:(a.zmax+a.zmin)/2}get effectiveDisplayUnits(){const{displayUnits:e}=this.analysis,t=r(this.view);return{elevation:e.elevation??t,volume:e.volume??t}}get updating(){return null!=this._analysisController&&this._analysisController.updating||this._analysisTool.updating}place(e){return this._analysisTool.place(e)}get test(){}};e([l({readOnly:!0})],m.prototype,"type",void 0),e([l({constructOnly:!0,nonNullable:!0})],m.prototype,"analysis",void 0),e([l({readOnly:!0})],m.prototype,"result",null),e([l()],m.prototype,"elevationAlignedGeometry",void 0),e([l({type:Number})],m.prototype,"effectiveTargetElevation",null),e([l()],m.prototype,"targetGeometry",void 0),e([l()],m.prototype,"effectiveDisplayUnits",null),e([l()],m.prototype,"updating",null),m=e([o("esri.views.3d.analysis.VolumeMeasurementAnalysisView3D")],m);const y=m;export{y as default};
5
+ import{__decorate as e}from"tslib";import"../../../core/has.js";import{destroyMaybe as t}from"../../../core/maybe.js";import{verticalLengthUnitFromSpatialReference as i,convertUnit as s}from"../../../core/unitUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import n from"../../../geometry/Point.js";import{getDefaultUnitForView as a}from"../../../support/getDefaultUnitForView.js";import{AnalysisView3D as u}from"./AnalysisView3D.js";import{VolumeMeasurementCutFillController as p}from"./VolumeMeasurement/VolumeMeasurementCutFillController.js";import{VolumeMeasurementCutFillVisualization as m}from"./VolumeMeasurement/VolumeMeasurementCutFillVisualization.js";import y from"./VolumeMeasurement/VolumeMeasurementTool.js";let c=class extends u{constructor(e){super(e),this.type="volume-measurement-view-3d",this.analysis=null,this.elevationAlignedGeometry=null,this.targetGeometry=null}initialize(){const{analysis:e,view:t}=this;this._analysisController=new p({view:t,analysis:e,analysisViewData:this}),this._analysisTool=new y({analysis:e,view:t,analysisViewData:this}),this._analysisVisualization=new m({view:t,analysisViewData:this})}destroy(){this._analysisController=t(this._analysisController),this._analysisVisualization=t(this._analysisVisualization),this._analysisTool.destroy()}get result(){return this._analysisController?.result}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get visible(){return super.visible}set visible(e){super.visible=e}get effectiveTargetElevation(){const{cutFillOptions:e,inputUnits:t}=this.analysis,{targetElevation:l}=e,o=t?.elevation??"meters",r=i(this.view.spatialReference);if(null!=l&&null!=r)return s(l,o,r);const n=this.elevationAlignedGeometry?.extent;return null==n?.zmin||null==n?.zmax?null:(n.zmax+n.zmin)/2}get effectiveDisplayUnits(){const{displayUnits:e}=this.analysis,t=a(this.view);return{elevation:e.elevation??t,volume:e.volume??t}}get labelAnchors(){const{elevationAlignedGeometry:e,view:t}=this,{renderCoordsHelper:i}=t;if(!e)return{cut:null,fill:null};let s=e.rings[0][0],l=e.rings[0][0];e.rings[0].forEach(e=>{e[2]>s[2]&&(s=e),e[2]<l[2]&&(l=e)});const{spatialReference:o}=e,a=new n({x:s[0],y:s[1],z:s[2],spatialReference:o}),u=new n({x:l[0],y:l[1],z:l[2],spatialReference:o}),p=r(),m=r();return i.toRenderCoords(a,p),i.toRenderCoords(u,m),{cut:p,fill:m}}get updating(){return null!=this._analysisController&&this._analysisController.updating||this._analysisTool.updating||this._analysisVisualization.updating}place(e){return this._analysisTool.place(e)}get test(){}};e([l({readOnly:!0})],c.prototype,"type",void 0),e([l({constructOnly:!0,nonNullable:!0})],c.prototype,"analysis",void 0),e([l({readOnly:!0})],c.prototype,"result",null),e([l()],c.prototype,"elevationAlignedGeometry",void 0),e([l({type:Number})],c.prototype,"effectiveTargetElevation",null),e([l()],c.prototype,"targetGeometry",void 0),e([l()],c.prototype,"effectiveDisplayUnits",null),e([l()],c.prototype,"labelAnchors",null),e([l()],c.prototype,"updating",null),c=e([o("esri.views.3d.analysis.VolumeMeasurementAnalysisView3D")],c);const v=c;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.34/esri/copyright.txt for details.
4
4
  */
5
- import"../webgl-engine/core/shaderLibrary/shading/EvaluateAmbientLighting.glsl.js";import"../webgl-engine/core/shaderLibrary/shading/Gamma.glsl.js";import"../webgl-engine/core/shaderLibrary/shading/PiUtils.glsl.js";import"../webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js";import"../webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import"../webgl-engine/core/shaderLibrary/util/RgbaFloatEncoding.glsl.js";import"../webgl-engine/core/shaderModules/Float3BindUniform.js";import"../webgl-engine/core/shaderModules/FloatBindUniform.js";import"../webgl-engine/core/shaderModules/glsl.js";import"../webgl-engine/shaders/ScreenSpacePassAtmosphere.glsl.js";import"../../webgl/ShaderBuilder.js";export{b as build}from"../../../chunks/CloudsComposition.glsl.js";
5
+ import"../webgl-engine/core/shaderLibrary/shading/EvaluateAmbientLighting.glsl.js";import"../webgl-engine/core/shaderLibrary/shading/Gamma.glsl.js";import"../webgl-engine/core/shaderLibrary/shading/PiUtils.glsl.js";import"../webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js";import"../webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import"../webgl-engine/core/shaderModules/Float3BindUniform.js";import"../webgl-engine/core/shaderModules/FloatBindUniform.js";import"../webgl-engine/core/shaderModules/glsl.js";import"../webgl-engine/shaders/ScreenSpacePassAtmosphere.glsl.js";import"../../webgl/ShaderBuilder.js";export{b as build}from"../../../chunks/CloudsComposition.glsl.js";
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Error.js";import t from"../../../../core/Logger.js";import{getOrCreateMapValue as r}from"../../../../core/MapUtils.js";import{getKey as o}from"../../../../core/object.js";import{allSettledValues as n}from"../../../../core/promiseUtils.js";import{isDataProtocol as s,dataComponents as a,dataToArrayBuffer as i,makeAbsolute as u}from"../../../../core/urlUtils.js";import{Version as f}from"../../../../core/Version.js";import{fromXRotation as c,multiply as d,translate as l,rotate as p,scale as m}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as h,clone as b}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{getAxisAngle as w}from"../../../../core/libs/gl-matrix-2/math/quat.js";import{create as y}from"../../../../core/libs/gl-matrix-2/factories/quatf64.js";import{BufferViewVec2f as g,BufferViewVec2u32 as T,BufferViewVec2u16 as _,BufferViewVec2i16 as x,BufferViewVec2u8 as O,BufferViewVec2i8 as N,BufferViewUint32 as S,BufferViewUint16 as C,BufferViewUint8 as A,BufferViewVec3f as L,BufferViewVec4f as E,BufferViewVec4u8 as R,BufferViewVec4u16 as v,BufferViewVec3u8 as I,BufferViewVec3u16 as D}from"../../../../geometry/support/buffer/BufferView.js";import{m as B}from"../../../../chunks/scalar.js";import"../../../../core/has.js";import{getDracoMeshDecoder as U}from"../../../../libs/dracoMeshDecoder/dracoMeshDecoder.js";import{BinaryStreamReader as M}from"./BinaryStreamReader.js";import{material as j,textureSampler as G}from"./fillDefaults.js";import{splitURI as F}from"./pathUtils.js";import{jsonFromBinaryData as H,EncodedMeshTexture as P,imageFromBinaryData as V,isEncodedMeshTexture as z}from"./resourceUtils.js";import{DataType as K}from"../../../webgl/enums.js";const k={MAGIC:1179937895,CHUNK_TYPE_JSON:1313821514,CHUNK_TYPE_BIN:5130562};class Y{constructor(t,r,o,n){if(this._context=t,this.uri=r,this.json=o,this._glbBuffer=n,this._bufferLoaders=new Map,this._textureLoaders=new Map,this._dracoBuffersSize=0,this._textureCache=new Map,this._materialCache=new Map,this._nodeParentMap=new Map,this._nodeTransformCache=new Map,this._supportedExtensions=["KHR_texture_basisu","KHR_texture_transform","KHR_draco_mesh_compression"],this._baseUri=F(this.uri).dirPart,this._checkVersionSupported(),this._checkRequiredExtensionsSupported(),null==o.scenes)throw new e("gltf-loader-unsupported-feature","Scenes must be defined.");if(null==o.meshes)throw new e("gltf-loader-unsupported-feature","Meshes must be defined");if(null==o.nodes)throw new e("gltf-loader-unsupported-feature","Nodes must be defined.");this._computeNodeParents()}static async load(t,r,o){if(s(r)){const e=a(r);if(e&&"model/gltf-binary"!==e.mediaType)try{const o=JSON.parse(e.isBase64?atob(e.data):e.data);return new Y(t,r,o)}catch{}const o=i(r);if(Y._isGLBData(o))return this._fromGLBData(t,r,o)}if(te.test(r)||"gltf"===o?.expectedType){const e=await t.loadJSON(r,o);return new Y(t,r,e)}const n=await t.loadBinary(r,o);if(Y._isGLBData(n))return this._fromGLBData(t,r,n);if(re.test(r)||"glb"===o?.expectedType)throw new e("gltf-loader-invalid-glb","This is not a valid glb file.");const u=await t.loadJSON(r,o);return new Y(t,r,u)}static _isGLBData(e){if(null==e)return!1;const t=new M(e);return t.remainingBytes()>=4&&t.readUint32()===k.MAGIC}static async _fromGLBData(e,t,r){const o=await Y._parseGLBData(r);return new Y(e,t,o.json,o.binaryData)}static async _parseGLBData(r){const o=new M(r);if(o.remainingBytes()<12)throw new e("gltf-loader-error","glb binary data is insufficiently large.");const n=o.readUint32(),s=o.readUint32(),a=o.readUint32();if(n!==k.MAGIC)throw new e("gltf-loader-error","Magic first 4 bytes do not fit to expected glb value.");if(r.byteLength<a)throw new e("gltf-loader-error","glb binary data is smaller than header specifies.");if(2!==s)throw new e("gltf-loader-unsupported-feature","An unsupported glb container version was detected. Only version 2 is supported.");let i,u,f=0;for(;o.remainingBytes()>=8;){const r=o.readUint32(),n=o.readUint32();if(0===f){if(n!==k.CHUNK_TYPE_JSON)throw new e("gltf-loader-error","First glb chunk must be JSON.");if(r<0)throw new e("gltf-loader-error","No JSON data found.");i=await H(o.readUint8Array(r))}else if(1===f){if(n!==k.CHUNK_TYPE_BIN)throw new e("gltf-loader-unsupported-feature","Second glb chunk expected to be BIN.");u=o.readUint8Array(r)}else t.getLogger("esri.views.3d.glTF").warn("[Unsupported Feature] More than 2 glb chunks detected. Skipping.");f+=1}if(!i)throw new e("gltf-loader-error","No glb JSON chunk detected.");return{json:i,binaryData:u}}async getBuffer(t,r){const o=this.json.buffers[t];if(null==o.uri){if(null==this._glbBuffer)throw new e("gltf-loader-error","glb buffer not present");return this._glbBuffer}const n=await this._getBufferLoader(t,r);if(n.byteLength!==o.byteLength)throw new e("gltf-loader-error","Buffer byte lengths should match.");return n}async _getBufferLoader(e,t){const r=this._bufferLoaders.get(e);if(r)return r;const o=this.json.buffers[e].uri,n=this._context.loadBinary(this._resolveUri(o),t).then(e=>new Uint8Array(e));return this._bufferLoaders.set(e,n),n}_validateAccessor(t){if(!this.json.accessors)throw new e("gltf-loader-unsupported-feature","Accessors missing.");const r=this.json.accessors[t];if(r.type in["MAT2","MAT3","MAT4"])throw new e("gltf-loader-unsupported-feature",`AttributeType ${r.type} is not supported`);return r}_getComponentInfo(e){const t=$[e.type],r=W[e.componentType];return{componentCount:t,componentByteSize:r,denseByteStride:t*r}}getDracoAccessor(e,t,r=!1){const o=this._validateAccessor(e),{componentCount:n,componentByteSize:s,denseByteStride:a}=this._getComponentInfo(o),i=t.offsets.get(e);return{raw:t.buffer.buffer,byteStride:a,byteOffset:t.buffer.byteOffset+(i||0),entryCount:o.count,isDenselyPacked:!0,componentCount:n,componentByteSize:s,componentType:r?t.indexComponentType:o.componentType,min:o.min,max:o.max,normalized:!!o.normalized}}async getAccessor(t,r){const o=this._validateAccessor(t);if(null==o?.bufferView)throw new e("gltf-loader-unsupported-feature","Some accessor does not specify a bufferView.");const{componentCount:n,componentByteSize:s,denseByteStride:a}=this._getComponentInfo(o),i=this.json.bufferViews[o.bufferView],u=await this.getBuffer(i.buffer,r),f=i.byteStride||a;return{raw:u.buffer,byteStride:f,byteOffset:u.byteOffset+(i.byteOffset||0)+(o.byteOffset||0),entryCount:o.count,isDenselyPacked:f===a,componentCount:n,componentByteSize:s,componentType:o.componentType,min:o.min,max:o.max,normalized:!!o.normalized}}async getIndexData(e,t,r){if(null==e.indices)return;const o=e.indices,n=r?this.getDracoAccessor(o,r,!0):await this.getAccessor(o,t);if(n.isDenselyPacked)switch(n.componentType){case K.UNSIGNED_BYTE:return new Uint8Array(n.raw,n.byteOffset,n.entryCount);case K.UNSIGNED_SHORT:return new Uint16Array(n.raw,n.byteOffset,n.entryCount);case K.UNSIGNED_INT:return new Uint32Array(n.raw,n.byteOffset,n.entryCount)}else switch(n.componentType){case K.UNSIGNED_BYTE:return B(Z(A,n));case K.UNSIGNED_SHORT:return B(Z(C,n));case K.UNSIGNED_INT:return B(Z(S,n))}}async getPositionData(t,r,n){if(null==t.attributes.POSITION)throw new e("gltf-loader-unsupported-feature","No POSITION vertex data found.");const s=t.attributes.POSITION,a=n?this.getDracoAccessor(s,n):await this.getAccessor(s,r);if(a.componentType!==K.FLOAT)throw new e("gltf-loader-unsupported-feature","Expected type FLOAT for POSITION vertex attribute, but found "+o(K,a.componentType));if(3!==a.componentCount)throw new e("gltf-loader-unsupported-feature","POSITION vertex attribute must have 3 components, but found "+a.componentCount.toFixed());return Z(L,a)}async getNormalData(t,r,n){if(null==t.attributes.NORMAL)throw new e("gltf-loader-error","No NORMAL vertex data found.");const s=t.attributes.NORMAL,a=n?this.getDracoAccessor(s,n):await this.getAccessor(s,r);if(a.componentType!==K.FLOAT)throw new e("gltf-loader-unsupported-feature","Expected type FLOAT for NORMAL vertex attribute, but found "+o(K,a.componentType));if(3!==a.componentCount)throw new e("gltf-loader-unsupported-feature","NORMAL vertex attribute must have 3 components, but found "+a.componentCount.toFixed());return Z(L,a)}async getTangentData(t,r,n){if(null==t.attributes.TANGENT)throw new e("gltf-loader-error","No TANGENT vertex data found.");const s=t.attributes.TANGENT,a=n?this.getDracoAccessor(s,n):await this.getAccessor(s,r);if(a.componentType!==K.FLOAT)throw new e("gltf-loader-unsupported-feature","Expected type FLOAT for TANGENT vertex attribute, but found "+o(K,a.componentType));if(4!==a.componentCount)throw new e("gltf-loader-unsupported-feature","TANGENT vertex attribute must have 4 components, but found "+a.componentCount.toFixed());return Z(E,a)}async getTextureCoordinates(t,r,o){if(null==t.attributes.TEXCOORD_0)throw new e("gltf-loader-error","No TEXCOORD_0 vertex data found.");const n=t.attributes.TEXCOORD_0,s=o?this.getDracoAccessor(n,o):await this.getAccessor(n,r);if(2!==s.componentCount)throw new e("gltf-loader-unsupported-feature","TEXCOORD_0 vertex attribute must have 2 components, but found "+s.componentCount.toFixed());if(s.componentType===K.FLOAT)return Z(g,s);if(!s.normalized)throw new e("gltf-loader-unsupported-feature","Integer component types are only supported for a normalized accessor for TEXCOORD_0.");return Q(s)}async getVertexColors(t,r,n){if(null==t.attributes.COLOR_0)throw new e("gltf-loader-error","No COLOR_0 vertex data found.");const s=t.attributes.COLOR_0,a=n?this.getDracoAccessor(s,n):await this.getAccessor(s,r);if(4!==a.componentCount&&3!==a.componentCount)throw new e("gltf-loader-unsupported-feature","COLOR_0 attribute must have 3 or 4 components, but found "+a.componentCount.toFixed());if(4===a.componentCount){if(a.componentType===K.FLOAT)return Z(E,a);if(a.componentType===K.UNSIGNED_BYTE)return Z(R,a);if(a.componentType===K.UNSIGNED_SHORT)return Z(v,a)}else if(3===a.componentCount){if(a.componentType===K.FLOAT)return Z(L,a);if(a.componentType===K.UNSIGNED_BYTE)return Z(I,a);if(a.componentType===K.UNSIGNED_SHORT)return Z(D,a)}throw new e("gltf-loader-unsupported-feature","Unsupported component type for COLOR_0 attribute: "+o(K,a.componentType))}hasPositions(e){return void 0!==e.attributes.POSITION}hasNormals(e){return void 0!==e.attributes.NORMAL}hasVertexColors(e){return void 0!==e.attributes.COLOR_0}hasTextureCoordinates(e){return void 0!==e.attributes.TEXCOORD_0}hasTangents(e){return void 0!==e.attributes.TANGENT}async getMaterial(e,t,r){let o=e.material?this._materialCache.get(e.material):void 0;if(!o){const n=null!=e.material?j(this.json.materials[e.material]):j(),s=n.pbrMetallicRoughness,a=this.hasVertexColors(e),i=this.getTexture(s.baseColorTexture,t),u=this.getTexture(n.normalTexture,t),f=r?this.getTexture(n.occlusionTexture,t):void 0,c=r?this.getTexture(n.emissiveTexture,t):void 0,d=r?this.getTexture(s.metallicRoughnessTexture,t):void 0,l=null!=e.material?e.material:-1;o={alphaMode:n.alphaMode,alphaCutoff:n.alphaCutoff,color:s.baseColorFactor,doubleSided:!!n.doubleSided,colorTexture:await i,normalTexture:await u,name:n.name,id:l,occlusionTexture:await f,emissiveTexture:await c,emissiveFactor:n.emissiveFactor,metallicFactor:s.metallicFactor,roughnessFactor:s.roughnessFactor,metallicRoughnessTexture:await d,hasVertexColors:a,ESRI_externalColorMixMode:n.extras.ESRI_externalColorMixMode,colorTextureTransform:s?.baseColorTexture?.extensions?.KHR_texture_transform,normalTextureTransform:n.normalTexture?.extensions?.KHR_texture_transform,occlusionTextureTransform:n.occlusionTexture?.extensions?.KHR_texture_transform,emissiveTextureTransform:n.emissiveTexture?.extensions?.KHR_texture_transform,metallicRoughnessTextureTransform:s?.metallicRoughnessTexture?.extensions?.KHR_texture_transform,receiveAmbientOcclusion:n.extras.ESRI_receiveAmbientOcclusion,receiveShadows:n.extras.ESRI_receiveShadows}}return o}async decode(t,r){const o=t.extensions?.KHR_draco_mesh_compression;if(!o)return;if(null==t.indices)throw new e("gltf-loader-error","Found Draco compressed primitive without indices.");const n=this.json.bufferViews[o.bufferView],s=await this.getBuffer(n.buffer,r),a=(await U()).decode(new Uint8Array(s.buffer,n.byteOffset,n.byteLength));this._bufferLoaders.delete(n.buffer);const i=new Map([[t.indices,a.indexOffset],[t.attributes.POSITION,a.positionOffset]]);return t.attributes.TEXCOORD_0&&i.set(t.attributes.TEXCOORD_0,a.uvOffset),t.attributes.NORMAL&&i.set(t.attributes.NORMAL,a.normalOffset),t.attributes.COLOR_0&&i.set(t.attributes.COLOR_0,a.colorOffset),t.attributes.TANGENT&&i.set(t.attributes.TANGENT,a.tangentOffset),this._dracoBuffersSize+=a.buffer.byteLength,{buffer:a.buffer,indexComponentType:a.indexComponentType,offsets:i}}async getTexture(t,o){if(!t)return;if(0!==(t.texCoord||0))throw new e("gltf-loader-unsupported-feature","Only TEXCOORD with index 0 is supported.");const n=t.index,s=this.json.textures[n],a=G(null!=s.sampler?this.json.samplers[s.sampler]:{}),i=ee(s),u=this.json.images[i],f=await this._loadTextureImageData(n,s,o);return r(this._textureCache,n,()=>{const t=e=>33071===e||33648===e||10497===e,r=t=>{throw new e("gltf-loader-error",`Unexpected TextureSampler WrapMode: ${t}`)};return{data:f,wrapS:t(a.wrapS)?a.wrapS:r(a.wrapS),wrapT:t(a.wrapT)?a.wrapT:r(a.wrapT),minFilter:a.minFilter,name:u.name,id:n}})}getNodeTransform(e){if(void 0===e)return X;let t=this._nodeTransformCache.get(e);if(!t){const r=this.getNodeTransform(this._getNodeParent(e)),o=this.json.nodes[e];o.matrix?t=d(h(),r,o.matrix):o.translation||o.rotation||o.scale?(t=b(r),o.translation&&l(t,t,o.translation),o.rotation&&(J[3]=w(J,o.rotation),p(t,t,J[3],J)),o.scale&&m(t,t,o.scale)):t=b(r),this._nodeTransformCache.set(e,t)}return t}_resolveUri(e){return u(e,this._baseUri)}_getNodeParent(e){return this._nodeParentMap.get(e)}_checkVersionSupported(){const e=f.parse(this.json.asset.version,"glTF");q.validate(e)}_checkRequiredExtensionsSupported(){const t=this.json;if(t.extensionsRequired){if(!t.extensionsRequired.every(e=>this._supportedExtensions.includes(e)))throw new e("gltf-loader-unsupported-feature","gltf loader was not able to load unsupported feature. Required extensions: "+t.extensionsRequired.join(", "))}}_computeNodeParents(){this.json.nodes.forEach((e,t)=>{e.children&&e.children.forEach(e=>{this._nodeParentMap.set(e,t)})})}async _loadTextureImageData(e,t,r){const o=this._textureLoaders.get(e);if(o)return o;const n=this._createTextureLoader(t,r);return this._textureLoaders.set(e,n),n}async _createTextureLoader(t,r){const o=ee(t),n=this.json.images[o];if(n.uri){if(n.uri.endsWith(".ktx2")){const e=await this._context.loadBinary(this._resolveUri(n.uri),r);return new P(new Uint8Array(e))}return this._context.loadImage(this._resolveUri(n.uri),r)}if(null==n.bufferView)throw new e("gltf-loader-unsupported-feature","Image bufferView must be defined.");if(null==n.mimeType)throw new e("gltf-loader-unsupported-feature","Image mimeType must be defined.");const s=this.json.bufferViews[n.bufferView],a=await this.getBuffer(s.buffer,r);if(null!=s.byteStride)throw new e("gltf-loader-unsupported-feature","byteStride not supported for image buffer");const i=a.byteOffset+(s.byteOffset||0);return V(new Uint8Array(a.buffer,i,s.byteLength),n.mimeType)}async getLoadedBuffersSize(){if(this._glbBuffer)return this._glbBuffer.byteLength;const e=await n(Array.from(this._bufferLoaders.values())),t=await n(Array.from(this._textureLoaders.values()));return e.reduce((e,t)=>e+(t?.byteLength??0),0)+this._dracoBuffersSize+t.reduce((e,t)=>e+(t?z(t)?t.data.byteLength:t.width*t.height*4:0),0)}}const X=c(h(),Math.PI/2),q=new f(2,0,"glTF"),J=y(),$={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},W={[K.BYTE]:1,[K.UNSIGNED_BYTE]:1,[K.SHORT]:2,[K.UNSIGNED_SHORT]:2,[K.HALF_FLOAT]:2,[K.FLOAT]:4,[K.INT]:4,[K.UNSIGNED_INT]:4};function Q(e){switch(e.componentType){case K.BYTE:return new N(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case K.UNSIGNED_BYTE:return new O(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case K.SHORT:return new x(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case K.UNSIGNED_SHORT:return new _(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case K.UNSIGNED_INT:return new T(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case K.FLOAT:return new g(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount)}}function Z(e,t){return new e(t.raw,t.byteOffset,t.byteStride,t.byteOffset+t.byteStride*(t.entryCount-1)+t.componentByteSize*t.componentCount)}function ee(t){if(null!=t.extensions?.KHR_texture_basisu)return t.extensions.KHR_texture_basisu.source;if(null!==t.source)return t.source;throw new e("gltf-loader-unsupported-feature","Source is expected to be defined for a texture. It can also be omitted in favour of an KHR_texture_basisu extension tag.")}const te=/\.gltf$/i,re=/\.glb$/i;export{Y as GLTFResource,X as transformGltfToEngine};
5
+ import e from"../../../../core/Error.js";import t from"../../../../core/Logger.js";import{getOrCreateMapValue as r}from"../../../../core/MapUtils.js";import{getKey as o}from"../../../../core/object.js";import{allSettledValues as n}from"../../../../core/promiseUtils.js";import{isDataProtocol as s,dataComponents as a,dataToArrayBuffer as i,makeAbsolute as u}from"../../../../core/urlUtils.js";import{Version as f}from"../../../../core/Version.js";import{fromXRotation as c,multiply as d,translate as l,rotate as p,scale as m}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as h,clone as b}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{getAxisAngle as w}from"../../../../core/libs/gl-matrix-2/math/quat.js";import{create as y}from"../../../../core/libs/gl-matrix-2/factories/quatf64.js";import{BufferViewVec2f as g,BufferViewVec2u32 as T,BufferViewVec2u16 as _,BufferViewVec2i16 as x,BufferViewVec2u8 as O,BufferViewVec2i8 as N,BufferViewUint32 as S,BufferViewUint16 as C,BufferViewUint8 as A,BufferViewVec3f as L,BufferViewVec4f as E,BufferViewVec4u8 as R,BufferViewVec4u16 as I,BufferViewVec3u8 as v,BufferViewVec3u16 as D}from"../../../../geometry/support/buffer/BufferView.js";import{m as B}from"../../../../chunks/scalar.js";import"../../../../core/has.js";import{getDracoMeshDecoder as U}from"../../../../libs/dracoMeshDecoder/dracoMeshDecoder.js";import{BinaryStreamReader as M}from"./BinaryStreamReader.js";import{material as j,textureSampler as G}from"./fillDefaults.js";import{splitURI as F}from"./pathUtils.js";import{jsonFromBinaryData as H,EncodedMeshTexture as P,imageFromBinaryData as V,isEncodedMeshTexture as z}from"./resourceUtils.js";import{DataType as K}from"../../../webgl/enums.js";const k={MAGIC:1179937895,CHUNK_TYPE_JSON:1313821514,CHUNK_TYPE_BIN:5130562};class Y{constructor(t,r,o,n){if(this._context=t,this.uri=r,this.json=o,this._glbBuffer=n,this._bufferLoaders=new Map,this._textureLoaders=new Map,this._dracoBuffersSize=0,this._textureCache=new Map,this._materialCache=new Map,this._nodeParentMap=new Map,this._nodeTransformCache=new Map,this._supportedExtensions=["KHR_texture_basisu","KHR_texture_transform","KHR_draco_mesh_compression"],this._baseUri=F(this.uri).dirPart,this._checkVersionSupported(),this._checkRequiredExtensionsSupported(),null==o.scenes)throw new e("gltf-loader-unsupported-feature","Scenes must be defined.");if(null==o.meshes)throw new e("gltf-loader-unsupported-feature","Meshes must be defined");if(null==o.nodes)throw new e("gltf-loader-unsupported-feature","Nodes must be defined.");this._computeNodeParents()}static async load(t,r,o){if(s(r)){const e=a(r);if(e&&"model/gltf-binary"!==e.mediaType)try{const o=JSON.parse(e.isBase64?atob(e.data):e.data);return new Y(t,r,o)}catch{}const o=i(r);if(Y._isGLBData(o))return this._fromGLBData(t,r,o)}if(te.test(r)||"gltf"===o?.expectedType){const e=await t.loadJSON(r,o);return new Y(t,r,e)}const n=await t.loadBinary(r,o);if(Y._isGLBData(n))return this._fromGLBData(t,r,n);if(re.test(r)||"glb"===o?.expectedType)throw new e("gltf-loader-invalid-glb","This is not a valid glb file.");const u=await t.loadJSON(r,o);return new Y(t,r,u)}static _isGLBData(e){if(null==e)return!1;const t=new M(e);return t.remainingBytes()>=4&&t.readUint32()===k.MAGIC}static async _fromGLBData(e,t,r){const o=await Y._parseGLBData(r);return new Y(e,t,o.json,o.binaryData)}static async _parseGLBData(r){const o=new M(r);if(o.remainingBytes()<12)throw new e("gltf-loader-error","glb binary data is insufficiently large.");const n=o.readUint32(),s=o.readUint32(),a=o.readUint32();if(n!==k.MAGIC)throw new e("gltf-loader-error","Magic first 4 bytes do not fit to expected glb value.");if(r.byteLength<a)throw new e("gltf-loader-error","glb binary data is smaller than header specifies.");if(2!==s)throw new e("gltf-loader-unsupported-feature","An unsupported glb container version was detected. Only version 2 is supported.");let i,u,f=0;for(;o.remainingBytes()>=8;){const r=o.readUint32(),n=o.readUint32();if(0===f){if(n!==k.CHUNK_TYPE_JSON)throw new e("gltf-loader-error","First glb chunk must be JSON.");if(r<0)throw new e("gltf-loader-error","No JSON data found.");i=await H(o.readUint8Array(r))}else if(1===f){if(n!==k.CHUNK_TYPE_BIN)throw new e("gltf-loader-unsupported-feature","Second glb chunk expected to be BIN.");u=o.readUint8Array(r)}else t.getLogger("esri.views.3d.glTF").warn("[Unsupported Feature] More than 2 glb chunks detected. Skipping.");f+=1}if(!i)throw new e("gltf-loader-error","No glb JSON chunk detected.");return{json:i,binaryData:u}}async getBuffer(t,r){const o=this.json.buffers[t];if(null==o.uri){if(null==this._glbBuffer)throw new e("gltf-loader-error","glb buffer not present");return this._glbBuffer}const n=await this._getBufferLoader(t,r);if(n.byteLength!==o.byteLength)throw new e("gltf-loader-error","Buffer byte lengths should match.");return n}async _getBufferLoader(e,t){const r=this._bufferLoaders.get(e);if(r)return r;const o=this.json.buffers[e].uri,n=this._context.loadBinary(this._resolveUri(o),t).then(e=>new Uint8Array(e));return this._bufferLoaders.set(e,n),n}_validateAccessor(t){if(!this.json.accessors)throw new e("gltf-loader-unsupported-feature","Accessors missing.");const r=this.json.accessors[t];if(r.type in["MAT2","MAT3","MAT4"])throw new e("gltf-loader-unsupported-feature",`AttributeType ${r.type} is not supported`);return r}_getComponentInfo(e,t){const r=$[e.type],o=t?.componentType||e.componentType,n=W[o];return{componentType:o,componentCount:r,componentByteSize:n,denseByteStride:r*n}}getDracoAccessor(e,t){const r=this._validateAccessor(e),o=t.accessorInfos.get(e),{componentType:n,componentCount:s,componentByteSize:a,denseByteStride:i}=this._getComponentInfo(r,o);return{raw:t.data.buffer,byteStride:i,byteOffset:t.data.byteOffset+(o?.byteOffset||0),entryCount:o?.count??r.count,isDenselyPacked:!0,componentCount:s,componentByteSize:a,componentType:n,min:r.min,max:r.max,normalized:!!r.normalized}}async getAccessor(t,r){const o=this._validateAccessor(t);if(null==o?.bufferView)throw new e("gltf-loader-unsupported-feature","Some accessor does not specify a bufferView.");const{componentCount:n,componentByteSize:s,denseByteStride:a}=this._getComponentInfo(o),i=this.json.bufferViews[o.bufferView],u=await this.getBuffer(i.buffer,r),f=i.byteStride||a;return{raw:u.buffer,byteStride:f,byteOffset:u.byteOffset+(i.byteOffset||0)+(o.byteOffset||0),entryCount:o.count,isDenselyPacked:f===a,componentCount:n,componentByteSize:s,componentType:o.componentType,min:o.min,max:o.max,normalized:!!o.normalized}}async getIndexData(e,t,r){if(null==e.indices)return;const o=e.indices,n=r?this.getDracoAccessor(o,r):await this.getAccessor(o,t);if(n.isDenselyPacked)switch(n.componentType){case K.UNSIGNED_BYTE:return new Uint8Array(n.raw,n.byteOffset,n.entryCount);case K.UNSIGNED_SHORT:return new Uint16Array(n.raw,n.byteOffset,n.entryCount);case K.UNSIGNED_INT:return new Uint32Array(n.raw,n.byteOffset,n.entryCount)}else switch(n.componentType){case K.UNSIGNED_BYTE:return B(Z(A,n));case K.UNSIGNED_SHORT:return B(Z(C,n));case K.UNSIGNED_INT:return B(Z(S,n))}}async getPositionData(t,r,n){if(null==t.attributes.POSITION)throw new e("gltf-loader-unsupported-feature","No POSITION vertex data found.");const s=t.attributes.POSITION,a=n?this.getDracoAccessor(s,n):await this.getAccessor(s,r);if(a.componentType!==K.FLOAT)throw new e("gltf-loader-unsupported-feature","Expected type FLOAT for POSITION vertex attribute, but found "+o(K,a.componentType));if(3!==a.componentCount)throw new e("gltf-loader-unsupported-feature","POSITION vertex attribute must have 3 components, but found "+a.componentCount.toFixed());return Z(L,a)}async getNormalData(t,r,n){if(null==t.attributes.NORMAL)throw new e("gltf-loader-error","No NORMAL vertex data found.");const s=t.attributes.NORMAL,a=n?this.getDracoAccessor(s,n):await this.getAccessor(s,r);if(a.componentType!==K.FLOAT)throw new e("gltf-loader-unsupported-feature","Expected type FLOAT for NORMAL vertex attribute, but found "+o(K,a.componentType));if(3!==a.componentCount)throw new e("gltf-loader-unsupported-feature","NORMAL vertex attribute must have 3 components, but found "+a.componentCount.toFixed());return Z(L,a)}async getTangentData(t,r,n){if(null==t.attributes.TANGENT)throw new e("gltf-loader-error","No TANGENT vertex data found.");const s=t.attributes.TANGENT,a=n?this.getDracoAccessor(s,n):await this.getAccessor(s,r);if(a.componentType!==K.FLOAT)throw new e("gltf-loader-unsupported-feature","Expected type FLOAT for TANGENT vertex attribute, but found "+o(K,a.componentType));if(4!==a.componentCount)throw new e("gltf-loader-unsupported-feature","TANGENT vertex attribute must have 4 components, but found "+a.componentCount.toFixed());return Z(E,a)}async getTextureCoordinates(t,r,o){if(null==t.attributes.TEXCOORD_0)throw new e("gltf-loader-error","No TEXCOORD_0 vertex data found.");const n=t.attributes.TEXCOORD_0,s=o?this.getDracoAccessor(n,o):await this.getAccessor(n,r);if(2!==s.componentCount)throw new e("gltf-loader-unsupported-feature","TEXCOORD_0 vertex attribute must have 2 components, but found "+s.componentCount.toFixed());if(s.componentType===K.FLOAT)return Z(g,s);if(!s.normalized)throw new e("gltf-loader-unsupported-feature","Integer component types are only supported for a normalized accessor for TEXCOORD_0.");return Q(s)}async getVertexColors(t,r,n){if(null==t.attributes.COLOR_0)throw new e("gltf-loader-error","No COLOR_0 vertex data found.");const s=t.attributes.COLOR_0,a=n?this.getDracoAccessor(s,n):await this.getAccessor(s,r);if(4!==a.componentCount&&3!==a.componentCount)throw new e("gltf-loader-unsupported-feature","COLOR_0 attribute must have 3 or 4 components, but found "+a.componentCount.toFixed());if(4===a.componentCount){if(a.componentType===K.FLOAT)return Z(E,a);if(a.componentType===K.UNSIGNED_BYTE)return Z(R,a);if(a.componentType===K.UNSIGNED_SHORT)return Z(I,a)}else if(3===a.componentCount){if(a.componentType===K.FLOAT)return Z(L,a);if(a.componentType===K.UNSIGNED_BYTE)return Z(v,a);if(a.componentType===K.UNSIGNED_SHORT)return Z(D,a)}throw new e("gltf-loader-unsupported-feature","Unsupported component type for COLOR_0 attribute: "+o(K,a.componentType))}hasPositions(e){return void 0!==e.attributes.POSITION}hasNormals(e){return void 0!==e.attributes.NORMAL}hasVertexColors(e){return void 0!==e.attributes.COLOR_0}hasTextureCoordinates(e){return void 0!==e.attributes.TEXCOORD_0}hasTangents(e){return void 0!==e.attributes.TANGENT}async getMaterial(e,t,r){let o=e.material?this._materialCache.get(e.material):void 0;if(!o){const n=null!=e.material?j(this.json.materials[e.material]):j(),s=n.pbrMetallicRoughness,a=this.hasVertexColors(e),i=this.getTexture(s.baseColorTexture,t),u=this.getTexture(n.normalTexture,t),f=r?this.getTexture(n.occlusionTexture,t):void 0,c=r?this.getTexture(n.emissiveTexture,t):void 0,d=r?this.getTexture(s.metallicRoughnessTexture,t):void 0,l=null!=e.material?e.material:-1;o={alphaMode:n.alphaMode,alphaCutoff:n.alphaCutoff,color:s.baseColorFactor,doubleSided:!!n.doubleSided,colorTexture:await i,normalTexture:await u,name:n.name,id:l,occlusionTexture:await f,emissiveTexture:await c,emissiveFactor:n.emissiveFactor,metallicFactor:s.metallicFactor,roughnessFactor:s.roughnessFactor,metallicRoughnessTexture:await d,hasVertexColors:a,ESRI_externalColorMixMode:n.extras.ESRI_externalColorMixMode,colorTextureTransform:s?.baseColorTexture?.extensions?.KHR_texture_transform,normalTextureTransform:n.normalTexture?.extensions?.KHR_texture_transform,occlusionTextureTransform:n.occlusionTexture?.extensions?.KHR_texture_transform,emissiveTextureTransform:n.emissiveTexture?.extensions?.KHR_texture_transform,metallicRoughnessTextureTransform:s?.metallicRoughnessTexture?.extensions?.KHR_texture_transform,receiveAmbientOcclusion:n.extras.ESRI_receiveAmbientOcclusion,receiveShadows:n.extras.ESRI_receiveShadows}}return o}async decode(t,r){const o=t.extensions?.KHR_draco_mesh_compression;if(!o)return;if(null==t.indices)throw new e("gltf-loader-error","Found Draco compressed primitive without indices.");const n=this.json.bufferViews[o.bufferView],s=await this.getBuffer(n.buffer,r),a=(await U()).decode(new Uint8Array(s.buffer,s.byteOffset+(n.byteOffset||0),n.byteLength));this._bufferLoaders.delete(n.buffer);const i=new Map([[t.indices,a.indices],[t.attributes.POSITION,a.positions]]);return t.attributes.TEXCOORD_0&&i.set(t.attributes.TEXCOORD_0,a.uvs),t.attributes.NORMAL&&i.set(t.attributes.NORMAL,a.normals),t.attributes.COLOR_0&&i.set(t.attributes.COLOR_0,a.colors),t.attributes.TANGENT&&i.set(t.attributes.TANGENT,a.tangents),this._dracoBuffersSize+=a.buffer.byteLength,{data:a.buffer,accessorInfos:i}}async getTexture(t,o){if(!t)return;if(0!==(t.texCoord||0))throw new e("gltf-loader-unsupported-feature","Only TEXCOORD with index 0 is supported.");const n=t.index,s=this.json.textures[n],a=G(null!=s.sampler?this.json.samplers[s.sampler]:{}),i=ee(s),u=this.json.images[i],f=await this._loadTextureImageData(n,s,o);return r(this._textureCache,n,()=>{const t=e=>33071===e||33648===e||10497===e,r=t=>{throw new e("gltf-loader-error",`Unexpected TextureSampler WrapMode: ${t}`)};return{data:f,wrapS:t(a.wrapS)?a.wrapS:r(a.wrapS),wrapT:t(a.wrapT)?a.wrapT:r(a.wrapT),minFilter:a.minFilter,name:u.name,id:n}})}getNodeTransform(e){if(void 0===e)return X;let t=this._nodeTransformCache.get(e);if(!t){const r=this.getNodeTransform(this._getNodeParent(e)),o=this.json.nodes[e];o.matrix?t=d(h(),r,o.matrix):o.translation||o.rotation||o.scale?(t=b(r),o.translation&&l(t,t,o.translation),o.rotation&&(J[3]=w(J,o.rotation),p(t,t,J[3],J)),o.scale&&m(t,t,o.scale)):t=b(r),this._nodeTransformCache.set(e,t)}return t}_resolveUri(e){return u(e,this._baseUri)}_getNodeParent(e){return this._nodeParentMap.get(e)}_checkVersionSupported(){const e=f.parse(this.json.asset.version,"glTF");q.validate(e)}_checkRequiredExtensionsSupported(){const t=this.json;if(t.extensionsRequired){if(!t.extensionsRequired.every(e=>this._supportedExtensions.includes(e)))throw new e("gltf-loader-unsupported-feature","gltf loader was not able to load unsupported feature. Required extensions: "+t.extensionsRequired.join(", "))}}_computeNodeParents(){this.json.nodes.forEach((e,t)=>{e.children&&e.children.forEach(e=>{this._nodeParentMap.set(e,t)})})}async _loadTextureImageData(e,t,r){const o=this._textureLoaders.get(e);if(o)return o;const n=this._createTextureLoader(t,r);return this._textureLoaders.set(e,n),n}async _createTextureLoader(t,r){const o=ee(t),n=this.json.images[o];if(n.uri){if(n.uri.endsWith(".ktx2")){const e=await this._context.loadBinary(this._resolveUri(n.uri),r);return new P(new Uint8Array(e))}return this._context.loadImage(this._resolveUri(n.uri),r)}if(null==n.bufferView)throw new e("gltf-loader-unsupported-feature","Image bufferView must be defined.");if(null==n.mimeType)throw new e("gltf-loader-unsupported-feature","Image mimeType must be defined.");const s=this.json.bufferViews[n.bufferView],a=await this.getBuffer(s.buffer,r);if(null!=s.byteStride)throw new e("gltf-loader-unsupported-feature","byteStride not supported for image buffer");const i=a.byteOffset+(s.byteOffset||0);return V(new Uint8Array(a.buffer,i,s.byteLength),n.mimeType)}async getLoadedBuffersSize(){if(this._glbBuffer)return this._glbBuffer.byteLength;const e=await n(Array.from(this._bufferLoaders.values())),t=await n(Array.from(this._textureLoaders.values()));return e.reduce((e,t)=>e+(t?.byteLength??0),0)+this._dracoBuffersSize+t.reduce((e,t)=>e+(t?z(t)?t.data.byteLength:t.width*t.height*4:0),0)}}const X=c(h(),Math.PI/2),q=new f(2,0,"glTF"),J=y(),$={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},W={[K.BYTE]:1,[K.UNSIGNED_BYTE]:1,[K.SHORT]:2,[K.UNSIGNED_SHORT]:2,[K.HALF_FLOAT]:2,[K.FLOAT]:4,[K.INT]:4,[K.UNSIGNED_INT]:4};function Q(e){switch(e.componentType){case K.BYTE:return new N(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case K.UNSIGNED_BYTE:return new O(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case K.SHORT:return new x(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case K.UNSIGNED_SHORT:return new _(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case K.UNSIGNED_INT:return new T(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case K.FLOAT:return new g(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount)}}function Z(e,t){return new e(t.raw,t.byteOffset,t.byteStride,t.byteOffset+t.byteStride*(t.entryCount-1)+t.componentByteSize*t.componentCount)}function ee(t){if(null!=t.extensions?.KHR_texture_basisu)return t.extensions.KHR_texture_basisu.source;if(null!==t.source)return t.source;throw new e("gltf-loader-unsupported-feature","Source is expected to be defined for a texture. It can also be omitted in favour of an KHR_texture_basisu extension tag.")}const te=/\.gltf$/i,re=/\.glb$/i;export{Y as GLTFResource,X as transformGltfToEngine};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../Color.js";import{multiplyOpacity as i}from"../../../core/colorUtils.js";import"../../../core/has.js";import{destroyHandle as n}from"../../../core/handleUtils.js";import{m as t}from"../../../chunks/vec32.js";import{create as o}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectVectorToVector as r}from"../../../geometry/projection/projectVectorToVector.js";import{onTheGroundElevationInfo as l,absoluteHeightElevationInfo as a}from"../../../support/elevationInfoUtils.js";import{vectorToRender as s}from"./support/viewUtils.js";import{ExtendedLineVisualElement as c}from"./visualElements/ExtendedLineVisualElement.js";import{ParallelLineVisualElement as p}from"./visualElements/ParallelLineVisualElement.js";import{PointVisualElement as d}from"./visualElements/PointVisualElement.js";import{RightAngleQuadVisualElement as m}from"./visualElements/RightAngleQuadVisualElement.js";import{toDehydratedPoint as u,isTarget as f,withSelfSnappingZ as g}from"../../interactive/sketch/normalizedPoint.js";import{defaults as v}from"../../interactive/snapping/Settings.js";import{SnappingVisualizer as h}from"../../interactive/snapping/SnappingVisualizer.js";import{LineSnappingHint as C}from"../../interactive/snapping/hints/LineSnappingHint.js";class w extends h{sortUniqueHints(e){return e.sort((e,i)=>(i instanceof C?i.length:0)-(e instanceof C?e.length:0))}visualizeIntersectionPoint(e,i){const{spatialReference:t,view:o}=i,r=j(i);return n(new d({view:o,primitive:"circle",geometry:u(e.intersectionPoint,t),elevationInfo:e.isDraped?l:a,size:20,outlineSize:2,color:r.intersectionPointColor,outlineColor:r.intersectionPointOutlineColor,pixelSnappingEnabled:!1,isDecoration:!0,attached:!0}))}visualizePoint(e,i){const{view:t,spatialReference:o}=i,r=j(i),l=E(e.point,e.domain,i);return n(new d({view:t,primitive:"circle",geometry:u(l,o),elevationInfo:x(e),size:20,outlineSize:2,color:r.pointColor,outlineColor:r.pointOutlineColor,pixelSnappingEnabled:!1,isDecoration:!0,attached:!0}))}visualizeLine(e,i){const{view:t,spatialReference:o}=i,r=j(i),l=E(e.lineStart,e.domain,i),a=E(e.lineEnd,e.domain,i);return n(D(e.type,l,a,o,x(e),t,r,e.isDraped,e.fadeLeft,e.fadeRight))}visualizeParallelSign(e,i){const{view:o,spatialReference:r}=i,l=j(i),{isDraped:a}=e,s=x(e),c=E(e.lineStart,e.domain,i),d=E(e.lineEnd,e.domain,i),m=S(c,r,s,o,a),u=S(d,r,s,o,a),f=t(u,m,u,.5),g=new p({view:o,attached:!1,offset:v.parallelLineHintOffset,length:v.parallelLineHintLength,width:v.parallelLineHintWidth,color:l.parallelSignColor,location:f,renderOccluded:a?4:16,isDraped:a,renderGroup:3,isDecoration:!0});return g.setDirectionFromPoints(m,f),g.attached=!0,n(g)}visualizeRightAngleQuad(e,i){const{view:t,spatialReference:o}=i,r=j(i),l=x(e),{isDraped:a}=e,s=E(e.previousVertex,e.domain,i),c=E(e.centerVertex,e.domain,i),p=E(e.nextVertex,e.domain,i),d=S(s,o,l,t,a),u=S(c,o,l,t,a),f=S(p,o,l,t,a);return n(new m({view:t,attached:!0,color:a?r.rightAngleColorDraped:r.rightAngleColor,renderOccluded:a?4:2,outlineRenderOccluded:a?4:16,outlineColor:r.rightAngleOutlineColor,outlineSize:v.rightAngleHintOutlineSize,size:v.rightAngleHintSize,isDraped:a,geometry:{previous:d,center:u,next:f},renderGroup:3,isDecoration:!0}))}}function j(n){const{effectiveTheme:t}=n.view,o=e.toUnitRGBA(t.accentColor),r=[0,0,0,0];return{intersectionPointColor:r,intersectionPointOutlineColor:o,pointColor:r,pointOutlineColor:o,lineColor:o,lineOutlineColor:void 0,parallelSignColor:o,rightAngleColor:o,rightAngleColorDraped:e.toUnitRGBA(i(t.accentColor,.5)),rightAngleOutlineColor:o}}function E(e,i,{selfSnappingZ:n,view:t,spatialReference:o}){return 2&i&&f(e)&&null!=n?g(e,n,t,o):e}function x(e){return e.isDraped?l:a}function D(e,i,n,t,o,r,l,a=!1,s=!0,p=!0){const d=S(i,t,o,r,a),m=S(n,t,o,r,a),u=new c({view:r,extensionType:3,start:d,end:m,isDraped:a,color:l.lineColor,renderOccluded:a?4:16,renderGroup:3,isDecoration:!0});switch(e){case 0:u.width=v.lineHintWidthTarget,u.fadedExtensions={start:0,end:v.lineHintFadedExtensions};break;case 2:u.width=v.lineHintWidthReference,u.fadedExtensions={start:0,end:0};break;case 1:u.width=v.lineHintWidthReference,u.fadedExtensions={start:s?v.lineHintFadedExtensions:0,end:p?v.lineHintFadedExtensions:0}}return u.attached=!0,u}function S(e,i,n,t,l){const a=o();if(l){const n=t.basemapTerrain.overlayManager.renderer.spatialReference;r(e,i,a,n)}else s(e,i,n,t,a);return a}export{w as SnappingVisualizer3D};
5
+ import e from"../../../Color.js";import{multiplyOpacity as i}from"../../../core/colorUtils.js";import"../../../core/has.js";import{destroyHandle as n}from"../../../core/handleUtils.js";import{m as t}from"../../../chunks/vec32.js";import{create as o}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectVectorToVector as r}from"../../../geometry/projection/projectVectorToVector.js";import{onTheGroundElevationInfo as l,absoluteHeightElevationInfo as a}from"../../../support/elevationInfoUtils.js";import{vectorToRender as s}from"./support/viewUtils.js";import{ExtendedLineVisualElement as c}from"./visualElements/ExtendedLineVisualElement.js";import{ParallelLineVisualElement as p}from"./visualElements/ParallelLineVisualElement.js";import{PointVisualElement as d}from"./visualElements/PointVisualElement.js";import{RightAngleQuadVisualElement as u}from"./visualElements/RightAngleQuadVisualElement.js";import{toDehydratedPoint as m,isTarget as f,withSelfSnappingZ as g}from"../../interactive/sketch/normalizedPoint.js";import{defaults as v}from"../../interactive/snapping/Settings.js";import{SnappingVisualizer as h}from"../../interactive/snapping/SnappingVisualizer.js";import{LineSnappingHint as C}from"../../interactive/snapping/hints/LineSnappingHint.js";class w extends h{sortUniqueHints(e){return e.sort((e,i)=>(i instanceof C?i.length:0)-(e instanceof C?e.length:0))}visualizeIntersectionPoint(e,i){const{spatialReference:t,view:o}=i,r=j(i);return n(new d({view:o,primitive:"circle",geometry:m(e.intersectionPoint,t),elevationInfo:e.isDraped?l:a,size:20,outlineSize:2,color:r.intersectionPointColor,outlineColor:r.intersectionPointOutlineColor,pixelSnappingEnabled:!1,isDecoration:!0,attached:!0}))}visualizePoint(e,i){const{view:t,spatialReference:o}=i,r=j(i),l=E(e.point,e.domain,i);return n(new d({view:t,primitive:"circle",geometry:m(l,o),elevationInfo:x(e),size:20,outlineSize:2,color:r.pointColor,outlineColor:r.pointOutlineColor,pixelSnappingEnabled:!1,isDecoration:!0,attached:!0}))}visualizeLine(e,i){const{view:t,spatialReference:o}=i,r=j(i),l=E(e.lineStart,e.domain,i),a=E(e.lineEnd,e.domain,i);return n(D(e.type,l,a,o,x(e),t,r,e.isDraped,e.fadeLeft,e.fadeRight))}visualizeParallelSign(e,i){const{view:o,spatialReference:r}=i,l=j(i),{isDraped:a}=e,s=x(e),c=E(e.lineStart,e.domain,i),d=E(e.lineEnd,e.domain,i),u=S(c,r,s,o,a),m=S(d,r,s,o,a),f=t(m,u,m,.5),g=new p({view:o,attached:!1,offset:v.parallelLineHintOffset,length:v.parallelLineHintLength,width:v.parallelLineHintWidth,color:l.parallelSignColor,location:f,renderOccluded:a?4:16,isDraped:a,renderGroup:3,isDecoration:!0});return g.setDirectionFromPoints(u,f),g.attached=!0,n(g)}visualizeRightAngleQuad(e,i){const{view:t,spatialReference:o}=i,r=j(i),l=x(e),{isDraped:a}=e,s=E(e.previousVertex,e.domain,i),c=E(e.centerVertex,e.domain,i),p=E(e.nextVertex,e.domain,i),d=S(s,o,l,t,a),m=S(c,o,l,t,a),f=S(p,o,l,t,a);return n(new u({view:t,attached:!0,color:a?r.rightAngleColorDraped:r.rightAngleColor,renderOccluded:a?4:2,outlineRenderOccluded:a?4:16,outlineColor:r.rightAngleOutlineColor,outlineSize:v.rightAngleHintOutlineSize,size:v.rightAngleHintSize,isDraped:a,geometry:{previous:d,center:m,next:f},renderGroup:3,isDecoration:!0}))}}function j(n){const{effectiveTheme:t}=n.view,o=e.toUnitRGBA(t.accentColor),r=[0,0,0,0];return{intersectionPointColor:r,intersectionPointOutlineColor:o,pointColor:r,pointOutlineColor:o,lineColor:o,lineOutlineColor:void 0,parallelSignColor:o,rightAngleColor:o,rightAngleColorDraped:e.toUnitRGBA(i(t.accentColor,.5)),rightAngleOutlineColor:o}}function E(e,i,{selfSnappingZ:n,view:t,spatialReference:o}){return 2&i&&f(e)&&null!=n?g(e,n,t,o):e}function x(e){return e.isDraped?l:a}function D(e,i,n,t,o,r,l,a=!1,s=!0,p=!0){const d=S(i,t,o,r,a),u=S(n,t,o,r,a),m=new c({view:r,extensionType:3,start:d,end:u,isDraped:a,color:l.lineColor,renderOccluded:a?4:16,renderGroup:3,isDecoration:!0});switch(e){case 0:m.width=v.lineHintWidthTarget,m.fadedExtensions={start:0,end:v.lineHintFadedExtensions};break;case 2:m.width=v.lineHintWidthReference,m.fadedExtensions={start:0,end:0};break;case 1:m.width=v.lineHintWidthReference,m.fadedExtensions={start:s?v.lineHintFadedExtensions:0,end:p?v.lineHintFadedExtensions:0}}return m.attached=!0,m}function S(e,i,n,t,l){const a=o();if(l){const n=t.overlayManager.spatialReference;r(e,i,a,n)}else s(e,i,n,t,a);return a}export{w 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.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import r from"../../../../core/Accessor.js";import{IdentifiableMixin as s}from"../../../../core/Identifiable.js";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";class i{constructor(e){this._resourceFactory=e,this._resources=null,this._visible=!0,this._attached=!1,this._renderGroup=2}destroy(){this._destroyResources()}get resources(){return this._resources?.external}get visible(){return this._visible}set visible(e){e!==this._visible&&(this._visible=e,this._syncGeometriesToRenderer())}get attached(){return this._attached}set attached(e){e!==this._attached&&(this._attached=e,this._createOrDestroyResources())}get renderGroup(){return this._renderGroup}set renderGroup(e){this._renderGroup=e;const r=this._resources?.layerView;r&&(r.renderGroup=e)}recreate(){this.attached&&this._createResources()}recreateGeometry(){this._resourceFactory.recreateGeometry?null!=this._resources&&(this._ensureRenderGeometriesRemoved(),this._resourceFactory.recreateGeometry(this._resources.external),this._syncGeometriesToRenderer()):this.recreate()}forEachMaterial(e){this._resources&&this._resourceFactory.forEachMaterial(this._resources.external,e)}_createOrDestroyResources(){this._attached?null==this._resources&&this._createResources():this._destroyResources()}_createResources(){this._destroyResources();const e=this._resourceFactory.createResources(),r=new c({view:this._resourceFactory.view,renderGroup:this._renderGroup}),s=this._resourceFactory.view.basemapTerrain?.overlayManager;this._resources={layerView:r,external:e,geometriesAdded:!1},s&&(this._resources.drapeSourceRenderer=s.registerGeometryDrapeSource(r)),this._syncGeometriesToRenderer()}_destroyResources(){if(null==this._resources)return;this._ensureRenderGeometriesRemoved();const e=this._resourceFactory.view.basemapTerrain?.overlayManager;e&&e.unregisterDrapeSource(this._resources.layerView),this._resourceFactory.destroyResources(this._resources.external),this._resources=null}_syncGeometriesToRenderer(){this._visible?this._ensureRenderGeometriesAdded():this._ensureRenderGeometriesRemoved()}_ensureRenderGeometriesRemoved(){if(null==this._resources?.drapeSourceRenderer)return;if(!this._resources.geometriesAdded)return;this._resources.drapeSourceRenderer.removeGeometries(this._resources.external.geometries,1),this._resources.geometriesAdded=!1}_ensureRenderGeometriesAdded(){if(null==this._resources?.drapeSourceRenderer)return;if(this._resources.geometriesAdded)return;this._resources.drapeSourceRenderer.addGeometries(this._resources.external.geometries,1),this._resources.geometriesAdded=!0}}let c=class extends(s(r)){constructor(e){super(e),this.drapeSourceType=1,this.updatePolicy=1,this.renderGroup=2}};e([t({constructOnly:!0})],c.prototype,"view",void 0),e([t({readOnly:!0})],c.prototype,"drapeSourceType",void 0),e([t()],c.prototype,"renderGroup",void 0),c=e([o("esri.views.3d.interactive.visualElements.DrapedVisualElementResources")],c);export{i as DrapedVisualElementResources};
5
+ import{__decorate as e}from"tslib";import r from"../../../../core/Accessor.js";import{IdentifiableMixin as s}from"../../../../core/Identifiable.js";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";class i{constructor(e){this._resourceFactory=e,this._resources=null,this._visible=!0,this._attached=!1,this._renderGroup=2}destroy(){this._destroyResources()}get resources(){return this._resources?.external}get visible(){return this._visible}set visible(e){e!==this._visible&&(this._visible=e,this._syncGeometriesToRenderer())}get attached(){return this._attached}set attached(e){e!==this._attached&&(this._attached=e,this._createOrDestroyResources())}get renderGroup(){return this._renderGroup}set renderGroup(e){this._renderGroup=e;const r=this._resources?.layerView;r&&(r.renderGroup=e)}recreate(){this.attached&&this._createResources()}recreateGeometry(){this._resourceFactory.recreateGeometry?null!=this._resources&&(this._ensureRenderGeometriesRemoved(),this._resourceFactory.recreateGeometry(this._resources.external),this._syncGeometriesToRenderer()):this.recreate()}forEachMaterial(e){this._resources&&this._resourceFactory.forEachMaterial(this._resources.external,e)}_createOrDestroyResources(){this._attached?null==this._resources&&this._createResources():this._destroyResources()}_createResources(){this._destroyResources();const e=this._resourceFactory.createResources(),r=new c({view:this._resourceFactory.view,renderGroup:this._renderGroup}),s=this._resourceFactory.view.overlayManager;this._resources={layerView:r,external:e,geometriesAdded:!1},s&&(this._resources.drapeSourceRenderer=s.registerGeometryDrapeSource(r)),this._syncGeometriesToRenderer()}_destroyResources(){if(null==this._resources)return;this._ensureRenderGeometriesRemoved();const e=this._resourceFactory.view.overlayManager;e&&e.unregisterDrapeSource(this._resources.layerView),this._resourceFactory.destroyResources(this._resources.external),this._resources=null}_syncGeometriesToRenderer(){this._visible?this._ensureRenderGeometriesAdded():this._ensureRenderGeometriesRemoved()}_ensureRenderGeometriesRemoved(){if(null==this._resources?.drapeSourceRenderer)return;if(!this._resources.geometriesAdded)return;this._resources.drapeSourceRenderer.removeGeometries(this._resources.external.geometries,1),this._resources.geometriesAdded=!1}_ensureRenderGeometriesAdded(){if(null==this._resources?.drapeSourceRenderer)return;if(this._resources.geometriesAdded)return;this._resources.drapeSourceRenderer.addGeometries(this._resources.external.geometries,1),this._resources.geometriesAdded=!0}}let c=class extends(s(r)){constructor(e){super(e),this.drapeSourceType=1,this.updatePolicy=1,this.renderGroup=2}};e([t({constructOnly:!0})],c.prototype,"view",void 0),e([t({readOnly:!0})],c.prototype,"drapeSourceType",void 0),e([t()],c.prototype,"renderGroup",void 0),c=e([o("esri.views.3d.interactive.visualElements.DrapedVisualElementResources")],c);export{i as DrapedVisualElementResources};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../Color.js";import e from"../../../../core/Handles.js";import{watch as o}from"../../../../core/reactiveUtils.js";import{createScreenPointArray as i,createRenderScreenPointArray as s,createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{add as a,set as n,scale as h,negate as l,normalize as c,length as _}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{f as m}from"../../../../chunks/vec32.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{renderScreenSpaceTangent as d}from"../support/viewUtils.js";import{VisualElement as p}from"./VisualElement.js";import x from"../../../overlay/LineOverlayItem.js";import b from"../../../overlay/TextOverlayItem.js";class f extends p{constructor(o){super(o),this._handles=new e,this._textItem=null,this._calloutItem=null,this._showCallout=!0,this._showText=!0,this._geometry=null,this._text="-",this._fontSize=14,this._backgroundColor=new t([0,0,0,.6]),this._calloutColor=new t([0,0,0,.5]),this._textColor=new t([255,255,255]),this._distance=25,this._anchor="right",this.updatePositionOnCameraMove=!0,this.applyProperties(o)}get geometry(){return this._geometry}set geometry(t){this._geometry=t,this.updateLabelPosition()}get isDecoration(){return this._isDecoration}set isDecoration(t){this._isDecoration=t,this._textItem&&(this._textItem.isDecoration=t),this._calloutItem&&(this._calloutItem.isDecoration=t)}get textItem(){return this._textItem}get text(){return this._text}set text(t){this._text=t,this.attached&&(this._textItem.text=this._text)}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize=t,this.attached&&(this._textItem.fontSize=this._fontSize)}get backgroundColor(){return this._backgroundColor}set backgroundColor(t){this._backgroundColor=t,this.attached&&(this._textItem.backgroundColor=this._backgroundColor)}get calloutColor(){return this._calloutColor}set calloutColor(t){this._calloutColor=t,this.attached&&(this._calloutItem.color=this._calloutColor.toRgba())}get textColor(){return this._textColor}set textColor(t){this._textColor=t,this.attached&&(this._textItem.textColor=this._textColor)}get distance(){return this._distance}set distance(t){this._distance!==t&&(this._distance=t,this.updateLabelPosition())}get anchor(){return this._anchor}set anchor(t){this._anchor!==t&&(this._anchor=t,this.updateLabelPosition())}get _camera(){return this.view.state.cssCamera}overlaps(t){return!!this.attached&&(this.textItem.visible&&t.textItem.visible&&!!this.view.overlay?.overlaps(this._textItem,t.textItem))}updateLabelPosition(){if(!this.attached)return;this._showText=!1,this._showCallout=!1;const{geometry:t,view:e,visible:o}=this;if(null!=t&&e.stage)switch(t.type){case"point":if(!this._computeLabelPositionFromPoint(t.point,L))break;if(t.callout){const e=this._camera,o=t.callout.distance;a(j,j,[0,t.callout.offset]),e.renderToScreen(j,L),n(P,0,1),h(P,P,o),a(P,P,j),e.renderToScreen(P,D),this._showCallout=this._updatePosition(L,D)}else this._textItem.position=[L[0],L[1]],this._textItem.anchor="center";this._showText=!0;break;case"corner":if(!this._computeLabelPositionFromCorner(t,this._distance,L,D))break;this._showCallout=this._updatePosition(L,D),this._showText=!0;break;case"segment":{if(!this._computeLabelPositionFromSegment(t,this._distance,this._anchor,L,D))break;this._showText=!0;const e=this._updatePosition(L,D);this._showCallout=!1!==t.callout&&e,this._showCallout||(this._textItem.anchor="center")}}this.updateVisibility(o)}_computeLabelPositionFromPoint(t,e){const o=this._camera,i=o.projectToRenderScreen(t,T);return!!i&&(!(i[2]<0||i[2]>1)&&(o.renderToScreen(i,e),!0))}_computeLabelPositionFromCorner(t,e,o,i){if(!t)return!1;const s=this._camera,r=g(t.left,1,s,S),n=g(t.right,0,s,y);if(null==r||null==n)return!1;l(S,S),a(P,r,n),l(P,P),c(P,P);const _=s.projectToRenderScreen(t.left.endRenderSpace,T);return!(!_||_[2]<0||_[2]>1)&&(s.renderToScreen(_,o),h(P,P,e),a(P,P,_),s.renderToScreen(P,i),!0)}_computeLabelPositionFromSegment(t,e,o,i,s){if(!t)return!1;const r=t.segment,c=this._camera;d(r.startRenderSpace,r.endRenderSpace,c,S),n(P,-S[1],S[0]);let m=!1;switch(o){case"top":m=P[1]<0;break;case"bottom":m=P[1]>0;break;case"left":m=P[0]>0;break;case"right":m=P[0]<0}if(m&&l(P,P),0===_(P))switch(o){case"top":P[1]=1;break;case"bottom":P[1]=-1;break;case"left":P[0]=-1;break;case"right":P[0]=1}r.eval(R[t.sampleLocation],k);const u=c.projectToRenderScreen(k,T);return!(!u||u[2]<0||u[2]>1)&&(c.renderToScreen(T,i),h(P,P,e),a(P,P,T),c.renderToScreen(P,s),!0)}_updatePosition(t,e){if(e){const o=e[0]-t[0],i=e[1]-t[1];return this._textItem.position=[e[0],e[1]],this._textItem.anchor=Math.abs(o)>Math.abs(i)?o>0?"left":"right":i>0?"top":"bottom",this._calloutItem.startPosition=[t[0],t[1]],this._calloutItem.endPosition=[e[0],e[1]],!0}return this._textItem.position=[t[0],t[1]],this._textItem.anchor="center",!1}createResources(){this._textItem=new b({visible:!0,text:this._text,fontSize:this._fontSize,backgroundColor:this._backgroundColor,textColor:this._textColor,isDecoration:this._isDecoration}),this._calloutItem=new x({color:this._calloutColor.toRgba(),visible:!0,width:2,isDecoration:this._isDecoration}),this.updateLabelPosition(),this.view.overlay?.items.addMany([this._textItem,this._calloutItem]),this.updatePositionOnCameraMove&&this._handles.add(o(()=>this.view.state.camera,()=>this.updateLabelPosition()))}destroyResources(){this.view.overlay&&!this.view.overlay.destroyed&&this.view.overlay.items.removeMany([this._textItem,this._calloutItem]),this._handles.removeAll()}updateVisibility(t){this._textItem.visible=this._showText&&t,this._calloutItem.visible=this._showCallout&&t}forEachMaterial(){}}function g(t,e,o,i){return t.eval(e,v,w),m(I,v,w),d(v,I,o,i)}function C(t){switch(t){case"top":return"bottom";case"right":return"left";case"bottom":return"top";case"left":return"right"}}const v=u(),I=u(),w=u(),S=s(),y=s(),P=s(),k=u(),T=r(),j=s(),L=i(),D=i(),R={start:0,center:.5,end:1};export{f as LabelVisualElement,C as mirrorPosition};
5
+ import t from"../../../../Color.js";import e from"../../../../core/Handles.js";import{watch as o}from"../../../../core/reactiveUtils.js";import{createScreenPointArray as i,createRenderScreenPointArray as s,createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{add as a,set as n,scale as h,negate as l,normalize as c,length as _}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{f as m}from"../../../../chunks/vec32.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{renderScreenSpaceTangent as d}from"../support/viewUtils.js";import{VisualElement as p}from"./VisualElement.js";import x from"../../../overlay/LineOverlayItem.js";import b from"../../../overlay/TextOverlayItem.js";class f extends p{constructor(o){super(o),this._handles=new e,this._textItem=null,this._calloutItem=null,this._showCallout=!0,this._showText=!0,this._geometry=null,this._text="-",this._fontSize=14,this._backgroundColor=new t([0,0,0,.6]),this._calloutColor=new t([0,0,0,.5]),this._textColor=new t([255,255,255]),this._distance=25,this._anchor="right",this.updatePositionOnCameraMove=!0,this.applyProperties(o)}get geometry(){return this._geometry}set geometry(t){this._geometry=t,this.updateLabelPosition()}get isDecoration(){return this._isDecoration}set isDecoration(t){this._isDecoration=t,this._textItem&&(this._textItem.isDecoration=t),this._calloutItem&&(this._calloutItem.isDecoration=t)}get textItem(){return this._textItem}get text(){return this._text}set text(t){this._text=t,this.attached&&(this._textItem.text=this._text)}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize=t,this.attached&&(this._textItem.fontSize=this._fontSize)}get backgroundColor(){return this._backgroundColor}set backgroundColor(t){this._backgroundColor=t,this.attached&&(this._textItem.backgroundColor=this._backgroundColor)}get calloutColor(){return this._calloutColor}set calloutColor(t){this._calloutColor=t,this.attached&&(this._calloutItem.color=this._calloutColor.toRgba())}get textColor(){return this._textColor}set textColor(t){this._textColor=t,this.attached&&(this._textItem.textColor=this._textColor)}get distance(){return this._distance}set distance(t){this._distance!==t&&(this._distance=t,this.updateLabelPosition())}get anchor(){return this._anchor}set anchor(t){this._anchor!==t&&(this._anchor=t,this.updateLabelPosition())}get _camera(){return this.view.state.cssCamera}overlaps(t){return!!this.attached&&(this.textItem.visible&&t.textItem.visible&&!!this.view.overlay?.overlaps(this._textItem,t.textItem))}updateLabelPosition(){if(!this.attached)return;this._showText=!1,this._showCallout=!1;const{geometry:t,view:e,visible:o}=this;if(null!=t&&e.stage)switch(t.type){case"point":if(!this._computeLabelPositionFromPoint(t.point,L))break;if(t.callout){const e=this._camera,o=t.callout.distance;a(j,j,[0,t.callout.offset]),e.renderToScreen(j,L),n(P,0,1),h(P,P,o),a(P,P,j),e.renderToScreen(P,D),this._showCallout=this._updatePosition(L,D)}else this._textItem.position=[L[0],L[1]],this._textItem.anchor="center";this._showText=!0;break;case"corner":if(!this._computeLabelPositionFromCorner(t,this._distance,L,D))break;this._showCallout=this._updatePosition(L,D),this._showText=!0;break;case"segment":{if(!this._computeLabelPositionFromSegment(t,this._distance,this._anchor,L,D))break;this._showText=!0;const e=this._updatePosition(L,D);this._showCallout=!1!==t.callout&&e,this._showCallout||(this._textItem.anchor="center")}}this.updateVisibility(o)}_computeLabelPositionFromPoint(t,e){const o=this._camera,i=o.projectToRenderScreen(t,j);return!!i&&(!(i[2]<0||i[2]>1)&&(o.renderToScreen(i,e),!0))}_computeLabelPositionFromCorner(t,e,o,i){if(!t)return!1;const s=this._camera,r=g(t.left,1,s,S),n=g(t.right,0,s,y);if(null==r||null==n)return!1;l(S,S),a(P,r,n),l(P,P),c(P,P);const _=s.projectToRenderScreen(t.left.endRenderSpace,T);return!(!_||_[2]<0||_[2]>1)&&(s.renderToScreen(_,o),h(P,P,e),a(P,P,_),s.renderToScreen(P,i),!0)}_computeLabelPositionFromSegment(t,e,o,i,s){if(!t)return!1;const r=t.segment,c=this._camera;d(r.startRenderSpace,r.endRenderSpace,c,S),n(P,-S[1],S[0]);let m=!1;switch(o){case"top":m=P[1]<0;break;case"bottom":m=P[1]>0;break;case"left":m=P[0]>0;break;case"right":m=P[0]<0}if(m&&l(P,P),0===_(P))switch(o){case"top":P[1]=1;break;case"bottom":P[1]=-1;break;case"left":P[0]=-1;break;case"right":P[0]=1}r.eval(R[t.sampleLocation],k);const u=c.projectToRenderScreen(k,T);return!(!u||u[2]<0||u[2]>1)&&(c.renderToScreen(T,i),h(P,P,e),a(P,P,T),c.renderToScreen(P,s),!0)}_updatePosition(t,e){if(e){const o=e[0]-t[0],i=e[1]-t[1];return this._textItem.position=[e[0],e[1]],this._textItem.anchor=Math.abs(o)>Math.abs(i)?o>0?"left":"right":i>0?"top":"bottom",this._calloutItem.startPosition=[t[0],t[1]],this._calloutItem.endPosition=[e[0],e[1]],!0}return this._textItem.position=[t[0],t[1]],this._textItem.anchor="center",!1}createResources(){this._textItem=new b({visible:!0,text:this._text,fontSize:this._fontSize,backgroundColor:this._backgroundColor,textColor:this._textColor,isDecoration:this._isDecoration}),this._calloutItem=new x({color:this._calloutColor.toRgba(),visible:!0,width:2,isDecoration:this._isDecoration}),this.updateLabelPosition(),this.view.overlay?.items.addMany([this._textItem,this._calloutItem]),this.updatePositionOnCameraMove&&this._handles.add(o(()=>this.view.state.camera,()=>this.updateLabelPosition()))}destroyResources(){this.view.overlay&&!this.view.overlay.destroyed&&this.view.overlay.items.removeMany([this._textItem,this._calloutItem]),this._handles.removeAll()}updateVisibility(t){this._textItem.visible=this._showText&&t,this._calloutItem.visible=this._showCallout&&t}forEachMaterial(){}}function g(t,e,o,i){return t.eval(e,v,w),m(I,v,w),d(v,I,o,i)}function C(t){switch(t){case"top":return"bottom";case"right":return"left";case"bottom":return"top";case"left":return"right"}}const v=u(),I=u(),w=u(),S=s(),y=s(),P=s(),k=u(),T=r(),j=s(),L=i(),D=i(),R={start:0,center:.5,end:1};export{f as LabelVisualElement,C as mirrorPosition};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{watch as e}from"../../../../core/reactiveUtils.js";import{createScreenPointArray as t,castScreenPointArray as r}from"../../../../core/screenUtils.js";import{normalize as i,subtract as s,scale as o,set as a,add as c}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{q as d,c as h,n as l,d as m,f as u}from"../../../../chunks/vec32.js";import{create as p,fromValues as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as f,d as g}from"../../../../chunks/vec42.js";import{fromValues as b}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeDehydratedPoint as y}from"../../../../layers/graphics/dehydratedPoint.js";import{EngineVisualElement as j}from"./EngineVisualElement.js";import{drapedZ as D}from"../../terrain/OverlayRenderer.js";import{createPolylineGeometry as G}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as w}from"../../webgl-engine/lib/RenderGeometry.js";import{RibbonLineMaterial as R}from"../../webgl-engine/materials/RibbonLineMaterial.js";class O extends j{constructor(e){super(e),this._location=p(),this._direction=_(1,0,0),this._width=1,this._offset=1,this._length=18,this._color=b(1,0,1,1),this._renderOccluded=4,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:V,recreateGeometry:(e,t)=>this._recreateObject3DGeometry(e,t),cameraChanged:()=>this._updateGeometry(),forEachMaterial:(e,t)=>t(e.material)}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:M,recreateGeometry:e=>this._recreateDrapedGeometry(e),forEachMaterial:(e,t)=>t(e.material)}}get location(){return this._location}set location(e){d(this._location,e)||(h(this._location,e),this._updateGeometry())}get direction(){return this._direction}set direction(e){d(this._direction,e)||(h(this._direction,e),this._updateGeometry())}setDirectionFromPoints(e,t){l(this._direction,m(this._direction,t,e)),this._updateGeometry()}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get offset(){return this._offset}set offset(e){e!==this._offset&&(this._offset=e,this._updateGeometry())}get length(){return this._length}set length(e){e!==this._length&&(this._length=e,this._updateGeometry())}get color(){return this._color}set color(e){f(e,this._color)||(g(this._color,e),this._updateMaterial())}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get isDecoration(){return this._isDecoration}set isDecoration(e){this._isDecoration=e,this._updateMaterial()}_createObject3DResources(e){const t=new R(this.materialParameters,this.view.state.isGlobal),r=new Array;return this._createObject3DGeometry(t,e,r),{material:t,geometries:r}}_recreateObject3DGeometry(e,t){e.geometries.length=0,this._createObject3DGeometry(e.material,t,e.geometries)}_createObject3DGeometry(e,t,r){const[i,s]=v(e);t.addGeometry(i),t.addGeometry(s),r.push(i),r.push(s),this._updateVerticesObject3D(t)}_createDrapedResources(){const t=new R(this.materialParameters,this.view.state.isGlobal),r=e(()=>this.view.state.contentPixelRatio,()=>this.drapedResources.recreateGeometry());return{material:t,geometries:this._createDrapedGeometry(t),pixelRatioHandle:r}}_recreateDrapedGeometry(e){e.geometries=this._createDrapedGeometry(e.material)}_createDrapedGeometry(e){const t=v(e);return this._updateVerticesDraped(t),t.map(e=>new w(e))}_updateMaterial(){const{materialParameters:e}=this;this.object3dResources.resources?.material.setParameters(e),this.drapedResources.resources?.material.setParameters(e)}get materialParameters(){return{width:this._width,color:this._color,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration}}_updateGeometry(){if(this.isDraped)this.drapedResources.recreateGeometry();else{const e=this.object3dResources.object;e&&this._updateVerticesObject3D(e)}}_updateVerticesObject3D(e){const t=this.view.state.camera;t.projectToScreen(this.location,U),u(P,this.location,this.direction),t.projectToScreen(P,E),i(E,s(E,E,U)),this._updateVertexAttributesObject3D(t,e,0,U,E,1),this._updateVertexAttributesObject3D(t,e,1,U,E,-1)}_updateVertexAttributesObject3D(e,t,i,s,o,a){const c=t.geometries[i],n=c.getMutableAttribute("position")?.data;if(!n)return;const{start:d,end:h}=x(o,s,a,this.offset,this.width,this.length);e.unprojectFromScreen(r(d),P),n[0]=P[0],n[1]=P[1],n[2]=P[2],e.unprojectFromScreen(r(h),P),n[3]=P[0],n[4]=P[1],n[5]=P[2],t.geometryVertexAttributeUpdated(c,"position")}_updateVerticesDraped(e){const{view:{basemapTerrain:{overlayManager:t},state:{contentPixelRatio:r}}}=this,{location:i,width:s,length:o,offset:a}=this,c=T;c.spatialReference=t.renderer.spatialReference,c.x=i[0],c.y=i[1];const n=this.view.overlayPixelSizeInMapUnits(c)*r,d=s*n,h=o*n,l=a*n;this._updateVertexAttributesDraped(e[0],d,h,l,-1),this._updateVertexAttributesDraped(e[1],d,h,l,1)}_updateVertexAttributesDraped(e,t,r,i,s){const o=e.getMutableAttribute("position")?.data;if(!o)return;const{location:a,direction:c}=this,{start:n,end:d}=x(c,a,s,i,t,r);o[0]=n[0],o[1]=n[1],o[2]=D,o[3]=d[0],o[4]=d[1],o[5]=D,e.invalidateBoundingInfo()}}function v(e){return[G(e,[p(),p()]),G(e,[p(),p()])]}function x(e,t,r,i,s,n){const d=o(A,a(A,e[1]*r,e[0]*-r),i+s/2),h=c(F,c(F,c(F,t,o(F,e,n/2)),d),d);return{start:h,end:c(S,h,o(S,e,-n))}}function V(e){e.geometries.length=0}function M(e){e.pixelRatioHandle.remove(),e.geometries=[]}const P=p(),A=n(),F=n(),S=n(),U=t(),E=t(),T=y(0,0,void 0,null);export{O as ParallelLineVisualElement};
5
+ import{watch as e}from"../../../../core/reactiveUtils.js";import{createScreenPointArray as t,castScreenPointArray as r}from"../../../../core/screenUtils.js";import{normalize as i,subtract as s,scale as o,set as a,add as c}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{q as d,c as h,n as l,d as m,f as u}from"../../../../chunks/vec32.js";import{create as p,fromValues as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as f,d as g}from"../../../../chunks/vec42.js";import{fromValues as b}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeDehydratedPoint as y}from"../../../../layers/graphics/dehydratedPoint.js";import{EngineVisualElement as j}from"./EngineVisualElement.js";import{drapedZ as D}from"../../terrain/OverlayRenderer.js";import{createPolylineGeometry as G}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as w}from"../../webgl-engine/lib/RenderGeometry.js";import{RibbonLineMaterial as R}from"../../webgl-engine/materials/RibbonLineMaterial.js";class O extends j{constructor(e){super(e),this._location=p(),this._direction=_(1,0,0),this._width=1,this._offset=1,this._length=18,this._color=b(1,0,1,1),this._renderOccluded=4,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:V,recreateGeometry:(e,t)=>this._recreateObject3DGeometry(e,t),cameraChanged:()=>this._updateGeometry(),forEachMaterial:(e,t)=>t(e.material)}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:M,recreateGeometry:e=>this._recreateDrapedGeometry(e),forEachMaterial:(e,t)=>t(e.material)}}get location(){return this._location}set location(e){d(this._location,e)||(h(this._location,e),this._updateGeometry())}get direction(){return this._direction}set direction(e){d(this._direction,e)||(h(this._direction,e),this._updateGeometry())}setDirectionFromPoints(e,t){l(this._direction,m(this._direction,t,e)),this._updateGeometry()}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get offset(){return this._offset}set offset(e){e!==this._offset&&(this._offset=e,this._updateGeometry())}get length(){return this._length}set length(e){e!==this._length&&(this._length=e,this._updateGeometry())}get color(){return this._color}set color(e){f(e,this._color)||(g(this._color,e),this._updateMaterial())}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get isDecoration(){return this._isDecoration}set isDecoration(e){this._isDecoration=e,this._updateMaterial()}_createObject3DResources(e){const t=new R(this.materialParameters,this.view.state.isGlobal),r=new Array;return this._createObject3DGeometry(t,e,r),{material:t,geometries:r}}_recreateObject3DGeometry(e,t){e.geometries.length=0,this._createObject3DGeometry(e.material,t,e.geometries)}_createObject3DGeometry(e,t,r){const[i,s]=v(e);t.addGeometry(i),t.addGeometry(s),r.push(i),r.push(s),this._updateVerticesObject3D(t)}_createDrapedResources(){const t=new R(this.materialParameters,this.view.state.isGlobal),r=e(()=>this.view.state.contentPixelRatio,()=>this.drapedResources.recreateGeometry());return{material:t,geometries:this._createDrapedGeometry(t),pixelRatioHandle:r}}_recreateDrapedGeometry(e){e.geometries=this._createDrapedGeometry(e.material)}_createDrapedGeometry(e){const t=v(e);return this._updateVerticesDraped(t),t.map(e=>new w(e))}_updateMaterial(){const{materialParameters:e}=this;this.object3dResources.resources?.material.setParameters(e),this.drapedResources.resources?.material.setParameters(e)}get materialParameters(){return{width:this._width,color:this._color,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration}}_updateGeometry(){if(this.isDraped)this.drapedResources.recreateGeometry();else{const e=this.object3dResources.object;e&&this._updateVerticesObject3D(e)}}_updateVerticesObject3D(e){const t=this.view.state.camera;t.projectToScreen(this.location,U),u(P,this.location,this.direction),t.projectToScreen(P,E),i(E,s(E,E,U)),this._updateVertexAttributesObject3D(t,e,0,U,E,1),this._updateVertexAttributesObject3D(t,e,1,U,E,-1)}_updateVertexAttributesObject3D(e,t,i,s,o,a){const c=t.geometries[i],n=c.getMutableAttribute("position")?.data;if(!n)return;const{start:d,end:h}=x(o,s,a,this.offset,this.width,this.length);e.unprojectFromScreen(r(d),P),n[0]=P[0],n[1]=P[1],n[2]=P[2],e.unprojectFromScreen(r(h),P),n[3]=P[0],n[4]=P[1],n[5]=P[2],t.geometryVertexAttributeUpdated(c,"position")}_updateVerticesDraped(e){const{view:{overlayManager:t,state:{contentPixelRatio:r}}}=this,{location:i,width:s,length:o,offset:a}=this,c=k;c.spatialReference=t.spatialReference,c.x=i[0],c.y=i[1];const n=this.view.overlayPixelSizeInMapUnits(c)*r,d=s*n,h=o*n,l=a*n;this._updateVertexAttributesDraped(e[0],d,h,l,-1),this._updateVertexAttributesDraped(e[1],d,h,l,1)}_updateVertexAttributesDraped(e,t,r,i,s){const o=e.getMutableAttribute("position")?.data;if(!o)return;const{location:a,direction:c}=this,{start:n,end:d}=x(c,a,s,i,t,r);o[0]=n[0],o[1]=n[1],o[2]=D,o[3]=d[0],o[4]=d[1],o[5]=D,e.invalidateBoundingInfo()}}function v(e){return[G(e,[p(),p()]),G(e,[p(),p()])]}function x(e,t,r,i,s,n){const d=o(A,a(A,e[1]*r,e[0]*-r),i+s/2),h=c(F,c(F,c(F,t,o(F,e,n/2)),d),d);return{start:h,end:c(S,h,o(S,e,-n))}}function V(e){e.geometries.length=0}function M(e){e.pixelRatioHandle.remove(),e.geometries=[]}const P=p(),A=n(),F=n(),S=n(),U=t(),E=t(),k=y(0,0,void 0,null);export{O as ParallelLineVisualElement};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{watch as e}from"../../../../core/reactiveUtils.js";import{fromTranslation as t,scale as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{j as s,n as a,d as o,c as n,q as c,f as l}from"../../../../chunks/vec32.js";import{create as u,ZEROS as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{d}from"../../../../chunks/vec42.js";import{fromValues as m}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{sv3d as _}from"../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as p}from"../../../../layers/graphics/dehydratedPoint.js";import{EngineVisualElement as f}from"./EngineVisualElement.js";import{drapedZ as g}from"../../terrain/OverlayRenderer.js";import{Attribute as M}from"../../webgl-engine/lib/Attribute.js";import{Geometry as b}from"../../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as R}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as j}from"../../webgl-engine/lib/RenderGeometry.js";import{ColorMaterial as O}from"../../webgl-engine/materials/ColorMaterial.js";import{RibbonLineMaterial as D}from"../../webgl-engine/materials/RibbonLineMaterial.js";class w extends f{constructor(e){super(e),this._maxSize=0,this._position=u(),this._up=u(),this._right=u(),this._renderOccluded=4,this._color=m(1,0,0,1),this._outlineColor=m(0,0,0,1),this._outlineSize=0,this._size=32,this._outlineRenderOccluded=16,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:()=>{},cameraChanged:()=>this._updateTransformObject3D(),forEachMaterial:(e,t)=>{t(e.outlineMaterial),t(e.quadMaterial)}}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:z,forEachMaterial:(e,t)=>{t(e.outlineMaterial),t(e.quadMaterial)}}}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateQuadMaterial())}get isDecoration(){return this._isDecoration}set isDecoration(e){this._isDecoration=e,this._updateOutlineMaterial(),this._updateQuadMaterial()}get color(){return this._color}set color(e){d(this._color,e),this._updateQuadMaterial()}get outlineColor(){return this._outlineColor}set outlineColor(e){d(this._outlineColor,e),this._updateOutlineMaterial()}get outlineSize(){return this._outlineSize}set outlineSize(e){const t=0===this._outlineSize!=(0===e);this._outlineSize=e,t?this.recreateGeometry():this._updateOutlineMaterial()}get size(){return this._size}set size(e){e!==this._size&&(this._size=e,this._updateTransform())}get outlineRenderOccluded(){return this._outlineRenderOccluded}set outlineRenderOccluded(e){this._outlineRenderOccluded=e,this._updateOutlineMaterial()}set geometry({previous:e,center:t,next:r}){this._maxSize=Math.min(s(t,e),s(t,r))/3,a(this._up,o(this._up,e,t)),a(this._right,o(this._right,r,t)),n(this._position,t),this.recreateGeometry()}_createObject3DResources(e){const t=new O(this._quadMaterialParameters),r=0===this._outlineSize?void 0:new D(this._outlineMaterialParameters,this.view.state.isGlobal);return this._createObject3DGeometries(e,t,r),{quadMaterial:t,outlineMaterial:r}}_createObject3DGeometries(e,t,r){if(c(this._up,h)&&c(this._right,h))return;const i=this._createGeometries(t,r);for(const s of i)e.addGeometry(s);this._updateTransformObject3D(e)}_createDrapedResources(){const t=new O(this._quadMaterialParameters),r=0===this._outlineSize?void 0:new D(this._outlineMaterialParameters,this.view.state.isGlobal),i=this._createGeometries(t,r).map(e=>new j(e));this._setTransformDraped(i);return{quadMaterial:t,outlineMaterial:r,geometries:i,pixelRatioHandle:e(()=>this.view.state.contentPixelRatio,()=>this.drapedResources.recreateGeometry())}}_createGeometries(e,t){const{up:r,right:i,corner:s}=this._getVertices(),a=v(r,i,s,e);if(!t)return[a];return[a,R(t,[r,s,i])]}_getVertices(){let e=this._up,t=this._right;const r=l(_.get(),e,t);return this.isDraped&&(e=n(_.get(),e),t=n(_.get(),t),e[2]=0,t[2]=0,r[2]=0),{up:e,right:t,corner:r}}_updateTransform(){this.isDraped?this.drapedResources.recreateGeometry():this._updateTransformObject3D()}_updateTransformObject3D(e=this.object3dResources.object){if(!e)return;const i=this.view.state.camera,s=this._size*i.computeScreenPixelSizeAt(this._position),a=Math.min(this._maxSize,s);t(y,this._position),r(y,y,[a,a,a]),e.transformation=y}_setTransformDraped(e){if(0===e.length)return;const{view:{basemapTerrain:{overlayManager:i},state:{contentPixelRatio:s}}}=this,{_position:a,_size:o}=this,c=n(_.get(),a);c[2]=g;const l=P;l.spatialReference=i.renderer.spatialReference,l.x=c[0],l.y=c[1];const u=o*(this.view.overlayPixelSizeInMapUnits(l)*s),h=Math.min(this._maxSize,u);t(y,c),r(y,y,[h,h,1]);for(const t of e)t.transformation=y}get _quadMaterialParameters(){return{color:this._color,forceTransparentMode:!0,writeDepth:!1,polygonOffset:!0,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration}}_updateQuadMaterial(){this.object3dResources.resources?.quadMaterial.setParameters(this._quadMaterialParameters),this.drapedResources.resources?.quadMaterial.setParameters(this._quadMaterialParameters)}get _outlineMaterialParameters(){return{color:this._outlineColor,width:this._outlineSize,renderOccluded:this._outlineRenderOccluded,isDecoration:this.isDecoration}}_updateOutlineMaterial(){this.object3dResources.resources?.outlineMaterial?.setParameters(this._outlineMaterialParameters),this.drapedResources.resources?.outlineMaterial?.setParameters(this._outlineMaterialParameters)}}function z(e){e.pixelRatioHandle.remove(),e.geometries=[]}function v(e,t,r,i){return new b(i,[["position",new M([0,0,0,...t,...e,...r],[0,1,2,1,2,3],3,!0)]])}const y=i(),P=p(0,0,void 0,null);export{w as RightAngleQuadVisualElement};
5
+ import{watch as e}from"../../../../core/reactiveUtils.js";import{fromTranslation as t,scale as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{j as s,n as a,d as o,c as n,q as c,f as l}from"../../../../chunks/vec32.js";import{create as u,ZEROS as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{d}from"../../../../chunks/vec42.js";import{fromValues as m}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{sv3d as _}from"../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as p}from"../../../../layers/graphics/dehydratedPoint.js";import{EngineVisualElement as f}from"./EngineVisualElement.js";import{drapedZ as g}from"../../terrain/OverlayRenderer.js";import{Attribute as M}from"../../webgl-engine/lib/Attribute.js";import{Geometry as b}from"../../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as R}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as j}from"../../webgl-engine/lib/RenderGeometry.js";import{ColorMaterial as O}from"../../webgl-engine/materials/ColorMaterial.js";import{RibbonLineMaterial as D}from"../../webgl-engine/materials/RibbonLineMaterial.js";class w extends f{constructor(e){super(e),this._maxSize=0,this._position=u(),this._up=u(),this._right=u(),this._renderOccluded=4,this._color=m(1,0,0,1),this._outlineColor=m(0,0,0,1),this._outlineSize=0,this._size=32,this._outlineRenderOccluded=16,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:()=>{},cameraChanged:()=>this._updateTransformObject3D(),forEachMaterial:(e,t)=>{t(e.outlineMaterial),t(e.quadMaterial)}}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:z,forEachMaterial:(e,t)=>{t(e.outlineMaterial),t(e.quadMaterial)}}}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateQuadMaterial())}get isDecoration(){return this._isDecoration}set isDecoration(e){this._isDecoration=e,this._updateOutlineMaterial(),this._updateQuadMaterial()}get color(){return this._color}set color(e){d(this._color,e),this._updateQuadMaterial()}get outlineColor(){return this._outlineColor}set outlineColor(e){d(this._outlineColor,e),this._updateOutlineMaterial()}get outlineSize(){return this._outlineSize}set outlineSize(e){const t=0===this._outlineSize!=(0===e);this._outlineSize=e,t?this.recreateGeometry():this._updateOutlineMaterial()}get size(){return this._size}set size(e){e!==this._size&&(this._size=e,this._updateTransform())}get outlineRenderOccluded(){return this._outlineRenderOccluded}set outlineRenderOccluded(e){this._outlineRenderOccluded=e,this._updateOutlineMaterial()}set geometry({previous:e,center:t,next:r}){this._maxSize=Math.min(s(t,e),s(t,r))/3,a(this._up,o(this._up,e,t)),a(this._right,o(this._right,r,t)),n(this._position,t),this.recreateGeometry()}_createObject3DResources(e){const t=new O(this._quadMaterialParameters),r=0===this._outlineSize?void 0:new D(this._outlineMaterialParameters,this.view.state.isGlobal);return this._createObject3DGeometries(e,t,r),{quadMaterial:t,outlineMaterial:r}}_createObject3DGeometries(e,t,r){if(c(this._up,h)&&c(this._right,h))return;const i=this._createGeometries(t,r);for(const s of i)e.addGeometry(s);this._updateTransformObject3D(e)}_createDrapedResources(){const t=new O(this._quadMaterialParameters),r=0===this._outlineSize?void 0:new D(this._outlineMaterialParameters,this.view.state.isGlobal),i=this._createGeometries(t,r).map(e=>new j(e));this._setTransformDraped(i);return{quadMaterial:t,outlineMaterial:r,geometries:i,pixelRatioHandle:e(()=>this.view.state.contentPixelRatio,()=>this.drapedResources.recreateGeometry())}}_createGeometries(e,t){const{up:r,right:i,corner:s}=this._getVertices(),a=v(r,i,s,e);if(!t)return[a];return[a,R(t,[r,s,i])]}_getVertices(){let e=this._up,t=this._right;const r=l(_.get(),e,t);return this.isDraped&&(e=n(_.get(),e),t=n(_.get(),t),e[2]=0,t[2]=0,r[2]=0),{up:e,right:t,corner:r}}_updateTransform(){this.isDraped?this.drapedResources.recreateGeometry():this._updateTransformObject3D()}_updateTransformObject3D(e=this.object3dResources.object){if(!e)return;const i=this.view.state.camera,s=this._size*i.computeScreenPixelSizeAt(this._position),a=Math.min(this._maxSize,s);t(y,this._position),r(y,y,[a,a,a]),e.transformation=y}_setTransformDraped(e){if(0===e.length)return;const{view:{overlayManager:i,state:{contentPixelRatio:s}}}=this,{_position:a,_size:o}=this,c=n(_.get(),a);c[2]=g;const l=P;l.spatialReference=i.spatialReference,l.x=c[0],l.y=c[1];const u=o*(this.view.overlayPixelSizeInMapUnits(l)*s),h=Math.min(this._maxSize,u);t(y,c),r(y,y,[h,h,1]);for(const t of e)t.transformation=y}get _quadMaterialParameters(){return{color:this._color,forceTransparentMode:!0,writeDepth:!1,polygonOffset:!0,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration}}_updateQuadMaterial(){this.object3dResources.resources?.quadMaterial.setParameters(this._quadMaterialParameters),this.drapedResources.resources?.quadMaterial.setParameters(this._quadMaterialParameters)}get _outlineMaterialParameters(){return{color:this._outlineColor,width:this._outlineSize,renderOccluded:this._outlineRenderOccluded,isDecoration:this.isDecoration}}_updateOutlineMaterial(){this.object3dResources.resources?.outlineMaterial?.setParameters(this._outlineMaterialParameters),this.drapedResources.resources?.outlineMaterial?.setParameters(this._outlineMaterialParameters)}}function z(e){e.pixelRatioHandle.remove(),e.geometries=[]}function v(e,t,r,i){return new b(i,[["position",new M([0,0,0,...t,...e,...r],[0,1,2,1,2,3],3,!0)]])}const y=i(),P=p(0,0,void 0,null);export{w as RightAngleQuadVisualElement};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{forEach as t,result as r}from"../../../core/asyncUtils.js";import{makeHandle as i}from"../../../core/handleUtils.js";import a from"../../../core/Logger.js";import{abortMaybe as s}from"../../../core/maybe.js";import{isAbortError as o,onAbort as n,throwIfAborted as l,isAborted as h,createAbortError as m}from"../../../core/promiseUtils.js";import{whenOnce as d}from"../../../core/reactiveUtils.js";import{property as g}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import u from"../../../geometry/Extent.js";import{create as p,equals as x,width as y,height as f,copy as w,intersection as _}from"../../../geometry/support/aaBoundingRect.js";import b from"./SubView3D.js";import{computeImageExportSize as v,createGeometryForExtent as R,createOuterImageGeometry as S}from"./support/overlayImageUtils.js";import{debugFlags as j}from"../support/debugFlags.js";import{RenderGeometry as E}from"../webgl-engine/lib/RenderGeometry.js";import{Texture as M}from"../webgl-engine/lib/Texture.js";import{ImageMaterial as I}from"../webgl-engine/materials/ImageMaterial.js";let A=class extends b{constructor(e){super(e),this.drapeSourceType=0,this.updatePolicy=1,this.type="draped",this.maximumDataResolution=null,this._images=new Array,this._extents=new Array,this._overlays=new Array,this._drapeSourceRenderer=null}initialize(){this._drapeSourceRenderer=this.view.basemapTerrain.overlayManager.registerGeometryDrapeSource(this),this.addHandles(i(()=>this.view.basemapTerrain.overlayManager.unregisterDrapeSource(this)))}setDrapingExtent(e,t){this._spatialReference=t,e.forEach((e,t)=>{this._overlays[t]=e,this._updateImageExtent(e,t)})}destroy(){this.clear()}get spatialReference(){return this._spatialReference}_updateImageExtent(e,t){const r=this._clippedExtent(e.extent,G);if(null==r)return;const i=v(e.extent,r,e.resolution);let s=e.pixelRatio*this.view.state.pixelRatio;const{layer:n}=this;if("imageMaxWidth"in n&&null!=n.imageMaxWidth||"imageMaxHeight"in n&&null!=n.imageMaxHeight){const e=n.imageMaxWidth,t=n.imageMaxHeight;if(i.width>e){const t=e/i.width;i.height=Math.floor(i.height*t),i.width=e,s*=t}if(i.height>t){const e=t/i.height;i.width=Math.floor(i.width*e),i.height=t,s*=e}}const l=this._extents[t];l&&x(l.extent,r)&&this._imageSizeEquals(r,l.imageSize,i)||(this._extents[t]={extent:p(r),imageSize:i,pixelRatio:s},this.suspended||this._fetch(t).catch(e=>{o(e)||a.getLogger(this).error(e)}))}clear(){for(let e=0;e<this._images.length;e++)this._clearImage(e)}async doRefresh(e){const t=[];for(let r=0;r<this._extents.length;r++)this._extents[r]&&t.push(this._fetch(r,e));await Promise.allSettled(t)}async processResult(e,t,r){(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement)&&(e.image=t)}findExtentInfoAt(e){for(const t of this._extents){const r=t.extent;if(new u(r[0],r[1],r[2],r[3],this._spatialReference).contains(e))return t}return null}async redraw(e,r){await t(this._images,async(t,i)=>{t&&(await e(t,r),await this._createStageObjects(i,t.image,r))})}_imageSizeEquals(e,t,r){if(!this.maximumDataResolution)return!1;const i=y(e)/this.maximumDataResolution.x,a=f(e)/this.maximumDataResolution.y,s=i/t.width,o=a/t.height,n=i/r.width,l=a/r.height,h=Math.abs(s-n),m=Math.abs(o-l),d=j.TESTS_DISABLE_OPTIMIZATIONS?0:1.5;return h<=d&&m<=d}async _fetch(e,t){if(this.suspended)return;const r=this._extents[e],i=r.extent;this._images[e]||(this._images[e]={texture:null,material:null,renderGeometry:null,loadingPromise:null,loadingAbortController:null,image:null,pixelData:null,renderExtent:p(i)});const d=this._images[e];d.loadingAbortController=s(d.loadingAbortController);const g=new u(i[0],i[1],i[2],i[3],this._spatialReference);if(0===g.width||0===g.height)return void this._clearImage(e);const c=new AbortController;d.loadingAbortController=c,n(t,()=>c.abort());const x=c.signal,y=this._waitFetchReady(x).then(async()=>{l(x);const t={requestAsImageElement:!0,pixelRatio:this._overlays[e].pixelRatio,...this.layerView.getFetchOptions(),signal:x},{height:i,width:a}=r.imageSize;return this.layer?"imagery"===this.layer.type?this.layer.internalFetchImage(g,a,i,t):this.layer.fetchImage(g,a,i,t):null}).then(e=>{if(h(x))throw a.getLogger(this).warnOnce("A call to fetchImage resolved even though the request was aborted. fetchImage should not resolve if options.signal.aborted is true."),m();return this.processResult(d,e)}).then(()=>{w(d.renderExtent,i)});d.loadingPromise=y,await this.updatingHandles.addPromise(y.then(async()=>{l(x),await this._createStageObjects(e,d.image,x)}).catch(e=>{throw e&&!o(e)&&a.getLogger(this).error(e),e}).finally(()=>{y===d.loadingPromise&&(d.loadingPromise=null,d.loadingAbortController=null)}))}_clearImage(e){const t=this._images[e];if(t){null!=t.renderGeometry&&(this._drapeSourceRenderer.removeGeometries([t.renderGeometry],1),t.renderGeometry=null);const e=this.view.stage,r=t.texture;r?.unload(),e.removeTexture(r),t.texture=null,t.material=null,t.loadingAbortController=s(t.loadingAbortController),t.loadingPromise=null,t.image=null,t.pixelData=null}}async _createStageObjects(e,t,i){const a=this.view.stage,s=this._images[e],o=()=>{s.texture?.unload(),a.removeTexture(s.texture),s.texture=null,s.renderGeometry&&(this._drapeSourceRenderer.removeGeometries([s.renderGeometry],1),s.renderGeometry=null)};if(t){const n=new M(t,{width:t.width,height:t.height,preMultiplyAlpha:!0,wrap:{s:33071,t:33071}});if(await r(this._images[0===e?1:0].loadingPromise),l(i),o(),await a.schedule(()=>n.load(a.renderView.renderingContext),i),!n.loaded)return void o();let h;if(a.addTexture(n),s.texture=n,s.material??=new I({draped:!0,texture:n}),s.material.setParameters({texture:n}),0===e)h=R(s.material,s.renderExtent);else{const e=this._images[0].renderExtent;if(!e)return void o();h=S(s.material,e,s.renderExtent)}s.renderGeometry=new E(h),s.renderGeometry.localOrigin=this._overlays[e].renderLocalOrigin,this._drapeSourceRenderer.addGeometries([s.renderGeometry],1)}else o(),s.material=null}_clippedExtent(e,t){if("local"!==this.view.viewingMode)return w(t,e);const r=this.view.basemapTerrain;return r.ready?_(e,r.extent,t):w(t,e)}async _waitFetchReady(e){await d(()=>this.view.stationary,e),l(e)}get usedMemory(){return this._images.reduce((e,t)=>e+(t.texture?.usedMemory??0),0)}};e([g()],A.prototype,"type",void 0),A=e([c("esri.views.3d.layers.DrapedSubView3D")],A);const G=p();export{A as default};
5
+ import{__decorate as e}from"tslib";import{forEach as t,result as r}from"../../../core/asyncUtils.js";import{makeHandle as i}from"../../../core/handleUtils.js";import a from"../../../core/Logger.js";import{abortMaybe as s}from"../../../core/maybe.js";import{isAbortError as o,onAbort as n,throwIfAborted as l,isAborted as h,createAbortError as m}from"../../../core/promiseUtils.js";import{whenOnce as d}from"../../../core/reactiveUtils.js";import{property as g}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import u from"../../../geometry/Extent.js";import{create as p,equals as x,width as y,height as f,copy as w,intersection as _}from"../../../geometry/support/aaBoundingRect.js";import v from"./SubView3D.js";import{computeImageExportSize as b,createGeometryForExtent as R,createOuterImageGeometry as S}from"./support/overlayImageUtils.js";import{debugFlags as j}from"../support/debugFlags.js";import{RenderGeometry as E}from"../webgl-engine/lib/RenderGeometry.js";import{Texture as M}from"../webgl-engine/lib/Texture.js";import{ImageMaterial as I}from"../webgl-engine/materials/ImageMaterial.js";let A=class extends v{constructor(e){super(e),this.drapeSourceType=0,this.updatePolicy=1,this.type="draped",this.maximumDataResolution=null,this._images=new Array,this._extents=new Array,this._overlays=new Array,this._drapeSourceRenderer=null}initialize(){this._drapeSourceRenderer=this.view.overlayManager.registerGeometryDrapeSource(this),this.addHandles(i(()=>this.view.overlayManager.unregisterDrapeSource(this)))}setDrapingExtent(e,t){this._spatialReference=t,e.forEach((e,t)=>{this._overlays[t]=e,this._updateImageExtent(e,t)})}destroy(){this.clear()}get spatialReference(){return this._spatialReference}_updateImageExtent(e,t){const r=this._clippedExtent(e.extent,G);if(null==r)return;const i=b(e.extent,r,e.resolution);let s=e.pixelRatio*this.view.state.pixelRatio;const{layer:n}=this;if("imageMaxWidth"in n&&null!=n.imageMaxWidth||"imageMaxHeight"in n&&null!=n.imageMaxHeight){const e=n.imageMaxWidth,t=n.imageMaxHeight;if(i.width>e){const t=e/i.width;i.height=Math.floor(i.height*t),i.width=e,s*=t}if(i.height>t){const e=t/i.height;i.width=Math.floor(i.width*e),i.height=t,s*=e}}const l=this._extents[t];l&&x(l.extent,r)&&this._imageSizeEquals(r,l.imageSize,i)||(this._extents[t]={extent:p(r),imageSize:i,pixelRatio:s},this.suspended||this._fetch(t).catch(e=>{o(e)||a.getLogger(this).error(e)}))}clear(){for(let e=0;e<this._images.length;e++)this._clearImage(e)}async doRefresh(e){const t=[];for(let r=0;r<this._extents.length;r++)this._extents[r]&&t.push(this._fetch(r,e));await Promise.allSettled(t)}async processResult(e,t,r){(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement)&&(e.image=t)}findExtentInfoAt(e){for(const t of this._extents){const r=t.extent;if(new u(r[0],r[1],r[2],r[3],this._spatialReference).contains(e))return t}return null}async redraw(e,r){await t(this._images,async(t,i)=>{t&&(await e(t,r),await this._createStageObjects(i,t.image,r))})}_imageSizeEquals(e,t,r){if(!this.maximumDataResolution)return!1;const i=y(e)/this.maximumDataResolution.x,a=f(e)/this.maximumDataResolution.y,s=i/t.width,o=a/t.height,n=i/r.width,l=a/r.height,h=Math.abs(s-n),m=Math.abs(o-l),d=j.TESTS_DISABLE_OPTIMIZATIONS?0:1.5;return h<=d&&m<=d}async _fetch(e,t){if(this.suspended)return;const r=this._extents[e],i=r.extent;this._images[e]||(this._images[e]={texture:null,material:null,renderGeometry:null,loadingPromise:null,loadingAbortController:null,image:null,pixelData:null,renderExtent:p(i)});const d=this._images[e];d.loadingAbortController=s(d.loadingAbortController);const g=new u(i[0],i[1],i[2],i[3],this._spatialReference);if(0===g.width||0===g.height)return void this._clearImage(e);const c=new AbortController;d.loadingAbortController=c,n(t,()=>c.abort());const x=c.signal,y=this._waitFetchReady(x).then(async()=>{l(x);const t={requestAsImageElement:!0,pixelRatio:this._overlays[e].pixelRatio,...this.layerView.getFetchOptions(),signal:x},{height:i,width:a}=r.imageSize;return this.layer?"imagery"===this.layer.type?this.layer.internalFetchImage(g,a,i,t):this.layer.fetchImage(g,a,i,t):null}).then(e=>{if(h(x))throw a.getLogger(this).warnOnce("A call to fetchImage resolved even though the request was aborted. fetchImage should not resolve if options.signal.aborted is true."),m();return this.processResult(d,e)}).then(()=>{w(d.renderExtent,i)});d.loadingPromise=y,await this.updatingHandles.addPromise(y.then(async()=>{l(x),await this._createStageObjects(e,d.image,x)}).catch(e=>{throw e&&!o(e)&&a.getLogger(this).error(e),e}).finally(()=>{y===d.loadingPromise&&(d.loadingPromise=null,d.loadingAbortController=null)}))}_clearImage(e){const t=this._images[e];if(t){null!=t.renderGeometry&&(this._drapeSourceRenderer.removeGeometries([t.renderGeometry],1),t.renderGeometry=null);const e=this.view.stage,r=t.texture;r?.unload(),e.removeTexture(r),t.texture=null,t.material=null,t.loadingAbortController=s(t.loadingAbortController),t.loadingPromise=null,t.image=null,t.pixelData=null}}async _createStageObjects(e,t,i){const a=this.view.stage,s=this._images[e],o=()=>{s.texture?.unload(),a.removeTexture(s.texture),s.texture=null,s.renderGeometry&&(this._drapeSourceRenderer.removeGeometries([s.renderGeometry],1),s.renderGeometry=null)};if(t){const n=new M(t,{width:t.width,height:t.height,preMultiplyAlpha:!0,wrap:{s:33071,t:33071}});if(await r(this._images[0===e?1:0].loadingPromise),l(i),o(),await a.schedule(()=>n.load(a.renderView.renderingContext),i),!n.loaded)return void o();let h;if(a.addTexture(n),s.texture=n,s.material??=new I({draped:!0,texture:n}),s.material.setParameters({texture:n}),0===e)h=R(s.material,s.renderExtent);else{const e=this._images[0].renderExtent;if(!e)return void o();h=S(s.material,e,s.renderExtent)}s.renderGeometry=new E(h),s.renderGeometry.localOrigin=this._overlays[e].renderLocalOrigin,this._drapeSourceRenderer.addGeometries([s.renderGeometry],1)}else o(),s.material=null}_clippedExtent(e,t){if("local"!==this.view.viewingMode)return w(t,e);const r=this.view.basemapTerrain;return r.ready?_(e,r.extent,t):w(t,e)}async _waitFetchReady(e){await d(()=>this.view.stationary,e),l(e)}get usedMemory(){return this._images.reduce((e,t)=>e+(t.texture?.usedMemory??0),0)}};e([g()],A.prototype,"type",void 0),A=e([c("esri.views.3d.layers.DrapedSubView3D")],A);const G=p();export{A 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.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{equals as t}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{removeMaybe as i,abortMaybe as r}from"../../../core/maybe.js";import{debounce as s,ignoreAbortErrors as o,throwIfAborted as l}from"../../../core/promiseUtils.js";import{watch as a,when as n,sync as u,whenOnce as d}from"../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../core/scheduling.js";import{Seconds as h,secondsFromMilliseconds as c}from"../../../core/time.js";import{getMetersPerVerticalUnitForSR as m}from"../../../core/unitUtils.js";import{property as _}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as f}from"../../../core/accessorSupport/decorators/subclass.js";import{getReferenceEllipsoid as g}from"../../../geometry/ellipsoidUtils.js";import{projectOrLoad as y}from"../../../geometry/projectionUtils.js";import{fromExtent as w,intersection as v,toExtent as T,intersects as b}from"../../../geometry/support/aaBoundingRect.js";import R from"../../../symbols/support/ElevationInfo.js";import{simulationSettingsEqual as S,getPositions as j,getFlowSimulationSettings as L}from"../../2d/engine/flow/utils.js";import A from"./SubView3D.js";import{makeScheduleFunction as P}from"./support/makeScheduleFunction.js";import{thresholdForLoadingAllTiles as U,fadeOutTime as E,fadeInTime as x,defaultTransitionDuration as I,transitionDurationFactor as V,averageLoadingTimeSmoothingFactor as k}from"../support/flow/constants.js";import{FlowWorkerHandle as C}from"../support/flow/FlowWorkerHandle.js";import{materialParametersFromRenderer as q,createStreamlineGeometry as z}from"../support/flow/geometryUtils.js";import{boundingRectOfTiles as M}from"../support/flow/loadUtils.js";import{StreamlineResources3DOverlay as D}from"../support/flow/StreamlineResources3DOverlay.js";import{StreamlineResources3DShape as F}from"../support/flow/StreamlineResources3DShape.js";import B from"../support/flow/VisualQuery3D.js";import{tilesAreRelated as W}from"../terrain/tileUtils.js";import{isScreenSizePerspectiveEnabled as G}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{RibbonLineMaterial as H}from"../webgl-engine/materials/RibbonLineMaterial.js";import{isInEffectiveScaleRange as O,hasLayerBasedScaleVisibility as N}from"../../support/layerViewUtils.js";import{TaskPriority as Q}from"../../support/Scheduler.js";let J=class extends A{constructor(e){super(e),this.type="flow",this.renderedTiles=null,this.requireLoad=!1,this.workerHandle=null,this._averageLoadingTime=h(0),this._abortController=null,this._frameTask=null,this._tilesUpdateIsWaiting=!1,this._transitionEnabled=!0,this._debugAllowAutoLoading=!0,this.emissiveStrength=0,this._overrideMaterialParameters=null,this._overrideSimulationSettings=null,this._updateTask=null,this._debouncedTileUpdate=s(async()=>{const{allTiles:e}=this.surface,t=this._getTileFilterFunction(),i=new Set;function*r(r){for(let s=0;s<e.length;++s){const o=e.at(s);t(o)&&i.add(o),r.madeProgress(),r.done&&(r=yield)}}await this._frameTask.scheduleGenerator(r),this.renderedTiles=i}),this._transitionEnabled=!0}initialize(){const{surface:e,view:t}=this,{resourceController:i}=t;this.workerHandle=new C(P(i)),this._frameTask=i.scheduler.registerTask(Q.FLOW_GENERATOR),this._updateTask=p({update:this._update.bind(this)}),this.addHandles([a(()=>this.simulationSettings,()=>this.triggerLoad(),{sync:!0,equals:(e,t)=>null==e&&null==t||null!=e&&null!=t&&S(e,t)}),a(()=>{const{elevationInfo:e}=this;return[this._clippingArea,this._visible,this._draped,this.view.state.contentPixelRatio,e?.mode,e?.offset,e?.unit]},()=>this.triggerLoad(),u),a(()=>this._materialParameters,e=>{this._resources?.setMaterialParameters(e),this._lastResources?.setMaterialParameters(e)}),e.on("tiles-changed",()=>this._triggerTilesUpdate()),t.enableFeatureTiles(),a(()=>[this._dataBounds,this._featureTilesBounds,this._loadAllTiles],()=>this._triggerTilesUpdate()),a(()=>this._flowRenderer,(e,t)=>{const i=t?.visualVariables??[],r=e?.visualVariables??[];r.length===i.length&&r.every((e,t)=>e.type===i[t].type)||this.clear()}),n(()=>!t.featureTiles?.updating,()=>this._triggerTilesUpdate())]),this._triggerTilesUpdate()}destroy(){this._updateTask=i(this._updateTask),this.abort(),this.clear()}abort(){this._abortController=r(this._abortController),this.requireLoad=!1}get _clippingArea(){const e=y(this.view.clippingArea,this.surface.spatialReference).geometry;return null==e?null:w(e)}get _dataBounds(){const e=y(this.layer.fullExtent,this.surface.spatialReference).geometry;return null==e?null:w(e)}get _draped(){return"on-the-ground"===this.elevationInfo.mode}get _ellipsoidRadius(){return g(this.view.spatialReference).radius}get _loadAllTiles(){const{position:e}=this.view.camera,t=e.z;if(null==t)return!1;return t*m(e.spatialReference)/this._ellipsoidRadius>=U}get _featureTilesBounds(){const e=this.view.featureTiles?.filterExtent,t=y(e,this.surface.spatialReference).geometry;return null==t?null:w(t)}get _flowRenderer(){const e=this.layer.renderer;return"flow"!==e?.type?null:e}get _materialParameters(){return{...q(this._flowRenderer,this.layerView.fullOpacity,this.emissiveStrength),fadeInTime:x,fadeOutTime:E,...this._overrideMaterialParameters,hasSlicePlane:this.layerView.slicePlaneEnabled,screenSizePerspective:!this._draped&&G(this.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}}get _opacity(){return this.layerView.fullOpacity}get _transitionDuration(){const{_averageLoadingTime:e}=this;return h(0===e?I:this._averageLoadingTime*V)}get _visible(){const e=this._flowRenderer?.color;return this.visibleAtCurrentScale&&this.layer.effectiveVisible&&this._opacity>0&&(null==e||e.a>0)}get elevationInfo(){return this.layer.elevationInfo??K}startPositions(e){if(!this._transitionEnabled)return[];const{_flowRenderer:t,_resources:i}=this;return null==t||null==i?[]:j(i.streamlines,i.query,e,t.flowSpeed)}get needsMagnitude(){return this._flowRenderer?.hasVisualVariables()??!1}get layer(){return this.layerView.layer}get updating(){return this.updatingHandles.updating||this.requireLoad}get visibleAtCurrentScale(){return!N()||O(this.layer.effectiveScaleRange,this.view.scale)}get simulationSettings(){const{_flowRenderer:e,_overrideSimulationSettings:t}=this;if(null==e)return null;let i=L(e);return i.segmentLength=i.lineCollisionWidth/2,i.onlyForwardTracing=!1,null!=t&&(i={...i,...t}),i}get surface(){return this.view.basemapTerrain}doRefresh(){this.triggerLoad()}clear(){this._resources?.detach(),this._resources=null,this._lastResources?.detach(),this._lastResources=null}_update(e){if(!this.requireLoad||this.updatingHandles.updating)return;const t=c(e.time);if(this._transitionEnabled&&!this._lastResourceIsTransitioned(t))return;const{renderedTiles:i}=this;if(null==i||0===i.size)return;const r=async()=>{const e=performance.now();await this._load(i,t,this._transitionDuration);const r=h((performance.now()-e)/1e3);this._updateAverageLoadingTime(r)};this.updatingHandles.addPromise(o(r())),this.requireLoad=!1}_updateAverageLoadingTime(e){const t=k;this._averageLoadingTime=h(t*e+(1-t)*this._averageLoadingTime)}triggerLoad(){this._debugAllowAutoLoading&&(this.requireLoad=!0)}async _load(e,t,i){const{view:r}=this;if(!this._visible)return void this.clear();if(0===e.size)return;const s=this._computeExtent(e);if(null==s)return;const o=this._transitionEnabled&&null!=this._resources?h(t+i):t,a=new B(s,this.layerView.timeExtent,this._viewSizeWithEqualRatio(s),r.state.contentPixelRatio,o);null==this._abortController&&(this._abortController=new AbortController);const n=this._abortController,u=await this._loadStreamlines(a,n.signal);if(l(n.signal),this._visible&&null!=u){u.attach(),this._lastResources?.detach(),this._transitionEnabled?this._lastResources=this._resources:this._resources?.detach(),this._resources=u;const e=performance.now()/1e3,t=this._transitionEnabled&&e>o?e:o;null!=this._lastResources&&(this._lastResources.endTime=t),this._resources.startTime=t}}async _loadStreamlines(e,t){const i=await this.fetchDataAndGenerateStreamlines(e,t);if(null==i||0===i.length)return null;const{geometries:r,material:s}=await this._createGeometry(e,i);return this._draped?new D(e,i,s,r,this.surface.overlayManager):new F(e,i,s,r,this.view.stage)}async fetchDataAndGenerateStreamlines(e,t){return null}async _createGeometry(e,t){const i=new H(this._materialParameters,this.view.state.isGlobal),r=new Array,{elevationInfo:s,_draped:o,view:l}=this;function*a(a){for(let n=0;n<t.length;++n)r.push(z(l,e,t[n],s,i,o)),a.madeProgress(),a.done&&(a=yield)}return await this._frameTask.scheduleGenerator(a),{geometries:r,material:i}}_computeExtent(e){const{spatialReference:t}=this.surface;if(null==t)return null;const i=M(e);return null==i?null:(v(i,this._clippingArea,i),T(i,t))}_triggerTilesUpdate(){if(this._tilesUpdateIsWaiting)return;this._tilesUpdateIsWaiting=!0;const e=async()=>{await d(()=>this.view.stationary),this._tilesUpdateIsWaiting=!1,await this._debouncedTileUpdate()};this.updatingHandles.addPromise(o(e()))}_getTileFilterFunction(){const{_dataBounds:e,view:i,_featureTilesBounds:r}=this;if(this._loadAllTiles)return t=>t.leaf&&X(e,t.extent);const s=t=>t.rendered&&t.visible&&X(e,t.extent),{featureTiles:o}=i;if(!o)return s;const l=o.tiles.filter(e=>e.measures.visible);return e=>s(e)&&X(r,e.extent)&&l.some(({lij:i})=>t(i,e.lij)||W(i,e.lij))}_viewSizeWithEqualRatio(e){const t=(e.xmax-e.xmin)/(e.ymax-e.ymin),[i,r]=this.view.size;return i<r?[i,Math.floor(i/t)]:[Math.floor(r*t),r]}_lastResourceIsTransitioned(e){const{_lastResources:t,_resources:i,_flowRenderer:r}=this;if(null==t||null==i||null==r)return!0;return i.startTime+E<e}get test(){}};e([_()],J.prototype,"type",void 0),e([_()],J.prototype,"renderedTiles",void 0),e([_()],J.prototype,"_resources",void 0),e([_()],J.prototype,"_lastResources",void 0),e([_()],J.prototype,"requireLoad",void 0),e([_()],J.prototype,"_averageLoadingTime",void 0),e([_()],J.prototype,"emissiveStrength",void 0),e([_()],J.prototype,"_clippingArea",null),e([_()],J.prototype,"_dataBounds",null),e([_()],J.prototype,"_draped",null),e([_()],J.prototype,"_ellipsoidRadius",null),e([_()],J.prototype,"_loadAllTiles",null),e([_()],J.prototype,"_featureTilesBounds",null),e([_()],J.prototype,"_flowRenderer",null),e([_()],J.prototype,"_materialParameters",null),e([_()],J.prototype,"_opacity",null),e([_()],J.prototype,"_transitionDuration",null),e([_()],J.prototype,"_visible",null),e([_()],J.prototype,"elevationInfo",null),e([_()],J.prototype,"needsMagnitude",null),e([_()],J.prototype,"layer",null),e([_()],J.prototype,"updating",null),e([_()],J.prototype,"visibleAtCurrentScale",null),e([_()],J.prototype,"_overrideMaterialParameters",void 0),e([_()],J.prototype,"_overrideSimulationSettings",void 0),e([_()],J.prototype,"simulationSettings",null),e([_()],J.prototype,"surface",null),J=e([f("esri.views.3d.layers.FlowSubView3D")],J);const K=new R({mode:"on-the-ground"});function X(e,t){return null==e||null==t||b(e,t)}export{J as default};
5
+ import{__decorate as e}from"tslib";import{equals as t}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{removeMaybe as i,abortMaybe as r}from"../../../core/maybe.js";import{debounce as s,ignoreAbortErrors as o,throwIfAborted as l}from"../../../core/promiseUtils.js";import{watch as a,when as n,sync as u,whenOnce as d}from"../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../core/scheduling.js";import{Seconds as h,secondsFromMilliseconds as c}from"../../../core/time.js";import{getMetersPerVerticalUnitForSR as m}from"../../../core/unitUtils.js";import{property as _}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as f}from"../../../core/accessorSupport/decorators/subclass.js";import{getReferenceEllipsoid as g}from"../../../geometry/ellipsoidUtils.js";import{projectOrLoad as y}from"../../../geometry/projectionUtils.js";import{fromExtent as w,intersection as v,toExtent as T,intersects as b}from"../../../geometry/support/aaBoundingRect.js";import R from"../../../symbols/support/ElevationInfo.js";import{simulationSettingsEqual as S,getPositions as j,getFlowSimulationSettings as L}from"../../2d/engine/flow/utils.js";import A from"./SubView3D.js";import{makeScheduleFunction as P}from"./support/makeScheduleFunction.js";import{thresholdForLoadingAllTiles as U,fadeOutTime as E,fadeInTime as x,defaultTransitionDuration as I,transitionDurationFactor as V,averageLoadingTimeSmoothingFactor as k}from"../support/flow/constants.js";import{FlowWorkerHandle as C}from"../support/flow/FlowWorkerHandle.js";import{materialParametersFromRenderer as q,createStreamlineGeometry as z}from"../support/flow/geometryUtils.js";import{boundingRectOfTiles as M}from"../support/flow/loadUtils.js";import{StreamlineResources3DOverlay as D}from"../support/flow/StreamlineResources3DOverlay.js";import{StreamlineResources3DShape as F}from"../support/flow/StreamlineResources3DShape.js";import B from"../support/flow/VisualQuery3D.js";import{tilesAreRelated as W}from"../terrain/tileUtils.js";import{isScreenSizePerspectiveEnabled as G}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{RibbonLineMaterial as H}from"../webgl-engine/materials/RibbonLineMaterial.js";import{isInEffectiveScaleRange as O,hasLayerBasedScaleVisibility as N}from"../../support/layerViewUtils.js";import{TaskPriority as Q}from"../../support/Scheduler.js";let J=class extends A{constructor(e){super(e),this.type="flow",this.renderedTiles=null,this.requireLoad=!1,this.workerHandle=null,this._averageLoadingTime=h(0),this._abortController=null,this._frameTask=null,this._tilesUpdateIsWaiting=!1,this._transitionEnabled=!0,this._debugAllowAutoLoading=!0,this.emissiveStrength=0,this._overrideMaterialParameters=null,this._overrideSimulationSettings=null,this._updateTask=null,this._debouncedTileUpdate=s(async()=>{const{allTiles:e}=this.surface,t=this._getTileFilterFunction(),i=new Set;function*r(r){for(let s=0;s<e.length;++s){const o=e.at(s);t(o)&&i.add(o),r.madeProgress(),r.done&&(r=yield)}}await this._frameTask.scheduleGenerator(r),this.renderedTiles=i}),this._transitionEnabled=!0}initialize(){const{surface:e,view:t}=this,{resourceController:i}=t;this.workerHandle=new C(P(i)),this._frameTask=i.scheduler.registerTask(Q.FLOW_GENERATOR),this._updateTask=p({update:this._update.bind(this)}),this.addHandles([a(()=>this.simulationSettings,()=>this.triggerLoad(),{sync:!0,equals:(e,t)=>null==e&&null==t||null!=e&&null!=t&&S(e,t)}),a(()=>{const{elevationInfo:e}=this;return[this._clippingArea,this._visible,this._draped,this.view.state.contentPixelRatio,e?.mode,e?.offset,e?.unit]},()=>this.triggerLoad(),u),a(()=>this._materialParameters,e=>{this._resources?.setMaterialParameters(e),this._lastResources?.setMaterialParameters(e)}),e.on("tiles-changed",()=>this._triggerTilesUpdate()),t.enableFeatureTiles(),a(()=>[this._dataBounds,this._featureTilesBounds,this._loadAllTiles],()=>this._triggerTilesUpdate()),a(()=>this._flowRenderer,(e,t)=>{const i=t?.visualVariables??[],r=e?.visualVariables??[];r.length===i.length&&r.every((e,t)=>e.type===i[t].type)||this.clear()}),n(()=>!t.featureTiles?.updating,()=>this._triggerTilesUpdate())]),this._triggerTilesUpdate()}destroy(){this._updateTask=i(this._updateTask),this.abort(),this.clear()}abort(){this._abortController=r(this._abortController),this.requireLoad=!1}get _clippingArea(){const e=y(this.view.clippingArea,this.surface.spatialReference).geometry;return null==e?null:w(e)}get _dataBounds(){const e=y(this.layer.fullExtent,this.surface.spatialReference).geometry;return null==e?null:w(e)}get _draped(){return"on-the-ground"===this.elevationInfo.mode}get _ellipsoidRadius(){return g(this.view.spatialReference).radius}get _loadAllTiles(){const{position:e}=this.view.camera,t=e.z;if(null==t)return!1;return t*m(e.spatialReference)/this._ellipsoidRadius>=U}get _featureTilesBounds(){const e=this.view.featureTiles?.filterExtent,t=y(e,this.surface.spatialReference).geometry;return null==t?null:w(t)}get _flowRenderer(){const e=this.layer.renderer;return"flow"!==e?.type?null:e}get _materialParameters(){return{...q(this._flowRenderer,this.layerView.fullOpacity,this.emissiveStrength),fadeInTime:x,fadeOutTime:E,...this._overrideMaterialParameters,hasSlicePlane:this.layerView.slicePlaneEnabled,screenSizePerspective:!this._draped&&G(this.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}}get _opacity(){return this.layerView.fullOpacity}get _transitionDuration(){const{_averageLoadingTime:e}=this;return h(0===e?I:this._averageLoadingTime*V)}get _visible(){const e=this._flowRenderer?.color;return this.visibleAtCurrentScale&&this.layer.effectiveVisible&&this._opacity>0&&(null==e||e.a>0)}get elevationInfo(){return this.layer.elevationInfo??K}startPositions(e){if(!this._transitionEnabled)return[];const{_flowRenderer:t,_resources:i}=this;return null==t||null==i?[]:j(i.streamlines,i.query,e,t.flowSpeed)}get needsMagnitude(){return this._flowRenderer?.hasVisualVariables()??!1}get layer(){return this.layerView.layer}get updating(){return this.updatingHandles.updating||this.requireLoad}get visibleAtCurrentScale(){return!N()||O(this.layer.effectiveScaleRange,this.view.scale)}get simulationSettings(){const{_flowRenderer:e,_overrideSimulationSettings:t}=this;if(null==e)return null;let i=L(e);return i.segmentLength=i.lineCollisionWidth/2,i.onlyForwardTracing=!1,null!=t&&(i={...i,...t}),i}get surface(){return this.view.basemapTerrain}doRefresh(){this.triggerLoad()}clear(){this._resources?.detach(),this._resources=null,this._lastResources?.detach(),this._lastResources=null}_update(e){if(!this.requireLoad||this.updatingHandles.updating)return;const t=c(e.time);if(this._transitionEnabled&&!this._lastResourceIsTransitioned(t))return;const{renderedTiles:i}=this;if(null==i||0===i.size)return;const r=async()=>{const e=performance.now();await this._load(i,t,this._transitionDuration);const r=h((performance.now()-e)/1e3);this._updateAverageLoadingTime(r)};this.updatingHandles.addPromise(o(r())),this.requireLoad=!1}_updateAverageLoadingTime(e){const t=k;this._averageLoadingTime=h(t*e+(1-t)*this._averageLoadingTime)}triggerLoad(){this._debugAllowAutoLoading&&(this.requireLoad=!0)}async _load(e,t,i){const{view:r}=this;if(!this._visible)return void this.clear();if(0===e.size)return;const s=this._computeExtent(e);if(null==s)return;const o=this._transitionEnabled&&null!=this._resources?h(t+i):t,a=new B(s,this.layerView.timeExtent,this._viewSizeWithEqualRatio(s),r.state.contentPixelRatio,o);null==this._abortController&&(this._abortController=new AbortController);const n=this._abortController,u=await this._loadStreamlines(a,n.signal);if(l(n.signal),this._visible&&null!=u){u.attach(),this._lastResources?.detach(),this._transitionEnabled?this._lastResources=this._resources:this._resources?.detach(),this._resources=u;const e=performance.now()/1e3,t=this._transitionEnabled&&e>o?e:o;null!=this._lastResources&&(this._lastResources.endTime=t),this._resources.startTime=t}}async _loadStreamlines(e,t){const i=await this.fetchDataAndGenerateStreamlines(e,t);if(null==i||0===i.length)return null;const{geometries:r,material:s}=await this._createGeometry(e,i);return this._draped?new D(e,i,s,r,this.view.overlayManager):new F(e,i,s,r,this.view.stage)}async fetchDataAndGenerateStreamlines(e,t){return null}async _createGeometry(e,t){const i=new H(this._materialParameters,this.view.state.isGlobal),r=new Array,{elevationInfo:s,_draped:o,view:l}=this;function*a(a){for(let n=0;n<t.length;++n)r.push(z(l,e,t[n],s,i,o)),a.madeProgress(),a.done&&(a=yield)}return await this._frameTask.scheduleGenerator(a),{geometries:r,material:i}}_computeExtent(e){const{spatialReference:t}=this.surface;if(null==t)return null;const i=M(e);return null==i?null:(v(i,this._clippingArea,i),T(i,t))}_triggerTilesUpdate(){if(this._tilesUpdateIsWaiting)return;this._tilesUpdateIsWaiting=!0;const e=async()=>{await d(()=>this.view.stationary),this._tilesUpdateIsWaiting=!1,await this._debouncedTileUpdate()};this.updatingHandles.addPromise(o(e()))}_getTileFilterFunction(){const{_dataBounds:e,view:i,_featureTilesBounds:r}=this;if(this._loadAllTiles)return t=>t.leaf&&X(e,t.extent);const s=t=>t.rendered&&t.visible&&X(e,t.extent),{featureTiles:o}=i;if(!o)return s;const l=o.tiles.filter(e=>e.measures.visible);return e=>s(e)&&X(r,e.extent)&&l.some(({lij:i})=>t(i,e.lij)||W(i,e.lij))}_viewSizeWithEqualRatio(e){const t=(e.xmax-e.xmin)/(e.ymax-e.ymin),[i,r]=this.view.size;return i<r?[i,Math.floor(i/t)]:[Math.floor(r*t),r]}_lastResourceIsTransitioned(e){const{_lastResources:t,_resources:i,_flowRenderer:r}=this;if(null==t||null==i||null==r)return!0;return i.startTime+E<e}get test(){}};e([_()],J.prototype,"type",void 0),e([_()],J.prototype,"renderedTiles",void 0),e([_()],J.prototype,"_resources",void 0),e([_()],J.prototype,"_lastResources",void 0),e([_()],J.prototype,"requireLoad",void 0),e([_()],J.prototype,"_averageLoadingTime",void 0),e([_()],J.prototype,"emissiveStrength",void 0),e([_()],J.prototype,"_clippingArea",null),e([_()],J.prototype,"_dataBounds",null),e([_()],J.prototype,"_draped",null),e([_()],J.prototype,"_ellipsoidRadius",null),e([_()],J.prototype,"_loadAllTiles",null),e([_()],J.prototype,"_featureTilesBounds",null),e([_()],J.prototype,"_flowRenderer",null),e([_()],J.prototype,"_materialParameters",null),e([_()],J.prototype,"_opacity",null),e([_()],J.prototype,"_transitionDuration",null),e([_()],J.prototype,"_visible",null),e([_()],J.prototype,"elevationInfo",null),e([_()],J.prototype,"needsMagnitude",null),e([_()],J.prototype,"layer",null),e([_()],J.prototype,"updating",null),e([_()],J.prototype,"visibleAtCurrentScale",null),e([_()],J.prototype,"_overrideMaterialParameters",void 0),e([_()],J.prototype,"_overrideSimulationSettings",void 0),e([_()],J.prototype,"simulationSettings",null),e([_()],J.prototype,"surface",null),J=e([f("esri.views.3d.layers.FlowSubView3D")],J);const K=new R({mode:"on-the-ground"});function X(e,t){return null==e||null==t||b(e,t)}export{J 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.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../core/Logger.js";import{removeMaybe as s}from"../../../core/maybe.js";import{watch as i,syncAndInitial as r}from"../../../core/reactiveUtils.js";import{convertUnit as a}from"../../../core/unitUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{fromValues as l}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{isCompatible as h}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as u,isWebMercator as d,equals as c}from"../../../geometry/support/spatialReferenceUtils.js";import{getHeightModelInfoFromVCS as m}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as f}from"../../../support/elevationInfoUtils.js";import{getMetersPerUnit as p}from"../../../symbols/support/unitConversionUtils.js";import{LayerView3D as _}from"./LayerView3D.js";import{addLayerViewToWasm as y,getLyr3DWasm as w,removeLayerViewFromWasm as g}from"./Lyr3DWasm.js";import{Obb as b}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as M,elementsPerSplatPage as v,packedGaussianSizeInU32 as C,splatPageSizeInU32WithoutHeader as S,gaussiansPerSplatPage as x,splatAtlasTextureWidth as U}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianTile as j}from"../support/gaussianSplatting/GaussianTile.js";import{GaussianSplatRenderNode as V}from"../webgl-engine/lib/GaussianSplatRenderNode.js";import L from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as R}from"../../support/layerViewUtils.js";const A=()=>t.getLogger("esri.views.3d.layers.GaussianSPlatLayerView3D");let E=class extends(_(L)){constructor(e){super(e),this.type="gaussian-splat-3d",this._gaussianTileHandles=new Map,this._pageBuffer=new Uint32Array(M),this._wasmLayerId=-1,this._metersPerVCSUnit=1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._suspendedHandle=null,this._conversionBuffer=new ArrayBuffer(4),this._u32View=new Uint32Array(this._conversionBuffer),this._f32View=new Float32Array(this._conversionBuffer),this._memCache=e.view.resourceController.memoryController.newCache(`GaussianSplat-${this.uid}`,e=>this._deleteTile(e)),this._renderNode=new V(e)}initialize(){if(!this._canProjectWithoutEngine())throw R("layer",this.layer.spatialReference.wkid,this.view.renderSpatialReference?.wkid);const e=y(this).then(e=>{this._wasmLayerId=e,this.addHandles([i(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e))]),this._suspendedHandle=i(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),r)});this.addResolvingPromise(e)}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&e.isUpdating(this._wasmLayerId)}updatingFlagChanged(){this.notifyChange("updating")}get _wasm(){return w(this.view)}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get useEsriCrs(){return this._useEsriCrs}async createRenderable(e){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const s=t.desc.prims[0],i=s.vertexCount,r=s.atrbs[0].view,a=s.atrbs[0].view.byteCount,n=s.atrbs[0].view.byteOffset;let o=null;if("U32"!==r.type)return A().warnOnce("unexpected meshData.data format"),{memUsageBytes:0};o=new Uint32Array(t.data.buffer,n,a/4);const h=this.extractHeader(o),u=Math.ceil(i/x),d=new Uint32Array(i),c=[];for(let l=0;l<u;l++){let e=this._data.textureAtlas.requestPage();if(null===e&&(this._freeInvisibleTiles(),e=this._data.textureAtlas.requestPage()),null===e)return A().warnOnce("ran out of gaussian splat memory"),{memUsageBytes:0};{c.push(e);const t=i-l*x,s=Math.min(t,x),r=l*x;for(let i=0;i<s;i++)d[i+r]=i+v*e;const a=l*S;this._pageBuffer.set(o.subarray(a,a+s*C)),this._pageBuffer.set(h.packedHeader,S);const n=e*v,u=n%U,m=Math.floor(n/U);this._data.textureAtlas.update(u,m,this._pageBuffer)}}const m=new Float64Array(3*i),f=new Float64Array(i),p=2.048,_=h.tileOrigin.x*p,y=h.tileOrigin.y*p,w=h.tileOrigin.z*p,g=h.invPosScale;let M=0,V=0;for(let l=0;l<i;l++){const e=l*C,{rawX:t,rawY:s,rawZ:i}=this._extractGaussianPosition(o,e),r=this._extractGaussianSphericalScale(o,e);m[M]=t*g+_,m[M+1]=s*g+y,m[M+2]=i*g+w,f[l]=r*r,V=Math.max(V,r),M+=3}let L=null;if(t.desc.obb){const e=t.desc.obb.quaternion;L=new b(t.desc.obb.center,t.desc.obb.halfSize,l(...e))}L||(A().warnOnce("encountered tile without a bounding box"),L=new b);const R=new j(e.handle,L,d,c,m,f,V);return this._memCache.put(`${R.handle}`,R),this._gaussianTileHandles.set(e.handle,R),this._cacheMemory+=R.usedMemory,{memUsageBytes:R.usedMemory}}_extractGaussianPosition(e,t){const s=e[t+1];return{rawX:16383&s,rawY:s>>>14&16383,rawZ:s>>>28&15|(1023&e[t+2])<<4}}_extractGaussianSphericalScale(e,t){const s=e[t+2],i=s>>>10&255,r=s>>>18&255,a=s>>>26&63|(3&e[t+3])<<6,n=Math.exp(i/16-10),o=Math.exp(r/16-10),l=Math.exp(a/16-10);return Math.max(n,o,l)}freeRenderable(e){const t=this._gaussianTileHandles.get(e);t&&(t.isVisible?this._usedMemory-=t.usedMemory:this._cacheMemory-=t.usedMemory,t.pageIds.forEach(e=>this._data.textureAtlas.freePage(e)),this.freeObject(t),this._gaussianTileHandles.delete(e)),this._updateGaussians()}freeObject(e){this._memCache.pop(`${e.handle}`)}setRenderableVisibility(e,t,s){for(let i=0;i<s;i++){if(!t[i])continue;const s=e[i],r=this._gaussianTileHandles.get(s);if(r){if(r.isVisible)continue;r.isVisible=!0,this._usedMemory+=r.usedMemory,this._cacheMemory-=r.usedMemory,this._memCache.pop(`${s}`)}}for(let i=0;i<s;i++){if(t[i])continue;const s=e[i],r=this._gaussianTileHandles.get(s);if(r){if(!r.isVisible)continue;r.isVisible=!1,this._usedMemory-=r.usedMemory,this._cacheMemory+=r.usedMemory,this._memCache.put(`${s}`,r)}}this._updateGaussians()}destroy(){g(this),this._suspendedHandle&&(this._suspendedHandle=s(this._suspendedHandle)),this._renderNode.destroy(),this._memCache.destroy()}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(u(this.view.renderSpatialReference)||d(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&c(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){const e=m(this.layer.esriCrsSpatialReference),t=this.view.heightModelInfo;return this._useEsriCrs=0===h(e,t,!1),this._useEsriCrs&&e&&(this._metersPerVCSUnit=a(1,"meters",e.heightUnit),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}_elevationInfoChanged(e){if(e?.offset)if(this._useEsriCrs){const t=p(e?.unit)/this._metersPerVCSUnit,s=e?.offset??0;this._wasm?.setLayerOffset(this,s*t)}else this._wasm?.setLayerOffset(this,f(e));else this._wasm?.setLayerOffset(this,0)}_updateGaussians(){const e=new Array;for(const t of this._gaussianTileHandles.values())t.isVisible&&e.push(t);this._data.updateGaussianVisibility(e)}_freeInvisibleTiles(){for(const e of this._gaussianTileHandles.values())e.isVisible||this._deleteTile(e)}get _data(){return this._renderNode.data}extractHeader(e){const t=e.length-4,s=this.reinterpretU32AsFloat(e[t]),i=this.reinterpretU32AsFloat(e[t+1]),r=this.reinterpretU32AsFloat(e[t+2]),a=1/(1<<(255&e[t+3]));return{packedHeader:e.subarray(t,t+4),tileOrigin:{x:s,y:i,z:r},invPosScale:a}}_deleteTile(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}reinterpretU32AsFloat(e){return this._u32View[0]=e,this._f32View[0]}};e([n()],E.prototype,"layer",void 0),e([n()],E.prototype,"fullExtentInLocalViewSpatialReference",void 0),E=e([o("esri.views.3d.layers.GaussianSplatLayerView3D")],E);const H=E;export{H as default};
5
+ import{__decorate as e}from"tslib";import t from"../../../core/Logger.js";import{removeMaybe as s}from"../../../core/maybe.js";import{watch as i,syncAndInitial as r}from"../../../core/reactiveUtils.js";import{convertUnit as a}from"../../../core/unitUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{fromValues as l}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{isCompatible as h}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as u,isWebMercator as d,equals as c}from"../../../geometry/support/spatialReferenceUtils.js";import{getHeightModelInfoFromVCS as m}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as f}from"../../../support/elevationInfoUtils.js";import{getMetersPerUnit as p}from"../../../symbols/support/unitConversionUtils.js";import{LayerView3D as _}from"./LayerView3D.js";import{addLayerViewToWasm as y,getLyr3DWasm as w,removeLayerViewFromWasm as g}from"./Lyr3DWasm.js";import{Obb as b}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as M,elementsPerSplatPage as v,packedGaussianSizeInU32 as C,splatPageSizeInU32WithoutHeader as S,gaussiansPerSplatPage as x,splatAtlasTextureWidth as U}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianTile as j}from"../support/gaussianSplatting/GaussianTile.js";import{GaussianSplatRenderNode as V}from"../webgl-engine/lib/GaussianSplatRenderNode.js";import L from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as R}from"../../support/layerViewUtils.js";const A=()=>t.getLogger("esri.views.3d.layers.GaussianSPlatLayerView3D");let E=class extends(_(L)){constructor(e){super(e),this.type="gaussian-splat-3d",this._gaussianTileHandles=new Map,this._pageBuffer=new Uint32Array(M),this._wasmLayerId=-1,this._metersPerVCSUnit=1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._suspendedHandle=null,this._conversionBuffer=new ArrayBuffer(4),this._u32View=new Uint32Array(this._conversionBuffer),this._f32View=new Float32Array(this._conversionBuffer);const{view:t}=e;this._memCache=t.resourceController.memoryController.newCache(`GaussianSplat-${this.uid}`,e=>this._deleteTile(e)),this._renderNode=new V({view:t})}initialize(){if(!this._canProjectWithoutEngine())throw R("layer",this.layer.spatialReference.wkid,this.view.renderSpatialReference?.wkid);const e=y(this).then(e=>{this._wasmLayerId=e,this.addHandles([i(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e))]),this._suspendedHandle=i(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),r)});this.addResolvingPromise(e)}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&e.isUpdating(this._wasmLayerId)}updatingFlagChanged(){this.notifyChange("updating")}get _wasm(){return w(this.view)}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get useEsriCrs(){return this._useEsriCrs}async createRenderable(e){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const s=t.desc.prims[0],i=s.vertexCount,r=s.atrbs[0].view,a=s.atrbs[0].view.byteCount,n=s.atrbs[0].view.byteOffset;let o=null;if("U32"!==r.type)return A().warnOnce("unexpected meshData.data format"),{memUsageBytes:0};o=new Uint32Array(t.data.buffer,n,a/4);const h=this.extractHeader(o),u=Math.ceil(i/x),d=new Uint32Array(i),c=[];for(let l=0;l<u;l++){let e=this._data.textureAtlas.requestPage();if(null===e&&(this._freeInvisibleTiles(),e=this._data.textureAtlas.requestPage()),null===e)return A().warnOnce("ran out of gaussian splat memory"),{memUsageBytes:0};{c.push(e);const t=i-l*x,s=Math.min(t,x),r=l*x;for(let i=0;i<s;i++)d[i+r]=i+v*e;const a=l*S;this._pageBuffer.set(o.subarray(a,a+s*C)),this._pageBuffer.set(h.packedHeader,S);const n=e*v,u=n%U,m=Math.floor(n/U);this._data.textureAtlas.update(u,m,this._pageBuffer)}}const m=new Float64Array(3*i),f=new Float64Array(i),p=2.048,_=h.tileOrigin.x*p,y=h.tileOrigin.y*p,w=h.tileOrigin.z*p,g=h.invPosScale;let M=0,V=0;for(let l=0;l<i;l++){const e=l*C,{rawX:t,rawY:s,rawZ:i}=this._extractGaussianPosition(o,e),r=this._extractGaussianSphericalScale(o,e);m[M]=t*g+_,m[M+1]=s*g+y,m[M+2]=i*g+w,f[l]=r*r,V=Math.max(V,r),M+=3}let L=null;if(t.desc.obb){const e=t.desc.obb.quaternion;L=new b(t.desc.obb.center,t.desc.obb.halfSize,l(...e))}L||(A().warnOnce("encountered tile without a bounding box"),L=new b);const R=new j(e.handle,L,d,c,m,f,V);return this._memCache.put(`${R.handle}`,R),this._gaussianTileHandles.set(e.handle,R),this._cacheMemory+=R.usedMemory,{memUsageBytes:R.usedMemory}}_extractGaussianPosition(e,t){const s=e[t+1];return{rawX:16383&s,rawY:s>>>14&16383,rawZ:s>>>28&15|(1023&e[t+2])<<4}}_extractGaussianSphericalScale(e,t){const s=e[t+2],i=s>>>10&255,r=s>>>18&255,a=s>>>26&63|(3&e[t+3])<<6,n=Math.exp(i/16-10),o=Math.exp(r/16-10),l=Math.exp(a/16-10);return Math.max(n,o,l)}freeRenderable(e){const t=this._gaussianTileHandles.get(e);t&&(t.isVisible?this._usedMemory-=t.usedMemory:this._cacheMemory-=t.usedMemory,t.pageIds.forEach(e=>this._data.textureAtlas.freePage(e)),this.freeObject(t),this._gaussianTileHandles.delete(e)),this._updateGaussians()}freeObject(e){this._memCache.pop(`${e.handle}`)}setRenderableVisibility(e,t,s){for(let i=0;i<s;i++){if(!t[i])continue;const s=e[i],r=this._gaussianTileHandles.get(s);if(r){if(r.isVisible)continue;r.isVisible=!0,this._usedMemory+=r.usedMemory,this._cacheMemory-=r.usedMemory,this._memCache.pop(`${s}`)}}for(let i=0;i<s;i++){if(t[i])continue;const s=e[i],r=this._gaussianTileHandles.get(s);if(r){if(!r.isVisible)continue;r.isVisible=!1,this._usedMemory-=r.usedMemory,this._cacheMemory+=r.usedMemory,this._memCache.put(`${s}`,r)}}this._updateGaussians()}destroy(){g(this),this._suspendedHandle&&(this._suspendedHandle=s(this._suspendedHandle)),this._renderNode.destroy(),this._memCache.destroy()}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(u(this.view.renderSpatialReference)||d(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&c(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){const e=m(this.layer.esriCrsSpatialReference),t=this.view.heightModelInfo;return this._useEsriCrs=0===h(e,t,!1),this._useEsriCrs&&e&&(this._metersPerVCSUnit=a(1,"meters",e.heightUnit),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}_elevationInfoChanged(e){if(e?.offset)if(this._useEsriCrs){const t=p(e?.unit)/this._metersPerVCSUnit,s=e?.offset??0;this._wasm?.setLayerOffset(this,s*t)}else this._wasm?.setLayerOffset(this,f(e));else this._wasm?.setLayerOffset(this,0)}_updateGaussians(){const e=new Array;for(const t of this._gaussianTileHandles.values())t.isVisible&&e.push(t);this._data.updateGaussianVisibility(e)}_freeInvisibleTiles(){for(const e of this._gaussianTileHandles.values())e.isVisible||this._deleteTile(e)}get _data(){return this._renderNode.data}extractHeader(e){const t=e.length-4,s=this.reinterpretU32AsFloat(e[t]),i=this.reinterpretU32AsFloat(e[t+1]),r=this.reinterpretU32AsFloat(e[t+2]),a=1/(1<<(255&e[t+3]));return{packedHeader:e.subarray(t,t+4),tileOrigin:{x:s,y:i,z:r},invPosScale:a}}_deleteTile(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}reinterpretU32AsFloat(e){return this._u32View[0]=e,this._f32View[0]}};e([n()],E.prototype,"layer",void 0),e([n()],E.prototype,"fullExtentInLocalViewSpatialReference",void 0),E=e([o("esri.views.3d.layers.GaussianSplatLayerView3D")],E);const H=E;export{H as default};