@arcgis/core 6.0.0-next.15 → 6.0.0-next.16

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 (337) hide show
  1. package/analysis/LineOfSightAnalysis.d.ts +49 -32
  2. package/analysis/LineOfSightAnalysisObserver.d.ts +19 -3
  3. package/analysis/LineOfSightAnalysisTarget.d.ts +19 -3
  4. package/analysis/Viewshed.d.ts +23 -3
  5. package/analysis/ViewshedAnalysis.d.ts +33 -13
  6. package/arcade/geometry/operatorsWorkerConnection.js +1 -1
  7. package/assets/esri/core/workers/RemoteClient.js +1 -1
  8. package/assets/esri/core/workers/chunks/00d66e3fba5ab4d2aa3c.js +1 -0
  9. package/assets/esri/core/workers/chunks/{d994bcf0a65d1c07160f.js → 0320cbd825f9a4222042.js} +1 -1
  10. package/assets/esri/core/workers/chunks/14d5d219e7fe017f23f0.js +1 -0
  11. package/assets/esri/core/workers/chunks/164e74d586297946a717.js +1 -0
  12. package/assets/esri/core/workers/chunks/{1bca39e0e651426bdbb5.js → 1b1d3f6916d2cb751435.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{ed6e9d7f71bfd2691717.js → 1c77de1e79860f8d2228.js} +1 -1
  14. package/assets/esri/core/workers/chunks/1e40a26dcce4d1dadc28.js +1 -0
  15. package/assets/esri/core/workers/chunks/237a1f68a0efbfe5b77c.js +1 -0
  16. package/assets/esri/core/workers/chunks/23c43f09c4a4749516e1.js +1 -0
  17. package/assets/esri/core/workers/chunks/{3418877328f4f0830300.js → 24dac4970526a4e0ae63.js} +1 -1
  18. package/assets/esri/core/workers/chunks/26ceb0ff8d93dbb9b84f.js +1 -0
  19. package/assets/esri/core/workers/chunks/2acf2952cef69e382a35.js +1 -0
  20. package/assets/esri/core/workers/chunks/{481589c3eddad6e026ad.js → 369780276b2755361f7d.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{4df6cb1bee5d0720a43e.js → 36cbd614454581aaf334.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{1e0d2715d603f48a7e0b.js → 370aad23df597db80d65.js} +1 -1
  23. package/assets/esri/core/workers/chunks/3baa4a9c52f41bfd6abb.js +1 -0
  24. package/assets/esri/core/workers/chunks/42d44c7d532df5ee70e9.js +1 -0
  25. package/assets/esri/core/workers/chunks/42e985a576d7aaeed0cf.js +1 -0
  26. package/assets/esri/core/workers/chunks/{6400446b7615b97c3521.js → 45f826554499c38968c6.js} +1 -1
  27. package/assets/esri/core/workers/chunks/48cc58890fddbcf69cef.js +1 -0
  28. package/assets/esri/core/workers/chunks/494bd434fee9032e1d02.js +1 -0
  29. package/assets/esri/core/workers/chunks/{33e4ff228a8c81b99022.js → 4abd3753cd9b80e4d937.js} +1 -1
  30. package/assets/esri/core/workers/chunks/4bbe1f28f5f16a6bef05.js +1 -0
  31. package/assets/esri/core/workers/chunks/4c389472b8cdb0c55154.js +1 -0
  32. package/assets/esri/core/workers/chunks/4e4f747de424941a0bfa.js +1 -0
  33. package/assets/esri/core/workers/chunks/5529831dd891382c79df.js +1 -0
  34. package/assets/esri/core/workers/chunks/576248e9ae2654569420.js +1 -0
  35. package/assets/esri/core/workers/chunks/5acb422fe3cf693d9d4f.js +1 -0
  36. package/assets/esri/core/workers/chunks/{aeaaff7a4b1a99540f52.js → 5cb26bbaa08114aec5ce.js} +1 -1
  37. package/assets/esri/core/workers/chunks/661c6324529dd17b297e.js +1 -0
  38. package/assets/esri/core/workers/chunks/68dd1fd2025c7125ead1.js +1 -0
  39. package/assets/esri/core/workers/chunks/{89e76de5ae3328d821a4.js → 69f6d5997b8ff1326e39.js} +1 -1
  40. package/assets/esri/core/workers/chunks/6a8dd8b18b0b825b0c1b.js +1 -0
  41. package/assets/esri/core/workers/chunks/{a40b6d8b5c73e06e14d4.js → 6c255c029d67423e4dac.js} +1 -1
  42. package/assets/esri/core/workers/chunks/7446d0dfebf93e86c098.js +1 -0
  43. package/assets/esri/core/workers/chunks/{688f2dbf784e66082308.js → 74c866e0b66e61751861.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{3ffda5bf0b91700dc308.js → 78643f116677950ea29a.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{916b363c342b61ba5461.js → 787c1a8bda7d745633f2.js} +1 -1
  46. package/assets/esri/core/workers/chunks/7b5f3c79e0605c32b267.js +1 -0
  47. package/assets/esri/core/workers/chunks/7bbfe9ff352afc566367.js +1 -0
  48. package/assets/esri/core/workers/chunks/{ac5a6603f7fa78d3e4c8.js → 7e8611cb709f105946f5.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{05cd33d41d91f8d09633.js → 7fb7493f483cd9878bfa.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{acfa03c65ba3ca6c5685.js → 8715661a838361d4211a.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{601e1d020b8115497944.js → 8a485130781b49dbf608.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{0ccab50877b24f862d6e.js → 8ac2098ecdc40ad41055.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{a655ebdb4bf0660615a2.js → 8b4e9fd88c0c313416d4.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{4e544de61f07ca660236.js → 8c12269d26f5a4c753cb.js} +1 -1
  55. package/assets/esri/core/workers/chunks/91dd65cf877c8f2e01a7.js +1 -0
  56. package/assets/esri/core/workers/chunks/{46b4fb6a7fe4877b0efc.js → 94baa354e50c03b82b25.js} +2 -2
  57. package/assets/esri/core/workers/chunks/950d4578dc450467404c.js +1 -0
  58. package/assets/esri/core/workers/chunks/{68be3fb88ca61f82fb90.js → 95dbbddac6581b9d671f.js} +1 -1
  59. package/assets/esri/core/workers/chunks/98be2f621801e230aa01.js +1 -0
  60. package/assets/esri/core/workers/chunks/9b051745d24d1f43480b.js +1 -0
  61. package/assets/esri/core/workers/chunks/9d61740ef8bdcc162be1.js +1 -0
  62. package/assets/esri/core/workers/chunks/{eb04e1717a1002cda3ab.js → 9f06ec95bdf0d0b52b41.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{fafb92ca2c5e4b0b2c23.js → a09d2e1e2540921e4717.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{3b3e519f15ed52c83f0c.js → a49fe94933b65b4b64f8.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{1819c45655c836b9a8d7.js → a4d3944700f1cc240176.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{90bdf86f553e2742d67c.js → a7bd5ba4d7d97411fd33.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{900181f68449d8f82eeb.js → aa1ac7954e4f0fefe15b.js} +1 -1
  68. package/assets/esri/core/workers/chunks/ac24b4370dc7194a3107.js +1 -0
  69. package/assets/esri/core/workers/chunks/{b8337492e2b753aefac4.js → ace41659a5ca0e5abfc3.js} +1 -1
  70. package/assets/esri/core/workers/chunks/{3c0ed15b544df6fb0903.js → b48952e1fb4cb7360dd0.js} +1 -1
  71. package/assets/esri/core/workers/chunks/b5e7475cc5fbf31289d3.js +1 -0
  72. package/assets/esri/core/workers/chunks/{f3da30d7300b92bd8bb0.js → befa32b9e7b3fbdd431e.js} +1 -1
  73. package/assets/esri/core/workers/chunks/{0f617980c7dd9ad0444f.js → bf35927979fc5e7e0478.js} +1 -1
  74. package/assets/esri/core/workers/chunks/c4ddac23bd649d24f3f2.js +1 -0
  75. package/assets/esri/core/workers/chunks/{4e6f40cbdb8c508e6df1.js → c5a9e77977e867a75ff2.js} +1 -1
  76. package/assets/esri/core/workers/chunks/{25f19fc929f25ddd628c.js → c79934cd6883307203f8.js} +1 -1
  77. package/assets/esri/core/workers/chunks/cddc3e285f763ccf33c2.js +1 -0
  78. package/assets/esri/core/workers/chunks/d08ff41e2a9bcd58b64a.js +1 -0
  79. package/assets/esri/core/workers/chunks/d311ff96a5a2791d8cfc.js +1 -0
  80. package/assets/esri/core/workers/chunks/d62afb71f4ece4283994.js +1 -0
  81. package/assets/esri/core/workers/chunks/dc1761cba0454fda3cf9.js +1 -0
  82. package/assets/esri/core/workers/chunks/{4ac1d3e49e242e373a92.js → e0650b1408197d3ac862.js} +1 -1
  83. package/assets/esri/core/workers/chunks/{3ff6d1ed3c0f1285f3e7.js → e0d9dc97985561320bd4.js} +1 -1
  84. package/assets/esri/core/workers/chunks/eaddffcc7004101fc230.js +1 -0
  85. package/assets/esri/core/workers/chunks/eb2652ec48faa78de3c5.js +1 -0
  86. package/assets/esri/core/workers/chunks/eca44e53bcee9b08d70a.js +1 -0
  87. package/assets/esri/core/workers/chunks/f00458654c7c34c369ef.js +1 -0
  88. package/assets/esri/core/workers/chunks/f3cd610084e3f4d8656b.js +1 -0
  89. package/assets/esri/core/workers/chunks/f47fe4433b05fca5c3ad.js +1 -0
  90. package/assets/esri/core/workers/chunks/f7bfa3d33b05b250ce33.js +1 -0
  91. package/assets/esri/core/workers/chunks/f91bc1cb1014e05be763.js +1 -0
  92. package/assets/esri/core/workers/chunks/{ae31fd416bbb41a81392.js → f9c5aa0bbf23e780fecc.js} +1 -1
  93. package/assets/esri/core/workers/chunks/f9ff27cfcf0538ac5e26.js +1 -0
  94. package/assets/esri/core/workers/chunks/{19676b2c5f8b0a5ee680.js → facd1ff23203fed67686.js} +1 -1
  95. package/assets/esri/core/workers/chunks/{40a584cb952e94326e9e.js → fcb86d24fc7e0666b564.js} +1 -1
  96. package/chunks/Distance2DCalculator-DjIp2uQi.js +1 -1
  97. package/chunks/Envelope.js +1 -1
  98. package/chunks/MultiPathImpl.js +1 -1
  99. package/chunks/OperatorGeodeticArea.js +1 -1
  100. package/chunks/OperatorShapePreservingLength.js +1 -1
  101. package/chunks/OperatorShapePreservingProject.js +1 -1
  102. package/chunks/UnitFactory.js +1 -1
  103. package/chunks/basis_encoder.js +1 -1
  104. package/chunks/basis_transcoder.js +1 -1
  105. package/chunks/index.js +1 -1
  106. package/chunks/lclayout.js +1 -1
  107. package/config.d.ts +2 -0
  108. package/config.js +1 -1
  109. package/core/accessorSupport/DefaultsStore.js +1 -1
  110. package/core/accessorSupport/MultiOriginStore.js +1 -1
  111. package/core/accessorSupport/Store.js +1 -1
  112. package/core/accessorSupport/decorators/reader.js +1 -1
  113. package/core/accessorSupport/decorators/writer.js +1 -1
  114. package/core/workers/WorkerOwner.js +1 -1
  115. package/core/workers/workerFactory.js +1 -1
  116. package/core/workers/workers.js +2 -2
  117. package/core/workers.d.ts +9 -0
  118. package/form/elements/inputs/DynamicChoiceInput.d.ts +4 -2
  119. package/geometry/Mesh.js +1 -1
  120. package/geometry/operators/gx/operatorAlphaShape.js +1 -1
  121. package/geometry/operators/gx/operatorOffset.js +1 -1
  122. package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
  123. package/geometry/operators/support/jsonConverter.js +1 -1
  124. package/geometry/support/curves/bezierCurveUtils.js +1 -1
  125. package/geometry/support/curves/ellipticArc7Utils.js +1 -1
  126. package/geometry/support/meshUtils/merge.js +1 -1
  127. package/geometry/support/meshUtils/rotate.js +1 -1
  128. package/geometry/support/polygonExtentClipping.js +1 -1
  129. package/identity/Credential.js +1 -1
  130. package/kernel.js +1 -1
  131. package/layers/AnnotationFeatureLayer.d.ts +2 -2
  132. package/layers/AnnotationFeatureLayer.js +1 -1
  133. package/layers/CatalogLayer.d.ts +2 -2
  134. package/layers/CatalogLayer.js +1 -1
  135. package/layers/DimensionFeatureLayer.d.ts +2 -2
  136. package/layers/DimensionFeatureLayer.js +1 -1
  137. package/layers/FeatureLayer.d.ts +4 -4
  138. package/layers/FeatureLayer.js +1 -1
  139. package/layers/ImageryTileLayer.js +1 -1
  140. package/layers/LineOfSightLayer.d.ts +10 -8
  141. package/layers/SceneLayer.js +1 -1
  142. package/layers/SubtypeGroupLayer.d.ts +2 -2
  143. package/layers/SubtypeGroupLayer.js +1 -1
  144. package/layers/ViewshedLayer.d.ts +1 -1
  145. package/layers/VoxelLayer.js +1 -1
  146. package/layers/WMSLayer.js +1 -1
  147. package/layers/geospatialPDF/GeospatialPDFFrame.js +1 -1
  148. package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +9 -9
  149. package/layers/geospatialPDF/GeospatialPDFWorkerClient.js +1 -1
  150. package/layers/geospatialPDF/LGIDictMapFrame.js +1 -1
  151. package/layers/geospatialPDF/ViewportMeasureFrame.js +1 -1
  152. package/layers/geospatialPDF/geospatialPDFParserUtils.js +1 -1
  153. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  154. package/layers/graphics/data/QueryEngineResult.js +1 -1
  155. package/layers/graphics/sources/connections/WebSocketConnection.js +1 -1
  156. package/layers/graphics/sources/parquet/FileProvider.js +1 -1
  157. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  158. package/layers/mixins/{FeatureLayerReload.d.ts → ReloadableLayer.d.ts} +5 -3
  159. package/layers/mixins/ReloadableLayer.js +2 -0
  160. package/layers/raster/datasets/BaseRaster.js +1 -1
  161. package/layers/raster/datasets/GeospatialPDFRaster.js +1 -1
  162. package/layers/raster/datasets/ImageAuxRaster.js +2 -2
  163. package/layers/raster/datasets/ImageServerRaster.js +1 -1
  164. package/layers/raster/datasets/InMemoryRaster.js +1 -1
  165. package/layers/raster/datasets/MRFRaster.js +1 -1
  166. package/layers/raster/datasets/TIFFRaster.js +1 -1
  167. package/layers/raster/datasets/WCSRaster.js +1 -1
  168. package/layers/raster/formats/ImageCanvasDecoder.js +1 -1
  169. package/layers/raster/formats/RasterCodec.js +1 -1
  170. package/layers/raster/formats/TiffDecoder.js +1 -1
  171. package/layers/raster/formats/Zlib.js +1 -1
  172. package/layers/raster/functions/stretchUtils.js +1 -1
  173. package/layers/raster/functions/vectorFieldUtils.js +1 -1
  174. package/layers/support/FieldsIndex.js +1 -1
  175. package/layers/support/RasterWorker.js +1 -1
  176. package/layers/support/featureReductionProperties.js +1 -1
  177. package/layers/support/kmlUtils.js +1 -1
  178. package/layers/video/VideoController.js +10 -10
  179. package/libs/maquette/projection.js +1 -1
  180. package/networks/UtilityNetworkTraceAnalysis.js +1 -1
  181. package/package.json +5 -5
  182. package/popup/FeatureModel.js +1 -1
  183. package/popup/FeaturesModel.js +1 -1
  184. package/portal/Portal.js +1 -1
  185. package/request/process.js +1 -1
  186. package/request/types.d.ts +7 -0
  187. package/rest/knowledgeGraphService.js +1 -1
  188. package/rest/networks/trace.js +1 -1
  189. package/rest/query/executeQuery.js +1 -1
  190. package/smartMapping/raster/renderers/shadedRelief.js +1 -1
  191. package/smartMapping/renderers/univariateColorSize.js +1 -1
  192. package/smartMapping/statistics/support/statsWorker.js +1 -1
  193. package/smartMapping/statistics/support/utils.js +1 -1
  194. package/smartMapping/support/clusterUtils.js +1 -1
  195. package/statistics/utils.js +1 -1
  196. package/symbols/cim/CIMCursor.js +1 -1
  197. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  198. package/symbols/cim/cimAnalyzer.js +1 -1
  199. package/symbols/support/ElevationInfo.d.ts +4 -3
  200. package/undoredo/support/Services.js +1 -1
  201. package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +2 -2
  202. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  203. package/views/2d/grid/GridView2D.js +1 -1
  204. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  205. package/views/2d/layers/features/sources/strategies/FeatureHybridTileLoadStrategy.js +1 -1
  206. package/views/2d/layers/features/sources/strategies/FeaturePagedTileLoadStrategy.js +1 -1
  207. package/views/2d/layers/features/sources/strategies/FeatureSnapshotLoadStrategy.js +1 -1
  208. package/views/2d/viewpointUtils.js +1 -1
  209. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  210. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  211. package/views/3d/analysis/LineOfSight/types.d.ts +14 -3
  212. package/views/3d/analysis/LineOfSightAnalysisView3D.d.ts +39 -13
  213. package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
  214. package/views/3d/analysis/Viewshed/types.d.ts +7 -0
  215. package/views/3d/analysis/ViewshedAnalysisView3D.d.ts +43 -15
  216. package/views/3d/input/handlers/KeyboardNavigation.js +1 -1
  217. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  218. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  219. package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
  220. package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
  221. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  222. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  223. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  224. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  225. package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
  226. package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
  227. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  228. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  229. package/views/3d/layers/graphics/SpatialIndex2D.js +1 -1
  230. package/views/3d/layers/i3s/I3SNode.js +1 -1
  231. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  232. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  233. package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
  234. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  235. package/views/3d/layers/support/FeatureTileFetcher3DDebugger.js +1 -1
  236. package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
  237. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  238. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  239. package/views/3d/support/elevationUpdateExtentUtils.js +1 -1
  240. package/views/3d/support/elevationUpdateUtils.js +1 -1
  241. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  242. package/views/3d/support/sphereExtentUtils.js +2 -0
  243. package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
  244. package/views/3d/terrain/OverlayRenderer.js +1 -1
  245. package/views/3d/terrain/PatchRenderData.js +1 -1
  246. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  247. package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
  248. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  249. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  250. package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
  251. package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
  252. package/views/SceneView.js +1 -1
  253. package/views/ToolViewManager.js +1 -1
  254. package/views/draw/DrawOperation.js +1 -1
  255. package/views/draw/support/InteractiveHandle.js +1 -1
  256. package/views/draw/support/Reshape.js +1 -1
  257. package/views/draw/support/createUtils.js +1 -1
  258. package/views/draw/support/editingSessionUtils.js +1 -1
  259. package/views/draw/support/managers/InteractiveHandleManager.js +1 -1
  260. package/views/interactive/SegmentLabels.js +1 -1
  261. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  262. package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
  263. package/views/interactive/editGeometry/operations/SetAllVertexPositions.js +1 -1
  264. package/views/interactive/editGeometry/operations/UndoGroup.js +1 -1
  265. package/views/interactive/options/TooltipOptions.d.ts +2 -0
  266. package/views/interactive/sketch/SketchTooltipOptions.d.ts +2 -0
  267. package/views/interactive/sketch/constraintUtils.js +1 -1
  268. package/views/interactive/snapping/SnappingDragPipelineStep.js +1 -1
  269. package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
  270. package/views/layers/LayerView.js +1 -1
  271. package/views/layers/LineOfSightLayerView.d.ts +35 -13
  272. package/views/layers/SketchLayerView.d.ts +1 -0
  273. package/views/layers/ViewshedLayerView.d.ts +36 -12
  274. package/views/webgl/Program.js +1 -1
  275. package/views/webgl/Texture.js +1 -1
  276. package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
  277. package/widgets/Directions.js +1 -1
  278. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  279. package/widgets/Editor/legacy/CreateFeaturesWorkflow.js +1 -1
  280. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  281. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  282. package/widgets/FeatureTable/support/GroupColumnTemplate.js +1 -1
  283. package/widgets/FeatureTable/support/TableTemplate.js +1 -1
  284. package/widgets/Print.js +1 -1
  285. package/widgets/Slice.js +1 -1
  286. package/widgets/UtilityNetworkTraceAnalysis/UtilityNetworkTraceAnalysisViewModel.js +1 -1
  287. package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
  288. package/widgets/support/SelectionList.js +1 -1
  289. package/widgets/support/componentsUtils.js +1 -1
  290. package/assets/esri/core/workers/chunks/024b44c0c8876627f904.js +0 -1
  291. package/assets/esri/core/workers/chunks/02c5d027bdaee67869cf.js +0 -1
  292. package/assets/esri/core/workers/chunks/03261b9451e293a0fac8.js +0 -1
  293. package/assets/esri/core/workers/chunks/0c8c01097847617261b9.js +0 -1
  294. package/assets/esri/core/workers/chunks/0d931c7579b6409a696d.js +0 -1
  295. package/assets/esri/core/workers/chunks/12c154342fff876f2f1e.js +0 -1
  296. package/assets/esri/core/workers/chunks/1e11d2e97d17685b878a.js +0 -1
  297. package/assets/esri/core/workers/chunks/1f339247b68b061ab0a4.js +0 -1
  298. package/assets/esri/core/workers/chunks/21ddb26526bcb2b122c3.js +0 -1
  299. package/assets/esri/core/workers/chunks/2eae542fe7f0f6576ac1.js +0 -1
  300. package/assets/esri/core/workers/chunks/444e5f214abce3d607cd.js +0 -1
  301. package/assets/esri/core/workers/chunks/46a7da93a63663878583.js +0 -1
  302. package/assets/esri/core/workers/chunks/4a1e23e021bac37a88ab.js +0 -1
  303. package/assets/esri/core/workers/chunks/4c4117e28ea358a32088.js +0 -1
  304. package/assets/esri/core/workers/chunks/54b18559280a7d2a8d93.js +0 -1
  305. package/assets/esri/core/workers/chunks/59b216b60464611742d4.js +0 -1
  306. package/assets/esri/core/workers/chunks/62ac588f7dd1d24d0c9d.js +0 -1
  307. package/assets/esri/core/workers/chunks/62c8c9ad09e0166207fd.js +0 -1
  308. package/assets/esri/core/workers/chunks/62d6e101e9bd9557a410.js +0 -1
  309. package/assets/esri/core/workers/chunks/6558488ea96620439f34.js +0 -1
  310. package/assets/esri/core/workers/chunks/665e31c494d2af505acc.js +0 -1
  311. package/assets/esri/core/workers/chunks/6f4e6022a52de0c54aab.js +0 -1
  312. package/assets/esri/core/workers/chunks/7267b17de212207142c9.js +0 -1
  313. package/assets/esri/core/workers/chunks/7ef182e24cad50815b4e.js +0 -1
  314. package/assets/esri/core/workers/chunks/8293600f94553afc8c38.js +0 -1
  315. package/assets/esri/core/workers/chunks/8431ca60ad33d594e323.js +0 -1
  316. package/assets/esri/core/workers/chunks/876f7633c15f1e31078d.js +0 -1
  317. package/assets/esri/core/workers/chunks/8ca9648eacb894283513.js +0 -1
  318. package/assets/esri/core/workers/chunks/91ebb2ccab1889eb7e81.js +0 -1
  319. package/assets/esri/core/workers/chunks/94e427040edb469d58ad.js +0 -1
  320. package/assets/esri/core/workers/chunks/9ce91a909eccc4dfe388.js +0 -1
  321. package/assets/esri/core/workers/chunks/9e1a3b6a08c96dcefdde.js +0 -1
  322. package/assets/esri/core/workers/chunks/9e3e442a9874ed23a043.js +0 -1
  323. package/assets/esri/core/workers/chunks/ad76f7ab2f3e6d5a5b3c.js +0 -1
  324. package/assets/esri/core/workers/chunks/aff32980d91dab07dfb7.js +0 -1
  325. package/assets/esri/core/workers/chunks/bbf993dba74850bbf9d7.js +0 -1
  326. package/assets/esri/core/workers/chunks/d8f1cefcad02d7353d4b.js +0 -1
  327. package/assets/esri/core/workers/chunks/d938987344bce83cc660.js +0 -1
  328. package/assets/esri/core/workers/chunks/ddf0671976648f621269.js +0 -1
  329. package/assets/esri/core/workers/chunks/de02f60258e6985ef676.js +0 -1
  330. package/assets/esri/core/workers/chunks/e10b57aefcc89671116e.js +0 -1
  331. package/assets/esri/core/workers/chunks/e65dfa19f030ec298437.js +0 -1
  332. package/assets/esri/core/workers/chunks/ed8786fed345718ed684.js +0 -1
  333. package/assets/esri/core/workers/chunks/f122c18af10e56f9ec2b.js +0 -1
  334. package/assets/esri/core/workers/chunks/f92364afaefbac7e8f77.js +0 -1
  335. package/assets/esri/core/workers/chunks/fd9663952d5a94f3a83f.js +0 -1
  336. package/assets/esri/core/workers/chunks/fe9879ecd69ac4329291.js +0 -1
  337. package/layers/mixins/FeatureLayerReload.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../request.js";import{binaryIndexOf as t}from"../../../../core/arrayUtils.js";import n from"../../../../core/Error.js";import has from"../../../../core/has.js";import{invert as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as a,copy as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as c}from"../../../../geometry/projectionUtils.js";import l from"../../../../geometry/SpatialReference.js";import{projectVectorToVector as u}from"../../../../geometry/projection/projectVectorToVector.js";import{create as d,empty as f,expandPointInPlace as p,intersects as m}from"../../../../geometry/support/aaBoundingRect.js";import{fetchFeaturePopupFeatures as h}from"../../../../layers/support/featurePopupQueryUtils.js";import g from"../../../../rest/support/Query.js";import{readBinaryAttribute as _,getCachedAttributeValue as v}from"./I3SBinaryReader.js";import{computeGlobalTransformation as y}from"./I3SProjectionUtil.js";import{createSolidEdgeMaterial as b,createMaterialFromEdges as x}from"../support/edgeUtils.js";import{parseColorMixMode as ee}from"../support/symbolColorUtils.js";import{Obb as te,compute as ne}from"../../support/orientedBoundingBox.js";import{emissiveStrengthDefault as S}from"../../webgl-engine/core/shaderLibrary/output/getEmissions.glsl.js";import{spatialReferenceIncompatibleError as C}from"../../../support/layerViewUtils.js";function w(e){return e?parseInt(e.slice(e.lastIndexOf(`/`)+1),10):void 0}function T(e){if(has(`disable-feature:i3s-draco`)||!e)return!1;for(let t of e)for(let e of t.geometryBuffers)if(e.compressedAttributes?.encoding===`draco`)return!0;return!1}function E(e,t,n,r){n.traverse(t,t=>{let n=t.serviceMbsInIndexSR;return(n!=null&&k(e,n))!==0&&(r(t),!0)})}function D(e,t,n){let r=0,i=0;for(let a=0;a<t.length&&r<e.length;a++)e[r]===t[a]&&(n(a)&&(e[i]=e[r],i++),r++);e.length=i}function re(e,n,r){let i=0,a=0;for(;i<r.length;)t(e,r[i])>=0===n&&(r[a]=r[i],a++),i++;r.length=a}function ie(e,t){if(t.rotationScale[1]===0&&t.rotationScale[2]===0&&t.rotationScale[3]===0&&t.rotationScale[5]===0&&t.rotationScale[6]===0&&t.rotationScale[7]===0)return O[0]=(e[0]-t.position[0])/t.rotationScale[0],O[1]=(e[1]-t.position[1])/t.rotationScale[4],O[2]=(e[2]-t.position[0])/t.rotationScale[0],O[3]=(e[3]-t.position[1])/t.rotationScale[4],O}const O=d();function k(e,t){let n=t.center[0],r=t.center[1],i=t.radius,a=e[0]-n,o=n-e[2],s=e[1]-r,c=r-e[3],l=Math.max(a,o,0),u=Math.max(s,c,0),d=l*l+u*u;return d>i*i?0:d>0?1:-Math.max(a,o,s,c)>i?3:2}function A(e,t,n){let r=[],i=n?.missingFields,a=n?.originalFields,o=!1;for(let n of e){let e=t?.get(n);e?(a?.push(n),r.push(e.name),n!==e.name&&(o=!0)):i?.push(n)}return n&&`hasMismatchedCasing`in n&&(n.hasMismatchedCasing=o),r}async function ae(e,t,r,i,a,o){if(t.length===0)return[];let s=e.attributeStorageInfo;if(e.associatedLayer!=null)try{return await j(e.associatedLayer,t,i,o)}catch(t){if(e.associatedLayer.loaded)throw t}if(s){let n=oe(e,t,r,a),c=e.parsedUrl.path;return await Promise.allSettled(n.map(t=>M(c,s,t.node,t.indices,i,e.apiKey,e.customParameters,o).then(e=>{for(let n=0;n<t.graphics.length;n++){let r=t.graphics[n],i=e[n];if(r.attributes)for(let e in r.attributes)e in i||(i[e]=r.attributes[e]);r.attributes=i}}))),t}throw new n(`scenelayer:no-attribute-source`,`This scene layer does not have a source for attributes available`)}function oe({globalIdField:e},t,n,r){let i=new Map,a=[],o=r();for(let r of t){let t=r.attributes?.[n],s=t==null?r.getGlobalId():void 0;for(let n=0;n<o.length;n++){let c=o[n],l=se(c,t,e,s);if(l<0)continue;let u=i.get(c.node);u||(u={node:c.node,indices:[],graphics:[]},a.push(u),i.set(c.node,u)),u.indices.push(l),u.graphics.push(r);for(let e=n;e>0;e--)o[e]=o[e-1];o[0]=c;break}}return a}function se(e,t,n,r){if(t!=null&&typeof t==`number`)return e.featureIds.indexOf(t);if(r==null||n==null)return-1;let i=e.attributeInfo?.attributeData?.[n];return i?i.indexOf(r):-1}async function j(e,t,n,r){let i=[],a={hasMismatchedCasing:!1,originalFields:i},o=A(n,e.fieldsIndex,a),s=new g({outFields:[...o]});if(await h(e,t,s,{updateSourceAttributes:!0,...r}),!a.hasMismatchedCasing)return t;for(let e=0;e<t.length;e++){let n=t[e];if(n.attributes)for(let e=0;e<i.length;e++){let t=i[e],r=o[e];r in n.attributes&&(n.attributes[t]=n.attributes[r],delete n.attributes[r])}}return t}function M(e,t,n,r,i,a,o,s){return N(e,t,n.resources.attributes,r,i,a,o,s)}async function N(t,n,r,i,a,o,s,c){let l=[];for(let e of n)if(e&&a.includes(e.name)){let n=`${t}/nodes/${r}/attributes/${e.key}/0`;l.push({url:n,storageInfo:e})}let u=await Promise.allSettled(l.map(t=>e(t.url,{responseType:`array-buffer`,query:{...s,token:o},signal:c?.signal}).then(e=>_(t.storageInfo,e.data)))),d=[];for(let e of i){let t={};for(let n=0;n<u.length;n++){let r=u[n];if(r.status===`fulfilled`){let i=r.value;t[l[n].storageInfo.name]=v(i,e)}}d.push(t)}return d}function P(e){let t=e.store,r=t.indexCRS||t.geographicCRS,i=r===void 0?t.indexWKT:void 0;if(i){if(e.spatialReference){if(i!==e.spatialReference.wkt)throw new n(`layerview:store-spatial-reference-wkt-index-incompatible`,`The indexWKT of the scene layer store does not match the WKT of the layer spatial reference`,{})}else throw new n(`layerview:no-store-spatial-reference-wkt-index-and-no-layer-spatial-reference`,`Found indexWKT in the scene layer store but no layer spatial reference`,{})}let a=r?new l(w(r)):e.spatialReference;return a.equals(e.spatialReference)?e.spatialReference:a}function F(e){let t=e.store,r=t.vertexCRS||t.projectedCRS,i=r===void 0?t.vertexWKT:void 0;if(i){if(e.spatialReference){if(i!==e.spatialReference.wkt)throw new n(`layerview:store-spatial-reference-wkt-vertex-incompatible`,`The vertexWKT of the scene layer store does not match the WKT of the layer spatial reference`,{})}else throw new n(`layerview:no-store-spatial-reference-wkt-vertex-and-no-layer-spatial-reference`,`Found vertexWKT in the scene layer store but no layer spatial reference`,{})}let a=r?new l(w(r)):e.spatialReference;return a.equals(e.spatialReference)?e.spatialReference:a}function I(e,t,n){if(!c(e,t)||n===`local`&&!R(e,t))throw C(`scene layer`,e?.wkid,t?.wkid)}function L(e,t,r){if(e.serviceUpdateTimeStamp?.lastUpdate!==t.serviceUpdateTimeStamp?.lastUpdate||!r.isEmpty||e.associatedLayer?.url!==t.associatedLayer?.url)throw new n(`layerview:recycle-failed`,`Could not recycle layerview`)}function R(e,t){return e.equals(t)||e.isWGS84&&t.isWebMercator||e.isWebMercator&&t.isWGS84}function z(e,t,n){let r=P(e),i=F(e);I(r,t,n),I(i,t,n)}function B(e){return!(e.geometryType!=null&&e.geometryType!==`triangles`||e.topology!=null&&e.topology!==`PerAttributeArray`||e.vertexAttributes?.position==null)}function V(e){if(e.store?.defaultGeometrySchema==null||!B(e.store.defaultGeometrySchema))throw new n(`scenelayer:unsupported-geometry-schema`,`The geometry schema of this scene layer is not supported.`,{url:e.parsedUrl.path})}function H(e,t){z(e,t.spatialReference,t.viewingMode)}function U(e){return!(e.geometryType==null||e.geometryType!==`points`||e.topology!=null&&e.topology!==`PerAttributeArray`||e.encoding!=null&&e.encoding!==``&&e.encoding!==`lepcc-xyz`||e.vertexAttributes?.position==null)}function W(e){if(e.store?.defaultGeometrySchema==null||!U(e.store.defaultGeometrySchema))throw new n(`pointcloud:unsupported-geometry-schema`,`The geometry schema of this point cloud scene layer is not supported.`,{})}function G(e,t){I(e.spatialReference,t.spatialReference,t.viewingMode)}function ce(e){return e.type===`simple`||e.type===`class-breaks`||e.type===`unique-value`}function le(e){return e.type===`mesh-3d`}function ue(e){if(e==null||!ce(e)||(e.type===`unique-value`||e.type===`class-breaks`)&&e.defaultSymbol==null)return!0;let t=e.symbols;if(t.length===0)return!0;for(let e of t){if(!le(e)||e.symbolLayers.length===0)return!0;for(let t of e.symbolLayers.items)if(t.type!==`fill`||t.material?.color==null||t.material.colorMixMode!==`replace`)return!0}return!1}const de=b({color:[0,0,0,0],opacity:0});class K{constructor(){this.edgeMaterial=null,this.material=null,this.castShadows=!0}}function fe(e){let t=new K,n=!1,r=!1;for(let i of e.symbolLayers.items)if(i.type===`fill`&&i.enabled){let e=i.material,a=i.edges;if(e!=null&&!n){let r=e.color,a=ee(e.colorMixMode),o={strength:e.emissive?.strength??S,source:+(e.emissive?.source===`color`)};t.material=r==null?{color:[1,1,1],alpha:1,colorMixMode:1,emissive:o}:{color:[r.r/255,r.g/255,r.b/255],alpha:r.a,colorMixMode:a,emissive:o},t.castShadows=i.castShadows,n=!0}a!=null&&!r&&(t.edgeMaterial=x(a,{}),r=!0)}return t.material||={color:[1,1,1],alpha:1,colorMixMode:1,emissive:{strength:S,source:0}},t}function q(e,t){return(e|0)+(t|0)|0}function pe(e,t,n,i,s,c,l){if(!c||c.length===0||t==null||!e.serviceMbsInIndexSR)return null;let d=y(e.serviceMbsInIndexSR,s,`none`,n,t);r($,d);let h=null,g=()=>{if(!h){if(h=me,f(Y),e.serviceObbInIndexSR!=null){e.serviceObbInIndexSR.transform(X,n,t,s,l),X.getCorners(h);for(let e of h)a(e,e,$),p(Y,e)}else{let r=e.serviceMbsInIndexSR;if(!r)return;let i=r.radius;u(r.center,n,Z,t),a(Z,Z,$),Z[2]+=s;for(let e=0;e<8;++e){let t=e&1?i:-i,n=e&2?i:-i,r=e&4?i:-i,a=h[e];o(a,[Z[0]+t,Z[1]+n,Z[2]+r]),p(Y,a)}}}},_=1/0,v=-1/0,b=e=>{if(e.type!==`replace`)return;let n=e.geometry;if(!n?.hasZ)return;f(J);let r=n.spatialReference||i,o=n.rings.reduce((e,n)=>n.reduce((e,n)=>(u(n,r,Z,t),a(Z,Z,$),p(J,Z),Math.min(Z[2],e)),e),1/0);g(),m(Y,J)&&(_=Math.min(_,o),v=Math.max(v,o))};if(c.forEach(e=>b(e)),_===1/0)return null;let x=(e,t,n)=>{a(Z,n,d),e[t]=Z[0],e[t+1]=Z[1],e[t+2]=Z[2],t+=24,n[2]=_,a(Z,n,d),e[t]=Z[0],e[t+1]=Z[1],e[t+2]=Z[2],t+=24,n[2]=v,a(Z,n,d),e[t]=Z[0],e[t+1]=Z[1],e[t+2]=Z[2]};for(let e=0;e<8;++e)x(Q.data,e*3,h[e]);return ne(Q)}const me=[s(),s(),s(),s(),s(),s(),s(),s()],J=d(),Y=d(),X=new te,Z=s(),Q={data:Array(72),size:3,exclusive:!0,stride:3},$=i();export{K as SymbolInfo,q as addWraparound,G as checkPointCloudLayerCompatibleWithView,W as checkPointCloudLayerValid,L as checkRecyclable,H as checkSceneLayerCompatibleWithView,V as checkSceneLayerValid,I as checkSpatialReference,z as checkSpatialReferences,pe as computeVisibilityObb,T as containsDraco,w as extractWkid,D as filterInPlace,A as findFieldsCaseInsensitive,E as findIntersectingNodes,ie as getClipRect,P as getIndexCrs,fe as getSymbolInfo,F as getVertexCrs,k as intersectBoundingRectWithMbs,R as isSupportedLocalModeProjection,re as objectIdFilter,N as queryAttributesFromCachedAttributesId,ue as rendererNeedsTextures,de as transparentEdgeMaterial,ae as whenGraphicAttributes};
2
+ import e from"../../../../request.js";import{binaryIndexOf as t}from"../../../../core/arrayUtils.js";import n from"../../../../core/Error.js";import has from"../../../../core/has.js";import{invert as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as a,copy as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as c}from"../../../../geometry/projectionUtils.js";import l from"../../../../geometry/SpatialReference.js";import{projectVectorToVector as u}from"../../../../geometry/projection/projectVectorToVector.js";import{create as d,empty as f,expandPointInPlace as p,intersects as m}from"../../../../geometry/support/aaBoundingRect.js";import{fetchFeaturePopupFeatures as h}from"../../../../layers/support/featurePopupQueryUtils.js";import g from"../../../../rest/support/Query.js";import{readBinaryAttribute as _,getCachedAttributeValue as v}from"./I3SBinaryReader.js";import{computeGlobalTransformation as y}from"./I3SProjectionUtil.js";import{createSolidEdgeMaterial as b,createMaterialFromEdges as x}from"../support/edgeUtils.js";import{parseColorMixMode as ee}from"../support/symbolColorUtils.js";import{Obb as te,compute as S}from"../../support/orientedBoundingBox.js";import{emissiveStrengthDefault as C}from"../../webgl-engine/core/shaderLibrary/output/getEmissions.glsl.js";import{spatialReferenceIncompatibleError as w}from"../../../support/layerViewUtils.js";function T(e){return e?parseInt(e.slice(e.lastIndexOf(`/`)+1),10):void 0}function E(e){if(has(`disable-feature:i3s-draco`)||!e)return!1;for(let t of e)for(let e of t.geometryBuffers)if(e.compressedAttributes?.encoding===`draco`)return!0;return!1}function D(e,t,n,r,i){n.traverse(t,t=>i.intersectsElevationUpdate(e,t)?(r(t),!0):!1)}function ne(e,t,n){let r=0,i=0;for(let a=0;a<t.length&&r<e.length;a++)e[r]===t[a]&&(n(a)&&(e[i]=e[r],i++),r++);e.length=i}function re(e,n,r){let i=0,a=0;for(;i<r.length;)t(e,r[i])>=0===n&&(r[a]=r[i],a++),i++;r.length=a}function ie(e,t){if(t.rotationScale[1]===0&&t.rotationScale[2]===0&&t.rotationScale[3]===0&&t.rotationScale[5]===0&&t.rotationScale[6]===0&&t.rotationScale[7]===0)return O[0]=(e[0]-t.position[0])/t.rotationScale[0],O[1]=(e[1]-t.position[1])/t.rotationScale[4],O[2]=(e[2]-t.position[0])/t.rotationScale[0],O[3]=(e[3]-t.position[1])/t.rotationScale[4],O}const O=d();function ae(e,t){let n=t.center[0],r=t.center[1],i=t.radius,a=e[0]-n,o=n-e[2],s=e[1]-r,c=r-e[3],l=Math.max(a,o,0),u=Math.max(s,c,0),d=l*l+u*u;return d>i*i?0:d>0?1:-Math.max(a,o,s,c)>i?3:2}function k(e,t,n){let r=[],i=n?.missingFields,a=n?.originalFields,o=!1;for(let n of e){let e=t?.get(n);e?(a?.push(n),r.push(e.name),n!==e.name&&(o=!0)):i?.push(n)}return n&&`hasMismatchedCasing`in n&&(n.hasMismatchedCasing=o),r}async function oe(e,t,r,i,a,o){if(t.length===0)return[];let s=e.attributeStorageInfo;if(e.associatedLayer!=null)try{return await j(e.associatedLayer,t,i,o)}catch(t){if(e.associatedLayer.loaded)throw t}if(s){let n=se(e,t,r,a),c=e.parsedUrl.path;return await Promise.allSettled(n.map(t=>M(c,s,t.node,t.indices,i,e.apiKey,e.customParameters,o).then(e=>{for(let n=0;n<t.graphics.length;n++){let r=t.graphics[n],i=e[n];if(r.attributes)for(let e in r.attributes)e in i||(i[e]=r.attributes[e]);r.attributes=i}}))),t}throw new n(`scenelayer:no-attribute-source`,`This scene layer does not have a source for attributes available`)}function se({globalIdField:e},t,n,r){let i=new Map,a=[],o=r();for(let r of t){let t=r.attributes?.[n],s=t==null?r.getGlobalId():void 0;for(let n=0;n<o.length;n++){let c=o[n],l=A(c,t,e,s);if(l<0)continue;let u=i.get(c.node);u||(u={node:c.node,indices:[],graphics:[]},a.push(u),i.set(c.node,u)),u.indices.push(l),u.graphics.push(r);for(let e=n;e>0;e--)o[e]=o[e-1];o[0]=c;break}}return a}function A(e,t,n,r){if(t!=null&&typeof t==`number`)return e.featureIds.indexOf(t);if(r==null||n==null)return-1;let i=e.attributeInfo?.attributeData?.[n];return i?i.indexOf(r):-1}async function j(e,t,n,r){let i=[],a={hasMismatchedCasing:!1,originalFields:i},o=k(n,e.fieldsIndex,a),s=new g({outFields:[...o]});if(await h(e,t,s,{updateSourceAttributes:!0,...r}),!a.hasMismatchedCasing)return t;for(let e=0;e<t.length;e++){let n=t[e];if(n.attributes)for(let e=0;e<i.length;e++){let t=i[e],r=o[e];r in n.attributes&&(n.attributes[t]=n.attributes[r],delete n.attributes[r])}}return t}function M(e,t,n,r,i,a,o,s){return N(e,t,n.resources.attributes,r,i,a,o,s)}async function N(t,n,r,i,a,o,s,c){let l=[];for(let e of n)if(e&&a.includes(e.name)){let n=`${t}/nodes/${r}/attributes/${e.key}/0`;l.push({url:n,storageInfo:e})}let u=await Promise.allSettled(l.map(t=>e(t.url,{responseType:`array-buffer`,query:{...s,token:o},signal:c?.signal}).then(e=>_(t.storageInfo,e.data)))),d=[];for(let e of i){let t={};for(let n=0;n<u.length;n++){let r=u[n];if(r.status===`fulfilled`){let i=r.value;t[l[n].storageInfo.name]=v(i,e)}}d.push(t)}return d}function P(e){let t=e.store,r=t.indexCRS||t.geographicCRS,i=r===void 0?t.indexWKT:void 0;if(i){if(e.spatialReference){if(i!==e.spatialReference.wkt)throw new n(`layerview:store-spatial-reference-wkt-index-incompatible`,`The indexWKT of the scene layer store does not match the WKT of the layer spatial reference`,{})}else throw new n(`layerview:no-store-spatial-reference-wkt-index-and-no-layer-spatial-reference`,`Found indexWKT in the scene layer store but no layer spatial reference`,{})}let a=r?new l(T(r)):e.spatialReference;return a.equals(e.spatialReference)?e.spatialReference:a}function F(e){let t=e.store,r=t.vertexCRS||t.projectedCRS,i=r===void 0?t.vertexWKT:void 0;if(i){if(e.spatialReference){if(i!==e.spatialReference.wkt)throw new n(`layerview:store-spatial-reference-wkt-vertex-incompatible`,`The vertexWKT of the scene layer store does not match the WKT of the layer spatial reference`,{})}else throw new n(`layerview:no-store-spatial-reference-wkt-vertex-and-no-layer-spatial-reference`,`Found vertexWKT in the scene layer store but no layer spatial reference`,{})}let a=r?new l(T(r)):e.spatialReference;return a.equals(e.spatialReference)?e.spatialReference:a}function I(e,t,n){if(!c(e,t)||n===`local`&&!R(e,t))throw w(`scene layer`,e?.wkid,t?.wkid)}function L(e,t,r){if(e.serviceUpdateTimeStamp?.lastUpdate!==t.serviceUpdateTimeStamp?.lastUpdate||!r.isEmpty||e.associatedLayer?.url!==t.associatedLayer?.url)throw new n(`layerview:recycle-failed`,`Could not recycle layerview`)}function R(e,t){return e.equals(t)||e.isWGS84&&t.isWebMercator||e.isWebMercator&&t.isWGS84}function z(e,t,n){let r=P(e),i=F(e);I(r,t,n),I(i,t,n)}function B(e){return!(e.geometryType!=null&&e.geometryType!==`triangles`||e.topology!=null&&e.topology!==`PerAttributeArray`||e.vertexAttributes?.position==null)}function V(e){if(e.store?.defaultGeometrySchema==null||!B(e.store.defaultGeometrySchema))throw new n(`scenelayer:unsupported-geometry-schema`,`The geometry schema of this scene layer is not supported.`,{url:e.parsedUrl.path})}function H(e,t){z(e,t.spatialReference,t.viewingMode)}function U(e){return!(e.geometryType==null||e.geometryType!==`points`||e.topology!=null&&e.topology!==`PerAttributeArray`||e.encoding!=null&&e.encoding!==``&&e.encoding!==`lepcc-xyz`||e.vertexAttributes?.position==null)}function W(e){if(e.store?.defaultGeometrySchema==null||!U(e.store.defaultGeometrySchema))throw new n(`pointcloud:unsupported-geometry-schema`,`The geometry schema of this point cloud scene layer is not supported.`,{})}function G(e,t){I(e.spatialReference,t.spatialReference,t.viewingMode)}function ce(e){return e.type===`simple`||e.type===`class-breaks`||e.type===`unique-value`}function le(e){return e.type===`mesh-3d`}function ue(e){if(e==null||!ce(e)||(e.type===`unique-value`||e.type===`class-breaks`)&&e.defaultSymbol==null)return!0;let t=e.symbols;if(t.length===0)return!0;for(let e of t){if(!le(e)||e.symbolLayers.length===0)return!0;for(let t of e.symbolLayers.items)if(t.type!==`fill`||t.material?.color==null||t.material.colorMixMode!==`replace`)return!0}return!1}const de=b({color:[0,0,0,0],opacity:0});class K{constructor(){this.edgeMaterial=null,this.material=null,this.castShadows=!0}}function fe(e){let t=new K,n=!1,r=!1;for(let i of e.symbolLayers.items)if(i.type===`fill`&&i.enabled){let e=i.material,a=i.edges;if(e!=null&&!n){let r=e.color,a=ee(e.colorMixMode),o={strength:e.emissive?.strength??C,source:+(e.emissive?.source===`color`)};t.material=r==null?{color:[1,1,1],alpha:1,colorMixMode:1,emissive:o}:{color:[r.r/255,r.g/255,r.b/255],alpha:r.a,colorMixMode:a,emissive:o},t.castShadows=i.castShadows,n=!0}a!=null&&!r&&(t.edgeMaterial=x(a,{}),r=!0)}return t.material||={color:[1,1,1],alpha:1,colorMixMode:1,emissive:{strength:C,source:0}},t}function q(e,t){return(e|0)+(t|0)|0}function pe(e,t,n,i,s,c,l){if(!c||c.length===0||t==null||!e.serviceMbsInIndexSR)return null;let d=y(e.serviceMbsInIndexSR,s,`none`,n,t);r($,d);let h=null,g=()=>{if(!h){if(h=me,f(Y),e.serviceObbInIndexSR!=null){e.serviceObbInIndexSR.transform(X,n,t,s,l),X.getCorners(h);for(let e of h)a(e,e,$),p(Y,e)}else{let r=e.serviceMbsInIndexSR;if(!r)return;let i=r.radius;u(r.center,n,Z,t),a(Z,Z,$),Z[2]+=s;for(let e=0;e<8;++e){let t=e&1?i:-i,n=e&2?i:-i,r=e&4?i:-i,a=h[e];o(a,[Z[0]+t,Z[1]+n,Z[2]+r]),p(Y,a)}}}},_=1/0,v=-1/0,b=e=>{if(e.type!==`replace`)return;let n=e.geometry;if(!n?.hasZ)return;f(J);let r=n.spatialReference||i,o=n.rings.reduce((e,n)=>n.reduce((e,n)=>(u(n,r,Z,t),a(Z,Z,$),p(J,Z),Math.min(Z[2],e)),e),1/0);g(),m(Y,J)&&(_=Math.min(_,o),v=Math.max(v,o))};if(c.forEach(e=>b(e)),_===1/0)return null;let x=(e,t,n)=>{a(Z,n,d),e[t]=Z[0],e[t+1]=Z[1],e[t+2]=Z[2],t+=24,n[2]=_,a(Z,n,d),e[t]=Z[0],e[t+1]=Z[1],e[t+2]=Z[2],t+=24,n[2]=v,a(Z,n,d),e[t]=Z[0],e[t+1]=Z[1],e[t+2]=Z[2]};for(let e=0;e<8;++e)x(Q.data,e*3,h[e]);return S(Q)}const me=[s(),s(),s(),s(),s(),s(),s(),s()],J=d(),Y=d(),X=new te,Z=s(),Q={data:Array(72),size:3,exclusive:!0,stride:3},$=i();export{K as SymbolInfo,q as addWraparound,G as checkPointCloudLayerCompatibleWithView,W as checkPointCloudLayerValid,L as checkRecyclable,H as checkSceneLayerCompatibleWithView,V as checkSceneLayerValid,I as checkSpatialReference,z as checkSpatialReferences,pe as computeVisibilityObb,E as containsDraco,T as extractWkid,ne as filterInPlace,k as findFieldsCaseInsensitive,D as findIntersectingNodes,ie as getClipRect,P as getIndexCrs,fe as getSymbolInfo,F as getVertexCrs,ae as intersectBoundingRectWithMbs,R as isSupportedLocalModeProjection,re as objectIdFilter,N as queryAttributesFromCachedAttributesId,ue as rendererNeedsTextures,de as transparentEdgeMaterial,oe as whenGraphicAttributes};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{normalize as e,length as t,set as n,equals as r,subtract as i,dot as a,len as o,sqrDist as s,copy as c,scale as l,sub as u,scaleAndAdd as d,distance as f,squaredLength as p,squaredDistance as m,add as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as _}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as v}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingSphere as y}from"../../../../geometry/projection/projectBoundingSphere.js";import{getProjector as b}from"../../../../geometry/projection/projectors.js";import{signedDistance as x,getNormal as S}from"../../../../geometry/support/plane.js";import{isPlateCarree as ee}from"../../../../geometry/support/spatialReferenceUtils.js";import{Sphere as C}from"../../../../geometry/support/sphere.js";import{evaluateElevationAlignmentAtPoint as w}from"../graphics/elevationAlignmentUtils.js";import{ElevationContext as T}from"../graphics/ElevationContext.js";import{createContextWithoutExpressionSupport as E,extractExpressionInfo as D}from"../graphics/featureExpressionInfoUtils.js";import{intersectBoundingRectWithMbs as O}from"./I3SUtil.js";import{Frustum as k}from"../../state/Frustum.js";import{Obb as A,computeOffsetObb as j}from"../../support/orientedBoundingBox.js";import{SweptSphereCylindricalVolume as M,SphereGlobal as N,SweptSphereConicalVolume as P}from"../../support/SweptSphereVolume.js";const F=1e5;class te{get _frustumPlanes(){return this._frustum.planes}constructor(e,t,n,r,i,a,o,s,c={}){this._indexSR=e,this._renderCoordsHelper=t,this._clippingArea=i,this._elevationProvider=a,this._viewingMode=o,this._options=c,this._viewDirection=g(),this._useFrustumCulling=!1,this._poi=g(),this._cameraPOIDirection=g(),this._elevationContext=null,this.minCenterDistance=1/0,this.maxCenterDistance=0,this.maxLodLevel=2,this._screenspaceErrorBias=c.screenspaceErrorBias||1,this._progressiveLoadFactor=c.progressiveLoadFactor||1,this._frustum=new k(t),this.updateCamera(n,r);let l=this._renderCoordsHelper.spatialReference;this._renderSR=l,this._renderSRSphericalPCPF=v(l),this._isGlobalMode=l===this._renderSRSphericalPCPF,this.updateElevationInfo(s),this._isECEFOBBInLocalMode=this._indexSR.isWGS84&&(l.isWebMercator||ee(l)),this._indexSREllipsoidRadius=_(this._indexSR).radius,this._indexSRSphericalPCPF=v(e),this._projectorIndexSRToIndexSRSphericalPCPF=b(this._indexSR,this._indexSRSphericalPCPF)}updateElevationInfo(e){e==null?this._elevationContext=null:(this._elevationContext=T.fromElevationInfo(e),this._elevationContext.setFeatureExpressionInfoContext(E(D(e,!1))))}updateCamera(t,n){this._useFrustumCulling=n,e(this._viewDirection,t.viewForward),n&&this._frustum.update(t),this._halfScreenPixelSizePerDistance=t.screenPixelSizePerDistance/2,this._camPos=t.eye,this._updateCameraPOIDirection(),this.minCenterDistance=1/0,this.maxCenterDistance=0}setPointOfInterest(e){this._poi=e,this._updateCameraPOIDirection()}updateScreenSpaceErrorBias(e){let t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this._clippingArea=e}expandElevationRange(e,t,n){if(this._elevationContext==null)return;let r=e.serviceMbsInIndexSR;if(!r)return;let i=this._elevationContext.mode===`relative-to-scene`?`scene`:`ground`,a=this._elevationProvider;if(a.getSphereElevationRange){let e=a.getSphereElevationRange(r,this._indexSR,i);if(e){n.expandElevationRange(e);return}}let[o,s,c]=r.center,l=a.getElevation(o,s,c,this._indexSR,i);l&&n.expandElevationRangeValues(l,l);let u=t?null:a.getRootElevationRange?.();u&&n.expandElevationRange(u)}calculateServiceMbsInRenderSR(e){let{serviceMbsInRenderSR:t}=e;if(t.isValid)return t;let{serviceMbsInIndexSR:n}=e;if(!n?.isValid)return t;let r=G;return y(n,this._indexSR,r,this._renderSR),e.updateServiceMbsInRenderSR(r)}calculateServiceMbsInRenderSRElevationAdjusted(e){let{serviceMbsInRenderSRElevationAdjusted:t}=e;if(t.isValid)return t;let{serviceMbsInIndexSR:n}=e,r=this.calculateServiceMbsInRenderSR(e);if(!r.isValid||!n?.isValid)return t;let i=G;i.copyFrom(r);let{_elevationContext:a}=this;if(a){let{minElevation:t}=e,{_renderCoordsHelper:r}=this,o=n.center,s=0;if(Number.isFinite(t)){let n=0,c=0,{maxElevation:l}=e,u=o[2];switch(a.mode){case`relative-to-ground`:case`relative-to-scene`:n=a.geometryZWithOffset(u,r)+t-u,c=l-t;break;case`on-the-ground`:n=t-u,c=l-t}s=n+.5*c,i.radius+=.5*c}else i.radius<F&&(s=w(o,this._elevationProvider,a,r)-o[2]);s&&ae(i,s,this._viewingMode)}return e.updateServiceMbsInRenderSRElevationAdjusted(i)}_isGlobalMbsContainingPlanetCenter(e){return this._viewingMode===1&&t(e.center)<=e.radius}calculateMbsConeInRenderSR(e){let{mbsConeInRenderSR:t}=e;if(t)return t;if(!e.elevationRangeValid)return null;let{minElevation:n,maxElevation:r}=e;if(!Number.isFinite(n)||!(n<r))return null;let i=this.calculateServiceMbsInRenderSR(e);if(!i.isValid)return null;let a=this._elevationContext;if(a?.mode===`relative-to-ground`||a?.mode===`relative-to-scene`){let t=e.serviceMbsInIndexSR;if(!t?.isValid)return null;let i=t.center[2],o=a.geometryZWithOffset(i,this._renderCoordsHelper);if(this._viewingMode===2)n+=o,r+=o;else{let e=o-i;n+=e,r+=e}}let o=this._renderCoordsHelper.referenceEllipsoid.radius,s=this._viewingMode===2?new M(i,n,r):this._isGlobalMbsContainingPlanetCenter(i)?new N(i,o+n,o+r):new P(i,o+n,o+r);return e.updateMbsConeInRenderSR(s)}getAndUpdateVisibilityObbInRenderSR(e){{let t=e.visibilityObbInRenderSR;if(t)return t}let t=this._indexSREllipsoidRadius*.01,{serviceMbsInIndexSR:r,serviceObbInIndexSR:i}=e;if(i==null||!r||!i.isValid||this._isECEFOBBInLocalMode&&(i.halfSizeX>t||i.halfSizeY>t||i.halfSizeZ>t))return null;{let t=e.serviceObbInRenderSR;if(t==null)t=new A,e.serviceObbInRenderSR=t;else if(t.isValid)return t;let a=r.radius,o=0,s=0,c=i.centerZ,l=this._renderCoordsHelper,u=this._elevationContext;if(u&&e.elevationRangeValid){let{minElevation:t,maxElevation:n}=e;switch(u.mode){case`relative-to-ground`:case`relative-to-scene`:o=u.geometryZWithOffset(c,l)+t-c,s=n-t;break;case`on-the-ground`:o=t-c,s=n-t}}else if(u&&a<F){let e=n(R,i.centerX,i.centerY,c);o=w(e,this._elevationProvider,u,l)-c}let d=s>0,f=d?L:t;return i.transform(f,this._indexSR,this._renderSR,o,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),d&&j(f,0,s,this._viewingMode,t),t}}getNodeObbInRenderSRIndependentOfElevationOffset(e){{let t=e.visibilityObbInRenderSR??e.serviceObbInRenderSR??null;if(t?.isValid)return t}let t=e.serviceObbInIndexSR;return t?this._viewingMode===2&&Math.max(t.halfSizeX,t.halfSizeY,t.halfSizeZ)>.2*this._indexSREllipsoidRadius?null:(t.transform(L,this._indexSR,this._renderSR,void 0,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),L):null}ensureElevationAgnosticBoundingVolume(e){return!e.elevationAgnosticBoundingVolume.valid&&e.level>0&&(this._viewingMode===1?this._updateElevationAgnosticBoundingVolumeGlobal(e):this._updateElevationAgnosticBoundingVolumeLocal(e)),e.elevationAgnosticBoundingVolume}_updateCameraPOIDirection(){r(this._poi,this._camPos)?this._cameraPOIDirection=this._viewDirection:(i(this._cameraPOIDirection,this._camPos,this._poi),e(this._cameraPOIDirection,this._cameraPOIDirection))}_updateElevationAgnosticBoundingVolumeGlobal(t){let n=this.getNodeObbInRenderSRIndependentOfElevationOffset(t),r=t.elevationAgnosticBoundingVolume,i=-1,s;if(n){let t=R;n.getCenter(t),e(t,t),s=t,n.getCorners(z);for(let n of z){e(n,n);let o=a(n,t);if(o<=0){r.invalidate();return}let s=Math.sqrt(Math.max(0,1-o*o));i=Math.max(i,s)}}else{let n=t.serviceMbsInRenderSR;if(!n.isValid){r.invalidate();return}let{center:a,radius:c}=n,l=o(a);if(l<c){r.invalidate();return}i=c/l,s=e(W,a)}r.set(s,i+$)}_updateElevationAgnosticBoundingVolumeLocal(e){let t=e.elevationAgnosticBoundingVolume,n=this.getNodeObbInRenderSRIndependentOfElevationOffset(e);if(n){let e=n.getCenter(R);e[2]=0;let r=0,i=B;n.getCorners(z);for(let e of z){e[2]=0;let t=s(i,e);r=Math.max(r,t)}t.set(e,Math.sqrt(r))}else{let n=e.serviceMbsInRenderSR;if(n.isValid){let e=c(R,n.center);e[2]=0,t.set(e,n.radius)}}}isNodeVisible(e){if(!this._isMBSinClippingArea(this.calculateServiceMbsInRenderSR(e)))return!1;if(!this._useFrustumCulling)return!0;let t=this.getAndUpdateVisibilityObbInRenderSR(e);return t?t.intersectsFrustumConservativeApproximation(this._frustumPlanes):this._frustum.intersectsSphere(this.calculateServiceMbsInRenderSRElevationAdjusted(e))}isElevationAgnosticBoundingVolumeVisible(e){return!this._useFrustumCulling||!e.valid?!0:e.intersectsFrustumConservative(this._frustum,this._viewingMode,1)?this._viewingMode!==1||this._isConeVisibleInFrustum(e):!1}_isConeVisibleInFrustum(t){let n=t.radius;if(n>ce)return!0;let r=this._frustumPlanes,{center:i,radius:o}=this._frustum.boundingSphere,s=t.getAxis(W),c=a(s,i),f=o+1,p=c-f,m=c+f;if(p<=0)return!0;let h=l(re,s,p),g=l(ie,s,m),_=n/Math.sqrt(1-n*n);for(let t of r){let n=S(t),r=e(I,n),i=a(r,s);if(Math.abs(1-i)<le)continue;let o=V;l(o,s,i),u(o,o,r),e(o,o);let c=H;if(d(c,h,o,p*_),!(x(t,c)<=0)&&(d(c,g,o,m*_),!(x(t,c)<=0)))return!1}return!0}isObbVisibleIndependentOfElevation(e,t){if(!this._useFrustumCulling||!e.valid)return!0;let{center:n,radius:r}=this._frustum.boundingSphere,i=r+1,o=this._frustumPlanes,s=z;if(t.getCorners(s),this._viewingMode===1){let t=e.getAxis(W),r=a(t,n),c=r-i,u=r+i;if(c<=0)return!0;for(let e of o){let n=!0;for(let r of s){let i=a(r,t),o=U;if(l(o,r,c/i),x(e,o)<=0){n=!1;break}let s=U;if(l(s,r,u/i),x(e,s)<=0){n=!1;break}}if(n)return!1}}else{let e=n[2]-i,t=n[2]+i;for(let n of o){let r=!0,i=S(n),a=i[0],o=i[1],c=i[2],l=n[3];for(let n of s){let i=a*n[0]+o*n[1]+l;if(i+c*e<=0||i+c*t<=0){r=!1;break}}if(r)return!1}}return!0}isGeometryVisible(e){return this._useFrustumCulling?e.geometryObbInRenderSR?.intersectsFrustumConservativeApproximation(this._frustumPlanes)??this.isNodeVisible(e):!0}_isMBSinClippingArea(e){return this._clippingArea==null||O(this._clippingArea,e)!==0}_screenSpaceDiameterMbs(e,t){let n=this.calcCameraDistanceToSurfaceAndUpdateMinmaxWithCenterDistance(e);return n<0?oe:t/n/this._halfScreenPixelSizePerDistance}calcCameraDistanceToSurfaceAndUpdateMinmaxWithCenterDistance(e){let t=this.calculateMbsConeInRenderSR(e);if(t==null)return this.calcCameraDistanceToSurfaceAndUpdateMinmaxWithSphere(e);let n=t.calculateSurfaceDistanceFromPoint(this._camPos),r=t.calculateCenterDistanceFromPoint(this._camPos);return this._updateMinMaxDistanceToCenter(r),n}calcCameraDistanceToSurfaceAndUpdateMinmaxWithSphere(e){return this.calcCameraDistanceToCenterAndUpdateMinmax(e)-this.calculateServiceMbsInRenderSRElevationAdjusted(e).radius}calcCameraDistanceToCenterAndUpdateMinmax(e){let t=this.calculateServiceMbsInRenderSRElevationAdjusted(e),n=f(t.center,this._camPos);return this._updateMinMaxDistanceToCenter(n),n}_calculateAngleDependentLoDForSphere(e,n){let r=u(B,e,this._camPos),i=t(e),o=t(r);if(i===0||o===0)return 1;let s=(Math.abs(a(e,r))/i+n)/o;return Math.min(1,s)}calcAngleDependentLoD(e){let n=this.calculateMbsConeInRenderSR(e);if(n==null){let{center:t,radius:n}=this.calculateServiceMbsInRenderSRElevationAdjusted(e);return this._calculateAngleDependentLoDForSphere(t,n)}let{center:r,radius:i}=this.calculateServiceMbsInRenderSR(e);if(this._viewingMode===2)c(K,r),K[2]=n.lowerCenterHeight,c(q,r),q[2]=n.upperCenterHeight;else{let e=t(r);if(e===0)return 1;l(K,r,n.lowerCenterHeight/e),l(q,r,n.upperCenterHeight/e)}let o=this._calculateAngleDependentLoDForSphere(K,i),s=this._calculateAngleDependentLoDForSphere(q,i);if(this._viewingMode===2)c(J,r),J[2]=Math.max(n.lowerCenterHeight,Math.min(n.upperCenterHeight,this._camPos[2]));else{let e=t(r);if(e===0)return Math.max(o,s);let i=Math.max(n.lowerCenterHeight,Math.min(n.upperCenterHeight,a(this._camPos,r)/e));l(J,r,i/e)}return Math.max(o,s,this._calculateAngleDependentLoDForSphere(J,i))}hasLOD(e){return e.lodMetric!==0}_getDistanceToSurfaceGlobeMode(e,n){let r=t(n.center),o=t(e)-r;l(K,e,a(e,n.center)/p(e));let s=m(n.center,K),c=n.radius;if(s<=c*c)return Math.abs(o);let u=l(K,n.center,1/r),d=c*c/(2*r),g=l(q,u,r-d),_=i(J,e,g),v=i(J,_,l(Y,u,a(u,_))),y=h(J,g,l(J,v,c/t(v))),b=f(e,y);if(o>=X){let n=i(q,e,y),r=a(n,u)/t(n);r<Z&&(r=Q),b/=r}return b}_getDistanceToSurface(e,t){return this._isGlobalMode?this._getDistanceToSurfaceGlobeMode(e,t):ne(e,t)}_applyGlobalFlatAngleCorrectionToConeDistance(e,n){n.calculateClosestCenterToPoint(this._camPos,Y);let r=t(Y);if(r===0||t(this._camPos)-r<X)return e;let o=i(J,this._camPos,Y),s=t(o);if(s===0)return e;let c=a(o,Y)/(s*r);return e/(c<Z?Q:c)}calculateScreenSpaceRelativeSphere(e){let t=this.calculateServiceMbsInRenderSRElevationAdjusted(e),n=this._getDistanceToSurface(this._camPos,t),r=n+t.radius;return this._updateMinMaxDistanceToCenter(r),2*n*this._halfScreenPixelSizePerDistance}calculateScreenSpaceRelativeCone(e){let t=e.calculateCenterDistanceFromPoint(this._camPos);this._updateMinMaxDistanceToCenter(t);let n=e.calculateSurfaceDistanceFromPoint(this._camPos);return 2*(this._isGlobalMode?this._applyGlobalFlatAngleCorrectionToConeDistance(n,e):n)*this._halfScreenPixelSizePerDistance}_updateMinMaxDistanceToCenter(e){e>0?(this.minCenterDistance=Math.min(this.minCenterDistance,e),this.maxCenterDistance=Math.max(this.maxCenterDistance,e)):(this.minCenterDistance=0,this.maxCenterDistance=Math.max(this.maxCenterDistance,-e))}getLodLevel(e){if(e.lodMetric===0)return 0;if(e.childCount===0)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){let t=this._progressiveLoadFactor*this._screenspaceErrorBias,n=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,n)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case 1:{let n=this._screenSpaceDiameterMbs(e,(e.serviceMbsInIndexSR?.radius??0)*t);return this._options.angleDependentLoD&&(n*=this.calcAngleDependentLoD(e)),n<e.maxError}case 2:{let n=this.calculateMbsConeInRenderSR(e),r=n?this.calculateScreenSpaceRelativeCone(n):this.calculateScreenSpaceRelativeSphere(e);return e.maxError*t<=r}case 3:return this._screenSpaceDiameterMbs(e,e.maxError)*t<se;case 4:return this.calcCameraDistanceToSurfaceAndUpdateMinmaxWithCenterDistance(e)>e.maxError*t}return!1}distToCameraPOIRay(e){if(e==null)return 0;let t=this.calculateServiceMbsInRenderSRElevationAdjusted(e),n=t.center,r=a(n,this._cameraPOIDirection),i=r*r,o=p(n)-i;return Math.sqrt(o)-t.radius}distCameraToPOI(){return f(this._camPos,this._poi)}}function ne(e,t){let n=e[0]-t.center[0],r=e[1]-t.center[1],i=e[2]-t.center[2],a=n*n+r*r,o=t.radius;if(a<=o*o)return Math.abs(i);let s=Math.sqrt(a)-o;return Math.sqrt(i*i+s*s)}const re=g(),ie=g(),I=g(),L=new A,R=g(),z=[g(),g(),g(),g(),g(),g(),g(),g()],B=g(),V=g(),H=g(),U=g(),W=g(),G=new C,K=g(),q=g(),J=g(),Y=g();function ae(e,n,r){if(r===2)e.center[2]+=n;else{let r=t(e.center);if(r===0){e.radius+=Math.abs(n);return}l(e.center,e.center,1+n/r)}}const oe=.5*Number.MAX_VALUE,se=10,X=2e5,Z=.08,Q=1e-4,ce=.9,le=.01,$=.001;export{te as default};
2
+ import"../../../../core/has.js";import{normalize as e,length as t,set as n,equals as r,subtract as i,dot as a,len as o,sqrDist as s,copy as c,scale as l,sub as u,scaleAndAdd as d,distance as f,squaredLength as p,squaredDistance as m,add as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as _}from"../../../../geometry/ellipsoidUtils.js";import v from"../../../../geometry/SpatialReference.js";import{getSphericalPCPF as y}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingRect as b}from"../../../../geometry/projection/projectBoundingRect.js";import{projectBoundingSphere as x}from"../../../../geometry/projection/projectBoundingSphere.js";import{getProjector as ee}from"../../../../geometry/projection/projectors.js";import{create as S,fromValues as C}from"../../../../geometry/support/aaBoundingRect.js";import{signedDistance as w,getNormal as T}from"../../../../geometry/support/plane.js";import{isPlateCarree as te,webMercatorValid as ne}from"../../../../geometry/support/spatialReferenceUtils.js";import{Sphere as re}from"../../../../geometry/support/sphere.js";import{evaluateElevationAlignmentAtPoint as E}from"../graphics/elevationAlignmentUtils.js";import{ElevationContext as D}from"../graphics/ElevationContext.js";import{createContextWithoutExpressionSupport as O,extractExpressionInfo as ie}from"../graphics/featureExpressionInfoUtils.js";import{intersectBoundingRectWithMbs as k}from"./I3SUtil.js";import{Frustum as A}from"../../state/Frustum.js";import"../../support/elevationUpdateExtentUtils.js";import{Obb as j,computeOffsetObb as ae}from"../../support/orientedBoundingBox.js";import{SweptSphereCylindricalVolume as oe,SphereGlobal as se,SweptSphereConicalVolume as ce}from"../../support/SweptSphereVolume.js";import{sphereToGeographicExtent as le,intersectsGeographicExtent as ue}from"../../support/sphereExtentUtils.js";const M=1e5;class N{get _frustumPlanes(){return this._frustum.planes}constructor(e,t,n,r,i,a,o,s,c={}){this._indexSR=e,this._renderCoordsHelper=t,this._clippingArea=i,this._elevationProvider=a,this._viewingMode=o,this._options=c,this._viewDirection=g(),this._useFrustumCulling=!1,this._poi=g(),this._cameraPOIDirection=g(),this._elevationContext=null,this.minCenterDistance=1/0,this.maxCenterDistance=0,this.maxLodLevel=2,this._screenspaceErrorBias=c.screenspaceErrorBias||1,this._progressiveLoadFactor=c.progressiveLoadFactor||1,this._frustum=new A(t),this.updateCamera(n,r);let l=this._renderCoordsHelper.spatialReference;this._renderSR=l,this._renderSRSphericalPCPF=y(l),this._isGlobalMode=this._viewingMode===1,this.elevationIntersectionSpatialReference=this._isGlobalMode?this._indexSR.isWebMercator?this._indexSR:this._elevationProvider.spatialReference:l,this.updateElevationInfo(s),this._isECEFOBBInLocalMode=this._indexSR.isWGS84&&(l.isWebMercator||te(l)),this._indexSREllipsoidRadius=_(this._indexSR).radius,this._indexSRSphericalPCPF=y(e),this._projectorIndexSRToIndexSRSphericalPCPF=ee(this._indexSR,this._indexSRSphericalPCPF)}updateElevationInfo(e){e==null?this._elevationContext=null:(this._elevationContext=D.fromElevationInfo(e),this._elevationContext.setFeatureExpressionInfoContext(O(ie(e,!1))))}updateCamera(t,n){this._useFrustumCulling=n,e(this._viewDirection,t.viewForward),n&&this._frustum.update(t),this._halfScreenPixelSizePerDistance=t.screenPixelSizePerDistance/2,this._camPos=t.eye,this._updateCameraPOIDirection(),this.minCenterDistance=1/0,this.maxCenterDistance=0}setPointOfInterest(e){this._poi=e,this._updateCameraPOIDirection()}updateScreenSpaceErrorBias(e){let t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this._clippingArea=e}expandElevationRange(e,t,n){if(this._elevationContext==null)return;let r=e.serviceMbsInIndexSR;if(!r)return;let i=this._elevationContext.mode===`relative-to-scene`?`scene`:`ground`,a=this._elevationProvider;if(a.getSphereElevationRange){let e=a.getSphereElevationRange(r,this._indexSR,i);if(e){n.expandElevationRange(e);return}}let[o,s,c]=r.center,l=a.getElevation(o,s,c,this._indexSR,i);l&&n.expandElevationRangeValues(l,l);let u=t?null:a.getRootElevationRange?.();u&&n.expandElevationRange(u)}calculateServiceMbsInRenderSR(e){let{serviceMbsInRenderSR:t}=e;if(t.isValid)return t;let{serviceMbsInIndexSR:n}=e;if(!n?.isValid)return t;let r=G;return x(n,this._indexSR,r,this._renderSR),e.updateServiceMbsInRenderSR(r)}intersectsElevationUpdate(e,t){if(this._isGlobalMode&&this._indexSR.isWebMercator){let n=t.serviceMbsInIndexSR;if(!n?.isValid)return!0;let[r,i]=ne,a=i-r,o=e[2]-e[0]>=a,s=o?0:Math.round((n.center[0]-(e[0]+e[2])/2)/a)*a;return C(o?-1/0:e[0]+s,e[1],o?1/0:e[2]+s,e[3],K),k(K,n)!==0}let n=this.calculateServiceMbsInRenderSR(t);if(!n.isValid)return!0;if(!this._isGlobalMode)return k(e,n)!==0;let r=t.serviceMbsElevationUpdateExtent;return r[0]>r[2]&&(le(n,r),this.elevationIntersectionSpatialReference.isWebMercator&&Number.isFinite(r[0])&&(r[1]=Math.max(-90,r[1]),r[3]=Math.min(90,r[3]),b(r,v.WGS84,r,this.elevationIntersectionSpatialReference)||C(-1/0,-1/0,1/0,1/0,r))),ue(e,r,this.elevationIntersectionSpatialReference)}calculateServiceMbsInRenderSRElevationAdjusted(e){let{serviceMbsInRenderSRElevationAdjusted:t}=e;if(t.isValid)return t;let{serviceMbsInIndexSR:n}=e,r=this.calculateServiceMbsInRenderSR(e);if(!r.isValid||!n?.isValid)return t;let i=G;i.copyFrom(r);let{_elevationContext:a}=this;if(a){let{minElevation:t}=e,{_renderCoordsHelper:r}=this,o=n.center,s=0;if(Number.isFinite(t)){let n=0,c=0,{maxElevation:l}=e,u=o[2];switch(a.mode){case`relative-to-ground`:case`relative-to-scene`:n=a.geometryZWithOffset(u,r)+t-u,c=l-t;break;case`on-the-ground`:n=t-u,c=l-t}s=n+.5*c,i.radius+=.5*c}else i.radius<M&&(s=E(o,this._elevationProvider,a,r)-o[2]);s&&fe(i,s,this._viewingMode)}return e.updateServiceMbsInRenderSRElevationAdjusted(i)}_isGlobalMbsContainingPlanetCenter(e){return this._viewingMode===1&&t(e.center)<=e.radius}calculateMbsConeInRenderSR(e){let{mbsConeInRenderSR:t}=e;if(t)return t;if(!e.elevationRangeValid)return null;let{minElevation:n,maxElevation:r}=e;if(!Number.isFinite(n)||!(n<r))return null;let i=this.calculateServiceMbsInRenderSR(e);if(!i.isValid)return null;let a=this._elevationContext;if(a?.mode===`relative-to-ground`||a?.mode===`relative-to-scene`){let t=e.serviceMbsInIndexSR;if(!t?.isValid)return null;let i=t.center[2],o=a.geometryZWithOffset(i,this._renderCoordsHelper);if(this._viewingMode===2)n+=o,r+=o;else{let e=o-i;n+=e,r+=e}}let o=this._renderCoordsHelper.referenceEllipsoid.radius,s=this._viewingMode===2?new oe(i,n,r):this._isGlobalMbsContainingPlanetCenter(i)?new se(i,o+n,o+r):new ce(i,o+n,o+r);return e.updateMbsConeInRenderSR(s)}getAndUpdateVisibilityObbInRenderSR(e){{let t=e.visibilityObbInRenderSR;if(t)return t}let t=this._indexSREllipsoidRadius*.01,{serviceMbsInIndexSR:r,serviceObbInIndexSR:i}=e;if(i==null||!r||!i.isValid||this._isECEFOBBInLocalMode&&(i.halfSizeX>t||i.halfSizeY>t||i.halfSizeZ>t))return null;{let t=e.serviceObbInRenderSR;if(t==null)t=new j,e.serviceObbInRenderSR=t;else if(t.isValid)return t;let a=r.radius,o=0,s=0,c=i.centerZ,l=this._renderCoordsHelper,u=this._elevationContext;if(u&&e.elevationRangeValid){let{minElevation:t,maxElevation:n}=e;switch(u.mode){case`relative-to-ground`:case`relative-to-scene`:o=u.geometryZWithOffset(c,l)+t-c,s=n-t;break;case`on-the-ground`:o=t-c,s=n-t}}else if(u&&a<M){let e=n(z,i.centerX,i.centerY,c);o=E(e,this._elevationProvider,u,l)-c}let d=s>0,f=d?R:t;return i.transform(f,this._indexSR,this._renderSR,o,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),d&&ae(f,0,s,this._viewingMode,t),t}}getNodeObbInRenderSRIndependentOfElevationOffset(e){{let t=e.visibilityObbInRenderSR??e.serviceObbInRenderSR??null;if(t?.isValid)return t}let t=e.serviceObbInIndexSR;return t?this._viewingMode===2&&Math.max(t.halfSizeX,t.halfSizeY,t.halfSizeZ)>.2*this._indexSREllipsoidRadius?null:(t.transform(R,this._indexSR,this._renderSR,void 0,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),R):null}ensureElevationAgnosticBoundingVolume(e){return!e.elevationAgnosticBoundingVolume.valid&&e.level>0&&(this._viewingMode===1?this._updateElevationAgnosticBoundingVolumeGlobal(e):this._updateElevationAgnosticBoundingVolumeLocal(e)),e.elevationAgnosticBoundingVolume}_updateCameraPOIDirection(){r(this._poi,this._camPos)?this._cameraPOIDirection=this._viewDirection:(i(this._cameraPOIDirection,this._camPos,this._poi),e(this._cameraPOIDirection,this._cameraPOIDirection))}_updateElevationAgnosticBoundingVolumeGlobal(t){let n=this.getNodeObbInRenderSRIndependentOfElevationOffset(t),r=t.elevationAgnosticBoundingVolume,i=-1,s;if(n){let t=z;n.getCenter(t),e(t,t),s=t,n.getCorners(B);for(let n of B){e(n,n);let o=a(n,t);if(o<=0){r.invalidate();return}let s=Math.sqrt(Math.max(0,1-o*o));i=Math.max(i,s)}}else{let n=t.serviceMbsInRenderSR;if(!n.isValid){r.invalidate();return}let{center:a,radius:c}=n,l=o(a);if(l<c){r.invalidate();return}i=c/l,s=e(W,a)}r.set(s,i+_e)}_updateElevationAgnosticBoundingVolumeLocal(e){let t=e.elevationAgnosticBoundingVolume,n=this.getNodeObbInRenderSRIndependentOfElevationOffset(e);if(n){let e=n.getCenter(z);e[2]=0;let r=0,i=V;n.getCorners(B);for(let e of B){e[2]=0;let t=s(i,e);r=Math.max(r,t)}t.set(e,Math.sqrt(r))}else{let n=e.serviceMbsInRenderSR;if(n.isValid){let e=c(z,n.center);e[2]=0,t.set(e,n.radius)}}}isNodeVisible(e){if(!this._isMBSinClippingArea(this.calculateServiceMbsInRenderSR(e)))return!1;if(!this._useFrustumCulling)return!0;let t=this.getAndUpdateVisibilityObbInRenderSR(e);return t?t.intersectsFrustumConservativeApproximation(this._frustumPlanes):this._frustum.intersectsSphere(this.calculateServiceMbsInRenderSRElevationAdjusted(e))}isElevationAgnosticBoundingVolumeVisible(e){return!this._useFrustumCulling||!e.valid?!0:e.intersectsFrustumConservative(this._frustum,this._viewingMode,1)?this._viewingMode!==1||this._isConeVisibleInFrustum(e):!1}_isConeVisibleInFrustum(t){let n=t.radius;if(n>he)return!0;let r=this._frustumPlanes,{center:i,radius:o}=this._frustum.boundingSphere,s=t.getAxis(W),c=a(s,i),f=o+1,p=c-f,m=c+f;if(p<=0)return!0;let h=l(F,s,p),g=l(I,s,m),_=n/Math.sqrt(1-n*n);for(let t of r){let n=T(t),r=e(L,n),i=a(r,s);if(Math.abs(1-i)<ge)continue;let o=H;l(o,s,i),u(o,o,r),e(o,o);let c=de;if(d(c,h,o,p*_),!(w(t,c)<=0)&&(d(c,g,o,m*_),!(w(t,c)<=0)))return!1}return!0}isObbVisibleIndependentOfElevation(e,t){if(!this._useFrustumCulling||!e.valid)return!0;let{center:n,radius:r}=this._frustum.boundingSphere,i=r+1,o=this._frustumPlanes,s=B;if(t.getCorners(s),this._viewingMode===1){let t=e.getAxis(W),r=a(t,n),c=r-i,u=r+i;if(c<=0)return!0;for(let e of o){let n=!0;for(let r of s){let i=a(r,t),o=U;if(l(o,r,c/i),w(e,o)<=0){n=!1;break}let s=U;if(l(s,r,u/i),w(e,s)<=0){n=!1;break}}if(n)return!1}}else{let e=n[2]-i,t=n[2]+i;for(let n of o){let r=!0,i=T(n),a=i[0],o=i[1],c=i[2],l=n[3];for(let n of s){let i=a*n[0]+o*n[1]+l;if(i+c*e<=0||i+c*t<=0){r=!1;break}}if(r)return!1}}return!0}isGeometryVisible(e){return this._useFrustumCulling?e.geometryObbInRenderSR?.intersectsFrustumConservativeApproximation(this._frustumPlanes)??this.isNodeVisible(e):!0}_isMBSinClippingArea(e){return this._clippingArea==null||k(this._clippingArea,e)!==0}_screenSpaceDiameterMbs(e,t){let n=this.calcCameraDistanceToSurfaceAndUpdateMinmaxWithCenterDistance(e);return n<0?pe:t/n/this._halfScreenPixelSizePerDistance}calcCameraDistanceToSurfaceAndUpdateMinmaxWithCenterDistance(e){let t=this.calculateMbsConeInRenderSR(e);if(t==null)return this.calcCameraDistanceToSurfaceAndUpdateMinmaxWithSphere(e);let n=t.calculateSurfaceDistanceFromPoint(this._camPos),r=t.calculateCenterDistanceFromPoint(this._camPos);return this._updateMinMaxDistanceToCenter(r),n}calcCameraDistanceToSurfaceAndUpdateMinmaxWithSphere(e){return this.calcCameraDistanceToCenterAndUpdateMinmax(e)-this.calculateServiceMbsInRenderSRElevationAdjusted(e).radius}calcCameraDistanceToCenterAndUpdateMinmax(e){let t=this.calculateServiceMbsInRenderSRElevationAdjusted(e),n=f(t.center,this._camPos);return this._updateMinMaxDistanceToCenter(n),n}_calculateAngleDependentLoDForSphere(e,n){let r=u(V,e,this._camPos),i=t(e),o=t(r);if(i===0||o===0)return 1;let s=(Math.abs(a(e,r))/i+n)/o;return Math.min(1,s)}calcAngleDependentLoD(e){let n=this.calculateMbsConeInRenderSR(e);if(n==null){let{center:t,radius:n}=this.calculateServiceMbsInRenderSRElevationAdjusted(e);return this._calculateAngleDependentLoDForSphere(t,n)}let{center:r,radius:i}=this.calculateServiceMbsInRenderSR(e);if(this._viewingMode===2)c(q,r),q[2]=n.lowerCenterHeight,c(J,r),J[2]=n.upperCenterHeight;else{let e=t(r);if(e===0)return 1;l(q,r,n.lowerCenterHeight/e),l(J,r,n.upperCenterHeight/e)}let o=this._calculateAngleDependentLoDForSphere(q,i),s=this._calculateAngleDependentLoDForSphere(J,i);if(this._viewingMode===2)c(Y,r),Y[2]=Math.max(n.lowerCenterHeight,Math.min(n.upperCenterHeight,this._camPos[2]));else{let e=t(r);if(e===0)return Math.max(o,s);let i=Math.max(n.lowerCenterHeight,Math.min(n.upperCenterHeight,a(this._camPos,r)/e));l(Y,r,i/e)}return Math.max(o,s,this._calculateAngleDependentLoDForSphere(Y,i))}hasLOD(e){return e.lodMetric!==0}_getDistanceToSurfaceGlobeMode(e,n){let r=t(n.center),o=t(e)-r;l(q,e,a(e,n.center)/p(e));let s=m(n.center,q),c=n.radius;if(s<=c*c)return Math.abs(o);let u=l(q,n.center,1/r),d=c*c/(2*r),g=l(J,u,r-d),_=i(Y,e,g),v=i(Y,_,l(X,u,a(u,_))),y=h(Y,g,l(Y,v,c/t(v))),b=f(e,y);if(o>=Z){let n=i(J,e,y),r=a(n,u)/t(n);r<Q&&(r=$),b/=r}return b}_getDistanceToSurface(e,t){return this._isGlobalMode?this._getDistanceToSurfaceGlobeMode(e,t):P(e,t)}_applyGlobalFlatAngleCorrectionToConeDistance(e,n){n.calculateClosestCenterToPoint(this._camPos,X);let r=t(X);if(r===0||t(this._camPos)-r<Z)return e;let o=i(Y,this._camPos,X),s=t(o);if(s===0)return e;let c=a(o,X)/(s*r);return e/(c<Q?$:c)}calculateScreenSpaceRelativeSphere(e){let t=this.calculateServiceMbsInRenderSRElevationAdjusted(e),n=this._getDistanceToSurface(this._camPos,t),r=n+t.radius;return this._updateMinMaxDistanceToCenter(r),2*n*this._halfScreenPixelSizePerDistance}calculateScreenSpaceRelativeCone(e){let t=e.calculateCenterDistanceFromPoint(this._camPos);this._updateMinMaxDistanceToCenter(t);let n=e.calculateSurfaceDistanceFromPoint(this._camPos);return 2*(this._isGlobalMode?this._applyGlobalFlatAngleCorrectionToConeDistance(n,e):n)*this._halfScreenPixelSizePerDistance}_updateMinMaxDistanceToCenter(e){e>0?(this.minCenterDistance=Math.min(this.minCenterDistance,e),this.maxCenterDistance=Math.max(this.maxCenterDistance,e)):(this.minCenterDistance=0,this.maxCenterDistance=Math.max(this.maxCenterDistance,-e))}getLodLevel(e){if(e.lodMetric===0)return 0;if(e.childCount===0)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){let t=this._progressiveLoadFactor*this._screenspaceErrorBias,n=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,n)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case 1:{let n=this._screenSpaceDiameterMbs(e,(e.serviceMbsInIndexSR?.radius??0)*t);return this._options.angleDependentLoD&&(n*=this.calcAngleDependentLoD(e)),n<e.maxError}case 2:{let n=this.calculateMbsConeInRenderSR(e),r=n?this.calculateScreenSpaceRelativeCone(n):this.calculateScreenSpaceRelativeSphere(e);return e.maxError*t<=r}case 3:return this._screenSpaceDiameterMbs(e,e.maxError)*t<me;case 4:return this.calcCameraDistanceToSurfaceAndUpdateMinmaxWithCenterDistance(e)>e.maxError*t}return!1}distToCameraPOIRay(e){if(e==null)return 0;let t=this.calculateServiceMbsInRenderSRElevationAdjusted(e),n=t.center,r=a(n,this._cameraPOIDirection),i=r*r,o=p(n)-i;return Math.sqrt(o)-t.radius}distCameraToPOI(){return f(this._camPos,this._poi)}}function P(e,t){let n=e[0]-t.center[0],r=e[1]-t.center[1],i=e[2]-t.center[2],a=n*n+r*r,o=t.radius;if(a<=o*o)return Math.abs(i);let s=Math.sqrt(a)-o;return Math.sqrt(i*i+s*s)}const F=g(),I=g(),L=g(),R=new j,z=g(),B=[g(),g(),g(),g(),g(),g(),g(),g()],V=g(),H=g(),de=g(),U=g(),W=g(),G=new re,K=S(),q=g(),J=g(),Y=g(),X=g();function fe(e,n,r){if(r===2)e.center[2]+=n;else{let r=t(e.center);if(r===0){e.radius+=Math.abs(n);return}l(e.center,e.center,1+n/r)}}const pe=.5*Number.MAX_VALUE,me=10,Z=2e5,Q=.08,$=1e-4,he=.9,ge=.01,_e=.001;export{N as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../core/Evented.js";import n from"../../../../core/Logger.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{fromQuat as a}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/quatf64.js";import{set as c,transformMat4 as l,transformQuatValues as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as f}from"../../../../geometry/projectionUtils.js";import{projectBoundingRect as p}from"../../../../geometry/projection/projectBoundingRect.js";import{projectBoundingSphere as m}from"../../../../geometry/projection/projectBoundingSphere.js";import{create as h,allFinite as g,fromExtent as _}from"../../../../geometry/support/aaBoundingRect.js";import{getInfo as v}from"../../../../geometry/support/spatialReferenceUtils.js";import{Sphere as y}from"../../../../geometry/support/sphere.js";import{ElevationRange as b}from"../../support/ElevationRange.js";import{ElevationUpdateEvent as x}from"../../support/ElevationUpdateEvent.js";import{ProjectedElevationUpdateExtent as S,calculateElevationUpdateExtents as C,fullWorldElevationUpdateExtent as w,planetCenterProximityToleranceMeters as T}from"../../support/elevationUpdateExtentUtils.js";import{Intersector as E}from"../../webgl-engine/lib/Intersector.js";let D=class extends t{constructor(e){super(e),this._renderCoordsHelper=e.view.renderCoordsHelper,this._renderSR=this._renderCoordsHelper.spatialReference,this._layerElevationSource=e.layerElevationSource,this._projectedExtent=new S(this._renderCoordsHelper)}initialize(){this._intersector=new E(this.view.state.viewingMode),this._intersector.options.store=0,this._intersector.options.normalRequired=!1}get spatialReference(){return this.view?.elevationProvider?.spatialReference}getElevation(e,t,r,i){let a=this._renderCoordsHelper,o=c(A,e,t,r);if(!a.toRenderCoords(o,i,o))return n.getLogger(this).error(`could not project point to compute elevation`),null;let{layerElevationSource:s,_intersector:l,intersectionHandler:u}=this,d=s.fullExtent,f=d!=null&&Number.isFinite(d.xmin)&&Number.isFinite(d.xmax)&&Number.isFinite(d.ymin)&&Number.isFinite(d.ymax)&&Number.isFinite(d.zmin)&&Number.isFinite(d.zmax)?new b(d.zmin,d.zmax):s.elevationRange;if(f==null)return null;let p=s.elevationOffset,m=f.minElevation+p,h=f.maxElevation+p,g=a.setAltitude(j,h,o),_=a.setAltitude(M,m,o);return l.reset(g,_,this.view.state.camera),u.intersectRay(l,null,g,_,null,!0),l.results.min.getIntersectionPoint(o)?a.getAltitude(o):null}getElevations(e,t,n){let{groundSpatialReference:r}=this.view;for(let i=0;i<t;++i){let t=i*3,a=e[t],o=e[t+1],s=this.getElevation(a,o,0,r);n(i,s)}}getSphereElevationRange(e,t){return m(e,t,k,this._renderSR),this._layerElevationSource.getElevationRange(k)}getRootElevationRange(){let e=this.layerElevationSource.fullExtent;return e?.hasZ?new b(e.zmin,e.zmax):null}notifyObjectsChanged(e){this._notifyObjectsChanged(e.length,t=>{for(let n of e)if(!t(n))break})}notifyObjectsChangedFunctional(e,t){this._notifyObjectsChanged(e,t)}notifyObjectChanged(e){this._notifyObjectsChanged(1,t=>{t(e)})}_notifyObjectsChanged(e,t){if(e===0)return;let n=this.spatialReference;if(n==null)return;if(!f(this._renderSR,n)){this._emitFullExtentElevationChange(n);return}let r=new Float64Array(4*e),i=!1,a=0;t(e=>this._computeObjectExtent(e,r,a,n)?(a++,!0):(i=!0,!1)),i?this._emitFullExtentElevationChange(n):this._emitElevationChangeEvents(r,n)}_computeObjectExtent(e,t,n,r){if(this.view.state.viewingMode===1&&I(e))return!1;let i=this._projectedExtent;return A[0]=e.centerX,A[1]=e.centerY,A[2]=e.centerZ,i.reset(A,e.radius,r),!this._expandExtent(e,i,r)||!g(i.extent)?!1:(t.set(i.extent,4*n),!0)}_emitElevationChangeEvents(e,t){for(let n of C(e,t))this._emitElevationChangeEvent(n,t)}_emitFullExtentElevationChange(e){let t=h(),n=this._layerElevationSource.fullExtent;if(n!=null&&p(_(n,P),n.spatialReference,t,e)&&g(t)){this._emitElevationChangeEvent(t,e);return}let r=v(e);r!=null&&this._emitElevationChangeEvent(w(e,r),e)}_emitElevationChangeEvent(e,t){let n=new x(t,e,this.intersectionHandler.isGround?`ground`:`scene`);this.emit(`elevation-change`,n)}_expandExtent(e,t,n){a(O,e.getQuaternion(N)),O[12]=e.centerX,O[13]=e.centerY,O[14]=e.centerZ;let{halfSizeX:r,halfSizeY:i,halfSizeZ:o}=e;for(let e=0;e<8;++e)if(A[0]=e&1?r:-r,A[1]=e&2?i:-i,A[2]=e&4?o:-o,l(A,A,O),t.addRenderPoint(A,n)==null)return!1;for(let e=0;e<2;++e)if(A[0]=0,A[1]=0,A[2]=e===0?o:-o,l(A,A,O),t.addRenderPoint(A,n)==null)return!1;return!0}};e([r({constructOnly:!0})],D.prototype,`layerElevationSource`,void 0),e([r({constructOnly:!0})],D.prototype,`intersectionHandler`,void 0),e([r({constructOnly:!0})],D.prototype,`view`,void 0),e([r()],D.prototype,`spatialReference`,null),D=e([i(`esri.views.3d.layers.i3s.LayerElevationProvider`)],D);const O=o(),k=new y,A=d(),j=d(),M=d(),N=s(),P=h(),F=d();function I(e){F[0]=-e.centerX,F[1]=-e.centerY,F[2]=-e.centerZ,e.getQuaternion(N),u(F,F,-N[0],-N[1],-N[2],N[3]);let t=Math.max(Math.abs(F[0])-e.halfSizeX,0),n=Math.max(Math.abs(F[1])-e.halfSizeY,0),r=Math.max(Math.abs(F[2])-e.halfSizeZ,0);return t*t+n*n+r*r<=T*T}export{D as LayerElevationProvider};
2
+ import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../core/Evented.js";import n from"../../../../core/Logger.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/quatf64.js";import{set as o,transformQuatValues as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as l}from"../../../../geometry/projectionUtils.js";import{projectBoundingRect as u}from"../../../../geometry/projection/projectBoundingRect.js";import{projectBoundingSphere as d}from"../../../../geometry/projection/projectBoundingSphere.js";import{create as f,allFinite as p,fromExtent as m}from"../../../../geometry/support/aaBoundingRect.js";import{getInfo as h}from"../../../../geometry/support/spatialReferenceUtils.js";import{Sphere as g}from"../../../../geometry/support/sphere.js";import{ElevationRange as _}from"../../support/ElevationRange.js";import{ElevationUpdateEvent as v}from"../../support/ElevationUpdateEvent.js";import{ProjectedElevationUpdateExtent as y,calculateElevationUpdateExtents as b,fullWorldElevationUpdateExtent as x,planetCenterProximityToleranceMeters as S}from"../../support/elevationUpdateExtentUtils.js";import{Intersector as C}from"../../webgl-engine/lib/Intersector.js";let w=class extends t{constructor(e){super(e),this._renderCoordsHelper=e.view.renderCoordsHelper,this._renderSR=this._renderCoordsHelper.spatialReference,this._layerElevationSource=e.layerElevationSource,this._projectedExtent=new y(this._renderCoordsHelper)}initialize(){this._intersector=new C(this.view.state.viewingMode),this._intersector.options.store=0,this._intersector.options.normalRequired=!1}get spatialReference(){return this.view?.elevationProvider?.spatialReference}getElevation(e,t,r,i){let a=this._renderCoordsHelper,s=o(E,e,t,r);if(!a.toRenderCoords(s,i,s))return n.getLogger(this).error(`could not project point to compute elevation`),null;let{layerElevationSource:c,_intersector:l,intersectionHandler:u}=this,d=c.fullExtent,f=d!=null&&Number.isFinite(d.xmin)&&Number.isFinite(d.xmax)&&Number.isFinite(d.ymin)&&Number.isFinite(d.ymax)&&Number.isFinite(d.zmin)&&Number.isFinite(d.zmax)?new _(d.zmin,d.zmax):c.elevationRange;if(f==null)return null;let p=c.elevationOffset,m=f.minElevation+p,h=f.maxElevation+p,g=a.setAltitude(k,h,s),v=a.setAltitude(A,m,s);return l.reset(g,v,this.view.state.camera),u.intersectRay(l,null,g,v,null,!0),l.results.min.getIntersectionPoint(s)?a.getAltitude(s):null}getElevations(e,t,n){let{groundSpatialReference:r}=this.view;for(let i=0;i<t;++i){let t=i*3,a=e[t],o=e[t+1],s=this.getElevation(a,o,0,r);n(i,s)}}getSphereElevationRange(e,t){return d(e,t,T,this._renderSR),this._layerElevationSource.getElevationRange(T)}getRootElevationRange(){let e=this.layerElevationSource.fullExtent;return e?.hasZ?new _(e.zmin,e.zmax):null}notifyObjectsChanged(e){this._notifyObjectsChanged(e.length,t=>{for(let n of e)if(!t(n))break})}notifyObjectsChangedFunctional(e,t){this._notifyObjectsChanged(e,t)}notifyObjectChanged(e){this._notifyObjectsChanged(1,t=>{t(e)})}_notifyObjectsChanged(e,t){if(e===0)return;let n=this.spatialReference;if(n==null)return;if(!l(this._renderSR,n)){this._emitFullExtentElevationChange(n);return}let r=new Float64Array(4*e),i=!1,a=0;t(e=>this._computeObjectExtent(e,r,a,n)?(a++,!0):(i=!0,!1)),i?this._emitFullExtentElevationChange(n):this._emitElevationChangeEvents(r,n)}_computeObjectExtent(e,t,n,r){if(this.view.state.viewingMode===1&&P(e))return!1;let i=this._projectedExtent;return E[0]=e.centerX,E[1]=e.centerY,E[2]=e.centerZ,i.reset(E,e.radius,r),!this._expandExtent(e,i,r)||!p(i.extent)?!1:(t.set(i.extent,4*n),!0)}_emitElevationChangeEvents(e,t){for(let n of b(e,t))this._emitElevationChangeEvent(n,t)}_emitFullExtentElevationChange(e){let t=f(),n=this._layerElevationSource.fullExtent;if(n!=null&&u(m(n,M),n.spatialReference,t,e)&&p(t)){this._emitElevationChangeEvent(t,e);return}let r=h(e);r!=null&&this._emitElevationChangeEvent(x(e,r),e)}_emitElevationChangeEvent(e,t){let n=new v(t,e,this.intersectionHandler.isGround?`ground`:`scene`);this.emit(`elevation-change`,n)}_expandExtent(e,t,n){e.getCorners(O);for(let e=0;e<8;++e){let r=O[e];if(t.addRenderPoint(r,n)==null)return!1}for(let e=0;e<D.length;e+=2)if(!t.addRenderEdge(O[D[e]],O[D[e+1]],n))return!1;return!0}};e([r({constructOnly:!0})],w.prototype,`layerElevationSource`,void 0),e([r({constructOnly:!0})],w.prototype,`intersectionHandler`,void 0),e([r({constructOnly:!0})],w.prototype,`view`,void 0),e([r()],w.prototype,`spatialReference`,null),w=e([i(`esri.views.3d.layers.i3s.LayerElevationProvider`)],w);const T=new g,E=c(),D=[0,1,2,3,4,5,6,7,0,2,1,3,4,6,5,7,0,4,1,5,2,6,3,7],O=Array.from({length:8},()=>c()),k=c(),A=c(),j=a(),M=f(),N=c();function P(e){N[0]=-e.centerX,N[1]=-e.centerY,N[2]=-e.centerZ,e.getQuaternion(j),s(N,N,-j[0],-j[1],-j[2],j[3]);let t=Math.max(Math.abs(N[0])-e.halfSizeX,0),n=Math.max(Math.abs(N[1])-e.halfSizeY,0),r=Math.max(Math.abs(N[2])-e.halfSizeZ,0);return t*t+n*n+r*r<=S*S}export{w as LayerElevationProvider};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{filterInPlace as n}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import r from"../../../../core/Logger.js";import{getOrCreateMapValue as i}from"../../../../core/MapUtils.js";import{isAbortError as a,throwIfAborted as o}from"../../../../core/promiseUtils.js";import s from"../../../../core/ReactiveMap.js";import{on as c,watch as l}from"../../../../core/reactiveUtils.js";import{schedule as u}from"../../../../core/scheduling.js";import{signal as d}from"../../../../core/signal.js";import{sqlAnd as f}from"../../../../core/sql.js";import{property as p,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{getEpsilon as h}from"../../../../core/libs/gl-matrix-2/math/common.js";import{create as g,equals as _,clone as v,expand as y,toExtent as b,width as x,height as S}from"../../../../geometry/support/aaBoundingRect.js";import{getObjectId as C,hasVertices as w,computeAABR as T}from"../../../../layers/graphics/dehydratedFeatures.js";import{geometryKey as E,transferGeometryKey as D,identicalTransferGeometry as O,completeDehydratedFeatureFromTransfer as k}from"../../../../layers/graphics/transferFeatures.js";import A from"../../../../rest/support/QuantizationParameters.js";import j from"../../../../rest/support/Query.js";import{FeatureMemory as M}from"./FeatureMemory.js";import{MultiFeatureReference as ee,SingleFeatureReference as te}from"./featureReference.js";import{failedFeatureCount as N,FeatureTile as P}from"./FeatureTile.js";import{virtualDisplayFilterHighlightTileId as F,virtualSnapshotTileId as I}from"./FeatureTileDescriptor.js";import{tilesAreRelated as L}from"../../terrain/tileUtils.js";import{ImmediateTask as R,TaskPriority as z}from"../../../support/Scheduler.js";let B=class extends t{set maximumNumberOfFeatures(e){e||=1/0;let t=this._get(`maximumNumberOfFeatures`);e===t||e<1||(this._set(`maximumNumberOfFeatures`,e),this._maximumFeaturesUpdated(t,e))}set memoryFactor(e){this.memoryFactor!==e&&(this._set(`memoryFactor`,e),this._setDirty())}set lodFactor(e){this.lodFactor!==e&&(this._set(`lodFactor`,e),this._supportsResolution&&this.refetch())}get useTileCount(){return this._useTileCount&&this.context.query.queryFeatureCount!=null}set useTileCount(e){this._useTileCount=e,this.notifyChange(`useTileCount`)}get updating(){return this._dirty||!!this._pendingEdits||this._isFetching||(this.tileDescriptors?.updating??!1)}get readyToRun(){return this._dirty}get usedMemory(){return this._memory.usedMemory}get usedMemoryPerFeature(){return this._memory.usedMemoryPerFeature}get totalVertices(){let e=0;return this._featureTiles.forEach(t=>e+=t.numVertices),e}get totalFeatures(){let e=0;return this._featureTiles.forEach(t=>e+=t.numFeatures),e}get showsAllFeatures(){if(this._paused||this.dataUpdating)return!1;for(let e of this._featureTiles.values())if(!this.hasFullGeometries&&e.emptyFeatureRatio!==0||!e.showsAllFeatures)return!1;return!0}get hasFullGeometries(){return!this._supportsResolution||this.tileDescriptors?.some(V)||!this.context.capabilities.supportsQuantization&&this.context.geometryType!==`polyline`}set filterExtent(e){if(e!=null&&this.context.tilingScheme&&!e.spatialReference.equals(this.context.tilingScheme.spatialReference)){r.getLogger(this).error(`#filterExtent=`,`extent needs to be in the same spatial reference as the tiling scheme`);return}let t=this._get(`filterExtent`);if(t===e||t!=null&&e&&t.equals(e))return;let n=e==null?null:e.clone();this._set(`filterExtent`,n),this._reclip(n,t)}_updateTileZQuantization(e){if(this.context.viewingMode===1){let t=e.computeZQuantizationFactor();this._zQuantizationFactor.value<t&&(this._zQuantizationFactor.value=t)}}get _tileZQuantization(){return this.context.isDraped?1:this._zQuantizationFactor.value}constructor(e){super(e),this._useTileCount=!1,this.dataUpdating=!1,this.updatingTotal=0,this.updatingRemaining=0,this.expectedFeatureDiff=0,this.maximumNumberOfFeaturesExceeded=!1,this._fullRatio=1,this._farRatio=1,this._zQuantizationFactor=d(1),this._changes={updates:{adds:[],removes:[]},adds:[],removes:[]},this._featureTiles=new s,this._displayingFeatureReferences=new Map,this._numDisplayingFeatureReferences=0,this._memory=new M(E),this._dirty=!1,this._suspended=!0,this._pendingEdits=null,this._applyEditsTilesUpdated=!1,this.snappingComplexityExceeded=!0,this._isFetching=!1;let t=e.context;this._frameTask=t.scheduler?.registerTask(z.FEATURE_TILE_FETCHER,this)??R,this.FeatureReferenceClass=t.capabilities.supportsMultipleResolutions?ee:te,this._objectIdField=t.objectIdField}initialize(){this.addHandles([c(()=>this.tileDescriptors,`change`,()=>this._setDirty(),{onListenerAdd:()=>this._setDirty(),onListenerRemove:()=>this._setDirty()}),l(()=>this._tileZQuantization,()=>this.refetch())]),this._setDirty()}destroy(){this._frameTask.remove(),this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._removeTile(e)}),this._featureTiles.clear(),this._displayingFeatureReferences.clear(),this._pendingEdits?.controller.abort(),this._pendingEdits=null}get _paused(){return this._suspended||!!this._pendingEdits}restart(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._clearTile(e),this._resetFetchTile(e)}),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._setDirty()}refetch(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._resetFetchTile(e)}),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._setDirty()}refetchDisplayFilterHighlightTile(){let e=this._featureTiles.get(F);e&&(this._cancelFetchTile(e),this._resetFetchTile(e),this._setDirty())}suspend(){this._suspended||(this._suspended=!0,this._pause(),this._setDirty())}resume(){this._suspended&&(this._suspended=!1,this._unpause())}getMissingAttributesForFeature(e){for(let t of this._featureTiles.values()){let n=t.missingAttributes?.get(e);if(n!=null)return n}}_pause(){this._paused&&(this._featureTiles.forEach(e=>this._cancelFetchTile(e)),this._updated())}_unpause(){this._paused||this._setDirty()}get availableFields(){let e=null;return this._featureTiles.forEach(t=>{t.displayingFeatures!=null&&t.displayingFeatures.length!==0&&(e==null?e=new Set(t.availableFields):e.forEach(n=>{t.availableFields?.has(n)||e.delete(n)}))}),e??new Set}applyEdits(e){this._pendingEdits||(this._pendingEdits={edits:Promise.resolve(),count:0,controller:new AbortController},this._pause());let t=this._pendingEdits;t.count++;let n=t.edits.then(()=>e.result.catch(e=>{if(a(e))throw e;return null}).then(e=>e&&(this._applyEditsDeleteFeatures(e.deletedFeatures),this._applyEditsAddUpdateFeatures(e.addedFeatures,e.updatedFeatures,t.controller.signal).then(()=>e))).then(e=>(--t.count===0&&(this._pendingEdits===t&&(this._pendingEdits=null),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._applyEditsTilesUpdated=!1,this._unpause()),e)));return t.edits=n,this._updated(),n}_applyEditsDeleteFeatures(e){if(e.length===0)return;let t=this.context.globalIdField,n=t&&this.availableFields.has(t),i=new Set,a=this._objectIdField;e.forEach(({objectId:e,globalId:o})=>{(!e||e<0)&&t&&o&&(n||r.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected in the view`),e=this._objectIdFromGlobalId(o,a,t)),e!=null&&e>=0&&i.add(e)}),this._featureTiles.forEach(e=>{if(!e.features)return;let t=e.features.filter(e=>!i.has(C(e,this._objectIdField)));t.length!==e.features.length&&(this._applyEditsTileUpdated(),e.setFeatures(t,0,e.availableFields,e.missingAttributes),this._updateTileZQuantization(e),this._invalidateCounts())})}_objectIdFromGlobalId(e,t,n){if(e==null)return null;let r=this.features.find(t=>t.attributes?.[n]===e);return r?C(r,t):null}async _applyEditsAddUpdateFeatures(e,t,n){let{objectIdField:i,globalIdField:a}=this.context,o=a&&this.availableFields.has(a),s=new Set,c=new Set;for(let t of e){let e=t.objectId;e!=null&&s.add(e)}for(let{objectId:e,globalId:n}of t){let t=e;(t==null||t<0)&&a&&(o||r.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${a} to be included the layer's outFields for updates to be reflected in the view`),t=this._objectIdFromGlobalId(n,i,a)),t!=null&&t>=0&&(s.add(t),c.add(t))}if(s.size===0)return;let l=[];this._featureTiles.forEach(e=>{let t=this._applyEditsAddUpdateTile(e,s,c,n);l.push(t)}),this._updated(),await Promise.allSettled(l)}async _applyEditsAddUpdateTile(e,t,n,r){if(!e.features)return;e.fetchingResolution=e.descriptor.resolution;let i=this._createQuery(e);i.resultType=void 0,i.cacheHint=!1,i.objectIds=Array.from(t);let a=await this.context.query.queryFeaturesDehydrated(i,{signal:r,timeout:$}),o=null;if(n.size>0){let t=e.features.filter(e=>!n.has(C(e,this._objectIdField)));t.length!==e.features.length&&(o=t)}if(a.features.length>0){o||=e.features.slice();for(let e of a.features)o.push(e)}o&&(e.hasPreciseFeatureCount&&(e.numFeatures=Math.max(e.numFeatures,o.length)),this._applyEditsTileUpdated(),e.setFeatures(o,0,q(e.availableFields,a.fields),J(e.missingAttributes,a.missingAttributes),void 0,!1),this._updateTileZQuantization(e),this._invalidateCounts())}_applyEditsTileUpdated(){this._applyEditsTilesUpdated||(this._applyEditsTilesUpdated=!0,this._updated())}_queryFeatures(e,t,n){return this.context.query.queryFeaturesDehydrated(e,{signal:n,timeout:$,completeFeatureFromTransfer:(e,n,r)=>{let i=D(e.geometry,n,t),a=this._memory.findGeometry(i,t=>O(e.geometry,n,t));a?e.geometry=a:k(e,n,r)}})}_setDirty(){this._dirty=!0,this._updated()}runTask(e){let t=this._frameTask.processQueue(e);if(!this._dirty||!this.initialized)return t;this._dirty=!1;let n=this._featureTilesArray;if(this._markTilesNotAlive(n),!e.run(()=>this._addTiles(n,e))||!e.run(()=>this._filterExtentTiles(n,e))||!e.run(()=>this._removeTiles(n,e))||e.done){this._setDirty();return}let r=this._sortTiles(n);(!e.run(()=>this._showTiles(r,e))||!e.run(()=>this._fetchTiles(r,e))||!e.run(()=>this._updateMemoryEstimates(r,e)))&&this._setDirty(),this._updated(),this.updating||(this._updateMaximumNumberOfFeaturesExceeded(),this._updateSnappingComplexityExceeded(r))}_updateSnappingComplexityExceeded(e){let t=ie;for(let n of e){if(V(n)||t<=0)break;if(!H(n)&&(t--,n.sampledDensityEstimate>re)){this.snappingComplexityExceeded=!0;return}}this.snappingComplexityExceeded=this._featureTiles.size===0}_markTilesNotAlive(e){for(let t of e)t.alive=!1}_addTiles(e,t){return this._suspended||!this.tileDescriptors?!1:(this.tileDescriptors.forEach(n=>{let r=this._featureTiles.get(n.id);r?r.alive=!0:t.done||(e.push(this._addTile(n)),t.madeProgress())}),t.hasProgressed)}_filterExtentTiles(e,t){for(let n of e){if(t.done)break;n.alive&&(n.filtered=!n.intersects(this.filterExtent),n.filtered&&(this._clearTile(n),t.madeProgress()))}return t.hasProgressed}_removeTiles(e,t){for(let n=e.length-1;n>=0&&!t.done;n--){let r=e[n];r.alive||(this._removeTile(r),n!==e.length-1&&(e[n]=e[e.length-1]),e.pop(),t.madeProgress())}return t.hasProgressed}_sortTiles(e){return e.sort((e,t)=>e.descriptor.loadPriority-t.descriptor.loadPriority),e}_showTiles(e,t){let n=this._updateRatio(e),r=e=>{let t=this._fullRatio<1?n(e)*this._farRatio:1;e.reduceFeatures(t,this.memoryFactor,this._objectIdField,this._reduceMode)&&this._setDirty();let{numFeatures:r,fetchingResolution:i,descriptor:a,isFetched:o}=e;return this._supportsResolution&&r>0&&i!==a.resolution&&o&&(e.requestRefetch(),this._setDirty()),this._showTile(e)};for(let n of e)if(!t.run(()=>r(n))){this._setDirty();break}return t.hasProgressed}_fetchTiles(e,t){if(this._paused)return!1;let n=!1;for(let r of e){if(!r.needsFetch)continue;let e=this.context.memoryCache==null?null:this.context.memoryCache.pop(r.id);if(e?.resolution===r.displayingResolution)r.cache=e,r.numFeatures&&this._notifyDataUpdating(),this._setDirty(),this._scheduleUpdated(),t.madeProgress();else{if(this._needsNumFeatures(r)){let e=new AbortController,i=this._fetchTileCount(r,e.signal);this._handleRequest(r,i,e,()=>r.resetFetching(),()=>r.numFeatures=N),n=!0,t.madeProgress()}if(t.done)return!0}}if(n)return t.hasProgressed;for(let n of e){if(!n.needsFetch)continue;let e=new AbortController,i=this._fetchTile(n,e.signal);if(this._handleRequest(n,i,e,e=>n.fetchDone(e),e=>{n.fetchFailed=!0,this.context.logFetchError(r.getLogger(this),e)}),t.madeProgress(),t.done)return!0}return t.hasProgressed}_updateMemoryEstimates(e,t){return e.some(e=>!t.run(()=>e.updateEstimates())&&(this._setDirty(),!0)),t.hasProgressed}_reclip(e,t){if(!this.initialized)return;let n=[];this._featureTiles.forEach(r=>{r.displayingFeatures!=null&&r.displayingFeatures.length!==0&&(r.intersectionIncludingBorrowed(t,X),r.intersectionIncludingBorrowed(e,Z),_(X,Z)||n.push(r))}),this._refreshDisplayingFeatures(n),this._updated()}_refreshDisplayingFeatures(e){let t=new Set,n=this._changes.updates;for(let r of e)if(r.displayingFeatures!=null)for(let e of r.displayingFeatures){let r=C(e,this._objectIdField);if(t.has(r))continue;t.add(r);let i=this._displayingFeatureReferences.get(r).feature;n.removes.push(i),n.adds.push(i)}this._applyChanges()}_updated(){let e=0;if(this._paused||this._featureTiles.forEach(t=>t.isFetching?++e:0),this._isFetching=e>0,e>0||this._applyEditsTilesUpdated?this._notifyDataUpdating():this._dirty||this._set(`dataUpdating`,!1),this.updating){let t=0,n=0,r=0,i=0,a=0,o=this._displayingFeatureReferences.size/this._numDisplayingFeatureReferences;this._featureTiles.forEach(e=>{if(++n,e.isFetching&&e.hasPreciseFeatureCount){let t=this._maximumFeaturesForTile(e)*(1-e.emptyFeatureRatio),n=e.displayingFeatures==null?0:e.displayingFeatures.length*o;a+=t-n}e.needsFetch?++i:e.numFeatures>0&&(++r,t+=e.numFeatures)}),i+=e;let s=0,c=0;t?(c=t,s=Math.min(i*t/r,t)):(c=n,s=i),a=Math.min(this.maximumNumberOfFeatures-this.features.length,a),this._set(`updatingTotal`,c),this._set(`updatingRemaining`,s),this._set(`expectedFeatureDiff`,a)}else this._set(`updatingTotal`,0),this._set(`updatingRemaining`,0),this._set(`expectedFeatureDiff`,0);this.debugger?.update()}_updateMaximumNumberOfFeaturesExceeded(){for(let{perTileMaximumNumberOfFeaturesExceeded:e}of this._featureTiles.values())if(e){this._set(`maximumNumberOfFeaturesExceeded`,!0);return}this._set(`maximumNumberOfFeaturesExceeded`,!1)}_updateRatio(e){let t=W(e),n=e=>1/(1<<Math.max(0,t-e.descriptor.lij[0])),r=0,i=0;for(let t of e){let e=t.numFeatures;r+=e,i+=e*n(t)}return this._fullRatio=Math.min(1,this.maximumNumberOfFeatures/r),this._farRatio=this.maximumNumberOfFeatures/i,this._scheduleUpdated(),n}_maximumFeaturesUpdated(e,t){e!==t&&(t>e&&this._featureTiles.forEach(e=>{if(!e.featuresMissing)return;let t=this._maximumFeaturesForTile(e);e.isFullyFetched(t)||(this._cancelFetchTile(e),this._resetFetchTile(e))}),this._setDirty())}_addTile(e){let t=new P(e,this._memory);return this._featureTiles.set(t.id,t),this._resetFetchTile(t),this._referenceDisplayingFeaturesFromRelatedTiles(t),t}_referenceDisplayingFeaturesFromRelatedTiles(e){let t=e.displayingResolution;this._featureTiles.forEach(n=>{if(n.displayingFeatures!=null&&e!==n&&L(e.descriptor.lij,n.descriptor.lij)){e.displayingFeatures??=[],e.descriptor.extent&&n.descriptor.extent&&(e.extentIncludingBorrowedFeatures??=v(e.descriptor.extent),y(e.extentIncludingBorrowedFeatures,n.descriptor.extent,e.extentIncludingBorrowedFeatures));for(let r of n.displayingFeatures){e.displayingFeatures.push(r),this._memory.ref(r);let n=this._displayingFeatureReferences.get(C(r,this._objectIdField));n.ref(this._memory,n.feature,t),this._numDisplayingFeatureReferences++}}})}_removeTile(e){this._clearTile(e),this._featureTiles.delete(e.id)}_resetFetchTile(e){e.filtered=!e.intersects(this.filterExtent),e.filtered?e.needsFetch&&e.fetchDone(4):e.requestFetch()}_cancelFetchTile(e){let t=e.requestController;t!=null&&(e.requestController=null,e.resetFetching(),t.abort())}async _fetchTileCount(e,t){e.numFeatures=await this.context.query.queryFeatureCount(this._createFeatureCountQuery(e),{signal:t}),this._updateRatio(this._featureTilesArray)}async _fetchTile(e,t){e.fetchFailed=!1;let n=this._maximumFeaturesForTile(e);if(n<=0)return(!e.hasPreciseFeatureCount||e.numFeatures!==0)&&(e.fetchFailed=!0),G(e),e.fetchInformation.value=`Empty tile`,4;let r=this._getMaxRecordCount(e),i=Math.ceil(n/r);if(e.fetchingResolution=e.descriptor.resolution,U(e)||!this.context.capabilities.supportsMaxRecordCountFactor||e.numFeatures<=n&&i>j.MAX_MAX_RECORD_COUNT_FACTOR)return this._fetchPagedTile(e,t);let a=this._createQuery(e);if(a.maxRecordCountFactor=i,e.isRefetching&&e.features&&e.features.length>0){let t=Math.ceil(e.features.length/(1-e.emptyFeatureRatio)/r);a.maxRecordCountFactor=Math.max(t+1,a.maxRecordCountFactor)}e.fetchInformation.value=`Single fetch\n${n} features`;let{features:s,exceededTransferLimit:c,fields:l,missingAttributes:u}=await this._queryFeatures(a,e.fetchingResolution,t),d=c||a.maxRecordCountFactor>=j.MAX_MAX_RECORD_COUNT_FACTOR||n===this._totalFeaturesForTile(e)?5:4,f=await this._frameTask.schedule(()=>{e.exceededTransferLimit.value=!!c;let t=this._removeEmptyFeatures(s,this._getEffectiveTileResolution(e));return e.fetchInformation.value=`Single fetch\n${s.length}/${n} features`,e.setFeatures(s,t,K(l),J(void 0,u)),this._updateTileZQuantization(e),this._maximumFeaturesForTile(e)>n?1:d},t);return o(t),this._invalidateCounts(),f}async _fetchPagedTile(e,t){let n=0,r=0,i,a=0,s=this._maximumFeaturesForTile(e)-a,c=this._getMaxRecordCount(e),l=null,u;for(;;){let d=this._createQuery(e),f=this._setPagingParameters(d,n,s,c);e.fetchInformation.value=`Paged fetch\n${e.features?.length}/${s} features`;let{features:p,exceededTransferLimit:m,fields:h,missingAttributes:g}=await this._queryFeatures(d,e.fetchingResolution,t);if(await this._frameTask.schedule(()=>{f&&(n+=d.num),a+=p.length,r+=this._removeEmptyFeatures(p,this._getEffectiveTileResolution(e)),e.exceededTransferLimit.value=!!m,i=i?.concat(p)??p,l=q(l,h),u=J(u,g),e.setFeatures(i,r,l,u),this._updateTileZQuantization(e),this._invalidateCounts(),this._setDirty()},t),o(t),s=this._maximumFeaturesForTile(e)-(i?.length??0),!f||!m||s<=0)return m?4:5}}_createFeatureCountQuery(e){let t=this._createQuery(e);return this.context.capabilities.supportsCacheHint&&(t.resultType=void 0,t.cacheHint=!0),t}_createQuery(e){let t=this.context.createQuery();if(t.resultType=this._resultType(e),!U(e)&&e.descriptor.extent&&this.context.tilingScheme&&(t.geometry=b(e.descriptor.extent,this.context.tilingScheme.spatialReference)),this._setResolutionParams(t,e),t.resultType!==`tile`&&this.context.capabilities.supportsCacheHint&&(t.cacheHint=!0),H(e)){let{highlightIds:e}=this.context;e&&e.length>Y&&r.getLogger(this).warn(`highlight-too-many-features`,`highlight is limited to ${Y} features on large layers configured with a display filter to avoid performance issues`),t.objectIds=e?.slice(0,Y)}else!V(e)&&this.context.effectiveDisplayFilter&&(t.where=f(t.where,this.context.effectiveDisplayFilter.where));return t}_setPagingParameters(e,t,n,r){return this.context.capabilities.supportsPagination?(e.start=t,n>0&&this.context.capabilities.supportsMaxRecordCountFactor?(e.maxRecordCountFactor=Math.ceil(n/r),e.num=Math.min(e.maxRecordCountFactor*r,n)):e.num=Math.min(r),!0):!1}_getEffectiveTileResolution(e){if(U(e)||!this._supportsResolution)return null;let t=this.context.viewingMode===1&&this.context.tilingScheme?this.context.tilingScheme.resolutionAtLevel(3):1/0;return Math.min(e.fetchingResolution,t)/this.lodFactor/this._tileZQuantization}get _supportsResolution(){return this.context.capabilities.supportsMultipleResolutions&&this.context.geometryType!==`point`}_setResolutionParams(e,t){let n=this._getEffectiveTileResolution(t);n!=null&&(this.context.capabilities.supportsQuantization?e.quantizationParameters=new A({mode:`view`,originPosition:`upper-left`,tolerance:n,extent:this.context.fullExtent}):this.context.geometryType===`polyline`&&(e.maxAllowableOffset=n))}_removeEmptyFeatures(e,t){let r=e.length;if(t&&this._supportsResolution){let r=t*(1+h());n(e,({geometry:e})=>!e||!w(e)?!1:(T(e,Q),x(Q)>r||S(Q)>r))}else n(e,({geometry:e})=>w(e));return r-e.length}_needsNumFeatures(e){return this.useTileCount&&e.needsFeatureCount&&!V(e)}_getMaxRecordCount(e){switch(this._resultType(e)){case`tile`:if(this.context.tileMaxRecordCount)return this.context.tileMaxRecordCount;break;case`standard`:if(this.context.standardMaxRecordCount)return this.context.standardMaxRecordCount}return this.context.maxRecordCount||Y}_resultType(e){if(this.context.capabilities.supportsResultType)return V(e)?`standard`:`tile`}get _reduceMode(){let e=this.context.geometryType;return e===`polygon`||e===`polyline`?0:1}_handleRequest(e,t,n,r,i){e.startFetch(),e.requestController=n;let o=!1;t.then(t=>{e.requestController=null,r(t)}).catch(t=>{e.requestController===n&&(e.requestController=null,e.fetchDone(4)),a(t)?o=!0:i(t)}).then(()=>{o||this._setDirty(),this._scheduleUpdated()})}_scheduleUpdated(){this.hasHandles(`scheduleUpdated`)||this.addHandles(u(()=>{this.removeHandles(`scheduleUpdated`),this._updated()}),`scheduleUpdated`)}_showTile(e){if(e.displayingFeatures&&!e.needsDisplayUpdate)return!1;let t=e.features;if(e.featureLimit===0||!t){let t=e.displayingFeatures!=null&&e.displayingFeatures.length>0;return this._hideTileFeatures(e),e.displayingFeatures=[],t}let n=e.fetchingResolution,{adds:r,updates:i}=this._changes,a=Math.min(e.featureLimit,t.length);for(let e=0;e<a;++e){let a=t[e],o=C(a,this._objectIdField),s=this._displayingFeatureReferences.get(o);if(this._memory.ref(a),s){let{oldVersion:e,newVersion:t}=s.ref(this._memory,a,n);e!==t&&(e&&i.removes.push(e),t&&i.adds.push(t))}else this._displayingFeatureReferences.set(o,new this.FeatureReferenceClass(a,n,this._memory)),r.push(a);this._numDisplayingFeatureReferences++}return this._hideTileFeatures(e),e.displayingResolution=e.fetchingResolution,this._applyChanges(),e.displayingFeatures=t.slice(0,a),!0}_hideTile(e){this._cancelFetchTile(e),this._hideTileFeatures(e)}_hideTileFeatures(e){if(e.displayingFeatures==null)return;let{updates:t,removes:n}=this._changes;for(let r of e.displayingFeatures){this._memory.unref(r);let i=C(r,this._objectIdField),a=this._displayingFeatureReferences.get(i);if(!a)continue;let{oldVersion:o,newVersion:s}=a.unref(this._memory,e.displayingResolution);this._numDisplayingFeatureReferences--,o!==s&&(s==null?(this._displayingFeatureReferences.delete(i),o&&n.push(o)):(t.adds.push(s),o&&t.removes.push(o)))}this._applyChanges(),e.displayingFeatures=null}_notifyDataUpdating(){this._get(`dataUpdating`)||this._set(`dataUpdating`,!0)}_applyChanges(){let e=this._changes.updates;e.removes.length>0&&(this._notifyDataUpdating(),this.features.removeMany(e.removes),e.removes.length=0),e.adds.length>0&&(this._notifyDataUpdating(),this.features.addMany(e.adds),e.adds.length=0);let t=this._changes.adds,n=this._changes.removes,r=Math.min(t.length,n.length),i=0;for(;i<r;){let e=Math.min(i+ne,r);this._notifyDataUpdating(),this.features.addMany(t.slice(i,e)),this.features.removeMany(n.slice(i,e)),i=e}t.length>r&&(this._notifyDataUpdating(),this.features.addMany(i===0?t:t.slice(i))),n.length>r&&(this._notifyDataUpdating(),this.features.removeMany(i===0?n:n.slice(i))),t.length=0,n.length=0}_clearTile(e){this._hideTile(e),e.features&&this.context.memoryCache!=null&&this.context.memoryCache.put(e.id,e.cache),e.setFeatures(null,0,null,void 0),this._invalidateCounts()}_invalidateCounts(){this.notifyChange(`totalVertices`),this.notifyChange(`totalFeatures`)}get _featureTilesArray(){return Array.from(this._featureTiles.values())}get featureTiles(){return this._featureTiles}get storedFeatures(){return this._featureTilesArray.reduce((e,t)=>e+(t.features?t.features.length:0),0)}get missingTiles(){return this._featureTiles.values().reduce((e,t)=>e+(t.needsFetch||t.isFetching?1:0),0)}_totalFeaturesForTile(e){return e.hasPreciseFeatureCount?e.numFeatures:this.maximumNumberOfFeatures}_maximumFeaturesForTile(e){let t=this._totalFeaturesForTile(e),n=this._fullRatio<1?this._farRatio:1;return Math.min(Math.ceil(t*n/(1-e.emptyFeatureRatio)),t)}get test(){}};e([p({constructOnly:!0})],B.prototype,`features`,void 0),e([p({constructOnly:!0})],B.prototype,`context`,void 0),e([p()],B.prototype,`tileDescriptors`,void 0),e([p({value:1/0})],B.prototype,`maximumNumberOfFeatures`,null),e([p({value:1})],B.prototype,`memoryFactor`,null),e([p({value:1})],B.prototype,`lodFactor`,null),e([p()],B.prototype,`useTileCount`,null),e([p({readOnly:!0})],B.prototype,`updating`,null),e([p({readOnly:!0})],B.prototype,`dataUpdating`,void 0),e([p({readOnly:!0})],B.prototype,`updatingTotal`,void 0),e([p({readOnly:!0})],B.prototype,`updatingRemaining`,void 0),e([p({readOnly:!0})],B.prototype,`expectedFeatureDiff`,void 0),e([p()],B.prototype,`usedMemory`,null),e([p()],B.prototype,`usedMemoryPerFeature`,null),e([p({readOnly:!0})],B.prototype,`maximumNumberOfFeaturesExceeded`,void 0),e([p({readOnly:!0})],B.prototype,`totalVertices`,null),e([p({readOnly:!0})],B.prototype,`totalFeatures`,null),e([p({readOnly:!0})],B.prototype,`showsAllFeatures`,null),e([p({readOnly:!0})],B.prototype,`hasFullGeometries`,null),e([p()],B.prototype,`filterExtent`,null),e([p()],B.prototype,`_dirty`,void 0),e([p()],B.prototype,`_suspended`,void 0),e([p()],B.prototype,`_pendingEdits`,void 0),e([p()],B.prototype,`_applyEditsTilesUpdated`,void 0),e([p()],B.prototype,`_paused`,null),e([p()],B.prototype,`snappingComplexityExceeded`,void 0),e([p()],B.prototype,`_isFetching`,void 0),B=e([m(`esri.views.3d.layers.support.FeatureTileFetcher3D`)],B);function V(e){return e.id===I}function H(e){return e.id===F}function U(e){return V(e)||H(e)}function W(e){let t=0;for(let n of e)n.features&&n.features.length>0&&n.alive&&(t=Math.max(t,n.descriptor.lij[0]));return t}function G(e){e.setFeatures([],0,null,void 0)}function K(e){return e==null?new Set:new Set(e.map(e=>e.name))}function q(e,t){if(e==null||t==null)return K(t);let n=new Set;for(let{name:r}of t)e.has(r)&&n.add(r);return n}function J(e,t){if(!t?.length)return e;e??=new Map;let n=()=>new Set;for(let{objectId:r,attribute:a}of t)i(e,r,n).add(a);return e}const Y=2e3,X=g(),Z=g(),Q=g(),$=6e5,ne=200,re=.95,ie=10;export{B as FeatureTileFetcher3D};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{filterInPlace as n}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import r from"../../../../core/Logger.js";import{getOrCreateMapValue as i}from"../../../../core/MapUtils.js";import{isAbortError as a,throwIfAborted as o}from"../../../../core/promiseUtils.js";import s from"../../../../core/ReactiveMap.js";import{on as c,watch as l}from"../../../../core/reactiveUtils.js";import{schedule as u}from"../../../../core/scheduling.js";import{signal as d}from"../../../../core/signal.js";import{sqlAnd as f}from"../../../../core/sql.js";import{property as p,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{getEpsilon as h}from"../../../../core/libs/gl-matrix-2/math/common.js";import{create as g,equals as _,clone as v,expand as y,toExtent as b,width as x,height as S}from"../../../../geometry/support/aaBoundingRect.js";import{getObjectId as C,hasVertices as w,computeAABR as T}from"../../../../layers/graphics/dehydratedFeatures.js";import{geometryKey as E,transferGeometryKey as D,identicalTransferGeometry as O,completeDehydratedFeatureFromTransfer as k}from"../../../../layers/graphics/transferFeatures.js";import A from"../../../../rest/support/QuantizationParameters.js";import j from"../../../../rest/support/Query.js";import{FeatureMemory as M}from"./FeatureMemory.js";import{MultiFeatureReference as ee,SingleFeatureReference as te}from"./featureReference.js";import{failedFeatureCount as N,FeatureTile as P}from"./FeatureTile.js";import{virtualDisplayFilterHighlightTileId as F,virtualSnapshotTileId as I}from"./FeatureTileDescriptor.js";import{tilesAreRelated as L}from"../../terrain/tileUtils.js";import{ImmediateTask as R,TaskPriority as z}from"../../../support/Scheduler.js";let B=class extends t{set maximumNumberOfFeatures(e){e||=1/0;let t=this._get(`maximumNumberOfFeatures`);e===t||e<1||(this._set(`maximumNumberOfFeatures`,e),this._maximumFeaturesUpdated(t,e))}set memoryFactor(e){this.memoryFactor!==e&&(this._set(`memoryFactor`,e),this._setDirty())}set lodFactor(e){this.lodFactor!==e&&(this._set(`lodFactor`,e),this._supportsResolution&&this.refetch())}get useTileCount(){return this._useTileCount&&this.context.query.queryFeatureCount!=null}set useTileCount(e){this._useTileCount=e,this.notifyChange(`useTileCount`)}get updating(){return this._dirty||!!this._pendingEdits||this._isFetching||(this.tileDescriptors?.updating??!1)}get readyToRun(){return this._dirty}get usedMemory(){return this._memory.usedMemory}get usedMemoryPerFeature(){return this._memory.usedMemoryPerFeature}get totalVertices(){let e=0;return this._featureTiles.forEach(t=>e+=t.numVertices),e}get totalFeatures(){let e=0;return this._featureTiles.forEach(t=>e+=t.numFeatures),e}get showsAllFeatures(){if(this._paused||this.dataUpdating)return!1;for(let e of this._featureTiles.values())if(!this.hasFullGeometries&&e.emptyFeatureRatio!==0||!e.showsAllFeatures)return!1;return!0}get hasFullGeometries(){return!this._supportsResolution||this.tileDescriptors?.some(V)||!this.context.capabilities.supportsQuantization&&this.context.geometryType!==`polyline`}set filterExtent(e){if(e!=null&&this.context.tilingScheme&&!e.spatialReference.equals(this.context.tilingScheme.spatialReference)){r.getLogger(this).error(`#filterExtent=`,`extent needs to be in the same spatial reference as the tiling scheme`);return}let t=this._get(`filterExtent`);if(t===e||t!=null&&e&&t.equals(e))return;let n=e==null?null:e.clone();this._set(`filterExtent`,n),this._reclip(n,t)}_updateTileZQuantization(e){if(this.context.viewingMode===1){let t=e.computeZQuantizationFactor();this._zQuantizationFactor.value<t&&(this._zQuantizationFactor.value=t)}}get _tileZQuantization(){return this.context.isDraped?1:this._zQuantizationFactor.value}constructor(e){super(e),this._useTileCount=!1,this.dataUpdating=!1,this.updatingTotal=0,this.updatingRemaining=0,this.expectedFeatureDiff=0,this.maximumNumberOfFeaturesExceeded=!1,this._fullRatio=1,this._farRatio=1,this._zQuantizationFactor=d(1),this._changes={updates:{adds:[],removes:[]},adds:[],removes:[]},this._featureTiles=new s,this._displayingFeatureReferences=new Map,this._numDisplayingFeatureReferences=0,this._memory=new M(E),this._dirty=!1,this._suspended=!0,this._pendingEdits=null,this._applyEditsTilesUpdated=!1,this.snappingComplexityExceeded=!0,this._isFetching=!1;let t=e.context;this._frameTask=t.scheduler?.registerTask(z.FEATURE_TILE_FETCHER,this)??R,this.FeatureReferenceClass=t.capabilities.supportsMultipleResolutions?ee:te,this._objectIdField=t.objectIdField}initialize(){this.addHandles([c(()=>this.tileDescriptors,`change`,()=>this._setDirty(),{onListenerAdd:()=>this._setDirty(),onListenerRemove:()=>this._setDirty()}),l(()=>this._tileZQuantization,()=>this.refetch())]),this._setDirty()}destroy(){this._frameTask.remove(),this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._removeTile(e)}),this._featureTiles.clear(),this._displayingFeatureReferences.clear(),this._pendingEdits?.controller.abort(),this._pendingEdits=null}get _paused(){return this._suspended||!!this._pendingEdits}restart(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._clearTile(e),this._resetFetchTile(e)}),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._setDirty()}refetch(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._resetFetchTile(e)}),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._setDirty()}refetchDisplayFilterHighlightTile(){let e=this._featureTiles.get(F);e&&(this._cancelFetchTile(e),this._resetFetchTile(e),this._setDirty())}suspend(){this._suspended||(this._suspended=!0,this._pause(),this._setDirty())}resume(){this._suspended&&(this._suspended=!1,this._unpause())}getMissingAttributesForFeature(e){for(let t of this._featureTiles.values()){let n=t.missingAttributes?.get(e);if(n!=null)return n}}_pause(){this._paused&&(this._featureTiles.forEach(e=>this._cancelFetchTile(e)),this._updated())}_unpause(){this._paused||this._setDirty()}get availableFields(){let e=null;return this._featureTiles.forEach(t=>{t.displayingFeatures!=null&&t.displayingFeatures.length!==0&&(e==null?e=new Set(t.availableFields):e.forEach(n=>{t.availableFields?.has(n)||e.delete(n)}))}),e??new Set}applyEdits(e){this._pendingEdits||(this._pendingEdits={edits:Promise.resolve(),count:0,controller:new AbortController},this._pause());let t=this._pendingEdits;t.count++;let n=t.edits.then(()=>e.result.catch(e=>{if(a(e))throw e;return null}).then(e=>e&&(this._applyEditsDeleteFeatures(e.deletedFeatures),this._applyEditsAddUpdateFeatures(e.addedFeatures,e.updatedFeatures,t.controller.signal).then(()=>e))).then(e=>(--t.count===0&&(this._pendingEdits===t&&(this._pendingEdits=null),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._applyEditsTilesUpdated=!1,this._unpause()),e)));return t.edits=n,this._updated(),n}_applyEditsDeleteFeatures(e){if(e.length===0)return;let t=this.context.globalIdField,n=t&&this.availableFields.has(t),i=new Set,a=this._objectIdField;e.forEach(({objectId:e,globalId:o})=>{(!e||e<0)&&t&&o&&(n||r.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected in the view`),e=this._objectIdFromGlobalId(o,a,t)),e!=null&&e>=0&&i.add(e)}),this._featureTiles.forEach(e=>{if(!e.features)return;let t=e.features.filter(e=>!i.has(C(e,this._objectIdField)));t.length!==e.features.length&&(this._applyEditsTileUpdated(),e.setFeatures(t,0,e.availableFields,e.missingAttributes),this._updateTileZQuantization(e),this._invalidateCounts())})}_objectIdFromGlobalId(e,t,n){if(e==null)return null;let r=this.features.find(t=>t.attributes?.[n]===e);return r?C(r,t):null}async _applyEditsAddUpdateFeatures(e,t,n){let{objectIdField:i,globalIdField:a}=this.context,o=a&&this.availableFields.has(a),s=new Set,c=new Set;for(let t of e){let e=t.objectId;e!=null&&s.add(e)}for(let{objectId:e,globalId:n}of t){let t=e;(t==null||t<0)&&a&&(o||r.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${a} to be included the layer's outFields for updates to be reflected in the view`),t=this._objectIdFromGlobalId(n,i,a)),t!=null&&t>=0&&(s.add(t),c.add(t))}if(s.size===0)return;let l=[];this._featureTiles.forEach(e=>{let t=this._applyEditsAddUpdateTile(e,s,c,n);l.push(t)}),this._updated(),await Promise.allSettled(l)}async _applyEditsAddUpdateTile(e,t,n,r){if(!e.features)return;e.fetchingResolution=e.descriptor.resolution;let i=this._createQuery(e);i.resultType=void 0,i.cacheHint=!1,i.objectIds=Array.from(t);let a=await this.context.query.queryFeaturesDehydrated(i,{signal:r,timeout:$}),o=null;if(n.size>0){let t=e.features.filter(e=>!n.has(C(e,this._objectIdField)));t.length!==e.features.length&&(o=t)}if(a.features.length>0){o||=e.features.slice();for(let e of a.features)o.push(e)}o&&(e.hasPreciseFeatureCount&&(e.numFeatures=Math.max(e.numFeatures,o.length)),this._applyEditsTileUpdated(),e.setFeatures(o,0,q(e.availableFields,a.fields),J(e.missingAttributes,a.missingAttributes),void 0,!1),this._updateTileZQuantization(e),this._invalidateCounts())}_applyEditsTileUpdated(){this._applyEditsTilesUpdated||(this._applyEditsTilesUpdated=!0,this._updated())}_queryFeatures(e,t,n){return this.context.query.queryFeaturesDehydrated(e,{signal:n,timeout:$,completeFeatureFromTransfer:(e,n,r)=>{let i=D(e.geometry,n,t),a=this._memory.findGeometry(i,t=>O(e.geometry,n,t));a?e.geometry=a:k(e,n,r)}})}_setDirty(){this._dirty=!0,this._updated()}runTask(e){let t=this._frameTask.processQueue(e);if(!this._dirty||!this.initialized)return t;this._dirty=!1;let n=this._featureTilesArray;if(this._markTilesNotAlive(n),!e.run(()=>this._addTiles(n,e))||!e.run(()=>this._filterExtentTiles(n,e))||!e.run(()=>this._removeTiles(n,e))||e.done){this._setDirty();return}let r=this._sortTiles(n);e.run(()=>this._showTiles(r,e))&&e.run(()=>this._fetchTiles(r,e))&&e.run(()=>this._updateMemoryEstimates(r,e))||this._setDirty(),this._updated(),this.updating||(this._updateMaximumNumberOfFeaturesExceeded(),this._updateSnappingComplexityExceeded(r))}_updateSnappingComplexityExceeded(e){let t=ie;for(let n of e){if(V(n)||t<=0)break;if(!H(n)&&(t--,n.sampledDensityEstimate>re)){this.snappingComplexityExceeded=!0;return}}this.snappingComplexityExceeded=this._featureTiles.size===0}_markTilesNotAlive(e){for(let t of e)t.alive=!1}_addTiles(e,t){return this._suspended||!this.tileDescriptors?!1:(this.tileDescriptors.forEach(n=>{let r=this._featureTiles.get(n.id);r?r.alive=!0:t.done||(e.push(this._addTile(n)),t.madeProgress())}),t.hasProgressed)}_filterExtentTiles(e,t){for(let n of e){if(t.done)break;n.alive&&(n.filtered=!n.intersects(this.filterExtent),n.filtered&&(this._clearTile(n),t.madeProgress()))}return t.hasProgressed}_removeTiles(e,t){for(let n=e.length-1;n>=0&&!t.done;n--){let r=e[n];r.alive||(this._removeTile(r),n!==e.length-1&&(e[n]=e[e.length-1]),e.pop(),t.madeProgress())}return t.hasProgressed}_sortTiles(e){return e.sort((e,t)=>e.descriptor.loadPriority-t.descriptor.loadPriority),e}_showTiles(e,t){let n=this._updateRatio(e),r=e=>{let t=this._fullRatio<1?n(e)*this._farRatio:1;e.reduceFeatures(t,this.memoryFactor,this._objectIdField,this._reduceMode)&&this._setDirty();let{numFeatures:r,fetchingResolution:i,descriptor:a,isFetched:o}=e;return this._supportsResolution&&r>0&&i!==a.resolution&&o&&(e.requestRefetch(),this._setDirty()),this._showTile(e)};for(let n of e)if(!t.run(()=>r(n))){this._setDirty();break}return t.hasProgressed}_fetchTiles(e,t){if(this._paused)return!1;let n=!1;for(let r of e){if(!r.needsFetch)continue;let e=this.context.memoryCache==null?null:this.context.memoryCache.pop(r.id);if(e?.resolution===r.displayingResolution)r.cache=e,r.numFeatures&&this._notifyDataUpdating(),this._setDirty(),this._scheduleUpdated(),t.madeProgress();else{if(this._needsNumFeatures(r)){let e=new AbortController,i=this._fetchTileCount(r,e.signal);this._handleRequest(r,i,e,()=>r.resetFetching(),()=>r.numFeatures=N),n=!0,t.madeProgress()}if(t.done)return!0}}if(n)return t.hasProgressed;for(let n of e){if(!n.needsFetch)continue;let e=new AbortController,i=this._fetchTile(n,e.signal);if(this._handleRequest(n,i,e,e=>n.fetchDone(e),e=>{n.fetchFailed=!0,this.context.logFetchError(r.getLogger(this),e)}),t.madeProgress(),t.done)return!0}return t.hasProgressed}_updateMemoryEstimates(e,t){return e.some(e=>!t.run(()=>e.updateEstimates())&&(this._setDirty(),!0)),t.hasProgressed}_reclip(e,t){if(!this.initialized)return;let n=[];this._featureTiles.forEach(r=>{r.displayingFeatures!=null&&r.displayingFeatures.length!==0&&(r.intersectionIncludingBorrowed(t,X),r.intersectionIncludingBorrowed(e,Z),_(X,Z)||n.push(r))}),this._refreshDisplayingFeatures(n),this._updated()}_refreshDisplayingFeatures(e){let t=new Set,n=this._changes.updates;for(let r of e)if(r.displayingFeatures!=null)for(let e of r.displayingFeatures){let r=C(e,this._objectIdField);if(t.has(r))continue;t.add(r);let i=this._displayingFeatureReferences.get(r).feature;n.removes.push(i),n.adds.push(i)}this._applyChanges()}_updated(){let e=0;if(this._paused||this._featureTiles.forEach(t=>t.isFetching?++e:0),this._isFetching=e>0,e>0||this._applyEditsTilesUpdated?this._notifyDataUpdating():this._dirty||this._set(`dataUpdating`,!1),this.updating){let t=0,n=0,r=0,i=0,a=0,o=this._displayingFeatureReferences.size/this._numDisplayingFeatureReferences;this._featureTiles.forEach(e=>{if(++n,e.isFetching&&e.hasPreciseFeatureCount){let t=this._maximumFeaturesForTile(e)*(1-e.emptyFeatureRatio),n=e.displayingFeatures==null?0:e.displayingFeatures.length*o;a+=t-n}e.needsFetch?++i:e.numFeatures>0&&(++r,t+=e.numFeatures)}),i+=e;let s=0,c=0;t?(c=t,s=Math.min(i*t/r,t)):(c=n,s=i),a=Math.min(this.maximumNumberOfFeatures-this.features.length,a),this._set(`updatingTotal`,c),this._set(`updatingRemaining`,s),this._set(`expectedFeatureDiff`,a)}else this._set(`updatingTotal`,0),this._set(`updatingRemaining`,0),this._set(`expectedFeatureDiff`,0);this.debugger?.update()}_updateMaximumNumberOfFeaturesExceeded(){for(let{perTileMaximumNumberOfFeaturesExceeded:e}of this._featureTiles.values())if(e){this._set(`maximumNumberOfFeaturesExceeded`,!0);return}this._set(`maximumNumberOfFeaturesExceeded`,!1)}_updateRatio(e){let t=W(e),n=e=>1/(1<<Math.max(0,t-e.descriptor.lij[0])),r=0,i=0;for(let t of e){let e=t.numFeatures;r+=e,i+=e*n(t)}return this._fullRatio=Math.min(1,this.maximumNumberOfFeatures/r),this._farRatio=this.maximumNumberOfFeatures/i,this._scheduleUpdated(),n}_maximumFeaturesUpdated(e,t){e!==t&&(t>e&&this._featureTiles.forEach(e=>{if(!e.featuresMissing)return;let t=this._maximumFeaturesForTile(e);e.isFullyFetched(t)||(this._cancelFetchTile(e),this._resetFetchTile(e))}),this._setDirty())}_addTile(e){let t=new P(e,this._memory);return this._featureTiles.set(t.id,t),this._resetFetchTile(t),this._referenceDisplayingFeaturesFromRelatedTiles(t),t}_referenceDisplayingFeaturesFromRelatedTiles(e){let t=e.displayingResolution;this._featureTiles.forEach(n=>{if(n.displayingFeatures!=null&&e!==n&&L(e.descriptor.lij,n.descriptor.lij)){e.displayingFeatures??=[],e.descriptor.extent&&n.descriptor.extent&&(e.extentIncludingBorrowedFeatures??=v(e.descriptor.extent),y(e.extentIncludingBorrowedFeatures,n.descriptor.extent,e.extentIncludingBorrowedFeatures));for(let r of n.displayingFeatures){e.displayingFeatures.push(r),this._memory.ref(r);let n=this._displayingFeatureReferences.get(C(r,this._objectIdField));n.ref(this._memory,n.feature,t),this._numDisplayingFeatureReferences++}}})}_removeTile(e){this._clearTile(e),this._featureTiles.delete(e.id)}_resetFetchTile(e){e.filtered=!e.intersects(this.filterExtent),e.filtered?e.needsFetch&&e.fetchDone(4):e.requestFetch()}_cancelFetchTile(e){let t=e.requestController;t!=null&&(e.requestController=null,e.resetFetching(),t.abort())}async _fetchTileCount(e,t){e.numFeatures=await this.context.query.queryFeatureCount(this._createFeatureCountQuery(e),{signal:t}),this._updateRatio(this._featureTilesArray)}async _fetchTile(e,t){e.fetchFailed=!1;let n=this._maximumFeaturesForTile(e);if(n<=0)return e.hasPreciseFeatureCount&&e.numFeatures===0||(e.fetchFailed=!0),G(e),e.fetchInformation.value=`Empty tile`,4;let r=this._getMaxRecordCount(e),i=Math.ceil(n/r);if(e.fetchingResolution=e.descriptor.resolution,U(e)||!this.context.capabilities.supportsMaxRecordCountFactor||e.numFeatures<=n&&i>j.MAX_MAX_RECORD_COUNT_FACTOR)return this._fetchPagedTile(e,t);let a=this._createQuery(e);if(a.maxRecordCountFactor=i,e.isRefetching&&e.features&&e.features.length>0){let t=Math.ceil(e.features.length/(1-e.emptyFeatureRatio)/r);a.maxRecordCountFactor=Math.max(t+1,a.maxRecordCountFactor)}e.fetchInformation.value=`Single fetch\n${n} features`;let{features:s,exceededTransferLimit:c,fields:l,missingAttributes:u}=await this._queryFeatures(a,e.fetchingResolution,t),d=c||a.maxRecordCountFactor>=j.MAX_MAX_RECORD_COUNT_FACTOR||n===this._totalFeaturesForTile(e)?5:4,f=await this._frameTask.schedule(()=>{e.exceededTransferLimit.value=!!c;let t=this._removeEmptyFeatures(s,this._getEffectiveTileResolution(e));return e.fetchInformation.value=`Single fetch\n${s.length}/${n} features`,e.setFeatures(s,t,K(l),J(void 0,u)),this._updateTileZQuantization(e),this._maximumFeaturesForTile(e)>n?1:d},t);return o(t),this._invalidateCounts(),f}async _fetchPagedTile(e,t){let n=0,r=0,i,a=0,s=this._maximumFeaturesForTile(e)-a,c=this._getMaxRecordCount(e),l=null,u;for(;;){let d=this._createQuery(e),f=this._setPagingParameters(d,n,s,c);e.fetchInformation.value=`Paged fetch\n${e.features?.length}/${s} features`;let{features:p,exceededTransferLimit:m,fields:h,missingAttributes:g}=await this._queryFeatures(d,e.fetchingResolution,t);if(await this._frameTask.schedule(()=>{f&&(n+=d.num),a+=p.length,r+=this._removeEmptyFeatures(p,this._getEffectiveTileResolution(e)),e.exceededTransferLimit.value=!!m,i=i?.concat(p)??p,l=q(l,h),u=J(u,g),e.setFeatures(i,r,l,u),this._updateTileZQuantization(e),this._invalidateCounts(),this._setDirty()},t),o(t),s=this._maximumFeaturesForTile(e)-(i?.length??0),!f||!m||s<=0)return m?4:5}}_createFeatureCountQuery(e){let t=this._createQuery(e);return this.context.capabilities.supportsCacheHint&&(t.resultType=void 0,t.cacheHint=!0),t}_createQuery(e){let t=this.context.createQuery();if(t.resultType=this._resultType(e),!U(e)&&e.descriptor.extent&&this.context.tilingScheme&&(t.geometry=b(e.descriptor.extent,this.context.tilingScheme.spatialReference)),this._setResolutionParams(t,e),t.resultType!==`tile`&&this.context.capabilities.supportsCacheHint&&(t.cacheHint=!0),H(e)){let{highlightIds:e}=this.context;e&&e.length>Y&&r.getLogger(this).warn(`highlight-too-many-features`,`highlight is limited to ${Y} features on large layers configured with a display filter to avoid performance issues`),t.objectIds=e?.slice(0,Y)}else!V(e)&&this.context.effectiveDisplayFilter&&(t.where=f(t.where,this.context.effectiveDisplayFilter.where));return t}_setPagingParameters(e,t,n,r){return this.context.capabilities.supportsPagination?(e.start=t,n>0&&this.context.capabilities.supportsMaxRecordCountFactor?(e.maxRecordCountFactor=Math.ceil(n/r),e.num=Math.min(e.maxRecordCountFactor*r,n)):e.num=Math.min(r),!0):!1}_getEffectiveTileResolution(e){if(U(e)||!this._supportsResolution)return null;let t=this.context.viewingMode===1&&this.context.tilingScheme?this.context.tilingScheme.resolutionAtLevel(3):1/0;return Math.min(e.fetchingResolution,t)/this.lodFactor/this._tileZQuantization}get _supportsResolution(){return this.context.capabilities.supportsMultipleResolutions&&this.context.geometryType!==`point`}_setResolutionParams(e,t){let n=this._getEffectiveTileResolution(t);n!=null&&(this.context.capabilities.supportsQuantization?e.quantizationParameters=new A({mode:`view`,originPosition:`upper-left`,tolerance:n,extent:this.context.fullExtent}):this.context.geometryType===`polyline`&&(e.maxAllowableOffset=n))}_removeEmptyFeatures(e,t){let r=e.length;if(t&&this._supportsResolution){let r=t*(1+h());n(e,({geometry:e})=>!e||!w(e)?!1:(T(e,Q),x(Q)>r||S(Q)>r))}else n(e,({geometry:e})=>w(e));return r-e.length}_needsNumFeatures(e){return this.useTileCount&&e.needsFeatureCount&&!V(e)}_getMaxRecordCount(e){switch(this._resultType(e)){case`tile`:if(this.context.tileMaxRecordCount)return this.context.tileMaxRecordCount;break;case`standard`:if(this.context.standardMaxRecordCount)return this.context.standardMaxRecordCount}return this.context.maxRecordCount||Y}_resultType(e){if(this.context.capabilities.supportsResultType)return V(e)?`standard`:`tile`}get _reduceMode(){let e=this.context.geometryType;return e===`polygon`||e===`polyline`?0:1}_handleRequest(e,t,n,r,i){e.startFetch(),e.requestController=n;let o=!1;t.then(t=>{e.requestController=null,r(t)}).catch(t=>{e.requestController===n&&(e.requestController=null,e.fetchDone(4)),a(t)?o=!0:i(t)}).then(()=>{o||this._setDirty(),this._scheduleUpdated()})}_scheduleUpdated(){this.hasHandles(`scheduleUpdated`)||this.addHandles(u(()=>{this.removeHandles(`scheduleUpdated`),this._updated()}),`scheduleUpdated`)}_showTile(e){if(e.displayingFeatures&&!e.needsDisplayUpdate)return!1;let t=e.features;if(e.featureLimit===0||!t){let t=e.displayingFeatures!=null&&e.displayingFeatures.length>0;return this._hideTileFeatures(e),e.displayingFeatures=[],t}let n=e.fetchingResolution,{adds:r,updates:i}=this._changes,a=Math.min(e.featureLimit,t.length);for(let e=0;e<a;++e){let a=t[e],o=C(a,this._objectIdField),s=this._displayingFeatureReferences.get(o);if(this._memory.ref(a),s){let{oldVersion:e,newVersion:t}=s.ref(this._memory,a,n);e!==t&&(e&&i.removes.push(e),t&&i.adds.push(t))}else this._displayingFeatureReferences.set(o,new this.FeatureReferenceClass(a,n,this._memory)),r.push(a);this._numDisplayingFeatureReferences++}return this._hideTileFeatures(e),e.displayingResolution=e.fetchingResolution,this._applyChanges(),e.displayingFeatures=t.slice(0,a),!0}_hideTile(e){this._cancelFetchTile(e),this._hideTileFeatures(e)}_hideTileFeatures(e){if(e.displayingFeatures==null)return;let{updates:t,removes:n}=this._changes;for(let r of e.displayingFeatures){this._memory.unref(r);let i=C(r,this._objectIdField),a=this._displayingFeatureReferences.get(i);if(!a)continue;let{oldVersion:o,newVersion:s}=a.unref(this._memory,e.displayingResolution);this._numDisplayingFeatureReferences--,o!==s&&(s==null?(this._displayingFeatureReferences.delete(i),o&&n.push(o)):(t.adds.push(s),o&&t.removes.push(o)))}this._applyChanges(),e.displayingFeatures=null}_notifyDataUpdating(){this._get(`dataUpdating`)||this._set(`dataUpdating`,!0)}_applyChanges(){let e=this._changes.updates;e.removes.length>0&&(this._notifyDataUpdating(),this.features.removeMany(e.removes),e.removes.length=0),e.adds.length>0&&(this._notifyDataUpdating(),this.features.addMany(e.adds),e.adds.length=0);let t=this._changes.adds,n=this._changes.removes,r=Math.min(t.length,n.length),i=0;for(;i<r;){let e=Math.min(i+ne,r);this._notifyDataUpdating(),this.features.addMany(t.slice(i,e)),this.features.removeMany(n.slice(i,e)),i=e}t.length>r&&(this._notifyDataUpdating(),this.features.addMany(i===0?t:t.slice(i))),n.length>r&&(this._notifyDataUpdating(),this.features.removeMany(i===0?n:n.slice(i))),t.length=0,n.length=0}_clearTile(e){this._hideTile(e),e.features&&this.context.memoryCache!=null&&this.context.memoryCache.put(e.id,e.cache),e.setFeatures(null,0,null,void 0),this._invalidateCounts()}_invalidateCounts(){this.notifyChange(`totalVertices`),this.notifyChange(`totalFeatures`)}get _featureTilesArray(){return Array.from(this._featureTiles.values())}get featureTiles(){return this._featureTiles}get storedFeatures(){return this._featureTilesArray.reduce((e,t)=>e+(t.features?t.features.length:0),0)}get missingTiles(){return this._featureTiles.values().reduce((e,t)=>e+(t.needsFetch||t.isFetching?1:0),0)}_totalFeaturesForTile(e){return e.hasPreciseFeatureCount?e.numFeatures:this.maximumNumberOfFeatures}_maximumFeaturesForTile(e){let t=this._totalFeaturesForTile(e),n=this._fullRatio<1?this._farRatio:1;return Math.min(Math.ceil(t*n/(1-e.emptyFeatureRatio)),t)}get test(){}};e([p({constructOnly:!0})],B.prototype,`features`,void 0),e([p({constructOnly:!0})],B.prototype,`context`,void 0),e([p()],B.prototype,`tileDescriptors`,void 0),e([p({value:1/0})],B.prototype,`maximumNumberOfFeatures`,null),e([p({value:1})],B.prototype,`memoryFactor`,null),e([p({value:1})],B.prototype,`lodFactor`,null),e([p()],B.prototype,`useTileCount`,null),e([p({readOnly:!0})],B.prototype,`updating`,null),e([p({readOnly:!0})],B.prototype,`dataUpdating`,void 0),e([p({readOnly:!0})],B.prototype,`updatingTotal`,void 0),e([p({readOnly:!0})],B.prototype,`updatingRemaining`,void 0),e([p({readOnly:!0})],B.prototype,`expectedFeatureDiff`,void 0),e([p()],B.prototype,`usedMemory`,null),e([p()],B.prototype,`usedMemoryPerFeature`,null),e([p({readOnly:!0})],B.prototype,`maximumNumberOfFeaturesExceeded`,void 0),e([p({readOnly:!0})],B.prototype,`totalVertices`,null),e([p({readOnly:!0})],B.prototype,`totalFeatures`,null),e([p({readOnly:!0})],B.prototype,`showsAllFeatures`,null),e([p({readOnly:!0})],B.prototype,`hasFullGeometries`,null),e([p()],B.prototype,`filterExtent`,null),e([p()],B.prototype,`_dirty`,void 0),e([p()],B.prototype,`_suspended`,void 0),e([p()],B.prototype,`_pendingEdits`,void 0),e([p()],B.prototype,`_applyEditsTilesUpdated`,void 0),e([p()],B.prototype,`_paused`,null),e([p()],B.prototype,`snappingComplexityExceeded`,void 0),e([p()],B.prototype,`_isFetching`,void 0),B=e([m(`esri.views.3d.layers.support.FeatureTileFetcher3D`)],B);function V(e){return e.id===I}function H(e){return e.id===F}function U(e){return V(e)||H(e)}function W(e){let t=0;for(let n of e)n.features&&n.features.length>0&&n.alive&&(t=Math.max(t,n.descriptor.lij[0]));return t}function G(e){e.setFeatures([],0,null,void 0)}function K(e){return e==null?new Set:new Set(e.map(e=>e.name))}function q(e,t){if(e==null||t==null)return K(t);let n=new Set;for(let{name:r}of t)e.has(r)&&n.add(r);return n}function J(e,t){if(!t?.length)return e;e??=new Map;let n=()=>new Set;for(let{objectId:r,attribute:a}of t)i(e,r,n).add(a);return e}const Y=2e3,X=g(),Z=g(),Q=g(),$=6e5,ne=200,re=.95,ie=10;export{B as FeatureTileFetcher3D};
@@ -1,3 +1,3 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../Color.js";import t from"../../../../Graphic.js";import n from"../../../../core/Collection.js";import r from"../../../../core/Handles.js";import{watch as i,initial as a}from"../../../../core/reactiveUtils.js";import o from"../../../../geometry/Polygon.js";import s from"../../../../symbols/FillSymbol3DLayer.js";import c from"../../../../symbols/PointSymbol3D.js";import l from"../../../../symbols/PolygonSymbol3D.js";import u from"../../../../symbols/TextSymbol3DLayer.js";import d from"../../../../symbols/callouts/LineCallout3D.js";import f from"../../../../symbols/callouts/LineCallout3DBorder.js";import p from"../../../../symbols/support/Symbol3DVerticalOffset.js";import{TilingScheme as m}from"../../terrain/TilingScheme.js";const h=[[0,179,255],[117,62,128],[0,104,255],[215,189,166],[32,0,193],[98,162,206],[102,112,129],[52,125,0],[142,118,246],[138,83,0],[92,122,255],[122,55,83],[0,142,255],[81,40,179],[0,200,244],[13,24,127],[0,170,147],[19,58,241],[22,44,35]];class g{constructor(e,t,i){this._tileFetcher=e,this._view=i,this._handles=new r,this._loadingGraphics=new Map,this._loadingSymbols=[new l({symbolLayers:new n([new s({material:{color:[200,200,200,.4]},outline:{color:[30,30,30],size:1}})])})],this._loadedGraphics=new Map,this._loadedSymbols=h.map(e=>new l({symbolLayers:new n([new s({material:{color:[e[0],e[1],e[2],.6]},outline:{color:`black`,size:1}})])})),this._pendingGraphics=new Map,this._pendingSymbols=[new l({symbolLayers:new n([new s({material:{color:[100,100,100,.4]},outline:{color:[30,30,30],size:1}})])})],this._dataExtentGraphic=null,this._dataExtentSymbol=new l({symbolLayers:new n([new s({material:{color:[0,0,0,0]},outline:{color:`green`,size:4}})])}),this._enabled=!0,this._tilingScheme=new m(t),this.update()}destroy(){this.enabled=!1,this._handles.destroy()}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this.update()}update(){this._enabled?(this._synchronizeMaps(this._loadingGraphics,{filter:({isFetching:e})=>e,symbols:this._loadingSymbols}),this._synchronizeMaps(this._loadedGraphics,{filter:e=>!e.isFetching,symbols:this._loadedSymbols}),this._synchronizeMaps(this._pendingGraphics,{filter:({isFetching:e})=>!e,symbols:this._pendingSymbols}),this.showDataExtent(this._tileFetcher.filterExtent)):(this._loadingGraphics.forEach(e=>this._view.graphics.removeMany(e)),this._loadingGraphics.clear(),this._loadedGraphics.forEach(e=>this._view.graphics.removeMany(e)),this._loadedGraphics.clear(),this._pendingGraphics.forEach(e=>this._view.graphics.removeMany(e)),this._pendingGraphics.clear(),this._dataExtentGraphic&&=(this._view.graphics.remove(this._dataExtentGraphic),null))}showDataExtent(e){if(this._dataExtentGraphic&&=(this._view.graphics.remove(this._dataExtentGraphic),null),e==null)return;let n=o.fromExtent(e);this._dataExtentGraphic=new t({geometry:n,symbol:this._dataExtentSymbol}),this._view.graphics.add(this._dataExtentGraphic)}_synchronizeMaps(e,t){let n=this._tileFetcher.featureTiles;e.forEach((r,i)=>{let a=n.get(i);(!a||!t.filter(a))&&(this._view.graphics.removeMany(r),e.delete(i))}),this._handles.removeAll(),n.forEach(n=>{t.filter(n)&&!e.has(n.id)&&this._handles.add(i(()=>n.fetchInformation,()=>this._showTile(n,e,t),a))})}_showTile(r,i,a){let[o,s,l]=r.descriptor.lij,{numFeatures:m,featureLimit:h,features:g}=r;this._tilingScheme.ensureMaxLod(o);let _=this._tilingScheme.getExtentGeometry(o,s,l),v=new t({geometry:_,symbol:a.symbols[o%a.symbols.length]}),y=`Tile ${r.id}\nloaded/limit/total
2
+ import e from"../../../../Color.js";import t from"../../../../Graphic.js";import n from"../../../../core/Collection.js";import r from"../../../../core/Handles.js";import{watch as i,initial as a}from"../../../../core/reactiveUtils.js";import o from"../../../../geometry/Polygon.js";import s from"../../../../symbols/FillSymbol3DLayer.js";import c from"../../../../symbols/PointSymbol3D.js";import l from"../../../../symbols/PolygonSymbol3D.js";import u from"../../../../symbols/TextSymbol3DLayer.js";import d from"../../../../symbols/callouts/LineCallout3D.js";import f from"../../../../symbols/callouts/LineCallout3DBorder.js";import p from"../../../../symbols/support/Symbol3DVerticalOffset.js";import{TilingScheme as m}from"../../terrain/TilingScheme.js";const h=[[0,179,255],[117,62,128],[0,104,255],[215,189,166],[32,0,193],[98,162,206],[102,112,129],[52,125,0],[142,118,246],[138,83,0],[92,122,255],[122,55,83],[0,142,255],[81,40,179],[0,200,244],[13,24,127],[0,170,147],[19,58,241],[22,44,35]];class g{constructor(e,t,i){this._tileFetcher=e,this._view=i,this._handles=new r,this._loadingGraphics=new Map,this._loadingSymbols=[new l({symbolLayers:new n([new s({material:{color:[200,200,200,.4]},outline:{color:[30,30,30],size:1}})])})],this._loadedGraphics=new Map,this._loadedSymbols=h.map(e=>new l({symbolLayers:new n([new s({material:{color:[e[0],e[1],e[2],.6]},outline:{color:`black`,size:1}})])})),this._pendingGraphics=new Map,this._pendingSymbols=[new l({symbolLayers:new n([new s({material:{color:[100,100,100,.4]},outline:{color:[30,30,30],size:1}})])})],this._dataExtentGraphic=null,this._dataExtentSymbol=new l({symbolLayers:new n([new s({material:{color:[0,0,0,0]},outline:{color:`green`,size:4}})])}),this._enabled=!0,this._tilingScheme=new m(t),this.update()}destroy(){this.enabled=!1,this._handles.destroy()}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this.update()}update(){this._enabled?(this._synchronizeMaps(this._loadingGraphics,{filter:({isFetching:e})=>e,symbols:this._loadingSymbols}),this._synchronizeMaps(this._loadedGraphics,{filter:e=>!e.isFetching,symbols:this._loadedSymbols}),this._synchronizeMaps(this._pendingGraphics,{filter:({isFetching:e})=>!e,symbols:this._pendingSymbols}),this.showDataExtent(this._tileFetcher.filterExtent)):(this._loadingGraphics.forEach(e=>this._view.graphics.removeMany(e)),this._loadingGraphics.clear(),this._loadedGraphics.forEach(e=>this._view.graphics.removeMany(e)),this._loadedGraphics.clear(),this._pendingGraphics.forEach(e=>this._view.graphics.removeMany(e)),this._pendingGraphics.clear(),this._dataExtentGraphic&&=(this._view.graphics.remove(this._dataExtentGraphic),null))}showDataExtent(e){if(this._dataExtentGraphic&&=(this._view.graphics.remove(this._dataExtentGraphic),null),e==null)return;let n=o.fromExtent(e);this._dataExtentGraphic=new t({geometry:n,symbol:this._dataExtentSymbol}),this._view.graphics.add(this._dataExtentGraphic)}_synchronizeMaps(e,t){let n=this._tileFetcher.featureTiles;e.forEach((r,i)=>{let a=n.get(i);a&&t.filter(a)||(this._view.graphics.removeMany(r),e.delete(i))}),this._handles.removeAll(),n.forEach(n=>{t.filter(n)&&!e.has(n.id)&&this._handles.add(i(()=>n.fetchInformation,()=>this._showTile(n,e,t),a))})}_showTile(r,i,a){let[o,s,l]=r.descriptor.lij,{numFeatures:m,featureLimit:h,features:g}=r;this._tilingScheme.ensureMaxLod(o);let _=this._tilingScheme.getExtentGeometry(o,s,l),v=new t({geometry:_,symbol:a.symbols[o%a.symbols.length]}),y=`Tile ${r.id}\nloaded/limit/total
3
3
  ${g?.length}/${h}/${m}\nres ${Math.round(r.displayingResolution)} ${r.featuresMissing?`some`:`all`}\n${r.fetchInformation.value}`,b=new t({geometry:_.center,symbol:new c({verticalOffset:new p({screenLength:40/.75}),callout:new d({color:new e(`white`),border:new f({color:new e(`black`)})}),symbolLayers:new n([new u({text:y,halo:{color:`white`,size:1/.75},material:{color:`black`},size:16})])})}),x=i.get(r.id);x&&this._view.graphics.removeMany(x);let S=[v,b];i.set(r.id,S),this._view.graphics.addMany(S)}}export{g as FeatureTileFetcher3DDebugger};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../Color.js";import n from"../../../../core/Accessor.js";import{isSome as r}from"../../../../core/arrayUtils.js";import{makeHandle as i,destroyHandle as a}from"../../../../core/handleUtils.js";import{watch as o,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{assertNotMesh as u}from"../../../../geometry/asserts.js";import{initializeProjection as d,project as f}from"../../../../geometry/projectionUtils.js";import{GraphicsCollection as p}from"../../../../support/GraphicsCollection.js";import m from"../../../../symbols/SimpleFillSymbol.js";import h from"../../../../symbols/SimpleLineSymbol.js";import g from"../../../../symbols/SimpleMarkerSymbol.js";import{getHighlightGraphics as _}from"../../../layers/support/highlightUtils.js";let v=class extends n{get updating(){return this.graphicsView?.updating??!1}constructor(e){super(e),this._highlightCounts=new Map,this._graphicsViewLoader=null,this.graphics=new p,this.graphicsView=null,this.suspended=!1;let n=new t([255,255,255,1/255]);this._symbols=new Map([[`point`,new g({size:`2px`,style:`square`,color:n})],[`polyline`,new h({width:`2px`,color:n})],[`polygon`,new m({outline:null,color:n})]])}highlight(e,t){let n=_(e);if(n.length===0)return i();let r=!1,a;return this.updatingHandles.consumePromise(Promise.all([this._createHighlightGraphics(n),this._ensureGraphicsView3D()]).then(([e,n])=>{!r&&n&&(a=this._addHighlightGraphics(n,e,t))})),i(()=>{r=!0,a?.remove()})}preload(){this._ensureGraphicsView3D()}_addHighlightGraphics(e,t,n){for(let e of t)this._highlightCounts.set(e,(this._highlightCounts.get(e)??0)+1);this.graphics.addMany(t);let r=e.highlight(t,n);return i(()=>{this._removeHighlightGraphics(t),r.remove()})}_removeHighlightGraphics(e){this.graphics.removeMany(e.filter(e=>{let t=Math.max(0,(this._highlightCounts.get(e)??0)-1);return t===0?(this._highlightCounts.delete(e),!0):(this._highlightCounts.set(e,t),!1)}))}async _ensureGraphicsView3D(){if(this.graphicsView)return this.graphicsView;this._graphicsViewLoader||=import(`../GraphicsView3D.js`);let{default:e}=await this._graphicsViewLoader;if(this.destroyed)return null;let t=new e({view:this.view,layer:{type:`graphics-view-3d-dummy`,id:this.layer.id,uid:this.layer.uid,elevationInfo:{mode:`on-the-ground`}},getGraphics:()=>this.graphics,drapeSourcePriorityOffset:.5});return this._set(`graphicsView`,t),this.addHandles([a(this.graphicsView),o(()=>this.suspended,e=>{t.suspended=e},s)]),t}async _createHighlightGraphics(e){let t=e.map(({geometry:e})=>e?.spatialReference).filter(r).reduce((e,t)=>((e.length===0||!e.at(-1)?.equals(t))&&e.push(t),e),[]),n=this.view.spatialReference,i=t.map(e=>({source:e,dest:n}));try{await d(i)}catch{return[]}return e.map(e=>{let{geometry:t}=e;try{u(t);let r=t?f(t,n):null,i=e.cloneShallow();return i.geometry=r,i.symbol=this._symbols.get(r?.type),i}catch{return e}})}};e([c()],v.prototype,`graphics`,void 0),e([c()],v.prototype,`graphicsView`,void 0),e([c()],v.prototype,`view`,void 0),e([c()],v.prototype,`layer`,void 0),e([c()],v.prototype,`updatingHandles`,void 0),e([c()],v.prototype,`suspended`,void 0),e([c()],v.prototype,`updating`,null),v=e([l(`esri.views.3d.layers.support.ImageHighlightHelper3D`)],v);export{v as ImageHighlightHelper3D};
2
+ import{__decorate as e}from"tslib";import t from"../../../../Color.js";import n from"../../../../core/Accessor.js";import{isSome as r}from"../../../../core/arrayUtils.js";import{makeHandle as i,destroyHandle as a}from"../../../../core/handleUtils.js";import{watch as o,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{assertNotMesh as u}from"../../../../geometry/asserts.js";import{initializeProjection as d,project as f}from"../../../../geometry/projectionUtils.js";import{GraphicsCollection as p}from"../../../../support/GraphicsCollection.js";import m from"../../../../symbols/SimpleFillSymbol.js";import h from"../../../../symbols/SimpleLineSymbol.js";import g from"../../../../symbols/SimpleMarkerSymbol.js";import{getHighlightGraphics as _}from"../../../layers/support/highlightUtils.js";let v=class extends n{get updating(){return this.graphicsView?.updating??!1}constructor(e){super(e),this._highlightCounts=new Map,this._graphicsViewLoader=null,this.graphics=new p,this.graphicsView=null,this.suspended=!1;let n=new t([255,255,255,1/255]);this._symbols=new Map([[`point`,new g({size:`2px`,style:`square`,color:n})],[`polyline`,new h({width:`2px`,color:n})],[`polygon`,new m({outline:null,color:n})]])}highlight(e,t){let n=_(e);if(n.length===0)return i();let r=!1,a;return this.updatingHandles.consumePromise(Promise.all([this._createHighlightGraphics(n),this._ensureGraphicsView3D()]).then(([e,n])=>{!r&&n&&(a=this._addHighlightGraphics(n,e,t))})),i(()=>{r=!0,a?.remove()})}preload(){this._ensureGraphicsView3D()}_addHighlightGraphics(e,t,n){for(let e of t)this._highlightCounts.set(e,(this._highlightCounts.get(e)??0)+1);this.graphics.addMany(t);let r=e.highlight(t,n);return i(()=>{this._removeHighlightGraphics(t),r.remove()})}_removeHighlightGraphics(e){this.graphics.removeMany(e.filter(e=>{let t=Math.max(0,(this._highlightCounts.get(e)??0)-1);return t===0?(this._highlightCounts.delete(e),!0):(this._highlightCounts.set(e,t),!1)}))}async _ensureGraphicsView3D(){if(this.graphicsView)return this.graphicsView;this._graphicsViewLoader||=import(`../GraphicsView3D.js`);let{default:e}=await this._graphicsViewLoader;if(this.destroyed)return null;let t=new e({view:this.view,layer:{type:`graphics-view-3d-dummy`,id:this.layer.id,uid:this.layer.uid,elevationInfo:{mode:`on-the-ground`}},getGraphics:()=>this.graphics,drapeSourcePriorityOffset:.5});return this._set(`graphicsView`,t),this.addHandles([a(this.graphicsView),o(()=>this.suspended,e=>{t.suspended=e},s)]),t}async _createHighlightGraphics(e){let t=e.map(({geometry:e})=>e?.spatialReference).filter(r).reduce((e,t)=>(e.length!==0&&e.at(-1)?.equals(t)||e.push(t),e),[]),n=this.view.spatialReference,i=t.map(e=>({source:e,dest:n}));try{await d(i)}catch{return[]}return e.map(e=>{let{geometry:t}=e;try{u(t);let r=t?f(t,n):null,i=e.cloneShallow();return i.geometry=r,i.symbol=this._symbols.get(r?.type),i}catch{return e}})}};e([c()],v.prototype,`graphics`,void 0),e([c()],v.prototype,`graphicsView`,void 0),e([c()],v.prototype,`view`,void 0),e([c()],v.prototype,`layer`,void 0),e([c()],v.prototype,`updatingHandles`,void 0),e([c()],v.prototype,`suspended`,void 0),e([c()],v.prototype,`updating`,null),v=e([l(`esri.views.3d.layers.support.ImageHighlightHelper3D`)],v);export{v as ImageHighlightHelper3D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../core/Evented.js";import n from"../../../../core/Logger.js";import{getMetersPerVerticalUnitForSR as r}from"../../../../core/units.js";import{property as i,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{create as o,ZEROS as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isEmpty as c,copy as l,center as u,diameter as d,squaredDistanceToPoint as f}from"../../../../geometry/support/aaBoundingBox.js";import{allFinite as p}from"../../../../geometry/support/aaBoundingRect.js";import{getInfo as m}from"../../../../geometry/support/spatialReferenceUtils.js";import{getMetersPerUnit as h}from"../../../../symbols/support/unitConversionUtils.js";import{ElevationUpdateEvent as g}from"../../support/ElevationUpdateEvent.js";import{ProjectedElevationUpdateExtent as _,calculateElevationUpdateExtents as v,fullWorldElevationUpdateExtent as y,planetCenterProximityToleranceMeters as b}from"../../support/elevationUpdateExtentUtils.js";import{affectsGeometry as x}from"../../webgl-engine/lib/affectsGeometry.js";import{Intersector as S}from"../../webgl-engine/lib/Intersector.js";const C=Symbol(`layerHandles`);let w=class extends t{get spatialReference(){return this.view.spatialReference}constructor(e){super(e),this._elevationOffset=0}initialize(){this._renderCoordsHelper=this.view.renderCoordsHelper,this._projectedExtent=new _(this._renderCoordsHelper),this._intersectLayers=[this.stageLayer],this._intersector=new S(this.view.state.viewingMode),this._intersector.options.store=0;let[e,t]=this._computeLayerElevationRange(this.spatialReference,this.stageLayer);this._zmin=e,this._zmax=t;let n=this.stageLayer.events;this.addHandles([n.on([`layerObjectAdded`,`layerObjectRemoved`,`transformationChanged`,`shaderTransformationChanged`],e=>this._objectChanged(e)),n.on([`geometryAdded`,`geometryRemoved`],({object:e})=>this._objectChanged(e)),n.on(`attributesChanged`,({attribute:e,object:t})=>x(e)&&this._objectChanged(t))],C)}destroy(){this.removeHandles(C)}elevationInfoChanged(){let e=this.layer==null?null:this.layer.elevationInfo;if(e!=null&&e.mode!==`on-the-ground`){let t=r(this.layer.spatialReference),n=h(e.unit??`meters`);this._elevationOffset=(e.offset??0)*n/t}else this._elevationOffset=0}getElevation(e,t,r,i){if(A[0]=e,A[1]=t,A[2]=r,!this._renderCoordsHelper.toRenderCoords(A,i,A))return n.getLogger(this).error(`could not project point for elevation alignment`),null;let a=this._elevationOffset,o=this._zmin+a,s=this._zmax+a;return this._renderCoordsHelper.setAltitude(j,s,A),this._renderCoordsHelper.setAltitude(M,o,A),this._intersector.reset(j,M,null),this._intersector.intersect(this._intersectLayers,null,1,null,e=>!!e.lastValidElevationBB),this._intersector.results.min.getIntersectionPoint(A)?this._renderCoordsHelper.getAltitude(A):null}_objectChanged(e){let t=this.spatialReference;if(!e.lastValidElevationBB||!t)return;let n=e.lastValidElevationBB,{box:r,sphere:i}=e.boundingVolumeWorldSpace;if(this.view.state.viewingMode===1&&(!c(n)&&T(n)||T(r))){this._emitFullExtentElevationChange(t),l(n,r);return}let a=!c(n),o=new Float64Array(a?8:4),s=1/0,u=-1/0,d=!1;if(a&&(this._resetProjectedExtent(n,t),this._expandExtent(t,n,O,this._projectedExtent)||(d=!0),p(this._projectedExtent.extent)?(s=Math.min(s,O[0]),u=Math.max(u,O[1]),o.set(this._projectedExtent.extent)):d=!0),this._projectedExtent.reset(i.center,i.radius,t),this._expandExtent(t,r,E,this._projectedExtent)||(d=!0),p(this._projectedExtent.extent)?(s=Math.min(s,E[0]),u=Math.max(u,E[1]),o.set(this._projectedExtent.extent,a?4:0)):d=!0,d){this._emitFullExtentElevationChange(t),l(n,r);return}let f=v(o,t);f.length>0&&(this._zmin=Math.min(this._zmin,s),this._zmax=Math.max(this._zmax,u));for(let e of f)this._emitElevationChangeEvent(e,t);l(n,r)}_computeLayerElevationRange(e,t){let n=1/0,r=-1/0;return e!=null&&t.objects.forEach(t=>{this._expandExtent(e,t.boundingVolumeWorldSpace.box,D)&&(n=Math.min(n,D[0]),r=Math.max(r,D[1]))}),[n,r]}_expandExtent(e,t,n,r=null){n[0]=1/0,n[1]=-1/0;for(let i=0;i<8;++i){A[0]=t[i&1?0:3],A[1]=t[i&2?1:4],A[2]=t[i&4?2:5];let a=r==null?this._renderCoordsHelper.fromRenderCoords(A,A,e):r.addRenderPoint(A,e);if(a!=null)n[0]=Math.min(n[0],a[2]),n[1]=Math.max(n[1],a[2]);else if(r!=null)return!1}return!0}_emitFullExtentElevationChange(e){let t=m(e);t!=null&&this._emitElevationChangeEvent(y(e,t),e)}_emitElevationChangeEvent(e,t){let n=new g(t,e);this.emit(`elevation-change`,n)}_resetProjectedExtent(e,t){u(e,k),this._projectedExtent.reset(k,.5*d(e),t)}};e([i({constructOnly:!0})],w.prototype,`layer`,void 0),e([i({constructOnly:!0})],w.prototype,`stageLayer`,void 0),e([i({constructOnly:!0})],w.prototype,`view`,void 0),e([i()],w.prototype,`spatialReference`,null),w=e([a(`esri.views.3d.layers.support.StageLayerElevationProvider`)],w);function T(e){return f(e,s)<=b*b}const E=new Float64Array(2),D=new Float64Array(2),O=new Float64Array(2),k=o(),A=o(),j=o(),M=o();export{w as StageLayerElevationProvider};
2
+ import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../core/Evented.js";import n from"../../../../core/Logger.js";import{getMetersPerVerticalUnitForSR as r}from"../../../../core/units.js";import{property as i,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{copy as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s,ZEROS as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isEmpty as l,copy as u,center as d,diameter as f,squaredDistanceToPoint as p}from"../../../../geometry/support/aaBoundingBox.js";import{allFinite as m}from"../../../../geometry/support/aaBoundingRect.js";import{getInfo as h}from"../../../../geometry/support/spatialReferenceUtils.js";import{getMetersPerUnit as g}from"../../../../symbols/support/unitConversionUtils.js";import{ElevationUpdateEvent as _}from"../../support/ElevationUpdateEvent.js";import{ProjectedElevationUpdateExtent as v,calculateElevationUpdateExtents as y,fullWorldElevationUpdateExtent as b,planetCenterProximityToleranceMeters as x}from"../../support/elevationUpdateExtentUtils.js";import{affectsGeometry as S}from"../../webgl-engine/lib/affectsGeometry.js";import{Intersector as C}from"../../webgl-engine/lib/Intersector.js";const w=Symbol(`layerHandles`);let T=class extends t{get spatialReference(){return this.view.spatialReference}constructor(e){super(e),this._elevationOffset=0}initialize(){this._renderCoordsHelper=this.view.renderCoordsHelper,this._projectedExtent=new v(this._renderCoordsHelper),this._intersectLayers=[this.stageLayer],this._intersector=new C(this.view.state.viewingMode),this._intersector.options.store=0;let[e,t]=this._computeLayerElevationRange(this.spatialReference,this.stageLayer);this._zmin=e,this._zmax=t;let n=this.stageLayer.events;this.addHandles([n.on([`layerObjectAdded`,`layerObjectRemoved`,`transformationChanged`,`shaderTransformationChanged`],e=>this._objectChanged(e)),n.on([`geometryAdded`,`geometryRemoved`],({object:e})=>this._objectChanged(e)),n.on(`attributesChanged`,({attribute:e,object:t})=>S(e)&&this._objectChanged(t))],w)}destroy(){this.removeHandles(w)}elevationInfoChanged(){let e=this.layer==null?null:this.layer.elevationInfo;if(e!=null&&e.mode!==`on-the-ground`){let t=r(this.layer.spatialReference),n=g(e.unit??`meters`);this._elevationOffset=(e.offset??0)*n/t}else this._elevationOffset=0}getElevation(e,t,r,i){if(j[0]=e,j[1]=t,j[2]=r,!this._renderCoordsHelper.toRenderCoords(j,i,j))return n.getLogger(this).error(`could not project point for elevation alignment`),null;let a=this._elevationOffset,o=this._zmin+a,s=this._zmax+a;return this._renderCoordsHelper.setAltitude(N,s,j),this._renderCoordsHelper.setAltitude(P,o,j),this._intersector.reset(N,P,null),this._intersector.intersect(this._intersectLayers,null,1,null,e=>!!e.lastValidElevationBB),this._intersector.results.min.getIntersectionPoint(j)?this._renderCoordsHelper.getAltitude(j):null}_objectChanged(e){let t=this.spatialReference;if(!e.lastValidElevationBB||!t)return;let n=e.lastValidElevationBB,{box:r,sphere:i}=e.boundingVolumeWorldSpace;if(this.view.state.viewingMode===1&&(!l(n)&&E(n)||E(r))){this._emitFullExtentElevationChange(t),u(n,r);return}let a=!l(n),o=new Float64Array(a?8:4),s=1/0,c=-1/0,d=!1;if(a&&(this._resetProjectedExtent(n,t),this._expandExtent(t,n,k,this._projectedExtent)||(d=!0),m(this._projectedExtent.extent)?(s=Math.min(s,k[0]),c=Math.max(c,k[1]),o.set(this._projectedExtent.extent)):d=!0),this._projectedExtent.reset(i.center,i.radius,t),this._expandExtent(t,r,D,this._projectedExtent)||(d=!0),m(this._projectedExtent.extent)?(s=Math.min(s,D[0]),c=Math.max(c,D[1]),o.set(this._projectedExtent.extent,a?4:0)):d=!0,d){this._emitFullExtentElevationChange(t),u(n,r);return}let f=y(o,t);f.length>0&&(this._zmin=Math.min(this._zmin,s),this._zmax=Math.max(this._zmax,c));for(let e of f)this._emitElevationChangeEvent(e,t);u(n,r)}_computeLayerElevationRange(e,t){let n=1/0,r=-1/0;return e!=null&&t.objects.forEach(t=>{this._expandExtent(e,t.boundingVolumeWorldSpace.box,O)&&(n=Math.min(n,O[0]),r=Math.max(r,O[1]))}),[n,r]}_expandExtent(e,t,n,r=null){n[0]=1/0,n[1]=-1/0;for(let i=0;i<8;++i){j[0]=t[i&1?0:3],j[1]=t[i&2?1:4],j[2]=t[i&4?2:5];let a=r==null?this._renderCoordsHelper.fromRenderCoords(j,j,e):r.addRenderPoint(j,e);if(a!=null)n[0]=Math.min(n[0],a[2]),n[1]=Math.max(n[1],a[2]);else if(r!=null)return!1;if(r!=null){for(let n=0;n<3;++n)if(!(i&1<<n)&&(o(M,j),M[n]=t[n],!r.addRenderEdge(j,M,e)))return!1}}return!0}_emitFullExtentElevationChange(e){let t=h(e);t!=null&&this._emitElevationChangeEvent(b(e,t),e)}_emitElevationChangeEvent(e,t){let n=new _(t,e);this.emit(`elevation-change`,n)}_resetProjectedExtent(e,t){d(e,A),this._projectedExtent.reset(A,.5*f(e),t)}};e([i({constructOnly:!0})],T.prototype,`layer`,void 0),e([i({constructOnly:!0})],T.prototype,`stageLayer`,void 0),e([i({constructOnly:!0})],T.prototype,`view`,void 0),e([i()],T.prototype,`spatialReference`,null),T=e([a(`esri.views.3d.layers.support.StageLayerElevationProvider`)],T);function E(e){return p(e,c)<=x*x}const D=new Float64Array(2),O=new Float64Array(2),k=new Float64Array(2),A=s(),j=s(),M=s(),N=s(),P=s();export{T as StageLayerElevationProvider};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{lerp as e}from"../../../../core/mathUtils.js";import t from"../../../../core/PooledArray.js";import{castRenderScreenPointArray3 as n,createRenderScreenPointArray3 as r,createScreenPointArray as i}from"../../../../core/screenUtils.js";import{getMetersPerVerticalUnitForSR as a}from"../../../../core/units.js";import{set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as s}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{add as c,normalize as l,dot as u,distance as d}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f,clone as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as m,copy as h,negativeInfinity as g,expandWithNestedArray as _}from"../../../../geometry/support/aaBoundingRect.js";import{createSpatialReferenceCyclical as v}from"../../../../geometry/support/normalizeUtils.js";import{create as y}from"../../../../geometry/support/ray.js";import{sv3d as b}from"../../../../geometry/support/vectorStacks.js";import{getElevationOffsetInMeters as x}from"../../../../support/elevationInfoUtils.js";import{g as S}from"../../../../chunks/cameraUtilsSpherical.js";import{computeMapPointFromVec3d as C}from"../../support/hitTest.js";import{fromRenderAtEye as w,fromScreen as T}from"../../support/geometryUtils/ray.js";import{defaultTolerance as E,Intersector as D,defaultScreenPolygonPrimitiveProcessor as O}from"../../webgl-engine/lib/Intersector.js";import{RayIntersectionQuery as k,DrapedScreenPolygonIntersectionQuery as A}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as j}from"../../webgl-engine/lib/IntersectorResult.js";import{SliceScreenPolygonPrimitiveProcessor as M,createSliceExtrusionHalfspacePlanes as N,clipPolygonAgainstSlicedAwayHalfspaces as P,sliceFilterPredicate as F}from"../../webgl-engine/lib/intersectorUtils.js";import{prepareScreenPolygonIntersectionQuery as I}from"../../webgl-engine/lib/screenPolygonIntersectionUtils.js";import{TaskPriority as L}from"../../../support/Scheduler.js";class R{constructor(e,n,r){this.viewingMode=e,this._forEachLayer=n,this._view=r,this._externalIntersectionHandlers=new t,this._tolerance=E,this._tmpRay=y(),this._tmpRegion=m(),this._validateHUDIntersector=new D(this.viewingMode),this._validateHUDIntersector.options.hud=!1,this._screenPolygonIntersectionTask=this._view.resourceController.scheduler.registerTask(L.SCREEN_POLYGON_INTERSECTION)}destroy(){this._screenPolygonIntersectionTask.remove(),this._externalIntersectionHandlers.prune()}get screenPolygonIntersectionTask(){return this._screenPolygonIntersectionTask}intersectScreen(e,t,n){return this.intersectRay(this._getPickRay(e,this._tmpRay),H(this.viewingMode),t,n)}intersectScreenFreePointFallback(e,t,n){return this.intersectRayFreePointFallback(this._getPickRay(e,this._tmpRay),t,n)}intersectRayFreePointFallback(e,t,n){return this.intersectRay(e,H(this.viewingMode),t,n)||this._intersectRayFreePointLocal(e,t)}intersectRay(e,t,n,r){return t.options.selectionMode=!1,t.options.store=0,this.computeIntersection(e,t,!1,r),t.results.min?t.results.min.getIntersectionPoint(n):!1}getCenterRayWithSubpixelOffset(e,t,n=.5,r=.5){return e.getRenderCenter(Z,n,r),Z[0]+=.0466,Z[1]-=.0123,w(e,Z,t)}intersectIntersectorScreen(e,t,n){this.computeIntersection(this._getPickRay(e,this._tmpRay),t,!1,n)}async intersectIntersectorScreenPolygon(e,t,n){t.polygonResults.init();let r=this._view.state.camera,i=await I(r,e);i!=null&&await this._screenPolygonIntersectionTask.scheduleGenerator(e=>this._intersectIntersectorScreenPolygon(r,t,i,n,e))}*_intersectIntersectorScreenPolygon(e,t,n,r,i){let a=new U(r,this._forEachLayer);t.options.selectOpaqueTerrainOnly=!r||!(`include`in r||`exclude`in r),t.camera=e,t.point=null,t.screenPolygonPrimitiveProcessor=O,yield*t.intersectScreenPolygon(a.layers,n);let o=this._view.slice.plane,s=o?new M(o):null;t.screenPolygonPrimitiveProcessor=s??O,yield*t.intersectScreenPolygon(a.sliceableLayers,n),t.screenPolygonPrimitiveProcessor=O,yield*this._intersectPolygonHandlersGenerator(t,a,n,null,s,void 0,!0,i),yield*this._intersectDrapedScreenPolygon(t,a,n,r),yield*t.intersectHUDScreenPolygon(a.layers,n),t.screenPolygonPrimitiveProcessor=s??O,yield*t.intersectHUDScreenPolygon(a.sliceableLayers,n),t.polygonResults.sortResults()}intersectToolIntersectorScreen(e,t,n){let r=this._getPickRay(e,this._tmpRay);this.intersectToolIntersectorRay(r,t,n)}intersectToolIntersectorRay(e,t,n){t.options.selectionMode=!0,this.computeIntersection(e,t,!1,n);let r=t.results.min;!this._view.groundView.opaque&&(!j(r)||r.intersector===7)&&(t.options.selectionMode=!1,this.computeIntersection(e,t,!1,n))}setTolerance(e=E){this._tolerance=e}addIntersectionHandler(e){this._externalIntersectionHandlers.push(e),this._externalIntersectionHandlers.sort((e,t)=>e.type===7?1:t.type===7?-1:0)}removeIntersectionHandler(e){this._externalIntersectionHandlers.removeUnordered(e)!=null&&this._externalIntersectionHandlers.sort((e,t)=>e.type===7?1:t.type===7?-1:0)}_getPickRay(e,t){let n=this._view.state.camera;return T(n,e,t)}_intersectRayFreePointLocal(e,t){return this.viewingMode!==2||e==null||c(t,e.origin,l(b.get(),e.direction)),!1}intersectElevationFromScreen(e,t,n=0,r=null){return this._intersectElevation(this._getPickRay(e,this._tmpRay),t,n,r)}_intersectElevation(e,t,r=0,i=null){if(e==null)return null;let o=this._view,{renderCoordsHelper:s}=o,c=a(o.spatialReference),d=t==null?`absolute-height`:t.mode,f=x(t)/c,p=(d===`on-the-ground`?0:f+r)*c/s.unitInMeters,{camera:m}=o.state;if(d===`absolute-height`){let t=s?.getAltitude(m.eye),n=u(l(K,e.direction),s.worldUpAtPosition(m.eye,q));if(t<p&&n<0||t>=p&&n>0)return null;if(s.intersectInfiniteManifold(e,p,K)){let e=C(o,K);return e.z??=0,e.z-=f,e}return null}let h=m.projectToRenderScreen(e.origin,n(b.get())),g=new U(null,this._forEachLayer),_=o.slice.plane,v=_?F(_):null,y=new D(this.viewingMode);y.options.store=0,y.options.verticalOffset=p,y.options.normalRequired=!1;let S=this._createRayIntersectionQuery(e,h,!1);y.reset(S.beginPoint,S.endPoint,m),y.point=h;let w=null;if(i&&`type`in i&&i.type===`graphics`){let e=o.allLayerViews.find(e=>e.layer===i)?.uid;w=e?t=>t.layerViewUid===e:null}else i&&(w=e=>e.graphicUid!==i.uid);switch(d){case`relative-to-scene`:y.intersect(g.layers,S.screenPoint,this._tolerance,null,e=>(!w||w(e))&&!!e.lastValidElevationBB),this._intersectRayHandlers(y,g,S,v,!1,e=>e.type===2||e.type===7||e.type===8,!1);break;case`on-the-ground`:case`relative-to-ground`:this._intersectRayHandlers(y,g,S,v,!1,e=>e.isGround,!1)}if(y.results.min.getIntersectionPoint(K)){let e=C(o,K);return e.z=r,e}return null}computeIntersection(e,t,r,i){if(e==null)return;let a=this._view.state.camera,o=a.projectToRenderScreen(e.origin,n(b.get())),s=new U(i,this._forEachLayer);t.options.selectOpaqueTerrainOnly=!i||!(`include`in i||`exclude`in i);let c=this._createRayIntersectionQuery(e,o,r);t.reset(c.beginPoint,c.endPoint,a),t.intersect(s.layers,c.screenPoint,this._tolerance,null,s.objectFilter);let l=this._view.slice.plane,u=l?F(l):null;t.intersect(s.sliceableLayers,c.screenPoint,this._tolerance,u,s.objectFilter);let d=i&&(i.requiresGroundFeedback||i.enableDraped);this._intersectRayHandlers(t,s,c,u,!!d,e=>s.allowedIntersectorTypes==null||s.allowedIntersectorTypes.has(e.type));let f=b.get(),p=this._view,m=p.groundView.spatialReference;if(i&&i.enableDraped&&m!=null&&t.results.ground.getIntersectionPoint(f)){let e=p.overlayManager.renderer,n=p.renderCoordsHelper.spatialReference,r=b.get();p.renderCoordsHelper.fromRenderCoords(f,r,m),r[2]=p.elevationProvider?.getElevation(f[0],f[1],f[2],n,`ground`)??0,e.intersectRay(t,r,t.results.ground,e=>s.filterRenderGeometry(e))}t.sortResults(),this._processHUDResults(t)}_processHUDResults(e){let t=e.results.hud;h(this._tmpRegion,g);let n=[],r=this._tmpRegion,i=e=>{n.push(new z(e))};e.sortResults(t.all),t.min.distance!=null&&i(t.min);for(let e of t.all)t.min.target.object!==e.target.object&&t.max.target.object!==e.target.object&&i(e);if(t.max.distance!=null&&t.max.target.object!==t.min.target.object&&i(t.max),!n.length)return;r[0]===r[2]&&(r[2]+=1),r[1]===r[3]&&(r[3]+=1);let a=!0,o=e.results.max.distance==null,s=0;for(let t of n)a&&=(e.results.min.copy(t.result),!1),o&&e.results.max.copy(t.result),e.options.store===2&&e.results.all.splice(s++,0,t.result)}_createRayIntersectionQuery(e,t,n){return new k(e.origin,c(f(),e.origin,e.direction),t,n)}_intersectRayHandlers(e,t,n,r,i,a=()=>!0,o=!0){let{options:s}=e,c=s.isFiltered,l=s.filteredLayerViewUids;for(let{handler:c,filterPredicate:l,isFiltered:u,filteredLayerViewUids:d}of this._getFilteredIntersectionHandlers(t,r,null,a,o))(!u||c.isGround&&i)&&(s.isFiltered=u,s.filteredLayerViewUids=d,c.intersectRay(e,l,e.rayBegin,e.rayEnd,n.screenPoint,n.isVerticalRay));s.isFiltered=c,s.filteredLayerViewUids=l}*_intersectPolygonHandlersGenerator(e,t,n,r,i,a=()=>!0,o=!0,s){let{options:c}=e,l=c.isFiltered,u=c.filteredLayerViewUids,d=e.screenPolygonPrimitiveProcessor;for(let{handler:l,screenPolygonPrimitiveProcessor:u,isFiltered:d,filteredLayerViewUids:f}of this._getFilteredIntersectionHandlers(t,r,i,a,o))d||l.intersectScreenPolygon==null||(c.isFiltered=d,c.filteredLayerViewUids=f,e.screenPolygonPrimitiveProcessor=u??O,yield*l.intersectScreenPolygon(e,n,s));c.isFiltered=l,c.filteredLayerViewUids=u,e.screenPolygonPrimitiveProcessor=d}*_intersectDrapedScreenPolygon(e,t,n,r){let{basemapTerrain:i,overlayManager:a}=this._view,o=this._view.groundView.spatialReference!=null&&!a.renderer.isEmpty;if(!e.options.selectionMode||!r?.enableDraped||!o)return;let s=yield*this._createDrapedPolygonIntersectionQueries(n,i.slicePlaneEnabled?this._view.slice.plane:null);s!=null&&(yield*this._view.overlayManager.renderer.intersectScreenPolygon(e,s,e=>t.filterRenderGeometry(e)))}*_createDrapedPolygonIntersectionQueries(t,n){let{state:{camera:{eye:r}},pointsOfInterest:i}=this._view,a=this._view.groundView.spatialReference,c=[],l=n?[]:null,u=S(this._view,i.focus.renderLocation),f=v(a),m=1/0,h=null,g=K,_=q,y=e=>{if(!this._intersectDrapedScreenPolygonPoint(g,_,e))return!1;let t=h!=null&&f?h+f.shortestSignedDiff(h,g[0]):g[0];return h=t,c.push(s(t,g[1])),l&&l.push(p(_)),m=Math.min(m,d(r,_)),!0},{points:b}=t,{length:x}=b;for(let t=0;t<x;t++){let n=b[t],r=b[(t+1)%x];for(let t=0;t<u;t++){let i=t/u;if(!y(t===0?n:o(Y,e(n[0],r[0],i),e(n[1],r[1],i))))return null;yield}}if(!Number.isFinite(m))return null;if(n==null||!l)return[G(c,m)];let C=this._clipDrapedScreenPolygonIntersectionQueries(l,n,f,r);return C.length>0?C:null}_clipDrapedScreenPolygonIntersectionQueries(e,t,n,r){let i=[],a=N(t);for(let t of P(a,e)){let e=this._createDrapedQueryFromRenderPolygon(t,n,r);e!=null&&i.push(e)}return i.sort((e,t)=>e.distance-t.distance),i}_createDrapedQueryFromRenderPolygon(e,t,n){let{renderCoordsHelper:r}=this._view,i=this._view.groundView.spatialReference,a=[],o=1/0,c=null;for(let l of e){if(!r.fromRenderCoords(l,X,i))return null;let e=c!=null&&t?c+t.shortestSignedDiff(c,X[0]):X[0];c=e,a.push(s(e,X[1])),o=Math.min(o,d(n,l))}return a.length>=3&&Number.isFinite(o)?G(a,o):null}_intersectDrapedScreenPolygonPoint(e,t,n){let r=this._getPickRay(n,this._tmpRay);if(r==null)return!1;let{renderCoordsHelper:i}=this._view;this._intersectGroundPoint(t,r,n)||i.intersectManifoldClosestSilhouette(r,0,t);let a=this._view.groundView.spatialReference;return!!i.fromRenderCoords(t,e,a)}_intersectGroundPoint(e,t,n){let r=this._view.state.camera,i=new U(null,this._forEachLayer),a=new D(this.viewingMode);J[0]=n[0],J[1]=n[1],J[2]=0;let o=this._createRayIntersectionQuery(t,J,!1);return a.options.selectionMode=!0,a.options.store=0,a.options.normalRequired=!1,a.options.selectOpaqueTerrainOnly=!1,a.reset(o.beginPoint,o.endPoint,r),this._intersectRayHandlers(a,i,o,null,!0,e=>e.isGround,!1),a.results.ground.getIntersectionPoint(e)}*_getFilteredIntersectionHandlers(e,t,n,r=()=>!0,i=!0){for(let a of this._externalIntersectionHandlers){if(!r(a))continue;let o=!1,s=[];if(i){let t=a.layerViewUid,n=a.sublayerId,r=Array.isArray(t),i=r?t:[t],c=!1;for(let t of i)e.filterLayerViewUid(t,n)?c=!0:r&&s.push(t);o=!c}yield new B(a,a.slicePlaneEnabled?t:null,a.slicePlaneEnabled?n:null,o,s)}}}class z{constructor(e){this.result=e,this.screenPoint=r()}}class B{constructor(e,t,n,r,i){this.handler=e,this.filterPredicate=t,this.screenPolygonPrimitiveProcessor=n,this.isFiltered=r,this.filteredLayerViewUids=i}}let V;function H(e){return(!V||V.viewingMode!==e)&&(V=new D(e)),V}class U{constructor(e,t){this.layers=[],this.sliceableLayers=[],this.include=e?.include,this.exclude=e?.exclude,this.objectFilter=e?.objectFilter,this.allowedIntersectorTypes=e?.allowedIntersectorTypes,t(e=>{e.pickable&&this.filterLayerViewUid(e.apiLayerViewUid)&&(e.sliceable?this.sliceableLayers:this.layers).push(e)})}filterLayerViewUid(e,t){let{include:n,exclude:r}=this;if(e==null)return n==null&&r==null;let i=n instanceof Map?n.get(e)??!1:n?.has(e),a=r instanceof Map?r.get(e)??!1:r?.has(e);return(i==null||(typeof i==`boolean`?i:t!=null&&i.has(t)))&&(a==null||!(typeof a==`boolean`?a:t!=null&&a.has(t)))}filterRenderGeometry(e){return this.filterLayerViewUid(e.layerViewUid)}}function W(e){return typeof e==`object`&&!!e&&`intersectRay`in e}function G(e,t){return new A(e,_(m(g),e),t)}const K=f(),q=f(),J=r(),Y=i(),X=f(),Z=r();export{R as SceneIntersectionHelper,W as isIntersectionHandler};
2
+ import{lerp as e}from"../../../../core/mathUtils.js";import t from"../../../../core/PooledArray.js";import{castRenderScreenPointArray3 as n,createRenderScreenPointArray3 as r,createScreenPointArray as i}from"../../../../core/screenUtils.js";import{getMetersPerVerticalUnitForSR as a}from"../../../../core/units.js";import{set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as s}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{add as c,normalize as l,dot as u,distance as d}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f,clone as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as m,copy as h,negativeInfinity as g,expandWithNestedArray as _}from"../../../../geometry/support/aaBoundingRect.js";import{createSpatialReferenceCyclical as v}from"../../../../geometry/support/normalizeUtils.js";import{create as y}from"../../../../geometry/support/ray.js";import{sv3d as b}from"../../../../geometry/support/vectorStacks.js";import{getElevationOffsetInMeters as x}from"../../../../support/elevationInfoUtils.js";import{g as S}from"../../../../chunks/cameraUtilsSpherical.js";import{computeMapPointFromVec3d as C}from"../../support/hitTest.js";import{fromRenderAtEye as w,fromScreen as T}from"../../support/geometryUtils/ray.js";import{defaultTolerance as E,Intersector as D,defaultScreenPolygonPrimitiveProcessor as O}from"../../webgl-engine/lib/Intersector.js";import{RayIntersectionQuery as k,DrapedScreenPolygonIntersectionQuery as A}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as j}from"../../webgl-engine/lib/IntersectorResult.js";import{SliceScreenPolygonPrimitiveProcessor as M,createSliceExtrusionHalfspacePlanes as N,clipPolygonAgainstSlicedAwayHalfspaces as P,sliceFilterPredicate as F}from"../../webgl-engine/lib/intersectorUtils.js";import{prepareScreenPolygonIntersectionQuery as I}from"../../webgl-engine/lib/screenPolygonIntersectionUtils.js";import{TaskPriority as L}from"../../../support/Scheduler.js";class R{constructor(e,n,r){this.viewingMode=e,this._forEachLayer=n,this._view=r,this._externalIntersectionHandlers=new t,this._tolerance=E,this._tmpRay=y(),this._tmpRegion=m(),this._validateHUDIntersector=new D(this.viewingMode),this._validateHUDIntersector.options.hud=!1,this._screenPolygonIntersectionTask=this._view.resourceController.scheduler.registerTask(L.SCREEN_POLYGON_INTERSECTION)}destroy(){this._screenPolygonIntersectionTask.remove(),this._externalIntersectionHandlers.prune()}get screenPolygonIntersectionTask(){return this._screenPolygonIntersectionTask}intersectScreen(e,t,n){return this.intersectRay(this._getPickRay(e,this._tmpRay),H(this.viewingMode),t,n)}intersectScreenFreePointFallback(e,t,n){return this.intersectRayFreePointFallback(this._getPickRay(e,this._tmpRay),t,n)}intersectRayFreePointFallback(e,t,n){return this.intersectRay(e,H(this.viewingMode),t,n)||this._intersectRayFreePointLocal(e,t)}intersectRay(e,t,n,r){return t.options.selectionMode=!1,t.options.store=0,this.computeIntersection(e,t,!1,r),t.results.min?t.results.min.getIntersectionPoint(n):!1}getCenterRayWithSubpixelOffset(e,t,n=.5,r=.5){return e.getRenderCenter(Z,n,r),Z[0]+=.0466,Z[1]-=.0123,w(e,Z,t)}intersectIntersectorScreen(e,t,n){this.computeIntersection(this._getPickRay(e,this._tmpRay),t,!1,n)}async intersectIntersectorScreenPolygon(e,t,n){t.polygonResults.init();let r=this._view.state.camera,i=await I(r,e);i!=null&&await this._screenPolygonIntersectionTask.scheduleGenerator(e=>this._intersectIntersectorScreenPolygon(r,t,i,n,e))}*_intersectIntersectorScreenPolygon(e,t,n,r,i){let a=new U(r,this._forEachLayer);t.options.selectOpaqueTerrainOnly=!r||!(`include`in r||`exclude`in r),t.camera=e,t.point=null,t.screenPolygonPrimitiveProcessor=O,yield*t.intersectScreenPolygon(a.layers,n);let o=this._view.slice.plane,s=o?new M(o):null;t.screenPolygonPrimitiveProcessor=s??O,yield*t.intersectScreenPolygon(a.sliceableLayers,n),t.screenPolygonPrimitiveProcessor=O,yield*this._intersectPolygonHandlersGenerator(t,a,n,null,s,void 0,!0,i),yield*this._intersectDrapedScreenPolygon(t,a,n,r),yield*t.intersectHUDScreenPolygon(a.layers,n),t.screenPolygonPrimitiveProcessor=s??O,yield*t.intersectHUDScreenPolygon(a.sliceableLayers,n),t.polygonResults.sortResults()}intersectToolIntersectorScreen(e,t,n){let r=this._getPickRay(e,this._tmpRay);this.intersectToolIntersectorRay(r,t,n)}intersectToolIntersectorRay(e,t,n){t.options.selectionMode=!0,this.computeIntersection(e,t,!1,n);let r=t.results.min;this._view.groundView.opaque||j(r)&&r.intersector!==7||(t.options.selectionMode=!1,this.computeIntersection(e,t,!1,n))}setTolerance(e=E){this._tolerance=e}addIntersectionHandler(e){this._externalIntersectionHandlers.push(e),this._externalIntersectionHandlers.sort((e,t)=>e.type===7?1:t.type===7?-1:0)}removeIntersectionHandler(e){this._externalIntersectionHandlers.removeUnordered(e)!=null&&this._externalIntersectionHandlers.sort((e,t)=>e.type===7?1:t.type===7?-1:0)}_getPickRay(e,t){let n=this._view.state.camera;return T(n,e,t)}_intersectRayFreePointLocal(e,t){return this.viewingMode!==2||e==null||c(t,e.origin,l(b.get(),e.direction)),!1}intersectElevationFromScreen(e,t,n=0,r=null){return this._intersectElevation(this._getPickRay(e,this._tmpRay),t,n,r)}_intersectElevation(e,t,r=0,i=null){if(e==null)return null;let o=this._view,{renderCoordsHelper:s}=o,c=a(o.spatialReference),d=t==null?`absolute-height`:t.mode,f=x(t)/c,p=(d===`on-the-ground`?0:f+r)*c/s.unitInMeters,{camera:m}=o.state;if(d===`absolute-height`){let t=s?.getAltitude(m.eye),n=u(l(K,e.direction),s.worldUpAtPosition(m.eye,q));if(t<p&&n<0||t>=p&&n>0)return null;if(s.intersectInfiniteManifold(e,p,K)){let e=C(o,K);return e.z??=0,e.z-=f,e}return null}let h=m.projectToRenderScreen(e.origin,n(b.get())),g=new U(null,this._forEachLayer),_=o.slice.plane,v=_?F(_):null,y=new D(this.viewingMode);y.options.store=0,y.options.verticalOffset=p,y.options.normalRequired=!1;let S=this._createRayIntersectionQuery(e,h,!1);y.reset(S.beginPoint,S.endPoint,m),y.point=h;let w=null;if(i&&`type`in i&&i.type===`graphics`){let e=o.allLayerViews.find(e=>e.layer===i)?.uid;w=e?t=>t.layerViewUid===e:null}else i&&(w=e=>e.graphicUid!==i.uid);switch(d){case`relative-to-scene`:y.intersect(g.layers,S.screenPoint,this._tolerance,null,e=>(!w||w(e))&&!!e.lastValidElevationBB),this._intersectRayHandlers(y,g,S,v,!1,e=>e.type===2||e.type===7||e.type===8,!1);break;case`on-the-ground`:case`relative-to-ground`:this._intersectRayHandlers(y,g,S,v,!1,e=>e.isGround,!1)}if(y.results.min.getIntersectionPoint(K)){let e=C(o,K);return e.z=r,e}return null}computeIntersection(e,t,r,i){if(e==null)return;let a=this._view.state.camera,o=a.projectToRenderScreen(e.origin,n(b.get())),s=new U(i,this._forEachLayer);t.options.selectOpaqueTerrainOnly=!i||!(`include`in i||`exclude`in i);let c=this._createRayIntersectionQuery(e,o,r);t.reset(c.beginPoint,c.endPoint,a),t.intersect(s.layers,c.screenPoint,this._tolerance,null,s.objectFilter);let l=this._view.slice.plane,u=l?F(l):null;t.intersect(s.sliceableLayers,c.screenPoint,this._tolerance,u,s.objectFilter);let d=i&&(i.requiresGroundFeedback||i.enableDraped);this._intersectRayHandlers(t,s,c,u,!!d,e=>s.allowedIntersectorTypes==null||s.allowedIntersectorTypes.has(e.type));let f=b.get(),p=this._view,m=p.groundView.spatialReference;if(i&&i.enableDraped&&m!=null&&t.results.ground.getIntersectionPoint(f)){let e=p.overlayManager.renderer,n=p.renderCoordsHelper.spatialReference,r=b.get();p.renderCoordsHelper.fromRenderCoords(f,r,m),r[2]=p.elevationProvider?.getElevation(f[0],f[1],f[2],n,`ground`)??0,e.intersectRay(t,r,t.results.ground,e=>s.filterRenderGeometry(e))}t.sortResults(),this._processHUDResults(t)}_processHUDResults(e){let t=e.results.hud;h(this._tmpRegion,g);let n=[],r=this._tmpRegion,i=e=>{n.push(new z(e))};e.sortResults(t.all),t.min.distance!=null&&i(t.min);for(let e of t.all)t.min.target.object!==e.target.object&&t.max.target.object!==e.target.object&&i(e);if(t.max.distance!=null&&t.max.target.object!==t.min.target.object&&i(t.max),!n.length)return;r[0]===r[2]&&(r[2]+=1),r[1]===r[3]&&(r[3]+=1);let a=!0,o=e.results.max.distance==null,s=0;for(let t of n)a&&=(e.results.min.copy(t.result),!1),o&&e.results.max.copy(t.result),e.options.store===2&&e.results.all.splice(s++,0,t.result)}_createRayIntersectionQuery(e,t,n){return new k(e.origin,c(f(),e.origin,e.direction),t,n)}_intersectRayHandlers(e,t,n,r,i,a=()=>!0,o=!0){let{options:s}=e,c=s.isFiltered,l=s.filteredLayerViewUids;for(let{handler:c,filterPredicate:l,isFiltered:u,filteredLayerViewUids:d}of this._getFilteredIntersectionHandlers(t,r,null,a,o))(!u||c.isGround&&i)&&(s.isFiltered=u,s.filteredLayerViewUids=d,c.intersectRay(e,l,e.rayBegin,e.rayEnd,n.screenPoint,n.isVerticalRay));s.isFiltered=c,s.filteredLayerViewUids=l}*_intersectPolygonHandlersGenerator(e,t,n,r,i,a=()=>!0,o=!0,s){let{options:c}=e,l=c.isFiltered,u=c.filteredLayerViewUids,d=e.screenPolygonPrimitiveProcessor;for(let{handler:l,screenPolygonPrimitiveProcessor:u,isFiltered:d,filteredLayerViewUids:f}of this._getFilteredIntersectionHandlers(t,r,i,a,o))d||l.intersectScreenPolygon==null||(c.isFiltered=d,c.filteredLayerViewUids=f,e.screenPolygonPrimitiveProcessor=u??O,yield*l.intersectScreenPolygon(e,n,s));c.isFiltered=l,c.filteredLayerViewUids=u,e.screenPolygonPrimitiveProcessor=d}*_intersectDrapedScreenPolygon(e,t,n,r){let{basemapTerrain:i,overlayManager:a}=this._view,o=this._view.groundView.spatialReference!=null&&!a.renderer.isEmpty;if(!e.options.selectionMode||!r?.enableDraped||!o)return;let s=yield*this._createDrapedPolygonIntersectionQueries(n,i.slicePlaneEnabled?this._view.slice.plane:null);s!=null&&(yield*this._view.overlayManager.renderer.intersectScreenPolygon(e,s,e=>t.filterRenderGeometry(e)))}*_createDrapedPolygonIntersectionQueries(t,n){let{state:{camera:{eye:r}},pointsOfInterest:i}=this._view,a=this._view.groundView.spatialReference,c=[],l=n?[]:null,u=S(this._view,i.focus.renderLocation),f=v(a),m=1/0,h=null,g=K,_=q,y=e=>{if(!this._intersectDrapedScreenPolygonPoint(g,_,e))return!1;let t=h!=null&&f?h+f.shortestSignedDiff(h,g[0]):g[0];return h=t,c.push(s(t,g[1])),l&&l.push(p(_)),m=Math.min(m,d(r,_)),!0},{points:b}=t,{length:x}=b;for(let t=0;t<x;t++){let n=b[t],r=b[(t+1)%x];for(let t=0;t<u;t++){let i=t/u;if(!y(t===0?n:o(Y,e(n[0],r[0],i),e(n[1],r[1],i))))return null;yield}}if(!Number.isFinite(m))return null;if(n==null||!l)return[G(c,m)];let C=this._clipDrapedScreenPolygonIntersectionQueries(l,n,f,r);return C.length>0?C:null}_clipDrapedScreenPolygonIntersectionQueries(e,t,n,r){let i=[],a=N(t);for(let t of P(a,e)){let e=this._createDrapedQueryFromRenderPolygon(t,n,r);e!=null&&i.push(e)}return i.sort((e,t)=>e.distance-t.distance),i}_createDrapedQueryFromRenderPolygon(e,t,n){let{renderCoordsHelper:r}=this._view,i=this._view.groundView.spatialReference,a=[],o=1/0,c=null;for(let l of e){if(!r.fromRenderCoords(l,X,i))return null;let e=c!=null&&t?c+t.shortestSignedDiff(c,X[0]):X[0];c=e,a.push(s(e,X[1])),o=Math.min(o,d(n,l))}return a.length>=3&&Number.isFinite(o)?G(a,o):null}_intersectDrapedScreenPolygonPoint(e,t,n){let r=this._getPickRay(n,this._tmpRay);if(r==null)return!1;let{renderCoordsHelper:i}=this._view;this._intersectGroundPoint(t,r,n)||i.intersectManifoldClosestSilhouette(r,0,t);let a=this._view.groundView.spatialReference;return!!i.fromRenderCoords(t,e,a)}_intersectGroundPoint(e,t,n){let r=this._view.state.camera,i=new U(null,this._forEachLayer),a=new D(this.viewingMode);J[0]=n[0],J[1]=n[1],J[2]=0;let o=this._createRayIntersectionQuery(t,J,!1);return a.options.selectionMode=!0,a.options.store=0,a.options.normalRequired=!1,a.options.selectOpaqueTerrainOnly=!1,a.reset(o.beginPoint,o.endPoint,r),this._intersectRayHandlers(a,i,o,null,!0,e=>e.isGround,!1),a.results.ground.getIntersectionPoint(e)}*_getFilteredIntersectionHandlers(e,t,n,r=()=>!0,i=!0){for(let a of this._externalIntersectionHandlers){if(!r(a))continue;let o=!1,s=[];if(i){let t=a.layerViewUid,n=a.sublayerId,r=Array.isArray(t),i=r?t:[t],c=!1;for(let t of i)e.filterLayerViewUid(t,n)?c=!0:r&&s.push(t);o=!c}yield new B(a,a.slicePlaneEnabled?t:null,a.slicePlaneEnabled?n:null,o,s)}}}class z{constructor(e){this.result=e,this.screenPoint=r()}}class B{constructor(e,t,n,r,i){this.handler=e,this.filterPredicate=t,this.screenPolygonPrimitiveProcessor=n,this.isFiltered=r,this.filteredLayerViewUids=i}}let V;function H(e){return V&&V.viewingMode===e||(V=new D(e)),V}class U{constructor(e,t){this.layers=[],this.sliceableLayers=[],this.include=e?.include,this.exclude=e?.exclude,this.objectFilter=e?.objectFilter,this.allowedIntersectorTypes=e?.allowedIntersectorTypes,t(e=>{e.pickable&&this.filterLayerViewUid(e.apiLayerViewUid)&&(e.sliceable?this.sliceableLayers:this.layers).push(e)})}filterLayerViewUid(e,t){let{include:n,exclude:r}=this;if(e==null)return n==null&&r==null;let i=n instanceof Map?n.get(e)??!1:n?.has(e),a=r instanceof Map?r.get(e)??!1:r?.has(e);return(i==null||(typeof i==`boolean`?i:t!=null&&i.has(t)))&&(a==null||!(typeof a==`boolean`?a:t!=null&&a.has(t)))}filterRenderGeometry(e){return this.filterLayerViewUid(e.layerViewUid)}}function W(e){return typeof e==`object`&&!!e&&`intersectRay`in e}function G(e,t){return new A(e,_(m(g),e),t)}const K=f(),q=f(),J=r(),Y=i(),X=f(),Z=r();export{R as SceneIntersectionHelper,W as isIntersectionHandler};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{asinClamped as e}from"../../../core/mathUtils.js";import{len as t}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as r,expand as i,create as a,fromValues as o}from"../../../geometry/support/aaBoundingRect.js";import{getInfo as s,isGeographic as c}from"../../../geometry/support/spatialReferenceUtils.js";const l=1;function u(e,t){let n=t.valid,r=c(e)?90:n[1];return o(n[0],-r,n[1],r)}function d(e,t){let n=s(t);if(t==null||n==null){if(e.length===0)return[];let t=a();return m(e,t),[t]}return e.length===0?[u(t,n)]:p(e,n)}class f{constructor(e){this._renderCoordsHelper=e,this.extent=r(),this._mapCenterX=NaN,this._worldXWidth=0}reset(n,i,a){r(this.extent),this._mapCenterX=NaN;let o=s(a);if(this._renderCoordsHelper.viewingMode!==1||o==null)return;let c=t(n);if(i>=c)return;let l=Math.asin(i/c),u=e(n[2]/c);if(l>g||Math.abs(u)+l>=Math.PI/2||this._renderCoordsHelper.fromRenderCoords(n,_,a)==null)return;this._mapCenterX=_[0];let d=o.valid;this._worldXWidth=d[1]-d[0]}addRenderPoint(e,t){return this._renderCoordsHelper.fromRenderCoords(e,_,t)==null?null:(Number.isFinite(this._mapCenterX)&&(_[0]+=Math.round((this._mapCenterX-_[0])/this._worldXWidth)*this._worldXWidth),i(this.extent,_,this.extent),_)}}function p(e,t){let n=t.valid,r=n[1]-n[0],i=e[0],a=1/0,s=1/0,c=-1/0,l=-1/0,u=1/0,d=-1/0;for(let t=0;t<e.length;t+=4){let n=e[t],o=e[t+1],f=e[t+2],p=e[t+3];a=Math.min(a,n),c=Math.max(c,f),s=Math.min(s,o),l=Math.max(l,p);let m=Math.round((i-n)/r),h=n+m*r,g=f+m*r;u=Math.min(u,h),d=Math.max(d,g)}let f=o(a,s,c,l),p=a,m=c;if(d-u<m-p&&(p=u,m=d),m-p>=r)return f[0]=n[0],f[2]=n[1],[f];let g=h(p,n[0],r);return p+=g*r,m+=g*r,m<=n[1]?(f[0]=p,f[2]=m,[f]):(f[0]=n[0],f[2]=m-r,[f,o(p,s,n[1],l)])}function m(e,t){let n=1/0,r=1/0,i=-1/0,a=-1/0;for(let t=0;t<e.length;t+=4){let o=e[t],s=e[t+1],c=e[t+2],l=e[t+3];n=Math.min(n,o),r=Math.min(r,s),i=Math.max(i,c),a=Math.max(a,l)}o(n,r,i,a,t)}function h(e,t,n){return Math.ceil((t-e)/n)}const g=Math.PI/4,_=n();export{f as ProjectedElevationUpdateExtent,d as calculateElevationUpdateExtents,u as fullWorldElevationUpdateExtent,l as planetCenterProximityToleranceMeters};
2
+ import{asinClamped as e}from"../../../core/mathUtils.js";import{len as t,lerp as n}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as r,fromValues as i}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import a from"../../../geometry/SpatialReference.js";import{projectBoundingRect as o}from"../../../geometry/projection/projectBoundingRect.js";import{projectBuffer as s}from"../../../geometry/projection/projectBuffer.js";import{wgs84ToWebMercator as c}from"../../../geometry/projection/projectors.js";import{empty as l,expand as u,copy as d,create as f,fromValues as p}from"../../../geometry/support/aaBoundingRect.js";import{getInfo as m,isWebMercator as h,isGeographic as g}from"../../../geometry/support/spatialReferenceUtils.js";export{intersectsGeographicExtent as intersectsElevationUpdateExtent,sphereToGeographicExtent}from"./sphereExtentUtils.js";const _=1;function v(e,t,n,r){let i=e[1],c=e[3];if(t==null||r==null||!o(e,t,n,r))return!1;if(!h(t)||h(r))return!0;if(i<=-x[1]){if(!s(y,a.WGS84,0,S,r,0))return!1;n[1]=S[1]}if(c>=x[1]){if(!s(b,a.WGS84,0,S,r,0))return!1;n[3]=S[1]}return!0}const y=i(0,-90,0),b=i(0,90,0),x=r();c(b,0,x,0);const S=r();function C(e,t,n,r){if(n<e[1]||n>e[3])return!1;if(t>=e[0]&&t<=e[2])return!0;let i=m(r);if(i==null)return!1;let a=i.valid[1]-i.valid[0];return Math.ceil((e[0]-t)/a)<=Math.floor((e[2]-t)/a)}function w(e,t){let n=t.valid,r=g(e)?90:n[1];return h(e)&&(r=x[1]),p(n[0],-r,n[1],r)}function T(e,t){let n=m(t);if(t==null||n==null){if(e.length===0)return[];let t=f();return O(e,t),[t]}return e.length===0?[w(t,n)]:D(e,n)}class E{constructor(e){this._renderCoordsHelper=e,this.extent=l(),this._mapCenterX=NaN,this._worldXWidth=0}reset(n,r,i){l(this.extent),this._mapCenterX=NaN;let a=m(i);if(this._renderCoordsHelper.viewingMode!==1||i==null||a==null)return;let o=t(n);if(r>=o){this._setFullWorldExtent(i,a);return}let s=Math.asin(r/o),c=e(n[2]/o);if(s>A||Math.abs(c)+s>=Math.PI/2){this._setFullWorldExtent(i,a);return}if(this._renderCoordsHelper.fromRenderCoords(n,j,i)==null)return;this._mapCenterX=j[0];let u=a.valid;this._worldXWidth=u[1]-u[0]}addRenderPoint(e,t){return this._renderCoordsHelper.fromRenderCoords(e,j,t)==null?null:(Number.isFinite(this._mapCenterX)&&(j[0]+=Math.round((this._mapCenterX-j[0])/this._worldXWidth)*this._worldXWidth),u(this.extent,j,this.extent),j)}addRenderEdge(e,t,r){if(this._renderCoordsHelper.viewingMode!==1)return!0;let i=t[0]-e[0],a=t[1]-e[1],o=t[2]-e[2],s=e[0]*e[0]+e[1]*e[1],c=e[0]*i+e[1]*a,l=i*i+a*a,u=o*c-e[2]*l,d=(e[2]*c-o*s)/u;return d>0&&d<1?(n(M,e,t,d),this.addRenderPoint(M,r)!=null):!0}_setFullWorldExtent(e,t){d(this.extent,w(e,t))}}function D(e,t){let n=t.valid,r=n[1]-n[0],i=e[0],a=1/0,o=1/0,s=-1/0,c=-1/0,l=1/0,u=-1/0;for(let t=0;t<e.length;t+=4){let n=e[t],d=e[t+1],f=e[t+2],p=e[t+3];a=Math.min(a,n),s=Math.max(s,f),o=Math.min(o,d),c=Math.max(c,p);let m=Math.round((i-n)/r),h=n+m*r,g=f+m*r;l=Math.min(l,h),u=Math.max(u,g)}let d=p(a,o,s,c),f=a,m=s;if(u-l<m-f&&(f=l,m=u),m-f>=r)return d[0]=n[0],d[2]=n[1],[d];let h=k(f,n[0],r);return f+=h*r,m+=h*r,m<=n[1]?(d[0]=f,d[2]=m,[d]):(d[0]=n[0],d[2]=m-r,[d,p(f,o,n[1],c)])}function O(e,t){let n=1/0,r=1/0,i=-1/0,a=-1/0;for(let t=0;t<e.length;t+=4){let o=e[t],s=e[t+1],c=e[t+2],l=e[t+3];n=Math.min(n,o),r=Math.min(r,s),i=Math.max(i,c),a=Math.max(a,l)}p(n,r,i,a,t)}function k(e,t,n){return Math.ceil((t-e)/n)}const A=Math.PI/4,j=r(),M=r();export{E as ProjectedElevationUpdateExtent,T as calculateElevationUpdateExtents,C as containsElevationUpdatePoint,w as fullWorldElevationUpdateExtent,_ as planetCenterProximityToleranceMeters,v as projectElevationUpdateExtent};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{handlesGroup as e}from"../../../core/handleUtils.js";import{watch as t,initial as n}from"../../../core/reactiveUtils.js";import{assertNotMesh as r}from"../../../geometry/asserts.js";import i from"../../../geometry/Extent.js";import{projectOrLoad as a}from"../../../geometry/projectionUtils.js";import{projectBoundingRect as o}from"../../../geometry/projection/projectBoundingRect.js";import{intersects as s,fromExtent as c,empty as l}from"../../../geometry/support/aaBoundingRect.js";function u(l){let u=!1,m=(e,t,n)=>{if(u||d(e,n)||t==null)return;r(t);let h=a(t,l.view.spatialReference);if(h.pending!=null){u=!0,h.pending.finally(()=>{u=!1,m(e,t,n)});return}let g=h.geometry;if(g==null)return;let _=g.type===`point`?i.fromPoint(g):g.extent;_!=null&&o(e.extent,e.spatialReference,f,l.view.spatialReference)&&s(f,c(_,p))&&l.onElevationChanges()},h,g=t(()=>({elevationMode:l.elevationInfo?.mode,geometry:l.geometry}),({elevationMode:e,geometry:t})=>{h?.remove(),e!==`absolute-height`&&(h=l.view.elevationProvider.on(`elevation-change`,n=>m(n,t,e)))},n);return e([g,h])}function d({context:e},t){return t==null?!1:t===`absolute-height`||e===`scene`&&t!==`relative-to-scene`}const f=l(),p=l();export{u as createElevationUpdateHandle};
2
+ import{handlesGroup as e}from"../../../core/handleUtils.js";import{watch as t,initial as n}from"../../../core/reactiveUtils.js";import{assertNotMesh as r}from"../../../geometry/asserts.js";import i from"../../../geometry/Extent.js";import{projectOrLoad as a}from"../../../geometry/projectionUtils.js";import{fromExtent as o,empty as s}from"../../../geometry/support/aaBoundingRect.js";import{projectElevationUpdateExtent as c}from"./elevationUpdateExtentUtils.js";import{intersectsGeographicExtent as l}from"./sphereExtentUtils.js";function u(s){let u=!1,m=(e,t,n)=>{if(u||d(e,n)||t==null)return;r(t);let h=a(t,s.view.spatialReference);if(h.pending!=null){u=!0,h.pending.finally(()=>{u=!1,m(e,t,n)});return}let g=h.geometry;if(g==null)return;let _=g.type===`point`?i.fromPoint(g):g.extent;_!=null&&c(e.extent,e.spatialReference,f,s.view.spatialReference)&&l(f,o(_,p),s.view.spatialReference)&&s.onElevationChanges()},h,g=t(()=>({elevationMode:s.elevationInfo?.mode,geometry:s.geometry}),({elevationMode:e,geometry:t})=>{h?.remove(),e!==`absolute-height`&&(h=s.view.elevationProvider.on(`elevation-change`,n=>m(n,t,e)))},n);return e([g,h])}function d({context:e},t){return t==null?!1:t===`absolute-height`||e===`scene`&&t!==`relative-to-scene`}const f=s(),p=s();export{u as createElevationUpdateHandle};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{clamp as t}from"../../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{watch as r}from"../../../../core/reactiveUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{property as a,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{exactEquals as s,dot as c,copy as l,lerp as u,subtract as d,normalize as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import m from"../../../../geometry/Point.js";import{wrap as h}from"../../../../geometry/support/ray.js";import{PointOfInterest as g}from"./PointOfInterest.js";import{PropertiesPool as _}from"../../../support/PropertiesPool.js";import{TaskPriority as v}from"../../../support/Scheduler.js";import{Yield as y}from"../../../support/Yield.js";let b=class extends g{constructor(e){super(e),this._propertiesPool=new _({location:()=>new m,renderLocation:()=>p()},this),this._dirty=!0,this.renderLocation=this._propertiesPool.get(`renderLocation`)}initialize(){this.addHandles([r(()=>this.centerOnSurface.renderLocation,()=>this.updateRenderLocation(),{equals:s}),r(()=>this.state.contentCamera,()=>this.updateRenderLocation())]),this.scheduler&&this.addHandles(this.scheduler.registerTask(v.POINT_OF_INTEREST_FREQUENT,this))}destroy(){this._propertiesPool=n(this._propertiesPool)}get updating(){return this._dirty||this.centerOnSurface.updating}get location(){let e=this._propertiesPool.get(`location`);return e.spatialReference=this.state.spatialReference,this.renderCoordsHelper.fromRenderCoords(this.renderLocation,e),e}get worldUnitsPerContentPixel(){let{camera:e,contentPixelRatio:t}=this.state;return e.computeRenderPixelSizeAt(this.renderLocation)*(e.pixelRatio/t)}get readyToRun(){return this._dirty}runTask(){let e=this._get(`renderLocation`),n=this.centerOnSurface.renderLocation,r=this.renderCoordsHelper,i=this.state.contentCamera;this._dirty=!1,r.worldUpAtPosition(n,x);let a=Math.max(0,(Math.acos(c(x,i.viewForward))-.5*Math.PI)*(i.aboveGround?1:-1));if(Number.isNaN(a)){if(!e||!s(e,n)){let e=this._propertiesPool.get(`renderLocation`);l(e,n),this._set(`renderLocation`,e)}return y}let o=1-t(a/(.5*Math.PI),0,1),d=o*o*o;this._calculateScreenHorizontalEdgeOnSurface(C);let f=this._propertiesPool.get(`renderLocation`);return u(f,n,C,d),(!e||!s(e,f))&&this._set(`renderLocation`,f),y}_calculateScreenHorizontalEdgeOnSurface(e){let t=this.state.contentCamera,n=t.getRenderCenter(i());if(n[1]=t.aboveGround?t.padding[2]:t.fullHeight-t.padding[0],this.estimateSurfaceIntersectionAtRenderPoint(n,e))return e;let r=this.renderCoordsHelper.getAltitude(this.centerOnSurface.renderLocation);if(t.unprojectFromRenderScreen(n,S)){d(S,S,t.eye);let n=f(S,S);if(this.renderCoordsHelper.intersectInfiniteManifold(h(t.eye,n),r,e))return e}return this.renderCoordsHelper.setAltitude(e,r,t.eye)}updateRenderLocation(){this._dirty=!0}};e([a()],b.prototype,`_dirty`,void 0),e([a({constructOnly:!0})],b.prototype,`scheduler`,void 0),e([a({constructOnly:!0})],b.prototype,`centerOnSurface`,void 0),e([a({constructOnly:!0})],b.prototype,`estimateSurfaceIntersectionAtRenderPoint`,void 0),e([a()],b.prototype,`updating`,null),e([a()],b.prototype,`location`,null),e([a()],b.prototype,`renderLocation`,void 0),e([a()],b.prototype,`worldUnitsPerContentPixel`,null),b=e([o(`esri.views.3d.support.pointsOfInterest.Focus`)],b);const x=p(),S=p(),C=p();export{b as Focus};
2
+ import{__decorate as e}from"tslib";import{clamp as t}from"../../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{watch as r}from"../../../../core/reactiveUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{property as a,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{exactEquals as s,dot as c,copy as l,lerp as u,subtract as d,normalize as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import m from"../../../../geometry/Point.js";import{wrap as h}from"../../../../geometry/support/ray.js";import{PointOfInterest as g}from"./PointOfInterest.js";import{PropertiesPool as _}from"../../../support/PropertiesPool.js";import{TaskPriority as v}from"../../../support/Scheduler.js";import{Yield as y}from"../../../support/Yield.js";let b=class extends g{constructor(e){super(e),this._propertiesPool=new _({location:()=>new m,renderLocation:()=>p()},this),this._dirty=!0,this.renderLocation=this._propertiesPool.get(`renderLocation`)}initialize(){this.addHandles([r(()=>this.centerOnSurface.renderLocation,()=>this.updateRenderLocation(),{equals:s}),r(()=>this.state.contentCamera,()=>this.updateRenderLocation())]),this.scheduler&&this.addHandles(this.scheduler.registerTask(v.POINT_OF_INTEREST_FREQUENT,this))}destroy(){this._propertiesPool=n(this._propertiesPool)}get updating(){return this._dirty||this.centerOnSurface.updating}get location(){let e=this._propertiesPool.get(`location`);return e.spatialReference=this.state.spatialReference,this.renderCoordsHelper.fromRenderCoords(this.renderLocation,e),e}get worldUnitsPerContentPixel(){let{camera:e,contentPixelRatio:t}=this.state;return e.computeRenderPixelSizeAt(this.renderLocation)*(e.pixelRatio/t)}get readyToRun(){return this._dirty}runTask(){let e=this._get(`renderLocation`),n=this.centerOnSurface.renderLocation,r=this.renderCoordsHelper,i=this.state.contentCamera;this._dirty=!1,r.worldUpAtPosition(n,x);let a=Math.max(0,(Math.acos(c(x,i.viewForward))-.5*Math.PI)*(i.aboveGround?1:-1));if(Number.isNaN(a)){if(!e||!s(e,n)){let e=this._propertiesPool.get(`renderLocation`);l(e,n),this._set(`renderLocation`,e)}return y}let o=1-t(a/(.5*Math.PI),0,1),d=o*o*o;this._calculateScreenHorizontalEdgeOnSurface(C);let f=this._propertiesPool.get(`renderLocation`);return u(f,n,C,d),e&&s(e,f)||this._set(`renderLocation`,f),y}_calculateScreenHorizontalEdgeOnSurface(e){let t=this.state.contentCamera,n=t.getRenderCenter(i());if(n[1]=t.aboveGround?t.padding[2]:t.fullHeight-t.padding[0],this.estimateSurfaceIntersectionAtRenderPoint(n,e))return e;let r=this.renderCoordsHelper.getAltitude(this.centerOnSurface.renderLocation);if(t.unprojectFromRenderScreen(n,S)){d(S,S,t.eye);let n=f(S,S);if(this.renderCoordsHelper.intersectInfiniteManifold(h(t.eye,n),r,e))return e}return this.renderCoordsHelper.setAltitude(e,r,t.eye)}updateRenderLocation(){this._dirty=!0}};e([a()],b.prototype,`_dirty`,void 0),e([a({constructOnly:!0})],b.prototype,`scheduler`,void 0),e([a({constructOnly:!0})],b.prototype,`centerOnSurface`,void 0),e([a({constructOnly:!0})],b.prototype,`estimateSurfaceIntersectionAtRenderPoint`,void 0),e([a()],b.prototype,`updating`,null),e([a()],b.prototype,`location`,null),e([a()],b.prototype,`renderLocation`,void 0),e([a()],b.prototype,`worldUnitsPerContentPixel`,null),b=e([o(`esri.views.3d.support.pointsOfInterest.Focus`)],b);const x=p(),S=p(),C=p();export{b as Focus};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import{length as e}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{intersects as t,fromValues as n}from"../../../geometry/support/aaBoundingRect.js";import{getInfo as r}from"../../../geometry/support/spatialReferenceUtils.js";function i(e,n,i){if(t(e,n))return!0;let a=r(i);if(a==null||e[1]>n[3]||e[3]<n[1])return!1;let o=a.valid[1]-a.valid[0];return Math.ceil((e[0]-n[2])/o)<=Math.floor((e[2]-n[0])/o)}function a(t,r){let i=e(t.center);if(!t.isValid||i<=t.radius)return n(-1/0,-1/0,1/0,1/0,r);let a=Math.asin(t.radius/i),s=Math.atan2(t.center[2],Math.hypot(t.center[0],t.center[1])),c=s*180/Math.PI;return o(Math.atan2(t.center[1],t.center[0])*180/Math.PI,c,s,a,r)}function o(e,t,r,i,a){let o=i*180/Math.PI;if(Math.abs(r)+i>=Math.PI/2)return n(-180,Math.max(-90,t-o),180,Math.min(90,t+o),a);let s=Math.asin(Math.min(1,Math.sin(i)/Math.cos(r)))*180/Math.PI;return n(e-s,t-o,e+s,t+o,a)}export{i as intersectsGeographicExtent,a as sphereToGeographicExtent};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{releaseMaybe as e}from"../../../core/maybe.js";class t{constructor(e,t,n){this._fbos=e,this._format=t,this._name=n}get valid(){return this._handle?.getTexture()!=null}dispose(){this._handle=e(this._handle)}get texture(){return this._handle?.getTexture()}ensureFramebuffer(e,t){(!this._handle||this._handle.fbo?.width!==e||this._handle.fbo?.height!==t)&&(this._handle?.release(),this._handle=this._fbos.acquire(e,t,this._name,this._format))}bind(e){e.bindFramebuffer(this._handle?.fbo)}generateMipMap(){this._handle?.getTexture()?.descriptor?.hasMipmap&&this._handle?.getTexture()?.generateMipmap()}}export{t as OverlayFramebufferObject};
2
+ import{releaseMaybe as e}from"../../../core/maybe.js";class t{constructor(e,t,n){this._fbos=e,this._format=t,this._name=n}get valid(){return this._handle?.getTexture()!=null}dispose(){this._handle=e(this._handle)}get texture(){return this._handle?.getTexture()}ensureFramebuffer(e,t){this._handle&&this._handle.fbo?.width===e&&this._handle.fbo?.height===t||(this._handle?.release(),this._handle=this._fbos.acquire(e,t,this._name,this._format))}bind(e){e.bindFramebuffer(this._handle?.fbo)}generateMipMap(){this._handle?.getTexture()?.descriptor?.hasMipmap&&this._handle?.getTexture()?.generateMipmap()}}export{t as OverlayFramebufferObject};