@arcgis/core 4.22.0-next.20211021 → 4.22.0-next.20211025

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 (440) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/00ac1ce56f9885a8be83.js +1 -0
  3. package/assets/esri/core/workers/chunks/01c9afe41ab4ccc597c9.js +1 -0
  4. package/assets/esri/core/workers/chunks/02a3d14adc504a51fa24.js +1 -0
  5. package/assets/esri/core/workers/chunks/035a9ab0202d5386b782.js +1 -0
  6. package/assets/esri/core/workers/chunks/062bace5505f13689c7d.js +1 -0
  7. package/assets/esri/core/workers/chunks/06c7745d813bcb540ce8.js +1 -0
  8. package/assets/esri/core/workers/chunks/0950b488a60b2abc21fc.js +1 -0
  9. package/assets/esri/core/workers/chunks/0af396f2e0de681113ef.js +1 -0
  10. package/assets/esri/core/workers/chunks/131838059f0f81d8eaee.js +1 -0
  11. package/assets/esri/core/workers/chunks/146cba0d172ec2f4eba2.js +1 -0
  12. package/assets/esri/core/workers/chunks/17e49c0dfa5a5a6213e2.js +1 -0
  13. package/assets/esri/core/workers/chunks/1a0b08190274725dc956.js +1 -0
  14. package/assets/esri/core/workers/chunks/1add7f0779accdf8d204.js +1 -0
  15. package/assets/esri/core/workers/chunks/20b81d11e6286d347bfc.js +1 -0
  16. package/assets/esri/core/workers/chunks/{e596bd3de960d1dc1c57.js → 2207580a78ee292ed9b8.js} +1 -1
  17. package/assets/esri/core/workers/chunks/2d3646a83465c75986f9.js +1 -0
  18. package/assets/esri/core/workers/chunks/2d38ee3ef3ebe32a1194.js +1 -0
  19. package/assets/esri/core/workers/chunks/3737dcc3c0dea3ca05d5.js +1 -0
  20. package/assets/esri/core/workers/chunks/3e2042e70647c1afa6aa.js +1 -0
  21. package/assets/esri/core/workers/chunks/3ebfaab2855a2236a95d.js +1 -0
  22. package/assets/esri/core/workers/chunks/{d6fe616192a8efbfbc3e.js → 440f8101402a4c0d7019.js} +1 -1
  23. package/assets/esri/core/workers/chunks/4587d770767966985e22.js +1 -0
  24. package/assets/esri/core/workers/chunks/487b8892fae85810a8c0.js +1 -0
  25. package/assets/esri/core/workers/chunks/4901a78f32c3ea6b823b.js +1 -0
  26. package/assets/esri/core/workers/chunks/496fe47fc4d28e1a716d.js +1 -0
  27. package/assets/esri/core/workers/chunks/{9f22f47d4b2e72d7bdcf.js → 4c010119c24510ea31bb.js} +2 -2
  28. package/assets/esri/core/workers/chunks/{9f22f47d4b2e72d7bdcf.js.LICENSE.txt → 4c010119c24510ea31bb.js.LICENSE.txt} +0 -0
  29. package/assets/esri/core/workers/chunks/4f5076e1f2b18ce8156d.js +1 -0
  30. package/assets/esri/core/workers/chunks/{f291ebc4b089bd1f0a3f.js → 50e86a6bb13042b1dbac.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{64d9a062c1f1ac08a3ac.js → 565020b1c02a8cb33c2b.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{d78c60a22f76df7c48c7.js → 59640d78295e2e363f18.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{a0356f320a1b2fbd03f0.js → 5ac2b2598245aa17cdbd.js} +1 -1
  34. package/assets/esri/core/workers/chunks/5b4a8cce5601cc92c8a3.js +1 -0
  35. package/assets/esri/core/workers/chunks/5b92d5d4049622531109.js +1 -0
  36. package/assets/esri/core/workers/chunks/{751c1a2838b54a74a9a6.js → 5f3caa0ddb215342c728.js} +2 -2
  37. package/assets/esri/core/workers/chunks/615e995d5ce8fa044b09.js +1 -0
  38. package/assets/esri/core/workers/chunks/62a2453699e0dd2393b9.js +1 -0
  39. package/assets/esri/core/workers/chunks/67013547be1a7ae1670a.js +1 -0
  40. package/assets/esri/core/workers/chunks/67eddf4808f8888faeb4.js +1 -0
  41. package/assets/esri/core/workers/chunks/695dbedff2340aa019ba.js +1 -0
  42. package/assets/esri/core/workers/chunks/6a7e388c94206d2f61ff.js +1 -0
  43. package/assets/esri/core/workers/chunks/6e22b69d55e791ab3d9a.js +1 -0
  44. package/assets/esri/core/workers/chunks/71e6c0c5ef0aa7eb1703.js +1 -0
  45. package/assets/esri/core/workers/chunks/7a74e230439c5111f852.js +1 -0
  46. package/assets/esri/core/workers/chunks/7e76a8e6fa67e607d09e.js +1 -0
  47. package/assets/esri/core/workers/chunks/7fe4985ca0cb3e6d35c6.js +1 -0
  48. package/assets/esri/core/workers/chunks/8027330714ff5ffb020e.js +1 -0
  49. package/assets/esri/core/workers/chunks/844b564d1a422a17f6ac.js +1 -0
  50. package/assets/esri/core/workers/chunks/856f9281a08cb032238e.js +1 -0
  51. package/assets/esri/core/workers/chunks/89b4983de872780e9aa1.js +1 -0
  52. package/assets/esri/core/workers/chunks/8f3bc0cd2c2b01ab80cd.js +1 -0
  53. package/assets/esri/core/workers/chunks/8fd912e325ccd48b98a9.js +1 -0
  54. package/assets/esri/core/workers/chunks/901907a5c01f0fd1478f.js +1 -0
  55. package/assets/esri/core/workers/chunks/92a0b88a14c92239df8a.js +1 -0
  56. package/assets/esri/core/workers/chunks/972e9aeb3c29c9bf441a.js +1 -0
  57. package/assets/esri/core/workers/chunks/9758c34ce61c3714515a.js +1 -0
  58. package/assets/esri/core/workers/chunks/{457ea4feaa006d60c6b1.js → 9a04d087a29f0f3937a3.js} +1 -1
  59. package/assets/esri/core/workers/chunks/9b0bb171224b35ce2031.js +1 -0
  60. package/assets/esri/core/workers/chunks/9cbe7afdaef8720dfc8d.js +1 -0
  61. package/assets/esri/core/workers/chunks/9ccde5b6562f0007fe45.js +1 -0
  62. package/assets/esri/core/workers/chunks/9d320bbeedeea15522ab.js +1 -0
  63. package/assets/esri/core/workers/chunks/a001b3b4527817548094.js +1 -0
  64. package/assets/esri/core/workers/chunks/{197b72bca45065e0eb4a.js → a0c580d4a1915ddd3fe4.js} +1 -1
  65. package/assets/esri/core/workers/chunks/a4a9c15929b43d83701f.js +1 -0
  66. package/assets/esri/core/workers/chunks/a54d11f44721f808b82f.js +1 -0
  67. package/assets/esri/core/workers/chunks/a646a11673d513c00e7a.js +1 -0
  68. package/assets/esri/core/workers/chunks/a792e2bc7cafdc29f05e.js +1 -0
  69. package/assets/esri/core/workers/chunks/acae1771697034f265b1.js +1 -0
  70. package/assets/esri/core/workers/chunks/af2ee804a9c63eea610c.js +1 -0
  71. package/assets/esri/core/workers/chunks/b28b487047da3aeef3fd.js +1 -0
  72. package/assets/esri/core/workers/chunks/b3e57824a5855cb37a96.js +1 -0
  73. package/assets/esri/core/workers/chunks/b89449ead32e4cd21edd.js +1 -0
  74. package/assets/esri/core/workers/chunks/b99891ed5a02cab02173.js +1 -0
  75. package/assets/esri/core/workers/chunks/bac84bc621be73a7a4bc.js +1 -0
  76. package/assets/esri/core/workers/chunks/{25037dcf8a0c72b7b647.js → bbe068388167e9dd0c11.js} +1 -1
  77. package/assets/esri/core/workers/chunks/c271a1857bcc4e9a36dd.js +1 -0
  78. package/assets/esri/core/workers/chunks/{eb3035e49a45ecc82575.js → c5030664720fcdc6d85e.js} +1 -1
  79. package/assets/esri/core/workers/chunks/c534ed122f8a1202d3a3.js +1 -0
  80. package/assets/esri/core/workers/chunks/c5ef2e28b0c539ddb6a7.js +1 -0
  81. package/assets/esri/core/workers/chunks/c65e5ccfae03d148d82b.js +1 -0
  82. package/assets/esri/core/workers/chunks/c91660f3982be4e03705.js +1 -0
  83. package/assets/esri/core/workers/chunks/ce93113b99bdbeddd07b.js +1 -0
  84. package/assets/esri/core/workers/chunks/cf2d408e669cfa2c65be.js +1 -0
  85. package/assets/esri/core/workers/chunks/d08f63ffeecefa02ad91.js +1 -0
  86. package/assets/esri/core/workers/chunks/{8d33644192c01e5416b4.js → d1a71b58ef62e71979c5.js} +1 -1
  87. package/assets/esri/core/workers/chunks/d30eade5afecd334f6cb.js +1 -0
  88. package/assets/esri/core/workers/chunks/d8782d0856b9d815cb6c.js +1 -0
  89. package/assets/esri/core/workers/chunks/db16c21b650001502e6c.js +1 -0
  90. package/assets/esri/core/workers/chunks/db18110c57253a31ac96.js +1 -0
  91. package/assets/esri/core/workers/chunks/dbaa5fb466d6c0214f24.js +1 -0
  92. package/assets/esri/core/workers/chunks/deae370788a7aacf4dd5.js +1 -0
  93. package/assets/esri/core/workers/chunks/e6ca132e1eeea3aa174e.js +1 -0
  94. package/assets/esri/core/workers/chunks/e878ccc431729ef3360f.js +1 -0
  95. package/assets/esri/core/workers/chunks/eb124f15ad4b9193f00a.js +1 -0
  96. package/assets/esri/core/workers/chunks/ebc71c06c1c22aaef54e.js +1 -0
  97. package/assets/esri/core/workers/chunks/f183da283af0836421ab.js +1 -0
  98. package/assets/esri/core/workers/chunks/f42bdc2a134833d33b4e.js +1 -0
  99. package/assets/esri/core/workers/chunks/{736d628cda4e02d40337.js → f8612c2fc5739e98be58.js} +1 -1
  100. package/assets/esri/core/workers/chunks/f965e3e5f6f4f9ba54ac.js +1 -0
  101. package/assets/esri/core/workers/chunks/fa4089640f480b69962e.js +1 -0
  102. package/assets/esri/core/workers/chunks/fb219563e5169ea67d68.js +1 -0
  103. package/assets/esri/libs/i3s/i3s.wasm +0 -0
  104. package/chunks/ChapmanAtmosphere.glsl.js +56 -77
  105. package/chunks/Clouds.glsl.js +1 -1
  106. package/chunks/Pattern.glsl.js +9 -11
  107. package/chunks/RibbonLine.glsl.js +60 -68
  108. package/chunks/i3s.js +1 -1
  109. package/chunks/mat4.js +1 -1
  110. package/chunks/vec3.js +1 -1
  111. package/core/Collection.js +1 -1
  112. package/core/Loadable.js +1 -1
  113. package/core/accessorSupport/ensureType.js +1 -1
  114. package/core/promiseUtils.js +1 -1
  115. package/core/support/OwningCollection.js +1 -1
  116. package/core/workers/RemoteClient.js +1 -1
  117. package/core/workers/WorkerOwner.js +1 -1
  118. package/core/workers/workers.js +2 -2
  119. package/geometry/projection.js +1 -1
  120. package/identity/IdentityManagerBase.js +1 -1
  121. package/interfaces.d.ts +205 -497
  122. package/layers/ElevationLayer.js +1 -1
  123. package/layers/GeoJSONLayer.js +1 -1
  124. package/layers/ImageryTileLayer.js +1 -1
  125. package/layers/VectorTileLayer.js +1 -1
  126. package/layers/VoxelWasmPerScene.js +1 -1
  127. package/layers/WCSLayer.js +1 -1
  128. package/layers/analyses/AreaMeasurement3D.js +1 -1
  129. package/layers/analyses/DirectLineMeasurement3D.js +1 -1
  130. package/layers/analyses/Slice.js +1 -1
  131. package/layers/effects/EffectList.js +1 -1
  132. package/layers/effects/effects.js +1 -1
  133. package/layers/effects/jsonUtils.js +1 -1
  134. package/layers/effects/parser.js +1 -1
  135. package/layers/effects/utils.js +5 -0
  136. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  137. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  138. package/layers/graphics/data/QueryEngine.js +1 -1
  139. package/layers/graphics/data/QueryEngineResult.js +1 -1
  140. package/layers/graphics/sources/connections/GeoEventConnection.js +1 -1
  141. package/layers/mixins/ImageryTileMixin.js +1 -1
  142. package/layers/support/RasterWorker.js +1 -1
  143. package/layers/support/TilemapCache.js +1 -1
  144. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  145. package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
  146. package/layers/support/rasterDatasets/WCSRaster.js +1 -1
  147. package/layers/support/rasterFunctions/pixelUtils.js +1 -1
  148. package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
  149. package/package.json +2 -2
  150. package/portal/support/portalLayers.js +1 -1
  151. package/request.js +1 -1
  152. package/smartMapping/renderers/support/utils.js +1 -1
  153. package/smartMapping/statistics/support/WorkerClient.js +1 -1
  154. package/smartMapping/statistics/support/statsWorker.js +1 -1
  155. package/smartMapping/statistics/support/utils.js +1 -1
  156. package/smartMapping/support/adapters/CSVLayerAdapter.js +1 -1
  157. package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
  158. package/smartMapping/support/adapters/SceneLayerAdapter.js +1 -1
  159. package/smartMapping/support/adapters/support/utils.js +1 -1
  160. package/statistics/utils.js +1 -1
  161. package/support/GraphicsCollection.js +1 -1
  162. package/support/revision.js +1 -1
  163. package/symbols/FillSymbol3DLayer.js +1 -1
  164. package/symbols/IconSymbol3DLayer.js +1 -1
  165. package/symbols/LineSymbol3DLayer.js +1 -1
  166. package/symbols/patterns/LinePattern3D.js +5 -0
  167. package/symbols/patterns/LineStylePattern3D.d.ts +4 -0
  168. package/symbols/patterns/LineStylePattern3D.js +5 -0
  169. package/symbols/patterns/StylePattern3D.js +1 -1
  170. package/symbols/patterns/lineStyles.js +5 -0
  171. package/symbols/patterns/utils.js +1 -1
  172. package/symbols/support/Symbol3DFillMaterial.js +1 -1
  173. package/symbols/support/Symbol3DIconOutline.js +5 -0
  174. package/symbols/support/Symbol3DMaterial.js +1 -1
  175. package/symbols/support/Symbol3DOutline.js +1 -1
  176. package/symbols/support/defaults3D.js +1 -1
  177. package/symbols/support/previewSymbol3D.js +1 -1
  178. package/symbols/support/symbolLayerUtils3D.js +1 -1
  179. package/views/2d/engine/vectorTiles/TileParser.js +1 -1
  180. package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
  181. package/views/2d/engine/vectorTiles/style/StyleRepository.js +1 -1
  182. package/views/2d/engine/webgl/effects/HittestEffect.js +1 -1
  183. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  184. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  185. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  186. package/views/2d/layers/VectorTileLayerView2D.js +1 -1
  187. package/views/2d/layers/features/controllers/EditsQueue.js +1 -1
  188. package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
  189. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  190. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  191. package/views/2d/layers/support/FeatureLayerProxy.js +1 -1
  192. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  193. package/views/3d/environment/ChapmanAtmosphereTechnique.js +1 -1
  194. package/views/3d/environment/CloudsGenerator.js +1 -1
  195. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  196. package/views/3d/environment/PanoramicAtmosphere.js +1 -1
  197. package/views/3d/environment/SimpleAtmosphere.js +1 -1
  198. package/views/3d/externalRenderers/ExternalRendererStore.js +1 -1
  199. package/views/3d/externalRenderers.js +1 -1
  200. package/views/3d/interactive/Manipulator3D.js +1 -1
  201. package/views/3d/interactive/analysisTools/slice/SliceTool.js +1 -1
  202. package/views/3d/interactive/analysisTools/slice/images/Factory.js +5 -0
  203. package/views/3d/interactive/analysisTools/slice/sliceToolConfig.js +1 -1
  204. package/views/3d/interactive/analysisTools/slice/sliceToolUtils.js +1 -1
  205. package/views/3d/interactive/editingTools/settings.js +1 -1
  206. package/views/3d/interactive/editingTools/transformGraphic/ExtentTransformTool.js +1 -1
  207. package/views/3d/interactive/graphics/Slice/SliceController.js +1 -1
  208. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
  209. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
  210. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
  211. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  212. package/views/3d/interactive/visualElements/LaserlineVisualElement.js +1 -1
  213. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  214. package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
  215. package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
  216. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  217. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  218. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  219. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  220. package/views/3d/interactive/visualElements/SlicePlaneVisualElement.js +1 -1
  221. package/views/3d/interactive/visualElements/VerticesVisualElement.js +1 -1
  222. package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
  223. package/views/3d/layers/DynamicLayerView3D.js +1 -1
  224. package/views/3d/layers/I3SMeshView3D.js +1 -1
  225. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  226. package/views/3d/layers/VectorTileLayerView3D.js +1 -1
  227. package/views/3d/layers/analyses/AreaMeasurement3D/AreaMeasurementView3D.js +1 -1
  228. package/views/3d/layers/analyses/AreaMeasurement3D/support/AreaMeasurementPathHelper.js +1 -1
  229. package/views/3d/layers/analyses/AreaMeasurement3D/support/AreaMeasurementVisualization.js +1 -1
  230. package/views/3d/layers/analyses/DirectLineMeasurement3D/DirectLineMeasurementView3D.js +1 -1
  231. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  232. package/views/3d/layers/graphics/ElevationAligners.js +1 -1
  233. package/views/3d/layers/graphics/ElevationQuery.js +1 -1
  234. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  235. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  236. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  237. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  238. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  239. package/views/3d/layers/graphics/Graphics3DLodInstanceGraphicLayer.js +1 -1
  240. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  241. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  242. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  243. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  244. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  245. package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
  246. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  247. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  248. package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
  249. package/views/3d/layers/graphics/Labeler.js +1 -1
  250. package/views/3d/layers/graphics/Loadable.js +1 -1
  251. package/views/3d/layers/graphics/ObjectResourceCache.js +1 -1
  252. package/views/3d/layers/graphics/elevationAlignmentUtils.js +1 -1
  253. package/views/3d/layers/graphics/graphicUtils.js +1 -1
  254. package/views/3d/layers/graphics/labelPlacement.js +1 -1
  255. package/views/3d/layers/graphics/pointUtils.js +1 -1
  256. package/views/3d/layers/i3s/I3SAttributeOverrides.js +1 -1
  257. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  258. package/views/3d/layers/i3s/I3SStreamDataController.js +1 -1
  259. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  260. package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
  261. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  262. package/views/3d/layers/support/patternUtils.js +1 -1
  263. package/views/3d/state/GoToOperation.js +1 -1
  264. package/views/3d/state/ViewStateManager.js +1 -1
  265. package/views/3d/support/LaserLineRenderer.js +1 -1
  266. package/views/3d/support/SharedSymbolResources.js +1 -1
  267. package/views/3d/support/StreamDataLoader.js +1 -1
  268. package/views/3d/support/StreamTextureCollection.js +5 -0
  269. package/views/3d/support/TextureCollection.js +1 -1
  270. package/views/3d/support/debugFlags.js +1 -1
  271. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  272. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  273. package/views/3d/support/pointsOfInterest/StableSurfaceCenter.js +1 -1
  274. package/views/3d/terrain/OverlayManager.js +1 -1
  275. package/views/3d/terrain/OverlayRenderTarget.js +1 -1
  276. package/views/3d/terrain/OverlayRenderer.js +1 -1
  277. package/views/3d/terrain/Tile.js +1 -1
  278. package/views/3d/webgl-engine/Stage.js +1 -1
  279. package/views/3d/webgl-engine/core/material/RenderTexture.js +1 -1
  280. package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +13 -12
  281. package/views/3d/webgl-engine/core/shaderLibrary/shading/Reprojection.glsl.js +1 -1
  282. package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +10 -3
  283. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueRepository.js +1 -1
  284. package/views/3d/webgl-engine/lib/Camera.js +1 -1
  285. package/views/3d/webgl-engine/lib/GLMaterialRepository.js +1 -1
  286. package/views/3d/webgl-engine/lib/GLMaterialTexture.js +1 -1
  287. package/views/3d/webgl-engine/lib/GLMaterials.js +1 -1
  288. package/views/3d/webgl-engine/lib/Material.js +1 -1
  289. package/views/3d/webgl-engine/lib/ModelDirtySet.js +1 -1
  290. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  291. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  292. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  293. package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
  294. package/views/3d/webgl-engine/lib/SmaaRenderPass.js +1 -1
  295. package/views/3d/webgl-engine/lib/TextTexture.js +1 -1
  296. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  297. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  298. package/views/3d/webgl-engine/lib/TextureRepository.js +1 -1
  299. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  300. package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
  301. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  302. package/views/3d/webgl-engine/lib/lodRendering/LodComponentData.js +1 -1
  303. package/views/3d/webgl-engine/lib/lodRendering/LodLevel.js +1 -1
  304. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  305. package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
  306. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  307. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  308. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  309. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  310. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  311. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  312. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  313. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  314. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  315. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  316. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  317. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  318. package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
  319. package/views/3d/webgl-engine/materials/WaterGLMaterial.js +1 -1
  320. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  321. package/views/3d/webgl-engine/materials/lineStippleUtils.js +1 -1
  322. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  323. package/views/3d/webgl-engine/parts/Model.js +1 -1
  324. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  325. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  326. package/views/LayerViewManager.js +1 -1
  327. package/views/SceneView.js +1 -1
  328. package/views/ToolViewManager.js +1 -1
  329. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
  330. package/views/support/AllocationTracer.js +1 -1
  331. package/views/support/DefaultsFromMap.js +1 -1
  332. package/views/support/QueueProcessor.js +1 -1
  333. package/views/webgl/capabilities/load.js +1 -1
  334. package/webscene/Slide.js +1 -1
  335. package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
  336. package/widgets/AreaMeasurement3D/AreaMeasurement3DViewModel.js +1 -1
  337. package/widgets/BuildingExplorer/support/layerUtils.js +1 -1
  338. package/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js +1 -1
  339. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
  340. package/widgets/Editor/UpdateWorkflow.js +1 -1
  341. package/widgets/Feature/FeatureViewModel.js +1 -1
  342. package/widgets/Home/HomeViewModel.js +1 -1
  343. package/widgets/Locate/LocateViewModel.js +1 -1
  344. package/widgets/Popup/PopupViewModel.js +1 -1
  345. package/widgets/Search/SearchViewModel.js +1 -1
  346. package/widgets/Search.js +1 -1
  347. package/widgets/Sketch/SketchViewModel.js +1 -1
  348. package/widgets/Slice/SliceViewModel.js +1 -1
  349. package/widgets/TimeSlider/TimeSliderViewModel.js +1 -1
  350. package/assets/esri/core/workers/chunks/0283801d442984997abe.js +0 -1
  351. package/assets/esri/core/workers/chunks/0419e14a520b8fcf3e7a.js +0 -1
  352. package/assets/esri/core/workers/chunks/05318446b6a40caea361.js +0 -1
  353. package/assets/esri/core/workers/chunks/09e714d4381649348ac9.js +0 -1
  354. package/assets/esri/core/workers/chunks/0cecd668b9d5d3f83293.js +0 -1
  355. package/assets/esri/core/workers/chunks/13a73a88efd4f464173e.js +0 -1
  356. package/assets/esri/core/workers/chunks/1576727e8174d672555b.js +0 -1
  357. package/assets/esri/core/workers/chunks/1a3cbeb0a53d03a51dad.js +0 -1
  358. package/assets/esri/core/workers/chunks/1b8524b617bfc6fe422c.js +0 -1
  359. package/assets/esri/core/workers/chunks/1dc1d750046912ff6cef.js +0 -1
  360. package/assets/esri/core/workers/chunks/21fa174c114640be5e40.js +0 -1
  361. package/assets/esri/core/workers/chunks/2a3f6e56079620421a02.js +0 -1
  362. package/assets/esri/core/workers/chunks/2a5bcc73e55986ad93fe.js +0 -1
  363. package/assets/esri/core/workers/chunks/2a6f2e3d639aae491171.js +0 -1
  364. package/assets/esri/core/workers/chunks/2c17d1bad17bcee53f7d.js +0 -1
  365. package/assets/esri/core/workers/chunks/2cea27a0d07aa9a88ad4.js +0 -1
  366. package/assets/esri/core/workers/chunks/2e193d97d199b29b00c2.js +0 -1
  367. package/assets/esri/core/workers/chunks/2eb41fdf0d0a3b0c3232.js +0 -1
  368. package/assets/esri/core/workers/chunks/2f09ea639ca5d1d6ca7e.js +0 -1
  369. package/assets/esri/core/workers/chunks/2fb847ab1440bd1bdf15.js +0 -1
  370. package/assets/esri/core/workers/chunks/402d22ebbae608760b4f.js +0 -1
  371. package/assets/esri/core/workers/chunks/44daef7f0cbc6f6af09f.js +0 -1
  372. package/assets/esri/core/workers/chunks/46899156159e398c693f.js +0 -1
  373. package/assets/esri/core/workers/chunks/46bf8921db25845c63c0.js +0 -1
  374. package/assets/esri/core/workers/chunks/4eb23554e375350f73b5.js +0 -1
  375. package/assets/esri/core/workers/chunks/551917be63a513dfa4de.js +0 -1
  376. package/assets/esri/core/workers/chunks/564f6f5484bcb13ebb2b.js +0 -1
  377. package/assets/esri/core/workers/chunks/61df67ae47b7fb5875d9.js +0 -1
  378. package/assets/esri/core/workers/chunks/62642a8fc7bafe339984.js +0 -1
  379. package/assets/esri/core/workers/chunks/6304f4e53027df04eb8f.js +0 -1
  380. package/assets/esri/core/workers/chunks/6331987617ad166ea098.js +0 -1
  381. package/assets/esri/core/workers/chunks/6b13fcbc71c0088d317e.js +0 -1
  382. package/assets/esri/core/workers/chunks/6f7a6841e7269d2764ad.js +0 -1
  383. package/assets/esri/core/workers/chunks/70110efd2de23d9a5263.js +0 -1
  384. package/assets/esri/core/workers/chunks/7eae3f0588cde44fce39.js +0 -1
  385. package/assets/esri/core/workers/chunks/80d3c7a429c6412f1a8d.js +0 -1
  386. package/assets/esri/core/workers/chunks/80deebdf54bea04a0889.js +0 -1
  387. package/assets/esri/core/workers/chunks/81aa5fe7dcb4fdeb0974.js +0 -1
  388. package/assets/esri/core/workers/chunks/840d08b41913cad4df89.js +0 -1
  389. package/assets/esri/core/workers/chunks/85d154aeb511c5d70bb1.js +0 -1
  390. package/assets/esri/core/workers/chunks/8681e99e2bc9ece61c43.js +0 -1
  391. package/assets/esri/core/workers/chunks/8e5ef967f6518f4c93b1.js +0 -1
  392. package/assets/esri/core/workers/chunks/8edd7f70c8b95c34125c.js +0 -1
  393. package/assets/esri/core/workers/chunks/9044a7b90a53312b6392.js +0 -1
  394. package/assets/esri/core/workers/chunks/905b4dfc1ce57a225fa4.js +0 -1
  395. package/assets/esri/core/workers/chunks/945f90b31ebfae623ea0.js +0 -1
  396. package/assets/esri/core/workers/chunks/9943fd69b67cd1871d68.js +0 -1
  397. package/assets/esri/core/workers/chunks/9ad91c23480ffb656030.js +0 -1
  398. package/assets/esri/core/workers/chunks/9d103681372ab01a4147.js +0 -1
  399. package/assets/esri/core/workers/chunks/9d3230f59b4c4d1b2713.js +0 -1
  400. package/assets/esri/core/workers/chunks/9db75bc0980d16b730a1.js +0 -1
  401. package/assets/esri/core/workers/chunks/a0659b8bdc067da7badd.js +0 -1
  402. package/assets/esri/core/workers/chunks/a480ee9a994410177961.js +0 -1
  403. package/assets/esri/core/workers/chunks/a9b279975d7df0f295d7.js +0 -1
  404. package/assets/esri/core/workers/chunks/aa3abaa5ad4a5a3bcb84.js +0 -1
  405. package/assets/esri/core/workers/chunks/aa8e607f908297786675.js +0 -1
  406. package/assets/esri/core/workers/chunks/ab5a302b5f62d38293f9.js +0 -1
  407. package/assets/esri/core/workers/chunks/abd6a84396e0eb3f01ad.js +0 -1
  408. package/assets/esri/core/workers/chunks/abe9f8516b03a3fb0477.js +0 -1
  409. package/assets/esri/core/workers/chunks/aff6aa5c7f75f8e052d9.js +0 -1
  410. package/assets/esri/core/workers/chunks/b601cc5304b132536239.js +0 -1
  411. package/assets/esri/core/workers/chunks/b85f614ddbddd3c3007e.js +0 -1
  412. package/assets/esri/core/workers/chunks/b944f4ab25a691b3e611.js +0 -1
  413. package/assets/esri/core/workers/chunks/bbdacddb61e651ca0098.js +0 -1
  414. package/assets/esri/core/workers/chunks/c2fa728e805637a1783e.js +0 -1
  415. package/assets/esri/core/workers/chunks/c901f5f85d962254fc2c.js +0 -1
  416. package/assets/esri/core/workers/chunks/ca173b908d89a4e334f6.js +0 -1
  417. package/assets/esri/core/workers/chunks/cc2ef3bfa1f614d7452c.js +0 -1
  418. package/assets/esri/core/workers/chunks/cdb32a9ac9f5804c4212.js +0 -1
  419. package/assets/esri/core/workers/chunks/ce9a4997973da80141a5.js +0 -1
  420. package/assets/esri/core/workers/chunks/d0674b50a358d3bb9db2.js +0 -1
  421. package/assets/esri/core/workers/chunks/d18b7b4b3b9bea7204b0.js +0 -1
  422. package/assets/esri/core/workers/chunks/d2ce983f7babdf18a0ed.js +0 -1
  423. package/assets/esri/core/workers/chunks/d38a0d867dc6cecdc551.js +0 -1
  424. package/assets/esri/core/workers/chunks/e39ca33e9e463c1d6060.js +0 -1
  425. package/assets/esri/core/workers/chunks/e471d103205018a5cf7f.js +0 -1
  426. package/assets/esri/core/workers/chunks/e542fb044fc96f7e8af2.js +0 -1
  427. package/assets/esri/core/workers/chunks/e94e00a28591337b2def.js +0 -1
  428. package/assets/esri/core/workers/chunks/eb2709ccbc001f42ac1b.js +0 -1
  429. package/assets/esri/core/workers/chunks/f905511ca5f9b59fc17f.js +0 -1
  430. package/assets/esri/core/workers/chunks/f910e80dd87727af5184.js +0 -1
  431. package/assets/esri/core/workers/chunks/f9300a24305b0af1d227.js +0 -1
  432. package/assets/esri/core/workers/chunks/fa1e1ac5b3ef7bdf8a78.js +0 -1
  433. package/assets/esri/core/workers/chunks/fce76a84c7d25d8d47e8.js +0 -1
  434. package/assets/esri/core/workers/chunks/fef4f97fbe861a1b60e8.js +0 -1
  435. package/layers/AreaMeasurementLayer.d.ts +0 -4
  436. package/layers/DirectLineMeasurementLayer.d.ts +0 -4
  437. package/symbols/support/symbolPreview.d.ts +0 -4
  438. package/symbols/support/symbolPreview.js +0 -5
  439. package/views/3d/layers/AreaMeasurementLayerView3D.d.ts +0 -4
  440. package/views/3d/layers/DirectLineMeasurementLayerView3D.d.ts +0 -4
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Evented.js";import{isSome as t,unwrap as r,isNone as s}from"../../../../core/maybe.js";import{s as i,b as a,a as o}from"../../../../chunks/vec3.js";import{c as n}from"../../../../chunks/vec3f64.js";import{g as l,c as h,s as c}from"../../../../chunks/vec4.js";import{f as d,a as u}from"../../../../chunks/vec4f32.js";import{projectBuffer as p}from"../../../../geometry/projection.js";import{create as m,empty as f,expandWithBuffer as g}from"../../../../geometry/support/aaBoundingBox.js";import{makeDehydratedPoint as _}from"../../../../layers/graphics/dehydratedFeatures.js";import{getGeometryEffectiveElevationMode as y}from"../../../../support/elevationInfoUtils.js";import v from"../../../../symbols/support/ElevationInfo.js";import{DrapedVisualElementResources as w}from"./DrapedVisualElementResources.js";import{LaserlineVisualElement as O}from"./LaserlineVisualElement.js";import{VisualElementResources as C}from"./VisualElementResources.js";import{ElevationContext as R}from"../../layers/graphics/ElevationContext.js";import{geometryToRenderInfoDraped as b,createGeometry as D,geometryToRenderInfo as j}from"../../layers/graphics/lineUtils.js";import{computeAttachmentOriginLines as P}from"../../webgl-engine/lib/geometryDataUtils.js";import{RenderGeometry as E}from"../../webgl-engine/lib/RenderGeometry.js";import{RibbonLineMaterial as G}from"../../webgl-engine/materials/RibbonLineMaterial.js";class A{constructor(t){this.view=null,this._attachmentOrigin=_(0,0,0,null),this._attachmentOriginDirty=!0,this.events=new e,this._isDraped=!1,this._geometry=null,this._width=1,this._color=d(1,0,1,1),this._innerWidth=0,this._innerColor=d(1,1,1,1),this._stipplePattern=null,this._stippleOffColor=null,this._falloff=0,this._elevationInfo=null,this._laserlineStyle=null,this._laserlineEnabled=!1,this._renderOccluded=8,this.resources=new C({view:t.view,createResources:e=>this.createResources(e),recreateGeometry:(e,t)=>(e.geometries.length=0,this.recreateGeometry(t,e.material,e.geometries),e.geometries)}),this._attachmentOrigin.spatialReference=t.view.spatialReference,this.drapedResources=new w({view:t.view,createResources:()=>this.createDrapedResources(),recreateGeometry:e=>{e.geometries=this.createRenderGeometriesDraped(e.material),this.attachmentOriginChanged()}});let r=!0;this._laserline=new O({view:t.view});for(const e in t)e in this?"attached"===e?r=t[e]:this[e]=t[e]:console.error("Cannot set unknown property",e);this.attached=r}destroy(){this.resources.destroy(),this.drapedResources.destroy(),this._laserline.destroy()}get isDraped(){return this._isDraped}set isDraped(e){e!==this._isDraped&&(this._isDraped=e,this.updateAttached(this.attached),this._laserline.attached=this.laserlineAttached)}get laserlineAttached(){return this.attached&&this.visible&&t(this._laserlineStyle)&&!this.isDraped&&this.laserlineEnabled}get visible(){return this.resources.visible}set visible(e){this.resources.visible=e,this.drapedResources.visible=e,this._laserline.attached=this.laserlineAttached}get attached(){return this.resources.attached||this.drapedResources.attached}set attached(e){this.updateAttached(e)}updateAttached(e){this.resources.attached=!this.isDraped&&e,this.drapedResources.attached=this.isDraped&&e,this._laserline.attached=this.laserlineAttached,this.attached&&this.attachmentOriginChanged()}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.resources.recreateGeometry(),this.drapedResources.recreateGeometry()}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this.updateMaterial())}get color(){return this._color}set color(e){l(e,this._color)||(h(this._color,e),this.updateMaterial())}get innerWidth(){return this._innerWidth}set innerWidth(e){e!==this._innerWidth&&(this._innerWidth=e,this.updateMaterial())}get innerColor(){return this._innerColor}set innerColor(e){l(e,this._innerColor)||(h(this._innerColor,e),this.updateMaterial())}get stipplePattern(){return this._stipplePattern}set stipplePattern(e){const r=t(e)!==t(this._stipplePattern);this._stipplePattern=e,r?this.resources.recreate():this.updateMaterial()}get stippleOffColor(){return this._stippleOffColor}set stippleOffColor(e){e&&this._stippleOffColor&&l(e,this._stippleOffColor)||(this._stippleOffColor=e?u(e):null,this.updateMaterial())}get falloff(){return this._falloff}set falloff(e){e!==this._falloff&&(this._falloff=e,this.updateMaterial())}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this.resources.recreateGeometry()}get laserlineStyle(){return this._laserlineStyle}set laserlineStyle(e){this._laserlineStyle=e,this._laserline.attached=this.laserlineAttached,t(e)&&(this._laserline.style=e)}get laserlineEnabled(){return this._laserlineEnabled}set laserlineEnabled(e){this._laserlineEnabled!==e&&(this._laserlineEnabled=e,this._laserline.attached=this.laserlineAttached)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this.updateMaterial())}get attachmentOrigin(){if(!this._attachmentOriginDirty)return this._attachmentOrigin;const e=t(this.resources.resources)?this.resources.resources.geometries:null;if(!e||0===e.length)return null;i(S,0,0,0);let s=0;for(const t of e){const e=t.vertexAttributes.get("position"),i=t.indices.get("position"),o=r(this.resources.resources).material.isClosed(e.data,i);P(e,i,o,I)&&(a(S,S,I),s++)}return 0===s?null:(o(S,S,1/s),this.view.renderCoordsHelper.fromRenderCoords(S,this._attachmentOrigin),this._attachmentOriginDirty=!1,this._attachmentOrigin)}updateMaterial(){t(this.resources.resources)&&this.resources.resources.material.setParameterValues(this.materialParameters),t(this.drapedResources.resources)&&this.drapedResources.resources.material.setParameterValues(this.materialParameters)}get isClosed(){return t(this.geometry)&&"polygon"===this.geometry.type}get materialParameters(){return{width:this._width,color:this._color,stippleOffColor:this._stippleOffColor,stipplePattern:this._stipplePattern,isClosed:this.isClosed,falloff:this._falloff,innerColor:this._innerColor,innerWidth:this._innerWidth,join:"round",stippleIntegerRepeats:!0,polygonOffset:!0,renderOccluded:this.normalizedRenderOccluded}}get normalizedRenderOccluded(){return this.isDraped&&8===this._renderOccluded?4:this._renderOccluded}recreateGeometry(e,t,r){const s=this.createRenderGeometries();for(const i of s)e.addGeometry(i,t),r.push(i);this.attachmentOriginChanged()}attachmentOriginChanged(){this._attachmentOriginDirty=!0,this.events.emit("attachment-origin-changed")}createResources(e){const t=new G(this.materialParameters),r=[];return this.recreateGeometry(e,t,r),{material:t,geometries:r,forEach:e=>{e(t),r.forEach(e)}}}createDrapedResources(){const e=new G(this.materialParameters);return{material:e,geometries:this.createRenderGeometriesDraped(e)}}createRenderGeometriesDraped(e){const t=this.geometry;if(s(t))return[];const r=b(t,this.view.basemapTerrain.spatialReference),i=[];for(const{position:s}of r.lines){const t={attributeData:{position:s},removeDuplicateStartEnd:this.isClosed?1:0},r=new E(D(t),e),a=f(M);g(a,s),c(r.boundingSphere,.5*(a[0]+a[3]),.5*(a[1]+a[4]),0,.5*Math.sqrt((a[3]-a[0])*(a[3]-a[0])+(a[4]-a[1])*(a[4]-a[1]))),i.push(r)}return i}calculateMapBounds(e){if(s(this.resources.resources))return!1;const t=this.view.renderCoordsHelper;for(const r of this.resources.resources.geometries){const s=r.vertexAttributes.get("position"),i=new Float64Array(s.data.length);p(s.data,t.spatialReference,0,i,this.view.spatialReference,0,s.data.length/3),g(e,i)}return!0}createRenderGeometries(){var e;const t=this.geometry;if(s(t))return[];const r=j(t,this.view.elevationProvider,this.view.renderCoordsHelper,R.fromElevationInfo(null!=(e=this.elevationInfo)?e:new v({mode:y(t,null)}))),i=[],a=[];for(const{position:s,mapPosition:o}of r.lines){const e={attributeData:{position:s,mapPosition:o},removeDuplicateStartEnd:this.isClosed?1:0};i.push(D(e)),a.push(s)}return this._laserline.pathVerticalPlane=a,i}}const M=m(),I=n(),S=n();export{A as OutlineVisualElement};
5
+ import e from"../../../../core/Evented.js";import{isSome as t,unwrap as r,isNone as s}from"../../../../core/maybe.js";import{s as i,b as a,a as o}from"../../../../chunks/vec3.js";import{c as n}from"../../../../chunks/vec3f64.js";import{g as l,c as h,s as c}from"../../../../chunks/vec4.js";import{f as d,a as p}from"../../../../chunks/vec4f32.js";import{projectBuffer as u}from"../../../../geometry/projection.js";import{create as m,empty as f,expandWithBuffer as g}from"../../../../geometry/support/aaBoundingBox.js";import{makeDehydratedPoint as _}from"../../../../layers/graphics/dehydratedFeatures.js";import{getGeometryEffectiveElevationMode as y}from"../../../../support/elevationInfoUtils.js";import v from"../../../../symbols/support/ElevationInfo.js";import{DrapedVisualElementResources as w}from"./DrapedVisualElementResources.js";import{LaserlineVisualElement as O}from"./LaserlineVisualElement.js";import{VisualElementResources as C}from"./VisualElementResources.js";import{ElevationContext as R}from"../../layers/graphics/ElevationContext.js";import{geometryToRenderInfoDraped as b,createGeometry as D,geometryToRenderInfo as j}from"../../layers/graphics/lineUtils.js";import{computeAttachmentOriginLines as P}from"../../webgl-engine/lib/geometryDataUtils.js";import{RenderGeometry as E}from"../../webgl-engine/lib/RenderGeometry.js";import{RibbonLineMaterial as G}from"../../webgl-engine/materials/RibbonLineMaterial.js";class A{constructor(t){this.view=null,this._attachmentOrigin=_(0,0,0,null),this._attachmentOriginDirty=!0,this.events=new e,this._isDraped=!1,this._geometry=null,this._width=1,this._color=d(1,0,1,1),this._innerWidth=0,this._innerColor=d(1,1,1,1),this._stipplePattern=null,this._stippleOffColor=null,this._falloff=0,this._elevationInfo=null,this._laserlineStyle=null,this._laserlineEnabled=!1,this._renderOccluded=8,this.resources=new C({view:t.view,createResources:e=>this.createResources(e),recreateGeometry:(e,t)=>(e.geometries.length=0,this.recreateGeometry(t,e.material,e.geometries),e.geometries)}),this._attachmentOrigin.spatialReference=t.view.spatialReference,this.drapedResources=new w({view:t.view,createResources:()=>this.createDrapedResources(),recreateGeometry:e=>{e.geometries=this.createRenderGeometriesDraped(e.material),this.attachmentOriginChanged()}});let r=!0;this._laserline=new O({view:t.view});for(const e in t)e in this?"attached"===e?r=t[e]:this[e]=t[e]:console.error("Cannot set unknown property",e);this.attached=r}destroy(){this.resources.destroy(),this.drapedResources.destroy(),this._laserline.destroy()}get isDraped(){return this._isDraped}set isDraped(e){e!==this._isDraped&&(this._isDraped=e,this.updateAttached(this.attached),this._laserline.attached=this.laserlineAttached)}get laserlineAttached(){return this.attached&&this.visible&&t(this._laserlineStyle)&&!this.isDraped&&this.laserlineEnabled}get visible(){return this.resources.visible}set visible(e){this.resources.visible=e,this.drapedResources.visible=e,this._laserline.attached=this.laserlineAttached}get attached(){return this.resources.attached||this.drapedResources.attached}set attached(e){this.updateAttached(e)}updateAttached(e){this.resources.attached=!this.isDraped&&e,this.drapedResources.attached=this.isDraped&&e,this._laserline.attached=this.laserlineAttached,this.attached&&this.attachmentOriginChanged()}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.resources.recreateGeometry(),this.drapedResources.recreateGeometry()}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this.updateMaterial())}get color(){return this._color}set color(e){l(e,this._color)||(h(this._color,e),this.updateMaterial())}get innerWidth(){return this._innerWidth}set innerWidth(e){e!==this._innerWidth&&(this._innerWidth=e,this.updateMaterial())}get innerColor(){return this._innerColor}set innerColor(e){l(e,this._innerColor)||(h(this._innerColor,e),this.updateMaterial())}get stipplePattern(){return this._stipplePattern}set stipplePattern(e){const r=t(e)!==t(this._stipplePattern);this._stipplePattern=e,r?this.resources.recreate():this.updateMaterial()}get stippleOffColor(){return this._stippleOffColor}set stippleOffColor(e){e&&this._stippleOffColor&&l(e,this._stippleOffColor)||(this._stippleOffColor=e?p(e):null,this.updateMaterial())}get falloff(){return this._falloff}set falloff(e){e!==this._falloff&&(this._falloff=e,this.updateMaterial())}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this.resources.recreateGeometry()}get laserlineStyle(){return this._laserlineStyle}set laserlineStyle(e){this._laserlineStyle=e,this._laserline.attached=this.laserlineAttached,t(e)&&(this._laserline.style=e)}get laserlineEnabled(){return this._laserlineEnabled}set laserlineEnabled(e){this._laserlineEnabled!==e&&(this._laserlineEnabled=e,this._laserline.attached=this.laserlineAttached)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this.updateMaterial())}get attachmentOrigin(){if(!this._attachmentOriginDirty)return this._attachmentOrigin;const e=t(this.resources.resources)?this.resources.resources.geometries:null;if(!e||0===e.length)return null;i(S,0,0,0);let s=0;for(const t of e){const e=t.vertexAttributes.get("position"),i=t.indices.get("position"),o=r(this.resources.resources).material.isClosed(e.data,i);P(e,i,o,I)&&(a(S,S,I),s++)}return 0===s?null:(o(S,S,1/s),this.view.renderCoordsHelper.fromRenderCoords(S,this._attachmentOrigin),this._attachmentOriginDirty=!1,this._attachmentOrigin)}updateMaterial(){t(this.resources.resources)&&this.resources.resources.material.setParameters(this.materialParameters),t(this.drapedResources.resources)&&this.drapedResources.resources.material.setParameters(this.materialParameters)}get isClosed(){return t(this.geometry)&&"polygon"===this.geometry.type}get materialParameters(){return{width:this._width,color:this._color,stippleOffColor:this._stippleOffColor,stipplePattern:this._stipplePattern,isClosed:this.isClosed,falloff:this._falloff,innerColor:this._innerColor,innerWidth:this._innerWidth,join:"round",stippleIntegerRepeats:!0,polygonOffset:!0,renderOccluded:this.normalizedRenderOccluded}}get normalizedRenderOccluded(){return this.isDraped&&8===this._renderOccluded?4:this._renderOccluded}recreateGeometry(e,t,r){const s=this.createRenderGeometries();for(const i of s)e.addGeometry(i,t),r.push(i);this.attachmentOriginChanged()}attachmentOriginChanged(){this._attachmentOriginDirty=!0,this.events.emit("attachment-origin-changed")}createResources(e){const t=new G(this.materialParameters),r=[];return this.recreateGeometry(e,t,r),{material:t,geometries:r,forEach:e=>{e(t),r.forEach(e)}}}createDrapedResources(){const e=new G(this.materialParameters);return{material:e,geometries:this.createRenderGeometriesDraped(e)}}createRenderGeometriesDraped(e){const t=this.geometry;if(s(t))return[];const r=b(t,this.view.basemapTerrain.spatialReference),i=[];for(const{position:s}of r.lines){const t={attributeData:{position:s},removeDuplicateStartEnd:this.isClosed?1:0},r=new E(D(t),e),a=f(M);g(a,s),c(r.boundingSphere,.5*(a[0]+a[3]),.5*(a[1]+a[4]),0,.5*Math.sqrt((a[3]-a[0])*(a[3]-a[0])+(a[4]-a[1])*(a[4]-a[1]))),i.push(r)}return i}calculateMapBounds(e){if(s(this.resources.resources))return!1;const t=this.view.renderCoordsHelper;for(const r of this.resources.resources.geometries){const s=r.vertexAttributes.get("position"),i=new Float64Array(s.data.length);u(s.data,t.spatialReference,0,i,this.view.spatialReference,0,s.data.length/3),g(e,i)}return!0}createRenderGeometries(){var e;const t=this.geometry;if(s(t))return[];const r=j(t,this.view.elevationProvider,this.view.renderCoordsHelper,R.fromElevationInfo(null!=(e=this.elevationInfo)?e:new v({mode:y(t,null)}))),i=[],a=[];for(const{position:s,mapPosition:o}of r.lines){const e={attributeData:{position:s,mapPosition:o},removeDuplicateStartEnd:this.isClosed?1:0};i.push(D(e)),a.push(s)}return this._laserline.pathVerticalPlane=a,i}}const M=m(),I=n(),S=n();export{A as OutlineVisualElement};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Handles.js";import{unwrap as t,isSome as s,isNone as r}from"../../../../core/maybe.js";import{createScreenPointArray as i}from"../../../../core/screenUtils.js";import{I as o}from"../../../../chunks/mat4f64.js";import{f as a,a as c,b as h,s as n,i as l}from"../../../../chunks/vec2.js";import{k as d,g as m,n as u,f as _,b as p}from"../../../../chunks/vec3.js";import{c as f,f as g}from"../../../../chunks/vec3f64.js";import{g as y,c as j}from"../../../../chunks/vec4.js";import{f as w}from"../../../../chunks/vec4f32.js";import{Object3DVisualElement as x}from"./Object3DVisualElement.js";import b from"../../webgl-engine/lib/GeometryUtil.js";import{RibbonLineMaterial as G}from"../../webgl-engine/materials/RibbonLineMaterial.js";class R extends x{constructor(t){super(t),this._handles=new e,this._location=f(),this._direction=g(1,0,0),this._width=1,this._offset=1,this._length=18,this._color=w(1,0,1,1),this._renderOccluded=4,this.applyProps(t)}get location(){return this._location}set location(e){d(this._location,e)||(m(this._location,e),this.updateGeometry())}get direction(){return this._direction}set direction(e){d(this._direction,e)||(m(this._direction,e),this.updateGeometry())}setDirectionFromPoints(e,t){u(this._direction,_(this._direction,t,e)),this.updateGeometry()}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this.updateMaterial())}get offset(){return this._offset}set offset(e){e!==this._offset&&(this._offset=e,this.updateGeometry())}get length(){return this._length}set length(e){e!==this._length&&(this._length=e,this.updateGeometry())}get color(){return this._color}set color(e){y(e,this._color)||(j(this._color,e),this.updateMaterial())}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this.updateMaterial())}createExternalResources(){const e=new G(this.materialParameters);this._handles.add(this.view.state.watch("camera",(()=>{this.updateGeometry()}))),this._externalResources={material:e}}destroyExternalResources(){this._handles.removeAll(),this._externalResources=null}createGeometries(e){const s=b.createPolylineGeometry([f(),f()]),r=b.createPolylineGeometry([f(),f()]),i=t(this._externalResources).material;e.addGeometry(s,i,o),e.addGeometry(r,i,o),this.updateVertices(e)}forEachExternalMaterial(e){s(this._externalResources)&&e(this._externalResources.material)}updateMaterial(){if(r(this._externalResources))return;this._externalResources.material.setParameterValues(this.materialParameters)}get materialParameters(){return{width:this._width,color:this._color,renderOccluded:this._renderOccluded}}updateGeometry(){const e=this.object;r(e)||this.updateVertices(e)}updateVertices(e){const t=this.view.state.camera;t.projectToScreen(this.location,V),p(O,this.location,this.direction),t.projectToScreen(O,v),a(v,c(v,v,V)),this.updateVertexAttributes(t,e,0,V,v,1),this.updateVertexAttributes(t,e,1,V,v,-1)}updateVertexAttributes(e,t,s,r,i,o){const a=t.geometryRecords[s].geometry.getMutableAttribute("position").data,c=h(P,n(P,i[1]*o,i[0]*-o),this.offset+this.width/2),d=l(k,l(k,l(k,r,h(k,i,this.length/2)),c),c),m=l(M,d,h(M,i,-this.length));e.unprojectFromScreen(d,O),a[0]=O[0],a[1]=O[1],a[2]=O[2],e.unprojectFromScreen(m,O),a[3]=O[0],a[4]=O[1],a[5]=O[2],t.geometryVertexAttrsUpdated(s)}}const O=f(),V=i(),v=i(),P=i(),k=i(),M=i();export{R as ParallelLineVisualElement};
5
+ import e from"../../../../core/Handles.js";import{unwrap as t,isSome as r,isNone as s}from"../../../../core/maybe.js";import{createScreenPointArray as i}from"../../../../core/screenUtils.js";import{f as o,a,b as c,s as h,i as n}from"../../../../chunks/vec2.js";import{k as l,g as d,n as u,f as m,b as _}from"../../../../chunks/vec3.js";import{c as p,f}from"../../../../chunks/vec3f64.js";import{g,c as y}from"../../../../chunks/vec4.js";import{f as j}from"../../../../chunks/vec4f32.js";import{Object3DVisualElement as w}from"./Object3DVisualElement.js";import x from"../../webgl-engine/lib/GeometryUtil.js";import{RibbonLineMaterial as b}from"../../webgl-engine/materials/RibbonLineMaterial.js";class G extends w{constructor(t){super(t),this._handles=new e,this._location=p(),this._direction=f(1,0,0),this._width=1,this._offset=1,this._length=18,this._color=j(1,0,1,1),this._renderOccluded=4,this.applyProps(t)}get location(){return this._location}set location(e){l(this._location,e)||(d(this._location,e),this.updateGeometry())}get direction(){return this._direction}set direction(e){l(this._direction,e)||(d(this._direction,e),this.updateGeometry())}setDirectionFromPoints(e,t){u(this._direction,m(this._direction,t,e)),this.updateGeometry()}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this.updateMaterial())}get offset(){return this._offset}set offset(e){e!==this._offset&&(this._offset=e,this.updateGeometry())}get length(){return this._length}set length(e){e!==this._length&&(this._length=e,this.updateGeometry())}get color(){return this._color}set color(e){g(e,this._color)||(y(this._color,e),this.updateMaterial())}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this.updateMaterial())}createExternalResources(){const e=new b(this.materialParameters);this._handles.add(this.view.state.watch("camera",(()=>{this.updateGeometry()}))),this._externalResources={material:e}}destroyExternalResources(){this._handles.removeAll(),this._externalResources=null}createGeometries(e){const r=x.createPolylineGeometry([p(),p()]),s=x.createPolylineGeometry([p(),p()]),i=t(this._externalResources).material;e.addGeometry(r,i),e.addGeometry(s,i),this.updateVertices(e)}forEachExternalMaterial(e){r(this._externalResources)&&e(this._externalResources.material)}updateMaterial(){if(s(this._externalResources))return;this._externalResources.material.setParameters(this.materialParameters)}get materialParameters(){return{width:this._width,color:this._color,renderOccluded:this._renderOccluded}}updateGeometry(){const e=this.object;s(e)||this.updateVertices(e)}updateVertices(e){const t=this.view.state.camera;t.projectToScreen(this.location,O),_(R,this.location,this.direction),t.projectToScreen(R,v),o(v,a(v,v,O)),this.updateVertexAttributes(t,e,0,O,v,1),this.updateVertexAttributes(t,e,1,O,v,-1)}updateVertexAttributes(e,t,r,s,i,o){const a=t.geometryRecords[r],l=a.geometry.getMutableAttribute("position").data,d=c(P,h(P,i[1]*o,i[0]*-o),this.offset+this.width/2),u=n(V,n(V,n(V,s,c(V,i,this.length/2)),d),d),m=n(M,u,c(M,i,-this.length));e.unprojectFromScreen(u,R),l[0]=R[0],l[1]=R[1],l[2]=R[2],e.unprojectFromScreen(m,R),l[3]=R[0],l[4]=R[1],l[5]=R[2],t.geometryVertexAttrsUpdated(a)}}const R=p(),O=i(),v=i(),P=i(),V=i(),M=i();export{G as ParallelLineVisualElement};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as e,nextHighestPowerOfTwo as t}from"../../../../core/mathUtils.js";import{isSome as r,isNone as i}from"../../../../core/maybe.js";import{s}from"../../../../chunks/vec3.js";import{c as o}from"../../../../chunks/vec3f64.js";import{g as n,c as a}from"../../../../chunks/vec4.js";import{f as l}from"../../../../chunks/vec4f64.js";import{projectVectorToVector as u}from"../../../../geometry/projection.js";import{expandWithBuffer as c}from"../../../../geometry/support/aaBoundingBox.js";import{sv3d as h}from"../../../../geometry/support/vectorStacks.js";import{VisualElementResources as m}from"./VisualElementResources.js";import{evaluateElevationAlignmentAtPoint as p}from"../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as g}from"../../layers/graphics/ElevationContext.js";import{createType as d}from"../../layers/graphics/sdfPrimitives.js";import f from"../../webgl-engine/lib/GeometryUtil.js";import{Texture as y}from"../../webgl-engine/lib/Texture.js";import{HUDMaterial as v}from"../../webgl-engine/materials/HUDMaterial.js";class _{constructor(e){this.view=null,this._geometry=null,this._size=3,this._color=l(1,0,1,1),this._pixelSnappingEnabled=!0,this._primitive="square",this._outlineSize=1,this._outlineColor=l(1,1,1,1),this._elevationInfo=null,this.resources=new m({view:e.view,createResources:e=>this.createResources(e),recreateGeometry:(e,t)=>(e.geometry=this.recreateGeometry(t,e.material),r(e.geometry)?[e.geometry]:[])});let t=!0;for(const r in e)r in this?"attached"===r?t=e[r]:this[r]=e[r]:console.error("Cannot set unknown property",r);this.attached=t}destroy(){this.resources.destroy()}get visible(){return this.resources.visible}set visible(e){this.resources.visible=e}get attached(){return this.resources.attached}set attached(e){this.resources.attached=e}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.resources.recreateGeometry()}get size(){return this._size}set size(e){if(e!==this._size){const t=this.preferredTextureSize;this._size=e,t<this.preferredTextureSize?r(this.resources)&&this.resources.recreate():this.updateSizeAttribute()}}get color(){return this._color}set color(e){n(e,this._color)||(a(this._color,e),this.updateMaterial())}get pixelSnappingEnabled(){return this._pixelSnappingEnabled}set pixelSnappingEnabled(e){this._pixelSnappingEnabled!==e&&(this._pixelSnappingEnabled=e,this.updateMaterial())}get primitive(){return this._primitive}set primitive(e){this._primitive!==e&&(this._primitive=e,r(this.resources)&&this.resources.recreate())}get outlineSize(){return this._outlineSize}set outlineSize(e){e!==this._outlineSize&&(this._outlineSize=e,this.updateMaterial())}get outlineColor(){return this._outlineColor}set outlineColor(e){n(e,this._outlineColor)||(a(this._outlineColor,e),this.updateMaterial())}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this.resources&&this.resources.recreateGeometry()}updateMaterial(){const e=this.resources.resources;i(e)||e.material.setParameterValues(this.materialParameters(e.texture.id))}updateSizeAttribute(){const e=this.resources.resources,t=this.resources.object;if(i(e)||i(t))return;const r=e.geometry;if(i(r))return;const s=r.getMutableAttribute("size").data,o=this.geometrySize;s[0]=o,s[1]=o,t.geometryVertexAttrsUpdated(0)}materialParameters(e){return{color:this._color,textureIsSignedDistanceField:!0,distanceFieldBoundingBox:x,occlusionTest:!1,outlineColor:this._outlineColor,outlineSize:this._outlineSize,textureId:e,polygonOffset:!1,shaderPolygonOffset:0,drawInSecondSlot:!0,depthEnabled:!1,pixelSnappingEnabled:this.pixelSnappingEnabled}}get geometrySize(){return this._size/S}recreateGeometry(e,t){const i=this.createRenderGeometry();return r(i)&&e.addGeometry(i,t),i}createResources(e){const t=this.createTexture(),i=new v(this.materialParameters(t.id)),s=this.recreateGeometry(e,i);return{material:i,texture:t,geometry:s,forEach(e){e(t),e(i),r(this.geometry)&&e(this.geometry)}}}get preferredTextureSize(){return e(t(2*this.geometrySize),16,128)}createTexture(){const e=this.preferredTextureSize;return new y(d(this._primitive,e,e*S),{mipmap:!1,wrap:{s:33071,t:33071},width:e,height:e,components:4,noUnpackFlip:!0})}calculateMapBounds(e){if(i(this.resources.resources)||i(this.resources.resources.geometry))return!1;const t=this.resources.resources.geometry.vertexAttributes.get("position");return u(t.data,this.view.renderCoordsHelper.spatialReference,z,this.view.spatialReference),c(e,z),!0}createRenderGeometry(){const e=this.geometry;if(i(e))return null;const{renderCoordsHelper:t,elevationProvider:r}=this.view,o=p(e,r,g.fromElevationInfo(this.elevationInfo),t),n=s(h.get(),e.x,e.y,o),a=h.get();u(n,e.spatialReference,a,t.spatialReference);const l=this.geometrySize;return f.createPointGeometry(null,a,null,[l,l],[0,0,0,1])}}const S=.5,x=[S/2,S/2,1-S/2,1-S/2],z=o();export{_ as PointVisualElement};
5
+ import{clamp as e,nextHighestPowerOfTwo as t}from"../../../../core/mathUtils.js";import{isSome as r,isNone as i}from"../../../../core/maybe.js";import{s}from"../../../../chunks/vec3.js";import{c as o}from"../../../../chunks/vec3f64.js";import{g as n,c as a}from"../../../../chunks/vec4.js";import{f as l}from"../../../../chunks/vec4f64.js";import{projectVectorToVector as c}from"../../../../geometry/projection.js";import{expandWithBuffer as u}from"../../../../geometry/support/aaBoundingBox.js";import{sv3d as h}from"../../../../geometry/support/vectorStacks.js";import{VisualElementResources as m}from"./VisualElementResources.js";import{evaluateElevationAlignmentAtPoint as p}from"../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as g}from"../../layers/graphics/ElevationContext.js";import{createType as d}from"../../layers/graphics/sdfPrimitives.js";import f from"../../webgl-engine/lib/GeometryUtil.js";import{Texture as y}from"../../webgl-engine/lib/Texture.js";import{HUDMaterial as v}from"../../webgl-engine/materials/HUDMaterial.js";class _{constructor(e){this.view=null,this._geometry=null,this._size=3,this._color=l(1,0,1,1),this._pixelSnappingEnabled=!0,this._primitive="square",this._outlineSize=1,this._outlineColor=l(1,1,1,1),this._elevationInfo=null,this.resources=new m({view:e.view,createResources:e=>this.createResources(e),recreateGeometry:(e,t)=>(e.geometry=this.recreateGeometry(t,e.material),r(e.geometry)?[e.geometry]:[])});let t=!0;for(const r in e)r in this?"attached"===r?t=e[r]:this[r]=e[r]:console.error("Cannot set unknown property",r);this.attached=t}destroy(){this.resources.destroy()}get visible(){return this.resources.visible}set visible(e){this.resources.visible=e}get attached(){return this.resources.attached}set attached(e){this.resources.attached=e}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.resources.recreateGeometry()}get size(){return this._size}set size(e){if(e!==this._size){const t=this.preferredTextureSize;this._size=e,t<this.preferredTextureSize?r(this.resources)&&this.resources.recreate():this.updateSizeAttribute()}}get color(){return this._color}set color(e){n(e,this._color)||(a(this._color,e),this.updateMaterial())}get pixelSnappingEnabled(){return this._pixelSnappingEnabled}set pixelSnappingEnabled(e){this._pixelSnappingEnabled!==e&&(this._pixelSnappingEnabled=e,this.updateMaterial())}get primitive(){return this._primitive}set primitive(e){this._primitive!==e&&(this._primitive=e,r(this.resources)&&this.resources.recreate())}get outlineSize(){return this._outlineSize}set outlineSize(e){e!==this._outlineSize&&(this._outlineSize=e,this.updateMaterial())}get outlineColor(){return this._outlineColor}set outlineColor(e){n(e,this._outlineColor)||(a(this._outlineColor,e),this.updateMaterial())}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this.resources&&this.resources.recreateGeometry()}updateMaterial(){const e=this.resources.resources;i(e)||e.material.setParameters(this.materialParameters(e.texture.id))}updateSizeAttribute(){const e=this.resources.resources,t=this.resources.object;if(i(e)||i(t))return;const r=e.geometry;if(i(r))return;const s=r.getMutableAttribute("size").data,o=this.geometrySize;s[0]=o,s[1]=o,t.geometryVertexAttrsUpdated(t.geometryRecords[0])}materialParameters(e){return{color:this._color,textureIsSignedDistanceField:!0,distanceFieldBoundingBox:x,occlusionTest:!1,outlineColor:this._outlineColor,outlineSize:this._outlineSize,textureId:e,polygonOffset:!1,shaderPolygonOffset:0,drawInSecondSlot:!0,depthEnabled:!1,pixelSnappingEnabled:this.pixelSnappingEnabled}}get geometrySize(){return this._size/S}recreateGeometry(e,t){const i=this.createRenderGeometry();return r(i)&&e.addGeometry(i,t),i}createResources(e){const t=this.createTexture(),i=new v(this.materialParameters(t.id)),s=this.recreateGeometry(e,i);return{material:i,texture:t,geometry:s,forEach(e){e(t),e(i),r(this.geometry)&&e(this.geometry)}}}get preferredTextureSize(){return e(t(2*this.geometrySize),16,128)}createTexture(){const e=this.preferredTextureSize;return new y(d(this._primitive,e,e*S),{mipmap:!1,wrap:{s:33071,t:33071},width:e,height:e,components:4,noUnpackFlip:!0})}calculateMapBounds(e){if(i(this.resources.resources)||i(this.resources.resources.geometry))return!1;const t=this.resources.resources.geometry.vertexAttributes.get("position");return c(t.data,this.view.renderCoordsHelper.spatialReference,z,this.view.spatialReference),u(e,z),!0}createRenderGeometry(){const e=this.geometry;if(i(e))return null;const{renderCoordsHelper:t,elevationProvider:r}=this.view,o=p(e,r,g.fromElevationInfo(this.elevationInfo),t),n=s(h.get(),e.x,e.y,o),a=h.get();c(n,e.spatialReference,a,t.spatialReference);const l=this.geometrySize;return f.createPointGeometry(null,a,null,[l,l],[0,0,0,1])}}const S=.5,x=[S/2,S/2,1-S/2,1-S/2],z=o();export{_ as PointVisualElement};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Handles.js";import{isSome as t}from"../../../../core/maybe.js";import{i,t as r,f as s}from"../../../../chunks/mat4.js";import{c as a}from"../../../../chunks/mat4f64.js";import{i as o,n as l,f as n,g as u,b as h}from"../../../../chunks/vec3.js";import{c as d}from"../../../../chunks/vec3f64.js";import{c}from"../../../../chunks/vec4.js";import{f as _}from"../../../../chunks/vec4f32.js";import{sv3d as m}from"../../../../geometry/support/vectorStacks.js";import{Object3DVisualElement as p}from"./Object3DVisualElement.js";import{Geometry as M}from"../../webgl-engine/lib/Geometry.js";import f from"../../webgl-engine/lib/GeometryUtil.js";import{ColorMaterial as g}from"../../webgl-engine/materials/ColorMaterial.js";import{RibbonLineMaterial as O}from"../../webgl-engine/materials/RibbonLineMaterial.js";class y extends p{constructor(t){super(t),this._handles=new e,this._quadMaterial=null,this._outlineMaterial=null,this._maxSize=0,this._position=d(),this._up=d(),this._right=d(),this._renderOccluded=4,this._color=_(1,0,0,1),this._outlineColor=_(0,0,0,1),this._outlineSize=0,this._size=32,this._outlineRenderOccluded=16,this.applyProps(t)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateQuadMaterial())}get color(){return this._color}set color(e){c(this._color,e),this._updateQuadMaterial()}get outlineColor(){return this._outlineColor}set outlineColor(e){c(this._outlineColor,e),this._updateOutlineMaterial()}get outlineSize(){return this._outlineSize}set outlineSize(e){const t=0===this._outlineSize!=(0===e);this._outlineSize=e,t?this.recreateGeometry():this._updateOutlineMaterial()}get size(){return this._size}set size(e){e!==this._size&&(this._size=e,this._updateTransform())}get outlineRenderOccluded(){return this._outlineRenderOccluded}set outlineRenderOccluded(e){this._outlineRenderOccluded=e,this._updateOutlineMaterial()}set geometry({previous:e,center:t,next:i}){this._maxSize=Math.min(o(t,e),o(t,i))/3,l(this._up,n(this._up,e,t)),l(this._right,n(this._right,i,t)),u(this._position,t),this.recreateGeometry()}createExternalResources(){this._quadMaterial=new g(this.quadMaterialParameters),this._outlineMaterial=new O(this.outlineMaterialParameters),this._handles.add(this.view.state.watch("camera",(()=>this._updateTransform())))}destroyExternalResources(){this._quadMaterial=null,this._outlineMaterial=null,this._handles.removeAll()}forEachExternalMaterial(e){e(this._quadMaterial),e(this._outlineMaterial)}createGeometries(e){this._createQuadGeometry(e),this._createOutlineGeometry(e),this._updateTransform(e)}_createQuadGeometry(e){const t=this._quadGeometryData(this._up,this._right);e.addGeometry(t,this._quadMaterial)}_createOutlineGeometry(e){if(0===this._outlineSize)return;const t=h(m.get(),this._up,this._right),i=f.createPolylineGeometry([this._up,t,this._right]);e.addGeometry(i,this._outlineMaterial)}_updateTransform(e=this.object){const a=this.view.state.camera,o=this._size*a.computeScreenPixelSizeAt(this._position),l=Math.min(this._maxSize,o);i(z),r(z,z,this._position),s(z,z,[l,l,l]),t(e)&&(e.transformation=z)}_quadGeometryData(e,t){const i=h(m.get(),e,t);return new M([["position",{size:3,data:[0,0,0,...t,...e,...i],exclusive:!0}]],[["position",new Uint16Array([0,1,2,1,2,3])]])}get quadMaterialParameters(){return{color:this._color,transparent:!0,writeDepth:!1,polygonOffset:!0,renderOccluded:this._renderOccluded}}_updateQuadMaterial(){this._quadMaterial&&this._quadMaterial.setParameterValues(this.quadMaterialParameters)}get outlineMaterialParameters(){return{color:this._outlineColor,width:this._outlineSize,renderOccluded:this._outlineRenderOccluded}}_updateOutlineMaterial(){this._outlineMaterial&&this._outlineMaterial.setParameterValues(this.outlineMaterialParameters)}}const z=a();export{y as RightAngleQuadVisualElement};
5
+ import e from"../../../../core/Handles.js";import{isSome as t}from"../../../../core/maybe.js";import{i,t as r,f as s}from"../../../../chunks/mat4.js";import{c as a}from"../../../../chunks/mat4f64.js";import{i as o,n as l,f as n,g as u,b as h}from"../../../../chunks/vec3.js";import{c as d}from"../../../../chunks/vec3f64.js";import{c}from"../../../../chunks/vec4.js";import{f as _}from"../../../../chunks/vec4f32.js";import{sv3d as m}from"../../../../geometry/support/vectorStacks.js";import{Object3DVisualElement as p}from"./Object3DVisualElement.js";import{Geometry as M}from"../../webgl-engine/lib/Geometry.js";import f from"../../webgl-engine/lib/GeometryUtil.js";import{ColorMaterial as g}from"../../webgl-engine/materials/ColorMaterial.js";import{RibbonLineMaterial as O}from"../../webgl-engine/materials/RibbonLineMaterial.js";class y extends p{constructor(t){super(t),this._handles=new e,this._quadMaterial=null,this._outlineMaterial=null,this._maxSize=0,this._position=d(),this._up=d(),this._right=d(),this._renderOccluded=4,this._color=_(1,0,0,1),this._outlineColor=_(0,0,0,1),this._outlineSize=0,this._size=32,this._outlineRenderOccluded=16,this.applyProps(t)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateQuadMaterial())}get color(){return this._color}set color(e){c(this._color,e),this._updateQuadMaterial()}get outlineColor(){return this._outlineColor}set outlineColor(e){c(this._outlineColor,e),this._updateOutlineMaterial()}get outlineSize(){return this._outlineSize}set outlineSize(e){const t=0===this._outlineSize!=(0===e);this._outlineSize=e,t?this.recreateGeometry():this._updateOutlineMaterial()}get size(){return this._size}set size(e){e!==this._size&&(this._size=e,this._updateTransform())}get outlineRenderOccluded(){return this._outlineRenderOccluded}set outlineRenderOccluded(e){this._outlineRenderOccluded=e,this._updateOutlineMaterial()}set geometry({previous:e,center:t,next:i}){this._maxSize=Math.min(o(t,e),o(t,i))/3,l(this._up,n(this._up,e,t)),l(this._right,n(this._right,i,t)),u(this._position,t),this.recreateGeometry()}createExternalResources(){this._quadMaterial=new g(this.quadMaterialParameters),this._outlineMaterial=new O(this.outlineMaterialParameters),this._handles.add(this.view.state.watch("camera",(()=>this._updateTransform())))}destroyExternalResources(){this._quadMaterial=null,this._outlineMaterial=null,this._handles.removeAll()}forEachExternalMaterial(e){e(this._quadMaterial),e(this._outlineMaterial)}createGeometries(e){this._createQuadGeometry(e),this._createOutlineGeometry(e),this._updateTransform(e)}_createQuadGeometry(e){const t=this._quadGeometryData(this._up,this._right);e.addGeometry(t,this._quadMaterial)}_createOutlineGeometry(e){if(0===this._outlineSize)return;const t=h(m.get(),this._up,this._right),i=f.createPolylineGeometry([this._up,t,this._right]);e.addGeometry(i,this._outlineMaterial)}_updateTransform(e=this.object){const a=this.view.state.camera,o=this._size*a.computeScreenPixelSizeAt(this._position),l=Math.min(this._maxSize,o);i(z),r(z,z,this._position),s(z,z,[l,l,l]),t(e)&&(e.transformation=z)}_quadGeometryData(e,t){const i=h(m.get(),e,t);return new M([["position",{size:3,data:[0,0,0,...t,...e,...i],exclusive:!0}]],[["position",new Uint16Array([0,1,2,1,2,3])]])}get quadMaterialParameters(){return{color:this._color,transparent:!0,writeDepth:!1,polygonOffset:!0,renderOccluded:this._renderOccluded}}_updateQuadMaterial(){this._quadMaterial&&this._quadMaterial.setParameters(this.quadMaterialParameters)}get outlineMaterialParameters(){return{color:this._outlineColor,width:this._outlineSize,renderOccluded:this._outlineRenderOccluded}}_updateOutlineMaterial(){this._outlineMaterial&&this._outlineMaterial.setParameters(this.outlineMaterialParameters)}}const z=a();export{y as RightAngleQuadVisualElement};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as r}from"../../../../core/maybe.js";import{c as e}from"../../../../chunks/vec4.js";import{f as t}from"../../../../chunks/vec4f32.js";import{Object3DVisualElement as i}from"./Object3DVisualElement.js";import a from"../../webgl-engine/lib/GeometryUtil.js";import{SlicePlaneMaterial as s}from"../../webgl-engine/materials/SlicePlaneMaterial.js";class d extends i{constructor(r){super(r),this._material=null,this._renderOccluded=4,this._gridWidth=1,this._gridColor=t(1,0,0,1),this._backgroundColor=t(1,0,0,1),this.applyProps(r)}get renderOccluded(){return this._renderOccluded}set renderOccluded(r){r!==this._renderOccluded&&(this._renderOccluded=r,this._updateMaterial())}get gridWidth(){return this._gridWidth}set gridWidth(r){this._gridWidth!==r&&(this._gridWidth=r,this._updateMaterial())}get gridColor(){return this._gridColor}set gridColor(r){e(this._gridColor,r),this._updateMaterial()}get backgroundColor(){return this._backgroundColor}set backgroundColor(r){e(this._backgroundColor,r),this._updateMaterial()}createExternalResources(){this._material=new s(this.materialParameters)}destroyExternalResources(){this._material=null}forEachExternalMaterial(e){r(this._material)&&e(this._material)}createGeometries(e){if(r(this._material)){const r=a.createSquareGeometry();e.addGeometry(r,this._material)}}get materialParameters(){return{backgroundColor:this._backgroundColor,gridWidth:this._gridWidth,gridColor:this._gridColor,renderOccluded:this._renderOccluded}}_updateMaterial(){r(this._material)&&this._material.setParameterValues(this.materialParameters)}}export{d as SlicePlaneVisualElement};
5
+ import{isSome as r}from"../../../../core/maybe.js";import{c as e}from"../../../../chunks/vec4.js";import{f as t}from"../../../../chunks/vec4f32.js";import{Object3DVisualElement as i}from"./Object3DVisualElement.js";import a from"../../webgl-engine/lib/GeometryUtil.js";import{SlicePlaneMaterial as s}from"../../webgl-engine/materials/SlicePlaneMaterial.js";class d extends i{constructor(r){super(r),this._material=null,this._renderOccluded=4,this._gridWidth=1,this._gridColor=t(1,0,0,1),this._backgroundColor=t(1,0,0,1),this.applyProps(r)}get renderOccluded(){return this._renderOccluded}set renderOccluded(r){r!==this._renderOccluded&&(this._renderOccluded=r,this._updateMaterial())}get gridWidth(){return this._gridWidth}set gridWidth(r){this._gridWidth!==r&&(this._gridWidth=r,this._updateMaterial())}get gridColor(){return this._gridColor}set gridColor(r){e(this._gridColor,r),this._updateMaterial()}get backgroundColor(){return this._backgroundColor}set backgroundColor(r){e(this._backgroundColor,r),this._updateMaterial()}createExternalResources(){this._material=new s(this.materialParameters)}destroyExternalResources(){this._material=null}forEachExternalMaterial(e){r(this._material)&&e(this._material)}createGeometries(e){if(r(this._material)){const r=a.createSquareGeometry();e.addGeometry(r,this._material)}}get materialParameters(){return{backgroundColor:this._backgroundColor,gridWidth:this._gridWidth,gridColor:this._gridColor,renderOccluded:this._renderOccluded}}_updateMaterial(){r(this._material)&&this._material.setParameters(this.materialParameters)}}export{d as SlicePlaneVisualElement};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import{isNone as e}from"../../../../core/maybe.js";import{s as t}from"../../../../chunks/vec3.js";import{c as r}from"../../../../chunks/vec3f64.js";import{g as i,c as s}from"../../../../chunks/vec4.js";import{settings as a}from"../editingTools/settings.js";import{Object3DVisualElement as l}from"./Object3DVisualElement.js";import{ElevationContext as o}from"../../layers/graphics/ElevationContext.js";import{geometryToRenderInfo as n}from"../../layers/graphics/pointUtils.js";import c from"../../webgl-engine/lib/GeometryUtil.js";import{ShadedColorMaterial as h}from"../../webgl-engine/materials/ShadedColorMaterial.js";class u extends l{constructor(e){super(e),this.view=null,this._renderOccluded=4,this._vertices=null,this._spatialReference=null,this._color=a.colorToVec4(a.reshapeManipulators.vertex.color),this._size=a.reshapeManipulators.vertex.size,this._outlineColor=a.colorToVec4(a.reshapeManipulators.vertex.outlineColor),this._outlineSize=a.reshapeManipulators.vertex.outlineSize,this._elevationInfo=null,this.applyProps(e)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this.updateMaterial(),this.updateOutlineMaterial())}get vertices(){return this._vertices}set vertices(e){this._vertices=e,this.recreateGeometry()}get spatialReference(){return this._spatialReference}set spatialReference(e){this._spatialReference=e,this.recreateGeometry()}get color(){return this._color}set color(e){i(e,this._color)||(s(this._color,e),this.updateMaterial())}get size(){return this._size}set size(e){e!==this._size&&(this._size=e,this.updateMaterial())}get outlineColor(){return this._outlineColor}set outlineColor(e){i(e,this._outlineColor)||(s(this._outlineColor,e),this.updateOutlineMaterial())}get outlineSize(){return this._outlineSize}set outlineSize(e){e!==this._outlineSize&&(this._outlineSize=e,this.updateOutlineMaterial())}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this.recreateGeometry()}get vertexMaterialParameters(){return{color:this._color,transparent:this._color[3]<1,screenSize:this.size,renderOccluded:this._renderOccluded}}get vertexOutlineMaterialParameters(){return{color:this._outlineColor,transparent:this._outlineColor[3]<1,screenSize:this.size+2*this.outlineSize,renderOccluded:this._renderOccluded}}updateMaterial(){this.attached&&this.vertexMaterial.setParameterValues(this.vertexMaterialParameters)}updateOutlineMaterial(){this.attached&&this.vertexOutlineMaterial.setParameterValues(this.vertexOutlineMaterialParameters)}createRenderGeometries(){const r=this.vertices;if(e(r)||0===r.length)return[];const i=.5,s=.5,a=n(r,this.spatialReference,this.view.elevationProvider,this.view.renderCoordsHelper,o.fromElevationInfo(this.elevationInfo)),l=[],c=a.numVertices,h=a.position;for(let e=0;e<c;++e){const r=t(d,h[3*e+0],h[3*e+1],h[3*e+2]),a=p(i,r),o=p(s,r);l.push({vertexGeometry:a,vertexOutlineGeometry:o})}return l}createGeometries(e){const t=this.createRenderGeometries();for(const{vertexGeometry:r,vertexOutlineGeometry:i}of t)e.addGeometry(r,this.vertexMaterial),e.addGeometry(i,this.vertexOutlineMaterial)}createExternalResources(){this.vertexMaterial=new h({...this.vertexMaterialParameters,writeDepth:!0,cullFace:2,screenSizeEnabled:!0}),this.vertexOutlineMaterial=new h({...this.vertexOutlineMaterialParameters,transparent:!0,writeDepth:!0,cullFace:1,screenSizeEnabled:!0,shadingEnabled:!1})}destroyExternalResources(){this.vertexMaterial=null,this.vertexOutlineMaterial=null}forEachExternalMaterial(e){e(this.vertexMaterial),e(this.vertexOutlineMaterial)}}const d=r();function p(e,t){return c.createSphereGeometry(e,16,16,{offset:t})}export{u as VerticesVisualElement};
5
+ import{isNone as e}from"../../../../core/maybe.js";import{s as t}from"../../../../chunks/vec3.js";import{c as r}from"../../../../chunks/vec3f64.js";import{g as i,c as s}from"../../../../chunks/vec4.js";import{settings as a}from"../editingTools/settings.js";import{Object3DVisualElement as o}from"./Object3DVisualElement.js";import{ElevationContext as l}from"../../layers/graphics/ElevationContext.js";import{geometryToRenderInfo as n}from"../../layers/graphics/pointUtils.js";import c from"../../webgl-engine/lib/GeometryUtil.js";import{ShadedColorMaterial as h}from"../../webgl-engine/materials/ShadedColorMaterial.js";class u extends o{constructor(e){super(e),this.view=null,this._renderOccluded=4,this._vertices=null,this._spatialReference=null,this._color=a.colorToVec4(a.reshapeManipulators.vertex.color),this._size=a.reshapeManipulators.vertex.size,this._outlineColor=a.colorToVec4(a.reshapeManipulators.vertex.outlineColor),this._outlineSize=a.reshapeManipulators.vertex.outlineSize,this._elevationInfo=null,this.applyProps(e)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this.updateMaterial(),this.updateOutlineMaterial())}get vertices(){return this._vertices}set vertices(e){this._vertices=e,this.recreateGeometry()}get spatialReference(){return this._spatialReference}set spatialReference(e){this._spatialReference=e,this.recreateGeometry()}get color(){return this._color}set color(e){i(e,this._color)||(s(this._color,e),this.updateMaterial())}get size(){return this._size}set size(e){e!==this._size&&(this._size=e,this.updateMaterial())}get outlineColor(){return this._outlineColor}set outlineColor(e){i(e,this._outlineColor)||(s(this._outlineColor,e),this.updateOutlineMaterial())}get outlineSize(){return this._outlineSize}set outlineSize(e){e!==this._outlineSize&&(this._outlineSize=e,this.updateOutlineMaterial())}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this.recreateGeometry()}get vertexMaterialParameters(){return{color:this._color,transparent:this._color[3]<1,screenSize:this.size,renderOccluded:this._renderOccluded}}get vertexOutlineMaterialParameters(){return{color:this._outlineColor,transparent:this._outlineColor[3]<1,screenSize:this.size+2*this.outlineSize,renderOccluded:this._renderOccluded}}updateMaterial(){this.attached&&this.vertexMaterial.setParameters(this.vertexMaterialParameters)}updateOutlineMaterial(){this.attached&&this.vertexOutlineMaterial.setParameters(this.vertexOutlineMaterialParameters)}createRenderGeometries(){const r=this.vertices;if(e(r)||0===r.length)return[];const i=.5,s=.5,a=n(r,this.spatialReference,this.view.elevationProvider,this.view.renderCoordsHelper,l.fromElevationInfo(this.elevationInfo)),o=[],c=a.numVertices,h=a.position;for(let e=0;e<c;++e){const r=t(d,h[3*e+0],h[3*e+1],h[3*e+2]),a=p(i,r),l=p(s,r);o.push({vertexGeometry:a,vertexOutlineGeometry:l})}return o}createGeometries(e){const t=this.createRenderGeometries();for(const{vertexGeometry:r,vertexOutlineGeometry:i}of t)e.addGeometry(r,this.vertexMaterial),e.addGeometry(i,this.vertexOutlineMaterial)}createExternalResources(){this.vertexMaterial=new h({...this.vertexMaterialParameters,writeDepth:!0,cullFace:2,screenSizeEnabled:!0}),this.vertexOutlineMaterial=new h({...this.vertexOutlineMaterialParameters,transparent:!0,writeDepth:!0,cullFace:1,screenSizeEnabled:!0,shadingEnabled:!1})}destroyExternalResources(){this.vertexMaterial=null,this.vertexOutlineMaterial=null}forEachExternalMaterial(e){e(this.vertexMaterial),e(this.vertexOutlineMaterial)}}const d=r();function p(e,t){return c.createSphereGeometry(e,16,16,{offset:t})}export{u as VerticesVisualElement};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../Graphic.js";import i from"../../../core/Accessor.js";import s from"../../../core/Collection.js";import{handlesGroup as t}from"../../../core/handleUtils.js";import o from"../../../core/Logger.js";import{isSome as n,isNone as l}from"../../../core/maybe.js";import{createAbortController as a,isAbortError as u}from"../../../core/promiseUtils.js";import{init as p}from"../../../core/watchUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import"../../../layers/buildingSublayers/BuildingGroupSublayer.js";import y from"./BuildingComponentSublayerView3D.js";import{BuildingSublayerView3DMixin as d}from"./BuildingSublayerView3D.js";import{LayerView3D as g}from"./LayerView3D.js";import{parseFilterMode as m}from"./i3s/BuildingFilterUtil.js";import{checkSpatialReference as f}from"./i3s/I3SUtil.js";import{updatingProgress as b}from"../support/updatingProperties.js";import w from"../../layers/BuildingSceneLayerView.js";const V=o.getLogger("esri.views.3d.layers.BuildingSceneLayerView3D"),j=d(i);let C=class extends(g(w)){constructor(){super(...arguments),this.type="building-scene-3d",this.sublayerViews=new s,this._abortController=a(),this._loadingComponents=0}get filterExpression(){const e=this.layer.activeFilterId,r=null!=e?this.layer.filters.find((r=>r.id===e)):null,i=null!=r?r.filterBlocks.find((e=>"solid"===e.filterMode.type)):null;return i?i.filterExpression:null}get filterExpressions(){const e=this.layer.activeFilterId,r=null!=e?this.layer.filters.find((r=>r.id===e)):null;return r&&r.filterBlocks?r.filterBlocks.toArray().map((e=>[e.filterExpression,m(e)])):[]}get updatingProgressValue(){const e=this.sublayerViews,r=this._loadingComponents+(e?e.length:0);return e.reduce(((e,r)=>e+r.updatingProgress),0)/r}isUpdating(){return this._loadingComponents>0||this.sublayerViews&&this.sublayerViews.some((e=>e.updating))}initialize(){f(this.layer.spatialReference,this.view.spatialReference,this.view.viewingMode),this.initializeSubLayerViews(this.layer.sublayers,this)}destroy(){this.sublayerViews&&(this.sublayerViews.forEach((e=>e.destroy())),this.sublayerViews=null),this._abortController.abort(),this._abortController=null}initializeSubLayerViews(e,r){const i=this,s=this.view;e.forEach((e=>{if(!e.isEmpty)if("building-group"===e.type){const i=new j({sublayer:e,view:s,parent:r});this.initializeSubLayerViews(e.sublayers,i)}else"mesh"===e.geometryType&&(this._loadingComponents++,e.load({signal:this._abortController.signal}).then((()=>{const t=new y({sublayer:e,layerView:i,view:s,parent:r});this.sublayerViews.push(t),this.handles.add([p(t,"updating",(()=>this.notifyChange("updating")),!0),p(t,"updatingProgress",(()=>this.notifyChange("updatingProgressValue")),!0)])})).catch((r=>{u(r)||V.error(`Error while creating view for sublayer ${e.id}\nLayer: ${this.layer.url}\n`,r)})).then((()=>{this._loadingComponents--,this.notifyChange("updating"),this.notifyChange("updatingProgressValue")})))}))}getGraphicFromIntersectorMetadata(e){for(const r of this.sublayerViews.items)if(r.sublayer.uid===e.sublayerUid)return r.getGraphicFromIntersectorMetadata(e);return null}async fetchPopupFeatures(e,r){if(!n(r)||!r.clientGraphics||0===r.clientGraphics.length)return;const i=this._findComponent(r.clientGraphics[0].sourceLayer);return l(i)?void 0:i.fetchPopupFeatures(e,r)}whenGraphicBounds(e){const r=this._findComponent(e.sourceLayer);return l(r)?Promise.reject():r.whenGraphicBounds(e)}_findComponent(e){return this.sublayerViews.find((r=>e===r.sublayer))}highlight(e){e instanceof r?e=[e]:e instanceof s&&(e=e.toArray());const i=[];if(Array.isArray(e)&&e.length>0&&e[0]instanceof r){const r=e,s=new Map;for(const e of r){let r=s.get(e.sourceLayer);null==r&&(r=[],s.set(e.sourceLayer,r)),r.push(e)}this.sublayerViews.forEach((e=>{const r=s.get(e.sublayer);r&&i.push(e.highlight(r))}))}return t(i)}getUsedMemory(){return this.sublayerViews.reduce(((e,r)=>e+r.getUsedMemory()),0)}getUnloadedMemory(){return this.sublayerViews.reduce(((e,r)=>e+r.getUnloadedMemory()),0)}ignoresMemoryFactor(){return!1}};e([c()],C.prototype,"sublayerViews",void 0),e([c({readOnly:!0})],C.prototype,"filterExpression",null),e([c({readOnly:!0})],C.prototype,"filterExpressions",null),e([c(b)],C.prototype,"updatingProgress",void 0),e([c({readOnly:!0,dependsOn:[]})],C.prototype,"updatingProgressValue",null),C=e([h("esri.views.3d.layers.BuildingSceneLayerView3D")],C);const v=C;export{v as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../Graphic.js";import i from"../../../core/Accessor.js";import s from"../../../core/Collection.js";import{handlesGroup as t}from"../../../core/handleUtils.js";import o from"../../../core/Logger.js";import{isSome as n,isNone as l}from"../../../core/maybe.js";import{isAbortError as a}from"../../../core/promiseUtils.js";import{init as u}from"../../../core/watchUtils.js";import{property as p}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import"../../../layers/buildingSublayers/BuildingGroupSublayer.js";import h from"./BuildingComponentSublayerView3D.js";import{BuildingSublayerView3DMixin as y}from"./BuildingSublayerView3D.js";import{LayerView3D as d}from"./LayerView3D.js";import{parseFilterMode as g}from"./i3s/BuildingFilterUtil.js";import{checkSpatialReference as m}from"./i3s/I3SUtil.js";import{updatingProgress as f}from"../support/updatingProperties.js";import b from"../../layers/BuildingSceneLayerView.js";const w=o.getLogger("esri.views.3d.layers.BuildingSceneLayerView3D"),V=y(i);let j=class extends(d(b)){constructor(){super(...arguments),this.type="building-scene-3d",this.sublayerViews=new s,this._abortController=new AbortController,this._loadingComponents=0}get filterExpression(){const e=this.layer.activeFilterId,r=null!=e?this.layer.filters.find((r=>r.id===e)):null,i=null!=r?r.filterBlocks.find((e=>"solid"===e.filterMode.type)):null;return i?i.filterExpression:null}get filterExpressions(){const e=this.layer.activeFilterId,r=null!=e?this.layer.filters.find((r=>r.id===e)):null;return r&&r.filterBlocks?r.filterBlocks.toArray().map((e=>[e.filterExpression,g(e)])):[]}get updatingProgressValue(){const e=this.sublayerViews,r=this._loadingComponents+(e?e.length:0);return e.reduce(((e,r)=>e+r.updatingProgress),0)/r}isUpdating(){return this._loadingComponents>0||this.sublayerViews&&this.sublayerViews.some((e=>e.updating))}initialize(){m(this.layer.spatialReference,this.view.spatialReference,this.view.viewingMode),this.initializeSubLayerViews(this.layer.sublayers,this)}destroy(){this.sublayerViews&&(this.sublayerViews.forEach((e=>e.destroy())),this.sublayerViews=null),this._abortController.abort(),this._abortController=null}initializeSubLayerViews(e,r){const i=this,s=this.view;e.forEach((e=>{if(!e.isEmpty)if("building-group"===e.type){const i=new V({sublayer:e,view:s,parent:r});this.initializeSubLayerViews(e.sublayers,i)}else"mesh"===e.geometryType&&(this._loadingComponents++,e.load({signal:this._abortController.signal}).then((()=>{const t=new h({sublayer:e,layerView:i,view:s,parent:r});this.sublayerViews.push(t),this.handles.add([u(t,"updating",(()=>this.notifyChange("updating")),!0),u(t,"updatingProgress",(()=>this.notifyChange("updatingProgressValue")),!0)])})).catch((r=>{a(r)||w.error(`Error while creating view for sublayer ${e.id}\nLayer: ${this.layer.url}\n`,r)})).then((()=>{this._loadingComponents--,this.notifyChange("updating"),this.notifyChange("updatingProgressValue")})))}))}getGraphicFromIntersectorMetadata(e){for(const r of this.sublayerViews.items)if(r.sublayer.uid===e.sublayerUid)return r.getGraphicFromIntersectorMetadata(e);return null}async fetchPopupFeatures(e,r){if(!n(r)||!r.clientGraphics||0===r.clientGraphics.length)return;const i=this._findComponent(r.clientGraphics[0].sourceLayer);return l(i)?void 0:i.fetchPopupFeatures(e,r)}whenGraphicBounds(e){const r=this._findComponent(e.sourceLayer);return l(r)?Promise.reject():r.whenGraphicBounds(e)}_findComponent(e){return this.sublayerViews.find((r=>e===r.sublayer))}highlight(e){e instanceof r?e=[e]:e instanceof s&&(e=e.toArray());const i=[];if(Array.isArray(e)&&e.length>0&&e[0]instanceof r){const r=e,s=new Map;for(const e of r){let r=s.get(e.sourceLayer);null==r&&(r=[],s.set(e.sourceLayer,r)),r.push(e)}this.sublayerViews.forEach((e=>{const r=s.get(e.sublayer);r&&i.push(e.highlight(r))}))}return t(i)}getUsedMemory(){return this.sublayerViews.reduce(((e,r)=>e+r.getUsedMemory()),0)}getUnloadedMemory(){return this.sublayerViews.reduce(((e,r)=>e+r.getUnloadedMemory()),0)}ignoresMemoryFactor(){return!1}};e([p()],j.prototype,"sublayerViews",void 0),e([p({readOnly:!0})],j.prototype,"filterExpression",null),e([p({readOnly:!0})],j.prototype,"filterExpressions",null),e([p(f)],j.prototype,"updatingProgress",void 0),e([p({readOnly:!0,dependsOn:[]})],j.prototype,"updatingProgressValue",null),j=e([c("esri.views.3d.layers.BuildingSceneLayerView3D")],j);const C=j;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.22/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import{forEach as t,result as i}from"../../../core/asyncUtils.js";import r from"../../../core/Logger.js";import{isNone as a,isSome as s}from"../../../core/maybe.js";import{debounce as n,isAbortError as o,eachAlways as l,createAbortController as h,onAbort as m,isAborted as d,createAbortError as c,always as g,throwIfAborted as u}from"../../../core/promiseUtils.js";import{whenOnce as p}from"../../../core/watchUtils.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as f}from"../../../core/accessorSupport/decorators/subclass.js";import x from"../../../geometry/Extent.js";import{equals as w,create as _,width as v,height as b,copy as R,intersection as S}from"../../../geometry/support/aaBoundingRect.js";import{LayerView3D as j}from"./LayerView3D.js";import{computeImageExportSize as E,createGeometryForExtent as I,createOuterImageGeometry as A}from"./support/overlayImageUtils.js";import{toViewIfLocal as C}from"./support/projectExtentUtils.js";import L from"../support/debugFlags.js";import{RenderGeometry as D}from"../webgl-engine/lib/RenderGeometry.js";import{Texture as M}from"../webgl-engine/lib/Texture.js";import{ImageMaterial as G}from"../webgl-engine/materials/ImageMaterial.js";import T from"../../layers/LayerView.js";import{RefreshableLayerView as P}from"../../layers/RefreshableLayerView.js";const H=r.getLogger("esri.views.3d.layers.DynamicLayerView3D");let O=class extends(P(j(T))){constructor(){super(...arguments),this.drapeSourceType=0,this.updatePolicy=1,this.fullExtentInLocalViewSpatialReference=null,this.maximumDataResolution=null,this._images=new Array,this._extents=new Array,this._overlays=new Array,this.updateWhenStationary=!0,this.refreshDebounced=n((async e=>{await this.doRefresh(e).catch((e=>{o(e)||r.getLogger(this.declaredClass).error(e)}))}),2e3)}initialize(){this.addResolvingPromise(C(this).then((e=>this._set("fullExtentInLocalViewSpatialReference",e)))),this.updatingHandles.add(this,"suspended",(()=>this._suspendedChangeHandler())),this.handles.add(this.view.resourceController.scheduler.registerIdleStateCallbacks((()=>{this._isScaleRangeActive()&&this.notifyChange("suspended")}),(()=>{}))),this._isScaleRangeLayer()&&this.updatingHandles.add(this.layer,"scaleRangeId",(()=>this.notifyChange("suspended")))}destroy(){this.clear()}setDrapingExtent(e,t){this._spatialReference=t,e.forEach((e=>{this._overlays[e.index]=e,this._updateImageExtent(e)}))}_updateImageExtent(e){const t=this._clippedExtent(e.extent,V);if(a(t))return;const i=E(e.extent,t,e.resolution);let r=e.pixelRatio*this.view.pixelRatio;if("imageMaxWidth"in this.layer||"imageMaxHeight"in this.layer){const e=this.layer.imageMaxWidth,t=this.layer.imageMaxHeight;if(i.width>e){const t=e/i.width;i.height=Math.floor(i.height*t),i.width=e,r*=t}if(i.height>t){const e=t/i.height;i.width=Math.floor(i.width*e),i.height=t,r*=e}}const s=this._extents[e.index];s&&w(s.extent,t)&&this._imageSizeEquals(t,s.imageSize,i)||(this._extents[e.index]={extent:_(t),imageSize:i,pixelRatio:r},this.suspended||this._fetch(e.index).catch((e=>{o(e)||H.error(e)})))}clear(){for(let e=0;e<this._images.length;e++)this._clearImage(e)}async doRefresh(e){if(this.suspended)return;const t=[];for(let i=0;i<this._extents.length;i++)this._extents[i]&&t.push(this._fetch(i,e));await l(t)}canResume(){if(!super.canResume())return!1;if(this._isScaleRangeLayer()){const{minScale:e,maxScale:t}=this.layer;if(e>0||t>0){const i=this.view.scale;if(i<t||e>0&&i>e)return!1}}return!0}isUpdating(){return this._images.some((e=>!!e.loadingPromise))}async processResult(e,t,i){(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement)&&(e.image=t)}findExtentInfoAt(e){for(const t of this._extents){const i=t.extent;if(new x(i[0],i[1],i[2],i[3],this._spatialReference).contains(e))return t}return null}getFetchOptions(){}async redraw(e,i){await t(this._images,(async(t,r)=>{t&&(await e(t,i),await this._createStageObjects(r,t.image))}))}_imageSizeEquals(e,t,i){if(!this.maximumDataResolution||L.TESTS_DISABLE_UPDATE_THRESHOLDS)return!1;const r=v(e)/this.maximumDataResolution.x,a=b(e)/this.maximumDataResolution.y,s=r/t.width,n=a/t.height,o=r/i.width,l=a/i.height,h=Math.abs(s-o),m=Math.abs(n-l);return h<=1.5&&m<=1.5}async _fetch(e,t){if(this.suspended)return;const i=this._extents[e],r=i.extent;this._images[e]||(this._images[e]={texture:null,material:null,renderGeometry:null,loadingPromise:null,loadingAbortController:null,image:null,pixelData:null,renderExtent:_(r)});const a=this._images[e];a.loadingAbortController&&(a.loadingAbortController.abort(),a.loadingAbortController=null);const s=new x(r[0],r[1],r[2],r[3],this._spatialReference);if(0===s.width||0===s.height)return void this._clearImage(e);const n=h();a.loadingAbortController=n,m(t,(()=>n.abort()));const l=n.signal,u=this._waitFetchReady(l).then((()=>{const t={requestAsImageElement:!0,pixelRatio:this._overlays[e].pixelRatio,...this.getFetchOptions(),signal:l},{height:r,width:a}=i.imageSize;return this.layer.fetchImage(s,a,r,t)})).then((e=>{if(d(l))throw H.warnOnce("A call to fetchImage resolved even though the request was aborted. fetchImage should not resolve if options.signal.aborted is true."),c();return this.processResult(a,e)})).then((()=>R(a.renderExtent,r)));a.loadingPromise=u,g(u,(()=>{u===a.loadingPromise&&(a.loadingPromise=null,a.loadingAbortController=null)})),this.notifyChange("updating"),await u.then((async()=>{await this._createStageObjects(e,a.image),this.notifyChange("updating")})).catch((e=>{throw e&&!o(e)&&H.error(e),this.notifyChange("updating"),e}))}_clearImage(e){const t=this._images[e];if(t){s(t.renderGeometry)&&(this.view.basemapTerrain.overlayManager.renderer.removeGeometries([t.renderGeometry],this,2),t.renderGeometry=null);const e=this.view._stage;e.remove(t.texture),t.texture=null,e.remove(t.material),t.material=null,t.loadingAbortController&&(t.loadingAbortController.abort(),t.loadingAbortController=null),t.loadingPromise=null,t.image=null,t.pixelData=null}}async _createStageObjects(e,t){const r=this.view._stage,n=this._images[e],o=this.view.basemapTerrain.overlayManager.renderer,l=()=>{r.remove(n.texture),n.texture=null,s(n.renderGeometry)&&(o.removeGeometries([n.renderGeometry],this,2),n.renderGeometry=null)};if(t){const s=new M(t,{width:t.width,height:t.height,preMultiplyAlpha:!0,wrap:{s:33071,t:33071}});let h;if(await i(this._images[0===e?1:0].loadingPromise),0===e)h=I(n.renderExtent);else{const e=this._images[0].renderExtent;if(!e)return void l();h=A(e,n.renderExtent)}l(),r.add(s),n.texture=s,a(n.material)?(n.material=new G({transparent:!0,textureId:s.id}),r.add(n.material)):n.material.setParameterValues({textureId:s.id}),n.renderGeometry=new D(h,n.material),n.renderGeometry.origin=this._overlays[e].renderLocalOrigin,o.addGeometries([n.renderGeometry],this,2)}else l(),r.remove(n.material),n.material=null}_isScaleRangeLayer(){return"minScale"in this.layer&&"maxScale"in this.layer}_isScaleRangeActive(){return!!this._isScaleRangeLayer()&&(this.layer.minScale>0||this.layer.maxScale>0)}_clippedExtent(e,t){if("local"!==this.view.viewingMode)return R(t,e);const i=this.view.basemapTerrain;return i.ready?S(e,i.extent,t):R(t,e)}_suspendedChangeHandler(){this.suspended?this.clear():this.refreshDebounced()}async _waitFetchReady(e){await p(this.view,"stationary",e),u(e)}};e([y()],O.prototype,"layer",void 0),e([y()],O.prototype,"suspended",void 0),e([y({readOnly:!0})],O.prototype,"fullExtentInLocalViewSpatialReference",void 0),e([y()],O.prototype,"updating",void 0),O=e([f("esri.views.3d.layers.DynamicLayerView3D")],O);const V=_(),U=O;export{U as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import{forEach as t,result as i}from"../../../core/asyncUtils.js";import r from"../../../core/Logger.js";import{isNone as a,isSome as s}from"../../../core/maybe.js";import{debounce as n,isAbortError as o,eachAlways as l,onAbort as h,isAborted as m,createAbortError as d,always as c,throwIfAborted as g}from"../../../core/promiseUtils.js";import{whenOnce as u}from"../../../core/watchUtils.js";import{property as p}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as y}from"../../../core/accessorSupport/decorators/subclass.js";import f from"../../../geometry/Extent.js";import{equals as x,create as w,width as _,height as v,copy as b,intersection as R}from"../../../geometry/support/aaBoundingRect.js";import{LayerView3D as S}from"./LayerView3D.js";import{computeImageExportSize as j,createGeometryForExtent as E,createOuterImageGeometry as I}from"./support/overlayImageUtils.js";import{toViewIfLocal as A}from"./support/projectExtentUtils.js";import C from"../support/debugFlags.js";import{RenderGeometry as L}from"../webgl-engine/lib/RenderGeometry.js";import{Texture as M}from"../webgl-engine/lib/Texture.js";import{ImageMaterial as D}from"../webgl-engine/materials/ImageMaterial.js";import G from"../../layers/LayerView.js";import{RefreshableLayerView as T}from"../../layers/RefreshableLayerView.js";const P=r.getLogger("esri.views.3d.layers.DynamicLayerView3D");let O=class extends(T(S(G))){constructor(){super(...arguments),this.drapeSourceType=0,this.updatePolicy=1,this.fullExtentInLocalViewSpatialReference=null,this.maximumDataResolution=null,this._images=new Array,this._extents=new Array,this._overlays=new Array,this.updateWhenStationary=!0,this.refreshDebounced=n((async e=>{await this.doRefresh(e).catch((e=>{o(e)||r.getLogger(this.declaredClass).error(e)}))}),2e3)}initialize(){this.addResolvingPromise(A(this).then((e=>this._set("fullExtentInLocalViewSpatialReference",e)))),this.updatingHandles.add(this,"suspended",(()=>this._suspendedChangeHandler())),this.handles.add(this.view.resourceController.scheduler.registerIdleStateCallbacks((()=>{this._isScaleRangeActive()&&this.notifyChange("suspended")}),(()=>{}))),this._isScaleRangeLayer()&&this.updatingHandles.add(this.layer,"scaleRangeId",(()=>this.notifyChange("suspended")))}destroy(){this.clear()}setDrapingExtent(e,t){this._spatialReference=t,e.forEach((e=>{this._overlays[e.index]=e,this._updateImageExtent(e)}))}_updateImageExtent(e){const t=this._clippedExtent(e.extent,H);if(a(t))return;const i=j(e.extent,t,e.resolution);let r=e.pixelRatio*this.view.pixelRatio;if("imageMaxWidth"in this.layer||"imageMaxHeight"in this.layer){const e=this.layer.imageMaxWidth,t=this.layer.imageMaxHeight;if(i.width>e){const t=e/i.width;i.height=Math.floor(i.height*t),i.width=e,r*=t}if(i.height>t){const e=t/i.height;i.width=Math.floor(i.width*e),i.height=t,r*=e}}const s=this._extents[e.index];s&&x(s.extent,t)&&this._imageSizeEquals(t,s.imageSize,i)||(this._extents[e.index]={extent:w(t),imageSize:i,pixelRatio:r},this.suspended||this._fetch(e.index).catch((e=>{o(e)||P.error(e)})))}clear(){for(let e=0;e<this._images.length;e++)this._clearImage(e)}async doRefresh(e){if(this.suspended)return;const t=[];for(let i=0;i<this._extents.length;i++)this._extents[i]&&t.push(this._fetch(i,e));await l(t)}canResume(){if(!super.canResume())return!1;if(this._isScaleRangeLayer()){const{minScale:e,maxScale:t}=this.layer;if(e>0||t>0){const i=this.view.scale;if(i<t||e>0&&i>e)return!1}}return!0}isUpdating(){return this._images.some((e=>!!e.loadingPromise))}async processResult(e,t,i){(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement)&&(e.image=t)}findExtentInfoAt(e){for(const t of this._extents){const i=t.extent;if(new f(i[0],i[1],i[2],i[3],this._spatialReference).contains(e))return t}return null}getFetchOptions(){}async redraw(e,i){await t(this._images,(async(t,r)=>{t&&(await e(t,i),await this._createStageObjects(r,t.image))}))}_imageSizeEquals(e,t,i){if(!this.maximumDataResolution)return!1;const r=_(e)/this.maximumDataResolution.x,a=v(e)/this.maximumDataResolution.y,s=r/t.width,n=a/t.height,o=r/i.width,l=a/i.height,h=Math.abs(s-o),m=Math.abs(n-l),d=C.TESTS_DISABLE_OPTIMIZATIONS?0:1.5;return h<=d&&m<=d}async _fetch(e,t){if(this.suspended)return;const i=this._extents[e],r=i.extent;this._images[e]||(this._images[e]={texture:null,material:null,renderGeometry:null,loadingPromise:null,loadingAbortController:null,image:null,pixelData:null,renderExtent:w(r)});const a=this._images[e];a.loadingAbortController&&(a.loadingAbortController.abort(),a.loadingAbortController=null);const s=new f(r[0],r[1],r[2],r[3],this._spatialReference);if(0===s.width||0===s.height)return void this._clearImage(e);const n=new AbortController;a.loadingAbortController=n,h(t,(()=>n.abort()));const l=n.signal,g=this._waitFetchReady(l).then((()=>{const t={requestAsImageElement:!0,pixelRatio:this._overlays[e].pixelRatio,...this.getFetchOptions(),signal:l},{height:r,width:a}=i.imageSize;return this.layer.fetchImage(s,a,r,t)})).then((e=>{if(m(l))throw P.warnOnce("A call to fetchImage resolved even though the request was aborted. fetchImage should not resolve if options.signal.aborted is true."),d();return this.processResult(a,e)})).then((()=>b(a.renderExtent,r)));a.loadingPromise=g,c(g,(()=>{g===a.loadingPromise&&(a.loadingPromise=null,a.loadingAbortController=null)})),this.notifyChange("updating"),await g.then((async()=>{await this._createStageObjects(e,a.image),this.notifyChange("updating")})).catch((e=>{throw e&&!o(e)&&P.error(e),this.notifyChange("updating"),e}))}_clearImage(e){const t=this._images[e];if(t){s(t.renderGeometry)&&(this.view.basemapTerrain.overlayManager.renderer.removeGeometries([t.renderGeometry],this,2),t.renderGeometry=null);const e=this.view._stage;e.remove(t.texture),t.texture=null,e.remove(t.material),t.material=null,t.loadingAbortController&&(t.loadingAbortController.abort(),t.loadingAbortController=null),t.loadingPromise=null,t.image=null,t.pixelData=null}}async _createStageObjects(e,t){const r=this.view._stage,n=this._images[e],o=this.view.basemapTerrain.overlayManager.renderer,l=()=>{r.remove(n.texture),n.texture=null,s(n.renderGeometry)&&(o.removeGeometries([n.renderGeometry],this,2),n.renderGeometry=null)};if(t){const s=new M(t,{width:t.width,height:t.height,preMultiplyAlpha:!0,wrap:{s:33071,t:33071}});let h;if(await i(this._images[0===e?1:0].loadingPromise),0===e)h=E(n.renderExtent);else{const e=this._images[0].renderExtent;if(!e)return void l();h=I(e,n.renderExtent)}l(),r.add(s),await r.loadSynchronous(s),n.texture=s,a(n.material)?(n.material=new D({transparent:!0,textureId:s.id}),r.add(n.material)):n.material.setParameters({textureId:s.id}),n.renderGeometry=new L(h,n.material),n.renderGeometry.origin=this._overlays[e].renderLocalOrigin,o.addGeometries([n.renderGeometry],this,2)}else l(),r.remove(n.material),n.material=null}_isScaleRangeLayer(){return"minScale"in this.layer&&"maxScale"in this.layer}_isScaleRangeActive(){return!!this._isScaleRangeLayer()&&(this.layer.minScale>0||this.layer.maxScale>0)}_clippedExtent(e,t){if("local"!==this.view.viewingMode)return b(t,e);const i=this.view.basemapTerrain;return i.ready?R(e,i.extent,t):b(t,e)}_suspendedChangeHandler(){this.suspended?this.clear():this.refreshDebounced()}async _waitFetchReady(e){await u(this.view,"stationary",e),g(e)}};e([p()],O.prototype,"layer",void 0),e([p()],O.prototype,"suspended",void 0),e([p({readOnly:!0})],O.prototype,"fullExtentInLocalViewSpatialReference",void 0),e([p()],O.prototype,"updating",void 0),O=e([y("esri.views.3d.layers.DynamicLayerView3D")],O);const H=w(),V=O;export{V as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../Graphic.js";import s from"../../../core/Collection.js";import r from"../../../core/has.js";import o from"../../../core/Logger.js";import{someMap as a}from"../../../core/MapUtils.js";import{unwrapOr as n,destroyMaybe as l,isSome as d,isNone as h,applySome as c,unwrap as u}from"../../../core/maybe.js";import _ from"../../../core/PooledArray.js";import{throwIfAborted as m,createResolver as g}from"../../../core/promiseUtils.js";import{schedule as p}from"../../../core/scheduling.js";import{isArrayBuffer as f}from"../../../core/typedArrayUtil.js";import{getMetersPerVerticalUnitForSR as b}from"../../../core/unitUtils.js";import{init as y}from"../../../core/watchUtils.js";import{property as v}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as I}from"../../../core/accessorSupport/decorators/subclass.js";import{f as M}from"../../../chunks/mat3.js";import{c as x}from"../../../chunks/mat3f32.js";import{m as C,z as O}from"../../../chunks/mat4.js";import{b as j,c as w}from"../../../chunks/mat4f64.js";import{m as S,g as E}from"../../../chunks/vec3.js";import{c as D}from"../../../chunks/vec3f64.js";import{s as F}from"../../../chunks/vec4.js";import{projectBuffer as R,getProjectorName as N,localLinearScaleFactors as T,projectVectorToVector as V,projectBoundingSphere as P}from"../../../geometry/projection.js";import{create as A,empty as H,expandWithBuffer as U,intersects as G}from"../../../geometry/support/aaBoundingBox.js";import L from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as B}from"../../../layers/support/fieldUtils.js";import{areLabelsVisible as k}from"../../../layers/support/layerUtils.js";import q from"../../../layers/support/SceneModification.js";import{getColor as z,getOpacity as W}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{loadArcade as $}from"../../../support/arcadeOnDemand.js";import K from"../../../symbols/Symbol3D.js";import{getMetersPerUnit as J}from"../../../symbols/support/unitConversionUtils.js";import Q from"./I3SMeshViewLabeler.js";import{I3SMeshWorkerHandle as X,toWasmModification as Y}from"./I3SMeshWorkerHandle.js";import{initialize as Z,setModificationsSync as ee,filterObbsForModificationsSync as te,interpretObbModificationResults as ie}from"./SceneLayerWorker.js";import{overrideColor as se}from"./graphics/graphicUtils.js";import re from"./i3s/Highlights.js";import{I3SAttributeOverrides as oe}from"./i3s/I3SAttributeOverrides.js";import{I3SCrossfadeHelper as ae,NodeCrossfadeMetaData as ne}from"./i3s/I3SCrossfadeHelper.js";import le from"./i3s/I3SElevationProvider.js";import{boundingBoxCornerPoints as de}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as he}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as ce,selectEncoding as ue,createTexture as _e,configureMaterial as me}from"./i3s/I3SMaterialUtil.js";import{computeGlobalTransformation as ge,getLocalOrigin as pe}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as fe,checkSceneLayerValid as be,checkSceneLayerCompatibleWithView as ye,getCacheKeySuffix as ve,whenGraphicAttributes as Ie,computeVisibilityObb as Me,filterInPlace as xe,getCachedAttributeValue as Ce,intersectBoundingBoxWithMbs as Oe,addWraparound as je,getSymbolInfo as we,transparentEdgeMaterial as Se,getClipAABB as Ee}from"./i3s/I3SUtil.js";import{IDBCache as De}from"./i3s/IDBCache.js";import{attributeLookup as Fe}from"./support/attributeUtils.js";import Re from"../support/debugFlags.js";import{projectToBoundingBox as Ne}from"../support/extentUtils.js";import{create as Te,clone as Ve}from"../support/orientedBoundingBox.js";import{updatingProgress as Pe}from"../support/updatingProperties.js";import{glLayout as Ae}from"../support/buffer/glUtil.js";import{createVertexBufferLayout as He}from"../webgl-engine/collections/Component/SourceGeometry.js";import{loadBasis as Ue}from"../webgl-engine/lib/BasisUtil.js";const Ge=o.getLogger("esri.views.3d.layers.SceneLayerView3D"),Le=[1,1,1,1];class Be extends ne{constructor(e,t,i,s,r,o,a){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=o,this.textures=a,this.cachedEdgeMaterials=new Array,this.cachedSymbology=null}}const ke=19,qe=104857600,ze=t=>{let o=class extends t{constructor(...e){super(e),this._elevationProvider=null,this._intersectionHandler=null,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._hasLoadedPBRTextures=!1,this._asyncModuleLoading=0,this._addTasks=new Map,this._rendererVersion=0,this._colorVariable=null,this._opacityVariable=null,this._rendererFields=null,this._symbologyFields=null,this._symbologyOverride=null,this._symbologyOverrideFields=null,this._symbolInfos=new Map,this._idbCache=new De("esri-scenelayer-cache","geometries"),this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.slicePlaneEnabled=!1,this._modifications=new Array,this._layerUrl="",this._cacheKeySuffix=null,this._arcade=null,this._tmpAttributeOnlyGraphic=new i(null,null,{}),this._crossfadeHelper=new ae(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerUid(){return this.i3slayer&&this.i3slayer.uid}get sublayerUid(){return null}get hasTexturesOrVertexColors(){return this._hasData?this._hasTextures||this._hasColors?"yes":"probably-not":"unknown"}get rendererTextureUsage(){return fe(this._currentRenderer)?this._usePBR()||this._hasLoadedPBRTextures?63:37:this._usePBR()||this._hasLoadedPBRTextures?44:36}get elevationOffset(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null!=e&&"absolute-height"===e.mode){const t=b(this.i3slayer.spatialReference),i=J(e.unit);return n(e.offset,0)*i/t}return 0}get supportedTextureEncodings(){return ce(this.view._stage.renderView.capabilities)}get uncompressedTextureDownsamplingEnabled(){var e;const t=null==(e=this.view)?void 0:e.qualitySettings.sceneService.uncompressedTextureDownsamplingEnabled,i=0==(4&this.supportedTextureEncodings);return t&&i}initialize(){this.preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const e=this.view.resourceController;if(this.attributeOverrides=new oe(this.i3slayer,e.memoryController),this._worker=new X((t=>e.schedule(t))),this.addResolvingPromise(this._worker.promise),this._worker.setLegacySchema(this.layerUid,this.i3slayer.store.defaultGeometrySchema),be(this.i3slayer),ye(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new L({layerView:this}),this.gpuMemoryEstimate=0,this.texMemoryEstimate=0,this.geoMemoryEstimate=0,this._stage=this.view._stage,this._collection=this._stage.renderView.componentObjectCollection,this._highlights=new re({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,1),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)}),this._isIntegratedMesh||!this.i3slayer.store.defaultGeometrySchema)this._hasSymbolColors=!1;else{const e=this.i3slayer.store.defaultGeometrySchema.featureAttributes;this._hasSymbolColors=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=this.i3slayer.store.defaultGeometrySchema.vertexAttributes.color&&(null==this.i3slayer.cachedDrawingInfo||!this.i3slayer.cachedDrawingInfo.color),this._isIntegratedMesh||(this._edgeView=this._stage.renderView.ensureEdgeView());const t=this.view.resourceController.memoryController.newCache(this.i3slayer.uid,(e=>this._deleteComponentObject(e)));this._memCache=t;const i=e=>d(this._controller.index)&&d(this._controller.index.rootNode)?this._controller.index.traverse(this._controller.index.rootNode,(t=>{const i=t.index,s=this._nodeId2Meta.get(i)||this._nodeId2MetaReloading.get(i);return e(t,d(s)?s.objectHandle:null)})):()=>{};this._intersectionHandler=new he({layerUid:this.layerUid,sublayerUid:this.sublayerUid,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:i}),this._elevationProvider=new le({layerView:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR(),this.updatingHandles.add(this,"view.clippingArea",(()=>this._clippingAreaChanged()),2),this.updatingHandles.add(this,"fullOpacity",(e=>this._opacityChange(e))),this.updatingHandles.add(this,"slicePlaneEnabled",(e=>this._slicePlaneEnabledChange(e))),this.updatingHandles.add(this,"elevationOffset",((e,t)=>{this._reloadAll(t),this._controller.invalidateVisibilityObbs()})),this.updatingHandles.add(this,"filter",(()=>this._filterChange()),2),this.updatingHandles.add(this,"view.qualitySettings.physicallyBasedRenderingEnabled",(()=>this._updatePBR()));const s=()=>{this._reloadAll(),this.clearMemCache()};this.updatingHandles.add(this,"rendererTextureUsage",s),this.updatingHandles.add(this,"uncompressedTextureDownsamplingEnabled",s),this.updatingHandles.add(this,"suspended",(e=>this._suspendedChange(e)),2),this.updatingHandles.add(this.i3slayer,"labelsVisible",(()=>this._labelingChanged()),2),this.updatingHandles.add(this.i3slayer,"labelingInfo",(()=>this._labelingChanged()),2),this.updatingHandles.add(this,"_modifications",(()=>this._modificationsChanged()),2),this.handles.add([y(Re,"I3S_TREE_SHOW_TILES",(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&Re.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||Re.I3S_TREE_SHOW_TILES||(this._treeDebugger=l(this._treeDebugger))})),y(Re,"I3S_SHOW_MODIFICATIONS",(()=>this._showModifications()))]),this._cacheKeySuffix=ve(this.i3slayer.spatialReference,this.view.renderSpatialReference),this._idbCache.init().catch((e=>Ge.warn(`Failed to initialize IndexedDB cache: ${e}`)))}destroy(){this._clearAddTasks(),this.attributeOverrides=l(this.attributeOverrides),this._elevationProvider&&(this._elevationProvider.layerChanged(),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._worker;e&&(e.destroyContext(this.i3slayer.uid).then((()=>e.destroy())),this._worker=null),this._removeAllNodeDataFromStage(),this._memCache=l(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=l(this._labeler),this._treeDebugger=l(this._treeDebugger),this._controller=l(this._controller),this._highlights.destroy(),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}memEstimateTextureAdded(e){const t=e.estimatedTexMemRequired;return this.gpuMemoryEstimate+=t,this.texMemoryEstimate+=t,t}memEstimateTextureRemoved(e){const t=e.estimatedTexMemRequired;this.gpuMemoryEstimate-=t,this.texMemoryEstimate-=t}memEstimateGeometryAdded(e){const t=this._collection.getObjectGPUMemoryUsage(e);return this.gpuMemoryEstimate+=t,this.geoMemoryEstimate+=t,t}memEstimateGeometryRemoved(e){const t=this._collection.getObjectGPUMemoryUsage(e);this.gpuMemoryEstimate-=t,this.geoMemoryEstimate-=t}isNodeLoaded(e){return this._nodeId2Meta.has(e)}isNodeReloading(e){return this._nodeId2MetaReloading.has(e)}getUsedMemory(){let e=d(this._labeler)?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach((t=>e+=d(t)?t.node.memory:0)),this._nodeId2MetaReloading.forEach((t=>e+=d(t)?t.node.memory:0)),e}getUnloadedMemory(){return(d(this._controller)?this._controller.unloadedMemoryEstimate:0)+(d(this._labeler)?this._labeler.unloadedMemoryEstimate:0)}ignoresMemoryFactor(){return!1}_labelingChanged(){if(!(k(this.i3slayer)&&this._supportsLabeling))return void(d(this._labeler)&&(this._labeler.destroy(),this._labeler=null));if(d(this._labeler))return;const e=new Q({view:this.view,layer:this.i3slayer,collection:this._collection});this._nodeId2Meta.forEach((t=>d(t)&&this._addMetaToLabeler(e,t))),this._labeler=e}_loadAsyncModule(e){return++this._asyncModuleLoading,e.then((e=>(--this._asyncModuleLoading,e)),(e=>{throw--this._asyncModuleLoading,e}))}_modificationsChanged(){if(!this._i3sWasmLoaded&&this._hasModifications)return this._i3sWasmLoaded=Z().then((()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()})),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=this.i3slayer.uid,t=this.i3slayer.spatialReference;this._worker.setModifications(e,this._modifications,t);const i=Y(this._modifications,t);ee({context:e,modifications:i,isGeodetic:t.isGeographic}),this._controller.modificationsChanged();const s=this._hasModifications?new _:null;this._nodeId2Meta.forEach(((e,t)=>{h(e)?this._nodeId2Meta.delete(t):e.node.hasModifications?(this._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):d(s)&&s.push(e.node)})),d(s)&&this._nodeId2MetaReloading.forEach((e=>s.push(e.node))),d(s)&&s.length>0&&(this.updateNodeModificationStatus(s),s.forAll((e=>{if(2!==e.imModificationImpact){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),this._nodeId2Meta.delete(e.index),d(t)&&this._nodeId2MetaReloading.set(e.index,t)}}))),this.clearMemCache(),this._controller.restartNodeLoading(),this._showModifications()}_showModifications(){if(d(this._modificationGraphics)&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!Re.I3S_SHOW_MODIFICATIONS||0===this._modifications.length)return;const e={clip:[227,227,79,.8],mask:[227,139,79,.8],replace:[139,227,79,.8]},t={type:"simple-fill",outline:{color:[255,255,255],width:1}};this._modificationGraphics=new Array;for(const s of this._modifications){s.geometry.spatialReference=this.i3slayer.spatialReference;const r={...t,color:e[s.type]};this._modificationGraphics.push(new i({geometry:s.geometry,symbol:r}))}this.view.graphics.addMany(this._modificationGraphics)}_addMetaToLabeler(e,t){e.addNodeMeta(t,((e,t)=>this._createAttributes(e,t)))}_suspendedChange(e){e?(this._removeAllNodeDataFromStage(),this.view.elevationProvider&&this.view.elevationProvider.unregister(this._elevationProvider),this._stage.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler)):(this.view.elevationProvider.register(this._elevationContext,this._elevationProvider),this._stage.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler))}getLoadedAttributes(e){const t=this._nodeId2Meta.get(e);if(d(t)&&d(t.attributeInfo))return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if(d(t)&&d(t.attributeInfo))return t.attributeInfo.attributeData}setAttributeData(e,t){const i=this._nodeId2Meta.get(e);d(i)&&d(i.attributeInfo)&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const s=this._nodeId2Meta.get(e);d(s)&&(await this.attributeOverrides.apply(s.featureIds,t,i),s.attributeInfo=t,this._attributeValuesChanged(s))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.filteredIds=null,d(this._labeler)&&this._labeler.setNodeMetaAttributes(e,((e,t)=>this._createAttributes(e,t))),this._updateEngineObject(e)}clearMemCache(){d(this._memCache)&&this._memCache.clear()}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach((t=>d(t)&&e.push(t.node))),e}getLoadedNodeIndices(e){this._nodeId2Meta.forEach(((t,i)=>e.push(i))),this._nodeId2MetaReloading.forEach(((t,i)=>e.push(i)))}preLoadBasis(){!r("disable-feature:i3s-basis")&&0!=(2&this.supportedTextureEncodings)&&c(this.i3slayer.textureSetDefinitions,(e=>e.some((e=>e.formats.some((e=>"basis"===e.format||"ktx2"===e.format))))))&&Ue()}_getVertexBufferLayout(e,t){const i={hasTexture:Ye(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion};return Ae(He(this._getGeometryParameters(i)))}_getObjectIdField(){return this.i3slayer.objectIdField||"OBJECTID"}_findGraphicNodeAndIndex(e){const t=Fe(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());let i=null;return a(this._nodeId2Meta,(e=>{if(h(e))return!1;const s=e.featureIds.indexOf(t);return-1!==s&&(i={node:e.node,index:s},!0)})),i}_getGraphicIndices(e,t){const i=this._nodeId2Meta.get(e.index);if(h(i))return[];const s=[],r=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const a of t){const e=Fe(o,a.attributes,r),t=i.featureIds.indexOf(e);-1!==t&&s.push(t)}return s}whenGraphicBounds(e){const t=this._findGraphicNodeAndIndex(e);if(!t)return Promise.reject();const i=this._nodeId2Meta.get(t.node.index);if(h(i))return Promise.reject();const s=i.objectHandle,r=de(t.index,this._collection,s,new Float64Array(24)),o=this.view.renderSpatialReference,a=this.view.spatialReference;if(R(r,o,0,r,a,0,8)){const e=H();return U(e,r,0,8),Promise.resolve({boundingBox:e,screenSpaceObjects:[]})}}whenGraphicAttributes(e,t){return Ie(this.i3slayer,e,this._getObjectIdField(),t,(()=>[...this._nodeId2Meta.values()].filter(d)))}getGraphicFromIntersectorMetadata(e){if(null==e.nodeIndex||null==e.componentIndex)return null;const t=this._nodeId2Meta.get(e.nodeIndex);return h(t)||null==t.featureIds||e.componentIndex>=t.featureIds.length?null:this._createGraphic(e.componentIndex,t)}_getCacheKey(e){return`${this._layerUrl}/v${ke}/${e.id}${this._cacheKeySuffix}`}_getMemCacheKey(e,t=this.elevationOffset){return e+"#"+t}get _idbCacheEnabled(){return!this._controller.disableIDBCache&&0===this._modifications.length&&0===this.elevationOffset&&null!=this._cacheKeySuffix}loadCachedGPUData(e){return d(this._memCache)?this._memCache.pop(this._getMemCacheKey(e.index)):null}deleteCachedGPUData(e){d(e)&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(h(this._memCache))return void this._deleteComponentObject(e);const i=this._controller.indexDepth-e.node.level;this._memCache.put(this._getMemCacheKey(e.node.index,t),e,e.node.memory,i)}loadMissingTextures(e,t,i,s){const r=e.filter(((e,i)=>{if(0==(e.usage&this.rendererTextureUsage))return!1;if(h(t))return!0;const s=ue(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(h(r)||null==r.data||s&&r.encoding!==s.encoding)}));return 0===r.length?Promise.resolve(!1):i(r,s).then((i=>{let s=0;for(let r=0;r<e.length;r++)s<i.length&&i[s].id===e[r].id&&(t[r]=i[s],s++);return!0}))}loadCachedNodeData(e,t,i){return this._idbCacheEnabled?this._idbCache.get(this._getCacheKey(e),t).then((s=>null==s?null:s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e)),null):(e.geometryObb=s.geometryObb,this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then((i=>(i&&this._idbCache.initialized&&d(s.textureData)&&(s.byteSize=tt(s.transformedGeometry,s.textureData),s.textureData.every(et)&&it(e,s)&&this._idbCache.put(this._getCacheKey(e),s).catch((t=>Ge.warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`)))),m(t),s)))))):Promise.resolve(null)}addNode(e,t,i){return Ze(t)?this._addData(e,t.attributeDataInfo,(()=>this._transformNode(e,t,i).then((s=>this._safeReschedule((()=>{if(h(s))return e.hasModifications=!1,this._addCachedNodeData(e,null,i);e.hasModifications=s.transformedGeometry.hasModifications;const{obb:r,componentOffsets:o,featureIds:a,transformedGeometry:n}=s,l=this._controller.crsIndex,c=this.view.renderSpatialReference,u=ge(e.mbs,this.elevationOffset,l,c);e.geometryObb=Te([r.center.x,r.center.y,r.center.z],[r.extents.x,r.extents.y,r.extents.z],[r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w]),S(e.geometryObb.center,e.geometryObb.center,u),t.geometryData.componentOffsets=o,a&&(t.geometryData.featureIds=Array.prototype.slice.call(a));const _={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:n,globalTrafo:u,geometryObb:e.geometryObb,byteSize:tt(n,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&it(e,_)){const t=d(_.textureData)?_.textureData.map((e=>et(e)?e:null)):null;this._idbCache.put(this._getCacheKey(e),{..._,textureData:t}).catch((t=>Ge.warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`)))}return this._addCachedNodeData(e,_,i)}),i))))):Promise.reject()}computeVisibilityObb(e){return Me(e,this.view.renderSpatialReference,this._controller.crsIndex,this.i3slayer.spatialReference,this.elevationOffset,this._modifications)}_transformNode(e,t,i){const s=t.geometryData.geometries,r=new Array(s.length);for(let h=0;h<s.length;++h)r[h]=this._getVertexBufferLayout(s[h],t.geometryDescriptor);const o=e.mbs,a=this.elevationOffset,n=this._controller.crsIndex,l=this._controller.crsVertex,d=this.view.renderSpatialReference,c=pe(o,a,n),u=ge(o,a,n,d),_=N(n,l),m=N(l,d);if(h(_)||h(m))return Promise.resolve(null);const g={context:this.i3slayer.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,localOrigin:c,globalTrafo:u,mbs:o,obb:e.serviceObb,elevationOffset:a,needNormals:!this._isIntegratedMesh&&this._controller.isMeshPyramid,normalReferenceFrame:this.i3slayer.normalReferenceFrame||"none",indexToVertexProjector:_,vertexToRenderProjector:m};return this._worker.invoke(g,i)}get supportsNodeCrossFading(){var e,t;return!(null!=(e=this.view)&&null!=(t=e._stage)&&t.renderView.hasShadowsEnabled)}get nodeCrossfadingEnabled(){return this.supportsNodeCrossFading&&(this.lodCrossfadeinDuration>0||this.lodCrossfadeoutDuration>0||this.lodCrossfadeUncoveredDuration>0)}get nodeFadeoutEnabled(){return this.supportsNodeCrossFading&&this.lodCrossfadeoutDuration>0}_setNewNodeOpacity(e){const t=this.nodeCrossfadingEnabled?0:this.fullOpacity;this._setNodeOpacity(e,t)}addCachedGPUData(e,t,i){if(e.geometryObb=Ve(this._collection.getComponentObb(t.objectHandle)),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);d(this._labeler)&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,1),this._updateMaterial(t),this._setNewNodeOpacity(t),this._updateEngineObject(t),this._highlights.objectCreated(t),d(this._treeDebugger)&&this._treeDebugger.update()}addCachedNodeData(e,t,i,s){return this._addData(e,i,(()=>this._addCachedNodeData(e,t,s)))}async _addCachedNodeData(e,t,i){if(this.suspended||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(h(t))return void this._addNodeMeta(e.index,null);const s=this._addTasks.get(e.index),{geometryData:o,transformedGeometry:a,globalTrafo:n}=t;await this.attributeOverrides.apply(o.featureIds,s.attributeInfo,i);const l=d(t.textureData)?t.textureData.filter((e=>d(e)&&0!=(e.usage&this.rendererTextureUsage))):[];!r("disable-feature:i3s-basis")&&l.some((e=>d(e)&&(2===e.encoding||1===e.encoding)))&&await Ue(),e.memory=0;const{componentOffsets:c,geometries:_,featureIds:m}=o,g=this._collection,p=_[0],{layout:f,indices:b,interleavedVertexData:y,positionData:v,hasColors:I}=a,S=this._materialParameters(p,f),E=c||new Uint32Array([0,b?b.length:y.byteLength/f[0].stride]),F={vertices:{data:y,count:y.byteLength/f[0].stride,layoutParameters:S.geometryParams},positionData:{positions:v.data,indices:v.indices},indices:b,componentOffsets:E},R=p.transformation?j(p.transformation):w();C(R,n,R);const N=O(D(),R),P=M(x(),R),A=this.view.renderSpatialReference,H=this.view.basemapTerrain.spatialReference,U=D(),G=[1,1,1];T(N,A,G,H)||Ge.errorOnce("Unsupported coordinate system for IM overlay"),V(N,A,U,H);const L=g.createObject({toMapSpace:[U[0],U[1],G[0],G[1]],geometry:F,obb:u(e.geometryObb),transform:{position:N,rotationScale:P}}),B=2===S.geometryParams.textureCoordinates,k=this._initMaterialAndTextures(L,S.material,l,B);e.memory+=this.memEstimateGeometryAdded(L),e.memory+=k.reduce(((e,t)=>e+(d(t)?this.memEstimateTextureAdded(t):0)),0);const q=!!S.material.hasParametersFromSource,z="blend"!==S.material.alphaMode&&S.material.metallicRoughness.baseColorFactor[3]>=1,W=new Be(e,m,L,this._getInvalidRendererVersion(),s.attributeInfo,{hasParametersFromSource:q,isOpaque:z},k);s.meta=W,!this._hasTextures&&t.requiredTextures.some((({usage:e})=>0!=(19&e)))&&(this._hasTextures=!0),this._hasData=!0,this._hasColors=this._hasColors||I,this._hasTextures=this._hasTextures||!!e.resources.texture,this.notifyChange("hasTexturesOrVertexColors");const $=this.slicePlaneEnabled;return this._addOrUpdateEdgeRendering(W).then((t=>(d(t)&&t.updateObjectVisibility(W.objectHandle,!1),this._safeReschedule((()=>{const i=this._addTasks.get(e.index);if(!i)return;if(d(this._labeler)&&this._addMetaToLabeler(this._labeler,W),this._addNodeMeta(e.index,W),i.meta=null,this.suspended)return void this._removeNodeStageData(e.index,this.elevationOffset);g.setObjectVisibility(L,1),d(t)&&t.updateObjectVisibility(W.objectHandle,!0),W.attributeInfo=i.attributeInfo;const s=W.cachedRendererVersion!==this._rendererVersion,r=$!==this.slicePlaneEnabled;this._setObjectSymbolColors(W);const o=this._applyFiltersToNode(W);(s||d(t)&&(r||o))&&this._addOrUpdateEdgeRendering(W),this._visibleGeometryChanged(W),this._highlights.objectCreated(W),this._updateMaterial(W),this._setNewNodeOpacity(W),d(this._treeDebugger)&&this._treeDebugger.update()}),i)))).catch((e=>{throw d(s.meta)&&(this._cacheGPUData(s.meta),s.meta=null),e}))}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){Ge.error("Removing duplicated node");const t=this._nodeId2Meta.get(e);d(t)&&this._deleteComponentObject(t)}d(t)&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&ot(t.cachedEdgeMaterials,0)),this._nodeId2Meta.set(e,t)}_safeReschedule(e,t){return m(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const i=e.params.material,s=t.some((e=>"uvRegion"===e.name)),r=t.some((e=>"normalCompressed"===e.name)),o=Ye(i);return{geometryParams:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s){const r=this._stage.renderView,o=i.map((e=>_e(e,t,s,r)));for(const a of o)d(a)&&this._stage.add(a);return this._collection.updateMaterial(e,(e=>{me(e,t,o,i,this.view._stage.renderView.textureRepository,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR(),isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference}),this._updateMaterialOverlay(e)})),o}_getGeometryParameters(e){return{textureCoordinates:e.hasTexture?e.hasRegions?2:1:0,colors:this._hasVertexColors,normals:e.hasNormals&&!this._isIntegratedMesh}}_addData(e,t,i){let s=this._addTasks.get(e.index);return s?s.attributeInfo=t:(s={...g(),attributeInfo:t,meta:null},this._addTasks.set(e.index,s),i().then(s.resolve,s.reject).then((()=>this._addTasks.delete(e.index))).catch((t=>{throw this._addTasks.delete(e.index),t}))),s.promise}_clearAddTasks(){this._addTasks.forEach((e=>{d(e.meta)&&(this._cacheGPUData(e.meta),e.meta=null)})),this._addTasks.clear()}_clippingAreaChanged(){const e=A();Ne(this.view.clippingArea,e,this.view.renderSpatialReference)?this._clippingArea=e:this._clippingArea=null,this._filterChange(),this._controller&&this._controller.updateClippingArea(this.view.clippingArea)}_geometryFilterChange(){this._controller.geometryFilterChanged(this.hasGeometryFilter)}get hasGeometryFilter(){return!1}_filterChange(){this._applyFilters(!1)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach((e=>{d(e)&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e))}))}getFilters(){const e=[];return this._clippingArea&&e.push(((e,t)=>this._boundingboxFilter(e,t,this._clippingArea))),e}addSqlFilter(e,t,i){if(d(t)){const s=t.fieldNames;e.push(((e,r)=>this._sqlFilter(e,r,t,s,i)))}}_sqlFilter(e,t,i,s,r){const o={},a=this._createLayerGraphic(o),n=this.i3slayer.objectIdField,l=t.featureIds,h=d(t.attributeInfo)&&t.attributeInfo.attributeData;s.every((e=>null!=h[e]||e===n))&&xe(e,l,(e=>{o[n]=l[e];for(const i of s)i!==n&&(o[i]=Ce(h[i],e));try{return i.testFeature(a)}catch(t){return r(t),!1}}))}_boundingboxNodeTest(e,t){return P(e.node.mbs,this._controller.crsIndex,Xe,this.view.renderSpatialReference),Oe(t,Xe)}_boundingboxFeatureTest(e,t,i){return G(i,this._collection.getComponentAabb(e.objectHandle,t,We))}_boundingboxFilter(e,t,i){const s=this._collection,r=this._boundingboxNodeTest(t,i);if(3===r)return;if(0===r)return void(e.length=0);const o=s.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const a=this._transformAABB($e,i,t.objectHandle);xe(e,t.featureIds,(e=>this._boundingboxFeatureTest(t,e,a)))}_transformAABB(e,t,i){const s=this._collection.getObjectTransform(i),r=s.position,o=s.rotationScale;return e[0]=(t[0]-r[0])/o[0],e[1]=(t[1]-r[1])/o[4],e[2]=(t[2]-r[2])/o[8],e[3]=(t[3]-r[0])/o[0],e[4]=(t[4]-r[1])/o[4],e[5]=(t[5]-r[2])/o[8],e}_addOrUpdateEdgeRendering(e,t=!0){if(h(this._edgeView))return Promise.resolve(null);const i=e.objectHandle,s=this._edgeView.hasObject(i),{hasEdges:r,perFeatureEdgeMaterials:o}=this._getFilteredEdgeMaterials(e),a={slicePlaneEnabled:this.slicePlaneEnabled};if(r){if(s){if(this.nodeCrossfadingEnabled){ot(o,this.getNodeOpacity(e))}return this._edgeView.updateAllComponentMaterials(i,o,a,t),this._edgeView.updateObjectVisibility(i,!0),Promise.resolve(this._edgeView)}return this._collection.addEdges(i,this._edgeView,o,a).then((()=>this._edgeView))}return s&&this._edgeView.removeObject(i),Promise.resolve(null)}_removeEdgeRendering(e){d(this._edgeView)&&this._edgeView.hasObject(e.objectHandle)&&this._edgeView.removeObject(e.objectHandle)}_applyFiltersToNode(e){return!!this._applyFiltersToNodeComponents(e)&&(d(this._labeler)&&this._labeler.applyFilterChange(e),!0)}_applyFiltersToNodeComponents(e){const t=this._collection,i=0===t.getComponentCount(e.objectHandle).invisible;if(t.setAllComponentVisibilities(e.objectHandle,"all"),0===this._filters.length)return e.filteredIds=null,!i;if(this._updateCachedFilteredIds(e),e.filteredIds===e.featureIds)return!i;const s=this._computeFilteredComponentIndices(e);return t.setAllComponentVisibilities(e.objectHandle,s),!0}_updateCachedFilteredIds(e){null!=e.filteredIds&&e.appliedFilters===this._filters||(e.filteredIds=this._computeFilteredIds(e),e.appliedFilters=this._filters)}_computeFilteredIds(e){const t=e.featureIds.slice();for(const i of this._filters)if(i(t,e),0===t.length)break;return t.length===e.featureIds.length?e.featureIds:t}_computeFilteredComponentIndices(e){const t=new Array;return e.featureIds.forEach(((i,s)=>{e.filteredIds[t.length]===i&&t.push(s)})),t}_removeAllNodeDataFromStage(e=this.elevationOffset){this._nodeId2Meta.forEach(((t,i)=>this._removeNodeStageData(i,e))),this._nodeId2MetaReloading.forEach(((t,i)=>this._removeNodeStageData(i,e,this._nodeId2MetaReloading)))}removeNode(e){const t=this.elevationOffset;this._removeNodeStageData(e,t),this._removeNodeStageData(e,t,this._nodeId2MetaReloading)}_removeNodeStageData(e,t,i=this._nodeId2Meta){const s=i.get(e);h(s)?i.delete(e):(this._collection.setObjectVisibility(s.objectHandle,0),this._visibleGeometryChanged(s),this._removeEdgeRendering(s),d(this._labeler)&&this._labeler.removeNodeMeta(s),i.delete(e),this._highlights.objectDeleted(s),i===this._nodeId2Meta?(this._cacheGPUData(s,t),this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopNodeFading(s)):this._deleteComponentObject(s),d(this._treeDebugger)&&this._treeDebugger.update())}_deleteComponentObject(e){if(d(this._edgeView)&&this._edgeView.removeObject(e.objectHandle),this.memEstimateGeometryRemoved(e.objectHandle),this._collection.destroyObject(e.objectHandle),e.textures)for(const t of e.textures)this.memEstimateTextureRemoved(t),this._stage.remove(t)}updateNodeState(e,t){const i=this._nodeId2Meta.get(e);d(i)&&this._collection.updateMaterial(i.objectHandle,(e=>e.polygonOffsetEnabled=0===t))}_invalidateAllSymbols(){this._rendererVersion=je(this._rendererVersion,1),this._controller&&this._controller.requestUpdate()}_getInvalidRendererVersion(){return je(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=je(this._rendererVersion,1),this._rendererFields=null,this._colorVariable=null,this._opacityVariable=null,this._invalidateAllSymbols(),e&&(this._rendererFields=await e.getRequiredFields(this.i3slayer.fieldsIndex)),this._updateSymbologyFields(),!this._arcade&&e&&"arcadeRequired"in e&&e.arcadeRequired&&(this._arcade=await $()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:Ge.warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.getSymbols())"mesh-3d"!==t.type&&Ge.error(`Symbols of type '${t.type}' are not supported for 3D Object Scene Services.`);this._controller&&this._controller.requestUpdate()}_getCachedEdgeMaterials(e){return this._hasSymbolColors&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e),e.cachedEdgeMaterials}_getSymbolColors(e){this._hasSymbolColors&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e);const t=e.cachedSymbology;return(e,i)=>{const s=5*e;F(i.externalColor,t[s+0]/255,t[s+1]/255,t[s+2]/255,t[s+3]/255),i.externalColorMixMode=15&t[s+4],i.castShadows=0!=(16&t[s+4]),i.pickable=0!=(32&t[s+4])}}_getSymbolInfo(e,t){const i=e&&e.getSymbol(t,{arcade:this._arcade});if(!(i instanceof K))return null;const s=i.id;if(this._symbolInfos.has(s))return this._symbolInfos.get(s);const r=we(i);return this._symbolInfos.set(s,r),r}_setSymbologyOverride(e,t){this._symbologyOverride!==e&&(this._symbologyOverride=e,this._symbologyOverrideFields=t,this._invalidateAllSymbols(),this._updateSymbologyFields())}_updateSymbologyFields(){this._symbologyFields=d(this._symbologyOverrideFields)&&this._symbologyOverrideFields.length>0?d(this._rendererFields)&&this._rendererFields.length>0?B(this.i3slayer.fieldsIndex,[...this._rendererFields,...this._symbologyOverrideFields]):this._symbologyOverrideFields:this._rendererFields}_updateCachedRendererData(e){if(e.cachedRendererVersion=this._rendererVersion,!this._hasSymbolColors)return;const t=this._tmpAttributeOnlyGraphic,i={};t.attributes=i;const s=this._currentRenderer,r=d(e.attributeInfo)&&e.attributeInfo.attributeData,o=null!=e.featureIds?this.i3slayer.objectIdField:null,a=null!=r&&d(this._symbologyFields)&&this._symbologyFields.length>0,n=a?[]:null,l=a?[]:null;if(a&&d(this._symbologyFields))for(const d of this._symbologyFields){const e=r[d];e&&(n.push(d),l.push(e))}e.cachedSymbology||(e.cachedSymbology=new Uint8Array(5*e.featureIds.length));const c={color:Je,castShadows:!0,pickable:!0,colorMixMode:1,edgeMaterial:null},u=this.fullOpacity,_=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):u;let m=null,g=2,p=Se,f=0;for(let b=0;b<e.featureIds.length;b++){if(null!=o&&(i[o]=e.featureIds[b]),a)for(let e=0;e<n.length;e++)i[n[e]]=Ce(l[e],b);const r=this._getSymbolInfo(s,t);let u=null,y=null;if(s&&"visualVariables"in s){if(this._colorVariable){const e=z(this._colorVariable,t,{color:Qe,arcade:this._arcade});e&&(u=Je,u[0]=e.r/255,u[1]=e.g/255,u[2]=e.b/255,this._opacityVariable||null===e.a||(y=e.a))}this._opacityVariable&&(y=W(this._opacityVariable,t,{arcade:this._arcade}))}if(r&&r.material){const e=r.material;u=h(u)||h(y)?se(u,y,e.color,e.alpha,Le,Je):se(u,y,null,null,Le,Je)}if(h(u)&&(u=Je,u[0]=1,u[1]=1,u[2]=1,u[3]=1),c.pickable=!0,c.castShadows=!r||r.castShadows,c.colorMixMode=r&&r.material?r.material.colorMixMode:1,c.edgeMaterial=r?r.edgeMaterial:null,d(this._symbologyOverride)&&(c.color=u,this._symbologyOverride(t,c),u=c.color),d(c.edgeMaterial)){const t=u[3]<=0?0:u[3]>=1&&(e.material.isOpaque||3===c.colorMixMode)?2:1;c.edgeMaterial===m&&t===g||(p={...c.edgeMaterial,opacity:_,objectTransparency:t},m=c.edgeMaterial,g=t),e.cachedEdgeMaterials[b]=p}else e.cachedEdgeMaterials[b]=Se;e.cachedSymbology[f+0]=Math.round(255*u[0]),e.cachedSymbology[f+1]=Math.round(255*u[1]),e.cachedSymbology[f+2]=Math.round(255*u[2]),e.cachedSymbology[f+3]=Math.round(255*u[3]),e.cachedSymbology[f+4]=c.colorMixMode|+c.castShadows<<4|+c.pickable<<5,f+=5}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);if(this.nodeCrossfadingEnabled||ot(t,this.fullOpacity),h(e.filteredIds)){return{hasEdges:t.some((e=>e!==Se)),perFeatureEdgeMaterials:t}}let i=0,s=!1;const r=t.map(((t,r)=>e.featureIds[r]!==e.filteredIds[i]?Se:(s=s||t!==Se,i++,t)));return{hasEdges:s,perFeatureEdgeMaterials:r}}_setObjectSymbolColors(e){if(!this._hasSymbolColors)return;const t=e.objectHandle,i=this._getSymbolColors(e);this._collection.setComponentData(t,i),this._stage.renderView.setNeedsRender()}_reloadAll(e=this.elevationOffset){this._removeAllNodeDataFromStage(e),null!=this._controller&&this._controller.restartNodeLoading()}_opacityChange(e){this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopAllNodeFading(),this._nodeId2Meta.forEach((t=>{h(t)||(this._collection.updateMaterial(t.objectHandle,(t=>t.objectOpacity=e)),ot(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))}))}_updateMaterial(e){this._collection.updateMaterial(e.objectHandle,(e=>{e.commonMaterialParameters.slicePlaneEnabled=this.slicePlaneEnabled,e.usePBR=this._usePBR(),this._updateMaterialOverlay(e)}))}_updateMaterialOverlay(e){}_updateEngineObject(e){this._setObjectSymbolColors(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlane=e),d(this._labeler)&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach((t=>{h(t)||(this._collection.updateMaterial(t.objectHandle,(t=>{t.commonMaterialParameters.slicePlaneEnabled=e})),this._updateEdgeRendering(t,!1))}))}_updatePBR(){this._nodeId2Meta.forEach((e=>{h(e)||this._collection.updateMaterial(e.objectHandle,(e=>{e.usePBR=this._usePBR()}))})),this._hasLoadedPBRTextures=!0}_usePBR(){return!this._isIntegratedMesh&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){d(this._edgeView)&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_forAllFeatures(e,t,i=0){a(this._nodeId2Meta,(s=>{if(h(s))return!1;if(d(t)){switch(t(s)){case 0:return!0;case 2:return!1}}let r=1;switch(i){case 1:r=this._forAllFeaturesOfNode(s,e);break;case 0:r=this._forVisibleFeaturesOfNode(s,e);break;case 2:r=this._forAllFeaturesOfNodeInClippingArea(s,e)}return 0===r}))}_forAllFeaturesOfNode(e,t){let i=1;const s=e.featureIds;for(let r=0;r<s.length;r++)if(i=t(s[r],r,e),0===i)return i;return i}_forVisibleFeaturesOfNode(e,t){let i=1;const s=e.featureIds;return this._collection.forEachVisibleComponent(e.objectHandle,(r=>(i=t(s[r],r,e),1===i))),i}_forAllFeaturesOfNodeInClippingArea(e,t){if(null==this._clippingArea)return this._forAllFeaturesOfNode(e,t);const i=this._boundingboxNodeTest(e,this._clippingArea);if(0===i)return 1;if(3===i)return this._forAllFeaturesOfNode(e,t);const s=1,r=e.featureIds,o=e.objectHandle,a=Ee(this._clippingArea,this._collection.getObjectTransform(o));for(let n=0;n<r.length;n++){if(!this._boundingboxFeatureTest(e,n,a))continue;const i=t(r[n],n,e);if(0===i)return i}return s}_createAttributes(e,t){const i={};null!=t.featureIds&&(i[this._getObjectIdField()]=t.featureIds[e]);const s=d(t.attributeInfo)&&t.attributeInfo.attributeData;if(d(s))for(const r of Object.keys(s))i[r]=Ce(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e){const t=this._highlights;if("number"==typeof e||e instanceof i?e=[e]:e instanceof s&&(e=e.toArray()),Array.isArray(e)&&e.length>0){if(e[0]instanceof i){const i=e,s=this.i3slayer.fieldsIndex,r=this._getObjectIdField(),o=i.map((e=>Fe(s,e.attributes,r))),{set:a,handle:n}=t.acquireSet();return t.setFeatureIds(a,o),n}if("number"==typeof e[0]){const i=e,{set:s,handle:r}=t.acquireSet();return t.setFeatureIds(s,i),r}}return rt}_visibleGeometryChanged(e){this._elevationProvider&&(this._elevationProvider.objectChanged(e.node),null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=p((()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null}))))}get performanceInfo(){const e={displayedNumberOfFeatures:0,maximumNumberOfFeatures:0,totalNumberOfFeatures:0,core:null,index:0,nodes:this._nodeId2Meta.size,"Total GPU Memory Estimate":(this.gpuMemoryEstimate/1048576).toFixed(1)+"MB","Geometry Memory Estimate":(this.geoMemoryEstimate/1048576).toFixed(1)+"MB","Texture Memory Estimate":(this.texMemoryEstimate/1048576).toFixed(1)+"MB","Unloaded Memory Estimate":(this.getUnloadedMemory()/1048576).toFixed(1)+"MB"};return d(this._memCache)&&(e.MemCache=Math.round(100*this._memCache.hitRate)+"% hit"),this._controller&&(this._idbCacheEnabled&&(e.IDBCache=Math.round(100*this._idbCache.getHitRate())+"% hit"),this._controller.updateStats(e)),e}get test(){const e=this;return{controller:this._controller,labeler:this._labeler,get visibleObjectIds(){const t=[];return e._forAllFeatures((e=>(t.push(e),1)),null,0),t.sort(((e,t)=>e-t)),t},get numNodes(){return e._nodeId2Meta.size}}}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return d(e)?this._collection.getMaterial(e.objectHandle).objectOpacity:0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}markNodeToRemove(e){this._controller&&this._controller.markNodeToRemove(e)}removeMarkedNodes(){this._controller&&this._controller.removeMarkedNodes()}foreachCrossfadeNode(e){this._nodeId2Meta.forEach(((t,i)=>e(i,t)))}fadeNode(e,t,i){if(!this.nodeCrossfadingEnabled)return;const s=this._nodeId2Meta.get(e);d(s)&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);d(i)&&this._setNodeOpacity(i,t)}_setNodeOpacity(e,t){this._collection.updateMaterial(e.objectHandle,(e=>e.objectOpacity=t)),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(!d(this._edgeView)||!e.cachedEdgeMaterials)return;ot(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t)}get _hasModifications(){return this._modifications&&this._modifications.length>0}updateNodeModificationStatus(e){const t=e.length;if(!this._hasModifications||t<=0||!0!==this._i3sWasmLoaded)return;const i=this.i3slayer.uid,s=st(e);if(d(s)){const t={context:i,buffer:s.buffer};te(t);const r=new Float64Array(s.buffer);e.forAll(((e,t)=>{const i=r[t],s=ie(i);e.imModificationImpact=s,0!==s&&this._controller.invalidateGeometryVisibility(e.index)}))}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||d(this._labeler)&&this._labeler.updating||this._crossfadeHelper.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0}};return e([v()],o.prototype,"_hasLoadedPBRTextures",void 0),e([v()],o.prototype,"_asyncModuleLoading",void 0),e([v()],o.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([v()],o.prototype,"view",void 0),e([v()],o.prototype,"i3slayer",void 0),e([v()],o.prototype,"_controller",void 0),e([v()],o.prototype,"_labeler",void 0),e([v()],o.prototype,"updating",void 0),e([v()],o.prototype,"suspended",void 0),e([v()],o.prototype,"holeFilling",void 0),e([v(Pe)],o.prototype,"updatingProgress",void 0),e([v({readOnly:!0,aliasOf:"_controller.updatingProgress"})],o.prototype,"updatingProgressValue",void 0),e([v({readOnly:!0})],o.prototype,"hasTexturesOrVertexColors",null),e([v({readOnly:!0})],o.prototype,"rendererTextureUsage",null),e([v({readOnly:!0})],o.prototype,"elevationOffset",null),e([v({type:Boolean})],o.prototype,"slicePlaneEnabled",void 0),e([v()],o.prototype,"supportedTextureEncodings",null),e([v()],o.prototype,"uncompressedTextureDownsamplingEnabled",null),e([v({type:[q]})],o.prototype,"_modifications",void 0),o=e([I("esri.views.3d.layers.I3SMeshView3D")],o),o},We=A(),$e=A(),Ke=Te(),Je=[0,0,0,0],Qe=new t([0,0,0,0]),Xe=[0,0,0,0];function Ye(e){const t=e.metallicRoughness;return t&&t.baseColorTextureId>=0||t&&t.metallicRoughnessTextureId>=0||e.normalTextureId>=0||e.emissiveTextureId>=0||e.occlusionTextureId>=0}function Ze(e){return"geometryData"in e}function et(e){return d(e)&&f(e.data)}function tt(e,t){let i=1024+e.interleavedVertexData.byteLength+(e.indices?e.indices.byteLength:0)+e.positionData.data.byteLength+e.positionData.indices.byteLength;if(d(t))for(const s of t)d(s)&&f(s.data)&&(i+=s.data.byteLength);return i}function it(e,t){return t.byteSize>qe?(Ge.warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}function st(e){if(0===e.length)return null;const t=10*e.length,i=new Float64Array(t);return e.forAll(((e,t)=>{let s=e.serviceObb;h(s)&&(s=Ke,E(s.center,e.mbs),s.halfSize[0]=s.halfSize[1]=s.halfSize[2]=e.mbs[3]);const r=10*t;i[r+0]=s.center[0],i[r+1]=s.center[1],i[r+2]=s.center[2],i[r+3]=s.halfSize[0],i[r+4]=s.halfSize[1],i[r+5]=s.halfSize[2],i[r+6]=s.quaternion[0],i[r+7]=s.quaternion[1],i[r+8]=s.quaternion[2],i[r+9]=s.quaternion[3]})),i}const rt={remove(){},pause(){},resume(){}};function ot(e,t){e.forEach((e=>e.opacity=t))}export{ze as I3SMeshView3D};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../Graphic.js";import s from"../../../core/Collection.js";import r from"../../../core/has.js";import o from"../../../core/Logger.js";import{someMap as a}from"../../../core/MapUtils.js";import{unwrapOr as n,destroyMaybe as l,isSome as d,isNone as h,applySome as c,unwrap as u}from"../../../core/maybe.js";import _ from"../../../core/PooledArray.js";import{throwIfAborted as m,createResolver as g}from"../../../core/promiseUtils.js";import{schedule as p}from"../../../core/scheduling.js";import{isArrayBuffer as f}from"../../../core/typedArrayUtil.js";import{getMetersPerVerticalUnitForSR as b}from"../../../core/unitUtils.js";import{init as y}from"../../../core/watchUtils.js";import{property as v}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as I}from"../../../core/accessorSupport/decorators/subclass.js";import{f as M}from"../../../chunks/mat3.js";import{c as x}from"../../../chunks/mat3f32.js";import{m as C,z as O}from"../../../chunks/mat4.js";import{b as j,c as w}from"../../../chunks/mat4f64.js";import{m as S,g as E}from"../../../chunks/vec3.js";import{c as D}from"../../../chunks/vec3f64.js";import{s as F}from"../../../chunks/vec4.js";import{projectBuffer as R,getProjectorName as N,localLinearScaleFactors as T,projectVectorToVector as V,projectBoundingSphere as P}from"../../../geometry/projection.js";import{create as A,empty as H,expandWithBuffer as U,intersects as G}from"../../../geometry/support/aaBoundingBox.js";import L from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as B}from"../../../layers/support/fieldUtils.js";import{areLabelsVisible as k}from"../../../layers/support/layerUtils.js";import q from"../../../layers/support/SceneModification.js";import{getColor as z,getOpacity as W}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{loadArcade as $}from"../../../support/arcadeOnDemand.js";import K from"../../../symbols/Symbol3D.js";import{getMetersPerUnit as J}from"../../../symbols/support/unitConversionUtils.js";import Q from"./I3SMeshViewLabeler.js";import{I3SMeshWorkerHandle as X,toWasmModification as Y}from"./I3SMeshWorkerHandle.js";import{initialize as Z,setModificationsSync as ee,filterObbsForModificationsSync as te,interpretObbModificationResults as ie}from"./SceneLayerWorker.js";import{overrideColor as se}from"./graphics/graphicUtils.js";import re from"./i3s/Highlights.js";import{I3SAttributeOverrides as oe}from"./i3s/I3SAttributeOverrides.js";import{I3SCrossfadeHelper as ae,NodeCrossfadeMetaData as ne}from"./i3s/I3SCrossfadeHelper.js";import le from"./i3s/I3SElevationProvider.js";import{boundingBoxCornerPoints as de}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as he}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as ce,selectEncoding as ue,createTexture as _e,configureMaterial as me}from"./i3s/I3SMaterialUtil.js";import{computeGlobalTransformation as ge,getLocalOrigin as pe}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as fe,checkSceneLayerValid as be,checkSceneLayerCompatibleWithView as ye,getCacheKeySuffix as ve,whenGraphicAttributes as Ie,computeVisibilityObb as Me,filterInPlace as xe,getCachedAttributeValue as Ce,intersectBoundingBoxWithMbs as Oe,addWraparound as je,getSymbolInfo as we,transparentEdgeMaterial as Se,getClipAABB as Ee}from"./i3s/I3SUtil.js";import{IDBCache as De}from"./i3s/IDBCache.js";import{attributeLookup as Fe}from"./support/attributeUtils.js";import Re from"../support/debugFlags.js";import{projectToBoundingBox as Ne}from"../support/extentUtils.js";import{create as Te,clone as Ve}from"../support/orientedBoundingBox.js";import{updatingProgress as Pe}from"../support/updatingProperties.js";import{glLayout as Ae}from"../support/buffer/glUtil.js";import{createVertexBufferLayout as He}from"../webgl-engine/collections/Component/SourceGeometry.js";import{loadBasis as Ue}from"../webgl-engine/lib/BasisUtil.js";const Ge=o.getLogger("esri.views.3d.layers.SceneLayerView3D"),Le=[1,1,1,1];class Be extends ne{constructor(e,t,i,s,r,o,a){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=o,this.textures=a,this.cachedEdgeMaterials=new Array,this.cachedSymbology=null}}const ke=19,qe=104857600,ze=t=>{let o=class extends t{constructor(...e){super(e),this._elevationProvider=null,this._intersectionHandler=null,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._hasLoadedPBRTextures=!1,this._asyncModuleLoading=0,this._addTasks=new Map,this._rendererVersion=0,this._colorVariable=null,this._opacityVariable=null,this._rendererFields=null,this._symbologyFields=null,this._symbologyOverride=null,this._symbologyOverrideFields=null,this._symbolInfos=new Map,this._idbCache=new De("esri-scenelayer-cache","geometries"),this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.slicePlaneEnabled=!1,this._modifications=new Array,this._layerUrl="",this._cacheKeySuffix=null,this._arcade=null,this._tmpAttributeOnlyGraphic=new i(null,null,{}),this._crossfadeHelper=new ae(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerUid(){return this.i3slayer&&this.i3slayer.uid}get sublayerUid(){return null}get hasTexturesOrVertexColors(){return this._hasData?this._hasTextures||this._hasColors?"yes":"probably-not":"unknown"}get rendererTextureUsage(){return fe(this._currentRenderer)?this._usePBR()||this._hasLoadedPBRTextures?63:37:this._usePBR()||this._hasLoadedPBRTextures?44:36}get elevationOffset(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null!=e&&"absolute-height"===e.mode){const t=b(this.i3slayer.spatialReference),i=J(e.unit);return n(e.offset,0)*i/t}return 0}get supportedTextureEncodings(){return ce(this.view._stage.renderView.capabilities)}get uncompressedTextureDownsamplingEnabled(){var e;const t=null==(e=this.view)?void 0:e.qualitySettings.sceneService.uncompressedTextureDownsamplingEnabled,i=0==(4&this.supportedTextureEncodings);return t&&i}initialize(){this.preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const e=this.view.resourceController;if(this.attributeOverrides=new oe(this.i3slayer,e.memoryController),this._worker=new X((t=>e.schedule(t))),this.addResolvingPromise(this._worker.promise),this._worker.setLegacySchema(this.layerUid,this.i3slayer.store.defaultGeometrySchema),be(this.i3slayer),ye(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new L({layerView:this}),this.gpuMemoryEstimate=0,this.texMemoryEstimate=0,this.geoMemoryEstimate=0,this._stage=this.view._stage,this._collection=this._stage.renderView.componentObjectCollection,this._highlights=new re({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,1),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)}),this._isIntegratedMesh||!this.i3slayer.store.defaultGeometrySchema)this._hasSymbolColors=!1;else{const e=this.i3slayer.store.defaultGeometrySchema.featureAttributes;this._hasSymbolColors=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=this.i3slayer.store.defaultGeometrySchema.vertexAttributes.color&&(null==this.i3slayer.cachedDrawingInfo||!this.i3slayer.cachedDrawingInfo.color),this._isIntegratedMesh||(this._edgeView=this._stage.renderView.ensureEdgeView());const t=this.view.resourceController.memoryController.newCache(this.i3slayer.uid,(e=>this._deleteComponentObject(e)));this._memCache=t;const i=e=>d(this._controller.index)&&d(this._controller.index.rootNode)?this._controller.index.traverse(this._controller.index.rootNode,(t=>{const i=t.index,s=this._nodeId2Meta.get(i)||this._nodeId2MetaReloading.get(i);return e(t,d(s)?s.objectHandle:null)})):()=>{};this._intersectionHandler=new he({layerUid:this.layerUid,sublayerUid:this.sublayerUid,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:i}),this._elevationProvider=new le({layerView:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR(),this.updatingHandles.add(this,"view.clippingArea",(()=>this._clippingAreaChanged()),2),this.updatingHandles.add(this,"fullOpacity",(e=>this._opacityChange(e))),this.updatingHandles.add(this,"slicePlaneEnabled",(e=>this._slicePlaneEnabledChange(e))),this.updatingHandles.add(this,"elevationOffset",((e,t)=>{this._reloadAll(t),this._controller.invalidateVisibilityObbs()})),this.updatingHandles.add(this,"filter",(()=>this._filterChange()),2),this.updatingHandles.add(this,"view.qualitySettings.physicallyBasedRenderingEnabled",(()=>this._updatePBR()));const s=()=>{this._reloadAll(),this.clearMemCache()};this.updatingHandles.add(this,"rendererTextureUsage",s),this.updatingHandles.add(this,"uncompressedTextureDownsamplingEnabled",s),this.updatingHandles.add(this,"suspended",(e=>this._suspendedChange(e)),2),this.updatingHandles.add(this.i3slayer,"labelsVisible",(()=>this._labelingChanged()),2),this.updatingHandles.add(this.i3slayer,"labelingInfo",(()=>this._labelingChanged()),2),this.updatingHandles.add(this,"_modifications",(()=>this._modificationsChanged()),2),this.handles.add([y(Re,"I3S_TREE_SHOW_TILES",(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&Re.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||Re.I3S_TREE_SHOW_TILES||(this._treeDebugger=l(this._treeDebugger))})),y(Re,"I3S_SHOW_MODIFICATIONS",(()=>this._showModifications()))]),this._cacheKeySuffix=ve(this.i3slayer.spatialReference,this.view.renderSpatialReference),this._idbCache.init().catch((e=>Ge.warn(`Failed to initialize IndexedDB cache: ${e}`)))}destroy(){this._clearAddTasks(),this.attributeOverrides=l(this.attributeOverrides),this._elevationProvider&&(this._elevationProvider.layerChanged(),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._worker;e&&(e.destroyContext(this.i3slayer.uid).then((()=>e.destroy())),this._worker=null),this._removeAllNodeDataFromStage(),this._memCache=l(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=l(this._labeler),this._treeDebugger=l(this._treeDebugger),this._controller=l(this._controller),this._highlights.destroy(),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}memEstimateTextureAdded(e){const t=e.estimatedTexMemRequired;return this.gpuMemoryEstimate+=t,this.texMemoryEstimate+=t,t}memEstimateTextureRemoved(e){if(d(e)){const t=e.estimatedTexMemRequired;this.gpuMemoryEstimate-=t,this.texMemoryEstimate-=t}}memEstimateGeometryAdded(e){const t=this._collection.getObjectGPUMemoryUsage(e);return this.gpuMemoryEstimate+=t,this.geoMemoryEstimate+=t,t}memEstimateGeometryRemoved(e){const t=this._collection.getObjectGPUMemoryUsage(e);this.gpuMemoryEstimate-=t,this.geoMemoryEstimate-=t}isNodeLoaded(e){return this._nodeId2Meta.has(e)}isNodeReloading(e){return this._nodeId2MetaReloading.has(e)}getUsedMemory(){let e=d(this._labeler)?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach((t=>e+=d(t)?t.node.memory:0)),this._nodeId2MetaReloading.forEach((t=>e+=d(t)?t.node.memory:0)),e}getUnloadedMemory(){return(d(this._controller)?this._controller.unloadedMemoryEstimate:0)+(d(this._labeler)?this._labeler.unloadedMemoryEstimate:0)}ignoresMemoryFactor(){return!1}_labelingChanged(){if(!(k(this.i3slayer)&&this._supportsLabeling))return void(d(this._labeler)&&(this._labeler.destroy(),this._labeler=null));if(d(this._labeler))return;const e=new Q({view:this.view,layer:this.i3slayer,collection:this._collection});this._nodeId2Meta.forEach((t=>d(t)&&this._addMetaToLabeler(e,t))),this._labeler=e}_loadAsyncModule(e){return++this._asyncModuleLoading,e.then((e=>(--this._asyncModuleLoading,e)),(e=>{throw--this._asyncModuleLoading,e}))}_modificationsChanged(){if(!this._i3sWasmLoaded&&this._hasModifications)return this._i3sWasmLoaded=Z().then((()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()})),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=this.i3slayer.uid,t=this.i3slayer.spatialReference;this._worker.setModifications(e,this._modifications,t);const i=Y(this._modifications,t);ee({context:e,modifications:i,isGeodetic:t.isGeographic}),this._controller.modificationsChanged();const s=this._hasModifications?new _:null;this._nodeId2Meta.forEach(((e,t)=>{h(e)?this._nodeId2Meta.delete(t):e.node.hasModifications?(this._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):d(s)&&s.push(e.node)})),d(s)&&this._nodeId2MetaReloading.forEach((e=>s.push(e.node))),d(s)&&s.length>0&&(this.updateNodeModificationStatus(s),s.forAll((e=>{if(2!==e.imModificationImpact){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),this._nodeId2Meta.delete(e.index),d(t)&&this._nodeId2MetaReloading.set(e.index,t)}}))),this.clearMemCache(),this._controller.restartNodeLoading(),this._showModifications()}_showModifications(){if(d(this._modificationGraphics)&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!Re.I3S_SHOW_MODIFICATIONS||0===this._modifications.length)return;const e={clip:[227,227,79,.8],mask:[227,139,79,.8],replace:[139,227,79,.8]},t={type:"simple-fill",outline:{color:[255,255,255],width:1}};this._modificationGraphics=new Array;for(const s of this._modifications){s.geometry.spatialReference=this.i3slayer.spatialReference;const r={...t,color:e[s.type]};this._modificationGraphics.push(new i({geometry:s.geometry,symbol:r}))}this.view.graphics.addMany(this._modificationGraphics)}_addMetaToLabeler(e,t){e.addNodeMeta(t,((e,t)=>this._createAttributes(e,t)))}_suspendedChange(e){e?(this._removeAllNodeDataFromStage(),this.view.elevationProvider&&this.view.elevationProvider.unregister(this._elevationProvider),this._stage.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler)):(this.view.elevationProvider.register(this._elevationContext,this._elevationProvider),this._stage.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler))}getLoadedAttributes(e){const t=this._nodeId2Meta.get(e);if(d(t)&&d(t.attributeInfo))return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if(d(t)&&d(t.attributeInfo))return t.attributeInfo.attributeData}setAttributeData(e,t){const i=this._nodeId2Meta.get(e);d(i)&&d(i.attributeInfo)&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const s=this._nodeId2Meta.get(e);d(s)&&(await this.attributeOverrides.apply(s.featureIds,t,i),s.attributeInfo=t,this._attributeValuesChanged(s))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.filteredIds=null,d(this._labeler)&&this._labeler.setNodeMetaAttributes(e,((e,t)=>this._createAttributes(e,t))),this._updateEngineObject(e)}clearMemCache(){d(this._memCache)&&this._memCache.clear()}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach((t=>d(t)&&e.push(t.node))),e}getLoadedNodeIndices(e){this._nodeId2Meta.forEach(((t,i)=>e.push(i))),this._nodeId2MetaReloading.forEach(((t,i)=>e.push(i)))}preLoadBasis(){!r("disable-feature:i3s-basis")&&0!=(2&this.supportedTextureEncodings)&&c(this.i3slayer.textureSetDefinitions,(e=>e.some((e=>e.formats.some((e=>"basis"===e.format||"ktx2"===e.format))))))&&Ue()}_getVertexBufferLayout(e,t){const i={hasTexture:Ye(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion};return Ae(He(this._getGeometryParameters(i)))}_getObjectIdField(){return this.i3slayer.objectIdField||"OBJECTID"}_findGraphicNodeAndIndex(e){const t=Fe(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());let i=null;return a(this._nodeId2Meta,(e=>{if(h(e))return!1;const s=e.featureIds.indexOf(t);return-1!==s&&(i={node:e.node,index:s},!0)})),i}_getGraphicIndices(e,t){const i=this._nodeId2Meta.get(e.index);if(h(i))return[];const s=[],r=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const a of t){const e=Fe(o,a.attributes,r),t=i.featureIds.indexOf(e);-1!==t&&s.push(t)}return s}whenGraphicBounds(e){const t=this._findGraphicNodeAndIndex(e);if(!t)return Promise.reject();const i=this._nodeId2Meta.get(t.node.index);if(h(i))return Promise.reject();const s=i.objectHandle,r=de(t.index,this._collection,s,new Float64Array(24)),o=this.view.renderSpatialReference,a=this.view.spatialReference;if(R(r,o,0,r,a,0,8)){const e=H();return U(e,r,0,8),Promise.resolve({boundingBox:e,screenSpaceObjects:[]})}}whenGraphicAttributes(e,t){return Ie(this.i3slayer,e,this._getObjectIdField(),t,(()=>[...this._nodeId2Meta.values()].filter(d)))}getGraphicFromIntersectorMetadata(e){if(null==e.nodeIndex||null==e.componentIndex)return null;const t=this._nodeId2Meta.get(e.nodeIndex);return h(t)||null==t.featureIds||e.componentIndex>=t.featureIds.length?null:this._createGraphic(e.componentIndex,t)}_getCacheKey(e){return`${this._layerUrl}/v${ke}/${e.id}${this._cacheKeySuffix}`}_getMemCacheKey(e,t=this.elevationOffset){return e+"#"+t}get _idbCacheEnabled(){return!this._controller.disableIDBCache&&0===this._modifications.length&&0===this.elevationOffset&&null!=this._cacheKeySuffix}loadCachedGPUData(e){return d(this._memCache)?this._memCache.pop(this._getMemCacheKey(e.index)):null}deleteCachedGPUData(e){d(e)&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(h(this._memCache))return void this._deleteComponentObject(e);const i=this._controller.indexDepth-e.node.level;this._memCache.put(this._getMemCacheKey(e.node.index,t),e,e.node.memory,i)}loadMissingTextures(e,t,i,s){const r=e.filter(((e,i)=>{if(0==(e.usage&this.rendererTextureUsage))return!1;if(h(t))return!0;const s=ue(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(h(r)||null==r.data||s&&r.encoding!==s.encoding)}));return 0===r.length?Promise.resolve(!1):i(r,s).then((i=>{let s=0;for(let r=0;r<e.length;r++)s<i.length&&i[s].id===e[r].id&&(t[r]=i[s],s++);return!0}))}loadCachedNodeData(e,t,i){return this._idbCacheEnabled?this._idbCache.get(this._getCacheKey(e),t).then((s=>null==s?null:s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e)),null):(e.geometryObb=s.geometryObb,this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then((i=>(i&&this._idbCache.initialized&&d(s.textureData)&&(s.byteSize=tt(s.transformedGeometry,s.textureData),s.textureData.every(et)&&it(e,s)&&this._idbCache.put(this._getCacheKey(e),s).catch((t=>Ge.warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`)))),m(t),s)))))):Promise.resolve(null)}addNode(e,t,i){return Ze(t)?this._addData(e,t.attributeDataInfo,(()=>this._transformNode(e,t,i).then((s=>this._safeReschedule((()=>{if(h(s))return e.hasModifications=!1,this._addCachedNodeData(e,null,i);e.hasModifications=s.transformedGeometry.hasModifications;const{obb:r,componentOffsets:o,featureIds:a,transformedGeometry:n}=s,l=this._controller.crsIndex,c=this.view.renderSpatialReference,u=ge(e.mbs,this.elevationOffset,l,c);e.geometryObb=Te([r.center.x,r.center.y,r.center.z],[r.extents.x,r.extents.y,r.extents.z],[r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w]),S(e.geometryObb.center,e.geometryObb.center,u),t.geometryData.componentOffsets=o,a&&(t.geometryData.featureIds=Array.prototype.slice.call(a));const _={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:n,globalTrafo:u,geometryObb:e.geometryObb,byteSize:tt(n,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&it(e,_)){const t=d(_.textureData)?_.textureData.map((e=>et(e)?e:null)):null;this._idbCache.put(this._getCacheKey(e),{..._,textureData:t}).catch((t=>Ge.warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`)))}return this._addCachedNodeData(e,_,i)}),i))))):Promise.reject()}computeVisibilityObb(e){return Me(e,this.view.renderSpatialReference,this._controller.crsIndex,this.i3slayer.spatialReference,this.elevationOffset,this._modifications)}_transformNode(e,t,i){const s=t.geometryData.geometries,r=new Array(s.length);for(let h=0;h<s.length;++h)r[h]=this._getVertexBufferLayout(s[h],t.geometryDescriptor);const o=e.mbs,a=this.elevationOffset,n=this._controller.crsIndex,l=this._controller.crsVertex,d=this.view.renderSpatialReference,c=pe(o,a,n),u=ge(o,a,n,d),_=N(n,l),m=N(l,d);if(h(_)||h(m))return Promise.resolve(null);const g={context:this.i3slayer.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,localOrigin:c,globalTrafo:u,mbs:o,obb:e.serviceObb,elevationOffset:a,needNormals:!this._isIntegratedMesh&&this._controller.isMeshPyramid,normalReferenceFrame:this.i3slayer.normalReferenceFrame||"none",indexToVertexProjector:_,vertexToRenderProjector:m};return this._worker.invoke(g,i)}get supportsNodeCrossFading(){var e,t;return!(null!=(e=this.view)&&null!=(t=e._stage)&&t.renderView.hasShadowsEnabled)}get nodeCrossfadingEnabled(){return this.supportsNodeCrossFading&&(this.lodCrossfadeinDuration>0||this.lodCrossfadeoutDuration>0||this.lodCrossfadeUncoveredDuration>0)}get nodeFadeoutEnabled(){return this.supportsNodeCrossFading&&this.lodCrossfadeoutDuration>0}_setNewNodeOpacity(e){const t=this.nodeCrossfadingEnabled?0:this.fullOpacity;this._setNodeOpacity(e,t)}addCachedGPUData(e,t,i){if(e.geometryObb=Ve(this._collection.getComponentObb(t.objectHandle)),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);d(this._labeler)&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,1),this._updateMaterial(t),this._setNewNodeOpacity(t),this._updateEngineObject(t),this._highlights.objectCreated(t),d(this._treeDebugger)&&this._treeDebugger.update()}addCachedNodeData(e,t,i,s){return this._addData(e,i,(()=>this._addCachedNodeData(e,t,s)))}async _addCachedNodeData(e,t,i){if(this.suspended||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(h(t))return void this._addNodeMeta(e.index,null);const s=this._addTasks.get(e.index),{geometryData:o,transformedGeometry:a,globalTrafo:n}=t;await this.attributeOverrides.apply(o.featureIds,s.attributeInfo,i);const l=d(t.textureData)?t.textureData.filter((e=>d(e)&&0!=(e.usage&this.rendererTextureUsage))):[];!r("disable-feature:i3s-basis")&&l.some((e=>d(e)&&(2===e.encoding||1===e.encoding)))&&await Ue(),e.memory=0;const{componentOffsets:c,geometries:_,featureIds:m}=o,g=this._collection,p=_[0],{layout:f,indices:b,interleavedVertexData:y,positionData:v,hasColors:I}=a,S=this._materialParameters(p,f),E=c||new Uint32Array([0,b?b.length:y.byteLength/f[0].stride]),F={vertices:{data:y,count:y.byteLength/f[0].stride,layoutParameters:S.geometryParams},positionData:{positions:v.data,indices:v.indices},indices:b,componentOffsets:E},R=p.transformation?j(p.transformation):w();C(R,n,R);const N=O(D(),R),P=M(x(),R),A=this.view.renderSpatialReference,H=this.view.basemapTerrain.spatialReference,U=D(),G=[1,1,1];T(N,A,G,H)||Ge.errorOnce("Unsupported coordinate system for IM overlay"),V(N,A,U,H);const L=g.createObject({toMapSpace:[U[0],U[1],G[0],G[1]],geometry:F,obb:u(e.geometryObb),transform:{position:N,rotationScale:P}}),B=2===S.geometryParams.textureCoordinates,k=this._initMaterialAndTextures(L,S.material,l,B);e.memory+=this.memEstimateGeometryAdded(L),e.memory+=k.reduce(((e,t)=>e+(d(t)?this.memEstimateTextureAdded(t):0)),0);const q=!!S.material.hasParametersFromSource,z="blend"!==S.material.alphaMode&&S.material.metallicRoughness.baseColorFactor[3]>=1,W=new Be(e,m,L,this._getInvalidRendererVersion(),s.attributeInfo,{hasParametersFromSource:q,isOpaque:z},k);s.meta=W,!this._hasTextures&&t.requiredTextures.some((({usage:e})=>0!=(19&e)))&&(this._hasTextures=!0),this._hasData=!0,this._hasColors=this._hasColors||I,this._hasTextures=this._hasTextures||!!e.resources.texture,this.notifyChange("hasTexturesOrVertexColors");const $=this.slicePlaneEnabled;return this._addOrUpdateEdgeRendering(W).then((t=>(d(t)&&t.updateObjectVisibility(W.objectHandle,!1),this._safeReschedule((()=>{const i=this._addTasks.get(e.index);if(!i)return;if(d(this._labeler)&&this._addMetaToLabeler(this._labeler,W),this._addNodeMeta(e.index,W),i.meta=null,this.suspended)return void this._removeNodeStageData(e.index,this.elevationOffset);g.setObjectVisibility(L,1),d(t)&&t.updateObjectVisibility(W.objectHandle,!0),W.attributeInfo=i.attributeInfo;const s=W.cachedRendererVersion!==this._rendererVersion,r=$!==this.slicePlaneEnabled;this._setObjectSymbolColors(W);const o=this._applyFiltersToNode(W);(s||d(t)&&(r||o))&&this._addOrUpdateEdgeRendering(W),this._visibleGeometryChanged(W),this._highlights.objectCreated(W),this._updateMaterial(W),this._setNewNodeOpacity(W),d(this._treeDebugger)&&this._treeDebugger.update()}),i)))).catch((e=>{throw d(s.meta)&&(this._cacheGPUData(s.meta),s.meta=null),e}))}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){Ge.error("Removing duplicated node");const t=this._nodeId2Meta.get(e);d(t)&&this._deleteComponentObject(t)}d(t)&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&ot(t.cachedEdgeMaterials,0)),this._nodeId2Meta.set(e,t)}_safeReschedule(e,t){return m(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const i=e.params.material,s=t.some((e=>"uvRegion"===e.name)),r=t.some((e=>"normalCompressed"===e.name)),o=Ye(i);return{geometryParams:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s){const r=this._stage.renderView,o=i.map((e=>_e(e,t,s,r)));return this._stage.addMany(o),this._collection.updateMaterial(e,(e=>{me(e,t,o,i,this.view._stage.renderView.textureRepository,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR(),isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference}),this._updateMaterialOverlay(e)})),o}_getGeometryParameters(e){return{textureCoordinates:e.hasTexture?e.hasRegions?2:1:0,colors:this._hasVertexColors,normals:e.hasNormals&&!this._isIntegratedMesh}}_addData(e,t,i){let s=this._addTasks.get(e.index);return s?s.attributeInfo=t:(s={...g(),attributeInfo:t,meta:null},this._addTasks.set(e.index,s),i().then(s.resolve,s.reject).then((()=>this._addTasks.delete(e.index))).catch((t=>{throw this._addTasks.delete(e.index),t}))),s.promise}_clearAddTasks(){this._addTasks.forEach((e=>{d(e.meta)&&(this._cacheGPUData(e.meta),e.meta=null)})),this._addTasks.clear()}_clippingAreaChanged(){const e=A();Ne(this.view.clippingArea,e,this.view.renderSpatialReference)?this._clippingArea=e:this._clippingArea=null,this._filterChange(),this._controller&&this._controller.updateClippingArea(this.view.clippingArea)}_geometryFilterChange(){this._controller.geometryFilterChanged(this.hasGeometryFilter)}get hasGeometryFilter(){return!1}_filterChange(){this._applyFilters(!1)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach((e=>{d(e)&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e))}))}getFilters(){const e=[];return this._clippingArea&&e.push(((e,t)=>this._boundingboxFilter(e,t,this._clippingArea))),e}addSqlFilter(e,t,i){if(d(t)){const s=t.fieldNames;e.push(((e,r)=>this._sqlFilter(e,r,t,s,i)))}}_sqlFilter(e,t,i,s,r){const o={},a=this._createLayerGraphic(o),n=this.i3slayer.objectIdField,l=t.featureIds,h=d(t.attributeInfo)&&t.attributeInfo.attributeData;s.every((e=>null!=h[e]||e===n))&&xe(e,l,(e=>{o[n]=l[e];for(const i of s)i!==n&&(o[i]=Ce(h[i],e));try{return i.testFeature(a)}catch(t){return r(t),!1}}))}_boundingboxNodeTest(e,t){return P(e.node.mbs,this._controller.crsIndex,Xe,this.view.renderSpatialReference),Oe(t,Xe)}_boundingboxFeatureTest(e,t,i){return G(i,this._collection.getComponentAabb(e.objectHandle,t,We))}_boundingboxFilter(e,t,i){const s=this._collection,r=this._boundingboxNodeTest(t,i);if(3===r)return;if(0===r)return void(e.length=0);const o=s.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const a=this._transformAABB($e,i,t.objectHandle);xe(e,t.featureIds,(e=>this._boundingboxFeatureTest(t,e,a)))}_transformAABB(e,t,i){const s=this._collection.getObjectTransform(i),r=s.position,o=s.rotationScale;return e[0]=(t[0]-r[0])/o[0],e[1]=(t[1]-r[1])/o[4],e[2]=(t[2]-r[2])/o[8],e[3]=(t[3]-r[0])/o[0],e[4]=(t[4]-r[1])/o[4],e[5]=(t[5]-r[2])/o[8],e}_addOrUpdateEdgeRendering(e,t=!0){if(h(this._edgeView))return Promise.resolve(null);const i=e.objectHandle,s=this._edgeView.hasObject(i),{hasEdges:r,perFeatureEdgeMaterials:o}=this._getFilteredEdgeMaterials(e),a={slicePlaneEnabled:this.slicePlaneEnabled};if(r){if(s){if(this.nodeCrossfadingEnabled){ot(o,this.getNodeOpacity(e))}return this._edgeView.updateAllComponentMaterials(i,o,a,t),this._edgeView.updateObjectVisibility(i,!0),Promise.resolve(this._edgeView)}return this._collection.addEdges(i,this._edgeView,o,a).then((()=>this._edgeView))}return s&&this._edgeView.removeObject(i),Promise.resolve(null)}_removeEdgeRendering(e){d(this._edgeView)&&this._edgeView.hasObject(e.objectHandle)&&this._edgeView.removeObject(e.objectHandle)}_applyFiltersToNode(e){return!!this._applyFiltersToNodeComponents(e)&&(d(this._labeler)&&this._labeler.applyFilterChange(e),!0)}_applyFiltersToNodeComponents(e){const t=this._collection,i=0===t.getComponentCount(e.objectHandle).invisible;if(t.setAllComponentVisibilities(e.objectHandle,"all"),0===this._filters.length)return e.filteredIds=null,!i;if(this._updateCachedFilteredIds(e),e.filteredIds===e.featureIds)return!i;const s=this._computeFilteredComponentIndices(e);return t.setAllComponentVisibilities(e.objectHandle,s),!0}_updateCachedFilteredIds(e){null!=e.filteredIds&&e.appliedFilters===this._filters||(e.filteredIds=this._computeFilteredIds(e),e.appliedFilters=this._filters)}_computeFilteredIds(e){const t=e.featureIds.slice();for(const i of this._filters)if(i(t,e),0===t.length)break;return t.length===e.featureIds.length?e.featureIds:t}_computeFilteredComponentIndices(e){const t=new Array;return e.featureIds.forEach(((i,s)=>{e.filteredIds[t.length]===i&&t.push(s)})),t}_removeAllNodeDataFromStage(e=this.elevationOffset){this._nodeId2Meta.forEach(((t,i)=>this._removeNodeStageData(i,e))),this._nodeId2MetaReloading.forEach(((t,i)=>this._removeNodeStageData(i,e,this._nodeId2MetaReloading)))}removeNode(e){const t=this.elevationOffset;this._removeNodeStageData(e,t),this._removeNodeStageData(e,t,this._nodeId2MetaReloading)}_removeNodeStageData(e,t,i=this._nodeId2Meta){const s=i.get(e);h(s)?i.delete(e):(this._collection.setObjectVisibility(s.objectHandle,0),this._visibleGeometryChanged(s),this._removeEdgeRendering(s),d(this._labeler)&&this._labeler.removeNodeMeta(s),i.delete(e),this._highlights.objectDeleted(s),i===this._nodeId2Meta?(this._cacheGPUData(s,t),this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopNodeFading(s)):this._deleteComponentObject(s),d(this._treeDebugger)&&this._treeDebugger.update())}_deleteComponentObject(e){if(d(this._edgeView)&&this._edgeView.removeObject(e.objectHandle),this.memEstimateGeometryRemoved(e.objectHandle),this._collection.destroyObject(e.objectHandle),e.textures)for(const t of e.textures)this.memEstimateTextureRemoved(t),this._stage.remove(t)}updateNodeState(e,t){const i=this._nodeId2Meta.get(e);d(i)&&this._collection.updateMaterial(i.objectHandle,(e=>e.polygonOffsetEnabled=0===t))}_invalidateAllSymbols(){this._rendererVersion=je(this._rendererVersion,1),this._controller&&this._controller.requestUpdate()}_getInvalidRendererVersion(){return je(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=je(this._rendererVersion,1),this._rendererFields=null,this._colorVariable=null,this._opacityVariable=null,this._invalidateAllSymbols(),e&&(this._rendererFields=await e.getRequiredFields(this.i3slayer.fieldsIndex)),this._updateSymbologyFields(),!this._arcade&&e&&"arcadeRequired"in e&&e.arcadeRequired&&(this._arcade=await $()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:Ge.warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.getSymbols())"mesh-3d"!==t.type&&Ge.error(`Symbols of type '${t.type}' are not supported for 3D Object Scene Services.`);this._controller&&this._controller.requestUpdate()}_getCachedEdgeMaterials(e){return this._hasSymbolColors&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e),e.cachedEdgeMaterials}_getSymbolColors(e){this._hasSymbolColors&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e);const t=e.cachedSymbology;return(e,i)=>{const s=5*e;F(i.externalColor,t[s+0]/255,t[s+1]/255,t[s+2]/255,t[s+3]/255),i.externalColorMixMode=15&t[s+4],i.castShadows=0!=(16&t[s+4]),i.pickable=0!=(32&t[s+4])}}_getSymbolInfo(e,t){const i=e&&e.getSymbol(t,{arcade:this._arcade});if(!(i instanceof K))return null;const s=i.id;if(this._symbolInfos.has(s))return this._symbolInfos.get(s);const r=we(i);return this._symbolInfos.set(s,r),r}_setSymbologyOverride(e,t){this._symbologyOverride!==e&&(this._symbologyOverride=e,this._symbologyOverrideFields=t,this._invalidateAllSymbols(),this._updateSymbologyFields())}_updateSymbologyFields(){this._symbologyFields=d(this._symbologyOverrideFields)&&this._symbologyOverrideFields.length>0?d(this._rendererFields)&&this._rendererFields.length>0?B(this.i3slayer.fieldsIndex,[...this._rendererFields,...this._symbologyOverrideFields]):this._symbologyOverrideFields:this._rendererFields}_updateCachedRendererData(e){if(e.cachedRendererVersion=this._rendererVersion,!this._hasSymbolColors)return;const t=this._tmpAttributeOnlyGraphic,i={};t.attributes=i;const s=this._currentRenderer,r=d(e.attributeInfo)&&e.attributeInfo.attributeData,o=null!=e.featureIds?this.i3slayer.objectIdField:null,a=null!=r&&d(this._symbologyFields)&&this._symbologyFields.length>0,n=a?[]:null,l=a?[]:null;if(a&&d(this._symbologyFields))for(const d of this._symbologyFields){const e=r[d];e&&(n.push(d),l.push(e))}e.cachedSymbology||(e.cachedSymbology=new Uint8Array(5*e.featureIds.length));const c={color:Je,castShadows:!0,pickable:!0,colorMixMode:1,edgeMaterial:null},u=this.fullOpacity,_=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):u;let m=null,g=2,p=Se,f=0;for(let b=0;b<e.featureIds.length;b++){if(null!=o&&(i[o]=e.featureIds[b]),a)for(let e=0;e<n.length;e++)i[n[e]]=Ce(l[e],b);const r=this._getSymbolInfo(s,t);let u=null,y=null;if(s&&"visualVariables"in s){if(this._colorVariable){const e=z(this._colorVariable,t,{color:Qe,arcade:this._arcade});e&&(u=Je,u[0]=e.r/255,u[1]=e.g/255,u[2]=e.b/255,this._opacityVariable||null===e.a||(y=e.a))}this._opacityVariable&&(y=W(this._opacityVariable,t,{arcade:this._arcade}))}if(r&&r.material){const e=r.material;u=h(u)||h(y)?se(u,y,e.color,e.alpha,Le,Je):se(u,y,null,null,Le,Je)}if(h(u)&&(u=Je,u[0]=1,u[1]=1,u[2]=1,u[3]=1),c.pickable=!0,c.castShadows=!r||r.castShadows,c.colorMixMode=r&&r.material?r.material.colorMixMode:1,c.edgeMaterial=r?r.edgeMaterial:null,d(this._symbologyOverride)&&(c.color=u,this._symbologyOverride(t,c),u=c.color),d(c.edgeMaterial)){const t=u[3]<=0?0:u[3]>=1&&(e.material.isOpaque||3===c.colorMixMode)?2:1;c.edgeMaterial===m&&t===g||(p={...c.edgeMaterial,opacity:_,objectTransparency:t},m=c.edgeMaterial,g=t),e.cachedEdgeMaterials[b]=p}else e.cachedEdgeMaterials[b]=Se;e.cachedSymbology[f+0]=Math.round(255*u[0]),e.cachedSymbology[f+1]=Math.round(255*u[1]),e.cachedSymbology[f+2]=Math.round(255*u[2]),e.cachedSymbology[f+3]=Math.round(255*u[3]),e.cachedSymbology[f+4]=c.colorMixMode|+c.castShadows<<4|+c.pickable<<5,f+=5}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);if(this.nodeCrossfadingEnabled||ot(t,this.fullOpacity),h(e.filteredIds)){return{hasEdges:t.some((e=>e!==Se)),perFeatureEdgeMaterials:t}}let i=0,s=!1;const r=t.map(((t,r)=>e.featureIds[r]!==e.filteredIds[i]?Se:(s=s||t!==Se,i++,t)));return{hasEdges:s,perFeatureEdgeMaterials:r}}_setObjectSymbolColors(e){if(!this._hasSymbolColors)return;const t=e.objectHandle,i=this._getSymbolColors(e);this._collection.setComponentData(t,i),this._stage.renderView.requestRender()}_reloadAll(e=this.elevationOffset){this._removeAllNodeDataFromStage(e),null!=this._controller&&this._controller.restartNodeLoading()}_opacityChange(e){this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopAllNodeFading(),this._nodeId2Meta.forEach((t=>{h(t)||(this._collection.updateMaterial(t.objectHandle,(t=>t.objectOpacity=e)),ot(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))}))}_updateMaterial(e){this._collection.updateMaterial(e.objectHandle,(e=>{e.commonMaterialParameters.slicePlaneEnabled=this.slicePlaneEnabled,e.usePBR=this._usePBR(),this._updateMaterialOverlay(e)}))}_updateMaterialOverlay(e){}_updateEngineObject(e){this._setObjectSymbolColors(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlane=e),d(this._labeler)&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach((t=>{h(t)||(this._collection.updateMaterial(t.objectHandle,(t=>{t.commonMaterialParameters.slicePlaneEnabled=e})),this._updateEdgeRendering(t,!1))}))}_updatePBR(){this._nodeId2Meta.forEach((e=>{h(e)||this._collection.updateMaterial(e.objectHandle,(e=>{e.usePBR=this._usePBR()}))})),this._hasLoadedPBRTextures=!0}_usePBR(){return!this._isIntegratedMesh&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){d(this._edgeView)&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_forAllFeatures(e,t,i=0){a(this._nodeId2Meta,(s=>{if(h(s))return!1;if(d(t)){switch(t(s)){case 0:return!0;case 2:return!1}}let r=1;switch(i){case 1:r=this._forAllFeaturesOfNode(s,e);break;case 0:r=this._forVisibleFeaturesOfNode(s,e);break;case 2:r=this._forAllFeaturesOfNodeInClippingArea(s,e)}return 0===r}))}_forAllFeaturesOfNode(e,t){let i=1;const s=e.featureIds;for(let r=0;r<s.length;r++)if(i=t(s[r],r,e),0===i)return i;return i}_forVisibleFeaturesOfNode(e,t){let i=1;const s=e.featureIds;return this._collection.forEachVisibleComponent(e.objectHandle,(r=>(i=t(s[r],r,e),1===i))),i}_forAllFeaturesOfNodeInClippingArea(e,t){if(null==this._clippingArea)return this._forAllFeaturesOfNode(e,t);const i=this._boundingboxNodeTest(e,this._clippingArea);if(0===i)return 1;if(3===i)return this._forAllFeaturesOfNode(e,t);const s=1,r=e.featureIds,o=e.objectHandle,a=Ee(this._clippingArea,this._collection.getObjectTransform(o));for(let n=0;n<r.length;n++){if(!this._boundingboxFeatureTest(e,n,a))continue;const i=t(r[n],n,e);if(0===i)return i}return s}_createAttributes(e,t){const i={};null!=t.featureIds&&(i[this._getObjectIdField()]=t.featureIds[e]);const s=d(t.attributeInfo)&&t.attributeInfo.attributeData;if(d(s))for(const r of Object.keys(s))i[r]=Ce(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e){const t=this._highlights;if("number"==typeof e||e instanceof i?e=[e]:e instanceof s&&(e=e.toArray()),Array.isArray(e)&&e.length>0){if(e[0]instanceof i){const i=e,s=this.i3slayer.fieldsIndex,r=this._getObjectIdField(),o=i.map((e=>Fe(s,e.attributes,r))),{set:a,handle:n}=t.acquireSet();return t.setFeatureIds(a,o),n}if("number"==typeof e[0]){const i=e,{set:s,handle:r}=t.acquireSet();return t.setFeatureIds(s,i),r}}return rt}_visibleGeometryChanged(e){this._elevationProvider&&(this._elevationProvider.objectChanged(e.node),null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=p((()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null}))))}get performanceInfo(){const e={displayedNumberOfFeatures:0,maximumNumberOfFeatures:0,totalNumberOfFeatures:0,core:null,index:0,nodes:this._nodeId2Meta.size,"Total GPU Memory Estimate":(this.gpuMemoryEstimate/1048576).toFixed(1)+"MB","Geometry Memory Estimate":(this.geoMemoryEstimate/1048576).toFixed(1)+"MB","Texture Memory Estimate":(this.texMemoryEstimate/1048576).toFixed(1)+"MB","Unloaded Memory Estimate":(this.getUnloadedMemory()/1048576).toFixed(1)+"MB"};return d(this._memCache)&&(e.MemCache=Math.round(100*this._memCache.hitRate)+"% hit"),this._controller&&(this._idbCacheEnabled&&(e.IDBCache=Math.round(100*this._idbCache.getHitRate())+"% hit"),this._controller.updateStats(e)),e}get test(){const e=this;return{controller:this._controller,labeler:this._labeler,get visibleObjectIds(){const t=[];return e._forAllFeatures((e=>(t.push(e),1)),null,0),t.sort(((e,t)=>e-t)),t},get numNodes(){return e._nodeId2Meta.size}}}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return d(e)?this._collection.getMaterial(e.objectHandle).objectOpacity:0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}markNodeToRemove(e){this._controller&&this._controller.markNodeToRemove(e)}removeMarkedNodes(){this._controller&&this._controller.removeMarkedNodes()}foreachCrossfadeNode(e){this._nodeId2Meta.forEach(((t,i)=>e(i,t)))}fadeNode(e,t,i){if(!this.nodeCrossfadingEnabled)return;const s=this._nodeId2Meta.get(e);d(s)&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);d(i)&&this._setNodeOpacity(i,t)}_setNodeOpacity(e,t){this._collection.updateMaterial(e.objectHandle,(e=>e.objectOpacity=t)),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(!d(this._edgeView)||!e.cachedEdgeMaterials)return;ot(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t)}get _hasModifications(){return this._modifications&&this._modifications.length>0}updateNodeModificationStatus(e){const t=e.length;if(!this._hasModifications||t<=0||!0!==this._i3sWasmLoaded)return;const i=this.i3slayer.uid,s=st(e);if(d(s)){const t={context:i,buffer:s.buffer};te(t);const r=new Float64Array(s.buffer);e.forAll(((e,t)=>{const i=r[t],s=ie(i);e.imModificationImpact=s,0!==s&&this._controller.invalidateGeometryVisibility(e.index)}))}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||d(this._labeler)&&this._labeler.updating||this._crossfadeHelper.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0}};return e([v()],o.prototype,"_hasLoadedPBRTextures",void 0),e([v()],o.prototype,"_asyncModuleLoading",void 0),e([v()],o.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([v()],o.prototype,"view",void 0),e([v()],o.prototype,"i3slayer",void 0),e([v()],o.prototype,"_controller",void 0),e([v()],o.prototype,"_labeler",void 0),e([v()],o.prototype,"updating",void 0),e([v()],o.prototype,"suspended",void 0),e([v()],o.prototype,"holeFilling",void 0),e([v(Pe)],o.prototype,"updatingProgress",void 0),e([v({readOnly:!0,aliasOf:"_controller.updatingProgress"})],o.prototype,"updatingProgressValue",void 0),e([v({readOnly:!0})],o.prototype,"hasTexturesOrVertexColors",null),e([v({readOnly:!0})],o.prototype,"rendererTextureUsage",null),e([v({readOnly:!0})],o.prototype,"elevationOffset",null),e([v({type:Boolean})],o.prototype,"slicePlaneEnabled",void 0),e([v()],o.prototype,"supportedTextureEncodings",null),e([v()],o.prototype,"uncompressedTextureDownsamplingEnabled",null),e([v({type:[q]})],o.prototype,"_modifications",void 0),o=e([I("esri.views.3d.layers.I3SMeshView3D")],o),o},We=A(),$e=A(),Ke=Te(),Je=[0,0,0,0],Qe=new t([0,0,0,0]),Xe=[0,0,0,0];function Ye(e){const t=e.metallicRoughness;return t&&t.baseColorTextureId>=0||t&&t.metallicRoughnessTextureId>=0||e.normalTextureId>=0||e.emissiveTextureId>=0||e.occlusionTextureId>=0}function Ze(e){return"geometryData"in e}function et(e){return d(e)&&f(e.data)}function tt(e,t){let i=1024+e.interleavedVertexData.byteLength+(e.indices?e.indices.byteLength:0)+e.positionData.data.byteLength+e.positionData.indices.byteLength;if(d(t))for(const s of t)d(s)&&f(s.data)&&(i+=s.data.byteLength);return i}function it(e,t){return t.byteSize>qe?(Ge.warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}function st(e){if(0===e.length)return null;const t=10*e.length,i=new Float64Array(t);return e.forAll(((e,t)=>{let s=e.serviceObb;h(s)&&(s=Ke,E(s.center,e.mbs),s.halfSize[0]=s.halfSize[1]=s.halfSize[2]=e.mbs[3]);const r=10*t;i[r+0]=s.center[0],i[r+1]=s.center[1],i[r+2]=s.center[2],i[r+3]=s.halfSize[0],i[r+4]=s.halfSize[1],i[r+5]=s.halfSize[2],i[r+6]=s.quaternion[0],i[r+7]=s.quaternion[1],i[r+8]=s.quaternion[2],i[r+9]=s.quaternion[3]})),i}const rt={remove(){},pause(){},resume(){}};function ot(e,t){e.forEach((e=>e.opacity=t))}export{ze as I3SMeshView3D};