@arcgis/core 5.2.0-next.81 → 5.2.0-next.83

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 (269) hide show
  1. package/assets/components/assets/icon/deleteAndReplaceFeatures16.json +1 -0
  2. package/assets/components/assets/icon/deleteAndReplaceFeatures24.json +1 -0
  3. package/assets/components/assets/icon/deleteAndReplaceFeatures32.json +1 -0
  4. package/assets/components/assets/icon/moveAndRotate16.json +1 -0
  5. package/assets/components/assets/icon/moveAndRotate24.json +1 -0
  6. package/assets/components/assets/icon/moveAndRotate32.json +1 -0
  7. package/assets/esri/core/workers/RemoteClient.js +1 -1
  8. package/assets/esri/core/workers/chunks/{88d6a7ebded4d359deb0.js → 027af54888befb209aaa.js} +1 -1
  9. package/assets/esri/core/workers/chunks/028bee58f7bc19e5e39e.js +1 -0
  10. package/assets/esri/core/workers/chunks/{9bd4cda90daf90189bfc.js → 03895d49fbd34ccb3ead.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{694216224d5fd3a8956d.js → 04f5ff688785a4bd3b03.js} +1 -1
  12. package/assets/esri/core/workers/chunks/0775d1e3034d5e7ef7bc.js +1 -0
  13. package/assets/esri/core/workers/chunks/{3adba34224cba869a39c.js → 10ac92dcd3738ec23dfb.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{4a537054c99cbc492715.js → 11d911f70bf0ca252c19.js} +1 -1
  15. package/assets/esri/core/workers/chunks/1354b8442c2c501238f1.js +1 -0
  16. package/assets/esri/core/workers/chunks/{95ff342e5c29bf91a765.js → 13a43c87d7952facbed4.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{8cfe817299eb16cb2664.js → 1438f571f738e83b4d1c.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{bfd532e33800755b1f48.js → 14511c92cbbc26d80c86.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{e59101f1d060d0a30a65.js → 14def8f47ae7265dd71b.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{fbb0b2f4ec0ba458ddeb.js → 19dac19122eeeb5e36b2.js} +1 -1
  21. package/assets/esri/core/workers/chunks/1b00789511c9b27da4a7.js +1 -0
  22. package/assets/esri/core/workers/chunks/1b277311a4beb4243bf8.js +2 -0
  23. package/assets/esri/core/workers/chunks/1d03db4df18524cf391c.js +1 -0
  24. package/assets/esri/core/workers/chunks/{f71a3fe5f30aa782193a.js → 20db27d9828397d0b37a.js} +1 -1
  25. package/assets/esri/core/workers/chunks/24bfe759c8848143361e.js +1 -0
  26. package/assets/esri/core/workers/chunks/{b3081c0b037abc49d09b.js → 26c12804a0d801df29bf.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{8006ffa263fb8016afdb.js → 26c8ed0aef59ed6d5267.js} +1 -1
  28. package/assets/esri/core/workers/chunks/2d1c0d80a9843567df8d.js +1 -0
  29. package/assets/esri/core/workers/chunks/{2b79b376b0d60d2f0d5c.js → 2d6e1bf7c1981bed4357.js} +1 -1
  30. package/assets/esri/core/workers/chunks/30dade7bf6032be32599.js +2 -0
  31. package/assets/esri/core/workers/chunks/{7028671ffdaafe2725bc.js → 33aaa5a49e396a0aca47.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{dcec7fc66385c12ecdf0.js → 33dc93d82407052fafe1.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{578904043e873424904c.js → 3a6990058f1003bd2812.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{0fd7590e545864f5fff4.js → 3ca0d503ce733088a6c2.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{bfac0f47e81055585002.js → 3f0625c31dd46b563160.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{9a5894e8ebdf0e97b98f.js → 43122c435497228a7583.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{8fff4a41a54d39db470a.js → 44d13f65465646e5f6e9.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{9c17bfbfc347ac289b6e.js → 463b7952a4825541eb13.js} +1 -1
  39. package/assets/esri/core/workers/chunks/46b3d6814ba4c0a71111.js +1 -0
  40. package/assets/esri/core/workers/chunks/49784f8e8e5fac0cc5a9.js +1 -0
  41. package/assets/esri/core/workers/chunks/{1ed6a8bb415999c4e8a6.js → 4cf2c33494cb75942511.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{d8b38c196b06e801c4e6.js → 5156d94f01b4fbbf8cde.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{6c372d85b5783dd2a793.js → 52042fd36f4a572938f0.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{e8a9a686a3c23afc9d1f.js → 5568448e7f51508ffdf5.js} +1 -1
  45. package/assets/esri/core/workers/chunks/58e4aecabca047f1d229.js +1 -0
  46. package/assets/esri/core/workers/chunks/598221c7054415b84904.js +1 -0
  47. package/assets/esri/core/workers/chunks/{89df303abcbc0167e4d2.js → 5a006ff759fad9fc25cb.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{218ddad849745d652a28.js → 5a3c1fe24814a345ab39.js} +1 -1
  49. package/assets/esri/core/workers/chunks/5b292831127bf981c1c5.js +1 -0
  50. package/assets/esri/core/workers/chunks/{40ebe69b08ea54e0e780.js → 5b60fc95757b2a53558a.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{c336f300fe6100e36592.js → 5c634b3e6dc76299b1df.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{5a67bd724aa7fcdebe16.js → 5d30accf1dcda0c70f95.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{dbca32f0e0c2c2e2ccf3.js → 5f13ade03500b39c1720.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{8d16d53643dd8d489c25.js → 605da92d28e067f4a4c6.js} +1 -1
  55. package/assets/esri/core/workers/chunks/6154f4d39f9e53fe56cc.js +1 -0
  56. package/assets/esri/core/workers/chunks/62b116307483d5f0e37d.js +2 -0
  57. package/assets/esri/core/workers/chunks/6433a623af765b7e53ab.js +1 -0
  58. package/assets/esri/core/workers/chunks/{5c9a398e659ecd427fb5.js → 657528eb6a3d3b3cb631.js} +1 -1
  59. package/assets/esri/core/workers/chunks/65eff0ae773505495f21.js +1 -0
  60. package/assets/esri/core/workers/chunks/{d845f2115848b56c0369.js → 66292e98b4111ea3658d.js} +1 -1
  61. package/assets/esri/core/workers/chunks/{f57e5e7d0748d9a370f7.js → 680496660b2aaa710099.js} +1 -1
  62. package/assets/esri/core/workers/chunks/6d11b922898a8039dbe7.js +1 -0
  63. package/assets/esri/core/workers/chunks/{fbcc346fa603d6edac98.js → 6db4a4f9a9ce7cc738d0.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{a9e944f28bd573c8230d.js → 6eb28086dc28f6d144ec.js} +1 -1
  65. package/assets/esri/core/workers/chunks/7188559a685e0ba30c4f.js +1 -0
  66. package/assets/esri/core/workers/chunks/{a3cbd3e983e21f40b253.js → 724b2631c9ced80a1661.js} +1 -1
  67. package/assets/esri/core/workers/chunks/7493ce5d02224c07a6d5.js +1 -0
  68. package/assets/esri/core/workers/chunks/7ad70c8a56f2481adc82.js +1 -0
  69. package/assets/esri/core/workers/chunks/7bd8ebb321ecf1f06496.js +1 -0
  70. package/assets/esri/core/workers/chunks/7ca188f824956a5cac35.js +2 -0
  71. package/assets/esri/core/workers/chunks/{d0aaa4ad7f76f577f117.js → 7d5877eede2f552dea9f.js} +1 -1
  72. package/assets/esri/core/workers/chunks/{bf5831a7c12b1e42c669.js → 83a77d3f45c8c21cec45.js} +1 -1
  73. package/assets/esri/core/workers/chunks/852649460d664b0a1a1d.js +1 -0
  74. package/assets/esri/core/workers/chunks/{d62a5a33a24418a3e283.js → 88771a75adcbd54c4fac.js} +1 -1
  75. package/assets/esri/core/workers/chunks/{37fb38db03cb39e3c342.js → 8c6a60d96c73982febd2.js} +1 -1
  76. package/assets/esri/core/workers/chunks/{e63f94c8097555b266ad.js → 8e1b913067b8e88ff365.js} +2 -2
  77. package/assets/esri/core/workers/chunks/{6065caa7981cef255277.js → 911f3a1b8dd4bc5c9782.js} +1 -1
  78. package/assets/esri/core/workers/chunks/{70c371c9f133ab9f7925.js → 918577ea025f67ebe372.js} +1 -1
  79. package/assets/esri/core/workers/chunks/{e3eab61815ef1c521a6c.js → 9568932bafe689c38f63.js} +1 -1
  80. package/assets/esri/core/workers/chunks/{e72fa08b0bd324514a0e.js → 996ac351e2322298a17d.js} +1 -1
  81. package/assets/esri/core/workers/chunks/99966339b061eb9945b8.js +1 -0
  82. package/assets/esri/core/workers/chunks/{d1baf17f3219f70106f7.js → 9be05d32528b395a7d34.js} +1 -1
  83. package/assets/esri/core/workers/chunks/{552d6aecc7d88d16227b.js → 9d41c02601d0bb75b525.js} +1 -1
  84. package/assets/esri/core/workers/chunks/{64a1ffc221e5b63b43fb.js → a4bb0951e1389e7b803c.js} +1 -1
  85. package/assets/esri/core/workers/chunks/{74cd17aca5f7e0caac90.js → a9a1061cdf82b372835f.js} +1 -1
  86. package/assets/esri/core/workers/chunks/{d2448e26e19005ef9ab2.js → aabffe53508730e504ec.js} +1 -1
  87. package/assets/esri/core/workers/chunks/{82da6d98bd4980a3d454.js → af88f8dd1a53e4740aa6.js} +1 -1
  88. package/assets/esri/core/workers/chunks/b61c30cdf698b4d1573a.js +1 -0
  89. package/assets/esri/core/workers/chunks/{61190c833791f0833a39.js → b7bcc2d0b0fa8e703c83.js} +1 -1
  90. package/assets/esri/core/workers/chunks/{37a121316d114999ac70.js → ba67aaa08e4f11e1140a.js} +1 -1
  91. package/assets/esri/core/workers/chunks/bbb97c38d8670329d07e.js +2 -0
  92. package/assets/esri/core/workers/chunks/{5d50a030bf9f4e94f69d.js → bbeb61d9302323bae9fb.js} +1 -1
  93. package/assets/esri/core/workers/chunks/bd8b483e70acf0fc601e.js +1 -0
  94. package/assets/esri/core/workers/chunks/bef32acf368b4d5aba37.js +1 -0
  95. package/assets/esri/core/workers/chunks/c1f125594e684c1b4ffc.js +1 -0
  96. package/assets/esri/core/workers/chunks/c90dfdf2302b7db1f6f7.js +1 -0
  97. package/assets/esri/core/workers/chunks/{09f0805b32e6cab980e6.js → cc1a00694cc9f7c606d6.js} +1 -1
  98. package/assets/esri/core/workers/chunks/{8a36b999cbd65dd2f16c.js → d8c3bdc3c6be8ba7c5e6.js} +1 -1
  99. package/assets/esri/core/workers/chunks/{bc30c0de6dcb106b24a1.js → da233362b06b6db375f1.js} +1 -1
  100. package/assets/esri/core/workers/chunks/{ce81f29134ab3971bd54.js → dd91824692bec809909c.js} +1 -1
  101. package/assets/esri/core/workers/chunks/{f9e9e79f78be32e5d475.js → e706c37b44e98fbcb5f7.js} +1 -1
  102. package/assets/esri/core/workers/chunks/ef269dd559c1c79957e5.js +1 -0
  103. package/assets/esri/core/workers/chunks/{4a6158994a8cc8b8664f.js → f0692e10af5983f6ad93.js} +1 -1
  104. package/assets/esri/core/workers/chunks/{40b842d055b87e442156.js → f20b88f5a6d3b988a055.js} +1 -1
  105. package/assets/esri/core/workers/chunks/{fae32c9ce811934b6a64.js → f6ae0c483579e227a2f2.js} +1 -1
  106. package/assets/esri/core/workers/chunks/{4c15551e33a3c6cda61d.js → f762f0f6c83748d8e328.js} +1 -1
  107. package/assets/esri/core/workers/chunks/{4eaa93859ceec1b38530.js → fa29b5064d6626cfc019.js} +1 -1
  108. package/assets/esri/core/workers/chunks/fcf7299e2ee904ab9882.js +1 -0
  109. package/assets/esri/core/workers/chunks/{388b71211a0ad5cbd6b9.js → fe06cc2f90b2d551e4c1.js} +1 -1
  110. package/assets/esri/core/workers/chunks/{86035e46777ed896c658.js → ffad5fd9c5e98f4fe2c3.js} +1 -1
  111. package/assets/esri/geometry/support/pe-wasm.wasm +0 -0
  112. package/chunks/Bufferer-CclWhXVb.js +1 -1
  113. package/chunks/Distance2DCalculator-DjIp2uQi.js +1 -1
  114. package/chunks/EmissionComposite.glsl.js +7 -1
  115. package/chunks/GeodeticDistanceCalculator-zRp89-dW.js +1 -1
  116. package/chunks/GeodeticUtils.js +1 -1
  117. package/chunks/GeographicTransformation.js +2 -0
  118. package/chunks/Geometry.js +1 -1
  119. package/chunks/MultiPathImpl.js +1 -1
  120. package/chunks/OperatorCrosses.js +1 -1
  121. package/chunks/OperatorCut.js +1 -1
  122. package/chunks/OperatorGeodesicBuffer.js +1 -1
  123. package/chunks/OperatorGeodeticArea.js +1 -1
  124. package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
  125. package/chunks/OperatorGeodeticLength.js +1 -1
  126. package/chunks/OperatorGraphicBuffer.js +1 -1
  127. package/chunks/OperatorIntegrate.js +1 -1
  128. package/chunks/OperatorIntersects.js +1 -1
  129. package/chunks/OperatorMultiPartToSinglePart.js +1 -1
  130. package/chunks/OperatorOverlaps.js +1 -1
  131. package/chunks/OperatorProximity.js +1 -1
  132. package/chunks/OperatorProximityGeodesic.js +1 -1
  133. package/chunks/OperatorShapePreservingLength.js +1 -1
  134. package/chunks/OperatorShapePreservingProject.js +1 -1
  135. package/chunks/OperatorSimplifyOGC.js +1 -1
  136. package/chunks/OperatorTouches.js +1 -1
  137. package/chunks/OperatorWithin.js +1 -1
  138. package/chunks/Point2D.js +1 -1
  139. package/chunks/ProjectionTransformation.js +1 -1
  140. package/chunks/SideCalculator2D-DX0718xq.js +1 -1
  141. package/chunks/UnitFactory.js +1 -1
  142. package/chunks/containsOperator.js +1 -1
  143. package/chunks/disjointOperator.js +1 -1
  144. package/chunks/equalsOperator.js +1 -1
  145. package/chunks/pe-wasm.js +1 -1
  146. package/chunks/relateOperator.js +1 -1
  147. package/config.js +1 -1
  148. package/geometry/operators/gx/operatorAutoComplete.js +1 -1
  149. package/geometry/operators/gx/operatorBuffer.js +1 -1
  150. package/geometry/operators/gx/operatorDifference.js +1 -1
  151. package/geometry/operators/gx/operatorIntersection.js +1 -1
  152. package/geometry/operators/gx/operatorLabelPoint.js +1 -1
  153. package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
  154. package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
  155. package/geometry/operators/gx/operatorSimplify.js +1 -1
  156. package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
  157. package/geometry/operators/gx/operatorUnion.js +1 -1
  158. package/geometry/operators/json/containsOperator.js +1 -1
  159. package/geometry/operators/json/disjointOperator.js +1 -1
  160. package/geometry/operators/reshapeOperator.js +1 -1
  161. package/geometry/operators/support/GeographicTransformation.d.ts +7 -0
  162. package/geometry/operators/support/GeographicTransformation.js +1 -1
  163. package/geometry/operators/support/GeographicTransformationStep.d.ts +7 -1
  164. package/geometry/operators/support/GeographicTransformationStep.js +1 -1
  165. package/geometry/operators/support/geographicTransformationUtils.d.ts +13 -2
  166. package/geometry/operators/support/geographicTransformationUtils.js +1 -1
  167. package/geometry/operators/support/jsonConverter.js +1 -1
  168. package/geometry/operators/support/projectionTransformation.js +1 -1
  169. package/geometry/support/spatialReferenceUtils.js +1 -1
  170. package/kernel.js +1 -1
  171. package/layers/raster/types.d.ts +1 -1
  172. package/layers/support/AggregateField.d.ts +9 -3
  173. package/layers/support/FeatureReductionCluster.d.ts +16 -6
  174. package/layers/support/I3SExtractChanges.js +2 -0
  175. package/package.json +4 -4
  176. package/renderers/UniqueValueRenderer.js +1 -1
  177. package/renderers/support/AuthoringInfo.d.ts +8 -3
  178. package/support/revision.js +1 -1
  179. package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +1 -1
  180. package/views/2d/engine/vectorTiles/style/GeoJSONLabelUtils.js +2 -0
  181. package/views/2d/engine/vectorTiles/style/StyleLayer.js +1 -1
  182. package/views/2d/engine/vectorTiles/style/StyleRepository.js +1 -1
  183. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AAnimatedShader.js +1 -1
  184. package/views/2d/layers/MediaLayerView2D.js +1 -1
  185. package/views/3d/GroundView3D.js +1 -1
  186. package/views/3d/analysis/LineOfSight/LineOfSightAuthoringUtils.js +1 -1
  187. package/views/3d/analysis/LineOfSight/LineOfSightDrawToolRenderer.js +1 -1
  188. package/views/3d/analysis/LineOfSight/LineOfSightEditTool.js +1 -1
  189. package/views/3d/analysis/LineOfSight/LineOfSightInteractionVisuals.js +1 -1
  190. package/views/3d/analysis/LineOfSight/LineOfSightItemTool.js +1 -1
  191. package/views/3d/analysis/LineOfSight/LineOfSightObserverPlugin.js +1 -1
  192. package/views/3d/analysis/LineOfSight/LineOfSightPlacementLeafPlugin.js +1 -1
  193. package/views/3d/analysis/LineOfSight/LineOfSightRootPlugin.js +1 -1
  194. package/views/3d/analysis/LineOfSight/LineOfSightTargetPlugin.js +1 -1
  195. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  196. package/views/3d/analysis/LineOfSight/lineOfSightPlacementUtils.js +1 -1
  197. package/views/3d/input/SceneInputManager.js +1 -1
  198. package/views/3d/input/handlers/PinchAndPanNavigation.js +1 -1
  199. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  200. package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
  201. package/views/3d/layers/I3SMeshView3D.js +1 -1
  202. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  203. package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
  204. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  205. package/views/3d/layers/SceneLayerView3D.js +1 -1
  206. package/views/3d/layers/i3s/I3SOverrides.js +1 -1
  207. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  208. package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
  209. package/views/3d/state/controllers/ZoomControllerGlobal.js +1 -1
  210. package/views/3d/state/utils/navigationUtils.js +1 -1
  211. package/views/3d/support/GroundAndIMSurface.js +2 -0
  212. package/views/3d/support/PBFDecoder.js +1 -1
  213. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  214. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  215. package/views/3d/support/pointsOfInterest/PointOfInterest.js +1 -1
  216. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  217. package/views/3d/terrain/OverlayManager.js +1 -1
  218. package/views/3d/webgl-engine/Stage.js +1 -1
  219. package/views/3d/webgl-engine/lib/EmissionComposite.glsl.js +1 -1
  220. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  221. package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
  222. package/views/MapView.d.ts +0 -60
  223. package/views/SceneView.js +1 -1
  224. package/views/View2D.d.ts +59 -1
  225. package/views/draw/support/PluginContext.js +1 -1
  226. package/views/draw/support/managers/InteractiveHandleManager.js +1 -1
  227. package/views/draw/support/types.d.ts +6 -0
  228. package/views/interactive/interactiveToolUtils.js +1 -1
  229. package/widgets/Legend/support/sizeRampUtils.js +1 -1
  230. package/widgets/Legend/support/utils.js +1 -1
  231. package/widgets/Widget.js +1 -1
  232. package/widgets/support/jsxWidgetSupport.js +1 -1
  233. package/assets/esri/core/workers/chunks/0dcfd82a2669df6eb5a0.js +0 -1
  234. package/assets/esri/core/workers/chunks/177c3b23c1cbd4737049.js +0 -1
  235. package/assets/esri/core/workers/chunks/21f763694a41968ac21a.js +0 -1
  236. package/assets/esri/core/workers/chunks/230925079cee040a8d77.js +0 -1
  237. package/assets/esri/core/workers/chunks/25696c194457e42b3bdc.js +0 -1
  238. package/assets/esri/core/workers/chunks/2f3525df00fb265661fc.js +0 -1
  239. package/assets/esri/core/workers/chunks/453c69879f4b82ba13a1.js +0 -1
  240. package/assets/esri/core/workers/chunks/4f36596280142be1c666.js +0 -1
  241. package/assets/esri/core/workers/chunks/53d80202b5f43542d45b.js +0 -1
  242. package/assets/esri/core/workers/chunks/540a3685e614bb006744.js +0 -1
  243. package/assets/esri/core/workers/chunks/61312d3b5477ed9d87d9.js +0 -2
  244. package/assets/esri/core/workers/chunks/6f08c8a1e8e3ffd0a96a.js +0 -1
  245. package/assets/esri/core/workers/chunks/71ee7c51d2c60a180f1e.js +0 -1
  246. package/assets/esri/core/workers/chunks/856dba96332509fb1d7a.js +0 -2
  247. package/assets/esri/core/workers/chunks/9234a293d61e134f121f.js +0 -1
  248. package/assets/esri/core/workers/chunks/927582ec15bff2acbb49.js +0 -1
  249. package/assets/esri/core/workers/chunks/95b9eaf7a49eeb17e62f.js +0 -1
  250. package/assets/esri/core/workers/chunks/973440553c9e058b0132.js +0 -1
  251. package/assets/esri/core/workers/chunks/98739b6e7904045edbab.js +0 -1
  252. package/assets/esri/core/workers/chunks/a69c10bfd632a5546b34.js +0 -1
  253. package/assets/esri/core/workers/chunks/c5853fbb975e169c44c5.js +0 -1
  254. package/assets/esri/core/workers/chunks/c899457f19b749516275.js +0 -1
  255. package/assets/esri/core/workers/chunks/d4b78d11a5ce4320a29a.js +0 -1
  256. package/assets/esri/core/workers/chunks/da0ef984509057ec8507.js +0 -1
  257. package/assets/esri/core/workers/chunks/e2473de49189d93714d3.js +0 -1
  258. package/assets/esri/core/workers/chunks/eca0736953a20cfc64ad.js +0 -2
  259. package/assets/esri/core/workers/chunks/efd176c5ac35f313e7a2.js +0 -1
  260. package/assets/esri/core/workers/chunks/f2d99f693a590f384315.js +0 -1
  261. package/assets/esri/core/workers/chunks/fc2234e0d202631f3abf.js +0 -2
  262. package/assets/esri/core/workers/chunks/fcb943c3b31b1bf62e65.js +0 -2
  263. package/assets/esri/core/workers/chunks/ffe2cbfea38b92a231d6.js +0 -1
  264. /package/assets/esri/core/workers/chunks/{eca0736953a20cfc64ad.js.LICENSE.txt → 1b277311a4beb4243bf8.js.LICENSE.txt} +0 -0
  265. /package/assets/esri/core/workers/chunks/{856dba96332509fb1d7a.js.LICENSE.txt → 30dade7bf6032be32599.js.LICENSE.txt} +0 -0
  266. /package/assets/esri/core/workers/chunks/{fc2234e0d202631f3abf.js.LICENSE.txt → 62b116307483d5f0e37d.js.LICENSE.txt} +0 -0
  267. /package/assets/esri/core/workers/chunks/{61312d3b5477ed9d87d9.js.LICENSE.txt → 7ca188f824956a5cac35.js.LICENSE.txt} +0 -0
  268. /package/assets/esri/core/workers/chunks/{e63f94c8097555b266ad.js.LICENSE.txt → 8e1b913067b8e88ff365.js.LICENSE.txt} +0 -0
  269. /package/assets/esri/core/workers/chunks/{fcb943c3b31b1bf62e65.js.LICENSE.txt → bbb97c38d8670329d07e.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{abortMaybe as i,destroyMaybe as r,removeMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as a,createAbortError as o}from"../../../core/promiseUtils.js";import{initial as n,watch as l,when as c}from"../../../core/reactiveUtils.js";import{schedule as d}from"../../../core/scheduling.js";import{isUint8Array as h,isFloat32Array as u,isUint32Array as m,isUint16Array as p}from"../../../core/typedArrayUtil.js";import{unitFromRESTJSON as f,convertUnit as g}from"../../../core/units.js";import{property as y,subclass as b}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as _,invert as v}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as w,IDENTITY as C}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as T}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as x}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{normalize as j,sub as E,dot as M,set as R}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as O,freeze as S,clone as V,ZEROS as U,fromValues as P}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as H,clone as I,ONES as D}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMoon as L,isMars as k,getReferenceEllipsoid as A,SphericalECEFSpatialReferenceLike as F}from"../../../geometry/ellipsoidUtils.js";import G from"../../../geometry/HeightModelInfo.js";import{computeTranslationToOriginAndRotation as z}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as B}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as N}from"../../../geometry/projection/projectVectorToVector.js";import{create as q}from"../../../geometry/support/aaBoundingRect.js";import{isCompatible as W}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as X,isWebMercator as $,equals as Z,isGeographic as Y,isCGCS2000 as J}from"../../../geometry/support/spatialReferenceUtils.js";import K from"../../../geometry/support/WKIDUnitConversion.js";import{BufferViewVec4u8 as Q,BufferViewVec3u8 as ee,BufferViewVec2f as te,BufferViewVec3f as ie,BufferViewUint32 as re,BufferViewUint16 as se}from"../../../geometry/support/buffer/BufferView.js";import{nullId as ae}from"../../../layers/ILyr3DWasmPerSceneView.js";import oe from"../../../layers/support/SceneModification.js";import{getHeightModelInfoFromVCS as ne,validateEntity3D as le,makeCacheKey as ce}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as de}from"../../../support/elevationInfoUtils.js";import{IntegratedMesh3DTilesLayerWorkerHandle as he}from"./IntegratedMesh3DTilesLayerWorkerHandle.js";import{LayerView3D as ue}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as me}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as pe,removeLayerViewFromWasm as fe,getLyr3DWasm as ge}from"./Lyr3DWasm.js";import{toWasmModification as ye}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as be}from"./i3s/LayerElevationProvider.js";import{IntegratedMesh3DTilesLayerView3DSymbol as _e}from"./support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{primTypeConversion as ve,alphaModeConversion as we,faceCullingConversion as Ce,wrapModeConversion as Te}from"./support/lyr3dTypeConversions.js";import{makeScheduleFunction as xe}from"./support/makeScheduleFunction.js";import{Tiles3DMeshIntersectionHandler as je}from"./support/Tiles3DMeshIntersectionHandler.js";import{Frustum as Ee}from"../state/Frustum.js";import{ElevationRange as Me}from"../support/ElevationRange.js";import{toBoundingRect as Re}from"../support/extentUtils.js";import{Obb as Oe}from"../support/orientedBoundingBox.js";import{glLayout as Se}from"../support/buffer/glUtil.js";import{getGroundTransparencyModeFromOpacity as Ve}from"../terrain/TransparencyMode.js";import{ComponentGeometryParameters as Ue,SourceGeometry as Pe}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as He}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as Ie}from"../webgl-engine/core/material/RenderTexture.js";import{ManagedTexture as De}from"../webgl-engine/lib/ManagedTexture.js";import{compressNormals as Le}from"../webgl-engine/lib/Normals.js";import{advancedMRRFactors as ke}from"../webgl-engine/materials/pbrUtils.js";import Ae from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as Fe,isInEffectiveScaleRange as Ge,validateScaleRange as ze}from"../../support/layerViewUtils.js";import{TaskPriority as Be}from"../../support/Scheduler.js";import{TextureCompressionTracker as Ne}from"../../support/TextureCompressionTracker.js";import{CompressedTextureFormat as qe,SizedPixelFormat as We}from"../../webgl/enums.js";import{alphaCutoff as Xe}from"../../../webscene/support/AlphaCutoff.js";var $e;function Ze(e,t,i){if("image/vnd-ms.dds"===t)switch(i){case"Dxt1":return qe.COMPRESSED_RGB_S3TC_DXT1_EXT;case"Dxt5":return qe.COMPRESSED_RGBA_S3TC_DXT5_EXT;default:return null}if("image/ktx"===t)return"Etc1"===i?qe.COMPRESSED_RGB8_ETC2:null;switch(e){case 33319:return We.RG8;case 6407:return We.RGB8;case 6408:return We.RGBA8;case 6403:return We.R8;default:return null}}let Ye=class extends(ue(Ae)){static{$e=_e}constructor(e){super(e),this[$e]=!0,this.type="integrated-mesh-3dtiles",this.freeze=!1,this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._initializationController=null,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._replacesTerrain=!1,this._isUsedAsGroundLayer=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._imShading=!!has("enable-feature:im-shading"),this._imVertexNormals=!!has("enable-feature:im-vertex-normals"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._loadedObjects=new Set,this._compressionTracker=new Ne,this._dbgFlags=new Set;const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e)),this._replacesTerrain=e.layer.replacesTerrain,this._isUsedAsGroundLayer=e.layer.isUsedAsGroundLayer,this._frameTask=t.scheduler.registerTask(Be.TILES3D,this),this._frustum=new Ee(e.view.renderCoordsHelper)}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{a(t);const i=this.layer.queryElevationCallback;this.layer=e,this.layer.queryElevationCallback=i}):null}canRecycleWith(e){return e.url===this.layer.url&&"integrated-mesh-3dtiles"===e.type&&e.replacesTerrain===this._replacesTerrain&&e.isUsedAsGroundLayer===this._isUsedAsGroundLayer}initialize(){this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._workerHandle=new he(xe(e.resourceController)),this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),n),!this._canProjectWithoutEngine())throw Fe("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);this._initializationController=new AbortController;const t=pe(this,this._initializationController.signal).then(t=>{a(this._initializationController.signal),this._wasmLayerId=t,this._intersectionHandler=new je(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged()),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>this.view.overlayManager.renderer.isEmpty,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),n),this._updatingHandles.add(()=>e.state.contentCamera,()=>this._cameraChanged(),n),this._elevationProvider=new be({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler});const i=this._replacesTerrain?0:1;e.elevationProvider.register(i,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([l(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),c(()=>this.fullOpacity,()=>this._opacityChange()),l(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),n),l(()=>this.freeze,e=>{e?this._wasm?.incrementFrozenLayerViewCount(this):(this._wasm?.decrementFrozenLayerViewCount(this),this._cameraChanged())})]),this._initializationController=null,this.addHandles(c(()=>this._replacesTerrain&&this._wasm?.isTerrainReady,()=>{this.layer.queryElevationCallback=(e,t)=>this._queryElevation(e,t)}))});this.addResolvingPromise(t)}destroy(){if(this.freeze=!1,this._initializationController=i(this._initializationController),this._dbg(2,"Tiles3DLayerView3D destroy() called"),this._workerHandle?.destroyContextAndSelf(this.uid),fe(this),this.layer.queryElevationCallback=null,this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler.destroy(),this._intersectionHandler=null),this._elevationProvider){const e=Array.from(this._lyrHandleToObjects.values()),t=e.reduce((e,{componentObjects:t})=>e+t.length,0);this._elevationProvider.notifyObjectsChangedFunctional(t,t=>{for(const{componentObjects:i}of e)for(const{obb:e}of i)if(!t(e))return}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null}this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._loadedObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._frameTask.remove(),this._updatingHandles=r(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=s(this._visibleGeometryChangedSchedulerHandle)}get fullOpacity(){return this.layer.replacesTerrain?this.view.map.ground.opacity:1}get opaque(){return 0===this._groundTransparencyMode}get invisible(){return 3===this._groundTransparencyMode}get _groundTransparencyMode(){return this.layer.replacesTerrain?Ve(this.fullOpacity,this.view.overlayManager.renderer.isEmpty):0}get _renderOpacity(){switch(this._groundTransparencyMode){case 3:return 0;case 2:return Xe;default:return this.fullOpacity}}get hasModifications(){return this._modifications&&this._modifications.length>0}_opacityChange(){const e=this._renderOpacity,t=this._groundTransparencyMode;this.forEachComponentObject(i=>this._collection.updateObjectOpacity(i,e,t))}_cameraChanged(){if(this.freeze)return;const e=this._frustum;e.update(this.view.state.contentCamera);const t=this._visibleObjects;let i=!1;this._loadedObjects.forEach(r=>{const s=r.obb?.intersectsFrustum(e)??!1;s!==r.isVisible&&(r.isVisible=s,s?t.add(r):t.delete(r),r.componentObjects.forEach(e=>this._collection.setObjectVisibility(e,s)),i||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(s,r.elevationRange))}),i&&this._setVisibleElevationRangeDirty()}intersect(e,t,i,r){this._intersectionHandler.intersectRay(e,t,i,r,null,!1)}get ready(){return!this.layer.replacesTerrain||!!this._wasm?.isTerrainReady}_modificationsChanged(){const e=this.useEsriCrs?this.layer.supportedSpatialReferences[1]:this.layer.supportedSpatialReferences[0],t=ye(this._layerClippingArea,this._modifications,e,this.view.state.isGlobal);this._wasm?.setMeshModifications(this,t)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=q();this._layerClippingArea=Re(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=d(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this.layer.replacesTerrain),this.forEachComponentObject(t=>t.updateMaterial({slicePlaneEnabled:e}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,de(e))}get _wasm(){return ge(this.view)}_queryElevation(e,t){return this.destroying||this.destroyed?Promise.reject(o()):this._wasm?.queryElevation(this,e,t)??Promise.reject(o())}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get useEsriCrs(){return this._useEsriCrs}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||Ge(this.layer.effectiveScaleRange,this.view.scale)}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.layer.isUsedAsGroundLayer||ze(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,r=0,s=0,a=0;return this._lyrHandleToObjects.forEach(o=>{o.isLoaded?(e+=o.textureMemoryUsage,t+=o.vboMemoryUsage,s++):(i+=o.textureMemoryUsage,r+=o.vboMemoryUsage,a++)}),new me(this.usedMemory,s,a,Qe(t),Qe(e),Qe(r),Qe(i))}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(X(this.view.renderSpatialReference)||$(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&Z(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(115700===this.layer.esriCrsSpatialReference.vcsWkid)return!1;let e=ne(this.layer.esriCrsSpatialReference);if(!e){const t=this.layer.esriCrsSpatialReference;let i="meters";!Y(t)&&t.wkid&&-1!==t.wkid&&(i=f(K.units[K[t.wkid]])),i&&(e=new G({heightModel:"gravity-related-height",heightUnit:i}))}const t=this.view.heightModelInfo;return this._useEsriCrs=0===W(e,t,!1),this._useEsriCrs&&(e&&(this._metersPerVCSUnit=g(1,e.heightUnit,"meters")),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return de(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new Me(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new Me;0===this._visibleObjects.size?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this._forEachRelevantVisibleTile(t=>e.expandElevationRange(t.elevationRange)),e.minElevation===1/0&&e.setElevationRangeValues(0,0));const t=this._get("visibleElevationRange");return t&&t.minElevation===e.minElevation&&t.maxElevation===e.maxElevation?t:e}_setVisibleElevationRangeDirty(){this.notifyChange("visibleElevationRange")}_forEachRelevantVisibleTile(e){const{view:t}=this,{spatialReference:i}=t,r=i.isWGS84||i.isWebMercator||J(i)||L(i)||k(i);if(this.view.state.isGlobal||!r)return this.forEachVisibleTile(e);const s=A(i).radius,{eye:a,viewForward:o,near:n}=t.state.contentCamera,l=j(O(),o),c=500,d=Math.max(a[2],c),h=d+s,u=Math.sqrt(h**2-s**2),m=Math.abs(Math.atan2(u,s))*s,p=d>.5*s?.5*Math.PI*s:m,f=O();this.forEachVisibleTile(t=>{const{mbsRadius:i,mbsCenter:r}=t;if(i<0)return;E(f,r,a);const s=M(f,l);Math.abs(s)<p&&s+i>n&&s-i<p&&e(t)})}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachTile(e){for(const t of this._loadedObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const{componentObjects:i}of e)for(const e of i)t(e)}get drapeTargetType(){return this._replacesTerrain?0:1}isUpdating(){const e=this._wasm;return!this.freeze&&this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}get readyToRun(){return!!this._frameTask?.readyToRun}runTask(e){this._frameTask.processQueue(e)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");const{entity3d:t}=e;if(!le(t))throw new Error("entity3D not valid");const i=new Map;let r;try{r=this._createPrimitiveTextureBundles(t,i)}catch(a){throw i.forEach(e=>this._stage?.removeTexture(e)),a}let s=null;try{if(s=await this._createRenderableMain(t,r),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance");const{tileObb:a,componentObjects:o,elevationRange:n}=s;let l=0,c=0,d=0;for(const e of o){const{texture:t,textureMetallicRoughness:i,textureEmissive:r,textureOcclusion:s,textureNormal:a}=e.renderable.drawParameters;l+=(t?.usedMemory??0)+(i?.usedMemory??0)+(r?.usedMemory??0)+(s?.usedMemory??0)+(a?.usedMemory??0),c+=this._collection.getObjectGPUMemoryUsage(e),d+=e.intersectionGeometry.usedMemory}const h=Array.from(i.values()),u=new Ke(e.handle,o,h,d,c,l,a,e.stableNodeId,e.nodeDepth,n);return this._lyrHandleToObjects.set(e.handle,u),()=>{this._memCache.put(ce(u.handle),u);const{usedMemory:e}=u;return this._cacheMemory+=e,{memUsageBytes:e}}}catch(a){throw r.forEach(e=>e.cleanup()),s?.componentObjects.forEach(e=>this._collection.destroyObject(e)),i.forEach(e=>this._stage?.removeTexture(e)),a}}_createPrimitiveTextureBundles(e,t){const i=new Array;try{const r=e.desc.geometry;for(const s of e.validPrimitiveIndices){const a=r.prims[s].materialId,o=e.desc.materials?.materials&&null!=a&&a!==ae?e.desc.materials.materials[a]:null;let n=Promise.resolve(tt),l=null,c=null,d=null,h=null,u=null;if(o){const i="Pbr"===o.lightingModel;l=this._getTexture(o.baseColorTex,e,t),c=i?this._getTexture(o.metalTex,e,t):null,d=i?this._getTexture(o.emissiveTex,e,t):null,h=i?this._getTexture(o.occlusionTex,e,t):null,u=i?this._getTexture(o.normalTex,e,t):null;const r=[l,c,d,h,u].map(e=>e?.loadPromise??null);n=Promise.all(r)}i.push(new it(n,l,c,d,h,u))}}catch(r){throw i.forEach(e=>e.cleanup()),r}return i}async _createRenderableMain(e,t){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain called after destroy");const i=new Array,r=e.desc,s=S(...e.origin),a=this.view.groundView.spatialReference,o=this.view.state.isGlobal;let n=C;if(o){const e=T();z(F,s,e,a),n=_(w(),e)}const l=et(r.obb),c=o?A(this.view.spatialReference).radius:0,d=new Array;try{let h=-1;for(const i of e.validPrimitiveIndices){h+=1;const s=r.geometry.prims[i],a=t[h];this._dbgFlags.has(2)&&this._dbg(2,JSON.stringify(s));if(null==ve[s.ptype]){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+s.ptype+"). Skipping primitive."),a.cleanup();continue}const{positionView:o,normalsData:n,colorView:l,texCoord0Data:c,indicesView:u}=this._getBufferViews(s,e);if(null==o||null==u){a.cleanup();continue}const m=o.count,p=(e,t)=>null==e||e===m||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);p(null!=c?c.length/2:void 0,"numTexcoord")&&p(l?.count,"numColors")&&p(n?.length,"normals")?d.push({componentIndex:h,positionView:o,indicesView:u,texCoord0Data:c,colorView:l,normalsData:n}):a.cleanup()}const u=n!==C,m=u?v(w(),n)??C:C,{vertexProcessingOutputs:p,obbHalfSizeAccumulator:f,elevationRange:g}=await this._workerHandle.processTiles3DVertices(d,s,c,o,n,l,this._imVertexNormals&&!this._isUsedAsGroundLayer);if(this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");const y=r.materials;if(await Promise.all(t.map(e=>e.materialPromise)),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");p.length>0&&l.setHalfSize(f);for(const o of p){const{componentIndex:n,positionView:c,indicesView:d,layout:h,textureCoordinateType:p,interleavedVertexData:f,indices:g}=o,b=e.validPrimitiveIndices[n],_=r.geometry.prims[b],v=t[n],w=l.clone(),C=Se(h),T=new Uint32Array([0,d.typedBuffer.length]),x=new Ue(C,this._imShading?2:0,p,u?2:0),j=new Pe({interleavedVertexData:f,vertexCount:f.byteLength/C[0].stride,indexData:g},{positions:c.typedBuffer,indices:d.typedBuffer},T,x),E=this.view.renderSpatialReference,M=O(),R=[1,1,1];B(s,E,R,a)||this._dbg(3,"Unsupported coordinate system for IM overlay"),N(s,E,M,a);const S=this._createComponentMaterialInitParameters(y,_.materialId,v);S.baseColorTexture||this._dbg(3,"No colour texture 1");const V=this._collection.createObject({toMapSpace:H(M[0],M[1],R[0],R[1]),transform:new He(s,m),obb:w,geometry:j,elevationAlignable:!1},S);i.push(V)}const{fullExtent:b}=this.layer;return b?.hasZ&&b.zmax&&b.zmin&&(g.minElevation=Math.max(g.minElevation,b.zmin),g.maxElevation=Math.min(g.maxElevation,b.zmax)),{tileObb:l,componentObjects:i,elevationRange:g}}catch(h){throw i.forEach(e=>this._collection.destroyObject(e)),h}}_createComponentMaterialInitParameters(e,t,i){const r=null!=e?.materials&&null!=t&&t!==ae?e.materials[t]:null;let s=1;const a=r?.baseColorTex?.imageId;if(null!=a&&e&&Array.isArray(e.images)&&a>=0&&a<e.images.length){const t=e.images[a];t.alpha&&(s=we[t.alpha])}const o="Pbr"===(null!=r?r.lightingModel:"Unlit");let n=D,l=Xe,c=!1,d=2,h=P(0,0,0);const u=V(ke),m=i.baseColorTexture,p=i.metallicRoughnessTexture,f=i.emissionTexture,g=i.occlusionTexture,y=i.normalTexture;return r&&(n=I(r.baseColorFactor),l=r.alphaCutoff??Xe,o&&(R(u,r.metallicFactor,r.roughnessFactor,0),r.emissiveFactor&&(h=r.emissiveFactor)),c=r.isDoubleSided,d=Ce[r.faceCulling??"NotSet"]),{isIntegratedMesh:!0,baseColor:n,textureAlphaCutoff:l,mrrFactors:u,baseColorTexture:m,metallicRoughnessTexture:p,normalTexture:y,occlusionTexture:g,emissionTexture:f,hasParametersFromSource:!1,sphereDepthInterpolate:this.layer.hasGoogleUrl,alphaDiscardMode:s,doubleSided:c,cullFace:d,isGround:this.layer.replacesTerrain,groundTransparencyMode:this._groundTransparencyMode,emissiveBaseColor:h,usePBR:o,slicePlaneEnabled:this.slicePlaneEnabled,opacity:this._renderOpacity,polygonOffset:0,ellipsoidMode:1,applySSAO:this._applySSAO}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t?(t.isLoaded?(this._loadedObjects.delete(t),this._visibleObjects.delete(t),this._intersectionHandler.removeTile(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e)):this._dbg(3,`freeRendedrable on non-existent renderable ${e}`)}freeObject(e){const t=ce(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){if(this.destroyed||this.destroying)return;const r=this._frustum,s=new Array;let a=!1,o=!1;for(let n=0;n<i;++n){if(!t[n])continue;const i=e[n],l=this._lyrHandleToObjects.get(i);if(l){if(l.isLoaded){this._dbg(3,`Already loaded object marked loaded again ${l.stableNodeId}`);continue}a=!0,l.isLoaded=!0,this._loadedObjects.add(l),this._intersectionHandler.addTile(l),this._usedMemory+=l.usedMemory,this._cacheMemory-=l.usedMemory;const e=l.obb?.intersectsFrustum(r)??!0;l.isVisible=e,e&&(this._visibleObjects.add(l),o||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(e,l.elevationRange)),s.push(l.obb),l.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(ce(i))}else this._dbg(3,`Tried to mark Non existent object ${i} as loaded`)}for(let n=0;n<i;++n){const i=e[n];if(t[n])continue;const r=this._lyrHandleToObjects.get(i);if(r){if(!r.isLoaded){this._dbg(3,`Tried to unload not-loaded object ${r.stableNodeId}`);continue}const e=r.isVisible;this._visibleObjects.delete(r),r.isVisible=!1,r.isLoaded=!1,this._loadedObjects.delete(r),this._intersectionHandler.removeTile(r),e&&(this._visibleGeometryChanged(),o||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(!1,r.elevationRange)),this._usedMemory-=r.usedMemory,this._cacheMemory+=r.usedMemory,s.push(r.obb),r.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,!1)}),this._memCache.put(ce(i),r)}else this._dbg(3,`Tried to mark Non existent object ${i} as not loaded`)}a&&this._visibleGeometryChanged(),s.length>0&&this._elevationProvider.notifyObjectsChanged(s),o&&this._setVisibleElevationRangeDirty()}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_isVisibileElevationRangeModifiedByChangedTileVisbility(e,t){const{visibleElevationRange:i}=this,{minElevation:r,maxElevation:s}=t;return e?r<i.minElevation||s>i.maxElevation:r===i.minElevation||s===i.maxElevation}_getTexture(e,t,i){const r=e&&t.desc.materials?.images?.[e.imageId];if(!r||null==r.data||r.data===ae)return null;const s=t.assets[r.data];if(!s||s.byteCount<1||"U8"!==s.dataType)return null;const a=i.get(r)??this._createTexture(e,r,s,i);return a?new Ie(this._stage.renderView.textures,a.id):null}_createTexture(e,t,i,r){const s=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,a=!!t.mipCount||s>1,o=Te[e.wrapMode??"None"];let n=t.alpha?6408:6407;const l=new Uint8Array(i.data.buffer,0,i.byteCount);let c=null,d=null,h=null;switch(t.format){case"Raw":"R8"===t.pixelFormat?(c=l,n=6403,d=""):"Rg8"===t.pixelFormat||"Ga8"===t.pixelFormat?(c=l,n=33319,d=""):"Rgb8"===t.pixelFormat?(c=l,n=6407,d=""):"Rgba8"===t.pixelFormat&&(c=l,n=6408,d="");break;case"Dxt1":c=l,n=6407,d="image/vnd-ms.dds";break;case"Dxt5":c=l,n=6408,d="image/vnd-ms.dds";break;case"Basis":c=l,n=6407,d="image/ktx2";break;case"Etc1":c=l,n=6407,d="image/ktx";break;case"Png":d="image/png",h=document.createElement("img");break;case"Jpeg":d="image/jpeg",h=document.createElement("img");break;case"Etc2":d="image/ktx",h=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(h&&d){const e=new Blob([l],{type:d});h.src=URL.createObjectURL(e),c=h}if(c&&null!=d){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker}:void 0,i=Ze(n,d,t.format),l=new De(c,{mipmap:a,maxAnisotropy:s,encoding:d,wrap:o,pixelFormat:n,internalFormat:i??void 0,immutable:null!=i,compressionOptions:e,noUnpackFlip:!0,width:t.mip0Width,height:t.mip0Height});return this._stage.addTexture(l),r.set(t,l),l}return null}_getBufferViews(e,t){let i,r,s,a,o;for(let c=0;c<e.atrbs.length;c++){const o=e.atrbs[c],n=t.assets[o.assetId];if(!n)continue;const d=n.data.buffer,m=void 0,p=0,f=n.byteCount;try{switch(o.sem){case"Position":3===n.ncomp&&"F32"===n.dataType&&u(n.data)?i=new ie(d,p,m,f):this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+n+")");break;case"Normal":if(3===n.ncomp&&"F32"===n.dataType&&u(n.data)){const e=new ie(d,p,m,f);a=new Uint32Array(e.count),Le(e.typedBuffer,new Int16Array(a.buffer,a.byteOffset,2*a.length))}else this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+n+")");break;case"TexCoord":2===n.ncomp&&"F32"===n.dataType&&u(n.data)?void 0===s&&(s=new te(d,p,m,f).typedBuffer):this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+n+")");break;case"Color":"U8"===n.dataType&&h(n.data)&&(4===n.ncomp?r=new Q(d,p,m,f):3===n.ncomp&&(r=new ee(d,p,m,f))),null==r&&this._dbg(3,"[Unsupported Feature] Unsupported view for Color ("+n+")");break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+o.sem+"). Skipping vertex attribute.")}}catch(l){this._dbg(2,"Error Creating buffer ("+l+"). Skipping vertex attribute.")}}let n=!1;if(null!=e.index&&e.index!==ae){const i=t.assets[e.index];if(i){const e=void 0,t=0,r=i.byteCount;switch(i.dataType){case"U16":1===i.ncomp&&p(i.data)&&(o=new se(i.data.buffer,t,e,r));break;case"U32":1===i.ncomp&&m(i.data)&&(o=new re(i.data.buffer,t,e,r))}n=!o}else n=!0}if(!n&&null==o&&null!=i){const e=i.count;o=o=e<65535?new se(new Uint16Array(e).buffer):new re(new Uint32Array(e).buffer);for(let t=0;t<e;t++)o.set(t,t)}return{positionView:i,colorView:r,texCoord0Data:s,indicesView:o,normalsData:a}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>{this._modifications=e.filter(e=>!(this.layer.isUsedAsGroundLayer&&"replace"!==e.type)).toArray(),this._modifications.length<e.length&&t.getLogger(this).info("Ground layers only support replace modifications. Other modification types have been ignored.")},n),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([y()],Ye.prototype,"freeze",void 0),e([y()],Ye.prototype,"fullOpacity",null),e([y()],Ye.prototype,"opaque",null),e([y()],Ye.prototype,"invisible",null),e([y({readOnly:!0})],Ye.prototype,"ready",null),e([y({type:[oe]})],Ye.prototype,"_modifications",void 0),e([y()],Ye.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([y()],Ye.prototype,"layer",void 0),e([y({readOnly:!0})],Ye.prototype,"visibleAtCurrentScale",null),e([y({readOnly:!0})],Ye.prototype,"_collection",null),e([y()],Ye.prototype,"elevationOffset",null),e([y({readOnly:!0})],Ye.prototype,"visibleElevationRange",null),e([y()],Ye.prototype,"fullExtentInLocalViewSpatialReference",void 0),Ye=e([b("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Ye);const Je=Ye;class Ke{constructor(e,t,i,r,s,a,o,n,l,c){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=r,this.vboMemoryUsage=s,this.textureMemoryUsage=a,this.obb=o,this.stableNodeId=n,this.nodeDepth=l,this.elevationRange=c,this.bvhIntersectionGeneration=0,this.isLoaded=!1,this.isVisible=!1;const d=O();o?.getCenter(d),this._obbCenterX=d[0],this._obbCenterY=d[1],this._obbCenterZ=d[2];const h=o?.radius??-1;this._obbRadius=h,this._obbRadiusSquared=h*h,this._obbShortestHalfsize=o?Math.min(o.halfSizeX,o.halfSizeY,o.halfSizeZ):0,this._mbsCenter=o?o.getCenter(O()):U}get usedMemory(){return this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get mbsRadius(){return this._obbRadius}get mbsCenter(){return this._mbsCenter}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const{_obbCenterX:i,_obbCenterY:r,_obbCenterZ:s}=this,a=i-e[0],o=r-e[1],n=s-e[2],l=a*t[0]+o*t[1]+n*t[2];return a*a+o*o+n*n-l*l<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){const t=this._obbRadius;if(t<0)return!0;const i=e.center,r=e.radius,s=t+r,a=this._obbCenterX-i[0];if(a>s)return!1;const o=this._obbCenterY-i[1];if(o>s)return!1;const n=this._obbCenterZ-i[2];if(n>s)return!1;const l=a*a+o*o+n*n;if(l>s*s)return!1;if(l<=(this._obbShortestHalfsize+r)**2)return!0;const c=r-t;return c>0&&l<=c*c||(this.obb?.intersectSphere(e)??!0)}}function Qe(e){return Math.round(e/1048.576)/1e3}function et(e){return new Oe(e.center,e.halfSize,x(...e.quaternion))}const tt=new Array;class it{constructor(e,t,i,r,s,a){this.materialPromise=e,this.baseColorTexture=t,this.metallicRoughnessTexture=i,this.emissionTexture=r,this.occlusionTexture=s,this.normalTexture=a}cleanup(){this.baseColorTexture?.dispose(),this.metallicRoughnessTexture?.dispose(),this.emissionTexture?.dispose(),this.occlusionTexture?.dispose(),this.normalTexture?.dispose()}}export{Je as default};
2
+ import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{abortMaybe as i,destroyMaybe as r,removeMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as a,createAbortError as o}from"../../../core/promiseUtils.js";import{initial as n,watch as l,when as c}from"../../../core/reactiveUtils.js";import{schedule as d}from"../../../core/scheduling.js";import{isUint8Array as h,isFloat32Array as u,isUint32Array as m,isUint16Array as p}from"../../../core/typedArrayUtil.js";import{unitFromRESTJSON as f,convertUnit as g}from"../../../core/units.js";import{property as y,subclass as b}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as _,invert as v}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as w,IDENTITY as C}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as T}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as x}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{normalize as j,sub as E,dot as M,set as R}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as O,freeze as S,clone as V,ZEROS as U,fromValues as P}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as H,clone as I,ONES as D}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMoon as L,isMars as A,getReferenceEllipsoid as k,SphericalECEFSpatialReferenceLike as F}from"../../../geometry/ellipsoidUtils.js";import G from"../../../geometry/HeightModelInfo.js";import{computeTranslationToOriginAndRotation as z}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as B}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as N}from"../../../geometry/projection/projectVectorToVector.js";import{create as q}from"../../../geometry/support/aaBoundingRect.js";import{isCompatible as W}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as X,isWebMercator as $,equals as Z,isGeographic as Y,isCGCS2000 as J}from"../../../geometry/support/spatialReferenceUtils.js";import K from"../../../geometry/support/WKIDUnitConversion.js";import{BufferViewVec4u8 as Q,BufferViewVec3u8 as ee,BufferViewVec2f as te,BufferViewVec3f as ie,BufferViewUint32 as re,BufferViewUint16 as se}from"../../../geometry/support/buffer/BufferView.js";import{nullId as ae}from"../../../layers/ILyr3DWasmPerSceneView.js";import oe from"../../../layers/support/SceneModification.js";import{getHeightModelInfoFromVCS as ne,validateEntity3D as le,makeCacheKey as ce}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as de}from"../../../support/elevationInfoUtils.js";import{IntegratedMesh3DTilesLayerWorkerHandle as he}from"./IntegratedMesh3DTilesLayerWorkerHandle.js";import{LayerView3D as ue}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as me}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as pe,removeLayerViewFromWasm as fe,getLyr3DWasm as ge}from"./Lyr3DWasm.js";import{toWasmModification as ye}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as be}from"./i3s/LayerElevationProvider.js";import{IntegratedMesh3DTilesLayerView3DSymbol as _e}from"./support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{primTypeConversion as ve,alphaModeConversion as we,faceCullingConversion as Ce,wrapModeConversion as Te}from"./support/lyr3dTypeConversions.js";import{makeScheduleFunction as xe}from"./support/makeScheduleFunction.js";import{Tiles3DMeshIntersectionHandler as je}from"./support/Tiles3DMeshIntersectionHandler.js";import{Frustum as Ee}from"../state/Frustum.js";import{ElevationRange as Me}from"../support/ElevationRange.js";import{toBoundingRect as Re}from"../support/extentUtils.js";import{Obb as Oe}from"../support/orientedBoundingBox.js";import{glLayout as Se}from"../support/buffer/glUtil.js";import{getGroundTransparencyModeFromOpacity as Ve}from"../terrain/TransparencyMode.js";import{ComponentGeometryParameters as Ue,SourceGeometry as Pe}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as He}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as Ie}from"../webgl-engine/core/material/RenderTexture.js";import{ManagedTexture as De}from"../webgl-engine/lib/ManagedTexture.js";import{compressNormals as Le}from"../webgl-engine/lib/Normals.js";import{advancedMRRFactors as Ae}from"../webgl-engine/materials/pbrUtils.js";import ke from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as Fe,isInEffectiveScaleRange as Ge,validateScaleRange as ze}from"../../support/layerViewUtils.js";import{TaskPriority as Be}from"../../support/Scheduler.js";import{TextureCompressionTracker as Ne}from"../../support/TextureCompressionTracker.js";import{CompressedTextureFormat as qe,SizedPixelFormat as We}from"../../webgl/enums.js";import{alphaCutoff as Xe}from"../../../webscene/support/AlphaCutoff.js";var $e;function Ze(e,t,i){if("image/vnd-ms.dds"===t)switch(i){case"Dxt1":return qe.COMPRESSED_RGB_S3TC_DXT1_EXT;case"Dxt5":return qe.COMPRESSED_RGBA_S3TC_DXT5_EXT;default:return null}if("image/ktx"===t)return"Etc1"===i?qe.COMPRESSED_RGB8_ETC2:null;switch(e){case 33319:return We.RG8;case 6407:return We.RGB8;case 6408:return We.RGBA8;case 6403:return We.R8;default:return null}}let Ye=class extends(ue(ke)){static{$e=_e}constructor(e){super(e),this[$e]=!0,this.type="integrated-mesh-3dtiles",this.freeze=!1,this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._initializationController=null,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._replacesTerrain=!1,this._isUsedAsGroundLayer=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._imShading=!!has("enable-feature:im-shading"),this._imVertexNormals=!!has("enable-feature:im-vertex-normals"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._loadedObjects=new Set,this._compressionTracker=new Ne,this._dbgFlags=new Set;const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e)),this._replacesTerrain=e.layer.replacesTerrain,this._isUsedAsGroundLayer=e.layer.isUsedAsGroundLayer,this._frameTask=t.scheduler.registerTask(Be.TILES3D,this),this._frustum=new Ee(e.view.renderCoordsHelper)}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{a(t);const i=this.layer.queryElevationCallback;this.layer=e,this.layer.queryElevationCallback=i}):null}canRecycleWith(e){return e.url===this.layer.url&&"integrated-mesh-3dtiles"===e.type&&e.replacesTerrain===this._replacesTerrain&&e.isUsedAsGroundLayer===this._isUsedAsGroundLayer}initialize(){this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._workerHandle=new he(xe(e.resourceController)),this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),n),!this._canProjectWithoutEngine())throw Fe("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);this._initializationController=new AbortController;const t=pe(this,this._initializationController.signal).then(t=>{a(this._initializationController.signal),this._wasmLayerId=t,this._intersectionHandler=new je(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged()),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>this.view.overlayManager.renderer.isEmpty,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),n),this._updatingHandles.add(()=>e.state.contentCamera,()=>this._cameraChanged(),n),this._elevationProvider=new be({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler});const i=this._replacesTerrain?0:1;e.elevationProvider.register(i,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([l(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),c(()=>this.fullOpacity,()=>this._opacityChange()),l(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),n),l(()=>this.freeze,e=>{e?this._wasm?.incrementFrozenLayerViewCount(this):(this._wasm?.decrementFrozenLayerViewCount(this),this._cameraChanged())})]),this._initializationController=null,this.addHandles(c(()=>this._replacesTerrain&&this._wasm?.isTerrainReady,()=>{this.layer.queryElevationCallback=(e,t)=>this._queryElevation(e,t)}))});this.addResolvingPromise(t)}destroy(){if(this.freeze=!1,this._initializationController=i(this._initializationController),this._dbg(2,"Tiles3DLayerView3D destroy() called"),this._workerHandle?.destroyContextAndSelf(this.uid),fe(this),this.layer.queryElevationCallback=null,this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler.destroy(),this._intersectionHandler=null),this._elevationProvider){const e=Array.from(this._lyrHandleToObjects.values()),t=e.reduce((e,{componentObjects:t})=>e+t.length,0);this._elevationProvider.notifyObjectsChangedFunctional(t,t=>{for(const{componentObjects:i}of e)for(const{obb:e}of i)if(!t(e))return}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null}this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._loadedObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._frameTask.remove(),this._updatingHandles=r(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=s(this._visibleGeometryChangedSchedulerHandle)}get usedAsGround(){return this._isUsedAsGroundLayer}get fullOpacity(){return this.layer.replacesTerrain?this.view.map.ground.opacity:1}get opaque(){return 0===this._groundTransparencyMode}get invisible(){return 3===this._groundTransparencyMode}get _groundTransparencyMode(){return this.layer.replacesTerrain?Ve(this.fullOpacity,this.view.overlayManager.renderer.isEmpty):0}get _renderOpacity(){switch(this._groundTransparencyMode){case 3:return 0;case 2:return Xe;default:return this.fullOpacity}}get hasModifications(){return this._modifications&&this._modifications.length>0}_opacityChange(){const e=this._renderOpacity,t=this._groundTransparencyMode;this.forEachComponentObject(i=>this._collection.updateObjectOpacity(i,e,t))}_cameraChanged(){if(this.freeze)return;const e=this._frustum;e.update(this.view.state.contentCamera);const t=this._visibleObjects;let i=!1;this._loadedObjects.forEach(r=>{const s=r.obb?.intersectsFrustum(e)??!1;s!==r.isVisible&&(r.isVisible=s,s?t.add(r):t.delete(r),r.componentObjects.forEach(e=>this._collection.setObjectVisibility(e,s)),i||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(s,r.elevationRange))}),i&&this._setVisibleElevationRangeDirty()}intersect(e,t,i,r){this._intersectionHandler.intersectRay(e,t,i,r,null,!1)}get ready(){return!this.layer.replacesTerrain||!!this._wasm?.isTerrainReady}_modificationsChanged(){const e=this.useEsriCrs?this.layer.supportedSpatialReferences[1]:this.layer.supportedSpatialReferences[0],t=ye(this._layerClippingArea,this._modifications,e,this.view.state.isGlobal);this._wasm?.setMeshModifications(this,t)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=q();this._layerClippingArea=Re(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=d(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this.layer.replacesTerrain),this.forEachComponentObject(t=>t.updateMaterial({slicePlaneEnabled:e}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,de(e))}get _wasm(){return ge(this.view)}_queryElevation(e,t){return this.destroying||this.destroyed?Promise.reject(o()):this._wasm?.queryElevation(this,e,t)??Promise.reject(o())}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get useEsriCrs(){return this._useEsriCrs}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||Ge(this.layer.effectiveScaleRange,this.view.scale)}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.layer.isUsedAsGroundLayer||ze(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,r=0,s=0,a=0;return this._lyrHandleToObjects.forEach(o=>{o.isLoaded?(e+=o.textureMemoryUsage,t+=o.vboMemoryUsage,s++):(i+=o.textureMemoryUsage,r+=o.vboMemoryUsage,a++)}),new me(this.usedMemory,s,a,Qe(t),Qe(e),Qe(r),Qe(i))}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(X(this.view.renderSpatialReference)||$(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&Z(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(115700===this.layer.esriCrsSpatialReference.vcsWkid)return!1;let e=ne(this.layer.esriCrsSpatialReference);if(!e){const t=this.layer.esriCrsSpatialReference;let i="meters";!Y(t)&&t.wkid&&-1!==t.wkid&&(i=f(K.units[K[t.wkid]])),i&&(e=new G({heightModel:"gravity-related-height",heightUnit:i}))}const t=this.view.heightModelInfo;return this._useEsriCrs=0===W(e,t,!1),this._useEsriCrs&&(e&&(this._metersPerVCSUnit=g(1,e.heightUnit,"meters")),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return de(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new Me(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new Me;0===this._visibleObjects.size?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this._forEachRelevantVisibleTile(t=>e.expandElevationRange(t.elevationRange)),e.minElevation===1/0&&e.setElevationRangeValues(0,0));const t=this._get("visibleElevationRange");return t&&t.minElevation===e.minElevation&&t.maxElevation===e.maxElevation?t:e}_setVisibleElevationRangeDirty(){this.notifyChange("visibleElevationRange")}_forEachRelevantVisibleTile(e){const{view:t}=this,{spatialReference:i}=t,r=i.isWGS84||i.isWebMercator||J(i)||L(i)||A(i);if(this.view.state.isGlobal||!r)return this.forEachVisibleTile(e);const s=k(i).radius,{eye:a,viewForward:o,near:n}=t.state.contentCamera,l=j(O(),o),c=500,d=Math.max(a[2],c),h=d+s,u=Math.sqrt(h**2-s**2),m=Math.abs(Math.atan2(u,s))*s,p=d>.5*s?.5*Math.PI*s:m,f=O();this.forEachVisibleTile(t=>{const{mbsRadius:i,mbsCenter:r}=t;if(i<0)return;E(f,r,a);const s=M(f,l);Math.abs(s)<p&&s+i>n&&s-i<p&&e(t)})}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachTile(e){for(const t of this._loadedObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const{componentObjects:i}of e)for(const e of i)t(e)}get drapeTargetType(){return this._replacesTerrain?0:1}isUpdating(){const e=this._wasm;return!this.freeze&&this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}get readyToRun(){return!!this._frameTask?.readyToRun}runTask(e){this._frameTask.processQueue(e)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");const{entity3d:t}=e;if(!le(t))throw new Error("entity3D not valid");const i=new Map;let r;try{r=this._createPrimitiveTextureBundles(t,i)}catch(a){throw i.forEach(e=>this._stage?.removeTexture(e)),a}let s=null;try{if(s=await this._createRenderableMain(t,r),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance");const{tileObb:a,componentObjects:o,elevationRange:n}=s;let l=0,c=0,d=0;for(const e of o){const{texture:t,textureMetallicRoughness:i,textureEmissive:r,textureOcclusion:s,textureNormal:a}=e.renderable.drawParameters;l+=(t?.usedMemory??0)+(i?.usedMemory??0)+(r?.usedMemory??0)+(s?.usedMemory??0)+(a?.usedMemory??0),c+=this._collection.getObjectGPUMemoryUsage(e),d+=e.intersectionGeometry.usedMemory}const h=Array.from(i.values()),u=new Ke(e.handle,o,h,d,c,l,a,e.stableNodeId,e.nodeDepth,n);return this._lyrHandleToObjects.set(e.handle,u),()=>{this._memCache.put(ce(u.handle),u);const{usedMemory:e}=u;return this._cacheMemory+=e,{memUsageBytes:e}}}catch(a){throw r.forEach(e=>e.cleanup()),s?.componentObjects.forEach(e=>this._collection.destroyObject(e)),i.forEach(e=>this._stage?.removeTexture(e)),a}}_createPrimitiveTextureBundles(e,t){const i=new Array;try{const r=e.desc.geometry;for(const s of e.validPrimitiveIndices){const a=r.prims[s].materialId,o=e.desc.materials?.materials&&null!=a&&a!==ae?e.desc.materials.materials[a]:null;let n=Promise.resolve(tt),l=null,c=null,d=null,h=null,u=null;if(o){const i="Pbr"===o.lightingModel;l=this._getTexture(o.baseColorTex,e,t),c=i?this._getTexture(o.metalTex,e,t):null,d=i?this._getTexture(o.emissiveTex,e,t):null,h=i?this._getTexture(o.occlusionTex,e,t):null,u=i?this._getTexture(o.normalTex,e,t):null;const r=[l,c,d,h,u].map(e=>e?.loadPromise??null);n=Promise.all(r)}i.push(new it(n,l,c,d,h,u))}}catch(r){throw i.forEach(e=>e.cleanup()),r}return i}async _createRenderableMain(e,t){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain called after destroy");const i=new Array,r=e.desc,s=S(...e.origin),a=this.view.groundView.spatialReference,o=this.view.state.isGlobal;let n=C;if(o){const e=T();z(F,s,e,a),n=_(w(),e)}const l=et(r.obb),c=o?k(this.view.spatialReference).radius:0,d=new Array;try{let h=-1;for(const i of e.validPrimitiveIndices){h+=1;const s=r.geometry.prims[i],a=t[h];this._dbgFlags.has(2)&&this._dbg(2,JSON.stringify(s));if(null==ve[s.ptype]){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+s.ptype+"). Skipping primitive."),a.cleanup();continue}const{positionView:o,normalsData:n,colorView:l,texCoord0Data:c,indicesView:u}=this._getBufferViews(s,e);if(null==o||null==u){a.cleanup();continue}const m=o.count,p=(e,t)=>null==e||e===m||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);p(null!=c?c.length/2:void 0,"numTexcoord")&&p(l?.count,"numColors")&&p(n?.length,"normals")?d.push({componentIndex:h,positionView:o,indicesView:u,texCoord0Data:c,colorView:l,normalsData:n}):a.cleanup()}const u=n!==C,m=u?v(w(),n)??C:C,{vertexProcessingOutputs:p,obbHalfSizeAccumulator:f,elevationRange:g}=await this._workerHandle.processTiles3DVertices(d,s,c,o,n,l,this._imVertexNormals&&!this._isUsedAsGroundLayer);if(this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");const y=r.materials;if(await Promise.all(t.map(e=>e.materialPromise)),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");p.length>0&&l.setHalfSize(f);for(const o of p){const{componentIndex:n,positionView:c,indicesView:d,layout:h,textureCoordinateType:p,interleavedVertexData:f,indices:g}=o,b=e.validPrimitiveIndices[n],_=r.geometry.prims[b],v=t[n],w=l.clone(),C=Se(h),T=new Uint32Array([0,d.typedBuffer.length]),x=new Ue(C,this._imShading?2:0,p,u?2:0),j=new Pe({interleavedVertexData:f,vertexCount:f.byteLength/C[0].stride,indexData:g},{positions:c.typedBuffer,indices:d.typedBuffer},T,x),E=this.view.renderSpatialReference,M=O(),R=[1,1,1];B(s,E,R,a)||this._dbg(3,"Unsupported coordinate system for IM overlay"),N(s,E,M,a);const S=this._createComponentMaterialInitParameters(y,_.materialId,v);S.baseColorTexture||this._dbg(3,"No colour texture 1");const V=this._collection.createObject({toMapSpace:H(M[0],M[1],R[0],R[1]),transform:new He(s,m),obb:w,geometry:j,elevationAlignable:!1},S);i.push(V)}const{fullExtent:b}=this.layer;return b?.hasZ&&b.zmax&&b.zmin&&(g.minElevation=Math.max(g.minElevation,b.zmin),g.maxElevation=Math.min(g.maxElevation,b.zmax)),{tileObb:l,componentObjects:i,elevationRange:g}}catch(h){throw i.forEach(e=>this._collection.destroyObject(e)),h}}_createComponentMaterialInitParameters(e,t,i){const r=null!=e?.materials&&null!=t&&t!==ae?e.materials[t]:null;let s=1;const a=r?.baseColorTex?.imageId;if(null!=a&&e&&Array.isArray(e.images)&&a>=0&&a<e.images.length){const t=e.images[a];t.alpha&&(s=we[t.alpha])}const o="Pbr"===(null!=r?r.lightingModel:"Unlit");let n=D,l=Xe,c=!1,d=2,h=P(0,0,0);const u=V(Ae),m=i.baseColorTexture,p=i.metallicRoughnessTexture,f=i.emissionTexture,g=i.occlusionTexture,y=i.normalTexture;return r&&(n=I(r.baseColorFactor),l=r.alphaCutoff??Xe,o&&(R(u,r.metallicFactor,r.roughnessFactor,0),r.emissiveFactor&&(h=r.emissiveFactor)),c=r.isDoubleSided,d=Ce[r.faceCulling??"NotSet"]),{isIntegratedMesh:!0,baseColor:n,textureAlphaCutoff:l,mrrFactors:u,baseColorTexture:m,metallicRoughnessTexture:p,normalTexture:y,occlusionTexture:g,emissionTexture:f,hasParametersFromSource:!1,sphereDepthInterpolate:this.layer.hasGoogleUrl,alphaDiscardMode:s,doubleSided:c,cullFace:d,isGround:this.layer.replacesTerrain,groundTransparencyMode:this._groundTransparencyMode,emissiveBaseColor:h,usePBR:o,slicePlaneEnabled:this.slicePlaneEnabled,opacity:this._renderOpacity,polygonOffset:0,ellipsoidMode:1,applySSAO:this._applySSAO}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t?(t.isLoaded?(this._loadedObjects.delete(t),this._visibleObjects.delete(t),this._intersectionHandler.removeTile(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e)):this._dbg(3,`freeRendedrable on non-existent renderable ${e}`)}freeObject(e){const t=ce(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){if(this.destroyed||this.destroying)return;const r=this._frustum,s=new Array;let a=!1,o=!1;for(let n=0;n<i;++n){if(!t[n])continue;const i=e[n],l=this._lyrHandleToObjects.get(i);if(l){if(l.isLoaded){this._dbg(3,`Already loaded object marked loaded again ${l.stableNodeId}`);continue}a=!0,l.isLoaded=!0,this._loadedObjects.add(l),this._intersectionHandler.addTile(l),this._usedMemory+=l.usedMemory,this._cacheMemory-=l.usedMemory;const e=l.obb?.intersectsFrustum(r)??!0;l.isVisible=e,e&&(this._visibleObjects.add(l),o||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(e,l.elevationRange)),s.push(l.obb),l.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(ce(i))}else this._dbg(3,`Tried to mark Non existent object ${i} as loaded`)}for(let n=0;n<i;++n){const i=e[n];if(t[n])continue;const r=this._lyrHandleToObjects.get(i);if(r){if(!r.isLoaded){this._dbg(3,`Tried to unload not-loaded object ${r.stableNodeId}`);continue}const e=r.isVisible;this._visibleObjects.delete(r),r.isVisible=!1,r.isLoaded=!1,this._loadedObjects.delete(r),this._intersectionHandler.removeTile(r),e&&(this._visibleGeometryChanged(),o||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(!1,r.elevationRange)),this._usedMemory-=r.usedMemory,this._cacheMemory+=r.usedMemory,s.push(r.obb),r.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,!1)}),this._memCache.put(ce(i),r)}else this._dbg(3,`Tried to mark Non existent object ${i} as not loaded`)}a&&this._visibleGeometryChanged(),s.length>0&&this._elevationProvider.notifyObjectsChanged(s),o&&this._setVisibleElevationRangeDirty()}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_isVisibileElevationRangeModifiedByChangedTileVisbility(e,t){const{visibleElevationRange:i}=this,{minElevation:r,maxElevation:s}=t;return e?r<i.minElevation||s>i.maxElevation:r===i.minElevation||s===i.maxElevation}_getTexture(e,t,i){const r=e&&t.desc.materials?.images?.[e.imageId];if(!r||null==r.data||r.data===ae)return null;const s=t.assets[r.data];if(!s||s.byteCount<1||"U8"!==s.dataType)return null;const a=i.get(r)??this._createTexture(e,r,s,i);return a?new Ie(this._stage.renderView.textures,a.id):null}_createTexture(e,t,i,r){const s=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,a=!!t.mipCount||s>1,o=Te[e.wrapMode??"None"];let n=t.alpha?6408:6407;const l=new Uint8Array(i.data.buffer,0,i.byteCount);let c=null,d=null,h=null;switch(t.format){case"Raw":"R8"===t.pixelFormat?(c=l,n=6403,d=""):"Rg8"===t.pixelFormat||"Ga8"===t.pixelFormat?(c=l,n=33319,d=""):"Rgb8"===t.pixelFormat?(c=l,n=6407,d=""):"Rgba8"===t.pixelFormat&&(c=l,n=6408,d="");break;case"Dxt1":c=l,n=6407,d="image/vnd-ms.dds";break;case"Dxt5":c=l,n=6408,d="image/vnd-ms.dds";break;case"Basis":c=l,n=6407,d="image/ktx2";break;case"Etc1":c=l,n=6407,d="image/ktx";break;case"Png":d="image/png",h=document.createElement("img");break;case"Jpeg":d="image/jpeg",h=document.createElement("img");break;case"Etc2":d="image/ktx",h=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(h&&d){const e=new Blob([l],{type:d});h.src=URL.createObjectURL(e),c=h}if(c&&null!=d){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker}:void 0,i=Ze(n,d,t.format),l=new De(c,{mipmap:a,maxAnisotropy:s,encoding:d,wrap:o,pixelFormat:n,internalFormat:i??void 0,immutable:null!=i,compressionOptions:e,noUnpackFlip:!0,width:t.mip0Width,height:t.mip0Height});return this._stage.addTexture(l),r.set(t,l),l}return null}_getBufferViews(e,t){let i,r,s,a,o;for(let c=0;c<e.atrbs.length;c++){const o=e.atrbs[c],n=t.assets[o.assetId];if(!n)continue;const d=n.data.buffer,m=void 0,p=0,f=n.byteCount;try{switch(o.sem){case"Position":3===n.ncomp&&"F32"===n.dataType&&u(n.data)?i=new ie(d,p,m,f):this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+n+")");break;case"Normal":if(3===n.ncomp&&"F32"===n.dataType&&u(n.data)){const e=new ie(d,p,m,f);a=new Uint32Array(e.count),Le(e.typedBuffer,new Int16Array(a.buffer,a.byteOffset,2*a.length))}else this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+n+")");break;case"TexCoord":2===n.ncomp&&"F32"===n.dataType&&u(n.data)?void 0===s&&(s=new te(d,p,m,f).typedBuffer):this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+n+")");break;case"Color":"U8"===n.dataType&&h(n.data)&&(4===n.ncomp?r=new Q(d,p,m,f):3===n.ncomp&&(r=new ee(d,p,m,f))),null==r&&this._dbg(3,"[Unsupported Feature] Unsupported view for Color ("+n+")");break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+o.sem+"). Skipping vertex attribute.")}}catch(l){this._dbg(2,"Error Creating buffer ("+l+"). Skipping vertex attribute.")}}let n=!1;if(null!=e.index&&e.index!==ae){const i=t.assets[e.index];if(i){const e=void 0,t=0,r=i.byteCount;switch(i.dataType){case"U16":1===i.ncomp&&p(i.data)&&(o=new se(i.data.buffer,t,e,r));break;case"U32":1===i.ncomp&&m(i.data)&&(o=new re(i.data.buffer,t,e,r))}n=!o}else n=!0}if(!n&&null==o&&null!=i){const e=i.count;o=o=e<65535?new se(new Uint16Array(e).buffer):new re(new Uint32Array(e).buffer);for(let t=0;t<e;t++)o.set(t,t)}return{positionView:i,colorView:r,texCoord0Data:s,indicesView:o,normalsData:a}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>{this._modifications=e.filter(e=>!(this.layer.isUsedAsGroundLayer&&"replace"!==e.type)).toArray(),this._modifications.length<e.length&&t.getLogger(this).info("Ground layers only support replace modifications. Other modification types have been ignored.")},n),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([y()],Ye.prototype,"freeze",void 0),e([y()],Ye.prototype,"fullOpacity",null),e([y()],Ye.prototype,"opaque",null),e([y()],Ye.prototype,"invisible",null),e([y({readOnly:!0})],Ye.prototype,"ready",null),e([y({type:[oe]})],Ye.prototype,"_modifications",void 0),e([y()],Ye.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([y()],Ye.prototype,"layer",void 0),e([y({readOnly:!0})],Ye.prototype,"visibleAtCurrentScale",null),e([y({readOnly:!0})],Ye.prototype,"_collection",null),e([y()],Ye.prototype,"elevationOffset",null),e([y({readOnly:!0})],Ye.prototype,"visibleElevationRange",null),e([y()],Ye.prototype,"fullExtentInLocalViewSpatialReference",void 0),Ye=e([b("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Ye);const Je=Ye;class Ke{constructor(e,t,i,r,s,a,o,n,l,c){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=r,this.vboMemoryUsage=s,this.textureMemoryUsage=a,this.obb=o,this.stableNodeId=n,this.nodeDepth=l,this.elevationRange=c,this.bvhIntersectionGeneration=0,this.isLoaded=!1,this.isVisible=!1;const d=O();o?.getCenter(d),this._obbCenterX=d[0],this._obbCenterY=d[1],this._obbCenterZ=d[2];const h=o?.radius??-1;this._obbRadius=h,this._obbRadiusSquared=h*h,this._obbShortestHalfsize=o?Math.min(o.halfSizeX,o.halfSizeY,o.halfSizeZ):0,this._mbsCenter=o?o.getCenter(O()):U}get usedMemory(){return this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get mbsRadius(){return this._obbRadius}get mbsCenter(){return this._mbsCenter}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const{_obbCenterX:i,_obbCenterY:r,_obbCenterZ:s}=this,a=i-e[0],o=r-e[1],n=s-e[2],l=a*t[0]+o*t[1]+n*t[2];return a*a+o*o+n*n-l*l<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){const t=this._obbRadius;if(t<0)return!0;const i=e.center,r=e.radius,s=t+r,a=this._obbCenterX-i[0];if(a>s)return!1;const o=this._obbCenterY-i[1];if(o>s)return!1;const n=this._obbCenterZ-i[2];if(n>s)return!1;const l=a*a+o*o+n*n;if(l>s*s)return!1;if(l<=(this._obbShortestHalfsize+r)**2)return!0;const c=r-t;return c>0&&l<=c*c||(this.obb?.intersectSphere(e)??!0)}}function Qe(e){return Math.round(e/1048.576)/1e3}function et(e){return new Oe(e.center,e.halfSize,x(...e.quaternion))}const tt=new Array;class it{constructor(e,t,i,r,s,a){this.materialPromise=e,this.baseColorTexture=t,this.metallicRoughnessTexture=i,this.emissionTexture=r,this.occlusionTexture=s,this.normalTexture=a}cleanup(){this.baseColorTexture?.dispose(),this.metallicRoughnessTexture?.dispose(),this.emissionTexture?.dispose(),this.occlusionTexture?.dispose(),this.normalTexture?.dispose()}}export{Je as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{initial as t}from"../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{I3SMeshView3D as o}from"./I3SMeshView3D.js";import{LayerView3D as s}from"./LayerView3D.js";import{ElevationRange as a}from"../support/ElevationRange.js";import{updatingProgress as l}from"../support/updatingProperties.js";import n from"../../layers/LayerView.js";import{isInEffectiveScaleRange as p}from"../../support/layerViewUtils.js";const d=.2;let u=class extends(o(s(n))){constructor(){super(...arguments),this.type="integrated-mesh-3d",this.visibleElevationRange=new a(1/0,-1/0),this._elevationContext=1,this._supportsLabeling=!1,this._applySSAO=!has("disable-feature:im-ssao"),this.drapeTargetType=1}get updatingProgressValue(){return this._controller?.updatingProgress??0}get lodFactor(){return this.view?.qualitySettings?.sceneService?.meshLoDFactor??1}get progressiveLoadFactor(){return this.lodFactor>=1?d:1}get visibleAtCurrentScale(){return p(this.layer.effectiveScaleRange,this.view.scale)}get fullOpacity(){return 1}get opaque(){return!0}get invisible(){return!1}get layerPopupEnabledAndHasTemplate(){return!1}initialize(){this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),t),this.view.overlayManager.registerDrapeTarget(this)}destroy(){this.view.overlayManager.unregisterDrapeTarget(this)}get ready(){return this.layer.loaded}_createLayerGraphic(){}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>this._modifications=e.toArray(),t),"modifications")}};e([r()],u.prototype,"layer",void 0),e([r(l)],u.prototype,"updatingProgress",void 0),e([r()],u.prototype,"updatingProgressValue",null),e([r()],u.prototype,"lodFactor",null),e([r({readOnly:!0})],u.prototype,"progressiveLoadFactor",null),e([r({readOnly:!0})],u.prototype,"visibleAtCurrentScale",null),e([r({readOnly:!0})],u.prototype,"visibleElevationRange",void 0),e([r()],u.prototype,"fullOpacity",null),e([r()],u.prototype,"opaque",null),e([r()],u.prototype,"invisible",null),u=e([i("esri.views.3d.layers.IntegratedMeshLayerView3D")],u);const c=u;export{c as default};
2
+ import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{initial as t}from"../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{I3SMeshView3D as o}from"./I3SMeshView3D.js";import{LayerView3D as s}from"./LayerView3D.js";import{ElevationRange as a}from"../support/ElevationRange.js";import{updatingProgress as l}from"../support/updatingProperties.js";import n from"../../layers/LayerView.js";import{isInEffectiveScaleRange as p}from"../../support/layerViewUtils.js";const d=.2;let u=class extends(o(s(n))){constructor(){super(...arguments),this.type="integrated-mesh-3d",this.usedAsGround=!1,this.visibleElevationRange=new a(1/0,-1/0),this._elevationContext=1,this._supportsLabeling=!1,this._applySSAO=!has("disable-feature:im-ssao"),this.drapeTargetType=1}get updatingProgressValue(){return this._controller?.updatingProgress??0}get lodFactor(){return this.view?.qualitySettings?.sceneService?.meshLoDFactor??1}get progressiveLoadFactor(){return this.lodFactor>=1?d:1}get visibleAtCurrentScale(){return p(this.layer.effectiveScaleRange,this.view.scale)}get fullOpacity(){return 1}get opaque(){return!0}get invisible(){return!1}get layerPopupEnabledAndHasTemplate(){return!1}initialize(){this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),t),this.view.overlayManager.registerDrapeTarget(this)}destroy(){this.view.overlayManager.unregisterDrapeTarget(this)}get ready(){return this.layer.loaded}_createLayerGraphic(){}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>this._modifications=e.toArray(),t),"modifications")}};e([r()],u.prototype,"layer",void 0),e([r(l)],u.prototype,"updatingProgress",void 0),e([r()],u.prototype,"updatingProgressValue",null),e([r()],u.prototype,"lodFactor",null),e([r({readOnly:!0})],u.prototype,"progressiveLoadFactor",null),e([r({readOnly:!0})],u.prototype,"visibleAtCurrentScale",null),e([r({readOnly:!0})],u.prototype,"visibleElevationRange",void 0),e([r()],u.prototype,"fullOpacity",null),e([r()],u.prototype,"opaque",null),e([r()],u.prototype,"invisible",null),u=e([i("esri.views.3d.layers.IntegratedMeshLayerView3D")],u);const c=u;export{c as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{estimateNumberArrayMemory as i}from"../../../core/memoryEstimations.js";import{throwIfAborted as s}from"../../../core/promiseUtils.js";import{initial as o,watch as a,sync as n}from"../../../core/reactiveUtils.js";import{generateUID as l}from"../../../core/uid.js";import{property as d,subclass as u}from"../../../core/accessorSupport/decorators.js";import{set as h}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as p,create as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBuffer as g}from"../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as m}from"../../../geometry/projection/projectVectorToVector.js";import{extentContainsCoords3D as y,extentContainsCoords2D as f}from"../../../geometry/support/contains.js";import{newDoubleArray as _,doubleArrayFrom as b}from"../../../geometry/support/DoubleArray.js";import{getGeometryZScaler as v}from"../../../geometry/support/zscale.js";import{fallbackObjectIDAttribute as I}from"../../../layers/LayerConstants.js";import{estimateSize as x}from"../../../layers/graphics/dehydratedFeatures.js";import{ImmutableDehydratedPoint as E}from"../../../layers/graphics/dehydratedPoint.js";import{hydrateGraphic as w}from"../../../layers/graphics/hydratedFeatures.js";import O from"../../../layers/graphics/controllers/I3SOnDemandController.js";import j from"../../../layers/support/FeatureFilter.js";import N from"../../../rest/support/Query.js";import{isBasemapLayerView as C}from"../../../support/basemapUtils.js";import{isGraphic as D}from"../../../support/graphicInstanceUtils.js";import{I3SPointsWorkerHandle as F}from"./I3SPointsWorkerHandle.js";import{LayerView3D as S}from"./LayerView3D.js";import{Graphics3DFeatureProcessor as G}from"./graphics/Graphics3DFeatureProcessor.js";import{QueryEngine as A}from"./graphics/QueryEngine.js";import{QueryEngineContext as V}from"./graphics/QueryEngineContext.js";import{createInteractiveEditSession as P,normalizeEditResultsEvent as L,processAttributeEdits as R}from"./i3s/featureEditing.js";import{getCachedAttributeValue as H}from"./i3s/I3SBinaryReader.js";import{I3SGraphicsMap as M}from"./i3s/I3SGraphicsMap.js";import{I3SOverrides as U}from"./i3s/I3SOverrides.js";import{checkRecyclable as Q,checkSpatialReferences as q,containsDraco as T,whenGraphicAttributes as B}from"./i3s/I3SUtil.js";import{attributeLookup as k}from"./support/attributeUtils.js";import{DefinitionExpressionSceneLayerView as z}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as W}from"./support/fieldProperties.js";import{normalizeHighlightTarget as K,emptyHighlightHandle as Z,isObjectId as $}from"./support/highlightUtils.js";import{LayerViewPerformanceInfo as Y}from"./support/LayerViewPerformanceInfo.js";import{PopupSceneLayerView as J}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as X}from"./support/SceneLayerViewRequiredFields.js";import{TemporalSceneLayerView as ee}from"./support/TemporalSceneLayerView.js";import{debugFlags as te}from"../support/debugFlags.js";import{compute as re}from"../support/orientedBoundingBox.js";import{updatingProgress as ie}from"../support/updatingProperties.js";import{Vertices as se}from"../webgl-engine/lib/Attribute.js";import oe from"../../layers/SceneLayerView.js";import{hasPopupTemplate as ae}from"../../layers/support/popupUtils.js";import{getHighlightName as ne}from"../../support/highlightOptionsUtils.js";import{hasLayerBasedScaleVisibility as le,isInEffectiveScaleRange as de}from"../../support/layerViewUtils.js";import{TaskPriority as ue}from"../../support/Scheduler.js";const he=W();class pe{constructor(e,t,r,i){this.graphics=e,this.featureIds=t,this.attributeInfo=r,this.node=i}get usedMemory(){return this.graphics.reduce((e,t)=>x(t)+e,i(this.featureIds)+1024)}}let ce=class extends(ee(z(J(S(oe))))){constructor(){super(...arguments),this.type="scene-layer-graphics-3d",this._queryEngine=null,this._memCache=null,this._interactiveEditingSessions=new Map,this._pendingEditsQueue=Promise.resolve(),this.loadedGraphics=new M((e,t,r)=>fe(e,t,r),e=>this.processor.graphicsCore.recreateGraphics(e),this.logError),this.holeFilling="always",this.progressiveLoadFactor=1,this.supportsHeightUnitConversion=!0,this._coordinatesOutsideExtentErrors=0,this._maxCoordinatesOutsideExtentErrors=20}tryRecycleWith(e,t){return e.url===this.layer.url&&this._i3sOverrides.isEmpty?e.load(t).then(()=>{s(t),Q(this.layer,e,this._i3sOverrides),this.layer=e,this._i3sOverrides.destroy();const i=this.view.resourceController?.memoryController;this._i3sOverrides=new U({view:this.view,layer:e,memoryController:i}),r(this._queryEngine),this._setupQueryEngine(),this.processor.resetObjectStates()}):null}initialize(){this.addResolvingPromise(this.layer.indexInfo);const e=this.view.resourceController?.memoryController;this._i3sOverrides=new U({view:this.view,layer:this.layer,memoryController:e}),q(this.layer,this.view.spatialReference,this.view.viewingMode),this._fieldsHelper=new X({layerView:this}),this._updatingHandles.add(()=>this.layer.rangeInfos,e=>this._rangeInfosChanged(e),o),this._updatingHandles.add(()=>this.layer.renderer,(e,t)=>this._rendererChange(e,t)),this._updatingHandles.add(()=>[this.parsedDefinitionExpression,this.layer.excludeObjectIds],()=>this._filterChange()),this._set("processor",new G({owner:this,preferredUpdatePolicy:0,scaleVisibilityEnabled:!le(),filterVisibilityEnabled:!0,timeExtentEnabled:!1,frustumVisibilityEnabled:!1,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!1,setUidToIdOnAdd:!1,dataExtent:this.layer.fullExtent,updateClippingExtent:e=>this._updateClippingExtent(e)})),this.processor.elevationAlignment?.events.on("invalidate-elevation",({extent:e,spatialReference:t})=>this._controller.updateElevationChanged(e,t)),this.supportsHeightUnitConversion&&(this._verticalScale=v("point",this.layer.spatialReference,this.view.spatialReference)),this.addResolvingPromise(this.processor.when()),this._memCache=this.view.resourceController.memoryController.newCache(`psl-${this.uid}`),this._controller=new O({layerView:this}),T(this.layer.geometryDefinitions)&&(this._workerHandle=new F(e=>this.view.resourceController.immediate.schedule(e))),this.addHandles(this.layer.on("apply-edits",e=>this._updatingHandles.addPromise(e.result))),this.addHandles([this.layer.on("edits",e=>{const t=this._pendingEditsQueue.then(()=>this._handleEdits(e)).then();this._pendingEditsQueue=t,this._updatingHandles.consumePromise(t)}),a(()=>te.I3S_TREE_SHOW_TILES,e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then(({I3STreeDebugger:t})=>{!this._treeDebugger&&te.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))})}else e||!this._treeDebugger||te.I3S_TREE_SHOW_TILES||(this._treeDebugger.destroy(),this._treeDebugger=null)},o)]),this.when(()=>{this._setupQueryEngine(),this._updatingHandles.add(()=>this.availableFields,()=>this._queryEngine?.clear(),n),this._updatingHandles.add(()=>this.maximumNumberOfFeatures,e=>this._controller.featureTarget=e,o),this._updatingHandles.add(()=>this.suspended,e=>{e&&this._removeAllNodeData()})}).catch(()=>{})}destroy(){this._treeDebugger=r(this._treeDebugger),this._i3sOverrides=r(this._i3sOverrides),this._set("processor",r(this.processor)),this._controller=r(this._controller),this._queryEngine=r(this._queryEngine),this._workerHandle=r(this._workerHandle),this._memCache=r(this._memCache),this.loadedGraphics.clear(),this._fieldsHelper=r(this._fieldsHelper)}get layerViewUid(){return this.uid}get updatingProgressValue(){return this._controller?.updatingProgress??1}get visibleAtCurrentScale(){return le()?de(this.layer.effectiveScaleRange,this.view.scale):!this.processor?.scaleVisibilitySuspended}get requiredFields(){return this._fieldsHelper?.requiredFields??[]}get maximumNumberOfFeatures(){const e=this.processor?.graphicsCore?.displayFeatureLimit;return e?.maximumNumberOfFeatures??0}set maximumNumberOfFeatures(e){null!=e?(this._override("maximumNumberOfFeatures",e),this._controller.fixedFeatureTarget=!0):(this._clearOverride("maximumNumberOfFeatures"),this._controller.fixedFeatureTarget=!1)}get maximumNumberOfFeaturesExceeded(){return!this.suspended&&(!!this._controller?.useMaximumNumberOfFeatures&&!this._controller.leavesReached)}get _excludeObjectIds(){return new Set(this.layer.excludeObjectIds)}get lodFactor(){return"Labels"===this.layer.semantic?1:this.view.qualitySettings.sceneService.pointLoDFactor}get hasM(){return!1}get hasZ(){return!0}get contentVisible(){return!this.suspended&&!!this._controller?.rootNodeVisible}get legendEnabled(){return this.contentVisible&&!0===this.layer?.legendEnabled}get _graphicOrigin(){return this.layer.graphicOrigin}async whenGraphicAttributes(e,t){return B(this.layer,e,this._getObjectIdField(),t,()=>[...this.loadedGraphics.nodes()])}getHit(e){if(!this.loadedGraphics)return null;const t=w(this.loadedGraphics.find(t=>t.uid===e),this.layer,this._graphicOrigin),r=this._getObjectIdField();return null==t?.attributes?.[r]?null:{type:"graphic",graphic:t,layer:t.layer}}whenGraphicBounds(e,t){return this.processor.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.processor.computeAttachmentOrigin(e,t)}isUpdating(){return!!(this._controller?.updating||this.processor?.updating||this._fieldsHelper?.updating||this.layerFilterUpdating)}highlight(e,t){const r=ne(t),i=this.layer.objectIdField,s=K(e);if(0===s.length)return Z;if(D(s[0])){const e=s;if(null!=k(this.layer.fieldsIndex,e[0].attributes,i)){const t=e.map(e=>k(this.layer.fieldsIndex,e.attributes,i));return this.processor.highlightByObjectIds(t,i,r)}return this.processor.highlightByGraphics(e,r)}return $(s[0])?this.processor.highlightByObjectIds(s,i,r):Z}get updatePolicy(){return this.processor.graphicsCore.effectiveUpdatePolicy}createInteractiveEditSession(e){return P(this._attributeEditingContext,e)}async _decompressBinaryPointData(e,t){const r={geometryBuffer:e.geometryBuffer};null==this._workerHandle&&(this._workerHandle=new F(e=>this.view.resourceController.immediate.schedule(e)));const i=await this._workerHandle.invoke(r,t);if(null==i)throw new Error("Failed to decompress Draco point data");return{positionData:i.positions,featureIds:i.featureIds}}async addNode(e,r,i){if(!ye(r)&&!me(r))throw new Error;if(this.loadedGraphics.hasNode(e.index))return void t.getLogger(this).error("I3S node "+e.id+" already added");const s=null!=this.layer.fullExtent?be(this.layer.fullExtent.clone(),.5):null,{featureIds:o,pointPositions:a}=ye(r)?await this._extractBinaryPointPositions(e,r,i):this._extractLegacyPointPositions(r),n=new Array;this._validatePositions(e,o,a,s,n);const l=this._controller.crsVertex,d=this.view.spatialReference;g(a,l,0,a,d,0,o.length);const u=ye(r)?e.level:0,h=this._createGraphics(o,a,e.index,u),p=new pe(h,o,r.attributeDataInfo,e);if(await this._i3sOverrides.applyAttributeOverrides(p.featureIds,r.attributeDataInfo,i),e.numFeatures=p.graphics.length,this._updateNodeMemory(e),_e(p),n.length>0&&(this._computeObb(e,n,l),this._controller.updateVisibility(e.index)),!this._controller.isGeometryVisible(e))return void this._cacheNodeData(p);if(null!=this._verticalScale)for(const t of p.graphics)this._verticalScale(t.geometry);const c=this.view.stage.renderView.olidRenderHelper;if(c){const e=C(this.view,this.uid);for(let t=0;t<p.featureIds.length;t++){const r=p.featureIds[t];c.setUidToObjectAndLayerId(r,p.graphics[t].uid,this.layer.id,this.uid,this.layer.popupEnabled&&!e&&ae(this.layer,this.view.popup?.defaultPopupTemplateEnabled),p.node.resources.attributes,t)}}this.loadedGraphics.addNode(e.index,p),this._controller.updateLoadStatus(e.index,!0),this._filterNode(p),this._treeDebugger&&this._treeDebugger.update()}_computeObb(e,t,r){const i=this._controller.crsIndex,s=i.isGeographic?this.view.renderSpatialReference:i;g(t,r,0,t,s,0),e.serviceObbInIndexSR=re(new se(t,3)),i.isGeographic&&(m(e.serviceObbInIndexSR.getCenter(Ie),s,Ie,i),e.serviceObbInIndexSR.setCenter(Ie))}isNodeLoaded(e){return this.loadedGraphics.hasNode(e)}isNodeReloading(){return!1}updateNodeState(){}getNodeComponentHandle(){}async _extractBinaryPointPositions(e,t,r){const i=await this._decompressBinaryPointData(t,r),s=i.positionData,o=3,a=s.length/o,n=_(3*a),l=null!=e.serviceObbInIndexSR?e.serviceObbInIndexSR.getCenter(Ee):p,d=Math.abs(l[2])*2**-20;for(let u=0;u<a;u++){const e=u*o;n[e]=s[e]+l[0],n[e+1]=s[e+1]+l[1],n[e+2]=s[e+2]+l[2],Math.abs(n[e+2])<d&&(n[e+2]=0)}return{featureIds:i.featureIds?b(i.featureIds):[],pointPositions:n}}_extractLegacyPointPositions(e){const t=e.pointData.length,r=_(3*t),i=new Array;for(let s=0;s<t;s++){const t=e.pointData[s],o=t.featureDataPosition,a=o.length,n=t.geometries?.[0]??ve[a],l=t.featureIds[0];if("Embedded"!==n.type||"points"!==n.params.type||a<2||a>3)continue;const d=n.params.vertexAttributes?.position??[0,0,0],u=3*i.length;r[u]=o[0]+d[0],r[u+1]=o[1]+d[1],r[u+2]=3===a?o[2]+d[2]:NaN,i.push(l)}return{featureIds:i,pointPositions:r}}_validatePositions(e,r,i,s,o){if(null==s&&e.serviceObbInIndexSR)return;const a=r.length,n=3;for(let l=0;l<a;l++){const r=l*n;h(Ie,i[r],i[r+1],i[r+2]);const a=!Number.isNaN(i[2]);null==s||(a?y(s,Ie):f(s,Ie))||(this._coordinatesOutsideExtentErrors<this._maxCoordinatesOutsideExtentErrors&&t.getLogger(this).error("Service Error: Coordinates outside of layer extent"),this._coordinatesOutsideExtentErrors+1===this._maxCoordinatesOutsideExtentErrors&&t.getLogger(this).error("Maximum number of errors reached. Further errors are ignored."),this._coordinatesOutsideExtentErrors++),e.serviceObbInIndexSR||o.push(Ie[0],Ie[1],Ie[2])}}_createGraphics(e,t,r,i){const s=e.length,o=3,a=this._getObjectIdField(),n=this.processor.graphicsCore,d=new Array,u=this.view.spatialReference;for(let h=0;h<s;h++){const s=e[h],p={};null!=s&&(p[a]=s);const c=s??l(),g=h*o,m=isNaN(t[g+2])?void 0:t[g+2],y=new E(u,t[g],t[g+1],m),f=this.loadedGraphics.get(c);if(null!=f)(null==f.level||f.level<i)&&(xe.property="geometry",xe.graphic=f,xe.oldValue=f.geometry,xe.newValue=y,f.geometry=y,f.level=i,n.graphicUpdateHandler(xe),we()),d.push(f);else{const e=l();d.push({objectId:c,uid:e,geometry:y,attributes:p,visible:!0,nodeIndex:r,level:i})}}return d}_updateNodeMemory(e){e.memory=4096+(e.numFeatures??0)*this.processor.graphicsCore.usedMemoryPerGraphic}_cacheNodeData(e){this._memCache.put(this._getMemCacheKey(e.node),e)}_getMemCacheKey(e){return`${e.index}`}_removeAllNodeData(){this.loadedGraphics.forEachNode((e,t)=>{if(e){const t=e.node;this._updateNodeMemory(t),this._cacheNodeData(e)}this._controller.updateLoadStatus(t,!1)}),this._treeDebugger&&this._treeDebugger.update(),this.loadedGraphics.clear()}removeNode(e){const t=this._removeNodeStageData(e);t&&(this._updateNodeMemory(t.node),this._cacheNodeData(t))}_removeNodeStageData(e){const t=this.loadedGraphics.getNode(e);return null==t?null:(this._controller.updateLoadStatus(e,!1),this.loadedGraphics.removeNode(e),this._treeDebugger&&this._treeDebugger.update(),t)}async loadCachedNodeData(e){return this._memCache?.pop(this._getMemCacheKey(e))}async addCachedNodeData(e,r,i,s){this.loadedGraphics.hasNode(e.index)?t.getLogger(this).error("I3S node "+e.id+" already added"):(await this._i3sOverrides.applyAttributeOverrides(r.featureIds,i,s),r.attributeInfo=i,this.loadedGraphics.addNode(e.index,r),this._controller.updateLoadStatus(e.index,!0),this._updateNodeMemory(e),_e(r),this._filterNode(r),this._treeDebugger&&this._treeDebugger.update())}getLoadedNodeIds(){const e=[];return this.loadedGraphics.forEachNode(t=>e.push(t.node.id)),e.sort()}getVisibleNodes(){const e=new Array;return this.loadedGraphics.forEachNode(t=>e.push(t.node)),e}getLoadedNodeIndices(e){this.loadedGraphics.forEachNode((t,r)=>e.push(r))}getLoadedAttributes(e){const t=this.loadedGraphics.getNode(e);if(null!=t?.attributeInfo)return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this.loadedGraphics.getNode(e);if(null!=t?.attributeInfo)return t.attributeInfo.attributeData}_setAttributeData(e,t){const r=this.loadedGraphics.getNode(e);null!=r?.attributeInfo&&(r.attributeInfo.attributeData=t,this._attributeValuesChanged(r))}async updateAttributes(e,t,r){const i=this.loadedGraphics.getNode(e);null!=i&&(await this._i3sOverrides.applyAttributeOverrides(i.featureIds,t,r),i.attributeInfo=t,this._attributeValuesChanged(i))}_attributeValuesChanged(e){_e(e),this._filterNode(e);const{processor:t}=this,{graphicsCore:r}=t;if(r.labelsEnabled){const t=e.node.index,i=new Array;e.graphics.forEach(e=>e.nodeIndex===t&&i.push(e.uid)),r.updateLabelingInfo(i)}t.refreshFilter()}_updateClippingExtent(e){return this._controller&&this._controller.updateClippingArea(e),!1}_getObjectIdField(){return this.layer.objectIdField||I}_getGlobalIdField(){return this.layer.globalIdField}async _rendererChange(e,t){const{layer:{fieldsIndex:r}}=this,i=new Set;let s,o;e?(await e.collectRequiredFields(i,r),s=Array.from(i).sort()):s=[],i.clear(),t?(await t.collectRequiredFields(i,r),o=Array.from(i).sort()):o=[],s.length===o.length&&s.every((e,t)=>s[t]===o[t])||this._reloadAllNodes()}_rangeInfosChanged(e){null!=e&&e.length>0&&t.getLogger(this).warn("Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.")}_filterChange(){this.loadedGraphics.forEachNode(e=>this._filterNode(e))}_reloadAllNodes(){this._removeAllNodeData(),this._controller&&this._controller.restartNodeLoading()}_filterNode(e){const t=this.parsedDefinitionExpression,r=this._excludeObjectIds,i=this._getObjectIdField();for(const s of e.graphics){const e=s.visible,o=this._evaluateClause(t,s),a=!r.has(s.attributes[i]);s.visible=o&&a,e!==s.visible&&(xe.graphic=s,xe.property="visible",xe.oldValue=e,xe.newValue=s.visible,this.processor.graphicsCore.graphicUpdateHandler(xe),we())}}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return this.filter?.createQuery(e)??new N(e)}queryFeatures(e,t){return this._queryEngine.executeQuery(this._ensureQuery(e),t?.signal)}queryObjectIds(e,t){return this._queryEngine.executeQueryForIds(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this._queryEngine.executeQueryForCount(this._ensureQuery(e),t?.signal)}queryExtent(e,t){return this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t?.signal)}_ensureQuery(e){return this._addDefinitionExpressionToQuery(null==e?this.createQuery():N.from(e))}_setupQueryEngine(){const{layer:e,view:t,hasM:r,hasZ:i}=this,{spatialReference:s,resourceController:o}=t,a=new V(s,e,o,()=>this.processor.featureStore,i,r,()=>this.availableFields);this._queryEngine=new A({context:a,priority:ue.FEATURE_QUERY_ENGINE})}get usedMemory(){return this.processor?.graphicsCore?.usedMemory??0}get unloadedMemory(){return.8*((this._controller?.unloadedMemoryEstimate??0)+(this.processor?.graphicsCore?.unprocessedMemoryEstimate??0))}get ignoresMemoryFactor(){return this._controller&&this._controller.fixedFeatureTarget}async _handleEdits(e){const t=this._attributeEditingContext,r=await L(t,e);R(t,r)}get _attributeEditingContext(){const e=this._getObjectIdField(),t=this._getGlobalIdField();return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:e,globalIdField:t,forEachNode:e=>this.loadedGraphics.forEachNode(t=>e(t.node,t.featureIds)),attributeStorageInfo:this.layer.attributeStorageInfo??[],i3sOverrides:this._i3sOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(t,r,i)=>{this._setAttributeData(t,r);const s=this.loadedGraphics.getNode(t);if(null!=i){const t=this.loadedGraphics.get(i.attributes[e]);null!=t&&this.processor.graphicsCore.recreateGraphics([t])}else null!=s&&this.processor.graphicsCore.recreateGraphics(s.graphics)},clearMemCache:()=>{}}}get performanceInfo(){return new Y(this.usedMemory,this.loadedGraphics.length,-1,this.maximumNumberOfFeatures,this.loadedGraphics.nodeCount,this.processor.graphicsCore.performanceInfo)}get test(){}};e([d()],ce.prototype,"processor",void 0),e([d({type:j})],ce.prototype,"filter",void 0),e([d()],ce.prototype,"loadedGraphics",void 0),e([d()],ce.prototype,"layerViewUid",null),e([d()],ce.prototype,"_controller",void 0),e([d()],ce.prototype,"updating",void 0),e([d()],ce.prototype,"suspended",void 0),e([d(ie)],ce.prototype,"updatingProgress",void 0),e([d()],ce.prototype,"updatingProgressValue",null),e([d({readOnly:!0})],ce.prototype,"visibleAtCurrentScale",null),e([d(he.requiredFields)],ce.prototype,"requiredFields",null),e([d(he.availableFields)],ce.prototype,"availableFields",void 0),e([d()],ce.prototype,"_fieldsHelper",void 0),e([d({type:Number})],ce.prototype,"maximumNumberOfFeatures",null),e([d({readOnly:!0})],ce.prototype,"maximumNumberOfFeaturesExceeded",null),e([d()],ce.prototype,"_excludeObjectIds",null),e([d({readOnly:!0})],ce.prototype,"lodFactor",null),e([d({readOnly:!0})],ce.prototype,"hasM",null),e([d({readOnly:!0})],ce.prototype,"hasZ",null),e([d()],ce.prototype,"contentVisible",null),e([d({readOnly:!0})],ce.prototype,"legendEnabled",null),e([d()],ce.prototype,"_graphicOrigin",null),ce=e([u("esri.views.3d.layers.SceneLayerGraphicsView3D")],ce);const ge=ce;function me(e){return"pointData"in e}function ye(e){return"geometryBuffer"in e&&null!==e.geometryBuffer}function fe(e,t,r){const i=t.attributeInfo;if(null==i?.loadedAttributes||null==i.attributeData)return!1;let s=!1;for(const{name:o}of i.loadedAttributes)if(i.attributeData[o]){const t=H(i.attributeData[o],r);t!==e.attributes[o]&&(e.attributes[o]=t,s=!0)}return s}function _e(e){const t=e.attributeInfo;if(null==t?.loadedAttributes||null==t.attributeData)return;const r=e.node.index;for(let i=0;i<e.graphics.length;i++){const s=e.graphics[i];if(s.nodeIndex===r){s.attributes||(s.attributes={});for(const{name:e}of t.loadedAttributes)t.attributeData[e]&&(s.attributes[e]=H(t.attributeData[e],i))}}}function be(e,t){return e.xmin-=t,e.ymin-=t,e.xmax+=t,e.ymax+=t,null!=e.zmin&&null!=e.zmax&&(e.zmin-=t,e.zmax+=t),null!=e.mmin&&null!=e.mmax&&(e.mmin-=t,e.mmax+=t),e}const ve={2:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0]}}},3:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0,0]}}}},Ie=c(),xe={graphic:null,property:null,oldValue:null,newValue:null},Ee=c();function we(){xe.graphic=null,xe.property=null,xe.oldValue=null,xe.newValue=null}export{ge as default};
2
+ import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{estimateNumberArrayMemory as i}from"../../../core/memoryEstimations.js";import{throwIfAborted as s}from"../../../core/promiseUtils.js";import{initial as o,watch as a,sync as n}from"../../../core/reactiveUtils.js";import{generateUID as l}from"../../../core/uid.js";import{property as d,subclass as h}from"../../../core/accessorSupport/decorators.js";import{set as u}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as p,create as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBuffer as g}from"../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as m}from"../../../geometry/projection/projectVectorToVector.js";import{extentContainsCoords3D as y,extentContainsCoords2D as f}from"../../../geometry/support/contains.js";import{newDoubleArray as _,doubleArrayFrom as b}from"../../../geometry/support/DoubleArray.js";import{getGeometryZScaler as v}from"../../../geometry/support/zscale.js";import{fallbackObjectIDAttribute as x}from"../../../layers/LayerConstants.js";import{estimateSize as I}from"../../../layers/graphics/dehydratedFeatures.js";import{ImmutableDehydratedPoint as E}from"../../../layers/graphics/dehydratedPoint.js";import{hydrateGraphic as w}from"../../../layers/graphics/hydratedFeatures.js";import O from"../../../layers/graphics/controllers/I3SOnDemandController.js";import j from"../../../layers/support/FeatureFilter.js";import{I3SExtractChanges as C}from"../../../layers/support/I3SExtractChanges.js";import N from"../../../rest/support/Query.js";import{isBasemapLayerView as D}from"../../../support/basemapUtils.js";import{isGraphic as F}from"../../../support/graphicInstanceUtils.js";import{I3SPointsWorkerHandle as S}from"./I3SPointsWorkerHandle.js";import{LayerView3D as G}from"./LayerView3D.js";import{Graphics3DFeatureProcessor as A}from"./graphics/Graphics3DFeatureProcessor.js";import{QueryEngine as V}from"./graphics/QueryEngine.js";import{QueryEngineContext as P}from"./graphics/QueryEngineContext.js";import{createInteractiveEditSession as L,normalizeEditResultsEvent as R,processAttributeEdits as H}from"./i3s/featureEditing.js";import{getCachedAttributeValue as M}from"./i3s/I3SBinaryReader.js";import{I3SGraphicsMap as U}from"./i3s/I3SGraphicsMap.js";import{I3SOverrides as Q}from"./i3s/I3SOverrides.js";import{checkRecyclable as q,checkSpatialReferences as T,containsDraco as B,whenGraphicAttributes as z}from"./i3s/I3SUtil.js";import{attributeLookup as k}from"./support/attributeUtils.js";import{DefinitionExpressionSceneLayerView as W}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as K}from"./support/fieldProperties.js";import{normalizeHighlightTarget as Z,emptyHighlightHandle as $,isObjectId as Y}from"./support/highlightUtils.js";import{LayerViewPerformanceInfo as J}from"./support/LayerViewPerformanceInfo.js";import{PopupSceneLayerView as X}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as ee}from"./support/SceneLayerViewRequiredFields.js";import{TemporalSceneLayerView as te}from"./support/TemporalSceneLayerView.js";import{debugFlags as re}from"../support/debugFlags.js";import{compute as ie}from"../support/orientedBoundingBox.js";import{updatingProgress as se}from"../support/updatingProperties.js";import{Vertices as oe}from"../webgl-engine/lib/Attribute.js";import ae from"../../layers/SceneLayerView.js";import{hasPopupTemplate as ne}from"../../layers/support/popupUtils.js";import{getHighlightName as le}from"../../support/highlightOptionsUtils.js";import{hasLayerBasedScaleVisibility as de,isInEffectiveScaleRange as he}from"../../support/layerViewUtils.js";import{TaskPriority as ue}from"../../support/Scheduler.js";const pe=K();class ce{constructor(e,t,r,i){this.graphics=e,this.featureIds=t,this.attributeInfo=r,this.node=i}get usedMemory(){return this.graphics.reduce((e,t)=>I(t)+e,i(this.featureIds)+1024)}}let ge=class extends(te(W(X(G(ae))))){constructor(){super(...arguments),this.type="scene-layer-graphics-3d",this._queryEngine=null,this._memCache=null,this._interactiveEditingSessions=new Map,this._pendingEditsQueue=Promise.resolve(),this.loadedGraphics=new U((e,t,r)=>_e(e,t,r),e=>this.processor.graphicsCore.recreateGraphics(e),this.logError),this.holeFilling="always",this.progressiveLoadFactor=1,this.supportsHeightUnitConversion=!0,this._coordinatesOutsideExtentErrors=0,this._maxCoordinatesOutsideExtentErrors=20}tryRecycleWith(e,t){return e.url===this.layer.url&&this._i3sOverrides.isEmpty?e.load(t).then(()=>{s(t),q(this.layer,e,this._i3sOverrides),this.layer=e,this._reinitializeOverrides(),r(this._queryEngine),this._setupQueryEngine(),this.processor.resetObjectStates()}):null}initialize(){this.addResolvingPromise(this.layer.indexInfo),this._reinitializeOverrides(),T(this.layer,this.view.spatialReference,this.view.viewingMode),this._fieldsHelper=new ee({layerView:this}),this._updatingHandles.add(()=>this.layer.rangeInfos,e=>this._rangeInfosChanged(e),o),this._updatingHandles.add(()=>this.layer.renderer,(e,t)=>this._rendererChange(e,t)),this._updatingHandles.add(()=>[this.parsedDefinitionExpression,this.layer.excludeObjectIds],()=>this._filterChange()),this._set("processor",new A({owner:this,preferredUpdatePolicy:0,scaleVisibilityEnabled:!de(),filterVisibilityEnabled:!0,timeExtentEnabled:!1,frustumVisibilityEnabled:!1,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!1,setUidToIdOnAdd:!1,dataExtent:this.layer.fullExtent,updateClippingExtent:e=>this._updateClippingExtent(e)})),this.processor.elevationAlignment?.events.on("invalidate-elevation",({extent:e,spatialReference:t})=>this._controller.updateElevationChanged(e,t)),this.supportsHeightUnitConversion&&(this._verticalScale=v("point",this.layer.spatialReference,this.view.spatialReference)),this.addResolvingPromise(this.processor.when()),this._memCache=this.view.resourceController.memoryController.newCache(`psl-${this.uid}`),this._controller=new O({layerView:this}),B(this.layer.geometryDefinitions)&&(this._workerHandle=new S(e=>this.view.resourceController.immediate.schedule(e))),this.addHandles(this.layer.on("apply-edits",e=>this._updatingHandles.addPromise(e.result))),this.addHandles([this.layer.on("edits",e=>{const t=this._pendingEditsQueue.then(()=>this._handleEdits(e)).then();this._pendingEditsQueue=t,this._updatingHandles.consumePromise(t)}),a(()=>re.I3S_TREE_SHOW_TILES,e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then(({I3STreeDebugger:t})=>{!this._treeDebugger&&re.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))})}else e||!this._treeDebugger||re.I3S_TREE_SHOW_TILES||(this._treeDebugger.destroy(),this._treeDebugger=null)},o)]),this.when(()=>{this._setupQueryEngine(),this._updatingHandles.add(()=>this.availableFields,()=>this._queryEngine?.clear(),n),this._updatingHandles.add(()=>this.maximumNumberOfFeatures,e=>this._controller.featureTarget=e,o),this._updatingHandles.add(()=>this.suspended,e=>{e&&this._removeAllNodeData()})}).catch(()=>{})}_reinitializeOverrides(){this._i3sOverrides?.destroy(),this._extractChanges?.destroy();const{layer:e}=this,t=this.view.resourceController?.memoryController;this._extractChanges=new C({layer:e}),this._i3sOverrides=new Q({view:this.view,layer:e,memoryController:t,extractChanges:this._extractChanges})}destroy(){this._treeDebugger=r(this._treeDebugger),this._i3sOverrides=r(this._i3sOverrides),this._extractChanges=r(this._extractChanges),this._set("processor",r(this.processor)),this._controller=r(this._controller),this._queryEngine=r(this._queryEngine),this._workerHandle=r(this._workerHandle),this._memCache=r(this._memCache),this.loadedGraphics.clear(),this._fieldsHelper=r(this._fieldsHelper)}get layerViewUid(){return this.uid}get updatingProgressValue(){return this._controller?.updatingProgress??1}get visibleAtCurrentScale(){return de()?he(this.layer.effectiveScaleRange,this.view.scale):!this.processor?.scaleVisibilitySuspended}get requiredFields(){return this._fieldsHelper?.requiredFields??[]}get maximumNumberOfFeatures(){const e=this.processor?.graphicsCore?.displayFeatureLimit;return e?.maximumNumberOfFeatures??0}set maximumNumberOfFeatures(e){null!=e?(this._override("maximumNumberOfFeatures",e),this._controller.fixedFeatureTarget=!0):(this._clearOverride("maximumNumberOfFeatures"),this._controller.fixedFeatureTarget=!1)}get maximumNumberOfFeaturesExceeded(){return!this.suspended&&(!!this._controller?.useMaximumNumberOfFeatures&&!this._controller.leavesReached)}get _excludeObjectIds(){return new Set(this.layer.excludeObjectIds)}get lodFactor(){return"Labels"===this.layer.semantic?1:this.view.qualitySettings.sceneService.pointLoDFactor}get hasM(){return!1}get hasZ(){return!0}get contentVisible(){return!this.suspended&&!!this._controller?.rootNodeVisible}get legendEnabled(){return this.contentVisible&&!0===this.layer?.legendEnabled}get _graphicOrigin(){return this.layer.graphicOrigin}async whenGraphicAttributes(e,t){return z(this.layer,e,this._getObjectIdField(),t,()=>[...this.loadedGraphics.nodes()])}getHit(e){if(!this.loadedGraphics)return null;const t=w(this.loadedGraphics.find(t=>t.uid===e),this.layer,this._graphicOrigin),r=this._getObjectIdField();return null==t?.attributes?.[r]?null:{type:"graphic",graphic:t,layer:t.layer}}whenGraphicBounds(e,t){return this.processor.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.processor.computeAttachmentOrigin(e,t)}isUpdating(){return!!(this._controller?.updating||this.processor?.updating||this._fieldsHelper?.updating||this.layerFilterUpdating)}highlight(e,t){const r=le(t),i=this.layer.objectIdField,s=Z(e);if(0===s.length)return $;if(F(s[0])){const e=s;if(null!=k(this.layer.fieldsIndex,e[0].attributes,i)){const t=e.map(e=>k(this.layer.fieldsIndex,e.attributes,i));return this.processor.highlightByObjectIds(t,i,r)}return this.processor.highlightByGraphics(e,r)}return Y(s[0])?this.processor.highlightByObjectIds(s,i,r):$}get updatePolicy(){return this.processor.graphicsCore.effectiveUpdatePolicy}createInteractiveEditSession(e){return L(this._attributeEditingContext,e)}async _decompressBinaryPointData(e,t){const r={geometryBuffer:e.geometryBuffer};null==this._workerHandle&&(this._workerHandle=new S(e=>this.view.resourceController.immediate.schedule(e)));const i=await this._workerHandle.invoke(r,t);if(null==i)throw new Error("Failed to decompress Draco point data");return{positionData:i.positions,featureIds:i.featureIds}}async addNode(e,r,i){if(!fe(r)&&!ye(r))throw new Error;if(this.loadedGraphics.hasNode(e.index))return void t.getLogger(this).error("I3S node "+e.id+" already added");const s=null!=this.layer.fullExtent?ve(this.layer.fullExtent.clone(),.5):null,{featureIds:o,pointPositions:a}=fe(r)?await this._extractBinaryPointPositions(e,r,i):this._extractLegacyPointPositions(r),n=new Array;this._validatePositions(e,o,a,s,n);const l=this._controller.crsVertex,d=this.view.spatialReference;g(a,l,0,a,d,0,o.length);const h=fe(r)?e.level:0,u=this._createGraphics(o,a,e.index,h),p=new ce(u,o,r.attributeDataInfo,e);if(await this._i3sOverrides.applyAttributeOverrides(p.featureIds,r.attributeDataInfo,i),e.numFeatures=p.graphics.length,this._updateNodeMemory(e),be(p),n.length>0&&(this._computeObb(e,n,l),this._controller.updateVisibility(e.index)),!this._controller.isGeometryVisible(e))return void this._cacheNodeData(p);if(null!=this._verticalScale)for(const t of p.graphics)this._verticalScale(t.geometry);const c=this.view.stage.renderView.olidRenderHelper;if(c){const e=D(this.view,this.uid);for(let t=0;t<p.featureIds.length;t++){const r=p.featureIds[t];c.setUidToObjectAndLayerId(r,p.graphics[t].uid,this.layer.id,this.uid,this.layer.popupEnabled&&!e&&ne(this.layer,this.view.popup?.defaultPopupTemplateEnabled),p.node.resources.attributes,t)}}this.loadedGraphics.addNode(e.index,p),this._controller.updateLoadStatus(e.index,!0),this._filterNode(p),this._treeDebugger&&this._treeDebugger.update()}_computeObb(e,t,r){const i=this._controller.crsIndex,s=i.isGeographic?this.view.renderSpatialReference:i;g(t,r,0,t,s,0),e.serviceObbInIndexSR=ie(new oe(t,3)),i.isGeographic&&(m(e.serviceObbInIndexSR.getCenter(Ie),s,Ie,i),e.serviceObbInIndexSR.setCenter(Ie))}isNodeLoaded(e){return this.loadedGraphics.hasNode(e)}isNodeReloading(){return!1}updateNodeState(){}getNodeComponentHandle(){}async _extractBinaryPointPositions(e,t,r){const i=await this._decompressBinaryPointData(t,r),s=i.positionData,o=3,a=s.length/o,n=_(3*a),l=null!=e.serviceObbInIndexSR?e.serviceObbInIndexSR.getCenter(we):p,d=Math.abs(l[2])*2**-20;for(let h=0;h<a;h++){const e=h*o;n[e]=s[e]+l[0],n[e+1]=s[e+1]+l[1],n[e+2]=s[e+2]+l[2],Math.abs(n[e+2])<d&&(n[e+2]=0)}return{featureIds:i.featureIds?b(i.featureIds):[],pointPositions:n}}_extractLegacyPointPositions(e){const t=e.pointData.length,r=_(3*t),i=new Array;for(let s=0;s<t;s++){const t=e.pointData[s],o=t.featureDataPosition,a=o.length,n=t.geometries?.[0]??xe[a],l=t.featureIds[0];if("Embedded"!==n.type||"points"!==n.params.type||a<2||a>3)continue;const d=n.params.vertexAttributes?.position??[0,0,0],h=3*i.length;r[h]=o[0]+d[0],r[h+1]=o[1]+d[1],r[h+2]=3===a?o[2]+d[2]:NaN,i.push(l)}return{featureIds:i,pointPositions:r}}_validatePositions(e,r,i,s,o){if(null==s&&e.serviceObbInIndexSR)return;const a=r.length,n=3;for(let l=0;l<a;l++){const r=l*n;u(Ie,i[r],i[r+1],i[r+2]);const a=!Number.isNaN(i[2]);null==s||(a?y(s,Ie):f(s,Ie))||(this._coordinatesOutsideExtentErrors<this._maxCoordinatesOutsideExtentErrors&&t.getLogger(this).error("Service Error: Coordinates outside of layer extent"),this._coordinatesOutsideExtentErrors+1===this._maxCoordinatesOutsideExtentErrors&&t.getLogger(this).error("Maximum number of errors reached. Further errors are ignored."),this._coordinatesOutsideExtentErrors++),e.serviceObbInIndexSR||o.push(Ie[0],Ie[1],Ie[2])}}_createGraphics(e,t,r,i){const s=e.length,o=3,a=this._getObjectIdField(),n=this.processor.graphicsCore,d=new Array,h=this.view.spatialReference;for(let u=0;u<s;u++){const s=e[u],p={};null!=s&&(p[a]=s);const c=s??l(),g=u*o,m=isNaN(t[g+2])?void 0:t[g+2],y=new E(h,t[g],t[g+1],m),f=this.loadedGraphics.get(c);if(null!=f)(null==f.level||f.level<i)&&(Ee.property="geometry",Ee.graphic=f,Ee.oldValue=f.geometry,Ee.newValue=y,f.geometry=y,f.level=i,n.graphicUpdateHandler(Ee),Oe()),d.push(f);else{const e=l();d.push({objectId:c,uid:e,geometry:y,attributes:p,visible:!0,nodeIndex:r,level:i})}}return d}_updateNodeMemory(e){e.memory=4096+(e.numFeatures??0)*this.processor.graphicsCore.usedMemoryPerGraphic}_cacheNodeData(e){this._memCache.put(this._getMemCacheKey(e.node),e)}_getMemCacheKey(e){return`${e.index}`}_removeAllNodeData(){this.loadedGraphics.forEachNode((e,t)=>{if(e){const t=e.node;this._updateNodeMemory(t),this._cacheNodeData(e)}this._controller.updateLoadStatus(t,!1)}),this._treeDebugger&&this._treeDebugger.update(),this.loadedGraphics.clear()}removeNode(e){const t=this._removeNodeStageData(e);t&&(this._updateNodeMemory(t.node),this._cacheNodeData(t))}_removeNodeStageData(e){const t=this.loadedGraphics.getNode(e);return null==t?null:(this._controller.updateLoadStatus(e,!1),this.loadedGraphics.removeNode(e),this._treeDebugger&&this._treeDebugger.update(),t)}async loadCachedNodeData(e){return this._memCache?.pop(this._getMemCacheKey(e))}async addCachedNodeData(e,r,i,s){this.loadedGraphics.hasNode(e.index)?t.getLogger(this).error("I3S node "+e.id+" already added"):(await this._i3sOverrides.applyAttributeOverrides(r.featureIds,i,s),r.attributeInfo=i,this.loadedGraphics.addNode(e.index,r),this._controller.updateLoadStatus(e.index,!0),this._updateNodeMemory(e),be(r),this._filterNode(r),this._treeDebugger&&this._treeDebugger.update())}getLoadedNodeIds(){const e=[];return this.loadedGraphics.forEachNode(t=>e.push(t.node.id)),e.sort()}getVisibleNodes(){const e=new Array;return this.loadedGraphics.forEachNode(t=>e.push(t.node)),e}getLoadedNodeIndices(e){this.loadedGraphics.forEachNode((t,r)=>e.push(r))}getLoadedAttributes(e){const t=this.loadedGraphics.getNode(e);if(null!=t?.attributeInfo)return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this.loadedGraphics.getNode(e);if(null!=t?.attributeInfo)return t.attributeInfo.attributeData}_setAttributeData(e,t){const r=this.loadedGraphics.getNode(e);null!=r?.attributeInfo&&(r.attributeInfo.attributeData=t,this._attributeValuesChanged(r))}async updateAttributes(e,t,r){const i=this.loadedGraphics.getNode(e);null!=i&&(await this._i3sOverrides.applyAttributeOverrides(i.featureIds,t,r),i.attributeInfo=t,this._attributeValuesChanged(i))}_attributeValuesChanged(e){be(e),this._filterNode(e);const{processor:t}=this,{graphicsCore:r}=t;if(r.labelsEnabled){const t=e.node.index,i=new Array;e.graphics.forEach(e=>e.nodeIndex===t&&i.push(e.uid)),r.updateLabelingInfo(i)}t.refreshFilter()}_updateClippingExtent(e){return this._controller&&this._controller.updateClippingArea(e),!1}_getObjectIdField(){return this.layer.objectIdField||x}_getGlobalIdField(){return this.layer.globalIdField}async _rendererChange(e,t){const{layer:{fieldsIndex:r}}=this,i=new Set;let s,o;e?(await e.collectRequiredFields(i,r),s=Array.from(i).sort()):s=[],i.clear(),t?(await t.collectRequiredFields(i,r),o=Array.from(i).sort()):o=[],s.length===o.length&&s.every((e,t)=>s[t]===o[t])||this._reloadAllNodes()}_rangeInfosChanged(e){null!=e&&e.length>0&&t.getLogger(this).warn("Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.")}_filterChange(){this.loadedGraphics.forEachNode(e=>this._filterNode(e))}_reloadAllNodes(){this._removeAllNodeData(),this._controller&&this._controller.restartNodeLoading()}_filterNode(e){const t=this.parsedDefinitionExpression,r=this._excludeObjectIds,i=this._getObjectIdField();for(const s of e.graphics){const e=s.visible,o=this._evaluateClause(t,s),a=!r.has(s.attributes[i]);s.visible=o&&a,e!==s.visible&&(Ee.graphic=s,Ee.property="visible",Ee.oldValue=e,Ee.newValue=s.visible,this.processor.graphicsCore.graphicUpdateHandler(Ee),Oe())}}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return this.filter?.createQuery(e)??new N(e)}queryFeatures(e,t){return this._queryEngine.executeQuery(this._ensureQuery(e),t?.signal)}queryObjectIds(e,t){return this._queryEngine.executeQueryForIds(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this._queryEngine.executeQueryForCount(this._ensureQuery(e),t?.signal)}queryExtent(e,t){return this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t?.signal)}_ensureQuery(e){return this._addDefinitionExpressionToQuery(null==e?this.createQuery():N.from(e))}_setupQueryEngine(){const{layer:e,view:t,hasM:r,hasZ:i}=this,{spatialReference:s,resourceController:o}=t,a=new P(s,e,o,()=>this.processor.featureStore,i,r,()=>this.availableFields);this._queryEngine=new V({context:a,priority:ue.FEATURE_QUERY_ENGINE})}get usedMemory(){return this.processor?.graphicsCore?.usedMemory??0}get unloadedMemory(){return.8*((this._controller?.unloadedMemoryEstimate??0)+(this.processor?.graphicsCore?.unprocessedMemoryEstimate??0))}get ignoresMemoryFactor(){return this._controller&&this._controller.fixedFeatureTarget}async _handleEdits(e){const t=this._attributeEditingContext,r=await R(t,e);H(t,r)}get _attributeEditingContext(){const e=this._getObjectIdField(),t=this._getGlobalIdField();return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:e,globalIdField:t,forEachNode:e=>this.loadedGraphics.forEachNode(t=>e(t.node,t.featureIds)),attributeStorageInfo:this.layer.attributeStorageInfo??[],i3sOverrides:this._i3sOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(t,r,i)=>{this._setAttributeData(t,r);const s=this.loadedGraphics.getNode(t);if(null!=i){const t=this.loadedGraphics.get(i.attributes[e]);null!=t&&this.processor.graphicsCore.recreateGraphics([t])}else null!=s&&this.processor.graphicsCore.recreateGraphics(s.graphics)},clearMemCache:()=>{}}}get performanceInfo(){return new J(this.usedMemory,this.loadedGraphics.length,-1,this.maximumNumberOfFeatures,this.loadedGraphics.nodeCount,this.processor.graphicsCore.performanceInfo)}get test(){}};e([d()],ge.prototype,"processor",void 0),e([d({type:j})],ge.prototype,"filter",void 0),e([d()],ge.prototype,"loadedGraphics",void 0),e([d()],ge.prototype,"layerViewUid",null),e([d()],ge.prototype,"_controller",void 0),e([d()],ge.prototype,"updating",void 0),e([d()],ge.prototype,"suspended",void 0),e([d(se)],ge.prototype,"updatingProgress",void 0),e([d()],ge.prototype,"updatingProgressValue",null),e([d({readOnly:!0})],ge.prototype,"visibleAtCurrentScale",null),e([d(pe.requiredFields)],ge.prototype,"requiredFields",null),e([d(pe.availableFields)],ge.prototype,"availableFields",void 0),e([d()],ge.prototype,"_fieldsHelper",void 0),e([d({type:Number})],ge.prototype,"maximumNumberOfFeatures",null),e([d({readOnly:!0})],ge.prototype,"maximumNumberOfFeaturesExceeded",null),e([d()],ge.prototype,"_excludeObjectIds",null),e([d({readOnly:!0})],ge.prototype,"lodFactor",null),e([d({readOnly:!0})],ge.prototype,"hasM",null),e([d({readOnly:!0})],ge.prototype,"hasZ",null),e([d()],ge.prototype,"contentVisible",null),e([d({readOnly:!0})],ge.prototype,"legendEnabled",null),e([d()],ge.prototype,"_graphicOrigin",null),ge=e([h("esri.views.3d.layers.SceneLayerGraphicsView3D")],ge);const me=ge;function ye(e){return"pointData"in e}function fe(e){return"geometryBuffer"in e&&null!==e.geometryBuffer}function _e(e,t,r){const i=t.attributeInfo;if(null==i?.loadedAttributes||null==i.attributeData)return!1;let s=!1;for(const{name:o}of i.loadedAttributes)if(i.attributeData[o]){const t=M(i.attributeData[o],r);t!==e.attributes[o]&&(e.attributes[o]=t,s=!0)}return s}function be(e){const t=e.attributeInfo;if(null==t?.loadedAttributes||null==t.attributeData)return;const r=e.node.index;for(let i=0;i<e.graphics.length;i++){const s=e.graphics[i];if(s.nodeIndex===r){s.attributes||(s.attributes={});for(const{name:e}of t.loadedAttributes)t.attributeData[e]&&(s.attributes[e]=M(t.attributeData[e],i))}}}function ve(e,t){return e.xmin-=t,e.ymin-=t,e.xmax+=t,e.ymax+=t,null!=e.zmin&&null!=e.zmax&&(e.zmin-=t,e.zmax+=t),null!=e.mmin&&null!=e.mmax&&(e.mmin-=t,e.mmax+=t),e}const xe={2:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0]}}},3:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0,0]}}}},Ie=c(),Ee={graphic:null,property:null,oldValue:null,newValue:null},we=c();function Oe(){Ee.graphic=null,Ee.property=null,Ee.oldValue=null,Ee.newValue=null}export{me as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import i from"../../../core/Logger.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{throwIfAborted as s}from"../../../core/promiseUtils.js";import l from"../../../core/ReactiveSet.js";import{initial as n}from"../../../core/reactiveUtils.js";import{property as o,subclass as a}from"../../../core/accessorSupport/decorators.js";import d from"../../../core/sql/WhereClause.js";import u from"../../../layers/support/FeatureFilter.js";import{getFloorFilterClause as h}from"../../../layers/support/floorFilterUtils.js";import p from"../../../rest/support/Query.js";import{isNumber as c}from"../../../support/guards.js";import{I3SMeshView3D as y}from"./I3SMeshView3D.js";import{LayerView3D as g}from"./LayerView3D.js";import{createInteractiveEditSession as f,normalizeEditResultsEvent as m,processGeometryEdits as _,processAttributeEdits as F}from"./i3s/featureEditing.js";import{createGetFeatureExtent as v}from"./i3s/I3SGeometryUtil.js";import{I3SMeshViewFilter as w}from"./i3s/I3SMeshViewFilter.js";import{I3SOverrides as b}from"./i3s/I3SOverrides.js";import{I3SQueryEngine as j}from"./i3s/I3SQueryEngine.js";import{I3SQueryFeatureAdapter as I,I3SQueryFeature as S}from"./i3s/I3SQueryFeatureAdapter.js";import{I3SQueryFeatureStore as E}from"./i3s/I3SQueryFeatureStore.js";import{checkRecyclable as O,getIndexCrs as H,objectIdFilter as x}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as C}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as Q}from"./support/fieldProperties.js";import{PopupSceneLayerView as V}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as R}from"./support/SceneLayerViewRequiredFields.js";import{TemporalSceneLayerView as q}from"./support/TemporalSceneLayerView.js";import{updatingProgress as L}from"../support/updatingProperties.js";import A from"../../layers/SceneLayerView.js";import{hasPopupTemplate as D}from"../../layers/support/popupUtils.js";import{isInEffectiveScaleRange as G}from"../../support/layerViewUtils.js";import{TaskPriority as U}from"../../support/Scheduler.js";const P=Q();let M=class extends(y(q(C(V(g(A)))))){constructor(){super(...arguments),this.type="scene-layer-3d",this.viewFilter=null,this._setVisibilityHiddenObjectIds=new l,this.progressiveLoadFactor=1,this._elevationContext=2,this._supportsLabeling=!0,this._pendingEditsQueue=Promise.resolve(),this._interactiveEditingSessions=new Map,this._queryEngine=null}tryRecycleWith(e,t){return e.url===this.layer.url&&this.i3sOverrides.isEmpty?e.load(t).then(()=>{s(t),O(this.layer,e,this.i3sOverrides),this.layer=e,this.i3sOverrides.destroy();const i=this.view.resourceController?.memoryController;this.i3sOverrides=new b({view:this.view,layer:e,memoryController:i}),this.resetHighlights()}):null}get layerPopupEnabledAndHasTemplate(){return this.layer.popupEnabled&&D(this.layer,this.view.popup?.defaultPopupTemplateEnabled)}get filter(){return this._get("filter")}set filter(e){this._set("filter",w.checkSupport(e)?e:null)}get requiredFields(){return this._fieldsHelper?.requiredFields??[]}get _floorFilterClause(){const e=h(this);return null!=e?d.create(e,{fieldsIndex:this.layer.fieldsIndex}):null}get _excludeObjectIdsSorted(){const e=this.layer.excludeObjectIds.toArray();return e.length?e.sort((e,t)=>e-t):null}get _setVisibilityHiddenObjectIdsSorted(){return this._setVisibilityHiddenObjectIds.size?Array.from(this._setVisibilityHiddenObjectIds).sort((e,t)=>e-t):null}get lodFactor(){return this.view?.qualitySettings?.sceneService?.objectLoDFactor??1}get lodCrossfadeUncoveredDuration(){return this.view?.qualitySettings?.fadeDuration??0}get updatingProgressValue(){return this._controller?.updatingProgress??0}get visibleAtCurrentScale(){return G(this.layer.effectiveScaleRange,this.view.scale)}get _graphicOrigin(){return this.layer.graphicOrigin}initialize(){this._fieldsHelper=new R({layerView:this}),this._updatingHandles.add(()=>this.layer.rangeInfos,e=>this._rangeInfosChanged(e),n),this._updatingHandles.add(()=>this.layer.renderer,e=>this._updatingHandles.addPromise(this._rendererChange(e)),n);const e=()=>this._filterChange();this._updatingHandles.add(()=>this.parsedDefinitionExpression,e),this._updatingHandles.add(()=>this.mergedFilter,e),this._updatingHandles.add(()=>this._floorFilterClause,e),this._updatingHandles.add(()=>this._excludeObjectIdsSorted,e),this._updatingHandles.add(()=>this._setVisibilityHiddenObjectIdsSorted,e),this._updatingHandles.add(()=>this.viewFilter?.sortedObjectIds,e),this._updatingHandles.add(()=>this.viewFilter?.parsedWhereClause,e),this._updatingHandles.add(()=>this.getTimeFilterDependencies(),e),this._updatingHandles.add(()=>[this.viewFilter?.parsedGeometry,this.mergedFilter?.spatialRelationship,this.layer.filter?.spatialRelationship],()=>this._geometryFilterChange()),this._updatingHandles.add(()=>({layerViewFilter:this.mergedFilter,layerFilter:this.layerFilter}),({layerViewFilter:e,layerFilter:t})=>{if(null==e&&null==t)return void this._set("viewFilter",null);const i=this.viewFilter;if(i)return i.viewFilter=e,i.layerFilter=t,void this._filterChange();this._set("viewFilter",new w({layerFilter:t,viewFilter:e,layerFieldsIndex:this.layer.fieldsIndex,loadAsyncModule:e=>this._loadAsyncModule(e),addSqlFilter:(e,t)=>this.addSqlFilter(e,t,this.logError),addTimeFilter:(e,t)=>this.addTimeFilter(e,t)}))},n),this.i3sOverrides.is3DOFL&&this._updatingHandles.add(()=>this.i3sOverrides.sortedGeometryChangedObjectIds,e),this.addHandles(this.layer.on("apply-edits",e=>this._updatingHandles.addPromise(e.result))),this.addHandles(this.layer.on("edits",e=>{const t=this._pendingEditsQueue.then(()=>this._handleEdits(e)).then();this._pendingEditsQueue=t,this._updatingHandles.consumePromise(t)}))}destroy(){this._fieldsHelper=r(this._fieldsHelper)}_rangeInfosChanged(e){null!=e&&e.length>0&&i.getLogger(this).warn("Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.")}createQuery(){const e={outFields:["*"],returnGeometry:!0,returnZ:!0,outSpatialReference:this.view.spatialReference};return this.mergedFilter?.createQuery(e)??new p(e)}queryExtent(e,t){return this._ensureQueryEngine().executeQueryForExtent(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this._ensureQueryEngine().executeQueryForCount(this._ensureQuery(e),t?.signal)}queryFeatures(e,t){return this._ensureQueryEngine().executeQuery(this._ensureQuery(e),t?.signal).then(e=>{if(!e?.features)return e;const t=this.layer,i=this._graphicOrigin;for(const r of e.features)r.layer=t,r.sourceLayer=t,r.origin=i;return e})}async queryObjectIds(e,t){return(await this._ensureQueryEngine().executeQueryForIds(this._ensureQuery(e),t?.signal)).filter(c)}_ensureQueryEngine(){return this._queryEngine??=this._createQueryEngine(),this._queryEngine}_createQueryEngine(){const e=v(this.view.spatialReference,this.view.renderSpatialReference,this._collection);return new j({layerView:this,priority:U.FEATURE_QUERY_ENGINE,spatialIndex:new E({featureAdapter:new I({objectIdField:this.layer.objectIdField,attributeStorageInfo:this.layer.attributeStorageInfo??[],getFeatureExtent:e}),forAllFeatures:(e,t)=>this._forAllFeatures((t,i,r)=>e(new S(t,i,r)),t,2),getFeatureExtent:e,sourceSpatialReference:H(this.layer),viewSpatialReference:this.view.spatialReference})})}createInteractiveEditSession(e){return f(this._attributeEditingContext,e)}_createLayerGraphic(e){return new t({attributes:e,layer:this.layer,sourceLayer:this.layer,origin:this._graphicOrigin})}getFilters(){const e=super.getFilters();this.i3sOverrides.is3DOFL&&this.i3sOverrides.sortedGeometryChangedObjectIds.length>0&&e.push((e,t)=>{t.node.index>=0&&x(this.i3sOverrides.sortedGeometryChangedObjectIds,!1,e)});const t=this._setVisibilityHiddenObjectIdsSorted;null!=t&&e.push(e=>x(t,!1,e));const i=this._excludeObjectIdsSorted;return null!=i&&e.push(e=>x(i,!1,e)),this._floorFilterClause&&this.addSqlFilter(e,this._floorFilterClause,this.logError),this.addSqlFilter(e,this.parsedDefinitionExpression,this.logError),null!=this.viewFilter&&this.viewFilter.addFilters(e,this.view,this._controller.crsIndex,this._collection),e}setVisibility(e,t){t?this._setVisibilityHiddenObjectIds.delete(e):this._setVisibilityHiddenObjectIds.add(e)}isUpdating(){return super.isUpdating()||!!this._fieldsHelper?.updating||this.layerFilterUpdating||null!=this.viewFilter&&this.viewFilter.updating||null!=this.i3sOverrides&&this.i3sOverrides.updating}_ensureQuery(e){return this._validateQuery(this._addDefinitionExpressionToQuery(null==e?this.createQuery():p.from(e)))}_validateQuery(e){return e.outSpatialReference&&!e.outSpatialReference.equals(this.view.spatialReference)&&(i.getLogger(this).warn("query: outSpatialReference different from the view's spatial reference is not supported"),e.outSpatialReference=this.view.spatialReference),e.returnGeometry&&(e.returnZ=!0),e.returnCentroid=!1,e}get _attributeEditingContext(){return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:this._getObjectIdField(),globalIdField:this._getGlobalIdField(),forEachNode:e=>this._forAllNodes(t=>null!=t?e(t.node,t.featureIds):null),attributeStorageInfo:this.layer.attributeStorageInfo??[],i3sOverrides:this.i3sOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(e,t)=>this.setAttributeData(e,t),clearMemCache:()=>this.clearMemCache()}}async _handleEdits(e){const t=this._attributeEditingContext,i=await m(t,e);_(t,i),F(t,i)}get hasGeometryFilter(){return null!=this.viewFilter?.parsedGeometry}computeNodeFiltering(e){const t=this.viewFilter;return null==t||!this.view.spatialReference||t.isMBSGeometryVisible(e,this.view.spatialReference,this._controller.crsIndex)?0:1}};e([o(L)],M.prototype,"updatingProgress",void 0),e([o({type:u})],M.prototype,"filter",null),e([o({readOnly:!0})],M.prototype,"viewFilter",void 0),e([o(P.requiredFields)],M.prototype,"requiredFields",null),e([o(P.availableFields)],M.prototype,"availableFields",void 0),e([o()],M.prototype,"_fieldsHelper",void 0),e([o()],M.prototype,"_floorFilterClause",null),e([o()],M.prototype,"_excludeObjectIdsSorted",null),e([o()],M.prototype,"_setVisibilityHiddenObjectIds",void 0),e([o()],M.prototype,"_setVisibilityHiddenObjectIdsSorted",null),e([o()],M.prototype,"lodFactor",null),e([o()],M.prototype,"updatingProgressValue",null),e([o({readOnly:!0})],M.prototype,"visibleAtCurrentScale",null),e([o()],M.prototype,"_graphicOrigin",null),M=e([a("esri.views.3d.layers.SceneLayerView3D")],M);const T=M;export{T as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import i from"../../../core/Logger.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{throwIfAborted as s}from"../../../core/promiseUtils.js";import l from"../../../core/ReactiveSet.js";import{initial as n}from"../../../core/reactiveUtils.js";import{property as o,subclass as a}from"../../../core/accessorSupport/decorators.js";import d from"../../../core/sql/WhereClause.js";import u from"../../../layers/support/FeatureFilter.js";import{getFloorFilterClause as h}from"../../../layers/support/floorFilterUtils.js";import p from"../../../rest/support/Query.js";import{isNumber as c}from"../../../support/guards.js";import{I3SMeshView3D as y}from"./I3SMeshView3D.js";import{LayerView3D as g}from"./LayerView3D.js";import{createInteractiveEditSession as f,normalizeEditResultsEvent as m,processGeometryEdits as _,processAttributeEdits as F}from"./i3s/featureEditing.js";import{createGetFeatureExtent as v}from"./i3s/I3SGeometryUtil.js";import{I3SMeshViewFilter as w}from"./i3s/I3SMeshViewFilter.js";import{I3SOverrides as b}from"./i3s/I3SOverrides.js";import{I3SQueryEngine as j}from"./i3s/I3SQueryEngine.js";import{I3SQueryFeatureAdapter as I,I3SQueryFeature as S}from"./i3s/I3SQueryFeatureAdapter.js";import{I3SQueryFeatureStore as E}from"./i3s/I3SQueryFeatureStore.js";import{checkRecyclable as O,getIndexCrs as H,objectIdFilter as x}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as C}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as Q}from"./support/fieldProperties.js";import{PopupSceneLayerView as V}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as R}from"./support/SceneLayerViewRequiredFields.js";import{TemporalSceneLayerView as q}from"./support/TemporalSceneLayerView.js";import{updatingProgress as L}from"../support/updatingProperties.js";import A from"../../layers/SceneLayerView.js";import{hasPopupTemplate as D}from"../../layers/support/popupUtils.js";import{isInEffectiveScaleRange as G}from"../../support/layerViewUtils.js";import{TaskPriority as U}from"../../support/Scheduler.js";const P=Q();let M=class extends(y(q(C(V(g(A)))))){constructor(){super(...arguments),this.type="scene-layer-3d",this.viewFilter=null,this._setVisibilityHiddenObjectIds=new l,this.progressiveLoadFactor=1,this._elevationContext=2,this._supportsLabeling=!0,this._pendingEditsQueue=Promise.resolve(),this._interactiveEditingSessions=new Map,this._queryEngine=null}tryRecycleWith(e,t){return e.url===this.layer.url&&this.i3sOverrides.isEmpty?e.load(t).then(()=>{s(t),O(this.layer,e,this.i3sOverrides),this.layer=e,this.i3sOverrides.destroy();const i=this.view.resourceController?.memoryController;this.i3sOverrides=new b({view:this.view,layer:e,memoryController:i,extractChanges:this.extractChanges}),this.resetHighlights()}):null}get layerPopupEnabledAndHasTemplate(){return this.layer.popupEnabled&&D(this.layer,this.view.popup?.defaultPopupTemplateEnabled)}get filter(){return this._get("filter")}set filter(e){this._set("filter",w.checkSupport(e)?e:null)}get requiredFields(){return this._fieldsHelper?.requiredFields??[]}get _floorFilterClause(){const e=h(this);return null!=e?d.create(e,{fieldsIndex:this.layer.fieldsIndex}):null}get _excludeObjectIdsSorted(){const e=this.layer.excludeObjectIds.toArray();return e.length?e.sort((e,t)=>e-t):null}get _setVisibilityHiddenObjectIdsSorted(){return this._setVisibilityHiddenObjectIds.size?Array.from(this._setVisibilityHiddenObjectIds).sort((e,t)=>e-t):null}get lodFactor(){return this.view?.qualitySettings?.sceneService?.objectLoDFactor??1}get lodCrossfadeUncoveredDuration(){return this.view?.qualitySettings?.fadeDuration??0}get updatingProgressValue(){return this._controller?.updatingProgress??0}get visibleAtCurrentScale(){return G(this.layer.effectiveScaleRange,this.view.scale)}get _graphicOrigin(){return this.layer.graphicOrigin}initialize(){this._fieldsHelper=new R({layerView:this}),this._updatingHandles.add(()=>this.layer.rangeInfos,e=>this._rangeInfosChanged(e),n),this._updatingHandles.add(()=>this.layer.renderer,e=>this._updatingHandles.addPromise(this._rendererChange(e)),n);const e=()=>this._filterChange();this._updatingHandles.add(()=>this.parsedDefinitionExpression,e),this._updatingHandles.add(()=>this.mergedFilter,e),this._updatingHandles.add(()=>this._floorFilterClause,e),this._updatingHandles.add(()=>this._excludeObjectIdsSorted,e),this._updatingHandles.add(()=>this._setVisibilityHiddenObjectIdsSorted,e),this._updatingHandles.add(()=>this.viewFilter?.sortedObjectIds,e),this._updatingHandles.add(()=>this.viewFilter?.parsedWhereClause,e),this._updatingHandles.add(()=>this.getTimeFilterDependencies(),e),this._updatingHandles.add(()=>[this.viewFilter?.parsedGeometry,this.mergedFilter?.spatialRelationship,this.layer.filter?.spatialRelationship],()=>this._geometryFilterChange()),this._updatingHandles.add(()=>({layerViewFilter:this.mergedFilter,layerFilter:this.layerFilter}),({layerViewFilter:e,layerFilter:t})=>{if(null==e&&null==t)return void this._set("viewFilter",null);const i=this.viewFilter;if(i)return i.viewFilter=e,i.layerFilter=t,void this._filterChange();this._set("viewFilter",new w({layerFilter:t,viewFilter:e,layerFieldsIndex:this.layer.fieldsIndex,loadAsyncModule:e=>this._loadAsyncModule(e),addSqlFilter:(e,t)=>this.addSqlFilter(e,t,this.logError),addTimeFilter:(e,t)=>this.addTimeFilter(e,t)}))},n),this.i3sOverrides.is3DOFL&&this._updatingHandles.add(()=>this.i3sOverrides.sortedGeometryChangedObjectIds,e),this.addHandles(this.layer.on("apply-edits",e=>this._updatingHandles.addPromise(e.result))),this.addHandles(this.layer.on("edits",e=>{const t=this._pendingEditsQueue.then(()=>this._handleEdits(e)).then();this._pendingEditsQueue=t,this._updatingHandles.consumePromise(t)}))}destroy(){this._fieldsHelper=r(this._fieldsHelper)}_rangeInfosChanged(e){null!=e&&e.length>0&&i.getLogger(this).warn("Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.")}createQuery(){const e={outFields:["*"],returnGeometry:!0,returnZ:!0,outSpatialReference:this.view.spatialReference};return this.mergedFilter?.createQuery(e)??new p(e)}queryExtent(e,t){return this._ensureQueryEngine().executeQueryForExtent(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this._ensureQueryEngine().executeQueryForCount(this._ensureQuery(e),t?.signal)}queryFeatures(e,t){return this._ensureQueryEngine().executeQuery(this._ensureQuery(e),t?.signal).then(e=>{if(!e?.features)return e;const t=this.layer,i=this._graphicOrigin;for(const r of e.features)r.layer=t,r.sourceLayer=t,r.origin=i;return e})}async queryObjectIds(e,t){return(await this._ensureQueryEngine().executeQueryForIds(this._ensureQuery(e),t?.signal)).filter(c)}_ensureQueryEngine(){return this._queryEngine??=this._createQueryEngine(),this._queryEngine}_createQueryEngine(){const e=v(this.view.spatialReference,this.view.renderSpatialReference,this._collection);return new j({layerView:this,priority:U.FEATURE_QUERY_ENGINE,spatialIndex:new E({featureAdapter:new I({objectIdField:this.layer.objectIdField,attributeStorageInfo:this.layer.attributeStorageInfo??[],getFeatureExtent:e}),forAllFeatures:(e,t)=>this._forAllFeatures((t,i,r)=>e(new S(t,i,r)),t,2),getFeatureExtent:e,sourceSpatialReference:H(this.layer),viewSpatialReference:this.view.spatialReference})})}createInteractiveEditSession(e){return f(this._attributeEditingContext,e)}_createLayerGraphic(e){return new t({attributes:e,layer:this.layer,sourceLayer:this.layer,origin:this._graphicOrigin})}getFilters(){const e=super.getFilters();this.i3sOverrides.is3DOFL&&this.i3sOverrides.sortedGeometryChangedObjectIds.length>0&&e.push((e,t)=>{t.node.index>=0&&x(this.i3sOverrides.sortedGeometryChangedObjectIds,!1,e)});const t=this._setVisibilityHiddenObjectIdsSorted;null!=t&&e.push(e=>x(t,!1,e));const i=this._excludeObjectIdsSorted;return null!=i&&e.push(e=>x(i,!1,e)),this._floorFilterClause&&this.addSqlFilter(e,this._floorFilterClause,this.logError),this.addSqlFilter(e,this.parsedDefinitionExpression,this.logError),null!=this.viewFilter&&this.viewFilter.addFilters(e,this.view,this._controller.crsIndex,this._collection),e}setVisibility(e,t){t?this._setVisibilityHiddenObjectIds.delete(e):this._setVisibilityHiddenObjectIds.add(e)}isUpdating(){return super.isUpdating()||!!this._fieldsHelper?.updating||this.layerFilterUpdating||null!=this.viewFilter&&this.viewFilter.updating||null!=this.i3sOverrides&&this.i3sOverrides.updating}_ensureQuery(e){return this._validateQuery(this._addDefinitionExpressionToQuery(null==e?this.createQuery():p.from(e)))}_validateQuery(e){return e.outSpatialReference&&!e.outSpatialReference.equals(this.view.spatialReference)&&(i.getLogger(this).warn("query: outSpatialReference different from the view's spatial reference is not supported"),e.outSpatialReference=this.view.spatialReference),e.returnGeometry&&(e.returnZ=!0),e.returnCentroid=!1,e}get _attributeEditingContext(){return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:this._getObjectIdField(),globalIdField:this._getGlobalIdField(),forEachNode:e=>this._forAllNodes(t=>null!=t?e(t.node,t.featureIds):null),attributeStorageInfo:this.layer.attributeStorageInfo??[],i3sOverrides:this.i3sOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(e,t)=>this.setAttributeData(e,t),clearMemCache:()=>this.clearMemCache()}}async _handleEdits(e){const t=this._attributeEditingContext,i=await m(t,e);_(t,i),F(t,i)}get hasGeometryFilter(){return null!=this.viewFilter?.parsedGeometry}computeNodeFiltering(e){const t=this.viewFilter;return null==t||!this.view.spatialReference||t.isMBSGeometryVisible(e,this.view.spatialReference,this._controller.crsIndex)?0:1}};e([o(L)],M.prototype,"updatingProgress",void 0),e([o({type:u})],M.prototype,"filter",null),e([o({readOnly:!0})],M.prototype,"viewFilter",void 0),e([o(P.requiredFields)],M.prototype,"requiredFields",null),e([o(P.availableFields)],M.prototype,"availableFields",void 0),e([o()],M.prototype,"_fieldsHelper",void 0),e([o()],M.prototype,"_floorFilterClause",null),e([o()],M.prototype,"_excludeObjectIdsSorted",null),e([o()],M.prototype,"_setVisibilityHiddenObjectIds",void 0),e([o()],M.prototype,"_setVisibilityHiddenObjectIdsSorted",null),e([o()],M.prototype,"lodFactor",null),e([o()],M.prototype,"updatingProgressValue",null),e([o({readOnly:!0})],M.prototype,"visibleAtCurrentScale",null),e([o()],M.prototype,"_graphicOrigin",null),M=e([a("esri.views.3d.layers.SceneLayerView3D")],M);const T=M;export{T as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../request.js";import r from"../../../../core/Accessor.js";import{splitIntoChunks as s}from"../../../../core/arrayUtils.js";import{createTask as i,resultOrAbort as n,result as o}from"../../../../core/asyncUtils.js";import a from"../../../../core/Collection.js";import{makeHandle as d}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import c from"../../../../core/Logger.js";import{abortMaybe as h,destroyMaybe as l}from"../../../../core/maybe.js";import{estimateNumberMemory as u,estimateStringMemory as m}from"../../../../core/memoryEstimations.js";import{whenOrAbort as g}from"../../../../core/promiseUtils.js";import p from"../../../../core/ReactiveSet.js";import{watch as y,sync as f}from"../../../../core/reactiveUtils.js";import{property as _,subclass as b}from"../../../../core/accessorSupport/decorators.js";import{equals as v}from"../../../../geometry/support/spatialReferenceUtils.js";import{formatNumber as O}from"../../../../intl/number.js";import{getMaximumQuerySize as j,queryAllJSON as C}from"../../../../layers/support/featureQueryAll.js";let w=class extends r{constructor(e){super(e),this._warnMaximumChangedObjectsExceeded=!1,this._maximumNumberOfEditOVerrides=G,this._definitionExpressionDirty=!0,this._interactiveEditingSessions=new a,this.geometryOverrides=new a,this._clientGeometryCache=new Map,this._attributeChangedObjectIds=new p,this._geometryChangedObjectIds=new p,this._pendingFetchChangedObjectIds=null,this._pendingFetchAbortController=new AbortController,this._applyGeometryOverridesTask=null,this._featureIdLocks=new Map}initialize(){this._memCache=new F(this.memoryController.newCache(`i3s-attribute-overrides-${this.layer.uid}`)),this.addHandles(y(()=>this.layer.definitionExpression,async()=>{this._definitionExpressionDirty=!0,this._pendingFetchChangedObjectIds||(this._applyGeometryOverridesTask=h(this._applyGeometryOverridesTask),this._applyGeometryOverridesTask=i(e=>this._queryAndAddGeometryOverrides(e)),await this._applyGeometryOverridesTask.promise.catch(()=>{}))},f)),this._pendingFetchChangedObjectIds=this._fetchChangedObjectIds(this._pendingFetchAbortController?.signal),this._pendingFetchChangedObjectIds.finally(()=>{this._pendingFetchAbortController=null,this._pendingFetchChangedObjectIds=null}).catch(()=>{})}destroy(){this._set("layer",null),this._memCache=l(this._memCache),this._pendingFetchAbortController=h(this._pendingFetchAbortController),this._pendingFetchChangedObjectIds=null,this._featureIdLocks.clear()}get is3DOFL(){return null!=this._associatedLayer?.infoFor3D}get sortedGeometryChangedObjectIds(){return this.is3DOFL?[...this._geometryChangedObjectIds].sort((e,t)=>e-t):[]}get _associatedLayer(){return null==this.layer?null:this.layer.associatedLayer}get hasGeometryChanges(){return this._geometryChangedObjectIds.size>0}get updating(){return!!this.is3DOFL&&!!(this._pendingFetchChangedObjectIds||this._applyGeometryOverridesTask&&!this._applyGeometryOverridesTask.finished)}get isEmpty(){return null==this._pendingFetchChangedObjectIds&&0===this._attributeChangedObjectIds.size&&0===this._geometryChangedObjectIds.size}featureHasGeometryChanges(e){return this._geometryChangedObjectIds.has(e)}featureHasAttributeChanges(e){return this._attributeChangedObjectIds.has(e)}createInteractiveEditSession(e){this._attributeChangedObjectIds.add(e);const t=this._interactiveEditingSessions,r=new I(e,()=>{t.remove(r)});return t.unshift(r),r}async applyAttributeOverrides(e,t,r,s=[]){if(this._pendingFetchChangedObjectIds&&await g(this._pendingFetchChangedObjectIds,r),null==t)return;const{attributeData:i,loadedAttributes:n}=t;if(null==n||null==i||0===this._attributeChangedObjectIds.size)return;const o=new Set;for(const d of n)o.add(d.index);for(const d of s)o.has(d.index)||(n.push(d),i[d.name]=new Array(e.length));const a=await this._lockFeatureIds(e);try{const t={attributeData:i,loadedAttributes:n},s=this._getOverridesFromCache(e,t,this._attributeChangedObjectIds),{objectIds:o,fieldNames:a}=s;if(0===o.length||0===a.length)return;const d=await this._queryAttributeOverridesFromAssociatedLayer(o,a,r);if(null==d)return;this._processOverridesFromAssociatedLayer(e,d,a,t)}finally{a.remove()}}updateGeometry(e,t){this._geometryChangedObjectIds.add(e);const r=this._clientGeometryCache.get(e);if(null!=r&&(this.geometryOverrides.remove(r),this._clientGeometryCache.delete(e)),null!=t){const r={oid:e,mesh:t};this.geometryOverrides.add(r),this._clientGeometryCache.set(e,r)}}updateAttributeValue(e,t,r){this._attributeChangedObjectIds.add(e),this._cacheAttributeValue(e,t,r)}featureAdded(e){this.is3DOFL&&this._geometryChangedObjectIds.add(e),this._attributeChangedObjectIds.add(e)}_cacheAttributeValue(e,t,r){this._memCache.put(e,t,r)}_getOverridesFromCache(e,{loadedAttributes:t,attributeData:r},s){const i=new Array;for(const a of t)i[a.index]=r[a.name];const n=new Set,o=new Set;for(let a=0;a<e.length;a++){const r=e[a];if(s.has(r))for(const e of t){const t=this._attributeFromCache(r,e.index);void 0===t?(n.add(r),o.add(e.name)):i[e.index][a]=t}}return{objectIds:Array.from(n),fieldNames:Array.from(o)}}_attributeFromCache(e,t){const r=this._fromInteractiveEditingSession(e,t);return void 0!==r?r:this._memCache.get(e,t)}_fromInteractiveEditingSession(e,t){if(null!=this._interactiveEditingSessions)for(const r of this._interactiveEditingSessions){if(r.objectId!==e)continue;const s=r.getAttribute(t);if(void 0!==s)return s}}async _queryAttributeOverridesFromAssociatedLayer(e,t,r){if(0===e.length)return null;this._logWarningIfMaximumObjectsExceeded();const{associatedLayer:s}=this.layer;if(null==s)return null;const i=s.createQuery(),{objectIdField:n}=s,o=[n,...t];i.where=this.layer.definitionExpression||"1=1",i.returnGeometry=!1,i.outFields=o,i.cacheHint=!0;const a=await this._executeBatchQuery(s,e,i,r),d=[];for(const c of a)if(c.ok)for(const e of c.value.features)d.push(e);return d}async _queryGeometryOverridesFromAssociatedLayer(e,t){if(0===e.length||!this.is3DOFL)return null;const r=this.layer.associatedLayer,s=r.infoFor3D,{spatialReference:i}=r,{state:{viewingMode:n},spatialReference:o}=this.view,a=1===n,d=i.isGeographic;if(a&&!d)return c.getLogger(this).warn("unsupported-pcs-edits-in-global-view",this.layer.title,L(i,o,this.view.viewingMode,0)),null;if(!a&&d)return c.getLogger(this).warn("unsupported-gcs-edits-in-local-view",this.layer.title,L(i,o,this.view.viewingMode,0)),null;if(!(v(i,o)||a&&o.isWebMercator&&i.isWGS84))return c.getLogger(this).warn("unsupported-mismatched-spatial-reference-edits",this.layer.title,L(i,o,this.view.viewingMode,1)),null;this._logWarningIfMaximumObjectsExceeded();const{objectIdField:h,globalIdField:l}=r,u=[h,...null!=l?[l]:[]],m=r.createQuery();m.where=this.layer.definitionExpression||"1=1",m.returnGeometry=!0,m.outFields=u,m.cacheHint=!0,m.returnZ=r.hasZ,m.returnM=r.hasM;const{assetMapFromAssetMapsJSON:g,extractMesh:p}=await(import("../../../../rest/support/meshFeatureSet.js")),y=await this._executeBatchQuery(r,e,m,t),f=[];for(const c of y){if(!c.ok)continue;const e=c.value,{assetMaps:t,features:r,globalIdFieldName:n}=e;if(null==t)continue;const o=g(s,t);for(const a of r){const e=p(a,n,i,s,o),t=a;null!=e?(t.geometry=e,f.push(t)):t.geometry=null}}return f}_logWarningIfMaximumObjectsExceeded(){if(!this._warnMaximumChangedObjectsExceeded)return;this._warnMaximumChangedObjectsExceeded=!1;let e=`The number of edited objects that are not yet cached in the scene service exceeds the maximum limit. Attribute changes will only be available for the first ${O(this._maximumNumberOfEditOVerrides)} objects. Please consider re-caching the scene service`;const t=this.layer.portalItem;e+=t?.loaded?` (${t.portal.url}/home/item.html?id=${t.id}#settings)`:` (${this.layer.parsedUrl.path})`,c.getLogger(this).warn("#queryOverrides()",this.layer.title,`${e}.`)}async _executeBatchQuery(e,t,r,i){if(0===t.length)return[];const o=j(e);t=[...t].sort((e,t)=>e-t);const a=s(t,o).map(t=>{const s=r.clone();return s.objectIds=t,n(C(e,s,{signal:i}))});return Promise.all(a)}_processOverridesFromAssociatedLayer(e,t,r,{loadedAttributes:s,attributeData:i}){const n=this._associatedLayer;if(null==n)return;const o=n.objectIdField,a=r.map(t=>(t in i||(i[t]=new Array(e.length)),i[t])),d=new Map(s.map(e=>[e.name,e.index])),c=r.map(e=>d.get(e)),h=new Map(Array.from(e,(e,t)=>[e,t]));for(const l of t){const e=l.attributes[o];for(let t=0;t<r.length;t++){const s=c[t],i=h.get(e),n=l.attributes[r[t]];a[t][i]=n,this._cacheAttributeValue(e,s,n)}}}async _fetchChangedObjectIds(e){const r=this.layer;await r.load({signal:e}),this._geometryChangedObjectIds.clear(),this._attributeChangedObjectIds.clear();const{associatedLayer:s}=r;if(null==s||!s.capabilities?.operations?.supportsChangeTracking)return;const i=this._getFetchChangedObjectIdsServerGen();if(null==i)return;const n=s.layerId,a=this.is3DOFL,d={...s.customParameters,f:"json",returnIdsOnly:!0,layers:`[${n}]`,returnUpdates:!0,returnDeletes:a,returnInserts:a,layerServerGens:JSON.stringify([{id:n,serverGen:i}])};if(null!=s.apiKey&&(d.token=s.apiKey),a){const e=s.infoFor3D;d.fieldsToCompare=JSON.stringify({fields:[...Object.values(e.transformFieldRoles),e.sourceHashField]})}const h=await o(t(`${s.url}/extractChanges`,{method:"post",query:d,timeout:x,signal:e}));if(!h.ok){const e=this.layer.title;c.getLogger(this).warn("extractChanges:unavailable",e,": could not obtain edited features that are not cached in the scene service. Display of features may not be up to date with the latest edits. Consider re-caching the scene service.")}if(h.ok&&1===h.value.data?.edits?.length){const t=h.value.data.edits[0],r=t?.objectIds,s=t?.fieldUpdates,i=r?.adds??[],n=r?.updates??[],o=r?.deletes??[],d=[...i,...n,...o],c=a?[...i,...s??n,...o]:[],l=Math.min(this._maximumNumberOfEditOVerrides,d.length);l<d.length&&(this._warnMaximumChangedObjectsExceeded=!0);const u=d.sort((e,t)=>e-t);for(let e=0;e<l;++e){const t=u[e];this._attributeChangedObjectIds.add(t)}for(const e of c)this._geometryChangedObjectIds.add(e);for(;this._definitionExpressionDirty;)await this._queryAndAddGeometryOverrides(e)}}async _queryAndAddGeometryOverrides(e){this._definitionExpressionDirty=!1;const t=this.layer,{associatedLayer:r}=t;if(null!=r&&r.capabilities?.operations?.supportsChangeTracking&&this.is3DOFL&&this._geometryChangedObjectIds.size>0){const t=await this._queryGeometryOverridesFromAssociatedLayer(Array.from(this._geometryChangedObjectIds),e);if(null!=t)for(const e of t)null!=e.geometry&&this.updateGeometry(e.attributes[r.objectIdField],e.geometry)}}_getFetchChangedObjectIdsServerGen(){const e=this.layer;if(null!=e.serviceUpdateTimeStamp?.lastUpdate)return e.serviceUpdateTimeStamp.lastUpdate;const t=e.associatedLayer;return null!=t?.serverGens?.minServerGen?t.serverGens.minServerGen:null}async _lockFeatureIds(e){const t=this._featureIdLocks;let r=!0;for(;r;){const s=new Array;for(const r of e){const e=t.get(r);e&&s.push(e)}0===s.length?r=!1:await Promise.all(s)}const s=Promise.withResolvers(),i=s.promise;for(const n of e)t.set(n,i);return d(()=>{for(const r of e)t.delete(r);s.resolve()})}get test(){}};e([_({constructOnly:!0})],w.prototype,"view",void 0),e([_({constructOnly:!0})],w.prototype,"layer",void 0),e([_({readOnly:!0})],w.prototype,"is3DOFL",null),e([_()],w.prototype,"_interactiveEditingSessions",void 0),e([_({readOnly:!0})],w.prototype,"sortedGeometryChangedObjectIds",null),e([_({readOnly:!0})],w.prototype,"geometryOverrides",void 0),e([_()],w.prototype,"_clientGeometryCache",void 0),e([_()],w.prototype,"_associatedLayer",null),e([_({constructOnly:!0})],w.prototype,"memoryController",void 0),e([_()],w.prototype,"_attributeChangedObjectIds",void 0),e([_()],w.prototype,"_geometryChangedObjectIds",void 0),e([_()],w.prototype,"hasGeometryChanges",null),e([_()],w.prototype,"_pendingFetchChangedObjectIds",void 0),e([_()],w.prototype,"_pendingFetchAbortController",void 0),e([_()],w.prototype,"_applyGeometryOverridesTask",void 0),e([_()],w.prototype,"updating",null),e([_()],w.prototype,"isEmpty",null),w=e([b("esri.views.3d.layers.i3s.I3SOverrides")],w);class I{constructor(e,t){this.objectId=e,this._remove=t,this._updates=new Map,this._isActive=!0}getAttribute(e){return this._updates.get(e)}setAttribute(e,t){this.isActive&&this._updates.set(e,t)}remove(){this.isActive&&(this._isActive=!1,this._remove())}get isActive(){return this._isActive}}class F{constructor(e){this._cache=e}destroy(){this._cache.destroy()}put(e,t,r){this._cache.put(this._getKey(e,t),new A(r))}get(e,t){return this._cache.get(this._getKey(e,t))?.value}_getKey(e,t){return`${e}-${t}`}}class A{constructor(e){this.value=e,this.usedMemory="string"==typeof e?m(e):u}}const x=1e4,G=5e4;function L(e,t,r,s){return`Displaying the edits of a SceneLayer with a${0===s?e.isGeographic?" geographic ":" projected ":" "}spatial reference (wkid:${e.wkid}) in ${r} viewing mode${1===s?` with spatial reference (wkid:${t.wkid}) `:" "}is not supported. No geometry edits will be displayed for this layer.\nPlease consider re-caching the scene service or changing the ${0===s?"viewing mode":"view spatial reference"} to display edits.`}export{w as I3SOverrides};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{splitIntoChunks as r}from"../../../../core/arrayUtils.js";import{createTask as s,resultOrAbort as i}from"../../../../core/asyncUtils.js";import n from"../../../../core/Collection.js";import{makeHandle as o}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import a from"../../../../core/Logger.js";import{abortMaybe as d,destroyMaybe as c}from"../../../../core/maybe.js";import{estimateNumberMemory as h,estimateStringMemory as l}from"../../../../core/memoryEstimations.js";import{whenOrAbort as u,throwIfAborted as m}from"../../../../core/promiseUtils.js";import g from"../../../../core/ReactiveSet.js";import{watch as p,sync as y}from"../../../../core/reactiveUtils.js";import{property as f,subclass as _}from"../../../../core/accessorSupport/decorators.js";import{equals as b}from"../../../../geometry/support/spatialReferenceUtils.js";import{formatNumber as v}from"../../../../intl/number.js";import{getMaximumQuerySize as O,queryAllJSON as C}from"../../../../layers/support/featureQueryAll.js";let j=class extends t{constructor(e){super(e),this._warnMaximumChangedObjectsExceeded=!1,this._maximumNumberOfEditOVerrides=F,this._definitionExpressionDirty=!0,this._interactiveEditingSessions=new n,this.geometryOverrides=new n,this._clientGeometryCache=new Map,this._attributeChangedObjectIds=new g,this._geometryChangedObjectIds=new g,this._pendingFetchChangedObjectIds=null,this._pendingFetchAbortController=new AbortController,this._applyGeometryOverridesTask=null,this._featureIdLocks=new Map}initialize(){this._memCache=new I(this.memoryController.newCache(`i3s-attribute-overrides-${this.layer.uid}`)),this.addHandles(p(()=>this.layer.definitionExpression,async()=>{this._definitionExpressionDirty=!0,this._pendingFetchChangedObjectIds||(this._applyGeometryOverridesTask=d(this._applyGeometryOverridesTask),this._applyGeometryOverridesTask=s(e=>this._queryAndAddGeometryOverrides(e)),await this._applyGeometryOverridesTask.promise.catch(()=>{}))},y)),this._pendingFetchChangedObjectIds=this._fetchChangedObjectIds(this._pendingFetchAbortController?.signal),this._pendingFetchChangedObjectIds.finally(()=>{this._pendingFetchAbortController=null,this._pendingFetchChangedObjectIds=null}).catch(()=>{})}destroy(){this._set("layer",null),this._memCache=c(this._memCache),this._pendingFetchAbortController=d(this._pendingFetchAbortController),this._pendingFetchChangedObjectIds=null,this._featureIdLocks.clear()}get is3DOFL(){return null!=this._associatedLayer?.infoFor3D}get sortedGeometryChangedObjectIds(){return this.is3DOFL?[...this._geometryChangedObjectIds].sort((e,t)=>e-t):[]}get _associatedLayer(){return null==this.layer?null:this.layer.associatedLayer}get hasGeometryChanges(){return this._geometryChangedObjectIds.size>0}get updating(){return!!this.is3DOFL&&!!(this._pendingFetchChangedObjectIds||this._applyGeometryOverridesTask&&!this._applyGeometryOverridesTask.finished)}get isEmpty(){return null==this._pendingFetchChangedObjectIds&&0===this._attributeChangedObjectIds.size&&0===this._geometryChangedObjectIds.size}featureHasGeometryChanges(e){return this._geometryChangedObjectIds.has(e)}featureHasAttributeChanges(e){return this._attributeChangedObjectIds.has(e)}createInteractiveEditSession(e){this._attributeChangedObjectIds.add(e);const t=this._interactiveEditingSessions,r=new w(e,()=>{t.remove(r)});return t.unshift(r),r}async applyAttributeOverrides(e,t,r,s=[]){if(this._pendingFetchChangedObjectIds&&await u(this._pendingFetchChangedObjectIds,r),null==t)return;const{attributeData:i,loadedAttributes:n}=t;if(null==n||null==i||0===this._attributeChangedObjectIds.size)return;const o=new Set;for(const d of n)o.add(d.index);for(const d of s)o.has(d.index)||(n.push(d),i[d.name]=new Array(e.length));const a=await this._lockFeatureIds(e);try{const t={attributeData:i,loadedAttributes:n},s=this._getOverridesFromCache(e,t,this._attributeChangedObjectIds),{objectIds:o,fieldNames:a}=s;if(0===o.length||0===a.length)return;const d=await this._queryAttributeOverridesFromAssociatedLayer(o,a,r);if(null==d)return;this._processOverridesFromAssociatedLayer(e,d,a,t)}finally{a.remove()}}updateGeometry(e,t){this._geometryChangedObjectIds.add(e);const r=this._clientGeometryCache.get(e);if(null!=r&&(this.geometryOverrides.remove(r),this._clientGeometryCache.delete(e)),null!=t){const r={oid:e,mesh:t};this.geometryOverrides.add(r),this._clientGeometryCache.set(e,r)}}updateAttributeValue(e,t,r){this._attributeChangedObjectIds.add(e),this._cacheAttributeValue(e,t,r)}featureAdded(e){this.is3DOFL&&this._geometryChangedObjectIds.add(e),this._attributeChangedObjectIds.add(e)}_cacheAttributeValue(e,t,r){this._memCache.put(e,t,r)}_getOverridesFromCache(e,{loadedAttributes:t,attributeData:r},s){const i=new Array;for(const a of t)i[a.index]=r[a.name];const n=new Set,o=new Set;for(let a=0;a<e.length;a++){const r=e[a];if(s.has(r))for(const e of t){const t=this._attributeFromCache(r,e.index);void 0===t?(n.add(r),o.add(e.name)):i[e.index][a]=t}}return{objectIds:Array.from(n),fieldNames:Array.from(o)}}_attributeFromCache(e,t){const r=this._fromInteractiveEditingSession(e,t);return void 0!==r?r:this._memCache.get(e,t)}_fromInteractiveEditingSession(e,t){if(null!=this._interactiveEditingSessions)for(const r of this._interactiveEditingSessions){if(r.objectId!==e)continue;const s=r.getAttribute(t);if(void 0!==s)return s}}async _queryAttributeOverridesFromAssociatedLayer(e,t,r){if(0===e.length)return null;this._logWarningIfMaximumObjectsExceeded();const{associatedLayer:s}=this.layer;if(null==s)return null;const i=s.createQuery(),{objectIdField:n}=s,o=[n,...t];i.where=this.layer.definitionExpression||"1=1",i.returnGeometry=!1,i.outFields=o,i.cacheHint=!0;const a=await this._executeBatchQuery(s,e,i,r),d=[];for(const c of a)if(c.ok)for(const e of c.value.features)d.push(e);return d}async _queryGeometryOverridesFromAssociatedLayer(e,t){if(0===e.length||!this.is3DOFL)return null;const r=this.layer.associatedLayer,s=r.infoFor3D,{spatialReference:i}=r;if(this.view){const{state:{viewingMode:e},spatialReference:t}=this.view,r=1===e,s=i.isGeographic;if(r&&!s)return a.getLogger(this).warn("unsupported-pcs-edits-in-global-view",this.layer.title,x(i,t,this.view.viewingMode,0)),null;if(!r&&s)return a.getLogger(this).warn("unsupported-gcs-edits-in-local-view",this.layer.title,x(i,t,this.view.viewingMode,0)),null;if(!(b(i,t)||r&&t.isWebMercator&&i.isWGS84))return a.getLogger(this).warn("unsupported-mismatched-spatial-reference-edits",this.layer.title,x(i,t,this.view.viewingMode,1)),null}this._logWarningIfMaximumObjectsExceeded();const{objectIdField:n,globalIdField:o}=r,d=[n,...null!=o?[o]:[]],c=r.createQuery();c.where=this.layer.definitionExpression||"1=1",c.returnGeometry=!0,c.outFields=d,c.cacheHint=!0,c.returnZ=r.hasZ,c.returnM=r.hasM;const{assetMapFromAssetMapsJSON:h,extractMesh:l}=await(import("../../../../rest/support/meshFeatureSet.js")),u=await this._executeBatchQuery(r,e,c,t),m=[];for(const a of u){if(!a.ok)continue;const e=a.value,{assetMaps:t,features:r,globalIdFieldName:n}=e;if(null==t)continue;const o=h(s,t);for(const a of r){const e=l(a,n,i,s,o),t=a;null!=e?(t.geometry=e,m.push(t)):t.geometry=null}}return m}_logWarningIfMaximumObjectsExceeded(){if(!this._warnMaximumChangedObjectsExceeded)return;this._warnMaximumChangedObjectsExceeded=!1;let e=`The number of edited objects that are not yet cached in the scene service exceeds the maximum limit. Attribute changes will only be available for the first ${v(this._maximumNumberOfEditOVerrides)} objects. Please consider re-caching the scene service`;const t=this.layer.portalItem;e+=t?.loaded?` (${t.portal.url}/home/item.html?id=${t.id}#settings)`:` (${this.layer.parsedUrl.path})`,a.getLogger(this).warn("#queryOverrides()",this.layer.title,`${e}.`)}async _executeBatchQuery(e,t,s,n){if(0===t.length)return[];const o=O(e);t=[...t].sort((e,t)=>e-t);const a=r(t,o).map(t=>{const r=s.clone();return r.objectIds=t,i(C(e,r,{signal:n}))});return Promise.all(a)}_processOverridesFromAssociatedLayer(e,t,r,{loadedAttributes:s,attributeData:i}){const n=this._associatedLayer;if(null==n)return;const o=n.objectIdField,a=r.map(t=>(t in i||(i[t]=new Array(e.length)),i[t])),d=new Map(s.map(e=>[e.name,e.index])),c=r.map(e=>d.get(e)),h=new Map(Array.from(e,(e,t)=>[e,t]));for(const l of t){const e=l.attributes[o];for(let t=0;t<r.length;t++){const s=c[t],i=h.get(e),n=l.attributes[r[t]];a[t][i]=n,this._cacheAttributeValue(e,s,n)}}}async _fetchChangedObjectIds(e){const t=this.layer;await t.load({signal:e}),this._geometryChangedObjectIds.clear(),this._attributeChangedObjectIds.clear();const{associatedLayer:r}=t;if(null==r)return;if(await r.load({signal:e}),!r.capabilities?.operations?.supportsChangeTracking)return;const s=this._getFetchChangedObjectIdsServerGen();if(null==s)return;const i=await this.extractChanges.fetch(r,{serverGen:s,returnGeometryChanges:this.is3DOFL,signal:e});if(m(e),null!=i)for(this._setChangedObjectIds(i);this._definitionExpressionDirty;)await this._queryAndAddGeometryOverrides(e)}_setChangedObjectIds(e){const{attributeChangedObjectIds:t,geometryChangedObjectIds:r}=e,s=Math.min(this._maximumNumberOfEditOVerrides,t.length);s<t.length&&(this._warnMaximumChangedObjectsExceeded=!0);const i=t.sort((e,t)=>e-t);for(let n=0;n<s;++n){const e=i[n];this._attributeChangedObjectIds.add(e)}for(const n of r)this._geometryChangedObjectIds.add(n)}async _queryAndAddGeometryOverrides(e){this._definitionExpressionDirty=!1;const t=this.layer,{associatedLayer:r}=t;if(null!=r&&r.capabilities?.operations?.supportsChangeTracking&&this.is3DOFL&&this._geometryChangedObjectIds.size>0){const t=await this._queryGeometryOverridesFromAssociatedLayer(Array.from(this._geometryChangedObjectIds),e);if(null!=t)for(const e of t)null!=e.geometry&&this.updateGeometry(e.attributes[r.objectIdField],e.geometry)}}_getFetchChangedObjectIdsServerGen(){const e=this.layer;if(null!=e.serviceUpdateTimeStamp?.lastUpdate)return e.serviceUpdateTimeStamp.lastUpdate;const t=e.associatedLayer;return null!=t?.serverGens?.minServerGen?t.serverGens.minServerGen:null}async _lockFeatureIds(e){const t=this._featureIdLocks;let r=!0;for(;r;){const s=new Array;for(const r of e){const e=t.get(r);e&&s.push(e)}0===s.length?r=!1:await Promise.all(s)}const s=Promise.withResolvers(),i=s.promise;for(const n of e)t.set(n,i);return o(()=>{for(const r of e)t.delete(r);s.resolve()})}get test(){}};e([f({constructOnly:!0})],j.prototype,"view",void 0),e([f({constructOnly:!0})],j.prototype,"layer",void 0),e([f({constructOnly:!0})],j.prototype,"extractChanges",void 0),e([f({readOnly:!0})],j.prototype,"is3DOFL",null),e([f()],j.prototype,"_interactiveEditingSessions",void 0),e([f({readOnly:!0})],j.prototype,"sortedGeometryChangedObjectIds",null),e([f({readOnly:!0})],j.prototype,"geometryOverrides",void 0),e([f()],j.prototype,"_clientGeometryCache",void 0),e([f()],j.prototype,"_associatedLayer",null),e([f({constructOnly:!0})],j.prototype,"memoryController",void 0),e([f()],j.prototype,"_attributeChangedObjectIds",void 0),e([f()],j.prototype,"_geometryChangedObjectIds",void 0),e([f()],j.prototype,"hasGeometryChanges",null),e([f()],j.prototype,"_pendingFetchChangedObjectIds",void 0),e([f()],j.prototype,"_pendingFetchAbortController",void 0),e([f()],j.prototype,"_applyGeometryOverridesTask",void 0),e([f()],j.prototype,"updating",null),e([f()],j.prototype,"isEmpty",null),j=e([_("esri.views.3d.layers.i3s.I3SOverrides")],j);class w{constructor(e,t){this.objectId=e,this._remove=t,this._updates=new Map,this._isActive=!0}getAttribute(e){return this._updates.get(e)}setAttribute(e,t){this.isActive&&this._updates.set(e,t)}remove(){this.isActive&&(this._isActive=!1,this._remove())}get isActive(){return this._isActive}}class I{constructor(e){this._cache=e}destroy(){this._cache.destroy()}put(e,t,r){this._cache.put(this._getKey(e,t),new A(r))}get(e,t){return this._cache.get(this._getKey(e,t))?.value}_getKey(e,t){return`${e}-${t}`}}class A{constructor(e){this.value=e,this.usedMemory="string"==typeof e?l(e):h}}const F=5e4;function x(e,t,r,s){return`Displaying the edits of a SceneLayer with a${0===s?e.isGeographic?" geographic ":" projected ":" "}spatial reference (wkid:${e.wkid}) in ${r} viewing mode${1===s?` with spatial reference (wkid:${t.wkid}) `:" "}is not supported. No geometry edits will be displayed for this layer.\nPlease consider re-caching the scene service or changing the ${0===s?"viewing mode":"view spatial reference"} to display edits.`}export{j as I3SOverrides};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{cyclicalPI as i}from"../../../../core/Cyclical.js";import{deg2rad as e}from"../../../../core/mathUtils.js";import{createScreenPointArray as n,screenPointObjectToArray as s}from"../../../../core/screenUtils.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{copy as a,distance as h}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{copy as m,negate as c,length as _,subtract as p,normalize as l,add as u,scale as d,dot as P}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 S}from"../../../../geometry/ellipsoidUtils.js";import{wrapAxisAngle as v}from"../../../../geometry/support/axisAngle.js";import{create as C,fromPositionAndNormal as w,getNormal as b}from"../../../../geometry/support/plane.js";import{Sphere as M}from"../../../../geometry/support/sphere.js";import{pixelDistanceToInteractionFactor as f,applyAll as z}from"../../camera/constraintUtils.js";import{ConstraintOptions as j}from"../../camera/constraintUtils/ConstraintOptions.js";import{ExponentialFalloff as E}from"../../input/util.js";import{InteractiveController as A}from"./InteractiveController.js";import{PanPlanarMomentumController as k}from"./momentum/PanPlanarMomentumController.js";import{PanSphericalMomentumController as y}from"./momentum/PanSphericalMomentumController.js";import{RotationMomentumController as R}from"./momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as x}from"./momentum/ZoomPlanarMomentumController.js";import{ZoomSphericalMomentumController as O}from"./momentum/ZoomSphericalMomentumController.js";import{inferNavigationMode as H,pickPointAndInitSphere as F,excludeTerrain as Y,sphereOrPlanePointFromScreenPoint as L,maxPanDistanceModifier as T,minPinchAndPanCameraHeight as D,pivotSearchAreaSize as U,intersectPlaneFromScreenPointAtEye as G,applyZoomOnSphere as I,findSphereHorizonY as V,computeHorizonDownLimitScreenY as Z,shouldClampScreenY as q,shouldPreserveHeading as B,applyPanSphericalPreserveHeading as J,applyPanSphericalDirectRotation as K,computeHorizonUpLimitScreenY as N,normalizeRotationDelta as Q,applyRotation as W,applyPanPlanar as X,applyZoomToPoint as $}from"../utils/navigationUtils.js";import tt from"../../webgl/RenderCamera.js";import{PanPlanarMomentumEstimator as it}from"../../../navigation/PanPlanarMomentumEstimator.js";import{PanSphericalMomentumEstimator as et}from"../../../navigation/PanSphericalMomentumEstimator.js";import{RotationMomentumEstimator as nt}from"../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as st}from"../../../navigation/ZoomMomentumEstimator.js";let rt=class extends A{constructor(t){super(t),this.forceHorizontalPan=!1,this._smoothRotation=new E(.05),this._rotationAxis=g(),this._beginAngle=0,this._beginHeading=0,this._panningPlane=C(),this._beginRadius=0,this._smoothScaling=new E(.05),this._zoomCenterScreen=n(),this._zoomMomentumEstimator=new st,this._rotationMomentumEstimator=new nt,this._panSphericalMomentumEstimator=new et,this._panPlanarMomentumEstimator=new it,this._adjustedSphere=new M,this._referenceSphere=new M,this._tmp3d=g(),this._tmpScreenPointArray=n(),this._beginScreenPoint=n(),this._beginScenePoint=g(),this._screenPickPoint=n(),this._clampedScreenPoint=n(),this._scenePickPoint=g(),this._horizonScreenY=null,this._panLimitScreenY=null,this._panLimitFromAbove=!1,this._navigationMode=1,this._sphere=new M,this._pointerCount=0,this._tmpInteractionDirection=g(),this._beginCamera=new tt,this._constraintOptions=new j(15,0,0,this._beginCamera)}get _intersectionHelper(){return this.view.sceneIntersectionHelper}begin(t){if(!this.running)return;this._zoomMomentumEstimator.enabled=this._rotationMomentumEstimator.enabled=this._panPlanarMomentumEstimator.enabled=this._panSphericalMomentumEstimator.enabled=this.view.navigation.momentumEnabled,this._beginHeading=-i.normalize(e(this.view.camera.heading)),this._beginRadius=t.radius,this._beginAngle=t.angle,this._pointerCount=t.pointers.size,this._smoothRotation.reset(),this._referenceSphere.radius=S(this.view.spatialReference).radius,s(t.center,this._screenPickPoint),this.forceHorizontalPan?this._navigationMode=1:this._navigationMode=H(this.startCamera,this._screenPickPoint,this.view.renderCoordsHelper,this.view.viewingMode),1===this._navigationMode&&(this._initClampValues(),a(this._screenPickPoint,this._clampScreenPointToHorizonPaddingRegion(this._screenPickPoint))),a(this._beginScreenPoint,this._screenPickPoint);const n=F(this._intersectionHelper,this.startCamera,this._screenPickPoint,this._referenceSphere.radius,1,this.view.groundView.invisible?Y:{});null!=n.scenePickPoint&&(this._scenePickPoint=n.scenePickPoint,this._sphere=n.sphere,m(this._beginScenePoint,this._scenePickPoint),0===this._navigationMode?this._preparePlanarPanMode(t,n.hasGeometryIntersection):this._prepareSphericalPanMode(),this._beginCamera.copyFrom(this.startCamera))}update(t){if(!this.running)return;this.currentCamera.copyFrom(this.startCamera);const i=t.pointers.size>1;1===this._navigationMode?(i&&this._zoomSpherical(t),this._panningSpherical(t),i&&this._rotateSpherical(t)):(i&&this._zoomPlanar(t),this._panningPlanar(t),i&&this._rotatePlanar(t)),this.commitCamera()}end(t){t.pointers.size===this._pointerCount&&this.update(t),this.finishController();const i=this.view.animationsEnabled&&this._zoomMomentumEstimator.evaluateMomentum();if(i)return 1===this._navigationMode?new O({view:this.view,momentum:i,screenCenter:this._zoomCenterScreen,sceneCenter:this._beginScenePoint,radius:this._sphere.radius}):new x({view:this.view,momentum:i,zoomCenter:this._beginScenePoint});const e=this.view.animationsEnabled&&this._rotationMomentumEstimator.evaluateMomentum();if(e)return new R({view:this.view,momentum:e,center:this._sphere.center,axis:this._rotationAxis});if(1===this._navigationMode){const t=this.view.animationsEnabled&&this._panSphericalMomentumEstimator.evaluateMomentum();if(t)return new y({view:this.view,momentum:t})}else{const t=this.view.animationsEnabled&&this._panPlanarMomentumEstimator.evaluateMomentum();if(t)return new k({view:this.view,momentum:t})}return null}_preparePlanarPanMode(t,i){const e=c(this._tmp3d,this.startCamera.viewForward);w(this._scenePickPoint,e,this._panningPlane);const r=n(this._screenPickPoint[0],0),o=g(),a=_(this.startCamera.eye);this._adjustedSphere.radius=a<this._sphere.radius?a-100:this._sphere.radius,L(this._adjustedSphere,this.startCamera,r,o);const h=g(),S=g(),v=g();p(h,this._scenePickPoint,this.currentCamera.eye);const C=_(h);l(h,h);const M=T*Math.max(Math.abs(this.view.camera.position.z),D),f=this.view.stage.renderView.getMinimalDepthForArea(null,this._screenPickPoint[0],this._screenPickPoint[1],this.view.state.camera,U);let z=null!=f?f:M;i&&(z=Math.min(z,C)),m(v,u(S,this.currentCamera.eye,d(S,h,z))),this._panningPlane[3]=-P(b(this._panningPlane),v),this.startCamera.center=u(S,this.startCamera.eye,d(S,this.startCamera.viewForward,z));const j=s(t.center,this._tmpScreenPointArray);G(this._panningPlane,this.startCamera,j,this._beginScenePoint)}_zoomSpherical(t){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._smoothScaling.gain=e,this._smoothScaling.update(i),I(this._sphere,this.currentCamera,this._smoothScaling.value),s(t.center,this._zoomCenterScreen),this._zoomMomentumEstimator.add(this._smoothScaling.value,.001*t.timestamp),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=f(t.radius-this._beginRadius),z(this.view,this.currentCamera,this._constraintOptions)}_initClampValues(){this._horizonScreenY=V(this.startCamera,this._referenceSphere,this._screenPickPoint);const t=null!=this._horizonScreenY;this._panLimitFromAbove=t&&this._screenPickPoint[1]<this._horizonScreenY,this._panLimitScreenY=t?Z(this.startCamera,this._horizonScreenY):null}_prepareSphericalPanMode(){null!=this._panLimitScreenY&&q(this._screenPickPoint[1],this._panLimitFromAbove,this._panLimitScreenY)&&(this._screenPickPoint[1]=this._panLimitScreenY,L(this._sphere,this.startCamera,this._screenPickPoint,this._beginScenePoint),m(this._scenePickPoint,this._beginScenePoint)),a(this._clampedScreenPoint,this._screenPickPoint)}_panningSpherical(t){const i=s(t.center,this._tmpScreenPointArray),e=this._clampScreenPointToHorizonPaddingRegion(i);L(this._sphere,this.currentCamera,e,this._tmp3d),B(this._beginScenePoint,P(this.currentCamera.up,this._beginScenePoint),this._sphere.radius,this._beginHeading,this.view.camera.tilt,this.startCamera.aboveGround)?(J(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this._beginHeading,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumPreserveHeading(e,this._tmp3d,.001*t.timestamp,this.startCamera,this._sphere,this._beginHeading,this.view.camera.tilt)):(K(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumDirectRotation(e,this._tmp3d,.001*t.timestamp,this.startCamera,this._sphere.radius,this.view.camera.tilt)),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=f(h(this._screenPickPoint,e)),z(this.view,this.currentCamera,this._constraintOptions)}_clampScreenPointToHorizonPaddingRegion(t){if(a(this._clampedScreenPoint,t),null==this._panLimitScreenY)return this._clampedScreenPoint;const i=V(this.currentCamera,this._referenceSphere,t);return null!=i&&(this._horizonScreenY=i,this._panLimitScreenY=this._panLimitFromAbove?Z(this.currentCamera,i):N(this.currentCamera,i)),q(t[1],this._panLimitFromAbove,this._panLimitScreenY)&&(this._clampedScreenPoint[1]=this._panLimitScreenY,this._panSphericalMomentumEstimator.reset()),this._clampedScreenPoint}_rotateSpherical(t){l(this._rotationAxis,this._scenePickPoint),this.currentCamera.aboveGround||c(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value,e=i+Q(t.angle-i),n=.00125*Math.min(Math.max(t.radius,40),120);this._smoothRotation.gain=n,this._smoothRotation.update(e);const s=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(s,.001*t.timestamp),W(this.currentCamera,this._sphere.center,v(this._rotationAxis,s)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=f(t.radius*e),z(this.view,this.currentCamera,this._constraintOptions)}_panningPlanar(t){const i=s(t.center,this._tmpScreenPointArray);G(this._panningPlane,this.currentCamera,i,this._tmp3d)&&(X(this.currentCamera,this._beginScenePoint,this._tmp3d),this._panPlanarMomentumEstimator.add(i,this._tmp3d,.001*t.timestamp),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=f(h(this._beginScreenPoint,i)),this._constraintOptions.interactionDirection=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,this._tmpInteractionDirection),z(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null)}_zoomPlanar(t){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._smoothScaling.gain=e,this._smoothScaling.update(i),this._zoomMomentumEstimator.add(this._smoothScaling.value,.001*t.timestamp),$(this.currentCamera,this._beginScenePoint,this._smoothScaling.value,this.view.state.constraints.minimumPoiDistance),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=f(t.radius-this._beginRadius),z(this.view,this.currentCamera,this._constraintOptions)}_rotatePlanar(t){m(this._rotationAxis,this._beginScenePoint),this.currentCamera.aboveGround||c(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value;let e=t.angle-i;e=Q(e);const n=i+e,s=.00125*Math.min(Math.max(t.radius,40),120);this._smoothRotation.gain=s,this._smoothRotation.update(n);const r=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(r,.001*t.timestamp),W(this.currentCamera,this._sphere.center,v(this._rotationAxis,r)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=f(t.radius*r),z(this.view,this.currentCamera,this._constraintOptions)}};t([r()],rt.prototype,"forceHorizontalPan",void 0),rt=t([o("esri.views.3d.state.controllers.PinchAndPanControllerGlobal")],rt);export{rt as PinchAndPanControllerGlobal};
2
+ import{__decorate as t}from"tslib";import{cyclicalPI as i}from"../../../../core/Cyclical.js";import{deg2rad as e}from"../../../../core/mathUtils.js";import{createScreenPointArray as n,screenPointObjectToArray as s}from"../../../../core/screenUtils.js";import{subclass as o}from"../../../../core/accessorSupport/decorators.js";import{copy as a,distance as r}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{copy as m,negate as h,length as c,subtract as _,normalize as p,add as u,scale as l,dot as d}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 P}from"../../../../geometry/ellipsoidUtils.js";import{wrapAxisAngle as v}from"../../../../geometry/support/axisAngle.js";import{create as w,fromPositionAndNormal as C,getNormal as M}from"../../../../geometry/support/plane.js";import{Sphere as b}from"../../../../geometry/support/sphere.js";import{pixelDistanceToInteractionFactor as S,applyAll as f}from"../../camera/constraintUtils.js";import{ConstraintOptions as j}from"../../camera/constraintUtils/ConstraintOptions.js";import{ExponentialFalloff as E}from"../../input/util.js";import{InteractiveController as y}from"./InteractiveController.js";import{PanPlanarMomentumController as x}from"./momentum/PanPlanarMomentumController.js";import{PanSphericalMomentumController as A}from"./momentum/PanSphericalMomentumController.js";import{RotationMomentumController as O}from"./momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as R}from"./momentum/ZoomPlanarMomentumController.js";import{ZoomSphericalMomentumController as z}from"./momentum/ZoomSphericalMomentumController.js";import{pickPointAndInitSphere as k,excludeTerrain as F,inferNavigationMode as H,sphereOrPlanePointFromScreenPoint as D,maxPanDistanceModifier as U,minPinchAndPanCameraHeight as T,pivotSearchAreaSize as G,intersectPlaneFromScreenPointAtEye as I,applyZoomOnSphere as Z,shouldPreserveHeading as V,applyPanSphericalPreserveHeading as q,applyPanSphericalDirectRotation as B,normalizeRotationDelta as J,applyRotation as K,applyPanPlanar as L,applyZoomToPoint as N}from"../utils/navigationUtils.js";import Q from"../../webgl/RenderCamera.js";import{PanPlanarMomentumEstimator as W}from"../../../navigation/PanPlanarMomentumEstimator.js";import{PanSphericalMomentumEstimator as X}from"../../../navigation/PanSphericalMomentumEstimator.js";import{RotationMomentumEstimator as Y}from"../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as $}from"../../../navigation/ZoomMomentumEstimator.js";let tt=class extends y{constructor(t){super(t),this._smoothRotation=new E(.05),this._rotationAxis=g(),this._beginAngle=0,this._beginHeading=0,this._panningPlane=w(),this._beginRadius=0,this._smoothScaling=new E(.05),this._zoomCenterScreen=n(),this._zoomMomentumEstimator=new $,this._rotationMomentumEstimator=new Y,this._panSphericalMomentumEstimator=new X,this._panPlanarMomentumEstimator=new W,this._adjustedSphere=new b,this._tmp3d=g(),this._tmpScreenPointArray=n(),this._beginScreenPoint=n(),this._beginScenePoint=g(),this._screenPickPoint=n(),this._scenePickPoint=g(),this._navigationMode=1,this._sphere=new b,this._pointerCount=0,this._tmpInteractionDirection=g(),this._beginCamera=new Q,this._constraintOptions=new j(15,0,0,this._beginCamera)}begin(t){if(!this.running)return;this._zoomMomentumEstimator.enabled=this._rotationMomentumEstimator.enabled=this._panPlanarMomentumEstimator.enabled=this._panSphericalMomentumEstimator.enabled=this.view.navigation.momentumEnabled,this._beginHeading=-i.normalize(e(this.view.camera.heading)),this._beginRadius=t.radius,this._beginAngle=t.angle,this._pointerCount=t.pointers.size,this._smoothRotation.reset(),s(t.center,this._screenPickPoint),a(this._beginScreenPoint,this._screenPickPoint);const n=k(this.view,this.startCamera,this._screenPickPoint,P(this.view.spatialReference).radius,1,this.view.groundView.invisible?F:{});null!=n.scenePickPoint&&(this._scenePickPoint=n.scenePickPoint,this._sphere=n.sphere,m(this._beginScenePoint,this._scenePickPoint),this._navigationMode=H(this.startCamera,this._screenPickPoint,this.view.renderCoordsHelper,this.view.viewingMode),0===this._navigationMode&&this._preparePlanarPanMode(t,n.hasGeometryIntersection),this._beginCamera.copyFrom(this.startCamera))}update(t){if(!this.running)return;this.currentCamera.copyFrom(this.startCamera);const i=t.pointers.size>1;1===this._navigationMode?(i&&this._zoomSpherical(t),this._panningSpherical(t),i&&this._rotateSpherical(t)):(i&&this._zoomPlanar(t),this._panningPlanar(t),i&&this._rotatePlanar(t)),this.commitCamera()}end(t){t.pointers.size===this._pointerCount&&this.update(t),this.finishController();const i=this.view.animationsEnabled&&this._zoomMomentumEstimator.evaluateMomentum();if(i)return 1===this._navigationMode?new z({view:this.view,momentum:i,screenCenter:this._zoomCenterScreen,sceneCenter:this._beginScenePoint,radius:this._sphere.radius}):new R({view:this.view,momentum:i,zoomCenter:this._beginScenePoint});const e=this.view.animationsEnabled&&this._rotationMomentumEstimator.evaluateMomentum();if(e)return new O({view:this.view,momentum:e,center:this._sphere.center,axis:this._rotationAxis});if(1===this._navigationMode){const t=this.view.animationsEnabled&&this._panSphericalMomentumEstimator.evaluateMomentum();if(t)return new A({view:this.view,momentum:t})}else{const t=this.view.animationsEnabled&&this._panPlanarMomentumEstimator.evaluateMomentum();if(t)return new x({view:this.view,momentum:t})}return null}_preparePlanarPanMode(t,i){const e=h(this._tmp3d,this.startCamera.viewForward);C(this._scenePickPoint,e,this._panningPlane);const o=n(this._screenPickPoint[0],0),a=g(),r=c(this.startCamera.eye);this._adjustedSphere.radius=r<this._sphere.radius?r-100:this._sphere.radius,D(this._adjustedSphere,this.startCamera,o,a);const P=g(),v=g(),w=g();_(P,this._scenePickPoint,this.currentCamera.eye);const b=c(P);p(P,P);const S=U*Math.max(Math.abs(this.view.camera.position.z),T),f=this.view.stage.renderView.getMinimalDepthForArea(null,this._screenPickPoint[0],this._screenPickPoint[1],this.view.state.camera,G);let j=null!=f?f:S;i&&(j=Math.min(j,b)),m(w,u(v,this.currentCamera.eye,l(v,P,j))),this._panningPlane[3]=-d(M(this._panningPlane),w),this.startCamera.center=u(v,this.startCamera.eye,l(v,this.startCamera.viewForward,j));const E=s(t.center,this._tmpScreenPointArray);I(this._panningPlane,this.startCamera,E,this._beginScenePoint)}_zoomSpherical(t){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._smoothScaling.gain=e,this._smoothScaling.update(i),Z(this._sphere,this.currentCamera,this._smoothScaling.value),s(t.center,this._zoomCenterScreen),this._zoomMomentumEstimator.add(this._smoothScaling.value,.001*t.timestamp),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=S(t.radius-this._beginRadius),f(this.view,this.currentCamera,this._constraintOptions)}_panningSpherical(t){const i=s(t.center,this._tmpScreenPointArray);D(this._sphere,this.currentCamera,i,this._tmp3d),V(this._beginScenePoint,d(this.currentCamera.up,this._beginScenePoint),this._sphere.radius,this._beginHeading,this.view.camera.tilt,this.startCamera.aboveGround)?(q(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this._beginHeading,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumPreserveHeading(i,this._tmp3d,.001*t.timestamp,this.startCamera,this._sphere,this._beginHeading,this.view.camera.tilt)):(B(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumDirectRotation(i,this._tmp3d,.001*t.timestamp,this.startCamera,this._sphere.radius,this.view.camera.tilt)),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=S(r(this._screenPickPoint,i)),f(this.view,this.currentCamera,this._constraintOptions)}_rotateSpherical(t){p(this._rotationAxis,this._scenePickPoint),this.currentCamera.aboveGround||h(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value,e=i+J(t.angle-i),n=.00125*Math.min(Math.max(t.radius,40),120);this._smoothRotation.gain=n,this._smoothRotation.update(e);const s=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(s,.001*t.timestamp),K(this.currentCamera,this._sphere.center,v(this._rotationAxis,s)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=S(t.radius*e),f(this.view,this.currentCamera,this._constraintOptions)}_panningPlanar(t){const i=s(t.center,this._tmpScreenPointArray);I(this._panningPlane,this.currentCamera,i,this._tmp3d)&&(L(this.currentCamera,this._beginScenePoint,this._tmp3d),this._panPlanarMomentumEstimator.add(i,this._tmp3d,.001*t.timestamp),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=S(r(this._beginScreenPoint,i)),this._constraintOptions.interactionDirection=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,this._tmpInteractionDirection),f(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null)}_zoomPlanar(t){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._smoothScaling.gain=e,this._smoothScaling.update(i),this._zoomMomentumEstimator.add(this._smoothScaling.value,.001*t.timestamp),N(this.currentCamera,this._beginScenePoint,this._smoothScaling.value,this.view.state.constraints.minimumPoiDistance),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=S(t.radius-this._beginRadius),f(this.view,this.currentCamera,this._constraintOptions)}_rotatePlanar(t){m(this._rotationAxis,this._beginScenePoint),this.currentCamera.aboveGround||h(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value;let e=t.angle-i;e=J(e);const n=i+e,s=.00125*Math.min(Math.max(t.radius,40),120);this._smoothRotation.gain=s,this._smoothRotation.update(n);const o=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(o,.001*t.timestamp),K(this.currentCamera,this._sphere.center,v(this._rotationAxis,o)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=S(t.radius*o),f(this.view,this.currentCamera,this._constraintOptions)}};tt=t([o("esri.views.3d.state.controllers.PinchAndPanControllerGlobal")],tt);export{tt as PinchAndPanControllerGlobal};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{createScreenPointArray as i,screenPointObjectToArray as e}from"../../../../core/screenUtils.js";import{property as n,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{copy as s,distance as r}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{negate as a,copy as m,dot as h,subtract as l,length as c,normalize as _,scale as p,add as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d,fromValues as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{wrapAxisAngle as C}from"../../../../geometry/support/axisAngle.js";import{create as v,fromNormalAndOffset as b,setOffsetFromPoint as S,negate as w,getNormal as M}from"../../../../geometry/support/plane.js";import{pixelDistanceToInteractionFactor as z,applyAll as P}from"../../camera/constraintUtils.js";import{ConstraintOptions as f}from"../../camera/constraintUtils/ConstraintOptions.js";import{ExponentialFalloff as V}from"../../input/util.js";import{getVoxelWasm as H}from"../../layers/VoxelWasm.js";import{InteractiveController as E}from"./InteractiveController.js";import{PanPlanarMomentumController as j}from"./momentum/PanPlanarMomentumController.js";import{RotationMomentumController as F}from"./momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as y}from"./momentum/ZoomPlanarMomentumController.js";import{inferNavigationMode as Y,excludeTerrain as x,getTiltScaleFactor as L,maxPanDistanceModifier as A,minPinchAndPanCameraHeight as O,pivotSearchAreaSize as R,centroid as T,applyZoomToPoint as U,applyPanPlanar as D,normalizeRotationDelta as I,applyRotation as Z,intersectPlaneFromScreenPointAtEye as k,findPlaneHorizonY as G,computeHorizonDownLimitScreenY as W,computeHorizonUpLimitScreenY as q,shouldClampScreenY as B}from"../utils/navigationUtils.js";import J from"../../webgl/RenderCamera.js";import{PanPlanarMomentumEstimator as K}from"../../../navigation/PanPlanarMomentumEstimator.js";import{RotationMomentumEstimator as N}from"../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as Q}from"../../../navigation/ZoomMomentumEstimator.js";const X=g(0,0,1);let $=class extends E{constructor(t){super(t),this.forceHorizontalPan=!1,this._rotationValueSmooth=new V(.05),this._scalingValueSmooth=new V(.05),this._planeHorizontal=v(),this._planeVertical=v(),this._rotationMomentumEstimator=new N,this._panMomentumEstimator=new K(300,12,.9),this._zoomMomentumEstimator=new Q,this._beginRadius=0,this._beginCenter=d(),this._beginAngle=0,this._tmpPoints=[],this._navigationMode=1,this._beginCenterScreen=i(),this._tmpCentroid3d=d(),this._tmpCentroid2d=i(),this._tmp2d=i(),this._clampedScreenPoint=i(),this._horizonScreenY=null,this._panLimitScreenY=null,this._panLimitFromAbove=!1,this._pointerCount=0,this._beginCamera=new J,this._constraintOptions=new f(15,0,0,this._beginCamera)}begin(t){if(!this.running)return;const i=this.view.navigation.momentumEnabled;this._zoomMomentumEstimator.enabled=i,this._rotationMomentumEstimator.enabled=i,this._panMomentumEstimator.enabled=i,this._beginRadius=t.radius,this._pointerCount=t.pointers.size,this._beginAngle=t.angle,this._rotationValueSmooth.reset(),this._scalingValueSmooth.reset(),e(t.center,this._beginCenterScreen),b(X,0,this._planeHorizontal);const n=d();a(n,this.startCamera.viewForward);const o=d();m(o,X);const r=h(n,o);this.forceHorizontalPan?this._navigationMode=1:this._navigationMode=Y(this.startCamera,this._beginCenterScreen,this.view.renderCoordsHelper,this.view.viewingMode),1===this._navigationMode&&(this._initClampValues(),s(this._beginCenterScreen,this._clampScreenPointToHorizonPaddingRegion(this._beginCenterScreen)));const g=d(),C=this._intersectionHelper.intersectScreenFreePointFallback(this._beginCenterScreen,g,this.view.groundView.invisible?x:{}),v=L(o,this.startCamera.viewForward,A)*Math.max(Math.abs(this.view.camera.position.z),O);S(this._planeHorizontal,this._planeHorizontal,g),this.startCamera.aboveGround||w(this._planeHorizontal,this._planeHorizontal);const z=d(),P=d(),f=d();l(z,g,this.currentCamera.eye);const V=c(z);if(_(z,z),0===this._navigationMode){p(o,o,r),l(M(this._planeVertical),n,o),_(M(this._planeVertical),M(this._planeVertical)),S(this._planeVertical,this._planeVertical,g);const i=this.view.stage.renderView.getMinimalDepthForArea(H(this.view),this._beginCenterScreen[0],this._beginCenterScreen[1],this.view.state.camera,R);let e=null!=i?i:v;C&&(e=Math.min(e,V)),m(f,u(P,this.currentCamera.eye,p(P,z,e))),this._planeVertical[3]=-h(M(this._planeVertical),f),this._computePlanePoints(t.pointers,this._planeVertical,this.startCamera,this._tmpPoints),T(this._tmpPoints,this._beginCenter)}else{const i=C?V:v;m(f,u(P,this.currentCamera.eye,p(P,z,i))),this._planeHorizontal[3]=-h(M(this._planeHorizontal),f),this._computePlanePoints(t.pointers,this._planeHorizontal,this.startCamera,this._tmpPoints),T(this._tmpPoints,this._beginCenter)}this._beginCamera.copyFrom(this.startCamera)}update(t){if(!this.running)return;this.currentCamera.copyFrom(this.startCamera);const i=t.pointers.size>1,n=1===this._navigationMode?this._planeHorizontal:this._planeVertical,o=this._beginCenter;if(i){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._scalingValueSmooth.gain=e,this._scalingValueSmooth.update(i),U(this.currentCamera,o,this._scalingValueSmooth.value,this.view.state.constraints.minimumPoiDistance),this._zoomMomentumEstimator.add(this._scalingValueSmooth.value,.001*t.timestamp),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=z(Math.abs(t.radius-this._beginRadius)),P(this.view,this.currentCamera,this._constraintOptions)}this._computePlanePoints(t.pointers,n,this.currentCamera,this._tmpPoints),T(this._tmpPoints,this._tmpCentroid3d),e(t.center,this._tmpCentroid2d);const s=1===this._navigationMode?this._clampScreenPointToHorizonPaddingRegion(this._tmpCentroid2d):this._tmpCentroid2d;if(D(this.currentCamera,o,this._tmpCentroid3d),this._panMomentumEstimator.add(s,this._tmpCentroid3d,.001*t.timestamp),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=z(r(this._beginCenterScreen,s)),P(this.view,this.currentCamera,this._constraintOptions),i){const i=o,e=this._rotationValueSmooth.value,n=e+I(t.angle-e),s=.00125*Math.min(Math.max(t.radius,40),120);this._rotationValueSmooth.gain=s,this._rotationValueSmooth.update(n);const r=this._rotationValueSmooth.value-this._beginAngle;this._rotationMomentumEstimator.add(r,.001*t.timestamp);const a=M(this._planeHorizontal);Z(this.currentCamera,i,C(a,r)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=z(Math.abs(t.radius*r)),P(this.view,this.currentCamera,this._constraintOptions)}this.commitCamera()}end(t){t.pointers.size===this._pointerCount&&this.update(t),this.finishController();const i=this.view.animationsEnabled&&this._zoomMomentumEstimator.evaluateMomentum();if(i)return new y({view:this.view,momentum:i,zoomCenter:this._beginCenter});const e=this.view.animationsEnabled&&this._rotationMomentumEstimator.evaluateMomentum();if(e)return new F({view:this.view,momentum:e,center:this._beginCenter,axis:M(this._planeHorizontal)});const n=this.view.animationsEnabled&&this._panMomentumEstimator.evaluateMomentum();return n?new j({view:this.view,momentum:n}):null}_computePlanePoints(t,i,e,n){n.length=t.size;const o=this._tmp2d;let s=0;return t.forEach(t=>{o[0]=t.x,o[1]=t.y;const r=1===this._navigationMode?this._clampScreenPointToHorizonPaddingRegion(o):o;void 0===n[s]&&(n[s]=d()),k(i,e,r,n[s]),s+=1}),n}_initClampValues(){this._horizonScreenY=G(this.startCamera,this._planeHorizontal),this._panLimitFromAbove=this._beginCenterScreen[1]<this._horizonScreenY,this._panLimitScreenY=this._panLimitFromAbove?W(this.startCamera,this._horizonScreenY):q(this.startCamera,this._horizonScreenY)}_clampScreenPointToHorizonPaddingRegion(t){return s(this._clampedScreenPoint,t),null==this._panLimitScreenY||(this._horizonScreenY=G(this.currentCamera,this._planeHorizontal),this._panLimitScreenY=this._panLimitFromAbove?W(this.currentCamera,this._horizonScreenY):q(this.currentCamera,this._horizonScreenY),B(t[1],this._panLimitFromAbove,this._panLimitScreenY)&&(this._clampedScreenPoint[1]=this._panLimitScreenY,this._panMomentumEstimator.reset())),this._clampedScreenPoint}get _intersectionHelper(){return this.view.sceneIntersectionHelper}};t([n()],$.prototype,"forceHorizontalPan",void 0),$=t([o("esri.views.3d.state.controllers.PinchAndPanControllerLocal")],$);export{$ as PinchAndPanControllerLocal};
2
+ import{__decorate as t}from"tslib";import{createScreenPointArray as i,screenPointObjectToArray as e}from"../../../../core/screenUtils.js";import{subclass as n}from"../../../../core/accessorSupport/decorators.js";import{distance as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{negate as s,copy as a,dot as r,subtract as m,length as h,normalize as l,scale as c,add as p}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _,fromValues as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{wrapAxisAngle as d}from"../../../../geometry/support/axisAngle.js";import{create as g,fromNormalAndOffset as C,setOffsetFromPoint as v,negate as b,getNormal as w}from"../../../../geometry/support/plane.js";import{pixelDistanceToInteractionFactor as M,applyAll as f}from"../../camera/constraintUtils.js";import{ConstraintOptions as V}from"../../camera/constraintUtils/ConstraintOptions.js";import{ExponentialFalloff as P}from"../../input/util.js";import{getVoxelWasm as z}from"../../layers/VoxelWasm.js";import{InteractiveController as S}from"./InteractiveController.js";import{PanPlanarMomentumController as j}from"./momentum/PanPlanarMomentumController.js";import{RotationMomentumController as E}from"./momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as H}from"./momentum/ZoomPlanarMomentumController.js";import{inferNavigationMode as x,excludeTerrain as y,getTiltScaleFactor as O,maxPanDistanceModifier as F,minPinchAndPanCameraHeight as R,pivotSearchAreaSize as A,centroid as U,applyZoomToPoint as T,applyPanPlanar as D,normalizeRotationDelta as I,applyRotation as Z,intersectPlaneFromScreenPointAtEye as k}from"../utils/navigationUtils.js";import G from"../../webgl/RenderCamera.js";import{PanPlanarMomentumEstimator as L}from"../../../navigation/PanPlanarMomentumEstimator.js";import{RotationMomentumEstimator as W}from"../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as q}from"../../../navigation/ZoomMomentumEstimator.js";const B=u(0,0,1);let J=class extends S{constructor(t){super(t),this._rotationValueSmooth=new P(.05),this._scalingValueSmooth=new P(.05),this._planeHorizontal=g(),this._planeVertical=g(),this._rotationMomentumEstimator=new W,this._panMomentumEstimator=new L(300,12,.9),this._zoomMomentumEstimator=new q,this._beginRadius=0,this._beginCenter=_(),this._beginAngle=0,this._tmpPoints=[],this._navigationMode=1,this._beginCenterScreen=i(),this._tmpCentroid3d=_(),this._tmpCentroid2d=i(),this._tmp2d=i(),this._pointerCount=0,this._beginCamera=new G,this._constraintOptions=new V(15,0,0,this._beginCamera)}begin(t){if(!this.running)return;const i=this.view.navigation.momentumEnabled;this._zoomMomentumEstimator.enabled=i,this._rotationMomentumEstimator.enabled=i,this._panMomentumEstimator.enabled=i,this._beginRadius=t.radius,this._pointerCount=t.pointers.size,this._beginAngle=t.angle,this._rotationValueSmooth.reset(),this._scalingValueSmooth.reset(),e(t.center,this._beginCenterScreen),C(B,0,this._planeHorizontal);const n=_();s(n,this.startCamera.viewForward);const o=_();a(o,B);const u=r(n,o);this._navigationMode=x(this.startCamera,this._beginCenterScreen,this.view.renderCoordsHelper,this.view.viewingMode);const d=_(),g=this._intersectionHelper.intersectScreenFreePointFallback(this._beginCenterScreen,d,this.view.groundView.invisible?y:{}),M=O(o,this.startCamera.viewForward,F)*Math.max(Math.abs(this.view.camera.position.z),R);v(this._planeHorizontal,this._planeHorizontal,d),this.startCamera.aboveGround||b(this._planeHorizontal,this._planeHorizontal);const f=_(),V=_(),P=_();m(f,d,this.currentCamera.eye);const S=h(f);if(l(f,f),0===this._navigationMode){c(o,o,u),m(w(this._planeVertical),n,o),l(w(this._planeVertical),w(this._planeVertical)),v(this._planeVertical,this._planeVertical,d);const i=this.view.stage.renderView.getMinimalDepthForArea(z(this.view),this._beginCenterScreen[0],this._beginCenterScreen[1],this.view.state.camera,A);let e=null!=i?i:M;g&&(e=Math.min(e,S)),a(P,p(V,this.currentCamera.eye,c(V,f,e))),this._planeVertical[3]=-r(w(this._planeVertical),P),this._computePlanePoints(t.pointers,this._planeVertical,this.startCamera,this._tmpPoints),U(this._tmpPoints,this._beginCenter)}else{const i=g?S:M;a(P,p(V,this.currentCamera.eye,c(V,f,i))),this._planeHorizontal[3]=-r(w(this._planeHorizontal),P),this._computePlanePoints(t.pointers,this._planeHorizontal,this.startCamera,this._tmpPoints),U(this._tmpPoints,this._beginCenter)}this._beginCamera.copyFrom(this.startCamera)}update(t){if(!this.running)return;this.currentCamera.copyFrom(this.startCamera);const i=t.pointers.size>1,n=1===this._navigationMode?this._planeHorizontal:this._planeVertical,s=this._beginCenter;if(i){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._scalingValueSmooth.gain=e,this._scalingValueSmooth.update(i),T(this.currentCamera,s,this._scalingValueSmooth.value,this.view.state.constraints.minimumPoiDistance),this._zoomMomentumEstimator.add(this._scalingValueSmooth.value,.001*t.timestamp),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=M(Math.abs(t.radius-this._beginRadius)),f(this.view,this.currentCamera,this._constraintOptions)}if(this._computePlanePoints(t.pointers,n,this.currentCamera,this._tmpPoints),U(this._tmpPoints,this._tmpCentroid3d),e(t.center,this._tmpCentroid2d),D(this.currentCamera,s,this._tmpCentroid3d),this._panMomentumEstimator.add(this._tmpCentroid2d,this._tmpCentroid3d,.001*t.timestamp),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=M(o(this._beginCenterScreen,this._tmpCentroid2d)),f(this.view,this.currentCamera,this._constraintOptions),i){const i=s,e=this._rotationValueSmooth.value,n=e+I(t.angle-e),o=.00125*Math.min(Math.max(t.radius,40),120);this._rotationValueSmooth.gain=o,this._rotationValueSmooth.update(n);const a=this._rotationValueSmooth.value-this._beginAngle;this._rotationMomentumEstimator.add(a,.001*t.timestamp);const r=w(this._planeHorizontal);Z(this.currentCamera,i,d(r,a)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=M(Math.abs(t.radius*a)),f(this.view,this.currentCamera,this._constraintOptions)}this.commitCamera()}end(t){t.pointers.size===this._pointerCount&&this.update(t),this.finishController();const i=this.view.animationsEnabled&&this._zoomMomentumEstimator.evaluateMomentum();if(i)return new H({view:this.view,momentum:i,zoomCenter:this._beginCenter});const e=this.view.animationsEnabled&&this._rotationMomentumEstimator.evaluateMomentum();if(e)return new E({view:this.view,momentum:e,center:this._beginCenter,axis:w(this._planeHorizontal)});const n=this.view.animationsEnabled&&this._panMomentumEstimator.evaluateMomentum();return n?new j({view:this.view,momentum:n}):null}_computePlanePoints(t,i,e,n){n.length=t.size;const o=this._tmp2d;let s=0;return t.forEach(t=>{o[0]=t.x,o[1]=t.y,void 0===n[s]&&(n[s]=_()),k(i,e,o,n[s]),s+=1}),n}get _intersectionHelper(){return this.view.sceneIntersectionHelper}};J=t([n("esri.views.3d.state.controllers.PinchAndPanControllerLocal")],J);export{J as PinchAndPanControllerLocal};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{clamp as i}from"../../../../core/mathUtils.js";import{createScreenPointArray as r}from"../../../../core/screenUtils.js";import{subclass as e}from"../../../../core/accessorSupport/decorators.js";import{copy as s,distance as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{normalize as o,subtract as h,length as c,scale as m,add as p}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as _}from"../../../../geometry/ellipsoidUtils.js";import{create as u,fromPoints as P}from"../../../../geometry/support/axisAngle.js";import{Sphere as g}from"../../../../geometry/support/sphere.js";import{pixelDistanceToInteractionFactor as y,applyAll as C}from"../../camera/constraintUtils.js";import{ConstraintOptions as d}from"../../camera/constraintUtils/ConstraintOptions.js";import{applySurfaceCollisionConstraint as f}from"../../camera/constraintUtils/surfaceCollision.js";import{InteractiveController as v}from"./InteractiveController.js";import{normalizeCoordinate as R,pickPointAndInitSphere as w,excludeTerrain as D,inferNavigationMode as k,zoomPivotDistanceClamp as j,getTiltScaleFactor as A,pivotSearchAreaSize as b,distanceComparisonTolerance as x,sphereOrPlanePointFromScreenPoint as M,applyRotation as O,maxZoomPivotDistanceModifier as U}from"../utils/navigationUtils.js";import{fromScreenAtEye as z}from"../../support/geometryUtils/ray.js";const H=12;let B=class extends v{constructor(){super(...arguments),this._pickPoint=l(),this._tmpP0=a(),this._panAxisAngle=u(),this._tmpRayDir=l(),this._tmpRayDirPick=l(),this._targetOnSphere=l(),this._navigationMode=1,this._tmpRay={origin:l(),direction:l()},this.dragBeginPoint=r(),this._normalizedAnchorPoint=a(),this._constraintOptions=new d(7,1,0,this.startCamera),this._sphere=new g,this._hasPickPoint=!1}get _intersectionHelper(){return this.view.sceneIntersectionHelper}begin(t){if(!this.running)return;s(this.dragBeginPoint,t),R(this.startCamera,t,this._normalizedAnchorPoint);const r=_(this.view.spatialReference),e=w(this._intersectionHelper,this.startCamera,t,r.radius,0,this.view.groundView.invisible?D:{});if(this._navigationMode=k(this.startCamera,t,this.view.renderCoordsHelper,this.view.viewingMode),1===this._navigationMode)this._hasPickPoint=!!e.scenePickPoint,this._pickPoint=e.scenePickPoint??this._pickPoint,this._sphere=e.sphere;else{let r;z(this.startCamera,t,this._tmpRay),o(this._tmpRay.direction,this._tmpRay.direction),null!=e.scenePickPoint&&(h(this._tmpRayDirPick,this.startCamera.eye,e.scenePickPoint),r=c(this._tmpRayDirPick));const s=Math.abs(this.view.camera.position.z);this.view.renderCoordsHelper.worldUpAtPosition(this.startCamera.eye,F);const n=i(A(F,this._tmpRay.direction,U)*s,j[0],j[1]),a=this.view.stage.renderView.getMinimalDepthForArea(null,t[0],t[1],this.view.state.camera,b);let l=null!=a?a:n;null!=r&&(l=Math.min(l,r)),this._hasPickPoint=!0,m(this._tmpRay.direction,this._tmpRay.direction,l),p(this._pickPoint,this._tmpRay.origin,this._tmpRay.direction)}}update(t){if(this.running){if(this.currentCamera.eye=this.startCamera.eye,this.currentCamera.center=this.startCamera.center,this.currentCamera.up=this.startCamera.up,1===this._navigationMode){h(this._tmpRayDir,this.currentCamera.center,this.currentCamera.eye);const i=c(this._tmpRayDir);R(this.currentCamera,t,this._tmpP0);const r=(this._normalizedAnchorPoint[1]-this._tmpP0[1])*H;let e=i*2**r;const s=this.view.state.constraints.minimumPoiDistance;if(r<0&&e<s&&(e=s),Math.abs(i-e)<x)return;if(this._hasPickPoint&&e<i){const t=1-(1-e/i)*(1-this._sphere.radius/c(this.currentCamera.center));this.currentCamera.center=m(S,this.currentCamera.center,t)}m(this._tmpRayDir,this._tmpRayDir,-e/i),this.currentCamera.eye=p(S,this.currentCamera.center,this._tmpRayDir),this._constraintOptions.interactionFactor=y(n(this.dragBeginPoint,t)),C(this.view,this.currentCamera,this._constraintOptions),this._hasPickPoint&&(M(this._sphere,this.currentCamera,this.dragBeginPoint,this._targetOnSphere),P(this._pickPoint,this._targetOnSphere,this._panAxisAngle),O(this.currentCamera,this._sphere.center,this._panAxisAngle))}else{const i=c(this._tmpRay.direction);R(this.currentCamera,t,this._tmpP0);const r=(this._normalizedAnchorPoint[1]-this._tmpP0[1])*H;let e=i*2**r;const s=this.view.state.constraints.minimumPoiDistance;if(r<0&&e<s&&(e=s),Math.abs(i-e)<x)return;m(this._tmpRayDir,this._tmpRay.direction,1-e/i),this.currentCamera.eye=p(S,this.currentCamera.eye,this._tmpRayDir),this.currentCamera.center=p(S,this.currentCamera.center,this._tmpRayDir),o(this._tmpRayDir,this._tmpRayDir),this._constraintOptions.interactionDirection=this._tmpRayDir,C(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}f(this.view,null,this.currentCamera),this.commitCamera()}}finish(){this.running&&this.finishController()}};B=t([e("esri.views.3d.state.controllers.ZoomControllerGlobal")],B);const S=l(),F=l();export{B as ZoomControllerGlobal};
2
+ import{__decorate as t}from"tslib";import{clamp as i}from"../../../../core/mathUtils.js";import{createScreenPointArray as r}from"../../../../core/screenUtils.js";import{subclass as e}from"../../../../core/accessorSupport/decorators.js";import{copy as s,distance as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{normalize as o,subtract as h,length as c,scale as m,add as p}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as _}from"../../../../geometry/ellipsoidUtils.js";import{create as u,fromPoints as P}from"../../../../geometry/support/axisAngle.js";import{Sphere as y}from"../../../../geometry/support/sphere.js";import{pixelDistanceToInteractionFactor as C,applyAll as g}from"../../camera/constraintUtils.js";import{ConstraintOptions as d}from"../../camera/constraintUtils/ConstraintOptions.js";import{applySurfaceCollisionConstraint as f}from"../../camera/constraintUtils/surfaceCollision.js";import{InteractiveController as v}from"./InteractiveController.js";import{normalizeCoordinate as R,pickPointAndInitSphere as w,excludeTerrain as D,inferNavigationMode as k,zoomPivotDistanceClamp as j,getTiltScaleFactor as A,pivotSearchAreaSize as b,distanceComparisonTolerance as x,sphereOrPlanePointFromScreenPoint as M,applyRotation as O,maxZoomPivotDistanceModifier as U}from"../utils/navigationUtils.js";import{fromScreenAtEye as z}from"../../support/geometryUtils/ray.js";const B=12;let S=class extends v{constructor(){super(...arguments),this._pickPoint=l(),this._tmpP0=a(),this._panAxisAngle=u(),this._tmpRayDir=l(),this._tmpRayDirPick=l(),this._targetOnSphere=l(),this._navigationMode=1,this._tmpRay={origin:l(),direction:l()},this.dragBeginPoint=r(),this._normalizedAnchorPoint=a(),this._constraintOptions=new d(7,1,0,this.startCamera),this._sphere=new y,this._hasPickPoint=!1}begin(t){if(!this.running)return;s(this.dragBeginPoint,t),R(this.startCamera,t,this._normalizedAnchorPoint);const r=_(this.view.spatialReference),e=w(this.view,this.startCamera,t,r.radius,0,this.view.groundView.invisible?D:{});if(this._navigationMode=k(this.startCamera,t,this.view.renderCoordsHelper,this.view.viewingMode),1===this._navigationMode)this._hasPickPoint=!!e.scenePickPoint,this._pickPoint=e.scenePickPoint??this._pickPoint,this._sphere=e.sphere;else{let r;z(this.startCamera,t,this._tmpRay),o(this._tmpRay.direction,this._tmpRay.direction),null!=e.scenePickPoint&&(h(this._tmpRayDirPick,this.startCamera.eye,e.scenePickPoint),r=c(this._tmpRayDirPick));const s=Math.abs(this.view.camera.position.z);this.view.renderCoordsHelper.worldUpAtPosition(this.startCamera.eye,H);const n=i(A(H,this._tmpRay.direction,U)*s,j[0],j[1]),a=this.view.stage.renderView.getMinimalDepthForArea(null,t[0],t[1],this.view.state.camera,b);let l=null!=a?a:n;null!=r&&(l=Math.min(l,r)),this._hasPickPoint=!0,m(this._tmpRay.direction,this._tmpRay.direction,l),p(this._pickPoint,this._tmpRay.origin,this._tmpRay.direction)}}update(t){if(this.running){if(this.currentCamera.eye=this.startCamera.eye,this.currentCamera.center=this.startCamera.center,this.currentCamera.up=this.startCamera.up,1===this._navigationMode){h(this._tmpRayDir,this.currentCamera.center,this.currentCamera.eye);const i=c(this._tmpRayDir);R(this.currentCamera,t,this._tmpP0);const r=(this._normalizedAnchorPoint[1]-this._tmpP0[1])*B;let e=i*2**r;const s=this.view.state.constraints.minimumPoiDistance;if(r<0&&e<s&&(e=s),Math.abs(i-e)<x)return;if(this._hasPickPoint&&e<i){const t=1-(1-e/i)*(1-this._sphere.radius/c(this.currentCamera.center));this.currentCamera.center=m(F,this.currentCamera.center,t)}m(this._tmpRayDir,this._tmpRayDir,-e/i),this.currentCamera.eye=p(F,this.currentCamera.center,this._tmpRayDir),this._constraintOptions.interactionFactor=C(n(this.dragBeginPoint,t)),g(this.view,this.currentCamera,this._constraintOptions),this._hasPickPoint&&(M(this._sphere,this.currentCamera,this.dragBeginPoint,this._targetOnSphere),P(this._pickPoint,this._targetOnSphere,this._panAxisAngle),O(this.currentCamera,this._sphere.center,this._panAxisAngle))}else{const i=c(this._tmpRay.direction);R(this.currentCamera,t,this._tmpP0);const r=(this._normalizedAnchorPoint[1]-this._tmpP0[1])*B;let e=i*2**r;const s=this.view.state.constraints.minimumPoiDistance;if(r<0&&e<s&&(e=s),Math.abs(i-e)<x)return;m(this._tmpRayDir,this._tmpRay.direction,1-e/i),this.currentCamera.eye=p(F,this.currentCamera.eye,this._tmpRayDir),this.currentCamera.center=p(F,this.currentCamera.center,this._tmpRayDir),o(this._tmpRayDir,this._tmpRayDir),this._constraintOptions.interactionDirection=this._tmpRayDir,g(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}f(this.view,null,this.currentCamera),this.commitCamera()}}finish(){this.running&&this.finishController()}};S=t([e("esri.views.3d.state.controllers.ZoomControllerGlobal")],S);const F=l(),H=l();export{S as ZoomControllerGlobal};