@arcgis/core 6.0.0-next.6 → 6.0.0-next.8

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 (257) hide show
  1. package/arcade/functions/knowledgegraph.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{f09c9d9a554c33a753b4.js → 02253bdffbd580af22d8.js} +1 -1
  4. package/assets/esri/core/workers/chunks/06ab24a083c3229228dd.js +1 -0
  5. package/assets/esri/core/workers/chunks/09a63cc1987f8636c5b0.js +1 -0
  6. package/assets/esri/core/workers/chunks/{8ba32d3a0df4a206ef1c.js → 15cc2c295682f48030f9.js} +1 -1
  7. package/assets/esri/core/workers/chunks/17b76e0d401c7e396d10.js +1 -0
  8. package/assets/esri/core/workers/chunks/{c18189710d6198516175.js → 19b9d393046a780e6c3f.js} +1 -1
  9. package/assets/esri/core/workers/chunks/1b35ec54968fbeec17ce.js +1 -0
  10. package/assets/esri/core/workers/chunks/1c0c5cb13c2590aae906.js +1 -0
  11. package/assets/esri/core/workers/chunks/1e0d2715d603f48a7e0b.js +1 -0
  12. package/assets/esri/core/workers/chunks/{83589144eeeb08f45557.js → 2aeb5cc32284dd3e4d22.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{9a7fc93cc693fd12b5d8.js → 2b6c74646ff475a6e302.js} +1 -1
  14. package/assets/esri/core/workers/chunks/2d9a1f23ec6ce90723ac.js +1 -0
  15. package/assets/esri/core/workers/chunks/340621182db9e8edbec2.js +1 -0
  16. package/assets/esri/core/workers/chunks/{71f739bb3f7350704af6.js → 384ae10053d35940de73.js} +1 -1
  17. package/assets/esri/core/workers/chunks/3b3e519f15ed52c83f0c.js +1 -0
  18. package/assets/esri/core/workers/chunks/{72019baeba520edb6bb0.js → 3b737dae6efed627406e.js} +1 -1
  19. package/assets/esri/core/workers/chunks/3c0ed15b544df6fb0903.js +1 -0
  20. package/assets/esri/core/workers/chunks/3ffda5bf0b91700dc308.js +1 -0
  21. package/assets/esri/core/workers/chunks/{1317ecdfd0cfa683a493.js → 42323093827adffe56d3.js} +1 -1
  22. package/assets/esri/core/workers/chunks/451d7d456df0f4466563.js +1 -0
  23. package/assets/esri/core/workers/chunks/4a6b92ecbb1f1c55cc43.js +1 -0
  24. package/assets/esri/core/workers/chunks/4e544de61f07ca660236.js +1 -0
  25. package/assets/esri/core/workers/chunks/{67ac6b326bf80fc3d33d.js → 53be85d04cd2da4f391d.js} +1 -1
  26. package/assets/esri/core/workers/chunks/54778dec1598818d93cb.js +1 -0
  27. package/assets/esri/core/workers/chunks/{06e7400f5ebe0719b81c.js → 5a5d80c2519aa3ea8878.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{fb4ff0ac2bc445fec413.js → 5b434e8c98e7119d4a3b.js} +1 -1
  29. package/assets/esri/core/workers/chunks/606ea251075fe81a1206.js +1 -0
  30. package/assets/esri/core/workers/chunks/{3ac9dcbb0571a2580236.js → 62c8c9ad09e0166207fd.js} +1 -1
  31. package/assets/esri/core/workers/chunks/6588725275c75fae0d9c.js +1 -0
  32. package/assets/esri/core/workers/chunks/{ac4cc49104d26c384e98.js → 658b2642ab6880770e4e.js} +1 -1
  33. package/assets/esri/core/workers/chunks/68be3fb88ca61f82fb90.js +1 -0
  34. package/assets/esri/core/workers/chunks/6c9266120d46e8c69dbf.js +1 -0
  35. package/assets/esri/core/workers/chunks/6ebe73f69ae822053b70.js +1 -0
  36. package/assets/esri/core/workers/chunks/6ef647b7769d27529f9c.js +1 -0
  37. package/assets/esri/core/workers/chunks/709e019885822b1f6f3e.js +1 -0
  38. package/assets/esri/core/workers/chunks/70cc2d79653d66e85b58.js +1 -0
  39. package/assets/esri/core/workers/chunks/{cbe6c0f32608cb504695.js → 776ae25a34352d3468bc.js} +1 -1
  40. package/assets/esri/core/workers/chunks/8730e7e6e0296f43f10b.js +1 -0
  41. package/assets/esri/core/workers/chunks/8bea0d706ede6f84f8aa.js +1 -0
  42. package/assets/esri/core/workers/chunks/900181f68449d8f82eeb.js +1 -0
  43. package/assets/esri/core/workers/chunks/939942b00ba380e2957e.js +1 -0
  44. package/assets/esri/core/workers/chunks/{1ef39aef6b33c530cbe4.js → 966d0832a3c1f03668a0.js} +1 -1
  45. package/assets/esri/core/workers/chunks/9a28a66807a1e3557018.js +1 -0
  46. package/assets/esri/core/workers/chunks/{2f9033890c465acff698.js → 9bf48a907f91ea004648.js} +1 -1
  47. package/assets/esri/core/workers/chunks/9c7fa9d324fa0bf64d9c.js +1 -0
  48. package/assets/esri/core/workers/chunks/9ce91a909eccc4dfe388.js +1 -0
  49. package/assets/esri/core/workers/chunks/{1ba1f705b6ce5c8ea702.js → a655ebdb4bf0660615a2.js} +1 -1
  50. package/assets/esri/core/workers/chunks/ad76f7ab2f3e6d5a5b3c.js +1 -0
  51. package/assets/esri/core/workers/chunks/af349c7bc8ef41a0e1bd.js +1 -0
  52. package/assets/esri/core/workers/chunks/{250d3be6d3849d71fed8.js → c29c474c4b1049352d3e.js} +1 -1
  53. package/assets/esri/core/workers/chunks/c8ba0673d1b87216e619.js +1 -0
  54. package/assets/esri/core/workers/chunks/{4d3f97a48046021713a6.js → ceb112fe7aef354f8051.js} +1 -1
  55. package/assets/esri/core/workers/chunks/d6ad4390df576198e45b.js +1 -0
  56. package/assets/esri/core/workers/chunks/ddf0671976648f621269.js +1 -0
  57. package/assets/esri/core/workers/chunks/ded8b64a46992c3ae693.js +1 -0
  58. package/assets/esri/core/workers/chunks/{0b36abcbf03037b4073d.js → e1af43e2a8f2ef1059e3.js} +1 -1
  59. package/assets/esri/core/workers/chunks/eaf6d587477399a83088.js +1 -0
  60. package/assets/esri/core/workers/chunks/ecaac39dde7ec4213264.js +1 -0
  61. package/assets/esri/core/workers/chunks/f122c18af10e56f9ec2b.js +1 -0
  62. package/assets/esri/core/workers/chunks/f31b424a3667686af10c.js +1 -0
  63. package/assets/esri/core/workers/chunks/{711cfb84659cb4437679.js → f528ac5c648ca6a98582.js} +1 -1
  64. package/assets/esri/core/workers/chunks/f92364afaefbac7e8f77.js +1 -0
  65. package/assets/esri/core/workers/chunks/fb444954be74c1962ced.js +1 -0
  66. package/assets/esri/core/workers/chunks/fecaf0bc28aeea4d15db.js +1 -0
  67. package/assets/esri/themes/base/widgets/_FeatureFormUtilityNetworkAssociationSettings.scss +1 -1
  68. package/assets/esri/themes/base/widgets/_Features.scss +1 -1
  69. package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +5 -9
  70. package/assets/esri/themes/base/widgets/_SelectionToolbar.scss +2 -4
  71. package/assets/esri/themes/base/widgets/_Tooltip.scss +1 -1
  72. package/assets/esri/themes/dark/main.css +1 -1
  73. package/assets/esri/themes/light/main.css +1 -1
  74. package/assets/esri/themes/light/view.css +1 -1
  75. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.en.json +1 -1
  76. package/chunks/GlobalIllumination.glsl.js +4 -2
  77. package/chunks/GlobalIlluminationBlur.glsl.js +3 -5
  78. package/chunks/GlobalIlluminationUpscale.glsl.js +1 -1
  79. package/config.js +1 -1
  80. package/core/colorUtils.js +1 -1
  81. package/core/has.js +1 -1
  82. package/core/workers/workerFactory.js +1 -1
  83. package/form/elements/inputs/DynamicChoiceInput.d.ts +35 -5
  84. package/geometry/projectionUtils.js +1 -1
  85. package/geometry/support/scaleUtils.js +1 -1
  86. package/kernel.js +1 -1
  87. package/layers/ParquetLayer.d.ts +3 -2
  88. package/layers/ParquetLayer.js +1 -1
  89. package/layers/graphics/data/FeatureStore.js +1 -1
  90. package/layers/graphics/data/QueryEngineResult.js +1 -1
  91. package/layers/graphics/data/geometryUtils.js +1 -1
  92. package/layers/graphics/data/projectionSupport.js +1 -1
  93. package/layers/knowledgeGraph/layerUtils.js +1 -1
  94. package/layers/knowledgeGraph/nodeMovementUtils.js +1 -1
  95. package/layers/mixins/ScaleRangeLayer.js +1 -1
  96. package/layers/mixins/SublayersOwner.js +1 -1
  97. package/layers/raster/datasets/TIFFRaster.js +1 -1
  98. package/layers/support/Sublayer.js +1 -1
  99. package/layers/support/SubtypeSublayer.js +1 -1
  100. package/package.json +2 -2
  101. package/popup/FeaturesModel.d.ts +26 -5
  102. package/popup/FeaturesModel.js +1 -1
  103. package/rest/support/printTaskUtils.js +1 -1
  104. package/symbols/cim/CIMSymbolHelper.js +1 -1
  105. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
  106. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  107. package/views/2d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles2D.js +1 -1
  108. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  109. package/views/2d/layers/LayerView2D.js +1 -1
  110. package/views/2d/layers/features/FeatureSourceEventLog.js +1 -1
  111. package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
  112. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  113. package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
  114. package/views/2d/layers/features/sources/strategies/AFeatureTileLoadStrategy.js +1 -1
  115. package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
  116. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  117. package/views/2d/layers/features/support/FeatureSetReaderIndirect.js +1 -1
  118. package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
  119. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  120. package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
  121. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  122. package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
  123. package/views/3d/analysis/Viewshed/types.d.ts +3 -1
  124. package/views/3d/environment/Environment.d.ts +2 -2
  125. package/views/3d/environment/Environment.js +1 -1
  126. package/views/3d/environment/EnvironmentView.js +2 -0
  127. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  128. package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
  129. package/views/3d/layers/DynamicLayerView3D.js +1 -1
  130. package/views/3d/layers/FeatureLikeLayerViewBase3D.js +1 -1
  131. package/views/3d/layers/FlowSubView3D.js +1 -1
  132. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  133. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  134. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  135. package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
  136. package/views/3d/layers/MediaLayerView3D.js +1 -1
  137. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  138. package/views/3d/layers/RouteLayerView3D.js +1 -1
  139. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  140. package/views/3d/layers/SceneLayerView3D.js +1 -1
  141. package/views/3d/layers/TiledLayerView3D.js +1 -1
  142. package/views/3d/layers/VoxelLayerView3D.js +1 -1
  143. package/views/3d/layers/graphics/Graphics3DScaleVisibility.js +1 -1
  144. package/views/3d/layers/graphics/Labeler.js +1 -1
  145. package/views/3d/layers/support/FeatureTile.js +1 -1
  146. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  147. package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
  148. package/views/3d/layers/support/SampledGeometryMaxDistanceRatio.js +1 -1
  149. package/views/3d/support/elevationUpdateUtils.js +1 -1
  150. package/views/3d/support/popupHitTest.js +1 -1
  151. package/views/3d/terrain/TerrainRenderer.js +1 -1
  152. package/views/3d/webgl-engine/effects/WeatherFader.js +1 -1
  153. package/views/3d/webgl-engine/effects/clouds/CloudsComposition.js +1 -1
  154. package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
  155. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationColorQuantization.glsl.js +2 -2
  156. package/views/3d/webgl-engine/lib/EmissionComposite.js +1 -1
  157. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  158. package/views/SceneView.js +1 -1
  159. package/views/draw/Draw.d.ts +1 -1
  160. package/views/draw/support/InteractiveHandle.js +1 -1
  161. package/views/interactive/options/SnappingOptions.d.ts +1 -0
  162. package/views/interactive/options/TooltipOptions.d.ts +1 -0
  163. package/views/interactive/options/ViewOptions.d.ts +1 -0
  164. package/views/interactive/snapping/FeatureSnappingSourceInfo.js +1 -1
  165. package/views/interactive/support/Units.d.ts +1 -0
  166. package/views/interactive/tooltip/components/DrawHeaderActions.js +1 -1
  167. package/views/interactive/tooltip/components/ElevationModeSelect.js +1 -1
  168. package/views/layers/LayerView.js +1 -1
  169. package/views/layers/LineOfSightLayerView.d.ts +3 -4
  170. package/views/layers/ViewshedLayerView.d.ts +5 -6
  171. package/views/support/layerViewUtils.js +1 -1
  172. package/views/support/projectionUtils.js +1 -1
  173. package/widgets/BasemapLayerList.js +1 -1
  174. package/widgets/BatchAttributeForm.js +1 -1
  175. package/widgets/DirectionalPad.js +1 -1
  176. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  177. package/widgets/Editor.d.ts +10 -0
  178. package/widgets/Expand.js +1 -1
  179. package/widgets/FeatureForm.d.ts +2 -2
  180. package/widgets/FeatureForm.js +1 -1
  181. package/widgets/FeatureTable/FieldColumn.js +1 -1
  182. package/widgets/FeatureTable.js +1 -1
  183. package/widgets/Features/FeaturesDrillIn.js +1 -1
  184. package/widgets/Features.js +1 -1
  185. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  186. package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
  187. package/widgets/OrientedImageryViewer/components/SequentialNavigationUI.js +1 -1
  188. package/widgets/OrientedImageryViewer/components/SketchTools.js +1 -1
  189. package/widgets/PanoramicVideoViewer.js +1 -1
  190. package/widgets/Print.js +1 -1
  191. package/widgets/ScaleRangeSlider.js +1 -1
  192. package/widgets/Search/SearchResultRenderer.js +1 -1
  193. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  194. package/widgets/Sketch/SketchViewModel.d.ts +1 -1
  195. package/widgets/Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js +1 -1
  196. package/widgets/Sketch.d.ts +1 -1
  197. package/widgets/Track/TrackViewModel.d.ts +1 -1
  198. package/widgets/UtilityNetworkAssociations.js +1 -1
  199. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
  200. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeaturesDrillIn.js +1 -1
  201. package/widgets/UtilityNetworkTrace/types.d.ts +2 -2
  202. package/widgets/UtilityNetworkTrace.js +1 -1
  203. package/widgets/UtilityNetworkValidateTopology.js +1 -1
  204. package/widgets/ValuePicker.js +1 -1
  205. package/widgets/VideoPlayer/components/PlayerActionsGroup.js +1 -1
  206. package/widgets/VideoPlayer/components/PlayerControlsGroup.js +1 -1
  207. package/widgets/support/GridControls.js +1 -1
  208. package/widgets/support/PluginSettingsControls.js +1 -1
  209. package/widgets/support/SelectionToolbar.js +1 -1
  210. package/widgets/support/SnappingControls.js +1 -1
  211. package/widgets/support/componentsUtils.js +1 -1
  212. package/assets/esri/core/workers/chunks/00a600c71ceebe7bfeee.js +0 -1
  213. package/assets/esri/core/workers/chunks/00d24415bdeb0adae3df.js +0 -1
  214. package/assets/esri/core/workers/chunks/0193df3f9fb23633da87.js +0 -1
  215. package/assets/esri/core/workers/chunks/02d4f91652a79d2b637e.js +0 -1
  216. package/assets/esri/core/workers/chunks/07aa6d36f1006b6ab7ff.js +0 -1
  217. package/assets/esri/core/workers/chunks/107b025dc5b09465a78f.js +0 -1
  218. package/assets/esri/core/workers/chunks/1f43e06dcfe56229bb0f.js +0 -1
  219. package/assets/esri/core/workers/chunks/25d6c674b1c4829f040f.js +0 -1
  220. package/assets/esri/core/workers/chunks/25e6013e2c095629b236.js +0 -1
  221. package/assets/esri/core/workers/chunks/2a570ce6b99dac6ee996.js +0 -1
  222. package/assets/esri/core/workers/chunks/2c90f7a6432cd716db8b.js +0 -1
  223. package/assets/esri/core/workers/chunks/2e6a2f4d686b71249c0e.js +0 -1
  224. package/assets/esri/core/workers/chunks/303fde8f3459dde16555.js +0 -1
  225. package/assets/esri/core/workers/chunks/350540770781b281c39a.js +0 -1
  226. package/assets/esri/core/workers/chunks/3880d2c7fb14955d7f93.js +0 -1
  227. package/assets/esri/core/workers/chunks/3b017b718ea2d4ed498f.js +0 -1
  228. package/assets/esri/core/workers/chunks/43fc42405167a5537039.js +0 -1
  229. package/assets/esri/core/workers/chunks/4d82db661365daa513a6.js +0 -1
  230. package/assets/esri/core/workers/chunks/56851011276de0b3e318.js +0 -1
  231. package/assets/esri/core/workers/chunks/5f3ab77a79c408423fde.js +0 -1
  232. package/assets/esri/core/workers/chunks/633a9051580c5302d2f7.js +0 -1
  233. package/assets/esri/core/workers/chunks/6469c0d18d3663e7da4b.js +0 -1
  234. package/assets/esri/core/workers/chunks/65654e481cce9ae40e54.js +0 -1
  235. package/assets/esri/core/workers/chunks/669e39c3437d7273f0c7.js +0 -1
  236. package/assets/esri/core/workers/chunks/798a63653f82c0e842c5.js +0 -1
  237. package/assets/esri/core/workers/chunks/84fcbf7a1d04f01685d1.js +0 -1
  238. package/assets/esri/core/workers/chunks/8b54589f173259c1ba55.js +0 -1
  239. package/assets/esri/core/workers/chunks/8e511079918e2fd9261f.js +0 -1
  240. package/assets/esri/core/workers/chunks/95b82cbbe355266c65d7.js +0 -1
  241. package/assets/esri/core/workers/chunks/9673a9efec86040b8c13.js +0 -1
  242. package/assets/esri/core/workers/chunks/a010d2e4e34eb7bc1fec.js +0 -1
  243. package/assets/esri/core/workers/chunks/b05a41a60e30935644be.js +0 -1
  244. package/assets/esri/core/workers/chunks/bff767ec5bb4c0d6b324.js +0 -1
  245. package/assets/esri/core/workers/chunks/c906f984b2b6e7578c06.js +0 -1
  246. package/assets/esri/core/workers/chunks/d21257d2e2a37266c0f7.js +0 -1
  247. package/assets/esri/core/workers/chunks/d270cc9807161033686e.js +0 -1
  248. package/assets/esri/core/workers/chunks/de02a6a1f4810f99e9bb.js +0 -1
  249. package/assets/esri/core/workers/chunks/e5943f3a4bbc12c06c4d.js +0 -1
  250. package/assets/esri/core/workers/chunks/ec9a2425b4a498054a19.js +0 -1
  251. package/assets/esri/core/workers/chunks/f0a68d2900d24f56afa0.js +0 -1
  252. package/assets/esri/core/workers/chunks/f0aaa646b17ffdbdcefa.js +0 -1
  253. package/assets/esri/core/workers/chunks/f46a0d7cf588ba1b4157.js +0 -1
  254. package/assets/esri/core/workers/chunks/f762f70e7d39634ce797.js +0 -1
  255. package/assets/esri/core/workers/chunks/fccbb902fe08448f91de.js +0 -1
  256. package/assets/esri/core/workers/chunks/fd0254c6fc6c03ec11ba.js +0 -1
  257. package/views/3d/environment/EnvironmentManager.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Collection.js";import n from"../../../core/CollectionFlattener.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{initial as i,when as a,watch as o}from"../../../core/reactiveUtils.js";import{property as s,subclass as c}from"../../../core/accessorSupport/decorators.js";import{projectAsync as l}from"../../../geometry/projectionUtils.js";import u from"../../../rest/support/DirectionLine.js";import d from"../../../rest/support/DirectionPoint.js";import f from"../../../rest/support/PointBarrier.js";import p from"../../../rest/support/PolygonBarrier.js";import m from"../../../rest/support/PolylineBarrier.js";import h from"../../../rest/support/RouteInfo.js";import g from"../../../rest/support/Stop.js";import{LayerView3D as _}from"./LayerView3D.js";import{GraphicsProcessor as v}from"./graphics/GraphicsProcessor.js";import{LayerViewPerformanceInfo as y}from"./support/LayerViewPerformanceInfo.js";import{EventedSet as b}from"../support/EventedSet.js";import x from"../../layers/LayerView.js";import{getHighlightName as S}from"../../support/highlightOptionsUtils.js";import{hasLayerBasedScaleVisibility as C,isInEffectiveScaleRange as w}from"../../support/layerViewUtils.js";function T(e){return e instanceof u||e instanceof d||e instanceof f||e instanceof p||e instanceof m||e instanceof h||e instanceof g}let E=class extends _(x){constructor(){super(...arguments),this.type=`route-3d`,this.loadedGraphics=new b,this._networkFeatureToGraphic=new Map,this._graphicToNetworkFeature=new Map,this.slicePlaneEnabled=!1,this.fullExtentInLocalViewSpatialReference=null}initialize(){this._set(`processor`,new v({owner:this,scaleVisibilityEnabled:!0,frustumVisibilityEnabled:!0})),this.addResolvingPromise(this.processor.initializePromise),this._updatingHandles.addOnCollectionChange(()=>this._routeItems,e=>this._routeItemsChanged(e),i),this.view.viewingMode===`local`&&this.addResolvingPromise((async()=>this.fullExtentInLocalViewSpatialReference=await l(this.layer.fullExtent,this.view.spatialReference).catch(()=>null))()),this.addHandles(a(()=>this.view?.groundView?.ready,()=>()=>this.notifyChange(`updating`),{once:!0}))}destroy(){this._updatingHandles.removeAll(),this._networkFeatureToGraphic.clear(),this._graphicToNetworkFeature.clear(),this._set(`processor`,r(this.processor)),this._get(`_routeItems`)?.destroy()}get _routeItems(){return new n({getCollections:()=>[this.layer.pointBarriers,this.layer.polygonBarriers,this.layer.polylineBarriers,this.layer.stops,this.layer.directionLines,this.layer.directionPoints,this.layer.routeInfo==null?null:new t([this.layer.routeInfo])]})}_routeItemsChanged(e){if(e.removed.length){this.loadedGraphics.removeMany(e.removed.map(e=>{let t=this._networkFeatureToGraphic.get(e);return this._networkFeatureToGraphic.delete(e),this._graphicToNetworkFeature.delete(t),t}));for(let t of e.removed)this.removeHandles(t)}if(e.added.length){this.loadedGraphics.addMany(e.added.map(e=>{let t=e.toGraphic();return this._networkFeatureToGraphic.set(e,t),this._graphicToNetworkFeature.set(t,e),t}));for(let t of e.added)this.addHandles([o(()=>t.geometry,(e,n)=>{this._updateGraphic(t,`geometry`,e,n)}),o(()=>t.symbol,(e,n)=>{this._updateGraphic(t,`symbol`,e,n)})],t)}}get legendEnabled(){return this.canResume()&&!this.processor?.frustumVisibilitySuspended}get visibleAtCurrentScale(){return C()?w(this.layer.effectiveScaleRange,this.view.scale):!this.processor?.scaleVisibilitySuspended}getSuspendInfo(){let e=super.getSuspendInfo();return e.outsideOfView=this.processor?.frustumVisibilitySuspended??!1,e}getHit(e){let t=this.processor.getHit(e,null);if(t?.type===`graphic`){let e=this._graphicToNetworkFeature.get(t.graphic);if(e)return{type:`route`,layer:this.layer,networkFeature:e}}return null}whenGraphicBounds(e,t){return this.processor.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.processor?.computeAttachmentOrigin(e,t)}getSymbolLayerSize(e,t){return this.processor.getSymbolLayerSize(e,t)}async queryGraphics(){return new t(this.loadedGraphics.toArray())}maskOccludee(e){return this.processor.maskOccludee(e)}highlight(e,t){return T(e)&&(e=this._networkFeatureToGraphic.get(e)),this.processor.highlight(e,S(t))}notifyContentGeometryUpdate(){this.emit(`visible-geometry-changed`)}get updatePolicy(){return this.processor?.graphicsCore.effectiveUpdatePolicy||1}isUpdating(){return!(!this.processor?.updating&&this.view?.groundView?.ready)}get performanceInfo(){return new y(this.processor?.graphicsCore.usedMemory??0,this.loadedGraphics.length,-1,-1,0,this.processor?.graphicsCore.performanceInfo??null)}_updateGraphic(e,t,n,r){let i=this._networkFeatureToGraphic.get(e);i[t]=n,D.graphic=i,D.property=t,D.oldValue=r,D.newValue=n,this.processor?.graphicsCore.graphicUpdateHandler(D),D.graphic=null}};e([s()],E.prototype,`_routeItems`,null),e([s()],E.prototype,`loadedGraphics`,void 0),e([s({readOnly:!0})],E.prototype,`legendEnabled`,null),e([s({readOnly:!0})],E.prototype,`visibleAtCurrentScale`,null),e([s()],E.prototype,`layer`,void 0),e([s({readOnly:!0})],E.prototype,`processor`,void 0),e([s({type:Boolean})],E.prototype,`slicePlaneEnabled`,void 0),E=e([c(`esri.views.3d.layers.RouteLayerView3D`)],E);const D={graphic:null,property:null,oldValue:null,newValue:null},O=E;export{O as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Collection.js";import n from"../../../core/CollectionFlattener.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{initial as i,when as a,watch as o}from"../../../core/reactiveUtils.js";import{property as s,subclass as c}from"../../../core/accessorSupport/decorators.js";import{projectAsync as l}from"../../../geometry/projectionUtils.js";import{isInEffectiveScaleRange as u}from"../../../geometry/support/scaleUtils.js";import d from"../../../rest/support/DirectionLine.js";import f from"../../../rest/support/DirectionPoint.js";import p from"../../../rest/support/PointBarrier.js";import m from"../../../rest/support/PolygonBarrier.js";import h from"../../../rest/support/PolylineBarrier.js";import g from"../../../rest/support/RouteInfo.js";import _ from"../../../rest/support/Stop.js";import{LayerView3D as v}from"./LayerView3D.js";import{GraphicsProcessor as y}from"./graphics/GraphicsProcessor.js";import{LayerViewPerformanceInfo as b}from"./support/LayerViewPerformanceInfo.js";import{EventedSet as x}from"../support/EventedSet.js";import S from"../../layers/LayerView.js";import{getHighlightName as C}from"../../support/highlightOptionsUtils.js";import{hasLayerBasedScaleVisibility as w}from"../../support/layerViewUtils.js";function T(e){return e instanceof d||e instanceof f||e instanceof p||e instanceof m||e instanceof h||e instanceof g||e instanceof _}let E=class extends v(S){constructor(){super(...arguments),this.type=`route-3d`,this.loadedGraphics=new x,this._networkFeatureToGraphic=new Map,this._graphicToNetworkFeature=new Map,this.slicePlaneEnabled=!1,this.fullExtentInLocalViewSpatialReference=null}initialize(){this._set(`processor`,new y({owner:this,scaleVisibilityEnabled:!0,frustumVisibilityEnabled:!0})),this.addResolvingPromise(this.processor.initializePromise),this._updatingHandles.addOnCollectionChange(()=>this._routeItems,e=>this._routeItemsChanged(e),i),this.view.viewingMode===`local`&&this.addResolvingPromise((async()=>this.fullExtentInLocalViewSpatialReference=await l(this.layer.fullExtent,this.view.spatialReference).catch(()=>null))()),this.addHandles(a(()=>this.view?.groundView?.ready,()=>()=>this.notifyChange(`updating`),{once:!0}))}destroy(){this._updatingHandles.removeAll(),this._networkFeatureToGraphic.clear(),this._graphicToNetworkFeature.clear(),this._set(`processor`,r(this.processor)),this._get(`_routeItems`)?.destroy()}get _routeItems(){return new n({getCollections:()=>[this.layer.pointBarriers,this.layer.polygonBarriers,this.layer.polylineBarriers,this.layer.stops,this.layer.directionLines,this.layer.directionPoints,this.layer.routeInfo==null?null:new t([this.layer.routeInfo])]})}_routeItemsChanged(e){if(e.removed.length){this.loadedGraphics.removeMany(e.removed.map(e=>{let t=this._networkFeatureToGraphic.get(e);return this._networkFeatureToGraphic.delete(e),this._graphicToNetworkFeature.delete(t),t}));for(let t of e.removed)this.removeHandles(t)}if(e.added.length){this.loadedGraphics.addMany(e.added.map(e=>{let t=e.toGraphic();return this._networkFeatureToGraphic.set(e,t),this._graphicToNetworkFeature.set(t,e),t}));for(let t of e.added)this.addHandles([o(()=>t.geometry,(e,n)=>{this._updateGraphic(t,`geometry`,e,n)}),o(()=>t.symbol,(e,n)=>{this._updateGraphic(t,`symbol`,e,n)})],t)}}get legendEnabled(){return this.canResume()&&!this.processor?.frustumVisibilitySuspended}get visibleAtCurrentScale(){return w()?u(this.layer.effectiveScaleRange,this.view.scale):!this.processor?.scaleVisibilitySuspended}getSuspendInfo(){let e=super.getSuspendInfo();return e.outsideOfView=this.processor?.frustumVisibilitySuspended??!1,e}getHit(e){let t=this.processor.getHit(e,null);if(t?.type===`graphic`){let e=this._graphicToNetworkFeature.get(t.graphic);if(e)return{type:`route`,layer:this.layer,networkFeature:e}}return null}whenGraphicBounds(e,t){return this.processor.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.processor?.computeAttachmentOrigin(e,t)}getSymbolLayerSize(e,t){return this.processor.getSymbolLayerSize(e,t)}async queryGraphics(){return new t(this.loadedGraphics.toArray())}maskOccludee(e){return this.processor.maskOccludee(e)}highlight(e,t){return T(e)&&(e=this._networkFeatureToGraphic.get(e)),this.processor.highlight(e,C(t))}notifyContentGeometryUpdate(){this.emit(`visible-geometry-changed`)}get updatePolicy(){return this.processor?.graphicsCore.effectiveUpdatePolicy||1}isUpdating(){return!(!this.processor?.updating&&this.view?.groundView?.ready)}get performanceInfo(){return new b(this.processor?.graphicsCore.usedMemory??0,this.loadedGraphics.length,-1,-1,0,this.processor?.graphicsCore.performanceInfo??null)}_updateGraphic(e,t,n,r){let i=this._networkFeatureToGraphic.get(e);i[t]=n,D.graphic=i,D.property=t,D.oldValue=r,D.newValue=n,this.processor?.graphicsCore.graphicUpdateHandler(D),D.graphic=null}};e([s()],E.prototype,`_routeItems`,null),e([s()],E.prototype,`loadedGraphics`,void 0),e([s({readOnly:!0})],E.prototype,`legendEnabled`,null),e([s({readOnly:!0})],E.prototype,`visibleAtCurrentScale`,null),e([s()],E.prototype,`layer`,void 0),e([s({readOnly:!0})],E.prototype,`processor`,void 0),e([s({type:Boolean})],E.prototype,`slicePlaneEnabled`,void 0),E=e([c(`esri.views.3d.layers.RouteLayerView3D`)],E);const D={graphic:null,property:null,oldValue:null,newValue:null},O=E;export{O as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{estimateNumberArrayMemory as r}from"../../../core/memoryEstimations.js";import{throwIfAborted as i}from"../../../core/promiseUtils.js";import{initial as a,watch as o,sync as s}from"../../../core/reactiveUtils.js";import{generateUID as c}from"../../../core/uid.js";import{property as l,subclass as u}from"../../../core/accessorSupport/decorators.js";import{set as d}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as f,create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBuffer as m}from"../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as h}from"../../../geometry/projection/projectVectorToVector.js";import{extentContainsCoords3D as g,extentContainsCoords2D as ee}from"../../../geometry/support/contains.js";import{newDoubleArray as _,doubleArrayFrom as te}from"../../../geometry/support/DoubleArray.js";import{getGeometryZScaler as v}from"../../../geometry/support/zscale.js";import{fallbackObjectIDAttribute as y}from"../../../layers/LayerConstants.js";import{estimateSize as b}from"../../../layers/graphics/dehydratedFeatures.js";import{ImmutableDehydratedPoint as ne}from"../../../layers/graphics/dehydratedPoint.js";import{hydrateGraphic as re}from"../../../layers/graphics/hydratedFeatures.js";import ie from"../../../layers/graphics/controllers/I3SOnDemandController.js";import ae from"../../../layers/support/FeatureFilter.js";import{I3SExtractChanges as oe}from"../../../layers/support/I3SExtractChanges.js";import x from"../../../rest/support/Query.js";import{isBasemapLayerView as se}from"../../../support/basemapUtils.js";import{isGraphic as ce}from"../../../support/graphicInstanceUtils.js";import{I3SPointsWorkerHandle as S}from"./I3SPointsWorkerHandle.js";import{LayerView3D as le}from"./LayerView3D.js";import{Graphics3DFeatureProcessor as C}from"./graphics/Graphics3DFeatureProcessor.js";import{QueryEngine as w}from"./graphics/QueryEngine.js";import{QueryEngineContext as T}from"./graphics/QueryEngineContext.js";import{createInteractiveEditSession as E,normalizeEditResultsEvent as D,processAttributeEdits as O}from"./i3s/featureEditing.js";import{getCachedAttributeValue as k}from"./i3s/I3SBinaryReader.js";import{I3SGraphicsMap as A}from"./i3s/I3SGraphicsMap.js";import{I3SOverrides as j}from"./i3s/I3SOverrides.js";import{checkRecyclable as M,checkSpatialReferences as N,containsDraco as P,whenGraphicAttributes as F}from"./i3s/I3SUtil.js";import{attributeLookup as I}from"./support/attributeUtils.js";import{DefinitionExpressionSceneLayerView as L}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as R}from"./support/fieldProperties.js";import{normalizeHighlightTarget as z,emptyHighlightHandle as B,isObjectId as V}from"./support/highlightUtils.js";import{LayerViewPerformanceInfo as H}from"./support/LayerViewPerformanceInfo.js";import{PopupSceneLayerView as ue}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as U}from"./support/SceneLayerViewRequiredFields.js";import{TemporalSceneLayerView as de}from"./support/TemporalSceneLayerView.js";import{debugFlags as W}from"../support/debugFlags.js";import{compute as fe}from"../support/orientedBoundingBox.js";import{updatingProgress as pe}from"../support/updatingProperties.js";import{Vertices as me}from"../webgl-engine/lib/Attribute.js";import he from"../../layers/SceneLayerView.js";import{hasPopupTemplate as ge}from"../../layers/support/popupUtils.js";import{getHighlightName as _e}from"../../support/highlightOptionsUtils.js";import{hasLayerBasedScaleVisibility as G,isInEffectiveScaleRange as ve}from"../../support/layerViewUtils.js";import{TaskPriority as ye}from"../../support/Scheduler.js";const K=R();class be{constructor(e,t,n,r){this.graphics=e,this.featureIds=t,this.attributeInfo=n,this.node=r}get usedMemory(){return this.graphics.reduce((e,t)=>b(t)+e,r(this.featureIds)+1024)}}let q=class extends de(L(ue(le(he)))){constructor(){super(...arguments),this.type=`scene-layer-graphics-3d`,this._queryEngine=null,this._memCache=null,this._interactiveEditingSessions=new Map,this._pendingEditsQueue=Promise.resolve(),this.loadedGraphics=new A((e,t,n)=>Ce(e,t,n),e=>this.processor.graphicsCore.recreateGraphics(e),this.logError),this.holeFilling=`always`,this.progressiveLoadFactor=1,this.supportsHeightUnitConversion=!0,this._coordinatesOutsideExtentErrors=0,this._maxCoordinatesOutsideExtentErrors=20}tryRecycleWith(e,t){return e.url!==this.layer.url||!this._i3sOverrides.isEmpty?null:e.load(t).then(()=>{i(t),M(this.layer,e,this._i3sOverrides),this.layer=e,this._reinitializeOverrides(),n(this._queryEngine),this._setupQueryEngine(),this.processor.resetObjectStates()})}initialize(){this.addResolvingPromise(this.layer.indexInfo),this._reinitializeOverrides(),N(this.layer,this.view.spatialReference,this.view.viewingMode),this._fieldsHelper=new U({layerView:this}),this._updatingHandles.add(()=>this.layer.rangeInfos,e=>this._rangeInfosChanged(e),a),this._updatingHandles.add(()=>this.layer.renderer,(e,t)=>this._rendererChange(e,t)),this._updatingHandles.add(()=>[this.parsedDefinitionExpression,this.layer.excludeObjectIds],()=>this._filterChange()),this._set(`processor`,new C({owner:this,preferredUpdatePolicy:0,scaleVisibilityEnabled:!G(),filterVisibilityEnabled:!0,timeExtentEnabled:!1,frustumVisibilityEnabled:!1,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!1,setUidToIdOnAdd:!1,dataExtent:this.layer.fullExtent,updateClippingExtent:e=>this._updateClippingExtent(e)})),this.processor.elevationAlignment?.events.on(`invalidate-elevation`,({extent:e,spatialReference:t})=>this._controller.updateElevationChanged(e,t)),this.supportsHeightUnitConversion&&(this._verticalScale=v(`point`,this.layer.spatialReference,this.view.spatialReference)),this.addResolvingPromise(this.processor.when()),this._memCache=this.view.resourceController.memoryController.newCache(`psl-${this.uid}`),this._controller=new ie({layerView:this}),P(this.layer.geometryDefinitions)&&(this._workerHandle=new S(e=>this.view.resourceController.immediate.schedule(e))),this.addHandles(this.layer.on(`apply-edits`,e=>this._updatingHandles.addPromise(e.result))),this.addHandles([this.layer.on(`edits`,e=>{let t=this._pendingEditsQueue.then(()=>this._handleEdits(e)).then();this._pendingEditsQueue=t,this._updatingHandles.consumePromise(t)}),o(()=>W.I3S_TREE_SHOW_TILES,e=>{if(e&&!this._treeDebugger){let e=this._controller.crsIndex;import(`./support/I3STreeDebugger.js`).then(({I3STreeDebugger:t})=>{!this._treeDebugger&&W.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))})}else!e&&this._treeDebugger&&!W.I3S_TREE_SHOW_TILES&&(this._treeDebugger.destroy(),this._treeDebugger=null)},a)]),this.when(()=>{this._setupQueryEngine(),this._updatingHandles.add(()=>this.availableFields,()=>this._queryEngine?.clear(),s),this._updatingHandles.add(()=>this.maximumNumberOfFeatures,e=>this._controller.featureTarget=e,a),this._updatingHandles.add(()=>this.suspended,e=>{e&&this._removeAllNodeData()})}).catch(()=>{})}_reinitializeOverrides(){this._i3sOverrides?.destroy(),this._extractChanges?.destroy();let{layer:e}=this,t=this.view.resourceController?.memoryController;this._extractChanges=new oe({layer:e}),this._i3sOverrides=new j({view:this.view,layer:e,memoryController:t,extractChanges:this._extractChanges})}destroy(){this._treeDebugger=n(this._treeDebugger),this._i3sOverrides=n(this._i3sOverrides),this._extractChanges=n(this._extractChanges),this._set(`processor`,n(this.processor)),this._controller=n(this._controller),this._queryEngine=n(this._queryEngine),this._workerHandle=n(this._workerHandle),this._memCache=n(this._memCache),this.loadedGraphics.clear(),this._fieldsHelper=n(this._fieldsHelper)}get layerViewUid(){return this.uid}get updatingProgressValue(){return this._controller?.updatingProgress??1}get visibleAtCurrentScale(){return G()?ve(this.layer.effectiveScaleRange,this.view.scale):!this.processor?.scaleVisibilitySuspended}get requiredFields(){return this._fieldsHelper?.requiredFields??[]}get maximumNumberOfFeatures(){return this.processor?.graphicsCore?.displayFeatureLimit?.maximumNumberOfFeatures??0}set maximumNumberOfFeatures(e){e==null?(this._clearOverride(`maximumNumberOfFeatures`),this._controller.fixedFeatureTarget=!1):(this._override(`maximumNumberOfFeatures`,e),this._controller.fixedFeatureTarget=!0)}get maximumNumberOfFeaturesExceeded(){return!this.suspended&&!!this._controller?.useMaximumNumberOfFeatures&&!this._controller.leavesReached}get _excludeObjectIds(){return new Set(this.layer.excludeObjectIds)}get lodFactor(){return this.layer.semantic===`Labels`?1:this.view.qualitySettings.sceneService.pointLoDFactor}get hasM(){return!1}get hasZ(){return!0}get contentVisible(){return!this.suspended&&!!this._controller?.rootNodeVisible}get legendEnabled(){return this.contentVisible&&this.layer?.legendEnabled===!0}get _graphicOrigin(){return this.layer.graphicOrigin}async whenGraphicAttributes(e,t){return F(this.layer,e,this._getObjectIdField(),t,()=>[...this.loadedGraphics.nodes()])}getHit(e){if(!this.loadedGraphics)return null;let t=re(this.loadedGraphics.find(t=>t.uid===e),this.layer,this._graphicOrigin),n=this._getObjectIdField();return t?.attributes?.[n]==null?null:{type:`graphic`,graphic:t,layer:t.layer}}whenGraphicBounds(e,t){return this.processor.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.processor.computeAttachmentOrigin(e,t)}isUpdating(){return!!(this._controller?.updating||this.processor?.updating||this._fieldsHelper?.updating||this.layerFilterUpdating)}highlight(e,t){let n=_e(t),r=this.layer.objectIdField,i=z(e);if(i.length===0)return B;if(ce(i[0])){let e=i;if(I(this.layer.fieldsIndex,e[0].attributes,r)!=null){let t=e.map(e=>I(this.layer.fieldsIndex,e.attributes,r));return this.processor.highlightByObjectIds(t,r,n)}return this.processor.highlightByGraphics(e,n)}return V(i[0])?this.processor.highlightByObjectIds(i,r,n):B}get updatePolicy(){return this.processor.graphicsCore.effectiveUpdatePolicy}createInteractiveEditSession(e){return E(this._attributeEditingContext,e)}async _decompressBinaryPointData(e,t){let n={geometryBuffer:e.geometryBuffer};this._workerHandle??=new S(e=>this.view.resourceController.immediate.schedule(e));let r=await this._workerHandle.invoke(n,t);if(r==null)throw Error(`Failed to decompress Draco point data`);return{positionData:r.positions,featureIds:r.featureIds}}async addNode(e,n,r){if(!J(n)&&!Se(n))throw Error();if(this.loadedGraphics.hasNode(e.index)){t.getLogger(this).error(`I3S node `+e.id+` already added`);return}let i=this.layer.fullExtent==null?null:X(this.layer.fullExtent.clone(),.5),{featureIds:a,pointPositions:o}=J(n)?await this._extractBinaryPointPositions(e,n,r):this._extractLegacyPointPositions(n),s=[];this._validatePositions(e,a,o,i,s);let c=this._controller.crsVertex,l=this.view.spatialReference;m(o,c,0,o,l,0,a.length);let u=J(n)?e.level:0,d=this._createGraphics(a,o,e.index,u),f=new be(d,a,n.attributeDataInfo,e);if(await this._i3sOverrides.applyAttributeOverrides(f.featureIds,n.attributeDataInfo,r),e.numFeatures=f.graphics.length,this._updateNodeMemory(e),Y(f),s.length>0&&(this._computeObb(e,s,c),this._controller.updateVisibility(e.index)),!this._controller.isGeometryVisible(e)){this._cacheNodeData(f);return}if(this._verticalScale!=null)for(let e of f.graphics)this._verticalScale(e.geometry);let p=this.view.stage.renderView.olidRenderHelper;if(p){let e=se(this.view,this.uid);for(let t=0;t<f.featureIds.length;t++){let n=f.featureIds[t];p.setUidToObjectAndLayerId(n,f.graphics[t].uid,this.layer.id,this.uid,this.layer.popupEnabled&&!e&&ge(this.layer,this.view.popup?.defaultPopupTemplateEnabled),f.node.resources.attributes,t)}}this.loadedGraphics.addNode(e.index,f),this._controller.updateLoadStatus(e.index,!0),this._filterNode(f),this._treeDebugger&&this._treeDebugger.update()}_computeObb(e,t,n){let r=this._controller.crsIndex,i=r.isGeographic?this.view.renderSpatialReference:r;m(t,n,0,t,i,0),e.serviceObbInIndexSR=fe(new me(t,3)),r.isGeographic&&(h(e.serviceObbInIndexSR.getCenter(Z),i,Z,r),e.serviceObbInIndexSR.setCenter(Z))}isNodeLoaded(e){return this.loadedGraphics.hasNode(e)}isNodeReloading(){return!1}updateNodeState(){}getNodeComponentHandle(){}async _extractBinaryPointPositions(e,t,n){let r=await this._decompressBinaryPointData(t,n),i=r.positionData,a=i.length/3,o=_(a*3),s=e.serviceObbInIndexSR==null?f:e.serviceObbInIndexSR.getCenter(Te),c=Math.abs(s[2])*2**-20;for(let e=0;e<a;e++){let t=e*3;o[t]=i[t]+s[0],o[t+1]=i[t+1]+s[1],o[t+2]=i[t+2]+s[2],Math.abs(o[t+2])<c&&(o[t+2]=0)}return{featureIds:r.featureIds?te(r.featureIds):[],pointPositions:o}}_extractLegacyPointPositions(e){let t=e.pointData.length,n=_(3*t),r=[];for(let i=0;i<t;i++){let t=e.pointData[i],a=t.featureDataPosition,o=a.length,s=t.geometries?.[0]??we[o],c=t.featureIds[0];if(s.type!==`Embedded`||s.params.type!==`points`||o<2||o>3)continue;let l=s.params.vertexAttributes?.position??[0,0,0],u=r.length*3;n[u]=a[0]+l[0],n[u+1]=a[1]+l[1],n[u+2]=o===3?a[2]+l[2]:NaN,r.push(c)}return{featureIds:r,pointPositions:n}}_validatePositions(e,n,r,i,a){if(i==null&&e.serviceObbInIndexSR)return;let o=n.length;for(let n=0;n<o;n++){let o=n*3;d(Z,r[o],r[o+1],r[o+2]);let s=!Number.isNaN(r[2]);i!=null&&(s?!g(i,Z):!ee(i,Z))&&(this._coordinatesOutsideExtentErrors<this._maxCoordinatesOutsideExtentErrors&&t.getLogger(this).error(`Service Error: Coordinates outside of layer extent`),this._coordinatesOutsideExtentErrors+1===this._maxCoordinatesOutsideExtentErrors&&t.getLogger(this).error(`Maximum number of errors reached. Further errors are ignored.`),this._coordinatesOutsideExtentErrors++),e.serviceObbInIndexSR||a.push(Z[0],Z[1],Z[2])}}_createGraphics(e,t,n,r){let i=e.length,a=this._getObjectIdField(),o=this.processor.graphicsCore,s=[],l=this.view.spatialReference;for(let u=0;u<i;u++){let i=e[u],d={};i!=null&&(d[a]=i);let f=i??c(),p=u*3,m=isNaN(t[p+2])?void 0:t[p+2],h=new ne(l,t[p],t[p+1],m),g=this.loadedGraphics.get(f);if(g!=null)(g.level==null||g.level<r)&&(Q.property=`geometry`,Q.graphic=g,Q.oldValue=g.geometry,Q.newValue=h,g.geometry=h,g.level=r,o.graphicUpdateHandler(Q),$()),s.push(g);else{let e=c();s.push({objectId:f,uid:e,geometry:h,attributes:d,visible:!0,nodeIndex:n,level:r})}}return s}_updateNodeMemory(e){e.memory=4096+(e.numFeatures??0)*this.processor.graphicsCore.usedMemoryPerGraphic}_cacheNodeData(e){this._memCache.put(this._getMemCacheKey(e.node),e)}_getMemCacheKey(e){return`${e.index}`}_removeAllNodeData(){this.loadedGraphics.forEachNode((e,t)=>{if(e){let t=e.node;this._updateNodeMemory(t),this._cacheNodeData(e)}this._controller.updateLoadStatus(t,!1)}),this._treeDebugger&&this._treeDebugger.update(),this.loadedGraphics.clear()}removeNode(e){let t=this._removeNodeStageData(e);t&&(this._updateNodeMemory(t.node),this._cacheNodeData(t))}_removeNodeStageData(e){let t=this.loadedGraphics.getNode(e);return t==null?null:(this._controller.updateLoadStatus(e,!1),this.loadedGraphics.removeNode(e),this._treeDebugger&&this._treeDebugger.update(),t)}async loadCachedNodeData(e){return this._memCache?.pop(this._getMemCacheKey(e))}async addCachedNodeData(e,n,r,i){this.loadedGraphics.hasNode(e.index)?t.getLogger(this).error(`I3S node `+e.id+` already added`):(await this._i3sOverrides.applyAttributeOverrides(n.featureIds,r,i),n.attributeInfo=r,this.loadedGraphics.addNode(e.index,n),this._controller.updateLoadStatus(e.index,!0),this._updateNodeMemory(e),Y(n),this._filterNode(n),this._treeDebugger&&this._treeDebugger.update())}getLoadedNodeIds(){let e=[];return this.loadedGraphics.forEachNode(t=>e.push(t.node.id)),e.sort()}getVisibleNodes(){let e=[];return this.loadedGraphics.forEachNode(t=>e.push(t.node)),e}getLoadedNodeIndices(e){this.loadedGraphics.forEachNode((t,n)=>e.push(n))}getLoadedAttributes(e){let t=this.loadedGraphics.getNode(e);if(t?.attributeInfo!=null)return t.attributeInfo.loadedAttributes}getAttributeData(e){let t=this.loadedGraphics.getNode(e);if(t?.attributeInfo!=null)return t.attributeInfo.attributeData}_setAttributeData(e,t){let n=this.loadedGraphics.getNode(e);n?.attributeInfo!=null&&(n.attributeInfo.attributeData=t,this._attributeValuesChanged(n))}async updateAttributes(e,t,n){let r=this.loadedGraphics.getNode(e);r!=null&&(await this._i3sOverrides.applyAttributeOverrides(r.featureIds,t,n),r.attributeInfo=t,this._attributeValuesChanged(r))}_attributeValuesChanged(e){Y(e),this._filterNode(e);let{processor:t}=this,{graphicsCore:n}=t;if(n.labelsEnabled){let t=e.node.index,r=[];e.graphics.forEach(e=>e.nodeIndex===t&&r.push(e.uid)),n.updateLabelingInfo(r)}t.refreshFilter()}_updateClippingExtent(e){return this._controller&&this._controller.updateClippingArea(e),!1}_getObjectIdField(){return this.layer.objectIdField||y}_getGlobalIdField(){return this.layer.globalIdField}async _rendererChange(e,t){let{layer:{fieldsIndex:n}}=this,r=new Set,i;e?(await e.collectRequiredFields(r,n),i=Array.from(r).sort()):i=[],r.clear();let a;t?(await t.collectRequiredFields(r,n),a=Array.from(r).sort()):a=[],!(i.length===a.length&&i.every((e,t)=>i[t]===a[t]))&&this._reloadAllNodes()}_rangeInfosChanged(e){e!=null&&e.length>0&&t.getLogger(this).warn(`Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.`)}_filterChange(){this.loadedGraphics.forEachNode(e=>this._filterNode(e))}_reloadAllNodes(){this._removeAllNodeData(),this._controller&&this._controller.restartNodeLoading()}_filterNode(e){let t=this.parsedDefinitionExpression,n=this._excludeObjectIds,r=this._getObjectIdField();for(let i of e.graphics){let e=i.visible,a=this._evaluateClause(t,i),o=!n.has(i.attributes[r]);i.visible=a&&o,e!==i.visible&&(Q.graphic=i,Q.property=`visible`,Q.oldValue=e,Q.newValue=i.visible,this.processor.graphicsCore.graphicUpdateHandler(Q),$())}}createQuery(){let e={outFields:[`*`],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return this.filter?.createQuery(e)??new x(e)}queryFeatures(e,t){return this._queryEngine.executeQuery(this._ensureQuery(e),t?.signal)}queryObjectIds(e,t){return this._queryEngine.executeQueryForIds(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this._queryEngine.executeQueryForCount(this._ensureQuery(e),t?.signal)}queryExtent(e,t){return this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t?.signal)}_ensureQuery(e){return this._addDefinitionExpressionToQuery(e==null?this.createQuery():x.from(e))}_setupQueryEngine(){let{layer:e,view:t,hasM:n,hasZ:r}=this,{spatialReference:i,resourceController:a}=t,o=new T(i,e,a,()=>this.processor.featureStore,r,n,()=>this.availableFields);this._queryEngine=new w({context:o,priority:ye.FEATURE_QUERY_ENGINE})}get usedMemory(){return this.processor?.graphicsCore?.usedMemory??0}get unloadedMemory(){return((this._controller?.unloadedMemoryEstimate??0)+(this.processor?.graphicsCore?.unprocessedMemoryEstimate??0))*.8}get ignoresMemoryFactor(){return this._controller&&this._controller.fixedFeatureTarget}async _handleEdits(e){let t=this._attributeEditingContext,n=await D(t,e);O(t,n)}get _attributeEditingContext(){let e=this._getObjectIdField(),t=this._getGlobalIdField();return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:e,globalIdField:t,forEachNode:e=>this.loadedGraphics.forEachNode(t=>e(t.node,t.featureIds)),attributeStorageInfo:this.layer.attributeStorageInfo??[],i3sOverrides:this._i3sOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(t,n,r)=>{this._setAttributeData(t,n);let i=this.loadedGraphics.getNode(t);if(r!=null){let t=this.loadedGraphics.get(r.attributes[e]);t!=null&&this.processor.graphicsCore.recreateGraphics([t])}else i!=null&&this.processor.graphicsCore.recreateGraphics(i.graphics)},clearMemCache:()=>{}}}get performanceInfo(){return new H(this.usedMemory,this.loadedGraphics.length,-1,this.maximumNumberOfFeatures,this.loadedGraphics.nodeCount,this.processor.graphicsCore.performanceInfo)}get test(){}};e([l()],q.prototype,`processor`,void 0),e([l({type:ae})],q.prototype,`filter`,void 0),e([l()],q.prototype,`loadedGraphics`,void 0),e([l()],q.prototype,`layerViewUid`,null),e([l()],q.prototype,`_controller`,void 0),e([l()],q.prototype,`updating`,void 0),e([l()],q.prototype,`suspended`,void 0),e([l(pe)],q.prototype,`updatingProgress`,void 0),e([l()],q.prototype,`updatingProgressValue`,null),e([l({readOnly:!0})],q.prototype,`visibleAtCurrentScale`,null),e([l(K.requiredFields)],q.prototype,`requiredFields`,null),e([l(K.availableFields)],q.prototype,`availableFields`,void 0),e([l()],q.prototype,`_fieldsHelper`,void 0),e([l({type:Number})],q.prototype,`maximumNumberOfFeatures`,null),e([l({readOnly:!0})],q.prototype,`maximumNumberOfFeaturesExceeded`,null),e([l()],q.prototype,`_excludeObjectIds`,null),e([l({readOnly:!0})],q.prototype,`lodFactor`,null),e([l({readOnly:!0})],q.prototype,`hasM`,null),e([l({readOnly:!0})],q.prototype,`hasZ`,null),e([l()],q.prototype,`contentVisible`,null),e([l({readOnly:!0})],q.prototype,`legendEnabled`,null),e([l()],q.prototype,`_graphicOrigin`,null),q=e([u(`esri.views.3d.layers.SceneLayerGraphicsView3D`)],q);const xe=q;function Se(e){return`pointData`in e}function J(e){return`geometryBuffer`in e&&e.geometryBuffer!==null}function Ce(e,t,n){let r=t.attributeInfo;if(r?.loadedAttributes==null||r.attributeData==null)return!1;let i=!1;for(let{name:t}of r.loadedAttributes)if(r.attributeData[t]){let a=k(r.attributeData[t],n);a!==e.attributes[t]&&(e.attributes[t]=a,i=!0)}return i}function Y(e){let t=e.attributeInfo;if(t?.loadedAttributes==null||t.attributeData==null)return;let n=e.node.index;for(let r=0;r<e.graphics.length;r++){let i=e.graphics[r];if(i.nodeIndex===n){i.attributes||={};for(let{name:e}of t.loadedAttributes)t.attributeData[e]&&(i.attributes[e]=k(t.attributeData[e],r))}}}function X(e,t){return e.xmin-=t,e.ymin-=t,e.xmax+=t,e.ymax+=t,e.zmin!=null&&e.zmax!=null&&(e.zmin-=t,e.zmax+=t),e.mmin!=null&&e.mmax!=null&&(e.mmin-=t,e.mmax+=t),e}const we={2:{type:`Embedded`,params:{type:`points`,vertexAttributes:{position:[0,0]}}},3:{type:`Embedded`,params:{type:`points`,vertexAttributes:{position:[0,0,0]}}}},Z=p(),Q={graphic:null,property:null,oldValue:null,newValue:null},Te=p();function $(){Q.graphic=null,Q.property=null,Q.oldValue=null,Q.newValue=null}export{xe as default};
2
+ import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{estimateNumberArrayMemory as r}from"../../../core/memoryEstimations.js";import{throwIfAborted as i}from"../../../core/promiseUtils.js";import{initial as a,watch as o,sync as s}from"../../../core/reactiveUtils.js";import{generateUID as c}from"../../../core/uid.js";import{property as l,subclass as u}from"../../../core/accessorSupport/decorators.js";import{set as d}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as f,create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBuffer as m}from"../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as h}from"../../../geometry/projection/projectVectorToVector.js";import{extentContainsCoords3D as g,extentContainsCoords2D as _}from"../../../geometry/support/contains.js";import{newDoubleArray as v,doubleArrayFrom as ee}from"../../../geometry/support/DoubleArray.js";import{isInEffectiveScaleRange as te}from"../../../geometry/support/scaleUtils.js";import{getGeometryZScaler as ne}from"../../../geometry/support/zscale.js";import{fallbackObjectIDAttribute as re}from"../../../layers/LayerConstants.js";import{estimateSize as ie}from"../../../layers/graphics/dehydratedFeatures.js";import{ImmutableDehydratedPoint as y}from"../../../layers/graphics/dehydratedPoint.js";import{hydrateGraphic as b}from"../../../layers/graphics/hydratedFeatures.js";import x from"../../../layers/graphics/controllers/I3SOnDemandController.js";import ae from"../../../layers/support/FeatureFilter.js";import{I3SExtractChanges as S}from"../../../layers/support/I3SExtractChanges.js";import C from"../../../rest/support/Query.js";import{isBasemapLayerView as oe}from"../../../support/basemapUtils.js";import{isGraphic as se}from"../../../support/graphicInstanceUtils.js";import{I3SPointsWorkerHandle as w}from"./I3SPointsWorkerHandle.js";import{LayerView3D as ce}from"./LayerView3D.js";import{Graphics3DFeatureProcessor as T}from"./graphics/Graphics3DFeatureProcessor.js";import{QueryEngine as E}from"./graphics/QueryEngine.js";import{QueryEngineContext as D}from"./graphics/QueryEngineContext.js";import{createInteractiveEditSession as O,normalizeEditResultsEvent as k,processAttributeEdits as A}from"./i3s/featureEditing.js";import{getCachedAttributeValue as j}from"./i3s/I3SBinaryReader.js";import{I3SGraphicsMap as M}from"./i3s/I3SGraphicsMap.js";import{I3SOverrides as N}from"./i3s/I3SOverrides.js";import{checkRecyclable as P,checkSpatialReferences as F,containsDraco as I,whenGraphicAttributes as L}from"./i3s/I3SUtil.js";import{attributeLookup as R}from"./support/attributeUtils.js";import{DefinitionExpressionSceneLayerView as z}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as B}from"./support/fieldProperties.js";import{normalizeHighlightTarget as V,emptyHighlightHandle as H,isObjectId as U}from"./support/highlightUtils.js";import{LayerViewPerformanceInfo as le}from"./support/LayerViewPerformanceInfo.js";import{PopupSceneLayerView as W}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as ue}from"./support/SceneLayerViewRequiredFields.js";import{TemporalSceneLayerView as de}from"./support/TemporalSceneLayerView.js";import{debugFlags as G}from"../support/debugFlags.js";import{compute as fe}from"../support/orientedBoundingBox.js";import{updatingProgress as pe}from"../support/updatingProperties.js";import{Vertices as me}from"../webgl-engine/lib/Attribute.js";import he from"../../layers/SceneLayerView.js";import{hasPopupTemplate as ge}from"../../layers/support/popupUtils.js";import{getHighlightName as _e}from"../../support/highlightOptionsUtils.js";import{hasLayerBasedScaleVisibility as K}from"../../support/layerViewUtils.js";import{TaskPriority as ve}from"../../support/Scheduler.js";const q=B();class ye{constructor(e,t,n,r){this.graphics=e,this.featureIds=t,this.attributeInfo=n,this.node=r}get usedMemory(){return this.graphics.reduce((e,t)=>ie(t)+e,r(this.featureIds)+1024)}}let J=class extends de(z(W(ce(he)))){constructor(){super(...arguments),this.type=`scene-layer-graphics-3d`,this._queryEngine=null,this._memCache=null,this._interactiveEditingSessions=new Map,this._pendingEditsQueue=Promise.resolve(),this.loadedGraphics=new M((e,t,n)=>Se(e,t,n),e=>this.processor.graphicsCore.recreateGraphics(e),this.logError),this.holeFilling=`always`,this.progressiveLoadFactor=1,this.supportsHeightUnitConversion=!0,this._coordinatesOutsideExtentErrors=0,this._maxCoordinatesOutsideExtentErrors=20}tryRecycleWith(e,t){return e.url!==this.layer.url||!this._i3sOverrides.isEmpty?null:e.load(t).then(()=>{i(t),P(this.layer,e,this._i3sOverrides),this.layer=e,this._reinitializeOverrides(),n(this._queryEngine),this._setupQueryEngine(),this.processor.resetObjectStates()})}initialize(){this.addResolvingPromise(this.layer.indexInfo),this._reinitializeOverrides(),F(this.layer,this.view.spatialReference,this.view.viewingMode),this._fieldsHelper=new ue({layerView:this}),this._updatingHandles.add(()=>this.layer.rangeInfos,e=>this._rangeInfosChanged(e),a),this._updatingHandles.add(()=>this.layer.renderer,(e,t)=>this._rendererChange(e,t)),this._updatingHandles.add(()=>[this.parsedDefinitionExpression,this.layer.excludeObjectIds],()=>this._filterChange()),this._set(`processor`,new T({owner:this,preferredUpdatePolicy:0,scaleVisibilityEnabled:!K(),filterVisibilityEnabled:!0,timeExtentEnabled:!1,frustumVisibilityEnabled:!1,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!1,setUidToIdOnAdd:!1,dataExtent:this.layer.fullExtent,updateClippingExtent:e=>this._updateClippingExtent(e)})),this.processor.elevationAlignment?.events.on(`invalidate-elevation`,({extent:e,spatialReference:t})=>this._controller.updateElevationChanged(e,t)),this.supportsHeightUnitConversion&&(this._verticalScale=ne(`point`,this.layer.spatialReference,this.view.spatialReference)),this.addResolvingPromise(this.processor.when()),this._memCache=this.view.resourceController.memoryController.newCache(`psl-${this.uid}`),this._controller=new x({layerView:this}),I(this.layer.geometryDefinitions)&&(this._workerHandle=new w(e=>this.view.resourceController.immediate.schedule(e))),this.addHandles(this.layer.on(`apply-edits`,e=>this._updatingHandles.addPromise(e.result))),this.addHandles([this.layer.on(`edits`,e=>{let t=this._pendingEditsQueue.then(()=>this._handleEdits(e)).then();this._pendingEditsQueue=t,this._updatingHandles.consumePromise(t)}),o(()=>G.I3S_TREE_SHOW_TILES,e=>{if(e&&!this._treeDebugger){let e=this._controller.crsIndex;import(`./support/I3STreeDebugger.js`).then(({I3STreeDebugger:t})=>{!this._treeDebugger&&G.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))})}else!e&&this._treeDebugger&&!G.I3S_TREE_SHOW_TILES&&(this._treeDebugger.destroy(),this._treeDebugger=null)},a)]),this.when(()=>{this._setupQueryEngine(),this._updatingHandles.add(()=>this.availableFields,()=>this._queryEngine?.clear(),s),this._updatingHandles.add(()=>this.maximumNumberOfFeatures,e=>this._controller.featureTarget=e,a),this._updatingHandles.add(()=>this.suspended,e=>{e&&this._removeAllNodeData()})}).catch(()=>{})}_reinitializeOverrides(){this._i3sOverrides?.destroy(),this._extractChanges?.destroy();let{layer:e}=this,t=this.view.resourceController?.memoryController;this._extractChanges=new S({layer:e}),this._i3sOverrides=new N({view:this.view,layer:e,memoryController:t,extractChanges:this._extractChanges})}destroy(){this._treeDebugger=n(this._treeDebugger),this._i3sOverrides=n(this._i3sOverrides),this._extractChanges=n(this._extractChanges),this._set(`processor`,n(this.processor)),this._controller=n(this._controller),this._queryEngine=n(this._queryEngine),this._workerHandle=n(this._workerHandle),this._memCache=n(this._memCache),this.loadedGraphics.clear(),this._fieldsHelper=n(this._fieldsHelper)}get layerViewUid(){return this.uid}get updatingProgressValue(){return this._controller?.updatingProgress??1}get visibleAtCurrentScale(){return K()?te(this.layer.effectiveScaleRange,this.view.scale):!this.processor?.scaleVisibilitySuspended}get requiredFields(){return this._fieldsHelper?.requiredFields??[]}get maximumNumberOfFeatures(){return this.processor?.graphicsCore?.displayFeatureLimit?.maximumNumberOfFeatures??0}set maximumNumberOfFeatures(e){e==null?(this._clearOverride(`maximumNumberOfFeatures`),this._controller.fixedFeatureTarget=!1):(this._override(`maximumNumberOfFeatures`,e),this._controller.fixedFeatureTarget=!0)}get maximumNumberOfFeaturesExceeded(){return!this.suspended&&!!this._controller?.useMaximumNumberOfFeatures&&!this._controller.leavesReached}get _excludeObjectIds(){return new Set(this.layer.excludeObjectIds)}get lodFactor(){return this.layer.semantic===`Labels`?1:this.view.qualitySettings.sceneService.pointLoDFactor}get hasM(){return!1}get hasZ(){return!0}get contentVisible(){return!this.suspended&&!!this._controller?.rootNodeVisible}get legendEnabled(){return this.contentVisible&&this.layer?.legendEnabled===!0}get _graphicOrigin(){return this.layer.graphicOrigin}async whenGraphicAttributes(e,t){return L(this.layer,e,this._getObjectIdField(),t,()=>[...this.loadedGraphics.nodes()])}getHit(e){if(!this.loadedGraphics)return null;let t=b(this.loadedGraphics.find(t=>t.uid===e),this.layer,this._graphicOrigin),n=this._getObjectIdField();return t?.attributes?.[n]==null?null:{type:`graphic`,graphic:t,layer:t.layer}}whenGraphicBounds(e,t){return this.processor.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.processor.computeAttachmentOrigin(e,t)}isUpdating(){return!!(this._controller?.updating||this.processor?.updating||this._fieldsHelper?.updating||this.layerFilterUpdating)}highlight(e,t){let n=_e(t),r=this.layer.objectIdField,i=V(e);if(i.length===0)return H;if(se(i[0])){let e=i;if(R(this.layer.fieldsIndex,e[0].attributes,r)!=null){let t=e.map(e=>R(this.layer.fieldsIndex,e.attributes,r));return this.processor.highlightByObjectIds(t,r,n)}return this.processor.highlightByGraphics(e,n)}return U(i[0])?this.processor.highlightByObjectIds(i,r,n):H}get updatePolicy(){return this.processor.graphicsCore.effectiveUpdatePolicy}createInteractiveEditSession(e){return O(this._attributeEditingContext,e)}async _decompressBinaryPointData(e,t){let n={geometryBuffer:e.geometryBuffer};this._workerHandle??=new w(e=>this.view.resourceController.immediate.schedule(e));let r=await this._workerHandle.invoke(n,t);if(r==null)throw Error(`Failed to decompress Draco point data`);return{positionData:r.positions,featureIds:r.featureIds}}async addNode(e,n,r){if(!Y(n)&&!xe(n))throw Error();if(this.loadedGraphics.hasNode(e.index)){t.getLogger(this).error(`I3S node `+e.id+` already added`);return}let i=this.layer.fullExtent==null?null:Ce(this.layer.fullExtent.clone(),.5),{featureIds:a,pointPositions:o}=Y(n)?await this._extractBinaryPointPositions(e,n,r):this._extractLegacyPointPositions(n),s=[];this._validatePositions(e,a,o,i,s);let c=this._controller.crsVertex,l=this.view.spatialReference;m(o,c,0,o,l,0,a.length);let u=Y(n)?e.level:0,d=this._createGraphics(a,o,e.index,u),f=new ye(d,a,n.attributeDataInfo,e);if(await this._i3sOverrides.applyAttributeOverrides(f.featureIds,n.attributeDataInfo,r),e.numFeatures=f.graphics.length,this._updateNodeMemory(e),X(f),s.length>0&&(this._computeObb(e,s,c),this._controller.updateVisibility(e.index)),!this._controller.isGeometryVisible(e)){this._cacheNodeData(f);return}if(this._verticalScale!=null)for(let e of f.graphics)this._verticalScale(e.geometry);let p=this.view.stage.renderView.olidRenderHelper;if(p){let e=oe(this.view,this.uid);for(let t=0;t<f.featureIds.length;t++){let n=f.featureIds[t];p.setUidToObjectAndLayerId(n,f.graphics[t].uid,this.layer.id,this.uid,this.layer.popupEnabled&&!e&&ge(this.layer,this.view.popup?.defaultPopupTemplateEnabled),f.node.resources.attributes,t)}}this.loadedGraphics.addNode(e.index,f),this._controller.updateLoadStatus(e.index,!0),this._filterNode(f),this._treeDebugger&&this._treeDebugger.update()}_computeObb(e,t,n){let r=this._controller.crsIndex,i=r.isGeographic?this.view.renderSpatialReference:r;m(t,n,0,t,i,0),e.serviceObbInIndexSR=fe(new me(t,3)),r.isGeographic&&(h(e.serviceObbInIndexSR.getCenter(Z),i,Z,r),e.serviceObbInIndexSR.setCenter(Z))}isNodeLoaded(e){return this.loadedGraphics.hasNode(e)}isNodeReloading(){return!1}updateNodeState(){}getNodeComponentHandle(){}async _extractBinaryPointPositions(e,t,n){let r=await this._decompressBinaryPointData(t,n),i=r.positionData,a=i.length/3,o=v(a*3),s=e.serviceObbInIndexSR==null?f:e.serviceObbInIndexSR.getCenter(Te),c=Math.abs(s[2])*2**-20;for(let e=0;e<a;e++){let t=e*3;o[t]=i[t]+s[0],o[t+1]=i[t+1]+s[1],o[t+2]=i[t+2]+s[2],Math.abs(o[t+2])<c&&(o[t+2]=0)}return{featureIds:r.featureIds?ee(r.featureIds):[],pointPositions:o}}_extractLegacyPointPositions(e){let t=e.pointData.length,n=v(3*t),r=[];for(let i=0;i<t;i++){let t=e.pointData[i],a=t.featureDataPosition,o=a.length,s=t.geometries?.[0]??we[o],c=t.featureIds[0];if(s.type!==`Embedded`||s.params.type!==`points`||o<2||o>3)continue;let l=s.params.vertexAttributes?.position??[0,0,0],u=r.length*3;n[u]=a[0]+l[0],n[u+1]=a[1]+l[1],n[u+2]=o===3?a[2]+l[2]:NaN,r.push(c)}return{featureIds:r,pointPositions:n}}_validatePositions(e,n,r,i,a){if(i==null&&e.serviceObbInIndexSR)return;let o=n.length;for(let n=0;n<o;n++){let o=n*3;d(Z,r[o],r[o+1],r[o+2]);let s=!Number.isNaN(r[2]);i!=null&&(s?!g(i,Z):!_(i,Z))&&(this._coordinatesOutsideExtentErrors<this._maxCoordinatesOutsideExtentErrors&&t.getLogger(this).error(`Service Error: Coordinates outside of layer extent`),this._coordinatesOutsideExtentErrors+1===this._maxCoordinatesOutsideExtentErrors&&t.getLogger(this).error(`Maximum number of errors reached. Further errors are ignored.`),this._coordinatesOutsideExtentErrors++),e.serviceObbInIndexSR||a.push(Z[0],Z[1],Z[2])}}_createGraphics(e,t,n,r){let i=e.length,a=this._getObjectIdField(),o=this.processor.graphicsCore,s=[],l=this.view.spatialReference;for(let u=0;u<i;u++){let i=e[u],d={};i!=null&&(d[a]=i);let f=i??c(),p=u*3,m=isNaN(t[p+2])?void 0:t[p+2],h=new y(l,t[p],t[p+1],m),g=this.loadedGraphics.get(f);if(g!=null)(g.level==null||g.level<r)&&(Q.property=`geometry`,Q.graphic=g,Q.oldValue=g.geometry,Q.newValue=h,g.geometry=h,g.level=r,o.graphicUpdateHandler(Q),$()),s.push(g);else{let e=c();s.push({objectId:f,uid:e,geometry:h,attributes:d,visible:!0,nodeIndex:n,level:r})}}return s}_updateNodeMemory(e){e.memory=4096+(e.numFeatures??0)*this.processor.graphicsCore.usedMemoryPerGraphic}_cacheNodeData(e){this._memCache.put(this._getMemCacheKey(e.node),e)}_getMemCacheKey(e){return`${e.index}`}_removeAllNodeData(){this.loadedGraphics.forEachNode((e,t)=>{if(e){let t=e.node;this._updateNodeMemory(t),this._cacheNodeData(e)}this._controller.updateLoadStatus(t,!1)}),this._treeDebugger&&this._treeDebugger.update(),this.loadedGraphics.clear()}removeNode(e){let t=this._removeNodeStageData(e);t&&(this._updateNodeMemory(t.node),this._cacheNodeData(t))}_removeNodeStageData(e){let t=this.loadedGraphics.getNode(e);return t==null?null:(this._controller.updateLoadStatus(e,!1),this.loadedGraphics.removeNode(e),this._treeDebugger&&this._treeDebugger.update(),t)}async loadCachedNodeData(e){return this._memCache?.pop(this._getMemCacheKey(e))}async addCachedNodeData(e,n,r,i){this.loadedGraphics.hasNode(e.index)?t.getLogger(this).error(`I3S node `+e.id+` already added`):(await this._i3sOverrides.applyAttributeOverrides(n.featureIds,r,i),n.attributeInfo=r,this.loadedGraphics.addNode(e.index,n),this._controller.updateLoadStatus(e.index,!0),this._updateNodeMemory(e),X(n),this._filterNode(n),this._treeDebugger&&this._treeDebugger.update())}getLoadedNodeIds(){let e=[];return this.loadedGraphics.forEachNode(t=>e.push(t.node.id)),e.sort()}getVisibleNodes(){let e=[];return this.loadedGraphics.forEachNode(t=>e.push(t.node)),e}getLoadedNodeIndices(e){this.loadedGraphics.forEachNode((t,n)=>e.push(n))}getLoadedAttributes(e){let t=this.loadedGraphics.getNode(e);if(t?.attributeInfo!=null)return t.attributeInfo.loadedAttributes}getAttributeData(e){let t=this.loadedGraphics.getNode(e);if(t?.attributeInfo!=null)return t.attributeInfo.attributeData}_setAttributeData(e,t){let n=this.loadedGraphics.getNode(e);n?.attributeInfo!=null&&(n.attributeInfo.attributeData=t,this._attributeValuesChanged(n))}async updateAttributes(e,t,n){let r=this.loadedGraphics.getNode(e);r!=null&&(await this._i3sOverrides.applyAttributeOverrides(r.featureIds,t,n),r.attributeInfo=t,this._attributeValuesChanged(r))}_attributeValuesChanged(e){X(e),this._filterNode(e);let{processor:t}=this,{graphicsCore:n}=t;if(n.labelsEnabled){let t=e.node.index,r=[];e.graphics.forEach(e=>e.nodeIndex===t&&r.push(e.uid)),n.updateLabelingInfo(r)}t.refreshFilter()}_updateClippingExtent(e){return this._controller&&this._controller.updateClippingArea(e),!1}_getObjectIdField(){return this.layer.objectIdField||re}_getGlobalIdField(){return this.layer.globalIdField}async _rendererChange(e,t){let{layer:{fieldsIndex:n}}=this,r=new Set,i;e?(await e.collectRequiredFields(r,n),i=Array.from(r).sort()):i=[],r.clear();let a;t?(await t.collectRequiredFields(r,n),a=Array.from(r).sort()):a=[],!(i.length===a.length&&i.every((e,t)=>i[t]===a[t]))&&this._reloadAllNodes()}_rangeInfosChanged(e){e!=null&&e.length>0&&t.getLogger(this).warn(`Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.`)}_filterChange(){this.loadedGraphics.forEachNode(e=>this._filterNode(e))}_reloadAllNodes(){this._removeAllNodeData(),this._controller&&this._controller.restartNodeLoading()}_filterNode(e){let t=this.parsedDefinitionExpression,n=this._excludeObjectIds,r=this._getObjectIdField();for(let i of e.graphics){let e=i.visible,a=this._evaluateClause(t,i),o=!n.has(i.attributes[r]);i.visible=a&&o,e!==i.visible&&(Q.graphic=i,Q.property=`visible`,Q.oldValue=e,Q.newValue=i.visible,this.processor.graphicsCore.graphicUpdateHandler(Q),$())}}createQuery(){let e={outFields:[`*`],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return this.filter?.createQuery(e)??new C(e)}queryFeatures(e,t){return this._queryEngine.executeQuery(this._ensureQuery(e),t?.signal)}queryObjectIds(e,t){return this._queryEngine.executeQueryForIds(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this._queryEngine.executeQueryForCount(this._ensureQuery(e),t?.signal)}queryExtent(e,t){return this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t?.signal)}_ensureQuery(e){return this._addDefinitionExpressionToQuery(e==null?this.createQuery():C.from(e))}_setupQueryEngine(){let{layer:e,view:t,hasM:n,hasZ:r}=this,{spatialReference:i,resourceController:a}=t,o=new D(i,e,a,()=>this.processor.featureStore,r,n,()=>this.availableFields);this._queryEngine=new E({context:o,priority:ve.FEATURE_QUERY_ENGINE})}get usedMemory(){return this.processor?.graphicsCore?.usedMemory??0}get unloadedMemory(){return((this._controller?.unloadedMemoryEstimate??0)+(this.processor?.graphicsCore?.unprocessedMemoryEstimate??0))*.8}get ignoresMemoryFactor(){return this._controller&&this._controller.fixedFeatureTarget}async _handleEdits(e){let t=this._attributeEditingContext,n=await k(t,e);A(t,n)}get _attributeEditingContext(){let e=this._getObjectIdField(),t=this._getGlobalIdField();return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:e,globalIdField:t,forEachNode:e=>this.loadedGraphics.forEachNode(t=>e(t.node,t.featureIds)),attributeStorageInfo:this.layer.attributeStorageInfo??[],i3sOverrides:this._i3sOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(t,n,r)=>{this._setAttributeData(t,n);let i=this.loadedGraphics.getNode(t);if(r!=null){let t=this.loadedGraphics.get(r.attributes[e]);t!=null&&this.processor.graphicsCore.recreateGraphics([t])}else i!=null&&this.processor.graphicsCore.recreateGraphics(i.graphics)},clearMemCache:()=>{}}}get performanceInfo(){return new le(this.usedMemory,this.loadedGraphics.length,-1,this.maximumNumberOfFeatures,this.loadedGraphics.nodeCount,this.processor.graphicsCore.performanceInfo)}get test(){}};e([l()],J.prototype,`processor`,void 0),e([l({type:ae})],J.prototype,`filter`,void 0),e([l()],J.prototype,`loadedGraphics`,void 0),e([l()],J.prototype,`layerViewUid`,null),e([l()],J.prototype,`_controller`,void 0),e([l()],J.prototype,`updating`,void 0),e([l()],J.prototype,`suspended`,void 0),e([l(pe)],J.prototype,`updatingProgress`,void 0),e([l()],J.prototype,`updatingProgressValue`,null),e([l({readOnly:!0})],J.prototype,`visibleAtCurrentScale`,null),e([l(q.requiredFields)],J.prototype,`requiredFields`,null),e([l(q.availableFields)],J.prototype,`availableFields`,void 0),e([l()],J.prototype,`_fieldsHelper`,void 0),e([l({type:Number})],J.prototype,`maximumNumberOfFeatures`,null),e([l({readOnly:!0})],J.prototype,`maximumNumberOfFeaturesExceeded`,null),e([l()],J.prototype,`_excludeObjectIds`,null),e([l({readOnly:!0})],J.prototype,`lodFactor`,null),e([l({readOnly:!0})],J.prototype,`hasM`,null),e([l({readOnly:!0})],J.prototype,`hasZ`,null),e([l()],J.prototype,`contentVisible`,null),e([l({readOnly:!0})],J.prototype,`legendEnabled`,null),e([l()],J.prototype,`_graphicOrigin`,null),J=e([u(`esri.views.3d.layers.SceneLayerGraphicsView3D`)],J);const be=J;function xe(e){return`pointData`in e}function Y(e){return`geometryBuffer`in e&&e.geometryBuffer!==null}function Se(e,t,n){let r=t.attributeInfo;if(r?.loadedAttributes==null||r.attributeData==null)return!1;let i=!1;for(let{name:t}of r.loadedAttributes)if(r.attributeData[t]){let a=j(r.attributeData[t],n);a!==e.attributes[t]&&(e.attributes[t]=a,i=!0)}return i}function X(e){let t=e.attributeInfo;if(t?.loadedAttributes==null||t.attributeData==null)return;let n=e.node.index;for(let r=0;r<e.graphics.length;r++){let i=e.graphics[r];if(i.nodeIndex===n){i.attributes||={};for(let{name:e}of t.loadedAttributes)t.attributeData[e]&&(i.attributes[e]=j(t.attributeData[e],r))}}}function Ce(e,t){return e.xmin-=t,e.ymin-=t,e.xmax+=t,e.ymax+=t,e.zmin!=null&&e.zmax!=null&&(e.zmin-=t,e.zmax+=t),e.mmin!=null&&e.mmax!=null&&(e.mmin-=t,e.mmax+=t),e}const we={2:{type:`Embedded`,params:{type:`points`,vertexAttributes:{position:[0,0]}}},3:{type:`Embedded`,params:{type:`points`,vertexAttributes:{position:[0,0,0]}}}},Z=p(),Q={graphic:null,property:null,oldValue:null,newValue:null},Te=p();function $(){Q.graphic=null,Q.property=null,Q.oldValue=null,Q.newValue=null}export{be as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import n from"../../../core/Logger.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{throwIfAborted as i}from"../../../core/promiseUtils.js";import a from"../../../core/ReactiveSet.js";import{initial as o}from"../../../core/reactiveUtils.js";import{property as s,subclass as c}from"../../../core/accessorSupport/decorators.js";import l from"../../../core/sql/WhereClause.js";import u from"../../../layers/support/FeatureFilter.js";import{getFloorFilterClause as d}from"../../../layers/support/floorFilterUtils.js";import f from"../../../rest/support/Query.js";import{isNumber as p}from"../../../support/guards.js";import{I3SMeshView3D as m}from"./I3SMeshView3D.js";import{LayerView3D as h}from"./LayerView3D.js";import{createInteractiveEditSession as g,normalizeEditResultsEvent as _,processGeometryEdits as v,processAttributeEdits as y}from"./i3s/featureEditing.js";import{createGetFeatureExtent as b}from"./i3s/I3SGeometryUtil.js";import{I3SMeshViewFilter as x}from"./i3s/I3SMeshViewFilter.js";import{I3SOverrides as S}from"./i3s/I3SOverrides.js";import{I3SQueryEngine as C}from"./i3s/I3SQueryEngine.js";import{I3SQueryFeatureAdapter as w,I3SQueryFeature as T}from"./i3s/I3SQueryFeatureAdapter.js";import{I3SQueryFeatureStore as E}from"./i3s/I3SQueryFeatureStore.js";import{checkRecyclable as D,getIndexCrs as O,objectIdFilter as k}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as A}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as j}from"./support/fieldProperties.js";import{PopupSceneLayerView as M}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as N}from"./support/SceneLayerViewRequiredFields.js";import{TemporalSceneLayerView as P}from"./support/TemporalSceneLayerView.js";import{updatingProgress as F}from"../support/updatingProperties.js";import I from"../../layers/SceneLayerView.js";import{hasPopupTemplate as L}from"../../layers/support/popupUtils.js";import{isInEffectiveScaleRange as R}from"../../support/layerViewUtils.js";import{TaskPriority as z}from"../../support/Scheduler.js";const B=j();let V=class extends m(P(A(M(h(I))))){constructor(){super(...arguments),this.type=`scene-layer-3d`,this.viewFilter=null,this._setVisibilityHiddenObjectIds=new a,this.progressiveLoadFactor=1,this._elevationContext=2,this._supportsLabeling=!0,this._pendingEditsQueue=Promise.resolve(),this._interactiveEditingSessions=new Map,this._queryEngine=null}tryRecycleWith(e,t){return e.url!==this.layer.url||!this.i3sOverrides.isEmpty?null:e.load(t).then(()=>{i(t),D(this.layer,e,this.i3sOverrides),this.layer=e,this.i3sOverrides.destroy();let n=this.view.resourceController?.memoryController;this.i3sOverrides=new S({view:this.view,layer:e,memoryController:n,extractChanges:this.extractChanges}),this.resetHighlights()})}get layerPopupEnabledAndHasTemplate(){return this.layer.popupEnabled&&L(this.layer,this.view.popup?.defaultPopupTemplateEnabled)}get filter(){return this._get(`filter`)}set filter(e){this._set(`filter`,x.checkSupport(e)?e:null)}get requiredFields(){return this._fieldsHelper?.requiredFields??[]}get _floorFilterClause(){let e=d(this);return e==null?null:l.create(e,{fieldsIndex:this.layer.fieldsIndex})}get _excludeObjectIdsSorted(){let e=this.layer.excludeObjectIds.toArray();return e.length?e.sort((e,t)=>e-t):null}get _setVisibilityHiddenObjectIdsSorted(){return this._setVisibilityHiddenObjectIds.size?Array.from(this._setVisibilityHiddenObjectIds).sort((e,t)=>e-t):null}get lodFactor(){return this.view?.qualitySettings?.sceneService?.objectLoDFactor??1}get lodCrossfadeUncoveredDuration(){return this.view?.qualitySettings?.fadeDuration??0}get updatingProgressValue(){return this._controller?.updatingProgress??0}get visibleAtCurrentScale(){return R(this.layer.effectiveScaleRange,this.view.scale)}get _graphicOrigin(){return this.layer.graphicOrigin}initialize(){this._fieldsHelper=new N({layerView:this}),this._updatingHandles.add(()=>this.layer.rangeInfos,e=>this._rangeInfosChanged(e),o),this._updatingHandles.add(()=>this.layer.renderer,e=>this._updatingHandles.addPromise(this._rendererChange(e)),o);let e=()=>this._filterChange();this._updatingHandles.add(()=>this.parsedDefinitionExpression,e),this._updatingHandles.add(()=>this.mergedFilter,e),this._updatingHandles.add(()=>this._floorFilterClause,e),this._updatingHandles.add(()=>this._excludeObjectIdsSorted,e),this._updatingHandles.add(()=>this._setVisibilityHiddenObjectIdsSorted,e),this._updatingHandles.add(()=>this.viewFilter?.sortedObjectIds,e),this._updatingHandles.add(()=>this.viewFilter?.parsedWhereClause,e),this._updatingHandles.add(()=>this.getTimeFilterDependencies(),e),this._updatingHandles.add(()=>[this.viewFilter?.parsedGeometry,this.mergedFilter?.spatialRelationship,this.layer.filter?.spatialRelationship],()=>this._geometryFilterChange()),this._updatingHandles.add(()=>({layerViewFilter:this.mergedFilter,layerFilter:this.layerFilter}),({layerViewFilter:e,layerFilter:t})=>{if(e==null&&t==null){this._set(`viewFilter`,null);return}let n=this.viewFilter;n?(n.viewFilter=e,n.layerFilter=t,this._filterChange()):this._set(`viewFilter`,new x({layerFilter:t,viewFilter:e,layerFieldsIndex:this.layer.fieldsIndex,loadAsyncModule:e=>this._loadAsyncModule(e),addSqlFilter:(e,t)=>this.addSqlFilter(e,t,this.logError),addTimeFilter:(e,t)=>this.addTimeFilter(e,t)}))},o),this.i3sOverrides.is3DOFL&&this._updatingHandles.add(()=>this.i3sOverrides.sortedGeometryChangedObjectIds,e),this.addHandles(this.layer.on(`apply-edits`,e=>this._updatingHandles.addPromise(e.result))),this.addHandles(this.layer.on(`edits`,e=>{let t=this._pendingEditsQueue.then(()=>this._handleEdits(e)).then();this._pendingEditsQueue=t,this._updatingHandles.consumePromise(t)}))}destroy(){this._fieldsHelper=r(this._fieldsHelper)}_rangeInfosChanged(e){e!=null&&e.length>0&&n.getLogger(this).warn(`Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.`)}createQuery(){let e={outFields:[`*`],returnGeometry:!0,returnZ:!0,outSpatialReference:this.view.spatialReference};return this.mergedFilter?.createQuery(e)??new f(e)}queryExtent(e,t){return this._ensureQueryEngine().executeQueryForExtent(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this._ensureQueryEngine().executeQueryForCount(this._ensureQuery(e),t?.signal)}queryFeatures(e,t){return this._ensureQueryEngine().executeQuery(this._ensureQuery(e),t?.signal).then(e=>{if(!e?.features)return e;let t=this.layer,n=this._graphicOrigin;for(let r of e.features)r.layer=t,r.sourceLayer=t,r.origin=n;return e})}async queryObjectIds(e,t){return(await this._ensureQueryEngine().executeQueryForIds(this._ensureQuery(e),t?.signal)).filter(p)}_ensureQueryEngine(){return this._queryEngine??=this._createQueryEngine(),this._queryEngine}_createQueryEngine(){let e=b(this.view.spatialReference,this.view.renderSpatialReference,this._collection);return new C({layerView:this,priority:z.FEATURE_QUERY_ENGINE,spatialIndex:new E({featureAdapter:new w({objectIdField:this.layer.objectIdField,attributeStorageInfo:this.layer.attributeStorageInfo??[],getFeatureExtent:e}),forAllFeatures:(e,t)=>this._forAllFeatures((t,n,r)=>e(new T(t,n,r)),t,2),getFeatureExtent:e,sourceSpatialReference:O(this.layer),viewSpatialReference:this.view.spatialReference})})}createInteractiveEditSession(e){return g(this._attributeEditingContext,e)}_createLayerGraphic(e){return new t({attributes:e,layer:this.layer,sourceLayer:this.layer,origin:this._graphicOrigin})}getFilters(){let e=super.getFilters();this.i3sOverrides.is3DOFL&&this.i3sOverrides.sortedGeometryChangedObjectIds.length>0&&e.push((e,t)=>{t.node.index>=0&&k(this.i3sOverrides.sortedGeometryChangedObjectIds,!1,e)});let t=this._setVisibilityHiddenObjectIdsSorted;t!=null&&e.push(e=>k(t,!1,e));let n=this._excludeObjectIdsSorted;return n!=null&&e.push(e=>k(n,!1,e)),this._floorFilterClause&&this.addSqlFilter(e,this._floorFilterClause,this.logError),this.addSqlFilter(e,this.parsedDefinitionExpression,this.logError),this.viewFilter!=null&&this.viewFilter.addFilters(e,this.view,this._controller.crsIndex,this._collection),e}setVisibility(e,t){t?this._setVisibilityHiddenObjectIds.delete(e):this._setVisibilityHiddenObjectIds.add(e)}isUpdating(){return super.isUpdating()||!!this._fieldsHelper?.updating||this.layerFilterUpdating||this.viewFilter!=null&&this.viewFilter.updating||this.i3sOverrides!=null&&this.i3sOverrides.updating}_ensureQuery(e){return this._validateQuery(this._addDefinitionExpressionToQuery(e==null?this.createQuery():f.from(e)))}_validateQuery(e){return e.outSpatialReference&&!e.outSpatialReference.equals(this.view.spatialReference)&&(n.getLogger(this).warn(`query: outSpatialReference different from the view's spatial reference is not supported`),e.outSpatialReference=this.view.spatialReference),e.returnGeometry&&(e.returnZ=!0),e.returnCentroid=!1,e}get _attributeEditingContext(){return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:this._getObjectIdField(),globalIdField:this._getGlobalIdField(),forEachNode:e=>this._forAllNodes(t=>t==null?null:e(t.node,t.featureIds)),attributeStorageInfo:this.layer.attributeStorageInfo??[],i3sOverrides:this.i3sOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(e,t)=>this.setAttributeData(e,t),clearMemCache:()=>this.clearMemCache()}}async _handleEdits(e){let t=this._attributeEditingContext,n=await _(t,e);v(t,n),y(t,n)}get hasGeometryFilter(){return this.viewFilter?.parsedGeometry!=null}computeNodeFiltering(e){let t=this.viewFilter;return+!(t==null||!this.view.spatialReference||t.isMBSGeometryVisible(e,this.view.spatialReference,this._controller.crsIndex))}};e([s(F)],V.prototype,`updatingProgress`,void 0),e([s({type:u})],V.prototype,`filter`,null),e([s({readOnly:!0})],V.prototype,`viewFilter`,void 0),e([s(B.requiredFields)],V.prototype,`requiredFields`,null),e([s(B.availableFields)],V.prototype,`availableFields`,void 0),e([s()],V.prototype,`_fieldsHelper`,void 0),e([s()],V.prototype,`_floorFilterClause`,null),e([s()],V.prototype,`_excludeObjectIdsSorted`,null),e([s()],V.prototype,`_setVisibilityHiddenObjectIds`,void 0),e([s()],V.prototype,`_setVisibilityHiddenObjectIdsSorted`,null),e([s()],V.prototype,`lodFactor`,null),e([s()],V.prototype,`updatingProgressValue`,null),e([s({readOnly:!0})],V.prototype,`visibleAtCurrentScale`,null),e([s()],V.prototype,`_graphicOrigin`,null),V=e([c(`esri.views.3d.layers.SceneLayerView3D`)],V);const H=V;export{H as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import n from"../../../core/Logger.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{throwIfAborted as i}from"../../../core/promiseUtils.js";import a from"../../../core/ReactiveSet.js";import{initial as o}from"../../../core/reactiveUtils.js";import{property as s,subclass as c}from"../../../core/accessorSupport/decorators.js";import l from"../../../core/sql/WhereClause.js";import{isInEffectiveScaleRange as u}from"../../../geometry/support/scaleUtils.js";import d from"../../../layers/support/FeatureFilter.js";import{getFloorFilterClause as f}from"../../../layers/support/floorFilterUtils.js";import p from"../../../rest/support/Query.js";import{isNumber as m}from"../../../support/guards.js";import{I3SMeshView3D as h}from"./I3SMeshView3D.js";import{LayerView3D as g}from"./LayerView3D.js";import{createInteractiveEditSession as _,normalizeEditResultsEvent as v,processGeometryEdits as y,processAttributeEdits as b}from"./i3s/featureEditing.js";import{createGetFeatureExtent as x}from"./i3s/I3SGeometryUtil.js";import{I3SMeshViewFilter as S}from"./i3s/I3SMeshViewFilter.js";import{I3SOverrides as C}from"./i3s/I3SOverrides.js";import{I3SQueryEngine as w}from"./i3s/I3SQueryEngine.js";import{I3SQueryFeatureAdapter as T,I3SQueryFeature as E}from"./i3s/I3SQueryFeatureAdapter.js";import{I3SQueryFeatureStore as D}from"./i3s/I3SQueryFeatureStore.js";import{checkRecyclable as O,getIndexCrs as k,objectIdFilter as A}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as j}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as M}from"./support/fieldProperties.js";import{PopupSceneLayerView as N}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as P}from"./support/SceneLayerViewRequiredFields.js";import{TemporalSceneLayerView as F}from"./support/TemporalSceneLayerView.js";import{updatingProgress as I}from"../support/updatingProperties.js";import L from"../../layers/SceneLayerView.js";import{hasPopupTemplate as R}from"../../layers/support/popupUtils.js";import{TaskPriority as z}from"../../support/Scheduler.js";const B=M();let V=class extends h(F(j(N(g(L))))){constructor(){super(...arguments),this.type=`scene-layer-3d`,this.viewFilter=null,this._setVisibilityHiddenObjectIds=new a,this.progressiveLoadFactor=1,this._elevationContext=2,this._supportsLabeling=!0,this._pendingEditsQueue=Promise.resolve(),this._interactiveEditingSessions=new Map,this._queryEngine=null}tryRecycleWith(e,t){return e.url!==this.layer.url||!this.i3sOverrides.isEmpty?null:e.load(t).then(()=>{i(t),O(this.layer,e,this.i3sOverrides),this.layer=e,this.i3sOverrides.destroy();let n=this.view.resourceController?.memoryController;this.i3sOverrides=new C({view:this.view,layer:e,memoryController:n,extractChanges:this.extractChanges}),this.resetHighlights()})}get layerPopupEnabledAndHasTemplate(){return this.layer.popupEnabled&&R(this.layer,this.view.popup?.defaultPopupTemplateEnabled)}get filter(){return this._get(`filter`)}set filter(e){this._set(`filter`,S.checkSupport(e)?e:null)}get requiredFields(){return this._fieldsHelper?.requiredFields??[]}get _floorFilterClause(){let e=f(this);return e==null?null:l.create(e,{fieldsIndex:this.layer.fieldsIndex})}get _excludeObjectIdsSorted(){let e=this.layer.excludeObjectIds.toArray();return e.length?e.sort((e,t)=>e-t):null}get _setVisibilityHiddenObjectIdsSorted(){return this._setVisibilityHiddenObjectIds.size?Array.from(this._setVisibilityHiddenObjectIds).sort((e,t)=>e-t):null}get lodFactor(){return this.view?.qualitySettings?.sceneService?.objectLoDFactor??1}get lodCrossfadeUncoveredDuration(){return this.view?.qualitySettings?.fadeDuration??0}get updatingProgressValue(){return this._controller?.updatingProgress??0}get visibleAtCurrentScale(){return u(this.layer.effectiveScaleRange,this.view.scale)}get _graphicOrigin(){return this.layer.graphicOrigin}initialize(){this._fieldsHelper=new P({layerView:this}),this._updatingHandles.add(()=>this.layer.rangeInfos,e=>this._rangeInfosChanged(e),o),this._updatingHandles.add(()=>this.layer.renderer,e=>this._updatingHandles.addPromise(this._rendererChange(e)),o);let e=()=>this._filterChange();this._updatingHandles.add(()=>this.parsedDefinitionExpression,e),this._updatingHandles.add(()=>this.mergedFilter,e),this._updatingHandles.add(()=>this._floorFilterClause,e),this._updatingHandles.add(()=>this._excludeObjectIdsSorted,e),this._updatingHandles.add(()=>this._setVisibilityHiddenObjectIdsSorted,e),this._updatingHandles.add(()=>this.viewFilter?.sortedObjectIds,e),this._updatingHandles.add(()=>this.viewFilter?.parsedWhereClause,e),this._updatingHandles.add(()=>this.getTimeFilterDependencies(),e),this._updatingHandles.add(()=>[this.viewFilter?.parsedGeometry,this.mergedFilter?.spatialRelationship,this.layer.filter?.spatialRelationship],()=>this._geometryFilterChange()),this._updatingHandles.add(()=>({layerViewFilter:this.mergedFilter,layerFilter:this.layerFilter}),({layerViewFilter:e,layerFilter:t})=>{if(e==null&&t==null){this._set(`viewFilter`,null);return}let n=this.viewFilter;n?(n.viewFilter=e,n.layerFilter=t,this._filterChange()):this._set(`viewFilter`,new S({layerFilter:t,viewFilter:e,layerFieldsIndex:this.layer.fieldsIndex,loadAsyncModule:e=>this._loadAsyncModule(e),addSqlFilter:(e,t)=>this.addSqlFilter(e,t,this.logError),addTimeFilter:(e,t)=>this.addTimeFilter(e,t)}))},o),this.i3sOverrides.is3DOFL&&this._updatingHandles.add(()=>this.i3sOverrides.sortedGeometryChangedObjectIds,e),this.addHandles(this.layer.on(`apply-edits`,e=>this._updatingHandles.addPromise(e.result))),this.addHandles(this.layer.on(`edits`,e=>{let t=this._pendingEditsQueue.then(()=>this._handleEdits(e)).then();this._pendingEditsQueue=t,this._updatingHandles.consumePromise(t)}))}destroy(){this._fieldsHelper=r(this._fieldsHelper)}_rangeInfosChanged(e){e!=null&&e.length>0&&n.getLogger(this).warn(`Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.`)}createQuery(){let e={outFields:[`*`],returnGeometry:!0,returnZ:!0,outSpatialReference:this.view.spatialReference};return this.mergedFilter?.createQuery(e)??new p(e)}queryExtent(e,t){return this._ensureQueryEngine().executeQueryForExtent(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this._ensureQueryEngine().executeQueryForCount(this._ensureQuery(e),t?.signal)}queryFeatures(e,t){return this._ensureQueryEngine().executeQuery(this._ensureQuery(e),t?.signal).then(e=>{if(!e?.features)return e;let t=this.layer,n=this._graphicOrigin;for(let r of e.features)r.layer=t,r.sourceLayer=t,r.origin=n;return e})}async queryObjectIds(e,t){return(await this._ensureQueryEngine().executeQueryForIds(this._ensureQuery(e),t?.signal)).filter(m)}_ensureQueryEngine(){return this._queryEngine??=this._createQueryEngine(),this._queryEngine}_createQueryEngine(){let e=x(this.view.spatialReference,this.view.renderSpatialReference,this._collection);return new w({layerView:this,priority:z.FEATURE_QUERY_ENGINE,spatialIndex:new D({featureAdapter:new T({objectIdField:this.layer.objectIdField,attributeStorageInfo:this.layer.attributeStorageInfo??[],getFeatureExtent:e}),forAllFeatures:(e,t)=>this._forAllFeatures((t,n,r)=>e(new E(t,n,r)),t,2),getFeatureExtent:e,sourceSpatialReference:k(this.layer),viewSpatialReference:this.view.spatialReference})})}createInteractiveEditSession(e){return _(this._attributeEditingContext,e)}_createLayerGraphic(e){return new t({attributes:e,layer:this.layer,sourceLayer:this.layer,origin:this._graphicOrigin})}getFilters(){let e=super.getFilters();this.i3sOverrides.is3DOFL&&this.i3sOverrides.sortedGeometryChangedObjectIds.length>0&&e.push((e,t)=>{t.node.index>=0&&A(this.i3sOverrides.sortedGeometryChangedObjectIds,!1,e)});let t=this._setVisibilityHiddenObjectIdsSorted;t!=null&&e.push(e=>A(t,!1,e));let n=this._excludeObjectIdsSorted;return n!=null&&e.push(e=>A(n,!1,e)),this._floorFilterClause&&this.addSqlFilter(e,this._floorFilterClause,this.logError),this.addSqlFilter(e,this.parsedDefinitionExpression,this.logError),this.viewFilter!=null&&this.viewFilter.addFilters(e,this.view,this._controller.crsIndex,this._collection),e}setVisibility(e,t){t?this._setVisibilityHiddenObjectIds.delete(e):this._setVisibilityHiddenObjectIds.add(e)}isUpdating(){return super.isUpdating()||!!this._fieldsHelper?.updating||this.layerFilterUpdating||this.viewFilter!=null&&this.viewFilter.updating||this.i3sOverrides!=null&&this.i3sOverrides.updating}_ensureQuery(e){return this._validateQuery(this._addDefinitionExpressionToQuery(e==null?this.createQuery():p.from(e)))}_validateQuery(e){return e.outSpatialReference&&!e.outSpatialReference.equals(this.view.spatialReference)&&(n.getLogger(this).warn(`query: outSpatialReference different from the view's spatial reference is not supported`),e.outSpatialReference=this.view.spatialReference),e.returnGeometry&&(e.returnZ=!0),e.returnCentroid=!1,e}get _attributeEditingContext(){return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:this._getObjectIdField(),globalIdField:this._getGlobalIdField(),forEachNode:e=>this._forAllNodes(t=>t==null?null:e(t.node,t.featureIds)),attributeStorageInfo:this.layer.attributeStorageInfo??[],i3sOverrides:this.i3sOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(e,t)=>this.setAttributeData(e,t),clearMemCache:()=>this.clearMemCache()}}async _handleEdits(e){let t=this._attributeEditingContext,n=await v(t,e);y(t,n),b(t,n)}get hasGeometryFilter(){return this.viewFilter?.parsedGeometry!=null}computeNodeFiltering(e){let t=this.viewFilter;return+!(t==null||!this.view.spatialReference||t.isMBSGeometryVisible(e,this.view.spatialReference,this._controller.crsIndex))}};e([s(I)],V.prototype,`updatingProgress`,void 0),e([s({type:d})],V.prototype,`filter`,null),e([s({readOnly:!0})],V.prototype,`viewFilter`,void 0),e([s(B.requiredFields)],V.prototype,`requiredFields`,null),e([s(B.availableFields)],V.prototype,`availableFields`,void 0),e([s()],V.prototype,`_fieldsHelper`,void 0),e([s()],V.prototype,`_floorFilterClause`,null),e([s()],V.prototype,`_excludeObjectIdsSorted`,null),e([s()],V.prototype,`_setVisibilityHiddenObjectIds`,void 0),e([s()],V.prototype,`_setVisibilityHiddenObjectIdsSorted`,null),e([s()],V.prototype,`lodFactor`,null),e([s()],V.prototype,`updatingProgressValue`,null),e([s({readOnly:!0})],V.prototype,`visibleAtCurrentScale`,null),e([s()],V.prototype,`_graphicOrigin`,null),V=e([c(`esri.views.3d.layers.SceneLayerView3D`)],V);const H=V;export{H as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{whenOnce as n}from"../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{LayerViewPerformanceInfo as a}from"./support/LayerViewPerformanceInfo.js";import{updatingProgress as o,updatingProgressValue as s}from"../support/updatingProperties.js";import{checkIfTileInfoSupportedForView as c}from"../terrain/terrainUtils.js";import{isScaleRangeActive as l,validateScaleRange as u}from"../../support/layerViewUtils.js";const d=d=>{let f=d,p=class extends f{constructor(){super(...arguments),this.hasMixedImageFormats=!0}get imageFormatIsOpaque(){return!1}get fullExtent(){return this.layer.fullExtent}get isOpaque(){return this.fullOpacity>=1&&this.imageFormatIsOpaque}initialize(){this.addHandles(this.view.basemapTerrain.on(`tile-data-changed`,({layerClass:e,layerIndex:t})=>{e===1&&t===this.view.basemapTerrain.getLayerIndexByUID(1,this.uid)&&this.notifyChange(`visibleAtCurrentScale`)}))}tilesVisibleAtCurrentScale(){let{minScale:e,maxScale:t}=this.layer;if(!l(e,t))return!0;let{basemapTerrain:n}=this.view,r=n.getLayerIndexByUID(1,this.uid);if(r==null)return!1;let{tilingScheme:i}=n,a=e&&i.levelAtScale(e),o=t&&i.levelAtScale(t);return n.renderer.visibleTiles.some(e=>!!e.layerInfo[1][r]&&(!a||e.level>=a)&&(!o||e.level<=o))}get visibleAtCurrentScale(){return this.tilesVisibleAtCurrentScale()}get dataScaleRange(){let e=this.tileInfo.lods,t=e[0].scale,n=e[e.length-1].scale;if(`tilemapCache`in this.layer&&this.layer.tilemapCache){let{effectiveMinLOD:e,effectiveMaxLOD:r}=this.layer.tilemapCache;t=this.tileInfo.lodAt(e).scale,n=this.tileInfo.lodAt(r).scale}return{minScale:t,maxScale:n}}canResume(){let e=this.layer&&`effectiveScaleRange`in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&!this.parent?.suspended&&this.view?.ready&&u(e)&&this.visibleAtCurrentTimeExtent||!1}get dataLevelRange(){let{minScale:e,maxScale:t}=this.dataScaleRange;return this.levelRangeFromScaleRange(e,t)}get displayLevelRange(){let e=this.layer.minScale||this.dataScaleRange.minScale,t=this.layer.maxScale||this.dataScaleRange.maxScale,n=this.levelRangeFromScaleRange(e,t);return this.layer.maxScale&&n.maxLevel++,n}get performanceInfo(){return new a(this.view.basemapTerrain.getUsedMemoryForLayerView(this))}getTileUrl(e){return`getTileUrl`in this.layer?this.layer.getTileUrl(e[0],e[1],e[2]):null}_addTilingSchemeMatchPromise(){if(this.fullExtent==null)return this.addResolvingPromise(Promise.reject(new t(`tilingscheme:extent-not-defined`,`This layer doesn't define a fullExtent.`)));let e=this._getTileInfoSupportError(this.tileInfo,this.fullExtent);if(e)return this.addResolvingPromise(Promise.reject(e));this.addResolvingPromise(n(()=>this.view?.basemapTerrain?.tilingSchemeLocked).then(()=>{let e=this.view.basemapTerrain.tilingScheme,t=`tilemapCache`in this.layer?this.layer.tilemapCache?.effectiveMaxLOD:void 0,n=this._getTileInfoCompatibilityError(this.tileInfo,e,t);if(n)throw n}))}_getTileInfoSupportError(e,n){let r=c(e,n,this.view.spatialReference,this.view.state.viewingMode,`tilemapCache`in this.layer?this.layer.tilemapCache?.effectiveMaxLOD:void 0);if(!r)return;let i={layer:this.layer,error:r};switch(r.name){case`tilingscheme:spatial-reference-mismatch`:case`tilingscheme:global-unsupported-spatial-reference`:case`tilingscheme:local-unsupported-spatial-reference`:return new t(`layerview:spatial-reference-incompatible`,`The spatial reference of this layer does not meet the requirements of the view`,i);default:return new t(`layerview:tiling-scheme-unsupported`,`The tiling scheme of this layer is not supported by SceneView`,i)}}_getTileInfoCompatibilityError(e,n,r){return e==null||!n.compatibleWith(e,r)?new t(`layerview:tiling-scheme-incompatible`,`The tiling scheme of this layer is incompatible with the tiling scheme of the surface`):null}levelRangeFromScaleRange(e,t){let n={minLevel:0,maxLevel:1/0},r=this.view&&this.view.basemapTerrain&&this.view.basemapTerrain.tilingScheme;if(!r)return n;let i=r.levels[0],a=e=>{let t=Math.log(i.scale/e)/Math.LN2;return .5-Math.abs(.5-t%1)<1e-9?Math.round(t):Math.ceil(t)};return e!=null&&e>0&&(n.minLevel=Math.max(0,a(e))),t!=null&&t>0&&(n.maxLevel=Math.max(0,a(t))),n}isUpdating(){return!!(this.view&&this.view.basemapTerrain&&this.view.basemapTerrain.updating)}};return e([r({readOnly:!0})],p.prototype,`imageFormatIsOpaque`,null),e([r({readOnly:!0})],p.prototype,`updating`,void 0),e([r(o)],p.prototype,`updatingProgress`,void 0),e([r(s)],p.prototype,`updatingProgressValue`,void 0),e([r()],p.prototype,`hasMixedImageFormats`,void 0),e([r()],p.prototype,`fullExtent`,null),e([r({readOnly:!0})],p.prototype,`isOpaque`,null),e([r({readOnly:!0})],p.prototype,`visibleAtCurrentScale`,null),e([r()],p.prototype,`dataScaleRange`,null),e([r({readOnly:!0})],p.prototype,`dataLevelRange`,null),e([r({readOnly:!0})],p.prototype,`displayLevelRange`,null),e([r()],p.prototype,`layer`,void 0),p=e([i(`esri.views.3d.layers.TiledLayerView3D`)],p),p};export{d as TiledLayerView3D};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{whenOnce as n}from"../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{isScaleRangeActive as a,validateScaleRange as o}from"../../../geometry/support/scaleUtils.js";import{LayerViewPerformanceInfo as s}from"./support/LayerViewPerformanceInfo.js";import{updatingProgress as c,updatingProgressValue as l}from"../support/updatingProperties.js";import{checkIfTileInfoSupportedForView as u}from"../terrain/terrainUtils.js";const d=d=>{let f=d,p=class extends f{constructor(){super(...arguments),this.hasMixedImageFormats=!0}get imageFormatIsOpaque(){return!1}get fullExtent(){return this.layer.fullExtent}get isOpaque(){return this.fullOpacity>=1&&this.imageFormatIsOpaque}initialize(){this.addHandles(this.view.basemapTerrain.on(`tile-data-changed`,({layerClass:e,layerIndex:t})=>{e===1&&t===this.view.basemapTerrain.getLayerIndexByUID(1,this.uid)&&this.notifyChange(`visibleAtCurrentScale`)}))}tilesVisibleAtCurrentScale(){let{minScale:e,maxScale:t}=this.layer;if(!a(e,t))return!0;let{basemapTerrain:n}=this.view,r=n.getLayerIndexByUID(1,this.uid);if(r==null)return!1;let{tilingScheme:i}=n,o=e&&i.levelAtScale(e),s=t&&i.levelAtScale(t);return n.renderer.visibleTiles.some(e=>!!e.layerInfo[1][r]&&(!o||e.level>=o)&&(!s||e.level<=s))}get visibleAtCurrentScale(){return this.tilesVisibleAtCurrentScale()}get dataScaleRange(){let e=this.tileInfo.lods,t=e[0].scale,n=e[e.length-1].scale;if(`tilemapCache`in this.layer&&this.layer.tilemapCache){let{effectiveMinLOD:e,effectiveMaxLOD:r}=this.layer.tilemapCache;t=this.tileInfo.lodAt(e).scale,n=this.tileInfo.lodAt(r).scale}return{minScale:t,maxScale:n}}canResume(){let e=this.layer&&`effectiveScaleRange`in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&!this.parent?.suspended&&this.view?.ready&&o(e)&&this.visibleAtCurrentTimeExtent||!1}get dataLevelRange(){let{minScale:e,maxScale:t}=this.dataScaleRange;return this.levelRangeFromScaleRange(e,t)}get displayLevelRange(){let e=this.layer.minScale||this.dataScaleRange.minScale,t=this.layer.maxScale||this.dataScaleRange.maxScale,n=this.levelRangeFromScaleRange(e,t);return this.layer.maxScale&&n.maxLevel++,n}get performanceInfo(){return new s(this.view.basemapTerrain.getUsedMemoryForLayerView(this))}getTileUrl(e){return`getTileUrl`in this.layer?this.layer.getTileUrl(e[0],e[1],e[2]):null}_addTilingSchemeMatchPromise(){if(this.fullExtent==null)return this.addResolvingPromise(Promise.reject(new t(`tilingscheme:extent-not-defined`,`This layer doesn't define a fullExtent.`)));let e=this._getTileInfoSupportError(this.tileInfo,this.fullExtent);if(e)return this.addResolvingPromise(Promise.reject(e));this.addResolvingPromise(n(()=>this.view?.basemapTerrain?.tilingSchemeLocked).then(()=>{let e=this.view.basemapTerrain.tilingScheme,t=`tilemapCache`in this.layer?this.layer.tilemapCache?.effectiveMaxLOD:void 0,n=this._getTileInfoCompatibilityError(this.tileInfo,e,t);if(n)throw n}))}_getTileInfoSupportError(e,n){let r=u(e,n,this.view.spatialReference,this.view.state.viewingMode,`tilemapCache`in this.layer?this.layer.tilemapCache?.effectiveMaxLOD:void 0);if(!r)return;let i={layer:this.layer,error:r};switch(r.name){case`tilingscheme:spatial-reference-mismatch`:case`tilingscheme:global-unsupported-spatial-reference`:case`tilingscheme:local-unsupported-spatial-reference`:return new t(`layerview:spatial-reference-incompatible`,`The spatial reference of this layer does not meet the requirements of the view`,i);default:return new t(`layerview:tiling-scheme-unsupported`,`The tiling scheme of this layer is not supported by SceneView`,i)}}_getTileInfoCompatibilityError(e,n,r){return e==null||!n.compatibleWith(e,r)?new t(`layerview:tiling-scheme-incompatible`,`The tiling scheme of this layer is incompatible with the tiling scheme of the surface`):null}levelRangeFromScaleRange(e,t){let n={minLevel:0,maxLevel:1/0},r=this.view&&this.view.basemapTerrain&&this.view.basemapTerrain.tilingScheme;if(!r)return n;let i=r.levels[0],a=e=>{let t=Math.log(i.scale/e)/Math.LN2;return .5-Math.abs(.5-t%1)<1e-9?Math.round(t):Math.ceil(t)};return e!=null&&e>0&&(n.minLevel=Math.max(0,a(e))),t!=null&&t>0&&(n.maxLevel=Math.max(0,a(t))),n}isUpdating(){return!!(this.view&&this.view.basemapTerrain&&this.view.basemapTerrain.updating)}};return e([r({readOnly:!0})],p.prototype,`imageFormatIsOpaque`,null),e([r({readOnly:!0})],p.prototype,`updating`,void 0),e([r(c)],p.prototype,`updatingProgress`,void 0),e([r(l)],p.prototype,`updatingProgressValue`,void 0),e([r()],p.prototype,`hasMixedImageFormats`,void 0),e([r()],p.prototype,`fullExtent`,null),e([r({readOnly:!0})],p.prototype,`isOpaque`,null),e([r({readOnly:!0})],p.prototype,`visibleAtCurrentScale`,null),e([r()],p.prototype,`dataScaleRange`,null),e([r({readOnly:!0})],p.prototype,`dataLevelRange`,null),e([r({readOnly:!0})],p.prototype,`displayLevelRange`,null),e([r()],p.prototype,`layer`,void 0),p=e([i(`esri.views.3d.layers.TiledLayerView3D`)],p),p};export{d as TiledLayerView3D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import n from"../../../core/Logger.js";import{watch as r,initial as i}from"../../../core/reactiveUtils.js";import{property as a,subclass as o}from"../../../core/accessorSupport/decorators.js";import{cross as s,normalize as c,set as l}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import d from"../../../geometry/SpatialReference.js";import{projectVectorToVector as f}from"../../../geometry/projection/projectVectorToVector.js";import{empty as p,expandWithVec3 as m}from"../../../geometry/support/aaBoundingBox.js";import{equals as h}from"../../../geometry/support/spatialReferenceUtils.js";import{LayerView3D as g}from"./LayerView3D.js";import{VoxelGraphic as _}from"./VoxelGraphic.js";import{addLayerViewToWasm as v,getVoxelWasm as y,removeLayerViewFromWasm as b}from"./VoxelWasm.js";import{LayerViewPerformanceInfo as x}from"./support/LayerViewPerformanceInfo.js";import{PopupSceneLayerView as S}from"./support/PopupSceneLayerView.js";import C from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as w,isInEffectiveScaleRange as T}from"../../support/layerViewUtils.js";const E=u(),D=u();let O=class extends S(g(C)){constructor(){super(...arguments),this.type=`voxel-3d`,this.ignoresMemoryFactor=!0,this._suspendedHandle=null,this._usedMemory=0,this._futureMemory=0,this.slicePlaneEnabled=!1,this._wasmLayerId=-1,this._dbgFlags=new Set}initialize(){if(this._dbgFlags.add(3),this.view.viewingMode!==`local`)throw new t(`voxel:unsupported-viewingMode`,`Voxel layers support local viewingMode only.`,{});if(!this.view.stage.renderView.renderingContext.capabilities.colorBufferFloat?.textureFloat)throw new t(`voxel:missing-color-buffer-float`,`Voxel layers require the WebGL2 extension EXT_color_buffer_float`,{});let e=this.layer.spatialReference;if(!h(e,this.view.spatialReference))throw w(`voxel layer`,e.wkid,this.view.spatialReference.wkid);let n=this.layer.currentVariableId,a=this.layer.getVolume(n),o=this.layer.getVariable(n);if(a!=null&&o!=null){let e=a.dimensions[0],t=a.dimensions[1],n=a.zDimension;if(n>1){let r=a.dimensions[n],i=e.size*t.size*r.size,s=1;switch(o.renderingFormat.type){case`Int16`:case`UInt16`:s=2;break;case`Int32`:case`UInt32`:case`Float32`:s=4}this._futureMemory=s*i}}let s=v(this).then(e=>{this._wasmLayerId=e,this._suspendedHandle=r(()=>this.suspended,e=>{let t=y(this.view);t&&t.setEnabled(this,!e)},i),this.addHandles([r(()=>this.layer.renderMode,e=>this._pushRenderModeToWasm(e)),r(()=>this.layer.currentVariableId,e=>this._pushCurrentVariableIdToWasm(e)),r(()=>this.layer.getSections(),e=>this._pushSectionsToWasm(e)),r(()=>this.layer.getVariableStyles(),e=>this._pushVariableStylesToWasm(e)),r(()=>this.layer.getVolumeStyles(),e=>this._pushVolumeStylesToWasm(e)),r(()=>this.layer.enableDynamicSections,e=>this._pushEnableDynamicSectionsToWasm(e)),r(()=>this.layer.enableIsosurfaces,e=>this._pushEnableIsosurfacesToWasm(e)),r(()=>this.layer.enableSections,e=>this._pushEnableSectionsToWasm(e)),r(()=>this.layer.enableSlices,e=>this._pushEnableSlicesToWasm(e)),r(()=>[this.layer.timeOffset,this.layer.timeExtent,this.layer.useViewTime],()=>this._updateLayerTimeProperties()),r(()=>this.slicePlaneEnabled,e=>this._pushAnalysisSliceToWasm(e,this.view.slice.plane)),r(()=>this.view.slice.plane,e=>this._pushAnalysisSliceToWasm(this.slicePlaneEnabled,e))])}).catch(e=>{if(b(this),this._wasmLayerId=-1,e===-1)throw new t(`voxel:addLayer-failure`,`The voxel layer description was invalid.`,{});if(e===-2)throw new t(`voxel:addLayer-failure`,`The voxel layer web assembly module failed to download.`,{})});this.addResolvingPromise(s)}destroy(){b(this),this._suspendedHandle&&=(this._suspendedHandle.remove(),null)}isUpdating(){let e=y(this.view);return this._wasmLayerId<0||e==null?!1:e.isUpdating(this._wasmLayerId)}updatingFlagChanged(){this.notifyChange(`updating`)}get usedMemory(){return this._usedMemory}get unloadedMemory(){return this._futureMemory}get performanceInfo(){return new x(this.usedMemory)}get visibleAtCurrentScale(){return T(this.layer.effectiveScaleRange,this.view.scale)}whenGraphicBounds(e,t){let n=e.attributes[`Voxel.WorldPosition`];if(n){let e=p(),t=JSON.parse(n);if(f(t,this.view.renderSpatialReference,D,this.view.spatialReference||d.WGS84))return m(e,D),Promise.resolve({boundingBox:e,screenSpaceObjects:[]})}return Promise.reject()}async whenGraphicAttributes(e,t){let n=y(this.view);if(!n)return e;let r=[];for(let t of e)this._isValidVoxelGraphic(t)&&r.push(t);return r.length&&await n.getOtherFieldPopupValues(r,t),e}_isValidVoxelGraphic(e){return e instanceof _}setUsedMemory(e){this._usedMemory=e,this._futureMemory=0}captureFrustum(){y(this.view)?.captureFrustum()}toggleFullVolumeExtentDraw(){y(this.view)?.toggleFullVolumeExtentDraw(this)}getLayerTimes(){return y(this.view)?.getLayerTimes(this)??[]}getCurrentLayerTimeIndex(){return y(this.view)?.getCurrentLayerTimeIndex(this)??0}dropQueryRenderTarget(){y(this.view)?.dropQueryRenderTarget()}_pushRenderModeToWasm(e){let t=y(this.view);this._dbg(2,`VoxelLayerView3D._pushRenderModeToWasm() called, ${t?`have WASM`:`don't have WASM!!!`}`),t?.setRenderMode(this,e)||this._dbg(3,`VoxelLayerView3D._pushRenderModeToWasm() failed!`)}_pushSectionsToWasm(e){let t=y(this.view);this._dbg(2,`VoxelLayerView3D._pushSectionsToWasm() called, ${t?`have WASM`:`don't have WASM!!!`}`),t?.setStaticSections(this,e)||this._dbg(3,`VoxelLayerView3D._pushSectionsToWasm() failed!`)}_pushCurrentVariableIdToWasm(e){let t=y(this.view);this._dbg(2,`VoxelLayerView3D._pushCurrentVariableIdToWasm() called!, ${t?`have WASM`:`don't have WASM!!!`}`),t?.setCurrentVariable(this,e)||this._dbg(3,`VoxelLayerView3D._pushCurrentVariableIdToWasm() failed!`)}_pushVariableStylesToWasm(e){let t=y(this.view);this._dbg(2,`VoxelLayerView3D._pushVariableStylesToWasm() called, ${t?`have WASM`:`don't have WASM!!!`}`),t?.setVariableStyles(this,e)||this._dbg(3,`VoxelLayerView3D._pushVariableStylesToWasm() failed!`)}_accountForEnableSlices(e,t){let n=t??this.layer.enableSlices;for(let t=0;t<e.length;++t){let r=e[t];for(let e of r.slices)e.enabled=e.enabled&&n}}_pushVolumeStylesToWasm(e){let t=y(this.view);this._dbg(2,`VoxelLayerView3D._pushVolumeStylesToWasm() called, ${t?`have WASM`:`don't have WASM!!!`}`),t&&(this._accountForEnableSlices(e,null),t.setVolumeStyles(this,e)||this._dbg(3,`VoxelLayerView3D._pushVolumeStylesToWasm() failed!`))}_pushAnalysisSliceToWasm(e,t){let n=y(this.view);this._dbg(2,`VoxelLayerView3D._pushAnalysisSliceToWasm() called, ${n?`have WASM`:`don't have WASM!!!`}`);let r=!1;if(n){if(t){let i=t.origin;s(E,t.basis1,t.basis2),c(E,E),r=n.setAnalysisSlice(this,e,i,E)}else l(E,0,0,1),r=n.setAnalysisSlice(this,!1,E,E);r||this._dbg(3,`VoxelLayerView3D._pushAnalysisSliceToWasm() failed!`)}}_updateLayerTimeProperties(){let e=y(this.view);this._dbg(2,`VoxelLayerView3D._updateLayerTimeProperties() called, ${e?`have WASM`:`don't have WASM!!!`}`),e&&e.updateLayerTimeProperties(this)}_pushEnableDynamicSectionsToWasm(e){let t=y(this.view);this._dbg(2,`VoxelLayerView3D._pushEnableDynamicSectionsToWasm() called, ${t?`have WASM`:`don't have WASM!!!`}`),t?.setEnableDynamicSections(this,e)||this._dbg(3,`VoxelLayerView3D._pushEnableDynamicSectionsToWasm() failed!`)}_pushEnableSlicesToWasm(e){let t=y(this.view);if(this._dbg(2,`VoxelLayerView3D._pushEnableSlicesToWasm() called, ${t?`have WASM`:`don't have WASM!!!`}`),t){let n=this.layer.getVolumeStyles();this._accountForEnableSlices(n,e),t.setVolumeStyles(this,n)||this._dbg(3,`VoxelLayerView3D._pushEnableSlicesToWasm() failed!`)}}_pushEnableIsosurfacesToWasm(e){let t=y(this.view);this._dbg(2,`VoxelLayerView3D._pushEnableIsosurfacesToWasm() called, ${t?`have WASM`:`don't have WASM!!!`}`),t?.setEnableIsosurfaces(this,e)||this._dbg(3,`VoxelLayerView3D._pushEnableIsosurfacesToWasm() failed!`)}_pushEnableSectionsToWasm(e){let t=y(this.view);this._dbg(2,`VoxelLayerView3D._pushEnableSectionsToWasm() called, ${t?`have WASM`:`don't have WASM!!!`}`),t?.setEnableSections(this,e)||this._dbg(3,`VoxelLayerView3D._pushEnableSectionsToWasm() failed!`)}get baseUrl(){return this.layer.parsedUrl?.path??``}get wasmLayerId(){return this._wasmLayerId}_dbg(e,t){this._dbgFlags.has(e)&&(e===3?n.getLogger(this).error(t):n.getLogger(this).warn(t))}};e([a({readOnly:!0})],O.prototype,`visibleAtCurrentScale`,null),e([a()],O.prototype,`layer`,void 0),e([a()],O.prototype,`baseUrl`,null),e([a({type:Boolean})],O.prototype,`slicePlaneEnabled`,void 0),O=e([o(`esri.views.3d.layers.VoxelLayerView3D`)],O);const k=O;export{k as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import n from"../../../core/Logger.js";import{watch as r,initial as i}from"../../../core/reactiveUtils.js";import{property as a,subclass as o}from"../../../core/accessorSupport/decorators.js";import{cross as s,normalize as c,set as l}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import d from"../../../geometry/SpatialReference.js";import{projectVectorToVector as f}from"../../../geometry/projection/projectVectorToVector.js";import{empty as p,expandWithVec3 as m}from"../../../geometry/support/aaBoundingBox.js";import{isInEffectiveScaleRange as h}from"../../../geometry/support/scaleUtils.js";import{equals as g}from"../../../geometry/support/spatialReferenceUtils.js";import{LayerView3D as _}from"./LayerView3D.js";import{VoxelGraphic as v}from"./VoxelGraphic.js";import{addLayerViewToWasm as y,getVoxelWasm as b,removeLayerViewFromWasm as x}from"./VoxelWasm.js";import{LayerViewPerformanceInfo as S}from"./support/LayerViewPerformanceInfo.js";import{PopupSceneLayerView as C}from"./support/PopupSceneLayerView.js";import w from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as T}from"../../support/layerViewUtils.js";const E=u(),D=u();let O=class extends C(_(w)){constructor(){super(...arguments),this.type=`voxel-3d`,this.ignoresMemoryFactor=!0,this._suspendedHandle=null,this._usedMemory=0,this._futureMemory=0,this.slicePlaneEnabled=!1,this._wasmLayerId=-1,this._dbgFlags=new Set}initialize(){if(this._dbgFlags.add(3),this.view.viewingMode!==`local`)throw new t(`voxel:unsupported-viewingMode`,`Voxel layers support local viewingMode only.`,{});if(!this.view.stage.renderView.renderingContext.capabilities.colorBufferFloat?.textureFloat)throw new t(`voxel:missing-color-buffer-float`,`Voxel layers require the WebGL2 extension EXT_color_buffer_float`,{});let e=this.layer.spatialReference;if(!g(e,this.view.spatialReference))throw T(`voxel layer`,e.wkid,this.view.spatialReference.wkid);let n=this.layer.currentVariableId,a=this.layer.getVolume(n),o=this.layer.getVariable(n);if(a!=null&&o!=null){let e=a.dimensions[0],t=a.dimensions[1],n=a.zDimension;if(n>1){let r=a.dimensions[n],i=e.size*t.size*r.size,s=1;switch(o.renderingFormat.type){case`Int16`:case`UInt16`:s=2;break;case`Int32`:case`UInt32`:case`Float32`:s=4}this._futureMemory=s*i}}let s=y(this).then(e=>{this._wasmLayerId=e,this._suspendedHandle=r(()=>this.suspended,e=>{let t=b(this.view);t&&t.setEnabled(this,!e)},i),this.addHandles([r(()=>this.layer.renderMode,e=>this._pushRenderModeToWasm(e)),r(()=>this.layer.currentVariableId,e=>this._pushCurrentVariableIdToWasm(e)),r(()=>this.layer.getSections(),e=>this._pushSectionsToWasm(e)),r(()=>this.layer.getVariableStyles(),e=>this._pushVariableStylesToWasm(e)),r(()=>this.layer.getVolumeStyles(),e=>this._pushVolumeStylesToWasm(e)),r(()=>this.layer.enableDynamicSections,e=>this._pushEnableDynamicSectionsToWasm(e)),r(()=>this.layer.enableIsosurfaces,e=>this._pushEnableIsosurfacesToWasm(e)),r(()=>this.layer.enableSections,e=>this._pushEnableSectionsToWasm(e)),r(()=>this.layer.enableSlices,e=>this._pushEnableSlicesToWasm(e)),r(()=>[this.layer.timeOffset,this.layer.timeExtent,this.layer.useViewTime],()=>this._updateLayerTimeProperties()),r(()=>this.slicePlaneEnabled,e=>this._pushAnalysisSliceToWasm(e,this.view.slice.plane)),r(()=>this.view.slice.plane,e=>this._pushAnalysisSliceToWasm(this.slicePlaneEnabled,e))])}).catch(e=>{if(x(this),this._wasmLayerId=-1,e===-1)throw new t(`voxel:addLayer-failure`,`The voxel layer description was invalid.`,{});if(e===-2)throw new t(`voxel:addLayer-failure`,`The voxel layer web assembly module failed to download.`,{})});this.addResolvingPromise(s)}destroy(){x(this),this._suspendedHandle&&=(this._suspendedHandle.remove(),null)}isUpdating(){let e=b(this.view);return this._wasmLayerId<0||e==null?!1:e.isUpdating(this._wasmLayerId)}updatingFlagChanged(){this.notifyChange(`updating`)}get usedMemory(){return this._usedMemory}get unloadedMemory(){return this._futureMemory}get performanceInfo(){return new S(this.usedMemory)}get visibleAtCurrentScale(){return h(this.layer.effectiveScaleRange,this.view.scale)}whenGraphicBounds(e,t){let n=e.attributes[`Voxel.WorldPosition`];if(n){let e=p(),t=JSON.parse(n);if(f(t,this.view.renderSpatialReference,D,this.view.spatialReference||d.WGS84))return m(e,D),Promise.resolve({boundingBox:e,screenSpaceObjects:[]})}return Promise.reject()}async whenGraphicAttributes(e,t){let n=b(this.view);if(!n)return e;let r=[];for(let t of e)this._isValidVoxelGraphic(t)&&r.push(t);return r.length&&await n.getOtherFieldPopupValues(r,t),e}_isValidVoxelGraphic(e){return e instanceof v}setUsedMemory(e){this._usedMemory=e,this._futureMemory=0}captureFrustum(){b(this.view)?.captureFrustum()}toggleFullVolumeExtentDraw(){b(this.view)?.toggleFullVolumeExtentDraw(this)}getLayerTimes(){return b(this.view)?.getLayerTimes(this)??[]}getCurrentLayerTimeIndex(){return b(this.view)?.getCurrentLayerTimeIndex(this)??0}dropQueryRenderTarget(){b(this.view)?.dropQueryRenderTarget()}_pushRenderModeToWasm(e){let t=b(this.view);this._dbg(2,`VoxelLayerView3D._pushRenderModeToWasm() called, ${t?`have WASM`:`don't have WASM!!!`}`),t?.setRenderMode(this,e)||this._dbg(3,`VoxelLayerView3D._pushRenderModeToWasm() failed!`)}_pushSectionsToWasm(e){let t=b(this.view);this._dbg(2,`VoxelLayerView3D._pushSectionsToWasm() called, ${t?`have WASM`:`don't have WASM!!!`}`),t?.setStaticSections(this,e)||this._dbg(3,`VoxelLayerView3D._pushSectionsToWasm() failed!`)}_pushCurrentVariableIdToWasm(e){let t=b(this.view);this._dbg(2,`VoxelLayerView3D._pushCurrentVariableIdToWasm() called!, ${t?`have WASM`:`don't have WASM!!!`}`),t?.setCurrentVariable(this,e)||this._dbg(3,`VoxelLayerView3D._pushCurrentVariableIdToWasm() failed!`)}_pushVariableStylesToWasm(e){let t=b(this.view);this._dbg(2,`VoxelLayerView3D._pushVariableStylesToWasm() called, ${t?`have WASM`:`don't have WASM!!!`}`),t?.setVariableStyles(this,e)||this._dbg(3,`VoxelLayerView3D._pushVariableStylesToWasm() failed!`)}_accountForEnableSlices(e,t){let n=t??this.layer.enableSlices;for(let t=0;t<e.length;++t){let r=e[t];for(let e of r.slices)e.enabled=e.enabled&&n}}_pushVolumeStylesToWasm(e){let t=b(this.view);this._dbg(2,`VoxelLayerView3D._pushVolumeStylesToWasm() called, ${t?`have WASM`:`don't have WASM!!!`}`),t&&(this._accountForEnableSlices(e,null),t.setVolumeStyles(this,e)||this._dbg(3,`VoxelLayerView3D._pushVolumeStylesToWasm() failed!`))}_pushAnalysisSliceToWasm(e,t){let n=b(this.view);this._dbg(2,`VoxelLayerView3D._pushAnalysisSliceToWasm() called, ${n?`have WASM`:`don't have WASM!!!`}`);let r=!1;if(n){if(t){let i=t.origin;s(E,t.basis1,t.basis2),c(E,E),r=n.setAnalysisSlice(this,e,i,E)}else l(E,0,0,1),r=n.setAnalysisSlice(this,!1,E,E);r||this._dbg(3,`VoxelLayerView3D._pushAnalysisSliceToWasm() failed!`)}}_updateLayerTimeProperties(){let e=b(this.view);this._dbg(2,`VoxelLayerView3D._updateLayerTimeProperties() called, ${e?`have WASM`:`don't have WASM!!!`}`),e&&e.updateLayerTimeProperties(this)}_pushEnableDynamicSectionsToWasm(e){let t=b(this.view);this._dbg(2,`VoxelLayerView3D._pushEnableDynamicSectionsToWasm() called, ${t?`have WASM`:`don't have WASM!!!`}`),t?.setEnableDynamicSections(this,e)||this._dbg(3,`VoxelLayerView3D._pushEnableDynamicSectionsToWasm() failed!`)}_pushEnableSlicesToWasm(e){let t=b(this.view);if(this._dbg(2,`VoxelLayerView3D._pushEnableSlicesToWasm() called, ${t?`have WASM`:`don't have WASM!!!`}`),t){let n=this.layer.getVolumeStyles();this._accountForEnableSlices(n,e),t.setVolumeStyles(this,n)||this._dbg(3,`VoxelLayerView3D._pushEnableSlicesToWasm() failed!`)}}_pushEnableIsosurfacesToWasm(e){let t=b(this.view);this._dbg(2,`VoxelLayerView3D._pushEnableIsosurfacesToWasm() called, ${t?`have WASM`:`don't have WASM!!!`}`),t?.setEnableIsosurfaces(this,e)||this._dbg(3,`VoxelLayerView3D._pushEnableIsosurfacesToWasm() failed!`)}_pushEnableSectionsToWasm(e){let t=b(this.view);this._dbg(2,`VoxelLayerView3D._pushEnableSectionsToWasm() called, ${t?`have WASM`:`don't have WASM!!!`}`),t?.setEnableSections(this,e)||this._dbg(3,`VoxelLayerView3D._pushEnableSectionsToWasm() failed!`)}get baseUrl(){return this.layer.parsedUrl?.path??``}get wasmLayerId(){return this._wasmLayerId}_dbg(e,t){this._dbgFlags.has(e)&&(e===3?n.getLogger(this).error(t):n.getLogger(this).warn(t))}};e([a({readOnly:!0})],O.prototype,`visibleAtCurrentScale`,null),e([a()],O.prototype,`layer`,void 0),e([a()],O.prototype,`baseUrl`,null),e([a({type:Boolean})],O.prototype,`slicePlaneEnabled`,void 0),O=e([o(`esri.views.3d.layers.VoxelLayerView3D`)],O);const k=O;export{k as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import n from"../../../../core/Logger.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as a}from"../../../../core/support/UpdatingHandles.js";import{projectBoundingRect as o}from"../../../../geometry/projection/projectBoundingRect.js";import{create as s}from"../../../../geometry/support/aaBoundingRect.js";import{scaleBoundsPredicate as c}from"../../../support/layerViewUtils.js";import{TaskPriority as l}from"../../../support/Scheduler.js";import{Yield as u}from"../../../support/Yield.js";let d=class extends t{constructor(e){super(e),this._scaleRangeActive=!1,this._layerScaleRangeVisibilityQuery=!1,this._extent=null,this._updatingHandles=new a,this.graphicsCoreOwner=null,this.layer=null,this.queryGraphicUIDsInExtent=null,this.graphicsCore=null,this.basemapTerrain=null,this.layerScaleEnabled=!0,this.suspended=!1,this._dirty=!0}initialize(){this.updateScaleRangeActive();let e=this.graphicsCoreOwner.view.resourceController.scheduler;this.addHandles(e.registerTask(l.SCALE_VISIBILITY,this)),this._updatingHandles.add(()=>this.layer.effectiveScaleRange,()=>this.layerMinMaxScaleChangeHandler())}destroy(){this._updatingHandles.destroy(),this.removeHandles(),this._dirty=!1,this._extent=null,this.graphicsCoreOwner=null,this.layer=null,this.queryGraphicUIDsInExtent=null,this.graphicsCore=null,this.basemapTerrain=null}get updating(){return this._dirty||this._updatingHandles.updating}_setDirty(){this._dirty=!0}setExtent(e){let t=this.graphicsCoreOwner.view.spatialReference,n=this.graphicsCoreOwner.view.groundView.spatialReference;if(t===n)this._extent=e??null;else{let r=s();this._extent=o(e,t,r,n)?r:null}this._setDirty()}scaleRangeActive(){return this._scaleRangeActive}updateScaleRangeActive(){let e=this.layer,t=e.effectiveScaleRange,n=this.layerScaleEnabled&&t!=null&&f(t.minScale,t.maxScale);e.labelingInfo&&!n&&(n=e.labelingInfo.some(e=>e&&f(e.minScale??0,e.maxScale??0)));let r=this._scaleRangeActive!==n;return this._scaleRangeActive=n,n&&!this.hasHandles(p)&&this.basemapTerrain?(this.addHandles(this.basemapTerrain.on(`scale-change`,e=>this._scaleUpdateHandler(e)),p),this.layerScaleEnabled&&this.addHandles(this.basemapTerrain.on(`tiles-visibility-changed`,()=>this._setDirty()),p)):!n&&this.hasHandles(p)&&this.removeHandles(p),r}get readyToRun(){return!!(this.graphicsCoreOwner.view.basemapTerrain&&this.updating)}runTask(e){let{groundView:t}=this.graphicsCoreOwner.view;if(!this._extent||!t||!t.ready||!this._scaleRangeActive||!this.layerScaleEnabled)this._finishUpdate(!0);else if(this._layerScaleRangeVisibilityQuery)return u;else{this._layerScaleRangeVisibilityQuery=!0;let{minScale:e,maxScale:t}=this.layer.effectiveScaleRange;this.graphicsCoreOwner.view.basemapTerrain.queryVisibleScaleRange(this._extent,e,t,e=>this._finishUpdate(e))}e.madeProgress()}_finishUpdate(e){this._layerScaleRangeVisibilityQuery=!1,this._set(`suspended`,!e),this._dirty=!1}_visibleAtLayerScale(e){let t=this.layer.effectiveScaleRange;return!this.layerScaleEnabled||c(e,t.minScale||0,t.maxScale||0)}_visibleAtLabelScale(e,t){return c(e,t.minScale||0,t.maxScale||0)}_graphicScale(e){let t;return e.centroid==null?e.graphic.geometry!=null&&e.graphic.geometry.type===`point`&&(t=e.graphic.geometry):t=e.centroid,t?this.graphicsCoreOwner.view.basemapTerrain?this.graphicsCoreOwner.view.basemapTerrain.getScale(t):1:null}_graphicVisible(e){if(!this.layerScaleEnabled)return!0;let t=this._graphicScale(e);return this._visibleAtLayerScale(t)}updateVisibility(e){if(!this._scaleRangeActive)return!1;let t=this._graphicVisible(e);return e.setVisibilityFlag(1,2,t)}updateGraphicLabelScaleVisibility(e){if(!this._scaleRangeActive||!e.labelLayers.length)return!1;let t=this._graphicScale(e),n=this._updateLabelScaleVisibility(e,t);return n&&(this.graphicsCore.deconflictor?.setDirty(),this.graphicsCore.labeler?.setDirty()),n}_updateLabelScaleVisibility(e,t){if(!e.labelLayers.length)return!1;let n=e.labelLayers[0].labelClass;if(n?.minScale!=null&&n.maxScale!=null){let r=this._visibleAtLabelScale(t,n);if(e.setVisibilityFlag(16,2,r))return!0}return!1}_scaleUpdateHandler(e){if(this._setDirty(),!this.graphicsCore.visible)return;let t=e.extent,r=e.scale,i=this._visibleAtLayerScale(r),a=!1,s=this.graphicsCoreOwner.view.spatialReference,c=e.spatialReference;if(c==null){n.getLogger(this).error(`scaleUpdate: Internal error, no SpatialReference given for tiles`);return}let l=!c.equals(s);if(l&&!o(t,c,m,s)){n.getLogger(this).error(`scaleUpdate: Internal error, cannot project AABR from `+c+` to wkid `+s);return}let u=l?m:t;this.queryGraphicUIDsInExtent(u,s,e=>{let n=this.graphicsCore.getGraphics3DGraphicById(e);if(n==null)return;let o=n.centroid;o!=null&&(t[0]>o.x||t[1]>o.y||t[2]<o.x||t[3]<o.y)||(n.setVisibilityFlag(1,2,i)&&(a=!0),this._updateLabelScaleVisibility(n,r)&&(a=!0))}),a&&(this.graphicsCore.deconflictor?.setDirty(),this.graphicsCore.labeler?.setDirty())}layerMinMaxScaleChangeHandler(){this.updateScaleRangeActive()&&!this._scaleRangeActive?this.graphicsCore.modifyGraphics3DGraphicVisibilities(e=>e.setVisibilityFlag(1,2,!0)):this._scaleRangeActive&&this.graphicsCore.updateGraphicsVisibilities(),this._setDirty()}};e([r()],d.prototype,`graphicsCoreOwner`,void 0),e([r()],d.prototype,`layer`,void 0),e([r()],d.prototype,`queryGraphicUIDsInExtent`,void 0),e([r()],d.prototype,`graphicsCore`,void 0),e([r()],d.prototype,`basemapTerrain`,void 0),e([r({constructOnly:!0})],d.prototype,`layerScaleEnabled`,void 0),e([r({readOnly:!0})],d.prototype,`suspended`,void 0),e([r({readOnly:!0})],d.prototype,`updating`,null),e([r()],d.prototype,`_dirty`,void 0),d=e([i(`esri.views.3d.layers.graphics.Graphics3DScaleVisibility`)],d);function f(e,t){return e>0||t>0}const p=`terrain-events`,m=s();export{d as Graphics3DScaleVisibility};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import n from"../../../../core/Logger.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as a}from"../../../../core/support/UpdatingHandles.js";import{projectBoundingRect as o}from"../../../../geometry/projection/projectBoundingRect.js";import{create as s}from"../../../../geometry/support/aaBoundingRect.js";import{scaleBoundsPredicate as c}from"../../../../geometry/support/scaleUtils.js";import{TaskPriority as l}from"../../../support/Scheduler.js";import{Yield as u}from"../../../support/Yield.js";let d=class extends t{constructor(e){super(e),this._scaleRangeActive=!1,this._layerScaleRangeVisibilityQuery=!1,this._extent=null,this._updatingHandles=new a,this.graphicsCoreOwner=null,this.layer=null,this.queryGraphicUIDsInExtent=null,this.graphicsCore=null,this.basemapTerrain=null,this.layerScaleEnabled=!0,this.suspended=!1,this._dirty=!0}initialize(){this.updateScaleRangeActive();let e=this.graphicsCoreOwner.view.resourceController.scheduler;this.addHandles(e.registerTask(l.SCALE_VISIBILITY,this)),this._updatingHandles.add(()=>this.layer.effectiveScaleRange,()=>this.layerMinMaxScaleChangeHandler())}destroy(){this._updatingHandles.destroy(),this.removeHandles(),this._dirty=!1,this._extent=null,this.graphicsCoreOwner=null,this.layer=null,this.queryGraphicUIDsInExtent=null,this.graphicsCore=null,this.basemapTerrain=null}get updating(){return this._dirty||this._updatingHandles.updating}_setDirty(){this._dirty=!0}setExtent(e){let t=this.graphicsCoreOwner.view.spatialReference,n=this.graphicsCoreOwner.view.groundView.spatialReference;if(t===n)this._extent=e??null;else{let r=s();this._extent=o(e,t,r,n)?r:null}this._setDirty()}scaleRangeActive(){return this._scaleRangeActive}updateScaleRangeActive(){let e=this.layer,t=e.effectiveScaleRange,n=this.layerScaleEnabled&&t!=null&&f(t.minScale,t.maxScale);e.labelingInfo&&!n&&(n=e.labelingInfo.some(e=>e&&f(e.minScale??0,e.maxScale??0)));let r=this._scaleRangeActive!==n;return this._scaleRangeActive=n,n&&!this.hasHandles(p)&&this.basemapTerrain?(this.addHandles(this.basemapTerrain.on(`scale-change`,e=>this._scaleUpdateHandler(e)),p),this.layerScaleEnabled&&this.addHandles(this.basemapTerrain.on(`tiles-visibility-changed`,()=>this._setDirty()),p)):!n&&this.hasHandles(p)&&this.removeHandles(p),r}get readyToRun(){return!!(this.graphicsCoreOwner.view.basemapTerrain&&this.updating)}runTask(e){let{groundView:t}=this.graphicsCoreOwner.view;if(!this._extent||!t||!t.ready||!this._scaleRangeActive||!this.layerScaleEnabled)this._finishUpdate(!0);else if(this._layerScaleRangeVisibilityQuery)return u;else{this._layerScaleRangeVisibilityQuery=!0;let{minScale:e,maxScale:t}=this.layer.effectiveScaleRange;this.graphicsCoreOwner.view.basemapTerrain.queryVisibleScaleRange(this._extent,e,t,e=>this._finishUpdate(e))}e.madeProgress()}_finishUpdate(e){this._layerScaleRangeVisibilityQuery=!1,this._set(`suspended`,!e),this._dirty=!1}_visibleAtLayerScale(e){let t=this.layer.effectiveScaleRange;return!this.layerScaleEnabled||c(e,t.minScale||0,t.maxScale||0)}_visibleAtLabelScale(e,t){return c(e,t.minScale||0,t.maxScale||0)}_graphicScale(e){let t;return e.centroid==null?e.graphic.geometry!=null&&e.graphic.geometry.type===`point`&&(t=e.graphic.geometry):t=e.centroid,t?this.graphicsCoreOwner.view.basemapTerrain?this.graphicsCoreOwner.view.basemapTerrain.getScale(t):1:null}_graphicVisible(e){if(!this.layerScaleEnabled)return!0;let t=this._graphicScale(e);return this._visibleAtLayerScale(t)}updateVisibility(e){if(!this._scaleRangeActive)return!1;let t=this._graphicVisible(e);return e.setVisibilityFlag(1,2,t)}updateGraphicLabelScaleVisibility(e){if(!this._scaleRangeActive||!e.labelLayers.length)return!1;let t=this._graphicScale(e),n=this._updateLabelScaleVisibility(e,t);return n&&(this.graphicsCore.deconflictor?.setDirty(),this.graphicsCore.labeler?.setDirty()),n}_updateLabelScaleVisibility(e,t){if(!e.labelLayers.length)return!1;let n=e.labelLayers[0].labelClass;if(n?.minScale!=null&&n.maxScale!=null){let r=this._visibleAtLabelScale(t,n);if(e.setVisibilityFlag(16,2,r))return!0}return!1}_scaleUpdateHandler(e){if(this._setDirty(),!this.graphicsCore.visible)return;let t=e.extent,r=e.scale,i=this._visibleAtLayerScale(r),a=!1,s=this.graphicsCoreOwner.view.spatialReference,c=e.spatialReference;if(c==null){n.getLogger(this).error(`scaleUpdate: Internal error, no SpatialReference given for tiles`);return}let l=!c.equals(s);if(l&&!o(t,c,m,s)){n.getLogger(this).error(`scaleUpdate: Internal error, cannot project AABR from `+c+` to wkid `+s);return}let u=l?m:t;this.queryGraphicUIDsInExtent(u,s,e=>{let n=this.graphicsCore.getGraphics3DGraphicById(e);if(n==null)return;let o=n.centroid;o!=null&&(t[0]>o.x||t[1]>o.y||t[2]<o.x||t[3]<o.y)||(n.setVisibilityFlag(1,2,i)&&(a=!0),this._updateLabelScaleVisibility(n,r)&&(a=!0))}),a&&(this.graphicsCore.deconflictor?.setDirty(),this.graphicsCore.labeler?.setDirty())}layerMinMaxScaleChangeHandler(){this.updateScaleRangeActive()&&!this._scaleRangeActive?this.graphicsCore.modifyGraphics3DGraphicVisibilities(e=>e.setVisibilityFlag(1,2,!0)):this._scaleRangeActive&&this.graphicsCore.updateGraphicsVisibilities(),this._setDirty()}};e([r()],d.prototype,`graphicsCoreOwner`,void 0),e([r()],d.prototype,`layer`,void 0),e([r()],d.prototype,`queryGraphicUIDsInExtent`,void 0),e([r()],d.prototype,`graphicsCore`,void 0),e([r()],d.prototype,`basemapTerrain`,void 0),e([r({constructOnly:!0})],d.prototype,`layerScaleEnabled`,void 0),e([r({readOnly:!0})],d.prototype,`suspended`,void 0),e([r({readOnly:!0})],d.prototype,`updating`,null),e([r()],d.prototype,`_dirty`,void 0),d=e([i(`esri.views.3d.layers.graphics.Graphics3DScaleVisibility`)],d);function f(e,t){return e>0||t>0}const p=`terrain-events`,m=s();export{d as Graphics3DScaleVisibility};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{forEach as n,result as r}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import i from"../../../../core/Logger.js";import{disposeMaybe as a,abortMaybe as o}from"../../../../core/maybe.js";import{throwIfAborted as s,isAbortError as c}from"../../../../core/promiseUtils.js";import l from"../../../../core/Queue.js";import{watch as u}from"../../../../core/reactiveUtils.js";import{property as d,subclass as f}from"../../../../core/accessorSupport/decorators.js";import{fromValues as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{hydrateGraphic as m}from"../../../../layers/graphics/hydratedFeatures.js";import{createLabelFunction as h}from"../../../../layers/support/labelFormatUtils.js";import{hasCalloutSupport as g}from"../../../../symbols/callouts/calloutUtils.js";import{make as _}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutCreationContext as v,LineCalloutSymbolLayerRenderingInfo as y}from"./Graphics3DLineCalloutSymbolLayer.js";import{getGraphics3DSymbol as b}from"./graphicSymbolUtils.js";import{LabelInfo as x}from"./LabelInfo.js";import{LabelParameters as S}from"./LabelParameters.js";import{horizontalPlacementFromAnchor as C,verticalPlacementFromAnchor as w,textRenderAlignmentFromHorizontalPlacement as T}from"./placementUtils.js";import{placePointOnGeometry as E}from"./pointUtils.js";import{TextRenderer as D}from"../../webgl-engine/lib/TextRenderer.js";import{TextRenderParameters as O}from"../../webgl-engine/lib/TextRenderParameters.js";import{TextTextureAtlas as k}from"../../webgl-engine/lib/TextTextureAtlas.js";import{WebGLLayer as A}from"../../webgl-engine/lib/WebGLLayer.js";import{hasLayerBasedScaleVisibility as j,isInEffectiveScaleRange as M}from"../../../support/layerViewUtils.js";import{TaskPriority as N}from"../../../support/Scheduler.js";import{Yield as P}from"../../../support/Yield.js";class F{constructor(e,t){this.labelingContext=e,this.graphics3DGraphic=t,this.hasGraphics3DResources=!1,this.visible=!1,this.textureAtlasHandles=[],this.textInitialized=!1,this.textRenderers=[],this.textLabelPlacements=[]}}class I{constructor(e,t,n,r,i){this.labelClass=e,this.graphics3DSymbol=t,this.graphics3DCalloutSymbolLayer=n,this.textRenderParameters=r,this.labelFunction=i,this.calloutSymbolLayerIndex=0,this.graphics=new Map,this.scaleVisibility=null}}class L{constructor(e,t,n,r,i,a,o,s){this.layer=t,this.graphics3DCore=n,this.scaleVisibility=r,this.emptySymbolLabelSupported=i,this.elevationInfoOverride=a,this.disablePlacement=o,this.active=s,this.labelClassAbortController=new AbortController,this._labelClassContexts=[],this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new A(e,{pickable:!0},n.owner.layerViewUid)}destroy(){this.stageLayer.destroy()}get labelClassContexts(){return this._labelClassContexts}setLabelClassContext(e,t){this._labelClassContexts[e]=t}resetLabelClassContext(){this._labelClassContexts.length=0}}let R=class extends t{constructor(e){super(e),this._hudMaterials=new Map,this._calloutMaterials=new Map,this._dirty=!1,this._focusAreasLabelsQueue=new l,this._labels=new Map,this._labelingContexts=[]}setup(){this.dispose(),this.addHandles([u(()=>this.view.state?.camera,()=>this.setDirty()),u(()=>this.view.state?.rasterPixelRatio,()=>this._resetAllLabels()),u(()=>this.view.timeZone,()=>this._resetArcadeLabels()),u(()=>this.view.focusAreasView?.polygons,()=>this._updateFocus()),this.view.resourceController.scheduler.registerTask(N.LABELER,this)]),j()&&this.addHandles(u(()=>this.view.scale,()=>this._updateScaleVisibility())),this._textTextureAtlas=new k({view:this.view})}dispose(){this.removeAllHandles(),this._textTextureAtlas=a(this._textTextureAtlas),this._hudMaterials.clear(),this._calloutMaterials.clear(),this._labelingContexts.length=0,this._labels.clear()}destroy(){this.dispose(),G.graphic=null,G.renderingInfo=null,G.layer=null}_updateFocus(){this._focusAreasLabelsQueue.clear(),this._labelingContexts.forEach(e=>{e.graphics.forEach(t=>{this._focusAreasLabelsQueue.push({graphic3DGraphic:t,labelingContext:e})})})}_activateLabelingContext(e){e.graphics.forEach((t,n)=>{let r=new F(e,t);this._labels.set(n,r),e.labelsToInitialize.set(n,r),t.setVisibilityFlag(16,1,!0)}),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach((e,t)=>{e.setVisibilityFlag(16,1,!1),this.setLabelGraphicVisibility(e,!1),e.clearLabelGraphics(),this._labels.delete(t)}),e.active=!1}_addLabelTextureToAtlas(e){if(this._textTextureAtlas)for(let t of e.graphics3DGraphic.labelLayers){if(!t.labelClass)continue;let n=e.textRenderers[t.labelClassContextIndex];n&&(e.textureAtlasHandles.push(this._textTextureAtlas.addText(n,e=>B(t.stageObject,e))),z(t.stageObject,n))}}_removeLabelTextureFromAtlas(e){e.textureAtlasHandles.forEach(e=>e.remove()),e.textureAtlasHandles.length=0}get readyToRun(){return this.view.ready&&(this._dirty||this.deconflictor.readyToRun||this._focusAreasLabelsQueue.length>0)}runTask(e){return this._updateLabels(e),this._applyFocusAreasUpdates(e),!this._dirty&&this.deconflictor.readyToRun&&this.deconflictor.runTask(e),P}_updateLabels(e){if(this._dirty){this._dirty=!1;for(let t of this._labelingContexts)if(t.active){if(V(t))this._dirty=!0;else if(H(t.labelClassContexts)){if(t.labelClassContexts===null){this._deactivateLabelingContext(t);continue}this._createLabelClassContext(t),this._dirty=!0}else for(let[n,r]of t.labelsToInitialize)if(this._ensureGraphics3DResources(r)&&(this._labels.set(n,r),this.deconflictor.setDirty(),e.madeProgress()),(r.visible&&r.textInitialized||!r.visible&&r.hasGraphics3DResources)&&(t.labelsToInitialize.delete(n),e.madeProgress()),e.done){this._dirty=!0;break}}this._dirty||this.notifyChange(`updating`)}}_applyFocusAreasUpdates(e){for(;this._focusAreasLabelsQueue.length>0&&!e.done;){e.madeProgress();let{graphic3DGraphic:t,labelingContext:n}=this._focusAreasLabelsQueue.pop();if(t.labelLayers.length===0||!n.active)continue;let r=E(t.graphic.geometry);if(r==null)continue;let i=this.view.focusAreasView?.containsGeometry(r)??!0;t.labelLayers.forEach(e=>{e.stageObject.geometries.some(e=>e.material.parameters.focusAreaStyle==null!==i)&&(this._removeGraphic(n,t),this._addGraphic(n,t),this.setDirty())})}this._focusAreasLabelsQueue.length===0&&(this.notifyChange(`readyToRun`),this.notifyChange(`updating`))}async _createLabelClassContextAsync(e){let t=e.labelClassAbortController?.signal;e.layer.when&&await e.layer.when(),s(t),e.scaleVisibility?.updateScaleRangeActive();let a=e.graphics3DCore,o=a.layer.labelingInfo?.filter(e=>!!e.symbol);o&&o.length!==0&&(await n(o,async(n,o)=>{let c=n.symbol,l=b(a.getOrCreateGraphics3DSymbol(c));if(l==null){i.getLogger(this).error(`Failed to create Graphics3DSymbol for label`);return}await l.load(),s(t);let u=null;g(c)&&c.hasVisibleCallout()&&(u=_(c,a.symbolCreationContext),await u.load(),s(t));let d=await r(h(n,e.layer.fieldsIndex,this.view.spatialReference));if(s(t),d.ok===!0){let r=await this._createTextRenderParameters(l.symbol);s(t);let i=new I(n,l,u,r,d.value);this._updateLabelClassContextVisibility(i),e.setLabelClassContext(o,i)}else i.getLogger(this).error(`Label expression failed to evaluate: ${d.error}`)}),s(t))}async _createLabelClassContext(e){return e.labelClassPromise??(e.labelClassPromise=this._createLabelClassContextAsync(e).catch(t=>{if(c(t))throw t;e.resetLabelClassContext()}).then(()=>{e.labelClassAbortController=null,this.notifyChange(`updating`)}).catch(()=>{}),this.notifyChange(`updating`)),e.labelClassPromise}async _createTextRenderParameters(e){let t=e.symbolLayers.at(0);return t?.type===`text`?O.fromSymbol(t,this.view.state.rasterPixelRatio):null}_destroyLabelClassContext(e){for(let t of e.labelClassContexts)t&&--t.graphics3DSymbol.referenced;let t=e.labelClassAbortController;e.labelClassAbortController=new AbortController,o(t),e.resetLabelClassContext(),e.labelClassPromise=null,this.notifyChange(`updating`)}_createTextSymbolGraphic(e,t,n,r,i,a){if(!this._textTextureAtlas)return null;let o=new S(n,C(n.anchor),w(n.anchor),e.text,p(e.displayWidth,e.displayHeight));return G.graphic=t,G.layer=r,G.renderingInfo=null,i.createLabel(G,o,this._hudMaterials,this._textTextureAtlas,()=>a.placement?.elevationOffset??null)}_createLineCalloutGraphic(e,t,n,r,i){G.graphic=e,G.layer=i;let a=r.screenOffset[0];return G.renderingInfo=new y(null,t,r.translation,r.centerOffset,r.groundDistance,a,r.centerOffsetUnits,r.elevationOffset),n.createGraphics3DGraphic(G,this._calloutMaterials)}_ensureGraphics3DResources(e){if(e.hasGraphics3DResources)return!1;let t=e.graphics3DGraphic;if(t.destroyed)return!1;this._ensureTextTextureResources(e);let n=e.labelingContext,r=n.labelClassContexts;if(H(r)||!n.emptySymbolLabelSupported&&t.layers.length===0)return!1;let i=!1,a=t.graphic,o=n.layer,s=W(n.layer);for(let c=0;c<r.length;c++){let l=e.textRenderers[c],u=e.textLabelPlacements[c],d=r[c];if(l==null||u==null||d==null)continue;let f=d.graphics3DSymbol,p=U(f),m=f.symbolLayers[0];if(!m)continue;m.setElevationInfoOverride(n.elevationInfoOverride);let h=new x(t,p,d.labelClass),g=this._createTextSymbolGraphic(l,a,u,o,m,h);if(g==null)return!1;g.labelClass=d.labelClass,g.labelClassContextIndex=c,t.addLabelGraphic(g,n.stageLayer),this.deconflictor.setPriority(t,d.textRenderParameters?.definition.size??0),t.setVisibilityFlag(16,1,s),t.setVisibilityFlag(16,2,d.scaleVisibility??!0),t.setVisibilityFlag(16,8,!1),j()&&d.graphics.set(a.uid,t),i=!0;let _=d.graphics3DCalloutSymbolLayer;if(_&&u.hasLabelVerticalOffset){_.setElevationInfoOverride(n.elevationInfoOverride);let e=this._createLineCalloutGraphic(a,p,_,u,o);e!=null&&(d.calloutSymbolLayerIndex=t.labelLayers.length,t.addLabelGraphic(e,n.stageLayer))}break}return i&&n.scaleVisibility?.updateGraphicLabelScaleVisibility(t),e.hasGraphics3DResources=!0,!0}_destroyGraphics3DResources(e){let t=e.labelingContext.labelClassContexts;for(let n of e.graphics3DGraphic.labelLayers)n.labelClass!=null&&t[n.labelClassContextIndex].graphics3DSymbol.symbolLayers[0]?.onRemoveGraphic(n);e.graphics3DGraphic.clearLabelGraphics(),e.hasGraphics3DResources=!1}_ensureTextTextureResources(e){if(e.textInitialized)return;let t=e.labelingContext,n=t.labelClassContexts;if(H(n))return;let r=e.graphics3DGraphic.graphic;for(let i=0;i<n.length;i++){let a=n[i];if(e.textRenderers[i]=null,e.textLabelPlacements[i]=null,a?.textRenderParameters==null)continue;let o=a.labelFunction,s;if(o.type===`arcade`)try{let e=o.needsHydrationToEvaluate()?m(r,t.layer,null):r;s=o.evaluate(e,this.view.timeZone)}catch{s=null}else s=o.evaluate(r);if(s==null||s===``||/^\s+$/.test(s))continue;let c=a.graphics3DSymbol;if(!c.symbolLayers[0])continue;let l=e.graphics3DGraphic,u=c.symbol?.type===`label-3d`?c.symbol:null,d=a.labelClass,f=t.disablePlacement,p=new x(l,u,d,f).placement;if(p==null)continue;let h=C(p.anchor),g=T(h);e.textRenderers[i]=new D(s,g,a.textRenderParameters,k.maxSize),e.textLabelPlacements[i]=p}e.textInitialized=!0}_destroyTextTextureResources(e){e.textInitialized=!1,e.textRenderers.length=0,e.textLabelPlacements.length=0}_addGraphic(e,t){let n=t.graphic.uid;if(e.graphics.set(n,t),e.active){let r=new F(e,t);this._labels.set(n,r),e.labelsToInitialize.set(n,r)}this.setDirty(),this.deconflictor.setDirty()}_updateGraphicGeometry(e,t){let n=t.graphic.uid,r=this._labels.get(n);if(!r)return!0;for(let n of r.graphics3DGraphic.labelLayers)if(n.labelClass!=null&&!e.labelClassContexts[n.labelClassContextIndex].graphics3DSymbol.symbolLayers[0].updateGeometry(t.graphic,n))return!1;return this.setDirty(),this.deconflictor.setDirty(),!0}_removeGraphic(e,t){let n=t.graphic.uid,r=this._labels.get(n);e.graphics.delete(n),e.labelClassContexts.forEach(e=>e?.graphics.delete(n)),r&&(this._destroyGraphic(r,n),e.labelsToInitialize.delete(n),this.setDirty(),this.deconflictor.setDirty())}_destroyGraphic(e,t){this._labels.delete(t),e.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(e),this._destroyTextTextureResources(e),e.hasGraphics3DResources&&this._destroyGraphics3DResources(e)}async _labelingInfoChange(e,t){if(t)for(let n of t){let t=e.graphics.get(n);t&&(this._removeGraphic(e,t),this._addGraphic(e,t))}else return this._visibilityInfoChange(e),this._resetLabels(e),this._createLabelClassContext(e)}_globalPropertyChanged(e,t){for(let n of t.labelClassContexts){if(!n)continue;let r=new Map;t.graphics.forEach(e=>r.set(e.graphic.uid,e)),n.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,r,e=>e.labelLayers[0]),n.graphics3DCalloutSymbolLayer&&n.graphics3DCalloutSymbolLayer.globalPropertyChanged(e,r,e=>e.labelLayers[n.calloutSymbolLayerIndex])}}_visibilityInfoChange(e){let t=W(e.layer);t&&!e.active&&this._activateLabelingContext(e),!t&&e.active&&this._deactivateLabelingContext(e),this.setDirty()}_resetAllLabels(){for(let e of this._labelingContexts)this._resetLabels(e)}_resetArcadeLabels(){for(let e of this._labelingContexts)e.labelClassContexts.some(e=>e?.labelFunction.type===`arcade`)&&this._resetLabels(e)}_resetLabels(e){e.graphics.forEach((t,n)=>{let r=this._labels.get(n);r&&(this._destroyGraphic(r,n),r.visible=!1,e.labelsToInitialize.set(n,r))}),this._destroyLabelClassContext(e),this.setDirty(),this.deconflictor.setDirty()}_findLabelingContext(e){for(let t of this._labelingContexts)if(t.graphics3DCore===e)return t;return null}addGraphicsOwner(e,t,n){let r=n?.emptySymbolLabelSupported||!1,i=n?.elevationInfoOverride||null,a=n?.disablePlacement||null;if(this._findLabelingContext(e))return;let o=e.layer,s=new L(this.view.stage,o,e,t,r,i,a,W(o));return this._labelingContexts.push(s),this.setDirty(),{addGraphic:e=>this._addGraphic(s,e),removeGraphic:e=>this._removeGraphic(s,e),updateGraphicGeometry:e=>this._updateGraphicGeometry(s,e),layerLabelsEnabled:()=>W(s.layer),labelingInfoChange:e=>this._labelingInfoChange(s,e),elevationInfoChange:()=>this._globalPropertyChanged(`elevationInfo`,s),screenSizePerspectiveEnabledChanged:()=>this._globalPropertyChanged(`screenSizePerspectiveEnabled`,s),slicePlaneEnabledChange:()=>this._globalPropertyChanged(`slicePlaneEnabled`,s),visibilityInfoChange:()=>this._visibilityInfoChange(s),reset:()=>this._resetLabels(s),remove:()=>this._removeGraphicsOwner(e),setDirty:()=>this.setDirty()}}_removeGraphicsOwner(e){let t=this._findLabelingContext(e);if(!t)return;let n=this._labelingContexts.indexOf(t);this._labelingContexts.splice(n,1),t.graphics.forEach(e=>this._removeGraphic(t,e)),t.destroy(),this.setDirty()}_updateScaleVisibility(){for(let e of this._labelingContexts)if(e.active&&!V(e))for(let t of e.labelClassContexts)this._updateLabelClassContextVisibility(t)}_updateLabelClassContextVisibility(e){if(!e||!j())return;let{labelClass:t,graphics:n}=e,r={minScale:t.minScale,maxScale:t.maxScale},i=M(r,this.view.scale),a=e.scaleVisibility==null||e.scaleVisibility!==i;e.scaleVisibility=i,a&&n.size&&(n.forEach(e=>e.setVisibilityFlag(16,2,i)),this.deconflictor.setDirty(),this.setDirty())}setLabelGraphicVisibility(e,t){let n=e.graphic.uid,r=this._labels.get(n);r&&r.visible!==t&&(t&&!r.textureAtlasHandles.length?(this._addLabelTextureToAtlas(r),r.textInitialized||r.labelingContext.labelsToInitialize.set(n,r)):!t&&r.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(r),r.visible=t,this.setDirty())}setDirty(){!this._dirty&&this._labelingContexts.length>0&&(this._dirty=!0,this.notifyChange(`updating`))}get updating(){return this._dirty||this._textTextureAtlas?.updating||this.deconflictor.updating||this._labelingContexts.some(e=>V(e))||this._focusAreasLabelsQueue.length>0}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;let e=this._labelingContexts.length>0?this._labelingContexts.reduce((e,t)=>e+ +!V(t),0)/this._labelingContexts.length:1;return(this._dirty?0:.3)+(this._textTextureAtlas.updating?0:.1)+e*.1+this.deconflictor.updatingProgress*.5}get usedMemory(){return this._textTextureAtlas?.usedMemory??0}get test(){}};e([d({constructOnly:!0})],R.prototype,`view`,void 0),e([d({constructOnly:!0})],R.prototype,`deconflictor`,void 0),e([d()],R.prototype,`_textTextureAtlas`,void 0),e([d({type:Boolean,readOnly:!0})],R.prototype,`updating`,null),R=e([f(`esri.views.3d.layers.graphics.Labeler`)],R);function z(e,t){e.geometries[0].setAttributeData(`size`,[t.displayWidth,t.displayHeight]),e.geometryVertexAttributeUpdated(e.geometries[0],`size`)}function B(e,t){e.geometries[0].setAttributeData(`uvi`,t),e.geometryVertexAttributeUpdated(e.geometries[0],`uvi`,!0)}function V(e){return!!e.labelClassPromise&&!!e.labelClassAbortController}function H(e){return(e?.length??0)===0}function U(e){return e.symbol?.type===`label-3d`?e.symbol:null}function W(e){return!!e.labelsVisible&&!!e.labelingInfo?.some(e=>!!e.symbol)}const G=new v(null,null,null);export{R as Labeler,W as areLabelsVisible};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{forEach as n,result as r}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import i from"../../../../core/Logger.js";import{disposeMaybe as a,abortMaybe as o}from"../../../../core/maybe.js";import{throwIfAborted as s,isAbortError as c}from"../../../../core/promiseUtils.js";import l from"../../../../core/Queue.js";import{watch as u}from"../../../../core/reactiveUtils.js";import{property as d,subclass as f}from"../../../../core/accessorSupport/decorators.js";import{fromValues as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isInEffectiveScaleRange as m}from"../../../../geometry/support/scaleUtils.js";import{hydrateGraphic as h}from"../../../../layers/graphics/hydratedFeatures.js";import{createLabelFunction as g}from"../../../../layers/support/labelFormatUtils.js";import{hasCalloutSupport as _}from"../../../../symbols/callouts/calloutUtils.js";import{make as v}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutCreationContext as y,LineCalloutSymbolLayerRenderingInfo as b}from"./Graphics3DLineCalloutSymbolLayer.js";import{getGraphics3DSymbol as x}from"./graphicSymbolUtils.js";import{LabelInfo as S}from"./LabelInfo.js";import{LabelParameters as C}from"./LabelParameters.js";import{horizontalPlacementFromAnchor as w,verticalPlacementFromAnchor as T,textRenderAlignmentFromHorizontalPlacement as E}from"./placementUtils.js";import{placePointOnGeometry as D}from"./pointUtils.js";import{TextRenderer as O}from"../../webgl-engine/lib/TextRenderer.js";import{TextRenderParameters as k}from"../../webgl-engine/lib/TextRenderParameters.js";import{TextTextureAtlas as A}from"../../webgl-engine/lib/TextTextureAtlas.js";import{WebGLLayer as j}from"../../webgl-engine/lib/WebGLLayer.js";import{hasLayerBasedScaleVisibility as M}from"../../../support/layerViewUtils.js";import{TaskPriority as N}from"../../../support/Scheduler.js";import{Yield as P}from"../../../support/Yield.js";class F{constructor(e,t){this.labelingContext=e,this.graphics3DGraphic=t,this.hasGraphics3DResources=!1,this.visible=!1,this.textureAtlasHandles=[],this.textInitialized=!1,this.textRenderers=[],this.textLabelPlacements=[]}}class I{constructor(e,t,n,r,i){this.labelClass=e,this.graphics3DSymbol=t,this.graphics3DCalloutSymbolLayer=n,this.textRenderParameters=r,this.labelFunction=i,this.calloutSymbolLayerIndex=0,this.graphics=new Map,this.scaleVisibility=null}}class L{constructor(e,t,n,r,i,a,o,s){this.layer=t,this.graphics3DCore=n,this.scaleVisibility=r,this.emptySymbolLabelSupported=i,this.elevationInfoOverride=a,this.disablePlacement=o,this.active=s,this.labelClassAbortController=new AbortController,this._labelClassContexts=[],this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new j(e,{pickable:!0},n.owner.layerViewUid)}destroy(){this.stageLayer.destroy()}get labelClassContexts(){return this._labelClassContexts}setLabelClassContext(e,t){this._labelClassContexts[e]=t}resetLabelClassContext(){this._labelClassContexts.length=0}}let R=class extends t{constructor(e){super(e),this._hudMaterials=new Map,this._calloutMaterials=new Map,this._dirty=!1,this._focusAreasLabelsQueue=new l,this._labels=new Map,this._labelingContexts=[]}setup(){this.dispose(),this.addHandles([u(()=>this.view.state?.camera,()=>this.setDirty()),u(()=>this.view.state?.rasterPixelRatio,()=>this._resetAllLabels()),u(()=>this.view.timeZone,()=>this._resetArcadeLabels()),u(()=>this.view.focusAreasView?.polygons,()=>this._updateFocus()),this.view.resourceController.scheduler.registerTask(N.LABELER,this)]),M()&&this.addHandles(u(()=>this.view.scale,()=>this._updateScaleVisibility())),this._textTextureAtlas=new A({view:this.view})}dispose(){this.removeAllHandles(),this._textTextureAtlas=a(this._textTextureAtlas),this._hudMaterials.clear(),this._calloutMaterials.clear(),this._labelingContexts.length=0,this._labels.clear()}destroy(){this.dispose(),G.graphic=null,G.renderingInfo=null,G.layer=null}_updateFocus(){this._focusAreasLabelsQueue.clear(),this._labelingContexts.forEach(e=>{e.graphics.forEach(t=>{this._focusAreasLabelsQueue.push({graphic3DGraphic:t,labelingContext:e})})})}_activateLabelingContext(e){e.graphics.forEach((t,n)=>{let r=new F(e,t);this._labels.set(n,r),e.labelsToInitialize.set(n,r),t.setVisibilityFlag(16,1,!0)}),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach((e,t)=>{e.setVisibilityFlag(16,1,!1),this.setLabelGraphicVisibility(e,!1),e.clearLabelGraphics(),this._labels.delete(t)}),e.active=!1}_addLabelTextureToAtlas(e){if(this._textTextureAtlas)for(let t of e.graphics3DGraphic.labelLayers){if(!t.labelClass)continue;let n=e.textRenderers[t.labelClassContextIndex];n&&(e.textureAtlasHandles.push(this._textTextureAtlas.addText(n,e=>B(t.stageObject,e))),z(t.stageObject,n))}}_removeLabelTextureFromAtlas(e){e.textureAtlasHandles.forEach(e=>e.remove()),e.textureAtlasHandles.length=0}get readyToRun(){return this.view.ready&&(this._dirty||this.deconflictor.readyToRun||this._focusAreasLabelsQueue.length>0)}runTask(e){return this._updateLabels(e),this._applyFocusAreasUpdates(e),!this._dirty&&this.deconflictor.readyToRun&&this.deconflictor.runTask(e),P}_updateLabels(e){if(this._dirty){this._dirty=!1;for(let t of this._labelingContexts)if(t.active){if(V(t))this._dirty=!0;else if(H(t.labelClassContexts)){if(t.labelClassContexts===null){this._deactivateLabelingContext(t);continue}this._createLabelClassContext(t),this._dirty=!0}else for(let[n,r]of t.labelsToInitialize)if(this._ensureGraphics3DResources(r)&&(this._labels.set(n,r),this.deconflictor.setDirty(),e.madeProgress()),(r.visible&&r.textInitialized||!r.visible&&r.hasGraphics3DResources)&&(t.labelsToInitialize.delete(n),e.madeProgress()),e.done){this._dirty=!0;break}}this._dirty||this.notifyChange(`updating`)}}_applyFocusAreasUpdates(e){for(;this._focusAreasLabelsQueue.length>0&&!e.done;){e.madeProgress();let{graphic3DGraphic:t,labelingContext:n}=this._focusAreasLabelsQueue.pop();if(t.labelLayers.length===0||!n.active)continue;let r=D(t.graphic.geometry);if(r==null)continue;let i=this.view.focusAreasView?.containsGeometry(r)??!0;t.labelLayers.forEach(e=>{e.stageObject.geometries.some(e=>e.material.parameters.focusAreaStyle==null!==i)&&(this._removeGraphic(n,t),this._addGraphic(n,t),this.setDirty())})}this._focusAreasLabelsQueue.length===0&&(this.notifyChange(`readyToRun`),this.notifyChange(`updating`))}async _createLabelClassContextAsync(e){let t=e.labelClassAbortController?.signal;e.layer.when&&await e.layer.when(),s(t),e.scaleVisibility?.updateScaleRangeActive();let a=e.graphics3DCore,o=a.layer.labelingInfo?.filter(e=>!!e.symbol);o&&o.length!==0&&(await n(o,async(n,o)=>{let c=n.symbol,l=x(a.getOrCreateGraphics3DSymbol(c));if(l==null){i.getLogger(this).error(`Failed to create Graphics3DSymbol for label`);return}await l.load(),s(t);let u=null;_(c)&&c.hasVisibleCallout()&&(u=v(c,a.symbolCreationContext),await u.load(),s(t));let d=await r(g(n,e.layer.fieldsIndex,this.view.spatialReference));if(s(t),d.ok===!0){let r=await this._createTextRenderParameters(l.symbol);s(t);let i=new I(n,l,u,r,d.value);this._updateLabelClassContextVisibility(i),e.setLabelClassContext(o,i)}else i.getLogger(this).error(`Label expression failed to evaluate: ${d.error}`)}),s(t))}async _createLabelClassContext(e){return e.labelClassPromise??(e.labelClassPromise=this._createLabelClassContextAsync(e).catch(t=>{if(c(t))throw t;e.resetLabelClassContext()}).then(()=>{e.labelClassAbortController=null,this.notifyChange(`updating`)}).catch(()=>{}),this.notifyChange(`updating`)),e.labelClassPromise}async _createTextRenderParameters(e){let t=e.symbolLayers.at(0);return t?.type===`text`?k.fromSymbol(t,this.view.state.rasterPixelRatio):null}_destroyLabelClassContext(e){for(let t of e.labelClassContexts)t&&--t.graphics3DSymbol.referenced;let t=e.labelClassAbortController;e.labelClassAbortController=new AbortController,o(t),e.resetLabelClassContext(),e.labelClassPromise=null,this.notifyChange(`updating`)}_createTextSymbolGraphic(e,t,n,r,i,a){if(!this._textTextureAtlas)return null;let o=new C(n,w(n.anchor),T(n.anchor),e.text,p(e.displayWidth,e.displayHeight));return G.graphic=t,G.layer=r,G.renderingInfo=null,i.createLabel(G,o,this._hudMaterials,this._textTextureAtlas,()=>a.placement?.elevationOffset??null)}_createLineCalloutGraphic(e,t,n,r,i){G.graphic=e,G.layer=i;let a=r.screenOffset[0];return G.renderingInfo=new b(null,t,r.translation,r.centerOffset,r.groundDistance,a,r.centerOffsetUnits,r.elevationOffset),n.createGraphics3DGraphic(G,this._calloutMaterials)}_ensureGraphics3DResources(e){if(e.hasGraphics3DResources)return!1;let t=e.graphics3DGraphic;if(t.destroyed)return!1;this._ensureTextTextureResources(e);let n=e.labelingContext,r=n.labelClassContexts;if(H(r)||!n.emptySymbolLabelSupported&&t.layers.length===0)return!1;let i=!1,a=t.graphic,o=n.layer,s=W(n.layer);for(let c=0;c<r.length;c++){let l=e.textRenderers[c],u=e.textLabelPlacements[c],d=r[c];if(l==null||u==null||d==null)continue;let f=d.graphics3DSymbol,p=U(f),m=f.symbolLayers[0];if(!m)continue;m.setElevationInfoOverride(n.elevationInfoOverride);let h=new S(t,p,d.labelClass),g=this._createTextSymbolGraphic(l,a,u,o,m,h);if(g==null)return!1;g.labelClass=d.labelClass,g.labelClassContextIndex=c,t.addLabelGraphic(g,n.stageLayer),this.deconflictor.setPriority(t,d.textRenderParameters?.definition.size??0),t.setVisibilityFlag(16,1,s),t.setVisibilityFlag(16,2,d.scaleVisibility??!0),t.setVisibilityFlag(16,8,!1),M()&&d.graphics.set(a.uid,t),i=!0;let _=d.graphics3DCalloutSymbolLayer;if(_&&u.hasLabelVerticalOffset){_.setElevationInfoOverride(n.elevationInfoOverride);let e=this._createLineCalloutGraphic(a,p,_,u,o);e!=null&&(d.calloutSymbolLayerIndex=t.labelLayers.length,t.addLabelGraphic(e,n.stageLayer))}break}return i&&n.scaleVisibility?.updateGraphicLabelScaleVisibility(t),e.hasGraphics3DResources=!0,!0}_destroyGraphics3DResources(e){let t=e.labelingContext.labelClassContexts;for(let n of e.graphics3DGraphic.labelLayers)n.labelClass!=null&&t[n.labelClassContextIndex].graphics3DSymbol.symbolLayers[0]?.onRemoveGraphic(n);e.graphics3DGraphic.clearLabelGraphics(),e.hasGraphics3DResources=!1}_ensureTextTextureResources(e){if(e.textInitialized)return;let t=e.labelingContext,n=t.labelClassContexts;if(H(n))return;let r=e.graphics3DGraphic.graphic;for(let i=0;i<n.length;i++){let a=n[i];if(e.textRenderers[i]=null,e.textLabelPlacements[i]=null,a?.textRenderParameters==null)continue;let o=a.labelFunction,s;if(o.type===`arcade`)try{let e=o.needsHydrationToEvaluate()?h(r,t.layer,null):r;s=o.evaluate(e,this.view.timeZone)}catch{s=null}else s=o.evaluate(r);if(s==null||s===``||/^\s+$/.test(s))continue;let c=a.graphics3DSymbol;if(!c.symbolLayers[0])continue;let l=e.graphics3DGraphic,u=c.symbol?.type===`label-3d`?c.symbol:null,d=a.labelClass,f=t.disablePlacement,p=new S(l,u,d,f).placement;if(p==null)continue;let m=w(p.anchor),g=E(m);e.textRenderers[i]=new O(s,g,a.textRenderParameters,A.maxSize),e.textLabelPlacements[i]=p}e.textInitialized=!0}_destroyTextTextureResources(e){e.textInitialized=!1,e.textRenderers.length=0,e.textLabelPlacements.length=0}_addGraphic(e,t){let n=t.graphic.uid;if(e.graphics.set(n,t),e.active){let r=new F(e,t);this._labels.set(n,r),e.labelsToInitialize.set(n,r)}this.setDirty(),this.deconflictor.setDirty()}_updateGraphicGeometry(e,t){let n=t.graphic.uid,r=this._labels.get(n);if(!r)return!0;for(let n of r.graphics3DGraphic.labelLayers)if(n.labelClass!=null&&!e.labelClassContexts[n.labelClassContextIndex].graphics3DSymbol.symbolLayers[0].updateGeometry(t.graphic,n))return!1;return this.setDirty(),this.deconflictor.setDirty(),!0}_removeGraphic(e,t){let n=t.graphic.uid,r=this._labels.get(n);e.graphics.delete(n),e.labelClassContexts.forEach(e=>e?.graphics.delete(n)),r&&(this._destroyGraphic(r,n),e.labelsToInitialize.delete(n),this.setDirty(),this.deconflictor.setDirty())}_destroyGraphic(e,t){this._labels.delete(t),e.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(e),this._destroyTextTextureResources(e),e.hasGraphics3DResources&&this._destroyGraphics3DResources(e)}async _labelingInfoChange(e,t){if(t)for(let n of t){let t=e.graphics.get(n);t&&(this._removeGraphic(e,t),this._addGraphic(e,t))}else return this._visibilityInfoChange(e),this._resetLabels(e),this._createLabelClassContext(e)}_globalPropertyChanged(e,t){for(let n of t.labelClassContexts){if(!n)continue;let r=new Map;t.graphics.forEach(e=>r.set(e.graphic.uid,e)),n.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,r,e=>e.labelLayers[0]),n.graphics3DCalloutSymbolLayer&&n.graphics3DCalloutSymbolLayer.globalPropertyChanged(e,r,e=>e.labelLayers[n.calloutSymbolLayerIndex])}}_visibilityInfoChange(e){let t=W(e.layer);t&&!e.active&&this._activateLabelingContext(e),!t&&e.active&&this._deactivateLabelingContext(e),this.setDirty()}_resetAllLabels(){for(let e of this._labelingContexts)this._resetLabels(e)}_resetArcadeLabels(){for(let e of this._labelingContexts)e.labelClassContexts.some(e=>e?.labelFunction.type===`arcade`)&&this._resetLabels(e)}_resetLabels(e){e.graphics.forEach((t,n)=>{let r=this._labels.get(n);r&&(this._destroyGraphic(r,n),r.visible=!1,e.labelsToInitialize.set(n,r))}),this._destroyLabelClassContext(e),this.setDirty(),this.deconflictor.setDirty()}_findLabelingContext(e){for(let t of this._labelingContexts)if(t.graphics3DCore===e)return t;return null}addGraphicsOwner(e,t,n){let r=n?.emptySymbolLabelSupported||!1,i=n?.elevationInfoOverride||null,a=n?.disablePlacement||null;if(this._findLabelingContext(e))return;let o=e.layer,s=new L(this.view.stage,o,e,t,r,i,a,W(o));return this._labelingContexts.push(s),this.setDirty(),{addGraphic:e=>this._addGraphic(s,e),removeGraphic:e=>this._removeGraphic(s,e),updateGraphicGeometry:e=>this._updateGraphicGeometry(s,e),layerLabelsEnabled:()=>W(s.layer),labelingInfoChange:e=>this._labelingInfoChange(s,e),elevationInfoChange:()=>this._globalPropertyChanged(`elevationInfo`,s),screenSizePerspectiveEnabledChanged:()=>this._globalPropertyChanged(`screenSizePerspectiveEnabled`,s),slicePlaneEnabledChange:()=>this._globalPropertyChanged(`slicePlaneEnabled`,s),visibilityInfoChange:()=>this._visibilityInfoChange(s),reset:()=>this._resetLabels(s),remove:()=>this._removeGraphicsOwner(e),setDirty:()=>this.setDirty()}}_removeGraphicsOwner(e){let t=this._findLabelingContext(e);if(!t)return;let n=this._labelingContexts.indexOf(t);this._labelingContexts.splice(n,1),t.graphics.forEach(e=>this._removeGraphic(t,e)),t.destroy(),this.setDirty()}_updateScaleVisibility(){for(let e of this._labelingContexts)if(e.active&&!V(e))for(let t of e.labelClassContexts)this._updateLabelClassContextVisibility(t)}_updateLabelClassContextVisibility(e){if(!e||!M())return;let{labelClass:t,graphics:n}=e,r={minScale:t.minScale,maxScale:t.maxScale},i=m(r,this.view.scale),a=e.scaleVisibility==null||e.scaleVisibility!==i;e.scaleVisibility=i,a&&n.size&&(n.forEach(e=>e.setVisibilityFlag(16,2,i)),this.deconflictor.setDirty(),this.setDirty())}setLabelGraphicVisibility(e,t){let n=e.graphic.uid,r=this._labels.get(n);r&&r.visible!==t&&(t&&!r.textureAtlasHandles.length?(this._addLabelTextureToAtlas(r),r.textInitialized||r.labelingContext.labelsToInitialize.set(n,r)):!t&&r.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(r),r.visible=t,this.setDirty())}setDirty(){!this._dirty&&this._labelingContexts.length>0&&(this._dirty=!0,this.notifyChange(`updating`))}get updating(){return this._dirty||this._textTextureAtlas?.updating||this.deconflictor.updating||this._labelingContexts.some(e=>V(e))||this._focusAreasLabelsQueue.length>0}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;let e=this._labelingContexts.length>0?this._labelingContexts.reduce((e,t)=>e+ +!V(t),0)/this._labelingContexts.length:1;return(this._dirty?0:.3)+(this._textTextureAtlas.updating?0:.1)+e*.1+this.deconflictor.updatingProgress*.5}get usedMemory(){return this._textTextureAtlas?.usedMemory??0}get test(){}};e([d({constructOnly:!0})],R.prototype,`view`,void 0),e([d({constructOnly:!0})],R.prototype,`deconflictor`,void 0),e([d()],R.prototype,`_textTextureAtlas`,void 0),e([d({type:Boolean,readOnly:!0})],R.prototype,`updating`,null),R=e([f(`esri.views.3d.layers.graphics.Labeler`)],R);function z(e,t){e.geometries[0].setAttributeData(`size`,[t.displayWidth,t.displayHeight]),e.geometryVertexAttributeUpdated(e.geometries[0],`size`)}function B(e,t){e.geometries[0].setAttributeData(`uvi`,t),e.geometryVertexAttributeUpdated(e.geometries[0],`uvi`,!0)}function V(e){return!!e.labelClassPromise&&!!e.labelClassAbortController}function H(e){return(e?.length??0)===0}function U(e){return e.symbol?.type===`label-3d`?e.symbol:null}function W(e){return!!e.labelsVisible&&!!e.labelingInfo?.some(e=>!!e.symbol)}const G=new y(null,null,null);export{R as Labeler,W as areLabelsVisible};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{shuffle as e}from"../../../../core/arrayUtils.js";import{baseObjectMemory as t}from"../../../../core/memoryEstimations.js";import{signal as n}from"../../../../core/signal.js";import{create as r,diameter as i}from"../../../../geometry/support/aaBoundingBox.js";import{create as a,fromExtent as o,intersects as s,copy as c,positiveInfinity as l,intersection as u}from"../../../../geometry/support/aaBoundingRect.js";import{numVertices as d,estimateSize as f,getObjectId as p,computeAABB as m}from"../../../../layers/graphics/dehydratedFeatures.js";import{computeMaxZ as h}from"../graphics/graphicUtils.js";import{SampledGeometryMaxDistanceRatio as g}from"./SampledGeometryMaxDistanceRatio.js";class _{constructor(e,t){this.descriptor=e,this._memory=t,this._numVertices=0,this.exceededTransferLimit=n(!1),this._fetchFailed=n(!1),this._sorted=!1,this._numFeatures=n(v),this._emptyFeatureRatio=n(0),this._estimatedSize=-1,this._sampledDensityEstimate=-1,this._displayingFeatures=null,this.alive=!0,this.filtered=!1,this._features=null,this._featuresLength=n(0),this._featureLimit=n(0),this._fetchStatus=0,this.fetchInformation=n(``),this.fetchingResolution=this.displayingResolution=e.resolution}get featuresMissing(){return this.fetchFailed||(this.hasPreciseFeatureCount?this._featuresLength.value<this.numFeatures:this.exceededTransferLimit.value)}get showsAllFeatures(){return!this.fetchFailed&&this.displayingFeatures!=null&&(this.hasPreciseFeatureCount?this.displayingFeatures.length===this.numFeatures:!this.exceededTransferLimit.value)}get missingAttributes(){return this._missingAttributes}get fetchFailed(){return this._fetchFailed.value}set fetchFailed(e){this._fetchFailed.value=e}get displayingFeatures(){return this._displayingFeatures}set displayingFeatures(e){this._displayingFeatures=e,this.extentIncludingBorrowedFeatures=null}get perTileMaximumNumberOfFeaturesExceeded(){let e=this.isFetched&&this.featuresMissing;return!this.filtered&&(e||this.hasFeatureLimit)}get features(){return this._features}get featureLimit(){return this._featureLimit.value}set featureLimit(e){this._featureLimit.value=e}get hasFeatureLimit(){return this.featureLimit!==this._featuresLength.value}get availableFields(){return this._availableFields}setFeatures(e,t,n,r,i=this.fetchingResolution,a=!0){this._replaceFeatures(e,i,a),this._availableFields=n,this._featuresLength.value=e?.length??0,this._sorted=!1,this._estimatedSize=-1,this._sampledDensityEstimate=-1,this._missingAttributes=r,e&&e.length>0?(this._emptyFeatureRatio.value=t/(e.length+t),this._numVertices=e.reduce((e,t)=>e+d(t.geometry),0)):(this._emptyFeatureRatio.value=0,this._numVertices=0)}computeZQuantizationFactor(){if(this._features&&this._features.length>0){let e=this._features.reduce((e,{geometry:t})=>Math.max(e,h(t)??0),0);return Math.floor(e/this.descriptor.planetRadius)+1}return 1}get emptyFeatureRatio(){return this._emptyFeatureRatio.value}get numFeatures(){return this.hasPreciseFeatureCount?this._numFeatures.value:this._features?this._featuresLength.value:0}set numFeatures(e){this._numFeatures.value=e}get hasPreciseFeatureCount(){return this._numFeatures.value>v}get needsFeatureCount(){return this._numFeatures.value===v}get numVertices(){return this._numVertices}get id(){return this.descriptor.id}get estimatedSize(){return this.updateEstimates(),this._estimatedSize}get sampledDensityEstimate(){return this._sampledDensityEstimate}updateEstimates(){if(this._estimatedSize<0||this._sampledDensityEstimate<0){this._estimatedSize=0,this._sampledDensityEstimate=0;let e=Math.floor(Math.sqrt(S));if(this._features){let t=null,n=new g(S,w*this.fetchingResolution),r=this._features.length;for(let i=0;i<r;++i){let a=this._features[i],o=f(a);if(this._estimatedSize+=o,!n.done){let o=r-i,s=Math.ceil(o/Math.max(1,Math.floor(Math.sqrt(n.numRemainingSamples))));if(i%s===0){let r=Math.max(Math.floor(n.numRemainingSamples/o),e);n.sampleGeometry(a.geometry,t,r)}}t=a.geometry}this._sampledDensityEstimate=n.numSamples>=C?n.ratio:0}return!0}return!1}get fetchStatus(){return this._fetchStatus}requestFetch(){this._fetchStatus=0}requestRefetch(){this._fetchStatus=1}startFetch(){this._fetchStatus=this.needsRefetch?3:2}fetchDone(e){this._fetchStatus=e}get isFetching(){return this._fetchStatus===2||this._fetchStatus===3}get isRefetching(){return this._fetchStatus===3}get needsFetch(){return this._fetchStatus===0||this._fetchStatus===1}get needsRefetch(){return this._fetchStatus===1}get isFetched(){return this._fetchStatus===4||this._fetchStatus===5}isFullyFetched(e){return!!this.features&&(this.features.length>=e||this.fetchStatus===5)}resetFetching(){this._fetchStatus=+!!this.isRefetching}get needsDisplayUpdate(){return!!this._features&&!x(this._features,this.displayingFeatures,this.featureLimit)}intersects(e){return e==null||!this.descriptor.extent||(o(e,T),s(this.descriptor.extent,T))}intersectionIncludingBorrowed(e,t){let n=this.extentIncludingBorrowedFeatures==null?this.descriptor.extent:this.extentIncludingBorrowedFeatures;return!e&&!n?(c(t,l),t):(e==null?c(t,n):(o(e,t),u(t,n,t)),t)}_shuffle(t){this._features?.sort((e,n)=>p(e,t)-p(n,t)),e(this._features,16438)}_sortBySize(e){this._features?.sort((t,n)=>i(m(n.geometry,E))-i(m(t.geometry,E))||p(t,e)-p(n,e))}reduceFeatures(e,t,n,r){if(e<=0)return!1;if(!this._features)return this.featureLimit=0,!1;let i=!1;this.featureLimit=Math.ceil(this.numFeatures*e),this.featureLimit>this._features.length&&this._fetchStatus===4&&this._features.length>0&&(this._fetchStatus=1,i=!0),!this._sorted&&e<1&&(r===1?this._shuffle(n):this._sortBySize(n),this._sorted=!0);let a=Math.max(this.featureLimit,Math.ceil(t*this.numFeatures));if(this._features.length>a){for(let e=a;e<this._features.length;e++)this._memory.unref(this._features[e]);this._features.length=this._featuresLength.value=a,this._estimatedSize=-1,this.exceededTransferLimit.value=!1,this._fetchStatus===5&&(this._fetchStatus=4)}return i}get cache(){return new b(this,this._features,this._numFeatures.value,this._emptyFeatureRatio.value)}set cache(e){this._replaceFeatures(e.features,e.resolution),this.requestController=null,this._availableFields=e.availableFields,this._featuresLength.value=e.features?.length??0,this._numFeatures.value=e.numFeatures,this._emptyFeatureRatio.value=e.emptyFeatureRatio,this._fetchStatus=e.fetchStatus,this.exceededTransferLimit.value=e.exceededTransferLimit,this._estimatedSize=-1,this._sampledDensityEstimate=-1,this.fetchInformation.value=e.fetchInformation}_replaceFeatures(e,t,n=!0){for(let r of e??[])this._memory.ref(r,t,n);for(let e of this._features??[])this._memory.unref(e);this._features=e}}const v=-1,y=-2;class b{constructor(e,n,r,i){this.features=n,this.numFeatures=r,this.emptyFeatureRatio=i,this.usedMemory=t+e.estimatedSize,this.resolution=e.displayingResolution,this.availableFields=e.availableFields,this.fetchStatus=e.fetchStatus,this.exceededTransferLimit=e.exceededTransferLimit.value,this.fetchInformation=e.fetchInformation.value}}function x(e,t,n){if(t==null||e==null||n!==t.length||n>e.length)return!1;for(let r=0;r<n;++r)if(e[r]!==t[r])return!1;return!0}const S=150,C=100,w=2,T=a(),E=r();export{_ as FeatureTile,b as FeatureTileCacheItem,y as failedFeatureCount};
2
+ import{shuffle as e}from"../../../../core/arrayUtils.js";import has from"../../../../core/has.js";import{baseObjectMemory as t}from"../../../../core/memoryEstimations.js";import{signal as n}from"../../../../core/signal.js";import{create as r,diameter as i}from"../../../../geometry/support/aaBoundingBox.js";import{create as a,fromExtent as o,intersects as s,copy as c,positiveInfinity as l,intersection as u}from"../../../../geometry/support/aaBoundingRect.js";import{numVertices as d,estimateSize as f,getObjectId as p,computeAABB as m}from"../../../../layers/graphics/dehydratedFeatures.js";import{computeMaxZ as h}from"../graphics/graphicUtils.js";import{SampledGeometryMaxDistanceRatio as g}from"./SampledGeometryMaxDistanceRatio.js";class _{constructor(e,t){this.descriptor=e,this._memory=t,this._numVertices=0,this.exceededTransferLimit=n(!1),this._fetchFailed=n(!1),this._sorted=!1,this._numFeatures=n(v),this._emptyFeatureRatio=n(0),this._estimatedSize=-1,this._sampledDensityEstimate=-1,this._displayingFeatures=null,this.alive=!0,this.filtered=!1,this._features=null,this._featuresLength=n(0),this._featureLimit=n(0),this._fetchStatus=0,this.fetchInformation=n(``),this.fetchingResolution=this.displayingResolution=e.resolution}get featuresMissing(){return this.fetchFailed||(this.hasPreciseFeatureCount?this._featuresLength.value<this.numFeatures:this.exceededTransferLimit.value)}get showsAllFeatures(){return!this.fetchFailed&&this.displayingFeatures!=null&&(this.hasPreciseFeatureCount?this.displayingFeatures.length===this.numFeatures:!this.exceededTransferLimit.value)}get missingAttributes(){return this._missingAttributes}get fetchFailed(){return this._fetchFailed.value}set fetchFailed(e){this._fetchFailed.value=e}get displayingFeatures(){return this._displayingFeatures}set displayingFeatures(e){this._displayingFeatures=e,this.extentIncludingBorrowedFeatures=null}get perTileMaximumNumberOfFeaturesExceeded(){let e=this.isFetched&&this.featuresMissing;return!this.filtered&&(e||this.hasFeatureLimit)}get features(){return this._features}get featureLimit(){return this._featureLimit.value}set featureLimit(e){this._featureLimit.value=e}get hasFeatureLimit(){return this.featureLimit!==this._featuresLength.value}get availableFields(){return this._availableFields}setFeatures(e,t,n,r,i=this.fetchingResolution,a=!0){this._replaceFeatures(e,i,a),this._availableFields=n,this._featuresLength.value=e?.length??0,this._sorted=!1,this._estimatedSize=-1,this._sampledDensityEstimate=-1,this._missingAttributes=r,e&&e.length>0?(this._emptyFeatureRatio.value=t/(e.length+t),this._numVertices=e.reduce((e,t)=>e+d(t.geometry),0)):(this._emptyFeatureRatio.value=0,this._numVertices=0)}computeZQuantizationFactor(){if(this._features&&this._features.length>0){let e=this._features.reduce((e,{geometry:t})=>Math.max(e,h(t)??0),0);return Math.floor(e/this.descriptor.planetRadius)+1}return 1}get emptyFeatureRatio(){return this._emptyFeatureRatio.value}get numFeatures(){return this.hasPreciseFeatureCount?this._numFeatures.value:this._features?this._featuresLength.value:0}set numFeatures(e){this._numFeatures.value=e}get hasPreciseFeatureCount(){return this._numFeatures.value>v}get needsFeatureCount(){return this._numFeatures.value===v}get numVertices(){return this._numVertices}get id(){return this.descriptor.id}get estimatedSize(){return this.updateEstimates(),this._estimatedSize}get sampledDensityEstimate(){return this._sampledDensityEstimate}updateEstimates(){if(this._estimatedSize<0||this._sampledDensityEstimate<0){this._estimatedSize=0,this._sampledDensityEstimate=0;let e=Math.floor(Math.sqrt(S));if(this._features){let t=null,n=new g(S,has(`featurelayer-snapping-density-max-distance`)*this.fetchingResolution),r=this._features.length;for(let i=0;i<r;++i){let a=this._features[i],o=f(a);if(this._estimatedSize+=o,!n.done){let o=r-i,s=Math.ceil(o/Math.max(1,Math.floor(Math.sqrt(n.numRemainingSamples))));if(i%s===0){let r=Math.max(Math.floor(n.numRemainingSamples/o),e);n.sampleGeometry(a.geometry,t,r)}}t=a.geometry}this._sampledDensityEstimate=n.numSamples>=C?n.ratio:0}return!0}return!1}get fetchStatus(){return this._fetchStatus}requestFetch(){this._fetchStatus=0}requestRefetch(){this._fetchStatus=1}startFetch(){this._fetchStatus=this.needsRefetch?3:2}fetchDone(e){this._fetchStatus=e}get isFetching(){return this._fetchStatus===2||this._fetchStatus===3}get isRefetching(){return this._fetchStatus===3}get needsFetch(){return this._fetchStatus===0||this._fetchStatus===1}get needsRefetch(){return this._fetchStatus===1}get isFetched(){return this._fetchStatus===4||this._fetchStatus===5}isFullyFetched(e){return!!this.features&&(this.features.length>=e||this.fetchStatus===5)}resetFetching(){this._fetchStatus=+!!this.isRefetching}get needsDisplayUpdate(){return!!this._features&&!x(this._features,this.displayingFeatures,this.featureLimit)}intersects(e){return e==null||!this.descriptor.extent||(o(e,w),s(this.descriptor.extent,w))}intersectionIncludingBorrowed(e,t){let n=this.extentIncludingBorrowedFeatures==null?this.descriptor.extent:this.extentIncludingBorrowedFeatures;return!e&&!n?(c(t,l),t):(e==null?c(t,n):(o(e,t),u(t,n,t)),t)}_shuffle(t){this._features?.sort((e,n)=>p(e,t)-p(n,t)),e(this._features,16438)}_sortBySize(e){this._features?.sort((t,n)=>i(m(n.geometry,T))-i(m(t.geometry,T))||p(t,e)-p(n,e))}reduceFeatures(e,t,n,r){if(e<=0)return!1;if(!this._features)return this.featureLimit=0,!1;let i=!1;this.featureLimit=Math.ceil(this.numFeatures*e),this.featureLimit>this._features.length&&this._fetchStatus===4&&this._features.length>0&&(this._fetchStatus=1,i=!0),!this._sorted&&e<1&&(r===1?this._shuffle(n):this._sortBySize(n),this._sorted=!0);let a=Math.max(this.featureLimit,Math.ceil(t*this.numFeatures));if(this._features.length>a){for(let e=a;e<this._features.length;e++)this._memory.unref(this._features[e]);this._features.length=this._featuresLength.value=a,this._estimatedSize=-1,this.exceededTransferLimit.value=!1,this._fetchStatus===5&&(this._fetchStatus=4)}return i}get cache(){return new b(this,this._features,this._numFeatures.value,this._emptyFeatureRatio.value)}set cache(e){this._replaceFeatures(e.features,e.resolution),this.requestController=null,this._availableFields=e.availableFields,this._featuresLength.value=e.features?.length??0,this._numFeatures.value=e.numFeatures,this._emptyFeatureRatio.value=e.emptyFeatureRatio,this._fetchStatus=e.fetchStatus,this.exceededTransferLimit.value=e.exceededTransferLimit,this._estimatedSize=-1,this._sampledDensityEstimate=-1,this.fetchInformation.value=e.fetchInformation}_replaceFeatures(e,t,n=!0){for(let r of e??[])this._memory.ref(r,t,n);for(let e of this._features??[])this._memory.unref(e);this._features=e}}const v=-1,y=-2;class b{constructor(e,n,r,i){this.features=n,this.numFeatures=r,this.emptyFeatureRatio=i,this.usedMemory=t+e.estimatedSize,this.resolution=e.displayingResolution,this.availableFields=e.availableFields,this.fetchStatus=e.fetchStatus,this.exceededTransferLimit=e.exceededTransferLimit.value,this.fetchInformation=e.fetchInformation.value}}function x(e,t,n){if(t==null||e==null||n!==t.length||n>e.length)return!1;for(let r=0;r<n;++r)if(e[r]!==t[r])return!1;return!0}const S=150,C=100,w=a(),T=r();export{_ as FeatureTile,b as FeatureTileCacheItem,y as failedFeatureCount};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{isSome as t}from"../../../../core/arrayUtils.js";import{makeHandle as n}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import r from"../../../../core/Logger.js";import{estimateFixedArrayMemory as i,estimateNumberMemory as a,estimateAttributesMemory as o}from"../../../../core/memoryEstimations.js";import{EsriPromise as s}from"../../../../core/Promise.js";import{initial as c,sync as l,watch as u}from"../../../../core/reactiveUtils.js";import{pt2px as d}from"../../../../core/screenUtils.js";import{property as f,subclass as p}from"../../../../core/accessorSupport/decorators.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as h}from"../../../../core/support/UpdatingHandles.js";import{projectPointToVector as g}from"../../../../geometry/projection/projectPointToVector.js";import{getContinuousIndexArray as _}from"../../../../geometry/support/Indices.js";import{getResolutionForScale as v}from"../../../../geometry/support/scaleUtils.js";import{getObjectId as y}from"../../../../layers/graphics/dehydratedFeatures.js";import{convertFromPoint as b}from"../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as x}from"../../../../layers/graphics/OptimizedFeature.js";import S from"../../../../layers/graphics/data/FeatureStore.js";import{isNumericField as C}from"../../../../layers/support/fieldUtils.js";import{generateGradient as w}from"../../../../renderers/support/heatmapUtils.js";import{DisplayFeatureLimit as T}from"../graphics/DisplayFeatureLimit.js";import{GraphicsCorePerformanceInfo as E}from"../graphics/GraphicsCorePerformanceInfo.js";import{FeatureVisibilityFilter as D}from"./FeatureVisibilityFilter.js";import{emptyHighlightHandle as O}from"./highlightUtils.js";import{Attribute as k}from"../../webgl-engine/lib/Attribute.js";import{DrapedHeatmapRenderer as A}from"../../webgl-engine/lib/DrapedHeatmapRenderer.js";import{Geometry as j}from"../../webgl-engine/lib/Geometry.js";import{GeometryBaseInstance as M}from"../../webgl-engine/lib/GeometryBaseInstance.js";import{RenderGeometry as N}from"../../webgl-engine/lib/RenderGeometry.js";import{HeatmapDensityMaterial as P}from"../../webgl-engine/materials/HeatmapDensityMaterial.js";import{scaleBoundsPredicate as F,isScaleRangeActive as I}from"../../../support/layerViewUtils.js";import{PixelType as L}from"../../../webgl/enums.js";import{loadHeatmapTextureConfiguration as R,fallBackHeatmapConfiguration as z}from"../../../webgl/heatmapTextureUtils.js";const B=112;let V=class extends s{constructor(e){super(e),this.type=`heatmap`,this.preferredUpdatePolicy=0,this.dataExtent=null,this.drapeSourceType=1,this._renderGeometries=new Map,this._fieldTotal=0,this._drapeSourceRenderer=null,this._dataType=L.HALF_FLOAT,this._pixelFormat=6408,this._baseInstance=new M([]),this._updatingHandles=new h}initialize(){let e;try{e=R(this._renderView.renderingContext,r.getLogger(this))}catch(t){this.addResolvingPromise(Promise.reject(t)),e=z}let{dataType:t,samplingMode:i,pixelFormat:a,internalFormat:o}=e;this._featureStore=new S({geometryType:`esriGeometryPoint`,hasZ:this.hasZ,hasM:this.hasM}),this._dataType=t,this._pixelFormat=a;let s=t!==L.FLOAT,d=this.view.overlayManager,f={...this._rendererParameters,stage:this.view.stage,dataType:t,samplingMode:i,pixelFormat:a,internalFormat:o,rendererContext:d.renderer,drapeSource:this};this._drapeSourceRenderer=new A(f),d.registerDrapeSource(this,this._drapeSourceRenderer),this._material=new P({usesHalfFloats:s}),this._materialWithField=new P({usesHalfFloats:s,isAttributeDriven:!0}),this._filterVisibility=new D({context:{configuration:this.owner,featureStore:this.featureStore,getFeatureCount:()=>this._loadedPointGraphics.length,setAllFeaturesVisibility:e=>this._setAllFeaturesVisibility(e),clearFeaturesVisibility:()=>this._setAllFeaturesVisibility(!0),updateFeatureVisibilities:e=>this._updateFeatureVisibilities(e)}}),this._updatingHandles.addOnCollectionChange(()=>this._loadedPointGraphics,e=>this._onLoadedFeaturesChange(e),c),this._updatingHandles.addWhen(()=>this._materialParameters,e=>this._forEachMaterial(t=>t.setParameters(e)),c),this._updatingHandles.add(()=>this._rendererParameters,e=>this._drapeSourceRenderer.set(e)),this._updatingHandles.add(()=>this._heatmapRendererField,()=>{this._recreate()},l),this._updatingHandles.add(()=>({fieldName:this._heatmapRendererFieldName,numeric:this._heatmapRendererFieldIsNumeric}),({fieldName:e,numeric:t})=>{if(e!=null&&t){let t=0;this._featureStore.forEach(n=>t+=n.attributes[e]??0),this._fieldTotal=t}else this._fieldTotal=this._featureStore.numFeatures},c),this.addHandles([u(()=>({fieldName:this._heatmapRendererFieldName,field:this._heatmapRendererField}),({fieldName:e,field:t})=>{e&&!t&&r.getLogger(this).warn(`Heatmap renderer field '${e}' for layer '${this.layer.title??this.layer.id}' not found`)}),u(()=>({field:this._heatmapRendererField,numeric:this._heatmapRendererFieldIsNumeric}),({field:e,numeric:t})=>{e!=null&&!t&&r.getLogger(this).warn(`Heatmap renderer field '${e.name}' for layer '${this.layer.title??this.layer.id}' does not contain numeric values and cannot be used to drive the heatmap density`)}),n(()=>this.view.overlayManager.unregisterDrapeSource(this))])}destroy(){this._renderGeometries.clear(),this._material=null,this._materialWithField=null,this._featureStore.clear(),this._featureStore=null,this._updatingHandles.destroy(),this._baseInstance=null}get layer(){return this.owner.layer}get featureStore(){return this._featureStore}get updating(){return this._updatingHandles.updating||this.filterVisibility.updating}get updatingRemaining(){return 0}get suspendInfo(){return{}}get legendEnabled(){return!0}get filterVisibility(){return this._filterVisibility}get displayFeatureLimit(){let e=this.owner?.view?.quality??1,t=this.owner?.view?.qualitySettings,n=t?Math.ceil(t.graphics3D.maxTotalNumberOfFeatures*e):0,r=n*6;return new T(r,n)}get hasZ(){return`hasZ`in this.layer&&this.layer.hasZ===!0}get hasM(){return`hasM`in this.layer&&this.layer.hasM}get view(){return this.owner.view}get fullOpacity(){return this.owner.fullOpacity}get updatePolicy(){return this.owner.updatePolicy}get scaleVisibilitySuspended(){if(!this._isScaleRangeActive)return!1;let{minScale:e,maxScale:t}=this.layer.effectiveScaleRange,{scale:n}=this.view;return!F(n,e??0,t??0)}get usedMemory(){let e=this.usedMemoryPerFeature*this._featureStore.numFeatures,t=this._pixelFormat===6403?1:4,n=this._dataType===L.FLOAT?4:2,r=Math.ceil((this._overlayRenderer?.overlays[0]?.resolution??0)*this._densityMapPixelRatio)??0;return r*r*t*n+e+H}get usedMemoryPerFeature(){let e=this._loadedPointGraphics.find(()=>!0);if(e==null)return 0;let t=o(e);return i([0,0],a)+(this._heatmapRendererFieldIsNumeric?a:0)+t}get loadedFeatures(){return this._featureStore.numFeatures}get unprocessedMemoryEstimate(){return 0}get performanceInfo(){return new E(this._renderGeometries.size,this._visibleFeatures,0,0)}get renderer(){return this._heatmapRenderer}get _overlayRenderer(){return this.view.overlayManager.renderer}get _overlaySpatialReference(){return this.view.overlayManager.spatialReference}get _rendererParameters(){return{...this._radiusParameter,...this._densityParameters,...this._colorRampParameter,...this._pixelRatioParameter}}get _materialParameters(){return{...this._radiusParameter,...this._resolutionForScaleParameter}}get _densityParameters(){let e=this._heatmapRenderer;if(e==null)return null;let{minDensity:t,maxDensity:n}=e;return{minDensity:t,maxDensity:n,fieldTotal:this._fieldTotal}}get _radiusParameter(){let e=this._heatmapRenderer;return e?{searchRadius:d(this._clampSearchRadius(e.radius))}:null}get _resolutionForScaleParameter(){let e=this._heatmapRenderer;if(!e)return null;let{referenceScale:t}=e;return{resolutionForScale:t===0?0:v(t,this.view.spatialReference)}}get _colorRampParameter(){let e=this._heatmapRenderer;return e?{colorRampData:w(e.colorStops)}:null}get _pixelRatioParameter(){return{pixelRatio:this._densityMapPixelRatio}}get _densityMapPixelRatio(){return this.owner?.view?.qualitySettings.heatmap.pixelRatio??1}get _renderView(){return this.view.stage.renderView}get _featuresArePoints(){return this.layer.geometryType===`point`}get _loadedPointGraphics(){return this.owner.loadedGraphics}get _heatmapRenderer(){let e=this.layer.renderer;return e?.type===`heatmap`?e:null}get _heatmapRendererFieldName(){return this._heatmapRenderer?.field}get _heatmapRendererField(){let e=this._heatmapRendererFieldName;return e==null?null:this.layer.fieldsIndex.get(e)}get _heatmapRendererFieldIsNumeric(){let e=this._heatmapRendererField;return e!=null&&C(e)}get _isScaleRangeActive(){let{layer:e}=this;if(!(`effectiveScaleRange`in e))return!1;let{minScale:t,maxScale:n}=e.effectiveScaleRange;return I(t,n)}get _visibleFeatures(){return this._renderGeometries.values().reduce((e,{visible:t})=>e+ +!!t,0)}async whenGraphicBounds(){return null}computeAttachmentOrigin(){return null}highlightByGraphics(){return O}highlightByObjectIds(){return O}maskOccludee(){return n()}setObjectIdVisibility(){}refreshFilter(){this.filterVisibility.reapply()}_onLoadedFeaturesChange(e){if(!this._featuresArePoints)return;let{objectIdField:n}=this.layer;this._featureStore.removeManyById(e.removed.map(e=>y(e,n))),this._featureStore.addMany(e.added.map(e=>{let{attributes:t,centroid:r,geometry:i}=e,a=new x(b(i),t,r?b(r):null,y(e,n));return a.displayId=e.uid,a}));let r=e.added,i=e.removed;this._fieldTotal+=this._computeFieldTotalChange(r,i);let a=i.map(({uid:e})=>{let t=this._renderGeometries.get(e);return this._renderGeometries.delete(e),t}).filter(t),o=r.map(e=>{let t=this._pointGraphicToRenderGeometry(e);return this._renderGeometries.set(e.uid,t),t});a.length>0&&this._drapeSourceRenderer.removeGeometries(a,2),o.length>0&&this._drapeSourceRenderer.addGeometries(o,0),(o.length>0||a.length>0)&&(this.filterVisibility.reapply(),this._renderView.requestRender())}_recreate(){if(!this._loadedPointGraphics)return;let e=this._loadedPointGraphics.toArray();this._onLoadedFeaturesChange({added:e,removed:e})}_pointGraphicToRenderGeometry(e){let t=this._heatmapRendererFieldName,n=t==null?this._material:this._materialWithField,r=m();g(e.geometry,r,this._overlaySpatialReference);let i=_(1),a=[[`position`,new k([r[0],r[1]],i,2)]],o=this._heatmapRendererFieldIsNumeric;t!=null&&a.push([`featureAttribute`,new k([o?e.attributes[t]??0:0],i,1)]);let s=new N(new j(n,a,null,void 0,this._baseInstance),{layerViewUid:this.owner.layerViewUid,graphicUid:e.uid});return s.visible=this.filterVisibility.defaultVisibility,s}_forEachMaterial(e){e(this._material),e(this._materialWithField)}_computeFieldTotalChange(e,t){if(this._heatmapRendererFieldName==null||!this._heatmapRendererFieldIsNumeric)return e.length-t.length;let n=this._heatmapRendererFieldName,r=(e,t)=>e+(t.attributes[n]??0);return e.reduce(r,0)-t.reduce(r,0)}_clampSearchRadius(e){return e>112&&r.getLogger(this).warnOnce(`SceneView supports a maximum radius of 112 pt for HeatmapRenderer.`),Math.min(e,112)}_updateFeatureVisibilities(e){let t=[];this._featureStore.forEach(({objectId:n,displayId:r})=>{let i=e(n),a=this._renderGeometries.get(r);a&&a.visible!==i&&(t.push(a),a.visible=i)}),this._drapeSourceRenderer.modifyGeometries(t,1)}_setAllFeaturesVisibility(e){let t=[];for(let n of this._renderGeometries.values())n.visible!==e&&(t.push(n),n.visible=e);this._drapeSourceRenderer.modifyGeometries(t,1)}get test(){}};e([f()],V.prototype,`type`,void 0),e([f({constructOnly:!0})],V.prototype,`owner`,void 0),e([f()],V.prototype,`layer`,null),e([f()],V.prototype,`featureStore`,null),e([f()],V.prototype,`updating`,null),e([f()],V.prototype,`updatingRemaining`,null),e([f()],V.prototype,`suspendInfo`,null),e([f()],V.prototype,`legendEnabled`,null),e([f()],V.prototype,`filterVisibility`,null),e([f()],V.prototype,`displayFeatureLimit`,null),e([f()],V.prototype,`preferredUpdatePolicy`,void 0),e([f()],V.prototype,`hasZ`,null),e([f()],V.prototype,`hasM`,null),e([f()],V.prototype,`dataExtent`,void 0),e([f()],V.prototype,`view`,null),e([f()],V.prototype,`fullOpacity`,null),e([f()],V.prototype,`updatePolicy`,null),e([f()],V.prototype,`drapeSourceType`,void 0),e([f()],V.prototype,`scaleVisibilitySuspended`,null),e([f()],V.prototype,`renderer`,null),e([f()],V.prototype,`_featureStore`,void 0),e([f()],V.prototype,`_filterVisibility`,void 0),e([f()],V.prototype,`_overlayRenderer`,null),e([f()],V.prototype,`_overlaySpatialReference`,null),e([f()],V.prototype,`_rendererParameters`,null),e([f()],V.prototype,`_materialParameters`,null),e([f()],V.prototype,`_densityParameters`,null),e([f()],V.prototype,`_radiusParameter`,null),e([f()],V.prototype,`_resolutionForScaleParameter`,null),e([f()],V.prototype,`_colorRampParameter`,null),e([f()],V.prototype,`_pixelRatioParameter`,null),e([f()],V.prototype,`_densityMapPixelRatio`,null),e([f()],V.prototype,`_renderGeometries`,void 0),e([f()],V.prototype,`_material`,void 0),e([f()],V.prototype,`_materialWithField`,void 0),e([f()],V.prototype,`_renderView`,null),e([f()],V.prototype,`_featuresArePoints`,null),e([f()],V.prototype,`_loadedPointGraphics`,null),e([f()],V.prototype,`_heatmapRenderer`,null),e([f()],V.prototype,`_heatmapRendererFieldName`,null),e([f()],V.prototype,`_heatmapRendererField`,null),e([f()],V.prototype,`_heatmapRendererFieldIsNumeric`,null),e([f()],V.prototype,`_fieldTotal`,void 0),e([f()],V.prototype,`_drapeSourceRenderer`,void 0),e([f()],V.prototype,`_isScaleRangeActive`,null),V=e([p(`esri.views.3d.layers.support.HeatmapFeatureProcessor`)],V);const H=i([0,0,0,0,0,0,0,0],a);export{V as HeatmapFeatureProcessor,B as maxRadiusPt};
2
+ import{__decorate as e}from"tslib";import{isSome as t}from"../../../../core/arrayUtils.js";import{makeHandle as n}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import r from"../../../../core/Logger.js";import{estimateFixedArrayMemory as i,estimateNumberMemory as a,estimateAttributesMemory as o}from"../../../../core/memoryEstimations.js";import{EsriPromise as s}from"../../../../core/Promise.js";import{initial as c,sync as l,watch as u}from"../../../../core/reactiveUtils.js";import{pt2px as d}from"../../../../core/screenUtils.js";import{property as f,subclass as p}from"../../../../core/accessorSupport/decorators.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as h}from"../../../../core/support/UpdatingHandles.js";import{projectPointToVector as g}from"../../../../geometry/projection/projectPointToVector.js";import{getContinuousIndexArray as _}from"../../../../geometry/support/Indices.js";import{scaleBoundsPredicate as v,getResolutionForScale as y,isScaleRangeActive as b}from"../../../../geometry/support/scaleUtils.js";import{getObjectId as x}from"../../../../layers/graphics/dehydratedFeatures.js";import{convertFromPoint as S}from"../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as C}from"../../../../layers/graphics/OptimizedFeature.js";import w from"../../../../layers/graphics/data/FeatureStore.js";import{isNumericField as T}from"../../../../layers/support/fieldUtils.js";import{generateGradient as E}from"../../../../renderers/support/heatmapUtils.js";import{DisplayFeatureLimit as D}from"../graphics/DisplayFeatureLimit.js";import{GraphicsCorePerformanceInfo as O}from"../graphics/GraphicsCorePerformanceInfo.js";import{FeatureVisibilityFilter as k}from"./FeatureVisibilityFilter.js";import{emptyHighlightHandle as A}from"./highlightUtils.js";import{Attribute as j}from"../../webgl-engine/lib/Attribute.js";import{DrapedHeatmapRenderer as M}from"../../webgl-engine/lib/DrapedHeatmapRenderer.js";import{Geometry as N}from"../../webgl-engine/lib/Geometry.js";import{GeometryBaseInstance as P}from"../../webgl-engine/lib/GeometryBaseInstance.js";import{RenderGeometry as F}from"../../webgl-engine/lib/RenderGeometry.js";import{HeatmapDensityMaterial as I}from"../../webgl-engine/materials/HeatmapDensityMaterial.js";import{PixelType as L}from"../../../webgl/enums.js";import{loadHeatmapTextureConfiguration as R,fallBackHeatmapConfiguration as z}from"../../../webgl/heatmapTextureUtils.js";const B=112;let V=class extends s{constructor(e){super(e),this.type=`heatmap`,this.preferredUpdatePolicy=0,this.dataExtent=null,this.drapeSourceType=1,this._renderGeometries=new Map,this._fieldTotal=0,this._drapeSourceRenderer=null,this._dataType=L.HALF_FLOAT,this._pixelFormat=6408,this._baseInstance=new P([]),this._updatingHandles=new h}initialize(){let e;try{e=R(this._renderView.renderingContext,r.getLogger(this))}catch(t){this.addResolvingPromise(Promise.reject(t)),e=z}let{dataType:t,samplingMode:i,pixelFormat:a,internalFormat:o}=e;this._featureStore=new w({geometryType:`esriGeometryPoint`,hasZ:this.hasZ,hasM:this.hasM}),this._dataType=t,this._pixelFormat=a;let s=t!==L.FLOAT,d=this.view.overlayManager,f={...this._rendererParameters,stage:this.view.stage,dataType:t,samplingMode:i,pixelFormat:a,internalFormat:o,rendererContext:d.renderer,drapeSource:this};this._drapeSourceRenderer=new M(f),d.registerDrapeSource(this,this._drapeSourceRenderer),this._material=new I({usesHalfFloats:s}),this._materialWithField=new I({usesHalfFloats:s,isAttributeDriven:!0}),this._filterVisibility=new k({context:{configuration:this.owner,featureStore:this.featureStore,getFeatureCount:()=>this._loadedPointGraphics.length,setAllFeaturesVisibility:e=>this._setAllFeaturesVisibility(e),clearFeaturesVisibility:()=>this._setAllFeaturesVisibility(!0),updateFeatureVisibilities:e=>this._updateFeatureVisibilities(e)}}),this._updatingHandles.addOnCollectionChange(()=>this._loadedPointGraphics,e=>this._onLoadedFeaturesChange(e),c),this._updatingHandles.addWhen(()=>this._materialParameters,e=>this._forEachMaterial(t=>t.setParameters(e)),c),this._updatingHandles.add(()=>this._rendererParameters,e=>this._drapeSourceRenderer.set(e)),this._updatingHandles.add(()=>this._heatmapRendererField,()=>{this._recreate()},l),this._updatingHandles.add(()=>({fieldName:this._heatmapRendererFieldName,numeric:this._heatmapRendererFieldIsNumeric}),({fieldName:e,numeric:t})=>{if(e!=null&&t){let t=0;this._featureStore.forEach(n=>t+=n.attributes[e]??0),this._fieldTotal=t}else this._fieldTotal=this._featureStore.numFeatures},c),this.addHandles([u(()=>({fieldName:this._heatmapRendererFieldName,field:this._heatmapRendererField}),({fieldName:e,field:t})=>{e&&!t&&r.getLogger(this).warn(`Heatmap renderer field '${e}' for layer '${this.layer.title??this.layer.id}' not found`)}),u(()=>({field:this._heatmapRendererField,numeric:this._heatmapRendererFieldIsNumeric}),({field:e,numeric:t})=>{e!=null&&!t&&r.getLogger(this).warn(`Heatmap renderer field '${e.name}' for layer '${this.layer.title??this.layer.id}' does not contain numeric values and cannot be used to drive the heatmap density`)}),n(()=>this.view.overlayManager.unregisterDrapeSource(this))])}destroy(){this._renderGeometries.clear(),this._material=null,this._materialWithField=null,this._featureStore.clear(),this._featureStore=null,this._updatingHandles.destroy(),this._baseInstance=null}get layer(){return this.owner.layer}get featureStore(){return this._featureStore}get updating(){return this._updatingHandles.updating||this.filterVisibility.updating}get updatingRemaining(){return 0}get suspendInfo(){return{}}get legendEnabled(){return!0}get filterVisibility(){return this._filterVisibility}get displayFeatureLimit(){let e=this.owner?.view?.quality??1,t=this.owner?.view?.qualitySettings,n=t?Math.ceil(t.graphics3D.maxTotalNumberOfFeatures*e):0,r=n*6;return new D(r,n)}get hasZ(){return`hasZ`in this.layer&&this.layer.hasZ===!0}get hasM(){return`hasM`in this.layer&&this.layer.hasM}get view(){return this.owner.view}get fullOpacity(){return this.owner.fullOpacity}get updatePolicy(){return this.owner.updatePolicy}get scaleVisibilitySuspended(){if(!this._isScaleRangeActive)return!1;let{minScale:e,maxScale:t}=this.layer.effectiveScaleRange,{scale:n}=this.view;return!v(n,e??0,t??0)}get usedMemory(){let e=this.usedMemoryPerFeature*this._featureStore.numFeatures,t=this._pixelFormat===6403?1:4,n=this._dataType===L.FLOAT?4:2,r=Math.ceil((this._overlayRenderer?.overlays[0]?.resolution??0)*this._densityMapPixelRatio)??0;return r*r*t*n+e+H}get usedMemoryPerFeature(){let e=this._loadedPointGraphics.find(()=>!0);if(e==null)return 0;let t=o(e);return i([0,0],a)+(this._heatmapRendererFieldIsNumeric?a:0)+t}get loadedFeatures(){return this._featureStore.numFeatures}get unprocessedMemoryEstimate(){return 0}get performanceInfo(){return new O(this._renderGeometries.size,this._visibleFeatures,0,0)}get renderer(){return this._heatmapRenderer}get _overlayRenderer(){return this.view.overlayManager.renderer}get _overlaySpatialReference(){return this.view.overlayManager.spatialReference}get _rendererParameters(){return{...this._radiusParameter,...this._densityParameters,...this._colorRampParameter,...this._pixelRatioParameter}}get _materialParameters(){return{...this._radiusParameter,...this._resolutionForScaleParameter}}get _densityParameters(){let e=this._heatmapRenderer;if(e==null)return null;let{minDensity:t,maxDensity:n}=e;return{minDensity:t,maxDensity:n,fieldTotal:this._fieldTotal}}get _radiusParameter(){let e=this._heatmapRenderer;return e?{searchRadius:d(this._clampSearchRadius(e.radius))}:null}get _resolutionForScaleParameter(){let e=this._heatmapRenderer;if(!e)return null;let{referenceScale:t}=e;return{resolutionForScale:t===0?0:y(t,this.view.spatialReference)}}get _colorRampParameter(){let e=this._heatmapRenderer;return e?{colorRampData:E(e.colorStops)}:null}get _pixelRatioParameter(){return{pixelRatio:this._densityMapPixelRatio}}get _densityMapPixelRatio(){return this.owner?.view?.qualitySettings.heatmap.pixelRatio??1}get _renderView(){return this.view.stage.renderView}get _featuresArePoints(){return this.layer.geometryType===`point`}get _loadedPointGraphics(){return this.owner.loadedGraphics}get _heatmapRenderer(){let e=this.layer.renderer;return e?.type===`heatmap`?e:null}get _heatmapRendererFieldName(){return this._heatmapRenderer?.field}get _heatmapRendererField(){let e=this._heatmapRendererFieldName;return e==null?null:this.layer.fieldsIndex.get(e)}get _heatmapRendererFieldIsNumeric(){let e=this._heatmapRendererField;return e!=null&&T(e)}get _isScaleRangeActive(){let{layer:e}=this;if(!(`effectiveScaleRange`in e))return!1;let{minScale:t,maxScale:n}=e.effectiveScaleRange;return b(t,n)}get _visibleFeatures(){return this._renderGeometries.values().reduce((e,{visible:t})=>e+ +!!t,0)}async whenGraphicBounds(){return null}computeAttachmentOrigin(){return null}highlightByGraphics(){return A}highlightByObjectIds(){return A}maskOccludee(){return n()}setObjectIdVisibility(){}refreshFilter(){this.filterVisibility.reapply()}_onLoadedFeaturesChange(e){if(!this._featuresArePoints)return;let{objectIdField:n}=this.layer;this._featureStore.removeManyById(e.removed.map(e=>x(e,n))),this._featureStore.addMany(e.added.map(e=>{let{attributes:t,centroid:r,geometry:i}=e,a=new C(S(i),t,r?S(r):null,x(e,n));return a.displayId=e.uid,a}));let r=e.added,i=e.removed;this._fieldTotal+=this._computeFieldTotalChange(r,i);let a=i.map(({uid:e})=>{let t=this._renderGeometries.get(e);return this._renderGeometries.delete(e),t}).filter(t),o=r.map(e=>{let t=this._pointGraphicToRenderGeometry(e);return this._renderGeometries.set(e.uid,t),t});a.length>0&&this._drapeSourceRenderer.removeGeometries(a,2),o.length>0&&this._drapeSourceRenderer.addGeometries(o,0),(o.length>0||a.length>0)&&(this.filterVisibility.reapply(),this._renderView.requestRender())}_recreate(){if(!this._loadedPointGraphics)return;let e=this._loadedPointGraphics.toArray();this._onLoadedFeaturesChange({added:e,removed:e})}_pointGraphicToRenderGeometry(e){let t=this._heatmapRendererFieldName,n=t==null?this._material:this._materialWithField,r=m();g(e.geometry,r,this._overlaySpatialReference);let i=_(1),a=[[`position`,new j([r[0],r[1]],i,2)]],o=this._heatmapRendererFieldIsNumeric;t!=null&&a.push([`featureAttribute`,new j([o?e.attributes[t]??0:0],i,1)]);let s=new F(new N(n,a,null,void 0,this._baseInstance),{layerViewUid:this.owner.layerViewUid,graphicUid:e.uid});return s.visible=this.filterVisibility.defaultVisibility,s}_forEachMaterial(e){e(this._material),e(this._materialWithField)}_computeFieldTotalChange(e,t){if(this._heatmapRendererFieldName==null||!this._heatmapRendererFieldIsNumeric)return e.length-t.length;let n=this._heatmapRendererFieldName,r=(e,t)=>e+(t.attributes[n]??0);return e.reduce(r,0)-t.reduce(r,0)}_clampSearchRadius(e){return e>112&&r.getLogger(this).warnOnce(`SceneView supports a maximum radius of 112 pt for HeatmapRenderer.`),Math.min(e,112)}_updateFeatureVisibilities(e){let t=[];this._featureStore.forEach(({objectId:n,displayId:r})=>{let i=e(n),a=this._renderGeometries.get(r);a&&a.visible!==i&&(t.push(a),a.visible=i)}),this._drapeSourceRenderer.modifyGeometries(t,1)}_setAllFeaturesVisibility(e){let t=[];for(let n of this._renderGeometries.values())n.visible!==e&&(t.push(n),n.visible=e);this._drapeSourceRenderer.modifyGeometries(t,1)}get test(){}};e([f()],V.prototype,`type`,void 0),e([f({constructOnly:!0})],V.prototype,`owner`,void 0),e([f()],V.prototype,`layer`,null),e([f()],V.prototype,`featureStore`,null),e([f()],V.prototype,`updating`,null),e([f()],V.prototype,`updatingRemaining`,null),e([f()],V.prototype,`suspendInfo`,null),e([f()],V.prototype,`legendEnabled`,null),e([f()],V.prototype,`filterVisibility`,null),e([f()],V.prototype,`displayFeatureLimit`,null),e([f()],V.prototype,`preferredUpdatePolicy`,void 0),e([f()],V.prototype,`hasZ`,null),e([f()],V.prototype,`hasM`,null),e([f()],V.prototype,`dataExtent`,void 0),e([f()],V.prototype,`view`,null),e([f()],V.prototype,`fullOpacity`,null),e([f()],V.prototype,`updatePolicy`,null),e([f()],V.prototype,`drapeSourceType`,void 0),e([f()],V.prototype,`scaleVisibilitySuspended`,null),e([f()],V.prototype,`renderer`,null),e([f()],V.prototype,`_featureStore`,void 0),e([f()],V.prototype,`_filterVisibility`,void 0),e([f()],V.prototype,`_overlayRenderer`,null),e([f()],V.prototype,`_overlaySpatialReference`,null),e([f()],V.prototype,`_rendererParameters`,null),e([f()],V.prototype,`_materialParameters`,null),e([f()],V.prototype,`_densityParameters`,null),e([f()],V.prototype,`_radiusParameter`,null),e([f()],V.prototype,`_resolutionForScaleParameter`,null),e([f()],V.prototype,`_colorRampParameter`,null),e([f()],V.prototype,`_pixelRatioParameter`,null),e([f()],V.prototype,`_densityMapPixelRatio`,null),e([f()],V.prototype,`_renderGeometries`,void 0),e([f()],V.prototype,`_material`,void 0),e([f()],V.prototype,`_materialWithField`,void 0),e([f()],V.prototype,`_renderView`,null),e([f()],V.prototype,`_featuresArePoints`,null),e([f()],V.prototype,`_loadedPointGraphics`,null),e([f()],V.prototype,`_heatmapRenderer`,null),e([f()],V.prototype,`_heatmapRendererFieldName`,null),e([f()],V.prototype,`_heatmapRendererField`,null),e([f()],V.prototype,`_heatmapRendererFieldIsNumeric`,null),e([f()],V.prototype,`_fieldTotal`,void 0),e([f()],V.prototype,`_drapeSourceRenderer`,void 0),e([f()],V.prototype,`_isScaleRangeActive`,null),V=e([p(`esri.views.3d.layers.support.HeatmapFeatureProcessor`)],V);const H=i([0,0,0,0,0,0,0,0],a);export{V as HeatmapFeatureProcessor,B as maxRadiusPt};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../Color.js";import n from"../../../../core/Accessor.js";import{isSome as r}from"../../../../core/arrayUtils.js";import{makeHandle as i,destroyHandle as a}from"../../../../core/handleUtils.js";import{watch as o,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{initializeProjection as u,project as d}from"../../../../geometry/projectionUtils.js";import{GraphicsCollection as f}from"../../../../support/GraphicsCollection.js";import p from"../../../../symbols/SimpleFillSymbol.js";import m from"../../../../symbols/SimpleLineSymbol.js";import h from"../../../../symbols/SimpleMarkerSymbol.js";import{getHighlightGraphics as g}from"../../../layers/support/highlightUtils.js";let _=class extends n{get updating(){return this.graphicsView?.updating??!1}constructor(e){super(e),this._highlightCounts=new Map,this._graphicsViewLoader=null,this.graphics=new f,this.graphicsView=null,this.suspended=!1;let n=new t([255,255,255,1/255]);this._symbols=new Map([[`point`,new h({size:`2px`,style:`square`,color:n})],[`polyline`,new m({width:`2px`,color:n})],[`polygon`,new p({outline:null,color:n})]])}highlight(e,t){let n=g(e);if(n.length===0)return i();let r=!1,a;return this.updatingHandles.consumePromise(Promise.all([this._createHighlightGraphics(n),this._ensureGraphicsView3D()]).then(([e,n])=>{!r&&n&&(a=this._addHighlightGraphics(n,e,t))})),i(()=>{r=!0,a?.remove()})}preload(){this._ensureGraphicsView3D()}_addHighlightGraphics(e,t,n){for(let e of t)this._highlightCounts.set(e,(this._highlightCounts.get(e)??0)+1);this.graphics.addMany(t);let r=e.highlight(t,n);return i(()=>{this._removeHighlightGraphics(t),r.remove()})}_removeHighlightGraphics(e){this.graphics.removeMany(e.filter(e=>{let t=Math.max(0,(this._highlightCounts.get(e)??0)-1);return t===0?(this._highlightCounts.delete(e),!0):(this._highlightCounts.set(e,t),!1)}))}async _ensureGraphicsView3D(){if(this.graphicsView)return this.graphicsView;this._graphicsViewLoader||=import(`../GraphicsView3D.js`);let{default:e}=await this._graphicsViewLoader;if(this.destroyed)return null;let t=new e({view:this.view,layer:{type:`graphics-view-3d-dummy`,id:this.layer.id,uid:this.layer.uid,elevationInfo:{mode:`on-the-ground`}},getGraphics:()=>this.graphics,drapeSourcePriorityOffset:.5});return this._set(`graphicsView`,t),this.addHandles([a(this.graphicsView),o(()=>this.suspended,e=>{t.suspended=e},s)]),t}async _createHighlightGraphics(e){let t=e.map(({geometry:e})=>e?.spatialReference).filter(r).reduce((e,t)=>((e.length===0||!e.at(-1)?.equals(t))&&e.push(t),e),[]),n=this.view.spatialReference,i=t.map(e=>({source:e,dest:n}));try{await u(i)}catch{return[]}return e.map(e=>{let{geometry:t}=e;try{let r=t?d(t,n):null,i=e.cloneShallow();return i.geometry=r,i.symbol=this._symbols.get(r?.type),i}catch{return e}})}};e([c()],_.prototype,`graphics`,void 0),e([c()],_.prototype,`graphicsView`,void 0),e([c()],_.prototype,`view`,void 0),e([c()],_.prototype,`layer`,void 0),e([c()],_.prototype,`updatingHandles`,void 0),e([c()],_.prototype,`suspended`,void 0),e([c()],_.prototype,`updating`,null),_=e([l(`esri.views.3d.layers.support.ImageHighlightHelper3D`)],_);export{_ as ImageHighlightHelper3D};
2
+ import{__decorate as e}from"tslib";import t from"../../../../Color.js";import n from"../../../../core/Accessor.js";import{isSome as r}from"../../../../core/arrayUtils.js";import{makeHandle as i,destroyHandle as a}from"../../../../core/handleUtils.js";import{watch as o,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{assertNotMesh as u}from"../../../../geometry/asserts.js";import{initializeProjection as d,project as f}from"../../../../geometry/projectionUtils.js";import{GraphicsCollection as p}from"../../../../support/GraphicsCollection.js";import m from"../../../../symbols/SimpleFillSymbol.js";import h from"../../../../symbols/SimpleLineSymbol.js";import g from"../../../../symbols/SimpleMarkerSymbol.js";import{getHighlightGraphics as _}from"../../../layers/support/highlightUtils.js";let v=class extends n{get updating(){return this.graphicsView?.updating??!1}constructor(e){super(e),this._highlightCounts=new Map,this._graphicsViewLoader=null,this.graphics=new p,this.graphicsView=null,this.suspended=!1;let n=new t([255,255,255,1/255]);this._symbols=new Map([[`point`,new g({size:`2px`,style:`square`,color:n})],[`polyline`,new h({width:`2px`,color:n})],[`polygon`,new m({outline:null,color:n})]])}highlight(e,t){let n=_(e);if(n.length===0)return i();let r=!1,a;return this.updatingHandles.consumePromise(Promise.all([this._createHighlightGraphics(n),this._ensureGraphicsView3D()]).then(([e,n])=>{!r&&n&&(a=this._addHighlightGraphics(n,e,t))})),i(()=>{r=!0,a?.remove()})}preload(){this._ensureGraphicsView3D()}_addHighlightGraphics(e,t,n){for(let e of t)this._highlightCounts.set(e,(this._highlightCounts.get(e)??0)+1);this.graphics.addMany(t);let r=e.highlight(t,n);return i(()=>{this._removeHighlightGraphics(t),r.remove()})}_removeHighlightGraphics(e){this.graphics.removeMany(e.filter(e=>{let t=Math.max(0,(this._highlightCounts.get(e)??0)-1);return t===0?(this._highlightCounts.delete(e),!0):(this._highlightCounts.set(e,t),!1)}))}async _ensureGraphicsView3D(){if(this.graphicsView)return this.graphicsView;this._graphicsViewLoader||=import(`../GraphicsView3D.js`);let{default:e}=await this._graphicsViewLoader;if(this.destroyed)return null;let t=new e({view:this.view,layer:{type:`graphics-view-3d-dummy`,id:this.layer.id,uid:this.layer.uid,elevationInfo:{mode:`on-the-ground`}},getGraphics:()=>this.graphics,drapeSourcePriorityOffset:.5});return this._set(`graphicsView`,t),this.addHandles([a(this.graphicsView),o(()=>this.suspended,e=>{t.suspended=e},s)]),t}async _createHighlightGraphics(e){let t=e.map(({geometry:e})=>e?.spatialReference).filter(r).reduce((e,t)=>((e.length===0||!e.at(-1)?.equals(t))&&e.push(t),e),[]),n=this.view.spatialReference,i=t.map(e=>({source:e,dest:n}));try{await d(i)}catch{return[]}return e.map(e=>{let{geometry:t}=e;try{u(t);let r=t?f(t,n):null,i=e.cloneShallow();return i.geometry=r,i.symbol=this._symbols.get(r?.type),i}catch{return e}})}};e([c()],v.prototype,`graphics`,void 0),e([c()],v.prototype,`graphicsView`,void 0),e([c()],v.prototype,`view`,void 0),e([c()],v.prototype,`layer`,void 0),e([c()],v.prototype,`updatingHandles`,void 0),e([c()],v.prototype,`suspended`,void 0),e([c()],v.prototype,`updating`,null),v=e([l(`esri.views.3d.layers.support.ImageHighlightHelper3D`)],v);export{v as ImageHighlightHelper3D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- class e{constructor(e,t){this._maxTotalSamples=e,this._maxDistance=t,this.count=0,this.numSamples=0}get done(){return this.numRemainingSamples===0}get numRemainingSamples(){return Math.max(0,this._maxTotalSamples-this.numSamples)}get ratio(){return this.numSamples?this.count/this.numSamples:0}sampleGeometry(e,t,n){switch(e?.type){case`point`:if(t?.type!==`point`)return;this._withinDistance(e.x-t.x,e.y-t.y)&&this.count++,this.numSamples++;break;case`polyline`:case`polygon`:{let t=e.type===`polyline`?e.paths:e.rings;for(let e=0;e<t.length;e++){let r=t[e],i=t.length-e,a=n/i,o=Math.max(1,Math.ceil(r.length/a));for(let e=Math.floor(o/2);e<r.length-1;e+=o){let t=r[e],i=r[e+1],a=i[0]-t[0],o=i[1]-t[1];if(this._withinDistance(a,o)&&this.count++,this.numSamples++,n--,n<=0||this.numSamples>=this._maxTotalSamples)return}}}}}_withinDistance(e,t){return Math.abs(e)<=this._maxDistance||Math.abs(t)<=this._maxDistance}}export{e as SampledGeometryMaxDistanceRatio};
2
+ class e{constructor(e,t){this._maxTotalSamples=e,this.count=0,this.numSamples=0,this._maxDistanceSquared=t**2}get done(){return this.numRemainingSamples===0}get numRemainingSamples(){return Math.max(0,this._maxTotalSamples-this.numSamples)}get ratio(){return this.numSamples?this.count/this.numSamples:0}sampleGeometry(e,t,n){switch(e?.type){case`point`:if(t?.type!==`point`)return;this._withinDistance(e.x-t.x,e.y-t.y)&&this.count++,this.numSamples++;break;case`polyline`:case`polygon`:{let t=e.type===`polyline`?e.paths:e.rings;for(let e=0;e<t.length;e++){let r=t[e],i=t.length-e,a=n/i,o=Math.max(1,Math.ceil(r.length/a));for(let e=Math.floor(o/2);e<r.length-1;e+=o){let t=r[e],i=r[e+1],a=i[0]-t[0],o=i[1]-t[1];if(this._withinDistance(a,o)&&this.count++,this.numSamples++,n--,n<=0||this.numSamples>=this._maxTotalSamples)return}}}}}_withinDistance(e,t){return e**2+t**2<=this._maxDistanceSquared}}export{e as SampledGeometryMaxDistanceRatio};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{handlesGroup as e}from"../../../core/handleUtils.js";import{watch as t,initial as n}from"../../../core/reactiveUtils.js";import r from"../../../geometry/Extent.js";import{projectOrLoad as i}from"../../../geometry/projectionUtils.js";import{projectBoundingRect as a}from"../../../geometry/projection/projectBoundingRect.js";import{intersects as o,fromExtent as s,empty as c}from"../../../geometry/support/aaBoundingRect.js";function l(c){let l=!1,p=(e,t,n)=>{if(l||u(e,n)||t==null)return;let m=i(t,c.view.spatialReference);if(m.pending!=null){l=!0,m.pending.finally(()=>{l=!1,p(e,t,n)});return}let h=m.geometry;if(h==null)return;let g=h.type===`point`?r.fromPoint(h):h.extent;g!=null&&a(e.extent,e.spatialReference,d,c.view.spatialReference)&&o(d,s(g,f))&&c.onElevationChanges()},m,h=t(()=>({elevationMode:c.elevationInfo?.mode,geometry:c.geometry}),({elevationMode:e,geometry:t})=>{m?.remove(),e!==`absolute-height`&&(m=c.view.elevationProvider.on(`elevation-change`,n=>p(n,t,e)))},n);return e([h,m])}function u({context:e},t){return t==null?!1:t===`absolute-height`||e===`scene`&&t!==`relative-to-scene`}const d=c(),f=c();export{l as createElevationUpdateHandle};
2
+ import{handlesGroup as e}from"../../../core/handleUtils.js";import{watch as t,initial as n}from"../../../core/reactiveUtils.js";import{assertNotMesh as r}from"../../../geometry/asserts.js";import i from"../../../geometry/Extent.js";import{projectOrLoad as a}from"../../../geometry/projectionUtils.js";import{projectBoundingRect as o}from"../../../geometry/projection/projectBoundingRect.js";import{intersects as s,fromExtent as c,empty as l}from"../../../geometry/support/aaBoundingRect.js";function u(l){let u=!1,m=(e,t,n)=>{if(u||d(e,n)||t==null)return;r(t);let h=a(t,l.view.spatialReference);if(h.pending!=null){u=!0,h.pending.finally(()=>{u=!1,m(e,t,n)});return}let g=h.geometry;if(g==null)return;let _=g.type===`point`?i.fromPoint(g):g.extent;_!=null&&o(e.extent,e.spatialReference,f,l.view.spatialReference)&&s(f,c(_,p))&&l.onElevationChanges()},h,g=t(()=>({elevationMode:l.elevationInfo?.mode,geometry:l.geometry}),({elevationMode:e,geometry:t})=>{h?.remove(),e!==`absolute-height`&&(h=l.view.elevationProvider.on(`elevation-change`,n=>m(n,t,e)))},n);return e([g,h])}function d({context:e},t){return t==null?!1:t===`absolute-height`||e===`scene`&&t!==`relative-to-scene`}const f=l(),p=l();export{u as createElevationUpdateHandle};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{isScreenRect as e,createScreenPoint as t}from"../../../core/screenUtils.js";import{isTiledLayer as n,isLayerWithFlowRenderer as r}from"../../../layers/support/layerUtils.js";import{hitTestSelectSimilarDistance as i}from"../../support/hitTestSelectUtils.js";import{isScaleRangeActive as a,scaleBoundsPredicate as o}from"../../support/layerViewUtils.js";async function s(s,d){let f=await i(s,d),{results:p}=f,m=f.ground,h=e(d)?s.toMap(t(d.x+d.width/2,d.y+d.height/2)):m.mapPoint,g=h!=null,_=[],v=u(s),y=m.layer==null,b=g?c(s,v,y):l,x=0,S=0,C=()=>{let e=b.layerViews[S++];if(!g||!e||!(`fetchPopupFeaturesAtTarget`in e))return;let t=h,i=e.layer;if(n(i)&&`effectiveScaleRange`in i){let{minScale:e,maxScale:n}=i.effectiveScaleRange;if(a(e,n)){if(r(i)&&!o(s.scale,e,n))return;let a=s.basemapTerrain.getScale(t);if(!o(a,e,n))return}}_.push({geometry:t,layerView:e})},w=null;for(;x<p.length||S<b.layerViews.length;){let e=p[x];if(e&&e.type!==`graphic`)++x;else if(e?.layer?.type===`scene`&&e?.layer?.parent===s?.map?.basemap)++x;else if(e){let t=e.layer?.uid,n=b.layerUids.has(t)&&e.distance===m.distance,r=v.get(e.layer?.uid);if(w??=e.mapPoint,S<b.layerViews.length&&(n||(e.distance??0)>m.distance)&&b.layerViews[S]!==r){C();continue}_.push({graphic:e.graphic,layerView:r}),++x}else C()}return w??=h,{hits:_,location:w}}function c(e,t,n){let r=new Set,i=new Set,a=e=>{e&&(r.add(e.layer.uid),i.add(e))};if(n){let{basemapTerrain:t}=e,n=t.numLayers(1);for(let e=n-1;e>=0;e--)a(t.layerViewByIndex(e,1))}let o=e.overlayManager.renderer.layers;for(let{uid:e}of o)a(t.get(e));return{layerUids:r,layerViews:Array.from(i).reverse()}}const l={layerUids:new Set,layerViews:[]};function u(e){let t=new Map;for(let n of e.allLayerViews){let e=n.layer.uid;t.set(e,n)}return t}export{s as popupHitTest};
2
+ import{isScreenRect as e,createScreenPoint as t}from"../../../core/screenUtils.js";import{isScaleRangeActive as n,scaleBoundsPredicate as r}from"../../../geometry/support/scaleUtils.js";import{isTiledLayer as i,isLayerWithFlowRenderer as a}from"../../../layers/support/layerUtils.js";import{hitTestSelectSimilarDistance as o}from"../../support/hitTestSelectUtils.js";async function s(s,d){let f=await o(s,d),{results:p}=f,m=f.ground,h=e(d)?s.toMap(t(d.x+d.width/2,d.y+d.height/2)):m.mapPoint,g=h!=null,_=[],v=u(s),y=m.layer==null,b=g?c(s,v,y):l,x=0,S=0,C=()=>{let e=b.layerViews[S++];if(!g||!e||!(`fetchPopupFeaturesAtTarget`in e))return;let t=h,o=e.layer;if(i(o)&&`effectiveScaleRange`in o){let{minScale:e,maxScale:i}=o.effectiveScaleRange;if(n(e,i)){if(a(o)&&!r(s.scale,e,i))return;let n=s.basemapTerrain.getScale(t);if(!r(n,e,i))return}}_.push({geometry:t,layerView:e})},w=null;for(;x<p.length||S<b.layerViews.length;){let e=p[x];if(e&&e.type!==`graphic`)++x;else if(e?.layer?.type===`scene`&&e?.layer?.parent===s?.map?.basemap)++x;else if(e){let t=e.layer?.uid,n=b.layerUids.has(t)&&e.distance===m.distance,r=v.get(e.layer?.uid);if(w??=e.mapPoint,S<b.layerViews.length&&(n||(e.distance??0)>m.distance)&&b.layerViews[S]!==r){C();continue}_.push({graphic:e.graphic,layerView:r}),++x}else C()}return w??=h,{hits:_,location:w}}function c(e,t,n){let r=new Set,i=new Set,a=e=>{e&&(r.add(e.layer.uid),i.add(e))};if(n){let{basemapTerrain:t}=e,n=t.numLayers(1);for(let e=n-1;e>=0;e--)a(t.layerViewByIndex(e,1))}let o=e.overlayManager.renderer.layers;for(let{uid:e}of o)a(t.get(e));return{layerUids:r,layerViews:Array.from(i).reverse()}}const l={layerUids:new Set,layerViews:[]};function u(e){let t=new Map;for(let n of e.allLayerViews){let e=n.layer.uid;t.set(e,n)}return t}export{s as popupHitTest};