@arcgis/core 4.29.0-next.20231219 → 4.29.0-next.20231221

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 (242) hide show
  1. package/analysis/Analysis.js +1 -1
  2. package/applications/WebEditor/sketchUtils.js +1 -1
  3. package/assets/components/assets/icon/hexagon16.json +1 -0
  4. package/assets/components/assets/icon/hexagon24.json +1 -0
  5. package/assets/components/assets/icon/hexagon32.json +1 -0
  6. package/assets/components/assets/icon/octagon16.json +1 -0
  7. package/assets/components/assets/icon/octagon24.json +1 -0
  8. package/assets/components/assets/icon/octagon32.json +1 -0
  9. package/assets/esri/core/libs/libtess/libtess.wasm +0 -0
  10. package/assets/esri/core/workers/RemoteClient.js +1 -1
  11. package/assets/esri/core/workers/chunks/00b340b4495bfabd4ca2.js +1 -0
  12. package/assets/esri/core/workers/chunks/{4301736368af52b94ee2.js → 02d6e2f0b1003534a077.js} +1 -1
  13. package/assets/esri/core/workers/chunks/050132142f4887c62724.js.LICENSE.txt +1 -1
  14. package/assets/esri/core/workers/chunks/0e315452f11b112523f0.js +1 -0
  15. package/assets/esri/core/workers/chunks/0f5a197f0a4b3a354bcd.js +1 -0
  16. package/assets/esri/core/workers/chunks/1187ba315883ff27e2d9.js +1 -0
  17. package/assets/esri/core/workers/chunks/1254a544d369d99ccf59.js +1 -0
  18. package/assets/esri/core/workers/chunks/138d138a5d33b2f5d8a4.js +1 -0
  19. package/assets/esri/core/workers/chunks/1a73dcbb49d17f16ed5a.js +1 -0
  20. package/assets/esri/core/workers/chunks/1c2b17d22f97d56f6212.js +1 -0
  21. package/assets/esri/core/workers/chunks/{0be38fd63e870341c660.js → 220fcc25578b2ef316da.js} +1 -1
  22. package/assets/esri/core/workers/chunks/251ceefdea4b345698a4.js +1 -0
  23. package/assets/esri/core/workers/chunks/28aafc7ea522663909b8.js +1 -0
  24. package/assets/esri/core/workers/chunks/30749bcd1a7b98a38386.js +1 -0
  25. package/assets/esri/core/workers/chunks/320a75ff760295d9af91.js +1 -0
  26. package/assets/esri/core/workers/chunks/{c9f8354d51f701cd69e5.js → 321dcff84c31c739ed93.js} +1 -1
  27. package/assets/esri/core/workers/chunks/36eb1e0471eb61a6bc38.js +1 -0
  28. package/assets/esri/core/workers/chunks/{57176c0968e07357126d.js → 3a429bb09b89e84021ab.js} +1 -1
  29. package/assets/esri/core/workers/chunks/444adb8a310024ec969c.js +1 -0
  30. package/assets/esri/core/workers/chunks/48aebd650b6eccde01f8.js.LICENSE.txt +1 -1
  31. package/assets/esri/core/workers/chunks/4f7459402b5910288ab1.js +1 -0
  32. package/assets/esri/core/workers/chunks/4fcd94fbf7c68996ad31.js +1 -0
  33. package/assets/esri/core/workers/chunks/573ad8aa1c2cfad61eb8.js +1 -0
  34. package/assets/esri/core/workers/chunks/5e12871a267742de6d22.js +1 -0
  35. package/assets/esri/core/workers/chunks/5f3104051f5267c58dda.js +2 -0
  36. package/assets/esri/core/workers/chunks/{76d0c4d6192449f22e51.js.LICENSE.txt → 5f3104051f5267c58dda.js.LICENSE.txt} +1 -1
  37. package/assets/esri/core/workers/chunks/{f350378a0d93dda39425.js → 7205c1680afee0cc0aac.js} +1 -1
  38. package/assets/esri/core/workers/chunks/77b3dff9fdcfe1222749.js +1 -0
  39. package/assets/esri/core/workers/chunks/77c29cfa3d245ff0afa0.js +1 -0
  40. package/assets/esri/core/workers/chunks/82dac92c1c611dea077f.js +1 -0
  41. package/assets/esri/core/workers/chunks/831283ac6653d7af90b6.js +1 -0
  42. package/assets/esri/core/workers/chunks/8485562b452686c6c3f2.js +1 -0
  43. package/assets/esri/core/workers/chunks/85a39b0f928f817a4b1b.js +1 -0
  44. package/assets/esri/core/workers/chunks/882fec2317740f6c118f.js +1 -0
  45. package/assets/esri/core/workers/chunks/8e1ac19a6188da157c0b.js +1 -0
  46. package/assets/esri/core/workers/chunks/8e2723dbc09400202aea.js +1 -0
  47. package/assets/esri/core/workers/chunks/{d3860693a40394723c99.js → 9249371cb2437e68a304.js} +1 -1
  48. package/assets/esri/core/workers/chunks/9528dfed701ad37ea551.js.LICENSE.txt +1 -1
  49. package/assets/esri/core/workers/chunks/{419f4aaecc4231fdd171.js → 9dc0331885cb8150d9ca.js} +1 -1
  50. package/assets/esri/core/workers/chunks/9ebf8288046aa0fa51f1.js.LICENSE.txt +1 -1
  51. package/assets/esri/core/workers/chunks/a0b8164928a331ffc1b4.js +2 -0
  52. package/assets/esri/core/workers/chunks/{5c71a14417cdd11a1e8d.js.LICENSE.txt → a0b8164928a331ffc1b4.js.LICENSE.txt} +1 -1
  53. package/assets/esri/core/workers/chunks/a6e3783cc10fb505473e.js +1 -0
  54. package/assets/esri/core/workers/chunks/a6fec91863abaa670301.js +2 -0
  55. package/assets/esri/core/workers/chunks/{359297c87764ae8db386.js.LICENSE.txt → a6fec91863abaa670301.js.LICENSE.txt} +1 -1
  56. package/assets/esri/core/workers/chunks/a98cdf10ff7b2923abd5.js +1 -0
  57. package/assets/esri/core/workers/chunks/aa43b12a71957da2e678.js +1 -0
  58. package/assets/esri/core/workers/chunks/ac85f9d88f5583407d66.js +1 -0
  59. package/assets/esri/core/workers/chunks/{418988591e8068adefe2.js → b7c2244c27790ccaca92.js} +1 -1
  60. package/assets/esri/core/workers/chunks/da70e2c191e7d1d2df64.js +1 -0
  61. package/assets/esri/core/workers/chunks/dbded06d7a944dd97b01.js +1 -0
  62. package/assets/esri/core/workers/chunks/dcf857dc23b152fe74ff.js +1 -0
  63. package/assets/esri/core/workers/chunks/dcfc48bf5c27774fa05c.js +1 -0
  64. package/assets/esri/core/workers/chunks/dd368833c042127360ad.js +1 -0
  65. package/assets/esri/core/workers/chunks/e4049e498b3eaa9c8596.js +1 -0
  66. package/assets/esri/core/workers/chunks/e730a930d8a551552db5.js +1 -0
  67. package/assets/esri/core/workers/chunks/eb55835b8d3829f75e1e.js +1 -0
  68. package/assets/esri/core/workers/chunks/ef6fc6c92eae4f51e689.js +2 -0
  69. package/assets/esri/core/workers/chunks/{931063b2654ff763d15e.js.LICENSE.txt → ef6fc6c92eae4f51e689.js.LICENSE.txt} +1 -1
  70. package/assets/esri/core/workers/chunks/f4124bf5b674811332bd.js.LICENSE.txt +1 -1
  71. package/assets/esri/core/workers/chunks/fd03cd19d0d4db699dca.js +1 -0
  72. package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
  73. package/assets/esri/themes/base/widgets/_Directions.scss +4 -0
  74. package/assets/esri/themes/base/widgets/_Grid.scss +8 -2
  75. package/assets/esri/themes/dark/main.css +1 -1
  76. package/assets/esri/themes/light/main.css +1 -1
  77. package/assets/esri/themes/light/view.css +1 -1
  78. package/chunks/libtess-asm.js +1 -1
  79. package/chunks/libtess.js +1 -1
  80. package/chunks/vec32.js +1 -1
  81. package/chunks/vxlLayer.js +1 -1
  82. package/core/PooledArray.js +1 -1
  83. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  84. package/core/scheduling.js +1 -1
  85. package/core/sql.js +1 -1
  86. package/geometry/ellipsoidUtils.js +1 -1
  87. package/geometry/libtess.js +1 -1
  88. package/geometry/support/meshUtils/loadExternal.js +1 -1
  89. package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
  90. package/interfaces.d.ts +391 -49
  91. package/layers/BuildingSceneLayer.js +1 -1
  92. package/layers/GeoJSONLayer.js +1 -1
  93. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  94. package/layers/IntegratedMeshLayer.js +1 -1
  95. package/layers/MapImageLayer.js +1 -1
  96. package/layers/OGCFeatureLayer.js +1 -1
  97. package/layers/PointCloudLayer.js +1 -1
  98. package/layers/SceneLayer.js +1 -1
  99. package/layers/VoxelLayer.js +1 -1
  100. package/layers/VoxelWasmPerSceneView.js +1 -1
  101. package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
  102. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  103. package/layers/graphics/sources/WFSSource.js +1 -1
  104. package/layers/graphics/sources/support/uploads.js +1 -1
  105. package/layers/mixins/SceneService.js +1 -1
  106. package/layers/ogc/wfsUtils.js +1 -1
  107. package/layers/support/I3SIndexInfo.js +1 -1
  108. package/layers/support/Sublayer.js +1 -1
  109. package/layers/support/associatedFeatureServiceUtils.js +1 -1
  110. package/layers/support/rasterDatasets/WCSRaster.js +1 -1
  111. package/layers/support/rasterFunctions/BandArithmeticFunction.js +1 -1
  112. package/layers/support/rasterFunctions/bandIndexUtils.js +1 -1
  113. package/package.json +2 -2
  114. package/portal/schemas/buildingSceneLayerItem.js +1 -1
  115. package/portal/schemas/definitions.js +1 -1
  116. package/portal/schemas/integratedMeshLayerItem.js +1 -1
  117. package/portal/schemas/pointCloudLayerItem.js +1 -1
  118. package/portal/schemas/sceneLayerItem.js +1 -1
  119. package/support/revision.js +1 -1
  120. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerShader.js +1 -1
  121. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  122. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  123. package/views/2d/layers/SubtypeGroupLayerView2D.js +1 -1
  124. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +5 -0
  125. package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +5 -0
  126. package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +5 -0
  127. package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +5 -0
  128. package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +5 -0
  129. package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +5 -0
  130. package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +5 -0
  131. package/views/2d/layers/features/layerAdapters/featureReductionUtils.js +5 -0
  132. package/views/2d/layers/features/layerAdapters/floorFilterUtils.js +5 -0
  133. package/views/2d/layers/features/support/NormalizedField.js +1 -1
  134. package/views/2d/layers/support/DebugOverlay.js +1 -1
  135. package/views/3d/analysis/AnalysisView3D.js +1 -1
  136. package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
  137. package/views/3d/layers/I3SMeshView3D.js +1 -1
  138. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  139. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  140. package/views/3d/layers/IntegratedMesh3DTilesViewPerformanceInfo.js +5 -0
  141. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  142. package/views/3d/layers/TiledLayerView3D.js +1 -1
  143. package/views/3d/layers/VoxelLayerView3D.js +1 -1
  144. package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
  145. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  146. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  147. package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
  148. package/views/3d/layers/i3s/PagedNodeIndex.js +1 -1
  149. package/views/3d/layers/support/DefinitionExpressionSceneLayerView.js +1 -1
  150. package/views/3d/layers/support/TemporalSceneLayerView.js +1 -1
  151. package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
  152. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  153. package/views/3d/support/RenderCoordsHelper.js +1 -1
  154. package/views/3d/support/orientedBoundingBox.js +1 -1
  155. package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
  156. package/views/3d/terrain/OverlayManager.js +1 -1
  157. package/views/3d/terrain/OverlayRenderer.js +1 -1
  158. package/views/3d/terrain/PatchRenderData.js +1 -1
  159. package/views/3d/terrain/SphericalPatch.js +1 -1
  160. package/views/3d/terrain/TerrainSurface.js +1 -1
  161. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  162. package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
  163. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  164. package/views/3d/webgl-engine/effects/RenderNodeCollection.js +1 -1
  165. package/views/3d/webgl-engine/effects/ScreenSpaceGeometry.js +1 -1
  166. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  167. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  168. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  169. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  170. package/views/3d/webgl-engine/lib/Camera.js +1 -1
  171. package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
  172. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  173. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  174. package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
  175. package/views/3d/webgl-engine/lib/rendererUtils.js +1 -1
  176. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  177. package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
  178. package/views/draw/DrawGraphicTool.js +1 -1
  179. package/views/interactive/AnalysisToolBase.js +1 -1
  180. package/views/interactive/tooltip/Tooltip.js +1 -1
  181. package/views/interactive/tooltip/content/TooltipContent.js +1 -1
  182. package/views/layers/DimensionLayerView.js +1 -1
  183. package/views/webgl/Program.js +1 -1
  184. package/widgets/BasemapLayerList/BasemapLayerListVisibleElements.js +1 -1
  185. package/widgets/BasemapLayerList.js +1 -1
  186. package/widgets/DirectionalPad/DirectionalPadViewModel.d.ts +4 -0
  187. package/widgets/DirectionalPad.d.ts +4 -0
  188. package/widgets/Directions/css.js +1 -1
  189. package/widgets/Directions.js +1 -1
  190. package/widgets/ElevationProfile/ElevationProfileLineView.js +1 -1
  191. package/widgets/FeatureTable/FieldColumn.js +1 -1
  192. package/widgets/FeatureTable/Grid/Column.js +1 -1
  193. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  194. package/widgets/Features/FeaturesViewModel.js +1 -1
  195. package/widgets/LayerList/support/layerListUtils.js +1 -1
  196. package/widgets/LayerList.js +1 -1
  197. package/widgets/TableList.js +1 -1
  198. package/widgets/support/AnchorElementViewModel.js +1 -1
  199. package/assets/esri/core/workers/chunks/040e0122efe1cb716431.js +0 -1
  200. package/assets/esri/core/workers/chunks/04c89069761f7d6bf69d.js +0 -1
  201. package/assets/esri/core/workers/chunks/0c05900239e372f49f7e.js +0 -1
  202. package/assets/esri/core/workers/chunks/104e943cfffd093572a8.js +0 -1
  203. package/assets/esri/core/workers/chunks/1f5a4da5773ba48addfa.js +0 -1
  204. package/assets/esri/core/workers/chunks/24087961564e5b8cc20c.js +0 -1
  205. package/assets/esri/core/workers/chunks/26d8f6e0b9d67c75a781.js +0 -1
  206. package/assets/esri/core/workers/chunks/3441ae1ee2b11cf2c3f6.js +0 -1
  207. package/assets/esri/core/workers/chunks/359297c87764ae8db386.js +0 -2
  208. package/assets/esri/core/workers/chunks/37f71dac3208e74a76fc.js +0 -1
  209. package/assets/esri/core/workers/chunks/3913cf13681761afa596.js +0 -1
  210. package/assets/esri/core/workers/chunks/4a4dfe393c4c5e9435f9.js +0 -1
  211. package/assets/esri/core/workers/chunks/530306592924eb06d30c.js +0 -1
  212. package/assets/esri/core/workers/chunks/5558e8acc1bee29a0e9b.js +0 -1
  213. package/assets/esri/core/workers/chunks/587c81abcbe118ea89ae.js +0 -1
  214. package/assets/esri/core/workers/chunks/5c71a14417cdd11a1e8d.js +0 -2
  215. package/assets/esri/core/workers/chunks/5db76bdc4916d11cbcfe.js +0 -1
  216. package/assets/esri/core/workers/chunks/642e652bf21a7fa463c9.js +0 -1
  217. package/assets/esri/core/workers/chunks/649c3cbf6b3ec94cbdf1.js +0 -1
  218. package/assets/esri/core/workers/chunks/67e4bec7950f09ffe4a7.js +0 -1
  219. package/assets/esri/core/workers/chunks/68b2743411ef5e09862b.js +0 -1
  220. package/assets/esri/core/workers/chunks/76d0c4d6192449f22e51.js +0 -2
  221. package/assets/esri/core/workers/chunks/78123fa25903d376bd49.js +0 -1
  222. package/assets/esri/core/workers/chunks/7918a1c53ce9e7c95030.js +0 -1
  223. package/assets/esri/core/workers/chunks/80498a2a85e1aeadd569.js +0 -1
  224. package/assets/esri/core/workers/chunks/8407cf549c0c59a206f1.js +0 -1
  225. package/assets/esri/core/workers/chunks/89299923c92540455513.js +0 -1
  226. package/assets/esri/core/workers/chunks/8932cdbb7cfab9258d5a.js +0 -1
  227. package/assets/esri/core/workers/chunks/931063b2654ff763d15e.js +0 -2
  228. package/assets/esri/core/workers/chunks/969a22814dc765ac1061.js +0 -1
  229. package/assets/esri/core/workers/chunks/aa4d3276917421abaa12.js +0 -1
  230. package/assets/esri/core/workers/chunks/be924cb8ab2d40abea6c.js +0 -1
  231. package/assets/esri/core/workers/chunks/c6d1a6db8cfa0a7e3bd2.js +0 -1
  232. package/assets/esri/core/workers/chunks/c87e3d55ecdbbb584dfc.js +0 -1
  233. package/assets/esri/core/workers/chunks/cf9bf7d57341d00a92a6.js +0 -1
  234. package/assets/esri/core/workers/chunks/d72121b17640e302d6a9.js +0 -1
  235. package/assets/esri/core/workers/chunks/de01e106ca3daf6c2f49.js +0 -1
  236. package/assets/esri/core/workers/chunks/e3154ef5dbd851224452.js +0 -1
  237. package/assets/esri/core/workers/chunks/f0c62bb406bb93b1408a.js +0 -1
  238. package/assets/esri/core/workers/chunks/f4c4e0fe6be09fa49784.js +0 -1
  239. package/assets/esri/core/workers/chunks/f64a4349f895f92b6338.js +0 -1
  240. package/assets/esri/core/workers/chunks/f7a31ac1251c9c0ba713.js +0 -1
  241. package/assets/esri/core/workers/chunks/f842b3b50059aa70f1af.js +0 -1
  242. package/assets/esri/core/workers/chunks/fab270f3a45914f8df9e.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.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import s from"../../../core/Error.js";import t from"../../../core/Logger.js";import{watch as i,initial as r}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{b as l,n,s as h}from"../../../chunks/vec32.js";import{create as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectVectorToVector as d}from"../../../geometry/projection/projectVectorToVector.js";import{empty as u,expandWithVec3 as m}from"../../../geometry/support/aaBoundingBox.js";import{equals as p}from"../../../geometry/support/spatialReferenceUtils.js";import{LayerView3D as y}from"./LayerView3D.js";import{addLayerViewToWasm as b,removeLayerViewFromWasm as _,getVoxelWasm as V}from"./VoxelWasm.js";import{LayerViewPerformanceInfo as w}from"./support/LayerViewPerformanceInfo.js";import{PopupSceneLayerView as f}from"./support/PopupSceneLayerView.js";import g from"../../layers/LayerView.js";import S from"../../../geometry/SpatialReference.js";var v;!function(e){e[e.API=1]="API",e[e.VerboseAPI=2]="VerboseAPI",e[e.Error=3]="Error"}(v||(v={}));const W=c(),T=c();let E=class extends(f(y(g))){constructor(){super(...arguments),this._suspendedHandle=null,this._usedMemory=0,this._futureMemory=0,this.type="voxel-3d",this.slicePlaneEnabled=!1,this._wasmLayerId=-1,this.ignoresMemoryFactor=!0,this._dbgFlags=new Set}get baseUrl(){return this.layer.parsedUrl?.path??""}get wasmLayerId(){return this._wasmLayerId}initialize(){if(this._dbgFlags.add(v.Error),"local"!==this.view.viewingMode)throw new s("voxel:unsupported-viewingMode","Voxel layers support local viewingMode only.",{});if(!!!this.view._stage.renderView.renderingContext.capabilities.colorBufferFloat?.textureFloat)throw new s("voxel:missing-color-buffer-float","Voxel layers require the WebGL2 extension EXT_color_buffer_float",{});const e=this.layer.spatialReference;if(!p(e,this.view.spatialReference))throw new s("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{});const t=this.layer.currentVariableId,o=this.layer.getVolume(t),a=this.layer.getVariable(t);if(null!=o&&null!=a){const e=o.dimensions[0],s=o.dimensions[1],t=o.zDimension;if(t>1){const i=o.dimensions[t],r=e.size*s.size*i.size;let l=1;switch(a.renderingFormat.type){case"Int16":case"UInt16":l=2;break;case"Int32":case"UInt32":case"Float32":l=4}this._futureMemory=l*r}}const l=b(this).then((e=>{this._wasmLayerId=e,this._suspendedHandle=i((()=>this.suspended),(e=>{const s=V(this.view);s&&s.setEnabled(this,!e)}),r),this.addHandles([i((()=>this.layer.renderMode),(e=>this._pushRenderModeToWasm(e))),i((()=>this.layer.currentVariableId),(e=>this._pushCurrentVariableIdToWasm(e))),i((()=>this.layer.getSections()),(e=>this._pushSectionsToWasm(e))),i((()=>this.layer.getVariableStyles()),(e=>this._pushVariableStylesToWasm(e))),i((()=>this.layer.getVolumeStyles()),(e=>this._pushVolumeStylesToWasm(e))),i((()=>this.layer.enableDynamicSections),(e=>this._pushEnableDynamicSectionsToWasm(e))),i((()=>this.layer.enableIsosurfaces),(e=>this._pushEnableIsosurfacesToWasm(e))),i((()=>this.layer.enableSections),(e=>this._pushEnableSectionsToWasm(e))),i((()=>this.layer.enableSlices),(e=>this._pushEnableSlicesToWasm(e))),i((()=>this.slicePlaneEnabled),(e=>this._pushAnalysisSliceToWasm(e,this.view.slicePlane))),i((()=>this.view.slicePlane),(e=>this._pushAnalysisSliceToWasm(this.slicePlaneEnabled,e)))])})).catch((e=>{if(_(this),this._wasmLayerId=-1,-1===e)throw new s("voxel:addLayer-failure","The voxel layer description was invalid.",{});if(-2===e)throw new s("voxel:addLayer-failure","The voxel layer web assembly module failed to download.",{})}));this.addResolvingPromise(l)}destroy(){_(this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null)}isUpdating(){const e=V(this.view);return!(this._wasmLayerId<0||null==e)&&e.isUpdating(this._wasmLayerId)}updatingFlagChanged(){this.notifyChange("updating")}get usedMemory(){return this._usedMemory}get unloadedMemory(){return this._futureMemory}get performanceInfo(){return new w(this.usedMemory)}whenGraphicBounds(e,s){const t=e.attributes["Voxel.WorldPosition"];if(t){const e=u(),s=JSON.parse(t);if(d(s,this.view.renderSpatialReference,T,this.view.spatialReference||S.WGS84))return m(e,T),Promise.resolve({boundingBox:e,screenSpaceObjects:[]})}return Promise.reject()}setUsedMemory(e){this._usedMemory=e,this._futureMemory=0}captureFrustum(){const e=V(this.view);e?.captureFrustum()}toggleFullVolumeExtentDraw(){const e=V(this.view);e?.toggleFullVolumeExtentDraw(this)}getLayerTimes(){const e=V(this.view);return e?.getLayerTimes(this)??[]}getCurrentLayerTimeIndex(){const e=V(this.view);return e?.getCurrentLayerTimeIndex(this)??0}_pushRenderModeToWasm(e){const s=V(this.view);this._dbg(v.VerboseAPI,"VoxelLayerView3D._pushRenderModeToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s?.setRenderMode(this,e)||this._dbg(v.Error,"VoxelLayerView3D._pushRenderModeToWasm() failed!")}_pushSectionsToWasm(e){const s=V(this.view);this._dbg(v.VerboseAPI,"VoxelLayerView3D._pushSectionsToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s?.setStaticSections(this,e)||this._dbg(v.Error,"VoxelLayerView3D._pushSectionsToWasm() failed!")}_pushCurrentVariableIdToWasm(e){const s=V(this.view);this._dbg(v.VerboseAPI,"VoxelLayerView3D._pushCurrentVariableIdToWasm() called!, "+(s?"have WASM":"don't have WASM!!!")),s?.setCurrentVariable(this,e)||this._dbg(v.Error,"VoxelLayerView3D._pushCurrentVariableIdToWasm() failed!")}_pushVariableStylesToWasm(e){const s=V(this.view);this._dbg(v.VerboseAPI,"VoxelLayerView3D._pushVariableStylesToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s?.setVariableStyles(this,e)||this._dbg(v.Error,"VoxelLayerView3D._pushVariableStylesToWasm() failed!")}_accountForEnableSlices(e,s){const t=null!=s?s:this.layer.enableSlices;for(let i=0;i<e.length;++i){const s=e[i];for(const e of s.slices)e.enabled=e.enabled&&t}}_pushVolumeStylesToWasm(e){const s=V(this.view);this._dbg(v.VerboseAPI,"VoxelLayerView3D._pushVolumeStylesToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s&&(this._accountForEnableSlices(e,null),s.setVolumeStyles(this,e)||this._dbg(v.Error,"VoxelLayerView3D._pushVolumeStylesToWasm() failed!"))}_pushAnalysisSliceToWasm(e,s){const t=V(this.view);this._dbg(v.VerboseAPI,"VoxelLayerView3D._pushAnalysisSliceToWasm() called, "+(t?"have WASM":"don't have WASM!!!"));let i=!1;if(t){if(s){const r=s.origin;l(W,s.basis1,s.basis2),n(W,W),i=t.setAnalysisSlice(this,e,r,W)}else h(W,0,0,1),i=t.setAnalysisSlice(this,!1,W,W);i||this._dbg(v.Error,"VoxelLayerView3D._pushAnalysisSliceToWasm() failed!")}}_pushEnableDynamicSectionsToWasm(e){const s=V(this.view);this._dbg(v.VerboseAPI,"VoxelLayerView3D._pushEnableDynamicSectionsToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s?.setEnableDynamicSections(this,e)||this._dbg(v.Error,"VoxelLayerView3D._pushEnableDynamicSectionsToWasm() failed!")}_pushEnableSlicesToWasm(e){const s=V(this.view);if(this._dbg(v.VerboseAPI,"VoxelLayerView3D._pushEnableSlicesToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s){const t=this.layer.getVolumeStyles();this._accountForEnableSlices(t,e),s.setVolumeStyles(this,t)||this._dbg(v.Error,"VoxelLayerView3D._pushEnableSlicesToWasm() failed!")}}_pushEnableIsosurfacesToWasm(e){const s=V(this.view);this._dbg(v.VerboseAPI,"VoxelLayerView3D._pushEnableIsosurfacesToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s?.setEnableIsosurfaces(this,e)||this._dbg(v.Error,"VoxelLayerView3D._pushEnableIsosurfacesToWasm() failed!")}_pushEnableSectionsToWasm(e){const s=V(this.view);this._dbg(v.VerboseAPI,"VoxelLayerView3D._pushEnableSectionsToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s?.setEnableSections(this,e)||this._dbg(v.Error,"VoxelLayerView3D._pushEnableSectionsToWasm() failed!")}async whenGraphicAttributes(e,s){return e}_dbg(e,s){this._dbgFlags.has(e)&&(e===v.Error?t.getLogger(this).error(s):t.getLogger(this).warn(s))}};e([o()],E.prototype,"layer",void 0),e([o()],E.prototype,"baseUrl",null),e([o({type:Boolean})],E.prototype,"slicePlaneEnabled",void 0),E=e([a("esri.views.3d.layers.VoxelLayerView3D")],E);const x=E;export{x as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import s from"../../../core/Error.js";import t from"../../../core/Logger.js";import{watch as i,initial as a}from"../../../core/reactiveUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{b as l,n,s as h}from"../../../chunks/vec32.js";import{create as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectVectorToVector as d}from"../../../geometry/projection/projectVectorToVector.js";import{empty as m,expandWithVec3 as u}from"../../../geometry/support/aaBoundingBox.js";import{equals as p}from"../../../geometry/support/spatialReferenceUtils.js";import{LayerView3D as y}from"./LayerView3D.js";import{addLayerViewToWasm as b,removeLayerViewFromWasm as _,getVoxelWasm as V}from"./VoxelWasm.js";import{LayerViewPerformanceInfo as w}from"./support/LayerViewPerformanceInfo.js";import{PopupSceneLayerView as S}from"./support/PopupSceneLayerView.js";import f from"../../layers/LayerView.js";import{scaleBoundsPredicate as g}from"../../support/layerViewUtils.js";import v from"../../../geometry/SpatialReference.js";var W;!function(e){e[e.API=1]="API",e[e.VerboseAPI=2]="VerboseAPI",e[e.Error=3]="Error"}(W||(W={}));const T=c(),x=c();let E=class extends(S(y(f))){constructor(){super(...arguments),this._suspendedHandle=null,this._usedMemory=0,this._futureMemory=0,this.type="voxel-3d",this.slicePlaneEnabled=!1,this._wasmLayerId=-1,this.ignoresMemoryFactor=!0,this._dbgFlags=new Set}get baseUrl(){return this.layer.parsedUrl?.path??""}get wasmLayerId(){return this._wasmLayerId}initialize(){if(this._dbgFlags.add(W.Error),"local"!==this.view.viewingMode)throw new s("voxel:unsupported-viewingMode","Voxel layers support local viewingMode only.",{});if(!!!this.view._stage.renderView.renderingContext.capabilities.colorBufferFloat?.textureFloat)throw new s("voxel:missing-color-buffer-float","Voxel layers require the WebGL2 extension EXT_color_buffer_float",{});const e=this.layer.spatialReference;if(!p(e,this.view.spatialReference))throw new s("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{});const t=this.layer.currentVariableId,r=this.layer.getVolume(t),o=this.layer.getVariable(t);if(null!=r&&null!=o){const e=r.dimensions[0],s=r.dimensions[1],t=r.zDimension;if(t>1){const i=r.dimensions[t],a=e.size*s.size*i.size;let l=1;switch(o.renderingFormat.type){case"Int16":case"UInt16":l=2;break;case"Int32":case"UInt32":case"Float32":l=4}this._futureMemory=l*a}}const l=b(this).then((e=>{this._wasmLayerId=e,this._suspendedHandle=i((()=>this.suspended),(e=>{const s=V(this.view);s&&s.setEnabled(this,!e)}),a),this.addHandles([i((()=>this.layer.renderMode),(e=>this._pushRenderModeToWasm(e))),i((()=>this.layer.currentVariableId),(e=>this._pushCurrentVariableIdToWasm(e))),i((()=>this.layer.getSections()),(e=>this._pushSectionsToWasm(e))),i((()=>this.layer.getVariableStyles()),(e=>this._pushVariableStylesToWasm(e))),i((()=>this.layer.getVolumeStyles()),(e=>this._pushVolumeStylesToWasm(e))),i((()=>this.layer.enableDynamicSections),(e=>this._pushEnableDynamicSectionsToWasm(e))),i((()=>this.layer.enableIsosurfaces),(e=>this._pushEnableIsosurfacesToWasm(e))),i((()=>this.layer.enableSections),(e=>this._pushEnableSectionsToWasm(e))),i((()=>this.layer.enableSlices),(e=>this._pushEnableSlicesToWasm(e))),i((()=>this.slicePlaneEnabled),(e=>this._pushAnalysisSliceToWasm(e,this.view.slicePlane))),i((()=>this.view.slicePlane),(e=>this._pushAnalysisSliceToWasm(this.slicePlaneEnabled,e))),i((()=>this.layer.minScale),(e=>this._onScaleUpdated(this.view.scale,e,this.layer.maxScale)),a),i((()=>this.layer.maxScale),(e=>this._onScaleUpdated(this.view.scale,this.layer.minScale,e)),a),i((()=>this.view.scale),(e=>this._onScaleUpdated(e,this.layer.minScale,this.layer.maxScale)),a)])})).catch((e=>{if(_(this),this._wasmLayerId=-1,-1===e)throw new s("voxel:addLayer-failure","The voxel layer description was invalid.",{});if(-2===e)throw new s("voxel:addLayer-failure","The voxel layer web assembly module failed to download.",{})}));this.addResolvingPromise(l)}destroy(){_(this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null)}isUpdating(){const e=V(this.view);return!(this._wasmLayerId<0||null==e)&&e.isUpdating(this._wasmLayerId)}updatingFlagChanged(){this.notifyChange("updating")}get usedMemory(){return this._usedMemory}get unloadedMemory(){return this._futureMemory}get performanceInfo(){return new w(this.usedMemory)}whenGraphicBounds(e,s){const t=e.attributes["Voxel.WorldPosition"];if(t){const e=m(),s=JSON.parse(t);if(d(s,this.view.renderSpatialReference,x,this.view.spatialReference||v.WGS84))return u(e,x),Promise.resolve({boundingBox:e,screenSpaceObjects:[]})}return Promise.reject()}setUsedMemory(e){this._usedMemory=e,this._futureMemory=0}captureFrustum(){const e=V(this.view);e?.captureFrustum()}toggleFullVolumeExtentDraw(){const e=V(this.view);e?.toggleFullVolumeExtentDraw(this)}getLayerTimes(){const e=V(this.view);return e?.getLayerTimes(this)??[]}getCurrentLayerTimeIndex(){const e=V(this.view);return e?.getCurrentLayerTimeIndex(this)??0}_pushRenderModeToWasm(e){const s=V(this.view);this._dbg(W.VerboseAPI,"VoxelLayerView3D._pushRenderModeToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s?.setRenderMode(this,e)||this._dbg(W.Error,"VoxelLayerView3D._pushRenderModeToWasm() failed!")}_pushSectionsToWasm(e){const s=V(this.view);this._dbg(W.VerboseAPI,"VoxelLayerView3D._pushSectionsToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s?.setStaticSections(this,e)||this._dbg(W.Error,"VoxelLayerView3D._pushSectionsToWasm() failed!")}_pushCurrentVariableIdToWasm(e){const s=V(this.view);this._dbg(W.VerboseAPI,"VoxelLayerView3D._pushCurrentVariableIdToWasm() called!, "+(s?"have WASM":"don't have WASM!!!")),s?.setCurrentVariable(this,e)||this._dbg(W.Error,"VoxelLayerView3D._pushCurrentVariableIdToWasm() failed!")}_pushVariableStylesToWasm(e){const s=V(this.view);this._dbg(W.VerboseAPI,"VoxelLayerView3D._pushVariableStylesToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s?.setVariableStyles(this,e)||this._dbg(W.Error,"VoxelLayerView3D._pushVariableStylesToWasm() failed!")}_accountForEnableSlices(e,s){const t=null!=s?s:this.layer.enableSlices;for(let i=0;i<e.length;++i){const s=e[i];for(const e of s.slices)e.enabled=e.enabled&&t}}_pushVolumeStylesToWasm(e){const s=V(this.view);this._dbg(W.VerboseAPI,"VoxelLayerView3D._pushVolumeStylesToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s&&(this._accountForEnableSlices(e,null),s.setVolumeStyles(this,e)||this._dbg(W.Error,"VoxelLayerView3D._pushVolumeStylesToWasm() failed!"))}_pushAnalysisSliceToWasm(e,s){const t=V(this.view);this._dbg(W.VerboseAPI,"VoxelLayerView3D._pushAnalysisSliceToWasm() called, "+(t?"have WASM":"don't have WASM!!!"));let i=!1;if(t){if(s){const a=s.origin;l(T,s.basis1,s.basis2),n(T,T),i=t.setAnalysisSlice(this,e,a,T)}else h(T,0,0,1),i=t.setAnalysisSlice(this,!1,T,T);i||this._dbg(W.Error,"VoxelLayerView3D._pushAnalysisSliceToWasm() failed!")}}_pushEnableDynamicSectionsToWasm(e){const s=V(this.view);this._dbg(W.VerboseAPI,"VoxelLayerView3D._pushEnableDynamicSectionsToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s?.setEnableDynamicSections(this,e)||this._dbg(W.Error,"VoxelLayerView3D._pushEnableDynamicSectionsToWasm() failed!")}_pushEnableSlicesToWasm(e){const s=V(this.view);if(this._dbg(W.VerboseAPI,"VoxelLayerView3D._pushEnableSlicesToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s){const t=this.layer.getVolumeStyles();this._accountForEnableSlices(t,e),s.setVolumeStyles(this,t)||this._dbg(W.Error,"VoxelLayerView3D._pushEnableSlicesToWasm() failed!")}}_pushEnableIsosurfacesToWasm(e){const s=V(this.view);this._dbg(W.VerboseAPI,"VoxelLayerView3D._pushEnableIsosurfacesToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s?.setEnableIsosurfaces(this,e)||this._dbg(W.Error,"VoxelLayerView3D._pushEnableIsosurfacesToWasm() failed!")}_pushEnableSectionsToWasm(e){const s=V(this.view);this._dbg(W.VerboseAPI,"VoxelLayerView3D._pushEnableSectionsToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s?.setEnableSections(this,e)||this._dbg(W.Error,"VoxelLayerView3D._pushEnableSectionsToWasm() failed!")}_onScaleUpdated(e,s,t){const i=g(e,s,t),a=V(this.view);a&&a.setIsInScaleRange(this,i)}async whenGraphicAttributes(e,s){return e}_dbg(e,s){this._dbgFlags.has(e)&&(e===W.Error?t.getLogger(this).error(s):t.getLogger(this).warn(s))}};e([r()],E.prototype,"layer",void 0),e([r()],E.prototype,"baseUrl",null),e([r({type:Boolean})],E.prototype,"slicePlaneEnabled",void 0),E=e([o("esri.views.3d.layers.VoxelLayerView3D")],E);const I=E;export{I 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.29/esri/copyright.txt for details.
4
4
  */
5
- import{ViewingMode as e}from"../../../ViewingMode.js";import{isValidObb as t,isValidMbs as i}from"./I3SUtil.js";import{I3sTarget as r}from"./Intersector.js";import{newIntersectorResult as s}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as n,StoreResults as l}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{getVerticalOffsetI3S as o}from"../../webgl-engine/lib/verticalOffsetUtils.js";class c{constructor(e){this.type=n.I3S,this._needVerticalOffset=!1,this.layerUid=e.layerUid,this.sublayerUid=e.sublayerUid,this._collection=e.collection,this._traverseNodeHierarchy=e.traverseNodeHierarchy,this.slicePlaneEnabled=e.slicePlaneEnabled,this.isGround=e.isGround}updateElevationAlignState(t,i){this._needVerticalOffset=t&&i===e.Global}intersect(e,n,c,d){const u=e.results,b=e.options.store===l.ALL,f=e.ray.direction,h=e.tolerance;let m=e=>e,y=e=>e;const p=o(e.verticalOffset??(this._needVerticalOffset?0:null));null!=e.verticalOffset&&null!=p&&(m=e=>p.applyToMbs(e),y=e=>p.applyToObb(e)),this._traverseNodeHierarchy(((l,o)=>{if(0===l.childrenLoaded)return!1;const g=t(l.serviceObbInRenderSR)?l.serviceObbInRenderSR:null;return!(g&&!y(g).intersectRay(c,f,h))&&(!o||!g&&i(l.renderMbs)&&!a(m(l.renderMbs),c,f,h)||null!=l.geometryObb&&!y(l.geometryObb).intersectRay(c,f,h)||this._collection.intersect(o,c,d,h,p,((t,i,o,a)=>{if(i<0||null!=n&&!n(c,d,i))return;const f=e=>{const s=new r(this.layerUid,this.sublayerUid,l.index,t,a);e.set(this.type,s,i,o)};if(this.isGround&&(null==u.ground.dist||i<u.ground.dist)&&f(u.ground),!e.options.isFiltered&&((null==u.min.dist||i<u.min.dist)&&f(u.min),(null==u.max.dist||i>u.max.dist)&&f(u.max),b)){const t=s(e.ray);f(t),e.results.all.push(t)}})),!0)}))}}function a(e,t,i,r=0){const s=e[3]+r,n=t[0]-e[0],l=t[1]-e[1],o=t[2]-e[2],c=i[0],a=i[1],d=i[2],u=c*n+a*l+d*o;return u*u-(c*c+a*a+d*d)*(n*n+l*l+o*o-s*s)>=0}export{c as I3SIntersectionHandler};
5
+ import{ViewingMode as e}from"../../../ViewingMode.js";import{isValidObb as t,isValidMbs as i}from"./I3SUtil.js";import{I3sTarget as r}from"./Intersector.js";import{newIntersectorResult as s}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as n,StoreResults as l}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{getVerticalOffsetI3S as o}from"../../webgl-engine/lib/verticalOffsetUtils.js";class c{constructor(e){this.type=n.I3S,this._needVerticalOffset=!1,this.layerUid=e.layerUid,this.sublayerUid=e.sublayerUid,this._collection=e.collection,this._traverseNodeHierarchy=e.traverseNodeHierarchy,this.slicePlaneEnabled=e.slicePlaneEnabled,this.isGround=e.isGround}updateElevationAlignState(t,i){this._needVerticalOffset=t&&i===e.Global}intersect(e,n,c,d,u,b){const f=e.results,h=e.options.store===l.ALL,m=e.ray.direction,y=e.tolerance;let p=e=>e,g=e=>e;const O=o(e.verticalOffset??(this._needVerticalOffset?0:null));null!=e.verticalOffset&&null!=O&&(p=e=>O.applyToMbs(e),g=e=>O.applyToObb(e)),this._traverseNodeHierarchy(((l,o)=>{if(0===l.childrenLoaded)return!1;const u=t(l.serviceObbInRenderSR)?l.serviceObbInRenderSR:null;return!(u&&!g(u).intersectRay(c,m,y))&&(!o||!u&&i(l.renderMbs)&&!a(p(l.renderMbs),c,m,y)||null!=l.geometryObb&&!g(l.geometryObb).intersectRay(c,m,y)||this._collection.intersect(o,c,d,y,O,((t,i,o,a)=>{if(i<0||null!=n&&!n(c,d,i))return;const u=e=>{const s=new r(this.layerUid,this.sublayerUid,l.index,t,a);e.set(this.type,s,i,o)};if(this.isGround&&(null==f.ground.dist||i<f.ground.dist)&&u(f.ground),!e.options.isFiltered&&((null==f.min.dist||i<f.min.dist)&&u(f.min),(null==f.max.dist||i>f.max.dist)&&u(f.max),h)){const t=s(e.ray);u(t),e.results.all.push(t)}}),b),!0)}))}}function a(e,t,i,r=0){const s=e[3]+r,n=t[0]-e[0],l=t[1]-e[1],o=t[2]-e[2],c=i[0],a=i[1],d=i[2],u=c*n+a*l+d*o;return u*u-(c*c+a*a+d*d)*(n*n+l*l+o*o-s*s)>=0}export{c as I3SIntersectionHandler};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../geometry.js";import e from"../../../../request.js";import{binaryIndexOf as t,splitIntoChunks as r}from"../../../../core/arrayUtils.js";import o from"../../../../core/Error.js";import has from"../../../../core/has.js";import{isInt16Array as n,isInt32Array as i}from"../../../../core/typedArrayUtil.js";import{invert as a}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as l,e as c,c as u}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as p}from"../../../../geometry/projection.js";import{getSphericalPCPF as m}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectVectorToVector as d}from"../../../../geometry/projection/projectVectorToVector.js";import{create as h,empty as y,expandPointInPlace as g,intersects as b}from"../../../../geometry/support/aaBoundingRect.js";import{g as w}from"../../../../chunks/sphere.js";import S from"../../../../rest/support/Query.js";import{readBinaryAttribute as T}from"./I3SBinaryReader.js";import{computeGlobalTransformation as E}from"./I3SProjectionUtil.js";import{createSolidEdgeMaterial as v,createMaterialFromEdges as I}from"../support/edgeUtils.js";import{parseColorMixMode as R,ColorMixModeEnum as x}from"../support/symbolColorUtils.js";import{Obb as j,compute as M,INVALID_HALFSIZE as C}from"../../support/orientedBoundingBox.js";import U from"../../../../geometry/SpatialReference.js";function N(e){return e?parseInt(e.substring(e.lastIndexOf("/")+1,e.length),10):void 0}function k(e){if(has("disable-feature:i3s-draco")||!e)return!1;for(const t of e)for(const e of t.geometryBuffers)if("draco"===e.compressedAttributes?.encoding)return!0;return!1}function D(e,t,r,o){r.traverse(t,(t=>{const r=t.mbs;return(null!=r&&L(e,r))!==q.OUTSIDE&&(o(t),!0)}))}function W(e,t,r){let o=0,n=0;for(let i=0;i<t.length&&o<e.length;i++)e[o]===t[i]&&(r(i)&&(e[n]=e[o],n++),o++);e.length=n}function _(e,r,o){let n=0,i=0;for(;n<o.length;){t(e,o[n])>=0===r&&(o[i]=o[n],i++),n++}o.length=i}const F=h();function O(e,t){if(0===t.rotationScale[1]&&0===t.rotationScale[2]&&0===t.rotationScale[3]&&0===t.rotationScale[5]&&0===t.rotationScale[6]&&0===t.rotationScale[7])return F[0]=(e[0]-t.position[0])/t.rotationScale[0],F[1]=(e[1]-t.position[1])/t.rotationScale[4],F[2]=(e[2]-t.position[0])/t.rotationScale[0],F[3]=(e[3]-t.position[1])/t.rotationScale[4],F}var q;function L(e,t){const r=t[0],o=t[1],n=t[3],i=e[0]-r,a=r-e[2],s=e[1]-o,l=o-e[3],c=Math.max(i,a,0),u=Math.max(s,l,0),f=c*c+u*u;if(f>n*n)return q.OUTSIDE;if(f>0)return q.INTERSECTS_CENTER_OUTSIDE;return-Math.max(i,a,s,l)>n?q.INSIDE:q.INTERSECTS_CENTER_INSIDE}function A(e,t,r){const o=[],n=r?.missingFields,i=r?.originalFields;for(const a of e){const e=a.toLowerCase();let r=!1;for(const n of t)if(e===n.name.toLowerCase()){o.push(n.name),r=!0,i&&i.push(a);break}!r&&n&&n.push(a)}return o}async function K(e,t,r,n,i){if(0===t.length)return[];const a=e.attributeStorageInfo;if(null!=e.associatedLayer)try{return await G(e.associatedLayer,t,r,n)}catch(s){if(e.associatedLayer.loaded)throw s}if(a){const s=B(t,r,i);if(null==s)throw new o("scenelayer:features-not-loaded","Tried to query attributes for unloaded features");const l=e.parsedUrl.path;return(await Promise.all(s.map((e=>z(l,a,e.node,e.indices,n).then((t=>{for(let r=0;r<e.graphics.length;r++){const o=e.graphics[r],n=t[r];if(o.attributes)for(const e in o.attributes)e in n||(n[e]=o.attributes[e]);o.attributes=n}return e.graphics})))))).flat()}throw new o("scenelayer:no-attribute-source","This scene layer does not have a source for attributes available")}function B(e,t,r){const o=new Map,n=[],i=r();for(const a of e){const e=a.attributes[t];for(let t=0;t<i.length;t++){const r=i[t],s=r.featureIds.indexOf(e);if(s>=0){let e=o.get(r.node);e||(e={node:r.node,indices:[],graphics:[]},n.push(e),o.set(r.node,e)),e.indices.push(s),e.graphics.push(a);for(let r=t;r>0;r--)i[r]=i[r-1];i[0]=r;break}}}return n}async function G(e,t,r,o){t.sort(((e,t)=>e.attributes[r]-t.attributes[r]));const n=t.map((e=>e.attributes[r])),i=[],a=A(o,e.fields,{originalFields:i}),s=await P(e,n,a);for(let l=0;l<t.length;l++){const e=t[l],r=s[l],o={};if(e.attributes)for(const t in e.attributes)o[t]=e.attributes[t];for(let t=0;t<i.length;t++)o[i[t]]=r[a[t]];e.attributes=o}return t}function P(e,t,n){const i=e.capabilities.query.maxRecordCount;if(null!=i&&t.length>i){const o=r(t,i);return Promise.all(o.map((t=>P(e,t,n)))).then((e=>e.flat()))}const a=new S({objectIds:t,outFields:n,orderByFields:[e.objectIdField]});return e.queryFeatures(a).then((e=>{if(e&&e.features&&e.features.length===t.length)return e.features.map((e=>e.attributes));throw new o("scenelayer:feature-not-in-associated-layer","Feature not found in associated feature layer")}))}function z(e,t,r,o,n){return $(e,t,r.resources.attributes,o,n)}async function $(t,r,o,n,i){const a=[];for(const e of r)if(e&&i.includes(e.name)){const r=`${t}/nodes/${o}/attributes/${e.key}/0`;a.push({url:r,storageInfo:e})}const s=await Promise.allSettled(a.map((t=>e(t.url,{responseType:"array-buffer"}).then((e=>T(t.storageInfo,e.data)))))),l=[];for(const e of n){const t={};for(let r=0;r<s.length;r++){const o=s[r];if("fulfilled"===o.status){const n=o.value;t[a[r].storageInfo.name]=Z(n,e)}}l.push(t)}return l}!function(e){e[e.OUTSIDE=0]="OUTSIDE",e[e.INTERSECTS_CENTER_OUTSIDE=1]="INTERSECTS_CENTER_OUTSIDE",e[e.INTERSECTS_CENTER_INSIDE=2]="INTERSECTS_CENTER_INSIDE",e[e.INSIDE=3]="INSIDE"}(q||(q={}));const V=-32768,Q=-(2**31);function Z(e,t){if(!e)return null;const r=e[t];if(n(e))return r===V?null:r;if(i(e))return r===Q?null:r;return r!=r?null:r}function H(e){const t=e.store,r=t.indexCRS||t.geographicCRS,n=void 0===r?t.indexWKT:void 0;if(n){if(!e.spatialReference)throw new o("layerview:no-store-spatial-reference-wkt-index-and-no-layer-spatial-reference","Found indexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new o("layerview:store-spatial-reference-wkt-index-incompatible","The indexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const i=r?new U(N(r)):e.spatialReference;return i.equals(e.spatialReference)?e.spatialReference:i}function J(e){const t=e.store,r=t.vertexCRS||t.projectedCRS,n=void 0===r?t.vertexWKT:void 0;if(n){if(!e.spatialReference)throw new o("layerview:no-store-spatial-reference-wkt-vertex-and-no-layer-spatial-reference","Found vertexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new o("layerview:store-spatial-reference-wkt-vertex-incompatible","The vertexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const i=r?new U(N(r)):e.spatialReference;return i.equals(e.spatialReference)?e.spatialReference:i}function X(e,t){return null==t?"@null":t===m(t)?"@ECEF":e.equals(t)?"":null!=t.wkid?"@"+t.wkid:null}function Y(e,t,r){if(!p(e,t))throw new o("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{});if("local"===r&&!te(e,t))throw new o("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{})}function ee(e,t,r){if(e.serviceUpdateTimeStamp?.lastUpdate!==t.serviceUpdateTimeStamp?.lastUpdate||!r.isEmpty||e.associatedLayer?.url!==t.associatedLayer?.url)throw new o("layerview:recycle-failed")}function te(e,t){return e.equals(t)||e.isWGS84&&t.isWebMercator||e.isWebMercator&&t.isWGS84}function re(e,t,r){const o=H(e),n=J(e);Y(o,t,r),Y(n,t,r)}function oe(e){return(null==e.geometryType||"triangles"===e.geometryType)&&((null==e.topology||"PerAttributeArray"===e.topology)&&null!=e.vertexAttributes?.position)}function ne(e){if(null==e.store?.defaultGeometrySchema||!oe(e.store.defaultGeometrySchema))throw new o("scenelayer:unsupported-geometry-schema","The geometry schema of this scene layer is not supported.",{url:e.parsedUrl.path})}function ie(e,t){re(e,t.spatialReference,t.viewingMode)}function ae(e){return null!=e.geometryType&&"points"===e.geometryType&&((null==e.topology||"PerAttributeArray"===e.topology)&&((null==e.encoding||""===e.encoding||"lepcc-xyz"===e.encoding)&&null!=e.vertexAttributes?.position))}function se(e){if(null==e.store?.defaultGeometrySchema||!ae(e.store.defaultGeometrySchema))throw new o("pointcloud:unsupported-geometry-schema","The geometry schema of this point cloud scene layer is not supported.",{})}function le(e,t){Y(e.spatialReference,t.spatialReference,t.viewingMode)}function ce(e){return"simple"===e.type||"class-breaks"===e.type||"unique-value"===e.type}function ue(e){return"mesh-3d"===e.type}function fe(e){if(null==e||!ce(e))return!0;if(("unique-value"===e.type||"class-breaks"===e.type)&&null==e.defaultSymbol)return!0;const t=e.getSymbols();if(0===t.length)return!0;for(const r of t){if(!ue(r)||0===r.symbolLayers.length)return!0;for(const e of r.symbolLayers.items)if("fill"!==e.type||null==e.material?.color||"replace"!==e.material.colorMixMode)return!0}return!1}const pe=v({color:[0,0,0,0],opacity:0});class me{constructor(){this.edgeMaterial=null,this.material=null,this.castShadows=!0}}function de(e){const t=new me;let r=!1,o=!1;for(const n of e.symbolLayers.items)if("fill"===n.type&&n.enabled){const e=n.material,i=n.edges;if(null!=e&&!r){const o=e.color,i=R(e.colorMixMode);t.material=null!=o?{color:[o.r/255,o.g/255,o.b/255],alpha:o.a,colorMixMode:i}:{color:[1,1,1],alpha:1,colorMixMode:x.Multiply},t.castShadows=n.castShadows,r=!0}null==i||o||(t.edgeMaterial=I(i,{}),o=!0)}return t.material||(t.material={color:[1,1,1],alpha:1,colorMixMode:x.Multiply}),t}function he(e,t){return(0|e)+(0|t)|0}function ye(e,t,r,o,n,i){if(!i||0===i.length||null==t||!e.mbs)return null;const s=E(e.mbs,n,r,t);a(je,s);let f=null;const p=()=>{if(!f)if(f=Te,y(ve),null!=e.serviceObb){e.serviceObb.transform(Ie,r,t,n),Ie.getCorners(f);for(const e of f)c(e,e,je),g(ve,e)}else{const o=e.mbs;if(!o)return;const i=o[3];d(w(o),r,Re,t),c(Re,Re,je),Re[2]+=n;for(let e=0;e<8;++e){const t=1&e?i:-i,r=2&e?i:-i,o=4&e?i:-i,n=f[e];u(n,[Re[0]+t,Re[1]+r,Re[2]+o]),g(ve,n)}}};let m=1/0,h=-1/0;const S=e=>{if("replace"!==e.type)return;const r=e.geometry;if(!r?.hasZ)return;y(Ee);const n=r.spatialReference||o,i=r.rings.reduce(((e,r)=>r.reduce(((e,r)=>(l(Re,r[0],r[1],r[2]),d(Re,n,Re,t),c(Re,Re,je),g(Ee,Re),Math.min(Re[2],e))),e)),1/0);p(),b(ve,Ee)&&(m=Math.min(m,i),h=Math.max(h,i))};if(i.forEach((e=>S(e))),m===1/0)return null;const T=(e,t,r)=>{c(Re,r,s),e[t]=Re[0],e[t+1]=Re[1],e[t+2]=Re[2],t+=24,r[2]=m,c(Re,r,s),e[t]=Re[0],e[t+1]=Re[1],e[t+2]=Re[2],t+=24,r[2]=h,c(Re,r,s),e[t]=Re[0],e[t+1]=Re[1],e[t+2]=Re[2]};for(let a=0;a<8;++a)T(xe.data,3*a,f[a]);return M(xe)}function ge(e){return null!=e&&e.halfSize[0]>=0}function be(e){return e[3]>=0}function we(e){null!=e&&(e.halfSize=C)}function Se(e){null!=e&&(e[3]=-1)}const Te=[f(),f(),f(),f(),f(),f(),f(),f()],Ee=h(),ve=h(),Ie=new j,Re=f(),xe={data:new Array(72),size:3,exclusive:!0,stride:3},je=s();export{q as MbsIntersectResult,me as SymbolInfo,he as addWraparound,le as checkPointCloudLayerCompatibleWithView,se as checkPointCloudLayerValid,ee as checkRecyclable,ie as checkSceneLayerCompatibleWithView,ne as checkSceneLayerValid,Y as checkSpatialReference,re as checkSpatialReferences,ye as computeVisibilityObb,k as containsDraco,N as extractWkid,W as filterInPlace,A as findFieldsCaseInsensitive,D as findIntersectingNodes,X as getCacheKeySuffix,Z as getCachedAttributeValue,O as getClipRect,H as getIndexCrs,de as getSymbolInfo,J as getVertexCrs,L as intersectBoundingRectWithMbs,Se as invalidateMbs,we as invalidateObb,te as isSupportedLocalModeProjection,be as isValidMbs,ge as isValidObb,_ as objectIdFilter,$ as queryAttributesFromCachedAttributesId,fe as rendererNeedsTextures,pe as transparentEdgeMaterial,K as whenGraphicAttributes};
5
+ import"../../../../geometry.js";import e from"../../../../request.js";import{binaryIndexOf as t,splitIntoChunks as r}from"../../../../core/arrayUtils.js";import o from"../../../../core/Error.js";import has from"../../../../core/has.js";import{isInt16Array as n,isInt32Array as i}from"../../../../core/typedArrayUtil.js";import{invert as a}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as l,e as c,c as u}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as p}from"../../../../geometry/projection.js";import{getSphericalPCPF as m}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectVectorToVector as d}from"../../../../geometry/projection/projectVectorToVector.js";import{create as h,empty as y,expandPointInPlace as g,intersects as b}from"../../../../geometry/support/aaBoundingRect.js";import{g as w}from"../../../../chunks/sphere.js";import S from"../../../../rest/support/Query.js";import{readBinaryAttribute as T}from"./I3SBinaryReader.js";import{computeGlobalTransformation as E}from"./I3SProjectionUtil.js";import{createSolidEdgeMaterial as v,createMaterialFromEdges as I}from"../support/edgeUtils.js";import{parseColorMixMode as R,ColorMixModeEnum as x}from"../support/symbolColorUtils.js";import{Obb as j,compute as M,INVALID_HALFSIZE as C}from"../../support/orientedBoundingBox.js";import U from"../../../../geometry/SpatialReference.js";function N(e){return e?parseInt(e.substring(e.lastIndexOf("/")+1,e.length),10):void 0}function k(e){if(has("disable-feature:i3s-draco")||!e)return!1;for(const t of e)for(const e of t.geometryBuffers)if("draco"===e.compressedAttributes?.encoding)return!0;return!1}function D(e,t,r,o){r.traverse(t,(t=>{const r=t.mbs;return(null!=r&&L(e,r))!==q.OUTSIDE&&(o(t),!0)}))}function W(e,t,r){let o=0,n=0;for(let i=0;i<t.length&&o<e.length;i++)e[o]===t[i]&&(r(i)&&(e[n]=e[o],n++),o++);e.length=n}function _(e,r,o){let n=0,i=0;for(;n<o.length;){t(e,o[n])>=0===r&&(o[i]=o[n],i++),n++}o.length=i}const F=h();function O(e,t){if(0===t.rotationScale[1]&&0===t.rotationScale[2]&&0===t.rotationScale[3]&&0===t.rotationScale[5]&&0===t.rotationScale[6]&&0===t.rotationScale[7])return F[0]=(e[0]-t.position[0])/t.rotationScale[0],F[1]=(e[1]-t.position[1])/t.rotationScale[4],F[2]=(e[2]-t.position[0])/t.rotationScale[0],F[3]=(e[3]-t.position[1])/t.rotationScale[4],F}var q;function L(e,t){const r=t[0],o=t[1],n=t[3],i=e[0]-r,a=r-e[2],s=e[1]-o,l=o-e[3],c=Math.max(i,a,0),u=Math.max(s,l,0),f=c*c+u*u;if(f>n*n)return q.OUTSIDE;if(f>0)return q.INTERSECTS_CENTER_OUTSIDE;return-Math.max(i,a,s,l)>n?q.INSIDE:q.INTERSECTS_CENTER_INSIDE}function A(e,t,r){const o=[],n=r?.missingFields,i=r?.originalFields;for(const a of e){const e=a.toLowerCase();let r=!1;for(const n of t)if(e===n.name.toLowerCase()){o.push(n.name),r=!0,i&&i.push(a);break}!r&&n&&n.push(a)}return o}async function K(e,t,r,n,i){if(0===t.length)return[];const a=e.attributeStorageInfo;if(null!=e.associatedLayer)try{return await G(e.associatedLayer,t,r,n)}catch(s){if(e.associatedLayer.loaded)throw s}if(a){const s=B(t,r,i);if(null==s)throw new o("scenelayer:features-not-loaded","Tried to query attributes for unloaded features");const l=e.parsedUrl.path;return(await Promise.all(s.map((e=>z(l,a,e.node,e.indices,n).then((t=>{for(let r=0;r<e.graphics.length;r++){const o=e.graphics[r],n=t[r];if(o.attributes)for(const e in o.attributes)e in n||(n[e]=o.attributes[e]);o.attributes=n}return e.graphics})))))).flat()}throw new o("scenelayer:no-attribute-source","This scene layer does not have a source for attributes available")}function B(e,t,r){const o=new Map,n=[],i=r();for(const a of e){const e=a.attributes[t];for(let t=0;t<i.length;t++){const r=i[t],s=r.featureIds.indexOf(e);if(s>=0){let e=o.get(r.node);e||(e={node:r.node,indices:[],graphics:[]},n.push(e),o.set(r.node,e)),e.indices.push(s),e.graphics.push(a);for(let r=t;r>0;r--)i[r]=i[r-1];i[0]=r;break}}}return n}async function G(e,t,r,o){t.sort(((e,t)=>e.attributes[r]-t.attributes[r]));const n=t.map((e=>e.attributes[r])),i=[],a=A(o,e.fields,{originalFields:i}),s=await P(e,n,a);for(let l=0;l<t.length;l++){const e=t[l],r=s[l],o={};if(e.attributes)for(const t in e.attributes)o[t]=e.attributes[t];for(let t=0;t<i.length;t++)o[i[t]]=r[a[t]];e.attributes=o}return t}function P(e,t,n){const i=e.capabilities.query.maxRecordCount;if(null!=i&&t.length>i){const o=r(t,i);return Promise.all(o.map((t=>P(e,t,n)))).then((e=>e.flat()))}const a=new S({objectIds:t,outFields:n,orderByFields:[e.objectIdField]});return e.queryFeatures(a).then((e=>{if(e&&e.features&&e.features.length===t.length)return e.features.map((e=>e.attributes));throw new o("scenelayer:feature-not-in-associated-layer","Feature not found in associated feature layer")}))}function z(e,t,r,o,n){return $(e,t,r.resources.attributes,o,n)}async function $(t,r,o,n,i){const a=[];for(const e of r)if(e&&i.includes(e.name)){const r=`${t}/nodes/${o}/attributes/${e.key}/0`;a.push({url:r,storageInfo:e})}const s=await Promise.allSettled(a.map((t=>e(t.url,{responseType:"array-buffer"}).then((e=>T(t.storageInfo,e.data)))))),l=[];for(const e of n){const t={};for(let r=0;r<s.length;r++){const o=s[r];if("fulfilled"===o.status){const n=o.value;t[a[r].storageInfo.name]=Z(n,e)}}l.push(t)}return l}!function(e){e[e.OUTSIDE=0]="OUTSIDE",e[e.INTERSECTS_CENTER_OUTSIDE=1]="INTERSECTS_CENTER_OUTSIDE",e[e.INTERSECTS_CENTER_INSIDE=2]="INTERSECTS_CENTER_INSIDE",e[e.INSIDE=3]="INSIDE"}(q||(q={}));const V=-32768,Q=-(2**31);function Z(e,t){if(!e)return null;const r=e[t];if(n(e))return r===V?null:r;if(i(e))return r===Q?null:r;return r!=r?null:r}function H(e){const t=e.store,r=t.indexCRS||t.geographicCRS,n=void 0===r?t.indexWKT:void 0;if(n){if(!e.spatialReference)throw new o("layerview:no-store-spatial-reference-wkt-index-and-no-layer-spatial-reference","Found indexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new o("layerview:store-spatial-reference-wkt-index-incompatible","The indexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const i=r?new U(N(r)):e.spatialReference;return i.equals(e.spatialReference)?e.spatialReference:i}function J(e){const t=e.store,r=t.vertexCRS||t.projectedCRS,n=void 0===r?t.vertexWKT:void 0;if(n){if(!e.spatialReference)throw new o("layerview:no-store-spatial-reference-wkt-vertex-and-no-layer-spatial-reference","Found vertexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new o("layerview:store-spatial-reference-wkt-vertex-incompatible","The vertexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const i=r?new U(N(r)):e.spatialReference;return i.equals(e.spatialReference)?e.spatialReference:i}function X(e,t){return null==t?"@null":t===m(t)?"@ECEF":e.equals(t)?"":null!=t.wkid?"@"+t.wkid:null}function Y(e,t,r){if(!p(e,t))throw new o("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{});if("local"===r&&!te(e,t))throw new o("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{})}function ee(e,t,r){if(e.serviceUpdateTimeStamp?.lastUpdate!==t.serviceUpdateTimeStamp?.lastUpdate||!r.isEmpty||e.associatedLayer?.url!==t.associatedLayer?.url)throw new o("layerview:recycle-failed")}function te(e,t){return e.equals(t)||e.isWGS84&&t.isWebMercator||e.isWebMercator&&t.isWGS84}function re(e,t,r){const o=H(e),n=J(e);Y(o,t,r),Y(n,t,r)}function oe(e){return(null==e.geometryType||"triangles"===e.geometryType)&&((null==e.topology||"PerAttributeArray"===e.topology)&&null!=e.vertexAttributes?.position)}function ne(e){if(null==e.store?.defaultGeometrySchema||!oe(e.store.defaultGeometrySchema))throw new o("scenelayer:unsupported-geometry-schema","The geometry schema of this scene layer is not supported.",{url:e.parsedUrl.path})}function ie(e,t){re(e,t.spatialReference,t.viewingMode)}function ae(e){return null!=e.geometryType&&"points"===e.geometryType&&((null==e.topology||"PerAttributeArray"===e.topology)&&((null==e.encoding||""===e.encoding||"lepcc-xyz"===e.encoding)&&null!=e.vertexAttributes?.position))}function se(e){if(null==e.store?.defaultGeometrySchema||!ae(e.store.defaultGeometrySchema))throw new o("pointcloud:unsupported-geometry-schema","The geometry schema of this point cloud scene layer is not supported.",{})}function le(e,t){Y(e.spatialReference,t.spatialReference,t.viewingMode)}function ce(e){return"simple"===e.type||"class-breaks"===e.type||"unique-value"===e.type}function ue(e){return"mesh-3d"===e.type}function fe(e){if(null==e||!ce(e))return!0;if(("unique-value"===e.type||"class-breaks"===e.type)&&null==e.defaultSymbol)return!0;const t=e.getSymbols();if(0===t.length)return!0;for(const r of t){if(!ue(r)||0===r.symbolLayers.length)return!0;for(const e of r.symbolLayers.items)if("fill"!==e.type||null==e.material?.color||"replace"!==e.material.colorMixMode)return!0}return!1}const pe=v({color:[0,0,0,0],opacity:0});class me{constructor(){this.edgeMaterial=null,this.material=null,this.castShadows=!0}}function de(e){const t=new me;let r=!1,o=!1;for(const n of e.symbolLayers.items)if("fill"===n.type&&n.enabled){const e=n.material,i=n.edges;if(null!=e&&!r){const o=e.color,i=R(e.colorMixMode);t.material=null!=o?{color:[o.r/255,o.g/255,o.b/255],alpha:o.a,colorMixMode:i}:{color:[1,1,1],alpha:1,colorMixMode:x.Multiply},t.castShadows=n.castShadows,r=!0}null==i||o||(t.edgeMaterial=I(i,{}),o=!0)}return t.material||(t.material={color:[1,1,1],alpha:1,colorMixMode:x.Multiply}),t}function he(e,t){return(0|e)+(0|t)|0}function ye(e,t,r,o,n,i,s){if(!i||0===i.length||null==t||!e.mbs)return null;const f=E(e.mbs,n,r,t);a(je,f);let p=null;const m=()=>{if(!p)if(p=Te,y(ve),null!=e.serviceObb){e.serviceObb.transform(Ie,r,t,n,s),Ie.getCorners(p);for(const e of p)c(e,e,je),g(ve,e)}else{const o=e.mbs;if(!o)return;const i=o[3];d(w(o),r,Re,t),c(Re,Re,je),Re[2]+=n;for(let e=0;e<8;++e){const t=1&e?i:-i,r=2&e?i:-i,o=4&e?i:-i,n=p[e];u(n,[Re[0]+t,Re[1]+r,Re[2]+o]),g(ve,n)}}};let h=1/0,S=-1/0;const T=e=>{if("replace"!==e.type)return;const r=e.geometry;if(!r?.hasZ)return;y(Ee);const n=r.spatialReference||o,i=r.rings.reduce(((e,r)=>r.reduce(((e,r)=>(l(Re,r[0],r[1],r[2]),d(Re,n,Re,t),c(Re,Re,je),g(Ee,Re),Math.min(Re[2],e))),e)),1/0);m(),b(ve,Ee)&&(h=Math.min(h,i),S=Math.max(S,i))};if(i.forEach((e=>T(e))),h===1/0)return null;const v=(e,t,r)=>{c(Re,r,f),e[t]=Re[0],e[t+1]=Re[1],e[t+2]=Re[2],t+=24,r[2]=h,c(Re,r,f),e[t]=Re[0],e[t+1]=Re[1],e[t+2]=Re[2],t+=24,r[2]=S,c(Re,r,f),e[t]=Re[0],e[t+1]=Re[1],e[t+2]=Re[2]};for(let a=0;a<8;++a)v(xe.data,3*a,p[a]);return M(xe)}function ge(e){return null!=e&&e.halfSize[0]>=0}function be(e){return e[3]>=0}function we(e){null!=e&&(e.halfSize=C)}function Se(e){null!=e&&(e[3]=-1)}const Te=[f(),f(),f(),f(),f(),f(),f(),f()],Ee=h(),ve=h(),Ie=new j,Re=f(),xe={data:new Array(72),size:3,exclusive:!0,stride:3},je=s();export{q as MbsIntersectResult,me as SymbolInfo,he as addWraparound,le as checkPointCloudLayerCompatibleWithView,se as checkPointCloudLayerValid,ee as checkRecyclable,ie as checkSceneLayerCompatibleWithView,ne as checkSceneLayerValid,Y as checkSpatialReference,re as checkSpatialReferences,ye as computeVisibilityObb,k as containsDraco,N as extractWkid,W as filterInPlace,A as findFieldsCaseInsensitive,D as findIntersectingNodes,X as getCacheKeySuffix,Z as getCachedAttributeValue,O as getClipRect,H as getIndexCrs,de as getSymbolInfo,J as getVertexCrs,L as intersectBoundingRectWithMbs,Se as invalidateMbs,we as invalidateObb,te as isSupportedLocalModeProjection,be as isValidMbs,ge as isValidObb,_ as objectIdFilter,$ as queryAttributesFromCachedAttributesId,fe as rendererNeedsTextures,pe as transparentEdgeMaterial,K as whenGraphicAttributes};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{a as e,k as t,l as i,i as s,j as r,m as n,f as o,g as a}from"../../../../chunks/vec32.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c}from"../../../../chunks/vec42.js";import{getReferenceEllipsoid as l}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as m}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingSphere as p}from"../../../../geometry/projection/projectBoundingSphere.js";import{create as _,fromMatrix as u,intersectsSphere as d}from"../../../../geometry/support/frustum.js";import{isPlateCarree as g}from"../../../../geometry/support/spatialReferenceUtils.js";import{w as v,g as b}from"../../../../chunks/sphere.js";import{makeDehydratedPoint as f}from"../../../../layers/graphics/dehydratedPoint.js";import{evaluateElevationAlignmentAtPoint as x}from"../graphics/elevationAlignmentUtils.js";import{ElevationContext as M}from"../graphics/ElevationContext.js";import{createContextWithoutExpressionSupport as R,extractExpressionInfo as C}from"../graphics/featureExpressionInfoUtils.js";import{expandElevationRange as D}from"./ElevationRange.js";import{LodMetric as S}from"./I3SNode.js";import{isValidMbs as E,isValidObb as P,intersectBoundingRectWithMbs as O,MbsIntersectResult as L}from"./I3SUtil.js";import{Obb as j,computeOffsetObb as B}from"../../support/orientedBoundingBox.js";const F=1e5;class y{constructor(e,t,i,s,r,n,o,a,c={}){this._indexSR=e,this._renderCoordsHelper=t,this._clippingArea=r,this._elevationProvider=n,this._viewingMode=o,this._options=c,this._frustum=_(),this._useFrustumCulling=!1,this._poi=h(),this._elevationContext=null,this.minDistance=1/0,this.maxDistance=0,this.maxLodLevel=2,this._tmpObb=new j,this._tmp1=h(),this._tmp2=h(),this._tmp3=h(),this._tmp0=h(),this._screenspaceErrorBias=c.screenspaceErrorBias||1,this._progressiveLoadFactor=c.progressiveLoadFactor||1,this.updateCamera(i,s),this.engineSR=this._renderCoordsHelper.spatialReference,this.updateElevationInfo(a),this._tmpPoint=f(0,0,0,e),this._isECEFOBBInLocalMode=this._indexSR.isWGS84&&(this.engineSR.isWebMercator||g(this.engineSR)),this._indexSREllipsoidRadius=l(this._indexSR).radius}updateElevationInfo(e){null!=e?(this._elevationContext=M.fromElevationInfo(e),this._elevationContext.updateFeatureExpressionInfoContext(R(C(e,!1)))):this._elevationContext=null}updateCamera(e,t){this._useFrustumCulling=t,t&&u(e.viewMatrix,e.projectionMatrix,this._frustum),this._screenSizeFactor=1/(e.perScreenPixelRatio/2),this._camPos=e.eye,this.minDistance=1/0,this.maxDistance=0}setPointOfInterest(e){this._poi=e}updateScreenSpaceErrorBias(e){const t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this._clippingArea=e}expandElevationRange(e,t,i){if(null==this._elevationContext)return;const s=e.mbs;if(!s)return;if(this._elevationProvider.getSphereElevationBounds){const e=this._elevationProvider.getSphereElevationBounds(s,this._indexSR);return void(e&&D(i,e.min,e.max))}const r=s[0],n=s[1],o=s[2],a="relative-to-scene"===this._elevationContext.mode?"scene":"ground",h=this._elevationProvider.getElevation(r,n,o,this._indexSR,a);h&&D(i,h,h);const c=t?null:this._elevationProvider.getRootElevationBounds?.();c&&D(i,c.min,c.max)}getRenderMbs(e){const t=e.renderMbs;if(E(t))return t;e.mbs&&c(t,e.mbs);const i=e.elevationRangeMin;if(this._elevationContext&&Number.isFinite(i)){let s=0,r=0;const n=e.elevationRangeMax;switch(this._elevationContext.mode){case"relative-to-ground":s=this._elevationContext.geometryZWithOffset(t[2],this._renderCoordsHelper)+i-t[2],r=n-i;break;case"on-the-ground":s=i-t[2],r=n-i}t[2]+=s+.5*r,t[3]+=.5*r}else this._elevationContext&&t[3]<F&&(this._tmpPoint.x=t[0],this._tmpPoint.y=t[1],this._tmpPoint.z=t[2],t[2]=x(this._tmpPoint,this._elevationProvider,this._elevationContext,this._renderCoordsHelper));return p(t,this._indexSR,t,this.engineSR),t}_getVisibilityObb(e){if(e.visibilityObb)return e.visibilityObb;const t=e.serviceObb,i=.01*this._indexSREllipsoidRadius;return null==t||!e.mbs||!P(t)||this._isECEFOBBInLocalMode&&t.halfSize.some((e=>e>i))?null:(e.serviceObbInRenderSR=this._computeRenderObb(t,e.serviceObbInRenderSR,e.mbs[3],e.elevationRangeMin,e.elevationRangeMax),e.serviceObbInRenderSR)}_computeRenderObb(e,t,i,s,r){if(null==t)t=new j;else if(P(t))return t;let n=0,o=0;if(this._elevationContext&&!Number.isNaN(s)&&Number.isFinite(s))switch(this._elevationContext.mode){case"relative-to-ground":n=this._elevationContext.geometryZWithOffset(e.center[2],this._renderCoordsHelper)+s-e.center[2],o=r-s;break;case"on-the-ground":n=s-e.center[2],o=r-s}else this._elevationContext&&i<F&&(this._tmpPoint.x=e.center[0],this._tmpPoint.y=e.center[1],this._tmpPoint.z=e.center[2],n=x(this._tmpPoint,this._elevationProvider,this._elevationContext,this._renderCoordsHelper)-e.center[2]);return o>0?(e.transform(this._tmpObb,this._indexSR,this.engineSR,n),B(this._tmpObb,0,o,this._viewingMode,t)):e.transform(t,this._indexSR,this.engineSR,n),t}isNodeVisible(e){const t=this.getRenderMbs(e);if(!this._isMBSinClippingArea(t))return!1;if(!this._useFrustumCulling)return!0;const i=this._getVisibilityObb(e);return i?i.isVisible(this._frustum):d(this._frustum,v(t))}isGeometryVisible(e){if(!this._useFrustumCulling)return!0;const t=e.geometryObb;return t?.isVisible(this._frustum)??this.isNodeVisible(e)}_isMBSinClippingArea(e){return null==this._clippingArea||O(this._clippingArea,e)!==L.OUTSIDE}_screenSpaceDiameterMbs(t,i){const s=this.getRenderMbs(t),r=Math.sqrt(e(b(s),this._camPos)),n=r-s[3];return this._updateMinMaxDistance(r),n<0?.5*Number.MAX_VALUE:i/n*this._screenSizeFactor}calcCameraDistance(e){return this.calcCameraDistanceToCenter(e)-this.getRenderMbs(e)[3]}calcCameraDistanceToCenter(e){const i=this.getRenderMbs(e),s=t(b(i),this._camPos);return this._updateMinMaxDistance(s),s}calcAngleDependentLoD(e){const s=this.getRenderMbs(e),r=s[3],n=(Math.abs(s[0]*(s[0]-this._camPos[0])+s[1]*(s[1]-this._camPos[1])+s[2]*(s[2]-this._camPos[2]))/i(b(s))+r)/t(b(s),this._camPos);return Math.min(1,n)}hasLOD(e){return e.lodMetric!==S.None}_getDistancePlanarMode(e,t){const i=e[0]-t[0],s=e[1]-t[1],r=e[2]-t[2],n=i*i+s*s,o=t[3];if(n<=o*o)return Math.abs(r);const a=Math.sqrt(n)-o;return Math.sqrt(r*r+a*a)}_getDistanceGlobeMode(h,c){const l=i(b(c)),m=i(h)-l;s(this._tmp0,h,r(h,b(c))/n(h));const p=e(b(c),this._tmp0),_=c[3];if(p<=_*_)return Math.abs(m);{const e=s(this._tmp0,b(c),1/l),n=l,p=_*_/2/n,u=s(this._tmp1,e,n-p),d=h,g=o(this._tmp2,d,u),v=o(this._tmp2,g,s(this._tmp3,e,r(e,g))),f=a(this._tmp2,u,s(this._tmp2,v,_/i(v)));let x=t(d,f);if(m>=2e5){const t=o(this._tmp1,d,f);let s=r(t,e)/i(t);s<.08&&(s=1e-4),x/=s}return x}}_getDistance(e,t){return this.engineSR===m(this.engineSR)?this._getDistanceGlobeMode(e,t):this._getDistancePlanarMode(e,t)}_updateMinMaxDistance(e){e>0?(this.minDistance=Math.min(this.minDistance,e),this.maxDistance=Math.max(this.maxDistance,e)):(this.minDistance=0,this.maxDistance=Math.max(this.maxDistance,-e))}getLodLevel(e){if(e.lodMetric===S.None)return 0;if(0===e.childCount)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){const t=this._progressiveLoadFactor*this._screenspaceErrorBias,i=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,i)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case S.ScreenSpaceRelative:{const i=this.getRenderMbs(e),s=this._getDistance(this._camPos,i),r=2*s/this._screenSizeFactor,n=s+i[3];return this._updateMinMaxDistance(n),e.maxError*t<=r}case S.MaxScreenThreshold:{let i=this._screenSpaceDiameterMbs(e,e.mbs[3]*t);return this._options.angleDependentLoD&&(i*=this.calcAngleDependentLoD(e)),i<e.maxError}case S.RemovedFeatureDiameter:return this._screenSpaceDiameterMbs(e,e.maxError)*t<10;case S.DistanceRangeFromDefaultCamera:return this.calcCameraDistance(e)>e.maxError*t}return!1}distToPOI(e){const i=this.getRenderMbs(e);return t(b(i),this._poi)-i[3]}distCameraToPOI(){return t(this._camPos,this._poi)}}export{y as default};
5
+ import{a as e,k as t,l as i,i as s,j as r,m as n,f as o,g as a}from"../../../../chunks/vec32.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c}from"../../../../chunks/vec42.js";import{getReferenceEllipsoid as l}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as m}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingSphere as _}from"../../../../geometry/projection/projectBoundingSphere.js";import{create as p,fromMatrix as u,intersectsSphere as d}from"../../../../geometry/support/frustum.js";import{isPlateCarree as v}from"../../../../geometry/support/spatialReferenceUtils.js";import{w as g,g as b}from"../../../../chunks/sphere.js";import{makeDehydratedPoint as f}from"../../../../layers/graphics/dehydratedPoint.js";import{evaluateElevationAlignmentAtPoint as x}from"../graphics/elevationAlignmentUtils.js";import{ElevationContext as M}from"../graphics/ElevationContext.js";import{createContextWithoutExpressionSupport as R,extractExpressionInfo as C}from"../graphics/featureExpressionInfoUtils.js";import{expandElevationRange as S}from"./ElevationRange.js";import{LodMetric as D}from"./I3SNode.js";import{isValidMbs as P,isValidObb as E,intersectBoundingRectWithMbs as O,MbsIntersectResult as F}from"./I3SUtil.js";import{Obb as L,computeOffsetObb as j}from"../../support/orientedBoundingBox.js";const B=1e5;class y{constructor(e,t,i,s,r,n,o,a,c={}){this._indexSR=e,this._renderCoordsHelper=t,this._clippingArea=r,this._elevationProvider=n,this._viewingMode=o,this._options=c,this._frustum=p(),this._useFrustumCulling=!1,this._poi=h(),this._elevationContext=null,this.minDistance=1/0,this.maxDistance=0,this.maxLodLevel=2,this._tmpObb=new L,this._tmp1=h(),this._tmp2=h(),this._tmp3=h(),this._tmp0=h(),this._screenspaceErrorBias=c.screenspaceErrorBias||1,this._progressiveLoadFactor=c.progressiveLoadFactor||1,this.updateCamera(i,s);const _=this._renderCoordsHelper.spatialReference;this._renderSR=_,this._renderSRSphericalPCPF=m(_),this._isGlobalMode=_===this._renderSRSphericalPCPF,this.updateElevationInfo(a),this._tmpPoint=f(0,0,0,e),this._isECEFOBBInLocalMode=this._indexSR.isWGS84&&(_.isWebMercator||v(_)),this._indexSREllipsoidRadius=l(this._indexSR).radius}updateElevationInfo(e){null!=e?(this._elevationContext=M.fromElevationInfo(e),this._elevationContext.updateFeatureExpressionInfoContext(R(C(e,!1)))):this._elevationContext=null}updateCamera(e,t){this._useFrustumCulling=t,t&&u(e.viewMatrix,e.projectionMatrix,this._frustum),this._screenSizeFactor=1/(e.perScreenPixelRatio/2),this._camPos=e.eye,this.minDistance=1/0,this.maxDistance=0}setPointOfInterest(e){this._poi=e}updateScreenSpaceErrorBias(e){const t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this._clippingArea=e}expandElevationRange(e,t,i){if(null==this._elevationContext)return;const s=e.mbs;if(!s)return;if(this._elevationProvider.getSphereElevationBounds){const e=this._elevationProvider.getSphereElevationBounds(s,this._indexSR);return void(e&&S(i,e.min,e.max))}const r=s[0],n=s[1],o=s[2],a="relative-to-scene"===this._elevationContext.mode?"scene":"ground",h=this._elevationProvider.getElevation(r,n,o,this._indexSR,a);h&&S(i,h,h);const c=t?null:this._elevationProvider.getRootElevationBounds?.();c&&S(i,c.min,c.max)}getRenderMbs(e){const t=e.renderMbs;if(P(t))return t;e.mbs&&c(t,e.mbs);const i=e.elevationRangeMin;if(this._elevationContext&&Number.isFinite(i)){let s=0,r=0;const n=e.elevationRangeMax;switch(this._elevationContext.mode){case"relative-to-ground":s=this._elevationContext.geometryZWithOffset(t[2],this._renderCoordsHelper)+i-t[2],r=n-i;break;case"on-the-ground":s=i-t[2],r=n-i}t[2]+=s+.5*r,t[3]+=.5*r}else this._elevationContext&&t[3]<B&&(this._tmpPoint.x=t[0],this._tmpPoint.y=t[1],this._tmpPoint.z=t[2],t[2]=x(this._tmpPoint,this._elevationProvider,this._elevationContext,this._renderCoordsHelper));return _(t,this._indexSR,t,this._renderSR),t}_getVisibilityObb(e){if(e.visibilityObb)return e.visibilityObb;const t=e.serviceObb,i=.01*this._indexSREllipsoidRadius;return null==t||!e.mbs||!E(t)||this._isECEFOBBInLocalMode&&t.halfSize.some((e=>e>i))?null:(e.serviceObbInRenderSR=this._computeRenderObb(t,e.serviceObbInRenderSR,e.mbs[3],e.elevationRangeMin,e.elevationRangeMax),e.serviceObbInRenderSR)}_computeRenderObb(e,t,i,s,r){if(null==t)t=new L;else if(E(t))return t;let n=0,o=0;if(this._elevationContext&&!Number.isNaN(s)&&Number.isFinite(s))switch(this._elevationContext.mode){case"relative-to-ground":n=this._elevationContext.geometryZWithOffset(e.center[2],this._renderCoordsHelper)+s-e.center[2],o=r-s;break;case"on-the-ground":n=s-e.center[2],o=r-s}else this._elevationContext&&i<B&&(this._tmpPoint.x=e.center[0],this._tmpPoint.y=e.center[1],this._tmpPoint.z=e.center[2],n=x(this._tmpPoint,this._elevationProvider,this._elevationContext,this._renderCoordsHelper)-e.center[2]);return o>0?(e.transform(this._tmpObb,this._indexSR,this._renderSR,n,this._renderSRSphericalPCPF),j(this._tmpObb,0,o,this._viewingMode,t)):e.transform(t,this._indexSR,this._renderSR,n,this._renderSRSphericalPCPF),t}isNodeVisible(e){const t=this.getRenderMbs(e);if(!this._isMBSinClippingArea(t))return!1;if(!this._useFrustumCulling)return!0;const i=this._getVisibilityObb(e);return i?i.isVisible(this._frustum):d(this._frustum,g(t))}isGeometryVisible(e){if(!this._useFrustumCulling)return!0;const t=e.geometryObb;return t?.isVisible(this._frustum)??this.isNodeVisible(e)}_isMBSinClippingArea(e){return null==this._clippingArea||O(this._clippingArea,e)!==F.OUTSIDE}_screenSpaceDiameterMbs(t,i){const s=this.getRenderMbs(t),r=Math.sqrt(e(b(s),this._camPos)),n=r-s[3];return this._updateMinMaxDistance(r),n<0?.5*Number.MAX_VALUE:i/n*this._screenSizeFactor}calcCameraDistance(e){return this.calcCameraDistanceToCenter(e)-this.getRenderMbs(e)[3]}calcCameraDistanceToCenter(e){const i=this.getRenderMbs(e),s=t(b(i),this._camPos);return this._updateMinMaxDistance(s),s}calcAngleDependentLoD(e){const s=this.getRenderMbs(e),r=s[3],n=(Math.abs(s[0]*(s[0]-this._camPos[0])+s[1]*(s[1]-this._camPos[1])+s[2]*(s[2]-this._camPos[2]))/i(b(s))+r)/t(b(s),this._camPos);return Math.min(1,n)}hasLOD(e){return e.lodMetric!==D.None}_getDistancePlanarMode(e,t){const i=e[0]-t[0],s=e[1]-t[1],r=e[2]-t[2],n=i*i+s*s,o=t[3];if(n<=o*o)return Math.abs(r);const a=Math.sqrt(n)-o;return Math.sqrt(r*r+a*a)}_getDistanceGlobeMode(h,c){const l=i(b(c)),m=i(h)-l;s(this._tmp0,h,r(h,b(c))/n(h));const _=e(b(c),this._tmp0),p=c[3];if(_<=p*p)return Math.abs(m);{const e=s(this._tmp0,b(c),1/l),n=l,_=p*p/2/n,u=s(this._tmp1,e,n-_),d=h,v=o(this._tmp2,d,u),g=o(this._tmp2,v,s(this._tmp3,e,r(e,v))),f=a(this._tmp2,u,s(this._tmp2,g,p/i(g)));let x=t(d,f);if(m>=2e5){const t=o(this._tmp1,d,f);let s=r(t,e)/i(t);s<.08&&(s=1e-4),x/=s}return x}}_getDistance(e,t){return this._isGlobalMode?this._getDistanceGlobeMode(e,t):this._getDistancePlanarMode(e,t)}_updateMinMaxDistance(e){e>0?(this.minDistance=Math.min(this.minDistance,e),this.maxDistance=Math.max(this.maxDistance,e)):(this.minDistance=0,this.maxDistance=Math.max(this.maxDistance,-e))}getLodLevel(e){if(e.lodMetric===D.None)return 0;if(0===e.childCount)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){const t=this._progressiveLoadFactor*this._screenspaceErrorBias,i=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,i)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case D.ScreenSpaceRelative:{const i=this.getRenderMbs(e),s=this._getDistance(this._camPos,i),r=2*s/this._screenSizeFactor,n=s+i[3];return this._updateMinMaxDistance(n),e.maxError*t<=r}case D.MaxScreenThreshold:{let i=this._screenSpaceDiameterMbs(e,e.mbs[3]*t);return this._options.angleDependentLoD&&(i*=this.calcAngleDependentLoD(e)),i<e.maxError}case D.RemovedFeatureDiameter:return this._screenSpaceDiameterMbs(e,e.maxError)*t<10;case D.DistanceRangeFromDefaultCamera:return this.calcCameraDistance(e)>e.maxError*t}return!1}distToPOI(e){const i=this.getRenderMbs(e);return t(b(i),this._poi)-i[3]}distCameraToPOI(){return t(this._camPos,this._poi)}}export{y 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.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import r from"../../../../core/Evented.js";import o from"../../../../core/Logger.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromQuat as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as l,e as c}from"../../../../chunks/vec32.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBoundingSphere as p}from"../../../../geometry/projection/projectBoundingSphere.js";import{empty as u,expand as f}from"../../../../geometry/support/aaBoundingRect.js";import{f as h}from"../../../../chunks/sphere.js";import{ElevationRange as d}from"../../support/ElevationRange.js";import{ElevationUpdateEvent as v}from"../../support/ElevationUpdateEvent.js";import{newIntersector as g}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as E}from"../../webgl-engine/lib/IntersectorInterfaces.js";let x=class extends(r.EventedMixin(t)){constructor(e){super(e),this._tmpEvent=new v}initialize(){this._renderCoordsHelper=this.view.renderCoordsHelper,this._intersector=g(this.view.state.viewingMode),this._intersector.options.store=E.MIN,this._tmpEvent.context=this.intersectionHandler.isGround?"ground":"scene"}get spatialReference(){return this.view?.elevationProvider?.spatialReference}getElevation(e,t,r,i){const n=this._renderCoordsHelper,s=l(y,e,t,r);if(!n.toRenderCoords(s,i,s))return o.getLogger(this).error("could not project point to compute elevation"),null;const{layerElevationSource:a,_intersector:c,intersectionHandler:m}=this,p=a.fullExtent,u=null!=p&&Number.isFinite(p.xmin)&&Number.isFinite(p.xmax)&&Number.isFinite(p.ymin)&&Number.isFinite(p.ymax)&&Number.isFinite(p.zmin)&&Number.isFinite(p.zmax)?{min:p.zmin,max:p.zmax}:a.elevationRange;if(null==u)return null;const f=a.elevationOffset,h=u.min+f,d=u.max+f,v=n.setAltitude(b,d,s),g=n.setAltitude(R,h,s);return c.reset(v,g,null),m.intersect(c,null,v,g,null),c.results.min.getIntersectionPoint(s)?n.getAltitude(s):null}getSphereElevationBounds(e,t){return p(e,t,_,this._renderCoordsHelper.spatialReference),this.layerElevationSource.getElevationRange(_)}getRootElevationBounds(){const e=this.layerElevationSource.fullExtent;return e?.hasZ?new d(e.zmin,e.zmax):null}objectsChanged(e){this.spatialReference&&(this._computeLayerExtent(e,this._tmpEvent.extent),this._tmpEvent.spatialReference=this.spatialReference,this.emit("elevation-change",this._tmpEvent))}objectChanged(e){this.spatialReference&&(this._computeObjectExtent(e,this._tmpEvent.extent),this._tmpEvent.spatialReference=this.spatialReference,this.emit("elevation-change",this._tmpEvent))}_computeObjectExtent(e,t){u(t),this._expandExtent(e,t)}_computeLayerExtent(e,t){u(t);for(const r of e)this._expandExtent(r,t)}_expandExtent(e,t){const r=this.spatialReference;if(null==r)return;if(null==e)return;s(j,e.quaternion),j[12]=e.center[0],j[13]=e.center[1],j[14]=e.center[2];const o=e.halfSize;for(let i=0;i<8;++i)y[0]=1&i?o[0]:-o[0],y[1]=2&i?o[1]:-o[1],y[2]=4&i?o[2]:-o[2],c(y,y,j),this._renderCoordsHelper.fromRenderCoords(y,y,r),f(t,y,t)}};e([i({constructOnly:!0})],x.prototype,"layerElevationSource",void 0),e([i({constructOnly:!0})],x.prototype,"intersectionHandler",void 0),e([i({constructOnly:!0})],x.prototype,"view",void 0),e([i()],x.prototype,"spatialReference",null),x=e([n("esri.views.3d.layers.i3s.LayerElevationProvider")],x);const j=a(),_=h(0,0,0,0),y=m(),b=m(),R=m();export{x as LayerElevationProvider};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import r from"../../../../core/Evented.js";import o from"../../../../core/Logger.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromQuat as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as l,e as c}from"../../../../chunks/vec32.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBoundingSphere as p}from"../../../../geometry/projection/projectBoundingSphere.js";import{empty as u,expand as f}from"../../../../geometry/support/aaBoundingRect.js";import{f as h}from"../../../../chunks/sphere.js";import{ElevationRange as d}from"../../support/ElevationRange.js";import{ElevationUpdateEvent as v}from"../../support/ElevationUpdateEvent.js";import{newIntersector as g}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as E}from"../../webgl-engine/lib/IntersectorInterfaces.js";let x=class extends(r.EventedMixin(t)){constructor(e){super(e),this._tmpEvent=new v}initialize(){this._renderCoordsHelper=this.view.renderCoordsHelper,this._intersector=g(this.view.state.viewingMode),this._intersector.options.store=E.MIN,this._tmpEvent.context=this.intersectionHandler.isGround?"ground":"scene"}get spatialReference(){return this.view?.elevationProvider?.spatialReference}getElevation(e,t,r,i){const n=this._renderCoordsHelper,s=l(y,e,t,r);if(!n.toRenderCoords(s,i,s))return o.getLogger(this).error("could not project point to compute elevation"),null;const{layerElevationSource:a,_intersector:c,intersectionHandler:m}=this,p=a.fullExtent,u=null!=p&&Number.isFinite(p.xmin)&&Number.isFinite(p.xmax)&&Number.isFinite(p.ymin)&&Number.isFinite(p.ymax)&&Number.isFinite(p.zmin)&&Number.isFinite(p.zmax)?{min:p.zmin,max:p.zmax}:a.elevationRange;if(null==u)return null;const f=a.elevationOffset,h=u.min+f,d=u.max+f,v=n.setAltitude(b,d,s),g=n.setAltitude(R,h,s);return c.reset(v,g,null),m.intersect(c,null,v,g,null,!0),c.results.min.getIntersectionPoint(s)?n.getAltitude(s):null}getSphereElevationBounds(e,t){return p(e,t,_,this._renderCoordsHelper.spatialReference),this.layerElevationSource.getElevationRange(_)}getRootElevationBounds(){const e=this.layerElevationSource.fullExtent;return e?.hasZ?new d(e.zmin,e.zmax):null}objectsChanged(e){this.spatialReference&&(this._computeLayerExtent(e,this._tmpEvent.extent),this._tmpEvent.spatialReference=this.spatialReference,this.emit("elevation-change",this._tmpEvent))}objectChanged(e){this.spatialReference&&(this._computeObjectExtent(e,this._tmpEvent.extent),this._tmpEvent.spatialReference=this.spatialReference,this.emit("elevation-change",this._tmpEvent))}_computeObjectExtent(e,t){u(t),this._expandExtent(e,t)}_computeLayerExtent(e,t){u(t);for(const r of e)this._expandExtent(r,t)}_expandExtent(e,t){const r=this.spatialReference;if(null==r)return;if(null==e)return;s(j,e.quaternion),j[12]=e.center[0],j[13]=e.center[1],j[14]=e.center[2];const o=e.halfSize;for(let i=0;i<8;++i)y[0]=1&i?o[0]:-o[0],y[1]=2&i?o[1]:-o[1],y[2]=4&i?o[2]:-o[2],c(y,y,j),this._renderCoordsHelper.fromRenderCoords(y,y,r),f(t,y,t)}};e([i({constructOnly:!0})],x.prototype,"layerElevationSource",void 0),e([i({constructOnly:!0})],x.prototype,"intersectionHandler",void 0),e([i({constructOnly:!0})],x.prototype,"view",void 0),e([i()],x.prototype,"spatialReference",null),x=e([n("esri.views.3d.layers.i3s.LayerElevationProvider")],x);const j=a(),_=h(0,0,0,0),y=m(),b=m(),R=m();export{x as LayerElevationProvider};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{create as e,contains as t,intersects as s}from"../../../../geometry/support/aaBoundingBox.js";class n{constructor(e,t,s){this._pages=[],this.pageSize=0,this._nodeSR=null,this._renderSR=null,this._nodeSR=e,this._renderSR=t,this.pageSize=s}addPage(e,t,s=0){for(;this._pages.length<e;)this._pages.push(null);o(t,this._nodeSR,this._renderSR,s),this._pages[e]={nodes:t,parents:new Uint32Array(this.pageSize)},r(this._pages,this.pageSize)}hasPage(e){return!!this._pages[e]}getNode(e){const t=this.pageSize;return this._pages[p(e,t)].nodes[a(e,t)]}getRenderObb(e){const t=this.pageSize;return this._pages[p(e,t)].nodes[a(e,t)].obbInRenderSR}setRenderObb(e,t){const s=this.pageSize;this._pages[p(e,s)].nodes[a(e,s)].obbInRenderSR.copy(t)}getParentId(e){const t=this.pageSize;return this._pages[p(e,t)].parents[a(e,t)]}hasNodes(e,t){const s=p(e,this.pageSize),n=p(e+t-1,this.pageSize);for(let i=s;i<=n;i++)if(null==this._pages[i])return!1;return!0}forEachNodeId(e){for(let t=0;t<this._pages.length;t++){const s=this._pages[t];if(s)for(let n=0;n<s.nodes.length;n++)e(t*this.pageSize+n)}}createVisibilityTraverse(){const t={index:this,queue:[],masks:[],tempAabb:e()};return(e,s)=>i(t,e,s)}}function i(e,n,i){const o=e.index;if(!o.hasNodes(0,1))return;const r=e.queue;r.length=0,r.push(0);const a=e.masks;for(a.length=0,a.push(0);r.length>0;){const h=r.pop();let g=a.pop();const l=o.getNode(h),u=o.getRenderObb(h);let c=!0;if(null!=n.clippingBox){const i=1<<n.frustum.length;0==(g&i)&&(u.toAaBoundingBox(e.tempAabb),t(n.clippingBox,e.tempAabb)?g|=i:s(n.clippingBox,e.tempAabb)||(c=!1))}for(let e=0;e<n.frustum.length&&c;e++){const t=1<<e;if(0==(g&t)){const s=u.intersectPlane(n.frustum[e]);s>0?c=!1:s<0&&(g|=t)}}if(i.predicate(h,l,c)){const e=l.firstChild,t=l.childCount;let s=!1;const n=p(e,o.pageSize),u=p(e+t-1,o.pageSize);for(let r=n;r<=u;r++)if(!o.hasPage(r)){i.pageMiss(h,r),s=!0;break}if(!s)for(let i=0;i<t;i++)r.push(e+i),a.push(g)}}}function o(e,t,s,n){for(let i=0;i<e.length;i++){const o=e[i];o.obb.transform(o.obbInRenderSR,t,s,n)}}function r(e,t){const s=[0];for(;s.length;){const n=s.pop(),i=e[p(n,t)].nodes[a(n,t)];for(let o=0;o<i.childCount;o++){const r=i.firstChild+o;null!=e[p(r,t)]&&(e[p(r,t)].parents[a(r,t)]=n,s.push(r))}}}function p(e,t){return e/t|0}function a(e,t){return e%t}export{n as PagedNodeIndex};
5
+ import{getSphericalPCPF as e}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{create as t,contains as s,intersects as n}from"../../../../geometry/support/aaBoundingBox.js";class i{constructor(t,s,n){this._pages=[],this.pageSize=0,this._nodeSR=t,this._renderSR=s,this._renderSRSphericalPCPF=e(s),this.pageSize=n}addPage(e,t,s=0){for(;this._pages.length<e;)this._pages.push(null);r(t,this._nodeSR,this._renderSR,s,this._renderSRSphericalPCPF),this._pages[e]={nodes:t,parents:new Uint32Array(this.pageSize)},p(this._pages,this.pageSize)}hasPage(e){return!!this._pages[e]}getNode(e){const t=this.pageSize;return this._pages[a(e,t)].nodes[h(e,t)]}getRenderObb(e){const t=this.pageSize;return this._pages[a(e,t)].nodes[h(e,t)].obbInRenderSR}setRenderObb(e,t){const s=this.pageSize;this._pages[a(e,s)].nodes[h(e,s)].obbInRenderSR.copy(t)}getParentId(e){const t=this.pageSize;return this._pages[a(e,t)].parents[h(e,t)]}hasNodes(e,t){const s=a(e,this.pageSize),n=a(e+t-1,this.pageSize);for(let i=s;i<=n;i++)if(null==this._pages[i])return!1;return!0}forEachNodeId(e){for(let t=0;t<this._pages.length;t++){const s=this._pages[t];if(s)for(let n=0;n<s.nodes.length;n++)e(t*this.pageSize+n)}}createVisibilityTraverse(){const e={index:this,queue:[],masks:[],tempAabb:t()};return(t,s)=>o(e,t,s)}}function o(e,t,i){const o=e.index;if(!o.hasNodes(0,1))return;const r=e.queue;r.length=0,r.push(0);const p=e.masks;for(p.length=0,p.push(0);r.length>0;){const h=r.pop();let g=p.pop();const l=o.getNode(h),c=o.getRenderObb(h);let u=!0;if(null!=t.clippingBox){const i=1<<t.frustum.length;0==(g&i)&&(c.toAaBoundingBox(e.tempAabb),s(t.clippingBox,e.tempAabb)?g|=i:n(t.clippingBox,e.tempAabb)||(u=!1))}for(let e=0;e<t.frustum.length&&u;e++){const s=1<<e;if(0==(g&s)){const n=c.intersectPlane(t.frustum[e]);n>0?u=!1:n<0&&(g|=s)}}if(i.predicate(h,l,u)){const e=l.firstChild,t=l.childCount;let s=!1;const n=a(e,o.pageSize),c=a(e+t-1,o.pageSize);for(let r=n;r<=c;r++)if(!o.hasPage(r)){i.pageMiss(h,r),s=!0;break}if(!s)for(let i=0;i<t;i++)r.push(e+i),p.push(g)}}}function r(e,t,s,n,i){for(let o=0;o<e.length;o++){const r=e[o];r.obb.transform(r.obbInRenderSR,t,s,n,i)}}function p(e,t){const s=[0];for(;s.length;){const n=s.pop(),i=e[a(n,t)].nodes[h(n,t)];for(let o=0;o<i.childCount;o++){const r=i.firstChild+o;null!=e[a(r,t)]&&(e[a(r,t)].parents[h(r,t)]=n,s.push(r))}}}function a(e,t){return e/t|0}function h(e,t){return e%t}export{i as PagedNodeIndex};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as r}from"../../../../chunks/tslib.es6.js";import i from"../../../../core/Logger.js";import{property as e}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{WhereClause as o}from"../../../../core/sql/WhereClause.js";import{findFieldsCaseInsensitive as n}from"../i3s/I3SUtil.js";const t=t=>{let p=class extends t{constructor(){super(...arguments),this._definitionExpressionErrors=0,this._maxDefinitionExpressionErrors=20,this.logError=r=>{this._definitionExpressionErrors<this._maxDefinitionExpressionErrors&&i.getLogger(this).error("Error while evaluating definitionExpression: "+r),this._definitionExpressionErrors++,this._definitionExpressionErrors===this._maxDefinitionExpressionErrors&&i.getLogger(this).error("Further errors are ignored")}}get parsedDefinitionExpression(){if(!this.i3slayer?.definitionExpression)return null;try{const r=o.create(this.i3slayer.definitionExpression,this.i3slayer.fieldsIndex);if(!r.isStandardized)return i.getLogger(this).error("definitionExpression is using non standard function"),null;const e=[],s=r.fieldNames;return n(s,this.i3slayer.fields,{missingFields:e}),e.length>0?(i.getLogger(this).error(`definitionExpression references unknown fields: ${e.join(", ")}`),null):(this._definitionExpressionErrors=0,r)}catch(r){return i.getLogger(this).error("Failed to parse definitionExpression: "+r),null}}get definitionExpressionFields(){return this.parsedDefinitionExpression?this.parsedDefinitionExpression.fieldNames:[]}_evaluateClause(r,i){try{return r.testFeature(i)}catch(e){return this.logError(e),!1}}_addDefinitionExpressionToQuery(r){if(!this.parsedDefinitionExpression)return r;const i=this.i3slayer.definitionExpression,e=r.clone();return e.where?e.where=`(${i}) AND (${e.where})`:e.where=i,e}};return r([e()],p.prototype,"i3slayer",void 0),r([e({readOnly:!0})],p.prototype,"parsedDefinitionExpression",null),r([e({readOnly:!0})],p.prototype,"definitionExpressionFields",null),p=r([s("esri.views.3d.layers.support.DefinitionExpressionSceneLayerView")],p),p};export{t as DefinitionExpressionSceneLayerView};
5
+ import{_ as r}from"../../../../chunks/tslib.es6.js";import i from"../../../../core/Logger.js";import{property as e}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{WhereClause as o}from"../../../../core/sql/WhereClause.js";import{findFieldsCaseInsensitive as n}from"../i3s/I3SUtil.js";const t=t=>{let p=class extends t{constructor(){super(...arguments),this._definitionExpressionErrors=0,this._maxDefinitionExpressionErrors=20,this.logError=r=>{this._definitionExpressionErrors<this._maxDefinitionExpressionErrors&&i.getLogger(this).error("Error while evaluating definitionExpression: "+r),this._definitionExpressionErrors++,this._definitionExpressionErrors===this._maxDefinitionExpressionErrors&&i.getLogger(this).error("Further errors are ignored")}}get parsedDefinitionExpression(){if(!this.i3slayer?.definitionExpression)return null;try{const r=o.create(this.i3slayer.definitionExpression,this.i3slayer.fieldsIndex);if(!r.isStandardized)return i.getLogger(this).error("definitionExpression is using non standard function"),null;const e=[],s=r.fieldNames;return n(s,this.i3slayer.fields,{missingFields:e}),e.length>0?(i.getLogger(this).error(`definitionExpression references unknown fields: ${e.join(", ")}`),null):(this._definitionExpressionErrors=0,r)}catch(r){return i.getLogger(this).error("Failed to parse definitionExpression: "+r),null}}get definitionExpressionFields(){return this.parsedDefinitionExpression?this.parsedDefinitionExpression.fieldNames:[]}_evaluateClause(r,i){try{return r.testFeature(i)}catch(e){return this.logError(e),!1}}_addDefinitionExpressionToQuery(r){if(!this.parsedDefinitionExpression)return r;const i=this.i3slayer.definitionExpression,e=r.clone();return e.where?e.where=`(${i}) AND (${e.where})`:e.where=i,e}};return r([e({readOnly:!0})],p.prototype,"parsedDefinitionExpression",null),r([e({readOnly:!0})],p.prototype,"definitionExpressionFields",null),p=r([s("esri.views.3d.layers.support.DefinitionExpressionSceneLayerView")],p),p};export{t as DefinitionExpressionSceneLayerView};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../chunks/tslib.es6.js";import{property as e}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{getTimeOperator as o}from"../../../../layers/graphics/data/timeSupport.js";import{combinedViewLayerTimeExtentProperty as i}from"../../../../layers/support/commonProperties.js";import s from"../../../../layers/support/FeatureFilter.js";import{filterInPlace as n,getCachedAttributeValue as l}from"../i3s/I3SUtil.js";const u=l=>{let u=class extends l{constructor(){super(...arguments),this.timeExtent=null}get mergedFilter(){const{filter:t,timeExtent:e}=this;if(null==e)return t;const r=t?.clone()??new s;return null!=e&&(r.timeExtent=r.timeExtent?.intersection(e)??e),r}addTimeFilter(t,e){if(null==e)return;const{timeInfo:r}=this.i3slayer;if(null==r)return;const{startField:o,endField:i,useTime:s}=r;if(!s||null==o&&null==i)return;const n=r.toJSON(),l=e.toJSON();t.push(((t,e)=>this._timeFilter(t,e,n,l)))}_timeFilter(t,e,r,i){const s=e.attributeInfo?.attributeData;if(null==s)return;const{startTimeField:l,endTimeField:u}=r;if(!!(null!=l&&null==s[l]||null!=u&&null==s[u]))return;const m=o(r,i,new p(s));if(null==m)return;const{featureIds:a}=e;n(t,a,m)}};return t([e()],u.prototype,"i3slayer",void 0),t([e()],u.prototype,"filter",void 0),t([e(i)],u.prototype,"timeExtent",void 0),t([e()],u.prototype,"mergedFilter",null),u=t([r("esri.views.3d.layers.support.TemporalSceneLayerView")],u),u};class p{constructor(t){this.attributeData=t}getAttribute(t,e){return l(this.attributeData[e],t)}getAttributeAsTimestamp(t,e){const r=this.getAttribute(t,e);return"string"==typeof r?new Date(r).getTime():"number"==typeof r||null==r?r:null}}export{u as TemporalSceneLayerView};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import{property as e}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{getTimeOperator as s}from"../../../../layers/graphics/data/timeSupport.js";import{combinedViewLayerTimeExtentProperty as i}from"../../../../layers/support/commonProperties.js";import o from"../../../../layers/support/FeatureFilter.js";import{filterInPlace as n,getCachedAttributeValue as l}from"../i3s/I3SUtil.js";const u=l=>{let u=class extends l{constructor(){super(...arguments),this.timeExtent=null}get mergedFilter(){const{filter:t,timeExtent:e}=this;if(null==e)return t;const r=t?.clone()??new o;return null!=e&&(r.timeExtent=r.timeExtent?.intersection(e)??e),r}addTimeFilter(t,e){if(null==e)return;const{timeInfo:r}=this.i3slayer;if(null==r)return;const{startField:s,endField:i,useTime:o}=r;if(!o||null==s&&null==i)return;const n=r.toJSON(),l=e.toJSON();t.push(((t,e)=>this._timeFilter(t,e,n,l)))}_timeFilter(t,e,r,i){const o=e.attributeInfo?.attributeData;if(null==o)return;const{startTimeField:l,endTimeField:u}=r;if(!!(null!=l&&null==o[l]||null!=u&&null==o[u]))return;const a=s(r,i,new m(o));if(null==a)return;const{featureIds:p}=e;n(t,p,a)}};return t([e(i)],u.prototype,"timeExtent",void 0),t([e()],u.prototype,"mergedFilter",null),u=t([r("esri.views.3d.layers.support.TemporalSceneLayerView")],u),u};class m{constructor(t){this.attributeData=t}getAttribute(t,e){return l(this.attributeData[e],t)}getAttributeAsTimestamp(t,e){const r=this.getAttribute(t,e);return"string"==typeof r?new Date(r).getTime():"number"==typeof r||null==r?r:null}}export{u as TemporalSceneLayerView};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Graphic.js";import{Tiles3DTarget as i}from"../i3s/Intersector.js";import{newIntersectorResult as t}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as r,StoreResults as s}from"../../webgl-engine/lib/IntersectorInterfaces.js";class n{constructor(e){this.layerUid=[],this.type=r.TILES3D,this.slicePlaneEnabled=!1,this.isGround=!0,this.layerView=e,this.layerUid.push(e.layer.uid)}intersect(e,r,n,l){const o=e.results,a=e.options.store===s.ALL;if(e.options.filteredLayerUids.includes(this.layerView.layer.uid))return;const c=this.layerView.view._stage.renderView.componentObjectCollection;this.layerView.objects.forEach((s=>{s.visible&&c.intersect(s,n,l,e.tolerance,null,((s,c,u,d)=>{if(c>=0){if(null!=r&&!r(n,l,c))return;const s=e=>{const t=new i(this.layerView.layer.uid,(()=>this._createTiles3DGraphic(this.layerView.layer,{})));e.set(this.type,t,c,u)};if(this.isGround&&(null==o.ground.dist||c<o.ground.dist)&&s(o.ground),e.options.isFiltered)return;if((null==o.min.dist||c<o.min.dist)&&s(o.min),(null==o.max.dist||c>o.max.dist)&&s(o.max),a){const i=t(e.ray);s(i),e.results.all.push(i)}}}))}))}_createTiles3DGraphic(i,t){return new e({layer:i,sourceLayer:i,attributes:t})}}export{n as Tiles3DIntersectionHandler};
5
+ import e from"../../../../Graphic.js";import{Tiles3DTarget as i}from"../i3s/Intersector.js";import{newIntersectorResult as t}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as r,StoreResults as s}from"../../webgl-engine/lib/IntersectorInterfaces.js";class n{constructor(e){this.layerUid=[],this.type=r.TILES3D,this.slicePlaneEnabled=!1,this.isGround=!0,this.layerView=e,this.layerUid.push(e.layer.uid)}intersect(e,r,n,l){const o=e.results,a=e.options.store===s.ALL;if(e.options.filteredLayerUids.includes(this.layerView.layer.uid))return;const c=this.layerView.view._stage.renderView.componentObjectCollection;this.layerView.objects.forEach((s=>{s.visible&&s.intersectionGeometry&&c.intersect(s,n,l,e.tolerance,null,((s,c,u,d)=>{if(c>=0){if(null!=r&&!r(n,l,c))return;const s=e=>{const t=new i(this.layerView.layer.uid,(()=>this._createTiles3DGraphic(this.layerView.layer,{})));e.set(this.type,t,c,u)};if(this.isGround&&(null==o.ground.dist||c<o.ground.dist)&&s(o.ground),e.options.isFiltered)return;if((null==o.min.dist||c<o.min.dist)&&s(o.min),(null==o.max.dist||c>o.max.dist)&&s(o.max),a){const i=t(e.ray);s(i),e.results.all.push(i)}}}))}))}_createTiles3DGraphic(i,t){return new e({layer:i,sourceLayer:i,attributes:t})}}export{n as Tiles3DIntersectionHandler};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/PooledArray.js";import{castRenderScreenPointArray3 as t,createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{g as n,n as i}from"../../../../chunks/vec32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as o,copy as l,negativeInfinity as c,width as a,height as u,expandPointInPlace as h}from"../../../../geometry/support/aaBoundingRect.js";import{create as d}from"../../../../geometry/support/ray.js";import{sv3d as p}from"../../../../geometry/support/vectorStacks.js";import{ViewingMode as m}from"../../../ViewingMode.js";import{computeMapPointFromVec3d as y}from"../../support/hitTest.js";import{fromRenderAtEye as g,fromScreen as f}from"../../support/geometryUtils/ray.js";import{defaultTolerance as _,newIntersector as R}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as v,IntersectorType as I}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as b,sliceFilterPredicate as w}from"../../webgl-engine/lib/intersectorUtils.js";class P{constructor(t,r,n){this.viewingMode=t,this._forEachLayer=r,this._view=n,this._externalIntersectionHandlers=new e,this._tolerance=_,this._tmpRay=d(),this._tmpRegion=o(),this._validateHUDIntersector=R(this.viewingMode),this._validateHUDIntersector.options.hud=!1}intersectScreen(e,t,r){return this.intersectRay(this._getPickRay(e,this._tmpRay),E(this.viewingMode),t,r)}intersectScreenFreePointFallback(e,t,r){return this.intersectRayFreePointFallback(this._getPickRay(e,this._tmpRay),t,r)}intersectRayFreePointFallback(e,t,r){return this.intersectRay(e,E(this.viewingMode),t,r)||this._intersectRayFreePointLocal(e,t)}intersectRay(e,t,r,n){return t.options.selectionMode=!1,t.options.store=v.MIN,this.computeIntersection(e,t,n),!!t.results.min&&t.results.min.getIntersectionPoint(r)}getCenterRayWithSubpixelOffset(e,t,r=.5,n=.5){return e.getRenderCenter(A,r,n),A[0]+=.0466,A[1]-=.0123,g(e,A,t)}intersectIntersectorScreen(e,t,r){this.computeIntersection(this._getPickRay(e,this._tmpRay),t,r)}intersectToolIntersectorScreen(e,t,r){const n=this._getPickRay(e,this._tmpRay);this.intersectToolIntersectorRay(n,t,r)}intersectToolIntersectorRay(e,t,r){t.options.selectionMode=!0,this.computeIntersection(e,t,r);const n=t.results.min;!!this._view.basemapTerrain&&this._view.basemapTerrain.opaque||b(n)&&n.intersector!==I.TERRAIN||(t.options.selectionMode=!1,this.computeIntersection(e,t,r))}setTolerance(e=_){this._tolerance=e}addIntersectionHandler(e){this._externalIntersectionHandlers.push(e),this._externalIntersectionHandlers.sort(((e,t)=>e.type===I.TERRAIN?1:t.type===I.TERRAIN?-1:0))}removeIntersectionHandler(e){null!=this._externalIntersectionHandlers.removeUnordered(e)&&this._externalIntersectionHandlers.sort(((e,t)=>e.type===I.TERRAIN?1:t.type===I.TERRAIN?-1:0))}_getPickRay(e,t){const r=this._view.state.camera;return f(r,e,t)}_intersectRayFreePointLocal(e,t){return this.viewingMode!==m.Local||null==e||n(t,e.origin,i(p.get(),e.direction)),!1}intersectElevationFromScreen(e,t,r=0,n=null){return this._intersectElevation(this._getPickRay(e,this._tmpRay),t,r,n)}_intersectElevation(e,r,i=0,s=null){if(null==e)return null;const o=null!=r?r.mode:"absolute-height",l=r?.offset??0,c="on-the-ground"!==o?l+i:0,a=c/this._view.renderCoordsHelper.unitInMeters;if("absolute-height"===o){if(this._view.renderCoordsHelper.intersectInfiniteManifold(e,c,T)){const e=y(this._view,T);return e.z??=0,e.z-=l,e}return null}const u=this._view.state.camera,h=t(p.get());u.projectToRenderScreen(e.origin,h);const d=new H(null,this._forEachLayer),m=this._view.slicePlane,g=null!=m?w(m):null,f=R(this.viewingMode);f.options.store=v.MIN,f.options.verticalOffset=a;const _=e.origin,b=n(p.get(),_,e.direction);f.reset(_,b,u),f.point=h;const P=s?"type"in s&&"graphics"===s.type?e=>e.layerUid!==s.uid:e=>e.graphicUid!==s.uid:null;switch(o){case"relative-to-scene":{const e=e=>(!P||P(e))&&!!e.lastValidElevationBB;f.intersect(d.layers,h,this._tolerance,null,e),this._externalIntersectionHandlers.forAll((e=>{if(e.type===I.I3S||e.type===I.TERRAIN||e.type===I.TILES3D){const t=e.slicePlaneEnabled?g:null;e.intersect(f,t,f.rayBegin,f.rayEnd,h)}}));break}case"on-the-ground":case"relative-to-ground":this._externalIntersectionHandlers.forAll((e=>{if(e.isGround){const t=e.slicePlaneEnabled?g:null;e.intersect(f,t,f.rayBegin,f.rayEnd,h)}}))}if(f.results.min.getIntersectionPoint(T)){const e=y(this._view,T);return e.z=i,e}return null}computeIntersection(e,r,i){if(null==e)return;const s=this._view.state.camera,o=t(p.get());s.projectToRenderScreen(e.origin,o);const l=new H(i,this._forEachLayer);r.options.selectOpaqueTerrainOnly=!i||!("include"in i||"exclude"in i);const c=e.origin,a=n(p.get(),e.origin,e.direction);r.reset(c,a,s),r.intersect(l.layers,o,this._tolerance);const u=this._view.slicePlane,h=null!=u?w(u):null;r.intersect(l.sliceableLayers,o,this._tolerance,h);const d=i&&(i.requiresGroundFeedback||i.enableDraped);this._externalIntersectionHandlers.forAll((e=>{const t=e.layerUid,n=Array.isArray(t),i=n?t:[t];n&&(r.options.filteredLayerUids=[]);let s=!1;for(const o of i){!l.filterLayerUid(o)?n&&r.options.filteredLayerUids.push(o):s=!0}if(r.options.isFiltered=!s,e.isGround&&d||!r.options.isFiltered){const t=e.slicePlaneEnabled?h:null;e.intersect(r,t,c,a,o)}}));const m=p.get(),y=this._view.basemapTerrain;if(i&&i.enableDraped&&null!=y.spatialReference&&r.results.ground.getIntersectionPoint(m)){const e=y.overlayManager.renderer,t=this._view.renderCoordsHelper.spatialReference,n=p.get();this._view.renderCoordsHelper.fromRenderCoords(m,n,y.spatialReference),n[2]=this._view.elevationProvider?.getElevation(m[0],m[1],m[2],t,"ground")??0,e.intersect(r,n,r.results.ground,(e=>l.filterRenderGeometry(e)))}r.sortResults(),this._processHUDResults(r)}_processHUDResults(e){const t=e.results.hud;l(this._tmpRegion,c);const r=this._view.state.camera,n=[],i=this._tmpRegion,s=e=>{const t=new x(e);r.projectToRenderScreen(e.target.center,t.screenPoint),t.screenPoint[0]=Math.floor(t.screenPoint[0]),t.screenPoint[1]=Math.floor(t.screenPoint[1]),n.push(t),h(i,t.screenPoint)};e.sortResults(t.all),null!=t.min.dist&&s(t.min);for(const l of t.all)t.min.target.object!==l.target.object&&t.max.target.object!==l.target.object&&s(l);if(null!=t.max.dist&&t.max.target.object!==t.min.target.object&&s(t.max),!n.length)return;i[0]===i[2]&&(i[2]+=1),i[1]===i[3]&&(i[3]+=1);const o=r.fullWidth,d=r.fullHeight,p=Math.max(0,i[0]-M),m=Math.max(0,i[1]-M),y=Math.min(a(i)+2*M,o-p),g=Math.min(u(i)+2*M,d-m);if(y<=0||g<=0)return;const f=new Uint8Array(y*g*4);this._view._stage.renderer.readHUDVisibility(p,m,y,g,f);let _=!0;const R=null==e.results.max.dist;let I=0;for(const l of n)for(const t of j){const r=4*(Math.min(l.screenPoint[0]+t[0],o)-i[0]+(Math.min(l.screenPoint[1]+t[1],d)-i[1])*y);if(!(r<0||r>=f.length)&&f[r]){_&&(e.results.min.copy(l.result),_=!1),R&&e.results.max.copy(l.result),e.options.store===v.ALL&&e.results.all.splice(I++,0,l.result);break}}}}const M=1,j=(()=>{const e=[],t=M;for(let r=-t;r<=t;r++)for(let n=-t;n<=t;n++)e.push([n+t,r+t]);return e})();class x{constructor(e){this.result=e,this.screenPoint=r()}}let U;function E(e){return U&&U.viewingMode===e||(U=R(e)),U}class H{constructor(e,t){this.layers=new Array,this.sliceableLayers=new Array,this.include=e?.include,this.exclude=e?.exclude,t((e=>{e.pickable&&this.filterLayerUid(e.apiLayerUid)&&(e.sliceable?this.sliceableLayers:this.layers).push(e)}))}filterLayerUid(e){const{include:t,exclude:r}=this;return null==e?null==t&&null==r:(null==t||t.has(e))&&(null==r||!r.has(e))}filterRenderGeometry(e){return this.filterLayerUid(e.layerUid)}}function L(e){return"object"==typeof e&&"intersect"in e}const T=s(),A=r();export{P as SceneIntersectionHelper,L as isIntersectionHandler};
5
+ import e from"../../../../core/PooledArray.js";import{castRenderScreenPointArray3 as t,createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{g as n,n as i}from"../../../../chunks/vec32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as o,copy as l,negativeInfinity as c,width as a,height as u,expandPointInPlace as h}from"../../../../geometry/support/aaBoundingRect.js";import{create as d}from"../../../../geometry/support/ray.js";import{sv3d as p}from"../../../../geometry/support/vectorStacks.js";import{ViewingMode as m}from"../../../ViewingMode.js";import{computeMapPointFromVec3d as y}from"../../support/hitTest.js";import{fromRenderAtEye as g,fromScreen as f}from"../../support/geometryUtils/ray.js";import{defaultTolerance as _,newIntersector as R}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as v,IntersectorType as I}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as b,sliceFilterPredicate as w}from"../../webgl-engine/lib/intersectorUtils.js";class P{constructor(t,r,n){this.viewingMode=t,this._forEachLayer=r,this._view=n,this._externalIntersectionHandlers=new e,this._tolerance=_,this._tmpRay=d(),this._tmpRegion=o(),this._validateHUDIntersector=R(this.viewingMode),this._validateHUDIntersector.options.hud=!1}intersectScreen(e,t,r){return this.intersectRay(this._getPickRay(e,this._tmpRay),E(this.viewingMode),t,r)}intersectScreenFreePointFallback(e,t,r){return this.intersectRayFreePointFallback(this._getPickRay(e,this._tmpRay),t,r)}intersectRayFreePointFallback(e,t,r){return this.intersectRay(e,E(this.viewingMode),t,r)||this._intersectRayFreePointLocal(e,t)}intersectRay(e,t,r,n){return t.options.selectionMode=!1,t.options.store=v.MIN,this.computeIntersection(e,t,n),!!t.results.min&&t.results.min.getIntersectionPoint(r)}getCenterRayWithSubpixelOffset(e,t,r=.5,n=.5){return e.getRenderCenter(A,r,n),A[0]+=.0466,A[1]-=.0123,g(e,A,t)}intersectIntersectorScreen(e,t,r){this.computeIntersection(this._getPickRay(e,this._tmpRay),t,r)}intersectToolIntersectorScreen(e,t,r){const n=this._getPickRay(e,this._tmpRay);this.intersectToolIntersectorRay(n,t,r)}intersectToolIntersectorRay(e,t,r){t.options.selectionMode=!0,this.computeIntersection(e,t,r);const n=t.results.min;!!this._view.basemapTerrain&&this._view.basemapTerrain.opaque||b(n)&&n.intersector!==I.TERRAIN||(t.options.selectionMode=!1,this.computeIntersection(e,t,r))}setTolerance(e=_){this._tolerance=e}addIntersectionHandler(e){this._externalIntersectionHandlers.push(e),this._externalIntersectionHandlers.sort(((e,t)=>e.type===I.TERRAIN?1:t.type===I.TERRAIN?-1:0))}removeIntersectionHandler(e){null!=this._externalIntersectionHandlers.removeUnordered(e)&&this._externalIntersectionHandlers.sort(((e,t)=>e.type===I.TERRAIN?1:t.type===I.TERRAIN?-1:0))}_getPickRay(e,t){const r=this._view.state.camera;return f(r,e,t)}_intersectRayFreePointLocal(e,t){return this.viewingMode!==m.Local||null==e||n(t,e.origin,i(p.get(),e.direction)),!1}intersectElevationFromScreen(e,t,r=0,n=null){return this._intersectElevation(this._getPickRay(e,this._tmpRay),t,r,n)}_intersectElevation(e,r,i=0,s=null){if(null==e)return null;const o=null!=r?r.mode:"absolute-height",l=r?.offset??0,c="on-the-ground"!==o?l+i:0,a=c/this._view.renderCoordsHelper.unitInMeters;if("absolute-height"===o){if(this._view.renderCoordsHelper.intersectInfiniteManifold(e,c,T)){const e=y(this._view,T);return e.z??=0,e.z-=l,e}return null}const u=this._view.state.camera,h=t(p.get());u.projectToRenderScreen(e.origin,h);const d=new H(null,this._forEachLayer),m=this._view.slicePlane,g=null!=m?w(m):null,f=R(this.viewingMode);f.options.store=v.MIN,f.options.verticalOffset=a;const _=e.origin,b=n(p.get(),_,e.direction);f.reset(_,b,u),f.point=h;const P=s?"type"in s&&"graphics"===s.type?e=>e.layerUid!==s.uid:e=>e.graphicUid!==s.uid:null;switch(o){case"relative-to-scene":{const e=e=>(!P||P(e))&&!!e.lastValidElevationBB;f.intersect(d.layers,h,this._tolerance,null,e),this._externalIntersectionHandlers.forAll((e=>{if(e.type===I.I3S||e.type===I.TERRAIN||e.type===I.TILES3D){const t=e.slicePlaneEnabled?g:null;e.intersect(f,t,f.rayBegin,f.rayEnd,h)}}));break}case"on-the-ground":case"relative-to-ground":this._externalIntersectionHandlers.forAll((e=>{if(e.isGround){const t=e.slicePlaneEnabled?g:null;e.intersect(f,t,f.rayBegin,f.rayEnd,h)}}))}if(f.results.min.getIntersectionPoint(T)){const e=y(this._view,T);return e.z=i,e}return null}computeIntersection(e,r,i,s){if(null==e)return;const o=this._view.state.camera,l=t(p.get());o.projectToRenderScreen(e.origin,l);const c=new H(i,this._forEachLayer);r.options.selectOpaqueTerrainOnly=!i||!("include"in i||"exclude"in i);const a=e.origin,u=n(p.get(),e.origin,e.direction);r.reset(a,u,o),r.intersect(c.layers,l,this._tolerance);const h=this._view.slicePlane,d=null!=h?w(h):null;r.intersect(c.sliceableLayers,l,this._tolerance,d);const m=i&&(i.requiresGroundFeedback||i.enableDraped);this._externalIntersectionHandlers.forAll((e=>{const t=e.layerUid,n=Array.isArray(t),i=n?t:[t];n&&(r.options.filteredLayerUids=[]);let o=!1;for(const s of i){!c.filterLayerUid(s)?n&&r.options.filteredLayerUids.push(s):o=!0}if(r.options.isFiltered=!o,e.isGround&&m||!r.options.isFiltered){const t=e.slicePlaneEnabled?d:null;e.intersect(r,t,a,u,l,s)}}));const y=p.get(),g=this._view.basemapTerrain;if(i&&i.enableDraped&&null!=g.spatialReference&&r.results.ground.getIntersectionPoint(y)){const e=g.overlayManager.renderer,t=this._view.renderCoordsHelper.spatialReference,n=p.get();this._view.renderCoordsHelper.fromRenderCoords(y,n,g.spatialReference),n[2]=this._view.elevationProvider?.getElevation(y[0],y[1],y[2],t,"ground")??0,e.intersect(r,n,r.results.ground,(e=>c.filterRenderGeometry(e)))}r.sortResults(),this._processHUDResults(r)}_processHUDResults(e){const t=e.results.hud;l(this._tmpRegion,c);const r=this._view.state.camera,n=[],i=this._tmpRegion,s=e=>{const t=new x(e);r.projectToRenderScreen(e.target.center,t.screenPoint),t.screenPoint[0]=Math.floor(t.screenPoint[0]),t.screenPoint[1]=Math.floor(t.screenPoint[1]),n.push(t),h(i,t.screenPoint)};e.sortResults(t.all),null!=t.min.dist&&s(t.min);for(const l of t.all)t.min.target.object!==l.target.object&&t.max.target.object!==l.target.object&&s(l);if(null!=t.max.dist&&t.max.target.object!==t.min.target.object&&s(t.max),!n.length)return;i[0]===i[2]&&(i[2]+=1),i[1]===i[3]&&(i[3]+=1);const o=r.fullWidth,d=r.fullHeight,p=Math.max(0,i[0]-M),m=Math.max(0,i[1]-M),y=Math.min(a(i)+2*M,o-p),g=Math.min(u(i)+2*M,d-m);if(y<=0||g<=0)return;const f=new Uint8Array(y*g*4);this._view._stage.renderer.readHUDVisibility(p,m,y,g,f);let _=!0;const R=null==e.results.max.dist;let I=0;for(const l of n)for(const t of j){const r=4*(Math.min(l.screenPoint[0]+t[0],o)-i[0]+(Math.min(l.screenPoint[1]+t[1],d)-i[1])*y);if(!(r<0||r>=f.length)&&f[r]){_&&(e.results.min.copy(l.result),_=!1),R&&e.results.max.copy(l.result),e.options.store===v.ALL&&e.results.all.splice(I++,0,l.result);break}}}}const M=1,j=(()=>{const e=[],t=M;for(let r=-t;r<=t;r++)for(let n=-t;n<=t;n++)e.push([n+t,r+t]);return e})();class x{constructor(e){this.result=e,this.screenPoint=r()}}let U;function E(e){return U&&U.viewingMode===e||(U=R(e)),U}class H{constructor(e,t){this.layers=new Array,this.sliceableLayers=new Array,this.include=e?.include,this.exclude=e?.exclude,t((e=>{e.pickable&&this.filterLayerUid(e.apiLayerUid)&&(e.sliceable?this.sliceableLayers:this.layers).push(e)}))}filterLayerUid(e){const{include:t,exclude:r}=this;return null==e?null==t&&null==r:(null==t||t.has(e))&&(null==r||!r.has(e))}filterRenderGeometry(e){return this.filterLayerUid(e.layerUid)}}function L(e){return"object"==typeof e&&"intersect"in e}const T=s(),A=r();export{P as SceneIntersectionHelper,L as isIntersectionHandler};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{rad2deg as t}from"../../../core/mathUtils.js";import{getMetersPerUnitForSR as e,getMetersPerCartesianUnitForSR as o}from"../../../core/unitUtils.js";import{set as r}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{c as i}from"../../../chunks/vec32.js";import{projectPointToVector as s}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToPoint as n}from"../../../geometry/projection/projectVectorToPoint.js";import{projectVectorToVector as a}from"../../../geometry/projection/projectVectorToVector.js";import{Axis as m}from"../../../geometry/support/Axis.js";import{create as c,setExtent as l,altitudeAt as p,setAltitudeAt as d,setAltitudeOfTransformation as h,normalAt as u,axisAt as y,elevate as f,intersectRayClosestSilhouette as g,intersectRay as S,createGlobal as j,createLocal as _}from"../../../geometry/support/coordinateSystem.js";import{intersectRay as w}from"../../../geometry/support/plane.js";import{angleAroundAxis as A}from"../../../geometry/support/vector.js";import{sv3d as P}from"../../../geometry/support/vectorStacks.js";import{isDehydratedPoint as C}from"../../../layers/graphics/dehydratedFeatureUtils.js";import{ViewingMode as M}from"../../ViewingMode.js";class R{constructor(t,e,o,r){this.viewingMode=t,this.spatialReference=e,this.unitInMeters=o,this._coordinateSystem=r,this._tmpCoordinateSystem=c(r)}set extent(t){t&&l(this._coordinateSystem,t,this._coordinateSystem)}getAltitude(t){return p(this._coordinateSystem,t)}setAltitude(t,e,o=t){return d(this._coordinateSystem,o,e,t)}setAltitudeOfTransformation(t,e){h(this._coordinateSystem,e,t,e)}worldUpAtPosition(t,e){return u(this._coordinateSystem,t,e)}worldBasisAtPosition(t,e,o){return y(this._coordinateSystem,t,e,o)}basisMatrixAtPosition(t,e){const o=this.worldBasisAtPosition(t,m.X,P.get()),i=this.worldBasisAtPosition(t,m.Y,P.get()),s=this.worldBasisAtPosition(t,m.Z,P.get());return r(e,o[0],o[1],o[2],0,i[0],i[1],i[2],0,s[0],s[1],s[2],0,0,0,0,1),e}headingAtPosition(e,o){const r=this.worldUpAtPosition(e,P.get()),i=this.worldBasisAtPosition(e,m.Y,P.get()),s=A(o,i,r);return t(s)}intersectManifoldClosestSilhouette(t,e,o){return f(this._coordinateSystem,e,this._tmpCoordinateSystem),g(this._tmpCoordinateSystem,t,o),o}intersectManifold(t,e,o){f(this._coordinateSystem,e,this._tmpCoordinateSystem);const r=P.get();return S(this._tmpCoordinateSystem,t,r)?i(o,r):null}intersectInfiniteManifold(t,e,o){if(this.viewingMode===M.Global)return this.intersectManifold(t,e,o);f(this._coordinateSystem,e,this._tmpCoordinateSystem);const r=this._tmpCoordinateSystem.value,s=P.get();return w(r.plane,t,s)?i(o,s):null}toRenderCoords(t,e,o){return C(t)?s(t,e,this.spatialReference):a(t,e,o,this.spatialReference)}fromRenderCoords(t,e,o=null){return C(e)?(null!=o&&(e.spatialReference=o),n(t,this.spatialReference,e)?e:null):a(t,this.spatialReference,e,o)?e:null}static create(t,o){switch(t){case M.Local:return new R(M.Local,o,e(o),_());case M.Global:return new R(M.Global,o,1,j(o))}}static renderUnitScaleFactor(t,e){return o(t)/o(e)}}export{R as RenderCoordsHelper};
5
+ import{rad2deg as t}from"../../../core/mathUtils.js";import{getMetersPerUnitForSR as e,getMetersPerCartesianUnitForSR as o}from"../../../core/unitUtils.js";import{set as r}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{c as i}from"../../../chunks/vec32.js";import{getReferenceEllipsoid as s}from"../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as n}from"../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectPointToVector as a}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToPoint as m}from"../../../geometry/projection/projectVectorToPoint.js";import{projectVectorToVector as c}from"../../../geometry/projection/projectVectorToVector.js";import{Axis as l}from"../../../geometry/support/Axis.js";import{create as p,setExtent as d,altitudeAt as h,setAltitudeAt as u,setAltitudeOfTransformation as f,normalAt as y,axisAt as g,elevate as j,intersectRayClosestSilhouette as S,intersectRay as _,createGlobal as w,createLocal as A}from"../../../geometry/support/coordinateSystem.js";import{intersectRay as P}from"../../../geometry/support/plane.js";import{angleAroundAxis as C}from"../../../geometry/support/vector.js";import{sv3d as R}from"../../../geometry/support/vectorStacks.js";import{isDehydratedPoint as M}from"../../../layers/graphics/dehydratedFeatureUtils.js";import{ViewingMode as U}from"../../ViewingMode.js";class v{constructor(t,e,o,r){this.viewingMode=t,this.spatialReference=e,this.unitInMeters=o,this._coordinateSystem=r,this._tmpCoordinateSystem=p(r),this.referenceEllipsoid=s(e),this.sphericalPCPF=n(e)}set extent(t){t&&d(this._coordinateSystem,t,this._coordinateSystem)}getAltitude(t){return h(this._coordinateSystem,t)}setAltitude(t,e,o=t){return u(this._coordinateSystem,o,e,t)}setAltitudeOfTransformation(t,e){f(this._coordinateSystem,e,t,e)}worldUpAtPosition(t,e){return y(this._coordinateSystem,t,e)}worldBasisAtPosition(t,e,o){return g(this._coordinateSystem,t,e,o)}basisMatrixAtPosition(t,e){const o=this.worldBasisAtPosition(t,l.X,R.get()),i=this.worldBasisAtPosition(t,l.Y,R.get()),s=this.worldBasisAtPosition(t,l.Z,R.get());return r(e,o[0],o[1],o[2],0,i[0],i[1],i[2],0,s[0],s[1],s[2],0,0,0,0,1),e}headingAtPosition(e,o){const r=this.worldUpAtPosition(e,R.get()),i=this.worldBasisAtPosition(e,l.Y,R.get()),s=C(o,i,r);return t(s)}intersectManifoldClosestSilhouette(t,e,o){return j(this._coordinateSystem,e,this._tmpCoordinateSystem),S(this._tmpCoordinateSystem,t,o),o}intersectManifold(t,e,o){j(this._coordinateSystem,e,this._tmpCoordinateSystem);const r=R.get();return _(this._tmpCoordinateSystem,t,r)?i(o,r):null}intersectInfiniteManifold(t,e,o){if(this.viewingMode===U.Global)return this.intersectManifold(t,e,o);j(this._coordinateSystem,e,this._tmpCoordinateSystem);const r=this._tmpCoordinateSystem.value,s=R.get();return P(r.plane,t,s)?i(o,s):null}toRenderCoords(t,e,o){return M(t)?a(t,e,this.spatialReference):c(t,e,o,this.spatialReference)}fromRenderCoords(t,e,o=null){return M(e)?(null!=o&&(e.spatialReference=o),m(t,this.spatialReference,e)?e:null):c(t,this.spatialReference,e,o)?e:null}static create(t,o){switch(t){case U.Local:return new v(U.Local,o,e(o),A());case U.Global:return new v(U.Global,o,1,w(o))}}static renderUnitScaleFactor(t,e){return o(t)/o(e)}}export{v as RenderCoordsHelper};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{fromQuat as t,scale as e}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as s}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as i,conjugate as r,multiply as n}from"../../../core/libs/gl-matrix-2/math/quat.js";import{IDENTITY as o,create as h}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{s as c,r as l,g as f,u as m,v as u,w as d,f as _,x as p,t as b,l as g,i as M,p as S,y as j,z as q,c as z,A as x}from"../../../chunks/vec32.js";import{ZEROS as y,create as w,UNIT_Z as P,fromValues as R}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{t as v}from"../../../chunks/vec42.js";import{create as A}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as k}from"../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as B}from"../../../geometry/spatialReferenceEllipsoidUtils.js";import{computeTranslationToOriginAndRotation as D}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as G}from"../../../geometry/projection/projectBuffer.js";import{signedDistance as U,getNormal as W}from"../../../geometry/support/plane.js";import{isPlateCarree as C}from"../../../geometry/support/spatialReferenceUtils.js";import{sv3d as O,sq4d as T}from"../../../geometry/support/vectorStacks.js";import{ViewingMode as V}from"../../ViewingMode.js";import{computeOBB as E}from"./dito.js";import{Vertices as F}from"../webgl-engine/lib/Attribute.js";class I{constructor(t=y,e=ut,a=o){this._data=[t[0],t[1],t[2],e[0],e[1],e[2],a[0],a[1],a[2],a[3]]}clone(){const t=new I;return t._data=this._data.slice(),t}static fromData(t){const e=new I;return e._data=t.slice(),e}static fromJSON(t){return new I(t.center,t.halfSize,t.quaternion)}copy(t){this._data=t.data.slice()}get center(){return c(O.get(),this._data[0],this._data[1],this._data[2])}set center(t){this._data[0]=t[0],this._data[1]=t[1],this._data[2]=t[2]}get halfSize(){return c(O.get(),this._data[3],this._data[4],this._data[5])}set halfSize(t){this._data[3]=t[0],this._data[4]=t[1],this._data[5]=t[2]}get quaternion(){return i(T.get(),this._data[6],this._data[7],this._data[8],this._data[9])}set quaternion(t){this._data[6]=t[0],this._data[7]=t[1],this._data[8]=t[2],this._data[9]=t[3]}get data(){return this._data}getCorners(t){const{quaternion:e,center:a}=this;for(let s=0;s<8;++s){const i=t[s];i[0]=1&s?-this._data[3]:this._data[3],i[1]=2&s?-this._data[4]:this._data[4],i[2]=4&s?-this._data[5]:this._data[5],l(i,i,e),f(i,i,a)}}isVisible(t){return this.intersectPlane(t[0])<=0&&this.intersectPlane(t[1])<=0&&this.intersectPlane(t[2])<=0&&this.intersectPlane(t[3])<=0&&this.intersectPlane(t[4])<=0&&this.intersectPlane(t[5])<=0}get radius(){const t=this._data[3],e=this._data[4],a=this._data[5];return Math.sqrt(t*t+e*e+a*a)}intersectSphere(t){return N[0]=this.center[0]-t[0],N[1]=this.center[1]-t[1],N[2]=this.center[2]-t[2],r(J,this.quaternion),l(N,N,J),m(N,N),u(H,N,this.halfSize),d(H,N)<t[3]*t[3]}intersectPlane(t){const e=U(t,this.center),a=this.projectedRadius(W(t));return e>a?1:e<-a?-1:0}intersectRay(t,e,a=0){r(J,this.quaternion),_(N,t,this.center);const s=l(N,N,J),i=l(H,e,J);let n=-1/0,o=1/0;const h=this.halfSize;for(let r=0;r<3;r++)if(Math.abs(i[r])>1e-6){const t=(a+h[r]-s[r])/i[r],e=(-a-h[r]-s[r])/i[r];n=Math.max(n,Math.min(t,e)),o=Math.min(o,Math.max(t,e))}else if(s[r]>h[r]+a||s[r]<-h[r]-a)return!1;return n<=o}projectedArea(a,s,i,n){const o=this.quaternion;r(J,o),p(N,a,this.center),l(N,N,J);const h=this.halfSize,m=N[0]<-h[0]?-1:N[0]>h[0]?1:0,u=N[1]<-h[1]?-1:N[1]>h[1]?1:0,d=N[2]<-h[2]?-1:N[2]>h[2]?1:0,_=Math.abs(m)+Math.abs(u)+Math.abs(d);if(0===_)return 1/0;const g=1===_?4:6,M=6*(m+3*u+9*d+13);t(ot,o),e(ot,ot,h);for(let t=0;t<g;t++){const e=X[M+t];c(N,((1&e)<<1)-1,(2&e)-1,((4&e)>>1)-1),b(N,N,ot),f(K,this.center,N),K[3]=1,v(K,K,s);const a=1/Math.max(1e-6,K[3]);Q[2*t]=K[0]*a,Q[2*t+1]=K[1]*a}const S=2*g-2;let j=Q[0]*(Q[3]-Q[S+1])+Q[S]*(Q[1]-Q[S-1]);for(let t=2;t<S;t+=2)j+=Q[t]*(Q[t+3]-Q[t-1]);return Math.abs(j)*i*n*.125}projectedRadius(t){return r(J,this.quaternion),l(N,t,J),Math.abs(N[0]*this._data[3])+Math.abs(N[1]*this._data[4])+Math.abs(N[2]*this._data[5])}minimumDistancePlane(t){return U(t,this.center)-this.projectedRadius(W(t))}maximumDistancePlane(t){return U(t,this.center)+this.projectedRadius(W(t))}toAaBoundingBox(e){const a=t(ot,this.quaternion),s=this._data[3]*Math.abs(a[0])+this._data[4]*Math.abs(a[3])+this._data[5]*Math.abs(a[6]),i=this._data[3]*Math.abs(a[1])+this._data[4]*Math.abs(a[4])+this._data[5]*Math.abs(a[7]),r=this._data[3]*Math.abs(a[2])+this._data[4]*Math.abs(a[5])+this._data[5]*Math.abs(a[8]),n=this.center;e[0]=n[0]-s,e[1]=n[1]-i,e[2]=n[2]-r,e[3]=n[0]+s,e[4]=n[1]+i,e[5]=n[2]+r}transform(t,e,a,s=0){if(a===B(a))e.isGeographic?at(this,t,e,s):et(this,t,e,s);else if(e.isWGS84&&(a.isWebMercator||C(a)))Z(e,this,a,t,s);else if(e.isWebMercator&&C(a))$(e,this,a,t,s);else{const i=this.center;i[2]+=s,G(i,e,0,i,a,0,1),t.center=i,this!==t&&(t.quaternion=this.quaternion,t.halfSize=this.halfSize)}}}const J=h(),N=w(),H=w(),K=A();function L(t,e=new I){return E(t,e),e}const Q=[.1,.2,.3,.4,.5,.6,.7,.8,.9,1,1.1,1.2],X=(()=>{const t=new Int8Array(162);let e=0;const a=a=>{for(let s=0;s<a.length;s++)t[e+s]=a[s];e+=6};return a([6,2,3,1,5,4]),a([0,2,3,1,5,4]),a([0,2,3,7,5,4]),a([0,1,3,2,6,4]),a([0,1,3,2,0,0]),a([0,1,5,7,3,2]),a([0,1,3,7,6,4]),a([0,1,3,7,6,2]),a([0,1,5,7,6,2]),a([0,1,5,4,6,2]),a([0,1,5,4,0,0]),a([0,1,3,7,5,4]),a([0,2,6,4,0,0]),a([0,0,0,0,0,0]),a([1,3,7,5,0,0]),a([2,3,7,6,4,0]),a([2,3,7,6,0,0]),a([2,3,1,5,7,6]),a([0,1,5,7,6,2]),a([0,1,5,7,6,4]),a([0,1,3,7,6,4]),a([4,5,7,6,2,0]),a([4,5,7,6,0,0]),a([4,5,1,3,7,6]),a([0,2,3,7,5,4]),a([6,2,3,7,5,4]),a([6,2,3,1,5,4]),t})();function Y(t,e,a,s,i){if(i.quaternion=t.quaternion,r(J,t.quaternion),s===V.Global){l(lt,t.center,J),m(ft,lt),u(mt,ft,t.halfSize),p(mt,ft,mt);const s=g(mt);f(mt,ft,t.halfSize);const r=g(mt);if(s<a)i.center=t.center,c(lt,a,a,a),i.halfSize=f(lt,t.halfSize,lt);else{const n=r>0?1+e/r:1,o=s>0?1+a/s:1,h=(o+n)/2,c=(o-n)/2;M(mt,ft,c),i.halfSize=S(mt,mt,t.halfSize,h),M(mt,ft,h),i.center=S(mt,mt,t.halfSize,c),j(lt,lt),q(lt,i.center,lt),i.center=l(lt,lt,i.quaternion)}}else{i.center=S(lt,t.center,P,(a+e)/2);const s=l(lt,P,J);m(s,s),i.halfSize=S(ft,t.halfSize,s,(a-e)/2)}return i}function Z(t,e,a,s,i){z(nt,e.center),nt[2]+=i;const r=B(a);G(nt,t,0,nt,r,0,1),tt(r,e,nt,a,s)}function $(t,e,a,s,i){z(nt,e.center),nt[2]+=i,tt(t,e,nt,a,s)}function tt(e,a,s,i,r){const n=t(ot,a.quaternion),o=a.halfSize;for(let t=0;t<8;++t){for(let e=0;e<3;++e)rt[e]=o[e]*(0!=(t&1<<e)?-1:1);for(let e=0;e<3;++e){let a=s[e];for(let t=0;t<3;++t)a+=rt[t]*n[3*t+e];st[3*t+e]=a}}G(st,e,0,st,i,0,8),L(it,r)}function et(t,e,a,s){t.getCorners(ct),e.center=c(rt,t.center[0],t.center[1],t.center[2]+s),D(a,e.center,ht,B(a)),e.center=c(rt,ht[12],ht[13],ht[14]);const i=2*Math.sqrt(1+ht[0]+ht[5]+ht[10]);J[0]=(ht[6]-ht[9])/i,J[1]=(ht[8]-ht[2])/i,J[2]=(ht[1]-ht[4])/i,J[3]=.25*i,e.quaternion=n(J,J,t.quaternion),r(J,e.quaternion),c(ft,0,0,0);for(const r of ct)r[2]+=s,G(r,a,0,r,B(a),0,1),p(lt,r,e.center),l(lt,lt,J),x(ft,ft,lt);e.halfSize=ft}function at(t,e,a,s){const i=k(a),n=1+Math.max(0,s)/(i.radius+t.center[2]);c(rt,t.center[0],t.center[1],t.center[2]+s),G(rt,a,0,rt,B(a),0,1),e.center=rt,e.quaternion=t.quaternion,r(J,t.quaternion),c(lt,0,0,1),l(lt,lt,J),c(lt,t.halfSize[0]*Math.abs(lt[0]),t.halfSize[1]*Math.abs(lt[1]),t.halfSize[2]*Math.abs(lt[2])),M(lt,lt,i.inverseFlattening),f(lt,t.halfSize,lt),e.halfSize=M(lt,lt,n)}const st=new Array(24),it=new F(st,3),rt=w(),nt=w(),ot=a(),ht=s(),ct=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],lt=w(),ft=w(),mt=w(),ut=R(-1,-1,-1);export{ut as INVALID_HALFSIZE,I as Obb,L as compute,Y as computeOffsetObb};
5
+ import{fromQuat as t,scale as a}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as e}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as s}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as i,conjugate as r,multiply as n}from"../../../core/libs/gl-matrix-2/math/quat.js";import{IDENTITY as o,create as h}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{s as c,r as d,u as _,v as l,t as f,g as m,w as u,x as g,l as p,i as b,p as M,y as j,z as S,A as z}from"../../../chunks/vec32.js";import{ZEROS as x,create as y,UNIT_Z as C,fromValues as q}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{t as Q}from"../../../chunks/vec42.js";import{create as w}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as P}from"../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as R}from"../../../geometry/spatialReferenceEllipsoidUtils.js";import{computeTranslationToOriginAndRotation as v}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as A}from"../../../geometry/projection/projectBuffer.js";import{getNormal as H}from"../../../geometry/support/plane.js";import{isPlateCarree as k}from"../../../geometry/support/spatialReferenceUtils.js";import{sv3d as B,sq4d as D}from"../../../geometry/support/vectorStacks.js";import{ViewingMode as G}from"../../ViewingMode.js";import{computeOBB as U}from"./dito.js";import{Vertices as W}from"../webgl-engine/lib/Attribute.js";class O{constructor(t=x,a=mt,e=o){this._data=[t[0],t[1],t[2],a[0],a[1],a[2],e[0],e[1],e[2],e[3]]}clone(){const t=new O;return t._data=this._data.slice(),t}static fromData(t){const a=new O;return a._data=t.slice(),a}static fromJSON(t){return new O(t.center,t.halfSize,t.quaternion)}copy(t){this._data=t.data.slice()}get center(){return c(B.get(),this._data[0],this._data[1],this._data[2])}get centerX(){return this._data[0]}get centerY(){return this._data[1]}get centerZ(){return this._data[2]}getCenter(t){return t[0]=this._data[0],t[1]=this._data[1],t[2]=this._data[2],t}set center(t){this._data[0]=t[0],this._data[1]=t[1],this._data[2]=t[2]}setCenter(t,a,e){this._data[0]=t,this._data[1]=a,this._data[2]=e}get halfSize(){return c(B.get(),this._data[3],this._data[4],this._data[5])}getHalfSize(t){return t[0]=this._data[3],t[1]=this._data[4],t[2]=this._data[5],t}set halfSize(t){this._data[3]=t[0],this._data[4]=t[1],this._data[5]=t[2]}get quaternion(){return i(D.get(),this._data[6],this._data[7],this._data[8],this._data[9])}getQuaternion(t){return t[0]=this._data[6],t[1]=this._data[7],t[2]=this._data[8],t[3]=this._data[9],t}set quaternion(t){this._data[6]=t[0],this._data[7]=t[1],this._data[8]=t[2],this._data[9]=t[3]}get data(){return this._data}getCorners(t){const{quaternion:a}=this;for(let e=0;e<8;++e){const s=t[e];s[0]=1&e?-this._data[3]:this._data[3],s[1]=2&e?-this._data[4]:this._data[4],s[2]=4&e?-this._data[5]:this._data[5],d(s,s,a),s[0]+=this._data[0],s[1]+=this._data[1],s[2]+=this._data[2]}}isVisible(t){return this.intersectPlane(t[0])<=0&&this.intersectPlane(t[1])<=0&&this.intersectPlane(t[2])<=0&&this.intersectPlane(t[3])<=0&&this.intersectPlane(t[4])<=0&&this.intersectPlane(t[5])<=0}get radius(){const t=this._data[3],a=this._data[4],e=this._data[5];return Math.sqrt(t*t+a*a+e*e)}intersectSphere(t){E[0]=this._data[0]-t[0],E[1]=this._data[1]-t[1],E[2]=this._data[2]-t[2];const a=this.getQuaternion(V);return r(T,a),d(E,E,T),_(E,E),F[0]=Math.min(E[0],this._data[3]),F[1]=Math.min(E[1],this._data[4]),F[2]=Math.min(E[2],this._data[5]),l(F,E)<t[3]*t[3]}intersectPlane(t){const a=t[0]*this._data[0]+t[1]*this._data[1]+t[2]*this._data[2]+t[3],e=this.projectedRadius(H(t));return a>e?1:a<-e?-1:0}intersectRay(t,a,e=0){const s=this.getQuaternion(V);r(T,s),E[0]=t[0]-this._data[0],E[1]=t[1]-this._data[1],E[2]=t[2]-this._data[2];const i=d(E,E,T),n=d(F,a,T);let o=-1/0,h=1/0;const c=this.getHalfSize(ot);for(let r=0;r<3;r++)if(Math.abs(n[r])>1e-6){const t=(e+c[r]-i[r])/n[r],a=(-e-c[r]-i[r])/n[r];o=Math.max(o,Math.min(t,a)),h=Math.min(h,Math.max(t,a))}else if(i[r]>c[r]+e||i[r]<-c[r]-e)return!1;return o<=h}projectedArea(e,s,i,n){const o=this.getQuaternion(V);r(T,o),E[0]=e[0]-this._data[0],E[1]=e[1]-this._data[1],E[2]=e[2]-this._data[2],d(E,E,T);const h=this.getHalfSize(ot),_=E[0]<-h[0]?-1:E[0]>h[0]?1:0,l=E[1]<-h[1]?-1:E[1]>h[1]?1:0,u=E[2]<-h[2]?-1:E[2]>h[2]?1:0,g=Math.abs(_)+Math.abs(l)+Math.abs(u);if(0===g)return 1/0;const p=1===g?4:6,b=6*(_+3*l+9*u+13);t(ht,o),a(ht,ht,h);const M=this.getCenter(rt);for(let t=0;t<p;t++){const a=X[b+t];c(E,((1&a)<<1)-1,(2&a)-1,((4&a)>>1)-1),f(E,E,ht),m(I,M,E),I[3]=1,Q(I,I,s);const e=1/Math.max(1e-6,I[3]);N[2*t]=I[0]*e,N[2*t+1]=I[1]*e}const j=2*p-2;let S=N[0]*(N[3]-N[j+1])+N[j]*(N[1]-N[j-1]);for(let t=2;t<j;t+=2)S+=N[t]*(N[t+3]-N[t-1]);return Math.abs(S)*i*n*.125}projectedRadius(t){const a=this.getQuaternion(V);return r(T,a),d(E,t,T),Math.abs(E[0]*this._data[3])+Math.abs(E[1]*this._data[4])+Math.abs(E[2]*this._data[5])}minimumDistancePlane(t){return t[0]*this._data[0]+t[1]*this._data[1]+t[2]*this._data[2]+t[3]-this.projectedRadius(H(t))}maximumDistancePlane(t){return t[0]*this._data[0]+t[1]*this._data[1]+t[2]*this._data[2]+t[3]+this.projectedRadius(H(t))}toAaBoundingBox(a){const e=this.getQuaternion(V),s=t(ht,e),i=this._data[3]*Math.abs(s[0])+this._data[4]*Math.abs(s[3])+this._data[5]*Math.abs(s[6]),r=this._data[3]*Math.abs(s[1])+this._data[4]*Math.abs(s[4])+this._data[5]*Math.abs(s[7]),n=this._data[3]*Math.abs(s[2])+this._data[4]*Math.abs(s[5])+this._data[5]*Math.abs(s[8]);a[0]=this._data[0]-i,a[1]=this._data[1]-r,a[2]=this._data[2]-n,a[3]=this._data[0]+i,a[4]=this._data[1]+r,a[5]=this._data[2]+n}transform(t,a,e,s=0,i=R(e)){if(e===i)a.isGeographic?at(this,t,a,s):tt(this,t,a,s);else if(a.isWGS84&&(e.isWebMercator||k(e)))K(a,this,e,t,s);else if(a.isWebMercator&&k(e))L(a,this,e,t,s);else{const i=this.getCenter(rt);i[2]+=s,A(i,a,0,i,e,0,1),t.center=i,this!==t&&(t.quaternion=this.getQuaternion(V),t.halfSize=this.getHalfSize(ot))}}}const T=h(),V=h(),Z=h(),E=y(),F=y(),I=w();function J(t,a=new O){return U(t,a),a}const N=[.1,.2,.3,.4,.5,.6,.7,.8,.9,1,1.1,1.2],X=(()=>{const t=new Int8Array(162);let a=0;const e=e=>{for(let s=0;s<e.length;s++)t[a+s]=e[s];a+=6};return e([6,2,3,1,5,4]),e([0,2,3,1,5,4]),e([0,2,3,7,5,4]),e([0,1,3,2,6,4]),e([0,1,3,2,0,0]),e([0,1,5,7,3,2]),e([0,1,3,7,6,4]),e([0,1,3,7,6,2]),e([0,1,5,7,6,2]),e([0,1,5,4,6,2]),e([0,1,5,4,0,0]),e([0,1,3,7,5,4]),e([0,2,6,4,0,0]),e([0,0,0,0,0,0]),e([1,3,7,5,0,0]),e([2,3,7,6,4,0]),e([2,3,7,6,0,0]),e([2,3,1,5,7,6]),e([0,1,5,7,6,2]),e([0,1,5,7,6,4]),e([0,1,3,7,6,4]),e([4,5,7,6,2,0]),e([4,5,7,6,0,0]),e([4,5,1,3,7,6]),e([0,2,3,7,5,4]),e([6,2,3,7,5,4]),e([6,2,3,1,5,4]),t})();function Y(t,a,e,s,i){const n=t.getQuaternion(V);i.quaternion=n,r(T,n);const o=t.getCenter(rt),h=t.getHalfSize(ot);if(s===G.Global){d(_t,o,T),_(lt,_t),u(ft,lt,h),g(ft,lt,ft);const s=p(ft);m(ft,lt,h);const r=p(ft);if(s<e)i.center=o,c(_t,e,e,e),i.halfSize=m(_t,h,_t);else{const n=r>0?1+a/r:1,o=s>0?1+e/s:1,c=(o+n)/2,_=(o-n)/2;b(ft,lt,_),i.halfSize=M(ft,ft,h,c),b(ft,lt,c),M(ft,ft,h,_),j(_t,_t),S(_t,ft,_t);const l=t.getQuaternion(Z);i.center=d(_t,_t,l)}}else{i.center=M(_t,o,C,(e+a)/2);const t=d(_t,C,T);_(t,t),i.halfSize=M(lt,h,t,(e-a)/2)}return i}function K(t,a,e,s,i){a.getCenter(rt),rt[2]+=i;const r=R(e);A(rt,t,0,rt,r,0,1),$(r,a,rt,e,s)}function L(t,a,e,s,i){a.getCenter(rt),rt[2]+=i,$(t,a,rt,e,s)}function $(a,e,s,i,r){const n=e.getQuaternion(V),o=t(ht,n),h=e.getHalfSize(ot);for(let t=0;t<8;++t){for(let a=0;a<3;++a)it[a]=h[a]*(0!=(t&1<<a)?-1:1);for(let a=0;a<3;++a){let e=s[a];for(let t=0;t<3;++t)e+=it[t]*o[3*t+a];et[3*t+a]=e}}A(et,a,0,et,i,0,8),J(st,r)}function tt(t,a,e,s){t.getCorners(dt),t.getCenter(it),it[2]+=s,v(e,it,ct,R(e)),a.setCenter(ct[12],ct[13],ct[14]);const i=2*Math.sqrt(1+ct[0]+ct[5]+ct[10]);T[0]=(ct[6]-ct[9])/i,T[1]=(ct[8]-ct[2])/i,T[2]=(ct[1]-ct[4])/i,T[3]=.25*i;const o=t.getQuaternion(V);a.quaternion=n(T,T,o),r(T,T),c(lt,0,0,0);const h=a.getCenter(nt);for(const r of dt)r[2]+=s,A(r,e,0,r,R(e),0,1),g(_t,r,h),d(_t,_t,T),z(lt,lt,_t);a.halfSize=lt}function at(t,a,e,s){const i=P(e),n=1+Math.max(0,s)/(i.radius+t.centerZ);t.getCenter(it),it[2]+=s,A(it,e,0,it,R(e),0,1),a.center=it;const o=t.getQuaternion(V);a.quaternion=o,r(T,o),c(_t,0,0,1),d(_t,_t,T);const h=t.getHalfSize(ot);c(_t,h[0]*Math.abs(_t[0]),h[1]*Math.abs(_t[1]),h[2]*Math.abs(_t[2])),b(_t,_t,i.inverseFlattening),m(_t,h,_t),a.halfSize=b(_t,_t,n)}const et=new Array(24),st=new W(et,3),it=y(),rt=y(),nt=y(),ot=y(),ht=e(),ct=s(),dt=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],_t=y(),lt=y(),ft=y(),mt=q(-1,-1,-1);export{mt as INVALID_HALFSIZE,O as Obb,J as compute,Y as computeOffsetObb};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{releaseMaybe as e}from"../../../core/maybe.js";class t{constructor(e,t,h){this._fbos=e,this._format=t,this._name=h}get valid(){return null!=this._handle?.colorTexture}dispose(){this._handle=e(this._handle)}get texture(){return this._handle?.colorTexture}bind(e,t,h){this._handle&&this._handle.fbo.width===t&&this._handle.fbo.height===h||(this._handle?.release(),this._handle=this._fbos.acquire(this._format,t,h,this._name)),e.bindFramebuffer(this._handle?.fbo)}generateMipMap(){this._handle?.colorTexture?.descriptor?.hasMipmap&&this._handle?.colorTexture?.generateMipmap()}}export{t as OverlayFramebufferObject};
5
+ import{releaseMaybe as e}from"../../../core/maybe.js";class t{constructor(e,t,h){this._fbos=e,this._format=t,this._name=h}get valid(){return null!=this._handle?.colorTexture}dispose(){this._handle=e(this._handle)}get texture(){return this._handle?.colorTexture}bind(e,t,h){this._handle&&this._handle.fbo.width===t&&this._handle.fbo.height===h?e.bindFramebuffer(this._handle?.fbo):(this._handle?.release(),this._handle=this._fbos.acquire(t,h,this._name,this._format))}generateMipMap(){this._handle?.colorTexture?.descriptor?.hasMipmap&&this._handle?.colorTexture?.generateMipmap()}}export{t as OverlayFramebufferObject};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{Cyclical as r,cyclicalPI as s}from"../../../core/Cyclical.js";import has from"../../../core/has.js";import{clamp as i,deg2rad as a}from"../../../core/mathUtils.js";import{watch as n,sync as o}from"../../../core/reactiveUtils.js";import{Milliseconds as l}from"../../../core/time.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{subtract as d}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{g as u,f as p,w as _,c as m,k as y}from"../../../chunks/vec32.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{t as f,b as v,f as R}from"../../../chunks/vec42.js";import{create as w,fromValues as O}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as T}from"../../../geometry/ellipsoidUtils.js";import{projectVectorToVector as x}from"../../../geometry/projection/projectVectorToVector.js";import{create as D,width as S,copy as E,center as P,height as M,intersection as b,contains as I,intersects as j,offset as C}from"../../../geometry/support/aaBoundingRect.js";import{create as U,wrap as N}from"../../../geometry/support/ray.js";import{j as A,k as L,t as G}from"../../../chunks/sphere.js";import{angleAroundAxis as V}from"../../../geometry/support/vector.js";import{y2lat as q}from"../../../geometry/support/webMercatorUtils.js";import{viewAngle as F}from"../state/utils/viewUtils.js";import{debugFlags as k}from"../support/debugFlags.js";import{PointGraphics as B}from"../support/debugUtils.js";import{OverlayIndex as H}from"./interfaces.js";import{OverlayRenderer as W}from"./OverlayRenderer.js";import{RenderRequestType as Y}from"../webgl-engine/lib/basicInterfaces.js";import{newIntersector as z}from"../webgl-engine/lib/Intersector.js";import{fromValues as X}from"../webgl-engine/lib/LocalOriginFactory.js";import{UpdateParameters as K}from"../webgl-engine/lib/Material.js";import{SortedRenderGeometryRenderer as Z}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{applyTextureResizeModulo as J}from"../webgl-engine/lib/textureUtils.js";import{removeLoadedShaderModules as Q}from"../webgl-engine/parts/requireUtils.js";import{TaskPriority as $,noBudget as ee,Task as te}from"../../support/Scheduler.js";const re=1.3,se=[[-.1,-2,3.9,2],[-.1,-3.9,3.9,.1],[-2,-3.9,2,.1],[-3.9,-3.9,.1,.1],[-3.9,-2,.1,2],[-3.9,-.1,.1,3.9],[-2,-.1,2,3.9],[-.1,-.1,3.9,3.9]];let ie,ae=class extends t{get running(){return this._placementDirty&&(this._drapeSources.size>0||this.view.graphics.length>0||k.OVERLAY_DRAW_DEBUG_TEXTURE)&&!!this._spatialReference&&!this.suspended&&this.surface.ready}get _isSpherical(){return this.view.state.isGlobal}get _worldToPCSRatio(){return null!=this._spatialReference&&this._spatialReference.isGeographic&&!this.view.state.isLocal?T(this._spatialReference).metersPerDegree:1}get _overlayStretch(){return re/this.view.resolutionScale}get suspended(){return this.surface.suspended}get updating(){return this.running||this.renderer.updating||this._contentUpdated}get rendersOccludedDraped(){return this.renderer.rendersOccludedDraped}constructor(e){super(e),this._spatialReference=null,this._renderSR=null,this._overlaySREqualsRenderSR=!0,this._drapeSources=new Set,this._drapeTargets=new Set,this._placementDirty=!1,this._contentUpdated=!1,this._drawTexturesDirty=!1,this._drawTexturesAnimateDirty=!1,this._longitudeCyclical=null,this._latestOriginId=0,this._maxResolution=has("esri-mobile")?2048:4096,this._animationTimeLast=0}initialize(){const e=this.view;this.renderer=new W({view:e,worldToPCSRatio:this._worldToPCSRatio,spatialReference:this._spatialReference}),e._stage.renderer.plugins.add(this.renderer);const t=()=>this.setDrawTexturesDirty();this._groundIntersector=z(this.view.state.viewingMode),this._groundIntersector.options.backfacesTerrain=!0,this._groundIntersector.options.invisibleTerrain=!0,this._groundIntersector.options.hud=!1,this.addHandles([n((()=>this.renderer.hasHighlights),t),this.renderer.events.on("has-water",(t=>e._stage?.renderer.setParameters({hasOverlayWater:t}))),this.renderer.events.on("content-changed",t),n((()=>e.state.camera.pixelRatio),t),n((()=>e.state.alignPixelEnabled),t),this.renderer.events.on("textures-disposed",(()=>this.surface.requestRender())),n((()=>[e.pointsOfInterest?.renderPointOfView,e.pointsOfInterest?.centerOnSurfaceFrequent?.location]),(()=>this.setPlacementDirty())),n((()=>[e.state?.pixelRatio,e.state?.contentPixelRatio]),(()=>this.setPlacementDirty()),o),this.surface.on("elevation-change",(()=>this.setPlacementDirty())),e.on("resize",(()=>this.setPlacementDirty())),e.resourceController.scheduler.registerTask($.OVERLAY,this),e._stage.renderView.events.on("force-camera-for-screenshot",(e=>{this._updateOverlays(ee,e.camera,Y.BACKGROUND),this.renderer.hasOverlays&&this._drawOverlays(Y.BACKGROUND,e)}))]),e._stage.renderer.renderOverlay=e=>this._renderOverlay(e)}_renderOverlay(e){if(this._contentUpdated=!1,this.renderer.processSyncDrapeSources(),this.renderer.hasOverlays)return this._dispatchAnimationUpdate(e),this._drawOverlays(Y.UPDATE,this.view.state)}destroy(){this.view?._stage&&(this.view._stage.renderer.plugins.remove(this.renderer),this.view._stage.renderer.renderOverlay=()=>{}),ie&&(ie.hide(),ie=null)}get hasOverlays(){return this.renderer.hasOverlays}setSpatialReference(e){this._spatialReference=e,this.renderer.spatialReference=e,this._longitudeCyclical=null;const t=this.view.renderSpatialReference;null!=e&&null!=t?(this._renderSR=t,this._overlaySREqualsRenderSR=e.equals(this._renderSR),this._isSpherical&&(this._longitudeCyclical=e.isWebMercator?new r(-20037508.342787,20037508.342787):new r(-180,180),this.renderer.longitudeCyclical=this._longitudeCyclical),this.renderer&&(this.renderer.worldToPCSRatio=this._worldToPCSRatio)):this.renderer.disposeOverlays()}registerDrapeSource(e,t,r){this._drapeSources.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources);const s=this.renderer.createDrapeSourceRenderer(e,t,r);return this._updateDrapeSourceExtent(e),this._setContentDirty(),this.notifyChange("running"),s}registerGeometryDrapeSource(e){return this.registerDrapeSource(e,Z)}_updateDrapeSourceExtent(e){2===this.renderer.overlays.length&&null!=e.setDrapingExtent&&null!=this._spatialReference&&e.setDrapingExtent(this.renderer.overlays,this._spatialReference)}unregisterDrapeSource(e){this._drapeSources.has(e)&&(this._drapeSources.delete(e),this.renderer.removeDrapeSourceRenderer(e),this.renderer.ensureDrapeSources(this._drapeSources),this._setContentDirty(),this.notifyChange("running"))}registerDrapeTarget(e){this._drapeTargets.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources)}unregisterDrapeTarget(e){this._drapeTargets.delete(e),this.renderer.ensureDrapeTargets(this._drapeTargets)}_setContentDirty(){this.setPlacementDirty(),this.setDrawTexturesDirty()}setPlacementDirty(){this._placementDirty=!0}runTask(e){return this._updateOverlays(e,this.view.state.contentCamera,Y.UPDATE)}_updateOverlays(e,t,r){if(!this._spatialReference)return te.YIELD;const s=this._computeOverlayResolution(t);this._computeOverlayExtents(t,s,ce),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources,ce.stretch);const i=this._updateOverlay(H.INNER,ce.inner,s,1*ce.pixelRatioAdjustment,ce.mapUnitsPerPixel),a=S(ce.inner)/S(ce.outer),n=this._updateOverlay(H.OUTER,ce.outer,s,a*ce.pixelRatioAdjustment,ce.mapUnitsPerPixel);i!==_e.EXTENT&&n!==_e.EXTENT||(this._drapeSources.forEach((e=>this._updateDrapeSourceExtent(e))),this.surface.updateTileOverlayParams(r)),i===_e.NONE&&n===_e.NONE||this.setDrawTexturesDirty(),this._placementDirty=!1,e.madeProgress()}_computeOverlayResolution(e){const t=this.view.state.contentPixelRatio*this.view.resolutionScale,r=e.fullWidth/e.pixelRatio*t,s=e.fullHeight/e.pixelRatio*t,i=Math.ceil(1.5*Math.max(r,s));return Math.min(J(i),this._maxResolution)}_updateOverlay(e,t,r,s,i){if(0===this.renderer.overlays.length)return _e.NONE;const a=this.renderer.overlays[e],n=a.mapUnitsPerPixel;if(a.mapUnitsPerPixel=i,a.pixelRatio=s,ne(t,a.extent)&&r===a.resolution)return n===i?_e.NONE:_e.RERENDER_ONLY;E(a.extent,t),a.resolution=r;const o=P(a.extent);return a.renderLocalOrigin=X(o[0],o[1],0,"OV_"+this._latestOriginId++),_e.EXTENT}setTileParameters(e){const t=e.renderData.overlay;if(this.renderer.overlays.length>0){const r=this.renderer.overlays[H.INNER],s=this.renderer.overlays[H.OUTER],i=e.extent;this._rectInsideRect(r.extent,i)||this._rectanglesOverlap(i,r.extent)||this._rectanglesOverlap(i,s.extent)?(this._setTileOverlayData(i,H.INNER,t),this._setTileOverlayData(i,H.OUTER,t)):(this._clearTileOverlayData(H.INNER,t),this._clearTileOverlayData(H.OUTER,t))}else this._clearTileOverlayData(H.INNER,t),this._clearTileOverlayData(H.OUTER,t)}overlayPixelSizeInMapUnits(e,t){if(0===this.renderer.overlays.length)return t();const r=this.renderer.overlays[H.INNER],s=this.renderer.overlays[H.OUTER],i=this._pointIsInExtent(e,r.extent)?r:s;return(i.extent[2]-i.extent[0])/i.resolution}_setTileOverlayData(e,t,r){if(0===this.renderer.overlays.length)return;const s=this.renderer.overlays[t].extent,i=S(s),a=M(s);let n=e[0];if(this._longitudeCyclical){n=this._longitudeCyclical.minimalMonotonic(s[0],n);const t=this._longitudeCyclical.minimalMonotonic(s[0],e[2]);n>t&&(n=t-(e[2]-e[0]))}r.setScale(t,S(e)/i,M(e)/a),r.setOffset(t,(n-s[0])/i,(e[1]-s[1])/a)}_clearTileOverlayData(e,t){t.setScale(e,-1,-1),t.setOffset(e,-1,-1)}async reloadShaders(){Q(),await this.renderer.reloadShaders(),this.setDrawTexturesDirty(),this.runTask(ee)}_dispatchAnimationUpdate(e){const t=l(e-this._animationTimeLast);if(t>=this.surface.view._stage.renderer.animationTimestep||null!=this.view.state.forcedAnimationTime||this._drawTexturesDirty||this._drawTexturesAnimateDirty){const r=l(t/this.surface.view._stage.renderer.animationTimeDilation),s=new K(this.view.state.camera,r,this.view.state.forcedAnimationTime);this.renderer.updateAnimation(s)&&(this._drawTexturesAnimateDirty=!0),this._animationTimeLast=e}}setDrawTexturesDirty(){this.renderer.hasOverlays?(this._contentUpdated=!0,this._drawTexturesDirty=!0,this.view._stage.renderView.requestRender()):this.setPlacementDirty()}_intersectGroundFromView(e,t,r,s){const i=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(e,pe,t,r);if(null==i)return!1;const a=i.origin,n=u(he,i.origin,i.direction);return this._groundIntersector.reset(a,n,e),this._groundIntersector.intersect([]),this.view.basemapTerrain.intersect(this._groundIntersector,null,a,n),this._groundIntersector.results.min.getIntersectionPoint(s)}_findHorizonBasedPointOfInterest(e,t){let r=.5;const a=.55,n=this.view.renderCoordsHelper.getAltitude(e.eye),o=this.view.pointsOfInterest.centerOnSurfaceFrequent,l=1e-5,h=i(o.estimatedSurfaceAltitude,e.aboveGround?-1/0:n+l,e.aboveGround?n-l:1/0),c=e.aboveGround;if("global"===this.view.viewingMode){const t=he;A(L(G,T(this.view.spatialReference).radius+h),N(e.eye,e.viewForward),t),p(t,t,e.eye);const i=s.normalize(V(e.viewForward,t,e.viewRight))/e.fovY+.5,n=i<=0||i>=1?.5:a;r=c?n*i:i+n*(1-i)}else{const t=.5*Math.PI-Math.acos(-e.viewForward[2]),s=Math.tan(t),n=O(0,s,1,0),o=f(n,n,e.projectionMatrix)[1],l=i(.5+.5*o,0,1);r=1===l||0===l?.5:c?l*a:1-(1-l)*a}return!!this._intersectGroundFromView(e,.5,r,t)&&_(t,e.eye)<o.distance*o.distance}_computeOverlayExtents(e,t,r){const s=this.view.pointsOfInterest.centerOnSurfaceFrequent.renderLocation,i=g();this._findHorizonBasedPointOfInterest(e,i)||m(i,s),k.OVERLAY_SHOW_CENTER?(null==ie&&(ie=new B(this.view.graphics,"red")),ie.show(i,this._renderSR)):null!=ie&&ie.hide();const n=Math.max(.1,y(e.eye,i)),o=F(this.view.renderCoordsHelper,s,e.eye);this._overlaySREqualsRenderSR||x(i,this._renderSR,i,this._spatialReference);const l=this.surface.extent,h=!this._isSpherical&&this._spatialReference&&this._spatialReference.isGeographic,c=h&&this._spatialReference?1/T(this._spatialReference).metersPerDegree:1,u=this.view.state.contentPixelRatio,p=e.perScreenPixelRatio/u*n*c;r.mapUnitsPerPixel=p/this._worldToPCSRatio,r.stretch=this._overlayStretch;let _=t*p/2*r.stretch,f=!1,w=h?90:1/0;this._isSpherical&&l&&this._spatialReference&&(this._spatialReference.isWebMercator?(_/=Math.cos(q(i[1])),w=l[3]):(f=!0,_/=T(this._spatialReference).metersPerDegree,w=90),_>=w&&(_=w,i[1]=0,this._spatialReference.isWebMercator&&(i[0]=0)));let O=1;f&&(O=1/Math.max(.2,Math.cos(Math.abs(a(i[1])))),_*O>180&&(O=180/_),r.mapUnitsPerPixel*=O);const D=Math.log(2)/12;_=Math.exp(Math.round(Math.log(_)/D)*D);const P=_*O,M=32,j=.5*t/(M*P),C=.5*t/(M*_);i[0]=Math.round(i[0]*j)/j,i[1]=Math.round(i[1]*C)/C;const U=r.inner;U[0]=i[0]-P,U[1]=i[1]-_,U[2]=i[0]+P,U[3]=i[1]+_,this._isSpherical&&this._shiftExtentToFitBounds(U,1/0,w);const N=r.outer;if(6*P>S(l))E(N,l);else{if(Math.PI/2-Math.abs(o-Math.PI/2)<=.25*Math.PI)N[0]=U[0]-P,N[1]=U[1]-_,N[2]=U[2]+P,N[3]=U[3]+_;else{x(e.eye,this._renderSR,he,this._spatialReference),d(le,i,he);let t=-Math.atan2(le[1],le[0])+.125*Math.PI;t<0&&(t+=2*Math.PI);const r=Math.floor(t/(.25*Math.PI));v(le,se[r],2*_),le[0]*=O,le[2]*=O,R(N,U,le)}}if(this._isSpherical)N[0]=this._longitudeCyclical.clamp(N[0]),N[2]=this._longitudeCyclical.clamp(N[2]),N[1]=Math.max(N[1],-w),N[3]=Math.min(N[3],w);else{const e=b(U,l,de),t=b(N,l,ue);I(e,t)&&(N[2]=N[0],N[3]=N[1])}const A=Math.abs(U[2]-U[0])/t;r.mapUnitsPerPixel=Math.max(r.mapUnitsPerPixel,A),r.pixelRatioAdjustment=r.mapUnitsPerPixel/A}_drawOverlays(e,t){if(!this.renderer.hasOverlays)return;if(!this._drawTexturesDirty&&!this._drawTexturesAnimateDirty)return this.renderer;const r=this._drawTexturesDirty;this._drawTexturesDirty=this._drawTexturesAnimateDirty=!1;const s=this.renderer.computeValidity();this.renderer.releaseRenderTargets(),this.renderer.drawOverlays(t);return s!==this.renderer.computeValidity()&&this.surface.updateTileOverlayParams(Y.UPDATE),r?(this.surface.requestRender(e),e===Y.UPDATE&&this.surface.requestUpdate()):this.surface.requestRender(Y.BACKGROUND),this.renderer}_rectanglesOverlap(e,t){return null!=e&&(this._longitudeCyclical?(this._longitudeCyclical.contains(t[0],t[2],e[0])||this._longitudeCyclical.contains(t[0],t[2],e[2])||this._longitudeCyclical.contains(e[0],e[2],t[0]))&&!(e[1]>t[3]||e[3]<t[1]):j(e,t))}_rectInsideRect(e,t){return null!=t&&(this._longitudeCyclical?this._longitudeCyclical.contains(e[0],e[2],t[0])&&this._longitudeCyclical.contains(e[0],e[2],t[2])&&t[1]>e[1]&&t[3]<e[3]:I(e,t))}_pointIsInExtent(e,t){if(this._longitudeCyclical)return this._longitudeCyclical.contains(t[0],t[2],e.x)&&e.y>=t[1]&&e.y<=t[3];const r=e.x,s=e.y;return r>t[0]&&r<t[2]&&s>t[1]&&s<t[3]}_shiftExtentToFitBounds(e,t,r){let s=0,i=0;e[0]<-t?s=e[0]+t:e[2]>t&&(s=t-e[2]),e[1]<-r?i=e[1]+r:e[3]>r&&(i=r-e[3]),C(e,s,i)}get test(){return{renderer:this.renderer,update:()=>this.runTask(ee)}}};function ne(e,t){const r=1e-5,s=k.TESTS_DISABLE_OPTIMIZATIONS?0:r*Math.max(e[2]-e[0],e[3]-e[1],t[2]-t[0],t[3]-t[1]);return Math.abs(t[0]-e[0])<=s&&Math.abs(t[1]-e[1])<=s&&Math.abs(t[2]-e[2])<=s&&Math.abs(t[3]-e[3])<=s}e([h()],ae.prototype,"_spatialReference",void 0),e([h({readOnly:!0})],ae.prototype,"running",null),e([h()],ae.prototype,"_placementDirty",void 0),e([h()],ae.prototype,"_contentUpdated",void 0),e([h()],ae.prototype,"_isSpherical",null),e([h()],ae.prototype,"_worldToPCSRatio",null),e([h({autoDestroy:!0})],ae.prototype,"renderer",void 0),e([h({constructOnly:!0})],ae.prototype,"view",void 0),e([h({constructOnly:!0})],ae.prototype,"surface",void 0),e([h()],ae.prototype,"suspended",null),e([h()],ae.prototype,"updating",null),e([h({type:Boolean})],ae.prototype,"rendersOccludedDraped",null),ae=e([c("esri.views.3d.terrain.OverlayManager")],ae);class oe{constructor(){this.inner=D(),this.outer=D(),this.mapUnitsPerPixel=0,this.pixelRatioAdjustment=1,this.stretch=re}}const le=w(),he=g(),ce=new oe,de=D(),ue=D(),pe=U();var _e;!function(e){e[e.NONE=0]="NONE",e[e.EXTENT=1]="EXTENT",e[e.RERENDER_ONLY=2]="RERENDER_ONLY"}(_e||(_e={}));export{ae as OverlayManager};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{Cyclical as r,cyclicalPI as s}from"../../../core/Cyclical.js";import has from"../../../core/has.js";import{clamp as i,deg2rad as a}from"../../../core/mathUtils.js";import{watch as n,sync as o}from"../../../core/reactiveUtils.js";import{Milliseconds as l}from"../../../core/time.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{subtract as d}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{g as u,f as p,v as _,c as m,k as y}from"../../../chunks/vec32.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{t as f,b as v,f as R}from"../../../chunks/vec42.js";import{create as w,fromValues as O}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as T}from"../../../geometry/ellipsoidUtils.js";import{projectVectorToVector as x}from"../../../geometry/projection/projectVectorToVector.js";import{create as D,width as S,copy as E,center as P,height as M,intersection as b,contains as I,intersects as j,offset as C}from"../../../geometry/support/aaBoundingRect.js";import{create as U,wrap as N}from"../../../geometry/support/ray.js";import{j as A,k as L,t as G}from"../../../chunks/sphere.js";import{angleAroundAxis as V}from"../../../geometry/support/vector.js";import{y2lat as q}from"../../../geometry/support/webMercatorUtils.js";import{viewAngle as F}from"../state/utils/viewUtils.js";import{debugFlags as k}from"../support/debugFlags.js";import{PointGraphics as B}from"../support/debugUtils.js";import{OverlayIndex as H}from"./interfaces.js";import{OverlayRenderer as W}from"./OverlayRenderer.js";import{RenderRequestType as Y}from"../webgl-engine/lib/basicInterfaces.js";import{newIntersector as z}from"../webgl-engine/lib/Intersector.js";import{fromValues as X}from"../webgl-engine/lib/LocalOriginFactory.js";import{UpdateParameters as K}from"../webgl-engine/lib/Material.js";import{SortedRenderGeometryRenderer as Z}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{applyTextureResizeModulo as J}from"../webgl-engine/lib/textureUtils.js";import{removeLoadedShaderModules as Q}from"../webgl-engine/parts/requireUtils.js";import{TaskPriority as $,noBudget as ee,Task as te}from"../../support/Scheduler.js";const re=1.3,se=[[-.1,-2,3.9,2],[-.1,-3.9,3.9,.1],[-2,-3.9,2,.1],[-3.9,-3.9,.1,.1],[-3.9,-2,.1,2],[-3.9,-.1,.1,3.9],[-2,-.1,2,3.9],[-.1,-.1,3.9,3.9]];let ie,ae=class extends t{get running(){return this._placementDirty&&(this._drapeSources.size>0||this.view.graphics.length>0||k.OVERLAY_DRAW_DEBUG_TEXTURE)&&!!this._spatialReference&&!this.suspended&&this.surface.ready}get _isSpherical(){return this.view.state.isGlobal}get _worldToPCSRatio(){return null!=this._spatialReference&&this._spatialReference.isGeographic&&!this.view.state.isLocal?T(this._spatialReference).metersPerDegree:1}get _overlayStretch(){return re/this.view.resolutionScale}get suspended(){return this.surface.suspended}get updating(){return this.running||this.renderer.updating||this._contentUpdated}get rendersOccludedDraped(){return this.renderer.rendersOccludedDraped}constructor(e){super(e),this._spatialReference=null,this._renderSR=null,this._overlaySREqualsRenderSR=!0,this._drapeSources=new Set,this._drapeTargets=new Set,this._placementDirty=!1,this._contentUpdated=!1,this._drawTexturesDirty=!1,this._drawTexturesAnimateDirty=!1,this._longitudeCyclical=null,this._latestOriginId=0,this._maxResolution=has("esri-mobile")?2048:4096,this._animationTimeLast=0}initialize(){const e=this.view;this.renderer=new W({view:e,worldToPCSRatio:this._worldToPCSRatio,spatialReference:this._spatialReference}),e._stage.renderer.plugins.add(this.renderer);const t=()=>this.setDrawTexturesDirty();this._groundIntersector=z(this.view.state.viewingMode),this._groundIntersector.options.backfacesTerrain=!0,this._groundIntersector.options.invisibleTerrain=!0,this._groundIntersector.options.hud=!1,this.addHandles([n((()=>this.renderer.hasHighlights),t),this.renderer.events.on("has-water",(t=>e._stage?.renderer.setParameters({hasOverlayWater:t}))),this.renderer.events.on("content-changed",t),n((()=>e.state.camera.pixelRatio),t),n((()=>e.state.alignPixelEnabled),t),this.renderer.events.on("textures-disposed",(()=>this.surface.requestRender())),n((()=>[e.pointsOfInterest?.renderPointOfView,e.pointsOfInterest?.centerOnSurfaceFrequent?.location]),(()=>this.setPlacementDirty())),n((()=>[e.state?.pixelRatio,e.state?.contentPixelRatio]),(()=>this.setPlacementDirty()),o),this.surface.on("elevation-change",(()=>this.setPlacementDirty())),e.on("resize",(()=>this.setPlacementDirty())),e.resourceController.scheduler.registerTask($.OVERLAY,this),e._stage.renderView.events.on("force-camera-for-screenshot",(e=>{this._updateOverlays(ee,e.camera,Y.BACKGROUND),this.renderer.hasOverlays&&this._drawOverlays(Y.BACKGROUND,e)}))]),e._stage.renderer.renderOverlay=e=>this._renderOverlay(e)}_renderOverlay(e){if(this._contentUpdated=!1,this.renderer.processSyncDrapeSources(),this.renderer.hasOverlays)return this._dispatchAnimationUpdate(e),this._drawOverlays(Y.UPDATE,this.view.state)}destroy(){this.view?._stage&&(this.view._stage.renderer.plugins.remove(this.renderer),this.view._stage.renderer.renderOverlay=()=>{}),ie&&(ie.hide(),ie=null)}get hasOverlays(){return this.renderer.hasOverlays}setSpatialReference(e){this._spatialReference=e,this.renderer.spatialReference=e,this._longitudeCyclical=null;const t=this.view.renderSpatialReference;null!=e&&null!=t?(this._renderSR=t,this._overlaySREqualsRenderSR=e.equals(this._renderSR),this._isSpherical&&(this._longitudeCyclical=e.isWebMercator?new r(-20037508.342787,20037508.342787):new r(-180,180),this.renderer.longitudeCyclical=this._longitudeCyclical),this.renderer&&(this.renderer.worldToPCSRatio=this._worldToPCSRatio)):this.renderer.disposeOverlays()}registerDrapeSource(e,t,r){this._drapeSources.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources);const s=this.renderer.createDrapeSourceRenderer(e,t,r);return this._updateDrapeSourceExtent(e),this._setContentDirty(),this.notifyChange("running"),s}registerGeometryDrapeSource(e){return this.registerDrapeSource(e,Z)}_updateDrapeSourceExtent(e){2===this.renderer.overlays.length&&null!=e.setDrapingExtent&&null!=this._spatialReference&&e.setDrapingExtent(this.renderer.overlays,this._spatialReference)}unregisterDrapeSource(e){this._drapeSources.has(e)&&(this._drapeSources.delete(e),this.renderer.removeDrapeSourceRenderer(e),this.renderer.ensureDrapeSources(this._drapeSources),this._setContentDirty(),this.notifyChange("running"))}registerDrapeTarget(e){this._drapeTargets.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources)}unregisterDrapeTarget(e){this._drapeTargets.delete(e),this.renderer.ensureDrapeTargets(this._drapeTargets)}_setContentDirty(){this.setPlacementDirty(),this.setDrawTexturesDirty()}setPlacementDirty(){this._placementDirty=!0}runTask(e){return this._updateOverlays(e,this.view.state.contentCamera,Y.UPDATE)}_updateOverlays(e,t,r){if(!this._spatialReference)return te.YIELD;const s=this._computeOverlayResolution(t);this._computeOverlayExtents(t,s,ce),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources,ce.stretch);const i=this._updateOverlay(H.INNER,ce.inner,s,1*ce.pixelRatioAdjustment,ce.mapUnitsPerPixel),a=S(ce.inner)/S(ce.outer),n=this._updateOverlay(H.OUTER,ce.outer,s,a*ce.pixelRatioAdjustment,ce.mapUnitsPerPixel);i!==_e.EXTENT&&n!==_e.EXTENT||(this._drapeSources.forEach((e=>this._updateDrapeSourceExtent(e))),this.surface.updateTileOverlayParams(r)),i===_e.NONE&&n===_e.NONE||this.setDrawTexturesDirty(),this._placementDirty=!1,e.madeProgress()}_computeOverlayResolution(e){const t=this.view.state.contentPixelRatio*this.view.resolutionScale,r=e.fullWidth/e.pixelRatio*t,s=e.fullHeight/e.pixelRatio*t,i=Math.ceil(1.5*Math.max(r,s));return Math.min(J(i),this._maxResolution)}_updateOverlay(e,t,r,s,i){if(0===this.renderer.overlays.length)return _e.NONE;const a=this.renderer.overlays[e],n=a.mapUnitsPerPixel;if(a.mapUnitsPerPixel=i,a.pixelRatio=s,ne(t,a.extent)&&r===a.resolution)return n===i?_e.NONE:_e.RERENDER_ONLY;E(a.extent,t),a.resolution=r;const o=P(a.extent);return a.renderLocalOrigin=X(o[0],o[1],0,"OV_"+this._latestOriginId++),_e.EXTENT}setTileParameters(e){const t=e.renderData.overlay;if(this.renderer.overlays.length>0){const r=this.renderer.overlays[H.INNER],s=this.renderer.overlays[H.OUTER],i=e.extent;this._rectInsideRect(r.extent,i)||this._rectanglesOverlap(i,r.extent)||this._rectanglesOverlap(i,s.extent)?(this._setTileOverlayData(i,H.INNER,t),this._setTileOverlayData(i,H.OUTER,t)):(this._clearTileOverlayData(H.INNER,t),this._clearTileOverlayData(H.OUTER,t))}else this._clearTileOverlayData(H.INNER,t),this._clearTileOverlayData(H.OUTER,t)}overlayPixelSizeInMapUnits(e,t){if(0===this.renderer.overlays.length)return t();const r=this.renderer.overlays[H.INNER],s=this.renderer.overlays[H.OUTER],i=this._pointIsInExtent(e,r.extent)?r:s;return(i.extent[2]-i.extent[0])/i.resolution}_setTileOverlayData(e,t,r){if(0===this.renderer.overlays.length)return;const s=this.renderer.overlays[t].extent,i=S(s),a=M(s);let n=e[0];if(this._longitudeCyclical){n=this._longitudeCyclical.minimalMonotonic(s[0],n);const t=this._longitudeCyclical.minimalMonotonic(s[0],e[2]);n>t&&(n=t-(e[2]-e[0]))}r.setScale(t,S(e)/i,M(e)/a),r.setOffset(t,(n-s[0])/i,(e[1]-s[1])/a)}_clearTileOverlayData(e,t){t.setScale(e,-1,-1),t.setOffset(e,-1,-1)}async reloadShaders(){Q(),await this.renderer.reloadShaders(),this.setDrawTexturesDirty(),this.runTask(ee)}_dispatchAnimationUpdate(e){const t=l(e-this._animationTimeLast);if(t>=this.surface.view._stage.renderer.animationTimestep||null!=this.view.state.forcedAnimationTime||this._drawTexturesDirty||this._drawTexturesAnimateDirty){const r=l(t/this.surface.view._stage.renderer.animationTimeDilation),s=new K(this.view.state.camera,r,this.view.state.forcedAnimationTime);this.renderer.updateAnimation(s)&&(this._drawTexturesAnimateDirty=!0),this._animationTimeLast=e}}setDrawTexturesDirty(){this.renderer.hasOverlays?(this._contentUpdated=!0,this._drawTexturesDirty=!0,this.view._stage.renderView.requestRender()):this.setPlacementDirty()}_intersectGroundFromView(e,t,r,s){const i=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(e,pe,t,r);if(null==i)return!1;const a=i.origin,n=u(he,i.origin,i.direction);return this._groundIntersector.reset(a,n,e),this._groundIntersector.intersect([]),this.view.basemapTerrain.intersect(this._groundIntersector,null,a,n),this._groundIntersector.results.min.getIntersectionPoint(s)}_findHorizonBasedPointOfInterest(e,t){let r=.5;const a=.55,n=this.view.renderCoordsHelper.getAltitude(e.eye),o=this.view.pointsOfInterest.centerOnSurfaceFrequent,l=1e-5,h=i(o.estimatedSurfaceAltitude,e.aboveGround?-1/0:n+l,e.aboveGround?n-l:1/0),c=e.aboveGround;if("global"===this.view.viewingMode){const t=he;A(L(G,T(this.view.spatialReference).radius+h),N(e.eye,e.viewForward),t),p(t,t,e.eye);const i=s.normalize(V(e.viewForward,t,e.viewRight))/e.fovY+.5,n=i<=0||i>=1?.5:a;r=c?n*i:i+n*(1-i)}else{const t=.5*Math.PI-Math.acos(-e.viewForward[2]),s=Math.tan(t),n=O(0,s,1,0),o=f(n,n,e.projectionMatrix)[1],l=i(.5+.5*o,0,1);r=1===l||0===l?.5:c?l*a:1-(1-l)*a}return!!this._intersectGroundFromView(e,.5,r,t)&&_(t,e.eye)<o.distance*o.distance}_computeOverlayExtents(e,t,r){const s=this.view.pointsOfInterest.centerOnSurfaceFrequent.renderLocation,i=g();this._findHorizonBasedPointOfInterest(e,i)||m(i,s),k.OVERLAY_SHOW_CENTER?(null==ie&&(ie=new B(this.view.graphics,"red")),ie.show(i,this._renderSR)):null!=ie&&ie.hide();const n=Math.max(.1,y(e.eye,i)),o=F(this.view.renderCoordsHelper,s,e.eye);this._overlaySREqualsRenderSR||x(i,this._renderSR,i,this._spatialReference);const l=this.surface.extent,h=!this._isSpherical&&this._spatialReference&&this._spatialReference.isGeographic,c=h&&this._spatialReference?1/T(this._spatialReference).metersPerDegree:1,u=this.view.state.contentPixelRatio,p=e.perScreenPixelRatio/u*n*c;r.mapUnitsPerPixel=p/this._worldToPCSRatio,r.stretch=this._overlayStretch;let _=t*p/2*r.stretch,f=!1,w=h?90:1/0;this._isSpherical&&l&&this._spatialReference&&(this._spatialReference.isWebMercator?(_/=Math.cos(q(i[1])),w=l[3]):(f=!0,_/=T(this._spatialReference).metersPerDegree,w=90),_>=w&&(_=w,i[1]=0,this._spatialReference.isWebMercator&&(i[0]=0)));let O=1;f&&(O=1/Math.max(.2,Math.cos(Math.abs(a(i[1])))),_*O>180&&(O=180/_),r.mapUnitsPerPixel*=O);const D=Math.log(2)/12;_=Math.exp(Math.round(Math.log(_)/D)*D);const P=_*O,M=32,j=.5*t/(M*P),C=.5*t/(M*_);i[0]=Math.round(i[0]*j)/j,i[1]=Math.round(i[1]*C)/C;const U=r.inner;U[0]=i[0]-P,U[1]=i[1]-_,U[2]=i[0]+P,U[3]=i[1]+_,this._isSpherical&&this._shiftExtentToFitBounds(U,1/0,w);const N=r.outer;if(6*P>S(l))E(N,l);else{if(Math.PI/2-Math.abs(o-Math.PI/2)<=.25*Math.PI)N[0]=U[0]-P,N[1]=U[1]-_,N[2]=U[2]+P,N[3]=U[3]+_;else{x(e.eye,this._renderSR,he,this._spatialReference),d(le,i,he);let t=-Math.atan2(le[1],le[0])+.125*Math.PI;t<0&&(t+=2*Math.PI);const r=Math.floor(t/(.25*Math.PI));v(le,se[r],2*_),le[0]*=O,le[2]*=O,R(N,U,le)}}if(this._isSpherical)N[0]=this._longitudeCyclical.clamp(N[0]),N[2]=this._longitudeCyclical.clamp(N[2]),N[1]=Math.max(N[1],-w),N[3]=Math.min(N[3],w);else{const e=b(U,l,de),t=b(N,l,ue);I(e,t)&&(N[2]=N[0],N[3]=N[1])}const A=Math.abs(U[2]-U[0])/t;r.mapUnitsPerPixel=Math.max(r.mapUnitsPerPixel,A),r.pixelRatioAdjustment=r.mapUnitsPerPixel/A}_drawOverlays(e,t){if(!this.renderer.hasOverlays)return;if(!this._drawTexturesDirty&&!this._drawTexturesAnimateDirty)return this.renderer;const r=this._drawTexturesDirty;this._drawTexturesDirty=this._drawTexturesAnimateDirty=!1;const s=this.renderer.computeValidity();this.renderer.releaseRenderTargets(),this.renderer.drawOverlays(t);return s!==this.renderer.computeValidity()&&this.surface.updateTileOverlayParams(Y.UPDATE),r?(this.surface.requestRender(e),e===Y.UPDATE&&this.surface.requestUpdate()):this.surface.requestRender(Y.BACKGROUND),this.renderer}_rectanglesOverlap(e,t){return null!=e&&(this._longitudeCyclical?(this._longitudeCyclical.contains(t[0],t[2],e[0])||this._longitudeCyclical.contains(t[0],t[2],e[2])||this._longitudeCyclical.contains(e[0],e[2],t[0]))&&!(e[1]>t[3]||e[3]<t[1]):j(e,t))}_rectInsideRect(e,t){return null!=t&&(this._longitudeCyclical?this._longitudeCyclical.contains(e[0],e[2],t[0])&&this._longitudeCyclical.contains(e[0],e[2],t[2])&&t[1]>e[1]&&t[3]<e[3]:I(e,t))}_pointIsInExtent(e,t){if(this._longitudeCyclical)return this._longitudeCyclical.contains(t[0],t[2],e.x)&&e.y>=t[1]&&e.y<=t[3];const r=e.x,s=e.y;return r>t[0]&&r<t[2]&&s>t[1]&&s<t[3]}_shiftExtentToFitBounds(e,t,r){let s=0,i=0;e[0]<-t?s=e[0]+t:e[2]>t&&(s=t-e[2]),e[1]<-r?i=e[1]+r:e[3]>r&&(i=r-e[3]),C(e,s,i)}get test(){return{renderer:this.renderer,update:()=>this.runTask(ee)}}};function ne(e,t){const r=1e-5,s=k.TESTS_DISABLE_OPTIMIZATIONS?0:r*Math.max(e[2]-e[0],e[3]-e[1],t[2]-t[0],t[3]-t[1]);return Math.abs(t[0]-e[0])<=s&&Math.abs(t[1]-e[1])<=s&&Math.abs(t[2]-e[2])<=s&&Math.abs(t[3]-e[3])<=s}e([h()],ae.prototype,"_spatialReference",void 0),e([h({readOnly:!0})],ae.prototype,"running",null),e([h()],ae.prototype,"_placementDirty",void 0),e([h()],ae.prototype,"_contentUpdated",void 0),e([h()],ae.prototype,"_isSpherical",null),e([h()],ae.prototype,"_worldToPCSRatio",null),e([h({autoDestroy:!0})],ae.prototype,"renderer",void 0),e([h({constructOnly:!0})],ae.prototype,"view",void 0),e([h({constructOnly:!0})],ae.prototype,"surface",void 0),e([h()],ae.prototype,"suspended",null),e([h()],ae.prototype,"updating",null),e([h({type:Boolean})],ae.prototype,"rendersOccludedDraped",null),ae=e([c("esri.views.3d.terrain.OverlayManager")],ae);class oe{constructor(){this.inner=D(),this.outer=D(),this.mapUnitsPerPixel=0,this.pixelRatioAdjustment=1,this.stretch=re}}const le=w(),he=g(),ce=new oe,de=D(),ue=D(),pe=U();var _e;!function(e){e[e.NONE=0]="NONE",e[e.EXTENT=1]="EXTENT",e[e.RERENDER_ONLY=2]="RERENDER_ONLY"}(_e||(_e={}));export{ae as OverlayManager};