@arcgis/core 5.2.0-next.67 → 5.2.0-next.69

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 (443) hide show
  1. package/arcgisGlobal.d.ts +2 -0
  2. package/assets/components/assets/combobox/t9n/messages.ar.json +1 -1
  3. package/assets/components/assets/combobox/t9n/messages.bg.json +1 -1
  4. package/assets/components/assets/combobox/t9n/messages.bs.json +1 -1
  5. package/assets/components/assets/combobox/t9n/messages.ca.json +1 -1
  6. package/assets/components/assets/combobox/t9n/messages.cs.json +1 -1
  7. package/assets/components/assets/combobox/t9n/messages.da.json +1 -1
  8. package/assets/components/assets/combobox/t9n/messages.de.json +1 -1
  9. package/assets/components/assets/combobox/t9n/messages.el.json +1 -1
  10. package/assets/components/assets/combobox/t9n/messages.en.json +1 -1
  11. package/assets/components/assets/combobox/t9n/messages.es.json +1 -1
  12. package/assets/components/assets/combobox/t9n/messages.et.json +1 -1
  13. package/assets/components/assets/combobox/t9n/messages.fi.json +1 -1
  14. package/assets/components/assets/combobox/t9n/messages.fr.json +1 -1
  15. package/assets/components/assets/combobox/t9n/messages.he.json +1 -1
  16. package/assets/components/assets/combobox/t9n/messages.hr.json +1 -1
  17. package/assets/components/assets/combobox/t9n/messages.hu.json +1 -1
  18. package/assets/components/assets/combobox/t9n/messages.id.json +1 -1
  19. package/assets/components/assets/combobox/t9n/messages.it.json +1 -1
  20. package/assets/components/assets/combobox/t9n/messages.ja.json +1 -1
  21. package/assets/components/assets/combobox/t9n/messages.json +1 -1
  22. package/assets/components/assets/combobox/t9n/messages.ko.json +1 -1
  23. package/assets/components/assets/combobox/t9n/messages.lt.json +1 -1
  24. package/assets/components/assets/combobox/t9n/messages.lv.json +1 -1
  25. package/assets/components/assets/combobox/t9n/messages.nl.json +1 -1
  26. package/assets/components/assets/combobox/t9n/messages.no.json +1 -1
  27. package/assets/components/assets/combobox/t9n/messages.pl.json +1 -1
  28. package/assets/components/assets/combobox/t9n/messages.pt-BR.json +1 -1
  29. package/assets/components/assets/combobox/t9n/messages.pt-PT.json +1 -1
  30. package/assets/components/assets/combobox/t9n/messages.ro.json +1 -1
  31. package/assets/components/assets/combobox/t9n/messages.ru.json +1 -1
  32. package/assets/components/assets/combobox/t9n/messages.sk.json +1 -1
  33. package/assets/components/assets/combobox/t9n/messages.sl.json +1 -1
  34. package/assets/components/assets/combobox/t9n/messages.sr.json +1 -1
  35. package/assets/components/assets/combobox/t9n/messages.sv.json +1 -1
  36. package/assets/components/assets/combobox/t9n/messages.th.json +1 -1
  37. package/assets/components/assets/combobox/t9n/messages.tr.json +1 -1
  38. package/assets/components/assets/combobox/t9n/messages.uk.json +1 -1
  39. package/assets/components/assets/combobox/t9n/messages.vi.json +1 -1
  40. package/assets/components/assets/combobox/t9n/messages.zh-CN.json +1 -1
  41. package/assets/components/assets/combobox/t9n/messages.zh-HK.json +1 -1
  42. package/assets/components/assets/combobox/t9n/messages.zh-TW.json +1 -1
  43. package/assets/components/assets/icon/arcgisEnterprise16.json +1 -0
  44. package/assets/components/assets/icon/arcgisEnterprise24.json +1 -0
  45. package/assets/components/assets/icon/arcgisEnterprise32.json +1 -0
  46. package/assets/components/assets/icon/buildingIndex16.json +1 -0
  47. package/assets/components/assets/icon/buildingIndex24.json +1 -0
  48. package/assets/components/assets/icon/buildingIndex32.json +1 -0
  49. package/assets/components/assets/icon/fireIndex16.json +1 -0
  50. package/assets/components/assets/icon/fireIndex24.json +1 -0
  51. package/assets/components/assets/icon/fireIndex32.json +1 -0
  52. package/assets/components/assets/icon/geologyIndex16.json +1 -0
  53. package/assets/components/assets/icon/geologyIndex24.json +1 -0
  54. package/assets/components/assets/icon/geologyIndex32.json +1 -0
  55. package/assets/components/assets/icon/orientedImageryFullSuperimpose16.json +1 -0
  56. package/assets/components/assets/icon/orientedImageryFullSuperimpose24.json +1 -0
  57. package/assets/components/assets/icon/orientedImageryFullSuperimpose32.json +1 -0
  58. package/assets/components/assets/icon/orientedImageryHalfSuperimpose16.json +1 -0
  59. package/assets/components/assets/icon/orientedImageryHalfSuperimpose24.json +1 -0
  60. package/assets/components/assets/icon/orientedImageryHalfSuperimpose32.json +1 -0
  61. package/assets/components/assets/icon/orientedImagerySceneOnly16.json +1 -0
  62. package/assets/components/assets/icon/orientedImagerySceneOnly24.json +1 -0
  63. package/assets/components/assets/icon/orientedImagerySceneOnly32.json +1 -0
  64. package/assets/components/assets/icon/parquetFeatureLayer16.json +1 -0
  65. package/assets/components/assets/icon/parquetFeatureLayer24.json +1 -0
  66. package/assets/components/assets/icon/parquetFeatureLayer32.json +1 -0
  67. package/assets/components/assets/icon/publish32.json +1 -1
  68. package/assets/components/assets/icon/radarChart16.json +1 -0
  69. package/assets/components/assets/icon/radarChart24.json +1 -0
  70. package/assets/components/assets/icon/radarChart32.json +1 -0
  71. package/assets/components/assets/icon/returnToDefault16.json +1 -1
  72. package/assets/components/assets/icon/returnToDefault32.json +1 -1
  73. package/assets/components/assets/icon/smartSearch16.json +1 -0
  74. package/assets/components/assets/icon/smartSearch24.json +1 -0
  75. package/assets/components/assets/icon/smartSearch32.json +1 -0
  76. package/assets/components/assets/icon/snowIndex16.json +1 -0
  77. package/assets/components/assets/icon/snowIndex24.json +1 -0
  78. package/assets/components/assets/icon/snowIndex32.json +1 -0
  79. package/assets/components/assets/icon/soilAdjustedVegetationIndex16.json +1 -0
  80. package/assets/components/assets/icon/soilAdjustedVegetationIndex24.json +1 -0
  81. package/assets/components/assets/icon/soilAdjustedVegetationIndex32.json +1 -0
  82. package/assets/components/assets/icon/treeMap16.json +1 -0
  83. package/assets/components/assets/icon/treeMap24.json +1 -0
  84. package/assets/components/assets/icon/treeMap32.json +1 -0
  85. package/assets/components/assets/icon/userSave16.json +1 -0
  86. package/assets/components/assets/icon/userSave24.json +1 -0
  87. package/assets/components/assets/icon/userSave32.json +1 -0
  88. package/assets/components/assets/icon/vegetationIndex16.json +1 -0
  89. package/assets/components/assets/icon/vegetationIndex24.json +1 -0
  90. package/assets/components/assets/icon/vegetationIndex32.json +1 -0
  91. package/assets/components/assets/icon/weatherRadar16.json +1 -0
  92. package/assets/components/assets/icon/weatherRadar24.json +1 -0
  93. package/assets/components/assets/icon/weatherRadar32.json +1 -0
  94. package/assets/components/assets/input/t9n/messages.ar.json +1 -1
  95. package/assets/components/assets/input/t9n/messages.bg.json +1 -1
  96. package/assets/components/assets/input/t9n/messages.bs.json +1 -1
  97. package/assets/components/assets/input/t9n/messages.ca.json +1 -1
  98. package/assets/components/assets/input/t9n/messages.cs.json +1 -1
  99. package/assets/components/assets/input/t9n/messages.da.json +1 -1
  100. package/assets/components/assets/input/t9n/messages.de.json +1 -1
  101. package/assets/components/assets/input/t9n/messages.el.json +1 -1
  102. package/assets/components/assets/input/t9n/messages.en.json +1 -1
  103. package/assets/components/assets/input/t9n/messages.es.json +1 -1
  104. package/assets/components/assets/input/t9n/messages.et.json +1 -1
  105. package/assets/components/assets/input/t9n/messages.fi.json +1 -1
  106. package/assets/components/assets/input/t9n/messages.fr.json +1 -1
  107. package/assets/components/assets/input/t9n/messages.he.json +1 -1
  108. package/assets/components/assets/input/t9n/messages.hr.json +1 -1
  109. package/assets/components/assets/input/t9n/messages.hu.json +1 -1
  110. package/assets/components/assets/input/t9n/messages.id.json +1 -1
  111. package/assets/components/assets/input/t9n/messages.it.json +1 -1
  112. package/assets/components/assets/input/t9n/messages.ja.json +1 -1
  113. package/assets/components/assets/input/t9n/messages.json +1 -1
  114. package/assets/components/assets/input/t9n/messages.ko.json +1 -1
  115. package/assets/components/assets/input/t9n/messages.lt.json +1 -1
  116. package/assets/components/assets/input/t9n/messages.lv.json +1 -1
  117. package/assets/components/assets/input/t9n/messages.nl.json +1 -1
  118. package/assets/components/assets/input/t9n/messages.no.json +1 -1
  119. package/assets/components/assets/input/t9n/messages.pl.json +1 -1
  120. package/assets/components/assets/input/t9n/messages.pt-BR.json +1 -1
  121. package/assets/components/assets/input/t9n/messages.pt-PT.json +1 -1
  122. package/assets/components/assets/input/t9n/messages.ro.json +1 -1
  123. package/assets/components/assets/input/t9n/messages.ru.json +1 -1
  124. package/assets/components/assets/input/t9n/messages.sk.json +1 -1
  125. package/assets/components/assets/input/t9n/messages.sl.json +1 -1
  126. package/assets/components/assets/input/t9n/messages.sr.json +1 -1
  127. package/assets/components/assets/input/t9n/messages.sv.json +1 -1
  128. package/assets/components/assets/input/t9n/messages.th.json +1 -1
  129. package/assets/components/assets/input/t9n/messages.tr.json +1 -1
  130. package/assets/components/assets/input/t9n/messages.uk.json +1 -1
  131. package/assets/components/assets/input/t9n/messages.vi.json +1 -1
  132. package/assets/components/assets/input/t9n/messages.zh-CN.json +1 -1
  133. package/assets/components/assets/input/t9n/messages.zh-HK.json +1 -1
  134. package/assets/components/assets/input/t9n/messages.zh-TW.json +1 -1
  135. package/assets/components/assets/input-date-picker/t9n/messages.ar.json +1 -1
  136. package/assets/components/assets/input-date-picker/t9n/messages.bg.json +1 -1
  137. package/assets/components/assets/input-date-picker/t9n/messages.bs.json +1 -1
  138. package/assets/components/assets/input-date-picker/t9n/messages.ca.json +1 -1
  139. package/assets/components/assets/input-date-picker/t9n/messages.cs.json +1 -1
  140. package/assets/components/assets/input-date-picker/t9n/messages.da.json +1 -1
  141. package/assets/components/assets/input-date-picker/t9n/messages.de.json +1 -1
  142. package/assets/components/assets/input-date-picker/t9n/messages.el.json +1 -1
  143. package/assets/components/assets/input-date-picker/t9n/messages.en.json +1 -1
  144. package/assets/components/assets/input-date-picker/t9n/messages.es.json +1 -1
  145. package/assets/components/assets/input-date-picker/t9n/messages.et.json +1 -1
  146. package/assets/components/assets/input-date-picker/t9n/messages.fi.json +1 -1
  147. package/assets/components/assets/input-date-picker/t9n/messages.fr.json +1 -1
  148. package/assets/components/assets/input-date-picker/t9n/messages.he.json +1 -1
  149. package/assets/components/assets/input-date-picker/t9n/messages.hr.json +1 -1
  150. package/assets/components/assets/input-date-picker/t9n/messages.hu.json +1 -1
  151. package/assets/components/assets/input-date-picker/t9n/messages.id.json +1 -1
  152. package/assets/components/assets/input-date-picker/t9n/messages.it.json +1 -1
  153. package/assets/components/assets/input-date-picker/t9n/messages.ja.json +1 -1
  154. package/assets/components/assets/input-date-picker/t9n/messages.json +1 -1
  155. package/assets/components/assets/input-date-picker/t9n/messages.ko.json +1 -1
  156. package/assets/components/assets/input-date-picker/t9n/messages.lt.json +1 -1
  157. package/assets/components/assets/input-date-picker/t9n/messages.lv.json +1 -1
  158. package/assets/components/assets/input-date-picker/t9n/messages.nl.json +1 -1
  159. package/assets/components/assets/input-date-picker/t9n/messages.no.json +1 -1
  160. package/assets/components/assets/input-date-picker/t9n/messages.pl.json +1 -1
  161. package/assets/components/assets/input-date-picker/t9n/messages.pt-BR.json +1 -1
  162. package/assets/components/assets/input-date-picker/t9n/messages.pt-PT.json +1 -1
  163. package/assets/components/assets/input-date-picker/t9n/messages.ro.json +1 -1
  164. package/assets/components/assets/input-date-picker/t9n/messages.ru.json +1 -1
  165. package/assets/components/assets/input-date-picker/t9n/messages.sk.json +1 -1
  166. package/assets/components/assets/input-date-picker/t9n/messages.sl.json +1 -1
  167. package/assets/components/assets/input-date-picker/t9n/messages.sr.json +1 -1
  168. package/assets/components/assets/input-date-picker/t9n/messages.sv.json +1 -1
  169. package/assets/components/assets/input-date-picker/t9n/messages.th.json +1 -1
  170. package/assets/components/assets/input-date-picker/t9n/messages.tr.json +1 -1
  171. package/assets/components/assets/input-date-picker/t9n/messages.uk.json +1 -1
  172. package/assets/components/assets/input-date-picker/t9n/messages.vi.json +1 -1
  173. package/assets/components/assets/input-date-picker/t9n/messages.zh-CN.json +1 -1
  174. package/assets/components/assets/input-date-picker/t9n/messages.zh-HK.json +1 -1
  175. package/assets/components/assets/input-date-picker/t9n/messages.zh-TW.json +1 -1
  176. package/assets/components/assets/input-number/t9n/messages.ar.json +1 -1
  177. package/assets/components/assets/input-number/t9n/messages.bg.json +1 -1
  178. package/assets/components/assets/input-number/t9n/messages.bs.json +1 -1
  179. package/assets/components/assets/input-number/t9n/messages.ca.json +1 -1
  180. package/assets/components/assets/input-number/t9n/messages.cs.json +1 -1
  181. package/assets/components/assets/input-number/t9n/messages.da.json +1 -1
  182. package/assets/components/assets/input-number/t9n/messages.de.json +1 -1
  183. package/assets/components/assets/input-number/t9n/messages.el.json +1 -1
  184. package/assets/components/assets/input-number/t9n/messages.en.json +1 -1
  185. package/assets/components/assets/input-number/t9n/messages.es.json +1 -1
  186. package/assets/components/assets/input-number/t9n/messages.et.json +1 -1
  187. package/assets/components/assets/input-number/t9n/messages.fi.json +1 -1
  188. package/assets/components/assets/input-number/t9n/messages.fr.json +1 -1
  189. package/assets/components/assets/input-number/t9n/messages.he.json +1 -1
  190. package/assets/components/assets/input-number/t9n/messages.hr.json +1 -1
  191. package/assets/components/assets/input-number/t9n/messages.hu.json +1 -1
  192. package/assets/components/assets/input-number/t9n/messages.id.json +1 -1
  193. package/assets/components/assets/input-number/t9n/messages.it.json +1 -1
  194. package/assets/components/assets/input-number/t9n/messages.ja.json +1 -1
  195. package/assets/components/assets/input-number/t9n/messages.json +1 -1
  196. package/assets/components/assets/input-number/t9n/messages.ko.json +1 -1
  197. package/assets/components/assets/input-number/t9n/messages.lt.json +1 -1
  198. package/assets/components/assets/input-number/t9n/messages.lv.json +1 -1
  199. package/assets/components/assets/input-number/t9n/messages.nl.json +1 -1
  200. package/assets/components/assets/input-number/t9n/messages.no.json +1 -1
  201. package/assets/components/assets/input-number/t9n/messages.pl.json +1 -1
  202. package/assets/components/assets/input-number/t9n/messages.pt-BR.json +1 -1
  203. package/assets/components/assets/input-number/t9n/messages.pt-PT.json +1 -1
  204. package/assets/components/assets/input-number/t9n/messages.ro.json +1 -1
  205. package/assets/components/assets/input-number/t9n/messages.ru.json +1 -1
  206. package/assets/components/assets/input-number/t9n/messages.sk.json +1 -1
  207. package/assets/components/assets/input-number/t9n/messages.sl.json +1 -1
  208. package/assets/components/assets/input-number/t9n/messages.sr.json +1 -1
  209. package/assets/components/assets/input-number/t9n/messages.sv.json +1 -1
  210. package/assets/components/assets/input-number/t9n/messages.th.json +1 -1
  211. package/assets/components/assets/input-number/t9n/messages.tr.json +1 -1
  212. package/assets/components/assets/input-number/t9n/messages.uk.json +1 -1
  213. package/assets/components/assets/input-number/t9n/messages.vi.json +1 -1
  214. package/assets/components/assets/input-number/t9n/messages.zh-CN.json +1 -1
  215. package/assets/components/assets/input-number/t9n/messages.zh-HK.json +1 -1
  216. package/assets/components/assets/input-number/t9n/messages.zh-TW.json +1 -1
  217. package/assets/components/assets/input-text/t9n/messages.ar.json +1 -1
  218. package/assets/components/assets/input-text/t9n/messages.bg.json +1 -1
  219. package/assets/components/assets/input-text/t9n/messages.bs.json +1 -1
  220. package/assets/components/assets/input-text/t9n/messages.ca.json +1 -1
  221. package/assets/components/assets/input-text/t9n/messages.cs.json +1 -1
  222. package/assets/components/assets/input-text/t9n/messages.da.json +1 -1
  223. package/assets/components/assets/input-text/t9n/messages.de.json +1 -1
  224. package/assets/components/assets/input-text/t9n/messages.el.json +1 -1
  225. package/assets/components/assets/input-text/t9n/messages.en.json +1 -1
  226. package/assets/components/assets/input-text/t9n/messages.es.json +1 -1
  227. package/assets/components/assets/input-text/t9n/messages.et.json +1 -1
  228. package/assets/components/assets/input-text/t9n/messages.fi.json +1 -1
  229. package/assets/components/assets/input-text/t9n/messages.fr.json +1 -1
  230. package/assets/components/assets/input-text/t9n/messages.he.json +1 -1
  231. package/assets/components/assets/input-text/t9n/messages.hr.json +1 -1
  232. package/assets/components/assets/input-text/t9n/messages.hu.json +1 -1
  233. package/assets/components/assets/input-text/t9n/messages.id.json +1 -1
  234. package/assets/components/assets/input-text/t9n/messages.it.json +1 -1
  235. package/assets/components/assets/input-text/t9n/messages.ja.json +1 -1
  236. package/assets/components/assets/input-text/t9n/messages.json +1 -1
  237. package/assets/components/assets/input-text/t9n/messages.ko.json +1 -1
  238. package/assets/components/assets/input-text/t9n/messages.lt.json +1 -1
  239. package/assets/components/assets/input-text/t9n/messages.lv.json +1 -1
  240. package/assets/components/assets/input-text/t9n/messages.nl.json +1 -1
  241. package/assets/components/assets/input-text/t9n/messages.no.json +1 -1
  242. package/assets/components/assets/input-text/t9n/messages.pl.json +1 -1
  243. package/assets/components/assets/input-text/t9n/messages.pt-BR.json +1 -1
  244. package/assets/components/assets/input-text/t9n/messages.pt-PT.json +1 -1
  245. package/assets/components/assets/input-text/t9n/messages.ro.json +1 -1
  246. package/assets/components/assets/input-text/t9n/messages.ru.json +1 -1
  247. package/assets/components/assets/input-text/t9n/messages.sk.json +1 -1
  248. package/assets/components/assets/input-text/t9n/messages.sl.json +1 -1
  249. package/assets/components/assets/input-text/t9n/messages.sr.json +1 -1
  250. package/assets/components/assets/input-text/t9n/messages.sv.json +1 -1
  251. package/assets/components/assets/input-text/t9n/messages.th.json +1 -1
  252. package/assets/components/assets/input-text/t9n/messages.tr.json +1 -1
  253. package/assets/components/assets/input-text/t9n/messages.uk.json +1 -1
  254. package/assets/components/assets/input-text/t9n/messages.vi.json +1 -1
  255. package/assets/components/assets/input-text/t9n/messages.zh-CN.json +1 -1
  256. package/assets/components/assets/input-text/t9n/messages.zh-HK.json +1 -1
  257. package/assets/components/assets/input-text/t9n/messages.zh-TW.json +1 -1
  258. package/assets/components/assets/input-time-picker/t9n/messages.ar.json +1 -1
  259. package/assets/components/assets/input-time-picker/t9n/messages.bg.json +1 -1
  260. package/assets/components/assets/input-time-picker/t9n/messages.bs.json +1 -1
  261. package/assets/components/assets/input-time-picker/t9n/messages.ca.json +1 -1
  262. package/assets/components/assets/input-time-picker/t9n/messages.cs.json +1 -1
  263. package/assets/components/assets/input-time-picker/t9n/messages.da.json +1 -1
  264. package/assets/components/assets/input-time-picker/t9n/messages.de.json +1 -1
  265. package/assets/components/assets/input-time-picker/t9n/messages.el.json +1 -1
  266. package/assets/components/assets/input-time-picker/t9n/messages.en.json +1 -1
  267. package/assets/components/assets/input-time-picker/t9n/messages.es.json +1 -1
  268. package/assets/components/assets/input-time-picker/t9n/messages.et.json +1 -1
  269. package/assets/components/assets/input-time-picker/t9n/messages.fi.json +1 -1
  270. package/assets/components/assets/input-time-picker/t9n/messages.fr.json +1 -1
  271. package/assets/components/assets/input-time-picker/t9n/messages.he.json +1 -1
  272. package/assets/components/assets/input-time-picker/t9n/messages.hr.json +1 -1
  273. package/assets/components/assets/input-time-picker/t9n/messages.hu.json +1 -1
  274. package/assets/components/assets/input-time-picker/t9n/messages.id.json +1 -1
  275. package/assets/components/assets/input-time-picker/t9n/messages.it.json +1 -1
  276. package/assets/components/assets/input-time-picker/t9n/messages.ja.json +1 -1
  277. package/assets/components/assets/input-time-picker/t9n/messages.json +1 -1
  278. package/assets/components/assets/input-time-picker/t9n/messages.ko.json +1 -1
  279. package/assets/components/assets/input-time-picker/t9n/messages.lt.json +1 -1
  280. package/assets/components/assets/input-time-picker/t9n/messages.lv.json +1 -1
  281. package/assets/components/assets/input-time-picker/t9n/messages.nl.json +1 -1
  282. package/assets/components/assets/input-time-picker/t9n/messages.no.json +1 -1
  283. package/assets/components/assets/input-time-picker/t9n/messages.pl.json +1 -1
  284. package/assets/components/assets/input-time-picker/t9n/messages.pt-BR.json +1 -1
  285. package/assets/components/assets/input-time-picker/t9n/messages.pt-PT.json +1 -1
  286. package/assets/components/assets/input-time-picker/t9n/messages.ro.json +1 -1
  287. package/assets/components/assets/input-time-picker/t9n/messages.ru.json +1 -1
  288. package/assets/components/assets/input-time-picker/t9n/messages.sk.json +1 -1
  289. package/assets/components/assets/input-time-picker/t9n/messages.sl.json +1 -1
  290. package/assets/components/assets/input-time-picker/t9n/messages.sr.json +1 -1
  291. package/assets/components/assets/input-time-picker/t9n/messages.sv.json +1 -1
  292. package/assets/components/assets/input-time-picker/t9n/messages.th.json +1 -1
  293. package/assets/components/assets/input-time-picker/t9n/messages.tr.json +1 -1
  294. package/assets/components/assets/input-time-picker/t9n/messages.uk.json +1 -1
  295. package/assets/components/assets/input-time-picker/t9n/messages.vi.json +1 -1
  296. package/assets/components/assets/input-time-picker/t9n/messages.zh-CN.json +1 -1
  297. package/assets/components/assets/input-time-picker/t9n/messages.zh-HK.json +1 -1
  298. package/assets/components/assets/input-time-picker/t9n/messages.zh-TW.json +1 -1
  299. package/assets/esri/core/workers/RemoteClient.js +1 -1
  300. package/assets/esri/core/workers/chunks/{6f39545710d1b35d922c.js → 181f330314c1989f642f.js} +1 -1
  301. package/assets/esri/core/workers/chunks/{d4058352db1e8255b52e.js → 1d38a710cf799cb0e5b3.js} +1 -1
  302. package/assets/esri/core/workers/chunks/{59dd83e5aee2908c7eca.js → 3f84ade6285560b692d1.js} +1 -1
  303. package/assets/esri/core/workers/chunks/{25197ecb324d6f08e03e.js → 538bdf02c4dfb5ec72fe.js} +1 -1
  304. package/assets/esri/core/workers/chunks/{f5c9659fc5d571d501c9.js → 59a795eba31061dc357a.js} +1 -1
  305. package/assets/esri/core/workers/chunks/{7d163d9d90393e491ee5.js → 5fb0e8f89b885e5e3742.js} +1 -1
  306. package/assets/esri/core/workers/chunks/{19bf6826e7d9a4d52035.js → 6cc1120554bcb1b4899b.js} +1 -1
  307. package/assets/esri/core/workers/chunks/7dd672c25beb8813cc75.js +2 -0
  308. package/assets/esri/core/workers/chunks/{d7267f429a051943187b.js → 873d8332e2149eb1b36a.js} +1 -1
  309. package/assets/esri/core/workers/chunks/{a97e0b9b057664911c14.js → 8f8db62f126e4a8c1bf7.js} +1 -1
  310. package/assets/esri/core/workers/chunks/b526055794e64b0227ca.js +256 -0
  311. package/assets/esri/core/workers/chunks/be291d920ebc68fde02b.js +2 -0
  312. package/assets/esri/core/workers/chunks/c10a0eebd935472d8fae.js +1 -0
  313. package/assets/esri/core/workers/chunks/c97451f75c23be979476.js +1 -0
  314. package/assets/esri/core/workers/chunks/d198ecb1fe3690d6092f.js +2 -0
  315. package/assets/esri/core/workers/chunks/d2a51c797b2966cb95f3.js +2 -0
  316. package/assets/esri/core/workers/chunks/d303621c902330be5035.js +1 -0
  317. package/assets/esri/core/workers/chunks/{7d4c65311064a5c2e0b1.js → df89bf05c18f0c8e418b.js} +1 -1
  318. package/assets/esri/core/workers/chunks/f4e813ead56d963b16b8.js +1 -0
  319. package/assets/esri/core/workers/chunks/f6f1122bed931f1d960b.js +1 -0
  320. package/assets/esri/core/workers/chunks/f82cd34a79c8aa58d40c.js +2 -0
  321. package/assets/esri/themes/base/widgets/_SelectionToolbar.scss +1 -0
  322. package/assets/esri/themes/dark/main.css +1 -1
  323. package/assets/esri/themes/light/main.css +1 -1
  324. package/assets/esri/themes/light/view.css +1 -1
  325. package/assets/esri/views/3d/environment/resources/milkyway-band.ktx2 +0 -0
  326. package/chunks/DeepSky.glsl.js +66 -0
  327. package/chunks/GaussianSplat.glsl.js +10 -9
  328. package/chunks/GaussianSplatDepth.glsl.js +11 -0
  329. package/chunks/GaussianSplatShadow.glsl.js +7 -16
  330. package/config.js +1 -1
  331. package/interfaces.d.ts +0 -14
  332. package/kernel.js +1 -1
  333. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  334. package/networks/RulesTable.js +1 -1
  335. package/networks/UtilityNetwork.js +1 -1
  336. package/networks/support/utils.js +1 -1
  337. package/package.json +4 -4
  338. package/popup/FeatureContent.d.ts +17 -96
  339. package/popup/FeatureContentCollection.d.ts +71 -188
  340. package/support/revision.js +1 -1
  341. package/symbols/LabelSymbol3D.js +1 -1
  342. package/symbols/LineSymbol3D.js +1 -1
  343. package/symbols/MeshSymbol3D.js +1 -1
  344. package/symbols/PointSymbol3D.js +1 -1
  345. package/symbols/PolygonSymbol3D.js +1 -1
  346. package/third-party-notices.txt +9 -0
  347. package/views/2d/engine/imagery/RasterVFDisplayObject.js +1 -1
  348. package/views/2d/engine/webgl/AFeatureTile.js +1 -1
  349. package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
  350. package/views/2d/layers/support/MediaLayerInteraction.js +1 -1
  351. package/views/2d/layers/support/MediaLayerInteractionOptions.d.ts +46 -0
  352. package/views/2d/layers/support/MediaLayerInteractionOptions.js +1 -1
  353. package/views/2d/layers/support/MediaLayerInteractionReshapeOptions.d.ts +22 -0
  354. package/views/2d/layers/support/MediaLayerInteractionReshapeOptions.js +2 -0
  355. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  356. package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
  357. package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
  358. package/views/3d/analysis/Viewshed/ViewshedSnappingController.js +1 -1
  359. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  360. package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
  361. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  362. package/views/3d/layers/I3SMeshView3D.js +1 -1
  363. package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
  364. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  365. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  366. package/views/3d/layers/i3s/SweptSphereVolume.js +2 -0
  367. package/views/3d/layers/support/MediaLayerInteractionReshapeOptions.d.ts +0 -1
  368. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  369. package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
  370. package/views/3d/support/hitTest.js +1 -1
  371. package/views/3d/terrain/TerrainSurface.js +1 -1
  372. package/views/3d/webgl/RenderCamera.js +1 -1
  373. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  374. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticBVH.js +1 -1
  375. package/views/3d/webgl-engine/collections/Component/ComponentObjectFixedBVH.js +1 -1
  376. package/views/3d/webgl-engine/collections/Component/ElevationAgnosticBVH.js +1 -1
  377. package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
  378. package/views/3d/webgl-engine/effects/stars/DeepSky.glsl.js +2 -0
  379. package/views/3d/webgl-engine/effects/stars/DeepSkyTechnique.js +2 -0
  380. package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
  381. package/views/3d/webgl-engine/effects/stars/starsUtils.js +2 -0
  382. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  383. package/views/3d/webgl-engine/lib/GaussianSplatDepthRenderer.js +2 -0
  384. package/views/3d/webgl-engine/lib/GaussianSplatRenderer.js +1 -1
  385. package/views/3d/webgl-engine/lib/GaussianSplatShadows.js +1 -1
  386. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  387. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  388. package/views/3d/webgl-engine/lib/screenPolygonOverlapUtils.js +1 -1
  389. package/views/3d/webgl-engine/shaders/GaussianSplat.glsl.js +1 -1
  390. package/views/3d/webgl-engine/shaders/GaussianSplatDepth.glsl.js +2 -0
  391. package/views/3d/webgl-engine/shaders/GaussianSplatDepthPolicy.js +2 -0
  392. package/views/3d/webgl-engine/shaders/GaussianSplatDepthTechnique.js +2 -0
  393. package/views/3d/webgl-engine/shaders/GaussianSplatPass.glsl.js +97 -0
  394. package/views/3d/webgl-engine/shaders/GaussianSplatShadow.glsl.js +1 -1
  395. package/views/3d/webgl-engine/shaders/GaussianSplatShadowTechnique.js +1 -1
  396. package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
  397. package/views/3d/webgl.js +1 -1
  398. package/widgets/BasemapLayerList.js +1 -1
  399. package/widgets/Bookmarks.js +1 -1
  400. package/widgets/Daylight.js +1 -1
  401. package/widgets/Editor/AddAssociationWorkflow.js +1 -1
  402. package/widgets/Editor/AddAssociationWorkflowData.js +1 -1
  403. package/widgets/Editor/legacy/AddAssociationWorkflow.js +1 -1
  404. package/widgets/Editor/legacy/AddAssociationWorkflowData.js +1 -1
  405. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/AssociationDetails.js +1 -1
  406. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  407. package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
  408. package/widgets/FeatureTable/Grid/EditorColumn.js +1 -1
  409. package/widgets/LayerList.js +1 -1
  410. package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
  411. package/widgets/OrientedImageryViewer/support/panConstraint.js +1 -1
  412. package/widgets/PanoramicVideoViewer.js +1 -1
  413. package/widgets/PanoramicViewer.js +1 -1
  414. package/widgets/Print.js +1 -1
  415. package/widgets/Search/support/locatorUtils.js +1 -1
  416. package/widgets/ShadowCast.js +1 -1
  417. package/widgets/Sketch.js +1 -1
  418. package/widgets/TableList.js +1 -1
  419. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
  420. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeaturesDrillIn.js +1 -1
  421. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  422. package/widgets/support/SelectionToolbar.js +1 -1
  423. package/widgets/support/SketchTooltipControls.js +1 -1
  424. package/widgets/support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js +1 -1
  425. package/widgets/support/UtilityNetworkAssociations/utils/createAssociation.js +1 -1
  426. package/widgets/support/UtilityNetworkAssociations/utils/isFromElement.js +1 -1
  427. package/assets/esri/core/workers/chunks/15de305ac3d6433748e7.js +0 -1
  428. package/assets/esri/core/workers/chunks/2426601b8cae7f06af4d.js +0 -256
  429. package/assets/esri/core/workers/chunks/242cad472fbc38b24dbc.js +0 -2
  430. package/assets/esri/core/workers/chunks/24c0b3586bb6500eda53.js +0 -2
  431. package/assets/esri/core/workers/chunks/394716bd1ecfd638d708.js +0 -2
  432. package/assets/esri/core/workers/chunks/55af58b6dff52dc040fe.js +0 -2
  433. package/assets/esri/core/workers/chunks/5b18696109fe84a1010a.js +0 -2
  434. package/assets/esri/core/workers/chunks/7f6eee102871769fdf8f.js +0 -1
  435. package/assets/esri/core/workers/chunks/93c0a620a147cbf4a0ba.js +0 -1
  436. package/assets/esri/core/workers/chunks/a27172dacdb85a774c4b.js +0 -1
  437. package/assets/esri/core/workers/chunks/ddafe402f1bc9e8285ef.js +0 -1
  438. package/views/3d/layers/i3s/SphereCone.js +0 -2
  439. /package/assets/esri/core/workers/chunks/{394716bd1ecfd638d708.js.LICENSE.txt → 7dd672c25beb8813cc75.js.LICENSE.txt} +0 -0
  440. /package/assets/esri/core/workers/chunks/{55af58b6dff52dc040fe.js.LICENSE.txt → be291d920ebc68fde02b.js.LICENSE.txt} +0 -0
  441. /package/assets/esri/core/workers/chunks/{24c0b3586bb6500eda53.js.LICENSE.txt → d198ecb1fe3690d6092f.js.LICENSE.txt} +0 -0
  442. /package/assets/esri/core/workers/chunks/{5b18696109fe84a1010a.js.LICENSE.txt → d2a51c797b2966cb95f3.js.LICENSE.txt} +0 -0
  443. /package/assets/esri/core/workers/chunks/{242cad472fbc38b24dbc.js.LICENSE.txt → f82cd34a79c8aa58d40c.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{signal as i}from"../../../../core/signal.js";import{Milliseconds as e}from"../../../../core/time.js";import{getGaussianSplatAlphaCutoffValue as t}from"../../webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js";class a{static{this.fadeInEase=i=>i*(2-i)}static{this.fadeOutEase=i=>i*i}static{this.inverseFadeInEase=i=>1-Math.sqrt(1-i)}static{this.inverseFadeOutEase=i=>Math.sqrt(1-i)}static{this.minimumFadeDuration=e(80)}static{this.resetFadeDurationInterval=e(1e3)}constructor(t){this._view=t,this._numFadingTiles=i(0),this._tmpFullyFadedOutTiles=new Array,this._previousNumFadingTiles=0,this._lastStoppedFading=e(0),this._currentFadeDuration=this.baseFadeDuration}get numFadingTiles(){return this._numFadingTiles.value}updateForFrame(i){if(i!==this._lastUpdatedFrameStart){if(this._lastUpdatedFrameStart=i,0===this.numFadingTiles)this._previousFrameStart=null;else{const t=e(null==this._previousFrameStart?0:i-this._previousFrameStart);this.updateAllTileFading(t),this._previousFrameStart=i}this._view.updateFadingTexture()}}fadeTile(i,e,t){const a=this._getTargetOpacity(e);if(i.fadeDirection=e,!this.fadingEnabled)return void this._instantTileFading(i,a);const s=i.opacityModifier;if(s!==a){const a=this._getFadeProgressFromOpacity(s,e);this._startTileFading(i,a,t)}else this._stopTileFading(i)}updateAllTileFading(i){const e=this._tmpFullyFadedOutTiles;e.length=0,this._view.tileHandles.forEach(t=>{this._updateTileFading(t,i)&&e.push(t)});e.length>0&&(this._view.notifyTileObbsChanged(e),0===this._numFadingTiles.value&&this._view.updateGaussians()),this._numFadingTiles.value>0&&this._view.view.stage?.renderView.requestRender(2)}onFadeDurationChanged(i){0===i&&this.numFadingTiles>0&&this._instantlyFullyFadeAllTiles()}isTileFadingOut(i){return null!=i.fadeProgress&&1===i.fadeDirection}onTileDiscarded(i){null!=i.fadeProgress&&(this._numFadingTiles.value--,0===this._numFadingTiles.value&&(this._lastStoppedFading=e(performance.now())))}updateFadeDuration(){if(this.numFadingTiles&&this.numFadingTiles>=this._previousNumFadingTiles){const i=.95*this._currentFadeDuration;this._currentFadeDuration=e(Math.max(i,a.minimumFadeDuration))}else 0===this.numFadingTiles&&performance.now()-this._lastStoppedFading>a.resetFadeDurationInterval&&(this._currentFadeDuration=this.baseFadeDuration);return this._previousNumFadingTiles=this.numFadingTiles,this._currentFadeDuration}get updating(){return this._numFadingTiles.value>0}get baseFadeDuration(){return this._view.view.qualitySettings.fadeDuration}get fadingEnabled(){return 0!==this.baseFadeDuration}_startTileFading(i,e,t){null==i.fadeProgress&&this._numFadingTiles.value++,i.fadeDuration=t,i.fadeProgress=e}_stopTileFading(i){null!=i.fadeProgress&&(1===i.fadeDirection&&this._onTileFullyFadedOut(i),this._numFadingTiles.value--,0===this._numFadingTiles.value&&(this._lastStoppedFading=e(performance.now())),i.fadeDuration=null,i.fadeProgress=null)}_updateTileFading(i,e){const{fadeProgress:t,fadeDirection:s}=i;if(null==t)return!1;const n=this._fadeDirectionToSign(s),r=i.fadeDuration,d=this._getTargetOpacity(s),u=e/Math.abs(r||1),l=Math.min(t+u,1),o=d-n*(1-(0===s?a.fadeInEase:a.fadeOutEase)(l)),h=1===l||this._tileReachedFadeOutCutoff(i,o);if(i.opacityModifier=h?d:o,h){const e=1===s;return this._stopTileFading(i),this._updateOpacityModifier(i),e}return i.fadeProgress=l,this._updateOpacityModifier(i),!1}_updateOpacityModifier(i){for(let e=0;e<i.pageIds.length;e++){const t=i.pageIds[e];this._view.data.fadingTexture.updateBuffer(i.opacityModifier,t)}}_tileReachedFadeOutCutoff(i,e){if(1!==i.fadeDirection)return!1;const a=t(this._view.view.qualitySettings.gaussianSplat.nonIdleMinimumOpacity);return e*i.maxGaussianOpacity<=a}_instantTileFading(i,e){i.fadeDuration=null,i.fadeProgress=null,i.opacityModifier=e,this._updateOpacityModifier(i),1===i.fadeDirection&&this._onTileFullyFadedOut(i)}_instantlyFullyFadeAllTiles(){const i=this._tmpFullyFadedOutTiles;i.length=0,this._view.tileHandles.forEach(e=>{if(null!=e.fadeProgress){const t=1===e.fadeDirection;this._instantTileFading(e,this._getTargetOpacity(e.fadeDirection)),t&&i.push(e)}});i.length>0&&(this._view.updateGaussians(),this._view.notifyTileObbsChanged(i)),this._numFadingTiles.value=0}_onTileFullyFadedOut(i){i.lifecycleState=0,this._view.moveTileToCache(i)}_fadeDirectionToSign(i){return 0===i?1:-1}_getTargetOpacity(i){return 0===i?1:0}_getFadeProgressFromOpacity(i,e){const t=Math.max(0,Math.min(i,1));return 0===e?a.inverseFadeInEase(t):a.inverseFadeOutEase(t)}}export{a as GaussianSplatFadeHelper};
2
+ import{signal as i}from"../../../../core/signal.js";import{Milliseconds as e}from"../../../../core/time.js";import{getGaussianSplatAlphaCutoffValue as t}from"../../webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js";class a{static{this.fadeInEase=i=>i*(2-i)}static{this.fadeOutEase=i=>i*i}static{this.inverseFadeInEase=i=>1-Math.sqrt(1-i)}static{this.inverseFadeOutEase=i=>Math.sqrt(1-i)}static{this.minimumFadeDuration=e(80)}static{this.resetFadeDurationInterval=e(1e3)}constructor(t){this._view=t,this._numFadingTiles=i(0),this._tmpFullyFadedOutTiles=new Array,this._visibilityUpdatePending=!1,this._previousNumFadingTiles=0,this._lastStoppedFading=e(0),this._currentFadeDuration=this.baseFadeDuration}get numFadingTiles(){return this._numFadingTiles.value}updateForFrame(i){if(i!==this._lastUpdatedFrameStart){if(this._lastUpdatedFrameStart=i,0===this.numFadingTiles)this._previousFrameStart=null;else{const t=e(null==this._previousFrameStart?0:i-this._previousFrameStart);this.updateAllTileFading(t),this._previousFrameStart=i}this._view.updateFadingTexture()}}fadeTile(i,e,t){const a=this._getTargetOpacity(e);if(i.fadeDirection=e,!this.fadingEnabled)return void this._instantTileFading(i,a);const s=i.opacityModifier;if(s!==a){const a=this._getFadeProgressFromOpacity(s,e);this._startTileFading(i,a,t)}else this._stopTileFading(i)}updateAllTileFading(i){const e=this._tmpFullyFadedOutTiles;e.length=0,this._view.tileHandles.forEach(t=>{this._updateTileFading(t,i)&&e.push(t)});e.length>0&&(this._view.notifyTileObbsChanged(e),this._visibilityUpdatePending=!0),0===this._numFadingTiles.value&&this._visibilityUpdatePending&&(this._visibilityUpdatePending=!1,this._view.updateGaussians()),this._numFadingTiles.value>0&&this._view.view.stage?.renderView.requestRender(2)}onFadeDurationChanged(i){0===i&&this.numFadingTiles>0&&this._instantlyFullyFadeAllTiles()}isTileFadingOut(i){return null!=i.fadeProgress&&1===i.fadeDirection}onTileDiscarded(i){null!=i.fadeProgress&&(this._numFadingTiles.value--,0===this._numFadingTiles.value&&(this._lastStoppedFading=e(performance.now())))}updateFadeDuration(){if(this.numFadingTiles&&this.numFadingTiles>=this._previousNumFadingTiles){const i=.95*this._currentFadeDuration;this._currentFadeDuration=e(Math.max(i,a.minimumFadeDuration))}else 0===this.numFadingTiles&&performance.now()-this._lastStoppedFading>a.resetFadeDurationInterval&&(this._currentFadeDuration=this.baseFadeDuration);return this._previousNumFadingTiles=this.numFadingTiles,this._currentFadeDuration}get updating(){return this._numFadingTiles.value>0}get baseFadeDuration(){return this._view.view.qualitySettings.fadeDuration}get fadingEnabled(){return 0!==this.baseFadeDuration}_startTileFading(i,e,t){null==i.fadeProgress&&this._numFadingTiles.value++,i.fadeDuration=t,i.fadeProgress=e}_stopTileFading(i){null!=i.fadeProgress&&(1===i.fadeDirection&&this._onTileFullyFadedOut(i),this._numFadingTiles.value--,0===this._numFadingTiles.value&&(this._lastStoppedFading=e(performance.now())),i.fadeDuration=null,i.fadeProgress=null)}_updateTileFading(i,e){const{fadeProgress:t,fadeDirection:s}=i;if(null==t)return!1;const n=this._fadeDirectionToSign(s),d=i.fadeDuration,r=this._getTargetOpacity(s),l=e/Math.abs(d||1),u=Math.min(t+l,1),o=r-n*(1-(0===s?a.fadeInEase:a.fadeOutEase)(u)),h=1===u||this._tileReachedFadeOutCutoff(i,o);if(i.opacityModifier=h?r:o,h){const e=1===s;return this._stopTileFading(i),this._updateOpacityModifier(i),e}return i.fadeProgress=u,this._updateOpacityModifier(i),!1}_updateOpacityModifier(i){for(let e=0;e<i.pageIds.length;e++){const t=i.pageIds[e];this._view.data.fadingTexture.updateBuffer(i.opacityModifier,t)}}_tileReachedFadeOutCutoff(i,e){if(1!==i.fadeDirection)return!1;const a=t(this._view.view.qualitySettings.gaussianSplat.nonIdleMinimumOpacity);return e*i.maxGaussianOpacity<=a}_instantTileFading(i,e){i.fadeDuration=null,i.fadeProgress=null,i.opacityModifier=e,this._updateOpacityModifier(i),1===i.fadeDirection&&this._onTileFullyFadedOut(i)}_instantlyFullyFadeAllTiles(){const i=this._tmpFullyFadedOutTiles;i.length=0,this._view.tileHandles.forEach(e=>{if(null!=e.fadeProgress){const t=1===e.fadeDirection;this._instantTileFading(e,this._getTargetOpacity(e.fadeDirection)),t&&i.push(e)}});const e=i.length>0;e&&(this._visibilityUpdatePending=!0),this._numFadingTiles.value=0,this._visibilityUpdatePending&&(this._visibilityUpdatePending=!1,this._view.updateGaussians()),e&&this._view.notifyTileObbsChanged(i)}_onTileFullyFadedOut(i){i.lifecycleState=0,this._view.moveTileToCache(i)}_fadeDirectionToSign(i){return 0===i?1:-1}_getTargetOpacity(i){return 0===i?1:0}_getFadeProgressFromOpacity(i,e){const t=Math.max(0,Math.min(i,1));return 0===e?a.inverseFadeInEase(t):a.inverseFadeOutEase(t)}}export{a as GaussianSplatFadeHelper};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../Graphic.js";import{isIterable as n}from"../../../core/iteratorUtils.js";import{screenPointObjectToArray as t,isScreenPolygon as i,isScreenRect as r,createScreenPointArray as s,createScreenPoint as o}from"../../../core/screenUtils.js";import{create as l}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import a from"../../../geometry/Point.js";import c from"../../../geometry/SpatialReference.js";import{projectVectorToVector as u}from"../../../geometry/projection/projectVectorToVector.js";import{Sphere as d,sphereCSO as p}from"../../../geometry/support/sphere.js";import{fallbackObjectIDAttribute as f}from"../../../layers/LayerConstants.js";import{isIntegratedMeshLayer as m}from"../../../layers/support/layerUtils.js";import{debugFlags as g}from"./debugFlags.js";import{getElevationAtPoint as y}from"./ElevationProvider.js";import{getGraphicHitDedupeKey as h,resolveOrderedIntersectionHits as w}from"./intersectionHitUtils.js";import{Intersector as b}from"../webgl-engine/lib/Intersector.js";import{isValidIntersectorResultRay as S}from"../webgl-engine/lib/IntersectorResult.js";import{toHit as x,toOwner as E}from"../webgl-engine/lib/intersectorUtilsConversions.js";import{terrainId as U}from"../webgl-engine/lib/verticalOffsetUtils.js";async function j(e,n,t,o){const l=t?C(e,t):o;if(i(n))return I(e,n,l,t?.excludeLabels);if(r(n))return I(e,T(n),l,t?.excludeLabels);const a=n,c=s(a.x,a.y);l.requiresGroundFeedback=!0,l.enableDraped=!0;const u=new b(e.state.viewingMode);u.options.selectionMode=!0,u.options.store=2,u.options.excludeLabels=t?.excludeLabels??!1,e.sceneIntersectionHelper.intersectIntersectorScreen(c,u,l);const d=await P(e,u.results.all,l.graphics,{getDistance:e=>e.distanceInRenderSpace,getMapPoint:n=>L(e,n),stopAtSupportSurface:!0}),p=u.results.ground,f=E(p,e),y=null!=f&&"type"in f&&m(f)?f:null,h={screenPoint:a,results:d,ground:{mapPoint:L(e,p),distance:S(p)?p.distanceInRenderSpace:0,layer:y}};return g.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(h.intersector=u),h}async function I(e,n,i,r){i.enableDraped=!0;const s=new b(e.state.viewingMode);s.options.selectionMode=!0,s.options.store=2,s.options.excludeLabels=r??!1,await e.sceneIntersectionHelper.intersectIntersectorScreenPolygon(n.map(e=>t(e)),s,i);const o={screenPoint:null,results:await P(e,R(e,s.polygonResults.all),i.graphics,{getDistance:e=>e.distance,getMapPoint:()=>null}),ground:{mapPoint:null,distance:0,layer:null}};return g.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(o.intersector=s),o}function*R(e,n){const t=V(e);if(null!=t)for(const i of n)null!=i.distance&&i.distance<=t&&(yield i);else yield*n}function V(e){const n=e.basemapTerrain,t=e.state.camera;if(1!==e.state.viewingMode||!t.aboveGround||!n?.opaque)return null;z.radius=n.getLowerBoundRadius();return p.distanceToSilhouette(z,t.eye)*F}function T(e){return[o(e.x,e.y),o(e.x+e.width,e.y),o(e.x+e.width,e.y+e.height),o(e.x,e.y+e.height)]}function M(e,n,i,r){const s=i?C(e,i):r,o=!(!s.graphics?.include&&!s.graphics?.exclude),l=!(!s.mediaElements?.include&&!s.mediaElements?.exclude),a=t(n);s.enableDraped=s.include&&!s.include.has(U)||s.exclude?.has(U);const c=e.sceneIntersectionHelper,u=new b(e.state.viewingMode);if(u.options.selectionMode=!0,u.options.store=o||l?2:0,u.options.excludeLabels=i?.excludeLabels??!1,c.intersectIntersectorScreen(a,u,s),o||l){for(const n of u.results.all){const t=x(n,e);if(null==t)return L(e,n);if(o&&("graphic"!==t.type||D(s.graphics,t.graphic)))return L(e,n);if(l&&("media"!==t.type||G(s.mediaElements,t.element)))return L(e,n)}return null}return L(e,u.results.min)}async function P(e,n,t,i){const r=w(e,i.stopAtSupportSurface?function*(){for(const t of n){yield t;const n=E(t,e);if(null!=n&&(n===e.map.ground||"type"in n&&m(n)))break}}():n,{getDedupeKey:e=>"graphic"===e.type?v(e.graphic):null,filterHit:e=>"graphic"!==e.type||D(t,e.graphic)}),s=new Array;for await(const{input:o,hit:l}of r){const e=i.getMapPoint(o),n=i.getDistance(o);if("media"===l.type){const t=e?l.element.toSource(e):null;s.push({...l,mapPoint:e,distance:n,sourcePoint:t})}else s.push({...l,mapPoint:e,distance:n})}return s}function L(e,n,t){return n.getIntersectionPoint(q)?(t=H(e,q,t),7===n.intersector&&e.basemapTerrain&&(t.z=y(e.basemapTerrain,t)??0),t):null}function v(e){const n=e.getObjectId()??e.attributes?.[f];return e.origin&&null!=n?`o-${e.origin.id}-${n}`:`u-${h(e)}`}function D(e,n){return G(e,v(n))}function G(e,n){return null==e||(null==e.include||e.include.has(n))&&(null==e.exclude||!e.exclude.has(n))}function H(e,n,t){let i=e.spatialReference||c.WGS84;return u(n,e.renderSpatialReference,q,i)?n=q:(i=c.WGS84,u(n,e.renderSpatialReference,q,i)&&(n=q)),t?(t.x=n[0],t.y=n[1],t.z=n[2],t.spatialReference=i):t=new a(n,i),t}function C(e,n){const t=N(e,n.include,0),i=N(e,n.exclude,1);return{include:t.layerViewUids,exclude:i.layerViewUids,graphics:{include:t.graphicUids,exclude:i.graphicUids},mediaElements:{include:t.mediaElements,exclude:i.mediaElements}}}function N(t,i,r,s=new _){if(!i)return s;if(i instanceof e)$(s,v(i)),0===r&&(null!=t.graphicsView&&i.layer===t?W(s,t.graphicsView.uid):i.layer&&O(s,t,i.layer.uid));else if("layer"in i&&"element"in i)k(s,i.element),0===r&&O(s,t,i.layer.uid);else if(n(i))for(const e of i)e===t.graphics&&null!=t.graphicsView?W(s,t.graphicsView.uid):e===t.map.ground?(W(s,U),t.map.ground.integratedMeshGround&&O(s,t,t.map.ground.integratedMeshGround.uid)):N(t,e,r,s);else"layer"in i&&A(s,t,i),"uid"in i&&O(s,t,i.uid);return s}class _{constructor(){this.layerViewUids=null,this.graphicUids=null,this.mediaElements=null}}function O(e,n,t){const i=n.allLayerViews.find(e=>e.layer.uid===t);i&&W(e,i.uid)}function W(e,n){e.layerViewUids??=new Map,e.layerViewUids.set(n,!0)}function A(e,n,t){const i=n.allLayerViews.find(e=>e.layer.uid===t.layer.uid);if(!i)return;e.layerViewUids??=new Map;const r=e.layerViewUids.get(i.uid);!0!==r&&(r?r.add(t.id):e.layerViewUids.set(i.uid,new Set([t.id])))}function $(e,n){e.graphicUids??=new Set,e.graphicUids.add(n)}function k(e,n){e.mediaElements??=new Set,e.mediaElements.add(n)}const q=l(),z=new d,F=1.2;export{H as computeMapPointFromVec3d,C as externalToInternalIntersectOptions,j as hitTest,L as intersectResultToMapPoint,D as testGraphicUidFilter,M as toMap};
2
+ import e from"../../../Graphic.js";import{isIterable as n}from"../../../core/iteratorUtils.js";import{screenPointObjectToArray as t,isScreenPolygon as i,isScreenRect as r,createScreenPointArray as s,createScreenPoint as o}from"../../../core/screenUtils.js";import{create as l}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import c from"../../../geometry/Point.js";import a from"../../../geometry/SpatialReference.js";import{projectVectorToVector as u}from"../../../geometry/projection/projectVectorToVector.js";import{Sphere as d,sphereCSO as p}from"../../../geometry/support/sphere.js";import{fallbackObjectIDAttribute as f}from"../../../layers/LayerConstants.js";import{isIntegratedMeshLayer as m}from"../../../layers/support/layerUtils.js";import{debugFlags as g}from"./debugFlags.js";import{getElevationAtPoint as y}from"./ElevationProvider.js";import{getGraphicHitDedupeKey as h,resolveOrderedIntersectionHits as w}from"./intersectionHitUtils.js";import{Intersector as b}from"../webgl-engine/lib/Intersector.js";import{isValidIntersectorResultRay as S}from"../webgl-engine/lib/IntersectorResult.js";import{toHit as x,toOwner as E}from"../webgl-engine/lib/intersectorUtilsConversions.js";import{terrainId as U}from"../webgl-engine/lib/verticalOffsetUtils.js";async function j(e,n,t,o){const l=t?C(e,t):o;if(i(n))return I(e,n,l,t?.excludeLabels);if(r(n))return I(e,V(n),l,t?.excludeLabels);const c=n,a=s(c.x,c.y);l.requiresGroundFeedback=!0,l.enableDraped=!0;const u=new b(e.state.viewingMode);u.options.selectionMode=!0,u.options.store=2,u.options.excludeLabels=t?.excludeLabels??!1,e.sceneIntersectionHelper.intersectIntersectorScreen(a,u,l);const d=await Array.fromAsync(M(e,u.results.all,l.graphics,{getDistance:e=>e.distanceInRenderSpace,getMapPoint:n=>L(e,n),stopAtSupportSurface:!0})),p=u.results.ground,f=E(p,e),y=null!=f&&"type"in f&&m(f)?f:null,h={screenPoint:c,results:d,ground:{mapPoint:L(e,p),distance:S(p)?p.distanceInRenderSpace:0,layer:y}};return g.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(h.intersector=u),h}async function I(e,n,i,r){i.enableDraped=!0;const s=new b(e.state.viewingMode);s.options.selectionMode=!0,s.options.store=2,s.options.excludeLabels=r??!1,await e.sceneIntersectionHelper.intersectIntersectorScreenPolygon(n.map(e=>t(e)),s,i);const o=new Array;await e.sceneIntersectionHelper.screenPolygonIntersectionTask.scheduleGenerator(async function*(n){for await(const t of M(e,R(e,s.polygonResults.all),i.graphics,{getDistance:e=>e.distance,getMapPoint:()=>null}))o.push(t),n.done&&(n=yield)});const l={screenPoint:null,results:o,ground:{mapPoint:null,distance:0,layer:null}};return g.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(l.intersector=s),l}function*R(e,n){const t=T(e);if(null!=t)for(const i of n)null!=i.distance&&i.distance<=t&&(yield i);else yield*n}function T(e){const n=e.basemapTerrain,t=e.state.camera;if(1!==e.state.viewingMode||!t.aboveGround||!n?.opaque)return null;z.radius=n.getLowerBoundRadius();return p.distanceToSilhouette(z,t.eye)*F}function V(e){return[o(e.x,e.y),o(e.x+e.width,e.y),o(e.x+e.width,e.y+e.height),o(e.x,e.y+e.height)]}function P(e,n,i,r){const s=i?C(e,i):r,o=!(!s.graphics?.include&&!s.graphics?.exclude),l=!(!s.mediaElements?.include&&!s.mediaElements?.exclude),c=t(n);s.enableDraped=s.include&&!s.include.has(U)||s.exclude?.has(U);const a=e.sceneIntersectionHelper,u=new b(e.state.viewingMode);if(u.options.selectionMode=!0,u.options.store=o||l?2:0,u.options.excludeLabels=i?.excludeLabels??!1,a.intersectIntersectorScreen(c,u,s),o||l){for(const n of u.results.all){const t=x(n,e);if(null==t)return L(e,n);if(o&&("graphic"!==t.type||G(s.graphics,t.graphic)))return L(e,n);if(l&&("media"!==t.type||H(s.mediaElements,t.element)))return L(e,n)}return null}return L(e,u.results.min)}async function*M(e,n,t,i){const r=w(e,i.stopAtSupportSurface?function*(){for(const t of n){yield t;const n=E(t,e);if(null!=n&&(n===e.map.ground||"type"in n&&m(n)))break}}():n,{getDedupeKey:e=>"graphic"===e.type?v(e.graphic):null,filterHit:e=>"graphic"!==e.type||G(t,e.graphic)});for await(const{input:s,hit:o}of r){const e=i.getMapPoint(s),n=i.getDistance(s);if("media"===o.type){const t=e?o.element.toSource(e):null;yield{...o,mapPoint:e,distance:n,sourcePoint:t}}else yield{...o,mapPoint:e,distance:n}}}function L(e,n,t){return n.getIntersectionPoint(q)?(t=D(e,q,t),7===n.intersector&&e.basemapTerrain&&(t.z=y(e.basemapTerrain,t)??0),t):null}function v(e){const n=e.getObjectId()??e.attributes?.[f];return e.origin&&null!=n?`o-${e.origin.id}-${n}`:`u-${h(e)}`}function G(e,n){return H(e,v(n))}function H(e,n){return null==e||(null==e.include||e.include.has(n))&&(null==e.exclude||!e.exclude.has(n))}function D(e,n,t){let i=e.spatialReference||a.WGS84;return u(n,e.renderSpatialReference,q,i)?n=q:(i=a.WGS84,u(n,e.renderSpatialReference,q,i)&&(n=q)),t?(t.x=n[0],t.y=n[1],t.z=n[2],t.spatialReference=i):t=new c(n,i),t}function C(e,n){const t=N(e,n.include,0),i=N(e,n.exclude,1);return{include:t.layerViewUids,exclude:i.layerViewUids,graphics:{include:t.graphicUids,exclude:i.graphicUids},mediaElements:{include:t.mediaElements,exclude:i.mediaElements}}}function N(t,i,r,s=new _){if(!i)return s;if(i instanceof e)k(s,v(i)),0===r&&(null!=t.graphicsView&&i.layer===t?O(s,t.graphicsView.uid):i.layer&&A(s,t,i.layer.uid));else if("layer"in i&&"element"in i)$(s,i.element),0===r&&A(s,t,i.layer.uid);else if(n(i))for(const e of i)e===t.graphics&&null!=t.graphicsView?O(s,t.graphicsView.uid):e===t.map.ground?(O(s,U),t.map.ground.integratedMeshGround&&A(s,t,t.map.ground.integratedMeshGround.uid)):N(t,e,r,s);else"layer"in i&&W(s,t,i),"uid"in i&&A(s,t,i.uid);return s}class _{constructor(){this.layerViewUids=null,this.graphicUids=null,this.mediaElements=null}}function A(e,n,t){const i=n.allLayerViews.find(e=>e.layer.uid===t);i&&O(e,i.uid)}function O(e,n){e.layerViewUids??=new Map,e.layerViewUids.set(n,!0)}function W(e,n,t){const i=n.allLayerViews.find(e=>e.layer.uid===t.layer.uid);if(!i)return;e.layerViewUids??=new Map;const r=e.layerViewUids.get(i.uid);!0!==r&&(r?r.add(t.id):e.layerViewUids.set(i.uid,new Set([t.id])))}function k(e,n){e.graphicUids??=new Set,e.graphicUids.add(n)}function $(e,n){e.mediaElements??=new Set,e.mediaElements.add(n)}const q=l(),z=new d,F=1.2;export{D as computeMapPointFromVec3d,C as externalToInternalIntersectOptions,j as hitTest,L as intersectResultToMapPoint,G as testGraphicUidFilter,P as toMap};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../Color.js";import{filterInPlace as i,difference as r}from"../../../core/arrayUtils.js";import s from"../../../core/CollectionFlattener.js";import{toConst as a}from"../../../core/compilerUtils.js";import{EventedAccessor as n}from"../../../core/Evented.js";import"../../../core/has.js";import l from"../../../core/Logger.js";import{clamp as o}from"../../../core/mathUtils.js";import{destroyMaybe as h}from"../../../core/maybe.js";import{MemCachePool as d}from"../../../core/MemCachePool.js";import p from"../../../core/ObjectPool.js";import u from"../../../core/PooledArray.js";import{throwIfAborted as c,isAbortError as g,isAborted as m}from"../../../core/promiseUtils.js";import{watch as _,syncAndInitial as y,sync as f,initial as T}from"../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as v}from"../../../core/units.js";import{property as w,subclass as S}from"../../../core/accessorSupport/decorators.js";import{exactEquals as C,set as b,copy as E}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as x}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as U}from"../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as L,radiusModifier as P}from"../../../geometry/ellipsoidUtils.js";import R from"../../../geometry/SpatialReference.js";import{getProjector as M}from"../../../geometry/projection/projectors.js";import{projectPointToVector as D}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as j}from"../../../geometry/projection/projectVectorToVector.js";import{create as I,equals as k,intersection as V,intersectsSphere as A}from"../../../geometry/support/aaBoundingRect.js";import{copy as B,create as G}from"../../../geometry/support/frustum.js";import{createSpatialReferenceCyclical as O}from"../../../geometry/support/normalizeUtils.js";import{isPlateCarree as q}from"../../../geometry/support/spatialReferenceUtils.js";import{Sphere as N}from"../../../geometry/support/sphere.js";import{ElevationQueryTileCache as F}from"../../../layers/support/ElevationQueryTileCache.js";import{isBaseLayer as W}from"../../../layers/support/layerUtils.js";import{queueHighPriority as H}from"../../../request/queue.js";import{debugFlags as $}from"../support/debugFlags.js";import{ElevationRange as Q}from"../support/ElevationRange.js";import{ElevationUpdateEvent as z}from"../support/ElevationUpdateEvent.js";import{calculateElevationUpdateExtents as Y}from"../support/elevationUpdateExtentUtils.js";import{toBoundingRect as X}from"../support/extentUtils.js";import{updatingProgress as K}from"../support/updatingProperties.js";import{ElevationBounds as J}from"./ElevationBounds.js";import{ElevationData as Z,sampleElevation as ee}from"./ElevationData.js";import{create as te}from"./ExtentHelper.js";import{LayerClasses as ie}from"./LayerClass.js";import{OverlayManager as re}from"./OverlayManager.js";import{PlanarPatch as se}from"./PlanarPatch.js";import{Queue as ae}from"./Queue.js";import{ScaleRangeQueries as ne}from"./ScaleRangeQueries.js";import{SphericalPatch as le}from"./SphericalPatch.js";import{SplitLimits as oe}from"./SplitLimits.js";import{maxRootTiles as he,tooManyRootTilesAfterChangeError as de,tooManyRootTilesForLayerError as pe,maxTileNeighborLevelDelta as ue,maxMemoryLodBias as ce}from"./TerrainConst.js";import{TerrainRenderer as ge}from"./TerrainRenderer.js";import me from"./TerrainSurfacePerformanceInfo.js";import{weakAssert as _e,isVectorTileLayerView as ye,neighborEdgeIndices as fe,internalAssert as Te,oppositeEdge as ve,isSurfaceLayerView as we,isGroupLayerView as Se,isMapTileLayerView as Ce,isBlendableLayerView as be,isElevationLayerView as Ee,releaseTerrainData as xe,enableTerrainInternalChecks as Ue,oppositeCorner as Le,enableWaterproofTests as Pe,enableInternalTerrainChecks as Re,enableTerrainWaterproofChecks as Me,neighborCornerIndices as De}from"./terrainUtils.js";import{Tile as je,lijEquals as Ie}from"./Tile.js";import{printAllocations as ke}from"./TilePerLayerInfo.js";import{sortTiles as Ve,IteratorPreorder as Ae,IteratorPostorder as Be,compareTilesByLij as Ge,hasLoadableSiblings as Oe,sortTilesByPOI as qe,traverseTilesPreorder as Ne}from"./tileUtils.js";import{TilingSchemeLogic as Fe}from"./TilingSchemeLogic.js";import{UpsampleInfo as We}from"./UpsampleInfo.js";import{isCompositeBlendMode as He,blendModeFromString as $e}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{hasLayerBasedScaleVisibility as Qe}from"../../support/layerViewUtils.js";import{ImmediateTask as ze,TaskPriority as Ye,noBudget as Xe}from"../../support/Scheduler.js";import{TextureCompressionTracker as Ke}from"../../support/TextureCompressionTracker.js";import{Yield as Je}from"../../support/Yield.js";var Ze;let et=class extends n{static{Ze=this}get allTilesCreated(){return this._allTilesCreated}get allTiles(){return a(this._allTiles)}get renderedTiles(){return Ve(i(this._allTiles.toArray(),e=>e.visible&&e.rendered))}get demResolution(){const{_allTiles:e,tilingScheme:t}=this;if(0===e.length)return{min:1,max:1};const i=v(t.spatialReference);let r=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(const a of e){const e=t.resolutionAtLevel(a.level)*i;r=Math.min(r,e),s=Math.max(s,e)}return{min:r,max:s}}constructor(e){super(e),this.terrainTextureCompressionTracker=new Ke,this._iteratorPool=new p(()=>new Ae,e=>e.remove=()=>this._iteratorPool.release(e)),this._postorderIterator=new Be,this._hasPendingUpdates=!1,this._pendingUpdates=0,this._asyncWorkItems=0,this._allTilesDirty=!0,this._allTilesSorted=!0,this._allTilesCreated=!1,this._usedMemory=null,this._performanceInfo=new me,this._viewChanged=!1,this.heading=0,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=x(),this._eyePosSurfaceSR=x(),this._splitLimits=new oe,this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._watchUpdatingTracking=new U,this._frameTask=ze,this._allTiles=new u,this._upsampleInfoPool=new p(()=>new We),this._shouldEmitChangeEvent=!1,this._rootTilesExtent=I(),this.updatingProgress=.5,this._maxNumUpdating=1,this.maxTextureScale=1.2,this._spatialReference=R.WebMercator,this._elevationProjectorCache=new Map,this.visibleElevationRange=new Q(1/0,-1/0),this._rootTileElevationRange=new Q(1/0,-1/0),this._projectorCache=new Map,this._tilingSchemeSpatialReference=null,this._updatingRootTiles=!1,this._pendingTilesForElevationUpdateEvent=new Set,this._pendingTilesToUpdate=new Set,this.totalGeometryUpdates=0,this.totalTileUpdates=0,this._oneBatchPerFrameTask=!0,this._layerViewsDirty=!1,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._isWebMercator=!1,this._isWebMercatorOnPlateCarree=!1,this.enabled=!0;const{view:t}=e;this.overlayManager=new re({...e,terrainSurface:this}),this._isGlobal=!t.state?.isLocal,this._isGeographic=this._spatialReference?.isGeographic??!1,this._tileConstructor=this._isGlobal?le:se,this._ellipsoid=L(t.spatialReference),this._renderer=new ge(this.overlayManager.renderer,t.stage,this._allTiles,this.terrainTextureCompressionTracker,t.resourceController.memoryController),Qe()||(this._scaleRangeQueries=new ne)}initialize(){const{view:e}=this,{resourceController:t}=e,{memoryController:i}=t;this._tileCache=new d((e,t)=>i.newCache(e,t),"terrain-tile"),this._upsampleMapCache=i.newCache("terrain-upsample",({tile:e})=>e.unloadMapData()),this._elevationQueryCache=new F(i.newCache("elevation-query"));const r=this.overlayManager;this.addHandles([_(()=>r.renderer.isEmpty,()=>this._evaluateTransparency()),_(()=>this.renderer.visible,e=>this.suspended=!e),_(()=>this.heading,e=>{this._renderer.updateHeading(e),this._updateTileTextures(0)},y),_(()=>({heading:e.camera?.heading,state:e.state?.mode}),({heading:e,state:t})=>{if(null==e)return;if(this.isGlobal&&this.isGeographic||this.isWebMercatorOnPlateCarree)return void(this.heading=90*Math.round(e/90)%360);const i=Math.round(e)%360,r=Math.abs(i-this.heading);(2===t||Math.min(r,360-r)>=30)&&(this.heading=i)})],"overlayManager"),this.addHandles([_(()=>this.baseOpacity,()=>{this._handleLayerViewChanges(),this._updateTileTextures(this._evaluateTransparency()?1:2)},y),_(()=>this.hasCompositeBlendMode,()=>this._updateTileTextures(this._evaluateTransparency()?1:2),y),_(()=>this.backgroundColor,(e,t)=>{e?.equals(t)||(this._handleLayerViewChanges(),this._renderer.updateTileBackground(e))},f),_(()=>this.snapLevel,()=>this._viewChanged=!0,f),_(()=>this.view.pointsOfInterest,e=>{this._renderer.pointsOfInterest=e,this._watchUpdatingTracking.removeAll(),e&&this._watchUpdatingTracking.add(()=>e.focus?.renderLocation,()=>this._allTilesSorted=!1,{equals:C})}),_(()=>$.TERRAIN_TILE_TREE_SHOW_TILES,t=>{t&&!this._treeDebugger?import("../layers/support/TerrainTileTree3DDebugger.js").then(({TerrainTileTree3DDebugger:t})=>{!this._treeDebugger&&$.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new t({view:e}))}):t||(this._treeDebugger=h(this._treeDebugger))},T)]);const{spatialReference:a}=e;this._extentHelper=te(this.viewingMode,{layers:e.map.allLayers,layerViews:e.allLayerViews,viewSpatialReference:a});const n=new s({getCollections:()=>e.defaultsFromMap?.mapCollections?.map(({layers:e})=>e),getChildrenFunction:e=>e&&"layers"in e?e.layers:null}),l=new Fe({layers:n,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:a});this._set("tilingSchemeLogic",l),this._updateTilingScheme();const o=t.scheduler;this._frameTask=o.registerTask(Ye.TERRAIN_SURFACE,this),this.addHandles([_(()=>this._extentHelper.stencilEnabledExtents,e=>this._renderer.setStencilEnabledLayerExtents(e),T),_(()=>this.tilingSchemeLogic.tilingScheme,()=>this._updateTilingScheme(),f),_(()=>this.groundExtent,()=>this._updateRootTiles(),T),e.on("resize",()=>this._viewChangeUpdate()),_(()=>{const t=e.state;return[this._lodBias,this.lodSnappingEnabled,e.quality,t.camera,t.contentCamera,t.fixedContentCamera]},()=>this._viewChangeUpdate(),y),_(()=>e.qualitySettings?.fadeDuration,e=>this._renderer.textureFadingEnabled=e>0,T),_(()=>e.qualitySettings?.physicallyBasedRenderingEnabled,e=>this._renderer.pbrMode=e?5:0,T),_(()=>e.qualitySettings?.tiledSurface.elevationLevelDelta,()=>this._updateAllTileGeometries()),_(()=>this.userClippingExtent,()=>this._updateClippingExtent(),f)]),this.addHandles(e.allLayerViews.on("after-changes",()=>this._layerViewsDirty=!0)),this._layerViewsDirty=!0,this._handleLayerViewChanges(),this._renderer.updateTileBackground(this.backgroundColor)}clearHandles(){this._watchUpdatingTracking?.removeAll(),this.removeAllHandles(),this._basemapLayerViewHandles.forEach((e,t)=>this._unregisterTiledLayerView(t)),this._basemapLayerViewHandles.clear()}destroy(){this._frameTask.remove(),this._frameTask=ze,this._watchUpdatingTracking?.destroy(),this._removeAllTiles(),this._set("tilingSchemeLogic",h(this.tilingSchemeLogic)),this._basemapLayerViewHandles.forEach((e,t)=>this._unregisterTiledLayerView(t)),this._basemapLayerViewHandles.clear(),this._set("overlayManager",h(this.overlayManager)),this._tileCache=h(this._tileCache),this._allTiles.prune(),je.prune(),this._treeDebugger=h(this._treeDebugger),this._renderer.destroyed||this._renderer.destroy(),this._renderer=null,this._iteratorPool=h(this._iteratorPool),this._upsampleMapCache=h(this._upsampleMapCache),this._elevationQueryCache=h(this._elevationQueryCache),this._set("view",null),this._extentHelper=h(this._extentHelper),this._upsampleInfoPool=h(this._upsampleInfoPool),ke(),this._layerViews.forEach(e=>e.length=0),this._performanceInfo=null}get renderer(){return this._renderer}get frustum(){return this.view.state.camera.frustum}get snapLevel(){return this.lodSnappingEnabled?this.view.terrainLevel:null}get lodSnappingEnabled(){return this.view.qualitySettings.tiledSurface.reduceTileLevelDifferences}get upsampleInfoPool(){return this._upsampleInfoPool}get upsampleMapCache(){return this._upsampleMapCache}get elevationQueryCache(){return this._elevationQueryCache}get hasStencilEnabledExtents(){return this._extentHelper.stencilEnabledExtents.length>0}get userClippingExtent(){const{spatialReference:e}=this,t=this.view?.clippingArea;if(null==t||null==e)return null;const i=I(),r=X(t,i,e)?i:null,s=this._get("userClippingExtent");return k(r,s)?s:r}get rootTilesExtent(){return this._rootTilesExtent}get groundExtent(){const e=V(this.fullGroundExtent,this.userClippingExtent,I()),t=this._get("groundExtent");return k(e,t)?t:e}get fullGroundExtent(){return null!=this._tilingSchemeExtent?this._tilingSchemeExtent:this._rootTilesExtent}get _tilingSchemeExtent(){return this.tilingSchemeLogic?.extent}get updating(){return this._hasPendingUpdates||(this._maxNumUpdating=1),this.enabled&&!!((this.readyToRun||this._watchUpdatingTracking?.updating||this._asyncWorkItems>0)&&this.ready&&!this.suspended||this.overlayManager?.updating||this.terrainTextureCompressionTracker.compressing)}get readyToRun(){return this.enabled&&(this._hasPendingUpdates||this._viewChanged||this._allTilesDirty||!this._allTilesSorted||this._hasElevationSourceUpdates||this._layerViewsDirty||this._scaleRangeQueries?.updating||this._frameTask.updating)&&this.ready&&!this.suspended}get _hasElevationSourceUpdates(){return this._allTiles.some(e=>e.needsElevationSourceUpdate())}get updatingProgressValue(){return this._maxNumUpdating=Math.max(this._pendingUpdates,this._maxNumUpdating),1-this._pendingUpdates/this._maxNumUpdating}get baseOpacity(){return this.view?.map?.ground?.opacity??1}set baseOpacity(e){this.view.map.ground.opacity=e}get viewingMode(){return this.view.state.viewingMode}get ready(){return!this.enabled||null!=this._rootTiles}get rootTiles(){return this._rootTiles}get spatialReference(){return this.tilingScheme?.spatialReference??null}get backgroundColor(){return this.view?.map?.ground?.surfaceColor}set backgroundColor(e){this.view.map.ground.surfaceColor=e}set slicePlaneEnabled(e){this._renderer.slicePlaneEnabled=e,this._set("slicePlaneEnabled",e),this._evaluateTransparency()}get tilingSchemeLocked(){return this.tilingSchemeLogic?.tilingSchemeLocked??!1}get wireframe(){return this._renderer?.wireframe}set wireframe(e){e!==this._renderer.wireframe&&(this._renderer.wireframe=e,this._updateAllTileGeometries())}get opaque(){return 0===this._renderer.transparency}get invisible(){return 3===this._renderer.transparency}set suspended(e){this._set("suspended",e),this._viewChangeUpdate()}get fadeDuration(){return this.view.qualitySettings.fadeDuration??0}intersect(e,t,i,r){this._renderer.intersectRay(e,t,i,r)}getElevationLevelDelta(e){return e<4?3:this.view.qualitySettings.tiledSurface.elevationLevelDelta}get _xNormalizer(){return O(this._spatialReference)}getElevation(e,t,i,r){const s=this._rootTiles;if(!s?.length||!this.enabled)return null;if(0===s[0].layerInfo[0].length)return null;let a=this._elevationProjectorCache.get(r);if(void 0===a&&(a=M(r,this._spatialReference)??null,this._elevationProjectorCache.set(r,a)),null==a)return l.getLogger(this).error("TerrainSurface.getElevation(): could not project given point to tiling scheme coordinate system"),null;const n=b(it,e,t,i);a(n,0,n,0);return lt(s,this._xNormalizer?.normalize(n[0])??n[0],n[1])}getElevations(e,t,i){const r=this._rootTiles,s=r?r[0].layerInfo[0].length:0;if(r?.length&&0!==s&&this.enabled)for(let a=0;a<t;++a){const t=3*a;i(a,lt(r,e[t],e[t+1]))}else for(let a=0;a<t;++a)i(a,null)}getLayerIndexByUID(e,t){return this._layerIndexByUid[e].get(t)}getScale(e){if(!this.tilingScheme)return null;if(!D(e,it,this.spatialReference))return l.getLogger(this).error("TerrainSurface.getScale(): could not project given point to tiling scheme coordinate system"),null;const t=this._rootTiles;if(null!=t)for(const i of t)if(i?.containsPoint(it)){let e=i;for(;e.children[0]&&!e.rendered;){const t=e.children[0].extent;let i=0;it[0]>t[2]&&(i+=1),it[1]<t[1]&&(i+=2),e=e.children[i]}return this._getLodBiasCorrectedScale(e.level)}return 1/0}_ensureProjector(e){const t=this._projectorCache.get(e);if(t)return t;const i=M(e,this._tilingSchemeSpatialReference)??null;return this._projectorCache.set(e,i),i}getSphereElevationRange(e,t){if(!this.enabled||null==this._rootTiles)return null;const i=this._ensureProjector(t);if(null==i)return l.getLogger(this).error("TerrainSurface.getSphereElevationRange(): could not project given point to tiling scheme coordinate system"),null;rt.copyFrom(e),i(rt.center,0,rt.center,0);const r=new Q,s=this._rootTiles;if(null!=s){const e=[];for(const i of s)e.push(i);let t=0;for(;t<e.length;){const i=e[t];if(++t,!A(i.extent,rt))continue;const s=i.children;if(null==s[0]||i.rendered)r.expandElevationRangeValues(i.elevationBoundsMin,i.elevationBoundsMax);else for(const t of s)e.push(t)}}return r}getRootElevationRange(){return this.enabled&&null!=this._rootTiles?new Q(this._rootTileElevationRange.minElevation,this._rootTileElevationRange.maxElevation):null}getLowerBoundRadius(){const e=(this._ellipsoid.radius+this.visibleElevationRange.minElevation)*P;return Math.min(e,this._ellipsoid.radius)}getSphereScale(e,t){if(!this.tilingScheme)return null;if(!D(e,rt.center,this.spatialReference))return l.getLogger(this).error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;rt.radius=t;let i=null;const r=e=>{if(e&&A(e.extent,rt)){const t=e.children;if(t[0]&&!e.rendered)for(const e of t)r(e);else{const t=this._getLodBiasCorrectedScale(e.level);i=null==i?t:Math.min(i,t)}}},s=this._rootTiles;if(null!=s)for(const a of s)r(a);return i}queryVisibleScaleRange(e,t,i,r){if(!this._scaleRangeQueries)return;const s=t?this.tilingScheme.levelAtScale(t):0,a=i?this.tilingScheme.levelAtScale(i):1/0,n=this._lodBias;this._scaleRangeQueries.queryVisibleLevelRange(e,s+n,a+n,r)}_evaluateTransparency(){const e=this.baseOpacity,t=this.overlayManager.renderer.isEmpty,i=this._renderer.transparency,r=this._isFullyTransparent?t?3:2:e>=1&&!this.hasCompositeBlendMode&&!this._renderer.slicePlaneEnabled?0:1;return this._renderer.transparency=r,i!==r&&(this.notifyChange("opaque"),this.notifyChange("invisible"),!0)}_updateTilingScheme(){const{tilingScheme:e}=this.tilingSchemeLogic;if(!(e!==this.tilingScheme))return;_e(!!e,"tiling scheme cannot be reset to undefined"),this._isGlobal=!this.view?.state?.isLocal,this.tilingScheme&&this._removeAllTiles();const t=e?.spatialReference??R.WebMercator;this._spatialReference=t,this._isWebMercator=!!t?.isWebMercator,this._isWebMercatorOnPlateCarree=this._isWebMercator&&q(this.view?.renderSpatialReference),this._isGeographic=t?.isGeographic??!1,this._set("tilingScheme",e),this._tilingSchemeSpatialReference=this.tilingScheme?.spatialReference,this._projectorCache.clear(),this._updateClippingExtent(),e&&(this._updateTiledLayers(),this._renderer.tileSize=e.pixelSize,this.overlayManager.spatialReference=e.spatialReference,this._updateRootTiles())}static{this._tileMemcacheKey="TerrainTileMemcache"}_acquireTile(e,t,i,r){const s=this._tileCache.pop(Ze._tileMemcacheKey);return s?(s.init(e,t,i,r,this),s):new this._tileConstructor(e,t,i,r,this)}get updatingRootTiles(){return this._updatingRootTiles}_updateRootTiles(){const{groundExtent:e,tilingScheme:t}=this;if(!t)return;if(!this.enabled)return void this._setRootTiles(null);const i=st;let s=t.rootTilesInExtent(e,i,5*he);if(null!=this._rootTiles){if(s.length>he)return void l.getLogger(this).warn(de);const e=this._rootTiles.map(e=>e.lij),t=r(e,s,Ie);if(this._updatingRootTiles=!0,t.removed.length>0||t.added.length>0){const e=this._rootTiles.filter(e=>!(t.removed.findIndex(t=>Ie(t,e.lij))>-1)||(this._purgeTile(e),!1));t.added.forEach(t=>e.push(this._newRootTile(t))),this._setRootTiles(e)}}else this._updatingRootTiles=!0,s.length>he&&(l.getLogger(this).warn(pe),s=t.rootTilesInExtent(e,i,he)),this._setRootTiles(s.map(e=>this._newRootTile(e)));k(i,this._rootTilesExtent)||(this._rootTilesExtent=I(i)),this.renderer.visible=!0,this._viewChangeUpdate(),this.overlayManager.setPlacementDirty(),this.notifyChange("ready"),this._updateAllTileGeometries(),this._updatingRootTiles=!1,this.checkAllTilesWaterproofness()}_updateAllTileGeometries(){const e=this._allTiles.filter(e=>this._canUpdateTileGeometry(e));0!==e.length?(e.sort(Ge),e.forEach(e=>this._renderer.updateTileGeometryState(e)),e.forEach(e=>e.renderData.updateNeighborData()),this._updateTilesGeometries(e),this._pendingTilesToUpdate.clear()):this._pendingTilesToUpdate.clear()}_updateTilesGeometries(e){const t=e.filter(e=>this._canUpdateTileGeometry(e));if(0===t.length)return;const i=this.renderer;for(const r of t)i.updateGeometryIfNeeded(r);for(const r of t)this._pendingTilesForElevationUpdateEvent.add(r)}_canUpdateTileGeometry(e){return e.loaded&&e.intersectsClippingArea&&e.hasGeometryState}_shouldSplit(e){return 1===e.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.snapLevel)}_newRootTile(e){const t=this._acquireTile(0,e[1],e[2],null);return this._shouldSplit(t)&&t.setPendingUpdate(1),this._loadTile(t),this._markTileToUpdate(t),this._updateRootTileElevationRange(),t}_setRootTiles(e){if(this._rootTiles=e,this._allTiles.clear(),null!=e){const t=this._iteratorPool.acquire();for(t.reset(e);!t.done;)this._allTiles.push(t.next());t.remove()}this._renderer.setRootTiles(this._rootTiles),this._updateTilesVisibility(e),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles})}_runViewChangeUpdateIfDirty(){this._viewChangeUpdateDirty&&(this._viewChangeUpdateDirty=!1,this._viewChangeUpdate())}_viewChangeUpdate(){this.view&&!this.suspended&&this.tilingScheme&&this.renderer.visible&&(this._inFrameTask?this._viewChangeUpdateDirty=!0:(this._viewChangeUpdateDirty=!1,this._updateViewDependentParameters(),this._updateTilesVisibility(this._rootTiles)))}_updateClippingStatus(e){e.updateClippingStatus(this.groundExtent)&&e.resetPendingUpdate(8)&&this._updateTileGeometryState(e)}_updateTilesVisibility(e){if(null==e)return;const t=Oe(e),i=this.visibleElevationRange;let r=t?i.minElevation:1/0,s=t?i.maxElevation:-1/0;const a=this.groundExtent,n=this.view.state.contentCamera.viewProjectionMatrix;this.setTileTreeDirty(!1);const l=this._iteratorPool.acquire();for(l.reset(e);!l.done;){const e=l.next();e.updateClippingStatus(a)&&e.resetPendingUpdate(8)&&this._updateTileGeometryState(e),e.computeVisibility(),e.updateScreenDepth(n),e.renderData&&(r=Math.min(e.elevationBoundsMin,r),s=Math.max(e.elevationBoundsMax,s))}l.remove(),this._viewChanged=!0,this._allTilesDirty=!0,this._updatePendingTileGeometries(),isFinite(r)&&isFinite(s)&&(i.minElevation!==r||i.maxElevation!==s)&&(this.visibleElevationRange=new J(r,s))}_updateRootTileElevationRange(){let e=1/0,t=-1/0;const i=this._rootTiles;null!=i&&i.forEach(({elevationBoundsMin:i,elevationBoundsMax:r})=>{e=Math.min(e,i),t=Math.max(t,r)});const r=this._rootTileElevationRange;r.minElevation===e&&r.maxElevation===t||(this._rootTileElevationRange=new J(e,t))}_updateViewDependentParameters(){const{camera:e,contentCamera:t}=this.view.state,i=Math.tan(.5*t.fovX),r=Math.tan(.5*t.fovY),s=this.tilingScheme.pixelSize,a=2**-this._lodBias*e.pixelRatio;this._splitLimits.aboveGround=e.aboveGround,this._splitLimits.fovX=i,this._splitLimits.fovY=r,this._splitLimits.relativeWidthLimit=s/e.width*this.maxTextureScale*a,this._splitLimits.relativeHeightLimit=s/e.height*this.maxTextureScale*a,this._splitLimits.maxLod=this.tilingScheme.getMaxLod(),this._splitLimits.angledSplitBias=this.view.qualitySettings.tiledSurface.angledSplitBias,this.view.state.fixedContentCamera?this._splitLimits.frustum=B(this._splitLimits.frustum??G(),t.frustum):this._splitLimits.frustum=null,E(this._eyePosRenderSR,t.eye),j(e.eye,this.view.renderSpatialReference,this._eyePosSurfaceSR,this.spatialReference)}_updateTileGeometryState(e){e.updateVisibility();const t=this._renderer.updateTileGeometryState(e);e.needsElevationSourceUpdate()&&(e.updateAgents(0),e.markElevationSourceUpdateRequested(),this.requestUpdate()),t&&this._markTileToUpdate(e),this.setMemoryDirty()}_markAllTileNeighborsForUpdate(e){e.forEachLoadedNeighbor(e=>{this._layerViews[1].some(ye)&&e.setPendingUpdate(32),this._pendingTilesToUpdate.add(e)})}_updateTileTexture(e,t){const i=e.resetPendingUpdate(32)?32:!!e.resetPendingUpdate(16)&&16;i&&(this._renderer.updateTileTexture(e,i),this._usedMemory=null,t.madeProgress())}_emitElevationUpdateEventForTiles(){if(!this._shouldEmitChangeEvent)return;const e=this._pendingTilesForElevationUpdateEvent;if(e.size>0){const t=new Float64Array(4*e.size);let i=0;for(const r of e)t.set(r.extent,4*i),++i;e.clear();for(const e of Y(t,this.spatialReference)){const t=new z(this.spatialReference,e,"ground");this.emit("elevation-change",t)}}this._shouldEmitChangeEvent=!1}runTask(e){this._handleLayerViewChanges(e),this._frameTask.processQueue(e),this.renderer.processScaleRangeQueries(this._scaleRangeQueries,e),this._inFrameTask=!0,this._pendingUpdates=0,this._hasPendingUpdates=!1,this._updateAllTilesStatus(e),this._sortTiles(e);const t=!this.view.state.fixedContentCamera;this._mergeAndSplit(e,t),this._updateElevation(e),this._updateElevationSources(e),this._updateTextures(e),t||this._mergeAndSplit(e,!0),this._inFrameTask=!1,this._runViewChangeUpdateIfDirty();const i=this._pendingTilesToUpdate.size>0,r=i&&this._hasPendingGeometryWithoutIndices();if(e.done&&!r||this._updatePendingTileGeometries(),this._emitElevationUpdateEventForTiles(),e.done&&(e.hasProgressed||i&&!r)&&this.requestUpdate(),this.notifyChange("updatingProgressValue"),Ue&&this._checkTileInvariant(),!e.hasProgressed)return Je}_checkTileInvariant(){const e=new Map;this._allTiles.forAll(t=>e.set(t,new Set)),this._allTiles.forAll(t=>{if(_e(t.rendered===t.leaf,` rendered ${t.rendered} != ${t.leaf} leaf`),!t.leaf){const e=e=>0===e.unmergableChildCount&&0===e.maxLevelDeltaNeighborCount,i=t.children.reduce((t,i)=>t+(e(i)?0:1),0);if(_e(t.unmergableChildCount===i,` Tile[${t.lij.toString()}] unmergeable child count mismatch: actual ${t.unmergableChildCount} vs ${i}`),t.hasPendingUpdate(4)){_e(!t.hasPendingUpdate(1),"Tile can be both split and merge at the same time");for(const e of t.children)_e(e.leaf||e.hasPendingUpdate(4),"Child of tile to merge must also merge")}}for(let i=0;i<4;++i){if(t.rendered){const e=t.renderData?.geometryState.edgePeerNeighbors[i];if(null!=e){{const r=t.level-e.level<=ue;r||(console.log(`tile level delta [${t.lij.toString()}] vs [${e.lij.toString()}] > ${ue} (edge[${i}])`),_e(r,`tile level delta [${t.level}] vs [${e.level}] > ${ue}`))}_e(t.level-e.level<=ue,`Max tile lod delta exceeded: [${t.lij.toString()}] vs [${e.lij.toString()}]`)}}const r=t.level-ue,s=e=>e.leaf||e.level===t.level,a=t.findNeighborTile(fe[i],s);if(null!=a){if(t.leaf&&t.level>=ue){let i=a;for(;t.level-i.level<ue;)i=i.parent;const s=[r,t.lij[1]>>ue,t.lij[2]>>ue];if(!Ie(s,i.lij)){const r=e.get(i);_e(!r.has(t),"Cannot already have neighbor"),r.add(t)}}_e(a.rendered||a.level===t.level,"Non-same-level-neighbor of rendered must be rendered"),_e(t.level-a.level<=ue,`Tile level delta [${t.level}] vs [${a.level}] > ${ue}`)}}}),this._allTiles.forAll(t=>{const i=t.maxLevelDeltaNeighborCount,r=e.get(t);_e(i===r.size,`Tile[${t.lij.toString()}] merge-blocker mismatch: actual ${i} vs ${r.size}`)})}_updateAllTilesStatus(e){if(!this._viewChanged||!this._rootTiles||e.done)return;this._viewChanged=!1;let t=!1;const i=new ae(this._allTiles.length);i.pushAll(this._rootTiles);const r=this.snapLevel,s=this._splitLimits,a=this._eyePosRenderSR;this._allTiles.forAll(e=>{e.maxLevelDeltaNeighborCount=0,e.unmergableChildCount=0});const n=this.view.state.contentCamera.viewProjectionMatrix;for(;!i.empty;){const e=i.pop(),l=e.parent,o=l?.hasPendingUpdate(4),h=o?4:e.shouldSplit(s,a,r),d=1===h;e.leaf?ot(e,d):i.pushAll(e.children),o?(e.resetPendingUpdate(1),e.leaf||(e.setPendingUpdate(4),t=!0),this._updateClippingStatus(e),e.updateVisibility(),e.updateScreenDepth(n)):d?(e.resetPendingUpdate(4),e.leaf&&(e.setPendingUpdate(1),t=!0)):(e.resetPendingUpdate(1)&&e.updateAgentSuspension(),2===h&&e.updateAgents(0),e.leaf||(e.setPendingUpdate(4),e.resetPendingUpdate(1),t=!0))}this._allTilesDirty=t,this.requestUpdate(),(this._shortBatches||!this._oneBatchPerFrameTask)&&this._updatePendingTileGeometries(),e.madeProgress()}_sortTiles(e){e.done||this._allTilesSorted||!this.view.pointsOfInterest?.focus||(qe(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger?.update(),e.madeProgress())}_markTileToUpdate(e){Te(e.loaded),e.intersectsClippingArea&&(this._pendingTilesToUpdate.add(e),this._markAllTileNeighborsForUpdate(e))}_hasPendingGeometryWithoutIndices(){for(const e of this._pendingTilesToUpdate)if(e.loaded&&e.intersectsClippingArea&&null==e.renderData?.vao?.indexBuffer)return!0;return!1}_updatePendingTileGeometries(){const e=this._pendingTilesToUpdate,t=[];if(e.forEach(e=>{this._canUpdateTileGeometry(e)&&t.push(e)}),0===t.length)return void e.clear();const i=(i,r)=>{!r||!this._canUpdateTileGeometry(r)||r.level<i.level||e.has(r)||(e.add(r),t.push(r),r.renderData.updateNeighborData())};t.sort(Ge);const r=t.length;for(let s=0;s<r;++s){const r=t[s];Te(r.loaded),Te(r.intersectsClippingArea);const a=r.renderData;if(!a?.geometryState)continue;a.updateNeighborData();const n=a.dirtyEdgeResolutions,l=a.geometryState,o=e=>{const t=De[e];i(r,l.cornerPeerNeighbors[e]?.findCorner(Le(t),e=>e.loaded))};for(let t=0;t<4;++t)if(n&1<<t){const s=a.geometryState.edgePeerNeighbors[t];s&&s?.level>=r.level&&s.forAllSubtreeOnSide(ve(fe[t]),t=>!!this._canUpdateTileGeometry(t)&&(Te(e.has(t)||Ge(r,t)<0),i(r,t),!0)),o((t+1)%4),o(t)}}e.clear(),this._updateTilesGeometries(t),this._shouldEmitChangeEvent=!0,Ue&&Pe&&this.checkAllTilesWaterproofness()}_mergeAndSplit(e,t){if(this.suspended||e.done||!this._allTilesDirty)return;this._allTilesDirty=!1,this.requestUpdate();let i=!1;const r=this.view.state.fixedContentCamera;let s=!1;for(;!e.done;){s=!0;let a=!1;const n=!this._allTiles.some(s=>{if(!i&&!r&&!s.visible)return e.done;let n=s;if(s.hasPendingUpdate(4)){if(!t||s.unmergableChildCount>0)return e.done;for(s.resetPendingUpdate(4);null!=n.parent&&0===n.parent.unmergableChildCount&&n.parent.resetPendingUpdate(4);)n=n.parent;this._mergeTile(n),a=!0,e.madeProgress()}else if(s.resetPendingUpdate(1)){let t=!0;const i=s.level;if(i>=ue){const e=e=>e.leaf||i-e.level<ue;for(let r=0;r<4;++r){const a=s.findNeighborTile(fe[r],e);null!=a&&i-a.level===ue&&(t=!1,Ue&&(Te(a.leaf),Te(a.hasPendingUpdate(1))))}}t?(this._splitTile(s),e.madeProgress(),a=!0):s.setPendingUpdate(1)}return e.done});if(a&&(this._allTilesSorted=!1,this._allTilesDirty=!0,!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries()),n){if(!i){i=!0;continue}if(!a)break}else this._allTilesDirty=!0}s?e.madeProgress():this._allTilesDirty=!0,!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries(),this._allTilesCreated=!this.allTiles.some(e=>e.hasPendingUpdate(1)||e.hasPendingUpdate(4)&&0===e.unmergableChildCount),this._sortTiles(e)}_updateElevation(e){e.done||(this._allTiles.some(t=>(t.resetPendingUpdate(8)&&(this._updateTileGeometryState(t),e.madeProgress()),e.done)),!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries())}_updateElevationSources(e){e.done||this._allTiles.some(t=>(t.needsElevationSourceUpdate()&&(t.updateAgents(0),t.markElevationSourceUpdateRequested(),e.madeProgress()),e.done))}_updateTextures(e){e.done||this._allTiles.some(t=>(this._updateTileTexture(t,e),e.done))}_updateClippingExtent(){this.spatialReference&&(this.updateOverlayParameters(),this.requestRender(1),this.overlayManager.setPlacementDirty(),this._updateRootTiles())}get _lodBias(){return this.view.qualitySettings.tiledSurface.lodBias-(1-this.view.quality)*ce}_getLodBiasCorrectedScale(e){const t=this.tilingScheme.levels,i=o(e-this._lodBias,0,t.length-1),r=i-Math.floor(i);return t[Math.floor(i)].scale*(1-r)+t[Math.ceil(i)].scale*r}_removeAllTiles(){this._pendingTilesToUpdate.clear(),this._pendingTilesForElevationUpdateEvent.clear(),null!=this._rootTiles&&(this._rootTiles.forEach(e=>this._purgeTile(e)),this._setRootTiles(null),this.notifyChange("ready")),this._allTiles.clear(),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles}),this.renderer.visible=!1}_purgeSubtree(e){const t=e.children;t[0]&&(this._purgeTile(t[0]),this._purgeTile(t[1]),this._purgeTile(t[2]),this._purgeTile(t[3]),e.clearChildren())}_purgeTile(e){e.leaf?dt(e):this._purgeSubtree(e),this._allTiles.removeUnordered(e),this._unloadTile(e),e.dispose(),this._tileCache.put(Ze._tileMemcacheKey,e),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles})}_unloadTile(e){this._pendingTilesToUpdate.delete(e),this._pendingTilesForElevationUpdateEvent.delete(e),e.unload()}_splitTile(e){_e(e.leaf,"Tile that is already split should not be split again!"),_e(e.rendered,"Tile marked to split is not rendered"),dt(e);const t=e.createChildren();this._allTiles.pushArray(t),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles}),e.updateAgentSuspension(),_e(e.rendered,"parent should be rendered"),t.forEach(e=>this._loadTile(e)),t.forEach(e=>this._pendingTilesToUpdate.add(e)),this._unloadTile(e),this._markAllTileNeighborsForUpdate(e),this._emitTileScaleChange(e,e.level+1),this._allTilesDirty=!0,this._shortBatches&&this._updatePendingTileGeometries(),t.forEach(e=>ot(e,e.hasPendingUpdate(1))),++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){nt.spatialReference=this.spatialReference,nt.extent=e.extent,nt.scale=this._getLodBiasCorrectedScale(t),this.emit("scale-change",nt)}createTile(e,t,i,r){_e(!!r,"createTile sanity check");const s=this._acquireTile(e,t,i,r);return s.updateClippingStatus(this.groundExtent),s.updateScreenDepth(this.view.state.contentCamera.viewProjectionMatrix),this._shouldSplit(s)&&s.setPendingUpdate(1),s}get _shortBatches(){return 2!==this.view.state.mode}_mergeTile(e){_e(!e.hasPendingUpdate(1),"_mergeTile sanity check"),_e(!e.leaf,"Cannot merge a leaf"),e.leaf||(this._purgeSubtree(e),_e(!e.renderData,"Merging tile with existing render data?"),this._loadTile(e),this._markTileToUpdate(e),this._emitTileScaleChange(e),this._shortBatches&&this._updatePendingTileGeometries(),ot(e,!1),this._allTilesDirty=!0,++this._performanceInfo.numMerged)}_loadTile(e){e.load(),this.requestUpdate(),this._allTilesDirty=!0,this.overlayManager?.hasOverlays&&e.updateOverlayParameters(this.overlayManager)}_handleLayerViewChanges(e=Xe){if(!this._layerViewsDirty)return;this._layerViewsDirty=!1;let t=!1;const i=new Set;let r=-1;for(let s=this.view.allLayerViews.length-1;s>=0;s--){const e=this.view.allLayerViews.items[s];if(i.add(e.uid),we(e)||Se(e))if(this._basemapLayerViewHandles.has(e.uid)&&!Se(e)){const i=this._layerClassFromLayerView(e),s=this.getLayerIndexByUID(i,e.uid);null!=s&&((s<r||null==r)&&(t=!0),r=s)}else this._registerTiledLayerView(e),e.layer.loaded&&(t=!0)}this._basemapLayerViewHandles.forEach((e,r)=>{i.has(r)||(this._unregisterTiledLayerView(r),t=!0)}),t&&this._updateTiledLayers(),this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._evaluateTransparency(),e.madeProgress()}get _isFullyTransparent(){if(this.view.map?.ground?.opacity>0)return!1;for(const e of this.view.allLayerViews.items)if(Ce(e)&&!W(e.layer)&&0!==e.fullOpacity)return!1;return!0}_hasCompositeBlendMode(){for(const e of this.view.allLayerViews.items)if((be(e)||Se(e))&&He($e[e.layer.blendMode]))return!0;return!1}_layerClassFromLayerView(e){return Ee(e)?0:1}_registerTiledLayerView(e){const t=[];if((be(e)||Se(e))&&t.push(_(()=>e.layer.blendMode,()=>{this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._updateTileTextures(2)})),!Se(e)){const i=this._layerClassFromLayerView(e);t.push(_(()=>!e.destroyed&&e.suspended,()=>this._updateTiledLayers())),t.push(_(()=>!e.destroyed&&e.fullOpacity,()=>this._updateTileTextures(2)));const{layer:r}=e;"effectiveScaleRange"in r&&t.push(_(()=>!e.destroyed&&r.effectiveScaleRange,()=>this._restartAllAgents(i))),t.push(e.on("data-changed",()=>{const t=this.getLayerIndexByUID(i,e.uid);null!=t&&this._invalidateLayerData(t,i)}))}this._unregisterTiledLayerView(e.uid),this._basemapLayerViewHandles.set(e.uid,t)}_unregisterTiledLayerView(e){const t=this._basemapLayerViewHandles.get(e);if(t){for(const e of t)e.remove();this._basemapLayerViewHandles.delete(e)}}_updateTiledLayers(){if(!this.tilingScheme||this.view.suspended)return;const e=this.view.allLayerViews,t=[[],[]];let i=null;e.forEach(e=>{if(!e.layer||e.suspended||!we(e)||!e.fullExtent)return;const r=this._layerClassFromLayerView(e);if(1===r){const t=e.displayLevelRange.maxLevel;t!==1/0&&(null===i||t>i)&&(i=t)}t[r].push(e)});for(const r of ie){const e=this._layerViews[r],i=t[r];i.reverse();const s=i.length;let a=e.length!==s;const n=new Array(s),l=new Array(e.length);this._layerIndexByUid[r].clear();for(let t=0;t<s;t++){const s=i[t].uid;this._layerIndexByUid[r].set(s,t);const o=e.indexOf(i[t]);n[t]=o,t!==o&&(a=!0),o>-1&&(l[o]=t)}if(a){const e=this._postorderIterator;for(e.reset(this._rootTiles);!e.done;)e.next().modifyLayers(l,n,r);this._layerViews[r]=i,this._restartAllAgents(r),this._updateTilesVisibility(this._rootTiles)}}this.tilingScheme.ensureMaxLod(i)&&(this._viewChangeUpdate(),this.notifyChange("tilingScheme"))}_restartAllAgents(e){const t=this._postorderIterator;for(t.reset(this._rootTiles);!t.done;){const i=t.next();i.restartAgents(e),0===e&&i.computeElevationBounds()}this._updateRootTileElevationRange()}layerViewByIndex(e,t){return this._layerViews[t][e]}numLayers(e){return this._layerViews[e].length}_updateTileTextures(e){this._allTiles.forAll(t=>{t.updateAgents(1),1===e?this.renderer.updateTileTexture(t,16):t.updateRenderData(1,e)}),this._evaluateTransparency()}_invalidateLayerData(e,t){null!=this._rootTiles&&(Ne(this._rootTiles,i=>i.removeLayerAgent(e,t)),Ne(this._rootTiles,i=>{i.invalidateLayerData(e,t),i.restartAgents(t)}))}setTileTreeDirty(e){this._allTilesDirty=!0,e&&(this._allTilesCreated=!1)}requestRender(e=1){this.renderer.setNeedsRender(e)}requestUpdate(){1===++this._pendingUpdates&&(this._hasPendingUpdates=!0)}requestTileData(e,t,i,r){const s=this.layerViewByIndex(t,i),a=s.layer;return!a.tilemapCache||ye(s)?this._requestTileData(e,i,s,r):(++this._asyncWorkItems,a.tilemapCache.fetchAvailability(e.level,e.lij[1],e.lij[2],{...r,timeout:6e3}).catch(t=>{throw c(r),g(t)||this._dataMissing(e,i,s),t}).then(()=>this._frameTask.schedule(()=>this._requestTileData(e,i,s,r),r.signal)).finally(()=>--this._asyncWorkItems))}_requestTileData(e,t,i,r){if(this.destroying)return Promise.resolve();return 0===t?Ee(i)?this._requestElevationTileData(e,i,r):Promise.reject():Ce(i)?this._requestMapTileData(e,i,r):Promise.reject()}_requestElevationTileData(e,t,i){++this._asyncWorkItems;const r=r=>{!m(i)&&r&&(this.setMemoryDirty(),this.requestUpdate(),this._elevationDataArrived(e,t,r))},s=i=>{g(i)||(l.getLogger(this).error(`Tile ${e.lij.toString()} layer 0/${t.uid} error ${i}`),this._dataMissing(e,0,t),this.requestUpdate())};return t.fetchElevationTile(e,{...H,...i}).then(e=>this._frameTask.schedule(()=>r(e)),s).finally(()=>--this._asyncWorkItems)}_elevationDataArrived(e,t,i){const r=this._layerIndexByUid[0].get(t.uid);if(null==r)return void l.getLogger(this).warn("TerrainSurface: received data from unknown layer %d %s",0,e.lij.toString());const s=new Z(e.lij,e.extent,i);e.dataArrived(r,0,s),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:0});const a=[e],n=e.level,o=this._iteratorPool.acquire();for(o.reset(a);!o.done;){const e=o.next();e.findElevationBoundsForLayer(r,n),e.computeElevationBounds()}0===n&&this._updateRootTileElevationRange(),o.remove(),this._updateTilesVisibility(a)}_requestMapTileData(e,t,i){++this._asyncWorkItems;const r=(r,s)=>{xe(s),m(i)||(console.error(`Tile ${e.lij.toString()} layer 1/${t.uid} error ${r}`),this._dataMissing(e,1,t),this.requestUpdate())},s=e=>t=>r(t,e),a=r=>this._frameTask.schedule(()=>{this.requestUpdate(),m(i)?xe(r):this._mapTileDataArrived(e,t,r)},i.signal,s(r)).catch(s(r)),n=(e,t=null)=>this._frameTask.schedule(()=>r(e,t));return t.fetchTile(e.lij,i).then(a,n).finally(()=>--this._asyncWorkItems)}_mapTileDataArrived(e,t,i){const r=this.getLayerIndexByUID(1,t.uid);if(null==r)return xe(i),void l.getLogger(this).warn("TerrainSurface: received data from unknown layer");e.dataArrived(r,1,i),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:1})}_dataMissing(e,t,i){const r=this.getLayerIndexByUID(t,i.uid);null!=r?(e.dataMissing(r,t),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:t})):l.getLogger(this).warn("TerrainSurface: received data from unknown layer")}get performanceInfo(){const e=this._performanceInfo;return e.numNodes=this._allTiles.length,e.numLeaves=e.numVisible=e.numRendered=e.numLoadedPerLevel.length=e.numRenderedPerLevel.length=0,this._allTiles.forAll(t=>{t.leaf&&e.numLeaves++;const i=t.level;t.renderData&&(e.numLoadedPerLevel[i]=(e.numLoadedPerLevel[i]||0)+1),t.visible&&(e.numVisible++,t.rendered&&(e.numRenderedPerLevel[i]=(e.numRenderedPerLevel[i]||0)+1,e.numRendered++))}),e}setMemoryDirty(){this._usedMemory=null}get usedMemory(){return this.tilingScheme?(null==this._usedMemory&&(this._usedMemory=this._recalculateUsedMemory()),this._usedMemory??0):0}_recalculateUsedMemory(){return this.tilingScheme?Math.round(this._allTiles.reduce((e,t)=>e+t.usedMemory,0)):null}getUsedMemoryForLayerView(e){let t=0;const i=this._layerClassFromLayerView(e),r=this.getLayerIndexByUID(i,e.uid);return null!=r&&this._allTiles.forAll(e=>t+=e.getUsedMemoryForLayer(i,r)),t}get renderPatchBorders(){return this._renderer.renderPatchBorders}set renderPatchBorders(e){this._renderer.renderPatchBorders=e}get renderingDisabled(){return this._renderer.renderingDisabled}set renderingDisabled(e){this._renderer.renderingDisabled=e}get test(){}checkAllTilesWaterproofness(){if(!Pe)return;const e=this._rootTiles;if(null==e)return;const t=e=>e?.renderData?.geometry?.indices?.length>0,i=(e,i)=>{t(e)&&console.error("Tile[",e.lij,"] has geometry although parent[",i.lij,"] has geom")},r=e=>{if(e.intersectsClippingArea)if(e.renderData&&!e.renderData.geometryState&&console.error("Tile[",e.lij,"] has renderData but not geometryState"),e.renderData&&!e.renderData.geometry&&console.error("Tile[",e.lij,"] has renderData but not geometryInfo"),!e.renderData?.geometry||(e.renderData.geometry.indices?.length??0)>0||console.error("Tile[",e.lij,"] has renderData but no indices - geometryInfo: ",e.renderData.geometry),t(e)){e.checkGeometryWaterproofness();for(const t of e.children)i(t,e)}else if(e.leaf)console.error("Tile[",e.lij,"] has no geometry and no children, from root to leaf");else for(const t of e.children)r(t)},s=e=>{const t=e.parent?.visible??!0,i=e.visible;e.computeVisibility();const r=e.visible;if(i!==r&&t&&console.error(" Tile[",e.lij,"] has out of date visibility: ",i," instead of ",r),!e.leaf)for(const a of e.children)s(a)};for(const a of e)r(a),s(a)}get isGlobal(){return this._isGlobal}get isGeographic(){return this._isGeographic}get isWebMercator(){return this._isWebMercator}get isWebMercatorOnPlateCarree(){return this._isWebMercatorOnPlateCarree}isEastEndWrap(e){return this._isGlobal&&e[2]===this.lijEastEnd(e[0])-1}isWestEndWrap(e){return this._isGlobal&&0===e[2]}lijEastEnd(e){return 1<<e+(this._isGeographic?1:0)}wrapEastWest(e){const t=this.lijEastEnd(e[0]),i=e[2];if(0<=i&&i<t)return e;if(!this._isGlobal)return null;const r=(i+(i<0?t:0))%t;return[e[0],e[1],r]}enableInternalChecks(e){Re(e)}enableWaterproofnessChecks(e){Me(e)}static cleanupTerrainSurface(){at.prune()}enable(e){e!==this.enabled&&(this._set("enabled",e),e?(this._updateRootTiles(),this.suspended=!1,this.view.elevationProvider.register(0,this)):(this.view.elevationProvider.unregister(this),this.suspended=!0,this._removeAllTiles(),this._setRootTiles(null)),this.notifyChange("ready"))}updateOverlayParameters(){const{overlayManager:e}=this;this.allTiles.forAll(t=>t.updateOverlayParameters(e))}};e([w()],et.prototype,"_renderer",void 0),e([w({constructOnly:!0})],et.prototype,"_scaleRangeQueries",void 0),e([w({constructOnly:!0})],et.prototype,"view",void 0),e([w({constructOnly:!0})],et.prototype,"overlayManager",void 0),e([w({constructOnly:!0})],et.prototype,"terrainTextureCompressionTracker",void 0),e([w()],et.prototype,"_hasPendingUpdates",void 0),e([w()],et.prototype,"_asyncWorkItems",void 0),e([w()],et.prototype,"_allTilesDirty",void 0),e([w()],et.prototype,"_allTilesSorted",void 0),e([w()],et.prototype,"allTilesCreated",null),e([w()],et.prototype,"_allTilesCreated",void 0),e([w()],et.prototype,"_viewChanged",void 0),e([w({type:Number})],et.prototype,"heading",void 0),e([w()],et.prototype,"_splitLimits",void 0),e([w({readOnly:!0})],et.prototype,"_watchUpdatingTracking",void 0),e([w()],et.prototype,"_frameTask",void 0),e([w()],et.prototype,"demResolution",null),e([w({readOnly:!0})],et.prototype,"snapLevel",null),e([w({readOnly:!0})],et.prototype,"lodSnappingEnabled",null),e([w({readOnly:!0})],et.prototype,"userClippingExtent",null),e([w()],et.prototype,"_rootTilesExtent",void 0),e([w({readOnly:!0})],et.prototype,"groundExtent",null),e([w({readOnly:!0})],et.prototype,"fullGroundExtent",null),e([w({readOnly:!0})],et.prototype,"_tilingSchemeExtent",null),e([w({readOnly:!0})],et.prototype,"updating",null),e([w({readOnly:!0})],et.prototype,"readyToRun",null),e([w(K)],et.prototype,"updatingProgress",void 0),e([w({readOnly:!0})],et.prototype,"updatingProgressValue",null),e([w()],et.prototype,"_maxNumUpdating",void 0),e([w()],et.prototype,"baseOpacity",null),e([w()],et.prototype,"hasCompositeBlendMode",void 0),e([w({readOnly:!0})],et.prototype,"viewingMode",null),e([w()],et.prototype,"maxTextureScale",void 0),e([w({readOnly:!0})],et.prototype,"ready",null),e([w({readOnly:!0})],et.prototype,"rootTiles",null),e([w()],et.prototype,"_rootTiles",void 0),e([w({readOnly:!0})],et.prototype,"spatialReference",null),e([w({type:t})],et.prototype,"backgroundColor",null),e([w({value:!1})],et.prototype,"slicePlaneEnabled",null),e([w({readOnly:!0})],et.prototype,"tilingScheme",void 0),e([w({readOnly:!0})],et.prototype,"tilingSchemeLocked",null),e([w({readOnly:!0})],et.prototype,"tilingSchemeLogic",void 0),e([w()],et.prototype,"wireframe",null),e([w()],et.prototype,"opaque",null),e([w()],et.prototype,"invisible",null),e([w({value:!1})],et.prototype,"suspended",null),e([w()],et.prototype,"fadeDuration",null),e([w()],et.prototype,"_xNormalizer",null),e([w()],et.prototype,"visibleElevationRange",void 0),e([w()],et.prototype,"_rootTileElevationRange",void 0),e([w()],et.prototype,"_layerViewsDirty",void 0),e([w()],et.prototype,"renderPatchBorders",null),e([w()],et.prototype,"renderingDisabled",null),e([w({readOnly:!0})],et.prototype,"enabled",void 0),et=Ze=e([S("esri.views.3d.terrain.TerrainSurface")],et);const tt=et,it=x(),rt=new N,st=I(),at=new u,nt={spatialReference:null,extent:null,scale:0};function lt(e,t,i){for(const r of e){if(!r.containsPointXY(t,i))continue;let e=r;for(;e&&!e.renderData;){const r=(t>e.extentMidX?1:0)+(i<e.extentMidY?2:0);e=e.children[r]}const s=e?.renderData?.geometryState.samplerData??null;return ee(t,i,s)}return null}function ot(e,t){!e.leaf||e.level<ue||ut(e,e=>{t&&ht(e);const i=pt(e);if(e.maxLevelDeltaNeighborCount++,i){let t=e.parent;for(;t;){const e=pt(t);if(t.unmergableChildCount++,!e)break;t=t.parent}}})}function ht(e){if(e.hasPendingUpdate(1))return;let t=e.parent;for(;t?.resetPendingUpdate(4);)t=t.parent;e.resetPendingUpdate(4),e.leaf&&e.setPendingUpdate(1),e.level<ue||ut(e,e=>{ht(e)})}function dt(e){e.level<ue||ut(e,e=>{if(e.maxLevelDeltaNeighborCount--,0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount){let t=e.parent;for(;t&&(t.unmergableChildCount--,pt(t));)t=t.parent}})}function pt(e){return 0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount}function ut(e,t){if(e.level<ue)return;const i=e.level-ue,r=e.lij[1]>>ue,s=e.lij[2]>>ue,a=e=>e.leaf||e.level===i;for(let n=0;n<4;++n){const l=e.findNeighborTile(fe[n],a);if(!l||l.level!==i)continue;const o=l.lij;o[1]===r&&o[2]===s||t(l)}}export{tt as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../Color.js";import{filterInPlace as i,difference as r}from"../../../core/arrayUtils.js";import s from"../../../core/CollectionFlattener.js";import{toConst as a}from"../../../core/compilerUtils.js";import{EventedAccessor as n}from"../../../core/Evented.js";import"../../../core/has.js";import l from"../../../core/Logger.js";import{clamp as o}from"../../../core/mathUtils.js";import{removeMaybe as h,destroyMaybe as d}from"../../../core/maybe.js";import{MemCachePool as p}from"../../../core/MemCachePool.js";import u from"../../../core/ObjectPool.js";import c from"../../../core/PooledArray.js";import{throwIfAborted as g,isAbortError as m,isAborted as _}from"../../../core/promiseUtils.js";import{watch as f,syncAndInitial as y,initial as T,sync as v}from"../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as w}from"../../../core/units.js";import{property as S,subclass as C}from"../../../core/accessorSupport/decorators.js";import{exactEquals as b,set as E,copy as x}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as U}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as L}from"../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as P,radiusModifier as R}from"../../../geometry/ellipsoidUtils.js";import M from"../../../geometry/SpatialReference.js";import{getProjector as D}from"../../../geometry/projection/projectors.js";import{projectPointToVector as j}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as I}from"../../../geometry/projection/projectVectorToVector.js";import{create as V,equals as A,intersection as k,intersectsSphere as B}from"../../../geometry/support/aaBoundingRect.js";import{copy as G,create as O}from"../../../geometry/support/frustum.js";import{createSpatialReferenceCyclical as q}from"../../../geometry/support/normalizeUtils.js";import{isPlateCarree as N}from"../../../geometry/support/spatialReferenceUtils.js";import{Sphere as F}from"../../../geometry/support/sphere.js";import{ElevationQueryTileCache as W}from"../../../layers/support/ElevationQueryTileCache.js";import{isBaseLayer as H}from"../../../layers/support/layerUtils.js";import{queueHighPriority as $}from"../../../request/queue.js";import{debugFlags as Q}from"../support/debugFlags.js";import{ElevationRange as z}from"../support/ElevationRange.js";import{ElevationUpdateEvent as Y}from"../support/ElevationUpdateEvent.js";import{calculateElevationUpdateExtents as X}from"../support/elevationUpdateExtentUtils.js";import{toBoundingRect as K}from"../support/extentUtils.js";import{updatingProgress as J}from"../support/updatingProperties.js";import{ElevationBounds as Z}from"./ElevationBounds.js";import{ElevationData as ee,sampleElevation as te}from"./ElevationData.js";import{create as ie}from"./ExtentHelper.js";import{LayerClasses as re}from"./LayerClass.js";import{OverlayManager as se}from"./OverlayManager.js";import{PlanarPatch as ae}from"./PlanarPatch.js";import{Queue as ne}from"./Queue.js";import{ScaleRangeQueries as le}from"./ScaleRangeQueries.js";import{SphericalPatch as oe}from"./SphericalPatch.js";import{SplitLimits as he}from"./SplitLimits.js";import{maxRootTiles as de,tooManyRootTilesAfterChangeError as pe,tooManyRootTilesForLayerError as ue,maxTileNeighborLevelDelta as ce,maxMemoryLodBias as ge}from"./TerrainConst.js";import{TerrainRenderer as me}from"./TerrainRenderer.js";import _e from"./TerrainSurfacePerformanceInfo.js";import{weakAssert as fe,isVectorTileLayerView as ye,neighborEdgeIndices as Te,internalAssert as ve,oppositeEdge as we,isSurfaceLayerView as Se,isGroupLayerView as Ce,isMapTileLayerView as be,isBlendableLayerView as Ee,isElevationLayerView as xe,releaseTerrainData as Ue,enableTerrainInternalChecks as Le,oppositeCorner as Pe,enableWaterproofTests as Re,enableInternalTerrainChecks as Me,enableTerrainWaterproofChecks as De,neighborCornerIndices as je}from"./terrainUtils.js";import{Tile as Ie,lijEquals as Ve}from"./Tile.js";import{printAllocations as Ae}from"./TilePerLayerInfo.js";import{sortTiles as ke,IteratorPreorder as Be,IteratorPostorder as Ge,compareTilesByLij as Oe,hasLoadableSiblings as qe,sortTilesByPOI as Ne,traverseTilesPreorder as Fe}from"./tileUtils.js";import{TilingSchemeLogic as We}from"./TilingSchemeLogic.js";import{UpsampleInfo as He}from"./UpsampleInfo.js";import{isCompositeBlendMode as $e,blendModeFromString as Qe}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{hasLayerBasedScaleVisibility as ze}from"../../support/layerViewUtils.js";import{ImmediateTask as Ye,TaskPriority as Xe,noBudget as Ke}from"../../support/Scheduler.js";import{TextureCompressionTracker as Je}from"../../support/TextureCompressionTracker.js";import{Yield as Ze}from"../../support/Yield.js";var et;let tt=class extends n{static{et=this}get allTilesCreated(){return this._allTilesCreated}get allTiles(){return a(this._allTiles)}get renderedTiles(){return ke(i(this._allTiles.toArray(),e=>e.visible&&e.rendered))}get demResolution(){const{_allTiles:e,tilingScheme:t}=this;if(0===e.length)return{min:1,max:1};const i=w(t.spatialReference);let r=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(const a of e){const e=t.resolutionAtLevel(a.level)*i;r=Math.min(r,e),s=Math.max(s,e)}return{min:r,max:s}}constructor(e){super(e),this.terrainTextureCompressionTracker=new Je,this._iteratorPool=new u(()=>new Be,e=>e.remove=()=>this._iteratorPool.release(e)),this._postorderIterator=new Ge,this._hasPendingUpdates=!1,this._pendingUpdates=0,this._asyncWorkItems=0,this._allTilesDirty=!0,this._allTilesSorted=!0,this._allTilesCreated=!1,this._usedMemory=null,this._performanceInfo=new _e,this._viewChanged=!1,this.heading=0,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=U(),this._eyePosSurfaceSR=U(),this._splitLimits=new he,this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._updatingHandles=new L,this._poiWatchHandle=null,this._frameTask=Ye,this._allTiles=new c,this._upsampleInfoPool=new u(()=>new He),this._shouldEmitChangeEvent=!1,this._rootTilesExtent=V(),this.updatingProgress=.5,this._maxNumUpdating=1,this.maxTextureScale=1.2,this._spatialReference=M.WebMercator,this._elevationProjectorCache=new Map,this.visibleElevationRange=new z(1/0,-1/0),this._rootTileElevationRange=new z(1/0,-1/0),this._projectorCache=new Map,this._tilingSchemeSpatialReference=null,this._updatingRootTiles=!1,this._pendingTilesForElevationUpdateEvent=new Set,this._pendingTilesToUpdate=new Set,this.totalGeometryUpdates=0,this.totalTileUpdates=0,this._oneBatchPerFrameTask=!0,this._layerViewsDirty=!1,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._isWebMercator=!1,this._isWebMercatorOnPlateCarree=!1,this.enabled=!0;const{view:t}=e;this.overlayManager=new se({...e,terrainSurface:this}),this._isGlobal=!t.state?.isLocal,this._isGeographic=this._spatialReference?.isGeographic??!1,this._tileConstructor=this._isGlobal?oe:ae,this._ellipsoid=P(t.spatialReference),this._renderer=new me(this.overlayManager.renderer,t.stage,this._allTiles,this.terrainTextureCompressionTracker,t.resourceController.memoryController),ze()||(this._scaleRangeQueries=new le)}initialize(){const{view:e}=this,{resourceController:t}=e,{memoryController:i}=t;this._tileCache=new p((e,t)=>i.newCache(e,t),"terrain-tile"),this._upsampleMapCache=i.newCache("terrain-upsample",({tile:e})=>e.unloadMapData()),this._elevationQueryCache=new W(i.newCache("elevation-query"));const r=this.overlayManager;this.addHandles([f(()=>r.renderer.isEmpty,()=>this._evaluateTransparency()),f(()=>this.renderer.visible,e=>this.suspended=!e),f(()=>this.heading,e=>{this._renderer.updateHeading(e),this._updateTileTextures(0)},y)],"overlayManager"),this._updatingHandles.add(()=>({heading:e.camera?.heading,state:e.state?.mode}),({heading:e,state:t})=>{if(null==e)return;if(this.isGlobal&&this.isGeographic||this.isWebMercatorOnPlateCarree)return void(this.heading=90*Math.round(e/90)%360);const i=Math.round(e)%360,r=Math.abs(i-this.heading);(2===t||Math.min(r,360-r)>=30)&&(this.heading=i)},T),this.addHandles([f(()=>this.baseOpacity,()=>{this._handleLayerViewChanges(),this._updateTileTextures(this._evaluateTransparency()?1:2)},y),f(()=>this.hasCompositeBlendMode,()=>this._updateTileTextures(this._evaluateTransparency()?1:2),y),f(()=>this.backgroundColor,(e,t)=>{e?.equals(t)||(this._handleLayerViewChanges(),this._renderer.updateTileBackground(e))},v),f(()=>this.snapLevel,()=>this._viewChanged=!0,v),f(()=>this.view.pointsOfInterest,e=>{this._renderer.pointsOfInterest=e,this._poiWatchHandle=h(this._poiWatchHandle),e&&(this._poiWatchHandle=this._updatingHandles.add(()=>e.focus?.renderLocation,()=>this._allTilesSorted=!1,{equals:b}))}),f(()=>Q.TERRAIN_TILE_TREE_SHOW_TILES,t=>{t&&!this._treeDebugger?import("../layers/support/TerrainTileTree3DDebugger.js").then(({TerrainTileTree3DDebugger:t})=>{!this._treeDebugger&&Q.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new t({view:e}))}):t||(this._treeDebugger=d(this._treeDebugger))},T)]);const{spatialReference:a}=e;this._extentHelper=ie(this.viewingMode,{layers:e.map.allLayers,layerViews:e.allLayerViews,viewSpatialReference:a});const n=new s({getCollections:()=>e.defaultsFromMap?.mapCollections?.map(({layers:e})=>e),getChildrenFunction:e=>e&&"layers"in e?e.layers:null}),l=new We({layers:n,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:a});this._set("tilingSchemeLogic",l),this._updateTilingScheme();const o=t.scheduler;this._frameTask=o.registerTask(Xe.TERRAIN_SURFACE,this),this.addHandles([f(()=>this._extentHelper.stencilEnabledExtents,e=>this._renderer.setStencilEnabledLayerExtents(e),T),f(()=>this.tilingSchemeLogic.tilingScheme,()=>this._updateTilingScheme(),v),f(()=>this.groundExtent,()=>this._updateRootTiles(),T),e.on("resize",()=>this._viewChangeUpdate()),f(()=>{const t=e.state;return[this._lodBias,this.lodSnappingEnabled,e.quality,t.camera,t.contentCamera,t.fixedContentCamera]},()=>this._viewChangeUpdate(),y),f(()=>e.qualitySettings?.fadeDuration,e=>this._renderer.textureFadingEnabled=e>0,T),f(()=>e.qualitySettings?.physicallyBasedRenderingEnabled,e=>this._renderer.pbrMode=e?5:0,T),f(()=>e.qualitySettings?.tiledSurface.elevationLevelDelta,()=>this._updateAllTileGeometries()),f(()=>this.userClippingExtent,()=>this._updateClippingExtent(),v)]),this.addHandles(e.allLayerViews.on("after-changes",()=>this._layerViewsDirty=!0)),this._layerViewsDirty=!0,this._handleLayerViewChanges(),this._renderer.updateTileBackground(this.backgroundColor)}clearHandles(){this._updatingHandles?.removeAll(),this.removeAllHandles(),this._basemapLayerViewHandles.forEach((e,t)=>this._unregisterTiledLayerView(t)),this._basemapLayerViewHandles.clear()}destroy(){this._frameTask.remove(),this._frameTask=Ye,this._updatingHandles?.destroy(),this._removeAllTiles(),this._set("tilingSchemeLogic",d(this.tilingSchemeLogic)),this._basemapLayerViewHandles.forEach((e,t)=>this._unregisterTiledLayerView(t)),this._basemapLayerViewHandles.clear(),this._set("overlayManager",d(this.overlayManager)),this._tileCache=d(this._tileCache),this._allTiles.prune(),Ie.prune(),this._treeDebugger=d(this._treeDebugger),this._renderer.destroyed||this._renderer.destroy(),this._renderer=null,this._iteratorPool=d(this._iteratorPool),this._upsampleMapCache=d(this._upsampleMapCache),this._elevationQueryCache=d(this._elevationQueryCache),this._set("view",null),this._extentHelper=d(this._extentHelper),this._upsampleInfoPool=d(this._upsampleInfoPool),Ae(),this._layerViews.forEach(e=>e.length=0),this._performanceInfo=null}get renderer(){return this._renderer}get frustum(){return this.view.state.camera.frustum}get snapLevel(){return this.lodSnappingEnabled?this.view.terrainLevel:null}get lodSnappingEnabled(){return this.view.qualitySettings.tiledSurface.reduceTileLevelDifferences}get upsampleInfoPool(){return this._upsampleInfoPool}get upsampleMapCache(){return this._upsampleMapCache}get elevationQueryCache(){return this._elevationQueryCache}get hasStencilEnabledExtents(){return this._extentHelper.stencilEnabledExtents.length>0}get userClippingExtent(){const{spatialReference:e}=this,t=this.view?.clippingArea;if(null==t||null==e)return null;const i=V(),r=K(t,i,e)?i:null,s=this._get("userClippingExtent");return A(r,s)?s:r}get rootTilesExtent(){return this._rootTilesExtent}get groundExtent(){const e=k(this.fullGroundExtent,this.userClippingExtent,V()),t=this._get("groundExtent");return A(e,t)?t:e}get fullGroundExtent(){return null!=this._tilingSchemeExtent?this._tilingSchemeExtent:this._rootTilesExtent}get _tilingSchemeExtent(){return this.tilingSchemeLogic?.extent}get updating(){return this._hasPendingUpdates||(this._maxNumUpdating=1),this.enabled&&!!((this.readyToRun||this._updatingHandles?.updating||this._asyncWorkItems>0)&&this.ready&&!this.suspended||this.overlayManager?.updating||this.terrainTextureCompressionTracker.compressing)}get readyToRun(){return this.enabled&&(this._hasPendingUpdates||this._viewChanged||this._allTilesDirty||!this._allTilesSorted||this._hasElevationSourceUpdates||this._layerViewsDirty||this._scaleRangeQueries?.updating||this._frameTask.updating)&&this.ready&&!this.suspended}get _hasElevationSourceUpdates(){return this._allTiles.some(e=>e.needsElevationSourceUpdate())}get updatingProgressValue(){return this._maxNumUpdating=Math.max(this._pendingUpdates,this._maxNumUpdating),1-this._pendingUpdates/this._maxNumUpdating}get baseOpacity(){return this.view?.map?.ground?.opacity??1}set baseOpacity(e){this.view.map.ground.opacity=e}get viewingMode(){return this.view.state.viewingMode}get ready(){return!this.enabled||null!=this._rootTiles}get rootTiles(){return this._rootTiles}get spatialReference(){return this.tilingScheme?.spatialReference??null}get backgroundColor(){return this.view?.map?.ground?.surfaceColor}set backgroundColor(e){this.view.map.ground.surfaceColor=e}set slicePlaneEnabled(e){this._renderer.slicePlaneEnabled=e,this._set("slicePlaneEnabled",e),this._evaluateTransparency()}get tilingSchemeLocked(){return this.tilingSchemeLogic?.tilingSchemeLocked??!1}get wireframe(){return this._renderer?.wireframe}set wireframe(e){e!==this._renderer.wireframe&&(this._renderer.wireframe=e,this._updateAllTileGeometries())}get opaque(){return 0===this._renderer.transparency}get invisible(){return 3===this._renderer.transparency}set suspended(e){this._set("suspended",e),this._viewChangeUpdate()}get fadeDuration(){return this.view.qualitySettings.fadeDuration??0}intersect(e,t,i,r){this._renderer.intersectRay(e,t,i,r)}getElevationLevelDelta(e){return e<4?3:this.view.qualitySettings.tiledSurface.elevationLevelDelta}get _xNormalizer(){return q(this._spatialReference)}getElevation(e,t,i,r){const s=this._rootTiles;if(!s?.length||!this.enabled)return null;if(0===s[0].layerInfo[0].length)return null;let a=this._elevationProjectorCache.get(r);if(void 0===a&&(a=D(r,this._spatialReference)??null,this._elevationProjectorCache.set(r,a)),null==a)return l.getLogger(this).error("TerrainSurface.getElevation(): could not project given point to tiling scheme coordinate system"),null;const n=E(rt,e,t,i);a(n,0,n,0);return ot(s,this._xNormalizer?.normalize(n[0])??n[0],n[1])}getElevations(e,t,i){const r=this._rootTiles,s=r?r[0].layerInfo[0].length:0;if(r?.length&&0!==s&&this.enabled)for(let a=0;a<t;++a){const t=3*a;i(a,ot(r,e[t],e[t+1]))}else for(let a=0;a<t;++a)i(a,null)}getLayerIndexByUID(e,t){return this._layerIndexByUid[e].get(t)}getScale(e){if(!this.tilingScheme)return null;if(!j(e,rt,this.spatialReference))return l.getLogger(this).error("TerrainSurface.getScale(): could not project given point to tiling scheme coordinate system"),null;const t=this._rootTiles;if(null!=t)for(const i of t)if(i?.containsPoint(rt)){let e=i;for(;e.children[0]&&!e.rendered;){const t=e.children[0].extent;let i=0;rt[0]>t[2]&&(i+=1),rt[1]<t[1]&&(i+=2),e=e.children[i]}return this._getLodBiasCorrectedScale(e.level)}return 1/0}_ensureProjector(e){const t=this._projectorCache.get(e);if(t)return t;const i=D(e,this._tilingSchemeSpatialReference)??null;return this._projectorCache.set(e,i),i}getSphereElevationRange(e,t){if(!this.enabled||null==this._rootTiles)return null;const i=this._ensureProjector(t);if(null==i)return l.getLogger(this).error("TerrainSurface.getSphereElevationRange(): could not project given point to tiling scheme coordinate system"),null;st.copyFrom(e),i(st.center,0,st.center,0);const r=new z,s=this._rootTiles;if(null!=s){const e=[];for(const i of s)e.push(i);let t=0;for(;t<e.length;){const i=e[t];if(++t,!B(i.extent,st))continue;const s=i.children;if(null==s[0]||i.rendered)r.expandElevationRangeValues(i.elevationBoundsMin,i.elevationBoundsMax);else for(const t of s)e.push(t)}}return r}getRootElevationRange(){return this.enabled&&null!=this._rootTiles?new z(this._rootTileElevationRange.minElevation,this._rootTileElevationRange.maxElevation):null}getLowerBoundRadius(){const e=(this._ellipsoid.radius+this.visibleElevationRange.minElevation)*R;return Math.min(e,this._ellipsoid.radius)}getSphereScale(e,t){if(!this.tilingScheme)return null;if(!j(e,st.center,this.spatialReference))return l.getLogger(this).error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;st.radius=t;let i=null;const r=e=>{if(e&&B(e.extent,st)){const t=e.children;if(t[0]&&!e.rendered)for(const e of t)r(e);else{const t=this._getLodBiasCorrectedScale(e.level);i=null==i?t:Math.min(i,t)}}},s=this._rootTiles;if(null!=s)for(const a of s)r(a);return i}queryVisibleScaleRange(e,t,i,r){if(!this._scaleRangeQueries)return;const s=t?this.tilingScheme.levelAtScale(t):0,a=i?this.tilingScheme.levelAtScale(i):1/0,n=this._lodBias;this._scaleRangeQueries.queryVisibleLevelRange(e,s+n,a+n,r)}_evaluateTransparency(){const e=this.baseOpacity,t=this.overlayManager.renderer.isEmpty,i=this._renderer.transparency,r=this._isFullyTransparent?t?3:2:e>=1&&!this.hasCompositeBlendMode&&!this._renderer.slicePlaneEnabled?0:1;return this._renderer.transparency=r,i!==r&&(this.notifyChange("opaque"),this.notifyChange("invisible"),!0)}_updateTilingScheme(){const{tilingScheme:e}=this.tilingSchemeLogic;if(!(e!==this.tilingScheme))return;fe(!!e,"tiling scheme cannot be reset to undefined"),this._isGlobal=!this.view?.state?.isLocal,this.tilingScheme&&this._removeAllTiles();const t=e?.spatialReference??M.WebMercator;this._spatialReference=t,this._isWebMercator=!!t?.isWebMercator,this._isWebMercatorOnPlateCarree=this._isWebMercator&&N(this.view?.renderSpatialReference),this._isGeographic=t?.isGeographic??!1,this._set("tilingScheme",e),this._tilingSchemeSpatialReference=this.tilingScheme?.spatialReference,this._projectorCache.clear(),this._updateClippingExtent(),e&&(this._updateTiledLayers(),this._renderer.tileSize=e.pixelSize,this.overlayManager.spatialReference=e.spatialReference,this._updateRootTiles())}static{this._tileMemcacheKey="TerrainTileMemcache"}_acquireTile(e,t,i,r){const s=this._tileCache.pop(et._tileMemcacheKey);return s?(s.init(e,t,i,r,this),s):new this._tileConstructor(e,t,i,r,this)}get updatingRootTiles(){return this._updatingRootTiles}_updateRootTiles(){const{groundExtent:e,tilingScheme:t}=this;if(!t)return;if(!this.enabled)return void this._setRootTiles(null);const i=at;let s=t.rootTilesInExtent(e,i,5*de);if(null!=this._rootTiles){if(s.length>de)return void l.getLogger(this).warn(pe);const e=this._rootTiles.map(e=>e.lij),t=r(e,s,Ve);if(this._updatingRootTiles=!0,t.removed.length>0||t.added.length>0){const e=this._rootTiles.filter(e=>!(t.removed.findIndex(t=>Ve(t,e.lij))>-1)||(this._purgeTile(e),!1));t.added.forEach(t=>e.push(this._newRootTile(t))),this._setRootTiles(e)}}else this._updatingRootTiles=!0,s.length>de&&(l.getLogger(this).warn(ue),s=t.rootTilesInExtent(e,i,de)),this._setRootTiles(s.map(e=>this._newRootTile(e)));A(i,this._rootTilesExtent)||(this._rootTilesExtent=V(i)),this.renderer.visible=!0,this._viewChangeUpdate(),this.overlayManager.setPlacementDirty(),this.notifyChange("ready"),this._updateAllTileGeometries(),this._updatingRootTiles=!1,this.checkAllTilesWaterproofness()}_updateAllTileGeometries(){const e=this._allTiles.filter(e=>this._canUpdateTileGeometry(e));0!==e.length?(e.sort(Oe),e.forEach(e=>this._renderer.updateTileGeometryState(e)),e.forEach(e=>e.renderData.updateNeighborData()),this._updateTilesGeometries(e),this._pendingTilesToUpdate.clear()):this._pendingTilesToUpdate.clear()}_updateTilesGeometries(e){const t=e.filter(e=>this._canUpdateTileGeometry(e));if(0===t.length)return;const i=this.renderer;for(const r of t)i.updateGeometryIfNeeded(r);for(const r of t)this._pendingTilesForElevationUpdateEvent.add(r)}_canUpdateTileGeometry(e){return e.loaded&&e.intersectsClippingArea&&e.hasGeometryState}_shouldSplit(e){return 1===e.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.snapLevel)}_newRootTile(e){const t=this._acquireTile(0,e[1],e[2],null);return this._shouldSplit(t)&&t.setPendingUpdate(1),this._loadTile(t),this._markTileToUpdate(t),this._updateRootTileElevationRange(),t}_setRootTiles(e){if(this._rootTiles=e,this._allTiles.clear(),null!=e){const t=this._iteratorPool.acquire();for(t.reset(e);!t.done;)this._allTiles.push(t.next());t.remove()}this._renderer.setRootTiles(this._rootTiles),this._updateTilesVisibility(e),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles})}_runViewChangeUpdateIfDirty(){this._viewChangeUpdateDirty&&(this._viewChangeUpdateDirty=!1,this._viewChangeUpdate())}_viewChangeUpdate(){this.view&&!this.suspended&&this.tilingScheme&&this.renderer.visible&&(this._inFrameTask?this._viewChangeUpdateDirty=!0:(this._viewChangeUpdateDirty=!1,this._updateViewDependentParameters(),this._updateTilesVisibility(this._rootTiles)))}_updateClippingStatus(e){e.updateClippingStatus(this.groundExtent)&&e.resetPendingUpdate(8)&&this._updateTileGeometryState(e)}_updateTilesVisibility(e){if(null==e)return;const t=qe(e),i=this.visibleElevationRange;let r=t?i.minElevation:1/0,s=t?i.maxElevation:-1/0;const a=this.groundExtent,n=this.view.state.contentCamera.viewProjectionMatrix;this.setTileTreeDirty(!1);const l=this._iteratorPool.acquire();for(l.reset(e);!l.done;){const e=l.next();e.updateClippingStatus(a)&&e.resetPendingUpdate(8)&&this._updateTileGeometryState(e),e.computeVisibility(),e.updateScreenDepth(n),e.renderData&&(r=Math.min(e.elevationBoundsMin,r),s=Math.max(e.elevationBoundsMax,s))}l.remove(),this._viewChanged=!0,this._allTilesDirty=!0,this._updatePendingTileGeometries(),isFinite(r)&&isFinite(s)&&(i.minElevation!==r||i.maxElevation!==s)&&(this.visibleElevationRange=new Z(r,s))}_updateRootTileElevationRange(){let e=1/0,t=-1/0;const i=this._rootTiles;null!=i&&i.forEach(({elevationBoundsMin:i,elevationBoundsMax:r})=>{e=Math.min(e,i),t=Math.max(t,r)});const r=this._rootTileElevationRange;r.minElevation===e&&r.maxElevation===t||(this._rootTileElevationRange=new Z(e,t))}_updateViewDependentParameters(){const{camera:e,contentCamera:t}=this.view.state,i=Math.tan(.5*t.fovX),r=Math.tan(.5*t.fovY),s=this.tilingScheme.pixelSize,a=2**-this._lodBias*e.pixelRatio;this._splitLimits.aboveGround=e.aboveGround,this._splitLimits.fovX=i,this._splitLimits.fovY=r,this._splitLimits.relativeWidthLimit=s/e.width*this.maxTextureScale*a,this._splitLimits.relativeHeightLimit=s/e.height*this.maxTextureScale*a,this._splitLimits.maxLod=this.tilingScheme.getMaxLod(),this._splitLimits.angledSplitBias=this.view.qualitySettings.tiledSurface.angledSplitBias,this.view.state.fixedContentCamera?this._splitLimits.frustum=G(this._splitLimits.frustum??O(),t.frustum):this._splitLimits.frustum=null,x(this._eyePosRenderSR,t.eye),I(e.eye,this.view.renderSpatialReference,this._eyePosSurfaceSR,this.spatialReference)}_updateTileGeometryState(e){e.updateVisibility();const t=this._renderer.updateTileGeometryState(e);e.needsElevationSourceUpdate()&&(e.updateAgents(0),e.markElevationSourceUpdateRequested(),this.requestUpdate()),t&&this._markTileToUpdate(e),this.setMemoryDirty()}_markAllTileNeighborsForUpdate(e){e.forEachLoadedNeighbor(e=>{this._layerViews[1].some(ye)&&e.setPendingUpdate(32),this._pendingTilesToUpdate.add(e)})}_updateTileTexture(e,t){const i=e.resetPendingUpdate(32)?32:!!e.resetPendingUpdate(16)&&16;i&&(this._renderer.updateTileTexture(e,i),this._usedMemory=null,t.madeProgress())}_emitElevationUpdateEventForTiles(){if(!this._shouldEmitChangeEvent)return;const e=this._pendingTilesForElevationUpdateEvent;if(e.size>0){const t=new Float64Array(4*e.size);let i=0;for(const r of e)t.set(r.extent,4*i),++i;e.clear();for(const e of X(t,this.spatialReference)){const t=new Y(this.spatialReference,e,"ground");this.emit("elevation-change",t)}}this._shouldEmitChangeEvent=!1}runTask(e){this._handleLayerViewChanges(e),this._frameTask.processQueue(e),this.renderer.processScaleRangeQueries(this._scaleRangeQueries,e),this._inFrameTask=!0,this._pendingUpdates=0,this._hasPendingUpdates=!1,this._updateAllTilesStatus(e),this._sortTiles(e);const t=!this.view.state.fixedContentCamera;this._mergeAndSplit(e,t),this._updateElevation(e),this._updateElevationSources(e),this._updateTextures(e),t||this._mergeAndSplit(e,!0),this._inFrameTask=!1,this._runViewChangeUpdateIfDirty();const i=this._pendingTilesToUpdate.size>0,r=i&&this._hasPendingGeometryWithoutIndices();if(e.done&&!r||this._updatePendingTileGeometries(),this._emitElevationUpdateEventForTiles(),e.done&&(e.hasProgressed||i&&!r)&&this.requestUpdate(),this.notifyChange("updatingProgressValue"),Le&&this._checkTileInvariant(),!e.hasProgressed)return Ze}_checkTileInvariant(){const e=new Map;this._allTiles.forAll(t=>e.set(t,new Set)),this._allTiles.forAll(t=>{if(fe(t.rendered===t.leaf,` rendered ${t.rendered} != ${t.leaf} leaf`),!t.leaf){const e=e=>0===e.unmergableChildCount&&0===e.maxLevelDeltaNeighborCount,i=t.children.reduce((t,i)=>t+(e(i)?0:1),0);if(fe(t.unmergableChildCount===i,` Tile[${t.lij.toString()}] unmergeable child count mismatch: actual ${t.unmergableChildCount} vs ${i}`),t.hasPendingUpdate(4)){fe(!t.hasPendingUpdate(1),"Tile can be both split and merge at the same time");for(const e of t.children)fe(e.leaf||e.hasPendingUpdate(4),"Child of tile to merge must also merge")}}for(let i=0;i<4;++i){if(t.rendered){const e=t.renderData?.geometryState.edgePeerNeighbors[i];if(null!=e){{const r=t.level-e.level<=ce;r||(console.log(`tile level delta [${t.lij.toString()}] vs [${e.lij.toString()}] > ${ce} (edge[${i}])`),fe(r,`tile level delta [${t.level}] vs [${e.level}] > ${ce}`))}fe(t.level-e.level<=ce,`Max tile lod delta exceeded: [${t.lij.toString()}] vs [${e.lij.toString()}]`)}}const r=t.level-ce,s=e=>e.leaf||e.level===t.level,a=t.findNeighborTile(Te[i],s);if(null!=a){if(t.leaf&&t.level>=ce){let i=a;for(;t.level-i.level<ce;)i=i.parent;const s=[r,t.lij[1]>>ce,t.lij[2]>>ce];if(!Ve(s,i.lij)){const r=e.get(i);fe(!r.has(t),"Cannot already have neighbor"),r.add(t)}}fe(a.rendered||a.level===t.level,"Non-same-level-neighbor of rendered must be rendered"),fe(t.level-a.level<=ce,`Tile level delta [${t.level}] vs [${a.level}] > ${ce}`)}}}),this._allTiles.forAll(t=>{const i=t.maxLevelDeltaNeighborCount,r=e.get(t);fe(i===r.size,`Tile[${t.lij.toString()}] merge-blocker mismatch: actual ${i} vs ${r.size}`)})}_updateAllTilesStatus(e){if(!this._viewChanged||!this._rootTiles||e.done)return;this._viewChanged=!1;let t=!1;const i=new ne(this._allTiles.length);i.pushAll(this._rootTiles);const r=this.snapLevel,s=this._splitLimits,a=this._eyePosRenderSR;this._allTiles.forAll(e=>{e.maxLevelDeltaNeighborCount=0,e.unmergableChildCount=0});const n=this.view.state.contentCamera.viewProjectionMatrix;for(;!i.empty;){const e=i.pop(),l=e.parent,o=l?.hasPendingUpdate(4),h=o?4:e.shouldSplit(s,a,r),d=1===h;e.leaf?ht(e,d):i.pushAll(e.children),o?(e.resetPendingUpdate(1),e.leaf||(e.setPendingUpdate(4),t=!0),this._updateClippingStatus(e),e.updateVisibility(),e.updateScreenDepth(n)):d?(e.resetPendingUpdate(4),e.leaf&&(e.setPendingUpdate(1),t=!0)):(e.resetPendingUpdate(1)&&e.updateAgentSuspension(),2===h&&e.updateAgents(0),e.leaf||(e.setPendingUpdate(4),e.resetPendingUpdate(1),t=!0))}this._allTilesDirty=t,this.requestUpdate(),(this._shortBatches||!this._oneBatchPerFrameTask)&&this._updatePendingTileGeometries(),e.madeProgress()}_sortTiles(e){e.done||this._allTilesSorted||!this.view.pointsOfInterest?.focus||(Ne(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger?.update(),e.madeProgress())}_markTileToUpdate(e){ve(e.loaded),e.intersectsClippingArea&&(this._pendingTilesToUpdate.add(e),this._markAllTileNeighborsForUpdate(e))}_hasPendingGeometryWithoutIndices(){for(const e of this._pendingTilesToUpdate)if(e.loaded&&e.intersectsClippingArea&&null==e.renderData?.vao?.indexBuffer)return!0;return!1}_updatePendingTileGeometries(){const e=this._pendingTilesToUpdate,t=[];if(e.forEach(e=>{this._canUpdateTileGeometry(e)&&t.push(e)}),0===t.length)return void e.clear();const i=(i,r)=>{!r||!this._canUpdateTileGeometry(r)||r.level<i.level||e.has(r)||(e.add(r),t.push(r),r.renderData.updateNeighborData())};t.sort(Oe);const r=t.length;for(let s=0;s<r;++s){const r=t[s];ve(r.loaded),ve(r.intersectsClippingArea);const a=r.renderData;if(!a?.geometryState)continue;a.updateNeighborData();const n=a.dirtyEdgeResolutions,l=a.geometryState,o=e=>{const t=je[e];i(r,l.cornerPeerNeighbors[e]?.findCorner(Pe(t),e=>e.loaded))};for(let t=0;t<4;++t)if(n&1<<t){const s=a.geometryState.edgePeerNeighbors[t];s&&s?.level>=r.level&&s.forAllSubtreeOnSide(we(Te[t]),t=>!!this._canUpdateTileGeometry(t)&&(ve(e.has(t)||Oe(r,t)<0),i(r,t),!0)),o((t+1)%4),o(t)}}e.clear(),this._updateTilesGeometries(t),this._shouldEmitChangeEvent=!0,Le&&Re&&this.checkAllTilesWaterproofness()}_mergeAndSplit(e,t){if(this.suspended||e.done||!this._allTilesDirty)return;this._allTilesDirty=!1,this.requestUpdate();let i=!1;const r=this.view.state.fixedContentCamera;let s=!1;for(;!e.done;){s=!0;let a=!1;const n=!this._allTiles.some(s=>{if(!i&&!r&&!s.visible)return e.done;let n=s;if(s.hasPendingUpdate(4)){if(!t||s.unmergableChildCount>0)return e.done;for(s.resetPendingUpdate(4);null!=n.parent&&0===n.parent.unmergableChildCount&&n.parent.resetPendingUpdate(4);)n=n.parent;this._mergeTile(n),a=!0,e.madeProgress()}else if(s.resetPendingUpdate(1)){let t=!0;const i=s.level;if(i>=ce){const e=e=>e.leaf||i-e.level<ce;for(let r=0;r<4;++r){const a=s.findNeighborTile(Te[r],e);null!=a&&i-a.level===ce&&(t=!1,Le&&(ve(a.leaf),ve(a.hasPendingUpdate(1))))}}t?(this._splitTile(s),e.madeProgress(),a=!0):s.setPendingUpdate(1)}return e.done});if(a&&(this._allTilesSorted=!1,this._allTilesDirty=!0,!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries()),n){if(!i){i=!0;continue}if(!a)break}else this._allTilesDirty=!0}s?e.madeProgress():this._allTilesDirty=!0,!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries(),this._allTilesCreated=!this.allTiles.some(e=>e.hasPendingUpdate(1)||e.hasPendingUpdate(4)&&0===e.unmergableChildCount),this._sortTiles(e)}_updateElevation(e){e.done||(this._allTiles.some(t=>(t.resetPendingUpdate(8)&&(this._updateTileGeometryState(t),e.madeProgress()),e.done)),!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries())}_updateElevationSources(e){e.done||this._allTiles.some(t=>(t.needsElevationSourceUpdate()&&(t.updateAgents(0),t.markElevationSourceUpdateRequested(),e.madeProgress()),e.done))}_updateTextures(e){e.done||this._allTiles.some(t=>(this._updateTileTexture(t,e),e.done))}_updateClippingExtent(){this.spatialReference&&(this.updateOverlayParameters(),this.requestRender(1),this.overlayManager.setPlacementDirty(),this._updateRootTiles())}get _lodBias(){return this.view.qualitySettings.tiledSurface.lodBias-(1-this.view.quality)*ge}_getLodBiasCorrectedScale(e){const t=this.tilingScheme.levels,i=o(e-this._lodBias,0,t.length-1),r=i-Math.floor(i);return t[Math.floor(i)].scale*(1-r)+t[Math.ceil(i)].scale*r}_removeAllTiles(){this._pendingTilesToUpdate.clear(),this._pendingTilesForElevationUpdateEvent.clear(),null!=this._rootTiles&&(this._rootTiles.forEach(e=>this._purgeTile(e)),this._setRootTiles(null),this.notifyChange("ready")),this._allTiles.clear(),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles}),this.renderer.visible=!1}_purgeSubtree(e){const t=e.children;t[0]&&(this._purgeTile(t[0]),this._purgeTile(t[1]),this._purgeTile(t[2]),this._purgeTile(t[3]),e.clearChildren())}_purgeTile(e){e.leaf?pt(e):this._purgeSubtree(e),this._allTiles.removeUnordered(e),this._unloadTile(e),e.dispose(),this._tileCache.put(et._tileMemcacheKey,e),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles})}_unloadTile(e){this._pendingTilesToUpdate.delete(e),this._pendingTilesForElevationUpdateEvent.delete(e),e.unload()}_splitTile(e){fe(e.leaf,"Tile that is already split should not be split again!"),fe(e.rendered,"Tile marked to split is not rendered"),pt(e);const t=e.createChildren();this._allTiles.pushArray(t),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles}),e.updateAgentSuspension(),fe(e.rendered,"parent should be rendered"),t.forEach(e=>this._loadTile(e)),t.forEach(e=>this._pendingTilesToUpdate.add(e)),this._unloadTile(e),this._markAllTileNeighborsForUpdate(e),this._emitTileScaleChange(e,e.level+1),this._allTilesDirty=!0,this._shortBatches&&this._updatePendingTileGeometries(),t.forEach(e=>ht(e,e.hasPendingUpdate(1))),++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){lt.spatialReference=this.spatialReference,lt.extent=e.extent,lt.scale=this._getLodBiasCorrectedScale(t),this.emit("scale-change",lt)}createTile(e,t,i,r){fe(!!r,"createTile sanity check");const s=this._acquireTile(e,t,i,r);return s.updateClippingStatus(this.groundExtent),s.updateScreenDepth(this.view.state.contentCamera.viewProjectionMatrix),this._shouldSplit(s)&&s.setPendingUpdate(1),s}get _shortBatches(){return 2!==this.view.state.mode}_mergeTile(e){fe(!e.hasPendingUpdate(1),"_mergeTile sanity check"),fe(!e.leaf,"Cannot merge a leaf"),e.leaf||(this._purgeSubtree(e),fe(!e.renderData,"Merging tile with existing render data?"),this._loadTile(e),this._markTileToUpdate(e),this._emitTileScaleChange(e),this._shortBatches&&this._updatePendingTileGeometries(),ht(e,!1),this._allTilesDirty=!0,++this._performanceInfo.numMerged)}_loadTile(e){e.load(),this.requestUpdate(),this._allTilesDirty=!0,this.overlayManager?.hasOverlays&&e.updateOverlayParameters(this.overlayManager)}_handleLayerViewChanges(e=Ke){if(!this._layerViewsDirty)return;this._layerViewsDirty=!1;let t=!1;const i=new Set;let r=-1;for(let s=this.view.allLayerViews.length-1;s>=0;s--){const e=this.view.allLayerViews.items[s];if(i.add(e.uid),Se(e)||Ce(e))if(this._basemapLayerViewHandles.has(e.uid)&&!Ce(e)){const i=this._layerClassFromLayerView(e),s=this.getLayerIndexByUID(i,e.uid);null!=s&&((s<r||null==r)&&(t=!0),r=s)}else this._registerTiledLayerView(e),e.layer.loaded&&(t=!0)}this._basemapLayerViewHandles.forEach((e,r)=>{i.has(r)||(this._unregisterTiledLayerView(r),t=!0)}),t&&this._updateTiledLayers(),this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._evaluateTransparency(),e.madeProgress()}get _isFullyTransparent(){if(this.view.map?.ground?.opacity>0)return!1;for(const e of this.view.allLayerViews.items)if(be(e)&&!H(e.layer)&&0!==e.fullOpacity)return!1;return!0}_hasCompositeBlendMode(){for(const e of this.view.allLayerViews.items)if((Ee(e)||Ce(e))&&$e(Qe[e.layer.blendMode]))return!0;return!1}_layerClassFromLayerView(e){return xe(e)?0:1}_registerTiledLayerView(e){const t=[];if((Ee(e)||Ce(e))&&t.push(f(()=>e.layer.blendMode,()=>{this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._updateTileTextures(2)})),!Ce(e)){const i=this._layerClassFromLayerView(e);t.push(f(()=>!e.destroyed&&e.suspended,()=>this._updateTiledLayers())),t.push(f(()=>!e.destroyed&&e.fullOpacity,()=>this._updateTileTextures(2)));const{layer:r}=e;"effectiveScaleRange"in r&&t.push(f(()=>!e.destroyed&&r.effectiveScaleRange,()=>this._restartAllAgents(i))),t.push(e.on("data-changed",()=>{const t=this.getLayerIndexByUID(i,e.uid);null!=t&&this._invalidateLayerData(t,i)}))}this._unregisterTiledLayerView(e.uid),this._basemapLayerViewHandles.set(e.uid,t)}_unregisterTiledLayerView(e){const t=this._basemapLayerViewHandles.get(e);if(t){for(const e of t)e.remove();this._basemapLayerViewHandles.delete(e)}}_updateTiledLayers(){if(!this.tilingScheme||this.view.suspended)return;const e=this.view.allLayerViews,t=[[],[]];let i=null;e.forEach(e=>{if(!e.layer||e.suspended||!Se(e)||!e.fullExtent)return;const r=this._layerClassFromLayerView(e);if(1===r){const t=e.displayLevelRange.maxLevel;t!==1/0&&(null===i||t>i)&&(i=t)}t[r].push(e)});for(const r of re){const e=this._layerViews[r],i=t[r];i.reverse();const s=i.length;let a=e.length!==s;const n=new Array(s),l=new Array(e.length);this._layerIndexByUid[r].clear();for(let t=0;t<s;t++){const s=i[t].uid;this._layerIndexByUid[r].set(s,t);const o=e.indexOf(i[t]);n[t]=o,t!==o&&(a=!0),o>-1&&(l[o]=t)}if(a){const e=this._postorderIterator;for(e.reset(this._rootTiles);!e.done;)e.next().modifyLayers(l,n,r);this._layerViews[r]=i,this._restartAllAgents(r),this._updateTilesVisibility(this._rootTiles)}}this.tilingScheme.ensureMaxLod(i)&&(this._viewChangeUpdate(),this.notifyChange("tilingScheme"))}_restartAllAgents(e){const t=this._postorderIterator;for(t.reset(this._rootTiles);!t.done;){const i=t.next();i.restartAgents(e),0===e&&i.computeElevationBounds()}this._updateRootTileElevationRange()}layerViewByIndex(e,t){return this._layerViews[t][e]}numLayers(e){return this._layerViews[e].length}_updateTileTextures(e){this._allTiles.forAll(t=>{t.updateAgents(1),1===e?this.renderer.updateTileTexture(t,16):t.updateRenderData(1,e)}),this._evaluateTransparency()}_invalidateLayerData(e,t){null!=this._rootTiles&&(Fe(this._rootTiles,i=>i.removeLayerAgent(e,t)),Fe(this._rootTiles,i=>{i.invalidateLayerData(e,t),i.restartAgents(t)}))}setTileTreeDirty(e){this._allTilesDirty=!0,e&&(this._allTilesCreated=!1)}requestRender(e=1){this.renderer.setNeedsRender(e)}requestUpdate(){1===++this._pendingUpdates&&(this._hasPendingUpdates=!0)}requestTileData(e,t,i,r){const s=this.layerViewByIndex(t,i),a=s.layer;return!a.tilemapCache||ye(s)?this._requestTileData(e,i,s,r):(++this._asyncWorkItems,a.tilemapCache.fetchAvailability(e.level,e.lij[1],e.lij[2],{...r,timeout:6e3}).catch(t=>{throw g(r),m(t)||this._dataMissing(e,i,s),t}).then(()=>this._frameTask.schedule(()=>this._requestTileData(e,i,s,r),r.signal)).finally(()=>--this._asyncWorkItems))}_requestTileData(e,t,i,r){if(this.destroying)return Promise.resolve();return 0===t?xe(i)?this._requestElevationTileData(e,i,r):Promise.reject():be(i)?this._requestMapTileData(e,i,r):Promise.reject()}_requestElevationTileData(e,t,i){++this._asyncWorkItems;const r=r=>{!_(i)&&r&&(this.setMemoryDirty(),this.requestUpdate(),this._elevationDataArrived(e,t,r))},s=i=>{m(i)||(l.getLogger(this).error(`Tile ${e.lij.toString()} layer 0/${t.uid} error ${i}`),this._dataMissing(e,0,t),this.requestUpdate())};return t.fetchElevationTile(e,{...$,...i}).then(e=>this._frameTask.schedule(()=>r(e)),s).finally(()=>--this._asyncWorkItems)}_elevationDataArrived(e,t,i){const r=this._layerIndexByUid[0].get(t.uid);if(null==r)return void l.getLogger(this).warn("TerrainSurface: received data from unknown layer %d %s",0,e.lij.toString());const s=new ee(e.lij,e.extent,i);e.dataArrived(r,0,s),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:0});const a=[e],n=e.level,o=this._iteratorPool.acquire();for(o.reset(a);!o.done;){const e=o.next();e.findElevationBoundsForLayer(r,n),e.computeElevationBounds()}0===n&&this._updateRootTileElevationRange(),o.remove(),this._updateTilesVisibility(a)}_requestMapTileData(e,t,i){++this._asyncWorkItems;const r=(r,s)=>{Ue(s),_(i)||(console.error(`Tile ${e.lij.toString()} layer 1/${t.uid} error ${r}`),this._dataMissing(e,1,t),this.requestUpdate())},s=e=>t=>r(t,e),a=r=>this._frameTask.schedule(()=>{this.requestUpdate(),_(i)?Ue(r):this._mapTileDataArrived(e,t,r)},i.signal,s(r)).catch(s(r)),n=(e,t=null)=>this._frameTask.schedule(()=>r(e,t));return t.fetchTile(e.lij,i).then(a,n).finally(()=>--this._asyncWorkItems)}_mapTileDataArrived(e,t,i){const r=this.getLayerIndexByUID(1,t.uid);if(null==r)return Ue(i),void l.getLogger(this).warn("TerrainSurface: received data from unknown layer");e.dataArrived(r,1,i),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:1})}_dataMissing(e,t,i){const r=this.getLayerIndexByUID(t,i.uid);null!=r?(e.dataMissing(r,t),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:t})):l.getLogger(this).warn("TerrainSurface: received data from unknown layer")}get performanceInfo(){const e=this._performanceInfo;return e.numNodes=this._allTiles.length,e.numLeaves=e.numVisible=e.numRendered=e.numLoadedPerLevel.length=e.numRenderedPerLevel.length=0,this._allTiles.forAll(t=>{t.leaf&&e.numLeaves++;const i=t.level;t.renderData&&(e.numLoadedPerLevel[i]=(e.numLoadedPerLevel[i]||0)+1),t.visible&&(e.numVisible++,t.rendered&&(e.numRenderedPerLevel[i]=(e.numRenderedPerLevel[i]||0)+1,e.numRendered++))}),e}setMemoryDirty(){this._usedMemory=null}get usedMemory(){return this.tilingScheme?(null==this._usedMemory&&(this._usedMemory=this._recalculateUsedMemory()),this._usedMemory??0):0}_recalculateUsedMemory(){return this.tilingScheme?Math.round(this._allTiles.reduce((e,t)=>e+t.usedMemory,0)):null}getUsedMemoryForLayerView(e){let t=0;const i=this._layerClassFromLayerView(e),r=this.getLayerIndexByUID(i,e.uid);return null!=r&&this._allTiles.forAll(e=>t+=e.getUsedMemoryForLayer(i,r)),t}get renderPatchBorders(){return this._renderer.renderPatchBorders}set renderPatchBorders(e){this._renderer.renderPatchBorders=e}get renderingDisabled(){return this._renderer.renderingDisabled}set renderingDisabled(e){this._renderer.renderingDisabled=e}get test(){}checkAllTilesWaterproofness(){if(!Re)return;const e=this._rootTiles;if(null==e)return;const t=e=>e?.renderData?.geometry?.indices?.length>0,i=(e,i)=>{t(e)&&console.error("Tile[",e.lij,"] has geometry although parent[",i.lij,"] has geom")},r=e=>{if(e.intersectsClippingArea)if(e.renderData&&!e.renderData.geometryState&&console.error("Tile[",e.lij,"] has renderData but not geometryState"),e.renderData&&!e.renderData.geometry&&console.error("Tile[",e.lij,"] has renderData but not geometryInfo"),!e.renderData?.geometry||(e.renderData.geometry.indices?.length??0)>0||console.error("Tile[",e.lij,"] has renderData but no indices - geometryInfo: ",e.renderData.geometry),t(e)){e.checkGeometryWaterproofness();for(const t of e.children)i(t,e)}else if(e.leaf)console.error("Tile[",e.lij,"] has no geometry and no children, from root to leaf");else for(const t of e.children)r(t)},s=e=>{const t=e.parent?.visible??!0,i=e.visible;e.computeVisibility();const r=e.visible;if(i!==r&&t&&console.error(" Tile[",e.lij,"] has out of date visibility: ",i," instead of ",r),!e.leaf)for(const a of e.children)s(a)};for(const a of e)r(a),s(a)}get isGlobal(){return this._isGlobal}get isGeographic(){return this._isGeographic}get isWebMercator(){return this._isWebMercator}get isWebMercatorOnPlateCarree(){return this._isWebMercatorOnPlateCarree}isEastEndWrap(e){return this._isGlobal&&e[2]===this.lijEastEnd(e[0])-1}isWestEndWrap(e){return this._isGlobal&&0===e[2]}lijEastEnd(e){return 1<<e+(this._isGeographic?1:0)}wrapEastWest(e){const t=this.lijEastEnd(e[0]),i=e[2];if(0<=i&&i<t)return e;if(!this._isGlobal)return null;const r=(i+(i<0?t:0))%t;return[e[0],e[1],r]}enableInternalChecks(e){Me(e)}enableWaterproofnessChecks(e){De(e)}static cleanupTerrainSurface(){nt.prune()}enable(e){e!==this.enabled&&(this._set("enabled",e),e?(this._updateRootTiles(),this.suspended=!1,this.view.elevationProvider.register(0,this)):(this.view.elevationProvider.unregister(this),this.suspended=!0,this._removeAllTiles(),this._setRootTiles(null)),this.notifyChange("ready"))}updateOverlayParameters(){const{overlayManager:e}=this;this.allTiles.forAll(t=>t.updateOverlayParameters(e))}};e([S()],tt.prototype,"_renderer",void 0),e([S({constructOnly:!0})],tt.prototype,"_scaleRangeQueries",void 0),e([S({constructOnly:!0})],tt.prototype,"view",void 0),e([S({constructOnly:!0})],tt.prototype,"overlayManager",void 0),e([S({constructOnly:!0})],tt.prototype,"terrainTextureCompressionTracker",void 0),e([S()],tt.prototype,"_hasPendingUpdates",void 0),e([S()],tt.prototype,"_asyncWorkItems",void 0),e([S()],tt.prototype,"_allTilesDirty",void 0),e([S()],tt.prototype,"_allTilesSorted",void 0),e([S()],tt.prototype,"allTilesCreated",null),e([S()],tt.prototype,"_allTilesCreated",void 0),e([S()],tt.prototype,"_viewChanged",void 0),e([S({type:Number})],tt.prototype,"heading",void 0),e([S()],tt.prototype,"_splitLimits",void 0),e([S()],tt.prototype,"_frameTask",void 0),e([S()],tt.prototype,"demResolution",null),e([S({readOnly:!0})],tt.prototype,"snapLevel",null),e([S({readOnly:!0})],tt.prototype,"lodSnappingEnabled",null),e([S({readOnly:!0})],tt.prototype,"userClippingExtent",null),e([S()],tt.prototype,"_rootTilesExtent",void 0),e([S({readOnly:!0})],tt.prototype,"groundExtent",null),e([S({readOnly:!0})],tt.prototype,"fullGroundExtent",null),e([S({readOnly:!0})],tt.prototype,"_tilingSchemeExtent",null),e([S({readOnly:!0})],tt.prototype,"updating",null),e([S({readOnly:!0})],tt.prototype,"readyToRun",null),e([S(J)],tt.prototype,"updatingProgress",void 0),e([S({readOnly:!0})],tt.prototype,"updatingProgressValue",null),e([S()],tt.prototype,"_maxNumUpdating",void 0),e([S()],tt.prototype,"baseOpacity",null),e([S()],tt.prototype,"hasCompositeBlendMode",void 0),e([S({readOnly:!0})],tt.prototype,"viewingMode",null),e([S()],tt.prototype,"maxTextureScale",void 0),e([S({readOnly:!0})],tt.prototype,"ready",null),e([S({readOnly:!0})],tt.prototype,"rootTiles",null),e([S()],tt.prototype,"_rootTiles",void 0),e([S({readOnly:!0})],tt.prototype,"spatialReference",null),e([S({type:t})],tt.prototype,"backgroundColor",null),e([S({value:!1})],tt.prototype,"slicePlaneEnabled",null),e([S({readOnly:!0})],tt.prototype,"tilingScheme",void 0),e([S({readOnly:!0})],tt.prototype,"tilingSchemeLocked",null),e([S({readOnly:!0})],tt.prototype,"tilingSchemeLogic",void 0),e([S()],tt.prototype,"wireframe",null),e([S()],tt.prototype,"opaque",null),e([S()],tt.prototype,"invisible",null),e([S({value:!1})],tt.prototype,"suspended",null),e([S()],tt.prototype,"fadeDuration",null),e([S()],tt.prototype,"_xNormalizer",null),e([S()],tt.prototype,"visibleElevationRange",void 0),e([S()],tt.prototype,"_rootTileElevationRange",void 0),e([S()],tt.prototype,"_layerViewsDirty",void 0),e([S()],tt.prototype,"renderPatchBorders",null),e([S()],tt.prototype,"renderingDisabled",null),e([S({readOnly:!0})],tt.prototype,"enabled",void 0),tt=et=e([C("esri.views.3d.terrain.TerrainSurface")],tt);const it=tt,rt=U(),st=new F,at=V(),nt=new c,lt={spatialReference:null,extent:null,scale:0};function ot(e,t,i){for(const r of e){if(!r.containsPointXY(t,i))continue;let e=r;for(;e&&!e.renderData;){const r=(t>e.extentMidX?1:0)+(i<e.extentMidY?2:0);e=e.children[r]}const s=e?.renderData?.geometryState.samplerData??null;return te(t,i,s)}return null}function ht(e,t){!e.leaf||e.level<ce||ct(e,e=>{t&&dt(e);const i=ut(e);if(e.maxLevelDeltaNeighborCount++,i){let t=e.parent;for(;t;){const e=ut(t);if(t.unmergableChildCount++,!e)break;t=t.parent}}})}function dt(e){if(e.hasPendingUpdate(1))return;let t=e.parent;for(;t?.resetPendingUpdate(4);)t=t.parent;e.resetPendingUpdate(4),e.leaf&&e.setPendingUpdate(1),e.level<ce||ct(e,e=>{dt(e)})}function pt(e){e.level<ce||ct(e,e=>{if(e.maxLevelDeltaNeighborCount--,0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount){let t=e.parent;for(;t&&(t.unmergableChildCount--,ut(t));)t=t.parent}})}function ut(e){return 0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount}function ct(e,t){if(e.level<ce)return;const i=e.level-ce,r=e.lij[1]>>ce,s=e.lij[2]>>ce,a=e=>e.leaf||e.level===i;for(let n=0;n<4;++n){const l=e.findNeighborTile(Te[n],a);if(!l||l.level!==i)continue;const o=l.lij;o[1]===r&&o[2]===s||t(l)}}export{it as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import i from"../../../core/Accessor.js";import e from"../../../core/Logger.js";import{lerp as r}from"../../../core/mathUtils.js";import{createScreenPointArray as s,createRenderScreenPointArray3 as o}from"../../../core/screenUtils.js";import{property as n,subclass as h}from"../../../core/accessorSupport/decorators.js";import{copy as a,invertOrIdentity as p,multiply as u,invert as l,transpose as _,frustum as v,exactEquals as c,lookAt as w}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as d}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as y,exactEquals as g}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as m}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{subtract as f,set as x,distance as M,copy as D,exactEquals as j,sub as R,dot as P,sqrLen as V,sqrDist as F,scale as C,length as b,cross as S,normalize as T,direction as I}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as E,UNIT_Z as A}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{scale as O,equals as U,exactEquals as H,copy as z,squaredDistance as W,transformMat4 as q}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as Y,create as k}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as L,copy as X,fromMatrix as G}from"../../../geometry/support/frustum.js";import{create as N}from"../../../geometry/support/ray.js";import{projectPointSignedLength as B}from"../../../geometry/support/vector.js";import{viewAngle as J}from"../state/utils/viewUtils.js";import{fovd2fovx as K,fovx2fovd as Q,fovd2fovy as Z,fovy2fovd as $}from"../webgl-engine/lib/fov.js";var tt;let it=tt=class extends i{constructor(t){super(t),this._ray=N(),this._viewport=Y(0,0,1,1),this._padding=Y(0,0,0,0),this._fov=55/180*Math.PI,this._nearFar=m(1,1e3),this._viewDirty=!0,this._viewMatrix=d(),this._viewProjectionDirty=!0,this._viewProjectionMatrix=d(),this._viewInverseTransposeMatrixDirty=!0,this._viewInverseTransposeMatrix=d(),this._frustumDirty=!0,this._frustum=L(),this._fullViewport=k(),this._pixelRatio=1,this.row=0,this.column=0,this._rows=1,this._columns=1,this._center=E(),this._up=E(),this.relativeElevation=0}get pixelRatio(){return this._pixelRatio}set pixelRatio(t){this._pixelRatio=t>0?t:1}get rows(){return this._rows}set rows(t){this._rows=Math.max(1,t)}get columns(){return this._columns}set columns(t){this._columns=Math.max(1,t)}get eye(){return this._ray.origin}set eye(t){this._compareAndSetView(t,this._ray.origin,"eye")}get center(){return this._center}set center(t){this._compareAndSetView(t,this._center,"_center")}get ray(){return f(this._ray.direction,this.center,this.eye),this._ray}get up(){return this._up}set up(t){this._compareAndSetView(t,this._up,"_up")}get viewMatrix(){return this._ensureViewClean(),this._viewMatrix}set viewMatrix(t){a(this._viewMatrix,t),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0}get inverseViewMatrix(){return p(d(),this.viewMatrix)||this._get("inverseViewMatrix")||d()}get viewForward(){return this._ensureViewClean(),x(E(),-this._viewMatrix[2],-this._viewMatrix[6],-this._viewMatrix[10])}get viewUp(){return this._ensureViewClean(),x(E(),this._viewMatrix[1],this._viewMatrix[5],this._viewMatrix[9])}get viewRight(){return this._ensureViewClean(),x(E(),this._viewMatrix[0],this._viewMatrix[4],this._viewMatrix[8])}get nearFar(){return this._nearFar}get near(){return this._nearFar[0]}set near(t){this._nearFar[0]!==t&&(this._nearFar[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get far(){return this._nearFar[1]}set far(t){this._nearFar[1]!==t&&(this._nearFar[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get viewport(){return this._viewport}set viewport(t){this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3]}get screenViewport(){if(1===this.pixelRatio)return this._viewport;const t=O(k(),this._viewport,1/this.pixelRatio),i=this._get("screenViewport");return i&&U(t,i)?i:t}get screenPadding(){if(1===this.pixelRatio)return this._padding;const t=O(k(),this._padding,1/this.pixelRatio),i=this._get("screenPadding");return i&&U(t,i)?i:t}get x(){return this._viewport[0]}set x(t){t+=this._padding[3],this._viewport[0]!==t&&(this._viewport[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get y(){return this._viewport[1]}set y(t){t+=this._padding[2],this._viewport[1]!==t&&(this._viewport[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get width(){return this._viewport[2]}set width(t){this._viewport[2]!==t&&(this._viewport[2]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get height(){return this._viewport[3]}set height(t){this._viewport[3]!==t&&(this._viewport[3]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get fullWidth(){return this._viewport[2]+this._padding[1]+this._padding[3]}set fullWidth(t){this.width=t-(this._padding[1]+this._padding[3])}get fullHeight(){return this._viewport[3]+this._padding[0]+this._padding[2]}set fullHeight(t){this.height=t-(this._padding[0]+this._padding[2])}get fullViewport(){return this._fullViewport[0]=this._viewport[0]-this._padding[3],this._fullViewport[1]=this._viewport[1]-this._padding[2],this._fullViewport[2]=this.fullWidth,this._fullViewport[3]=this.fullHeight,this._fullViewport}get _aspect(){return this.width/this.height}get padding(){return this._padding}set padding(t){H(this._padding,t)||(this._viewport[0]+=t[3]-this._padding[3],this._viewport[1]+=t[2]-this._padding[2],this._viewport[2]-=t[1]+t[3]-(this._padding[1]+this._padding[3]),this._viewport[3]-=t[0]+t[2]-(this._padding[0]+this._padding[2]),z(this._padding,t),this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_padding"),this.notifyChange("_viewport"))}get viewProjectionMatrix(){return this._viewProjectionDirty&&(u(this._viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),this._viewProjectionDirty=!1),this._viewProjectionMatrix}get projectionMatrix(){return this._projectionMatrixInternal}get inverseProjectionMatrix(){return l(d(),this.projectionMatrix)||this._get("inverseProjectionMatrix")||d()}get fov(){return this._fov}set fov(t){this._fov=t,this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovX(){return K(this._fov,this.width,this.height)}set fovX(t){this._fov=Q(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovY(){return Z(this._fov,this.width,this.height)}set fovY(t){this._fov=$(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get distance(){return M(this.center,this.eye)}get frustum(){return this._recomputeFrustum(),this._frustum}get viewInverseTransposeMatrix(){return(this._viewInverseTransposeMatrixDirty||this._viewDirty)&&(l(this._viewInverseTransposeMatrix,this.viewMatrix),_(this._viewInverseTransposeMatrix,this._viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this._viewInverseTransposeMatrix}depthNDCToWorld(t){const{near:i,far:e}=this;return 2*i*e/(e+i-t*(e-i))}get perRenderPixelRatio(){return Math.tan(this.fovX/2)/(this.width/2)}get perScreenPixelRatio(){return this.perRenderPixelRatio*this.pixelRatio}get aboveGround(){return null!=this.relativeElevation&&this.relativeElevation>=0}get _projectionMatrixInternal(){const t=this.width,i=this.height,e=this.near*Math.tan(this.fovY/2)*2,r=e*this._aspect,s=e/this.rows,o=r/this.columns,n=-r/2+this.column*o,h=n+o,a=-e/2+this.row*s,p=a+s,u=v(d(),n*(1+2*this._padding[3]/t),h*(1+2*this._padding[1]/t),a*(1+2*this._padding[2]/i),p*(1+2*this._padding[0]/i),this.near,this.far),l=this._get("projectionMatrix");return l&&c(l,u)?l:u}copyFrom(t){D(this._ray.origin,t.eye),this.center=t.center,this.up=t.up,z(this._viewport,t.viewport),this.notifyChange("_viewport"),z(this._padding,t.padding),this.notifyChange("_padding"),y(this._nearFar,t.nearFar),this.notifyChange("_nearFar"),this._fov=t.fov,this.row=t.row,this.column=t.column,this.rows=t.rows,this.columns=t.columns,this.relativeElevation=t.relativeElevation;const i=t;return this._viewDirty=i._viewDirty,this._viewDirty||(a(this._viewMatrix,t.viewMatrix),this.notifyChange("_viewMatrix")),this._viewProjectionDirty=!0,this._frustumDirty=i._frustumDirty,this._frustumDirty||(X(this._frustum,t.frustum),this._frustumDirty=!1),i._viewInverseTransposeMatrixDirty?this._viewInverseTransposeMatrixDirty=!0:(a(this._viewInverseTransposeMatrix,t.viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),z(this._fullViewport,t.fullViewport),this.pixelRatio=t.pixelRatio,this}copyViewFrom(t){this.eye=t.eye,this.center=t.center,this.up=t.up,this.fov=t.fov}clone(){return(new tt).copyFrom(this)}equals(t){return j(this.eye,t.eye)&&j(this.center,t.center)&&j(this.up,t.up)&&H(this._viewport,t.viewport)&&H(this._padding,t.padding)&&g(this.nearFar,t.nearFar)&&this._fov===t.fov&&this.pixelRatio===t.pixelRatio&&this.relativeElevation===t.relativeElevation&&this.row===t.row&&this.column===t.column&&this.rows===t.rows&&this.columns===t.columns}equalsView(t){return j(this.eye,t.eye)&&j(this.center,t.center)&&j(this.up,t.up)&&this._fov===t.fov}almostEquals(t){const i=Math.max(1,1/this.pixelRatio,1/t.pixelRatio);if(Math.abs(t.fov-this._fov)>=.001||W(t.screenPadding,this.screenPadding)>=i||W(this.screenViewport,t.screenViewport)>=i||this.row!==t.row||this.column!==t.column||this.rows!==t.rows||this.columns!==t.columns)return!1;R(ot,t.eye,t.center),R(nt,this.eye,this.center);const e=P(ot,nt),r=V(ot),s=V(nt),o=5e-4;return e*e>=(1-1e-10)*r*s&&F(t.eye,this.eye)<Math.max(r,s)*o*o}computeRenderPixelSizeAt(t){return this.computeRenderPixelSizeAtDist(this._viewDirectionDistance(t))}computeRenderPixelSizeAtDist(t){return t*this.perRenderPixelRatio}computeScreenPixelSizeAt(t){return this.computeScreenPixelSizeAtDist(this._viewDirectionDistance(t))}_viewDirectionDistance(t){return Math.abs(B(this.viewForward,f(ot,t,this.eye)))}computeScreenPixelSizeAtDist(t){return t*this.perScreenPixelRatio}computeDistanceFromRadius(t,i){return t/Math.tan(Math.min(this.fovX,this.fovY)/(2*(i||1)))}getScreenCenter(t=s()){return t[0]=(this.padding[3]+this.width/2)/this.pixelRatio,t[1]=(this.padding[0]+this.height/2)/this.pixelRatio,t}getRenderCenter(t,i=.5,e=.5){return t[0]=this.padding[3]+this.width*i,t[1]=this.padding[2]+this.height*e,t[2]=.5,t}setGLViewport(t){const i=this.viewport,e=this.padding;t.setViewport(i[0]-e[3],i[1]-e[2],i[2]+e[1]+e[3],i[3]+e[0]+e[2])}applyProjection(t,i){t!==rt&&D(rt,t),rt[3]=1,q(rt,rt,this.projectionMatrix);const e=Math.abs(rt[3]);C(rt,rt,1/e);const s=this.fullViewport;i[0]=r(0,s[0]+s[2],.5+.5*rt[0]),i[1]=r(0,s[1]+s[3],.5+.5*rt[1]),i[2]=.5*(rt[2]+1),i[3]=e}unapplyProjection(t,i){const e=this.fullViewport;rt[0]=(t[0]/(e[0]+e[2])*2-1)*t[3],rt[1]=(t[1]/(e[1]+e[3])*2-1)*t[3],rt[2]=(2*t[2]-1)*t[3],rt[3]=t[3],null!=this.inverseProjectionMatrix&&(q(rt,rt,this.inverseProjectionMatrix),i[0]=rt[0],i[1]=rt[1],i[2]=rt[2])}projectToScreen(t,i){return null==this.projectToRenderScreen(t,ht)?null:(this.renderToScreen(ht,i),i)}projectToRenderScreen(t,i){if(rt[0]=t[0],rt[1]=t[1],rt[2]=t[2],rt[3]=1,q(rt,rt,this.viewProjectionMatrix),0===rt[3])return null;const e=rt;C(e,e,1/Math.abs(rt[3]));const s=this.fullViewport,o=r(0,s[0]+s[2],.5+.5*e[0]),n=r(0,s[1]+s[3],.5+.5*e[1]);return"x"in i?(i.x=o,i.y=n):(i[0]=o,i[1]=n,i.length>2&&(i[2]=.5*(e[2]+1))),i}unprojectFromScreen(t,i){return this.unprojectFromRenderScreen(this.screenToRender(t,ht),i)}unprojectFromRenderScreen(t,i){if(u(st,this.projectionMatrix,this.viewMatrix),!l(st,st))return null;const e=this.fullViewport;return rt[0]=2*(t[0]-e[0])/e[2]-1,rt[1]=2*(t[1]-e[1])/e[3]-1,rt[2]=2*t[2]-1,rt[3]=1,q(rt,rt,st),0===rt[3]?null:(i[0]=rt[0]/rt[3],i[1]=rt[1]/rt[3],i[2]=rt[2]/rt[3],i)}constrainWindowSize(t,i,e,r){const s=t*this.pixelRatio,o=i*this.pixelRatio,n=Math.max(s-e/2,0),h=Math.max(this.fullHeight-o-r/2,0),a=-Math.min(s-e/2,0),p=-Math.min(this.fullHeight-o-r/2,0),u=e-a- -Math.min(this.fullWidth-s-e/2,0),l=r-p- -Math.min(o-r/2,0);return[Math.round(n),Math.round(h),Math.round(u),Math.round(l)]}computeUp(t){1===t?this._computeUpGlobal():this._computeUpLocal()}screenToRender(t,i){const e=t[0]*this.pixelRatio,r=this.fullHeight-t[1]*this.pixelRatio;return i[0]=e,i[1]=r,i}renderToScreen(t,i){const e=t[0]/this.pixelRatio,r=(this.fullHeight-t[1])/this.pixelRatio;i[0]=e,i[1]=r}sphereFrustumCoverage(t,i){const{center:e,eye:r,distance:s,fovY:o}=this,n=Math.abs(Math.PI/2-J(i,e,r));return t.frustumCoverage(n,s,o)}_computeUpGlobal(){f(ot,this.center,this.eye);const t=b(this.center);t<1?j(this._up,A)&&(D(this._up,A),this._markViewDirty(),this.notifyChange("_up")):Math.abs(P(ot,this.center))>.9999*b(ot)*t||(S(nt,ot,this.center),S(nt,nt,ot),T(nt,nt),j(this._up,nt)||(D(this._up,nt),this.notifyChange("_up"),this._markViewDirty()))}_computeUpLocal(){I(ot,this.eye,this.center),Math.abs(ot[2])<=.9999&&(C(ot,ot,ot[2]),x(ot,-ot[0],-ot[1],1-ot[2]),T(ot,ot),j(this._up,ot)||(D(this._up,ot),this.notifyChange("_up"),this._markViewDirty()))}_compareAndSetView(t,i,r){"number"==typeof t[0]&&isFinite(t[0])&&"number"==typeof t[1]&&isFinite(t[1])&&"number"==typeof t[2]&&isFinite(t[2])?j(t,i)||(D(i,t),this._markViewDirty(),this.notifyChange(r)):e.getLogger("esri.views.3d.webgl-engine.lib.RenderCamera").warn("RenderCamera vector contains invalid number, ignoring value")}_markViewDirty(){this._viewDirty=!0,this._frustumDirty=!0,this._viewProjectionDirty=!0}_recomputeFrustum(){this._frustumDirty&&(G(this.viewMatrix,this.projectionMatrix,this._frustum),this._frustumDirty=!1)}_ensureViewClean(){this._viewDirty&&(w(this._viewMatrix,this.eye,this.center,this.up),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0)}};t([n()],it.prototype,"_viewport",void 0),t([n()],it.prototype,"_padding",void 0),t([n()],it.prototype,"_fov",void 0),t([n()],it.prototype,"_nearFar",void 0),t([n()],it.prototype,"_viewDirty",void 0),t([n()],it.prototype,"_viewMatrix",void 0),t([n()],it.prototype,"_pixelRatio",void 0),t([n()],it.prototype,"pixelRatio",null),t([n()],it.prototype,"row",void 0),t([n()],it.prototype,"column",void 0),t([n()],it.prototype,"_rows",void 0),t([n()],it.prototype,"rows",null),t([n()],it.prototype,"_columns",void 0),t([n()],it.prototype,"columns",null),t([n()],it.prototype,"eye",null),t([n()],it.prototype,"center",null),t([n()],it.prototype,"_center",void 0),t([n()],it.prototype,"up",null),t([n()],it.prototype,"_up",void 0),t([n()],it.prototype,"viewMatrix",null),t([n({readOnly:!0})],it.prototype,"inverseViewMatrix",null),t([n({readOnly:!0})],it.prototype,"viewForward",null),t([n({readOnly:!0})],it.prototype,"viewUp",null),t([n({readOnly:!0})],it.prototype,"viewRight",null),t([n({readOnly:!0})],it.prototype,"nearFar",null),t([n()],it.prototype,"near",null),t([n()],it.prototype,"far",null),t([n()],it.prototype,"viewport",null),t([n({readOnly:!0})],it.prototype,"screenViewport",null),t([n({readOnly:!0})],it.prototype,"screenPadding",null),t([n()],it.prototype,"x",null),t([n()],it.prototype,"y",null),t([n()],it.prototype,"width",null),t([n()],it.prototype,"height",null),t([n()],it.prototype,"fullWidth",null),t([n()],it.prototype,"fullHeight",null),t([n({readOnly:!0})],it.prototype,"_aspect",null),t([n()],it.prototype,"padding",null),t([n({readOnly:!0})],it.prototype,"projectionMatrix",null),t([n({readOnly:!0})],it.prototype,"inverseProjectionMatrix",null),t([n()],it.prototype,"fov",null),t([n()],it.prototype,"fovX",null),t([n()],it.prototype,"fovY",null),t([n()],it.prototype,"viewInverseTransposeMatrix",null),t([n({readOnly:!0})],it.prototype,"_projectionMatrixInternal",null),t([n()],it.prototype,"relativeElevation",void 0),it=tt=t([h("esri.views.3d.webgl.RenderCamera")],it);const et=it,rt=k(),st=d(),ot=E(),nt=E(),ht=o();export{et as default};
2
+ import{__decorate as t}from"tslib";import i from"../../../core/Accessor.js";import e from"../../../core/Logger.js";import{lerp as r}from"../../../core/mathUtils.js";import{createScreenPointArray as s,createRenderScreenPointArray3 as o}from"../../../core/screenUtils.js";import{property as n,subclass as h}from"../../../core/accessorSupport/decorators.js";import{copy as a,invertOrIdentity as p,multiply as u,invert as l,transpose as _,frustum as v,exactEquals as c,lookAt as w}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as y}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as d,exactEquals as g}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as m}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{subtract as f,set as x,distance as M,copy as D,exactEquals as j,sub as R,dot as V,sqrLen as P,sqrDist as F,scale as C,length as b,cross as S,normalize as T,direction as I}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as E,UNIT_Z as A}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{scale as O,equals as U,exactEquals as z,copy as H,squaredDistance as q,transformMat4 as W}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as Y,create as k}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as L,copy as X,fromMatrix as G}from"../../../geometry/support/frustum.js";import{create as N}from"../../../geometry/support/ray.js";import{projectPointSignedLength as B}from"../../../geometry/support/vector.js";import{viewAngle as J}from"../state/utils/viewUtils.js";import{fovd2fovx as K,fovx2fovd as Q,fovd2fovy as Z,fovy2fovd as $}from"../webgl-engine/lib/fov.js";var tt;let it=tt=class extends i{constructor(t){super(t),this._ray=N(),this._viewport=Y(0,0,1,1),this._padding=Y(0,0,0,0),this._fov=55/180*Math.PI,this._nearFar=m(1,1e3),this._viewDirty=!0,this._viewMatrix=y(),this._viewProjectionDirty=!0,this._viewProjectionMatrix=y(),this._viewInverseTransposeMatrixDirty=!0,this._viewInverseTransposeMatrix=y(),this._frustumDirty=!0,this._frustum=L(),this._fullViewport=k(),this._fullViewportDirty=!0,this._pixelRatio=1,this.row=0,this.column=0,this._rows=1,this._columns=1,this._center=E(),this._up=E(),this.relativeElevation=0}get pixelRatio(){return this._pixelRatio}set pixelRatio(t){this._pixelRatio=t>0?t:1}get rows(){return this._rows}set rows(t){this._rows=Math.max(1,t)}get columns(){return this._columns}set columns(t){this._columns=Math.max(1,t)}get eye(){return this._ray.origin}set eye(t){this._compareAndSetView(t,this._ray.origin,"eye")}get center(){return this._center}set center(t){this._compareAndSetView(t,this._center,"_center")}get ray(){return f(this._ray.direction,this.center,this.eye),this._ray}get up(){return this._up}set up(t){this._compareAndSetView(t,this._up,"_up")}get viewMatrix(){return this._ensureViewClean(),this._viewMatrix}set viewMatrix(t){a(this._viewMatrix,t),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0}get inverseViewMatrix(){return p(y(),this.viewMatrix)||this._get("inverseViewMatrix")||y()}get viewForward(){return this._ensureViewClean(),x(E(),-this._viewMatrix[2],-this._viewMatrix[6],-this._viewMatrix[10])}get viewUp(){return this._ensureViewClean(),x(E(),this._viewMatrix[1],this._viewMatrix[5],this._viewMatrix[9])}get viewRight(){return this._ensureViewClean(),x(E(),this._viewMatrix[0],this._viewMatrix[4],this._viewMatrix[8])}get nearFar(){return this._nearFar}get near(){return this._nearFar[0]}set near(t){this._nearFar[0]!==t&&(this._nearFar[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get far(){return this._nearFar[1]}set far(t){this._nearFar[1]!==t&&(this._nearFar[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get viewport(){return this._viewport}set viewport(t){this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3]}get screenViewport(){if(1===this.pixelRatio)return this._viewport;const t=O(k(),this._viewport,1/this.pixelRatio),i=this._get("screenViewport");return i&&U(t,i)?i:t}get screenPadding(){if(1===this.pixelRatio)return this._padding;const t=O(k(),this._padding,1/this.pixelRatio),i=this._get("screenPadding");return i&&U(t,i)?i:t}get x(){return this._viewport[0]}set x(t){t+=this._padding[3],this._viewport[0]!==t&&(this._viewport[0]=t,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get y(){return this._viewport[1]}set y(t){t+=this._padding[2],this._viewport[1]!==t&&(this._viewport[1]=t,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get width(){return this._viewport[2]}set width(t){this._viewport[2]!==t&&(this._viewport[2]=t,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get height(){return this._viewport[3]}set height(t){this._viewport[3]!==t&&(this._viewport[3]=t,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get fullWidth(){return this._viewport[2]+this._padding[1]+this._padding[3]}set fullWidth(t){this.width=t-(this._padding[1]+this._padding[3])}get fullHeight(){return this._viewport[3]+this._padding[0]+this._padding[2]}set fullHeight(t){this.height=t-(this._padding[0]+this._padding[2])}get fullViewport(){return this._fullViewportDirty&&(this._fullViewport[0]=this._viewport[0]-this._padding[3],this._fullViewport[1]=this._viewport[1]-this._padding[2],this._fullViewport[2]=this._viewport[2]+this._padding[1]+this._padding[3],this._fullViewport[3]=this._viewport[3]+this._padding[0]+this._padding[2],this._fullViewportDirty=!1),this._fullViewport}get _aspect(){return this.width/this.height}get padding(){return this._padding}set padding(t){z(this._padding,t)||(this._viewport[0]+=t[3]-this._padding[3],this._viewport[1]+=t[2]-this._padding[2],this._viewport[2]-=t[1]+t[3]-(this._padding[1]+this._padding[3]),this._viewport[3]-=t[0]+t[2]-(this._padding[0]+this._padding[2]),H(this._padding,t),this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_padding"),this.notifyChange("_viewport"))}get viewProjectionMatrix(){return this._viewProjectionDirty&&(u(this._viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),this._viewProjectionDirty=!1),this._viewProjectionMatrix}get projectionMatrix(){return this._projectionMatrixInternal}get inverseProjectionMatrix(){return l(y(),this.projectionMatrix)||this._get("inverseProjectionMatrix")||y()}get fov(){return this._fov}set fov(t){this._fov=t,this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovX(){return K(this._fov,this.width,this.height)}set fovX(t){this._fov=Q(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovY(){return Z(this._fov,this.width,this.height)}set fovY(t){this._fov=$(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get distance(){return M(this.center,this.eye)}get frustum(){return this._recomputeFrustum(),this._frustum}get viewInverseTransposeMatrix(){return(this._viewInverseTransposeMatrixDirty||this._viewDirty)&&(l(this._viewInverseTransposeMatrix,this.viewMatrix),_(this._viewInverseTransposeMatrix,this._viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this._viewInverseTransposeMatrix}depthNDCToWorld(t){const{near:i,far:e}=this;return 2*i*e/(e+i-t*(e-i))}get perRenderPixelRatio(){return Math.tan(this.fovX/2)/(this.width/2)}get perScreenPixelRatio(){return this.perRenderPixelRatio*this.pixelRatio}get aboveGround(){return null!=this.relativeElevation&&this.relativeElevation>=0}get _projectionMatrixInternal(){const t=this.width,i=this.height,e=this.near*Math.tan(this.fovY/2)*2,r=e*this._aspect,s=e/this.rows,o=r/this.columns,n=-r/2+this.column*o,h=n+o,a=-e/2+this.row*s,p=a+s,u=v(y(),n*(1+2*this._padding[3]/t),h*(1+2*this._padding[1]/t),a*(1+2*this._padding[2]/i),p*(1+2*this._padding[0]/i),this.near,this.far),l=this._get("projectionMatrix");return l&&c(l,u)?l:u}copyFrom(t){D(this._ray.origin,t.eye),this.center=t.center,this.up=t.up,H(this._viewport,t.viewport),this.notifyChange("_viewport"),H(this._padding,t.padding),this.notifyChange("_padding"),this._fullViewportDirty=!0,d(this._nearFar,t.nearFar),this.notifyChange("_nearFar"),this._fov=t.fov,this.row=t.row,this.column=t.column,this.rows=t.rows,this.columns=t.columns,this.relativeElevation=t.relativeElevation;const i=t;return this._viewDirty=i._viewDirty,this._viewDirty||(a(this._viewMatrix,t.viewMatrix),this.notifyChange("_viewMatrix")),this._viewProjectionDirty=!0,this._frustumDirty=i._frustumDirty,this._frustumDirty||(X(this._frustum,t.frustum),this._frustumDirty=!1),i._viewInverseTransposeMatrixDirty?this._viewInverseTransposeMatrixDirty=!0:(a(this._viewInverseTransposeMatrix,t.viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this.pixelRatio=t.pixelRatio,this}copyViewFrom(t){this.eye=t.eye,this.center=t.center,this.up=t.up,this.fov=t.fov}clone(){return(new tt).copyFrom(this)}equals(t){return j(this.eye,t.eye)&&j(this.center,t.center)&&j(this.up,t.up)&&z(this._viewport,t.viewport)&&z(this._padding,t.padding)&&g(this.nearFar,t.nearFar)&&this._fov===t.fov&&this.pixelRatio===t.pixelRatio&&this.relativeElevation===t.relativeElevation&&this.row===t.row&&this.column===t.column&&this.rows===t.rows&&this.columns===t.columns}equalsView(t){return j(this.eye,t.eye)&&j(this.center,t.center)&&j(this.up,t.up)&&this._fov===t.fov}almostEquals(t){const i=Math.max(1,1/this.pixelRatio,1/t.pixelRatio);if(Math.abs(t.fov-this._fov)>=.001||q(t.screenPadding,this.screenPadding)>=i||q(this.screenViewport,t.screenViewport)>=i||this.row!==t.row||this.column!==t.column||this.rows!==t.rows||this.columns!==t.columns)return!1;R(ot,t.eye,t.center),R(nt,this.eye,this.center);const e=V(ot,nt),r=P(ot),s=P(nt),o=5e-4;return e*e>=(1-1e-10)*r*s&&F(t.eye,this.eye)<Math.max(r,s)*o*o}computeRenderPixelSizeAt(t){return this.computeRenderPixelSizeAtDist(this._viewDirectionDistance(t))}computeRenderPixelSizeAtDist(t){return t*this.perRenderPixelRatio}computeScreenPixelSizeAt(t){return this.computeScreenPixelSizeAtDist(this._viewDirectionDistance(t))}_viewDirectionDistance(t){return Math.abs(B(this.viewForward,f(ot,t,this.eye)))}computeScreenPixelSizeAtDist(t){return t*this.perScreenPixelRatio}computeDistanceFromRadius(t,i){return t/Math.tan(Math.min(this.fovX,this.fovY)/(2*(i||1)))}getScreenCenter(t=s()){return t[0]=(this.padding[3]+this.width/2)/this.pixelRatio,t[1]=(this.padding[0]+this.height/2)/this.pixelRatio,t}getRenderCenter(t,i=.5,e=.5){return t[0]=this.padding[3]+this.width*i,t[1]=this.padding[2]+this.height*e,t[2]=.5,t}setGLViewport(t){const i=this.viewport,e=this.padding;t.setViewport(i[0]-e[3],i[1]-e[2],i[2]+e[1]+e[3],i[3]+e[0]+e[2])}applyProjection(t,i){t!==rt&&D(rt,t),rt[3]=1,W(rt,rt,this.projectionMatrix);const e=Math.abs(rt[3]);C(rt,rt,1/e);const s=this.fullViewport;i[0]=r(0,s[0]+s[2],.5+.5*rt[0]),i[1]=r(0,s[1]+s[3],.5+.5*rt[1]),i[2]=.5*(rt[2]+1),i[3]=e}unapplyProjection(t,i){const e=this.fullViewport;rt[0]=(t[0]/(e[0]+e[2])*2-1)*t[3],rt[1]=(t[1]/(e[1]+e[3])*2-1)*t[3],rt[2]=(2*t[2]-1)*t[3],rt[3]=t[3],null!=this.inverseProjectionMatrix&&(W(rt,rt,this.inverseProjectionMatrix),i[0]=rt[0],i[1]=rt[1],i[2]=rt[2])}projectToScreen(t,i){return null==this.projectToRenderScreen(t,ht)?null:(this.renderToScreen(ht,i),i)}projectToRenderScreen(t,i){if(rt[0]=t[0],rt[1]=t[1],rt[2]=t[2],rt[3]=1,W(rt,rt,this.viewProjectionMatrix),0===rt[3])return null;const e=rt;C(e,e,1/Math.abs(rt[3]));const s=this.fullViewport,o=r(0,s[0]+s[2],.5+.5*e[0]),n=r(0,s[1]+s[3],.5+.5*e[1]);return"x"in i?(i.x=o,i.y=n):(i[0]=o,i[1]=n,i.length>2&&(i[2]=.5*(e[2]+1))),i}unprojectFromScreen(t,i){return this.unprojectFromRenderScreen(this.screenToRender(t,ht),i)}unprojectFromRenderScreen(t,i){if(u(st,this.projectionMatrix,this.viewMatrix),!l(st,st))return null;const e=this.fullViewport;return rt[0]=2*(t[0]-e[0])/e[2]-1,rt[1]=2*(t[1]-e[1])/e[3]-1,rt[2]=2*t[2]-1,rt[3]=1,W(rt,rt,st),0===rt[3]?null:(i[0]=rt[0]/rt[3],i[1]=rt[1]/rt[3],i[2]=rt[2]/rt[3],i)}constrainWindowSize(t,i,e,r){const s=t*this.pixelRatio,o=i*this.pixelRatio,n=Math.max(s-e/2,0),h=Math.max(this.fullHeight-o-r/2,0),a=-Math.min(s-e/2,0),p=-Math.min(this.fullHeight-o-r/2,0),u=e-a- -Math.min(this.fullWidth-s-e/2,0),l=r-p- -Math.min(o-r/2,0);return[Math.round(n),Math.round(h),Math.round(u),Math.round(l)]}computeUp(t){1===t?this._computeUpGlobal():this._computeUpLocal()}screenToRender(t,i){const e=t[0]*this.pixelRatio,r=this.fullHeight-t[1]*this.pixelRatio;return i[0]=e,i[1]=r,i}renderToScreen(t,i){const e=t[0]/this.pixelRatio,r=(this.fullHeight-t[1])/this.pixelRatio;i[0]=e,i[1]=r}sphereFrustumCoverage(t,i){const{center:e,eye:r,distance:s,fovY:o}=this,n=Math.abs(Math.PI/2-J(i,e,r));return t.frustumCoverage(n,s,o)}_computeUpGlobal(){f(ot,this.center,this.eye);const t=b(this.center);t<1?j(this._up,A)&&(D(this._up,A),this._markViewDirty(),this.notifyChange("_up")):Math.abs(V(ot,this.center))>.9999*b(ot)*t||(S(nt,ot,this.center),S(nt,nt,ot),T(nt,nt),j(this._up,nt)||(D(this._up,nt),this.notifyChange("_up"),this._markViewDirty()))}_computeUpLocal(){I(ot,this.eye,this.center),Math.abs(ot[2])<=.9999&&(C(ot,ot,ot[2]),x(ot,-ot[0],-ot[1],1-ot[2]),T(ot,ot),j(this._up,ot)||(D(this._up,ot),this.notifyChange("_up"),this._markViewDirty()))}_compareAndSetView(t,i,r){"number"==typeof t[0]&&isFinite(t[0])&&"number"==typeof t[1]&&isFinite(t[1])&&"number"==typeof t[2]&&isFinite(t[2])?j(t,i)||(D(i,t),this._markViewDirty(),this.notifyChange(r)):e.getLogger("esri.views.3d.webgl-engine.lib.RenderCamera").warn("RenderCamera vector contains invalid number, ignoring value")}_markViewDirty(){this._viewDirty=!0,this._frustumDirty=!0,this._viewProjectionDirty=!0}_recomputeFrustum(){this._frustumDirty&&(G(this.viewMatrix,this.projectionMatrix,this._frustum),this._frustumDirty=!1)}_ensureViewClean(){this._viewDirty&&(w(this._viewMatrix,this.eye,this.center,this.up),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0)}};t([n()],it.prototype,"_viewport",void 0),t([n()],it.prototype,"_padding",void 0),t([n()],it.prototype,"_fov",void 0),t([n()],it.prototype,"_nearFar",void 0),t([n()],it.prototype,"_viewDirty",void 0),t([n()],it.prototype,"_viewMatrix",void 0),t([n()],it.prototype,"_pixelRatio",void 0),t([n()],it.prototype,"pixelRatio",null),t([n()],it.prototype,"row",void 0),t([n()],it.prototype,"column",void 0),t([n()],it.prototype,"_rows",void 0),t([n()],it.prototype,"rows",null),t([n()],it.prototype,"_columns",void 0),t([n()],it.prototype,"columns",null),t([n()],it.prototype,"eye",null),t([n()],it.prototype,"center",null),t([n()],it.prototype,"_center",void 0),t([n()],it.prototype,"up",null),t([n()],it.prototype,"_up",void 0),t([n()],it.prototype,"viewMatrix",null),t([n({readOnly:!0})],it.prototype,"inverseViewMatrix",null),t([n({readOnly:!0})],it.prototype,"viewForward",null),t([n({readOnly:!0})],it.prototype,"viewUp",null),t([n({readOnly:!0})],it.prototype,"viewRight",null),t([n({readOnly:!0})],it.prototype,"nearFar",null),t([n()],it.prototype,"near",null),t([n()],it.prototype,"far",null),t([n()],it.prototype,"viewport",null),t([n({readOnly:!0})],it.prototype,"screenViewport",null),t([n({readOnly:!0})],it.prototype,"screenPadding",null),t([n()],it.prototype,"x",null),t([n()],it.prototype,"y",null),t([n()],it.prototype,"width",null),t([n()],it.prototype,"height",null),t([n()],it.prototype,"fullWidth",null),t([n()],it.prototype,"fullHeight",null),t([n({readOnly:!0})],it.prototype,"_aspect",null),t([n()],it.prototype,"padding",null),t([n({readOnly:!0})],it.prototype,"projectionMatrix",null),t([n({readOnly:!0})],it.prototype,"inverseProjectionMatrix",null),t([n()],it.prototype,"fov",null),t([n()],it.prototype,"fovX",null),t([n()],it.prototype,"fovY",null),t([n()],it.prototype,"viewInverseTransposeMatrix",null),t([n({readOnly:!0})],it.prototype,"_projectionMatrixInternal",null),t([n()],it.prototype,"relativeElevation",void 0),it=tt=t([h("esri.views.3d.webgl.RenderCamera")],it);const et=it,rt=k(),st=y(),ot=E(),nt=E(),ht=o();export{et as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import"../../../../../core/has.js";import i from"../../../../../core/Logger.js";import n from"../../../../../core/PooledArray.js";import{watch as o,sync as s}from"../../../../../core/reactiveUtils.js";import{isTypedArray as r}from"../../../../../core/typedArrayUtil.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{clone as l}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as h}from"../../../../../geometry/support/aaBoundingBox.js";import{compactIndices as c}from"../../../../../geometry/support/Indices.js";import{d as m}from"../../../../../chunks/vec3.js";import{c as g}from"../../../../../chunks/vec32.js";import{ComponentData as p}from"./ComponentData.js";import{defaultComponentParameters as d,ComponentDrawParametersImplementation as f}from"./ComponentDrawParameters.js";import{ComponentObject as u}from"./ComponentObject.js";import{IntersectionGeometry as b}from"./IntersectionGeometry.js";import{RenderableMeta as _,Renderable as v}from"./Renderable.js";import{RenderGeometry as y}from"./RenderGeometry.js";import{RenderSubmitSystem as O}from"./RenderSubmitSystem.js";import{ComponentMaterialParameters as j}from"./Material/ComponentMaterialInitParameters.js";import{ComponentMaterialRepository as C}from"./Material/ComponentMaterialRepository.js";import{SamplerRepository as M}from"../../lib/SamplerRepository.js";import{VertexArrayObject as w}from"../../lib/VertexArrayObject.js";import{getVerticalOffsetI3S as R}from"../../lib/verticalOffsetUtils.js";import{BufferManager as x}from"../../lib/TextureBackedBuffer/BufferManager.js";import{getComponentDataLayout as D,IndexGlLayout as H}from"../../materials/DefaultLayouts.js";import{BufferObject as A}from"../../../../webgl/BufferObject.js";import{PrimitiveType as I}from"../../../../webgl/enums.js";import{VertexBuffer as E}from"../../../../webgl/VertexBuffer.js";const B=()=>i.getLogger("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection");let P=class extends t{constructor(e,t,i){super({}),this._renderPassManager=e,this._viewingMode=t,this._elevationRangeCacheVerticalOffset=NaN,this._elevationRangeCacheMin=NaN,this._elevationRangeCacheMax=NaN,this._highlightsInOrder=[],this._highlights=null,this._activeHighlightOptions=new Map,this._visible=new n,this._hidden=new n,this._renderSubmit=new O(this),this._renderPassManager.register(this._renderSubmit);const{rctx:r,bind:a}=e;this._componentBufferManager=new x(r,D());const l=2===this._viewingMode?0:i?1:2;this.materials=new C(a,l),this.samplers=new M(r.gl),this.addHandles(o(()=>a.useFloatBlend.value,()=>{this._visible.forAll(e=>e.updateMaterial(this.materials.globals)),this._hidden.forAll(e=>e.updateMaterial(this.materials.globals)),this._requestRender()},s))}destroy(){this._componentBufferManager.destroy(),this._componentBufferManager=null,this._visible.forAll(e=>e.destroy()),this._visible.prune(),this._hidden.forAll(e=>e.destroy()),this._hidden.prune(),this._renderSubmit.destroy(),this.samplers.dispose(),this.materials.destroy()}createObject(e,t){const{geometry:i}=e,n=new p(this._componentBufferManager,c(i.componentOffsets)),o=this._createRenderable(e,t,n),s=new b(this._viewingMode,i.positions,n,e.elevationAlignable),r=new u(this,e.transform,e.obb.clone(),n,o,s);return(r.visible?this._visible:this._hidden).push(r),r}destroyObject(e){const t=e;(t.visible?this._visible:this._hidden).removeUnordered(t),t.destroy(),this._requestRender()}setObjectVisibility(e,t){const i=e;t!==i.visible&&(t?(this._hidden.removeUnordered(i),this._visible.push(i)):(this._visible.removeUnordered(i),this._hidden.push(i)),i.visible=t,this._requestRender())}preSubmit(e){const{camera:t,highlights:i}=e;this._updateHighlightsInOrder(i),this._componentBufferManager.updateTextures(),this.visibleObjects.forAll(e=>e.updateCameraDerivedParameters(t))}getObjectOpacity(e){return e.renderable.drawParameters.opacity}updateObjectOpacity(e,t){const i=e;i.opacity!==t&&(i.updateOpacity(t),this._requestRender())}isSliceplaneEnabled(e){return e.renderable.material.slicePlaneEnabled}setAllComponentVisibilities(e,t){const i=e;i.componentData.visibility.reset(t),i.componentData.markVisibilityDirty(),this._requestRender()}forEachVisibleComponent(e,t){return e.componentData.visibility.forEachComponent(t)}getComponentCount(e){const t=e,{componentData:i}=t,n=i.visibility.componentCount;return{visible:n,invisible:i.count-n}}setComponentData(e,t){e.setComponentData(t,this._viewingMode),this._elevationRangeCacheVerticalOffset=NaN,this._requestRender()}getComponentAabb(e,t,i,n=!1){e.intersectionGeometry.getComponentAabb(t,i);const o=e,s=o.componentData.verticalOffsets;if(n||null==s)return i;const r=s[t];if(2===this._viewingMode||0===r)return i[2]+=r,i[5]+=r,i;const a=R(r);return a.localOrigin=o.transform.position,a.applyToAabb(i)}getComponentObb(e){return e.obb}getObjectTransform(e){return e.transform}getComponentPositions(e,t,i){return e.intersectionGeometry.getComponentPositions(t,i)}_updateHighlightsInOrder(e){if(this._highlights===e)return;const{_highlightsInOrder:t}=this,i=Math.min(e.length,8);let n=t.length!==i;for(let o=0;o<i;++o)if(t[o]!==e[o].name){n=!0;break}if(this._highlights=e,n){t.length=i;for(let n=0;n<i;++n)t[n]=e[n].name;this._syncHighlightedObjectHighlightOrder()}}_syncHighlightedObjectHighlightOrder(){const e=this._highlightsInOrder,t=t=>{t.componentData.componentHighlights.size>0&&t.componentData.setHighlightsInOrder(e)};this._visible.forAll(t),this._hidden.forAll(t)}expandRangeWithComponentObjectElevationRange(e,t,i,n){Number.isNaN(this._elevationRangeCacheVerticalOffset)||this._elevationRangeCacheVerticalOffset!==t||n.expandElevationRangeValues(this._elevationRangeCacheMin,this._elevationRangeCacheMax);const o=e,{componentData:s}=o,r=s.count,{verticalOffsets:a}=s,{intersectionGeometry:l}=o,h=2===this._viewingMode,c=l.getComponentAabbs(),m=V;let g=1/0,p=-1/0;for(let d=0;d<r;d++){const e=6*d,s=a?.[d]??0;let r=1/0,l=-1/0;if(h)r=c[e+2]+s+t,l=c[e+5]+s+t;else{if(m[0]=c[e],m[1]=c[e+1],m[2]=c[e+2],m[3]=c[e+3],m[4]=c[e+4],m[5]=c[e+5],0!==s){const e=R(s);e.localOrigin=o.transform.position,e.applyToAabb(m)}const r=Math.max(Math.abs(m[3]),Math.abs(m[0])),a=Math.max(Math.abs(m[4]),Math.abs(m[1])),l=t+m[5]+i;n.expandElevationRangeValues(t+m[2],Math.sqrt(r*r+a*a+l*l)-i)}n.expandElevationRangeValues(r,l),g=Math.min(g,r),p=Math.max(p,l)}this._elevationRangeCacheVerticalOffset=t,this._elevationRangeCacheMin=g,this._elevationRangeCacheMax=p}intersectRay(e,t,i,n,o,s){const r=e,{transform:a,componentData:l,intersectionGeometry:h}=r;null!=n&&(n.localOrigin=a.position),h.intersectRay(t,i,n,l.verticalOffsets,a,o,s)}intersectScreenPolygon(e,t,i,n,o){const s=e,{transform:r,componentData:a,intersectionGeometry:l}=s;null!=n&&(n.localOrigin=r.position),l.intersectScreenPolygon(t,i,n,a.verticalOffsets,r,o)}addEdges(e,t,i,n,o){const s=e,{indices:r,positions:a}=s.intersectionGeometry,l=s.componentData.offsets;return t.addComponentObject(s,a,r,l,i,n,o)}async extractEdgeInformation(e,t,i){const n=e,o=n.componentData.visibility;if(o.allInvisible()){const{extractComponentsEdgeLocationsLayout:e}=await import("../../lib/edgeRendering/edgeProcessing.js");return{buffer:e.createBuffer(0),origin:[0,0,0]}}const{indices:s,positions:r}=n.intersectionGeometry,a=n.componentData.offsets,{EdgeInputBufferLayout:h}=await import("../../lib/edgeRendering/bufferLayouts.js"),c=h.createBuffer(r.length/3);g(c.position.typedBuffer,r,c.position.typedBufferStride,3),m(c.position,c.position,n.transform.rotationScale),this._setComponentIndices(c.componentIndex,s,a);const p=c.count,d=this._computeVisibilityIndices(s,o,a,p);return{origin:l(n.transform.position),buffer:await t.extractComponentsEdgeLocations({indices:d,indicesLength:d.length,skipDeduplicate:!0,data:c,writerSettings:{reducedPrecision:!1,variants:0}},i)}}_setComponentIndices(e,t,i){let n=0;for(let o=0;o<i.length-1;o++){const s=i[o],r=i[o+1];for(let i=s;i<r;i++){const o=t?t[i]:i;e.set(o,n)}n++}}_computeVisibilityIndices(e,t,i,n){if(e&&t.allVisible())return e;let o=0;t.forEachComponentRange((e,t)=>(o+=i[t]-i[e],!0));const s=r(e)?2===e?.BYTES_PER_ELEMENT||n<=65536?new Uint16Array(o):new Uint32Array(o):new Array(o);let a=0;return t.forEachComponentRange((t,n)=>{const o=i[t],r=i[n];for(let i=o;i<r;i++)s[a++]=e?e[i]:i;return!0}),s}addHighlight(e,t,i){const n=e,o=this._activeHighlightOptions.get(i)??0;this._activeHighlightOptions.set(i,o+1),n.componentData.setHighlightsInOrder(this._highlightsInOrder);n.addHighlight(t,i)&&this._requestRender()}removeHighlight(e,t,i){const n=e.removeHighlight(t,i);"notfound"!==n&&(this._removeActiveHighlight(i),n&&this._requestRender())}_removeActiveHighlight(e,t=1){const i=this._activeHighlightOptions.get(e);if(void 0===i)B().warn(`Removing non-existing highlight "${e}".`);else{const n=i-t;n<0&&B().warn(`Removing non-existing highlight "${e}".`),n<=0?this._activeHighlightOptions.delete(e):this._activeHighlightOptions.set(e,n)}}clearHighlights(e){const t=e,{componentData:i}=t,{componentHighlights:n}=t.componentData;if(n.size>0){for(const e of n)this._removeActiveHighlight(e[0],e[1][i.count]);t.clearHighlights(),this._requestRender()}}hasHighlight(e){return this._activeHighlightOptions.has(e)}getObjectGPUMemoryUsage(e){return e.renderable.meta.gpuMemoryEstimate}get visibleObjects(){return this._visible}_createRenderable(e,t,i){const n=this._renderPassManager.rctx,o=e.geometry,s=o.parameters.layout,{interleavedVertexData:r,indexData:a,vertexCount:l}=o.renderGeometryData,h=new E(n,s,r),c=a?A.createIndex(n,35044,a):null;let m=0;const g=[["geometry",h]];if(!t.isIntegratedMesh){const e=new Uint16Array(l);for(let n=0;n<i.count;n++){const t=i.offsets[n],o=i.offsets[n+1],s=i.materialDataIndices[n];if(null!=a)for(let i=t;i<o;i++){e[a[i]]=s}else for(let i=t;i<o;i++)e[i]=s}const t=new E(n,H,e.buffer);m+=t.usedMemory,g.push(["componentIndices",t])}const p=new w(n,new Map(g),c),u=a?.length??l,b=new y(p,I.TRIANGLES,o.parameters,null!=c,u),O=new j(t),C=this.materials.acquire(O,b.parameters,d),M=new _(h.usedMemory+m+(c?.usedMemory??0)),R=this.samplers.addFromTexture(t.baseColorTexture?.texture),x=new f(e,t,R);return new v(C,x,b,M)}_requestRender(){this._renderPassManager.requestRender()}};P=e([a("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection")],P);const V=h();export{P as ComponentObjectCollection};
2
+ import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import"../../../../../core/has.js";import i from"../../../../../core/Logger.js";import n from"../../../../../core/PooledArray.js";import{watch as o,sync as s}from"../../../../../core/reactiveUtils.js";import{isTypedArray as r}from"../../../../../core/typedArrayUtil.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{clone as l}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as h}from"../../../../../geometry/support/aaBoundingBox.js";import{compactIndices as c}from"../../../../../geometry/support/Indices.js";import{d as m}from"../../../../../chunks/vec3.js";import{c as g}from"../../../../../chunks/vec32.js";import{ComponentData as p}from"./ComponentData.js";import{defaultComponentParameters as d,ComponentDrawParametersImplementation as f}from"./ComponentDrawParameters.js";import{ComponentObject as u}from"./ComponentObject.js";import{IntersectionGeometry as b}from"./IntersectionGeometry.js";import{RenderableMeta as _,Renderable as v}from"./Renderable.js";import{RenderGeometry as y}from"./RenderGeometry.js";import{RenderSubmitSystem as O}from"./RenderSubmitSystem.js";import{ComponentMaterialParameters as j}from"./Material/ComponentMaterialInitParameters.js";import{ComponentMaterialRepository as C}from"./Material/ComponentMaterialRepository.js";import{SamplerRepository as M}from"../../lib/SamplerRepository.js";import{VertexArrayObject as w}from"../../lib/VertexArrayObject.js";import{getVerticalOffsetI3S as R}from"../../lib/verticalOffsetUtils.js";import{BufferManager as x}from"../../lib/TextureBackedBuffer/BufferManager.js";import{getComponentDataLayout as D,IndexGlLayout as H}from"../../materials/DefaultLayouts.js";import{BufferObject as A}from"../../../../webgl/BufferObject.js";import{PrimitiveType as I}from"../../../../webgl/enums.js";import{VertexBuffer as E}from"../../../../webgl/VertexBuffer.js";const B=()=>i.getLogger("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection");let P=class extends t{constructor(e,t,i){super({}),this._renderPassManager=e,this._viewingMode=t,this._elevationRangeCacheVerticalOffset=NaN,this._elevationRangeCacheMin=NaN,this._elevationRangeCacheMax=NaN,this._highlightsInOrder=[],this._highlights=null,this._activeHighlightOptions=new Map,this._visible=new n,this._hidden=new n,this._renderSubmit=new O(this),this._renderPassManager.register(this._renderSubmit);const{rctx:r,bind:a}=e;this._componentBufferManager=new x(r,D());const l=2===this._viewingMode?0:i?1:2;this.materials=new C(a,l),this.samplers=new M(r.gl),this.addHandles(o(()=>a.useFloatBlend.value,()=>{this._visible.forAll(e=>e.updateMaterial(this.materials.globals)),this._hidden.forAll(e=>e.updateMaterial(this.materials.globals)),this._requestRender()},s))}destroy(){this._componentBufferManager.destroy(),this._componentBufferManager=null,this._visible.forAll(e=>e.destroy()),this._visible.prune(),this._hidden.forAll(e=>e.destroy()),this._hidden.prune(),this._renderSubmit.destroy(),this.samplers.dispose(),this.materials.destroy()}createObject(e,t){const{geometry:i}=e,n=new p(this._componentBufferManager,c(i.componentOffsets)),o=this._createRenderable(e,t,n),s=new b(this._viewingMode,i.positions,n,e.elevationAlignable),r=new u(this,e.transform,e.obb.clone(),n,o,s);return(r.visible?this._visible:this._hidden).push(r),r}destroyObject(e){const t=e;(t.visible?this._visible:this._hidden).removeUnordered(t),t.destroy(),this._requestRender()}setObjectVisibility(e,t){const i=e;t!==i.visible&&(t?(this._hidden.removeUnordered(i),this._visible.push(i)):(this._visible.removeUnordered(i),this._hidden.push(i)),i.visible=t,this._requestRender())}preSubmit(e){const{camera:t,highlights:i}=e;this._updateHighlightsInOrder(i),this._componentBufferManager.updateTextures(),this.visibleObjects.forAll(e=>e.updateCameraDerivedParameters(t))}getObjectOpacity(e){return e.renderable.drawParameters.opacity}updateObjectOpacity(e,t){const i=e;i.opacity!==t&&(i.updateOpacity(t),this._requestRender())}isSliceplaneEnabled(e){return e.renderable.material.slicePlaneEnabled}setAllComponentVisibilities(e,t){const i=e;i.componentData.visibility.reset(t),i.componentData.markVisibilityDirty(),this._requestRender()}forEachVisibleComponent(e,t){return e.componentData.visibility.forEachComponent(t)}getComponentCount(e){const t=e,{componentData:i}=t,n=i.visibility.componentCount;return{visible:n,invisible:i.count-n}}setComponentData(e,t){e.setComponentData(t,this._viewingMode),this._elevationRangeCacheVerticalOffset=NaN,this._requestRender()}getComponentAabb(e,t,i,n=!1){e.intersectionGeometry.getComponentAabb(t,i);const o=e,s=o.componentData.verticalOffsets;if(n||null==s)return i;const r=s[t];if(2===this._viewingMode||0===r)return i[2]+=r,i[5]+=r,i;const a=R(r);return a.localOrigin=o.transform.position,a.applyToAabb(i)}getComponentObb(e){return e.obb}getObjectTransform(e){return e.transform}getComponentPositions(e,t,i){return e.intersectionGeometry.getComponentPositions(t,i)}_updateHighlightsInOrder(e){if(this._highlights===e)return;const{_highlightsInOrder:t}=this,i=Math.min(e.length,8);let n=t.length!==i;for(let o=0;o<i;++o)if(t[o]!==e[o].name){n=!0;break}if(this._highlights=e,n){t.length=i;for(let n=0;n<i;++n)t[n]=e[n].name;this._syncHighlightedObjectHighlightOrder()}}_syncHighlightedObjectHighlightOrder(){const e=this._highlightsInOrder,t=t=>{t.componentData.componentHighlights.size>0&&t.componentData.setHighlightsInOrder(e)};this._visible.forAll(t),this._hidden.forAll(t)}expandRangeWithComponentObjectElevationRange(e,t,i,n){Number.isNaN(this._elevationRangeCacheVerticalOffset)||this._elevationRangeCacheVerticalOffset!==t||n.expandElevationRangeValues(this._elevationRangeCacheMin,this._elevationRangeCacheMax);const o=e,{componentData:s}=o,r=s.count,{verticalOffsets:a}=s,{intersectionGeometry:l}=o,h=2===this._viewingMode,c=l.getComponentAabbs(),m=V;let g=1/0,p=-1/0;for(let d=0;d<r;d++){const e=6*d,s=a?.[d]??0;let r=1/0,l=-1/0;if(h)r=c[e+2]+s+t,l=c[e+5]+s+t;else{if(m[0]=c[e],m[1]=c[e+1],m[2]=c[e+2],m[3]=c[e+3],m[4]=c[e+4],m[5]=c[e+5],0!==s){const e=R(s);e.localOrigin=o.transform.position,e.applyToAabb(m)}const r=Math.max(Math.abs(m[3]),Math.abs(m[0])),a=Math.max(Math.abs(m[4]),Math.abs(m[1])),l=t+m[5]+i;n.expandElevationRangeValues(t+m[2],Math.sqrt(r*r+a*a+l*l)-i)}n.expandElevationRangeValues(r,l),g=Math.min(g,r),p=Math.max(p,l)}this._elevationRangeCacheVerticalOffset=t,this._elevationRangeCacheMin=g,this._elevationRangeCacheMax=p}intersectRay(e,t,i,n,o,s){const r=e,{transform:a,componentData:l,intersectionGeometry:h}=r;null!=n&&(n.localOrigin=a.position),h.intersectRay(t,i,n,l.verticalOffsets,a,o,s)}*intersectScreenPolygon(e,t,i,n,o){const s=e,{transform:r,componentData:a,intersectionGeometry:l}=s;null!=n&&(n.localOrigin=r.position),yield*l.intersectScreenPolygon(t,i,n,a.verticalOffsets,r,o)}addEdges(e,t,i,n,o){const s=e,{indices:r,positions:a}=s.intersectionGeometry,l=s.componentData.offsets;return t.addComponentObject(s,a,r,l,i,n,o)}async extractEdgeInformation(e,t,i){const n=e,o=n.componentData.visibility;if(o.allInvisible()){const{extractComponentsEdgeLocationsLayout:e}=await import("../../lib/edgeRendering/edgeProcessing.js");return{buffer:e.createBuffer(0),origin:[0,0,0]}}const{indices:s,positions:r}=n.intersectionGeometry,a=n.componentData.offsets,{EdgeInputBufferLayout:h}=await import("../../lib/edgeRendering/bufferLayouts.js"),c=h.createBuffer(r.length/3);g(c.position.typedBuffer,r,c.position.typedBufferStride,3),m(c.position,c.position,n.transform.rotationScale),this._setComponentIndices(c.componentIndex,s,a);const p=c.count,d=this._computeVisibilityIndices(s,o,a,p);return{origin:l(n.transform.position),buffer:await t.extractComponentsEdgeLocations({indices:d,indicesLength:d.length,skipDeduplicate:!0,data:c,writerSettings:{reducedPrecision:!1,variants:0}},i)}}_setComponentIndices(e,t,i){let n=0;for(let o=0;o<i.length-1;o++){const s=i[o],r=i[o+1];for(let i=s;i<r;i++){const o=t?t[i]:i;e.set(o,n)}n++}}_computeVisibilityIndices(e,t,i,n){if(e&&t.allVisible())return e;let o=0;t.forEachComponentRange((e,t)=>(o+=i[t]-i[e],!0));const s=r(e)?2===e?.BYTES_PER_ELEMENT||n<=65536?new Uint16Array(o):new Uint32Array(o):new Array(o);let a=0;return t.forEachComponentRange((t,n)=>{const o=i[t],r=i[n];for(let i=o;i<r;i++)s[a++]=e?e[i]:i;return!0}),s}addHighlight(e,t,i){const n=e,o=this._activeHighlightOptions.get(i)??0;this._activeHighlightOptions.set(i,o+1),n.componentData.setHighlightsInOrder(this._highlightsInOrder);n.addHighlight(t,i)&&this._requestRender()}removeHighlight(e,t,i){const n=e.removeHighlight(t,i);"notfound"!==n&&(this._removeActiveHighlight(i),n&&this._requestRender())}_removeActiveHighlight(e,t=1){const i=this._activeHighlightOptions.get(e);if(void 0===i)B().warn(`Removing non-existing highlight "${e}".`);else{const n=i-t;n<0&&B().warn(`Removing non-existing highlight "${e}".`),n<=0?this._activeHighlightOptions.delete(e):this._activeHighlightOptions.set(e,n)}}clearHighlights(e){const t=e,{componentData:i}=t,{componentHighlights:n}=t.componentData;if(n.size>0){for(const e of n)this._removeActiveHighlight(e[0],e[1][i.count]);t.clearHighlights(),this._requestRender()}}hasHighlight(e){return this._activeHighlightOptions.has(e)}getObjectGPUMemoryUsage(e){return e.renderable.meta.gpuMemoryEstimate}get visibleObjects(){return this._visible}_createRenderable(e,t,i){const n=this._renderPassManager.rctx,o=e.geometry,s=o.parameters.layout,{interleavedVertexData:r,indexData:a,vertexCount:l}=o.renderGeometryData,h=new E(n,s,r),c=a?A.createIndex(n,35044,a):null;let m=0;const g=[["geometry",h]];if(!t.isIntegratedMesh){const e=new Uint16Array(l);for(let n=0;n<i.count;n++){const t=i.offsets[n],o=i.offsets[n+1],s=i.materialDataIndices[n];if(null!=a)for(let i=t;i<o;i++){e[a[i]]=s}else for(let i=t;i<o;i++)e[i]=s}const t=new E(n,H,e.buffer);m+=t.usedMemory,g.push(["componentIndices",t])}const p=new w(n,new Map(g),c),u=a?.length??l,b=new y(p,I.TRIANGLES,o.parameters,null!=c,u),O=new j(t),C=this.materials.acquire(O,b.parameters,d),M=new _(h.usedMemory+m+(c?.usedMemory??0)),R=this.samplers.addFromTexture(t.baseColorTexture?.texture),x=new f(e,t,R);return new v(C,x,b,M)}_requestRender(){this._renderPassManager.requestRender()}};P=e([a("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection")],P);const V=h();export{P as ComponentObjectCollection};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{copy as t,sub as e}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as o,copy as s,expandWithAABB as i}from"../../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as r}from"../../../../../geometry/support/DoubleArray.js";import{intersectsTransformedAabb as a}from"../../../../../geometry/support/frustum.js";import{intersectTriangleRangeForComponent as l,intersectTriangleRangeScreenPolygonForComponent as c,ComponentObjectElevationAgnosticComponentGeometryBVH as h}from"./ComponentObjectElevationAgnosticComponentGeometryBVH.js";import{ElevationAgnosticBVH as m}from"./ElevationAgnosticBVH.js";import{MeshIntersectionOptions as p,computeInvDir as _,intersectAabbInvDir as f}from"../../lib/RayIntersections.js";import{elevationAlignVertexGlobal as b}from"../../lib/triangleIntersectionUtils.js";class u{constructor(t,e,o,s,i,r,a,l){this.vertexData=t,this.vertexStride=e,this.indexData=o,this._componentData=s,this._componentAabbs3D=i,this.geometryMinZ=r,this.planetCenterZ=a,this.localMode=l,this.maxBspNodeDepth=6,this.minElementCountForBVH=10,this.minBspNodeElementCount=3,this._ray0=P,this._ray1=v,this._invDir=n(),this._componentVerticalOffsets=null,this._verticalOffset=null,this._tolerance=0,this._intersectionOptions=I,this._callback=A,this._screenPolygonCallback=O,this._screenPolygonIntersector=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this._localModeOffsetDisplacement=new S,this._nodeAabbs3D=null,this.rayDirectionC=n(),this._intersectComponent=A,this._componentIndexMap=null,this._bvh=new m(s.count,this),this.componentIntersectionData=new Array(s.count)}get numComponents(){return this._componentData.count}get minZGlobal(){return this.geometryMinZ-this.planetCenterZ}getAabbs2D(){return this.localMode?this.getAabbs2DLocal():this.getAabbs2DGlobal()}getAabbs2DGlobal(){const{numComponents:t,planetCenterZ:e,minZGlobal:n}=this,o=r(4*t),s=this._componentAabbs3D;for(let i=0;i<t;++i){const t=6*i,r=s[t+0],a=s[t+1],l=s[t+2],c=s[t+3],h=s[t+4],m=n/(l-e),p=n/(s[t+5]-e),_=Math.min(r*m,r*p),f=Math.min(a*m,a*p),b=Math.max(c*m,c*p),u=Math.max(h*m,h*p),y=4*i;o[y+0]=_,o[y+1]=f,o[y+2]=b,o[y+3]=u}return o}getAabbs2DLocal(){const{numComponents:t}=this,e=r(4*t),n=this._componentAabbs3D;for(let o=0;o<t;++o){const t=6*o,s=n[t+0],i=n[t+1],r=n[t+3],a=n[t+4],l=4*o;e[l+0]=s,e[l+1]=i,e[l+2]=r,e[l+3]=a}return e}intersectRay(t,e,n,o,s,i){const{isVerticalRay:r}=n;this._ray0=t,this._ray1=e,this._componentVerticalOffsets=s??null,this._verticalOffset=i??null,this._tolerance=n.tolerance,this._intersectionOptions=n,this._intersectComponent=this._intersectComponentRay,this._componentIndexMap=this._bvh.elementIndexMap,_(t,e,this._invDir),this._callback=o,this._bvh.intersectRay(t,e,r),this._callback=A,this._intersectComponent=A}intersectScreenPolygon(t,e,n,o,s,i){this._componentVerticalOffsets=s??null,this._verticalOffset=i??null,this._screenPolygonIntersector=t,this._screenPolygonQuery=e,this._screenPolygonTransformation=n,this._screenPolygonCallback=o,this._componentIndexMap=this._bvh.elementIndexMap,this._intersectComponent=this._intersectComponentScreenPolygon,this._bvh.intersectNodes((t,e)=>this._intersectScreenPolygonNode(t,e)),this._componentIndexMap=null,this._componentVerticalOffsets=null,this._verticalOffset=null,this._screenPolygonCallback=O,this._screenPolygonTransformation=null,this._screenPolygonQuery=null,this._screenPolygonIntersector=null,this._intersectComponent=A}intersectRange(t,e){this._forEachIntersectableComponent(t,e,t=>{this._intersectComponent(t)})}getComponentTriangleCount(t){const e=this._componentData.offsets,n=e[t]/3;return e[t+1]/3-n}getComponentAabb3D(t,e){const n=this._componentAabbs3D,o=6*t;return e[0]=n[o],e[1]=n[o+1],e[2]=n[o+2],e[3]=n[o+3],e[4]=n[o+4],e[5]=n[o+5],e}_intersectComponentRay(n){const o=this.getComponentAabb3D(n,y);let s=!1;const{localMode:i,_componentVerticalOffsets:r,_verticalOffset:a,_ray0:c,_ray1:h,_invDir:m,planetCenterZ:p,_tolerance:_,rayDirectionC:u}=this,{isVerticalRay:g}=this._intersectionOptions,D=this._componentData.offsets,d=t(C,c),P=t(x,h),v=r?.[n]??0,A=v+(a?.offset??0);if(0!==A&&(i?(d[2]=c[2]-A,P[2]=h[2]-A,s=!0):(null!=a&&(a.componentOffset=v),g&&(b(d,-A,p,c),b(P,-A,p,h),s=!0))),null==a||s||0===A||a.applyToAabb(o),!f(o,d,m,_))return;e(u,P,d);const O=D[n]/3,I=D[n+1]/3,S=I-O,T=(t,e,o,s)=>this._callback(t,e,o,s,n),{vertexData:V,vertexStride:R,indexData:N,_intersectionOptions:j}=this,{normalRequired:B}=j;if(S>M){this._getOrCreateComponentGeometryBvh(n,O,I).intersectRay(d,P,g,s?0:A,T,B)}else{l(d,u,O,I,N,V,R,s?0:A,p,B,T)}}_intersectComponentScreenPolygon(t){const e=this._screenPolygonIntersector,n=this._screenPolygonQuery;if(null==e||null==n)return;const o=this.getComponentAabb3D(t,y),{_screenPolygonTransformation:i,_screenPolygonCallback:r,vertexData:l,vertexStride:h,indexData:m}=this,p=this._getScreenPolygonElevationDisplacement(t),_=null!=p?p.applyToAabb(s(g,o)):o;if(!a(n.broadPhaseFrustum,_,i))return;const f=this._componentData.offsets,b=f[t]/3,u=f[t+1]/3;if(u-b>M){return void this._getOrCreateComponentGeometryBvh(t,b,u).intersectScreenPolygon(e,i,n,p,(e,n,o)=>{r(e,n,t,o)})}const D=c(e,i,n,b,u,m,l,h,p);null!=D&&r(D.distance,D.primitiveIndex,t,D.point)}_intersectScreenPolygonNode(t,e){const n=this._screenPolygonQuery;if(null==n)return!1;const o=this._getScreenPolygonNodeAabb(t,e,g),{_screenPolygonTransformation:s}=this;return a(n.broadPhaseFrustum,o,s)}_forEachIntersectableComponent(t,e,n){const o=this._componentIndexMap,s=this._componentData;for(let i=t;i<e;++i){const t=o?o[i]:i;s.isPickable(t)&&s.isVisible(t)&&n(t)}}_getOrCreateComponentGeometryBvh(t,e,n){let o=this.componentIntersectionData[t];return null==o&&(o=new h(t,this.vertexData,this.vertexStride,this.indexData,e,n,this._componentAabbs3D[6*t+2],this._componentAabbs3D[6*t+5],this.geometryMinZ,this.planetCenterZ,this.localMode),this.componentIntersectionData[t]=o),o}_getScreenPolygonElevationDisplacement(t){const e=this._componentVerticalOffsets?.[t]??0;return this._getScreenPolygonDisplacementForOffset(e)}_getScreenPolygonDisplacementForOffset(t){const e=this._verticalOffset;return null!=e?0===t&&0===e.offset?null:(e.componentOffset=t,e):this.localMode&&0!==t?(this._localModeOffsetDisplacement.offset=t,this._localModeOffsetDisplacement):null}_getScreenPolygonNodeAabb(t,e,n){const o=this._getNodeAabb3D(t,e,n),[r,a]=this._getNodeComponentOffsetRange(t);if(r===a)return this._applyScreenPolygonDisplacementToAabb(o,r);const l=this._applyScreenPolygonDisplacementToAabb(s(D,o),r),c=this._applyScreenPolygonDisplacementToAabb(s(d,o),a);return i(l,c,n),n}_applyScreenPolygonDisplacementToAabb(t,e){const n=this._getScreenPolygonDisplacementForOffset(e);return null!=n?n.applyToAabb(t):t}_getNodeAabb3D(t,e,n){const r=this._nodeAabbs3D??=[],a=r[e];if(null!=a)return s(n,a);const l=this._componentIndexMap;let c=!1;for(let o=t.minIndexIndex;o<t.maxIndexIndex;++o){const t=l?l[o]:o,e=this.getComponentAabb3D(t,D);c?i(n,e):(s(n,e),c=!0)}const h=o();return s(h,n),r[e]=h,n}_getNodeComponentOffsetRange(t){const e=this._componentVerticalOffsets;if(null==e)return[0,0];const n=this._componentIndexMap;let o=0,s=0,i=!1;for(let r=t.minIndexIndex;r<t.maxIndexIndex;++r){const t=e[n?n[r]:r]??0;i?(o=Math.min(o,t),s=Math.max(s,t)):(o=t,s=t,i=!0)}return i?[o,s]:[0,0]}}const y=o(),g=o(),D=o(),d=o(),C=n(),x=n(),P=n(),v=n(),A=()=>{},O=()=>{},I=new p,M=40;class S{constructor(){this.offset=0}applyToVertex(t,e,n,o){return t[0]=e,t[1]=n,t[2]=o+this.offset,t}applyToAabb(t){return t[2]+=this.offset,t[5]+=this.offset,t}}export{u as ComponentObjectElevationAgnosticComponentBVH};
2
+ import{copy as t,sub as e}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as o,copy as s,expandWithAABB as i}from"../../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as r}from"../../../../../geometry/support/DoubleArray.js";import{intersectsTransformedAabb as a}from"../../../../../geometry/support/frustum.js";import{intersectTriangleRangeForComponent as l,intersectTriangleRangeScreenPolygonForComponent as c,ComponentObjectElevationAgnosticComponentGeometryBVH as h}from"./ComponentObjectElevationAgnosticComponentGeometryBVH.js";import{ElevationAgnosticBVH as m}from"./ElevationAgnosticBVH.js";import{MeshIntersectionOptions as p,computeInvDir as _,intersectAabbInvDir as f}from"../../lib/RayIntersections.js";import{elevationAlignVertexGlobal as b}from"../../lib/triangleIntersectionUtils.js";class u{constructor(t,e,o,s,i,r,a,l){this.vertexData=t,this.vertexStride=e,this.indexData=o,this._componentData=s,this._componentAabbs3D=i,this.geometryMinZ=r,this.planetCenterZ=a,this.localMode=l,this.maxBspNodeDepth=6,this.minElementCountForBVH=10,this.minBspNodeElementCount=3,this._ray0=P,this._ray1=v,this._invDir=n(),this._componentVerticalOffsets=null,this._verticalOffset=null,this._tolerance=0,this._intersectionOptions=I,this._callback=A,this._screenPolygonCallback=O,this._screenPolygonIntersector=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this._localModeOffsetDisplacement=new S,this._nodeAabbs3D=null,this.rayDirectionC=n(),this._intersectComponent=A,this._componentIndexMap=null,this._bvh=new m(s.count,this),this.componentIntersectionData=new Array(s.count)}get numComponents(){return this._componentData.count}get minZGlobal(){return this.geometryMinZ-this.planetCenterZ}getAabbs2D(){return this.localMode?this.getAabbs2DLocal():this.getAabbs2DGlobal()}getAabbs2DGlobal(){const{numComponents:t,planetCenterZ:e,minZGlobal:n}=this,o=r(4*t),s=this._componentAabbs3D;for(let i=0;i<t;++i){const t=6*i,r=s[t+0],a=s[t+1],l=s[t+2],c=s[t+3],h=s[t+4],m=n/(l-e),p=n/(s[t+5]-e),_=Math.min(r*m,r*p),f=Math.min(a*m,a*p),b=Math.max(c*m,c*p),u=Math.max(h*m,h*p),y=4*i;o[y+0]=_,o[y+1]=f,o[y+2]=b,o[y+3]=u}return o}getAabbs2DLocal(){const{numComponents:t}=this,e=r(4*t),n=this._componentAabbs3D;for(let o=0;o<t;++o){const t=6*o,s=n[t+0],i=n[t+1],r=n[t+3],a=n[t+4],l=4*o;e[l+0]=s,e[l+1]=i,e[l+2]=r,e[l+3]=a}return e}intersectRay(t,e,n,o,s,i){const{isVerticalRay:r}=n;this._ray0=t,this._ray1=e,this._componentVerticalOffsets=s??null,this._verticalOffset=i??null,this._tolerance=n.tolerance,this._intersectionOptions=n,this._intersectComponent=this._intersectComponentRay,this._componentIndexMap=this._bvh.elementIndexMap,_(t,e,this._invDir),this._callback=o,this._bvh.intersectRay(t,e,r),this._callback=A,this._intersectComponent=A}*intersectScreenPolygon(t,e,n,o,s,i){this._componentVerticalOffsets=s??null,this._verticalOffset=i??null,this._screenPolygonIntersector=t,this._screenPolygonQuery=e,this._screenPolygonTransformation=n,this._screenPolygonCallback=o,this._componentIndexMap=this._bvh.elementIndexMap,this._intersectComponent=this._intersectComponentScreenPolygon,yield*this._bvh.intersectNodesGenerator((t,e)=>this._intersectScreenPolygonNode(t,e)),this._componentIndexMap=null,this._componentVerticalOffsets=null,this._verticalOffset=null,this._screenPolygonCallback=O,this._screenPolygonTransformation=null,this._screenPolygonQuery=null,this._screenPolygonIntersector=null,this._intersectComponent=A}intersectRange(t,e){this._forEachIntersectableComponent(t,e,t=>{this._intersectComponent(t)})}*intersectRangeGenerator(t,e){const n=this._componentIndexMap,o=this._componentData;for(let s=t;s<e;++s){const t=n?n[s]:s;o.isPickable(t)&&o.isVisible(t)&&(this._intersectComponent(t),yield)}}getComponentTriangleCount(t){const e=this._componentData.offsets,n=e[t]/3;return e[t+1]/3-n}getComponentAabb3D(t,e){const n=this._componentAabbs3D,o=6*t;return e[0]=n[o],e[1]=n[o+1],e[2]=n[o+2],e[3]=n[o+3],e[4]=n[o+4],e[5]=n[o+5],e}_intersectComponentRay(n){const o=this.getComponentAabb3D(n,y);let s=!1;const{localMode:i,_componentVerticalOffsets:r,_verticalOffset:a,_ray0:c,_ray1:h,_invDir:m,planetCenterZ:p,_tolerance:_,rayDirectionC:u}=this,{isVerticalRay:g}=this._intersectionOptions,d=this._componentData.offsets,D=t(C,c),P=t(x,h),v=r?.[n]??0,A=v+(a?.offset??0);if(0!==A&&(i?(D[2]=c[2]-A,P[2]=h[2]-A,s=!0):(null!=a&&(a.componentOffset=v),g&&(b(D,-A,p,c),b(P,-A,p,h),s=!0))),null==a||s||0===A||a.applyToAabb(o),!f(o,D,m,_))return;e(u,P,D);const O=d[n]/3,I=d[n+1]/3,S=I-O,T=(t,e,o,s)=>this._callback(t,e,o,s,n),{vertexData:V,vertexStride:R,indexData:N,_intersectionOptions:j}=this,{normalRequired:k}=j;if(S>M){this._getOrCreateComponentGeometryBvh(n,O,I).intersectRay(D,P,g,s?0:A,T,k)}else{l(D,u,O,I,N,V,R,s?0:A,p,k,T)}}_intersectComponentScreenPolygon(t){const e=this._screenPolygonIntersector,n=this._screenPolygonQuery;if(null==e||null==n)return;const o=this.getComponentAabb3D(t,y),{_screenPolygonTransformation:i,_screenPolygonCallback:r,vertexData:l,vertexStride:h,indexData:m}=this,p=this._getScreenPolygonElevationDisplacement(t),_=null!=p?p.applyToAabb(s(g,o)):o;if(!a(n.broadPhaseFrustum,_,i))return;const f=this._componentData.offsets,b=f[t]/3,u=f[t+1]/3;if(u-b>M){return void this._getOrCreateComponentGeometryBvh(t,b,u).intersectScreenPolygon(e,i,n,p,(e,n,o)=>{r(e,n,t,o)})}const d=c(e,i,n,b,u,m,l,h,p);null!=d&&r(d.distance,d.primitiveIndex,t,d.point)}_intersectScreenPolygonNode(t,e){const n=this._screenPolygonQuery;if(null==n)return!1;const o=this._getScreenPolygonNodeAabb(t,e,g),{_screenPolygonTransformation:s}=this;return a(n.broadPhaseFrustum,o,s)}_forEachIntersectableComponent(t,e,n){const o=this._componentIndexMap,s=this._componentData;for(let i=t;i<e;++i){const t=o?o[i]:i;s.isPickable(t)&&s.isVisible(t)&&n(t)}}_getOrCreateComponentGeometryBvh(t,e,n){let o=this.componentIntersectionData[t];return null==o&&(o=new h(t,this.vertexData,this.vertexStride,this.indexData,e,n,this._componentAabbs3D[6*t+2],this._componentAabbs3D[6*t+5],this.geometryMinZ,this.planetCenterZ,this.localMode),this.componentIntersectionData[t]=o),o}_getScreenPolygonElevationDisplacement(t){const e=this._componentVerticalOffsets?.[t]??0;return this._getScreenPolygonDisplacementForOffset(e)}_getScreenPolygonDisplacementForOffset(t){const e=this._verticalOffset;return null!=e?0===t&&0===e.offset?null:(e.componentOffset=t,e):this.localMode&&0!==t?(this._localModeOffsetDisplacement.offset=t,this._localModeOffsetDisplacement):null}_getScreenPolygonNodeAabb(t,e,n){const o=this._getNodeAabb3D(t,e,n),[r,a]=this._getNodeComponentOffsetRange(t);if(r===a)return this._applyScreenPolygonDisplacementToAabb(o,r);const l=this._applyScreenPolygonDisplacementToAabb(s(d,o),r),c=this._applyScreenPolygonDisplacementToAabb(s(D,o),a);return i(l,c,n),n}_applyScreenPolygonDisplacementToAabb(t,e){const n=this._getScreenPolygonDisplacementForOffset(e);return null!=n?n.applyToAabb(t):t}_getNodeAabb3D(t,e,n){const r=this._nodeAabbs3D??=[],a=r[e];if(null!=a)return s(n,a);const l=this._componentIndexMap;let c=!1;for(let o=t.minIndexIndex;o<t.maxIndexIndex;++o){const t=l?l[o]:o,e=this.getComponentAabb3D(t,d);c?i(n,e):(s(n,e),c=!0)}const h=o();return s(h,n),r[e]=h,n}_getNodeComponentOffsetRange(t){const e=this._componentVerticalOffsets;if(null==e)return[0,0];const n=this._componentIndexMap;let o=0,s=0,i=!1;for(let r=t.minIndexIndex;r<t.maxIndexIndex;++r){const t=e[n?n[r]:r]??0;i?(o=Math.min(o,t),s=Math.max(s,t)):(o=t,s=t,i=!0)}return i?[o,s]:[0,0]}}const y=o(),g=o(),d=o(),D=o(),C=n(),x=n(),P=n(),v=n(),A=()=>{},O=()=>{},I=new p,M=40;class S{constructor(){this.offset=0}applyToVertex(t,e,n,o){return t[0]=e,t[1]=n,t[2]=o+this.offset,t}applyToAabb(t){return t[2]+=this.offset,t[5]+=this.offset,t}}export{u as ComponentObjectElevationAgnosticComponentBVH};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{Vertices as t}from"../../lib/Attribute.js";import{TriangleIntersectionData as n}from"../../lib/TriangleIntersectionData.js";class e{constructor(e,o,s,i,r){this._componentOffsets=r,this._intersectionData=new n(s,i,new t(e,3,o))}intersectRay(t,n,e,s){const i=(t,n,e,i)=>{const r=o(this._componentOffsets,i);s(t,n,e,i,r)};this._intersectionData.intersectRay(t,n,e,i)}intersectScreenPolygon(t,n,e,s){this._intersectionData.forEachScreenPolygonHit(t,e,n,null,(t,n,e)=>{const i=o(this._componentOffsets,n);i<0||i>=this._componentOffsets.length-1||s(t,n,i,e)})}}function o(t,n){const{length:e}=t;if(0===e||n<t[0])return-1;if(n>t[e-1])return e;let o=0,s=e-1;for(;s-o>1;){const e=Math.round(.5*(o+s));n<=t[e]?s=e:o=e}return o}export{e as ComponentObjectFixedBVH};
2
+ import{Vertices as t}from"../../lib/Attribute.js";import{TriangleIntersectionData as n}from"../../lib/TriangleIntersectionData.js";class e{constructor(e,o,s,i,r){this._componentOffsets=r,this._intersectionData=new n(s,i,new t(e,3,o))}intersectRay(t,n,e,s){const i=(t,n,e,i)=>{const r=o(this._componentOffsets,i);s(t,n,e,i,r)};this._intersectionData.intersectRay(t,n,e,i)}*intersectScreenPolygon(t,n,e,s){this._intersectionData.forEachScreenPolygonHit(t,e,n,null,(t,n,e)=>{const i=o(this._componentOffsets,n);i<0||i>=this._componentOffsets.length-1||s(t,n,i,e)}),yield}}function o(t,n){const{length:e}=t;if(0===e||n<t[0])return-1;if(n>t[e-1])return e;let o=0,s=e-1;for(;s-o>1;){const e=Math.round(.5*(o+s));n<=t[e]?s=e:o=e}return o}export{e as ComponentObjectFixedBVH};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{clamp as t}from"../../../../../core/mathUtils.js";import{fromValues as e}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as n}from"../../../../../geometry/support/aaBoundingRect.js";import{createUintArray as i}from"../../lib/triangleIntersectionUtils.js";class s{constructor(t,n){this.elementCount=t,this.model=n,this._elementIndexMap=null,this._bspNodes=[],this._generatedBVH=!1,this.localMode=n.localMode,this.planetCenterZ=n.planetCenterZ,this.geometryMinZ=n.geometryMinZ,this.planetCenter=e(0,0,this.planetCenterZ),this.maxBspNodeDepth=n.maxBspNodeDepth??8,this.minElementCountForBVH=n.minElementCountForBVH??15,this.minBspNodeElementCount=n.minBspNodeElementCount??5}get elementIndexMap(){return this._ensureBVH(),this._elementIndexMap}get _skipBVH(){return this.elementCount<this.minElementCountForBVH||this.geometryMinZ<.5*this.planetCenterZ}_ensureBVH(){this._generatedBVH||this._skipBVH||0===this._bspNodes.length&&this._generateBsp()}intersectRay(t,e,n){this.elementCount<1||(this._skipBVH?this._intersectRayWithoutBVH(n):this._intersectRayWithBVH(t,e,n))}intersectNodes(t){if(this.elementCount<1)return;if(this._skipBVH)return void this._intersectRange(0,this.elementCount);this._ensureBVH();const e=[0];for(;e.length>0;){const n=e.pop(),i=this._bspNodes[n];if(!t(i,n))continue;const{child0:s,child1:h,minIndexIndex:o,minMidIndexIndex:a,maxMidIndexIndex:r,maxIndexIndex:c}=i;-1!==s||-1!==h?(-1!==s?e.push(s):this._intersectRange(o,a),this._intersectRange(a,r),-1!==h?e.push(h):this._intersectRange(r,c)):this._intersectRange(o,c)}}_intersectRayWithoutBVH(t){this._intersectRange(0,this.elementCount)}_intersectRange(t,e){this.model.intersectRange(t,e)}_intersectRayWithBVH(t,e,n){this._ensureBVH(),n?this._intersectGeometryWithBVHVerticalRay(t):this._intersectGeometryWithBVHGeneralRay(t,e)}_intersectGeometryWithBVHVerticalRay(t){let e=t[0],n=t[1];if(!this.localMode){const{geometryMinZ:i,planetCenterZ:s}=this,h=(i-s)/(t[2]-s);e=t[0]*h,n=t[1]*h}const{_bspNodes:i}=this;let s=0;for(;s>=0;){const t=i[s],{d:h,dim:o,minIndexIndex:a,minMidIndexIndex:r,maxMidIndexIndex:c,maxIndexIndex:d,aabb2D:m}=t;if(e<m[0]||e>m[2]||n<m[1]||n>m[3])break;if(-1===o||-1===t.child0&&-1===t.child1){this._intersectRange(a,d);break}{this._intersectRange(r,c);const i=(0===o?e:n)-h;if(i<0){if(-1===t.child0){this._intersectRange(a,r);break}s=t.child0}else{if(!(i>0))break;if(-1===t.child1){this._intersectRange(c,d);break}s=t.child1}}}}_intersectGeometryWithBVHGeneralRay(e,n){let i=e[0],s=e[1],h=n[0],o=n[1];const{geometryMinZ:a}=this;if(!this.localMode){let t=0,r=1;const c=Math.min(.5*this.planetCenterZ,a),d=e[2],m=n[2];if(d<c&&m<c)return;if(d<c&&(t=(c-d)/(m-d)),m<c&&(r=(c-d)/(m-d)),t>r)return;const l=(1-t)*e[0]+t*n[0],x=(1-t)*e[1]+t*n[1],u=(1-t)*e[2]+t*n[2],p=(1-r)*e[0]+r*n[0],M=(1-r)*e[1]+r*n[1],f=(1-r)*e[2]+r*n[2],{planetCenterZ:_}=this,g=a-_,I=g/(u-_);i=l*I,s=x*I;const B=g/(f-_);h=p*B,o=M*B}const r=h-i,c=o-s,d=this._bspNodes;let m=1;{const{aabb2D:t}=d[0],e=(t,e,n,i)=>{if(Math.abs(e)<1e-5*Math.max(i-n,1))return!1;const s=e>0,h=s?i:n,o=t+m*e;return(s?o<h:o>h)&&(m=Math.max((h-t)/e,m),!0)},n=()=>e(i,r,t[0],t[2]),h=()=>e(s,c,t[1],t[3]);Math.abs(r)>=Math.abs(c)?n()||h():h()||n()}const l=[0,0,m];let x=0;for(;x<l.length;){const e=l[x];let n=l[x+1],h=l[x+2];if(x+=3,n>h)continue;const o=d[e],{minIndexIndex:a,maxIndexIndex:u}=o,{child0:p,child1:M,minMidIndexIndex:f,maxMidIndexIndex:_,aabb2D:g,d:I,dim:B}=o;{const t=i+n*r,e=i+h*r,s=Math.min(t,e),o=Math.max(t,e),a=g[0],c=g[2];if(o<a||c<s)continue;if(s<a){const t=(a-i)/r;r>0?n=Math.max(n,t):h=Math.min(h,t)}if(c<o){const t=(c-i)/r;r>0?h=Math.min(h,t):n=Math.max(n,t)}}{const t=s+n*c,e=s+h*c,i=Math.min(t,e),o=Math.max(t,e),a=g[1],r=g[3];if(o<a||r<i)continue;if(i<a){const t=(a-s)/c;c>0?n=Math.max(n,t):h=Math.min(h,t)}if(r<o){const t=(r-s)/c;c>0?h=Math.min(h,t):n=Math.max(n,t)}}if(-1===p&&-1===M)this._intersectRange(a,u);else{const e=0===B?i:s,o=0===B?r:c,d=e+n*o,x=e+h*o,g=Math.min(d,x),b=Math.max(d,x),R=t((I-e)/o,0,m);a<f&&g<=I&&(-1!==p?(l.push(p),l.push(o>=0?n:Math.max(n,R)),l.push(o>=0?Math.min(h,R):h)):this._intersectRange(a,f)),this._intersectRange(f,_),_<u&&I<=b&&(-1!==M?(l.push(M),l.push(o>=0?Math.max(n,R):n),l.push(o>=0?h:Math.min(h,R))):this._intersectRange(_,u))}}}_generateBsp(){const{elementCount:t}=this;if(t<1)return;const e=i(t,t);this._elementIndexMap=e;for(let n=0;n<t;++n)e[n]=n;const s=this.model.getAabbs2D();let r=0;const m=this._bspNodes;m.length=0;const{localMode:l}=this;let x=!1;if(!l){const{planetCenterZ:t,geometryMinZ:e}=this;x=t>=0||e<.5*t}const u=[],p=(t,e,n,i,s)=>{u.push(t),u.push(e),u.push(n),u.push(i<0?-1:(s?0:1)+2*i)},{maxBspNodeDepth:M,minBspNodeElementCount:f}=this,_=(t,i,r,u,_)=>{const g=m.length;if(g>0&&(x||r>=M||i-t<f))return;const I=n();c(I,t,i,e,s);const{d:B,dim:b}=l?h(I):o(I),{rangeMidStart:R,rangeMidEnd:V}=a(t,i,b,B,e,s),C=r===M-1,H=!C&&R>=t+f,y=!C&&i>=V+f;if(H||y||0===g){const e=new d(t,R,V,i,b,B,I);if(H&&p(t,R,r+1,g,!0),y&&p(V,i,r+1,g,!1),m.push(e),-1!==u){const t=m[u];_?t.child0=g:t.child1=g}}};for(p(0,t,0,-1,!1);r<u.length;){const t=u[r],e=u[r+1],n=u[r+2],i=u[r+3];r+=4;const s=i>>1;_(t,e,n,s,i-(s<<1)==0)}this._generatedBVH=!0}}function h(t){const e=t[0],n=t[1],i=t[2],s=t[3];let h,o;return i-e>=s-n?(o=.5*(e+i),h=0):(o=.5*(n+s),h=1),{d:o,dim:h}}function o(t){const e=t[0],n=t[1],i=t[2],s=t[3];let h,o;return i-e>=s-n?(h=0,o=.5*(e+i)):(h=1,o=.5*(n+s)),{dim:h,d:o}}function a(t,e,n,i,s,h){let o=t;{let t=e;for(;o<t;){const e=s[o];r(e,n,i,h)<0?++o:(--t,s[o]=s[t],s[t]=e)}}const a=o;let c=o,d=e;for(;c<d;){const t=s[d-1];r(t,n,i,h)>0?--d:(s[d-1]=s[c],s[c]=t,++c)}return{rangeMidStart:a,rangeMidEnd:d}}function r(t,e,n,i){const s=4*t,h=i[s+0+e];return i[s+2+e]<n?-1:h>n?1:0}function c(t,e,n,i,s){let h=1/0,o=1/0,a=-1/0,r=-1/0;for(let c=e;c<n;++c){const t=4*i[c];h=Math.min(h,s[t+0]),o=Math.min(o,s[t+1]),a=Math.max(a,s[t+2]),r=Math.max(r,s[t+3])}t[0]=h,t[1]=o,t[2]=a,t[3]=r}class d{constructor(t,e,n,i,s,h,o){this.minIndexIndex=t,this.minMidIndexIndex=e,this.maxMidIndexIndex=n,this.maxIndexIndex=i,this.dim=s,this.d=h,this.aabb2D=o,this.child0=-1,this.child1=-1}}export{s as ElevationAgnosticBVH};
2
+ import{clamp as t}from"../../../../../core/mathUtils.js";import{fromValues as e}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as n}from"../../../../../geometry/support/aaBoundingRect.js";import{createUintArray as i}from"../../lib/triangleIntersectionUtils.js";class s{constructor(t,n){this.elementCount=t,this.model=n,this._elementIndexMap=null,this._bspNodes=[],this._generatedBVH=!1,this.localMode=n.localMode,this.planetCenterZ=n.planetCenterZ,this.geometryMinZ=n.geometryMinZ,this.planetCenter=e(0,0,this.planetCenterZ),this.maxBspNodeDepth=n.maxBspNodeDepth??8,this.minElementCountForBVH=n.minElementCountForBVH??15,this.minBspNodeElementCount=n.minBspNodeElementCount??5}get elementIndexMap(){return this._ensureBVH(),this._elementIndexMap}get _skipBVH(){return this.elementCount<this.minElementCountForBVH||this.geometryMinZ<.5*this.planetCenterZ}_ensureBVH(){this._generatedBVH||this._skipBVH||0===this._bspNodes.length&&this._generateBsp()}intersectRay(t,e,n){this.elementCount<1||(this._skipBVH?this._intersectRayWithoutBVH(n):this._intersectRayWithBVH(t,e,n))}intersectNodes(t){if(this.elementCount<1)return;if(this._skipBVH)return void this._intersectRange(0,this.elementCount);this._ensureBVH();const e=[0];for(;e.length>0;){const n=e.pop(),i=this._bspNodes[n];if(!t(i,n))continue;const{child0:s,child1:h,minIndexIndex:r,minMidIndexIndex:o,maxMidIndexIndex:a,maxIndexIndex:c}=i;-1!==s||-1!==h?(-1!==s?e.push(s):this._intersectRange(r,o),this._intersectRange(o,a),-1!==h?e.push(h):this._intersectRange(a,c)):this._intersectRange(r,c)}}*intersectNodesGenerator(t){if(this.elementCount<1)return;if(this._skipBVH)return void(yield*this._intersectRangeGenerator(0,this.elementCount));this._ensureBVH();const e=[0];for(;e.length>0;){const n=e.pop(),i=this._bspNodes[n];if(!t(i,n))continue;const{child0:s,child1:h,minIndexIndex:r,minMidIndexIndex:o,maxMidIndexIndex:a,maxIndexIndex:c}=i;-1!==s||-1!==h?(-1!==s?e.push(s):yield*this._intersectRangeGenerator(r,o),yield*this._intersectRangeGenerator(o,a),-1!==h?e.push(h):yield*this._intersectRangeGenerator(a,c)):yield*this._intersectRangeGenerator(r,c)}}_intersectRayWithoutBVH(t){this._intersectRange(0,this.elementCount)}_intersectRange(t,e){this.model.intersectRange(t,e)}*_intersectRangeGenerator(t,e){this.model.intersectRangeGenerator?yield*this.model.intersectRangeGenerator(t,e):(this._intersectRange(t,e),yield)}_intersectRayWithBVH(t,e,n){this._ensureBVH(),n?this._intersectGeometryWithBVHVerticalRay(t):this._intersectGeometryWithBVHGeneralRay(t,e)}_intersectGeometryWithBVHVerticalRay(t){let e=t[0],n=t[1];if(!this.localMode){const{geometryMinZ:i,planetCenterZ:s}=this,h=(i-s)/(t[2]-s);e=t[0]*h,n=t[1]*h}const{_bspNodes:i}=this;let s=0;for(;s>=0;){const t=i[s],{d:h,dim:r,minIndexIndex:o,minMidIndexIndex:a,maxMidIndexIndex:c,maxIndexIndex:d,aabb2D:l}=t;if(e<l[0]||e>l[2]||n<l[1]||n>l[3])break;if(-1===r||-1===t.child0&&-1===t.child1){this._intersectRange(o,d);break}{this._intersectRange(a,c);const i=(0===r?e:n)-h;if(i<0){if(-1===t.child0){this._intersectRange(o,a);break}s=t.child0}else{if(!(i>0))break;if(-1===t.child1){this._intersectRange(c,d);break}s=t.child1}}}}_intersectGeometryWithBVHGeneralRay(e,n){let i=e[0],s=e[1],h=n[0],r=n[1];const{geometryMinZ:o}=this;if(!this.localMode){let t=0,a=1;const c=Math.min(.5*this.planetCenterZ,o),d=e[2],l=n[2];if(d<c&&l<c)return;if(d<c&&(t=(c-d)/(l-d)),l<c&&(a=(c-d)/(l-d)),t>a)return;const m=(1-t)*e[0]+t*n[0],x=(1-t)*e[1]+t*n[1],u=(1-t)*e[2]+t*n[2],p=(1-a)*e[0]+a*n[0],M=(1-a)*e[1]+a*n[1],_=(1-a)*e[2]+a*n[2],{planetCenterZ:g}=this,f=o-g,I=f/(u-g);i=m*I,s=x*I;const R=f/(_-g);h=p*R,r=M*R}const a=h-i,c=r-s,d=this._bspNodes;let l=1;{const{aabb2D:t}=d[0],e=(t,e,n,i)=>{if(Math.abs(e)<1e-5*Math.max(i-n,1))return!1;const s=e>0,h=s?i:n,r=t+l*e;return(s?r<h:r>h)&&(l=Math.max((h-t)/e,l),!0)},n=()=>e(i,a,t[0],t[2]),h=()=>e(s,c,t[1],t[3]);Math.abs(a)>=Math.abs(c)?n()||h():h()||n()}const m=[0,0,l];let x=0;for(;x<m.length;){const e=m[x];let n=m[x+1],h=m[x+2];if(x+=3,n>h)continue;const r=d[e],{minIndexIndex:o,maxIndexIndex:u}=r,{child0:p,child1:M,minMidIndexIndex:_,maxMidIndexIndex:g,aabb2D:f,d:I,dim:R}=r;{const t=i+n*a,e=i+h*a,s=Math.min(t,e),r=Math.max(t,e),o=f[0],c=f[2];if(r<o||c<s)continue;if(s<o){const t=(o-i)/a;a>0?n=Math.max(n,t):h=Math.min(h,t)}if(c<r){const t=(c-i)/a;a>0?h=Math.min(h,t):n=Math.max(n,t)}}{const t=s+n*c,e=s+h*c,i=Math.min(t,e),r=Math.max(t,e),o=f[1],a=f[3];if(r<o||a<i)continue;if(i<o){const t=(o-s)/c;c>0?n=Math.max(n,t):h=Math.min(h,t)}if(a<r){const t=(a-s)/c;c>0?h=Math.min(h,t):n=Math.max(n,t)}}if(-1===p&&-1===M)this._intersectRange(o,u);else{const e=0===R?i:s,r=0===R?a:c,d=e+n*r,x=e+h*r,f=Math.min(d,x),B=Math.max(d,x),b=t((I-e)/r,0,l);o<_&&f<=I&&(-1!==p?(m.push(p),m.push(r>=0?n:Math.max(n,b)),m.push(r>=0?Math.min(h,b):h)):this._intersectRange(o,_)),this._intersectRange(_,g),g<u&&I<=B&&(-1!==M?(m.push(M),m.push(r>=0?Math.max(n,b):n),m.push(r>=0?h:Math.min(h,b))):this._intersectRange(g,u))}}}_generateBsp(){const{elementCount:t}=this;if(t<1)return;const e=i(t,t);this._elementIndexMap=e;for(let n=0;n<t;++n)e[n]=n;const s=this.model.getAabbs2D();let a=0;const l=this._bspNodes;l.length=0;const{localMode:m}=this;let x=!1;if(!m){const{planetCenterZ:t,geometryMinZ:e}=this;x=t>=0||e<.5*t}const u=[],p=(t,e,n,i,s)=>{u.push(t),u.push(e),u.push(n),u.push(i<0?-1:(s?0:1)+2*i)},{maxBspNodeDepth:M,minBspNodeElementCount:_}=this,g=(t,i,a,u,g)=>{const f=l.length;if(f>0&&(x||a>=M||i-t<_))return;const I=n();c(I,t,i,e,s);const{d:R,dim:B}=m?h(I):r(I),{rangeMidStart:b,rangeMidEnd:y}=o(t,i,B,R,e,s),V=a===M-1,C=!V&&b>=t+_,H=!V&&i>=y+_;if(C||H||0===f){const e=new d(t,b,y,i,B,R,I);if(C&&p(t,b,a+1,f,!0),H&&p(y,i,a+1,f,!1),l.push(e),-1!==u){const t=l[u];g?t.child0=f:t.child1=f}}};for(p(0,t,0,-1,!1);a<u.length;){const t=u[a],e=u[a+1],n=u[a+2],i=u[a+3];a+=4;const s=i>>1;g(t,e,n,s,i-(s<<1)==0)}this._generatedBVH=!0}}function h(t){const e=t[0],n=t[1],i=t[2],s=t[3];let h,r;return i-e>=s-n?(r=.5*(e+i),h=0):(r=.5*(n+s),h=1),{d:r,dim:h}}function r(t){const e=t[0],n=t[1],i=t[2],s=t[3];let h,r;return i-e>=s-n?(h=0,r=.5*(e+i)):(h=1,r=.5*(n+s)),{dim:h,d:r}}function o(t,e,n,i,s,h){let r=t;{let t=e;for(;r<t;){const e=s[r];a(e,n,i,h)<0?++r:(--t,s[r]=s[t],s[t]=e)}}const o=r;let c=r,d=e;for(;c<d;){const t=s[d-1];a(t,n,i,h)>0?--d:(s[d-1]=s[c],s[c]=t,++c)}return{rangeMidStart:o,rangeMidEnd:d}}function a(t,e,n,i){const s=4*t,h=i[s+0+e];return i[s+2+e]<n?-1:h>n?1:0}function c(t,e,n,i,s){let h=1/0,r=1/0,o=-1/0,a=-1/0;for(let c=e;c<n;++c){const t=4*i[c];h=Math.min(h,s[t+0]),r=Math.min(r,s[t+1]),o=Math.max(o,s[t+2]),a=Math.max(a,s[t+3])}t[0]=h,t[1]=r,t[2]=o,t[3]=a}class d{constructor(t,e,n,i,s,h,r){this.minIndexIndex=t,this.minMidIndexIndex=e,this.maxMidIndexIndex=n,this.maxIndexIndex=i,this.dim=s,this.d=h,this.aabb2D=r,this.child0=-1,this.child1=-1}}export{s as ElevationAgnosticBVH};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{transpose as t,invert as e}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{sub as i,transformMat3 as o,negate as r}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as h}from"../../../../../geometry/support/aaBoundingBox.js";import{floatArrayFrom as m,floatArrayByteSize as c,newFloatArray as p}from"../../../../../geometry/support/FloatArray.js";import{indexArrayFrom as _,getContinuousIndexArray as l,indexArrayByteSize as b}from"../../../../../geometry/support/Indices.js";import{ComponentObjectElevationAgnosticComponentBVH as u}from"./ComponentObjectElevationAgnosticBVH.js";import{ComponentObjectFixedBVH as f}from"./ComponentObjectFixedBVH.js";class g{constructor(t,e,s,n){this.viewingMode=t,this._components=s,this._needsElevationAlignment=n,this.verticalOffset=null,this.componentVerticalOffsets=null,this._planetCenter=a(),this._componentBvh=null,this._aabb=h();const{indices:i,positions:o}=e,r=o.length/3;this._indices=i?_(i,r):l(r),this._positions=m(o)}get usedMemory(){return c(this._positions)+b(this._indices)}destroy(){this._positions=null,this._indices=null,this._perComponentAabbs=null,this._componentBvh=null}getComponentAabb(t,e){const s=this._ensureComponentAabbs(),n=6*t;return e[0]=s[n],e[1]=s[n+1],e[2]=s[n+2],e[3]=s[n+3],e[4]=s[n+4],e[5]=s[n+5],e}getComponentAabbs(){return this._ensureComponentAabbs()}_ensureComponentAabbs(){return this._perComponentAabbs||(this._perComponentAabbs=this._computePerComponentAabbs()),this._perComponentAabbs}getComponentPositions(t,e){e.indices=this._indices,e.data=this._positions,e.stride=3,e.startIndex=this._components.offsets[t],e.endIndex=this._components.offsets[t+1]}intersectRay(e,s,n,a,h,m,c){const p=v;this._setupIntersect(n,a,h,p);const{position:_}=h,l=i(d,e,_),b=i(C,s,_);o(l,l,p),o(b,b,p);const u=t(x,p);if(1===this.viewingMode){const t=this._planetCenter;r(t,_),o(t,t,p)}const f=(t,e,s,n,i)=>{c(t,e,s?o(A,s,u):null,n,i)};this._intersectComponents(l,b,a,n,f,m)}intersectScreenPolygon(t,e,s,n,i,o){this._setupIntersect(s,n,i);this._ensureComponentBvh().intersectScreenPolygon(t,e,i.toMat4(M),(t,e,s,n)=>o(s,t,n,e),n??void 0,s??void 0)}_setupIntersect(t,s,n,i=v){if(this.verticalOffset=t,this.componentVerticalOffsets=s,e(i,n.rotationScale),1===this.viewingMode){const t=this._planetCenter;r(t,n.position),o(t,t,i)}}_computePerComponentAabbs(){const t=this._aabb,e=.5*(t[0]+t[3]),s=.5*(t[1]+t[4]),n=.5*(t[2]+t[5]),i=this._components.count,o=p(6*i),r=this._indices,a=this._positions,h=this._components.offsets;let m=0,c=1/0,_=1/0,l=1/0,b=-1/0,u=-1/0,f=-1/0;for(let p=0;p<i;p++){const t=h[p],i=h[p+1];let g=1/0,d=1/0,C=1/0,v=-1/0,M=-1/0,A=-1/0;if(t<i)for(let e=t;e<i;e++){const t=3*r[e],s=a[t],n=a[t+1],i=a[t+2];g=Math.min(g,s),d=Math.min(d,n),C=Math.min(C,i),v=Math.max(v,s),M=Math.max(M,n),A=Math.max(A,i)}else g=e,d=s,C=n,v=e,M=s,A=n;o[m++]=g,o[m++]=d,o[m++]=C,o[m++]=v,o[m++]=M,o[m++]=A,c=Math.min(c,g),_=Math.min(_,d),l=Math.min(l,C),b=Math.max(b,v),u=Math.max(u,M),f=Math.max(f,A)}return this._aabb[0]=c,this._aabb[1]=_,this._aabb[2]=l,this._aabb[3]=b,this._aabb[4]=u,this._aabb[5]=f,o}_intersectComponents(t,e,s,n,i,o){this._ensureComponentBvh().intersectRay(t,e,o,i,s??void 0,n??void 0)}_ensureComponentBvh(){let t=this._componentBvh;return null==t&&(t=this._needsElevationAlignment?new u(this._positions,j,this._indices,this._components,this._ensureComponentAabbs(),this.geometryMinZ,this.planetCenterZ,this.localMode):new f(this._positions,j,this._indices,this.numTriangles,this._components.offsets),this._componentBvh=t),t}get geometryMinZ(){return this._aabb[2]}get planetCenterZ(){return this._planetCenter[2]}get numTriangles(){return this._indices.length/3}get localMode(){return 2===this.viewingMode}get positions(){return this._positions}get indices(){return this._indices}get aabb(){return this._ensureComponentAabbs(),this._aabb}}const d=a(),C=a(),v=s(),M=n(),A=a(),x=s(),j=3;export{g as IntersectionGeometry};
2
+ import{transpose as t,invert as e}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{sub as i,transformMat3 as o,negate as r}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as h}from"../../../../../geometry/support/aaBoundingBox.js";import{floatArrayFrom as m,floatArrayByteSize as c,newFloatArray as p}from"../../../../../geometry/support/FloatArray.js";import{indexArrayFrom as l,getContinuousIndexArray as _,indexArrayByteSize as b}from"../../../../../geometry/support/Indices.js";import{ComponentObjectElevationAgnosticComponentBVH as u}from"./ComponentObjectElevationAgnosticBVH.js";import{ComponentObjectFixedBVH as f}from"./ComponentObjectFixedBVH.js";class d{constructor(t,e,s,n){this.viewingMode=t,this._components=s,this._needsElevationAlignment=n,this.verticalOffset=null,this.componentVerticalOffsets=null,this._planetCenter=a(),this._componentBvh=null,this._aabb=h();const{indices:i,positions:o}=e,r=o.length/3;this._indices=i?l(i,r):_(r),this._positions=m(o)}get usedMemory(){return c(this._positions)+b(this._indices)}destroy(){this._positions=null,this._indices=null,this._perComponentAabbs=null,this._componentBvh=null}getComponentAabb(t,e){const s=this._ensureComponentAabbs(),n=6*t;return e[0]=s[n],e[1]=s[n+1],e[2]=s[n+2],e[3]=s[n+3],e[4]=s[n+4],e[5]=s[n+5],e}getComponentAabbs(){return this._ensureComponentAabbs()}_ensureComponentAabbs(){return this._perComponentAabbs||(this._perComponentAabbs=this._computePerComponentAabbs()),this._perComponentAabbs}getComponentPositions(t,e){e.indices=this._indices,e.data=this._positions,e.stride=3,e.startIndex=this._components.offsets[t],e.endIndex=this._components.offsets[t+1]}intersectRay(e,s,n,a,h,m,c){const p=v;this._setupIntersect(n,a,h,p);const{position:l}=h,_=i(g,e,l),b=i(C,s,l);o(_,_,p),o(b,b,p);const u=t(x,p);if(1===this.viewingMode){const t=this._planetCenter;r(t,l),o(t,t,p)}const f=(t,e,s,n,i)=>{c(t,e,s?o(A,s,u):null,n,i)};this._intersectComponents(_,b,a,n,f,m)}*intersectScreenPolygon(t,e,s,n,i,o){this._setupIntersect(s,n,i);const r=this._ensureComponentBvh();yield*r.intersectScreenPolygon(t,e,i.toMat4(M),(t,e,s,n)=>o(s,t,n,e),n??void 0,s??void 0)}_setupIntersect(t,s,n,i=v){if(this.verticalOffset=t,this.componentVerticalOffsets=s,e(i,n.rotationScale),1===this.viewingMode){const t=this._planetCenter;r(t,n.position),o(t,t,i)}}_computePerComponentAabbs(){const t=this._aabb,e=.5*(t[0]+t[3]),s=.5*(t[1]+t[4]),n=.5*(t[2]+t[5]),i=this._components.count,o=p(6*i),r=this._indices,a=this._positions,h=this._components.offsets;let m=0,c=1/0,l=1/0,_=1/0,b=-1/0,u=-1/0,f=-1/0;for(let p=0;p<i;p++){const t=h[p],i=h[p+1];let d=1/0,g=1/0,C=1/0,v=-1/0,M=-1/0,A=-1/0;if(t<i)for(let e=t;e<i;e++){const t=3*r[e],s=a[t],n=a[t+1],i=a[t+2];d=Math.min(d,s),g=Math.min(g,n),C=Math.min(C,i),v=Math.max(v,s),M=Math.max(M,n),A=Math.max(A,i)}else d=e,g=s,C=n,v=e,M=s,A=n;o[m++]=d,o[m++]=g,o[m++]=C,o[m++]=v,o[m++]=M,o[m++]=A,c=Math.min(c,d),l=Math.min(l,g),_=Math.min(_,C),b=Math.max(b,v),u=Math.max(u,M),f=Math.max(f,A)}return this._aabb[0]=c,this._aabb[1]=l,this._aabb[2]=_,this._aabb[3]=b,this._aabb[4]=u,this._aabb[5]=f,o}_intersectComponents(t,e,s,n,i,o){this._ensureComponentBvh().intersectRay(t,e,o,i,s??void 0,n??void 0)}_ensureComponentBvh(){let t=this._componentBvh;return null==t&&(t=this._needsElevationAlignment?new u(this._positions,y,this._indices,this._components,this._ensureComponentAabbs(),this.geometryMinZ,this.planetCenterZ,this.localMode):new f(this._positions,y,this._indices,this.numTriangles,this._components.offsets),this._componentBvh=t),t}get geometryMinZ(){return this._aabb[2]}get planetCenterZ(){return this._planetCenter[2]}get numTriangles(){return this._indices.length/3}get localMode(){return 2===this.viewingMode}get positions(){return this._positions}get indices(){return this._indices}get aabb(){return this._ensureComponentAabbs(),this._aabb}}const g=a(),C=a(),v=s(),M=n(),A=a(),x=s(),y=3;export{d as IntersectionGeometry};