@arcgis/core 4.23.0-next.20220127 → 4.23.0-next.20220128

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 (312) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/0463ba46df855a92b9c0.js +1 -0
  3. package/assets/esri/core/workers/chunks/{e657ba0cab29f05d02da.js → 0cd0a6eef51fc5b9ea61.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{e4896cf85fb2da8a9cc7.js → 17de7a324dfa7f57ad5d.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{c36f84daa7736878418d.js → 197ec52641aed20029c6.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{0317f37b6c8705b363fd.js → 1c733b7db092a2a88ef3.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{9387db408f496e7dd003.js → 214910032945dd2d86b0.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{d835b2a683fcd8aeeed8.js → 27474b007988855bea9d.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{8001b0e514bfffe9d7f8.js → 357033117dfe61eb81ea.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{5948923e07bd1662c24a.js → 37c03cfc19086ce631c6.js} +1 -1
  11. package/assets/esri/core/workers/chunks/3c673495e5f507c4a9e5.js +1 -0
  12. package/assets/esri/core/workers/chunks/44f0c3663b293afbd172.js +1 -0
  13. package/assets/esri/core/workers/chunks/483d5d8593d96d0f0b15.js +1 -0
  14. package/assets/esri/core/workers/chunks/49a1a633bb0d93764aae.js +1 -0
  15. package/assets/esri/core/workers/chunks/{5f1dcb6556820cd0aa31.js → 4be35af7d6babbfe9d84.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{f9ff3eaf4eb324429fbd.js → 5457962a70bd3c557a75.js} +1 -1
  17. package/assets/esri/core/workers/chunks/57856b4a9b8784a69844.js +1 -0
  18. package/assets/esri/core/workers/chunks/{56274b37ff74ca0d68a6.js → 5d11b97b667921d67ae7.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{ba5eb394f098968c22d2.js → 655b55ac0cd533d7e9d7.js} +1 -1
  20. package/assets/esri/core/workers/chunks/7903a3e2e0faff0f86c0.js +1 -0
  21. package/assets/esri/core/workers/chunks/918bb7a7d901544a7367.js +1 -0
  22. package/assets/esri/core/workers/chunks/949b2269457302ffc64b.js +1 -0
  23. package/assets/esri/core/workers/chunks/{601e697dc7414bda128a.js → 952980635afc7ec81804.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{e8741bf421f80213f1d3.js → 9876a1bae350795fab36.js} +1 -1
  25. package/assets/esri/core/workers/chunks/99619fcb772807c74f3b.js +1 -0
  26. package/assets/esri/core/workers/chunks/{3f343f792fd9f44d6f25.js → b3f5e91116112b0b612a.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{4c76146014dc15143ba3.js → be588873c16770ceb9ef.js} +1 -1
  28. package/assets/esri/core/workers/chunks/d1fe53b597351dc58305.js +1 -0
  29. package/assets/esri/core/workers/chunks/{b62e3dccd9f662c0afeb.js → db3c729ce0c0b2690dc9.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{199670a3a564ebe3bd79.js → e218bde41ffbcc5194f5.js} +1 -1
  31. package/assets/esri/core/workers/chunks/e21b211913aefde47e30.js +1 -0
  32. package/assets/esri/core/workers/chunks/{c9cbf8135e95f0f42cd9.js → e287f49184d076af17e2.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{bde1d5b0a7717350986e.js → e4019b63a1fe74e2c842.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{6e6a3c5866e8d8820457.js → eb82ff10cef2bde6e57f.js} +1 -1
  35. package/assets/esri/core/workers/chunks/ebc6f4764b82d4104c65.js +1 -0
  36. package/assets/esri/core/workers/chunks/{842db82733635dbf25cb.js → ee6e0db58dc64410e687.js} +1 -1
  37. package/assets/esri/core/workers/chunks/f0a9f161805fc7a30fc5.js +1 -0
  38. package/assets/esri/core/workers/chunks/ff6abdc72076f3994659.js +981 -0
  39. package/chunks/BlendLayers.glsl.js +2 -2
  40. package/chunks/ChapmanAtmosphere.glsl.js +17 -17
  41. package/chunks/CheckerBoard.glsl.js +3 -3
  42. package/chunks/Clouds.glsl.js +2 -2
  43. package/chunks/CloudsComposition.glsl.js +1 -1
  44. package/chunks/ColorMaterial.glsl.js +12 -12
  45. package/chunks/ComponentShader.glsl.js +3 -3
  46. package/chunks/Compositing.glsl.js +1 -1
  47. package/chunks/DefaultMaterial.glsl.js +33 -33
  48. package/chunks/EdgeShaderProgram.glsl.js +7 -7
  49. package/chunks/Fog.glsl.js +10 -12
  50. package/chunks/HUDMaterial.glsl.js +2 -2
  51. package/chunks/HighlightComposition.glsl.js +5 -5
  52. package/chunks/ImageMaterial.glsl.js +6 -6
  53. package/chunks/LaserlinePath.glsl.js +8 -8
  54. package/chunks/LineCallout.glsl.js +6 -6
  55. package/chunks/MeasurementArrow.glsl.js +1 -1
  56. package/chunks/NativeLine.glsl.js +1 -1
  57. package/chunks/Path.glsl.js +5 -5
  58. package/chunks/Pattern.glsl.js +9 -9
  59. package/chunks/PointRenderer.glsl.js +14 -14
  60. package/chunks/Precipitation.glsl.js +2 -2
  61. package/chunks/RealisticTree.glsl.js +21 -21
  62. package/chunks/RibbonLine.glsl.js +11 -11
  63. package/chunks/SMAA.glsl.js +40 -40
  64. package/chunks/ShadedColorMaterial.glsl.js +12 -12
  65. package/chunks/ShadowCast.glsl.js +6 -6
  66. package/chunks/ShadowHighlight.glsl.js +4 -4
  67. package/chunks/SimpleAtmosphere.glsl.js +3 -3
  68. package/chunks/SlicePlaneMaterial.glsl.js +3 -3
  69. package/chunks/Stars.glsl.js +3 -3
  70. package/chunks/Terrain.glsl.js +11 -11
  71. package/chunks/TextureOnly.glsl.js +2 -2
  72. package/chunks/WaterSurface.glsl.js +5 -5
  73. package/chunks/boundedPlane.js +1 -1
  74. package/core/accessorSupport/watch.js +1 -1
  75. package/core/loadAll.js +1 -1
  76. package/geometry/support/frustum.js +1 -1
  77. package/geometry/support/plane.js +1 -1
  78. package/interfaces.d.ts +204 -10
  79. package/layers/VectorTileLayer.js +1 -1
  80. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  81. package/layers/graphics/featureConversionUtils.js +1 -1
  82. package/layers/support/LayerContingentValuesCache.js +1 -1
  83. package/layers/support/TileInfo.js +1 -1
  84. package/package.json +1 -1
  85. package/smartMapping/statistics/support/predominanceUtils.d.ts +4 -0
  86. package/support/revision.js +1 -1
  87. package/symbols/FillSymbol3DLayer.js +1 -1
  88. package/symbols/IconSymbol3DLayer.js +1 -1
  89. package/symbols/ObjectSymbol3DLayer.js +1 -1
  90. package/symbols/Symbol3D.js +1 -1
  91. package/symbols/WebStyleSymbol.js +1 -1
  92. package/symbols/cim/CIMSymbolRasterizer.js +1 -1
  93. package/symbols/support/IconSymbol3DLayerResource.js +1 -1
  94. package/symbols/support/ObjectSymbol3DLayerResource.js +1 -1
  95. package/symbols/support/Symbol3DAnchorPosition2D.js +1 -1
  96. package/symbols/support/Symbol3DAnchorPosition3D.js +1 -1
  97. package/symbols/support/Symbol3DFillMaterial.js +1 -1
  98. package/symbols/support/Symbol3DIconOutline.js +1 -1
  99. package/symbols/support/Symbol3DOutline.js +1 -1
  100. package/symbols/support/Thumbnail.js +1 -1
  101. package/symbols/support/webStyleSymbolUtils.js +1 -1
  102. package/views/2d/engine/vectorTiles/SchemaHelper.js +1 -1
  103. package/views/3d/environment/ChapmanAtmosphere.glsl.js +1 -1
  104. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  105. package/views/3d/environment/CloudsComposition.glsl.js +1 -1
  106. package/views/3d/environment/CloudsGenerator.js +1 -1
  107. package/views/3d/environment/Fog.glsl.js +1 -1
  108. package/views/3d/environment/Fog.js +1 -1
  109. package/views/3d/environment/PanoramicAtmosphere.js +1 -1
  110. package/views/3d/environment/Precipitation.glsl.js +1 -1
  111. package/views/3d/environment/Precipitation.js +1 -1
  112. package/views/3d/environment/PrecipitationTechnique.js +1 -1
  113. package/views/3d/environment/SimpleAtmosphere.glsl.js +1 -1
  114. package/views/3d/environment/SimpleAtmosphere.js +1 -1
  115. package/views/3d/environment/Stars.glsl.js +1 -1
  116. package/views/3d/environment/Stars.js +1 -1
  117. package/views/3d/interactive/analysisTools/slice/sliceToolUtils.js +1 -1
  118. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  119. package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
  120. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  121. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  122. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  123. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  124. package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
  125. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  126. package/views/3d/layers/I3SMeshView3D.js +1 -1
  127. package/views/3d/layers/VectorTileLayerView3D.js +1 -1
  128. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  129. package/views/3d/layers/graphics/ElevationAligners.js +1 -1
  130. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  131. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  132. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  133. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  134. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  135. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  136. package/views/3d/layers/graphics/graphicUtils.js +1 -1
  137. package/views/3d/layers/graphics/lineUtils.js +1 -1
  138. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  139. package/views/3d/layers/graphics/polygonUtils.js +1 -1
  140. package/views/3d/layers/graphics/symbolComplexity.js +1 -1
  141. package/views/3d/layers/i3s/I3SBinaryReader.js +1 -1
  142. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  143. package/views/3d/layers/support/HeatmapFeatureProcessor.js +5 -0
  144. package/views/3d/layers/support/overlayImageUtils.js +1 -1
  145. package/views/3d/layers/support/patternUtils.js +1 -1
  146. package/views/3d/state/controllers/local/PinchAndPanController.js +1 -1
  147. package/views/3d/support/FrustumExtentIntersection.js +1 -1
  148. package/views/3d/support/LaserLineRenderer.js +1 -1
  149. package/views/3d/support/LaserlinePathData.js +1 -1
  150. package/views/3d/terrain/OverlayRenderer.js +1 -1
  151. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  152. package/views/3d/terrain/TerrainRenderer.js +1 -1
  153. package/views/3d/terrain/TerrainSurface.js +1 -1
  154. package/views/3d/terrain/Tile.js +1 -1
  155. package/views/3d/terrain/terrainUtils.js +1 -1
  156. package/views/3d/terrain/tileUtils.js +1 -1
  157. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  158. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  159. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  160. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +10 -10
  161. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
  162. package/views/3d/webgl-engine/collections/Component/SourceGeometry.js +1 -1
  163. package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
  164. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  165. package/views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js +2 -2
  166. package/views/3d/webgl-engine/core/shaderLibrary/ScreenSizeScaling.glsl.js +2 -2
  167. package/views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.js +2 -2
  168. package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +2 -2
  169. package/views/3d/webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js +4 -4
  170. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +1 -1
  171. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PositionAttribute.glsl.js +1 -1
  172. package/views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js +1 -1
  173. package/views/3d/webgl-engine/core/shaderLibrary/attributes/SymbolColor.glsl.js +1 -1
  174. package/views/3d/webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js +3 -3
  175. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexColor.glsl.js +1 -1
  176. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexNormal.glsl.js +6 -6
  177. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +12 -12
  178. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexTextureCoordinates.glsl.js +4 -4
  179. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js +1 -1
  180. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +16 -16
  181. package/views/3d/webgl-engine/core/shaderLibrary/default/RealisticTree.glsl.js +1 -1
  182. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +5 -5
  183. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUDOcclusionPass.glsl.js +3 -3
  184. package/views/3d/webgl-engine/core/shaderLibrary/raster/BasicGrid.glsl.js +2 -2
  185. package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeMaterialColor.glsl.js +6 -6
  186. package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeNormalTexture.glsl.js +2 -2
  187. package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeShadingNormal.glsl.js +10 -11
  188. package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +2 -2
  189. package/views/3d/webgl-engine/core/shaderLibrary/shading/MultipassGeometryTest.glsl.js +2 -2
  190. package/views/3d/webgl-engine/core/shaderLibrary/shading/MultipassTerrainTest.glsl.js +2 -2
  191. package/views/3d/webgl-engine/core/shaderLibrary/shading/Normals.glsl.js +6 -6
  192. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadBaseColorTexture.glsl.js +4 -4
  193. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +6 -6
  194. package/views/3d/webgl-engine/core/shaderLibrary/shading/Reprojection.glsl.js +4 -4
  195. package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceReflections.glsl.js +5 -5
  196. package/views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js +1 -1
  197. package/views/3d/webgl-engine/core/shaderLibrary/shading/Water.glsl.js +10 -10
  198. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Terrain.glsl.js +1 -1
  199. package/views/3d/webgl-engine/core/shaderLibrary/util/BlendLayers.glsl.js +1 -1
  200. package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +4 -4
  201. package/views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js +1 -1
  202. package/views/3d/webgl-engine/lib/Camera.js +1 -1
  203. package/views/3d/webgl-engine/lib/DefaultVertexAttributeLocations.js +1 -1
  204. package/views/3d/webgl-engine/lib/DefaultVertexBufferLayouts.js +1 -1
  205. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  206. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  207. package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
  208. package/views/3d/webgl-engine/lib/MagnifierHelper.js +1 -1
  209. package/views/3d/webgl-engine/lib/Material.js +1 -1
  210. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  211. package/views/3d/webgl-engine/lib/SSAOHelper.js +1 -1
  212. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  213. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  214. package/views/3d/webgl-engine/lib/SmaaRenderPass.js +1 -1
  215. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  216. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  217. package/views/3d/webgl-engine/lib/TextureUniformName.js +4 -0
  218. package/views/3d/webgl-engine/lib/UniformName.js +4 -0
  219. package/views/3d/webgl-engine/lib/VertexAttribute.js +5 -0
  220. package/views/3d/webgl-engine/lib/basicInterfaces.js +1 -1
  221. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  222. package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
  223. package/views/3d/webgl-engine/lib/edgeRendering/EdgeShaderTechnique.js +1 -1
  224. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  225. package/views/3d/webgl-engine/lib/edgeRendering/bufferLayouts.js +1 -1
  226. package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
  227. package/views/3d/webgl-engine/lib/lodRendering/RenderInstanceData.js +1 -1
  228. package/views/3d/webgl-engine/lib/pathGeometryUtils.js +1 -1
  229. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  230. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  231. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  232. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  233. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  234. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  235. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  236. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  237. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  238. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  239. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  240. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  241. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  242. package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
  243. package/views/3d/webgl-engine/materials/VisualVariableMaterialParameters.js +1 -1
  244. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  245. package/views/3d/webgl-engine/materials/internal/DefaultBufferWriter.js +1 -1
  246. package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
  247. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  248. package/views/3d/webgl-engine/materials/internal/waterMaterialUtils.js +1 -1
  249. package/views/3d/webgl-engine/shaders/CheckerBoard.glsl.js +1 -1
  250. package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
  251. package/views/3d/webgl-engine/shaders/ColorMaterial.glsl.js +1 -1
  252. package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
  253. package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
  254. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  255. package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
  256. package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
  257. package/views/3d/webgl-engine/shaders/HighlightComposition.glsl.js +1 -1
  258. package/views/3d/webgl-engine/shaders/HighlightTechnique.js +1 -1
  259. package/views/3d/webgl-engine/shaders/ImageMaterial.glsl.js +1 -1
  260. package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
  261. package/views/3d/webgl-engine/shaders/LaserlinePath.glsl.js +1 -1
  262. package/views/3d/webgl-engine/shaders/LaserlinePathTechnique.js +1 -1
  263. package/views/3d/webgl-engine/shaders/LineCallout.glsl.js +1 -1
  264. package/views/3d/webgl-engine/shaders/LineCalloutTechnique.js +1 -1
  265. package/views/3d/webgl-engine/shaders/Magnifier.glsl.js +1 -1
  266. package/views/3d/webgl-engine/shaders/MeasurementArrow.glsl.js +1 -1
  267. package/views/3d/webgl-engine/shaders/NativeLine.glsl.js +1 -1
  268. package/views/3d/webgl-engine/shaders/Pattern.glsl.js +1 -1
  269. package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
  270. package/views/3d/webgl-engine/shaders/PointRenderer.glsl.js +1 -1
  271. package/views/3d/webgl-engine/shaders/RealisticTreeTechnique.js +1 -1
  272. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  273. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  274. package/views/3d/webgl-engine/shaders/SMAA.glsl.js +1 -1
  275. package/views/3d/webgl-engine/shaders/ShadedColorMaterial.glsl.js +1 -1
  276. package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechnique.js +1 -1
  277. package/views/3d/webgl-engine/shaders/ShadowCastTechnique.js +1 -1
  278. package/views/3d/webgl-engine/shaders/ShadowHighlightTechnique.js +1 -1
  279. package/views/3d/webgl-engine/shaders/SlicePlaneMaterial.glsl.js +1 -1
  280. package/views/3d/webgl-engine/shaders/WaterSurface.glsl.js +1 -1
  281. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/AdjustProjectedPosition.glsl.js +10 -10
  282. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/DiscardShortEdges.glsl.js +1 -1
  283. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeShaderProgram.glsl.js +1 -1
  284. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeUtil.glsl.js +21 -21
  285. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/LineAmplitude.glsl.js +6 -6
  286. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/LineOffset.glsl.js +13 -13
  287. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/UnpackAttributes.glsl.js +6 -6
  288. package/views/SceneView.js +1 -1
  289. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  290. package/views/support/WatchUpdatingTracking.js +1 -1
  291. package/views/webgl/BufferObject.js +1 -1
  292. package/views/webgl/InstanceCounter.js +1 -1
  293. package/views/webgl/Program.js +1 -1
  294. package/widgets/BasemapGallery/support/basemapCompatibilityUtils.js +1 -1
  295. package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
  296. package/widgets/Search/support/locatorUtils.js +1 -1
  297. package/widgets/Search.js +1 -1
  298. package/assets/esri/core/workers/chunks/12c0cabb6c59e65d8546.js +0 -1
  299. package/assets/esri/core/workers/chunks/322d917e8cb398816a93.js +0 -1
  300. package/assets/esri/core/workers/chunks/392b6382e06652dd4c80.js +0 -1
  301. package/assets/esri/core/workers/chunks/3aa73119b055e05bbbeb.js +0 -1
  302. package/assets/esri/core/workers/chunks/52ea678ba1da0e349919.js +0 -1
  303. package/assets/esri/core/workers/chunks/5ee497d5d7b0e580526a.js +0 -1
  304. package/assets/esri/core/workers/chunks/663ad15b86936eb06b69.js +0 -1
  305. package/assets/esri/core/workers/chunks/83b8fec1650e061aaa56.js +0 -1
  306. package/assets/esri/core/workers/chunks/9796d54ff12b6429164a.js +0 -1
  307. package/assets/esri/core/workers/chunks/d07440469fe7d181c4fd.js +0 -1
  308. package/assets/esri/core/workers/chunks/dbf192b4ce7e608610f6.js +0 -1
  309. package/assets/esri/core/workers/chunks/de6cff7b6cbbf99b20d1.js +0 -981
  310. package/assets/esri/core/workers/chunks/dee9929d95e9fe26929c.js +0 -1
  311. package/assets/esri/core/workers/chunks/e12d91ef44d6f879a02a.js +0 -1
  312. package/assets/esri/core/workers/chunks/e59764ee8cf25d4f74e2.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/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 n}from"../../../../chunks/vec3.js";import{c as o}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 _}from"../../../../geometry/support/aaBoundingBox.js";import{makeDehydratedPoint as g}from"../../../../layers/graphics/dehydratedFeatures.js";import{getGeometryEffectiveElevationMode as y}from"../../../../support/elevationInfoUtils.js";import v from"../../../../symbols/support/ElevationInfo.js";import{DrapedVisualElementResources as O}from"./DrapedVisualElementResources.js";import{LaserlineVisualElement as w}from"./LaserlineVisualElement.js";import{VisualElementResources as C}from"./VisualElementResources.js";import{ElevationContext as b}from"../../layers/graphics/ElevationContext.js";import{geometryToRenderInfoDraped as R,RemoveDuplicateStartEnd as E,createGeometry as D,geometryToRenderInfo as P}from"../../layers/graphics/lineUtils.js";import{VertexAttribute as j}from"../../webgl-engine/lib/basicInterfaces.js";import{computeAttachmentOriginLines as I}from"../../webgl-engine/lib/geometryDataUtils.js";import{RenderOccludedFlag as A}from"../../webgl-engine/lib/Material.js";import{RenderGeometry as G}from"../../webgl-engine/lib/RenderGeometry.js";import{RibbonLineMaterial as M}from"../../webgl-engine/materials/RibbonLineMaterial.js";class S{constructor(t){this.view=null,this._attachmentOrigin=g(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=A.OccludeAndTransparentStencil,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 O({view:t.view,createResources:()=>this._createDrapedResources(),recreateGeometry:e=>{e.geometries=this._createRenderGeometriesDraped(e.material),this._attachmentOriginChanged()}});let r=!0;this._laserline=new w({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(V,0,0,0);let s=0;for(const t of e){const e=t.vertexAttributes.get(j.POSITION),i=t.indices.get(j.POSITION),n=r(this.resources.resources).material.isClosed(e.data,i);I(e,i,n,W)&&(a(V,V,W),s++)}return 0===s?null:(n(V,V,1/s),this.view.renderCoordsHelper.fromRenderCoords(V,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,stipplePreferContinuous:!1,isClosed:this.isClosed,falloff:this._falloff,innerColor:this._innerColor,innerWidth:this._innerWidth,join:"round",polygonOffset:!0,renderOccluded:this.normalizedRenderOccluded}}get normalizedRenderOccluded(){return this.isDraped&&this._renderOccluded===A.OccludeAndTransparentStencil?A.OccludeAndTransparent: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 M(this.materialParameters),r=[];return this._recreateGeometry(e,t,r),{material:t,geometries:r,forEach:e=>{e(t),r.forEach(e)}}}_createDrapedResources(){const e=new M(this.materialParameters);return{material:e,geometries:this._createRenderGeometriesDraped(e)}}_createRenderGeometriesDraped(e){const t=this.geometry;if(s(t))return[];const r=R(t,this.view.basemapTerrain.spatialReference),i=[];for(const{position:s}of r.lines){const t={overlayInfo:{spatialReference:this.view.basemapTerrain.spatialReference,renderCoordsHelper:this.view.renderCoordsHelper},attributeData:{position:s},removeDuplicateStartEnd:this.isClosed?E.REMOVE:E.KEEP},r=new G(D(t),e),a=f(T);_(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(j.POSITION),i=new Float64Array(s.data.length);u(s.data,t.spatialReference,0,i,this.view.spatialReference,0,s.data.length/3),_(e,i)}return!0}_createRenderGeometries(){var e;const t=this.geometry;if(s(t))return[];const r=P(t,this.view.elevationProvider,this.view.renderCoordsHelper,b.fromElevationInfo(null!=(e=this.elevationInfo)?e:new v({mode:y(t,null)}))),i=[],a=[];for(const{position:s,mapPosition:n}of r.lines){const e={overlayInfo:null,attributeData:{position:s,mapPosition:n},removeDuplicateStartEnd:this.isClosed?E.REMOVE:E.KEEP};i.push(D(e)),a.push(s)}return this._laserline.pathVerticalPlane=a,i}}const T=m(),W=o(),V=o();export{S 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 n}from"../../../../chunks/vec3.js";import{c as o}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 _}from"../../../../geometry/support/aaBoundingBox.js";import{makeDehydratedPoint as g}from"../../../../layers/graphics/dehydratedFeatures.js";import{getGeometryEffectiveElevationMode as y}from"../../../../support/elevationInfoUtils.js";import v from"../../../../symbols/support/ElevationInfo.js";import{DrapedVisualElementResources as O}from"./DrapedVisualElementResources.js";import{LaserlineVisualElement as w}from"./LaserlineVisualElement.js";import{VisualElementResources as C}from"./VisualElementResources.js";import{ElevationContext as b}from"../../layers/graphics/ElevationContext.js";import{geometryToRenderInfoDraped as R,RemoveDuplicateStartEnd as E,createGeometry as D,geometryToRenderInfo as P}from"../../layers/graphics/lineUtils.js";import{computeAttachmentOriginLines as j}from"../../webgl-engine/lib/geometryDataUtils.js";import{RenderOccludedFlag as I}from"../../webgl-engine/lib/Material.js";import{RenderGeometry as A}from"../../webgl-engine/lib/RenderGeometry.js";import{VertexAttribute as G}from"../../webgl-engine/lib/VertexAttribute.js";import{RibbonLineMaterial as M}from"../../webgl-engine/materials/RibbonLineMaterial.js";class S{constructor(t){this.view=null,this._attachmentOrigin=g(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=I.OccludeAndTransparentStencil,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 O({view:t.view,createResources:()=>this._createDrapedResources(),recreateGeometry:e=>{e.geometries=this._createRenderGeometriesDraped(e.material),this._attachmentOriginChanged()}});let r=!0;this._laserline=new w({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(V,0,0,0);let s=0;for(const t of e){const e=t.vertexAttributes.get(G.POSITION),i=t.indices.get(G.POSITION),n=r(this.resources.resources).material.isClosed(e.data,i);j(e,i,n,W)&&(a(V,V,W),s++)}return 0===s?null:(n(V,V,1/s),this.view.renderCoordsHelper.fromRenderCoords(V,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,stipplePreferContinuous:!1,isClosed:this.isClosed,falloff:this._falloff,innerColor:this._innerColor,innerWidth:this._innerWidth,join:"round",polygonOffset:!0,renderOccluded:this.normalizedRenderOccluded}}get normalizedRenderOccluded(){return this.isDraped&&this._renderOccluded===I.OccludeAndTransparentStencil?I.OccludeAndTransparent: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 M(this.materialParameters),r=[];return this._recreateGeometry(e,t,r),{material:t,geometries:r,forEach:e=>{e(t),r.forEach(e)}}}_createDrapedResources(){const e=new M(this.materialParameters);return{material:e,geometries:this._createRenderGeometriesDraped(e)}}_createRenderGeometriesDraped(e){const t=this.geometry;if(s(t))return[];const r=R(t,this.view.basemapTerrain.spatialReference),i=[];for(const{position:s}of r.lines){const t={overlayInfo:{spatialReference:this.view.basemapTerrain.spatialReference,renderCoordsHelper:this.view.renderCoordsHelper},attributeData:{position:s},removeDuplicateStartEnd:this.isClosed?E.REMOVE:E.KEEP},r=new A(D(t),e),a=f(T);_(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(G.POSITION),i=new Float64Array(s.data.length);p(s.data,t.spatialReference,0,i,this.view.spatialReference,0,s.data.length/3),_(e,i)}return!0}_createRenderGeometries(){var e;const t=this.geometry;if(s(t))return[];const r=P(t,this.view.elevationProvider,this.view.renderCoordsHelper,b.fromElevationInfo(null!=(e=this.elevationInfo)?e:new v({mode:y(t,null)}))),i=[],a=[];for(const{position:s,mapPosition:n}of r.lines){const e={overlayInfo:null,attributeData:{position:s,mapPosition:n},removeDuplicateStartEnd:this.isClosed?E.REMOVE:E.KEEP};i.push(D(e)),a.push(s)}return this._laserline.pathVerticalPlane=a,i}}const T=m(),W=o(),V=o();export{S 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.23/esri/copyright.txt for details.
4
4
  */
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{i as o,f as a,g as c,s as n,m as h}from"../../../../chunks/vec2.js";import{k as l,g as d,n as m,f as u,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 b}from"../../../../chunks/vec4f32.js";import{Object3DVisualElement as j}from"./Object3DVisualElement.js";import{VertexAttribute as w}from"../../webgl-engine/lib/basicInterfaces.js";import x from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as G}from"../../webgl-engine/lib/Material.js";import{RibbonLineMaterial as O}from"../../webgl-engine/materials/RibbonLineMaterial.js";class R extends j{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=b(1,0,1,1),this._renderOccluded=G.OccludeAndTransparent,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){m(this._direction,u(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 O(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,v),_(P,this.location,this.direction),t.projectToScreen(P,M),o(M,a(M,M,v)),this._updateVertexAttributes(t,e,0,v,M,1),this._updateVertexAttributes(t,e,1,v,M,-1)}_updateVertexAttributes(e,t,r,s,i,o){const a=t.geometryRecords[r],l=a.geometry.getMutableAttribute(w.POSITION).data,d=c(V,n(V,i[1]*o,i[0]*-o),this.offset+this.width/2),m=h(A,h(A,h(A,s,c(A,i,this.length/2)),d),d),u=h(k,m,c(k,i,-this.length));e.unprojectFromScreen(m,P),l[0]=P[0],l[1]=P[1],l[2]=P[2],e.unprojectFromScreen(u,P),l[3]=P[0],l[4]=P[1],l[5]=P[2],t.geometryVertexAttrsUpdated(a)}}const P=p(),v=i(),M=i(),V=i(),A=i(),k=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{i as o,f as a,g as c,s as n,m as h}from"../../../../chunks/vec2.js";import{k as l,g as d,n as m,f as u,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 b}from"../../../../chunks/vec4f32.js";import{Object3DVisualElement as j}from"./Object3DVisualElement.js";import w from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as x}from"../../webgl-engine/lib/Material.js";import{VertexAttribute as G}from"../../webgl-engine/lib/VertexAttribute.js";import{RibbonLineMaterial as O}from"../../webgl-engine/materials/RibbonLineMaterial.js";class R extends j{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=b(1,0,1,1),this._renderOccluded=x.OccludeAndTransparent,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){m(this._direction,u(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 O(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=w.createPolylineGeometry([p(),p()]),s=w.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,V),_(P,this.location,this.direction),t.projectToScreen(P,v),o(v,a(v,v,V)),this._updateVertexAttributes(t,e,0,V,v,1),this._updateVertexAttributes(t,e,1,V,v,-1)}_updateVertexAttributes(e,t,r,s,i,o){const a=t.geometryRecords[r],l=a.geometry.getMutableAttribute(G.POSITION).data,d=c(A,n(A,i[1]*o,i[0]*-o),this.offset+this.width/2),m=h(M,h(M,h(M,s,c(M,i,this.length/2)),d),d),u=h(k,m,c(k,i,-this.length));e.unprojectFromScreen(m,P),l[0]=P[0],l[1]=P[1],l[2]=P[2],e.unprojectFromScreen(u,P),l[3]=P[0],l[4]=P[1],l[5]=P[2],t.geometryVertexAttrsUpdated(a)}}const P=p(),V=i(),v=i(),A=i(),M=i(),k=i();export{R 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.23/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 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{VertexAttribute as _}from"../../webgl-engine/lib/basicInterfaces.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";import{TextureWrapMode as S}from"../../../webgl/enums.js";class b{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:z,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/x}_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*x),{mipmap:!1,wrap:{s:S.CLAMP_TO_EDGE,t:S.CLAMP_TO_EDGE},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,j,this.view.spatialReference),u(e,j),!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 x=.5,z=[x/2,x/2,1-x/2,1-x/2],j=o();export{b 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 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 _ from"../../webgl-engine/lib/GeometryUtil.js";import{Texture as f}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as y}from"../../webgl-engine/lib/VertexAttribute.js";import{HUDMaterial as v}from"../../webgl-engine/materials/HUDMaterial.js";import{TextureWrapMode as S}from"../../../webgl/enums.js";class b{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(y.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:z,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/x}_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 f(d(this._primitive,e,e*x),{mipmap:!1,wrap:{s:S.CLAMP_TO_EDGE,t:S.CLAMP_TO_EDGE},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(y.POSITION);return u(t.data,this.view.renderCoordsHelper.spatialReference,j,this.view.spatialReference),c(e,j),!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 _.createPointGeometry(null,a,null,[l,l],[0,0,0,1])}}const x=.5,z=[x/2,x/2,1-x/2,1-x/2],j=o();export{b 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.23/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Handles.js";import{isSome as t}from"../../../../core/maybe.js";import{f as i,h as r}from"../../../../chunks/mat4.js";import{c as s}from"../../../../chunks/mat4f64.js";import{i as a,n as o,f as l,g as n,b as u}from"../../../../chunks/vec3.js";import{c as h}from"../../../../chunks/vec3f64.js";import{c}from"../../../../chunks/vec4.js";import{f as d}from"../../../../chunks/vec4f32.js";import{sv3d as _}from"../../../../geometry/support/vectorStacks.js";import{Object3DVisualElement as m}from"./Object3DVisualElement.js";import{VertexAttribute as p}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as M}from"../../webgl-engine/lib/Geometry.js";import f from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as g}from"../../webgl-engine/lib/Material.js";import{ColorMaterial as O}from"../../webgl-engine/materials/ColorMaterial.js";import{RibbonLineMaterial as y}from"../../webgl-engine/materials/RibbonLineMaterial.js";class z extends m{constructor(t){super(t),this._handles=new e,this._quadMaterial=null,this._outlineMaterial=null,this._maxSize=0,this._position=h(),this._up=h(),this._right=h(),this._renderOccluded=g.OccludeAndTransparent,this._color=d(1,0,0,1),this._outlineColor=d(0,0,0,1),this._outlineSize=0,this._size=32,this._outlineRenderOccluded=g.Opaque,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(a(t,e),a(t,i))/3,o(this._up,l(this._up,e,t)),o(this._right,l(this._right,i,t)),n(this._position,t),this.recreateGeometry()}createExternalResources(){this._quadMaterial=new O(this.quadMaterialParameters),this._outlineMaterial=new y(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=u(_.get(),this._up,this._right),i=f.createPolylineGeometry([this._up,t,this._right]);e.addGeometry(i,this._outlineMaterial)}_updateTransform(e=this.object){const s=this.view.state.camera,a=this._size*s.computeScreenPixelSizeAt(this._position),o=Math.min(this._maxSize,a);i(j,this._position),r(j,j,[o,o,o]),t(e)&&(e.transformation=j)}_quadGeometryData(e,t){const i=u(_.get(),e,t);return new M([[p.POSITION,{size:3,data:[0,0,0,...t,...e,...i],exclusive:!0}]],[[p.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 j=s();export{z as RightAngleQuadVisualElement};
5
+ import e from"../../../../core/Handles.js";import{isSome as t}from"../../../../core/maybe.js";import{f as i,h as r}from"../../../../chunks/mat4.js";import{c as s}from"../../../../chunks/mat4f64.js";import{i as a,n as o,f as l,g as n,b as u}from"../../../../chunks/vec3.js";import{c as h}from"../../../../chunks/vec3f64.js";import{c as d}from"../../../../chunks/vec4.js";import{f as c}from"../../../../chunks/vec4f32.js";import{sv3d as _}from"../../../../geometry/support/vectorStacks.js";import{Object3DVisualElement as m}from"./Object3DVisualElement.js";import{Geometry as p}from"../../webgl-engine/lib/Geometry.js";import M from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as g}from"../../webgl-engine/lib/Material.js";import{VertexAttribute as f}from"../../webgl-engine/lib/VertexAttribute.js";import{ColorMaterial as O}from"../../webgl-engine/materials/ColorMaterial.js";import{RibbonLineMaterial as y}from"../../webgl-engine/materials/RibbonLineMaterial.js";class z extends m{constructor(t){super(t),this._handles=new e,this._quadMaterial=null,this._outlineMaterial=null,this._maxSize=0,this._position=h(),this._up=h(),this._right=h(),this._renderOccluded=g.OccludeAndTransparent,this._color=c(1,0,0,1),this._outlineColor=c(0,0,0,1),this._outlineSize=0,this._size=32,this._outlineRenderOccluded=g.Opaque,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){d(this._color,e),this._updateQuadMaterial()}get outlineColor(){return this._outlineColor}set outlineColor(e){d(this._outlineColor,e),this._updateOutlineMaterial()}get outlineSize(){return this._outlineSize}set outlineSize(e){const t=0===this._outlineSize!=(0===e);this._outlineSize=e,t?this.recreateGeometry():this._updateOutlineMaterial()}get size(){return this._size}set size(e){e!==this._size&&(this._size=e,this._updateTransform())}get outlineRenderOccluded(){return this._outlineRenderOccluded}set outlineRenderOccluded(e){this._outlineRenderOccluded=e,this._updateOutlineMaterial()}set geometry({previous:e,center:t,next:i}){this._maxSize=Math.min(a(t,e),a(t,i))/3,o(this._up,l(this._up,e,t)),o(this._right,l(this._right,i,t)),n(this._position,t),this.recreateGeometry()}createExternalResources(){this._quadMaterial=new O(this.quadMaterialParameters),this._outlineMaterial=new y(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=u(_.get(),this._up,this._right),i=M.createPolylineGeometry([this._up,t,this._right]);e.addGeometry(i,this._outlineMaterial)}_updateTransform(e=this.object){const s=this.view.state.camera,a=this._size*s.computeScreenPixelSizeAt(this._position),o=Math.min(this._maxSize,a);i(j,this._position),r(j,j,[o,o,o]),t(e)&&(e.transformation=j)}_quadGeometryData(e,t){const i=u(_.get(),e,t);return new p([[f.POSITION,{size:3,data:[0,0,0,...t,...e,...i],exclusive:!0}]],[[f.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 j=s();export{z 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.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Error.js";import{destroyMaybe as t,isSome as s}from"../../../core/maybe.js";import{initial as o,watch as i,when as a,syncAndInitial as l}from"../../../core/reactiveUtils.js";import{property as u}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{hydrateGeometry as p}from"../../../layers/graphics/hydratedFeatures.js";import{FeatureTileController3D as c}from"../../../layers/graphics/controllers/FeatureTileController3D.js";import{FeatureLikeLayerView3D as m}from"./FeatureLikeLayerView3D.js";import{LayerView3D as h}from"./LayerView3D.js";import{FeatureTileFetcher3DLayerViewContext as d}from"./support/FeatureTileFetcher3DLayerViewContext.js";import{EventedSet as y}from"../support/EventedSet.js";import{updatingProgress as f}from"../support/updatingProperties.js";import{UpdatePolicy as g}from"../webgl-engine/lib/basicInterfaces.js";import{FeatureLayerView as F}from"../../layers/FeatureLayerView.js";import b from"../../layers/LayerView.js";import{RefreshableLayerView as v}from"../../layers/RefreshableLayerView.js";let x=class extends(v(m(F(h(b))))){constructor(e){super(e),this._controllerTotal=0,this._graphicsCoreTotal=0,this.suspendResumeExtentMode="data"}initialize(){this.updatingHandles.add((()=>this.view.floors),(()=>this.processor.filterVisibility.filterChanged()))}destroy(){this.fetcherContext=t(this.fetcherContext)}get maximumNumberOfFeatures(){var e,r;return null!=(e=null==(r=this.controller)?void 0:r.maximumNumberOfFeatures)?e:this._get("maximumNumberOfFeatures")}set maximumNumberOfFeatures(e){this._set("maximumNumberOfFeatures",e),this.controller&&(this.controller.maximumNumberOfFeatures=e)}get maximumNumberOfFeaturesExceeded(){return!!this.controller&&!(this.suspended||!this.controller.maximumNumberOfFeaturesExceeded)}get updatingProgressValue(){var e,r,t;let s=0;if(null!=(e=this.controller)&&e.updating){const e=this.controller.updatingRemaining,r=Math.max(this.controller.updatingTotal,this._controllerTotal);r>0&&(s=(r-e)/r,this._controllerTotal=r)}let o=0;if(null!=(r=this.processor)&&null!=(t=r.graphicsCore)&&t.updating){const e=this.processor.graphicsCore.updatingRemaining,r=Math.max(e,this._graphicsCoreTotal);r>0&&(o=(r-e)/r,this._graphicsCoreTotal=r)}return.5*(s+o)}get updatePolicy(){if(!this.controller)return g.ASYNC;switch(this.controller.mode){case"snapshot":{const e=C[this.layer.geometryType];return null==e||this.controller.serviceDataCount>e?g.ASYNC:g.SYNC}case"tiles":return g.ASYNC}}get hasZ(){const e=this.layer,r=e.capabilities&&e.capabilities.data;return!(!r||!r.supportsZ)&&("returnZ"in e&&null!=e.returnZ?e.returnZ:r.supportsZ)}get hasM(){const e=this.layer,r=e.capabilities&&e.capabilities.data;return!(!r||!r.supportsM)&&("returnM"in e&&null!=e.returnM&&e.returnM)}setVisibility(e,r){var t;null==(t=this.processor)||t.graphicsCore.setObjectIdVisibility(e,r)}createQuery(){return super.createQuery()}queryFeatures(e,r){const t=()=>super.queryFeatures(e,r);return"mesh"===this.layer.geometryType?this._queryFeaturesMesh(this._ensureQuery(e),t):t()}beforeSetController(e){e.maximumNumberOfFeatures=this.maximumNumberOfFeatures}createController(){this.fetcherContext=new d({layerView:this,returnZ:this.hasZ,returnM:this.hasM});const e=new c({layerView:this,context:this.fetcherContext,graphics:new y,extent:this.clippingExtent});return this.updatingHandles.add((()=>e.serviceDataExtent),(e=>{this.processor&&(this.processor.dataExtent=e)}),o),this.handles.add(i((()=>this.suspended),(r=>{r?e.suspend():e.resume()}),l)),this.updatingHandles.add((()=>{var e,r;return null==(e=this.processor)||null==(r=e.graphicsCore)?void 0:r.displayFeatureLimit}),(()=>this._updateDisplayFeatureLimit(e)),o),this.handles.add([this.view.resourceController.memoryController.events.on("quality-changed",(()=>this._updateDisplayFeatureLimit())),a((()=>!this.updating),(()=>{this._controllerTotal=0,this._graphicsCoreTotal=0,this.notifyChange("updatingProgressValue")}))]),e}async doRefresh(e){e&&!this.suspended&&this.controller&&this.controller.refetch(),this.processor.filterVisibility.dirty=!0}getUsedMemory(){var e,r,t,s;const o=null==(e=this.processor)?void 0:e.graphicsCore;return(null!=(r=null==o?void 0:o.usedMemory)?r:0)+(null!=(t=null==(s=this.controller)?void 0:s.memoryForUnusedFeatures)?t:0)}getUnloadedMemory(){var e,r,t,s;const o=null==(e=this.processor)?void 0:e.graphicsCore;return(null!=(r=null==o?void 0:o.unprocessedMemoryEstimate)?r:0)+(null!=(t=(null==(s=this.controller)?void 0:s.expectedFeatureDiff)*(null==o?void 0:o.usedMemoryPerGraphic))?t:0)}ignoresMemoryFactor(){var e;return null==(e=this.controller)?void 0:e.hasMaximumNumberOfFeaturesOverride}_updateDisplayFeatureLimit(e=this.controller){var r;if(!e||null==(r=this.processor)||!r.graphicsCore)return;const t=this.processor.graphicsCore.displayFeatureLimit,s=this.view.resourceController.memoryController.memoryFactor;if(1===s)e.displayFeatureLimit=t;else{const r=Math.ceil(t.maximumNumberOfFeatures*s),o=Math.ceil(t.maximumTotalNumberOfFeatures*s),i=Math.ceil(t.minimumTotalNumberOfFeatures*s);e.displayFeatureLimit={...t,maximumNumberOfFeatures:r,maximumTotalNumberOfFeatures:o,minimumTotalNumberOfFeatures:i}}}async _queryFeaturesMesh(e,r){await this._validateQueryFeaturesMesh(e);const t=await r();if(e&&e.outStatistics)return t;const s=this.layer.objectIdField,o=this.processor.graphicsCore.graphics3DGraphicsByObjectID,i=[];for(const a of t.features)if(a.geometry){const e=o.get(a.attributes[s]);e&&(a.geometry=p(e.graphic.geometry),i.push(a))}else i.push(a);return t.features=i,t}async _validateQueryFeaturesMesh(e){if(!e)return;const t=e=>{throw new r("feature-layer-view:unsupported-query",`Queries on Mesh feature collection layers do not support '${e}'`)},o=["quantizationParameters","geometryPrecision","maxAllowableOffset"];for(const r of o)null!=e[r]&&t(r);"returnM"in e&&e.returnM&&t("returnM"),"returnCentroid"in e&&e.returnCentroid&&t("returnCentroid"),s(e.outSpatialReference)&&!e.outSpatialReference.equals(this.view.spatialReference)&&t("outSpatialReference")}get performanceInfo(){var e,r,t,o,i;const a=null==(e=this.controller)?void 0:e.displayFeatureLimit,l=s(a)&&a.averageSymbolComplexity,u=s(l)?`f:${l.primitivesPerFeature},v:${l.primitivesPerCoordinate}`:"n/a",n={...this._getResourceInfo(),storedFeatures:0,totalVertices:0,partial:this.maximumNumberOfFeaturesExceeded,mode:null!=(r=null==(t=this.controller)?void 0:t.mode)?r:"n/a",symbolComplexity:u,nodes:null!=(o=null==(i=this.controller)?void 0:i.tileDescriptors.length)?o:0};if(this.controller&&n.displayedNumberOfFeatures){const e=this.controller.debug;n.storedFeatures=e.storedFeatures,n.totalVertices=e.totalVertices}return n}get test(){return{updatePolicy:this.updatePolicy,controller:this.controller}}};e([u()],x.prototype,"layer",void 0),e([u()],x.prototype,"controller",void 0),e([u()],x.prototype,"maximumNumberOfFeatures",null),e([u()],x.prototype,"maximumNumberOfFeaturesExceeded",null),e([u(f)],x.prototype,"updatingProgress",void 0),e([u({readOnly:!0,dependsOn:["controller.updatingRemaining","controller.updatingTotal","processor.graphicsCore.updatingRemaining"]})],x.prototype,"updatingProgressValue",null),e([u({readOnly:!0})],x.prototype,"updatePolicy",null),e([u({readOnly:!0})],x.prototype,"hasZ",null),e([u({readOnly:!0})],x.prototype,"hasM",null),e([u()],x.prototype,"suspendResumeExtentMode",void 0),x=e([n("esri.views.3d.layers.FeatureLayerViewBase3D")],x);const C={point:5e3,polygon:500,polyline:1e3},M=x;export{M as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Error.js";import{destroyMaybe as t,isNone as s,isSome as o}from"../../../core/maybe.js";import{initial as i,watch as a,when as l,syncAndInitial as u}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as m}from"../../../core/accessorSupport/decorators/subclass.js";import{hydrateGeometry as p}from"../../../layers/graphics/hydratedFeatures.js";import{FeatureTileController3D as c}from"../../../layers/graphics/controllers/FeatureTileController3D.js";import{FeatureLikeLayerView3D as h}from"./FeatureLikeLayerView3D.js";import{LayerView3D as d}from"./LayerView3D.js";import{FeatureTileFetcher3DLayerViewContext as y}from"./support/FeatureTileFetcher3DLayerViewContext.js";import{EventedSet as f}from"../support/EventedSet.js";import{updatingProgress as g}from"../support/updatingProperties.js";import{UpdatePolicy as F}from"../webgl-engine/lib/basicInterfaces.js";import{FeatureLayerView as b}from"../../layers/FeatureLayerView.js";import v from"../../layers/LayerView.js";import{RefreshableLayerView as x}from"../../layers/RefreshableLayerView.js";let M=class extends(x(h(b(d(v))))){constructor(e){super(e),this._controllerTotal=0,this._processorTotal=0,this.suspendResumeExtentMode="data"}initialize(){this.updatingHandles.add((()=>this.view.floors),(()=>this.processor.filterVisibility.filterChanged()))}destroy(){this.updatingHandles.removeAll(),this.handles.removeAll(),this.fetcherContext=t(this.fetcherContext)}get maximumNumberOfFeatures(){var e,r;return null!=(e=null==(r=this.controller)?void 0:r.maximumNumberOfFeatures)?e:this._get("maximumNumberOfFeatures")}set maximumNumberOfFeatures(e){this._set("maximumNumberOfFeatures",e),this.controller&&(this.controller.maximumNumberOfFeatures=e)}get maximumNumberOfFeaturesExceeded(){return!!this.controller&&!(this.suspended||!this.controller.maximumNumberOfFeaturesExceeded)}get updatingProgressValue(){var e,r;let t=0;if(null!=(e=this.controller)&&e.updating){const e=this.controller.updatingRemaining,r=Math.max(this.controller.updatingTotal,this._controllerTotal);r>0&&(t=(r-e)/r,this._controllerTotal=r)}let s=0;if(null!=(r=this.processor)&&r.updating){const e=this.processor.updatingRemaining,r=Math.max(e,this._processorTotal);r>0&&(s=(r-e)/r,this._processorTotal=r)}return.5*(t+s)}get updatePolicy(){if(!this.controller)return F.ASYNC;switch(this.controller.mode){case"snapshot":{const e=O[this.layer.geometryType];return null==e||this.controller.serviceDataCount>e?F.ASYNC:F.SYNC}case"tiles":return F.ASYNC}}get hasZ(){const e=this.layer,r=e.capabilities&&e.capabilities.data;return!(!r||!r.supportsZ)&&("returnZ"in e&&null!=e.returnZ?e.returnZ:r.supportsZ)}get hasM(){const e=this.layer,r=e.capabilities&&e.capabilities.data;return!(!r||!r.supportsM)&&("returnM"in e&&null!=e.returnM&&e.returnM)}setVisibility(e,r){var t;null==(t=this.processor)||t.setObjectIdVisibility(e,r)}createQuery(){return super.createQuery()}queryFeatures(e,r){const t=()=>super.queryFeatures(e,r);return"mesh"===this.layer.geometryType?this._queryFeaturesMesh(this._ensureQuery(e),t):t()}beforeSetController(e){e.maximumNumberOfFeatures=this.maximumNumberOfFeatures}createController(){this.fetcherContext=new y({layerView:this,returnZ:this.hasZ,returnM:this.hasM});const e=new c({layerView:this,context:this.fetcherContext,graphics:new f,extent:this.clippingExtent});return this.updatingHandles.add((()=>e.serviceDataExtent),(e=>{this.processor&&(this.processor.dataExtent=e)}),i),this.handles.add(a((()=>this.suspended),(r=>{r?e.suspend():e.resume()}),u)),this.updatingHandles.add((()=>{var e;return null==(e=this.processor)?void 0:e.displayFeatureLimit}),(()=>this._updateDisplayFeatureLimit(e)),i),this.handles.add([this.view.resourceController.memoryController.events.on("quality-changed",(()=>this._updateDisplayFeatureLimit())),l((()=>!this.updating),(()=>{this._controllerTotal=0,this._processorTotal=0}))]),e}async doRefresh(e){e&&!this.suspended&&this.controller&&this.controller.refetch(),this.processor.filterVisibility.dirty=!0}getUsedMemory(){var e,r,t,s;return(null!=(e=null==(r=this.processor)?void 0:r.usedMemory)?e:0)+(null!=(t=null==(s=this.controller)?void 0:s.memoryForUnusedFeatures)?t:0)}getUnloadedMemory(){var e,r,t,s,o;return(null!=(e=null==(r=this.processor)?void 0:r.unprocessedMemoryEstimate)?e:0)+(null!=(t=(null==(s=this.controller)?void 0:s.expectedFeatureDiff)*(null==(o=this.processor)?void 0:o.usedMemoryPerFeature))?t:0)}ignoresMemoryFactor(){var e;return null==(e=this.controller)?void 0:e.hasMaximumNumberOfFeaturesOverride}_updateDisplayFeatureLimit(e=this.controller){if(!e||!this.processor)return;const r=this.processor.displayFeatureLimit,t=this.view.resourceController.memoryController.memoryFactor;if(1===t)e.displayFeatureLimit=r;else{const s=Math.ceil(r.maximumNumberOfFeatures*t),o=Math.ceil(r.maximumTotalNumberOfFeatures*t),i=Math.ceil(r.minimumTotalNumberOfFeatures*t);e.displayFeatureLimit={...r,maximumNumberOfFeatures:s,maximumTotalNumberOfFeatures:o,minimumTotalNumberOfFeatures:i}}}async _queryFeaturesMesh(e,r){await this._validateQueryFeaturesMesh(e);const t=await r();if(e&&e.outStatistics||s(this.graphics3DProcessor))return t;const o=this.layer.objectIdField,i=this.graphics3DProcessor.graphics3DGraphicsByObjectID,a=[];for(const s of t.features)if(s.geometry){const e=i.get(s.attributes[o]);e&&(s.geometry=p(e.graphic.geometry),a.push(s))}else a.push(s);return t.features=a,t}async _validateQueryFeaturesMesh(e){if(!e)return;const t=e=>{throw new r("feature-layer-view:unsupported-query",`Queries on Mesh feature collection layers do not support '${e}'`)},s=["quantizationParameters","geometryPrecision","maxAllowableOffset"];for(const r of s)null!=e[r]&&t(r);"returnM"in e&&e.returnM&&t("returnM"),"returnCentroid"in e&&e.returnCentroid&&t("returnCentroid"),o(e.outSpatialReference)&&!e.outSpatialReference.equals(this.view.spatialReference)&&t("outSpatialReference")}get performanceInfo(){var e,r,t,s,i;const a=null==(e=this.controller)?void 0:e.displayFeatureLimit,l=o(a)&&a.averageSymbolComplexity,u=o(l)?`f:${l.primitivesPerFeature},v:${l.primitivesPerCoordinate}`:"n/a",n={...this._getResourceInfo(),storedFeatures:0,totalVertices:0,partial:this.maximumNumberOfFeaturesExceeded,mode:null!=(r=null==(t=this.controller)?void 0:t.mode)?r:"n/a",symbolComplexity:u,nodes:null!=(s=null==(i=this.controller)?void 0:i.tileDescriptors.length)?s:0};if(this.controller&&n.displayedNumberOfFeatures){const e=this.controller.debug;n.storedFeatures=e.storedFeatures,n.totalVertices=e.totalVertices}return n}get test(){return{updatePolicy:this.updatePolicy,controller:this.controller}}};e([n()],M.prototype,"layer",void 0),e([n()],M.prototype,"controller",void 0),e([n()],M.prototype,"_controllerTotal",void 0),e([n()],M.prototype,"_processorTotal",void 0),e([n()],M.prototype,"maximumNumberOfFeatures",null),e([n()],M.prototype,"maximumNumberOfFeaturesExceeded",null),e([n(g)],M.prototype,"updatingProgress",void 0),e([n({readOnly:!0})],M.prototype,"updatingProgressValue",null),e([n({readOnly:!0})],M.prototype,"updatePolicy",null),e([n({readOnly:!0})],M.prototype,"hasZ",null),e([n({readOnly:!0})],M.prototype,"hasM",null),e([n()],M.prototype,"suspendResumeExtentMode",void 0),M=e([m("esri.views.3d.layers.FeatureLayerViewBase3D")],M);const O={point:5e3,polygon:500,polyline:1e3},w=M;export{w as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{destroyMaybe as r,get as s,isNone as i}from"../../../core/maybe.js";import{whenOnce as o}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{hydrateGraphic as a}from"../../../layers/graphics/hydratedFeatures.js";import{FeatureTileController3D as u}from"../../../layers/graphics/controllers/FeatureTileController3D.js";import p from"../../../rest/support/Query.js";import{DrapeSourceType as c}from"./interfaces.js";import d from"./graphics/Graphics3DFeatureProcessor.js";import h from"./graphics/QueryEngine.js";import{toViewIfLocal as y}from"./support/projectExtentUtils.js";import{UpdatePolicy as m}from"../webgl-engine/lib/basicInterfaces.js";import{TaskPriority as g}from"../../support/Scheduler.js";const f=f=>{let E=class extends f{constructor(){super(...arguments),this.controller=null,this.updatePolicy=m.SYNC,this.suspendResumeExtentMode="computed",this.slicePlaneEnabled=!1,this.drapeSourceType=c.Features,this.fullExtentInLocalViewSpatialReference=null,this.suspendResumeExtent=null,this._controllerCreated=!1,this.clippingExtent=null,this.supportsHeightUnitConversion=!0,this.pendingController=null,this.queryEngine=null}initialize(){const e=this.layer;if("isTable"in e&&e.isTable)return void this.addResolvingPromise(Promise.reject(new t("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e})));this.addResolvingPromise(this._validateGeometryType());const r=new d({owner:this,frustumVisibilityEnabled:!0,scaleVisibilityEnabled:!0,filterVisibilityEnabled:!0,timeExtentVisibilityEnabled:!0,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!0,preferredUpdatePolicy:this.updatePolicy,updateClippingExtent:e=>this._updateClippingExtent(e)});this._set("processor",r),this.addResolvingPromise((async()=>{await r.setup(),this.queryEngine=new h({layerView:this,priority:g.FEATURE_QUERY_ENGINE})})()),this.addResolvingPromise((async()=>{const e=await y(this);this.fullExtentInLocalViewSpatialReference=e,await this._initializeController()})()),this.updatingHandles.add((()=>this.updatePolicy),(e=>this.processor.preferredUpdatePolicy=e)),this.notifyChange("updating")}destroy(){this._destroyPendingController(),this.controller=r(this.controller),this._set("processor",r(this.processor)),this.queryEngine=r(this.queryEngine),this.loadedGraphics=null}_destroyPendingController(){this.pendingController=r(this.pendingController)}get legendEnabled(){var e,t;return this.canResume()&&!(null!=(e=this.processor)&&null!=(t=e.frustumVisibility)&&t.suspended)}getGraphicFromGraphicUid(e){var t;let r=null;return null==(t=this.loadedGraphics)||t.forEach((t=>{t.uid===e&&(r=a(t,this.layer))})),r}whenGraphicBounds(e,t){var r;return null==(r=this.processor)?void 0:r.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){var r;return null==(r=this.processor)?void 0:r.computeAttachmentOrigin(e,t)}queryFeatures(e,t){return this.queryEngine.executeQuery(this._ensureQuery(e),s(t,"signal"))}queryObjectIds(e,t){return this.queryEngine.executeQueryForIds(this._ensureQuery(e),s(t,"signal"))}queryFeatureCount(e,t){return this.queryEngine.executeQueryForCount(this._ensureQuery(e),s(t,"signal"))}queryExtent(e,t){return this.queryEngine.executeQueryForExtent(this._ensureQuery(e),s(t,"signal"))}_ensureQuery(e){return i(e)?this.createQuery():p.from(e)}highlight(e){return this.processor.highlight(e,this.layer.objectIdField)}maskOccludee(e){return this.processor.maskOccludee(e)}canResume(){var e;return super.canResume()&&!(null!=(e=this.processor)&&e.scaleVisibilitySuspended)}getSuspendInfo(){const e=super.getSuspendInfo();return this.processor?{...e,...this.processor.suspendInfo}:e}isUpdating(){var e,t,r;return!(!this.processor||this.processor.destroyed)&&!(this._controllerCreated&&(null==(e=this.controller)||!e.updating)&&null!=(t=this.view)&&null!=(r=t.basemapTerrain)&&r.ready&&!this.processor.updating)}async _initializeController(){const e=this.createController();this.pendingController=e,await e.when(),this._setControllerWhenInitialized(e)}async _setControllerWhenInitialized(e){try{await this.when()}catch(t){}this._controllerCreated=!0,this.notifyChange("updating"),this.isResolved()&&!this.destroyed?(await o((()=>{var e,t;return null==(e=this.view)||null==(t=e.basemapTerrain)?void 0:t.ready})),this.beforeSetController(e),this.pendingController=null,this.controller=e,this.loadedGraphics=e.graphics,this.notifyChange("updating")):this._destroyPendingController()}_updateClippingExtent(e){if(this.clippingExtent=e,!this.controller)return!1;switch(this.controller.type){case"stream":return!1;case"feature-tile-3d":return this.controller.extent=e,!0}}async _validateGeometryType(){switch(this.layer.geometryType){case"multipatch":case"multipoint":return Promise.reject(new t("featurelayerview3d:unsupported-geometry-type","Unsupported geometry type ${geometryType}",{geometryType:this.layer.geometryType}))}}_getResourceInfo(){var e,t;const r=this.controller instanceof u?this.controller:null;return{displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:null!=(e=null==r?void 0:r.maximumNumberOfFeatures)?e:-1,totalNumberOfFeatures:null!=(t=null==r?void 0:r.serviceDataCount)?t:-1,nodes:0,...this.processor.performanceInfo}}get performanceInfo(){return this._getResourceInfo()}};return e([n()],E.prototype,"loadedGraphics",void 0),e([n()],E.prototype,"suspended",void 0),e([n({readOnly:!0})],E.prototype,"legendEnabled",null),e([n()],E.prototype,"updating",void 0),e([n()],E.prototype,"controller",void 0),e([n()],E.prototype,"processor",void 0),e([n({readOnly:!0})],E.prototype,"updatePolicy",void 0),e([n({readOnly:!0})],E.prototype,"suspendResumeExtentMode",void 0),e([n({type:Boolean})],E.prototype,"slicePlaneEnabled",void 0),e([n({readOnly:!0})],E.prototype,"suspendInfo",void 0),E=e([l("esri.views.3d.layers.FeatureLikeLayerView3D")],E),E};export{f as FeatureLikeLayerView3D};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Error.js";import{destroyMaybe as t,get as s,isNone as i}from"../../../core/maybe.js";import{whenOnce as o}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{hydrateGraphic as a}from"../../../layers/graphics/hydratedFeatures.js";import{FeatureTileController3D as p}from"../../../layers/graphics/controllers/FeatureTileController3D.js";import u from"../../../rest/support/Query.js";import{DrapeSourceType as c}from"./interfaces.js";import h from"./graphics/Graphics3DFeatureProcessor.js";import d from"./graphics/QueryEngine.js";import{toViewIfLocal as y}from"./support/projectExtentUtils.js";import{UpdatePolicy as m}from"../webgl-engine/lib/basicInterfaces.js";import{TaskPriority as g}from"../../support/Scheduler.js";const f=f=>{let v=class extends f{constructor(){super(...arguments),this.controller=null,this.updatePolicy=m.SYNC,this.suspendResumeExtentMode="computed",this.slicePlaneEnabled=!1,this.drapeSourceType=c.Features,this.fullExtentInLocalViewSpatialReference=null,this.suspendResumeExtent=null,this._controllerCreated=!1,this.clippingExtent=null,this.supportsHeightUnitConversion=!0,this.pendingController=null,this.queryEngine=null}initialize(){const e=this.layer;if("isTable"in e&&e.isTable)return void this.addResolvingPromise(Promise.reject(new r("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e})));this.addResolvingPromise(this._validateGeometryType());const t=new h({owner:this,frustumVisibilityEnabled:!0,scaleVisibilityEnabled:!0,filterVisibilityEnabled:!0,timeExtentVisibilityEnabled:!0,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!0,preferredUpdatePolicy:this.updatePolicy,updateClippingExtent:e=>this._updateClippingExtent(e)});this._set("processor",t),this.addResolvingPromise((async()=>{await t.setup(),this.queryEngine=new d({layerView:this,priority:g.FEATURE_QUERY_ENGINE})})()),this.addResolvingPromise((async()=>{const e=await y(this);this.fullExtentInLocalViewSpatialReference=e,await this._initializeController()})()),this.updatingHandles.add((()=>this.updatePolicy),(e=>this.processor.preferredUpdatePolicy=e)),this.notifyChange("updating")}destroy(){this._destroyPendingController(),this.controller=t(this.controller),this._set("processor",t(this.processor)),this.queryEngine=t(this.queryEngine),this.loadedGraphics=null}_destroyPendingController(){this.pendingController=t(this.pendingController)}get legendEnabled(){var e;return this.canResume()&&(null==(e=this.processor)?void 0:e.legendEnabled)}get graphics3DProcessor(){var e;return"graphics-3d"===(null==(e=this.processor)?void 0:e.type)?this.processor:null}get heatmapProcessor(){var e;return"heatmap"===(null==(e=this.processor)?void 0:e.type)?this.processor:null}getGraphicFromGraphicUid(e){var r;let t=null;return null==(r=this.loadedGraphics)||r.forEach((r=>{r.uid===e&&(t=a(r,this.layer))})),t}whenGraphicBounds(e,r){var t;return null==(t=this.processor)?void 0:t.whenGraphicBounds(e,r)}computeAttachmentOrigin(e,r){var t;return null==(t=this.processor)?void 0:t.computeAttachmentOrigin(e,r)}queryFeatures(e,r){return this.queryEngine.executeQuery(this._ensureQuery(e),s(r,"signal"))}queryObjectIds(e,r){return this.queryEngine.executeQueryForIds(this._ensureQuery(e),s(r,"signal"))}queryFeatureCount(e,r){return this.queryEngine.executeQueryForCount(this._ensureQuery(e),s(r,"signal"))}queryExtent(e,r){return this.queryEngine.executeQueryForExtent(this._ensureQuery(e),s(r,"signal"))}_ensureQuery(e){return i(e)?this.createQuery():u.from(e)}highlight(e){return this.processor.highlight(e,this.layer.objectIdField)}maskOccludee(e){return this.processor.maskOccludee(e)}canResume(){var e;return super.canResume()&&!(null!=(e=this.processor)&&e.scaleVisibilitySuspended)}getSuspendInfo(){const e=super.getSuspendInfo();return this.processor?{...e,...this.processor.suspendInfo}:e}isUpdating(){var e,r,t;return!(!this.processor||this.processor.destroyed)&&!(this._controllerCreated&&(null==(e=this.controller)||!e.updating)&&null!=(r=this.view)&&null!=(t=r.basemapTerrain)&&t.ready&&!this.processor.updating)}async _initializeController(){const e=this.createController();this.pendingController=e,await e.when(),this._setControllerWhenInitialized(e)}async _setControllerWhenInitialized(e){try{await this.when()}catch(r){}this._controllerCreated=!0,this.notifyChange("updating"),this.isResolved()&&!this.destroyed?(await o((()=>{var e,r;return null==(e=this.view)||null==(r=e.basemapTerrain)?void 0:r.ready})),this.beforeSetController(e),this.pendingController=null,this.controller=e,this.loadedGraphics=e.graphics,this.notifyChange("updating")):this._destroyPendingController()}_updateClippingExtent(e){if(this.clippingExtent=e,!this.controller)return!1;switch(this.controller.type){case"stream":return!1;case"feature-tile-3d":return this.controller.extent=e,!0}}async _validateGeometryType(){switch(this.layer.geometryType){case"multipatch":case"multipoint":return Promise.reject(new r("featurelayerview3d:unsupported-geometry-type","Unsupported geometry type ${geometryType}",{geometryType:this.layer.geometryType}))}}_getResourceInfo(){var e,r;const t=this.controller instanceof p?this.controller:null;return{displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:null!=(e=null==t?void 0:t.maximumNumberOfFeatures)?e:-1,totalNumberOfFeatures:null!=(r=null==t?void 0:t.serviceDataCount)?r:-1,nodes:0,...this.processor.performanceInfo}}get performanceInfo(){return this._getResourceInfo()}};return e([n()],v.prototype,"loadedGraphics",void 0),e([n()],v.prototype,"suspended",void 0),e([n({readOnly:!0})],v.prototype,"legendEnabled",null),e([n()],v.prototype,"updating",void 0),e([n()],v.prototype,"controller",void 0),e([n()],v.prototype,"processor",void 0),e([n({readOnly:!0})],v.prototype,"updatePolicy",void 0),e([n({readOnly:!0})],v.prototype,"suspendResumeExtentMode",void 0),e([n({type:Boolean})],v.prototype,"slicePlaneEnabled",void 0),e([n({readOnly:!0})],v.prototype,"suspendInfo",void 0),e([n()],v.prototype,"graphics3DProcessor",null),e([n()],v.prototype,"heatmapProcessor",null),v=e([l("esri.views.3d.layers.FeatureLikeLayerView3D")],v),v};export{f as FeatureLikeLayerView3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/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{ByteSizeUnit as s}from"../../../core/byteSizeEstimations.js";import r from"../../../core/Collection.js";import o from"../../../core/has.js";import a from"../../../core/Logger.js";import{someMap as n}from"../../../core/MapUtils.js";import{unwrapOr as l,destroyMaybe as d,isSome as h,isNone as c,applySome as u,unwrap as _}from"../../../core/maybe.js";import m from"../../../core/PooledArray.js";import{throwIfAborted as g,createResolver as p}from"../../../core/promiseUtils.js";import{initial as f}from"../../../core/reactiveUtils.js";import{schedule as b}from"../../../core/scheduling.js";import{isArrayBuffer as y}from"../../../core/typedArrayUtil.js";import{getMetersPerVerticalUnitForSR as I}from"../../../core/unitUtils.js";import{init as v}from"../../../core/watchUtils.js";import{property as M}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as C}from"../../../core/accessorSupport/decorators/subclass.js";import{f as x}from"../../../chunks/mat3.js";import{c as O}from"../../../chunks/mat3f32.js";import{m as S,B as E}from"../../../chunks/mat4.js";import{b as j,c as w}from"../../../chunks/mat4f64.js";import{m as T,g as N}from"../../../chunks/vec3.js";import{c as D}from"../../../chunks/vec3f64.js";import{s as R}from"../../../chunks/vec4.js";import{projectBuffer as F,getProjectorName as A,localLinearScaleFactors as P,projectVectorToVector as V,projectBoundingSphere as U}from"../../../geometry/projection.js";import{create as H,empty as G,expandWithBuffer as L,toRect as B}from"../../../geometry/support/aaBoundingBox.js";import{create as k,intersects as q}from"../../../geometry/support/aaBoundingRect.js";import z from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as K}from"../../../layers/support/fieldUtils.js";import{areLabelsVisible as W}from"../../../layers/support/layerUtils.js";import $ from"../../../layers/support/SceneModification.js";import{getColor as X,getOpacity as Y}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{loadArcade as Q}from"../../../support/arcadeOnDemand.js";import J from"../../../symbols/Symbol3D.js";import{getMetersPerUnit as Z}from"../../../symbols/support/unitConversionUtils.js";import ee from"./I3SMeshViewLabeler.js";import{I3SMeshWorkerHandle as te,toWasmModification as ie}from"./I3SMeshWorkerHandle.js";import{ForAllFeaturesVisibilityMode as se,ForAllFeaturesReturnType as re}from"./II3SMeshView3D.js";import{initialize as oe,setModificationsSync as ae,filterObbsForModificationsSync as ne,interpretObbModificationResults as le}from"./SceneLayerWorker.js";import{overrideColor as de}from"./graphics/graphicUtils.js";import{TextureUsage as he,TextureEncoding as ce}from"./i3s/enums.js";import ue from"./i3s/Highlights.js";import{I3SAttributeOverrides as _e}from"./i3s/I3SAttributeOverrides.js";import{I3SCrossfadeHelper as me,NodeCrossfadeMetaData as ge}from"./i3s/I3SCrossfadeHelper.js";import pe from"./i3s/I3SElevationProvider.js";import{boundingBoxCornerPoints as fe}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as be}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as ye,selectEncoding as Ie,createTexture as ve,configureMaterial as Me}from"./i3s/I3SMaterialUtil.js";import{NodeIMModificationImpact as Ce,NodeState as xe}from"./i3s/I3SNode.js";import{computeGlobalTransformation as Oe,getLocalOrigin as Se}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as Ee,checkSceneLayerValid as je,checkSceneLayerCompatibleWithView as we,getCacheKeySuffix as Te,whenGraphicAttributes as Ne,computeVisibilityObb as De,filterInPlace as Re,getCachedAttributeValue as Fe,intersectBoundingRectWithMbs as Ae,MbsIntersectResult as Pe,addWraparound as Ve,getSymbolInfo as Ue,transparentEdgeMaterial as He,getClipRect as Ge}from"./i3s/I3SUtil.js";import{IDBCache as Le}from"./i3s/IDBCache.js";import{attributeLookup as Be}from"./support/attributeUtils.js";import{ColorMixModeEnum as ke}from"./support/symbolColorUtils.js";import qe from"../support/debugFlags.js";import{toBoundingRect as ze}from"../support/extentUtils.js";import{create as Ke,clone as We}from"../support/orientedBoundingBox.js";import{updatingProgress as $e}from"../support/updatingProperties.js";import{glLayout as Xe}from"../support/buffer/glUtil.js";import{State as Ye}from"../webgl-engine/collections/Component/ComponentObject.js";import{createVertexBufferLayout as Qe}from"../webgl-engine/collections/Component/SourceGeometry.js";import{TextureCoordinateAttribute as Je}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{loadBasis as Ze}from"../webgl-engine/lib/BasisUtil.js";import{Transparency as et}from"../webgl-engine/lib/edgeRendering/interfaces.js";const tt=a.getLogger("esri.views.3d.layers.SceneLayerView3D"),it=[1,1,1,1];class st extends ge{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.edgeMemoryUsage=0,this.cachedSymbology=null}}var rt;!function(e){e[e.CastShadows=4]="CastShadows",e[e.Pickable=5]="Pickable"}(rt||(rt={}));const ot=19,at=100*s.MEGABYTES,nt=t=>{let s=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 Le("esri-scenelayer-cache","geometries"),this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.filter=null,this.slicePlaneEnabled=!1,this._modifications=new Array,this._layerUrl="",this._cacheKeySuffix=null,this._arcade=null,this._tmpAttributeOnlyGraphic=new i(null,null,{}),this._crossfadeHelper=new me(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 Ee(this._currentRenderer)?this._usePBR()||this._hasLoadedPBRTextures?he.AllTexturesPBR:he.AllTextures:this._usePBR()||this._hasLoadedPBRTextures?he.GeometryTexturesPBR:he.GeometryTextures}get elevationOffset(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null!=e&&"absolute-height"===e.mode){const t=I(this.i3slayer.spatialReference),i=Z(e.unit);return l(e.offset,0)*i/t}return 0}get supportedTextureEncodings(){return ye(this.view._stage.renderView.capabilities)}get uncompressedTextureDownsamplingEnabled(){var e;const t=null==(e=this.view)?void 0:e.qualitySettings.sceneService.uncompressedTextureDownsamplingEnabled,i=0==(this.supportedTextureEncodings&ce.DDS_S3TC);return t&&i}initialize(){this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const e=this.view.resourceController;if(this.attributeOverrides=new _e(this.i3slayer,e.memoryController),this._worker=new te((t=>e.schedule(t))),this.addResolvingPromise(this._worker.promise),this._worker.setLegacySchema(this.layerUid,this.i3slayer.store.defaultGeometrySchema),je(this.i3slayer),we(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new z({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 ue({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,se.ALL),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=>h(this._controller.index)&&h(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,h(s)?s.objectHandle:null)})):()=>{};this._intersectionHandler=new be({layerUid:this.layerUid,sublayerUid:this.sublayerUid,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:i}),this._elevationProvider=new pe({layerView:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR(),this.updatingHandles.add((()=>this.view.clippingArea),(()=>this._clippingAreaChanged()),f),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()),f),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)),f),this.updatingHandles.add((()=>this.i3slayer.labelsVisible),(()=>this._labelingChanged()),f),this.updatingHandles.add((()=>this.i3slayer.labelingInfo),(()=>this._labelingChanged()),f),this.updatingHandles.add((()=>this._modifications),(()=>this._modificationsChanged()),f),this.handles.add([v(qe,"I3S_TREE_SHOW_TILES",(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&qe.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||qe.I3S_TREE_SHOW_TILES||(this._treeDebugger=d(this._treeDebugger))})),v(qe,"I3S_SHOW_MODIFICATIONS",(()=>this._showModifications()))]),this._cacheKeySuffix=Te(this.i3slayer.spatialReference,this.view.renderSpatialReference),this._idbCache.init().catch((e=>tt.warn(`Failed to initialize IndexedDB cache: ${e}`)))}destroy(){this._clearAddTasks(),this.attributeOverrides=d(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=d(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=d(this._labeler),this._treeDebugger=d(this._treeDebugger),this._controller=d(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(h(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=h(this._labeler)?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach((t=>e+=h(t)?t.node.memory:0)),this._nodeId2MetaReloading.forEach((t=>e+=h(t)?t.node.memory:0)),e}getUnloadedMemory(){return(h(this._controller)?this._controller.unloadedMemoryEstimate:0)+(h(this._labeler)?this._labeler.unloadedMemoryEstimate:0)}ignoresMemoryFactor(){return!1}_labelingChanged(){if(!(W(this.i3slayer)&&this._supportsLabeling))return void(h(this._labeler)&&(this._labeler.destroy(),this._labeler=null));if(h(this._labeler))return;const e=new ee({view:this.view,layer:this.i3slayer,collection:this._collection});this._nodeId2Meta.forEach((t=>h(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=oe().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._layerClippingArea,this._modifications,t);const i=ie(this._layerClippingArea,this._modifications,t);ae({context:e,modifications:i,isGeodetic:t.isGeographic}),this._controller.modificationsChanged();const s=this.hasModifications?new m:null;this._nodeId2Meta.forEach(((e,t)=>{c(e)?this._nodeId2Meta.delete(t):e.node.hasModifications?(this._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):h(s)&&s.push(e.node)})),h(s)&&this._nodeId2MetaReloading.forEach((e=>s.push(e.node))),h(s)&&s.length>0&&(this.updateNodeModificationStatus(s),s.forAll((e=>{if(e.imModificationImpact!==Ce.Culled){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),this._nodeId2Meta.delete(e.index),h(t)&&this._nodeId2MetaReloading.set(e.index,t)}}))),this.clearMemCache(),this._controller.restartNodeLoading(),this._showModifications()}_showModifications(){if(h(this._modificationGraphics)&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!qe.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(h(t)&&h(t.attributeInfo))return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if(h(t)&&h(t.attributeInfo))return t.attributeInfo.attributeData}setAttributeData(e,t){const i=this._nodeId2Meta.get(e);h(i)&&h(i.attributeInfo)&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const s=this._nodeId2Meta.get(e);h(s)&&(await this.attributeOverrides.apply(s.featureIds,t,i),s.attributeInfo=t,this._attributeValuesChanged(s))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.filteredIds=null,h(this._labeler)&&this._labeler.setNodeMetaAttributes(e,((e,t)=>this._createAttributes(e,t))),this._updateEngineObject(e)}clearMemCache(){h(this._memCache)&&this._memCache.clear()}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach((t=>h(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(){!o("disable-feature:i3s-basis")&&0!=(this.supportedTextureEncodings&ce.Basis)&&u(this.i3slayer.textureSetDefinitions,(e=>e.some((e=>e.formats.some((e=>"basis"===e.format||"ktx2"===e.format))))))&&Ze()}_getVertexBufferLayout(e,t){const i={hasTexture:gt(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion};return Xe(Qe(this._getGeometryParameters(i)))}_getObjectIdField(){return this.i3slayer.objectIdField||"OBJECTID"}_findGraphicNodeAndIndex(e){const t=Be(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());let i=null;return n(this._nodeId2Meta,(e=>{if(c(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(c(i))return[];const s=[],r=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const a of t){const e=Be(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(c(i))return Promise.reject();const s=i.objectHandle,r=fe(t.index,this._collection,s,new Float64Array(24)),o=this.view.renderSpatialReference,a=this.view.spatialReference;if(F(r,o,0,r,a,0,8)){const e=G();return L(e,r,0,8),Promise.resolve({boundingBox:e,screenSpaceObjects:[]})}}whenGraphicAttributes(e,t){return Ne(this.i3slayer,e,this._getObjectIdField(),t,(()=>[...this._nodeId2Meta.values()].filter(h)))}getGraphicFromIntersectorTarget(e){if(null==e.nodeIndex||null==e.componentIndex)return null;const t=this._nodeId2Meta.get(e.nodeIndex);return c(t)||null==t.featureIds||e.componentIndex>=t.featureIds.length?null:this._createGraphic(e.componentIndex,t)}_getCacheKey(e){return`${this._layerUrl}/v${ot}/${e.id}${this._cacheKeySuffix}`}_getMemCacheKey(e,t=this.elevationOffset){return e+"#"+t}get _idbCacheEnabled(){return!this._controller.disableIDBCache&&!this.hasModifications&&0===this.elevationOffset&&null!=this._cacheKeySuffix}loadCachedGPUData(e){return h(this._memCache)?this._memCache.pop(this._getMemCacheKey(e.index)):null}deleteCachedGPUData(e){h(e)&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(c(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(c(t))return!0;const s=Ie(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(c(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&&h(s.textureData)&&(s.byteSize=bt(s.transformedGeometry,s.textureData),s.textureData.every(ft)&&yt(e,s)&&this._idbCache.put(this._getCacheKey(e),s).catch((t=>tt.warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`)))),g(t),s)))))):Promise.resolve(null)}addNode(e,t,i){return pt(t)?this._addData(e,t.attributeDataInfo,(()=>this._transformNode(e,t,i).then((s=>this._safeReschedule((()=>{if(c(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,d=this.view.renderSpatialReference,u=Oe(e.mbs,this.elevationOffset,l,d);e.geometryObb=Ke([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]),T(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:bt(n,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&yt(e,_)){const t=h(_.textureData)?_.textureData.map((e=>ft(e)?e:null)):null;this._idbCache.put(this._getCacheKey(e),{..._,textureData:t}).catch((t=>tt.warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`)))}return this._addCachedNodeData(e,_,i)}),i))))):Promise.reject()}computeVisibilityObb(e){return De(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 c=0;c<s.length;++c)r[c]=this._getVertexBufferLayout(s[c],t.geometryDescriptor);const o=e.mbs,a=this.elevationOffset,n=this._controller.crsIndex,l=this._controller.crsVertex,d=this.view.renderSpatialReference,h=Se(o,a,n),u=Oe(o,a,n,d),_=A(n,l),m=A(l,d);if(c(_)||c(m))return Promise.resolve(null);const g={context:this.i3slayer.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,localOrigin:h,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=We(this._collection.getComponentObb(t.objectHandle)),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);h(this._labeler)&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,Ye.Visible),this._updateMaterial(t),this._setNewNodeOpacity(t),this._updateEngineObject(t),this._highlights.objectCreated(t),h(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(c(t))return void this._addNodeMeta(e.index,null);const s=this._addTasks.get(e.index),{geometryData:r,transformedGeometry:a,globalTrafo:n}=t;await this.attributeOverrides.apply(r.featureIds,s.attributeInfo,i);const l=h(t.textureData)?t.textureData.filter((e=>h(e)&&0!=(e.usage&this.rendererTextureUsage))):[];!o("disable-feature:i3s-basis")&&l.some((e=>h(e)&&(e.encoding===ce.Basis||e.encoding===ce.KTX2)))&&await Ze(),e.memory=0;const{componentOffsets:d,geometries:u,featureIds:m}=r,g=this._collection,p=u[0],{layout:f,indices:b,interleavedVertexData:y,positionData:I,hasColors:v}=a,M=this._materialParameters(p,f),C=d||new Uint32Array([0,b?b.length:y.byteLength/f[0].stride]),T={vertices:{data:y,count:y.byteLength/f[0].stride,layoutParameters:M.geometryParams},positionData:{positions:I.data,indices:I.indices},indices:b,componentOffsets:C},N=p.transformation?j(p.transformation):w();S(N,n,N);const R=E(D(),N),F=x(O(),N),A=this.view.renderSpatialReference,U=this.view.basemapTerrain.spatialReference,H=D(),G=[1,1,1];P(R,A,G,U)||tt.errorOnce("Unsupported coordinate system for IM overlay"),V(R,A,H,U);const L=g.createObject({toMapSpace:[H[0],H[1],G[0],G[1]],geometry:T,obb:_(e.geometryObb),transform:{position:R,rotationScale:F}}),B=M.geometryParams.textureCoordinates===Je.AttributeType.Atlas,{textures:k,texturePromise:q}=this._initMaterialAndTextures(L,M.material,l,B);e.memory+=this._memEstimateGeometryAdded(L),e.memory+=k.reduce(((e,t)=>e+(h(t)?this._memEstimateTextureAdded(t):0)),0);const z=!!M.material.hasParametersFromSource,K="blend"!==M.material.alphaMode&&M.material.metallicRoughness.baseColorFactor[3]>=1,W=new st(e,m,L,this._getInvalidRendererVersion(),s.attributeInfo,{hasParametersFromSource:z,isOpaque:K},k);s.meta=W,!this._hasTextures&&t.requiredTextures.some((({usage:e})=>0!=(e&he.ColorTextures)))&&(this._hasTextures=!0),this._hasData=!0,this._hasColors=this._hasColors||v,this._hasTextures=this._hasTextures||!!e.resources.texture,this.notifyChange("hasTexturesOrVertexColors");const $=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering(W),q]).then((([t,s])=>(h(t)&&t.updateObjectVisibility(W.objectHandle,!1),this._safeReschedule((()=>{const i=this._addTasks.get(e.index);if(!i)return;if(h(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,Ye.Visible),h(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||h(t)&&(r||o))&&this._addOrUpdateEdgeRendering(W),this._visibleGeometryChanged(W),this._highlights.objectCreated(W),this._updateMaterial(W),this._setNewNodeOpacity(W),h(this._treeDebugger)&&this._treeDebugger.update()}),i)))).catch((e=>{throw h(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)){tt.error("Removing duplicated node");const t=this._nodeId2Meta.get(e);h(t)&&this._deleteComponentObject(t)}h(t)&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&Mt(t.cachedEdgeMaterials,0)),this._nodeId2Meta.set(e,t)}_safeReschedule(e,t){return g(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=gt(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=>ve(e,t,s,r)));this._stage.addMany(o);let a=null;return this._collection.updateMaterial(e,(e=>{a=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)})),{textures:o,texturePromise:a}}_getGeometryParameters(e){return{textureCoordinates:e.hasTexture?e.hasRegions?Je.AttributeType.Atlas:Je.AttributeType.Default:Je.AttributeType.None,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={...p(),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=>{h(e.meta)&&(this._cacheGPUData(e.meta),e.meta=null)})),this._addTasks.clear()}_clippingAreaChanged(){const e=this.view.renderSpatialReference,t=this.i3slayer.spatialReference,i=k();this._renderClippingArea=ze(this.view.clippingArea,i,e)?i:null;const s=k();this._layerClippingArea=ze(this.view.clippingArea,s,t)?s:null,this._filterChange(),this._controller&&this._controller.updateClippingArea(this.view.clippingArea),this._isIntegratedMesh&&this._modificationsChanged()}_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=>{h(e)&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e))}))}getFilters(){const e=[],t=this._renderClippingArea;return h(t)&&e.push(((e,i)=>this._boundingRectFilter(e,i,t))),e}addSqlFilter(e,t,i){if(h(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,d=h(t.attributeInfo)&&t.attributeInfo.attributeData;s.every((e=>null!=d[e]||e===n))&&Re(e,l,(e=>{o[n]=l[e];for(const i of s)i!==n&&(o[i]=Fe(d[i],e));try{return i.testFeature(a)}catch(t){return r(t),!1}}))}_boundingRectNodeTest(e,t){return U(e.node.mbs,this._controller.crsIndex,mt,this.view.renderSpatialReference),Ae(t,mt)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,lt),B(lt,dt),q(i,dt)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(r===Pe.INSIDE)return;if(r===Pe.OUTSIDE)return void(e.length=0);const o=s.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const a=this._transformClippingArea(ht,i,t.objectHandle);Re(e,t.featureIds,(e=>this._boundingRectFeatureTest(t,e,a)))}_transformClippingArea(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[0])/o[0],e[3]=(t[3]-r[1])/o[4],e}_addOrUpdateEdgeRendering(e,t=!0){const i=this._edgeView;if(c(i))return Promise.resolve(null);const s=e.objectHandle,r=i.hasObject(s),{hasEdges:o,perFeatureEdgeMaterials:a}=this._getFilteredEdgeMaterials(e),n={slicePlaneEnabled:this.slicePlaneEnabled};if(o&&r){if(this.nodeCrossfadingEnabled){Mt(a,this.getNodeOpacity(e))}return i.updateAllComponentMaterials(s,a,n,t),i.updateObjectVisibility(s,!0),Promise.resolve(i)}return o&&!r?this._collection.addEdges(s,i,a,n).then((t=>(e.edgeMemoryUsage=t,e.node.memory+=t,i))):(!o&&r&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,i.removeObject(s)),Promise.resolve(null))}_applyFiltersToNode(e){return!!this._applyFiltersToNodeComponents(e)&&(h(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);c(s)?i.delete(e):(this._collection.setObjectVisibility(s.objectHandle,Ye.Hidden),h(this._edgeView)&&this._edgeView.hasObject(s.objectHandle)&&this._edgeView.updateObjectVisibility(s.objectHandle,!1),this._visibleGeometryChanged(s),h(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),h(this._treeDebugger)&&this._treeDebugger.update())}_deleteComponentObject(e){if(h(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);h(i)&&this._collection.updateMaterial(i.objectHandle,(e=>e.polygonOffsetEnabled=t===xe.Hole))}_invalidateAllSymbols(){this._rendererVersion=Ve(this._rendererVersion,1),this._controller&&this._controller.requestUpdate()}_getInvalidRendererVersion(){return Ve(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=Ve(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 Q()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:tt.warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.getSymbols())"mesh-3d"!==t.type&&tt.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;R(i.externalColor,t[s+0]/255,t[s+1]/255,t[s+2]/255,t[s+3]/255),i.externalColorMixMode=t[s+4]&(1<<rt.CastShadows)-1,i.castShadows=0!=(t[s+4]&1<<rt.CastShadows),i.pickable=0!=(t[s+4]&1<<rt.Pickable)}}_getSymbolInfo(e,t){const i=e&&e.getSymbol(t,{arcade:this._arcade});if(!(i instanceof J))return null;const s=i.id;if(this._symbolInfos.has(s))return this._symbolInfos.get(s);const r=Ue(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=h(this._symbologyOverrideFields)&&this._symbologyOverrideFields.length>0?h(this._rendererFields)&&this._rendererFields.length>0?K(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=h(e.attributeInfo)&&e.attributeInfo.attributeData,o=null!=e.featureIds?this.i3slayer.objectIdField:null,a=null!=r&&h(this._symbologyFields)&&this._symbologyFields.length>0,n=a?[]:null,l=a?[]:null;if(a&&h(this._symbologyFields))for(const h of this._symbologyFields){const e=r[h];e&&(n.push(h),l.push(e))}e.cachedSymbology||(e.cachedSymbology=new Uint8Array(5*e.featureIds.length));const d={color:ut,castShadows:!0,pickable:!0,colorMixMode:ke.Multiply,edgeMaterial:null},u=this.fullOpacity,_=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):u;let m=null,g=et.OPAQUE,p=He,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]]=Fe(l[e],b);const r=this._getSymbolInfo(s,t);let u=null,y=null;if(s&&"visualVariables"in s){if(this._colorVariable){const e=X(this._colorVariable,t,{color:_t,arcade:this._arcade});e&&(u=ut,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=Y(this._opacityVariable,t,{arcade:this._arcade}))}if(r&&r.material){const e=r.material;u=c(u)||c(y)?de(u,y,e.color,e.alpha,it,ut):de(u,y,null,null,it,ut)}if(c(u)&&(u=ut,u[0]=1,u[1]=1,u[2]=1,u[3]=1),d.pickable=!0,d.castShadows=!r||r.castShadows,d.colorMixMode=r&&r.material?r.material.colorMixMode:ke.Multiply,d.edgeMaterial=r?r.edgeMaterial:null,h(this._symbologyOverride)&&(d.color=u,this._symbologyOverride(t,d),u=d.color),h(d.edgeMaterial)){const t=u[3]<=0?et.INVISIBLE:u[3]>=1&&(e.material.isOpaque||d.colorMixMode===ke.Replace)?et.OPAQUE:et.TRANSPARENT;d.edgeMaterial===m&&t===g||(p={...d.edgeMaterial,opacity:_,objectTransparency:t},m=d.edgeMaterial,g=t),e.cachedEdgeMaterials[b]=p}else e.cachedEdgeMaterials[b]=He;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]=d.colorMixMode|+d.castShadows<<rt.CastShadows|+d.pickable<<rt.Pickable,f+=5}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);if(this.nodeCrossfadingEnabled||Mt(t,this.fullOpacity),c(e.filteredIds)){return{hasEdges:t.some((e=>e!==He)),perFeatureEdgeMaterials:t}}let i=0,s=!1;const r=t.map(((t,r)=>e.featureIds[r]!==e.filteredIds[i]?He:(s=s||t!==He,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=>{c(t)||(this._collection.updateMaterial(t.objectHandle,(t=>t.objectOpacity=e)),Mt(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.slicePlaneEnabled=e),h(this._labeler)&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach((t=>{c(t)||(this._collection.updateMaterial(t.objectHandle,(t=>{t.commonMaterialParameters.slicePlaneEnabled=e})),this._updateEdgeRendering(t,!1))}))}_updatePBR(){this._nodeId2Meta.forEach((e=>{c(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){h(this._edgeView)&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_forAllFeatures(e,t,i=se.VISIBLE_ONLY){n(this._nodeId2Meta,(s=>{if(c(s))return!1;if(h(t)){switch(t(s)){case re.EXIT:return!0;case re.SKIP:return!1}}let r=re.CONTINUE;switch(i){case se.ALL:r=this._forAllFeaturesOfNode(s,e);break;case se.VISIBLE_ONLY:r=this._forVisibleFeaturesOfNode(s,e);break;case se.ALL_IN_CLIPPING_AREA:r=this._forAllFeaturesOfNodeInClippingArea(s,e)}return r===re.EXIT}))}_forAllFeaturesOfNode(e,t){let i=re.CONTINUE;const s=e.featureIds;for(let r=0;r<s.length;r++)if(i=t(s[r],r,e),i===re.EXIT)return i;return i}_forVisibleFeaturesOfNode(e,t){let i=re.CONTINUE;const s=e.featureIds;return this._collection.forEachVisibleComponent(e.objectHandle,(r=>(i=t(s[r],r,e),i===re.CONTINUE))),i}_forAllFeaturesOfNodeInClippingArea(e,t){if(c(this._renderClippingArea))return this._forAllFeaturesOfNode(e,t);const i=this._boundingRectNodeTest(e,this._renderClippingArea);if(i===Pe.OUTSIDE)return re.CONTINUE;if(i===Pe.INSIDE)return this._forAllFeaturesOfNode(e,t);const s=re.CONTINUE,r=e.featureIds,o=e.objectHandle,a=Ge(this._renderClippingArea,this._collection.getObjectTransform(o));for(let n=0;n<r.length;n++){if(!this._boundingRectFeatureTest(e,n,a))continue;const i=t(r[n],n,e);if(i===re.EXIT)return i}return s}_createAttributes(e,t){const i={};null!=t.featureIds&&(i[this._getObjectIdField()]=t.featureIds[e]);const s=h(t.attributeInfo)&&t.attributeInfo.attributeData;if(h(s))for(const r of Object.keys(s))i[r]=Fe(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 r&&(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=>Be(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 vt}_visibleGeometryChanged(e){this._elevationProvider&&(this._elevationProvider.objectChanged(e.node),null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=b((()=>{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 h(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),re.CONTINUE)),null,se.VISIBLE_ONLY),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 h(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);h(s)&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);h(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(!h(this._edgeView)||!e.cachedEdgeMaterials)return;Mt(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t)}get hasModifications(){return this._isIntegratedMesh&&h(this._layerClippingArea)||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=It(e);if(h(s)){const t={context:i,buffer:s.buffer};ne(t);const r=new Float64Array(s.buffer);e.forAll(((e,t)=>{const i=r[t],s=le(i);e.imModificationImpact=s,s!==Ce.Unmodified&&this._controller.invalidateGeometryVisibility(e.index)}))}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||h(this._labeler)&&this._labeler.updating||this._crossfadeHelper.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0}};return e([M()],s.prototype,"_hasLoadedPBRTextures",void 0),e([M()],s.prototype,"_asyncModuleLoading",void 0),e([M()],s.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([M()],s.prototype,"view",void 0),e([M()],s.prototype,"i3slayer",void 0),e([M()],s.prototype,"_controller",void 0),e([M()],s.prototype,"_labeler",void 0),e([M()],s.prototype,"updating",void 0),e([M()],s.prototype,"suspended",void 0),e([M()],s.prototype,"holeFilling",void 0),e([M($e)],s.prototype,"updatingProgress",void 0),e([M({readOnly:!0,aliasOf:"_controller.updatingProgress"})],s.prototype,"updatingProgressValue",void 0),e([M({readOnly:!0})],s.prototype,"hasTexturesOrVertexColors",null),e([M({readOnly:!0})],s.prototype,"rendererTextureUsage",null),e([M()],s.prototype,"filter",void 0),e([M({readOnly:!0})],s.prototype,"elevationOffset",null),e([M({type:Boolean})],s.prototype,"slicePlaneEnabled",void 0),e([M()],s.prototype,"supportedTextureEncodings",null),e([M()],s.prototype,"uncompressedTextureDownsamplingEnabled",null),e([M({type:[$]})],s.prototype,"_modifications",void 0),s=e([C("esri.views.3d.layers.I3SMeshView3D")],s),s},lt=H(),dt=k(),ht=k(),ct=Ke(),ut=[0,0,0,0],_t=new t([0,0,0,0]),mt=[0,0,0,0];function gt(e){const t=e.metallicRoughness;return t&&t.baseColorTextureId>=0||t&&t.metallicRoughnessTextureId>=0||e.normalTextureId>=0||e.emissiveTextureId>=0||e.occlusionTextureId>=0}function pt(e){return"geometryData"in e}function ft(e){return h(e)&&y(e.data)}function bt(e,t){let i=1024+e.interleavedVertexData.byteLength+(e.indices?e.indices.byteLength:0)+e.positionData.data.byteLength+e.positionData.indices.byteLength;if(h(t))for(const s of t)h(s)&&y(s.data)&&(i+=s.data.byteLength);return i}function yt(e,t){return t.byteSize>at?(tt.warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}function It(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;c(s)&&(s=ct,N(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 vt={remove(){},pause(){},resume(){}};function Mt(e,t){e.forEach((e=>e.opacity=t))}export{nt as I3SMeshView3D};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../Graphic.js";import{ByteSizeUnit as s}from"../../../core/byteSizeEstimations.js";import r from"../../../core/Collection.js";import o from"../../../core/has.js";import a from"../../../core/Logger.js";import{someMap as n}from"../../../core/MapUtils.js";import{unwrapOr as l,destroyMaybe as d,isSome as h,isNone as c,applySome as u,unwrap as _}from"../../../core/maybe.js";import m from"../../../core/PooledArray.js";import{throwIfAborted as g,createResolver as p}from"../../../core/promiseUtils.js";import{initial as f}from"../../../core/reactiveUtils.js";import{schedule as b}from"../../../core/scheduling.js";import{isArrayBuffer as y}from"../../../core/typedArrayUtil.js";import{getMetersPerVerticalUnitForSR as I}from"../../../core/unitUtils.js";import{init as v}from"../../../core/watchUtils.js";import{property as M}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as C}from"../../../core/accessorSupport/decorators/subclass.js";import{f as x}from"../../../chunks/mat3.js";import{c as O}from"../../../chunks/mat3f32.js";import{m as S,B as E}from"../../../chunks/mat4.js";import{b as j,c as w}from"../../../chunks/mat4f64.js";import{m as N,g as D}from"../../../chunks/vec3.js";import{c as R}from"../../../chunks/vec3f64.js";import{s as T}from"../../../chunks/vec4.js";import{projectBuffer as F,getProjectorName as A,localLinearScaleFactors as P,projectVectorToVector as V,projectBoundingSphere as U}from"../../../geometry/projection.js";import{create as H,empty as G,expandWithBuffer as L,toRect as B}from"../../../geometry/support/aaBoundingBox.js";import{create as k,intersects as q}from"../../../geometry/support/aaBoundingRect.js";import z from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as K}from"../../../layers/support/fieldUtils.js";import{areLabelsVisible as W}from"../../../layers/support/layerUtils.js";import $ from"../../../layers/support/SceneModification.js";import{getColor as X,getOpacity as Y}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{loadArcade as Q}from"../../../support/arcadeOnDemand.js";import J from"../../../symbols/Symbol3D.js";import{getMetersPerUnit as Z}from"../../../symbols/support/unitConversionUtils.js";import ee from"./I3SMeshViewLabeler.js";import{I3SMeshWorkerHandle as te,toWasmModification as ie}from"./I3SMeshWorkerHandle.js";import{ForAllFeaturesVisibilityMode as se,ForAllFeaturesReturnType as re}from"./II3SMeshView3D.js";import{initialize as oe,setModificationsSync as ae,filterObbsForModificationsSync as ne,interpretObbModificationResults as le}from"./SceneLayerWorker.js";import{overrideColor as de}from"./graphics/graphicUtils.js";import{TextureUsage as he,TextureEncoding as ce}from"./i3s/enums.js";import ue from"./i3s/Highlights.js";import{I3SAttributeOverrides as _e}from"./i3s/I3SAttributeOverrides.js";import{I3SCrossfadeHelper as me,NodeCrossfadeMetaData as ge}from"./i3s/I3SCrossfadeHelper.js";import pe from"./i3s/I3SElevationProvider.js";import{boundingBoxCornerPoints as fe}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as be}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as ye,selectEncoding as Ie,createTexture as ve,configureMaterial as Me}from"./i3s/I3SMaterialUtil.js";import{NodeIMModificationImpact as Ce,NodeState as xe}from"./i3s/I3SNode.js";import{computeGlobalTransformation as Oe,getLocalOrigin as Se}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as Ee,checkSceneLayerValid as je,checkSceneLayerCompatibleWithView as we,getCacheKeySuffix as Ne,whenGraphicAttributes as De,computeVisibilityObb as Re,filterInPlace as Te,getCachedAttributeValue as Fe,intersectBoundingRectWithMbs as Ae,MbsIntersectResult as Pe,addWraparound as Ve,getSymbolInfo as Ue,transparentEdgeMaterial as He,getClipRect as Ge}from"./i3s/I3SUtil.js";import{IDBCache as Le}from"./i3s/IDBCache.js";import{attributeLookup as Be}from"./support/attributeUtils.js";import{ColorMixModeEnum as ke}from"./support/symbolColorUtils.js";import qe from"../support/debugFlags.js";import{toBoundingRect as ze}from"../support/extentUtils.js";import{create as Ke,clone as We}from"../support/orientedBoundingBox.js";import{updatingProgress as $e}from"../support/updatingProperties.js";import{glLayout as Xe}from"../support/buffer/glUtil.js";import{State as Ye}from"../webgl-engine/collections/Component/ComponentObject.js";import{createVertexBufferLayout as Qe}from"../webgl-engine/collections/Component/SourceGeometry.js";import{TextureCoordinateAttributeType as Je}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{loadBasis as Ze}from"../webgl-engine/lib/BasisUtil.js";import{Transparency as et}from"../webgl-engine/lib/edgeRendering/interfaces.js";const tt=a.getLogger("esri.views.3d.layers.SceneLayerView3D"),it=[1,1,1,1];class st extends ge{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.edgeMemoryUsage=0,this.cachedSymbology=null}}var rt;!function(e){e[e.CastShadows=4]="CastShadows",e[e.Pickable=5]="Pickable"}(rt||(rt={}));const ot=19,at=100*s.MEGABYTES,nt=t=>{let s=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 Le("esri-scenelayer-cache","geometries"),this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.filter=null,this.slicePlaneEnabled=!1,this._modifications=new Array,this._layerUrl="",this._cacheKeySuffix=null,this._arcade=null,this._tmpAttributeOnlyGraphic=new i(null,null,{}),this._crossfadeHelper=new me(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 Ee(this._currentRenderer)?this._usePBR()||this._hasLoadedPBRTextures?he.AllTexturesPBR:he.AllTextures:this._usePBR()||this._hasLoadedPBRTextures?he.GeometryTexturesPBR:he.GeometryTextures}get elevationOffset(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null!=e&&"absolute-height"===e.mode){const t=I(this.i3slayer.spatialReference),i=Z(e.unit);return l(e.offset,0)*i/t}return 0}get supportedTextureEncodings(){return ye(this.view._stage.renderView.capabilities)}get uncompressedTextureDownsamplingEnabled(){var e;const t=null==(e=this.view)?void 0:e.qualitySettings.sceneService.uncompressedTextureDownsamplingEnabled,i=0==(this.supportedTextureEncodings&ce.DDS_S3TC);return t&&i}initialize(){this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const e=this.view.resourceController;if(this.attributeOverrides=new _e(this.i3slayer,e.memoryController),this._worker=new te((t=>e.schedule(t))),this.addResolvingPromise(this._worker.promise),this._worker.setLegacySchema(this.layerUid,this.i3slayer.store.defaultGeometrySchema),je(this.i3slayer),we(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new z({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 ue({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,se.ALL),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=>h(this._controller.index)&&h(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,h(s)?s.objectHandle:null)})):()=>{};this._intersectionHandler=new be({layerUid:this.layerUid,sublayerUid:this.sublayerUid,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:i}),this._elevationProvider=new pe({layerView:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR(),this.updatingHandles.add((()=>this.view.clippingArea),(()=>this._clippingAreaChanged()),f),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()),f),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)),f),this.updatingHandles.add((()=>this.i3slayer.labelsVisible),(()=>this._labelingChanged()),f),this.updatingHandles.add((()=>this.i3slayer.labelingInfo),(()=>this._labelingChanged()),f),this.updatingHandles.add((()=>this._modifications),(()=>this._modificationsChanged()),f),this.handles.add([v(qe,"I3S_TREE_SHOW_TILES",(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&qe.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||qe.I3S_TREE_SHOW_TILES||(this._treeDebugger=d(this._treeDebugger))})),v(qe,"I3S_SHOW_MODIFICATIONS",(()=>this._showModifications()))]),this._cacheKeySuffix=Ne(this.i3slayer.spatialReference,this.view.renderSpatialReference),this._idbCache.init().catch((e=>tt.warn(`Failed to initialize IndexedDB cache: ${e}`)))}destroy(){this._clearAddTasks(),this.attributeOverrides=d(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=d(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=d(this._labeler),this._treeDebugger=d(this._treeDebugger),this._controller=d(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(h(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=h(this._labeler)?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach((t=>e+=h(t)?t.node.memory:0)),this._nodeId2MetaReloading.forEach((t=>e+=h(t)?t.node.memory:0)),e}getUnloadedMemory(){return(h(this._controller)?this._controller.unloadedMemoryEstimate:0)+(h(this._labeler)?this._labeler.unloadedMemoryEstimate:0)}ignoresMemoryFactor(){return!1}_labelingChanged(){if(!(W(this.i3slayer)&&this._supportsLabeling))return void(h(this._labeler)&&(this._labeler.destroy(),this._labeler=null));if(h(this._labeler))return;const e=new ee({view:this.view,layer:this.i3slayer,collection:this._collection});this._nodeId2Meta.forEach((t=>h(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=oe().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._layerClippingArea,this._modifications,t);const i=ie(this._layerClippingArea,this._modifications,t);ae({context:e,modifications:i,isGeodetic:t.isGeographic}),this._controller.modificationsChanged();const s=this.hasModifications?new m:null;this._nodeId2Meta.forEach(((e,t)=>{c(e)?this._nodeId2Meta.delete(t):e.node.hasModifications?(this._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):h(s)&&s.push(e.node)})),h(s)&&this._nodeId2MetaReloading.forEach((e=>s.push(e.node))),h(s)&&s.length>0&&(this.updateNodeModificationStatus(s),s.forAll((e=>{if(e.imModificationImpact!==Ce.Culled){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),this._nodeId2Meta.delete(e.index),h(t)&&this._nodeId2MetaReloading.set(e.index,t)}}))),this.clearMemCache(),this._controller.restartNodeLoading(),this._showModifications()}_showModifications(){if(h(this._modificationGraphics)&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!qe.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(h(t)&&h(t.attributeInfo))return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if(h(t)&&h(t.attributeInfo))return t.attributeInfo.attributeData}setAttributeData(e,t){const i=this._nodeId2Meta.get(e);h(i)&&h(i.attributeInfo)&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const s=this._nodeId2Meta.get(e);h(s)&&(await this.attributeOverrides.apply(s.featureIds,t,i),s.attributeInfo=t,this._attributeValuesChanged(s))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.filteredIds=null,h(this._labeler)&&this._labeler.setNodeMetaAttributes(e,((e,t)=>this._createAttributes(e,t))),this._updateEngineObject(e)}clearMemCache(){h(this._memCache)&&this._memCache.clear()}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach((t=>h(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(){!o("disable-feature:i3s-basis")&&0!=(this.supportedTextureEncodings&ce.Basis)&&u(this.i3slayer.textureSetDefinitions,(e=>e.some((e=>e.formats.some((e=>"basis"===e.format||"ktx2"===e.format))))))&&Ze()}_getVertexBufferLayout(e,t){const i={hasTexture:gt(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion};return Xe(Qe(this._getGeometryParameters(i)))}_getObjectIdField(){return this.i3slayer.objectIdField||"OBJECTID"}_findGraphicNodeAndIndex(e){const t=Be(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());let i=null;return n(this._nodeId2Meta,(e=>{if(c(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(c(i))return[];const s=[],r=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const a of t){const e=Be(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(c(i))return Promise.reject();const s=i.objectHandle,r=fe(t.index,this._collection,s,new Float64Array(24)),o=this.view.renderSpatialReference,a=this.view.spatialReference;if(F(r,o,0,r,a,0,8)){const e=G();return L(e,r,0,8),Promise.resolve({boundingBox:e,screenSpaceObjects:[]})}}whenGraphicAttributes(e,t){return De(this.i3slayer,e,this._getObjectIdField(),t,(()=>[...this._nodeId2Meta.values()].filter(h)))}getGraphicFromIntersectorTarget(e){if(null==e.nodeIndex||null==e.componentIndex)return null;const t=this._nodeId2Meta.get(e.nodeIndex);return c(t)||null==t.featureIds||e.componentIndex>=t.featureIds.length?null:this._createGraphic(e.componentIndex,t)}_getCacheKey(e){return`${this._layerUrl}/v${ot}/${e.id}${this._cacheKeySuffix}`}_getMemCacheKey(e,t=this.elevationOffset){return e+"#"+t}get _idbCacheEnabled(){return!this._controller.disableIDBCache&&!this.hasModifications&&0===this.elevationOffset&&null!=this._cacheKeySuffix}loadCachedGPUData(e){return h(this._memCache)?this._memCache.pop(this._getMemCacheKey(e.index)):null}deleteCachedGPUData(e){h(e)&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(c(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(c(t))return!0;const s=Ie(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(c(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&&h(s.textureData)&&(s.byteSize=bt(s.transformedGeometry,s.textureData),s.textureData.every(ft)&&yt(e,s)&&this._idbCache.put(this._getCacheKey(e),s).catch((t=>tt.warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`)))),g(t),s)))))):Promise.resolve(null)}addNode(e,t,i){return pt(t)?this._addData(e,t.attributeDataInfo,(()=>this._transformNode(e,t,i).then((s=>this._safeReschedule((()=>{if(c(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,d=this.view.renderSpatialReference,u=Oe(e.mbs,this.elevationOffset,l,d);e.geometryObb=Ke([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]),N(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:bt(n,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&yt(e,_)){const t=h(_.textureData)?_.textureData.map((e=>ft(e)?e:null)):null;this._idbCache.put(this._getCacheKey(e),{..._,textureData:t}).catch((t=>tt.warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`)))}return this._addCachedNodeData(e,_,i)}),i))))):Promise.reject()}computeVisibilityObb(e){return Re(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 c=0;c<s.length;++c)r[c]=this._getVertexBufferLayout(s[c],t.geometryDescriptor);const o=e.mbs,a=this.elevationOffset,n=this._controller.crsIndex,l=this._controller.crsVertex,d=this.view.renderSpatialReference,h=Se(o,a,n),u=Oe(o,a,n,d),_=A(n,l),m=A(l,d);if(c(_)||c(m))return Promise.resolve(null);const g={context:this.i3slayer.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,localOrigin:h,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=We(this._collection.getComponentObb(t.objectHandle)),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);h(this._labeler)&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,Ye.Visible),this._updateMaterial(t),this._setNewNodeOpacity(t),this._updateEngineObject(t),this._highlights.objectCreated(t),h(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(c(t))return void this._addNodeMeta(e.index,null);const s=this._addTasks.get(e.index),{geometryData:r,transformedGeometry:a,globalTrafo:n}=t;await this.attributeOverrides.apply(r.featureIds,s.attributeInfo,i);const l=h(t.textureData)?t.textureData.filter((e=>h(e)&&0!=(e.usage&this.rendererTextureUsage))):[];!o("disable-feature:i3s-basis")&&l.some((e=>h(e)&&(e.encoding===ce.Basis||e.encoding===ce.KTX2)))&&await Ze(),e.memory=0;const{componentOffsets:d,geometries:u,featureIds:m}=r,g=this._collection,p=u[0],{layout:f,indices:b,interleavedVertexData:y,positionData:I,hasColors:v}=a,M=this._materialParameters(p,f),C=d||new Uint32Array([0,b?b.length:y.byteLength/f[0].stride]),N={vertices:{data:y,count:y.byteLength/f[0].stride,layoutParameters:M.geometryParams},positionData:{positions:I.data,indices:I.indices},indices:b,componentOffsets:C},D=p.transformation?j(p.transformation):w();S(D,n,D);const T=E(R(),D),F=x(O(),D),A=this.view.renderSpatialReference,U=this.view.basemapTerrain.spatialReference,H=R(),G=[1,1,1];P(T,A,G,U)||tt.errorOnce("Unsupported coordinate system for IM overlay"),V(T,A,H,U);const L=g.createObject({toMapSpace:[H[0],H[1],G[0],G[1]],geometry:N,obb:_(e.geometryObb),transform:{position:T,rotationScale:F}}),B=M.geometryParams.textureCoordinates===Je.Atlas,{textures:k,texturePromise:q}=this._initMaterialAndTextures(L,M.material,l,B);e.memory+=this._memEstimateGeometryAdded(L),e.memory+=k.reduce(((e,t)=>e+(h(t)?this._memEstimateTextureAdded(t):0)),0);const z=!!M.material.hasParametersFromSource,K="blend"!==M.material.alphaMode&&M.material.metallicRoughness.baseColorFactor[3]>=1,W=new st(e,m,L,this._getInvalidRendererVersion(),s.attributeInfo,{hasParametersFromSource:z,isOpaque:K},k);s.meta=W,!this._hasTextures&&t.requiredTextures.some((({usage:e})=>0!=(e&he.ColorTextures)))&&(this._hasTextures=!0),this._hasData=!0,this._hasColors=this._hasColors||v,this._hasTextures=this._hasTextures||!!e.resources.texture,this.notifyChange("hasTexturesOrVertexColors");const $=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering(W),q]).then((([t,s])=>(h(t)&&t.updateObjectVisibility(W.objectHandle,!1),this._safeReschedule((()=>{const i=this._addTasks.get(e.index);if(!i)return;if(h(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,Ye.Visible),h(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||h(t)&&(r||o))&&this._addOrUpdateEdgeRendering(W),this._visibleGeometryChanged(W),this._highlights.objectCreated(W),this._updateMaterial(W),this._setNewNodeOpacity(W),h(this._treeDebugger)&&this._treeDebugger.update()}),i)))).catch((e=>{throw h(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)){tt.error("Removing duplicated node");const t=this._nodeId2Meta.get(e);h(t)&&this._deleteComponentObject(t)}h(t)&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&Mt(t.cachedEdgeMaterials,0)),this._nodeId2Meta.set(e,t)}_safeReschedule(e,t){return g(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=gt(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=>ve(e,t,s,r)));this._stage.addMany(o);let a=null;return this._collection.updateMaterial(e,(e=>{a=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)})),{textures:o,texturePromise:a}}_getGeometryParameters(e){return{textureCoordinates:e.hasTexture?e.hasRegions?Je.Atlas:Je.Default:Je.None,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={...p(),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=>{h(e.meta)&&(this._cacheGPUData(e.meta),e.meta=null)})),this._addTasks.clear()}_clippingAreaChanged(){const e=this.view.renderSpatialReference,t=this.i3slayer.spatialReference,i=k();this._renderClippingArea=ze(this.view.clippingArea,i,e)?i:null;const s=k();this._layerClippingArea=ze(this.view.clippingArea,s,t)?s:null,this._filterChange(),this._controller&&this._controller.updateClippingArea(this.view.clippingArea),this._isIntegratedMesh&&this._modificationsChanged()}_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=>{h(e)&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e))}))}getFilters(){const e=[],t=this._renderClippingArea;return h(t)&&e.push(((e,i)=>this._boundingRectFilter(e,i,t))),e}addSqlFilter(e,t,i){if(h(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,d=h(t.attributeInfo)&&t.attributeInfo.attributeData;s.every((e=>null!=d[e]||e===n))&&Te(e,l,(e=>{o[n]=l[e];for(const i of s)i!==n&&(o[i]=Fe(d[i],e));try{return i.testFeature(a)}catch(t){return r(t),!1}}))}_boundingRectNodeTest(e,t){return U(e.node.mbs,this._controller.crsIndex,mt,this.view.renderSpatialReference),Ae(t,mt)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,lt),B(lt,dt),q(i,dt)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(r===Pe.INSIDE)return;if(r===Pe.OUTSIDE)return void(e.length=0);const o=s.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const a=this._transformClippingArea(ht,i,t.objectHandle);Te(e,t.featureIds,(e=>this._boundingRectFeatureTest(t,e,a)))}_transformClippingArea(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[0])/o[0],e[3]=(t[3]-r[1])/o[4],e}_addOrUpdateEdgeRendering(e,t=!0){const i=this._edgeView;if(c(i))return Promise.resolve(null);const s=e.objectHandle,r=i.hasObject(s),{hasEdges:o,perFeatureEdgeMaterials:a}=this._getFilteredEdgeMaterials(e),n={slicePlaneEnabled:this.slicePlaneEnabled};if(o&&r){if(this.nodeCrossfadingEnabled){Mt(a,this.getNodeOpacity(e))}return i.updateAllComponentMaterials(s,a,n,t),i.updateObjectVisibility(s,!0),Promise.resolve(i)}return o&&!r?this._collection.addEdges(s,i,a,n).then((t=>(e.edgeMemoryUsage=t,e.node.memory+=t,i))):(!o&&r&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,i.removeObject(s)),Promise.resolve(null))}_applyFiltersToNode(e){return!!this._applyFiltersToNodeComponents(e)&&(h(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);c(s)?i.delete(e):(this._collection.setObjectVisibility(s.objectHandle,Ye.Hidden),h(this._edgeView)&&this._edgeView.hasObject(s.objectHandle)&&this._edgeView.updateObjectVisibility(s.objectHandle,!1),this._visibleGeometryChanged(s),h(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),h(this._treeDebugger)&&this._treeDebugger.update())}_deleteComponentObject(e){if(h(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);h(i)&&this._collection.updateMaterial(i.objectHandle,(e=>e.polygonOffsetEnabled=t===xe.Hole))}_invalidateAllSymbols(){this._rendererVersion=Ve(this._rendererVersion,1),this._controller&&this._controller.requestUpdate()}_getInvalidRendererVersion(){return Ve(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=Ve(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 Q()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:tt.warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.getSymbols())"mesh-3d"!==t.type&&tt.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;T(i.externalColor,t[s+0]/255,t[s+1]/255,t[s+2]/255,t[s+3]/255),i.externalColorMixMode=t[s+4]&(1<<rt.CastShadows)-1,i.castShadows=0!=(t[s+4]&1<<rt.CastShadows),i.pickable=0!=(t[s+4]&1<<rt.Pickable)}}_getSymbolInfo(e,t){const i=e&&e.getSymbol(t,{arcade:this._arcade});if(!(i instanceof J))return null;const s=i.id;if(this._symbolInfos.has(s))return this._symbolInfos.get(s);const r=Ue(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=h(this._symbologyOverrideFields)&&this._symbologyOverrideFields.length>0?h(this._rendererFields)&&this._rendererFields.length>0?K(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=h(e.attributeInfo)&&e.attributeInfo.attributeData,o=null!=e.featureIds?this.i3slayer.objectIdField:null,a=null!=r&&h(this._symbologyFields)&&this._symbologyFields.length>0,n=a?[]:null,l=a?[]:null;if(a&&h(this._symbologyFields))for(const h of this._symbologyFields){const e=r[h];e&&(n.push(h),l.push(e))}e.cachedSymbology||(e.cachedSymbology=new Uint8Array(5*e.featureIds.length));const d={color:ut,castShadows:!0,pickable:!0,colorMixMode:ke.Multiply,edgeMaterial:null},u=this.fullOpacity,_=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):u;let m=null,g=et.OPAQUE,p=He,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]]=Fe(l[e],b);const r=this._getSymbolInfo(s,t);let u=null,y=null;if(s&&"visualVariables"in s){if(this._colorVariable){const e=X(this._colorVariable,t,{color:_t,arcade:this._arcade});e&&(u=ut,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=Y(this._opacityVariable,t,{arcade:this._arcade}))}if(r&&r.material){const e=r.material;u=c(u)||c(y)?de(u,y,e.color,e.alpha,it,ut):de(u,y,null,null,it,ut)}if(c(u)&&(u=ut,u[0]=1,u[1]=1,u[2]=1,u[3]=1),d.pickable=!0,d.castShadows=!r||r.castShadows,d.colorMixMode=r&&r.material?r.material.colorMixMode:ke.Multiply,d.edgeMaterial=r?r.edgeMaterial:null,h(this._symbologyOverride)&&(d.color=u,this._symbologyOverride(t,d),u=d.color),h(d.edgeMaterial)){const t=u[3]<=0?et.INVISIBLE:u[3]>=1&&(e.material.isOpaque||d.colorMixMode===ke.Replace)?et.OPAQUE:et.TRANSPARENT;d.edgeMaterial===m&&t===g||(p={...d.edgeMaterial,opacity:_,objectTransparency:t},m=d.edgeMaterial,g=t),e.cachedEdgeMaterials[b]=p}else e.cachedEdgeMaterials[b]=He;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]=d.colorMixMode|+d.castShadows<<rt.CastShadows|+d.pickable<<rt.Pickable,f+=5}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);if(this.nodeCrossfadingEnabled||Mt(t,this.fullOpacity),c(e.filteredIds)){return{hasEdges:t.some((e=>e!==He)),perFeatureEdgeMaterials:t}}let i=0,s=!1;const r=t.map(((t,r)=>e.featureIds[r]!==e.filteredIds[i]?He:(s=s||t!==He,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=>{c(t)||(this._collection.updateMaterial(t.objectHandle,(t=>t.objectOpacity=e)),Mt(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.slicePlaneEnabled=e),h(this._labeler)&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach((t=>{c(t)||(this._collection.updateMaterial(t.objectHandle,(t=>{t.commonMaterialParameters.slicePlaneEnabled=e})),this._updateEdgeRendering(t,!1))}))}_updatePBR(){this._nodeId2Meta.forEach((e=>{c(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){h(this._edgeView)&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_forAllFeatures(e,t,i=se.VISIBLE_ONLY){n(this._nodeId2Meta,(s=>{if(c(s))return!1;if(h(t)){switch(t(s)){case re.EXIT:return!0;case re.SKIP:return!1}}let r=re.CONTINUE;switch(i){case se.ALL:r=this._forAllFeaturesOfNode(s,e);break;case se.VISIBLE_ONLY:r=this._forVisibleFeaturesOfNode(s,e);break;case se.ALL_IN_CLIPPING_AREA:r=this._forAllFeaturesOfNodeInClippingArea(s,e)}return r===re.EXIT}))}_forAllFeaturesOfNode(e,t){let i=re.CONTINUE;const s=e.featureIds;for(let r=0;r<s.length;r++)if(i=t(s[r],r,e),i===re.EXIT)return i;return i}_forVisibleFeaturesOfNode(e,t){let i=re.CONTINUE;const s=e.featureIds;return this._collection.forEachVisibleComponent(e.objectHandle,(r=>(i=t(s[r],r,e),i===re.CONTINUE))),i}_forAllFeaturesOfNodeInClippingArea(e,t){if(c(this._renderClippingArea))return this._forAllFeaturesOfNode(e,t);const i=this._boundingRectNodeTest(e,this._renderClippingArea);if(i===Pe.OUTSIDE)return re.CONTINUE;if(i===Pe.INSIDE)return this._forAllFeaturesOfNode(e,t);const s=re.CONTINUE,r=e.featureIds,o=e.objectHandle,a=Ge(this._renderClippingArea,this._collection.getObjectTransform(o));for(let n=0;n<r.length;n++){if(!this._boundingRectFeatureTest(e,n,a))continue;const i=t(r[n],n,e);if(i===re.EXIT)return i}return s}_createAttributes(e,t){const i={};null!=t.featureIds&&(i[this._getObjectIdField()]=t.featureIds[e]);const s=h(t.attributeInfo)&&t.attributeInfo.attributeData;if(h(s))for(const r of Object.keys(s))i[r]=Fe(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 r&&(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=>Be(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 vt}_visibleGeometryChanged(e){this._elevationProvider&&(this._elevationProvider.objectChanged(e.node),null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=b((()=>{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 h(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),re.CONTINUE)),null,se.VISIBLE_ONLY),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 h(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);h(s)&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);h(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(!h(this._edgeView)||!e.cachedEdgeMaterials)return;Mt(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t)}get hasModifications(){return this._isIntegratedMesh&&h(this._layerClippingArea)||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=It(e);if(h(s)){const t={context:i,buffer:s.buffer};ne(t);const r=new Float64Array(s.buffer);e.forAll(((e,t)=>{const i=r[t],s=le(i);e.imModificationImpact=s,s!==Ce.Unmodified&&this._controller.invalidateGeometryVisibility(e.index)}))}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||h(this._labeler)&&this._labeler.updating||this._crossfadeHelper.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0}};return e([M()],s.prototype,"_hasLoadedPBRTextures",void 0),e([M()],s.prototype,"_asyncModuleLoading",void 0),e([M()],s.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([M()],s.prototype,"view",void 0),e([M()],s.prototype,"i3slayer",void 0),e([M()],s.prototype,"_controller",void 0),e([M()],s.prototype,"_labeler",void 0),e([M()],s.prototype,"updating",void 0),e([M()],s.prototype,"suspended",void 0),e([M()],s.prototype,"holeFilling",void 0),e([M($e)],s.prototype,"updatingProgress",void 0),e([M({readOnly:!0,aliasOf:"_controller.updatingProgress"})],s.prototype,"updatingProgressValue",void 0),e([M({readOnly:!0})],s.prototype,"hasTexturesOrVertexColors",null),e([M({readOnly:!0})],s.prototype,"rendererTextureUsage",null),e([M()],s.prototype,"filter",void 0),e([M({readOnly:!0})],s.prototype,"elevationOffset",null),e([M({type:Boolean})],s.prototype,"slicePlaneEnabled",void 0),e([M()],s.prototype,"supportedTextureEncodings",null),e([M()],s.prototype,"uncompressedTextureDownsamplingEnabled",null),e([M({type:[$]})],s.prototype,"_modifications",void 0),s=e([C("esri.views.3d.layers.I3SMeshView3D")],s),s},lt=H(),dt=k(),ht=k(),ct=Ke(),ut=[0,0,0,0],_t=new t([0,0,0,0]),mt=[0,0,0,0];function gt(e){const t=e.metallicRoughness;return t&&t.baseColorTextureId>=0||t&&t.metallicRoughnessTextureId>=0||e.normalTextureId>=0||e.emissiveTextureId>=0||e.occlusionTextureId>=0}function pt(e){return"geometryData"in e}function ft(e){return h(e)&&y(e.data)}function bt(e,t){let i=1024+e.interleavedVertexData.byteLength+(e.indices?e.indices.byteLength:0)+e.positionData.data.byteLength+e.positionData.indices.byteLength;if(h(t))for(const s of t)h(s)&&y(s.data)&&(i+=s.data.byteLength);return i}function yt(e,t){return t.byteSize>at?(tt.warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}function It(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;c(s)&&(s=ct,D(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 vt={remove(){},pause(){},resume(){}};function Mt(e,t){e.forEach((e=>e.opacity=t))}export{nt as I3SMeshView3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{isNone as i,disposeMaybe as r,destroyMaybe as l}from"../../../core/maybe.js";import{isAborted as s}from"../../../core/promiseUtils.js";import{whenTrueOnce as o}from"../../../core/watchUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import h from"../../2d/engine/vectorTiles/SchemaHelper.js";import c from"../../2d/engine/vectorTiles/TileHandler3D.js";import p from"../../2d/engine/vectorTiles/VTLPainter3D.js";import m from"../../2d/engine/vectorTiles/style/StyleRepository.js";import{LayerView3D as d}from"./LayerView3D.js";import{TiledLayerView3D as y}from"./TiledLayerView3D.js";import{test as f}from"../terrain/terrainUtils.js";import u from"../../layers/LayerView.js";let g=class extends(y(d(u))){constructor(){super(...arguments),this.type="vector-tile-3d"}initialize(){if(i(this.layer.fullExtent))return void this.addResolvingPromise(Promise.reject(new t("vectortilelayerview:full-extent-undefined","This layer view's layer does not define a fullExtent.")));const e=f.force512VTL?this.layer.tileInfo:this.layer.compatibleTileInfo256,r=this._getTileInfoSupportError(e,this.layer.fullExtent);if(r)return this.addResolvingPromise(Promise.reject(r));const{basemapTerrain:l,spatialReference:n,pixelRatio:a}=this.view,d=o(this.view,"basemapTerrain.tilingSchemeLocked").then((()=>{const e=l.tilingScheme,t=e.pixelSize;let i;this.schemaHelper=new h(t,n.isGeographic),i=256===t?this.layer.compatibleTileInfo256:this.view.spatialReference.isGeographic?this.layer.compatibleTileInfo512:this.layer.tileInfo;const r=this._getTileInfoCompatibilityError(i,e);if(r)throw r;this._set("tileInfo",i)}));this._tileHandlerController=new AbortController;const y=this.view.resourceController;this._memCache=y.memoryController.newCache(this.layer.uid,(e=>{e.release()}));const{style:u}=this.layer.currentStyleInfo,g=new m(u),_=l.mapTileRequester;this._tileHandler=new c(this.layer,g,a,this._memCache,_);const v=this._tileHandlerController.signal,H=e=>y.schedule(e),w=this._tileHandler.start({signal:v,schedule:H}),C=this._tileHandler.spriteMosaic;C.then((e=>{!s(v)&&this._tileHandler&&(this.painter=new p(e,this._tileHandler.glyphMosaic))})),w.then((()=>this._tileHandlerController=null));const T=()=>{this._tileHandlerController&&this._tileHandlerController.abort(),this._tileHandlerController=new AbortController,this._memCache.clear();const{style:e}=this.layer.currentStyleInfo,t=new m(e),i=new c(this.layer,t,a,this._memCache,_),r=i.start({signal:this._tileHandlerController.signal,schedule:H}),l=i.spriteMosaic;r.then((()=>this._tileHandlerController=null)),this.updatingHandles.addPromise(Promise.all([r,l]).then((([,e])=>{const t=this._tileHandler,r=this.painter;this.painter=new p(e,i.glyphMosaic),this._tileHandler=i,this.emit("data-changed"),t.destroy(),r&&r.dispose()})))};this.updatingHandles.add((()=>[this.layer.currentStyleInfo,this.view.pixelRatio]),T);const j=Promise.all([d,w,C]);this.addResolvingPromise(j)}destroy(){this.painter=r(this.painter),this._tileHandlerController&&(this._tileHandlerController.abort(),this._tileHandlerController=null),l(this._tileHandler),this._memCache=l(this._memCache),this._tileHandler=null}get dataLevelRange(){const e=this.tileInfo.lods,t=e[0].scale,i=e[e.length-1].scale,r=this.levelRangeFromScaleRange(t,i);return 1===r.minLevel&&256===this.tileInfo.size[0]&&(r.minLevel=0),r}async fetchTile(e,t,i,r){return this._tileHandler.getVectorTile(e,t,i,r)}};e([n({aliasOf:"layer.fullExtent"})],g.prototype,"fullExtent",void 0),e([n()],g.prototype,"layer",void 0),e([n()],g.prototype,"tileInfo",void 0),e([n()],g.prototype,"dataLevelRange",null),e([n()],g.prototype,"updatingProgressValue",void 0),g=e([a("esri.views.3d.layers.VectorTileLayerView3D")],g);const _=g;export{_ as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{isNone as r,disposeMaybe as i,destroyMaybe as l}from"../../../core/maybe.js";import{isAborted as s}from"../../../core/promiseUtils.js";import{whenTrueOnce as o}from"../../../core/watchUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{SchemaHelper as h}from"../../2d/engine/vectorTiles/SchemaHelper.js";import c from"../../2d/engine/vectorTiles/TileHandler3D.js";import p from"../../2d/engine/vectorTiles/VTLPainter3D.js";import m from"../../2d/engine/vectorTiles/style/StyleRepository.js";import{LayerView3D as d}from"./LayerView3D.js";import{TiledLayerView3D as y}from"./TiledLayerView3D.js";import{test as f}from"../terrain/terrainUtils.js";import u from"../../layers/LayerView.js";let g=class extends(y(d(u))){constructor(){super(...arguments),this.type="vector-tile-3d"}initialize(){if(r(this.layer.fullExtent))return void this.addResolvingPromise(Promise.reject(new t("vectortilelayerview:full-extent-undefined","This layer view's layer does not define a fullExtent.")));const e=f.force512VTL?this.layer.tileInfo:this.layer.tileInfo.getOrCreateCompatible(256),i=this._getTileInfoSupportError(e,this.layer.fullExtent);if(i)return this.addResolvingPromise(Promise.reject(i));const{basemapTerrain:l,spatialReference:n,pixelRatio:a}=this.view,d=o(this.view,"basemapTerrain.tilingSchemeLocked").then((()=>{const e=l.tilingScheme,t=e.pixelSize;let r;this.schemaHelper=new h(t,n.isGeographic),r=256===t?this.layer.tileInfo.getOrCreateCompatible(256):this.view.spatialReference.isGeographic?this.layer.tileInfo.getOrCreateCompatible(512):this.layer.tileInfo;const i=this._getTileInfoCompatibilityError(r,e);if(i)throw i;this._set("tileInfo",r)}));this._tileHandlerController=new AbortController;const y=this.view.resourceController;this._memCache=y.memoryController.newCache(this.layer.uid,(e=>{e.release()}));const{style:u}=this.layer.currentStyleInfo,g=new m(u),_=l.mapTileRequester;this._tileHandler=new c(this.layer,g,a,this._memCache,_);const C=this._tileHandlerController.signal,v=e=>y.schedule(e),H=this._tileHandler.start({signal:C,schedule:v}),w=this._tileHandler.spriteMosaic;w.then((e=>{!s(C)&&this._tileHandler&&(this.painter=new p(e,this._tileHandler.glyphMosaic))})),H.then((()=>this._tileHandlerController=null));const j=()=>{this._tileHandlerController&&this._tileHandlerController.abort(),this._tileHandlerController=new AbortController,this._memCache.clear();const{style:e}=this.layer.currentStyleInfo,t=new m(e),r=new c(this.layer,t,a,this._memCache,_),i=r.start({signal:this._tileHandlerController.signal,schedule:v}),l=r.spriteMosaic;i.then((()=>this._tileHandlerController=null)),this.updatingHandles.addPromise(Promise.all([i,l]).then((([,e])=>{const t=this._tileHandler,i=this.painter;this.painter=new p(e,r.glyphMosaic),this._tileHandler=r,this.emit("data-changed"),t.destroy(),i&&i.dispose()})))};this.updatingHandles.add((()=>[this.layer.currentStyleInfo,this.view.pixelRatio]),j);const T=Promise.all([d,H,w]);this.addResolvingPromise(T)}destroy(){this.painter=i(this.painter),this._tileHandlerController&&(this._tileHandlerController.abort(),this._tileHandlerController=null),l(this._tileHandler),this._memCache=l(this._memCache),this._tileHandler=null}get dataLevelRange(){const e=this.tileInfo.lods,t=e[0].scale,r=e[e.length-1].scale,i=this.levelRangeFromScaleRange(t,r);return 1===i.minLevel&&256===this.tileInfo.size[0]&&(i.minLevel=0),i}async fetchTile(e,t,r,i){return this._tileHandler.getVectorTile(e,t,r,i)}};e([n({aliasOf:"layer.fullExtent"})],g.prototype,"fullExtent",void 0),e([n()],g.prototype,"layer",void 0),e([n()],g.prototype,"tileInfo",void 0),e([n()],g.prototype,"dataLevelRange",null),e([n()],g.prototype,"updatingProgressValue",void 0),g=e([a("esri.views.3d.layers.VectorTileLayerView3D")],g);const _=g;export{_ 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.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as i}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{lerp as s}from"../../../../core/mathUtils.js";import{isNone as e,isSome as r}from"../../../../core/maybe.js";import a from"../../../../core/PooledArray.js";import{property as o}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{a as n}from"../../../../chunks/mat4.js";import{c as h}from"../../../../chunks/mat4f64.js";import{a as l}from"../../../../chunks/vec2f64.js";import{m as p,a as u,s as d,g as f}from"../../../../chunks/vec3.js";import{Z as m,c as g}from"../../../../chunks/vec3f64.js";import{s as b,t as v,b as y}from"../../../../chunks/vec4.js";import{c as _}from"../../../../chunks/vec4f64.js";import{getReferenceEllipsoid as G}from"../../../../geometry/projectionEllipsoid.js";import{create as S,empty as B,offset as w,width as D,height as N,expand as j,intersects as I}from"../../../../geometry/support/aaBoundingRect.js";import{c as V,a as P,e as C}from"../../../../chunks/boundedPlane.js";import{create as A}from"../../../../geometry/support/ray.js";import{d as O,g as x,e as M,c as T}from"../../../../chunks/sphere.js";import{drawAccelerationStruct as z,prepare as E,drawPoly as F}from"./deconflictorDebug.js";import{VisibilityGroup as X,VisibilityFlag as R}from"./enums.js";import L from"../../support/debugFlags.js";import{VertexAttribute as Y}from"../../webgl-engine/lib/basicInterfaces.js";import k from"../../webgl-engine/lib/Camera.js";import{applyPrecomputedScaleFactor as W}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{HUDMaterial as U}from"../../webgl-engine/materials/HUDMaterial.js";const H=g(),Z=_(),q=_(),J=g(),K=h(),Q=T(),$=A(),ii=g(),ti=S();class si{constructor(){this.aabr=S(),this.distance=0,this.culled=!1,this.visible=!1}}class ei{constructor(i,t,s={}){this.graphics3DGraphic=i,this.slicePlaneEnabled=t,this.info=s}}class ri{constructor(){this.active=new Map,this.visible=new Map}clear(){this.active.clear(),this.visible.clear()}}class ai{}class oi{constructor(){this.sortArray=new a({allocator:i=>i||new ai})}}var ci;!function(i){i[i.Idle=0]="Idle",i[i.Process=1]="Process",i[i.Sort=2]="Sort",i[i.Deconflict=3]="Deconflict",i[i.NumStates=4]="NumStates"}(ci||(ci={}));class ni{constructor(){this.camera=new k,this.slicePlane=V(),this.slicePlaneEnabled=!1}copyFrom(i){this.camera.copyFrom(i.camera),P(i.slicePlane,this.slicePlane),this.slicePlaneEnabled=i.slicePlaneEnabled}}let hi=class extends t{constructor(){super(...arguments),this._dirty=!1,this._runningViewState=new ni,this._state=ci.Idle,this.graphics=new ri,this.iterators=new oi,this.accBinsNumX=15,this.accBinsNumY=20,this.accBinsSizeX=0,this.accBinsSizeY=0,this.accBins=null,this.accNumTests=0}get dirty(){return this._dirty}get state(){return this._state}destroy(){this.graphics.clear(),this.iterators=null}setDirty(){!this._dirty&&this.graphics.active.size>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._state!==ci.Idle||this._dirty}get updatingProgress(){if(!this.updating)return 1;const i=this._state/ci.NumStates;return this._dirty?.5*i:i}get running(){return this.view.ready&&null!=this.view.state&&this.updating}runTask(i){switch(this._state){case ci.Idle:this._startUpdate(),i.madeProgress();case ci.Process:if(this._state=ci.Process,!this._processActiveGraphics(i))return;case ci.Sort:if(this._state=ci.Sort,!this._sortVisibleGraphics(i))return;case ci.Deconflict:if(this._state=ci.Deconflict,!this._deconflictVisibleGraphics(i))return;default:z(this,this.graphics.visible),this._state=ci.Idle,this.notifyChange("updating")}}modifyGraphics(i,t){t?i.forEach((i=>this.addToActiveGraphics(i))):i.forEach((i=>this.removeFromActiveGraphics(i))),this.setDirty()}layerSupportsDeconfliction(i){if(e(i)||"object3d"!==i.type)return!1;const t=i.stageObject;if(1!==(t?t.geometryRecords.length:0))return!1;return t.geometryRecords[0].material instanceof U}_startUpdate(){E(this.view),this._dirty=!1,this._runningViewState.copyFrom(this.viewState);const{fullWidth:i,fullHeight:t}=this._runningViewState.camera;this._initBins(i,t),this._resetIterators()}addToActiveGraphics(i){i.info[this.visibilityGroup]=new si,this.graphics.active.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromActiveGraphics(i){this._removeFromVisibleGraphics(i),li(i,this.visibilityGroup),delete i.info[this.visibilityGroup],this.graphics.active.delete(i.graphics3DGraphic.graphic.uid),this.setDirty()}_addToVisibleGraphics(i){this.graphics.visible.set(i.graphics3DGraphic.graphic.uid,i)}_removeFromVisibleGraphics(i){this.graphics.visible.delete(i.graphics3DGraphic.graphic.uid)}_processActiveGraphics(i){const t=this._ensureActiveGraphicsIterator(),s=n(K,this._runningViewState.camera.projectionMatrix),e="global"===this.view.viewingMode&&1===this.view.map.ground.opacity&&this._runningViewState.camera.relativeElevation>0?Q:null;let a=0;for(r(e)&&(p(e,m,this._runningViewState.camera.viewMatrix),e[3]=G(this.view.spatialReference).radius,a=O(e,m));!i.done;){i.madeProgress();const r=t.next();if(!0===r.done)return this._resetActiveGraphicsIterator(),!0;const o=r.value,c=o&&o.info[this.visibilityGroup];c&&(this._collectGraphics3DGraphics(o,s,e,a),c.culled?this._removeFromVisibleGraphics(o):this._addToVisibleGraphics(o))}return!1}_sortVisibleGraphics(i){const t=this._ensureSortGraphicsIterator();for(;!i.done;){const s=t.next();if(i.madeProgress(),!0===s.done)return this._resetSortGraphicsIterator(),!0}return!1}_deconflictVisibleGraphics(i){const t=this._ensureVisibleGraphicsIterator(),s=this.visibilityGroup===X.LABEL;for(;!i.done;){i.madeProgress();const e=t.next();if(!0===e.done)return this._resetVisibleGraphicsIterator(),!0;const r=e.value,a=r.info[this.visibilityGroup];if(!a||a.culled)continue;const o=r.graphics3DGraphic,c=(!s||o.isVisible())&&!this._isConflicted(r);c&&this._addToBins(r),a.visible=c,this._setGraphicVisibility(r,c),F(a,c)}return!1}_resetIterators(){this.iterators.active=null,this.iterators.visible=null,this.iterators.sort=null}_ensureActiveGraphicsIterator(){return this.iterators.active||(this.iterators.active=pi(this.graphics.active)),this.iterators.active}_resetActiveGraphicsIterator(){this.iterators.active=null}_ensureVisibleGraphicsIterator(){return this.iterators.visible||(this.iterators.visible=pi(this.graphics.visible)),this.iterators.visible}_resetVisibleGraphicsIterator(){this.iterators.visible=null}_ensureSortGraphicsIterator(){return this.iterators.sort||(this.iterators.sort=ui(this.graphics.visible,this.iterators.sortArray,this.visibilityGroup)),this.iterators.sort}_resetSortGraphicsIterator(){this.iterators.sort=null}_collectGraphics3DGraphics(i,t,s,a){const o=i.graphics3DGraphic;if(o.destroyed)return;const c=i.info[this.visibilityGroup];if(!o.isVisible(X.GRAPHIC,R.DECONFLICTION))return void(c.culled=!0);const n=this.getGraphicsLayers(o);B(c.aabr);let h=null;for(const l of n){if(!this.layerSupportsDeconfliction(l))continue;const o=l.stageObject.geometryRecords[0].material;if(e(h)){if(h=this._getProjectionInfo(l,t,mi),h.isOutsideScreen||this._isCulledBySlice(i,H)||r(s)&&this._isCulledByHorizon(h,s,a))return void(c.culled=!0);!L.TESTS_DISABLE_OPTIMIZATIONS&&c.visible&&(h.distance*=.7)}this._expandBoundingRect(c,l,o,h)}e(h)?c.culled=!0:(c.distance=h.distance,c.culled=!1)}_getProjectionInfo(i,t,s){const e=this._runningViewState.camera,r=i.stageObject,a=r.geometryRecords[0],o=a.material,c=x(r.boundingVolumeWorldSpace.bounds);p(H,c,e.viewMatrix);const n=a.geometry.vertexAttributes,h=n.get(Y.NORMAL).data,l=n.get(Y.AUXPOS1).data;return o.applyShaderOffsetsView(H,h,r.transformation,l,e,s.scaleInfo,H),b(Z,H[0],H[1],H[2],1),v(q,Z,e.projectionMatrix),u(s.positionNDC,q,1/q[3]),o.applyShaderOffsetsNDC(s.positionNDC,l,e,s.positionNDC,J),s.distanceWithoutPolygonOffset=e.depthNDCToWorld(J[2]),s.distance=J[2]===s.positionNDC[2]?s.distanceWithoutPolygonOffset:e.depthNDCToWorld(s.positionNDC[2]),b(q,s.positionNDC[0],s.positionNDC[1],s.positionNDC[2],1),v(Z,q,t),y(Z,Z,1/Z[3]),d(s.positionView,H[0],H[1],H[2]),s}_isCulledByHorizon(i,t,s){return f($.direction,i.positionView),d($.origin,0,0,0),!!M(t,$,ii)&&i.distanceWithoutPolygonOffset>s}_isCulledBySlice(i,t){return i.slicePlaneEnabled&&this._runningViewState.slicePlaneEnabled&&C(this._runningViewState.slicePlane,t)}_expandBoundingRect(i,t,e,{positionNDC:r,scaleInfo:a}){const o=this._runningViewState.camera,c=t.getScreenSize(di);W(c,a.factor,c),c[0]*=o.pixelRatio,c[1]*=o.pixelRatio;const n=w(e.calculateRelativeScreenBounds(c,a.factorAlignment.scale,ti),s(0,o.fullWidth,.5+.5*r[0]),s(0,o.fullHeight,.5+.5*r[1])),h=this.iconMarginFactor;if(0!==h){const i=h*Math.min(D(n),N(n));n[0]-=i,n[1]-=i,n[2]+=i,n[3]+=i}j(i.aabr,n,i.aabr)}_isConflicted(i){const t=i.graphics3DGraphic.graphic.uid,s=i.info[this.visibilityGroup];for(let e=Math.floor(s.aabr[0]/this.accBinsSizeX);e<=Math.floor(s.aabr[2]/this.accBinsSizeX);e++)if(!(e<0||e>=this.accBinsNumX))for(let i=Math.floor(s.aabr[1]/this.accBinsSizeY);i<=Math.floor(s.aabr[3]/this.accBinsSizeY);i++){if(i<0||i>=this.accBinsNumY)continue;const r=this.accBins[e][i];for(let i=0;i<r.length;i++){const e=r.data[i],a=e.info[this.visibilityGroup];if(a&&a.visible&&(e.graphics3DGraphic.graphic.uid!==t&&(this.accNumTests++,I(a.aabr,s.aabr))))return!0}}return!1}_initBins(i,t){if(null==this.accBins){this.accBins=[];for(let i=0;i<this.accBinsNumX;i++){this.accBins.push([]);const i=this.accBins[this.accBins.length-1];for(let t=0;t<this.accBinsNumY;t++)i.push(new a)}}else for(let s=0;s<this.accBinsNumX;s++)for(let i=0;i<this.accBinsNumY;i++)this.accBins[s][i].clear();this.accBinsSizeX=i/this.accBinsNumX,this.accBinsSizeY=t/this.accBinsNumY,this.accNumTests=0}_addToBins(i){const t=i.info[this.visibilityGroup],s=Math.floor(t.aabr[0]/this.accBinsSizeX),e=Math.floor(t.aabr[2]/this.accBinsSizeX),r=Math.floor(t.aabr[1]/this.accBinsSizeY),a=Math.floor(t.aabr[3]/this.accBinsSizeY);for(let o=s;o<=e;o++)if(!(o<0||o>=this.accBinsNumX))for(let t=r;t<=a;t++)t<0||t>=this.accBinsNumY||this.accBins[o][t].push(i)}_setGraphicVisibility(i,t){const s=i.graphics3DGraphic;s.destroyed||(s.setVisibilityFlag(R.DECONFLICTION,t,this.visibilityGroup),this.visibilityGroup===X.LABEL&&this.view.labeler.setLabelGraphicVisibility(s,t))}};function li(i,t){const s=i.graphics3DGraphic;s.destroyed||s.clearVisibilityFlag(R.DECONFLICTION,t)}function*pi(i){if(Map.prototype.entries){const t=i.entries();for(let i=t.next();!i.done;i=t.next())yield i.value[1]}else yield*i.values()}function*ui(i,t,s){t.clear(),i.forEach(((i,e)=>{const r=t.pushNew();r.id=e,r.prio=i.info?-i.info[s].distance:Number.MAX_VALUE})),yield;const e=t.iterableSort(((i,t)=>t.prio-i.prio));for(let r=e.next();!r.done;r=e.next())yield;t.forAll((t=>{const s=i.get(t.id);s&&(i.delete(t.id),i.set(t.id,s))})),t.clear()}i([o({constructOnly:!0})],hi.prototype,"view",void 0),i([o({type:Boolean,readOnly:!0})],hi.prototype,"updating",null),hi=i([c("esri.views.3d.layers.graphics.Deconflictor")],hi);const di=l();class fi{constructor(){this.positionView=g(),this.positionNDC=g(),this.distance=0,this.distanceWithoutPolygonOffset=0,this.scaleInfo={factor:{scale:0,factor:0,minPixelSize:0,paddingPixels:0},factorAlignment:{scale:0,factor:0,minPixelSize:0,paddingPixels:0}}}get isOutsideScreen(){const i=this.positionNDC;return i[0]<-1||i[1]<-1||i[2]<-1||i[0]>=1||i[1]>=1}}const mi=new fi;export{hi as Deconflictor,ei as DeconflictorGraphic,ni as DeconflictorViewState,ci as State};
5
+ import{_ as i}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{lerp as s}from"../../../../core/mathUtils.js";import{isNone as e,isSome as r}from"../../../../core/maybe.js";import a from"../../../../core/PooledArray.js";import{property as o}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{a as n}from"../../../../chunks/mat4.js";import{c as h}from"../../../../chunks/mat4f64.js";import{a as l}from"../../../../chunks/vec2f64.js";import{m as p,a as u,s as d,g as f}from"../../../../chunks/vec3.js";import{Z as m,c as g}from"../../../../chunks/vec3f64.js";import{s as b,t as v,b as y}from"../../../../chunks/vec4.js";import{c as _}from"../../../../chunks/vec4f64.js";import{getReferenceEllipsoid as G}from"../../../../geometry/projectionEllipsoid.js";import{create as S,empty as B,offset as w,width as D,height as N,expand as j,intersects as V}from"../../../../geometry/support/aaBoundingRect.js";import{c as I,a as P,e as C}from"../../../../chunks/boundedPlane.js";import{create as A}from"../../../../geometry/support/ray.js";import{d as x,g as O,e as M,c as T}from"../../../../chunks/sphere.js";import{drawAccelerationStruct as z,prepare as E,drawPoly as F}from"./deconflictorDebug.js";import{VisibilityGroup as X,VisibilityFlag as R}from"./enums.js";import L from"../../support/debugFlags.js";import Y from"../../webgl-engine/lib/Camera.js";import{applyPrecomputedScaleFactor as k}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as W}from"../../webgl-engine/lib/VertexAttribute.js";import{HUDMaterial as U}from"../../webgl-engine/materials/HUDMaterial.js";const H=g(),Z=_(),q=_(),J=g(),K=h(),Q=T(),$=A(),ii=g(),ti=S();class si{constructor(){this.aabr=S(),this.distance=0,this.culled=!1,this.visible=!1}}class ei{constructor(i,t,s={}){this.graphics3DGraphic=i,this.slicePlaneEnabled=t,this.info=s}}class ri{constructor(){this.active=new Map,this.visible=new Map}clear(){this.active.clear(),this.visible.clear()}}class ai{}class oi{constructor(){this.sortArray=new a({allocator:i=>i||new ai})}}var ci;!function(i){i[i.Idle=0]="Idle",i[i.Process=1]="Process",i[i.Sort=2]="Sort",i[i.Deconflict=3]="Deconflict",i[i.NumStates=4]="NumStates"}(ci||(ci={}));class ni{constructor(){this.camera=new Y,this.slicePlane=I(),this.slicePlaneEnabled=!1}copyFrom(i){this.camera.copyFrom(i.camera),P(i.slicePlane,this.slicePlane),this.slicePlaneEnabled=i.slicePlaneEnabled}}let hi=class extends t{constructor(){super(...arguments),this._dirty=!1,this._runningViewState=new ni,this._state=ci.Idle,this.graphics=new ri,this.iterators=new oi,this.accBinsNumX=15,this.accBinsNumY=20,this.accBinsSizeX=0,this.accBinsSizeY=0,this.accBins=null,this.accNumTests=0}get dirty(){return this._dirty}get state(){return this._state}destroy(){this.graphics.clear(),this.iterators=null}setDirty(){!this._dirty&&this.graphics.active.size>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._state!==ci.Idle||this._dirty}get updatingProgress(){if(!this.updating)return 1;const i=this._state/ci.NumStates;return this._dirty?.5*i:i}get running(){return this.view.ready&&null!=this.view.state&&this.updating}runTask(i){switch(this._state){case ci.Idle:this._startUpdate(),i.madeProgress();case ci.Process:if(this._state=ci.Process,!this._processActiveGraphics(i))return;case ci.Sort:if(this._state=ci.Sort,!this._sortVisibleGraphics(i))return;case ci.Deconflict:if(this._state=ci.Deconflict,!this._deconflictVisibleGraphics(i))return;default:z(this,this.graphics.visible),this._state=ci.Idle,this.notifyChange("updating")}}modifyGraphics(i,t){t?i.forEach((i=>this.addToActiveGraphics(i))):i.forEach((i=>this.removeFromActiveGraphics(i))),this.setDirty()}layerSupportsDeconfliction(i){if(e(i)||"object3d"!==i.type)return!1;const t=i.stageObject;if(1!==(t?t.geometryRecords.length:0))return!1;return t.geometryRecords[0].material instanceof U}_startUpdate(){E(this.view),this._dirty=!1,this._runningViewState.copyFrom(this.viewState);const{fullWidth:i,fullHeight:t}=this._runningViewState.camera;this._initBins(i,t),this._resetIterators()}addToActiveGraphics(i){i.info[this.visibilityGroup]=new si,this.graphics.active.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromActiveGraphics(i){this._removeFromVisibleGraphics(i),li(i,this.visibilityGroup),delete i.info[this.visibilityGroup],this.graphics.active.delete(i.graphics3DGraphic.graphic.uid),this.setDirty()}_addToVisibleGraphics(i){this.graphics.visible.set(i.graphics3DGraphic.graphic.uid,i)}_removeFromVisibleGraphics(i){this.graphics.visible.delete(i.graphics3DGraphic.graphic.uid)}_processActiveGraphics(i){const t=this._ensureActiveGraphicsIterator(),s=n(K,this._runningViewState.camera.projectionMatrix),e="global"===this.view.viewingMode&&1===this.view.map.ground.opacity&&this._runningViewState.camera.relativeElevation>0?Q:null;let a=0;for(r(e)&&(p(e,m,this._runningViewState.camera.viewMatrix),e[3]=G(this.view.spatialReference).radius,a=x(e,m));!i.done;){i.madeProgress();const r=t.next();if(!0===r.done)return this._resetActiveGraphicsIterator(),!0;const o=r.value,c=o&&o.info[this.visibilityGroup];c&&(this._collectGraphics3DGraphics(o,s,e,a),c.culled?this._removeFromVisibleGraphics(o):this._addToVisibleGraphics(o))}return!1}_sortVisibleGraphics(i){const t=this._ensureSortGraphicsIterator();for(;!i.done;){const s=t.next();if(i.madeProgress(),!0===s.done)return this._resetSortGraphicsIterator(),!0}return!1}_deconflictVisibleGraphics(i){const t=this._ensureVisibleGraphicsIterator(),s=this.visibilityGroup===X.LABEL;for(;!i.done;){i.madeProgress();const e=t.next();if(!0===e.done)return this._resetVisibleGraphicsIterator(),!0;const r=e.value,a=r.info[this.visibilityGroup];if(!a||a.culled)continue;const o=r.graphics3DGraphic,c=(!s||o.isVisible())&&!this._isConflicted(r);c&&this._addToBins(r),a.visible=c,this._setGraphicVisibility(r,c),F(a,c)}return!1}_resetIterators(){this.iterators.active=null,this.iterators.visible=null,this.iterators.sort=null}_ensureActiveGraphicsIterator(){return this.iterators.active||(this.iterators.active=pi(this.graphics.active)),this.iterators.active}_resetActiveGraphicsIterator(){this.iterators.active=null}_ensureVisibleGraphicsIterator(){return this.iterators.visible||(this.iterators.visible=pi(this.graphics.visible)),this.iterators.visible}_resetVisibleGraphicsIterator(){this.iterators.visible=null}_ensureSortGraphicsIterator(){return this.iterators.sort||(this.iterators.sort=ui(this.graphics.visible,this.iterators.sortArray,this.visibilityGroup)),this.iterators.sort}_resetSortGraphicsIterator(){this.iterators.sort=null}_collectGraphics3DGraphics(i,t,s,a){const o=i.graphics3DGraphic;if(o.destroyed)return;const c=i.info[this.visibilityGroup];if(!o.isVisible(X.GRAPHIC,R.DECONFLICTION))return void(c.culled=!0);const n=this.getGraphicsLayers(o);B(c.aabr);let h=null;for(const l of n){if(!this.layerSupportsDeconfliction(l))continue;const o=l.stageObject.geometryRecords[0].material;if(e(h)){if(h=this._getProjectionInfo(l,t,mi),h.isOutsideScreen||this._isCulledBySlice(i,H)||r(s)&&this._isCulledByHorizon(h,s,a))return void(c.culled=!0);!L.TESTS_DISABLE_OPTIMIZATIONS&&c.visible&&(h.distance*=.7)}this._expandBoundingRect(c,l,o,h)}e(h)?c.culled=!0:(c.distance=h.distance,c.culled=!1)}_getProjectionInfo(i,t,s){const e=this._runningViewState.camera,r=i.stageObject,a=r.geometryRecords[0],o=a.material,c=O(r.boundingVolumeWorldSpace.bounds);p(H,c,e.viewMatrix);const n=a.geometry.vertexAttributes,h=n.get(W.NORMAL).data,l=n.get(W.AUXPOS1).data;return o.applyShaderOffsetsView(H,h,r.transformation,l,e,s.scaleInfo,H),b(Z,H[0],H[1],H[2],1),v(q,Z,e.projectionMatrix),u(s.positionNDC,q,1/q[3]),o.applyShaderOffsetsNDC(s.positionNDC,l,e,s.positionNDC,J),s.distanceWithoutPolygonOffset=e.depthNDCToWorld(J[2]),s.distance=J[2]===s.positionNDC[2]?s.distanceWithoutPolygonOffset:e.depthNDCToWorld(s.positionNDC[2]),b(q,s.positionNDC[0],s.positionNDC[1],s.positionNDC[2],1),v(Z,q,t),y(Z,Z,1/Z[3]),d(s.positionView,H[0],H[1],H[2]),s}_isCulledByHorizon(i,t,s){return f($.direction,i.positionView),d($.origin,0,0,0),!!M(t,$,ii)&&i.distanceWithoutPolygonOffset>s}_isCulledBySlice(i,t){return i.slicePlaneEnabled&&this._runningViewState.slicePlaneEnabled&&C(this._runningViewState.slicePlane,t)}_expandBoundingRect(i,t,e,{positionNDC:r,scaleInfo:a}){const o=this._runningViewState.camera,c=t.getScreenSize(di);k(c,a.factor,c),c[0]*=o.pixelRatio,c[1]*=o.pixelRatio;const n=w(e.calculateRelativeScreenBounds(c,a.factorAlignment.scale,ti),s(0,o.fullWidth,.5+.5*r[0]),s(0,o.fullHeight,.5+.5*r[1])),h=this.iconMarginFactor;if(0!==h){const i=h*Math.min(D(n),N(n));n[0]-=i,n[1]-=i,n[2]+=i,n[3]+=i}j(i.aabr,n,i.aabr)}_isConflicted(i){const t=i.graphics3DGraphic.graphic.uid,s=i.info[this.visibilityGroup];for(let e=Math.floor(s.aabr[0]/this.accBinsSizeX);e<=Math.floor(s.aabr[2]/this.accBinsSizeX);e++)if(!(e<0||e>=this.accBinsNumX))for(let i=Math.floor(s.aabr[1]/this.accBinsSizeY);i<=Math.floor(s.aabr[3]/this.accBinsSizeY);i++){if(i<0||i>=this.accBinsNumY)continue;const r=this.accBins[e][i];for(let i=0;i<r.length;i++){const e=r.data[i],a=e.info[this.visibilityGroup];if(a&&a.visible&&(e.graphics3DGraphic.graphic.uid!==t&&(this.accNumTests++,V(a.aabr,s.aabr))))return!0}}return!1}_initBins(i,t){if(null==this.accBins){this.accBins=[];for(let i=0;i<this.accBinsNumX;i++){this.accBins.push([]);const i=this.accBins[this.accBins.length-1];for(let t=0;t<this.accBinsNumY;t++)i.push(new a)}}else for(let s=0;s<this.accBinsNumX;s++)for(let i=0;i<this.accBinsNumY;i++)this.accBins[s][i].clear();this.accBinsSizeX=i/this.accBinsNumX,this.accBinsSizeY=t/this.accBinsNumY,this.accNumTests=0}_addToBins(i){const t=i.info[this.visibilityGroup],s=Math.floor(t.aabr[0]/this.accBinsSizeX),e=Math.floor(t.aabr[2]/this.accBinsSizeX),r=Math.floor(t.aabr[1]/this.accBinsSizeY),a=Math.floor(t.aabr[3]/this.accBinsSizeY);for(let o=s;o<=e;o++)if(!(o<0||o>=this.accBinsNumX))for(let t=r;t<=a;t++)t<0||t>=this.accBinsNumY||this.accBins[o][t].push(i)}_setGraphicVisibility(i,t){const s=i.graphics3DGraphic;s.destroyed||(s.setVisibilityFlag(R.DECONFLICTION,t,this.visibilityGroup),this.visibilityGroup===X.LABEL&&this.view.labeler.setLabelGraphicVisibility(s,t))}};function li(i,t){const s=i.graphics3DGraphic;s.destroyed||s.clearVisibilityFlag(R.DECONFLICTION,t)}function*pi(i){if(Map.prototype.entries){const t=i.entries();for(let i=t.next();!i.done;i=t.next())yield i.value[1]}else yield*i.values()}function*ui(i,t,s){t.clear(),i.forEach(((i,e)=>{const r=t.pushNew();r.id=e,r.prio=i.info?-i.info[s].distance:Number.MAX_VALUE})),yield;const e=t.iterableSort(((i,t)=>t.prio-i.prio));for(let r=e.next();!r.done;r=e.next())yield;t.forAll((t=>{const s=i.get(t.id);s&&(i.delete(t.id),i.set(t.id,s))})),t.clear()}i([o({constructOnly:!0})],hi.prototype,"view",void 0),i([o({type:Boolean,readOnly:!0})],hi.prototype,"updating",null),hi=i([c("esri.views.3d.layers.graphics.Deconflictor")],hi);const di=l();class fi{constructor(){this.positionView=g(),this.positionNDC=g(),this.distance=0,this.distanceWithoutPolygonOffset=0,this.scaleInfo={factor:{scale:0,factor:0,minPixelSize:0,paddingPixels:0},factorAlignment:{scale:0,factor:0,minPixelSize:0,paddingPixels:0}}}get isOutsideScreen(){const i=this.positionNDC;return i[0]<-1||i[1]<-1||i[2]<-1||i[0]>=1||i[1]>=1}}const mi=new fi;export{hi as Deconflictor,ei as DeconflictorGraphic,ni as DeconflictorViewState,ci as State};