@arcgis/core 4.34.0-next.57 → 4.34.0-next.59

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 (462) hide show
  1. package/Basemap.js +1 -1
  2. package/LICENSE.md +19 -0
  3. package/README.md +2 -18
  4. package/applications/KnowledgeStudio/reshape.d.ts +5 -0
  5. package/applications/KnowledgeStudio/reshape.js +5 -0
  6. package/assets/esri/core/workers/RemoteClient.js +1 -1
  7. package/assets/esri/core/workers/chunks/03fe4164abd12abc7921.js +1 -0
  8. package/assets/esri/core/workers/chunks/{893e5eb5c028c4704317.js → 0427f66b56ec6601deb0.js} +1 -1
  9. package/assets/esri/core/workers/chunks/06b65105b15abf4d0fbf.js +1 -0
  10. package/assets/esri/core/workers/chunks/{02902303e5585a16ebea.js → 0b53bc76d38e85902748.js} +1 -1
  11. package/assets/esri/core/workers/chunks/0cb2f7172190babb4139.js +1 -0
  12. package/assets/esri/core/workers/chunks/0e28cb5d8d89ae29cdd0.js +1 -0
  13. package/assets/esri/core/workers/chunks/{1776ef96c9f4636f8838.js → 138c11b5eca621e51396.js} +1 -1
  14. package/assets/esri/core/workers/chunks/14c6461ffd36319e1d74.js +1 -0
  15. package/assets/esri/core/workers/chunks/1612d1c1d78c122dfef6.js +1 -0
  16. package/assets/esri/core/workers/chunks/17abab49db1813d3e192.js +1 -0
  17. package/assets/esri/core/workers/chunks/182383fd00008606bfaa.js +1 -0
  18. package/assets/esri/core/workers/chunks/18f878ec695617650a96.js +1 -0
  19. package/assets/esri/core/workers/chunks/{d578c3880eaf2dd62324.js → 19e5e011f929b6b940fe.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{57c438bb0da6410df525.js → 1bf17c6548ac4cd5a166.js} +1 -1
  21. package/assets/esri/core/workers/chunks/1c61cf137a989bc52bb8.js +1 -0
  22. package/assets/esri/core/workers/chunks/{043bb97e38e3a54aa2ab.js → 1ed7a8f4a0058d3b69ef.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{dd2b5f115d156b5b212e.js → 22ec2b0a853911692dc8.js} +1 -1
  24. package/assets/esri/core/workers/chunks/232c76f122b1f519e099.js +1 -0
  25. package/assets/esri/core/workers/chunks/{827bebb4bcdde23adc91.js → 251b7f2e295ce191eb62.js} +1 -1
  26. package/assets/esri/core/workers/chunks/27334cda1b877abcba1b.js +1 -0
  27. package/assets/esri/core/workers/chunks/{02a31483e09652a1a1a2.js → 2b7f9a57a2cfbc108673.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{9fef330b241f958b55df.js → 2cd27b06226e30aec5da.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{7c86af4f60cea383ed96.js → 39a1f361bb69073af765.js} +1 -1
  30. package/assets/esri/core/workers/chunks/3a7ac10a6614fe5745f7.js +1 -0
  31. package/assets/esri/core/workers/chunks/{70cf81ec5a901782d2db.js → 3e7c9a43e52ed6a1b018.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{8257352421f453a669e9.js → 3f634580055b30dbfc8e.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{0e8d3d38e9b1f6abf6f2.js → 3fd09a7c05583a57a317.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{52917b753c5ceab0c1f7.js → 4050ddb580d364d9e205.js} +7 -7
  35. package/assets/esri/core/workers/chunks/{8c79945909069733558f.js → 4094cebc4b92c52f4e27.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{82de1b50ae286f1e6c44.js → 451761c7bd2da530e1d0.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{cc748d4f4adb9c584aa4.js → 45aeff2f751f124f8e53.js} +1 -1
  38. package/assets/esri/core/workers/chunks/462b30fc40a5f337ba10.js +1 -0
  39. package/assets/esri/core/workers/chunks/{d20af70b23f175fb5442.js → 48b9ba825856a0c843ff.js} +1 -1
  40. package/assets/esri/core/workers/chunks/497214e9e82b936fc94e.js +1 -0
  41. package/assets/esri/core/workers/chunks/4ac127cefa3aa5e93e78.js +1 -0
  42. package/assets/esri/core/workers/chunks/4b1daffa97fd90a554a0.js +1 -0
  43. package/assets/esri/core/workers/chunks/4d7fcec769369c576847.js +1 -0
  44. package/assets/esri/core/workers/chunks/4dee2f05508e90410f13.js +1 -0
  45. package/assets/esri/core/workers/chunks/516864fb68025acc7db6.js +1 -0
  46. package/assets/esri/core/workers/chunks/{d630fc3acd2552c98dc0.js → 547af4ffbeeccba9d187.js} +1 -1
  47. package/assets/esri/core/workers/chunks/54b43876ae6fb078eb38.js +1 -0
  48. package/assets/esri/core/workers/chunks/{cf699b9bb530b87be14c.js → 58422c616a824ab49218.js} +1 -1
  49. package/assets/esri/core/workers/chunks/589a0e244ef5f1b84ab6.js +1 -0
  50. package/assets/esri/core/workers/chunks/5b7e5ec6aea1f7f9b005.js +1 -0
  51. package/assets/esri/core/workers/chunks/{fe55833c80cf59df9c2b.js → 5cb238318a24b70d5ac3.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{2c7e7895c4dda176220e.js → 5d4b24c864ebb68ae61e.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{88a5e7415f8858c454f7.js → 5de7c2a80bd9c81cefe2.js} +1 -1
  54. package/assets/esri/core/workers/chunks/5e1afea05b624b315d9f.js +1 -0
  55. package/assets/esri/core/workers/chunks/5ed7e139c72cd2b3ddba.js +1 -0
  56. package/assets/esri/core/workers/chunks/6531f33d6710960079e9.js +1 -0
  57. package/assets/esri/core/workers/chunks/{a1ff4c252012d5026133.js → 65eb183b5d001dfc42c8.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{f1b6d6ee03635d985c3e.js → 6688efc71d9d8f4d2559.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{d5faf3ddf9a39de826be.js → 672c04d48aa51f16e9b7.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{1cbd59918c60a1a21494.js → 700b5a536f97233bc4af.js} +1 -1
  61. package/assets/esri/core/workers/chunks/7597ef10d1699e7088e5.js +1 -0
  62. package/assets/esri/core/workers/chunks/781e424a383c71ca904d.js +1 -0
  63. package/assets/esri/core/workers/chunks/79933271a76a1756584f.js +1 -0
  64. package/assets/esri/core/workers/chunks/{17e203e4680c07bd02f1.js → 7aa7aff6d42be7c2d1d2.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{c2f184e9f579152aa29a.js → 7b17f52019762aa21af8.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{549e073fe276363a9896.js → 7db105f6b688b6da8106.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{945c5a477940ebd23a4c.js → 7f0c78bcba0aed3c4eff.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{a249e56a0be8cef33ba8.js → 81eb7785d626aa975033.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{3eb792863a789b97ec58.js → 831a69e5a87e92830fbe.js} +1 -1
  70. package/assets/esri/core/workers/chunks/8374d87176486c1fc90e.js +1 -0
  71. package/assets/esri/core/workers/chunks/83dfaa6e3bd58d544f35.js +1 -0
  72. package/assets/esri/core/workers/chunks/{5691d504ffe5592bc40f.js → 897f9775f06ddbf6486f.js} +1 -1
  73. package/assets/esri/core/workers/chunks/8bbae8ac586e5c0819d2.js +1 -0
  74. package/assets/esri/core/workers/chunks/8c0e11f781607239749d.js +1 -0
  75. package/assets/esri/core/workers/chunks/90540fdfb0c5f68aa959.js +1 -0
  76. package/assets/esri/core/workers/chunks/9280edff80fd87860a5e.js +1 -0
  77. package/assets/esri/core/workers/chunks/{9275313e0f1f521b2658.js → 9325000c87295c473291.js} +1 -1
  78. package/assets/esri/core/workers/chunks/94b9948ec628187c19fc.js +1 -0
  79. package/assets/esri/core/workers/chunks/94f1005222bff1870ef1.js +1 -0
  80. package/assets/esri/core/workers/chunks/{aab349d4624b78ef429f.js → 96102a9296afd1bfe1a9.js} +1 -1
  81. package/assets/esri/core/workers/chunks/981275b6f008431c983a.js +1 -0
  82. package/assets/esri/core/workers/chunks/{4d2473e680324dc17cfa.js → 997a2a1a51039ce7e4e3.js} +1 -1
  83. package/assets/esri/core/workers/chunks/{07d5e0633cc2f765037f.js → 9f4e23bae621ff3ecea3.js} +1 -1
  84. package/assets/esri/core/workers/chunks/{4e2b125e6e3945985a54.js → 9f93513037a6e87433c4.js} +1 -1
  85. package/assets/esri/core/workers/chunks/a16b471c3706ee37f9b6.js +1 -0
  86. package/assets/esri/core/workers/chunks/{989251f5e0d6a08b1afa.js → a17ed7ce97e69466d730.js} +1 -1
  87. package/assets/esri/core/workers/chunks/a2150baf0661e2f28011.js +1 -0
  88. package/assets/esri/core/workers/chunks/a244afea77127e54dd3a.js +1 -0
  89. package/assets/esri/core/workers/chunks/{ab3c018c406dcd81ef9e.js → a2f4b6d8da93f106852c.js} +1 -1
  90. package/assets/esri/core/workers/chunks/a532614aa65fb52dee7b.js +1 -0
  91. package/assets/esri/core/workers/chunks/{3b51b61a7b8a1ef87c9b.js → a700f57af6856cb5313c.js} +1 -1
  92. package/assets/esri/core/workers/chunks/{319fe6a02ec630a827ea.js → a7ea2e3895046e566bc6.js} +1 -1
  93. package/assets/esri/core/workers/chunks/abe60d92e0219ee97036.js +1 -0
  94. package/assets/esri/core/workers/chunks/{a7530dcb08b43e37bbb2.js → ae1cb4c65d72217ae4d4.js} +1 -1
  95. package/assets/esri/core/workers/chunks/af5ae7c36e1178077cbc.js +1 -0
  96. package/assets/esri/core/workers/chunks/{7f80bbbd0897082c1af3.js → b29144ee58b43f769d9a.js} +1 -1
  97. package/assets/esri/core/workers/chunks/b30de4936caa654d7817.js +1 -0
  98. package/assets/esri/core/workers/chunks/{4193691ca076948f4f90.js → b53008c1461dd6bacc63.js} +1 -1
  99. package/assets/esri/core/workers/chunks/{1d234c057a6671acc59f.js → b605dfdfed8ff8eda4f3.js} +1 -1
  100. package/assets/esri/core/workers/chunks/{76ff7ccfe583927918f3.js → b68b54be3d67595a9446.js} +18 -18
  101. package/assets/esri/core/workers/chunks/b6c6f82df3b60c2f831f.js +1 -0
  102. package/assets/esri/core/workers/chunks/{7eda1c400658b6a99be8.js → ba0c7339fa19cc7cbde7.js} +1 -1
  103. package/assets/esri/core/workers/chunks/{fae6030a81cb91a91b69.js → bafd9b0f6e817252cb31.js} +1 -1
  104. package/assets/esri/core/workers/chunks/{c80c032c5b7a11db177a.js → bb2ab663e3e5597f2104.js} +1 -1
  105. package/assets/esri/core/workers/chunks/{724de82d101eb59c2834.js → bd451668c4ce9f7d7128.js} +1 -1
  106. package/assets/esri/core/workers/chunks/{91ede8c62a7b1e8b8023.js → be06c8a58c217a17451b.js} +1 -1
  107. package/assets/esri/core/workers/chunks/bf6b76027c60b4ffa507.js +1 -0
  108. package/assets/esri/core/workers/chunks/{08c0c016787caa169492.js → c24214666d10cb648428.js} +1 -1
  109. package/assets/esri/core/workers/chunks/c34a164a8ece4cb33e81.js +1 -0
  110. package/assets/esri/core/workers/chunks/{a3a23a56df4e5ee86bb2.js → c5fe356fc5b8b7be0d31.js} +1 -1
  111. package/assets/esri/core/workers/chunks/c696615cae5daefa2d98.js +1 -0
  112. package/assets/esri/core/workers/chunks/{e982cf44906eb26164f2.js → c75b0243e5bb84738419.js} +1 -1
  113. package/assets/esri/core/workers/chunks/{64fab4e1e28c06c83403.js → c779c8b98e07fa881c1d.js} +1 -1
  114. package/assets/esri/core/workers/chunks/{4a0257c449f31bdadf26.js → cef9ff811221a7c3812c.js} +1 -1
  115. package/assets/esri/core/workers/chunks/{b1982490762972ae023d.js → d0296368ae143de4d5ce.js} +1 -1
  116. package/assets/esri/core/workers/chunks/{3d5954478864a975e65e.js → d07d3b0e06f12aee4a8b.js} +1 -1
  117. package/assets/esri/core/workers/chunks/{e1472dbf0795d737d6f8.js → d2371f5034b2a32e2523.js} +1 -1
  118. package/assets/esri/core/workers/chunks/{2f65081bfedeab44d6cb.js → d35cadfb78ac9803069b.js} +1 -1
  119. package/assets/esri/core/workers/chunks/{80a69897fa3ce1eaa6e7.js → d707538b150d79050336.js} +1 -1
  120. package/assets/esri/core/workers/chunks/d7ce68667bb355ef8e5d.js +1 -0
  121. package/assets/esri/core/workers/chunks/d823277612f971a9c2f0.js +1 -0
  122. package/assets/esri/core/workers/chunks/d83bdc13c3cad3eee7be.js +1 -0
  123. package/assets/esri/core/workers/chunks/d91b80aa4f847c2e2a33.js +1 -0
  124. package/assets/esri/core/workers/chunks/{a96ac5c68d84122e7751.js → db7678104b18534482e3.js} +1 -1
  125. package/assets/esri/core/workers/chunks/dbcef57073075e9cfdfe.js +1 -0
  126. package/assets/esri/core/workers/chunks/{c4ceb267d4004d8da8cc.js → e0bbfbe1ed39c82f1bd4.js} +1 -1
  127. package/assets/esri/core/workers/chunks/e36d538915261ee0373f.js +1 -0
  128. package/assets/esri/core/workers/chunks/e58c5c8639aa837c84d1.js +1 -0
  129. package/assets/esri/core/workers/chunks/{a24762e976c1459b12de.js → e689a4849f5af3f2f641.js} +1 -1
  130. package/assets/esri/core/workers/chunks/e97250ae8da4bd0d6bc9.js +1 -0
  131. package/assets/esri/core/workers/chunks/{ef85cd0e82d59db8a26f.js → eacc7fccdc3fb670ac8f.js} +2 -2
  132. package/assets/esri/core/workers/chunks/{0df1f56df6d47dfbb6ea.js → eada3483116a5ea8baed.js} +1 -1
  133. package/assets/esri/core/workers/chunks/ed8863c3d334f438b625.js +1 -0
  134. package/assets/esri/core/workers/chunks/{47682247910271077333.js → ee78a38a0cacb19b2fd4.js} +1 -1
  135. package/assets/esri/core/workers/chunks/{f4061587ff5789fa4e1f.js → f594df2f5ce6ca41a254.js} +1 -1
  136. package/assets/esri/core/workers/chunks/{d7b3e81cc313fd0a33b0.js → f5c821ca2911a5103c9a.js} +1 -1
  137. package/assets/esri/core/workers/chunks/f636ca5c811c3a2a962f.js +1 -0
  138. package/assets/esri/core/workers/chunks/{a3ee76b7e46d3fba7cf7.js → f6d91256c4e5f8a0d5c0.js} +1 -1
  139. package/assets/esri/core/workers/chunks/f711aeba1a2c184ddb43.js +1 -0
  140. package/assets/esri/core/workers/chunks/f718f630a8b81496c646.js +1 -0
  141. package/assets/esri/core/workers/chunks/{cac060a187f3a27a19ba.js → fa0f94318173db2034de.js} +1 -1
  142. package/assets/esri/core/workers/chunks/fdae43a97537093e4b97.js +1 -0
  143. package/assets/esri/core/workers/chunks/{b6a201e86f9caef45ff0.js → ff2614d96ca5228e9685.js} +1 -1
  144. package/assets/esri/themes/base/widgets/_Editor.scss +5 -3
  145. package/assets/esri/themes/base/widgets/_SelectionToolbar.scss +6 -0
  146. package/assets/esri/themes/dark/main.css +1 -1
  147. package/assets/esri/themes/light/main.css +1 -1
  148. package/assets/esri/themes/light/view.css +1 -1
  149. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar.json +1 -1
  150. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_en.json +1 -1
  151. package/chunks/BloomComposition.glsl.js +36 -18
  152. package/chunks/ColorMaterial.glsl.js +1 -1
  153. package/chunks/ComponentShader.glsl.js +3 -3
  154. package/chunks/CompositeGeographicTransformation.js +1 -1
  155. package/chunks/CutFillDepth.glsl.js +15 -0
  156. package/chunks/CutFillReduction.glsl.js +12 -0
  157. package/chunks/CutFillTargetDepth.glsl.js +6 -0
  158. package/chunks/DefaultMaterial.glsl.js +2 -2
  159. package/chunks/GeodeticDistanceCalculator-Ce-woMPw.js +1 -1
  160. package/chunks/GeographicTransformation.js +1 -1
  161. package/chunks/HUDMaterial.glsl.js +4 -4
  162. package/chunks/ImageMaterial.glsl.js +2 -2
  163. package/chunks/MultiPathImpl.js +1 -1
  164. package/chunks/NativeLine.glsl.js +1 -1
  165. package/chunks/OperatorGeodesicBuffer.js +1 -1
  166. package/chunks/OperatorGeodeticArea.js +1 -1
  167. package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
  168. package/chunks/OperatorGeodeticLength.js +1 -1
  169. package/chunks/OperatorProximityGeodesic.js +1 -1
  170. package/chunks/OperatorShapePreservingLength.js +1 -1
  171. package/chunks/OperatorShapePreservingProject.js +1 -1
  172. package/chunks/Path.glsl.js +7 -7
  173. package/chunks/Pattern.glsl.js +1 -1
  174. package/chunks/Point2D.js +1 -1
  175. package/chunks/ProjectionTransformation.js +1 -1
  176. package/chunks/RealisticTree.glsl.js +2 -2
  177. package/chunks/RibbonLine.glsl.js +2 -2
  178. package/chunks/ShadedColorMaterial.glsl.js +1 -1
  179. package/chunks/SimpleAtmosphere.glsl.js +1 -1
  180. package/chunks/SpatialReference.js +1 -1
  181. package/chunks/Terrain.glsl.js +4 -4
  182. package/chunks/UnitFactory.js +1 -1
  183. package/chunks/WaterSurface.glsl.js +3 -3
  184. package/chunks/offsetOperator.js +1 -1
  185. package/chunks/sphere.js +1 -1
  186. package/chunks/vec42.js +1 -1
  187. package/config.js +1 -1
  188. package/copyright.txt +2 -20
  189. package/core/Clonable.js +1 -1
  190. package/core/accessorSupport/layerContainerType.js +1 -1
  191. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  192. package/core/libs/gl-matrix-2/math/vec4.js +1 -1
  193. package/core/quantityFormatUtils.js +1 -1
  194. package/core/unitFormatUtils.js +1 -1
  195. package/editing/geometry/coordUtils.js +5 -0
  196. package/editing/geometry/lineUtils.js +5 -0
  197. package/editing/sharedTemplates/executor/builders/equallySpaced.js +1 -1
  198. package/editing/sharedTemplates/executor/builders/pointAtIntersectionVerticesOfLine.js +1 -1
  199. package/editing/sharedTemplates/executor/builders/support/builderUtils.js +1 -1
  200. package/editing/sharedTemplates/executor/builders/support/offsetUtils.js +1 -1
  201. package/editing/sharedTemplates/executor/builders/support/shapeUtils.js +1 -1
  202. package/effects/FocusArea.js +1 -1
  203. package/geometry/coordinateFormatter.js +1 -1
  204. package/geometry/operators/gx/operatorAlphaShape.js +1 -1
  205. package/geometry/operators/gx/operatorIntegrate.js +1 -1
  206. package/geometry/operators/gx/operatorOffset.js +1 -1
  207. package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
  208. package/geometry/operators/offsetOperator.js +1 -1
  209. package/geometry/operators/support/apiConverter.js +1 -1
  210. package/geometry/operators/support/initNoPeFactory.js +1 -1
  211. package/geometry/operators/support/jsonConverter.js +1 -1
  212. package/geometry/support/sphere.js +1 -1
  213. package/graphic/KnowledgeGraphGraphicOrigin.js +1 -1
  214. package/graphic/LinkChartGraphicOrigin.js +5 -0
  215. package/graphic/isLinkChartGraphicOrigin.js +5 -0
  216. package/interfaces.d.ts +131 -12
  217. package/kernel.js +1 -1
  218. package/layers/FeatureLayer.js +1 -1
  219. package/layers/GroundLayer.js +1 -1
  220. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  221. package/layers/IntegratedMeshLayer.js +1 -1
  222. package/layers/ParquetLayer.js +1 -1
  223. package/layers/PointCloudLayer.js +1 -1
  224. package/layers/SceneLayer.js +1 -1
  225. package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
  226. package/layers/catalog/catalogUtils.js +1 -1
  227. package/layers/graphics/hydratedFeatures.js +1 -1
  228. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  229. package/layers/knowledgeGraph/nodeMovementUtils.js +5 -0
  230. package/layers/mixins/ImageryTileMixin.js +1 -1
  231. package/layers/mixins/operationalLayers.js +1 -1
  232. package/layers/support/RasterStorageInfo.js +1 -1
  233. package/layers/support/SceneFilter.js +1 -1
  234. package/layers/support/Sublayer.js +1 -1
  235. package/layers/support/layersCreator.js +1 -1
  236. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  237. package/layers/support/rasterFunctions/BandArithmeticFunction.js +1 -1
  238. package/layers/support/rasterFunctions/BaseRasterFunction.js +1 -1
  239. package/layers/support/rasterFunctions/ExtractBandFunction.js +1 -1
  240. package/layers/support/rasterFunctions/NDVIFunction.js +1 -1
  241. package/package.json +2 -2
  242. package/portal/schemas/definitions.js +1 -1
  243. package/renderers/support/RasterSymbolizer.js +1 -1
  244. package/support/basemapUtils.js +1 -1
  245. package/support/revision.js +1 -1
  246. package/views/2d/engine/Stage.js +1 -1
  247. package/views/2d/engine/webgl/Profiler.js +1 -1
  248. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  249. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  250. package/views/3d/camera/constraintUtils/distance.js +1 -1
  251. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  252. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  253. package/views/3d/layers/CSVLayerView3D.js +1 -1
  254. package/views/3d/layers/FeatureLayerView3D.js +1 -1
  255. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  256. package/views/3d/layers/GeoJSONLayerView3D.js +1 -1
  257. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  258. package/views/3d/layers/GraphicsView3D.js +1 -1
  259. package/views/3d/layers/I3SMeshView3D.js +1 -1
  260. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  261. package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
  262. package/views/3d/layers/OGCFeatureLayerView3D.js +1 -1
  263. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  264. package/views/3d/layers/RouteLayerView3D.js +1 -1
  265. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  266. package/views/3d/layers/SceneLayerView3D.js +1 -1
  267. package/views/3d/layers/StreamLayerView3D.js +1 -1
  268. package/views/3d/layers/WFSLayerView3D.js +1 -1
  269. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  270. package/views/3d/layers/graphics/ElevationAligners.js +1 -1
  271. package/views/3d/layers/graphics/ElevationContext.js +1 -1
  272. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  273. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  274. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  275. package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
  276. package/views/3d/layers/graphics/Labeler.js +1 -1
  277. package/views/3d/layers/graphics/QueryEngine.js +1 -1
  278. package/views/3d/layers/graphics/StreamController.js +1 -1
  279. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +1 -1
  280. package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
  281. package/views/3d/layers/graphics/pointUtils.js +1 -1
  282. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  283. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  284. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  285. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  286. package/views/3d/layers/support/FlowTileTree3DDebugger.js +1 -1
  287. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  288. package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
  289. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  290. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  291. package/views/3d/state/utils/navigationUtils.js +1 -1
  292. package/views/3d/support/CombinedElevationProvider.js +1 -1
  293. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  294. package/views/3d/terrain/OverlayManager.js +1 -1
  295. package/views/3d/terrain/OverlayRenderTargets.js +1 -1
  296. package/views/3d/terrain/OverlayRenderer.js +1 -1
  297. package/views/3d/terrain/SphericalPatch.js +1 -1
  298. package/views/3d/terrain/TerrainRenderer.js +1 -1
  299. package/views/3d/terrain/TerrainSurface.js +1 -1
  300. package/views/3d/terrain/Tile.js +1 -1
  301. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  302. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  303. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +2 -2
  304. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  305. package/views/3d/webgl-engine/core/FBOCacheFormats.js +1 -1
  306. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  307. package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
  308. package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutputConfiguration.js +1 -1
  309. package/views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js +1 -1
  310. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +4 -4
  311. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js +2 -0
  312. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js +1 -1
  313. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlightOverlay.js +1 -1
  314. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +2 -4
  315. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +1 -1
  316. package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
  317. package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
  318. package/views/3d/webgl-engine/effects/bloom/BloomComposition.glsl.js +1 -1
  319. package/views/3d/webgl-engine/effects/bloom/BloomCompositionTechniqueConfiguration.js +5 -0
  320. package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
  321. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  322. package/views/3d/webgl-engine/effects/geometry/ObjectAndLayerIDRenderNode.js +1 -1
  323. package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
  324. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  325. package/views/3d/webgl-engine/lib/CutFillDepth.js +5 -0
  326. package/views/3d/webgl-engine/lib/DefaultVertexBufferLayouts.js +1 -1
  327. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  328. package/views/3d/webgl-engine/lib/Material.js +1 -1
  329. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  330. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  331. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  332. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  333. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  334. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  335. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  336. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  337. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  338. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  339. package/views/3d/webgl-engine/lib/lodRendering/InstanceOctree.js +1 -1
  340. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  341. package/views/3d/webgl-engine/lib/octreeUtils.js +1 -1
  342. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  343. package/views/3d/webgl-engine/materials/DefaultTechniqueConfiguration.js +1 -1
  344. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  345. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  346. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  347. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  348. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  349. package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
  350. package/views/3d/webgl-engine/shaders/CutFillDepth.glsl.js +5 -0
  351. package/views/3d/webgl-engine/shaders/CutFillDepthTechnique.js +5 -0
  352. package/views/3d/webgl-engine/shaders/CutFillReduction.glsl.js +5 -0
  353. package/views/3d/webgl-engine/shaders/CutFillReductionTechnique.js +5 -0
  354. package/views/3d/webgl-engine/shaders/CutFillTargetDepth.glsl.js +5 -0
  355. package/views/3d/webgl-engine/shaders/CutFillTargetDepthTechnique.js +5 -0
  356. package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
  357. package/views/3d/webgl-engine/shaders/OutputColorHighlightOID.glsl.js +1 -1
  358. package/views/3d/webgl.js +1 -1
  359. package/views/LinkChartView.js +1 -1
  360. package/views/draw/DrawOperation.js +1 -1
  361. package/views/draw/support/GraphicMover.js +1 -1
  362. package/views/draw/support/HighlightHelper.js +1 -1
  363. package/views/draw/support/Reshape.js +1 -1
  364. package/views/draw/support/drawUtils.js +1 -1
  365. package/views/interactive/Tooltip.js +1 -1
  366. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  367. package/views/interactive/sketch/SketchLabelOptions.js +1 -1
  368. package/views/interactive/sketch/SketchOptions.js +1 -1
  369. package/views/interactive/sketch/SketchTooltipOptions.js +1 -1
  370. package/views/interactive/sketch/SketchTooltipVisibleElements.js +1 -1
  371. package/views/interactive/sketch/SketchValueOptions.js +1 -1
  372. package/views/interactive/sketch/Units.js +1 -1
  373. package/views/interactive/sketch/constraints.js +1 -1
  374. package/views/interactive/snapping/featureSources/FeatureCollectionSnappingSource.js +1 -1
  375. package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
  376. package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
  377. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
  378. package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
  379. package/views/interactive/tooltip/fields/fields.js +1 -1
  380. package/views/interactive/tooltip/fields/parsingAndFormattingUtils.js +1 -1
  381. package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
  382. package/views/support/angularMeasurementUtils.js +1 -1
  383. package/webdoc/support/writeUtils.js +1 -1
  384. package/webscene/spec-certification/api.js +1 -1
  385. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.js +1 -1
  386. package/widgets/Editor/EditorViewModel.js +1 -1
  387. package/widgets/Editor/support/splitFeatureUtils.js +5 -0
  388. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  389. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  390. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  391. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  392. package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
  393. package/widgets/OrientedImageryViewer/services/ImageMeasurementService.js +1 -1
  394. package/widgets/OrientedImageryViewer.js +1 -1
  395. package/widgets/Sketch.js +1 -1
  396. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
  397. package/widgets/support/SelectionToolbar/VisibleElements.js +1 -1
  398. package/widgets/support/SelectionToolbar.js +1 -1
  399. package/widgets/support/Selector2D/SelectionOperation.js +1 -1
  400. package/EULA.pdf +0 -0
  401. package/assets/esri/core/workers/chunks/0390f3aa624e3f380ce2.js +0 -1
  402. package/assets/esri/core/workers/chunks/0569698a3e4eaf2bac8e.js +0 -1
  403. package/assets/esri/core/workers/chunks/06d2251d6f6b3e44800a.js +0 -1
  404. package/assets/esri/core/workers/chunks/07eea90733834313e9fa.js +0 -1
  405. package/assets/esri/core/workers/chunks/08393d9cc2ed846dd5b4.js +0 -1
  406. package/assets/esri/core/workers/chunks/094c741fa8139c3f40cf.js +0 -1
  407. package/assets/esri/core/workers/chunks/0f51e51db83f303ce5a6.js +0 -1
  408. package/assets/esri/core/workers/chunks/171ce8c64f322cd5d6d1.js +0 -1
  409. package/assets/esri/core/workers/chunks/184d3c88ac2fc1d7e2c3.js +0 -1
  410. package/assets/esri/core/workers/chunks/1ae15163af8875148fb8.js +0 -1
  411. package/assets/esri/core/workers/chunks/1eee7cf11df01a52c1bf.js +0 -1
  412. package/assets/esri/core/workers/chunks/27197b0a2ffb2b6104ea.js +0 -1
  413. package/assets/esri/core/workers/chunks/2c0241a5958aef9cda61.js +0 -1
  414. package/assets/esri/core/workers/chunks/2ded2446700f89155ccd.js +0 -1
  415. package/assets/esri/core/workers/chunks/3264d58aeef8cf074b86.js +0 -1
  416. package/assets/esri/core/workers/chunks/3445ffd752262673fb13.js +0 -1
  417. package/assets/esri/core/workers/chunks/38f09e36e174792646bd.js +0 -1
  418. package/assets/esri/core/workers/chunks/3c57b2e13628b5c1f6de.js +0 -1
  419. package/assets/esri/core/workers/chunks/4162c633efefc63c5506.js +0 -1
  420. package/assets/esri/core/workers/chunks/435169b455fd2846799b.js +0 -1
  421. package/assets/esri/core/workers/chunks/44dc7ec52c4abb700783.js +0 -1
  422. package/assets/esri/core/workers/chunks/4558f2e3e77831758fdc.js +0 -1
  423. package/assets/esri/core/workers/chunks/4fc267552939583a81a0.js +0 -1
  424. package/assets/esri/core/workers/chunks/527557b603400189d49a.js +0 -1
  425. package/assets/esri/core/workers/chunks/53873f26a2c24cd75e4a.js +0 -1
  426. package/assets/esri/core/workers/chunks/554c789f4e875d7e6fd5.js +0 -1
  427. package/assets/esri/core/workers/chunks/561a2078458bc0339f83.js +0 -1
  428. package/assets/esri/core/workers/chunks/5f28470304b57e24d94c.js +0 -1
  429. package/assets/esri/core/workers/chunks/61a294f9411bf884f2ab.js +0 -1
  430. package/assets/esri/core/workers/chunks/6acffacbb4a03af52e3b.js +0 -1
  431. package/assets/esri/core/workers/chunks/719450ccd455f503d81a.js +0 -1
  432. package/assets/esri/core/workers/chunks/71cac356874b36f9a383.js +0 -1
  433. package/assets/esri/core/workers/chunks/7388e8c905d93dea1c05.js +0 -1
  434. package/assets/esri/core/workers/chunks/749c7159e0902388e828.js +0 -1
  435. package/assets/esri/core/workers/chunks/7714228825fb44d506df.js +0 -1
  436. package/assets/esri/core/workers/chunks/77ee4afaa4a1c7047940.js +0 -1
  437. package/assets/esri/core/workers/chunks/790e97ddbe318bc75415.js +0 -1
  438. package/assets/esri/core/workers/chunks/8762928d10c3821738ad.js +0 -1
  439. package/assets/esri/core/workers/chunks/8ead467a5af0d9bba804.js +0 -1
  440. package/assets/esri/core/workers/chunks/91e04d03b0013bcaad82.js +0 -1
  441. package/assets/esri/core/workers/chunks/92b60d4fb09711919601.js +0 -1
  442. package/assets/esri/core/workers/chunks/9940e59033a8a1eff2a9.js +0 -1
  443. package/assets/esri/core/workers/chunks/998c38974372720b1c52.js +0 -1
  444. package/assets/esri/core/workers/chunks/9b10e70f28873cff44f5.js +0 -1
  445. package/assets/esri/core/workers/chunks/9b5e04d87116ce2b68b2.js +0 -1
  446. package/assets/esri/core/workers/chunks/9d920f3488d59e7f276c.js +0 -1
  447. package/assets/esri/core/workers/chunks/a999f804fc2f00b2e7ae.js +0 -1
  448. package/assets/esri/core/workers/chunks/acf13a64df2991a4cb6b.js +0 -1
  449. package/assets/esri/core/workers/chunks/b457b7dd907f06278bee.js +0 -1
  450. package/assets/esri/core/workers/chunks/b5640f9623a9c9ded92a.js +0 -1
  451. package/assets/esri/core/workers/chunks/b8158c681456d4cf2395.js +0 -1
  452. package/assets/esri/core/workers/chunks/bbdbb618a18542f7a4a2.js +0 -1
  453. package/assets/esri/core/workers/chunks/bead38898c3f4d4d3569.js +0 -1
  454. package/assets/esri/core/workers/chunks/c51e2a048df152abd901.js +0 -1
  455. package/assets/esri/core/workers/chunks/c86e339e45900c54c9f5.js +0 -1
  456. package/assets/esri/core/workers/chunks/ca7c9756802214e41c56.js +0 -1
  457. package/assets/esri/core/workers/chunks/cb8f2ce22274990b359c.js +0 -1
  458. package/assets/esri/core/workers/chunks/d6ab4d55f1023ee6ec6a.js +0 -1
  459. package/assets/esri/core/workers/chunks/db2b8d8cf7131554cf7e.js +0 -1
  460. package/assets/esri/core/workers/chunks/e7ccf067bea8f4766424.js +0 -1
  461. package/assets/esri/core/workers/chunks/f1c50f37a81c672263a1.js +0 -1
  462. package/assets/esri/core/workers/chunks/ff323db554c9e09749e8.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import r from"../../../../Graphic.js";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import i from"../../../../geometry/Polygon.js";import{toExtent as s}from"../../../../geometry/support/aaBoundingRect.js";import l from"../../../../symbols/SimpleFillSymbol.js";import{TileTreeDebugger as a}from"../../../support/TileTreeDebugger.js";let p=class extends a{get _flowSubView(){const{layerView:e}=this;return"imagery-3d"===e.type?e.test.subView:e.test.flowSubView}constructor(e,r=!0){super(e),this._fullExtentGraphic=null,this.enableLabels=r}clear(){super.clear(),this._fullExtentGraphic&&(this.view.graphics.remove(this._fullExtentGraphic),this._fullExtentGraphic=null)}update(){super.update();const e=this._flowSubView.layer.fullExtent;this._fullExtentGraphic=new r({geometry:e,symbol:new l({color:[0,0,0,0],outline:{color:"black",width:3}})}),this.view.graphics.add(this._fullExtentGraphic)}getTiles(){const e=null!=this.view.basemapTerrain.spatialReference?this.view.basemapTerrain.spatialReference:null,r=this._flowSubView.test.renderedTiles;return this.view.basemapTerrain.test.getRenderedTiles().map(t=>{const o=r?.has(t)?[0,255,0,.3]:[255,0,0,.3],a=new l({color:o,outline:{color:"black",width:1}});return{...t,lij:t.lij,level:t.level,geometry:i.fromExtent(s(t.extent,e)),label:t.lij.toString(),polygonSymbol:a}})}};e([t()],p.prototype,"layerView",void 0),p=e([o("esri.views.3d.layers.support.FlowTileTree3DDebugger")],p);export{p as FlowTileTree3DDebugger};
5
+ import{__decorate as e}from"tslib";import t from"../../../../Graphic.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import l from"../../../../geometry/Polygon.js";import{toExtent as i}from"../../../../geometry/support/aaBoundingRect.js";import s from"../../../../symbols/SimpleFillSymbol.js";import{tileToKey as a}from"../../support/flow/loadUtils.js";import{TileTreeDebugger as p}from"../../../support/TileTreeDebugger.js";let n=class extends p{get _flowSubView(){const{layerView:e}=this;return"imagery-3d"===e.type?e.test.subView:e.test.flowSubView}constructor(e,t=!0){super(e),this._fullExtentGraphic=null,this.enableLabels=t}clear(){super.clear(),this._fullExtentGraphic&&(this.view.graphics.remove(this._fullExtentGraphic),this._fullExtentGraphic=null)}update(){super.update();const e=this._flowSubView.layer.fullExtent;this._fullExtentGraphic=new t({geometry:e,symbol:new s({color:[0,0,0,0],outline:{color:"black",width:3}})}),this.view.graphics.add(this._fullExtentGraphic)}getTiles(){const e=null!=this.view.basemapTerrain.spatialReference?this.view.basemapTerrain.spatialReference:null,t=this._flowSubView.test.renderedTiles,r=this.view.basemapTerrain.test.getRenderedTiles();let o=null;if("imagery-tile"===this._flowSubView.layer.type){const e=this._flowSubView;o=e.test.loadedTiles}return r.map(r=>{const a=this._getColor(r,t,o),p=new s({color:a,outline:{color:"black",width:1}});return{...r,lij:r.lij,level:r.level,geometry:l.fromExtent(i(r.extent,e)),label:r.lij.toString(),polygonSymbol:p}})}_getColor(e,t,r){const o=.1;return null!=t&&t.has(e)?null==r||r.has(a(e))?[0,255,0,o]:[255,165,0,o]:[255,0,0,o]}};e([r()],n.prototype,"layerView",void 0),n=e([o("esri.views.3d.layers.support.FlowTileTree3DDebugger")],n);export{n as FlowTileTree3DDebugger};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../core/Evented.js";import r from"../../../../core/Logger.js";import{getMetersPerVerticalUnitForSR as o}from"../../../../core/unitUtils.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as a,toRect as l,expandWithVec3 as c}from"../../../../geometry/support/aaBoundingBox.js";import{getMetersPerUnit as d}from"../../../../symbols/support/unitConversionUtils.js";import{ElevationUpdateEvent as p}from"../../support/ElevationUpdateEvent.js";import{Intersector as m}from"../../webgl-engine/lib/Intersector.js";import{affectsGeometry as h}from"../../webgl-engine/lib/VertexAttribute.js";const u=1,f=Symbol("layerHandles");let g=class extends t{get spatialReference(){return this.view?.spatialReference}constructor(e){super(e),this._elevationOffset=0}initialize(){this._renderCoordsHelper=this.view.renderCoordsHelper,this._intersectLayers=[this.stageLayer],this._intersector=new m(this.view.state.viewingMode),this._intersector.options.store=0;const e=this._computeLayerExtent(this.spatialReference,this.stageLayer);this._zmin=e[2],this._zmax=e[5];const t=this.stageLayer.events;this.addHandles([t.on(["layerObjectAdded","layerObjectRemoved","transformationChanged","shaderTransformationChanged"],e=>this._objectChanged(e)),t.on(["geometryAdded","geometryRemoved"],({object:e})=>this._objectChanged(e)),t.on("attributesChanged",({attribute:e,object:t})=>h(e)&&this._objectChanged(t))],f)}dispose(){this.removeHandles(f)}elevationInfoChanged(){const e=null!=this.layer?this.layer.elevationInfo:null;if(null!=e&&"on-the-ground"!==e.mode){const t=o(this.layer.spatialReference),r=d(e.unit??"meters");this._elevationOffset=(e.offset??0)*r/t}else this._elevationOffset=0}getElevation(e,t,o,s){if(x[0]=e,x[1]=t,x[2]=o,!this._renderCoordsHelper.toRenderCoords(x,s,x))return r.getLogger(this).error("could not project point for elevation alignment"),null;const i=this._elevationOffset,n=this._zmin+i,a=this._zmax+i;this._renderCoordsHelper.setAltitude(b,a,x),this._renderCoordsHelper.setAltitude(j,n,x);const l=e=>!!e.lastValidElevationBB;return this._intersector.reset(b,j,null),this._intersector.intersect(this._intersectLayers,null,u,null,l),this._intersector.results.min.getIntersectionPoint(x)?this._renderCoordsHelper.getAltitude(x):null}_objectChanged(e){const t=this.spatialReference;if(!e.lastValidElevationBB||!t)return;a(_);const r=e.lastValidElevationBB;r.isEmpty()||this._expandExtent(t,r.min,r.max,_);const{min:o,max:s}=e.boundingVolumeWorldSpace;this._expandExtent(t,o,s,_),l(_,v.extent),this._zmin=Math.min(this._zmin,_[2]),this._zmax=Math.max(this._zmax,_[5]),v.spatialReference=t,this.emit("elevation-change",v),v.spatialReference=null,r.assignMinMax(o,s)}_computeLayerExtent(e,t){return a(_),null!=e&&t.objects.forEach(t=>this._expandExtent(e,t.boundingVolumeWorldSpace.min,t.boundingVolumeWorldSpace.max,_)),_}_expandExtent(e,t,r,o){for(let s=0;s<8;++s)x[0]=1&s?t[0]:r[0],x[1]=2&s?t[1]:r[1],x[2]=4&s?t[2]:r[2],this._renderCoordsHelper.fromRenderCoords(x,x,e),c(o,x);return o}};e([s({constructOnly:!0})],g.prototype,"layer",void 0),e([s({constructOnly:!0})],g.prototype,"stageLayer",void 0),e([s({constructOnly:!0})],g.prototype,"view",void 0),e([s()],g.prototype,"spatialReference",null),g=e([i("esri.views.3d.layers.support.StageLayerElevationProvider")],g);const _=a(),v=new p;function y(){v.spatialReference=null}const x=n(),b=n(),j=n();export{g as StageLayerElevationProvider,y as cleanupStageLayerElevationProvider};
5
+ import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../core/Evented.js";import r from"../../../../core/Logger.js";import{getMetersPerVerticalUnitForSR as o}from"../../../../core/unitUtils.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as a,toRect as l,expandWithVec3 as c}from"../../../../geometry/support/aaBoundingBox.js";import{getMetersPerUnit as d}from"../../../../symbols/support/unitConversionUtils.js";import{ElevationUpdateEvent as p}from"../../support/ElevationUpdateEvent.js";import{Intersector as m}from"../../webgl-engine/lib/Intersector.js";import{affectsGeometry as h}from"../../webgl-engine/lib/VertexAttribute.js";const u=1,f=Symbol("layerHandles");let g=class extends t{get spatialReference(){return this.view.spatialReference}constructor(e){super(e),this._elevationOffset=0}initialize(){this._renderCoordsHelper=this.view.renderCoordsHelper,this._intersectLayers=[this.stageLayer],this._intersector=new m(this.view.state.viewingMode),this._intersector.options.store=0;const e=this._computeLayerExtent(this.spatialReference,this.stageLayer);this._zmin=e[2],this._zmax=e[5];const t=this.stageLayer.events;this.addHandles([t.on(["layerObjectAdded","layerObjectRemoved","transformationChanged","shaderTransformationChanged"],e=>this._objectChanged(e)),t.on(["geometryAdded","geometryRemoved"],({object:e})=>this._objectChanged(e)),t.on("attributesChanged",({attribute:e,object:t})=>h(e)&&this._objectChanged(t))],f)}dispose(){this.removeHandles(f)}elevationInfoChanged(){const e=null!=this.layer?this.layer.elevationInfo:null;if(null!=e&&"on-the-ground"!==e.mode){const t=o(this.layer.spatialReference),r=d(e.unit??"meters");this._elevationOffset=(e.offset??0)*r/t}else this._elevationOffset=0}getElevation(e,t,o,s){if(x[0]=e,x[1]=t,x[2]=o,!this._renderCoordsHelper.toRenderCoords(x,s,x))return r.getLogger(this).error("could not project point for elevation alignment"),null;const i=this._elevationOffset,n=this._zmin+i,a=this._zmax+i;this._renderCoordsHelper.setAltitude(b,a,x),this._renderCoordsHelper.setAltitude(j,n,x);const l=e=>!!e.lastValidElevationBB;return this._intersector.reset(b,j,null),this._intersector.intersect(this._intersectLayers,null,u,null,l),this._intersector.results.min.getIntersectionPoint(x)?this._renderCoordsHelper.getAltitude(x):null}_objectChanged(e){const t=this.spatialReference;if(!e.lastValidElevationBB||!t)return;a(_);const r=e.lastValidElevationBB;r.isEmpty()||this._expandExtent(t,r.min,r.max,_);const{min:o,max:s}=e.boundingVolumeWorldSpace;this._expandExtent(t,o,s,_),l(_,v.extent),this._zmin=Math.min(this._zmin,_[2]),this._zmax=Math.max(this._zmax,_[5]),v.spatialReference=t,this.emit("elevation-change",v),v.spatialReference=null,r.assignMinMax(o,s)}_computeLayerExtent(e,t){return a(_),null!=e&&t.objects.forEach(t=>this._expandExtent(e,t.boundingVolumeWorldSpace.min,t.boundingVolumeWorldSpace.max,_)),_}_expandExtent(e,t,r,o){for(let s=0;s<8;++s)x[0]=1&s?t[0]:r[0],x[1]=2&s?t[1]:r[1],x[2]=4&s?t[2]:r[2],this._renderCoordsHelper.fromRenderCoords(x,x,e),c(o,x);return o}};e([s({constructOnly:!0})],g.prototype,"layer",void 0),e([s({constructOnly:!0})],g.prototype,"stageLayer",void 0),e([s({constructOnly:!0})],g.prototype,"view",void 0),e([s()],g.prototype,"spatialReference",null),g=e([i("esri.views.3d.layers.support.StageLayerElevationProvider")],g);const _=a(),v=new p;function y(){v.spatialReference=null}const x=n(),b=n(),j=n();export{g as StageLayerElevationProvider,y as cleanupStageLayerElevationProvider};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Graphic.js";import i from"../../../../graphic/IntegratedMesh3DTilesGraphicOrigin.js";import{Tiles3DTarget as r}from"../i3s/Intersector.js";import{IntersectorResult as t}from"../../webgl-engine/lib/IntersectorResult.js";import{MeshIntersectionOptions as s}from"../../webgl-engine/lib/RayIntersections.js";class n{constructor(e){this.type=8,this.slicePlaneEnabled=!1,this.isGround=!0,this.layerView=e,this.layerViewUid=e.uid,this._graphicOrigin=new i(this.layerView.layer)}intersect(e,i,n,l,o,a){if(e.options.filteredLayerViewUids.includes(this.layerView.uid))return;const c=e.results,h=2===e.options.store,u=this.layerView.view.stage.renderView.componentObjectCollection,d=new s(a,e.options.normalRequired);this.layerView.objects.forEach(s=>{s.visible&&s.intersectionGeometry&&u.intersect(s,n,l,e.tolerance,null,d,(s,o,a,u)=>{if(o>=0){if(null!=i&&!i(n,l,o))return;const s=e=>{const i=new r(this.layerView.layer.uid,()=>this._createTiles3DGraphic(this.layerView.layer,{}));e.set(this.type,i,o,a)};if(this.isGround&&(null==c.ground.distance||o<c.ground.distance)&&s(c.ground),e.options.isFiltered)return;if((null==c.min.distance||o<c.min.distance)&&s(c.min),(null==c.max.distance||o>c.max.distance)&&s(c.max),h){const i=new t(e.ray);s(i),e.results.all.push(i)}}})})}_createTiles3DGraphic(i,r){return new e({layer:i,sourceLayer:i,origin:this._graphicOrigin,attributes:r})}}export{n as Tiles3DIntersectionHandler};
5
+ import e from"../../../../Graphic.js";import{Tiles3DTarget as i}from"../i3s/Intersector.js";import{IntersectorResult as t}from"../../webgl-engine/lib/IntersectorResult.js";import{MeshIntersectionOptions as r}from"../../webgl-engine/lib/RayIntersections.js";class s{constructor(e){this.type=8,this.slicePlaneEnabled=!1,this.isGround=!0,this.layerView=e,this.layerViewUid=e.uid,this._graphicOrigin=e.layer.graphicOrigin}intersect(e,s,n,l,o,a){if(e.options.filteredLayerViewUids.includes(this.layerView.uid))return;const c=e.results,u=2===e.options.store,h=this.layerView.view.stage.renderView.componentObjectCollection,d=new r(a,e.options.normalRequired);this.layerView.objects.forEach(r=>{r.visible&&r.intersectionGeometry&&h.intersect(r,n,l,e.tolerance,null,d,(r,o,a,h)=>{if(o>=0){if(null!=s&&!s(n,l,o))return;const r=e=>{const t=new i(this.layerView.layer.uid,()=>this._createTiles3DGraphic(this.layerView.layer,{}));e.set(this.type,t,o,a)};if(this.isGround&&(null==c.ground.distance||o<c.ground.distance)&&r(c.ground),e.options.isFiltered)return;if((null==c.min.distance||o<c.min.distance)&&r(c.min),(null==c.max.distance||o>c.max.distance)&&r(c.max),u){const i=new t(e.ray);r(i),e.results.all.push(i)}}})})}_createTiles3DGraphic(i,t){return new e({layer:i,sourceLayer:i,origin:this._graphicOrigin,attributes:t})}}export{s as Tiles3DIntersectionHandler};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{neverReached as e}from"../../../../core/compilerUtils.js";import{clamp as i,acosClamped as a,deg2rad as r}from"../../../../core/mathUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{translate as n,rotate as c,identity as m}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d as h,t as p,f as d,g as u,c as f,u as _,l as v,i as g,n as C,h as y,j as w,E as b,e as S}from"../../../../chunks/vec32.js";import{create as O}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as x}from"../../../../geometry/ellipsoidUtils.js";import{wrap as j}from"../../../../geometry/support/ray.js";import{h as M,b as z,t as T}from"../../../../chunks/sphere.js";import{angle as A}from"../../../../geometry/support/vector.js";import{sv3d as R}from"../../../../geometry/support/vectorStacks.js";import{applyAll as D}from"../../camera/constraintUtils.js";import{ConstraintOptions as E}from"../../camera/constraintUtils/ConstraintOptions.js";import{TiltRange as H}from"../Constraints.js";import{InteractiveController as k}from"./InteractiveController.js";import{panMotionToRotationMatrix as U,onSurfaceTiltToEyeTiltGlobal as G,offSurfaceTiltToEyeTiltGlobal as F}from"../utils/navigationUtils.js";import{viewAngle as P}from"../utils/viewUtils.js";import{headingTiltToDirectionUp as B}from"../../support/cameraUtils.js";import{createDirectionUp as I}from"../../support/cameraUtilsInternal.js";import V from"../../webgl/RenderCamera.js";import{extractTransformation as L,isZeroTransformation as q,extractTransformationKeyboard as K}from"../../../navigation/gamepadAndKeyboardUtils.js";let Z=class extends k{constructor(t){super(t),this._filteredSurfaceElevation=0,this._transformation={translation:[0,0,0],heading:0,tilt:0,zoom:0},this._keysButtonState=[0,0,0,0,0,0,0,0,0,0,0,0],this._tmpCamera=new V,this._headingStart=0,this._constraintOptions=new E(15,0,0,new V,null,1)}handleEventGamepad(t){const e=L(t,this.view.navigation.gamepad,this._transformation);("end"===t.action||q(e))&&this.finishController()}activateDirection(t){this._keysButtonState[t]=1,K(this._keysButtonState,this._transformation)}directionActive(t){return 1===this._keysButtonState[t]}countActiveDirections(){return this._keysButtonState.reduce((t,e)=>e>0?t+1:t,0)}deactivateDirection(t){this._keysButtonState[t]=0;const e=K(this._keysButtonState,this._transformation);q(e)&&this.finishController()}onControllerStart(t){this._filteredSurfaceElevation=this.view.pointsOfInterest.cameraOnSurface.location.z,this._headingStart=this.view.camera.heading,super.onControllerStart(t)}_updateFilteredSurfaceElevation(t){const e=this.view.pointsOfInterest.cameraOnSurface.location.z,i=1;this._filteredSurfaceElevation+=i*(e-this._filteredSurfaceElevation)*t}stepController(t,e){this._updateStartHeading(),this._updateFilteredSurfaceElevation(t),this.currentCamera.copyViewFrom(e),this._updateCameraCenter(),this._constraintOptions.interactionStartCamera?.copyFrom(this.currentCamera),this._calculateControlTransformation(t,this.currentCamera,tt),this._applyDisabledMovementTypes(tt),this._applyPan(tt.pan),this._applyRotate(tt.rotate),this._applyZoom(tt.zoom),this._applyAscend(tt.ascend),this._constraintOptions.interactionType=0,this._constraintOptions.selection=8,D(this.view,this.currentCamera,this._constraintOptions),super.stepController(t,e)}_updateStartHeading(){0!==this._transformation.heading&&(this._headingStart=this.view.camera.heading)}_applyRotate(t){if(!t.enabled)return;const e=this.currentCamera;h(et,e.center,e.eye),p(et,et,t.matrix),e.center=d(et,et,e.eye),e.up=p(et,e.up,t.matrix),this._constraintOptions.interactionType=3,this._constraintOptions.selection=7,D(this.view,e,this._constraintOptions)}_applyPan(t,e=this.currentCamera){if(!t.enabled)return;e.eye=p(et,e.eye,t.matrix),e.center=p(et,e.center,t.matrix);this.view.state.isGlobal&&(e.up=p(et,e.up,t.matrix)),this._constraintOptions.interactionType=4,this._constraintOptions.selection=15,D(this.view,e,this._constraintOptions)}_applyZoom(t){if(!t)return;const e=this.currentCamera.viewForward;this.currentCamera.eye=d(et,this.currentCamera.eye,u(R.get(),e,t)),f(it,e),_(it,it),this._constraintOptions.interactionDirection=it,this._constraintOptions.interactionType=1,this._constraintOptions.selection=7,D(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_applyAscend(t){if(!t)return;const e=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,R.get());this._constraintOptions.interactionDirection=f(it,e);if(this.view.state.isGlobal){const e=v(this.currentCamera.eye),i=(e+t)/e;this.currentCamera.eye=u(et,this.currentCamera.eye,i),this.currentCamera.center=u(et,this.currentCamera.center,i)}else{const i=u(R.get(),e,t);this.currentCamera.eye=d(et,this.currentCamera.eye,i),this.currentCamera.center=d(et,this.currentCamera.center,i)}this._updateCameraCenter(),this._constraintOptions.interactionType=5,this._constraintOptions.selection=8,D(this.view,this.currentCamera,this._constraintOptions)&&this._updateCameraCenter(),this._constraintOptions.selection=7,D(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_calculateControlTransformation(t,e,i){rt(i);const a=this._computeVelocities(t);this.view.state.isLocal?this._calculateControlTransformationLocal(a,e,i):this._calculateControlTransformationGlobal(a,e,i)}_updateCameraCenter(){const t=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,e=this.view.renderCoordsHelper,i=this.currentCamera.ray;this.currentCamera.center=e.intersectManifoldClosestSilhouette(i,t,et)}_calculateControlTransformationLocal(t,a,r){const{viewRight:o,viewForward:s}=a,m=this._transformation,l=this.view.navigation.gamepad,h=g(R.get(),s[0],s[1],0);C(h,h);const p=m.translation[0]*t.pan;if(0!==p){const t=u(R.get(),o,p);n(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}switch(l.mode){case"pan":{const e=-m.translation[1]*t.pan;if(0!==e){const t=u(R.get(),h,e);n(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}r.zoom=m.zoom*t.zoom;break}case"zoom":r.zoom=(-m.translation[1]+m.zoom)*t.zoom;break;default:e(l.mode)}const d=m.translation[2]*t.ascend;r.ascend=d;const f=-m.heading*t.rotate;0!==f&&(c(r.rotate.matrix,r.rotate.matrix,f,this.view.renderCoordsHelper.worldUpAtPosition(a.eye,R.get())),r.rotate.enabled=!0);const _=m.tilt*t.rotate,v=P(this.view.renderCoordsHelper,a.center,a.eye),y=i(v+_,H.min,H.max)-v;y&&(c(r.rotate.matrix,r.rotate.matrix,y,o),r.rotate.enabled=!0)}_calculateControlTransformationGlobal(t,e,i){const{eye:a,viewRight:r}=e,o=this._transformation,s=this.view.navigation.gamepad,n=y(R.get(),r,a);C(n,n),_(n,n),U(this.startCamera,e,o,t,this.view.camera.heading,this._headingStart,this.view.camera.tilt,i,s),this._tmpCamera.copyFrom(this.currentCamera),this._applyPan(tt.pan,this._tmpCamera);const m=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,l=o.translation[2]*t.ascend;i.ascend=l;const h=-o.heading*t.rotate;0!==h&&(c(i.rotate.matrix,i.rotate.matrix,h,this._tmpCamera.eye),i.rotate.enabled=!0);const p=o.tilt*t.rotate,d=this._clampTiltDeltaGlobalToValidRange(p,e.ray,m);0!==d&&(c(i.rotate.matrix,i.rotate.matrix,d,this._tmpCamera.viewRight),i.rotate.enabled=!0),i.zoom+=o.zoom*t.zoom}_clampTiltDeltaGlobalToValidRange(t,e,a){const r=x(this.view.spatialReference),o=G(H.min,e.origin,a,r);let s=0,n=0;const c=R.get();if(this.view.renderCoordsHelper.intersectManifold(e,a,c)){const t=P(this.view.renderCoordsHelper,c,e.origin);s=G(t,e.origin,a,r),n=G(H.max,e.origin,a,r)}else{M(z(T,a+r.radius),e,c);const t=Math.PI+A(e.direction,c);s=F(t,e.origin,a,r),n=F(H.max,e.origin,a,r)}return i(s+t,o,n)-s}_getPointAbsoluteSurfaceElevation(t,e,i){const{renderCoordsHelper:a}=this.view,r=a.getAltitude(t),o=e+Math.abs(r-e);return a.setAltitude(i,o,t),o}_clampedDistanceToSurface(t,e){const{renderCoordsHelper:i}=this.view,{camera:a}=this.view.state,{direction:r}=B(this.view,e,0,J,at),o=i.intersectManifoldClosestSilhouette(j(e,r),t,R.get()),s=w(e,o),n=i.intersectManifoldClosestSilhouette(j(e,b(R.get(),e,a.center)),t,R.get()),c=w(e,n);return Math.min(s,c)}_computeHeadingRotateRadius(t){const{renderCoordsHelper:e,state:i}=this.view,{camera:r,isGlobal:o}=i,s=e.intersectManifoldClosestSilhouette(r.ray,this._filteredSurfaceElevation,R.get());if(o){const e=h(R.get(),t,s),i=v(e);u(e,e,1/i);const r=C(R.get(),t),o=a(S(r,e));return i*Math.sin(Math.min(N,o))}{const i=f(R.get(),t);return e.setAltitude(i,this._filteredSurfaceElevation),w(s,i)}}_minimumAscendVelocity(){return this.view.state.constraints.collision.enabled?0:W}_computeVelocities(t){const e=this._filteredSurfaceElevation,a=e+x(this.view.spatialReference).radius,{camera:r,isGlobal:o}=this.view.state,s=R.get(),n=this._getPointAbsoluteSurfaceElevation(r.eye,e,s),c=this._clampedDistanceToSurface(e,s),m=r.width/2,l=Q*r.width,h=Q*r.width,p=c*Math.tan(.5*r.fovX)/m,d=p/a,u=p/this._computeHeadingRotateRadius(s),f=n-e;return{pan:(o?d:p)*l*t,ascend:Math.max(this._minimumAscendVelocity()*t,2**(l*t/m)*f-f),zoom:2**(l*t/m)*c-c,rotate:i(u*h,Y,$)*t}}_applyDisabledMovementTypes(t){null==this.disableMovements||void 0!==this.disableMovements.mode&&this.view.state.viewingMode!==this.disableMovements.mode||(t.zoom=this.disableMovements.zoom?0:t.zoom,t.ascend=this.disableMovements.ascend?0:t.ascend,t.pan.enabled=!this.disableMovements.pan,this.disableMovements.pan&&m(t.pan.matrix),t.rotate.enabled=!this.disableMovements.rotate,this.disableMovements.rotate&&m(t.rotate.matrix))}static activatesFor(t,e){const i=L(e,t.navigation.gamepad,X);return!("end"===e.action||q(i))}};t([o({constructOnly:!0})],Z.prototype,"gamepadDevice",void 0),t([o({constructOnly:!0})],Z.prototype,"disableMovements",void 0),Z=t([s("esri.views.3d.state.controllers.GamepadKeyboardController")],Z);const X={translation:[0,0,0],heading:0,tilt:0,zoom:0},J=80,N=r(J),Q=.75,W=5,Y=r(30),$=r(80),tt={zoom:0,ascend:0,pan:{enabled:!1,matrix:l()},rotate:{enabled:!1,matrix:l()}},et=O(),it=O(),at=I();function rt(t){t.zoom=0,t.ascend=0,t.pan.enabled=!1,m(t.pan.matrix),t.rotate.enabled=!1,m(t.rotate.matrix)}export{Z as GamepadKeyboardController};
5
+ import{__decorate as t}from"tslib";import{neverReached as e}from"../../../../core/compilerUtils.js";import{clamp as i,acosClamped as a,deg2rad as r}from"../../../../core/mathUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{translate as n,rotate as c,identity as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d as h,t as p,f as d,g as u,c as f,u as _,l as v,i as g,n as C,h as y,j as w,E as b,e as S}from"../../../../chunks/vec32.js";import{create as O}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as x}from"../../../../geometry/ellipsoidUtils.js";import{wrap as j}from"../../../../geometry/support/ray.js";import{l as M,b as z,t as T}from"../../../../chunks/sphere.js";import{angle as A}from"../../../../geometry/support/vector.js";import{sv3d as R}from"../../../../geometry/support/vectorStacks.js";import{applyAll as D}from"../../camera/constraintUtils.js";import{ConstraintOptions as E}from"../../camera/constraintUtils/ConstraintOptions.js";import{TiltRange as H}from"../Constraints.js";import{InteractiveController as k}from"./InteractiveController.js";import{panMotionToRotationMatrix as U,onSurfaceTiltToEyeTiltGlobal as G,offSurfaceTiltToEyeTiltGlobal as F}from"../utils/navigationUtils.js";import{viewAngle as P}from"../utils/viewUtils.js";import{headingTiltToDirectionUp as B}from"../../support/cameraUtils.js";import{createDirectionUp as I}from"../../support/cameraUtilsInternal.js";import V from"../../webgl/RenderCamera.js";import{extractTransformation as L,isZeroTransformation as q,extractTransformationKeyboard as K}from"../../../navigation/gamepadAndKeyboardUtils.js";let Z=class extends k{constructor(t){super(t),this._filteredSurfaceElevation=0,this._transformation={translation:[0,0,0],heading:0,tilt:0,zoom:0},this._keysButtonState=[0,0,0,0,0,0,0,0,0,0,0,0],this._tmpCamera=new V,this._headingStart=0,this._constraintOptions=new E(15,0,0,new V,null,1)}handleEventGamepad(t){const e=L(t,this.view.navigation.gamepad,this._transformation);("end"===t.action||q(e))&&this.finishController()}activateDirection(t){this._keysButtonState[t]=1,K(this._keysButtonState,this._transformation)}directionActive(t){return 1===this._keysButtonState[t]}countActiveDirections(){return this._keysButtonState.reduce((t,e)=>e>0?t+1:t,0)}deactivateDirection(t){this._keysButtonState[t]=0;const e=K(this._keysButtonState,this._transformation);q(e)&&this.finishController()}onControllerStart(t){this._filteredSurfaceElevation=this.view.pointsOfInterest.cameraOnSurface.location.z,this._headingStart=this.view.camera.heading,super.onControllerStart(t)}_updateFilteredSurfaceElevation(t){const e=this.view.pointsOfInterest.cameraOnSurface.location.z,i=1;this._filteredSurfaceElevation+=i*(e-this._filteredSurfaceElevation)*t}stepController(t,e){this._updateStartHeading(),this._updateFilteredSurfaceElevation(t),this.currentCamera.copyViewFrom(e),this._updateCameraCenter(),this._constraintOptions.interactionStartCamera?.copyFrom(this.currentCamera),this._calculateControlTransformation(t,this.currentCamera,tt),this._applyDisabledMovementTypes(tt),this._applyPan(tt.pan),this._applyRotate(tt.rotate),this._applyZoom(tt.zoom),this._applyAscend(tt.ascend),this._constraintOptions.interactionType=0,this._constraintOptions.selection=8,D(this.view,this.currentCamera,this._constraintOptions),super.stepController(t,e)}_updateStartHeading(){0!==this._transformation.heading&&(this._headingStart=this.view.camera.heading)}_applyRotate(t){if(!t.enabled)return;const e=this.currentCamera;h(et,e.center,e.eye),p(et,et,t.matrix),e.center=d(et,et,e.eye),e.up=p(et,e.up,t.matrix),this._constraintOptions.interactionType=3,this._constraintOptions.selection=7,D(this.view,e,this._constraintOptions)}_applyPan(t,e=this.currentCamera){if(!t.enabled)return;e.eye=p(et,e.eye,t.matrix),e.center=p(et,e.center,t.matrix);this.view.state.isGlobal&&(e.up=p(et,e.up,t.matrix)),this._constraintOptions.interactionType=4,this._constraintOptions.selection=15,D(this.view,e,this._constraintOptions)}_applyZoom(t){if(!t)return;const e=this.currentCamera.viewForward;this.currentCamera.eye=d(et,this.currentCamera.eye,u(R.get(),e,t)),f(it,e),_(it,it),this._constraintOptions.interactionDirection=it,this._constraintOptions.interactionType=1,this._constraintOptions.selection=7,D(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_applyAscend(t){if(!t)return;const e=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,R.get());this._constraintOptions.interactionDirection=f(it,e);if(this.view.state.isGlobal){const e=v(this.currentCamera.eye),i=(e+t)/e;this.currentCamera.eye=u(et,this.currentCamera.eye,i),this.currentCamera.center=u(et,this.currentCamera.center,i)}else{const i=u(R.get(),e,t);this.currentCamera.eye=d(et,this.currentCamera.eye,i),this.currentCamera.center=d(et,this.currentCamera.center,i)}this._updateCameraCenter(),this._constraintOptions.interactionType=5,this._constraintOptions.selection=8,D(this.view,this.currentCamera,this._constraintOptions)&&this._updateCameraCenter(),this._constraintOptions.selection=7,D(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_calculateControlTransformation(t,e,i){rt(i);const a=this._computeVelocities(t);this.view.state.isLocal?this._calculateControlTransformationLocal(a,e,i):this._calculateControlTransformationGlobal(a,e,i)}_updateCameraCenter(){const t=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,e=this.view.renderCoordsHelper,i=this.currentCamera.ray;this.currentCamera.center=e.intersectManifoldClosestSilhouette(i,t,et)}_calculateControlTransformationLocal(t,a,r){const{viewRight:o,viewForward:s}=a,l=this._transformation,m=this.view.navigation.gamepad,h=g(R.get(),s[0],s[1],0);C(h,h);const p=l.translation[0]*t.pan;if(0!==p){const t=u(R.get(),o,p);n(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}switch(m.mode){case"pan":{const e=-l.translation[1]*t.pan;if(0!==e){const t=u(R.get(),h,e);n(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}r.zoom=l.zoom*t.zoom;break}case"zoom":r.zoom=(-l.translation[1]+l.zoom)*t.zoom;break;default:e(m.mode)}const d=l.translation[2]*t.ascend;r.ascend=d;const f=-l.heading*t.rotate;0!==f&&(c(r.rotate.matrix,r.rotate.matrix,f,this.view.renderCoordsHelper.worldUpAtPosition(a.eye,R.get())),r.rotate.enabled=!0);const _=l.tilt*t.rotate,v=P(this.view.renderCoordsHelper,a.center,a.eye),y=i(v+_,H.min,H.max)-v;y&&(c(r.rotate.matrix,r.rotate.matrix,y,o),r.rotate.enabled=!0)}_calculateControlTransformationGlobal(t,e,i){const{eye:a,viewRight:r}=e,o=this._transformation,s=this.view.navigation.gamepad,n=y(R.get(),r,a);C(n,n),_(n,n),U(this.startCamera,e,o,t,this.view.camera.heading,this._headingStart,this.view.camera.tilt,i,s),this._tmpCamera.copyFrom(this.currentCamera),this._applyPan(tt.pan,this._tmpCamera);const l=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,m=o.translation[2]*t.ascend;i.ascend=m;const h=-o.heading*t.rotate;0!==h&&(c(i.rotate.matrix,i.rotate.matrix,h,this._tmpCamera.eye),i.rotate.enabled=!0);const p=o.tilt*t.rotate,d=this._clampTiltDeltaGlobalToValidRange(p,e.ray,l);0!==d&&(c(i.rotate.matrix,i.rotate.matrix,d,this._tmpCamera.viewRight),i.rotate.enabled=!0),i.zoom+=o.zoom*t.zoom}_clampTiltDeltaGlobalToValidRange(t,e,a){const r=x(this.view.spatialReference),o=G(H.min,e.origin,a,r);let s=0,n=0;const c=R.get();if(this.view.renderCoordsHelper.intersectManifold(e,a,c)){const t=P(this.view.renderCoordsHelper,c,e.origin);s=G(t,e.origin,a,r),n=G(H.max,e.origin,a,r)}else{M(z(T,a+r.radius),e,c);const t=Math.PI+A(e.direction,c);s=F(t,e.origin,a,r),n=F(H.max,e.origin,a,r)}return i(s+t,o,n)-s}_getPointAbsoluteSurfaceElevation(t,e,i){const{renderCoordsHelper:a}=this.view,r=a.getAltitude(t),o=e+Math.abs(r-e);return a.setAltitude(i,o,t),o}_clampedDistanceToSurface(t,e){const{renderCoordsHelper:i}=this.view,{camera:a}=this.view.state,{direction:r}=B(this.view,e,0,J,at),o=i.intersectManifoldClosestSilhouette(j(e,r),t,R.get()),s=w(e,o),n=i.intersectManifoldClosestSilhouette(j(e,b(R.get(),e,a.center)),t,R.get()),c=w(e,n);return Math.min(s,c)}_computeHeadingRotateRadius(t){const{renderCoordsHelper:e,state:i}=this.view,{camera:r,isGlobal:o}=i,s=e.intersectManifoldClosestSilhouette(r.ray,this._filteredSurfaceElevation,R.get());if(o){const e=h(R.get(),t,s),i=v(e);u(e,e,1/i);const r=C(R.get(),t),o=a(S(r,e));return i*Math.sin(Math.min(N,o))}{const i=f(R.get(),t);return e.setAltitude(i,this._filteredSurfaceElevation),w(s,i)}}_minimumAscendVelocity(){return this.view.state.constraints.collision.enabled?0:W}_computeVelocities(t){const e=this._filteredSurfaceElevation,a=e+x(this.view.spatialReference).radius,{camera:r,isGlobal:o}=this.view.state,s=R.get(),n=this._getPointAbsoluteSurfaceElevation(r.eye,e,s),c=this._clampedDistanceToSurface(e,s),l=r.width/2,m=Q*r.width,h=Q*r.width,p=c*Math.tan(.5*r.fovX)/l,d=p/a,u=p/this._computeHeadingRotateRadius(s),f=n-e;return{pan:(o?d:p)*m*t,ascend:Math.max(this._minimumAscendVelocity()*t,2**(m*t/l)*f-f),zoom:2**(m*t/l)*c-c,rotate:i(u*h,Y,$)*t}}_applyDisabledMovementTypes(t){null==this.disableMovements||void 0!==this.disableMovements.mode&&this.view.state.viewingMode!==this.disableMovements.mode||(t.zoom=this.disableMovements.zoom?0:t.zoom,t.ascend=this.disableMovements.ascend?0:t.ascend,t.pan.enabled=!this.disableMovements.pan,this.disableMovements.pan&&l(t.pan.matrix),t.rotate.enabled=!this.disableMovements.rotate,this.disableMovements.rotate&&l(t.rotate.matrix))}static activatesFor(t,e){const i=L(e,t.navigation.gamepad,X);return!("end"===e.action||q(i))}};t([o({constructOnly:!0})],Z.prototype,"gamepadDevice",void 0),t([o({constructOnly:!0})],Z.prototype,"disableMovements",void 0),Z=t([s("esri.views.3d.state.controllers.GamepadKeyboardController")],Z);const X={translation:[0,0,0],heading:0,tilt:0,zoom:0},J=80,N=r(J),Q=.75,W=5,Y=r(30),$=r(80),tt={zoom:0,ascend:0,pan:{enabled:!1,matrix:m()},rotate:{enabled:!1,matrix:m()}},et=O(),it=O(),at=I();function rt(t){t.zoom=0,t.ascend=0,t.pan.enabled=!1,l(t.pan.matrix),t.rotate.enabled=!1,l(t.rotate.matrix)}export{Z as GamepadKeyboardController};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- 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,createRenderScreenPointArray3 as o}from"../../../../core/screenUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{copy as a,distance as m}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{c as h,u as c,l as _,d as p,n as u,f as l,g as d,e as g}from"../../../../chunks/vec32.js";import{create as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as v}from"../../../../geometry/ellipsoidUtils.js";import{wrapAxisAngle as C}from"../../../../geometry/support/axisAngle.js";import{create as w,fromPositionAndNormal as M,getNormal as b}from"../../../../geometry/support/plane.js";import{c as S,k as f,a as j}from"../../../../chunks/sphere.js";import{pixelDistanceToInteractionFactor as E,applyAll as R}from"../../camera/constraintUtils.js";import{ConstraintOptions as y}from"../../camera/constraintUtils/ConstraintOptions.js";import{ExponentialFalloff as A}from"../../input/util.js";import{InteractiveController as O}from"./InteractiveController.js";import{PanPlanarMomentumController as x}from"./momentum/PanPlanarMomentumController.js";import{PanSphericalMomentumController as k}from"./momentum/PanSphericalMomentumController.js";import{RotationMomentumController as z}from"./momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as F}from"./momentum/ZoomPlanarMomentumController.js";import{ZoomSphericalMomentumController as H}from"./momentum/ZoomSphericalMomentumController.js";import{pickPointAndInitSphere as T,excludeTerrain as D,navigationMode as U,sphereOrPlanePointFromScreenPoint as G,maxPanDistanceModifier as I,minPinchAndPanCameraHeight as Z,pivotSearchAreaSize as L,intersectPlaneFromScreenPointAtEye as V,applyZoomOnSphere as q,shouldPreserveHeading as B,applyPanSphericalPreserveHeading as J,applyPanSphericalDirectRotation as K,normalizeRotationDelta as N,applyRotation as Q,applyPanPlanar as W,applyZoomToPoint as X}from"../utils/navigationUtils.js";import Y from"../../webgl/RenderCamera.js";import{PanPlanarMomentumEstimator as $}from"../../../navigation/PanPlanarMomentumEstimator.js";import{PanSphericalMomentumEstimator as tt}from"../../../navigation/PanSphericalMomentumEstimator.js";import{RotationMomentumEstimator as it}from"../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as et}from"../../../navigation/ZoomMomentumEstimator.js";let nt=class extends O{constructor(){super(...arguments),this._smoothRotation=new A(.05),this._rotationAxis=P(),this._beginAngle=0,this._beginHeading=0,this._panningPlane=w(),this._beginRadius=0,this._smoothScaling=new A(.05),this._zoomCenterScreen=n(),this._zoomMomentumEstimator=new et,this._rotationMomentumEstimator=new it,this._panSphericalMomentumEstimator=new tt,this._panPlanarMomentumEstimator=new $,this._adjustedSphere=S(),this._tmp3d=P(),this._tmpScreenPointArray=n(),this._beginScreenPoint=n(),this._beginScenePoint=P(),this._screenPickPoint=n(),this._scenePickPoint=P(),this._navMode=1,this._sphere=S(),this._pointerCount=0,this._tmpInteractionDirection=P(),this._beginCamera=new Y,this._constraintOptions=new y(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._pointerCount=t.pointers.size,this._beginAngle=t.angle,this._smoothRotation.reset(),s(t.center,this._screenPickPoint),a(this._beginScreenPoint,this._screenPickPoint);const n=T(this._intersectionHelper,this.startCamera,this._screenPickPoint,v(this.view.spatialReference).radius,1,this.view.basemapTerrain.invisible?D:{});null!=n.scenePickPoint&&(this._scenePickPoint=n.scenePickPoint,this._sphere=n.sphere,h(this._beginScenePoint,this._scenePickPoint),this._navMode=U(this.startCamera,this._screenPickPoint,this.view.renderCoordsHelper,this.view.viewingMode),0===this._navMode&&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._navMode?(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._zoomMomentumEstimator.evaluateMomentum();if(i)return 1===this._navMode?new H({view:this.view,momentum:i,screenCenter:this._zoomCenterScreen,sceneCenter:this._beginScenePoint,radius:this._sphere[3]}):new F({view:this.view,momentum:i,zoomCenter:this._beginScenePoint});const e=this._rotationMomentumEstimator.evaluateMomentum();if(e)return new z({view:this.view,momentum:e,center:f(this._sphere,P()),axis:this._rotationAxis});if(1===this._navMode){const t=this._panSphericalMomentumEstimator.evaluateMomentum();if(t)return new k({view:this.view,momentum:t})}else{const t=this._panPlanarMomentumEstimator.evaluateMomentum();if(t)return new x({view:this.view,momentum:t})}return null}_preparePlanarPanMode(t,i){const e=c(this._tmp3d,this.startCamera.viewForward);M(this._scenePickPoint,e,this._panningPlane);const r=n(this._screenPickPoint[0],0),a=P(),m=_(this.startCamera.eye);this._adjustedSphere[3]=m<this._sphere[3]?m-100:this._sphere[3],G(this._adjustedSphere,this.startCamera,r,a);const v=o();this.startCamera.projectToRenderScreen(a,v);const C=P(),w=P(),S=P();p(C,this._scenePickPoint,this.currentCamera.eye);const f=_(C);u(C,C);const j=I*Math.max(Math.abs(this.view.camera.position.z),Z),E=this.view.stage.renderView.getMinimalDepthForArea(null,this._screenPickPoint[0],this._screenPickPoint[1],this.view.state.camera,L);let R=null!=E?E:j;i&&(R=Math.min(R,f)),h(S,l(w,this.currentCamera.eye,d(w,C,R))),this._panningPlane[3]=-g(b(this._panningPlane),S),this.startCamera.center=l(w,this.startCamera.eye,d(w,this.startCamera.viewForward,R));const y=s(t.center,this._tmpScreenPointArray);V(this._panningPlane,this.startCamera,y,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),q(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=E(t.radius-this._beginRadius),R(this.view,this.currentCamera,this._constraintOptions)}_panningSpherical(t){const i=s(t.center,this._tmpScreenPointArray);G(this._sphere,this.currentCamera,i,this._tmp3d),B(this._beginScenePoint,g(this.currentCamera.up,this._beginScenePoint),this._sphere[3],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(i,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(i,this._tmp3d,.001*t.timestamp,this.startCamera,this._sphere[3],this.view.camera.tilt)),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=E(m(this._screenPickPoint,i)),R(this.view,this.currentCamera,this._constraintOptions)}_rotateSpherical(t){u(this._rotationAxis,this._scenePickPoint),this.currentCamera.aboveGround||c(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value,e=i+N(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),Q(this.currentCamera,j(this._sphere),C(this._rotationAxis,s)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=E(t.radius*e),R(this.view,this.currentCamera,this._constraintOptions)}_panningPlanar(t){const i=s(t.center,this._tmpScreenPointArray);V(this._panningPlane,this.currentCamera,i,this._tmp3d)&&(W(this.currentCamera,this._beginScenePoint,this._tmp3d),this._panPlanarMomentumEstimator.add(i,this._tmp3d,.001*t.timestamp),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=E(m(this._beginScreenPoint,i)),this._constraintOptions.interactionDirection=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,this._tmpInteractionDirection),R(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),X(this.currentCamera,this._beginScenePoint,this._smoothScaling.value,this.view.state.constraints.minimumPoiDistance),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=E(t.radius-this._beginRadius),R(this.view,this.currentCamera,this._constraintOptions)}_rotatePlanar(t){h(this._rotationAxis,this._beginScenePoint),this.currentCamera.aboveGround||c(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value;let e=t.angle-i;e=N(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),Q(this.currentCamera,j(this._sphere),C(this._rotationAxis,o)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=E(t.radius*o),R(this.view,this.currentCamera,this._constraintOptions)}};nt=t([r("esri.views.3d.state.controllers.PinchAndPanControllerGlobal")],nt);export{nt as PinchAndPanControllerGlobal};
5
+ 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,createRenderScreenPointArray3 as o}from"../../../../core/screenUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{copy as a,distance as m}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{c as h,u as c,l as _,d as p,n as u,f as l,g as d,e as g}from"../../../../chunks/vec32.js";import{create as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as v}from"../../../../geometry/ellipsoidUtils.js";import{wrapAxisAngle as C}from"../../../../geometry/support/axisAngle.js";import{create as w,fromPositionAndNormal as M,getNormal as b}from"../../../../geometry/support/plane.js";import{c as S,n as f,a as j}from"../../../../chunks/sphere.js";import{pixelDistanceToInteractionFactor as E,applyAll as R}from"../../camera/constraintUtils.js";import{ConstraintOptions as y}from"../../camera/constraintUtils/ConstraintOptions.js";import{ExponentialFalloff as A}from"../../input/util.js";import{InteractiveController as O}from"./InteractiveController.js";import{PanPlanarMomentumController as x}from"./momentum/PanPlanarMomentumController.js";import{PanSphericalMomentumController as k}from"./momentum/PanSphericalMomentumController.js";import{RotationMomentumController as z}from"./momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as F}from"./momentum/ZoomPlanarMomentumController.js";import{ZoomSphericalMomentumController as H}from"./momentum/ZoomSphericalMomentumController.js";import{pickPointAndInitSphere as T,excludeTerrain as D,navigationMode as U,sphereOrPlanePointFromScreenPoint as G,maxPanDistanceModifier as I,minPinchAndPanCameraHeight as Z,pivotSearchAreaSize as L,intersectPlaneFromScreenPointAtEye as V,applyZoomOnSphere as q,shouldPreserveHeading as B,applyPanSphericalPreserveHeading as J,applyPanSphericalDirectRotation as K,normalizeRotationDelta as N,applyRotation as Q,applyPanPlanar as W,applyZoomToPoint as X}from"../utils/navigationUtils.js";import Y from"../../webgl/RenderCamera.js";import{PanPlanarMomentumEstimator as $}from"../../../navigation/PanPlanarMomentumEstimator.js";import{PanSphericalMomentumEstimator as tt}from"../../../navigation/PanSphericalMomentumEstimator.js";import{RotationMomentumEstimator as it}from"../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as et}from"../../../navigation/ZoomMomentumEstimator.js";let nt=class extends O{constructor(){super(...arguments),this._smoothRotation=new A(.05),this._rotationAxis=P(),this._beginAngle=0,this._beginHeading=0,this._panningPlane=w(),this._beginRadius=0,this._smoothScaling=new A(.05),this._zoomCenterScreen=n(),this._zoomMomentumEstimator=new et,this._rotationMomentumEstimator=new it,this._panSphericalMomentumEstimator=new tt,this._panPlanarMomentumEstimator=new $,this._adjustedSphere=S(),this._tmp3d=P(),this._tmpScreenPointArray=n(),this._beginScreenPoint=n(),this._beginScenePoint=P(),this._screenPickPoint=n(),this._scenePickPoint=P(),this._navMode=1,this._sphere=S(),this._pointerCount=0,this._tmpInteractionDirection=P(),this._beginCamera=new Y,this._constraintOptions=new y(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._pointerCount=t.pointers.size,this._beginAngle=t.angle,this._smoothRotation.reset(),s(t.center,this._screenPickPoint),a(this._beginScreenPoint,this._screenPickPoint);const n=T(this._intersectionHelper,this.startCamera,this._screenPickPoint,v(this.view.spatialReference).radius,1,this.view.basemapTerrain.invisible?D:{});null!=n.scenePickPoint&&(this._scenePickPoint=n.scenePickPoint,this._sphere=n.sphere,h(this._beginScenePoint,this._scenePickPoint),this._navMode=U(this.startCamera,this._screenPickPoint,this.view.renderCoordsHelper,this.view.viewingMode),0===this._navMode&&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._navMode?(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._zoomMomentumEstimator.evaluateMomentum();if(i)return 1===this._navMode?new H({view:this.view,momentum:i,screenCenter:this._zoomCenterScreen,sceneCenter:this._beginScenePoint,radius:this._sphere[3]}):new F({view:this.view,momentum:i,zoomCenter:this._beginScenePoint});const e=this._rotationMomentumEstimator.evaluateMomentum();if(e)return new z({view:this.view,momentum:e,center:f(this._sphere,P()),axis:this._rotationAxis});if(1===this._navMode){const t=this._panSphericalMomentumEstimator.evaluateMomentum();if(t)return new k({view:this.view,momentum:t})}else{const t=this._panPlanarMomentumEstimator.evaluateMomentum();if(t)return new x({view:this.view,momentum:t})}return null}_preparePlanarPanMode(t,i){const e=c(this._tmp3d,this.startCamera.viewForward);M(this._scenePickPoint,e,this._panningPlane);const r=n(this._screenPickPoint[0],0),a=P(),m=_(this.startCamera.eye);this._adjustedSphere[3]=m<this._sphere[3]?m-100:this._sphere[3],G(this._adjustedSphere,this.startCamera,r,a);const v=o();this.startCamera.projectToRenderScreen(a,v);const C=P(),w=P(),S=P();p(C,this._scenePickPoint,this.currentCamera.eye);const f=_(C);u(C,C);const j=I*Math.max(Math.abs(this.view.camera.position.z),Z),E=this.view.stage.renderView.getMinimalDepthForArea(null,this._screenPickPoint[0],this._screenPickPoint[1],this.view.state.camera,L);let R=null!=E?E:j;i&&(R=Math.min(R,f)),h(S,l(w,this.currentCamera.eye,d(w,C,R))),this._panningPlane[3]=-g(b(this._panningPlane),S),this.startCamera.center=l(w,this.startCamera.eye,d(w,this.startCamera.viewForward,R));const y=s(t.center,this._tmpScreenPointArray);V(this._panningPlane,this.startCamera,y,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),q(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=E(t.radius-this._beginRadius),R(this.view,this.currentCamera,this._constraintOptions)}_panningSpherical(t){const i=s(t.center,this._tmpScreenPointArray);G(this._sphere,this.currentCamera,i,this._tmp3d),B(this._beginScenePoint,g(this.currentCamera.up,this._beginScenePoint),this._sphere[3],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(i,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(i,this._tmp3d,.001*t.timestamp,this.startCamera,this._sphere[3],this.view.camera.tilt)),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=E(m(this._screenPickPoint,i)),R(this.view,this.currentCamera,this._constraintOptions)}_rotateSpherical(t){u(this._rotationAxis,this._scenePickPoint),this.currentCamera.aboveGround||c(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value,e=i+N(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),Q(this.currentCamera,j(this._sphere),C(this._rotationAxis,s)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=E(t.radius*e),R(this.view,this.currentCamera,this._constraintOptions)}_panningPlanar(t){const i=s(t.center,this._tmpScreenPointArray);V(this._panningPlane,this.currentCamera,i,this._tmp3d)&&(W(this.currentCamera,this._beginScenePoint,this._tmp3d),this._panPlanarMomentumEstimator.add(i,this._tmp3d,.001*t.timestamp),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=E(m(this._beginScreenPoint,i)),this._constraintOptions.interactionDirection=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,this._tmpInteractionDirection),R(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),X(this.currentCamera,this._beginScenePoint,this._smoothScaling.value,this.view.state.constraints.minimumPoiDistance),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=E(t.radius-this._beginRadius),R(this.view,this.currentCamera,this._constraintOptions)}_rotatePlanar(t){h(this._rotationAxis,this._beginScenePoint),this.currentCamera.aboveGround||c(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value;let e=t.angle-i;e=N(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),Q(this.currentCamera,j(this._sphere),C(this._rotationAxis,o)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=E(t.radius*o),R(this.view,this.currentCamera,this._constraintOptions)}};nt=t([r("esri.views.3d.state.controllers.PinchAndPanControllerGlobal")],nt);export{nt as PinchAndPanControllerGlobal};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{cyclicalPI as t}from"../../../../core/Cyclical.js";import{deg2rad as e,clamp as n,acosClamped as o,asinClamped as r}from"../../../../core/mathUtils.js";import{createScreenPointArray as a}from"../../../../core/screenUtils.js";import{fromRotation as s,exactEquals as i,rotate as c,multiply as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as m,create as u}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as f}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{e as h,l as M,d as g,t as y,f as b,n as d,s as x,c as j,h as v,g as P,m as z,i as w}from"../../../../chunks/vec32.js";import{create as I}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as A,fromPoints as k,axis as T,wrapAxisAngle as U}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as G,vectorCoordinates as R}from"../../../../geometry/support/coordinateSystem.js";import{create as S,fromNormalAndOffset as E,intersectRay as H}from"../../../../geometry/support/plane.js";import{a as q,c as C,h as F,i as O}from"../../../../chunks/sphere.js";import{sm4d as W,sv3d as B}from"../../../../geometry/support/vectorStacks.js";import{fromScreenAtEye as D,fromScreen as J}from"../../support/geometryUtils/ray.js";import{intersectScreen as K}from"../../support/geometryUtils/sphere.js";import L from"../../webgl/RenderCamera.js";import{terrainId as N}from"../../webgl-engine/lib/verticalOffsetUtils.js";const Q=30,V=[1,3e8],X=8,Y=[200,1508e5],Z=5,$=50,_=5,tt=10,et=80,nt=90,ot={exclude:new Set([N])};function rt(t,e,n){return n[0]=e[0]/(t.fullWidth/t.pixelRatio),n[1]=e[1]/(t.fullHeight/t.pixelRatio),n}function at(t){for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function st(t,e,n){const o=s(W.get(),n[3],T(n));null==o||i(o,m)||(g(ne,t.eye,e),y(ne,ne,o),t.eye=b(ne,ne,e),g(ne,t.center,e),y(ne,ne,o),t.center=b(ne,ne,e),t.up=y(ne,t.up,o))}function it(t,e,n,o){return H(t,J(e,n,ce),o)}function ct(t,e,n,o){return H(t,D(e,n,ce),o)}function lt(t,e,n,o){const r=B.get();let a=1-n;g(r,e,t.eye);const s=M(r);let i=s*(1-a);a>=0&&i<o&&(i=o,a=-(i-s)/s),Math.abs(s-i)<1e-6||(P(r,r,a),t.eye=b(ne,t.eye,r),t.center=z(ne,t.center,e,a))}function mt(t,e,n){e.getScreenCenter(ut),K(t,e,ut,ne)&&(e.center=ne);const o=e.distance,r=o*n;if(Math.abs(o-r)<1e-6)return;const a=P(B.get(),e.viewForward,r);e.eye=g(ne,e.center,a)}const ut=a();function ft(t,e){w(e,0,0,0);for(const n of t)b(e,e,n);P(e,e,1/t.length)}function pt(t,e,n,o){return Math.sin(t/M(e))*(n+o.radius)}function ht(t,e,n,o){return pt(Math.PI/2,e,n,o)+(t-Math.PI/2)}const Mt={Elevation:3e4,Angle:e(16)},gt=e(80);function yt(t,e,n,o,r,a){const s=I(),i=C();let c=!0,l=!0;return t.intersectScreen(n,s,a)?i[3]=M(s):(l=!1,e.aboveGround&&0!==r?i[3]=Math.max(M(e.center),.9*o):i[3]=M(e.eye)-e.relativeElevation,1===r?jt(i,e,n,s):c=K(i,e,n,s)),{sphere:i,scenePickPoint:c?s:null,hasGeometryIntersection:l}}function bt(t,e,n,o){const r=t.relativeElevation;if(r>Mt.Elevation&&"global"===o)return 1;D(t,e,le);const a=Math.sign(r),s=n.worldUpAtPosition(t.eye,ne);return-a*h(s,le.direction)<Math.sin(Mt.Angle)*M(le.direction)?0:1}function dt(t,e,n){g(xt,n,e),t.eye=g(ne,t.eye,xt),t.center=g(ne,t.center,xt)}const xt=I();function jt(t,e,n,o){const r=D(e,n,ce);return null!=r&&(F(t,r,vt),O(t,r,o)?!(x(vt,r.origin)<x(o,r.origin))||(j(o,vt),!1):(g(Pt,e.eye,e.center),d(Pt,Pt),E(Pt,-h(d(Pt,Pt),vt),zt),H(zt,r,o),!1))}const vt=I(),Pt=I(),zt=S();function wt(a,s,i,c,l,m){let u=0;if(v(ae,a,s),g(oe,a,s),M(a)<=l||!c.aboveGround){v(i,oe,c.eye);const f=h(a,s)/(M(a)*M(s));if(f<.9999)u=o(f);else{const t=M(v(I(),a,s))/(M(a)*M(s));u=r(t)}const p=Math.cos(n(t.normalize(e(m)),0,gt));u=-u-Math.max(0,M(s)-l)/(p*l)}else g(It,c.eye,c.center),v(i,oe,It),u=-M(oe)/l;return d(i,i),P(i,i,M(ae)),u}const It=I();function At(r,a,s,i){let c,l;const m=Math.cos(n(t.normalize(e(i)),0,gt));return c=a>s?-(a-s)/(m*s):a<-s?Math.PI-(a+s)/(m*s):o(a/s),l=r>s?-(r-s)/(m*s):r<-s?Math.PI-(r+s)/(m*s):o(r/s),(l-c)*s}function kt(t,e,n,o,r,a,s,i,c,l){const m=At(t[2],e[2],a[3],i),u=c?At(t[0],e[0],a[3],180):e[0]-t[0],p=Math.sin(s)*u-Math.cos(s)*m,M=Math.cos(s)*u+Math.sin(s)*m;d(ne,r);const g=c?p/Math.sqrt(Math.abs(a[3]**2-h(n,ne)**2)):p/a[3],y=M/Math.sqrt(Math.abs(a[3]**2-h(n,o)**2));f(l,g,y)}function Tt(t,e,n,o,r,a,s,i,c,l){v(ae,t,e),G(a.up,a.eye,Lt,Nt,Qt),G([0,0,1],a.eye,Dt,Jt,Kt),j(n,Jt),j(o,Dt),d(n,n),P(n,n,M(ae)),R(t,d(Nt,Nt),d(Qt,Qt),d(Lt,Lt),Vt),R(e,Nt,Qt,Lt,Xt),kt(Vt,Xt,t,Dt,Jt,s,i,c,l,r)}function Ut(t,e,n,o,r,a,i){s($t,r,o),s(_t,i,a),l(te,$t,_t),g(e,t,n),y(e,e,te),b(e,e,n)}function Gt(t,e,n,o,r,a){s($t,o,n),s(_t,a,r),l(te,$t,_t),g(ne,t.eye,e),y(ne,ne,te),t.eye=b(ne,ne,e),g(ne,t.center,e),y(ne,ne,te),t.center=b(ne,ne,e),g(ne,t.up,e),y(ne,ne,te),t.up=b(ne,ne,e)}const Rt={Pole:.95,Angle:e(18),Tilt:45,TiltHysteresisMargin:1e-7};let St=!1;function Et(t,e,n,o,r,a){const s=Math.abs(o)>Math.PI-Rt.Angle||Math.abs(o)<Rt.Angle,i=(Math.abs(t[2])<n*Rt.Pole||Math.abs(e)>n)&&a;return s&&i?!St&&r<Rt.Tilt-Rt.TiltHysteresisMargin?St=!0:St&&r>Rt.Tilt+Rt.TiltHysteresisMargin&&(St=!1):St=!1,St}function Ht(t,e,n,o,r,a){if(a)k(n,o,Zt),st(e,q(t),Zt);else{const a=wt(n,o,se,e,t[3],r);st(e,q(t),U(se,a))}}function qt(t,e,n,o,r,a,s){const i=s?20:1,c=1e-12;let l,m;j(ee,o),re.copyFrom(e);for(let u=0;u<i&&x(n,ee)>c&&(l=x(n,ee),Tt(n,ee,Jt,Dt,Yt,re,t,r,a,s),Gt(re,q(t),Dt,Yt[1],Jt,Yt[0]),Ut(ee,ee,q(t),Dt,Yt[1],Jt,Yt[0]),m=x(n,ee),m<l||0===u);u++)e.copyFrom(re)}function Ct(n,o,r,a,s,i,c){Et(r,h(o.up,r),n[3],-t.normalize(e(s)),i,o.aboveGround)?qt(n,o,r,a,-t.normalize(e(s)),i,c):Ht(n,o,r,a,i,c)}function Ft(t,e,n,o,r,a){const{eye:s}=t;G([0,0,1],s,Dt,Jt,Kt);const i=e.translation[0]*n.pan,l="zoom"===r.mode?0:e.translation[1]*n.pan,m=Math.max(Math.sqrt(Math.abs(1-h(t.center,Dt)**2/M(t.center)**2)),.5),u=(Math.sin(a)*l+Math.cos(a)*i)/m,f=-Math.cos(a)*l+Math.sin(a)*i;switch(c(o.pan.matrix,o.pan.matrix,u,Dt),o.pan.enabled=!0,r.mode){case"pan":c(o.pan.matrix,o.pan.matrix,f,Jt),o.pan.enabled=!0;break;case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Ot(t,e,n,o,r){const{eye:a,viewRight:s}=t,i=v(B.get(),s,a),l=e.translation[0]*n.pan;switch(0!==l&&(c(o.pan.matrix,o.pan.matrix,-l,i),o.pan.enabled=!0),r.mode){case"pan":{const t=e.translation[1]*n.pan;0!==t&&(c(o.pan.matrix,o.pan.matrix,t,s),o.pan.enabled=!0);break}case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Wt(n,o,r,a,s,i,c,l,m){Et(n.center,h(n.up,n.center),M(n.center),-t.normalize(e(i)),c,o.aboveGround)?Ft(o,r,a,l,m,-t.normalize(e(s))):Ot(o,r,a,l,m)}function Bt(t,e,n=1/0){const o=Math.abs(h(t,e));return Math.min(n,1/o)}const Dt=I(),Jt=I(),Kt=I(),Lt=I(),Nt=I(),Qt=I(),Vt=I(),Xt=I(),Yt=p(),Zt=A(),$t=u(),_t=u(),te=u(),ee=I(),ne=I(),oe=I();let re=new L;const ae=I(),se=I();function ie(){re=new L}const ce={origin:I(),direction:I()},le={origin:I(),direction:I()};export{gt as TiltThresholdPanningSpeed,Mt as VerticalPanTresholds,dt as applyPanPlanar,Ht as applyPanSphericalDirectRotation,qt as applyPanSphericalPreserveHeading,st as applyRotation,Gt as applyRotationWithTwoAxes,mt as applyZoomOnSphere,lt as applyZoomToPoint,ft as centroid,ie as cleanupNavigationUtils,ot as excludeTerrain,Bt as getTiltScaleFactor,it as intersectPlaneFromScreenPoint,ct as intersectPlaneFromScreenPointAtEye,At as lengthFromPoints,Z as maxPanDistanceModifier,_ as maxRotatePivotDistanceModifier,Q as maxZoomPivotDistanceModifier,X as maxZoomStepDistanceModifier,$ as minPinchAndPanCameraHeight,tt as minRotatePivotDistance,bt as navigationMode,rt as normalizeCoordinate,at as normalizeRotationDelta,ht as offSurfaceTiltToEyeTiltGlobal,pt as onSurfaceTiltToEyeTiltGlobal,Wt as panMotionToRotationMatrix,Ct as panToPosition,yt as pickPointAndInitSphere,et as pivotSearchAreaSize,Rt as preservingHeadingThresholds,nt as rotatePivotSearchAreaSize,Ut as rotatePointAroundTwoAxes,wt as rotationAngleAndAxisDirectRotation,Tt as rotationAnglesAndAxesHeadingPreserving,kt as rotationAnglesHeadingPreserving,Et as shouldPreserveHeading,jt as sphereOrPlanePointFromScreenPoint,V as zoomPivotDistanceClamp,Y as zoomStepDistanceClamp};
5
+ import{cyclicalPI as t}from"../../../../core/Cyclical.js";import{deg2rad as e,clamp as n,acosClamped as o,asinClamped as r}from"../../../../core/mathUtils.js";import{createScreenPointArray as a}from"../../../../core/screenUtils.js";import{fromRotation as s,exactEquals as i,rotate as c,multiply as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as m,create as u}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as f}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{e as h,l as M,d as g,t as y,f as b,n as d,s as x,c as j,h as v,g as P,m as z,i as w}from"../../../../chunks/vec32.js";import{create as I}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as A,fromPoints as k,axis as T,wrapAxisAngle as U}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as G,vectorCoordinates as R}from"../../../../geometry/support/coordinateSystem.js";import{create as S,fromNormalAndOffset as E,intersectRay as H}from"../../../../geometry/support/plane.js";import{a as q,c as C,l as F,i as O}from"../../../../chunks/sphere.js";import{sm4d as W,sv3d as B}from"../../../../geometry/support/vectorStacks.js";import{fromScreenAtEye as D,fromScreen as J}from"../../support/geometryUtils/ray.js";import{intersectScreen as K}from"../../support/geometryUtils/sphere.js";import L from"../../webgl/RenderCamera.js";import{terrainId as N}from"../../webgl-engine/lib/verticalOffsetUtils.js";const Q=30,V=[1,3e8],X=8,Y=[200,1508e5],Z=5,$=50,_=5,tt=10,et=80,nt=90,ot={exclude:new Set([N])};function rt(t,e,n){return n[0]=e[0]/(t.fullWidth/t.pixelRatio),n[1]=e[1]/(t.fullHeight/t.pixelRatio),n}function at(t){for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function st(t,e,n){const o=s(W.get(),n[3],T(n));null==o||i(o,m)||(g(ne,t.eye,e),y(ne,ne,o),t.eye=b(ne,ne,e),g(ne,t.center,e),y(ne,ne,o),t.center=b(ne,ne,e),t.up=y(ne,t.up,o))}function it(t,e,n,o){return H(t,J(e,n,ce),o)}function ct(t,e,n,o){return H(t,D(e,n,ce),o)}function lt(t,e,n,o){const r=B.get();let a=1-n;g(r,e,t.eye);const s=M(r);let i=s*(1-a);a>=0&&i<o&&(i=o,a=-(i-s)/s),Math.abs(s-i)<1e-6||(P(r,r,a),t.eye=b(ne,t.eye,r),t.center=z(ne,t.center,e,a))}function mt(t,e,n){e.getScreenCenter(ut),K(t,e,ut,ne)&&(e.center=ne);const o=e.distance,r=o*n;if(Math.abs(o-r)<1e-6)return;const a=P(B.get(),e.viewForward,r);e.eye=g(ne,e.center,a)}const ut=a();function ft(t,e){w(e,0,0,0);for(const n of t)b(e,e,n);P(e,e,1/t.length)}function pt(t,e,n,o){return Math.sin(t/M(e))*(n+o.radius)}function ht(t,e,n,o){return pt(Math.PI/2,e,n,o)+(t-Math.PI/2)}const Mt={Elevation:3e4,Angle:e(16)},gt=e(80);function yt(t,e,n,o,r,a){const s=I(),i=C();let c=!0,l=!0;return t.intersectScreen(n,s,a)?i[3]=M(s):(l=!1,e.aboveGround&&0!==r?i[3]=Math.max(M(e.center),.9*o):i[3]=M(e.eye)-e.relativeElevation,1===r?jt(i,e,n,s):c=K(i,e,n,s)),{sphere:i,scenePickPoint:c?s:null,hasGeometryIntersection:l}}function bt(t,e,n,o){const r=t.relativeElevation;if(r>Mt.Elevation&&"global"===o)return 1;D(t,e,le);const a=Math.sign(r),s=n.worldUpAtPosition(t.eye,ne);return-a*h(s,le.direction)<Math.sin(Mt.Angle)*M(le.direction)?0:1}function dt(t,e,n){g(xt,n,e),t.eye=g(ne,t.eye,xt),t.center=g(ne,t.center,xt)}const xt=I();function jt(t,e,n,o){const r=D(e,n,ce);return null!=r&&(F(t,r,vt),O(t,r,o)?!(x(vt,r.origin)<x(o,r.origin))||(j(o,vt),!1):(g(Pt,e.eye,e.center),d(Pt,Pt),E(Pt,-h(d(Pt,Pt),vt),zt),H(zt,r,o),!1))}const vt=I(),Pt=I(),zt=S();function wt(a,s,i,c,l,m){let u=0;if(v(ae,a,s),g(oe,a,s),M(a)<=l||!c.aboveGround){v(i,oe,c.eye);const f=h(a,s)/(M(a)*M(s));if(f<.9999)u=o(f);else{const t=M(v(I(),a,s))/(M(a)*M(s));u=r(t)}const p=Math.cos(n(t.normalize(e(m)),0,gt));u=-u-Math.max(0,M(s)-l)/(p*l)}else g(It,c.eye,c.center),v(i,oe,It),u=-M(oe)/l;return d(i,i),P(i,i,M(ae)),u}const It=I();function At(r,a,s,i){let c,l;const m=Math.cos(n(t.normalize(e(i)),0,gt));return c=a>s?-(a-s)/(m*s):a<-s?Math.PI-(a+s)/(m*s):o(a/s),l=r>s?-(r-s)/(m*s):r<-s?Math.PI-(r+s)/(m*s):o(r/s),(l-c)*s}function kt(t,e,n,o,r,a,s,i,c,l){const m=At(t[2],e[2],a[3],i),u=c?At(t[0],e[0],a[3],180):e[0]-t[0],p=Math.sin(s)*u-Math.cos(s)*m,M=Math.cos(s)*u+Math.sin(s)*m;d(ne,r);const g=c?p/Math.sqrt(Math.abs(a[3]**2-h(n,ne)**2)):p/a[3],y=M/Math.sqrt(Math.abs(a[3]**2-h(n,o)**2));f(l,g,y)}function Tt(t,e,n,o,r,a,s,i,c,l){v(ae,t,e),G(a.up,a.eye,Lt,Nt,Qt),G([0,0,1],a.eye,Dt,Jt,Kt),j(n,Jt),j(o,Dt),d(n,n),P(n,n,M(ae)),R(t,d(Nt,Nt),d(Qt,Qt),d(Lt,Lt),Vt),R(e,Nt,Qt,Lt,Xt),kt(Vt,Xt,t,Dt,Jt,s,i,c,l,r)}function Ut(t,e,n,o,r,a,i){s($t,r,o),s(_t,i,a),l(te,$t,_t),g(e,t,n),y(e,e,te),b(e,e,n)}function Gt(t,e,n,o,r,a){s($t,o,n),s(_t,a,r),l(te,$t,_t),g(ne,t.eye,e),y(ne,ne,te),t.eye=b(ne,ne,e),g(ne,t.center,e),y(ne,ne,te),t.center=b(ne,ne,e),g(ne,t.up,e),y(ne,ne,te),t.up=b(ne,ne,e)}const Rt={Pole:.95,Angle:e(18),Tilt:45,TiltHysteresisMargin:1e-7};let St=!1;function Et(t,e,n,o,r,a){const s=Math.abs(o)>Math.PI-Rt.Angle||Math.abs(o)<Rt.Angle,i=(Math.abs(t[2])<n*Rt.Pole||Math.abs(e)>n)&&a;return s&&i?!St&&r<Rt.Tilt-Rt.TiltHysteresisMargin?St=!0:St&&r>Rt.Tilt+Rt.TiltHysteresisMargin&&(St=!1):St=!1,St}function Ht(t,e,n,o,r,a){if(a)k(n,o,Zt),st(e,q(t),Zt);else{const a=wt(n,o,se,e,t[3],r);st(e,q(t),U(se,a))}}function qt(t,e,n,o,r,a,s){const i=s?20:1,c=1e-12;let l,m;j(ee,o),re.copyFrom(e);for(let u=0;u<i&&x(n,ee)>c&&(l=x(n,ee),Tt(n,ee,Jt,Dt,Yt,re,t,r,a,s),Gt(re,q(t),Dt,Yt[1],Jt,Yt[0]),Ut(ee,ee,q(t),Dt,Yt[1],Jt,Yt[0]),m=x(n,ee),m<l||0===u);u++)e.copyFrom(re)}function Ct(n,o,r,a,s,i,c){Et(r,h(o.up,r),n[3],-t.normalize(e(s)),i,o.aboveGround)?qt(n,o,r,a,-t.normalize(e(s)),i,c):Ht(n,o,r,a,i,c)}function Ft(t,e,n,o,r,a){const{eye:s}=t;G([0,0,1],s,Dt,Jt,Kt);const i=e.translation[0]*n.pan,l="zoom"===r.mode?0:e.translation[1]*n.pan,m=Math.max(Math.sqrt(Math.abs(1-h(t.center,Dt)**2/M(t.center)**2)),.5),u=(Math.sin(a)*l+Math.cos(a)*i)/m,f=-Math.cos(a)*l+Math.sin(a)*i;switch(c(o.pan.matrix,o.pan.matrix,u,Dt),o.pan.enabled=!0,r.mode){case"pan":c(o.pan.matrix,o.pan.matrix,f,Jt),o.pan.enabled=!0;break;case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Ot(t,e,n,o,r){const{eye:a,viewRight:s}=t,i=v(B.get(),s,a),l=e.translation[0]*n.pan;switch(0!==l&&(c(o.pan.matrix,o.pan.matrix,-l,i),o.pan.enabled=!0),r.mode){case"pan":{const t=e.translation[1]*n.pan;0!==t&&(c(o.pan.matrix,o.pan.matrix,t,s),o.pan.enabled=!0);break}case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Wt(n,o,r,a,s,i,c,l,m){Et(n.center,h(n.up,n.center),M(n.center),-t.normalize(e(i)),c,o.aboveGround)?Ft(o,r,a,l,m,-t.normalize(e(s))):Ot(o,r,a,l,m)}function Bt(t,e,n=1/0){const o=Math.abs(h(t,e));return Math.min(n,1/o)}const Dt=I(),Jt=I(),Kt=I(),Lt=I(),Nt=I(),Qt=I(),Vt=I(),Xt=I(),Yt=p(),Zt=A(),$t=u(),_t=u(),te=u(),ee=I(),ne=I(),oe=I();let re=new L;const ae=I(),se=I();function ie(){re=new L}const ce={origin:I(),direction:I()},le={origin:I(),direction:I()};export{gt as TiltThresholdPanningSpeed,Mt as VerticalPanTresholds,dt as applyPanPlanar,Ht as applyPanSphericalDirectRotation,qt as applyPanSphericalPreserveHeading,st as applyRotation,Gt as applyRotationWithTwoAxes,mt as applyZoomOnSphere,lt as applyZoomToPoint,ft as centroid,ie as cleanupNavigationUtils,ot as excludeTerrain,Bt as getTiltScaleFactor,it as intersectPlaneFromScreenPoint,ct as intersectPlaneFromScreenPointAtEye,At as lengthFromPoints,Z as maxPanDistanceModifier,_ as maxRotatePivotDistanceModifier,Q as maxZoomPivotDistanceModifier,X as maxZoomStepDistanceModifier,$ as minPinchAndPanCameraHeight,tt as minRotatePivotDistance,bt as navigationMode,rt as normalizeCoordinate,at as normalizeRotationDelta,ht as offSurfaceTiltToEyeTiltGlobal,pt as onSurfaceTiltToEyeTiltGlobal,Wt as panMotionToRotationMatrix,Ct as panToPosition,yt as pickPointAndInitSphere,et as pivotSearchAreaSize,Rt as preservingHeadingThresholds,nt as rotatePivotSearchAreaSize,Ut as rotatePointAroundTwoAxes,wt as rotationAngleAndAxisDirectRotation,Tt as rotationAnglesAndAxesHeadingPreserving,kt as rotationAnglesHeadingPreserving,Et as shouldPreserveHeading,jt as sphereOrPlanePointFromScreenPoint,V as zoomPivotDistanceClamp,Y as zoomStepDistanceClamp};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../core/Evented.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{throwIfAbortError as s}from"../../../core/promiseUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import i from"../../../geometry/SpatialReference.js";import{equals as a}from"../../../geometry/support/spatialReferenceUtils.js";import{ElevationQuery as l}from"../layers/graphics/ElevationQuery.js";import{ElevationRange as c}from"./ElevationRange.js";let u=class extends t{get spatialReference(){return this.view?.basemapTerrain?.spatialReference}constructor(e){super(e),this._im=new Array,this._ground=new Array,this._scene=new Array,this.lastElevationQuery=null,this._cacheEnabled=!1}destroy(){this._cachedQuery=r(this._cachedQuery)}enableCache(e){e||(this.lastElevationQuery=null),this._cacheEnabled=e}getElevation(e,t,r,s,n){if(this._cacheEnabled&&null!=this.lastElevationQuery){const o=this.lastElevationQuery;if(e===o.x&&t===o.y&&r===o.z&&a(s,o.spatialReference)&&n===o.queryContext)return o.result}let o=null;return o=h(o,this._im,e,t,r,s,n),null==o&&(o=h(o,this._ground,e,t,r,s,n)),"scene"===n&&(o=h(o,this._scene,e,t,r,s,n)),this._cacheEnabled&&(this.lastElevationQuery={x:e,y:t,z:r,spatialReference:s,queryContext:n,result:o}),o}getSphereElevationBounds(e,t,r){const s=new c;function n(n){for(const o of n)if(o.getSphereElevationBounds){const n=o.getSphereElevationBounds(e,t,r);null!=n&&s.expandElevationRangeValues(n.elevationRangeMin,n.elevationRangeMax)}}return n(this._ground),n(this._im),"scene"===r&&n(this._scene),s}getRootElevationBounds(){const e=new c;for(const t of[this._im,this._ground,this._scene])t.forEach(t=>{if(t.getRootElevationBounds){const r=t.getRootElevationBounds();null!=r&&e.expandElevationRangeValues(r.elevationRangeMin,r.elevationRangeMax)}});return e}async queryElevation(e,t,r,n,o,i=null,a=0){const l=this._getElevationQuery(n);try{const s=await l.queryElevation(e,t,i,a);return"scene"===o?h(s,this._scene,e,t,r,n,o):s}catch(c){return s(c),this.getElevation(e,t,r,n,o)}}register(e,t){this.addHandles(t.on("elevation-change",e=>this.emit("elevation-change",e)),t),this._providersFromContext(e).push(t)}unregister(e){this.removeHandles(e);for(const t of[this._im,this._ground,this._scene]){const r=t.indexOf(e);r>-1&&t.splice(r,1)}}_providersFromContext(e){switch(e){case"ground":return this._ground;case"im":return this._im;case"scene":return this._scene}}_getElevationQuery(e=this.view.spatialReference){const t=this._cachedQuery;if(null!=t&&a(e,t.spatialReference))return t;t?.destroy({completeTasks:!0});const{wkid:r,wkt:s,wkt2:n,latestWkid:o}=e,c=new l(this.view.resourceController.scheduler,new i({wkid:r,wkt:s,wkt2:n,latestWkid:o}),()=>this.view.map?.ground,{maximumAutoTileRequests:4});return this._cachedQuery=c,c}};function h(e,t,r,s,n,o,i){for(const a of t){const t=a.getElevation(r,s,n,o,i);null!=t&&(e=null!=e?Math.max(t,e):t)}return e}e([n({constructOnly:!0})],u.prototype,"view",void 0),e([n()],u.prototype,"spatialReference",null),u=e([o("esri.views.3d.support.CombinedElevationProvider")],u);export{u as CombinedElevationProvider};
5
+ import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../core/Evented.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{throwIfAbortError as s}from"../../../core/promiseUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import i from"../../../geometry/SpatialReference.js";import{equals as a}from"../../../geometry/support/spatialReferenceUtils.js";import{ElevationQuery as l}from"../layers/graphics/ElevationQuery.js";import{ElevationRange as c}from"./ElevationRange.js";let u=class extends t{get spatialReference(){return this.view.basemapTerrain?.spatialReference??this.view.spatialReference}constructor(e){super(e),this._im=new Array,this._ground=new Array,this._scene=new Array,this.lastElevationQuery=null,this._cacheEnabled=!1}destroy(){this._cachedQuery=r(this._cachedQuery)}enableCache(e){e||(this.lastElevationQuery=null),this._cacheEnabled=e}getElevation(e,t,r,s,n){if(this._cacheEnabled&&null!=this.lastElevationQuery){const o=this.lastElevationQuery;if(e===o.x&&t===o.y&&r===o.z&&a(s,o.spatialReference)&&n===o.queryContext)return o.result}let o=null;return o=h(o,this._im,e,t,r,s,n),null==o&&(o=h(o,this._ground,e,t,r,s,n)),"scene"===n&&(o=h(o,this._scene,e,t,r,s,n)),this._cacheEnabled&&(this.lastElevationQuery={x:e,y:t,z:r,spatialReference:s,queryContext:n,result:o}),o}getSphereElevationBounds(e,t,r){const s=new c;function n(n){for(const o of n)if(o.getSphereElevationBounds){const n=o.getSphereElevationBounds(e,t,r);null!=n&&s.expandElevationRangeValues(n.elevationRangeMin,n.elevationRangeMax)}}return n(this._ground),n(this._im),"scene"===r&&n(this._scene),s}getRootElevationBounds(){const e=new c;for(const t of[this._im,this._ground,this._scene])t.forEach(t=>{if(t.getRootElevationBounds){const r=t.getRootElevationBounds();null!=r&&e.expandElevationRangeValues(r.elevationRangeMin,r.elevationRangeMax)}});return e}async queryElevation(e,t,r,n,o,i=null,a=0){const l=this._getElevationQuery(n);try{const s=await l.queryElevation(e,t,i,a);return"scene"===o?h(s,this._scene,e,t,r,n,o):s}catch(c){return s(c),this.getElevation(e,t,r,n,o)}}register(e,t){this.addHandles(t.on("elevation-change",e=>this.emit("elevation-change",e)),t),this._providersFromContext(e).push(t)}unregister(e){this.removeHandles(e);for(const t of[this._im,this._ground,this._scene]){const r=t.indexOf(e);r>-1&&t.splice(r,1)}}_providersFromContext(e){switch(e){case"ground":return this._ground;case"im":return this._im;case"scene":return this._scene}}_getElevationQuery(e=this.view.spatialReference){const t=this._cachedQuery;if(null!=t&&a(e,t.spatialReference))return t;t?.destroy({completeTasks:!0});const{wkid:r,wkt:s,wkt2:n,latestWkid:o}=e,c=new l(this.view.resourceController.scheduler,new i({wkid:r,wkt:s,wkt2:n,latestWkid:o}),()=>this.view.map?.ground,{maximumAutoTileRequests:4});return this._cachedQuery=c,c}};function h(e,t,r,s,n,o,i){for(const a of t){const t=a.getElevation(r,s,n,o,i);null!=t&&(e=null!=e?Math.max(t,e):t)}return e}e([n({constructOnly:!0})],u.prototype,"view",void 0),e([n()],u.prototype,"spatialReference",null),u=e([o("esri.views.3d.support.CombinedElevationProvider")],u);export{u as CombinedElevationProvider};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as t}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromExtent as s,clone as a}from"../../../../geometry/support/aaBoundingRect.js";import{toFlowData as i}from"../../../2d/engine/flow/dataUtils.js";import r from"../../layers/FlowSubView3D.js";import{tileToKey as l,FlowDataTile as o}from"./loadUtils.js";import{isRasterTile as n}from"../../terrain/TerrainData.js";let d=class extends r{constructor(e){super(e),this._flowDataTiles=h(),this._resetTileData=!0}initialize(){this.addHandles([this.surface.on("tile-data-changed",({tile:e,layerIndex:t,layerClass:s})=>{const{renderedTiles:a}=this;null!=a&&t===this._layerIndex&&1===s&&this._updateFlowDataTile(e)})]),this.updatingHandles.add(()=>this.renderedTiles,e=>{const t=h();e?.forEach(e=>{const s=this._flowDataTiles.get(l(e))??this._getFlowDataCopy(e);null!=s&&t.set(l(e),s)}),this._flowDataTiles=t,this._resetTileData=!0,this.triggerLoad()})}get _layerIndex(){return this.surface.getLayerIndexByUID(1,this.layerView.uid)}async fetchDataAndGenerateStreamlines(e,t){const{simulationSettings:a,_flowDataTiles:i,workerHandle:r}=this,{size:l}=e;if(null==a||null==r)return;const o=s(e.extent),n=this._resetTileData;this._resetTileData=!1;const d=h();i.forEach((e,t)=>{"delete"===e?(d.set(t,"delete"),i.delete(t)):(n||"on-worker"!==e)&&(d.set(t,e),i.set(t,"on-worker"))});const u={simulationSettings:a,size:l,flowDataTiles:d,reset:n,extent:o,pixelSize:this.surface.tilingScheme.pixelSize},{streamlines:c}=await r.generateTiledStreamlines(u,t);return c}_getFlowDataCopy(e){const{_layerIndex:t}=this,s=null==e.surface;if(null==t||s)return null;const r=e.getLayerInfo(t,1);if(null==r||r.dataMissing||!e.hasLayerData(t,1))return null;const{data:l}=r;if(!n(l))return null;const d=i(this.layer.serviceRasterInfo.dataType,l.source),h=new Uint8Array(d.width*d.height);for(let a=0;a<h.length;a++)h[a]=d.mask[a];return new o(d.data,h,d.width,d.height,e.lij,a(e.extent))}async _updateFlowDataTile(e){if(this.renderedTiles?.has(e)){const t=this._getFlowDataCopy(e)??"delete";this._setTileData(e,t)}else this._setTileData(e,"delete");await this.triggerLoad()}_setTileData(e,t){this._flowDataTiles.set(l(e),t)}};function h(){return new Map}d=e([t("esri.views.3d.support.flow.FlowSubViewTiles3D")],d);export{d as default};
5
+ import{__decorate as e}from"tslib";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as t}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromExtent as s,clone as a}from"../../../../geometry/support/aaBoundingRect.js";import{toFlowData as i}from"../../../2d/engine/flow/dataUtils.js";import r from"../../layers/FlowSubView3D.js";import{tileToKey as l,FlowDataTile as o}from"./loadUtils.js";import{isRasterTile as n}from"../../terrain/TerrainData.js";let d=class extends r{constructor(e){super(e),this._flowDataTiles=h(),this._resetTileData=!0}initialize(){this.addHandles([this.surface.on("tile-data-changed",({tile:e,layerIndex:t,layerClass:s})=>{const{renderedTiles:a}=this;null!=a&&t===this._layerIndex&&1===s&&this._updateFlowDataTile(e)})]),this.updatingHandles.add(()=>this.renderedTiles,e=>{const t=h();e?.forEach(e=>{const s=this._flowDataTiles.get(l(e))??this._getFlowDataCopy(e);null!=s&&t.set(l(e),s)}),this._flowDataTiles=t,this._resetTileData=!0,this.triggerLoad()})}get _layerIndex(){return this.surface.getLayerIndexByUID(1,this.layerView.uid)}async fetchDataAndGenerateStreamlines(e,t){const{simulationSettings:a,_flowDataTiles:i,workerHandle:r}=this,{size:l}=e;if(null==a||null==r)return;const o=s(e.extent),n=this._resetTileData;this._resetTileData=!1;const d=h();i.forEach((e,t)=>{"delete"===e?(d.set(t,"delete"),i.delete(t)):(n||"on-worker"!==e)&&(d.set(t,e),i.set(t,"on-worker"))});const u={simulationSettings:a,size:l,flowDataTiles:d,reset:n,extent:o,pixelSize:this.surface.tilingScheme.pixelSize},{streamlines:c}=await r.generateTiledStreamlines(u,t);return c}_getFlowDataCopy(e){const{_layerIndex:t}=this,s=null==e.surface;if(null==t||s)return null;const r=e.getLayerInfo(t,1);if(null==r||r.dataMissing||!e.hasLayerData(t,1))return null;const{data:l}=r;if(!n(l))return null;const d=i(this.layer.serviceRasterInfo.dataType,l.source),h=new Uint8Array(d.width*d.height);for(let a=0;a<h.length;a++)h[a]=d.mask[a];return new o(d.data,h,d.width,d.height,e.lij,a(e.extent))}async _updateFlowDataTile(e){if(this.renderedTiles?.has(e)){const t=this._getFlowDataCopy(e)??"delete";this._setTileData(e,t)}else this._setTileData(e,"delete");await this.triggerLoad()}_setTileData(e,t){this._flowDataTiles.set(l(e),t)}get test(){return{...super.test,loadedTiles:this._flowDataTiles}}};function h(){return new Map}d=e([t("esri.views.3d.support.flow.FlowSubViewTiles3D")],d);export{d as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{Cyclical as r,cyclicalPI as s}from"../../../core/Cyclical.js";import"../../../core/has.js";import{clamp as i,deg2rad as a}from"../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{watch as o,sync as l}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{subtract as d}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{f as u,d as p,c as m,j as y}from"../../../chunks/vec32.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{t as _,c as f,g as v}from"../../../chunks/vec42.js";import{fromValues as x,create as R}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as w}from"../../../geometry/ellipsoidUtils.js";import{projectVectorToVector as S}from"../../../geometry/projection/projectVectorToVector.js";import{create as O,width as P,copy as T,center as D,height as M,intersection as j,contains as b,intersects as I,offset as C}from"../../../geometry/support/aaBoundingRect.js";import{create as U,wrap as E}from"../../../geometry/support/ray.js";import{h as A,b as q,t as V}from"../../../chunks/sphere.js";import{angleAroundAxis as F}from"../../../geometry/support/vector.js";import{y2lat as G}from"../../../geometry/support/webMercatorUtils.js";import{viewAngle as H}from"../state/utils/viewUtils.js";import{debugFlags as L}from"../support/debugFlags.js";import{DebugPoint as z}from"../support/debugUtils.js";import{OverlayRenderer as k}from"./OverlayRenderer.js";import{Intersector as B}from"../webgl-engine/lib/Intersector.js";import{fromValues as W}from"../webgl-engine/lib/LocalOriginFactory.js";import{SortedRenderGeometryRenderer as Y}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{applyTextureResizeModulo as N,ensureTextureSize as X}from"../webgl-engine/lib/textureUtils.js";import{removeLoadedShaderModules as Z}from"../webgl-engine/parts/renderUtils.js";import{TaskPriority as J,noBudget as K}from"../../support/Scheduler.js";import{Yield as Q}from"../../support/Yield.js";const $=1.3,ee=[[-.1,-2,3.9,2],[-.1,-3.9,3.9,.1],[-2,-3.9,2,.1],[-3.9,-3.9,.1,.1],[-3.9,-2,.1,2],[-3.9,-.1,.1,3.9],[-2,-.1,2,3.9],[-.1,-.1,3.9,3.9]];let te,re=class extends t{constructor(e){super(e),this._renderSR=null,this._overlaySREqualsRenderSR=!0,this._drapeSources=new Set,this._drapeTargets=new Set,this._placementDirty=!1,this._contentUpdated=!1,this._drawTexturesDirty=!1,this._drawTexturesAnimateDirty=!1,this._latestOriginId=0}initialize(){const e=this.view;this.renderer=new k({parent:this}),e.stage.renderer.plugins.add(this.renderer);const t=()=>this.requestRender();this._groundIntersector=new B(this.view.state.viewingMode),this._groundIntersector.options.backfacesTerrain=!0,this._groundIntersector.options.invisibleTerrain=!0,this._groundIntersector.options.hud=!1,this.addHandles([o(()=>this.renderer.hasHighlights,t),this.renderer.events.on("has-water",()=>e.stage?.renderer.updateHasFlags()),this.renderer.events.on("content-changed",t),o(()=>e.state.camera.pixelRatio,t),o(()=>e.state.alignPixelEnabled,t),this.renderer.events.on("textures-disposed",()=>this.surface.requestRender()),o(()=>[e.pointsOfInterest?.renderPointOfView,e.pointsOfInterest?.centerOnSurfaceFrequent?.location],()=>this.setPlacementDirty()),o(()=>[e.state?.pixelRatio,e.state?.contentPixelRatio],()=>this.setPlacementDirty(),l),this.surface.on("elevation-change",()=>this.setPlacementDirty()),e.on("resize",()=>this.setPlacementDirty()),e.resourceController.scheduler.registerTask(J.OVERLAY,this)]),e.stage.renderer.overlay=this}destroy(){this.view?.stage&&(this.view.stage.renderer.plugins.remove(this.renderer),this.view.stage.renderer.overlay=null,n(this.renderer)),te&&(te.hide(),te=null),this.renderer=null}get spatialReference(){return this._spatialReference}set spatialReference(e){this._spatialReference=e,this.renderer.longitudeCyclical=null;const t=this.view.renderSpatialReference;null!=e&&null!=t?(this._renderSR=t,this._overlaySREqualsRenderSR=e.equals(this._renderSR),this._isSpherical&&(this.renderer.longitudeCyclical=e.isWebMercator?new r(-20037508.342787,20037508.342787):new r(-180,180))):this.renderer.disposeOverlays()}get readyToRun(){return this._placementDirty&&(this._drapeSources.size>0||this.view.graphics.length>0||L.OVERLAY_DRAW_DEBUG_TEXTURE)&&!!this._spatialReference&&!this.suspended&&this.surface.ready}get _isSpherical(){return this.view.state.isGlobal}get worldToPCSRatio(){return null!=this._spatialReference&&this._spatialReference.isGeographic&&!this.view.state.isLocal?w(this._spatialReference).metersPerDegree:1}get _overlayStretch(){return $/this.view.resolutionScale}get _longitudeCyclical(){return this.renderer.longitudeCyclical}get suspended(){return this.surface.suspended}get updating(){return this.readyToRun||!!this.renderer?.updating||this._contentUpdated}render(){return this._contentUpdated=!1,this.renderer.processSyncDrapeSources(),this.renderer.precompileShaders(this.view.state)?this._drawOverlays():null}get hasOverlays(){return this.renderer.hasOverlays}registerDrapeSource(e,t){this._drapeSources.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources),this.renderer.registerDrapeSource(e,t),this._updateDrapeSourceExtent(e),this._setContentDirty(),this.notifyChange("readyToRun")}registerGeometryDrapeSource(e){const t=new Y({stage:this.view.stage,drapeSource:e,rendererContext:this.renderer});return this.registerDrapeSource(e,t),t}_updateDrapeSourceExtent(e){2===this.renderer.overlays.length&&null!=e.setDrapingExtent&&null!=this._spatialReference&&e.setDrapingExtent(this.renderer.overlays,this._spatialReference)}unregisterDrapeSource(e){this._drapeSources.has(e)&&(this._drapeSources.delete(e),this.renderer.removeDrapeSourceRenderer(e),this.renderer.ensureDrapeSources(this._drapeSources),this._setContentDirty(),this.notifyChange("readyToRun"))}registerDrapeTarget(e){this._drapeTargets.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources)}unregisterDrapeTarget(e){this._drapeTargets.delete(e),this.renderer.ensureDrapeTargets(this._drapeTargets)}_setContentDirty(){this.setPlacementDirty(),this.requestRender()}setPlacementDirty(){this._placementDirty=!0}runTask(e){return this.updateOverlays(e,this.view.state.contentCamera,1)}updateOverlays(e,t,r){if(!this._spatialReference)return Q;const s=this._computeOverlayHeight(t);this._computeOverlayExtents(t,s,oe),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources,oe.stretch);const i=this._updateOverlay(0,oe.inner,s,1*oe.pixelRatioAdjustment,oe.mapUnitsPerPixel),a=P(oe.inner)/P(oe.outer),n=this._updateOverlay(1,oe.outer,s,a*oe.pixelRatioAdjustment,oe.mapUnitsPerPixel);1!==i&&1!==n||(this._drapeSources.forEach(e=>this._updateDrapeSourceExtent(e)),this.updateOverlayParameters(r)),0===i&&0===n||this.requestRender(),this._placementDirty=!1,e.madeProgress()}_computeOverlayHeight(e){const t=this.view.state.contentPixelRatio*this.view.resolutionScale,r=e.fullWidth/e.pixelRatio*t,s=e.fullHeight/e.pixelRatio*t,i=Math.ceil(1.5*Math.max(r,s)),{maxPreferredTexturePixels:a,maxTextureSize:n}=this.view.stage.renderView.renderingContext.parameters,o=.5*n;return N(X({width:i,height:i},{maxPreferredTexturePixels:2*a,maxTextureSize:o})[1],o)}_updateOverlay(e,t,r,s,i){if(0===this.renderer.overlays.length)return 0;const a=this.renderer.overlays[e],n=a.mapUnitsPerPixel;if(a.mapUnitsPerPixel=i,a.pixelRatio=s,se(t,a.extent)&&r===a.resolution)return n===i?0:2;T(a.extent,t),a.resolution=r;const o=D(a.extent);return a.renderLocalOrigin=W(o[0],o[1],0,"OV_"+this._latestOriginId++),1}updateOverlayParameters(e){this.surface.allTiles.forAll(e=>this.updateTileOverlayParameters(e)),this.surface.requestRender(e)}updateTileOverlayParameters(e){if(!e.renderData)return;const t=e.renderData.overlay;if(0===this.renderer.overlays.length)this._clearTileOverlayData(0,t),this._clearTileOverlayData(1,t);else{const[r,s]=this.renderer.overlays,i=e.extent;this._rectInsideRect(r.extent,i)||this._rectanglesOverlap(i,r.extent)||this._rectanglesOverlap(i,s.extent)?(this._setTileOverlayData(i,0,t),this._setTileOverlayData(i,1,t)):(this._clearTileOverlayData(0,t),this._clearTileOverlayData(1,t))}}overlayPixelSizeInMapUnits(e,t){if(0===this.renderer.overlays.length)return t();const r=this.renderer.overlays[0],s=this.renderer.overlays[1],i=this._pointIsInExtent(e,r.extent)?r:s;return(i.extent[2]-i.extent[0])/i.resolution}_setTileOverlayData(e,t,r){if(0===this.renderer.overlays.length)return;const s=this.renderer.overlays[t].extent,i=P(s),a=M(s);let n=e[0];if(this._longitudeCyclical){n=this._longitudeCyclical.minimalMonotonic(s[0],n);const t=this._longitudeCyclical.minimalMonotonic(s[0],e[2]);n>t&&(n=t-(e[2]-e[0]))}r.setScale(t,P(e)/i,M(e)/a),r.setOffset(t,(n-s[0])/i,(e[1]-s[1])/a)}_clearTileOverlayData(e,t){t.setScale(e,-1,-1),t.setOffset(e,-1,-1)}reloadShaders(){Z(),this.requestRender(),this.runTask(K)}requestRender(e=1){this.renderer.hasOverlays?(1===e?(this._contentUpdated=!0,this._drawTexturesDirty=!0):this._drawTexturesAnimateDirty=!0,this.view.stage.renderView.requestRender(e)):this.setPlacementDirty()}_intersectGroundFromView(e,t,r,s,i){const a=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(e,ce,t,r);if(null==a)return!1;const n=a.origin,o=u(ne,a.origin,a.direction);this._groundIntersector.reset(n,o,e),this._groundIntersector.intersect([]),this.view.basemapTerrain.intersect(this._groundIntersector,null,n,o);const l=this._groundIntersector.results.min;return l.getIntersectionPoint(i)&&l.withinDistance(s)}_findHorizonBasedPointOfInterest(e,t){let r=.5;const a=.55,n=this.view.renderCoordsHelper.getAltitude(e.eye),o=this.view.pointsOfInterest.centerOnSurfaceFrequent,l=1e-5,h=i(o.estimatedSurfaceAltitude,e.aboveGround?-1/0:n+l,e.aboveGround?n-l:1/0),c=e.aboveGround;if("global"===this.view.viewingMode){const t=ne;A(q(V,w(this.view.spatialReference).radius+h),E(e.eye,e.viewForward),t),p(t,t,e.eye);const i=s.normalize(F(e.viewForward,t,e.viewRight))/e.fovY+.5,n=i<=0||i>=1?.5:a;r=c?n*i:i+n*(1-i)}else{const t=.5*Math.PI-Math.acos(-e.viewForward[2]),s=Math.tan(t),n=x(0,s,1,0),o=_(n,n,e.projectionMatrix)[1],l=i(.5+.5*o,0,1);r=1===l||0===l?.5:c?l*a:1-(1-l)*a}return this._intersectGroundFromView(e,.5,r,o.distance,t)}_computeOverlayExtents(e,t,r){const s=this.view.pointsOfInterest.centerOnSurfaceFrequent.renderLocation,i=g();this._findHorizonBasedPointOfInterest(e,i)||m(i,s),L.OVERLAY_SHOW_CENTER?(null==te&&(te=new z(this.view.graphics,"red")),te.show(i,this._renderSR)):null!=te&&te.hide();const n=Math.max(.1,y(e.eye,i)),o=H(this.view.renderCoordsHelper,s,e.eye);this._overlaySREqualsRenderSR||S(i,this._renderSR,i,this._spatialReference);const l=this.surface.extent,h=!this._isSpherical&&this._spatialReference?.isGeographic,c=h&&this._spatialReference?1/w(this._spatialReference).metersPerDegree:1,u=this.view.state.contentPixelRatio,p=e.perScreenPixelRatio/u*n*c;r.mapUnitsPerPixel=p/this.worldToPCSRatio,r.stretch=this._overlayStretch;let _=t*p/2*r.stretch,x=!1,R=h?90:1/0;this._isSpherical&&l&&this._spatialReference&&(this._spatialReference.isWebMercator?(_/=Math.cos(G(i[1])),R=l[3]):(x=!0,_/=w(this._spatialReference).metersPerDegree,R=90),_>=R&&(_=R,i[1]=0,this._spatialReference.isWebMercator&&(i[0]=0)));let O=1;x&&(O=1/Math.max(.2,Math.cos(Math.abs(a(i[1])))),_*O>180&&(O=180/_),r.mapUnitsPerPixel*=O);const D=Math.log(2)/12;_=Math.exp(Math.round(Math.log(_)/D)*D);const M=_*O,I=32,C=.5*t/(I*M),U=.5*t/(I*_);i[0]=Math.round(i[0]*C)/C,i[1]=Math.round(i[1]*U)/U;const E=r.inner;E[0]=i[0]-M,E[1]=i[1]-_,E[2]=i[0]+M,E[3]=i[1]+_,this._isSpherical&&this._shiftExtentToFitBounds(E,1/0,R);const A=r.outer;if(6*M>P(l))T(A,l);else{if(Math.PI/2-Math.abs(o-Math.PI/2)<=.25*Math.PI)A[0]=E[0]-M,A[1]=E[1]-_,A[2]=E[2]+M,A[3]=E[3]+_;else{S(e.eye,this._renderSR,ne,this._spatialReference),d(ae,i,ne);let t=-Math.atan2(ae[1],ae[0])+.125*Math.PI;t<0&&(t+=2*Math.PI);const r=Math.floor(t/(.25*Math.PI));f(ae,ee[r],2*_),ae[0]*=O,ae[2]*=O,v(A,E,ae)}}if(this._isSpherical)A[0]=this._longitudeCyclical.clamp(A[0]),A[2]=this._longitudeCyclical.clamp(A[2]),A[1]=Math.max(A[1],-R),A[3]=Math.min(A[3],R);else{const e=j(E,l,le),t=j(A,l,he);b(e,t)&&(A[2]=A[0],A[3]=A[1])}const q=Math.abs(E[2]-E[0])/t;r.mapUnitsPerPixel=Math.max(r.mapUnitsPerPixel,q),r.pixelRatioAdjustment=r.mapUnitsPerPixel/q}_drawOverlays(e=this.view.state){if(!this._drawTexturesDirty&&!this._drawTexturesAnimateDirty)return this.renderer;const t=!this._drawTexturesDirty&&this._drawTexturesAnimateDirty?0:1;this._drawTexturesDirty=this._drawTexturesAnimateDirty=!1;const r=this.renderer.computeValidity();this.renderer.releaseRenderTargets(t),this.renderer.drawOverlays(e,t);return r!==this.renderer.computeValidity()&&this.updateOverlayParameters(1),this.surface.requestRender(t),1===t&&this.surface.requestUpdate(),this.renderer}_rectanglesOverlap(e,t){return null!=e&&(this._longitudeCyclical?(this._longitudeCyclical.contains(t[0],t[2],e[0])||this._longitudeCyclical.contains(t[0],t[2],e[2])||this._longitudeCyclical.contains(e[0],e[2],t[0]))&&!(e[1]>t[3]||e[3]<t[1]):I(e,t))}_rectInsideRect(e,t){return null!=t&&(this._longitudeCyclical?this._longitudeCyclical.contains(e[0],e[2],t[0])&&this._longitudeCyclical.contains(e[0],e[2],t[2])&&t[1]>e[1]&&t[3]<e[3]:b(e,t))}_pointIsInExtent(e,t){if(this._longitudeCyclical)return this._longitudeCyclical.contains(t[0],t[2],e.x)&&e.y>=t[1]&&e.y<=t[3];const r=e.x,s=e.y;return r>t[0]&&r<t[2]&&s>t[1]&&s<t[3]}_shiftExtentToFitBounds(e,t,r){let s=0,i=0;e[0]<-t?s=e[0]+t:e[2]>t&&(s=t-e[2]),e[1]<-r?i=e[1]+r:e[3]>r&&(i=r-e[3]),C(e,s,i)}get test(){}};function se(e,t){const r=1e-5,s=L.TESTS_DISABLE_OPTIMIZATIONS?0:r*Math.max(e[2]-e[0],e[3]-e[1],t[2]-t[0],t[3]-t[1]);return Math.abs(t[0]-e[0])<=s&&Math.abs(t[1]-e[1])<=s&&Math.abs(t[2]-e[2])<=s&&Math.abs(t[3]-e[3])<=s}e([h()],re.prototype,"_spatialReference",void 0),e([h({readOnly:!0})],re.prototype,"readyToRun",null),e([h()],re.prototype,"_placementDirty",void 0),e([h()],re.prototype,"_contentUpdated",void 0),e([h()],re.prototype,"_isSpherical",null),e([h()],re.prototype,"worldToPCSRatio",null),e([h()],re.prototype,"renderer",void 0),e([h({constructOnly:!0})],re.prototype,"view",void 0),e([h({constructOnly:!0})],re.prototype,"surface",void 0),e([h()],re.prototype,"suspended",null),e([h()],re.prototype,"updating",null),re=e([c("esri.views.3d.terrain.OverlayManager")],re);class ie{constructor(){this.inner=O(),this.outer=O(),this.mapUnitsPerPixel=0,this.pixelRatioAdjustment=1,this.stretch=$}}const ae=R(),ne=g(),oe=new ie,le=O(),he=O(),ce=U();export{re as OverlayManager};
5
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{Cyclical as r,cyclicalPI as s}from"../../../core/Cyclical.js";import"../../../core/has.js";import{clamp as i,deg2rad as a}from"../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{watch as o,sync as l}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{subtract as d}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{f as u,d as p,c as m,j as y}from"../../../chunks/vec32.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{t as _,c as f,h as v}from"../../../chunks/vec42.js";import{fromValues as x,create as R}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as w}from"../../../geometry/ellipsoidUtils.js";import{projectVectorToVector as S}from"../../../geometry/projection/projectVectorToVector.js";import{create as O,width as P,copy as T,center as D,height as M,intersection as j,contains as b,intersects as I,offset as C}from"../../../geometry/support/aaBoundingRect.js";import{create as U,wrap as E}from"../../../geometry/support/ray.js";import{l as A,b as q,t as V}from"../../../chunks/sphere.js";import{angleAroundAxis as F}from"../../../geometry/support/vector.js";import{y2lat as G}from"../../../geometry/support/webMercatorUtils.js";import{viewAngle as H}from"../state/utils/viewUtils.js";import{debugFlags as L}from"../support/debugFlags.js";import{DebugPoint as z}from"../support/debugUtils.js";import{OverlayRenderer as k}from"./OverlayRenderer.js";import{Intersector as B}from"../webgl-engine/lib/Intersector.js";import{fromValues as W}from"../webgl-engine/lib/LocalOriginFactory.js";import{SortedRenderGeometryRenderer as Y}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{applyTextureResizeModulo as N,ensureTextureSize as X}from"../webgl-engine/lib/textureUtils.js";import{removeLoadedShaderModules as Z}from"../webgl-engine/parts/renderUtils.js";import{TaskPriority as J,noBudget as K}from"../../support/Scheduler.js";import{Yield as Q}from"../../support/Yield.js";const $=1.3,ee=[[-.1,-2,3.9,2],[-.1,-3.9,3.9,.1],[-2,-3.9,2,.1],[-3.9,-3.9,.1,.1],[-3.9,-2,.1,2],[-3.9,-.1,.1,3.9],[-2,-.1,2,3.9],[-.1,-.1,3.9,3.9]];let te,re=class extends t{constructor(e){super(e),this._renderSR=null,this._overlaySREqualsRenderSR=!0,this._drapeSources=new Set,this._drapeTargets=new Set,this._placementDirty=!1,this._contentUpdated=!1,this._drawTexturesDirty=!1,this._drawTexturesAnimateDirty=!1,this._latestOriginId=0}initialize(){const e=this.view;this.renderer=new k({parent:this}),e.stage.renderer.plugins.add(this.renderer);const t=()=>this.requestRender();this._groundIntersector=new B(this.view.state.viewingMode),this._groundIntersector.options.backfacesTerrain=!0,this._groundIntersector.options.invisibleTerrain=!0,this._groundIntersector.options.hud=!1,this.addHandles([o(()=>this.renderer.hasHighlights,t),this.renderer.events.on("has-water",()=>e.stage?.renderer.updateHasFlags()),this.renderer.events.on("content-changed",t),o(()=>e.state.camera.pixelRatio,t),o(()=>e.state.alignPixelEnabled,t),this.renderer.events.on("textures-disposed",()=>this.surface.requestRender()),o(()=>[e.pointsOfInterest?.renderPointOfView,e.pointsOfInterest?.centerOnSurfaceFrequent?.location],()=>this.setPlacementDirty()),o(()=>[e.state?.pixelRatio,e.state?.contentPixelRatio],()=>this.setPlacementDirty(),l),this.surface.on("elevation-change",()=>this.setPlacementDirty()),e.on("resize",()=>this.setPlacementDirty()),e.resourceController.scheduler.registerTask(J.OVERLAY,this)]),e.stage.renderer.overlay=this}destroy(){this.view?.stage&&(this.view.stage.renderer.plugins.remove(this.renderer),this.view.stage.renderer.overlay=null,n(this.renderer)),te&&(te.hide(),te=null),this.renderer=null}get spatialReference(){return this._spatialReference}set spatialReference(e){this._spatialReference=e,this.renderer.longitudeCyclical=null;const t=this.view.renderSpatialReference;null!=e&&null!=t?(this._renderSR=t,this._overlaySREqualsRenderSR=e.equals(this._renderSR),this._isSpherical&&(this.renderer.longitudeCyclical=e.isWebMercator?new r(-20037508.342787,20037508.342787):new r(-180,180))):this.renderer.disposeOverlays()}get readyToRun(){return this._placementDirty&&(this._drapeSources.size>0||this.view.graphics.length>0||L.OVERLAY_DRAW_DEBUG_TEXTURE)&&!!this._spatialReference&&!this.suspended&&this.surface.ready}get _isSpherical(){return this.view.state.isGlobal}get worldToPCSRatio(){return null!=this._spatialReference&&this._spatialReference.isGeographic&&!this.view.state.isLocal?w(this._spatialReference).metersPerDegree:1}get _overlayStretch(){return $/this.view.resolutionScale}get _longitudeCyclical(){return this.renderer.longitudeCyclical}get suspended(){return this.surface.suspended}get updating(){return this.readyToRun||!!this.renderer?.updating||this._contentUpdated}render(){return this._contentUpdated=!1,this.renderer.processSyncDrapeSources(),this.renderer.precompileShaders(this.view.state)?this._drawOverlays():null}get hasOverlays(){return this.renderer.hasOverlays}registerDrapeSource(e,t){this._drapeSources.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources),this.renderer.registerDrapeSource(e,t),this._updateDrapeSourceExtent(e),this._setContentDirty(),this.notifyChange("readyToRun")}registerGeometryDrapeSource(e){const t=new Y({stage:this.view.stage,drapeSource:e,rendererContext:this.renderer});return this.registerDrapeSource(e,t),t}_updateDrapeSourceExtent(e){2===this.renderer.overlays.length&&null!=e.setDrapingExtent&&null!=this._spatialReference&&e.setDrapingExtent(this.renderer.overlays,this._spatialReference)}unregisterDrapeSource(e){this._drapeSources.has(e)&&(this._drapeSources.delete(e),this.renderer.removeDrapeSourceRenderer(e),this.renderer.ensureDrapeSources(this._drapeSources),this._setContentDirty(),this.notifyChange("readyToRun"))}registerDrapeTarget(e){this._drapeTargets.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources)}unregisterDrapeTarget(e){this._drapeTargets.delete(e),this.renderer.ensureDrapeTargets(this._drapeTargets)}_setContentDirty(){this.setPlacementDirty(),this.requestRender()}setPlacementDirty(){this._placementDirty=!0}runTask(e){return this.updateOverlays(e,this.view.state.contentCamera,1)}updateOverlays(e,t,r){if(!this._spatialReference)return Q;const s=this._computeOverlayHeight(t);this._computeOverlayExtents(t,s,oe),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources,oe.stretch);const i=this._updateOverlay(0,oe.inner,s,1*oe.pixelRatioAdjustment,oe.mapUnitsPerPixel),a=P(oe.inner)/P(oe.outer),n=this._updateOverlay(1,oe.outer,s,a*oe.pixelRatioAdjustment,oe.mapUnitsPerPixel);1!==i&&1!==n||(this._drapeSources.forEach(e=>this._updateDrapeSourceExtent(e)),this.updateOverlayParameters(r)),0===i&&0===n||this.requestRender(),this._placementDirty=!1,e.madeProgress()}_computeOverlayHeight(e){const t=this.view.state.contentPixelRatio*this.view.resolutionScale,r=e.fullWidth/e.pixelRatio*t,s=e.fullHeight/e.pixelRatio*t,i=Math.ceil(1.5*Math.max(r,s)),{maxPreferredTexturePixels:a,maxTextureSize:n}=this.view.stage.renderView.renderingContext.parameters,o=.5*n;return N(X({width:i,height:i},{maxPreferredTexturePixels:2*a,maxTextureSize:o})[1],o)}_updateOverlay(e,t,r,s,i){if(0===this.renderer.overlays.length)return 0;const a=this.renderer.overlays[e],n=a.mapUnitsPerPixel;if(a.mapUnitsPerPixel=i,a.pixelRatio=s,se(t,a.extent)&&r===a.resolution)return n===i?0:2;T(a.extent,t),a.resolution=r;const o=D(a.extent);return a.renderLocalOrigin=W(o[0],o[1],0,"OV_"+this._latestOriginId++),1}updateOverlayParameters(e){this.surface.allTiles.forAll(e=>this.updateTileOverlayParameters(e)),this.surface.requestRender(e)}updateTileOverlayParameters(e){if(!e.renderData)return;const t=e.renderData.overlay;if(0===this.renderer.overlays.length)this._clearTileOverlayData(0,t),this._clearTileOverlayData(1,t);else{const[r,s]=this.renderer.overlays,i=e.extent;this._rectInsideRect(r.extent,i)||this._rectanglesOverlap(i,r.extent)||this._rectanglesOverlap(i,s.extent)?(this._setTileOverlayData(i,0,t),this._setTileOverlayData(i,1,t)):(this._clearTileOverlayData(0,t),this._clearTileOverlayData(1,t))}}overlayPixelSizeInMapUnits(e,t){if(0===this.renderer.overlays.length)return t();const r=this.renderer.overlays[0],s=this.renderer.overlays[1],i=this._pointIsInExtent(e,r.extent)?r:s;return(i.extent[2]-i.extent[0])/i.resolution}_setTileOverlayData(e,t,r){if(0===this.renderer.overlays.length)return;const s=this.renderer.overlays[t].extent,i=P(s),a=M(s);let n=e[0];if(this._longitudeCyclical){n=this._longitudeCyclical.minimalMonotonic(s[0],n);const t=this._longitudeCyclical.minimalMonotonic(s[0],e[2]);n>t&&(n=t-(e[2]-e[0]))}r.setScale(t,P(e)/i,M(e)/a),r.setOffset(t,(n-s[0])/i,(e[1]-s[1])/a)}_clearTileOverlayData(e,t){t.setScale(e,-1,-1),t.setOffset(e,-1,-1)}reloadShaders(){Z(),this.requestRender(),this.runTask(K)}requestRender(e=1){this.renderer.hasOverlays?(1===e?(this._contentUpdated=!0,this._drawTexturesDirty=!0):this._drawTexturesAnimateDirty=!0,this.view.stage.renderView.requestRender(e)):this.setPlacementDirty()}_intersectGroundFromView(e,t,r,s,i){const a=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(e,ce,t,r);if(null==a)return!1;const n=a.origin,o=u(ne,a.origin,a.direction);this._groundIntersector.reset(n,o,e),this._groundIntersector.intersect([]),this.view.basemapTerrain.intersect(this._groundIntersector,null,n,o);const l=this._groundIntersector.results.min;return l.getIntersectionPoint(i)&&l.withinDistance(s)}_findHorizonBasedPointOfInterest(e,t){let r=.5;const a=.55,n=this.view.renderCoordsHelper.getAltitude(e.eye),o=this.view.pointsOfInterest.centerOnSurfaceFrequent,l=1e-5,h=i(o.estimatedSurfaceAltitude,e.aboveGround?-1/0:n+l,e.aboveGround?n-l:1/0),c=e.aboveGround;if("global"===this.view.viewingMode){const t=ne;A(q(V,w(this.view.spatialReference).radius+h),E(e.eye,e.viewForward),t),p(t,t,e.eye);const i=s.normalize(F(e.viewForward,t,e.viewRight))/e.fovY+.5,n=i<=0||i>=1?.5:a;r=c?n*i:i+n*(1-i)}else{const t=.5*Math.PI-Math.acos(-e.viewForward[2]),s=Math.tan(t),n=x(0,s,1,0),o=_(n,n,e.projectionMatrix)[1],l=i(.5+.5*o,0,1);r=1===l||0===l?.5:c?l*a:1-(1-l)*a}return this._intersectGroundFromView(e,.5,r,o.distance,t)}_computeOverlayExtents(e,t,r){const s=this.view.pointsOfInterest.centerOnSurfaceFrequent.renderLocation,i=g();this._findHorizonBasedPointOfInterest(e,i)||m(i,s),L.OVERLAY_SHOW_CENTER?(null==te&&(te=new z(this.view.graphics,"red")),te.show(i,this._renderSR)):null!=te&&te.hide();const n=Math.max(.1,y(e.eye,i)),o=H(this.view.renderCoordsHelper,s,e.eye);this._overlaySREqualsRenderSR||S(i,this._renderSR,i,this._spatialReference);const l=this.surface.extent,h=!this._isSpherical&&this._spatialReference?.isGeographic,c=h&&this._spatialReference?1/w(this._spatialReference).metersPerDegree:1,u=this.view.state.contentPixelRatio,p=e.perScreenPixelRatio/u*n*c;r.mapUnitsPerPixel=p/this.worldToPCSRatio,r.stretch=this._overlayStretch;let _=t*p/2*r.stretch,x=!1,R=h?90:1/0;this._isSpherical&&l&&this._spatialReference&&(this._spatialReference.isWebMercator?(_/=Math.cos(G(i[1])),R=l[3]):(x=!0,_/=w(this._spatialReference).metersPerDegree,R=90),_>=R&&(_=R,i[1]=0,this._spatialReference.isWebMercator&&(i[0]=0)));let O=1;x&&(O=1/Math.max(.2,Math.cos(Math.abs(a(i[1])))),_*O>180&&(O=180/_),r.mapUnitsPerPixel*=O);const D=Math.log(2)/12;_=Math.exp(Math.round(Math.log(_)/D)*D);const M=_*O,I=32,C=.5*t/(I*M),U=.5*t/(I*_);i[0]=Math.round(i[0]*C)/C,i[1]=Math.round(i[1]*U)/U;const E=r.inner;E[0]=i[0]-M,E[1]=i[1]-_,E[2]=i[0]+M,E[3]=i[1]+_,this._isSpherical&&this._shiftExtentToFitBounds(E,1/0,R);const A=r.outer;if(6*M>P(l))T(A,l);else{if(Math.PI/2-Math.abs(o-Math.PI/2)<=.25*Math.PI)A[0]=E[0]-M,A[1]=E[1]-_,A[2]=E[2]+M,A[3]=E[3]+_;else{S(e.eye,this._renderSR,ne,this._spatialReference),d(ae,i,ne);let t=-Math.atan2(ae[1],ae[0])+.125*Math.PI;t<0&&(t+=2*Math.PI);const r=Math.floor(t/(.25*Math.PI));f(ae,ee[r],2*_),ae[0]*=O,ae[2]*=O,v(A,E,ae)}}if(this._isSpherical)A[0]=this._longitudeCyclical.clamp(A[0]),A[2]=this._longitudeCyclical.clamp(A[2]),A[1]=Math.max(A[1],-R),A[3]=Math.min(A[3],R);else{const e=j(E,l,le),t=j(A,l,he);b(e,t)&&(A[2]=A[0],A[3]=A[1])}const q=Math.abs(E[2]-E[0])/t;r.mapUnitsPerPixel=Math.max(r.mapUnitsPerPixel,q),r.pixelRatioAdjustment=r.mapUnitsPerPixel/q}_drawOverlays(e=this.view.state){if(!this._drawTexturesDirty&&!this._drawTexturesAnimateDirty)return this.renderer;const t=!this._drawTexturesDirty&&this._drawTexturesAnimateDirty?0:1;this._drawTexturesDirty=this._drawTexturesAnimateDirty=!1;const r=this.renderer.computeValidity();this.renderer.releaseRenderTargets(t),this.renderer.drawOverlays(e,t);return r!==this.renderer.computeValidity()&&this.updateOverlayParameters(1),this.surface.requestRender(t),1===t&&this.surface.requestUpdate(),this.renderer}_rectanglesOverlap(e,t){return null!=e&&(this._longitudeCyclical?(this._longitudeCyclical.contains(t[0],t[2],e[0])||this._longitudeCyclical.contains(t[0],t[2],e[2])||this._longitudeCyclical.contains(e[0],e[2],t[0]))&&!(e[1]>t[3]||e[3]<t[1]):I(e,t))}_rectInsideRect(e,t){return null!=t&&(this._longitudeCyclical?this._longitudeCyclical.contains(e[0],e[2],t[0])&&this._longitudeCyclical.contains(e[0],e[2],t[2])&&t[1]>e[1]&&t[3]<e[3]:b(e,t))}_pointIsInExtent(e,t){if(this._longitudeCyclical)return this._longitudeCyclical.contains(t[0],t[2],e.x)&&e.y>=t[1]&&e.y<=t[3];const r=e.x,s=e.y;return r>t[0]&&r<t[2]&&s>t[1]&&s<t[3]}_shiftExtentToFitBounds(e,t,r){let s=0,i=0;e[0]<-t?s=e[0]+t:e[2]>t&&(s=t-e[2]),e[1]<-r?i=e[1]+r:e[3]>r&&(i=r-e[3]),C(e,s,i)}get test(){}};function se(e,t){const r=1e-5,s=L.TESTS_DISABLE_OPTIMIZATIONS?0:r*Math.max(e[2]-e[0],e[3]-e[1],t[2]-t[0],t[3]-t[1]);return Math.abs(t[0]-e[0])<=s&&Math.abs(t[1]-e[1])<=s&&Math.abs(t[2]-e[2])<=s&&Math.abs(t[3]-e[3])<=s}e([h()],re.prototype,"_spatialReference",void 0),e([h({readOnly:!0})],re.prototype,"readyToRun",null),e([h()],re.prototype,"_placementDirty",void 0),e([h()],re.prototype,"_contentUpdated",void 0),e([h()],re.prototype,"_isSpherical",null),e([h()],re.prototype,"worldToPCSRatio",null),e([h()],re.prototype,"renderer",void 0),e([h({constructOnly:!0})],re.prototype,"view",void 0),e([h({constructOnly:!0})],re.prototype,"surface",void 0),e([h()],re.prototype,"suspended",null),e([h()],re.prototype,"updating",null),re=e([c("esri.views.3d.terrain.OverlayManager")],re);class ie{constructor(){this.inner=O(),this.outer=O(),this.mapUnitsPerPixel=0,this.pixelRatioAdjustment=1,this.stretch=$}}const ae=R(),ne=g(),oe=new ie,le=O(),he=O(),ce=U();export{re as OverlayManager};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{OverlayFramebufferObject as e}from"./OverlayFramebufferObject.js";import{olidEnabled as t}from"../webgl-engine/effects/geometry/olidUtils.js";class r{constructor(t,r,s,o,i=1,a=6){this.output=s,this.content=o,this.redrawOnRequest=i,this.fbo=new e(t,a,r)}handleRenderRequest(e){return 1===e||e===this.redrawOnRequest}get valid(){return this.fbo.valid}}class s{constructor(e){this.targets=[new r(e,"overlay color",0,0),new r(e,"overlay IM color",0,1),new r(e,"overlay highlight",8,2,1,3),new r(e,"overlay water",3,3,0),new r(e,"overlay occluded",0,4)],t()&&this.targets.push(new r(e,"overlay olid",9,5,1,5))}getTexture(e){return this.targets[e]?.fbo.texture}dispose(e){if(0!==e)for(const t of this.targets)t.fbo.dispose();else this.targets[3].fbo.dispose()}computeValidity(){return this.targets.reduce((e,t,r)=>t.valid?e|=1<<r:e,0)}}export{s as OverlayRenderTargets,r as RenderTargetDescriptor};
5
+ import{OverlayFramebufferObject as e}from"./OverlayFramebufferObject.js";import{olidEnabled as t}from"../webgl-engine/effects/geometry/olidUtils.js";class r{constructor(t,r,s,o,i=1,a=6){this.output=s,this.content=o,this.redrawOnRequest=i,this.fbo=new e(t,a,r)}handleRenderRequest(e){return 1===e||e===this.redrawOnRequest}get valid(){return this.fbo.valid}}class s{constructor(e){this.targets=[new r(e,"overlay color",0,0),new r(e,"overlay IM color",0,1),new r(e,"overlay highlight",9,2,1,3),new r(e,"overlay water",3,3,0),new r(e,"overlay occluded",0,4)],t()&&this.targets.push(new r(e,"overlay olid",10,5,1,5))}getTexture(e){return this.targets[e]?.fbo.texture}dispose(e){if(0!==e)for(const t of this.targets)t.fbo.dispose();else this.targets[3].fbo.dispose()}computeValidity(){return this.targets.reduce((e,t,r)=>t.valid?e|=1<<r:e,0)}}export{s as OverlayRenderTargets,r as RenderTargetDescriptor};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{EventEmitter as r}from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as t,everyMap as s}from"../../../core/MapUtils.js";import{disposeMaybe as i}from"../../../core/maybe.js";import n from"../../../core/PooledArray.js";import{watch as o,on as a,syncAndInitial as h,initial as d}from"../../../core/reactiveUtils.js";import{someSet as l}from"../../../core/SetUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{ortho as p,fromTranslation as _}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{i as g}from"../../../chunks/vec32.js";import{ones as m}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{debugFlags as y}from"../support/debugFlags.js";import{Overlay as f}from"./Overlay.js";import{OverlayRenderTargets as R}from"./OverlayRenderTargets.js";import v from"../webgl/RenderCamera.js";import{T as x}from"../../../chunks/TextureOnly.glsl.js";import{SyncRenderPlugin as T}from"../webgl-engine/effects/RenderPlugin.js";import{trackHighlightOptions as w,renderHighlightBuffer as S}from"../webgl-engine/effects/highlight/Highlight.js";import{GLMaterialRepository as b}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as O}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderContext as C,defaultRenderOccludedMask as D}from"../webgl-engine/lib/RenderContext.js";import{ShadowMap as P}from"../webgl-engine/lib/ShadowMap.js";import{TextureTechnique as j}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as E}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{AmbientLight as M}from"../webgl-engine/lighting/Lightsources.js";import{O as F}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as W}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as q,noBudget as V}from"../../support/Scheduler.js";import{Texture as A}from"../../webgl/Texture.js";import{TextureDescriptor as G}from"../../webgl/TextureDescriptor.js";let k=class extends T{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new F,this.hasHighlights=!1,this.renderOccludedFlags=1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new n,this._passParameters=new x,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new v,this.events=new r,this.longitudeCyclical=null,this.produces=new Map([[18,e=>8!==e||this.hasHighlights],[19,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1,this._hasDrapedFlowSource=!1}initialize(){const e=this._view,r=e.stage,t=r.renderer.fboCache,{waterTextures:s,techniques:i}=r.renderView;this._renderContext=new C(this._rctx,new P(t,e.state.viewingMode),i),this.addHandles([o(()=>s.updating,()=>this.events.emit("content-changed"),h),o(()=>this.spatialReference,e=>this._localOriginFactory=new O(e),h),a(()=>e.allLayerViews,"after-changes",()=>this._sortedDrapeSourceRenderersDirty=!0),o(()=>w(e.state.highlights),()=>this._sortedDrapeSourceRenderersDirty=!0,d),o(()=>e.state.highlights,r=>{this._bindParameters.highlights=r,this._bindParameters.highlightOrderMap=e.state.highlightOrderMap},d),e.resourceController.scheduler.registerTask(q.OVERLAY_RENDERER,this)]);const{_bindParameters:n,_camera:l}=this;l.near=1,l.far=1e4,l.relativeElevation=null,n.slot=18,n.mainDepth=null,n.camera=l,n.oitPass=0,n.updateLighting([new M(m())],0,0,0)}destroy(){this._renderers.forEach(e=>e.destroy()),this._renderers.clear(),this._passParameters.texture=i(this._passParameters.texture),this.disposeOverlays(),this._renderContext=null,this._sortedRenderers.prune()}get _bindParameters(){return this._renderContext.bind}get _rctx(){return this._stage.renderView.renderingContext}get _view(){return this.parent.view}get _stage(){return this.parent.view.stage}get spatialReference(){return this.parent.spatialReference}get _techniques(){return this._stage.renderView.techniques}get rctx(){return this._rctx}get materials(){return this._pluginContext.materials}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}get pluginContext(){return this._pluginContext}initializeRenderContext(e){const r=new b(this._view.stage.renderView.textures,this._techniques,()=>{this._onMaterialOrContentChanged(),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")},()=>this.events.emit("content-changed"));this._pluginContext={...e,materials:r},this._techniques.precompile(W)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||t(this._renderers,e=>e.updating||e.canCompact)}get hasOverlays(){return null!=this._overlays&&null!=this._renderTargets}getMaterialRenderer(e){for(const r of this._renderers.values()){const t=r.getMaterialRenderer(e);if(t)return t}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),this._sortedRenderers.map(e=>e.drapeSource.layer).filter(e=>!!e)}registerDrapeSource(e,r){const t=this._renderers.get(e);null!=t&&t.destroy(),this._renderers.set(e,r),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(o(()=>e.fullOpacity,()=>this.events.emit("content-changed")),e)}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(e){this._renderTargets?.dispose(e)}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&l(e,e=>1===e.drapeTargetType)}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=l(e,e=>1===e.drapeSourceType),this._hasDrapedRasterSource=l(e,e=>0===e.drapeSourceType),this._hasDrapedFlowSource=l(e,e=>2===e.drapeSourceType)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=this._hasDrapedFlowSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new R(this._stage.renderer.fboCache),this._overlays=[new f,new f]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets?.dispose(1),this._renderTargets=null,this.events.emit("textures-disposed")}_useOverlayColorInsteadOfColorNoRasterImage(e){return 1===e&&!this._needsColorWithoutRasterImage&&this._hasDrapedFeatureSource}getTexture(e){return this._useOverlayColorInsteadOfColorNoRasterImage(e)?this._renderTargets?.getTexture(0):this._renderTargets?.getTexture(e)}get readyToRun(){return this.updating}runTask(e){this._processDrapeSources(e,()=>!0)}_onMaterialOrContentChanged(){this.renderOccludedFlags=t(this._renderers,e=>e.hasOccluders)?H:1}_processDrapeSources(e,r){let s=!1;for(const[t,i]of this._renderers){if(e.done)break;(t.destroyed||r(t))&&(i.commitChanges()&&(s=!0,e.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,s=!0,this._updateSortedDrapeSourceRenderers(),e.madeProgress()),this.compact(e),s&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this._onMaterialOrContentChanged(),this.hasHighlights=t(this._renderers,e=>e.hasHighlights),this.events.emit("content-changed"))}compact(e){let r=!1;for(const t of this._renderers.values()){if(e.done)break;r=t.compact(e)||r}return r&&this.notifyChange("updating"),r}hasHighlight(e){return t(this._renderers,r=>r.hasHighlight(e))}processSyncDrapeSources(){this._processDrapeSources(V,e=>1===e.updatePolicy)}get isEmpty(){return!y.OVERLAY_DRAW_DEBUG_TEXTURE&&s(this._renderers,e=>e.isEmpty)}get hasWater(){const e=t(this._renderers,({hasWater:e})=>e);return e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water")),this._hasWater}renders(e){if(y.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==e&&2!==e)return!0;if(!this._overlays)return!1;const r=this._overlays[0];for(const i of this._overlays)i.setupGeometryViews(this.longitudeCyclical);if(!r.hasSomeSizedView())return!1;const t=this._renderContext.output;this._renderContext.output=this._renderTargets?.targets.find(r=>r.content===e)?.output??0,++this._techniques.precompiling;const s=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._renderContext.output=t,s}get mode(){return this.isEmpty?0:this.hasWater&&this.renders(3)?2:this._renderTargets?.getTexture(0)?1:0}updateAnimation(e){let r=!1;return this._renderers.forEach(t=>r=t.updateAnimation(e)||r),r&&this.parent.requestRender(0),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return!1;const r=this._bindParameters;r.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(const t of this._renderTargets.targets){if(1===t.content&&!this._needsColorWithoutRasterImage)continue;const e=t.output;this._renderContext.output=e,r.slot=3===e?19:18,8===e&&(r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null);const s=this._renderContext.renderOccludedMask;4===t.content&&(this._renderContext.renderOccludedMask=H),this._sortedRenderers.forAll(({drapeSource:e,renderer:r})=>{1===t.content&&0===e.drapeSourceType||4===t.content&&r.hasOnlyOccluders||r.precompile(this._renderContext)}),this._renderContext.renderOccludedMask=s,r.highlightMixTexture=null}return--this._techniques.precompiling,!0}drawOverlays(e,r){if(!this._overlays||!this._renderTargets)return;for(const s of this._overlays)s.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;const t=this.allSourcesOccluders;for(const s of this._renderTargets.targets){if(!(0===s.content&&this._hasDrapedFlowSource)&&!s.handleRenderRequest(r)||1===s.content&&!this._needsColorWithoutRasterImage||4===s.content&&t)continue;const e=this._drawTarget(0,s),i=this._drawTarget(1,s);(e||i)&&s.fbo.generateMipMap()}}_drawTarget(e,r){const t=this._overlays[e],s=t.canvasGeometries;if(0===s.numViews)return!1;const i=this._view.state.contentPixelRatio;this._screenToWorldRatio=i*t.mapUnitsPerPixel/this._bindParameters.overlayStretch;const{output:n}=r;if(this.isEmpty||3===n&&!this.hasWater||!t.hasSomeSizedView())return!1;const{_rctx:o,_camera:a,_renderContext:h,_bindParameters:d}=this;if(a.pixelRatio=t.pixelRatio*i,h.output=n,d.screenToWorldRatio=this._screenToWorldRatio,d.screenToPCSRatio=this._screenToWorldRatio*this.parent.worldToPCSRatio,d.slot=3===n?19:18,4===r.content&&(h.renderOccludedMask=H),!this.renders(r.content))return h.renderOccludedMask=D,!1;const{resolution:l}=t,c=0===e,u=c?0:l;if(o.setViewport(u,0,l,l),this._bindTargetFBO(r),c)if(8!==r.output)o.setClearColor(0,0,0,0),o.clear(16384);else{const{gl:e}=o;e.clearBufferuiv(e.COLOR,0,[0,0,0,0])}if(y.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==r.content&&2!==r.content){this._techniques.precompile(j,U);const r=this._techniques.get(j,U);for(let i=0;i<s.numViews;i++)this._setViewParameters(s.extents[i],t),this._ensureDebugPatternResources(t.resolution,I[e]),o.bindTechnique(r,d,this._passParameters),o.screen.draw()}if(8===r.output){const{fboCache:t}=this._stage.renderer,s=this._resolution;this._bindTargetFBO(r),S(o,t,{width:s,height:s},d,()=>this._renderAllGeometry(e,r),u)}else this._renderAllGeometry(e,r);return o.bindFramebuffer(null),h.renderOccludedMask=D,!0}get allSourcesOccluders(){return s(this._renderers,e=>e.hasOnlyOccluders)}_renderAllGeometry(e,r){const t=this._overlays[e],s=t.canvasGeometries;this._sortedRenderers.forAll(({drapeSource:i,renderer:n})=>{if(1===r.content&&0===i.drapeSourceType)return;const{fullOpacity:o}=i,a=null!=o&&o<1&&0===r.output&&this._bindTemporaryFBO();for(let e=0;e<s.numViews;e++)this._setViewParameters(s.extents[e],t),n.render(this._renderContext);if(a){this._bindTargetFBO(r),this._overlayParameters.texture=a.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const t=this._techniques.get(W);this._rctx.bindTechnique(t,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),a.release()}})}_bindTargetFBO(e){const r=this._resolution,t=2*r;e.fbo.ensureFramebuffer(t,r),e.fbo.bind(this._rctx)}_bindTemporaryFBO(){const e=this._resolution,r=2*e,t=this._stage.renderer.fboCache,s=t.acquire(r,e,"overlay tmp");return t.rctx.bindFramebuffer(s.fbo),t.rctx.clear(16384),s}get _resolution(){return this._overlays?.[0].resolution??0}notifyContentChanged(){this.events.emit("content-changed")}intersect(e,r,t,s){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(const{renderer:n}of this._sortedRenderers)i=n.intersect?.(e,r,t,s,i)??i}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this._view.map.allLayers,r=e.length;this._renderers.forEach((t,s)=>{const i=e.indexOf(s.layer),n=i>=0,o=s.renderGroup??(n?0:1),a=s.drapeSourcePriorityOffset??0,h=r*o+(n?i:0)+a;this._sortedRenderers.push(new L(s,t,h))}),this._sortedRenderers.sort((e,r)=>e.index-r.index)}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],p(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),_(t.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,r){if(g(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let n=0;n<e;n++)for(let r=0;r<e;r++){const i=Math.floor(r/10),o=Math.floor(n/10);i<2||o<2||10*i>e-20||10*o>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&o?1&r^1&n?0:255:1&i^1&o?0:128)}const i=new G(e);i.samplingMode=9728,this._passParameters.texture=new A(this._rctx,i,t)}get test(){}};e([c()],k.prototype,"hasHighlights",void 0),e([c()],k.prototype,"renderOccludedFlags",void 0),e([c()],k.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([c({constructOnly:!0})],k.prototype,"parent",void 0),e([c({readOnly:!0})],k.prototype,"_techniques",null),e([c({type:Boolean,readOnly:!0})],k.prototype,"updating",null),e([c()],k.prototype,"isEmpty",null),k=e([u("esri.views.3d.terrain.OverlayRenderer")],k);class L{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const I=[[1,.5,.5],[.5,.5,1]],B=-2,H=4,U=new E;U.hasAlpha=!0;export{k as OverlayRenderer,B as drapedZ,H as overlayRenderOccludedFlag};
5
+ import{__decorate as e}from"tslib";import{EventEmitter as r}from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as t,everyMap as s}from"../../../core/MapUtils.js";import{disposeMaybe as i}from"../../../core/maybe.js";import n from"../../../core/PooledArray.js";import{watch as o,on as a,syncAndInitial as h,initial as d}from"../../../core/reactiveUtils.js";import{someSet as l}from"../../../core/SetUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{ortho as p,fromTranslation as _}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{i as g}from"../../../chunks/vec32.js";import{ones as m}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{debugFlags as y}from"../support/debugFlags.js";import{Overlay as f}from"./Overlay.js";import{OverlayRenderTargets as R}from"./OverlayRenderTargets.js";import v from"../webgl/RenderCamera.js";import{T as x}from"../../../chunks/TextureOnly.glsl.js";import{SyncRenderPlugin as T}from"../webgl-engine/effects/RenderPlugin.js";import{trackHighlightOptions as w,renderHighlightBuffer as S}from"../webgl-engine/effects/highlight/Highlight.js";import{GLMaterialRepository as b}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as O}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderContext as C,defaultRenderOccludedMask as D}from"../webgl-engine/lib/RenderContext.js";import{ShadowMap as P}from"../webgl-engine/lib/ShadowMap.js";import{TextureTechnique as j}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as E}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{AmbientLight as M}from"../webgl-engine/lighting/Lightsources.js";import{O as F}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as W}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as q,noBudget as V}from"../../support/Scheduler.js";import{Texture as A}from"../../webgl/Texture.js";import{TextureDescriptor as G}from"../../webgl/TextureDescriptor.js";let k=class extends T{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new F,this.hasHighlights=!1,this.renderOccludedFlags=1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new n,this._passParameters=new x,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new v,this.events=new r,this.longitudeCyclical=null,this.produces=new Map([[18,e=>9!==e||this.hasHighlights],[19,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1,this._hasDrapedFlowSource=!1}initialize(){const e=this._view,r=e.stage,t=r.renderer.fboCache,{waterTextures:s,techniques:i}=r.renderView;this._renderContext=new C(this._rctx,new P(t,e.state.viewingMode),i),this.addHandles([o(()=>s.updating,()=>this.events.emit("content-changed"),h),o(()=>this.spatialReference,e=>this._localOriginFactory=new O(e),h),a(()=>e.allLayerViews,"after-changes",()=>this._sortedDrapeSourceRenderersDirty=!0),o(()=>w(e.state.highlights),()=>this._sortedDrapeSourceRenderersDirty=!0,d),o(()=>e.state.highlights,r=>{this._bindParameters.highlights=r,this._bindParameters.highlightOrderMap=e.state.highlightOrderMap},d),e.resourceController.scheduler.registerTask(q.OVERLAY_RENDERER,this)]);const{_bindParameters:n,_camera:l}=this;l.near=1,l.far=1e4,l.relativeElevation=null,n.slot=18,n.mainDepth=null,n.camera=l,n.oitPass=0,n.updateLighting([new M(m())],0,0,0)}destroy(){this._renderers.forEach(e=>e.destroy()),this._renderers.clear(),this._passParameters.texture=i(this._passParameters.texture),this.disposeOverlays(),this._renderContext=null,this._sortedRenderers.prune()}get _bindParameters(){return this._renderContext.bind}get _rctx(){return this._stage.renderView.renderingContext}get _view(){return this.parent.view}get _stage(){return this.parent.view.stage}get spatialReference(){return this.parent.spatialReference}get _techniques(){return this._stage.renderView.techniques}get rctx(){return this._rctx}get materials(){return this._pluginContext.materials}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}get pluginContext(){return this._pluginContext}initializeRenderContext(e){const r=new b(this._view.stage.renderView.textures,this._techniques,()=>{this._onMaterialOrContentChanged(),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")},()=>this.events.emit("content-changed"));this._pluginContext={...e,materials:r},this._techniques.precompile(W)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||t(this._renderers,e=>e.updating||e.canCompact)}get hasOverlays(){return null!=this._overlays&&null!=this._renderTargets}getMaterialRenderer(e){for(const r of this._renderers.values()){const t=r.getMaterialRenderer(e);if(t)return t}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),this._sortedRenderers.map(e=>e.drapeSource.layer).filter(e=>!!e)}registerDrapeSource(e,r){const t=this._renderers.get(e);null!=t&&t.destroy(),this._renderers.set(e,r),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(o(()=>e.fullOpacity,()=>this.events.emit("content-changed")),e)}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(e){this._renderTargets?.dispose(e)}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&l(e,e=>1===e.drapeTargetType)}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=l(e,e=>1===e.drapeSourceType),this._hasDrapedRasterSource=l(e,e=>0===e.drapeSourceType),this._hasDrapedFlowSource=l(e,e=>2===e.drapeSourceType)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=this._hasDrapedFlowSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new R(this._stage.renderer.fboCache),this._overlays=[new f,new f]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets?.dispose(1),this._renderTargets=null,this.events.emit("textures-disposed")}_useOverlayColorInsteadOfColorNoRasterImage(e){return 1===e&&!this._needsColorWithoutRasterImage&&this._hasDrapedFeatureSource}getTexture(e){return this._useOverlayColorInsteadOfColorNoRasterImage(e)?this._renderTargets?.getTexture(0):this._renderTargets?.getTexture(e)}get readyToRun(){return this.updating}runTask(e){this._processDrapeSources(e,()=>!0)}_onMaterialOrContentChanged(){this.renderOccludedFlags=t(this._renderers,e=>e.hasOccluders)?H:1}_processDrapeSources(e,r){let s=!1;for(const[t,i]of this._renderers){if(e.done)break;(t.destroyed||r(t))&&(i.commitChanges()&&(s=!0,e.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,s=!0,this._updateSortedDrapeSourceRenderers(),e.madeProgress()),this.compact(e),s&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this._onMaterialOrContentChanged(),this.hasHighlights=t(this._renderers,e=>e.hasHighlights),this.events.emit("content-changed"))}compact(e){let r=!1;for(const t of this._renderers.values()){if(e.done)break;r=t.compact(e)||r}return r&&this.notifyChange("updating"),r}hasHighlight(e){return t(this._renderers,r=>r.hasHighlight(e))}processSyncDrapeSources(){this._processDrapeSources(V,e=>1===e.updatePolicy)}get isEmpty(){return!y.OVERLAY_DRAW_DEBUG_TEXTURE&&s(this._renderers,e=>e.isEmpty)}get hasWater(){const e=t(this._renderers,({hasWater:e})=>e);return e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water")),this._hasWater}renders(e){if(y.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==e&&2!==e)return!0;if(!this._overlays)return!1;const r=this._overlays[0];for(const i of this._overlays)i.setupGeometryViews(this.longitudeCyclical);if(!r.hasSomeSizedView())return!1;const t=this._renderContext.output;this._renderContext.output=this._renderTargets?.targets.find(r=>r.content===e)?.output??0,++this._techniques.precompiling;const s=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._renderContext.output=t,s}get mode(){return this.isEmpty?0:this.hasWater&&this.renders(3)?2:this._renderTargets?.getTexture(0)?1:0}updateAnimation(e){let r=!1;return this._renderers.forEach(t=>r=t.updateAnimation(e)||r),r&&this.parent.requestRender(0),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return!1;const r=this._bindParameters;r.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(const t of this._renderTargets.targets){if(1===t.content&&!this._needsColorWithoutRasterImage)continue;const e=t.output;this._renderContext.output=e,r.slot=3===e?19:18,9===e&&(r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null);const s=this._renderContext.renderOccludedMask;4===t.content&&(this._renderContext.renderOccludedMask=H),this._sortedRenderers.forAll(({drapeSource:e,renderer:r})=>{1===t.content&&0===e.drapeSourceType||4===t.content&&r.hasOnlyOccluders||r.precompile(this._renderContext)}),this._renderContext.renderOccludedMask=s,r.highlightMixTexture=null}return--this._techniques.precompiling,!0}drawOverlays(e,r){if(!this._overlays||!this._renderTargets)return;for(const s of this._overlays)s.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;const t=this.allSourcesOccluders;for(const s of this._renderTargets.targets){if(!(0===s.content&&this._hasDrapedFlowSource)&&!s.handleRenderRequest(r)||1===s.content&&!this._needsColorWithoutRasterImage||4===s.content&&t)continue;const e=this._drawTarget(0,s),i=this._drawTarget(1,s);(e||i)&&s.fbo.generateMipMap()}}_drawTarget(e,r){const t=this._overlays[e],s=t.canvasGeometries;if(0===s.numViews)return!1;const i=this._view.state.contentPixelRatio;this._screenToWorldRatio=i*t.mapUnitsPerPixel/this._bindParameters.overlayStretch;const{output:n}=r;if(this.isEmpty||3===n&&!this.hasWater||!t.hasSomeSizedView())return!1;const{_rctx:o,_camera:a,_renderContext:h,_bindParameters:d}=this;if(a.pixelRatio=t.pixelRatio*i,h.output=n,d.screenToWorldRatio=this._screenToWorldRatio,d.screenToPCSRatio=this._screenToWorldRatio*this.parent.worldToPCSRatio,d.slot=3===n?19:18,4===r.content&&(h.renderOccludedMask=H),!this.renders(r.content))return h.renderOccludedMask=D,!1;const{resolution:l}=t,c=0===e,u=c?0:l;if(o.setViewport(u,0,l,l),this._bindTargetFBO(r),c)if(9!==r.output)o.setClearColor(0,0,0,0),o.clear(16384);else{const{gl:e}=o;e.clearBufferuiv(e.COLOR,0,[0,0,0,0])}if(y.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==r.content&&2!==r.content){this._techniques.precompile(j,U);const r=this._techniques.get(j,U);for(let i=0;i<s.numViews;i++)this._setViewParameters(s.extents[i],t),this._ensureDebugPatternResources(t.resolution,I[e]),o.bindTechnique(r,d,this._passParameters),o.screen.draw()}if(9===r.output){const{fboCache:t}=this._stage.renderer,s=this._resolution;this._bindTargetFBO(r),S(o,t,{width:s,height:s},d,()=>this._renderAllGeometry(e,r),u)}else this._renderAllGeometry(e,r);return o.bindFramebuffer(null),h.renderOccludedMask=D,!0}get allSourcesOccluders(){return s(this._renderers,e=>e.hasOnlyOccluders)}_renderAllGeometry(e,r){const t=this._overlays[e],s=t.canvasGeometries;this._sortedRenderers.forAll(({drapeSource:i,renderer:n})=>{if(1===r.content&&0===i.drapeSourceType)return;const{fullOpacity:o}=i,a=null!=o&&o<1&&0===r.output&&this._bindTemporaryFBO();for(let e=0;e<s.numViews;e++)this._setViewParameters(s.extents[e],t),n.render(this._renderContext);if(a){this._bindTargetFBO(r),this._overlayParameters.texture=a.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const t=this._techniques.get(W);this._rctx.bindTechnique(t,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),a.release()}})}_bindTargetFBO(e){const r=this._resolution,t=2*r;e.fbo.ensureFramebuffer(t,r),e.fbo.bind(this._rctx)}_bindTemporaryFBO(){const e=this._resolution,r=2*e,t=this._stage.renderer.fboCache,s=t.acquire(r,e,"overlay tmp");return t.rctx.bindFramebuffer(s.fbo),t.rctx.clear(16384),s}get _resolution(){return this._overlays?.[0].resolution??0}notifyContentChanged(){this.events.emit("content-changed")}intersect(e,r,t,s){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(const{renderer:n}of this._sortedRenderers)i=n.intersect?.(e,r,t,s,i)??i}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this._view.map.allLayers,r=e.length;this._renderers.forEach((t,s)=>{const i=e.indexOf(s.layer),n=i>=0,o=s.renderGroup??(n?0:1),a=s.drapeSourcePriorityOffset??0,h=r*o+(n?i:0)+a;this._sortedRenderers.push(new L(s,t,h))}),this._sortedRenderers.sort((e,r)=>e.index-r.index)}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],p(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),_(t.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,r){if(g(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let n=0;n<e;n++)for(let r=0;r<e;r++){const i=Math.floor(r/10),o=Math.floor(n/10);i<2||o<2||10*i>e-20||10*o>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&o?1&r^1&n?0:255:1&i^1&o?0:128)}const i=new G(e);i.samplingMode=9728,this._passParameters.texture=new A(this._rctx,i,t)}get test(){}};e([c()],k.prototype,"hasHighlights",void 0),e([c()],k.prototype,"renderOccludedFlags",void 0),e([c()],k.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([c({constructOnly:!0})],k.prototype,"parent",void 0),e([c({readOnly:!0})],k.prototype,"_techniques",null),e([c({type:Boolean,readOnly:!0})],k.prototype,"updating",null),e([c()],k.prototype,"isEmpty",null),k=e([u("esri.views.3d.terrain.OverlayRenderer")],k);class L{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const I=[[1,.5,.5],[.5,.5,1]],B=-2,H=4,U=new E;U.hasAlpha=!0;export{k as OverlayRenderer,B as drapedZ,H as overlayRenderOccludedFlag};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{lerp as t}from"../../../core/mathUtils.js";import{n as e,i,f as s,g as o,H as n,h as r,e as a,F as l,a as h}from"../../../chunks/vec32.js";import{create as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{lonLatToSphericalPCPF as d}from"../../../geometry/projection/lonLatToSphericalPCPF.js";import{newDoubleArray as c}from"../../../geometry/support/DoubleArray.js";import{intersectsSphere as p,numPlanes as f}from"../../../geometry/support/frustum.js";import{c as m,o as g,a as x,p as $,e as v,k as M}from"../../../chunks/sphere.js";import{createSphericalGlobePatch as _,updateCornerSpherical as b,updateEdgesAndCornersSpherical as j,updateEdgeElevationsAndResolutionsSpherical as y}from"./PatchGeometryFactory.js";import{enableTerrainInternalChecks as B,internalAssert as S,almostEquals as V}from"./terrainUtils.js";import{Tile as H}from"./Tile.js";import{compareTilesByLij as R}from"./tileUtils.js";class T extends H{constructor(t,e,i,s,o){super(),this._convexHull=new Array(24),this._boundingSphere=m(),this._baseUsedMemory=1816,this.init(t,e,i,s,o)}init(i,s,o,n,r){super.init(i,s,o,n,r);const a=this.ellipsoid.radius,l=this.extentInRadians[0],h=this.extentInRadians[1],u=this.extentInRadians[2],c=this.extentInRadians[3],p=t(h,c,.5),f=t(l,u,.5),m=0===i?0:Math.min(Math.abs(h),Math.abs(c));this._edgeLen=(u-l)*Math.cos(m)*a,this._edgeLen2=this._edgeLen*this._edgeLen,this._curvatureHeight=a-Math.sqrt(a*a-this._edgeLen2/4),d(this.centerAtSeaLevel,f,p,this.ellipsoid.radius),e(this.up,this.centerAtSeaLevel),this.updateRadiusAndCenter()}updateRadiusAndCenter(){this._updateBoundingVolumes();const t=this._center;if(0===this.lij[0])g(t[1],0,0,0),i(t[0],0,0,0),i(t[2],0,0,0),t[1][3]=this.ellipsoid.radius+this.elevationBoundsMax;else{this._updateCenter();const e=t[1],i=this.convexHull;let s=0;const o=x(e);for(let t=0;t<8;++t)s=Math.max(s,I(o,i,3*t));t[1][3]=Math.sqrt(s)}}_calculateFrustumVisibility(t){if(!p(t,this._boundingSphere))return 2;if(this.lij[0]<10)return 1;const e=this.convexHull,i=this.surface.view.state.camera.near;let s=!0;for(let o=0;o<f;o++){const n=4===o,r=t[o],a=r[0],l=r[1],h=r[2],u=r[3]-(n?i:0);let d=!1;for(let t=0;t<8;++t){const i=3*t;if(a*e[i]+l*e[i+1]+h*e[i+2]+u<0){if(d=!0,!s)break}else s=!1}if(!d)return 2}return s?0:1}computeElevationBounds(){super.computeElevationBounds(),this._updateBoundingVolumes()}createGeometry(){_(this.renderData,this._getPatchType()),this._updateBoundingVolumes(),this.setMemoryDirty()}_updateBoundingVolumes(){this._updateConvexHull(),this._updateBoundingSphere(),B&&this._checkBVs()}_updateBoundingSphere(){const t=this._boundingSphere,e=this.elevationBoundsMin,i=this.elevationBoundsMax,r=this.ellipsoid.radius,a=i;if(0===this.level)$(t,0,0,0,r+a);else{const a=this.extentInRadians,l=.5*(a[0]+a[2]),h=a[1],u=a[3];L(k,l,h,r),L(A,l,u,r),s(D,k,A);o(D,D,(r+.5*(e+i))/n(D));const d=this.convexHull;let c=0;const p=(t,e)=>{const i=t[0]-d[3*e],s=t[1]-d[3*e+1],o=t[2]-d[3*e+2];return Math.sqrt(i*i+s*s+o*o)};for(let t=0;t<8;++t){const e=p(D,t);c=Math.max(c,e)}v(t,D,c+2)}}_updateConvexHull(){const t=this.extentInRadians,i=this.ellipsoid.radius;if(0===this.level)return;const l=this.elevationBoundsMin,d=this.elevationBoundsMax,c=this._getPatchType(),p=this.surface.isWebMercator,f=p&&1===c,m=p&&2===c,g=m||f,x=Math.PI/2,$=t[0],v=t[2],M=m?-x:t[1],_=f?x:t[3],b=.5*($+v),j=l,y=i+(g?Math.min(0,j-1):j),B=(t,e,i)=>L(t,e,i,y),H=u(),R=u(),T=u(),C=u();B(H,$,M),B(R,$,_),B(T,v,_),B(C,v,M);const I=(t,e)=>{for(let i=0;i<3;++i)this._convexHull[3*e+i]=t[i]};I(H,0),I(R,1),I(T,2),I(C,3);const F=d,k=i+(g?Math.max(0,F+1):F),A=u(),D=u(),E=u();L(D,b,_,y),L(E,b,M,y),s(A,D,E),e(A,A);const w=u(),U=u(),q=(t,i)=>{h(U,t,i),e(U,U);const n=-a(t,w)/a(U,w);S(n>=0),o(U,U,n),s(t,t,U)};if(2**this.lij[0]>2*this.lij[1]){const t=E,i=u();r(i,P,t),e(i,i),r(w,t,i),e(w,w),S(V(a(w,t)/n(t),0)),q(H,R),q(C,T),I(H,0),I(C,3)}else if(2**this.lij[0]!==2*this.lij[1]){const t=D,i=u();r(i,P,t),e(i,i),r(w,i,t),e(w,w),q(R,H),q(T,C),I(R,1),I(T,2)}const N=(t,e)=>{const i=k/a(e,A);for(let s=0;s<3;++s)this._convexHull[3*t+s]=e[s]*i};N(4,H),N(5,R),N(6,T),N(7,C)}_getPatchType(){const t=this.lij[1],e=0===t,i=t===(1<<this.level)-1;return e?i?3:1:i?2:0}intersectsRay(t,e,i,s){const o=this._boundingSphere,n=o[3]+i,r=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],a=o[0]-t[0],l=o[1]-t[1],h=o[2]-t[2],u=(a*e[0]+l*e[1]+h*e[2])/r,d=e[0]*u-a,c=e[1]*u-l,p=e[2]*u-h;return d*d+c*c+p*p<n*n}get minimumVerticesPerSide(){return this.level<C.length?C[this.level]+1:2}updateCornerElevations(){b(this.renderData),this._updateBoundingVolumes()}updateEdgeElevations(){j(this.renderData),this._updateBoundingVolumes()}updateEdgeElevationsAndResolutions(){y(this.renderData),this._updateBoundingVolumes()}_checkBVs(){if(!B)return;if(this.level<=2)return;const t=this._boundingSphere,i=t[3],o=M(t,u()),d=u(),p=this.ellipsoid.radius,f=this.elevationBoundsMin,m=this.elevationBoundsMax,g=p+f,x=1,$=0,v=this._center[1];M(v,u());const _=v[3],b=this.convexHull,j=(t,e)=>{for(let i=0;i<3;++i)t[i]=b[3*e+i]};{const t=u(),i=u(),s=u(),o=u(),n=u(),l=(l,u,d,c)=>{j(i,l),j(s,u),j(o,d),h(i,i,s),h(o,o,s),r(t,i,o),e(t,t);const p=a(t,s);j(n,c);const f=a(t,n),m=Math.abs(f-p);S(V(m,0),`Non coplanar ${l},${u},${d},${c} diff = ${m}`)};l(0,1,2,3),l(4,5,6,7),l(0,1,4,5),l(1,2,5,6),l(2,3,6,7),l(3,0,7,4)}const y=c(24),H=(t,e,i)=>{const s=4*t;for(let o=0;o<3;++o)y[s+o]=e[o];y[s+3]=i},T=u(),C=u(),I=u(),P=u(),k=(t,i,s,o)=>{j(T,i),j(C,s),j(I,o),h(T,T,C),e(T,T),h(I,I,C),e(I,I),r(P,T,I),e(P,P);const n=a(P,C);H(t,P,n)};k(0,0,1,2),k(1,1,0,4),k(2,1,5,2),k(3,3,2,6),k(4,4,0,3),k(5,4,6,5);const A=(t,e,i,s)=>{const o=4*t;return y[o]*e+y[o+1]*i+y[o+2]*s-y[o+3]},D=(t,e,i,s)=>A(t,e,i,s)>=-1,E=(t,e)=>D(t,e[0],e[1],e[2]),w=2**this.lij[0]>2*this.lij[1],U=(t,e,s)=>Math.sqrt(F(t,e,s,o[0],o[1],o[2]))<i,q=t=>U(t[0],t[1],t[2]),N=(t,e)=>U(t[e],t[e+1],t[e+2]),G=this.extentInRadians,z=.5*(G[0]+G[2]),O=G[1],W=G[3],J=u(),K=u();L(J,z,W,g),L(K,z,O,g);const Q=w?"Upper":"Lower";let X=!0;for(let e=0;e<6;++e){for(let t=0;t<8;++t){const i=3*t,s=D(e,b[i],b[i+1],b[i+2]);X&&=s,S(s,`Tile[${this.lij}] Convex hull point ${t} outside of plane ${e}`)}S(E(e,K),`Tile[${this.lij}] (${Q}) bottom mid outside of plane ${e}`),S(E(e,J),`Tile[${this.lij}] (${Q}) top mid outside of plane ${e}`)}S(X,"Not all convex hull points are inside convex hull polyhedron"),S(q(K),`Tile[${this.lij}] (${Q}) bottom mid outside of bounding sphere`),S(q(J),`Tile[${this.lij}] (${Q}) top mid outside of bounding sphere`);for(let e=0;e<8;++e){const t=N(b,3*e);S(t,`Tile[${this.lij}] Convex hull point ${e} outside of bounding sphere`)}for(let e=0;e<6;++e)for(let t=0;t<8;++t){const i=3*t;D(e,b[i],b[i+1],b[i+2])||console.error(`Tile[${this.lij}] Convex hull point ${t} outside of plane ${e}`)}const{extentInRadians:Y}=this,Z=Math.max(Y[2]-Y[0],Y[3]-Y[1]),tt=Math.round(Z*p),{renderData:et}=this;if(!et)return;const{geometry:it,geometryState:st,localOrigin:ot}=et,nt=it.vertexAttributes?.position;if(!nt)return;const rt=u(),at=it.numVerticesPerSide-2,{indices:lt,indexCount:ht,edgeVerticesStartIndex:ut,poleVerticesStartIndex:dt}=it;if(!lt)return;const ct=new Set;for(let e=0;e<ht;++e){const t=lt[e];if(ct.has(t))continue;ct.add(t);const r=t<dt,a=t>=ut;let h=!1,u=-1;if(a){let e=ut;for(let i=0;i<4;++i){const s=st.edgeResolutions[i];if(t===e||t===e+s-1){h=!0;break}if(e+=s,t<e){u=i;break}}}const c=a?st.edgePeerNeighbors[u]:null,g=a&&c&&R(this,c)>0;nt.getVec(t,d),s(rt,d,ot);const v=n(rt)-p;let M=0,b=!1;const j=f-v,y=v-m,B=j>x,S=y>x,V=B||S,H=()=>{const e=r?"internal":a&&!h?"edge":h?"corner":"pole";return`Tile[${this.lij}].vertex[${t}]:${e}`+(B?"(below)":S?"(above)":"")+(g?"(Neighbor)":"")},T=l(rt,o);if(T>=i+$){const t=T-i;V||(console.error(`${H()} is out of the bounding sphere by ${t.toFixed(0)} / ${i.toFixed(0)}[tol=${$}] h=${v.toFixed(0)} / [${f.toFixed(0)}..${m.toFixed(0)}] (${(t/i).toFixed(0)})`),b=!0)}for(let e=0;e<6;++e)if(!D(e,rt[0],rt[1],rt[2])){const s=A(e,rt[0],rt[1],rt[2]),o=t%at,n=(t-o)/at;0===e&&j||5===e&&y||(console.error(`${H()} (${o},${n})|${at}] is out of the bounding trapezoid plane ${e} h=${Math.round(v)} / [${Math.round(f)}..${Math.round(m)}] dist=${Math.round(s)} radii = ${Math.round(i)}/${Math.round(_)}} : maxL = ${tt}`),++M)}if(b||M>0)break}}get convexHull(){return this._convexHull}}const C=[128,64,64,32,16,8,8,4];function I(t,e,i){return F(t[0],t[1],t[2],e[i],e[i+1],e[i+2])}function F(t,e,i,s,o,n){const r=s-t,a=o-e,l=n-i;return r*r+a*a+l*l}const L=(t,e,i,s)=>{const o=Math.cos(e),n=Math.sin(e),r=Math.cos(i),a=Math.sin(i);t[0]=s*r*o,t[1]=s*r*n,t[2]=s*a},P=[0,0,1],k=u(),A=u(),D=u();export{T as SphericalPatch};
5
+ import{lerp as t}from"../../../core/mathUtils.js";import{n as e,i,f as s,g as o,H as n,h as r,e as a,F as l,a as h}from"../../../chunks/vec32.js";import{create as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{lonLatToSphericalPCPF as d}from"../../../geometry/projection/lonLatToSphericalPCPF.js";import{newDoubleArray as c}from"../../../geometry/support/DoubleArray.js";import{intersectsSphere as p,numPlanes as f}from"../../../geometry/support/frustum.js";import{c as m,u as g,a as x,v as $,e as v,n as M}from"../../../chunks/sphere.js";import{createSphericalGlobePatch as _,updateCornerSpherical as b,updateEdgesAndCornersSpherical as j,updateEdgeElevationsAndResolutionsSpherical as y}from"./PatchGeometryFactory.js";import{enableTerrainInternalChecks as B,internalAssert as S,almostEquals as V}from"./terrainUtils.js";import{Tile as H}from"./Tile.js";import{compareTilesByLij as R}from"./tileUtils.js";class T extends H{constructor(t,e,i,s,o){super(),this._convexHull=new Array(24),this._boundingSphere=m(),this._baseUsedMemory=1816,this.init(t,e,i,s,o)}init(i,s,o,n,r){super.init(i,s,o,n,r);const a=this.ellipsoid.radius,l=this.extentInRadians[0],h=this.extentInRadians[1],u=this.extentInRadians[2],c=this.extentInRadians[3],p=t(h,c,.5),f=t(l,u,.5),m=0===i?0:Math.min(Math.abs(h),Math.abs(c));this._edgeLen=(u-l)*Math.cos(m)*a,this._edgeLen2=this._edgeLen*this._edgeLen,this._curvatureHeight=a-Math.sqrt(a*a-this._edgeLen2/4),d(this.centerAtSeaLevel,f,p,this.ellipsoid.radius),e(this.up,this.centerAtSeaLevel),this.updateRadiusAndCenter()}updateRadiusAndCenter(){this._updateBoundingVolumes();const t=this._center;if(0===this.lij[0])g(t[1],0,0,0),i(t[0],0,0,0),i(t[2],0,0,0),t[1][3]=this.ellipsoid.radius+this.elevationBoundsMax;else{this._updateCenter();const e=t[1],i=this.convexHull;let s=0;const o=x(e);for(let t=0;t<8;++t)s=Math.max(s,I(o,i,3*t));t[1][3]=Math.sqrt(s)}}_calculateFrustumVisibility(t){if(!p(t,this._boundingSphere))return 2;if(this.lij[0]<10)return 1;const e=this.convexHull,i=this.surface.view.state.camera.near;let s=!0;for(let o=0;o<f;o++){const n=4===o,r=t[o],a=r[0],l=r[1],h=r[2],u=r[3]-(n?i:0);let d=!1;for(let t=0;t<8;++t){const i=3*t;if(a*e[i]+l*e[i+1]+h*e[i+2]+u<0){if(d=!0,!s)break}else s=!1}if(!d)return 2}return s?0:1}computeElevationBounds(){super.computeElevationBounds(),this._updateBoundingVolumes()}createGeometry(){_(this.renderData,this._getPatchType()),this._updateBoundingVolumes(),this.setMemoryDirty()}_updateBoundingVolumes(){this._updateConvexHull(),this._updateBoundingSphere(),B&&this._checkBVs()}_updateBoundingSphere(){const t=this._boundingSphere,e=this.elevationBoundsMin,i=this.elevationBoundsMax,r=this.ellipsoid.radius,a=i;if(0===this.level)$(t,0,0,0,r+a);else{const a=this.extentInRadians,l=.5*(a[0]+a[2]),h=a[1],u=a[3];L(k,l,h,r),L(A,l,u,r),s(D,k,A);o(D,D,(r+.5*(e+i))/n(D));const d=this.convexHull;let c=0;const p=(t,e)=>{const i=t[0]-d[3*e],s=t[1]-d[3*e+1],o=t[2]-d[3*e+2];return Math.sqrt(i*i+s*s+o*o)};for(let t=0;t<8;++t){const e=p(D,t);c=Math.max(c,e)}v(t,D,c+2)}}_updateConvexHull(){const t=this.extentInRadians,i=this.ellipsoid.radius;if(0===this.level)return;const l=this.elevationBoundsMin,d=this.elevationBoundsMax,c=this._getPatchType(),p=this.surface.isWebMercator,f=p&&1===c,m=p&&2===c,g=m||f,x=Math.PI/2,$=t[0],v=t[2],M=m?-x:t[1],_=f?x:t[3],b=.5*($+v),j=l,y=i+(g?Math.min(0,j-1):j),B=(t,e,i)=>L(t,e,i,y),H=u(),R=u(),T=u(),C=u();B(H,$,M),B(R,$,_),B(T,v,_),B(C,v,M);const I=(t,e)=>{for(let i=0;i<3;++i)this._convexHull[3*e+i]=t[i]};I(H,0),I(R,1),I(T,2),I(C,3);const F=d,k=i+(g?Math.max(0,F+1):F),A=u(),D=u(),E=u();L(D,b,_,y),L(E,b,M,y),s(A,D,E),e(A,A);const w=u(),U=u(),q=(t,i)=>{h(U,t,i),e(U,U);const n=-a(t,w)/a(U,w);S(n>=0),o(U,U,n),s(t,t,U)};if(2**this.lij[0]>2*this.lij[1]){const t=E,i=u();r(i,P,t),e(i,i),r(w,t,i),e(w,w),S(V(a(w,t)/n(t),0)),q(H,R),q(C,T),I(H,0),I(C,3)}else if(2**this.lij[0]!==2*this.lij[1]){const t=D,i=u();r(i,P,t),e(i,i),r(w,i,t),e(w,w),q(R,H),q(T,C),I(R,1),I(T,2)}const N=(t,e)=>{const i=k/a(e,A);for(let s=0;s<3;++s)this._convexHull[3*t+s]=e[s]*i};N(4,H),N(5,R),N(6,T),N(7,C)}_getPatchType(){const t=this.lij[1],e=0===t,i=t===(1<<this.level)-1;return e?i?3:1:i?2:0}intersectsRay(t,e,i,s){const o=this._boundingSphere,n=o[3]+i,r=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],a=o[0]-t[0],l=o[1]-t[1],h=o[2]-t[2],u=(a*e[0]+l*e[1]+h*e[2])/r,d=e[0]*u-a,c=e[1]*u-l,p=e[2]*u-h;return d*d+c*c+p*p<n*n}get minimumVerticesPerSide(){return this.level<C.length?C[this.level]+1:2}updateCornerElevations(){b(this.renderData),this._updateBoundingVolumes()}updateEdgeElevations(){j(this.renderData),this._updateBoundingVolumes()}updateEdgeElevationsAndResolutions(){y(this.renderData),this._updateBoundingVolumes()}_checkBVs(){if(!B)return;if(this.level<=2)return;const t=this._boundingSphere,i=t[3],o=M(t,u()),d=u(),p=this.ellipsoid.radius,f=this.elevationBoundsMin,m=this.elevationBoundsMax,g=p+f,x=1,$=0,v=this._center[1];M(v,u());const _=v[3],b=this.convexHull,j=(t,e)=>{for(let i=0;i<3;++i)t[i]=b[3*e+i]};{const t=u(),i=u(),s=u(),o=u(),n=u(),l=(l,u,d,c)=>{j(i,l),j(s,u),j(o,d),h(i,i,s),h(o,o,s),r(t,i,o),e(t,t);const p=a(t,s);j(n,c);const f=a(t,n),m=Math.abs(f-p);S(V(m,0),`Non coplanar ${l},${u},${d},${c} diff = ${m}`)};l(0,1,2,3),l(4,5,6,7),l(0,1,4,5),l(1,2,5,6),l(2,3,6,7),l(3,0,7,4)}const y=c(24),H=(t,e,i)=>{const s=4*t;for(let o=0;o<3;++o)y[s+o]=e[o];y[s+3]=i},T=u(),C=u(),I=u(),P=u(),k=(t,i,s,o)=>{j(T,i),j(C,s),j(I,o),h(T,T,C),e(T,T),h(I,I,C),e(I,I),r(P,T,I),e(P,P);const n=a(P,C);H(t,P,n)};k(0,0,1,2),k(1,1,0,4),k(2,1,5,2),k(3,3,2,6),k(4,4,0,3),k(5,4,6,5);const A=(t,e,i,s)=>{const o=4*t;return y[o]*e+y[o+1]*i+y[o+2]*s-y[o+3]},D=(t,e,i,s)=>A(t,e,i,s)>=-1,E=(t,e)=>D(t,e[0],e[1],e[2]),w=2**this.lij[0]>2*this.lij[1],U=(t,e,s)=>Math.sqrt(F(t,e,s,o[0],o[1],o[2]))<i,q=t=>U(t[0],t[1],t[2]),N=(t,e)=>U(t[e],t[e+1],t[e+2]),G=this.extentInRadians,z=.5*(G[0]+G[2]),O=G[1],W=G[3],J=u(),K=u();L(J,z,W,g),L(K,z,O,g);const Q=w?"Upper":"Lower";let X=!0;for(let e=0;e<6;++e){for(let t=0;t<8;++t){const i=3*t,s=D(e,b[i],b[i+1],b[i+2]);X&&=s,S(s,`Tile[${this.lij}] Convex hull point ${t} outside of plane ${e}`)}S(E(e,K),`Tile[${this.lij}] (${Q}) bottom mid outside of plane ${e}`),S(E(e,J),`Tile[${this.lij}] (${Q}) top mid outside of plane ${e}`)}S(X,"Not all convex hull points are inside convex hull polyhedron"),S(q(K),`Tile[${this.lij}] (${Q}) bottom mid outside of bounding sphere`),S(q(J),`Tile[${this.lij}] (${Q}) top mid outside of bounding sphere`);for(let e=0;e<8;++e){const t=N(b,3*e);S(t,`Tile[${this.lij}] Convex hull point ${e} outside of bounding sphere`)}for(let e=0;e<6;++e)for(let t=0;t<8;++t){const i=3*t;D(e,b[i],b[i+1],b[i+2])||console.error(`Tile[${this.lij}] Convex hull point ${t} outside of plane ${e}`)}const{extentInRadians:Y}=this,Z=Math.max(Y[2]-Y[0],Y[3]-Y[1]),tt=Math.round(Z*p),{renderData:et}=this;if(!et)return;const{geometry:it,geometryState:st,localOrigin:ot}=et,nt=it.vertexAttributes?.position;if(!nt)return;const rt=u(),at=it.numVerticesPerSide-2,{indices:lt,indexCount:ht,edgeVerticesStartIndex:ut,poleVerticesStartIndex:dt}=it;if(!lt)return;const ct=new Set;for(let e=0;e<ht;++e){const t=lt[e];if(ct.has(t))continue;ct.add(t);const r=t<dt,a=t>=ut;let h=!1,u=-1;if(a){let e=ut;for(let i=0;i<4;++i){const s=st.edgeResolutions[i];if(t===e||t===e+s-1){h=!0;break}if(e+=s,t<e){u=i;break}}}const c=a?st.edgePeerNeighbors[u]:null,g=a&&c&&R(this,c)>0;nt.getVec(t,d),s(rt,d,ot);const v=n(rt)-p;let M=0,b=!1;const j=f-v,y=v-m,B=j>x,S=y>x,V=B||S,H=()=>{const e=r?"internal":a&&!h?"edge":h?"corner":"pole";return`Tile[${this.lij}].vertex[${t}]:${e}`+(B?"(below)":S?"(above)":"")+(g?"(Neighbor)":"")},T=l(rt,o);if(T>=i+$){const t=T-i;V||(console.error(`${H()} is out of the bounding sphere by ${t.toFixed(0)} / ${i.toFixed(0)}[tol=${$}] h=${v.toFixed(0)} / [${f.toFixed(0)}..${m.toFixed(0)}] (${(t/i).toFixed(0)})`),b=!0)}for(let e=0;e<6;++e)if(!D(e,rt[0],rt[1],rt[2])){const s=A(e,rt[0],rt[1],rt[2]),o=t%at,n=(t-o)/at;0===e&&j||5===e&&y||(console.error(`${H()} (${o},${n})|${at}] is out of the bounding trapezoid plane ${e} h=${Math.round(v)} / [${Math.round(f)}..${Math.round(m)}] dist=${Math.round(s)} radii = ${Math.round(i)}/${Math.round(_)}} : maxL = ${tt}`),++M)}if(b||M>0)break}}get convexHull(){return this._convexHull}}const C=[128,64,64,32,16,8,8,4];function I(t,e,i){return F(t[0],t[1],t[2],e[i],e[i+1],e[i+2])}function F(t,e,i,s,o,n){const r=s-t,a=o-e,l=n-i;return r*r+a*a+l*l}const L=(t,e,i,s)=>{const o=Math.cos(e),n=Math.sin(e),r=Math.cos(i),a=Math.sin(i);t[0]=s*r*o,t[1]=s*r*n,t[2]=s*a},P=[0,0,1],k=u(),A=u(),D=u();export{T as SphericalPatch};