@arcgis/core 4.34.0-next.20 → 4.34.0-next.22

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 (252) hide show
  1. package/analysis/VolumeMeasurement/CutFillOptions.js +5 -0
  2. package/analysis/VolumeMeasurement/volumeMeasurementUtils.js +5 -0
  3. package/analysis/VolumeMeasurementAnalysis.d.ts +4 -0
  4. package/analysis/VolumeMeasurementAnalysis.js +5 -0
  5. package/assets/esri/core/workers/RemoteClient.js +1 -1
  6. package/assets/esri/core/workers/chunks/{bcaf6edf887e4afbbdd2.js → 02dc6e31b1244e5bb785.js} +1 -1
  7. package/assets/esri/core/workers/chunks/04c17957c15234ca0321.js +1 -0
  8. package/assets/esri/core/workers/chunks/084236ca316aad980192.js +1 -0
  9. package/assets/esri/core/workers/chunks/0b484224a92b52c34330.js +1 -0
  10. package/assets/esri/core/workers/chunks/{822b32aaeec05a347c84.js → 0ba6177ba118a0f032e2.js} +1 -1
  11. package/assets/esri/core/workers/chunks/12723e79b996969e304e.js +1 -0
  12. package/assets/esri/core/workers/chunks/{bd7b985f7962b1cc7b8a.js → 146520d263b910b5bdc7.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{445ddf57d2f503a0b98b.js → 15064c3b21b325d5c2f6.js} +1 -1
  14. package/assets/esri/core/workers/chunks/19ae76283a0cb0fe4dee.js +346 -0
  15. package/assets/esri/core/workers/chunks/{28b525963420f022fb0a.js → 1cc30073f8200b67cff6.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{82a5000296134834d1ac.js → 1d75cb1747ffb7b8b050.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{55ce214a10fb6fc2e901.js → 24fe862b607ec927e07f.js} +1 -1
  18. package/assets/esri/core/workers/chunks/30fae1f066dc3cd781f1.js +1 -0
  19. package/assets/esri/core/workers/chunks/32756905bcf11699b3f7.js +1 -0
  20. package/assets/esri/core/workers/chunks/{7ec73f63929b1623de72.js → 3793f282ddaccd3465f2.js} +1 -1
  21. package/assets/esri/core/workers/chunks/3fcd73ba832cb53d3a07.js +1 -0
  22. package/assets/esri/core/workers/chunks/41f487713c6278d389a1.js +1 -0
  23. package/assets/esri/core/workers/chunks/{5e7f35bf1aab93cb1c52.js → 4cea5170939c8d363ef7.js} +1 -1
  24. package/assets/esri/core/workers/chunks/5253cca467fe9bc0a210.js +1 -0
  25. package/assets/esri/core/workers/chunks/{735d96d2b951cc1df3a3.js → 576e408fb0834f3948e8.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{2a784da5fa3f502d1803.js → 58e74681ddef30ba9cb6.js} +1 -1
  27. package/assets/esri/core/workers/chunks/5b276962c46c57155166.js +1 -0
  28. package/assets/esri/core/workers/chunks/5ce62d9fff80d014d186.js +1 -0
  29. package/assets/esri/core/workers/chunks/5e805c9e9012dd39ec86.js +1 -0
  30. package/assets/esri/core/workers/chunks/{27c9d3f6cebca087a123.js → 6136bf09950adc46bc33.js} +1 -1
  31. package/assets/esri/core/workers/chunks/66757fc16316a5c50e1e.js +1 -0
  32. package/assets/esri/core/workers/chunks/6a0fbc54638f7de138c1.js +1 -0
  33. package/assets/esri/core/workers/chunks/{dfd9ac2e28c96900c53e.js → 6c33ecffbc783cb8f944.js} +1 -1
  34. package/assets/esri/core/workers/chunks/6ca764b4baadef5c1515.js +1 -0
  35. package/assets/esri/core/workers/chunks/{fcdf714339060731fe1c.js → 7051bcc178eb512819f6.js} +1 -1
  36. package/assets/esri/core/workers/chunks/7cfba5cec425221962e8.js +1 -0
  37. package/assets/esri/core/workers/chunks/{3a753ce4de2e6ad40f7b.js → 86d6007c45f2aa643ac8.js} +1 -1
  38. package/assets/esri/core/workers/chunks/8b19fe829a9dc26fb3fe.js +1 -0
  39. package/assets/esri/core/workers/chunks/8eea6251aa09725e654e.js +1 -0
  40. package/assets/esri/core/workers/chunks/916691122d7fb38497d6.js +1 -0
  41. package/assets/esri/core/workers/chunks/919d2fd7ebc0c840a759.js +1 -0
  42. package/assets/esri/core/workers/chunks/92ad9098006568358550.js +1 -0
  43. package/assets/esri/core/workers/chunks/{2ed698579befe73caafd.js → 94d75f3b215e3bd1b4d7.js} +1 -1
  44. package/assets/esri/core/workers/chunks/97324f030738fc0d456b.js +1 -0
  45. package/assets/esri/core/workers/chunks/9c510df592befb9ff892.js +1 -0
  46. package/assets/esri/core/workers/chunks/{15d1ab71aaf6bcf3145b.js → a7a5b89c2bb69f3af59c.js} +1 -1
  47. package/assets/esri/core/workers/chunks/aba520714efc01bead36.js +1 -0
  48. package/assets/esri/core/workers/chunks/accff253af360c34e8a8.js +1 -0
  49. package/assets/esri/core/workers/chunks/ad3871f497ecea1a08c9.js +1 -0
  50. package/assets/esri/core/workers/chunks/ae6eed26fc932bc08356.js +1 -0
  51. package/assets/esri/core/workers/chunks/b4512d62b6cb26fc6b25.js +1 -0
  52. package/assets/esri/core/workers/chunks/{63e984a65ee670449a4a.js → b4bb461955a4c2bce072.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{abc75c945f3cfb1629b0.js → ba5b24beebeb703b5919.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{51afd0e71df1825d7593.js → c64fa94cba71ba2794e2.js} +1 -1
  55. package/assets/esri/core/workers/chunks/c94cc026c4ed330408fb.js +1 -0
  56. package/assets/esri/core/workers/chunks/cab1a1067f44ce374673.js +1 -0
  57. package/assets/esri/core/workers/chunks/{3f4a8c874c022dace9be.js → d1b363c418a67b087306.js} +1 -1
  58. package/assets/esri/core/workers/chunks/d45383d76ba99718b6d9.js +1 -0
  59. package/assets/esri/core/workers/chunks/{f806e9221dff7fcfc2f9.js → e2cb295104ed2f8cd2ff.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{9432a5466eec397710a4.js → e49a135a2933306a6105.js} +1 -1
  61. package/assets/esri/core/workers/chunks/{d31fa648497b0af97dc1.js → e9a9174c4d1a0a9effb6.js} +1 -1
  62. package/assets/esri/core/workers/chunks/f3d5d92e0aefc2593208.js +1 -0
  63. package/assets/esri/core/workers/chunks/f3e3c2340452c1d60c95.js +1 -0
  64. package/assets/esri/core/workers/chunks/{85b0e2a898251d048dda.js → f42155b7a4e6c5e80757.js} +1 -1
  65. package/assets/esri/core/workers/chunks/f43110391f124b8a179c.js +1009 -0
  66. package/assets/esri/core/workers/chunks/{080a8a1c6fe2d215142d.js → fb5e2b1ced03eef28e96.js} +1 -1
  67. package/assets/esri/core/workers/chunks/fe73e74e3e4278aedcc3.js +1 -0
  68. package/config.js +1 -1
  69. package/core/Clonable.js +1 -1
  70. package/core/lang.js +1 -1
  71. package/core/libs/rbush/PooledRBush.js +1 -1
  72. package/core/scheduling.js +1 -1
  73. package/geometry/Mesh.js +1 -1
  74. package/geometry/support/MeshComponent.js +1 -1
  75. package/geometry/support/MeshMaterial.js +1 -1
  76. package/geometry/support/MeshMaterialMetallicRoughness.js +1 -1
  77. package/geometry/support/MeshTexture.js +1 -1
  78. package/geometry/support/MeshTransform.js +1 -1
  79. package/geometry/support/MeshVertexAttributes.js +1 -1
  80. package/geometry/support/buffer/BufferView.js +1 -1
  81. package/geometry/support/float16.js +1 -1
  82. package/geometry/support/meshUtils/convertMeshVertexSpace.js +1 -1
  83. package/geometry/support/meshUtils/merge.js +1 -1
  84. package/geometry/support/meshUtils/meshCloneUtils.js +5 -0
  85. package/interfaces.d.ts +1134 -156
  86. package/kernel.js +1 -1
  87. package/layers/SubtypeGroupLayer.js +1 -1
  88. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  89. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  90. package/layers/mixins/ArcGISMapService.js +1 -1
  91. package/layers/save/mapImageLayerUtils.js +1 -1
  92. package/layers/support/TilemapCache.js +1 -1
  93. package/layers/support/TitleCreator.js +1 -1
  94. package/layers/support/arcgisLayerUrl.js +1 -1
  95. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  96. package/package.json +1 -1
  97. package/rest/knowledgeGraph/GraphAddFieldIndexResult.d.ts +4 -0
  98. package/rest/knowledgeGraph/GraphAddPropertyResult.d.ts +4 -0
  99. package/rest/knowledgeGraph/GraphDataModelOperationResult.d.ts +4 -0
  100. package/rest/knowledgeGraph/GraphDeleteFieldIndexResult.d.ts +4 -0
  101. package/rest/knowledgeGraph/GraphDeletePropertyResult.d.ts +4 -0
  102. package/rest/knowledgeGraph/GraphUpdateNamedTypesResult.d.ts +4 -0
  103. package/rest/knowledgeGraph/GraphUpdatePropertyResult.d.ts +4 -0
  104. package/rest/knowledgeGraph/GraphUpdateSearchIndexResult.d.ts +4 -0
  105. package/rest/knowledgeGraphService.d.ts +7 -0
  106. package/support/requestUtils.js +1 -1
  107. package/support/revision.js +1 -1
  108. package/views/2d/engine/ManagedCanvas.js +1 -1
  109. package/views/2d/engine/ParentChildStage.js +5 -0
  110. package/views/2d/engine/Stage.js +1 -1
  111. package/views/2d/engine/webgl/OverlayContainer.js +1 -1
  112. package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
  113. package/views/2d/engine/webgl/Painter.js +1 -1
  114. package/views/2d/engine/webgl/VideoScreenRenderer.js +5 -0
  115. package/views/2d/engine/webgl/shaderGraph/techniques/TechniqueType.js +1 -1
  116. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js +5 -0
  117. package/views/2d/engine/webgl/shaderGraph/techniques/videoScreenRenderer/VideoScreenTechnique.js +5 -0
  118. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  119. package/views/2d/layers/MediaLayerView2D.js +1 -1
  120. package/views/2d/layers/TileLayerView2D.js +1 -1
  121. package/views/2d/layers/features/Processor.js +1 -1
  122. package/views/2d/layers/features/processor/AProcessorStrategy.js +1 -1
  123. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  124. package/views/2d/mapViewDeps.js +1 -1
  125. package/views/3d/analysis/AnalysisViewManager3D.js +1 -1
  126. package/views/3d/analysis/VolumeMeasurementAnalysisView3D.d.ts +4 -0
  127. package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +5 -0
  128. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  129. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  130. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  131. package/views/3d/layers/graphics/DeconflictAABR.js +1 -1
  132. package/views/3d/layers/graphics/ExtentSet.js +1 -1
  133. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  134. package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
  135. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  136. package/views/3d/layers/graphics/Graphics3DGraphicsPipeline.js +1 -1
  137. package/views/3d/layers/graphics/Labeler.js +1 -1
  138. package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
  139. package/views/3d/layers/i3s/I3SAsyncElevationUpdater.js +1 -1
  140. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  141. package/views/3d/layers/i3s/I3SLodHandling.js +1 -1
  142. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  143. package/views/3d/layers/support/FeatureTileDescriptor.js +1 -1
  144. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  145. package/views/3d/layers/support/FeatureTileFetcher3DContext.js +1 -1
  146. package/views/3d/layers/support/FeatureTileTree3D.js +1 -1
  147. package/views/3d/layers/support/FeatureVisibilityFilter.js +1 -1
  148. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  149. package/views/3d/state/GoToOperation.js +1 -1
  150. package/views/3d/state/ViewStateManager.js +1 -1
  151. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  152. package/views/3d/support/StreamDataLoader.js +1 -1
  153. package/views/3d/support/buffer/InterleavedLayout.js +1 -1
  154. package/views/3d/support/cameraUtils.js +1 -1
  155. package/views/3d/support/viewingModeUtils.js +5 -0
  156. package/views/3d/support/viewpointUtils.js +1 -1
  157. package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
  158. package/views/3d/terrain/OverlayManager.js +1 -1
  159. package/views/3d/terrain/OverlayRenderTargets.js +1 -1
  160. package/views/3d/terrain/OverlayRenderer.js +1 -1
  161. package/views/3d/terrain/TerrainSurface.js +1 -1
  162. package/views/3d/webgl/ManagedFBOResource.js +1 -1
  163. package/views/3d/webgl-engine/Stage.js +1 -1
  164. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  165. package/views/3d/webgl-engine/core/FBOPool.js +1 -1
  166. package/views/3d/webgl-engine/effects/RenderNodes.js +1 -1
  167. package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
  168. package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
  169. package/views/3d/webgl-engine/lib/DefaultVertexBufferLayouts.js +1 -1
  170. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  171. package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
  172. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  173. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  174. package/views/3d/webgl.d.ts +2 -0
  175. package/views/3d/webgl.js +1 -1
  176. package/views/SceneView.js +1 -1
  177. package/views/VideoView.js +1 -1
  178. package/views/View2D.js +1 -1
  179. package/views/Viewport2DBaseMixin.js +5 -0
  180. package/views/Viewport2DMixin.js +1 -1
  181. package/views/layers/FeatureLayerView.js +1 -1
  182. package/views/support/Scheduler.js +1 -1
  183. package/views/support/layerViewUtils.js +1 -1
  184. package/views/video/VideoOperationalDataView.js +5 -0
  185. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  186. package/widgets/BatchAttributeForm/inputs/BatchFormInputs.d.ts +4 -0
  187. package/widgets/BatchAttributeForm/inputs/BatchFormInputs.js +1 -1
  188. package/widgets/BatchAttributeForm/inputs/EditableInput.d.ts +4 -0
  189. package/widgets/BatchAttributeForm/inputs/EditableInput.js +1 -1
  190. package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +4 -0
  191. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  192. package/widgets/BatchAttributeForm/inputs/GroupInput.d.ts +4 -0
  193. package/widgets/BatchAttributeForm/inputs/GroupInput.js +1 -1
  194. package/widgets/BatchAttributeForm/inputs/InputBase.d.ts +4 -0
  195. package/widgets/BatchAttributeForm/inputs/InputBase.js +1 -1
  196. package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
  197. package/widgets/Directions.js +1 -1
  198. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  199. package/widgets/Editor/Edits.js +1 -1
  200. package/widgets/FeatureForm/EditableInput.d.ts +2 -2
  201. package/widgets/FeatureForm/FieldInput.d.ts +2 -2
  202. package/widgets/FeatureForm/GroupInput.d.ts +2 -2
  203. package/widgets/FeatureForm/InputBase.d.ts +2 -2
  204. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  205. package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
  206. package/widgets/OrientedImageryViewer/components/ImageLocationWidget.js +1 -1
  207. package/widgets/OrientedImageryViewer/components/ImageMeasurementWidget.js +1 -1
  208. package/widgets/OrientedImageryViewer.js +1 -1
  209. package/widgets/VersionManagement/VersionManagementViewModel.js +1 -1
  210. package/widgets/VideoPlayer.js +1 -1
  211. package/widgets/support/SelectionList/FeatureItem.js +1 -1
  212. package/widgets/support/SelectionList/GroupLayerItem.js +1 -1
  213. package/widgets/support/SelectionList/LayerItem.js +1 -1
  214. package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
  215. package/widgets/support/SelectionList.js +1 -1
  216. package/widgets/support/Selector2D/SelectionOperation.js +1 -1
  217. package/assets/esri/core/workers/chunks/034950f7d0596e77a7dd.js +0 -1
  218. package/assets/esri/core/workers/chunks/0808b7b2a18331ac0cf6.js +0 -1
  219. package/assets/esri/core/workers/chunks/093938edee5f0532d7da.js +0 -1
  220. package/assets/esri/core/workers/chunks/0f5643d5437f48c63225.js +0 -1
  221. package/assets/esri/core/workers/chunks/116bbff428cc2dc1832e.js +0 -1
  222. package/assets/esri/core/workers/chunks/1646699188ed0cd4ce24.js +0 -1
  223. package/assets/esri/core/workers/chunks/1c7393bcd6e85ba25e1b.js +0 -1
  224. package/assets/esri/core/workers/chunks/2999ae2a7d4d1ad6447b.js +0 -1
  225. package/assets/esri/core/workers/chunks/2e3f620c79ec04033a6e.js +0 -1
  226. package/assets/esri/core/workers/chunks/2e54be3094e41fd3026d.js +0 -346
  227. package/assets/esri/core/workers/chunks/3541714d448958c9bc38.js +0 -1
  228. package/assets/esri/core/workers/chunks/48953ddf0bbcf3d77e04.js +0 -1
  229. package/assets/esri/core/workers/chunks/5b7464137aacf1c5fd78.js +0 -1
  230. package/assets/esri/core/workers/chunks/629a257509b148ff38c0.js +0 -1
  231. package/assets/esri/core/workers/chunks/6b5fc9da8ae34c889b83.js +0 -1
  232. package/assets/esri/core/workers/chunks/707b34e15937c4f7902f.js +0 -1
  233. package/assets/esri/core/workers/chunks/770e609a6bd3533ceda9.js +0 -1
  234. package/assets/esri/core/workers/chunks/7925e8ffa8027b59410e.js +0 -1
  235. package/assets/esri/core/workers/chunks/8235a997acb45ab43173.js +0 -1
  236. package/assets/esri/core/workers/chunks/851baab753d9c8e967bd.js +0 -1
  237. package/assets/esri/core/workers/chunks/aa6c37f116c07ddca5fb.js +0 -1
  238. package/assets/esri/core/workers/chunks/bac5e1d50b69f0d94694.js +0 -1
  239. package/assets/esri/core/workers/chunks/bc0c3b5a5ab3fcb8f77a.js +0 -1
  240. package/assets/esri/core/workers/chunks/bcefb413d03d59506b5a.js +0 -1009
  241. package/assets/esri/core/workers/chunks/c96fed4889712f5a9135.js +0 -1
  242. package/assets/esri/core/workers/chunks/cac281604a41af9b1759.js +0 -1
  243. package/assets/esri/core/workers/chunks/cb4c49d5b70f9563bc46.js +0 -1
  244. package/assets/esri/core/workers/chunks/d25c8c30ce4058937d4f.js +0 -1
  245. package/assets/esri/core/workers/chunks/d638ae7814acf6c0fb8e.js +0 -1
  246. package/assets/esri/core/workers/chunks/d6ce99a713afdb03e332.js +0 -1
  247. package/assets/esri/core/workers/chunks/dc3816eef53d17074eab.js +0 -1
  248. package/assets/esri/core/workers/chunks/dd70b060ea4f632c2430.js +0 -1
  249. package/assets/esri/core/workers/chunks/e2e5e8bd3406609d8996.js +0 -1
  250. package/assets/esri/core/workers/chunks/e9aa1d9ded8a52a40c57.js +0 -1
  251. package/assets/esri/core/workers/chunks/f65ad6a41c0c69bf1b21.js +0 -1
  252. package/assets/esri/core/workers/chunks/f6c815f7d3ca072172ce.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import{makeHandle as i}from"../../../core/handleUtils.js";import t from"../../../core/Logger.js";import{isAbortError as s,waitTick as r}from"../../../core/promiseUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{equals as h}from"../../../geometry/support/spatialReferenceUtils.js";import{GraphicsCollection as a}from"../../../support/GraphicsCollection.js";import"../../../core/Error.js";import"../../../core/scheduling.js";import"../../../core/colorUtils.js";import"../../../config.js";import"../../../symbols/cim/defaultCIMValues.js";import"../../../symbols/cim/enums.js";import"../../../core/floatRGBA.js";import"../../../geometry/Extent.js";import"../../../geometry/Geometry.js";import"../../../geometry/Multipoint.js";import"../../../geometry/Point.js";import"../../../geometry/Polygon.js";import"../../../geometry/Polyline.js";import"../engine/webgl/definitions.js";import"../engine/webgl/animations/instructions.js";import"../../../core/mathUtils.js";import"../../../symbols/Font.js";import"../../../core/ObjectPool.js";import"../../../geometry/support/Axis.js";import"../../../geometry/support/TileClipper.js";import"../../../symbols/cim/effects/EffectAddControlPoints.js";import"../../../symbols/cim/effects/EffectArrow.js";import"../../../symbols/cim/effects/EffectBuffer.js";import"../../../symbols/cim/effects/EffectControlMeasureLine.js";import"../../../symbols/cim/effects/EffectCut.js";import"../../../symbols/cim/effects/EffectDashes.js";import"../../../symbols/cim/effects/EffectDonut.js";import"../../../symbols/cim/effects/EffectEnclosingPolygon.js";import"../../../symbols/cim/effects/EffectJog.js";import"../../../symbols/cim/effects/EffectMove.js";import"../../../symbols/cim/effects/EffectOffset.js";import"../../../symbols/cim/effects/EffectRadial.js";import"../../../symbols/cim/effects/EffectReverse.js";import"../../../symbols/cim/effects/EffectRotate.js";import"../../../symbols/cim/effects/EffectScale.js";import"../../../symbols/cim/effects/EffectSuppress.js";import"../../../symbols/cim/effects/EffectTaperedPolygon.js";import"../../../symbols/cim/effects/EffectWave.js";import"../../../symbols/cim/placements/PlacementAlongLineSameSize.js";import"../../../symbols/cim/placements/PlacementAtExtremities.js";import"../../../symbols/cim/placements/PlacementAtRatioPositions.js";import"../../../symbols/cim/placements/PlacementInsidePolygon.js";import"../../../symbols/cim/placements/PlacementOnLine.js";import"../../../symbols/cim/placements/PlacementOnVertices.js";import"../../../symbols/cim/placements/PlacementPolygonCenter.js";import"../../../symbols/cim/constants.js";import"../../../core/libs/gl-matrix-2/factories/vec2f32.js";import"../engine/webgl/alignmentUtils.js";import"../../../symbols/support/defaults.js";import"../../../symbols/cim/OverrideHelper.js";import"../../../layers/effects/EffectView.js";import"../../../core/Evented.js";import"../engine/transitions/FadeTransition.js";import"../engine/webgl/enums.js";import"../../../core/libs/gl-matrix-2/factories/vec4f32.js";import"../../webgl/enums.js";import"../engine/webgl/shaders/BackgroundPrograms.js";import"../../webgl/checkWebGLError.js";import"../engine/webgl/DefaultVertexAttributeLayouts.js";import"../engine/webgl/AFeatureTile.js";import"../engine/webgl/DisplayEntity.js";import"../engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"../engine/webgl/cpuMapped/MappedMesh.js";import"../engine/webgl/number.js";import"../engine/webgl/shaders/TileInfoPrograms.js";import"../../webgl/Texture.js";import"../../webgl/FBOAttachmentType.js";import"../engine/vectorTiles/style/StyleDefinition.js";import"../engine/vectorTiles/enums.js";import"../engine/webgl/shaders/BitBlitPrograms.js";import"../../../request.js";import"../../../core/urlUtils.js";import"../../../core/pbf.js";import"../engine/webgl/shaders/StencilPrograms.js";import"../engine/webgl/shaderGraph/techniques/TechniqueType.js";import"../engine/webgl/shaderGraph/techniques/shaders/BlendShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/OpacityShader.js";import"../engine/webgl/shaders/HighlightPrograms.js";import"../../webgl/FramebufferObject.js";import"../engine/webgl/meshing/SimpleMesh.js";import"../engine/webgl/PooledUint32Array.js";import"../engine/webgl/Profiler.js";import"../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"../../../Color.js";import"../engine/webgl/shaderGraph/techniques/animated/attributes.js";import"../engine/webgl/shaderGraph/techniques/shaders/constants.js";import"../engine/webgl/mesh/templates/templateUtils.js";import"../engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/dotDensity/DotDensityMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/ComplexFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/heatmap/HeatmapMeshWriter.js";import"../../../geometry/support/aaBoundingBox.js";import"../engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js";import"../../../arcade/ArcadeDate.js";import"../../../intl/locale.js";import"luxon";import"../../../core/sql/UnknownTimeZone.js";import"../../../layers/support/fieldUtils.js";import"../../../time/constants.js";import"../engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js";import"../../webgl/renderState.js";import"../../3d/webgl-engine/core/shaderModules/glsl.js";import"../../webgl/testSVGPremultipliedAlpha.js";import"../LabelManager.js";import n from"./graphics/GraphicsView2D.js";import"../../../core/accessorSupport/watch.js";import"../../../core/accessorSupport/tracking/SimpleTrackingTarget.js";import"../../../chunks/earcut.js";import"../../../core/libs/gl-matrix-2/factories/vec3f32.js";import"../../../geometry/support/normalizeUtilsCommon.js";import"../../../geometry/SpatialReference.js";import"../../../geometry/support/Ellipsoid.js";import"../../../kernel.js";import"./support/util.js";import"../navigation/MapViewNavigation.js";import"../../../core/asyncUtils.js";import"../../../core/support/UpdatingHandles.js";import"../engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../../../core/unitUtils.js";import"../../../geometry/ellipsoidUtils.js";import"../../../chunks/pe.js";import"../../../geometry/projection/projectors.js";import"../engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../../../geometry/support/geodesicConstants.js";import{BitmapTileLayerView2D as p}from"./BitmapTileLayerView2D.js";import{LayerView2DMixin as m}from"./LayerView2D.js";import c from"./graphics/HighlightGraphicContainer.js";import{createBlankImage as g,resampleImage as f}from"./support/imageUtils.js";import u from"../tiling/TileInfoView.js";import d from"../tiling/TileKey.js";import j from"../tiling/TileQueue.js";import y from"../tiling/TileStrategy.js";import w from"../../layers/LayerView.js";import b from"../../layers/RefreshableLayerView.js";import{getHighlightGraphics as _}from"../../layers/support/highlightUtils.js";import{isMapServiceLayerView as T,MapServiceLayerViewHelper as G}from"../../layers/support/MapServiceLayerViewHelper.js";import{createQueryGeometry as q}from"../../support/drapedUtils.js";import{defaultHighlightName as V}from"../../support/HighlightDefaults.js";import{TaskPriority as v}from"../../support/Scheduler.js";const I=[0,0];let P=class extends(b(p(m(w)))){constructor(){super(...arguments),this._fetchQueue=null,this._highlightGraphics=new a,this._highlightView=null,this._popupHighlightHelper=null,this._tileStrategy=null,this.layer=null}get resampling(){return!("resampling"in this.layer)||!1!==this.layer.resampling}get tilemapCache(){return"tilemapCache"in this.layer?this.layer.tilemapCache:null}update(e){this._fetchQueue.pause(),this._fetchQueue.state=e.state,this._tileStrategy.update(e),this._fetchQueue.resume(),this._highlightView?.processUpdate(e)}attach(){const e="tileServers"in this.layer?this.layer.tileServers:null,i=this.tilemapCache;if(this._tileInfoView=new u(this.layer.tileInfo,this.layer.fullExtent,i?.effectiveMinLOD,i?.effectiveMaxLOD),this._fetchQueue=new j({tileInfoView:this._tileInfoView,concurrency:e&&10*e.length||10,process:(e,i)=>this.fetchTile(e,i),scheduler:this.scheduler,priority:v.MAPVIEW_FETCH_QUEUE}),this._tileStrategy=new y({cachePolicy:"keep",resampling:this.resampling,acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView}),T(this,this.layer)){const e=this._highlightView=new n({view:this.view,graphics:this._highlightGraphics,requestUpdateCallback:()=>this.requestUpdate(),container:new c(this.view.featuresTilingScheme),defaultPointSymbolEnabled:!1});this.container.addChild(this._highlightView.container),this._popupHighlightHelper=new G({createFetchPopupFeaturesQueryGeometry:(e,i)=>q(e,i,this.view),highlightGraphics:this._highlightGraphics,highlightGraphicUpdated:({graphic:i,property:t})=>e.graphicUpdateHandler({graphic:i,property:t}),layerView:this,updatingHandles:this._updatingHandles})}this.requestUpdate(),this.addAttachHandles(this._updatingHandles.add(()=>this.resampling,()=>{this.doRefresh()})),super.attach()}detach(){super.detach(),this._tileStrategy.destroy(),this._fetchQueue.clear(),this.container.removeAllChildren(),this._popupHighlightHelper?.destroy(),this._highlightView?.destroy(),this._fetchQueue=this._tileStrategy=this._tileInfoView=this._popupHighlightHelper=null}async fetchPopupFeaturesAtLocation(e,i){return this._popupHighlightHelper?this._popupHighlightHelper.fetchPopupFeaturesAtLocation(e,i):[]}highlight(e,t){const s=_(e);if(0===s.length)return i();const r=t?.name??V;return this._addHighlightGraphics(s,r),i(()=>!this.destroyed&&this._removeHighlightGraphics(s,r))}_processHighlight(){const e=this._getHighlights();this._highlightView?.setHighlight(e)}_addHighlightGraphics(e,i){this._highlightGraphics.addMany(e),this._addHighlights(e.map(e=>e.uid),i)}_removeHighlightGraphics(e,i){this._highlightGraphics.removeMany(e),this._removeHighlights(e.map(e=>e.uid),i)}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}supportsSpatialReference(e){return h(this.layer.tileInfo?.spatialReference,e)}async doRefresh(){if(this.attached){if(this.suspended)return this._tileStrategy.clear(),void this.requestUpdate();this._fetchQueue.reset(),this._tileStrategy.refresh(e=>this._updatingHandles.addPromise(this._enqueueTileFetch(e)))}}acquireTile(e){const i=this._bitmapView.createTile(e),t=i.bitmap;return[t.x,t.y]=this._tileInfoView.getTileCoords(I,i.key),t.resolution=this._tileInfoView.getTileResolution(i.key),[t.width,t.height]=this._tileInfoView.tileInfo.size,this._updatingHandles.addPromise(this._enqueueTileFetch(i)),this._bitmapView.addChild(i),this.requestUpdate(),i}releaseTile(e){this._fetchQueue.abort(e.key.id),this._bitmapView.removeChild(e),e.once("detach",()=>e.destroy()),this.requestUpdate()}async fetchTile(e,i={}){return this.tilemapCache?this._fetchTileWithTilemapCache(e,i):this._fetchTileWithoutTilemapCache(e,i)}async _fetchTileWithoutTilemapCache(e,i={}){const{signal:t,resamplingLevel:r=0}=i;try{return await this._fetchImage(e,t)}catch(o){if(s(o))throw o;if(!this.resampling)return g(this._tileInfoView.tileInfo.size);if(r<3){const t=this._tileInfoView.getTileParentId(e.id);if(t){const s=new d(t),o=await this._fetchTileWithoutTilemapCache(s,{...i,resamplingLevel:r+1});return f(this._tileInfoView,o,s,e)}}return g(this._tileInfoView.tileInfo.size)}}async _fetchTileWithTilemapCache(e,i={}){const t=this.tilemapCache,{signal:o,resamplingLevel:l=0}=i,h=new d(0,0,0,0);let a,n=null;try{if(n=await t.fetchAvailabilityUpsample(e.level,e.row,e.col,h,{signal:o}),!this.resampling&&h.level!==e.level)return await r(i),g(this._tileInfoView.tileInfo.size);a=await this._fetchImage(h,o)}catch(p){if(s(p))throw p;if(this.resampling&&"unknown"===n&&l<3){const t=this._tileInfoView.getTileParentId(e.id);if(t){h.set(t);try{a=await this._fetchTileWithTilemapCache(h,{...i,resamplingLevel:l+1})}catch{}}}}return a?this.resampling?f(this._tileInfoView,a,h,e):a:g(this._tileInfoView.tileInfo.size)}async _enqueueTileFetch(e){if(!this._fetchQueue.has(e.key.id)){try{const i=await this._fetchQueue.push(e.key);e.bitmap.source=i,e.bitmap.width=this._tileInfoView.tileInfo.size[0],e.bitmap.height=this._tileInfoView.tileInfo.size[1],e.once("attach",()=>this.requestUpdate())}catch(i){s(i)||t.getLogger(this).error(i)}this.requestUpdate()}}async _fetchImage(e,i){return this.layer.fetchImageBitmapTile(e.level,e.row,e.col,{signal:i})}};e([o()],P.prototype,"resampling",null),e([o()],P.prototype,"tilemapCache",null),P=e([l("esri.views.2d.layers.TileLayerView2D")],P);const C=P;export{C as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import{makeHandle as i}from"../../../core/handleUtils.js";import t from"../../../core/Logger.js";import{isAbortError as s,waitTick as r}from"../../../core/promiseUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{equals as h}from"../../../geometry/support/spatialReferenceUtils.js";import{GraphicsCollection as a}from"../../../support/GraphicsCollection.js";import"../../../core/Error.js";import"../../../core/scheduling.js";import"../../../core/colorUtils.js";import"../../../config.js";import"../../../symbols/cim/defaultCIMValues.js";import"../../../symbols/cim/enums.js";import"../../../core/floatRGBA.js";import"../../../geometry/Extent.js";import"../../../geometry/Geometry.js";import"../../../geometry/Multipoint.js";import"../../../geometry/Point.js";import"../../../geometry/Polygon.js";import"../../../geometry/Polyline.js";import"../engine/webgl/definitions.js";import"../engine/webgl/animations/instructions.js";import"../../../core/mathUtils.js";import"../../../symbols/Font.js";import"../../../core/ObjectPool.js";import"../../../geometry/support/Axis.js";import"../../../geometry/support/TileClipper.js";import"../../../symbols/cim/effects/EffectAddControlPoints.js";import"../../../symbols/cim/effects/EffectArrow.js";import"../../../symbols/cim/effects/EffectBuffer.js";import"../../../symbols/cim/effects/EffectControlMeasureLine.js";import"../../../symbols/cim/effects/EffectCut.js";import"../../../symbols/cim/effects/EffectDashes.js";import"../../../symbols/cim/effects/EffectDonut.js";import"../../../symbols/cim/effects/EffectEnclosingPolygon.js";import"../../../symbols/cim/effects/EffectJog.js";import"../../../symbols/cim/effects/EffectMove.js";import"../../../symbols/cim/effects/EffectOffset.js";import"../../../symbols/cim/effects/EffectRadial.js";import"../../../symbols/cim/effects/EffectReverse.js";import"../../../symbols/cim/effects/EffectRotate.js";import"../../../symbols/cim/effects/EffectScale.js";import"../../../symbols/cim/effects/EffectSuppress.js";import"../../../symbols/cim/effects/EffectTaperedPolygon.js";import"../../../symbols/cim/effects/EffectWave.js";import"../../../symbols/cim/placements/PlacementAlongLineSameSize.js";import"../../../symbols/cim/placements/PlacementAtExtremities.js";import"../../../symbols/cim/placements/PlacementAtRatioPositions.js";import"../../../symbols/cim/placements/PlacementInsidePolygon.js";import"../../../symbols/cim/placements/PlacementOnLine.js";import"../../../symbols/cim/placements/PlacementOnVertices.js";import"../../../symbols/cim/placements/PlacementPolygonCenter.js";import"../../../symbols/cim/constants.js";import"../../../core/libs/gl-matrix-2/factories/vec2f32.js";import"../engine/webgl/alignmentUtils.js";import"../../../symbols/support/defaults.js";import"../../../symbols/cim/OverrideHelper.js";import"../../../layers/effects/EffectView.js";import"../../../core/Evented.js";import"../engine/transitions/FadeTransition.js";import"../engine/webgl/enums.js";import"../../../core/libs/gl-matrix-2/factories/vec4f32.js";import"../../webgl/enums.js";import"../engine/webgl/shaders/BackgroundPrograms.js";import"../../webgl/checkWebGLError.js";import"../engine/webgl/DefaultVertexAttributeLayouts.js";import"../engine/webgl/AFeatureTile.js";import"../engine/webgl/DisplayEntity.js";import"../engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"../engine/webgl/cpuMapped/MappedMesh.js";import"../engine/webgl/number.js";import"../engine/webgl/shaders/TileInfoPrograms.js";import"../../webgl/Texture.js";import"../../webgl/FBOAttachmentType.js";import"../engine/vectorTiles/style/StyleDefinition.js";import"../engine/vectorTiles/enums.js";import"../engine/webgl/shaders/BitBlitPrograms.js";import"../../../request.js";import"../../../core/urlUtils.js";import"../../../core/pbf.js";import"../engine/webgl/shaders/StencilPrograms.js";import"../engine/webgl/shaderGraph/techniques/TechniqueType.js";import"../engine/webgl/shaderGraph/techniques/shaders/BlendShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/OpacityShader.js";import"../engine/webgl/shaders/HighlightPrograms.js";import"../../webgl/FramebufferObject.js";import"../engine/webgl/meshing/SimpleMesh.js";import"../engine/webgl/PooledUint32Array.js";import"../engine/webgl/Profiler.js";import"../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"../../../Color.js";import"../engine/webgl/shaderGraph/techniques/animated/attributes.js";import"../engine/webgl/shaderGraph/techniques/shaders/constants.js";import"../engine/webgl/mesh/templates/templateUtils.js";import"../engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/dotDensity/DotDensityMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/ComplexFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/heatmap/HeatmapMeshWriter.js";import"../../../geometry/support/aaBoundingBox.js";import"../engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js";import"../engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js";import"../../../arcade/ArcadeDate.js";import"../../../intl/locale.js";import"luxon";import"../../../core/sql/UnknownTimeZone.js";import"../../../layers/support/fieldUtils.js";import"../../../time/constants.js";import"../engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js";import"../../webgl/renderState.js";import"../../3d/webgl-engine/core/shaderModules/glsl.js";import"../../webgl/testSVGPremultipliedAlpha.js";import"../../../chunks/pe.js";import"../engine/webgl/meshing/definitions.js";import"../engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"../LabelManager.js";import n from"./graphics/GraphicsView2D.js";import"../../../core/accessorSupport/watch.js";import"../../../core/accessorSupport/tracking/SimpleTrackingTarget.js";import"../../../chunks/earcut.js";import"../../../core/libs/gl-matrix-2/factories/vec3f32.js";import"../../../geometry/support/normalizeUtilsCommon.js";import"../../../geometry/SpatialReference.js";import"../../../geometry/support/Ellipsoid.js";import"../../../kernel.js";import"./support/util.js";import"../navigation/MapViewNavigation.js";import"../../../core/asyncUtils.js";import"../../../core/support/UpdatingHandles.js";import"../engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../../../core/unitUtils.js";import"../../../geometry/ellipsoidUtils.js";import"../../../geometry/projection/projectors.js";import"../engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../../../geometry/support/geodesicConstants.js";import{BitmapTileLayerView2D as p}from"./BitmapTileLayerView2D.js";import{LayerView2DMixin as m}from"./LayerView2D.js";import c from"./graphics/HighlightGraphicContainer.js";import{createBlankImage as g,resampleImage as f}from"./support/imageUtils.js";import u from"../tiling/TileInfoView.js";import d from"../tiling/TileKey.js";import j from"../tiling/TileQueue.js";import y from"../tiling/TileStrategy.js";import w from"../../layers/LayerView.js";import b from"../../layers/RefreshableLayerView.js";import{getHighlightGraphics as _}from"../../layers/support/highlightUtils.js";import{isMapServiceLayerView as T,MapServiceLayerViewHelper as G}from"../../layers/support/MapServiceLayerViewHelper.js";import{createQueryGeometry as q}from"../../support/drapedUtils.js";import{defaultHighlightName as V}from"../../support/HighlightDefaults.js";import{TaskPriority as v}from"../../support/Scheduler.js";const I=[0,0];let P=class extends(b(p(m(w)))){constructor(){super(...arguments),this._fetchQueue=null,this._highlightGraphics=new a,this._highlightView=null,this._popupHighlightHelper=null,this._tileStrategy=null,this.layer=null}get resampling(){return!("resampling"in this.layer)||!1!==this.layer.resampling}get tilemapCache(){return"tilemapCache"in this.layer?this.layer.tilemapCache:null}update(e){this._fetchQueue.pause(),this._fetchQueue.state=e.state,this._tileStrategy.update(e),this._fetchQueue.resume(),this._highlightView?.processUpdate(e)}attach(){const e="tileServers"in this.layer?this.layer.tileServers:null,i=this.tilemapCache;if(this._tileInfoView=new u(this.layer.tileInfo,this.layer.fullExtent,i?.effectiveMinLOD,i?.effectiveMaxLOD),this._fetchQueue=new j({tileInfoView:this._tileInfoView,concurrency:e&&10*e.length||10,process:(e,i)=>this.fetchTile(e,i),scheduler:this.scheduler,priority:v.MAPVIEW_FETCH_QUEUE}),this._tileStrategy=new y({cachePolicy:"keep",resampling:this.resampling,acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView}),T(this,this.layer)){const e=this._highlightView=new n({view:this.view,graphics:this._highlightGraphics,requestUpdateCallback:()=>this.requestUpdate(),container:new c(this.view.featuresTilingScheme),defaultPointSymbolEnabled:!1});this.container.addChild(this._highlightView.container),this._popupHighlightHelper=new G({createFetchPopupFeaturesQueryGeometry:(e,i)=>q(e,i,this.view),highlightGraphics:this._highlightGraphics,highlightGraphicUpdated:({graphic:i,property:t})=>e.graphicUpdateHandler({graphic:i,property:t}),layerView:this,updatingHandles:this._updatingHandles})}this.requestUpdate(),this.addAttachHandles(this._updatingHandles.add(()=>this.resampling,()=>{this.doRefresh()})),super.attach()}detach(){super.detach(),this._tileStrategy.destroy(),this._fetchQueue.clear(),this.container.removeAllChildren(),this._popupHighlightHelper?.destroy(),this._highlightView?.destroy(),this._fetchQueue=this._tileStrategy=this._tileInfoView=this._popupHighlightHelper=null}async fetchPopupFeaturesAtLocation(e,i){return this._popupHighlightHelper?this._popupHighlightHelper.fetchPopupFeaturesAtLocation(e,i):[]}highlight(e,t){const s=_(e);if(0===s.length)return i();const r=t?.name??V;return this._addHighlightGraphics(s,r),i(()=>!this.destroyed&&this._removeHighlightGraphics(s,r))}_processHighlight(){const e=this._getHighlights();this._highlightView?.setHighlight(e)}_addHighlightGraphics(e,i){this._highlightGraphics.addMany(e),this._addHighlights(e.map(e=>e.uid),i)}_removeHighlightGraphics(e,i){this._highlightGraphics.removeMany(e),this._removeHighlights(e.map(e=>e.uid),i)}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}supportsSpatialReference(e){return h(this.layer.tileInfo?.spatialReference,e)}async doRefresh(){if(this.attached){if(this.suspended)return this._tileStrategy.clear(),void this.requestUpdate();this._fetchQueue.reset(),this._tileStrategy.refresh(e=>this._updatingHandles.addPromise(this._enqueueTileFetch(e)))}}acquireTile(e){const i=this._bitmapView.createTile(e),t=i.bitmap;return[t.x,t.y]=this._tileInfoView.getTileCoords(I,i.key),t.resolution=this._tileInfoView.getTileResolution(i.key),[t.width,t.height]=this._tileInfoView.tileInfo.size,this._updatingHandles.addPromise(this._enqueueTileFetch(i)),this._bitmapView.addChild(i),this.requestUpdate(),i}releaseTile(e){this._fetchQueue.abort(e.key.id),this._bitmapView.removeChild(e),e.once("detach",()=>e.destroy()),this.requestUpdate()}async fetchTile(e,i={}){return this.tilemapCache?this._fetchTileWithTilemapCache(e,i):this._fetchTileWithoutTilemapCache(e,i)}async _fetchTileWithoutTilemapCache(e,i={}){const{signal:t,resamplingLevel:r=0}=i;try{return await this._fetchImage(e,t)}catch(o){if(s(o))throw o;if(!this.resampling)return g(this._tileInfoView.tileInfo.size);if(r<3){const t=this._tileInfoView.getTileParentId(e.id);if(t){const s=new d(t),o=await this._fetchTileWithoutTilemapCache(s,{...i,resamplingLevel:r+1});return f(this._tileInfoView,o,s,e)}}return g(this._tileInfoView.tileInfo.size)}}async _fetchTileWithTilemapCache(e,i={}){const t=this.tilemapCache,{signal:o,resamplingLevel:l=0}=i,h=new d(0,0,0,0);let a,n=null;try{if(n=await t.fetchAvailabilityUpsample(e.level,e.row,e.col,h,{signal:o}),!this.resampling&&h.level!==e.level)return await r(i),g(this._tileInfoView.tileInfo.size);a=await this._fetchImage(h,o)}catch(p){if(s(p))throw p;if(this.resampling&&"unknown"===n&&l<3){const t=this._tileInfoView.getTileParentId(e.id);if(t){h.set(t);try{a=await this._fetchTileWithTilemapCache(h,{...i,resamplingLevel:l+1})}catch{}}}}return a?this.resampling?f(this._tileInfoView,a,h,e):a:g(this._tileInfoView.tileInfo.size)}async _enqueueTileFetch(e){if(!this._fetchQueue.has(e.key.id)){try{const i=await this._fetchQueue.push(e.key);e.bitmap.source=i,e.bitmap.width=this._tileInfoView.tileInfo.size[0],e.bitmap.height=this._tileInfoView.tileInfo.size[1],e.once("attach",()=>this.requestUpdate())}catch(i){s(i)||t.getLogger(this).error(i)}this.requestUpdate()}}async _fetchImage(e,i){return this.layer.fetchImageBitmapTile(e.level,e.row,e.col,{signal:i})}};e([o()],P.prototype,"resampling",null),e([o()],P.prototype,"tilemapCache",null),P=e([l("esri.views.2d.layers.TileLayerView2D")],P);const C=P;export{C as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{destroyMaybe as e}from"../../../../core/maybe.js";import{notDeepEqual as t}from"../../../../core/object.js";import{throwIfNotAbortError as s,throwIfAborted as r,after as i}from"../../../../core/promiseUtils.js";import{diff as a}from"../../../../core/accessorSupport/diffUtils.js";import{ignoreConnectionErrors as o}from"../../../../core/workers/utils.js";import n from"../../../../geometry/SpatialReference.js";import{MultiTileMeshData as c}from"../../engine/webgl/mesh/MultiTileMeshData.js";import{FeatureMeshFactory as h}from"../../engine/webgl/mesh/factories/FeatureMeshFactory.js";import{ResourceProxy as u}from"../../engine/webgl/mesh/factories/ResourceProxy.js";import{MeshWriterRegistry as p}from"../../engine/webgl/shaderGraph/techniques/mesh/MeshWriterRegistry.js";import{MatcherContext as g}from"../../engine/webgl/util/MatcherContext.js";import{ProcessorTileMessageQueue as y}from"./ProcessorTileMessageQueue.js";import{BinningStrategy as d}from"./processor/BinningStrategy.js";import{ClusterStrategy as _}from"./processor/ClusterStrategy.js";import{FeatureUpdateStrategy as l}from"./processor/FeatureUpdateStrategy.js";import{TrackStrategy as m}from"./processor/TrackStrategy.js";import{AttributeStore as f}from"./support/AttributeStore.js";import{ComputedAttributeStorage as b}from"./support/ComputedAttributeStorage.js";class w{constructor(e,t){this._connection=e,this._source=t,this._version=1,this._registry=new p,this._proxy=new u({fetch:(e,t)=>this._connection.layerView.fetch(e,t),fetchDictionary:(e,t)=>this._connection.layerView.fetchDictionary(e,t)}),this._attributeStore=new f({isLocal:!1,update:e=>o(this._connection.container.updateAttributeView(e))})}destroy(){this._proxy.destroy(),this._strategy?.destroy(),this._attributeStore.destroy()}get aggregateQueryEngine(){return this._strategy?.aggregateQueryEngine}get version(){return this._version}getDisplayFeatures(e){return this._strategy?this._strategy.getDisplayFeatures(e):{features:[],aggregates:[],tracks:[]}}getDisplayIds(e){const t={};return this._strategy?(this._strategy.displayMap(e,e=>e,(e,s,r)=>{t[r]=e}),t):t}getFeatureObjectIdsForAggregate(e){return this._strategy?this._strategy.getFeatureObjectIdsForAggregate(e):[]}onSubscribe(e){this._strategy?.onSubscribe(e)}onUnsubscribe(e){this._strategy?.onUnsubscribe(e)}requiresInvalidation(){return this._strategy?.requiresInvalidation()??!1}async update(e,s,r,i,o){const c=e.processor,u=t(this._schema?.storage,c.storage),p=t(this._schema?.mesh.properties,c.mesh.properties),y=t(this._schema?.mesh.factory,c.mesh.factory),d=t(this._schema?.mesh.strategy,c.mesh.strategy),_=S(this._schema?.expressionProperties,c.expressionProperties),l=_.some(e=>this._attributeStore.hasArcadeDependency(e)),m=_.some(e=>this._factory?.hasArcadeDependency(e)??!1),f=_.some(e=>this._strategy?.hasArcadeDependency(e))||this._strategy?.isAggregate&&l,w=m||f,I=p||y||d;if(!(u||I||(m||l||f))&&!i)return!1;has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] SymbolProcessor.update`,{changes:a(this._schema,c),schema:c}),this._schema=c;const x=n.fromJSON(this._source.service.outSpatialReference),v=new b({fields:this._source.metadata.fieldsIndex,spatialReference:x}),M={currentUser:c.mesh.properties.currentUser};if((u||I||l)&&(await this._attributeStore.update(c.storage,v,this._source.metadata,s),this._strategy?.invalidateAttributeData(j(c))),!i&&!I&&!w)return!1;(d||p||w)&&await this._updateStrategy(c.mesh.strategy,x,o,j(c),M),this._updateSortKey(v,"sortKey"in c.mesh.properties?c.mesh.properties.sortKey:null);const k="dictionary"===c.mesh.factory.symbology.type?c.mesh.factory.symbology.fieldMap:null,U=new g(v,this._proxy,r,this._registry,k);return(y||"dictionary"===c.mesh.factory.symbology.type)&&(this._factory=await h.create(U,c.mesh.factory)),this._version=s,!0}async applyOverrideUpdate(e){if(!this._strategy)return;const t=this._strategy.applyOverrideUpdate(e);for await(const r of t)try{await this._process(r)}catch(s){}}async updateChunks(){await this._doUpdateChunks(),this._strategy?.afterUpdateChunks()}async removeChunks(e){this._strategy?.removeChunks(e),this._attributeStore.incrementDisplayIdGeneration()}updateHighlight({highlights:e}){if(!this._strategy)return void this._attributeStore.setHighlight(e.map(({objectId:e,highlightFlags:t})=>({objectId:e,highlightFlags:t,displayId:-1})),e);const t=this._strategy.displayMap(e,({objectId:e})=>e,(e,{highlightFlags:t},s)=>({objectId:s,displayId:e,highlightFlags:t}));this._attributeStore.setHighlight(t,e)}invalidate(){this._strategy&&this._strategy.invalidate()}async _doUpdateChunks(){if(!this._strategy)return;const e=this._strategy.updateChunks(),t=[],r=new Map;for await(const a of e){let e=r.get(a.id);null==e&&(e=new y({concurrency:16,process:e=>this._process(e)}),r.set(a.id,e));const i=e.push(a).catch(e=>s(e));t.push(i)}try{await Promise.all(t)}catch(i){}has("esri-2d-update-debug")&&console.log("SendUpdates"),this._attributeStore.sendUpdates(),has("esri-2d-update-debug")&&console.log("SendUpdates.await")}async _updateStrategy(e,t,s,r,i){switch(this._strategy?.destroy(),e.type){case"feature":this._strategy=new l(this._source,this._attributeStore,r,i);break;case"binning":this._strategy=await d.create(e,t,this._source,this._attributeStore,r,i);break;case"cluster":this._strategy=await _.create(this._connection,e,t,this._source,this._attributeStore,r,i);break;case"track":this._strategy=await m.create(e,t,this._source,this._attributeStore,r,i)}for(const a of s)this._strategy.onSubscribe(a)}async _updateSortKey(t,s){if(this._sortInfo=e(this._sortInfo?.computed),null!=s){const e=s.byRenderer?null:await t.createComputedField(s);this._sortInfo={...s,computed:e}}}async _process(e){const t=e.subscription;if(has("esri-2d-update-debug")){const s=t.tile;console.debug(`Version[${this._version}] Tile[${s.key.id}, end=${e.end}] Processor._process`)}const s={currentUser:this._schema?.mesh.properties.currentUser};await this._fetchResources(e,s),r(t.signal);const i=await this._write(e,t.tile.createArcadeEvaluationOptions(j(this._schema)),s),a=t.tile.tileInfoView.getLODInfoAt(t.tile.key);r(t.signal);const{message:o,transferList:n}=i.serialize(a),c={objectIdMap:null,inner:e.createMessage(o,this._version,this._attributeStore.epoch)};if(this._schema?.mesh.properties.returnMeshObjectId){c.objectIdMap={};const t=e.reader?.getCursor();if(t)for(;t.next();)c.objectIdMap[t.getDisplayId()]=t.getObjectId()}if(r(t.signal),await this._connection.container.onMessage(c,{signal:t.signal,transferList:n}),this._attributeStore.sendUpdates(),has("esri-2d-update-debug")){const s=t.tile;console.debug(`Version[${this._version}] Tile[${s.key.id}, end=${e.end}] Processor._process.await`)}}async _fetchResources(e,t){await this._fetchMatcherResources(e),await this._fetchWriterResources(e,t)}async _fetchMatcherResources(e){if(e.reader)return this._factory.enqueueMatcherRequests(this._proxy,e.reader)}async _fetchWriterResources(e,t){if(!e.reader)return;const s=e.reader.getCursor(),r=e.subscription.tile.createArcadeEvaluationOptions(j(this._schema));for(;s.next();)this._factory.enqueueWriterRequests(this._proxy,s,r,t);await this._proxy.fetchEnqueuedResources()}async _write(e,t,s){const a=e.subscription.tile,o=e.reader?.getCursor(),n=o?.getSize()??0,h=a.tileInfoView.tileInfo.isWrappable,u=a.tileInfoView.tileInfo.spatialReference.isWGS84,p=new c(a.key,this._strategy.enablePixelBuffering,h,u,n);if(!o)return p;const g=a.createArcadeEvaluationOptions(j(this._schema));let y=0;for(;o.next();){++y%1e3||(await i(0),r(e.subscription));const n=this._getSortKeyValue(o,t);p.entityStart(o.getDisplayId(),n),this._factory.write(p,this._proxy,o,g,s,a.level),p.entityEnd()}return p}_getSortKeyValue(e,t){if(!this._sortInfo)return 0;const{computed:s,order:r,byRenderer:i}=this._sortInfo,a=i?this._factory.getSortKey(e,t):s?.read(e,t);return null==a||isNaN(a)?0:a*("asc"===r?-1:1)}}function S(e,t){const s=[];return e?.timeExtent?.start===t.timeExtent?.start&&e?.timeExtent?.end===t.timeExtent?.end||s.push("timeProperties"),s}function j(e){const{timeZone:t}=e?.mesh.properties??{},{timeExtent:s}=e?.expressionProperties??{};return{timeZone:t,timeExtent:s}}export{w as default};
5
+ import has from"../../../../core/has.js";import{destroyMaybe as e}from"../../../../core/maybe.js";import{notDeepEqual as t}from"../../../../core/object.js";import{throwIfNotAbortError as s,throwIfAborted as r,after as i}from"../../../../core/promiseUtils.js";import{diff as a}from"../../../../core/accessorSupport/diffUtils.js";import{ignoreConnectionErrors as o}from"../../../../core/workers/utils.js";import n from"../../../../geometry/SpatialReference.js";import{MultiTileMeshData as c}from"../../engine/webgl/mesh/MultiTileMeshData.js";import{FeatureMeshFactory as h}from"../../engine/webgl/mesh/factories/FeatureMeshFactory.js";import{ResourceProxy as u}from"../../engine/webgl/mesh/factories/ResourceProxy.js";import{MeshWriterRegistry as p}from"../../engine/webgl/shaderGraph/techniques/mesh/MeshWriterRegistry.js";import{MatcherContext as g}from"../../engine/webgl/util/MatcherContext.js";import{ProcessorTileMessageQueue as y}from"./ProcessorTileMessageQueue.js";import{BinningStrategy as d}from"./processor/BinningStrategy.js";import{ClusterStrategy as _}from"./processor/ClusterStrategy.js";import{FeatureUpdateStrategy as l}from"./processor/FeatureUpdateStrategy.js";import{TrackStrategy as m}from"./processor/TrackStrategy.js";import{AttributeStore as f}from"./support/AttributeStore.js";import{ComputedAttributeStorage as b}from"./support/ComputedAttributeStorage.js";class w{constructor(e,t){this._connection=e,this._source=t,this._version=1,this._registry=new p,this._proxy=new u({fetch:(e,t)=>this._connection.layerView.fetch(e,t),fetchDictionary:(e,t)=>this._connection.layerView.fetchDictionary(e,t)}),this._attributeStore=new f({isLocal:!1,update:e=>o(this._connection.container.updateAttributeView(e))})}destroy(){this._proxy.destroy(),this._strategy?.destroy(),this._attributeStore.destroy()}get aggregateQueryEngine(){return this._strategy?.aggregateQueryEngine}get version(){return this._version}getDisplayFeatures(e){return this._strategy?this._strategy.getDisplayFeatures(e):{features:[],aggregates:[],tracks:[]}}getDisplayIds(e){const t={};return this._strategy?(this._strategy.displayMap(e,e=>e,(e,s,r)=>{t[r]=e}),t):t}getFeatureObjectIdsForAggregate(e){return this._strategy?this._strategy.getFeatureObjectIdsForAggregate(e):[]}onSubscribe(e){this._strategy?.onSubscribe(e)}onUnsubscribe(e){this._strategy?.onUnsubscribe(e)}requiresInvalidation(){return this._strategy?.requiresInvalidation()??!1}async update(e,s,r,i,o){const c=e.processor,u=t(this._schema?.storage,c.storage),p=t(this._schema?.mesh.properties,c.mesh.properties),y=t(this._schema?.mesh.factory,c.mesh.factory),d=t(this._schema?.mesh.strategy,c.mesh.strategy),_=S(this._schema?.expressionProperties,c.expressionProperties),l=_.some(e=>this._attributeStore.hasArcadeDependency(e)),m=_.some(e=>this._factory?.hasArcadeDependency(e)??!1),f=_.some(e=>this._strategy?.hasArcadeDependency(e))||this._strategy?.isAggregate&&l,w=m||f,I=p||y||d;if(!(u||I||(m||l||f))&&!i)return!1;has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] SymbolProcessor.update`,{changes:a(this._schema,c),schema:c}),this._schema=c;const x=n.fromJSON(this._source.service.outSpatialReference),v=new b({fields:this._source.metadata.fieldsIndex,spatialReference:x}),M={currentUser:c.mesh.properties.currentUser};if((u||I||l)&&(await this._attributeStore.update(c.storage,v,this._source.metadata,s),this._strategy?.invalidateAttributeData(j(c))),!i&&!I&&!w)return!1;(d||p||w)&&await this._updateStrategy(c.mesh.strategy,x,o,j(c),M),this._updateSortKey(v,"sortKey"in c.mesh.properties?c.mesh.properties.sortKey:null);const k="dictionary"===c.mesh.factory.symbology.type?c.mesh.factory.symbology.fieldMap:null,U=new g(v,this._proxy,r,this._registry,k);return(y||"dictionary"===c.mesh.factory.symbology.type)&&(this._factory=await h.create(U,c.mesh.factory)),this._version=s,!0}async applyOverrideUpdate(e){if(!this._strategy)return;const t=this._strategy.applyOverrideUpdate(e);for await(const r of t)try{await this._process(r)}catch(s){}}async updateChunks(){await this._doUpdateChunks(),this._strategy?.afterUpdateChunks()}async removeChunks(e){this._strategy?.removeChunks(e),this._attributeStore.incrementDisplayIdGeneration()}updateHighlight({highlights:e}){if(!this._strategy||!this._strategy.hasSubscribers)return void this._attributeStore.setHighlight(e.map(({objectId:e,highlightFlags:t})=>({objectId:e,highlightFlags:t,displayId:-1})),e);const t=this._strategy.displayMap(e,({objectId:e})=>e,(e,{highlightFlags:t},s)=>({objectId:s,displayId:e,highlightFlags:t}));this._attributeStore.setHighlight(t,e)}invalidate(){this._strategy&&this._strategy.invalidate()}async _doUpdateChunks(){if(!this._strategy)return;const e=this._strategy.updateChunks(),t=[],r=new Map;for await(const a of e){let e=r.get(a.id);null==e&&(e=new y({concurrency:16,process:e=>this._process(e)}),r.set(a.id,e));const i=e.push(a).catch(e=>s(e));t.push(i)}try{await Promise.all(t)}catch(i){}has("esri-2d-update-debug")&&console.log("SendUpdates"),this._attributeStore.sendUpdates(),has("esri-2d-update-debug")&&console.log("SendUpdates.await")}async _updateStrategy(e,t,s,r,i){switch(this._strategy?.destroy(),e.type){case"feature":this._strategy=new l(this._source,this._attributeStore,r,i);break;case"binning":this._strategy=await d.create(e,t,this._source,this._attributeStore,r,i);break;case"cluster":this._strategy=await _.create(this._connection,e,t,this._source,this._attributeStore,r,i);break;case"track":this._strategy=await m.create(e,t,this._source,this._attributeStore,r,i)}for(const a of s)this._strategy.onSubscribe(a)}async _updateSortKey(t,s){if(this._sortInfo=e(this._sortInfo?.computed),null!=s){const e=s.byRenderer?null:await t.createComputedField(s);this._sortInfo={...s,computed:e}}}async _process(e){const t=e.subscription;if(has("esri-2d-update-debug")){const s=t.tile;console.debug(`Version[${this._version}] Tile[${s.key.id}, end=${e.end}] Processor._process`)}const s={currentUser:this._schema?.mesh.properties.currentUser};await this._fetchResources(e,s),r(t.signal);const i=await this._write(e,t.tile.createArcadeEvaluationOptions(j(this._schema)),s),a=t.tile.tileInfoView.getLODInfoAt(t.tile.key);r(t.signal);const{message:o,transferList:n}=i.serialize(a),c={objectIdMap:null,inner:e.createMessage(o,this._version,this._attributeStore.epoch)};if(this._schema?.mesh.properties.returnMeshObjectId){c.objectIdMap={};const t=e.reader?.getCursor();if(t)for(;t.next();)c.objectIdMap[t.getDisplayId()]=t.getObjectId()}if(r(t.signal),await this._connection.container.onMessage(c,{signal:t.signal,transferList:n}),this._attributeStore.sendUpdates(),has("esri-2d-update-debug")){const s=t.tile;console.debug(`Version[${this._version}] Tile[${s.key.id}, end=${e.end}] Processor._process.await`)}}async _fetchResources(e,t){await this._fetchMatcherResources(e),await this._fetchWriterResources(e,t)}async _fetchMatcherResources(e){if(e.reader)return this._factory.enqueueMatcherRequests(this._proxy,e.reader)}async _fetchWriterResources(e,t){if(!e.reader)return;const s=e.reader.getCursor(),r=e.subscription.tile.createArcadeEvaluationOptions(j(this._schema));for(;s.next();)this._factory.enqueueWriterRequests(this._proxy,s,r,t);await this._proxy.fetchEnqueuedResources()}async _write(e,t,s){const a=e.subscription.tile,o=e.reader?.getCursor(),n=o?.getSize()??0,h=a.tileInfoView.tileInfo.isWrappable,u=a.tileInfoView.tileInfo.spatialReference.isWGS84,p=new c(a.key,this._strategy.enablePixelBuffering,h,u,n);if(!o)return p;const g=a.createArcadeEvaluationOptions(j(this._schema));let y=0;for(;o.next();){++y%1e3||(await i(0),r(e.subscription));const n=this._getSortKeyValue(o,t);p.entityStart(o.getDisplayId(),n),this._factory.write(p,this._proxy,o,g,s,a.level),p.entityEnd()}return p}_getSortKeyValue(e,t){if(!this._sortInfo)return 0;const{computed:s,order:r,byRenderer:i}=this._sortInfo,a=i?this._factory.getSortKey(e,t):s?.read(e,t);return null==a||isNaN(a)?0:a*("asc"===r?-1:1)}}function S(e,t){const s=[];return e?.timeExtent?.start===t.timeExtent?.start&&e?.timeExtent?.end===t.timeExtent?.end||s.push("timeProperties"),s}function j(e){const{timeZone:t}=e?.mesh.properties??{},{timeExtent:s}=e?.expressionProperties??{};return{timeZone:t,timeExtent:s}}export{w as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- class t{constructor(t){this.subscription=t,this.handledChunks=new Set}destroy(){}}class e{constructor(t,e,s){this._source=t,this._attributeStore=e,this._sqlOptions=s,this._sendStates=new Map}destroy(){}get enablePixelBuffering(){return!0}get isAggregate(){return!1}onSubscribe(t){const e=this.createState(t);this._sendStates.set(t.key.id,e),this.updateChunks()}onUnsubscribe(t){this._sendStates.get(t.key.id)?.destroy(),this._sendStates.delete(t.key.id)}requiresInvalidation(){return!1}invalidate(){const t=Array.from(this._sendStates.values());this._sendStates.clear();for(const e of t)e.destroy(),this.onSubscribe(e.subscription)}invalidateAttributeData(t){}hasArcadeDependency(t){return!1}getFeatureObjectIdsForAggregate(t){throw new Error("InternalError: AggregateId lookup not supported")}getDisplayIds(t){return this.displayMap(t,t=>t,t=>t)}getDisplayAndObjectIds(t){return this.displayMap(t,t=>t,(t,e,s)=>[t,s])}afterUpdateChunks(){}}export{e as AProcessorStrategy,t as ASendState};
5
+ class t{constructor(t){this.subscription=t,this.handledChunks=new Set}destroy(){}}class e{constructor(t,e,s){this._source=t,this._attributeStore=e,this._sqlOptions=s,this._sendStates=new Map}destroy(){}get enablePixelBuffering(){return!0}get isAggregate(){return!1}onSubscribe(t){const e=this.createState(t);this._sendStates.set(t.key.id,e),this.updateChunks()}onUnsubscribe(t){this._sendStates.get(t.key.id)?.destroy(),this._sendStates.delete(t.key.id)}get hasSubscribers(){return this._sendStates.size>0}requiresInvalidation(){return!1}invalidate(){const t=Array.from(this._sendStates.values());this._sendStates.clear();for(const e of t)e.destroy(),this.onSubscribe(e.subscription)}invalidateAttributeData(t){}hasArcadeDependency(t){return!1}getFeatureObjectIdsForAggregate(t){throw new Error("InternalError: AggregateId lookup not supported")}getDisplayIds(t){return this.displayMap(t,t=>t,t=>t)}getDisplayAndObjectIds(t){return this.displayMap(t,t=>t,(t,e,s)=>[t,s])}afterUpdateChunks(){}}export{e as AProcessorStrategy,t as ASendState};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../../core/Error.js";import has from"../../../../../core/has.js";import e from"../../../../../core/Logger.js";import{diff as i}from"../../../../../core/accessorSupport/diffUtils.js";import{collectExpressionDependencies as s}from"../../../../../support/ArcadeExpression.js";import{attributeStoreInitialSize as r,maxHighlightReasons as a,AttributeDataType as n}from"../../../engine/webgl/definitions.js";import{getDisplayIdTexel as o}from"../../../engine/webgl/DisplayId.js";import{getPixelArrayCtor as l}from"../../../engine/webgl/Utils.js";import{nanMagicNumber as h}from"../../../engine/webgl/shaderGraph/techniques/shaders/constants.js";import{createDebugLogger as d,DEBUG_ATTR_UPDATES as c}from"../../../engine/webgl/util/debug.js";import{DisplayIdGenerator as u}from"./DisplayIdGenerator.js";import p from"./FeatureFilterEvaluator.js";import{PixelType as g}from"../../../../webgl/enums.js";function _(t,e){if(!t||!e)return t;switch(e){case"radius":case"distance":return 2*t;case"diameter":case"width":return t;case"area":return Math.sqrt(t)}return t}const y=()=>e.getLogger("esri.views.layers.2d.features.support.AttributeStore"),m=d(c,y()),f={sharedArrayBuffer:has("esri-shared-array-buffer"),atomics:has("esri-atomics")};class b{constructor(t,e,i){this.size=0,this.texelSize=4,this.dirtyStart=0,this.dirtyEnd=0;const{pixelType:s,layout:r,textureOnly:a}=e;this.textureOnly=a||!1,this.pixelType=s,this.layout=r,this._resetRange(),this.size=t,this.isLocal=i,a||(this.data=this._initData(s,t))}get buffer(){return this.data?.buffer}unsetComponentAllTexels(t,e){const i=this.data;for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]&=~e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponentAllTexels(t,e){const i=this.data;for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]|=255&e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponent(t,e,i){const s=this.data;for(const r of i)s[r*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r)}setComponentTexel(t,e,i){this.data[i*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}unsetComponentTexel(t,e,i){this.data[i*this.texelSize+t]&=~e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}getData(t,e){const i=o(t);return this.data[i*this.texelSize+e]}setData(t,e,i){const s=o(t),r=1<<e;0!==(this.layout&r)?null!=this.data&&(this.data[s*this.texelSize+e]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)):y().error("mapview-attributes-store","Tried to set a value for a texel's readonly component")}expand(t){if(this.size=t,!this.textureOnly){const e=this._initData(this.pixelType,t),i=this.data;e.set(i),this.data=e}}toMessage(){const t=this.dirtyStart,e=this.dirtyEnd,i=this.texelSize;if(t>e)return null;this._resetRange();const s=!this.isLocal,r=this.pixelType,a=this.layout,n=this.data;return{start:t,end:e,data:s&&n.slice(t*i,(e+1)*i)||null,pixelType:r,layout:a}}_initData(t,e){const i=ArrayBuffer,s=l(t),r=new s(new i(e*e*4*s.BYTES_PER_ELEMENT));for(let a=0;a<r.length;a+=4)r[a+1]=255;return r}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}}class x{constructor(t){this._client=t,this._filters=[],this._blocks=new Array,this._attributeComputeInfo=null,this._abortController=new AbortController,this._size=r,this._idsToHighlight=new Map,this._arcadeDependencies=new Set,this._initialized=!1,this.version=0,this._idGenerator=new u,this._epoch=1}destroy(){this._abortController.abort()}_initialize(){if(null!=this._blockDescriptors)return;const t=g.FLOAT;m(`Creating AttributeStore ${f.sharedArrayBuffer?"with":"without"} shared memory`),this._blockDescriptors=[{pixelType:g.UNSIGNED_BYTE,layout:1},{pixelType:g.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:g.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:g.FLOAT,layout:15}],this._blocks=this._blockDescriptors.map(()=>null)}get hasHighlight(){return this._idsToHighlight.size>0}createDisplayIdForObjectId(t){return this._idGenerator.createIdForObjectId(t)}releaseDisplayIdForObjectId(t){return this._idGenerator.releaseIdForObjectId(t)}getDisplayIdForObjectId(t){return this._idGenerator.getDisplayIdForObjectId(t)}incrementDisplayIdGeneration(){this._idGenerator.incrementGeneration()}hasArcadeDependency(t){return this._arcadeDependencies.has(t)}releaseAllIds(){this._idGenerator.releaseAll()}async update(t,e,s,r=0){const a=i(this._schema,t);if(this.version=r,a&&(has("esri-2d-update-debug")&&console.debug(`Version[${r}] AttributeStore.update`,{changed:a}),this._schema=t,this._attributeComputeInfo=null,this._initialize(),null!=t))if(s&&(this._filters=await Promise.all(t.filters.map(t=>t?p.create({geometryType:s.geometryType,hasM:!1,hasZ:!1,timeInfo:s.timeInfo,fieldsIndex:s.fieldsIndex,spatialReference:s.outSpatialReference,filterJSON:t}):null))),"multi"!==t.type)this._attributeComputeInfo={type:"feature",map:new Map},await Promise.all(t.bindings.map(async t=>{const i=await this._bind(e,t);this._updateReferences(i)}));else{this._attributeComputeInfo={type:"multi",keyField:t.keyField,map:new Map};for(const i in t.bindings){const s=t.bindings[i];await Promise.all(s.map(async t=>{const s=await this._bind(e,t,parseInt(i,10));this._updateReferences(s)}))}}}setHighlight(t,e){const i=this._getBlock(0);i.unsetComponentAllTexels(0,(1<<a)-1);for(const{displayId:s,highlightFlags:r}of t){if(null==s)continue;const t=o(s);i.setComponent(0,r,[t])}this._idsToHighlight.clear();for(const{objectId:s,highlightFlags:r}of t)this._idsToHighlight.set(s,r);for(const{objectId:s,highlightFlags:r}of e)this._idsToHighlight.set(s,r)}setData(t,e,i,s){const r=o(t);this._ensureSizeForTexel(r),this._getBlock(e).setData(t,i,s)}getData(t,e,i){return this._getBlock(e).getData(t,i)}getHighlightFlags(t){return this._idsToHighlight.get(t)||0}unsetAttributeData(t){const e=o(t);this._getBlock(0).setData(e,0,0)}setAttributeData(t,e,i,s){const r=o(t);this._ensureSizeForTexel(r),this._getBlock(0).setData(r,0,this.getFilterFlags(e,s));const a=this._attributeComputeInfo,l=1,d=4;let c=null;a&&(c="multi"===a.type?a.map.get(e.readAttribute(a.keyField)):a.map,c?.size&&c.forEach((t,s)=>{const a=s*l%d,o=Math.floor(s*l/d),c=this._getBlock(o+n.VV);let u=t.field?.read(e,i);t.valueRepresentation&&(u=_(u,t.valueRepresentation));(null===u||isNaN(u)||u===1/0||u===-1/0)&&(u=h),c.setData(r,a,u)}))}get epoch(){return this._epoch}sendUpdates(){const t=this._blocks.map(t=>null!=t?t.toMessage():null),e=this._getInitArgs();has("esri-2d-log-updating")&&console.log("AttributeStore: _doSendUpdate.start"),this._client.update({initArgs:e,blockData:t,version:this.version,sendUpdateEpoch:this._epoch}),this._epoch+=1,has("esri-2d-log-updating")&&console.log("AttributeStore: _doSendUpdate.end")}_ensureSizeForTexel(t){for(;t>=this._size*this._size;)if(this._expand())return}async _bind(t,e,i){const s=await t.createComputedField(e),{valueRepresentation:r}=e,a=this._attributeComputeInfo;if("multi"===a.type){const t=a.map.get(i)??new Map;t.set(e.binding,{field:s,valueRepresentation:r}),a.map.set(i,t)}else a.map.set(e.binding,{field:s,valueRepresentation:r});return s}_getInitArgs(){return this._initialized?null:(this._initialized=!0,this._getBlock(n.Animation),this._getBlock(n.GPGPU),this._getBlock(n.LocalTimeOrigin),{blockSize:this._size,blockDescriptors:this._blocks.map(t=>null!=t?{textureOnly:t.textureOnly,buffer:t.buffer,pixelType:t.pixelType}:null)})}_getBlock(t){const e=this._blocks[t];if(null!=e)return e;m(`Initializing AttributeBlock at index ${t}`);const i=new b(this._size,this._blockDescriptors[t],this._client.isLocal);return this._blocks[t]=i,this._initialized=!1,i}_expand(){if(this._size<this._schema.capabilities.maxTextureSize){const t=this._size<<=1;m("Expanding block size to",t,this._blocks);for(const e of this._blocks)e?.expand(t);return this._initialized=!1,this._size=t,0}return y().error(new t("mapview-limitations","Maximum number of onscreen features exceeded.")),-1}_updateReferences(t){s(this._arcadeDependencies,t)}isVisible(t){return!!(this._getBlock(0).getData(t,0)&1<<a)}getFilterFlags(t,e){let i=0;for(let r=0;r<this._filters.length;r++){const s=!!(1<<r),a=this._filters[r];i|=(!s||null==a||a.check(t,e)?1:0)<<r}let s=0;if(this._idsToHighlight.size){const e=t.getObjectId();s=this.getHighlightFlags(e)}return i<<a|s}}export{x as AttributeStore,_ as getVisualVariableSizeValueRepresentationRatio};
5
+ import t from"../../../../../core/Error.js";import has from"../../../../../core/has.js";import e from"../../../../../core/Logger.js";import{diff as i}from"../../../../../core/accessorSupport/diffUtils.js";import{collectExpressionDependencies as s}from"../../../../../support/ArcadeExpression.js";import{attributeStoreInitialSize as r,maxHighlightReasons as a,AttributeDataType as n}from"../../../engine/webgl/definitions.js";import{getDisplayIdTexel as o}from"../../../engine/webgl/DisplayId.js";import{getPixelArrayCtor as l}from"../../../engine/webgl/Utils.js";import{nanMagicNumber as h}from"../../../engine/webgl/shaderGraph/techniques/shaders/constants.js";import{createDebugLogger as d,DEBUG_ATTR_UPDATES as c}from"../../../engine/webgl/util/debug.js";import{DisplayIdGenerator as u}from"./DisplayIdGenerator.js";import p from"./FeatureFilterEvaluator.js";import{PixelType as g}from"../../../../webgl/enums.js";function _(t,e){if(!t||!e)return t;switch(e){case"radius":case"distance":return 2*t;case"diameter":case"width":return t;case"area":return Math.sqrt(t)}return t}const y=()=>e.getLogger("esri.views.layers.2d.features.support.AttributeStore"),m=d(c,y()),f={sharedArrayBuffer:has("esri-shared-array-buffer"),atomics:has("esri-atomics")};class b{constructor(t,e,i){this.size=0,this.texelSize=4,this.dirtyStart=0,this.dirtyEnd=0;const{pixelType:s,layout:r,textureOnly:a}=e;this.textureOnly=a||!1,this.pixelType=s,this.layout=r,this._resetRange(),this.size=t,this.isLocal=i,a||(this.data=this._initData(s,t))}get buffer(){return this.data?.buffer}unsetComponentAllTexels(t,e){const i=this.data;for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]&=~e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponentAllTexels(t,e){const i=this.data;for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]|=255&e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponent(t,e,i){const s=this.data;for(const r of i)s[r*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r)}setComponentTexel(t,e,i){this.data[i*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}unsetComponentTexel(t,e,i){this.data[i*this.texelSize+t]&=~e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}getData(t,e){const i=o(t);return this.data[i*this.texelSize+e]}setData(t,e,i){const s=o(t),r=1<<e;0!==(this.layout&r)?null!=this.data&&(this.data[s*this.texelSize+e]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)):y().error("mapview-attributes-store","Tried to set a value for a texel's readonly component")}expand(t){if(this.size=t,!this.textureOnly){const e=this._initData(this.pixelType,t),i=this.data;e.set(i),this.data=e}}toMessage(){const t=this.dirtyStart,e=this.dirtyEnd,i=this.texelSize;if(t>e)return null;this._resetRange();const s=!this.isLocal,r=this.pixelType,a=this.layout,n=this.data;return{start:t,end:e,data:s&&n.slice(t*i,(e+1)*i)||null,pixelType:r,layout:a}}_initData(t,e){const i=ArrayBuffer,s=l(t),r=new s(new i(e*e*4*s.BYTES_PER_ELEMENT));for(let a=0;a<r.length;a+=4)r[a+1]=255;return r}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}}class x{constructor(t){this._client=t,this._filters=[],this._blocks=new Array,this._attributeComputeInfo=null,this._abortController=new AbortController,this._size=r,this._idsToHighlight=new Map,this._arcadeDependencies=new Set,this._initialized=!1,this.version=0,this._idGenerator=new u,this._epoch=1}destroy(){this._abortController.abort()}_initialize(){if(null!=this._blockDescriptors)return;const t=g.FLOAT;m(`Creating AttributeStore ${f.sharedArrayBuffer?"with":"without"} shared memory`),this._blockDescriptors=[{pixelType:g.UNSIGNED_BYTE,layout:1},{pixelType:g.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:g.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:g.FLOAT,layout:15}],this._blocks=this._blockDescriptors.map(()=>null)}get hasHighlight(){return this._idsToHighlight.size>0}createDisplayIdForObjectId(t){return this._idGenerator.createIdForObjectId(t)}releaseDisplayIdForObjectId(t){return this._idGenerator.releaseIdForObjectId(t)}getDisplayIdForObjectId(t){return this._idGenerator.getDisplayIdForObjectId(t)}incrementDisplayIdGeneration(){this._idGenerator.incrementGeneration()}hasArcadeDependency(t){return this._arcadeDependencies.has(t)}releaseAllIds(){this._idGenerator.releaseAll()}async update(t,e,s,r=0){const a=i(this._schema,t);if(this.version=r,a&&(has("esri-2d-update-debug")&&console.debug(`Version[${r}] AttributeStore.update`,{changed:a}),this._schema=t,this._attributeComputeInfo=null,this._initialize(),null!=t))if(s&&(this._filters=await Promise.all(t.filters.map(t=>t?p.create({geometryType:s.geometryType,hasM:!1,hasZ:!1,timeInfo:s.timeInfo,fieldsIndex:s.fieldsIndex,spatialReference:s.outSpatialReference,filterJSON:t}):null))),"multi"!==t.type)this._attributeComputeInfo={type:"feature",map:new Map},await Promise.all(t.bindings.map(async t=>{const i=await this._bind(e,t);this._updateReferences(i)}));else{this._attributeComputeInfo={type:"multi",keyField:t.keyField,map:new Map};for(const i in t.bindings){const s=t.bindings[i];await Promise.all(s.map(async t=>{const s=await this._bind(e,t,parseInt(i,10));this._updateReferences(s)}))}}}setHighlight(t,e){let i=null;for(const{displayId:s,highlightFlags:r}of t){if(null==s||-1===s)continue;i||(i=this._getBlock(0),i.unsetComponentAllTexels(0,(1<<a)-1));const t=o(s);i.setComponent(0,r,[t])}this._idsToHighlight.clear();for(const{objectId:s,highlightFlags:r}of t)this._idsToHighlight.set(s,r);for(const{objectId:s,highlightFlags:r}of e)this._idsToHighlight.set(s,r)}setData(t,e,i,s){const r=o(t);this._ensureSizeForTexel(r),this._getBlock(e).setData(t,i,s)}getData(t,e,i){return this._getBlock(e).getData(t,i)}getHighlightFlags(t){return this._idsToHighlight.get(t)||0}unsetAttributeData(t){const e=o(t);this._getBlock(0).setData(e,0,0)}setAttributeData(t,e,i,s){const r=o(t);this._ensureSizeForTexel(r),this._getBlock(0).setData(r,0,this.getFilterFlags(e,s));const a=this._attributeComputeInfo,l=1,d=4;let c=null;a&&(c="multi"===a.type?a.map.get(e.readAttribute(a.keyField)):a.map,c?.size&&c.forEach((t,s)=>{const a=s*l%d,o=Math.floor(s*l/d),c=this._getBlock(o+n.VV);let u=t.field?.read(e,i);t.valueRepresentation&&(u=_(u,t.valueRepresentation));(null===u||isNaN(u)||u===1/0||u===-1/0)&&(u=h),c.setData(r,a,u)}))}get epoch(){return this._epoch}sendUpdates(){const t=this._blocks.map(t=>null!=t?t.toMessage():null),e=this._getInitArgs();has("esri-2d-log-updating")&&console.log("AttributeStore: _doSendUpdate.start"),this._client.update({initArgs:e,blockData:t,version:this.version,sendUpdateEpoch:this._epoch}),this._epoch+=1,has("esri-2d-log-updating")&&console.log("AttributeStore: _doSendUpdate.end")}_ensureSizeForTexel(t){for(;t>=this._size*this._size;)if(this._expand())return}async _bind(t,e,i){const s=await t.createComputedField(e),{valueRepresentation:r}=e,a=this._attributeComputeInfo;if("multi"===a.type){const t=a.map.get(i)??new Map;t.set(e.binding,{field:s,valueRepresentation:r}),a.map.set(i,t)}else a.map.set(e.binding,{field:s,valueRepresentation:r});return s}_getInitArgs(){return this._initialized?null:(this._initialized=!0,this._getBlock(n.Animation),this._getBlock(n.GPGPU),this._getBlock(n.LocalTimeOrigin),{blockSize:this._size,blockDescriptors:this._blocks.map(t=>null!=t?{textureOnly:t.textureOnly,buffer:t.buffer,pixelType:t.pixelType}:null)})}_getBlock(t){const e=this._blocks[t];if(null!=e)return e;m(`Initializing AttributeBlock at index ${t}`);const i=new b(this._size,this._blockDescriptors[t],this._client.isLocal);return this._blocks[t]=i,this._initialized=!1,i}_expand(){if(this._size<this._schema.capabilities.maxTextureSize){const t=this._size<<=1;m("Expanding block size to",t,this._blocks);for(const e of this._blocks)e?.expand(t);return this._initialized=!1,this._size=t,0}return y().error(new t("mapview-limitations","Maximum number of onscreen features exceeded.")),-1}_updateReferences(t){s(this._arcadeDependencies,t)}isVisible(t){return!!(this._getBlock(0).getData(t,0)&1<<a)}getFilterFlags(t,e){let i=0;for(let r=0;r<this._filters.length;r++){const s=!!(1<<r),a=this._filters[r];i|=(!s||null==a||a.check(t,e)?1:0)<<r}let s=0;if(this._idsToHighlight.size){const e=t.getObjectId();s=this.getHighlightFlags(e)}return i<<a|s}}export{x as AttributeStore,_ as getVisualVariableSizeValueRepresentationRatio};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- export{Stage}from"./engine/Stage.js";export{LabelManager}from"./LabelManager.js";export{default as GraphicsView2D}from"./layers/graphics/GraphicsView2D.js";export{default as GraphicContainer}from"./layers/graphics/GraphicContainer.js";export{default as MapViewNavigation}from"./navigation/MapViewNavigation.js";export{default as MagnifierView2D}from"./magnifier/MagnifierView2D.js";export{default as GridView2D}from"./grid/GridView2D.js";
5
+ export{Stage}from"./engine/Stage.js";export{ChildStage,ParentStage}from"./engine/ParentChildStage.js";export{LabelManager}from"./LabelManager.js";export{default as GraphicsView2D}from"./layers/graphics/GraphicsView2D.js";export{default as GraphicContainer}from"./layers/graphics/GraphicContainer.js";export{default as MapViewNavigation}from"./navigation/MapViewNavigation.js";export{default as MagnifierView2D}from"./magnifier/MagnifierView2D.js";export{default as GridView2D}from"./grid/GridView2D.js";
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import s from"../../../core/Accessor.js";import{createTask as i}from"../../../core/asyncUtils.js";import t from"../../../core/Collection.js";import a from"../../../core/Error.js";import{makeHandle as n}from"../../../core/handleUtils.js";import"../../../core/has.js";import r from"../../../core/Logger.js";import{removeMaybe as o,destroyMaybe as l,abortMaybe as c}from"../../../core/maybe.js";import{createAbortError as d,isAborted as h,onAbort as w,createResolver as y}from"../../../core/promiseUtils.js";import{schedule as m}from"../../../core/scheduling.js";import{property as u}from"../../../core/accessorSupport/decorators/property.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";const V="analyses-owner-handles";var p,A;!function(e){e[e.PENDING=0]="PENDING",e[e.CREATED=1]="CREATED"}(p||(p={})),function(e){e[e.ADDED=0]="ADDED",e[e.REMOVED=1]="REMOVED"}(A||(A={}));let v=class extends s{constructor(e){super(e),this._allAnalysisViews=new t,this._creatingViewCount=0,this._items=new Map,this._scheduledUpdateHandle=null,this._attachedToViewResolver=f(),this._analysisModules={"area-measurement":{module:null},dimension:{module:null},"direct-line-measurement":{module:null},"line-of-sight":{module:null},slice:{module:null},viewshed:{module:null}},this._emitOnView=(e,s)=>this.view.emit(e,s)}destroy(){this._disconnectOwners(),this._attachedToViewResolver.reject(d("AnalysisViewManager was destroyed"))}attach(){this._connectOwners(),this._attachedToViewResolver.resolve()}detach(){this._disconnectOwners(),this._attachedToViewResolver.reject(d()),this._attachedToViewResolver=f()}get updating(){return!this.view.ready||0!==this._creatingViewCount||this._allAnalysisViews.some(e=>e.updating)}get testInfo(){}async whenAnalysisView(e){await this._attachedToViewResolver.promise;const s=this._items.get(e);if(null==s||s.state.list===A.REMOVED){throw new a("AnalysisViewManager:no-analysisview-for-analysis","The analysis has not been added to view.analyses",{analysis:e})}return s.createAnalysisViewTask.promise}_connectOwners(){this.addHandles(this._connectAnalysesCollection(this.view.analyses),V)}_disconnectOwners(){this.removeHandles(V),this._update(),this._creatingViewCount=0}_connectAnalysesCollection(e){for(const t of e)this._addAnalysis(t);const s=e.on("after-add",e=>this._addAnalysis(e.item)),i=e.on("after-remove",e=>this._removeAnalysis(e.item));return n(()=>{s.remove(),i.remove();for(const s of e)this._removeAnalysis(s)})}_addAnalysis(e){const s=this._items.get(e);if(null==s){const s={state:{view:p.PENDING,list:A.ADDED},analysis:e,view:null,createAnalysisViewTask:null};this._items.set(e,s),s.createAnalysisViewTask=i(i=>this._createAnalysisViewPromise(s,i).then(s=>(this._emitOnView("analysis-view-create",{analysis:e,analysisView:s}),s),s=>{throw this._emitOnView("analysis-view-create-error",{analysis:e,error:s}),s}))}else s.state.list=A.ADDED}_removeAnalysis(e){const s=this._items.get(e);null!=s?(s.state.list=A.REMOVED,this._scheduleUpdate()):r.getLogger(this).error("Trying to remove analysis which was not added")}_scheduleUpdate(){null==this._scheduledUpdateHandle&&(this._scheduledUpdateHandle=m(()=>this._update()))}_update(){this._scheduledUpdateHandle=o(this._scheduledUpdateHandle),this._items.forEach(e=>{if(e.state.list!==A.REMOVED)return;const{analysis:s,view:i}=e;switch(this._items.delete(s),e.state.view){case p.PENDING:e.createAnalysisViewTask=c(e.createAnalysisViewTask);break;case p.CREATED:null!=i&&(this._allAnalysisViews.remove(i),e.view=l(i),e.createAnalysisViewTask=null,this._emitOnView("analysis-view-destroy",{analysis:s,analysisView:i}))}})}async _createAnalysisViewPromise(e,s){const i=e.analysis,t=i.type,a=this._analysisModules[t];if(this._creatingViewCount+=1,null==a.module)try{a.module=await this._loadAnalysisModule(t)}catch(o){throw this._creatingViewCount-=1,o}if(h(s))throw this._creatingViewCount-=1,d("AnalysisView creation aborted");const n=new a.module.default({analysis:i,view:this.view});let r=!0;w(s,()=>{r&&this._destroyAnalysisView(i,n)});try{await n.when()}catch(o){throw r=!1,this._destroyAnalysisView(i,n),o}if(h(s))throw d();return r=!1,e.view=n,e.state.view=p.CREATED,this._allAnalysisViews.add(n),this._creatingViewCount-=1,n}_destroyAnalysisView(e,s){s.destroyed||(this._creatingViewCount-=1,s.destroy(),this._emitOnView("analysis-view-destroy",{analysis:e,analysisView:s}))}_loadAnalysisModule(e){switch(e){case"area-measurement":return import("./AreaMeasurementAnalysisView3D.js");case"dimension":return import("./DimensionAnalysisView3D.js");case"direct-line-measurement":return import("./DirectLineMeasurementAnalysisView3D.js");case"line-of-sight":return import("./LineOfSightAnalysisView3D.js");case"slice":return import("./SliceAnalysisView3D.js");case"viewshed":return import("./ViewshedAnalysisView3D.js")}}};function f(){const e=y();return e.promise.catch(()=>{}),e}e([u()],v.prototype,"updating",null),e([u({constructOnly:!0})],v.prototype,"view",void 0),e([u()],v.prototype,"_allAnalysisViews",void 0),e([u()],v.prototype,"_creatingViewCount",void 0),v=e([_("esri.views.3d.analysis.AnalysisViewManager3D")],v);const D=v;export{D as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import s from"../../../core/Accessor.js";import{createTask as i}from"../../../core/asyncUtils.js";import t from"../../../core/Collection.js";import a from"../../../core/Error.js";import{makeHandle as n}from"../../../core/handleUtils.js";import"../../../core/has.js";import r from"../../../core/Logger.js";import{removeMaybe as o,destroyMaybe as l,abortMaybe as c}from"../../../core/maybe.js";import{createAbortError as d,isAborted as h,onAbort as w,createResolver as m}from"../../../core/promiseUtils.js";import{schedule as u}from"../../../core/scheduling.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";const V="analyses-owner-handles";var p,A;!function(e){e[e.PENDING=0]="PENDING",e[e.CREATED=1]="CREATED"}(p||(p={})),function(e){e[e.ADDED=0]="ADDED",e[e.REMOVED=1]="REMOVED"}(A||(A={}));let v=class extends s{constructor(e){super(e),this._allAnalysisViews=new t,this._creatingViewCount=0,this._items=new Map,this._scheduledUpdateHandle=null,this._attachedToViewResolver=f(),this._analysisModules={"area-measurement":{module:null},dimension:{module:null},"direct-line-measurement":{module:null},"line-of-sight":{module:null},slice:{module:null},viewshed:{module:null},"volume-measurement":{module:null}},this._emitOnView=(e,s)=>this.view.emit(e,s)}destroy(){this._disconnectOwners(),this._attachedToViewResolver.reject(d("AnalysisViewManager was destroyed"))}attach(){this._connectOwners(),this._attachedToViewResolver.resolve()}detach(){this._disconnectOwners(),this._attachedToViewResolver.reject(d()),this._attachedToViewResolver=f()}get updating(){return!this.view.ready||0!==this._creatingViewCount||this._allAnalysisViews.some(e=>e.updating)}get testInfo(){}async whenAnalysisView(e){await this._attachedToViewResolver.promise;const s=this._items.get(e);if(null==s||s.state.list===A.REMOVED){throw new a("AnalysisViewManager:no-analysisview-for-analysis","The analysis has not been added to view.analyses",{analysis:e})}return s.createAnalysisViewTask.promise}_connectOwners(){this.addHandles(this._connectAnalysesCollection(this.view.analyses),V)}_disconnectOwners(){this.removeHandles(V),this._update(),this._creatingViewCount=0}_connectAnalysesCollection(e){for(const t of e)this._addAnalysis(t);const s=e.on("after-add",e=>this._addAnalysis(e.item)),i=e.on("after-remove",e=>this._removeAnalysis(e.item));return n(()=>{s.remove(),i.remove();for(const s of e)this._removeAnalysis(s)})}_addAnalysis(e){const s=this._items.get(e);if(null==s){const s={state:{view:p.PENDING,list:A.ADDED},analysis:e,view:null,createAnalysisViewTask:null};this._items.set(e,s),s.createAnalysisViewTask=i(i=>this._createAnalysisViewPromise(s,i).then(s=>(this._emitOnView("analysis-view-create",{analysis:e,analysisView:s}),s),s=>{throw this._emitOnView("analysis-view-create-error",{analysis:e,error:s}),s}))}else s.state.list=A.ADDED}_removeAnalysis(e){const s=this._items.get(e);null!=s?(s.state.list=A.REMOVED,this._scheduleUpdate()):r.getLogger(this).error("Trying to remove analysis which was not added")}_scheduleUpdate(){null==this._scheduledUpdateHandle&&(this._scheduledUpdateHandle=u(()=>this._update()))}_update(){this._scheduledUpdateHandle=o(this._scheduledUpdateHandle),this._items.forEach(e=>{if(e.state.list!==A.REMOVED)return;const{analysis:s,view:i}=e;switch(this._items.delete(s),e.state.view){case p.PENDING:e.createAnalysisViewTask=c(e.createAnalysisViewTask);break;case p.CREATED:null!=i&&(this._allAnalysisViews.remove(i),e.view=l(i),e.createAnalysisViewTask=null,this._emitOnView("analysis-view-destroy",{analysis:s,analysisView:i}))}})}async _createAnalysisViewPromise(e,s){const i=e.analysis,t=i.type,a=this._analysisModules[t];if(this._creatingViewCount+=1,null==a.module)try{a.module=await this._loadAnalysisModule(t)}catch(o){throw this._creatingViewCount-=1,o}if(h(s))throw this._creatingViewCount-=1,d("AnalysisView creation aborted");const n=new a.module.default({analysis:i,view:this.view});let r=!0;w(s,()=>{r&&this._destroyAnalysisView(i,n)});try{await n.when()}catch(o){throw r=!1,this._destroyAnalysisView(i,n),o}if(h(s))throw d();return r=!1,e.view=n,e.state.view=p.CREATED,this._allAnalysisViews.add(n),this._creatingViewCount-=1,n}_destroyAnalysisView(e,s){s.destroyed||(this._creatingViewCount-=1,s.destroy(),this._emitOnView("analysis-view-destroy",{analysis:e,analysisView:s}))}_loadAnalysisModule(e){switch(e){case"area-measurement":return import("./AreaMeasurementAnalysisView3D.js");case"dimension":return import("./DimensionAnalysisView3D.js");case"direct-line-measurement":return import("./DirectLineMeasurementAnalysisView3D.js");case"line-of-sight":return import("./LineOfSightAnalysisView3D.js");case"slice":return import("./SliceAnalysisView3D.js");case"viewshed":return import("./ViewshedAnalysisView3D.js");case"volume-measurement":return import("./VolumeMeasurementAnalysisView3D.js")}}};function f(){const e=m();return e.promise.catch(()=>{}),e}e([y()],v.prototype,"updating",null),e([y({constructOnly:!0})],v.prototype,"view",void 0),e([y()],v.prototype,"_allAnalysisViews",void 0),e([y()],v.prototype,"_creatingViewCount",void 0),v=e([_("esri.views.3d.analysis.AnalysisViewManager3D")],v);const D=v;export{D as default};
@@ -0,0 +1,4 @@
1
+ import "../../../interfaces";
2
+
3
+ import VolumeMeasurementAnalysisView3D = __esri.VolumeMeasurementAnalysisView3D;
4
+ export default VolumeMeasurementAnalysisView3D;
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
+ */
5
+ import{_ as s}from"../../../chunks/tslib.es6.js";import o from"../../../core/Accessor.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as e}from"../../../core/accessorSupport/decorators/subclass.js";import{AnalysisView3D as t}from"./AnalysisView3D.js";let l=class extends(t(o)){constructor(s){super(s),this.type="volume-measurement-view-3d",this.analysis=null}get result(){return null}};s([r({readOnly:!0})],l.prototype,"type",void 0),s([r({constructOnly:!0,nonNullable:!0})],l.prototype,"analysis",void 0),s([r()],l.prototype,"result",null),l=s([e("esri.views.3d.analysis.VolumeMeasurementAnalysisView3D")],l);const p=l;export{p as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import r from"../../../core/Error.js";import has from"../../../core/has.js";import{destroyMaybe as i}from"../../../core/maybe.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{hydrateGraphic as a}from"../../../layers/graphics/hydratedFeatures.js";import{combineTimeExtent as p}from"../../../layers/support/timeSupport.js";import o from"../../../rest/support/Query.js";import{UpdatePolicy as l}from"../webgl-engine/lib/UpdatePolicy.js";import{defaultHighlightName as u}from"../../support/HighlightDefaults.js";import{isInEffectiveScaleRange as h,hasLayerBasedScaleVisibility as y}from"../../support/layerViewUtils.js";import{projectWithZConversionSilent as c}from"../../support/projectionUtils.js";const g=g=>{let d=class extends g{constructor(){super(...arguments),this.highlightOptions=null,this.updatePolicy=l.SYNC,this.slicePlaneEnabled=!1,this.fullExtentInLocalViewSpatialReference=null,this.supportsHeightUnitConversion=!0}initialize(){const e=this.layer;"isTable"in e&&e.isTable?this.addResolvingPromise(Promise.reject(new r("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e}))):(this.addResolvingPromise(this._validateGeometryType()),this.addResolvingPromise((async()=>{if(this.destroyed)return;this.fullExtentInLocalViewSpatialReference="local"===this.view.viewingMode?await c(this.layer.fullExtent,this.view.spatialReference):null;const e=await this.createGraphicsPipeline();this.destroyed?e.destroy():(this.graphicsPipeline=e,await e.when())})()),this.notifyChange("updating"))}destroy(){this.graphicsPipeline=i(this.graphicsPipeline)}get dataUpdating(){return!!this.graphicsPipeline?.dataUpdating}get legendEnabled(){return this.canResume()&&this.graphicsPipeline?.legendEnabled}get visibleAtCurrentScale(){return y()?h(this.layer.effectiveScaleRange,this.view.scale):!this.graphicsPipeline?.scaleVisibilitySuspended}get symbologySnappingSupported(){return this.graphicsPipeline.symbologySnappingSupported}get hasAllFeatures(){return this.graphicsPipeline.hasAllFeatures}get hasAllFeaturesInView(){return this.graphicsPipeline.hasAllFeaturesInView}get hasFullGeometries(){return this.graphicsPipeline.hasFullGeometries}get timeExtent(){return p(this.layer,this.view?.timeExtent,this._get("timeExtent"))}getHit(e){if(has("feature-pipeline-3d-test"))return this._getHitMock(e);const t=this.graphicsPipeline.findGraphic(t=>t.uid===e);if(null==t)return null;const r=a(t,this.layer);return{type:"graphic",graphic:r,layer:r.layer}}_getHitMock(e){const r=this.layer,i={};i[this.layer.objectIdField]=e;const s=new t({layer:r,sourceLayer:r,visible:!0,symbol:null,attributes:i,geometry:null});return{type:"graphic",graphic:s,layer:s.layer}}whenGraphicBounds(e,t){return this.graphicsPipeline?.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.graphicsPipeline?.computeAttachmentOrigin(e,t)}async elevationAlignPointsInFeatures(e,t){return this.graphicsPipeline.elevationAlignPointsInFeatures(e,t)}async queryForSymbologySnapping(e,t){return this.graphicsPipeline.graphicsQuery.queryForSymbologySnapping(e,t)}queryFeatures(e,t){return this.graphicsPipeline.graphicsQuery.executeQuery(this._ensureQuery(e),t?.signal)}queryObjectIds(e,t){return this.graphicsPipeline.graphicsQuery.executeQueryForIds(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this.graphicsPipeline.graphicsQuery.executeQueryForCount(this._ensureQuery(e),t?.signal)}queryExtent(e,t){return this.graphicsPipeline.graphicsQuery.executeQueryForExtent(this._ensureQuery(e),t?.signal)}_ensureQuery(e){return null==e?this.createQuery():o.from(e)}highlight(e,t){return this.graphicsPipeline.highlight(e,t?.name??u)}maskOccludee(e){return this.graphicsPipeline.maskOccludee(e)}getSuspendInfo(){return{...super.getSuspendInfo(),...this.graphicsPipeline.suspendInfo}}isUpdating(){return!(!this.graphicsPipeline||this.graphicsPipeline.destroyed)&&!(!this.graphicsPipeline?.updating&&this.view?.basemapTerrain?.ready)}async _validateGeometryType(){switch(this.layer.geometryType){case"multipatch":case"multipoint":throw new r("featurelayerview3d:unsupported-geometry-type","Unsupported geometry type ${geometryType}",{geometryType:this.layer.geometryType})}}get performanceInfo(){return this.graphicsPipeline.performanceInfo}queryAttributeBins(){throw new Error("Not implemented")}queryAggregates(){throw new Error("Not implemented")}};return e([s()],d.prototype,"graphicsPipeline",void 0),e([s({readOnly:!0})],d.prototype,"dataUpdating",null),e([s()],d.prototype,"highlightOptions",void 0),e([s()],d.prototype,"suspended",void 0),e([s({readOnly:!0})],d.prototype,"legendEnabled",null),e([s({readOnly:!0})],d.prototype,"visibleAtCurrentScale",null),e([s()],d.prototype,"updating",void 0),e([s({readOnly:!0})],d.prototype,"updatePolicy",void 0),e([s({type:Boolean})],d.prototype,"slicePlaneEnabled",void 0),e([s({readOnly:!0})],d.prototype,"suspendInfo",void 0),e([s()],d.prototype,"symbologySnappingSupported",null),e([s({readOnly:!0})],d.prototype,"hasAllFeatures",null),e([s({readOnly:!0})],d.prototype,"hasAllFeaturesInView",null),e([s({readOnly:!0})],d.prototype,"hasFullGeometries",null),e([s({readOnly:!0})],d.prototype,"timeExtent",null),d=e([n("esri.views.3d.layers.FeatureLikeLayerView3D")],d),d};export{g as FeatureLikeLayerView3D};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import i from"../../../core/Error.js";import{makeHandle as r}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import{destroyMaybe as s}from"../../../core/maybe.js";import n from"../../../core/ReactiveMap.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{hydrateGraphic as a}from"../../../layers/graphics/hydratedFeatures.js";import{combineTimeExtent as p}from"../../../layers/support/timeSupport.js";import h from"../../../rest/support/Query.js";import{isQuery as u,isGraphic as g}from"../../../support/guards.js";import{attributeLookup as c}from"./support/attributeUtils.js";import{normalizeHighlightTargetExceptQuery as y,emptyHighlightHandle as d,isObjectId as m}from"./support/highlightUtils.js";import{UpdatePolicy as f}from"../webgl-engine/lib/UpdatePolicy.js";import{defaultHighlightName as P}from"../../support/HighlightDefaults.js";import{isInEffectiveScaleRange as b,hasLayerBasedScaleVisibility as v}from"../../support/layerViewUtils.js";import{projectWithZConversionSilent as w}from"../../support/projectionUtils.js";const j=j=>{let I=class extends j{constructor(){super(...arguments),this.highlightOptions=null,this.updatePolicy=f.SYNC,this.slicePlaneEnabled=!1,this._highlightCounter=new n,this.fullExtentInLocalViewSpatialReference=null,this.supportsHeightUnitConversion=!0}initialize(){const e=this.layer;"isTable"in e&&e.isTable?this.addResolvingPromise(Promise.reject(new i("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e}))):(this.addResolvingPromise(this._validateGeometryType()),this.addResolvingPromise((async()=>{if(this.destroyed)return;this.fullExtentInLocalViewSpatialReference="local"===this.view.viewingMode?await w(this.layer.fullExtent,this.view.spatialReference):null;const e=await this.createGraphicsPipeline();this.destroyed?e.destroy():(this.graphicsPipeline=e,await e.when())})()),this.notifyChange("updating"))}destroy(){this.graphicsPipeline=s(this.graphicsPipeline)}get dataUpdating(){return!!this.graphicsPipeline?.dataUpdating}get legendEnabled(){return this.canResume()&&this.graphicsPipeline?.legendEnabled}get visibleAtCurrentScale(){return v()?b(this.layer.effectiveScaleRange,this.view.scale):!this.graphicsPipeline?.scaleVisibilitySuspended}get symbologySnappingSupported(){return this.graphicsPipeline.symbologySnappingSupported}get hasAllFeatures(){return this.graphicsPipeline.hasAllFeatures}get hasAllFeaturesInView(){return this.graphicsPipeline.hasAllFeaturesInView}get hasFullGeometries(){return this.graphicsPipeline.hasFullGeometries}get timeExtent(){return p(this.layer,this.view?.timeExtent,this._get("timeExtent"))}get highlightIds(){return Array.from(this._highlightCounter.keys())}get hasHighlight(){return this._highlightCounter.size>0}getHit(e){if(has("feature-pipeline-3d-test"))return this._getHitMock(e);const t=this.graphicsPipeline.findGraphic(t=>t.uid===e);if(null==t)return null;const i=a(t,this.layer);return{type:"graphic",graphic:i,layer:i.layer}}_getHitMock(e){const i=this.layer,r={};r[this.layer.objectIdField]=e;const s=new t({layer:i,sourceLayer:i,visible:!0,symbol:null,attributes:r,geometry:null});return{type:"graphic",graphic:s,layer:s.layer}}whenGraphicBounds(e,t){return this.graphicsPipeline?.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.graphicsPipeline?.computeAttachmentOrigin(e,t)}async elevationAlignPointsInFeatures(e,t){return this.graphicsPipeline.elevationAlignPointsInFeatures(e,t)}async queryForSymbologySnapping(e,t){return this.graphicsPipeline.graphicsQuery.queryForSymbologySnapping(e,t)}queryFeatures(e,t){return this.graphicsPipeline.graphicsQuery.executeQuery(this._ensureQuery(e),t?.signal)}queryObjectIds(e,t){return this.graphicsPipeline.graphicsQuery.executeQueryForIds(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this.graphicsPipeline.graphicsQuery.executeQueryForCount(this._ensureQuery(e),t?.signal)}queryExtent(e,t){return this.graphicsPipeline.graphicsQuery.executeQueryForExtent(this._ensureQuery(e),t?.signal)}_ensureQuery(e){return null==e?this.createQuery():h.from(e)}_addHighlightIds(e){for(const t of e){const e=this._highlightCounter.get(t)??0;this._highlightCounter.set(t,e+1)}}_removeHighlightIds(e){for(const t of e){let e=this._highlightCounter.get(t);null!=e&&(e--,e>0?this._highlightCounter.set(t,e):this._highlightCounter.delete(t))}}highlight(e,t){const i=t?.name??P,s=this.layer.objectIdField;if(u(e))return this.graphicsPipeline.highlightByQuery(e,i);const n=y(e);if(0===n.length)return d;if(g(n[0])){const e=n;if(null!=c(this.layer.fieldsIndex,e[0].attributes,s)){const t=e.map(e=>c(this.layer.fieldsIndex,e.attributes,s)),n=this.graphicsPipeline.highlightByObjectIds(t,i);return this._addHighlightIds(t),r(()=>{this._removeHighlightIds(t),n.remove()})}return this.graphicsPipeline.highlightByGraphics(e,i)}if(m(n[0])){const e=n;this._addHighlightIds(e);const t=this.graphicsPipeline.highlightByObjectIds(e,i);return r(()=>{t.remove(),this._removeHighlightIds(e)})}return d}maskOccludee(e){return this.graphicsPipeline.maskOccludee(e)}getSuspendInfo(){return{...super.getSuspendInfo(),...this.graphicsPipeline.suspendInfo}}isUpdating(){return!(!this.graphicsPipeline||this.graphicsPipeline.destroyed)&&!(!this.graphicsPipeline?.updating&&this.view?.basemapTerrain?.ready)}async _validateGeometryType(){switch(this.layer.geometryType){case"multipatch":case"multipoint":throw new i("featurelayerview3d:unsupported-geometry-type","Unsupported geometry type ${geometryType}",{geometryType:this.layer.geometryType})}}get performanceInfo(){return this.graphicsPipeline.performanceInfo}queryAttributeBins(){throw new Error("Not implemented")}queryAggregates(){throw new Error("Not implemented")}};return e([o()],I.prototype,"graphicsPipeline",void 0),e([o({readOnly:!0})],I.prototype,"dataUpdating",null),e([o()],I.prototype,"highlightOptions",void 0),e([o()],I.prototype,"suspended",void 0),e([o({readOnly:!0})],I.prototype,"legendEnabled",null),e([o({readOnly:!0})],I.prototype,"visibleAtCurrentScale",null),e([o()],I.prototype,"updating",void 0),e([o({readOnly:!0})],I.prototype,"updatePolicy",void 0),e([o({type:Boolean})],I.prototype,"slicePlaneEnabled",void 0),e([o({readOnly:!0})],I.prototype,"suspendInfo",void 0),e([o()],I.prototype,"symbologySnappingSupported",null),e([o({readOnly:!0})],I.prototype,"hasAllFeatures",null),e([o({readOnly:!0})],I.prototype,"hasAllFeaturesInView",null),e([o({readOnly:!0})],I.prototype,"hasFullGeometries",null),e([o({readOnly:!0})],I.prototype,"timeExtent",null),I=e([l("esri.views.3d.layers.FeatureLikeLayerView3D")],I),I};export{j as FeatureLikeLayerView3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import has from"../../../core/has.js";import r from"../../../core/Logger.js";import{destroyMaybe as i}from"../../../core/maybe.js";import{initial as s,watch as o}from"../../../core/reactiveUtils.js";import{schedule as n}from"../../../core/scheduling.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as c,invert as m}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as d,IDENTITY as h}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{translate as u,getTranslation as p}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as f}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as g}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{f as b,o as y}from"../../../chunks/vec32.js";import{fromArray as _,create as w}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as v}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{SphericalECEFSpatialReferenceLike as x}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as C}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as j}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as M}from"../../../geometry/projection/projectVectorToVector.js";import{create as T}from"../../../geometry/support/aaBoundingRect.js";import{BufferViewVec2f as P,BufferViewVec4f as O,BufferViewVec4u8 as U,BufferViewVec4u16 as E,BufferViewVec3f as A,BufferViewVec3u8 as H,BufferViewVec3u16 as I,BufferViewInt16 as V,BufferViewUint32 as R,BufferViewUint16 as S}from"../../../geometry/support/buffer/BufferView.js";import{Lyr3DLightingModel as F,Lyr3DUvWrapMode as k,Lyr3DImageFormat as D,Lyr3DPixelFormat as B,Lyr3DVtxAtrbSemantic as L,Lyr3DType as N}from"../../../layers/ILyr3DWasmPerSceneView.js";import G from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as z}from"../../../support/elevationInfoUtils.js";import{ViewingMode as W}from"../../ViewingMode.js";import{toWasmModification as $}from"./I3SMeshWorkerHandle.js";import{IntegratedMesh3DTilesViewPerformanceInfo as J}from"./IntegratedMesh3DTilesViewPerformanceInfo.js";import{DrapeTargetType as q}from"./interfaces.js";import{LayerView3D as K}from"./LayerView3D.js";import{addLayerViewToWasm as X,removeLayerViewFromWasm as Q,getLyr3DWasm as Y}from"./Lyr3DWasm.js";import{LayerElevationProvider as Z}from"./i3s/LayerElevationProvider.js";import{primTypeConversion as ee,alphaModeConversion as te,faceCullingConversion as re,wrapModeConversion as ie,lyr3DTypeToByteSize as se}from"./support/lyr3dTypeConversions.js";import{Tiles3DIntersectionHandler as oe}from"./support/Tiles3DIntersectionHandler.js";import{ElevationRange as ne}from"../support/ElevationRange.js";import{toBoundingRect as ae}from"../support/extentUtils.js";import{Obb as le,compute as ce}from"../support/orientedBoundingBox.js";import{ObjectParameters as me}from"../webgl-engine/collections/Component/ObjectParameters.js";import{GeometryParameters as de,createVertexBufferLayout as he}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as ue}from"../webgl-engine/collections/Component/Transform.js";import{ComponentParameterSummary as pe}from"../webgl-engine/collections/Component/Material/ComponentMaterial.js";import{RenderTexture as fe}from"../webgl-engine/core/material/RenderTexture.js";import{TextureCoordinateType as ge}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{getEllipsoidMode as be}from"../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{Attribute as ye}from"../webgl-engine/lib/Attribute.js";import{CullFaceOptions as _e,AlphaDiscardMode as we,TextureEncodingMimeType as ve}from"../webgl-engine/lib/basicInterfaces.js";import{compressAndTransformNormals as xe}from"../webgl-engine/lib/Normals.js";import{Texture as Ce}from"../webgl-engine/lib/Texture.js";import{VertexAttribute as je}from"../webgl-engine/lib/VertexAttribute.js";import{writeDefaultAttribute as Me,writeBufferVec2 as Te}from"../webgl-engine/materials/internal/bufferWriterUtils.js";import Pe from"../../layers/LayerView.js";import{isInEffectiveScaleRange as Oe}from"../../support/layerViewUtils.js";import{TextureCompressionTracker as Ue}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as Ee}from"../../../webscene/support/AlphaCutoff.js";var Ae;!function(e){e[e.API=1]="API",e[e.VerboseAPI=2]="VerboseAPI",e[e.Error=3]="Error"}(Ae||(Ae={}));class He{constructor(){this.handle=0,this.isVisible=!1,this.components=[],this.textureMemoryUsage=0,this.vboMemoryUsage=0,this.cpuMemoryUsage=0,this.textures=[]}get usedMemory(){return this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get cachedMemory(){return this.usedMemory}}function Ie(e){return Math.round(e/1048.576)/1e3}let Ve=class extends(K(Pe)){constructor(){super(...arguments),this.type="integrated-mesh-3dtiles",this._compressionTracker=new Ue,this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this.drapeTargetType=q.WithoutRasterImage,this._applySSAO=!has("disable-feature:im-ssao"),this._shadeNormals=!!has("enable-feature:im-shading"),this._lyrHandleToObjects=new Map,this._initialCullFace=new Map,this._suspendedHandle=null,this._dbgFlags=new Set}get hasModifications(){return this._modifications&&this._modifications.length>0}initialize(){if(this._dbgFlags.add(Ae.Error),this._dbg(Ae.VerboseAPI,"Tiles3DLayerView3D initialize() called"),this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),s),!this._canProjectWithoutEngine())throw new t("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{});const e=X(this).then(e=>{this._wasmLayerId=e,this._intersectionHandler=new oe(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged(),s),this._updatingHandles.add(()=>this.view.clippingArea,()=>this._clippingAreaChanged(),s),this._elevationProvider=new Z({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this.view.elevationProvider.register("im",this._elevationProvider),this.view.basemapTerrain.overlayManager.registerDrapeTarget(this);const t=this.view.resourceController.memoryController.newCache(`t3d-${this.uid}`,e=>this._onRemoveFromCache(e));this._memCache=t,this.addHandles([o(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e))]),this._suspendedHandle=o(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),s)});this.addResolvingPromise(e)}destroy(){this._dbg(Ae.VerboseAPI,"Tiles3DLayerView3D destroy() called"),Q(this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.objectsChanged(this._obbs),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.basemapTerrain.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._initialCullFace.clear(),this._memCache=i(this._memCache),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}_modificationsChanged(){const e=this.layer.spatialReference,t=$(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t,e.wkid)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=T();this._layerClippingArea=ae(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=n(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),this.objects.forEach(t=>{const r=this._collection.getMaterial(t);r.commonMaterialParameters.hasSlicePlane=e,r.commonMaterialParameters.cullFace=e?_e.None:this._initialCullFace.get(t)})}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,z(e))}get _obbs(){return this.objects.map(e=>this._collection.getComponentObb(e))}get _wasm(){return Y(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){let e=0;return this._lyrHandleToObjects.forEach(t=>{t.isVisible&&(e+=t.usedMemory)}),e}get unloadedMemory(){return 0}get cachedMemory(){let e=0;return this._lyrHandleToObjects.forEach(t=>{t.isVisible||(e+=t.usedMemory)}),e}get visibleAtCurrentScale(){return Oe(this.layer.effectiveScaleRange,this.view.scale)}get performanceInfo(){let e=0,t=0,r=0,i=0,s=0,o=0;return this._lyrHandleToObjects.forEach(n=>{n.isVisible?(e+=n.textureMemoryUsage,t+=n.vboMemoryUsage,s++):(r+=n.textureMemoryUsage,i+=n.vboMemoryUsage,o++)}),new J(this.usedMemory,s,o,Ie(t),Ie(e),Ie(i),Ie(r))}_canProjectWithoutEngine(){if(this.view.state.viewingMode===W.Local){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationOffset(){return z(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new ne(e.zmin,e.zmax):null}getElevationRange(e){return null}get fullExtent(){return this.layer.fullExtent}get objects(){return Array.from(this._lyrHandleToObjects.values()).reduce((e,t)=>e.concat(t.components),new Array)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const r=_(t.desc.origin),i=new Array,s=new Map,o=new He;o.handle=e.handle,this._lyrHandleToObjects.set(e.handle,o);const n=this.view.basemapTerrain.spatialReference;let a,l;if("global"===this.view.viewingMode){const e=f();C(x,r,e,n),a=c(d(),e),l=m(d(),a)}else a=h,l=h;const T=f();u(T,T,r);const O=p(w(),T);let U=null;const E=w();if(t.desc.obb){const e=t.desc.obb.quaternion;U=new le(t.desc.obb.center,t.desc.obb.halfSize,g(e[0],e[1],e[2],e[3]))}for(let c=0;c<t.desc.prims.length;c++){const e=t.desc.prims[c];this._dbg(Ae.VerboseAPI,JSON.stringify(e));if(null==ee[e.ptype]||null==t.data){this._dbg(Ae.VerboseAPI,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive.");continue}const m=t.desc?.materials&&null!=e.materialId?t.desc.materials[e.materialId]:null,d=null!=m?m.lightingModel:F.Unlit,{positionView:u,positionAttr:p,normalsView:f,normalsAttr:g,colorAttr:_,texCoord0Attr:x,indicesView:C}=this.getBufferViews(e,t.data.buffer,a);if(null==p||null==u||null==C)continue;const T=new de(null!=_,x?ge.Default:ge.None,null!=f,this._shadeNormals,this._applySSAO),A=p.data.length/p.size,H=(e,t)=>!e||e.data.length/e.size===A||(this._dbg(Ae.Error,`${t} !== numPos. Skipping primitive.`),!1);if(!H(x,"numTexcoord")||!H(_,"numColors")||!H(g,"normals"))continue;const I=he(T);if(null!=U?U=U.clone():(U=ce(p),b(E,U.center,r),U.center=E),a!==h)for(let t=0;t<u.count;t++)u.getVec(t,E),y(E,E,a),u.setVec(t,E);const V=I.createBuffer(p.data.length);if(Me(je.POSITION,p,null,null,V,0),null!=x){const e=V.getField(je.UV0,P);Te(x,e,0)}null!=_&&Me(je.COLOR,p,null,null,V,0),null!=g&&Me(je.NORMALCOMPRESSED,g,null,null,V,0);const R=new Uint32Array([0,C.typedBuffer.length]),S={vertices:{data:V.buffer,count:V.byteLength/I.stride,layoutParameters:T},positionData:{positions:u.typedBuffer,indices:C.typedBuffer},indices:C.typedBuffer,componentOffsets:R};o.cpuMemoryUsage+=u.count,o.cpuMemoryUsage+=C.count;const k=this.view.renderSpatialReference,D=w(),B=[1,1,1];j(O,k,B,n)||this._dbg(Ae.Error,"Unsupported coordinate system for IM overlay"),M(O,k,D,n);const L=this._collection.createObject(new me(v(D[0],D[1],B[0],B[1]),new ue(O,l),U,S));m&&this._collection.updateMaterial(L,e=>{e.baseColor=m.baseColorFactor,e.usePBR=d===F.Pbr,e.hasParametersFromSource=!1,e.baseColorTexture=this._getTexture(m.baseColorTex,t,s,o),e.usePBR&&(e.mrrFactors=[m.metallicFactor,m.roughnessFactor,0],e.emissiveBaseColor=m.emissiveFactor??[0,0,0],e.metallicRoughnessTexture=this._getTexture(m.metalTex,t,s,o),e.emissionTexture=this._getTexture(m.emissiveTex,t,s,o),e.occlusionTexture=this._getTexture(m.occlusionTex,t,s,o),e.normalTexture=this._getTexture(m.normalTex,t,s,o)),e.objectOpacity=0,e.alphaDiscardMode=we.Mask;const r=[];e.baseColorTexture&&r.push(e.baseColorTexture.loadPromise),e.usePBR&&e.metallicRoughnessTexture&&r.push(e.metallicRoughnessTexture.loadPromise),e.usePBR&&e.emissionTexture&&r.push(e.emissionTexture.loadPromise),e.usePBR&&e.occlusionTexture&&r.push(e.occlusionTexture.loadPromise),e.usePBR&&e.normalTexture&&r.push(e.normalTexture.loadPromise);const n=Promise.all(r);i.push(n),n.then(()=>{e.alphaDiscardMode=te[m.alphaMode],e.objectOpacity=1,o.textureMemoryUsage+=e.baseColorTexture?.glTexture?.usedMemory||0,e.usePBR&&(o.textureMemoryUsage+=e.metallicRoughnessTexture?.glTexture?.usedMemory||0,o.textureMemoryUsage+=e.emissionTexture?.glTexture?.usedMemory||0,o.textureMemoryUsage+=e.occlusionTexture?.glTexture?.usedMemory||0,o.textureMemoryUsage+=e.normalTexture?.glTexture?.usedMemory||0)}),e.commonMaterialParameters.doubleSided=m.isDoubleSided,e.commonMaterialParameters.cullFace=m.faceCulling?re[m.faceCulling]:_e.Back,this._initialCullFace.set(L,e.commonMaterialParameters.cullFace),e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.componentParameters.castShadows=pe.All,e.textureAlphaCutoff=m.alphaCutoff??Ee,e.alphaDiscardMode=te[m.alphaMode],e.isIntegratedMesh=!0,e.polygonOffsetEnabled=!1,e.hasOccludees=!1,e.ellipsoidMode=be(this.view.spatialReference)}),o.components.push(L),o.vboMemoryUsage+=this._collection.getObjectGPUMemoryUsage(L)}if(await Promise.all(i),s.forEach(e=>{o.textures.push(e)}),!this._memCache)throw new Error("no memCache");return this._memCache.put(`${o.handle}`,o),{memUsageBytes:o.usedMemory}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t&&(this.freeObject(t),this._lyrHandleToObjects.delete(e))}freeObject(e){this._memCache&&this._memCache.pop(`${e.handle}`),e.components.forEach(t=>{e.textures.forEach(e=>{this._stage.removeTexture(e)}),this._collection.destroyObject(t),this._initialCullFace.delete(t)})}setRenderableVisibility(e,t,r){if(this._memCache){for(let i=0;i<r;++i){const r=e[i],s=t[i];if(!s)continue;const o=this._lyrHandleToObjects.get(r);o&&(this._visibleGeometryChanged(),o.isVisible=s,o.components.forEach(e=>{this._collection.setObjectVisibility(e,s),this._elevationProvider.objectChanged(this._collection.getComponentObb(e))}),this._memCache.pop(`${r}`))}for(let i=0;i<r;++i){const r=e[i],s=t[i];if(s)continue;const o=this._lyrHandleToObjects.get(r);o&&(this._visibleGeometryChanged(),o.isVisible=s,o.components.forEach(e=>{this._collection.setObjectVisibility(e,s),this._elevationProvider.objectChanged(this._collection.getComponentObb(e))}),this._memCache.put(`${r}`,o))}}}_getTexture(e,t,r,i){let s=null;if(e&&t.desc?.images&&t.data?.buffer){const o=t.desc.images[e?.imageId];if(s=r.get(o),!s&&o){const n=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,a=!!o.mipCount||n>1,l=ie[e.wrapMode??k.None];let c=o.alpha?4:3;const m=new Uint8Array(t.data.buffer,o.data.byteOffset,o.data.byteCount);let d=null,h=null,u=null;switch(o.format){case D.Raw:o.pixelFormat===B.R8?(d=m,c=1,h=""):o.pixelFormat===B.Rgb8?(d=m,c=3,h=""):o.pixelFormat===B.Rgba8&&(d=m,c=4,h="");break;case D.Dxt1:d=m,c=3,h=ve.DDS_ENCODING;break;case D.Dxt5:d=m,c=4,h=ve.DDS_ENCODING;break;case D.Basis:d=m,c=3,h=ve.KTX2_ENCODING;break;case D.Png:h="image/png",u=document.createElement("img");break;case D.Jpeg:h="image/jpeg",u=document.createElement("img");break;case D.Etc2:h="image/ktx",u=document.createElement("img");break;case D.Astc:this._dbg(Ae.Error,"Astc texture not supported");break;case D.Pvrtc:this._dbg(Ae.Error,"Pvrtc texture not supported")}if(u&&h){const e=new Blob([m],{type:h});u.src=URL.createObjectURL(e),d=u}if(d&&null!=h){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker,compressionCallback:e=>{e&&e>0&&(i.textureMemoryUsage-=e)}}:void 0;s=new Ce(d,{mipmap:a,maxAnisotropy:n,encoding:h,wrap:l,components:c,compressionOptions:e,noUnpackFlip:!0,width:o.mip0Width,height:o.mip0Height}),this._stage.addTexture(s),r.set(o,s)}}}return s?new fe(this.view.stage.renderView.textures,s.id):null}getBufferViews(e,t,r){let i,s,o,n,a,l,c,m=null;for(let h=0;h<e.atrbs.length;h++){const c=e.atrbs[h],u=c.view,p=void 0,f=u.byteOffset+u.byteCount,g=u.byteCount/se[u.type],b=[...Array(g).keys()].map(e=>e);try{switch(c.sem){case L.Position:3!==u.ncomp||u.type!==N.F32?this._dbg(Ae.Error,"[Unsupported Feature] Unsupported view for Position ("+u+")"):(i=new A(t,u.byteOffset,p,f),s=new ye(i.typedBuffer,b,3));break;case L.Normal:if(3!==u.ncomp||u.type!==N.F32)this._dbg(Ae.Error,"[Unsupported Feature] Unsupported view for Normal ("+u+")");else{const e=new A(t,u.byteOffset,p,f),i=xe(e.typedBuffer,r);a=new V(i),l=new ye(a.typedBuffer,b,2)}break;case L.TexCoord:2!==u.ncomp||u.type!==N.F32?this._dbg(Ae.Error,"[Unsupported Feature] Unsupported view for Texcoord ("+u+")"):void 0===n&&(n=new ye(new P(t,u.byteOffset,p,f).typedBuffer,b,2));break;case L.Color:4===u.ncomp?(u.type===N.F32&&(m=new O(t,u.byteOffset,p,f)),u.type===N.U8&&(m=new U(t,u.byteOffset,p,f)),u.type===N.U16&&(m=new E(t,u.byteOffset,p,f))):3===u.ncomp&&(u.type===N.F32&&(m=new A(t,u.byteOffset,p,f)),u.type===N.U8&&(m=new H(t,u.byteOffset,p,f)),u.type===N.U16&&(m=new I(t,u.byteOffset,p,f))),null==m?this._dbg(Ae.VerboseAPI,"[Unsupported Feature] Unsupported view for Color ("+u+")"):o=new ye(m.typedBuffer,b,u.ncomp);break;case L.FeatureIndex:break;default:this._dbg(Ae.VerboseAPI,"[Unsupported Feature] Unsupported semantic ("+c.sem+"). Skipping vertex attribute.")}}catch(d){this._dbg(Ae.VerboseAPI,"Error Creating buffer ("+d+"). Skipping vertex attribute.")}}if(e.index){const r=e.index.view,i=void 0,s=r.byteOffset+r.byteCount;switch(e.index.view.type){case N.U16:c=new S(t,r.byteOffset,i,s);break;case N.U32:c=new R(t,r.byteOffset,i,s);break;case N.U8:default:this._dbg(Ae.Error,"[Unsupported Feature] index type not supported ("+r.type+").")}}if(null==c&&null!=i){const e=i.count;if(e<65535){const t=new Uint16Array(e);c=new S(t)}else{const t=new Uint32Array(e);c=new R(t)}for(let t=0;t<e;t++)c.set(t,t)}return{positionView:i,positionAttr:s,colorAttr:o,texCoord0Attr:n,indicesView:c,normalsView:a,normalsAttr:l}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>this._modifications=e.toArray(),s),"modifications")}_onRemoveFromCache(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,t){this._dbgFlags.has(e)&&(e===Ae.Error?r.getLogger(this).error(t):r.getLogger(this).warn(t))}};e([a({type:[G]})],Ve.prototype,"_modifications",void 0),e([a()],Ve.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([a()],Ve.prototype,"layer",void 0),e([a({readOnly:!0})],Ve.prototype,"visibleAtCurrentScale",null),e([a()],Ve.prototype,"elevationOffset",null),Ve=e([l("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Ve);const Re=Ve;export{Re as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{initial as i,watch as s}from"../../../core/reactiveUtils.js";import{schedule as o}from"../../../core/scheduling.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as l,invert as c}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as m,IDENTITY as d}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{translate as h,getTranslation as u}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as p}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as f}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{f as g,o as b}from"../../../chunks/vec32.js";import{fromArray as y,create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as w}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{SphericalECEFSpatialReferenceLike as v}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as x}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as C}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as j}from"../../../geometry/projection/projectVectorToVector.js";import{create as M}from"../../../geometry/support/aaBoundingRect.js";import{BufferViewVec2f as T,BufferViewVec4f as P,BufferViewVec4u8 as O,BufferViewVec4u16 as U,BufferViewVec3f as E,BufferViewVec3u8 as A,BufferViewVec3u16 as H,BufferViewInt16 as I,BufferViewUint32 as R,BufferViewUint16 as V}from"../../../geometry/support/buffer/BufferView.js";import{Lyr3DLightingModel as S,Lyr3DUvWrapMode as F,Lyr3DImageFormat as k,Lyr3DPixelFormat as D,Lyr3DVtxAtrbSemantic as B,Lyr3DType as L}from"../../../layers/ILyr3DWasmPerSceneView.js";import N from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as G}from"../../../support/elevationInfoUtils.js";import{ViewingMode as z}from"../../ViewingMode.js";import{toWasmModification as W}from"./I3SMeshWorkerHandle.js";import{IntegratedMesh3DTilesViewPerformanceInfo as $}from"./IntegratedMesh3DTilesViewPerformanceInfo.js";import{DrapeTargetType as J}from"./interfaces.js";import{LayerView3D as q}from"./LayerView3D.js";import{addLayerViewToWasm as K,removeLayerViewFromWasm as X,getLyr3DWasm as Q}from"./Lyr3DWasm.js";import{LayerElevationProvider as Y}from"./i3s/LayerElevationProvider.js";import{primTypeConversion as Z,alphaModeConversion as ee,faceCullingConversion as te,wrapModeConversion as re,lyr3DTypeToByteSize as ie}from"./support/lyr3dTypeConversions.js";import{Tiles3DIntersectionHandler as se}from"./support/Tiles3DIntersectionHandler.js";import{ElevationRange as oe}from"../support/ElevationRange.js";import{toBoundingRect as ne}from"../support/extentUtils.js";import{Obb as ae,compute as le}from"../support/orientedBoundingBox.js";import{ObjectParameters as ce}from"../webgl-engine/collections/Component/ObjectParameters.js";import{GeometryParameters as me,createVertexBufferLayout as de}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as he}from"../webgl-engine/collections/Component/Transform.js";import{ComponentParameterSummary as ue}from"../webgl-engine/collections/Component/Material/ComponentMaterial.js";import{RenderTexture as pe}from"../webgl-engine/core/material/RenderTexture.js";import{TextureCoordinateType as fe}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{getEllipsoidMode as ge}from"../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{Attribute as be}from"../webgl-engine/lib/Attribute.js";import{CullFaceOptions as ye,AlphaDiscardMode as _e,TextureEncodingMimeType as we}from"../webgl-engine/lib/basicInterfaces.js";import{compressAndTransformNormals as ve}from"../webgl-engine/lib/Normals.js";import{Texture as xe}from"../webgl-engine/lib/Texture.js";import{VertexAttribute as Ce}from"../webgl-engine/lib/VertexAttribute.js";import{writeDefaultAttribute as je,writeBufferVec2 as Me}from"../webgl-engine/materials/internal/bufferWriterUtils.js";import Te from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as Pe,isInEffectiveScaleRange as Oe}from"../../support/layerViewUtils.js";import{TextureCompressionTracker as Ue}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as Ee}from"../../../webscene/support/AlphaCutoff.js";var Ae;!function(e){e[e.API=1]="API",e[e.VerboseAPI=2]="VerboseAPI",e[e.Error=3]="Error"}(Ae||(Ae={}));class He{constructor(){this.handle=0,this.isVisible=!1,this.components=[],this.textureMemoryUsage=0,this.vboMemoryUsage=0,this.cpuMemoryUsage=0,this.textures=[]}get usedMemory(){return this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get cachedMemory(){return this.usedMemory}}function Ie(e){return Math.round(e/1048.576)/1e3}let Re=class extends(q(Te)){constructor(){super(...arguments),this.type="integrated-mesh-3dtiles",this._compressionTracker=new Ue,this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this.drapeTargetType=J.WithoutRasterImage,this._applySSAO=!has("disable-feature:im-ssao"),this._shadeNormals=!!has("enable-feature:im-shading"),this._lyrHandleToObjects=new Map,this._initialCullFace=new Map,this._suspendedHandle=null,this._dbgFlags=new Set}get hasModifications(){return this._modifications&&this._modifications.length>0}initialize(){if(this._dbgFlags.add(Ae.Error),this._dbg(Ae.VerboseAPI,"Tiles3DLayerView3D initialize() called"),this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),i),!this._canProjectWithoutEngine())throw Pe("layer",this.layer.spatialReference.wkid,this.view.renderSpatialReference?.wkid);const e=K(this).then(e=>{this._wasmLayerId=e,this._intersectionHandler=new se(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged(),i),this._updatingHandles.add(()=>this.view.clippingArea,()=>this._clippingAreaChanged(),i),this._elevationProvider=new Y({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this.view.elevationProvider.register("im",this._elevationProvider),this.view.basemapTerrain.overlayManager.registerDrapeTarget(this);const t=this.view.resourceController.memoryController.newCache(`t3d-${this.uid}`,e=>this._onRemoveFromCache(e));this._memCache=t,this.addHandles([s(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e))]),this._suspendedHandle=s(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),i)});this.addResolvingPromise(e)}destroy(){this._dbg(Ae.VerboseAPI,"Tiles3DLayerView3D destroy() called"),X(this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.objectsChanged(this._obbs),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.basemapTerrain.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._initialCullFace.clear(),this._memCache=r(this._memCache),this._updatingHandles=r(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}_modificationsChanged(){const e=this.layer.spatialReference,t=W(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t,e.wkid)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=M();this._layerClippingArea=ne(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=o(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),this.objects.forEach(t=>{const r=this._collection.getMaterial(t);r.commonMaterialParameters.hasSlicePlane=e,r.commonMaterialParameters.cullFace=e?ye.None:this._initialCullFace.get(t)})}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,G(e))}get _obbs(){return this.objects.map(e=>this._collection.getComponentObb(e))}get _wasm(){return Q(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){let e=0;return this._lyrHandleToObjects.forEach(t=>{t.isVisible&&(e+=t.usedMemory)}),e}get unloadedMemory(){return 0}get cachedMemory(){let e=0;return this._lyrHandleToObjects.forEach(t=>{t.isVisible||(e+=t.usedMemory)}),e}get visibleAtCurrentScale(){return Oe(this.layer.effectiveScaleRange,this.view.scale)}get performanceInfo(){let e=0,t=0,r=0,i=0,s=0,o=0;return this._lyrHandleToObjects.forEach(n=>{n.isVisible?(e+=n.textureMemoryUsage,t+=n.vboMemoryUsage,s++):(r+=n.textureMemoryUsage,i+=n.vboMemoryUsage,o++)}),new $(this.usedMemory,s,o,Ie(t),Ie(e),Ie(i),Ie(r))}_canProjectWithoutEngine(){if(this.view.state.viewingMode===z.Local){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationOffset(){return G(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new oe(e.zmin,e.zmax):null}getElevationRange(e){return null}get fullExtent(){return this.layer.fullExtent}get objects(){return Array.from(this._lyrHandleToObjects.values()).reduce((e,t)=>e.concat(t.components),new Array)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const r=y(t.desc.origin),i=new Array,s=new Map,o=new He;o.handle=e.handle,this._lyrHandleToObjects.set(e.handle,o);const n=this.view.basemapTerrain.spatialReference;let a,M;if("global"===this.view.viewingMode){const e=p();x(v,r,e,n),a=l(m(),e),M=c(m(),a)}else a=d,M=d;const P=p();h(P,P,r);const O=u(_(),P);let U=null;const E=_();if(t.desc.obb){const e=t.desc.obb.quaternion;U=new ae(t.desc.obb.center,t.desc.obb.halfSize,f(e[0],e[1],e[2],e[3]))}for(let l=0;l<t.desc.prims.length;l++){const e=t.desc.prims[l];this._dbg(Ae.VerboseAPI,JSON.stringify(e));if(null==Z[e.ptype]||null==t.data){this._dbg(Ae.VerboseAPI,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive.");continue}const c=t.desc?.materials&&null!=e.materialId?t.desc.materials[e.materialId]:null,m=null!=c?c.lightingModel:S.Unlit,{positionView:h,positionAttr:u,normalsView:p,normalsAttr:f,colorAttr:y,texCoord0Attr:v,indicesView:x}=this.getBufferViews(e,t.data.buffer,a);if(null==u||null==h||null==x)continue;const P=new me(null!=y,v?fe.Default:fe.None,null!=p,this._shadeNormals,this._applySSAO),A=u.data.length/u.size,H=(e,t)=>!e||e.data.length/e.size===A||(this._dbg(Ae.Error,`${t} !== numPos. Skipping primitive.`),!1);if(!H(v,"numTexcoord")||!H(y,"numColors")||!H(f,"normals"))continue;const I=de(P);if(null!=U?U=U.clone():(U=le(u),g(E,U.center,r),U.center=E),a!==d)for(let t=0;t<h.count;t++)h.getVec(t,E),b(E,E,a),h.setVec(t,E);const R=I.createBuffer(u.data.length);if(je(Ce.POSITION,u,null,null,R,0),null!=v){const e=R.getField(Ce.UV0,T);Me(v,e,0)}null!=y&&je(Ce.COLOR,u,null,null,R,0),null!=f&&je(Ce.NORMALCOMPRESSED,f,null,null,R,0);const V=new Uint32Array([0,x.typedBuffer.length]),F={vertices:{data:R.buffer,count:R.byteLength/I.stride,layoutParameters:P},positionData:{positions:h.typedBuffer,indices:x.typedBuffer},indices:x.typedBuffer,componentOffsets:V};o.cpuMemoryUsage+=h.count,o.cpuMemoryUsage+=x.count;const k=this.view.renderSpatialReference,D=_(),B=[1,1,1];C(O,k,B,n)||this._dbg(Ae.Error,"Unsupported coordinate system for IM overlay"),j(O,k,D,n);const L=this._collection.createObject(new ce(w(D[0],D[1],B[0],B[1]),new he(O,M),U,F));c&&this._collection.updateMaterial(L,e=>{e.baseColor=c.baseColorFactor,e.usePBR=m===S.Pbr,e.hasParametersFromSource=!1,e.baseColorTexture=this._getTexture(c.baseColorTex,t,s,o),e.usePBR&&(e.mrrFactors=[c.metallicFactor,c.roughnessFactor,0],e.emissiveBaseColor=c.emissiveFactor??[0,0,0],e.metallicRoughnessTexture=this._getTexture(c.metalTex,t,s,o),e.emissionTexture=this._getTexture(c.emissiveTex,t,s,o),e.occlusionTexture=this._getTexture(c.occlusionTex,t,s,o),e.normalTexture=this._getTexture(c.normalTex,t,s,o)),e.objectOpacity=0,e.alphaDiscardMode=_e.Mask;const r=[];e.baseColorTexture&&r.push(e.baseColorTexture.loadPromise),e.usePBR&&e.metallicRoughnessTexture&&r.push(e.metallicRoughnessTexture.loadPromise),e.usePBR&&e.emissionTexture&&r.push(e.emissionTexture.loadPromise),e.usePBR&&e.occlusionTexture&&r.push(e.occlusionTexture.loadPromise),e.usePBR&&e.normalTexture&&r.push(e.normalTexture.loadPromise);const n=Promise.all(r);i.push(n),n.then(()=>{e.alphaDiscardMode=ee[c.alphaMode],e.objectOpacity=1,o.textureMemoryUsage+=e.baseColorTexture?.glTexture?.usedMemory||0,e.usePBR&&(o.textureMemoryUsage+=e.metallicRoughnessTexture?.glTexture?.usedMemory||0,o.textureMemoryUsage+=e.emissionTexture?.glTexture?.usedMemory||0,o.textureMemoryUsage+=e.occlusionTexture?.glTexture?.usedMemory||0,o.textureMemoryUsage+=e.normalTexture?.glTexture?.usedMemory||0)}),e.commonMaterialParameters.doubleSided=c.isDoubleSided,e.commonMaterialParameters.cullFace=c.faceCulling?te[c.faceCulling]:ye.Back,this._initialCullFace.set(L,e.commonMaterialParameters.cullFace),e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.componentParameters.castShadows=ue.All,e.textureAlphaCutoff=c.alphaCutoff??Ee,e.alphaDiscardMode=ee[c.alphaMode],e.isIntegratedMesh=!0,e.polygonOffsetEnabled=!1,e.hasOccludees=!1,e.ellipsoidMode=ge(this.view.spatialReference)}),o.components.push(L),o.vboMemoryUsage+=this._collection.getObjectGPUMemoryUsage(L)}if(await Promise.all(i),s.forEach(e=>{o.textures.push(e)}),!this._memCache)throw new Error("no memCache");return this._memCache.put(`${o.handle}`,o),{memUsageBytes:o.usedMemory}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t&&(this.freeObject(t),this._lyrHandleToObjects.delete(e))}freeObject(e){this._memCache&&this._memCache.pop(`${e.handle}`),e.components.forEach(t=>{e.textures.forEach(e=>{this._stage.removeTexture(e)}),this._collection.destroyObject(t),this._initialCullFace.delete(t)})}setRenderableVisibility(e,t,r){if(this._memCache){for(let i=0;i<r;++i){const r=e[i],s=t[i];if(!s)continue;const o=this._lyrHandleToObjects.get(r);o&&(this._visibleGeometryChanged(),o.isVisible=s,o.components.forEach(e=>{this._collection.setObjectVisibility(e,s),this._elevationProvider.objectChanged(this._collection.getComponentObb(e))}),this._memCache.pop(`${r}`))}for(let i=0;i<r;++i){const r=e[i],s=t[i];if(s)continue;const o=this._lyrHandleToObjects.get(r);o&&(this._visibleGeometryChanged(),o.isVisible=s,o.components.forEach(e=>{this._collection.setObjectVisibility(e,s),this._elevationProvider.objectChanged(this._collection.getComponentObb(e))}),this._memCache.put(`${r}`,o))}}}_getTexture(e,t,r,i){let s=null;if(e&&t.desc?.images&&t.data?.buffer){const o=t.desc.images[e?.imageId];if(s=r.get(o),!s&&o){const n=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,a=!!o.mipCount||n>1,l=re[e.wrapMode??F.None];let c=o.alpha?4:3;const m=new Uint8Array(t.data.buffer,o.data.byteOffset,o.data.byteCount);let d=null,h=null,u=null;switch(o.format){case k.Raw:o.pixelFormat===D.R8?(d=m,c=1,h=""):o.pixelFormat===D.Rgb8?(d=m,c=3,h=""):o.pixelFormat===D.Rgba8&&(d=m,c=4,h="");break;case k.Dxt1:d=m,c=3,h=we.DDS_ENCODING;break;case k.Dxt5:d=m,c=4,h=we.DDS_ENCODING;break;case k.Basis:d=m,c=3,h=we.KTX2_ENCODING;break;case k.Png:h="image/png",u=document.createElement("img");break;case k.Jpeg:h="image/jpeg",u=document.createElement("img");break;case k.Etc2:h="image/ktx",u=document.createElement("img");break;case k.Astc:this._dbg(Ae.Error,"Astc texture not supported");break;case k.Pvrtc:this._dbg(Ae.Error,"Pvrtc texture not supported")}if(u&&h){const e=new Blob([m],{type:h});u.src=URL.createObjectURL(e),d=u}if(d&&null!=h){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker,compressionCallback:e=>{e&&e>0&&(i.textureMemoryUsage-=e)}}:void 0;s=new xe(d,{mipmap:a,maxAnisotropy:n,encoding:h,wrap:l,components:c,compressionOptions:e,noUnpackFlip:!0,width:o.mip0Width,height:o.mip0Height}),this._stage.addTexture(s),r.set(o,s)}}}return s?new pe(this.view.stage.renderView.textures,s.id):null}getBufferViews(e,t,r){let i,s,o,n,a,l,c,m=null;for(let h=0;h<e.atrbs.length;h++){const c=e.atrbs[h],u=c.view,p=void 0,f=u.byteOffset+u.byteCount,g=u.byteCount/ie[u.type],b=[...Array(g).keys()].map(e=>e);try{switch(c.sem){case B.Position:3!==u.ncomp||u.type!==L.F32?this._dbg(Ae.Error,"[Unsupported Feature] Unsupported view for Position ("+u+")"):(i=new E(t,u.byteOffset,p,f),s=new be(i.typedBuffer,b,3));break;case B.Normal:if(3!==u.ncomp||u.type!==L.F32)this._dbg(Ae.Error,"[Unsupported Feature] Unsupported view for Normal ("+u+")");else{const e=new E(t,u.byteOffset,p,f),i=ve(e.typedBuffer,r);a=new I(i),l=new be(a.typedBuffer,b,2)}break;case B.TexCoord:2!==u.ncomp||u.type!==L.F32?this._dbg(Ae.Error,"[Unsupported Feature] Unsupported view for Texcoord ("+u+")"):void 0===n&&(n=new be(new T(t,u.byteOffset,p,f).typedBuffer,b,2));break;case B.Color:4===u.ncomp?(u.type===L.F32&&(m=new P(t,u.byteOffset,p,f)),u.type===L.U8&&(m=new O(t,u.byteOffset,p,f)),u.type===L.U16&&(m=new U(t,u.byteOffset,p,f))):3===u.ncomp&&(u.type===L.F32&&(m=new E(t,u.byteOffset,p,f)),u.type===L.U8&&(m=new A(t,u.byteOffset,p,f)),u.type===L.U16&&(m=new H(t,u.byteOffset,p,f))),null==m?this._dbg(Ae.VerboseAPI,"[Unsupported Feature] Unsupported view for Color ("+u+")"):o=new be(m.typedBuffer,b,u.ncomp);break;case B.FeatureIndex:break;default:this._dbg(Ae.VerboseAPI,"[Unsupported Feature] Unsupported semantic ("+c.sem+"). Skipping vertex attribute.")}}catch(d){this._dbg(Ae.VerboseAPI,"Error Creating buffer ("+d+"). Skipping vertex attribute.")}}if(e.index){const r=e.index.view,i=void 0,s=r.byteOffset+r.byteCount;switch(e.index.view.type){case L.U16:c=new V(t,r.byteOffset,i,s);break;case L.U32:c=new R(t,r.byteOffset,i,s);break;case L.U8:default:this._dbg(Ae.Error,"[Unsupported Feature] index type not supported ("+r.type+").")}}if(null==c&&null!=i){const e=i.count;if(e<65535){const t=new Uint16Array(e);c=new V(t)}else{const t=new Uint32Array(e);c=new R(t)}for(let t=0;t<e;t++)c.set(t,t)}return{positionView:i,positionAttr:s,colorAttr:o,texCoord0Attr:n,indicesView:c,normalsView:a,normalsAttr:l}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>this._modifications=e.toArray(),i),"modifications")}_onRemoveFromCache(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,r){this._dbgFlags.has(e)&&(e===Ae.Error?t.getLogger(this).error(r):t.getLogger(this).warn(r))}};e([n({type:[N]})],Re.prototype,"_modifications",void 0),e([n()],Re.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([n()],Re.prototype,"layer",void 0),e([n({readOnly:!0})],Re.prototype,"visibleAtCurrentScale",null),e([n()],Re.prototype,"elevationOffset",null),Re=e([a("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Re);const Ve=Re;export{Ve as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{estimateNumberArrayMemory as i}from"../../../core/memoryEstimations.js";import{throwIfAborted as s}from"../../../core/promiseUtils.js";import{initial as o,watch as a}from"../../../core/reactiveUtils.js";import{generateUID as n}from"../../../core/uid.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{i as u}from"../../../chunks/vec32.js";import{create as h,ZEROS as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBuffer as c}from"../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as m}from"../../../geometry/projection/projectVectorToVector.js";import{extentContainsCoords3D as g,extentContainsCoords2D as y}from"../../../geometry/support/contains.js";import{newDoubleArray as f,doubleArrayFrom as _}from"../../../geometry/support/DoubleArray.js";import{getGeometryZScaler as b}from"../../../geometry/support/zscale.js";import{fallbackObjectIDAttribute as v}from"../../../layers/LayerConstants.js";import{estimateSize as x}from"../../../layers/graphics/dehydratedFeatures.js";import{makeDehydratedPoint as I}from"../../../layers/graphics/dehydratedPoint.js";import{hydrateGraphic as E}from"../../../layers/graphics/hydratedFeatures.js";import w from"../../../layers/graphics/controllers/I3SOnDemandController.js";import j from"../../../layers/support/FeatureFilter.js";import N from"../../../rest/support/Query.js";import{isBasemapLayerView as C}from"../../../support/basemapUtils.js";import{I3SPointsWorkerHandle as O}from"./I3SPointsWorkerHandle.js";import{LayerView3D as D}from"./LayerView3D.js";import{Graphics3DFeatureProcessor as S}from"./graphics/Graphics3DFeatureProcessor.js";import{QueryEngine as F}from"./graphics/QueryEngine.js";import{QueryEngineContext as G}from"./graphics/QueryEngineContext.js";import{createInteractiveEditSession as A,normalizeEditResultsEvent as V,processAttributeEdits as P}from"./i3s/featureEditing.js";import{getCachedAttributeValue as L}from"./i3s/I3SBinaryReader.js";import{I3SGraphicsMap as R}from"./i3s/I3SGraphicsMap.js";import{I3SOverrides as M}from"./i3s/I3SOverrides.js";import{checkRecyclable as H,checkSpatialReferences as Q,containsDraco as U,whenGraphicAttributes as q}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as T}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as B}from"./support/fieldProperties.js";import{LayerViewPerformanceInfo as k}from"./support/LayerViewPerformanceInfo.js";import{PopupSceneLayerView as z}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as W}from"./support/SceneLayerViewRequiredFields.js";import{TemporalSceneLayerView as K}from"./support/TemporalSceneLayerView.js";import{debugFlags as Z}from"../support/debugFlags.js";import{compute as Y}from"../support/orientedBoundingBox.js";import{updatingProgress as $}from"../support/updatingProperties.js";import{Vertices as J}from"../webgl-engine/lib/Attribute.js";import{UpdatePolicy as X}from"../webgl-engine/lib/UpdatePolicy.js";import ee from"../../layers/SceneLayerView.js";import{hasPopupTemplate as te}from"../../layers/support/popupUtils.js";import{defaultHighlightName as re}from"../../support/HighlightDefaults.js";import{hasLayerBasedScaleVisibility as ie,isInEffectiveScaleRange as se}from"../../support/layerViewUtils.js";import{TaskPriority as oe}from"../../support/Scheduler.js";const ae=B();class ne{constructor(e,t,r,i){this.graphics=e,this.featureIds=t,this.attributeInfo=r,this.node=i}get cachedMemory(){return this.graphics.reduce((e,t)=>x(t)+e,i(this.featureIds)+1024)}}let le=class extends(K(T(z(D(ee))))){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 R((e,t,r)=>pe(e,t,r),e=>this.processor.graphicsCore.recreateGraphics(e)),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?e.load(t).then(()=>{s(t),H(this.layer,e,this._i3sOverrides),this.layer=e,this._i3sOverrides.destroy();const i=this.view.resourceController?.memoryController;this._i3sOverrides=new M({view:this.view,layer:e,memoryController:i}),r(this._queryEngine),this._setupQueryEngine(),this.processor.resetObjectStates()}):null}initialize(){this.addResolvingPromise(this.layer.indexInfo);const e=this.view.resourceController?.memoryController;this._i3sOverrides=new M({view:this.view,layer:this.layer,memoryController:e}),Q(this.layer,this.view.spatialReference,this.view.viewingMode),this._fieldsHelper=new W({layerView:this}),this._updatingHandles.add(()=>this.layer.rangeInfos,e=>this._rangeInfosChanged(e),o),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 S({owner:this,preferredUpdatePolicy:X.ASYNC,scaleVisibilityEnabled:!ie(),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=b("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 w({layerView:this}),U(this.layer.geometryDefinitions)&&(this._worker=new O(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=>{const t=this._pendingEditsQueue.then(()=>this._handleEdits(e)).then();this._pendingEditsQueue=t,this._updatingHandles.addPromise(t)}),a(()=>Z.I3S_TREE_SHOW_TILES,e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then(({I3STreeDebugger:t})=>{!this._treeDebugger&&Z.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))})}else e||!this._treeDebugger||Z.I3S_TREE_SHOW_TILES||(this._treeDebugger.destroy(),this._treeDebugger=null)},o)]),this.when(()=>{this._setupQueryEngine(),this._updatingHandles.add(()=>this.maximumNumberOfFeatures,e=>this._controller.featureTarget=e,o),this._updatingHandles.add(()=>this.suspended,e=>{e&&this._removeAllNodeData()})})}destroy(){this._treeDebugger=r(this._treeDebugger),this._i3sOverrides=r(this._i3sOverrides),this._set("processor",r(this.processor)),this._controller=r(this._controller),this._queryEngine=r(this._queryEngine),this._worker=r(this._worker),this._memCache=r(this._memCache),this.loadedGraphics.clear(),this._fieldsHelper=r(this._fieldsHelper)}get i3slayer(){return this.layer}get layerViewUid(){return this.uid}get updatingProgressValue(){return this._controller?.updatingProgress??1}get visibleAtCurrentScale(){return ie()?se(this.layer.effectiveScaleRange,this.view.scale):!this.processor?.scaleVisibilitySuspended}get requiredFields(){return this._fieldsHelper?.requiredFields??[]}get maximumNumberOfFeatures(){const e=this.processor?.graphicsCore?.displayFeatureLimit;return e?.maximumNumberOfFeatures??0}set maximumNumberOfFeatures(e){null!=e?(this._override("maximumNumberOfFeatures",e),this._controller.fixedFeatureTarget=!0):(this._clearOverride("maximumNumberOfFeatures"),this._controller.fixedFeatureTarget=!1)}get maximumNumberOfFeaturesExceeded(){return!this.suspended&&(!!this._controller?.useMaximumNumberOfFeatures&&!this._controller.leavesReached)}get _excludeObjectIds(){return new Set(this.layer.excludeObjectIds)}get lodFactor(){return"Labels"===this.layer.semantic?1:this.view.qualitySettings.sceneService.point.lodFactor}get hasM(){return!1}get hasZ(){return!0}get contentVisible(){return!this.suspended&&!!this._controller?.rootNodeVisible}get legendEnabled(){return this.contentVisible&&!0===this.i3slayer?.legendEnabled}async whenGraphicAttributes(e,t){return q(this.layer,e,this._getObjectIdField(),t,()=>[...this.loadedGraphics.nodes()])}getHit(e){if(!this.loadedGraphics)return null;const t=E(this.loadedGraphics.find(t=>t.uid===e),this.layer),r=this._getObjectIdField();return t?.attributes?.[r]?(t.layer=this.layer,t.sourceLayer=this.layer,{type:"graphic",graphic:t,layer:t.layer}):null}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){return this.processor.highlight(e,this.layer.objectIdField,t?.name??re)}get updatePolicy(){return this.processor.graphicsCore.effectiveUpdatePolicy}createInteractiveEditSession(e){return A(this._attributeEditingContext,e)}async _decompressBinaryPointData(e,t){const r={geometryBuffer:e.geometryBuffer};null==this._worker&&(this._worker=new O(e=>this.view.resourceController.immediate.schedule(e)));const i=await this._worker.invoke(r,t);if(null==i)throw new Error("Failed to decompress Draco point data");return{positionData:i.positions,featureIds:i.featureIds}}async addNode(e,r,i){if(!he(r)&&!ue(r))throw new Error;if(this.loadedGraphics.hasNode(e.index))return void t.getLogger(this).error("I3S node "+e.id+" already added");const s=null!=this.layer.fullExtent?me(this.layer.fullExtent.clone(),.5):null,{featureIds:o,pointPositions:a}=he(r)?await this._extractBinaryPointPositions(e,r,i):this._extractLegacyPointPositions(r),n=new Array;this._validatePositions(e,o,a,s,n);const l=this._controller.crsVertex,d=this.view.spatialReference;c(a,l,0,a,d,0,o.length);const u=he(r)?e.level:0,h=this._createGraphics(o,a,e.index,u),p=new ne(h,o,r.attributeDataInfo,e);if(await this._i3sOverrides.applyAttributeOverrides(p.featureIds,r.attributeDataInfo,i),e.numFeatures=p.graphics.length,this._updateNodeMemory(e),ce(p),n.length>0&&(this._computeObb(e,n,l),this._controller.updateVisibility(e.index)),!this._controller.isGeometryVisible(e))return void this._cacheNodeData(p);if(null!=this._verticalScale)for(const t of p.graphics)this._verticalScale(t.geometry);const m=this.view.stage.renderView.olidRenderHelper;if(m){const e=C(this.view,this.uid);for(let t=0;t<p.featureIds.length;t++){const r=p.featureIds[t];m.setUidToObjectAndLayerId(r,p.graphics[t].uid,this.layer.id,this.uid,this.layer.popupEnabled&&!e&&te(this.layer,this.view.popup?.defaultPopupTemplateEnabled),p.node.resources.attributes,t)}}this.loadedGraphics.addNode(e.index,p),this._controller.updateLoadStatus(e.index,!0),this._filterNode(p),this._treeDebugger&&this._treeDebugger.update()}_computeObb(e,t,r){const i=this._controller.crsIndex,s=i.isGeographic?this.view.renderSpatialReference:i;c(t,r,0,t,s,0),e.serviceObbInIndexSR=Y(new J(t,3)),i.isGeographic&&(m(e.serviceObbInIndexSR.center,s,ye,i),e.serviceObbInIndexSR.center=ye)}isNodeLoaded(e){return this.loadedGraphics.hasNode(e)}isNodeReloading(){return!1}updateNodeState(){}getNodeComponentHandle(){}async _extractBinaryPointPositions(e,t,r){const i=await this._decompressBinaryPointData(t,r),s=i.positionData,o=3,a=s.length/o,n=f(3*a),l=null!=e.serviceObbInIndexSR?e.serviceObbInIndexSR.center:p,d=Math.abs(l[2])*2**-20;for(let u=0;u<a;u++){const e=u*o;n[e]=s[e]+l[0],n[e+1]=s[e+1]+l[1],n[e+2]=s[e+2]+l[2],Math.abs(n[e+2])<d&&(n[e+2]=0)}return{featureIds:i.featureIds?_(i.featureIds):[],pointPositions:n}}_extractLegacyPointPositions(e){const t=e.pointData.length,r=f(3*t),i=new Array;for(let s=0;s<t;s++){const t=e.pointData[s],o=t.featureDataPosition,a=o.length,n=t.geometries?.[0]??ge[a],l=t.featureIds[0];if("Embedded"!==n.type||"points"!==n.params.type||a<2||a>3)continue;const d=n.params.vertexAttributes?.position??[0,0,0],u=3*i.length;r[u]=o[0]+d[0],r[u+1]=o[1]+d[1],r[u+2]=3===a?o[2]+d[2]:NaN,i.push(l)}return{featureIds:i,pointPositions:r}}_validatePositions(e,r,i,s,o){if(null==s&&e.serviceObbInIndexSR)return;const a=r.length,n=3;for(let l=0;l<a;l++){const r=l*n;u(ye,i[r],i[r+1],i[r+2]);const a=!Number.isNaN(i[2]);null==s||(a?g(s,ye):y(s,ye))||(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||o.push(ye[0],ye[1],ye[2])}}_createGraphics(e,t,r,i){const s=e.length,o=3,a=this._getObjectIdField(),l=this.processor.graphicsCore,d=new Array,u=this.view.spatialReference;for(let h=0;h<s;h++){const s=e[h],p={};null!=s&&(p[a]=s);const c=s??n(),m=h*o,g=isNaN(t[m+2])?void 0:t[m+2],y=I(t[m],t[m+1],g,u),f=this.loadedGraphics.get(c);if(null!=f)(null==f.level||f.level<i)&&(fe.property="geometry",fe.graphic=f,fe.oldValue=f.geometry,fe.newValue=y,f.geometry=y,f.level=i,l.graphicUpdateHandler(fe),_e()),d.push(f);else{const e=n();d.push({objectId:c,uid:e,geometry:y,attributes:p,visible:!0,nodeIndex:r,level:i})}}return d}_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){const t=e.node;this._updateNodeMemory(t),this._cacheNodeData(e)}this._controller.updateLoadStatus(t,!1)}),this._treeDebugger&&this._treeDebugger.update(),this.loadedGraphics.clear()}removeNode(e){const t=this._removeNodeStageData(e);t&&(this._updateNodeMemory(t.node),this._cacheNodeData(t))}_removeNodeStageData(e){const t=this.loadedGraphics.getNode(e);return null==t?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,r,i,s){this.loadedGraphics.hasNode(e.index)?t.getLogger(this).error("I3S node "+e.id+" already added"):(await this._i3sOverrides.applyAttributeOverrides(r.featureIds,i,s),r.attributeInfo=i,this.loadedGraphics.addNode(e.index,r),this._controller.updateLoadStatus(e.index,!0),this._updateNodeMemory(e),ce(r),this._filterNode(r),this._treeDebugger&&this._treeDebugger.update())}getLoadedNodeIds(){const e=[];return this.loadedGraphics.forEachNode(t=>e.push(t.node.id)),e.sort()}getVisibleNodes(){const e=new Array;return this.loadedGraphics.forEachNode(t=>e.push(t.node)),e}getLoadedNodeIndices(e){this.loadedGraphics.forEachNode((t,r)=>e.push(r))}getLoadedAttributes(e){const t=this.loadedGraphics.getNode(e);if(null!=t?.attributeInfo)return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this.loadedGraphics.getNode(e);if(null!=t?.attributeInfo)return t.attributeInfo.attributeData}_setAttributeData(e,t){const r=this.loadedGraphics.getNode(e);null!=r?.attributeInfo&&(r.attributeInfo.attributeData=t,this._attributeValuesChanged(r))}async updateAttributes(e,t,r){const i=this.loadedGraphics.getNode(e);null!=i&&(await this._i3sOverrides.applyAttributeOverrides(i.featureIds,t,r),i.attributeInfo=t,this._attributeValuesChanged(i))}_attributeValuesChanged(e){ce(e),this._filterNode(e);const{processor:t}=this,{graphicsCore:r}=t;if(r.labelsEnabled){const t=e.node.index,i=new Array;e.graphics.forEach(e=>e.nodeIndex===t&&i.push(e.uid)),r.updateLabelingInfo(i)}t.refreshFilter()}_updateClippingExtent(e){return this._controller&&this._controller.updateClippingArea(e),!1}_getObjectIdField(){return this.layer.objectIdField||v}_getGlobalIdField(){return this.layer.globalIdField}async _rendererChange(e,t){const{layer:{fieldsIndex:r}}=this,i=new Set;let s,o;e?(await e.collectRequiredFields(i,r),s=Array.from(i).sort()):s=[],i.clear(),t?(await t.collectRequiredFields(i,r),o=Array.from(i).sort()):o=[],s.length===o.length&&s.every((e,t)=>s[t]===o[t])||this._reloadAllNodes()}_rangeInfosChanged(e){null!=e&&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){const t=this.parsedDefinitionExpression,r=this._excludeObjectIds,i=this._getObjectIdField();for(const s of e.graphics){const e=s.visible,o=this._evaluateClause(t,s),a=!r.has(s.attributes[i]);s.visible=o&&a,e!==s.visible&&(fe.graphic=s,fe.property="visible",fe.oldValue=e,fe.newValue=s.visible,this.processor.graphicsCore.graphicUpdateHandler(fe),_e())}}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return this.filter?.createQuery(e)??new N(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(null==e?this.createQuery():N.from(e))}_setupQueryEngine(){const{layer:e,view:t,hasM:r,hasZ:i}=this,{spatialReference:s,resourceController:o}=t,a=new G(s,e,o,()=>this.processor.featureStore,i,r);this._queryEngine=new F({context:a,priority:oe.FEATURE_QUERY_ENGINE})}get usedMemory(){return this.processor?.graphicsCore?.usedMemory??0}get unloadedMemory(){return.8*((this._controller?.unloadedMemoryEstimate??0)+(this.processor?.graphicsCore?.unprocessedMemoryEstimate??0))}get ignoresMemoryFactor(){return this._controller&&this._controller.fixedFeatureTarget}async _handleEdits(e){const t=this._attributeEditingContext,r=await V(t,e);P(t,r)}get _attributeEditingContext(){const 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.i3slayer.attributeStorageInfo??[],i3sOverrides:this._i3sOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(t,r,i)=>{this._setAttributeData(t,r);const s=this.loadedGraphics.getNode(t);if(null!=i){const t=this.loadedGraphics.get(i.attributes[e]);null!=t&&this.processor.graphicsCore.recreateGraphics([t])}else null!=s&&this.processor.graphicsCore.recreateGraphics(s.graphics)},clearMemCache:()=>{}}}get performanceInfo(){return new k(this.usedMemory,this.loadedGraphics.length,-1,this.maximumNumberOfFeatures,this.loadedGraphics.nodeCount,this.processor.graphicsCore.performanceInfo)}get test(){}};e([l()],le.prototype,"processor",void 0),e([l({type:j})],le.prototype,"filter",void 0),e([l()],le.prototype,"loadedGraphics",void 0),e([l()],le.prototype,"i3slayer",null),e([l()],le.prototype,"layerViewUid",null),e([l()],le.prototype,"_controller",void 0),e([l()],le.prototype,"updating",void 0),e([l()],le.prototype,"suspended",void 0),e([l($)],le.prototype,"updatingProgress",void 0),e([l()],le.prototype,"updatingProgressValue",null),e([l({readOnly:!0})],le.prototype,"visibleAtCurrentScale",null),e([l(ae.requiredFields)],le.prototype,"requiredFields",null),e([l(ae.availableFields)],le.prototype,"availableFields",void 0),e([l()],le.prototype,"_fieldsHelper",void 0),e([l({type:Number})],le.prototype,"maximumNumberOfFeatures",null),e([l({readOnly:!0})],le.prototype,"maximumNumberOfFeaturesExceeded",null),e([l()],le.prototype,"_excludeObjectIds",null),e([l({readOnly:!0})],le.prototype,"lodFactor",null),e([l({readOnly:!0})],le.prototype,"hasM",null),e([l({readOnly:!0})],le.prototype,"hasZ",null),e([l()],le.prototype,"contentVisible",null),e([l({readOnly:!0})],le.prototype,"legendEnabled",null),le=e([d("esri.views.3d.layers.SceneLayerGraphicsView3D")],le);const de=le;function ue(e){return"pointData"in e}function he(e){return"geometryBuffer"in e&&null!==e.geometryBuffer}function pe(e,t,r){const i=t.attributeInfo;if(null==i?.loadedAttributes||null==i.attributeData)return!1;let s=!1;for(const{name:o}of i.loadedAttributes)if(i.attributeData[o]){const t=L(i.attributeData[o],r);t!==e.attributes[o]&&(e.attributes[o]=t,s=!0)}return s}function ce(e){const t=e.attributeInfo;if(null==t?.loadedAttributes||null==t.attributeData)return;const r=e.node.index;for(let i=0;i<e.graphics.length;i++){const s=e.graphics[i];if(s.nodeIndex===r){s.attributes||(s.attributes={});for(const{name:e}of t.loadedAttributes)t.attributeData[e]&&(s.attributes[e]=L(t.attributeData[e],i))}}}function me(e,t){return e.xmin-=t,e.ymin-=t,e.xmax+=t,e.ymax+=t,null!=e.zmin&&null!=e.zmax&&(e.zmin-=t,e.zmax+=t),null!=e.mmin&&null!=e.mmax&&(e.mmin-=t,e.mmax+=t),e}const ge={2:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0]}}},3:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0,0]}}}},ye=h(),fe={graphic:null,property:null,oldValue:null,newValue:null};function _e(){fe.graphic=null,fe.property=null,fe.oldValue=null,fe.newValue=null}export{de as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{estimateNumberArrayMemory as i}from"../../../core/memoryEstimations.js";import{throwIfAborted as s}from"../../../core/promiseUtils.js";import{initial as o,watch as a}from"../../../core/reactiveUtils.js";import{generateUID as n}from"../../../core/uid.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{i as u}from"../../../chunks/vec32.js";import{create as h,ZEROS as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBuffer as c}from"../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as m}from"../../../geometry/projection/projectVectorToVector.js";import{extentContainsCoords3D as g,extentContainsCoords2D as y}from"../../../geometry/support/contains.js";import{newDoubleArray as f,doubleArrayFrom as _}from"../../../geometry/support/DoubleArray.js";import{getGeometryZScaler as b}from"../../../geometry/support/zscale.js";import{fallbackObjectIDAttribute as v}from"../../../layers/LayerConstants.js";import{estimateSize as I}from"../../../layers/graphics/dehydratedFeatures.js";import{makeDehydratedPoint as x}from"../../../layers/graphics/dehydratedPoint.js";import{hydrateGraphic as E}from"../../../layers/graphics/hydratedFeatures.js";import w from"../../../layers/graphics/controllers/I3SOnDemandController.js";import j from"../../../layers/support/FeatureFilter.js";import N from"../../../rest/support/Query.js";import{isBasemapLayerView as O}from"../../../support/basemapUtils.js";import{isQuery as C,isGraphic as D}from"../../../support/guards.js";import{I3SPointsWorkerHandle as S}from"./I3SPointsWorkerHandle.js";import{LayerView3D as F}from"./LayerView3D.js";import{Graphics3DFeatureProcessor as G}from"./graphics/Graphics3DFeatureProcessor.js";import{QueryEngine as A}from"./graphics/QueryEngine.js";import{QueryEngineContext as V}from"./graphics/QueryEngineContext.js";import{createInteractiveEditSession as P,normalizeEditResultsEvent as L,processAttributeEdits as R}from"./i3s/featureEditing.js";import{getCachedAttributeValue as M}from"./i3s/I3SBinaryReader.js";import{I3SGraphicsMap as H}from"./i3s/I3SGraphicsMap.js";import{I3SOverrides as Q}from"./i3s/I3SOverrides.js";import{checkRecyclable as U,checkSpatialReferences as q,containsDraco as T,whenGraphicAttributes as B}from"./i3s/I3SUtil.js";import{attributeLookup as k}from"./support/attributeUtils.js";import{DefinitionExpressionSceneLayerView as z}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as W}from"./support/fieldProperties.js";import{normalizeHighlightTargetExceptQuery as K,emptyHighlightHandle as Z,isObjectId as Y}from"./support/highlightUtils.js";import{LayerViewPerformanceInfo as $}from"./support/LayerViewPerformanceInfo.js";import{PopupSceneLayerView as J}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as X}from"./support/SceneLayerViewRequiredFields.js";import{TemporalSceneLayerView as ee}from"./support/TemporalSceneLayerView.js";import{debugFlags as te}from"../support/debugFlags.js";import{compute as re}from"../support/orientedBoundingBox.js";import{updatingProgress as ie}from"../support/updatingProperties.js";import{Vertices as se}from"../webgl-engine/lib/Attribute.js";import{UpdatePolicy as oe}from"../webgl-engine/lib/UpdatePolicy.js";import ae from"../../layers/SceneLayerView.js";import{hasPopupTemplate as ne}from"../../layers/support/popupUtils.js";import{defaultHighlightName as le}from"../../support/HighlightDefaults.js";import{hasLayerBasedScaleVisibility as de,isInEffectiveScaleRange as ue}from"../../support/layerViewUtils.js";import{TaskPriority as he}from"../../support/Scheduler.js";const pe=W();class ce{constructor(e,t,r,i){this.graphics=e,this.featureIds=t,this.attributeInfo=r,this.node=i}get cachedMemory(){return this.graphics.reduce((e,t)=>I(t)+e,i(this.featureIds)+1024)}}let me=class extends(ee(z(J(F(ae))))){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 H((e,t,r)=>_e(e,t,r),e=>this.processor.graphicsCore.recreateGraphics(e)),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?e.load(t).then(()=>{s(t),U(this.layer,e,this._i3sOverrides),this.layer=e,this._i3sOverrides.destroy();const i=this.view.resourceController?.memoryController;this._i3sOverrides=new Q({view:this.view,layer:e,memoryController:i}),r(this._queryEngine),this._setupQueryEngine(),this.processor.resetObjectStates()}):null}initialize(){this.addResolvingPromise(this.layer.indexInfo);const e=this.view.resourceController?.memoryController;this._i3sOverrides=new Q({view:this.view,layer:this.layer,memoryController:e}),q(this.layer,this.view.spatialReference,this.view.viewingMode),this._fieldsHelper=new X({layerView:this}),this._updatingHandles.add(()=>this.layer.rangeInfos,e=>this._rangeInfosChanged(e),o),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 G({owner:this,preferredUpdatePolicy:oe.ASYNC,scaleVisibilityEnabled:!de(),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=b("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 w({layerView:this}),T(this.layer.geometryDefinitions)&&(this._worker=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=>{const t=this._pendingEditsQueue.then(()=>this._handleEdits(e)).then();this._pendingEditsQueue=t,this._updatingHandles.addPromise(t)}),a(()=>te.I3S_TREE_SHOW_TILES,e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then(({I3STreeDebugger:t})=>{!this._treeDebugger&&te.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))})}else e||!this._treeDebugger||te.I3S_TREE_SHOW_TILES||(this._treeDebugger.destroy(),this._treeDebugger=null)},o)]),this.when(()=>{this._setupQueryEngine(),this._updatingHandles.add(()=>this.maximumNumberOfFeatures,e=>this._controller.featureTarget=e,o),this._updatingHandles.add(()=>this.suspended,e=>{e&&this._removeAllNodeData()})})}destroy(){this._treeDebugger=r(this._treeDebugger),this._i3sOverrides=r(this._i3sOverrides),this._set("processor",r(this.processor)),this._controller=r(this._controller),this._queryEngine=r(this._queryEngine),this._worker=r(this._worker),this._memCache=r(this._memCache),this.loadedGraphics.clear(),this._fieldsHelper=r(this._fieldsHelper)}get i3slayer(){return this.layer}get layerViewUid(){return this.uid}get updatingProgressValue(){return this._controller?.updatingProgress??1}get visibleAtCurrentScale(){return de()?ue(this.layer.effectiveScaleRange,this.view.scale):!this.processor?.scaleVisibilitySuspended}get requiredFields(){return this._fieldsHelper?.requiredFields??[]}get maximumNumberOfFeatures(){const e=this.processor?.graphicsCore?.displayFeatureLimit;return e?.maximumNumberOfFeatures??0}set maximumNumberOfFeatures(e){null!=e?(this._override("maximumNumberOfFeatures",e),this._controller.fixedFeatureTarget=!0):(this._clearOverride("maximumNumberOfFeatures"),this._controller.fixedFeatureTarget=!1)}get maximumNumberOfFeaturesExceeded(){return!this.suspended&&(!!this._controller?.useMaximumNumberOfFeatures&&!this._controller.leavesReached)}get _excludeObjectIds(){return new Set(this.layer.excludeObjectIds)}get lodFactor(){return"Labels"===this.layer.semantic?1:this.view.qualitySettings.sceneService.point.lodFactor}get hasM(){return!1}get hasZ(){return!0}get contentVisible(){return!this.suspended&&!!this._controller?.rootNodeVisible}get legendEnabled(){return this.contentVisible&&!0===this.i3slayer?.legendEnabled}async whenGraphicAttributes(e,t){return B(this.layer,e,this._getObjectIdField(),t,()=>[...this.loadedGraphics.nodes()])}getHit(e){if(!this.loadedGraphics)return null;const t=E(this.loadedGraphics.find(t=>t.uid===e),this.layer),r=this._getObjectIdField();return t?.attributes?.[r]?(t.layer=this.layer,t.sourceLayer=this.layer,{type:"graphic",graphic:t,layer:t.layer}):null}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){const r=t?.name??le,i=this.layer.objectIdField;if(C(e))return this.processor.highlightByQuery(e,i,r);const s=K(e);if(0===s.length)return Z;if(D(s[0])){const e=s;if(null!=k(this.layer.fieldsIndex,e[0].attributes,i)){const t=e.map(e=>k(this.layer.fieldsIndex,e.attributes,i));return this.processor.highlightByObjectIds(t,i,r)}return this.processor.highlightByGraphics(e,r)}return Y(s[0])?this.processor.highlightByObjectIds(s,i,r):Z}get updatePolicy(){return this.processor.graphicsCore.effectiveUpdatePolicy}createInteractiveEditSession(e){return P(this._attributeEditingContext,e)}async _decompressBinaryPointData(e,t){const r={geometryBuffer:e.geometryBuffer};null==this._worker&&(this._worker=new S(e=>this.view.resourceController.immediate.schedule(e)));const i=await this._worker.invoke(r,t);if(null==i)throw new Error("Failed to decompress Draco point data");return{positionData:i.positions,featureIds:i.featureIds}}async addNode(e,r,i){if(!fe(r)&&!ye(r))throw new Error;if(this.loadedGraphics.hasNode(e.index))return void t.getLogger(this).error("I3S node "+e.id+" already added");const s=null!=this.layer.fullExtent?ve(this.layer.fullExtent.clone(),.5):null,{featureIds:o,pointPositions:a}=fe(r)?await this._extractBinaryPointPositions(e,r,i):this._extractLegacyPointPositions(r),n=new Array;this._validatePositions(e,o,a,s,n);const l=this._controller.crsVertex,d=this.view.spatialReference;c(a,l,0,a,d,0,o.length);const u=fe(r)?e.level:0,h=this._createGraphics(o,a,e.index,u),p=new ce(h,o,r.attributeDataInfo,e);if(await this._i3sOverrides.applyAttributeOverrides(p.featureIds,r.attributeDataInfo,i),e.numFeatures=p.graphics.length,this._updateNodeMemory(e),be(p),n.length>0&&(this._computeObb(e,n,l),this._controller.updateVisibility(e.index)),!this._controller.isGeometryVisible(e))return void this._cacheNodeData(p);if(null!=this._verticalScale)for(const t of p.graphics)this._verticalScale(t.geometry);const m=this.view.stage.renderView.olidRenderHelper;if(m){const e=O(this.view,this.uid);for(let t=0;t<p.featureIds.length;t++){const r=p.featureIds[t];m.setUidToObjectAndLayerId(r,p.graphics[t].uid,this.layer.id,this.uid,this.layer.popupEnabled&&!e&&ne(this.layer,this.view.popup?.defaultPopupTemplateEnabled),p.node.resources.attributes,t)}}this.loadedGraphics.addNode(e.index,p),this._controller.updateLoadStatus(e.index,!0),this._filterNode(p),this._treeDebugger&&this._treeDebugger.update()}_computeObb(e,t,r){const i=this._controller.crsIndex,s=i.isGeographic?this.view.renderSpatialReference:i;c(t,r,0,t,s,0),e.serviceObbInIndexSR=re(new se(t,3)),i.isGeographic&&(m(e.serviceObbInIndexSR.center,s,xe,i),e.serviceObbInIndexSR.center=xe)}isNodeLoaded(e){return this.loadedGraphics.hasNode(e)}isNodeReloading(){return!1}updateNodeState(){}getNodeComponentHandle(){}async _extractBinaryPointPositions(e,t,r){const i=await this._decompressBinaryPointData(t,r),s=i.positionData,o=3,a=s.length/o,n=f(3*a),l=null!=e.serviceObbInIndexSR?e.serviceObbInIndexSR.center:p,d=Math.abs(l[2])*2**-20;for(let u=0;u<a;u++){const e=u*o;n[e]=s[e]+l[0],n[e+1]=s[e+1]+l[1],n[e+2]=s[e+2]+l[2],Math.abs(n[e+2])<d&&(n[e+2]=0)}return{featureIds:i.featureIds?_(i.featureIds):[],pointPositions:n}}_extractLegacyPointPositions(e){const t=e.pointData.length,r=f(3*t),i=new Array;for(let s=0;s<t;s++){const t=e.pointData[s],o=t.featureDataPosition,a=o.length,n=t.geometries?.[0]??Ie[a],l=t.featureIds[0];if("Embedded"!==n.type||"points"!==n.params.type||a<2||a>3)continue;const d=n.params.vertexAttributes?.position??[0,0,0],u=3*i.length;r[u]=o[0]+d[0],r[u+1]=o[1]+d[1],r[u+2]=3===a?o[2]+d[2]:NaN,i.push(l)}return{featureIds:i,pointPositions:r}}_validatePositions(e,r,i,s,o){if(null==s&&e.serviceObbInIndexSR)return;const a=r.length,n=3;for(let l=0;l<a;l++){const r=l*n;u(xe,i[r],i[r+1],i[r+2]);const a=!Number.isNaN(i[2]);null==s||(a?g(s,xe):y(s,xe))||(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||o.push(xe[0],xe[1],xe[2])}}_createGraphics(e,t,r,i){const s=e.length,o=3,a=this._getObjectIdField(),l=this.processor.graphicsCore,d=new Array,u=this.view.spatialReference;for(let h=0;h<s;h++){const s=e[h],p={};null!=s&&(p[a]=s);const c=s??n(),m=h*o,g=isNaN(t[m+2])?void 0:t[m+2],y=x(t[m],t[m+1],g,u),f=this.loadedGraphics.get(c);if(null!=f)(null==f.level||f.level<i)&&(Ee.property="geometry",Ee.graphic=f,Ee.oldValue=f.geometry,Ee.newValue=y,f.geometry=y,f.level=i,l.graphicUpdateHandler(Ee),we()),d.push(f);else{const e=n();d.push({objectId:c,uid:e,geometry:y,attributes:p,visible:!0,nodeIndex:r,level:i})}}return d}_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){const t=e.node;this._updateNodeMemory(t),this._cacheNodeData(e)}this._controller.updateLoadStatus(t,!1)}),this._treeDebugger&&this._treeDebugger.update(),this.loadedGraphics.clear()}removeNode(e){const t=this._removeNodeStageData(e);t&&(this._updateNodeMemory(t.node),this._cacheNodeData(t))}_removeNodeStageData(e){const t=this.loadedGraphics.getNode(e);return null==t?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,r,i,s){this.loadedGraphics.hasNode(e.index)?t.getLogger(this).error("I3S node "+e.id+" already added"):(await this._i3sOverrides.applyAttributeOverrides(r.featureIds,i,s),r.attributeInfo=i,this.loadedGraphics.addNode(e.index,r),this._controller.updateLoadStatus(e.index,!0),this._updateNodeMemory(e),be(r),this._filterNode(r),this._treeDebugger&&this._treeDebugger.update())}getLoadedNodeIds(){const e=[];return this.loadedGraphics.forEachNode(t=>e.push(t.node.id)),e.sort()}getVisibleNodes(){const e=new Array;return this.loadedGraphics.forEachNode(t=>e.push(t.node)),e}getLoadedNodeIndices(e){this.loadedGraphics.forEachNode((t,r)=>e.push(r))}getLoadedAttributes(e){const t=this.loadedGraphics.getNode(e);if(null!=t?.attributeInfo)return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this.loadedGraphics.getNode(e);if(null!=t?.attributeInfo)return t.attributeInfo.attributeData}_setAttributeData(e,t){const r=this.loadedGraphics.getNode(e);null!=r?.attributeInfo&&(r.attributeInfo.attributeData=t,this._attributeValuesChanged(r))}async updateAttributes(e,t,r){const i=this.loadedGraphics.getNode(e);null!=i&&(await this._i3sOverrides.applyAttributeOverrides(i.featureIds,t,r),i.attributeInfo=t,this._attributeValuesChanged(i))}_attributeValuesChanged(e){be(e),this._filterNode(e);const{processor:t}=this,{graphicsCore:r}=t;if(r.labelsEnabled){const t=e.node.index,i=new Array;e.graphics.forEach(e=>e.nodeIndex===t&&i.push(e.uid)),r.updateLabelingInfo(i)}t.refreshFilter()}_updateClippingExtent(e){return this._controller&&this._controller.updateClippingArea(e),!1}_getObjectIdField(){return this.layer.objectIdField||v}_getGlobalIdField(){return this.layer.globalIdField}async _rendererChange(e,t){const{layer:{fieldsIndex:r}}=this,i=new Set;let s,o;e?(await e.collectRequiredFields(i,r),s=Array.from(i).sort()):s=[],i.clear(),t?(await t.collectRequiredFields(i,r),o=Array.from(i).sort()):o=[],s.length===o.length&&s.every((e,t)=>s[t]===o[t])||this._reloadAllNodes()}_rangeInfosChanged(e){null!=e&&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){const t=this.parsedDefinitionExpression,r=this._excludeObjectIds,i=this._getObjectIdField();for(const s of e.graphics){const e=s.visible,o=this._evaluateClause(t,s),a=!r.has(s.attributes[i]);s.visible=o&&a,e!==s.visible&&(Ee.graphic=s,Ee.property="visible",Ee.oldValue=e,Ee.newValue=s.visible,this.processor.graphicsCore.graphicUpdateHandler(Ee),we())}}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return this.filter?.createQuery(e)??new N(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(null==e?this.createQuery():N.from(e))}_setupQueryEngine(){const{layer:e,view:t,hasM:r,hasZ:i}=this,{spatialReference:s,resourceController:o}=t,a=new V(s,e,o,()=>this.processor.featureStore,i,r);this._queryEngine=new A({context:a,priority:he.FEATURE_QUERY_ENGINE})}get usedMemory(){return this.processor?.graphicsCore?.usedMemory??0}get unloadedMemory(){return.8*((this._controller?.unloadedMemoryEstimate??0)+(this.processor?.graphicsCore?.unprocessedMemoryEstimate??0))}get ignoresMemoryFactor(){return this._controller&&this._controller.fixedFeatureTarget}async _handleEdits(e){const t=this._attributeEditingContext,r=await L(t,e);R(t,r)}get _attributeEditingContext(){const 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.i3slayer.attributeStorageInfo??[],i3sOverrides:this._i3sOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(t,r,i)=>{this._setAttributeData(t,r);const s=this.loadedGraphics.getNode(t);if(null!=i){const t=this.loadedGraphics.get(i.attributes[e]);null!=t&&this.processor.graphicsCore.recreateGraphics([t])}else null!=s&&this.processor.graphicsCore.recreateGraphics(s.graphics)},clearMemCache:()=>{}}}get performanceInfo(){return new $(this.usedMemory,this.loadedGraphics.length,-1,this.maximumNumberOfFeatures,this.loadedGraphics.nodeCount,this.processor.graphicsCore.performanceInfo)}get test(){}};e([l()],me.prototype,"processor",void 0),e([l({type:j})],me.prototype,"filter",void 0),e([l()],me.prototype,"loadedGraphics",void 0),e([l()],me.prototype,"i3slayer",null),e([l()],me.prototype,"layerViewUid",null),e([l()],me.prototype,"_controller",void 0),e([l()],me.prototype,"updating",void 0),e([l()],me.prototype,"suspended",void 0),e([l(ie)],me.prototype,"updatingProgress",void 0),e([l()],me.prototype,"updatingProgressValue",null),e([l({readOnly:!0})],me.prototype,"visibleAtCurrentScale",null),e([l(pe.requiredFields)],me.prototype,"requiredFields",null),e([l(pe.availableFields)],me.prototype,"availableFields",void 0),e([l()],me.prototype,"_fieldsHelper",void 0),e([l({type:Number})],me.prototype,"maximumNumberOfFeatures",null),e([l({readOnly:!0})],me.prototype,"maximumNumberOfFeaturesExceeded",null),e([l()],me.prototype,"_excludeObjectIds",null),e([l({readOnly:!0})],me.prototype,"lodFactor",null),e([l({readOnly:!0})],me.prototype,"hasM",null),e([l({readOnly:!0})],me.prototype,"hasZ",null),e([l()],me.prototype,"contentVisible",null),e([l({readOnly:!0})],me.prototype,"legendEnabled",null),me=e([d("esri.views.3d.layers.SceneLayerGraphicsView3D")],me);const ge=me;function ye(e){return"pointData"in e}function fe(e){return"geometryBuffer"in e&&null!==e.geometryBuffer}function _e(e,t,r){const i=t.attributeInfo;if(null==i?.loadedAttributes||null==i.attributeData)return!1;let s=!1;for(const{name:o}of i.loadedAttributes)if(i.attributeData[o]){const t=M(i.attributeData[o],r);t!==e.attributes[o]&&(e.attributes[o]=t,s=!0)}return s}function be(e){const t=e.attributeInfo;if(null==t?.loadedAttributes||null==t.attributeData)return;const r=e.node.index;for(let i=0;i<e.graphics.length;i++){const s=e.graphics[i];if(s.nodeIndex===r){s.attributes||(s.attributes={});for(const{name:e}of t.loadedAttributes)t.attributeData[e]&&(s.attributes[e]=M(t.attributeData[e],i))}}}function ve(e,t){return e.xmin-=t,e.ymin-=t,e.xmax+=t,e.ymax+=t,null!=e.zmin&&null!=e.zmax&&(e.zmin-=t,e.zmax+=t),null!=e.mmin&&null!=e.mmax&&(e.mmin-=t,e.mmax+=t),e}const Ie={2:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0]}}},3:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0,0]}}}},xe=h(),Ee={graphic:null,property:null,oldValue:null,newValue:null};function we(){Ee.graphic=null,Ee.property=null,Ee.oldValue=null,Ee.newValue=null}export{ge as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import i from"../../../../core/HeapSort.js";import s from"../../../../core/PooledArray.js";import{intersects as t}from"../../../../geometry/support/aaBoundingRect.js";import{drawPoly as c,drawAccelerationStruct as n}from"./deconflictorDebug.js";class e{constructor(i,s,t){this._setVisibility=i,this._canConflict=s,this._compare=t,this.done=!1,this._items=new Array,this._accBinsNumX=15,this._accBinsNumY=20,this._accBinsSizeX=0,this._accBinsSizeY=0,this._accBins=null}destroy(){this._generator=null}reset(i,s){this._initBins(i,s),this._items.length=0,this.done=!1,this._generator=null}add(i){this._items.push(i)}run(i){this._generator??=this._run(i),this.done=!!this._generator.next(i).done}*_run(i){yield*this._sort(i),yield*this._deconflict(i),n(()=>({bins:this._accBins,numX:this._accBinsNumX,numY:this._accBinsNumY,sizeX:this._accBinsSizeX,sizeY:this._accBinsSizeY,numTests:0,numVisible:this._items.length}))}*_sort(s){for(const t of i.iterableSort(this._items,0,this._items.length,this._compare))s.madeProgress(),s.done&&(s=yield)}_isConflicted(i){let s=!0;return this._forEachBin(i.aabr,c=>(s=!1,c.some(s=>this._canConflict(s,i)&&t(s.aabr,i.aabr))))||s}*_deconflict(i){for(const s of this._items){i.done&&(i=yield);const t=!this._isConflicted(s);this._setVisibility(s,t),c(s.aabr,t),t&&this._addToBins(s),i.madeProgress()}}_initBins(i,t){if(null==this._accBins){this._accBins=[];for(let i=0;i<this._accBinsNumX;i++){this._accBins.push([]);const i=this._accBins[this._accBins.length-1];for(let t=0;t<this._accBinsNumY;t++)i.push(new s)}}else for(let s=0;s<this._accBinsNumX;s++)for(let i=0;i<this._accBinsNumY;i++)this._accBins[s][i].clear();this._accBinsSizeX=i/this._accBinsNumX,this._accBinsSizeY=t/this._accBinsNumY}_addToBins(i){this._forEachBin(i.aabr,s=>s.push(i))}_forEachBin(i,s){if(!this._accBins)return!1;const t=Math.max(Math.floor(i[0]/this._accBinsSizeX),0),c=Math.max(Math.floor(i[1]/this._accBinsSizeY),0),n=Math.min(Math.floor(i[2]/this._accBinsSizeX),this._accBinsNumX-1),e=Math.min(Math.floor(i[3]/this._accBinsSizeY),this._accBinsNumY-1);for(let h=t;h<=n;h++)for(let i=c;i<=e;i++)if(s(this._accBins[h][i]))return!0;return!1}}export{e as DeconflictAABR};
5
+ import i from"../../../../core/HeapSort.js";import s from"../../../../core/PooledArray.js";import{intersects as t}from"../../../../geometry/support/aaBoundingRect.js";import{drawPoly as n,drawAccelerationStruct as c}from"./deconflictorDebug.js";class e{constructor(i,s,t){this._setVisibility=i,this._canConflict=s,this._compare=t,this.done=!1,this._items=new Array,this._accBinsNumX=15,this._accBinsNumY=20,this._accBinsSizeX=0,this._accBinsSizeY=0,this._accBins=null}destroy(){this._generator=null,this._accBins=null,this._items.length=0}reset(i,s){this._initBins(i,s),this._items.length=0,this.done=!1,this._generator=null}add(i){this._items.push(i)}run(i){this._generator??=this._run(i),this.done=!!this._generator.next(i).done}*_run(i){yield*this._sort(i),yield*this._deconflict(i),c(()=>({bins:this._accBins,numX:this._accBinsNumX,numY:this._accBinsNumY,sizeX:this._accBinsSizeX,sizeY:this._accBinsSizeY,numTests:0,numVisible:this._items.length}))}*_sort(s){for(const t of i.iterableSort(this._items,0,this._items.length,this._compare))s.madeProgress(),s.done&&(s=yield)}_isConflicted(i){let s=!0;return this._forEachBin(i.aabr,n=>(s=!1,n.some(s=>this._canConflict(s,i)&&t(s.aabr,i.aabr))))||s}*_deconflict(i){for(const s of this._items){i.done&&(i=yield);const t=!this._isConflicted(s);this._setVisibility(s,t),n(s.aabr,t),t&&this._addToBins(s),i.madeProgress()}}_initBins(i,t){if(null==this._accBins){this._accBins=[];for(let i=0;i<this._accBinsNumX;i++){this._accBins.push([]);const i=this._accBins[this._accBins.length-1];for(let t=0;t<this._accBinsNumY;t++)i.push(new s)}}else for(let s=0;s<this._accBinsNumX;s++)for(let i=0;i<this._accBinsNumY;i++)this._accBins[s][i].clear();this._accBinsSizeX=i/this._accBinsNumX,this._accBinsSizeY=t/this._accBinsNumY}_addToBins(i){this._forEachBin(i.aabr,s=>s.push(i))}_forEachBin(i,s){if(!this._accBins)return!1;const t=Math.max(Math.floor(i[0]/this._accBinsSizeX),0),n=Math.max(Math.floor(i[1]/this._accBinsSizeY),0),c=Math.min(Math.floor(i[2]/this._accBinsSizeX),this._accBinsNumX-1),e=Math.min(Math.floor(i[3]/this._accBinsSizeY),this._accBinsNumY-1);for(let h=t;h<=c;h++)for(let i=n;i<=e;i++)if(s(this._accBins[h][i]))return!0;return!1}}export{e as DeconflictAABR};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/has.js";import t from"../../../../core/PooledArray.js";import{create as e,copy as r,area as s,expand as n,contains as o}from"../../../../geometry/support/aaBoundingRect.js";import{noBudget as i}from"../../../support/Scheduler.js";const h=.05;class a{constructor(){this._extents=new t({allocator:t=>t||e()}),this._tmpExtent=e(),this._dirty=!1}get empty(){return 0===this._extents.length}get size(){return this._extents.length}clear(){this._extents.clear()}add(t){this._contains(t)||(this._removeContained(t),r(this._extents.pushNew(),t),this._dirty=!0)}pop(){return this._dirty&&this._mergeTight(),this._extents.pop()}merge(t){return this._mergeTight(t),t.hasProgressed}_mergeTight(t=i){const e=this._extents,o=new Set;let a=0;for(;a!==e.length;){e.sort((t,e)=>t[0]-e[0]),a=e.length,o.clear();for(let i=0;i<e.length;++i){if(t.done)return;const a=e.at(i);if(a){for(let t=i+1;t<e.length;++t){const r=e.at(t);if(null==r||r[0]>=a[2])break;o.add(r)}o.forEach(i=>{if(a===i)return;if(i[2]<=a[0])return void o.delete(i);const l=s(a),_=s(i),c=this._tmpExtent;n(a,i,c);const d=l+_;(s(c)-d)/d<h&&(r(a,c),o.delete(i),e.remove(i),t.madeProgress())}),o.add(a)}}}this._dirty=!1}_contains(t){return this._extents.some(e=>o(e,t))}_removeContained(t){this._extents.filterInPlace(e=>!o(t,e))}get test(){}}export{a as ExtentSet};
5
+ import"../../../../core/has.js";import t from"../../../../core/PooledArray.js";import{create as e,copy as r,area as s,expand as n,contains as o}from"../../../../geometry/support/aaBoundingRect.js";import{noBudget as i}from"../../../support/Scheduler.js";const h=.05;class a{constructor(){this._extents=new t({allocator:t=>t||e()}),this._tmpExtent=e(),this._dirty=!1}destroy(){this._extents.prune()}get empty(){return 0===this._extents.length}get size(){return this._extents.length}clear(){this._extents.clear()}add(t){this._contains(t)||(this._removeContained(t),r(this._extents.pushNew(),t),this._dirty=!0)}pop(){return this._dirty&&this._mergeTight(),this._extents.pop()}merge(t){return this._mergeTight(t),t.hasProgressed}_mergeTight(t=i){const e=this._extents,o=new Set;let a=0;for(;a!==e.length;){e.sort((t,e)=>t[0]-e[0]),a=e.length,o.clear();for(let i=0;i<e.length;++i){if(t.done)return;const a=e.at(i);if(a){for(let t=i+1;t<e.length;++t){const r=e.at(t);if(null==r||r[0]>=a[2])break;o.add(r)}o.forEach(i=>{if(a===i)return;if(i[2]<=a[0])return void o.delete(i);const l=s(a),_=s(i),d=this._tmpExtent;n(a,i,d);const c=l+_;(s(d)-c)/c<h&&(r(a,d),o.delete(i),e.remove(i),t.madeProgress())}),o.add(a)}}}this._dirty=!1}_contains(t){return this._extents.some(e=>o(e,t))}_removeContained(t){this._extents.filterInPlace(e=>!o(t,e))}get test(){}}export{a as ExtentSet};